--- /srv/reproducible-results/rbuild-debian/r-b-build.eaVzru49/b1/dune-common_2.9.0-6_amd64.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.eaVzru49/b2/dune-common_2.9.0-6_amd64.changes ├── Files │ @@ -1,4 +1,4 @@ │ │ fb10790728edc55510dc7cc21b8c2991 515772 debug optional libdune-common-dev-dbgsym_2.9.0-6_amd64.deb │ ee67b489371b0a14343184d6b580907a 380640 libdevel optional libdune-common-dev_2.9.0-6_amd64.deb │ - e428d4787db009dbf430b1ae133c4e25 3067304 doc optional libdune-common-doc_2.9.0-6_all.deb │ + dd2c8692a0ad2fb352929b913017c683 3062616 doc optional libdune-common-doc_2.9.0-6_all.deb ├── libdune-common-doc_2.9.0-6_all.deb │ ├── file list │ │ @@ -1,3 +1,3 @@ │ │ -rw-r--r-- 0 0 0 4 2023-12-26 18:41:53.000000 debian-binary │ │ --rw-r--r-- 0 0 0 26860 2023-12-26 18:41:53.000000 control.tar.xz │ │ --rw-r--r-- 0 0 0 3040252 2023-12-26 18:41:53.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 26888 2023-12-26 18:41:53.000000 control.tar.xz │ │ +-rw-r--r-- 0 0 0 3035536 2023-12-26 18:41:53.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ │ │ │ ├── line order │ │ │ │ │ @@ -26,39 +26,40 @@ │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00011_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00014.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00014_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00017.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00017_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00020.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00023.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00023_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00026.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00026_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00029.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00029_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00032.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00032_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00035.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00035_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00038.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00038_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00041.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00041_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00044.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00044_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00047.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00047_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00050.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00050_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00053.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00053_source.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00056.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00056_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00059.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00059_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00062.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00062_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00065.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00065_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00068.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00068_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00071.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00071_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00074.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00074_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00077.html │ │ │ │ │ @@ -77,17 +78,16 @@ │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00095_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00098.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00098_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00101.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00101_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00104.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00104_source.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00107.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00107_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00110.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00110_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00113.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00113_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00116.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00116_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00119.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00119_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00122.html │ │ │ │ │ @@ -116,40 +116,39 @@ │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00158.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00158_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00161.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00161_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00164.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00164_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00167.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00167_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00170.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00170_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00173.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00173_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00176.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00176_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00179.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00179_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00182.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00182_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00185.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00185_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00188.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00188_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00191.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00191_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00194.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00194_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00197.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00197_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00200.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00200_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00203.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00203_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00206.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00206_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00209.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00209_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00212.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00212_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00215.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00215_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00218.html │ │ │ │ │ @@ -165,33 +164,34 @@ │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00233.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00233_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00236.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00236_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00239.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00239_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00242.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00242_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00245.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00245_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00248.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00248_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00251.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00251_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00254.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00254_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00257.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00257_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00260.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00260_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00263.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00263_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00266.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00266_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00269.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00269_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00272.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00272_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00275.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00275_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00278.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00278_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00281.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00281_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00284.html │ │ │ │ │ @@ -201,25 +201,24 @@ │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00290.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00290_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00293.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00293_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00296.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00296_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00299.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00299_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00302.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00302_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00305.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00305_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00308.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00311.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00311_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00314.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00314_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00317.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00317_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00320.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00320_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00323.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00323_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00326.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00326_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00329.html │ │ │ │ │ @@ -235,14 +234,15 @@ │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00344.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00344_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00347.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00347_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00350.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00350_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00353.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00353_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00356.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00356_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00359.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00359_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00362.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00362_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00365.html │ ├── data.tar.xz │ │ ├── data.tar │ │ │ ├── file list │ │ │ │ @@ -26,259 +26,259 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2799 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/buildsystem/html/search.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 10569 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/buildsystem/html/searchindex.js │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1934 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/changelog.Debian.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7231 2022-10-20 18:41:15.000000 ./usr/share/doc/libdune-common-doc/changelog.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 9815 2023-01-07 21:56:09.000000 ./usr/share/doc/libdune-common-doc/copyright │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3045 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00002.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14288 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 63256 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3818 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6526 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19607 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 104969 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4959 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6605 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6970 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5356 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 41539 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4979 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6781 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8264 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8731 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 61450 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4310 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17898 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5458 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8314 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8836 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10533 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5325 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10220 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14506 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 54081 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 24039 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 42064 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13871 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20199 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3649 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6713 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11004 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 81300 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 145342 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14005 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 86153 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9861 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20797 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33483 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 357109 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14995 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 142940 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17652 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 42086 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4678 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7628 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4678 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7626 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5384 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8943 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4672 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6796 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5777 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10089 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8690 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15576 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3372 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 88030 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7124 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23206 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5247 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9926 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3949 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5082 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8080 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5278 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22235 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20708 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 66287 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 45125 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15704 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16771 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 48543 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6229 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21246 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17516 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 45459 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 26419 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 61788 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6158 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19960 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6380 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19421 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6586 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 44038 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7783 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12397 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11654 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 55191 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8704 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 26496 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8394 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9499 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 250589 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4394 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6435 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5767 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16722 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4768 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14349 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 24718 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 121580 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6819 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 100137 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6176 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8812 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12096 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 108064 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20821 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 29928 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21252 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 132735 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4748 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6856 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 112071 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5214 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15233 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13585 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 94215 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11616 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 101374 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5638 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33611 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6398 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33437 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6585 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 46321 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3649 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4983 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13149 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 178064 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7592 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 136353 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8766 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 71932 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9019 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 52516 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5984 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 51317 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7409 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33439 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6505 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 39913 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9141 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 172723 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8399 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 46563 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23075 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19865 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 179606 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6612 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19861 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6616 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 58092 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11420 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 290483 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3658 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4980 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5654 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7234 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3899 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7494 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 31467 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6187 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17742 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5049 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23176 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10687 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 108967 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4993 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 31445 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8196 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 148986 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17902 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 167223 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5347 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33493 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4655 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7486 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5275 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11331 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6240 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6782 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4128 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6384 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16097 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7345 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 18651 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9165 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7265 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14139 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6556 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 18103 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7919 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 126603 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5668 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10965 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8194 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 41231 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3384 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 51921 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7356 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9909 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17882 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 79073 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8323 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 40740 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7195 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 151469 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7721 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10469 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8170 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 63385 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14770 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23217 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9721 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 240955 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4125 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4366 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5137 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6662 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 52852 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10469 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33175 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5043 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6951 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6807 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12871 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10991 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22884 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8828 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15690 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13605 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 28676 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5115 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9512 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5980 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21115 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5125 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 29707 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5603 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9347 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 60433 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 127266 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5654 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7234 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5275 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11331 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8690 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15576 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21252 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 132735 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3899 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4128 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11654 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 55191 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14770 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23217 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6176 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8812 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8196 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 148986 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4125 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5356 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 41539 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5125 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 29707 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8704 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 26496 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6585 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 46321 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6612 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19861 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7592 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 136353 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5638 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33611 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3658 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4980 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23075 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5984 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 51317 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13149 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 178064 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11420 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 290483 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7409 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33439 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9141 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 172723 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6398 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33437 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9019 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 52516 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6505 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 39913 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6616 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 58092 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8766 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 71932 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8399 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 46563 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3649 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4983 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11616 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 101374 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19865 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 179606 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5278 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22235 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 45125 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15704 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5214 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15233 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7783 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12397 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17902 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 167223 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6384 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16097 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 26419 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 61788 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20821 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 29928 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6713 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11004 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13871 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20199 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 81300 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 145342 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14005 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 86153 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33483 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 357109 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 24039 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 42064 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3649 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9861 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20797 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3818 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6526 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3372 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 88030 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6970 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7265 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14139 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6187 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17742 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4310 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17898 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7356 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9909 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3384 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 51921 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 60433 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 127266 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5347 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33493 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6586 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 44038 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9721 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 240955 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5247 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9926 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5980 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21115 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7124 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23206 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3949 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7195 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 151469 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4655 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7486 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5777 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10089 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4678 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7626 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4678 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7628 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17652 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 42086 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5384 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8943 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4672 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6796 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5043 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6951 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6380 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19421 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6856 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 112071 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6781 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8264 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17516 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 45459 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14288 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 63256 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13605 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 28676 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12096 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 108064 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8836 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10533 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4394 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6435 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4993 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 31445 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6556 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 18103 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7721 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10469 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8394 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6819 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 100137 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10687 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 108967 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7919 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 126603 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6240 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6782 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5082 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8080 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8731 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 61450 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6807 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12871 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20708 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 66287 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4959 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6605 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9165 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5603 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9347 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4979 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4768 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14349 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5325 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10220 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4748 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5767 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16722 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8170 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 63385 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5049 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23176 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14995 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 142940 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6229 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21246 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4366 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5137 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16771 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 48543 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6662 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 52852 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10469 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33175 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10991 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22884 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8828 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15690 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5668 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10965 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6158 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19960 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19607 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 104969 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5458 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8314 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17882 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 79073 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9499 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 250589 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5115 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9512 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8194 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 41231 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8323 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 40740 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7494 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 31467 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7345 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 18651 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14506 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 54081 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 24718 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 121580 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13585 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 94215 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7897 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00395.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5736 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00396.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 261282 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00397.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 27946 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00397.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 39665 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2473 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 9343 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00399.html │ │ │ │ @@ -1127,15 +1127,15 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5016 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_ade7f944fd3a163752f5cc1af55c988a_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 4572 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_be46aaae597ce098e36afa8d6ef4f49b.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2402 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_be46aaae597ce098e36afa8d6ef4f49b_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 48471 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e151556194dc695299293609645e9437.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 8980 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e151556194dc695299293609645e9437_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3669 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e68e8157741866f444e17edd764ebbae.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 45631 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/doxygen.css │ │ │ │ --rw-r--r-- 0 root (0) root (0) 149319 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dune-common.tag.gz │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 149381 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dune-common.tag.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7704 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/dynsections.js │ │ │ │ -rw-r--r-- 0 root (0) root (0) 51296 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/files.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1145 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_0.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1167 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_0_dark.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1153 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_1.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 403 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_10.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 422 2023-12-26 18:41:53.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_10_dark.png │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00008.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: hybridutilities.hh File Reference │ │ │ │ +dune-common: documentation.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,85 +70,46 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
│ │ │ │ -
hybridutilities.hh File Reference
│ │ │ │ +Enumerations
│ │ │ │ +
documentation.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <tuple>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/typeutilities.hh>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/assertandreturn.hh>
│ │ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ │ -
│ │ │ │ + │ │ │ │ +

Documentation related stuff. │ │ │ │ +More...

│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

struct  Dune::ImplementationDefined
 Dummy struct used for documentation purposes. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Hybrid
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Functions

template<class T >
constexpr auto Dune::Hybrid::size (const T &t)
 Size query.
 
template<class Container , class Index >
constexpr decltype(auto) Dune::Hybrid::elementAt (Container &&c, Index &&i)
 Get element at given position from container.
 
template<class Begin , class End >
constexpr auto Dune::Hybrid::integralRange (const Begin &begin, const End &end)
 Create an integral range.
 
template<class End >
constexpr auto Dune::Hybrid::integralRange (const End &end)
 Create an integral range starting from 0.
 
template<class Range , class F >
constexpr void Dune::Hybrid::forEach (Range &&range, F &&f)
 Range based for loop.
 
template<class Range , class T , class F >
constexpr T Dune::Hybrid::accumulate (Range &&range, T value, F &&f)
 Accumulate values.
 
template<class Condition , class IfFunc , class ElseFunc >
decltype(auto) Dune::Hybrid::ifElse (const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
 A conditional expression.
 
template<class Condition , class IfFunc >
void Dune::Hybrid::ifElse (const Condition &condition, IfFunc &&ifFunc)
 A conditional expression.
 
template<class T1 , class T2 >
constexpr auto Dune::Hybrid::equals (T1 &&t1, T2 &&t2)
 Equality comparison.
 
template<class Cases , class Value , class Branches , class ElseBranch >
constexpr decltype(auto) Dune::Hybrid::switchCases (const Cases &cases, const Value &value, Branches &&branches, ElseBranch &&elseBranch)
 Switch statement.
 
template<class Cases , class Value , class Branches >
constexpr void Dune::Hybrid::switchCases (const Cases &cases, const Value &value, Branches &&branches)
 Switch statement.
 

│ │ │ │ +Enumerations

enum  { Dune::implementationDefined │ │ │ │ + }
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Documentation related stuff.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,77 +1,25 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -hybridutilities.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_a_s_s_e_r_t_a_n_d_r_e_t_u_r_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _E_n_u_m_e_r_a_t_i_o_n_s │ │ │ │ │ +documentation.hh File Reference │ │ │ │ │ +Documentation related stuff. _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 │ │ │ │ │ +struct   _D_u_n_e_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_D_e_f_i_n_e_d │ │ │ │ │ +  Dummy struct used for documentation purposes. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_H_y_b_r_i_d │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_s_i_z_e (const T &t) │ │ │ │ │ -  Size query. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -constexpr decltype(auto)  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_e_l_e_m_e_n_t_A_t (Container &&c, Index &&i) │ │ │ │ │ -  Get element at given position from container. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_i_n_t_e_g_r_a_l_R_a_n_g_e (const Begin &begin, │ │ │ │ │ - const End &end) │ │ │ │ │ -  Create an integral range. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_i_n_t_e_g_r_a_l_R_a_n_g_e (const End &end) │ │ │ │ │ -  Create an integral range starting from 0. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr void  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_f_o_r_E_a_c_h (Range &&_r_a_n_g_e, F &&f) │ │ │ │ │ -  Range based for loop. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr T  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_a_c_c_u_m_u_l_a_t_e (Range &&_r_a_n_g_e, T value, F │ │ │ │ │ - &&f) │ │ │ │ │ -  Accumulate values. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - decltype(auto)  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_i_f_E_l_s_e (const Condition &condition, │ │ │ │ │ - IfFunc &&ifFunc, ElseFunc &&elseFunc) │ │ │ │ │ -  A conditional expression. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_i_f_E_l_s_e (const Condition &condition, │ │ │ │ │ - IfFunc &&ifFunc) │ │ │ │ │ -  A conditional expression. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_e_q_u_a_l_s (T1 &&t1, T2 &&t2) │ │ │ │ │ -  Equality comparison. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -constexpr decltype(auto)  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_s_w_i_t_c_h_C_a_s_e_s (const Cases &cases, const │ │ │ │ │ - Value &value, Branches &&branches, ElseBranch │ │ │ │ │ - &&elseBranch) │ │ │ │ │ -  Switch statement. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr void  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_s_w_i_t_c_h_C_a_s_e_s (const Cases &cases, const │ │ │ │ │ - Value &value, Branches &&branches) │ │ │ │ │ -  Switch statement. │ │ │ │ │ +EEnnuummeerraattiioonnss │ │ │ │ │ +enum   { _D_u_n_e_:_:_i_m_p_l_e_m_e_n_t_a_t_i_o_n_D_e_f_i_n_e_d } │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Documentation related stuff. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: hybridutilities.hh Source File │ │ │ │ +dune-common: documentation.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,375 +74,38 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
hybridutilities.hh
│ │ │ │ +
documentation.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH
│ │ │ │ -
6#define DUNE_COMMON_HYBRIDUTILITIES_HH
│ │ │ │ -
7
│ │ │ │ -
8#include <tuple>
│ │ │ │ -
9#include <utility>
│ │ │ │ -
10
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
17
│ │ │ │ -
18
│ │ │ │ -
19
│ │ │ │ -
20namespace Dune {
│ │ │ │ -
│ │ │ │ -
21namespace Hybrid {
│ │ │ │ -
22
│ │ │ │ -
23namespace Impl {
│ │ │ │ -
24
│ │ │ │ -
25 // Try if tuple_size is implemented for class
│ │ │ │ -
26 template<class T, int i>
│ │ │ │ -
27 constexpr auto size(const Dune::FieldVector<T, i>&, const PriorityTag<5>&)
│ │ │ │ -
28 -> decltype(std::integral_constant<std::size_t,i>())
│ │ │ │ -
29 {
│ │ │ │ -
30 return {};
│ │ │ │ -
31 }
│ │ │ │ -
32
│ │ │ │ -
33 // Try if tuple_size is implemented for class
│ │ │ │ -
34 template<class T>
│ │ │ │ -
35 constexpr auto size(const T&, const PriorityTag<3>&)
│ │ │ │ -
36 -> decltype(std::integral_constant<std::size_t,std::tuple_size<T>::value>())
│ │ │ │ -
37 {
│ │ │ │ -
38 return {};
│ │ │ │ -
39 }
│ │ │ │ -
40
│ │ │ │ -
41 // Try if there's a static constexpr size()
│ │ │ │ -
42 template<class T>
│ │ │ │ -
43 constexpr auto size(const T&, const PriorityTag<1>&)
│ │ │ │ -
44 -> decltype(std::integral_constant<std::size_t,T::size()>())
│ │ │ │ -
45 {
│ │ │ │ -
46 return {};
│ │ │ │ -
47 }
│ │ │ │ -
48
│ │ │ │ -
49 // As a last resort try if there's a static constexpr size()
│ │ │ │ -
50 template<class T>
│ │ │ │ -
51 constexpr auto size(const T& t, const PriorityTag<0>&)
│ │ │ │ -
52 {
│ │ │ │ -
53 return t.size();
│ │ │ │ -
54 }
│ │ │ │ -
55
│ │ │ │ -
56} // namespace Impl
│ │ │ │ -
57
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_COMMON_DOCUMENTATION_HH
│ │ │ │ +
7#define DUNE_COMMON_DOCUMENTATION_HH
│ │ │ │ +
8
│ │ │ │ +
13namespace Dune {
│ │ │ │ +
14
│ │ │ │ + │ │ │ │ +
43
│ │ │ │ + │ │ │ │ +
56
│ │ │ │ +
57}
│ │ │ │
58
│ │ │ │
59
│ │ │ │ -
81template<class T>
│ │ │ │ -
│ │ │ │ -
82constexpr auto size(const T& t)
│ │ │ │ -
83{
│ │ │ │ -
84 return Impl::size(t, PriorityTag<42>());
│ │ │ │ -
85}
│ │ │ │ -
│ │ │ │ -
86
│ │ │ │ -
87
│ │ │ │ -
88
│ │ │ │ -
89namespace Impl {
│ │ │ │ -
90
│ │ │ │ -
91 template<class Container, class Index,
│ │ │ │ -
92 std::enable_if_t<IsTuple<std::decay_t<Container>>::value, int> = 0>
│ │ │ │ -
93 constexpr decltype(auto) elementAt(Container&& c, Index&&, PriorityTag<2>)
│ │ │ │ -
94 {
│ │ │ │ -
95 return std::get<std::decay_t<Index>::value>(c);
│ │ │ │ -
96 }
│ │ │ │ -
97
│ │ │ │ -
98 template<class T, T... t, class Index>
│ │ │ │ -
99 constexpr decltype(auto) elementAt(std::integer_sequence<T, t...> c, Index, PriorityTag<1>)
│ │ │ │ -
100 {
│ │ │ │ -
101 return Dune::integerSequenceEntry(c, std::integral_constant<std::size_t, Index::value>());
│ │ │ │ -
102 }
│ │ │ │ -
103
│ │ │ │ -
104 template<class Container, class Index>
│ │ │ │ -
105 constexpr decltype(auto) elementAt(Container&& c, Index&& i, PriorityTag<0>)
│ │ │ │ -
106 {
│ │ │ │ -
107 return c[i];
│ │ │ │ -
108 }
│ │ │ │ -
109
│ │ │ │ -
110} // namespace Impl
│ │ │ │ -
111
│ │ │ │ -
112
│ │ │ │ -
113
│ │ │ │ -
134template<class Container, class Index>
│ │ │ │ -
│ │ │ │ -
135constexpr decltype(auto) elementAt(Container&& c, Index&& i)
│ │ │ │ -
136{
│ │ │ │ -
137 return Impl::elementAt(std::forward<Container>(c), std::forward<Index>(i), PriorityTag<42>());
│ │ │ │ -
138}
│ │ │ │ -
│ │ │ │ -
139
│ │ │ │ -
140
│ │ │ │ -
141
│ │ │ │ -
142namespace Impl {
│ │ │ │ -
143
│ │ │ │ -
144 template<class Begin, class End,
│ │ │ │ -
145 std::enable_if_t<IsIntegralConstant<Begin>::value and IsIntegralConstant<End>::value, int> = 0>
│ │ │ │ -
146 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/, const PriorityTag<1>&)
│ │ │ │ -
147 {
│ │ │ │ -
148 static_assert(Begin::value <= End::value, "You cannot create an integralRange where end<begin");
│ │ │ │ - │ │ │ │ -
150 }
│ │ │ │ -
151
│ │ │ │ -
152 // This should be constexpr but gcc-4.9 does not support
│ │ │ │ -
153 // the relaxed constexpr requirements. Hence for being
│ │ │ │ -
154 // constexpr the function body can only contain a return
│ │ │ │ -
155 // statement and no assertion before this.
│ │ │ │ -
156 template<class Begin, class End>
│ │ │ │ -
157 constexpr auto integralRange(const Begin& begin, const End& end, const PriorityTag<0>&)
│ │ │ │ -
158 {
│ │ │ │ -
159 return DUNE_ASSERT_AND_RETURN(begin<=end, Dune::IntegralRange<End>(begin, end));
│ │ │ │ -
160 }
│ │ │ │ -
161
│ │ │ │ -
162} // namespace Impl
│ │ │ │ -
163
│ │ │ │ -
164
│ │ │ │ -
165
│ │ │ │ -
183template<class Begin, class End>
│ │ │ │ -
│ │ │ │ -
184constexpr auto integralRange(const Begin& begin, const End& end)
│ │ │ │ -
185{
│ │ │ │ -
186 return Impl::integralRange(begin, end, PriorityTag<42>());
│ │ │ │ -
187}
│ │ │ │ -
│ │ │ │ -
188
│ │ │ │ -
202template<class End>
│ │ │ │ -
│ │ │ │ -
203constexpr auto integralRange(const End& end)
│ │ │ │ -
204{
│ │ │ │ -
205 return Impl::integralRange(Dune::Indices::_0, end, PriorityTag<42>());
│ │ │ │ -
206}
│ │ │ │ -
│ │ │ │ -
207
│ │ │ │ -
208
│ │ │ │ -
209
│ │ │ │ -
210namespace Impl {
│ │ │ │ -
211
│ │ │ │ -
212 template<class T>
│ │ │ │ -
213 constexpr void evaluateFoldExpression(std::initializer_list<T>&&)
│ │ │ │ -
214 {}
│ │ │ │ -
215
│ │ │ │ -
216 template<class Range, class F, class Index, Index... i>
│ │ │ │ -
217 constexpr void forEachIndex(Range&& range, F&& f, std::integer_sequence<Index, i...>)
│ │ │ │ -
218 {
│ │ │ │ -
219 evaluateFoldExpression<int>({(f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)...});
│ │ │ │ -
220 }
│ │ │ │ -
221
│ │ │ │ -
222 template<class F, class Index, Index... i>
│ │ │ │ -
223 constexpr void forEach(std::integer_sequence<Index, i...> /*range*/, F&& f, PriorityTag<2>)
│ │ │ │ -
224 {
│ │ │ │ -
225 evaluateFoldExpression<int>({(f(std::integral_constant<Index,i>()), 0)...});
│ │ │ │ -
226 }
│ │ │ │ -
227
│ │ │ │ -
228
│ │ │ │ -
229 template<class Range, class F,
│ │ │ │ -
230 std::enable_if_t<IsIntegralConstant<decltype(Hybrid::size(std::declval<Range>()))>::value, int> = 0>
│ │ │ │ -
231 constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)
│ │ │ │ -
232 {
│ │ │ │ -
233 auto size = Hybrid::size(range);
│ │ │ │ -
234 auto indices = std::make_index_sequence<size>();
│ │ │ │ -
235 (forEachIndex)(std::forward<Range>(range), std::forward<F>(f), indices);
│ │ │ │ -
236 }
│ │ │ │ -
237
│ │ │ │ -
238 template<class Range, class F>
│ │ │ │ -
239 constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)
│ │ │ │ -
240 {
│ │ │ │ -
241 for(auto&& e : range)
│ │ │ │ -
242 f(e);
│ │ │ │ -
243 }
│ │ │ │ -
244
│ │ │ │ -
245} // namespace Impl
│ │ │ │ -
246
│ │ │ │ -
247
│ │ │ │ -
248
│ │ │ │ -
267template<class Range, class F>
│ │ │ │ -
│ │ │ │ -
268constexpr void forEach(Range&& range, F&& f)
│ │ │ │ -
269{
│ │ │ │ -
270 Impl::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>());
│ │ │ │ -
271}
│ │ │ │ -
│ │ │ │ -
272
│ │ │ │ -
273
│ │ │ │ -
274
│ │ │ │ -
290template<class Range, class T, class F>
│ │ │ │ -
│ │ │ │ -
291constexpr T accumulate(Range&& range, T value, F&& f)
│ │ │ │ -
292{
│ │ │ │ -
293 forEach(std::forward<Range>(range), [&](auto&& entry) {
│ │ │ │ -
294 value = f(value, entry);
│ │ │ │ -
295 });
│ │ │ │ -
296 return value;
│ │ │ │ -
297}
│ │ │ │ -
│ │ │ │ -
298
│ │ │ │ -
299
│ │ │ │ -
300
│ │ │ │ -
301namespace Impl {
│ │ │ │ -
302
│ │ │ │ -
303 struct Id {
│ │ │ │ -
304 template<class T>
│ │ │ │ -
305 constexpr T operator()(T&& x) const {
│ │ │ │ -
306 return std::forward<T>(x);
│ │ │ │ -
307 }
│ │ │ │ -
308 };
│ │ │ │ -
309
│ │ │ │ -
310 template<class IfFunc, class ElseFunc>
│ │ │ │ -
311 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc, ElseFunc&& /*elseFunc*/)
│ │ │ │ -
312 {
│ │ │ │ -
313 return ifFunc(Id{});
│ │ │ │ -
314 }
│ │ │ │ -
315
│ │ │ │ -
316 template<class IfFunc, class ElseFunc>
│ │ │ │ -
317 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/, ElseFunc&& elseFunc)
│ │ │ │ -
318 {
│ │ │ │ -
319 return elseFunc(Id{});
│ │ │ │ -
320 }
│ │ │ │ -
321
│ │ │ │ -
322 template<class IfFunc, class ElseFunc>
│ │ │ │ -
323 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
│ │ │ │ -
324 {
│ │ │ │ -
325 if (condition)
│ │ │ │ -
326 return ifFunc(Id{});
│ │ │ │ -
327 else
│ │ │ │ -
328 return elseFunc(Id{});
│ │ │ │ -
329 }
│ │ │ │ -
330
│ │ │ │ -
331} // namespace Impl
│ │ │ │ -
332
│ │ │ │ -
333
│ │ │ │ -
334
│ │ │ │ -
355template<class Condition, class IfFunc, class ElseFunc>
│ │ │ │ -
│ │ │ │ -
356decltype(auto) ifElse(const Condition& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
│ │ │ │ -
357{
│ │ │ │ -
358 return Impl::ifElse(condition, std::forward<IfFunc>(ifFunc), std::forward<ElseFunc>(elseFunc));
│ │ │ │ -
359}
│ │ │ │ -
│ │ │ │ -
360
│ │ │ │ -
368template<class Condition, class IfFunc>
│ │ │ │ -
│ │ │ │ -
369void ifElse(const Condition& condition, IfFunc&& ifFunc)
│ │ │ │ -
370{
│ │ │ │ -
371 ifElse(condition, std::forward<IfFunc>(ifFunc), [](auto&&) {});
│ │ │ │ -
372}
│ │ │ │ -
│ │ │ │ -
373
│ │ │ │ -
374
│ │ │ │ -
375
│ │ │ │ -
376namespace Impl {
│ │ │ │ -
377
│ │ │ │ -
378 template<class T1, class T2>
│ │ │ │ -
379 constexpr auto equals(const T1& /*t1*/, const T2& /*t2*/, PriorityTag<1>) -> decltype(T1::value, T2::value, std::integral_constant<bool,T1::value == T2::value>())
│ │ │ │ -
380 { return {}; }
│ │ │ │ -
381
│ │ │ │ -
382 template<class T1, class T2>
│ │ │ │ -
383 constexpr auto equals(const T1& t1, const T2& t2, PriorityTag<0>)
│ │ │ │ -
384 {
│ │ │ │ -
385 return t1==t2;
│ │ │ │ -
386 }
│ │ │ │ -
387
│ │ │ │ -
388} // namespace Impl
│ │ │ │ -
389
│ │ │ │ -
390
│ │ │ │ -
391
│ │ │ │ -
401template<class T1, class T2>
│ │ │ │ -
│ │ │ │ -
402constexpr auto equals(T1&& t1, T2&& t2)
│ │ │ │ -
403{
│ │ │ │ -
404 return Impl::equals(std::forward<T1>(t1), std::forward<T2>(t2), PriorityTag<1>());
│ │ │ │ -
405}
│ │ │ │ -
│ │ │ │ -
406
│ │ │ │ -
407
│ │ │ │ -
408
│ │ │ │ -
409namespace Impl {
│ │ │ │ -
410
│ │ │ │ -
411 template<class Result, class T, class Value, class Branches, class ElseBranch>
│ │ │ │ -
412 constexpr Result switchCases(std::integer_sequence<T>, const Value& /*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch)
│ │ │ │ -
413 {
│ │ │ │ -
414 return elseBranch();
│ │ │ │ -
415 }
│ │ │ │ -
416
│ │ │ │ -
417 template<class Result, class T, T t0, T... tt, class Value, class Branches, class ElseBranch>
│ │ │ │ -
418 constexpr Result switchCases(std::integer_sequence<T, t0, tt...>, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
│ │ │ │ -
419 {
│ │ │ │ -
420 return ifElse(
│ │ │ │ -
421 Hybrid::equals(std::integral_constant<T, t0>(), value),
│ │ │ │ -
422 [&](auto id) -> decltype(auto) {
│ │ │ │ -
423 return id(branches)(std::integral_constant<T, t0>());
│ │ │ │ -
424 }, [&](auto id) -> decltype(auto) {
│ │ │ │ -
425 return Impl::switchCases<Result>(id(std::integer_sequence<T, tt...>()), value, branches, elseBranch);
│ │ │ │ -
426 });
│ │ │ │ -
427 }
│ │ │ │ -
428
│ │ │ │ -
429} // namespace Impl
│ │ │ │ -
430
│ │ │ │ -
431
│ │ │ │ -
432
│ │ │ │ -
460template<class Cases, class Value, class Branches, class ElseBranch>
│ │ │ │ -
│ │ │ │ -
461constexpr decltype(auto) switchCases(const Cases& cases, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
│ │ │ │ -
462{
│ │ │ │ -
463 return Impl::switchCases<decltype(elseBranch())>(cases, value, std::forward<Branches>(branches), std::forward<ElseBranch>(elseBranch));
│ │ │ │ -
464}
│ │ │ │ -
│ │ │ │ -
465
│ │ │ │ -
486template<class Cases, class Value, class Branches>
│ │ │ │ -
│ │ │ │ -
487constexpr void switchCases(const Cases& cases, const Value& value, Branches&& branches)
│ │ │ │ -
488{
│ │ │ │ -
489 Impl::switchCases<void>(cases, value, std::forward<Branches>(branches), []() {});
│ │ │ │ -
490}
│ │ │ │ -
│ │ │ │ -
491
│ │ │ │ -
492
│ │ │ │ -
493} // namespace Hybrid
│ │ │ │ -
│ │ │ │ -
494} // namespace Dune
│ │ │ │ -
495
│ │ │ │ -
496
│ │ │ │ -
497#endif // #ifndef DUNE_COMMON_HYBRIDUTILITIES_HH
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ - │ │ │ │ -
Implements a vector constructed from a given type representing a field and a compile-time given size.
│ │ │ │ - │ │ │ │ -
Utilities for reduction like operations on ranges.
│ │ │ │ -
Utilities for type computations, constraining overloads, ...
│ │ │ │ -
constexpr index_constant< 0 > _0
Compile time index with value 0.
Definition indices.hh:53
│ │ │ │ -
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:300
│ │ │ │ -
constexpr auto size(const T &t)
Size query.
Definition hybridutilities.hh:82
│ │ │ │ -
constexpr auto equals(T1 &&t1, T2 &&t2)
Equality comparison.
Definition hybridutilities.hh:402
│ │ │ │ -
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition hybridutilities.hh:268
│ │ │ │ -
constexpr decltype(auto) switchCases(const Cases &cases, const Value &value, Branches &&branches, ElseBranch &&elseBranch)
Switch statement.
Definition hybridutilities.hh:461
│ │ │ │ -
decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
A conditional expression.
Definition hybridutilities.hh:356
│ │ │ │ -
constexpr auto integralRange(const Begin &begin, const End &end)
Create an integral range.
Definition hybridutilities.hh:184
│ │ │ │ -
constexpr decltype(auto) elementAt(Container &&c, Index &&i)
Get element at given position from container.
Definition hybridutilities.hh:135
│ │ │ │ -
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition hybridutilities.hh:291
│ │ │ │ -
constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::integral_constant< std::size_t, index > i)
Get entry of std::integer_sequence.
Definition typetraits.hh:462
│ │ │ │ -
#define DUNE_ASSERT_AND_RETURN(C, X)
Asserts a condition and return on success in constexpr context.
Definition assertandreturn.hh:22
│ │ │ │ +
60#endif // DUNE_COMMON_DOCUMENTATION_HH
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
vector space out of a tensor product of fields.
Definition fvector.hh:95
│ │ │ │ -
dynamic integer range for use in range-based for loops
Definition rangeutilities.hh:175
│ │ │ │ -
static integer range for use in range-based for loops
Definition rangeutilities.hh:225
│ │ │ │ -
Check if T is an std::integral_constant<I, i>
Definition typetraits.hh:384
│ │ │ │ -
Helper class for tagging priorities.
Definition typeutilities.hh:73
│ │ │ │ +
@ implementationDefined
Definition documentation.hh:55
│ │ │ │ +
Dummy struct used for documentation purposes.
Definition documentation.hh:42
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,433 +1,38 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -hybridutilities.hh │ │ │ │ │ +documentation.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH │ │ │ │ │ -6#define DUNE_COMMON_HYBRIDUTILITIES_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -12#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -13#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ -14#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_a_s_s_e_r_t_a_n_d_r_e_t_u_r_n_._h_h> │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -17 │ │ │ │ │ -18 │ │ │ │ │ -19 │ │ │ │ │ -20namespace _D_u_n_e { │ │ │ │ │ -_2_1namespace Hybrid { │ │ │ │ │ -22 │ │ │ │ │ -23namespace Impl { │ │ │ │ │ -24 │ │ │ │ │ -25 // Try if tuple_size is implemented for class │ │ │ │ │ -26 template │ │ │ │ │ -27 constexpr auto size(const _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _i_>&, const _P_r_i_o_r_i_t_y_T_a_g_<_5_>&) │ │ │ │ │ -28 -> decltype(std::integral_constant()) │ │ │ │ │ -29 { │ │ │ │ │ -30 return {}; │ │ │ │ │ -31 } │ │ │ │ │ -32 │ │ │ │ │ -33 // Try if tuple_size is implemented for class │ │ │ │ │ -34 template │ │ │ │ │ -35 constexpr auto size(const T&, const _P_r_i_o_r_i_t_y_T_a_g_<_3_>&) │ │ │ │ │ -36 -> decltype(std::integral_constant::value>()) │ │ │ │ │ -37 { │ │ │ │ │ -38 return {}; │ │ │ │ │ -39 } │ │ │ │ │ -40 │ │ │ │ │ -41 // Try if there's a static constexpr size() │ │ │ │ │ -42 template │ │ │ │ │ -43 constexpr auto size(const T&, const _P_r_i_o_r_i_t_y_T_a_g_<_1_>&) │ │ │ │ │ -44 -> decltype(std::integral_constant()) │ │ │ │ │ -45 { │ │ │ │ │ -46 return {}; │ │ │ │ │ -47 } │ │ │ │ │ -48 │ │ │ │ │ -49 // As a last resort try if there's a static constexpr size() │ │ │ │ │ -50 template │ │ │ │ │ -51 constexpr auto size(const T& t, const _P_r_i_o_r_i_t_y_T_a_g_<_0_>&) │ │ │ │ │ -52 { │ │ │ │ │ -53 return t.size(); │ │ │ │ │ -54 } │ │ │ │ │ -55 │ │ │ │ │ -56} // namespace Impl │ │ │ │ │ -57 │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_COMMON_DOCUMENTATION_HH │ │ │ │ │ +7#define DUNE_COMMON_DOCUMENTATION_HH │ │ │ │ │ +8 │ │ │ │ │ +13namespace _D_u_n_e { │ │ │ │ │ +14 │ │ │ │ │ +_4_2 struct _I_m_p_l_e_m_e_n_t_a_t_i_o_n_D_e_f_i_n_e_d {}; │ │ │ │ │ +43 │ │ │ │ │ +_5_5 enum { _i_m_p_l_e_m_e_n_t_a_t_i_o_n_D_e_f_i_n_e_d }; │ │ │ │ │ +56 │ │ │ │ │ +57} │ │ │ │ │ 58 │ │ │ │ │ 59 │ │ │ │ │ -81template │ │ │ │ │ -_8_2constexpr auto _s_i_z_e(const T& t) │ │ │ │ │ -83{ │ │ │ │ │ -84 return Impl::size(t, _P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ -85} │ │ │ │ │ -86 │ │ │ │ │ -87 │ │ │ │ │ -88 │ │ │ │ │ -89namespace Impl { │ │ │ │ │ -90 │ │ │ │ │ -91 template>::value, int> = 0> │ │ │ │ │ -93 constexpr decltype(auto) elementAt(Container&& c, Index&&, _P_r_i_o_r_i_t_y_T_a_g_<_2_>) │ │ │ │ │ -94 { │ │ │ │ │ -95 return std::get::value>(c); │ │ │ │ │ -96 } │ │ │ │ │ -97 │ │ │ │ │ -98 template │ │ │ │ │ -99 constexpr decltype(auto) elementAt(std::integer_sequence c, Index, │ │ │ │ │ -PriorityTag<1>) │ │ │ │ │ -100 { │ │ │ │ │ -101 return _D_u_n_e_:_:_i_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y(c, std::integral_constant()); │ │ │ │ │ -102 } │ │ │ │ │ -103 │ │ │ │ │ -104 template │ │ │ │ │ -105 constexpr decltype(auto) elementAt(Container&& c, Index&& i, │ │ │ │ │ -PriorityTag<0>) │ │ │ │ │ -106 { │ │ │ │ │ -107 return c[i]; │ │ │ │ │ -108 } │ │ │ │ │ -109 │ │ │ │ │ -110} // namespace Impl │ │ │ │ │ -111 │ │ │ │ │ -112 │ │ │ │ │ -113 │ │ │ │ │ -134template │ │ │ │ │ -_1_3_5constexpr decltype(auto) _e_l_e_m_e_n_t_A_t(Container&& c, Index&& i) │ │ │ │ │ -136{ │ │ │ │ │ -137 return Impl::elementAt(std::forward(c), std::forward(i), │ │ │ │ │ -_P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ -138} │ │ │ │ │ -139 │ │ │ │ │ -140 │ │ │ │ │ -141 │ │ │ │ │ -142namespace Impl { │ │ │ │ │ -143 │ │ │ │ │ -144 template::value and │ │ │ │ │ -_I_s_I_n_t_e_g_r_a_l_C_o_n_s_t_a_n_t_<_E_n_d_>_:_:_v_a_l_u_e, int> = 0> │ │ │ │ │ -146 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/, │ │ │ │ │ -const _P_r_i_o_r_i_t_y_T_a_g_<_1_>&) │ │ │ │ │ -147 { │ │ │ │ │ -148 static_assert(Begin::value <= End::value, "You cannot create an │ │ │ │ │ -integralRange where end(); │ │ │ │ │ -150 } │ │ │ │ │ -151 │ │ │ │ │ -152 // This should be constexpr but gcc-4.9 does not support │ │ │ │ │ -153 // the relaxed constexpr requirements. Hence for being │ │ │ │ │ -154 // constexpr the function body can only contain a return │ │ │ │ │ -155 // statement and no assertion before this. │ │ │ │ │ -156 template │ │ │ │ │ -157 constexpr auto integralRange(const Begin& begin, const End& end, const │ │ │ │ │ -PriorityTag<0>&) │ │ │ │ │ -158 { │ │ │ │ │ -159 return _D_U_N_E___A_S_S_E_R_T___A_N_D___R_E_T_U_R_N(begin<=end, _D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_<_E_n_d_>(begin, │ │ │ │ │ -end)); │ │ │ │ │ -160 } │ │ │ │ │ -161 │ │ │ │ │ -162} // namespace Impl │ │ │ │ │ -163 │ │ │ │ │ -164 │ │ │ │ │ -165 │ │ │ │ │ -183template │ │ │ │ │ -_1_8_4constexpr auto _i_n_t_e_g_r_a_l_R_a_n_g_e(const Begin& begin, const End& end) │ │ │ │ │ -185{ │ │ │ │ │ -186 return Impl::integralRange(begin, end, _P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ -187} │ │ │ │ │ -188 │ │ │ │ │ -202template │ │ │ │ │ -_2_0_3constexpr auto _i_n_t_e_g_r_a_l_R_a_n_g_e(const End& end) │ │ │ │ │ -204{ │ │ │ │ │ -205 return Impl::integralRange(_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___0, end, _P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ -206} │ │ │ │ │ -207 │ │ │ │ │ -208 │ │ │ │ │ -209 │ │ │ │ │ -210namespace Impl { │ │ │ │ │ -211 │ │ │ │ │ -212 template │ │ │ │ │ -213 constexpr void evaluateFoldExpression(std::initializer_list&&) │ │ │ │ │ -214 {} │ │ │ │ │ -215 │ │ │ │ │ -216 template │ │ │ │ │ -217 constexpr void forEachIndex(Range&& _r_a_n_g_e, F&& f, std:: │ │ │ │ │ -integer_sequence) │ │ │ │ │ -218 { │ │ │ │ │ -219 evaluateFoldExpression({(f(_H_y_b_r_i_d_:_:_e_l_e_m_e_n_t_A_t(_r_a_n_g_e, std:: │ │ │ │ │ -integral_constant())), 0)...}); │ │ │ │ │ -220 } │ │ │ │ │ -221 │ │ │ │ │ -222 template │ │ │ │ │ -223 constexpr void forEach(std::integer_sequence /*range*/, F&& f, │ │ │ │ │ -PriorityTag<2>) │ │ │ │ │ -224 { │ │ │ │ │ -225 evaluateFoldExpression({(f(std::integral_constant()), │ │ │ │ │ -0)...}); │ │ │ │ │ -226 } │ │ │ │ │ -227 │ │ │ │ │ -228 │ │ │ │ │ -229 template()))>::value, int> = 0> │ │ │ │ │ -231 constexpr void forEach(Range&& _r_a_n_g_e, F&& f, PriorityTag<1>) │ │ │ │ │ -232 { │ │ │ │ │ -233 auto size = _H_y_b_r_i_d_:_:_s_i_z_e(_r_a_n_g_e); │ │ │ │ │ -234 auto indices = std::make_index_sequence(); │ │ │ │ │ -235 (forEachIndex)(std::forward(_r_a_n_g_e), std::forward(f), indices); │ │ │ │ │ -236 } │ │ │ │ │ -237 │ │ │ │ │ -238 template │ │ │ │ │ -239 constexpr void forEach(Range&& _r_a_n_g_e, F&& f, PriorityTag<0>) │ │ │ │ │ -240 { │ │ │ │ │ -241 for(auto&& e : _r_a_n_g_e) │ │ │ │ │ -242 f(e); │ │ │ │ │ -243 } │ │ │ │ │ -244 │ │ │ │ │ -245} // namespace Impl │ │ │ │ │ -246 │ │ │ │ │ -247 │ │ │ │ │ -248 │ │ │ │ │ -267template │ │ │ │ │ -_2_6_8constexpr void _f_o_r_E_a_c_h(Range&& _r_a_n_g_e, F&& f) │ │ │ │ │ -269{ │ │ │ │ │ -270 Impl::forEach(std::forward(_r_a_n_g_e), std::forward(f), │ │ │ │ │ -_P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ -271} │ │ │ │ │ -272 │ │ │ │ │ -273 │ │ │ │ │ -274 │ │ │ │ │ -290template │ │ │ │ │ -_2_9_1constexpr T _a_c_c_u_m_u_l_a_t_e(Range&& _r_a_n_g_e, T value, F&& f) │ │ │ │ │ -292{ │ │ │ │ │ -293 _f_o_r_E_a_c_h(std::forward(_r_a_n_g_e), [&](auto&& entry) { │ │ │ │ │ -294 value = f(value, entry); │ │ │ │ │ -295 }); │ │ │ │ │ -296 return value; │ │ │ │ │ -297} │ │ │ │ │ -298 │ │ │ │ │ -299 │ │ │ │ │ -300 │ │ │ │ │ -301namespace Impl { │ │ │ │ │ -302 │ │ │ │ │ -303 struct Id { │ │ │ │ │ -304 template │ │ │ │ │ -305 constexpr T operator()(T&& x) const { │ │ │ │ │ -306 return std::forward(x); │ │ │ │ │ -307 } │ │ │ │ │ -308 }; │ │ │ │ │ -309 │ │ │ │ │ -310 template │ │ │ │ │ -311 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc, ElseFunc&& │ │ │ │ │ -/*elseFunc*/) │ │ │ │ │ -312 { │ │ │ │ │ -313 return ifFunc(Id{}); │ │ │ │ │ -314 } │ │ │ │ │ -315 │ │ │ │ │ -316 template │ │ │ │ │ -317 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/, │ │ │ │ │ -ElseFunc&& elseFunc) │ │ │ │ │ -318 { │ │ │ │ │ -319 return elseFunc(Id{}); │ │ │ │ │ -320 } │ │ │ │ │ -321 │ │ │ │ │ -322 template │ │ │ │ │ -323 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&& │ │ │ │ │ -elseFunc) │ │ │ │ │ -324 { │ │ │ │ │ -325 if (condition) │ │ │ │ │ -326 return ifFunc(Id{}); │ │ │ │ │ -327 else │ │ │ │ │ -328 return elseFunc(Id{}); │ │ │ │ │ -329 } │ │ │ │ │ -330 │ │ │ │ │ -331} // namespace Impl │ │ │ │ │ -332 │ │ │ │ │ -333 │ │ │ │ │ -334 │ │ │ │ │ -355template │ │ │ │ │ -_3_5_6decltype(auto) _i_f_E_l_s_e(const Condition& condition, IfFunc&& ifFunc, │ │ │ │ │ -ElseFunc&& elseFunc) │ │ │ │ │ -357{ │ │ │ │ │ -358 return Impl::ifElse(condition, std::forward(ifFunc), std:: │ │ │ │ │ -forward(elseFunc)); │ │ │ │ │ -359} │ │ │ │ │ -360 │ │ │ │ │ -368template │ │ │ │ │ -_3_6_9void _i_f_E_l_s_e(const Condition& condition, IfFunc&& ifFunc) │ │ │ │ │ -370{ │ │ │ │ │ -371 _i_f_E_l_s_e(condition, std::forward(ifFunc), [](auto&&) {}); │ │ │ │ │ -372} │ │ │ │ │ -373 │ │ │ │ │ -374 │ │ │ │ │ -375 │ │ │ │ │ -376namespace Impl { │ │ │ │ │ -377 │ │ │ │ │ -378 template │ │ │ │ │ -379 constexpr auto equals(const T1& /*t1*/, const T2& /*t2*/, _P_r_i_o_r_i_t_y_T_a_g_<_1_>) - │ │ │ │ │ -> decltype(T1::value, T2::value, std::integral_constant()) │ │ │ │ │ -380 { return {}; } │ │ │ │ │ -381 │ │ │ │ │ -382 template │ │ │ │ │ -383 constexpr auto equals(const T1& t1, const T2& t2, PriorityTag<0>) │ │ │ │ │ -384 { │ │ │ │ │ -385 return t1==t2; │ │ │ │ │ -386 } │ │ │ │ │ -387 │ │ │ │ │ -388} // namespace Impl │ │ │ │ │ -389 │ │ │ │ │ -390 │ │ │ │ │ -391 │ │ │ │ │ -401template │ │ │ │ │ -_4_0_2constexpr auto _e_q_u_a_l_s(T1&& t1, T2&& t2) │ │ │ │ │ -403{ │ │ │ │ │ -404 return Impl::equals(std::forward(t1), std::forward(t2), │ │ │ │ │ -_P_r_i_o_r_i_t_y_T_a_g_<_1_>()); │ │ │ │ │ -405} │ │ │ │ │ -406 │ │ │ │ │ -407 │ │ │ │ │ -408 │ │ │ │ │ -409namespace Impl { │ │ │ │ │ -410 │ │ │ │ │ -411 template │ │ │ │ │ -412 constexpr Result switchCases(std::integer_sequence, const Value& / │ │ │ │ │ -*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch) │ │ │ │ │ -413 { │ │ │ │ │ -414 return elseBranch(); │ │ │ │ │ -415 } │ │ │ │ │ -416 │ │ │ │ │ -417 template │ │ │ │ │ -418 constexpr Result switchCases(std::integer_sequence, const │ │ │ │ │ -Value& value, Branches&& branches, ElseBranch&& elseBranch) │ │ │ │ │ -419 { │ │ │ │ │ -420 return ifElse( │ │ │ │ │ -421 _H_y_b_r_i_d_:_:_e_q_u_a_l_s(std::integral_constant(), value), │ │ │ │ │ -422 [&](auto id) -> decltype(auto) { │ │ │ │ │ -423 return id(branches)(std::integral_constant()); │ │ │ │ │ -424 }, [&](auto id) -> decltype(auto) { │ │ │ │ │ -425 return Impl::switchCases(id(std::integer_sequence()), │ │ │ │ │ -value, branches, elseBranch); │ │ │ │ │ -426 }); │ │ │ │ │ -427 } │ │ │ │ │ -428 │ │ │ │ │ -429} // namespace Impl │ │ │ │ │ -430 │ │ │ │ │ -431 │ │ │ │ │ -432 │ │ │ │ │ -460template │ │ │ │ │ -_4_6_1constexpr decltype(auto) _s_w_i_t_c_h_C_a_s_e_s(const Cases& cases, const Value& value, │ │ │ │ │ -Branches&& branches, ElseBranch&& elseBranch) │ │ │ │ │ -462{ │ │ │ │ │ -463 return Impl::switchCases(cases, value, std:: │ │ │ │ │ -forward(branches), std::forward(elseBranch)); │ │ │ │ │ -464} │ │ │ │ │ -465 │ │ │ │ │ -486template │ │ │ │ │ -_4_8_7constexpr void _s_w_i_t_c_h_C_a_s_e_s(const Cases& cases, const Value& value, │ │ │ │ │ -Branches&& branches) │ │ │ │ │ -488{ │ │ │ │ │ -489 Impl::switchCases(cases, value, std::forward(branches), [] │ │ │ │ │ -() {}); │ │ │ │ │ -490} │ │ │ │ │ -491 │ │ │ │ │ -492 │ │ │ │ │ -493} // namespace Hybrid │ │ │ │ │ -494} // namespace Dune │ │ │ │ │ -495 │ │ │ │ │ -496 │ │ │ │ │ -497#endif // #ifndef DUNE_COMMON_HYBRIDUTILITIES_HH │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_a_s_s_e_r_t_a_n_d_r_e_t_u_r_n_._h_h │ │ │ │ │ -_f_v_e_c_t_o_r_._h_h │ │ │ │ │ -Implements a vector constructed from a given type representing a field and a │ │ │ │ │ -compile-time given size. │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for reduction like operations on ranges. │ │ │ │ │ -_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for type computations, constraining overloads, ... │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___0 │ │ │ │ │ -constexpr index_constant< 0 > _0 │ │ │ │ │ -Compile time index with value 0. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ -static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ ->, std::integral_constant< T, to >) noexcept │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_s_i_z_e │ │ │ │ │ -constexpr auto size(const T &t) │ │ │ │ │ -Size query. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_e_q_u_a_l_s │ │ │ │ │ -constexpr auto equals(T1 &&t1, T2 &&t2) │ │ │ │ │ -Equality comparison. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:402 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_f_o_r_E_a_c_h │ │ │ │ │ -constexpr void forEach(Range &&range, F &&f) │ │ │ │ │ -Range based for loop. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:268 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_s_w_i_t_c_h_C_a_s_e_s │ │ │ │ │ -constexpr decltype(auto) switchCases(const Cases &cases, const Value &value, │ │ │ │ │ -Branches &&branches, ElseBranch &&elseBranch) │ │ │ │ │ -Switch statement. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:461 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_i_f_E_l_s_e │ │ │ │ │ -decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc │ │ │ │ │ -&&elseFunc) │ │ │ │ │ -A conditional expression. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:356 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_i_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -constexpr auto integralRange(const Begin &begin, const End &end) │ │ │ │ │ -Create an integral range. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:184 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ -constexpr decltype(auto) elementAt(Container &&c, Index &&i) │ │ │ │ │ -Get element at given position from container. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:135 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_a_c_c_u_m_u_l_a_t_e │ │ │ │ │ -constexpr T accumulate(Range &&range, T value, F &&f) │ │ │ │ │ -Accumulate values. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:291 │ │ │ │ │ -_D_u_n_e_:_:_i_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y │ │ │ │ │ -constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std:: │ │ │ │ │ -integral_constant< std::size_t, index > i) │ │ │ │ │ -Get entry of std::integer_sequence. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:462 │ │ │ │ │ -_D_U_N_E___A_S_S_E_R_T___A_N_D___R_E_T_U_R_N │ │ │ │ │ -#define DUNE_ASSERT_AND_RETURN(C, X) │ │ │ │ │ -Asserts a condition and return on success in constexpr context. │ │ │ │ │ -DDeeffiinniittiioonn assertandreturn.hh:22 │ │ │ │ │ +60#endif // DUNE_COMMON_DOCUMENTATION_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -vector space out of a tensor product of fields. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -dynamic integer range for use in range-based for loops │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:175 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -static integer range for use in range-based for loops │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:225 │ │ │ │ │ -_D_u_n_e_:_:_I_s_I_n_t_e_g_r_a_l_C_o_n_s_t_a_n_t │ │ │ │ │ -Check if T is an std::integral_constant │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:384 │ │ │ │ │ -_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g │ │ │ │ │ -Helper class for tagging priorities. │ │ │ │ │ -DDeeffiinniittiioonn typeutilities.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_e_m_e_n_t_a_t_i_o_n_D_e_f_i_n_e_d │ │ │ │ │ +@ implementationDefined │ │ │ │ │ +DDeeffiinniittiioonn documentation.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_D_e_f_i_n_e_d │ │ │ │ │ +Dummy struct used for documentation purposes. │ │ │ │ │ +DDeeffiinniittiioonn documentation.hh:42 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00011.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: vc.hh File Reference │ │ │ │ +dune-common: singleton.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -69,25 +69,42 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
vc.hh File Reference
│ │ │ │ +
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
singleton.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Compatibility header for including <Vc/Vc> │ │ │ │ +

Useful wrapper for creating singletons. │ │ │ │ More...

│ │ │ │ - │ │ │ │ +
#include <dune/common/visibility.hh>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::Singleton< T >
 An adapter to turn a class into a singleton. More...
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Compatibility header for including <Vc/Vc>

│ │ │ │ -

Certain versions (1.3.2) of Vc (https://github.com/VcDevel/Vc) have a problem with certain compiler versions (g++ 7.2.0) in c++17 mode, see #88.

│ │ │ │ +

Useful wrapper for creating singletons.

│ │ │ │ +

Inspired by the article CodeGuru: A Leak-Free Singleton class

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,15 +1,24 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -vc.hh File Reference │ │ │ │ │ -Compatibility header for including _M_o_r_e_._._. │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +singleton.hh File Reference │ │ │ │ │ +Useful wrapper for creating singletons. _M_o_r_e_._._. │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_i_s_i_b_i_l_i_t_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_i_n_g_l_e_t_o_n_<_ _T_ _> │ │ │ │ │ +  An adapter to turn a class into a singleton. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Compatibility header for including │ │ │ │ │ -Certain versions (1.3.2) of Vc (_h_t_t_p_s_:_/_/_g_i_t_h_u_b_._c_o_m_/_V_c_D_e_v_e_l_/_V_c) have a problem │ │ │ │ │ -with certain compiler versions (g++ 7.2.0) in c++17 mode, see #88. │ │ │ │ │ +Useful wrapper for creating singletons. │ │ │ │ │ +Inspired by the article _C_o_d_e_G_u_r_u_:_ _A_ _L_e_a_k_-_F_r_e_e_ _S_i_n_g_l_e_t_o_n_ _c_l_a_s_s │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: vc.hh Source File │ │ │ │ +dune-common: singleton.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,38 +74,62 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
vc.hh
│ │ │ │ +
singleton.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_VC_HH
│ │ │ │ -
4#define DUNE_COMMON_VC_HH
│ │ │ │ -
5
│ │ │ │ -
15#if HAVE_VC
│ │ │ │ -
16
│ │ │ │ -
17// include Vc's macro definitions
│ │ │ │ -
18#include <Vc/global.h>
│ │ │ │ -
19
│ │ │ │ -
20// undefine the macro that signals C++17 support, if set
│ │ │ │ -
21#ifdef Vc_CXX17
│ │ │ │ -
22#undef Vc_CXX17
│ │ │ │ -
23#endif
│ │ │ │ -
24
│ │ │ │ -
25// include the rest of Vc
│ │ │ │ -
26#include <Vc/Vc>
│ │ │ │ -
27
│ │ │ │ -
28#endif // HAVE_VC
│ │ │ │ -
29
│ │ │ │ -
30#endif // DUNE_COMMON_VC_HH
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ +
5#ifndef DUNE_SINGLETON_HH
│ │ │ │ +
6#define DUNE_SINGLETON_HH
│ │ │ │ +
7
│ │ │ │ + │ │ │ │ +
9
│ │ │ │ +
17namespace Dune
│ │ │ │ +
18{
│ │ │ │ +
54 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
56 {
│ │ │ │ +
57 protected:
│ │ │ │ +
58 /* @brief Protected constructor. */
│ │ │ │ +
59 Singleton() = default;
│ │ │ │ +
60
│ │ │ │ +
61 public:
│ │ │ │ +
62
│ │ │ │ +
63 Singleton(const Singleton&) = delete;
│ │ │ │ +
64 void operator=(const Singleton&) = delete;
│ │ │ │ +
65
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
71 {
│ │ │ │ +
72 static T instance_;
│ │ │ │ +
73 return instance_;
│ │ │ │ +
74 }
│ │ │ │ +
│ │ │ │ +
75 };
│ │ │ │ +
│ │ │ │ +
76
│ │ │ │ +
77} // namespace Dune
│ │ │ │ +
78
│ │ │ │ +
79#endif
│ │ │ │ +
Definition of macros controlling symbol visibility at the ABI level.
│ │ │ │ +
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition visibility.hh:20
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
An adapter to turn a class into a singleton.
Definition singleton.hh:56
│ │ │ │ +
Singleton()=default
│ │ │ │ +
Singleton(const Singleton &)=delete
│ │ │ │ +
void operator=(const Singleton &)=delete
│ │ │ │ +
static DUNE_EXPORT T & instance()
Get the instance of the singleton.
Definition singleton.hh:70
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,32 +1,66 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -vc.hh │ │ │ │ │ +singleton.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_VC_HH │ │ │ │ │ -4#define DUNE_COMMON_VC_HH │ │ │ │ │ -5 │ │ │ │ │ -15#if HAVE_VC │ │ │ │ │ -16 │ │ │ │ │ -17// include Vc's macro definitions │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20// undefine the macro that signals C++17 support, if set │ │ │ │ │ -21#ifdef Vc_CXX17 │ │ │ │ │ -22#undef Vc_CXX17 │ │ │ │ │ -23#endif │ │ │ │ │ -24 │ │ │ │ │ -25// include the rest of Vc │ │ │ │ │ -26#include │ │ │ │ │ -27 │ │ │ │ │ -28#endif // HAVE_VC │ │ │ │ │ -29 │ │ │ │ │ -30#endif // DUNE_COMMON_VC_HH │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +5#ifndef DUNE_SINGLETON_HH │ │ │ │ │ +6#define DUNE_SINGLETON_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_i_s_i_b_i_l_i_t_y_._h_h> │ │ │ │ │ +9 │ │ │ │ │ +17namespace _D_u_n_e │ │ │ │ │ +18{ │ │ │ │ │ +54 template │ │ │ │ │ +_5_5 class _S_i_n_g_l_e_t_o_n │ │ │ │ │ +56 { │ │ │ │ │ +57 protected: │ │ │ │ │ +58 /* @brief Protected constructor. */ │ │ │ │ │ +_5_9 _S_i_n_g_l_e_t_o_n() = default; │ │ │ │ │ +60 │ │ │ │ │ +61 public: │ │ │ │ │ +62 │ │ │ │ │ +_6_3 _S_i_n_g_l_e_t_o_n(const _S_i_n_g_l_e_t_o_n&) = delete; │ │ │ │ │ +_6_4 void _o_p_e_r_a_t_o_r_=(const _S_i_n_g_l_e_t_o_n&) = delete; │ │ │ │ │ +65 │ │ │ │ │ +_7_0 _D_U_N_E___E_X_P_O_R_T static T& _i_n_s_t_a_n_c_e() │ │ │ │ │ +71 { │ │ │ │ │ +72 static T instance_; │ │ │ │ │ +73 return instance_; │ │ │ │ │ +74 } │ │ │ │ │ +75 }; │ │ │ │ │ +76 │ │ │ │ │ +77} // namespace Dune │ │ │ │ │ +78 │ │ │ │ │ +79#endif │ │ │ │ │ +_v_i_s_i_b_i_l_i_t_y_._h_h │ │ │ │ │ +Definition of macros controlling symbol visibility at the ABI level. │ │ │ │ │ +_D_U_N_E___E_X_P_O_R_T │ │ │ │ │ +#define DUNE_EXPORT │ │ │ │ │ +Export a symbol as part of the public ABI. │ │ │ │ │ +DDeeffiinniittiioonn visibility.hh:20 │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_S_i_n_g_l_e_t_o_n │ │ │ │ │ +An adapter to turn a class into a singleton. │ │ │ │ │ +DDeeffiinniittiioonn singleton.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_S_i_n_g_l_e_t_o_n_:_:_S_i_n_g_l_e_t_o_n │ │ │ │ │ +Singleton()=default │ │ │ │ │ +_D_u_n_e_:_:_S_i_n_g_l_e_t_o_n_:_:_S_i_n_g_l_e_t_o_n │ │ │ │ │ +Singleton(const Singleton &)=delete │ │ │ │ │ +_D_u_n_e_:_:_S_i_n_g_l_e_t_o_n_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +void operator=(const Singleton &)=delete │ │ │ │ │ +_D_u_n_e_:_:_S_i_n_g_l_e_t_o_n_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ +static DUNE_EXPORT T & instance() │ │ │ │ │ +Get the instance of the singleton. │ │ │ │ │ +DDeeffiinniittiioonn singleton.hh:70 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00014.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: iteratorfacades.hh File Reference │ │ │ │ +dune-common: referencehelper.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,101 +70,60 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
│ │ │ │ -
iteratorfacades.hh File Reference
│ │ │ │ +Typedefs | │ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
referencehelper.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

This file implements iterator facade classes for writing stl conformant iterators. │ │ │ │ -More...

│ │ │ │ -
#include <iterator>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include "typetraits.hh"
│ │ │ │ +
#include <type_traits>
│ │ │ │ +#include <functional>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::ForwardIteratorFacade< T, V, R, D >
 Base class for stl conformant forward iterators. More...
 
class  Dune::BidirectionalIteratorFacade< T, V, R, D >
 Facade class for stl conformant bidirectional iterators. More...
 
class  Dune::RandomAccessIteratorFacade< T, V, R, D >
 Base class for stl conformant forward iterators. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ +Typedefs

template<class T >
using Dune::ResolveRef_t = std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))>
 Type trait to resolve std::reference_wrapper.
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ Functions

template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator== (const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for equality.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator!= (const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for inequality.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
std::enable_if< std::is_convertible< T2, T1 >::value, bool >::type Dune::operator== (const BidirectionalIteratorFacade< T1, V1, R1, D > &lhs, const BidirectionalIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for equality.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
std::enable_if< std::is_convertible< T1, T2 >::value &&!std::is_convertible< T2, T1 >::value, bool >::type Dune::operator== (const BidirectionalIteratorFacade< T1, V1, R1, D > &lhs, const BidirectionalIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for equality.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator!= (const BidirectionalIteratorFacade< T1, V1, R1, D > &lhs, const BidirectionalIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for inequality.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator== (const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for equality.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator!= (const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for inequality.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator< (const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
 Comparison operator.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator<= (const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
 Comparison operator.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator> (const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
 Comparison operator.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator>= (const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
 Comparison operator.
 
template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, D >::type Dune::operator- (const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
 Calculates the difference between two pointers.
 
template<class T >
constexpr T & Dune::resolveRef (T &gf) noexcept
 Helper function to resolve std::reference_wrapper.
 
template<class T >
const auto & Dune::resolveRef (T &&gf)=delete
 
template<class T >
constexpr T & Dune::resolveRef (std::reference_wrapper< T > gf) noexcept
 Helper function to resolve std::reference_wrapper.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Variables

template<class T >
constexpr bool Dune::IsReferenceWrapper_v = Impl::IsReferenceWrapper<T>::value
 Helper to detect if given type is a std::reference_wrapper.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

This file implements iterator facade classes for writing stl conformant iterators.

│ │ │ │ -

With using these facades writing iterators for arbitrary containers becomes much less cumbersome as only few functions have to be implemented. All other functions needed by the stl are provided by the facades using the Barton-Nackman trick (also known as curiously recurring template pattern.

│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,145 +1,40 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -iteratorfacades.hh File Reference │ │ │ │ │ -This file implements iterator facade classes for writing stl conformant │ │ │ │ │ -iterators. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +referencehelper.hh File Reference │ │ │ │ │ #include │ │ │ │ │ -#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_ _T_,_ _V_,_ _R_,_ _D_ _> │ │ │ │ │ -  Base class for stl conformant forward iterators. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_ _T_,_ _V_,_ _R_,_ _D_ _> │ │ │ │ │ -  Facade class for stl conformant bidirectional iterators. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_ _T_,_ _V_,_ _R_,_ _D_ _> │ │ │ │ │ -  Base class for stl conformant forward iterators. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_R_e_s_o_l_v_e_R_e_f___t = std::remove_reference_t< decltype(_D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f │ │ │ │ │ + (std::declval< T & >()))> │ │ │ │ │ +  Type trait to resolve std::reference_wrapper. │ │ │ │ │ +  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const │ │ │ │ │ - type  _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, D > │ │ │ │ │ - &lhs, const _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, │ │ │ │ │ - V2, R2, D > &rhs) │ │ │ │ │ -  Checks for equality. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const │ │ │ │ │ - type  _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, D > │ │ │ │ │ - &lhs, const _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, │ │ │ │ │ - V2, R2, D > &rhs) │ │ │ │ │ -  Checks for inequality. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - std::enable_if< std::is_convertible< _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const │ │ │ │ │ - T2, T1 >::value, bool >::type  _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, │ │ │ │ │ - R1, D > &lhs, const │ │ │ │ │ - _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, │ │ │ │ │ - R2, D > &rhs) │ │ │ │ │ -  Checks for equality. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - std::enable_if< std::is_convertible< _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const │ │ │ │ │ -T1, T2 >::value &&!std::is_convertible< _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, │ │ │ │ │ - T2, T1 >::value, bool >::type  R1, D > &lhs, const │ │ │ │ │ - _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, │ │ │ │ │ - R2, D > &rhs) │ │ │ │ │ -  Checks for equality. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const │ │ │ │ │ - type  _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, │ │ │ │ │ - R1, D > &lhs, const │ │ │ │ │ - _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, │ │ │ │ │ - R2, D > &rhs) │ │ │ │ │ -  Checks for inequality. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const │ │ │ │ │ - type  _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, │ │ │ │ │ - D > &lhs, const │ │ │ │ │ - _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, R2, │ │ │ │ │ - D > &rhs) │ │ │ │ │ -  Checks for equality. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const │ │ │ │ │ - type  _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, │ │ │ │ │ - D > &lhs, const │ │ │ │ │ - _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, R2, │ │ │ │ │ - D > &rhs) │ │ │ │ │ -  Checks for inequality. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const │ │ │ │ │ - type  _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, │ │ │ │ │ - D > &lhs, const │ │ │ │ │ - _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, R2, │ │ │ │ │ - D > &rhs) │ │ │ │ │ -  Comparison operator. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_= (const │ │ │ │ │ - type  _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, │ │ │ │ │ - D > &lhs, const │ │ │ │ │ - _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, R2, │ │ │ │ │ - D > &rhs) │ │ │ │ │ -  Comparison operator. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_> (const │ │ │ │ │ - type  _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, │ │ │ │ │ - D > &lhs, const │ │ │ │ │ - _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, R2, │ │ │ │ │ - D > &rhs) │ │ │ │ │ -  Comparison operator. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, bool >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_= (const │ │ │ │ │ - type  _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, │ │ │ │ │ - D > &lhs, const │ │ │ │ │ - _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, R2, │ │ │ │ │ - D > &rhs) │ │ │ │ │ -  Comparison operator. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - _E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e< T1, T2, D >:: _D_u_n_e_:_:_o_p_e_r_a_t_o_r_- (const │ │ │ │ │ - type  _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T1, V1, R1, │ │ │ │ │ - D > &lhs, const │ │ │ │ │ - _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, V2, R2, │ │ │ │ │ - D > &rhs) │ │ │ │ │ -  Calculates the difference between two │ │ │ │ │ - pointers. │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements iterator facade classes for writing stl conformant │ │ │ │ │ -iterators. │ │ │ │ │ -With using these facades writing iterators for arbitrary containers becomes │ │ │ │ │ -much less cumbersome as only few functions have to be implemented. All other │ │ │ │ │ -functions needed by the stl are provided by the facades using the Barton- │ │ │ │ │ -Nackman trick (also known as curiously recurring template pattern. │ │ │ │ │ +template │ │ │ │ │ +constexpr T &  _D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f (T &gf) noexcept │ │ │ │ │ +  Helper function to resolve std::reference_wrapper. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + const auto &  _D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f (T &&gf)=delete │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +constexpr T &  _D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f (std::reference_wrapper< T > gf) noexcept │ │ │ │ │ +  Helper function to resolve std::reference_wrapper. │ │ │ │ │ +  │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ +template │ │ │ │ │ +constexpr bool  _D_u_n_e_:_:_I_s_R_e_f_e_r_e_n_c_e_W_r_a_p_p_e_r___v = Impl::IsReferenceWrapper::value │ │ │ │ │ +  Helper to detect if given type is a std::reference_wrapper. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: iteratorfacades.hh Source File │ │ │ │ +dune-common: referencehelper.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,507 +74,92 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
iteratorfacades.hh
│ │ │ │ +
referencehelper.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_ITERATORFACADES_HH
│ │ │ │ -
6#define DUNE_ITERATORFACADES_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_REFERENCE_HELPER_HH
│ │ │ │ +
6#define DUNE_COMMON_REFERENCE_HELPER_HH
│ │ │ │
7
│ │ │ │ -
8#include <iterator>
│ │ │ │ -
9#include <type_traits>
│ │ │ │ +
8#include <type_traits>
│ │ │ │ +
9#include <functional>
│ │ │ │
10
│ │ │ │ -
11#include "typetraits.hh"
│ │ │ │ +
11
│ │ │ │
12
│ │ │ │ -
13namespace Dune
│ │ │ │ -
14{
│ │ │ │ -
139 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
141 {
│ │ │ │ -
142
│ │ │ │ -
143 public:
│ │ │ │ -
144 /* type aliases required by C++ for iterators */
│ │ │ │ -
145 using iterator_category = std::forward_iterator_tag;
│ │ │ │ -
146 using value_type = typename std::remove_const<V>::type;
│ │ │ │ - │ │ │ │ -
148 using pointer = V*;
│ │ │ │ -
149 using reference = R;
│ │ │ │ -
150
│ │ │ │ -
175 typedef T DerivedType;
│ │ │ │ -
176
│ │ │ │ -
180 typedef V Value;
│ │ │ │ -
181
│ │ │ │ -
185 typedef V* Pointer;
│ │ │ │ -
186
│ │ │ │ -
190 typedef D DifferenceType;
│ │ │ │ -
191
│ │ │ │ -
195 typedef R Reference;
│ │ │ │ -
196
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
199 {
│ │ │ │ -
200 return static_cast<DerivedType const*>(this)->dereference();
│ │ │ │ -
201 }
│ │ │ │ -
│ │ │ │ -
202
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
204 {
│ │ │ │ -
205 return &(static_cast<const DerivedType *>(this)->dereference());
│ │ │ │ -
206 }
│ │ │ │ -
│ │ │ │ -
207
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
210 {
│ │ │ │ -
211 static_cast<DerivedType *>(this)->increment();
│ │ │ │ -
212 return *static_cast<DerivedType *>(this);
│ │ │ │ -
213 }
│ │ │ │ -
│ │ │ │ -
214
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
217 {
│ │ │ │ -
218 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ -
219 this->operator++();
│ │ │ │ -
220 return tmp;
│ │ │ │ -
221 }
│ │ │ │ -
│ │ │ │ -
222 };
│ │ │ │ -
│ │ │ │ -
223
│ │ │ │ -
234 template<class T1, class V1, class R1, class D,
│ │ │ │ -
235 class T2, class V2, class R2>
│ │ │ │ -
236 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
239 {
│ │ │ │ -
240 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
241 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ -
242 else
│ │ │ │ -
243 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ -
244 }
│ │ │ │ -
│ │ │ │ -
245
│ │ │ │ -
256 template<class T1, class V1, class R1, class D,
│ │ │ │ -
257 class T2, class V2, class R2>
│ │ │ │ -
258 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
261 {
│ │ │ │ -
262 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
263 return !static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ -
264 else
│ │ │ │ -
265 return !static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ -
266 }
│ │ │ │ -
│ │ │ │ -
267
│ │ │ │ -
272 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
274 {
│ │ │ │ -
275
│ │ │ │ -
276 public:
│ │ │ │ -
277 /* type aliases required by C++ for iterators */
│ │ │ │ -
278 using iterator_category = std::bidirectional_iterator_tag;
│ │ │ │ -
279 using value_type = typename std::remove_const<V>::type;
│ │ │ │ - │ │ │ │ -
281 using pointer = V*;
│ │ │ │ -
282 using reference = R;
│ │ │ │ -
283
│ │ │ │ -
309 typedef T DerivedType;
│ │ │ │ -
310
│ │ │ │ -
314 typedef V Value;
│ │ │ │ -
315
│ │ │ │ -
319 typedef V* Pointer;
│ │ │ │ -
320
│ │ │ │ -
324 typedef D DifferenceType;
│ │ │ │ -
325
│ │ │ │ -
329 typedef R Reference;
│ │ │ │ -
330
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
333 {
│ │ │ │ -
334 return static_cast<DerivedType const*>(this)->dereference();
│ │ │ │ -
335 }
│ │ │ │ -
│ │ │ │ -
336
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
338 {
│ │ │ │ -
339 return &(static_cast<const DerivedType *>(this)->dereference());
│ │ │ │ -
340 }
│ │ │ │ -
│ │ │ │ -
341
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
344 {
│ │ │ │ -
345 static_cast<DerivedType *>(this)->increment();
│ │ │ │ -
346 return *static_cast<DerivedType *>(this);
│ │ │ │ -
347 }
│ │ │ │ -
│ │ │ │ -
348
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
351 {
│ │ │ │ -
352 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ -
353 this->operator++();
│ │ │ │ -
354 return tmp;
│ │ │ │ -
355 }
│ │ │ │ -
│ │ │ │ -
356
│ │ │ │ -
357
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
360 {
│ │ │ │ -
361 static_cast<DerivedType *>(this)->decrement();
│ │ │ │ -
362 return *static_cast<DerivedType *>(this);
│ │ │ │ -
363 }
│ │ │ │ -
│ │ │ │ -
364
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
367 {
│ │ │ │ -
368 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ -
369 this->operator--();
│ │ │ │ -
370 return tmp;
│ │ │ │ -
371 }
│ │ │ │ -
│ │ │ │ -
372 };
│ │ │ │ -
│ │ │ │ -
373
│ │ │ │ -
381 template<class T1, class V1, class R1, class D,
│ │ │ │ -
382 class T2, class V2, class R2>
│ │ │ │ -
383 inline typename std::enable_if<std::is_convertible<T2,T1>::value,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
386 {
│ │ │ │ -
387 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ -
388 }
│ │ │ │ -
│ │ │ │ -
389
│ │ │ │ -
398 template<class T1, class V1, class R1, class D,
│ │ │ │ -
399 class T2, class V2, class R2>
│ │ │ │ -
400 inline
│ │ │ │ -
401 typename std::enable_if<std::is_convertible<T1,T2>::value && !std::is_convertible<T2,T1>::value,
│ │ │ │ -
402 bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
405 {
│ │ │ │ -
406 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ -
407 }
│ │ │ │ -
│ │ │ │ -
408
│ │ │ │ -
419 template<class T1, class V1, class R1, class D,
│ │ │ │ -
420 class T2, class V2, class R2>
│ │ │ │ -
421 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
424 {
│ │ │ │ -
425 return !(lhs == rhs);
│ │ │ │ -
426 }
│ │ │ │ -
│ │ │ │ -
427
│ │ │ │ -
432 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
434 {
│ │ │ │ -
435
│ │ │ │ -
436 public:
│ │ │ │ -
437 /* type aliases required by C++ for iterators */
│ │ │ │ -
438 using iterator_category = std::random_access_iterator_tag;
│ │ │ │ -
439 using value_type = typename std::remove_const<V>::type;
│ │ │ │ - │ │ │ │ -
441 using pointer = V*;
│ │ │ │ -
442 using reference = R;
│ │ │ │ -
443
│ │ │ │ -
477 typedef T DerivedType;
│ │ │ │ -
478
│ │ │ │ -
482 typedef V Value;
│ │ │ │ -
483
│ │ │ │ -
487 typedef V* Pointer;
│ │ │ │ -
488
│ │ │ │ -
492 typedef D DifferenceType;
│ │ │ │ -
493
│ │ │ │ -
497 typedef R Reference;
│ │ │ │ -
498
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
501 {
│ │ │ │ -
502 return static_cast<DerivedType const*>(this)->dereference();
│ │ │ │ -
503 }
│ │ │ │ -
│ │ │ │ -
504
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
506 {
│ │ │ │ -
507 return &(static_cast<const DerivedType *>(this)->dereference());
│ │ │ │ -
508 }
│ │ │ │ -
│ │ │ │ -
509
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
516 {
│ │ │ │ -
517 return static_cast<const DerivedType *>(this)->elementAt(n);
│ │ │ │ -
518 }
│ │ │ │ -
│ │ │ │ -
519
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
522 {
│ │ │ │ -
523 static_cast<DerivedType *>(this)->increment();
│ │ │ │ -
524 return *static_cast<DerivedType *>(this);
│ │ │ │ -
525 }
│ │ │ │ -
│ │ │ │ -
526
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
529 {
│ │ │ │ -
530 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ -
531 this->operator++();
│ │ │ │ -
532 return tmp;
│ │ │ │ -
533 }
│ │ │ │ -
│ │ │ │ -
534
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
536 {
│ │ │ │ -
537 static_cast<DerivedType *>(this)->advance(n);
│ │ │ │ -
538 return *static_cast<DerivedType *>(this);
│ │ │ │ -
539 }
│ │ │ │ -
│ │ │ │ -
540
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
542 {
│ │ │ │ -
543 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ -
544 tmp.advance(n);
│ │ │ │ -
545 return tmp;
│ │ │ │ -
546 }
│ │ │ │ -
│ │ │ │ -
547
│ │ │ │ -
548
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
551 {
│ │ │ │ -
552 static_cast<DerivedType *>(this)->decrement();
│ │ │ │ -
553 return *static_cast<DerivedType *>(this);
│ │ │ │ -
554 }
│ │ │ │ -
│ │ │ │ -
555
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
558 {
│ │ │ │ -
559 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ -
560 this->operator--();
│ │ │ │ -
561 return tmp;
│ │ │ │ -
562 }
│ │ │ │ -
│ │ │ │ -
563
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
565 {
│ │ │ │ -
566 static_cast<DerivedType *>(this)->advance(-n);
│ │ │ │ -
567 return *static_cast<DerivedType *>(this);
│ │ │ │ -
568 }
│ │ │ │ -
│ │ │ │ -
569
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
571 {
│ │ │ │ -
572 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ -
573 tmp.advance(-n);
│ │ │ │ -
574 return tmp;
│ │ │ │ -
575 }
│ │ │ │ -
│ │ │ │ -
576
│ │ │ │ -
577
│ │ │ │ -
578 };
│ │ │ │ -
│ │ │ │ -
579
│ │ │ │ -
590 template<class T1, class V1, class R1, class D,
│ │ │ │ -
591 class T2, class V2, class R2>
│ │ │ │ -
592 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
595 {
│ │ │ │ -
596 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
597 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ -
598 else
│ │ │ │ -
599 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ -
600 }
│ │ │ │ -
│ │ │ │ -
601
│ │ │ │ -
612 template<class T1, class V1, class R1, class D,
│ │ │ │ -
613 class T2, class V2, class R2>
│ │ │ │ -
614 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
617 {
│ │ │ │ -
618 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
619 return !static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ -
620 else
│ │ │ │ -
621 return !static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ -
622 }
│ │ │ │ -
│ │ │ │ -
623
│ │ │ │ -
634 template<class T1, class V1, class R1, class D,
│ │ │ │ -
635 class T2, class V2, class R2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
639 {
│ │ │ │ -
640 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
641 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))>0;
│ │ │ │ -
642 else
│ │ │ │ -
643 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))<0;
│ │ │ │ -
644 }
│ │ │ │ -
│ │ │ │ -
645
│ │ │ │ -
646
│ │ │ │ -
657 template<class T1, class V1, class R1, class D,
│ │ │ │ -
658 class T2, class V2, class R2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
662 {
│ │ │ │ -
663 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
664 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))>=0;
│ │ │ │ -
665 else
│ │ │ │ -
666 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))<=0;
│ │ │ │ -
667 }
│ │ │ │ -
│ │ │ │ -
668
│ │ │ │ -
669
│ │ │ │ -
680 template<class T1, class V1, class R1, class D,
│ │ │ │ -
681 class T2, class V2, class R2>
│ │ │ │ -
682 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
685 {
│ │ │ │ -
686 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
687 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))<0;
│ │ │ │ -
688 else
│ │ │ │ -
689 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))>0;
│ │ │ │ -
690 }
│ │ │ │ -
│ │ │ │ -
691
│ │ │ │ -
702 template<class T1, class V1, class R1, class D,
│ │ │ │ -
703 class T2, class V2, class R2>
│ │ │ │ -
704 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
707 {
│ │ │ │ -
708 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
709 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))<=0;
│ │ │ │ -
710 else
│ │ │ │ -
711 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))>=0;
│ │ │ │ -
712 }
│ │ │ │ -
│ │ │ │ -
713
│ │ │ │ -
724 template<class T1, class V1, class R1, class D,
│ │ │ │ -
725 class T2, class V2, class R2>
│ │ │ │ -
726 inline typename EnableIfInterOperable<T1,T2,D>::type
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
729 {
│ │ │ │ -
730 if(std::is_convertible<T2,T1>::value)
│ │ │ │ -
731 return -static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs));
│ │ │ │ -
732 else
│ │ │ │ -
733 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs));
│ │ │ │ -
734 }
│ │ │ │ -
│ │ │ │ -
735
│ │ │ │ -
737}
│ │ │ │ -
738#endif
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:542
│ │ │ │ -
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:637
│ │ │ │ -
EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:683
│ │ │ │ -
EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:660
│ │ │ │ -
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition iteratorfacades.hh:237
│ │ │ │ -
EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:705
│ │ │ │ -
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition iteratorfacades.hh:259
│ │ │ │ +
13namespace Dune {
│ │ │ │ +
14
│ │ │ │ +
15namespace Impl {
│ │ │ │ +
16
│ │ │ │ +
17 template<class T>
│ │ │ │ +
18 class IsReferenceWrapper : public std::false_type {};
│ │ │ │ +
19
│ │ │ │ +
20 template<class T>
│ │ │ │ +
21 class IsReferenceWrapper<std::reference_wrapper<T>> : public std::true_type {};
│ │ │ │ +
22
│ │ │ │ +
23 template<class T>
│ │ │ │ +
24 class IsReferenceWrapper<const std::reference_wrapper<T>> : public std::true_type {};
│ │ │ │ +
25
│ │ │ │ +
26} // namespace Dune::Impl
│ │ │ │ +
27
│ │ │ │ +
28
│ │ │ │ +
34template<class T>
│ │ │ │ +
35constexpr bool IsReferenceWrapper_v = Impl::IsReferenceWrapper<T>::value;
│ │ │ │ +
36
│ │ │ │ +
37
│ │ │ │ +
46template<class T>
│ │ │ │ +
│ │ │ │ +
47constexpr T& resolveRef(T& gf) noexcept
│ │ │ │ +
48{
│ │ │ │ +
49 return gf;
│ │ │ │ +
50}
│ │ │ │ +
│ │ │ │ +
51
│ │ │ │ +
52
│ │ │ │ +
53// There's no overload for non std::reference_wrapper r-values,
│ │ │ │ +
54// because this may lead to undefined behavior whenever the
│ │ │ │ +
55// return value is stored.
│ │ │ │ +
56// Notice that deleting the overload is not necessary, but
│ │ │ │ +
57// helps to document that it is missing on purpose. It also
│ │ │ │ +
58// leads to nicer error messages.
│ │ │ │ +
59template<class T>
│ │ │ │ +
60const auto& resolveRef(T&& gf) = delete;
│ │ │ │ +
61
│ │ │ │ +
62
│ │ │ │ +
81template<class T>
│ │ │ │ +
│ │ │ │ +
82constexpr T& resolveRef(std::reference_wrapper<T> gf) noexcept
│ │ │ │ +
83{
│ │ │ │ +
84 return gf.get();
│ │ │ │ +
85}
│ │ │ │ +
│ │ │ │ +
86
│ │ │ │ +
87
│ │ │ │ +
88
│ │ │ │ +
99template<class T>
│ │ │ │ +
100using ResolveRef_t = std::remove_reference_t<decltype(Dune::resolveRef(std::declval<T&>()))>;
│ │ │ │ +
101
│ │ │ │ +
102
│ │ │ │ +
103} // namespace Dune
│ │ │ │ +
104
│ │ │ │ +
105
│ │ │ │ +
106
│ │ │ │ +
107#endif // DUNE_COMMON_REFERENCE_HELPER_HH
│ │ │ │ +
constexpr bool IsReferenceWrapper_v
Helper to detect if given type is a std::reference_wrapper.
Definition referencehelper.hh:35
│ │ │ │ +
constexpr T & resolveRef(T &gf) noexcept
Helper function to resolve std::reference_wrapper.
Definition referencehelper.hh:47
│ │ │ │ +
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:141
│ │ │ │ -
std::forward_iterator_tag iterator_category
Definition iteratorfacades.hh:145
│ │ │ │ -
V * pointer
Definition iteratorfacades.hh:148
│ │ │ │ -
DerivedType & operator++()
Preincrement operator.
Definition iteratorfacades.hh:209
│ │ │ │ -
D DifferenceType
The type of the difference between two positions.
Definition iteratorfacades.hh:190
│ │ │ │ -
R Reference
The type of the reference to the values accessed.
Definition iteratorfacades.hh:195
│ │ │ │ -
Pointer operator->() const
Definition iteratorfacades.hh:203
│ │ │ │ -
T DerivedType
The type of derived iterator.
Definition iteratorfacades.hh:175
│ │ │ │ -
V Value
The type of value accessed through the iterator.
Definition iteratorfacades.hh:180
│ │ │ │ -
typename std::remove_const< V >::type value_type
Definition iteratorfacades.hh:146
│ │ │ │ -
DerivedType operator++(int)
Postincrement operator.
Definition iteratorfacades.hh:216
│ │ │ │ -
V * Pointer
The pointer to the Value.
Definition iteratorfacades.hh:185
│ │ │ │ -
D difference_type
Definition iteratorfacades.hh:147
│ │ │ │ -
Reference operator*() const
Dereferencing operator.
Definition iteratorfacades.hh:198
│ │ │ │ -
R reference
Definition iteratorfacades.hh:149
│ │ │ │ -
Facade class for stl conformant bidirectional iterators.
Definition iteratorfacades.hh:274
│ │ │ │ -
V * pointer
Definition iteratorfacades.hh:281
│ │ │ │ -
typename std::remove_const< V >::type value_type
Definition iteratorfacades.hh:279
│ │ │ │ -
Reference operator*() const
Dereferencing operator.
Definition iteratorfacades.hh:332
│ │ │ │ -
D difference_type
Definition iteratorfacades.hh:280
│ │ │ │ -
T DerivedType
The type of derived iterator.
Definition iteratorfacades.hh:309
│ │ │ │ -
DerivedType & operator--()
Preincrement operator.
Definition iteratorfacades.hh:359
│ │ │ │ -
Pointer operator->() const
Definition iteratorfacades.hh:337
│ │ │ │ -
DerivedType & operator++()
Preincrement operator.
Definition iteratorfacades.hh:343
│ │ │ │ -
V * Pointer
The pointer to the Value.
Definition iteratorfacades.hh:319
│ │ │ │ -
R Reference
The type of the reference to the values accessed.
Definition iteratorfacades.hh:329
│ │ │ │ -
DerivedType operator++(int)
Postincrement operator.
Definition iteratorfacades.hh:350
│ │ │ │ -
std::bidirectional_iterator_tag iterator_category
Definition iteratorfacades.hh:278
│ │ │ │ -
D DifferenceType
The type of the difference between two positions.
Definition iteratorfacades.hh:324
│ │ │ │ -
DerivedType operator--(int)
Postincrement operator.
Definition iteratorfacades.hh:366
│ │ │ │ -
R reference
Definition iteratorfacades.hh:282
│ │ │ │ -
V Value
The type of value accessed through the iterator.
Definition iteratorfacades.hh:314
│ │ │ │ -
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:434
│ │ │ │ -
typename std::remove_const< V >::type value_type
Definition iteratorfacades.hh:439
│ │ │ │ -
D difference_type
Definition iteratorfacades.hh:440
│ │ │ │ -
DerivedType operator--(int)
Postdecrement operator.
Definition iteratorfacades.hh:557
│ │ │ │ -
V * pointer
Definition iteratorfacades.hh:441
│ │ │ │ -
std::random_access_iterator_tag iterator_category
Definition iteratorfacades.hh:438
│ │ │ │ -
Reference operator*() const
Dereferencing operator.
Definition iteratorfacades.hh:500
│ │ │ │ -
DerivedType & operator++()
Preincrement operator.
Definition iteratorfacades.hh:521
│ │ │ │ -
R reference
Definition iteratorfacades.hh:442
│ │ │ │ -
Pointer operator->() const
Definition iteratorfacades.hh:505
│ │ │ │ -
D DifferenceType
The type of the difference between two positions.
Definition iteratorfacades.hh:492
│ │ │ │ -
DerivedType & operator--()
Predecrement operator.
Definition iteratorfacades.hh:550
│ │ │ │ -
DerivedType & operator-=(DifferenceType n)
Definition iteratorfacades.hh:564
│ │ │ │ -
DerivedType operator+(DifferenceType n) const
Definition iteratorfacades.hh:541
│ │ │ │ -
Reference operator[](DifferenceType n) const
Get the element n positions from the current one.
Definition iteratorfacades.hh:515
│ │ │ │ -
T DerivedType
The type of derived iterator.
Definition iteratorfacades.hh:477
│ │ │ │ -
V * Pointer
The pointer to the Value.
Definition iteratorfacades.hh:487
│ │ │ │ -
DerivedType operator-(DifferenceType n) const
Definition iteratorfacades.hh:570
│ │ │ │ -
DerivedType operator++(int)
Postincrement operator.
Definition iteratorfacades.hh:528
│ │ │ │ -
V Value
The type of value accessed through the iterator.
Definition iteratorfacades.hh:482
│ │ │ │ -
DerivedType & operator+=(DifferenceType n)
Definition iteratorfacades.hh:535
│ │ │ │ -
R Reference
The type of the reference to the values accessed.
Definition iteratorfacades.hh:497
│ │ │ │ -
Enable typedef if two types are interoperable.
Definition typetraits.hh:81
│ │ │ │ +
std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))> ResolveRef_t
Type trait to resolve std::reference_wrapper.
Definition referencehelper.hh:100
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,614 +1,98 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -iteratorfacades.hh │ │ │ │ │ +referencehelper.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_ITERATORFACADES_HH │ │ │ │ │ -6#define DUNE_ITERATORFACADES_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_REFERENCE_HELPER_HH │ │ │ │ │ +6#define DUNE_COMMON_REFERENCE_HELPER_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ 10 │ │ │ │ │ -11#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ +11 │ │ │ │ │ 12 │ │ │ │ │ -13namespace _D_u_n_e │ │ │ │ │ -14{ │ │ │ │ │ -139 template │ │ │ │ │ -_1_4_0 class _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -141 { │ │ │ │ │ -142 │ │ │ │ │ -143 public: │ │ │ │ │ -144 /* type aliases required by C++ for iterators */ │ │ │ │ │ -_1_4_5 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::forward_iterator_tag; │ │ │ │ │ -_1_4_6 using _v_a_l_u_e___t_y_p_e = typename std::remove_const::type; │ │ │ │ │ -_1_4_7 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = D; │ │ │ │ │ -_1_4_8 using _p_o_i_n_t_e_r = V*; │ │ │ │ │ -_1_4_9 using _r_e_f_e_r_e_n_c_e = R; │ │ │ │ │ -150 │ │ │ │ │ -_1_7_5 typedef T _D_e_r_i_v_e_d_T_y_p_e; │ │ │ │ │ -176 │ │ │ │ │ -_1_8_0 typedef V _V_a_l_u_e; │ │ │ │ │ -181 │ │ │ │ │ -_1_8_5 typedef V* _P_o_i_n_t_e_r; │ │ │ │ │ -186 │ │ │ │ │ -_1_9_0 typedef D _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ -191 │ │ │ │ │ -_1_9_5 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -196 │ │ │ │ │ -_1_9_8 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ -199 { │ │ │ │ │ -200 return static_cast<_D_e_r_i_v_e_d_T_y_p_e const*>(this)->dereference(); │ │ │ │ │ -201 } │ │ │ │ │ -202 │ │ │ │ │ -_2_0_3 _P_o_i_n_t_e_r _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ -204 { │ │ │ │ │ -205 return &(static_cast(this)->dereference()); │ │ │ │ │ -206 } │ │ │ │ │ -207 │ │ │ │ │ -_2_0_9 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -210 { │ │ │ │ │ -211 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->increment(); │ │ │ │ │ -212 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ -213 } │ │ │ │ │ -214 │ │ │ │ │ -_2_1_6 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_+_+(int) │ │ │ │ │ -217 { │ │ │ │ │ -218 _D_e_r_i_v_e_d_T_y_p_e tmp(static_cast<_D_e_r_i_v_e_d_T_y_p_e const&>(*this)); │ │ │ │ │ -219 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ -220 return tmp; │ │ │ │ │ -221 } │ │ │ │ │ -222 }; │ │ │ │ │ -223 │ │ │ │ │ -234 template │ │ │ │ │ -236 inline typename EnableIfInterOperable::type │ │ │ │ │ -_2_3_7 _o_p_e_r_a_t_o_r_=_=(const _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -238 const _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -239 { │ │ │ │ │ -240 if(std::is_convertible::value) │ │ │ │ │ -241 return static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ -242 else │ │ │ │ │ -243 return static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ -244 } │ │ │ │ │ -245 │ │ │ │ │ -256 template │ │ │ │ │ -258 inline typename EnableIfInterOperable::type │ │ │ │ │ -_2_5_9 _o_p_e_r_a_t_o_r_!_=(const _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -260 const _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -261 { │ │ │ │ │ -262 if(std::is_convertible::value) │ │ │ │ │ -263 return !static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ -264 else │ │ │ │ │ -265 return !static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ -266 } │ │ │ │ │ -267 │ │ │ │ │ -272 template │ │ │ │ │ -_2_7_3 class _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -274 { │ │ │ │ │ -275 │ │ │ │ │ -276 public: │ │ │ │ │ -277 /* type aliases required by C++ for iterators */ │ │ │ │ │ -_2_7_8 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::bidirectional_iterator_tag; │ │ │ │ │ -_2_7_9 using _v_a_l_u_e___t_y_p_e = typename std::remove_const::type; │ │ │ │ │ -_2_8_0 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = D; │ │ │ │ │ -_2_8_1 using _p_o_i_n_t_e_r = V*; │ │ │ │ │ -_2_8_2 using _r_e_f_e_r_e_n_c_e = R; │ │ │ │ │ -283 │ │ │ │ │ -_3_0_9 typedef T _D_e_r_i_v_e_d_T_y_p_e; │ │ │ │ │ -310 │ │ │ │ │ -_3_1_4 typedef V _V_a_l_u_e; │ │ │ │ │ -315 │ │ │ │ │ -_3_1_9 typedef V* _P_o_i_n_t_e_r; │ │ │ │ │ -320 │ │ │ │ │ -_3_2_4 typedef D _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ -325 │ │ │ │ │ -_3_2_9 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -330 │ │ │ │ │ -_3_3_2 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ -333 { │ │ │ │ │ -334 return static_cast<_D_e_r_i_v_e_d_T_y_p_e const*>(this)->dereference(); │ │ │ │ │ -335 } │ │ │ │ │ -336 │ │ │ │ │ -_3_3_7 _P_o_i_n_t_e_r _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ -338 { │ │ │ │ │ -339 return &(static_cast(this)->dereference()); │ │ │ │ │ -340 } │ │ │ │ │ -341 │ │ │ │ │ -_3_4_3 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -344 { │ │ │ │ │ -345 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->increment(); │ │ │ │ │ -346 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ -347 } │ │ │ │ │ -348 │ │ │ │ │ -_3_5_0 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_+_+(int) │ │ │ │ │ -351 { │ │ │ │ │ -352 _D_e_r_i_v_e_d_T_y_p_e tmp(static_cast<_D_e_r_i_v_e_d_T_y_p_e const&>(*this)); │ │ │ │ │ -353 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ -354 return tmp; │ │ │ │ │ -355 } │ │ │ │ │ -356 │ │ │ │ │ -357 │ │ │ │ │ -_3_5_9 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ -360 { │ │ │ │ │ -361 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->decrement(); │ │ │ │ │ -362 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ -363 } │ │ │ │ │ -364 │ │ │ │ │ -_3_6_6 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_-_-(int) │ │ │ │ │ -367 { │ │ │ │ │ -368 _D_e_r_i_v_e_d_T_y_p_e tmp(static_cast<_D_e_r_i_v_e_d_T_y_p_e const&>(*this)); │ │ │ │ │ -369 this->_o_p_e_r_a_t_o_r_-_-(); │ │ │ │ │ -370 return tmp; │ │ │ │ │ -371 } │ │ │ │ │ -372 }; │ │ │ │ │ -373 │ │ │ │ │ -381 template │ │ │ │ │ -383 inline typename std::enable_if::value,bool>:: │ │ │ │ │ -type │ │ │ │ │ -_3_8_4 _o_p_e_r_a_t_o_r_=_=(const _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -385 const _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -386 { │ │ │ │ │ -387 return static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ -388 } │ │ │ │ │ -389 │ │ │ │ │ -398 template │ │ │ │ │ -400 inline │ │ │ │ │ -401 typename std::enable_if::value && !std:: │ │ │ │ │ -is_convertible::value, │ │ │ │ │ -402 bool>::type │ │ │ │ │ -_4_0_3 _o_p_e_r_a_t_o_r_=_=(const _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -404 const _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -405 { │ │ │ │ │ -406 return static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ -407 } │ │ │ │ │ -408 │ │ │ │ │ -419 template │ │ │ │ │ -421 inline typename EnableIfInterOperable::type │ │ │ │ │ -_4_2_2 _o_p_e_r_a_t_o_r_!_=(const _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -423 const _B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -424 { │ │ │ │ │ -425 return !(lhs == rhs); │ │ │ │ │ -426 } │ │ │ │ │ -427 │ │ │ │ │ -432 template │ │ │ │ │ -_4_3_3 class _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -434 { │ │ │ │ │ -435 │ │ │ │ │ -436 public: │ │ │ │ │ -437 /* type aliases required by C++ for iterators */ │ │ │ │ │ -_4_3_8 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::random_access_iterator_tag; │ │ │ │ │ -_4_3_9 using _v_a_l_u_e___t_y_p_e = typename std::remove_const::type; │ │ │ │ │ -_4_4_0 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = D; │ │ │ │ │ -_4_4_1 using _p_o_i_n_t_e_r = V*; │ │ │ │ │ -_4_4_2 using _r_e_f_e_r_e_n_c_e = R; │ │ │ │ │ -443 │ │ │ │ │ -_4_7_7 typedef T _D_e_r_i_v_e_d_T_y_p_e; │ │ │ │ │ -478 │ │ │ │ │ -_4_8_2 typedef V _V_a_l_u_e; │ │ │ │ │ -483 │ │ │ │ │ -_4_8_7 typedef V* _P_o_i_n_t_e_r; │ │ │ │ │ -488 │ │ │ │ │ -_4_9_2 typedef D _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ -493 │ │ │ │ │ -_4_9_7 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -498 │ │ │ │ │ -_5_0_0 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ -501 { │ │ │ │ │ -502 return static_cast<_D_e_r_i_v_e_d_T_y_p_e const*>(this)->dereference(); │ │ │ │ │ -503 } │ │ │ │ │ -504 │ │ │ │ │ -_5_0_5 _P_o_i_n_t_e_r _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ -506 { │ │ │ │ │ -507 return &(static_cast(this)->dereference()); │ │ │ │ │ -508 } │ │ │ │ │ -509 │ │ │ │ │ -_5_1_5 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](_D_i_f_f_e_r_e_n_c_e_T_y_p_e n) const │ │ │ │ │ -516 { │ │ │ │ │ -517 return static_cast(this)->elementAt(n); │ │ │ │ │ -518 } │ │ │ │ │ -519 │ │ │ │ │ -_5_2_1 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -522 { │ │ │ │ │ -523 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->increment(); │ │ │ │ │ -524 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ -525 } │ │ │ │ │ -526 │ │ │ │ │ -_5_2_8 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_+_+(int) │ │ │ │ │ -529 { │ │ │ │ │ -530 _D_e_r_i_v_e_d_T_y_p_e tmp(static_cast<_D_e_r_i_v_e_d_T_y_p_e const&>(*this)); │ │ │ │ │ -531 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ -532 return tmp; │ │ │ │ │ -533 } │ │ │ │ │ -534 │ │ │ │ │ -_5_3_5 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_+_=(_D_i_f_f_e_r_e_n_c_e_T_y_p_e n) │ │ │ │ │ -536 { │ │ │ │ │ -537 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->advance(n); │ │ │ │ │ -538 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ -539 } │ │ │ │ │ -540 │ │ │ │ │ -_5_4_1 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_+(_D_i_f_f_e_r_e_n_c_e_T_y_p_e n) const │ │ │ │ │ -542 { │ │ │ │ │ -543 _D_e_r_i_v_e_d_T_y_p_e tmp(static_cast<_D_e_r_i_v_e_d_T_y_p_e const&>(*this)); │ │ │ │ │ -544 tmp.advance(n); │ │ │ │ │ -545 return tmp; │ │ │ │ │ -546 } │ │ │ │ │ -547 │ │ │ │ │ -548 │ │ │ │ │ -_5_5_0 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ -551 { │ │ │ │ │ -552 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->decrement(); │ │ │ │ │ -553 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ -554 } │ │ │ │ │ -555 │ │ │ │ │ -_5_5_7 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_-_-(int) │ │ │ │ │ -558 { │ │ │ │ │ -559 _D_e_r_i_v_e_d_T_y_p_e tmp(static_cast<_D_e_r_i_v_e_d_T_y_p_e const&>(*this)); │ │ │ │ │ -560 this->_o_p_e_r_a_t_o_r_-_-(); │ │ │ │ │ -561 return tmp; │ │ │ │ │ -562 } │ │ │ │ │ -563 │ │ │ │ │ -_5_6_4 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_-_=(_D_i_f_f_e_r_e_n_c_e_T_y_p_e n) │ │ │ │ │ -565 { │ │ │ │ │ -566 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->advance(-n); │ │ │ │ │ -567 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ -568 } │ │ │ │ │ -569 │ │ │ │ │ -_5_7_0 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_-(_D_i_f_f_e_r_e_n_c_e_T_y_p_e n) const │ │ │ │ │ -571 { │ │ │ │ │ -572 _D_e_r_i_v_e_d_T_y_p_e tmp(static_cast<_D_e_r_i_v_e_d_T_y_p_e const&>(*this)); │ │ │ │ │ -573 tmp.advance(-n); │ │ │ │ │ -574 return tmp; │ │ │ │ │ -575 } │ │ │ │ │ -576 │ │ │ │ │ -577 │ │ │ │ │ -578 }; │ │ │ │ │ -579 │ │ │ │ │ -590 template │ │ │ │ │ -592 inline typename EnableIfInterOperable::type │ │ │ │ │ -_5_9_3 _o_p_e_r_a_t_o_r_=_=(const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -594 const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -595 { │ │ │ │ │ -596 if(std::is_convertible::value) │ │ │ │ │ -597 return static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ -598 else │ │ │ │ │ -599 return static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ -600 } │ │ │ │ │ -601 │ │ │ │ │ -612 template │ │ │ │ │ -614 inline typename EnableIfInterOperable::type │ │ │ │ │ -_6_1_5 _o_p_e_r_a_t_o_r_!_=(const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -616 const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -617 { │ │ │ │ │ -618 if(std::is_convertible::value) │ │ │ │ │ -619 return !static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ -620 else │ │ │ │ │ -621 return !static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ -622 } │ │ │ │ │ -623 │ │ │ │ │ -634 template │ │ │ │ │ -_6_3_6 inline typename _E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e_<_T_1_,_T_2_,_b_o_o_l_>_:_:_t_y_p_e │ │ │ │ │ -637 _o_p_e_r_a_t_o_r_<(const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -638 const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -639 { │ │ │ │ │ -640 if(std::is_convertible::value) │ │ │ │ │ -641 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ -(rhs))>0; │ │ │ │ │ -642 else │ │ │ │ │ -643 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ -(lhs))<0; │ │ │ │ │ -644 } │ │ │ │ │ -645 │ │ │ │ │ -646 │ │ │ │ │ -657 template │ │ │ │ │ -_6_5_9 inline typename _E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e_<_T_1_,_T_2_,_b_o_o_l_>_:_:_t_y_p_e │ │ │ │ │ -660 _o_p_e_r_a_t_o_r_<_=(const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -661 const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -662 { │ │ │ │ │ -663 if(std::is_convertible::value) │ │ │ │ │ -664 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ -(rhs))>=0; │ │ │ │ │ -665 else │ │ │ │ │ -666 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ -(lhs))<=0; │ │ │ │ │ -667 } │ │ │ │ │ -668 │ │ │ │ │ -669 │ │ │ │ │ -680 template │ │ │ │ │ -682 inline typename EnableIfInterOperable::type │ │ │ │ │ -_6_8_3 _o_p_e_r_a_t_o_r_>(const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -684 const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -685 { │ │ │ │ │ -686 if(std::is_convertible::value) │ │ │ │ │ -687 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ -(rhs))<0; │ │ │ │ │ -688 else │ │ │ │ │ -689 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ -(lhs))>0; │ │ │ │ │ -690 } │ │ │ │ │ -691 │ │ │ │ │ -702 template │ │ │ │ │ -704 inline typename EnableIfInterOperable::type │ │ │ │ │ -_7_0_5 _o_p_e_r_a_t_o_r_>_=(const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -706 const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -707 { │ │ │ │ │ -708 if(std::is_convertible::value) │ │ │ │ │ -709 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ -(rhs))<=0; │ │ │ │ │ -710 else │ │ │ │ │ -711 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ -(lhs))>=0; │ │ │ │ │ -712 } │ │ │ │ │ -713 │ │ │ │ │ -724 template │ │ │ │ │ -726 inline typename EnableIfInterOperable::type │ │ │ │ │ -_7_2_7 _o_p_e_r_a_t_o_r_-(const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_V_1_,_R_1_,_D_>& lhs, │ │ │ │ │ -728 const _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_V_2_,_R_2_,_D_>& rhs) │ │ │ │ │ -729 { │ │ │ │ │ -730 if(std::is_convertible::value) │ │ │ │ │ -731 return -static_cast(lhs).distanceTo(static_cast │ │ │ │ │ -(rhs)); │ │ │ │ │ -732 else │ │ │ │ │ -733 return static_cast(rhs).distanceTo(static_cast(lhs)); │ │ │ │ │ -734 } │ │ │ │ │ -735 │ │ │ │ │ -737} │ │ │ │ │ -738#endif │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ -bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:542 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator<(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:637 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_> │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator>(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:683 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator<=(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:660 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for equality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator>=(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:705 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for inequality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ +13namespace _D_u_n_e { │ │ │ │ │ +14 │ │ │ │ │ +15namespace Impl { │ │ │ │ │ +16 │ │ │ │ │ +17 template │ │ │ │ │ +18 class IsReferenceWrapper : public std::false_type {}; │ │ │ │ │ +19 │ │ │ │ │ +20 template │ │ │ │ │ +21 class IsReferenceWrapper<_s_t_d::reference_wrapper> : public std::true_type │ │ │ │ │ +{}; │ │ │ │ │ +22 │ │ │ │ │ +23 template │ │ │ │ │ +24 class IsReferenceWrapper> : public std:: │ │ │ │ │ +true_type {}; │ │ │ │ │ +25 │ │ │ │ │ +26} // namespace Dune::Impl │ │ │ │ │ +27 │ │ │ │ │ +28 │ │ │ │ │ +34template │ │ │ │ │ +_3_5constexpr bool _I_s_R_e_f_e_r_e_n_c_e_W_r_a_p_p_e_r___v = Impl::IsReferenceWrapper::value; │ │ │ │ │ +36 │ │ │ │ │ +37 │ │ │ │ │ +46template │ │ │ │ │ +_4_7constexpr T& _r_e_s_o_l_v_e_R_e_f(T& gf) noexcept │ │ │ │ │ +48{ │ │ │ │ │ +49 return gf; │ │ │ │ │ +50} │ │ │ │ │ +51 │ │ │ │ │ +52 │ │ │ │ │ +53// There's no overload for non std::reference_wrapper r-values, │ │ │ │ │ +54// because this may lead to undefined behavior whenever the │ │ │ │ │ +55// return value is stored. │ │ │ │ │ +56// Notice that deleting the overload is not necessary, but │ │ │ │ │ +57// helps to document that it is missing on purpose. It also │ │ │ │ │ +58// leads to nicer error messages. │ │ │ │ │ +59template │ │ │ │ │ +_6_0const auto& _r_e_s_o_l_v_e_R_e_f(T&& gf) = delete; │ │ │ │ │ +61 │ │ │ │ │ +62 │ │ │ │ │ +81template │ │ │ │ │ +_8_2constexpr T& _r_e_s_o_l_v_e_R_e_f(std::reference_wrapper gf) noexcept │ │ │ │ │ +83{ │ │ │ │ │ +84 return gf.get(); │ │ │ │ │ +85} │ │ │ │ │ +86 │ │ │ │ │ +87 │ │ │ │ │ +88 │ │ │ │ │ +99template │ │ │ │ │ +_1_0_0using _R_e_s_o_l_v_e_R_e_f___t = std::remove_reference_t()))>; │ │ │ │ │ +101 │ │ │ │ │ +102 │ │ │ │ │ +103} // namespace Dune │ │ │ │ │ +104 │ │ │ │ │ +105 │ │ │ │ │ +106 │ │ │ │ │ +107#endif // DUNE_COMMON_REFERENCE_HELPER_HH │ │ │ │ │ +_D_u_n_e_:_:_I_s_R_e_f_e_r_e_n_c_e_W_r_a_p_p_e_r___v │ │ │ │ │ +constexpr bool IsReferenceWrapper_v │ │ │ │ │ +Helper to detect if given type is a std::reference_wrapper. │ │ │ │ │ +DDeeffiinniittiioonn referencehelper.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f │ │ │ │ │ +constexpr T & resolveRef(T &gf) noexcept │ │ │ │ │ +Helper function to resolve std::reference_wrapper. │ │ │ │ │ +DDeeffiinniittiioonn referencehelper.hh:47 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -Base class for stl conformant forward iterators. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y │ │ │ │ │ -std::forward_iterator_tag iterator_category │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_p_o_i_n_t_e_r │ │ │ │ │ -V * pointer │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:148 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -DerivedType & operator++() │ │ │ │ │ -Preincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:209 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_D_i_f_f_e_r_e_n_c_e_T_y_p_e │ │ │ │ │ -D DifferenceType │ │ │ │ │ -The type of the difference between two positions. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:190 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -R Reference │ │ │ │ │ -The type of the reference to the values accessed. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:195 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ -Pointer operator->() const │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:203 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_D_e_r_i_v_e_d_T_y_p_e │ │ │ │ │ -T DerivedType │ │ │ │ │ -The type of derived iterator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:175 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_V_a_l_u_e │ │ │ │ │ -V Value │ │ │ │ │ -The type of value accessed through the iterator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -typename std::remove_const< V >::type value_type │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:146 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -DerivedType operator++(int) │ │ │ │ │ -Postincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_P_o_i_n_t_e_r │ │ │ │ │ -V * Pointer │ │ │ │ │ -The pointer to the Value. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:185 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -D difference_type │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -Reference operator*() const │ │ │ │ │ -Dereferencing operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:198 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -R reference │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -Facade class for stl conformant bidirectional iterators. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:274 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_p_o_i_n_t_e_r │ │ │ │ │ -V * pointer │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:281 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -typename std::remove_const< V >::type value_type │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:279 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -Reference operator*() const │ │ │ │ │ -Dereferencing operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:332 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -D difference_type │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:280 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_D_e_r_i_v_e_d_T_y_p_e │ │ │ │ │ -T DerivedType │ │ │ │ │ -The type of derived iterator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:309 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ -DerivedType & operator--() │ │ │ │ │ -Preincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:359 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ -Pointer operator->() const │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:337 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -DerivedType & operator++() │ │ │ │ │ -Preincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:343 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_P_o_i_n_t_e_r │ │ │ │ │ -V * Pointer │ │ │ │ │ -The pointer to the Value. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:319 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -R Reference │ │ │ │ │ -The type of the reference to the values accessed. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:329 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -DerivedType operator++(int) │ │ │ │ │ -Postincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:350 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y │ │ │ │ │ -std::bidirectional_iterator_tag iterator_category │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_D_i_f_f_e_r_e_n_c_e_T_y_p_e │ │ │ │ │ -D DifferenceType │ │ │ │ │ -The type of the difference between two positions. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:324 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ -DerivedType operator--(int) │ │ │ │ │ -Postincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:366 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -R reference │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_V_a_l_u_e │ │ │ │ │ -V Value │ │ │ │ │ -The type of value accessed through the iterator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:314 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -Base class for stl conformant forward iterators. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:434 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -typename std::remove_const< V >::type value_type │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:439 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -D difference_type │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:440 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ -DerivedType operator--(int) │ │ │ │ │ -Postdecrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:557 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_p_o_i_n_t_e_r │ │ │ │ │ -V * pointer │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:441 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y │ │ │ │ │ -std::random_access_iterator_tag iterator_category │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:438 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -Reference operator*() const │ │ │ │ │ -Dereferencing operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:500 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -DerivedType & operator++() │ │ │ │ │ -Preincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:521 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -R reference │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:442 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ -Pointer operator->() const │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:505 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_D_i_f_f_e_r_e_n_c_e_T_y_p_e │ │ │ │ │ -D DifferenceType │ │ │ │ │ -The type of the difference between two positions. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:492 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ -DerivedType & operator--() │ │ │ │ │ -Predecrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:550 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ -DerivedType & operator-=(DifferenceType n) │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:564 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ -DerivedType operator+(DifferenceType n) const │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:541 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -Reference operator[](DifferenceType n) const │ │ │ │ │ -Get the element n positions from the current one. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:515 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_D_e_r_i_v_e_d_T_y_p_e │ │ │ │ │ -T DerivedType │ │ │ │ │ -The type of derived iterator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:477 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_P_o_i_n_t_e_r │ │ │ │ │ -V * Pointer │ │ │ │ │ -The pointer to the Value. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:487 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ -DerivedType operator-(DifferenceType n) const │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:570 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -DerivedType operator++(int) │ │ │ │ │ -Postincrement operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:528 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_V_a_l_u_e │ │ │ │ │ -V Value │ │ │ │ │ -The type of value accessed through the iterator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:482 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ -DerivedType & operator+=(DifferenceType n) │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:535 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -R Reference │ │ │ │ │ -The type of the reference to the values accessed. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:497 │ │ │ │ │ -_D_u_n_e_:_:_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e │ │ │ │ │ -Enable typedef if two types are interoperable. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_R_e_s_o_l_v_e_R_e_f___t │ │ │ │ │ +std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))> │ │ │ │ │ +ResolveRef_t │ │ │ │ │ +Type trait to resolve std::reference_wrapper. │ │ │ │ │ +DDeeffiinniittiioonn referencehelper.hh:100 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00017.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: matvectraits.hh File Reference │ │ │ │ +dune-common: rangeutilities.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,37 +71,120 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
matvectraits.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
rangeutilities.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Documentation of the traits classes you need to write for each implementation of DenseVector or DenseMatrix. │ │ │ │ +

Utilities for reduction like operations on ranges. │ │ │ │ More...

│ │ │ │ - │ │ │ │ +
#include <dune/common/typetraits.hh>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <bitset>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::DenseMatVecTraits< T >
class  Dune::IntegralRange< T >
 dynamic integer range for use in range-based for loops More...
 
class  Dune::StaticIntegralRange< T, to, from >
 static integer range for use in range-based for loops More...
 
struct  Dune::ValueTransformationTag
 Tag to enable value based transformations in TransformedRangeView. More...
 
struct  Dune::IteratorTransformationTag
 Tag to enable iterator based transformations in TransformedRangeView. More...
 
class  Dune::TransformedRangeView< R, F, T >
 A range transforming the values of another range on-the-fly. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
T::value_type Dune::max_value (const T &v)
 compute the maximum value over a range
 
template<typename T , typename std::enable_if<!IsIterable< T >::value, int >::type = 0>
const T & Dune::max_value (const T &v)
 
template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
T::value_type Dune::min_value (const T &v)
 compute the minimum value over a range
 
template<typename T , typename std::enable_if<!IsIterable< T >::value, int >::type = 0>
const T & Dune::min_value (const T &v)
 
template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
bool Dune::any_true (const T &v)
 similar to std::bitset<N>::any() return true, if any entries is true
 
template<std::size_t N>
bool Dune::any_true (const std::bitset< N > &b)
 
template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
bool Dune::all_true (const T &v)
 similar to std::bitset<N>::all() return true, if any entries is true
 
template<std::size_t N>
bool Dune::all_true (const std::bitset< N > &b)
 
template<class T , class U , std::enable_if_t< std::is_same< std::decay_t< T >, std::decay_t< U > >::value, int > = 0, std::enable_if_t< std::is_integral< std::decay_t< T > >::value, int > = 0>
static IntegralRange< std::decay_t< T > > Dune::range (T &&from, U &&to) noexcept
 free standing function for setting up a range based for loop over an integer range for (auto i: range(0,10)) // 0,1,2,3,4,5,6,7,8,9 or for (auto i: range(-10,10)) // -10,-9,..,8,9 or for (auto i: range(10)) // 0,1,2,3,4,5,6,7,8,9
 
template<class T , std::enable_if_t< std::is_integral< std::decay_t< T > >::value, int > = 0>
static IntegralRange< std::decay_t< T > > Dune::range (T &&to) noexcept
 
template<class T , std::enable_if_t< std::is_enum< std::decay_t< T > >::value, int > = 0>
static IntegralRange< std::underlying_type_t< std::decay_t< T > > > Dune::range (T &&to) noexcept
 
template<class T , T to>
static StaticIntegralRange< T, to > Dune::range (std::integral_constant< T, to >) noexcept
 
template<class R , class F >
auto Dune::transformedRangeView (R &&range, const F &f)
 Create a TransformedRangeView.
 
template<class R , class F >
auto Dune::iteratorTransformedRangeView (R &&range, const F &f)
 Create a TransformedRangeView using an iterator transformation.
 
template<class Range >
auto Dune::sparseRange (Range &&range)
 Allow structured-binding for-loops for sparse iterators.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Variables

template<class T , T from, T to>
static StaticIntegralRange< T, to, from > Dune::range (std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
 
│ │ │ │

Detailed Description

│ │ │ │ -

Documentation of the traits classes you need to write for each implementation of DenseVector or DenseMatrix.

│ │ │ │ +

Utilities for reduction like operations on ranges.

│ │ │ │ +
Author
Christian Engwer
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,23 +1,132 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -matvectraits.hh File Reference │ │ │ │ │ -Documentation of the traits classes you need to write for each implementation │ │ │ │ │ -of DenseVector or DenseMatrix. _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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +rangeutilities.hh File Reference │ │ │ │ │ +Utilities for reduction like operations on ranges. _M_o_r_e_._._. │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._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 │ │ │ │ │ -struct   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_<_ _T_ _> │ │ │ │ │ +  dynamic integer range for use in range-based for loops _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_<_ _T_,_ _t_o_,_ _f_r_o_m_ _> │ │ │ │ │ +  static integer range for use in range-based for loops _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ +  Tag to enable value based transformations in _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ +  Tag to enable iterator based transformations in _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_<_ _R_,_ _F_,_ _T_ _> │ │ │ │ │ +  A range transforming the values of another range on-the-fly. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template::value, int >:: │ │ │ │ │ +type = 0> │ │ │ │ │ + T::value_type  _D_u_n_e_:_:_m_a_x___v_a_l_u_e (const T &v) │ │ │ │ │ +  compute the maximum value over a range │ │ │ │ │ +  │ │ │ │ │ +template::value, int >:: │ │ │ │ │ +type = 0> │ │ │ │ │ + const T &  _D_u_n_e_:_:_m_a_x___v_a_l_u_e (const T &v) │ │ │ │ │ +  │ │ │ │ │ +template::value, int >:: │ │ │ │ │ +type = 0> │ │ │ │ │ + T::value_type  _D_u_n_e_:_:_m_i_n___v_a_l_u_e (const T &v) │ │ │ │ │ +  compute the minimum value over a range │ │ │ │ │ +  │ │ │ │ │ +template::value, int >:: │ │ │ │ │ +type = 0> │ │ │ │ │ + const T &  _D_u_n_e_:_:_m_i_n___v_a_l_u_e (const T &v) │ │ │ │ │ +  │ │ │ │ │ +template::value, int >:: │ │ │ │ │ +type = 0> │ │ │ │ │ + bool  _D_u_n_e_:_:_a_n_y___t_r_u_e (const T &v) │ │ │ │ │ +  similar to std::bitset::any() return │ │ │ │ │ + true, if any entries is true │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_a_n_y___t_r_u_e (const std::bitset< N > │ │ │ │ │ + &b) │ │ │ │ │ +  │ │ │ │ │ +template::value, int >:: │ │ │ │ │ +type = 0> │ │ │ │ │ + bool  _D_u_n_e_:_:_a_l_l___t_r_u_e (const T &v) │ │ │ │ │ +  similar to std::bitset::all() return │ │ │ │ │ + true, if any entries is true │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_a_l_l___t_r_u_e (const std::bitset< N > │ │ │ │ │ + &b) │ │ │ │ │ +  │ │ │ │ │ +template, │ │ │ │ │ +std::decay_t< U > >::value, int > = 0, std::enable_if_t< std::is_integral< │ │ │ │ │ +std::decay_t< T > >::value, int > = 0> │ │ │ │ │ +static _I_n_t_e_g_r_a_l_R_a_n_g_e< std::decay_t< T > │ │ │ │ │ + >  _D_u_n_e_:_:_r_a_n_g_e (T &&from, U &&to) noexcept │ │ │ │ │ + free standing function for setting up a │ │ │ │ │ + range based for loop over an integer │ │ │ │ │ + range for (auto i: _r_a_n_g_e_(_0_,_1_0_)) / │ │ │ │ │ +  / 0,1,2,3,4,5,6,7,8,9 or for (auto i: │ │ │ │ │ + range(-10,10)) // -10,-9,..,8,9 or for │ │ │ │ │ + (auto i: _r_a_n_g_e_(_1_0_)) / │ │ │ │ │ + / 0,1,2,3,4,5,6,7,8,9 │ │ │ │ │ +  │ │ │ │ │ +template >:: │ │ │ │ │ +value, int > = 0> │ │ │ │ │ +static _I_n_t_e_g_r_a_l_R_a_n_g_e< std::decay_t< T > │ │ │ │ │ + >  _D_u_n_e_:_:_r_a_n_g_e (T &&to) noexcept │ │ │ │ │ +  │ │ │ │ │ +template >::value, │ │ │ │ │ +int > = 0> │ │ │ │ │ + static _I_n_t_e_g_r_a_l_R_a_n_g_e< std:: │ │ │ │ │ + underlying_type_t< std::decay_t< T > > │ │ │ │ │ + >  _D_u_n_e_:_:_r_a_n_g_e (T &&to) noexcept │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e< T, to >  _D_u_n_e_:_:_r_a_n_g_e (std::integral_constant< T, │ │ │ │ │ + to >) noexcept │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_t_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w (R &&_r_a_n_g_e, │ │ │ │ │ + const F &f) │ │ │ │ │ +  Create a _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w (R │ │ │ │ │ + &&_r_a_n_g_e, const F &f) │ │ │ │ │ +  Create a _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w using an │ │ │ │ │ + iterator transformation. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_s_p_a_r_s_e_R_a_n_g_e (Range &&_r_a_n_g_e) │ │ │ │ │ +  Allow structured-binding for-loops for │ │ │ │ │ + sparse iterators. │ │ │ │ │ +  │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ +template │ │ │ │ │ +static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e< T, to, from _D_u_n_e_:_:_r_a_n_g_e (std::integral_constant< T, │ │ │ │ │ + >  from >, std::integral_constant< T, to │ │ │ │ │ + >) noexcept │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Documentation of the traits classes you need to write for each implementation │ │ │ │ │ -of DenseVector or DenseMatrix. │ │ │ │ │ +Utilities for reduction like operations on ranges. │ │ │ │ │ + Author │ │ │ │ │ + Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: matvectraits.hh Source File │ │ │ │ +dune-common: rangeutilities.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,37 +74,707 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
matvectraits.hh
│ │ │ │ +
rangeutilities.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_MATVECTRAITS_HH
│ │ │ │ -
6#define DUNE_MATVECTRAITS_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_RANGE_UTILITIES_HH
│ │ │ │ +
6#define DUNE_COMMON_RANGE_UTILITIES_HH
│ │ │ │
7
│ │ │ │ -
12namespace Dune {
│ │ │ │ + │ │ │ │ +
9#include <algorithm>
│ │ │ │ +
10#include <utility>
│ │ │ │ +
11#include <type_traits>
│ │ │ │ +
12#include <bitset>
│ │ │ │
13
│ │ │ │ -
22
│ │ │ │ -
24
│ │ │ │ -
26
│ │ │ │ -
30 template<class T>
│ │ │ │ - │ │ │ │ -
32
│ │ │ │ -
33} // end namespace Dune
│ │ │ │ -
34
│ │ │ │ -
35#endif // DUNE_FTRAITS_HH
│ │ │ │ +
21namespace Dune
│ │ │ │ +
22{
│ │ │ │ +
23
│ │ │ │ +
34 template <typename T,
│ │ │ │ +
35 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
36 typename T::value_type
│ │ │ │ +
│ │ │ │ +
37 max_value(const T & v) {
│ │ │ │ +
38 using std::max_element;
│ │ │ │ +
39 return *max_element(v.begin(), v.end());
│ │ │ │ +
40 }
│ │ │ │ +
│ │ │ │ +
41
│ │ │ │ +
42 template <typename T,
│ │ │ │ +
43 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
44 const T & max_value(const T & v) { return v; }
│ │ │ │ +
45
│ │ │ │ +
51 template <typename T,
│ │ │ │ +
52 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
53 typename T::value_type
│ │ │ │ +
│ │ │ │ +
54 min_value(const T & v) {
│ │ │ │ +
55 using std::min_element;
│ │ │ │ +
56 return *min_element(v.begin(), v.end());
│ │ │ │ +
57 }
│ │ │ │ +
│ │ │ │ +
58
│ │ │ │ +
59 template <typename T,
│ │ │ │ +
60 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
61 const T & min_value(const T & v) { return v; }
│ │ │ │ +
62
│ │ │ │ +
68 template <typename T,
│ │ │ │ +
69 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
70 bool any_true(const T & v) {
│ │ │ │ +
71 bool b = false;
│ │ │ │ +
72 for (const auto & e : v)
│ │ │ │ +
73 b = b or bool(e);
│ │ │ │ +
74 return b;
│ │ │ │ +
75 }
│ │ │ │ +
│ │ │ │ +
76
│ │ │ │ +
77 template <typename T,
│ │ │ │ +
78 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
79 bool any_true(const T & v) { return v; }
│ │ │ │ +
80
│ │ │ │ +
81 template<std::size_t N>
│ │ │ │ +
│ │ │ │ +
82 bool any_true(const std::bitset<N> & b)
│ │ │ │ +
83 {
│ │ │ │ +
84 return b.any();
│ │ │ │ +
85 }
│ │ │ │ +
│ │ │ │ +
86
│ │ │ │ +
92 template <typename T,
│ │ │ │ +
93 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
94 bool all_true(const T & v) {
│ │ │ │ +
95 bool b = true;
│ │ │ │ +
96 for (const auto & e : v)
│ │ │ │ +
97 b = b and bool(e);
│ │ │ │ +
98 return b;
│ │ │ │ +
99 }
│ │ │ │ +
│ │ │ │ +
100
│ │ │ │ +
101 template <typename T,
│ │ │ │ +
102 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
│ │ │ │ +
103 bool all_true(const T & v) { return v; }
│ │ │ │ +
104
│ │ │ │ +
105 template<std::size_t N>
│ │ │ │ +
│ │ │ │ +
106 bool all_true(const std::bitset<N> & b)
│ │ │ │ +
107 {
│ │ │ │ +
108 return b.all();
│ │ │ │ +
109 }
│ │ │ │ +
│ │ │ │ +
110
│ │ │ │ +
111
│ │ │ │ +
112
│ │ │ │ +
113 namespace Impl
│ │ │ │ +
114 {
│ │ │ │ +
115
│ │ │ │ +
116 template <class T>
│ │ │ │ +
117 class IntegralRangeIterator
│ │ │ │ +
118 {
│ │ │ │ +
119 public:
│ │ │ │ +
120 typedef std::random_access_iterator_tag iterator_category;
│ │ │ │ +
121 typedef T value_type;
│ │ │ │ +
122 typedef std::make_signed_t<T> difference_type;
│ │ │ │ +
123 typedef const T *pointer;
│ │ │ │ +
124 typedef T reference;
│ │ │ │ +
125
│ │ │ │ +
126 constexpr IntegralRangeIterator() noexcept : value_(0) {}
│ │ │ │ +
127 constexpr explicit IntegralRangeIterator(value_type value) noexcept : value_(value) {}
│ │ │ │ +
128
│ │ │ │ +
129 pointer operator->() const noexcept { return &value_; }
│ │ │ │ +
130 constexpr reference operator*() const noexcept { return value_; }
│ │ │ │ +
131
│ │ │ │ +
132 constexpr reference operator[]( difference_type n ) const noexcept { return (value_ + n); }
│ │ │ │ +
133
│ │ │ │ +
134 constexpr bool operator==(const IntegralRangeIterator & other) const noexcept { return (value_ == other.value_); }
│ │ │ │ +
135 constexpr bool operator!=(const IntegralRangeIterator & other) const noexcept { return (value_ != other.value_); }
│ │ │ │ +
136
│ │ │ │ +
137 constexpr bool operator<(const IntegralRangeIterator & other) const noexcept { return (value_ <= other.value_); }
│ │ │ │ +
138 constexpr bool operator<=(const IntegralRangeIterator & other) const noexcept { return (value_ <= other.value_); }
│ │ │ │ +
139 constexpr bool operator>(const IntegralRangeIterator & other) const noexcept { return (value_ >= other.value_); }
│ │ │ │ +
140 constexpr bool operator>=(const IntegralRangeIterator & other) const noexcept { return (value_ >= other.value_); }
│ │ │ │ +
141
│ │ │ │ +
142 IntegralRangeIterator& operator++() noexcept { ++value_; return *this; }
│ │ │ │ +
143 IntegralRangeIterator operator++(int) noexcept { IntegralRangeIterator copy( *this ); ++(*this); return copy; }
│ │ │ │ +
144
│ │ │ │ +
145 IntegralRangeIterator& operator--() noexcept { --value_; return *this; }
│ │ │ │ +
146 IntegralRangeIterator operator--(int) noexcept { IntegralRangeIterator copy( *this ); --(*this); return copy; }
│ │ │ │ +
147
│ │ │ │ +
148 IntegralRangeIterator& operator+=(difference_type n) noexcept { value_ += n; return *this; }
│ │ │ │ +
149 IntegralRangeIterator& operator-=(difference_type n) noexcept { value_ -= n; return *this; }
│ │ │ │ +
150
│ │ │ │ +
151 friend constexpr IntegralRangeIterator operator+(const IntegralRangeIterator &a, difference_type n) noexcept { return IntegralRangeIterator(a.value_ + n); }
│ │ │ │ +
152 friend constexpr IntegralRangeIterator operator+(difference_type n, const IntegralRangeIterator &a) noexcept { return IntegralRangeIterator(a.value_ + n); }
│ │ │ │ +
153 friend constexpr IntegralRangeIterator operator-(const IntegralRangeIterator &a, difference_type n) noexcept { return IntegralRangeIterator(a.value_ - n); }
│ │ │ │ +
154
│ │ │ │ +
155 constexpr difference_type operator-(const IntegralRangeIterator &other) const noexcept { return (static_cast<difference_type>(value_) - static_cast<difference_type>(other.value_)); }
│ │ │ │ +
156
│ │ │ │ +
157 private:
│ │ │ │ +
158 value_type value_;
│ │ │ │ +
159 };
│ │ │ │ +
160
│ │ │ │ +
161 } // namespace Impl
│ │ │ │ +
162
│ │ │ │ +
163
│ │ │ │ +
164
│ │ │ │ +
173 template <class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
175 {
│ │ │ │ +
176 public:
│ │ │ │ +
178 typedef T value_type;
│ │ │ │ +
180 typedef Impl::IntegralRangeIterator<T> iterator;
│ │ │ │ +
182 typedef std::make_unsigned_t<T> size_type;
│ │ │ │ +
183
│ │ │ │ +
185 constexpr IntegralRange(value_type from, value_type to) noexcept : from_(from), to_(to) {}
│ │ │ │ +
187 constexpr explicit IntegralRange(value_type to) noexcept : from_(0), to_(to) {}
│ │ │ │ +
189 constexpr IntegralRange(std::pair<value_type, value_type> range) noexcept : from_(range.first), to_(range.second) {}
│ │ │ │ +
190
│ │ │ │ +
192 constexpr iterator begin() const noexcept { return iterator(from_); }
│ │ │ │ +
194 constexpr iterator end() const noexcept { return iterator(to_); }
│ │ │ │ +
195
│ │ │ │ +
197 constexpr value_type operator[](const value_type &i) const noexcept { return (from_ + i); }
│ │ │ │ +
198
│ │ │ │ +
200 constexpr bool empty() const noexcept { return (from_ == to_); }
│ │ │ │ +
202 constexpr size_type size() const noexcept { return (static_cast<size_type>(to_) - static_cast<size_type>(from_)); }
│ │ │ │ +
203
│ │ │ │ +
204 private:
│ │ │ │ +
205 value_type from_, to_;
│ │ │ │ +
206 };
│ │ │ │ +
│ │ │ │ +
207
│ │ │ │ +
208
│ │ │ │ +
223 template <class T, T to, T from = 0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
225 {
│ │ │ │ +
226 template <T ofs, T... i>
│ │ │ │ +
227 static std::integer_sequence<T, (i+ofs)...> shift_integer_sequence(std::integer_sequence<T, i...>);
│ │ │ │ +
228
│ │ │ │ +
229 public:
│ │ │ │ +
231 typedef T value_type;
│ │ │ │ +
233 typedef Impl::IntegralRangeIterator<T> iterator;
│ │ │ │ +
235 typedef std::make_unsigned_t<T> size_type;
│ │ │ │ +
236
│ │ │ │ +
238 typedef decltype(shift_integer_sequence<from>(std::make_integer_sequence<T, to-from>())) integer_sequence;
│ │ │ │ +
239
│ │ │ │ +
241 constexpr StaticIntegralRange() noexcept = default;
│ │ │ │ +
242
│ │ │ │ +
244 constexpr operator IntegralRange<T>() const noexcept { return {from, to}; }
│ │ │ │ +
246 constexpr operator integer_sequence() const noexcept { return {}; }
│ │ │ │ +
247
│ │ │ │ +
249 static constexpr iterator begin() noexcept { return iterator(from); }
│ │ │ │ +
251 static constexpr iterator end() noexcept { return iterator(to); }
│ │ │ │ +
252
│ │ │ │ +
254 template <class U, U i>
│ │ │ │ +
│ │ │ │ +
255 constexpr auto operator[](const std::integral_constant<U, i> &) const noexcept
│ │ │ │ +
256 -> std::integral_constant<value_type, from + static_cast<value_type>(i)>
│ │ │ │ +
257 {
│ │ │ │ +
258 return {};
│ │ │ │ +
259 }
│ │ │ │ +
│ │ │ │ +
260
│ │ │ │ +
262 constexpr value_type operator[](const size_type &i) const noexcept { return (from + static_cast<value_type>(i)); }
│ │ │ │ +
263
│ │ │ │ +
265 static constexpr std::integral_constant<bool, from == to> empty() noexcept { return {}; }
│ │ │ │ +
267 static constexpr std::integral_constant<size_type, static_cast<size_type>(to) - static_cast<size_type>(from) > size() noexcept { return {}; }
│ │ │ │ +
268 };
│ │ │ │ +
│ │ │ │ +
269
│ │ │ │ +
279 template<class T, class U,
│ │ │ │ +
280 std::enable_if_t<std::is_same<std::decay_t<T>, std::decay_t<U>>::value, int> = 0,
│ │ │ │ +
281 std::enable_if_t<std::is_integral<std::decay_t<T>>::value, int> = 0>
│ │ │ │ +
│ │ │ │ +
282 inline static IntegralRange<std::decay_t<T>> range(T &&from, U &&to) noexcept
│ │ │ │ +
283 {
│ │ │ │ +
284 return IntegralRange<std::decay_t<T>>(std::forward<T>(from), std::forward<U>(to));
│ │ │ │ +
285 }
│ │ │ │ +
│ │ │ │ +
286
│ │ │ │ +
287 template<class T, std::enable_if_t<std::is_integral<std::decay_t<T>>::value, int> = 0>
│ │ │ │ +
│ │ │ │ +
288 inline static IntegralRange<std::decay_t<T>> range(T &&to) noexcept
│ │ │ │ +
289 {
│ │ │ │ +
290 return IntegralRange<std::decay_t<T>>(std::forward<T>(to));
│ │ │ │ +
291 }
│ │ │ │ +
│ │ │ │ +
292
│ │ │ │ +
293 template<class T, std::enable_if_t<std::is_enum<std::decay_t<T>>::value, int> = 0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
295 {
│ │ │ │ +
296 return IntegralRange<std::underlying_type_t<std::decay_t<T>>>(std::forward<T>(to));
│ │ │ │ +
297 }
│ │ │ │ +
│ │ │ │ +
298
│ │ │ │ +
299 template<class T, T from, T to>
│ │ │ │ +
│ │ │ │ +
300 inline static StaticIntegralRange<T, to, from> range(std::integral_constant<T, from>, std::integral_constant<T, to>) noexcept
│ │ │ │ +
301 {
│ │ │ │ +
302 return {};
│ │ │ │ +
303 }
│ │ │ │ +
│ │ │ │ +
304
│ │ │ │ +
305 template<class T, T to>
│ │ │ │ +
│ │ │ │ +
306 inline static StaticIntegralRange<T, to> range(std::integral_constant<T, to>) noexcept
│ │ │ │ +
307 {
│ │ │ │ +
308 return {};
│ │ │ │ +
309 }
│ │ │ │ +
│ │ │ │ +
310
│ │ │ │ +
311
│ │ │ │ +
312
│ │ │ │ + │ │ │ │ +
317
│ │ │ │ + │ │ │ │ +
322
│ │ │ │ +
323 namespace Impl
│ │ │ │ +
324 {
│ │ │ │ +
325
│ │ │ │ +
326 // Helper class to mimic a pointer for proxy objects.
│ │ │ │ +
327 // This is needed to implement operator-> on an iterator
│ │ │ │ +
328 // using proxy-values. It stores the proxy value but
│ │ │ │ +
329 // provides operator-> like a pointer.
│ │ │ │ +
330 template<class ProxyType>
│ │ │ │ +
331 class PointerProxy
│ │ │ │ +
332 {
│ │ │ │ +
333 public:
│ │ │ │ +
334 PointerProxy(ProxyType&& p) : p_(p)
│ │ │ │ +
335 {}
│ │ │ │ +
336
│ │ │ │ +
337 ProxyType* operator->()
│ │ │ │ +
338 {
│ │ │ │ +
339 return &p_;
│ │ │ │ +
340 }
│ │ │ │ +
341
│ │ │ │ +
342 ProxyType p_;
│ │ │ │ +
343 };
│ │ │ │ +
344
│ │ │ │ +
345 // An iterator transforming a wrapped iterator using
│ │ │ │ +
346 // an unary function. It inherits the iterator-category
│ │ │ │ +
347 // of the underlying iterator.
│ │ │ │ +
348 template <class I, class F, class TransformationType, class C = typename std::iterator_traits<I>::iterator_category>
│ │ │ │ +
349 class TransformedRangeIterator;
│ │ │ │ +
350
│ │ │ │ +
351 template <class I, class F, class TransformationType>
│ │ │ │ +
352 class TransformedRangeIterator<I,F,TransformationType,std::forward_iterator_tag>
│ │ │ │ +
353 {
│ │ │ │ +
354 protected:
│ │ │ │ +
355
│ │ │ │ +
356 static decltype(auto) transform(const F& f, const I& it) {
│ │ │ │ +
357 if constexpr (std::is_same_v<TransformationType,IteratorTransformationTag>)
│ │ │ │ +
358 return f(it);
│ │ │ │ +
359 else
│ │ │ │ +
360 return f(*it);
│ │ │ │ +
361 }
│ │ │ │ +
362
│ │ │ │ +
363 public:
│ │ │ │ +
364 using iterator_category = std::forward_iterator_tag;
│ │ │ │ +
365 using reference = decltype(transform(std::declval<F>(), std::declval<I>()));
│ │ │ │ +
366 using value_type = std::decay_t<reference>;
│ │ │ │ +
367 using pointer = PointerProxy<value_type>;
│ │ │ │ +
368
│ │ │ │ +
369 // If we later want to allow standalone TransformedRangeIterators,
│ │ │ │ +
370 // we could customize the FunctionPointer to be a default-constructible,
│ │ │ │ +
371 // copy-assignable type storing a function but acting like a pointer
│ │ │ │ +
372 // to function.
│ │ │ │ +
373 using FunctionPointer = const F*;
│ │ │ │ +
374
│ │ │ │ +
375 constexpr TransformedRangeIterator(const I& it, FunctionPointer f) noexcept :
│ │ │ │ +
376 it_(it),
│ │ │ │ +
377 f_(f)
│ │ │ │ +
378 {}
│ │ │ │ +
379
│ │ │ │ +
380 // Explicitly initialize members. Using a plain
│ │ │ │ +
381 //
│ │ │ │ +
382 // constexpr TransformedRangeIterator() noexcept {}
│ │ │ │ +
383 //
│ │ │ │ +
384 // would default-initialize the members while
│ │ │ │ +
385 //
│ │ │ │ +
386 // constexpr TransformedRangeIterator() noexcept : it_(), f_() {}
│ │ │ │ +
387 //
│ │ │ │ +
388 // leads to value-initialization. This is a case where
│ │ │ │ +
389 // both are really different. If it_ is a raw pointer (i.e. POD)
│ │ │ │ +
390 // then default-initialization leaves it uninitialized while
│ │ │ │ +
391 // value-initialization zero-initializes it.
│ │ │ │ +
392 constexpr TransformedRangeIterator() noexcept :
│ │ │ │ +
393 it_(),
│ │ │ │ +
394 f_()
│ │ │ │ +
395 {}
│ │ │ │ +
396
│ │ │ │ +
397 // Dereferencing returns a value created by the function
│ │ │ │ +
398 constexpr reference operator*() const noexcept {
│ │ │ │ +
399 return transform(*f_, it_);
│ │ │ │ +
400 }
│ │ │ │ +
401
│ │ │ │ +
402 // Dereferencing returns a value created by the function
│ │ │ │ +
403 pointer operator->() const noexcept {
│ │ │ │ +
404 return transform(*f_, it_);
│ │ │ │ +
405 }
│ │ │ │ +
406
│ │ │ │ +
407 constexpr TransformedRangeIterator& operator=(const TransformedRangeIterator& other) = default;
│ │ │ │ +
408
│ │ │ │ +
409 constexpr bool operator==(const TransformedRangeIterator& other) const noexcept {
│ │ │ │ +
410 return (it_ == other.it_);
│ │ │ │ +
411 }
│ │ │ │ +
412
│ │ │ │ +
413 constexpr bool operator!=(const TransformedRangeIterator& other) const noexcept {
│ │ │ │ +
414 return (it_ != other.it_);
│ │ │ │ +
415 }
│ │ │ │ +
416
│ │ │ │ +
417 TransformedRangeIterator& operator++() noexcept {
│ │ │ │ +
418 ++it_;
│ │ │ │ +
419 return *this;
│ │ │ │ +
420 }
│ │ │ │ +
421
│ │ │ │ +
422 TransformedRangeIterator operator++(int) noexcept {
│ │ │ │ +
423 TransformedRangeIterator copy(*this);
│ │ │ │ +
424 ++(*this);
│ │ │ │ +
425 return copy;
│ │ │ │ +
426 }
│ │ │ │ +
427
│ │ │ │ +
428 protected:
│ │ │ │ +
429 I it_;
│ │ │ │ +
430 FunctionPointer f_;
│ │ │ │ +
431 };
│ │ │ │ +
432
│ │ │ │ +
433
│ │ │ │ +
434
│ │ │ │ +
435 template <class I, class F, class T>
│ │ │ │ +
436 class TransformedRangeIterator<I,F,T,std::bidirectional_iterator_tag> :
│ │ │ │ +
437 public TransformedRangeIterator<I,F,T,std::forward_iterator_tag>
│ │ │ │ +
438 {
│ │ │ │ +
439 protected:
│ │ │ │ +
440 using Base = TransformedRangeIterator<I,F,T,std::forward_iterator_tag>;
│ │ │ │ +
441 using Base::it_;
│ │ │ │ +
442 using Base::f_;
│ │ │ │ +
443 public:
│ │ │ │ +
444 using iterator_category = std::bidirectional_iterator_tag;
│ │ │ │ +
445 using reference = typename Base::reference;
│ │ │ │ +
446 using value_type = typename Base::value_type;
│ │ │ │ +
447 using pointer = typename Base::pointer;
│ │ │ │ +
448
│ │ │ │ +
449 using FunctionPointer = typename Base::FunctionPointer;
│ │ │ │ +
450
│ │ │ │ +
451 using Base::Base;
│ │ │ │ +
452
│ │ │ │ +
453 // Member functions of the forward_iterator that need
│ │ │ │ +
454 // to be redefined because the base class methods return a
│ │ │ │ +
455 // forward_iterator.
│ │ │ │ +
456 constexpr TransformedRangeIterator& operator=(const TransformedRangeIterator& other) = default;
│ │ │ │ +
457
│ │ │ │ +
458 TransformedRangeIterator& operator++() noexcept {
│ │ │ │ +
459 ++it_;
│ │ │ │ +
460 return *this;
│ │ │ │ +
461 }
│ │ │ │ +
462
│ │ │ │ +
463 TransformedRangeIterator operator++(int) noexcept {
│ │ │ │ +
464 TransformedRangeIterator copy(*this);
│ │ │ │ +
465 ++(*this);
│ │ │ │ +
466 return copy;
│ │ │ │ +
467 }
│ │ │ │ +
468
│ │ │ │ +
469 // Additional member functions of bidirectional_iterator
│ │ │ │ +
470 TransformedRangeIterator& operator--() noexcept {
│ │ │ │ +
471 --(this->it_);
│ │ │ │ +
472 return *this;
│ │ │ │ +
473 }
│ │ │ │ +
474
│ │ │ │ +
475 TransformedRangeIterator operator--(int) noexcept {
│ │ │ │ +
476 TransformedRangeIterator copy(*this);
│ │ │ │ +
477 --(*this);
│ │ │ │ +
478 return copy;
│ │ │ │ +
479 }
│ │ │ │ +
480 };
│ │ │ │ +
481
│ │ │ │ +
482
│ │ │ │ +
483
│ │ │ │ +
484 template <class I, class F, class T>
│ │ │ │ +
485 class TransformedRangeIterator<I,F,T,std::random_access_iterator_tag> :
│ │ │ │ +
486 public TransformedRangeIterator<I,F,T,std::bidirectional_iterator_tag>
│ │ │ │ +
487 {
│ │ │ │ +
488 protected:
│ │ │ │ +
489 using Base = TransformedRangeIterator<I,F,T,std::bidirectional_iterator_tag>;
│ │ │ │ +
490 using Base::it_;
│ │ │ │ +
491 using Base::f_;
│ │ │ │ +
492 public:
│ │ │ │ +
493 using iterator_category = std::random_access_iterator_tag;
│ │ │ │ +
494 using reference = typename Base::reference;
│ │ │ │ +
495 using value_type = typename Base::value_type;
│ │ │ │ +
496 using pointer = typename Base::pointer;
│ │ │ │ +
497 using difference_type = typename std::iterator_traits<I>::difference_type;
│ │ │ │ +
498
│ │ │ │ +
499 using FunctionPointer = typename Base::FunctionPointer;
│ │ │ │ +
500
│ │ │ │ +
501 using Base::Base;
│ │ │ │ +
502
│ │ │ │ +
503 // Member functions of the forward_iterator that need
│ │ │ │ +
504 // to be redefined because the base class methods return a
│ │ │ │ +
505 // forward_iterator.
│ │ │ │ +
506 constexpr TransformedRangeIterator& operator=(const TransformedRangeIterator& other) = default;
│ │ │ │ +
507
│ │ │ │ +
508 TransformedRangeIterator& operator++() noexcept {
│ │ │ │ +
509 ++it_;
│ │ │ │ +
510 return *this;
│ │ │ │ +
511 }
│ │ │ │ +
512
│ │ │ │ +
513 TransformedRangeIterator operator++(int) noexcept {
│ │ │ │ +
514 TransformedRangeIterator copy(*this);
│ │ │ │ +
515 ++(*this);
│ │ │ │ +
516 return copy;
│ │ │ │ +
517 }
│ │ │ │ +
518
│ │ │ │ +
519 // Member functions of the bidirectional_iterator that need
│ │ │ │ +
520 // to be redefined because the base class methods return a
│ │ │ │ +
521 // bidirectional_iterator.
│ │ │ │ +
522 TransformedRangeIterator& operator--() noexcept {
│ │ │ │ +
523 --(this->it_);
│ │ │ │ +
524 return *this;
│ │ │ │ +
525 }
│ │ │ │ +
526
│ │ │ │ +
527 TransformedRangeIterator operator--(int) noexcept {
│ │ │ │ +
528 TransformedRangeIterator copy(*this);
│ │ │ │ +
529 --(*this);
│ │ │ │ +
530 return copy;
│ │ │ │ +
531 }
│ │ │ │ +
532
│ │ │ │ +
533 // Additional member functions of random_access_iterator
│ │ │ │ +
534 TransformedRangeIterator& operator+=(difference_type n) noexcept {
│ │ │ │ +
535 it_ += n;
│ │ │ │ +
536 return *this;
│ │ │ │ +
537 }
│ │ │ │ +
538
│ │ │ │ +
539 TransformedRangeIterator& operator-=(difference_type n) noexcept {
│ │ │ │ +
540 it_ -= n;
│ │ │ │ +
541 return *this;
│ │ │ │ +
542 }
│ │ │ │ +
543
│ │ │ │ +
544 bool operator<(const TransformedRangeIterator& other) noexcept {
│ │ │ │ +
545 return it_<other.it_;
│ │ │ │ +
546 }
│ │ │ │ +
547
│ │ │ │ +
548 bool operator<=(const TransformedRangeIterator& other) noexcept {
│ │ │ │ +
549 return it_<=other.it_;
│ │ │ │ +
550 }
│ │ │ │ +
551
│ │ │ │ +
552 bool operator>(const TransformedRangeIterator& other) noexcept {
│ │ │ │ +
553 return it_>other.it_;
│ │ │ │ +
554 }
│ │ │ │ +
555
│ │ │ │ +
556 bool operator>=(const TransformedRangeIterator& other) noexcept {
│ │ │ │ +
557 return it_>=other.it_;
│ │ │ │ +
558 }
│ │ │ │ +
559
│ │ │ │ +
560 reference operator[](difference_type n) noexcept {
│ │ │ │ +
561 return Base::transform(*f_, it_+n);
│ │ │ │ +
562 }
│ │ │ │ +
563
│ │ │ │ +
564 friend
│ │ │ │ +
565 TransformedRangeIterator operator+(const TransformedRangeIterator& it, difference_type n) noexcept {
│ │ │ │ +
566 return TransformedRangeIterator(it.it_+n, it.f_);
│ │ │ │ +
567 }
│ │ │ │ +
568
│ │ │ │ +
569 friend
│ │ │ │ +
570 TransformedRangeIterator operator+(difference_type n, const TransformedRangeIterator& it) noexcept {
│ │ │ │ +
571 return TransformedRangeIterator(n+it.it_, it.f_);
│ │ │ │ +
572 }
│ │ │ │ +
573
│ │ │ │ +
574 friend
│ │ │ │ +
575 TransformedRangeIterator operator-(const TransformedRangeIterator& it, difference_type n) noexcept {
│ │ │ │ +
576 return TransformedRangeIterator(it.it_-n, it.f_);
│ │ │ │ +
577 }
│ │ │ │ +
578
│ │ │ │ +
579 friend
│ │ │ │ +
580 difference_type operator-(const TransformedRangeIterator& first, const TransformedRangeIterator& second) noexcept {
│ │ │ │ +
581 return first.it_-second.it_;
│ │ │ │ +
582 }
│ │ │ │ +
583 };
│ │ │ │ +
584
│ │ │ │ +
585
│ │ │ │ +
586 } // namespace Impl
│ │ │ │ +
587
│ │ │ │ +
588
│ │ │ │ +
589
│ │ │ │ +
626 template <class R, class F, class T=ValueTransformationTag>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
628 {
│ │ │ │ +
629 using RawConstIterator = std::decay_t<decltype(std::declval<const R>().begin())>;
│ │ │ │ +
630 using RawIterator = std::decay_t<decltype(std::declval<R>().begin())>;
│ │ │ │ +
631
│ │ │ │ +
632 public:
│ │ │ │ +
633
│ │ │ │ +
640 using const_iterator = Impl::TransformedRangeIterator<RawConstIterator, F, T>;
│ │ │ │ +
641
│ │ │ │ +
648 using iterator = Impl::TransformedRangeIterator<RawIterator, F, T>;
│ │ │ │ +
649
│ │ │ │ +
656 using RawRange = std::remove_reference_t<R>;
│ │ │ │ +
657
│ │ │ │ +
661 template<class RR>
│ │ │ │ +
│ │ │ │ +
662 constexpr TransformedRangeView(RR&& rawRange, const F& f) noexcept :
│ │ │ │ +
663 rawRange_(std::forward<RR>(rawRange)),
│ │ │ │ +
664 f_(f)
│ │ │ │ +
665 {
│ │ │ │ +
666 static_assert(std::is_same_v<T, ValueTransformationTag> or std::is_same_v<T, IteratorTransformationTag>,
│ │ │ │ +
667 "The TransformationType passed to TransformedRangeView has to be either ValueTransformationTag or IteratorTransformationTag.");
│ │ │ │ +
668 }
│ │ │ │ +
│ │ │ │ +
669
│ │ │ │ +
│ │ │ │ +
678 constexpr const_iterator begin() const noexcept {
│ │ │ │ +
679 return const_iterator(rawRange_.begin(), &f_);
│ │ │ │ +
680 }
│ │ │ │ +
│ │ │ │ +
681
│ │ │ │ +
│ │ │ │ +
682 constexpr iterator begin() noexcept {
│ │ │ │ +
683 return iterator(rawRange_.begin(), &f_);
│ │ │ │ +
684 }
│ │ │ │ +
│ │ │ │ +
685
│ │ │ │ +
│ │ │ │ +
694 constexpr const_iterator end() const noexcept {
│ │ │ │ +
695 return const_iterator(rawRange_.end(), &f_);
│ │ │ │ +
696 }
│ │ │ │ +
│ │ │ │ +
697
│ │ │ │ +
│ │ │ │ +
698 constexpr iterator end() noexcept {
│ │ │ │ +
699 return iterator(rawRange_.end(), &f_);
│ │ │ │ +
700 }
│ │ │ │ +
│ │ │ │ +
701
│ │ │ │ +
712 template<class Dummy=R,
│ │ │ │ +
713 class = std::void_t<decltype(std::declval<Dummy>().size())>>
│ │ │ │ +
│ │ │ │ +
714 auto size() const
│ │ │ │ +
715 {
│ │ │ │ +
716 return rawRange_.size();
│ │ │ │ +
717 }
│ │ │ │ +
│ │ │ │ +
718
│ │ │ │ +
│ │ │ │ +
722 const RawRange& rawRange() const
│ │ │ │ +
723 {
│ │ │ │ +
724 return rawRange_;
│ │ │ │ +
725 }
│ │ │ │ +
│ │ │ │ +
726
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
731 {
│ │ │ │ +
732 return rawRange_;
│ │ │ │ +
733 }
│ │ │ │ +
│ │ │ │ +
734
│ │ │ │ +
735 private:
│ │ │ │ +
736 R rawRange_;
│ │ │ │ +
737 F f_;
│ │ │ │ +
738 };
│ │ │ │ +
│ │ │ │ +
739
│ │ │ │ +
768 template <class R, class F>
│ │ │ │ +
│ │ │ │ +
769 auto transformedRangeView(R&& range, const F& f)
│ │ │ │ +
770 {
│ │ │ │ + │ │ │ │ +
772 }
│ │ │ │ +
│ │ │ │ +
773
│ │ │ │ +
801 template <class R, class F>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
803 {
│ │ │ │ + │ │ │ │ +
805 }
│ │ │ │ +
│ │ │ │ +
806
│ │ │ │ +
807
│ │ │ │ +
820 template<class Range>
│ │ │ │ +
│ │ │ │ +
821 auto sparseRange(Range&& range) {
│ │ │ │ +
822 return Dune::iteratorTransformedRangeView(std::forward<Range>(range), [](auto&& it) {
│ │ │ │ +
823 return std::tuple<decltype(*it), decltype(it.index())>(*it, it.index());
│ │ │ │ +
824 });
│ │ │ │ +
825 }
│ │ │ │ +
│ │ │ │ +
826
│ │ │ │ +
831}
│ │ │ │ +
832
│ │ │ │ +
833#endif // DUNE_COMMON_RANGE_UTILITIES_HH
│ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
auto sparseRange(Range &&range)
Allow structured-binding for-loops for sparse iterators.
Definition rangeutilities.hh:821
│ │ │ │ +
auto iteratorTransformedRangeView(R &&range, const F &f)
Create a TransformedRangeView using an iterator transformation.
Definition rangeutilities.hh:802
│ │ │ │ +
auto transformedRangeView(R &&range, const F &f)
Create a TransformedRangeView.
Definition rangeutilities.hh:769
│ │ │ │ +
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:300
│ │ │ │ +
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:549
│ │ │ │ +
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:542
│ │ │ │ +
bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:535
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:637
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:683
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:660
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition iteratorfacades.hh:237
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:705
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition iteratorfacades.hh:259
│ │ │ │ +
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Definition matvectraits.hh:31
│ │ │ │ +
bool any_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:493
│ │ │ │ +
bool all_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:499
│ │ │ │ +
T max_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:481
│ │ │ │ +
T min_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:487
│ │ │ │ +
dynamic integer range for use in range-based for loops
Definition rangeutilities.hh:175
│ │ │ │ +
constexpr iterator begin() const noexcept
obtain a random-access iterator to the first element
Definition rangeutilities.hh:192
│ │ │ │ +
constexpr iterator end() const noexcept
obtain a random-access iterator past the last element
Definition rangeutilities.hh:194
│ │ │ │ +
std::make_unsigned_t< T > size_type
unsigned integer type corresponding to value_type
Definition rangeutilities.hh:182
│ │ │ │ +
Impl::IntegralRangeIterator< T > iterator
type of iterator
Definition rangeutilities.hh:180
│ │ │ │ +
constexpr value_type operator[](const value_type &i) const noexcept
access specified element
Definition rangeutilities.hh:197
│ │ │ │ +
constexpr bool empty() const noexcept
check whether the range is empty
Definition rangeutilities.hh:200
│ │ │ │ +
constexpr IntegralRange(std::pair< value_type, value_type > range) noexcept
construct integer range std::pair
Definition rangeutilities.hh:189
│ │ │ │ +
constexpr IntegralRange(value_type from, value_type to) noexcept
construct integer range [from, to)
Definition rangeutilities.hh:185
│ │ │ │ +
constexpr size_type size() const noexcept
obtain number of elements in the range
Definition rangeutilities.hh:202
│ │ │ │ +
constexpr IntegralRange(value_type to) noexcept
construct integer range [0, to)
Definition rangeutilities.hh:187
│ │ │ │ +
T value_type
type of integers contained in the range
Definition rangeutilities.hh:178
│ │ │ │ +
static integer range for use in range-based for loops
Definition rangeutilities.hh:225
│ │ │ │ +
static constexpr iterator end() noexcept
obtain a random-access iterator past the last element
Definition rangeutilities.hh:251
│ │ │ │ +
decltype(shift_integer_sequence< from >(std::make_integer_sequence< T, to-from >())) integer_sequence
type of corresponding std::integer_sequence
Definition rangeutilities.hh:238
│ │ │ │ +
constexpr StaticIntegralRange() noexcept=default
default constructor
│ │ │ │ +
std::make_unsigned_t< T > size_type
unsigned integer type corresponding to value_type
Definition rangeutilities.hh:235
│ │ │ │ +
T value_type
type of integers contained in the range
Definition rangeutilities.hh:231
│ │ │ │ +
constexpr auto operator[](const std::integral_constant< U, i > &) const noexcept -> std::integral_constant< value_type, from+static_cast< value_type >(i)>
access specified element (static version)
Definition rangeutilities.hh:255
│ │ │ │ +
static constexpr std::integral_constant< bool, from==to > empty() noexcept
check whether the range is empty
Definition rangeutilities.hh:265
│ │ │ │ +
static constexpr iterator begin() noexcept
obtain a random-access iterator to the first element
Definition rangeutilities.hh:249
│ │ │ │ +
constexpr value_type operator[](const size_type &i) const noexcept
access specified element (dynamic version)
Definition rangeutilities.hh:262
│ │ │ │ +
Impl::IntegralRangeIterator< T > iterator
type of iterator
Definition rangeutilities.hh:233
│ │ │ │ +
static constexpr std::integral_constant< size_type, static_cast< size_type >(to) - static_cast< size_type >(from) > size() noexcept
obtain number of elements in the range
Definition rangeutilities.hh:267
│ │ │ │ +
Tag to enable value based transformations in TransformedRangeView.
Definition rangeutilities.hh:316
│ │ │ │ +
Tag to enable iterator based transformations in TransformedRangeView.
Definition rangeutilities.hh:321
│ │ │ │ +
A range transforming the values of another range on-the-fly.
Definition rangeutilities.hh:628
│ │ │ │ +
auto size() const
Obtain the size of the range.
Definition rangeutilities.hh:714
│ │ │ │ +
constexpr iterator end() noexcept
Definition rangeutilities.hh:698
│ │ │ │ +
std::remove_reference_t< R > RawRange
Export type of the wrapped untransformed range.
Definition rangeutilities.hh:656
│ │ │ │ +
Impl::TransformedRangeIterator< RawConstIterator, F, T > const_iterator
Const iterator type.
Definition rangeutilities.hh:640
│ │ │ │ +
constexpr iterator begin() noexcept
Definition rangeutilities.hh:682
│ │ │ │ +
constexpr TransformedRangeView(RR &&rawRange, const F &f) noexcept
Construct from range and function.
Definition rangeutilities.hh:662
│ │ │ │ +
const RawRange & rawRange() const
Export the wrapped untransformed range.
Definition rangeutilities.hh:722
│ │ │ │ +
Impl::TransformedRangeIterator< RawIterator, F, T > iterator
Iterator type.
Definition rangeutilities.hh:648
│ │ │ │ +
constexpr const_iterator begin() const noexcept
Obtain a iterator to the first element.
Definition rangeutilities.hh:678
│ │ │ │ +
constexpr const_iterator end() const noexcept
Obtain a iterator past the last element.
Definition rangeutilities.hh:694
│ │ │ │ +
RawRange & rawRange()
Export the wrapped untransformed range.
Definition rangeutilities.hh:730
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,34 +1,880 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -matvectraits.hh │ │ │ │ │ +rangeutilities.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_MATVECTRAITS_HH │ │ │ │ │ -6#define DUNE_MATVECTRAITS_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_RANGE_UTILITIES_HH │ │ │ │ │ +6#define DUNE_COMMON_RANGE_UTILITIES_HH │ │ │ │ │ 7 │ │ │ │ │ -12namespace _D_u_n_e { │ │ │ │ │ +8#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ 13 │ │ │ │ │ -22 │ │ │ │ │ -24 │ │ │ │ │ -26 │ │ │ │ │ -30 template │ │ │ │ │ -_3_1 struct _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s {}; │ │ │ │ │ -32 │ │ │ │ │ -33} // end namespace Dune │ │ │ │ │ -34 │ │ │ │ │ -35#endif // DUNE_FTRAITS_HH │ │ │ │ │ +21namespace _D_u_n_e │ │ │ │ │ +22{ │ │ │ │ │ +23 │ │ │ │ │ +34 template ::value, int>::type = 0> │ │ │ │ │ +36 typename T::value_type │ │ │ │ │ +_3_7 _m_a_x___v_a_l_u_e(const T & v) { │ │ │ │ │ +38 using std::max_element; │ │ │ │ │ +39 return *max_element(v.begin(), v.end()); │ │ │ │ │ +40 } │ │ │ │ │ +41 │ │ │ │ │ +42 template ::value, int>::type = 0> │ │ │ │ │ +_4_4 const T & _m_a_x___v_a_l_u_e(const T & v) { return v; } │ │ │ │ │ +45 │ │ │ │ │ +51 template ::value, int>::type = 0> │ │ │ │ │ +53 typename T::value_type │ │ │ │ │ +_5_4 _m_i_n___v_a_l_u_e(const T & v) { │ │ │ │ │ +55 using std::min_element; │ │ │ │ │ +56 return *min_element(v.begin(), v.end()); │ │ │ │ │ +57 } │ │ │ │ │ +58 │ │ │ │ │ +59 template ::value, int>::type = 0> │ │ │ │ │ +_6_1 const T & _m_i_n___v_a_l_u_e(const T & v) { return v; } │ │ │ │ │ +62 │ │ │ │ │ +68 template ::value, int>::type = 0> │ │ │ │ │ +_7_0 bool _a_n_y___t_r_u_e(const T & v) { │ │ │ │ │ +71 bool b = false; │ │ │ │ │ +72 for (const auto & e : v) │ │ │ │ │ +73 b = b or bool(e); │ │ │ │ │ +74 return b; │ │ │ │ │ +75 } │ │ │ │ │ +76 │ │ │ │ │ +77 template ::value, int>::type = 0> │ │ │ │ │ +79 bool _a_n_y___t_r_u_e(const T & v) { return v; } │ │ │ │ │ +80 │ │ │ │ │ +81 template │ │ │ │ │ +_8_2 bool _a_n_y___t_r_u_e(const std::bitset & b) │ │ │ │ │ +83 { │ │ │ │ │ +84 return b.any(); │ │ │ │ │ +85 } │ │ │ │ │ +86 │ │ │ │ │ +92 template ::value, int>::type = 0> │ │ │ │ │ +_9_4 bool _a_l_l___t_r_u_e(const T & v) { │ │ │ │ │ +95 bool b = true; │ │ │ │ │ +96 for (const auto & e : v) │ │ │ │ │ +97 b = b and bool(e); │ │ │ │ │ +98 return b; │ │ │ │ │ +99 } │ │ │ │ │ +100 │ │ │ │ │ +101 template ::value, int>::type = 0> │ │ │ │ │ +103 bool _a_l_l___t_r_u_e(const T & v) { return v; } │ │ │ │ │ +104 │ │ │ │ │ +105 template │ │ │ │ │ +_1_0_6 bool _a_l_l___t_r_u_e(const std::bitset & b) │ │ │ │ │ +107 { │ │ │ │ │ +108 return b.all(); │ │ │ │ │ +109 } │ │ │ │ │ +110 │ │ │ │ │ +111 │ │ │ │ │ +112 │ │ │ │ │ +113 namespace Impl │ │ │ │ │ +114 { │ │ │ │ │ +115 │ │ │ │ │ +116 template │ │ │ │ │ +117 class IntegralRangeIterator │ │ │ │ │ +118 { │ │ │ │ │ +119 public: │ │ │ │ │ +120 typedef std::random_access_iterator_tag iterator_category; │ │ │ │ │ +121 typedef T value_type; │ │ │ │ │ +122 typedef std::make_signed_t difference_type; │ │ │ │ │ +123 typedef const T *pointer; │ │ │ │ │ +124 typedef T reference; │ │ │ │ │ +125 │ │ │ │ │ +126 constexpr IntegralRangeIterator() noexcept : value_(0) {} │ │ │ │ │ +127 constexpr explicit IntegralRangeIterator(value_type value) noexcept : │ │ │ │ │ +value_(value) {} │ │ │ │ │ +128 │ │ │ │ │ +129 pointer operator->() const noexcept { return &value_; } │ │ │ │ │ +130 constexpr reference _o_p_e_r_a_t_o_r_*() const noexcept { return value_; } │ │ │ │ │ +131 │ │ │ │ │ +132 constexpr reference operator[]( difference_type n ) const noexcept { return │ │ │ │ │ +(value_ + n); } │ │ │ │ │ +133 │ │ │ │ │ +134 constexpr bool _o_p_e_r_a_t_o_r_=_=(const IntegralRangeIterator & other) const │ │ │ │ │ +noexcept { return (value_ == other.value_); } │ │ │ │ │ +135 constexpr bool _o_p_e_r_a_t_o_r_!_=(const IntegralRangeIterator & other) const │ │ │ │ │ +noexcept { return (value_ != other.value_); } │ │ │ │ │ +136 │ │ │ │ │ +137 constexpr bool _o_p_e_r_a_t_o_r_<(const IntegralRangeIterator & other) const │ │ │ │ │ +noexcept { return (value_ <= other.value_); } │ │ │ │ │ +138 constexpr bool _o_p_e_r_a_t_o_r_<_=(const IntegralRangeIterator & other) const │ │ │ │ │ +noexcept { return (value_ <= other.value_); } │ │ │ │ │ +139 constexpr bool _o_p_e_r_a_t_o_r_>(const IntegralRangeIterator & other) const │ │ │ │ │ +noexcept { return (value_ >= other.value_); } │ │ │ │ │ +140 constexpr bool _o_p_e_r_a_t_o_r_>_=(const IntegralRangeIterator & other) const │ │ │ │ │ +noexcept { return (value_ >= other.value_); } │ │ │ │ │ +141 │ │ │ │ │ +142 IntegralRangeIterator& operator++() noexcept { ++value_; return *this; } │ │ │ │ │ +143 IntegralRangeIterator operator++(int) noexcept { IntegralRangeIterator copy │ │ │ │ │ +( *this ); ++(*this); return copy; } │ │ │ │ │ +144 │ │ │ │ │ +145 IntegralRangeIterator& operator--() noexcept { --value_; return *this; } │ │ │ │ │ +146 IntegralRangeIterator operator--(int) noexcept { IntegralRangeIterator copy │ │ │ │ │ +( *this ); --(*this); return copy; } │ │ │ │ │ +147 │ │ │ │ │ +148 IntegralRangeIterator& operator+=(difference_type n) noexcept { value_ += │ │ │ │ │ +n; return *this; } │ │ │ │ │ +149 IntegralRangeIterator& operator-=(difference_type n) noexcept { value_ - │ │ │ │ │ += n; return *this; } │ │ │ │ │ +150 │ │ │ │ │ +151 friend constexpr IntegralRangeIterator _o_p_e_r_a_t_o_r_+(const │ │ │ │ │ +IntegralRangeIterator &a, difference_type n) noexcept { return │ │ │ │ │ +IntegralRangeIterator(a.value_ + n); } │ │ │ │ │ +152 friend constexpr IntegralRangeIterator _o_p_e_r_a_t_o_r_+(difference_type n, const │ │ │ │ │ +IntegralRangeIterator &a) noexcept { return IntegralRangeIterator(a.value_ + │ │ │ │ │ +n); } │ │ │ │ │ +153 friend constexpr IntegralRangeIterator _o_p_e_r_a_t_o_r_-(const │ │ │ │ │ +IntegralRangeIterator &a, difference_type n) noexcept { return │ │ │ │ │ +IntegralRangeIterator(a.value_ - n); } │ │ │ │ │ +154 │ │ │ │ │ +155 constexpr difference_type _o_p_e_r_a_t_o_r_-(const IntegralRangeIterator &other) │ │ │ │ │ +const noexcept { return (static_cast(value_) - │ │ │ │ │ +static_cast(other.value_)); } │ │ │ │ │ +156 │ │ │ │ │ +157 private: │ │ │ │ │ +158 value_type value_; │ │ │ │ │ +159 }; │ │ │ │ │ +160 │ │ │ │ │ +161 } // namespace Impl │ │ │ │ │ +162 │ │ │ │ │ +163 │ │ │ │ │ +164 │ │ │ │ │ +173 template │ │ │ │ │ +_1_7_4 class _I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +175 { │ │ │ │ │ +176 public: │ │ │ │ │ +_1_7_8 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_1_8_0 typedef Impl::IntegralRangeIterator _i_t_e_r_a_t_o_r; │ │ │ │ │ +_1_8_2 typedef std::make_unsigned_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +183 │ │ │ │ │ +_1_8_5 constexpr _I_n_t_e_g_r_a_l_R_a_n_g_e(_v_a_l_u_e___t_y_p_e from, _v_a_l_u_e___t_y_p_e to) noexcept : from_ │ │ │ │ │ +(from), to_(to) {} │ │ │ │ │ +_1_8_7 constexpr explicit _I_n_t_e_g_r_a_l_R_a_n_g_e(_v_a_l_u_e___t_y_p_e to) noexcept : from_(0), to_ │ │ │ │ │ +(to) {} │ │ │ │ │ +_1_8_9 constexpr _I_n_t_e_g_r_a_l_R_a_n_g_e(std::pair _r_a_n_g_e) noexcept : │ │ │ │ │ +from_(_r_a_n_g_e.first), to_(_r_a_n_g_e.second) {} │ │ │ │ │ +190 │ │ │ │ │ +_1_9_2 constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n() const noexcept { return _i_t_e_r_a_t_o_r(from_); } │ │ │ │ │ +_1_9_4 constexpr _i_t_e_r_a_t_o_r _e_n_d() const noexcept { return _i_t_e_r_a_t_o_r(to_); } │ │ │ │ │ +195 │ │ │ │ │ +_1_9_7 constexpr _v_a_l_u_e___t_y_p_e _o_p_e_r_a_t_o_r_[_](const _v_a_l_u_e___t_y_p_e &i) const noexcept │ │ │ │ │ +{ return (from_ + i); } │ │ │ │ │ +198 │ │ │ │ │ +_2_0_0 constexpr bool _e_m_p_t_y() const noexcept { return (from_ == to_); } │ │ │ │ │ +_2_0_2 constexpr _s_i_z_e___t_y_p_e _s_i_z_e() const noexcept { return (static_cast<_s_i_z_e___t_y_p_e> │ │ │ │ │ +(to_) - static_cast<_s_i_z_e___t_y_p_e>(from_)); } │ │ │ │ │ +203 │ │ │ │ │ +204 private: │ │ │ │ │ +205 _v_a_l_u_e___t_y_p_e from_, to_; │ │ │ │ │ +206 }; │ │ │ │ │ +207 │ │ │ │ │ +208 │ │ │ │ │ +223 template │ │ │ │ │ +_2_2_4 class _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +225 { │ │ │ │ │ +226 template │ │ │ │ │ +227 static std::integer_sequence shift_integer_sequence(std:: │ │ │ │ │ +integer_sequence); │ │ │ │ │ +228 │ │ │ │ │ +229 public: │ │ │ │ │ +_2_3_1 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_2_3_3 typedef Impl::IntegralRangeIterator _i_t_e_r_a_t_o_r; │ │ │ │ │ +_2_3_5 typedef std::make_unsigned_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +236 │ │ │ │ │ +_2_3_8 typedef decltype(shift_integer_sequence(std::make_integer_sequence())) _i_n_t_e_g_e_r___s_e_q_u_e_n_c_e; │ │ │ │ │ +239 │ │ │ │ │ +_2_4_1 constexpr _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e() noexcept = default; │ │ │ │ │ +242 │ │ │ │ │ +_2_4_4 constexpr operator _I_n_t_e_g_r_a_l_R_a_n_g_e() const noexcept { return {from, to}; } │ │ │ │ │ +_2_4_6 constexpr operator _i_n_t_e_g_e_r___s_e_q_u_e_n_c_e() const noexcept { return {}; } │ │ │ │ │ +247 │ │ │ │ │ +_2_4_9 static constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n() noexcept { return _i_t_e_r_a_t_o_r(from); } │ │ │ │ │ +_2_5_1 static constexpr _i_t_e_r_a_t_o_r _e_n_d() noexcept { return _i_t_e_r_a_t_o_r(to); } │ │ │ │ │ +252 │ │ │ │ │ +254 template │ │ │ │ │ +_2_5_5 constexpr auto _o_p_e_r_a_t_o_r_[_](const std::integral_constant &) const │ │ │ │ │ +noexcept │ │ │ │ │ +256 -> std::integral_constant(i)> │ │ │ │ │ +257 { │ │ │ │ │ +258 return {}; │ │ │ │ │ +259 } │ │ │ │ │ +260 │ │ │ │ │ +_2_6_2 constexpr _v_a_l_u_e___t_y_p_e _o_p_e_r_a_t_o_r_[_](const _s_i_z_e___t_y_p_e &i) const noexcept { return │ │ │ │ │ +(from + static_cast<_v_a_l_u_e___t_y_p_e>(i)); } │ │ │ │ │ +263 │ │ │ │ │ +_2_6_5 static constexpr std::integral_constant _e_m_p_t_y() noexcept │ │ │ │ │ +{ return {}; } │ │ │ │ │ +_2_6_7 static constexpr std::integral_constant │ │ │ │ │ +(to) - static_cast<_s_i_z_e___t_y_p_e>(from) > _s_i_z_e() noexcept { return {}; } │ │ │ │ │ +268 }; │ │ │ │ │ +269 │ │ │ │ │ +279 template, std::decay_t>::value, │ │ │ │ │ +int> = 0, │ │ │ │ │ +281 std::enable_if_t>::value, int> = 0> │ │ │ │ │ +_2_8_2 inline static _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>> _r_a_n_g_e(T &&from, U &&to) │ │ │ │ │ +noexcept │ │ │ │ │ +283 { │ │ │ │ │ +284 return _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>(std::forward(from), std:: │ │ │ │ │ +forward(to)); │ │ │ │ │ +285 } │ │ │ │ │ +286 │ │ │ │ │ +287 template>:: │ │ │ │ │ +value, int> = 0> │ │ │ │ │ +_2_8_8 inline static _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>> _r_a_n_g_e(T &&to) noexcept │ │ │ │ │ +289 { │ │ │ │ │ +290 return _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>(std::forward(to)); │ │ │ │ │ +291 } │ │ │ │ │ +292 │ │ │ │ │ +293 template>::value, │ │ │ │ │ +int> = 0> │ │ │ │ │ +_2_9_4 inline static _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_u_n_d_e_r_l_y_i_n_g___t_y_p_e___t_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>> _r_a_n_g_e │ │ │ │ │ +(T &&to) noexcept │ │ │ │ │ +295 { │ │ │ │ │ +296 return _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_u_n_d_e_r_l_y_i_n_g___t_y_p_e___t_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>>(std:: │ │ │ │ │ +forward(to)); │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +299 template │ │ │ │ │ +_3_0_0 inline static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_<_T_,_ _t_o_,_ _f_r_o_m_> _r_a_n_g_e(std:: │ │ │ │ │ +integral_constant, std::integral_constant) noexcept │ │ │ │ │ +301 { │ │ │ │ │ +302 return {}; │ │ │ │ │ +303 } │ │ │ │ │ +304 │ │ │ │ │ +305 template │ │ │ │ │ +_3_0_6 inline static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_<_T_,_ _t_o_> _r_a_n_g_e(std::integral_constant) noexcept │ │ │ │ │ +307 { │ │ │ │ │ +308 return {}; │ │ │ │ │ +309 } │ │ │ │ │ +310 │ │ │ │ │ +311 │ │ │ │ │ +312 │ │ │ │ │ +_3_1_6 struct _V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g {}; │ │ │ │ │ +317 │ │ │ │ │ +_3_2_1 struct _I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g {}; │ │ │ │ │ +322 │ │ │ │ │ +323 namespace Impl │ │ │ │ │ +324 { │ │ │ │ │ +325 │ │ │ │ │ +326 // Helper class to mimic a pointer for proxy objects. │ │ │ │ │ +327 // This is needed to implement operator-> on an iterator │ │ │ │ │ +328 // using proxy-values. It stores the proxy value but │ │ │ │ │ +329 // provides operator-> like a pointer. │ │ │ │ │ +330 template │ │ │ │ │ +331 class PointerProxy │ │ │ │ │ +332 { │ │ │ │ │ +333 public: │ │ │ │ │ +334 PointerProxy(ProxyType&& p) : p_(p) │ │ │ │ │ +335 {} │ │ │ │ │ +336 │ │ │ │ │ +337 ProxyType* operator->() │ │ │ │ │ +338 { │ │ │ │ │ +339 return &p_; │ │ │ │ │ +340 } │ │ │ │ │ +341 │ │ │ │ │ +342 ProxyType p_; │ │ │ │ │ +343 }; │ │ │ │ │ +344 │ │ │ │ │ +345 // An iterator transforming a wrapped iterator using │ │ │ │ │ +346 // an unary function. It inherits the iterator-category │ │ │ │ │ +347 // of the underlying iterator. │ │ │ │ │ +348 template ::iterator_category> │ │ │ │ │ +349 class TransformedRangeIterator; │ │ │ │ │ +350 │ │ │ │ │ +351 template │ │ │ │ │ +352 class TransformedRangeIterator │ │ │ │ │ +353 { │ │ │ │ │ +354 protected: │ │ │ │ │ +355 │ │ │ │ │ +356 static decltype(auto) transform(const F& f, const I& it) { │ │ │ │ │ +357 if constexpr (std::is_same_v) │ │ │ │ │ +358 return f(it); │ │ │ │ │ +359 else │ │ │ │ │ +360 return f(*it); │ │ │ │ │ +361 } │ │ │ │ │ +362 │ │ │ │ │ +363 public: │ │ │ │ │ +364 using iterator_category = std::forward_iterator_tag; │ │ │ │ │ +365 using reference = decltype(transform(std::declval(), std::declval │ │ │ │ │ +())); │ │ │ │ │ +366 using value_type = std::decay_t; │ │ │ │ │ +367 using pointer = PointerProxy; │ │ │ │ │ +368 │ │ │ │ │ +369 // If we later want to allow standalone TransformedRangeIterators, │ │ │ │ │ +370 // we could customize the FunctionPointer to be a default-constructible, │ │ │ │ │ +371 // copy-assignable type storing a function but acting like a pointer │ │ │ │ │ +372 // to function. │ │ │ │ │ +373 using FunctionPointer = const F*; │ │ │ │ │ +374 │ │ │ │ │ +375 constexpr TransformedRangeIterator(const I& it, FunctionPointer f) noexcept │ │ │ │ │ +: │ │ │ │ │ +376 it_(it), │ │ │ │ │ +377 f_(f) │ │ │ │ │ +378 {} │ │ │ │ │ +379 │ │ │ │ │ +380 // Explicitly initialize members. Using a plain │ │ │ │ │ +381 // │ │ │ │ │ +382 // constexpr TransformedRangeIterator() noexcept {} │ │ │ │ │ +383 // │ │ │ │ │ +384 // would default-initialize the members while │ │ │ │ │ +385 // │ │ │ │ │ +386 // constexpr TransformedRangeIterator() noexcept : it_(), f_() {} │ │ │ │ │ +387 // │ │ │ │ │ +388 // leads to value-initialization. This is a case where │ │ │ │ │ +389 // both are really different. If it_ is a raw pointer (i.e. POD) │ │ │ │ │ +390 // then default-initialization leaves it uninitialized while │ │ │ │ │ +391 // value-initialization zero-initializes it. │ │ │ │ │ +392 constexpr TransformedRangeIterator() noexcept : │ │ │ │ │ +393 it_(), │ │ │ │ │ +394 f_() │ │ │ │ │ +395 {} │ │ │ │ │ +396 │ │ │ │ │ +397 // Dereferencing returns a value created by the function │ │ │ │ │ +398 constexpr reference _o_p_e_r_a_t_o_r_*() const noexcept { │ │ │ │ │ +399 return transform(*f_, it_); │ │ │ │ │ +400 } │ │ │ │ │ +401 │ │ │ │ │ +402 // Dereferencing returns a value created by the function │ │ │ │ │ +403 pointer operator->() const noexcept { │ │ │ │ │ +404 return transform(*f_, it_); │ │ │ │ │ +405 } │ │ │ │ │ +406 │ │ │ │ │ +407 constexpr TransformedRangeIterator& operator=(const │ │ │ │ │ +TransformedRangeIterator& other) = default; │ │ │ │ │ +408 │ │ │ │ │ +409 constexpr bool _o_p_e_r_a_t_o_r_=_=(const TransformedRangeIterator& other) const │ │ │ │ │ +noexcept { │ │ │ │ │ +410 return (it_ == other.it_); │ │ │ │ │ +411 } │ │ │ │ │ +412 │ │ │ │ │ +413 constexpr bool _o_p_e_r_a_t_o_r_!_=(const TransformedRangeIterator& other) const │ │ │ │ │ +noexcept { │ │ │ │ │ +414 return (it_ != other.it_); │ │ │ │ │ +415 } │ │ │ │ │ +416 │ │ │ │ │ +417 TransformedRangeIterator& operator++() noexcept { │ │ │ │ │ +418 ++it_; │ │ │ │ │ +419 return *this; │ │ │ │ │ +420 } │ │ │ │ │ +421 │ │ │ │ │ +422 TransformedRangeIterator operator++(int) noexcept { │ │ │ │ │ +423 TransformedRangeIterator copy(*this); │ │ │ │ │ +424 ++(*this); │ │ │ │ │ +425 return copy; │ │ │ │ │ +426 } │ │ │ │ │ +427 │ │ │ │ │ +428 protected: │ │ │ │ │ +429 I it_; │ │ │ │ │ +430 FunctionPointer f_; │ │ │ │ │ +431 }; │ │ │ │ │ +432 │ │ │ │ │ +433 │ │ │ │ │ +434 │ │ │ │ │ +435 template │ │ │ │ │ +436 class TransformedRangeIterator : │ │ │ │ │ +437 public TransformedRangeIterator │ │ │ │ │ +438 { │ │ │ │ │ +439 protected: │ │ │ │ │ +440 using Base = TransformedRangeIterator; │ │ │ │ │ +441 using Base::it_; │ │ │ │ │ +442 using Base::f_; │ │ │ │ │ +443 public: │ │ │ │ │ +444 using iterator_category = std::bidirectional_iterator_tag; │ │ │ │ │ +445 using reference = typename Base::reference; │ │ │ │ │ +446 using value_type = typename Base::value_type; │ │ │ │ │ +447 using pointer = typename Base::pointer; │ │ │ │ │ +448 │ │ │ │ │ +449 using FunctionPointer = typename Base::FunctionPointer; │ │ │ │ │ +450 │ │ │ │ │ +451 using Base::Base; │ │ │ │ │ +452 │ │ │ │ │ +453 // Member functions of the forward_iterator that need │ │ │ │ │ +454 // to be redefined because the base class methods return a │ │ │ │ │ +455 // forward_iterator. │ │ │ │ │ +456 constexpr TransformedRangeIterator& operator=(const │ │ │ │ │ +TransformedRangeIterator& other) = default; │ │ │ │ │ +457 │ │ │ │ │ +458 TransformedRangeIterator& operator++() noexcept { │ │ │ │ │ +459 ++it_; │ │ │ │ │ +460 return *this; │ │ │ │ │ +461 } │ │ │ │ │ +462 │ │ │ │ │ +463 TransformedRangeIterator operator++(int) noexcept { │ │ │ │ │ +464 TransformedRangeIterator copy(*this); │ │ │ │ │ +465 ++(*this); │ │ │ │ │ +466 return copy; │ │ │ │ │ +467 } │ │ │ │ │ +468 │ │ │ │ │ +469 // Additional member functions of bidirectional_iterator │ │ │ │ │ +470 TransformedRangeIterator& operator--() noexcept { │ │ │ │ │ +471 --(this->it_); │ │ │ │ │ +472 return *this; │ │ │ │ │ +473 } │ │ │ │ │ +474 │ │ │ │ │ +475 TransformedRangeIterator operator--(int) noexcept { │ │ │ │ │ +476 TransformedRangeIterator copy(*this); │ │ │ │ │ +477 --(*this); │ │ │ │ │ +478 return copy; │ │ │ │ │ +479 } │ │ │ │ │ +480 }; │ │ │ │ │ +481 │ │ │ │ │ +482 │ │ │ │ │ +483 │ │ │ │ │ +484 template │ │ │ │ │ +485 class TransformedRangeIterator : │ │ │ │ │ +486 public TransformedRangeIterator │ │ │ │ │ +487 { │ │ │ │ │ +488 protected: │ │ │ │ │ +489 using Base = TransformedRangeIterator; │ │ │ │ │ +490 using Base::it_; │ │ │ │ │ +491 using Base::f_; │ │ │ │ │ +492 public: │ │ │ │ │ +493 using iterator_category = std::random_access_iterator_tag; │ │ │ │ │ +494 using reference = typename Base::reference; │ │ │ │ │ +495 using value_type = typename Base::value_type; │ │ │ │ │ +496 using pointer = typename Base::pointer; │ │ │ │ │ +497 using difference_type = typename std::iterator_traits::difference_type; │ │ │ │ │ +498 │ │ │ │ │ +499 using FunctionPointer = typename Base::FunctionPointer; │ │ │ │ │ +500 │ │ │ │ │ +501 using Base::Base; │ │ │ │ │ +502 │ │ │ │ │ +503 // Member functions of the forward_iterator that need │ │ │ │ │ +504 // to be redefined because the base class methods return a │ │ │ │ │ +505 // forward_iterator. │ │ │ │ │ +506 constexpr TransformedRangeIterator& operator=(const │ │ │ │ │ +TransformedRangeIterator& other) = default; │ │ │ │ │ +507 │ │ │ │ │ +508 TransformedRangeIterator& operator++() noexcept { │ │ │ │ │ +509 ++it_; │ │ │ │ │ +510 return *this; │ │ │ │ │ +511 } │ │ │ │ │ +512 │ │ │ │ │ +513 TransformedRangeIterator operator++(int) noexcept { │ │ │ │ │ +514 TransformedRangeIterator copy(*this); │ │ │ │ │ +515 ++(*this); │ │ │ │ │ +516 return copy; │ │ │ │ │ +517 } │ │ │ │ │ +518 │ │ │ │ │ +519 // Member functions of the bidirectional_iterator that need │ │ │ │ │ +520 // to be redefined because the base class methods return a │ │ │ │ │ +521 // bidirectional_iterator. │ │ │ │ │ +522 TransformedRangeIterator& operator--() noexcept { │ │ │ │ │ +523 --(this->it_); │ │ │ │ │ +524 return *this; │ │ │ │ │ +525 } │ │ │ │ │ +526 │ │ │ │ │ +527 TransformedRangeIterator operator--(int) noexcept { │ │ │ │ │ +528 TransformedRangeIterator copy(*this); │ │ │ │ │ +529 --(*this); │ │ │ │ │ +530 return copy; │ │ │ │ │ +531 } │ │ │ │ │ +532 │ │ │ │ │ +533 // Additional member functions of random_access_iterator │ │ │ │ │ +534 TransformedRangeIterator& operator+=(difference_type n) noexcept { │ │ │ │ │ +535 it_ += n; │ │ │ │ │ +536 return *this; │ │ │ │ │ +537 } │ │ │ │ │ +538 │ │ │ │ │ +539 TransformedRangeIterator& operator-=(difference_type n) noexcept { │ │ │ │ │ +540 it_ -= n; │ │ │ │ │ +541 return *this; │ │ │ │ │ +542 } │ │ │ │ │ +543 │ │ │ │ │ +544 bool _o_p_e_r_a_t_o_r_<(const TransformedRangeIterator& other) noexcept { │ │ │ │ │ +545 return it_(const TransformedRangeIterator& other) noexcept { │ │ │ │ │ +553 return it_>other.it_; │ │ │ │ │ +554 } │ │ │ │ │ +555 │ │ │ │ │ +556 bool _o_p_e_r_a_t_o_r_>_=(const TransformedRangeIterator& other) noexcept { │ │ │ │ │ +557 return it_>=other.it_; │ │ │ │ │ +558 } │ │ │ │ │ +559 │ │ │ │ │ +560 reference operator[](difference_type n) noexcept { │ │ │ │ │ +561 return Base::transform(*f_, it_+n); │ │ │ │ │ +562 } │ │ │ │ │ +563 │ │ │ │ │ +564 friend │ │ │ │ │ +565 TransformedRangeIterator _o_p_e_r_a_t_o_r_+(const TransformedRangeIterator& it, │ │ │ │ │ +difference_type n) noexcept { │ │ │ │ │ +566 return TransformedRangeIterator(it.it_+n, it.f_); │ │ │ │ │ +567 } │ │ │ │ │ +568 │ │ │ │ │ +569 friend │ │ │ │ │ +570 TransformedRangeIterator _o_p_e_r_a_t_o_r_+(difference_type n, const │ │ │ │ │ +TransformedRangeIterator& it) noexcept { │ │ │ │ │ +571 return TransformedRangeIterator(n+it.it_, it.f_); │ │ │ │ │ +572 } │ │ │ │ │ +573 │ │ │ │ │ +574 friend │ │ │ │ │ +575 TransformedRangeIterator _o_p_e_r_a_t_o_r_-(const TransformedRangeIterator& it, │ │ │ │ │ +difference_type n) noexcept { │ │ │ │ │ +576 return TransformedRangeIterator(it.it_-n, it.f_); │ │ │ │ │ +577 } │ │ │ │ │ +578 │ │ │ │ │ +579 friend │ │ │ │ │ +580 difference_type _o_p_e_r_a_t_o_r_-(const TransformedRangeIterator& first, const │ │ │ │ │ +TransformedRangeIterator& second) noexcept { │ │ │ │ │ +581 return first.it_-second.it_; │ │ │ │ │ +582 } │ │ │ │ │ +583 }; │ │ │ │ │ +584 │ │ │ │ │ +585 │ │ │ │ │ +586 } // namespace Impl │ │ │ │ │ +587 │ │ │ │ │ +588 │ │ │ │ │ +589 │ │ │ │ │ +626 template │ │ │ │ │ +_6_2_7 class _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ +628 { │ │ │ │ │ +629 using RawConstIterator = std::decay_t │ │ │ │ │ +()._b_e_g_i_n())>; │ │ │ │ │ +630 using RawIterator = std::decay_t().begin())>; │ │ │ │ │ +631 │ │ │ │ │ +632 public: │ │ │ │ │ +633 │ │ │ │ │ +_6_4_0 using _c_o_n_s_t___i_t_e_r_a_t_o_r = Impl::TransformedRangeIterator; │ │ │ │ │ +641 │ │ │ │ │ +_6_4_8 using _i_t_e_r_a_t_o_r = Impl::TransformedRangeIterator; │ │ │ │ │ +649 │ │ │ │ │ +_6_5_6 using _R_a_w_R_a_n_g_e = std::remove_reference_t; │ │ │ │ │ +657 │ │ │ │ │ +661 template │ │ │ │ │ +_6_6_2 constexpr _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(RR&& _r_a_w_R_a_n_g_e, const F& f) noexcept : │ │ │ │ │ +663 rawRange_(std::forward(_r_a_w_R_a_n_g_e)), │ │ │ │ │ +664 f_(f) │ │ │ │ │ +665 { │ │ │ │ │ +666 static_assert(std::is_same_v or std:: │ │ │ │ │ +is_same_v, │ │ │ │ │ +667 "The TransformationType passed to TransformedRangeView has to be either │ │ │ │ │ +ValueTransformationTag or IteratorTransformationTag."); │ │ │ │ │ +668 } │ │ │ │ │ +669 │ │ │ │ │ +_6_7_8 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const noexcept { │ │ │ │ │ +679 return _c_o_n_s_t___i_t_e_r_a_t_o_r(rawRange_.begin(), &f_); │ │ │ │ │ +680 } │ │ │ │ │ +681 │ │ │ │ │ +_6_8_2 constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n() noexcept { │ │ │ │ │ +683 return _i_t_e_r_a_t_o_r(rawRange_.begin(), &f_); │ │ │ │ │ +684 } │ │ │ │ │ +685 │ │ │ │ │ +_6_9_4 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const noexcept { │ │ │ │ │ +695 return _c_o_n_s_t___i_t_e_r_a_t_o_r(rawRange_.end(), &f_); │ │ │ │ │ +696 } │ │ │ │ │ +697 │ │ │ │ │ +_6_9_8 constexpr _i_t_e_r_a_t_o_r _e_n_d() noexcept { │ │ │ │ │ +699 return _i_t_e_r_a_t_o_r(rawRange_.end(), &f_); │ │ │ │ │ +700 } │ │ │ │ │ +701 │ │ │ │ │ +712 template().size())>> │ │ │ │ │ +_7_1_4 auto _s_i_z_e() const │ │ │ │ │ +715 { │ │ │ │ │ +716 return rawRange_.size(); │ │ │ │ │ +717 } │ │ │ │ │ +718 │ │ │ │ │ +_7_2_2 const _R_a_w_R_a_n_g_e& _r_a_w_R_a_n_g_e() const │ │ │ │ │ +723 { │ │ │ │ │ +724 return rawRange_; │ │ │ │ │ +725 } │ │ │ │ │ +726 │ │ │ │ │ +_7_3_0 _R_a_w_R_a_n_g_e& _r_a_w_R_a_n_g_e() │ │ │ │ │ +731 { │ │ │ │ │ +732 return rawRange_; │ │ │ │ │ +733 } │ │ │ │ │ +734 │ │ │ │ │ +735 private: │ │ │ │ │ +736 R rawRange_; │ │ │ │ │ +737 F f_; │ │ │ │ │ +738 }; │ │ │ │ │ +739 │ │ │ │ │ +768 template │ │ │ │ │ +_7_6_9 auto _t_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(R&& _r_a_n_g_e, const F& f) │ │ │ │ │ +770 { │ │ │ │ │ +771 return _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_<_R_,_ _F_,_ _V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g_>(std::forward │ │ │ │ │ +(_r_a_n_g_e), f); │ │ │ │ │ +772 } │ │ │ │ │ +773 │ │ │ │ │ +801 template │ │ │ │ │ +_8_0_2 auto _i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(R&& _r_a_n_g_e, const F& f) │ │ │ │ │ +803 { │ │ │ │ │ +804 return _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_<_R_,_ _F_,_ _I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g_>(std:: │ │ │ │ │ +forward(_r_a_n_g_e), f); │ │ │ │ │ +805 } │ │ │ │ │ +806 │ │ │ │ │ +807 │ │ │ │ │ +820 template │ │ │ │ │ +_8_2_1 auto _s_p_a_r_s_e_R_a_n_g_e(Range&& _r_a_n_g_e) { │ │ │ │ │ +822 return _D_u_n_e_:_:_i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(std::forward(_r_a_n_g_e), [] │ │ │ │ │ +(auto&& it) { │ │ │ │ │ +823 return std::tuple(*it, it.index()); │ │ │ │ │ +824 }); │ │ │ │ │ +825 } │ │ │ │ │ +826 │ │ │ │ │ +831} │ │ │ │ │ +832 │ │ │ │ │ +833#endif // DUNE_COMMON_RANGE_UTILITIES_HH │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_u_n_e_:_:_s_p_a_r_s_e_R_a_n_g_e │ │ │ │ │ +auto sparseRange(Range &&range) │ │ │ │ │ +Allow structured-binding for-loops for sparse iterators. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:821 │ │ │ │ │ +_D_u_n_e_:_:_i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ +auto iteratorTransformedRangeView(R &&range, const F &f) │ │ │ │ │ +Create a TransformedRangeView using an iterator transformation. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:802 │ │ │ │ │ +_D_u_n_e_:_:_t_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ +auto transformedRangeView(R &&range, const F &f) │ │ │ │ │ +Create a TransformedRangeView. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:769 │ │ │ │ │ +_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ +static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ +>, std::integral_constant< T, to >) noexcept │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:549 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:542 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ +bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:535 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator<(const │ │ │ │ │ +RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ +RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ +Comparison operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:637 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_> │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator>(const │ │ │ │ │ +RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ +RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ +Comparison operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:683 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator<=(const │ │ │ │ │ +RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ +RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ +Comparison operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:660 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for equality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator>=(const │ │ │ │ │ +RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ +RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ +Comparison operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:705 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for inequality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn matvectraits.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_a_n_y___t_r_u_e │ │ │ │ │ +bool any_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:493 │ │ │ │ │ +_D_u_n_e_:_:_a_l_l___t_r_u_e │ │ │ │ │ +bool all_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:499 │ │ │ │ │ +_D_u_n_e_:_:_m_a_x___v_a_l_u_e │ │ │ │ │ +T max_value(const AlignedNumber< T, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:481 │ │ │ │ │ +_D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ +T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:487 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +dynamic integer range for use in range-based for loops │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_b_e_g_i_n │ │ │ │ │ +constexpr iterator begin() const noexcept │ │ │ │ │ +obtain a random-access iterator to the first element │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:192 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_n_d │ │ │ │ │ +constexpr iterator end() const noexcept │ │ │ │ │ +obtain a random-access iterator past the last element │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::make_unsigned_t< T > size_type │ │ │ │ │ +unsigned integer type corresponding to value_type │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +Impl::IntegralRangeIterator< T > iterator │ │ │ │ │ +type of iterator │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +constexpr value_type operator[](const value_type &i) const noexcept │ │ │ │ │ +access specified element │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:197 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_m_p_t_y │ │ │ │ │ +constexpr bool empty() const noexcept │ │ │ │ │ +check whether the range is empty │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:200 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +constexpr IntegralRange(std::pair< value_type, value_type > range) noexcept │ │ │ │ │ +construct integer range std::pair │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +constexpr IntegralRange(value_type from, value_type to) noexcept │ │ │ │ │ +construct integer range [from, to) │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:185 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e │ │ │ │ │ +constexpr size_type size() const noexcept │ │ │ │ │ +obtain number of elements in the range │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:202 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +constexpr IntegralRange(value_type to) noexcept │ │ │ │ │ +construct integer range [0, to) │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:187 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +T value_type │ │ │ │ │ +type of integers contained in the range │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +static integer range for use in range-based for loops │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:225 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_n_d │ │ │ │ │ +static constexpr iterator end() noexcept │ │ │ │ │ +obtain a random-access iterator past the last element │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:251 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_i_n_t_e_g_e_r___s_e_q_u_e_n_c_e │ │ │ │ │ +decltype(shift_integer_sequence< from >(std::make_integer_sequence< T, to-from │ │ │ │ │ +>())) integer_sequence │ │ │ │ │ +type of corresponding std::integer_sequence │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:238 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ +constexpr StaticIntegralRange() noexcept=default │ │ │ │ │ +default constructor │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::make_unsigned_t< T > size_type │ │ │ │ │ +unsigned integer type corresponding to value_type │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:235 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +T value_type │ │ │ │ │ +type of integers contained in the range │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:231 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +constexpr auto operator[](const std::integral_constant< U, i > &) const │ │ │ │ │ +noexcept -> std::integral_constant< value_type, from+static_cast< value_type > │ │ │ │ │ +(i)> │ │ │ │ │ +access specified element (static version) │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:255 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_m_p_t_y │ │ │ │ │ +static constexpr std::integral_constant< bool, from==to > empty() noexcept │ │ │ │ │ +check whether the range is empty │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:265 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_b_e_g_i_n │ │ │ │ │ +static constexpr iterator begin() noexcept │ │ │ │ │ +obtain a random-access iterator to the first element │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:249 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +constexpr value_type operator[](const size_type &i) const noexcept │ │ │ │ │ +access specified element (dynamic version) │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:262 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +Impl::IntegralRangeIterator< T > iterator │ │ │ │ │ +type of iterator │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:233 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e │ │ │ │ │ +static constexpr std::integral_constant< size_type, static_cast< size_type > │ │ │ │ │ +(to) - static_cast< size_type >(from) > size() noexcept │ │ │ │ │ +obtain number of elements in the range │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ +Tag to enable value based transformations in TransformedRangeView. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:316 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ +Tag to enable iterator based transformations in TransformedRangeView. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:321 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ +A range transforming the values of another range on-the-fly. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:628 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_s_i_z_e │ │ │ │ │ +auto size() const │ │ │ │ │ +Obtain the size of the range. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:714 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_e_n_d │ │ │ │ │ +constexpr iterator end() noexcept │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:698 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_R_a_w_R_a_n_g_e │ │ │ │ │ +std::remove_reference_t< R > RawRange │ │ │ │ │ +Export type of the wrapped untransformed range. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:656 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +Impl::TransformedRangeIterator< RawConstIterator, F, T > const_iterator │ │ │ │ │ +Const iterator type. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:640 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_b_e_g_i_n │ │ │ │ │ +constexpr iterator begin() noexcept │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:682 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ +constexpr TransformedRangeView(RR &&rawRange, const F &f) noexcept │ │ │ │ │ +Construct from range and function. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:662 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_r_a_w_R_a_n_g_e │ │ │ │ │ +const RawRange & rawRange() const │ │ │ │ │ +Export the wrapped untransformed range. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:722 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +Impl::TransformedRangeIterator< RawIterator, F, T > iterator │ │ │ │ │ +Iterator type. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:648 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_b_e_g_i_n │ │ │ │ │ +constexpr const_iterator begin() const noexcept │ │ │ │ │ +Obtain a iterator to the first element. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:678 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_e_n_d │ │ │ │ │ +constexpr const_iterator end() const noexcept │ │ │ │ │ +Obtain a iterator past the last element. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:694 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_r_a_w_R_a_n_g_e │ │ │ │ │ +RawRange & rawRange() │ │ │ │ │ +Export the wrapped untransformed range. │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:730 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00020.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: debugalign.cc File Reference │ │ │ │ +dune-common: parametertree.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -69,47 +69,27 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
│ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
debugalign.cc File Reference
│ │ │ │ +
parametertree.cc File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <config.h>
│ │ │ │ -#include <cstddef>
│ │ │ │ -#include <cstdlib>
│ │ │ │ -#include <functional>
│ │ │ │ -#include <ios>
│ │ │ │ +
#include <cstdlib>
│ │ │ │ #include <iostream>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <dune/common/debugalign.hh>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Namespaces

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

│ │ │ │ -Functions

static void Dune::defaultViolatedAlignment (const char *className, std::size_t expectedAlignment, const void *address)
 default alignment violation handler
 
ViolatedAlignmentHandlerDune::violatedAlignmentHandler ()
 access the handler called by violatedAlignment()
 
void Dune::violatedAlignment (const char *className, std::size_t expectedAlignment, const void *address)
 called when an alignment violation is detected
 
│ │ │ │ -
│ │ │ │ +#include <ostream>
│ │ │ │ +#include <string>
│ │ │ │ +#include <sstream>
│ │ │ │ +#include <fstream>
│ │ │ │ +#include <set>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/parametertree.hh>
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,19 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -debugalign.cc File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +parametertree.cc File Reference │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_b_u_g_a_l_i_g_n_._h_h> │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ - static void  _D_u_n_e_:_:_d_e_f_a_u_l_t_V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t (const char │ │ │ │ │ - *_c_l_a_s_s_N_a_m_e, std::size_t expectedAlignment, const │ │ │ │ │ - void *address) │ │ │ │ │ -  default alignment violation handler │ │ │ │ │ -  │ │ │ │ │ -_V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r &  _D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r () │ │ │ │ │ -  access the handler called by _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_(_) │ │ │ │ │ -  │ │ │ │ │ - void  _D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t (const char *_c_l_a_s_s_N_a_m_e, │ │ │ │ │ - std::size_t expectedAlignment, const void *address) │ │ │ │ │ -  called when an alignment violation is detected │ │ │ │ │ -  │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_m_e_t_e_r_t_r_e_e_._h_h> │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00023.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: lru.hh File Reference │ │ │ │ +dune-common: exceptions.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,45 +70,26 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces
│ │ │ │ -
lru.hh File Reference
│ │ │ │ +
exceptions.cc File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

LRU Cache Container, using an STL like interface. │ │ │ │ -More...

│ │ │ │ -
#include <list>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <map>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -
│ │ │ │ -

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::lru< Key, Tp, Traits >
 LRU Cache Container. More...
 
│ │ │ │ +
#include <dune/common/exceptions.hh>
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

LRU Cache Container, using an STL like interface.

│ │ │ │ -
Author
Christian Engwer
│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,29 +1,15 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -lru.hh File Reference │ │ │ │ │ -LRU Cache Container, using an STL like interface. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +exceptions.cc File Reference │ │ │ │ │ #include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_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_:_:_l_r_u_<_ _K_e_y_,_ _T_p_,_ _T_r_a_i_t_s_ _> │ │ │ │ │ -  LRU Cache Container. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -LRU Cache Container, using an STL like interface. │ │ │ │ │ - Author │ │ │ │ │ - Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00026.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: stdthread.cc File Reference │ │ │ │ +dune-common: propertymap.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,35 +70,78 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
stdthread.cc File Reference
│ │ │ │ +
propertymap.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <cstdlib>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <mutex>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <dune/common/stdthread.hh>
│ │ │ │ -
│ │ │ │ +
#include <cstddef>
│ │ │ │ +#include <iterator>
│ │ │ │ +#include <type_traits>
│ │ │ │ +
│ │ │ │ +

Go to the source code of this file.

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

│ │ │ │ +Classes

struct  Dune::PropertyMapTraits< PM >
 
struct  Dune::ReadablePropertyMapTag
 Tag for the category of readable property maps. More...
 
struct  Dune::WritablePropertyMapTag
 Tag for the category of writable property maps. More...
 
struct  Dune::ReadWritePropertyMapTag
 Tag for the category of readable and writable property maps. More...
 
struct  Dune::LvaluePropertyMapTag
 Tag for the category of lvalue property maps. More...
 
struct  Dune::PropertyMapTraits< T * >
 
struct  Dune::PropertyMapTraits< const T * >
 
struct  Dune::RAPropertyMapHelper< Reference, PropertyMap >
 
class  Dune::IteratorPropertyMap< RAI, IM, T, R >
 Adapter to turn a random access iterator into a property map. More...
 
class  Dune::AssociativePropertyMap< T >
 An adapter to turn an unique associative container into a property map. More...
 
class  Dune::ConstAssociativePropertyMap< T >
 An adaptor to turn an unique associative container into a property map. More...
 
struct  Dune::IdentityMap
 A property map that applies the identity function to integers. More...
 
struct  Dune::PropertyMapTypeSelector< T, C >
 Selector for the property map type. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Functions

void Dune::doAssertCallOnce (const char *file, int line, const char *function)
 
template<class Reference , class PropertyMap , class Key >
Reference Dune::get (const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
 
template<class Reference , class PropertyMap , class Key , class Value >
void Dune::put (const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key, const Value &value)
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,22 +1,65 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -stdthread.cc File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_t_h_r_e_a_d_._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 │ │ │ │ │ +propertymap.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 │ │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _P_M_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_R_e_a_d_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ +  Tag for the category of readable property maps. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_W_r_i_t_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ +  Tag for the category of writable property maps. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_R_e_a_d_W_r_i_t_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ +  Tag for the category of readable and writable property maps. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ +  Tag for the category of lvalue property maps. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _T_ _*_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _*_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r_<_ _R_e_f_e_r_e_n_c_e_,_ _P_r_o_p_e_r_t_y_M_a_p_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_<_ _R_A_I_,_ _I_M_,_ _T_,_ _R_ _> │ │ │ │ │ +  Adapter to turn a random access iterator into a property map. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p_<_ _T_ _> │ │ │ │ │ +  An adapter to turn an unique associative container into a property │ │ │ │ │ + map. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_C_o_n_s_t_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p_<_ _T_ _> │ │ │ │ │ +  An adaptor to turn an unique associative container into a property │ │ │ │ │ + map. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p │ │ │ │ │ +  A property map that applies the identity function to integers. _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_<_ _T_,_ _C_ _> │ │ │ │ │ +  Selector for the property map type. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -void  _D_u_n_e_:_:_d_o_A_s_s_e_r_t_C_a_l_l_O_n_c_e (const char *file, int line, const char *function) │ │ │ │ │ +template │ │ │ │ │ +Reference  _D_u_n_e_:_:_g_e_t (const _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r< Reference, PropertyMap > │ │ │ │ │ + &pmap, const Key &key) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + void  _D_u_n_e_:_:_p_u_t (const _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r< Reference, PropertyMap > │ │ │ │ │ + &pmap, const Key &key, const Value &value) │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00029.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: visibility.hh File Reference │ │ │ │ +dune-common: stdstreams.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,70 +70,84 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Macros
│ │ │ │ -
visibility.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Macros | │ │ │ │ +Typedefs | │ │ │ │ +Variables
│ │ │ │ +
stdstreams.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Definition of macros controlling symbol visibility at the ABI level. │ │ │ │ +

Standard Dune debug streams. │ │ │ │ More...

│ │ │ │ - │ │ │ │ +
#include "debugstream.hh"
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Namespaces

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

│ │ │ │ Macros

#define DUNE_EXPORT   implementation_defined
 Export a symbol as part of the public ABI.
 
#define DUNE_PRIVATE   implementation_defined
 Mark a symbol as being for internal use within the current DSO only.
 
#define DUNE_MINIMAL_DEBUG_LEVEL   4
 The default minimum debug level.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Typedefs

typedef DebugStream< VERY_VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVELDune::DVVerbType
 Type of very verbose debug stream.
 
typedef DebugStream< VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVELDune::DVerbType
 Type of more verbose debug stream.
 
typedef DebugStream< INFO_DEBUG_LEVEL, MINIMAL_DEBUG_LEVELDune::DInfoType
 Type of debug stream with info level.
 
typedef DebugStream< WARN_DEBUG_LEVEL, MINIMAL_DEBUG_LEVELDune::DWarnType
 Type of debug stream with warn level.
 
typedef DebugStream< GRAVE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVELDune::DGraveType
 Type of debug stream for fatal errors.
 
typedef DebugStream< 1 > Dune::DErrType
 The type of the stream used for error messages.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Variables

static const DebugLevel Dune::MINIMAL_DEBUG_LEVEL = DUNE_MINIMAL_DEBUG_LEVEL
 
static const DebugLevel Dune::VERY_VERBOSE_DEBUG_LEVEL = 1
 The level of the very verbose debug stream.
 
static const DebugLevel Dune::VERBOSE_DEBUG_LEVEL = 2
 The level of the verbose debug stream.
 
static const DebugLevel Dune::INFO_DEBUG_LEVEL = 3
 The level of the informative debug stream.
 
static const DebugLevel Dune::WARN_DEBUG_LEVEL = 4
 The level of the debug stream for warnings.
 
static const DebugLevel Dune::GRAVE_DEBUG_LEVEL = 5
 The level of the debug stream for fatal errors.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Definition of macros controlling symbol visibility at the ABI level.

│ │ │ │ -

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ DUNE_EXPORT

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_EXPORT   implementation_defined
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

Export a symbol as part of the public ABI.

│ │ │ │ -

Mark a class, function or static variable as visible outside the current DSO. For now, this is mostly important for templated global variables and functions that contain static variables.

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

◆ DUNE_PRIVATE

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_PRIVATE   implementation_defined
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

Mark a symbol as being for internal use within the current DSO only.

│ │ │ │ -

Mark a class, function or static variable as inaccessible from outside the current DSO. Doing so will decrease the size of the symbol table, but you have to be sure that the symbol will never have to be accessed from another library or the main executable!

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

Standard Dune debug streams.

│ │ │ │ +

The standard debug streams are compiled into libdune to exist globally. This file declares the stream types and the global debug level.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,70 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_M_a_c_r_o_s │ │ │ │ │ -visibility.hh File Reference │ │ │ │ │ -Definition of macros controlling symbol visibility at the ABI level. _M_o_r_e_._._. │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s | _T_y_p_e_d_e_f_s | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +stdstreams.hh File Reference │ │ │ │ │ +Standard _D_u_n_e debug streams. _M_o_r_e_._._. │ │ │ │ │ +#include "_d_e_b_u_g_s_t_r_e_a_m_._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 │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │ +  │ │ │ │ │ MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___E_X_P_O_R_T   implementation_defined │ │ │ │ │ -  Export a symbol as part of the public ABI. │ │ │ │ │ +#define  _D_U_N_E___M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L   4 │ │ │ │ │ +  The default minimum debug level. │ │ │ │ │ +  │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ + typedef _D_e_b_u_g_S_t_r_e_a_m< │ │ │ │ │ + _V_E_R_Y___V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L, │ │ │ │ │ + _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L >  _D_u_n_e_:_:_D_V_V_e_r_b_T_y_p_e │ │ │ │ │ +  Type of very verbose debug stream. │ │ │ │ │ +  │ │ │ │ │ + typedef _D_e_b_u_g_S_t_r_e_a_m< │ │ │ │ │ +_V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L, _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ + >  _D_u_n_e_:_:_D_V_e_r_b_T_y_p_e │ │ │ │ │ +  Type of more verbose debug stream. │ │ │ │ │ +  │ │ │ │ │ + typedef _D_e_b_u_g_S_t_r_e_a_m< _I_N_F_O___D_E_B_U_G___L_E_V_E_L, │ │ │ │ │ + _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L >  _D_u_n_e_:_:_D_I_n_f_o_T_y_p_e │ │ │ │ │ +  Type of debug stream with info level. │ │ │ │ │ +  │ │ │ │ │ + typedef _D_e_b_u_g_S_t_r_e_a_m< _W_A_R_N___D_E_B_U_G___L_E_V_E_L, │ │ │ │ │ + _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L >  _D_u_n_e_:_:_D_W_a_r_n_T_y_p_e │ │ │ │ │ +  Type of debug stream with warn level. │ │ │ │ │ +  │ │ │ │ │ + typedef _D_e_b_u_g_S_t_r_e_a_m< _G_R_A_V_E___D_E_B_U_G___L_E_V_E_L, │ │ │ │ │ + _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L >  _D_u_n_e_:_:_D_G_r_a_v_e_T_y_p_e │ │ │ │ │ +  Type of debug stream for fatal errors. │ │ │ │ │ +  │ │ │ │ │ + typedef _D_e_b_u_g_S_t_r_e_a_m< 1 >  _D_u_n_e_:_:_D_E_r_r_T_y_p_e │ │ │ │ │ +  The type of the stream used for error │ │ │ │ │ + messages. │ │ │ │ │ +  │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ +static const _D_e_b_u_g_L_e_v_e_l  _D_u_n_e_:_:_M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L = _D_U_N_E___M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +  │ │ │ │ │ +static const _D_e_b_u_g_L_e_v_e_l  _D_u_n_e_:_:_V_E_R_Y___V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L = 1 │ │ │ │ │ +  The level of the very verbose debug stream. │ │ │ │ │ +  │ │ │ │ │ +static const _D_e_b_u_g_L_e_v_e_l  _D_u_n_e_:_:_V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L = 2 │ │ │ │ │ +  The level of the verbose debug stream. │ │ │ │ │ +  │ │ │ │ │ +static const _D_e_b_u_g_L_e_v_e_l  _D_u_n_e_:_:_I_N_F_O___D_E_B_U_G___L_E_V_E_L = 3 │ │ │ │ │ +  The level of the informative debug stream. │ │ │ │ │ +  │ │ │ │ │ +static const _D_e_b_u_g_L_e_v_e_l  _D_u_n_e_:_:_W_A_R_N___D_E_B_U_G___L_E_V_E_L = 4 │ │ │ │ │ +  The level of the debug stream for warnings. │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___P_R_I_V_A_T_E   implementation_defined │ │ │ │ │ -  Mark a symbol as being for internal use within the current DSO only. │ │ │ │ │ +static const _D_e_b_u_g_L_e_v_e_l  _D_u_n_e_:_:_G_R_A_V_E___D_E_B_U_G___L_E_V_E_L = 5 │ │ │ │ │ +  The level of the debug stream for fatal errors. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Definition of macros controlling symbol visibility at the ABI level. │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__EEXXPPOORRTT ********** │ │ │ │ │ -#define DUNE_EXPORT   implementation_defined │ │ │ │ │ -Export a symbol as part of the public ABI. │ │ │ │ │ -Mark a class, function or static variable as visible outside the current DSO. │ │ │ │ │ -For now, this is mostly important for templated global variables and functions │ │ │ │ │ -that contain static variables. │ │ │ │ │ -********** _?◆_? DDUUNNEE__PPRRIIVVAATTEE ********** │ │ │ │ │ -#define DUNE_PRIVATE   implementation_defined │ │ │ │ │ -Mark a symbol as being for internal use within the current DSO only. │ │ │ │ │ -Mark a class, function or static variable as inaccessible from outside the │ │ │ │ │ -current DSO. Doing so will decrease the size of the symbol table, but you have │ │ │ │ │ -to be sure that the symbol will never have to be accessed from another library │ │ │ │ │ -or the main executable! │ │ │ │ │ +Standard _D_u_n_e debug streams. │ │ │ │ │ +The standard debug streams are compiled into libdune to exist globally. This │ │ │ │ │ +file declares the stream types and the global debug level. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: visibility.hh Source File │ │ │ │ +dune-common: stdstreams.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,48 +74,94 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
visibility.hh
│ │ │ │ +
stdstreams.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_VISIBILITY_HH
│ │ │ │ -
6#define DUNE_COMMON_VISIBILITY_HH
│ │ │ │ -
7
│ │ │ │ -
12#ifdef DOXYGEN
│ │ │ │ -
13
│ │ │ │ -
15
│ │ │ │ -
20#define DUNE_EXPORT implementation_defined
│ │ │ │ +
5
│ │ │ │ +
15#ifndef DUNE_COMMON_STDSTREAMS_HH
│ │ │ │ +
16#define DUNE_COMMON_STDSTREAMS_HH
│ │ │ │ +
17
│ │ │ │ +
18#include "debugstream.hh"
│ │ │ │ +
19
│ │ │ │ +
20namespace Dune {
│ │ │ │
21
│ │ │ │ -
23
│ │ │ │ -
28#define DUNE_PRIVATE implementation_defined
│ │ │ │ -
29
│ │ │ │ -
30#else // DOXYGEN
│ │ │ │ -
31
│ │ │ │ -
32#if __GNUC__ >= 4
│ │ │ │ -
33// GCC and Clang both define __GNUC__ to 4 and they both support the visibility
│ │ │ │ -
34// attribute
│ │ │ │ -
35#define DUNE_EXPORT __attribute__((visibility("default")))
│ │ │ │ -
36#define DUNE_PRIVATE __attribute__((visibility("hidden")))
│ │ │ │ -
37#else
│ │ │ │ -
38// We don't know about the active compiler, so just turn the visibility macros to no-ops.
│ │ │ │ -
39#define DUNE_EXPORT
│ │ │ │ -
40#define DUNE_PRIVATE
│ │ │ │ -
41#endif
│ │ │ │ -
42
│ │ │ │ -
43#endif // DOXYGEN
│ │ │ │ -
44
│ │ │ │ -
45#endif // DUNE_COMMON_VISIBILITY
│ │ │ │ +
66#ifndef DUNE_MINIMAL_DEBUG_LEVEL
│ │ │ │ +
67#define DUNE_MINIMAL_DEBUG_LEVEL 4
│ │ │ │ +
68#endif
│ │ │ │ + │ │ │ │ +
70
│ │ │ │ + │ │ │ │ +
76
│ │ │ │ + │ │ │ │ +
82
│ │ │ │ + │ │ │ │ +
96
│ │ │ │ + │ │ │ │ +
102
│ │ │ │ + │ │ │ │ +
108
│ │ │ │ + │ │ │ │ +
117
│ │ │ │ +
122 static const DebugLevel INFO_DEBUG_LEVEL = 3;
│ │ │ │ +
123
│ │ │ │ + │ │ │ │ +
129
│ │ │ │ + │ │ │ │ +
141
│ │ │ │ +
146 static const DebugLevel WARN_DEBUG_LEVEL = 4;
│ │ │ │ +
147
│ │ │ │ + │ │ │ │ +
153
│ │ │ │ + │ │ │ │ +
162
│ │ │ │ + │ │ │ │ +
168
│ │ │ │ + │ │ │ │ +
171
│ │ │ │ + │ │ │ │ +
180
│ │ │ │ + │ │ │ │ +
183
│ │ │ │ + │ │ │ │ +
196
│ │ │ │ +
198}
│ │ │ │ +
199
│ │ │ │ +
200#endif
│ │ │ │ +
Defines several output streams for messages of different importance.
│ │ │ │ +
unsigned int DebugLevel
Type for debug levels.
Definition debugstream.hh:118
│ │ │ │ +
DebugStream< VERY_VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVVerbType
Type of very verbose debug stream.
Definition stdstreams.hh:81
│ │ │ │ +
DebugStream< WARN_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DWarnType
Type of debug stream with warn level.
Definition stdstreams.hh:152
│ │ │ │ +
DVVerbType dvverb(std::cout)
stream for very verbose output.
Definition stdstreams.hh:95
│ │ │ │ +
static const DebugLevel MINIMAL_DEBUG_LEVEL
Definition stdstreams.hh:69
│ │ │ │ +
#define DUNE_MINIMAL_DEBUG_LEVEL
The default minimum debug level.
Definition stdstreams.hh:67
│ │ │ │ +
static const DebugLevel VERY_VERBOSE_DEBUG_LEVEL
The level of the very verbose debug stream.
Definition stdstreams.hh:75
│ │ │ │ +
DWarnType dwarn(std::cerr)
Stream for warnings indicating problems.
Definition stdstreams.hh:161
│ │ │ │ +
static const DebugLevel GRAVE_DEBUG_LEVEL
The level of the debug stream for fatal errors.
Definition stdstreams.hh:167
│ │ │ │ +
DebugStream< VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVerbType
Type of more verbose debug stream.
Definition stdstreams.hh:107
│ │ │ │ +
DebugStream< GRAVE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DGraveType
Type of debug stream for fatal errors.
Definition stdstreams.hh:170
│ │ │ │ +
DGraveType dgrave(std::cerr)
Stream for warnings indicating fatal errors.
Definition stdstreams.hh:179
│ │ │ │ +
DebugStream< 1 > DErrType
The type of the stream used for error messages.
Definition stdstreams.hh:182
│ │ │ │ +
static const DebugLevel INFO_DEBUG_LEVEL
The level of the informative debug stream.
Definition stdstreams.hh:122
│ │ │ │ +
DebugStream< INFO_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DInfoType
Type of debug stream with info level.
Definition stdstreams.hh:128
│ │ │ │ +
DInfoType dinfo(std::cout)
Stream for informative output.
Definition stdstreams.hh:140
│ │ │ │ +
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition stdstreams.hh:116
│ │ │ │ +
static const DebugLevel VERBOSE_DEBUG_LEVEL
The level of the verbose debug stream.
Definition stdstreams.hh:101
│ │ │ │ +
DErrType derr(std::cerr)
Stream for error messages.
Definition stdstreams.hh:195
│ │ │ │ +
static const DebugLevel WARN_DEBUG_LEVEL
The level of the debug stream for warnings.
Definition stdstreams.hh:146
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
Generic class to implement debug output streams.
Definition debugstream.hh:192
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,44 +1,153 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -visibility.hh │ │ │ │ │ +stdstreams.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_VISIBILITY_HH │ │ │ │ │ -6#define DUNE_COMMON_VISIBILITY_HH │ │ │ │ │ -7 │ │ │ │ │ -12#ifdef DOXYGEN │ │ │ │ │ -13 │ │ │ │ │ -15 │ │ │ │ │ -_2_0#define DUNE_EXPORT implementation_defined │ │ │ │ │ +5 │ │ │ │ │ +15#ifndef DUNE_COMMON_STDSTREAMS_HH │ │ │ │ │ +16#define DUNE_COMMON_STDSTREAMS_HH │ │ │ │ │ +17 │ │ │ │ │ +18#include "_d_e_b_u_g_s_t_r_e_a_m_._h_h" │ │ │ │ │ +19 │ │ │ │ │ +20namespace _D_u_n_e { │ │ │ │ │ 21 │ │ │ │ │ -23 │ │ │ │ │ -_2_8#define DUNE_PRIVATE implementation_defined │ │ │ │ │ -29 │ │ │ │ │ -30#else // DOXYGEN │ │ │ │ │ -31 │ │ │ │ │ -32#if __GNUC__ >= 4 │ │ │ │ │ -33// GCC and Clang both define __GNUC__ to 4 and they both support the │ │ │ │ │ -visibility │ │ │ │ │ -34// attribute │ │ │ │ │ -35#define DUNE_EXPORT __attribute__((visibility("default"))) │ │ │ │ │ -36#define DUNE_PRIVATE __attribute__((visibility("hidden"))) │ │ │ │ │ -37#else │ │ │ │ │ -38// We don't know about the active compiler, so just turn the visibility │ │ │ │ │ -macros to no-ops. │ │ │ │ │ -39#define DUNE_EXPORT │ │ │ │ │ -40#define DUNE_PRIVATE │ │ │ │ │ -41#endif │ │ │ │ │ -42 │ │ │ │ │ -43#endif // DOXYGEN │ │ │ │ │ -44 │ │ │ │ │ -45#endif // DUNE_COMMON_VISIBILITY │ │ │ │ │ +66#ifndef DUNE_MINIMAL_DEBUG_LEVEL │ │ │ │ │ +_6_7#define DUNE_MINIMAL_DEBUG_LEVEL 4 │ │ │ │ │ +68#endif │ │ │ │ │ +_6_9 static const _D_e_b_u_g_L_e_v_e_l _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L = _D_U_N_E___M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L; │ │ │ │ │ +70 │ │ │ │ │ +_7_5 static const _D_e_b_u_g_L_e_v_e_l _V_E_R_Y___V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L = 1; │ │ │ │ │ +76 │ │ │ │ │ +_8_1 typedef _D_e_b_u_g_S_t_r_e_a_m_<_V_E_R_Y___V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L_,_ _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L_> │ │ │ │ │ +_D_V_V_e_r_b_T_y_p_e; │ │ │ │ │ +82 │ │ │ │ │ +_9_5 extern _D_V_V_e_r_b_T_y_p_e _d_v_v_e_r_b; │ │ │ │ │ +96 │ │ │ │ │ +_1_0_1 static const _D_e_b_u_g_L_e_v_e_l _V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L = 2; │ │ │ │ │ +102 │ │ │ │ │ +_1_0_7 typedef _D_e_b_u_g_S_t_r_e_a_m_<_V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L_,_ _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L_> _D_V_e_r_b_T_y_p_e; │ │ │ │ │ +108 │ │ │ │ │ +_1_1_6 extern _D_V_e_r_b_T_y_p_e _d_v_e_r_b; │ │ │ │ │ +117 │ │ │ │ │ +_1_2_2 static const _D_e_b_u_g_L_e_v_e_l _I_N_F_O___D_E_B_U_G___L_E_V_E_L = 3; │ │ │ │ │ +123 │ │ │ │ │ +_1_2_8 typedef _D_e_b_u_g_S_t_r_e_a_m_<_I_N_F_O___D_E_B_U_G___L_E_V_E_L_,_ _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L_> _D_I_n_f_o_T_y_p_e; │ │ │ │ │ +129 │ │ │ │ │ +_1_4_0 extern _D_I_n_f_o_T_y_p_e _d_i_n_f_o; │ │ │ │ │ +141 │ │ │ │ │ +_1_4_6 static const _D_e_b_u_g_L_e_v_e_l _W_A_R_N___D_E_B_U_G___L_E_V_E_L = 4; │ │ │ │ │ +147 │ │ │ │ │ +_1_5_2 typedef _D_e_b_u_g_S_t_r_e_a_m_<_W_A_R_N___D_E_B_U_G___L_E_V_E_L_,_ _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L_> _D_W_a_r_n_T_y_p_e; │ │ │ │ │ +153 │ │ │ │ │ +_1_6_1 extern _D_W_a_r_n_T_y_p_e _d_w_a_r_n; │ │ │ │ │ +162 │ │ │ │ │ +_1_6_7 static const _D_e_b_u_g_L_e_v_e_l _G_R_A_V_E___D_E_B_U_G___L_E_V_E_L = 5; │ │ │ │ │ +168 │ │ │ │ │ +_1_7_0 typedef _D_e_b_u_g_S_t_r_e_a_m_<_G_R_A_V_E___D_E_B_U_G___L_E_V_E_L_,_ _M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L_> _D_G_r_a_v_e_T_y_p_e; │ │ │ │ │ +171 │ │ │ │ │ +_1_7_9 extern _D_G_r_a_v_e_T_y_p_e _d_g_r_a_v_e; │ │ │ │ │ +180 │ │ │ │ │ +_1_8_2 typedef _D_e_b_u_g_S_t_r_e_a_m_<_1_> _D_E_r_r_T_y_p_e; │ │ │ │ │ +183 │ │ │ │ │ +_1_9_5 extern _D_E_r_r_T_y_p_e _d_e_r_r; │ │ │ │ │ +196 │ │ │ │ │ +198} │ │ │ │ │ +199 │ │ │ │ │ +200#endif │ │ │ │ │ +_d_e_b_u_g_s_t_r_e_a_m_._h_h │ │ │ │ │ +Defines several output streams for messages of different importance. │ │ │ │ │ +_D_u_n_e_:_:_D_e_b_u_g_L_e_v_e_l │ │ │ │ │ +unsigned int DebugLevel │ │ │ │ │ +Type for debug levels. │ │ │ │ │ +DDeeffiinniittiioonn debugstream.hh:118 │ │ │ │ │ +_D_u_n_e_:_:_D_V_V_e_r_b_T_y_p_e │ │ │ │ │ +DebugStream< VERY_VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVVerbType │ │ │ │ │ +Type of very verbose debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_D_W_a_r_n_T_y_p_e │ │ │ │ │ +DebugStream< WARN_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DWarnType │ │ │ │ │ +Type of debug stream with warn level. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:152 │ │ │ │ │ +_D_u_n_e_:_:_d_v_v_e_r_b │ │ │ │ │ +DVVerbType dvverb(std::cout) │ │ │ │ │ +stream for very verbose output. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +static const DebugLevel MINIMAL_DEBUG_LEVEL │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:69 │ │ │ │ │ +_D_U_N_E___M_I_N_I_M_A_L___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +#define DUNE_MINIMAL_DEBUG_LEVEL │ │ │ │ │ +The default minimum debug level. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_V_E_R_Y___V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +static const DebugLevel VERY_VERBOSE_DEBUG_LEVEL │ │ │ │ │ +The level of the very verbose debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_d_w_a_r_n │ │ │ │ │ +DWarnType dwarn(std::cerr) │ │ │ │ │ +Stream for warnings indicating problems. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:161 │ │ │ │ │ +_D_u_n_e_:_:_G_R_A_V_E___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +static const DebugLevel GRAVE_DEBUG_LEVEL │ │ │ │ │ +The level of the debug stream for fatal errors. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_D_V_e_r_b_T_y_p_e │ │ │ │ │ +DebugStream< VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVerbType │ │ │ │ │ +Type of more verbose debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:107 │ │ │ │ │ +_D_u_n_e_:_:_D_G_r_a_v_e_T_y_p_e │ │ │ │ │ +DebugStream< GRAVE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DGraveType │ │ │ │ │ +Type of debug stream for fatal errors. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:170 │ │ │ │ │ +_D_u_n_e_:_:_d_g_r_a_v_e │ │ │ │ │ +DGraveType dgrave(std::cerr) │ │ │ │ │ +Stream for warnings indicating fatal errors. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:179 │ │ │ │ │ +_D_u_n_e_:_:_D_E_r_r_T_y_p_e │ │ │ │ │ +DebugStream< 1 > DErrType │ │ │ │ │ +The type of the stream used for error messages. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_I_N_F_O___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +static const DebugLevel INFO_DEBUG_LEVEL │ │ │ │ │ +The level of the informative debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:122 │ │ │ │ │ +_D_u_n_e_:_:_D_I_n_f_o_T_y_p_e │ │ │ │ │ +DebugStream< INFO_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DInfoType │ │ │ │ │ +Type of debug stream with info level. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:128 │ │ │ │ │ +_D_u_n_e_:_:_d_i_n_f_o │ │ │ │ │ +DInfoType dinfo(std::cout) │ │ │ │ │ +Stream for informative output. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_d_v_e_r_b │ │ │ │ │ +DVerbType dverb(std::cout) │ │ │ │ │ +Singleton of verbose debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_V_E_R_B_O_S_E___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +static const DebugLevel VERBOSE_DEBUG_LEVEL │ │ │ │ │ +The level of the verbose debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_d_e_r_r │ │ │ │ │ +DErrType derr(std::cerr) │ │ │ │ │ +Stream for error messages. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_W_A_R_N___D_E_B_U_G___L_E_V_E_L │ │ │ │ │ +static const DebugLevel WARN_DEBUG_LEVEL │ │ │ │ │ +The level of the debug stream for warnings. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:146 │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m │ │ │ │ │ +Generic class to implement debug output streams. │ │ │ │ │ +DDeeffiinniittiioonn debugstream.hh:192 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00032.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: debugstream.hh File Reference │ │ │ │ +dune-common: to_unique_ptr.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,64 +70,44 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Typedefs
│ │ │ │ -
debugstream.hh File Reference
│ │ │ │ +Typedefs | │ │ │ │ +Functions
│ │ │ │ +
to_unique_ptr.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Defines several output streams for messages of different importance. │ │ │ │ -More...

│ │ │ │ -
#include <iostream>
│ │ │ │ -#include <stack>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ +
#include <memory>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

struct  Dune::greater_or_equal< current, threshold >
 Greater or equal template test. More...
 
struct  Dune::common_bits< current, mask >
 activate if current and mask have common bits switched on. More...
 
class  Dune::DebugStreamError
 standard exception for the debugstream More...
 
class  Dune::StreamWrap
 
class  Dune::DebugStreamState
 Intermediate class to implement tie-operation of DebugStream. More...
 
class  Dune::DebugStream< thislevel, dlevel, alevel, activator >
 Generic class to implement debug output streams. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Typedefs

typedef unsigned int Dune::DebugLevel
 Type for debug levels.
 
template<class T >
using Dune::ToUniquePtr = std::unique_ptr< T >
 Alias for std::unique_ptr introduced as transition wrapper.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

template<class T , class... Args>
std::unique_ptr< T > Dune::makeToUnique (Args &&... args)
 Alias for std::make_unique introduced as transition wrapper.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Defines several output streams for messages of different importance.

│ │ │ │ -

This file implements the class DebugStream to support output in a variety of debug levels. Additionally, template parameters control if the output operation is really performed so that unused debug levels can be deactivated

│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,47 +1,27 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -debugstream.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _D_e_b_u_g_ _o_u_t_p_u_t │ │ │ │ │ -Defines several output streams for messages of different importance. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +_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 │ │ │ │ │ +to_unique_ptr.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_:_:_g_r_e_a_t_e_r___o_r___e_q_u_a_l_<_ _c_u_r_r_e_n_t_,_ _t_h_r_e_s_h_o_l_d_ _> │ │ │ │ │ -  Greater or equal template test. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_c_o_m_m_o_n___b_i_t_s_<_ _c_u_r_r_e_n_t_,_ _m_a_s_k_ _> │ │ │ │ │ -  activate if current and mask have common bits switched on. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r │ │ │ │ │ -  standard exception for the debugstream _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_S_t_r_e_a_m_W_r_a_p │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e │ │ │ │ │ -  Intermediate class to implement tie-operation of _D_e_b_u_g_S_t_r_e_a_m. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_<_ _t_h_i_s_l_e_v_e_l_,_ _d_l_e_v_e_l_,_ _a_l_e_v_e_l_,_ _a_c_t_i_v_a_t_o_r_ _> │ │ │ │ │ -  Generic class to implement debug output streams. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ TTyyppeeddeeffss │ │ │ │ │ -typedef unsigned int  _D_u_n_e_:_:_D_e_b_u_g_L_e_v_e_l │ │ │ │ │ -  Type for debug levels. │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_T_o_U_n_i_q_u_e_P_t_r = std::unique_ptr< T > │ │ │ │ │ +  Alias for std::unique_ptr introduced as transition wrapper. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::unique_ptr< T >  _D_u_n_e_:_:_m_a_k_e_T_o_U_n_i_q_u_e (Args &&... args) │ │ │ │ │ +  Alias for std::make_unique introduced as transition │ │ │ │ │ + wrapper. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Defines several output streams for messages of different importance. │ │ │ │ │ -This file implements the class DebugStream to support output in a variety of │ │ │ │ │ -debug levels. Additionally, template parameters control if the output operation │ │ │ │ │ -is really performed so that unused debug levels can be deactivated │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00032_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: debugstream.hh Source File │ │ │ │ +dune-common: to_unique_ptr.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,333 +74,48 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
debugstream.hh
│ │ │ │ +
to_unique_ptr.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │
5
│ │ │ │ -
6#ifndef DUNE_DEBUGSTREAM_HH
│ │ │ │ -
7#define DUNE_DEBUGSTREAM_HH
│ │ │ │ +
6#ifndef DUNE_TO_UNIQUE_PTR_HH
│ │ │ │ +
7#define DUNE_TO_UNIQUE_PTR_HH
│ │ │ │
8
│ │ │ │ -
13#include <iostream>
│ │ │ │ -
14#include <stack>
│ │ │ │ -
15
│ │ │ │ - │ │ │ │ -
17
│ │ │ │ -
18namespace Dune {
│ │ │ │ +
9#warning to_unique_ptr.hh and ToUniquePtr are deprecated. Use std::unique_ptr or std::shared_ptr instead.
│ │ │ │ +
10
│ │ │ │ +
11#include <memory>
│ │ │ │ +
12
│ │ │ │ +
13namespace Dune
│ │ │ │ +
14{
│ │ │ │ +
17 template <class T>
│ │ │ │ +
18 using ToUniquePtr [[deprecated]] = std::unique_ptr<T>;
│ │ │ │
19
│ │ │ │ -
118 typedef unsigned int DebugLevel;
│ │ │ │ -
119
│ │ │ │ -
129 template <DebugLevel current, DebugLevel threshold>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
131 constexpr static bool value = (current >= threshold);
│ │ │ │ -
132 };
│ │ │ │ -
│ │ │ │ -
133
│ │ │ │ -
134
│ │ │ │ -
141 template <DebugLevel current, DebugLevel mask>
│ │ │ │ -
│ │ │ │ -
142 struct common_bits {
│ │ │ │ -
143 constexpr static bool value = ((current & mask) != 0);
│ │ │ │ -
144 };
│ │ │ │ -
│ │ │ │ -
145
│ │ │ │ -
146
│ │ │ │ -
148 class DebugStreamError : public IOError {};
│ │ │ │ -
149
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
151 public:
│ │ │ │ -
152 StreamWrap(std::ostream& _out) : out(_out) { }
│ │ │ │ -
153 std::ostream& out;
│ │ │ │ - │ │ │ │ -
155 };
│ │ │ │ -
│ │ │ │ -
156
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
159 // !!! should be protected somehow but that won't be easy
│ │ │ │ -
160 public:
│ │ │ │ - │ │ │ │ -
163
│ │ │ │ - │ │ │ │ -
166
│ │ │ │ -
168 bool _tied;
│ │ │ │ -
169
│ │ │ │ -
171 unsigned int _tied_streams;
│ │ │ │ -
172 };
│ │ │ │ -
│ │ │ │ -
173
│ │ │ │ -
188 template <DebugLevel thislevel = 1,
│ │ │ │ -
189 DebugLevel dlevel = 1,
│ │ │ │ -
190 DebugLevel alevel = 1,
│ │ │ │ -
191 template<DebugLevel, DebugLevel> class activator = greater_or_equal>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
193 public:
│ │ │ │ -
│ │ │ │ -
199 DebugStream(std::ostream& out = std::cerr) {
│ │ │ │ -
200 // start a new list of streams
│ │ │ │ -
201 current = new StreamWrap(out);
│ │ │ │ -
202 current->next = 0;
│ │ │ │ -
203
│ │ │ │ -
204 // check if we are above the default activation level
│ │ │ │ -
205 _active = activator<thislevel,alevel>::value;
│ │ │ │ -
206
│ │ │ │ -
207 // we're not tied to another DebugStream
│ │ │ │ -
208 _tied = false;
│ │ │ │ -
209
│ │ │ │ -
210 // no child streams yet
│ │ │ │ -
211 _tied_streams = 0;
│ │ │ │ -
212 }
│ │ │ │ -
│ │ │ │ -
213
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
220 std::ostream& fallback = std::cerr)
│ │ │ │ -
221 {
│ │ │ │ -
222 // start a new list of streams
│ │ │ │ -
223 current = new StreamWrap(fallback);
│ │ │ │ -
224 current->next = 0;
│ │ │ │ -
225
│ │ │ │ -
226 // check if we are above the default activation level
│ │ │ │ -
227 _active = activator<thislevel,alevel>::value;
│ │ │ │ -
228 _tied_streams = 0;
│ │ │ │ -
229
│ │ │ │ -
230 // tie to the provided stream
│ │ │ │ -
231 _tied = true;
│ │ │ │ -
232 tiedstate = &master;
│ │ │ │ -
233 tiedstate->_tied_streams++;
│ │ │ │ -
234 }
│ │ │ │ -
│ │ │ │ -
235
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
244 {
│ │ │ │ -
245 // untie
│ │ │ │ -
246 if (_tied)
│ │ │ │ -
247 tiedstate->_tied_streams--;
│ │ │ │ -
248 else {
│ │ │ │ -
249 // check if somebody still ties to us...
│ │ │ │ -
250 if (_tied_streams != 0)
│ │ │ │ -
251 {
│ │ │ │ -
252 std::cerr << "DebugStream destructor is called while other streams are still tied to it. Terminating!" << std::endl;
│ │ │ │ -
253 std::terminate();
│ │ │ │ -
254 }
│ │ │ │ -
255 }
│ │ │ │ -
256
│ │ │ │ -
257 // remove ostream-stack
│ │ │ │ -
258 while (current != 0) {
│ │ │ │ -
259 StreamWrap *s = current;
│ │ │ │ - │ │ │ │ -
261 delete s;
│ │ │ │ -
262 }
│ │ │ │ -
263 }
│ │ │ │ -
│ │ │ │ -
264
│ │ │ │ -
266 template <class T>
│ │ │ │ -
│ │ │ │ -
267 DebugStream& operator<<(const T data) {
│ │ │ │ -
268 // remove the following code if stream wasn't compiled active
│ │ │ │ -
269 if (activator<thislevel, dlevel>::value) {
│ │ │ │ -
270 if (! _tied) {
│ │ │ │ -
271 if (_active)
│ │ │ │ -
272 current->out << data;
│ │ │ │ -
273 } else {
│ │ │ │ -
274 if (_active && tiedstate->_active)
│ │ │ │ -
275 tiedstate->current->out << data;
│ │ │ │ -
276 }
│ │ │ │ -
277 }
│ │ │ │ -
278
│ │ │ │ -
279 return *this;
│ │ │ │ -
280 }
│ │ │ │ -
│ │ │ │ -
281
│ │ │ │ -
│ │ │ │ -
289 DebugStream& operator<<(const int data) {
│ │ │ │ -
290 // remove the following code if stream wasn't compiled active
│ │ │ │ -
291 if (activator<thislevel, dlevel>::value) {
│ │ │ │ -
292 if (! _tied) {
│ │ │ │ -
293 if (_active)
│ │ │ │ -
294 current->out << data;
│ │ │ │ -
295 } else {
│ │ │ │ -
296 if (_active && tiedstate->_active)
│ │ │ │ -
297 tiedstate->current->out << data;
│ │ │ │ -
298 }
│ │ │ │ -
299 }
│ │ │ │ -
300
│ │ │ │ -
301 return *this;
│ │ │ │ -
302 }
│ │ │ │ -
│ │ │ │ -
303
│ │ │ │ -
│ │ │ │ -
305 DebugStream& operator<<(std::ostream& (*f)(std::ostream&)) {
│ │ │ │ -
306 if (activator<thislevel, dlevel>::value) {
│ │ │ │ -
307 if (! _tied) {
│ │ │ │ -
308 if (_active)
│ │ │ │ -
309 f(current->out);
│ │ │ │ -
310 } else {
│ │ │ │ -
311 if (_active && tiedstate->_active)
│ │ │ │ -
312 f(tiedstate->current->out);
│ │ │ │ -
313 }
│ │ │ │ -
314 }
│ │ │ │ -
315
│ │ │ │ -
316 return *this;
│ │ │ │ -
317 }
│ │ │ │ -
│ │ │ │ -
318
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
321 if (activator<thislevel, dlevel>::value) {
│ │ │ │ -
322 if (! _tied) {
│ │ │ │ -
323 if (_active)
│ │ │ │ -
324 current->out.flush();
│ │ │ │ -
325 } else {
│ │ │ │ -
326 if (_active && tiedstate->_active)
│ │ │ │ -
327 tiedstate->current->out.flush();
│ │ │ │ -
328 }
│ │ │ │ -
329 }
│ │ │ │ -
330
│ │ │ │ -
331 return *this;
│ │ │ │ -
332 }
│ │ │ │ -
│ │ │ │ -
333
│ │ │ │ -
│ │ │ │ -
335 void push(bool b) {
│ │ │ │ -
336 // are we at all active?
│ │ │ │ -
337 if (activator<thislevel,alevel>::value) {
│ │ │ │ -
338 _actstack.push(_active);
│ │ │ │ -
339 _active = b;
│ │ │ │ -
340 } else {
│ │ │ │ -
341 // stay off
│ │ │ │ -
342 _actstack.push(false);
│ │ │ │ -
343 }
│ │ │ │ -
344 }
│ │ │ │ -
│ │ │ │ -
345
│ │ │ │ -
│ │ │ │ -
349 void pop() {
│ │ │ │ -
350 if (_actstack.empty())
│ │ │ │ -
351 DUNE_THROW(DebugStreamError, "No previous activation setting!");
│ │ │ │ -
352
│ │ │ │ -
353 _active = _actstack.top();
│ │ │ │ -
354 _actstack.pop();
│ │ │ │ -
355 }
│ │ │ │ -
│ │ │ │ -
356
│ │ │ │ -
│ │ │ │ -
363 bool active() const {
│ │ │ │ -
364 return activator<thislevel, dlevel>::value && _active;
│ │ │ │ -
365 }
│ │ │ │ -
│ │ │ │ -
366
│ │ │ │ -
│ │ │ │ -
371 void attach(std::ostream& stream) {
│ │ │ │ -
372 if (_tied)
│ │ │ │ -
373 DUNE_THROW(DebugStreamError, "Cannot attach to a tied stream!");
│ │ │ │ -
374
│ │ │ │ -
375 StreamWrap* newcurr = new StreamWrap(stream);
│ │ │ │ -
376 newcurr->next = current;
│ │ │ │ -
377 current = newcurr;
│ │ │ │ -
378 }
│ │ │ │ -
│ │ │ │ -
379
│ │ │ │ -
│ │ │ │ -
383 void detach() {
│ │ │ │ -
384 if (current->next == 0)
│ │ │ │ -
385 DUNE_THROW(DebugStreamError, "Cannot detach initial stream!");
│ │ │ │ -
386 if (_tied)
│ │ │ │ -
387 DUNE_THROW(DebugStreamError, "Cannot detach a tied stream!");
│ │ │ │ -
388
│ │ │ │ -
389 StreamWrap* old = current;
│ │ │ │ - │ │ │ │ -
391 delete old;
│ │ │ │ -
392 }
│ │ │ │ -
│ │ │ │ -
393
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
398 if (to._tied)
│ │ │ │ -
399 DUNE_THROW(DebugStreamError, "Cannot tie to an already tied stream!");
│ │ │ │ -
400 if (_tied)
│ │ │ │ -
401 DUNE_THROW(DebugStreamError, "Stream already tied: untie first!");
│ │ │ │ -
402
│ │ │ │ -
403 _tied = true;
│ │ │ │ -
404 tiedstate = &to;
│ │ │ │ -
405
│ │ │ │ -
406 // tell master class
│ │ │ │ -
407 tiedstate->_tied_streams++;
│ │ │ │ -
408 }
│ │ │ │ -
│ │ │ │ -
409
│ │ │ │ -
│ │ │ │ -
413 void untie() {
│ │ │ │ -
414 if(! _tied)
│ │ │ │ -
415 DUNE_THROW(DebugStreamError, "Cannot untie, stream is not tied!");
│ │ │ │ -
416
│ │ │ │ -
417 tiedstate->_tied_streams--;
│ │ │ │ -
418 _tied = false;
│ │ │ │ -
419 tiedstate = 0;
│ │ │ │ -
420 }
│ │ │ │ -
│ │ │ │ -
421
│ │ │ │ -
422 private:
│ │ │ │ -
424 DebugStreamState* tiedstate;
│ │ │ │ -
425
│ │ │ │ -
430 std::stack<bool> _actstack;
│ │ │ │ -
431 };
│ │ │ │ -
│ │ │ │ -
432
│ │ │ │ -
434}
│ │ │ │ -
435
│ │ │ │ -
436
│ │ │ │ -
437#endif
│ │ │ │ -
A few common exception classes.
│ │ │ │ -
StreamWrap(std::ostream &_out)
Definition debugstream.hh:152
│ │ │ │ -
DebugStream(std::ostream &out=std::cerr)
Create a DebugStream and set initial output stream.
Definition debugstream.hh:199
│ │ │ │ -
void untie()
Untie stream.
Definition debugstream.hh:413
│ │ │ │ -
DebugStream & flush()
pass on flush to underlying output stream
Definition debugstream.hh:320
│ │ │ │ -
void attach(std::ostream &stream)
set output to a different stream.
Definition debugstream.hh:371
│ │ │ │ -
void detach()
detach current output stream and restore to previous stream
Definition debugstream.hh:383
│ │ │ │ -
static constexpr bool value
Definition debugstream.hh:143
│ │ │ │ -
std::ostream & out
Definition debugstream.hh:153
│ │ │ │ -
void pop()
restore previously set activation flag
Definition debugstream.hh:349
│ │ │ │ -
bool active() const
reports if this stream will produce output
Definition debugstream.hh:363
│ │ │ │ -
bool _active
flag to switch output during runtime
Definition debugstream.hh:165
│ │ │ │ -
unsigned int _tied_streams
how many streams are tied to this state
Definition debugstream.hh:171
│ │ │ │ -
void tie(DebugStreamState &to)
Tie a stream to this one.
Definition debugstream.hh:397
│ │ │ │ -
void push(bool b)
set activation flag and store old value
Definition debugstream.hh:335
│ │ │ │ -
unsigned int DebugLevel
Type for debug levels.
Definition debugstream.hh:118
│ │ │ │ -
bool _tied
are we tied to another DebugStream?
Definition debugstream.hh:168
│ │ │ │ -
StreamWrap * current
current output stream and link to possibly pushed old output streams
Definition debugstream.hh:162
│ │ │ │ -
DebugStream & operator<<(const T data)
Generic types are passed on to current output stream.
Definition debugstream.hh:267
│ │ │ │ -
static constexpr bool value
Definition debugstream.hh:131
│ │ │ │ -
~DebugStream()
Destroy stream.
Definition debugstream.hh:243
│ │ │ │ -
DebugStream(DebugStreamState &master, std::ostream &fallback=std::cerr)
Create a DebugStream and directly tie to another DebugStream.
Definition debugstream.hh:219
│ │ │ │ -
DebugStream & operator<<(const int data)
explicit specialization so that enums can be printed
Definition debugstream.hh:289
│ │ │ │ -
DebugStream & operator<<(std::ostream &(*f)(std::ostream &))
pass on manipulators to underlying output stream
Definition debugstream.hh:305
│ │ │ │ -
StreamWrap * next
Definition debugstream.hh:154
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
22 template <class T, class... Args>
│ │ │ │ +
│ │ │ │ +
23 [[deprecated]] std::unique_ptr<T> makeToUnique (Args&&... args)
│ │ │ │ +
24 {
│ │ │ │ +
25 return std::make_unique(std::forward<Args>(args)...);
│ │ │ │ +
26 }
│ │ │ │ +
│ │ │ │ +
27
│ │ │ │ +
28} // end namespace Dune
│ │ │ │ +
29
│ │ │ │ +
30#endif // DUNE_TO_UNIQUE_PTR_HH
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Greater or equal template test.
Definition debugstream.hh:130
│ │ │ │ -
activate if current and mask have common bits switched on.
Definition debugstream.hh:142
│ │ │ │ -
standard exception for the debugstream
Definition debugstream.hh:148
│ │ │ │ -
Definition debugstream.hh:150
│ │ │ │ -
Intermediate class to implement tie-operation of DebugStream.
Definition debugstream.hh:158
│ │ │ │ -
Generic class to implement debug output streams.
Definition debugstream.hh:192
│ │ │ │ -
Default exception class for I/O errors.
Definition exceptions.hh:231
│ │ │ │ +
std::unique_ptr< T > makeToUnique(Args &&... args)
Alias for std::make_unique introduced as transition wrapper.
Definition to_unique_ptr.hh:23
│ │ │ │ +
std::unique_ptr< T > ToUniquePtr
Alias for std::unique_ptr introduced as transition wrapper.
Definition to_unique_ptr.hh:18
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,375 +1,49 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -debugstream.hh │ │ │ │ │ +to_unique_ptr.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ 5 │ │ │ │ │ -6#ifndef DUNE_DEBUGSTREAM_HH │ │ │ │ │ -7#define DUNE_DEBUGSTREAM_HH │ │ │ │ │ +6#ifndef DUNE_TO_UNIQUE_PTR_HH │ │ │ │ │ +7#define DUNE_TO_UNIQUE_PTR_HH │ │ │ │ │ 8 │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -17 │ │ │ │ │ -18namespace _D_u_n_e { │ │ │ │ │ +9#warning to_unique_ptr.hh and ToUniquePtr are deprecated. Use std::unique_ptr │ │ │ │ │ +or std::shared_ptr instead. │ │ │ │ │ +10 │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13namespace _D_u_n_e │ │ │ │ │ +14{ │ │ │ │ │ +17 template │ │ │ │ │ +_1_8 using _T_o_U_n_i_q_u_e_P_t_r [[deprecated]] = std::unique_ptr; │ │ │ │ │ 19 │ │ │ │ │ -_1_1_8 typedef unsigned int _D_e_b_u_g_L_e_v_e_l; │ │ │ │ │ -119 │ │ │ │ │ -129 template │ │ │ │ │ -_1_3_0 struct _g_r_e_a_t_e_r___o_r___e_q_u_a_l { │ │ │ │ │ -_1_3_1 constexpr static bool _v_a_l_u_e = (current >= threshold); │ │ │ │ │ -132 }; │ │ │ │ │ -133 │ │ │ │ │ -134 │ │ │ │ │ -141 template │ │ │ │ │ -_1_4_2 struct _c_o_m_m_o_n___b_i_t_s { │ │ │ │ │ -_1_4_3 constexpr static bool _v_a_l_u_e = ((current & mask) != 0); │ │ │ │ │ -144 }; │ │ │ │ │ -145 │ │ │ │ │ -146 │ │ │ │ │ -_1_4_8 class _D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r : public _I_O_E_r_r_o_r {}; │ │ │ │ │ -149 │ │ │ │ │ -_1_5_0 class _S_t_r_e_a_m_W_r_a_p { │ │ │ │ │ -151 public: │ │ │ │ │ -_1_5_2 _S_t_r_e_a_m_W_r_a_p(std::ostream& _out) : _o_u_t(_out) { } │ │ │ │ │ -_1_5_3 std::ostream& _o_u_t; │ │ │ │ │ -_1_5_4 _S_t_r_e_a_m_W_r_a_p *_n_e_x_t; │ │ │ │ │ -155 }; │ │ │ │ │ -156 │ │ │ │ │ -_1_5_8 class _D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e { │ │ │ │ │ -159 // !!! should be protected somehow but that won't be easy │ │ │ │ │ -160 public: │ │ │ │ │ -_1_6_2 _S_t_r_e_a_m_W_r_a_p* _c_u_r_r_e_n_t; │ │ │ │ │ -163 │ │ │ │ │ -_1_6_5 bool ___a_c_t_i_v_e; │ │ │ │ │ -166 │ │ │ │ │ -_1_6_8 bool ___t_i_e_d; │ │ │ │ │ -169 │ │ │ │ │ -_1_7_1 unsigned int ___t_i_e_d___s_t_r_e_a_m_s; │ │ │ │ │ -172 }; │ │ │ │ │ -173 │ │ │ │ │ -188 template <_D_e_b_u_g_L_e_v_e_l thislevel = 1, │ │ │ │ │ -189 _D_e_b_u_g_L_e_v_e_l dlevel = 1, │ │ │ │ │ -190 _D_e_b_u_g_L_e_v_e_l alevel = 1, │ │ │ │ │ -191 template class activator = _g_r_e_a_t_e_r___o_r___e_q_u_a_l> │ │ │ │ │ -_1_9_2 class _D_e_b_u_g_S_t_r_e_a_m : public _D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e { │ │ │ │ │ -193 public: │ │ │ │ │ -_1_9_9 _D_e_b_u_g_S_t_r_e_a_m(std::ostream& out = std::cerr) { │ │ │ │ │ -200 // start a new list of streams │ │ │ │ │ -201 _c_u_r_r_e_n_t = new _S_t_r_e_a_m_W_r_a_p(out); │ │ │ │ │ -202 _c_u_r_r_e_n_t->_n_e_x_t = 0; │ │ │ │ │ -203 │ │ │ │ │ -204 // check if we are above the default activation level │ │ │ │ │ -205 ___a_c_t_i_v_e = activator::value; │ │ │ │ │ -206 │ │ │ │ │ -207 // we're not tied to another DebugStream │ │ │ │ │ -208 ___t_i_e_d = false; │ │ │ │ │ -209 │ │ │ │ │ -210 // no child streams yet │ │ │ │ │ -211 ___t_i_e_d___s_t_r_e_a_m_s = 0; │ │ │ │ │ -212 } │ │ │ │ │ -213 │ │ │ │ │ -_2_1_9 _D_e_b_u_g_S_t_r_e_a_m (_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e& master, │ │ │ │ │ -220 std::ostream& fallback = std::cerr) │ │ │ │ │ -221 { │ │ │ │ │ -222 // start a new list of streams │ │ │ │ │ -223 _c_u_r_r_e_n_t = new _S_t_r_e_a_m_W_r_a_p(fallback); │ │ │ │ │ -224 _c_u_r_r_e_n_t->_n_e_x_t = 0; │ │ │ │ │ -225 │ │ │ │ │ -226 // check if we are above the default activation level │ │ │ │ │ -227 ___a_c_t_i_v_e = activator::value; │ │ │ │ │ -228 ___t_i_e_d___s_t_r_e_a_m_s = 0; │ │ │ │ │ -229 │ │ │ │ │ -230 // tie to the provided stream │ │ │ │ │ -231 ___t_i_e_d = true; │ │ │ │ │ -232 tiedstate = &master; │ │ │ │ │ -233 tiedstate->___t_i_e_d___s_t_r_e_a_m_s++; │ │ │ │ │ -234 } │ │ │ │ │ -235 │ │ │ │ │ -_2_4_3 _~_D_e_b_u_g_S_t_r_e_a_m() │ │ │ │ │ -244 { │ │ │ │ │ -245 // untie │ │ │ │ │ -246 if (___t_i_e_d) │ │ │ │ │ -247 tiedstate->___t_i_e_d___s_t_r_e_a_m_s--; │ │ │ │ │ -248 else { │ │ │ │ │ -249 // check if somebody still ties to us... │ │ │ │ │ -250 if (___t_i_e_d___s_t_r_e_a_m_s != 0) │ │ │ │ │ -251 { │ │ │ │ │ -252 std::cerr << "DebugStream destructor is called while other streams are │ │ │ │ │ -still tied to it. Terminating!" << std::endl; │ │ │ │ │ -253 std::terminate(); │ │ │ │ │ -254 } │ │ │ │ │ -255 } │ │ │ │ │ -256 │ │ │ │ │ -257 // remove ostream-stack │ │ │ │ │ -258 while (_c_u_r_r_e_n_t != 0) { │ │ │ │ │ -259 _S_t_r_e_a_m_W_r_a_p *s = _c_u_r_r_e_n_t; │ │ │ │ │ -260 _c_u_r_r_e_n_t = _c_u_r_r_e_n_t->_n_e_x_t; │ │ │ │ │ -261 delete s; │ │ │ │ │ -262 } │ │ │ │ │ -263 } │ │ │ │ │ -264 │ │ │ │ │ -266 template │ │ │ │ │ -_2_6_7 _D_e_b_u_g_S_t_r_e_a_m& _o_p_e_r_a_t_o_r_<_<(const T data) { │ │ │ │ │ -268 // remove the following code if stream wasn't compiled active │ │ │ │ │ -269 if (activator::value) { │ │ │ │ │ -270 if (! ___t_i_e_d) { │ │ │ │ │ -271 if (___a_c_t_i_v_e) │ │ │ │ │ -272 _c_u_r_r_e_n_t->_o_u_t << data; │ │ │ │ │ -273 } else { │ │ │ │ │ -274 if (___a_c_t_i_v_e && tiedstate->___a_c_t_i_v_e) │ │ │ │ │ -275 tiedstate->_c_u_r_r_e_n_t->_o_u_t << data; │ │ │ │ │ -276 } │ │ │ │ │ -277 } │ │ │ │ │ -278 │ │ │ │ │ -279 return *this; │ │ │ │ │ -280 } │ │ │ │ │ -281 │ │ │ │ │ -_2_8_9 _D_e_b_u_g_S_t_r_e_a_m& _o_p_e_r_a_t_o_r_<_<(const int data) { │ │ │ │ │ -290 // remove the following code if stream wasn't compiled active │ │ │ │ │ -291 if (activator::value) { │ │ │ │ │ -292 if (! ___t_i_e_d) { │ │ │ │ │ -293 if (___a_c_t_i_v_e) │ │ │ │ │ -294 _c_u_r_r_e_n_t->_o_u_t << data; │ │ │ │ │ -295 } else { │ │ │ │ │ -296 if (___a_c_t_i_v_e && tiedstate->___a_c_t_i_v_e) │ │ │ │ │ -297 tiedstate->_c_u_r_r_e_n_t->_o_u_t << data; │ │ │ │ │ -298 } │ │ │ │ │ -299 } │ │ │ │ │ -300 │ │ │ │ │ -301 return *this; │ │ │ │ │ -302 } │ │ │ │ │ -303 │ │ │ │ │ -_3_0_5 _D_e_b_u_g_S_t_r_e_a_m& _o_p_e_r_a_t_o_r_<_<(std::ostream& (*f)(std::ostream&)) { │ │ │ │ │ -306 if (activator::value) { │ │ │ │ │ -307 if (! ___t_i_e_d) { │ │ │ │ │ -308 if (___a_c_t_i_v_e) │ │ │ │ │ -309 f(_c_u_r_r_e_n_t->_o_u_t); │ │ │ │ │ -310 } else { │ │ │ │ │ -311 if (___a_c_t_i_v_e && tiedstate->___a_c_t_i_v_e) │ │ │ │ │ -312 f(tiedstate->_c_u_r_r_e_n_t->_o_u_t); │ │ │ │ │ -313 } │ │ │ │ │ -314 } │ │ │ │ │ -315 │ │ │ │ │ -316 return *this; │ │ │ │ │ -317 } │ │ │ │ │ -318 │ │ │ │ │ -_3_2_0 _D_e_b_u_g_S_t_r_e_a_m& _f_l_u_s_h() { │ │ │ │ │ -321 if (activator::value) { │ │ │ │ │ -322 if (! ___t_i_e_d) { │ │ │ │ │ -323 if (___a_c_t_i_v_e) │ │ │ │ │ -324 _c_u_r_r_e_n_t->_o_u_t.flush(); │ │ │ │ │ -325 } else { │ │ │ │ │ -326 if (___a_c_t_i_v_e && tiedstate->___a_c_t_i_v_e) │ │ │ │ │ -327 tiedstate->_c_u_r_r_e_n_t->_o_u_t.flush(); │ │ │ │ │ -328 } │ │ │ │ │ -329 } │ │ │ │ │ -330 │ │ │ │ │ -331 return *this; │ │ │ │ │ -332 } │ │ │ │ │ -333 │ │ │ │ │ -_3_3_5 void _p_u_s_h(bool b) { │ │ │ │ │ -336 // are we at all active? │ │ │ │ │ -337 if (activator::value) { │ │ │ │ │ -338 _actstack.push(___a_c_t_i_v_e); │ │ │ │ │ -339 ___a_c_t_i_v_e = b; │ │ │ │ │ -340 } else { │ │ │ │ │ -341 // stay off │ │ │ │ │ -342 _actstack.push(false); │ │ │ │ │ -343 } │ │ │ │ │ -344 } │ │ │ │ │ -345 │ │ │ │ │ -_3_4_9 void _p_o_p() { │ │ │ │ │ -350 if (_actstack.empty()) │ │ │ │ │ -351 _D_U_N_E___T_H_R_O_W(_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r, "No previous activation setting!"); │ │ │ │ │ -352 │ │ │ │ │ -353 ___a_c_t_i_v_e = _actstack.top(); │ │ │ │ │ -354 _actstack.pop(); │ │ │ │ │ -355 } │ │ │ │ │ -356 │ │ │ │ │ -_3_6_3 bool _a_c_t_i_v_e() const { │ │ │ │ │ -364 return activator::value && ___a_c_t_i_v_e; │ │ │ │ │ -365 } │ │ │ │ │ -366 │ │ │ │ │ -_3_7_1 void _a_t_t_a_c_h(std::ostream& stream) { │ │ │ │ │ -372 if (___t_i_e_d) │ │ │ │ │ -373 _D_U_N_E___T_H_R_O_W(_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r, "Cannot attach to a tied stream!"); │ │ │ │ │ -374 │ │ │ │ │ -375 _S_t_r_e_a_m_W_r_a_p* newcurr = new _S_t_r_e_a_m_W_r_a_p(stream); │ │ │ │ │ -376 newcurr->_n_e_x_t = _c_u_r_r_e_n_t; │ │ │ │ │ -377 _c_u_r_r_e_n_t = newcurr; │ │ │ │ │ -378 } │ │ │ │ │ -379 │ │ │ │ │ -_3_8_3 void _d_e_t_a_c_h() { │ │ │ │ │ -384 if (_c_u_r_r_e_n_t->_n_e_x_t == 0) │ │ │ │ │ -385 _D_U_N_E___T_H_R_O_W(_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r, "Cannot detach initial stream!"); │ │ │ │ │ -386 if (___t_i_e_d) │ │ │ │ │ -387 _D_U_N_E___T_H_R_O_W(_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r, "Cannot detach a tied stream!"); │ │ │ │ │ -388 │ │ │ │ │ -389 _S_t_r_e_a_m_W_r_a_p* old = _c_u_r_r_e_n_t; │ │ │ │ │ -390 _c_u_r_r_e_n_t = _c_u_r_r_e_n_t->_n_e_x_t; │ │ │ │ │ -391 delete old; │ │ │ │ │ -392 } │ │ │ │ │ -393 │ │ │ │ │ -_3_9_7 void _t_i_e(_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e& to) { │ │ │ │ │ -398 if (to.___t_i_e_d) │ │ │ │ │ -399 _D_U_N_E___T_H_R_O_W(_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r, "Cannot tie to an already tied stream!"); │ │ │ │ │ -400 if (___t_i_e_d) │ │ │ │ │ -401 _D_U_N_E___T_H_R_O_W(_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r, "Stream already tied: untie first!"); │ │ │ │ │ -402 │ │ │ │ │ -403 ___t_i_e_d = true; │ │ │ │ │ -404 tiedstate = &to; │ │ │ │ │ -405 │ │ │ │ │ -406 // tell master class │ │ │ │ │ -407 tiedstate->___t_i_e_d___s_t_r_e_a_m_s++; │ │ │ │ │ -408 } │ │ │ │ │ -409 │ │ │ │ │ -_4_1_3 void _u_n_t_i_e() { │ │ │ │ │ -414 if(! ___t_i_e_d) │ │ │ │ │ -415 _D_U_N_E___T_H_R_O_W(_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r, "Cannot untie, stream is not tied!"); │ │ │ │ │ -416 │ │ │ │ │ -417 tiedstate->___t_i_e_d___s_t_r_e_a_m_s--; │ │ │ │ │ -418 ___t_i_e_d = false; │ │ │ │ │ -419 tiedstate = 0; │ │ │ │ │ -420 } │ │ │ │ │ -421 │ │ │ │ │ -422 private: │ │ │ │ │ -424 _D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e* tiedstate; │ │ │ │ │ -425 │ │ │ │ │ -430 std::stack _actstack; │ │ │ │ │ -431 }; │ │ │ │ │ -432 │ │ │ │ │ -434} │ │ │ │ │ -435 │ │ │ │ │ -436 │ │ │ │ │ -437#endif │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_u_n_e_:_:_S_t_r_e_a_m_W_r_a_p_:_:_S_t_r_e_a_m_W_r_a_p │ │ │ │ │ -StreamWrap(std::ostream &_out) │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:152 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_D_e_b_u_g_S_t_r_e_a_m │ │ │ │ │ -DebugStream(std::ostream &out=std::cerr) │ │ │ │ │ -Create a DebugStream and set initial output stream. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:199 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_u_n_t_i_e │ │ │ │ │ -void untie() │ │ │ │ │ -Untie stream. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:413 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_f_l_u_s_h │ │ │ │ │ -DebugStream & flush() │ │ │ │ │ -pass on flush to underlying output stream │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:320 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_a_t_t_a_c_h │ │ │ │ │ -void attach(std::ostream &stream) │ │ │ │ │ -set output to a different stream. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:371 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_d_e_t_a_c_h │ │ │ │ │ -void detach() │ │ │ │ │ -detach current output stream and restore to previous stream │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:383 │ │ │ │ │ -_D_u_n_e_:_:_c_o_m_m_o_n___b_i_t_s_:_:_v_a_l_u_e │ │ │ │ │ -static constexpr bool value │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_S_t_r_e_a_m_W_r_a_p_:_:_o_u_t │ │ │ │ │ -std::ostream & out │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_p_o_p │ │ │ │ │ -void pop() │ │ │ │ │ -restore previously set activation flag │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:349 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_a_c_t_i_v_e │ │ │ │ │ -bool active() const │ │ │ │ │ -reports if this stream will produce output │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:363 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e_:_:___a_c_t_i_v_e │ │ │ │ │ -bool _active │ │ │ │ │ -flag to switch output during runtime │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:165 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e_:_:___t_i_e_d___s_t_r_e_a_m_s │ │ │ │ │ -unsigned int _tied_streams │ │ │ │ │ -how many streams are tied to this state │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_t_i_e │ │ │ │ │ -void tie(DebugStreamState &to) │ │ │ │ │ -Tie a stream to this one. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:397 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_p_u_s_h │ │ │ │ │ -void push(bool b) │ │ │ │ │ -set activation flag and store old value │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:335 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_L_e_v_e_l │ │ │ │ │ -unsigned int DebugLevel │ │ │ │ │ -Type for debug levels. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e_:_:___t_i_e_d │ │ │ │ │ -bool _tied │ │ │ │ │ -are we tied to another DebugStream? │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:168 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e_:_:_c_u_r_r_e_n_t │ │ │ │ │ -StreamWrap * current │ │ │ │ │ -current output stream and link to possibly pushed old output streams │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:162 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -DebugStream & operator<<(const T data) │ │ │ │ │ -Generic types are passed on to current output stream. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_g_r_e_a_t_e_r___o_r___e_q_u_a_l_:_:_v_a_l_u_e │ │ │ │ │ -static constexpr bool value │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:131 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_~_D_e_b_u_g_S_t_r_e_a_m │ │ │ │ │ -~DebugStream() │ │ │ │ │ -Destroy stream. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:243 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_D_e_b_u_g_S_t_r_e_a_m │ │ │ │ │ -DebugStream(DebugStreamState &master, std::ostream &fallback=std::cerr) │ │ │ │ │ -Create a DebugStream and directly tie to another DebugStream. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:219 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -DebugStream & operator<<(const int data) │ │ │ │ │ -explicit specialization so that enums can be printed │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:289 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -DebugStream & operator<<(std::ostream &(*f)(std::ostream &)) │ │ │ │ │ -pass on manipulators to underlying output stream │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:305 │ │ │ │ │ -_D_u_n_e_:_:_S_t_r_e_a_m_W_r_a_p_:_:_n_e_x_t │ │ │ │ │ -StreamWrap * next │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:154 │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +22 template │ │ │ │ │ +_2_3 [[deprecated]] std::unique_ptr _m_a_k_e_T_o_U_n_i_q_u_e (Args&&... args) │ │ │ │ │ +24 { │ │ │ │ │ +25 return std::make_unique(std::forward(args)...); │ │ │ │ │ +26 } │ │ │ │ │ +27 │ │ │ │ │ +28} // end namespace Dune │ │ │ │ │ +29 │ │ │ │ │ +30#endif // DUNE_TO_UNIQUE_PTR_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_r_e_a_t_e_r___o_r___e_q_u_a_l │ │ │ │ │ -Greater or equal template test. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:130 │ │ │ │ │ -_D_u_n_e_:_:_c_o_m_m_o_n___b_i_t_s │ │ │ │ │ -activate if current and mask have common bits switched on. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_E_r_r_o_r │ │ │ │ │ -standard exception for the debugstream │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:148 │ │ │ │ │ -_D_u_n_e_:_:_S_t_r_e_a_m_W_r_a_p │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m_S_t_a_t_e │ │ │ │ │ -Intermediate class to implement tie-operation of DebugStream. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:158 │ │ │ │ │ -_D_u_n_e_:_:_D_e_b_u_g_S_t_r_e_a_m │ │ │ │ │ -Generic class to implement debug output streams. │ │ │ │ │ -DDeeffiinniittiioonn debugstream.hh:192 │ │ │ │ │ -_D_u_n_e_:_:_I_O_E_r_r_o_r │ │ │ │ │ -Default exception class for I/O errors. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:231 │ │ │ │ │ +_D_u_n_e_:_:_m_a_k_e_T_o_U_n_i_q_u_e │ │ │ │ │ +std::unique_ptr< T > makeToUnique(Args &&... args) │ │ │ │ │ +Alias for std::make_unique introduced as transition wrapper. │ │ │ │ │ +DDeeffiinniittiioonn to_unique_ptr.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_T_o_U_n_i_q_u_e_P_t_r │ │ │ │ │ +std::unique_ptr< T > ToUniquePtr │ │ │ │ │ +Alias for std::unique_ptr introduced as transition wrapper. │ │ │ │ │ +DDeeffiinniittiioonn to_unique_ptr.hh:18 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00035.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: matrixconcepts.hh File Reference │ │ │ │ +dune-common: bitsetvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,30 +70,60 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces
│ │ │ │ -
matrixconcepts.hh File Reference
│ │ │ │ +
bitsetvector.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <utility>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/std/type_traits.hh>
│ │ │ │ + │ │ │ │ +

Efficient implementation of a dynamic array of static arrays of booleans. │ │ │ │ +More...

│ │ │ │ +
#include <vector>
│ │ │ │ +#include <bitset>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <dune/common/boundschecking.hh>
│ │ │ │ +#include <dune/common/genericiterator.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::BitSetVectorConstReference< block_size, Alloc >
 A proxy class that acts as a const reference to a single bitset in a BitSetVector. More...
 
class  Dune::BitSetVectorReference< block_size, Alloc >
 A proxy class that acts as a mutable reference to a single bitset in a BitSetVector. More...
 
struct  Dune::const_reference< BitSetVectorReference< block_size, Alloc > >
 
struct  Dune::const_reference< BitSetVectorConstReference< block_size, Alloc > >
 
struct  Dune::mutable_reference< BitSetVectorReference< block_size, Alloc > >
 
struct  Dune::mutable_reference< BitSetVectorConstReference< block_size, Alloc > >
 
class  Dune::BitSetVector< block_size, Allocator >
 A dynamic array of blocks of booleans. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ +

Efficient implementation of a dynamic array of static arrays of booleans.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,18 +1,48 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -matrixconcepts.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +bitsetvector.hh File Reference │ │ │ │ │ +Efficient implementation of a dynamic array of static arrays of booleans. │ │ │ │ │ +_M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_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_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _> │ │ │ │ │ +  A proxy class that acts as a const reference to a single bitset in a │ │ │ │ │ + _B_i_t_S_e_t_V_e_c_t_o_r. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _> │ │ │ │ │ +  A proxy class that acts as a mutable reference to a single bitset in a │ │ │ │ │ + _B_i_t_S_e_t_V_e_c_t_o_r. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _> │ │ │ │ │ + _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c │ │ │ │ │ + _>_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ +  A dynamic array of blocks of booleans. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Efficient implementation of a dynamic array of static arrays of booleans. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00035_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: matrixconcepts.hh Source File │ │ │ │ +dune-common: bitsetvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,109 +74,787 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
matrixconcepts.hh
│ │ │ │ +
bitsetvector.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_MATRIXCONCEPTS_HH
│ │ │ │ -
6#define DUNE_COMMON_MATRIXCONCEPTS_HH
│ │ │ │ +
5#ifndef DUNE_BLOCK_BITFIELD_HH
│ │ │ │ +
6#define DUNE_BLOCK_BITFIELD_HH
│ │ │ │
7
│ │ │ │ -
8
│ │ │ │ -
9
│ │ │ │ -
10#include <utility>
│ │ │ │ -
11#include <type_traits>
│ │ │ │ -
12
│ │ │ │ - │ │ │ │ -
14
│ │ │ │ -
15
│ │ │ │ +
12#include <vector>
│ │ │ │ +
13#include <bitset>
│ │ │ │ +
14#include <iostream>
│ │ │ │ +
15#include <algorithm>
│ │ │ │
16
│ │ │ │ -
17namespace Dune {
│ │ │ │ -
18
│ │ │ │ -
19 template<class, int, int>
│ │ │ │ -
20 class FieldMatrix;
│ │ │ │ -
21
│ │ │ │ -
22 template<class>
│ │ │ │ -
23 class DynamicMatrix;
│ │ │ │ -
24
│ │ │ │ -
25}
│ │ │ │ -
26
│ │ │ │ -
27namespace Dune::Impl {
│ │ │ │ -
28
│ │ │ │ -
29
│ │ │ │ -
30 // Some traits for checking matrix concepts. Currently these are
│ │ │ │ -
31 // all technical internal helpers that just serve different headers
│ │ │ │ -
32 // to do internal checks and are thus collected here.
│ │ │ │ -
33
│ │ │ │ -
34 template<class T>
│ │ │ │ -
35 using IsMatrixHelper = std::void_t<decltype(std::declval<T>().N(), std::declval<T>().M())>;
│ │ │ │ -
36
│ │ │ │ -
37 template<class T>
│ │ │ │ -
38 struct IsMatrix : public Dune::Std::is_detected<IsMatrixHelper, T> {};
│ │ │ │ -
39
│ │ │ │ -
40 // Check if T is a matrix by checking for member functions N() and M().
│ │ │ │ -
41 template<class T>
│ │ │ │ -
42 constexpr bool IsMatrix_v = Impl::IsMatrix<T>::value;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
20
│ │ │ │ +
21namespace Dune {
│ │ │ │ +
22
│ │ │ │ +
23 template <int block_size, class Alloc> class BitSetVector;
│ │ │ │ +
24 template <int block_size, class Alloc> class BitSetVectorReference;
│ │ │ │ +
25
│ │ │ │ +
36 template <int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
38 {
│ │ │ │ +
39 protected:
│ │ │ │ +
40
│ │ │ │ + │ │ │ │ +
42 friend class Dune::BitSetVector<block_size, Alloc>;
│ │ │ │
43
│ │ │ │ -
44
│ │ │ │ -
45
│ │ │ │ -
46 template<class T>
│ │ │ │ -
47 using IsStaticSizeMatrixHelper = std::void_t<decltype(T::rows, T::cols)>;
│ │ │ │ -
48
│ │ │ │ -
49 template<class T>
│ │ │ │ -
50 struct IsStaticSizeMatrix : public Dune::Std::is_detected<IsStaticSizeMatrixHelper, T> {};
│ │ │ │ -
51
│ │ │ │ -
52 // Check if T is a statically sized matrix by checking for static members rows and cols.
│ │ │ │ -
53 template<class T>
│ │ │ │ -
54 constexpr bool IsStaticSizeMatrix_v = Impl::IsStaticSizeMatrix<T>::value;
│ │ │ │ +
│ │ │ │ +
44 BitSetVectorConstReference(const BitSetVector& blockBitField_, int block_number_) :
│ │ │ │ +
45 blockBitField(blockBitField_),
│ │ │ │ +
46 block_number(block_number_)
│ │ │ │ +
47 {
│ │ │ │ +
48 DUNE_ASSERT_BOUNDS(blockBitField_.size() > static_cast<size_t>(block_number_));
│ │ │ │ +
49 }
│ │ │ │ +
│ │ │ │ +
50
│ │ │ │ + │ │ │ │ +
53
│ │ │ │ +
54 public:
│ │ │ │
55
│ │ │ │ -
56
│ │ │ │ +
56 typedef std::bitset<block_size> bitset;
│ │ │ │
57
│ │ │ │ -
58 template<class T>
│ │ │ │ -
59 class IsFieldMatrix : public std::false_type {};
│ │ │ │ -
60
│ │ │ │ -
61 template< class K, int ROWS, int COLS>
│ │ │ │ -
62 class IsFieldMatrix<Dune::FieldMatrix<K, ROWS, COLS>> : public std::true_type {};
│ │ │ │ -
63
│ │ │ │ -
64 // Check if T is an instance of FieldMatrix
│ │ │ │ -
65 template<class T>
│ │ │ │ -
66 constexpr bool IsFieldMatrix_v = Impl::IsFieldMatrix<T>::value;
│ │ │ │ -
67
│ │ │ │ -
68
│ │ │ │ -
69
│ │ │ │ -
70 template<class T>
│ │ │ │ -
71 class IsDenseMatrix : public std::false_type {};
│ │ │ │ -
72
│ │ │ │ -
73 template<class K, int ROWS, int COLS>
│ │ │ │ -
74 class IsDenseMatrix<Dune::FieldMatrix<K, ROWS, COLS>> : public std::true_type {};
│ │ │ │ -
75
│ │ │ │ -
76 template<class K>
│ │ │ │ -
77 class IsDenseMatrix<Dune::DynamicMatrix<K>> : public std::true_type {};
│ │ │ │ +
58 // bitset interface typedefs
│ │ │ │ +
59 typedef typename std::vector<bool, Alloc>::const_reference reference;
│ │ │ │ +
60 typedef typename std::vector<bool, Alloc>::const_reference const_reference;
│ │ │ │ +
61 typedef size_t size_type;
│ │ │ │ +
62
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
65 {
│ │ │ │ +
66 bitset b = *this;
│ │ │ │ +
67 b <<= n;
│ │ │ │ +
68 return b;
│ │ │ │ +
69 }
│ │ │ │ +
│ │ │ │ +
70
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
73 {
│ │ │ │ +
74 bitset b = *this;
│ │ │ │ +
75 b >>= n;
│ │ │ │ +
76 return b;
│ │ │ │ +
77 }
│ │ │ │ +
│ │ │ │
78
│ │ │ │ -
79 // Check if T is a dense matrix. This is implemented by specialization.
│ │ │ │ -
80 template<class T>
│ │ │ │ -
81 constexpr bool IsDenseMatrix_v = Impl::IsDenseMatrix<T>::value;
│ │ │ │ -
82
│ │ │ │ -
83
│ │ │ │ -
84
│ │ │ │ -
85} // namespace Dune::Impl
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
81 {
│ │ │ │ +
82 bitset b = *this;
│ │ │ │ +
83 b.flip();
│ │ │ │ +
84 return b;
│ │ │ │ +
85 }
│ │ │ │ +
│ │ │ │
86
│ │ │ │ -
87
│ │ │ │ -
88
│ │ │ │ -
89#endif // DUNE_COMMON_MATRIXCONCEPTS_HH
│ │ │ │ - │ │ │ │ -
typename detected_or< nonesuch, Op, Args... >::value_t is_detected
Detects whether Op<Args...> is valid.
Definition type_traits.hh:141
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
89 {
│ │ │ │ +
90 return block_size;
│ │ │ │ +
91 }
│ │ │ │ +
│ │ │ │ +
92
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
95 {
│ │ │ │ +
96 size_type n = 0;
│ │ │ │ +
97 for(size_type i=0; i<block_size; ++i)
│ │ │ │ +
98 n += getBit(i);
│ │ │ │ +
99 return n;
│ │ │ │ +
100 }
│ │ │ │ +
│ │ │ │ +
101
│ │ │ │ +
│ │ │ │ +
103 bool any() const
│ │ │ │ +
104 {
│ │ │ │ +
105 return count();
│ │ │ │ +
106 }
│ │ │ │ +
│ │ │ │ +
107
│ │ │ │ +
│ │ │ │ +
109 bool none() const
│ │ │ │ +
110 {
│ │ │ │ +
111 return ! any();
│ │ │ │ +
112 }
│ │ │ │ +
│ │ │ │ +
113
│ │ │ │ +
│ │ │ │ +
115 bool all() const
│ │ │ │ +
116 {
│ │ │ │ +
117 for(size_type i=0; i<block_size; ++i)
│ │ │ │ +
118 if(not test(i))
│ │ │ │ +
119 return false;
│ │ │ │ +
120 return true;
│ │ │ │ +
121 }
│ │ │ │ +
│ │ │ │ +
122
│ │ │ │ +
│ │ │ │ +
124 bool test(size_type n) const
│ │ │ │ +
125 {
│ │ │ │ +
126 return getBit(n);
│ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │ +
128
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
131 {
│ │ │ │ +
132 return getBit(i);
│ │ │ │ +
133 }
│ │ │ │ +
│ │ │ │ +
134
│ │ │ │ +
│ │ │ │ +
136 operator bitset() const
│ │ │ │ +
137 {
│ │ │ │ +
138 return blockBitField.getRepr(block_number);
│ │ │ │ +
139 }
│ │ │ │ +
│ │ │ │ +
140
│ │ │ │ +
│ │ │ │ +
142 bool operator== (const bitset& bs) const
│ │ │ │ +
143 {
│ │ │ │ +
144 return equals(bs);
│ │ │ │ +
145 }
│ │ │ │ +
│ │ │ │ +
146
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
149 {
│ │ │ │ +
150 return equals(bs);
│ │ │ │ +
151 }
│ │ │ │ +
│ │ │ │ +
152
│ │ │ │ +
│ │ │ │ +
154 bool operator!= (const bitset& bs) const
│ │ │ │ +
155 {
│ │ │ │ +
156 return ! equals(bs);
│ │ │ │ +
157 }
│ │ │ │ +
│ │ │ │ +
158
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
161 {
│ │ │ │ +
162 return ! equals(bs);
│ │ │ │ +
163 }
│ │ │ │ +
│ │ │ │ +
164
│ │ │ │ +
│ │ │ │ +
171 friend std::ostream& operator<< (std::ostream& s, const BitSetVectorConstReference& v)
│ │ │ │ +
172 {
│ │ │ │ +
173 s << "(";
│ │ │ │ +
174 for(int i=0; i<block_size; ++i)
│ │ │ │ +
175 s << v[i];
│ │ │ │ +
176 s << ")";
│ │ │ │ +
177 return s;
│ │ │ │ +
178 }
│ │ │ │ +
│ │ │ │ +
179
│ │ │ │ +
180 protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
183
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
185 {
│ │ │ │ +
186 return blockBitField.getBit(block_number,i);
│ │ │ │ +
187 }
│ │ │ │ +
│ │ │ │ +
188
│ │ │ │ +
189 template<class BS>
│ │ │ │ +
│ │ │ │ +
190 bool equals(const BS & bs) const
│ │ │ │ +
191 {
│ │ │ │ +
192 bool eq = true;
│ │ │ │ +
193 for(int i=0; i<block_size; ++i)
│ │ │ │ +
194 eq &= (getBit(i) == bs[i]);
│ │ │ │ +
195 return eq;
│ │ │ │ +
196 }
│ │ │ │ +
│ │ │ │ +
197
│ │ │ │ +
198 private:
│ │ │ │ +
203 void operator & () = delete;
│ │ │ │ +
204
│ │ │ │ +
205 friend class BitSetVectorReference<block_size, Alloc>;
│ │ │ │ +
206 };
│ │ │ │ +
│ │ │ │ +
207
│ │ │ │ +
220 template <int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ +
221 class BitSetVectorReference : public BitSetVectorConstReference<block_size,Alloc>
│ │ │ │ +
222 {
│ │ │ │ +
223 protected:
│ │ │ │ +
224
│ │ │ │ + │ │ │ │ +
226 friend class Dune::BitSetVector<block_size, Alloc>;
│ │ │ │ +
227
│ │ │ │ + │ │ │ │ +
229
│ │ │ │ +
│ │ │ │ +
230 BitSetVectorReference(BitSetVector& blockBitField_, int block_number_) :
│ │ │ │ +
231 BitSetVectorConstReference(blockBitField_, block_number_),
│ │ │ │ +
232 blockBitField(blockBitField_)
│ │ │ │ +
233 {}
│ │ │ │ +
│ │ │ │ +
234
│ │ │ │ +
235 public:
│ │ │ │ +
236 typedef std::bitset<block_size> bitset;
│ │ │ │ +
237
│ │ │ │ +
241 typedef typename std::vector<bool, Alloc>::reference reference;
│ │ │ │ +
243 typedef typename std::vector<bool, Alloc>::const_reference const_reference;
│ │ │ │ +
245
│ │ │ │ +
247 typedef size_t size_type;
│ │ │ │ +
248
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
251 {
│ │ │ │ +
252 for(int i=0; i<block_size; ++i)
│ │ │ │ +
253 getBit(i) = b;
│ │ │ │ +
254 return (*this);
│ │ │ │ +
255 }
│ │ │ │ +
│ │ │ │ +
256
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
259 {
│ │ │ │ +
260 for(int i=0; i<block_size; ++i)
│ │ │ │ +
261 getBit(i) = b.test(i);
│ │ │ │ +
262 return (*this);
│ │ │ │ +
263 }
│ │ │ │ +
│ │ │ │ +
264
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
267 {
│ │ │ │ +
268 for(int i=0; i<block_size; ++i)
│ │ │ │ +
269 getBit(i) = b.test(i);
│ │ │ │ +
270 return (*this);
│ │ │ │ +
271 }
│ │ │ │ +
│ │ │ │ +
272
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
275 {
│ │ │ │ +
276 for(int i=0; i<block_size; ++i)
│ │ │ │ +
277 getBit(i) = b.test(i);
│ │ │ │ +
278 return (*this);
│ │ │ │ +
279 }
│ │ │ │ +
│ │ │ │ +
280
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
283 {
│ │ │ │ +
284 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
285 getBit(i) = (test(i) & x.test(i));
│ │ │ │ +
286 return *this;
│ │ │ │ +
287 }
│ │ │ │ +
│ │ │ │ +
288
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
291 {
│ │ │ │ +
292 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
293 getBit(i) = (test(i) & x.test(i));
│ │ │ │ +
294 return *this;
│ │ │ │ +
295 }
│ │ │ │ +
│ │ │ │ +
296
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
299 {
│ │ │ │ +
300 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
301 getBit(i) = (test(i) | x.test(i));
│ │ │ │ +
302 return *this;
│ │ │ │ +
303 }
│ │ │ │ +
│ │ │ │ +
304
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
307 {
│ │ │ │ +
308 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
309 getBit(i) = (test(i) | x.test(i));
│ │ │ │ +
310 return *this;
│ │ │ │ +
311 }
│ │ │ │ +
│ │ │ │ +
312
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
315 {
│ │ │ │ +
316 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
317 getBit(i) = (test(i) ^ x.test(i));
│ │ │ │ +
318 return *this;
│ │ │ │ +
319 }
│ │ │ │ +
│ │ │ │ +
320
│ │ │ │ +
321 private:
│ │ │ │ +
322
│ │ │ │ +
323 // For some reason, the following variant of operator^= triggers an ICE or a hanging
│ │ │ │ +
324 // compiler on Debian 9 with GCC 6.3 and full optimizations enabled (-O3).
│ │ │ │ +
325 // The only way to reliably avoid the issue is by making sure that the compiler does not
│ │ │ │ +
326 // see the XOR in the context of the function, so here is a little helper that will normally
│ │ │ │ +
327 // be inlined, but not on the broken compiler. This incurs a substantial overhead (a function
│ │ │ │ +
328 // call), but until someone else has a better idea, it's the only way to make it work reliably.
│ │ │ │ +
329
│ │ │ │ +
330 static bool xor_helper(bool a, bool b)
│ │ │ │ +
331#if defined(__GNUC__) && ! defined(__clang__) && __GNUC__ == 6 && __GNUC_MINOR__ == 3 && __cplusplus \
│ │ │ │ +
332 == 201402L
│ │ │ │ +
333 __attribute__((noinline))
│ │ │ │ +
334#endif
│ │ │ │ +
335 ;
│ │ │ │ +
336
│ │ │ │ +
337 public:
│ │ │ │ +
338
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
341 {
│ │ │ │ +
342 // This uses the helper from above to hoist the actual XOR computation out of the function for
│ │ │ │ +
343 // the buggy version of GCC.
│ │ │ │ +
344 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
345 getBit(i) = xor_helper(test(i),x.test(i));
│ │ │ │ +
346 return *this;
│ │ │ │ +
347 }
│ │ │ │ +
│ │ │ │ +
348
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
351 {
│ │ │ │ +
352 for (size_type i=0; i<block_size-n; i++)
│ │ │ │ +
353 getBit(i) = test(i+n);
│ │ │ │ +
354 return *this;
│ │ │ │ +
355 }
│ │ │ │ +
│ │ │ │ +
356
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
359 {
│ │ │ │ +
360 for (size_type i=0; i<block_size-n; i++)
│ │ │ │ +
361 getBit(i+n) = test(i);
│ │ │ │ +
362 return *this;
│ │ │ │ +
363 }
│ │ │ │ +
│ │ │ │ +
364
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
367 {
│ │ │ │ +
368 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
369 set(i);
│ │ │ │ +
370 return *this;
│ │ │ │ +
371 }
│ │ │ │ +
│ │ │ │ +
372
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
375 {
│ │ │ │ +
376 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
377 flip(i);
│ │ │ │ +
378 return *this;
│ │ │ │ +
379 }
│ │ │ │ +
│ │ │ │ +
380
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
383 {
│ │ │ │ +
384 *this = false;
│ │ │ │ +
385 return *this;
│ │ │ │ +
386 }
│ │ │ │ +
│ │ │ │ +
387
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
390 {
│ │ │ │ +
391 getBit(n) = val;
│ │ │ │ +
392 return *this;
│ │ │ │ +
393 }
│ │ │ │ +
│ │ │ │ +
394
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
397 {
│ │ │ │ +
398 set(n, false);
│ │ │ │ +
399 return *this;
│ │ │ │ +
400 }
│ │ │ │ +
│ │ │ │ +
401
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
404 {
│ │ │ │ +
405 getBit(n).flip();
│ │ │ │ +
406 return *this;
│ │ │ │ +
407 }
│ │ │ │ +
│ │ │ │ +
408
│ │ │ │ + │ │ │ │ +
410 using BitSetVectorConstReference::operator[];
│ │ │ │ +
411
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
414 {
│ │ │ │ +
415 return getBit(i);
│ │ │ │ +
416 }
│ │ │ │ +
│ │ │ │ +
417
│ │ │ │ +
418 protected:
│ │ │ │ + │ │ │ │ +
420
│ │ │ │ + │ │ │ │ +
422
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
424 {
│ │ │ │ +
425 return blockBitField.getBit(this->block_number,i);
│ │ │ │ +
426 }
│ │ │ │ +
│ │ │ │ +
427 };
│ │ │ │ +
│ │ │ │ +
428
│ │ │ │ +
429 // implementation of helper - I put it into the template to avoid having
│ │ │ │ +
430 // to compile it in a dedicated compilation unit
│ │ │ │ +
431 template<int block_size, class Alloc>
│ │ │ │ +
432 bool BitSetVectorReference<block_size,Alloc>::xor_helper(bool a, bool b)
│ │ │ │ +
433 {
│ │ │ │ +
434 return a ^ b;
│ │ │ │ +
435 }
│ │ │ │ +
436
│ │ │ │ +
440 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ +
441 struct const_reference< BitSetVectorReference<block_size,Alloc> >
│ │ │ │ +
442 {
│ │ │ │ + │ │ │ │ +
444 };
│ │ │ │ +
│ │ │ │ +
445
│ │ │ │ +
446 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ +
447 struct const_reference< BitSetVectorConstReference<block_size,Alloc> >
│ │ │ │ +
448 {
│ │ │ │ + │ │ │ │ +
450 };
│ │ │ │ +
│ │ │ │ +
451
│ │ │ │ +
452 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ +
453 struct mutable_reference< BitSetVectorReference<block_size,Alloc> >
│ │ │ │ +
454 {
│ │ │ │ + │ │ │ │ +
456 };
│ │ │ │ +
│ │ │ │ +
457
│ │ │ │ +
458 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
460 {
│ │ │ │ + │ │ │ │ +
462 };
│ │ │ │ +
│ │ │ │ +
463
│ │ │ │ +
467 template <int block_size, class Allocator=std::allocator<bool> >
│ │ │ │ +
│ │ │ │ +
468 class BitSetVector : private std::vector<bool, Allocator>
│ │ │ │ +
469 {
│ │ │ │ +
471 typedef std::vector<bool, Allocator> BlocklessBaseClass;
│ │ │ │ +
472
│ │ │ │ +
473 public:
│ │ │ │ +
476
│ │ │ │ +
478 typedef std::bitset<block_size> value_type;
│ │ │ │ +
479
│ │ │ │ + │ │ │ │ +
482
│ │ │ │ + │ │ │ │ +
485
│ │ │ │ + │ │ │ │ +
488
│ │ │ │ + │ │ │ │ +
491
│ │ │ │ +
493 typedef typename std::vector<bool, Allocator>::size_type size_type;
│ │ │ │ +
494
│ │ │ │ +
496 typedef Allocator allocator_type;
│ │ │ │ +
498
│ │ │ │ + │ │ │ │ + │ │ │ │ +
504
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
507 return iterator(*this, 0);
│ │ │ │ +
508 }
│ │ │ │ +
│ │ │ │ +
509
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
512 return const_iterator(*this, 0);
│ │ │ │ +
513 }
│ │ │ │ +
│ │ │ │ +
514
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
517 return iterator(*this, size());
│ │ │ │ +
518 }
│ │ │ │ +
│ │ │ │ +
519
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
522 return const_iterator(*this, size());
│ │ │ │ +
523 }
│ │ │ │ +
│ │ │ │ +
524
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
527 BlocklessBaseClass()
│ │ │ │ +
528 {}
│ │ │ │ +
│ │ │ │ +
529
│ │ │ │ +
│ │ │ │ +
531 BitSetVector(const BlocklessBaseClass& blocklessBitField) :
│ │ │ │ +
532 BlocklessBaseClass(blocklessBitField)
│ │ │ │ +
533 {
│ │ │ │ +
534 if (blocklessBitField.size()%block_size != 0)
│ │ │ │ +
535 DUNE_THROW(RangeError, "Vector size is not a multiple of the block size!");
│ │ │ │ +
536 }
│ │ │ │ +
│ │ │ │ +
537
│ │ │ │ +
│ │ │ │ +
541 explicit BitSetVector(int n) :
│ │ │ │ +
542 BlocklessBaseClass(n*block_size)
│ │ │ │ +
543 {}
│ │ │ │ +
│ │ │ │ +
544
│ │ │ │ +
│ │ │ │ +
546 BitSetVector(int n, bool v) :
│ │ │ │ +
547 BlocklessBaseClass(n*block_size,v)
│ │ │ │ +
548 {}
│ │ │ │ +
│ │ │ │ +
549
│ │ │ │ +
│ │ │ │ +
551 void clear()
│ │ │ │ +
552 {
│ │ │ │ +
553 BlocklessBaseClass::clear();
│ │ │ │ +
554 }
│ │ │ │ +
│ │ │ │ +
555
│ │ │ │ +
│ │ │ │ +
557 void resize(int n, bool v = bool())
│ │ │ │ +
558 {
│ │ │ │ +
559 BlocklessBaseClass::resize(n*block_size, v);
│ │ │ │ +
560 }
│ │ │ │ +
│ │ │ │ +
561
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
564 {
│ │ │ │ +
565 return BlocklessBaseClass::size()/block_size;
│ │ │ │ +
566 }
│ │ │ │ +
│ │ │ │ +
567
│ │ │ │ +
│ │ │ │ +
569 void setAll() {
│ │ │ │ +
570 this->assign(BlocklessBaseClass::size(), true);
│ │ │ │ +
571 }
│ │ │ │ +
│ │ │ │ +
572
│ │ │ │ +
│ │ │ │ +
574 void unsetAll() {
│ │ │ │ +
575 this->assign(BlocklessBaseClass::size(), false);
│ │ │ │ +
576 }
│ │ │ │ +
│ │ │ │ +
577
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
580 {
│ │ │ │ +
581 return reference(*this, i);
│ │ │ │ +
582 }
│ │ │ │ +
│ │ │ │ +
583
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
586 {
│ │ │ │ +
587 return const_reference(*this, i);
│ │ │ │ +
588 }
│ │ │ │ +
│ │ │ │ +
589
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
592 {
│ │ │ │ +
593 return reference(*this, size()-1);
│ │ │ │ +
594 }
│ │ │ │ +
│ │ │ │ +
595
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
598 {
│ │ │ │ +
599 return const_reference(*this, size()-1);
│ │ │ │ +
600 }
│ │ │ │ +
│ │ │ │ +
601
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
604 {
│ │ │ │ +
605 return std::count(BlocklessBaseClass::begin(), BlocklessBaseClass::end(), true);
│ │ │ │ +
606 }
│ │ │ │ +
│ │ │ │ +
607
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
610 {
│ │ │ │ +
611 size_type n = 0;
│ │ │ │ +
612 size_type blocks = size();
│ │ │ │ +
613 for(size_type i=0; i<blocks; ++i)
│ │ │ │ +
614 n += getBit(i,j);
│ │ │ │ +
615 return n;
│ │ │ │ +
616 }
│ │ │ │ +
│ │ │ │ +
617
│ │ │ │ +
│ │ │ │ +
619 friend std::ostream& operator<< (std::ostream& s, const BitSetVector& v)
│ │ │ │ +
620 {
│ │ │ │ +
621 for (size_t i=0; i<v.size(); i++)
│ │ │ │ +
622 s << v[i] << " ";
│ │ │ │ +
623 return s;
│ │ │ │ +
624 }
│ │ │ │ +
│ │ │ │ +
625
│ │ │ │ +
626 private:
│ │ │ │ +
627
│ │ │ │ +
629 value_type getRepr(int i) const
│ │ │ │ +
630 {
│ │ │ │ +
631 value_type bits;
│ │ │ │ +
632 for(int j=0; j<block_size; ++j)
│ │ │ │ +
633 bits.set(j, getBit(i,j));
│ │ │ │ +
634 return bits;
│ │ │ │ +
635 }
│ │ │ │ +
636
│ │ │ │ +
637 typename std::vector<bool>::reference getBit(size_type i, size_type j) {
│ │ │ │ +
638 DUNE_ASSERT_BOUNDS(j < block_size);
│ │ │ │ + │ │ │ │ +
640 return BlocklessBaseClass::operator[](i*block_size+j);
│ │ │ │ +
641 }
│ │ │ │ +
642
│ │ │ │ +
643 typename std::vector<bool>::const_reference getBit(size_type i, size_type j) const {
│ │ │ │ +
644 DUNE_ASSERT_BOUNDS(j < block_size);
│ │ │ │ + │ │ │ │ +
646 return BlocklessBaseClass::operator[](i*block_size+j);
│ │ │ │ +
647 }
│ │ │ │ +
648
│ │ │ │ +
649 friend class BitSetVectorReference<block_size,Allocator>;
│ │ │ │ +
650 friend class BitSetVectorConstReference<block_size,Allocator>;
│ │ │ │ +
651 };
│ │ │ │ +
│ │ │ │ +
652
│ │ │ │ +
653} // namespace Dune
│ │ │ │ +
654
│ │ │ │ +
655#endif
│ │ │ │ +
Macro for wrapping boundary checks.
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
Implements a generic iterator class for writing stl conformant iterators.
│ │ │ │ +
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition boundschecking.hh:30
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
void assign(T &dst, const T &src, bool mask)
masked Simd assignment (scalar version)
Definition simd.hh:447
│ │ │ │ +
A dynamic array of blocks of booleans.
Definition bitsetvector.hh:469
│ │ │ │ +
const_reference operator[](int i) const
Return const reference to i-th block.
Definition bitsetvector.hh:585
│ │ │ │ +
iterator begin()
Returns a iterator pointing to the beginning of the vector.
Definition bitsetvector.hh:506
│ │ │ │ +
BitSetVectorConstReference< block_size, Allocator > * const_pointer
Const pointer to a small block of bits.
Definition bitsetvector.hh:490
│ │ │ │ +
const_iterator end() const
Returns a const_iterator pointing to the end of the vector.
Definition bitsetvector.hh:521
│ │ │ │ +
BitSetVectorReference< block_size, Allocator > reference
Reference to a small block of bits.
Definition bitsetvector.hh:481
│ │ │ │ +
size_type countmasked(int j) const
Returns the number of set bits, while each block is masked with 1<<i.
Definition bitsetvector.hh:609
│ │ │ │ +
BitSetVectorConstReference< block_size, Allocator > const_reference
Const reference to a small block of bits.
Definition bitsetvector.hh:484
│ │ │ │ +
iterator end()
Returns an iterator pointing to the end of the vector.
Definition bitsetvector.hh:516
│ │ │ │ +
size_type count() const
Returns the number of bits that are set.
Definition bitsetvector.hh:603
│ │ │ │ +
BitSetVector()
Default constructor.
Definition bitsetvector.hh:526
│ │ │ │ +
void setAll()
Sets all entries to true
Definition bitsetvector.hh:569
│ │ │ │ +
Dune::GenericIterator< const BitSetVector< block_size, Allocator >, const value_type, const_reference, std::ptrdiff_t, ForwardIteratorFacade > const_iterator
Definition bitsetvector.hh:502
│ │ │ │ +
std::bitset< block_size > value_type
Type of the values stored by the container.
Definition bitsetvector.hh:478
│ │ │ │ +
reference back()
Return reference to last block.
Definition bitsetvector.hh:591
│ │ │ │ +
BitSetVector(const BlocklessBaseClass &blocklessBitField)
Construction from an unblocked bitfield.
Definition bitsetvector.hh:531
│ │ │ │ +
friend std::ostream & operator<<(std::ostream &s, const BitSetVector &v)
Send bitfield to an output stream.
Definition bitsetvector.hh:619
│ │ │ │ +
const_reference back() const
Return const reference to last block.
Definition bitsetvector.hh:597
│ │ │ │ +
void clear()
Erases all of the elements.
Definition bitsetvector.hh:551
│ │ │ │ +
BitSetVectorReference< block_size, Allocator > * pointer
Pointer to a small block of bits.
Definition bitsetvector.hh:487
│ │ │ │ +
reference operator[](int i)
Return reference to i-th block.
Definition bitsetvector.hh:579
│ │ │ │ +
size_type size() const
Return the number of blocks.
Definition bitsetvector.hh:563
│ │ │ │ +
std::vector< bool, Allocator >::size_type size_type
size type
Definition bitsetvector.hh:493
│ │ │ │ +
BitSetVector(int n, bool v)
Constructor which initializes the field with true or false.
Definition bitsetvector.hh:546
│ │ │ │ +
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the vector.
Definition bitsetvector.hh:511
│ │ │ │ +
Dune::GenericIterator< BitSetVector< block_size, Allocator >, value_type, reference, std::ptrdiff_t, ForwardIteratorFacade > iterator
Definition bitsetvector.hh:501
│ │ │ │ +
void resize(int n, bool v=bool())
Resize field.
Definition bitsetvector.hh:557
│ │ │ │ +
Allocator allocator_type
The type of the allocator.
Definition bitsetvector.hh:496
│ │ │ │ +
BitSetVector(int n)
Definition bitsetvector.hh:541
│ │ │ │ +
void unsetAll()
Sets all entries to false
Definition bitsetvector.hh:574
│ │ │ │ +
A proxy class that acts as a mutable reference to a single bitset in a BitSetVector.
Definition bitsetvector.hh:222
│ │ │ │ +
bool test(size_type n) const
Returns true if bit n is set.
Definition bitsetvector.hh:124
│ │ │ │ +
BitSetVectorReference & operator=(const BitSetVectorConstReference &b)
Assignment from BitSetVectorConstReference.
Definition bitsetvector.hh:266
│ │ │ │ +
reference operator[](size_type i)
Return reference to the i-th bit.
Definition bitsetvector.hh:413
│ │ │ │ +
BitSetVectorReference & reset(size_type n)
Clears bit n.
Definition bitsetvector.hh:396
│ │ │ │ +
BitSetVectorReference & operator<<=(size_type n)
Left shift.
Definition bitsetvector.hh:350
│ │ │ │ +
Dune::BitSetVector< block_size, Alloc > BitSetVector
Definition bitsetvector.hh:225
│ │ │ │ +
std::vector< bool, Alloc >::const_reference const_reference
A proxy class that acts as a const reference to a single bit.
Definition bitsetvector.hh:243
│ │ │ │ +
BitSetVectorReference & operator=(const BitSetVectorReference &b)
Assignment from BitSetVectorReference.
Definition bitsetvector.hh:274
│ │ │ │ +
reference getBit(size_type i)
Definition bitsetvector.hh:423
│ │ │ │ +
BitSetVectorReference & operator&=(const BitSetVectorConstReference &x)
Bitwise and (for BitSetVectorConstReference and BitSetVectorReference)
Definition bitsetvector.hh:290
│ │ │ │ +
BitSetVectorReference(BitSetVector &blockBitField_, int block_number_)
Definition bitsetvector.hh:230
│ │ │ │ +
size_t size_type
size_type typedef (an unsigned integral type)
Definition bitsetvector.hh:247
│ │ │ │ +
BitSetVectorReference & operator=(const bitset &b)
Assignment from bitset.
Definition bitsetvector.hh:258
│ │ │ │ +
Dune::BitSetVectorConstReference< block_size, Alloc > BitSetVectorConstReference
Definition bitsetvector.hh:228
│ │ │ │ +
BitSetVectorReference & reset()
Clears every bit.
Definition bitsetvector.hh:382
│ │ │ │ +
BitSetVector & blockBitField
Definition bitsetvector.hh:419
│ │ │ │ +
BitSetVectorReference & operator|=(const BitSetVectorConstReference &x)
Bitwise inclusive or (for BitSetVectorConstReference and BitSetVectorReference)
Definition bitsetvector.hh:306
│ │ │ │ +
BitSetVectorReference & set(size_type n, int val=1)
Sets bit n if val is nonzero, and clears bit n if val is zero.
Definition bitsetvector.hh:389
│ │ │ │ +
std::bitset< block_size > bitset
Definition bitsetvector.hh:236
│ │ │ │ +
BitSetVectorReference & operator^=(const bitset &x)
Bitwise exclusive or (for bitset).
Definition bitsetvector.hh:314
│ │ │ │ +
std::vector< bool, Alloc >::reference reference
Definition bitsetvector.hh:241
│ │ │ │ +
BitSetVectorReference & operator|=(const bitset &x)
Bitwise inclusive or (for bitset)
Definition bitsetvector.hh:298
│ │ │ │ +
BitSetVectorReference & operator>>=(size_type n)
Right shift.
Definition bitsetvector.hh:358
│ │ │ │ +
BitSetVectorReference & operator^=(const BitSetVectorConstReference &x)
Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference)
Definition bitsetvector.hh:340
│ │ │ │ +
BitSetVectorReference & flip(size_type n)
Flips bit n.
Definition bitsetvector.hh:403
│ │ │ │ +
BitSetVectorReference & flip()
Flips the value of every bit.
Definition bitsetvector.hh:374
│ │ │ │ +
BitSetVectorReference & set()
Sets every bit.
Definition bitsetvector.hh:366
│ │ │ │ +
BitSetVectorReference & operator&=(const bitset &x)
Bitwise and (for bitset).
Definition bitsetvector.hh:282
│ │ │ │ +
BitSetVectorReference & operator=(bool b)
Assignment from bool, sets each bit in the bitset to b.
Definition bitsetvector.hh:250
│ │ │ │ +
A proxy class that acts as a const reference to a single bitset in a BitSetVector.
Definition bitsetvector.hh:38
│ │ │ │ +
bool operator==(const bitset &bs) const
Equality of reference and std::bitset.
Definition bitsetvector.hh:142
│ │ │ │ +
bool test(size_type n) const
Returns true if bit n is set.
Definition bitsetvector.hh:124
│ │ │ │ +
const_reference operator[](size_type i) const
Return reference to the i-th bit.
Definition bitsetvector.hh:130
│ │ │ │ +
bitset operator<<(size_type n) const
Returns a copy of *this shifted left by n bits.
Definition bitsetvector.hh:64
│ │ │ │ +
BitSetVectorConstReference & operator=(const BitSetVectorConstReference &b)
hide assignment operator
│ │ │ │ +
BitSetVectorConstReference(const BitSetVector &blockBitField_, int block_number_)
Definition bitsetvector.hh:44
│ │ │ │ +
const BitSetVector & blockBitField
Definition bitsetvector.hh:181
│ │ │ │ +
bitset operator>>(size_type n) const
Returns a copy of *this shifted right by n bits.
Definition bitsetvector.hh:72
│ │ │ │ +
const_reference getBit(size_type i) const
Definition bitsetvector.hh:184
│ │ │ │ +
bool operator!=(const bitset &bs) const
Inequality of reference and std::bitset.
Definition bitsetvector.hh:154
│ │ │ │ +
bool equals(const BS &bs) const
Definition bitsetvector.hh:190
│ │ │ │ +
Dune::BitSetVector< block_size, Alloc > BitSetVector
Definition bitsetvector.hh:41
│ │ │ │ +
std::bitset< block_size > bitset
Definition bitsetvector.hh:56
│ │ │ │ +
bool all() const
Returns true if all bits are set.
Definition bitsetvector.hh:115
│ │ │ │ +
size_t size_type
Definition bitsetvector.hh:61
│ │ │ │ +
bitset operator~() const
Returns a copy of *this with all of its bits flipped.
Definition bitsetvector.hh:80
│ │ │ │ +
std::vector< bool, Alloc >::const_reference reference
Definition bitsetvector.hh:59
│ │ │ │ +
size_type size() const
Returns block_size.
Definition bitsetvector.hh:88
│ │ │ │ +
size_type count() const
Returns the number of bits that are set.
Definition bitsetvector.hh:94
│ │ │ │ +
bool none() const
Returns true if no bits are set.
Definition bitsetvector.hh:109
│ │ │ │ +
bool any() const
Returns true if any bits are set.
Definition bitsetvector.hh:103
│ │ │ │ +
int block_number
Definition bitsetvector.hh:182
│ │ │ │ +
std::vector< bool, Alloc >::const_reference const_reference
Definition bitsetvector.hh:60
│ │ │ │ +
friend std::ostream & operator<<(std::ostream &s, const BitSetVectorConstReference &v)
Definition bitsetvector.hh:171
│ │ │ │ +
BitSetVectorConstReference< block_size, Alloc > type
Definition bitsetvector.hh:443
│ │ │ │ +
BitSetVectorConstReference< block_size, Alloc > type
Definition bitsetvector.hh:449
│ │ │ │ +
BitSetVectorReference< block_size, Alloc > type
Definition bitsetvector.hh:455
│ │ │ │ +
BitSetVectorReference< block_size, Alloc > type
Definition bitsetvector.hh:461
│ │ │ │ +
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │ +
Get the 'const' version of a reference to a mutable object.
Definition genericiterator.hh:87
│ │ │ │ +
get the 'mutable' version of a reference to a const object
Definition genericiterator.hh:116
│ │ │ │ +
Generic class for stl-conforming iterators for container classes with operator[].
Definition genericiterator.hh:153
│ │ │ │ +
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:141
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,113 +1,936 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -matrixconcepts.hh │ │ │ │ │ +bitsetvector.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_MATRIXCONCEPTS_HH │ │ │ │ │ -6#define DUNE_COMMON_MATRIXCONCEPTS_HH │ │ │ │ │ +5#ifndef DUNE_BLOCK_BITFIELD_HH │ │ │ │ │ +6#define DUNE_BLOCK_BITFIELD_HH │ │ │ │ │ 7 │ │ │ │ │ -8 │ │ │ │ │ -9 │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12 │ │ │ │ │ -13#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ -14 │ │ │ │ │ -15 │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ 16 │ │ │ │ │ -17namespace _D_u_n_e { │ │ │ │ │ -18 │ │ │ │ │ -19 template │ │ │ │ │ -20 class FieldMatrix; │ │ │ │ │ -21 │ │ │ │ │ -22 template │ │ │ │ │ -23 class DynamicMatrix; │ │ │ │ │ -24 │ │ │ │ │ -25} │ │ │ │ │ -26 │ │ │ │ │ -27namespace Dune::Impl { │ │ │ │ │ -28 │ │ │ │ │ -29 │ │ │ │ │ -30 // Some traits for checking matrix concepts. Currently these are │ │ │ │ │ -31 // all technical internal helpers that just serve different headers │ │ │ │ │ -32 // to do internal checks and are thus collected here. │ │ │ │ │ -33 │ │ │ │ │ -34 template │ │ │ │ │ -35 using IsMatrixHelper = std::void_t().N(), std:: │ │ │ │ │ -declval().M())>; │ │ │ │ │ -36 │ │ │ │ │ -37 template │ │ │ │ │ -38 struct IsMatrix : public _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d {}; │ │ │ │ │ -39 │ │ │ │ │ -40 // Check if T is a matrix by checking for member functions N() and M(). │ │ │ │ │ -41 template │ │ │ │ │ -42 constexpr bool IsMatrix_v = Impl::IsMatrix::value; │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_c_o_m_m_o_n_/_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +20 │ │ │ │ │ +21namespace _D_u_n_e { │ │ │ │ │ +22 │ │ │ │ │ +23 template class BitSetVector; │ │ │ │ │ +24 template class BitSetVectorReference; │ │ │ │ │ +25 │ │ │ │ │ +36 template │ │ │ │ │ +_3_7 class _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e │ │ │ │ │ +38 { │ │ │ │ │ +39 protected: │ │ │ │ │ +40 │ │ │ │ │ +_4_1 typedef _D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_<_b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_> _B_i_t_S_e_t_V_e_c_t_o_r; │ │ │ │ │ +42 friend class _D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r; │ │ │ │ │ 43 │ │ │ │ │ -44 │ │ │ │ │ -45 │ │ │ │ │ -46 template │ │ │ │ │ -47 using IsStaticSizeMatrixHelper = std::void_t; │ │ │ │ │ -48 │ │ │ │ │ -49 template │ │ │ │ │ -50 struct IsStaticSizeMatrix : public _D_u_n_e_:_:_S_t_d_:_: │ │ │ │ │ -_i_s___d_e_t_e_c_t_e_d {}; │ │ │ │ │ -51 │ │ │ │ │ -52 // Check if T is a statically sized matrix by checking for static members │ │ │ │ │ -rows and cols. │ │ │ │ │ -53 template │ │ │ │ │ -54 constexpr bool IsStaticSizeMatrix_v = Impl::IsStaticSizeMatrix::value; │ │ │ │ │ +_4_4 _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e(const _B_i_t_S_e_t_V_e_c_t_o_r& blockBitField_, int │ │ │ │ │ +block_number_) : │ │ │ │ │ +45 _b_l_o_c_k_B_i_t_F_i_e_l_d(blockBitField_), │ │ │ │ │ +46 _b_l_o_c_k___n_u_m_b_e_r(block_number_) │ │ │ │ │ +47 { │ │ │ │ │ +48 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(blockBitField_._s_i_z_e() > static_cast │ │ │ │ │ +(block_number_)); │ │ │ │ │ +49 } │ │ │ │ │ +50 │ │ │ │ │ +_5_2 _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e& _o_p_e_r_a_t_o_r_=(const _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e & b); │ │ │ │ │ +53 │ │ │ │ │ +54 public: │ │ │ │ │ 55 │ │ │ │ │ -56 │ │ │ │ │ +_5_6 typedef std::bitset _b_i_t_s_e_t; │ │ │ │ │ 57 │ │ │ │ │ -58 template │ │ │ │ │ -59 class IsFieldMatrix : public std::false_type {}; │ │ │ │ │ -60 │ │ │ │ │ -61 template< class K, int ROWS, int COLS> │ │ │ │ │ -62 class IsFieldMatrix<_D_u_n_e::FieldMatrix> : public std:: │ │ │ │ │ -true_type {}; │ │ │ │ │ -63 │ │ │ │ │ -64 // Check if T is an instance of FieldMatrix │ │ │ │ │ -65 template │ │ │ │ │ -66 constexpr bool IsFieldMatrix_v = Impl::IsFieldMatrix::value; │ │ │ │ │ -67 │ │ │ │ │ -68 │ │ │ │ │ -69 │ │ │ │ │ -70 template │ │ │ │ │ -71 class IsDenseMatrix : public std::false_type {}; │ │ │ │ │ -72 │ │ │ │ │ -73 template │ │ │ │ │ -74 class IsDenseMatrix<_D_u_n_e::FieldMatrix> : public std:: │ │ │ │ │ -true_type {}; │ │ │ │ │ -75 │ │ │ │ │ -76 template │ │ │ │ │ -77 class IsDenseMatrix<_D_u_n_e::DynamicMatrix> : public std::true_type {}; │ │ │ │ │ +58 // bitset interface typedefs │ │ │ │ │ +_5_9 typedef typename std::vector::const_reference _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_6_0 typedef typename std::vector::const_reference _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_6_1 typedef size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +62 │ │ │ │ │ +_6_4 _b_i_t_s_e_t _o_p_e_r_a_t_o_r_<_<(_s_i_z_e___t_y_p_e n) const │ │ │ │ │ +65 { │ │ │ │ │ +66 _b_i_t_s_e_t b = *this; │ │ │ │ │ +67 b <<= n; │ │ │ │ │ +68 return b; │ │ │ │ │ +69 } │ │ │ │ │ +70 │ │ │ │ │ +_7_2 _b_i_t_s_e_t _o_p_e_r_a_t_o_r_>_>(_s_i_z_e___t_y_p_e n) const │ │ │ │ │ +73 { │ │ │ │ │ +74 _b_i_t_s_e_t b = *this; │ │ │ │ │ +75 b >>= n; │ │ │ │ │ +76 return b; │ │ │ │ │ +77 } │ │ │ │ │ 78 │ │ │ │ │ -79 // Check if T is a dense matrix. This is implemented by specialization. │ │ │ │ │ -80 template │ │ │ │ │ -81 constexpr bool IsDenseMatrix_v = Impl::IsDenseMatrix::value; │ │ │ │ │ -82 │ │ │ │ │ -83 │ │ │ │ │ -84 │ │ │ │ │ -85} // namespace Dune::Impl │ │ │ │ │ +_8_0 _b_i_t_s_e_t _o_p_e_r_a_t_o_r_~() const │ │ │ │ │ +81 { │ │ │ │ │ +82 _b_i_t_s_e_t b = *this; │ │ │ │ │ +83 b.flip(); │ │ │ │ │ +84 return b; │ │ │ │ │ +85 } │ │ │ │ │ 86 │ │ │ │ │ -87 │ │ │ │ │ -88 │ │ │ │ │ -89#endif // DUNE_COMMON_MATRIXCONCEPTS_HH │ │ │ │ │ -_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d │ │ │ │ │ -typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ -Detects whether Op is valid. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:141 │ │ │ │ │ +_8_8 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ +89 { │ │ │ │ │ +90 return block_size; │ │ │ │ │ +91 } │ │ │ │ │ +92 │ │ │ │ │ +_9_4 _s_i_z_e___t_y_p_e _c_o_u_n_t() const │ │ │ │ │ +95 { │ │ │ │ │ +96 _s_i_z_e___t_y_p_e n = 0; │ │ │ │ │ +97 for(_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_1_9_0 bool _e_q_u_a_l_s(const BS & bs) const │ │ │ │ │ +191 { │ │ │ │ │ +192 bool eq = true; │ │ │ │ │ +193 for(int i=0; i; │ │ │ │ │ +206 }; │ │ │ │ │ +207 │ │ │ │ │ +220 template │ │ │ │ │ +_2_2_1 class _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e : public │ │ │ │ │ +_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e │ │ │ │ │ +222 { │ │ │ │ │ +223 protected: │ │ │ │ │ +224 │ │ │ │ │ +_2_2_5 typedef _D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_<_b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_> _B_i_t_S_e_t_V_e_c_t_o_r; │ │ │ │ │ +226 friend class _D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r; │ │ │ │ │ +227 │ │ │ │ │ +_2_2_8 typedef _D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_> │ │ │ │ │ +_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e; │ │ │ │ │ +229 │ │ │ │ │ +_2_3_0 _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e(_B_i_t_S_e_t_V_e_c_t_o_r& blockBitField_, int block_number_) : │ │ │ │ │ +231 _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e(blockBitField_, block_number_), │ │ │ │ │ +232 _b_l_o_c_k_B_i_t_F_i_e_l_d(blockBitField_) │ │ │ │ │ +233 {} │ │ │ │ │ +234 │ │ │ │ │ +235 public: │ │ │ │ │ +_2_3_6 typedef std::bitset _b_i_t_s_e_t; │ │ │ │ │ +237 │ │ │ │ │ +_2_4_1 typedef typename std::vector::reference _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_2_4_3 typedef typename std::vector::const_reference _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +245 │ │ │ │ │ +_2_4_7 typedef size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +248 │ │ │ │ │ +_2_5_0 _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e& _o_p_e_r_a_t_o_r_=(bool b) │ │ │ │ │ +251 { │ │ │ │ │ +252 for(int i=0; i_>_=(_s_i_z_e___t_y_p_e n) │ │ │ │ │ +359 { │ │ │ │ │ +360 for (_s_i_z_e___t_y_p_e i=0; i_b_l_o_c_k___n_u_m_b_e_r,i); │ │ │ │ │ +426 } │ │ │ │ │ +427 }; │ │ │ │ │ +428 │ │ │ │ │ +429 // implementation of helper - I put it into the template to avoid having │ │ │ │ │ +430 // to compile it in a dedicated compilation unit │ │ │ │ │ +431 template │ │ │ │ │ +432 bool BitSetVectorReference::xor_helper(bool a, bool b) │ │ │ │ │ +433 { │ │ │ │ │ +434 return a ^ b; │ │ │ │ │ +435 } │ │ │ │ │ +436 │ │ │ │ │ +440 template │ │ │ │ │ +_4_4_1 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e< _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e > │ │ │ │ │ +442 { │ │ │ │ │ +_4_4_3 typedef _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_> _t_y_p_e; │ │ │ │ │ +444 }; │ │ │ │ │ +445 │ │ │ │ │ +446 template │ │ │ │ │ +_4_4_7 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e< _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e > │ │ │ │ │ +448 { │ │ │ │ │ +_4_4_9 typedef _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_> _t_y_p_e; │ │ │ │ │ +450 }; │ │ │ │ │ +451 │ │ │ │ │ +452 template │ │ │ │ │ +_4_5_3 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e< _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e > │ │ │ │ │ +454 { │ │ │ │ │ +_4_5_5 typedef _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_> _t_y_p_e; │ │ │ │ │ +456 }; │ │ │ │ │ +457 │ │ │ │ │ +458 template │ │ │ │ │ +_4_5_9 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e< _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e > │ │ │ │ │ +460 { │ │ │ │ │ +_4_6_1 typedef _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_> _t_y_p_e; │ │ │ │ │ +462 }; │ │ │ │ │ +463 │ │ │ │ │ +467 template > │ │ │ │ │ +_4_6_8 class _B_i_t_S_e_t_V_e_c_t_o_r : private std::vector │ │ │ │ │ +469 { │ │ │ │ │ +471 typedef std::vector BlocklessBaseClass; │ │ │ │ │ +472 │ │ │ │ │ +473 public: │ │ │ │ │ +476 │ │ │ │ │ +_4_7_8 typedef std::bitset _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +479 │ │ │ │ │ +_4_8_1 typedef _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_a_t_o_r_> _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +482 │ │ │ │ │ +_4_8_4 typedef _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_a_t_o_r_> _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +485 │ │ │ │ │ +_4_8_7 typedef _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_a_t_o_r_>* _p_o_i_n_t_e_r; │ │ │ │ │ +488 │ │ │ │ │ +_4_9_0 typedef _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_a_t_o_r_>* _c_o_n_s_t___p_o_i_n_t_e_r; │ │ │ │ │ +491 │ │ │ │ │ +_4_9_3 typedef typename std::vector::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +494 │ │ │ │ │ +_4_9_6 typedef Allocator _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +498 │ │ │ │ │ +_5_0_1 typedef _D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_<_B_i_t_S_e_t_V_e_c_t_o_r_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_a_t_o_r_>, │ │ │ │ │ +_v_a_l_u_e___t_y_p_e, _r_e_f_e_r_e_n_c_e, std::ptrdiff_t, _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e> _i_t_e_r_a_t_o_r; │ │ │ │ │ +_5_0_2 typedef _D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _B_i_t_S_e_t_V_e_c_t_o_r_<_b_l_o_c_k___s_i_z_e_,_A_l_l_o_c_a_t_o_r_>, │ │ │ │ │ +const _v_a_l_u_e___t_y_p_e, _c_o_n_s_t___r_e_f_e_r_e_n_c_e, std::ptrdiff_t, _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e> │ │ │ │ │ +_c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +504 │ │ │ │ │ +_5_0_6 _i_t_e_r_a_t_o_r _b_e_g_i_n(){ │ │ │ │ │ +507 return _i_t_e_r_a_t_o_r(*this, 0); │ │ │ │ │ +508 } │ │ │ │ │ +509 │ │ │ │ │ +_5_1_1 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const { │ │ │ │ │ +512 return _c_o_n_s_t___i_t_e_r_a_t_o_r(*this, 0); │ │ │ │ │ +513 } │ │ │ │ │ +514 │ │ │ │ │ +_5_1_6 _i_t_e_r_a_t_o_r _e_n_d(){ │ │ │ │ │ +517 return _i_t_e_r_a_t_o_r(*this, _s_i_z_e()); │ │ │ │ │ +518 } │ │ │ │ │ +519 │ │ │ │ │ +_5_2_1 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const { │ │ │ │ │ +522 return _c_o_n_s_t___i_t_e_r_a_t_o_r(*this, _s_i_z_e()); │ │ │ │ │ +523 } │ │ │ │ │ +524 │ │ │ │ │ +_5_2_6 _B_i_t_S_e_t_V_e_c_t_o_r() : │ │ │ │ │ +527 BlocklessBaseClass() │ │ │ │ │ +528 {} │ │ │ │ │ +529 │ │ │ │ │ +_5_3_1 _B_i_t_S_e_t_V_e_c_t_o_r(const BlocklessBaseClass& blocklessBitField) : │ │ │ │ │ +532 BlocklessBaseClass(blocklessBitField) │ │ │ │ │ +533 { │ │ │ │ │ +534 if (blocklessBitField.size()%block_size != 0) │ │ │ │ │ +535 _D_U_N_E___T_H_R_O_W(_R_a_n_g_e_E_r_r_o_r, "Vector size is not a multiple of the block size!"); │ │ │ │ │ +536 } │ │ │ │ │ +537 │ │ │ │ │ +_5_4_1 explicit _B_i_t_S_e_t_V_e_c_t_o_r(int n) : │ │ │ │ │ +542 BlocklessBaseClass(n*block_size) │ │ │ │ │ +543 {} │ │ │ │ │ +544 │ │ │ │ │ +_5_4_6 _B_i_t_S_e_t_V_e_c_t_o_r(int n, bool v) : │ │ │ │ │ +547 BlocklessBaseClass(n*block_size,v) │ │ │ │ │ +548 {} │ │ │ │ │ +549 │ │ │ │ │ +_5_5_1 void _c_l_e_a_r() │ │ │ │ │ +552 { │ │ │ │ │ +553 BlocklessBaseClass::clear(); │ │ │ │ │ +554 } │ │ │ │ │ +555 │ │ │ │ │ +_5_5_7 void _r_e_s_i_z_e(int n, bool v = bool()) │ │ │ │ │ +558 { │ │ │ │ │ +559 BlocklessBaseClass::resize(n*block_size, v); │ │ │ │ │ +560 } │ │ │ │ │ +561 │ │ │ │ │ +_5_6_3 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ +564 { │ │ │ │ │ +565 return BlocklessBaseClass::size()/block_size; │ │ │ │ │ +566 } │ │ │ │ │ +567 │ │ │ │ │ +_5_6_9 void _s_e_t_A_l_l() { │ │ │ │ │ +570 this->_a_s_s_i_g_n(BlocklessBaseClass::size(), true); │ │ │ │ │ +571 } │ │ │ │ │ +572 │ │ │ │ │ +_5_7_4 void _u_n_s_e_t_A_l_l() { │ │ │ │ │ +575 this->_a_s_s_i_g_n(BlocklessBaseClass::size(), false); │ │ │ │ │ +576 } │ │ │ │ │ +577 │ │ │ │ │ +_5_7_9 _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](int i) │ │ │ │ │ +580 { │ │ │ │ │ +581 return _r_e_f_e_r_e_n_c_e(*this, i); │ │ │ │ │ +582 } │ │ │ │ │ +583 │ │ │ │ │ +_5_8_5 _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](int i) const │ │ │ │ │ +586 { │ │ │ │ │ +587 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(*this, i); │ │ │ │ │ +588 } │ │ │ │ │ +589 │ │ │ │ │ +_5_9_1 _r_e_f_e_r_e_n_c_e _b_a_c_k() │ │ │ │ │ +592 { │ │ │ │ │ +593 return _r_e_f_e_r_e_n_c_e(*this, _s_i_z_e()-1); │ │ │ │ │ +594 } │ │ │ │ │ +595 │ │ │ │ │ +_5_9_7 _c_o_n_s_t___r_e_f_e_r_e_n_c_e _b_a_c_k() const │ │ │ │ │ +598 { │ │ │ │ │ +599 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(*this, _s_i_z_e()-1); │ │ │ │ │ +600 } │ │ │ │ │ +601 │ │ │ │ │ +_6_0_3 _s_i_z_e___t_y_p_e _c_o_u_n_t() const │ │ │ │ │ +604 { │ │ │ │ │ +605 return std::count(BlocklessBaseClass::begin(), BlocklessBaseClass::end(), │ │ │ │ │ +true); │ │ │ │ │ +606 } │ │ │ │ │ +607 │ │ │ │ │ +_6_0_9 _s_i_z_e___t_y_p_e _c_o_u_n_t_m_a_s_k_e_d(int j) const │ │ │ │ │ +610 { │ │ │ │ │ +611 _s_i_z_e___t_y_p_e n = 0; │ │ │ │ │ +612 _s_i_z_e___t_y_p_e blocks = _s_i_z_e(); │ │ │ │ │ +613 for(_s_i_z_e___t_y_p_e i=0; i::reference getBit(_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e j) { │ │ │ │ │ +638 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(j < block_size); │ │ │ │ │ +639 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _s_i_z_e()); │ │ │ │ │ +640 return BlocklessBaseClass::operator[](i*block_size+j); │ │ │ │ │ +641 } │ │ │ │ │ +642 │ │ │ │ │ +_6_4_3 typename std::vector::const_reference getBit(_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e │ │ │ │ │ +j) const { │ │ │ │ │ +644 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(j < block_size); │ │ │ │ │ +645 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _s_i_z_e()); │ │ │ │ │ +646 return BlocklessBaseClass::operator[](i*block_size+j); │ │ │ │ │ +647 } │ │ │ │ │ +648 │ │ │ │ │ +649 friend class _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e; │ │ │ │ │ +650 friend class _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e; │ │ │ │ │ +651 }; │ │ │ │ │ +652 │ │ │ │ │ +653} // namespace Dune │ │ │ │ │ +654 │ │ │ │ │ +655#endif │ │ │ │ │ +_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ +Macro for wrapping boundary checks. │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h │ │ │ │ │ +Implements a generic iterator class for writing stl conformant iterators. │ │ │ │ │ +_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ +#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ +If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ +nothing. │ │ │ │ │ +DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_a_s_s_i_g_n │ │ │ │ │ +void assign(T &dst, const T &src, bool mask) │ │ │ │ │ +masked Simd assignment (scalar version) │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:447 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r │ │ │ │ │ +A dynamic array of blocks of booleans. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:469 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +const_reference operator[](int i) const │ │ │ │ │ +Return const reference to i-th block. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:585 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +Returns a iterator pointing to the beginning of the vector. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:506 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ +BitSetVectorConstReference< block_size, Allocator > * const_pointer │ │ │ │ │ +Const pointer to a small block of bits. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:490 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +Returns a const_iterator pointing to the end of the vector. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:521 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +BitSetVectorReference< block_size, Allocator > reference │ │ │ │ │ +Reference to a small block of bits. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:481 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_c_o_u_n_t_m_a_s_k_e_d │ │ │ │ │ +size_type countmasked(int j) const │ │ │ │ │ +Returns the number of set bits, while each block is masked with 1< const_reference │ │ │ │ │ +Const reference to a small block of bits. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:484 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +Returns an iterator pointing to the end of the vector. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:516 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_c_o_u_n_t │ │ │ │ │ +size_type count() const │ │ │ │ │ +Returns the number of bits that are set. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:603 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_B_i_t_S_e_t_V_e_c_t_o_r │ │ │ │ │ +BitSetVector() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:526 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_s_e_t_A_l_l │ │ │ │ │ +void setAll() │ │ │ │ │ +Sets all entries to true │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:569 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +Dune::GenericIterator< const BitSetVector< block_size, Allocator >, const │ │ │ │ │ +value_type, const_reference, std::ptrdiff_t, ForwardIteratorFacade > │ │ │ │ │ +const_iterator │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:502 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +std::bitset< block_size > value_type │ │ │ │ │ +Type of the values stored by the container. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:478 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_b_a_c_k │ │ │ │ │ +reference back() │ │ │ │ │ +Return reference to last block. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:591 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_B_i_t_S_e_t_V_e_c_t_o_r │ │ │ │ │ +BitSetVector(const BlocklessBaseClass &blocklessBitField) │ │ │ │ │ +Construction from an unblocked bitfield. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:531 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +friend std::ostream & operator<<(std::ostream &s, const BitSetVector &v) │ │ │ │ │ +Send bitfield to an output stream. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:619 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_b_a_c_k │ │ │ │ │ +const_reference back() const │ │ │ │ │ +Return const reference to last block. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:597 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +Erases all of the elements. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:551 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ +BitSetVectorReference< block_size, Allocator > * pointer │ │ │ │ │ +Pointer to a small block of bits. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:487 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +reference operator[](int i) │ │ │ │ │ +Return reference to i-th block. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:579 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +Return the number of blocks. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:563 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::vector< bool, Allocator >::size_type size_type │ │ │ │ │ +size type │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:493 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_B_i_t_S_e_t_V_e_c_t_o_r │ │ │ │ │ +BitSetVector(int n, bool v) │ │ │ │ │ +Constructor which initializes the field with true or false. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:546 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +Returns a const_iterator pointing to the beginning of the vector. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:511 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +Dune::GenericIterator< BitSetVector< block_size, Allocator >, value_type, │ │ │ │ │ +reference, std::ptrdiff_t, ForwardIteratorFacade > iterator │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:501 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_r_e_s_i_z_e │ │ │ │ │ +void resize(int n, bool v=bool()) │ │ │ │ │ +Resize field. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:557 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +Allocator allocator_type │ │ │ │ │ +The type of the allocator. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:496 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_B_i_t_S_e_t_V_e_c_t_o_r │ │ │ │ │ +BitSetVector(int n) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:541 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_:_:_u_n_s_e_t_A_l_l │ │ │ │ │ +void unsetAll() │ │ │ │ │ +Sets all entries to false │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:574 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e │ │ │ │ │ +A proxy class that acts as a mutable reference to a single bitset in a │ │ │ │ │ +BitSetVector. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:222 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_t_e_s_t │ │ │ │ │ +bool test(size_type n) const │ │ │ │ │ +Returns true if bit n is set. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:124 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BitSetVectorReference & operator=(const BitSetVectorConstReference &b) │ │ │ │ │ +Assignment from BitSetVectorConstReference. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:266 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +reference operator[](size_type i) │ │ │ │ │ +Return reference to the i-th bit. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:413 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_r_e_s_e_t │ │ │ │ │ +BitSetVectorReference & reset(size_type n) │ │ │ │ │ +Clears bit n. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:396 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_<_<_= │ │ │ │ │ +BitSetVectorReference & operator<<=(size_type n) │ │ │ │ │ +Left shift. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:350 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r │ │ │ │ │ +Dune::BitSetVector< block_size, Alloc > BitSetVector │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:225 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +std::vector< bool, Alloc >::const_reference const_reference │ │ │ │ │ +A proxy class that acts as a const reference to a single bit. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:243 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BitSetVectorReference & operator=(const BitSetVectorReference &b) │ │ │ │ │ +Assignment from BitSetVectorReference. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:274 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_g_e_t_B_i_t │ │ │ │ │ +reference getBit(size_type i) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:423 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_&_= │ │ │ │ │ +BitSetVectorReference & operator&=(const BitSetVectorConstReference &x) │ │ │ │ │ +Bitwise and (for BitSetVectorConstReference and BitSetVectorReference) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:290 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e │ │ │ │ │ +BitSetVectorReference(BitSetVector &blockBitField_, int block_number_) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +size_t size_type │ │ │ │ │ +size_type typedef (an unsigned integral type) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:247 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BitSetVectorReference & operator=(const bitset &b) │ │ │ │ │ +Assignment from bitset. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:258 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e │ │ │ │ │ +Dune::BitSetVectorConstReference< block_size, Alloc > │ │ │ │ │ +BitSetVectorConstReference │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:228 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_r_e_s_e_t │ │ │ │ │ +BitSetVectorReference & reset() │ │ │ │ │ +Clears every bit. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:382 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_b_l_o_c_k_B_i_t_F_i_e_l_d │ │ │ │ │ +BitSetVector & blockBitField │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:419 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_|_= │ │ │ │ │ +BitSetVectorReference & operator|=(const BitSetVectorConstReference &x) │ │ │ │ │ +Bitwise inclusive or (for BitSetVectorConstReference and BitSetVectorReference) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:306 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_s_e_t │ │ │ │ │ +BitSetVectorReference & set(size_type n, int val=1) │ │ │ │ │ +Sets bit n if val is nonzero, and clears bit n if val is zero. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:389 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_b_i_t_s_e_t │ │ │ │ │ +std::bitset< block_size > bitset │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:236 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_^_= │ │ │ │ │ +BitSetVectorReference & operator^=(const bitset &x) │ │ │ │ │ +Bitwise exclusive or (for bitset). │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:314 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +std::vector< bool, Alloc >::reference reference │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:241 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_|_= │ │ │ │ │ +BitSetVectorReference & operator|=(const bitset &x) │ │ │ │ │ +Bitwise inclusive or (for bitset) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:298 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_>_>_= │ │ │ │ │ +BitSetVectorReference & operator>>=(size_type n) │ │ │ │ │ +Right shift. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:358 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_^_= │ │ │ │ │ +BitSetVectorReference & operator^=(const BitSetVectorConstReference &x) │ │ │ │ │ +Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:340 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_f_l_i_p │ │ │ │ │ +BitSetVectorReference & flip(size_type n) │ │ │ │ │ +Flips bit n. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:403 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_f_l_i_p │ │ │ │ │ +BitSetVectorReference & flip() │ │ │ │ │ +Flips the value of every bit. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:374 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_s_e_t │ │ │ │ │ +BitSetVectorReference & set() │ │ │ │ │ +Sets every bit. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:366 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_&_= │ │ │ │ │ +BitSetVectorReference & operator&=(const bitset &x) │ │ │ │ │ +Bitwise and (for bitset). │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BitSetVectorReference & operator=(bool b) │ │ │ │ │ +Assignment from bool, sets each bit in the bitset to b. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e │ │ │ │ │ +A proxy class that acts as a const reference to a single bitset in a │ │ │ │ │ +BitSetVector. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const bitset &bs) const │ │ │ │ │ +Equality of reference and std::bitset. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_t_e_s_t │ │ │ │ │ +bool test(size_type n) const │ │ │ │ │ +Returns true if bit n is set. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:124 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +const_reference operator[](size_type i) const │ │ │ │ │ +Return reference to the i-th bit. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:130 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +bitset operator<<(size_type n) const │ │ │ │ │ +Returns a copy of *this shifted left by n bits. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BitSetVectorConstReference & operator=(const BitSetVectorConstReference &b) │ │ │ │ │ +hide assignment operator │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e │ │ │ │ │ +BitSetVectorConstReference(const BitSetVector &blockBitField_, int │ │ │ │ │ +block_number_) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_b_l_o_c_k_B_i_t_F_i_e_l_d │ │ │ │ │ +const BitSetVector & blockBitField │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:181 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ +bitset operator>>(size_type n) const │ │ │ │ │ +Returns a copy of *this shifted right by n bits. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_g_e_t_B_i_t │ │ │ │ │ +const_reference getBit(size_type i) const │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:184 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const bitset &bs) const │ │ │ │ │ +Inequality of reference and std::bitset. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:154 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const BS &bs) const │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:190 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r │ │ │ │ │ +Dune::BitSetVector< block_size, Alloc > BitSetVector │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_b_i_t_s_e_t │ │ │ │ │ +std::bitset< block_size > bitset │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_a_l_l │ │ │ │ │ +bool all() const │ │ │ │ │ +Returns true if all bits are set. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +size_t size_type │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_~ │ │ │ │ │ +bitset operator~() const │ │ │ │ │ +Returns a copy of *this with all of its bits flipped. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +std::vector< bool, Alloc >::const_reference reference │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +Returns block_size. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_c_o_u_n_t │ │ │ │ │ +size_type count() const │ │ │ │ │ +Returns the number of bits that are set. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_n_o_n_e │ │ │ │ │ +bool none() const │ │ │ │ │ +Returns true if no bits are set. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:109 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_a_n_y │ │ │ │ │ +bool any() const │ │ │ │ │ +Returns true if any bits are set. │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:103 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_b_l_o_c_k___n_u_m_b_e_r │ │ │ │ │ +int block_number │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +std::vector< bool, Alloc >::const_reference const_reference │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +friend std::ostream & operator<<(std::ostream &s, const │ │ │ │ │ +BitSetVectorConstReference &v) │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:171 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +BitSetVectorConstReference< block_size, Alloc > type │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:443 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +BitSetVectorConstReference< block_size, Alloc > type │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +BitSetVectorReference< block_size, Alloc > type │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:455 │ │ │ │ │ +_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _B_i_t_S_e_t_V_e_c_t_o_r_C_o_n_s_t_R_e_f_e_r_e_n_c_e_<_ _b_l_o_c_k___s_i_z_e_,_ _A_l_l_o_c_ _>_ _>_:_: │ │ │ │ │ +_t_y_p_e │ │ │ │ │ +BitSetVectorReference< block_size, Alloc > type │ │ │ │ │ +DDeeffiinniittiioonn bitsetvector.hh:461 │ │ │ │ │ +_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r │ │ │ │ │ +Default exception class for range errors. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:254 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +Get the 'const' version of a reference to a mutable object. │ │ │ │ │ +DDeeffiinniittiioonn genericiterator.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e │ │ │ │ │ +get the 'mutable' version of a reference to a const object │ │ │ │ │ +DDeeffiinniittiioonn genericiterator.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r │ │ │ │ │ +Generic class for stl-conforming iterators for container classes with operator │ │ │ │ │ +[]. │ │ │ │ │ +DDeeffiinniittiioonn genericiterator.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ +Base class for stl conformant forward iterators. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:141 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00038.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: filledarray.hh File Reference │ │ │ │ +dune-common: ios_state.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,42 +70,26 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
filledarray.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
ios_state.cc File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Utility to generate an array with a certain value. │ │ │ │ -More...

│ │ │ │ -
#include <array>
│ │ │ │ -#include <cstddef>
│ │ │ │ -
│ │ │ │ -

Go to the source code of this file.

│ │ │ │ - │ │ │ │ +
#include <dune/common/ios_state.hh>
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<std::size_t n, class T >
constexpr std::array< T, n > Dune::filledArray (const T &t)
 Return an array filled with the provided value.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Utility to generate an array with a certain value.

│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,25 +1,15 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -filledarray.hh File Reference │ │ │ │ │ -Utility to generate an array with a certain value. _M_o_r_e_._._. │ │ │ │ │ -#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_. │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +ios_state.cc File Reference │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_o_s___s_t_a_t_e_._h_h> │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -constexpr std::array< T, n >  _D_u_n_e_:_:_f_i_l_l_e_d_A_r_r_a_y (const T &t) │ │ │ │ │ -  Return an array filled with the provided value. │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Utility to generate an array with a certain value. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00041.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: path.hh File Reference │ │ │ │ +dune-common: lru.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,56 +70,45 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
path.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
lru.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Utilities for handling filesystem paths. │ │ │ │ +

LRU Cache Container, using an STL like interface. │ │ │ │ More...

│ │ │ │ -
#include <string>
│ │ │ │ +
#include <list>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <map>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::lru< Key, Tp, Traits >
 LRU Cache Container. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

std::string Dune::concatPaths (const std::string &base, const std::string &p)
 concatenate two paths
 
std::string Dune::processPath (const std::string &p)
 sanitize a path for further processing
 
bool Dune::pathIndicatesDirectory (const std::string &p)
 check whether the given path indicates that it is a directory
 
std::string Dune::prettyPath (const std::string &p, bool isDirectory)
 pretty print path
 
std::string Dune::prettyPath (const std::string &p)
 pretty print path
 
std::string Dune::relativePath (const std::string &newbase, const std::string &p)
 compute a relative path between two paths
 
│ │ │ │

Detailed Description

│ │ │ │ -

Utilities for handling filesystem paths.

│ │ │ │ -
Author
Jö Fahlke jorri.nosp@m.t@jo.nosp@m.rrit..nosp@m.de
│ │ │ │ +

LRU Cache Container, using an STL like interface.

│ │ │ │ +
Author
Christian Engwer
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,42 +1,29 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -path.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _U_t_i_l_i_t_i_e_s » _F_i_l_e_s_y_s_t_e_m_ _P_a_t_h_s │ │ │ │ │ -Utilities for handling filesystem paths. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +lru.hh File Reference │ │ │ │ │ +LRU Cache Container, using an STL like interface. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_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_:_:_l_r_u_<_ _K_e_y_,_ _T_p_,_ _T_r_a_i_t_s_ _> │ │ │ │ │ +  LRU Cache Container. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -std::string  _D_u_n_e_:_:_c_o_n_c_a_t_P_a_t_h_s (const std::string &base, const std::string &p) │ │ │ │ │ -  concatenate two paths │ │ │ │ │ -  │ │ │ │ │ -std::string  _D_u_n_e_:_:_p_r_o_c_e_s_s_P_a_t_h (const std::string &p) │ │ │ │ │ -  sanitize a path for further processing │ │ │ │ │ -  │ │ │ │ │ - bool  _D_u_n_e_:_:_p_a_t_h_I_n_d_i_c_a_t_e_s_D_i_r_e_c_t_o_r_y (const std::string &p) │ │ │ │ │ -  check whether the given path indicates that it is a directory │ │ │ │ │ -  │ │ │ │ │ -std::string  _D_u_n_e_:_:_p_r_e_t_t_y_P_a_t_h (const std::string &p, bool isDirectory) │ │ │ │ │ -  pretty print path │ │ │ │ │ -  │ │ │ │ │ -std::string  _D_u_n_e_:_:_p_r_e_t_t_y_P_a_t_h (const std::string &p) │ │ │ │ │ -  pretty print path │ │ │ │ │ -  │ │ │ │ │ -std::string  _D_u_n_e_:_:_r_e_l_a_t_i_v_e_P_a_t_h (const std::string &newbase, const std::string │ │ │ │ │ - &p) │ │ │ │ │ -  compute a relative path between two paths │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Utilities for handling filesystem paths. │ │ │ │ │ +LRU Cache Container, using an STL like interface. │ │ │ │ │ Author │ │ │ │ │ - Jö Fahlke _j_o_r_r_i_._n_o_s_p_@_m_._t_@_j_o_._n_o_s_p_@_m_._r_r_i_t_._._n_o_s_p_@_m_._d_e │ │ │ │ │ + Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: path.hh Source File │ │ │ │ +dune-common: lru.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,54 +74,238 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
path.hh
│ │ │ │ +
lru.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_PATH_HH
│ │ │ │ -
6#define DUNE_COMMON_PATH_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_LRU_HH
│ │ │ │ +
6#define DUNE_COMMON_LRU_HH
│ │ │ │
7
│ │ │ │ -
8#include <string>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune {
│ │ │ │ +
8#include <list>
│ │ │ │ +
9#include <utility>
│ │ │ │ +
10#include <map>
│ │ │ │ +
11#include <memory>
│ │ │ │ +
12
│ │ │ │ + │ │ │ │ +
14
│ │ │ │ +
20namespace Dune {
│ │ │ │ +
21
│ │ │ │ +
22 namespace {
│ │ │ │
23
│ │ │ │ -
51 std::string concatPaths(const std::string& base, const std::string& p);
│ │ │ │ -
52
│ │ │ │ -
54
│ │ │ │ -
98 std::string processPath(const std::string& p);
│ │ │ │ -
99
│ │ │ │ -
101
│ │ │ │ -
109 bool pathIndicatesDirectory(const std::string& p);
│ │ │ │ -
110
│ │ │ │ -
112
│ │ │ │ -
151 std::string prettyPath(const std::string& p, bool isDirectory);
│ │ │ │ -
152
│ │ │ │ -
154
│ │ │ │ -
160 std::string prettyPath(const std::string& p);
│ │ │ │ -
161
│ │ │ │ -
163
│ │ │ │ -
179 std::string relativePath(const std::string& newbase, const std::string& p);
│ │ │ │ -
180
│ │ │ │ -
182}
│ │ │ │ -
183
│ │ │ │ -
184#endif // DUNE_COMMON_PATH_HH
│ │ │ │ -
std::string processPath(const std::string &p)
sanitize a path for further processing
Definition path.cc:41
│ │ │ │ -
bool pathIndicatesDirectory(const std::string &p)
check whether the given path indicates that it is a directory
Definition path.cc:115
│ │ │ │ -
std::string prettyPath(const std::string &p, bool isDirectory)
pretty print path
Definition path.cc:126
│ │ │ │ -
std::string relativePath(const std::string &newbase, const std::string &p)
compute a relative path between two paths
Definition path.cc:153
│ │ │ │ -
std::string concatPaths(const std::string &base, const std::string &p)
concatenate two paths
Definition path.cc:32
│ │ │ │ +
24 /*
│ │ │ │ +
25 hide the default traits in an empty namespace
│ │ │ │ +
26 */
│ │ │ │ +
27 template <typename Key, typename Tp,
│ │ │ │ +
28 typename Alloc = std::allocator<Tp> >
│ │ │ │ +
29 struct _lru_default_traits
│ │ │ │ +
30 {
│ │ │ │ +
31 typedef Key key_type;
│ │ │ │ +
32 typedef Alloc allocator;
│ │ │ │ +
33 typedef std::list< std::pair<Key, Tp> > list_type;
│ │ │ │ +
34 typedef typename list_type::iterator iterator;
│ │ │ │ +
35 typedef typename std::less<key_type> cmp;
│ │ │ │ +
36 typedef std::map< key_type, iterator, cmp,
│ │ │ │ +
37 typename std::allocator_traits<allocator>::template rebind_alloc<std::pair<const key_type, iterator> > > map_type;
│ │ │ │ +
38 };
│ │ │ │ +
39
│ │ │ │ +
40 } // end empty namespace
│ │ │ │ +
41
│ │ │ │ +
49 template <typename Key, typename Tp,
│ │ │ │ +
50 typename Traits = _lru_default_traits<Key, Tp> >
│ │ │ │ +
│ │ │ │ +
51 class lru
│ │ │ │ +
52 {
│ │ │ │ +
53 typedef typename Traits::list_type list_type;
│ │ │ │ +
54 typedef typename Traits::map_type map_type;
│ │ │ │ +
55 typedef typename Traits::allocator allocator;
│ │ │ │ +
56 typedef typename map_type::iterator map_iterator;
│ │ │ │ +
57 typedef typename map_type::const_iterator const_map_iterator;
│ │ │ │ +
58
│ │ │ │ +
59 public:
│ │ │ │ +
60 typedef typename Traits::key_type key_type;
│ │ │ │ +
61 typedef typename allocator::value_type value_type;
│ │ │ │ +
62 using pointer = typename allocator::value_type*;
│ │ │ │ +
63 using const_pointer = typename allocator::value_type const*;
│ │ │ │ +
64 using const_reference = typename allocator::value_type const&;
│ │ │ │ +
65 using reference = typename allocator::value_type&;
│ │ │ │ +
66 typedef typename allocator::size_type size_type;
│ │ │ │ +
67 typedef typename list_type::iterator iterator;
│ │ │ │ +
68 typedef typename list_type::const_iterator const_iterator;
│ │ │ │ +
69
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
75 {
│ │ │ │ +
76 return _data.front().second;
│ │ │ │ +
77 }
│ │ │ │ +
│ │ │ │ +
78
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
84 {
│ │ │ │ +
85 return _data.front().second;
│ │ │ │ +
86 }
│ │ │ │ +
│ │ │ │ +
87
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
93 {
│ │ │ │ +
94 return _data.back().second;
│ │ │ │ +
95 }
│ │ │ │ +
│ │ │ │ +
96
│ │ │ │ +
│ │ │ │ +
101 const_reference back ([[maybe_unused]] int i) const
│ │ │ │ +
102 {
│ │ │ │ +
103 return _data.back().second;
│ │ │ │ +
104 }
│ │ │ │ +
│ │ │ │ +
105
│ │ │ │ +
106
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
111 {
│ │ │ │ +
112 key_type k = _data.front().first;
│ │ │ │ +
113 _data.pop_front();
│ │ │ │ +
114 _index.erase(k);
│ │ │ │ +
115 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
119 void pop_back()
│ │ │ │ +
120 {
│ │ │ │ +
121 key_type k = _data.back().first;
│ │ │ │ +
122 _data.pop_back();
│ │ │ │ +
123 _index.erase(k);
│ │ │ │ +
124 }
│ │ │ │ +
│ │ │ │ +
125
│ │ │ │ +
│ │ │ │ +
131 iterator find (const key_type & key)
│ │ │ │ +
132 {
│ │ │ │ +
133 const map_iterator it = _index.find(key);
│ │ │ │ +
134 if (it == _index.end()) return _data.end();
│ │ │ │ +
135 return it->second;
│ │ │ │ +
136 }
│ │ │ │ +
│ │ │ │ +
137
│ │ │ │ +
│ │ │ │ +
143 const_iterator find (const key_type & key) const
│ │ │ │ +
144 {
│ │ │ │ +
145 const map_iterator it = _index.find(key);
│ │ │ │ +
146 if (it == _index.end()) return _data.end();
│ │ │ │ +
147 return it->second;
│ │ │ │ +
148 }
│ │ │ │ +
│ │ │ │ +
149
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
162 {
│ │ │ │ +
163 std::pair<key_type, value_type> x(key, data);
│ │ │ │ +
164 /* insert item as mru */
│ │ │ │ +
165 iterator it = _data.insert(_data.begin(), x);
│ │ │ │ +
166 /* store index */
│ │ │ │ +
167 _index.insert(std::make_pair(key,it));
│ │ │ │ +
168
│ │ │ │ +
169 return it->second;
│ │ │ │ +
170 }
│ │ │ │ +
│ │ │ │ +
171
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
176 {
│ │ │ │ +
177 return touch (key);
│ │ │ │ +
178 }
│ │ │ │ +
│ │ │ │ +
179
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
186 {
│ │ │ │ +
187 /* query _index for iterator */
│ │ │ │ +
188 map_iterator it = _index.find(key);
│ │ │ │ +
189 if (it == _index.end())
│ │ │ │ + │ │ │ │ +
191 "Failed to touch key " << key << ", it is not in the lru container");
│ │ │ │ +
192 /* update _data
│ │ │ │ +
193 move it to the front
│ │ │ │ +
194 */
│ │ │ │ +
195 _data.splice(_data.begin(), _data, it->second);
│ │ │ │ +
196 return it->second->second;
│ │ │ │ +
197 }
│ │ │ │ +
│ │ │ │ +
198
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
203 {
│ │ │ │ +
204 return _data.size();
│ │ │ │ +
205 }
│ │ │ │ +
│ │ │ │ +
206
│ │ │ │ +
│ │ │ │ +
213 void resize(size_type new_size)
│ │ │ │ +
214 {
│ │ │ │ +
215 assert(new_size <= size());
│ │ │ │ +
216
│ │ │ │ +
217 while (new_size < size())
│ │ │ │ +
218 pop_back();
│ │ │ │ +
219 }
│ │ │ │ +
│ │ │ │ +
220
│ │ │ │ +
│ │ │ │ +
224 void clear()
│ │ │ │ +
225 {
│ │ │ │ +
226 _data.clear();
│ │ │ │ +
227 _index.clear();
│ │ │ │ +
228 }
│ │ │ │ +
│ │ │ │ +
229
│ │ │ │ +
230 private:
│ │ │ │ +
231 list_type _data;
│ │ │ │ +
232 map_type _index;
│ │ │ │ +
233
│ │ │ │ +
234 };
│ │ │ │ +
│ │ │ │ +
235
│ │ │ │ +
236} // namespace Dune
│ │ │ │ +
237
│ │ │ │ +
238#endif // DUNE_COMMON_LRU_HH
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │ +
LRU Cache Container.
Definition lru.hh:52
│ │ │ │ +
void pop_back()
Removes the last element.
Definition lru.hh:119
│ │ │ │ +
iterator find(const key_type &key)
Finds the element whose key is k.
Definition lru.hh:131
│ │ │ │ +
reference insert(const key_type &key)
mark data associated with key as most recent
Definition lru.hh:175
│ │ │ │ +
list_type::const_iterator const_iterator
Definition lru.hh:68
│ │ │ │ +
void resize(size_type new_size)
ensure a maximum size of the container
Definition lru.hh:213
│ │ │ │ +
allocator::size_type size_type
Definition lru.hh:66
│ │ │ │ +
list_type::iterator iterator
Definition lru.hh:67
│ │ │ │ +
allocator::value_type value_type
Definition lru.hh:61
│ │ │ │ +
const_reference front() const
Definition lru.hh:83
│ │ │ │ +
typename allocator::value_type const * const_pointer
Definition lru.hh:63
│ │ │ │ +
size_type size() const
Retrieve number of entries in the container.
Definition lru.hh:202
│ │ │ │ +
typename allocator::value_type & reference
Definition lru.hh:65
│ │ │ │ +
reference back()
Definition lru.hh:92
│ │ │ │ +
void pop_front()
Removes the first element.
Definition lru.hh:110
│ │ │ │ +
reference front()
Definition lru.hh:74
│ │ │ │ +
void clear()
Definition lru.hh:224
│ │ │ │ +
reference touch(const key_type &key)
mark data associated with key as most recent
Definition lru.hh:185
│ │ │ │ +
reference insert(const key_type &key, const_reference data)
Insert a value into the container.
Definition lru.hh:161
│ │ │ │ +
typename allocator::value_type * pointer
Definition lru.hh:62
│ │ │ │ +
const_iterator find(const key_type &key) const
Finds the element whose key is k.
Definition lru.hh:143
│ │ │ │ +
typename allocator::value_type const & const_reference
Definition lru.hh:64
│ │ │ │ +
Traits::key_type key_type
Definition lru.hh:60
│ │ │ │ +
const_reference back(int i) const
Definition lru.hh:101
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,65 +1,267 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -path.hh │ │ │ │ │ +lru.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_PATH_HH │ │ │ │ │ -6#define DUNE_COMMON_PATH_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_LRU_HH │ │ │ │ │ +6#define DUNE_COMMON_LRU_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10namespace _D_u_n_e { │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +14 │ │ │ │ │ +20namespace _D_u_n_e { │ │ │ │ │ +21 │ │ │ │ │ +22 namespace { │ │ │ │ │ 23 │ │ │ │ │ -51 std::string _c_o_n_c_a_t_P_a_t_h_s(const std::string& base, const std::string& p); │ │ │ │ │ -52 │ │ │ │ │ -54 │ │ │ │ │ -98 std::string _p_r_o_c_e_s_s_P_a_t_h(const std::string& p); │ │ │ │ │ -99 │ │ │ │ │ -101 │ │ │ │ │ -109 bool _p_a_t_h_I_n_d_i_c_a_t_e_s_D_i_r_e_c_t_o_r_y(const std::string& p); │ │ │ │ │ -110 │ │ │ │ │ -112 │ │ │ │ │ -151 std::string _p_r_e_t_t_y_P_a_t_h(const std::string& p, bool isDirectory); │ │ │ │ │ -152 │ │ │ │ │ -154 │ │ │ │ │ -160 std::string _p_r_e_t_t_y_P_a_t_h(const std::string& p); │ │ │ │ │ -161 │ │ │ │ │ -163 │ │ │ │ │ -179 std::string _r_e_l_a_t_i_v_e_P_a_t_h(const std::string& newbase, const std::string& p); │ │ │ │ │ -180 │ │ │ │ │ -182} │ │ │ │ │ -183 │ │ │ │ │ -184#endif // DUNE_COMMON_PATH_HH │ │ │ │ │ -_D_u_n_e_:_:_p_r_o_c_e_s_s_P_a_t_h │ │ │ │ │ -std::string processPath(const std::string &p) │ │ │ │ │ -sanitize a path for further processing │ │ │ │ │ -DDeeffiinniittiioonn path.cc:41 │ │ │ │ │ -_D_u_n_e_:_:_p_a_t_h_I_n_d_i_c_a_t_e_s_D_i_r_e_c_t_o_r_y │ │ │ │ │ -bool pathIndicatesDirectory(const std::string &p) │ │ │ │ │ -check whether the given path indicates that it is a directory │ │ │ │ │ -DDeeffiinniittiioonn path.cc:115 │ │ │ │ │ -_D_u_n_e_:_:_p_r_e_t_t_y_P_a_t_h │ │ │ │ │ -std::string prettyPath(const std::string &p, bool isDirectory) │ │ │ │ │ -pretty print path │ │ │ │ │ -DDeeffiinniittiioonn path.cc:126 │ │ │ │ │ -_D_u_n_e_:_:_r_e_l_a_t_i_v_e_P_a_t_h │ │ │ │ │ -std::string relativePath(const std::string &newbase, const std::string &p) │ │ │ │ │ -compute a relative path between two paths │ │ │ │ │ -DDeeffiinniittiioonn path.cc:153 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_c_a_t_P_a_t_h_s │ │ │ │ │ -std::string concatPaths(const std::string &base, const std::string &p) │ │ │ │ │ -concatenate two paths │ │ │ │ │ -DDeeffiinniittiioonn path.cc:32 │ │ │ │ │ +24 /* │ │ │ │ │ +25 hide the default traits in an empty namespace │ │ │ │ │ +26 */ │ │ │ │ │ +27 template > │ │ │ │ │ +29 struct _lru_default_traits │ │ │ │ │ +30 { │ │ │ │ │ +31 typedef Key key_type; │ │ │ │ │ +32 typedef Alloc allocator; │ │ │ │ │ +33 typedef std::list< std::pair > list_type; │ │ │ │ │ +34 typedef typename list_type::iterator iterator; │ │ │ │ │ +35 typedef typename std::less cmp; │ │ │ │ │ +36 typedef std::map< key_type, iterator, cmp, │ │ │ │ │ +37 typename std::allocator_traits::template rebind_alloc > > map_type; │ │ │ │ │ +38 }; │ │ │ │ │ +39 │ │ │ │ │ +40 } // end empty namespace │ │ │ │ │ +41 │ │ │ │ │ +49 template > │ │ │ │ │ +_5_1 class _l_r_u │ │ │ │ │ +52 { │ │ │ │ │ +53 typedef typename Traits::list_type list_type; │ │ │ │ │ +54 typedef typename Traits::map_type map_type; │ │ │ │ │ +55 typedef typename Traits::allocator allocator; │ │ │ │ │ +56 typedef typename map_type::iterator map_iterator; │ │ │ │ │ +57 typedef typename map_type::const_iterator const_map_iterator; │ │ │ │ │ +58 │ │ │ │ │ +59 public: │ │ │ │ │ +_6_0 typedef typename Traits::key_type _k_e_y___t_y_p_e; │ │ │ │ │ +_6_1 typedef typename allocator::value_type _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_6_2 using _p_o_i_n_t_e_r = typename allocator::value_type*; │ │ │ │ │ +_6_3 using _c_o_n_s_t___p_o_i_n_t_e_r = typename allocator::value_type const*; │ │ │ │ │ +_6_4 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = typename allocator::value_type const&; │ │ │ │ │ +_6_5 using _r_e_f_e_r_e_n_c_e = typename allocator::value_type&; │ │ │ │ │ +_6_6 typedef typename allocator::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +_6_7 typedef typename list_type::iterator _i_t_e_r_a_t_o_r; │ │ │ │ │ +_6_8 typedef typename list_type::const_iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +69 │ │ │ │ │ +_7_4 _r_e_f_e_r_e_n_c_e _f_r_o_n_t() │ │ │ │ │ +75 { │ │ │ │ │ +76 return _data.front().second; │ │ │ │ │ +77 } │ │ │ │ │ +78 │ │ │ │ │ +_8_3 _c_o_n_s_t___r_e_f_e_r_e_n_c_e _f_r_o_n_t() const │ │ │ │ │ +84 { │ │ │ │ │ +85 return _data.front().second; │ │ │ │ │ +86 } │ │ │ │ │ +87 │ │ │ │ │ +_9_2 _r_e_f_e_r_e_n_c_e _b_a_c_k() │ │ │ │ │ +93 { │ │ │ │ │ +94 return _data.back().second; │ │ │ │ │ +95 } │ │ │ │ │ +96 │ │ │ │ │ +_1_0_1 _c_o_n_s_t___r_e_f_e_r_e_n_c_e _b_a_c_k ([[maybe_unused]] int i) const │ │ │ │ │ +102 { │ │ │ │ │ +103 return _data.back().second; │ │ │ │ │ +104 } │ │ │ │ │ +105 │ │ │ │ │ +106 │ │ │ │ │ +_1_1_0 void _p_o_p___f_r_o_n_t() │ │ │ │ │ +111 { │ │ │ │ │ +112 _k_e_y___t_y_p_e k = _data.front().first; │ │ │ │ │ +113 _data.pop_front(); │ │ │ │ │ +114 _index.erase(k); │ │ │ │ │ +115 } │ │ │ │ │ +_1_1_9 void _p_o_p___b_a_c_k() │ │ │ │ │ +120 { │ │ │ │ │ +121 _k_e_y___t_y_p_e k = _data.back().first; │ │ │ │ │ +122 _data.pop_back(); │ │ │ │ │ +123 _index.erase(k); │ │ │ │ │ +124 } │ │ │ │ │ +125 │ │ │ │ │ +_1_3_1 _i_t_e_r_a_t_o_r _f_i_n_d (const _k_e_y___t_y_p_e & key) │ │ │ │ │ +132 { │ │ │ │ │ +133 const map_iterator it = _index.find(key); │ │ │ │ │ +134 if (it == _index.end()) return _data.end(); │ │ │ │ │ +135 return it->second; │ │ │ │ │ +136 } │ │ │ │ │ +137 │ │ │ │ │ +_1_4_3 _c_o_n_s_t___i_t_e_r_a_t_o_r _f_i_n_d (const _k_e_y___t_y_p_e & key) const │ │ │ │ │ +144 { │ │ │ │ │ +145 const map_iterator it = _index.find(key); │ │ │ │ │ +146 if (it == _index.end()) return _data.end(); │ │ │ │ │ +147 return it->second; │ │ │ │ │ +148 } │ │ │ │ │ +149 │ │ │ │ │ +_1_6_1 _r_e_f_e_r_e_n_c_e _i_n_s_e_r_t (const _k_e_y___t_y_p_e & key, _c_o_n_s_t___r_e_f_e_r_e_n_c_e data) │ │ │ │ │ +162 { │ │ │ │ │ +163 std::pair x(key, data); │ │ │ │ │ +164 /* insert item as mru */ │ │ │ │ │ +165 _i_t_e_r_a_t_o_r it = _data.insert(_data.begin(), x); │ │ │ │ │ +166 /* store index */ │ │ │ │ │ +167 _index.insert(std::make_pair(key,it)); │ │ │ │ │ +168 │ │ │ │ │ +169 return it->second; │ │ │ │ │ +170 } │ │ │ │ │ +171 │ │ │ │ │ +_1_7_5 _r_e_f_e_r_e_n_c_e _i_n_s_e_r_t (const _k_e_y___t_y_p_e & key) │ │ │ │ │ +176 { │ │ │ │ │ +177 return _t_o_u_c_h (key); │ │ │ │ │ +178 } │ │ │ │ │ +179 │ │ │ │ │ +_1_8_5 _r_e_f_e_r_e_n_c_e _t_o_u_c_h (const _k_e_y___t_y_p_e & key) │ │ │ │ │ +186 { │ │ │ │ │ +187 /* query _index for iterator */ │ │ │ │ │ +188 map_iterator it = _index.find(key); │ │ │ │ │ +189 if (it == _index.end()) │ │ │ │ │ +190 _D_U_N_E___T_H_R_O_W(_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r, │ │ │ │ │ +191 "Failed to touch key " << key << ", it is not in the lru container"); │ │ │ │ │ +192 /* update _data │ │ │ │ │ +193 move it to the front │ │ │ │ │ +194 */ │ │ │ │ │ +195 _data.splice(_data.begin(), _data, it->second); │ │ │ │ │ +196 return it->second->second; │ │ │ │ │ +197 } │ │ │ │ │ +198 │ │ │ │ │ +_2_0_2 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ +203 { │ │ │ │ │ +204 return _data.size(); │ │ │ │ │ +205 } │ │ │ │ │ +206 │ │ │ │ │ +_2_1_3 void _r_e_s_i_z_e(_s_i_z_e___t_y_p_e new_size) │ │ │ │ │ +214 { │ │ │ │ │ +215 assert(new_size <= _s_i_z_e()); │ │ │ │ │ +216 │ │ │ │ │ +217 while (new_size < _s_i_z_e()) │ │ │ │ │ +218 _p_o_p___b_a_c_k(); │ │ │ │ │ +219 } │ │ │ │ │ +220 │ │ │ │ │ +_2_2_4 void _c_l_e_a_r() │ │ │ │ │ +225 { │ │ │ │ │ +226 _data.clear(); │ │ │ │ │ +227 _index.clear(); │ │ │ │ │ +228 } │ │ │ │ │ +229 │ │ │ │ │ +230 private: │ │ │ │ │ +231 list_type _data; │ │ │ │ │ +232 map_type _index; │ │ │ │ │ +233 │ │ │ │ │ +234 }; │ │ │ │ │ +235 │ │ │ │ │ +236} // namespace Dune │ │ │ │ │ +237 │ │ │ │ │ +238#endif // DUNE_COMMON_LRU_HH │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r │ │ │ │ │ +Default exception class for range errors. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:254 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u │ │ │ │ │ +LRU Cache Container. │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_p_o_p___b_a_c_k │ │ │ │ │ +void pop_back() │ │ │ │ │ +Removes the last element. │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:119 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_f_i_n_d │ │ │ │ │ +iterator find(const key_type &key) │ │ │ │ │ +Finds the element whose key is k. │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_i_n_s_e_r_t │ │ │ │ │ +reference insert(const key_type &key) │ │ │ │ │ +mark data associated with key as most recent │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +list_type::const_iterator const_iterator │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:68 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_r_e_s_i_z_e │ │ │ │ │ +void resize(size_type new_size) │ │ │ │ │ +ensure a maximum size of the container │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:213 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +allocator::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +list_type::iterator iterator │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +allocator::value_type value_type │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_f_r_o_n_t │ │ │ │ │ +const_reference front() const │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:83 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ +typename allocator::value_type const * const_pointer │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +Retrieve number of entries in the container. │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:202 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename allocator::value_type & reference │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_b_a_c_k │ │ │ │ │ +reference back() │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_p_o_p___f_r_o_n_t │ │ │ │ │ +void pop_front() │ │ │ │ │ +Removes the first element. │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_f_r_o_n_t │ │ │ │ │ +reference front() │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:224 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_t_o_u_c_h │ │ │ │ │ +reference touch(const key_type &key) │ │ │ │ │ +mark data associated with key as most recent │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:185 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_i_n_s_e_r_t │ │ │ │ │ +reference insert(const key_type &key, const_reference data) │ │ │ │ │ +Insert a value into the container. │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:161 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_p_o_i_n_t_e_r │ │ │ │ │ +typename allocator::value_type * pointer │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:62 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_f_i_n_d │ │ │ │ │ +const_iterator find(const key_type &key) const │ │ │ │ │ +Finds the element whose key is k. │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:143 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename allocator::value_type const & const_reference │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_k_e_y___t_y_p_e │ │ │ │ │ +Traits::key_type key_type │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_l_r_u_:_:_b_a_c_k │ │ │ │ │ +const_reference back(int i) const │ │ │ │ │ +DDeeffiinniittiioonn lru.hh:101 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00044.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: precision.hh File Reference │ │ │ │ +dune-common: scalarvectorview.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,40 +70,39 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces
│ │ │ │ -
precision.hh File Reference
│ │ │ │ +
scalarvectorview.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Various precision settings for calculations with FieldMatrix and FieldVector. │ │ │ │ +

Implements a scalar vector view wrapper around an existing scalar. │ │ │ │ More...

│ │ │ │ -
#include <stdlib.h>
│ │ │ │ +
#include <cstddef>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <istream>
│ │ │ │ +#include <dune/common/densevector.hh>
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/matvectraits.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::FMatrixPrecision< ctype >
 Precisions for calculations with FieldMatrix and FieldVector. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Various precision settings for calculations with FieldMatrix and FieldVector.

│ │ │ │ +

Implements a scalar vector view wrapper around an existing scalar.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,24 +1,26 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -precision.hh File Reference │ │ │ │ │ -Various precision settings for calculations with FieldMatrix and FieldVector. │ │ │ │ │ -_M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +scalarvectorview.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ +Implements a scalar vector view wrapper around an existing scalar. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_v_e_c_t_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_v_e_c_t_r_a_i_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_:_:_F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_<_ _c_t_y_p_e_ _> │ │ │ │ │ -  Precisions for calculations with _F_i_e_l_d_M_a_t_r_i_x and _F_i_e_l_d_V_e_c_t_o_r. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Various precision settings for calculations with FieldMatrix and FieldVector. │ │ │ │ │ +Implements a scalar vector view wrapper around an existing scalar. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: precision.hh Source File │ │ │ │ +dune-common: scalarvectorview.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,62 +74,194 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
precision.hh
│ │ │ │ +
scalarvectorview.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_PRECISION_HH
│ │ │ │ -
6#define DUNE_PRECISION_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_SCALARVECTORVIEW_HH
│ │ │ │ +
6#define DUNE_COMMON_SCALARVECTORVIEW_HH
│ │ │ │
7
│ │ │ │ -
12#include <stdlib.h>
│ │ │ │ -
13
│ │ │ │ -
14namespace Dune {
│ │ │ │ -
15
│ │ │ │ -
24 template <class ctype = double>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
26 public:
│ │ │ │ -
│ │ │ │ -
28 static ctype absolute_limit ()
│ │ │ │ -
29 {
│ │ │ │ -
30 return _absolute;
│ │ │ │ -
31 }
│ │ │ │ -
│ │ │ │ -
32
│ │ │ │ -
│ │ │ │ -
34 static void set_absolute_limit (ctype absthres)
│ │ │ │ -
35 {
│ │ │ │ -
36 _absolute = absthres;
│ │ │ │ -
37 }
│ │ │ │ -
│ │ │ │ -
38
│ │ │ │ -
39 private:
│ │ │ │ -
40 // just to demonstrate some state information
│ │ │ │ -
41 static ctype _absolute;
│ │ │ │ -
42 };
│ │ │ │ -
│ │ │ │ -
43
│ │ │ │ -
44 template <class ctype>
│ │ │ │ -
45 ctype FMatrixPrecision<ctype>::_absolute = 1E-80;
│ │ │ │ -
46
│ │ │ │ -
49} // end namespace
│ │ │ │ -
50
│ │ │ │ -
51#endif
│ │ │ │ +
8#include <cstddef>
│ │ │ │ +
9#include <type_traits>
│ │ │ │ +
10#include <istream>
│ │ │ │ +
11
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
16
│ │ │ │ +
17namespace Dune {
│ │ │ │ +
18
│ │ │ │ +
19namespace Impl {
│ │ │ │ +
20
│ │ │ │ +
35 template<class K>
│ │ │ │ +
36 class ScalarVectorView :
│ │ │ │ +
37 public DenseVector<ScalarVectorView<K>>
│ │ │ │ +
38 {
│ │ │ │ +
39 K* dataP_;
│ │ │ │ +
40 using Base = DenseVector<ScalarVectorView<K>>;
│ │ │ │ +
41
│ │ │ │ +
42 template <class>
│ │ │ │ +
43 friend class ScalarVectorView;
│ │ │ │ +
44 public:
│ │ │ │ +
45
│ │ │ │ +
47 constexpr static int dimension = 1;
│ │ │ │ +
48
│ │ │ │ +
50 using size_type = typename Base::size_type;
│ │ │ │ +
51
│ │ │ │ +
53 using reference = std::decay_t<K>&;
│ │ │ │ +
54
│ │ │ │ +
56 using const_reference = const K&;
│ │ │ │ +
57
│ │ │ │ +
58 //===== construction
│ │ │ │ +
59
│ │ │ │ +
61 constexpr ScalarVectorView ()
│ │ │ │ +
62 : dataP_(nullptr)
│ │ │ │ +
63 {}
│ │ │ │ +
64
│ │ │ │ +
66 ScalarVectorView (K* p) :
│ │ │ │ +
67 dataP_(p)
│ │ │ │ +
68 {}
│ │ │ │ +
69
│ │ │ │ +
71 ScalarVectorView (const ScalarVectorView &other) :
│ │ │ │ +
72 Base(),
│ │ │ │ +
73 dataP_(other.dataP_)
│ │ │ │ +
74 {}
│ │ │ │ +
75
│ │ │ │ +
77 ScalarVectorView (ScalarVectorView &&other) :
│ │ │ │ +
78 Base(),
│ │ │ │ +
79 dataP_( other.dataP_ )
│ │ │ │ +
80 {}
│ │ │ │ +
81
│ │ │ │ +
83 ScalarVectorView& operator= (const ScalarVectorView& other)
│ │ │ │ +
84 {
│ │ │ │ +
85 assert(dataP_);
│ │ │ │ +
86 assert(other.dataP_);
│ │ │ │ +
87 *dataP_ = *(other.dataP_);
│ │ │ │ +
88 return *this;
│ │ │ │ +
89 }
│ │ │ │ +
90
│ │ │ │ +
91 template<class KK>
│ │ │ │ +
92 ScalarVectorView& operator= (const ScalarVectorView<KK>& other)
│ │ │ │ +
93 {
│ │ │ │ +
94 assert(dataP_);
│ │ │ │ +
95 assert(other.dataP_);
│ │ │ │ +
96 *dataP_ = *(other.dataP_);
│ │ │ │ +
97 return *this;
│ │ │ │ +
98 }
│ │ │ │ +
99
│ │ │ │ +
101 template<typename T,
│ │ │ │ +
102 std::enable_if_t<std::is_convertible<T, K>::value, int> = 0>
│ │ │ │ +
103 inline ScalarVectorView& operator= (const T& k)
│ │ │ │ +
104 {
│ │ │ │ +
105 *dataP_ = k;
│ │ │ │ +
106 return *this;
│ │ │ │ +
107 }
│ │ │ │ +
108
│ │ │ │ +
110 static constexpr size_type size ()
│ │ │ │ +
111 {
│ │ │ │ +
112 return 1;
│ │ │ │ +
113 }
│ │ │ │ +
114
│ │ │ │ +
116 K& operator[] ([[maybe_unused]] size_type i)
│ │ │ │ +
117 {
│ │ │ │ +
118 DUNE_ASSERT_BOUNDS(i == 0);
│ │ │ │ +
119 return *dataP_;
│ │ │ │ +
120 }
│ │ │ │ +
121
│ │ │ │ +
123 const K& operator[] ([[maybe_unused]] size_type i) const
│ │ │ │ +
124 {
│ │ │ │ +
125 DUNE_ASSERT_BOUNDS(i == 0);
│ │ │ │ +
126 return *dataP_;
│ │ │ │ +
127 }
│ │ │ │ +
128 }; // class ScalarVectorView
│ │ │ │ +
129
│ │ │ │ +
130} // namespace Impl
│ │ │ │ +
131
│ │ │ │ +
132
│ │ │ │ +
133 template< class K>
│ │ │ │ +
134 struct DenseMatVecTraits< Impl::ScalarVectorView<K> >
│ │ │ │ +
135 {
│ │ │ │ +
136 using derived_type = Impl::ScalarVectorView<K>;
│ │ │ │ +
137 using value_type = std::remove_const_t<K>;
│ │ │ │ +
138 using size_type = std::size_t;
│ │ │ │ +
139 };
│ │ │ │ +
140
│ │ │ │ +
141 template< class K >
│ │ │ │ +
142 struct FieldTraits< Impl::ScalarVectorView<K> > : public FieldTraits<std::remove_const_t<K>> {};
│ │ │ │ +
143
│ │ │ │ +
144 template<class K>
│ │ │ │ +
145 struct AutonomousValueType<Impl::ScalarVectorView<K>>
│ │ │ │ +
146 {
│ │ │ │ +
147 using type = FieldVector<std::remove_const_t<K>,1>;
│ │ │ │ +
148 };
│ │ │ │ +
149
│ │ │ │ +
150namespace Impl {
│ │ │ │ +
151
│ │ │ │ +
163 template<class K>
│ │ │ │ +
164 inline std::istream &operator>> ( std::istream &in, ScalarVectorView<K> &v )
│ │ │ │ +
165 {
│ │ │ │ +
166 K w;
│ │ │ │ +
167 if(in >> w)
│ │ │ │ +
168 v = w;
│ │ │ │ +
169 return in;
│ │ │ │ +
170 }
│ │ │ │ +
171
│ │ │ │ +
172
│ │ │ │ +
174 template<class T,
│ │ │ │ +
175 std::enable_if_t<IsNumber<T>::value, int> = 0>
│ │ │ │ +
176 auto asVector(T& t)
│ │ │ │ +
177 {
│ │ │ │ +
178 return ScalarVectorView<T>{&t};
│ │ │ │ +
179 }
│ │ │ │ +
180
│ │ │ │ +
182 template<class T,
│ │ │ │ +
183 std::enable_if_t<IsNumber<T>::value, int> = 0>
│ │ │ │ +
184 auto asVector(const T& t)
│ │ │ │ +
185 {
│ │ │ │ +
186 return ScalarVectorView<const T>{&t};
│ │ │ │ +
187 }
│ │ │ │ +
188
│ │ │ │ +
190 template<class T,
│ │ │ │ +
191 std::enable_if_t<not IsNumber<T>::value, int> = 0>
│ │ │ │ +
192 T& asVector(T& t)
│ │ │ │ +
193 {
│ │ │ │ +
194 return t;
│ │ │ │ +
195 }
│ │ │ │ +
196
│ │ │ │ +
198 template<class T,
│ │ │ │ +
199 std::enable_if_t<not IsNumber<T>::value, int> = 0>
│ │ │ │ +
200 const T& asVector(const T& t)
│ │ │ │ +
201 {
│ │ │ │ +
202 return t;
│ │ │ │ +
203 }
│ │ │ │ +
204
│ │ │ │ +
205} // end namespace Impl
│ │ │ │ +
206
│ │ │ │ +
207} // end namespace Dune
│ │ │ │ +
208
│ │ │ │ +
209#endif // DUNE_COMMON_SCALARVECTORVIEW_HH
│ │ │ │ +
Implements the dense vector interface, with an exchangeable storage class.
│ │ │ │ +
Implements a vector constructed from a given type representing a field and a compile-time given size.
│ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
│ │ │ │ +
Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
Read a std::tuple.
Definition streamoperators.hh:43
│ │ │ │ +
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition boundschecking.hh:30
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Precisions for calculations with FieldMatrix and FieldVector.
Definition precision.hh:25
│ │ │ │ -
static ctype absolute_limit()
return threshold to declare matrix singular
Definition precision.hh:28
│ │ │ │ -
static void set_absolute_limit(ctype absthres)
set singular threshold
Definition precision.hh:34
│ │ │ │ +
size_type size() const
size method
Definition densevector.hh:336
│ │ │ │ +
Traits::size_type size_type
The type used for the index access and size operation.
Definition densevector.hh:259
│ │ │ │ +
T type
Definition typetraits.hh:501
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,60 +1,213 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -precision.hh │ │ │ │ │ +scalarvectorview.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_PRECISION_HH │ │ │ │ │ -6#define DUNE_PRECISION_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_SCALARVECTORVIEW_HH │ │ │ │ │ +6#define DUNE_COMMON_SCALARVECTORVIEW_HH │ │ │ │ │ 7 │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14namespace _D_u_n_e { │ │ │ │ │ -15 │ │ │ │ │ -24 template │ │ │ │ │ -_2_5 class _F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n { │ │ │ │ │ -26 public: │ │ │ │ │ -_2_8 static ctype _a_b_s_o_l_u_t_e___l_i_m_i_t () │ │ │ │ │ -29 { │ │ │ │ │ -30 return _absolute; │ │ │ │ │ -31 } │ │ │ │ │ -32 │ │ │ │ │ -_3_4 static void _s_e_t___a_b_s_o_l_u_t_e___l_i_m_i_t (ctype absthres) │ │ │ │ │ -35 { │ │ │ │ │ -36 _absolute = absthres; │ │ │ │ │ -37 } │ │ │ │ │ -38 │ │ │ │ │ -39 private: │ │ │ │ │ -40 // just to demonstrate some state information │ │ │ │ │ -41 static ctype _absolute; │ │ │ │ │ -42 }; │ │ │ │ │ -43 │ │ │ │ │ -44 template │ │ │ │ │ -45 ctype FMatrixPrecision::_absolute = 1E-80; │ │ │ │ │ -46 │ │ │ │ │ -49} // end namespace │ │ │ │ │ -50 │ │ │ │ │ -51#endif │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_v_e_c_t_o_r_._h_h> │ │ │ │ │ +13#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +14#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_v_e_c_t_r_a_i_t_s_._h_h> │ │ │ │ │ +16 │ │ │ │ │ +17namespace _D_u_n_e { │ │ │ │ │ +18 │ │ │ │ │ +19namespace Impl { │ │ │ │ │ +20 │ │ │ │ │ +35 template │ │ │ │ │ +36 class ScalarVectorView : │ │ │ │ │ +37 public DenseVector> │ │ │ │ │ +38 { │ │ │ │ │ +39 K* dataP_; │ │ │ │ │ +40 using Base = DenseVector>; │ │ │ │ │ +41 │ │ │ │ │ +42 template │ │ │ │ │ +43 friend class ScalarVectorView; │ │ │ │ │ +44 public: │ │ │ │ │ +45 │ │ │ │ │ +47 constexpr static int dimension = 1; │ │ │ │ │ +48 │ │ │ │ │ +50 using _s_i_z_e___t_y_p_e = typename _B_a_s_e_:_:_s_i_z_e___t_y_p_e; │ │ │ │ │ +51 │ │ │ │ │ +53 using reference = std::decay_t&; │ │ │ │ │ +54 │ │ │ │ │ +56 using const_reference = const K&; │ │ │ │ │ +57 │ │ │ │ │ +58 //===== construction │ │ │ │ │ +59 │ │ │ │ │ +61 constexpr ScalarVectorView () │ │ │ │ │ +62 : dataP_(nullptr) │ │ │ │ │ +63 {} │ │ │ │ │ +64 │ │ │ │ │ +66 ScalarVectorView (K* p) : │ │ │ │ │ +67 dataP_(p) │ │ │ │ │ +68 {} │ │ │ │ │ +69 │ │ │ │ │ +71 ScalarVectorView (const ScalarVectorView &other) : │ │ │ │ │ +72 Base(), │ │ │ │ │ +73 dataP_(other.dataP_) │ │ │ │ │ +74 {} │ │ │ │ │ +75 │ │ │ │ │ +77 ScalarVectorView (ScalarVectorView &&other) : │ │ │ │ │ +78 Base(), │ │ │ │ │ +79 dataP_( other.dataP_ ) │ │ │ │ │ +80 {} │ │ │ │ │ +81 │ │ │ │ │ +83 ScalarVectorView& operator= (const ScalarVectorView& other) │ │ │ │ │ +84 { │ │ │ │ │ +85 assert(dataP_); │ │ │ │ │ +86 assert(other.dataP_); │ │ │ │ │ +87 *dataP_ = *(other.dataP_); │ │ │ │ │ +88 return *this; │ │ │ │ │ +89 } │ │ │ │ │ +90 │ │ │ │ │ +91 template │ │ │ │ │ +92 ScalarVectorView& operator= (const ScalarVectorView& other) │ │ │ │ │ +93 { │ │ │ │ │ +94 assert(dataP_); │ │ │ │ │ +95 assert(other.dataP_); │ │ │ │ │ +96 *dataP_ = *(other.dataP_); │ │ │ │ │ +97 return *this; │ │ │ │ │ +98 } │ │ │ │ │ +99 │ │ │ │ │ +101 template::value, int> = 0> │ │ │ │ │ +103 inline ScalarVectorView& operator= (const T& k) │ │ │ │ │ +104 { │ │ │ │ │ +105 *dataP_ = k; │ │ │ │ │ +106 return *this; │ │ │ │ │ +107 } │ │ │ │ │ +108 │ │ │ │ │ +110 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e () │ │ │ │ │ +111 { │ │ │ │ │ +112 return 1; │ │ │ │ │ +113 } │ │ │ │ │ +114 │ │ │ │ │ +116 K& operator[] ([[maybe_unused]] size_type i) │ │ │ │ │ +117 { │ │ │ │ │ +118 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i == 0); │ │ │ │ │ +119 return *dataP_; │ │ │ │ │ +120 } │ │ │ │ │ +121 │ │ │ │ │ +123 const K& operator[] ([[maybe_unused]] size_type i) const │ │ │ │ │ +124 { │ │ │ │ │ +125 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i == 0); │ │ │ │ │ +126 return *dataP_; │ │ │ │ │ +127 } │ │ │ │ │ +128 }; // class ScalarVectorView │ │ │ │ │ +129 │ │ │ │ │ +130} // namespace Impl │ │ │ │ │ +131 │ │ │ │ │ +132 │ │ │ │ │ +133 template< class K> │ │ │ │ │ +134 struct DenseMatVecTraits< Impl::ScalarVectorView > │ │ │ │ │ +135 { │ │ │ │ │ +136 using derived_type = Impl::ScalarVectorView; │ │ │ │ │ +137 using value_type = std::remove_const_t; │ │ │ │ │ +138 using size_type = std::size_t; │ │ │ │ │ +139 }; │ │ │ │ │ +140 │ │ │ │ │ +141 template< class K > │ │ │ │ │ +142 struct FieldTraits< Impl::ScalarVectorView > : public FieldTraits> {}; │ │ │ │ │ +143 │ │ │ │ │ +144 template │ │ │ │ │ +145 struct AutonomousValueType> │ │ │ │ │ +146 { │ │ │ │ │ +147 using _t_y_p_e = FieldVector,1>; │ │ │ │ │ +148 }; │ │ │ │ │ +149 │ │ │ │ │ +150namespace Impl { │ │ │ │ │ +151 │ │ │ │ │ +163 template │ │ │ │ │ +164 inline std::istream &_o_p_e_r_a_t_o_r_>_>_ ( std::istream &in, ScalarVectorView &v │ │ │ │ │ +) │ │ │ │ │ +165 { │ │ │ │ │ +166 K w; │ │ │ │ │ +167 if(in >> w) │ │ │ │ │ +168 v = w; │ │ │ │ │ +169 return in; │ │ │ │ │ +170 } │ │ │ │ │ +171 │ │ │ │ │ +172 │ │ │ │ │ +174 template::value, int> = 0> │ │ │ │ │ +176 auto asVector(T& t) │ │ │ │ │ +177 { │ │ │ │ │ +178 return ScalarVectorView{&t}; │ │ │ │ │ +179 } │ │ │ │ │ +180 │ │ │ │ │ +182 template::value, int> = 0> │ │ │ │ │ +184 auto asVector(const T& t) │ │ │ │ │ +185 { │ │ │ │ │ +186 return ScalarVectorView{&t}; │ │ │ │ │ +187 } │ │ │ │ │ +188 │ │ │ │ │ +190 template::value, int> = 0> │ │ │ │ │ +192 T& asVector(T& t) │ │ │ │ │ +193 { │ │ │ │ │ +194 return t; │ │ │ │ │ +195 } │ │ │ │ │ +196 │ │ │ │ │ +198 template::value, int> = 0> │ │ │ │ │ +200 const T& asVector(const T& t) │ │ │ │ │ +201 { │ │ │ │ │ +202 return t; │ │ │ │ │ +203 } │ │ │ │ │ +204 │ │ │ │ │ +205} // end namespace Impl │ │ │ │ │ +206 │ │ │ │ │ +207} // end namespace Dune │ │ │ │ │ +208 │ │ │ │ │ +209#endif // DUNE_COMMON_SCALARVECTORVIEW_HH │ │ │ │ │ +_d_e_n_s_e_v_e_c_t_o_r_._h_h │ │ │ │ │ +Implements the dense vector interface, with an exchangeable storage class. │ │ │ │ │ +_f_v_e_c_t_o_r_._h_h │ │ │ │ │ +Implements a vector constructed from a given type representing a field and a │ │ │ │ │ +compile-time given size. │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_m_a_t_v_e_c_t_r_a_i_t_s_._h_h │ │ │ │ │ +Documentation of the traits classes you need to write for each implementation │ │ │ │ │ +of DenseVector or Dense... │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ +Stream & operator>>(Stream &stream, std::tuple< Ts... > &t) │ │ │ │ │ +Read a std::tuple. │ │ │ │ │ +DDeeffiinniittiioonn streamoperators.hh:43 │ │ │ │ │ +_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ +#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ +If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ +nothing. │ │ │ │ │ +DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n │ │ │ │ │ -Precisions for calculations with FieldMatrix and FieldVector. │ │ │ │ │ -DDeeffiinniittiioonn precision.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_:_:_a_b_s_o_l_u_t_e___l_i_m_i_t │ │ │ │ │ -static ctype absolute_limit() │ │ │ │ │ -return threshold to declare matrix singular │ │ │ │ │ -DDeeffiinniittiioonn precision.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_:_:_s_e_t___a_b_s_o_l_u_t_e___l_i_m_i_t │ │ │ │ │ -static void set_absolute_limit(ctype absthres) │ │ │ │ │ -set singular threshold │ │ │ │ │ -DDeeffiinniittiioonn precision.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_<_ _S_c_a_l_a_r_V_e_c_t_o_r_V_i_e_w_<_ _K_ _>_ _>_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +size method │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:336 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_<_ _S_c_a_l_a_r_V_e_c_t_o_r_V_i_e_w_<_ _K_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Traits::size_type size_type │ │ │ │ │ +The type used for the index access and size operation. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ +T type │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:501 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00047.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: concept.hh File Reference │ │ │ │ +dune-common: function.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,88 +72,75 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ +Macros | │ │ │ │ Functions
│ │ │ │ -
concept.hh File Reference
│ │ │ │ +
function.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Infrastructure for concepts. │ │ │ │ +

Simple base class templates for functions. │ │ │ │ More...

│ │ │ │ -
#include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include <dune/common/typeutilities.hh>
│ │ │ │ -#include <dune/common/typelist.hh>
│ │ │ │ -#include <dune/common/tupleutility.hh>
│ │ │ │ -#include <dune/common/std/type_traits.hh>
│ │ │ │ +
#include <utility>
│ │ │ │ +#include <dune/common/deprecated.hh>
│ │ │ │ +#include "typetraits.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Concept::Refines< BaseConcepts >
 Base class for refined concepts. More...
class  Dune::Function< Domain, Range >
 Base class template for function classes. More...
 
struct  Dune::Function< Domain, Range >::Traits
 Traits class containing raw types. More...
 
class  Dune::VirtualFunction< DomainType, RangeType >
 Virtual base class template for function classes. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Concept
 Namespace for concepts.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Macros

#define DUNE_FUNCTION_HH
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<class C , class... T>
constexpr auto Dune::models ()
 Check if concept is modeled by given types.
 
template<class C , class Tuple >
constexpr auto Dune::Concept::tupleEntriesModel () -> typename Impl::TupleEntriesModelHelper< C, Tuple >::Result
 
template<bool b, typename std::enable_if< b, int >::type = 0>
constexpr bool Dune::Concept::requireTrue ()
 
template<class C , class... T, typename std::enable_if< models< C, T... >(), int >::type = 0>
constexpr bool Dune::Concept::requireConcept ()
 
template<class C , class... T, typename std::enable_if< models< C, T... >(), int >::type = 0>
constexpr bool Dune::Concept::requireConcept (T &&...)
 
template<class C , class Tuple , typename std::enable_if< tupleEntriesModel< C, Tuple >(), int >::type = 0>
constexpr bool Dune::Concept::requireConceptForTupleEntries ()
 
template<class From , class To , typename std::enable_if< std::is_convertible< From, To >::value, int >::type = 0>
constexpr bool Dune::Concept::requireConvertible ()
 
template<class To , class From , typename std::enable_if< std::is_convertible< From, To >::value, int >::type = 0>
constexpr bool Dune::Concept::requireConvertible (const From &)
 
template<typename T >
constexpr bool Dune::Concept::requireType ()
 
template<class Base , class Derived , typename std::enable_if< std::is_base_of< Base, Derived >::value, int >::type = 0>
constexpr bool Dune::Concept::requireBaseOf ()
 
template<class Base , class Derived , typename std::enable_if< std::is_base_of< Base, Derived >::value, int >::type = 0>
constexpr bool Dune::Concept::requireBaseOf (const Derived &)
 
template<class A , class B , typename std::enable_if< std::is_same< A, B >::value, int >::type = 0>
constexpr bool Dune::Concept::requireSameType ()
 
template<typename Domain , typename Range , typename F >
Impl::LambdaVirtualFunction< Domain, Range, std::decay_t< F > > Dune::makeVirtualFunction (F &&f)
 make VirtualFunction out of a function object
 
│ │ │ │

Detailed Description

│ │ │ │ -

Infrastructure for concepts.

│ │ │ │ -
│ │ │ │ +

Simple base class templates for functions.

│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DUNE_FUNCTION_HH

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_FUNCTION_HH
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,79 +1,45 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -concept.hh File Reference │ │ │ │ │ -Infrastructure for concepts. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +_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 │ │ │ │ │ +function.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n │ │ │ │ │ +Simple base class templates for functions. _M_o_r_e_._._. │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_u_p_l_e_u_t_i_l_i_t_y_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_p_r_e_c_a_t_e_d_._h_h> │ │ │ │ │ +#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_R_e_f_i_n_e_s_<_ _B_a_s_e_C_o_n_c_e_p_t_s_ _> │ │ │ │ │ -  Base class for refined concepts. _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_F_u_n_c_t_i_o_n_<_ _D_o_m_a_i_n_,_ _R_a_n_g_e_ _> │ │ │ │ │ +  Base class template for function classes. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_u_n_c_t_i_o_n_<_ _D_o_m_a_i_n_,_ _R_a_n_g_e_ _>_:_:_T_r_a_i_t_s │ │ │ │ │ +  _T_r_a_i_t_s class containing raw types. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_<_ _D_o_m_a_i_n_T_y_p_e_,_ _R_a_n_g_e_T_y_p_e_ _> │ │ │ │ │ +  Virtual base class template for function classes. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_C_o_n_c_e_p_t │ │ │ │ │ -  Namespace for concepts. │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___F_U_N_C_T_I_O_N___H_H │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -constexpr auto  _D_u_n_e_:_:_m_o_d_e_l_s () │ │ │ │ │ -  Check if concept is modeled by given types. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -constexpr auto  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_t_u_p_l_e_E_n_t_r_i_e_s_M_o_d_e_l () -> typename Impl:: │ │ │ │ │ - TupleEntriesModelHelper< C, Tuple >::Result │ │ │ │ │ -  │ │ │ │ │ -template::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_T_r_u_e () │ │ │ │ │ -  │ │ │ │ │ -template(), │ │ │ │ │ -int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_c_e_p_t () │ │ │ │ │ -  │ │ │ │ │ -template(), │ │ │ │ │ -int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_c_e_p_t (T &&...) │ │ │ │ │ -  │ │ │ │ │ -template(), int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_c_e_p_t_F_o_r_T_u_p_l_e_E_n_t_r_i_e_s () │ │ │ │ │ -  │ │ │ │ │ -template::value, int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e () │ │ │ │ │ -  │ │ │ │ │ -template::value, int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e (const From &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_T_y_p_e () │ │ │ │ │ -  │ │ │ │ │ -template::value, int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_B_a_s_e_O_f () │ │ │ │ │ -  │ │ │ │ │ -template::value, int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_B_a_s_e_O_f (const Derived &) │ │ │ │ │ -  │ │ │ │ │ -template:: │ │ │ │ │ -value, int >::type = 0> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_S_a_m_e_T_y_p_e () │ │ │ │ │ +template │ │ │ │ │ +Impl::LambdaVirtualFunction< Domain, │ │ │ │ │ + Range, std::decay_t< F > >  _D_u_n_e_:_:_m_a_k_e_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n (F &&f) │ │ │ │ │ +  make _V_i_r_t_u_a_l_F_u_n_c_t_i_o_n out of a function │ │ │ │ │ + object │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Infrastructure for concepts. │ │ │ │ │ +Simple base class templates for functions. │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__FFUUNNCCTTIIOONN__HHHH ********** │ │ │ │ │ +#define DUNE_FUNCTION_HH │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: concept.hh Source File │ │ │ │ +dune-common: function.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,336 +74,143 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
concept.hh
│ │ │ │ +
function.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_CONCEPT_HH
│ │ │ │ -
6#define DUNE_COMMON_CONCEPT_HH
│ │ │ │ -
7
│ │ │ │ -
8#include <type_traits>
│ │ │ │ -
9#include <utility>
│ │ │ │ -
10#include <tuple>
│ │ │ │ -
11
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
16
│ │ │ │ -
23namespace Dune {
│ │ │ │ -
24
│ │ │ │ -
│ │ │ │ -
34namespace Concept {
│ │ │ │ -
35
│ │ │ │ -
36
│ │ │ │ -
37
│ │ │ │ -
52template<class... BaseConcepts>
│ │ │ │ -
│ │ │ │ -
53struct Refines
│ │ │ │ -
54{
│ │ │ │ -
55 typedef TypeList<BaseConcepts...> BaseConceptList;
│ │ │ │ -
56};
│ │ │ │ -
│ │ │ │ -
57
│ │ │ │ -
58
│ │ │ │ -
59#ifndef DOXYGEN
│ │ │ │ -
60
│ │ │ │ -
61namespace Impl {
│ │ │ │ -
62
│ │ │ │ -
63 // #############################################################################
│ │ │ │ -
64 // # All functions following here are implementation details
│ │ │ │ -
65 // # for the models() function below.
│ │ │ │ -
66 // #############################################################################
│ │ │ │ -
67
│ │ │ │ -
68 // Forward declaration
│ │ │ │ -
69 template<class C, class... T>
│ │ │ │ -
70 constexpr bool models();
│ │ │ │ -
71
│ │ │ │ -
72
│ │ │ │ -
73
│ │ │ │ -
74 // Here is the implementation of the concept checking.
│ │ │ │ -
75 // The first two overloads do the magic for checking
│ │ │ │ -
76 // if the requirements of a concept are satisfied.
│ │ │ │ -
77 // The rest is just for checking base concepts in case
│ │ │ │ -
78 // of refinement.
│ │ │ │ -
79
│ │ │ │ -
80 // This overload is present if type substitution for
│ │ │ │ -
81 // C::require(T...) is successful, i.e., if the T...
│ │ │ │ -
82 // matches the requirement of C. In this case this
│ │ │ │ -
83 // overload is selected because PriorityTag<1>
│ │ │ │ -
84 // is a better match for PrioriryTag<42> than
│ │ │ │ -
85 // PriorityTag<0> in the default overload.
│ │ │ │ -
86 template<class C, class... T,
│ │ │ │ -
87 decltype(std::declval<C>().require(std::declval<T>()...), 0) =0>
│ │ │ │ -
88 constexpr std::true_type matchesRequirement(PriorityTag<1>)
│ │ │ │ -
89 { return {}; }
│ │ │ │ +
5#ifndef DUNE_FUNCTION_HH_SILENCE_DEPRECATION
│ │ │ │ +
6#warning This file is deprecated after Dune 2.7! Use C++ function objects and std::function stuff instead!
│ │ │ │ +
7#else // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION
│ │ │ │ +
8#undef DUNE_FUNCTION_HH_SILENCE_DEPRECATION
│ │ │ │ +
9#endif // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION
│ │ │ │ +
10
│ │ │ │ +
11#ifndef DUNE_FUNCTION_HH
│ │ │ │ +
12#define DUNE_FUNCTION_HH
│ │ │ │ +
13
│ │ │ │ +
14#include <utility>
│ │ │ │ +
15
│ │ │ │ + │ │ │ │ +
17#include "typetraits.hh"
│ │ │ │ +
18
│ │ │ │ +
19namespace Dune {
│ │ │ │ +
20
│ │ │ │ +
36 template <class Domain, class Range>
│ │ │ │ +
│ │ │ │ +
37 class
│ │ │ │ +
38 [[deprecated("Dune::Function is deprecated after Dune 2.7. Use C++ "
│ │ │ │ +
39 "function objects instead!")]]
│ │ │ │ + │ │ │ │ +
41 {
│ │ │ │ +
42 typedef typename std::remove_cv<typename std::remove_reference< Domain >::type >::type RawDomainType;
│ │ │ │ +
43 typedef typename std::remove_cv<typename std::remove_reference< Range >::type >::type RawRangeType;
│ │ │ │ +
44
│ │ │ │ +
45 public:
│ │ │ │ +
46
│ │ │ │ +
48 typedef RawRangeType RangeType;
│ │ │ │ +
49
│ │ │ │ +
51 typedef RawDomainType DomainType;
│ │ │ │ +
52
│ │ │ │ +
│ │ │ │ +
54 struct Traits
│ │ │ │ +
55 {
│ │ │ │ +
56 typedef RawDomainType DomainType;
│ │ │ │ +
57 typedef RawRangeType RangeType;
│ │ │ │ +
58 };
│ │ │ │ +
│ │ │ │ +
59
│ │ │ │ +
66 void evaluate(const typename Traits::DomainType& x, typename Traits::RangeType& y) const;
│ │ │ │ +
67 }; // end of Function class
│ │ │ │ +
│ │ │ │ +
68
│ │ │ │ +
69
│ │ │ │ +
70
│ │ │ │ + │ │ │ │ +
82 template <class DomainType, class RangeType>
│ │ │ │ +
│ │ │ │ +
83 class
│ │ │ │ +
84 [[deprecated("Dune::VirtualFunction is deprecated after Dune 2.7. Use C++ "
│ │ │ │ +
85 "function objects and std::function instead!")]]
│ │ │ │ + │ │ │ │ +
87 {
│ │ │ │ +
88 public:
│ │ │ │ + │ │ │ │
90
│ │ │ │ -
91 // If the above overload is ruled out by SFINAE because
│ │ │ │ -
92 // the T... does not match the requirements of C, then
│ │ │ │ -
93 // this default overload drops in.
│ │ │ │ -
94 template<class C, class... T>
│ │ │ │ -
95 constexpr std::false_type matchesRequirement(PriorityTag<0>)
│ │ │ │ -
96 { return {}; }
│ │ │ │ -
97
│ │ │ │ -
98
│ │ │ │ -
99
│ │ │ │ -
100 // An empty list C of concepts is always matched by T...
│ │ │ │ -
101 template<class...T>
│ │ │ │ -
102 constexpr bool modelsConceptList(TypeList<>)
│ │ │ │ -
103 { return true; }
│ │ │ │ -
104
│ │ │ │ -
105 // A nonempty list C0,..,CN of concepts is modeled
│ │ │ │ -
106 // by T... if it models the concept C0
│ │ │ │ -
107 // and all concepts in the list C1,..,CN.
│ │ │ │ -
108 template<class...T, class C0, class... CC>
│ │ │ │ -
109 constexpr bool modelsConceptList(TypeList<C0, CC...>)
│ │ │ │ -
110 { return models<C0, T...>() and modelsConceptList<T...>(TypeList<CC...>()); }
│ │ │ │ -
111
│ │ │ │ -
112
│ │ │ │ +
91 virtual ~VirtualFunction() {}
│ │ │ │ +
98 virtual void evaluate(const typename Traits::DomainType& x, typename Traits::RangeType& y) const = 0;
│ │ │ │ +
99 }; // end of VirtualFunction class
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
101
│ │ │ │ +
102 namespace Impl {
│ │ │ │ +
103
│ │ │ │ + │ │ │ │ +
105 template<typename Domain, typename Range, typename F>
│ │ │ │ +
106 class LambdaVirtualFunction final
│ │ │ │ +
107 : public VirtualFunction<Domain, Range>
│ │ │ │ +
108 {
│ │ │ │ +
109 public:
│ │ │ │ +
110 LambdaVirtualFunction(F&& f)
│ │ │ │ +
111 : f_(std::move(f))
│ │ │ │ +
112 {}
│ │ │ │
113
│ │ │ │ -
114 // If C is an unrefined concept, then T... models C
│ │ │ │ -
115 // if it matches the requirement of C.
│ │ │ │ -
116 template<class C, class... T>
│ │ │ │ -
117 constexpr bool modelsConcept(PriorityTag<0>)
│ │ │ │ -
118 { return matchesRequirement<C, T...>(PriorityTag<42>()); }
│ │ │ │ -
119
│ │ │ │ -
120 // If C is a refined concept, then T... models C
│ │ │ │ -
121 // if it matches the requirement of C and of
│ │ │ │ -
122 // all base concepts.
│ │ │ │ -
123 //
│ │ │ │ -
124 // This overload is used if C::BaseConceptList exists
│ │ │ │ -
125 // due to its higher priority.
│ │ │ │ -
126 template<class C, class... T,
│ │ │ │ -
127 decltype(typename C::BaseConceptList(), 0) = 0>
│ │ │ │ -
128 constexpr bool modelsConcept(PriorityTag<1>)
│ │ │ │ -
129 { return matchesRequirement<C, T...>(PriorityTag<42>()) and modelsConceptList<T...>(typename C::BaseConceptList()); }
│ │ │ │ -
130
│ │ │ │ -
131 // This is the full concept check. It's defined here in the
│ │ │ │ -
132 // implementation namespace with 'constexpr bool' return type
│ │ │ │ -
133 // because we need a forward declaration in order to use it
│ │ │ │ -
134 // internally above.
│ │ │ │ -
135 //
│ │ │ │ -
136 // The actual interface function can then call this one and
│ │ │ │ -
137 // return the result as std::integral_constant<bool,*> which
│ │ │ │ -
138 // does not allow for a forward declaration because the return
│ │ │ │ -
139 // type is deduced.
│ │ │ │ -
140 template<class C, class... T>
│ │ │ │ -
141 constexpr bool models()
│ │ │ │ -
142 {
│ │ │ │ -
143 return modelsConcept<C, T...>(PriorityTag<42>());
│ │ │ │ -
144 }
│ │ │ │ -
145
│ │ │ │ -
146} // namespace Dune::Concept::Impl
│ │ │ │ -
147
│ │ │ │ -
148#endif // DOXYGEN
│ │ │ │ -
149
│ │ │ │ -
150} // namespace Dune::Concept
│ │ │ │ -
│ │ │ │ -
151
│ │ │ │ -
152
│ │ │ │ -
153
│ │ │ │ -
183template<class C, class... T>
│ │ │ │ -
│ │ │ │ -
184constexpr auto models()
│ │ │ │ -
185{
│ │ │ │ -
186 return Std::bool_constant<Concept::Impl::models<C, T...>()>();
│ │ │ │ -
187}
│ │ │ │ -
│ │ │ │ -
188
│ │ │ │ -
189
│ │ │ │ -
190
│ │ │ │ -
191namespace Concept {
│ │ │ │ -
192
│ │ │ │ -
193#ifndef DOXYGEN
│ │ │ │ -
194
│ │ │ │ -
195namespace Impl {
│ │ │ │ -
196
│ │ │ │ -
197 // #############################################################################
│ │ │ │ -
198 // # All functions following here are implementation details for the
│ │ │ │ -
199 // # for the tupleEntriesModel() function below.
│ │ │ │ -
200 // #############################################################################
│ │ │ │ -
201
│ │ │ │ -
202 template<class C, class Tuple>
│ │ │ │ -
203 struct TupleEntriesModelHelper
│ │ │ │ -
204 {
│ │ │ │ -
205 template<class Accumulated, class T>
│ │ │ │ -
206 struct AccumulateFunctor
│ │ │ │ -
207 {
│ │ │ │ -
208 using type = typename std::integral_constant<bool, Accumulated::value and models<C, T>()>;
│ │ │ │ -
209 };
│ │ │ │ -
210 using Result = typename ReduceTuple<AccumulateFunctor, Tuple, std::true_type>::type;
│ │ │ │ -
211 };
│ │ │ │ -
212
│ │ │ │ -
213} // namespace Dune::Concept::Impl
│ │ │ │ -
214
│ │ │ │ -
215#endif // DOXYGEN
│ │ │ │ -
216
│ │ │ │ -
217
│ │ │ │ -
218// #############################################################################
│ │ │ │ -
219// # The method tupleEntriesModel() does the actual check if the types in a tuple
│ │ │ │ -
220// # model a concept using the implementation details above.
│ │ │ │ -
221// #############################################################################
│ │ │ │ -
222
│ │ │ │ -
223template<class C, class Tuple>
│ │ │ │ -
│ │ │ │ -
224constexpr auto tupleEntriesModel()
│ │ │ │ -
225 -> typename Impl::TupleEntriesModelHelper<C, Tuple>::Result
│ │ │ │ -
226{
│ │ │ │ -
227 return {};
│ │ │ │ -
228}
│ │ │ │ -
│ │ │ │ -
229
│ │ │ │ -
230// #############################################################################
│ │ │ │ -
231// # The following require*() functions are just helpers that allow to
│ │ │ │ -
232// # propagate a failed check as substitution failure. This is useful
│ │ │ │ -
233// # inside of a concept definition.
│ │ │ │ -
234// #############################################################################
│ │ │ │ -
235
│ │ │ │ -
236// Helper function for use in concept definitions.
│ │ │ │ -
237// If the passed value b is not true, the concept will to be satisfied.
│ │ │ │ -
238template<bool b, typename std::enable_if<b, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
239constexpr bool requireTrue()
│ │ │ │ -
240{
│ │ │ │ -
241 return true;
│ │ │ │ -
242}
│ │ │ │ -
│ │ │ │ -
243
│ │ │ │ -
244// Helper function for use in concept definitions.
│ │ │ │ -
245template<class C, class... T, typename std::enable_if<models<C, T...>(), int>::type = 0>
│ │ │ │ -
│ │ │ │ -
246constexpr bool requireConcept()
│ │ │ │ -
247{
│ │ │ │ -
248 return true;
│ │ │ │ -
249}
│ │ │ │ -
│ │ │ │ -
250
│ │ │ │ -
251// Helper function for use in concept definitions.
│ │ │ │ -
252// This allows to avoid using decltype
│ │ │ │ -
253template<class C, class... T, typename std::enable_if<models<C, T...>(), int>::type = 0>
│ │ │ │ -
│ │ │ │ -
254constexpr bool requireConcept(T&&... /*t*/)
│ │ │ │ -
255{
│ │ │ │ -
256 return true;
│ │ │ │ -
257}
│ │ │ │ -
│ │ │ │ -
258
│ │ │ │ -
259// Helper function for use in concept definitions.
│ │ │ │ -
260// This checks if the concept given as first type is modelled by all types in the tuple passed as argument
│ │ │ │ -
261template<class C, class Tuple, typename std::enable_if<tupleEntriesModel<C, Tuple>(), int>::type = 0>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
263{
│ │ │ │ -
264 return true;
│ │ │ │ -
265}
│ │ │ │ -
│ │ │ │ -
266
│ │ │ │ -
267// Helper function for use in concept definitions.
│ │ │ │ -
268// If the first passed type is not convertible to the second, the concept will not be satisfied.
│ │ │ │ -
269template<class From, class To,
│ │ │ │ -
270 typename std::enable_if< std::is_convertible<From, To>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
271constexpr bool requireConvertible()
│ │ │ │ -
272{
│ │ │ │ -
273 return true;
│ │ │ │ -
274}
│ │ │ │ -
│ │ │ │ -
275
│ │ │ │ -
276// Helper function for use in concept definitions.
│ │ │ │ -
277// If passed argument is not convertible to the first passed type, the concept will not be satisfied.
│ │ │ │ -
278template<class To, class From,
│ │ │ │ -
279 typename std::enable_if< std::is_convertible<From, To>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
280constexpr bool requireConvertible(const From&)
│ │ │ │ -
281{
│ │ │ │ -
282 return true;
│ │ │ │ -
283}
│ │ │ │ -
│ │ │ │ -
284
│ │ │ │ -
285// Helper function for use in concept definitions.
│ │ │ │ -
286// This will always evaluate to true. If just allow
│ │ │ │ -
287// to turn a type into an expression. The failure happens
│ │ │ │ -
288// already during substitution for the type argument.
│ │ │ │ -
289template<typename T>
│ │ │ │ -
│ │ │ │ -
290constexpr bool requireType()
│ │ │ │ -
291{
│ │ │ │ -
292 return true;
│ │ │ │ -
293}
│ │ │ │ -
│ │ │ │ -
294
│ │ │ │ -
295// Helper function for use in concept definitions.
│ │ │ │ -
296// If first passed type is not a base class of second type, the concept will not be satisfied.
│ │ │ │ -
297template<class Base, class Derived,
│ │ │ │ -
298 typename std::enable_if< std::is_base_of<Base, Derived>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
299constexpr bool requireBaseOf()
│ │ │ │ -
300{
│ │ │ │ -
301 return true;
│ │ │ │ -
302}
│ │ │ │ -
│ │ │ │ -
303
│ │ │ │ -
304// Helper function for use in concept definitions.
│ │ │ │ -
305// If first passed type is not a base class of first arguments type, the concept will not be satisfied.
│ │ │ │ -
306template<class Base, class Derived,
│ │ │ │ -
307 typename std::enable_if< std::is_base_of<Base, Derived>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
308constexpr bool requireBaseOf(const Derived&)
│ │ │ │ -
309{
│ │ │ │ -
310 return true;
│ │ │ │ -
311}
│ │ │ │ -
│ │ │ │ -
312
│ │ │ │ -
313// Helper function for use in concept definitions.
│ │ │ │ -
314// If the passed types are not the same, the concept will not be satisfied.
│ │ │ │ -
315template<class A, class B,
│ │ │ │ -
316 typename std::enable_if< std::is_same<A, B>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
317constexpr bool requireSameType()
│ │ │ │ -
318{
│ │ │ │ -
319 return true;
│ │ │ │ -
320}
│ │ │ │ -
│ │ │ │ -
321
│ │ │ │ -
322
│ │ │ │ -
323
│ │ │ │ -
324} // namespace Dune::Concept
│ │ │ │ -
325
│ │ │ │ -
328} // namespace Dune
│ │ │ │ -
329
│ │ │ │ -
330
│ │ │ │ -
331
│ │ │ │ -
332
│ │ │ │ -
333#endif // DUNE_COMMON_CONCEPT_HH
│ │ │ │ - │ │ │ │ -
Contains utility classes which can be used with std::tuple.
│ │ │ │ -
Utilities for type computations, constraining overloads, ...
│ │ │ │ - │ │ │ │ -
std::tuple< MetaType< T >... > TypeList
A simple type list.
Definition typelist.hh:87
│ │ │ │ -
constexpr auto models()
Check if concept is modeled by given types.
Definition concept.hh:184
│ │ │ │ +
114 LambdaVirtualFunction(const F& f)
│ │ │ │ +
115 : f_(f)
│ │ │ │ +
116 {}
│ │ │ │ +
117
│ │ │ │ +
118 void evaluate(const Domain& x, Range& y) const override
│ │ │ │ +
119 {
│ │ │ │ +
120 y = f_(x);
│ │ │ │ +
121 }
│ │ │ │ +
122
│ │ │ │ +
123 private:
│ │ │ │ +
124 const F f_;
│ │ │ │ +
125 };
│ │ │ │ + │ │ │ │ +
127
│ │ │ │ +
128 } /* namespace Impl */
│ │ │ │ +
129
│ │ │ │ +
149 template<typename Domain, typename Range, typename F>
│ │ │ │ +
150 [[deprecated("Dune::LambdaVirtualFunction is deprecated after Dune 2.7. "
│ │ │ │ +
151 "Use std::function instead!")]]
│ │ │ │ +
152 Impl::LambdaVirtualFunction< Domain, Range, std::decay_t<F> >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
154 {
│ │ │ │ +
155 return {std::forward<F>(f)};
│ │ │ │ +
156 }
│ │ │ │ +
│ │ │ │ +
157
│ │ │ │ +
160} // end namespace
│ │ │ │ +
161
│ │ │ │ +
162#endif
│ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
Definition of the DUNE_NO_DEPRECATED_* macros.
│ │ │ │ +
Impl::LambdaVirtualFunction< Domain, Range, std::decay_t< F > > makeVirtualFunction(F &&f)
make VirtualFunction out of a function object
Definition function.hh:153
│ │ │ │ +
#define DUNE_NO_DEPRECATED_END
Ignore deprecation warnings (end)
Definition deprecated.hh:38
│ │ │ │ +
#define DUNE_NO_DEPRECATED_BEGIN
Ignore deprecation warnings (start)
Definition deprecated.hh:32
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
constexpr bool requireConcept()
Definition concept.hh:246
│ │ │ │ -
constexpr bool requireTrue()
Definition concept.hh:239
│ │ │ │ -
constexpr bool requireSameType()
Definition concept.hh:317
│ │ │ │ -
constexpr auto tupleEntriesModel() -> typename Impl::TupleEntriesModelHelper< C, Tuple >::Result
Definition concept.hh:224
│ │ │ │ -
constexpr bool requireConceptForTupleEntries()
Definition concept.hh:262
│ │ │ │ -
constexpr bool requireBaseOf()
Definition concept.hh:299
│ │ │ │ -
constexpr bool requireConvertible()
Definition concept.hh:271
│ │ │ │ -
constexpr bool requireType()
Definition concept.hh:290
│ │ │ │ -
Base class for refined concepts.
Definition concept.hh:54
│ │ │ │ -
TypeList< BaseConcepts... > BaseConceptList
Definition concept.hh:55
│ │ │ │ -
Helper class for tagging priorities.
Definition typeutilities.hh:73
│ │ │ │ +
Base class template for function classes.
Definition function.hh:41
│ │ │ │ +
RawDomainType DomainType
Raw type of output variable with removed reference and constness.
Definition function.hh:51
│ │ │ │ +
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Function evaluation.
│ │ │ │ +
RawRangeType RangeType
Raw type of input variable with removed reference and constness.
Definition function.hh:48
│ │ │ │ +
Traits class containing raw types.
Definition function.hh:55
│ │ │ │ +
RawDomainType DomainType
Definition function.hh:56
│ │ │ │ +
RawRangeType RangeType
Definition function.hh:57
│ │ │ │ +
Virtual base class template for function classes.
Definition function.hh:87
│ │ │ │ +
Function< constDomainType &, RangeType & >::Traits Traits
Definition function.hh:89
│ │ │ │ +
virtual ~VirtualFunction()
Definition function.hh:91
│ │ │ │ +
virtual void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const =0
Function evaluation.
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,360 +1,174 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -concept.hh │ │ │ │ │ +function.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_CONCEPT_HH │ │ │ │ │ -6#define DUNE_COMMON_CONCEPT_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11 │ │ │ │ │ -12#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -13#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ -14#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_u_p_l_e_u_t_i_l_i_t_y_._h_h> │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ -16 │ │ │ │ │ -23namespace _D_u_n_e { │ │ │ │ │ -24 │ │ │ │ │ -_3_4namespace Concept { │ │ │ │ │ -35 │ │ │ │ │ -36 │ │ │ │ │ -37 │ │ │ │ │ -52template │ │ │ │ │ -_5_3struct _R_e_f_i_n_e_s │ │ │ │ │ -54{ │ │ │ │ │ -_5_5 typedef _T_y_p_e_L_i_s_t _B_a_s_e_C_o_n_c_e_p_t_L_i_s_t; │ │ │ │ │ -56}; │ │ │ │ │ -57 │ │ │ │ │ -58 │ │ │ │ │ -59#ifndef DOXYGEN │ │ │ │ │ -60 │ │ │ │ │ -61namespace Impl { │ │ │ │ │ -62 │ │ │ │ │ -63 / │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -64 // # All functions following here are implementation details │ │ │ │ │ -65 // # for the models() function below. │ │ │ │ │ -66 / │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -67 │ │ │ │ │ -68 // Forward declaration │ │ │ │ │ -69 template │ │ │ │ │ -70 constexpr bool _m_o_d_e_l_s(); │ │ │ │ │ -71 │ │ │ │ │ -72 │ │ │ │ │ -73 │ │ │ │ │ -74 // Here is the implementation of the concept checking. │ │ │ │ │ -75 // The first two overloads do the magic for checking │ │ │ │ │ -76 // if the requirements of a concept are satisfied. │ │ │ │ │ -77 // The rest is just for checking base concepts in case │ │ │ │ │ -78 // of refinement. │ │ │ │ │ -79 │ │ │ │ │ -80 // This overload is present if type substitution for │ │ │ │ │ -81 // C::require(T...) is successful, i.e., if the T... │ │ │ │ │ -82 // matches the requirement of C. In this case this │ │ │ │ │ -83 // overload is selected because PriorityTag<1> │ │ │ │ │ -84 // is a better match for PrioriryTag<42> than │ │ │ │ │ -85 // PriorityTag<0> in the default overload. │ │ │ │ │ -86 template().require(std::declval()...), 0) =0> │ │ │ │ │ -88 constexpr std::true_type matchesRequirement(_P_r_i_o_r_i_t_y_T_a_g_<_1_>) │ │ │ │ │ -89 { return {}; } │ │ │ │ │ +5#ifndef DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ +6#warning This file is deprecated after Dune 2.7! Use C++ function objects and │ │ │ │ │ +std::function stuff instead! │ │ │ │ │ +7#else // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ +8#undef DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ +9#endif // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ +10 │ │ │ │ │ +11#ifndef DUNE_FUNCTION_HH │ │ │ │ │ +_1_2#define DUNE_FUNCTION_HH │ │ │ │ │ +13 │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_p_r_e_c_a_t_e_d_._h_h> │ │ │ │ │ +17#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ +18 │ │ │ │ │ +19namespace _D_u_n_e { │ │ │ │ │ +20 │ │ │ │ │ +36 template │ │ │ │ │ +_3_7 class │ │ │ │ │ +38 [[deprecated("Dune::Function is deprecated after Dune 2.7. Use C++ " │ │ │ │ │ +39 "function objects instead!")]] │ │ │ │ │ +40 _F_u_n_c_t_i_o_n │ │ │ │ │ +41 { │ │ │ │ │ +42 typedef typename std::remove_cv:: │ │ │ │ │ +type >::type RawDomainType; │ │ │ │ │ +43 typedef typename std::remove_cv:: │ │ │ │ │ +type >::type RawRangeType; │ │ │ │ │ +44 │ │ │ │ │ +45 public: │ │ │ │ │ +46 │ │ │ │ │ +_4_8 typedef RawRangeType _R_a_n_g_e_T_y_p_e; │ │ │ │ │ +49 │ │ │ │ │ +_5_1 typedef RawDomainType _D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ +52 │ │ │ │ │ +_5_4 struct _T_r_a_i_t_s │ │ │ │ │ +55 { │ │ │ │ │ +_5_6 typedef RawDomainType _D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ +_5_7 typedef RawRangeType _R_a_n_g_e_T_y_p_e; │ │ │ │ │ +58 }; │ │ │ │ │ +59 │ │ │ │ │ +_6_6 void _e_v_a_l_u_a_t_e(const typename _T_r_a_i_t_s_:_:_D_o_m_a_i_n_T_y_p_e& x, typename _T_r_a_i_t_s_:_: │ │ │ │ │ +_R_a_n_g_e_T_y_p_e& y) const; │ │ │ │ │ +67 }; // end of Function class │ │ │ │ │ +68 │ │ │ │ │ +69 │ │ │ │ │ +70 │ │ │ │ │ +71 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___B_E_G_I_N │ │ │ │ │ +82 template │ │ │ │ │ +_8_3 class │ │ │ │ │ +84 [[deprecated("Dune::VirtualFunction is deprecated after Dune 2.7. Use C++ " │ │ │ │ │ +85 "function objects and std::function instead!")]] │ │ │ │ │ +86 _V_i_r_t_u_a_l_F_u_n_c_t_i_o_n : public _F_u_n_c_t_i_o_n_<_c_o_n_s_t_ _D_o_m_a_i_n_T_y_p_e_&_,_ _R_a_n_g_e_T_y_p_e_&_> │ │ │ │ │ +87 { │ │ │ │ │ +88 public: │ │ │ │ │ +_8_9 typedef typename _F_u_n_c_t_i_o_n_<_c_o_n_s_t_ _D_o_m_a_i_n_T_y_p_e_&_,_ _R_a_n_g_e_T_y_p_e_&_>_:_:_T_r_a_i_t_s _T_r_a_i_t_s; │ │ │ │ │ 90 │ │ │ │ │ -91 // If the above overload is ruled out by SFINAE because │ │ │ │ │ -92 // the T... does not match the requirements of C, then │ │ │ │ │ -93 // this default overload drops in. │ │ │ │ │ -94 template │ │ │ │ │ -95 constexpr std::false_type matchesRequirement(_P_r_i_o_r_i_t_y_T_a_g_<_0_>) │ │ │ │ │ -96 { return {}; } │ │ │ │ │ -97 │ │ │ │ │ -98 │ │ │ │ │ -99 │ │ │ │ │ -100 // An empty list C of concepts is always matched by T... │ │ │ │ │ -101 template │ │ │ │ │ -102 constexpr bool modelsConceptList(TypeList<>) │ │ │ │ │ -103 { return true; } │ │ │ │ │ -104 │ │ │ │ │ -105 // A nonempty list C0,..,CN of concepts is modeled │ │ │ │ │ -106 // by T... if it models the concept C0 │ │ │ │ │ -107 // and all concepts in the list C1,..,CN. │ │ │ │ │ -108 template │ │ │ │ │ -109 constexpr bool modelsConceptList(TypeList) │ │ │ │ │ -110 { return _m_o_d_e_l_s() and modelsConceptList(TypeList()); │ │ │ │ │ -} │ │ │ │ │ -111 │ │ │ │ │ -112 │ │ │ │ │ +_9_1 virtual _~_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n() {} │ │ │ │ │ +_9_8 virtual void _e_v_a_l_u_a_t_e(const typename _T_r_a_i_t_s_:_:_D_o_m_a_i_n_T_y_p_e& x, typename │ │ │ │ │ +_T_r_a_i_t_s_:_:_R_a_n_g_e_T_y_p_e& y) const = 0; │ │ │ │ │ +99 }; // end of VirtualFunction class │ │ │ │ │ +100 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___E_N_D │ │ │ │ │ +101 │ │ │ │ │ +102 namespace Impl { │ │ │ │ │ +103 │ │ │ │ │ +104 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___B_E_G_I_N │ │ │ │ │ +105 template │ │ │ │ │ +106 class LambdaVirtualFunction final │ │ │ │ │ +107 : public _V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ +108 { │ │ │ │ │ +109 public: │ │ │ │ │ +110 LambdaVirtualFunction(F&& f) │ │ │ │ │ +111 : f_(std::move(f)) │ │ │ │ │ +112 {} │ │ │ │ │ 113 │ │ │ │ │ -114 // If C is an unrefined concept, then T... models C │ │ │ │ │ -115 // if it matches the requirement of C. │ │ │ │ │ -116 template │ │ │ │ │ -117 constexpr bool modelsConcept(PriorityTag<0>) │ │ │ │ │ -118 { return matchesRequirement(PriorityTag<42>()); } │ │ │ │ │ -119 │ │ │ │ │ -120 // If C is a refined concept, then T... models C │ │ │ │ │ -121 // if it matches the requirement of C and of │ │ │ │ │ -122 // all base concepts. │ │ │ │ │ -123 // │ │ │ │ │ -124 // This overload is used if C::BaseConceptList exists │ │ │ │ │ -125 // due to its higher priority. │ │ │ │ │ -126 template │ │ │ │ │ -128 constexpr bool modelsConcept(PriorityTag<1>) │ │ │ │ │ -129 { return matchesRequirement(PriorityTag<42>()) and │ │ │ │ │ -modelsConceptList(typename C::BaseConceptList()); } │ │ │ │ │ -130 │ │ │ │ │ -131 // This is the full concept check. It's defined here in the │ │ │ │ │ -132 // implementation namespace with 'constexpr bool' return type │ │ │ │ │ -133 // because we need a forward declaration in order to use it │ │ │ │ │ -134 // internally above. │ │ │ │ │ -135 // │ │ │ │ │ -136 // The actual interface function can then call this one and │ │ │ │ │ -137 // return the result as std::integral_constant which │ │ │ │ │ -138 // does not allow for a forward declaration because the return │ │ │ │ │ -139 // type is deduced. │ │ │ │ │ -140 template │ │ │ │ │ -141 constexpr bool _m_o_d_e_l_s() │ │ │ │ │ -142 { │ │ │ │ │ -143 return modelsConcept(PriorityTag<42>()); │ │ │ │ │ -144 } │ │ │ │ │ -145 │ │ │ │ │ -146} // namespace Dune::Concept::Impl │ │ │ │ │ -147 │ │ │ │ │ -148#endif // DOXYGEN │ │ │ │ │ -149 │ │ │ │ │ -150} // namespace Dune::Concept │ │ │ │ │ -151 │ │ │ │ │ -152 │ │ │ │ │ -153 │ │ │ │ │ -183template │ │ │ │ │ -_1_8_4constexpr auto _m_o_d_e_l_s() │ │ │ │ │ -185{ │ │ │ │ │ -186 return Std::bool_constant()>(); │ │ │ │ │ -187} │ │ │ │ │ -188 │ │ │ │ │ -189 │ │ │ │ │ -190 │ │ │ │ │ -191namespace Concept { │ │ │ │ │ -192 │ │ │ │ │ -193#ifndef DOXYGEN │ │ │ │ │ -194 │ │ │ │ │ -195namespace Impl { │ │ │ │ │ -196 │ │ │ │ │ -197 / │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -198 // # All functions following here are implementation details for the │ │ │ │ │ -199 // # for the tupleEntriesModel() function below. │ │ │ │ │ -200 / │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -201 │ │ │ │ │ -202 template │ │ │ │ │ -203 struct TupleEntriesModelHelper │ │ │ │ │ -204 { │ │ │ │ │ -205 template │ │ │ │ │ -206 struct AccumulateFunctor │ │ │ │ │ -207 { │ │ │ │ │ -208 using type = typename std::integral_constant()>; │ │ │ │ │ -209 }; │ │ │ │ │ -210 using Result = typename ReduceTuple::type; │ │ │ │ │ -211 }; │ │ │ │ │ -212 │ │ │ │ │ -213} // namespace Dune::Concept::Impl │ │ │ │ │ -214 │ │ │ │ │ -215#endif // DOXYGEN │ │ │ │ │ -216 │ │ │ │ │ -217 │ │ │ │ │ -218/ │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -219// # The method tupleEntriesModel() does the actual check if the types in a │ │ │ │ │ -tuple │ │ │ │ │ -220// # model a concept using the implementation details above. │ │ │ │ │ -221/ │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -222 │ │ │ │ │ -223template │ │ │ │ │ -_2_2_4constexpr auto _t_u_p_l_e_E_n_t_r_i_e_s_M_o_d_e_l() │ │ │ │ │ -225 -> typename Impl::TupleEntriesModelHelper::Result │ │ │ │ │ -226{ │ │ │ │ │ -227 return {}; │ │ │ │ │ -228} │ │ │ │ │ -229 │ │ │ │ │ -230/ │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -231// # The following require*() functions are just helpers that allow to │ │ │ │ │ -232// # propagate a failed check as substitution failure. This is useful │ │ │ │ │ -233// # inside of a concept definition. │ │ │ │ │ -234/ │ │ │ │ │ -/ ############################################################################# │ │ │ │ │ -235 │ │ │ │ │ -236// Helper function for use in concept definitions. │ │ │ │ │ -237// If the passed value b is not true, the concept will to be satisfied. │ │ │ │ │ -238template::type = 0> │ │ │ │ │ -_2_3_9constexpr bool _r_e_q_u_i_r_e_T_r_u_e() │ │ │ │ │ -240{ │ │ │ │ │ -241 return true; │ │ │ │ │ -242} │ │ │ │ │ -243 │ │ │ │ │ -244// Helper function for use in concept definitions. │ │ │ │ │ -245template(), │ │ │ │ │ -int>::type = 0> │ │ │ │ │ -_2_4_6constexpr bool _r_e_q_u_i_r_e_C_o_n_c_e_p_t() │ │ │ │ │ -247{ │ │ │ │ │ -248 return true; │ │ │ │ │ -249} │ │ │ │ │ -250 │ │ │ │ │ -251// Helper function for use in concept definitions. │ │ │ │ │ -252// This allows to avoid using decltype │ │ │ │ │ -253template(), │ │ │ │ │ -int>::type = 0> │ │ │ │ │ -_2_5_4constexpr bool _r_e_q_u_i_r_e_C_o_n_c_e_p_t(T&&... /*t*/) │ │ │ │ │ -255{ │ │ │ │ │ -256 return true; │ │ │ │ │ -257} │ │ │ │ │ -258 │ │ │ │ │ -259// Helper function for use in concept definitions. │ │ │ │ │ -260// This checks if the concept given as first type is modelled by all types │ │ │ │ │ -in the tuple passed as argument │ │ │ │ │ -261template(), int>::type = 0> │ │ │ │ │ -_2_6_2constexpr bool _r_e_q_u_i_r_e_C_o_n_c_e_p_t_F_o_r_T_u_p_l_e_E_n_t_r_i_e_s() │ │ │ │ │ -263{ │ │ │ │ │ -264 return true; │ │ │ │ │ -265} │ │ │ │ │ -266 │ │ │ │ │ -267// Helper function for use in concept definitions. │ │ │ │ │ -268// If the first passed type is not convertible to the second, the concept │ │ │ │ │ -will not be satisfied. │ │ │ │ │ -269template::value, int>::type = │ │ │ │ │ -0> │ │ │ │ │ -_2_7_1constexpr bool _r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e() │ │ │ │ │ -272{ │ │ │ │ │ -273 return true; │ │ │ │ │ -274} │ │ │ │ │ -275 │ │ │ │ │ -276// Helper function for use in concept definitions. │ │ │ │ │ -277// If passed argument is not convertible to the first passed type, the │ │ │ │ │ -concept will not be satisfied. │ │ │ │ │ -278template::value, int>::type = │ │ │ │ │ -0> │ │ │ │ │ -_2_8_0constexpr bool _r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e(const From&) │ │ │ │ │ -281{ │ │ │ │ │ -282 return true; │ │ │ │ │ -283} │ │ │ │ │ -284 │ │ │ │ │ -285// Helper function for use in concept definitions. │ │ │ │ │ -286// This will always evaluate to true. If just allow │ │ │ │ │ -287// to turn a type into an expression. The failure happens │ │ │ │ │ -288// already during substitution for the type argument. │ │ │ │ │ -289template │ │ │ │ │ -_2_9_0constexpr bool _r_e_q_u_i_r_e_T_y_p_e() │ │ │ │ │ -291{ │ │ │ │ │ -292 return true; │ │ │ │ │ -293} │ │ │ │ │ -294 │ │ │ │ │ -295// Helper function for use in concept definitions. │ │ │ │ │ -296// If first passed type is not a base class of second type, the concept will │ │ │ │ │ -not be satisfied. │ │ │ │ │ -297template::value, int>::type │ │ │ │ │ -= 0> │ │ │ │ │ -_2_9_9constexpr bool _r_e_q_u_i_r_e_B_a_s_e_O_f() │ │ │ │ │ -300{ │ │ │ │ │ -301 return true; │ │ │ │ │ -302} │ │ │ │ │ -303 │ │ │ │ │ -304// Helper function for use in concept definitions. │ │ │ │ │ -305// If first passed type is not a base class of first arguments type, the │ │ │ │ │ -concept will not be satisfied. │ │ │ │ │ -306template::value, int>::type │ │ │ │ │ -= 0> │ │ │ │ │ -_3_0_8constexpr bool _r_e_q_u_i_r_e_B_a_s_e_O_f(const Derived&) │ │ │ │ │ -309{ │ │ │ │ │ -310 return true; │ │ │ │ │ -311} │ │ │ │ │ -312 │ │ │ │ │ -313// Helper function for use in concept definitions. │ │ │ │ │ -314// If the passed types are not the same, the concept will not be satisfied. │ │ │ │ │ -315template::value, int>::type = 0> │ │ │ │ │ -_3_1_7constexpr bool _r_e_q_u_i_r_e_S_a_m_e_T_y_p_e() │ │ │ │ │ -318{ │ │ │ │ │ -319 return true; │ │ │ │ │ -320} │ │ │ │ │ -321 │ │ │ │ │ -322 │ │ │ │ │ -323 │ │ │ │ │ -324} // namespace Dune::Concept │ │ │ │ │ -325 │ │ │ │ │ -328} // namespace Dune │ │ │ │ │ -329 │ │ │ │ │ -330 │ │ │ │ │ -331 │ │ │ │ │ -332 │ │ │ │ │ -333#endif // DUNE_COMMON_CONCEPT_HH │ │ │ │ │ -_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ -_t_u_p_l_e_u_t_i_l_i_t_y_._h_h │ │ │ │ │ -Contains utility classes which can be used with std::tuple. │ │ │ │ │ -_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for type computations, constraining overloads, ... │ │ │ │ │ -_t_y_p_e_l_i_s_t_._h_h │ │ │ │ │ -_D_u_n_e_:_:_T_y_p_e_L_i_s_t │ │ │ │ │ -std::tuple< MetaType< T >... > TypeList │ │ │ │ │ -A simple type list. │ │ │ │ │ -DDeeffiinniittiioonn typelist.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_m_o_d_e_l_s │ │ │ │ │ -constexpr auto models() │ │ │ │ │ -Check if concept is modeled by given types. │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:184 │ │ │ │ │ +114 LambdaVirtualFunction(const F& f) │ │ │ │ │ +115 : f_(f) │ │ │ │ │ +116 {} │ │ │ │ │ +117 │ │ │ │ │ +118 void evaluate(const Domain& x, Range& y) const override │ │ │ │ │ +119 { │ │ │ │ │ +120 y = f_(x); │ │ │ │ │ +121 } │ │ │ │ │ +122 │ │ │ │ │ +123 private: │ │ │ │ │ +124 const F f_; │ │ │ │ │ +125 }; │ │ │ │ │ +126 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___E_N_D │ │ │ │ │ +127 │ │ │ │ │ +128 } /* namespace Impl */ │ │ │ │ │ +129 │ │ │ │ │ +149 template │ │ │ │ │ +150 [[deprecated("Dune::LambdaVirtualFunction is deprecated after Dune 2.7. " │ │ │ │ │ +151 "Use std::function instead!")]] │ │ │ │ │ +152 Impl::LambdaVirtualFunction< Domain, Range, std::decay_t > │ │ │ │ │ +_1_5_3 _m_a_k_e_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n(F&& f) │ │ │ │ │ +154 { │ │ │ │ │ +155 return {std::forward(f)}; │ │ │ │ │ +156 } │ │ │ │ │ +157 │ │ │ │ │ +160} // end namespace │ │ │ │ │ +161 │ │ │ │ │ +162#endif │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_d_e_p_r_e_c_a_t_e_d_._h_h │ │ │ │ │ +Definition of the DUNE_NO_DEPRECATED_* macros. │ │ │ │ │ +_D_u_n_e_:_:_m_a_k_e_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ +Impl::LambdaVirtualFunction< Domain, Range, std::decay_t< F > > │ │ │ │ │ +makeVirtualFunction(F &&f) │ │ │ │ │ +make VirtualFunction out of a function object │ │ │ │ │ +DDeeffiinniittiioonn function.hh:153 │ │ │ │ │ +_D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___E_N_D │ │ │ │ │ +#define DUNE_NO_DEPRECATED_END │ │ │ │ │ +Ignore deprecation warnings (end) │ │ │ │ │ +DDeeffiinniittiioonn deprecated.hh:38 │ │ │ │ │ +_D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___B_E_G_I_N │ │ │ │ │ +#define DUNE_NO_DEPRECATED_BEGIN │ │ │ │ │ +Ignore deprecation warnings (start) │ │ │ │ │ +DDeeffiinniittiioonn deprecated.hh:32 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_c_e_p_t │ │ │ │ │ -constexpr bool requireConcept() │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:246 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_T_r_u_e │ │ │ │ │ -constexpr bool requireTrue() │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:239 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_S_a_m_e_T_y_p_e │ │ │ │ │ -constexpr bool requireSameType() │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:317 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_t_u_p_l_e_E_n_t_r_i_e_s_M_o_d_e_l │ │ │ │ │ -constexpr auto tupleEntriesModel() -> typename Impl::TupleEntriesModelHelper< │ │ │ │ │ -C, Tuple >::Result │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:224 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_c_e_p_t_F_o_r_T_u_p_l_e_E_n_t_r_i_e_s │ │ │ │ │ -constexpr bool requireConceptForTupleEntries() │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:262 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_B_a_s_e_O_f │ │ │ │ │ -constexpr bool requireBaseOf() │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e │ │ │ │ │ -constexpr bool requireConvertible() │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_r_e_q_u_i_r_e_T_y_p_e │ │ │ │ │ -constexpr bool requireType() │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:290 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_R_e_f_i_n_e_s │ │ │ │ │ -Base class for refined concepts. │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_R_e_f_i_n_e_s_:_:_B_a_s_e_C_o_n_c_e_p_t_L_i_s_t │ │ │ │ │ -TypeList< BaseConcepts... > BaseConceptList │ │ │ │ │ -DDeeffiinniittiioonn concept.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g │ │ │ │ │ -Helper class for tagging priorities. │ │ │ │ │ -DDeeffiinniittiioonn typeutilities.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_F_u_n_c_t_i_o_n │ │ │ │ │ +Base class template for function classes. │ │ │ │ │ +DDeeffiinniittiioonn function.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_D_o_m_a_i_n_T_y_p_e │ │ │ │ │ +RawDomainType DomainType │ │ │ │ │ +Raw type of output variable with removed reference and constness. │ │ │ │ │ +DDeeffiinniittiioonn function.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_e_v_a_l_u_a_t_e │ │ │ │ │ +void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType │ │ │ │ │ +&y) const │ │ │ │ │ +Function evaluation. │ │ │ │ │ +_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_R_a_n_g_e_T_y_p_e │ │ │ │ │ +RawRangeType RangeType │ │ │ │ │ +Raw type of input variable with removed reference and constness. │ │ │ │ │ +DDeeffiinniittiioonn function.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s │ │ │ │ │ +Traits class containing raw types. │ │ │ │ │ +DDeeffiinniittiioonn function.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s_:_:_D_o_m_a_i_n_T_y_p_e │ │ │ │ │ +RawDomainType DomainType │ │ │ │ │ +DDeeffiinniittiioonn function.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s_:_:_R_a_n_g_e_T_y_p_e │ │ │ │ │ +RawRangeType RangeType │ │ │ │ │ +DDeeffiinniittiioonn function.hh:57 │ │ │ │ │ +_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ +Virtual base class template for function classes. │ │ │ │ │ +DDeeffiinniittiioonn function.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s │ │ │ │ │ +Function< constDomainType &, RangeType & >::Traits Traits │ │ │ │ │ +DDeeffiinniittiioonn function.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_:_:_~_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ +virtual ~VirtualFunction() │ │ │ │ │ +DDeeffiinniittiioonn function.hh:91 │ │ │ │ │ +_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_:_:_e_v_a_l_u_a_t_e │ │ │ │ │ +virtual void evaluate(const typename Traits::DomainType &x, typename Traits:: │ │ │ │ │ +RangeType &y) const =0 │ │ │ │ │ +Function evaluation. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00050.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: defaults.hh File Reference │ │ │ │ +dune-common: mpifuture.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,127 +65,51 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces
│ │ │ │ - │ │ │ │ +
mpifuture.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

Default implementations for SIMD Implementations. │ │ │ │ -More...

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <cstddef>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ │ -#include <dune/common/simd/base.hh>
│ │ │ │ -#include <dune/common/simd/interface.hh>
│ │ │ │ -#include <dune/common/typelist.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ +
#include <optional>
│ │ │ │ +#include <dune/common/parallel/communication.hh>
│ │ │ │ +#include <dune/common/parallel/future.hh>
│ │ │ │ +#include <dune/common/parallel/mpidata.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

struct  Dune::impl::Buffer< T >
 
struct  Dune::impl::Buffer< T & >
 
struct  Dune::impl::Buffer< void >
 
class  Dune::MPIFuture< R, S >
 Provides a future-like object for MPI communication. It contains the object that will be received and might contain also a sending object, which must be hold (keep alive) until the communication has been completed. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Simd
 Namespace for vectorization interface functions used by library developers.
namespace  Dune::impl
 
namespace  Dune::Simd::Overloads
 Namespace for the overloads and specializations that make up a SIMD implementation.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

Overloadable and default functions

This group contains functions that you, as an abstraction developer, must implement. All functions that are deleted must be provided, functions that have a default implementation may be left unimplemented if the default behaviour is satisfactory.

│ │ │ │ -
template<class V >
decltype(auto) Dune::Simd::Overloads::lane (ADLTag< 0 >, std::size_t l, V v)=delete
 implements Simd::lane()
 
template<class V >
constexpr V Dune::Simd::Overloads::implCast (ADLTag< 0 >, MetaType< V >, const V &u)
 implements Simd::implCast<V>(V)
 
template<class V , class U >
constexpr V Dune::Simd::Overloads::implCast (ADLTag< 0 >, MetaType< V >, const U &u)
 implements Simd::implCast<V>(U)
 
template<class V , class S >
auto Dune::Simd::Overloads::broadcast (ADLTag< 0 >, MetaType< V >, S s)
 implements Simd::broadcast<V>()
 
template<class V >
Dune::Simd::Overloads::cond (ADLTag< 0 >, const Mask< V > &mask, const V &ifTrue, const V &ifFalse)=delete
 implements Simd::cond()
 
template<class V >
auto Dune::Simd::Overloads::max (ADLTag< 0 >, const V &v1, const V &v2)
 implements binary Simd::max()
 
template<class V >
auto Dune::Simd::Overloads::min (ADLTag< 0 >, const V &v1, const V &v2)
 implements binary Simd::min()
 
template<class Mask >
bool Dune::Simd::Overloads::anyTrue (ADLTag< 0 >, const Mask &mask)=delete
 implements Simd::anyTrue()
 
template<class Mask >
bool Dune::Simd::Overloads::allTrue (ADLTag< 0 >, const Mask &mask)
 implements Simd::allTrue()
 
template<class Mask >
bool Dune::Simd::Overloads::anyFalse (ADLTag< 0 >, const Mask &mask)
 implements Simd::anyFalse()
 
template<class Mask >
bool Dune::Simd::Overloads::allFalse (ADLTag< 0 >, const Mask &mask)
 implements Simd::allFalse()
 
template<class V >
auto Dune::Simd::Overloads::max (ADLTag< 0 >, const V &v)
 implements Simd::maxValue()
 
template<class V >
auto Dune::Simd::Overloads::min (ADLTag< 0 >, const V &v)
 implements Simd::minValue()
 
template<class V >
Mask< V > Dune::Simd::Overloads::mask (ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
 implements Simd::mask()
 
template<class V >
auto Dune::Simd::Overloads::mask (ADLTag< 0, !std::is_same< V, Mask< V > >::value >, const V &v)
 implements Simd::mask()
 
template<class V1 , class V2 >
auto Dune::Simd::Overloads::maskOr (ADLTag< 0 >, const V1 &v1, const V2 &v2)
 implements Simd::maskOr()
 
template<class V1 , class V2 >
auto Dune::Simd::Overloads::maskAnd (ADLTag< 0 >, const V1 &v1, const V2 &v2)
 implements Simd::maskAnd()
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Default implementations for SIMD Implementations.

│ │ │ │ -

This file provides default overloads for SIMD implementation functions, and deleted placeholders where there are no default implementations.

│ │ │ │ -

This file should never be included by users of the SIMD abstraction. Include <dune/common/simd/simd.hh> instead.

│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,126 +1,35 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -defaults.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _A_b_s_t_r_a_c_t_i_o_n_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e │ │ │ │ │ -Default implementations for SIMD Implementations. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +mpifuture.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._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_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_<_ _R_,_ _S_ _> │ │ │ │ │ + Provides a future-like object for MPI communication. It contains the │ │ │ │ │ +  object that will be received and might contain also a sending object, │ │ │ │ │ + which must be hold (keep alive) until the communication has been │ │ │ │ │ + completed. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ -  Namespace for vectorization interface functions used by library │ │ │ │ │ - developers. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ -  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ - implementation. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -Overloadable and default functions │ │ │ │ │ -This group contains functions that you, as an abstraction developer, must │ │ │ │ │ -implement. All functions that are deleted must be provided, functions that have │ │ │ │ │ -a default implementation may be left unimplemented if the default behaviour is │ │ │ │ │ -satisfactory. │ │ │ │ │ -template │ │ │ │ │ -decltype(auto)  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 0 >, std::size_t l, V │ │ │ │ │ - v)=delete │ │ │ │ │ -  implements _S_i_m_d_:_:_l_a_n_e_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_i_m_p_l_C_a_s_t (_A_D_L_T_a_g< 0 >, _M_e_t_a_T_y_p_e< V >, │ │ │ │ │ - const V &u) │ │ │ │ │ -  implements Simd::implCast(V) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_i_m_p_l_C_a_s_t (_A_D_L_T_a_g< 0 >, _M_e_t_a_T_y_p_e< V >, │ │ │ │ │ - const U &u) │ │ │ │ │ -  implements Simd::implCast(U) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_b_r_o_a_d_c_a_s_t (_A_D_L_T_a_g< 0 >, _M_e_t_a_T_y_p_e< V >, S │ │ │ │ │ - s) │ │ │ │ │ -  implements _S_i_m_d_:_:_b_r_o_a_d_c_a_s_t_<_V_>_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d (_A_D_L_T_a_g< 0 >, const _M_a_s_k< V > │ │ │ │ │ - &_m_a_s_k, const V &ifTrue, const V &ifFalse)=delete │ │ │ │ │ -  implements _S_i_m_d_:_:_c_o_n_d_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_x (_A_D_L_T_a_g< 0 >, const V &v1, const V │ │ │ │ │ - &v2) │ │ │ │ │ -  implements binary _S_i_m_d_:_:_m_a_x_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_i_n (_A_D_L_T_a_g< 0 >, const V &v1, const V │ │ │ │ │ - &v2) │ │ │ │ │ -  implements binary _S_i_m_d_:_:_m_i_n_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k │ │ │ │ │ - &_m_a_s_k)=delete │ │ │ │ │ -  implements _S_i_m_d_:_:_a_n_y_T_r_u_e_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ -  implements _S_i_m_d_:_:_a_l_l_T_r_u_e_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ -  implements _S_i_m_d_:_:_a_n_y_F_a_l_s_e_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ -  implements _S_i_m_d_:_:_a_l_l_F_a_l_s_e_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_x (_A_D_L_T_a_g< 0 >, const V &v) │ │ │ │ │ -  implements Simd::maxValue() │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_i_n (_A_D_L_T_a_g< 0 >, const V &v) │ │ │ │ │ -  implements Simd::minValue() │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - _M_a_s_k< V >  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k (_A_D_L_T_a_g< 0, std::is_same< V, _M_a_s_k< │ │ │ │ │ - V > >::value >, const V &v) │ │ │ │ │ -  implements _S_i_m_d_:_:_m_a_s_k_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k (_A_D_L_T_a_g< 0, !std::is_same< V, _M_a_s_k< │ │ │ │ │ - V > >::value >, const V &v) │ │ │ │ │ -  implements _S_i_m_d_:_:_m_a_s_k_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_O_r (_A_D_L_T_a_g< 0 >, const V1 &v1, const │ │ │ │ │ - V2 &v2) │ │ │ │ │ -  implements _S_i_m_d_:_:_m_a_s_k_O_r_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_A_n_d (_A_D_L_T_a_g< 0 >, const V1 &v1, │ │ │ │ │ - const V2 &v2) │ │ │ │ │ -  implements _S_i_m_d_:_:_m_a_s_k_A_n_d_(_) │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Default implementations for SIMD Implementations. │ │ │ │ │ -This file provides default overloads for SIMD implementation functions, and │ │ │ │ │ -deleted placeholders where there are no default implementations. │ │ │ │ │ -This file should never be included by users of the SIMD abstraction. Include │ │ │ │ │ -<_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> instead. │ │ │ │ │ +namespace   _D_u_n_e_:_:_i_m_p_l │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: defaults.hh Source File │ │ │ │ +dune-common: mpifuture.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,215 +70,290 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
defaults.hh
│ │ │ │ +
mpifuture.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_DEFAULTS_HH
│ │ │ │ -
4#define DUNE_COMMON_SIMD_DEFAULTS_HH
│ │ │ │ -
5
│ │ │ │ -
17#include <algorithm>
│ │ │ │ -
18#include <cstddef>
│ │ │ │ -
19#include <type_traits>
│ │ │ │ -
20
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
26
│ │ │ │ -
27namespace Dune {
│ │ │ │ -
28 namespace Simd {
│ │ │ │ -
29 namespace Overloads {
│ │ │ │ -
30
│ │ │ │ -
47 template<class V>
│ │ │ │ -
48 decltype(auto) lane(ADLTag<0>, std::size_t l, V v) = delete;
│ │ │ │ -
49
│ │ │ │ -
51 template<class V>
│ │ │ │ -
│ │ │ │ -
52 constexpr V implCast(ADLTag<0>, MetaType<V>, const V &u)
│ │ │ │ -
53 {
│ │ │ │ -
54 return u;
│ │ │ │ -
55 }
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ +
5#ifndef DUNE_COMMON_PARALLEL_MPIFUTURE_HH
│ │ │ │ +
6#define DUNE_COMMON_PARALLEL_MPIFUTURE_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <optional>
│ │ │ │ +
9
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
13
│ │ │ │ +
14#if HAVE_MPI
│ │ │ │ +
15namespace Dune{
│ │ │ │ +
16
│ │ │ │ +
│ │ │ │ +
17 namespace impl{
│ │ │ │ +
18 template<class T>
│ │ │ │ +
│ │ │ │ +
19 struct Buffer{
│ │ │ │ +
│ │ │ │ +
20 Buffer(bool valid){
│ │ │ │ +
21 if(valid)
│ │ │ │ +
22 value = std::make_unique<T>();
│ │ │ │ +
23 }
│ │ │ │ +
│ │ │ │ +
24 template<class V>
│ │ │ │ +
│ │ │ │ +
25 Buffer(V&& t)
│ │ │ │ +
26 : value(std::make_unique<T>(std::forward<V>(t)))
│ │ │ │ +
27 {}
│ │ │ │ +
│ │ │ │ +
28 std::unique_ptr<T> value;
│ │ │ │ +
│ │ │ │ +
29 T get(){
│ │ │ │ +
30 T tmp = std::move(*value);
│ │ │ │ +
31 value.reset();
│ │ │ │ +
32 return tmp;
│ │ │ │ +
33 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
34 operator bool () const {
│ │ │ │ +
35 return (bool)value;
│ │ │ │ +
36 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
37 T& operator *() const{
│ │ │ │ +
38 return *value;
│ │ │ │ +
39 }
│ │ │ │ +
│ │ │ │ +
40 };
│ │ │ │ +
│ │ │ │ +
41
│ │ │ │ +
42 template<class T>
│ │ │ │ +
│ │ │ │ +
43 struct Buffer<T&>{
│ │ │ │ +
│ │ │ │ +
44 Buffer(bool valid = false)
│ │ │ │ +
45 {
│ │ │ │ +
46 if(valid)
│ │ │ │ +
47 value = T();
│ │ │ │ +
48 }
│ │ │ │ +
│ │ │ │ +
49 template<class V>
│ │ │ │ +
│ │ │ │ +
50 Buffer(V&& t)
│ │ │ │ +
51 : value(std::forward<V>(t))
│ │ │ │ +
52 {}
│ │ │ │ +
│ │ │ │ +
53 std::optional<std::reference_wrapper<T>> value;
│ │ │ │ +
│ │ │ │ +
54 T& get(){
│ │ │ │ +
55 T& tmp = *value;
│ │ │ │ +
56 value.reset();
│ │ │ │ +
57 return tmp;
│ │ │ │ +
58 }
│ │ │ │
│ │ │ │ -
56
│ │ │ │ -
58 template<class V, class U>
│ │ │ │
│ │ │ │ -
59 constexpr V implCast(ADLTag<0>, MetaType<V>, const U &u)
│ │ │ │ -
60 {
│ │ │ │ -
61 V result(Simd::Scalar<V>(0));
│ │ │ │ -
62 for(auto l : range(Simd::lanes(u)))
│ │ │ │ -
63 Simd::lane(l, result) = Simd::lane(l, u);
│ │ │ │ -
64 return result;
│ │ │ │ -
65 }
│ │ │ │ +
59 operator bool () const{
│ │ │ │ +
60 return (bool)value;
│ │ │ │ +
61 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
62 T& operator *() const{
│ │ │ │ +
63 return *value;
│ │ │ │ +
64 }
│ │ │ │ +
│ │ │ │ +
65 };
│ │ │ │
│ │ │ │
66
│ │ │ │ -
68 template<class V, class S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
70 {
│ │ │ │ -
71 return V(Simd::Scalar<V>(s));
│ │ │ │ -
72 }
│ │ │ │ -
│ │ │ │ -
73
│ │ │ │ -
75 template<class V>
│ │ │ │ - │ │ │ │ -
77 const V &ifTrue, const V &ifFalse) = delete;
│ │ │ │ -
78
│ │ │ │ -
80 template<class V>
│ │ │ │ -
│ │ │ │ -
81 auto max(ADLTag<0>, const V &v1, const V &v2)
│ │ │ │ -
82 {
│ │ │ │ -
83 using std::max;
│ │ │ │ -
84 return max(v1, v2);
│ │ │ │ -
85 }
│ │ │ │ -
│ │ │ │ -
86
│ │ │ │ -
88 template<class V>
│ │ │ │ -
│ │ │ │ -
89 auto min(ADLTag<0>, const V &v1, const V &v2)
│ │ │ │ -
90 {
│ │ │ │ -
91 using std::min;
│ │ │ │ -
92 return min(v1, v2);
│ │ │ │ -
93 }
│ │ │ │ -
│ │ │ │ -
94
│ │ │ │ -
96 template<class Mask>
│ │ │ │ -
97 bool anyTrue(ADLTag<0>, const Mask &mask) = delete;
│ │ │ │ -
98
│ │ │ │ -
100
│ │ │ │ -
103 template<class Mask>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
105 {
│ │ │ │ -
106 return !Dune::Simd::anyTrue(!mask);
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
110
│ │ │ │ -
113 template<class Mask>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
115 {
│ │ │ │ -
116 return Dune::Simd::anyTrue(!mask);
│ │ │ │ -
117 }
│ │ │ │ -
│ │ │ │ -
118
│ │ │ │ -
120
│ │ │ │ -
123 template<class Mask>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
125 {
│ │ │ │ -
126 return !Dune::Simd::anyTrue(mask);
│ │ │ │ -
127 }
│ │ │ │ +
67 template<>
│ │ │ │ +
│ │ │ │ +
68 struct Buffer<void>{
│ │ │ │ +
69 bool valid_;
│ │ │ │ +
│ │ │ │ +
70 Buffer(bool valid = false)
│ │ │ │ +
71 : valid_(valid)
│ │ │ │ +
72 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
73 operator bool () const{
│ │ │ │ +
74 return valid_;
│ │ │ │ +
75 }
│ │ │ │ +
│ │ │ │ +
76 void get(){}
│ │ │ │ +
77 };
│ │ │ │ +
│ │ │ │ +
78 }
│ │ │ │ +
│ │ │ │ +
79
│ │ │ │ +
84 template<class R, class S = void>
│ │ │ │ +
│ │ │ │ +
85 class MPIFuture{
│ │ │ │ +
86 mutable MPI_Request req_;
│ │ │ │ +
87 mutable MPI_Status status_;
│ │ │ │ +
88 impl::Buffer<R> data_;
│ │ │ │ +
89 impl::Buffer<S> send_data_;
│ │ │ │ +
90 friend class Communication<MPI_Comm>;
│ │ │ │ +
91 public:
│ │ │ │ +
│ │ │ │ +
92 MPIFuture(bool valid = false)
│ │ │ │ +
93 : req_(MPI_REQUEST_NULL)
│ │ │ │ +
94 , data_(valid)
│ │ │ │ +
95 {}
│ │ │ │ +
│ │ │ │ +
96
│ │ │ │ +
97 // Hide this constructor if R or S is void
│ │ │ │ +
98 template<class V = R, class U = S>
│ │ │ │ +
│ │ │ │ +
99 MPIFuture(V&& recv_data, U&& send_data, typename std::enable_if_t<!std::is_void<V>::value && !std::is_void<U>::value>* = 0) :
│ │ │ │ +
100 req_(MPI_REQUEST_NULL)
│ │ │ │ +
101 , data_(std::forward<R>(recv_data))
│ │ │ │ +
102 , send_data_(std::forward<S>(send_data))
│ │ │ │ +
103 {}
│ │ │ │ +
│ │ │ │ +
104
│ │ │ │ +
105 // hide this constructor if R is void
│ │ │ │ +
106 template<class V = R>
│ │ │ │ +
│ │ │ │ +
107 MPIFuture(V&& recv_data, typename std::enable_if_t<!std::is_void<V>::value>* = 0)
│ │ │ │ +
108 : req_(MPI_REQUEST_NULL)
│ │ │ │ +
109 , data_(std::forward<V>(recv_data))
│ │ │ │ +
110 {}
│ │ │ │ +
│ │ │ │ +
111
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
113 if(req_ != MPI_REQUEST_NULL){
│ │ │ │ +
114 try{ // might fail when it is a collective communication
│ │ │ │ +
115 MPI_Cancel(&req_);
│ │ │ │ +
116 MPI_Request_free(&req_);
│ │ │ │ +
117 }catch(...){
│ │ │ │ +
118 }
│ │ │ │ +
119 }
│ │ │ │ +
120 }
│ │ │ │ +
│ │ │ │ +
121
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
123 : req_(MPI_REQUEST_NULL)
│ │ │ │ +
124 , data_(std::move(f.data_))
│ │ │ │ +
125 , send_data_(std::move(f.send_data_))
│ │ │ │ +
126 {
│ │ │ │ +
127 std::swap(req_, f.req_);
│ │ │ │ +
128 std::swap(status_, f.status_);
│ │ │ │ +
129 }
│ │ │ │
│ │ │ │ -
128
│ │ │ │ -
130 template<class V>
│ │ │ │ +
130
│ │ │ │
│ │ │ │ -
131 auto max(ADLTag<0>, const V &v)
│ │ │ │ -
132 {
│ │ │ │ -
133 Scalar<V> m = Simd::lane(0, v);
│ │ │ │ -
134 for(std::size_t l = 1; l < Simd::lanes(v); ++l)
│ │ │ │ -
135 if(m < Simd::lane(l, v))
│ │ │ │ -
136 m = Simd::lane(l, v);
│ │ │ │ -
137 return m;
│ │ │ │ -
138 }
│ │ │ │ -
│ │ │ │ -
139
│ │ │ │ -
141 template<class V>
│ │ │ │ -
│ │ │ │ -
142 auto min(ADLTag<0>, const V &v)
│ │ │ │ -
143 {
│ │ │ │ -
144 Scalar<V> m = Simd::lane(0, v);
│ │ │ │ -
145 for(std::size_t l = 1; l < Simd::lanes(v); ++l)
│ │ │ │ -
146 if(Simd::lane(l, v) < m)
│ │ │ │ -
147 m = Simd::lane(l, v);
│ │ │ │ -
148 return m;
│ │ │ │ -
149 }
│ │ │ │ -
│ │ │ │ -
150
│ │ │ │ -
152 template<class V>
│ │ │ │ -
│ │ │ │ -
153 Mask<V> mask(ADLTag<0, std::is_same<V, Mask<V> >::value>,
│ │ │ │ -
154 const V &v)
│ │ │ │ -
155 {
│ │ │ │ -
156 return v;
│ │ │ │ -
157 }
│ │ │ │ -
│ │ │ │ -
158
│ │ │ │ -
160 template<class V>
│ │ │ │ -
│ │ │ │ -
161 auto mask(ADLTag<0, !std::is_same<V, Mask<V> >::value>,
│ │ │ │ -
162 const V &v)
│ │ │ │ -
163 {
│ │ │ │ -
164 using Copy = AutonomousValue<V>; // just in case we are handed a proxy
│ │ │ │ -
165 return v != Copy(Scalar<Copy>(0));
│ │ │ │ -
166 }
│ │ │ │ -
│ │ │ │ -
167
│ │ │ │ -
169 template<class V1, class V2>
│ │ │ │ -
│ │ │ │ -
170 auto maskOr(ADLTag<0>, const V1 &v1, const V2 &v2)
│ │ │ │ -
171 {
│ │ │ │ -
172 return Simd::mask(v1) || Simd::mask(v2);
│ │ │ │ -
173 }
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
176 template<class V1, class V2>
│ │ │ │ -
│ │ │ │ -
177 auto maskAnd(ADLTag<0>, const V1 &v1, const V2 &v2)
│ │ │ │ -
178 {
│ │ │ │ -
179 return Simd::mask(v1) && Simd::mask(v2);
│ │ │ │ -
180 }
│ │ │ │ -
│ │ │ │ -
181
│ │ │ │ -
184 } // namespace Overloads
│ │ │ │ -
185 } // namespace Simd
│ │ │ │ -
186} // namespace Dune
│ │ │ │ -
187
│ │ │ │ -
188#endif // DUNE_COMMON_SIMD_DEFAULTS_HH
│ │ │ │ -
Basic definitions for SIMD Implementations.
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Utilities for reduction like operations on ranges.
│ │ │ │ - │ │ │ │ -
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:300
│ │ │ │ -
typename AutonomousValueType< T >::type AutonomousValue
Type free of internal references that T can be converted to.
Definition typetraits.hh:558
│ │ │ │ -
bool anyTrue(const Mask &mask)
Whether any entry is true
Definition simd/interface.hh:429
│ │ │ │ -
auto mask(const V &v)
Convert to mask, analogue of bool(s) for scalars.
Definition simd/interface.hh:489
│ │ │ │ -
constexpr std::size_t lanes()
Number of lanes in a SIMD type.
Definition simd/interface.hh:305
│ │ │ │ -
decltype(auto) lane(std::size_t l, V &&v)
Extract an element of a SIMD type.
Definition simd/interface.hh:324
│ │ │ │ -
Rebind< bool, V > Mask
Mask type type of some SIMD type.
Definition simd/interface.hh:289
│ │ │ │ -
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition simd/interface.hh:235
│ │ │ │ -
Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
implements Simd::mask()
Definition defaults.hh:153
│ │ │ │ -
constexpr V implCast(ADLTag< 0 >, MetaType< V >, const V &u)
implements Simd::implCast<V>(V)
Definition defaults.hh:52
│ │ │ │ -
bool allFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::allFalse()
Definition defaults.hh:124
│ │ │ │ -
bool allTrue(ADLTag< 0 >, const Mask &mask)
implements Simd::allTrue()
Definition defaults.hh:104
│ │ │ │ -
auto maskAnd(ADLTag< 0 >, const V1 &v1, const V2 &v2)
implements Simd::maskAnd()
Definition defaults.hh:177
│ │ │ │ -
auto maskOr(ADLTag< 0 >, const V1 &v1, const V2 &v2)
implements Simd::maskOr()
Definition defaults.hh:170
│ │ │ │ -
bool anyFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::anyFalse()
Definition defaults.hh:114
│ │ │ │ -
auto min(ADLTag< 0 >, const V &v1, const V &v2)
implements binary Simd::min()
Definition defaults.hh:89
│ │ │ │ -
auto broadcast(ADLTag< 0 >, MetaType< V >, S s)
implements Simd::broadcast<V>()
Definition defaults.hh:69
│ │ │ │ -
auto max(ADLTag< 0 >, const V &v1, const V &v2)
implements binary Simd::max()
Definition defaults.hh:81
│ │ │ │ + │ │ │ │ +
132 std::swap(req_, f.req_);
│ │ │ │ +
133 std::swap(status_, f.status_);
│ │ │ │ +
134 std::swap(data_, f.data_);
│ │ │ │ +
135 std::swap(send_data_, f.send_data_);
│ │ │ │ +
136 return *this;
│ │ │ │ +
137 }
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
│ │ │ │ +
139 bool valid() const{
│ │ │ │ +
140 return (bool)data_;
│ │ │ │ +
141 }
│ │ │ │ +
│ │ │ │ +
142
│ │ │ │ +
│ │ │ │ +
143 void wait(){
│ │ │ │ +
144 if(!valid())
│ │ │ │ +
145 DUNE_THROW(InvalidFutureException, "The MPIFuture is not valid!");
│ │ │ │ +
146 MPI_Wait(&req_, &status_);
│ │ │ │ +
147 }
│ │ │ │ +
│ │ │ │ +
148
│ │ │ │ +
│ │ │ │ +
149 bool ready() const{
│ │ │ │ +
150 int flag = -1;
│ │ │ │ +
151 MPI_Test(&req_, &flag, &status_);
│ │ │ │ +
152 return flag;
│ │ │ │ +
153 }
│ │ │ │ +
│ │ │ │ +
154
│ │ │ │ +
│ │ │ │ +
155 R get() {
│ │ │ │ +
156 wait();
│ │ │ │ +
157 return data_.get();
│ │ │ │ +
158 }
│ │ │ │ +
│ │ │ │ +
159
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
161 wait();
│ │ │ │ +
162 return send_data_.get();
│ │ │ │ +
163 }
│ │ │ │ +
│ │ │ │ +
164
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
166 return getMPIData(*data_);
│ │ │ │ +
167 }
│ │ │ │ +
│ │ │ │ +
168
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
170 return getMPIData(*send_data_);
│ │ │ │ +
171 }
│ │ │ │ +
│ │ │ │ +
172 };
│ │ │ │ +
│ │ │ │ +
173
│ │ │ │ +
174}
│ │ │ │ +
175#endif
│ │ │ │ +
176#endif
│ │ │ │ +
Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
│ │ │ │ + │ │ │ │ +
Implements an utility class that provides collective communication methods for sequential programs.
│ │ │ │ +
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:549
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
Definition debugalign.hh:543
│ │ │ │ -
const AlignedNumber< T, align > & cond(ADLTag< 5 >, AlignedNumber< bool, align > mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align > &ifFalse)
Definition debugalign.hh:535
│ │ │ │ -
T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
Definition debugalign.hh:520
│ │ │ │ -
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition base.hh:182
│ │ │ │ -
A type that refers to another type.
Definition typelist.hh:33
│ │ │ │ -
User interface of the SIMD abstraction.
│ │ │ │ +
auto getMPIData(T &t)
Definition mpidata.hh:43
│ │ │ │ +
Collective communication interface and sequential default implementation.
Definition communication.hh:100
│ │ │ │ +
This exception is thrown when ready(), wait() or get() is called on an invalid future....
Definition future.hh:18
│ │ │ │ +
Definition mpifuture.hh:19
│ │ │ │ +
std::unique_ptr< T > value
Definition mpifuture.hh:28
│ │ │ │ +
T & operator*() const
Definition mpifuture.hh:37
│ │ │ │ +
Buffer(V &&t)
Definition mpifuture.hh:25
│ │ │ │ +
T get()
Definition mpifuture.hh:29
│ │ │ │ +
Buffer(bool valid)
Definition mpifuture.hh:20
│ │ │ │ +
std::optional< std::reference_wrapper< T > > value
Definition mpifuture.hh:53
│ │ │ │ +
Buffer(bool valid=false)
Definition mpifuture.hh:44
│ │ │ │ +
T & get()
Definition mpifuture.hh:54
│ │ │ │ +
Buffer(V &&t)
Definition mpifuture.hh:50
│ │ │ │ +
bool valid_
Definition mpifuture.hh:69
│ │ │ │ +
void get()
Definition mpifuture.hh:76
│ │ │ │ +
Buffer(bool valid=false)
Definition mpifuture.hh:70
│ │ │ │ +
Provides a future-like object for MPI communication. It contains the object that will be received and...
Definition mpifuture.hh:85
│ │ │ │ +
MPIFuture(V &&recv_data, typename std::enable_if_t<!std::is_void< V >::value > *=0)
Definition mpifuture.hh:107
│ │ │ │ +
bool ready() const
Definition mpifuture.hh:149
│ │ │ │ +
bool valid() const
Definition mpifuture.hh:139
│ │ │ │ +
~MPIFuture()
Definition mpifuture.hh:112
│ │ │ │ +
MPIFuture(bool valid=false)
Definition mpifuture.hh:92
│ │ │ │ +
MPIFuture & operator=(MPIFuture &&f)
Definition mpifuture.hh:131
│ │ │ │ +
auto get_send_mpidata()
Definition mpifuture.hh:169
│ │ │ │ +
void wait()
Definition mpifuture.hh:143
│ │ │ │ +
auto get_mpidata()
Definition mpifuture.hh:165
│ │ │ │ +
R get()
Definition mpifuture.hh:155
│ │ │ │ +
MPIFuture(V &&recv_data, U &&send_data, typename std::enable_if_t<!std::is_void< V >::value &&!std::is_void< U >::value > *=0)
Definition mpifuture.hh:99
│ │ │ │ +
S get_send_data()
Definition mpifuture.hh:160
│ │ │ │ +
MPIFuture(MPIFuture &&f)
Definition mpifuture.hh:122
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,250 +1,297 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -defaults.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpifuture.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_DEFAULTS_HH │ │ │ │ │ -4#define DUNE_COMMON_SIMD_DEFAULTS_HH │ │ │ │ │ -5 │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20 │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -22#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ -23#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ -25#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -26 │ │ │ │ │ -27namespace _D_u_n_e { │ │ │ │ │ -28 namespace Simd { │ │ │ │ │ -29 namespace Overloads { │ │ │ │ │ -30 │ │ │ │ │ -47 template │ │ │ │ │ -_4_8 decltype(auto) _l_a_n_e(_A_D_L_T_a_g_<_0_>, std::size_t l, V v) = delete; │ │ │ │ │ -49 │ │ │ │ │ -51 template │ │ │ │ │ -_5_2 constexpr V _i_m_p_l_C_a_s_t(_A_D_L_T_a_g_<_0_>, _M_e_t_a_T_y_p_e_<_V_>, const V &u) │ │ │ │ │ -53 { │ │ │ │ │ -54 return u; │ │ │ │ │ -55 } │ │ │ │ │ -56 │ │ │ │ │ -58 template │ │ │ │ │ -_5_9 constexpr V _i_m_p_l_C_a_s_t(_A_D_L_T_a_g_<_0_>, _M_e_t_a_T_y_p_e_<_V_>, const U &u) │ │ │ │ │ -60 { │ │ │ │ │ -61 V result(_S_i_m_d_:_:_S_c_a_l_a_r_<_V_>(0)); │ │ │ │ │ -62 for(auto l : _r_a_n_g_e(_S_i_m_d_:_:_l_a_n_e_s(u))) │ │ │ │ │ -63 _S_i_m_d_:_:_l_a_n_e(l, result) = _S_i_m_d_:_:_l_a_n_e(l, u); │ │ │ │ │ -64 return result; │ │ │ │ │ -65 } │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +5#ifndef DUNE_COMMON_PARALLEL_MPIFUTURE_HH │ │ │ │ │ +6#define DUNE_COMMON_PARALLEL_MPIFUTURE_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +11#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_e_._h_h> │ │ │ │ │ +12#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ +13 │ │ │ │ │ +14#if HAVE_MPI │ │ │ │ │ +15namespace _D_u_n_e{ │ │ │ │ │ +16 │ │ │ │ │ +_1_7 namespace impl{ │ │ │ │ │ +18 template │ │ │ │ │ +_1_9 struct _B_u_f_f_e_r{ │ │ │ │ │ +_2_0 _B_u_f_f_e_r(bool valid){ │ │ │ │ │ +21 if(valid) │ │ │ │ │ +22 _v_a_l_u_e = std::make_unique(); │ │ │ │ │ +23 } │ │ │ │ │ +24 template │ │ │ │ │ +_2_5 _B_u_f_f_e_r(V&& t) │ │ │ │ │ +26 : _v_a_l_u_e(_s_t_d::make_unique(_s_t_d::forward(t))) │ │ │ │ │ +27 {} │ │ │ │ │ +_2_8 std::unique_ptr _v_a_l_u_e; │ │ │ │ │ +_2_9 T _g_e_t(){ │ │ │ │ │ +30 T tmp = std::move(*_v_a_l_u_e); │ │ │ │ │ +31 _v_a_l_u_e.reset(); │ │ │ │ │ +32 return tmp; │ │ │ │ │ +33 } │ │ │ │ │ +_3_4 operator bool () const { │ │ │ │ │ +35 return (bool)_v_a_l_u_e; │ │ │ │ │ +36 } │ │ │ │ │ +_3_7 T& _o_p_e_r_a_t_o_r_ _*() const{ │ │ │ │ │ +38 return *_v_a_l_u_e; │ │ │ │ │ +39 } │ │ │ │ │ +40 }; │ │ │ │ │ +41 │ │ │ │ │ +42 template │ │ │ │ │ +_4_3 struct _B_u_f_f_e_r{ │ │ │ │ │ +_4_4 _B_u_f_f_e_r(bool valid = false) │ │ │ │ │ +45 { │ │ │ │ │ +46 if(valid) │ │ │ │ │ +47 value = T(); │ │ │ │ │ +48 } │ │ │ │ │ +49 template │ │ │ │ │ +_5_0 _B_u_f_f_e_r(V&& t) │ │ │ │ │ +51 : value(_s_t_d::forward(t)) │ │ │ │ │ +52 {} │ │ │ │ │ +_5_3 std::optional> _v_a_l_u_e; │ │ │ │ │ +_5_4 T& _g_e_t(){ │ │ │ │ │ +55 T& tmp = *value; │ │ │ │ │ +56 value.reset(); │ │ │ │ │ +57 return tmp; │ │ │ │ │ +58 } │ │ │ │ │ +_5_9 operator bool () const{ │ │ │ │ │ +60 return (bool)value; │ │ │ │ │ +61 } │ │ │ │ │ +_6_2 T& _o_p_e_r_a_t_o_r_ _*() const{ │ │ │ │ │ +63 return *value; │ │ │ │ │ +64 } │ │ │ │ │ +65 }; │ │ │ │ │ 66 │ │ │ │ │ -68 template │ │ │ │ │ -_6_9 auto _b_r_o_a_d_c_a_s_t(_A_D_L_T_a_g_<_0_>, _M_e_t_a_T_y_p_e_<_V_>, S s) │ │ │ │ │ -70 { │ │ │ │ │ -71 return V(_S_i_m_d_:_:_S_c_a_l_a_r_<_V_>(s)); │ │ │ │ │ -72 } │ │ │ │ │ -73 │ │ │ │ │ -75 template │ │ │ │ │ -_7_6 V _c_o_n_d(_A_D_L_T_a_g_<_0_>, const _M_a_s_k_<_V_> &_m_a_s_k, │ │ │ │ │ -77 const V &ifTrue, const V &ifFalse) = delete; │ │ │ │ │ -78 │ │ │ │ │ -80 template │ │ │ │ │ -_8_1 auto _m_a_x(_A_D_L_T_a_g_<_0_>, const V &v1, const V &v2) │ │ │ │ │ -82 { │ │ │ │ │ -83 using std::max; │ │ │ │ │ -84 return _m_a_x(v1, v2); │ │ │ │ │ -85 } │ │ │ │ │ -86 │ │ │ │ │ -88 template │ │ │ │ │ -_8_9 auto _m_i_n(_A_D_L_T_a_g_<_0_>, const V &v1, const V &v2) │ │ │ │ │ -90 { │ │ │ │ │ -91 using std::min; │ │ │ │ │ -92 return _m_i_n(v1, v2); │ │ │ │ │ -93 } │ │ │ │ │ -94 │ │ │ │ │ -96 template │ │ │ │ │ -_9_7 bool _a_n_y_T_r_u_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) = delete; │ │ │ │ │ -98 │ │ │ │ │ -100 │ │ │ │ │ -103 template │ │ │ │ │ -_1_0_4 bool _a_l_l_T_r_u_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ -105 { │ │ │ │ │ -106 return !_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e(!_m_a_s_k); │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -110 │ │ │ │ │ -113 template │ │ │ │ │ -_1_1_4 bool _a_n_y_F_a_l_s_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ -115 { │ │ │ │ │ -116 return _D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e(!_m_a_s_k); │ │ │ │ │ -117 } │ │ │ │ │ -118 │ │ │ │ │ -120 │ │ │ │ │ -123 template │ │ │ │ │ -_1_2_4 bool _a_l_l_F_a_l_s_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ -125 { │ │ │ │ │ -126 return !_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e(_m_a_s_k); │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -130 template │ │ │ │ │ -_1_3_1 auto _m_a_x(_A_D_L_T_a_g_<_0_>, const V &v) │ │ │ │ │ -132 { │ │ │ │ │ -133 _S_c_a_l_a_r_<_V_> m = _S_i_m_d_:_:_l_a_n_e(0, v); │ │ │ │ │ -134 for(std::size_t l = 1; l < _S_i_m_d_:_:_l_a_n_e_s(v); ++l) │ │ │ │ │ -135 if(m < _S_i_m_d_:_:_l_a_n_e(l, v)) │ │ │ │ │ -136 m = _S_i_m_d_:_:_l_a_n_e(l, v); │ │ │ │ │ -137 return m; │ │ │ │ │ -138 } │ │ │ │ │ -139 │ │ │ │ │ -141 template │ │ │ │ │ -_1_4_2 auto _m_i_n(_A_D_L_T_a_g_<_0_>, const V &v) │ │ │ │ │ -143 { │ │ │ │ │ -144 _S_c_a_l_a_r_<_V_> m = _S_i_m_d_:_:_l_a_n_e(0, v); │ │ │ │ │ -145 for(std::size_t l = 1; l < _S_i_m_d_:_:_l_a_n_e_s(v); ++l) │ │ │ │ │ -146 if(_S_i_m_d_:_:_l_a_n_e(l, v) < m) │ │ │ │ │ -147 m = _S_i_m_d_:_:_l_a_n_e(l, v); │ │ │ │ │ -148 return m; │ │ │ │ │ -149 } │ │ │ │ │ -150 │ │ │ │ │ -152 template │ │ │ │ │ -_1_5_3 _M_a_s_k_<_V_> _m_a_s_k(_A_D_L_T_a_g<0, std::is_same >::value>, │ │ │ │ │ -154 const V &v) │ │ │ │ │ -155 { │ │ │ │ │ -156 return v; │ │ │ │ │ -157 } │ │ │ │ │ -158 │ │ │ │ │ -160 template │ │ │ │ │ -_1_6_1 auto _m_a_s_k(_A_D_L_T_a_g<0, !std::is_same >::value>, │ │ │ │ │ -162 const V &v) │ │ │ │ │ -163 { │ │ │ │ │ -164 using Copy = _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_<_V_>; // just in case we are handed a proxy │ │ │ │ │ -165 return v != Copy(_S_c_a_l_a_r_<_C_o_p_y_>(0)); │ │ │ │ │ -166 } │ │ │ │ │ -167 │ │ │ │ │ -169 template │ │ │ │ │ -_1_7_0 auto _m_a_s_k_O_r(_A_D_L_T_a_g_<_0_>, const V1 &v1, const V2 &v2) │ │ │ │ │ -171 { │ │ │ │ │ -172 return _S_i_m_d_:_:_m_a_s_k(v1) || _S_i_m_d_:_:_m_a_s_k(v2); │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -176 template │ │ │ │ │ -_1_7_7 auto _m_a_s_k_A_n_d(_A_D_L_T_a_g_<_0_>, const V1 &v1, const V2 &v2) │ │ │ │ │ -178 { │ │ │ │ │ -179 return _S_i_m_d_:_:_m_a_s_k(v1) && _S_i_m_d_:_:_m_a_s_k(v2); │ │ │ │ │ -180 } │ │ │ │ │ -181 │ │ │ │ │ -184 } // namespace Overloads │ │ │ │ │ -185 } // namespace Simd │ │ │ │ │ -186} // namespace Dune │ │ │ │ │ -187 │ │ │ │ │ -188#endif // DUNE_COMMON_SIMD_DEFAULTS_HH │ │ │ │ │ -_b_a_s_e_._h_h │ │ │ │ │ -Basic definitions for SIMD Implementations. │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for reduction like operations on ranges. │ │ │ │ │ -_t_y_p_e_l_i_s_t_._h_h │ │ │ │ │ -_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ -static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ ->, std::integral_constant< T, to >) noexcept │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e │ │ │ │ │ -typename AutonomousValueType< T >::type AutonomousValue │ │ │ │ │ -Type free of internal references that T can be converted to. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:558 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e │ │ │ │ │ -bool anyTrue(const Mask &mask) │ │ │ │ │ -Whether any entry is true │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:429 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_m_a_s_k │ │ │ │ │ -auto mask(const V &v) │ │ │ │ │ -Convert to mask, analogue of bool(s) for scalars. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:489 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ -constexpr std::size_t lanes() │ │ │ │ │ -Number of lanes in a SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ -decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ -Extract an element of a SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_M_a_s_k │ │ │ │ │ -Rebind< bool, V > Mask │ │ │ │ │ -Mask type type of some SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:289 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ -typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ -Element type of some SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k │ │ │ │ │ -Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) │ │ │ │ │ -implements Simd::mask() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_i_m_p_l_C_a_s_t │ │ │ │ │ -constexpr V implCast(ADLTag< 0 >, MetaType< V >, const V &u) │ │ │ │ │ -implements Simd::implCast(V) │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ -bool allFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ -implements Simd::allFalse() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:124 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e │ │ │ │ │ -bool allTrue(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ -implements Simd::allTrue() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_A_n_d │ │ │ │ │ -auto maskAnd(ADLTag< 0 >, const V1 &v1, const V2 &v2) │ │ │ │ │ -implements Simd::maskAnd() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:177 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_O_r │ │ │ │ │ -auto maskOr(ADLTag< 0 >, const V1 &v1, const V2 &v2) │ │ │ │ │ -implements Simd::maskOr() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:170 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ -bool anyFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ -implements Simd::anyFalse() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:114 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_i_n │ │ │ │ │ -auto min(ADLTag< 0 >, const V &v1, const V &v2) │ │ │ │ │ -implements binary Simd::min() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_b_r_o_a_d_c_a_s_t │ │ │ │ │ -auto broadcast(ADLTag< 0 >, MetaType< V >, S s) │ │ │ │ │ -implements Simd::broadcast() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_x │ │ │ │ │ -auto max(ADLTag< 0 >, const V &v1, const V &v2) │ │ │ │ │ -implements binary Simd::max() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:81 │ │ │ │ │ +67 template<> │ │ │ │ │ +_6_8 struct _B_u_f_f_e_r{ │ │ │ │ │ +_6_9 bool _v_a_l_i_d__; │ │ │ │ │ +_7_0 _B_u_f_f_e_r(bool valid = false) │ │ │ │ │ +71 : valid_(valid) │ │ │ │ │ +72 {} │ │ │ │ │ +_7_3 operator bool () const{ │ │ │ │ │ +74 return valid_; │ │ │ │ │ +75 } │ │ │ │ │ +_7_6 void _g_e_t(){} │ │ │ │ │ +77 }; │ │ │ │ │ +78 } │ │ │ │ │ +79 │ │ │ │ │ +84 template │ │ │ │ │ +_8_5 class _M_P_I_F_u_t_u_r_e{ │ │ │ │ │ +86 mutable MPI_Request req_; │ │ │ │ │ +87 mutable MPI_Status status_; │ │ │ │ │ +88 _i_m_p_l_:_:_B_u_f_f_e_r_<_R_> data_; │ │ │ │ │ +_8_9 _i_m_p_l_:_:_B_u_f_f_e_r_<_S_> send_data_; │ │ │ │ │ +90 friend class _C_o_m_m_u_n_i_c_a_t_i_o_n; │ │ │ │ │ +91 public: │ │ │ │ │ +_9_2 _M_P_I_F_u_t_u_r_e(bool _v_a_l_i_d = false) │ │ │ │ │ +93 : req_(MPI_REQUEST_NULL) │ │ │ │ │ +94 , data_(_v_a_l_i_d) │ │ │ │ │ +95 {} │ │ │ │ │ +96 │ │ │ │ │ +97 // Hide this constructor if R or S is void │ │ │ │ │ +98 template │ │ │ │ │ +_9_9 _M_P_I_F_u_t_u_r_e(V&& recv_data, U&& send_data, typename std::enable_if_t::value && !std::is_void::value>* = 0) : │ │ │ │ │ +100 req_(MPI_REQUEST_NULL) │ │ │ │ │ +101 , data_(_s_t_d::forward(recv_data)) │ │ │ │ │ +102 , send_data_(_s_t_d::forward(send_data)) │ │ │ │ │ +103 {} │ │ │ │ │ +104 │ │ │ │ │ +105 // hide this constructor if R is void │ │ │ │ │ +106 template │ │ │ │ │ +_1_0_7 _M_P_I_F_u_t_u_r_e(V&& recv_data, typename std::enable_if_t:: │ │ │ │ │ +value>* = 0) │ │ │ │ │ +108 : req_(MPI_REQUEST_NULL) │ │ │ │ │ +109 , data_(_s_t_d::forward(recv_data)) │ │ │ │ │ +110 {} │ │ │ │ │ +111 │ │ │ │ │ +_1_1_2 _~_M_P_I_F_u_t_u_r_e() { │ │ │ │ │ +113 if(req_ != MPI_REQUEST_NULL){ │ │ │ │ │ +114 try{ // might fail when it is a collective communication │ │ │ │ │ +115 MPI_Cancel(&req_); │ │ │ │ │ +116 MPI_Request_free(&req_); │ │ │ │ │ +117 }catch(...){ │ │ │ │ │ +118 } │ │ │ │ │ +119 } │ │ │ │ │ +120 } │ │ │ │ │ +121 │ │ │ │ │ +_1_2_2 _M_P_I_F_u_t_u_r_e(_M_P_I_F_u_t_u_r_e&& f) │ │ │ │ │ +123 : req_(MPI_REQUEST_NULL) │ │ │ │ │ +124 , data_(_s_t_d::move(f.data_)) │ │ │ │ │ +125 , send_data_(_s_t_d::move(f.send_data_)) │ │ │ │ │ +126 { │ │ │ │ │ +127 std::swap(req_, f.req_); │ │ │ │ │ +128 std::swap(status_, f.status_); │ │ │ │ │ +129 } │ │ │ │ │ +130 │ │ │ │ │ +_1_3_1 _M_P_I_F_u_t_u_r_e& _o_p_e_r_a_t_o_r_=(_M_P_I_F_u_t_u_r_e&& f){ │ │ │ │ │ +132 std::swap(req_, f.req_); │ │ │ │ │ +133 std::swap(status_, f.status_); │ │ │ │ │ +134 std::swap(data_, f.data_); │ │ │ │ │ +135 std::swap(send_data_, f.send_data_); │ │ │ │ │ +136 return *this; │ │ │ │ │ +137 } │ │ │ │ │ +138 │ │ │ │ │ +_1_3_9 bool _v_a_l_i_d() const{ │ │ │ │ │ +140 return (bool)data_; │ │ │ │ │ +141 } │ │ │ │ │ +142 │ │ │ │ │ +_1_4_3 void _w_a_i_t(){ │ │ │ │ │ +144 if(!_v_a_l_i_d()) │ │ │ │ │ +145 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The MPIFuture is not valid!"); │ │ │ │ │ +146 MPI_Wait(&req_, &status_); │ │ │ │ │ +147 } │ │ │ │ │ +148 │ │ │ │ │ +_1_4_9 bool _r_e_a_d_y() const{ │ │ │ │ │ +150 int flag = -1; │ │ │ │ │ +151 MPI_Test(&req_, &flag, &status_); │ │ │ │ │ +152 return flag; │ │ │ │ │ +153 } │ │ │ │ │ +154 │ │ │ │ │ +_1_5_5 R _g_e_t() { │ │ │ │ │ +156 _w_a_i_t(); │ │ │ │ │ +157 return data_.get(); │ │ │ │ │ +158 } │ │ │ │ │ +159 │ │ │ │ │ +_1_6_0 S _g_e_t___s_e_n_d___d_a_t_a(){ │ │ │ │ │ +161 _w_a_i_t(); │ │ │ │ │ +162 return send_data_._g_e_t(); │ │ │ │ │ +163 } │ │ │ │ │ +164 │ │ │ │ │ +_1_6_5 auto _g_e_t___m_p_i_d_a_t_a(){ │ │ │ │ │ +166 return _g_e_t_M_P_I_D_a_t_a(*data_); │ │ │ │ │ +167 } │ │ │ │ │ +168 │ │ │ │ │ +_1_6_9 auto _g_e_t___s_e_n_d___m_p_i_d_a_t_a(){ │ │ │ │ │ +170 return _g_e_t_M_P_I_D_a_t_a(*send_data_); │ │ │ │ │ +171 } │ │ │ │ │ +172 }; │ │ │ │ │ +173 │ │ │ │ │ +174} │ │ │ │ │ +175#endif │ │ │ │ │ +176#endif │ │ │ │ │ +_m_p_i_d_a_t_a_._h_h │ │ │ │ │ +Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ +MPI calls. │ │ │ │ │ +_f_u_t_u_r_e_._h_h │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides collective communication methods for │ │ │ │ │ +sequential programs. │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:549 │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e │ │ │ │ │ -bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:543 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d │ │ │ │ │ -const AlignedNumber< T, align > & cond(ADLTag< 5 >, AlignedNumber< bool, align │ │ │ │ │ -> mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align │ │ │ │ │ -> &ifFalse) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:535 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e │ │ │ │ │ -T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:520 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ -Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ -DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_M_e_t_a_T_y_p_e │ │ │ │ │ -A type that refers to another type. │ │ │ │ │ -DDeeffiinniittiioonn typelist.hh:33 │ │ │ │ │ -_i_n_t_e_r_f_a_c_e_._h_h │ │ │ │ │ -User interface of the SIMD abstraction. │ │ │ │ │ +_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ +auto getMPIData(T &t) │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Collective communication interface and sequential default implementation. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ +This exception is thrown when ready(), wait() or get() is called on an invalid │ │ │ │ │ +future.... │ │ │ │ │ +DDeeffiinniittiioonn future.hh:18 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_v_a_l_u_e │ │ │ │ │ +std::unique_ptr< T > value │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +T & operator*() const │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_B_u_f_f_e_r │ │ │ │ │ +Buffer(V &&t) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_g_e_t │ │ │ │ │ +T get() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_B_u_f_f_e_r │ │ │ │ │ +Buffer(bool valid) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:20 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_v_a_l_u_e │ │ │ │ │ +std::optional< std::reference_wrapper< T > > value │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_B_u_f_f_e_r │ │ │ │ │ +Buffer(bool valid=false) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_g_e_t │ │ │ │ │ +T & get() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_B_u_f_f_e_r │ │ │ │ │ +Buffer(V &&t) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _>_:_:_v_a_l_i_d__ │ │ │ │ │ +bool valid_ │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _>_:_:_g_e_t │ │ │ │ │ +void get() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _>_:_:_B_u_f_f_e_r │ │ │ │ │ +Buffer(bool valid=false) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ +Provides a future-like object for MPI communication. It contains the object │ │ │ │ │ +that will be received and... │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ +MPIFuture(V &&recv_data, typename std::enable_if_t::value > │ │ │ │ │ +*=0) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:107 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ +bool ready() const │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_v_a_l_i_d │ │ │ │ │ +bool valid() const │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:139 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_~_M_P_I_F_u_t_u_r_e │ │ │ │ │ +~MPIFuture() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ +MPIFuture(bool valid=false) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +MPIFuture & operator=(MPIFuture &&f) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___s_e_n_d___m_p_i_d_a_t_a │ │ │ │ │ +auto get_send_mpidata() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:169 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_w_a_i_t │ │ │ │ │ +void wait() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:143 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___m_p_i_d_a_t_a │ │ │ │ │ +auto get_mpidata() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:165 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ +R get() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ +MPIFuture(V &&recv_data, U &&send_data, typename std::enable_if_t::value &&!std::is_void< U >::value > *=0) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___s_e_n_d___d_a_t_a │ │ │ │ │ +S get_send_data() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:160 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ +MPIFuture(MPIFuture &&f) │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:122 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00053.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: standard.hh File Reference │ │ │ │ +dune-common: localindex.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,86 +65,55 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +Namespaces | │ │ │ │ +Enumerations
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

SIMD abstractions for the standard built-in types. │ │ │ │ +

Provides classes for use as the local index in ParallelIndexSet. │ │ │ │ More...

│ │ │ │
#include <cstddef>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/simd/base.hh>
│ │ │ │ -#include <dune/common/simd/defaults.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Simd::Overloads::ScalarType< V, class >
 should have a member type type More...
 
struct  Dune::Simd::Overloads::RebindType< S, class, class >
 should have a member type type More...
 
struct  Dune::Simd::Overloads::LaneCount< class, class >
 should be derived from a Dune::index_constant More...
class  Dune::LocalIndex
 An index present on the local process. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Simd
 Namespace for vectorization interface functions used by library developers.
 
namespace  Dune::Simd::Overloads
 Namespace for the overloads and specializations that make up a SIMD implementation.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Functions

Specialized classes and overloaded functions
template<class V >
Dune::Simd::Overloads::lane (ADLTag< 2 >, std::size_t, V v)
 implements Simd::lane()
 
template<class V >
V & Dune::Simd::Overloads::lane (ADLTag< 3 >, std::size_t, V &v)
 
bool Dune::Simd::Overloads::anyTrue (ADLTag< 2 >, bool mask)
 implements Simd::anyTrue()
 
bool Dune::Simd::Overloads::allTrue (ADLTag< 2 >, bool mask)
 implements Simd::allTrue()
 
bool Dune::Simd::Overloads::anyFalse (ADLTag< 2 >, bool mask)
 implements Simd::anyFalse()
 
bool Dune::Simd::Overloads::allFalse (ADLTag< 2 >, bool mask)
 implements Simd::allFalse()
 

│ │ │ │ +Enumerations

enum  Dune::LocalIndexState { Dune::VALID │ │ │ │ +, Dune::DELETED │ │ │ │ + }
 The states available for the local indices. More...
 
│ │ │ │

Detailed Description

│ │ │ │ -

SIMD abstractions for the standard built-in types.

│ │ │ │ -

This file should not normally be included by users of the SIMD abstraction (i.e. other Dune headers). Neither should it be included by the translation units passing built-in types to Dune headers that in turn support SIMD types through the SIMD abstraction. Dune-functionality always supports built-in types. Either because that functionality does not support SIMD types and so only supports built-in types, or if it does support SIMD types it must include <dune/common/simd/simd.hh>, which in turn includes this header.

│ │ │ │ +

Provides classes for use as the local index in ParallelIndexSet.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,73 +1,31 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -standard.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _A_p_p_l_i_c_a_t_i_o_n_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e » _S_I_M_D_ _A_b_s_t_r_a_c_t_i_o_n │ │ │ │ │ -_I_m_p_l_e_m_e_n_t_a_t_i_o_n_ _f_o_r_ _s_t_a_n_d_a_r_d_ _t_y_p_e_s │ │ │ │ │ -SIMD abstractions for the standard built-in types. _M_o_r_e_._._. │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ +localindex.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ +Provides classes for use as the local index in ParallelIndexSet. _M_o_r_e_._._. │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_d_e_f_a_u_l_t_s_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_<_ _V_,_ _c_l_a_s_s_ _> │ │ │ │ │ -  should have a member type type _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e_<_ _S_,_ _c_l_a_s_s_,_ _c_l_a_s_s_ _> │ │ │ │ │ -  should have a member type type _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t_<_ _c_l_a_s_s_,_ _c_l_a_s_s_ _> │ │ │ │ │ -  should be derived from a _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +  An index present on the local process. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ -  Namespace for vectorization interface functions used by library │ │ │ │ │ - developers. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ -  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ - implementation. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -Specialized classes and overloaded functions │ │ │ │ │ -template │ │ │ │ │ - V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 2 >, std::size_t, V v) │ │ │ │ │ -  implements _S_i_m_d_:_:_l_a_n_e_(_) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - V &  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 3 >, std::size_t, V &v) │ │ │ │ │ -  │ │ │ │ │ -bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ -  implements _S_i_m_d_:_:_a_n_y_T_r_u_e_(_) │ │ │ │ │ -  │ │ │ │ │ -bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ -  implements _S_i_m_d_:_:_a_l_l_T_r_u_e_(_) │ │ │ │ │ -  │ │ │ │ │ -bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ -  implements _S_i_m_d_:_:_a_n_y_F_a_l_s_e_(_) │ │ │ │ │ -  │ │ │ │ │ -bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ -  implements _S_i_m_d_:_:_a_l_l_F_a_l_s_e_(_) │ │ │ │ │ +EEnnuummeerraattiioonnss │ │ │ │ │ +enum   _D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_S_t_a_t_e { _D_u_n_e_:_:_V_A_L_I_D , _D_u_n_e_:_:_D_E_L_E_T_E_D } │ │ │ │ │ +  The states available for the local indices. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -SIMD abstractions for the standard built-in types. │ │ │ │ │ -This file should not normally be included by users of the SIMD abstraction │ │ │ │ │ -(i.e. other _D_u_n_e headers). Neither should it be included by the translation │ │ │ │ │ -units passing built-in types to _D_u_n_e headers that in turn support SIMD types │ │ │ │ │ -through the SIMD abstraction. Dune-functionality always supports built-in │ │ │ │ │ -types. Either because that functionality does not support SIMD types and so │ │ │ │ │ -only supports built-in types, or if it does support SIMD types it must include │ │ │ │ │ -<_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h>, which in turn includes this header. │ │ │ │ │ +Provides classes for use as the local index in ParallelIndexSet. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00053_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: standard.hh Source File │ │ │ │ +dune-common: localindex.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,102 +70,117 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
standard.hh
│ │ │ │ +
localindex.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_STANDARD_HH
│ │ │ │ -
4#define DUNE_COMMON_SIMD_STANDARD_HH
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │
5
│ │ │ │ -
20#include <cstddef>
│ │ │ │ -
21#include <type_traits>
│ │ │ │ -
22#include <utility>
│ │ │ │ -
23
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
27
│ │ │ │ -
45namespace Dune {
│ │ │ │ -
46 namespace Simd {
│ │ │ │ -
47
│ │ │ │ -
48 namespace Overloads {
│ │ │ │ -
49
│ │ │ │ +
6#ifndef DUNE_COMMON_LOCALINDEX_HH
│ │ │ │ +
7#define DUNE_COMMON_LOCALINDEX_HH
│ │ │ │ +
8
│ │ │ │ +
9#include <cstddef>
│ │ │ │ +
10
│ │ │ │ +
11namespace Dune
│ │ │ │ +
12{
│ │ │ │ +
13
│ │ │ │ +
14
│ │ │ │ + │ │ │ │ +
29
│ │ │ │ +
30
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
35 {
│ │ │ │ +
36 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
42 localIndex_(0), state_(VALID){}
│ │ │ │ +
│ │ │ │ +
43
│ │ │ │ +
44
│ │ │ │ +
│ │ │ │ +
49 LocalIndex(std::size_t index) :
│ │ │ │ +
50 localIndex_(index), state_(VALID){}
│ │ │ │ +
│ │ │ │ +
55 inline const std::size_t& local() const;
│ │ │ │
56
│ │ │ │ -
59 template<class V, class>
│ │ │ │ -
60 struct ScalarType { using type = V; };
│ │ │ │ +
60 inline operator std::size_t() const;
│ │ │ │
61
│ │ │ │ -
63
│ │ │ │ -
66 template<class S, class, class>
│ │ │ │ -
67 struct RebindType { using type = S; };
│ │ │ │ +
67 inline LocalIndex& operator=(std::size_t index);
│ │ │ │
68
│ │ │ │ -
70
│ │ │ │ -
73 template<class, class>
│ │ │ │ -
74 struct LaneCount : public index_constant<1> { };
│ │ │ │ -
75
│ │ │ │ -
77
│ │ │ │ -
86 template<class V>
│ │ │ │ -
│ │ │ │ -
87 V lane(ADLTag<2>, std::size_t, V v)
│ │ │ │ -
88 {
│ │ │ │ -
89 return v;
│ │ │ │ -
90 }
│ │ │ │ -
│ │ │ │ -
91
│ │ │ │ -
92 template<class V>
│ │ │ │ -
│ │ │ │ -
93 V &lane(ADLTag<3>, std::size_t, V &v)
│ │ │ │ -
94 {
│ │ │ │ -
95 return v;
│ │ │ │ -
96 }
│ │ │ │ -
│ │ │ │ -
97
│ │ │ │ -
98 // No Simd::cond() implementation, the overload for bool masks in the
│ │ │ │ -
99 // interface is sufficient
│ │ │ │ +
73 inline LocalIndexState state() const;
│ │ │ │ +
74
│ │ │ │ +
79 inline void setState(LocalIndexState state);
│ │ │ │ +
80
│ │ │ │ +
81 private:
│ │ │ │ +
83 std::size_t localIndex_;
│ │ │ │ +
84
│ │ │ │ +
91 char state_;
│ │ │ │ +
92
│ │ │ │ +
93 };
│ │ │ │ +
│ │ │ │ +
94
│ │ │ │ +
95
│ │ │ │ +
96
│ │ │ │ +
│ │ │ │ +
97 inline const std::size_t& LocalIndex::local() const {
│ │ │ │ +
98 return localIndex_;
│ │ │ │ +
99 }
│ │ │ │ +
│ │ │ │
100
│ │ │ │ -
102 inline bool anyTrue(ADLTag<2>, bool mask) { return mask; }
│ │ │ │ -
103
│ │ │ │ -
105 inline bool allTrue(ADLTag<2>, bool mask) { return mask; }
│ │ │ │ -
106
│ │ │ │ -
108 inline bool anyFalse(ADLTag<2>, bool mask) { return !mask; }
│ │ │ │ +
│ │ │ │ +
101 inline LocalIndex::operator std::size_t() const {
│ │ │ │ +
102 return localIndex_;
│ │ │ │ +
103 }
│ │ │ │ +
│ │ │ │ +
104
│ │ │ │ +
│ │ │ │ +
105 inline LocalIndex& LocalIndex::operator=(std::size_t index){
│ │ │ │ +
106 localIndex_ = index;
│ │ │ │ +
107 return *this;
│ │ │ │ +
108 }
│ │ │ │ +
│ │ │ │
109
│ │ │ │ -
111 inline bool allFalse(ADLTag<2>, bool mask) { return !mask; }
│ │ │ │ -
112
│ │ │ │ -
114
│ │ │ │ -
115 } // namespace Overloads
│ │ │ │ -
116 } // namespace Simd
│ │ │ │ -
117} // namespace Dune
│ │ │ │ -
118
│ │ │ │ -
119#endif // DUNE_COMMON_SIMD_STANDARD_HH
│ │ │ │ -
Default implementations for SIMD Implementations.
│ │ │ │ -
Basic definitions for SIMD Implementations.
│ │ │ │ - │ │ │ │ -
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition indices.hh:30
│ │ │ │ -
Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
implements Simd::mask()
Definition defaults.hh:153
│ │ │ │ -
bool allFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::allFalse()
Definition defaults.hh:124
│ │ │ │ -
bool allTrue(ADLTag< 0 >, const Mask &mask)
implements Simd::allTrue()
Definition defaults.hh:104
│ │ │ │ -
bool anyFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::anyFalse()
Definition defaults.hh:114
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
111 return static_cast<LocalIndexState>(state_);
│ │ │ │ +
112 }
│ │ │ │ +
│ │ │ │ +
113
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
115 state_ = static_cast<char>(state);
│ │ │ │ +
116 }
│ │ │ │ +
│ │ │ │ +
117
│ │ │ │ +
120} // namespace Dune
│ │ │ │ +
121
│ │ │ │ +
122#endif
│ │ │ │ +
LocalIndexState
The states available for the local indices.
Definition localindex.hh:28
│ │ │ │ +
LocalIndex & operator=(std::size_t index)
Assign a new local index.
Definition localindex.hh:105
│ │ │ │ +
LocalIndexState state() const
Get the state.
Definition localindex.hh:110
│ │ │ │ +
const std::size_t & local() const
get the local index.
Definition localindex.hh:97
│ │ │ │ +
void setState(LocalIndexState state)
Set the state.
Definition localindex.hh:114
│ │ │ │ +
@ VALID
Definition localindex.hh:28
│ │ │ │ +
@ DELETED
Definition localindex.hh:28
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
Definition debugalign.hh:543
│ │ │ │ -
T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
Definition debugalign.hh:520
│ │ │ │ -
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition base.hh:182
│ │ │ │ -
should have a member type type
Definition standard.hh:60
│ │ │ │ -
V type
Definition standard.hh:60
│ │ │ │ -
should have a member type type
Definition standard.hh:67
│ │ │ │ -
S type
Definition standard.hh:67
│ │ │ │ -
should be derived from a Dune::index_constant
Definition standard.hh:74
│ │ │ │ +
An index present on the local process.
Definition localindex.hh:35
│ │ │ │ +
LocalIndex()
Constructor. known to other processes.
Definition localindex.hh:41
│ │ │ │ +
LocalIndex(std::size_t index)
Constructor.
Definition localindex.hh:49
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,124 +1,121 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -standard.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +localindex.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_STANDARD_HH │ │ │ │ │ -4#define DUNE_COMMON_SIMD_STANDARD_HH │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ 5 │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22#include │ │ │ │ │ -23 │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -25#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ -26#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_d_e_f_a_u_l_t_s_._h_h> │ │ │ │ │ -27 │ │ │ │ │ -45namespace _D_u_n_e { │ │ │ │ │ -46 namespace Simd { │ │ │ │ │ -47 │ │ │ │ │ -48 namespace Overloads { │ │ │ │ │ -49 │ │ │ │ │ +6#ifndef DUNE_COMMON_LOCALINDEX_HH │ │ │ │ │ +7#define DUNE_COMMON_LOCALINDEX_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e │ │ │ │ │ +12{ │ │ │ │ │ +13 │ │ │ │ │ +14 │ │ │ │ │ +_2_8 enum _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e {_V_A_L_I_D, _D_E_L_E_T_E_D}; │ │ │ │ │ +29 │ │ │ │ │ +30 │ │ │ │ │ +_3_4 class _L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +35 { │ │ │ │ │ +36 public: │ │ │ │ │ +_4_1 _L_o_c_a_l_I_n_d_e_x() : │ │ │ │ │ +42 localIndex_(0), state_(_V_A_L_I_D){} │ │ │ │ │ +43 │ │ │ │ │ +44 │ │ │ │ │ +_4_9 _L_o_c_a_l_I_n_d_e_x(std::size_t index) : │ │ │ │ │ +50 localIndex_(index), state_(_V_A_L_I_D){} │ │ │ │ │ +55 inline const std::size_t& _l_o_c_a_l() const; │ │ │ │ │ 56 │ │ │ │ │ -59 template │ │ │ │ │ -_6_0 struct _S_c_a_l_a_r_T_y_p_e { using _t_y_p_e = V; }; │ │ │ │ │ +60 inline operator std::size_t() const; │ │ │ │ │ 61 │ │ │ │ │ -63 │ │ │ │ │ -66 template │ │ │ │ │ -_6_7 struct _R_e_b_i_n_d_T_y_p_e { using _t_y_p_e = S; }; │ │ │ │ │ +67 inline _L_o_c_a_l_I_n_d_e_x& _o_p_e_r_a_t_o_r_=(std::size_t index); │ │ │ │ │ 68 │ │ │ │ │ -70 │ │ │ │ │ -73 template │ │ │ │ │ -_7_4 struct _L_a_n_e_C_o_u_n_t : public _i_n_d_e_x___c_o_n_s_t_a_n_t<1> { }; │ │ │ │ │ -75 │ │ │ │ │ -77 │ │ │ │ │ -86 template │ │ │ │ │ -_8_7 V _l_a_n_e(_A_D_L_T_a_g_<_2_>, std::size_t, V v) │ │ │ │ │ -88 { │ │ │ │ │ -89 return v; │ │ │ │ │ -90 } │ │ │ │ │ -91 │ │ │ │ │ -92 template │ │ │ │ │ -_9_3 V &_l_a_n_e(_A_D_L_T_a_g_<_3_>, std::size_t, V &v) │ │ │ │ │ -94 { │ │ │ │ │ -95 return v; │ │ │ │ │ -96 } │ │ │ │ │ -97 │ │ │ │ │ -98 // No Simd::cond() implementation, the overload for bool masks in the │ │ │ │ │ -99 // interface is sufficient │ │ │ │ │ +73 inline _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _s_t_a_t_e() const; │ │ │ │ │ +74 │ │ │ │ │ +79 inline void _s_e_t_S_t_a_t_e(_L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _s_t_a_t_e); │ │ │ │ │ +80 │ │ │ │ │ +81 private: │ │ │ │ │ +83 std::size_t localIndex_; │ │ │ │ │ +84 │ │ │ │ │ +91 char state_; │ │ │ │ │ +92 │ │ │ │ │ +93 }; │ │ │ │ │ +94 │ │ │ │ │ +95 │ │ │ │ │ +96 │ │ │ │ │ +_9_7 inline const std::size_t& _L_o_c_a_l_I_n_d_e_x_:_:_l_o_c_a_l() const { │ │ │ │ │ +98 return localIndex_; │ │ │ │ │ +99 } │ │ │ │ │ 100 │ │ │ │ │ -_1_0_2 inline bool _a_n_y_T_r_u_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return _m_a_s_k; } │ │ │ │ │ -103 │ │ │ │ │ -_1_0_5 inline bool _a_l_l_T_r_u_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return _m_a_s_k; } │ │ │ │ │ -106 │ │ │ │ │ -_1_0_8 inline bool _a_n_y_F_a_l_s_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return !_m_a_s_k; } │ │ │ │ │ +_1_0_1 inline LocalIndex::operator std::size_t() const { │ │ │ │ │ +102 return localIndex_; │ │ │ │ │ +103 } │ │ │ │ │ +104 │ │ │ │ │ +_1_0_5 inline _L_o_c_a_l_I_n_d_e_x& _L_o_c_a_l_I_n_d_e_x_:_:_o_p_e_r_a_t_o_r_=(std::size_t index){ │ │ │ │ │ +106 localIndex_ = index; │ │ │ │ │ +107 return *this; │ │ │ │ │ +108 } │ │ │ │ │ 109 │ │ │ │ │ -_1_1_1 inline bool _a_l_l_F_a_l_s_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return !_m_a_s_k; } │ │ │ │ │ -112 │ │ │ │ │ -114 │ │ │ │ │ -115 } // namespace Overloads │ │ │ │ │ -116 } // namespace Simd │ │ │ │ │ -117} // namespace Dune │ │ │ │ │ -118 │ │ │ │ │ -119#endif // DUNE_COMMON_SIMD_STANDARD_HH │ │ │ │ │ -_d_e_f_a_u_l_t_s_._h_h │ │ │ │ │ -Default implementations for SIMD Implementations. │ │ │ │ │ -_b_a_s_e_._h_h │ │ │ │ │ -Basic definitions for SIMD Implementations. │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t │ │ │ │ │ -std::integral_constant< std::size_t, i > index_constant │ │ │ │ │ -An index constant with value i. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k │ │ │ │ │ -Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) │ │ │ │ │ -implements Simd::mask() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ -bool allFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ -implements Simd::allFalse() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:124 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e │ │ │ │ │ -bool allTrue(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ -implements Simd::allTrue() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ -bool anyFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ -implements Simd::anyFalse() │ │ │ │ │ -DDeeffiinniittiioonn defaults.hh:114 │ │ │ │ │ +_1_1_0 inline _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _L_o_c_a_l_I_n_d_e_x_:_:_s_t_a_t_e() const { │ │ │ │ │ +111 return static_cast<_L_o_c_a_l_I_n_d_e_x_S_t_a_t_e>(state_); │ │ │ │ │ +112 } │ │ │ │ │ +113 │ │ │ │ │ +_1_1_4 inline void _L_o_c_a_l_I_n_d_e_x_:_:_s_e_t_S_t_a_t_e(_L_o_c_a_l_I_n_d_e_x_S_t_a_t_e state){ │ │ │ │ │ +115 state_ = static_cast(_s_t_a_t_e); │ │ │ │ │ +116 } │ │ │ │ │ +117 │ │ │ │ │ +120} // namespace Dune │ │ │ │ │ +121 │ │ │ │ │ +122#endif │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_S_t_a_t_e │ │ │ │ │ +LocalIndexState │ │ │ │ │ +The states available for the local indices. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +LocalIndex & operator=(std::size_t index) │ │ │ │ │ +Assign a new local index. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_:_:_s_t_a_t_e │ │ │ │ │ +LocalIndexState state() const │ │ │ │ │ +Get the state. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_:_:_l_o_c_a_l │ │ │ │ │ +const std::size_t & local() const │ │ │ │ │ +get the local index. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:97 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_:_:_s_e_t_S_t_a_t_e │ │ │ │ │ +void setState(LocalIndexState state) │ │ │ │ │ +Set the state. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:114 │ │ │ │ │ +_D_u_n_e_:_:_V_A_L_I_D │ │ │ │ │ +@ VALID │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_D_E_L_E_T_E_D │ │ │ │ │ +@ DELETED │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e │ │ │ │ │ -bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:543 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e │ │ │ │ │ -T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:520 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ -Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ -DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e │ │ │ │ │ -should have a member type type │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ -V type │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e │ │ │ │ │ -should have a member type type │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ -S type │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t │ │ │ │ │ -should be derived from a Dune::index_constant │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +An index present on the local process. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +LocalIndex() │ │ │ │ │ +Constructor. known to other processes. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +LocalIndex(std::size_t index) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:49 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00059.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: test.cc File Reference │ │ │ │ +dune-common: mpitraits.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,25 +65,51 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
test.cc File Reference
│ │ │ │ +
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
mpitraits.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <config.h>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <dune/common/simd/test.hh>
│ │ │ │ + │ │ │ │ +

Traits classes for mapping types onto MPI_Datatype. │ │ │ │ +More...

│ │ │ │ +
#include <cstddef>
│ │ │ │ +#include <cstdint>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <mpi.h>
│ │ │ │ +
│ │ │ │ +

Go to the source code of this file.

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

│ │ │ │ +Classes

struct  Dune::MPITraits< T >
 A traits class describing the mapping of types onto MPI_Datatypes. More...
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │ +

Detailed Description

│ │ │ │ +

Traits classes for mapping types onto MPI_Datatype.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,14 +1,33 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -test.cc File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_t_e_s_t_._h_h> │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +mpitraits.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Traits classes for mapping types onto MPI_Datatype. _M_o_r_e_._._. │ │ │ │ │ +#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_:_:_M_P_I_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ +  A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00062.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: base.hh File Reference │ │ │ │ +dune-common: mpicollectivecommunication.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,53 +65,24 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +
mpicollectivecommunication.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

Basic definitions for SIMD Implementations. │ │ │ │ -More...

│ │ │ │ - │ │ │ │ +
#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

struct  Dune::Simd::Overloads::ADLTag< i >
 
struct  Dune::Simd::Overloads::ADLTag< 0 >
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Simd
 Namespace for vectorization interface functions used by library developers.
 
namespace  Dune::Simd::Overloads
 Namespace for the overloads and specializations that make up a SIMD implementation.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Basic definitions for SIMD Implementations.

│ │ │ │ -

This file provides basic definitions and template declarations that are used to write SIMD abstraction layers.

│ │ │ │ -

This file should never be included by users of the SIMD abstraction. Include <dune/common/simd/simd.hh> instead.

│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +1,12 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -base.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _A_b_s_t_r_a_c_t_i_o_n_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e │ │ │ │ │ -Basic definitions for SIMD Implementations. _M_o_r_e_._._. │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpicollectivecommunication.hh File Reference │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_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_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g_<_ _i_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g_<_ _0_ _> │ │ │ │ │ -  │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ -  Namespace for vectorization interface functions used by library │ │ │ │ │ - developers. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ -  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ - implementation. │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Basic definitions for SIMD Implementations. │ │ │ │ │ -This file provides basic definitions and template declarations that are used to │ │ │ │ │ -write SIMD abstraction layers. │ │ │ │ │ -This file should never be included by users of the SIMD abstraction. Include │ │ │ │ │ -<_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> instead. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: base.hh Source File │ │ │ │ +dune-common: mpicollectivecommunication.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,66 +70,27 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
base.hh
│ │ │ │ +
mpicollectivecommunication.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_BASE_HH
│ │ │ │ -
4#define DUNE_COMMON_SIMD_BASE_HH
│ │ │ │ -
5
│ │ │ │ -
92namespace Dune {
│ │ │ │ -
93 namespace Simd {
│ │ │ │ -
94
│ │ │ │ -
97
│ │ │ │ -
112 namespace Overloads {
│ │ │ │ -
113
│ │ │ │ -
116
│ │ │ │ -
118
│ │ │ │ -
181 template<unsigned i, bool = true>
│ │ │ │ -
182 struct ADLTag;
│ │ │ │ -
183
│ │ │ │ -
184 template<unsigned i>
│ │ │ │ -
185 struct ADLTag<i> : ADLTag<i-1> {};
│ │ │ │ -
186
│ │ │ │ -
187 template<>
│ │ │ │ -
188 struct ADLTag<0> {};
│ │ │ │ -
189
│ │ │ │ -
191
│ │ │ │ -
195 template<class V, class SFINAETag = void>
│ │ │ │ -
196 struct ScalarType;
│ │ │ │ -
197
│ │ │ │ -
199
│ │ │ │ -
203 template<class S, class V, class SFINAETag = void>
│ │ │ │ -
204 struct RebindType;
│ │ │ │ -
205
│ │ │ │ -
207
│ │ │ │ -
211 template<class V, class SFINAETag = void>
│ │ │ │ -
212 struct LaneCount;
│ │ │ │ -
213
│ │ │ │ -
215
│ │ │ │ -
216 } // namespace Overloads
│ │ │ │ -
217 } // namespace Simd
│ │ │ │ -
218} // namespace Dune
│ │ │ │ -
219
│ │ │ │ -
220#endif // DUNE_COMMON_SIMD_BASE_HH
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition base.hh:182
│ │ │ │ -
should have a member type type
Definition standard.hh:60
│ │ │ │ -
should have a member type type
Definition standard.hh:67
│ │ │ │ -
should be derived from a Dune::index_constant
Definition standard.hh:74
│ │ │ │ +
3// Will be removed after the 2.7 release
│ │ │ │ +
4#warning "Deprecated header, use #include <dune/common/parallel/mpicommunication.hh> instead!"
│ │ │ │ + │ │ │ │ +
Implements an utility class that provides MPI's collective communication methods.
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,67 +1,21 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -base.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpicollectivecommunication.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-FileCopyrightInfo: 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_COMMON_SIMD_BASE_HH │ │ │ │ │ -4#define DUNE_COMMON_SIMD_BASE_HH │ │ │ │ │ -5 │ │ │ │ │ -92namespace _D_u_n_e { │ │ │ │ │ -93 namespace Simd { │ │ │ │ │ -94 │ │ │ │ │ -97 │ │ │ │ │ -112 namespace Overloads { │ │ │ │ │ -113 │ │ │ │ │ -116 │ │ │ │ │ -118 │ │ │ │ │ -181 template │ │ │ │ │ -_1_8_2 struct _A_D_L_T_a_g; │ │ │ │ │ -183 │ │ │ │ │ -184 template │ │ │ │ │ -_1_8_5 struct _A_D_L_T_a_g : _A_D_L_T_a_g {}; │ │ │ │ │ -186 │ │ │ │ │ -187 template<> │ │ │ │ │ -_1_8_8 struct _A_D_L_T_a_g<0> {}; │ │ │ │ │ -189 │ │ │ │ │ -191 │ │ │ │ │ -195 template │ │ │ │ │ -196 struct _S_c_a_l_a_r_T_y_p_e; │ │ │ │ │ -197 │ │ │ │ │ -199 │ │ │ │ │ -203 template │ │ │ │ │ -204 struct _R_e_b_i_n_d_T_y_p_e; │ │ │ │ │ -205 │ │ │ │ │ -207 │ │ │ │ │ -211 template │ │ │ │ │ -212 struct _L_a_n_e_C_o_u_n_t; │ │ │ │ │ -213 │ │ │ │ │ -215 │ │ │ │ │ -216 } // namespace Overloads │ │ │ │ │ -217 } // namespace Simd │ │ │ │ │ -218} // namespace Dune │ │ │ │ │ -219 │ │ │ │ │ -220#endif // DUNE_COMMON_SIMD_BASE_HH │ │ │ │ │ -_D_u_n_e │ │ │ │ │ -Dune namespace. │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ -Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ -DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e │ │ │ │ │ -should have a member type type │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e │ │ │ │ │ -should have a member type type │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t │ │ │ │ │ -should be derived from a Dune::index_constant │ │ │ │ │ -DDeeffiinniittiioonn standard.hh:74 │ │ │ │ │ +3// Will be removed after the 2.7 release │ │ │ │ │ +4#warning "Deprecated header, use #include instead!" │ │ │ │ │ +5#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides MPI's collective communication │ │ │ │ │ +methods. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00065.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: loop.hh File Reference │ │ │ │ +dune-common: mpi_collective_benchmark.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,679 +65,328 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Macros | │ │ │ │ -Functions
│ │ │ │ -
loop.hh File Reference
│ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
mpi_collective_benchmark.cc File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <cmath>
│ │ │ │ -#include <cstddef>
│ │ │ │ -#include <cstdlib>
│ │ │ │ -#include <cstdint>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <dune/common/math.hh>
│ │ │ │ -#include <dune/common/simd/simd.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -
│ │ │ │ -

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::LoopSIMD< T, S, A >
 
struct  Dune::Simd::Overloads::ScalarType< LoopSIMD< T, S, A > >
 
struct  Dune::Simd::Overloads::RebindType< U, LoopSIMD< T, S, A > >
 
struct  Dune::Simd::Overloads::LaneCount< LoopSIMD< T, S, A > >
 
struct  Dune::IsNumber< LoopSIMD< T, S, A > >
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Simd
 Namespace for vectorization interface functions used by library developers.
 
namespace  Dune::Simd::Overloads
 Namespace for the overloads and specializations that make up a SIMD implementation.
 
namespace  Dune::MathOverloads
 namespace for customization of math functions with Dune-Semantics
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Macros

#define DUNE_PRAGMA_OMP_SIMD
 
#define DUNE_SIMD_LOOP_PREFIX_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_UNARY_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_POSTFIX_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_BINARY_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_BITSHIFT_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_COMPARISON_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_CMATH_UNARY_OP(expr)
 
#define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN(expr, returnType)
 
#define DUNE_SIMD_LOOP_STD_UNARY_OP(expr)
 
#define DUNE_SIMD_LOOP_STD_BINARY_OP(expr)
 
│ │ │ │ +
#include <config.h>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <iomanip>
│ │ │ │ +#include <thread>
│ │ │ │ +#include <dune/common/parallel/mpihelper.hh>
│ │ │ │ +#include <dune/common/timer.hh>
│ │ │ │ +#include <dune/common/parametertree.hh>
│ │ │ │ +#include <dune/common/parametertreeparser.hh>
│ │ │ │ +
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ Functions

 Dune::DUNE_SIMD_LOOP_BINARY_OP (+)
 
 Dune::DUNE_SIMD_LOOP_BINARY_OP (-)
 
DUNE_SIMD_LOOP_BINARY_OP * Dune::DUNE_SIMD_LOOP_BINARY_OP (/);DUNE_SIMD_LOOP_BINARY_OP(%
 
DUNE_SIMD_LOOP_BINARY_OP & Dune::DUNE_SIMD_LOOP_BINARY_OP (|);DUNE_SIMD_LOOP_BINARY_OP(^
 
 Dune::DUNE_SIMD_LOOP_BITSHIFT_OP (<<)
 
 Dune::DUNE_SIMD_LOOP_BITSHIFT_OP (> >)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (<)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (<=)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (>=)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (!=)
 
DUNE_SIMD_LOOP_BOOLEAN_OP && Dune::DUNE_SIMD_LOOP_BOOLEAN_OP (||);template< class T, std::size_t S, std::size_t A > std::ostream &operator<<(std::ostream &os, const LoopSIMD< T, S, A > &v
 
template<class T , std::size_t S, std::size_t A>
auto Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, LoopSIMD< T, S, A > &&v) -> decltype(std::move(Simd::lane(l%lanes< T >(), v[l/lanes< T >()])))
 
template<class T , std::size_t S, std::size_t A>
auto Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, const LoopSIMD< T, S, A > &v) -> decltype(Simd::lane(l%lanes< T >(), v[l/lanes< T >()]))
 
template<class T , std::size_t S, std::size_t A>
auto Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, LoopSIMD< T, S, A > &v) -> decltype(Simd::lane(l%lanes< T >(), v[l/lanes< T >()]))
 
template<class T , std::size_t S, std::size_t AM, std::size_t AD>
auto Dune::Simd::Overloads::cond (ADLTag< 5 >, Simd::Mask< LoopSIMD< T, S, AM > > mask, LoopSIMD< T, S, AD > ifTrue, LoopSIMD< T, S, AD > ifFalse)
 
template<class M , class T , std::size_t S, std::size_t A>
auto Dune::Simd::Overloads::cond (ADLTag< 5, std::is_same< bool, Simd::Scalar< M > >::value &&Simd::lanes< M >()==Simd::lanes< LoopSIMD< T, S, A > >()>, M mask, LoopSIMD< T, S, A > ifTrue, LoopSIMD< T, S, A > ifFalse)
 
template<class M , std::size_t S, std::size_t A>
bool Dune::Simd::Overloads::anyTrue (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
 
template<class M , std::size_t S, std::size_t A>
bool Dune::Simd::Overloads::allTrue (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
 
template<class M , std::size_t S, std::size_t A>
bool Dune::Simd::Overloads::anyFalse (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
 
template<class M , std::size_t S, std::size_t A>
bool Dune::Simd::Overloads::allFalse (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cos)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sin)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tan)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (acos)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (asin)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (atan)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cosh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sinh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tanh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (acosh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (asinh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (atanh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (exp)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log10)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (exp2)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (expm1)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (ilogb, int)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log1p)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log2)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (logb)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sqrt)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cbrt)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (erf)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (erfc)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tgamma)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (lgamma)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (ceil)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (floor)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (trunc)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (round)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (lround, long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (llround, long long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (rint)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (lrint, long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (llrint, long long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (nearbyint)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (fabs)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (abs)
 
 Dune::DUNE_SIMD_LOOP_STD_UNARY_OP (real)
 
 Dune::DUNE_SIMD_LOOP_STD_UNARY_OP (imag)
 
 Dune::DUNE_SIMD_LOOP_STD_BINARY_OP (max)
 
 Dune::DUNE_SIMD_LOOP_STD_BINARY_OP (min)
 
template<class T , std::size_t S, std::size_t A>
auto Dune::MathOverloads::isNaN (const LoopSIMD< T, S, A > &v, PriorityTag< 3 >, ADLTag)
 
template<class T , std::size_t S, std::size_t A>
auto Dune::MathOverloads::isInf (const LoopSIMD< T, S, A > &v, PriorityTag< 3 >, ADLTag)
 
template<class T , std::size_t S, std::size_t A>
auto Dune::MathOverloads::isFinite (const LoopSIMD< T, S, A > &v, PriorityTag< 3 >, ADLTag)
 
template<class CC >
void communicate (CC &cc)
 
template<class CC >
Dune::Future< void > startCommunication (CC &cc)
 
template<class CC >
double runBlocking (CC &cc)
 
template<class CC >
double runNonblockingWait (CC &cc)
 
std::tuple< double, double > runNonblockingSleep (decltype(Dune::MPIHelper::getCommunication())&cc, std::chrono::duration< double > wait_time)
 
std::tuple< double, double > runNonblockingActive (decltype(Dune::MPIHelper::getCommunication())&cc, std::chrono::duration< double > wait_time)
 
std::tuple< double, double > determineOverlap (std::function< std::tuple< double, double >(std::chrono::duration< double >)> fun)
 
void printHeader ()
 
void run (int s)
 
int main (int argc, char **argv)
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Variables

Dune::ParameterTree options
 Benchmark for measure the possible overlap of computation and communication at MPI collective communications.
 
std::vector< std::string > all_methods
 
│ │ │ │ -

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ DUNE_PRAGMA_OMP_SIMD

│ │ │ │ +

Function Documentation

│ │ │ │ + │ │ │ │ +

◆ communicate()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +
│ │ │ │ +template<class CC >
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │
#define DUNE_PRAGMA_OMP_SIMDvoid communicate (CC & cc)
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_ASSIGNMENT_OP

│ │ │ │ + │ │ │ │ +

◆ determineOverlap()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_ASSIGNMENT_OPstd::tuple< double, double > determineOverlap ( SYMBOL)std::function< std::tuple< double, double >(std::chrono::duration< double >)> fun)
│ │ │ │
│ │ │ │ -Value:
auto operator SYMBOL(const Simd::Scalar<T> s) { \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
(*this)[i] SYMBOL s; \
│ │ │ │ -
} \
│ │ │ │ -
return *this; \
│ │ │ │ -
} \
│ │ │ │ -
\
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v) { \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
(*this)[i] SYMBOL v[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return *this; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_BINARY_OP

│ │ │ │ + │ │ │ │ +

◆ main()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_BINARY_OPint main ( SYMBOL)int argc,
char ** argv 
)
│ │ │ │
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL s; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = s SYMBOL v[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
│ │ │ │ -
const LoopSIMD<T,S,A> &w) { \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL w[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_BITSHIFT_OP

│ │ │ │ + │ │ │ │ +

◆ printHeader()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_BITSHIFT_OPvoid printHeader ( SYMBOL))
│ │ │ │
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A, class U> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL s; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
template<class T, std::size_t S, std::size_t A, class U, std::size_t AU> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
│ │ │ │ -
const LoopSIMD<U,S,AU> &w) { \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL w[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_BOOLEAN_OP

│ │ │ │ + │ │ │ │ +

◆ run()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_BOOLEAN_OPvoid run ( SYMBOL)int s)
│ │ │ │
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
│ │ │ │ -
Simd::Mask<LoopSIMD<T,S,A>> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL s; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const Simd::Mask<T> s, const LoopSIMD<T,S,A> &v) { \
│ │ │ │ -
Simd::Mask<LoopSIMD<T,S,A>> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = s SYMBOL v[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
│ │ │ │ -
const LoopSIMD<T,S,A> &w) { \
│ │ │ │ -
Simd::Mask<LoopSIMD<T,S,A>> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL w[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP

│ │ │ │ + │ │ │ │ +

◆ runBlocking()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +
│ │ │ │ +template<class CC >
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_CMATH_UNARY_OPdouble runBlocking ( expr)CC & cc)
│ │ │ │
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A, typename Sfinae = \
│ │ │ │ -
typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
│ │ │ │ -
auto expr(const LoopSIMD<T,S,A> &v) { \
│ │ │ │ -
using std::expr; \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
for(std::size_t i=0; i<S; i++) { \
│ │ │ │ -
out[i] = expr(v[i]); \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN

│ │ │ │ + │ │ │ │ +

◆ runNonblockingActive()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURNstd::tuple< double, double > runNonblockingActive ( expr, decltype(Dune::MPIHelper::getCommunication())& cc,
 returnType std::chrono::duration< double > wait_time 
)
│ │ │ │
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A, typename Sfinae = \
│ │ │ │ -
typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
│ │ │ │ -
auto expr(const LoopSIMD<T,S,A> &v) { \
│ │ │ │ -
using std::expr; \
│ │ │ │ -
LoopSIMD<returnType,S> out; \
│ │ │ │ -
for(std::size_t i=0; i<S; i++) { \
│ │ │ │ -
out[i] = expr(v[i]); \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_COMPARISON_OP

│ │ │ │ + │ │ │ │ +

◆ runNonblockingSleep()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ -
#define DUNE_SIMD_LOOP_COMPARISON_OPstd::tuple< double, double > runNonblockingSleep ( SYMBOL)decltype(Dune::MPIHelper::getCommunication())& cc,
std::chrono::duration< double > wait_time 
│ │ │ │ -
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A, class U> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
│ │ │ │ -
Simd::Mask<LoopSIMD<T,S,A>> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL s; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
│ │ │ │ -
Simd::Mask<LoopSIMD<T,S,A>> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = s SYMBOL v[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
│ │ │ │ -
const LoopSIMD<T,S,A> &w) { \
│ │ │ │ -
Simd::Mask<LoopSIMD<T,S,A>> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = v[i] SYMBOL w[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_POSTFIX_OP

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_POSTFIX_OP( SYMBOL))
│ │ │ │
│ │ │ │ -Value:
auto operator SYMBOL(int){ \
│ │ │ │ -
LoopSIMD<T,S,A> out = *this; \
│ │ │ │ -
SYMBOL(*this); \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_PREFIX_OP

│ │ │ │ + │ │ │ │ +

◆ runNonblockingWait()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +
│ │ │ │ +template<class CC >
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_PREFIX_OPdouble runNonblockingWait ( SYMBOL)CC & cc)
│ │ │ │
│ │ │ │ -Value:
auto operator SYMBOL() { \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
SYMBOL(*this)[i]; \
│ │ │ │ -
} \
│ │ │ │ -
return *this; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_STD_BINARY_OP

│ │ │ │ + │ │ │ │ +

◆ startCommunication()

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +
│ │ │ │ +template<class CC >
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_STD_BINARY_OPDune::Future< void > startCommunication ( expr)CC & cc)
│ │ │ │
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto expr(const LoopSIMD<T,S,A> &v, const LoopSIMD<T,S,A> &w) { \
│ │ │ │ -
using std::expr; \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
for(std::size_t i=0; i<S; i++) { \
│ │ │ │ -
out[i] = expr(v[i],w[i]); \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_STD_UNARY_OP

│ │ │ │ +

Variable Documentation

│ │ │ │ + │ │ │ │ +

◆ all_methods

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_STD_UNARY_OP( expr)std::vector<std::string> all_methods
│ │ │ │
│ │ │ │ -Value:
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto expr(const LoopSIMD<T,S,A> &v) { \
│ │ │ │ -
using std::expr; \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
for(std::size_t i=0; i<S; i++) { \
│ │ │ │ -
out[i] = expr(v[i]); \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
\
│ │ │ │ -
template<class T, std::size_t S, std::size_t A> \
│ │ │ │ -
auto expr(const LoopSIMD<std::complex<T>,S,A> &v) { \
│ │ │ │ -
using std::expr; \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
for(std::size_t i=0; i<S; i++) { \
│ │ │ │ -
out[i] = expr(v[i]); \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ +Initial value:
= {"allreduce",
│ │ │ │ +
"barrier",
│ │ │ │ +
"broadcast",
│ │ │ │ +
"gather",
│ │ │ │ +
"allgather",
│ │ │ │ +
"scatter"}
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_LOOP_UNARY_OP

│ │ │ │ + │ │ │ │ +

◆ options

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │
#define DUNE_SIMD_LOOP_UNARY_OP( SYMBOL)Dune::ParameterTree options
│ │ │ │
│ │ │ │ -Value:
auto operator SYMBOL() const { \
│ │ │ │ -
LoopSIMD<T,S,A> out; \
│ │ │ │ -
DUNE_PRAGMA_OMP_SIMD \
│ │ │ │ -
for(std::size_t i=0; i<S; i++){ \
│ │ │ │ -
out[i] = SYMBOL((*this)[i]); \
│ │ │ │ -
} \
│ │ │ │ -
return out; \
│ │ │ │ -
} \
│ │ │ │ -
static_assert(true, "expecting ;")
│ │ │ │ -
│ │ │ │ + │ │ │ │ +

Benchmark for measure the possible overlap of computation and communication at MPI collective communications.

│ │ │ │ +

This benchmark is inspired by the sandia micro benchmark: W. Lawry, C. Wilson, A. Maccabe, R. Brightwell. COMB: A Portable Benchmark Suite for Assessing MPI Overlap. In Proceedings of the IEEE International Conference on Cluster Computing (CLUSTER 2002), p. 472, 2002. http://www.cs.sandia.gov/smb/overhead.html

│ │ │ │ +

The following communication times are measured: Blocking: Blocking call. E.g. MPI_Allreduce Nonblocking_wait (NB_Wait): Nonblocking (e.g. MPI_Iallreduce) call directly followed by MPI_Wait. Nonblocking_sleep (NB_Sleep): Nonblocking call followed by a busy wait until the work time has passed. Then MPI_Wait. Nonblocking_active (NB_active): Nonblocking call followed by a basy wait where in every iteration MPI_Test is called until the work time has passed. The MPI_wait.

│ │ │ │ +

The overhead is computed as the time for the Nonblocking call plus the time for MPI_Wait. The iteration time is the time for the whole communication. The available part of the communication time(avail(%)) is computed as 1-(overhead/base_t), where base_t is the time for calling the method with wait time = 0. The overhead is determined by increasing the work time successive until it is the dominant factor in the iteration time. Then the overhead is computed as iter_t-work_t.

│ │ │ │ +

Usage: mpirun ./mpi_collective_benchmark [options]

│ │ │ │ +

options: -method: default: allreduce. possible methods: allreduce, barrier, broadcast, gather, allgather, scatter -iterations: default: 10000. Number of iterations for measure the time for one communication -allMethods: default:0. If 1 iterates over all available methods -startSize: default: n, where n is the size of MPI_COMM_WORLD. runs the benchmark for different communicator sizes, starting with startSize. After every run the size is doubled. Finally one run is made for the whole communicator. -verbose: default: 0. If 1 prints intermediate information while determining the overhead. -threshold: default: 2. The threshold when the work time is the dominant factor in the iteration time. (Similar to the threshold in the sandia benchmark) -nohdr: default: 0. Suppress output of the header.

│ │ │ │ +

options can be set either in the options.ini file or can be pass at the command-line (-key value).

│ │ │ │ +

To get a good 'available' value for the NB_sleep communication, some MPI implementation need to spawn an extra thread. With MPICH you can activate this by setting the environment variable MPI_ASYNC_PROGRESS to 1, with IntelMPI the variable is called I_MPI_ASYNC_PROGRESS. (https://software.intel.com/en-us/mpi-developer-reference-linux-asynchronous-progress-control)

│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,489 +1,145 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -_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 │ │ │ │ │ -loop.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_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_I_M_D_<_ _T_,_ _S_,_ _A_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_<_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e_<_ _U_,_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t_<_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_N_u_m_b_e_r_<_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ -  Namespace for vectorization interface functions used by library │ │ │ │ │ - developers. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ -  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ - implementation. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s │ │ │ │ │ -  namespace for customization of math functions with Dune-Semantics │ │ │ │ │ -  │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___P_R_A_G_M_A___O_M_P___S_I_M_D │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___P_R_E_F_I_X___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___U_N_A_R_Y___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___P_O_S_T_F_I_X___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___B_I_T_S_H_I_F_T___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___B_O_O_L_E_A_N___O_P(SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P(expr) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N(expr, returnType) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___U_N_A_R_Y___O_P(expr) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___B_I_N_A_R_Y___O_P(expr) │ │ │ │ │ -  │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ + * _b_e_n_c_h_m_a_r_k │ │ │ │ │ +_F_u_n_c_t_i_o_n_s | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +mpi_collective_benchmark.cc File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_h_e_l_p_e_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_i_m_e_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_m_e_t_e_r_t_r_e_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_m_e_t_e_r_t_r_e_e_p_a_r_s_e_r_._h_h> │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P (+) │ │ │ │ │ +template │ │ │ │ │ + void  _c_o_m_m_u_n_i_c_a_t_e (CC &cc) │ │ │ │ │   │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P (-) │ │ │ │ │ +template │ │ │ │ │ + _D_u_n_e_:_:_F_u_t_u_r_e< void >  _s_t_a_r_t_C_o_m_m_u_n_i_c_a_t_i_o_n (CC &cc) │ │ │ │ │   │ │ │ │ │ - DUNE_SIMD_LOOP_BINARY_OP *  _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P (/ │ │ │ │ │ - );DUNE_SIMD_LOOP_BINARY_OP(% │ │ │ │ │ +template │ │ │ │ │ + double  _r_u_n_B_l_o_c_k_i_n_g (CC &cc) │ │ │ │ │   │ │ │ │ │ - DUNE_SIMD_LOOP_BINARY_OP &  _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P │ │ │ │ │ - (|);DUNE_SIMD_LOOP_BINARY_OP(^ │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_T_S_H_I_F_T___O_P (<<) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_T_S_H_I_F_T___O_P (> >) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (<) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (<=) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (>=) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (!=) │ │ │ │ │ -  │ │ │ │ │ -DUNE_SIMD_LOOP_BOOLEAN_OP &&  _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_O_O_L_E_A_N___O_P (||);template< │ │ │ │ │ - class T, std::size_t S, std::size_t A > std:: │ │ │ │ │ - ostream &operator<<(std::ostream &os, const │ │ │ │ │ - _L_o_o_p_S_I_M_D< T, S, A > &v │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, std:: │ │ │ │ │ - size_t l, _L_o_o_p_S_I_M_D< T, S, A > &&v) -> decltype │ │ │ │ │ - (std::move(Simd::lane(l%_l_a_n_e_s< T >(), v[l/_l_a_n_e_s< │ │ │ │ │ - T >()]))) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, std:: │ │ │ │ │ - size_t l, const _L_o_o_p_S_I_M_D< T, S, A > &v) - │ │ │ │ │ - > decltype(Simd::lane(l%_l_a_n_e_s< T >(), v[l/_l_a_n_e_s< │ │ │ │ │ - T >()])) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, std:: │ │ │ │ │ - size_t l, _L_o_o_p_S_I_M_D< T, S, A > &v) -> decltype │ │ │ │ │ - (Simd::lane(l%_l_a_n_e_s< T >(), v[l/_l_a_n_e_s< T >()])) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d (_A_D_L_T_a_g< 5 >, _S_i_m_d_:_: │ │ │ │ │ - _M_a_s_k< _L_o_o_p_S_I_M_D< T, S, AM > > _m_a_s_k, _L_o_o_p_S_I_M_D< T, │ │ │ │ │ - S, AD > ifTrue, _L_o_o_p_S_I_M_D< T, S, AD > ifFalse) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d (_A_D_L_T_a_g< 5, std:: │ │ │ │ │ - is_same< bool, _S_i_m_d_:_:_S_c_a_l_a_r< M > >::value │ │ │ │ │ - &&_S_i_m_d_:_:_l_a_n_e_s< M >()==_S_i_m_d_:_:_l_a_n_e_s< _L_o_o_p_S_I_M_D< T, │ │ │ │ │ - S, A > >()>, M _m_a_s_k, _L_o_o_p_S_I_M_D< T, S, A > ifTrue, │ │ │ │ │ - _L_o_o_p_S_I_M_D< T, S, A > ifFalse) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ - _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ - _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ - _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ - _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (cos) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (sin) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (tan) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (acos) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (asin) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (atan) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (cosh) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (sinh) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (tanh) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (acosh) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (asinh) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (atanh) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (exp) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log10) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (exp2) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (expm1) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ - (ilogb, int) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log1p) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log2) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (logb) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (sqrt) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (cbrt) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (erf) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (erfc) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (tgamma) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (lgamma) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (ceil) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (floor) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (trunc) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (round) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ - (lround, long) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ - (llround, long long) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (rint) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ - (lrint, long) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ - (llrint, long long) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (nearbyint) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (fabs) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (abs) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___U_N_A_R_Y___O_P (real) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___U_N_A_R_Y___O_P (imag) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___B_I_N_A_R_Y___O_P (max) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___B_I_N_A_R_Y___O_P (min) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N (const _L_o_o_p_S_I_M_D< T, S, │ │ │ │ │ - A > &v, _P_r_i_o_r_i_t_y_T_a_g< 3 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f (const _L_o_o_p_S_I_M_D< T, S, │ │ │ │ │ - A > &v, _P_r_i_o_r_i_t_y_T_a_g< 3 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e (const _L_o_o_p_S_I_M_D< T, │ │ │ │ │ - S, A > &v, _P_r_i_o_r_i_t_y_T_a_g< 3 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__PPRRAAGGMMAA__OOMMPP__SSIIMMDD ********** │ │ │ │ │ -#define DUNE_PRAGMA_OMP_SIMD │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__LLOOOOPP__AASSSSIIGGNNMMEENNTT__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_LOOP_ASSIGNMENT_OP (   SYMBOL ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -auto operator SYMBOL(const Simd::Scalar s) { \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i &v) { \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, const Simd::Scalar s) { \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const Simd::Scalar s, const LoopSIMD &v) { \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ -const LoopSIMD &w) { \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, const U s) { \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ -const LoopSIMD &w) { \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, const Simd::Scalar s) { \ │ │ │ │ │ -Simd::Mask> out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const Simd::Mask s, const LoopSIMD &v) { \ │ │ │ │ │ -Simd::Mask> out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ -const LoopSIMD &w) { \ │ │ │ │ │ -Simd::Mask> out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i>::value> > \ │ │ │ │ │ -auto expr(const LoopSIMD &v) { \ │ │ │ │ │ -using std::expr; \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -for(std::size_t i=0; i>::value> > \ │ │ │ │ │ -auto expr(const LoopSIMD &v) { \ │ │ │ │ │ -using std::expr; \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, const U s) { \ │ │ │ │ │ -Simd::Mask> out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const Simd::Scalar s, const LoopSIMD &v) { \ │ │ │ │ │ -Simd::Mask> out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ -const LoopSIMD &w) { \ │ │ │ │ │ -Simd::Mask> out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i out = *this; \ │ │ │ │ │ -SYMBOL(*this); \ │ │ │ │ │ -return out; \ │ │ │ │ │ -} \ │ │ │ │ │ -static_assert(true, "expecting ;") │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__LLOOOOPP__PPRREEFFIIXX__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_LOOP_PREFIX_OP (   SYMBOL ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -auto operator SYMBOL() { \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto expr(const LoopSIMD &v, const LoopSIMD &w) { \ │ │ │ │ │ -using std::expr; \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto expr(const LoopSIMD &v) { \ │ │ │ │ │ -using std::expr; \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -for(std::size_t i=0; i \ │ │ │ │ │ -auto expr(const LoopSIMD,S,A> &v) { \ │ │ │ │ │ -using std::expr; \ │ │ │ │ │ -LoopSIMD out; \ │ │ │ │ │ -for(std::size_t i=0; i out; \ │ │ │ │ │ -DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ -for(std::size_t i=0; i │ │ │ │ │ + double  _r_u_n_N_o_n_b_l_o_c_k_i_n_g_W_a_i_t (CC &cc) │ │ │ │ │ +  │ │ │ │ │ +std::tuple< double, double >  _r_u_n_N_o_n_b_l_o_c_k_i_n_g_S_l_e_e_p (decltype(_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_: │ │ │ │ │ + _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n())&cc, std::chrono::duration< │ │ │ │ │ + double > wait_time) │ │ │ │ │ +  │ │ │ │ │ +std::tuple< double, double >  _r_u_n_N_o_n_b_l_o_c_k_i_n_g_A_c_t_i_v_e (decltype(_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_: │ │ │ │ │ + _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n())&cc, std::chrono::duration< │ │ │ │ │ + double > wait_time) │ │ │ │ │ +  │ │ │ │ │ +std::tuple< double, double >  _d_e_t_e_r_m_i_n_e_O_v_e_r_l_a_p (std::function< std::tuple< │ │ │ │ │ + double, double >(std::chrono::duration< double │ │ │ │ │ + >)> fun) │ │ │ │ │ +  │ │ │ │ │ + void  _p_r_i_n_t_H_e_a_d_e_r () │ │ │ │ │ +  │ │ │ │ │ + void  _r_u_n (int s) │ │ │ │ │ +  │ │ │ │ │ + int  _m_a_i_n (int argc, char **argv) │ │ │ │ │ +  │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ + _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e  _o_p_t_i_o_n_s │ │ │ │ │ + Benchmark for measure the possible overlap of │ │ │ │ │ +  computation and communication at MPI collective │ │ │ │ │ + communications. │ │ │ │ │ +  │ │ │ │ │ +std::vector< std::string >  _a_l_l___m_e_t_h_o_d_s │ │ │ │ │ +  │ │ │ │ │ +********** FFuunnccttiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? ccoommmmuunniiccaattee(()) ********** │ │ │ │ │ +template │ │ │ │ │ +void communicate ( CC &  cccc ) │ │ │ │ │ +********** _?◆_? ddeetteerrmmiinneeOOvveerrllaapp(()) ********** │ │ │ │ │ +std::tuple< double, double > ( std::function< std::tuple< double, double ffuunn ) │ │ │ │ │ +determineOverlap >(std::chrono::duration< double >)>  │ │ │ │ │ +********** _?◆_? mmaaiinn(()) ********** │ │ │ │ │ +int main ( int  aarrggcc, │ │ │ │ │ + char **  aarrggvv  │ │ │ │ │ + ) │ │ │ │ │ +********** _?◆_? pprriinnttHHeeaaddeerr(()) ********** │ │ │ │ │ +void printHeader ( ) │ │ │ │ │ +********** _?◆_? rruunn(()) ********** │ │ │ │ │ +void run ( int  ss ) │ │ │ │ │ +********** _?◆_? rruunnBBlloocckkiinngg(()) ********** │ │ │ │ │ +template │ │ │ │ │ +double runBlocking ( CC &  cccc ) │ │ │ │ │ +********** _?◆_? rruunnNNoonnbblloocckkiinnggAAccttiivvee(()) ********** │ │ │ │ │ +std::tuple< double, double > ( decltype(_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_: cccc, │ │ │ │ │ +runNonblockingActive _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n())&  │ │ │ │ │ + std::chrono::duration< double >  wwaaiitt__ttiimmee  │ │ │ │ │ + ) │ │ │ │ │ +********** _?◆_? rruunnNNoonnbblloocckkiinnggSSlleeeepp(()) ********** │ │ │ │ │ +std::tuple< double, double > ( decltype(_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_: cccc, │ │ │ │ │ +runNonblockingSleep _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n())&  │ │ │ │ │ + std::chrono::duration< double >  wwaaiitt__ttiimmee  │ │ │ │ │ + ) │ │ │ │ │ +********** _?◆_? rruunnNNoonnbblloocckkiinnggWWaaiitt(()) ********** │ │ │ │ │ +template │ │ │ │ │ +double runNonblockingWait ( CC &  cccc ) │ │ │ │ │ +********** _?◆_? ssttaarrttCCoommmmuunniiccaattiioonn(()) ********** │ │ │ │ │ +template │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e< void > startCommunication ( CC &  cccc ) │ │ │ │ │ +********** VVaarriiaabbllee DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? aallll__mmeetthhooddss ********** │ │ │ │ │ +std::vector all_methods │ │ │ │ │ +IInniittiiaall vvaalluuee:: │ │ │ │ │ += {"allreduce", │ │ │ │ │ +"barrier", │ │ │ │ │ +"broadcast", │ │ │ │ │ +"gather", │ │ │ │ │ +"allgather", │ │ │ │ │ +"scatter"} │ │ │ │ │ +********** _?◆_? ooppttiioonnss ********** │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e options │ │ │ │ │ +Benchmark for measure the possible overlap of computation and communication at │ │ │ │ │ +MPI collective communications. │ │ │ │ │ +This benchmark is inspired by the sandia micro benchmark: W. Lawry, C. Wilson, │ │ │ │ │ +A. Maccabe, R. Brightwell. COMB: A Portable Benchmark Suite for Assessing MPI │ │ │ │ │ +Overlap. In Proceedings of the IEEE International Conference on Cluster │ │ │ │ │ +Computing (CLUSTER 2002), p. 472, 2002. _h_t_t_p_:_/_/_w_w_w_._c_s_._s_a_n_d_i_a_._g_o_v_/_s_m_b_/ │ │ │ │ │ +_o_v_e_r_h_e_a_d_._h_t_m_l │ │ │ │ │ +The following communication times are measured: Blocking: Blocking call. E.g. │ │ │ │ │ +MPI_Allreduce Nonblocking_wait (NB_Wait): Nonblocking (e.g. MPI_Iallreduce) │ │ │ │ │ +call directly followed by MPI_Wait. Nonblocking_sleep (NB_Sleep): Nonblocking │ │ │ │ │ +call followed by a busy wait until the work time has passed. Then MPI_Wait. │ │ │ │ │ +Nonblocking_active (NB_active): Nonblocking call followed by a basy wait where │ │ │ │ │ +in every iteration MPI_Test is called until the work time has passed. The │ │ │ │ │ +MPI_wait. │ │ │ │ │ +The overhead is computed as the time for the Nonblocking call plus the time for │ │ │ │ │ +MPI_Wait. The iteration time is the time for the whole communication. The │ │ │ │ │ +available part of the communication time(avail(%)) is computed as 1-(overhead/ │ │ │ │ │ +base_t), where base_t is the time for calling the method with wait time = 0. │ │ │ │ │ +The overhead is determined by increasing the work time successive until it is │ │ │ │ │ +the dominant factor in the iteration time. Then the overhead is computed as │ │ │ │ │ +iter_t-work_t. │ │ │ │ │ +Usage: mpirun ./mpi_collective_benchmark [options] │ │ │ │ │ +options: -method: default: allreduce. possible methods: allreduce, barrier, │ │ │ │ │ +broadcast, gather, allgather, scatter -iterations: default: 10000. Number of │ │ │ │ │ +iterations for measure the time for one communication -allMethods: default:0. │ │ │ │ │ +If 1 iterates over all available methods -startSize: default: n, where n is the │ │ │ │ │ +size of MPI_COMM_WORLD. runs the benchmark for different communicator sizes, │ │ │ │ │ +starting with startSize. After every run the size is doubled. Finally one run │ │ │ │ │ +is made for the whole communicator. -verbose: default: 0. If 1 prints │ │ │ │ │ +intermediate information while determining the overhead. -threshold: default: │ │ │ │ │ +2. The threshold when the work time is the dominant factor in the iteration │ │ │ │ │ +time. (Similar to the threshold in the sandia benchmark) -nohdr: default: 0. │ │ │ │ │ +Suppress output of the header. │ │ │ │ │ +options can be set either in the options.ini file or can be pass at the │ │ │ │ │ +command-line (-key value). │ │ │ │ │ +To get a good 'available' value for the NB_sleep communication, some MPI │ │ │ │ │ +implementation need to spawn an extra thread. With MPICH you can activate this │ │ │ │ │ +by setting the environment variable MPI_ASYNC_PROGRESS to 1, with IntelMPI the │ │ │ │ │ +variable is called I_MPI_ASYNC_PROGRESS. (_h_t_t_p_s_:_/_/_s_o_f_t_w_a_r_e_._i_n_t_e_l_._c_o_m_/_e_n_-_u_s_/_m_p_i_- │ │ │ │ │ +_d_e_v_e_l_o_p_e_r_-_r_e_f_e_r_e_n_c_e_-_l_i_n_u_x_-_a_s_y_n_c_h_r_o_n_o_u_s_-_p_r_o_g_r_e_s_s_-_c_o_n_t_r_o_l) │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00068.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: simd.hh File Reference │ │ │ │ +dune-common: mpipack.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,101 +65,51 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions
│ │ │ │ -
simd.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
mpipack.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Abstractions for support of dedicated SIMD data types. │ │ │ │ +

See MPI_Pack. │ │ │ │ More...

│ │ │ │ -
#include <cassert>
│ │ │ │ -#include <cstddef>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <dune/common/conditional.hh>
│ │ │ │ -#include <dune/common/debugalign.hh>
│ │ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/vc.hh>
│ │ │ │ +
#include <vector>
│ │ │ │ +#include <mpi.h>
│ │ │ │ +#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ +#include <dune/common/parallel/mpidata.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::SimdScalarTypeTraits< T >
class  Dune::MPIPack
 
struct  Dune::SimdScalarTypeTraits< AlignedNumber< T, align > >
 deduce the underlying scalar data type of an AlignedNumber More...
 
struct  Dune::SimdIndexTypeTraits< V, typename >
 
struct  Dune::SimdMaskTypeTraits< V, typename >
struct  Dune::MPIData< P, std::enable_if_t< std::is_same< std::remove_const_t< P >, MPIPack >::value > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Typedefs

template<typename T >
using Dune::SimdScalar = typename SimdScalarTypeTraits< T >::type
 
template<typename V >
using Dune::SimdIndex = typename SimdIndexTypeTraits< V >::type
 An simd vector of indices corresponding to a simd vector V.
 
template<typename V >
using Dune::SimdMask = typename SimdMaskTypeTraits< V >::type
 A simd vector of truth values corresponding to a simd vector V.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

template<class T >
std::size_t Dune::lanes (const T &)
 get the number of lanes of a simd vector (scalar version)
 
template<class T >
Dune::lane (std::size_t l, const T &v)
 access a lane of a simd vector (scalar version)
 
template<class T >
T & Dune::lane (std::size_t l, T &v)
 access a lane of a simd vector (scalar version)
 
template<class T >
void Dune::assign (T &dst, const T &src, bool mask)
 masked Simd assignment (scalar version)
 
template<class T >
void Dune::swap (T &v1, T &v2, bool mask)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Abstractions for support of dedicated SIMD data types.

│ │ │ │ -

Libraries like Vc (https://github.com/VcDevel/Vc) add high-level data types for SIMD (or vectorization) support in C++. Most of these operations mimic the behavior of a numerical data type. Some boolean operations can not be implemented in a compatible way to trivial data types.

│ │ │ │ -

This header contains additional abstractions to help writing code that works with trivial numerical data types (like double) and Vc vectorization data types.

│ │ │ │ -

See also the conditional.hh and range_utils.hh headers.

│ │ │ │ -
Deprecated:
Use the newer simd architecture from dune/common/simd/simd.hh instead.
│ │ │ │ +

See MPI_Pack.

│ │ │ │ +

This Wrapper class takes care of the memory management and provides methods to pack and unpack objects. All objects that can be used for MPI communication can also be packed and unpacked to/from MPIPack.

│ │ │ │ +
Author
Nils-Arne Dreier
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,79 +1,35 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -simd.hh File Reference │ │ │ │ │ -Abstractions for support of dedicated SIMD data types. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_o_n_d_i_t_i_o_n_a_l_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_b_u_g_a_l_i_g_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_c_._h_h> │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +mpipack.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +See MPI_Pack. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._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_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_M_P_I_P_a_c_k │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _> │ │ │ │ │ -  deduce the underlying scalar data type of an AlignedNumber _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s_<_ _V_,_ _t_y_p_e_n_a_m_e_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s_<_ _V_,_ _t_y_p_e_n_a_m_e_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_< │ │ │ │ │ + _P_ _>_,_ _M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r = typename _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s< T >::type │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_S_i_m_d_I_n_d_e_x = typename _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s< V >::type │ │ │ │ │ -  An simd vector of indices corresponding to a simd vector V. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_S_i_m_d_M_a_s_k = typename _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s< V >::type │ │ │ │ │ -  A simd vector of truth values corresponding to a simd vector V. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -std::size_t  _D_u_n_e_:_:_l_a_n_e_s (const T &) │ │ │ │ │ -  get the number of lanes of a simd vector (scalar version) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - T  _D_u_n_e_:_:_l_a_n_e (std::size_t l, const T &v) │ │ │ │ │ -  access a lane of a simd vector (scalar version) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - T &  _D_u_n_e_:_:_l_a_n_e (std::size_t l, T &v) │ │ │ │ │ -  access a lane of a simd vector (scalar version) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_a_s_s_i_g_n (T &dst, const T &src, bool mask) │ │ │ │ │ -  masked _S_i_m_d assignment (scalar version) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_s_w_a_p (T &v1, T &v2, bool mask) │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Abstractions for support of dedicated SIMD data types. │ │ │ │ │ -Libraries like Vc (_h_t_t_p_s_:_/_/_g_i_t_h_u_b_._c_o_m_/_V_c_D_e_v_e_l_/_V_c) add high-level data types for │ │ │ │ │ -SIMD (or vectorization) support in C++. Most of these operations mimic the │ │ │ │ │ -behavior of a numerical data type. Some boolean operations can not be │ │ │ │ │ -implemented in a compatible way to trivial data types. │ │ │ │ │ -This header contains additional abstractions to help writing code that works │ │ │ │ │ -with trivial numerical data types (like double) and Vc vectorization data │ │ │ │ │ -types. │ │ │ │ │ -See also the _c_o_n_d_i_t_i_o_n_a_l_._h_h and range_utils.hh headers. │ │ │ │ │ - _DD_ee_pp_rr_ee_cc_aa_tt_ee_dd_:: │ │ │ │ │ - Use the newer simd architecture from _d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h instead. │ │ │ │ │ +See MPI_Pack. │ │ │ │ │ +This Wrapper class takes care of the memory management and provides methods to │ │ │ │ │ +pack and unpack objects. All objects that can be used for MPI communication can │ │ │ │ │ +also be packed and unpacked to/from MPIPack. │ │ │ │ │ + Author │ │ │ │ │ + Nils-Arne Dreier │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: simd.hh Source File │ │ │ │ +dune-common: mpipack.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,522 +70,283 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
simd.hh
│ │ │ │ +
mpipack.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_HH
│ │ │ │ -
4#define DUNE_COMMON_SIMD_HH
│ │ │ │ -
5
│ │ │ │ -
6#warning dune/common/simd.hh is deprecated.
│ │ │ │ -
7#warning Use the new infrastructure from dune/common/simd/simd.h instead.
│ │ │ │ -
8
│ │ │ │ -
30#include <cassert>
│ │ │ │ -
31#include <cstddef>
│ │ │ │ -
32#include <type_traits>
│ │ │ │ -
33#include <utility>
│ │ │ │ -
34
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
38#if HAVE_VC
│ │ │ │ -
39// include Vc part of new simd interface to provide compatibility for
│ │ │ │ -
40// functionality that has been switched over.
│ │ │ │ - │ │ │ │ -
42#endif
│ │ │ │ - │ │ │ │ -
44#include <dune/common/vc.hh>
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ +
20#ifndef DUNE_COMMON_PARALLEL_MPIPACK_HH
│ │ │ │ +
21#define DUNE_COMMON_PARALLEL_MPIPACK_HH
│ │ │ │ +
22
│ │ │ │ +
23#include <vector>
│ │ │ │ +
24#if HAVE_MPI
│ │ │ │ +
25#include <mpi.h>
│ │ │ │ + │ │ │ │ + │ │ │ │ +
28
│ │ │ │ +
29
│ │ │ │ +
30namespace Dune {
│ │ │ │ +
31
│ │ │ │ +
│ │ │ │ +
32 class MPIPack {
│ │ │ │ +
33 std::vector<char> _buffer;
│ │ │ │ +
34 int _position;
│ │ │ │ +
35 MPI_Comm _comm;
│ │ │ │ +
36
│ │ │ │ +
37 friend struct MPIData<MPIPack>;
│ │ │ │ +
38 friend struct MPIData<const MPIPack>;
│ │ │ │ +
39 public:
│ │ │ │ +
│ │ │ │ +
40 MPIPack(Communication<MPI_Comm> comm, std::size_t size = 0)
│ │ │ │ +
41 : _buffer(size)
│ │ │ │ +
42 , _position(0)
│ │ │ │ +
43 , _comm(comm)
│ │ │ │ +
44 {}
│ │ │ │ +
│ │ │ │
45
│ │ │ │ -
46namespace Dune
│ │ │ │ -
47{
│ │ │ │ -
48
│ │ │ │ -
49#if HAVE_VC
│ │ │ │ -
50 namespace VcImpl {
│ │ │ │ -
52
│ │ │ │ -
61 template<class V>
│ │ │ │ -
62 class Proxy
│ │ │ │ -
63 {
│ │ │ │ -
64 static_assert(std::is_same<V, std::decay_t<V> >::value, "Class Proxy "
│ │ │ │ -
65 "may only be instantiated with unqualified types");
│ │ │ │ -
66 public:
│ │ │ │ -
67 using value_type = typename V::value_type;
│ │ │ │ -
68
│ │ │ │ -
69 private:
│ │ │ │ -
70 static_assert(std::is_arithmetic<value_type>::value,
│ │ │ │ -
71 "Only arithmetic types are supported");
│ │ │ │ -
72 V &vec_;
│ │ │ │ -
73 std::size_t idx_;
│ │ │ │ -
74
│ │ │ │ -
75 public:
│ │ │ │ -
76 Proxy(std::size_t idx, V &vec)
│ │ │ │ -
77 : vec_(vec), idx_(idx)
│ │ │ │ -
78 { }
│ │ │ │ -
79
│ │ │ │ -
80 operator value_type() const { return vec_[idx_]; }
│ │ │ │ -
81
│ │ │ │ -
82 // postfix operators
│ │ │ │ -
83
│ │ │ │ -
84 template<class T = value_type,
│ │ │ │ -
85 class = std::enable_if_t<!std::is_same<T, bool>::value> >
│ │ │ │ -
86 value_type operator++(int) { return vec_[idx_]++; }
│ │ │ │ -
87 template<class T = value_type,
│ │ │ │ -
88 class = std::enable_if_t<!std::is_same<T, bool>::value> >
│ │ │ │ -
89 value_type operator--(int) { return vec_[idx_]--; }
│ │ │ │ -
90
│ │ │ │ -
91 // unary (prefix) operators
│ │ │ │ -
92 template<class T = value_type,
│ │ │ │ -
93 class = std::enable_if_t<!std::is_same<T, bool>::value> >
│ │ │ │ -
94 Proxy &operator++() { ++(vec_[idx_]); return *this; }
│ │ │ │ -
95 template<class T = value_type,
│ │ │ │ -
96 class = std::enable_if_t<!std::is_same<T, bool>::value> >
│ │ │ │ -
97 Proxy &operator--() { --(vec_[idx_]); return *this; }
│ │ │ │ -
98 decltype(auto) operator!() const { return !(vec_[idx_]); }
│ │ │ │ -
99 decltype(auto) operator+() const { return +(vec_[idx_]); }
│ │ │ │ -
100 decltype(auto) operator-() const { return -(vec_[idx_]); }
│ │ │ │ -
101 template<class T = value_type,
│ │ │ │ -
102 class = std::enable_if_t<std::is_integral<T>::value> >
│ │ │ │ -
103 decltype(auto) operator~() const { return ~(vec_[idx_]); }
│ │ │ │ -
104
│ │ │ │ -
105 // binary operators
│ │ │ │ -
106#define DUNE_SIMD_VC_BINARY_OP(OP) \
│ │ │ │ -
107 template<class T> \
│ │ │ │ -
108 auto operator OP(T &&o) const \
│ │ │ │ -
109 -> decltype(vec_[idx_] OP valueCast(std::forward<T>(o))) \
│ │ │ │ -
110 { \
│ │ │ │ -
111 return vec_[idx_] OP valueCast(std::forward<T>(o)); \
│ │ │ │ -
112 } \
│ │ │ │ -
113 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
114
│ │ │ │ -
115 DUNE_SIMD_VC_BINARY_OP(*);
│ │ │ │ -
116 DUNE_SIMD_VC_BINARY_OP(/);
│ │ │ │ -
117 DUNE_SIMD_VC_BINARY_OP(%);
│ │ │ │ -
118
│ │ │ │ -
119 DUNE_SIMD_VC_BINARY_OP(+);
│ │ │ │ -
120 DUNE_SIMD_VC_BINARY_OP(-);
│ │ │ │ -
121
│ │ │ │ -
122 DUNE_SIMD_VC_BINARY_OP(<<);
│ │ │ │ -
123 DUNE_SIMD_VC_BINARY_OP(>>);
│ │ │ │ -
124
│ │ │ │ -
125 DUNE_SIMD_VC_BINARY_OP(<);
│ │ │ │ -
126 DUNE_SIMD_VC_BINARY_OP(>);
│ │ │ │ -
127 DUNE_SIMD_VC_BINARY_OP(<=);
│ │ │ │ -
128 DUNE_SIMD_VC_BINARY_OP(>=);
│ │ │ │ -
129
│ │ │ │ -
130 DUNE_SIMD_VC_BINARY_OP(==);
│ │ │ │ -
131 DUNE_SIMD_VC_BINARY_OP(!=);
│ │ │ │ -
132
│ │ │ │ -
133 DUNE_SIMD_VC_BINARY_OP(&);
│ │ │ │ -
134 DUNE_SIMD_VC_BINARY_OP(^);
│ │ │ │ -
135 DUNE_SIMD_VC_BINARY_OP(|);
│ │ │ │ -
136
│ │ │ │ -
137 DUNE_SIMD_VC_BINARY_OP(&&);
│ │ │ │ -
138 DUNE_SIMD_VC_BINARY_OP(||);
│ │ │ │ -
139#undef DUNE_SIMD_VC_BINARY_OP
│ │ │ │ -
140
│ │ │ │ -
141#define DUNE_SIMD_VC_ASSIGNMENT(OP) \
│ │ │ │ -
142 template<class T> \
│ │ │ │ -
143 auto operator OP(T &&o) \
│ │ │ │ -
144 -> std::enable_if_t<AlwaysTrue<decltype( \
│ │ │ │ -
145 vec_[idx_] OP valueCast(std::forward<T>(o)) \
│ │ │ │ -
146 )>::value, Proxy&> \
│ │ │ │ -
147 { \
│ │ │ │ -
148 vec_[idx_] OP valueCast(std::forward<T>(o)); \
│ │ │ │ -
149 return *this; \
│ │ │ │ -
150 } \
│ │ │ │ -
151 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
152
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
164#undef DUNE_SIMD_VC_ASSIGNMENT
│ │ │ │ -
165
│ │ │ │ -
166 // swap on proxies swaps the proxied vector entries. As such, it
│ │ │ │ -
167 // applies to rvalues of proxies too, not just lvalues
│ │ │ │ -
168 template<class V1, class V2>
│ │ │ │ -
169 friend void swap(Proxy<V1>, Proxy<V2>);
│ │ │ │ +
46 // Its not valid to copy a MPIPack but you can move it
│ │ │ │ +
47 MPIPack(const MPIPack&) = delete;
│ │ │ │ +
48 MPIPack& operator = (const MPIPack& other) = delete;
│ │ │ │ +
49 MPIPack(MPIPack&&) = default;
│ │ │ │ +
50 MPIPack& operator = (MPIPack&& other) = default;
│ │ │ │ +
51
│ │ │ │ +
57 template<class T>
│ │ │ │ +
│ │ │ │ +
58 void pack(const T& data){
│ │ │ │ +
59 auto mpidata = getMPIData(data);
│ │ │ │ +
60 int size = getPackSize(mpidata.size(), _comm, mpidata.type());
│ │ │ │ +
61 constexpr bool has_static_size = decltype(getMPIData(std::declval<T&>()))::static_size;
│ │ │ │ +
62 if(!has_static_size)
│ │ │ │ +
63 size += getPackSize(1, _comm, MPI_INT);
│ │ │ │ +
64 if (_position + size > 0 && size_t(_position + size) > _buffer.size()) // resize buffer if necessary
│ │ │ │ +
65 _buffer.resize(_position + size);
│ │ │ │ +
66 if(!has_static_size){
│ │ │ │ +
67 int size = mpidata.size();
│ │ │ │ +
68 MPI_Pack(&size, 1, MPI_INT, _buffer.data(), _buffer.size(),
│ │ │ │ +
69 &_position, _comm);
│ │ │ │ +
70 }
│ │ │ │ +
71 MPI_Pack(mpidata.ptr(), mpidata.size(),
│ │ │ │ +
72 mpidata.type(), _buffer.data(), _buffer.size(),
│ │ │ │ +
73 &_position, _comm);
│ │ │ │ +
74 }
│ │ │ │ +
│ │ │ │ +
75
│ │ │ │ +
80 template<class T>
│ │ │ │ +
│ │ │ │ +
81 auto /*void*/ unpack(T& data)
│ │ │ │ +
82 -> std::enable_if_t<decltype(getMPIData(data))::static_size, void>
│ │ │ │ +
83 {
│ │ │ │ +
84 auto mpidata = getMPIData(data);
│ │ │ │ +
85 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
│ │ │ │ +
86 mpidata.ptr(), mpidata.size(),
│ │ │ │ +
87 mpidata.type(), _comm);
│ │ │ │ +
88 }
│ │ │ │ +
│ │ │ │ +
89
│ │ │ │ +
94 template<class T>
│ │ │ │ +
│ │ │ │ +
95 auto /*void*/ unpack(T& data)
│ │ │ │ +
96 -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void>
│ │ │ │ +
97 {
│ │ │ │ +
98 auto mpidata = getMPIData(data);
│ │ │ │ +
99 int size = 0;
│ │ │ │ +
100 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
│ │ │ │ +
101 &size, 1,
│ │ │ │ +
102 MPI_INT, _comm);
│ │ │ │ +
103 mpidata.resize(size);
│ │ │ │ +
104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
│ │ │ │ +
105 mpidata.ptr(), mpidata.size(),
│ │ │ │ +
106 mpidata.type(), _comm);
│ │ │ │ +
107 }
│ │ │ │ +
│ │ │ │ +
108
│ │ │ │ +
109
│ │ │ │ +
111 template<typename T>
│ │ │ │ +
│ │ │ │ +
112 friend MPIPack& operator << (MPIPack& p, const T& t){
│ │ │ │ +
113 p.pack(t);
│ │ │ │ +
114 return p;
│ │ │ │ +
115 }
│ │ │ │ +
│ │ │ │ +
116
│ │ │ │ +
118 template<typename T>
│ │ │ │ +
│ │ │ │ +
119 friend MPIPack& operator >> (MPIPack& p, T& t){
│ │ │ │ +
120 p.unpack(t);
│ │ │ │ +
121 return p;
│ │ │ │ +
122 }
│ │ │ │ +
│ │ │ │ +
123
│ │ │ │ +
125 template<typename T>
│ │ │ │ +
│ │ │ │ +
126 MPIPack& read(T& t){
│ │ │ │ +
127 unpack(t);
│ │ │ │ +
128 return *this;
│ │ │ │ +
129 }
│ │ │ │ +
│ │ │ │ +
130
│ │ │ │ +
132 template<typename T>
│ │ │ │ +
│ │ │ │ +
133 MPIPack& write(const T& t){
│ │ │ │ +
134 pack(t);
│ │ │ │ +
135 return *this;
│ │ │ │ +
136 }
│ │ │ │ +
│ │ │ │ +
137
│ │ │ │ +
│ │ │ │ +
141 void resize(size_t size){
│ │ │ │ +
142 _buffer.resize(size);
│ │ │ │ +
143 }
│ │ │ │ +
│ │ │ │ +
144
│ │ │ │ +
│ │ │ │ +
147 void enlarge(int s) {
│ │ │ │ +
148 _buffer.resize(_buffer.size() + s);
│ │ │ │ +
149 }
│ │ │ │ +
│ │ │ │ +
150
│ │ │ │ +
│ │ │ │ +
153 size_t size() const {
│ │ │ │ +
154 return _buffer.size();
│ │ │ │ +
155 }
│ │ │ │ +
│ │ │ │ +
156
│ │ │ │ +
│ │ │ │ +
160 void seek(int p){
│ │ │ │ +
161 _position = p;
│ │ │ │ +
162 }
│ │ │ │ +
│ │ │ │ +
163
│ │ │ │ +
│ │ │ │ +
167 int tell() const{
│ │ │ │ +
168 return _position;
│ │ │ │ +
169 }
│ │ │ │ +
│ │ │ │
170
│ │ │ │ -
171 template<class T>
│ │ │ │ -
172 friend void swap(Proxy p1, T& s2)
│ │ │ │ -
173 {
│ │ │ │ -
174 // don't use swap() ourselves -- not supported by Vc 1.3.0 (but is
│ │ │ │ -
175 // supported by Vc 1.3.2)
│ │ │ │ -
176 T tmp = p1.vec_[p1.idx_];
│ │ │ │ -
177 p1.vec_[p1.idx_] = s2;
│ │ │ │ -
178 s2 = tmp;
│ │ │ │ -
179 }
│ │ │ │ -
180
│ │ │ │ -
181 template<class T>
│ │ │ │ -
182 friend void swap(T& s1, Proxy p2)
│ │ │ │ -
183 {
│ │ │ │ -
184 T tmp = s1;
│ │ │ │ -
185 s1 = p2.vec_[p2.idx_];
│ │ │ │ -
186 p2.vec_[p2.idx_] = tmp;
│ │ │ │ -
187 }
│ │ │ │ -
188 };
│ │ │ │ -
189
│ │ │ │ -
190 template<class V1, class V2>
│ │ │ │ -
191 void swap(Proxy<V1> p1, Proxy<V2> p2)
│ │ │ │ -
192 {
│ │ │ │ -
193 typename V1::value_type tmp = p1.vec_[p1.idx_];
│ │ │ │ -
194 p1.vec_[p1.idx_] = p2.vec_[p2.idx_];
│ │ │ │ -
195 p2.vec_[p2.idx_] = tmp;
│ │ │ │ -
196 }
│ │ │ │ -
197 } // namespace VcImpl
│ │ │ │ -
198#endif // HAVE_VC
│ │ │ │ -
199
│ │ │ │ -
200 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
202 {
│ │ │ │ -
203 using type = T;
│ │ │ │ -
204 };
│ │ │ │ -
│ │ │ │ -
205
│ │ │ │ -
206 template<typename T>
│ │ │ │ - │ │ │ │ +
│ │ │ │ +
173 bool eof() const{
│ │ │ │ +
174 return std::size_t(_position)==_buffer.size();
│ │ │ │ +
175 }
│ │ │ │ +
│ │ │ │ +
176
│ │ │ │ +
│ │ │ │ +
180 static int getPackSize(int len, const MPI_Comm& comm, const MPI_Datatype& dt){
│ │ │ │ +
181 int size;
│ │ │ │ +
182 MPI_Pack_size(len, dt, comm, &size);
│ │ │ │ +
183 return size;
│ │ │ │ +
184 }
│ │ │ │ +
│ │ │ │ +
185
│ │ │ │ +
│ │ │ │ +
186 friend bool operator==(const MPIPack& a, const MPIPack& b) {
│ │ │ │ +
187 return a._buffer == b._buffer && a._comm == b._comm;
│ │ │ │ +
188 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
189 friend bool operator!=(const MPIPack& a, const MPIPack& b) {
│ │ │ │ +
190 return !(a==b);
│ │ │ │ +
191 }
│ │ │ │ +
│ │ │ │ +
192
│ │ │ │ +
193 };
│ │ │ │ +
│ │ │ │ +
194
│ │ │ │ +
195 template<class P>
│ │ │ │ +
│ │ │ │ +
196 struct MPIData<P, std::enable_if_t<std::is_same<std::remove_const_t<P>, MPIPack>::value>> {
│ │ │ │ +
197 protected:
│ │ │ │ +
198 friend auto getMPIData<P>(P& t);
│ │ │ │ +
│ │ │ │ +
199 MPIData(P& t) :
│ │ │ │ +
200 data_(t)
│ │ │ │ +
201 {}
│ │ │ │ +
│ │ │ │ +
202 public:
│ │ │ │ +
203 static constexpr bool static_size = std::is_const<P>::value;
│ │ │ │ +
204
│ │ │ │ +
│ │ │ │ +
205 void* ptr() {
│ │ │ │ +
206 return (void*) data_._buffer.data();
│ │ │ │ +
207 }
│ │ │ │ +
│ │ │ │
208
│ │ │ │ -
209#if HAVE_VC
│ │ │ │ -
210 /*
│ │ │ │ -
211 Add Vc specializations for the SimdScalarTypeTraits trais class
│ │ │ │ -
212 */
│ │ │ │ -
213 template<typename T, typename A>
│ │ │ │ -
214 struct SimdScalarTypeTraits< Vc::Vector<T,A> >
│ │ │ │ -
215 {
│ │ │ │ -
216 using type = T;
│ │ │ │ -
217 };
│ │ │ │ -
218
│ │ │ │ -
219 template<typename T, std::size_t N, typename V, std::size_t M>
│ │ │ │ -
220 struct SimdScalarTypeTraits< Vc::SimdArray<T,N,V,M> >
│ │ │ │ -
221 {
│ │ │ │ -
222 using type = T;
│ │ │ │ -
223 };
│ │ │ │ -
224#endif // HAVE_VC
│ │ │ │ +
│ │ │ │ +
209 int size() {
│ │ │ │ +
210 return data_.size();
│ │ │ │ +
211 }
│ │ │ │ +
│ │ │ │ +
212
│ │ │ │ +
│ │ │ │ +
213 MPI_Datatype type() const{
│ │ │ │ +
214 return MPI_PACKED;
│ │ │ │ +
215 }
│ │ │ │ +
│ │ │ │ +
216
│ │ │ │ +
│ │ │ │ +
217 void resize(int size){
│ │ │ │ +
218 data_.resize(size);
│ │ │ │ +
219 }
│ │ │ │ +
│ │ │ │ +
220 protected:
│ │ │ │ + │ │ │ │ +
222 };
│ │ │ │ +
│ │ │ │ +
223
│ │ │ │ +
224} // end namespace Dune
│ │ │ │
225
│ │ │ │ -
227 template<typename T, std::size_t align>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
229 {
│ │ │ │ -
230 using type = T;
│ │ │ │ -
231 };
│ │ │ │ -
│ │ │ │ -
232
│ │ │ │ -
233 template<typename V, typename = void>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
235 using type = std::size_t;
│ │ │ │ -
236 };
│ │ │ │ -
│ │ │ │ -
237
│ │ │ │ -
239
│ │ │ │ -
245 template<typename V>
│ │ │ │ - │ │ │ │ -
247
│ │ │ │ -
248#if HAVE_VC
│ │ │ │ -
249 template<typename T, typename A>
│ │ │ │ -
250 struct SimdIndexTypeTraits<Vc::Vector<T, A> > {
│ │ │ │ -
251 using type = typename Vc::Vector<T, A>::index_type;
│ │ │ │ -
252 };
│ │ │ │ -
253
│ │ │ │ -
254 template<typename T, std::size_t n, typename V>
│ │ │ │ -
255 struct SimdIndexTypeTraits<Vc::SimdArray<T, n, V> > {
│ │ │ │ -
256 using type = typename Vc::SimdArray<T, n, V>::index_type;
│ │ │ │ -
257 };
│ │ │ │ -
258#endif // HAVE_VC
│ │ │ │ -
259
│ │ │ │ -
260 template<typename V, typename = void>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
262 using type = bool;
│ │ │ │ -
263 };
│ │ │ │ -
│ │ │ │ -
264
│ │ │ │ -
266
│ │ │ │ -
269 template<typename V>
│ │ │ │ - │ │ │ │ -
271
│ │ │ │ -
272#if HAVE_VC
│ │ │ │ -
273 template<typename T, typename A>
│ │ │ │ -
274 struct SimdMaskTypeTraits<Vc::Vector<T, A> > {
│ │ │ │ -
275 using type = typename Vc::Vector<T, A>::mask_type;
│ │ │ │ -
276 };
│ │ │ │ -
277
│ │ │ │ -
278 template<typename T, std::size_t n, typename V>
│ │ │ │ -
279 struct SimdMaskTypeTraits<Vc::SimdArray<T, n, V> > {
│ │ │ │ -
280 using type = typename Vc::SimdArray<T, n, V>::mask_type;
│ │ │ │ -
281 };
│ │ │ │ -
282#endif // HAVE_VC
│ │ │ │ -
283
│ │ │ │ -
284#if HAVE_VC
│ │ │ │ -
285 /*
│ │ │ │ -
286 Add Vc specializations for cond(), see conditional.hh
│ │ │ │ -
287 */
│ │ │ │ -
288 template<typename T, typename A>
│ │ │ │ -
289 Vc::Vector<T,A> cond(const Vc::Mask<T,A> & b,
│ │ │ │ -
290 const Vc::Vector<T,A> & v1,
│ │ │ │ -
291 const Vc::Vector<T,A> & v2)
│ │ │ │ -
292 {
│ │ │ │ -
293 return std::move(Vc::iif(b, v1, v2));
│ │ │ │ -
294 }
│ │ │ │ -
295
│ │ │ │ -
296 template<typename T, std::size_t N, typename V, std::size_t M>
│ │ │ │ -
297 Vc::SimdArray<T,N,V,M> cond(const typename Vc::SimdArray<T,N,V,M>::mask_type & b,
│ │ │ │ -
298 const Vc::SimdArray<T,N,V,M> & v1,
│ │ │ │ -
299 const Vc::SimdArray<T,N,V,M> & v2)
│ │ │ │ -
300 {
│ │ │ │ -
301 return std::move(Vc::iif(b, v1, v2));
│ │ │ │ -
302 }
│ │ │ │ -
303#endif // HAVE_VC
│ │ │ │ -
304
│ │ │ │ -
305#if HAVE_VC
│ │ │ │ -
306 /*
│ │ │ │ -
307 Add Vc specializations for several boolean operations, see rangeutitlities.hh:
│ │ │ │ -
308
│ │ │ │ -
309 max_value, min_value, any_true, all_true
│ │ │ │ -
310 */
│ │ │ │ -
311 template<typename T, typename A>
│ │ │ │ -
312 T max_value(const Vc::Vector<T,A> & v)
│ │ │ │ -
313 {
│ │ │ │ -
314 return v.max();
│ │ │ │ -
315 }
│ │ │ │ -
316
│ │ │ │ -
317 template<typename T, std::size_t N, typename V, std::size_t M>
│ │ │ │ -
318 double max_value(const Vc::SimdArray<T,N,V,M> & v)
│ │ │ │ -
319 {
│ │ │ │ -
320 return v.max();
│ │ │ │ -
321 }
│ │ │ │ -
322
│ │ │ │ -
323 template<typename T, typename A>
│ │ │ │ -
324 T min_value(const Vc::Vector<T,A> & v)
│ │ │ │ -
325 {
│ │ │ │ -
326 return v.min();
│ │ │ │ -
327 }
│ │ │ │ -
328
│ │ │ │ -
329 template<typename T, std::size_t N, typename V, std::size_t M>
│ │ │ │ -
330 double min_value(const Vc::SimdArray<T,N,V,M> & v)
│ │ │ │ -
331 {
│ │ │ │ -
332 return v.min();
│ │ │ │ -
333 }
│ │ │ │ -
334
│ │ │ │ -
335 template<typename T, typename A>
│ │ │ │ -
336 bool any_true(const Vc::Mask<T,A> & v)
│ │ │ │ -
337 {
│ │ │ │ -
338 return Vc::any_of(v);
│ │ │ │ -
339 }
│ │ │ │ -
340
│ │ │ │ -
341 template<typename T, std::size_t N, typename V, std::size_t M>
│ │ │ │ -
342 bool any_true(const Vc::SimdMaskArray<T,N,V,M> & v)
│ │ │ │ -
343 {
│ │ │ │ -
344 return Vc::any_of(v);
│ │ │ │ -
345 }
│ │ │ │ -
346
│ │ │ │ -
347 template<typename T, typename A>
│ │ │ │ -
348 bool all_true(const Vc::Mask<T,A> & v)
│ │ │ │ -
349 {
│ │ │ │ -
350 return Vc::all_of(v);
│ │ │ │ -
351 }
│ │ │ │ -
352
│ │ │ │ -
353 template<typename T, std::size_t N, typename V, std::size_t M>
│ │ │ │ -
354 bool all_true(const Vc::SimdMaskArray<T,N,V,M> & v)
│ │ │ │ -
355 {
│ │ │ │ -
356 return Vc::all_of(v);
│ │ │ │ -
357 }
│ │ │ │ -
358#endif // HAVE_VC
│ │ │ │ -
359
│ │ │ │ -
361 template<class T>
│ │ │ │ -
362 std::size_t lanes(const T &) { return 1; }
│ │ │ │ -
363
│ │ │ │ -
365 template<class T>
│ │ │ │ -
│ │ │ │ -
366 T lane(std::size_t l, const T &v)
│ │ │ │ -
367 {
│ │ │ │ -
368 assert(l == 0);
│ │ │ │ -
369 return v;
│ │ │ │ -
370 }
│ │ │ │ -
│ │ │ │ -
371
│ │ │ │ -
373 template<class T>
│ │ │ │ -
│ │ │ │ -
374 T &lane(std::size_t l, T &v)
│ │ │ │ -
375 {
│ │ │ │ -
376 assert(l == 0);
│ │ │ │ -
377 return v;
│ │ │ │ -
378 }
│ │ │ │ -
│ │ │ │ -
379
│ │ │ │ -
380#if HAVE_VC
│ │ │ │ -
381 template<class T, class A>
│ │ │ │ -
382 std::size_t lanes(const Vc::Vector<T, A> &)
│ │ │ │ -
383 {
│ │ │ │ -
384 return Vc::Vector<T, A>::size();
│ │ │ │ -
385 }
│ │ │ │ -
386
│ │ │ │ -
387 template<class T, class A>
│ │ │ │ -
388 T lane(std::size_t l, const Vc::Vector<T, A> &v)
│ │ │ │ -
389 {
│ │ │ │ -
390 assert(l < lanes(v));
│ │ │ │ -
391 return v[l];
│ │ │ │ -
392 }
│ │ │ │ -
393
│ │ │ │ -
394 template<class T, class A>
│ │ │ │ -
395 auto lane(std::size_t l, Vc::Vector<T, A> &v)
│ │ │ │ -
396 {
│ │ │ │ -
397 assert(l < lanes(v));
│ │ │ │ -
398 return VcImpl::Proxy<Vc::Vector<T, A> >{l, v};
│ │ │ │ -
399 }
│ │ │ │ -
400
│ │ │ │ -
401 template<class T, std::size_t n, class V>
│ │ │ │ -
402 std::size_t lanes(const Vc::SimdArray<T, n, V> &)
│ │ │ │ -
403 {
│ │ │ │ -
404 return n;
│ │ │ │ -
405 }
│ │ │ │ -
406
│ │ │ │ -
407 template<class T, std::size_t n, class V>
│ │ │ │ -
408 T lane(std::size_t l, const Vc::SimdArray<T, n, V> &v)
│ │ │ │ -
409 {
│ │ │ │ -
410 assert(l < n);
│ │ │ │ -
411 return v[l];
│ │ │ │ -
412 }
│ │ │ │ -
413
│ │ │ │ -
414 template<class T, std::size_t n, class V>
│ │ │ │ -
415 auto lane(std::size_t l, Vc::SimdArray<T, n, V> &v)
│ │ │ │ -
416 {
│ │ │ │ -
417 assert(l < n);
│ │ │ │ -
418 return VcImpl::Proxy<Vc::SimdArray<T, n, V> >{l, v};
│ │ │ │ -
419 }
│ │ │ │ -
420
│ │ │ │ -
421 template<class T, std::size_t n, class V>
│ │ │ │ -
422 std::size_t lanes(const Vc::SimdMaskArray<T, n, V> &)
│ │ │ │ -
423 {
│ │ │ │ -
424 return n;
│ │ │ │ -
425 }
│ │ │ │ -
426
│ │ │ │ -
427 template<class T, std::size_t n, class V>
│ │ │ │ -
428 bool lane(std::size_t l, const Vc::SimdMaskArray<T, n, V> &v)
│ │ │ │ -
429 {
│ │ │ │ -
430 assert(l < n);
│ │ │ │ -
431 return v[l];
│ │ │ │ -
432 }
│ │ │ │ -
433
│ │ │ │ -
434 template<class T, std::size_t n, class V>
│ │ │ │ -
435 auto lane(std::size_t l, Vc::SimdMaskArray<T, n, V> &v)
│ │ │ │ -
436 {
│ │ │ │ -
437 assert(l < n);
│ │ │ │ -
438 return VcImpl::Proxy<Vc::SimdMaskArray<T, n, V> >{l, v};
│ │ │ │ -
439 }
│ │ │ │ -
440#endif // HAVE_VC
│ │ │ │ -
441
│ │ │ │ -
443
│ │ │ │ -
446 template<class T>
│ │ │ │ -
│ │ │ │ -
447 void assign(T &dst, const T &src, bool mask)
│ │ │ │ -
448 {
│ │ │ │ -
449 if(mask) dst = src;
│ │ │ │ -
450 }
│ │ │ │ -
│ │ │ │ -
451
│ │ │ │ -
452#if HAVE_VC
│ │ │ │ -
453 /*
│ │ │ │ -
454 Add Vc specializations for masked assignment
│ │ │ │ -
455 */
│ │ │ │ -
456 template<class T, class A>
│ │ │ │ -
457 void assign(Vc::Vector<T, A> &dst, const Vc::Vector<T, A> &src,
│ │ │ │ -
458 typename Vc::Vector<T, A>::mask_type mask)
│ │ │ │ -
459 {
│ │ │ │ -
460 dst(mask) = src;
│ │ │ │ -
461 }
│ │ │ │ -
462
│ │ │ │ -
463 template<class T, std::size_t n, class V>
│ │ │ │ -
464 void assign(Vc::SimdArray<T, n, V> &dst, const Vc::SimdArray<T, n, V> &src,
│ │ │ │ -
465 typename Vc::SimdArray<T, n, V>::mask_type mask)
│ │ │ │ -
466 {
│ │ │ │ -
467 dst(mask) = src;
│ │ │ │ -
468 }
│ │ │ │ -
469#endif // HAVE_VC
│ │ │ │ -
470
│ │ │ │ -
471 template<class T>
│ │ │ │ -
│ │ │ │ -
472 void swap(T &v1, T &v2, bool mask)
│ │ │ │ -
473 {
│ │ │ │ -
474 using std::swap;
│ │ │ │ -
475 if(mask) swap(v1, v2);
│ │ │ │ -
476 }
│ │ │ │ -
│ │ │ │ -
477
│ │ │ │ -
478#if HAVE_VC
│ │ │ │ -
479 /*
│ │ │ │ -
480 Add Vc specializations for masked swap
│ │ │ │ -
481 */
│ │ │ │ -
482 template<class T, class A>
│ │ │ │ -
483 void swap(Vc::Vector<T, A> &v1, Vc::Vector<T, A> &v2,
│ │ │ │ -
484 typename Vc::Vector<T, A>::mask_type mask)
│ │ │ │ -
485 {
│ │ │ │ -
486 auto tmp = v1;
│ │ │ │ -
487 v1(mask) = v2;
│ │ │ │ -
488 v2(mask) = tmp;
│ │ │ │ -
489 }
│ │ │ │ -
490
│ │ │ │ -
491 template<class T, std::size_t n, class V>
│ │ │ │ -
492 void swap(Vc::SimdArray<T, n, V> &v1, Vc::SimdArray<T, n, V> &v2,
│ │ │ │ -
493 typename Vc::SimdArray<T, n, V>::mask_type mask)
│ │ │ │ -
494 {
│ │ │ │ -
495 auto tmp = v1;
│ │ │ │ -
496 v1(mask) = v2;
│ │ │ │ -
497 v2(mask) = tmp;
│ │ │ │ -
498 }
│ │ │ │ -
499#endif // HAVE_VC
│ │ │ │ -
500
│ │ │ │ -
501} // end namespace Dune
│ │ │ │ -
502
│ │ │ │ -
503#endif // DUNE_COMMON_SIMD_HH
│ │ │ │ -
Compatibility header for including <Vc/Vc>
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Utilities for reduction like operations on ranges.
│ │ │ │ - │ │ │ │ - │ │ │ │ +
226#endif
│ │ │ │ +
227#endif
│ │ │ │ +
Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
│ │ │ │ +
Implements an utility class that provides MPI's collective communication methods.
│ │ │ │ +
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
bool any_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:493
│ │ │ │ -
bool all_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:499
│ │ │ │ -
typename SimdIndexTypeTraits< V >::type SimdIndex
An simd vector of indices corresponding to a simd vector V.
Definition simd.hh:246
│ │ │ │ -
typename SimdScalarTypeTraits< T >::type SimdScalar
Definition simd.hh:207
│ │ │ │ -
typename SimdMaskTypeTraits< V >::type SimdMask
A simd vector of truth values corresponding to a simd vector V.
Definition simd.hh:270
│ │ │ │ -
T lane(std::size_t l, const T &v)
access a lane of a simd vector (scalar version)
Definition simd.hh:366
│ │ │ │ -
void swap(T &v1, T &v2, bool mask)
Definition simd.hh:472
│ │ │ │ -
void assign(T &dst, const T &src, bool mask)
masked Simd assignment (scalar version)
Definition simd.hh:447
│ │ │ │ -
const T1 cond(bool b, const T1 &v1, const T2 &v2)
conditional evaluate
Definition conditional.hh:28
│ │ │ │ -
T max_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:481
│ │ │ │ -
T min_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:487
│ │ │ │ -
std::size_t lanes(const T &)
get the number of lanes of a simd vector (scalar version)
Definition simd.hh:362
│ │ │ │ -
aligned wrappers for arithmetic types
Definition debugalign.hh:115
│ │ │ │ -
Definition simd.hh:202
│ │ │ │ -
T type
Definition simd.hh:203
│ │ │ │ - │ │ │ │ -
Definition simd.hh:234
│ │ │ │ -
std::size_t type
Definition simd.hh:235
│ │ │ │ -
Definition simd.hh:261
│ │ │ │ -
bool type
Definition simd.hh:262
│ │ │ │ -
SIMD abstractions for Vc.
│ │ │ │ -
#define DUNE_SIMD_VC_ASSIGNMENT(OP)
Definition simd/vc.hh:224
│ │ │ │ +
auto getMPIData(T &t)
Definition mpidata.hh:43
│ │ │ │ +
Collective communication interface and sequential default implementation.
Definition communication.hh:100
│ │ │ │ +
Definition mpidata.hh:50
│ │ │ │ +
T & data_
Definition mpidata.hh:53
│ │ │ │ +
int size() const
Definition mpidata.hh:67
│ │ │ │ +
static constexpr bool static_size
Definition mpidata.hh:65
│ │ │ │ +
Definition mpipack.hh:32
│ │ │ │ +
void enlarge(int s)
Enlarges the internal buffer.
Definition mpipack.hh:147
│ │ │ │ +
friend MPIPack & operator>>(MPIPack &p, T &t)
Unpacks data from the object.
Definition mpipack.hh:119
│ │ │ │ +
friend MPIPack & operator<<(MPIPack &p, const T &t)
Packs the data into the object. Enlarges the internal buffer if necessary.
Definition mpipack.hh:112
│ │ │ │ +
friend bool operator!=(const MPIPack &a, const MPIPack &b)
Definition mpipack.hh:189
│ │ │ │ +
size_t size() const
Returns the size of the internal buffer.
Definition mpipack.hh:153
│ │ │ │ +
MPIPack & operator=(const MPIPack &other)=delete
│ │ │ │ +
MPIPack(Communication< MPI_Comm > comm, std::size_t size=0)
Definition mpipack.hh:40
│ │ │ │ +
void pack(const T &data)
Packs the data into the object. Enlarges the internal buffer if necessary.
Definition mpipack.hh:58
│ │ │ │ +
auto unpack(T &data) -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void >
Unpacks data from the object.
Definition mpipack.hh:95
│ │ │ │ +
auto unpack(T &data) -> std::enable_if_t< decltype(getMPIData(data))::static_size, void >
Unpacks data from the object.
Definition mpipack.hh:81
│ │ │ │ +
friend bool operator==(const MPIPack &a, const MPIPack &b)
Definition mpipack.hh:186
│ │ │ │ +
MPIPack(const MPIPack &)=delete
│ │ │ │ +
void seek(int p)
Sets the position in the buffer where the next pack/unpack operation should take place.
Definition mpipack.hh:160
│ │ │ │ +
bool eof() const
Checks whether the end of the buffer is reached.
Definition mpipack.hh:173
│ │ │ │ +
void resize(size_t size)
Resizes the internal buffer.
Definition mpipack.hh:141
│ │ │ │ +
int tell() const
Gets the position in the buffer where the next pack/unpack operation should take place.
Definition mpipack.hh:167
│ │ │ │ +
MPIPack(MPIPack &&)=default
│ │ │ │ +
MPIPack & read(T &t)
Unpacks data from the object.
Definition mpipack.hh:126
│ │ │ │ +
static int getPackSize(int len, const MPI_Comm &comm, const MPI_Datatype &dt)
Returns the size of the data needed to store the data in an MPIPack. See MPI_Pack_size.
Definition mpipack.hh:180
│ │ │ │ +
MPIPack & write(const T &t)
Packs the data into the object. Enlarges the internal buffer if necessary.
Definition mpipack.hh:133
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,549 +1,323 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -simd.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpipack.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_HH │ │ │ │ │ -4#define DUNE_COMMON_SIMD_HH │ │ │ │ │ -5 │ │ │ │ │ -6#warning dune/common/simd.hh is deprecated. │ │ │ │ │ -7#warning Use the new infrastructure from dune/common/simd/simd.h instead. │ │ │ │ │ -8 │ │ │ │ │ -30#include │ │ │ │ │ -31#include │ │ │ │ │ -32#include │ │ │ │ │ -33#include │ │ │ │ │ -34 │ │ │ │ │ -35#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_o_n_d_i_t_i_o_n_a_l_._h_h> │ │ │ │ │ -36#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_b_u_g_a_l_i_g_n_._h_h> │ │ │ │ │ -37#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -38#if HAVE_VC │ │ │ │ │ -39// include Vc part of new simd interface to provide compatibility for │ │ │ │ │ -40// functionality that has been switched over. │ │ │ │ │ -41#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_v_c_._h_h> │ │ │ │ │ -42#endif │ │ │ │ │ -43#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -44#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_c_._h_h> │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +20#ifndef DUNE_COMMON_PARALLEL_MPIPACK_HH │ │ │ │ │ +21#define DUNE_COMMON_PARALLEL_MPIPACK_HH │ │ │ │ │ +22 │ │ │ │ │ +23#include │ │ │ │ │ +24#if HAVE_MPI │ │ │ │ │ +25#include │ │ │ │ │ +26#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +27#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ +28 │ │ │ │ │ +29 │ │ │ │ │ +30namespace _D_u_n_e { │ │ │ │ │ +31 │ │ │ │ │ +_3_2 class _M_P_I_P_a_c_k { │ │ │ │ │ +33 std::vector _buffer; │ │ │ │ │ +34 int _position; │ │ │ │ │ +_3_5 MPI_Comm _comm; │ │ │ │ │ +36 │ │ │ │ │ +37 friend struct _M_P_I_D_a_t_a<_M_P_I_P_a_c_k>; │ │ │ │ │ +38 friend struct _M_P_I_D_a_t_a; │ │ │ │ │ +39 public: │ │ │ │ │ +_4_0 _M_P_I_P_a_c_k(_C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I___C_o_m_m_> comm, std::size_t _s_i_z_e = 0) │ │ │ │ │ +41 : _buffer(_s_i_z_e) │ │ │ │ │ +42 , _position(0) │ │ │ │ │ +43 , _comm(comm) │ │ │ │ │ +44 {} │ │ │ │ │ 45 │ │ │ │ │ -46namespace _D_u_n_e │ │ │ │ │ -47{ │ │ │ │ │ -48 │ │ │ │ │ -49#if HAVE_VC │ │ │ │ │ -50 namespace VcImpl { │ │ │ │ │ -52 │ │ │ │ │ -61 template │ │ │ │ │ -62 class Proxy │ │ │ │ │ -63 { │ │ │ │ │ -64 static_assert(std::is_same >::value, "Class Proxy " │ │ │ │ │ -65 "may only be instantiated with unqualified types"); │ │ │ │ │ -66 public: │ │ │ │ │ -67 using value_type = typename V::value_type; │ │ │ │ │ -68 │ │ │ │ │ -69 private: │ │ │ │ │ -70 static_assert(std::is_arithmetic::value, │ │ │ │ │ -71 "Only arithmetic types are supported"); │ │ │ │ │ -72 V &vec_; │ │ │ │ │ -73 std::size_t idx_; │ │ │ │ │ -74 │ │ │ │ │ -75 public: │ │ │ │ │ -76 Proxy(std::size_t idx, V &vec) │ │ │ │ │ -77 : vec_(vec), idx_(idx) │ │ │ │ │ -78 { } │ │ │ │ │ -79 │ │ │ │ │ -80 operator value_type() const { return vec_[idx_]; } │ │ │ │ │ -81 │ │ │ │ │ -82 // postfix operators │ │ │ │ │ -83 │ │ │ │ │ -84 template::value> > │ │ │ │ │ -86 value_type operator++(int) { return vec_[idx_]++; } │ │ │ │ │ -87 template::value> > │ │ │ │ │ -89 value_type operator--(int) { return vec_[idx_]--; } │ │ │ │ │ -90 │ │ │ │ │ -91 // unary (prefix) operators │ │ │ │ │ -92 template::value> > │ │ │ │ │ -94 Proxy &operator++() { ++(vec_[idx_]); return *this; } │ │ │ │ │ -95 template::value> > │ │ │ │ │ -97 Proxy &operator--() { --(vec_[idx_]); return *this; } │ │ │ │ │ -98 decltype(auto) operator!() const { return !(vec_[idx_]); } │ │ │ │ │ -99 decltype(auto) operator+() const { return +(vec_[idx_]); } │ │ │ │ │ -100 decltype(auto) operator-() const { return -(vec_[idx_]); } │ │ │ │ │ -101 template::value> > │ │ │ │ │ -103 decltype(auto) operator~() const { return ~(vec_[idx_]); } │ │ │ │ │ -104 │ │ │ │ │ -105 // binary operators │ │ │ │ │ -106#define DUNE_SIMD_VC_BINARY_OP(OP) \ │ │ │ │ │ -107 template \ │ │ │ │ │ -108 auto operator OP(T &&o) const \ │ │ │ │ │ -109 -> decltype(vec_[idx_] OP valueCast(std::forward(o))) \ │ │ │ │ │ -110 { \ │ │ │ │ │ -111 return vec_[idx_] OP valueCast(std::forward(o)); \ │ │ │ │ │ -112 } \ │ │ │ │ │ -113 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -114 │ │ │ │ │ -115 DUNE_SIMD_VC_BINARY_OP(*); │ │ │ │ │ -116 DUNE_SIMD_VC_BINARY_OP(/); │ │ │ │ │ -117 DUNE_SIMD_VC_BINARY_OP(%); │ │ │ │ │ -118 │ │ │ │ │ -119 DUNE_SIMD_VC_BINARY_OP(+); │ │ │ │ │ -120 DUNE_SIMD_VC_BINARY_OP(-); │ │ │ │ │ -121 │ │ │ │ │ -122 DUNE_SIMD_VC_BINARY_OP(<<); │ │ │ │ │ -123 DUNE_SIMD_VC_BINARY_OP(>>); │ │ │ │ │ -124 │ │ │ │ │ -125 DUNE_SIMD_VC_BINARY_OP(<); │ │ │ │ │ -126 DUNE_SIMD_VC_BINARY_OP(>); │ │ │ │ │ -127 DUNE_SIMD_VC_BINARY_OP(<=); │ │ │ │ │ -128 DUNE_SIMD_VC_BINARY_OP(>=); │ │ │ │ │ -129 │ │ │ │ │ -130 DUNE_SIMD_VC_BINARY_OP(==); │ │ │ │ │ -131 DUNE_SIMD_VC_BINARY_OP(!=); │ │ │ │ │ -132 │ │ │ │ │ -133 DUNE_SIMD_VC_BINARY_OP(&); │ │ │ │ │ -134 DUNE_SIMD_VC_BINARY_OP(^); │ │ │ │ │ -135 DUNE_SIMD_VC_BINARY_OP(|); │ │ │ │ │ -136 │ │ │ │ │ -137 DUNE_SIMD_VC_BINARY_OP(&&); │ │ │ │ │ -138 DUNE_SIMD_VC_BINARY_OP(||); │ │ │ │ │ -139#undef DUNE_SIMD_VC_BINARY_OP │ │ │ │ │ -140 │ │ │ │ │ -141#define DUNE_SIMD_VC_ASSIGNMENT(OP) \ │ │ │ │ │ -142 template \ │ │ │ │ │ -143 auto operator OP(T &&o) \ │ │ │ │ │ -144 -> std::enable_if_t(o)) \ │ │ │ │ │ -146 )>::value, Proxy&> \ │ │ │ │ │ -147 { \ │ │ │ │ │ -148 vec_[idx_] OP valueCast(std::forward(o)); \ │ │ │ │ │ -149 return *this; \ │ │ │ │ │ -150 } \ │ │ │ │ │ -151 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -152 │ │ │ │ │ -153 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(=); │ │ │ │ │ -154 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(*=); │ │ │ │ │ -155 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(/=); │ │ │ │ │ -156 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(%=); │ │ │ │ │ -157 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(+=); │ │ │ │ │ -158 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(-=); │ │ │ │ │ -159 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(<<=); │ │ │ │ │ -160 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(>>=); │ │ │ │ │ -161 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(&=); │ │ │ │ │ -162 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(^=); │ │ │ │ │ -163 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(|=); │ │ │ │ │ -164#undef DUNE_SIMD_VC_ASSIGNMENT │ │ │ │ │ -165 │ │ │ │ │ -166 // swap on proxies swaps the proxied vector entries. As such, it │ │ │ │ │ -167 // applies to rvalues of proxies too, not just lvalues │ │ │ │ │ -168 template │ │ │ │ │ -169 friend void _s_w_a_p(Proxy, Proxy); │ │ │ │ │ +46 // Its not valid to copy a MPIPack but you can move it │ │ │ │ │ +_4_7 _M_P_I_P_a_c_k(const _M_P_I_P_a_c_k&) = delete; │ │ │ │ │ +_4_8 _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _=_ (const _M_P_I_P_a_c_k& other) = delete; │ │ │ │ │ +_4_9 _M_P_I_P_a_c_k(_M_P_I_P_a_c_k&&) = default; │ │ │ │ │ +_5_0 _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _=_ (_M_P_I_P_a_c_k&& other) = default; │ │ │ │ │ +51 │ │ │ │ │ +57 template │ │ │ │ │ +_5_8 void _p_a_c_k(const T& data){ │ │ │ │ │ +59 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ +60 int _s_i_z_e = _g_e_t_P_a_c_k_S_i_z_e(mpidata.size(), _comm, mpidata.type()); │ │ │ │ │ +61 constexpr bool has_static_size = decltype(_g_e_t_M_P_I_D_a_t_a(std::declval())):: │ │ │ │ │ +static_size; │ │ │ │ │ +62 if(!has_static_size) │ │ │ │ │ +63 _s_i_z_e += _g_e_t_P_a_c_k_S_i_z_e(1, _comm, MPI_INT); │ │ │ │ │ +64 if (_position + _s_i_z_e > 0 && size_t(_position + _s_i_z_e) > _buffer.size()) / │ │ │ │ │ +/ resize buffer if necessary │ │ │ │ │ +65 _buffer.resize(_position + _s_i_z_e); │ │ │ │ │ +66 if(!has_static_size){ │ │ │ │ │ +67 int _s_i_z_e = mpidata.size(); │ │ │ │ │ +68 MPI_Pack(&_s_i_z_e, 1, MPI_INT, _buffer.data(), _buffer.size(), │ │ │ │ │ +69 &_position, _comm); │ │ │ │ │ +70 } │ │ │ │ │ +71 MPI_Pack(mpidata.ptr(), mpidata.size(), │ │ │ │ │ +72 mpidata.type(), _buffer.data(), _buffer.size(), │ │ │ │ │ +73 &_position, _comm); │ │ │ │ │ +74 } │ │ │ │ │ +75 │ │ │ │ │ +80 template │ │ │ │ │ +_8_1 auto /*void*/ _u_n_p_a_c_k(T& data) │ │ │ │ │ +82 -> std::enable_if_t │ │ │ │ │ +83 { │ │ │ │ │ +84 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ +85 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ +86 mpidata.ptr(), mpidata.size(), │ │ │ │ │ +87 mpidata.type(), _comm); │ │ │ │ │ +88 } │ │ │ │ │ +89 │ │ │ │ │ +94 template │ │ │ │ │ +_9_5 auto /*void*/ _u_n_p_a_c_k(T& data) │ │ │ │ │ +96 -> std::enable_if_t │ │ │ │ │ +97 { │ │ │ │ │ +98 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ +99 int _s_i_z_e = 0; │ │ │ │ │ +100 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ +101 &_s_i_z_e, 1, │ │ │ │ │ +102 MPI_INT, _comm); │ │ │ │ │ +103 mpidata.resize(_s_i_z_e); │ │ │ │ │ +104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ +105 mpidata.ptr(), mpidata.size(), │ │ │ │ │ +106 mpidata.type(), _comm); │ │ │ │ │ +107 } │ │ │ │ │ +108 │ │ │ │ │ +109 │ │ │ │ │ +111 template │ │ │ │ │ +_1_1_2 friend _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _<_<_ (_M_P_I_P_a_c_k& p, const T& t){ │ │ │ │ │ +113 p._p_a_c_k(t); │ │ │ │ │ +114 return p; │ │ │ │ │ +115 } │ │ │ │ │ +116 │ │ │ │ │ +118 template │ │ │ │ │ +_1_1_9 friend _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _>_>_ (_M_P_I_P_a_c_k& p, T& t){ │ │ │ │ │ +120 p._u_n_p_a_c_k(t); │ │ │ │ │ +121 return p; │ │ │ │ │ +122 } │ │ │ │ │ +123 │ │ │ │ │ +125 template │ │ │ │ │ +_1_2_6 _M_P_I_P_a_c_k& _r_e_a_d(T& t){ │ │ │ │ │ +127 _u_n_p_a_c_k(t); │ │ │ │ │ +128 return *this; │ │ │ │ │ +129 } │ │ │ │ │ +130 │ │ │ │ │ +132 template │ │ │ │ │ +_1_3_3 _M_P_I_P_a_c_k& _w_r_i_t_e(const T& t){ │ │ │ │ │ +134 _p_a_c_k(t); │ │ │ │ │ +135 return *this; │ │ │ │ │ +136 } │ │ │ │ │ +137 │ │ │ │ │ +_1_4_1 void _r_e_s_i_z_e(size_t _s_i_z_e){ │ │ │ │ │ +142 _buffer.resize(_s_i_z_e); │ │ │ │ │ +143 } │ │ │ │ │ +144 │ │ │ │ │ +_1_4_7 void _e_n_l_a_r_g_e(int s) { │ │ │ │ │ +148 _buffer.resize(_buffer.size() + s); │ │ │ │ │ +149 } │ │ │ │ │ +150 │ │ │ │ │ +_1_5_3 size_t _s_i_z_e() const { │ │ │ │ │ +154 return _buffer.size(); │ │ │ │ │ +155 } │ │ │ │ │ +156 │ │ │ │ │ +_1_6_0 void _s_e_e_k(int p){ │ │ │ │ │ +161 _position = p; │ │ │ │ │ +162 } │ │ │ │ │ +163 │ │ │ │ │ +_1_6_7 int _t_e_l_l() const{ │ │ │ │ │ +168 return _position; │ │ │ │ │ +169 } │ │ │ │ │ 170 │ │ │ │ │ -171 template │ │ │ │ │ -172 friend void _s_w_a_p(Proxy p1, T& s2) │ │ │ │ │ -173 { │ │ │ │ │ -174 // don't use swap() ourselves -- not supported by Vc 1.3.0 (but is │ │ │ │ │ -175 // supported by Vc 1.3.2) │ │ │ │ │ -176 T tmp = p1.vec_[p1.idx_]; │ │ │ │ │ -177 p1.vec_[p1.idx_] = s2; │ │ │ │ │ -178 s2 = tmp; │ │ │ │ │ -179 } │ │ │ │ │ -180 │ │ │ │ │ -181 template │ │ │ │ │ -182 friend void _s_w_a_p(T& s1, Proxy p2) │ │ │ │ │ -183 { │ │ │ │ │ -184 T tmp = s1; │ │ │ │ │ -185 s1 = p2.vec_[p2.idx_]; │ │ │ │ │ -186 p2.vec_[p2.idx_] = tmp; │ │ │ │ │ -187 } │ │ │ │ │ -188 }; │ │ │ │ │ -189 │ │ │ │ │ -190 template │ │ │ │ │ -191 void _s_w_a_p(Proxy p1, Proxy p2) │ │ │ │ │ -192 { │ │ │ │ │ -193 typename V1::value_type tmp = p1.vec_[p1.idx_]; │ │ │ │ │ -194 p1.vec_[p1.idx_] = p2.vec_[p2.idx_]; │ │ │ │ │ -195 p2.vec_[p2.idx_] = tmp; │ │ │ │ │ -196 } │ │ │ │ │ -197 } // namespace VcImpl │ │ │ │ │ -198#endif // HAVE_VC │ │ │ │ │ -199 │ │ │ │ │ -200 template │ │ │ │ │ -_2_0_1 struct _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ -202 { │ │ │ │ │ -_2_0_3 using _t_y_p_e = T; │ │ │ │ │ -204 }; │ │ │ │ │ -205 │ │ │ │ │ -206 template │ │ │ │ │ -_2_0_7 using _S_i_m_d_S_c_a_l_a_r = typename _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_T_>_:_:_t_y_p_e; │ │ │ │ │ +_1_7_3 bool _e_o_f() const{ │ │ │ │ │ +174 return std::size_t(_position)==_buffer.size(); │ │ │ │ │ +175 } │ │ │ │ │ +176 │ │ │ │ │ +_1_8_0 static int _g_e_t_P_a_c_k_S_i_z_e(int len, const MPI_Comm& comm, const MPI_Datatype& │ │ │ │ │ +dt){ │ │ │ │ │ +181 int _s_i_z_e; │ │ │ │ │ +182 MPI_Pack_size(len, dt, comm, &_s_i_z_e); │ │ │ │ │ +183 return _s_i_z_e; │ │ │ │ │ +184 } │ │ │ │ │ +185 │ │ │ │ │ +_1_8_6 friend bool _o_p_e_r_a_t_o_r_=_=(const _M_P_I_P_a_c_k& a, const _M_P_I_P_a_c_k& b) { │ │ │ │ │ +187 return a._buffer == b._buffer && a._comm == b._comm; │ │ │ │ │ +188 } │ │ │ │ │ +_1_8_9 friend bool _o_p_e_r_a_t_o_r_!_=(const _M_P_I_P_a_c_k& a, const _M_P_I_P_a_c_k& b) { │ │ │ │ │ +190 return !(a==b); │ │ │ │ │ +191 } │ │ │ │ │ +192 │ │ │ │ │ +193 }; │ │ │ │ │ +194 │ │ │ │ │ +195 template │ │ │ │ │ +_1_9_6 struct _M_P_I_D_a_t_a, │ │ │ │ │ +MPIPack>::value>> { │ │ │ │ │ +197 protected: │ │ │ │ │ +_1_9_8 friend auto getMPIData

(P& t); │ │ │ │ │ +_1_9_9 _M_P_I_D_a_t_a(P& t) : │ │ │ │ │ +200 _d_a_t_a__(t) │ │ │ │ │ +201 {} │ │ │ │ │ +202 public: │ │ │ │ │ +_2_0_3 static constexpr bool _s_t_a_t_i_c___s_i_z_e = std::is_const

::value; │ │ │ │ │ +204 │ │ │ │ │ +_2_0_5 void* _p_t_r() { │ │ │ │ │ +206 return (void*) _d_a_t_a__._buffer.data(); │ │ │ │ │ +207 } │ │ │ │ │ 208 │ │ │ │ │ -209#if HAVE_VC │ │ │ │ │ -210 /* │ │ │ │ │ -211 Add Vc specializations for the SimdScalarTypeTraits trais class │ │ │ │ │ -212 */ │ │ │ │ │ -213 template │ │ │ │ │ -214 struct _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s< Vc::Vector > │ │ │ │ │ -215 { │ │ │ │ │ -216 using _t_y_p_e = T; │ │ │ │ │ -217 }; │ │ │ │ │ -218 │ │ │ │ │ -219 template │ │ │ │ │ -220 struct SimdScalarTypeTraits< Vc::SimdArray > │ │ │ │ │ -221 { │ │ │ │ │ -222 using _t_y_p_e = T; │ │ │ │ │ -223 }; │ │ │ │ │ -224#endif // HAVE_VC │ │ │ │ │ +_2_0_9 int _s_i_z_e() { │ │ │ │ │ +210 return _d_a_t_a__.size(); │ │ │ │ │ +211 } │ │ │ │ │ +212 │ │ │ │ │ +_2_1_3 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ +214 return MPI_PACKED; │ │ │ │ │ +215 } │ │ │ │ │ +216 │ │ │ │ │ +_2_1_7 void _r_e_s_i_z_e(int _s_i_z_e){ │ │ │ │ │ +218 _d_a_t_a__.resize(_s_i_z_e); │ │ │ │ │ +219 } │ │ │ │ │ +220 protected: │ │ │ │ │ +_2_2_1 P& _d_a_t_a__; │ │ │ │ │ +222 }; │ │ │ │ │ +223 │ │ │ │ │ +224} // end namespace Dune │ │ │ │ │ 225 │ │ │ │ │ -227 template │ │ │ │ │ -_2_2_8 struct _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s< _A_l_i_g_n_e_d_N_u_m_b_e_r > │ │ │ │ │ -229 { │ │ │ │ │ -_2_3_0 using _t_y_p_e = T; │ │ │ │ │ -231 }; │ │ │ │ │ -232 │ │ │ │ │ -233 template │ │ │ │ │ -_2_3_4 struct _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s { │ │ │ │ │ -_2_3_5 using _t_y_p_e = std::size_t; │ │ │ │ │ -236 }; │ │ │ │ │ -237 │ │ │ │ │ -239 │ │ │ │ │ -245 template │ │ │ │ │ -_2_4_6 using _S_i_m_d_I_n_d_e_x = typename _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s_<_V_>_:_:_t_y_p_e; │ │ │ │ │ -247 │ │ │ │ │ -248#if HAVE_VC │ │ │ │ │ -249 template │ │ │ │ │ -250 struct _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s > { │ │ │ │ │ -251 using _t_y_p_e = typename Vc::Vector::index_type; │ │ │ │ │ -252 }; │ │ │ │ │ -253 │ │ │ │ │ -254 template │ │ │ │ │ -255 struct SimdIndexTypeTraits > { │ │ │ │ │ -256 using _t_y_p_e = typename Vc::SimdArray::index_type; │ │ │ │ │ -257 }; │ │ │ │ │ -258#endif // HAVE_VC │ │ │ │ │ -259 │ │ │ │ │ -260 template │ │ │ │ │ -_2_6_1 struct _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s { │ │ │ │ │ -_2_6_2 using _t_y_p_e = bool; │ │ │ │ │ -263 }; │ │ │ │ │ -264 │ │ │ │ │ -266 │ │ │ │ │ -269 template │ │ │ │ │ -_2_7_0 using _S_i_m_d_M_a_s_k = typename _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s_<_V_>_:_:_t_y_p_e; │ │ │ │ │ -271 │ │ │ │ │ -272#if HAVE_VC │ │ │ │ │ -273 template │ │ │ │ │ -274 struct _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s > { │ │ │ │ │ -275 using _t_y_p_e = typename Vc::Vector::mask_type; │ │ │ │ │ -276 }; │ │ │ │ │ -277 │ │ │ │ │ -278 template │ │ │ │ │ -279 struct SimdMaskTypeTraits > { │ │ │ │ │ -280 using _t_y_p_e = typename Vc::SimdArray::mask_type; │ │ │ │ │ -281 }; │ │ │ │ │ -282#endif // HAVE_VC │ │ │ │ │ -283 │ │ │ │ │ -284#if HAVE_VC │ │ │ │ │ -285 /* │ │ │ │ │ -286 Add Vc specializations for cond(), see conditional.hh │ │ │ │ │ -287 */ │ │ │ │ │ -288 template │ │ │ │ │ -289 Vc::Vector _c_o_n_d(const Vc::Mask & b, │ │ │ │ │ -290 const Vc::Vector & v1, │ │ │ │ │ -291 const Vc::Vector & v2) │ │ │ │ │ -292 { │ │ │ │ │ -293 return std::move(Vc::iif(b, v1, v2)); │ │ │ │ │ -294 } │ │ │ │ │ -295 │ │ │ │ │ -296 template │ │ │ │ │ -297 Vc::SimdArray _c_o_n_d(const typename Vc::SimdArray:: │ │ │ │ │ -mask_type & b, │ │ │ │ │ -298 const Vc::SimdArray & v1, │ │ │ │ │ -299 const Vc::SimdArray & v2) │ │ │ │ │ -300 { │ │ │ │ │ -301 return std::move(Vc::iif(b, v1, v2)); │ │ │ │ │ -302 } │ │ │ │ │ -303#endif // HAVE_VC │ │ │ │ │ -304 │ │ │ │ │ -305#if HAVE_VC │ │ │ │ │ -306 /* │ │ │ │ │ -307 Add Vc specializations for several boolean operations, see │ │ │ │ │ -rangeutitlities.hh: │ │ │ │ │ -308 │ │ │ │ │ -309 max_value, min_value, any_true, all_true │ │ │ │ │ -310 */ │ │ │ │ │ -311 template │ │ │ │ │ -312 T _m_a_x___v_a_l_u_e(const Vc::Vector & v) │ │ │ │ │ -313 { │ │ │ │ │ -314 return v.max(); │ │ │ │ │ -315 } │ │ │ │ │ -316 │ │ │ │ │ -317 template │ │ │ │ │ -318 double _m_a_x___v_a_l_u_e(const Vc::SimdArray & v) │ │ │ │ │ -319 { │ │ │ │ │ -320 return v.max(); │ │ │ │ │ -321 } │ │ │ │ │ -322 │ │ │ │ │ -323 template │ │ │ │ │ -324 T _m_i_n___v_a_l_u_e(const Vc::Vector & v) │ │ │ │ │ -325 { │ │ │ │ │ -326 return v.min(); │ │ │ │ │ -327 } │ │ │ │ │ -328 │ │ │ │ │ -329 template │ │ │ │ │ -330 double _m_i_n___v_a_l_u_e(const Vc::SimdArray & v) │ │ │ │ │ -331 { │ │ │ │ │ -332 return v.min(); │ │ │ │ │ -333 } │ │ │ │ │ -334 │ │ │ │ │ -335 template │ │ │ │ │ -336 bool _a_n_y___t_r_u_e(const Vc::Mask & v) │ │ │ │ │ -337 { │ │ │ │ │ -338 return Vc::any_of(v); │ │ │ │ │ -339 } │ │ │ │ │ -340 │ │ │ │ │ -341 template │ │ │ │ │ -342 bool _a_n_y___t_r_u_e(const Vc::SimdMaskArray & v) │ │ │ │ │ -343 { │ │ │ │ │ -344 return Vc::any_of(v); │ │ │ │ │ -345 } │ │ │ │ │ -346 │ │ │ │ │ -347 template │ │ │ │ │ -348 bool _a_l_l___t_r_u_e(const Vc::Mask & v) │ │ │ │ │ -349 { │ │ │ │ │ -350 return Vc::all_of(v); │ │ │ │ │ -351 } │ │ │ │ │ -352 │ │ │ │ │ -353 template │ │ │ │ │ -354 bool _a_l_l___t_r_u_e(const Vc::SimdMaskArray & v) │ │ │ │ │ -355 { │ │ │ │ │ -356 return Vc::all_of(v); │ │ │ │ │ -357 } │ │ │ │ │ -358#endif // HAVE_VC │ │ │ │ │ -359 │ │ │ │ │ -361 template │ │ │ │ │ -_3_6_2 std::size_t _l_a_n_e_s(const T &) { return 1; } │ │ │ │ │ -363 │ │ │ │ │ -365 template │ │ │ │ │ -_3_6_6 T _l_a_n_e(std::size_t l, const T &v) │ │ │ │ │ -367 { │ │ │ │ │ -368 assert(l == 0); │ │ │ │ │ -369 return v; │ │ │ │ │ -370 } │ │ │ │ │ -371 │ │ │ │ │ -373 template │ │ │ │ │ -_3_7_4 T &_l_a_n_e(std::size_t l, T &v) │ │ │ │ │ -375 { │ │ │ │ │ -376 assert(l == 0); │ │ │ │ │ -377 return v; │ │ │ │ │ -378 } │ │ │ │ │ -379 │ │ │ │ │ -380#if HAVE_VC │ │ │ │ │ -381 template │ │ │ │ │ -382 std::size_t _l_a_n_e_s(const Vc::Vector &) │ │ │ │ │ -383 { │ │ │ │ │ -384 return Vc::Vector::size(); │ │ │ │ │ -385 } │ │ │ │ │ -386 │ │ │ │ │ -387 template │ │ │ │ │ -388 T _l_a_n_e(std::size_t l, const Vc::Vector &v) │ │ │ │ │ -389 { │ │ │ │ │ -390 assert(l < _l_a_n_e_s(v)); │ │ │ │ │ -391 return v[l]; │ │ │ │ │ -392 } │ │ │ │ │ -393 │ │ │ │ │ -394 template │ │ │ │ │ -395 auto _l_a_n_e(std::size_t l, Vc::Vector &v) │ │ │ │ │ -396 { │ │ │ │ │ -397 assert(l < _l_a_n_e_s(v)); │ │ │ │ │ -398 return VcImpl::Proxy >{l, v}; │ │ │ │ │ -399 } │ │ │ │ │ -400 │ │ │ │ │ -401 template │ │ │ │ │ -402 std::size_t _l_a_n_e_s(const Vc::SimdArray &) │ │ │ │ │ -403 { │ │ │ │ │ -404 return n; │ │ │ │ │ -405 } │ │ │ │ │ -406 │ │ │ │ │ -407 template │ │ │ │ │ -408 T _l_a_n_e(std::size_t l, const Vc::SimdArray &v) │ │ │ │ │ -409 { │ │ │ │ │ -410 assert(l < n); │ │ │ │ │ -411 return v[l]; │ │ │ │ │ -412 } │ │ │ │ │ -413 │ │ │ │ │ -414 template │ │ │ │ │ -415 auto _l_a_n_e(std::size_t l, Vc::SimdArray &v) │ │ │ │ │ -416 { │ │ │ │ │ -417 assert(l < n); │ │ │ │ │ -418 return VcImpl::Proxy >{l, v}; │ │ │ │ │ -419 } │ │ │ │ │ -420 │ │ │ │ │ -421 template │ │ │ │ │ -422 std::size_t _l_a_n_e_s(const Vc::SimdMaskArray &) │ │ │ │ │ -423 { │ │ │ │ │ -424 return n; │ │ │ │ │ -425 } │ │ │ │ │ -426 │ │ │ │ │ -427 template │ │ │ │ │ -428 bool _l_a_n_e(std::size_t l, const Vc::SimdMaskArray &v) │ │ │ │ │ -429 { │ │ │ │ │ -430 assert(l < n); │ │ │ │ │ -431 return v[l]; │ │ │ │ │ -432 } │ │ │ │ │ -433 │ │ │ │ │ -434 template │ │ │ │ │ -435 auto _l_a_n_e(std::size_t l, Vc::SimdMaskArray &v) │ │ │ │ │ -436 { │ │ │ │ │ -437 assert(l < n); │ │ │ │ │ -438 return VcImpl::Proxy >{l, v}; │ │ │ │ │ -439 } │ │ │ │ │ -440#endif // HAVE_VC │ │ │ │ │ -441 │ │ │ │ │ -443 │ │ │ │ │ -446 template │ │ │ │ │ -_4_4_7 void _a_s_s_i_g_n(T &dst, const T &src, bool mask) │ │ │ │ │ -448 { │ │ │ │ │ -449 if(mask) dst = src; │ │ │ │ │ -450 } │ │ │ │ │ -451 │ │ │ │ │ -452#if HAVE_VC │ │ │ │ │ -453 /* │ │ │ │ │ -454 Add Vc specializations for masked assignment │ │ │ │ │ -455 */ │ │ │ │ │ -456 template │ │ │ │ │ -457 void _a_s_s_i_g_n(Vc::Vector &dst, const Vc::Vector &src, │ │ │ │ │ -458 typename Vc::Vector::mask_type mask) │ │ │ │ │ -459 { │ │ │ │ │ -460 dst(mask) = src; │ │ │ │ │ -461 } │ │ │ │ │ -462 │ │ │ │ │ -463 template │ │ │ │ │ -464 void _a_s_s_i_g_n(Vc::SimdArray &dst, const Vc::SimdArray &src, │ │ │ │ │ -465 typename Vc::SimdArray::mask_type mask) │ │ │ │ │ -466 { │ │ │ │ │ -467 dst(mask) = src; │ │ │ │ │ -468 } │ │ │ │ │ -469#endif // HAVE_VC │ │ │ │ │ -470 │ │ │ │ │ -471 template │ │ │ │ │ -_4_7_2 void _s_w_a_p(T &v1, T &v2, bool mask) │ │ │ │ │ -473 { │ │ │ │ │ -474 using std::swap; │ │ │ │ │ -475 if(mask) _s_w_a_p(v1, v2); │ │ │ │ │ -476 } │ │ │ │ │ -477 │ │ │ │ │ -478#if HAVE_VC │ │ │ │ │ -479 /* │ │ │ │ │ -480 Add Vc specializations for masked swap │ │ │ │ │ -481 */ │ │ │ │ │ -482 template │ │ │ │ │ -483 void _s_w_a_p(Vc::Vector &v1, Vc::Vector &v2, │ │ │ │ │ -484 typename Vc::Vector::mask_type mask) │ │ │ │ │ -485 { │ │ │ │ │ -486 auto tmp = v1; │ │ │ │ │ -487 v1(mask) = v2; │ │ │ │ │ -488 v2(mask) = tmp; │ │ │ │ │ -489 } │ │ │ │ │ -490 │ │ │ │ │ -491 template │ │ │ │ │ -492 void _s_w_a_p(Vc::SimdArray &v1, Vc::SimdArray &v2, │ │ │ │ │ -493 typename Vc::SimdArray::mask_type mask) │ │ │ │ │ -494 { │ │ │ │ │ -495 auto tmp = v1; │ │ │ │ │ -496 v1(mask) = v2; │ │ │ │ │ -497 v2(mask) = tmp; │ │ │ │ │ -498 } │ │ │ │ │ -499#endif // HAVE_VC │ │ │ │ │ -500 │ │ │ │ │ -501} // end namespace Dune │ │ │ │ │ -502 │ │ │ │ │ -503#endif // DUNE_COMMON_SIMD_HH │ │ │ │ │ -_v_c_._h_h │ │ │ │ │ -Compatibility header for including │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for reduction like operations on ranges. │ │ │ │ │ -_c_o_n_d_i_t_i_o_n_a_l_._h_h │ │ │ │ │ -_d_e_b_u_g_a_l_i_g_n_._h_h │ │ │ │ │ +226#endif │ │ │ │ │ +227#endif │ │ │ │ │ +_m_p_i_d_a_t_a_._h_h │ │ │ │ │ +Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ +MPI calls. │ │ │ │ │ +_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides MPI's collective communication │ │ │ │ │ +methods. │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_a_n_y___t_r_u_e │ │ │ │ │ -bool any_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:493 │ │ │ │ │ -_D_u_n_e_:_:_a_l_l___t_r_u_e │ │ │ │ │ -bool all_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:499 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_I_n_d_e_x │ │ │ │ │ -typename SimdIndexTypeTraits< V >::type SimdIndex │ │ │ │ │ -An simd vector of indices corresponding to a simd vector V. │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:246 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r │ │ │ │ │ -typename SimdScalarTypeTraits< T >::type SimdScalar │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:207 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_M_a_s_k │ │ │ │ │ -typename SimdMaskTypeTraits< V >::type SimdMask │ │ │ │ │ -A simd vector of truth values corresponding to a simd vector V. │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:270 │ │ │ │ │ -_D_u_n_e_:_:_l_a_n_e │ │ │ │ │ -T lane(std::size_t l, const T &v) │ │ │ │ │ -access a lane of a simd vector (scalar version) │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:366 │ │ │ │ │ -_D_u_n_e_:_:_s_w_a_p │ │ │ │ │ -void swap(T &v1, T &v2, bool mask) │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:472 │ │ │ │ │ -_D_u_n_e_:_:_a_s_s_i_g_n │ │ │ │ │ -void assign(T &dst, const T &src, bool mask) │ │ │ │ │ -masked Simd assignment (scalar version) │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:447 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_d │ │ │ │ │ -const T1 cond(bool b, const T1 &v1, const T2 &v2) │ │ │ │ │ -conditional evaluate │ │ │ │ │ -DDeeffiinniittiioonn conditional.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_m_a_x___v_a_l_u_e │ │ │ │ │ -T max_value(const AlignedNumber< T, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:481 │ │ │ │ │ -_D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ -T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:487 │ │ │ │ │ -_D_u_n_e_:_:_l_a_n_e_s │ │ │ │ │ -std::size_t lanes(const T &) │ │ │ │ │ -get the number of lanes of a simd vector (scalar version) │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:362 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ -aligned wrappers for arithmetic types │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:202 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ -T type │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:203 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -T type │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:234 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ -std::size_t type │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:235 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ -bool type │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:262 │ │ │ │ │ -_v_c_._h_h │ │ │ │ │ -SIMD abstractions for Vc. │ │ │ │ │ -_D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T │ │ │ │ │ -#define DUNE_SIMD_VC_ASSIGNMENT(OP) │ │ │ │ │ -DDeeffiinniittiioonn simd/vc.hh:224 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ +auto getMPIData(T &t) │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Collective communication interface and sequential default implementation. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_d_a_t_a__ │ │ │ │ │ +T & data_ │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_t_a_t_i_c___s_i_z_e │ │ │ │ │ +static constexpr bool static_size │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_e_n_l_a_r_g_e │ │ │ │ │ +void enlarge(int s) │ │ │ │ │ +Enlarges the internal buffer. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:147 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ +friend MPIPack & operator>>(MPIPack &p, T &t) │ │ │ │ │ +Unpacks data from the object. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:119 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +friend MPIPack & operator<<(MPIPack &p, const T &t) │ │ │ │ │ +Packs the data into the object. Enlarges the internal buffer if necessary. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +friend bool operator!=(const MPIPack &a, const MPIPack &b) │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_s_i_z_e │ │ │ │ │ +size_t size() const │ │ │ │ │ +Returns the size of the internal buffer. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +MPIPack & operator=(const MPIPack &other)=delete │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_M_P_I_P_a_c_k │ │ │ │ │ +MPIPack(Communication< MPI_Comm > comm, std::size_t size=0) │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_p_a_c_k │ │ │ │ │ +void pack(const T &data) │ │ │ │ │ +Packs the data into the object. Enlarges the internal buffer if necessary. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_u_n_p_a_c_k │ │ │ │ │ +auto unpack(T &data) -> std::enable_if_t │ │ │ │ │ +Unpacks data from the object. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_u_n_p_a_c_k │ │ │ │ │ +auto unpack(T &data) -> std::enable_if_t< decltype(getMPIData(data)):: │ │ │ │ │ +static_size, void > │ │ │ │ │ +Unpacks data from the object. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +friend bool operator==(const MPIPack &a, const MPIPack &b) │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:186 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_M_P_I_P_a_c_k │ │ │ │ │ +MPIPack(const MPIPack &)=delete │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_s_e_e_k │ │ │ │ │ +void seek(int p) │ │ │ │ │ +Sets the position in the buffer where the next pack/unpack operation should │ │ │ │ │ +take place. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:160 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_e_o_f │ │ │ │ │ +bool eof() const │ │ │ │ │ +Checks whether the end of the buffer is reached. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:173 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_r_e_s_i_z_e │ │ │ │ │ +void resize(size_t size) │ │ │ │ │ +Resizes the internal buffer. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_t_e_l_l │ │ │ │ │ +int tell() const │ │ │ │ │ +Gets the position in the buffer where the next pack/unpack operation should │ │ │ │ │ +take place. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_M_P_I_P_a_c_k │ │ │ │ │ +MPIPack(MPIPack &&)=default │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_r_e_a_d │ │ │ │ │ +MPIPack & read(T &t) │ │ │ │ │ +Unpacks data from the object. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_g_e_t_P_a_c_k_S_i_z_e │ │ │ │ │ +static int getPackSize(int len, const MPI_Comm &comm, const MPI_Datatype &dt) │ │ │ │ │ +Returns the size of the data needed to store the data in an MPIPack. See │ │ │ │ │ +MPI_Pack_size. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_w_r_i_t_e │ │ │ │ │ +MPIPack & write(const T &t) │ │ │ │ │ +Packs the data into the object. Enlarges the internal buffer if necessary. │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:133 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ +_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +MPI_Datatype type() const │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:213 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ +_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_M_P_I_D_a_t_a │ │ │ │ │ +MPIData(P &t) │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:199 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ +_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_s_i_z_e │ │ │ │ │ +int size() │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ +_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_p_t_r │ │ │ │ │ +void * ptr() │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:205 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ +_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_d_a_t_a__ │ │ │ │ │ +P & data_ │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:221 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ +_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_r_e_s_i_z_e │ │ │ │ │ +void resize(int size) │ │ │ │ │ +DDeeffiinniittiioonn mpipack.hh:217 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00071.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: io.hh File Reference │ │ │ │ +dune-common: indicessyncer.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,76 +65,86 @@ │ │ │ │

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ - │ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

IO interface of the SIMD abstraction. │ │ │ │ +

Class for adding missing indices of a distributed index set in a local communication. │ │ │ │ More...

│ │ │ │ -
#include <ios>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ │ -#include <dune/common/simd/simd.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ +
#include "indexset.hh"
│ │ │ │ +#include "remoteindices.hh"
│ │ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ │ +#include <dune/common/sllist.hh>
│ │ │ │ +#include <cassert>
│ │ │ │ +#include <cmath>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <functional>
│ │ │ │ +#include <map>
│ │ │ │ +#include <tuple>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::SimdImpl::Inserter< T >
class  Dune::IndicesSyncer< T >
 Class for recomputing missing indices of a distributed index set. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::SimdImpl
 
namespace  Dune::Simd
 Namespace for vectorization interface functions used by library developers.
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<class V , class = std::enable_if_t<Simd::lanes<V>() != 1>>
Inserter< V > Dune::SimdImpl::io (const V &v)
 
template<class V , class = std::enable_if_t<Simd::lanes<V>() == 1>>
Simd::Scalar< V > Dune::SimdImpl::io (const V &v)
 
IO interface

Templates and functions in this group provide syntactic sugar for IO. They are implemented using the functionality from SimdInterfaceBase, and are not customizable by implementations.

│ │ │ │ -
template<class V >
auto Dune::Simd::vio (const V &v)
 construct a stream inserter
 
template<class V >
auto Dune::Simd::io (const V &v)
 construct a stream inserter
 
template<typename TG , typename TA >
bool Dune::operator< (const IndexPair< TG, ParallelLocalIndex< TA > > &i1, const std::pair< TG, TA > &i2)
 
template<typename TG , typename TA >
bool Dune::operator< (const std::pair< TG, TA > &i1, const IndexPair< TG, ParallelLocalIndex< TA > > &i2)
 
template<typename TG , typename TA >
bool Dune::operator== (const IndexPair< TG, ParallelLocalIndex< TA > > &i1, const std::pair< TG, TA > &i2)
 
template<typename TG , typename TA >
bool Dune::operator!= (const IndexPair< TG, ParallelLocalIndex< TA > > &i1, const std::pair< TG, TA > &i2)
 
template<typename TG , typename TA >
bool Dune::operator== (const std::pair< TG, TA > &i2, const IndexPair< TG, ParallelLocalIndex< TA > > &i1)
 
template<typename TG , typename TA >
bool Dune::operator!= (const std::pair< TG, TA > &i2, const IndexPair< TG, ParallelLocalIndex< TA > > &i1)
 
template<typename T , typename A , typename A1 >
void Dune::storeGlobalIndicesOfRemoteIndices (std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, const RemoteIndices< T, A1 > &remoteIndices)
 Stores the corresponding global indices of the remote index information.
 
template<typename T , typename A , typename A1 >
void Dune::repairLocalIndexPointers (std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, RemoteIndices< T, A1 > &remoteIndices, const T &indexSet)
 Repair the pointers to the local indices in the remote indices.
 
│ │ │ │

Detailed Description

│ │ │ │ -

IO interface of the SIMD abstraction.

│ │ │ │ -

This file provides IO interface functions of the SIMD abstraction layer.

│ │ │ │ -

This file is intended for direct inclusion by header making use of the IO interface.

│ │ │ │ +

Class for adding missing indices of a distributed index set in a local communication.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,56 +1,77 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ -_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _L_i_b_r_a_r_y_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e │ │ │ │ │ -IO interface of the SIMD abstraction. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +indicessyncer.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ +Class for adding missing indices of a distributed index set in a local │ │ │ │ │ +communication. _M_o_r_e_._._. │ │ │ │ │ +#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ +#include "_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h" │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_l_l_i_s_t_._h_h> │ │ │ │ │ +#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_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_<_ _T_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_<_ _T_ _> │ │ │ │ │ +  Class for recomputing missing indices of a distributed index set. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d_I_m_p_l │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ -  Namespace for vectorization interface functions used by library │ │ │ │ │ - developers. │ │ │ │ │ -  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template() != 1>> │ │ │ │ │ - _I_n_s_e_r_t_e_r< V >  _D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_i_o (const V &v) │ │ │ │ │ -  │ │ │ │ │ -template() == 1>> │ │ │ │ │ -_S_i_m_d_:_:_S_c_a_l_a_r< V >  _D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_i_o (const V &v) │ │ │ │ │ -  │ │ │ │ │ -IO interface │ │ │ │ │ -Templates and functions in this group provide syntactic sugar for IO. They are │ │ │ │ │ -implemented using the functionality from SimdInterfaceBase, and are not │ │ │ │ │ -customizable by implementations. │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_v_i_o (const V &v) │ │ │ │ │ -  construct a stream inserter │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_S_i_m_d_:_:_i_o (const V &v) │ │ │ │ │ -  construct a stream inserter │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const _I_n_d_e_x_P_a_i_r< TG, _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1, │ │ │ │ │ + const std::pair< TG, TA > &i2) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const std::pair< TG, TA > &i1, const _I_n_d_e_x_P_a_i_r< TG, │ │ │ │ │ + _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i2) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _I_n_d_e_x_P_a_i_r< TG, _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1, │ │ │ │ │ + const std::pair< TG, TA > &i2) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _I_n_d_e_x_P_a_i_r< TG, _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1, │ │ │ │ │ + const std::pair< TG, TA > &i2) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const std::pair< TG, TA > &i2, const _I_n_d_e_x_P_a_i_r< TG, │ │ │ │ │ + _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const std::pair< TG, TA > &i2, const _I_n_d_e_x_P_a_i_r< TG, │ │ │ │ │ + _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_s_t_o_r_e_G_l_o_b_a_l_I_n_d_i_c_e_s_O_f_R_e_m_o_t_e_I_n_d_i_c_e_s (std::map< int, _S_L_L_i_s_t< std:: │ │ │ │ │ + pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > │ │ │ │ │ + &globalMap, const _R_e_m_o_t_e_I_n_d_i_c_e_s< T, A1 > &remoteIndices) │ │ │ │ │ +  Stores the corresponding global indices of the remote index information. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s (std::map< int, _S_L_L_i_s_t< std::pair< │ │ │ │ │ + typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > │ │ │ │ │ + &globalMap, _R_e_m_o_t_e_I_n_d_i_c_e_s< T, A1 > &remoteIndices, const T &indexSet) │ │ │ │ │ +  Repair the pointers to the local indices in the remote indices. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -IO interface of the SIMD abstraction. │ │ │ │ │ -This file provides IO interface functions of the SIMD abstraction layer. │ │ │ │ │ -This file is intended for direct inclusion by header making use of the IO │ │ │ │ │ -interface. │ │ │ │ │ +Class for adding missing indices of a distributed index set in a local │ │ │ │ │ +communication. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: io.hh Source File │ │ │ │ +dune-common: indicessyncer.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,125 +70,1051 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
io.hh
│ │ │ │ +
indicessyncer.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_IO_HH
│ │ │ │ -
4#define DUNE_COMMON_SIMD_IO_HH
│ │ │ │ -
5
│ │ │ │ -
16#include <ios>
│ │ │ │ -
17#include <type_traits>
│ │ │ │ -
18
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
22
│ │ │ │ -
23namespace Dune {
│ │ │ │ -
24
│ │ │ │ -
│ │ │ │ -
25 namespace SimdImpl {
│ │ │ │ -
26
│ │ │ │ -
27 template<class T>
│ │ │ │ -
│ │ │ │ -
28 class Inserter {
│ │ │ │ -
29 T value_;
│ │ │ │ -
30
│ │ │ │ -
31 public:
│ │ │ │ -
32 Inserter(const T &value) : value_(value) {}
│ │ │ │ -
33
│ │ │ │ -
34 template<class Stream,
│ │ │ │ -
35 class = std::enable_if_t<std::is_base_of<std::ios_base,
│ │ │ │ -
36 Stream>::value> >
│ │ │ │ -
│ │ │ │ -
37 friend Stream& operator<<(Stream &out, const Inserter &ins)
│ │ │ │ -
38 {
│ │ │ │ -
39 const char *sep = "<";
│ │ │ │ -
40 for(auto l : range(Simd::lanes(ins.value_)))
│ │ │ │ -
41 {
│ │ │ │ -
42 out << sep << autoCopy(Simd::lane(l, ins.value_));
│ │ │ │ -
43 sep = ", ";
│ │ │ │ -
44 }
│ │ │ │ -
45 out << '>';
│ │ │ │ -
46 return out;
│ │ │ │ -
47 }
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ +
5#ifndef DUNE_INDICESSYNCER_HH
│ │ │ │ +
6#define DUNE_INDICESSYNCER_HH
│ │ │ │ +
7
│ │ │ │ +
8#include "indexset.hh"
│ │ │ │ +
9#include "remoteindices.hh"
│ │ │ │ + │ │ │ │ +
11#include <dune/common/sllist.hh>
│ │ │ │ +
12#include <cassert>
│ │ │ │ +
13#include <cmath>
│ │ │ │ +
14#include <limits>
│ │ │ │ +
15#include <algorithm>
│ │ │ │ +
16#include <functional>
│ │ │ │ +
17#include <map>
│ │ │ │ +
18#include <tuple>
│ │ │ │ +
19
│ │ │ │ +
20#if HAVE_MPI
│ │ │ │ +
21namespace Dune
│ │ │ │ +
22{
│ │ │ │ +
39 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
41 {
│ │ │ │ +
42 public:
│ │ │ │ +
43
│ │ │ │ + │ │ │ │ +
46
│ │ │ │ + │ │ │ │ +
49
│ │ │ │ + │ │ │ │ +
52
│ │ │ │ +
54 typedef typename ParallelIndexSet::LocalIndex::Attribute Attribute;
│ │ │ │ +
55
│ │ │ │ + │ │ │ │ +
60
│ │ │ │ + │ │ │ │ +
71 RemoteIndices& remoteIndices);
│ │ │ │ +
72
│ │ │ │ +
82 void sync();
│ │ │ │ +
83
│ │ │ │ +
94 template<typename T1>
│ │ │ │ +
95 void sync(T1& numberer);
│ │ │ │ +
96
│ │ │ │ +
97 private:
│ │ │ │ +
98
│ │ │ │ +
100 ParallelIndexSet& indexSet_;
│ │ │ │ +
101
│ │ │ │ +
103 RemoteIndices& remoteIndices_;
│ │ │ │ +
104
│ │ │ │ +
106 char** sendBuffers_;
│ │ │ │ +
107
│ │ │ │ +
109 char* receiveBuffer_;
│ │ │ │ +
110
│ │ │ │ +
112 std::size_t* sendBufferSizes_;
│ │ │ │ +
113
│ │ │ │ +
115 int receiveBufferSize_; // int because of MPI
│ │ │ │ +
116
│ │ │ │ +
120 struct MessageInformation
│ │ │ │ +
121 {
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
123 : publish(), pairs()
│ │ │ │ +
124 {}
│ │ │ │
│ │ │ │ -
48 };
│ │ │ │ + │ │ │ │ +
131 int pairs;
│ │ │ │ +
132 };
│ │ │ │ +
133
│ │ │ │ +
137 class DefaultNumberer
│ │ │ │ +
138 {
│ │ │ │ +
139 public:
│ │ │ │ +
145 std::size_t operator()([[maybe_unused]] const GlobalIndex& global)
│ │ │ │ +
146 {
│ │ │ │ +
147 return std::numeric_limits<size_t>::max();
│ │ │ │ +
148 }
│ │ │ │ +
149 };
│ │ │ │ +
150
│ │ │ │ +
152 MPI_Datatype datatype_;
│ │ │ │ +
153
│ │ │ │ +
155 int rank_;
│ │ │ │ +
156
│ │ │ │ +
161 typedef SLList<std::pair<GlobalIndex,Attribute>, typename RemoteIndices::Allocator> GlobalIndexList;
│ │ │ │ +
162
│ │ │ │ +
164 typedef typename GlobalIndexList::ModifyIterator GlobalIndexModifier;
│ │ │ │ +
165
│ │ │ │ + │ │ │ │ +
170 GlobalIndexIterator;
│ │ │ │ +
171
│ │ │ │ +
173 typedef std::map<int, GlobalIndexList> GlobalIndicesMap;
│ │ │ │ +
174
│ │ │ │ +
183 GlobalIndicesMap globalMap_;
│ │ │ │ +
184
│ │ │ │ + │ │ │ │ +
189
│ │ │ │ +
193 typedef typename BoolList::iterator BoolIterator;
│ │ │ │ +
194
│ │ │ │ +
196 typedef typename BoolList::ModifyIterator BoolListModifier;
│ │ │ │ +
197
│ │ │ │ +
199 typedef std::map<int,BoolList> BoolMap;
│ │ │ │ +
200
│ │ │ │ +
205 BoolMap oldMap_;
│ │ │ │ +
206
│ │ │ │ +
208 std::map<int,MessageInformation> infoSend_;
│ │ │ │ +
209
│ │ │ │ +
211 typedef typename RemoteIndices::RemoteIndexList RemoteIndexList;
│ │ │ │ +
212
│ │ │ │ +
214 typedef typename RemoteIndexList::ModifyIterator RemoteIndexModifier;
│ │ │ │ +
215
│ │ │ │ + │ │ │ │ +
218
│ │ │ │ +
220 typedef typename RemoteIndexList::iterator RemoteIndexIterator;
│ │ │ │ +
221
│ │ │ │ +
223 typedef typename RemoteIndexList::const_iterator ConstRemoteIndexIterator;
│ │ │ │ +
224
│ │ │ │ +
226 typedef std::tuple<RemoteIndexModifier,GlobalIndexModifier,BoolListModifier,
│ │ │ │ +
227 const ConstRemoteIndexIterator> IteratorTuple;
│ │ │ │ +
228
│ │ │ │ +
236 class Iterators
│ │ │ │ +
237 {
│ │ │ │ +
238 friend class IndicesSyncer<T>;
│ │ │ │ +
239 public:
│ │ │ │ +
249 Iterators(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,
│ │ │ │ +
250 BoolList& booleans);
│ │ │ │ +
251
│ │ │ │ +
255 Iterators();
│ │ │ │ +
256
│ │ │ │ + │ │ │ │ +
261
│ │ │ │ +
267 void insert(const RemoteIndex& index,
│ │ │ │ +
268 const std::pair<GlobalIndex,Attribute>& global);
│ │ │ │ +
269
│ │ │ │ +
274 RemoteIndex& remoteIndex() const;
│ │ │ │ +
275
│ │ │ │ +
280 std::pair<GlobalIndex,Attribute>& globalIndexPair() const;
│ │ │ │ +
281
│ │ │ │ + │ │ │ │ +
283
│ │ │ │ +
289 bool isOld() const;
│ │ │ │ +
290
│ │ │ │ +
300 void reset(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,
│ │ │ │ +
301 BoolList& booleans);
│ │ │ │ +
302
│ │ │ │ +
308 bool isNotAtEnd() const;
│ │ │ │ +
309
│ │ │ │ +
315 bool isAtEnd() const;
│ │ │ │ +
316
│ │ │ │ +
317 private:
│ │ │ │ +
327 IteratorTuple iterators_;
│ │ │ │ +
328 };
│ │ │ │ +
329
│ │ │ │ +
331 typedef std::map<int,Iterators> IteratorsMap;
│ │ │ │ +
332
│ │ │ │ +
344 IteratorsMap iteratorsMap_;
│ │ │ │ +
345
│ │ │ │ +
347 void calculateMessageSizes();
│ │ │ │ +
348
│ │ │ │ +
356 void packAndSend(int destination, char* buffer, std::size_t bufferSize, MPI_Request& req);
│ │ │ │ +
357
│ │ │ │ +
362 template<typename T1>
│ │ │ │ +
363 void recvAndUnpack(T1& numberer);
│ │ │ │ +
364
│ │ │ │ +
368 void registerMessageDatatype();
│ │ │ │ +
369
│ │ │ │ +
373 void insertIntoRemoteIndexList(int process,
│ │ │ │ +
374 const std::pair<GlobalIndex,Attribute>& global,
│ │ │ │ +
375 char attribute);
│ │ │ │ +
376
│ │ │ │ +
380 void resetIteratorsMap();
│ │ │ │ +
381
│ │ │ │ +
386 bool checkReset();
│ │ │ │ +
387
│ │ │ │ +
396 bool checkReset(const Iterators& iterators, RemoteIndexList& rlist, GlobalIndexList& gList,
│ │ │ │ +
397 BoolList& bList);
│ │ │ │ +
398 };
│ │ │ │
│ │ │ │ -
49
│ │ │ │ -
50 template<class V, class = std::enable_if_t<Simd::lanes<V>() != 1> >
│ │ │ │ -
│ │ │ │ -
51 Inserter<V> io(const V &v)
│ │ │ │ -
52 {
│ │ │ │ -
53 return { v };
│ │ │ │ -
54 }
│ │ │ │ +
399
│ │ │ │ +
400 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
402 const std::pair<TG,TA>& i2)
│ │ │ │ +
403 {
│ │ │ │ +
404 return i1.global() < i2.first ||
│ │ │ │ +
405 (i1.global() == i2.first && i1.local().attribute()<i2.second);
│ │ │ │ +
406 }
│ │ │ │
│ │ │ │ -
55
│ │ │ │ -
56 template<class V, class = std::enable_if_t<Simd::lanes<V>() == 1> >
│ │ │ │ -
│ │ │ │ -
57 Simd::Scalar<V> io(const V &v)
│ │ │ │ -
58 {
│ │ │ │ -
59 return Simd::lane(0, v);
│ │ │ │ -
60 }
│ │ │ │ -
│ │ │ │ -
61
│ │ │ │ -
62 }
│ │ │ │ -
│ │ │ │ -
63
│ │ │ │ -
64 namespace Simd {
│ │ │ │ -
65
│ │ │ │ -
82
│ │ │ │ -
89 template<class V>
│ │ │ │ -
│ │ │ │ -
90 auto vio(const V &v)
│ │ │ │ -
91 {
│ │ │ │ -
92 return SimdImpl::Inserter<V>{ v };
│ │ │ │ -
93 }
│ │ │ │ +
407
│ │ │ │ +
408 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ +
409 bool operator<(const std::pair<TG,TA>& i1,
│ │ │ │ +
410 const IndexPair<TG,ParallelLocalIndex<TA> >& i2)
│ │ │ │ +
411 {
│ │ │ │ +
412 return i1.first < i2.global() ||
│ │ │ │ +
413 (i1.first == i2.global() && i1.second<i2.local().attribute());
│ │ │ │ +
414 }
│ │ │ │
│ │ │ │ -
94
│ │ │ │ -
96
│ │ │ │ -
105 template<class V>
│ │ │ │ -
│ │ │ │ -
106 auto io(const V &v)
│ │ │ │ -
107 {
│ │ │ │ -
108 return SimdImpl::io(v);
│ │ │ │ -
109 }
│ │ │ │ +
415
│ │ │ │ +
416 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
418 const std::pair<TG,TA>& i2)
│ │ │ │ +
419 {
│ │ │ │ +
420 return (i1.global() == i2.first && i1.local().attribute()==i2.second);
│ │ │ │ +
421 }
│ │ │ │
│ │ │ │ -
110
│ │ │ │ -
112
│ │ │ │ -
114
│ │ │ │ -
115 } // namespace Simd
│ │ │ │ -
116} // namespace Dune
│ │ │ │ -
117
│ │ │ │ -
118#endif // DUNE_COMMON_SIMD_IO_HH
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Utilities for reduction like operations on ranges.
│ │ │ │ -
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:300
│ │ │ │ -
constexpr AutonomousValue< T > autoCopy(T &&v)
Autonomous copy of an expression's value for use in auto type deduction.
Definition typetraits.hh:642
│ │ │ │ -
auto io(const V &v)
construct a stream inserter
Definition io.hh:106
│ │ │ │ -
auto vio(const V &v)
construct a stream inserter
Definition io.hh:90
│ │ │ │ -
constexpr std::size_t lanes()
Number of lanes in a SIMD type.
Definition simd/interface.hh:305
│ │ │ │ -
decltype(auto) lane(std::size_t l, V &&v)
Extract an element of a SIMD type.
Definition simd/interface.hh:324
│ │ │ │ -
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition simd/interface.hh:235
│ │ │ │ +
422
│ │ │ │ +
423 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
425 const std::pair<TG,TA>& i2)
│ │ │ │ +
426 {
│ │ │ │ +
427 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);
│ │ │ │ +
428 }
│ │ │ │ +
│ │ │ │ +
429
│ │ │ │ +
430 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ +
431 bool operator==(const std::pair<TG,TA>& i2,
│ │ │ │ +
432 const IndexPair<TG,ParallelLocalIndex<TA> >& i1)
│ │ │ │ +
433 {
│ │ │ │ +
434 return (i1.global() == i2.first && i1.local().attribute()==i2.second);
│ │ │ │ +
435 }
│ │ │ │ +
│ │ │ │ +
436
│ │ │ │ +
437 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ +
438 bool operator!=(const std::pair<TG,TA>& i2,
│ │ │ │ +
439 const IndexPair<TG,ParallelLocalIndex<TA> >& i1)
│ │ │ │ +
440 {
│ │ │ │ +
441 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);
│ │ │ │ +
442 }
│ │ │ │ +
│ │ │ │ +
443
│ │ │ │ +
460 template<typename T, typename A, typename A1>
│ │ │ │ +
│ │ │ │ +
461 void storeGlobalIndicesOfRemoteIndices(std::map<int,SLList<std::pair<typename T::GlobalIndex, typename T::LocalIndex::Attribute>,A> >& globalMap,
│ │ │ │ +
462 const RemoteIndices<T,A1>& remoteIndices)
│ │ │ │ +
463 {
│ │ │ │ +
464 for(auto remote = remoteIndices.begin(), end =remoteIndices.end(); remote != end; ++remote) {
│ │ │ │ +
465 typedef typename RemoteIndices<T,A1>::RemoteIndexList RemoteIndexList;
│ │ │ │ + │ │ │ │ +
467 GlobalIndexList& global = globalMap[remote->first];
│ │ │ │ +
468 RemoteIndexList& rList = *(remote->second.first);
│ │ │ │ +
469
│ │ │ │ +
470 for(auto index = rList.begin(), riEnd = rList.end();
│ │ │ │ +
471 index != riEnd; ++index) {
│ │ │ │ +
472 global.push_back(std::make_pair(index->localIndexPair().global(),
│ │ │ │ +
473 index->localIndexPair().local().attribute()));
│ │ │ │ +
474 }
│ │ │ │ +
475 }
│ │ │ │ +
476 }
│ │ │ │ +
│ │ │ │ +
477
│ │ │ │ +
486 template<typename T, typename A, typename A1>
│ │ │ │ +
│ │ │ │ +
487 inline void repairLocalIndexPointers(std::map<int,
│ │ │ │ +
488 SLList<std::pair<typename T::GlobalIndex,
│ │ │ │ +
489 typename T::LocalIndex::Attribute>,A> >& globalMap,
│ │ │ │ +
490 RemoteIndices<T,A1>& remoteIndices,
│ │ │ │ +
491 const T& indexSet)
│ │ │ │ +
492 {
│ │ │ │ +
493 assert(globalMap.size()==static_cast<std::size_t>(remoteIndices.neighbours()));
│ │ │ │ +
494 // Repair pointers to index set in remote indices.
│ │ │ │ +
495 auto global = globalMap.begin();
│ │ │ │ +
496 auto end = remoteIndices.remoteIndices_.end();
│ │ │ │ +
497
│ │ │ │ +
498 for(auto remote = remoteIndices.remoteIndices_.begin(); remote != end; ++remote, ++global) {
│ │ │ │ +
499 assert(remote->first==global->first);
│ │ │ │ +
500 assert(remote->second.first->size() == global->second.size());
│ │ │ │ +
501
│ │ │ │ +
502 auto riEnd = remote->second.first->end();
│ │ │ │ +
503 auto rIndex = remote->second.first->begin();
│ │ │ │ +
504 auto gIndex = global->second.begin();
│ │ │ │ +
505 auto index = indexSet.begin();
│ │ │ │ +
506
│ │ │ │ +
507 assert(rIndex==riEnd || gIndex != global->second.end());
│ │ │ │ +
508 while(rIndex != riEnd) {
│ │ │ │ +
509 // Search for the index in the set.
│ │ │ │ +
510 assert(gIndex != global->second.end());
│ │ │ │ +
511
│ │ │ │ +
512 while(!(index->global() == gIndex->first
│ │ │ │ +
513 && index->local().attribute() == gIndex->second)) {
│ │ │ │ +
514 ++index;
│ │ │ │ +
515 // this is only needed for ALU, where there may exist
│ │ │ │ +
516 // more entries with the same global index in the remote index set
│ │ │ │ +
517 // than in the index set
│ │ │ │ +
518 if (index->global() > gIndex->first) {
│ │ │ │ +
519 index=indexSet.begin();
│ │ │ │ +
520 }
│ │ │ │ +
521 }
│ │ │ │ +
522
│ │ │ │ +
523 assert(index != indexSet.end() && *index == *gIndex);
│ │ │ │ +
524
│ │ │ │ +
525 rIndex->localIndex_ = &(*index);
│ │ │ │ +
526 ++index;
│ │ │ │ +
527 ++rIndex;
│ │ │ │ +
528 ++gIndex;
│ │ │ │ +
529 }
│ │ │ │ +
530 }
│ │ │ │ +
531 remoteIndices.sourceSeqNo_ = remoteIndices.source_->seqNo();
│ │ │ │ +
532 remoteIndices.destSeqNo_ = remoteIndices.target_->seqNo();
│ │ │ │ +
533 }
│ │ │ │ +
│ │ │ │ +
534
│ │ │ │ +
535 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
537 RemoteIndices& remoteIndices)
│ │ │ │ +
538 : indexSet_(indexSet), remoteIndices_(remoteIndices)
│ │ │ │ +
539 {
│ │ │ │ +
540 // index sets must match.
│ │ │ │ +
541 assert(remoteIndices.source_ == remoteIndices.target_);
│ │ │ │ +
542 assert(remoteIndices.source_ == &indexSet);
│ │ │ │ +
543 MPI_Comm_rank(remoteIndices_.communicator(), &rank_);
│ │ │ │ +
544 }
│ │ │ │ +
│ │ │ │ +
545
│ │ │ │ +
546 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
548 GlobalIndexList& globalIndices,
│ │ │ │ +
549 BoolList& booleans)
│ │ │ │ +
550 : iterators_(remoteIndices.beginModify(), globalIndices.beginModify(),
│ │ │ │ +
551 booleans.beginModify(), remoteIndices.end())
│ │ │ │ +
552 { }
│ │ │ │ +
│ │ │ │ +
553
│ │ │ │ +
554 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
556 : iterators_()
│ │ │ │ +
557 {}
│ │ │ │ +
│ │ │ │ +
558
│ │ │ │ +
559 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
561 {
│ │ │ │ +
562 ++(std::get<0>(iterators_));
│ │ │ │ +
563 ++(std::get<1>(iterators_));
│ │ │ │ +
564 ++(std::get<2>(iterators_));
│ │ │ │ +
565 return *this;
│ │ │ │ +
566 }
│ │ │ │ +
│ │ │ │ +
567
│ │ │ │ +
568 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
570 const std::pair<GlobalIndex,Attribute>& global)
│ │ │ │ +
571 {
│ │ │ │ +
572 std::get<0>(iterators_).insert(index);
│ │ │ │ +
573 std::get<1>(iterators_).insert(global);
│ │ │ │ +
574 std::get<2>(iterators_).insert(false);
│ │ │ │ +
575 }
│ │ │ │ +
│ │ │ │ +
576
│ │ │ │ +
577 template<typename T>
│ │ │ │ +
578 inline typename IndicesSyncer<T>::RemoteIndex&
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
580 {
│ │ │ │ +
581 return *(std::get<0>(iterators_));
│ │ │ │ +
582 }
│ │ │ │ +
│ │ │ │ +
583
│ │ │ │ +
584 template<typename T>
│ │ │ │ +
585 inline std::pair<typename IndicesSyncer<T>::GlobalIndex,typename IndicesSyncer<T>::Attribute>&
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
587 {
│ │ │ │ +
588 return *(std::get<1>(iterators_));
│ │ │ │ +
589 }
│ │ │ │ +
│ │ │ │ +
590
│ │ │ │ +
591 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
593 {
│ │ │ │ +
594 return *(std::get<2>(iterators_));
│ │ │ │ +
595 }
│ │ │ │ +
│ │ │ │ +
596
│ │ │ │ +
597 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
599 GlobalIndexList& globalIndices,
│ │ │ │ +
600 BoolList& booleans)
│ │ │ │ +
601 {
│ │ │ │ +
602 std::get<0>(iterators_) = remoteIndices.beginModify();
│ │ │ │ +
603 std::get<1>(iterators_) = globalIndices.beginModify();
│ │ │ │ +
604 std::get<2>(iterators_) = booleans.beginModify();
│ │ │ │ +
605 }
│ │ │ │ +
│ │ │ │ +
606
│ │ │ │ +
607 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
609 {
│ │ │ │ +
610 return std::get<0>(iterators_) != std::get<3>(iterators_);
│ │ │ │ +
611 }
│ │ │ │ +
│ │ │ │ +
612
│ │ │ │ +
613 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
615 {
│ │ │ │ +
616 return std::get<0>(iterators_) == std::get<3>(iterators_);
│ │ │ │ +
617 }
│ │ │ │ +
│ │ │ │ +
618
│ │ │ │ +
619 template<typename T>
│ │ │ │ + │ │ │ │ +
621 {
│ │ │ │ +
622 MPI_Datatype type[2] = {MPI_INT, MPI_INT};
│ │ │ │ +
623 int blocklength[2] = {1,1};
│ │ │ │ +
624 MPI_Aint displacement[2];
│ │ │ │ +
625 MPI_Aint base;
│ │ │ │ +
626
│ │ │ │ +
627 // Compute displacement
│ │ │ │ +
628 MessageInformation message;
│ │ │ │ +
629
│ │ │ │ +
630 MPI_Get_address( &(message.publish), displacement);
│ │ │ │ +
631 MPI_Get_address( &(message.pairs), displacement+1);
│ │ │ │ +
632
│ │ │ │ +
633 // Make the displacement relative
│ │ │ │ +
634 MPI_Get_address(&message, &base);
│ │ │ │ +
635 displacement[0] -= base;
│ │ │ │ +
636 displacement[1] -= base;
│ │ │ │ +
637
│ │ │ │ +
638 MPI_Type_create_struct( 2, blocklength, displacement, type, &datatype_);
│ │ │ │ +
639 MPI_Type_commit(&datatype_);
│ │ │ │ +
640 }
│ │ │ │ +
641
│ │ │ │ +
642 template<typename T>
│ │ │ │ +
643 void IndicesSyncer<T>::calculateMessageSizes()
│ │ │ │ +
644 {
│ │ │ │ +
645 auto iEnd = indexSet_.end();
│ │ │ │ +
646 auto collIter = remoteIndices_.template iterator<true>();
│ │ │ │ +
647
│ │ │ │ +
648 for(auto index = indexSet_.begin(); index != iEnd; ++index) {
│ │ │ │ +
649 collIter.advance(index->global(), index->local().attribute());
│ │ │ │ +
650 if(collIter.empty())
│ │ │ │ +
651 break;
│ │ │ │ +
652 int knownRemote=0;
│ │ │ │ +
653 auto end = collIter.end();
│ │ │ │ +
654
│ │ │ │ +
655 // Count the remote indices we know.
│ │ │ │ +
656 for(auto valid = collIter.begin(); valid != end; ++valid) {
│ │ │ │ +
657 ++knownRemote;
│ │ │ │ +
658 }
│ │ │ │ +
659
│ │ │ │ +
660 if(knownRemote>0) {
│ │ │ │ +
661 Dune::dverb<<rank_<<": publishing "<<knownRemote<<" for index "<<index->global()<< " for processes ";
│ │ │ │ +
662
│ │ │ │ +
663 // Update MessageInformation
│ │ │ │ +
664 for(auto valid = collIter.begin(); valid != end; ++valid) {
│ │ │ │ +
665 ++(infoSend_[valid.process()].publish);
│ │ │ │ +
666 (infoSend_[valid.process()].pairs) += knownRemote;
│ │ │ │ +
667 Dune::dverb<<valid.process()<<" ";
│ │ │ │ +
668 Dune::dverb<<"(publish="<<infoSend_[valid.process()].publish<<", pairs="<<infoSend_[valid.process()].pairs
│ │ │ │ +
669 <<") ";
│ │ │ │ +
670 }
│ │ │ │ +
671 Dune::dverb<<std::endl;
│ │ │ │ +
672 }
│ │ │ │ +
673 }
│ │ │ │ +
674
│ │ │ │ +
675 const auto end = infoSend_.end();
│ │ │ │ +
676
│ │ │ │ +
677 // Now determine the buffersizes needed for each neighbour using MPI_Pack_size
│ │ │ │ +
678 MessageInformation dummy;
│ │ │ │ +
679
│ │ │ │ +
680 auto messageIter= infoSend_.begin();
│ │ │ │ +
681 const auto rend = remoteIndices_.end();
│ │ │ │ +
682 int neighbour=0;
│ │ │ │ +
683
│ │ │ │ +
684 for(auto remote = remoteIndices_.begin(); remote != rend; ++remote, ++neighbour) {
│ │ │ │ +
685 MessageInformation* message;
│ │ │ │ +
686 MessageInformation recv;
│ │ │ │ +
687
│ │ │ │ +
688 if(messageIter != end && messageIter->first==remote->first) {
│ │ │ │ +
689 // We want to send message information to that process
│ │ │ │ +
690 message = const_cast<MessageInformation*>(&(messageIter->second));
│ │ │ │ +
691 ++messageIter;
│ │ │ │ +
692 }else
│ │ │ │ +
693 // We do not want to send information but the other process might.
│ │ │ │ +
694 message = &dummy;
│ │ │ │ +
695
│ │ │ │ +
696 sendBufferSizes_[neighbour]=0;
│ │ │ │ +
697 int tsize;
│ │ │ │ +
698 // The number of indices published
│ │ │ │ +
699 MPI_Pack_size(1, MPI_INT,remoteIndices_.communicator(), &tsize);
│ │ │ │ +
700 sendBufferSizes_[neighbour] += tsize;
│ │ │ │ +
701
│ │ │ │ +
702 for(int i=0; i < message->publish; ++i) {
│ │ │ │ +
703 // The global index
│ │ │ │ +
704 MPI_Pack_size(1, MPITraits<GlobalIndex>::getType(), remoteIndices_.communicator(), &tsize);
│ │ │ │ +
705 sendBufferSizes_[neighbour] += tsize;
│ │ │ │ +
706 // The attribute in the local index
│ │ │ │ +
707 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);
│ │ │ │ +
708 sendBufferSizes_[neighbour] += tsize;
│ │ │ │ +
709 // The number of corresponding remote indices
│ │ │ │ +
710 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);
│ │ │ │ +
711 sendBufferSizes_[neighbour] += tsize;
│ │ │ │ +
712 }
│ │ │ │ +
713 for(int i=0; i < message->pairs; ++i) {
│ │ │ │ +
714 // The process of the remote index
│ │ │ │ +
715 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);
│ │ │ │ +
716 sendBufferSizes_[neighbour] += tsize;
│ │ │ │ +
717 // The attribute of the remote index
│ │ │ │ +
718 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);
│ │ │ │ +
719 sendBufferSizes_[neighbour] += tsize;
│ │ │ │ +
720 }
│ │ │ │ +
721
│ │ │ │ +
722 Dune::dverb<<rank_<<": Buffer (neighbour="<<remote->first<<") size is "<< sendBufferSizes_[neighbour]<<" for publish="<<message->publish<<" pairs="<<message->pairs<<std::endl;
│ │ │ │ +
723 }
│ │ │ │ +
724
│ │ │ │ +
725 }
│ │ │ │ +
726
│ │ │ │ +
727 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
729 {
│ │ │ │ +
730 DefaultNumberer numberer;
│ │ │ │ +
731 sync(numberer);
│ │ │ │ +
732 }
│ │ │ │ +
│ │ │ │ +
733
│ │ │ │ +
734 template<typename T>
│ │ │ │ +
735 template<typename T1>
│ │ │ │ +
│ │ │ │ +
736 void IndicesSyncer<T>::sync(T1& numberer)
│ │ │ │ +
737 {
│ │ │ │ +
738 // The pointers to the local indices in the remote indices
│ │ │ │ +
739 // will become invalid due to the resorting of the index set.
│ │ │ │ +
740 // Therefore store the corresponding global indices.
│ │ │ │ +
741 // Mark all indices as not added
│ │ │ │ +
742 const auto end = remoteIndices_.end();
│ │ │ │ +
743
│ │ │ │ +
744 // Number of neighbours might change during the syncing.
│ │ │ │ +
745 // save the old neighbours
│ │ │ │ +
746 std::size_t noOldNeighbours = remoteIndices_.neighbours();
│ │ │ │ +
747 int* oldNeighbours = new int[noOldNeighbours];
│ │ │ │ +
748 sendBufferSizes_ = new std::size_t[noOldNeighbours];
│ │ │ │ +
749 std::size_t neighbourI = 0;
│ │ │ │ +
750
│ │ │ │ +
751 for(auto remote = remoteIndices_.begin(); remote != end; ++remote, ++neighbourI) {
│ │ │ │ +
752 oldNeighbours[neighbourI] = remote->first;
│ │ │ │ +
753
│ │ │ │ +
754 // Make sure we only have one remote index list.
│ │ │ │ +
755 assert(remote->second.first==remote->second.second);
│ │ │ │ +
756
│ │ │ │ +
757 RemoteIndexList& rList = *(remote->second.first);
│ │ │ │ +
758
│ │ │ │ +
759 // Store the corresponding global indices.
│ │ │ │ +
760 GlobalIndexList& global = globalMap_[remote->first];
│ │ │ │ +
761 BoolList& added = oldMap_[remote->first];
│ │ │ │ +
762 auto riEnd = rList.end();
│ │ │ │ +
763
│ │ │ │ +
764 for(auto index = rList.begin();
│ │ │ │ +
765 index != riEnd; ++index) {
│ │ │ │ +
766 global.push_back(std::make_pair(index->localIndexPair().global(),
│ │ │ │ +
767 index->localIndexPair().local().attribute()));
│ │ │ │ +
768 added.push_back(true);
│ │ │ │ +
769 }
│ │ │ │ +
770
│ │ │ │ +
771 Iterators iterators(rList, global, added);
│ │ │ │ +
772 iteratorsMap_.insert(std::make_pair(remote->first, iterators));
│ │ │ │ +
773 assert(checkReset(iteratorsMap_[remote->first], rList,global,added));
│ │ │ │ +
774 }
│ │ │ │ +
775
│ │ │ │ +
776 // Exchange indices with each neighbour
│ │ │ │ +
777 calculateMessageSizes();
│ │ │ │ +
778
│ │ │ │ +
779 // Allocate the buffers
│ │ │ │ +
780 receiveBufferSize_=1;
│ │ │ │ +
781 sendBuffers_ = new char*[noOldNeighbours];
│ │ │ │ +
782
│ │ │ │ +
783 for(std::size_t i=0; i<noOldNeighbours; ++i) {
│ │ │ │ +
784 sendBuffers_[i] = new char[sendBufferSizes_[i]];
│ │ │ │ +
785 receiveBufferSize_ = std::max(receiveBufferSize_, static_cast<int>(sendBufferSizes_[i]));
│ │ │ │ +
786 }
│ │ │ │ +
787
│ │ │ │ +
788 receiveBuffer_=new char[receiveBufferSize_];
│ │ │ │ +
789
│ │ │ │ +
790 indexSet_.beginResize();
│ │ │ │ +
791
│ │ │ │ +
792 Dune::dverb<<rank_<<": Neighbours: ";
│ │ │ │ +
793
│ │ │ │ +
794 for(std::size_t i = 0; i<noOldNeighbours; ++i)
│ │ │ │ +
795 Dune::dverb<<oldNeighbours[i]<<" ";
│ │ │ │ +
796
│ │ │ │ +
797 Dune::dverb<<std::endl;
│ │ │ │ +
798
│ │ │ │ +
799 MPI_Request* requests = new MPI_Request[noOldNeighbours];
│ │ │ │ +
800 MPI_Status* statuses = new MPI_Status[noOldNeighbours];
│ │ │ │ +
801
│ │ │ │ +
802 // Pack Message data and start the sends
│ │ │ │ +
803 for(std::size_t i = 0; i<noOldNeighbours; ++i)
│ │ │ │ +
804 packAndSend(oldNeighbours[i], sendBuffers_[i], sendBufferSizes_[i], requests[i]);
│ │ │ │ +
805
│ │ │ │ +
806 // Probe for incoming messages, receive and unpack them
│ │ │ │ +
807 for(std::size_t i = 0; i<noOldNeighbours; ++i)
│ │ │ │ +
808 recvAndUnpack(numberer);
│ │ │ │ +
809 // }else{
│ │ │ │ +
810 // recvAndUnpack(oldNeighbours[i], numberer);
│ │ │ │ +
811 // packAndSend(oldNeighbours[i]);
│ │ │ │ +
812 // }
│ │ │ │ +
813 // }
│ │ │ │ +
814
│ │ │ │ +
815 delete[] receiveBuffer_;
│ │ │ │ +
816
│ │ │ │ +
817 // Wait for the completion of the sends
│ │ │ │ +
818 // Wait for completion of sends
│ │ │ │ +
819 if(MPI_SUCCESS!=MPI_Waitall(noOldNeighbours, requests, statuses)) {
│ │ │ │ +
820 std::cerr<<": MPI_Error occurred while sending message"<<std::endl;
│ │ │ │ +
821 for(std::size_t i=0; i< noOldNeighbours; i++)
│ │ │ │ +
822 if(MPI_SUCCESS!=statuses[i].MPI_ERROR)
│ │ │ │ +
823 std::cerr<<"Destination "<<statuses[i].MPI_SOURCE<<" error code: "<<statuses[i].MPI_ERROR<<std::endl;
│ │ │ │ +
824 }
│ │ │ │ +
825
│ │ │ │ +
826 delete[] statuses;
│ │ │ │ +
827 delete[] requests;
│ │ │ │ +
828
│ │ │ │ +
829 for(std::size_t i=0; i<noOldNeighbours; ++i)
│ │ │ │ +
830 delete[] sendBuffers_[i];
│ │ │ │ +
831
│ │ │ │ +
832 delete[] sendBuffers_;
│ │ │ │ +
833 delete[] sendBufferSizes_;
│ │ │ │ +
834
│ │ │ │ +
835 // No need for the iterator tuples any more
│ │ │ │ +
836 iteratorsMap_.clear();
│ │ │ │ +
837
│ │ │ │ +
838 indexSet_.endResize();
│ │ │ │ +
839
│ │ │ │ +
840 delete[] oldNeighbours;
│ │ │ │ +
841
│ │ │ │ +
842 repairLocalIndexPointers(globalMap_, remoteIndices_, indexSet_);
│ │ │ │ +
843
│ │ │ │ +
844 oldMap_.clear();
│ │ │ │ +
845 globalMap_.clear();
│ │ │ │ +
846
│ │ │ │ +
847 // update the sequence number
│ │ │ │ +
848 remoteIndices_.sourceSeqNo_ = remoteIndices_.destSeqNo_ = indexSet_.seqNo();
│ │ │ │ +
849 }
│ │ │ │ +
│ │ │ │ +
850
│ │ │ │ +
851 template<typename T>
│ │ │ │ +
852 void IndicesSyncer<T>::packAndSend(int destination, char* buffer, std::size_t bufferSize, MPI_Request& request)
│ │ │ │ +
853 {
│ │ │ │ +
854 auto iEnd = indexSet_.end();
│ │ │ │ +
855 int bpos = 0;
│ │ │ │ +
856 int published = 0;
│ │ │ │ +
857 int pairs = 0;
│ │ │ │ +
858
│ │ │ │ +
859 assert(checkReset());
│ │ │ │ +
860
│ │ │ │ +
861 // Pack the number of indices we publish
│ │ │ │ +
862 MPI_Pack(&(infoSend_[destination].publish), 1, MPI_INT, buffer, bufferSize, &bpos,
│ │ │ │ +
863 remoteIndices_.communicator());
│ │ │ │ +
864
│ │ │ │ +
865 for(auto index = indexSet_.begin(); index != iEnd; ++index) {
│ │ │ │ +
866 // Search for corresponding remote indices in all iterator tuples
│ │ │ │ +
867 auto iteratorsEnd = iteratorsMap_.end();
│ │ │ │ +
868
│ │ │ │ +
869 // advance all iterators to a position with global index >= index->global()
│ │ │ │ +
870 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators) {
│ │ │ │ +
871 while(iterators->second.isNotAtEnd() &&
│ │ │ │ +
872 iterators->second.globalIndexPair().first < index->global())
│ │ │ │ +
873 ++(iterators->second);
│ │ │ │ +
874 assert(!iterators->second.isNotAtEnd() || iterators->second.globalIndexPair().first >= index->global());
│ │ │ │ +
875 }
│ │ │ │ +
876
│ │ │ │ +
877 // Add all remote indices positioned at global which were already present before calling sync
│ │ │ │ +
878 // to the message.
│ │ │ │ +
879 // Count how many remote indices we will send
│ │ │ │ +
880 int indices = 0;
│ │ │ │ +
881 bool knownRemote = false; // Is the remote process supposed to know this index?
│ │ │ │ +
882
│ │ │ │ +
883 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators)
│ │ │ │ +
884 {
│ │ │ │ +
885 std::pair<GlobalIndex,Attribute> p;
│ │ │ │ +
886 if (iterators->second.isNotAtEnd())
│ │ │ │ +
887 {
│ │ │ │ +
888 p = iterators->second.globalIndexPair();
│ │ │ │ +
889 }
│ │ │ │ +
890
│ │ │ │ +
891 if(iterators->second.isNotAtEnd() && iterators->second.isOld()
│ │ │ │ +
892 && iterators->second.globalIndexPair().first == index->global()) {
│ │ │ │ +
893 indices++;
│ │ │ │ +
894 if(destination == iterators->first)
│ │ │ │ +
895 knownRemote = true;
│ │ │ │ +
896 }
│ │ │ │ +
897 }
│ │ │ │ +
898
│ │ │ │ +
899 if(!knownRemote)
│ │ │ │ +
900 // We do not need to send any indices
│ │ │ │ +
901 continue;
│ │ │ │ +
902
│ │ │ │ +
903 Dune::dverb<<rank_<<": sending "<<indices<<" for index "<<index->global()<<" to "<<destination<<std::endl;
│ │ │ │ +
904
│ │ │ │ +
905
│ │ │ │ +
906 // Pack the global index, the attribute and the number
│ │ │ │ +
907 MPI_Pack(const_cast<GlobalIndex*>(&(index->global())), 1, MPITraits<GlobalIndex>::getType(), buffer, bufferSize, &bpos,
│ │ │ │ +
908 remoteIndices_.communicator());
│ │ │ │ +
909
│ │ │ │ +
910 char attr = index->local().attribute();
│ │ │ │ +
911 MPI_Pack(&attr, 1, MPI_CHAR, buffer, bufferSize, &bpos,
│ │ │ │ +
912 remoteIndices_.communicator());
│ │ │ │ +
913
│ │ │ │ +
914 // Pack the number of remote indices we send.
│ │ │ │ +
915 MPI_Pack(&indices, 1, MPI_INT, buffer, bufferSize, &bpos,
│ │ │ │ +
916 remoteIndices_.communicator());
│ │ │ │ +
917
│ │ │ │ +
918 // Pack the information about the remote indices
│ │ │ │ +
919 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators)
│ │ │ │ +
920 if(iterators->second.isNotAtEnd() && iterators->second.isOld()
│ │ │ │ +
921 && iterators->second.globalIndexPair().first == index->global()) {
│ │ │ │ +
922 int process = iterators->first;
│ │ │ │ +
923
│ │ │ │ +
924 ++pairs;
│ │ │ │ +
925 assert(pairs <= infoSend_[destination].pairs);
│ │ │ │ +
926 MPI_Pack(&process, 1, MPI_INT, buffer, bufferSize, &bpos,
│ │ │ │ +
927 remoteIndices_.communicator());
│ │ │ │ +
928 char attr2 = iterators->second.remoteIndex().attribute();
│ │ │ │ +
929
│ │ │ │ +
930 MPI_Pack(&attr2, 1, MPI_CHAR, buffer, bufferSize, &bpos,
│ │ │ │ +
931 remoteIndices_.communicator());
│ │ │ │ +
932 --indices;
│ │ │ │ +
933 }
│ │ │ │ +
934 assert(indices==0);
│ │ │ │ +
935 ++published;
│ │ │ │ +
936 Dune::dvverb<<" (publish="<<published<<", pairs="<<pairs<<")"<<std::endl;
│ │ │ │ +
937 assert(published <= infoSend_[destination].publish);
│ │ │ │ +
938 }
│ │ │ │ +
939
│ │ │ │ +
940 // Make sure we send all expected entries
│ │ │ │ +
941 assert(published == infoSend_[destination].publish);
│ │ │ │ +
942 assert(pairs == infoSend_[destination].pairs);
│ │ │ │ +
943 resetIteratorsMap();
│ │ │ │ +
944
│ │ │ │ +
945 Dune::dverb << rank_<<": Sending message of "<<bpos<<" bytes to "<<destination<<std::endl;
│ │ │ │ +
946
│ │ │ │ +
947 MPI_Issend(buffer, bpos, MPI_PACKED, destination, 345, remoteIndices_.communicator(),&request);
│ │ │ │ +
948 }
│ │ │ │ +
949
│ │ │ │ +
950 template<typename T>
│ │ │ │ +
951 inline void IndicesSyncer<T>::insertIntoRemoteIndexList(int process,
│ │ │ │ +
952 const std::pair<GlobalIndex,Attribute>& globalPair,
│ │ │ │ +
953 char attribute)
│ │ │ │ +
954 {
│ │ │ │ +
955 Dune::dverb<<"Inserting from "<<process<<" "<<globalPair.first<<", "<<
│ │ │ │ +
956 globalPair.second<<" "<<attribute<<std::endl;
│ │ │ │ +
957
│ │ │ │ +
958 resetIteratorsMap();
│ │ │ │ +
959
│ │ │ │ +
960 // There might be cases where there no remote indices for that process yet
│ │ │ │ +
961 typename IteratorsMap::iterator found = iteratorsMap_.find(process);
│ │ │ │ +
962
│ │ │ │ +
963 if( found == iteratorsMap_.end() ) {
│ │ │ │ +
964 Dune::dverb<<"Discovered new neighbour "<<process<<std::endl;
│ │ │ │ +
965 RemoteIndexList* rlist = new RemoteIndexList();
│ │ │ │ +
966 remoteIndices_.remoteIndices_.insert(std::make_pair(process,std::make_pair(rlist,rlist)));
│ │ │ │ +
967 Iterators iterators = Iterators(*rlist, globalMap_[process], oldMap_[process]);
│ │ │ │ +
968 found = iteratorsMap_.insert(std::make_pair(process, iterators)).first;
│ │ │ │ +
969 }
│ │ │ │ +
970
│ │ │ │ +
971 Iterators& iterators = found->second;
│ │ │ │ +
972
│ │ │ │ +
973 // Search for the remote index
│ │ │ │ +
974 while(iterators.isNotAtEnd() && iterators.globalIndexPair() < globalPair) {
│ │ │ │ +
975 // Increment all iterators
│ │ │ │ +
976 ++iterators;
│ │ │ │ +
977
│ │ │ │ +
978 }
│ │ │ │ +
979
│ │ │ │ +
980 if(iterators.isAtEnd() || iterators.globalIndexPair() != globalPair) {
│ │ │ │ +
981 // The entry is not yet known
│ │ │ │ +
982 // Insert in the list and do not change the first iterator.
│ │ │ │ +
983 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);
│ │ │ │ +
984 return;
│ │ │ │ +
985 }
│ │ │ │ +
986
│ │ │ │ +
987 // Global indices match
│ │ │ │ +
988 bool indexIsThere=false;
│ │ │ │ +
989 for(Iterators tmpIterators = iterators;
│ │ │ │ +
990 !tmpIterators.isAtEnd() && tmpIterators.globalIndexPair() == globalPair;
│ │ │ │ +
991 ++tmpIterators)
│ │ │ │ +
992 //entry already exists with the same attribute
│ │ │ │ +
993 if(tmpIterators.globalIndexPair().second == attribute) {
│ │ │ │ +
994 indexIsThere=true;
│ │ │ │ +
995 break;
│ │ │ │ +
996 }
│ │ │ │ +
997
│ │ │ │ +
998 if(!indexIsThere)
│ │ │ │ +
999 // The entry is not yet known
│ │ │ │ +
1000 // Insert in the list and do not change the first iterator.
│ │ │ │ +
1001 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);
│ │ │ │ +
1002 }
│ │ │ │ +
1003
│ │ │ │ +
1004 template<typename T>
│ │ │ │ +
1005 template<typename T1>
│ │ │ │ +
1006 void IndicesSyncer<T>::recvAndUnpack(T1& numberer)
│ │ │ │ +
1007 {
│ │ │ │ +
1008 const ParallelIndexSet& constIndexSet = indexSet_;
│ │ │ │ +
1009 auto iEnd = constIndexSet.end();
│ │ │ │ +
1010 auto index = constIndexSet.begin();
│ │ │ │ +
1011 int bpos = 0;
│ │ │ │ +
1012 int publish;
│ │ │ │ +
1013
│ │ │ │ +
1014 assert(checkReset());
│ │ │ │ +
1015
│ │ │ │ +
1016 MPI_Status status;
│ │ │ │ +
1017
│ │ │ │ +
1018 // We have to determine the message size and source before the receive
│ │ │ │ +
1019 MPI_Probe(MPI_ANY_SOURCE, 345, remoteIndices_.communicator(), &status);
│ │ │ │ +
1020
│ │ │ │ +
1021 int source=status.MPI_SOURCE;
│ │ │ │ +
1022 int count;
│ │ │ │ +
1023 MPI_Get_count(&status, MPI_PACKED, &count);
│ │ │ │ +
1024
│ │ │ │ +
1025 Dune::dvverb<<rank_<<": Receiving message from "<< source<<" with "<<count<<" bytes"<<std::endl;
│ │ │ │ +
1026
│ │ │ │ +
1027 if(count>receiveBufferSize_) {
│ │ │ │ +
1028 receiveBufferSize_=count;
│ │ │ │ +
1029 delete[] receiveBuffer_;
│ │ │ │ +
1030 receiveBuffer_ = new char[receiveBufferSize_];
│ │ │ │ +
1031 }
│ │ │ │ +
1032
│ │ │ │ +
1033 MPI_Recv(receiveBuffer_, count, MPI_PACKED, source, 345, remoteIndices_.communicator(), &status);
│ │ │ │ +
1034
│ │ │ │ +
1035 // How many global entries were published?
│ │ │ │ +
1036 MPI_Unpack(receiveBuffer_, count, &bpos, &publish, 1, MPI_INT, remoteIndices_.communicator());
│ │ │ │ +
1037
│ │ │ │ +
1038 // Now unpack the remote indices and add them.
│ │ │ │ +
1039 while(publish>0) {
│ │ │ │ +
1040
│ │ │ │ +
1041 // Unpack information about the local index on the source process
│ │ │ │ +
1042 GlobalIndex global; // global index of the current entry
│ │ │ │ +
1043 char sourceAttribute; // Attribute on the source process
│ │ │ │ +
1044 int pairs;
│ │ │ │ +
1045
│ │ │ │ +
1046 MPI_Unpack(receiveBuffer_, count, &bpos, &global, 1, MPITraits<GlobalIndex>::getType(),
│ │ │ │ +
1047 remoteIndices_.communicator());
│ │ │ │ +
1048 MPI_Unpack(receiveBuffer_, count, &bpos, &sourceAttribute, 1, MPI_CHAR,
│ │ │ │ +
1049 remoteIndices_.communicator());
│ │ │ │ +
1050 MPI_Unpack(receiveBuffer_, count, &bpos, &pairs, 1, MPI_INT,
│ │ │ │ +
1051 remoteIndices_.communicator());
│ │ │ │ +
1052
│ │ │ │ +
1053 // Insert the entry on the remote process to our
│ │ │ │ +
1054 // remote index list
│ │ │ │ +
1055 SLList<std::pair<int,Attribute> > sourceAttributeList;
│ │ │ │ +
1056 sourceAttributeList.push_back(std::make_pair(source,Attribute(sourceAttribute)));
│ │ │ │ +
1057#ifndef NDEBUG
│ │ │ │ +
1058 bool foundSelf = false;
│ │ │ │ +
1059#endif
│ │ │ │ +
1060 Attribute myAttribute=Attribute();
│ │ │ │ +
1061
│ │ │ │ +
1062 // Unpack the remote indices
│ │ │ │ +
1063 for(; pairs>0; --pairs) {
│ │ │ │ +
1064 // Unpack the process id that knows the index
│ │ │ │ +
1065 int process;
│ │ │ │ +
1066 char attribute;
│ │ │ │ +
1067 MPI_Unpack(receiveBuffer_, count, &bpos, &process, 1, MPI_INT,
│ │ │ │ +
1068 remoteIndices_.communicator());
│ │ │ │ +
1069 // Unpack the attribute
│ │ │ │ +
1070 MPI_Unpack(receiveBuffer_, count, &bpos, &attribute, 1, MPI_CHAR,
│ │ │ │ +
1071 remoteIndices_.communicator());
│ │ │ │ +
1072
│ │ │ │ +
1073 if(process==rank_) {
│ │ │ │ +
1074#ifndef NDEBUG
│ │ │ │ +
1075 foundSelf=true;
│ │ │ │ +
1076#endif
│ │ │ │ +
1077 myAttribute=Attribute(attribute);
│ │ │ │ +
1078 // Now we know the local attribute of the global index
│ │ │ │ +
1079 //Only add the index if it is unknown.
│ │ │ │ +
1080 // Do we know that global index already?
│ │ │ │ +
1081 auto pos = std::lower_bound(index, iEnd, IndexPair(global));
│ │ │ │ +
1082
│ │ │ │ +
1083 if(pos == iEnd || pos->global() != global) {
│ │ │ │ +
1084 // no entry with this global index
│ │ │ │ +
1085 indexSet_.add(global,
│ │ │ │ +
1086 ParallelLocalIndex<Attribute>(numberer(global),
│ │ │ │ +
1087 myAttribute, true));
│ │ │ │ +
1088 Dune::dvverb << "Adding "<<global<<" "<<myAttribute<<std::endl;
│ │ │ │ +
1089 continue;
│ │ │ │ +
1090 }
│ │ │ │ +
1091
│ │ │ │ +
1092 // because of above the global indices match. Add only if the attribute is different
│ │ │ │ +
1093 bool indexIsThere = false;
│ │ │ │ +
1094 index=pos;
│ │ │ │ +
1095
│ │ │ │ +
1096 for(; pos->global()==global; ++pos)
│ │ │ │ +
1097 if(pos->local().attribute() == myAttribute) {
│ │ │ │ +
1098 Dune::dvverb<<"found "<<global<<" "<<myAttribute<<std::endl;
│ │ │ │ +
1099 indexIsThere = true;
│ │ │ │ +
1100 break;
│ │ │ │ +
1101 }
│ │ │ │ +
1102
│ │ │ │ +
1103 if(!indexIsThere) {
│ │ │ │ +
1104 indexSet_.add(global,
│ │ │ │ +
1105 ParallelLocalIndex<Attribute>(numberer(global),
│ │ │ │ +
1106 myAttribute, true));
│ │ │ │ +
1107 Dune::dvverb << "Adding "<<global<<" "<<myAttribute<<std::endl;
│ │ │ │ +
1108 }
│ │ │ │ +
1109
│ │ │ │ +
1110 }else{
│ │ │ │ +
1111 sourceAttributeList.push_back(std::make_pair(process,Attribute(attribute)));
│ │ │ │ +
1112 }
│ │ │ │ +
1113 }
│ │ │ │ +
1114 assert(foundSelf);
│ │ │ │ +
1115 // Insert remote indices
│ │ │ │ +
1116 typedef typename SLList<std::pair<int,Attribute> >::const_iterator Iter;
│ │ │ │ +
1117 for(Iter i=sourceAttributeList.begin(), end=sourceAttributeList.end();
│ │ │ │ +
1118 i!=end; ++i)
│ │ │ │ +
1119 insertIntoRemoteIndexList(i->first, std::make_pair(global, myAttribute),
│ │ │ │ +
1120 i->second);
│ │ │ │ +
1121 --publish;
│ │ │ │ +
1122 }
│ │ │ │ +
1123
│ │ │ │ +
1124 resetIteratorsMap();
│ │ │ │ +
1125 }
│ │ │ │ +
1126
│ │ │ │ +
1127 template<typename T>
│ │ │ │ +
1128 void IndicesSyncer<T>::resetIteratorsMap(){
│ │ │ │ +
1129
│ │ │ │ +
1130 // Reset iterators in all tuples.
│ │ │ │ +
1131 const auto remoteEnd = remoteIndices_.remoteIndices_.end();
│ │ │ │ +
1132 auto iterators = iteratorsMap_.begin();
│ │ │ │ +
1133 auto global = globalMap_.begin();
│ │ │ │ +
1134 auto added = oldMap_.begin();
│ │ │ │ +
1135
│ │ │ │ +
1136 for(auto remote = remoteIndices_.remoteIndices_.begin();
│ │ │ │ +
1137 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {
│ │ │ │ +
1138 iterators->second.reset(*(remote->second.first), global->second, added->second);
│ │ │ │ +
1139 }
│ │ │ │ +
1140 }
│ │ │ │ +
1141
│ │ │ │ +
1142 template<typename T>
│ │ │ │ +
1143 bool IndicesSyncer<T>::checkReset(const Iterators& iterators, RemoteIndexList& rList, GlobalIndexList& gList,
│ │ │ │ +
1144 BoolList& bList){
│ │ │ │ +
1145
│ │ │ │ +
1146 if(std::get<0>(iterators.iterators_) != rList.begin())
│ │ │ │ +
1147 return false;
│ │ │ │ +
1148 if(std::get<1>(iterators.iterators_) != gList.begin())
│ │ │ │ +
1149 return false;
│ │ │ │ +
1150 if(std::get<2>(iterators.iterators_) != bList.begin())
│ │ │ │ +
1151 return false;
│ │ │ │ +
1152 return true;
│ │ │ │ +
1153 }
│ │ │ │ +
1154
│ │ │ │ +
1155
│ │ │ │ +
1156 template<typename T>
│ │ │ │ +
1157 bool IndicesSyncer<T>::checkReset(){
│ │ │ │ +
1158
│ │ │ │ +
1159 // Reset iterators in all tuples.
│ │ │ │ +
1160 const auto remoteEnd = remoteIndices_.remoteIndices_.end();
│ │ │ │ +
1161 auto iterators = iteratorsMap_.begin();
│ │ │ │ +
1162 auto global = globalMap_.begin();
│ │ │ │ +
1163 auto added = oldMap_.begin();
│ │ │ │ +
1164 bool ret = true;
│ │ │ │ +
1165
│ │ │ │ +
1166 for(auto remote = remoteIndices_.remoteIndices_.begin();
│ │ │ │ +
1167 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {
│ │ │ │ +
1168 if(!checkReset(iterators->second, *(remote->second.first), global->second,
│ │ │ │ +
1169 added->second))
│ │ │ │ +
1170 ret=false;
│ │ │ │ +
1171 }
│ │ │ │ +
1172 return ret;
│ │ │ │ +
1173 }
│ │ │ │ +
1174}
│ │ │ │ +
1175
│ │ │ │ +
1176#endif
│ │ │ │ +
1177#endif
│ │ │ │ +
Standard Dune debug streams.
│ │ │ │ +
Classes describing a distributed indexset.
│ │ │ │ +
Provides a map between global and local indices.
│ │ │ │ +
Implements a singly linked list together with the necessary iterators.
│ │ │ │ +
void push_back(const MemberType &item)
Add a new entry to the end of the list.
Definition sllist.hh:643
│ │ │ │ +
SLListIterator< T, A > iterator
The mutable iterator of the list.
Definition sllist.hh:69
│ │ │ │ +
iterator end()
Get an iterator pointing to the end of the list.
Definition sllist.hh:774
│ │ │ │ +
ModifyIterator beginModify()
Get an iterator capable of deleting and inserting elements.
Definition sllist.hh:787
│ │ │ │ +
SLListConstIterator< RemoteIndex, Allocator > const_iterator
The constant iterator of the list.
Definition sllist.hh:74
│ │ │ │ +
SLListModifyIterator< T, A > ModifyIterator
The type of the iterator capable of deletion and insertion.
Definition sllist.hh:103
│ │ │ │ +
iterator begin()
Get an iterator pointing to the first element in the list.
Definition sllist.hh:762
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:637
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition iteratorfacades.hh:237
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition iteratorfacades.hh:259
│ │ │ │ +
Iterators()
Default constructor.
Definition indicessyncer.hh:555
│ │ │ │ +
Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
Type of the remote indices.
Definition indicessyncer.hh:59
│ │ │ │ +
bool isOld() const
Was this entry already in the remote index list before the sync process?
Definition indicessyncer.hh:592
│ │ │ │ +
int publish
The number of indices we publish for the other process.
Definition indicessyncer.hh:126
│ │ │ │ +
void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, RemoteIndices< T, A1 > &remoteIndices, const T &indexSet)
Repair the pointers to the local indices in the remote indices.
Definition indicessyncer.hh:487
│ │ │ │ +
bool isAtEnd() const
Are we at the end of the list?
Definition indicessyncer.hh:614
│ │ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
Type of the global index used in the index set.
Definition indicessyncer.hh:51
│ │ │ │ +
int pairs
The number of pairs (attribute and process number) we publish to the neighbour process.
Definition indicessyncer.hh:131
│ │ │ │ +
Attribute & attribute() const
│ │ │ │ +
Iterators & operator++()
Increment all iteraors.
Definition indicessyncer.hh:560
│ │ │ │ +
ParallelIndexSet::LocalIndex::Attribute Attribute
Type of the attribute used in the index set.
Definition indicessyncer.hh:54
│ │ │ │ +
std::pair< GlobalIndex, Attribute > & globalIndexPair() const
Get the global index of the remote index at current position.
Definition indicessyncer.hh:586
│ │ │ │ +
IndicesSyncer(ParallelIndexSet &indexSet, RemoteIndices &remoteIndices)
Constructor.
Definition indicessyncer.hh:536
│ │ │ │ +
void reset(RemoteIndexList &remoteIndices, GlobalIndexList &globalIndices, BoolList &booleans)
Reset all the underlying iterators.
Definition indicessyncer.hh:598
│ │ │ │ +
std::size_t operator()(const GlobalIndex &global)
Provide the local index, always std::numeric_limits<size_t>::max()
Definition indicessyncer.hh:145
│ │ │ │ +
T ParallelIndexSet
The type of the index set.
Definition indicessyncer.hh:45
│ │ │ │ +
bool isNotAtEnd() const
Are we not at the end of the list?
Definition indicessyncer.hh:608
│ │ │ │ +
TG GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition indexset.hh:226
│ │ │ │ +
void storeGlobalIndicesOfRemoteIndices(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, const RemoteIndices< T, A1 > &remoteIndices)
Stores the corresponding global indices of the remote index information.
Definition indicessyncer.hh:461
│ │ │ │ +
void sync()
Sync the index set.
Definition indicessyncer.hh:728
│ │ │ │ +
int seqNo() const
Get the internal sequence number.
│ │ │ │ +
ParallelIndexSet::IndexPair IndexPair
The type of the index pair.
Definition indicessyncer.hh:48
│ │ │ │ +
RemoteIndex & remoteIndex() const
Get the remote index at current position.
Definition indicessyncer.hh:579
│ │ │ │ +
MessageInformation()
Definition indicessyncer.hh:122
│ │ │ │ +
void insert(const RemoteIndex &index, const std::pair< GlobalIndex, Attribute > &global)
Insert a new remote index to the underlying remote index list.
Definition indicessyncer.hh:569
│ │ │ │ +
DVVerbType dvverb(std::cout)
stream for very verbose output.
Definition stdstreams.hh:95
│ │ │ │ +
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition stdstreams.hh:116
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Inserter< V > io(const V &v)
Definition io.hh:51
│ │ │ │ -
Definition io.hh:28
│ │ │ │ -
Inserter(const T &value)
Definition io.hh:32
│ │ │ │ -
friend Stream & operator<<(Stream &out, const Inserter &ins)
Definition io.hh:37
│ │ │ │ -
Include file for users of the SIMD abstraction layer.
│ │ │ │ +
static MPI_Datatype getType()
Definition mpitraits.hh:48
│ │ │ │ +
A pair consisting of a global and local index.
Definition indexset.hh:85
│ │ │ │ +
Class for recomputing missing indices of a distributed index set.
Definition indicessyncer.hh:41
│ │ │ │ +
An index present on the local process with an additional attribute flag.
Definition plocalindex.hh:49
│ │ │ │ +
The indices present on remote processes.
Definition remoteindices.hh:189
│ │ │ │ +
MPI_Comm communicator() const
Get the mpi communicator used.
Definition remoteindices.hh:1696
│ │ │ │ +
const_iterator end() const
Get an iterator over all remote index lists.
Definition remoteindices.hh:1529
│ │ │ │ +
int neighbours() const
Get the number of processors we share indices with.
Definition remoteindices.hh:1446
│ │ │ │ +
typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > Allocator
The type of the allocator for the remote index list.
Definition remoteindices.hh:237
│ │ │ │ +
const_iterator begin() const
Get an iterator over all remote index lists.
Definition remoteindices.hh:1522
│ │ │ │ +
Information about an index residing on another processor.
Definition remoteindices.hh:73
│ │ │ │ +
A mutable iterator for the SLList.
Definition sllist.hh:271
│ │ │ │ +
A single linked list.
Definition sllist.hh:44
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,135 +1,1204 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -io.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +indicessyncer.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_IO_HH │ │ │ │ │ -4#define DUNE_COMMON_SIMD_IO_HH │ │ │ │ │ -5 │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18 │ │ │ │ │ -19#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -20#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -22 │ │ │ │ │ -23namespace _D_u_n_e { │ │ │ │ │ -24 │ │ │ │ │ -_2_5 namespace SimdImpl { │ │ │ │ │ -26 │ │ │ │ │ -27 template │ │ │ │ │ -_2_8 class _I_n_s_e_r_t_e_r { │ │ │ │ │ -29 T value_; │ │ │ │ │ -30 │ │ │ │ │ -31 public: │ │ │ │ │ -_3_2 _I_n_s_e_r_t_e_r(const T &value) : value_(value) {} │ │ │ │ │ -33 │ │ │ │ │ -34 template::value> > │ │ │ │ │ -_3_7 friend Stream& _o_p_e_r_a_t_o_r_<_<(Stream &out, const _I_n_s_e_r_t_e_r &ins) │ │ │ │ │ -38 { │ │ │ │ │ -39 const char *sep = "<"; │ │ │ │ │ -40 for(auto l : _r_a_n_g_e(_S_i_m_d_:_:_l_a_n_e_s(ins.value_))) │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +5#ifndef DUNE_INDICESSYNCER_HH │ │ │ │ │ +6#define DUNE_INDICESSYNCER_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ +9#include "_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h" │ │ │ │ │ +10#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ +11#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_l_l_i_s_t_._h_h> │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19 │ │ │ │ │ +20#if HAVE_MPI │ │ │ │ │ +21namespace _D_u_n_e │ │ │ │ │ +22{ │ │ │ │ │ +39 template │ │ │ │ │ +_4_0 class _I_n_d_i_c_e_s_S_y_n_c_e_r │ │ │ │ │ 41 { │ │ │ │ │ -42 out << sep << _a_u_t_o_C_o_p_y(_S_i_m_d_:_:_l_a_n_e(l, ins.value_)); │ │ │ │ │ -43 sep = ", "; │ │ │ │ │ -44 } │ │ │ │ │ -45 out << '>'; │ │ │ │ │ -46 return out; │ │ │ │ │ -47 } │ │ │ │ │ -48 }; │ │ │ │ │ +42 public: │ │ │ │ │ +43 │ │ │ │ │ +_4_5 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +46 │ │ │ │ │ +_4_8 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_I_n_d_e_x_P_a_i_r _I_n_d_e_x_P_a_i_r; │ │ │ │ │ 49 │ │ │ │ │ -50 template() != 1> > │ │ │ │ │ -_5_1 _I_n_s_e_r_t_e_r_<_V_> _i_o(const V &v) │ │ │ │ │ -52 { │ │ │ │ │ -53 return { v }; │ │ │ │ │ -54 } │ │ │ │ │ +_5_1 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +52 │ │ │ │ │ +_5_4 typedef typename ParallelIndexSet::LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ │ 55 │ │ │ │ │ -56 template() == 1> > │ │ │ │ │ -_5_7 _S_i_m_d_:_:_S_c_a_l_a_r_<_V_> _i_o(const V &v) │ │ │ │ │ -58 { │ │ │ │ │ -59 return _S_i_m_d_:_:_l_a_n_e(0, v); │ │ │ │ │ -60 } │ │ │ │ │ -61 │ │ │ │ │ -62 } │ │ │ │ │ -63 │ │ │ │ │ -64 namespace Simd { │ │ │ │ │ -65 │ │ │ │ │ -82 │ │ │ │ │ -89 template │ │ │ │ │ -_9_0 auto _v_i_o(const V &v) │ │ │ │ │ -91 { │ │ │ │ │ -92 return _S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_<_V_>{ v }; │ │ │ │ │ -93 } │ │ │ │ │ -94 │ │ │ │ │ +_5_9 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_<_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_> _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ +60 │ │ │ │ │ +70 _I_n_d_i_c_e_s_S_y_n_c_e_r(_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ +71 _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices); │ │ │ │ │ +72 │ │ │ │ │ +82 void _s_y_n_c(); │ │ │ │ │ +83 │ │ │ │ │ +94 template │ │ │ │ │ +95 void _s_y_n_c(T1& numberer); │ │ │ │ │ 96 │ │ │ │ │ -105 template │ │ │ │ │ -_1_0_6 auto _i_o(const V &v) │ │ │ │ │ -107 { │ │ │ │ │ -108 return _S_i_m_d_I_m_p_l_:_:_i_o(v); │ │ │ │ │ -109 } │ │ │ │ │ +97 private: │ │ │ │ │ +98 │ │ │ │ │ +100 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet_; │ │ │ │ │ +101 │ │ │ │ │ +103 _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices_; │ │ │ │ │ +104 │ │ │ │ │ +106 char** sendBuffers_; │ │ │ │ │ +107 │ │ │ │ │ +109 char* receiveBuffer_; │ │ │ │ │ 110 │ │ │ │ │ -112 │ │ │ │ │ -114 │ │ │ │ │ -115 } // namespace Simd │ │ │ │ │ -116} // namespace Dune │ │ │ │ │ -117 │ │ │ │ │ -118#endif // DUNE_COMMON_SIMD_IO_HH │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for reduction like operations on ranges. │ │ │ │ │ -_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ -static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ ->, std::integral_constant< T, to >) noexcept │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_a_u_t_o_C_o_p_y │ │ │ │ │ -constexpr AutonomousValue< T > autoCopy(T &&v) │ │ │ │ │ -Autonomous copy of an expression's value for use in auto type deduction. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:642 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_i_o │ │ │ │ │ -auto io(const V &v) │ │ │ │ │ -construct a stream inserter │ │ │ │ │ -DDeeffiinniittiioonn io.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_v_i_o │ │ │ │ │ -auto vio(const V &v) │ │ │ │ │ -construct a stream inserter │ │ │ │ │ -DDeeffiinniittiioonn io.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ -constexpr std::size_t lanes() │ │ │ │ │ -Number of lanes in a SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ -decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ -Extract an element of a SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ -typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ -Element type of some SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ +112 std::size_t* sendBufferSizes_; │ │ │ │ │ +113 │ │ │ │ │ +115 int receiveBufferSize_; // int because of MPI │ │ │ │ │ +116 │ │ │ │ │ +120 struct MessageInformation │ │ │ │ │ +121 { │ │ │ │ │ +_1_2_2 _M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n() │ │ │ │ │ +123 : _p_u_b_l_i_s_h(), _p_a_i_r_s() │ │ │ │ │ +124 {} │ │ │ │ │ +_1_2_6 int _p_u_b_l_i_s_h; │ │ │ │ │ +_1_3_1 int _p_a_i_r_s; │ │ │ │ │ +132 }; │ │ │ │ │ +133 │ │ │ │ │ +137 class DefaultNumberer │ │ │ │ │ +138 { │ │ │ │ │ +139 public: │ │ │ │ │ +_1_4_5 std::size_t _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const _G_l_o_b_a_l_I_n_d_e_x& global) │ │ │ │ │ +146 { │ │ │ │ │ +147 return std::numeric_limits::max(); │ │ │ │ │ +148 } │ │ │ │ │ +149 }; │ │ │ │ │ +150 │ │ │ │ │ +152 MPI_Datatype datatype_; │ │ │ │ │ +153 │ │ │ │ │ +155 int rank_; │ │ │ │ │ +156 │ │ │ │ │ +161 typedef _S_L_L_i_s_t_<_s_t_d_:_:_p_a_i_r_<_G_l_o_b_a_l_I_n_d_e_x_,_A_t_t_r_i_b_u_t_e_>, typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_: │ │ │ │ │ +_A_l_l_o_c_a_t_o_r> GlobalIndexList; │ │ │ │ │ +162 │ │ │ │ │ +164 typedef typename _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r GlobalIndexModifier; │ │ │ │ │ +165 │ │ │ │ │ +169 typedef typename _S_L_L_i_s_t_<_G_l_o_b_a_l_I_n_d_e_x_,_ _t_y_p_e_n_a_m_e_ _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_l_l_o_c_a_t_o_r_>_:_: │ │ │ │ │ +_i_t_e_r_a_t_o_r │ │ │ │ │ +170 GlobalIndexIterator; │ │ │ │ │ +171 │ │ │ │ │ +173 typedef std::map GlobalIndicesMap; │ │ │ │ │ +174 │ │ │ │ │ +183 GlobalIndicesMap globalMap_; │ │ │ │ │ +184 │ │ │ │ │ +188 typedef _S_L_L_i_s_t_<_b_o_o_l_,_ _t_y_p_e_n_a_m_e_ _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_l_l_o_c_a_t_o_r_> BoolList; │ │ │ │ │ +189 │ │ │ │ │ +193 typedef typename _B_o_o_l_L_i_s_t_:_:_i_t_e_r_a_t_o_r BoolIterator; │ │ │ │ │ +194 │ │ │ │ │ +196 typedef typename _B_o_o_l_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r BoolListModifier; │ │ │ │ │ +197 │ │ │ │ │ +199 typedef std::map BoolMap; │ │ │ │ │ +200 │ │ │ │ │ +205 BoolMap oldMap_; │ │ │ │ │ +206 │ │ │ │ │ +208 std::map infoSend_; │ │ │ │ │ +209 │ │ │ │ │ +211 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t RemoteIndexList; │ │ │ │ │ +212 │ │ │ │ │ +214 typedef typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r RemoteIndexModifier; │ │ │ │ │ +215 │ │ │ │ │ +217 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_<_G_l_o_b_a_l_I_n_d_e_x_,_A_t_t_r_i_b_u_t_e_> _R_e_m_o_t_e_I_n_d_e_x; │ │ │ │ │ +218 │ │ │ │ │ +220 typedef typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_i_t_e_r_a_t_o_r RemoteIndexIterator; │ │ │ │ │ +221 │ │ │ │ │ +223 typedef typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r ConstRemoteIndexIterator; │ │ │ │ │ +224 │ │ │ │ │ +226 typedef std:: │ │ │ │ │ +tuple IteratorTuple; │ │ │ │ │ +228 │ │ │ │ │ +236 class Iterators │ │ │ │ │ +237 { │ │ │ │ │ +238 friend class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ +239 public: │ │ │ │ │ +249 _I_t_e_r_a_t_o_r_s(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices, │ │ │ │ │ +250 BoolList& booleans); │ │ │ │ │ +251 │ │ │ │ │ +255 _I_t_e_r_a_t_o_r_s(); │ │ │ │ │ +256 │ │ │ │ │ +260 _I_t_e_r_a_t_o_r_s& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +261 │ │ │ │ │ +267 void _i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x& index, │ │ │ │ │ +268 const std::pair& global); │ │ │ │ │ +269 │ │ │ │ │ +274 _R_e_m_o_t_e_I_n_d_e_x& _r_e_m_o_t_e_I_n_d_e_x() const; │ │ │ │ │ +275 │ │ │ │ │ +280 std::pair& _g_l_o_b_a_l_I_n_d_e_x_P_a_i_r() const; │ │ │ │ │ +281 │ │ │ │ │ +_2_8_2 _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e() const; │ │ │ │ │ +283 │ │ │ │ │ +289 bool _i_s_O_l_d() const; │ │ │ │ │ +290 │ │ │ │ │ +300 void _r_e_s_e_t(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& remoteIndices, _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& globalIndices, │ │ │ │ │ +301 _B_o_o_l_L_i_s_t& booleans); │ │ │ │ │ +302 │ │ │ │ │ +308 bool _i_s_N_o_t_A_t_E_n_d() const; │ │ │ │ │ +309 │ │ │ │ │ +315 bool _i_s_A_t_E_n_d() const; │ │ │ │ │ +316 │ │ │ │ │ +317 private: │ │ │ │ │ +327 IteratorTuple iterators_; │ │ │ │ │ +328 }; │ │ │ │ │ +329 │ │ │ │ │ +331 typedef std::map IteratorsMap; │ │ │ │ │ +332 │ │ │ │ │ +344 IteratorsMap iteratorsMap_; │ │ │ │ │ +345 │ │ │ │ │ +347 void calculateMessageSizes(); │ │ │ │ │ +348 │ │ │ │ │ +356 void packAndSend(int destination, char* buffer, std::size_t bufferSize, │ │ │ │ │ +MPI_Request& req); │ │ │ │ │ +357 │ │ │ │ │ +362 template │ │ │ │ │ +363 void recvAndUnpack(T1& numberer); │ │ │ │ │ +364 │ │ │ │ │ +368 void registerMessageDatatype(); │ │ │ │ │ +369 │ │ │ │ │ +373 void insertIntoRemoteIndexList(int process, │ │ │ │ │ +374 const std::pair& global, │ │ │ │ │ +375 char attribute); │ │ │ │ │ +376 │ │ │ │ │ +380 void resetIteratorsMap(); │ │ │ │ │ +381 │ │ │ │ │ +386 bool checkReset(); │ │ │ │ │ +387 │ │ │ │ │ +396 bool checkReset(const Iterators& iterators, _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& rlist, │ │ │ │ │ +_G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& gList, │ │ │ │ │ +397 _B_o_o_l_L_i_s_t& bList); │ │ │ │ │ +398 }; │ │ │ │ │ +399 │ │ │ │ │ +400 template │ │ │ │ │ +_4_0_1 bool _o_p_e_r_a_t_o_r_<(const _I_n_d_e_x_P_a_i_r >& i1, │ │ │ │ │ +402 const std::pair& i2) │ │ │ │ │ +403 { │ │ │ │ │ +404 return i1.global() < i2.first || │ │ │ │ │ +405 (i1.global() == i2.first && i1.local().attribute() │ │ │ │ │ +_4_0_9 bool _o_p_e_r_a_t_o_r_<(const std::pair& i1, │ │ │ │ │ +410 const _I_n_d_e_x_P_a_i_r >& i2) │ │ │ │ │ +411 { │ │ │ │ │ +412 return i1.first < i2.global() || │ │ │ │ │ +413 (i1.first == i2.global() && i1.second │ │ │ │ │ +_4_1_7 bool _o_p_e_r_a_t_o_r_=_=(const _I_n_d_e_x_P_a_i_r >& i1, │ │ │ │ │ +418 const std::pair& i2) │ │ │ │ │ +419 { │ │ │ │ │ +420 return (i1.global() == i2.first && i1.local().attribute()==i2.second); │ │ │ │ │ +421 } │ │ │ │ │ +422 │ │ │ │ │ +423 template │ │ │ │ │ +_4_2_4 bool _o_p_e_r_a_t_o_r_!_=(const _I_n_d_e_x_P_a_i_r >& i1, │ │ │ │ │ +425 const std::pair& i2) │ │ │ │ │ +426 { │ │ │ │ │ +427 return (i1.global() != i2.first || i1.local().attribute()!=i2.second); │ │ │ │ │ +428 } │ │ │ │ │ +429 │ │ │ │ │ +430 template │ │ │ │ │ +_4_3_1 bool _o_p_e_r_a_t_o_r_=_=(const std::pair& i2, │ │ │ │ │ +432 const _I_n_d_e_x_P_a_i_r >& i1) │ │ │ │ │ +433 { │ │ │ │ │ +434 return (i1.global() == i2.first && i1.local().attribute()==i2.second); │ │ │ │ │ +435 } │ │ │ │ │ +436 │ │ │ │ │ +437 template │ │ │ │ │ +_4_3_8 bool _o_p_e_r_a_t_o_r_!_=(const std::pair& i2, │ │ │ │ │ +439 const _I_n_d_e_x_P_a_i_r >& i1) │ │ │ │ │ +440 { │ │ │ │ │ +441 return (i1.global() != i2.first || i1.local().attribute()!=i2.second); │ │ │ │ │ +442 } │ │ │ │ │ +443 │ │ │ │ │ +460 template │ │ │ │ │ +_4_6_1 void _s_t_o_r_e_G_l_o_b_a_l_I_n_d_i_c_e_s_O_f_R_e_m_o_t_e_I_n_d_i_c_e_s(std::map,A> >& │ │ │ │ │ +globalMap, │ │ │ │ │ +462 const _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>& remoteIndices) │ │ │ │ │ +463 { │ │ │ │ │ +464 for(auto remote = remoteIndices._b_e_g_i_n(), end =remoteIndices._e_n_d(); remote │ │ │ │ │ +!= end; ++remote) { │ │ │ │ │ +465 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t RemoteIndexList; │ │ │ │ │ +466 typedef _S_L_L_i_s_t_<_s_t_d_:_:_p_a_i_r_<_t_y_p_e_n_a_m_e_ _T_:_:_G_l_o_b_a_l_I_n_d_e_x_,_ _t_y_p_e_n_a_m_e_ _T_:_:_L_o_c_a_l_I_n_d_e_x_:_: │ │ │ │ │ +_A_t_t_r_i_b_u_t_e_>,A> GlobalIndexList; │ │ │ │ │ +467 GlobalIndexList& global = globalMap[remote->first]; │ │ │ │ │ +468 RemoteIndexList& rList = *(remote->second.first); │ │ │ │ │ +469 │ │ │ │ │ +470 for(auto index = rList.begin(), riEnd = rList.end(); │ │ │ │ │ +471 index != riEnd; ++index) { │ │ │ │ │ +472 global._p_u_s_h___b_a_c_k(std::make_pair(index->localIndexPair().global(), │ │ │ │ │ +473 index->localIndexPair().local().attribute())); │ │ │ │ │ +474 } │ │ │ │ │ +475 } │ │ │ │ │ +476 } │ │ │ │ │ +477 │ │ │ │ │ +486 template │ │ │ │ │ +_4_8_7 inline void _r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s(std::map,A> >& globalMap, │ │ │ │ │ +490 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>& remoteIndices, │ │ │ │ │ +491 const T& indexSet) │ │ │ │ │ +492 { │ │ │ │ │ +493 assert(globalMap.size()==static_cast(remoteIndices._n_e_i_g_h_b_o_u_r_s │ │ │ │ │ +())); │ │ │ │ │ +494 // Repair pointers to index set in remote indices. │ │ │ │ │ +495 auto global = globalMap.begin(); │ │ │ │ │ +496 auto end = remoteIndices.remoteIndices_.end(); │ │ │ │ │ +497 │ │ │ │ │ +498 for(auto remote = remoteIndices.remoteIndices_.begin(); remote != end; │ │ │ │ │ +++remote, ++global) { │ │ │ │ │ +499 assert(remote->first==global->first); │ │ │ │ │ +500 assert(remote->second.first->size() == global->second.size()); │ │ │ │ │ +501 │ │ │ │ │ +502 auto riEnd = remote->second.first->end(); │ │ │ │ │ +503 auto rIndex = remote->second.first->begin(); │ │ │ │ │ +504 auto gIndex = global->second.begin(); │ │ │ │ │ +505 auto index = indexSet.begin(); │ │ │ │ │ +506 │ │ │ │ │ +507 assert(rIndex==riEnd || gIndex != global->second.end()); │ │ │ │ │ +508 while(rIndex != riEnd) { │ │ │ │ │ +509 // Search for the index in the set. │ │ │ │ │ +510 assert(gIndex != global->second.end()); │ │ │ │ │ +511 │ │ │ │ │ +512 while(!(index->global() == gIndex->first │ │ │ │ │ +513 && index->local().attribute() == gIndex->second)) { │ │ │ │ │ +514 ++index; │ │ │ │ │ +515 // this is only needed for ALU, where there may exist │ │ │ │ │ +516 // more entries with the same global index in the remote index set │ │ │ │ │ +517 // than in the index set │ │ │ │ │ +518 if (index->global() > gIndex->first) { │ │ │ │ │ +519 index=indexSet.begin(); │ │ │ │ │ +520 } │ │ │ │ │ +521 } │ │ │ │ │ +522 │ │ │ │ │ +523 assert(index != indexSet.end() && *index == *gIndex); │ │ │ │ │ +524 │ │ │ │ │ +525 rIndex->localIndex_ = &(*index); │ │ │ │ │ +526 ++index; │ │ │ │ │ +527 ++rIndex; │ │ │ │ │ +528 ++gIndex; │ │ │ │ │ +529 } │ │ │ │ │ +530 } │ │ │ │ │ +531 remoteIndices.sourceSeqNo_ = remoteIndices.source_->_s_e_q_N_o(); │ │ │ │ │ +532 remoteIndices.destSeqNo_ = remoteIndices.target_->_s_e_q_N_o(); │ │ │ │ │ +533 } │ │ │ │ │ +534 │ │ │ │ │ +535 template │ │ │ │ │ +_5_3_6 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r(_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ +537 _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices) │ │ │ │ │ +538 : indexSet_(indexSet), remoteIndices_(remoteIndices) │ │ │ │ │ +539 { │ │ │ │ │ +540 // index sets must match. │ │ │ │ │ +541 assert(remoteIndices.source_ == remoteIndices.target_); │ │ │ │ │ +542 assert(remoteIndices.source_ == &indexSet); │ │ │ │ │ +543 MPI_Comm_rank(remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &rank_); │ │ │ │ │ +544 } │ │ │ │ │ +545 │ │ │ │ │ +546 template │ │ │ │ │ +_5_4_7 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_I_t_e_r_a_t_o_r_s(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& remoteIndices, │ │ │ │ │ +548 _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& globalIndices, │ │ │ │ │ +549 _B_o_o_l_L_i_s_t& booleans) │ │ │ │ │ +550 : iterators_(remoteIndices.beginModify(), globalIndices.beginModify(), │ │ │ │ │ +551 booleans.beginModify(), remoteIndices.end()) │ │ │ │ │ +552 { } │ │ │ │ │ +553 │ │ │ │ │ +554 template │ │ │ │ │ +_5_5_5 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_I_t_e_r_a_t_o_r_s() │ │ │ │ │ +556 : iterators_() │ │ │ │ │ +557 {} │ │ │ │ │ +558 │ │ │ │ │ +559 template │ │ │ │ │ +_5_6_0 inline typename _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s& _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_: │ │ │ │ │ +_o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +561 { │ │ │ │ │ +562 ++(std::get<0>(iterators_)); │ │ │ │ │ +563 ++(std::get<1>(iterators_)); │ │ │ │ │ +564 ++(std::get<2>(iterators_)); │ │ │ │ │ +565 return *this; │ │ │ │ │ +566 } │ │ │ │ │ +567 │ │ │ │ │ +568 template │ │ │ │ │ +_5_6_9 inline void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x & index, │ │ │ │ │ +570 const std::pair& global) │ │ │ │ │ +571 { │ │ │ │ │ +572 std::get<0>(iterators_).insert(index); │ │ │ │ │ +573 std::get<1>(iterators_).insert(global); │ │ │ │ │ +574 std::get<2>(iterators_).insert(false); │ │ │ │ │ +575 } │ │ │ │ │ +576 │ │ │ │ │ +577 template │ │ │ │ │ +578 inline typename _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_R_e_m_o_t_e_I_n_d_e_x& │ │ │ │ │ +_5_7_9 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_m_o_t_e_I_n_d_e_x() const │ │ │ │ │ +580 { │ │ │ │ │ +581 return *(std::get<0>(iterators_)); │ │ │ │ │ +582 } │ │ │ │ │ +583 │ │ │ │ │ +584 template │ │ │ │ │ +585 inline std::pair::GlobalIndex,typename │ │ │ │ │ +_I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_A_t_t_r_i_b_u_t_e>& │ │ │ │ │ +_5_8_6 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_g_l_o_b_a_l_I_n_d_e_x_P_a_i_r() const │ │ │ │ │ +587 { │ │ │ │ │ +588 return *(std::get<1>(iterators_)); │ │ │ │ │ +589 } │ │ │ │ │ +590 │ │ │ │ │ +591 template │ │ │ │ │ +_5_9_2 inline bool _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_O_l_d() const │ │ │ │ │ +593 { │ │ │ │ │ +594 return *(std::get<2>(iterators_)); │ │ │ │ │ +595 } │ │ │ │ │ +596 │ │ │ │ │ +597 template │ │ │ │ │ +_5_9_8 inline void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_s_e_t(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& │ │ │ │ │ +remoteIndices, │ │ │ │ │ +599 _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& globalIndices, │ │ │ │ │ +600 _B_o_o_l_L_i_s_t& booleans) │ │ │ │ │ +601 { │ │ │ │ │ +602 std::get<0>(iterators_) = remoteIndices._b_e_g_i_n_M_o_d_i_f_y(); │ │ │ │ │ +603 std::get<1>(iterators_) = globalIndices._b_e_g_i_n_M_o_d_i_f_y(); │ │ │ │ │ +604 std::get<2>(iterators_) = booleans._b_e_g_i_n_M_o_d_i_f_y(); │ │ │ │ │ +605 } │ │ │ │ │ +606 │ │ │ │ │ +607 template │ │ │ │ │ +_6_0_8 inline bool _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_N_o_t_A_t_E_n_d() const │ │ │ │ │ +609 { │ │ │ │ │ +610 return std::get<0>(iterators_) != std::get<3>(iterators_); │ │ │ │ │ +611 } │ │ │ │ │ +612 │ │ │ │ │ +613 template │ │ │ │ │ +_6_1_4 inline bool _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_A_t_E_n_d() const │ │ │ │ │ +615 { │ │ │ │ │ +616 return std::get<0>(iterators_) == std::get<3>(iterators_); │ │ │ │ │ +617 } │ │ │ │ │ +618 │ │ │ │ │ +619 template │ │ │ │ │ +620 void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_r_e_g_i_s_t_e_r_M_e_s_s_a_g_e_D_a_t_a_t_y_p_e() │ │ │ │ │ +621 { │ │ │ │ │ +622 MPI_Datatype type[2] = {MPI_INT, MPI_INT}; │ │ │ │ │ +623 int blocklength[2] = {1,1}; │ │ │ │ │ +624 MPI_Aint displacement[2]; │ │ │ │ │ +625 MPI_Aint base; │ │ │ │ │ +626 │ │ │ │ │ +627 // Compute displacement │ │ │ │ │ +628 MessageInformation message; │ │ │ │ │ +629 │ │ │ │ │ +630 MPI_Get_address( &(message.publish), displacement); │ │ │ │ │ +631 MPI_Get_address( &(message.pairs), displacement+1); │ │ │ │ │ +632 │ │ │ │ │ +633 // Make the displacement relative │ │ │ │ │ +634 MPI_Get_address(&message, &base); │ │ │ │ │ +635 displacement[0] -= base; │ │ │ │ │ +636 displacement[1] -= base; │ │ │ │ │ +637 │ │ │ │ │ +638 MPI_Type_create_struct( 2, blocklength, displacement, type, &datatype_); │ │ │ │ │ +639 MPI_Type_commit(&datatype_); │ │ │ │ │ +640 } │ │ │ │ │ +641 │ │ │ │ │ +642 template │ │ │ │ │ +643 void IndicesSyncer::calculateMessageSizes() │ │ │ │ │ +644 { │ │ │ │ │ +645 auto iEnd = indexSet_.end(); │ │ │ │ │ +646 auto collIter = remoteIndices_.template iterator(); │ │ │ │ │ +647 │ │ │ │ │ +648 for(auto index = indexSet_.begin(); index != iEnd; ++index) { │ │ │ │ │ +649 collIter.advance(index->global(), index->local().attribute()); │ │ │ │ │ +650 if(collIter.empty()) │ │ │ │ │ +651 break; │ │ │ │ │ +652 int knownRemote=0; │ │ │ │ │ +653 auto end = collIter.end(); │ │ │ │ │ +654 │ │ │ │ │ +655 // Count the remote indices we know. │ │ │ │ │ +656 for(auto valid = collIter.begin(); valid != end; ++valid) { │ │ │ │ │ +657 ++knownRemote; │ │ │ │ │ +658 } │ │ │ │ │ +659 │ │ │ │ │ +660 if(knownRemote>0) { │ │ │ │ │ +661 _D_u_n_e_:_:_d_v_e_r_b<global()<< " for processes "; │ │ │ │ │ +662 │ │ │ │ │ +663 // Update MessageInformation │ │ │ │ │ +664 for(auto valid = collIter.begin(); valid != end; ++valid) { │ │ │ │ │ +665 ++(infoSend_[valid.process()].publish); │ │ │ │ │ +666 (infoSend_[valid.process()].pairs) += knownRemote; │ │ │ │ │ +667 _D_u_n_e_:_:_d_v_e_r_b<first==remote->first) { │ │ │ │ │ +689 // We want to send message information to that process │ │ │ │ │ +690 message = const_cast(&(messageIter->second)); │ │ │ │ │ +691 ++messageIter; │ │ │ │ │ +692 }else │ │ │ │ │ +693 // We do not want to send information but the other process might. │ │ │ │ │ +694 message = &dummy; │ │ │ │ │ +695 │ │ │ │ │ +696 sendBufferSizes_[neighbour]=0; │ │ │ │ │ +697 int tsize; │ │ │ │ │ +698 // The number of indices published │ │ │ │ │ +699 MPI_Pack_size(1, MPI_INT,remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +700 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ +701 │ │ │ │ │ +702 for(int i=0; i < message->publish; ++i) { │ │ │ │ │ +703 // The global index │ │ │ │ │ +704 MPI_Pack_size(1, _M_P_I_T_r_a_i_t_s_<_G_l_o_b_a_l_I_n_d_e_x_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +705 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ +706 // The attribute in the local index │ │ │ │ │ +707 MPI_Pack_size(1, MPI_CHAR, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +708 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ +709 // The number of corresponding remote indices │ │ │ │ │ +710 MPI_Pack_size(1, MPI_INT, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +711 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ +712 } │ │ │ │ │ +713 for(int i=0; i < message->pairs; ++i) { │ │ │ │ │ +714 // The process of the remote index │ │ │ │ │ +715 MPI_Pack_size(1, MPI_INT, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +716 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ +717 // The attribute of the remote index │ │ │ │ │ +718 MPI_Pack_size(1, MPI_CHAR, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +719 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ +720 } │ │ │ │ │ +721 │ │ │ │ │ +722 _D_u_n_e_:_:_d_v_e_r_b< │ │ │ │ │ +852 void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_p_a_c_k_A_n_d_S_e_n_d(int destination, char* buffer, std:: │ │ │ │ │ +size_t bufferSize, MPI_Request& request) │ │ │ │ │ +853 { │ │ │ │ │ +854 auto iEnd = indexSet_.end(); │ │ │ │ │ +855 int bpos = 0; │ │ │ │ │ +856 int published = 0; │ │ │ │ │ +857 int pairs = 0; │ │ │ │ │ +858 │ │ │ │ │ +859 assert(checkReset()); │ │ │ │ │ +860 │ │ │ │ │ +861 // Pack the number of indices we publish │ │ │ │ │ +862 MPI_Pack(&(infoSend_[destination].publish), 1, MPI_INT, buffer, bufferSize, │ │ │ │ │ +&bpos, │ │ │ │ │ +863 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +864 │ │ │ │ │ +865 for(auto index = indexSet_.begin(); index != iEnd; ++index) { │ │ │ │ │ +866 // Search for corresponding remote indices in all iterator tuples │ │ │ │ │ +867 auto iteratorsEnd = iteratorsMap_.end(); │ │ │ │ │ +868 │ │ │ │ │ +869 // advance all iterators to a position with global index >= index->global() │ │ │ │ │ +870 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; │ │ │ │ │ +++iterators) { │ │ │ │ │ +871 while(iterators->second.isNotAtEnd() && │ │ │ │ │ +872 iterators->second.globalIndexPair().first < index->global()) │ │ │ │ │ +873 ++(iterators->second); │ │ │ │ │ +874 assert(!iterators->second.isNotAtEnd() || iterators->second.globalIndexPair │ │ │ │ │ +().first >= index->global()); │ │ │ │ │ +875 } │ │ │ │ │ +876 │ │ │ │ │ +877 // Add all remote indices positioned at global which were already present │ │ │ │ │ +before calling sync │ │ │ │ │ +878 // to the message. │ │ │ │ │ +879 // Count how many remote indices we will send │ │ │ │ │ +880 int indices = 0; │ │ │ │ │ +881 bool knownRemote = false; // Is the remote process supposed to know this │ │ │ │ │ +index? │ │ │ │ │ +882 │ │ │ │ │ +883 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; │ │ │ │ │ +++iterators) │ │ │ │ │ +884 { │ │ │ │ │ +885 std::pair p; │ │ │ │ │ +886 if (iterators->second.isNotAtEnd()) │ │ │ │ │ +887 { │ │ │ │ │ +888 p = iterators->second.globalIndexPair(); │ │ │ │ │ +889 } │ │ │ │ │ +890 │ │ │ │ │ +891 if(iterators->second.isNotAtEnd() && iterators->second.isOld() │ │ │ │ │ +892 && iterators->second.globalIndexPair().first == index->global()) { │ │ │ │ │ +893 indices++; │ │ │ │ │ +894 if(destination == iterators->first) │ │ │ │ │ +895 knownRemote = true; │ │ │ │ │ +896 } │ │ │ │ │ +897 } │ │ │ │ │ +898 │ │ │ │ │ +899 if(!knownRemote) │ │ │ │ │ +900 // We do not need to send any indices │ │ │ │ │ +901 continue; │ │ │ │ │ +902 │ │ │ │ │ +903 _D_u_n_e_:_:_d_v_e_r_b<global │ │ │ │ │ +()<<" to "<(&(index->global())), 1, │ │ │ │ │ +_M_P_I_T_r_a_i_t_s_<_G_l_o_b_a_l_I_n_d_e_x_>_:_:_g_e_t_T_y_p_e(), buffer, bufferSize, &bpos, │ │ │ │ │ +908 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +909 │ │ │ │ │ +910 char attr = index->local().attribute(); │ │ │ │ │ +911 MPI_Pack(&attr, 1, MPI_CHAR, buffer, bufferSize, &bpos, │ │ │ │ │ +912 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +913 │ │ │ │ │ +914 // Pack the number of remote indices we send. │ │ │ │ │ +915 MPI_Pack(&indices, 1, MPI_INT, buffer, bufferSize, &bpos, │ │ │ │ │ +916 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +917 │ │ │ │ │ +918 // Pack the information about the remote indices │ │ │ │ │ +919 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; │ │ │ │ │ +++iterators) │ │ │ │ │ +920 if(iterators->second.isNotAtEnd() && iterators->second.isOld() │ │ │ │ │ +921 && iterators->second.globalIndexPair().first == index->global()) { │ │ │ │ │ +922 int process = iterators->first; │ │ │ │ │ +923 │ │ │ │ │ +924 ++pairs; │ │ │ │ │ +925 assert(pairs <= infoSend_[destination].pairs); │ │ │ │ │ +926 MPI_Pack(&process, 1, MPI_INT, buffer, bufferSize, &bpos, │ │ │ │ │ +927 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +928 char attr2 = iterators->second.remoteIndex().attribute(); │ │ │ │ │ +929 │ │ │ │ │ +930 MPI_Pack(&attr2, 1, MPI_CHAR, buffer, bufferSize, &bpos, │ │ │ │ │ +931 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +932 --indices; │ │ │ │ │ +933 } │ │ │ │ │ +934 assert(indices==0); │ │ │ │ │ +935 ++published; │ │ │ │ │ +936 _D_u_n_e_:_:_d_v_v_e_r_b<<" (publish="< │ │ │ │ │ +951 inline void IndicesSyncer::insertIntoRemoteIndexList(int process, │ │ │ │ │ +952 const std::pair& globalPair, │ │ │ │ │ +953 char attribute) │ │ │ │ │ +954 { │ │ │ │ │ +955 _D_u_n_e_:_:_d_v_e_r_b<<"Inserting from "<second; │ │ │ │ │ +972 │ │ │ │ │ +973 // Search for the remote index │ │ │ │ │ +974 while(iterators.isNotAtEnd() && iterators.globalIndexPair() < globalPair) { │ │ │ │ │ +975 // Increment all iterators │ │ │ │ │ +976 ++iterators; │ │ │ │ │ +977 │ │ │ │ │ +978 } │ │ │ │ │ +979 │ │ │ │ │ +980 if(iterators.isAtEnd() || iterators.globalIndexPair() != globalPair) { │ │ │ │ │ +981 // The entry is not yet known │ │ │ │ │ +982 // Insert in the list and do not change the first iterator. │ │ │ │ │ +983 iterators.insert(RemoteIndex(_A_t_t_r_i_b_u_t_e(attribute)),globalPair); │ │ │ │ │ +984 return; │ │ │ │ │ +985 } │ │ │ │ │ +986 │ │ │ │ │ +987 // Global indices match │ │ │ │ │ +988 bool indexIsThere=false; │ │ │ │ │ +989 for(Iterators tmpIterators = iterators; │ │ │ │ │ +990 !tmpIterators.isAtEnd() && tmpIterators.globalIndexPair() == globalPair; │ │ │ │ │ +991 ++tmpIterators) │ │ │ │ │ +992 //entry already exists with the same attribute │ │ │ │ │ +993 if(tmpIterators.globalIndexPair().second == attribute) { │ │ │ │ │ +994 indexIsThere=true; │ │ │ │ │ +995 break; │ │ │ │ │ +996 } │ │ │ │ │ +997 │ │ │ │ │ +998 if(!indexIsThere) │ │ │ │ │ +999 // The entry is not yet known │ │ │ │ │ +1000 // Insert in the list and do not change the first iterator. │ │ │ │ │ +1001 iterators.insert(RemoteIndex(_A_t_t_r_i_b_u_t_e(attribute)),globalPair); │ │ │ │ │ +1002 } │ │ │ │ │ +1003 │ │ │ │ │ +1004 template │ │ │ │ │ +1005 template │ │ │ │ │ +1006 void IndicesSyncer::recvAndUnpack(T1& numberer) │ │ │ │ │ +1007 { │ │ │ │ │ +1008 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& constIndexSet = indexSet_; │ │ │ │ │ +1009 auto iEnd = constIndexSet.end(); │ │ │ │ │ +1010 auto index = constIndexSet.begin(); │ │ │ │ │ +1011 int bpos = 0; │ │ │ │ │ +1012 int publish; │ │ │ │ │ +1013 │ │ │ │ │ +1014 assert(checkReset()); │ │ │ │ │ +1015 │ │ │ │ │ +1016 MPI_Status status; │ │ │ │ │ +1017 │ │ │ │ │ +1018 // We have to determine the message size and source before the receive │ │ │ │ │ +1019 MPI_Probe(MPI_ANY_SOURCE, 345, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &status); │ │ │ │ │ +1020 │ │ │ │ │ +1021 int source=status.MPI_SOURCE; │ │ │ │ │ +1022 int count; │ │ │ │ │ +1023 MPI_Get_count(&status, MPI_PACKED, &count); │ │ │ │ │ +1024 │ │ │ │ │ +1025 _D_u_n_e_:_:_d_v_v_e_r_b<receiveBufferSize_) { │ │ │ │ │ +1028 receiveBufferSize_=count; │ │ │ │ │ +1029 delete[] receiveBuffer_; │ │ │ │ │ +1030 receiveBuffer_ = new char[receiveBufferSize_]; │ │ │ │ │ +1031 } │ │ │ │ │ +1032 │ │ │ │ │ +1033 MPI_Recv(receiveBuffer_, count, MPI_PACKED, source, 345, │ │ │ │ │ +remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &status); │ │ │ │ │ +1034 │ │ │ │ │ +1035 // How many global entries were published? │ │ │ │ │ +1036 MPI_Unpack(receiveBuffer_, count, &bpos, &publish, 1, MPI_INT, │ │ │ │ │ +remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1037 │ │ │ │ │ +1038 // Now unpack the remote indices and add them. │ │ │ │ │ +1039 while(publish>0) { │ │ │ │ │ +1040 │ │ │ │ │ +1041 // Unpack information about the local index on the source process │ │ │ │ │ +1042 _G_l_o_b_a_l_I_n_d_e_x global; // global index of the current entry │ │ │ │ │ +1043 char sourceAttribute; // Attribute on the source process │ │ │ │ │ +1044 int pairs; │ │ │ │ │ +1045 │ │ │ │ │ +1046 MPI_Unpack(receiveBuffer_, count, &bpos, &global, 1, │ │ │ │ │ +_M_P_I_T_r_a_i_t_s_<_G_l_o_b_a_l_I_n_d_e_x_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +1047 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1048 MPI_Unpack(receiveBuffer_, count, &bpos, &sourceAttribute, 1, MPI_CHAR, │ │ │ │ │ +1049 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1050 MPI_Unpack(receiveBuffer_, count, &bpos, &pairs, 1, MPI_INT, │ │ │ │ │ +1051 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1052 │ │ │ │ │ +1053 // Insert the entry on the remote process to our │ │ │ │ │ +1054 // remote index list │ │ │ │ │ +1055 SLList > sourceAttributeList; │ │ │ │ │ +1056 sourceAttributeList.push_back(std::make_pair(source,_A_t_t_r_i_b_u_t_e │ │ │ │ │ +(sourceAttribute))); │ │ │ │ │ +1057#ifndef NDEBUG │ │ │ │ │ +1058 bool foundSelf = false; │ │ │ │ │ +1059#endif │ │ │ │ │ +1060 _A_t_t_r_i_b_u_t_e myAttribute=_A_t_t_r_i_b_u_t_e(); │ │ │ │ │ +1061 │ │ │ │ │ +1062 // Unpack the remote indices │ │ │ │ │ +1063 for(; pairs>0; --pairs) { │ │ │ │ │ +1064 // Unpack the process id that knows the index │ │ │ │ │ +1065 int process; │ │ │ │ │ +1066 char attribute; │ │ │ │ │ +1067 MPI_Unpack(receiveBuffer_, count, &bpos, &process, 1, MPI_INT, │ │ │ │ │ +1068 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1069 // Unpack the attribute │ │ │ │ │ +1070 MPI_Unpack(receiveBuffer_, count, &bpos, &attribute, 1, MPI_CHAR, │ │ │ │ │ +1071 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1072 │ │ │ │ │ +1073 if(process==rank_) { │ │ │ │ │ +1074#ifndef NDEBUG │ │ │ │ │ +1075 foundSelf=true; │ │ │ │ │ +1076#endif │ │ │ │ │ +1077 myAttribute=_A_t_t_r_i_b_u_t_e(attribute); │ │ │ │ │ +1078 // Now we know the local attribute of the global index │ │ │ │ │ +1079 //Only add the index if it is unknown. │ │ │ │ │ +1080 // Do we know that global index already? │ │ │ │ │ +1081 auto pos = std::lower_bound(index, iEnd, _I_n_d_e_x_P_a_i_r(global)); │ │ │ │ │ +1082 │ │ │ │ │ +1083 if(pos == iEnd || pos->global() != global) { │ │ │ │ │ +1084 // no entry with this global index │ │ │ │ │ +1085 indexSet_.add(global, │ │ │ │ │ +1086 ParallelLocalIndex(numberer(global), │ │ │ │ │ +1087 myAttribute, true)); │ │ │ │ │ +1088 _D_u_n_e_:_:_d_v_v_e_r_b << "Adding "<global()==global; ++pos) │ │ │ │ │ +1097 if(pos->local().attribute() == myAttribute) { │ │ │ │ │ +1098 _D_u_n_e_:_:_d_v_v_e_r_b<<"found "<(numberer(global), │ │ │ │ │ +1106 myAttribute, true)); │ │ │ │ │ +1107 _D_u_n_e_:_:_d_v_v_e_r_b << "Adding "< >::const_iterator Iter; │ │ │ │ │ +1117 for(Iter i=sourceAttributeList.begin(), end=sourceAttributeList.end(); │ │ │ │ │ +1118 i!=end; ++i) │ │ │ │ │ +1119 insertIntoRemoteIndexList(i->first, std::make_pair(global, myAttribute), │ │ │ │ │ +1120 i->second); │ │ │ │ │ +1121 --publish; │ │ │ │ │ +1122 } │ │ │ │ │ +1123 │ │ │ │ │ +1124 resetIteratorsMap(); │ │ │ │ │ +1125 } │ │ │ │ │ +1126 │ │ │ │ │ +1127 template │ │ │ │ │ +1128 void IndicesSyncer::resetIteratorsMap(){ │ │ │ │ │ +1129 │ │ │ │ │ +1130 // Reset iterators in all tuples. │ │ │ │ │ +1131 const auto remoteEnd = remoteIndices_.remoteIndices_.end(); │ │ │ │ │ +1132 auto iterators = iteratorsMap_.begin(); │ │ │ │ │ +1133 auto global = globalMap_.begin(); │ │ │ │ │ +1134 auto added = oldMap_.begin(); │ │ │ │ │ +1135 │ │ │ │ │ +1136 for(auto remote = remoteIndices_.remoteIndices_.begin(); │ │ │ │ │ +1137 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) { │ │ │ │ │ +1138 iterators->second.reset(*(remote->second.first), global->second, added- │ │ │ │ │ +>second); │ │ │ │ │ +1139 } │ │ │ │ │ +1140 } │ │ │ │ │ +1141 │ │ │ │ │ +1142 template │ │ │ │ │ +1143 bool IndicesSyncer::checkReset(const Iterators& iterators, │ │ │ │ │ +RemoteIndexList& rList, GlobalIndexList& gList, │ │ │ │ │ +1144 BoolList& bList){ │ │ │ │ │ +1145 │ │ │ │ │ +1146 if(std::get<0>(iterators.iterators_) != rList.begin()) │ │ │ │ │ +1147 return false; │ │ │ │ │ +1148 if(std::get<1>(iterators.iterators_) != gList.begin()) │ │ │ │ │ +1149 return false; │ │ │ │ │ +1150 if(std::get<2>(iterators.iterators_) != bList.begin()) │ │ │ │ │ +1151 return false; │ │ │ │ │ +1152 return true; │ │ │ │ │ +1153 } │ │ │ │ │ +1154 │ │ │ │ │ +1155 │ │ │ │ │ +1156 template │ │ │ │ │ +1157 bool IndicesSyncer::checkReset(){ │ │ │ │ │ +1158 │ │ │ │ │ +1159 // Reset iterators in all tuples. │ │ │ │ │ +1160 const auto remoteEnd = remoteIndices_.remoteIndices_.end(); │ │ │ │ │ +1161 auto iterators = iteratorsMap_.begin(); │ │ │ │ │ +1162 auto global = globalMap_.begin(); │ │ │ │ │ +1163 auto added = oldMap_.begin(); │ │ │ │ │ +1164 bool ret = true; │ │ │ │ │ +1165 │ │ │ │ │ +1166 for(auto remote = remoteIndices_.remoteIndices_.begin(); │ │ │ │ │ +1167 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) { │ │ │ │ │ +1168 if(!checkReset(iterators->second, *(remote->second.first), global->second, │ │ │ │ │ +1169 added->second)) │ │ │ │ │ +1170 ret=false; │ │ │ │ │ +1171 } │ │ │ │ │ +1172 return ret; │ │ │ │ │ +1173 } │ │ │ │ │ +1174} │ │ │ │ │ +1175 │ │ │ │ │ +1176#endif │ │ │ │ │ +1177#endif │ │ │ │ │ +_s_t_d_s_t_r_e_a_m_s_._h_h │ │ │ │ │ +Standard Dune debug streams. │ │ │ │ │ +_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +Classes describing a distributed indexset. │ │ │ │ │ +_i_n_d_e_x_s_e_t_._h_h │ │ │ │ │ +Provides a map between global and local indices. │ │ │ │ │ +_s_l_l_i_s_t_._h_h │ │ │ │ │ +Implements a singly linked list together with the necessary iterators. │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ +void push_back(const MemberType &item) │ │ │ │ │ +Add a new entry to the end of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:643 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +SLListIterator< T, A > iterator │ │ │ │ │ +The mutable iterator of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +Get an iterator pointing to the end of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:774 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_b_e_g_i_n_M_o_d_i_f_y │ │ │ │ │ +ModifyIterator beginModify() │ │ │ │ │ +Get an iterator capable of deleting and inserting elements. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:787 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_<_ _R_e_m_o_t_e_I_n_d_e_x_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +SLListConstIterator< RemoteIndex, Allocator > const_iterator │ │ │ │ │ +The constant iterator of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListModifyIterator< T, A > ModifyIterator │ │ │ │ │ +The type of the iterator capable of deletion and insertion. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:103 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +Get an iterator pointing to the first element in the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:762 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator<(const │ │ │ │ │ +RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ +RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ +Comparison operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:637 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for equality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for inequality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_I_t_e_r_a_t_o_r_s │ │ │ │ │ +Iterators() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:555 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +Dune::RemoteIndices< ParallelIndexSet > RemoteIndices │ │ │ │ │ +Type of the remote indices. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_O_l_d │ │ │ │ │ +bool isOld() const │ │ │ │ │ +Was this entry already in the remote index list before the sync process? │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:592 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n_:_:_p_u_b_l_i_s_h │ │ │ │ │ +int publish │ │ │ │ │ +The number of indices we publish for the other process. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s │ │ │ │ │ +void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T:: │ │ │ │ │ +GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, │ │ │ │ │ +RemoteIndices< T, A1 > &remoteIndices, const T &indexSet) │ │ │ │ │ +Repair the pointers to the local indices in the remote indices. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:487 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_A_t_E_n_d │ │ │ │ │ +bool isAtEnd() const │ │ │ │ │ +Are we at the end of the list? │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:614 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ │ +Type of the global index used in the index set. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n_:_:_p_a_i_r_s │ │ │ │ │ +int pairs │ │ │ │ │ +The number of pairs (attribute and process number) we publish to the neighbour │ │ │ │ │ +process. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ │ +Attribute & attribute() const │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +Iterators & operator++() │ │ │ │ │ +Increment all iteraors. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ +ParallelIndexSet::LocalIndex::Attribute Attribute │ │ │ │ │ +Type of the attribute used in the index set. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_g_l_o_b_a_l_I_n_d_e_x_P_a_i_r │ │ │ │ │ +std::pair< GlobalIndex, Attribute > & globalIndexPair() const │ │ │ │ │ +Get the global index of the remote index at current position. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:586 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r │ │ │ │ │ +IndicesSyncer(ParallelIndexSet &indexSet, RemoteIndices &remoteIndices) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:536 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_s_e_t │ │ │ │ │ +void reset(RemoteIndexList &remoteIndices, GlobalIndexList &globalIndices, │ │ │ │ │ +BoolList &booleans) │ │ │ │ │ +Reset all the underlying iterators. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:598 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_D_e_f_a_u_l_t_N_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +std::size_t operator()(const GlobalIndex &global) │ │ │ │ │ +Provide the local index, always std::numeric_limits::max() │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:145 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +T ParallelIndexSet │ │ │ │ │ +The type of the index set. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_N_o_t_A_t_E_n_d │ │ │ │ │ +bool isNotAtEnd() const │ │ │ │ │ +Are we not at the end of the list? │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:608 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +TG GlobalIndex │ │ │ │ │ +the type of the global index. This type has to provide at least a operator< for │ │ │ │ │ +sorting. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:226 │ │ │ │ │ +_D_u_n_e_:_:_s_t_o_r_e_G_l_o_b_a_l_I_n_d_i_c_e_s_O_f_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +void storeGlobalIndicesOfRemoteIndices(std::map< int, SLList< std::pair< │ │ │ │ │ +typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, │ │ │ │ │ +const RemoteIndices< T, A1 > &remoteIndices) │ │ │ │ │ +Stores the corresponding global indices of the remote index information. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:461 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_s_y_n_c │ │ │ │ │ +void sync() │ │ │ │ │ +Sync the index set. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:728 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_s_e_q_N_o │ │ │ │ │ +int seqNo() const │ │ │ │ │ +Get the internal sequence number. │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ +ParallelIndexSet::IndexPair IndexPair │ │ │ │ │ +The type of the index pair. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +RemoteIndex & remoteIndex() const │ │ │ │ │ +Get the remote index at current position. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:579 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +MessageInformation() │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:122 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_n_s_e_r_t │ │ │ │ │ +void insert(const RemoteIndex &index, const std::pair< GlobalIndex, Attribute > │ │ │ │ │ +&global) │ │ │ │ │ +Insert a new remote index to the underlying remote index list. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:569 │ │ │ │ │ +_D_u_n_e_:_:_d_v_v_e_r_b │ │ │ │ │ +DVVerbType dvverb(std::cout) │ │ │ │ │ +stream for very verbose output. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_d_v_e_r_b │ │ │ │ │ +DVerbType dverb(std::cout) │ │ │ │ │ +Singleton of verbose debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:116 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_i_o │ │ │ │ │ -Inserter< V > io(const V &v) │ │ │ │ │ -DDeeffiinniittiioonn io.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r │ │ │ │ │ -DDeeffiinniittiioonn io.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_:_:_I_n_s_e_r_t_e_r │ │ │ │ │ -Inserter(const T &value) │ │ │ │ │ -DDeeffiinniittiioonn io.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -friend Stream & operator<<(Stream &out, const Inserter &ins) │ │ │ │ │ -DDeeffiinniittiioonn io.hh:37 │ │ │ │ │ -_s_i_m_d_._h_h │ │ │ │ │ -Include file for users of the SIMD abstraction layer. │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_:_:_g_e_t_T_y_p_e │ │ │ │ │ +static MPI_Datatype getType() │ │ │ │ │ +DDeeffiinniittiioonn mpitraits.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ +A pair consisting of a global and local index. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r │ │ │ │ │ +Class for recomputing missing indices of a distributed index set. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +An index present on the local process with an additional attribute flag. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +The indices present on remote processes. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +MPI_Comm communicator() const │ │ │ │ │ +Get the mpi communicator used. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1696 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +Get an iterator over all remote index lists. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1529 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_n_e_i_g_h_b_o_u_r_s │ │ │ │ │ +int neighbours() const │ │ │ │ │ +Get the number of processors we share indices with. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1446 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > │ │ │ │ │ +Allocator │ │ │ │ │ +The type of the allocator for the remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +Get an iterator over all remote index lists. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1522 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +Information about an index residing on another processor. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +A mutable iterator for the SLList. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t │ │ │ │ │ +A single linked list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:44 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00074.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: test.hh File Reference │ │ │ │ +dune-common: remoteindices.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,496 +65,89 @@ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ -Typedefs
│ │ │ │ -
test.hh File Reference
│ │ │ │ +Functions
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Common tests for simd abstraction implementations. │ │ │ │ +

Classes describing a distributed indexset. │ │ │ │ More...

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <cstddef>
│ │ │ │ +
#include <cassert>
│ │ │ │ #include <iostream>
│ │ │ │ -#include <sstream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <typeindex>
│ │ │ │ -#include <typeinfo>
│ │ │ │ -#include <unordered_set>
│ │ │ │ +#include <ostream>
│ │ │ │ +#include <map>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <set>
│ │ │ │ #include <utility>
│ │ │ │ -#include <dune/common/classname.hh>
│ │ │ │ -#include <dune/common/hybridutilities.hh>
│ │ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ │ -#include <dune/common/simd/io.hh>
│ │ │ │ -#include <dune/common/simd/loop.hh>
│ │ │ │ -#include <dune/common/simd/simd.hh>
│ │ │ │ -#include <dune/common/std/type_traits.hh>
│ │ │ │ -#include <dune/common/typelist.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <mpi.h>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/parallel/indexset.hh>
│ │ │ │ +#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ +#include <dune/common/parallel/plocalindex.hh>
│ │ │ │ +#include <dune/common/sllist.hh>
│ │ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Simd::EndMark
 final element marker for RebindList More...
class  Dune::MPITraits< IndexPair< TG, ParallelLocalIndex< TA > > >
 
class  Dune::Simd::UnitTest
class  Dune::RemoteIndex< T1, T2 >
 Information about an index residing on another processor. More...
 
class  Dune::RemoteIndices< T, A >
 The indices present on remote processes. More...
 
class  Dune::RemoteIndexListModifier< T, A, mode >
 Modifier for adding and/or deleting remote indices from the remote index list. More...
 
class  Dune::RemoteIndexListModifier< T, A, mode >::InvalidPosition
 
class  Dune::CollectiveIterator< T, A >
 A collective iterator for moving over the remote indices for all processes collectively. More...
 
class  Dune::CollectiveIterator< T, A >::iterator
 Iterator over the valid underlying iterators. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Simd
 Namespace for vectorization interface functions used by library developers.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Macros

#define DUNE_SIMD_CHECK(expr)    ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr))
 
#define DUNE_SIMD_CHECK_OP(expr)
 
#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL)
 
#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL)
 
#define DUNE_SIMD_OPNAME   (className<Op(V)>())
 
#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL)
 
#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL)
 
#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL)
 
#define DUNE_SIMD_OPNAME   (className<OpInfixComma(T1, T2)>())
 
#define DUNE_SIMD_OPNAME   (className<Op(V1, V2)>())
 
#define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
 
#define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
 
#define DUNE_SIMD_OPNAME   (className<Op(V1, P2)>())
 
#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME)
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Typedefs

template<class... Types>
using Dune::Simd::RebindList = typename Impl::RemoveEnd< EndMark, TypeList< Types... > >::type
 A list of types with the final element removed.
 
template<class T >
using Dune::Simd::IsLoop = typename Impl::IsLoop< T >::type
 check whether a type is an instance of LoopSIMD
 

│ │ │ │ +Functions

template<typename T1 , typename T2 >
std::ostream & Dune::operator<< (std::ostream &os, const RemoteIndex< T1, T2 > &index)
 
template<class T , class A >
std::ostream & Dune::operator<< (std::ostream &os, const RemoteIndices< T, A > &indices)
 
template<typename TG , typename TA >
std::ostream & Dune::operator<< (std::ostream &os, const RemoteIndex< TG, TA > &index)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Common tests for simd abstraction implementations.

│ │ │ │ -

This file is an interface header and may be included without restrictions.

│ │ │ │ -

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_ASSIGN_OP

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_ASSIGN_OP( NAME,
 SYMBOL 
)
│ │ │ │ -
│ │ │ │ -Value:
struct OpInfix##NAME \
│ │ │ │ -
{ \
│ │ │ │ -
template<class V1, class V2> \
│ │ │ │ -
decltype(auto) operator()(V1&& v1, V2&& v2) const \
│ │ │ │ -
{ \
│ │ │ │ -
return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
│ │ │ │ -
} \
│ │ │ │ -
template<class S1, class S2> \
│ │ │ │ -
auto scalar(S1& s1, S2&& s2) const \
│ │ │ │ -
-> decltype(s1 SYMBOL std::forward<S2>(s2)); \
│ │ │ │ -
}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_CHECK

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_CHECK( expr)    ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr))
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_CHECK_OP

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_CHECK_OP( expr)
│ │ │ │ -
│ │ │ │ -Value:
((expr) ? void() : complain(__FILE__, __LINE__, __func__, \
│ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_OPNAME
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_DO

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_DO( M1,
 M2,
 M3,
 V1,
 V2,
 V3,
 NAME 
)
│ │ │ │ -
│ │ │ │ -Value:
checker(bool_constant<isMask ? do_##M1 : do_##V1>{}, \
│ │ │ │ -
bool_constant<isMask ? do_##M2 : do_##V2>{}, \
│ │ │ │ -
bool_constant<isMask ? do_##M3 : do_##V3>{}, \
│ │ │ │ -
Op##NAME{})
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_INFIX_OP

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_INFIX_OP( NAME,
 SYMBOL 
)
│ │ │ │ -
│ │ │ │ -Value:
struct OpInfix##NAME \
│ │ │ │ -
{ \
│ │ │ │ -
template<class V1, class V2> \
│ │ │ │ -
decltype(auto) operator()(V1&& v1, V2&& v2) const \
│ │ │ │ -
{ \
│ │ │ │ -
return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
│ │ │ │ -
} \
│ │ │ │ -
template<class S1, class S2> \
│ │ │ │ -
auto scalar(S1&& s1, S2&& s2) const \
│ │ │ │ -
-> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
│ │ │ │ -
}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_OPNAME [1/6]

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_OPNAME   (className<Op(V)>())
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_OPNAME [2/6]

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_OPNAME   (className<OpInfixComma(T1, T2)>())
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_OPNAME [3/6]

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_OPNAME   (className<Op(V1, V2)>())
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_OPNAME [4/6]

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_OPNAME [5/6]

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_OPNAME [6/6]

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_OPNAME   (className<Op(V1, P2)>())
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_POSTFIX_OP

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_POSTFIX_OP( NAME,
 SYMBOL 
)
│ │ │ │ -
│ │ │ │ -Value:
struct OpPostfix##NAME \
│ │ │ │ -
{ \
│ │ │ │ -
template<class V> \
│ │ │ │ -
auto operator()(V&& v) const \
│ │ │ │ -
-> decltype(std::forward<V>(v) SYMBOL) \
│ │ │ │ -
{ \
│ │ │ │ -
return std::forward<V>(v) SYMBOL; \
│ │ │ │ -
} \
│ │ │ │ -
}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_PREFIX_OP

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_PREFIX_OP( NAME,
 SYMBOL 
)
│ │ │ │ -
│ │ │ │ -Value:
struct OpPrefix##NAME \
│ │ │ │ -
{ \
│ │ │ │ -
template<class V> \
│ │ │ │ -
auto operator()(V&& v) const \
│ │ │ │ -
-> decltype(SYMBOL std::forward<V>(v)) \
│ │ │ │ -
{ \
│ │ │ │ -
return SYMBOL std::forward<V>(v); \
│ │ │ │ -
} \
│ │ │ │ -
}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_SIMD_REPL_OP

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_SIMD_REPL_OP( NAME,
 REPLFN,
 SYMBOL 
)
│ │ │ │ -
│ │ │ │ -Value:
struct OpInfix##NAME \
│ │ │ │ -
{ \
│ │ │ │ -
template<class V1, class V2> \
│ │ │ │ -
decltype(auto) operator()(V1&& v1, V2&& v2) const \
│ │ │ │ -
{ \
│ │ │ │ -
return Simd::REPLFN(std::forward<V1>(v1), std::forward<V2>(v2)); \
│ │ │ │ -
} \
│ │ │ │ -
template<class S1, class S2> \
│ │ │ │ -
auto scalar(S1&& s1, S2&& s2) const \
│ │ │ │ -
-> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
│ │ │ │ -
}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +

Classes describing a distributed indexset.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,203 +1,72 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s | _T_y_p_e_d_e_f_s │ │ │ │ │ -test.hh File Reference │ │ │ │ │ -Common tests for simd abstraction implementations. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ +remoteindices.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ +Classes describing a distributed indexset. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_y_b_r_i_d_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_o_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_l_o_o_p_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_d_e_x_s_e_t_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_p_l_o_c_a_l_i_n_d_e_x_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_l_l_i_s_t_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_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_:_:_S_i_m_d_:_:_E_n_d_M_a_r_k │ │ │ │ │ -  final element marker for RebindList _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_<_ _I_n_d_e_x_P_a_i_r_<_ _T_G_,_ _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_A_ _>_ _>_ _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t │ │ │ │ │ +class   _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_<_ _T_1_,_ _T_2_ _> │ │ │ │ │ +  Information about an index residing on another processor. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ -  Namespace for vectorization interface functions used by library │ │ │ │ │ - developers. │ │ │ │ │ -  │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___C_H_E_C_K(expr)    ((expr) ? void() : complain(__FILE__, │ │ │ │ │ - __LINE__, __func__, #expr)) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(expr) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P(NAME, SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P(NAME, SYMBOL) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +class   _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_<_ _T_,_ _A_ _> │ │ │ │ │ +  The indices present on remote processes. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(NAME, SYMBOL) │ │ │ │ │ +class   _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_ _T_,_ _A_,_ _m_o_d_e_ _> │ │ │ │ │ +  Modifier for adding and/or deleting remote indices from the remote │ │ │ │ │ + index list. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(NAME, SYMBOL) │ │ │ │ │ +class   _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_ _T_,_ _A_,_ _m_o_d_e_ _>_:_:_I_n_v_a_l_i_d_P_o_s_i_t_i_o_n │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___R_E_P_L___O_P(NAME, REPLFN, SYMBOL) │ │ │ │ │ +class   _D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_ _T_,_ _A_ _> │ │ │ │ │ +  A collective iterator for moving over the remote indices for all │ │ │ │ │ + processes collectively. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +class   _D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_ _T_,_ _A_ _>_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +  Iterator over the valid underlying iterators. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___S_I_M_D___D_O(M1, M2, M3, V1, V2, V3, NAME) │ │ │ │ │ -  │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_S_i_m_d_:_:_R_e_b_i_n_d_L_i_s_t = typename Impl::RemoveEnd< _E_n_d_M_a_r_k, _T_y_p_e_L_i_s_t< │ │ │ │ │ - Types... > >::type │ │ │ │ │ -  A list of types with the final element removed. │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_S_i_m_d_:_:_I_s_L_o_o_p = typename Impl::IsLoop< T >::type │ │ │ │ │ -  check whether a type is an instance of _L_o_o_p_S_I_M_D │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _R_e_m_o_t_e_I_n_d_e_x< T1, T2 > │ │ │ │ │ + &index) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _R_e_m_o_t_e_I_n_d_i_c_e_s< T, A > │ │ │ │ │ + &indices) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _R_e_m_o_t_e_I_n_d_e_x< TG, TA > │ │ │ │ │ + &index) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Common tests for simd abstraction implementations. │ │ │ │ │ -This file is an interface header and may be included without restrictions. │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__AASSSSIIGGNN__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_ASSIGN_OP (   NAME, │ │ │ │ │ -   SYMBOL  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -struct OpInfix##NAME \ │ │ │ │ │ -{ \ │ │ │ │ │ -template \ │ │ │ │ │ -decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ -{ \ │ │ │ │ │ -return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ -} \ │ │ │ │ │ -template \ │ │ │ │ │ -auto scalar(S1& s1, S2&& s2) const \ │ │ │ │ │ --> decltype(s1 SYMBOL std::forward(s2)); \ │ │ │ │ │ -} │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__CCHHEECCKK ********** │ │ │ │ │ -#define DUNE_SIMD_CHECK (   expr )     ((expr) ? void() : complain(__FILE__, │ │ │ │ │ - __LINE__, __func__, #expr)) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__CCHHEECCKK__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_CHECK_OP (   expr ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -((expr) ? void() : complain(__FILE__, __LINE__, __func__, \ │ │ │ │ │ -_D_U_N_E___S_I_M_D___O_P_N_A_M_E, #expr)) │ │ │ │ │ -_D_U_N_E___S_I_M_D___O_P_N_A_M_E │ │ │ │ │ -#define DUNE_SIMD_OPNAME │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__DDOO ********** │ │ │ │ │ -#define DUNE_SIMD_DO (   M1, │ │ │ │ │ -   M2, │ │ │ │ │ -   M3, │ │ │ │ │ -   V1, │ │ │ │ │ -   V2, │ │ │ │ │ -   V3, │ │ │ │ │ -   NAME  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -checker(bool_constant{}, \ │ │ │ │ │ -bool_constant{}, \ │ │ │ │ │ -bool_constant{}, \ │ │ │ │ │ -Op##NAME{}) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__IINNFFIIXX__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_INFIX_OP (   NAME, │ │ │ │ │ -   SYMBOL  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -struct OpInfix##NAME \ │ │ │ │ │ -{ \ │ │ │ │ │ -template \ │ │ │ │ │ -decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ -{ \ │ │ │ │ │ -return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ -} \ │ │ │ │ │ -template \ │ │ │ │ │ -auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ --> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ -} │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[11//66]] ********** │ │ │ │ │ -#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[22//66]] ********** │ │ │ │ │ -#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[33//66]] ********** │ │ │ │ │ -#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[44//66]] ********** │ │ │ │ │ -#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[55//66]] ********** │ │ │ │ │ -#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[66//66]] ********** │ │ │ │ │ -#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__PPOOSSTTFFIIXX__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_POSTFIX_OP (   NAME, │ │ │ │ │ -   SYMBOL  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -struct OpPostfix##NAME \ │ │ │ │ │ -{ \ │ │ │ │ │ -template \ │ │ │ │ │ -auto operator()(V&& v) const \ │ │ │ │ │ --> decltype(std::forward(v) SYMBOL) \ │ │ │ │ │ -{ \ │ │ │ │ │ -return std::forward(v) SYMBOL; \ │ │ │ │ │ -} \ │ │ │ │ │ -} │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__PPRREEFFIIXX__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_PREFIX_OP (   NAME, │ │ │ │ │ -   SYMBOL  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -struct OpPrefix##NAME \ │ │ │ │ │ -{ \ │ │ │ │ │ -template \ │ │ │ │ │ -auto operator()(V&& v) const \ │ │ │ │ │ --> decltype(SYMBOL std::forward(v)) \ │ │ │ │ │ -{ \ │ │ │ │ │ -return SYMBOL std::forward(v); \ │ │ │ │ │ -} \ │ │ │ │ │ -} │ │ │ │ │ -********** _?◆_? DDUUNNEE__SSIIMMDD__RREEPPLL__OOPP ********** │ │ │ │ │ -#define DUNE_SIMD_REPL_OP (   NAME, │ │ │ │ │ -   REPLFN, │ │ │ │ │ -   SYMBOL  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -struct OpInfix##NAME \ │ │ │ │ │ -{ \ │ │ │ │ │ -template \ │ │ │ │ │ -decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ -{ \ │ │ │ │ │ -return Simd::REPLFN(std::forward(v1), std::forward(v2)); \ │ │ │ │ │ -} \ │ │ │ │ │ -template \ │ │ │ │ │ -auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ --> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ -} │ │ │ │ │ +Classes describing a distributed indexset. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: test.hh Source File │ │ │ │ +dune-common: remoteindices.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,2026 +70,1697 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
test.hh
│ │ │ │ +
remoteindices.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_TEST_HH
│ │ │ │ -
4#define DUNE_COMMON_SIMD_TEST_HH
│ │ │ │ -
5
│ │ │ │ -
12#include <algorithm>
│ │ │ │ -
13#include <cstddef>
│ │ │ │ -
14#include <iostream>
│ │ │ │ -
15#include <sstream>
│ │ │ │ -
16#include <string>
│ │ │ │ -
17#include <type_traits>
│ │ │ │ -
18#include <typeindex>
│ │ │ │ -
19#include <typeinfo>
│ │ │ │ -
20#include <unordered_set>
│ │ │ │ -
21#include <utility>
│ │ │ │ -
22
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
32
│ │ │ │ -
33namespace Dune {
│ │ │ │ -
34 namespace Simd {
│ │ │ │ -
35
│ │ │ │ -
36 namespace Impl {
│ │ │ │ -
37
│ │ │ │ -
38 template<class T, class SFINAE = void>
│ │ │ │ -
39 struct LessThenComparable : std::false_type {};
│ │ │ │ -
40 template<class T>
│ │ │ │ -
41 struct LessThenComparable<T, std::void_t<decltype(std::declval<T>()
│ │ │ │ -
42 < std::declval<T>())> > :
│ │ │ │ -
43 std::true_type
│ │ │ │ -
44 {};
│ │ │ │ -
45
│ │ │ │ -
46 template<class Dst, class Src>
│ │ │ │ -
47 struct CopyConstHelper
│ │ │ │ -
48 {
│ │ │ │ -
49 using type = Dst;
│ │ │ │ -
50 };
│ │ │ │ -
51 template<class Dst, class Src>
│ │ │ │ -
52 struct CopyConstHelper<Dst, const Src>
│ │ │ │ -
53 {
│ │ │ │ -
54 using type = std::add_const_t<Dst>;
│ │ │ │ -
55 };
│ │ │ │ -
56
│ │ │ │ -
57 template<class Dst, class Src>
│ │ │ │ -
58 struct CopyVolatileHelper
│ │ │ │ -
59 {
│ │ │ │ -
60 using type = Dst;
│ │ │ │ -
61 };
│ │ │ │ -
62 template<class Dst, class Src>
│ │ │ │ -
63 struct CopyVolatileHelper<Dst, volatile Src>
│ │ │ │ -
64 {
│ │ │ │ -
65 using type = std::add_volatile_t<Dst>;
│ │ │ │ -
66 };
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ +
5#ifndef DUNE_REMOTEINDICES_HH
│ │ │ │ +
6#define DUNE_REMOTEINDICES_HH
│ │ │ │ +
7
│ │ │ │ +
8#if HAVE_MPI
│ │ │ │ +
9
│ │ │ │ +
10#include <cassert>
│ │ │ │ +
11#include <iostream>
│ │ │ │ +
12#include <ostream>
│ │ │ │ +
13#include <map>
│ │ │ │ +
14#include <memory>
│ │ │ │ +
15#include <set>
│ │ │ │ +
16#include <utility>
│ │ │ │ +
17#include <vector>
│ │ │ │ +
18
│ │ │ │ +
19#include <mpi.h>
│ │ │ │ +
20
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
25#include <dune/common/sllist.hh>
│ │ │ │ + │ │ │ │ +
27
│ │ │ │ +
28namespace Dune {
│ │ │ │ +
40 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
42 {
│ │ │ │ +
43 public:
│ │ │ │ +
44 inline static MPI_Datatype getType();
│ │ │ │ +
45 private:
│ │ │ │ +
46 static MPI_Datatype type;
│ │ │ │ +
47 };
│ │ │ │ +
│ │ │ │ +
48
│ │ │ │ +
49
│ │ │ │ +
50 template<typename T, typename A>
│ │ │ │ +
51 class RemoteIndices;
│ │ │ │ +
52
│ │ │ │ +
53 template<typename T1, typename T2>
│ │ │ │ +
54 class RemoteIndex;
│ │ │ │ +
55
│ │ │ │ +
56 // forward declaration needed for friend declaration.
│ │ │ │ +
57 template<typename T>
│ │ │ │ +
58 class IndicesSyncer;
│ │ │ │ +
59
│ │ │ │ +
60 template<typename T1, typename T2>
│ │ │ │ +
61 std::ostream& operator<<(std::ostream& os, const RemoteIndex<T1,T2>& index);
│ │ │ │ +
62
│ │ │ │ +
63
│ │ │ │ +
64 template<typename T, typename A, bool mode>
│ │ │ │ + │ │ │ │ +
66
│ │ │ │
67
│ │ │ │ -
68 template<class Dst, class Src>
│ │ │ │ -
69 struct CopyReferenceHelper
│ │ │ │ -
70 {
│ │ │ │ -
71 using type = Dst;
│ │ │ │ -
72 };
│ │ │ │ -
73 template<class Dst, class Src>
│ │ │ │ -
74 struct CopyReferenceHelper<Dst, Src&>
│ │ │ │ -
75 {
│ │ │ │ -
76 using type = std::add_lvalue_reference_t<Dst>;
│ │ │ │ -
77 };
│ │ │ │ -
78
│ │ │ │ -
79 template<class Dst, class Src>
│ │ │ │ -
80 struct CopyReferenceHelper<Dst, Src&&>
│ │ │ │ -
81 {
│ │ │ │ -
82 using type = std::add_rvalue_reference_t<Dst>;
│ │ │ │ -
83 };
│ │ │ │ +
71 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
73 {
│ │ │ │ +
74 template<typename T>
│ │ │ │ +
75 friend class IndicesSyncer;
│ │ │ │ +
76
│ │ │ │ +
77 template<typename T, typename A, typename A1>
│ │ │ │ +
78 friend void repairLocalIndexPointers(std::map<int,SLList<std::pair<typename T::GlobalIndex, typename T::LocalIndex::Attribute>,A> >&,
│ │ │ │ + │ │ │ │ +
80 const T&);
│ │ │ │ +
81
│ │ │ │ +
82 template<typename T, typename A, bool mode>
│ │ │ │ + │ │ │ │
84
│ │ │ │ -
85 template<class Dst, class Src>
│ │ │ │ -
86 using CopyRefQual = typename CopyReferenceHelper<
│ │ │ │ -
87 typename CopyVolatileHelper<
│ │ │ │ -
88 typename CopyConstHelper<
│ │ │ │ -
89 std::decay_t<Dst>,
│ │ │ │ -
90 std::remove_reference_t<Src>
│ │ │ │ -
91 >::type,
│ │ │ │ -
92 std::remove_reference_t<Src>
│ │ │ │ -
93 >::type,
│ │ │ │ -
94 Src
│ │ │ │ -
95 >::type;
│ │ │ │ -
96
│ │ │ │ -
97 template<class Mark, class Types,
│ │ │ │ -
98 class Indices =
│ │ │ │ -
99 std::make_index_sequence<TypeListSize<Types>::value - 1> >
│ │ │ │ -
100 struct RemoveEnd;
│ │ │ │ -
101 template<class Mark, class Types, std::size_t... I>
│ │ │ │ -
102 struct RemoveEnd<Mark, Types, std::index_sequence<I...>>
│ │ │ │ -
103 {
│ │ │ │ -
104 using Back = TypeListEntry_t<TypeListSize<Types>::value - 1, Types>;
│ │ │ │ -
105 static_assert(std::is_same<Mark, Back>::value,
│ │ │ │ -
106 "TypeList not terminated by proper EndMark");
│ │ │ │ -
107 using type = TypeList<TypeListEntry_t<I, Types>...>;
│ │ │ │ -
108 };
│ │ │ │ -
109
│ │ │ │ -
110 template<class T, class List, class = void>
│ │ │ │ -
111 struct TypeInList;
│ │ │ │ +
85 public:
│ │ │ │ +
90 typedef T1 GlobalIndex;
│ │ │ │ +
99 typedef T2 Attribute;
│ │ │ │ +
100
│ │ │ │ + │ │ │ │ + │ │ │ │ +
106
│ │ │ │ +
111 const Attribute attribute() const;
│ │ │ │
112
│ │ │ │ -
113 template<class T>
│ │ │ │ -
114 struct TypeInList<T, TypeList<> > : std::false_type {};
│ │ │ │ -
115
│ │ │ │ -
116 template<class T, class... Rest>
│ │ │ │ -
117 struct TypeInList<T, TypeList<T, Rest...> > : std::true_type {};
│ │ │ │ -
118
│ │ │ │ -
119 template<class T, class Head, class... Rest>
│ │ │ │ -
120 struct TypeInList<T, TypeList<Head, Rest...>,
│ │ │ │ -
121 std::enable_if_t<!std::is_same<T, Head>::value> > :
│ │ │ │ -
122 TypeInList<T, TypeList<Rest...> >::type
│ │ │ │ -
123 {};
│ │ │ │ +
118 const PairType& localIndexPair() const;
│ │ │ │ +
119
│ │ │ │ +
123 RemoteIndex();
│ │ │ │
124
│ │ │ │ -
125 template<class T>
│ │ │ │ -
126 struct IsLoop : std::false_type {};
│ │ │ │ -
127 template<class T, std::size_t S>
│ │ │ │ -
128 struct IsLoop<LoopSIMD<T, S> > : std::true_type {};
│ │ │ │ -
129
│ │ │ │ -
130 // used inside static_assert to trick the compiler into printing a list
│ │ │ │ -
131 // of types:
│ │ │ │ -
132 //
│ │ │ │ -
133 // static_assert(debugTypes<V>(Std::bool_constant<condition>{}), "msg");
│ │ │ │ -
134 //
│ │ │ │ -
135 // Should include what the type `V` expands to in the error message.
│ │ │ │ -
136 template<class...>
│ │ │ │ -
137 constexpr bool debugTypes(std::true_type) { return true; }
│ │ │ │ -
138 template<class... Types>
│ │ │ │ -
139 [[deprecated]]
│ │ │ │ -
140 constexpr bool debugTypes(std::false_type) { return false; }
│ │ │ │ +
125
│ │ │ │ +
131 RemoteIndex(const T2& attribute,
│ │ │ │ +
132 const PairType* local);
│ │ │ │ +
133
│ │ │ │ +
134
│ │ │ │ +
140 RemoteIndex(const T2& attribute);
│ │ │ │
141
│ │ │ │ -
142 } // namespace Impl
│ │ │ │ +
142 bool operator==(const RemoteIndex& ri) const;
│ │ │ │
143
│ │ │ │ -
145 struct EndMark {};
│ │ │ │ -
147
│ │ │ │ -
156 template<class... Types>
│ │ │ │ - │ │ │ │ -
158 typename Impl::RemoveEnd<EndMark, TypeList<Types...> >::type;
│ │ │ │ -
159
│ │ │ │ -
161 template<class T>
│ │ │ │ -
162 using IsLoop = typename Impl::IsLoop<T>::type;
│ │ │ │ -
163
│ │ │ │ -
│ │ │ │ -
164 class UnitTest {
│ │ │ │ -
165 bool good_ = true;
│ │ │ │ -
166 std::ostream &log_ = std::cerr;
│ │ │ │ -
167 // records the types for which checks have started running to avoid
│ │ │ │ -
168 // infinite recursion
│ │ │ │ -
169 std::unordered_set<std::type_index> seen_;
│ │ │ │ -
170
│ │ │ │ -
172 //
│ │ │ │ -
173 // Helper functions
│ │ │ │ -
174 //
│ │ │ │ -
175
│ │ │ │ -
176 void complain(const char *file, int line, const char *func,
│ │ │ │ -
177 const char *expr);
│ │ │ │ -
178
│ │ │ │ -
179 void complain(const char *file, int line, const char *func,
│ │ │ │ -
180 const std::string &opname, const char *expr);
│ │ │ │ -
181
│ │ │ │ -
182 // This macro is defined only within this file, do not use anywhere
│ │ │ │ -
183 // else. Doing the actual printing in an external function dramatically
│ │ │ │ -
184 // reduces memory use during compilation. Defined in such a way that
│ │ │ │ -
185 // the call will only happen for failed checks.
│ │ │ │ -
│ │ │ │ -
186#define DUNE_SIMD_CHECK(expr) \
│ │ │ │ -
187 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr))
│ │ │ │ -
│ │ │ │ -
188
│ │ │ │ -
189 // the function using this macro must define a way to compute the
│ │ │ │ -
190 // operator name in DUNE_SIMD_OPNAME
│ │ │ │ -
│ │ │ │ -
191#define DUNE_SIMD_CHECK_OP(expr) \
│ │ │ │ -
192 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, \
│ │ │ │ -
193 DUNE_SIMD_OPNAME, #expr))
│ │ │ │ -
│ │ │ │ -
194
│ │ │ │ -
195 // "cast" into a prvalue
│ │ │ │ -
196 template<class T>
│ │ │ │ -
197 static std::decay_t<T> prvalue(T &&t)
│ │ │ │ -
198 {
│ │ │ │ -
199 return std::forward<T>(t);
│ │ │ │ -
200 }
│ │ │ │ -
201
│ │ │ │ -
202 // whether the vector is 42 in all lanes
│ │ │ │ -
203 template<class V>
│ │ │ │ -
204 static bool is42(const V &v)
│ │ │ │ -
205 {
│ │ │ │ -
206 bool good = true;
│ │ │ │ +
144 bool operator!=(const RemoteIndex& ri) const;
│ │ │ │ +
145 private:
│ │ │ │ +
147 const PairType* localIndex_;
│ │ │ │ +
148
│ │ │ │ +
150 char attribute_;
│ │ │ │ +
151 };
│ │ │ │ +
│ │ │ │ +
152
│ │ │ │ +
153 template<class T, class A>
│ │ │ │ +
154 std::ostream& operator<<(std::ostream& os, const RemoteIndices<T,A>& indices);
│ │ │ │ +
155
│ │ │ │ +
156 class InterfaceBuilder;
│ │ │ │ +
157
│ │ │ │ +
158 template<class T, class A>
│ │ │ │ +
159 class CollectiveIterator;
│ │ │ │ +
160
│ │ │ │ +
161 // forward declaration needed for friend declaration.
│ │ │ │ +
162 template<class T>
│ │ │ │ +
163 class IndicesSyncer;
│ │ │ │ +
164
│ │ │ │ +
165 // forward declaration needed for friend declaration.
│ │ │ │ +
166 template<typename T1, typename T2>
│ │ │ │ + │ │ │ │ +
168
│ │ │ │ +
169
│ │ │ │ +
186 template<class T, class A=std::allocator<RemoteIndex<typename T::GlobalIndex,
│ │ │ │ +
187 typename T::LocalIndex::Attribute> > >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
189 {
│ │ │ │ +
190 friend class InterfaceBuilder;
│ │ │ │ +
191 friend class IndicesSyncer<T>;
│ │ │ │ +
192 template<typename T1, typename A2, typename A1>
│ │ │ │ +
193 friend void repairLocalIndexPointers(std::map<int,SLList<std::pair<typename T1::GlobalIndex, typename T1::LocalIndex::Attribute>,A2> >&,
│ │ │ │ + │ │ │ │ +
195 const T1&);
│ │ │ │ +
196
│ │ │ │ +
197 template<class G, class T1, class T2>
│ │ │ │ + │ │ │ │ +
199 friend std::ostream& operator<<<>(std::ostream&, const RemoteIndices<T>&);
│ │ │ │ +
200
│ │ │ │ +
201 public:
│ │ │ │ +
202
│ │ │ │ + │ │ │ │
207
│ │ │ │ -
208 for(std::size_t l = 0; l < lanes(v); ++l)
│ │ │ │ -
209 // need to cast in case we have a mask type
│ │ │ │ -
210 good &= (lane(l, v) == Scalar<V>(42));
│ │ │ │ + │ │ │ │
211
│ │ │ │ -
212 return good;
│ │ │ │ -
213 }
│ │ │ │ -
214
│ │ │ │ -
215 // make a vector that contains the sequence { 1, 2, ... }
│ │ │ │ -
216 template<class V>
│ │ │ │ -
217 static V make123()
│ │ │ │ -
218 {
│ │ │ │ -
219 // initialize to avoid undefined behaviour if assigning to lane()
│ │ │ │ -
220 // involves lvalue-to-rvalue conversions, e.g. due to bitmask
│ │ │ │ -
221 // operations. Avoid using broadcast<V>() for initialization to avoid
│ │ │ │ -
222 // test interdependencies.
│ │ │ │ -
223 V vec(Scalar<V>(0));
│ │ │ │ -
224 for(std::size_t l = 0; l < lanes(vec); ++l)
│ │ │ │ -
225 lane(l, vec) = l + 1;
│ │ │ │ -
226 return vec;
│ │ │ │ -
227 }
│ │ │ │ -
228
│ │ │ │ -
229 // whether the vector contains the sequence { 1, 2, ... }
│ │ │ │ -
230 template<class V>
│ │ │ │ -
231 static bool is123(const V &v)
│ │ │ │ -
232 {
│ │ │ │ -
233 bool good = true;
│ │ │ │ -
234
│ │ │ │ -
235 for(std::size_t l = 0; l < lanes(v); ++l)
│ │ │ │ -
236 // need to cast in case we have a mask type
│ │ │ │ -
237 good &= (lane(l, v) == Scalar<V>(l+1));
│ │ │ │ + │ │ │ │ +
216
│ │ │ │ +
217
│ │ │ │ + │ │ │ │ +
222
│ │ │ │ +
226 typedef typename LocalIndex::Attribute Attribute;
│ │ │ │ +
227
│ │ │ │ + │ │ │ │ +
232
│ │ │ │ +
233
│ │ │ │ +
237 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<RemoteIndex>;
│ │ │ │
238
│ │ │ │ -
239 return good;
│ │ │ │ -
240 }
│ │ │ │ -
241
│ │ │ │ -
242 template<class V>
│ │ │ │ -
243 static V leftVector()
│ │ │ │ -
244 {
│ │ │ │ -
245 // Avoid using broadcast<V>() for initialization to avoid test
│ │ │ │ -
246 // interdependencies.
│ │ │ │ -
247 V res(Scalar<V>(0));
│ │ │ │ -
248 for(std::size_t l = 0; l < lanes(res); ++l)
│ │ │ │ -
249 lane(l, res) = Scalar<V>(l+1);
│ │ │ │ -
250 return res;
│ │ │ │ -
251 }
│ │ │ │ -
252
│ │ │ │ -
253 template<class V>
│ │ │ │ -
254 static V rightVector()
│ │ │ │ -
255 {
│ │ │ │ -
256 // Avoid using broadcast<V>() for initialization to avoid test
│ │ │ │ -
257 // interdependencies.
│ │ │ │ -
258 V res(Scalar<V>(0));
│ │ │ │ -
259 for(std::size_t l = 0; l < lanes(res); ++l)
│ │ │ │ -
260 // do not exceed number of bits in char (for shifts)
│ │ │ │ -
261 // avoid 0 (for / and %)
│ │ │ │ -
262 lane(l, res) = Scalar<V>((l)%7+1);
│ │ │ │ -
263 return res;
│ │ │ │ -
264 }
│ │ │ │ -
265
│ │ │ │ -
266 template<class T>
│ │ │ │ -
267 static T leftScalar()
│ │ │ │ -
268 {
│ │ │ │ -
269 return T(42);
│ │ │ │ -
270 }
│ │ │ │ -
271
│ │ │ │ -
272 template<class T>
│ │ │ │ -
273 static T rightScalar()
│ │ │ │ -
274 {
│ │ │ │ -
275 // do not exceed number of bits in char (for shifts)
│ │ │ │ -
276 // avoid 0 (for / and %)
│ │ │ │ -
277 return T(5);
│ │ │ │ -
278 }
│ │ │ │ + │ │ │ │ + │ │ │ │ +
242
│ │ │ │ +
244 typedef std::map<int, std::pair<RemoteIndexList*,RemoteIndexList*> >
│ │ │ │ + │ │ │ │ +
246
│ │ │ │ +
247 typedef typename RemoteIndexMap::const_iterator const_iterator;
│ │ │ │ +
248
│ │ │ │ +
266 inline RemoteIndices(const ParallelIndexSet& source, const ParallelIndexSet& destination,
│ │ │ │ +
267 const MPI_Comm& comm, const std::vector<int>& neighbours=std::vector<int>(), bool includeSelf=false);
│ │ │ │ +
268
│ │ │ │ + │ │ │ │ +
270
│ │ │ │ +
278 void setIncludeSelf(bool includeSelf);
│ │ │ │
279
│ │ │ │ -
280 template<class Dst, class Src>
│ │ │ │ -
281 using CopyRefQual = Impl::CopyRefQual<Dst, Src>;
│ │ │ │ -
282
│ │ │ │ -
283 // test whether the Op supports the operation on scalars. We do not use
│ │ │ │ -
284 // `lane()` to obtain the scalars, because that might return a proxy
│ │ │ │ -
285 // object, and we are interested in what exactly the scalar type can do,
│ │ │ │ -
286 // no a proxy that might have more overloads than needed. In addition,
│ │ │ │ -
287 // `lane()` may not preserve `const` and reference qualifiers.
│ │ │ │ -
288 template<class Op, class... Vectors>
│ │ │ │ -
289 using ScalarResult =
│ │ │ │ -
290 decltype(std::declval<Op>().
│ │ │ │ -
291 scalar(std::declval<CopyRefQual<Scalar<Vectors>,
│ │ │ │ -
292 Vectors> >()...));
│ │ │ │ -
293
│ │ │ │ -
295 //
│ │ │ │ -
296 // Check associated types
│ │ │ │ -
297 //
│ │ │ │ +
296 void setIndexSets(const ParallelIndexSet& source, const ParallelIndexSet& destination,
│ │ │ │ +
297 const MPI_Comm& comm, const std::vector<int>& neighbours=std::vector<int>());
│ │ │ │
298
│ │ │ │ -
299 template<class V>
│ │ │ │ -
300 void checkScalar()
│ │ │ │ -
301 {
│ │ │ │ -
302 // check that the type Scalar<V> exists
│ │ │ │ -
303 using T = Scalar<V>;
│ │ │ │ +
299 template<typename C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
301 {
│ │ │ │ +
302 neighbourIds.clear();
│ │ │ │ +
303 neighbourIds.insert(neighbours.begin(), neighbours.end());
│ │ │ │
304
│ │ │ │ -
305 static_assert(std::is_same<T, std::decay_t<T> >::value, "Scalar types "
│ │ │ │ -
306 "must not be references, and must not include "
│ │ │ │ -
307 "cv-qualifiers");
│ │ │ │ -
308 [[maybe_unused]] T a{};
│ │ │ │ -
309 }
│ │ │ │ -
310
│ │ │ │ -
311 template<class V>
│ │ │ │ -
312 [[deprecated("Warning: please include bool in the Rebinds for "
│ │ │ │ -
313 "simd type V, as Masks are not checked otherwise.")]]
│ │ │ │ -
314 void warnMissingMaskRebind(std::true_type) {}
│ │ │ │ -
315 template<class V>
│ │ │ │ -
316 void warnMissingMaskRebind(std::false_type) {}
│ │ │ │ -
317
│ │ │ │ -
318 template<class V, class Rebinds, template<class> class RebindPrune,
│ │ │ │ -
319 template<class> class RebindAccept, class Recurse>
│ │ │ │ -
320 void checkRebindOf(Recurse recurse)
│ │ │ │ -
321 {
│ │ │ │ -
322 Hybrid::forEach(Rebinds{}, [this,recurse](auto target) {
│ │ │ │ -
323 using T = typename decltype(target)::type;
│ │ │ │ -
324
│ │ │ │ -
325 // check that the rebound type exists
│ │ │ │ -
326 using W = Rebind<T, V>;
│ │ │ │ -
327 log_ << "Type " << className<V>() << " rebound to "
│ │ │ │ -
328 << className<T>() << " is " << className<W>() << std::endl;
│ │ │ │ -
329
│ │ │ │ -
330 static_assert(std::is_same<W, std::decay_t<W> >::value, "Rebound "
│ │ │ │ -
331 "types must not be references, and must not include "
│ │ │ │ -
332 "cv-qualifiers");
│ │ │ │ -
333 static_assert(lanes<V>() == lanes<W>(), "Rebound types must have "
│ │ │ │ -
334 "the same number of lanes as the original vector "
│ │ │ │ -
335 "types");
│ │ │ │ -
336 static_assert(std::is_same<T, Scalar<W> >::value, "Rebound types "
│ │ │ │ -
337 "must have the bound-to scalar type");
│ │ │ │ -
338
│ │ │ │ -
339 if constexpr (RebindPrune<W>{}) {
│ │ │ │ -
340 log_ << "Pruning check of Simd type " << className<W>()
│ │ │ │ -
341 << std::endl;
│ │ │ │ -
342 }
│ │ │ │ -
343 else {
│ │ │ │ -
344 using Impl::debugTypes;
│ │ │ │ -
345 static_assert(debugTypes<T, V, W>(RebindAccept<W>{}),
│ │ │ │ -
346 "Rebind<T, V> is W, but that is not accepted "
│ │ │ │ -
347 "by RebindAccept");
│ │ │ │ -
348 recurse(MetaType<W>{});
│ │ │ │ -
349 }
│ │ │ │ -
350 });
│ │ │ │ -
351
│ │ │ │ -
352 static_assert(std::is_same<Rebind<Scalar<V>, V>, V>::value, "A type "
│ │ │ │ -
353 "rebound to its own scalar type must be the same type "
│ │ │ │ -
354 "as the original type");
│ │ │ │ -
355 static_assert(std::is_same<Rebind<bool, V>, Mask<V> >::value, "A type "
│ │ │ │ -
356 "rebound to bool must be the mask type for that type");
│ │ │ │ -
357
│ │ │ │ -
358 constexpr bool hasBool = Impl::TypeInList<bool, Rebinds>::value;
│ │ │ │ -
359 warnMissingMaskRebind<V>(Std::bool_constant<!hasBool>{});
│ │ │ │ -
360 }
│ │ │ │ +
305 }
│ │ │ │ +
│ │ │ │ +
306
│ │ │ │ +
│ │ │ │ +
307 const std::set<int>& getNeighbours() const
│ │ │ │ +
308 {
│ │ │ │ +
309 return neighbourIds;
│ │ │ │ +
310 }
│ │ │ │ +
│ │ │ │ +
311
│ │ │ │ + │ │ │ │ +
316
│ │ │ │ +
326 template<bool ignorePublic>
│ │ │ │ +
327 void rebuild();
│ │ │ │ +
328
│ │ │ │ +
329 bool operator==(const RemoteIndices& ri) const;
│ │ │ │ +
330
│ │ │ │ +
338 inline bool isSynced() const;
│ │ │ │ +
339
│ │ │ │ +
343 inline MPI_Comm communicator() const;
│ │ │ │ +
344
│ │ │ │ +
359 template<bool mode, bool send>
│ │ │ │ + │ │ │ │
361
│ │ │ │ -
363 //
│ │ │ │ -
364 // Fundamental checks
│ │ │ │ -
365 //
│ │ │ │ -
366
│ │ │ │ -
367 template<class V>
│ │ │ │ -
368 void checkLanes()
│ │ │ │ -
369 {
│ │ │ │ -
370 // check lanes
│ │ │ │ -
371 static_assert(std::is_same<std::size_t, decltype(lanes<V>())>::value,
│ │ │ │ -
372 "return type of lanes<V>() should be std::size_t");
│ │ │ │ -
373 static_assert(std::is_same<std::size_t, decltype(lanes(V{}))>::value,
│ │ │ │ -
374 "return type of lanes(V{}) should be std::size_t");
│ │ │ │ +
368 inline const_iterator find(int proc) const;
│ │ │ │ +
369
│ │ │ │ +
374 inline const_iterator begin() const;
│ │ │ │
375
│ │ │ │ -
376 // the result of lanes<V>() must be constexpr
│ │ │ │ -
377 [[maybe_unused]] constexpr auto size = lanes<V>();
│ │ │ │ -
378 // but the result of lanes(vec) does not need to be constexpr
│ │ │ │ -
379 DUNE_SIMD_CHECK(lanes<V>() == lanes(V{}));
│ │ │ │ -
380 }
│ │ │ │ +
380 inline const_iterator end() const;
│ │ │ │
381
│ │ │ │ -
382 template<class V>
│ │ │ │ -
383 void checkDefaultConstruct()
│ │ │ │ -
384 {
│ │ │ │ -
385 { [[maybe_unused]] V vec; }
│ │ │ │ -
386 { [[maybe_unused]] V vec{}; }
│ │ │ │ -
387 { [[maybe_unused]] V vec = {}; }
│ │ │ │ -
388 }
│ │ │ │ -
389
│ │ │ │ -
390 template<class V>
│ │ │ │ -
391 void checkLane()
│ │ │ │ -
392 {
│ │ │ │ -
393 // Avoid using broadcast<V>() for initialization to avoid test
│ │ │ │ -
394 // interdependencies.
│ │ │ │ -
395 V vec(Scalar<V>(0));
│ │ │ │ -
396 // check lane() on mutable lvalues
│ │ │ │ -
397 for(std::size_t l = 0; l < lanes(vec); ++l)
│ │ │ │ -
398 lane(l, vec) = l + 1;
│ │ │ │ -
399 for(std::size_t l = 0; l < lanes(vec); ++l)
│ │ │ │ -
400 DUNE_SIMD_CHECK(lane(l, vec) == Scalar<V>(l + 1));
│ │ │ │ -
401 using MLRes = decltype(lane(0, vec));
│ │ │ │ -
402 static_assert(std::is_same<MLRes, Scalar<V>&>::value ||
│ │ │ │ -
403 std::is_same<MLRes, std::decay_t<MLRes> >::value,
│ │ │ │ -
404 "Result of lane() on a mutable lvalue vector must "
│ │ │ │ -
405 "either be a mutable reference to a scalar of that "
│ │ │ │ -
406 "vector or a proxy object (which itself may not be a "
│ │ │ │ -
407 "reference nor const).");
│ │ │ │ +
385 template<bool send>
│ │ │ │ +
386 inline CollectiveIteratorT iterator() const;
│ │ │ │ +
387
│ │ │ │ +
391 inline void free();
│ │ │ │ +
392
│ │ │ │ +
397 inline int neighbours() const;
│ │ │ │ +
398
│ │ │ │ +
400 inline const ParallelIndexSet& sourceIndexSet() const;
│ │ │ │ +
401
│ │ │ │ +
403 inline const ParallelIndexSet& destinationIndexSet() const;
│ │ │ │ +
404
│ │ │ │ +
405 private:
│ │ │ │ +
407 RemoteIndices(const RemoteIndices&) = delete;
│ │ │ │
408
│ │ │ │ -
409 // check lane() on const lvalues
│ │ │ │ -
410 const V &vec2 = vec;
│ │ │ │ -
411 for(std::size_t l = 0; l < lanes(vec); ++l)
│ │ │ │ -
412 DUNE_SIMD_CHECK(lane(l, vec2) == Scalar<V>(l + 1));
│ │ │ │ -
413 using CLRes = decltype(lane(0, vec2));
│ │ │ │ -
414 static_assert(std::is_same<CLRes, const Scalar<V>&>::value ||
│ │ │ │ -
415 std::is_same<CLRes, std::decay_t<CLRes> >::value,
│ │ │ │ -
416 "Result of lane() on a const lvalue vector must "
│ │ │ │ -
417 "either be a const lvalue reference to a scalar of that "
│ │ │ │ -
418 "vector or a proxy object (which itself may not be a "
│ │ │ │ -
419 "reference nor const).");
│ │ │ │ -
420 static_assert(!std::is_assignable<CLRes, Scalar<V> >::value,
│ │ │ │ -
421 "Result of lane() on a const lvalue vector must not be "
│ │ │ │ -
422 "assignable from a scalar.");
│ │ │ │ -
423
│ │ │ │ -
424 // check lane() on rvalues
│ │ │ │ -
425 for(std::size_t l = 0; l < lanes(vec); ++l)
│ │ │ │ -
426 DUNE_SIMD_CHECK(lane(l, prvalue(vec)) == Scalar<V>(l + 1));
│ │ │ │ -
427 using RRes = decltype(lane(0, prvalue(vec)));
│ │ │ │ -
428 // TODO: do we really want to allow Scalar<V>&& here? If we allow it,
│ │ │ │ -
429 // then `auto &&res = lane(0, vec*vec);` creates a dangling reference,
│ │ │ │ -
430 // and the scalar (and even the vector types) are small enough to be
│ │ │ │ -
431 // passed in registers anyway. On the other hand, the only comparable
│ │ │ │ -
432 // accessor function in the standard library that I can think of is
│ │ │ │ -
433 // std::get(), and that does return an rvalue reference in this
│ │ │ │ -
434 // situation. However, that cannot assume anything about the size of
│ │ │ │ -
435 // the returned types.
│ │ │ │ -
436 static_assert(std::is_same<RRes, Scalar<V> >::value ||
│ │ │ │ -
437 std::is_same<RRes, Scalar<V>&&>::value,
│ │ │ │ -
438 "Result of lane() on a rvalue vector V must be "
│ │ │ │ -
439 "Scalar<V> or Scalar<V>&&.");
│ │ │ │ -
440 // Can't assert non-assignable, fails for any typical class,
│ │ │ │ -
441 // e.g. std::complex<>. Would need to return const Scalar<V> or const
│ │ │ │ -
442 // Scalar<V>&&, which would inhibit moving from the return value.
│ │ │ │ -
443 // static_assert(!std::is_assignable<RRes, Scalar<V> >::value,
│ │ │ │ -
444 // "Result of lane() on a rvalue vector must not be "
│ │ │ │ -
445 // "assignable from a scalar.");
│ │ │ │ -
446 }
│ │ │ │ -
447
│ │ │ │ -
448 // check non-default constructors
│ │ │ │ -
449 template<class V>
│ │ │ │ -
450 void checkCopyMoveConstruct()
│ │ │ │ -
451 {
│ │ │ │ -
452 // elided copy/move constructors
│ │ │ │ -
453 { V vec (make123<V>()); DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
454 { V vec = make123<V>() ; DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
455 { V vec {make123<V>()}; DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
456 { V vec = {make123<V>()}; DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
457
│ │ │ │ -
458 // copy constructors
│ │ │ │ -
459 { V ref(make123<V>()); V vec (ref);
│ │ │ │ -
460 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
│ │ │ │ -
461 { V ref(make123<V>()); V vec = ref ;
│ │ │ │ -
462 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
│ │ │ │ -
463 { V ref(make123<V>()); V vec {ref};
│ │ │ │ -
464 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
│ │ │ │ -
465 { V ref(make123<V>()); V vec = {ref};
│ │ │ │ -
466 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
│ │ │ │ -
467 { const V ref(make123<V>()); V vec (ref);
│ │ │ │ -
468 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
469 { const V ref(make123<V>()); V vec = ref ;
│ │ │ │ -
470 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
471 { const V ref(make123<V>()); V vec {ref};
│ │ │ │ -
472 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
473 { const V ref(make123<V>()); V vec = {ref};
│ │ │ │ -
474 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
475
│ │ │ │ -
476 // move constructors
│ │ │ │ -
477 { V ref(make123<V>()); V vec (std::move(ref));
│ │ │ │ -
478 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
479 { V ref(make123<V>()); V vec = std::move(ref) ;
│ │ │ │ -
480 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
481 { V ref(make123<V>()); V vec {std::move(ref)};
│ │ │ │ -
482 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
483 { V ref(make123<V>()); V vec = {std::move(ref)};
│ │ │ │ -
484 DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
485 }
│ │ │ │ +
410 const ParallelIndexSet* source_;
│ │ │ │ +
411
│ │ │ │ +
413 const ParallelIndexSet* target_;
│ │ │ │ +
414
│ │ │ │ +
416 MPI_Comm comm_;
│ │ │ │ +
417
│ │ │ │ +
420 std::set<int> neighbourIds;
│ │ │ │ +
421
│ │ │ │ +
423 const static int commTag_=333;
│ │ │ │ +
424
│ │ │ │ +
429 int sourceSeqNo_;
│ │ │ │ +
430
│ │ │ │ +
435 int destSeqNo_;
│ │ │ │ +
436
│ │ │ │ +
440 bool publicIgnored;
│ │ │ │ +
441
│ │ │ │ +
445 bool firstBuild;
│ │ │ │ +
446
│ │ │ │ +
447 /*
│ │ │ │ +
448 * @brief If true, sending from indices of the processor to other
│ │ │ │ +
449 * indices on the same processor is enabled even if the same indexset is used
│ │ │ │ +
450 * on both the
│ │ │ │ +
451 * sending and receiving side.
│ │ │ │ +
452 */
│ │ │ │ +
453 bool includeSelf;
│ │ │ │ +
454
│ │ │ │ + │ │ │ │ +
457 PairType;
│ │ │ │ +
458
│ │ │ │ +
465 RemoteIndexMap remoteIndices_;
│ │ │ │ +
466
│ │ │ │ +
477 template<bool ignorePublic>
│ │ │ │ +
478 inline void buildRemote(bool includeSelf);
│ │ │ │ +
479
│ │ │ │ +
485 inline int noPublic(const ParallelIndexSet& indexSet);
│ │ │ │
486
│ │ │ │ -
487 template<class V>
│ │ │ │ -
488 void checkBroadcastVectorConstruct()
│ │ │ │ -
489 {
│ │ │ │ -
490 // broadcast copy constructors
│ │ │ │ -
491 { Scalar<V> ref = 42; V vec (ref);
│ │ │ │ -
492 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
493 { Scalar<V> ref = 42; V vec = ref ;
│ │ │ │ -
494 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
495 // { Scalar<V> ref = 42; V vec {ref};
│ │ │ │ -
496 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
497 // { Scalar<V> ref = 42; V vec = {ref};
│ │ │ │ -
498 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
499 { const Scalar<V> ref = 42; V vec (ref);
│ │ │ │ -
500 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
501 { const Scalar<V> ref = 42; V vec = ref ;
│ │ │ │ -
502 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
503 // { const Scalar<V> ref = 42; V vec {ref};
│ │ │ │ -
504 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
505 // { const Scalar<V> ref = 42; V vec = {ref};
│ │ │ │ -
506 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
507
│ │ │ │ -
508 // broadcast move constructors
│ │ │ │ -
509 { Scalar<V> ref = 42; V vec (std::move(ref));
│ │ │ │ -
510 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
511 { Scalar<V> ref = 42; V vec = std::move(ref) ;
│ │ │ │ -
512 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
513 // { Scalar<V> ref = 42; V vec {std::move(ref)};
│ │ │ │ -
514 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
515 // { Scalar<V> ref = 42; V vec = {std::move(ref)};
│ │ │ │ -
516 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
517 }
│ │ │ │ -
518
│ │ │ │ -
519 template<class V>
│ │ │ │ -
520 void checkBroadcastMaskConstruct()
│ │ │ │ -
521 {
│ │ │ │ -
522 // broadcast copy constructors
│ │ │ │ -
523 { Scalar<V> ref = 42; V vec (ref);
│ │ │ │ -
524 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
525 // { Scalar<V> ref = 42; V vec = ref ;
│ │ │ │ -
526 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
527 { Scalar<V> ref = 42; V vec {ref};
│ │ │ │ -
528 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
529 // { Scalar<V> ref = 42; V vec = {ref};
│ │ │ │ -
530 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
531 { const Scalar<V> ref = 42; V vec (ref);
│ │ │ │ -
532 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
533 // { const Scalar<V> ref = 42; V vec = ref ;
│ │ │ │ -
534 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
535 { const Scalar<V> ref = 42; V vec {ref};
│ │ │ │ -
536 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
537 // { const Scalar<V> ref = 42; V vec = {ref};
│ │ │ │ -
538 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
539
│ │ │ │ -
540 // broadcast move constructors
│ │ │ │ -
541 { Scalar<V> ref = 42; V vec (std::move(ref));
│ │ │ │ -
542 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
543 // { Scalar<V> ref = 42; V vec = std::move(ref) ;
│ │ │ │ -
544 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
545 { Scalar<V> ref = 42; V vec {std::move(ref)};
│ │ │ │ -
546 DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
547 // { Scalar<V> ref = 42; V vec = {std::move(ref)};
│ │ │ │ -
548 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
549 }
│ │ │ │ -
550
│ │ │ │ -
551 // check the implCast function
│ │ │ │ -
552 template<class FromV, class ToV>
│ │ │ │ -
553 void checkImplCast()
│ │ │ │ -
554 {
│ │ │ │ -
555 { // lvalue arg
│ │ │ │ -
556 FromV fromVec = make123<FromV>();
│ │ │ │ -
557 auto toVec = implCast<ToV>(fromVec);
│ │ │ │ -
558 static_assert(std::is_same<decltype(toVec), ToV>::value,
│ │ │ │ -
559 "Unexpected result type for implCast<ToV>(FromV&)");
│ │ │ │ -
560 DUNE_SIMD_CHECK(is123(fromVec));
│ │ │ │ -
561 DUNE_SIMD_CHECK(is123(toVec));
│ │ │ │ -
562 }
│ │ │ │ -
563
│ │ │ │ -
564 { // const lvalue arg
│ │ │ │ -
565 const FromV fromVec = make123<FromV>();
│ │ │ │ -
566 auto toVec = implCast<ToV>(fromVec);
│ │ │ │ -
567 static_assert(std::is_same<decltype(toVec), ToV>::value,
│ │ │ │ -
568 "Unexpected result type for implCast<ToV>(const "
│ │ │ │ -
569 "FromV&)");
│ │ │ │ -
570 DUNE_SIMD_CHECK(is123(toVec));
│ │ │ │ -
571 }
│ │ │ │ -
572
│ │ │ │ -
573 { // rvalue arg
│ │ │ │ -
574 auto toVec = implCast<ToV>(make123<FromV>());
│ │ │ │ -
575 static_assert(std::is_same<decltype(toVec), ToV>::value,
│ │ │ │ -
576 "Unexpected result type for implCast<ToV>(FromV&&)");
│ │ │ │ -
577 DUNE_SIMD_CHECK(is123(toVec));
│ │ │ │ -
578 }
│ │ │ │ -
579 }
│ │ │ │ -
580
│ │ │ │ -
581 // check the implCast function
│ │ │ │ -
582 template<class V>
│ │ │ │ -
583 void checkImplCast()
│ │ │ │ -
584 {
│ │ │ │ -
585 // check against LoopSIMD
│ │ │ │ -
586 using LoopV = Dune::LoopSIMD<Scalar<V>, lanes<V>()>;
│ │ │ │ -
587
│ │ │ │ -
588 checkImplCast<V, V>();
│ │ │ │ -
589 checkImplCast<V, LoopV>();
│ │ │ │ -
590 checkImplCast<LoopV, V>();
│ │ │ │ -
591 }
│ │ │ │ -
592
│ │ │ │ -
593 // check the broadcast function
│ │ │ │ -
594 template<class V>
│ │ │ │ -
595 void checkBroadcast()
│ │ │ │ -
596 {
│ │ │ │ -
597 // broadcast function
│ │ │ │ -
598 { // lvalue arg
│ │ │ │ -
599 Scalar<V> ref = 42;
│ │ │ │ -
600 auto vec = broadcast<V>(ref);
│ │ │ │ -
601 static_assert(std::is_same<decltype(vec), V>::value,
│ │ │ │ -
602 "Unexpected result type for broadcast<V>()");
│ │ │ │ -
603 DUNE_SIMD_CHECK(is42(vec));
│ │ │ │ -
604 DUNE_SIMD_CHECK(ref == Scalar<V>(42));
│ │ │ │ -
605 }
│ │ │ │ -
606
│ │ │ │ -
607 { // const lvalue arg
│ │ │ │ -
608 const Scalar<V> ref = 42;
│ │ │ │ -
609 auto vec = broadcast<V>(ref);
│ │ │ │ -
610 static_assert(std::is_same<decltype(vec), V>::value,
│ │ │ │ -
611 "Unexpected result type for broadcast<V>()");
│ │ │ │ -
612 DUNE_SIMD_CHECK(is42(vec));
│ │ │ │ -
613 }
│ │ │ │ -
614
│ │ │ │ -
615 { // rvalue arg
│ │ │ │ -
616 auto vec = broadcast<V>(Scalar<V>(42));
│ │ │ │ -
617 static_assert(std::is_same<decltype(vec), V>::value,
│ │ │ │ -
618 "Unexpected result type for broadcast<V>()");
│ │ │ │ -
619 DUNE_SIMD_CHECK(is42(vec));
│ │ │ │ -
620 }
│ │ │ │ -
621
│ │ │ │ -
622 { // int arg
│ │ │ │ -
623 auto vec = broadcast<V>(42);
│ │ │ │ -
624 static_assert(std::is_same<decltype(vec), V>::value,
│ │ │ │ -
625 "Unexpected result type for broadcast<V>()");
│ │ │ │ -
626 DUNE_SIMD_CHECK(is42(vec));
│ │ │ │ -
627 }
│ │ │ │ +
498 template<bool ignorePublic>
│ │ │ │ +
499 inline void packEntries(PairType** myPairs, const ParallelIndexSet& indexSet,
│ │ │ │ +
500 char* p_out, MPI_Datatype type, int bufferSize,
│ │ │ │ +
501 int* position, int n);
│ │ │ │ +
502
│ │ │ │ +
516 inline void unpackIndices(RemoteIndexList& remote, int remoteEntries,
│ │ │ │ +
517 PairType** local, int localEntries, char* p_in,
│ │ │ │ +
518 MPI_Datatype type, int* position, int bufferSize,
│ │ │ │ +
519 bool fromOurself);
│ │ │ │ +
520
│ │ │ │ +
521 inline void unpackIndices(RemoteIndexList& send, RemoteIndexList& receive,
│ │ │ │ +
522 int remoteEntries, PairType** localSource,
│ │ │ │ +
523 int localSourceEntries, PairType** localDest,
│ │ │ │ +
524 int localDestEntries, char* p_in,
│ │ │ │ +
525 MPI_Datatype type, int* position, int bufferSize);
│ │ │ │ +
526
│ │ │ │ +
527 void unpackCreateRemote(char* p_in, PairType** sourcePairs, PairType** DestPairs,
│ │ │ │ +
528 int remoteProc, int sourcePublish, int destPublish,
│ │ │ │ +
529 int bufferSize, bool sendTwo, bool fromOurSelf=false);
│ │ │ │ +
530 };
│ │ │ │ +
│ │ │ │ +
531
│ │ │ │ +
549 template<class T, class A, bool mode>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
551 {
│ │ │ │ +
552
│ │ │ │ +
553 template<typename T1, typename A1>
│ │ │ │ +
554 friend class RemoteIndices;
│ │ │ │ +
555
│ │ │ │ +
556 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
558 {};
│ │ │ │ +
│ │ │ │ +
559
│ │ │ │ +
568 constexpr static bool MODIFYINDEXSET = mode;
│ │ │ │ +
569
│ │ │ │ + │ │ │ │ +
574
│ │ │ │ + │ │ │ │ +
579
│ │ │ │ + │ │ │ │ +
584
│ │ │ │ +
588 typedef typename LocalIndex::Attribute Attribute;
│ │ │ │ +
589
│ │ │ │ + │ │ │ │ +
594
│ │ │ │ +
598 typedef A Allocator;
│ │ │ │ +
599
│ │ │ │ + │ │ │ │ + │ │ │ │ +
603
│ │ │ │ + │ │ │ │ +
608
│ │ │ │ + │ │ │ │ +
613
│ │ │ │ +
627 void insert(const RemoteIndex& index);
│ │ │ │
628
│ │ │ │ -
629 { // double arg
│ │ │ │ -
630 auto vec = broadcast<V>(42.0);
│ │ │ │ -
631 static_assert(std::is_same<decltype(vec), V>::value,
│ │ │ │ -
632 "Unexpected result type for broadcast<V>()");
│ │ │ │ -
633 DUNE_SIMD_CHECK(is42(vec));
│ │ │ │ -
634 }
│ │ │ │ -
635 }
│ │ │ │ -
636
│ │ │ │ -
637 template<class V>
│ │ │ │ -
638 void checkBracedAssign()
│ │ │ │ -
639 {
│ │ │ │ -
640 // copy assignment
│ │ │ │ -
641 { V ref = make123<V>(); V vec; vec = {ref};
│ │ │ │ -
642 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
│ │ │ │ -
643 { const V ref = make123<V>(); V vec; vec = {ref};
│ │ │ │ -
644 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
│ │ │ │ +
629
│ │ │ │ +
644 void insert(const RemoteIndex& index, const GlobalIndex& global);
│ │ │ │
645
│ │ │ │ -
646 // move assignment
│ │ │ │ -
647 { V vec; vec = {make123<V>()}; DUNE_SIMD_CHECK(is123(vec)); }
│ │ │ │ -
648 }
│ │ │ │ -
649
│ │ │ │ -
650 template<class V>
│ │ │ │ -
651 void checkBracedBroadcastAssign()
│ │ │ │ -
652 {
│ │ │ │ -
653 // nothing works here
│ │ │ │ -
654 // // broadcast copy assignment
│ │ │ │ -
655 // { Scalar<V> ref = 42; V vec; vec = {ref};
│ │ │ │ -
656 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
│ │ │ │ -
657 // { const Scalar<V> ref = 42; V vec; vec = {ref};
│ │ │ │ -
658 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
659
│ │ │ │ -
660 // // broadcast move assignment
│ │ │ │ -
661 // { Scalar<V> ref = 42; V vec; vec = {std::move(ref)};
│ │ │ │ -
662 // DUNE_SIMD_CHECK(is42(vec)); }
│ │ │ │ -
663 }
│ │ │ │ -
664
│ │ │ │ -
666 //
│ │ │ │ -
667 // checks for unary operators
│ │ │ │ -
668 //
│ │ │ │ +
653 bool remove(const GlobalIndex& global);
│ │ │ │ +
654
│ │ │ │ + │ │ │ │ +
668
│ │ │ │
669
│ │ │ │ -
│ │ │ │ -
670#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL) \
│ │ │ │ -
671 struct OpPostfix##NAME \
│ │ │ │ -
672 { \
│ │ │ │ -
673 template<class V> \
│ │ │ │ -
674 auto operator()(V&& v) const \
│ │ │ │ -
675 -> decltype(std::forward<V>(v) SYMBOL) \
│ │ │ │ -
676 { \
│ │ │ │ -
677 return std::forward<V>(v) SYMBOL; \
│ │ │ │ -
678 } \
│ │ │ │ -
679 }
│ │ │ │ -
│ │ │ │ -
680
│ │ │ │ -
│ │ │ │ -
681#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL) \
│ │ │ │ -
682 struct OpPrefix##NAME \
│ │ │ │ -
683 { \
│ │ │ │ -
684 template<class V> \
│ │ │ │ -
685 auto operator()(V&& v) const \
│ │ │ │ -
686 -> decltype(SYMBOL std::forward<V>(v)) \
│ │ │ │ -
687 { \
│ │ │ │ -
688 return SYMBOL std::forward<V>(v); \
│ │ │ │ -
689 } \
│ │ │ │ -
690 }
│ │ │ │ -
│ │ │ │ -
691
│ │ │ │ -
692 DUNE_SIMD_POSTFIX_OP(Decrement, -- );
│ │ │ │ -
693 DUNE_SIMD_POSTFIX_OP(Increment, ++ );
│ │ │ │ -
694
│ │ │ │ -
695 DUNE_SIMD_PREFIX_OP (Decrement, -- );
│ │ │ │ -
696 DUNE_SIMD_PREFIX_OP (Increment, ++ );
│ │ │ │ -
697
│ │ │ │ -
698 DUNE_SIMD_PREFIX_OP (Plus, + );
│ │ │ │ -
699 DUNE_SIMD_PREFIX_OP (Minus, - );
│ │ │ │ -
700 DUNE_SIMD_PREFIX_OP (LogicNot, ! );
│ │ │ │ -
701 // Do not warn about ~ being applied to bool. (1) Yes, doing that is
│ │ │ │ -
702 // weird, but we do want to test the weird stuff too. (2) It avoids
│ │ │ │ -
703 // running into <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82040> on
│ │ │ │ -
704 // g++-7.0 through 7.2. Also, ignore -Wpragmas to not warn about an
│ │ │ │ -
705 // unknown -Wbool-operation on compilers that do not know that option.
│ │ │ │ -
706#pragma GCC diagnostic push
│ │ │ │ -
707#pragma GCC diagnostic ignored "-Wpragmas"
│ │ │ │ -
708#pragma GCC diagnostic ignored "-Wunknown-warning-option" // clang 6.0.1
│ │ │ │ -
709#pragma GCC diagnostic ignored "-Wbool-operation"
│ │ │ │ -
710 DUNE_SIMD_PREFIX_OP (BitNot, ~ );
│ │ │ │ -
711#pragma GCC diagnostic pop
│ │ │ │ -
712
│ │ │ │ -
713#undef DUNE_SIMD_POSTFIX_OP
│ │ │ │ -
714#undef DUNE_SIMD_PREFIX_OP
│ │ │ │ -
715
│ │ │ │ -
716 template<class V, class Op>
│ │ │ │ -
717 std::enable_if_t<
│ │ │ │ -
718 IsCallable<Op(decltype(lane(0, std::declval<V>())))>::value>
│ │ │ │ -
719 checkUnaryOpV(Op op)
│ │ │ │ -
720 {
│ │ │ │ -
721#define DUNE_SIMD_OPNAME (className<Op(V)>())
│ │ │ │ -
722 // arguments
│ │ │ │ -
723 auto val = leftVector<std::decay_t<V>>();
│ │ │ │ + │ │ │ │ +
671
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
677 : glist_()
│ │ │ │ +
678 {}
│ │ │ │ +
│ │ │ │ +
679
│ │ │ │ +
680 private:
│ │ │ │ +
681
│ │ │ │ + │ │ │ │ +
688 RemoteIndexList& rList);
│ │ │ │ +
689
│ │ │ │ +
690 typedef SLList<GlobalIndex,Allocator> GlobalList;
│ │ │ │ +
691 typedef typename GlobalList::ModifyIterator GlobalModifyIterator;
│ │ │ │ +
692 RemoteIndexList* rList_;
│ │ │ │ +
693 const ParallelIndexSet* indexSet_;
│ │ │ │ +
694 GlobalList glist_;
│ │ │ │ +
695 ModifyIterator iter_;
│ │ │ │ +
696 GlobalModifyIterator giter_;
│ │ │ │ +
697 ConstIterator end_;
│ │ │ │ +
698 bool first_;
│ │ │ │ +
699 GlobalIndex last_;
│ │ │ │ +
700 };
│ │ │ │ +
│ │ │ │ +
701
│ │ │ │ +
706 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
708 {
│ │ │ │ +
709
│ │ │ │ +
713 typedef T ParallelIndexSet;
│ │ │ │ +
714
│ │ │ │ +
718 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ │ +
719
│ │ │ │ +
723 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
│ │ │ │
724
│ │ │ │ -
725 // copy the arguments in case V is a references
│ │ │ │ -
726 auto arg = val;
│ │ │ │ -
727 auto &&result = op(static_cast<V>(arg));
│ │ │ │ -
728 using T = Scalar<std::decay_t<decltype(result)> >;
│ │ │ │ -
729 for(std::size_t l = 0; l < lanes(val); ++l)
│ │ │ │ -
730 {
│ │ │ │ -
731 // `op` might promote the argument. This is a problem if the
│ │ │ │ -
732 // argument of the operation on the right of the `==` is
│ │ │ │ -
733 // e.g. `(unsigned short)1` and the operation is e.g. unary `-`.
│ │ │ │ -
734 // Then the argument is promoted to `int` before applying the
│ │ │ │ -
735 // negation, and the result is `(int)-1`. However, the left side of
│ │ │ │ -
736 // the `==` is still `(unsigned short)-1`, which typically is the
│ │ │ │ -
737 // same as `(unsigned short)65535`. The `==` promotes the left side
│ │ │ │ -
738 // before comparing, so that becomes `(int)65535`. It will then
│ │ │ │ -
739 // compare `(int)65535` and `(int)-1` and rightly declare them to be
│ │ │ │ -
740 // not equal.
│ │ │ │ -
741
│ │ │ │ -
742 // To work around this, we explicitly convert the right side of the
│ │ │ │ -
743 // `==` to the scalar type before comparing.
│ │ │ │ - │ │ │ │ -
745 (lane(l, result)
│ │ │ │ -
746 == static_cast<T>(op(lane(l, static_cast<V>(val)))));
│ │ │ │ -
747 }
│ │ │ │ -
748 // op might modify val, verify that any such modification also happens
│ │ │ │ -
749 // in the vector case
│ │ │ │ -
750 for(std::size_t l = 0; l < lanes<std::decay_t<V> >(); ++l)
│ │ │ │ -
751 DUNE_SIMD_CHECK_OP(lane(l, val) == lane(l, arg));
│ │ │ │ -
752#undef DUNE_SIMD_OPNAME
│ │ │ │ -
753 }
│ │ │ │ -
754
│ │ │ │ -
755 template<class V, class Op>
│ │ │ │ -
756 std::enable_if_t<
│ │ │ │ -
757 not IsCallable<Op(decltype(lane(0, std::declval<V>())))>::value>
│ │ │ │ -
758 checkUnaryOpV(Op op)
│ │ │ │ -
759 {
│ │ │ │ -
760 // log_ << "No " << className<Op(decltype(lane(0, std::declval<V>())))>()
│ │ │ │ -
761 // << std::endl
│ │ │ │ -
762 // << " ==> Not checking " << className<Op(V)>() << std::endl;
│ │ │ │ -
763 }
│ │ │ │ -
764
│ │ │ │ -
765 template<class V, class Op>
│ │ │ │ -
766 void checkUnaryOpsV(Op op)
│ │ │ │ -
767 {
│ │ │ │ -
768 checkUnaryOpV<V&>(op);
│ │ │ │ -
769 checkUnaryOpV<const V&>(op);
│ │ │ │ -
770 checkUnaryOpV<V&&>(op);
│ │ │ │ -
771 }
│ │ │ │ -
772
│ │ │ │ -
774 //
│ │ │ │ -
775 // checks for binary operators
│ │ │ │ -
776 //
│ │ │ │ +
728 typedef typename LocalIndex::Attribute Attribute;
│ │ │ │ +
729
│ │ │ │ + │ │ │ │ +
732
│ │ │ │ +
734 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<RemoteIndex>;
│ │ │ │ +
735
│ │ │ │ + │ │ │ │ +
738
│ │ │ │ +
740 typedef std::map<int,std::pair<typename RemoteIndexList::const_iterator,
│ │ │ │ +
741 const typename RemoteIndexList::const_iterator> >
│ │ │ │ +
742 Map;
│ │ │ │ +
743
│ │ │ │ +
744 public:
│ │ │ │ +
745
│ │ │ │ +
747 typedef std::map<int, std::pair<RemoteIndexList*,RemoteIndexList*> >
│ │ │ │ + │ │ │ │ +
749
│ │ │ │ +
755 inline CollectiveIterator(const RemoteIndexMap& map_, bool send);
│ │ │ │ +
756
│ │ │ │ +
765 inline void advance(const GlobalIndex& global);
│ │ │ │ +
766
│ │ │ │ +
776 inline void advance(const GlobalIndex& global, const Attribute& attribute);
│ │ │ │
777
│ │ │ │ -
778 // The operators contain an `operator()`, which will be invoked for both
│ │ │ │ -
779 // scalar and vector arguments. The function `scalar()` is used the
│ │ │ │ -
780 // test whether the scalar types support the operation (via
│ │ │ │ -
781 // `ScalarResult`). The difference is that `scalar()` should only ever
│ │ │ │ -
782 // receive `const`-ref-qualified version of `Scalar<V>`, while the
│ │ │ │ -
783 // `operator()` may also be called with proxies representing scalars.
│ │ │ │ -
│ │ │ │ -
784#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL) \
│ │ │ │ -
785 struct OpInfix##NAME \
│ │ │ │ -
786 { \
│ │ │ │ -
787 template<class V1, class V2> \
│ │ │ │ -
788 decltype(auto) operator()(V1&& v1, V2&& v2) const \
│ │ │ │ -
789 { \
│ │ │ │ -
790 return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
│ │ │ │ -
791 } \
│ │ │ │ -
792 template<class S1, class S2> \
│ │ │ │ -
793 auto scalar(S1&& s1, S2&& s2) const \
│ │ │ │ -
794 -> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
│ │ │ │ -
795 }
│ │ │ │ -
│ │ │ │ + │ │ │ │ +
779
│ │ │ │ +
783 inline bool empty() const;
│ │ │ │ +
784
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
792 {
│ │ │ │ +
793 public:
│ │ │ │ +
794 typedef typename Map::iterator RealIterator;
│ │ │ │ +
795 typedef typename Map::iterator ConstRealIterator;
│ │ │ │
796
│ │ │ │ -
797 // for assign ops, accept only non-const lvalue arguments for scalars.
│ │ │ │ -
798 // This is needed for class scalars (e.g. std::complex) because
│ │ │ │ -
799 // non-const class rvalues are actually usually assignable. Though that
│ │ │ │ -
800 // assignment happens to a temporary, and thus is lost. Except that the
│ │ │ │ -
801 // tests would bind the result of the assignment to a reference. And
│ │ │ │ -
802 // because that result is returned from a function by reference, even
│ │ │ │ -
803 // though it is a temporary passed as an argument to that function,
│ │ │ │ -
804 // accessing the result later is undefined behaviour.
│ │ │ │ -
│ │ │ │ -
805#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL) \
│ │ │ │ -
806 struct OpInfix##NAME \
│ │ │ │ -
807 { \
│ │ │ │ -
808 template<class V1, class V2> \
│ │ │ │ -
809 decltype(auto) operator()(V1&& v1, V2&& v2) const \
│ │ │ │ -
810 { \
│ │ │ │ -
811 return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
│ │ │ │ -
812 } \
│ │ │ │ -
813 template<class S1, class S2> \
│ │ │ │ -
814 auto scalar(S1& s1, S2&& s2) const \
│ │ │ │ -
815 -> decltype(s1 SYMBOL std::forward<S2>(s2)); \
│ │ │ │ -
816 }
│ │ │ │ -
│ │ │ │ -
817
│ │ │ │ -
│ │ │ │ -
818#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL) \
│ │ │ │ -
819 struct OpInfix##NAME \
│ │ │ │ -
820 { \
│ │ │ │ -
821 template<class V1, class V2> \
│ │ │ │ -
822 decltype(auto) operator()(V1&& v1, V2&& v2) const \
│ │ │ │ -
823 { \
│ │ │ │ -
824 return Simd::REPLFN(std::forward<V1>(v1), std::forward<V2>(v2)); \
│ │ │ │ -
825 } \
│ │ │ │ -
826 template<class S1, class S2> \
│ │ │ │ -
827 auto scalar(S1&& s1, S2&& s2) const \
│ │ │ │ -
828 -> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
│ │ │ │ -
829 }
│ │ │ │ -
│ │ │ │ -
830
│ │ │ │ -
831 DUNE_SIMD_INFIX_OP(Mul, * );
│ │ │ │ -
832 DUNE_SIMD_INFIX_OP(Div, / );
│ │ │ │ -
833 DUNE_SIMD_INFIX_OP(Remainder, % );
│ │ │ │ -
834
│ │ │ │ -
835 DUNE_SIMD_INFIX_OP(Plus, + );
│ │ │ │ -
836 DUNE_SIMD_INFIX_OP(Minus, - );
│ │ │ │ -
837
│ │ │ │ -
838 DUNE_SIMD_INFIX_OP(LeftShift, << );
│ │ │ │ -
839 DUNE_SIMD_INFIX_OP(RightShift, >> );
│ │ │ │ -
840
│ │ │ │ -
841 DUNE_SIMD_INFIX_OP(Less, < );
│ │ │ │ -
842 DUNE_SIMD_INFIX_OP(Greater, > );
│ │ │ │ -
843 DUNE_SIMD_INFIX_OP(LessEqual, <= );
│ │ │ │ -
844 DUNE_SIMD_INFIX_OP(GreaterEqual, >= );
│ │ │ │ -
845
│ │ │ │ -
846 DUNE_SIMD_INFIX_OP(Equal, == );
│ │ │ │ -
847 DUNE_SIMD_INFIX_OP(NotEqual, != );
│ │ │ │ +
797
│ │ │ │ +
│ │ │ │ +
799 iterator(const RealIterator& iter, const ConstRealIterator& end, GlobalIndex& index)
│ │ │ │ +
800 : iter_(iter), end_(end), index_(index), hasAttribute(false)
│ │ │ │ +
801 {
│ │ │ │ +
802 // Move to the first valid entry
│ │ │ │ +
803 while(iter_!=end_ && iter_->second.first->localIndexPair().global()!=index_)
│ │ │ │ +
804 ++iter_;
│ │ │ │ +
805 }
│ │ │ │ +
│ │ │ │ +
806
│ │ │ │ +
│ │ │ │ +
807 iterator(const RealIterator& iter, const ConstRealIterator& end, GlobalIndex index,
│ │ │ │ +
808 Attribute attribute)
│ │ │ │ +
809 : iter_(iter), end_(end), index_(index), attribute_(attribute), hasAttribute(true)
│ │ │ │ +
810 {
│ │ │ │ +
811 // Move to the first valid entry or the end
│ │ │ │ +
812 while(iter_!=end_ && (iter_->second.first->localIndexPair().global()!=index_
│ │ │ │ +
813 || iter_->second.first->localIndexPair().local().attribute()!=attribute))
│ │ │ │ +
814 ++iter_;
│ │ │ │ +
815 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
817 iterator(const iterator& other)
│ │ │ │ +
818 : iter_(other.iter_), end_(other.end_), index_(other.index_)
│ │ │ │ +
819 { }
│ │ │ │ +
│ │ │ │ +
820
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
823 {
│ │ │ │ +
824 ++iter_;
│ │ │ │ +
825 // If entry is not valid move on
│ │ │ │ +
826 while(iter_!=end_ && (iter_->second.first->localIndexPair().global()!=index_ ||
│ │ │ │ +
827 (hasAttribute &&
│ │ │ │ +
828 iter_->second.first->localIndexPair().local().attribute()!=attribute_)))
│ │ │ │ +
829 ++iter_;
│ │ │ │ +
830 assert(iter_==end_ ||
│ │ │ │ +
831 (iter_->second.first->localIndexPair().global()==index_));
│ │ │ │ +
832 assert(iter_==end_ || !hasAttribute ||
│ │ │ │ +
833 (iter_->second.first->localIndexPair().local().attribute()==attribute_));
│ │ │ │ +
834 return *this;
│ │ │ │ +
835 }
│ │ │ │ +
│ │ │ │ +
836
│ │ │ │ +
│ │ │ │ +
838 const RemoteIndex& operator*() const
│ │ │ │ +
839 {
│ │ │ │ +
840 return *(iter_->second.first);
│ │ │ │ +
841 }
│ │ │ │ +
│ │ │ │ +
842
│ │ │ │ +
│ │ │ │ +
844 int process() const
│ │ │ │ +
845 {
│ │ │ │ +
846 return iter_->first;
│ │ │ │ +
847 }
│ │ │ │ +
│ │ │ │
848
│ │ │ │ -
849 DUNE_SIMD_INFIX_OP(BitAnd, & );
│ │ │ │ -
850 DUNE_SIMD_INFIX_OP(BitXor, ^ );
│ │ │ │ -
851 DUNE_SIMD_INFIX_OP(BitOr, | );
│ │ │ │ -
852
│ │ │ │ -
853 // Those are not supported in any meaningful way by vectorclass
│ │ │ │ -
854 // We need to test replacement functions maskAnd() and maskOr() instead.
│ │ │ │ -
855 DUNE_SIMD_REPL_OP(LogicAnd, maskAnd, && );
│ │ │ │ -
856 DUNE_SIMD_REPL_OP(LogicOr, maskOr, || );
│ │ │ │ -
857
│ │ │ │ -
858 DUNE_SIMD_ASSIGN_OP(Assign, = );
│ │ │ │ -
859 DUNE_SIMD_ASSIGN_OP(AssignMul, *= );
│ │ │ │ -
860 DUNE_SIMD_ASSIGN_OP(AssignDiv, /= );
│ │ │ │ -
861 DUNE_SIMD_ASSIGN_OP(AssignRemainder, %= );
│ │ │ │ -
862 DUNE_SIMD_ASSIGN_OP(AssignPlus, += );
│ │ │ │ -
863 DUNE_SIMD_ASSIGN_OP(AssignMinus, -= );
│ │ │ │ -
864 DUNE_SIMD_ASSIGN_OP(AssignLeftShift, <<=);
│ │ │ │ -
865 DUNE_SIMD_ASSIGN_OP(AssignRightShift, >>=);
│ │ │ │ -
866 DUNE_SIMD_ASSIGN_OP(AssignAnd, &= );
│ │ │ │ -
867 DUNE_SIMD_ASSIGN_OP(AssignXor, ^= );
│ │ │ │ -
868 DUNE_SIMD_ASSIGN_OP(AssignOr, |= );
│ │ │ │ +
│ │ │ │ +
850 const RemoteIndex* operator->() const
│ │ │ │ +
851 {
│ │ │ │ +
852 return iter_->second.first.operator->();
│ │ │ │ +
853 }
│ │ │ │ +
│ │ │ │ +
854
│ │ │ │ +
│ │ │ │ +
856 bool operator==(const iterator& other) const
│ │ │ │ +
857 {
│ │ │ │ +
858 return other.iter_==iter_;
│ │ │ │ +
859 }
│ │ │ │ +
│ │ │ │ +
860
│ │ │ │ +
│ │ │ │ +
862 bool operator!=(const iterator& other) const
│ │ │ │ +
863 {
│ │ │ │ +
864 return other.iter_!=iter_;
│ │ │ │ +
865 }
│ │ │ │ +
│ │ │ │ +
866
│ │ │ │ +
867 private:
│ │ │ │ +
868 iterator();
│ │ │ │
869
│ │ │ │ -
870#undef DUNE_SIMD_INFIX_OP
│ │ │ │ -
871#undef DUNE_SIMD_REPL_OP
│ │ │ │ -
872#undef DUNE_SIMD_ASSIGN_OP
│ │ │ │ -
873
│ │ │ │ -
874 // just used as a tag
│ │ │ │ -
875 struct OpInfixComma {};
│ │ │ │ +
870 RealIterator iter_;
│ │ │ │ +
871 RealIterator end_;
│ │ │ │ +
872 GlobalIndex index_;
│ │ │ │ +
873 Attribute attribute_;
│ │ │ │ +
874 bool hasAttribute;
│ │ │ │ +
875 };
│ │ │ │ +
│ │ │ │
876
│ │ │ │ -
877 template<class T1, class T2>
│ │ │ │ -
878 void checkCommaOp(const std::decay_t<T1> &val1,
│ │ │ │ -
879 const std::decay_t<T2> &val2)
│ │ │ │ -
880 {
│ │ │ │ -
881#define DUNE_SIMD_OPNAME (className<OpInfixComma(T1, T2)>())
│ │ │ │ -
882 static_assert(std::is_same<decltype((std::declval<T1>(),
│ │ │ │ -
883 std::declval<T2>())), T2>::value,
│ │ │ │ -
884 "Type and value category of the comma operator must "
│ │ │ │ -
885 "match that of the second operand");
│ │ │ │ -
886
│ │ │ │ -
887 // copy the arguments in case T1 or T2 are references
│ │ │ │ -
888 auto arg1 = val1;
│ │ │ │ -
889 auto arg2 = val2;
│ │ │ │ -
890 // Do not warn that the left side of the comma operator is unused.
│ │ │ │ -
891 // Seems to work for g++-4.9 and clang++-3.8. Appears to be harmless
│ │ │ │ -
892 // for icpc (14 and 17), and icpc does not seem to issue a warning
│ │ │ │ -
893 // anyway.
│ │ │ │ -
894#pragma GCC diagnostic push
│ │ │ │ -
895#pragma GCC diagnostic ignored "-Wunused-value"
│ │ │ │ -
896 auto &&result = (static_cast<T1>(arg1),
│ │ │ │ -
897 static_cast<T2>(arg2));
│ │ │ │ -
898#pragma GCC diagnostic pop
│ │ │ │ -
899 if(std::is_reference<T2>::value)
│ │ │ │ -
900 {
│ │ │ │ -
901 // comma should return the same object as the second argument for
│ │ │ │ -
902 // lvalues and xvalues
│ │ │ │ -
903 DUNE_SIMD_CHECK_OP(&result == &arg2);
│ │ │ │ -
904 // it should not modify any arguments
│ │ │ │ -
905 DUNE_SIMD_CHECK_OP(allTrue(val1 == arg1));
│ │ │ │ -
906 DUNE_SIMD_CHECK_OP(allTrue(val2 == arg2));
│ │ │ │ -
907 }
│ │ │ │ -
908 else
│ │ │ │ -
909 {
│ │ │ │ -
910 // comma should return the same value as the second argument for
│ │ │ │ -
911 // prvalues
│ │ │ │ -
912 DUNE_SIMD_CHECK_OP(allTrue(result == arg2));
│ │ │ │ -
913 // it should not modify any arguments
│ │ │ │ -
914 DUNE_SIMD_CHECK_OP(allTrue(val1 == arg1));
│ │ │ │ -
915 // second argument is a prvalue, any modifications happen to a
│ │ │ │ -
916 // temporary and we can't detect them
│ │ │ │ -
917 }
│ │ │ │ -
918#undef DUNE_SIMD_OPNAME
│ │ │ │ -
919 }
│ │ │ │ -
920
│ │ │ │ -
922 //
│ │ │ │ -
923 // checks for vector-vector binary operations
│ │ │ │ -
924 //
│ │ │ │ -
925
│ │ │ │ -
926 // We check the following candidate operation
│ │ │ │ -
927 //
│ │ │ │ -
928 // vopres = vop1 @ vop2
│ │ │ │ -
929 //
│ │ │ │ -
930 // against the reference operation
│ │ │ │ -
931 //
│ │ │ │ -
932 // arefres[l] = aref1[l] @ aref2[l] foreach l
│ │ │ │ -
933 //
│ │ │ │ -
934 // v... variables are simd-vectors and a... variables are arrays. The
│ │ │ │ -
935 // operation may modify the operands, but if is does the modification
│ │ │ │ -
936 // needs to happen in both the candidate and the reference.
│ │ │ │ -
937 //
│ │ │ │ -
938 // We do the following checks:
│ │ │ │ -
939 // 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
940 // 2. lane(l, vopres) == arefres[l] foreach l
│ │ │ │ -
941 // 3. lane(l, vop1) == aref1[l] foreach l
│ │ │ │ -
942 // 4. lane(l, vop2) == aref2[l] foreach l
│ │ │ │ -
943 template<class V1, class V2, class Op>
│ │ │ │ -
944 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, V2> >
│ │ │ │ -
945 checkBinaryOpVV(MetaType<V1>, MetaType<V2>, Op op)
│ │ │ │ -
946 {
│ │ │ │ -
947#define DUNE_SIMD_OPNAME (className<Op(V1, V2)>())
│ │ │ │ -
948 static_assert(std::is_same<std::decay_t<V1>, std::decay_t<V2> >::value,
│ │ │ │ -
949 "Internal testsystem error: called with two types that "
│ │ │ │ -
950 "don't decay to the same thing");
│ │ │ │ -
951
│ │ │ │ -
952 // reference arguments
│ │ │ │ -
953 auto vref1 = leftVector<std::decay_t<V1>>();
│ │ │ │ -
954 auto vref2 = rightVector<std::decay_t<V2>>();
│ │ │ │ -
955
│ │ │ │ -
956 // candidate arguments
│ │ │ │ -
957 auto vop1 = vref1;
│ │ │ │ -
958 auto vop2 = vref2;
│ │ │ │ -
959
│ │ │ │ -
960 // candidate operation
│ │ │ │ -
961 auto &&vopres = op(static_cast<V1>(vop1), static_cast<V2>(vop2));
│ │ │ │ -
962 using VR = decltype(vopres);
│ │ │ │ -
963
│ │ │ │ -
964 // check 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
965 static_assert(lanes<std::decay_t<VR> >() == lanes<std::decay_t<V1> >(),
│ │ │ │ -
966 "The result must have the same number of lanes as the "
│ │ │ │ -
967 "operands.");
│ │ │ │ -
968
│ │ │ │ -
969 // do the reference operation, and simultaneously
│ │ │ │ -
970 // check 2. lane(l, vopres) == arefres[l] foreach l
│ │ │ │ -
971 using T = Scalar<std::decay_t<VR> >;
│ │ │ │ -
972 for(auto l : range(lanes(vopres)))
│ │ │ │ -
973 {
│ │ │ │ -
974 // see the lengthy comment in `checkUnaryOpV()` as to why the
│ │ │ │ -
975 // `static_cast` around the `op()` is necessary
│ │ │ │ - │ │ │ │ -
977 (lane(l, vopres)
│ │ │ │ -
978 == static_cast<T>(op(lane(l, static_cast<V1>(vref1)),
│ │ │ │ -
979 lane(l, static_cast<V2>(vref2)))));
│ │ │ │ -
980 }
│ │ │ │ -
981
│ │ │ │ -
982 // check 3. lane(l, vop1) == aref1[l] foreach l
│ │ │ │ -
983 for(auto l : range(lanes(vop1)))
│ │ │ │ -
984 DUNE_SIMD_CHECK_OP(lane(l, vop1) == lane(l, vref1));
│ │ │ │ -
985
│ │ │ │ -
986 // check 4. lane(l, vop2) == aref2[l] foreach l
│ │ │ │ -
987 for(auto l : range(lanes(vop2)))
│ │ │ │ -
988 DUNE_SIMD_CHECK_OP(lane(l, vop2) == lane(l, vref2));
│ │ │ │ -
989
│ │ │ │ -
990#undef DUNE_SIMD_OPNAME
│ │ │ │ -
991 }
│ │ │ │ -
992
│ │ │ │ -
993 template<class V1, class V2, class Op>
│ │ │ │ -
994 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, V2> >
│ │ │ │ -
995 checkBinaryOpVV(MetaType<V1>, MetaType<V2>, Op op)
│ │ │ │ -
996 {
│ │ │ │ -
997 // log_ << "No " << className<Op(decltype(lane(0, std::declval<V1>())),
│ │ │ │ -
998 // decltype(lane(0, std::declval<V2>())))>()
│ │ │ │ -
999 // << std::endl
│ │ │ │ -
1000 // << " ==> Not checking " << className<Op(V1, V2)>() << std::endl;
│ │ │ │ -
1001 }
│ │ │ │ -
1002
│ │ │ │ -
1003 template<class V1, class V2>
│ │ │ │ -
1004 void checkBinaryOpVV(MetaType<V1>, MetaType<V2>, OpInfixComma)
│ │ │ │ -
1005 {
│ │ │ │ -
1006 static_assert(std::is_same<std::decay_t<V1>, std::decay_t<V2> >::value,
│ │ │ │ -
1007 "Internal testsystem error: called with two types that "
│ │ │ │ -
1008 "don't decay to the same thing");
│ │ │ │ -
1009
│ │ │ │ -
1010 checkCommaOp<V1, V2>(leftVector<std::decay_t<V1>>(),
│ │ │ │ -
1011 rightVector<std::decay_t<V2>>());
│ │ │ │ -
1012 }
│ │ │ │ -
1013
│ │ │ │ -
1015 //
│ │ │ │ -
1016 // checks for vector-scalar binary operations
│ │ │ │ -
1017 //
│ │ │ │ +
877 iterator begin();
│ │ │ │ +
878
│ │ │ │ +
879 iterator end();
│ │ │ │ +
880
│ │ │ │ +
881 private:
│ │ │ │ +
882
│ │ │ │ +
883 Map map_;
│ │ │ │ +
884 GlobalIndex index_;
│ │ │ │ +
885 Attribute attribute_;
│ │ │ │ +
886 bool noattribute;
│ │ │ │ +
887 };
│ │ │ │ +
│ │ │ │ +
888
│ │ │ │ +
889 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
891 {
│ │ │ │ +
892 if(type==MPI_DATATYPE_NULL) {
│ │ │ │ +
893 int length[2] = {1, 1};
│ │ │ │ +
894 MPI_Aint base;
│ │ │ │ +
895 MPI_Aint disp[2];
│ │ │ │ +
896 MPI_Datatype types[2] = {MPITraits<TG>::getType(),
│ │ │ │ + │ │ │ │ + │ │ │ │ +
899 MPI_Get_address(&rep, &base); // lower bound of the datatype
│ │ │ │ +
900 MPI_Get_address(&(rep.global_), &disp[0]);
│ │ │ │ +
901 MPI_Get_address(&(rep.local_), &disp[1]);
│ │ │ │ +
902 for (MPI_Aint& d : disp)
│ │ │ │ +
903 d -= base;
│ │ │ │ +
904
│ │ │ │ +
905 MPI_Datatype tmp;
│ │ │ │ +
906 MPI_Type_create_struct(2, length, disp, types, &tmp);
│ │ │ │ +
907
│ │ │ │ +
908 MPI_Type_create_resized(tmp, 0, sizeof(IndexPair<TG,ParallelLocalIndex<TA> >), &type);
│ │ │ │ +
909 MPI_Type_commit(&type);
│ │ │ │ +
910
│ │ │ │ +
911 MPI_Type_free(&tmp);
│ │ │ │ +
912 }
│ │ │ │ +
913 return type;
│ │ │ │ +
914 }
│ │ │ │ +
│ │ │ │ +
915
│ │ │ │ +
916 template<typename TG, typename TA>
│ │ │ │ +
917 MPI_Datatype MPITraits<IndexPair<TG,ParallelLocalIndex<TA> > >::type=MPI_DATATYPE_NULL;
│ │ │ │ +
918
│ │ │ │ +
919 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ +
920 RemoteIndex<T1,T2>::RemoteIndex(const T2& attribute, const PairType* local)
│ │ │ │ +
921 : localIndex_(local), attribute_(static_cast<std::underlying_type_t<T2>>(attribute))
│ │ │ │ +
922 {}
│ │ │ │ +
│ │ │ │ +
923
│ │ │ │ +
924 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
926 : localIndex_(0), attribute_(static_cast<std::underlying_type_t<T2>>(attribute))
│ │ │ │ +
927 {}
│ │ │ │ +
│ │ │ │ +
928
│ │ │ │ +
929 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
931 : localIndex_(0), attribute_()
│ │ │ │ +
932 {}
│ │ │ │ +
│ │ │ │ +
933 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ +
934 inline bool RemoteIndex<T1,T2>::operator==(const RemoteIndex& ri) const
│ │ │ │ +
935 {
│ │ │ │ +
936 return localIndex_==ri.localIndex_ && attribute_==ri.attribute;
│ │ │ │ +
937 }
│ │ │ │ +
│ │ │ │ +
938
│ │ │ │ +
939 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ +
940 inline bool RemoteIndex<T1,T2>::operator!=(const RemoteIndex& ri) const
│ │ │ │ +
941 {
│ │ │ │ +
942 return localIndex_!=ri.localIndex_ || attribute_!=ri.attribute_;
│ │ │ │ +
943 }
│ │ │ │ +
│ │ │ │ +
944
│ │ │ │ +
945 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ +
946 inline const T2 RemoteIndex<T1,T2>::attribute() const
│ │ │ │ +
947 {
│ │ │ │ +
948 return T2(attribute_);
│ │ │ │ +
949 }
│ │ │ │ +
│ │ │ │ +
950
│ │ │ │ +
951 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
953 {
│ │ │ │ +
954 return *localIndex_;
│ │ │ │ +
955 }
│ │ │ │ +
│ │ │ │ +
956
│ │ │ │ +
957 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
959 const ParallelIndexSet& destination,
│ │ │ │ +
960 const MPI_Comm& comm,
│ │ │ │ +
961 const std::vector<int>& neighbours,
│ │ │ │ +
962 bool includeSelf_)
│ │ │ │ +
963 : source_(&source), target_(&destination), comm_(comm),
│ │ │ │ +
964 sourceSeqNo_(-1), destSeqNo_(-1), publicIgnored(false), firstBuild(true),
│ │ │ │ +
965 includeSelf(includeSelf_)
│ │ │ │ +
966 {
│ │ │ │ + │ │ │ │ +
968 }
│ │ │ │ +
│ │ │ │ +
969
│ │ │ │ +
970 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
972 {
│ │ │ │ +
973 includeSelf=b;
│ │ │ │ +
974 }
│ │ │ │ +
│ │ │ │ +
975
│ │ │ │ +
976 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
978 : source_(0), target_(0), sourceSeqNo_(-1),
│ │ │ │ +
979 destSeqNo_(-1), publicIgnored(false), firstBuild(true),
│ │ │ │ +
980 includeSelf(false)
│ │ │ │ +
981 {}
│ │ │ │ +
│ │ │ │ +
982
│ │ │ │ +
983 template<class T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
985 const ParallelIndexSet& destination,
│ │ │ │ +
986 const MPI_Comm& comm,
│ │ │ │ +
987 const std::vector<int>& neighbours)
│ │ │ │ +
988 {
│ │ │ │ +
989 free();
│ │ │ │ +
990 source_ = &source;
│ │ │ │ +
991 target_ = &destination;
│ │ │ │ +
992 comm_ = comm;
│ │ │ │ +
993 firstBuild = true;
│ │ │ │ +
994 setNeighbours(neighbours);
│ │ │ │ +
995 }
│ │ │ │ +
│ │ │ │ +
996
│ │ │ │ +
997 template<typename T, typename A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
1000 {
│ │ │ │ +
1001 return *source_;
│ │ │ │ +
1002 }
│ │ │ │ +
│ │ │ │ +
1003
│ │ │ │ +
1004
│ │ │ │ +
1005 template<typename T, typename A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
1008 {
│ │ │ │ +
1009 return *target_;
│ │ │ │ +
1010 }
│ │ │ │ +
│ │ │ │ +
1011
│ │ │ │ +
1012
│ │ │ │ +
1013 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1015 {
│ │ │ │ +
1016 free();
│ │ │ │ +
1017 }
│ │ │ │ +
│ │ │ │
1018
│ │ │ │ -
1019 // We check the following candidate operation
│ │ │ │ -
1020 //
│ │ │ │ -
1021 // vopres = vop1 @ sop2
│ │ │ │ -
1022 //
│ │ │ │ -
1023 // against the reference operation
│ │ │ │ -
1024 //
│ │ │ │ -
1025 // arefres[l] = aref1[l] @ sref2 foreach l
│ │ │ │ -
1026 //
│ │ │ │ -
1027 // v... variables are simd-vectors, a... variables are arrays, and
│ │ │ │ -
1028 // s... variables are scalars. The operation may modify the left
│ │ │ │ -
1029 // operand, but if is does the modifications needs to happen in both the
│ │ │ │ -
1030 // candidate and the reference.
│ │ │ │ -
1031 //
│ │ │ │ -
1032 // We do the following checks:
│ │ │ │ -
1033 // 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
1034 // 2. lane(l, vopres) == arefres[l] foreach l
│ │ │ │ -
1035 // 3. lane(l, vop1) == aref1[l] foreach l
│ │ │ │ -
1036 // 4. sop2 is never modified
│ │ │ │ -
1037 // 5. sref2 is never modified
│ │ │ │ -
1038 //
│ │ │ │ -
1039 // In fact, if the property "sref2 is never modified" is violated that
│ │ │ │ -
1040 // means the operation is unsuitable for an automatic broadcast of the
│ │ │ │ -
1041 // second operand and should not be checked. There are no operations in
│ │ │ │ -
1042 // the standard where the second operand is modified like this, but
│ │ │ │ -
1043 // there are operations where the first operand is modified -- and this
│ │ │ │ -
1044 // check is used for those ops as well by exchanging the first and second
│ │ │ │ -
1045 // argument below.
│ │ │ │ -
1046
│ │ │ │ -
1047 template<class V1, class T2, class Op>
│ │ │ │ -
1048 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, T2> >
│ │ │ │ -
1049 checkBinaryOpVS(MetaType<V1>, MetaType<T2>, Op op)
│ │ │ │ -
1050 {
│ │ │ │ -
1051#define DUNE_SIMD_OPNAME (className<Op(V1, T2)>())
│ │ │ │ -
1052 static_assert(std::is_same<Scalar<std::decay_t<V1> >,
│ │ │ │ -
1053 std::decay_t<T2> >::value,
│ │ │ │ -
1054 "Internal testsystem error: called with a scalar that "
│ │ │ │ -
1055 "does not match the vector type.");
│ │ │ │ -
1056
│ │ │ │ -
1057 // initial values
│ │ │ │ -
1058 auto sinit2 = rightScalar<std::decay_t<T2>>();
│ │ │ │ +
1019 template<typename T, typename A>
│ │ │ │ +
1020 template<bool ignorePublic>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1022 const ParallelIndexSet& indexSet,
│ │ │ │ +
1023 char* p_out, MPI_Datatype type,
│ │ │ │ +
1024 int bufferSize,
│ │ │ │ +
1025 int *position,
│ │ │ │ +
1026 [[maybe_unused]] int n)
│ │ │ │ +
1027 {
│ │ │ │ +
1028 // fill with own indices
│ │ │ │ +
1029 const auto end = indexSet.end();
│ │ │ │ +
1030
│ │ │ │ +
1031 //Now pack the source indices
│ │ │ │ +
1032 int i=0;
│ │ │ │ +
1033 for(auto index = indexSet.begin(); index != end; ++index)
│ │ │ │ +
1034 if(ignorePublic || index->local().isPublic()) {
│ │ │ │ +
1035
│ │ │ │ +
1036 MPI_Pack(const_cast<PairType*>(&(*index)), 1,
│ │ │ │ +
1037 type,
│ │ │ │ +
1038 p_out, bufferSize, position, comm_);
│ │ │ │ +
1039 pairs[i++] = const_cast<PairType*>(&(*index));
│ │ │ │ +
1040
│ │ │ │ +
1041 }
│ │ │ │ +
1042 assert(i==n);
│ │ │ │ +
1043 }
│ │ │ │ +
│ │ │ │ +
1044
│ │ │ │ +
1045 template<typename T, typename A>
│ │ │ │ +
1046 inline int RemoteIndices<T,A>::noPublic(const ParallelIndexSet& indexSet)
│ │ │ │ +
1047 {
│ │ │ │ +
1048
│ │ │ │ +
1049 int noPublic=0;
│ │ │ │ +
1050
│ │ │ │ +
1051 const auto end=indexSet.end();
│ │ │ │ +
1052 for(auto index=indexSet.begin(); index!=end; ++index)
│ │ │ │ +
1053 if(index->local().isPublic())
│ │ │ │ +
1054 noPublic++;
│ │ │ │ +
1055
│ │ │ │ +
1056 return noPublic;
│ │ │ │ +
1057
│ │ │ │ +
1058 }
│ │ │ │
1059
│ │ │ │ -
1060 // reference arguments
│ │ │ │ -
1061 auto vref1 = leftVector<std::decay_t<V1>>();
│ │ │ │ -
1062 auto sref2 = sinit2;
│ │ │ │ -
1063
│ │ │ │ -
1064 // candidate arguments
│ │ │ │ -
1065 auto vop1 = vref1;
│ │ │ │ -
1066 auto sop2 = sref2;
│ │ │ │ -
1067
│ │ │ │ -
1068 // candidate operation
│ │ │ │ -
1069 auto &&vopres = op(static_cast<V1>(vop1), static_cast<T2>(sop2));
│ │ │ │ -
1070 using VR = decltype(vopres);
│ │ │ │ -
1071
│ │ │ │ -
1072 // check 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
1073 static_assert(lanes<std::decay_t<VR> >() == lanes<std::decay_t<V1> >(),
│ │ │ │ -
1074 "The result must have the same number of lanes as the "
│ │ │ │ -
1075 "operands.");
│ │ │ │ -
1076
│ │ │ │ -
1077 // check 4. sop2 is never modified
│ │ │ │ -
1078 DUNE_SIMD_CHECK_OP(sop2 == sinit2);
│ │ │ │ +
1060
│ │ │ │ +
1061 template<typename T, typename A>
│ │ │ │ +
1062 inline void RemoteIndices<T,A>::unpackCreateRemote(char* p_in, PairType** sourcePairs,
│ │ │ │ +
1063 PairType** destPairs, int remoteProc,
│ │ │ │ +
1064 int sourcePublish, int destPublish,
│ │ │ │ +
1065 int bufferSize, bool sendTwo,
│ │ │ │ +
1066 bool fromOurSelf)
│ │ │ │ +
1067 {
│ │ │ │ +
1068
│ │ │ │ +
1069 // unpack the number of indices we received
│ │ │ │ +
1070 int noRemoteSource=-1, noRemoteDest=-1;
│ │ │ │ +
1071 char twoIndexSets=0;
│ │ │ │ +
1072 int position=0;
│ │ │ │ +
1073 // Did we receive two index sets?
│ │ │ │ +
1074 MPI_Unpack(p_in, bufferSize, &position, &twoIndexSets, 1, MPI_CHAR, comm_);
│ │ │ │ +
1075 // The number of source indices received
│ │ │ │ +
1076 MPI_Unpack(p_in, bufferSize, &position, &noRemoteSource, 1, MPI_INT, comm_);
│ │ │ │ +
1077 // The number of destination indices received
│ │ │ │ +
1078 MPI_Unpack(p_in, bufferSize, &position, &noRemoteDest, 1, MPI_INT, comm_);
│ │ │ │
1079
│ │ │ │ -
1080 // do the reference operation, and simultaneously check 2. and 5.
│ │ │ │ -
1081 using T = Scalar<std::decay_t<decltype(vopres)> >;
│ │ │ │ -
1082 for(auto l : range(lanes(vopres)))
│ │ │ │ -
1083 {
│ │ │ │ -
1084 // check 2. lane(l, vopres) == arefres[l] foreach l
│ │ │ │ -
1085 // see the lengthy comment in `checkUnaryOpV()` as to why the
│ │ │ │ -
1086 // `static_cast` around the `op()` is necessary
│ │ │ │ - │ │ │ │ -
1088 (lane(l, vopres)
│ │ │ │ -
1089 == static_cast<T>(op(lane(l, static_cast<V1>(vref1)),
│ │ │ │ -
1090 static_cast<T2>(sref2) )));
│ │ │ │ -
1091 // check 5. sref2 is never modified
│ │ │ │ -
1092 DUNE_SIMD_CHECK_OP(sref2 == sinit2);
│ │ │ │ -
1093 }
│ │ │ │ -
1094
│ │ │ │ -
1095 // check 3. lane(l, vop1) == aref1[l] foreach l
│ │ │ │ -
1096 for(auto l : range(lanes(vop1)))
│ │ │ │ -
1097 DUNE_SIMD_CHECK_OP(lane(l, vop1) == lane(l, vref1));
│ │ │ │ -
1098
│ │ │ │ -
1099#undef DUNE_SIMD_OPNAME
│ │ │ │ -
1100 }
│ │ │ │ +
1080
│ │ │ │ +
1081 // Indices for which we receive
│ │ │ │ +
1082 RemoteIndexList* receive= new RemoteIndexList();
│ │ │ │ +
1083 // Indices for which we send
│ │ │ │ +
1084 RemoteIndexList* send=0;
│ │ │ │ +
1085
│ │ │ │ +
1086 MPI_Datatype type= MPITraits<PairType>::getType();
│ │ │ │ +
1087
│ │ │ │ +
1088 if(!twoIndexSets) {
│ │ │ │ +
1089 if(sendTwo) {
│ │ │ │ +
1090 send = new RemoteIndexList();
│ │ │ │ +
1091 // Create both remote index sets simultaneously
│ │ │ │ +
1092 unpackIndices(*send, *receive, noRemoteSource, sourcePairs, sourcePublish,
│ │ │ │ +
1093 destPairs, destPublish, p_in, type, &position, bufferSize);
│ │ │ │ +
1094 }else{
│ │ │ │ +
1095 // we only need one list
│ │ │ │ +
1096 unpackIndices(*receive, noRemoteSource, sourcePairs, sourcePublish,
│ │ │ │ +
1097 p_in, type, &position, bufferSize, fromOurSelf);
│ │ │ │ +
1098 send=receive;
│ │ │ │ +
1099 }
│ │ │ │ +
1100 }else{
│ │ │ │
1101
│ │ │ │ -
1102 template<class V1, class T2, class Op>
│ │ │ │ -
1103 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, T2> >
│ │ │ │ -
1104 checkBinaryOpVS(MetaType<V1>, MetaType<T2>, Op op)
│ │ │ │ -
1105 {
│ │ │ │ -
1106 // log_ << "No "
│ │ │ │ -
1107 // << className<Op(decltype(lane(0, std::declval<V1>())), T2)>()
│ │ │ │ -
1108 // << std::endl
│ │ │ │ -
1109 // << " ==> Not checking " << className<Op(V1, T2)>() << std::endl;
│ │ │ │ -
1110 }
│ │ │ │ -
1111
│ │ │ │ -
1112 template<class V1, class T2>
│ │ │ │ -
1113 void checkBinaryOpVS(MetaType<V1>, MetaType<T2>, OpInfixComma)
│ │ │ │ -
1114 {
│ │ │ │ -
1115 static_assert(std::is_same<Scalar<std::decay_t<V1> >,
│ │ │ │ -
1116 std::decay_t<T2> >::value,
│ │ │ │ -
1117 "Internal testsystem error: called with a scalar that "
│ │ │ │ -
1118 "does not match the vector type.");
│ │ │ │ -
1119
│ │ │ │ -
1120 checkCommaOp<V1, T2>(leftVector<std::decay_t<V1>>(),
│ │ │ │ -
1121 rightScalar<std::decay_t<T2>>());
│ │ │ │ -
1122 }
│ │ │ │ -
1123
│ │ │ │ -
1125 //
│ │ │ │ -
1126 // cross-check scalar-vector binary operations against vector-vector
│ │ │ │ -
1127 //
│ │ │ │ +
1102 int oldPos=position;
│ │ │ │ +
1103 // Two index sets received
│ │ │ │ +
1104 unpackIndices(*receive, noRemoteSource, destPairs, destPublish,
│ │ │ │ +
1105 p_in, type, &position, bufferSize, fromOurSelf);
│ │ │ │ +
1106 if(!sendTwo)
│ │ │ │ +
1107 //unpack source entries again as destination entries
│ │ │ │ +
1108 position=oldPos;
│ │ │ │ +
1109
│ │ │ │ +
1110 send = new RemoteIndexList();
│ │ │ │ +
1111 unpackIndices(*send, noRemoteDest, sourcePairs, sourcePublish,
│ │ │ │ +
1112 p_in, type, &position, bufferSize, fromOurSelf);
│ │ │ │ +
1113 }
│ │ │ │ +
1114
│ │ │ │ +
1115 if(receive->empty() && send->empty()) {
│ │ │ │ +
1116 if(send==receive) {
│ │ │ │ +
1117 delete send;
│ │ │ │ +
1118 }else{
│ │ │ │ +
1119 delete send;
│ │ │ │ +
1120 delete receive;
│ │ │ │ +
1121 }
│ │ │ │ +
1122 }else{
│ │ │ │ +
1123 remoteIndices_.insert(std::make_pair(remoteProc,
│ │ │ │ +
1124 std::make_pair(send,receive)));
│ │ │ │ +
1125 }
│ │ │ │ +
1126 }
│ │ │ │ +
1127
│ │ │ │
1128
│ │ │ │ -
1129 // We check the following candidate operation
│ │ │ │ -
1130 //
│ │ │ │ -
1131 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2)
│ │ │ │ -
1132 //
│ │ │ │ -
1133 // against the reference operation
│ │ │ │ -
1134 //
│ │ │ │ -
1135 // vrefres = vref1 @ sref2
│ │ │ │ -
1136 //
│ │ │ │ -
1137 // v... variables are simd-vectors, a... variables are arrays, and
│ │ │ │ -
1138 // s... variables are scalars.
│ │ │ │ -
1139 //
│ │ │ │ -
1140 // We could check the following properties
│ │ │ │ -
1141 // 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
1142 // 2. lane(l, vopres) == lane(l, vrefres) foreach l
│ │ │ │ -
1143 // 3. lane(l, vop1) == lane(l, vref1) foreach l
│ │ │ │ -
1144 // but these are given by checking the operation against the scalar
│ │ │ │ -
1145 // operation in the vector@vector and vector@scalar cases above.
│ │ │ │ -
1146 //
│ │ │ │ -
1147 // The only thing left to check is:
│ │ │ │ -
1148 // 4. lane(l, vop2) foreach l is never modified
│ │ │ │ -
1149
│ │ │ │ -
1150 template<class V1, class T2, class Op>
│ │ │ │ -
1151 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, T2> >
│ │ │ │ -
1152 checkBinaryOpVVAgainstVS(MetaType<V1>, MetaType<T2>, Op op)
│ │ │ │ -
1153 {
│ │ │ │ -
1154#define DUNE_SIMD_OPNAME (className<Op(V1, T2)>())
│ │ │ │ -
1155 static_assert(std::is_same<Scalar<std::decay_t<V1> >,
│ │ │ │ -
1156 std::decay_t<T2> >::value,
│ │ │ │ -
1157 "Internal testsystem error: called with a scalar that "
│ │ │ │ -
1158 "does not match the vector type.");
│ │ │ │ -
1159
│ │ │ │ -
1160 // initial values
│ │ │ │ -
1161 auto sinit2 = rightScalar<std::decay_t<T2>>();
│ │ │ │ -
1162
│ │ │ │ -
1163 // reference arguments
│ │ │ │ -
1164 auto vop1 = leftVector<std::decay_t<V1>>();
│ │ │ │ -
1165 using V2 = CopyRefQual<V1, T2>;
│ │ │ │ -
1166 std::decay_t<V2> vop2(sinit2);
│ │ │ │ -
1167
│ │ │ │ -
1168 // candidate operation
│ │ │ │ -
1169 op(static_cast<V1>(vop1), static_cast<V2>(vop2));
│ │ │ │ +
1129 template<typename T, typename A>
│ │ │ │ +
1130 template<bool ignorePublic>
│ │ │ │ +
1131 inline void RemoteIndices<T,A>::buildRemote(bool includeSelf_)
│ │ │ │ +
1132 {
│ │ │ │ +
1133 // Processor configuration
│ │ │ │ +
1134 int rank, procs;
│ │ │ │ +
1135 MPI_Comm_rank(comm_, &rank);
│ │ │ │ +
1136 MPI_Comm_size(comm_, &procs);
│ │ │ │ +
1137
│ │ │ │ +
1138 // number of local indices to publish
│ │ │ │ +
1139 // The indices of the destination will be send.
│ │ │ │ +
1140 int sourcePublish, destPublish;
│ │ │ │ +
1141
│ │ │ │ +
1142 // Do we need to send two index sets?
│ │ │ │ +
1143 char sendTwo = (source_ != target_);
│ │ │ │ +
1144
│ │ │ │ +
1145 if(procs==1 && !(sendTwo || includeSelf_))
│ │ │ │ +
1146 // Nothing to communicate
│ │ │ │ +
1147 return;
│ │ │ │ +
1148
│ │ │ │ +
1149 sourcePublish = (ignorePublic) ? source_->size() : noPublic(*source_);
│ │ │ │ +
1150
│ │ │ │ +
1151 if(sendTwo)
│ │ │ │ +
1152 destPublish = (ignorePublic) ? target_->size() : noPublic(*target_);
│ │ │ │ +
1153 else
│ │ │ │ +
1154 // we only need to send one set of indices
│ │ │ │ +
1155 destPublish = 0;
│ │ │ │ +
1156
│ │ │ │ +
1157 int maxPublish, publish=sourcePublish+destPublish;
│ │ │ │ +
1158
│ │ │ │ +
1159 // Calculate maximum number of indices send
│ │ │ │ +
1160 MPI_Allreduce(&publish, &maxPublish, 1, MPI_INT, MPI_MAX, comm_);
│ │ │ │ +
1161
│ │ │ │ +
1162 // allocate buffers
│ │ │ │ +
1163 PairType** destPairs;
│ │ │ │ +
1164 PairType** sourcePairs = new PairType*[sourcePublish>0 ? sourcePublish : 1];
│ │ │ │ +
1165
│ │ │ │ +
1166 if(sendTwo)
│ │ │ │ +
1167 destPairs = new PairType*[destPublish>0 ? destPublish : 1];
│ │ │ │ +
1168 else
│ │ │ │ +
1169 destPairs=sourcePairs;
│ │ │ │
1170
│ │ │ │ -
1171 // 4. lane(l, vop2) foreach l is never modified
│ │ │ │ -
1172 for(auto l : range(lanes(vop2)))
│ │ │ │ -
1173 DUNE_SIMD_CHECK_OP(lane(l, vop2) == sinit2);
│ │ │ │ -
1174
│ │ │ │ -
1175#undef DUNE_SIMD_OPNAME
│ │ │ │ -
1176 }
│ │ │ │ -
1177
│ │ │ │ -
1178 template<class V1, class T2, class Op>
│ │ │ │ -
1179 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, T2> >
│ │ │ │ -
1180 checkBinaryOpVVAgainstVS(MetaType<V1>, MetaType<T2>, Op op)
│ │ │ │ -
1181 {
│ │ │ │ -
1182 // log_ << "No "
│ │ │ │ -
1183 // << className<Op(decltype(lane(0, std::declval<V1>())), T2)>()
│ │ │ │ -
1184 // << std::endl
│ │ │ │ -
1185 // << " ==> Not checking " << className<Op(V1, T2)>() << std::endl;
│ │ │ │ -
1186 }
│ │ │ │ -
1187
│ │ │ │ -
1188 template<class V1, class T2>
│ │ │ │ -
1189 void checkBinaryOpVVAgainstVS(MetaType<V1>, MetaType<T2>, OpInfixComma)
│ │ │ │ -
1190 { }
│ │ │ │ +
1171 char** buffer = new char*[2];
│ │ │ │ +
1172 int bufferSize;
│ │ │ │ +
1173 int position=0;
│ │ │ │ +
1174 int intSize;
│ │ │ │ +
1175 int charSize;
│ │ │ │ +
1176
│ │ │ │ +
1177 // calculate buffer size
│ │ │ │ +
1178 MPI_Datatype type = MPITraits<PairType>::getType();
│ │ │ │ +
1179
│ │ │ │ +
1180 MPI_Pack_size(maxPublish, type, comm_,
│ │ │ │ +
1181 &bufferSize);
│ │ │ │ +
1182 MPI_Pack_size(1, MPI_INT, comm_,
│ │ │ │ +
1183 &intSize);
│ │ │ │ +
1184 MPI_Pack_size(1, MPI_CHAR, comm_,
│ │ │ │ +
1185 &charSize);
│ │ │ │ +
1186 // Our message will contain the following:
│ │ │ │ +
1187 // a bool whether two index sets where sent
│ │ │ │ +
1188 // the size of the source and the dest indexset,
│ │ │ │ +
1189 // then the source and destination indices
│ │ │ │ +
1190 bufferSize += 2 * intSize + charSize;
│ │ │ │
1191
│ │ │ │ -
1193 //
│ │ │ │ -
1194 // checks for vector-proxy binary operations
│ │ │ │ -
1195 //
│ │ │ │ +
1192 if(bufferSize<=0) bufferSize=1;
│ │ │ │ +
1193
│ │ │ │ +
1194 buffer[0] = new char[bufferSize];
│ │ │ │ +
1195 buffer[1] = new char[bufferSize];
│ │ │ │
1196
│ │ │ │ -
1197 // We check the following candidate operation
│ │ │ │ -
1198 //
│ │ │ │ -
1199 // vopres = vop1 @ pop2
│ │ │ │ -
1200 //
│ │ │ │ -
1201 // against the reference operation
│ │ │ │ -
1202 //
│ │ │ │ -
1203 // arefres[l] = aref1[l] @ sref2 foreach l
│ │ │ │ -
1204 //
│ │ │ │ -
1205 // v... variables are simd-vectors, a... variables are arrays,
│ │ │ │ -
1206 // p... variables are proxies of simd-vector entries and s... variables
│ │ │ │ -
1207 // are scalars. The operation may modify the left operand, but if is
│ │ │ │ -
1208 // does the modifications needs to happen in both the candidate and the
│ │ │ │ -
1209 // reference.
│ │ │ │ -
1210 //
│ │ │ │ -
1211 // We do the following checks:
│ │ │ │ -
1212 // 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
1213 // 2. lane(l, vopres) == arefres[l] foreach l
│ │ │ │ -
1214 // 3. lane(l, vop1) == aref1[l] foreach l
│ │ │ │ -
1215 // 4. pop2 is never modified
│ │ │ │ -
1216 // 5. sref2 is never modified
│ │ │ │ -
1217 //
│ │ │ │ -
1218 // In fact, if the property "sref2 is never modified" is violated that
│ │ │ │ -
1219 // means the operation is unsuitable for an automatic broadcast of the
│ │ │ │ -
1220 // second operand and should not be checked. There are no operations in
│ │ │ │ -
1221 // the standard where the second operand is modified like this, but
│ │ │ │ -
1222 // there are operations where the first operand is modified -- and this
│ │ │ │ -
1223 // check is used for those ops as well by exchanging the first and second
│ │ │ │ -
1224 // argument below.
│ │ │ │ -
1225
│ │ │ │ -
1226 template<class V1, class V2, class Op>
│ │ │ │ -
1227 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, V2> >
│ │ │ │ -
1228 checkBinaryOpVP(MetaType<V1>, MetaType<V2>, Op op)
│ │ │ │ -
1229 {
│ │ │ │ -
1230 using P2 = decltype(lane(0, std::declval<V2>()));
│ │ │ │ -
1231 using T2 = CopyRefQual<Scalar<V2>, V2>;
│ │ │ │ -
1232#define DUNE_SIMD_OPNAME (className<Op(V1, P2)>())
│ │ │ │ -
1233 static_assert(std::is_same<Scalar<V1>, Scalar<V2> >::value,
│ │ │ │ -
1234 "Internal testsystem error: called with two vector "
│ │ │ │ -
1235 "types whose scalar types don't match.");
│ │ │ │ -
1236
│ │ │ │ -
1237 // initial values
│ │ │ │ -
1238 auto sinit2 = rightScalar<Scalar<V2>>();
│ │ │ │ -
1239
│ │ │ │ -
1240 // reference arguments
│ │ │ │ -
1241 auto vref1 = leftVector<std::decay_t<V1>>();
│ │ │ │ -
1242 auto sref2 = sinit2;
│ │ │ │ -
1243
│ │ │ │ -
1244 // candidate arguments
│ │ │ │ -
1245 auto vop1 = vref1;
│ │ │ │ -
1246 auto vop2 = std::decay_t<V2>(Scalar<V2>(0));
│ │ │ │ -
1247 lane(0, vop2) = sref2; // pop2 is just a name for `lane(0, vop2)`
│ │ │ │ -
1248
│ │ │ │ -
1249 // candidate operation
│ │ │ │ -
1250 auto &&vopres =
│ │ │ │ -
1251 op(static_cast<V1>(vop1), lane(0, static_cast<V2>(vop2)));
│ │ │ │ -
1252 using VR = decltype(vopres);
│ │ │ │ -
1253
│ │ │ │ -
1254 // check 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
1255 static_assert(lanes<std::decay_t<VR> >() == lanes<std::decay_t<V1> >(),
│ │ │ │ -
1256 "The result must have the same number of lanes as the "
│ │ │ │ -
1257 "operands.");
│ │ │ │ -
1258
│ │ │ │ -
1259 // check 4. pop2 is never modified
│ │ │ │ -
1260 DUNE_SIMD_CHECK_OP(lane(0, vop2) == sinit2);
│ │ │ │ -
1261
│ │ │ │ -
1262 // do the reference operation, and simultaneously check 2. and 5.
│ │ │ │ -
1263 using T = Scalar<decltype(vopres)>;
│ │ │ │ -
1264 for(auto l : range(lanes(vopres)))
│ │ │ │ -
1265 {
│ │ │ │ -
1266 // check 2. lane(l, vopres) == arefres[l] foreach l
│ │ │ │ -
1267 // see the lengthy comment in `checkUnaryOpV()` as to why the
│ │ │ │ -
1268 // `static_cast` around the `op()` is necessary
│ │ │ │ - │ │ │ │ -
1270 (lane(l, vopres)
│ │ │ │ -
1271 == static_cast<T>(op(lane(l, static_cast<V1>(vref1)),
│ │ │ │ -
1272 static_cast<T2>(sref2) )));
│ │ │ │ -
1273 // check 5. sref2 is never modified
│ │ │ │ -
1274 DUNE_SIMD_CHECK_OP(sref2 == sinit2);
│ │ │ │ -
1275 }
│ │ │ │ -
1276
│ │ │ │ -
1277 // check 3. lane(l, vop1) == aref1[l] foreach l
│ │ │ │ -
1278 for(auto l : range(lanes(vop1)))
│ │ │ │ -
1279 DUNE_SIMD_CHECK_OP(lane(l, vop1) == lane(l, vref1));
│ │ │ │ -
1280
│ │ │ │ -
1281#undef DUNE_SIMD_OPNAME
│ │ │ │ -
1282 }
│ │ │ │ -
1283
│ │ │ │ -
1284 template<class V1, class V2, class Op>
│ │ │ │ -
1285 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, V2> >
│ │ │ │ -
1286 checkBinaryOpVP(MetaType<V1>, MetaType<V2>, Op op)
│ │ │ │ -
1287 {
│ │ │ │ -
1288 // log_ << "No "
│ │ │ │ -
1289 // << className<Op(decltype(lane(0, std::declval<V1>())), T2)>()
│ │ │ │ -
1290 // << std::endl
│ │ │ │ -
1291 // << " ==> Not checking " << className<Op(V1, T2)>() << std::endl;
│ │ │ │ -
1292 }
│ │ │ │ -
1293
│ │ │ │ -
1294 template<class V1, class V2>
│ │ │ │ -
1295 void checkBinaryOpVP(MetaType<V1>, MetaType<V2>, OpInfixComma)
│ │ │ │ -
1296 {
│ │ │ │ -
1297 // Don't really know how to check comma operator for proxies
│ │ │ │ -
1298 }
│ │ │ │ -
1299
│ │ │ │ -
1301 //
│ │ │ │ -
1302 // checks for (scalar/proxy)-vector binary operations
│ │ │ │ -
1303 //
│ │ │ │ -
1304
│ │ │ │ -
1305 template<class Op>
│ │ │ │ -
1306 struct OpInfixSwappedArgs
│ │ │ │ -
1307 {
│ │ │ │ -
1308 Op orig;
│ │ │ │ -
1309
│ │ │ │ -
1310 template<class V1, class V2>
│ │ │ │ -
1311 decltype(auto) operator()(V1&& v1, V2&& v2) const
│ │ │ │ -
1312 {
│ │ │ │ -
1313 return orig(std::forward<V2>(v2), std::forward<V1>(v1));
│ │ │ │ -
1314 }
│ │ │ │ -
1315 template<class S1, class S2>
│ │ │ │ -
1316 auto scalar(S1&& s1, S2&& s2) const
│ │ │ │ -
1317 -> decltype(orig.scalar(std::forward<S2>(s2), std::forward<S1>(s1)));
│ │ │ │ -
1318 };
│ │ │ │ -
1319
│ │ │ │ -
1320 template<class T1, class V2, class Op>
│ │ │ │ -
1321 void checkBinaryOpSV(MetaType<T1> t1, MetaType<V2> v2, Op op)
│ │ │ │ -
1322 {
│ │ │ │ -
1323 checkBinaryOpVS(v2, t1, OpInfixSwappedArgs<Op>{op});
│ │ │ │ -
1324 }
│ │ │ │ -
1325
│ │ │ │ -
1326 template<class T1, class V2>
│ │ │ │ -
1327 void checkBinaryOpSV(MetaType<T1>, MetaType<V2>, OpInfixComma)
│ │ │ │ -
1328 {
│ │ │ │ -
1329 static_assert(std::is_same<std::decay_t<T1>,
│ │ │ │ -
1330 Scalar<std::decay_t<V2> > >::value,
│ │ │ │ -
1331 "Internal testsystem error: called with a scalar that "
│ │ │ │ -
1332 "does not match the vector type.");
│ │ │ │ -
1333
│ │ │ │ -
1334 checkCommaOp<T1, V2>(leftScalar<std::decay_t<T1>>(),
│ │ │ │ -
1335 rightVector<std::decay_t<V2>>());
│ │ │ │ -
1336 }
│ │ │ │ +
1197
│ │ │ │ +
1198 // pack entries into buffer[0], p_out below!
│ │ │ │ +
1199 MPI_Pack(&sendTwo, 1, MPI_CHAR, buffer[0], bufferSize, &position,
│ │ │ │ +
1200 comm_);
│ │ │ │ +
1201
│ │ │ │ +
1202 // The number of indices we send for each index set
│ │ │ │ +
1203 MPI_Pack(&sourcePublish, 1, MPI_INT, buffer[0], bufferSize, &position,
│ │ │ │ +
1204 comm_);
│ │ │ │ +
1205 MPI_Pack(&destPublish, 1, MPI_INT, buffer[0], bufferSize, &position,
│ │ │ │ +
1206 comm_);
│ │ │ │ +
1207
│ │ │ │ +
1208 // Now pack the source indices and setup the destination pairs
│ │ │ │ +
1209 packEntries<ignorePublic>(sourcePairs, *source_, buffer[0], type,
│ │ │ │ +
1210 bufferSize, &position, sourcePublish);
│ │ │ │ +
1211 // If necessary send the dest indices and setup the source pairs
│ │ │ │ +
1212 if(sendTwo)
│ │ │ │ +
1213 packEntries<ignorePublic>(destPairs, *target_, buffer[0], type,
│ │ │ │ +
1214 bufferSize, &position, destPublish);
│ │ │ │ +
1215
│ │ │ │ +
1216
│ │ │ │ +
1217 // Update remote indices for ourself
│ │ │ │ +
1218 if(sendTwo|| includeSelf_)
│ │ │ │ +
1219 unpackCreateRemote(buffer[0], sourcePairs, destPairs, rank, sourcePublish,
│ │ │ │ +
1220 destPublish, bufferSize, sendTwo, includeSelf_);
│ │ │ │ +
1221
│ │ │ │ +
1222 neighbourIds.erase(rank);
│ │ │ │ +
1223
│ │ │ │ +
1224 if(neighbourIds.size()==0)
│ │ │ │ +
1225 {
│ │ │ │ +
1226 Dune::dvverb<<rank<<": Sending messages in a ring"<<std::endl;
│ │ │ │ +
1227 // send messages in ring
│ │ │ │ +
1228 for(int proc=1; proc<procs; proc++) {
│ │ │ │ +
1229 // pointers to the current input and output buffers
│ │ │ │ +
1230 char* p_out = buffer[1-(proc%2)];
│ │ │ │ +
1231 char* p_in = buffer[proc%2];
│ │ │ │ +
1232
│ │ │ │ +
1233 MPI_Status status;
│ │ │ │ +
1234 if(rank%2==0) {
│ │ │ │ +
1235 MPI_Ssend(p_out, bufferSize, MPI_PACKED, (rank+1)%procs,
│ │ │ │ +
1236 commTag_, comm_);
│ │ │ │ +
1237 MPI_Recv(p_in, bufferSize, MPI_PACKED, (rank+procs-1)%procs,
│ │ │ │ +
1238 commTag_, comm_, &status);
│ │ │ │ +
1239 }else{
│ │ │ │ +
1240 MPI_Recv(p_in, bufferSize, MPI_PACKED, (rank+procs-1)%procs,
│ │ │ │ +
1241 commTag_, comm_, &status);
│ │ │ │ +
1242 MPI_Ssend(p_out, bufferSize, MPI_PACKED, (rank+1)%procs,
│ │ │ │ +
1243 commTag_, comm_);
│ │ │ │ +
1244 }
│ │ │ │ +
1245
│ │ │ │ +
1246
│ │ │ │ +
1247 // The process these indices are from
│ │ │ │ +
1248 int remoteProc = (rank+procs-proc)%procs;
│ │ │ │ +
1249
│ │ │ │ +
1250 unpackCreateRemote(p_in, sourcePairs, destPairs, remoteProc, sourcePublish,
│ │ │ │ +
1251 destPublish, bufferSize, sendTwo);
│ │ │ │ +
1252
│ │ │ │ +
1253 }
│ │ │ │ +
1254
│ │ │ │ +
1255 }
│ │ │ │ +
1256 else
│ │ │ │ +
1257 {
│ │ │ │ +
1258 MPI_Request* requests=new MPI_Request[neighbourIds.size()];
│ │ │ │ +
1259 MPI_Request* req=requests;
│ │ │ │ +
1260
│ │ │ │ +
1261 typedef typename std::set<int>::size_type size_type;
│ │ │ │ +
1262 size_type noNeighbours=neighbourIds.size();
│ │ │ │ +
1263
│ │ │ │ +
1264 // setup sends
│ │ │ │ +
1265 for(std::set<int>::iterator neighbour=neighbourIds.begin();
│ │ │ │ +
1266 neighbour!= neighbourIds.end(); ++neighbour) {
│ │ │ │ +
1267 // Only send the information to the neighbouring processors
│ │ │ │ +
1268 MPI_Issend(buffer[0], position , MPI_PACKED, *neighbour, commTag_, comm_, req++);
│ │ │ │ +
1269 }
│ │ │ │ +
1270
│ │ │ │ +
1271 //Test for received messages
│ │ │ │ +
1272
│ │ │ │ +
1273 for(size_type received=0; received <noNeighbours; ++received)
│ │ │ │ +
1274 {
│ │ │ │ +
1275 MPI_Status status;
│ │ │ │ +
1276 // probe for next message
│ │ │ │ +
1277 MPI_Probe(MPI_ANY_SOURCE, commTag_, comm_, &status);
│ │ │ │ +
1278 int remoteProc=status.MPI_SOURCE;
│ │ │ │ +
1279 int size;
│ │ │ │ +
1280 MPI_Get_count(&status, MPI_PACKED, &size);
│ │ │ │ +
1281 // receive message
│ │ │ │ +
1282 MPI_Recv(buffer[1], size, MPI_PACKED, remoteProc,
│ │ │ │ +
1283 commTag_, comm_, &status);
│ │ │ │ +
1284
│ │ │ │ +
1285 unpackCreateRemote(buffer[1], sourcePairs, destPairs, remoteProc, sourcePublish,
│ │ │ │ +
1286 destPublish, bufferSize, sendTwo);
│ │ │ │ +
1287 }
│ │ │ │ +
1288 // wait for completion of pending requests
│ │ │ │ +
1289 MPI_Status* statuses = new MPI_Status[neighbourIds.size()];
│ │ │ │ +
1290
│ │ │ │ +
1291 if(MPI_ERR_IN_STATUS==MPI_Waitall(neighbourIds.size(), requests, statuses)) {
│ │ │ │ +
1292 for(size_type i=0; i < neighbourIds.size(); ++i)
│ │ │ │ +
1293 if(statuses[i].MPI_ERROR!=MPI_SUCCESS) {
│ │ │ │ +
1294 std::cerr<<rank<<": MPI_Error occurred while receiving message."<<std::endl;
│ │ │ │ +
1295 MPI_Abort(comm_, 999);
│ │ │ │ +
1296 }
│ │ │ │ +
1297 }
│ │ │ │ +
1298 delete[] requests;
│ │ │ │ +
1299 delete[] statuses;
│ │ │ │ +
1300 }
│ │ │ │ +
1301
│ │ │ │ +
1302
│ │ │ │ +
1303 // delete allocated memory
│ │ │ │ +
1304 if(destPairs!=sourcePairs)
│ │ │ │ +
1305 delete[] destPairs;
│ │ │ │ +
1306
│ │ │ │ +
1307 delete[] sourcePairs;
│ │ │ │ +
1308 delete[] buffer[0];
│ │ │ │ +
1309 delete[] buffer[1];
│ │ │ │ +
1310 delete[] buffer;
│ │ │ │ +
1311 }
│ │ │ │ +
1312
│ │ │ │ +
1313 template<typename T, typename A>
│ │ │ │ +
1314 inline void RemoteIndices<T,A>::unpackIndices(RemoteIndexList& remote,
│ │ │ │ +
1315 int remoteEntries,
│ │ │ │ +
1316 PairType** local,
│ │ │ │ +
1317 int localEntries,
│ │ │ │ +
1318 char* p_in,
│ │ │ │ +
1319 MPI_Datatype type,
│ │ │ │ +
1320 int* position,
│ │ │ │ +
1321 int bufferSize,
│ │ │ │ +
1322 bool fromOurSelf)
│ │ │ │ +
1323 {
│ │ │ │ +
1324 if(remoteEntries==0)
│ │ │ │ +
1325 return;
│ │ │ │ +
1326
│ │ │ │ +
1327 PairType index;
│ │ │ │ +
1328 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ +
1329 type, comm_);
│ │ │ │ +
1330 GlobalIndex oldGlobal=index.global();
│ │ │ │ +
1331 int n_in=0, localIndex=0;
│ │ │ │ +
1332
│ │ │ │ +
1333 //Check if we know the global index
│ │ │ │ +
1334 while(localIndex<localEntries) {
│ │ │ │ +
1335 if(local[localIndex]->global()==index.global()) {
│ │ │ │ +
1336 int oldLocalIndex=localIndex;
│ │ │ │
1337
│ │ │ │ -
1338 template<class V1, class V2, class Op>
│ │ │ │ -
1339 void checkBinaryOpPV(MetaType<V1> v1, MetaType<V2> v2, Op op)
│ │ │ │ -
1340 {
│ │ │ │ -
1341 checkBinaryOpVP(v2, v1, OpInfixSwappedArgs<Op>{op});
│ │ │ │ -
1342 }
│ │ │ │ -
1343
│ │ │ │ -
1344 template<class V1, class V2>
│ │ │ │ -
1345 void checkBinaryOpPV(MetaType<V1>, MetaType<V2>, OpInfixComma)
│ │ │ │ -
1346 {
│ │ │ │ -
1347 // Don't really know how to check comma operator for proxies
│ │ │ │ -
1348 }
│ │ │ │ -
1349
│ │ │ │ -
1351 //
│ │ │ │ -
1352 // cross-check scalar-vector binary operations against vector-vector
│ │ │ │ -
1353 //
│ │ │ │ -
1354
│ │ │ │ -
1355 // We check the following candidate operation
│ │ │ │ -
1356 //
│ │ │ │ -
1357 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2)
│ │ │ │ -
1358 //
│ │ │ │ -
1359 // against the reference operation
│ │ │ │ -
1360 //
│ │ │ │ -
1361 // vrefres = vref1 @ sref2
│ │ │ │ -
1362 //
│ │ │ │ -
1363 // v... variables are simd-vectors, a... variables are arrays, and
│ │ │ │ -
1364 // s... variables are scalars.
│ │ │ │ -
1365 //
│ │ │ │ -
1366 // We could check the following properties
│ │ │ │ -
1367 // 1. lanes(vopres) == lanes(vop1)
│ │ │ │ -
1368 // 2. lane(l, vopres) == lane(l, vrefres) foreach l
│ │ │ │ -
1369 // 3. lane(l, vop1) == lane(l, vref1) foreach l
│ │ │ │ -
1370 // but these are given by checking the operation against the scalar
│ │ │ │ -
1371 // operation in the vector@vector and vector@scalar cases above.
│ │ │ │ -
1372 //
│ │ │ │ -
1373 // The only thing left to check is:
│ │ │ │ -
1374 // 4. lane(l, vop2) foreach l is never modified
│ │ │ │ -
1375
│ │ │ │ -
1376 template<class T1, class V2, class Op>
│ │ │ │ -
1377 void checkBinaryOpVVAgainstSV(MetaType<T1> t1, MetaType<V2> v2, Op op)
│ │ │ │ -
1378 {
│ │ │ │ -
1379 checkBinaryOpVVAgainstVS(v2, t1, OpInfixSwappedArgs<Op>{op});
│ │ │ │ -
1380 }
│ │ │ │ -
1381
│ │ │ │ -
1382 template<class V1, class T2>
│ │ │ │ -
1383 void checkBinaryOpVVAgainstSV(MetaType<V1>, MetaType<T2>, OpInfixComma)
│ │ │ │ -
1384 { }
│ │ │ │ +
1338 while(localIndex<localEntries &&
│ │ │ │ +
1339 local[localIndex]->global()==index.global()) {
│ │ │ │ +
1340 if(!fromOurSelf || index.local().attribute() !=
│ │ │ │ +
1341 local[localIndex]->local().attribute())
│ │ │ │ +
1342 // if index is from us it has to have a different attribute
│ │ │ │ +
1343 remote.push_back(RemoteIndex(index.local().attribute(),
│ │ │ │ +
1344 local[localIndex]));
│ │ │ │ +
1345 localIndex++;
│ │ │ │ +
1346 }
│ │ │ │ +
1347
│ │ │ │ +
1348 // unpack next remote index
│ │ │ │ +
1349 if((++n_in) < remoteEntries) {
│ │ │ │ +
1350 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ +
1351 type, comm_);
│ │ │ │ +
1352 if(index.global()==oldGlobal)
│ │ │ │ +
1353 // Restart comparison for the same global indices
│ │ │ │ +
1354 localIndex=oldLocalIndex;
│ │ │ │ +
1355 else
│ │ │ │ +
1356 oldGlobal=index.global();
│ │ │ │ +
1357 }else{
│ │ │ │ +
1358 // No more received indices
│ │ │ │ +
1359 break;
│ │ │ │ +
1360 }
│ │ │ │ +
1361 continue;
│ │ │ │ +
1362 }
│ │ │ │ +
1363
│ │ │ │ +
1364 if (local[localIndex]->global()<index.global()) {
│ │ │ │ +
1365 // compare with next entry in our list
│ │ │ │ +
1366 ++localIndex;
│ │ │ │ +
1367 }else{
│ │ │ │ +
1368 // We do not know the index, unpack next
│ │ │ │ +
1369 if((++n_in) < remoteEntries) {
│ │ │ │ +
1370 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ +
1371 type, comm_);
│ │ │ │ +
1372 oldGlobal=index.global();
│ │ │ │ +
1373 }else
│ │ │ │ +
1374 // No more received indices
│ │ │ │ +
1375 break;
│ │ │ │ +
1376 }
│ │ │ │ +
1377 }
│ │ │ │ +
1378
│ │ │ │ +
1379 // Unpack the other received indices without doing anything
│ │ │ │ +
1380 while(++n_in < remoteEntries)
│ │ │ │ +
1381 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ +
1382 type, comm_);
│ │ │ │ +
1383 }
│ │ │ │ +
1384
│ │ │ │
1385
│ │ │ │ -
1387 //
│ │ │ │ -
1388 // Invoke the checks for all combinations
│ │ │ │ -
1389 //
│ │ │ │ -
1390
│ │ │ │ -
1391 template<class T1, class T2, bool condition, class Checker>
│ │ │ │ -
1392 void checkBinaryRefQual(Checker checker)
│ │ │ │ -
1393 {
│ │ │ │ -
1394 if constexpr (condition) {
│ │ │ │ -
1395 Hybrid::forEach(TypeList<T1&, const T1&, T1&&>{}, [=] (auto t1) {
│ │ │ │ -
1396 Hybrid::forEach(TypeList<T2&, const T2&, T2&&>{}, [=] (auto t2) {
│ │ │ │ -
1397 checker(t1, t2);
│ │ │ │ -
1398 });
│ │ │ │ -
1399 });
│ │ │ │ -
1400 }
│ │ │ │ -
1401 }
│ │ │ │ -
1402
│ │ │ │ -
1403 template<class V, class Checker>
│ │ │ │ -
1404 void checkBinaryOps(Checker checker)
│ │ │ │ -
1405 {
│ │ │ │ -
1406 using Std::bool_constant;
│ │ │ │ -
1407
│ │ │ │ -
1408 constexpr bool isMask = std::is_same<Scalar<V>, bool>::value;
│ │ │ │ -
1409
│ │ │ │ -
1410 constexpr bool do_ = false;
│ │ │ │ -
1411 constexpr bool do_SV = true;
│ │ │ │ -
1412 constexpr bool do_VV = true;
│ │ │ │ -
1413 constexpr bool do_VS = true;
│ │ │ │ -
1414
│ │ │ │ -
1415#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME) \
│ │ │ │ -
1416 checker(bool_constant<isMask ? do_##M1 : do_##V1>{}, \
│ │ │ │ -
1417 bool_constant<isMask ? do_##M2 : do_##V2>{}, \
│ │ │ │ -
1418 bool_constant<isMask ? do_##M3 : do_##V3>{}, \
│ │ │ │ -
1419 Op##NAME{})
│ │ │ │ +
1386 template<typename T, typename A>
│ │ │ │ +
1387 inline void RemoteIndices<T,A>::unpackIndices(RemoteIndexList& send,
│ │ │ │ +
1388 RemoteIndexList& receive,
│ │ │ │ +
1389 int remoteEntries,
│ │ │ │ +
1390 PairType** localSource,
│ │ │ │ +
1391 int localSourceEntries,
│ │ │ │ +
1392 PairType** localDest,
│ │ │ │ +
1393 int localDestEntries,
│ │ │ │ +
1394 char* p_in,
│ │ │ │ +
1395 MPI_Datatype type,
│ │ │ │ +
1396 int* position,
│ │ │ │ +
1397 int bufferSize)
│ │ │ │ +
1398 {
│ │ │ │ +
1399 int n_in=0, sourceIndex=0, destIndex=0;
│ │ │ │ +
1400
│ │ │ │ +
1401 //Check if we know the global index
│ │ │ │ +
1402 while(n_in<remoteEntries && (sourceIndex<localSourceEntries || destIndex<localDestEntries)) {
│ │ │ │ +
1403 // Unpack next index
│ │ │ │ +
1404 PairType index;
│ │ │ │ +
1405 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ +
1406 type, comm_);
│ │ │ │ +
1407 n_in++;
│ │ │ │ +
1408
│ │ │ │ +
1409 // Advance until global index in localSource and localDest are >= than the one in the unpacked index
│ │ │ │ +
1410 while(sourceIndex<localSourceEntries && localSource[sourceIndex]->global()<index.global())
│ │ │ │ +
1411 sourceIndex++;
│ │ │ │ +
1412
│ │ │ │ +
1413 while(destIndex<localDestEntries && localDest[destIndex]->global()<index.global())
│ │ │ │ +
1414 destIndex++;
│ │ │ │ +
1415
│ │ │ │ +
1416 // Add a remote index if we found the global index.
│ │ │ │ +
1417 if(sourceIndex<localSourceEntries && localSource[sourceIndex]->global()==index.global())
│ │ │ │ +
1418 send.push_back(RemoteIndex(index.local().attribute(),
│ │ │ │ +
1419 localSource[sourceIndex]));
│ │ │ │
1420
│ │ │ │ -
1421 // (Mask , Vector , Name );
│ │ │ │ -
1422
│ │ │ │ -
1423 DUNE_SIMD_DO( , , , SV, VV, VS, InfixMul );
│ │ │ │ -
1424 DUNE_SIMD_DO( , , , SV, VV, VS, InfixDiv );
│ │ │ │ -
1425 DUNE_SIMD_DO( , , , SV, VV, VS, InfixRemainder );
│ │ │ │ -
1426
│ │ │ │ -
1427 DUNE_SIMD_DO( , , , SV, VV, VS, InfixPlus );
│ │ │ │ -
1428 DUNE_SIMD_DO( , , , SV, VV, VS, InfixMinus );
│ │ │ │ -
1429
│ │ │ │ -
1430 DUNE_SIMD_DO( , , , , VV, VS, InfixLeftShift );
│ │ │ │ -
1431 DUNE_SIMD_DO( , , , , VV, VS, InfixRightShift );
│ │ │ │ -
1432
│ │ │ │ -
1433 DUNE_SIMD_DO( , , , SV, VV, VS, InfixLess );
│ │ │ │ -
1434 DUNE_SIMD_DO( , , , SV, VV, VS, InfixGreater );
│ │ │ │ -
1435 DUNE_SIMD_DO( , , , SV, VV, VS, InfixLessEqual );
│ │ │ │ -
1436 DUNE_SIMD_DO( , , , SV, VV, VS, InfixGreaterEqual );
│ │ │ │ -
1437
│ │ │ │ -
1438 DUNE_SIMD_DO( , , , SV, VV, VS, InfixEqual );
│ │ │ │ -
1439 DUNE_SIMD_DO( , , , SV, VV, VS, InfixNotEqual );
│ │ │ │ -
1440
│ │ │ │ -
1441 DUNE_SIMD_DO( , VV, , SV, VV, VS, InfixBitAnd );
│ │ │ │ -
1442 DUNE_SIMD_DO( , VV, , SV, VV, VS, InfixBitXor );
│ │ │ │ -
1443 DUNE_SIMD_DO( , VV, , SV, VV, VS, InfixBitOr );
│ │ │ │ +
1421 if(destIndex < localDestEntries && localDest[destIndex]->global() == index.global())
│ │ │ │ +
1422 receive.push_back(RemoteIndex(index.local().attribute(),
│ │ │ │ +
1423 localDest[sourceIndex]));
│ │ │ │ +
1424 }
│ │ │ │ +
1425
│ │ │ │ +
1426 }
│ │ │ │ +
1427
│ │ │ │ +
1428 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1430 {
│ │ │ │ +
1431 auto lend = remoteIndices_.end();
│ │ │ │ +
1432 for(auto lists=remoteIndices_.begin(); lists != lend; ++lists) {
│ │ │ │ +
1433 if(lists->second.first==lists->second.second) {
│ │ │ │ +
1434 // there is only one remote index list.
│ │ │ │ +
1435 delete lists->second.first;
│ │ │ │ +
1436 }else{
│ │ │ │ +
1437 delete lists->second.first;
│ │ │ │ +
1438 delete lists->second.second;
│ │ │ │ +
1439 }
│ │ │ │ +
1440 }
│ │ │ │ +
1441 remoteIndices_.clear();
│ │ │ │ +
1442 firstBuild=true;
│ │ │ │ +
1443 }
│ │ │ │ +
│ │ │ │
1444
│ │ │ │ -
1445 DUNE_SIMD_DO(SV, VV, VS, SV, VV, VS, InfixLogicAnd );
│ │ │ │ -
1446 DUNE_SIMD_DO(SV, VV, VS, SV, VV, VS, InfixLogicOr );
│ │ │ │ -
1447
│ │ │ │ -
1448 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssign );
│ │ │ │ -
1449 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignMul );
│ │ │ │ -
1450 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignDiv );
│ │ │ │ -
1451 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignRemainder );
│ │ │ │ -
1452 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignPlus );
│ │ │ │ -
1453 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignMinus );
│ │ │ │ -
1454 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignLeftShift );
│ │ │ │ -
1455 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignRightShift);
│ │ │ │ -
1456 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssignAnd );
│ │ │ │ -
1457 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssignXor );
│ │ │ │ -
1458 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssignOr );
│ │ │ │ -
1459
│ │ │ │ -
1460 DUNE_SIMD_DO(SV, VV, VS, SV, , VS, InfixComma );
│ │ │ │ -
1461
│ │ │ │ -
1462#undef DUNE_SIMD_DO
│ │ │ │ -
1463 }
│ │ │ │ -
1464
│ │ │ │ -
1466 //
│ │ │ │ -
1467 // SIMD interface functions
│ │ │ │ -
1468 //
│ │ │ │ +
1445 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1447 {
│ │ │ │ +
1448 return remoteIndices_.size();
│ │ │ │ +
1449 }
│ │ │ │ +
│ │ │ │ +
1450
│ │ │ │ +
1451 template<typename T, typename A>
│ │ │ │ +
1452 template<bool ignorePublic>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1454 {
│ │ │ │ +
1455 // Test whether a rebuild is Needed.
│ │ │ │ +
1456 if(firstBuild ||
│ │ │ │ +
1457 ignorePublic!=publicIgnored || !
│ │ │ │ +
1458 isSynced()) {
│ │ │ │ +
1459 free();
│ │ │ │ +
1460
│ │ │ │ +
1461 buildRemote<ignorePublic>(includeSelf);
│ │ │ │ +
1462
│ │ │ │ +
1463 sourceSeqNo_ = source_->seqNo();
│ │ │ │ +
1464 destSeqNo_ = target_->seqNo();
│ │ │ │ +
1465 firstBuild=false;
│ │ │ │ +
1466 publicIgnored=ignorePublic;
│ │ │ │ +
1467 }
│ │ │ │ +
1468
│ │ │ │
1469
│ │ │ │ -
1470 template<class V>
│ │ │ │ -
1471 void checkAutoCopy()
│ │ │ │ -
1472 {
│ │ │ │ -
1473 using RValueResult = decltype(autoCopy(lane(0, std::declval<V>())));
│ │ │ │ -
1474 static_assert(std::is_same<RValueResult, Scalar<V> >::value,
│ │ │ │ -
1475 "Result of autoCopy() must always be Scalar<V>");
│ │ │ │ -
1476
│ │ │ │ -
1477 using MutableLValueResult =
│ │ │ │ -
1478 decltype(autoCopy(lane(0, std::declval<V&>())));
│ │ │ │ -
1479 static_assert(std::is_same<MutableLValueResult, Scalar<V> >::value,
│ │ │ │ -
1480 "Result of autoCopy() must always be Scalar<V>");
│ │ │ │ -
1481
│ │ │ │ -
1482 using ConstLValueResult =
│ │ │ │ -
1483 decltype(autoCopy(lane(0, std::declval<const V&>())));
│ │ │ │ -
1484 static_assert(std::is_same<ConstLValueResult, Scalar<V> >::value,
│ │ │ │ -
1485 "Result of autoCopy() must always be Scalar<V>");
│ │ │ │ -
1486
│ │ │ │ -
1487 V vec = make123<V>();
│ │ │ │ -
1488 for(std::size_t l = 0; l < lanes(vec); ++l)
│ │ │ │ -
1489 DUNE_SIMD_CHECK(autoCopy(lane(l, vec)) == Scalar<V>(l+1));
│ │ │ │ -
1490 }
│ │ │ │ -
1491
│ │ │ │ -
1492 // may only be called for mask types
│ │ │ │ -
1493 template<class M>
│ │ │ │ -
1494 void checkBoolReductions()
│ │ │ │ -
1495 {
│ │ │ │ -
1496 M trueVec(true);
│ │ │ │ -
1497
│ │ │ │ -
1498 // mutable lvalue
│ │ │ │ -
1499 DUNE_SIMD_CHECK(allTrue (static_cast<M&>(trueVec)) == true);
│ │ │ │ -
1500 DUNE_SIMD_CHECK(anyTrue (static_cast<M&>(trueVec)) == true);
│ │ │ │ -
1501 DUNE_SIMD_CHECK(allFalse(static_cast<M&>(trueVec)) == false);
│ │ │ │ -
1502 DUNE_SIMD_CHECK(anyFalse(static_cast<M&>(trueVec)) == false);
│ │ │ │ -
1503
│ │ │ │ -
1504 // const lvalue
│ │ │ │ -
1505 DUNE_SIMD_CHECK(allTrue (static_cast<const M&>(trueVec)) == true);
│ │ │ │ -
1506 DUNE_SIMD_CHECK(anyTrue (static_cast<const M&>(trueVec)) == true);
│ │ │ │ -
1507 DUNE_SIMD_CHECK(allFalse(static_cast<const M&>(trueVec)) == false);
│ │ │ │ -
1508 DUNE_SIMD_CHECK(anyFalse(static_cast<const M&>(trueVec)) == false);
│ │ │ │ -
1509
│ │ │ │ -
1510 // rvalue
│ │ │ │ -
1511 DUNE_SIMD_CHECK(allTrue (M(true)) == true);
│ │ │ │ -
1512 DUNE_SIMD_CHECK(anyTrue (M(true)) == true);
│ │ │ │ -
1513 DUNE_SIMD_CHECK(allFalse(M(true)) == false);
│ │ │ │ -
1514 DUNE_SIMD_CHECK(anyFalse(M(true)) == false);
│ │ │ │ -
1515
│ │ │ │ -
1516 M falseVec(false);
│ │ │ │ -
1517
│ │ │ │ -
1518 // mutable lvalue
│ │ │ │ -
1519 DUNE_SIMD_CHECK(allTrue (static_cast<M&>(falseVec)) == false);
│ │ │ │ -
1520 DUNE_SIMD_CHECK(anyTrue (static_cast<M&>(falseVec)) == false);
│ │ │ │ -
1521 DUNE_SIMD_CHECK(allFalse(static_cast<M&>(falseVec)) == true);
│ │ │ │ -
1522 DUNE_SIMD_CHECK(anyFalse(static_cast<M&>(falseVec)) == true);
│ │ │ │ -
1523
│ │ │ │ -
1524 // const lvalue
│ │ │ │ -
1525 DUNE_SIMD_CHECK(allTrue (static_cast<const M&>(falseVec)) == false);
│ │ │ │ -
1526 DUNE_SIMD_CHECK(anyTrue (static_cast<const M&>(falseVec)) == false);
│ │ │ │ -
1527 DUNE_SIMD_CHECK(allFalse(static_cast<const M&>(falseVec)) == true);
│ │ │ │ -
1528 DUNE_SIMD_CHECK(anyFalse(static_cast<const M&>(falseVec)) == true);
│ │ │ │ -
1529
│ │ │ │ -
1530 // rvalue
│ │ │ │ -
1531 DUNE_SIMD_CHECK(allTrue (M(false)) == false);
│ │ │ │ -
1532 DUNE_SIMD_CHECK(anyTrue (M(false)) == false);
│ │ │ │ -
1533 DUNE_SIMD_CHECK(allFalse(M(false)) == true);
│ │ │ │ -
1534 DUNE_SIMD_CHECK(anyFalse(M(false)) == true);
│ │ │ │ -
1535
│ │ │ │ -
1536 auto mixedVec = broadcast<M>(0);
│ │ │ │ -
1537 for(std::size_t l = 0; l < lanes(mixedVec); ++l)
│ │ │ │ -
1538 lane(l, mixedVec) = (l % 2);
│ │ │ │ -
1539
│ │ │ │ -
1540 // mutable lvalue
│ │ │ │ - │ │ │ │ -
1542 (allTrue (static_cast<M&>(mixedVec)) == false);
│ │ │ │ - │ │ │ │ -
1544 (anyTrue (static_cast<M&>(mixedVec)) == (lanes<M>() > 1));
│ │ │ │ - │ │ │ │ -
1546 (allFalse(static_cast<M&>(mixedVec)) == (lanes<M>() == 1));
│ │ │ │ - │ │ │ │ -
1548 (anyFalse(static_cast<M&>(mixedVec)) == true);
│ │ │ │ -
1549
│ │ │ │ -
1550 // const lvalue
│ │ │ │ - │ │ │ │ -
1552 (allTrue (static_cast<const M&>(mixedVec)) == false);
│ │ │ │ - │ │ │ │ -
1554 (anyTrue (static_cast<const M&>(mixedVec)) == (lanes<M>() > 1));
│ │ │ │ - │ │ │ │ -
1556 (allFalse(static_cast<const M&>(mixedVec)) == (lanes<M>() == 1));
│ │ │ │ - │ │ │ │ -
1558 (anyFalse(static_cast<const M&>(mixedVec)) == true);
│ │ │ │ -
1559
│ │ │ │ -
1560 // rvalue
│ │ │ │ -
1561 DUNE_SIMD_CHECK(allTrue (M(mixedVec)) == false);
│ │ │ │ -
1562 DUNE_SIMD_CHECK(anyTrue (M(mixedVec)) == (lanes<M>() > 1));
│ │ │ │ -
1563 DUNE_SIMD_CHECK(allFalse(M(mixedVec)) == (lanes<M>() == 1));
│ │ │ │ -
1564 DUNE_SIMD_CHECK(anyFalse(M(mixedVec)) == true);
│ │ │ │ -
1565 }
│ │ │ │ +
1470 }
│ │ │ │ +
│ │ │ │ +
1471
│ │ │ │ +
1472 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1474 {
│ │ │ │ +
1475 return sourceSeqNo_==source_->seqNo() && destSeqNo_ ==target_->seqNo();
│ │ │ │ +
1476 }
│ │ │ │ +
│ │ │ │ +
1477
│ │ │ │ +
1478 template<typename T, typename A>
│ │ │ │ +
1479 template<bool mode, bool send>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1481 {
│ │ │ │ +
1482
│ │ │ │ +
1483 // The user are on their own now!
│ │ │ │ +
1484 // We assume they know what they are doing and just set the
│ │ │ │ +
1485 // remote indices to synced status.
│ │ │ │ +
1486 sourceSeqNo_ = source_->seqNo();
│ │ │ │ +
1487 destSeqNo_ = target_->seqNo();
│ │ │ │ +
1488
│ │ │ │ +
1489 typename RemoteIndexMap::iterator found = remoteIndices_.find(process);
│ │ │ │ +
1490
│ │ │ │ +
1491 if(found == remoteIndices_.end())
│ │ │ │ +
1492 {
│ │ │ │ +
1493 if(source_ != target_)
│ │ │ │ +
1494 found = remoteIndices_.insert(found, std::make_pair(process,
│ │ │ │ +
1495 std::make_pair(new RemoteIndexList(),
│ │ │ │ +
1496 new RemoteIndexList())));
│ │ │ │ +
1497 else{
│ │ │ │ +
1498 RemoteIndexList* rlist = new RemoteIndexList();
│ │ │ │ +
1499 found = remoteIndices_.insert(found,
│ │ │ │ +
1500 std::make_pair(process,
│ │ │ │ +
1501 std::make_pair(rlist, rlist)));
│ │ │ │ +
1502 }
│ │ │ │ +
1503 }
│ │ │ │ +
1504
│ │ │ │ +
1505 firstBuild = false;
│ │ │ │ +
1506
│ │ │ │ +
1507 if(send)
│ │ │ │ +
1508 return RemoteIndexListModifier<T,A,mode>(*source_, *(found->second.first));
│ │ │ │ +
1509 else
│ │ │ │ +
1510 return RemoteIndexListModifier<T,A,mode>(*target_, *(found->second.second));
│ │ │ │ +
1511 }
│ │ │ │ +
│ │ │ │ +
1512
│ │ │ │ +
1513 template<typename T, typename A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
1516 {
│ │ │ │ +
1517 return remoteIndices_.find(proc);
│ │ │ │ +
1518 }
│ │ │ │ +
│ │ │ │ +
1519
│ │ │ │ +
1520 template<typename T, typename A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
1523 {
│ │ │ │ +
1524 return remoteIndices_.begin();
│ │ │ │ +
1525 }
│ │ │ │ +
│ │ │ │ +
1526
│ │ │ │ +
1527 template<typename T, typename A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
1530 {
│ │ │ │ +
1531 return remoteIndices_.end();
│ │ │ │ +
1532 }
│ │ │ │ +
│ │ │ │ +
1533
│ │ │ │ +
1534
│ │ │ │ +
1535 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1537 {
│ │ │ │ +
1538 if(neighbours()!=ri.neighbours())
│ │ │ │ +
1539 return false;
│ │ │ │ +
1540
│ │ │ │ +
1541 const auto rend = remoteIndices_.end();
│ │ │ │ +
1542
│ │ │ │ +
1543 for(auto rindex = remoteIndices_.begin(), rindex1=ri.remoteIndices_.begin(); rindex!=rend; ++rindex, ++rindex1) {
│ │ │ │ +
1544 if(rindex->first != rindex1->first)
│ │ │ │ +
1545 return false;
│ │ │ │ +
1546 if(*(rindex->second.first) != *(rindex1->second.first))
│ │ │ │ +
1547 return false;
│ │ │ │ +
1548 if(*(rindex->second.second) != *(rindex1->second.second))
│ │ │ │ +
1549 return false;
│ │ │ │ +
1550 }
│ │ │ │ +
1551 return true;
│ │ │ │ +
1552 }
│ │ │ │ +
│ │ │ │ +
1553
│ │ │ │ +
1554 template<class T, class A, bool mode>
│ │ │ │ + │ │ │ │ +
1556 RemoteIndexList& rList)
│ │ │ │ +
1557 : rList_(&rList), indexSet_(&indexSet), iter_(rList.beginModify()), end_(rList.end()), first_(true)
│ │ │ │ +
1558 {
│ │ │ │ +
1559 if(MODIFYINDEXSET) {
│ │ │ │ +
1560 assert(indexSet_);
│ │ │ │ +
1561 for(ConstIterator iter=iter_; iter != end_; ++iter)
│ │ │ │ +
1562 glist_.push_back(iter->localIndexPair().global());
│ │ │ │ +
1563 giter_ = glist_.beginModify();
│ │ │ │ +
1564 }
│ │ │ │ +
1565 }
│ │ │ │
1566
│ │ │ │ -
1567 template<class V>
│ │ │ │ -
1568 void checkCond()
│ │ │ │ -
1569 {
│ │ │ │ -
1570 using M = Mask<V>;
│ │ │ │ -
1571
│ │ │ │ -
1572 static_assert
│ │ │ │ -
1573 (std::is_same<decltype(cond(std::declval<M>(), std::declval<V>(),
│ │ │ │ -
1574 std::declval<V>())), V>::value,
│ │ │ │ -
1575 "The result of cond(M, V, V) should have exactly the type V");
│ │ │ │ -
1576
│ │ │ │ -
1577 static_assert
│ │ │ │ -
1578 (std::is_same<decltype(cond(std::declval<const M&>(),
│ │ │ │ -
1579 std::declval<const V&>(),
│ │ │ │ -
1580 std::declval<const V&>())), V>::value,
│ │ │ │ -
1581 "The result of cond(const M&, const V&, const V&) should have "
│ │ │ │ -
1582 "exactly the type V");
│ │ │ │ -
1583
│ │ │ │ -
1584 static_assert
│ │ │ │ -
1585 (std::is_same<decltype(cond(std::declval<M&>(), std::declval<V&>(),
│ │ │ │ -
1586 std::declval<V&>())), V>::value,
│ │ │ │ -
1587 "The result of cond(M&, V&, V&) should have exactly the type V");
│ │ │ │ -
1588
│ │ │ │ -
1589 V vec1 = leftVector<V>();
│ │ │ │ -
1590 V vec2 = rightVector<V>();
│ │ │ │ -
1591
│ │ │ │ -
1592 DUNE_SIMD_CHECK(allTrue(cond(M(true), vec1, vec2) == vec1));
│ │ │ │ -
1593 DUNE_SIMD_CHECK(allTrue(cond(M(false), vec1, vec2) == vec2));
│ │ │ │ +
1567 template<typename T, typename A, bool mode>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1569 : rList_(other.rList_), indexSet_(other.indexSet_),
│ │ │ │ +
1570 glist_(other.glist_), iter_(other.iter_), giter_(other.giter_), end_(other.end_),
│ │ │ │ +
1571 first_(other.first_), last_(other.last_)
│ │ │ │ +
1572 {}
│ │ │ │ +
│ │ │ │ +
1573
│ │ │ │ +
1574 template<typename T, typename A, bool mode>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1576 {
│ │ │ │ +
1577 if(MODIFYINDEXSET) {
│ │ │ │ +
1578 // repair pointers to local index set.
│ │ │ │ +
1579#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1580 if(indexSet_->state()!=GROUND)
│ │ │ │ +
1581 DUNE_THROW(InvalidIndexSetState, "Index has to be in ground mode for repairing pointers to indices");
│ │ │ │ +
1582#endif
│ │ │ │ +
1583 auto giter = glist_.begin();
│ │ │ │ +
1584 auto index = indexSet_->begin();
│ │ │ │ +
1585
│ │ │ │ +
1586 for(auto iter=rList_->begin(); iter != end_; ++iter) {
│ │ │ │ +
1587 while(index->global()<*giter) {
│ │ │ │ +
1588 ++index;
│ │ │ │ +
1589#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1590 if(index == indexSet_->end())
│ │ │ │ +
1591 DUNE_THROW(InvalidPosition, "No such global index in set!");
│ │ │ │ +
1592#endif
│ │ │ │ +
1593 }
│ │ │ │
1594
│ │ │ │ -
1595 auto mixedResult = broadcast<V>(0);
│ │ │ │ -
1596 auto mixedMask = broadcast<M>(false);
│ │ │ │ -
1597 for(std::size_t l = 0; l < lanes(mixedMask); ++l)
│ │ │ │ -
1598 {
│ │ │ │ -
1599 lane(l, mixedMask ) = (l % 2);
│ │ │ │ -
1600 lane(l, mixedResult) = lane(l, (l % 2) ? vec1 : vec2);
│ │ │ │ -
1601 }
│ │ │ │ -
1602
│ │ │ │ -
1603 DUNE_SIMD_CHECK(allTrue(cond(mixedMask, vec1, vec2) == mixedResult));
│ │ │ │ -
1604 }
│ │ │ │ -
1605
│ │ │ │ -
1606 template<class V>
│ │ │ │ -
1607 void checkBoolCond()
│ │ │ │ -
1608 {
│ │ │ │ -
1609 static_assert
│ │ │ │ -
1610 (std::is_same<decltype(cond(std::declval<bool>(), std::declval<V>(),
│ │ │ │ -
1611 std::declval<V>())), V>::value,
│ │ │ │ -
1612 "The result of cond(bool, V, V) should have exactly the type V");
│ │ │ │ -
1613
│ │ │ │ -
1614 static_assert
│ │ │ │ -
1615 (std::is_same<decltype(cond(std::declval<const bool&>(),
│ │ │ │ -
1616 std::declval<const V&>(),
│ │ │ │ -
1617 std::declval<const V&>())), V>::value,
│ │ │ │ -
1618 "The result of cond(const bool&, const V&, const V&) should have "
│ │ │ │ -
1619 "exactly the type V");
│ │ │ │ -
1620
│ │ │ │ -
1621 static_assert
│ │ │ │ -
1622 (std::is_same<decltype(cond(std::declval<bool&>(),
│ │ │ │ -
1623 std::declval<V&>(),
│ │ │ │ -
1624 std::declval<V&>())), V>::value,
│ │ │ │ -
1625 "The result of cond(bool&, V&, V&) should have exactly the type V");
│ │ │ │ +
1595#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1596 if(index->global() != *giter)
│ │ │ │ +
1597 DUNE_THROW(InvalidPosition, "No such global index in set!");
│ │ │ │ +
1598#endif
│ │ │ │ +
1599 iter->localIndex_ = &(*index);
│ │ │ │ +
1600 }
│ │ │ │ +
1601 }
│ │ │ │ +
1602 }
│ │ │ │ +
│ │ │ │ +
1603
│ │ │ │ +
1604 template<typename T, typename A, bool mode>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1606 {
│ │ │ │ +
1607 static_assert(!mode,"Not allowed if the mode indicates that new indices"
│ │ │ │ +
1608 "might be added to the underlying index set. Use "
│ │ │ │ +
1609 "insert(const RemoteIndex&, const GlobalIndex&) instead");
│ │ │ │ +
1610
│ │ │ │ +
1611#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1612 if(!first_ && index.localIndexPair().global()<last_)
│ │ │ │ +
1613 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
│ │ │ │ +
1614#endif
│ │ │ │ +
1615 // Move to the correct position
│ │ │ │ +
1616 while(iter_ != end_ && iter_->localIndexPair().global() < index.localIndexPair().global()) {
│ │ │ │ +
1617 ++iter_;
│ │ │ │ +
1618 }
│ │ │ │ +
1619
│ │ │ │ +
1620 // No duplicate entries allowed
│ │ │ │ +
1621 assert(iter_==end_ || iter_->localIndexPair().global() != index.localIndexPair().global());
│ │ │ │ +
1622 iter_.insert(index);
│ │ │ │ +
1623 last_ = index.localIndexPair().global();
│ │ │ │ +
1624 first_ = false;
│ │ │ │ +
1625 }
│ │ │ │ +
│ │ │ │
1626
│ │ │ │ -
1627 V vec1 = leftVector<V>();
│ │ │ │ -
1628 V vec2 = rightVector<V>();
│ │ │ │ -
1629
│ │ │ │ -
1630 DUNE_SIMD_CHECK(allTrue(cond(true, vec1, vec2) == vec1));
│ │ │ │ -
1631 DUNE_SIMD_CHECK(allTrue(cond(false, vec1, vec2) == vec2));
│ │ │ │ -
1632 }
│ │ │ │ -
1633
│ │ │ │ -
1634 template<class V>
│ │ │ │ -
1635 std::enable_if_t<!Impl::LessThenComparable<Scalar<V> >::value>
│ │ │ │ -
1636 checkHorizontalMinMax() {}
│ │ │ │ -
1637
│ │ │ │ -
1638 template<class V>
│ │ │ │ -
1639 std::enable_if_t<Impl::LessThenComparable<Scalar<V> >::value>
│ │ │ │ -
1640 checkHorizontalMinMax()
│ │ │ │ -
1641 {
│ │ │ │ -
1642 static_assert
│ │ │ │ -
1643 (std::is_same<decltype(max(std::declval<V>())), Scalar<V> >::value,
│ │ │ │ -
1644 "The result of max(V) should be exactly Scalar<V>");
│ │ │ │ -
1645
│ │ │ │ -
1646 static_assert
│ │ │ │ -
1647 (std::is_same<decltype(min(std::declval<V>())), Scalar<V> >::value,
│ │ │ │ -
1648 "The result of min(V) should be exactly Scalar<V>");
│ │ │ │ -
1649
│ │ │ │ -
1650 static_assert
│ │ │ │ -
1651 (std::is_same<decltype(max(std::declval<V&>())), Scalar<V> >::value,
│ │ │ │ -
1652 "The result of max(V) should be exactly Scalar<V>");
│ │ │ │ -
1653
│ │ │ │ -
1654 static_assert
│ │ │ │ -
1655 (std::is_same<decltype(min(std::declval<V&>())), Scalar<V> >::value,
│ │ │ │ -
1656 "The result of min(V) should be exactly Scalar<V>");
│ │ │ │ -
1657
│ │ │ │ -
1658 const V vec1 = leftVector<V>();
│ │ │ │ +
1627 template<typename T, typename A, bool mode>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1629 {
│ │ │ │ +
1630 static_assert(mode,"Not allowed if the mode indicates that no new indices"
│ │ │ │ +
1631 "might be added to the underlying index set. Use "
│ │ │ │ +
1632 "insert(const RemoteIndex&) instead");
│ │ │ │ +
1633#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1634 if(!first_ && global<last_)
│ │ │ │ +
1635 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
│ │ │ │ +
1636#endif
│ │ │ │ +
1637 // Move to the correct position
│ │ │ │ +
1638 while(iter_ != end_ && *giter_ < global) {
│ │ │ │ +
1639 ++giter_;
│ │ │ │ +
1640 ++iter_;
│ │ │ │ +
1641 }
│ │ │ │ +
1642
│ │ │ │ +
1643 // No duplicate entries allowed
│ │ │ │ +
1644 assert(iter_->localIndexPair().global() != global);
│ │ │ │ +
1645 iter_.insert(index);
│ │ │ │ +
1646 giter_.insert(global);
│ │ │ │ +
1647
│ │ │ │ +
1648 last_ = global;
│ │ │ │ +
1649 first_ = false;
│ │ │ │ +
1650 }
│ │ │ │ +
│ │ │ │ +
1651
│ │ │ │ +
1652 template<typename T, typename A, bool mode>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1654 {
│ │ │ │ +
1655#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1656 if(!first_ && global<last_)
│ │ │ │ +
1657 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
│ │ │ │ +
1658#endif
│ │ │ │
1659
│ │ │ │ -
1660 DUNE_SIMD_CHECK(max(vec1) == Scalar<V>(lanes(vec1)));
│ │ │ │ -
1661 DUNE_SIMD_CHECK(min(vec1) == Scalar<V>(1));
│ │ │ │ -
1662 }
│ │ │ │ -
1663
│ │ │ │ -
1664 template<class V>
│ │ │ │ -
1665 std::enable_if_t<!Impl::LessThenComparable<Scalar<V> >::value>
│ │ │ │ -
1666 checkBinaryMinMax() {}
│ │ │ │ -
1667
│ │ │ │ -
1668 template<class V>
│ │ │ │ -
1669 std::enable_if_t<Impl::LessThenComparable<Scalar<V> >::value>
│ │ │ │ -
1670 checkBinaryMinMax()
│ │ │ │ -
1671 {
│ │ │ │ -
1672 using std::max;
│ │ │ │ -
1673 using std::min;
│ │ │ │ -
1674
│ │ │ │ -
1675 static_assert
│ │ │ │ -
1676 (std::is_same<decltype(Simd::max(std::declval<V>(),
│ │ │ │ -
1677 std::declval<V>())), V>::value,
│ │ │ │ -
1678 "The result of Simd::max(V, V) should be exactly V");
│ │ │ │ -
1679 static_assert
│ │ │ │ -
1680 (std::is_same<decltype(Simd::min(std::declval<V>(),
│ │ │ │ -
1681 std::declval<V>())), V>::value,
│ │ │ │ -
1682 "The result of Simd::min(V, V) should be exactly V");
│ │ │ │ -
1683
│ │ │ │ -
1684 static_assert
│ │ │ │ -
1685 (std::is_same<decltype(Simd::max(std::declval<V&>(),
│ │ │ │ -
1686 std::declval<V&>())), V>::value,
│ │ │ │ -
1687 "The result of Simd::max(V&, V&) should be exactly V");
│ │ │ │ -
1688 static_assert
│ │ │ │ -
1689 (std::is_same<decltype(Simd::min(std::declval<V&>(),
│ │ │ │ -
1690 std::declval<V&>())), V>::value,
│ │ │ │ -
1691 "The result of Simd::min(V&, V&) should be exactly V");
│ │ │ │ -
1692
│ │ │ │ -
1693 const V arg1 = leftVector<V>();
│ │ │ │ -
1694 const V arg2 = rightVector<V>();
│ │ │ │ -
1695
│ │ │ │ -
1696 V maxExp(Scalar<V>(0)), minExp(Scalar<V>(0));
│ │ │ │ -
1697 for(auto l : range(lanes<V>()))
│ │ │ │ -
1698 {
│ │ │ │ -
1699 lane(l, maxExp) = max(lane(l, arg1), lane(l, arg2));
│ │ │ │ -
1700 lane(l, minExp) = min(lane(l, arg1), lane(l, arg2));
│ │ │ │ -
1701 }
│ │ │ │ -
1702
│ │ │ │ -
1703 DUNE_SIMD_CHECK(allTrue(maxExp == Simd::max(arg1, arg2)));
│ │ │ │ -
1704 DUNE_SIMD_CHECK(allTrue(minExp == Simd::min(arg1, arg2)));
│ │ │ │ -
1705 }
│ │ │ │ -
1706
│ │ │ │ -
1707 template<class V>
│ │ │ │ -
1708 void checkIO()
│ │ │ │ -
1709 {
│ │ │ │ -
1710 const V vec1 = leftVector<V>();
│ │ │ │ -
1711
│ │ │ │ -
1712 std::string reference;
│ │ │ │ -
1713 {
│ │ │ │ -
1714 const char *sep = "";
│ │ │ │ -
1715 for(auto l : range(lanes(vec1)))
│ │ │ │ -
1716 {
│ │ │ │ -
1717 std::ostringstream stream;
│ │ │ │ -
1718 stream << lane(l, vec1);
│ │ │ │ +
1660 bool found= false;
│ │ │ │ +
1661
│ │ │ │ +
1662 if(MODIFYINDEXSET) {
│ │ │ │ +
1663 // Move to the correct position
│ │ │ │ +
1664 while(iter_!=end_ && *giter_< global) {
│ │ │ │ +
1665 ++giter_;
│ │ │ │ +
1666 ++iter_;
│ │ │ │ +
1667 }
│ │ │ │ +
1668 if(*giter_ == global) {
│ │ │ │ +
1669 giter_.remove();
│ │ │ │ +
1670 iter_.remove();
│ │ │ │ +
1671 found=true;
│ │ │ │ +
1672 }
│ │ │ │ +
1673 }else{
│ │ │ │ +
1674 while(iter_!=end_ && iter_->localIndexPair().global() < global)
│ │ │ │ +
1675 ++iter_;
│ │ │ │ +
1676
│ │ │ │ +
1677 if(iter_->localIndexPair().global()==global) {
│ │ │ │ +
1678 iter_.remove();
│ │ │ │ +
1679 found = true;
│ │ │ │ +
1680 }
│ │ │ │ +
1681 }
│ │ │ │ +
1682
│ │ │ │ +
1683 last_ = global;
│ │ │ │ +
1684 first_ = false;
│ │ │ │ +
1685 return found;
│ │ │ │ +
1686 }
│ │ │ │ +
│ │ │ │ +
1687
│ │ │ │ +
1688 template<typename T, typename A>
│ │ │ │ +
1689 template<bool send>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1691 {
│ │ │ │ +
1692 return CollectiveIterator<T,A>(remoteIndices_, send);
│ │ │ │ +
1693 }
│ │ │ │ +
│ │ │ │ +
1694
│ │ │ │ +
1695 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1696 inline MPI_Comm RemoteIndices<T,A>::communicator() const
│ │ │ │ +
1697 {
│ │ │ │ +
1698 return comm_;
│ │ │ │ +
1699
│ │ │ │ +
1700 }
│ │ │ │ +
│ │ │ │ +
1701
│ │ │ │ +
1702 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1704 {
│ │ │ │ +
1705
│ │ │ │ +
1706 const auto end = pmap.end();
│ │ │ │ +
1707 for(auto process = pmap.begin(); process != end; ++process) {
│ │ │ │ +
1708 const RemoteIndexList* list = send ? process->second.first : process->second.second;
│ │ │ │ +
1709 using ri_iterator = typename RemoteIndexList::const_iterator;
│ │ │ │ +
1710 map_.insert(std::make_pair(process->first,
│ │ │ │ +
1711 std::pair<ri_iterator, const ri_iterator>(list->begin(), list->end())));
│ │ │ │ +
1712 }
│ │ │ │ +
1713 }
│ │ │ │ +
│ │ │ │ +
1714
│ │ │ │ +
1715 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1716 inline void CollectiveIterator<T,A>::advance(const GlobalIndex& index)
│ │ │ │ +
1717 {
│ │ │ │ +
1718 const auto end = map_.end();
│ │ │ │
1719
│ │ │ │ -
1720 reference += sep;
│ │ │ │ -
1721 reference += stream.str();
│ │ │ │ -
1722 sep = ", ";
│ │ │ │ -
1723 }
│ │ │ │ -
1724 }
│ │ │ │ -
1725
│ │ │ │ -
1726 {
│ │ │ │ -
1727 std::ostringstream stream;
│ │ │ │ -
1728 stream << io(vec1);
│ │ │ │ -
1729 if(lanes(vec1) == 1)
│ │ │ │ -
1730 DUNE_SIMD_CHECK(stream.str() == reference);
│ │ │ │ -
1731 else
│ │ │ │ -
1732 DUNE_SIMD_CHECK(stream.str() == "<" + reference + ">");
│ │ │ │ -
1733 }
│ │ │ │ -
1734
│ │ │ │ -
1735 {
│ │ │ │ -
1736 std::ostringstream stream;
│ │ │ │ -
1737 stream << vio(vec1);
│ │ │ │ -
1738 DUNE_SIMD_CHECK(stream.str() == "<" + reference + ">");
│ │ │ │ -
1739 }
│ │ │ │ -
1740 }
│ │ │ │ +
1720 for(auto iter = map_.begin(); iter != end;) {
│ │ │ │ +
1721 // Step the iterator until we are >= index
│ │ │ │ +
1722 typename RemoteIndexList::const_iterator current = iter->second.first;
│ │ │ │ +
1723 typename RemoteIndexList::const_iterator rend = iter->second.second;
│ │ │ │ +
1724 RemoteIndex remoteIndex;
│ │ │ │ +
1725 if(current != rend)
│ │ │ │ +
1726 remoteIndex = *current;
│ │ │ │ +
1727
│ │ │ │ +
1728 while(iter->second.first!=iter->second.second && iter->second.first->localIndexPair().global()<index)
│ │ │ │ +
1729 ++(iter->second.first);
│ │ │ │ +
1730
│ │ │ │ +
1731 // erase from the map if there are no more entries.
│ │ │ │ +
1732 if(iter->second.first == iter->second.second)
│ │ │ │ +
1733 map_.erase(iter++);
│ │ │ │ +
1734 else{
│ │ │ │ +
1735 ++iter;
│ │ │ │ +
1736 }
│ │ │ │ +
1737 }
│ │ │ │ +
1738 index_=index;
│ │ │ │ +
1739 noattribute=true;
│ │ │ │ +
1740 }
│ │ │ │ +
│ │ │ │
1741
│ │ │ │ -
1742#undef DUNE_SIMD_CHECK
│ │ │ │ -
1743
│ │ │ │ -
1744 public:
│ │ │ │ -
1807 template<class V> void checkType();
│ │ │ │ -
1808 template<class V> void checkNonOps();
│ │ │ │ -
1809 template<class V> void checkUnaryOps();
│ │ │ │ -
1810 template<class V> void checkBinaryOps();
│ │ │ │ -
1811 template<class V> void checkBinaryOpsVectorVector();
│ │ │ │ -
1812 template<class V> void checkBinaryOpsScalarVector();
│ │ │ │ -
1813 template<class V> void checkBinaryOpsVectorScalar();
│ │ │ │ -
1814 template<class V> void checkBinaryOpsProxyVector();
│ │ │ │ -
1815 template<class V> void checkBinaryOpsVectorProxy();
│ │ │ │ +
1742 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1743 inline void CollectiveIterator<T,A>::advance(const GlobalIndex& index,
│ │ │ │ +
1744 const Attribute& attribute)
│ │ │ │ +
1745 {
│ │ │ │ +
1746 const auto end = map_.end();
│ │ │ │ +
1747
│ │ │ │ +
1748 for(auto iter = map_.begin(); iter != end;) {
│ │ │ │ +
1749 // Step the iterator until we are >= index
│ │ │ │ +
1750 typename RemoteIndexList::const_iterator current = iter->second.first;
│ │ │ │ +
1751 typename RemoteIndexList::const_iterator rend = iter->second.second;
│ │ │ │ +
1752 RemoteIndex remoteIndex;
│ │ │ │ +
1753 if(current != rend)
│ │ │ │ +
1754 remoteIndex = *current;
│ │ │ │ +
1755
│ │ │ │ +
1756 // Move to global index or bigger
│ │ │ │ +
1757 while(iter->second.first!=iter->second.second && iter->second.first->localIndexPair().global()<index)
│ │ │ │ +
1758 ++(iter->second.first);
│ │ │ │ +
1759
│ │ │ │ +
1760 // move to attribute or bigger
│ │ │ │ +
1761 while(iter->second.first!=iter->second.second
│ │ │ │ +
1762 && iter->second.first->localIndexPair().global()==index
│ │ │ │ +
1763 && iter->second.first->localIndexPair().local().attribute()<attribute)
│ │ │ │ +
1764 ++(iter->second.first);
│ │ │ │ +
1765
│ │ │ │ +
1766 // erase from the map if there are no more entries.
│ │ │ │ +
1767 if(iter->second.first == iter->second.second)
│ │ │ │ +
1768 map_.erase(iter++);
│ │ │ │ +
1769 else{
│ │ │ │ +
1770 ++iter;
│ │ │ │ +
1771 }
│ │ │ │ +
1772 }
│ │ │ │ +
1773 index_=index;
│ │ │ │ +
1774 attribute_=attribute;
│ │ │ │ +
1775 noattribute=false;
│ │ │ │ +
1776 }
│ │ │ │ +
│ │ │ │ +
1777
│ │ │ │ +
1778 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1780 {
│ │ │ │ +
1781 const auto end = map_.end();
│ │ │ │ +
1782
│ │ │ │ +
1783 for(auto iter = map_.begin(); iter != end;) {
│ │ │ │ +
1784 // Step the iterator until we are >= index
│ │ │ │ +
1785 auto current = iter->second.first;
│ │ │ │ +
1786 auto rend = iter->second.second;
│ │ │ │ +
1787
│ │ │ │ +
1788 // move all iterators pointing to the current global index to next value
│ │ │ │ +
1789 if(iter->second.first->localIndexPair().global()==index_ &&
│ │ │ │ +
1790 (noattribute || iter->second.first->localIndexPair().local().attribute() == attribute_))
│ │ │ │ +
1791 ++(iter->second.first);
│ │ │ │ +
1792
│ │ │ │ +
1793 // erase from the map if there are no more entries.
│ │ │ │ +
1794 if(iter->second.first == iter->second.second)
│ │ │ │ +
1795 map_.erase(iter++);
│ │ │ │ +
1796 else{
│ │ │ │ +
1797 ++iter;
│ │ │ │ +
1798 }
│ │ │ │ +
1799 }
│ │ │ │ +
1800 return *this;
│ │ │ │ +
1801 }
│ │ │ │ +
│ │ │ │ +
1802
│ │ │ │ +
1803 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1805 {
│ │ │ │ +
1806 return map_.empty();
│ │ │ │ +
1807 }
│ │ │ │ +
│ │ │ │ +
1808
│ │ │ │ +
1809 template<typename T, typename A>
│ │ │ │ +
1810 inline typename CollectiveIterator<T,A>::iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1812 {
│ │ │ │ +
1813 if(noattribute)
│ │ │ │ +
1814 return iterator(map_.begin(), map_.end(), index_);
│ │ │ │ +
1815 else
│ │ │ │ +
1816 return iterator(map_.begin(), map_.end(), index_,
│ │ │ │ +
1817 attribute_);
│ │ │ │ +
1818 }
│ │ │ │ +
│ │ │ │
1819
│ │ │ │ -
1836 template<class V, class Rebinds,
│ │ │ │ -
1837 template<class> class RebindPrune = IsLoop,
│ │ │ │ -
1838 template<class> class RebindAccept = Dune::AlwaysTrue>
│ │ │ │ -
│ │ │ │ -
1839 void check() {
│ │ │ │ -
1840 // check whether the test for this type already started
│ │ │ │ -
1841 if(seen_.emplace(typeid (V)).second == false)
│ │ │ │ -
1842 {
│ │ │ │ -
1843 // type already seen, nothing to do
│ │ │ │ -
1844 return;
│ │ │ │ -
1845 }
│ │ │ │ +
1820 template<typename T, typename A>
│ │ │ │ +
1821 inline typename CollectiveIterator<T,A>::iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1823 {
│ │ │ │ +
1824 return iterator(map_.end(), map_.end(), index_);
│ │ │ │ +
1825 }
│ │ │ │ +
│ │ │ │ +
1826
│ │ │ │ +
1827 template<typename TG, typename TA>
│ │ │ │ +
│ │ │ │ +
1828 inline std::ostream& operator<<(std::ostream& os, const RemoteIndex<TG,TA>& index)
│ │ │ │ +
1829 {
│ │ │ │ +
1830 os<<"[global="<<index.localIndexPair().global()<<", remote attribute="<<index.attribute()<<" local attribute="<<index.localIndexPair().local().attribute()<<"]";
│ │ │ │ +
1831 return os;
│ │ │ │ +
1832 }
│ │ │ │ +
│ │ │ │ +
1833
│ │ │ │ +
1834 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1835 inline std::ostream& operator<<(std::ostream& os, const RemoteIndices<T,A>& indices)
│ │ │ │ +
1836 {
│ │ │ │ +
1837 int rank;
│ │ │ │ +
1838 MPI_Comm_rank(indices.comm_, &rank);
│ │ │ │ +
1839 const auto rend = indices.remoteIndices_.end();
│ │ │ │ +
1840
│ │ │ │ +
1841 for(auto rindex = indices.remoteIndices_.begin(); rindex!=rend; ++rindex) {
│ │ │ │ +
1842 os<<rank<<": Process "<<rindex->first<<":";
│ │ │ │ +
1843
│ │ │ │ +
1844 if(!rindex->second.first->empty()) {
│ │ │ │ +
1845 os<<" send:";
│ │ │ │
1846
│ │ │ │ -
1847 // do these first so everything that appears after "Checking SIMD type
│ │ │ │ -
1848 // ..." really pertains to that type
│ │ │ │ -
1849 auto recurse = [this](auto w) {
│ │ │ │ -
1850 using W = typename decltype(w)::type;
│ │ │ │ -
1851 this->template check<W, Rebinds, RebindPrune, RebindAccept>();
│ │ │ │ -
1852 };
│ │ │ │ -
1853 checkRebindOf<V, Rebinds, RebindPrune, RebindAccept>(recurse);
│ │ │ │ -
1854
│ │ │ │ -
1855 checkType<V>();
│ │ │ │ -
1856 }
│ │ │ │ -
│ │ │ │ -
1857
│ │ │ │ -
│ │ │ │ -
1859 bool good() const
│ │ │ │ -
1860 {
│ │ │ │ -
1861 return good_;
│ │ │ │ -
1862 }
│ │ │ │ -
│ │ │ │ -
1863
│ │ │ │ -
1864 }; // class UnitTest
│ │ │ │ -
│ │ │ │ -
1865
│ │ │ │ -
│ │ │ │ -
1866 template<class V> void UnitTest::checkType()
│ │ │ │ -
1867 {
│ │ │ │ -
1868 static_assert(std::is_same<V, std::decay_t<V> >::value, "Simd types "
│ │ │ │ -
1869 "must not be references, and must not include "
│ │ │ │ -
1870 "cv-qualifiers");
│ │ │ │ -
1871
│ │ │ │ -
1872 log_ << "Checking SIMD type " << className<V>() << std::endl;
│ │ │ │ -
1873
│ │ │ │ -
1874 checkNonOps<V>();
│ │ │ │ -
1875 checkUnaryOps<V>();
│ │ │ │ -
1876 checkBinaryOps<V>();
│ │ │ │ -
1877 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
1878 template<class V> void UnitTest::checkNonOps()
│ │ │ │ -
1879 {
│ │ │ │ -
1880 constexpr auto isMask = typename std::is_same<Scalar<V>, bool>::type{};
│ │ │ │ -
1881
│ │ │ │ -
1882 checkLanes<V>();
│ │ │ │ -
1883 checkScalar<V>();
│ │ │ │ -
1884
│ │ │ │ -
1885 checkDefaultConstruct<V>();
│ │ │ │ -
1886 checkLane<V>();
│ │ │ │ -
1887 checkCopyMoveConstruct<V>();
│ │ │ │ -
1888 checkImplCast<V>();
│ │ │ │ -
1889 checkBroadcast<V>();
│ │ │ │ -
1890 if constexpr (isMask)
│ │ │ │ -
1891 this->template checkBroadcastMaskConstruct<V>();
│ │ │ │ -
1892 else
│ │ │ │ -
1893 this->template checkBroadcastVectorConstruct<V>();
│ │ │ │ -
1894 checkBracedAssign<V>();
│ │ │ │ -
1895 checkBracedBroadcastAssign<V>();
│ │ │ │ -
1896
│ │ │ │ -
1897 checkAutoCopy<V>();
│ │ │ │ -
1898 checkCond<V>();
│ │ │ │ -
1899 checkBoolCond<V>();
│ │ │ │ -
1900
│ │ │ │ -
1901 if constexpr (isMask)
│ │ │ │ -
1902 this->template checkBoolReductions<V>();
│ │ │ │ -
1903 // checkBoolReductions() is not applicable for non-masks
│ │ │ │ -
1904
│ │ │ │ -
1905 checkHorizontalMinMax<V>();
│ │ │ │ -
1906 checkBinaryMinMax<V>();
│ │ │ │ -
1907 checkIO<V>();
│ │ │ │ -
1908 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
1909 template<class V> void UnitTest::checkUnaryOps()
│ │ │ │ -
1910 {
│ │ │ │ -
1911 if constexpr (std::is_same_v<Scalar<V>, bool>) {
│ │ │ │ -
1912 // check mask
│ │ │ │ -
1913 auto check = [this](auto op) {
│ │ │ │ -
1914 this->template checkUnaryOpsV<V>(op);
│ │ │ │ -
1915 };
│ │ │ │ -
1916
│ │ │ │ -
1917 // postfix
│ │ │ │ -
1918 // check(OpPostfixDecrement{});
│ │ │ │ -
1919 // clang deprecation warning if bool++ is tested
│ │ │ │ -
1920 // check(OpPostfixIncrement{});
│ │ │ │ -
1921
│ │ │ │ -
1922 // prefix
│ │ │ │ -
1923 // check(OpPrefixDecrement{});
│ │ │ │ -
1924 // clang deprecation warning if ++bool is tested
│ │ │ │ -
1925 // check(OpPrefixIncrement{});
│ │ │ │ -
1926
│ │ │ │ -
1927 // check(OpPrefixPlus{});
│ │ │ │ -
1928 // check(OpPrefixMinus{});
│ │ │ │ -
1929 check(OpPrefixLogicNot{});
│ │ │ │ -
1930 // check(OpPrefixBitNot{});
│ │ │ │ -
1931 }
│ │ │ │ -
1932 else {
│ │ │ │ -
1933 // check vector
│ │ │ │ -
1934 auto check = [this](auto op) {
│ │ │ │ -
1935 this->template checkUnaryOpsV<V>(op);
│ │ │ │ -
1936 };
│ │ │ │ -
1937
│ │ │ │ -
1938 // postfix
│ │ │ │ -
1939 // check(OpPostfixDecrement{});
│ │ │ │ -
1940 // check(OpPostfixIncrement{});
│ │ │ │ -
1941
│ │ │ │ -
1942 // prefix
│ │ │ │ -
1943 // check(OpPrefixDecrement{});
│ │ │ │ -
1944 // check(OpPrefixIncrement{});
│ │ │ │ -
1945
│ │ │ │ -
1946 // check(OpPrefixPlus{});
│ │ │ │ -
1947 check(OpPrefixMinus{});
│ │ │ │ -
1948 check(OpPrefixLogicNot{});
│ │ │ │ -
1949 check(OpPrefixBitNot{});
│ │ │ │ -
1950 }
│ │ │ │ -
1951 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
1952 template<class V> void UnitTest::checkBinaryOps()
│ │ │ │ -
1953 {
│ │ │ │ -
1954 checkBinaryOpsVectorVector<V>();
│ │ │ │ -
1955 checkBinaryOpsScalarVector<V>();
│ │ │ │ -
1956 checkBinaryOpsVectorScalar<V>();
│ │ │ │ -
1957 checkBinaryOpsProxyVector<V>();
│ │ │ │ -
1958 checkBinaryOpsVectorProxy<V>();
│ │ │ │ -
1959 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1961 {
│ │ │ │ -
1962 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
│ │ │ │ -
1963 auto check = [this,op](auto t1, auto t2) {
│ │ │ │ -
1964 this->checkBinaryOpVV(t1, t2, op);
│ │ │ │ -
1965 };
│ │ │ │ -
1966 this->checkBinaryRefQual<V, V, doVV>(check);
│ │ │ │ -
1967 };
│ │ │ │ -
1968 checkBinaryOps<V>(checker);
│ │ │ │ -
1969 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1971 {
│ │ │ │ -
1972 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
│ │ │ │ -
1973 auto check = [this,op](auto t1, auto t2) {
│ │ │ │ -
1974 this->checkBinaryOpSV(t1, t2, op);
│ │ │ │ -
1975 };
│ │ │ │ -
1976 this->checkBinaryRefQual<Scalar<V>, V, doSV>(check);
│ │ │ │ -
1977
│ │ │ │ -
1978 auto crossCheck = [this,op](auto t1, auto t2) {
│ │ │ │ -
1979 this->checkBinaryOpVVAgainstSV(t1, t2, op);
│ │ │ │ -
1980 };
│ │ │ │ -
1981 this->checkBinaryRefQual<Scalar<V>, V, doSV && doVV>(crossCheck);
│ │ │ │ -
1982 };
│ │ │ │ -
1983 checkBinaryOps<V>(checker);
│ │ │ │ -
1984 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1986 {
│ │ │ │ -
1987 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
│ │ │ │ -
1988 auto check = [this,op](auto t1, auto t2) {
│ │ │ │ -
1989 this->checkBinaryOpVS(t1, t2, op);
│ │ │ │ -
1990 };
│ │ │ │ -
1991 this->checkBinaryRefQual<V, Scalar<V>, doVS>(check);
│ │ │ │ -
1992
│ │ │ │ -
1993 auto crossCheck = [this,op](auto t1, auto t2) {
│ │ │ │ -
1994 this->checkBinaryOpVVAgainstVS(t1, t2, op);
│ │ │ │ -
1995 };
│ │ │ │ -
1996 this->checkBinaryRefQual<V, Scalar<V>, doVV && doVS>(crossCheck);
│ │ │ │ -
1997 };
│ │ │ │ -
1998 checkBinaryOps<V>(checker);
│ │ │ │ -
1999 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2001 {
│ │ │ │ -
2002 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
│ │ │ │ -
2003 auto check = [this,op](auto t1, auto t2) {
│ │ │ │ -
2004 this->checkBinaryOpPV(t1, t2, op);
│ │ │ │ -
2005 };
│ │ │ │ -
2006 this->checkBinaryRefQual<V, V, doSV>(check);
│ │ │ │ -
2007 };
│ │ │ │ -
2008 checkBinaryOps<V>(checker);
│ │ │ │ -
2009 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2011 {
│ │ │ │ -
2012 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
│ │ │ │ -
2013 auto check = [this,op](auto t1, auto t2) {
│ │ │ │ -
2014 this->checkBinaryOpVP(t1, t2, op);
│ │ │ │ -
2015 };
│ │ │ │ -
2016 this->checkBinaryRefQual<V, V, doVS>(check);
│ │ │ │ -
2017 };
│ │ │ │ -
2018 checkBinaryOps<V>(checker);
│ │ │ │ -
2019 }
│ │ │ │ -
│ │ │ │ -
2020
│ │ │ │ -
2021 } // namespace Simd
│ │ │ │ -
2022} // namespace Dune
│ │ │ │ -
2023
│ │ │ │ -
2024#endif // DUNE_COMMON_SIMD_TEST_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ -
IO interface of the SIMD abstraction.
│ │ │ │ -
#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL)
Definition test.hh:670
│ │ │ │ -
#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL)
Definition test.hh:784
│ │ │ │ -
#define DUNE_SIMD_CHECK_OP(expr)
Definition test.hh:191
│ │ │ │ -
#define DUNE_SIMD_CHECK(expr)
Definition test.hh:186
│ │ │ │ -
#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL)
Definition test.hh:818
│ │ │ │ -
#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL)
Definition test.hh:805
│ │ │ │ -
#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL)
Definition test.hh:681
│ │ │ │ -
#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME)
│ │ │ │ - │ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Utilities for reduction like operations on ranges.
│ │ │ │ -
A free function to provide the demangled class name of a given object or type as a string.
│ │ │ │ - │ │ │ │ -
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:300
│ │ │ │ -
std::tuple< MetaType< T >... > TypeList
A simple type list.
Definition typelist.hh:87
│ │ │ │ -
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition hybridutilities.hh:268
│ │ │ │ -
constexpr AutonomousValue< T > autoCopy(T &&v)
Autonomous copy of an expression's value for use in auto type deduction.
Definition typetraits.hh:642
│ │ │ │ -
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition typetraits.hh:40
│ │ │ │ -
bool anyTrue(const Mask &mask)
Whether any entry is true
Definition simd/interface.hh:429
│ │ │ │ -
auto maskOr(const V1 &v1, const V2 &v2)
Logic or of masks.
Definition simd/interface.hh:499
│ │ │ │ -
V cond(M &&mask, const V &ifTrue, const V &ifFalse)
Like the ?: operator.
Definition simd/interface.hh:386
│ │ │ │ -
auto io(const V &v)
construct a stream inserter
Definition io.hh:106
│ │ │ │ -
bool allTrue(const Mask &mask)
Whether all entries are true
Definition simd/interface.hh:439
│ │ │ │ -
auto vio(const V &v)
construct a stream inserter
Definition io.hh:90
│ │ │ │ -
auto max(const V &v1, const V &v2)
The binary maximum value over two simd objects.
Definition simd/interface.hh:409
│ │ │ │ -
bool anyFalse(const Mask &mask)
Whether any entry is false
Definition simd/interface.hh:449
│ │ │ │ -
constexpr std::size_t lanes()
Number of lanes in a SIMD type.
Definition simd/interface.hh:305
│ │ │ │ -
decltype(auto) lane(std::size_t l, V &&v)
Extract an element of a SIMD type.
Definition simd/interface.hh:324
│ │ │ │ -
bool allFalse(const Mask &mask)
Whether all entries are false
Definition simd/interface.hh:459
│ │ │ │ -
auto maskAnd(const V1 &v1, const V2 &v2)
Logic and of masks.
Definition simd/interface.hh:509
│ │ │ │ -
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition simd/interface.hh:235
│ │ │ │ -
auto min(const V &v1, const V &v2)
The binary minimum value over two simd objects.
Definition simd/interface.hh:419
│ │ │ │ +
1847 const auto send= rindex->second.first->end();
│ │ │ │ +
1848
│ │ │ │ +
1849 for(auto index = rindex->second.first->begin();
│ │ │ │ +
1850 index != send; ++index)
│ │ │ │ +
1851 os<<*index<<" ";
│ │ │ │ +
1852 os<<std::endl;
│ │ │ │ +
1853 }
│ │ │ │ +
1854 if(!rindex->second.second->empty()) {
│ │ │ │ +
1855 os<<rank<<": Process "<<rindex->first<<": "<<"receive: ";
│ │ │ │ +
1856
│ │ │ │ +
1857 for(const auto& index : *(rindex->second.second))
│ │ │ │ +
1858 os << index << " ";
│ │ │ │ +
1859 }
│ │ │ │ +
1860 os<<std::endl<<std::flush;
│ │ │ │ +
1861 }
│ │ │ │ +
1862 return os;
│ │ │ │ +
1863 }
│ │ │ │ +
│ │ │ │ +
1865}
│ │ │ │ +
1866
│ │ │ │ +
1867#endif // HAVE_MPI
│ │ │ │ +
1868
│ │ │ │ +
1869#endif
│ │ │ │ +
Standard Dune debug streams.
│ │ │ │ +
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ +
Provides classes for use as the local index in ParallelIndexSet for distributed computing.
│ │ │ │ +
Provides a map between global and local indices.
│ │ │ │ +
Implements a singly linked list together with the necessary iterators.
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
iterator end()
Get an iterator pointing to the end of the list.
Definition sllist.hh:774
│ │ │ │ +
SLListConstIterator< RemoteIndex, Allocator > const_iterator
The constant iterator of the list.
Definition sllist.hh:74
│ │ │ │ +
SLListModifyIterator< GlobalIndex, Allocator > ModifyIterator
The type of the iterator capable of deletion and insertion.
Definition sllist.hh:103
│ │ │ │ +
iterator begin()
Get an iterator pointing to the first element in the list.
Definition sllist.hh:762
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
iterator begin()
Get an iterator over the indices positioned at the first index.
│ │ │ │ +
iterator end()
Get an iterator over the indices positioned after the last index.
│ │ │ │ +
TL LocalIndex
The type of the local index, e.g. ParallelLocalIndex.
Definition indexset.hh:239
│ │ │ │ +
const GlobalIndex & global() const
Get the global index.
│ │ │ │ +
LocalIndex & local()
Get the local index.
│ │ │ │ +
TG GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition indexset.hh:226
│ │ │ │ +
@ GROUND
The default mode. Indicates that the index set is ready to be used.
Definition indexset.hh:186
│ │ │ │ +
DVVerbType dvverb(std::cout)
stream for very verbose output.
Definition stdstreams.hh:95
│ │ │ │
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
typename Impl::RemoveEnd< EndMark, TypeList< Types... > >::type RebindList
A list of types with the final element removed.
Definition test.hh:158
│ │ │ │ -
typename Impl::IsLoop< T >::type IsLoop
check whether a type is an instance of LoopSIMD
Definition test.hh:162
│ │ │ │ -
Definition loop.hh:65
│ │ │ │ -
final element marker for RebindList
Definition test.hh:145
│ │ │ │ -
Definition test.hh:164
│ │ │ │ -
void checkUnaryOps()
Definition test.hh:1909
│ │ │ │ -
void checkBinaryOps()
Definition test.hh:1952
│ │ │ │ -
void checkBinaryOpsScalarVector()
Definition test.hh:1970
│ │ │ │ -
void checkType()
Definition test.hh:1866
│ │ │ │ -
void check()
run unit tests for simd vector type V
Definition test.hh:1839
│ │ │ │ -
void checkBinaryOpsVectorScalar()
Definition test.hh:1985
│ │ │ │ -
bool good() const
whether all tests succeeded
Definition test.hh:1859
│ │ │ │ -
void checkBinaryOpsVectorVector()
Definition test.hh:1960
│ │ │ │ -
void checkNonOps()
Definition test.hh:1878
│ │ │ │ -
void checkBinaryOpsVectorProxy()
Definition test.hh:2010
│ │ │ │ -
void checkBinaryOpsProxyVector()
Definition test.hh:2000
│ │ │ │ -
template which always yields a true value
Definition typetraits.hh:134
│ │ │ │ -
Include file for users of the SIMD abstraction layer.
│ │ │ │ +
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
│ │ │ │ +
static MPI_Datatype getType()
Definition mpitraits.hh:48
│ │ │ │ +
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │ +
A pair consisting of a global and local index.
Definition indexset.hh:85
│ │ │ │ +
Exception indicating that the index set is not in the expected state.
Definition indexset.hh:205
│ │ │ │ +
Manager class for the mapping between local indices and globally unique indices.
Definition indexset.hh:218
│ │ │ │ +
Class for recomputing missing indices of a distributed index set.
Definition indicessyncer.hh:41
│ │ │ │ +
Base class of all classes representing a communication interface.
Definition parallel/interface.hh:35
│ │ │ │ +
An index present on the local process with an additional attribute flag.
Definition plocalindex.hh:49
│ │ │ │ +
The indices present on remote processes.
Definition remoteindices.hh:189
│ │ │ │ +
const std::set< int > & getNeighbours() const
Definition remoteindices.hh:307
│ │ │ │ +
Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex
Type of the remote indices we manage.
Definition remoteindices.hh:231
│ │ │ │ +
RemoteIndices()
Definition remoteindices.hh:977
│ │ │ │ +
friend void fillIndexSetHoles(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
│ │ │ │ +
void setIndexSets(const ParallelIndexSet &source, const ParallelIndexSet &destination, const MPI_Comm &comm, const std::vector< int > &neighbours=std::vector< int >())
Set the index sets and communicator we work with.
Definition remoteindices.hh:984
│ │ │ │ +
void free()
Free the index lists.
Definition remoteindices.hh:1429
│ │ │ │ +
friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T1::GlobalIndex, typename T1::LocalIndex::Attribute >, A2 > > &, RemoteIndices< T1, A1 > &, const T1 &)
│ │ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition remoteindices.hh:215
│ │ │ │ +
void rebuild()
Rebuilds the set of remote indices.
Definition remoteindices.hh:1453
│ │ │ │ +
T ParallelIndexSet
Type of the index set we use, e.g. ParallelLocalIndexSet.
Definition remoteindices.hh:206
│ │ │ │ +
MPI_Comm communicator() const
Get the mpi communicator used.
Definition remoteindices.hh:1696
│ │ │ │ +
LocalIndex::Attribute Attribute
The type of the attribute.
Definition remoteindices.hh:226
│ │ │ │ +
CollectiveIteratorT iterator() const
Get an iterator for colletively iterating over the remote indices of all remote processes.
Definition remoteindices.hh:1690
│ │ │ │ +
void setIncludeSelf(bool includeSelf)
Tell whether sending from indices of the processor to other indices on the same processor is enabled ...
Definition remoteindices.hh:971
│ │ │ │ +
const_iterator end() const
Get an iterator over all remote index lists.
Definition remoteindices.hh:1529
│ │ │ │ +
bool operator==(const RemoteIndices &ri) const
Definition remoteindices.hh:1536
│ │ │ │ +
std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > RemoteIndexMap
The type of the map from rank to remote index list.
Definition remoteindices.hh:245
│ │ │ │ +
void setNeighbours(const C &neighbours)
Definition remoteindices.hh:300
│ │ │ │ +
RemoteIndexListModifier< T, A, mode > getModifier(int process)
Get a modifier for a remote index list.
Definition remoteindices.hh:1480
│ │ │ │ +
const ParallelIndexSet & sourceIndexSet() const
Get the index set at the source.
Definition remoteindices.hh:999
│ │ │ │ +
~RemoteIndices()
Destructor.
Definition remoteindices.hh:1014
│ │ │ │ +
Dune::SLList< RemoteIndex, Allocator > RemoteIndexList
The type of the remote index list.
Definition remoteindices.hh:241
│ │ │ │ +
int neighbours() const
Get the number of processors we share indices with.
Definition remoteindices.hh:1446
│ │ │ │ +
CollectiveIterator< T, A > CollectiveIteratorT
The type of the collective iterator over all remote indices.
Definition remoteindices.hh:210
│ │ │ │ +
const ParallelIndexSet & destinationIndexSet() const
Get the index set at destination.
Definition remoteindices.hh:1007
│ │ │ │ +
typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > Allocator
The type of the allocator for the remote index list.
Definition remoteindices.hh:237
│ │ │ │ +
const_iterator find(int proc) const
Find an iterator over the remote index lists of a specific process.
Definition remoteindices.hh:1515
│ │ │ │ +
bool isSynced() const
Checks whether the remote indices are synced with the indexsets.
Definition remoteindices.hh:1473
│ │ │ │ +
const_iterator begin() const
Get an iterator over all remote index lists.
Definition remoteindices.hh:1522
│ │ │ │ +
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition remoteindices.hh:221
│ │ │ │ +
RemoteIndexMap::const_iterator const_iterator
Definition remoteindices.hh:247
│ │ │ │ +
Information about an index residing on another processor.
Definition remoteindices.hh:73
│ │ │ │ +
const Attribute attribute() const
Get the attribute of the index on the remote process.
Definition remoteindices.hh:946
│ │ │ │ +
friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &, RemoteIndices< T, A1 > &, const T &)
│ │ │ │ +
bool operator==(const RemoteIndex &ri) const
Definition remoteindices.hh:934
│ │ │ │ +
T1 GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition remoteindices.hh:90
│ │ │ │ +
T2 Attribute
The type of the attributes. Normally this will be an enumeration like.
Definition remoteindices.hh:99
│ │ │ │ +
IndexPair< GlobalIndex, ParallelLocalIndex< Attribute > > PairType
The type of the index pair.
Definition remoteindices.hh:105
│ │ │ │ +
const PairType & localIndexPair() const
Get the corresponding local index pair.
Definition remoteindices.hh:952
│ │ │ │ +
RemoteIndex()
Parameterless Constructor.
Definition remoteindices.hh:930
│ │ │ │ +
bool operator!=(const RemoteIndex &ri) const
Definition remoteindices.hh:940
│ │ │ │ +
Modifier for adding and/or deleting remote indices from the remote index list.
Definition remoteindices.hh:551
│ │ │ │ +
void repairLocalIndexPointers()
Repair the pointers to the local index pairs.
Definition remoteindices.hh:1575
│ │ │ │ +
Dune::SLList< RemoteIndex, Allocator > RemoteIndexList
The type of the remote index list.
Definition remoteindices.hh:602
│ │ │ │ +
A Allocator
The type of the allocator for the remote index list.
Definition remoteindices.hh:598
│ │ │ │ +
void insert(const RemoteIndex &index)
Insert an index to the list.
Definition remoteindices.hh:1605
│ │ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition remoteindices.hh:578
│ │ │ │ +
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition remoteindices.hh:583
│ │ │ │ +
RemoteIndexList::const_iterator ConstIterator
The type of the remote index list iterator.
Definition remoteindices.hh:612
│ │ │ │ +
SLListModifyIterator< RemoteIndex, Allocator > ModifyIterator
The type of the modifying iterator of the remote index list.
Definition remoteindices.hh:607
│ │ │ │ +
bool remove(const GlobalIndex &global)
Remove a remote index.
Definition remoteindices.hh:1653
│ │ │ │ +
T ParallelIndexSet
Type of the index set we use.
Definition remoteindices.hh:573
│ │ │ │ +
RemoteIndexListModifier()
Default constructor.
Definition remoteindices.hh:676
│ │ │ │ +
LocalIndex::Attribute Attribute
The type of the attribute.
Definition remoteindices.hh:588
│ │ │ │ +
Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex
Type of the remote indices we manage.
Definition remoteindices.hh:593
│ │ │ │ +
static constexpr bool MODIFYINDEXSET
If true the index set corresponding to the remote indices might get modified.
Definition remoteindices.hh:568
│ │ │ │ +
A collective iterator for moving over the remote indices for all processes collectively.
Definition remoteindices.hh:708
│ │ │ │ +
CollectiveIterator & operator++()
Definition remoteindices.hh:1779
│ │ │ │ +
iterator end()
Definition remoteindices.hh:1822
│ │ │ │ +
CollectiveIterator(const RemoteIndexMap &map_, bool send)
Constructor.
Definition remoteindices.hh:1703
│ │ │ │ +
bool empty() const
Checks whether there are still iterators in the map.
Definition remoteindices.hh:1804
│ │ │ │ +
void advance(const GlobalIndex &global)
Advances all underlying iterators.
Definition remoteindices.hh:1716
│ │ │ │ +
std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > RemoteIndexMap
The type of the map from rank to remote index list.
Definition remoteindices.hh:748
│ │ │ │ +
iterator begin()
Definition remoteindices.hh:1811
│ │ │ │ +
Definition remoteindices.hh:167
│ │ │ │ +
Definition remoteindices.hh:558
│ │ │ │ +
Iterator over the valid underlying iterators.
Definition remoteindices.hh:792
│ │ │ │ +
iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex &index)
Definition remoteindices.hh:799
│ │ │ │ +
iterator(const iterator &other)
Definition remoteindices.hh:817
│ │ │ │ +
const RemoteIndex & operator*() const
Definition remoteindices.hh:838
│ │ │ │ +
Map::iterator ConstRealIterator
Definition remoteindices.hh:795
│ │ │ │ +
iterator & operator++()
Definition remoteindices.hh:822
│ │ │ │ +
const RemoteIndex * operator->() const
Definition remoteindices.hh:850
│ │ │ │ +
bool operator==(const iterator &other) const
Definition remoteindices.hh:856
│ │ │ │ +
int process() const
Definition remoteindices.hh:844
│ │ │ │ +
iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex index, Attribute attribute)
Definition remoteindices.hh:807
│ │ │ │ +
bool operator!=(const iterator &other) const
Definition remoteindices.hh:862
│ │ │ │ +
Map::iterator RealIterator
Definition remoteindices.hh:794
│ │ │ │ +
A constant iterator for the SLList.
Definition sllist.hh:371
│ │ │ │ +
A mutable iterator for the SLList.
Definition sllist.hh:429
│ │ │ │ +
A single linked list.
Definition sllist.hh:44
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,2096 +1,1925 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_i_m_d │ │ │ │ │ -test.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +remoteindices.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_TEST_HH │ │ │ │ │ -4#define DUNE_COMMON_SIMD_TEST_HH │ │ │ │ │ -5 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22 │ │ │ │ │ -23#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_y_b_r_i_d_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -25#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -26#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_o_._h_h> │ │ │ │ │ -27#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_l_o_o_p_._h_h> │ │ │ │ │ -28#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ -29#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ -30#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ -31#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -32 │ │ │ │ │ -33namespace _D_u_n_e { │ │ │ │ │ -34 namespace Simd { │ │ │ │ │ -35 │ │ │ │ │ -36 namespace Impl { │ │ │ │ │ -37 │ │ │ │ │ -38 template │ │ │ │ │ -39 struct LessThenComparable : std::false_type {}; │ │ │ │ │ -40 template │ │ │ │ │ -41 struct LessThenComparable() │ │ │ │ │ -42 < std::declval())> > : │ │ │ │ │ -43 std::true_type │ │ │ │ │ -44 {}; │ │ │ │ │ -45 │ │ │ │ │ -46 template │ │ │ │ │ -47 struct CopyConstHelper │ │ │ │ │ -48 { │ │ │ │ │ -49 using type = Dst; │ │ │ │ │ -50 }; │ │ │ │ │ -51 template │ │ │ │ │ -52 struct CopyConstHelper │ │ │ │ │ -53 { │ │ │ │ │ -54 using type = std::add_const_t; │ │ │ │ │ -55 }; │ │ │ │ │ -56 │ │ │ │ │ -57 template │ │ │ │ │ -58 struct CopyVolatileHelper │ │ │ │ │ -59 { │ │ │ │ │ -60 using type = Dst; │ │ │ │ │ -61 }; │ │ │ │ │ -62 template │ │ │ │ │ -63 struct CopyVolatileHelper │ │ │ │ │ -64 { │ │ │ │ │ -65 using type = std::add_volatile_t; │ │ │ │ │ -66 }; │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +5#ifndef DUNE_REMOTEINDICES_HH │ │ │ │ │ +6#define DUNE_REMOTEINDICES_HH │ │ │ │ │ +7 │ │ │ │ │ +8#if HAVE_MPI │ │ │ │ │ +9 │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18 │ │ │ │ │ +19#include │ │ │ │ │ +20 │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_d_e_x_s_e_t_._h_h> │ │ │ │ │ +23#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ +24#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_p_l_o_c_a_l_i_n_d_e_x_._h_h> │ │ │ │ │ +25#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_l_l_i_s_t_._h_h> │ │ │ │ │ +26#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ +27 │ │ │ │ │ +28namespace _D_u_n_e { │ │ │ │ │ +40 template │ │ │ │ │ +_4_1 class _M_P_I_T_r_a_i_t_s<_I_n_d_e_x_P_a_i_r > > │ │ │ │ │ +42 { │ │ │ │ │ +43 public: │ │ │ │ │ +44 inline static MPI_Datatype _g_e_t_T_y_p_e(); │ │ │ │ │ +45 private: │ │ │ │ │ +46 static MPI_Datatype type; │ │ │ │ │ +47 }; │ │ │ │ │ +48 │ │ │ │ │ +49 │ │ │ │ │ +50 template │ │ │ │ │ +51 class _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ +52 │ │ │ │ │ +53 template │ │ │ │ │ +54 class _R_e_m_o_t_e_I_n_d_e_x; │ │ │ │ │ +55 │ │ │ │ │ +56 // forward declaration needed for friend declaration. │ │ │ │ │ +57 template │ │ │ │ │ +58 class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ +59 │ │ │ │ │ +60 template │ │ │ │ │ +_6_1 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>& index); │ │ │ │ │ +62 │ │ │ │ │ +63 │ │ │ │ │ +64 template │ │ │ │ │ +65 class _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r; │ │ │ │ │ +66 │ │ │ │ │ 67 │ │ │ │ │ -68 template │ │ │ │ │ -69 struct CopyReferenceHelper │ │ │ │ │ -70 { │ │ │ │ │ -71 using type = Dst; │ │ │ │ │ -72 }; │ │ │ │ │ -73 template │ │ │ │ │ -74 struct CopyReferenceHelper │ │ │ │ │ -75 { │ │ │ │ │ -76 using type = std::add_lvalue_reference_t; │ │ │ │ │ -77 }; │ │ │ │ │ -78 │ │ │ │ │ -79 template │ │ │ │ │ -80 struct CopyReferenceHelper │ │ │ │ │ -81 { │ │ │ │ │ -82 using type = std::add_rvalue_reference_t; │ │ │ │ │ -83 }; │ │ │ │ │ +71 template │ │ │ │ │ +_7_2 class _R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +73 { │ │ │ │ │ +74 template │ │ │ │ │ +_7_5 friend class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ +76 │ │ │ │ │ +77 template │ │ │ │ │ +_7_8 friend void _r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s(std::map,A> >&, │ │ │ │ │ +79 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>&, │ │ │ │ │ +80 const T&); │ │ │ │ │ +81 │ │ │ │ │ +82 template │ │ │ │ │ +_8_3 friend class _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r; │ │ │ │ │ 84 │ │ │ │ │ -85 template │ │ │ │ │ -86 using CopyRefQual = typename CopyReferenceHelper< │ │ │ │ │ -87 typename CopyVolatileHelper< │ │ │ │ │ -88 typename CopyConstHelper< │ │ │ │ │ -89 std::decay_t, │ │ │ │ │ -90 std::remove_reference_t │ │ │ │ │ -91 >::type, │ │ │ │ │ -92 std::remove_reference_t │ │ │ │ │ -93 >::type, │ │ │ │ │ -94 Src │ │ │ │ │ -95 >::type; │ │ │ │ │ -96 │ │ │ │ │ -97 template::value - 1> > │ │ │ │ │ -100 struct RemoveEnd; │ │ │ │ │ -101 template │ │ │ │ │ -102 struct RemoveEnd> │ │ │ │ │ -103 { │ │ │ │ │ -104 using Back = TypeListEntry_t::value - 1, Types>; │ │ │ │ │ -105 static_assert(std::is_same::value, │ │ │ │ │ -106 "TypeList not terminated by proper EndMark"); │ │ │ │ │ -107 using type = TypeList...>; │ │ │ │ │ -108 }; │ │ │ │ │ -109 │ │ │ │ │ -110 template │ │ │ │ │ -111 struct TypeInList; │ │ │ │ │ +85 public: │ │ │ │ │ +_9_0 typedef T1 _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +_9_9 typedef T2 _A_t_t_r_i_b_u_t_e; │ │ │ │ │ +100 │ │ │ │ │ +104 typedef _I_n_d_e_x_P_a_i_r_<_G_l_o_b_a_l_I_n_d_e_x_,_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_A_t_t_r_i_b_u_t_e_> > │ │ │ │ │ +_1_0_5 _P_a_i_r_T_y_p_e; │ │ │ │ │ +106 │ │ │ │ │ +111 const _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() const; │ │ │ │ │ 112 │ │ │ │ │ -113 template │ │ │ │ │ -114 struct TypeInList > : std::false_type {}; │ │ │ │ │ -115 │ │ │ │ │ -116 template │ │ │ │ │ -117 struct TypeInList > : std::true_type {}; │ │ │ │ │ -118 │ │ │ │ │ -119 template │ │ │ │ │ -120 struct TypeInList, │ │ │ │ │ -121 _s_t_d::enable_if_t::value> > : │ │ │ │ │ -122 TypeInList >::type │ │ │ │ │ -123 {}; │ │ │ │ │ +118 const _P_a_i_r_T_y_p_e& _l_o_c_a_l_I_n_d_e_x_P_a_i_r() const; │ │ │ │ │ +119 │ │ │ │ │ +123 _R_e_m_o_t_e_I_n_d_e_x(); │ │ │ │ │ 124 │ │ │ │ │ -125 template │ │ │ │ │ -126 struct _I_s_L_o_o_p : std::false_type {}; │ │ │ │ │ -127 template │ │ │ │ │ -128 struct _I_s_L_o_o_p > : std::true_type {}; │ │ │ │ │ -129 │ │ │ │ │ -130 // used inside static_assert to trick the compiler into printing a list │ │ │ │ │ -131 // of types: │ │ │ │ │ -132 // │ │ │ │ │ -133 // static_assert(debugTypes(Std::bool_constant{}), "msg"); │ │ │ │ │ -134 // │ │ │ │ │ -135 // Should include what the type `V` expands to in the error message. │ │ │ │ │ -136 template │ │ │ │ │ -137 constexpr bool debugTypes(std::true_type) { return true; } │ │ │ │ │ -138 template │ │ │ │ │ -139 [[deprecated]] │ │ │ │ │ -140 constexpr bool debugTypes(std::false_type) { return false; } │ │ │ │ │ +125 │ │ │ │ │ +131 _R_e_m_o_t_e_I_n_d_e_x(const T2& _a_t_t_r_i_b_u_t_e, │ │ │ │ │ +132 const _P_a_i_r_T_y_p_e* local); │ │ │ │ │ +133 │ │ │ │ │ +134 │ │ │ │ │ +140 _R_e_m_o_t_e_I_n_d_e_x(const T2& _a_t_t_r_i_b_u_t_e); │ │ │ │ │ 141 │ │ │ │ │ -142 } // namespace Impl │ │ │ │ │ +142 bool _o_p_e_r_a_t_o_r_=_=(const _R_e_m_o_t_e_I_n_d_e_x& ri) const; │ │ │ │ │ 143 │ │ │ │ │ -_1_4_5 struct _E_n_d_M_a_r_k {}; │ │ │ │ │ -147 │ │ │ │ │ -156 template │ │ │ │ │ -_1_5_7 using _R_e_b_i_n_d_L_i_s_t = │ │ │ │ │ -158 typename Impl::RemoveEnd<_E_n_d_M_a_r_k, _T_y_p_e_L_i_s_t >::type; │ │ │ │ │ -159 │ │ │ │ │ -161 template │ │ │ │ │ -_1_6_2 using _I_s_L_o_o_p = typename Impl::IsLoop::type; │ │ │ │ │ -163 │ │ │ │ │ -_1_6_4 class _U_n_i_t_T_e_s_t { │ │ │ │ │ -165 bool good_ = true; │ │ │ │ │ -166 std::ostream &log_ = std::cerr; │ │ │ │ │ -167 // records the types for which checks have started running to avoid │ │ │ │ │ -168 // infinite recursion │ │ │ │ │ -169 std::unordered_set seen_; │ │ │ │ │ -170 │ │ │ │ │ -172 // │ │ │ │ │ -173 // Helper functions │ │ │ │ │ -174 // │ │ │ │ │ -175 │ │ │ │ │ -176 void complain(const char *file, int line, const char *func, │ │ │ │ │ -177 const char *expr); │ │ │ │ │ -178 │ │ │ │ │ -179 void complain(const char *file, int line, const char *func, │ │ │ │ │ -180 const std::string &opname, const char *expr); │ │ │ │ │ -181 │ │ │ │ │ -182 // This macro is defined only within this file, do not use anywhere │ │ │ │ │ -183 // else. Doing the actual printing in an external function dramatically │ │ │ │ │ -184 // reduces memory use during compilation. Defined in such a way that │ │ │ │ │ -185 // the call will only happen for failed checks. │ │ │ │ │ -_1_8_6#define DUNE_SIMD_CHECK(expr) \ │ │ │ │ │ -187 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr)) │ │ │ │ │ -188 │ │ │ │ │ -189 // the function using this macro must define a way to compute the │ │ │ │ │ -190 // operator name in DUNE_SIMD_OPNAME │ │ │ │ │ -_1_9_1#define DUNE_SIMD_CHECK_OP(expr) \ │ │ │ │ │ -192 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, \ │ │ │ │ │ -193 DUNE_SIMD_OPNAME, #expr)) │ │ │ │ │ -194 │ │ │ │ │ -195 // "cast" into a prvalue │ │ │ │ │ -196 template │ │ │ │ │ -197 static std::decay_t prvalue(T &&t) │ │ │ │ │ -198 { │ │ │ │ │ -199 return std::forward(t); │ │ │ │ │ -200 } │ │ │ │ │ -201 │ │ │ │ │ -202 // whether the vector is 42 in all lanes │ │ │ │ │ -203 template │ │ │ │ │ -204 static bool is42(const V &v) │ │ │ │ │ -205 { │ │ │ │ │ -206 bool _g_o_o_d = true; │ │ │ │ │ +144 bool _o_p_e_r_a_t_o_r_!_=(const _R_e_m_o_t_e_I_n_d_e_x& ri) const; │ │ │ │ │ +145 private: │ │ │ │ │ +147 const _P_a_i_r_T_y_p_e* localIndex_; │ │ │ │ │ +148 │ │ │ │ │ +150 char attribute_; │ │ │ │ │ +151 }; │ │ │ │ │ +152 │ │ │ │ │ +153 template │ │ │ │ │ +154 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>& │ │ │ │ │ +indices); │ │ │ │ │ +155 │ │ │ │ │ +156 class _I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r; │ │ │ │ │ +157 │ │ │ │ │ +158 template │ │ │ │ │ +159 class _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +160 │ │ │ │ │ +161 // forward declaration needed for friend declaration. │ │ │ │ │ +162 template │ │ │ │ │ +163 class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ +164 │ │ │ │ │ +165 // forward declaration needed for friend declaration. │ │ │ │ │ +166 template │ │ │ │ │ +_1_6_7 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; │ │ │ │ │ +168 │ │ │ │ │ +169 │ │ │ │ │ +186 template > > │ │ │ │ │ +_1_8_8 class _R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +189 { │ │ │ │ │ +_1_9_0 friend class _I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r; │ │ │ │ │ +191 friend class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ +192 template │ │ │ │ │ +_1_9_3 friend void _r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s(std::map,A2> >&, │ │ │ │ │ +194 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_1_,_A_1_>&, │ │ │ │ │ +195 const T1&); │ │ │ │ │ +196 │ │ │ │ │ +197 template │ │ │ │ │ +_1_9_8 friend 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); │ │ │ │ │ +_1_9_9 friend std::ostream& operator<<<>(std::ostream&, const _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_>&); │ │ │ │ │ +200 │ │ │ │ │ +201 public: │ │ │ │ │ +202 │ │ │ │ │ +_2_0_6 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ 207 │ │ │ │ │ -208 for(std::size_t l = 0; l < _l_a_n_e_s(v); ++l) │ │ │ │ │ -209 // need to cast in case we have a mask type │ │ │ │ │ -210 _g_o_o_d &= (_l_a_n_e(l, v) == Scalar(42)); │ │ │ │ │ +_2_1_0 typedef _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_> _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_T; │ │ │ │ │ 211 │ │ │ │ │ -212 return _g_o_o_d; │ │ │ │ │ -213 } │ │ │ │ │ -214 │ │ │ │ │ -215 // make a vector that contains the sequence { 1, 2, ... } │ │ │ │ │ -216 template │ │ │ │ │ -217 static V make123() │ │ │ │ │ -218 { │ │ │ │ │ -219 // initialize to avoid undefined behaviour if assigning to lane() │ │ │ │ │ -220 // involves lvalue-to-rvalue conversions, e.g. due to bitmask │ │ │ │ │ -221 // operations. Avoid using broadcast() for initialization to avoid │ │ │ │ │ -222 // test interdependencies. │ │ │ │ │ -223 V vec(Scalar(0)); │ │ │ │ │ -224 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ -225 _l_a_n_e(l, vec) = l + 1; │ │ │ │ │ -226 return vec; │ │ │ │ │ -227 } │ │ │ │ │ -228 │ │ │ │ │ -229 // whether the vector contains the sequence { 1, 2, ... } │ │ │ │ │ -230 template │ │ │ │ │ -231 static bool is123(const V &v) │ │ │ │ │ -232 { │ │ │ │ │ -233 bool _g_o_o_d = true; │ │ │ │ │ -234 │ │ │ │ │ -235 for(std::size_t l = 0; l < _l_a_n_e_s(v); ++l) │ │ │ │ │ -236 // need to cast in case we have a mask type │ │ │ │ │ -237 _g_o_o_d &= (_l_a_n_e(l, v) == Scalar(l+1)); │ │ │ │ │ +_2_1_5 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +216 │ │ │ │ │ +217 │ │ │ │ │ +_2_2_1 typedef typename _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 _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ +222 │ │ │ │ │ +_2_2_6 typedef typename LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ │ +227 │ │ │ │ │ +_2_3_1 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_<_G_l_o_b_a_l_I_n_d_e_x_,_A_t_t_r_i_b_u_t_e_> _R_e_m_o_t_e_I_n_d_e_x; │ │ │ │ │ +232 │ │ │ │ │ +233 │ │ │ │ │ +_2_3_7 using _A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ │ +rebind_alloc; │ │ │ │ │ 238 │ │ │ │ │ -239 return _g_o_o_d; │ │ │ │ │ -240 } │ │ │ │ │ -241 │ │ │ │ │ -242 template │ │ │ │ │ -243 static V leftVector() │ │ │ │ │ -244 { │ │ │ │ │ -245 // Avoid using broadcast() for initialization to avoid test │ │ │ │ │ -246 // interdependencies. │ │ │ │ │ -247 V res(Scalar(0)); │ │ │ │ │ -248 for(std::size_t l = 0; l < _l_a_n_e_s(res); ++l) │ │ │ │ │ -249 _l_a_n_e(l, res) = Scalar(l+1); │ │ │ │ │ -250 return res; │ │ │ │ │ -251 } │ │ │ │ │ -252 │ │ │ │ │ -253 template │ │ │ │ │ -254 static V rightVector() │ │ │ │ │ -255 { │ │ │ │ │ -256 // Avoid using broadcast() for initialization to avoid test │ │ │ │ │ -257 // interdependencies. │ │ │ │ │ -258 V res(Scalar(0)); │ │ │ │ │ -259 for(std::size_t l = 0; l < _l_a_n_e_s(res); ++l) │ │ │ │ │ -260 // do not exceed number of bits in char (for shifts) │ │ │ │ │ -261 // avoid 0 (for / and %) │ │ │ │ │ -262 _l_a_n_e(l, res) = Scalar((l)%7+1); │ │ │ │ │ -263 return res; │ │ │ │ │ -264 } │ │ │ │ │ -265 │ │ │ │ │ -266 template │ │ │ │ │ -267 static T leftScalar() │ │ │ │ │ -268 { │ │ │ │ │ -269 return T(42); │ │ │ │ │ -270 } │ │ │ │ │ -271 │ │ │ │ │ -272 template │ │ │ │ │ -273 static T rightScalar() │ │ │ │ │ -274 { │ │ │ │ │ -275 // do not exceed number of bits in char (for shifts) │ │ │ │ │ -276 // avoid 0 (for / and %) │ │ │ │ │ -277 return T(5); │ │ │ │ │ -278 } │ │ │ │ │ +240 typedef _D_u_n_e_:_:_S_L_L_i_s_t_<_R_e_m_o_t_e_I_n_d_e_x_,_A_l_l_o_c_a_t_o_r_> │ │ │ │ │ +_2_4_1 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t; │ │ │ │ │ +242 │ │ │ │ │ +244 typedef std::map > │ │ │ │ │ +_2_4_5 _R_e_m_o_t_e_I_n_d_e_x_M_a_p; │ │ │ │ │ +246 │ │ │ │ │ +_2_4_7 typedef typename RemoteIndexMap::const_iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +248 │ │ │ │ │ +266 inline _R_e_m_o_t_e_I_n_d_i_c_e_s(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& source, const │ │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& destination, │ │ │ │ │ +267 const MPI_Comm& comm, const std::vector& _n_e_i_g_h_b_o_u_r_s=std::vector │ │ │ │ │ +(), bool includeSelf=false); │ │ │ │ │ +268 │ │ │ │ │ +269 _R_e_m_o_t_e_I_n_d_i_c_e_s(); │ │ │ │ │ +270 │ │ │ │ │ +278 void _s_e_t_I_n_c_l_u_d_e_S_e_l_f(bool includeSelf); │ │ │ │ │ 279 │ │ │ │ │ -280 template │ │ │ │ │ -281 using CopyRefQual = Impl::CopyRefQual; │ │ │ │ │ -282 │ │ │ │ │ -283 // test whether the Op supports the operation on scalars. We do not use │ │ │ │ │ -284 // `lane()` to obtain the scalars, because that might return a proxy │ │ │ │ │ -285 // object, and we are interested in what exactly the scalar type can do, │ │ │ │ │ -286 // no a proxy that might have more overloads than needed. In addition, │ │ │ │ │ -287 // `lane()` may not preserve `const` and reference qualifiers. │ │ │ │ │ -288 template │ │ │ │ │ -289 using ScalarResult = │ │ │ │ │ -290 decltype(std::declval(). │ │ │ │ │ -291 scalar(std::declval, │ │ │ │ │ -292 Vectors> >()...)); │ │ │ │ │ -293 │ │ │ │ │ -295 // │ │ │ │ │ -296 // Check associated types │ │ │ │ │ -297 // │ │ │ │ │ +296 void _s_e_t_I_n_d_e_x_S_e_t_s(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& source, const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& │ │ │ │ │ +destination, │ │ │ │ │ +297 const MPI_Comm& comm, const std::vector& _n_e_i_g_h_b_o_u_r_s=std::vector │ │ │ │ │ +()); │ │ │ │ │ 298 │ │ │ │ │ -299 template │ │ │ │ │ -300 void checkScalar() │ │ │ │ │ +299 template │ │ │ │ │ +_3_0_0 void _s_e_t_N_e_i_g_h_b_o_u_r_s(const C& _n_e_i_g_h_b_o_u_r_s) │ │ │ │ │ 301 { │ │ │ │ │ -302 // check that the type Scalar exists │ │ │ │ │ -303 using T = Scalar; │ │ │ │ │ +302 neighbourIds.clear(); │ │ │ │ │ +303 neighbourIds.insert(_n_e_i_g_h_b_o_u_r_s.begin(), _n_e_i_g_h_b_o_u_r_s.end()); │ │ │ │ │ 304 │ │ │ │ │ -305 static_assert(std::is_same >::value, "Scalar types " │ │ │ │ │ -306 "must not be references, and must not include " │ │ │ │ │ -307 "cv-qualifiers"); │ │ │ │ │ -308 [[maybe_unused]] T a{}; │ │ │ │ │ -309 } │ │ │ │ │ -310 │ │ │ │ │ -311 template │ │ │ │ │ -312 [[deprecated("Warning: please include bool in the Rebinds for " │ │ │ │ │ -313 "simd type V, as Masks are not checked otherwise.")]] │ │ │ │ │ -314 void warnMissingMaskRebind(std::true_type) {} │ │ │ │ │ -315 template │ │ │ │ │ -316 void warnMissingMaskRebind(std::false_type) {} │ │ │ │ │ -317 │ │ │ │ │ -318 template class RebindPrune, │ │ │ │ │ -319 template class RebindAccept, class Recurse> │ │ │ │ │ -320 void checkRebindOf(Recurse recurse) │ │ │ │ │ -321 { │ │ │ │ │ -322 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(Rebinds{}, [this,recurse](auto target) { │ │ │ │ │ -323 using T = typename decltype(target)::type; │ │ │ │ │ -324 │ │ │ │ │ -325 // check that the rebound type exists │ │ │ │ │ -326 using W = Rebind; │ │ │ │ │ -327 log_ << "Type " << className() << " rebound to " │ │ │ │ │ -328 << className() << " is " << className() << std::endl; │ │ │ │ │ -329 │ │ │ │ │ -330 static_assert(std::is_same >::value, "Rebound " │ │ │ │ │ -331 "types must not be references, and must not include " │ │ │ │ │ -332 "cv-qualifiers"); │ │ │ │ │ -333 static_assert(lanes() == lanes(), "Rebound types must have " │ │ │ │ │ -334 "the same number of lanes as the original vector " │ │ │ │ │ -335 "types"); │ │ │ │ │ -336 static_assert(std::is_same >::value, "Rebound types " │ │ │ │ │ -337 "must have the bound-to scalar type"); │ │ │ │ │ -338 │ │ │ │ │ -339 if constexpr (RebindPrune{}) { │ │ │ │ │ -340 log_ << "Pruning check of Simd type " << className() │ │ │ │ │ -341 << std::endl; │ │ │ │ │ -342 } │ │ │ │ │ -343 else { │ │ │ │ │ -344 using Impl::debugTypes; │ │ │ │ │ -345 static_assert(debugTypes(RebindAccept{}), │ │ │ │ │ -346 "Rebind is W, but that is not accepted " │ │ │ │ │ -347 "by RebindAccept"); │ │ │ │ │ -348 recurse(MetaType{}); │ │ │ │ │ -349 } │ │ │ │ │ -350 }); │ │ │ │ │ -351 │ │ │ │ │ -352 static_assert(std::is_same, V>, V>::value, "A type " │ │ │ │ │ -353 "rebound to its own scalar type must be the same type " │ │ │ │ │ -354 "as the original type"); │ │ │ │ │ -355 static_assert(std::is_same, Mask >::value, "A type " │ │ │ │ │ -356 "rebound to bool must be the mask type for that type"); │ │ │ │ │ -357 │ │ │ │ │ -358 constexpr bool hasBool = Impl::TypeInList::value; │ │ │ │ │ -359 warnMissingMaskRebind(Std::bool_constant{}); │ │ │ │ │ -360 } │ │ │ │ │ +305 } │ │ │ │ │ +306 │ │ │ │ │ +_3_0_7 const std::set& _g_e_t_N_e_i_g_h_b_o_u_r_s() const │ │ │ │ │ +308 { │ │ │ │ │ +309 return neighbourIds; │ │ │ │ │ +310 } │ │ │ │ │ +311 │ │ │ │ │ +315 _~_R_e_m_o_t_e_I_n_d_i_c_e_s(); │ │ │ │ │ +316 │ │ │ │ │ +326 template │ │ │ │ │ +327 void _r_e_b_u_i_l_d(); │ │ │ │ │ +328 │ │ │ │ │ +329 bool _o_p_e_r_a_t_o_r_=_=(const _R_e_m_o_t_e_I_n_d_i_c_e_s& ri) const; │ │ │ │ │ +330 │ │ │ │ │ +338 inline bool _i_s_S_y_n_c_e_d() const; │ │ │ │ │ +339 │ │ │ │ │ +343 inline MPI_Comm _c_o_m_m_u_n_i_c_a_t_o_r() const; │ │ │ │ │ +344 │ │ │ │ │ +359 template │ │ │ │ │ +360 inline _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_> _g_e_t_M_o_d_i_f_i_e_r(int process); │ │ │ │ │ 361 │ │ │ │ │ -363 // │ │ │ │ │ -364 // Fundamental checks │ │ │ │ │ -365 // │ │ │ │ │ -366 │ │ │ │ │ -367 template │ │ │ │ │ -368 void checkLanes() │ │ │ │ │ -369 { │ │ │ │ │ -370 // check lanes │ │ │ │ │ -371 static_assert(std::is_same())>::value, │ │ │ │ │ -372 "return type of lanes() should be std::size_t"); │ │ │ │ │ -373 static_assert(std::is_same::value, │ │ │ │ │ -374 "return type of lanes(V{}) should be std::size_t"); │ │ │ │ │ +368 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _f_i_n_d(int proc) const; │ │ │ │ │ +369 │ │ │ │ │ +374 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ 375 │ │ │ │ │ -376 // the result of lanes() must be constexpr │ │ │ │ │ -377 [[maybe_unused]] constexpr auto size = lanes(); │ │ │ │ │ -378 // but the result of lanes(vec) does not need to be constexpr │ │ │ │ │ -379 _D_U_N_E___S_I_M_D___C_H_E_C_K(lanes() == _l_a_n_e_s(V{})); │ │ │ │ │ -380 } │ │ │ │ │ +380 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ 381 │ │ │ │ │ -382 template │ │ │ │ │ -383 void checkDefaultConstruct() │ │ │ │ │ -384 { │ │ │ │ │ -385 { [[maybe_unused]] V vec; } │ │ │ │ │ -386 { [[maybe_unused]] V vec{}; } │ │ │ │ │ -387 { [[maybe_unused]] V vec = {}; } │ │ │ │ │ -388 } │ │ │ │ │ -389 │ │ │ │ │ -390 template │ │ │ │ │ -391 void checkLane() │ │ │ │ │ -392 { │ │ │ │ │ -393 // Avoid using broadcast() for initialization to avoid test │ │ │ │ │ -394 // interdependencies. │ │ │ │ │ -395 V vec(Scalar(0)); │ │ │ │ │ -396 // check lane() on mutable lvalues │ │ │ │ │ -397 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ -398 _l_a_n_e(l, vec) = l + 1; │ │ │ │ │ -399 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ -400 _D_U_N_E___S_I_M_D___C_H_E_C_K(_l_a_n_e(l, vec) == Scalar(l + 1)); │ │ │ │ │ -401 using MLRes = decltype(_l_a_n_e(0, vec)); │ │ │ │ │ -402 static_assert(std::is_same&>::value || │ │ │ │ │ -403 std::is_same >::value, │ │ │ │ │ -404 "Result of lane() on a mutable lvalue vector must " │ │ │ │ │ -405 "either be a mutable reference to a scalar of that " │ │ │ │ │ -406 "vector or a proxy object (which itself may not be a " │ │ │ │ │ -407 "reference nor const)."); │ │ │ │ │ +385 template │ │ │ │ │ +386 inline _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_T _i_t_e_r_a_t_o_r() const; │ │ │ │ │ +387 │ │ │ │ │ +391 inline void _f_r_e_e(); │ │ │ │ │ +392 │ │ │ │ │ +397 inline int _n_e_i_g_h_b_o_u_r_s() const; │ │ │ │ │ +398 │ │ │ │ │ +400 inline const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& _s_o_u_r_c_e_I_n_d_e_x_S_e_t() const; │ │ │ │ │ +401 │ │ │ │ │ +403 inline const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& _d_e_s_t_i_n_a_t_i_o_n_I_n_d_e_x_S_e_t() const; │ │ │ │ │ +404 │ │ │ │ │ +405 private: │ │ │ │ │ +407 _R_e_m_o_t_e_I_n_d_i_c_e_s(const _R_e_m_o_t_e_I_n_d_i_c_e_s&) = delete; │ │ │ │ │ 408 │ │ │ │ │ -409 // check lane() on const lvalues │ │ │ │ │ -410 const V &vec2 = vec; │ │ │ │ │ -411 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ -412 _D_U_N_E___S_I_M_D___C_H_E_C_K(_l_a_n_e(l, vec2) == Scalar(l + 1)); │ │ │ │ │ -413 using CLRes = decltype(_l_a_n_e(0, vec2)); │ │ │ │ │ -414 static_assert(std::is_same&>::value || │ │ │ │ │ -415 std::is_same >::value, │ │ │ │ │ -416 "Result of lane() on a const lvalue vector must " │ │ │ │ │ -417 "either be a const lvalue reference to a scalar of that " │ │ │ │ │ -418 "vector or a proxy object (which itself may not be a " │ │ │ │ │ -419 "reference nor const)."); │ │ │ │ │ -420 static_assert(!std::is_assignable >::value, │ │ │ │ │ -421 "Result of lane() on a const lvalue vector must not be " │ │ │ │ │ -422 "assignable from a scalar."); │ │ │ │ │ -423 │ │ │ │ │ -424 // check lane() on rvalues │ │ │ │ │ -425 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ -426 _D_U_N_E___S_I_M_D___C_H_E_C_K(_l_a_n_e(l, prvalue(vec)) == Scalar(l + 1)); │ │ │ │ │ -427 using RRes = decltype(_l_a_n_e(0, prvalue(vec))); │ │ │ │ │ -428 // TODO: do we really want to allow Scalar&& here? If we allow it, │ │ │ │ │ -429 // then `auto &&res = lane(0, vec*vec);` creates a dangling reference, │ │ │ │ │ -430 // and the scalar (and even the vector types) are small enough to be │ │ │ │ │ -431 // passed in registers anyway. On the other hand, the only comparable │ │ │ │ │ -432 // accessor function in the standard library that I can think of is │ │ │ │ │ -433 // std::get(), and that does return an rvalue reference in this │ │ │ │ │ -434 // situation. However, that cannot assume anything about the size of │ │ │ │ │ -435 // the returned types. │ │ │ │ │ -436 static_assert(std::is_same >::value || │ │ │ │ │ -437 std::is_same&&>::value, │ │ │ │ │ -438 "Result of lane() on a rvalue vector V must be " │ │ │ │ │ -439 "Scalar or Scalar&&."); │ │ │ │ │ -440 // Can't assert non-assignable, fails for any typical class, │ │ │ │ │ -441 // e.g. std::complex<>. Would need to return const Scalar or const │ │ │ │ │ -442 // Scalar&&, which would inhibit moving from the return value. │ │ │ │ │ -443 // static_assert(!std::is_assignable >::value, │ │ │ │ │ -444 // "Result of lane() on a rvalue vector must not be " │ │ │ │ │ -445 // "assignable from a scalar."); │ │ │ │ │ -446 } │ │ │ │ │ -447 │ │ │ │ │ -448 // check non-default constructors │ │ │ │ │ -449 template │ │ │ │ │ -450 void checkCopyMoveConstruct() │ │ │ │ │ -451 { │ │ │ │ │ -452 // elided copy/move constructors │ │ │ │ │ -453 { V vec (make123()); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -454 { V vec = make123() ; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -455 { V vec {make123()}; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -456 { V vec = {make123()}; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -457 │ │ │ │ │ -458 // copy constructors │ │ │ │ │ -459 { V ref(make123()); V vec (ref); │ │ │ │ │ -460 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ -461 { V ref(make123()); V vec = ref ; │ │ │ │ │ -462 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ -463 { V ref(make123()); V vec {ref}; │ │ │ │ │ -464 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ -465 { V ref(make123()); V vec = {ref}; │ │ │ │ │ -466 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ -467 { const V ref(make123()); V vec (ref); │ │ │ │ │ -468 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -469 { const V ref(make123()); V vec = ref ; │ │ │ │ │ -470 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -471 { const V ref(make123()); V vec {ref}; │ │ │ │ │ -472 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -473 { const V ref(make123()); V vec = {ref}; │ │ │ │ │ -474 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -475 │ │ │ │ │ -476 // move constructors │ │ │ │ │ -477 { V ref(make123()); V vec (std::move(ref)); │ │ │ │ │ -478 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -479 { V ref(make123()); V vec = std::move(ref) ; │ │ │ │ │ -480 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -481 { V ref(make123()); V vec {std::move(ref)}; │ │ │ │ │ -482 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -483 { V ref(make123()); V vec = {std::move(ref)}; │ │ │ │ │ -484 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -485 } │ │ │ │ │ +410 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* source_; │ │ │ │ │ +411 │ │ │ │ │ +413 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* target_; │ │ │ │ │ +414 │ │ │ │ │ +416 MPI_Comm comm_; │ │ │ │ │ +417 │ │ │ │ │ +420 std::set neighbourIds; │ │ │ │ │ +421 │ │ │ │ │ +423 const static int commTag_=333; │ │ │ │ │ +424 │ │ │ │ │ +429 int sourceSeqNo_; │ │ │ │ │ +430 │ │ │ │ │ +435 int destSeqNo_; │ │ │ │ │ +436 │ │ │ │ │ +440 bool publicIgnored; │ │ │ │ │ +441 │ │ │ │ │ +445 bool firstBuild; │ │ │ │ │ +446 │ │ │ │ │ +447 /* │ │ │ │ │ +448 * @brief If true, sending from indices of the processor to other │ │ │ │ │ +449 * indices on the same processor is enabled even if the same indexset is │ │ │ │ │ +used │ │ │ │ │ +450 * on both the │ │ │ │ │ +451 * sending and receiving side. │ │ │ │ │ +452 */ │ │ │ │ │ +453 bool includeSelf; │ │ │ │ │ +454 │ │ │ │ │ +456 typedef _I_n_d_e_x_P_a_i_r_<_G_l_o_b_a_l_I_n_d_e_x_,_ _L_o_c_a_l_I_n_d_e_x_> │ │ │ │ │ +457 PairType; │ │ │ │ │ +458 │ │ │ │ │ +465 _R_e_m_o_t_e_I_n_d_e_x_M_a_p remoteIndices_; │ │ │ │ │ +466 │ │ │ │ │ +477 template │ │ │ │ │ +478 inline void buildRemote(bool includeSelf); │ │ │ │ │ +479 │ │ │ │ │ +485 inline int noPublic(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet); │ │ │ │ │ 486 │ │ │ │ │ -487 template │ │ │ │ │ -488 void checkBroadcastVectorConstruct() │ │ │ │ │ -489 { │ │ │ │ │ -490 // broadcast copy constructors │ │ │ │ │ -491 { Scalar ref = 42; V vec (ref); │ │ │ │ │ -492 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ -493 { Scalar ref = 42; V vec = ref ; │ │ │ │ │ -494 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ -495 // { Scalar ref = 42; V vec {ref}; │ │ │ │ │ -496 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ -497 // { Scalar ref = 42; V vec = {ref}; │ │ │ │ │ -498 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ -499 { const Scalar ref = 42; V vec (ref); │ │ │ │ │ -500 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -501 { const Scalar ref = 42; V vec = ref ; │ │ │ │ │ -502 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -503 // { const Scalar ref = 42; V vec {ref}; │ │ │ │ │ -504 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -505 // { const Scalar ref = 42; V vec = {ref}; │ │ │ │ │ -506 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -507 │ │ │ │ │ -508 // broadcast move constructors │ │ │ │ │ -509 { Scalar ref = 42; V vec (std::move(ref)); │ │ │ │ │ -510 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -511 { Scalar ref = 42; V vec = std::move(ref) ; │ │ │ │ │ -512 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -513 // { Scalar ref = 42; V vec {std::move(ref)}; │ │ │ │ │ -514 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -515 // { Scalar ref = 42; V vec = {std::move(ref)}; │ │ │ │ │ -516 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -517 } │ │ │ │ │ -518 │ │ │ │ │ -519 template │ │ │ │ │ -520 void checkBroadcastMaskConstruct() │ │ │ │ │ -521 { │ │ │ │ │ -522 // broadcast copy constructors │ │ │ │ │ -523 { Scalar ref = 42; V vec (ref); │ │ │ │ │ -524 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ -525 // { Scalar ref = 42; V vec = ref ; │ │ │ │ │ -526 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ -527 { Scalar ref = 42; V vec {ref}; │ │ │ │ │ -528 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ -529 // { Scalar ref = 42; V vec = {ref}; │ │ │ │ │ -530 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ -531 { const Scalar ref = 42; V vec (ref); │ │ │ │ │ -532 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -533 // { const Scalar ref = 42; V vec = ref ; │ │ │ │ │ -534 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -535 { const Scalar ref = 42; V vec {ref}; │ │ │ │ │ -536 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -537 // { const Scalar ref = 42; V vec = {ref}; │ │ │ │ │ -538 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -539 │ │ │ │ │ -540 // broadcast move constructors │ │ │ │ │ -541 { Scalar ref = 42; V vec (std::move(ref)); │ │ │ │ │ -542 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -543 // { Scalar ref = 42; V vec = std::move(ref) ; │ │ │ │ │ -544 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -545 { Scalar ref = 42; V vec {std::move(ref)}; │ │ │ │ │ -546 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ -547 // { Scalar ref = 42; V vec = {std::move(ref)}; │ │ │ │ │ -548 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -549 } │ │ │ │ │ -550 │ │ │ │ │ -551 // check the implCast function │ │ │ │ │ -552 template │ │ │ │ │ -553 void checkImplCast() │ │ │ │ │ -554 { │ │ │ │ │ -555 { // lvalue arg │ │ │ │ │ -556 FromV fromVec = make123(); │ │ │ │ │ -557 auto toVec = implCast(fromVec); │ │ │ │ │ -558 static_assert(std::is_same::value, │ │ │ │ │ -559 "Unexpected result type for implCast(FromV&)"); │ │ │ │ │ -560 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(fromVec)); │ │ │ │ │ -561 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(toVec)); │ │ │ │ │ -562 } │ │ │ │ │ -563 │ │ │ │ │ -564 { // const lvalue arg │ │ │ │ │ -565 const FromV fromVec = make123(); │ │ │ │ │ -566 auto toVec = implCast(fromVec); │ │ │ │ │ -567 static_assert(std::is_same::value, │ │ │ │ │ -568 "Unexpected result type for implCast(const " │ │ │ │ │ -569 "FromV&)"); │ │ │ │ │ -570 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(toVec)); │ │ │ │ │ -571 } │ │ │ │ │ -572 │ │ │ │ │ -573 { // rvalue arg │ │ │ │ │ -574 auto toVec = implCast(make123()); │ │ │ │ │ -575 static_assert(std::is_same::value, │ │ │ │ │ -576 "Unexpected result type for implCast(FromV&&)"); │ │ │ │ │ -577 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(toVec)); │ │ │ │ │ -578 } │ │ │ │ │ -579 } │ │ │ │ │ -580 │ │ │ │ │ -581 // check the implCast function │ │ │ │ │ -582 template │ │ │ │ │ -583 void checkImplCast() │ │ │ │ │ -584 { │ │ │ │ │ -585 // check against LoopSIMD │ │ │ │ │ -586 using LoopV = _D_u_n_e_:_:_L_o_o_p_S_I_M_D_<_S_c_a_l_a_r_<_V_>, lanes()>; │ │ │ │ │ -587 │ │ │ │ │ -588 checkImplCast(); │ │ │ │ │ -589 checkImplCast(); │ │ │ │ │ -590 checkImplCast(); │ │ │ │ │ -591 } │ │ │ │ │ -592 │ │ │ │ │ -593 // check the broadcast function │ │ │ │ │ -594 template │ │ │ │ │ -595 void checkBroadcast() │ │ │ │ │ -596 { │ │ │ │ │ -597 // broadcast function │ │ │ │ │ -598 { // lvalue arg │ │ │ │ │ -599 Scalar ref = 42; │ │ │ │ │ -600 auto vec = broadcast(ref); │ │ │ │ │ -601 static_assert(std::is_same::value, │ │ │ │ │ -602 "Unexpected result type for broadcast()"); │ │ │ │ │ -603 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ -604 _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); │ │ │ │ │ -605 } │ │ │ │ │ -606 │ │ │ │ │ -607 { // const lvalue arg │ │ │ │ │ -608 const Scalar ref = 42; │ │ │ │ │ -609 auto vec = broadcast(ref); │ │ │ │ │ -610 static_assert(std::is_same::value, │ │ │ │ │ -611 "Unexpected result type for broadcast()"); │ │ │ │ │ -612 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ -613 } │ │ │ │ │ -614 │ │ │ │ │ -615 { // rvalue arg │ │ │ │ │ -616 auto vec = broadcast(Scalar(42)); │ │ │ │ │ -617 static_assert(std::is_same::value, │ │ │ │ │ -618 "Unexpected result type for broadcast()"); │ │ │ │ │ -619 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ -620 } │ │ │ │ │ -621 │ │ │ │ │ -622 { // int arg │ │ │ │ │ -623 auto vec = broadcast(42); │ │ │ │ │ -624 static_assert(std::is_same::value, │ │ │ │ │ -625 "Unexpected result type for broadcast()"); │ │ │ │ │ -626 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ -627 } │ │ │ │ │ +498 template │ │ │ │ │ +499 inline void packEntries(PairType** myPairs, const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& │ │ │ │ │ +indexSet, │ │ │ │ │ +500 char* p_out, MPI_Datatype type, int bufferSize, │ │ │ │ │ +501 int* position, int n); │ │ │ │ │ +502 │ │ │ │ │ +516 inline void unpackIndices(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& remote, int remoteEntries, │ │ │ │ │ +517 PairType** local, int localEntries, char* p_in, │ │ │ │ │ +518 MPI_Datatype type, int* position, int bufferSize, │ │ │ │ │ +519 bool fromOurself); │ │ │ │ │ +520 │ │ │ │ │ +521 inline void unpackIndices(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& send, _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& receive, │ │ │ │ │ +522 int remoteEntries, PairType** localSource, │ │ │ │ │ +523 int localSourceEntries, PairType** localDest, │ │ │ │ │ +524 int localDestEntries, char* p_in, │ │ │ │ │ +525 MPI_Datatype type, int* position, int bufferSize); │ │ │ │ │ +526 │ │ │ │ │ +527 void unpackCreateRemote(char* p_in, PairType** sourcePairs, PairType** │ │ │ │ │ +DestPairs, │ │ │ │ │ +528 int remoteProc, int sourcePublish, int destPublish, │ │ │ │ │ +529 int bufferSize, bool sendTwo, bool fromOurSelf=false); │ │ │ │ │ +530 }; │ │ │ │ │ +531 │ │ │ │ │ +549 template │ │ │ │ │ +_5_5_0 class _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r │ │ │ │ │ +551 { │ │ │ │ │ +552 │ │ │ │ │ +553 template │ │ │ │ │ +_5_5_4 friend class _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ +555 │ │ │ │ │ +556 public: │ │ │ │ │ +_5_5_7 class _I_n_v_a_l_i_d_P_o_s_i_t_i_o_n : public _R_a_n_g_e_E_r_r_o_r │ │ │ │ │ +558 {}; │ │ │ │ │ +559 │ │ │ │ │ +_5_6_8 constexpr static bool _M_O_D_I_F_Y_I_N_D_E_X_S_E_T = mode; │ │ │ │ │ +569 │ │ │ │ │ +_5_7_3 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +574 │ │ │ │ │ +_5_7_8 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +579 │ │ │ │ │ +_5_8_3 typedef typename _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 _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ +584 │ │ │ │ │ +_5_8_8 typedef typename LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ │ +589 │ │ │ │ │ +_5_9_3 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_<_G_l_o_b_a_l_I_n_d_e_x_,_A_t_t_r_i_b_u_t_e_> _R_e_m_o_t_e_I_n_d_e_x; │ │ │ │ │ +594 │ │ │ │ │ +_5_9_8 typedef A _A_l_l_o_c_a_t_o_r; │ │ │ │ │ +599 │ │ │ │ │ +601 typedef _D_u_n_e_:_:_S_L_L_i_s_t_<_R_e_m_o_t_e_I_n_d_e_x_,_A_l_l_o_c_a_t_o_r_> │ │ │ │ │ +_6_0_2 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t; │ │ │ │ │ +603 │ │ │ │ │ +_6_0_7 typedef _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_R_e_m_o_t_e_I_n_d_e_x_,_A_l_l_o_c_a_t_o_r_> _M_o_d_i_f_y_I_t_e_r_a_t_o_r; │ │ │ │ │ +608 │ │ │ │ │ +_6_1_2 typedef typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_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; │ │ │ │ │ +613 │ │ │ │ │ +627 void _i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x& index); │ │ │ │ │ 628 │ │ │ │ │ -629 { // double arg │ │ │ │ │ -630 auto vec = broadcast(42.0); │ │ │ │ │ -631 static_assert(std::is_same::value, │ │ │ │ │ -632 "Unexpected result type for broadcast()"); │ │ │ │ │ -633 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ -634 } │ │ │ │ │ -635 } │ │ │ │ │ -636 │ │ │ │ │ -637 template │ │ │ │ │ -638 void checkBracedAssign() │ │ │ │ │ -639 { │ │ │ │ │ -640 // copy assignment │ │ │ │ │ -641 { V ref = make123(); V vec; vec = {ref}; │ │ │ │ │ -642 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ -643 { const V ref = make123(); V vec; vec = {ref}; │ │ │ │ │ -644 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ +629 │ │ │ │ │ +644 void _i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x& index, const _G_l_o_b_a_l_I_n_d_e_x& global); │ │ │ │ │ 645 │ │ │ │ │ -646 // move assignment │ │ │ │ │ -647 { V vec; vec = {make123()}; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ -648 } │ │ │ │ │ -649 │ │ │ │ │ -650 template │ │ │ │ │ -651 void checkBracedBroadcastAssign() │ │ │ │ │ -652 { │ │ │ │ │ -653 // nothing works here │ │ │ │ │ -654 // // broadcast copy assignment │ │ │ │ │ -655 // { Scalar ref = 42; V vec; vec = {ref}; │ │ │ │ │ -656 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ -657 // { const Scalar ref = 42; V vec; vec = {ref}; │ │ │ │ │ -658 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -659 │ │ │ │ │ -660 // // broadcast move assignment │ │ │ │ │ -661 // { Scalar ref = 42; V vec; vec = {std::move(ref)}; │ │ │ │ │ -662 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ -663 } │ │ │ │ │ -664 │ │ │ │ │ -666 // │ │ │ │ │ -667 // checks for unary operators │ │ │ │ │ -668 // │ │ │ │ │ +653 bool _r_e_m_o_v_e(const _G_l_o_b_a_l_I_n_d_e_x& global); │ │ │ │ │ +654 │ │ │ │ │ +667 void _r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s(); │ │ │ │ │ +668 │ │ │ │ │ 669 │ │ │ │ │ -_6_7_0#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL) \ │ │ │ │ │ -671 struct OpPostfix##NAME \ │ │ │ │ │ -672 { \ │ │ │ │ │ -673 template \ │ │ │ │ │ -674 auto operator()(V&& v) const \ │ │ │ │ │ -675 -> decltype(std::forward(v) SYMBOL) \ │ │ │ │ │ -676 { \ │ │ │ │ │ -677 return std::forward(v) SYMBOL; \ │ │ │ │ │ -678 } \ │ │ │ │ │ -679 } │ │ │ │ │ -680 │ │ │ │ │ -_6_8_1#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL) \ │ │ │ │ │ -682 struct OpPrefix##NAME \ │ │ │ │ │ -683 { \ │ │ │ │ │ -684 template \ │ │ │ │ │ -685 auto operator()(V&& v) const \ │ │ │ │ │ -686 -> decltype(SYMBOL std::forward(v)) \ │ │ │ │ │ -687 { \ │ │ │ │ │ -688 return SYMBOL std::forward(v); \ │ │ │ │ │ -689 } \ │ │ │ │ │ -690 } │ │ │ │ │ -691 │ │ │ │ │ -692 _D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P(Decrement, -- ); │ │ │ │ │ -693 _D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P(Increment, ++ ); │ │ │ │ │ -694 │ │ │ │ │ -695 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Decrement, -- ); │ │ │ │ │ -696 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Increment, ++ ); │ │ │ │ │ -697 │ │ │ │ │ -698 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Plus, + ); │ │ │ │ │ -699 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Minus, - ); │ │ │ │ │ -700 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (LogicNot, ! ); │ │ │ │ │ -701 // Do not warn about ~ being applied to bool. (1) Yes, doing that is │ │ │ │ │ -702 // weird, but we do want to test the weird stuff too. (2) It avoids │ │ │ │ │ -703 // running into on │ │ │ │ │ -704 // g++-7.0 through 7.2. Also, ignore -Wpragmas to not warn about an │ │ │ │ │ -705 // unknown -Wbool-operation on compilers that do not know that option. │ │ │ │ │ -706#pragma GCC diagnostic push │ │ │ │ │ -707#pragma GCC diagnostic ignored "-Wpragmas" │ │ │ │ │ -708#pragma GCC diagnostic ignored "-Wunknown-warning-option" // clang 6.0.1 │ │ │ │ │ -709#pragma GCC diagnostic ignored "-Wbool-operation" │ │ │ │ │ -710 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (BitNot, ~ ); │ │ │ │ │ -711#pragma GCC diagnostic pop │ │ │ │ │ -712 │ │ │ │ │ -713#undef DUNE_SIMD_POSTFIX_OP │ │ │ │ │ -714#undef DUNE_SIMD_PREFIX_OP │ │ │ │ │ -715 │ │ │ │ │ -716 template │ │ │ │ │ -717 std::enable_if_t< │ │ │ │ │ -718 IsCallable())))>::value> │ │ │ │ │ -719 checkUnaryOpV(Op op) │ │ │ │ │ -720 { │ │ │ │ │ -721#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ -722 // arguments │ │ │ │ │ -723 auto val = leftVector>(); │ │ │ │ │ +670 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r(const _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r&); │ │ │ │ │ +671 │ │ │ │ │ +_6_7_6 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r() │ │ │ │ │ +677 : glist_() │ │ │ │ │ +678 {} │ │ │ │ │ +679 │ │ │ │ │ +680 private: │ │ │ │ │ +681 │ │ │ │ │ +687 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ +688 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& rList); │ │ │ │ │ +689 │ │ │ │ │ +690 typedef _S_L_L_i_s_t_<_G_l_o_b_a_l_I_n_d_e_x_,_A_l_l_o_c_a_t_o_r_> GlobalList; │ │ │ │ │ +691 typedef typename _G_l_o_b_a_l_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r GlobalModifyIterator; │ │ │ │ │ +692 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t* rList_; │ │ │ │ │ +693 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* indexSet_; │ │ │ │ │ +694 GlobalList glist_; │ │ │ │ │ +695 _M_o_d_i_f_y_I_t_e_r_a_t_o_r iter_; │ │ │ │ │ +696 GlobalModifyIterator giter_; │ │ │ │ │ +697 _C_o_n_s_t_I_t_e_r_a_t_o_r end_; │ │ │ │ │ +698 bool first_; │ │ │ │ │ +699 _G_l_o_b_a_l_I_n_d_e_x last_; │ │ │ │ │ +700 }; │ │ │ │ │ +701 │ │ │ │ │ +706 template │ │ │ │ │ +_7_0_7 class _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r │ │ │ │ │ +708 { │ │ │ │ │ +709 │ │ │ │ │ +713 typedef T ParallelIndexSet; │ │ │ │ │ +714 │ │ │ │ │ +718 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x GlobalIndex; │ │ │ │ │ +719 │ │ │ │ │ +723 typedef typename _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 LocalIndex; │ │ │ │ │ 724 │ │ │ │ │ -725 // copy the arguments in case V is a references │ │ │ │ │ -726 auto arg = val; │ │ │ │ │ -727 auto &&result = op(static_cast(arg)); │ │ │ │ │ -728 using T = _S_c_a_l_a_r >; │ │ │ │ │ -729 for(std::size_t l = 0; l < _l_a_n_e_s(val); ++l) │ │ │ │ │ -730 { │ │ │ │ │ -731 // `op` might promote the argument. This is a problem if the │ │ │ │ │ -732 // argument of the operation on the right of the `==` is │ │ │ │ │ -733 // e.g. `(unsigned short)1` and the operation is e.g. unary `-`. │ │ │ │ │ -734 // Then the argument is promoted to `int` before applying the │ │ │ │ │ -735 // negation, and the result is `(int)-1`. However, the left side of │ │ │ │ │ -736 // the `==` is still `(unsigned short)-1`, which typically is the │ │ │ │ │ -737 // same as `(unsigned short)65535`. The `==` promotes the left side │ │ │ │ │ -738 // before comparing, so that becomes `(int)65535`. It will then │ │ │ │ │ -739 // compare `(int)65535` and `(int)-1` and rightly declare them to be │ │ │ │ │ -740 // not equal. │ │ │ │ │ -741 │ │ │ │ │ -742 // To work around this, we explicitly convert the right side of the │ │ │ │ │ -743 // `==` to the scalar type before comparing. │ │ │ │ │ -744 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ -745 (_l_a_n_e(l, result) │ │ │ │ │ -746 == static_cast(op(_l_a_n_e(l, static_cast(val))))); │ │ │ │ │ -747 } │ │ │ │ │ -748 // op might modify val, verify that any such modification also happens │ │ │ │ │ -749 // in the vector case │ │ │ │ │ -750 for(std::size_t l = 0; l < lanes >(); ++l) │ │ │ │ │ -751 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, val) == _l_a_n_e(l, arg)); │ │ │ │ │ -752#undef DUNE_SIMD_OPNAME │ │ │ │ │ -753 } │ │ │ │ │ -754 │ │ │ │ │ -755 template │ │ │ │ │ -756 std::enable_if_t< │ │ │ │ │ -757 not IsCallable())))>::value> │ │ │ │ │ -758 checkUnaryOpV(Op op) │ │ │ │ │ -759 { │ │ │ │ │ -760 // log_ << "No " << className())))>() │ │ │ │ │ -761 // << std::endl │ │ │ │ │ -762 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ -763 } │ │ │ │ │ -764 │ │ │ │ │ -765 template │ │ │ │ │ -766 void checkUnaryOpsV(Op op) │ │ │ │ │ -767 { │ │ │ │ │ -768 checkUnaryOpV(op); │ │ │ │ │ -769 checkUnaryOpV(op); │ │ │ │ │ -770 checkUnaryOpV(op); │ │ │ │ │ -771 } │ │ │ │ │ -772 │ │ │ │ │ -774 // │ │ │ │ │ -775 // checks for binary operators │ │ │ │ │ -776 // │ │ │ │ │ +728 typedef typename LocalIndex::Attribute Attribute; │ │ │ │ │ +729 │ │ │ │ │ +731 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_<_G_l_o_b_a_l_I_n_d_e_x_,_A_t_t_r_i_b_u_t_e_> _R_e_m_o_t_e_I_n_d_e_x; │ │ │ │ │ +732 │ │ │ │ │ +734 using Allocator = typename std::allocator_traits::template │ │ │ │ │ +rebind_alloc; │ │ │ │ │ +735 │ │ │ │ │ +737 typedef _D_u_n_e_:_:_S_L_L_i_s_t_<_R_e_m_o_t_e_I_n_d_e_x_,_A_l_l_o_c_a_t_o_r_> _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t; │ │ │ │ │ +738 │ │ │ │ │ +740 typedef std::map > │ │ │ │ │ +742 Map; │ │ │ │ │ +743 │ │ │ │ │ +744 public: │ │ │ │ │ +745 │ │ │ │ │ +747 typedef std::map > │ │ │ │ │ +_7_4_8 _R_e_m_o_t_e_I_n_d_e_x_M_a_p; │ │ │ │ │ +749 │ │ │ │ │ +755 inline _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r(const _R_e_m_o_t_e_I_n_d_e_x_M_a_p& map_, bool send); │ │ │ │ │ +756 │ │ │ │ │ +765 inline void _a_d_v_a_n_c_e(const GlobalIndex& global); │ │ │ │ │ +766 │ │ │ │ │ +776 inline void _a_d_v_a_n_c_e(const GlobalIndex& global, const Attribute& attribute); │ │ │ │ │ 777 │ │ │ │ │ -778 // The operators contain an `operator()`, which will be invoked for both │ │ │ │ │ -779 // scalar and vector arguments. The function `scalar()` is used the │ │ │ │ │ -780 // test whether the scalar types support the operation (via │ │ │ │ │ -781 // `ScalarResult`). The difference is that `scalar()` should only ever │ │ │ │ │ -782 // receive `const`-ref-qualified version of `Scalar`, while the │ │ │ │ │ -783 // `operator()` may also be called with proxies representing scalars. │ │ │ │ │ -_7_8_4#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL) \ │ │ │ │ │ -785 struct OpInfix##NAME \ │ │ │ │ │ -786 { \ │ │ │ │ │ -787 template \ │ │ │ │ │ -788 decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ -789 { \ │ │ │ │ │ -790 return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ -791 } \ │ │ │ │ │ -792 template \ │ │ │ │ │ -793 auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ -794 -> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ -795 } │ │ │ │ │ +778 _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +779 │ │ │ │ │ +783 inline bool _e_m_p_t_y() const; │ │ │ │ │ +784 │ │ │ │ │ +_7_9_1 class _i_t_e_r_a_t_o_r │ │ │ │ │ +792 { │ │ │ │ │ +793 public: │ │ │ │ │ +_7_9_4 typedef typename Map::iterator _R_e_a_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +_7_9_5 typedef typename Map::iterator _C_o_n_s_t_R_e_a_l_I_t_e_r_a_t_o_r; │ │ │ │ │ 796 │ │ │ │ │ -797 // for assign ops, accept only non-const lvalue arguments for scalars. │ │ │ │ │ -798 // This is needed for class scalars (e.g. std::complex) because │ │ │ │ │ -799 // non-const class rvalues are actually usually assignable. Though that │ │ │ │ │ -800 // assignment happens to a temporary, and thus is lost. Except that the │ │ │ │ │ -801 // tests would bind the result of the assignment to a reference. And │ │ │ │ │ -802 // because that result is returned from a function by reference, even │ │ │ │ │ -803 // though it is a temporary passed as an argument to that function, │ │ │ │ │ -804 // accessing the result later is undefined behaviour. │ │ │ │ │ -_8_0_5#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL) \ │ │ │ │ │ -806 struct OpInfix##NAME \ │ │ │ │ │ -807 { \ │ │ │ │ │ -808 template \ │ │ │ │ │ -809 decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ -810 { \ │ │ │ │ │ -811 return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ -812 } \ │ │ │ │ │ -813 template \ │ │ │ │ │ -814 auto scalar(S1& s1, S2&& s2) const \ │ │ │ │ │ -815 -> decltype(s1 SYMBOL std::forward(s2)); \ │ │ │ │ │ -816 } │ │ │ │ │ -817 │ │ │ │ │ -_8_1_8#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL) \ │ │ │ │ │ -819 struct OpInfix##NAME \ │ │ │ │ │ -820 { \ │ │ │ │ │ -821 template \ │ │ │ │ │ -822 decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ -823 { \ │ │ │ │ │ -824 return Simd::REPLFN(std::forward(v1), std::forward(v2)); \ │ │ │ │ │ -825 } \ │ │ │ │ │ -826 template \ │ │ │ │ │ -827 auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ -828 -> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ -829 } │ │ │ │ │ -830 │ │ │ │ │ -831 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Mul, * ); │ │ │ │ │ -832 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Div, / ); │ │ │ │ │ -833 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Remainder, % ); │ │ │ │ │ -834 │ │ │ │ │ -835 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Plus, + ); │ │ │ │ │ -836 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Minus, - ); │ │ │ │ │ -837 │ │ │ │ │ -838 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(LeftShift, << ); │ │ │ │ │ -839 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(RightShift, >> ); │ │ │ │ │ -840 │ │ │ │ │ -841 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Less, < ); │ │ │ │ │ -842 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Greater, > ); │ │ │ │ │ -843 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(LessEqual, <= ); │ │ │ │ │ -844 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(GreaterEqual, >= ); │ │ │ │ │ -845 │ │ │ │ │ -846 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Equal, == ); │ │ │ │ │ -847 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(NotEqual, != ); │ │ │ │ │ +797 │ │ │ │ │ +_7_9_9 _i_t_e_r_a_t_o_r(const _R_e_a_l_I_t_e_r_a_t_o_r& iter, const _C_o_n_s_t_R_e_a_l_I_t_e_r_a_t_o_r& _e_n_d, │ │ │ │ │ +GlobalIndex& index) │ │ │ │ │ +800 : iter_(iter), end_(_e_n_d), index_(index), hasAttribute(false) │ │ │ │ │ +801 { │ │ │ │ │ +802 // Move to the first valid entry │ │ │ │ │ +803 while(iter_!=end_ && iter_->second.first->localIndexPair().global │ │ │ │ │ +()!=index_) │ │ │ │ │ +804 ++iter_; │ │ │ │ │ +805 } │ │ │ │ │ +806 │ │ │ │ │ +_8_0_7 _i_t_e_r_a_t_o_r(const _R_e_a_l_I_t_e_r_a_t_o_r& iter, const _C_o_n_s_t_R_e_a_l_I_t_e_r_a_t_o_r& _e_n_d, │ │ │ │ │ +GlobalIndex index, │ │ │ │ │ +808 Attribute attribute) │ │ │ │ │ +809 : iter_(iter), end_(_e_n_d), index_(index), attribute_(attribute), │ │ │ │ │ +hasAttribute(true) │ │ │ │ │ +810 { │ │ │ │ │ +811 // Move to the first valid entry or the end │ │ │ │ │ +812 while(iter_!=end_ && (iter_->second.first->localIndexPair().global │ │ │ │ │ +()!=index_ │ │ │ │ │ +813 || iter_->second.first->localIndexPair().local().attribute()!=attribute)) │ │ │ │ │ +814 ++iter_; │ │ │ │ │ +815 } │ │ │ │ │ +_8_1_7 _i_t_e_r_a_t_o_r(const _i_t_e_r_a_t_o_r& other) │ │ │ │ │ +818 : iter_(other.iter_), end_(other.end_), index_(other.index_) │ │ │ │ │ +819 { } │ │ │ │ │ +820 │ │ │ │ │ +_8_2_2 _i_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +823 { │ │ │ │ │ +824 ++iter_; │ │ │ │ │ +825 // If entry is not valid move on │ │ │ │ │ +826 while(iter_!=end_ && (iter_->second.first->localIndexPair().global │ │ │ │ │ +()!=index_ || │ │ │ │ │ +827 (hasAttribute && │ │ │ │ │ +828 iter_->second.first->localIndexPair().local().attribute()!=attribute_))) │ │ │ │ │ +829 ++iter_; │ │ │ │ │ +830 assert(iter_==end_ || │ │ │ │ │ +831 (iter_->second.first->localIndexPair().global()==index_)); │ │ │ │ │ +832 assert(iter_==end_ || !hasAttribute || │ │ │ │ │ +833 (iter_->second.first->localIndexPair().local().attribute()==attribute_)); │ │ │ │ │ +834 return *this; │ │ │ │ │ +835 } │ │ │ │ │ +836 │ │ │ │ │ +_8_3_8 const _R_e_m_o_t_e_I_n_d_e_x& _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ +839 { │ │ │ │ │ +840 return *(iter_->second.first); │ │ │ │ │ +841 } │ │ │ │ │ +842 │ │ │ │ │ +_8_4_4 int _p_r_o_c_e_s_s() const │ │ │ │ │ +845 { │ │ │ │ │ +846 return iter_->first; │ │ │ │ │ +847 } │ │ │ │ │ 848 │ │ │ │ │ -849 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(BitAnd, & ); │ │ │ │ │ -850 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(BitXor, ^ ); │ │ │ │ │ -851 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(BitOr, | ); │ │ │ │ │ -852 │ │ │ │ │ -853 // Those are not supported in any meaningful way by vectorclass │ │ │ │ │ -854 // We need to test replacement functions maskAnd() and maskOr() instead. │ │ │ │ │ -855 _D_U_N_E___S_I_M_D___R_E_P_L___O_P(LogicAnd, _m_a_s_k_A_n_d, && ); │ │ │ │ │ -856 _D_U_N_E___S_I_M_D___R_E_P_L___O_P(LogicOr, _m_a_s_k_O_r, || ); │ │ │ │ │ -857 │ │ │ │ │ -858 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(Assign, = ); │ │ │ │ │ -859 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignMul, *= ); │ │ │ │ │ -860 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignDiv, /= ); │ │ │ │ │ -861 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignRemainder, %= ); │ │ │ │ │ -862 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignPlus, += ); │ │ │ │ │ -863 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignMinus, -= ); │ │ │ │ │ -864 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignLeftShift, <<=); │ │ │ │ │ -865 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignRightShift, >>=); │ │ │ │ │ -866 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignAnd, &= ); │ │ │ │ │ -867 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignXor, ^= ); │ │ │ │ │ -868 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignOr, |= ); │ │ │ │ │ +_8_5_0 const _R_e_m_o_t_e_I_n_d_e_x* _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ +851 { │ │ │ │ │ +852 return iter_->second.first.operator->(); │ │ │ │ │ +853 } │ │ │ │ │ +854 │ │ │ │ │ +_8_5_6 bool _o_p_e_r_a_t_o_r_=_=(const _i_t_e_r_a_t_o_r& other) const │ │ │ │ │ +857 { │ │ │ │ │ +858 return other.iter_==iter_; │ │ │ │ │ +859 } │ │ │ │ │ +860 │ │ │ │ │ +_8_6_2 bool _o_p_e_r_a_t_o_r_!_=(const _i_t_e_r_a_t_o_r& other) const │ │ │ │ │ +863 { │ │ │ │ │ +864 return other.iter_!=iter_; │ │ │ │ │ +865 } │ │ │ │ │ +866 │ │ │ │ │ +867 private: │ │ │ │ │ +868 _i_t_e_r_a_t_o_r(); │ │ │ │ │ 869 │ │ │ │ │ -870#undef DUNE_SIMD_INFIX_OP │ │ │ │ │ -871#undef DUNE_SIMD_REPL_OP │ │ │ │ │ -872#undef DUNE_SIMD_ASSIGN_OP │ │ │ │ │ -873 │ │ │ │ │ -874 // just used as a tag │ │ │ │ │ -875 struct OpInfixComma {}; │ │ │ │ │ +870 _R_e_a_l_I_t_e_r_a_t_o_r iter_; │ │ │ │ │ +871 _R_e_a_l_I_t_e_r_a_t_o_r end_; │ │ │ │ │ +872 GlobalIndex index_; │ │ │ │ │ +873 Attribute attribute_; │ │ │ │ │ +874 bool hasAttribute; │ │ │ │ │ +875 }; │ │ │ │ │ 876 │ │ │ │ │ -877 template │ │ │ │ │ -878 void checkCommaOp(const std::decay_t &val1, │ │ │ │ │ -879 const std::decay_t &val2) │ │ │ │ │ -880 { │ │ │ │ │ -881#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ -882 static_assert(std::is_same(), │ │ │ │ │ -883 std::declval())), T2>::value, │ │ │ │ │ -884 "Type and value category of the comma operator must " │ │ │ │ │ -885 "match that of the second operand"); │ │ │ │ │ -886 │ │ │ │ │ -887 // copy the arguments in case T1 or T2 are references │ │ │ │ │ -888 auto arg1 = val1; │ │ │ │ │ -889 auto arg2 = val2; │ │ │ │ │ -890 // Do not warn that the left side of the comma operator is unused. │ │ │ │ │ -891 // Seems to work for g++-4.9 and clang++-3.8. Appears to be harmless │ │ │ │ │ -892 // for icpc (14 and 17), and icpc does not seem to issue a warning │ │ │ │ │ -893 // anyway. │ │ │ │ │ -894#pragma GCC diagnostic push │ │ │ │ │ -895#pragma GCC diagnostic ignored "-Wunused-value" │ │ │ │ │ -896 auto &&result = (static_cast(arg1), │ │ │ │ │ -897 static_cast(arg2)); │ │ │ │ │ -898#pragma GCC diagnostic pop │ │ │ │ │ -899 if(std::is_reference::value) │ │ │ │ │ -900 { │ │ │ │ │ -901 // comma should return the same object as the second argument for │ │ │ │ │ -902 // lvalues and xvalues │ │ │ │ │ -903 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(&result == &arg2); │ │ │ │ │ -904 // it should not modify any arguments │ │ │ │ │ -905 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(val1 == arg1)); │ │ │ │ │ -906 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(val2 == arg2)); │ │ │ │ │ -907 } │ │ │ │ │ -908 else │ │ │ │ │ -909 { │ │ │ │ │ -910 // comma should return the same value as the second argument for │ │ │ │ │ -911 // prvalues │ │ │ │ │ -912 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(result == arg2)); │ │ │ │ │ -913 // it should not modify any arguments │ │ │ │ │ -914 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(val1 == arg1)); │ │ │ │ │ -915 // second argument is a prvalue, any modifications happen to a │ │ │ │ │ -916 // temporary and we can't detect them │ │ │ │ │ -917 } │ │ │ │ │ -918#undef DUNE_SIMD_OPNAME │ │ │ │ │ -919 } │ │ │ │ │ -920 │ │ │ │ │ -922 // │ │ │ │ │ -923 // checks for vector-vector binary operations │ │ │ │ │ -924 // │ │ │ │ │ -925 │ │ │ │ │ -926 // We check the following candidate operation │ │ │ │ │ -927 // │ │ │ │ │ -928 // vopres = vop1 @ vop2 │ │ │ │ │ -929 // │ │ │ │ │ -930 // against the reference operation │ │ │ │ │ -931 // │ │ │ │ │ -932 // arefres[l] = aref1[l] @ aref2[l] foreach l │ │ │ │ │ -933 // │ │ │ │ │ -934 // v... variables are simd-vectors and a... variables are arrays. The │ │ │ │ │ -935 // operation may modify the operands, but if is does the modification │ │ │ │ │ -936 // needs to happen in both the candidate and the reference. │ │ │ │ │ -937 // │ │ │ │ │ -938 // We do the following checks: │ │ │ │ │ -939 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -940 // 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ -941 // 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ -942 // 4. lane(l, vop2) == aref2[l] foreach l │ │ │ │ │ -943 template │ │ │ │ │ -944 std::enable_if_t > │ │ │ │ │ -945 checkBinaryOpVV(MetaType, MetaType, Op op) │ │ │ │ │ -946 { │ │ │ │ │ -947#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ -948 static_assert(std::is_same, std::decay_t >::value, │ │ │ │ │ -949 "Internal testsystem error: called with two types that " │ │ │ │ │ -950 "don't decay to the same thing"); │ │ │ │ │ -951 │ │ │ │ │ -952 // reference arguments │ │ │ │ │ -953 auto vref1 = leftVector>(); │ │ │ │ │ -954 auto vref2 = rightVector>(); │ │ │ │ │ -955 │ │ │ │ │ -956 // candidate arguments │ │ │ │ │ -957 auto vop1 = vref1; │ │ │ │ │ -958 auto vop2 = vref2; │ │ │ │ │ -959 │ │ │ │ │ -960 // candidate operation │ │ │ │ │ -961 auto &&vopres = op(static_cast(vop1), static_cast(vop2)); │ │ │ │ │ -962 using VR = decltype(vopres); │ │ │ │ │ -963 │ │ │ │ │ -964 // check 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -965 static_assert(lanes >() == _l_a_n_e_s >(), │ │ │ │ │ -966 "The result must have the same number of lanes as the " │ │ │ │ │ -967 "operands."); │ │ │ │ │ -968 │ │ │ │ │ -969 // do the reference operation, and simultaneously │ │ │ │ │ -970 // check 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ -971 using T = Scalar >; │ │ │ │ │ -972 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vopres))) │ │ │ │ │ -973 { │ │ │ │ │ -974 // see the lengthy comment in `checkUnaryOpV()` as to why the │ │ │ │ │ -975 // `static_cast` around the `op()` is necessary │ │ │ │ │ -976 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ -977 (_l_a_n_e(l, vopres) │ │ │ │ │ -978 == static_cast(op(_l_a_n_e(l, static_cast(vref1)), │ │ │ │ │ -979 _l_a_n_e(l, static_cast(vref2))))); │ │ │ │ │ -980 } │ │ │ │ │ -981 │ │ │ │ │ -982 // check 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ -983 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop1))) │ │ │ │ │ -984 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop1) == _l_a_n_e(l, vref1)); │ │ │ │ │ -985 │ │ │ │ │ -986 // check 4. lane(l, vop2) == aref2[l] foreach l │ │ │ │ │ -987 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop2))) │ │ │ │ │ -988 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop2) == _l_a_n_e(l, vref2)); │ │ │ │ │ -989 │ │ │ │ │ -990#undef DUNE_SIMD_OPNAME │ │ │ │ │ -991 } │ │ │ │ │ -992 │ │ │ │ │ -993 template │ │ │ │ │ -994 std::enable_if_t > │ │ │ │ │ -995 checkBinaryOpVV(MetaType, MetaType, Op op) │ │ │ │ │ -996 { │ │ │ │ │ -997 // log_ << "No " << className())), │ │ │ │ │ -998 // decltype(lane(0, std::declval())))>() │ │ │ │ │ -999 // << std::endl │ │ │ │ │ -1000 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ -1001 } │ │ │ │ │ -1002 │ │ │ │ │ -1003 template │ │ │ │ │ -1004 void checkBinaryOpVV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ -1005 { │ │ │ │ │ -1006 static_assert(std::is_same, std::decay_t >::value, │ │ │ │ │ -1007 "Internal testsystem error: called with two types that " │ │ │ │ │ -1008 "don't decay to the same thing"); │ │ │ │ │ -1009 │ │ │ │ │ -1010 checkCommaOp(leftVector>(), │ │ │ │ │ -1011 rightVector>()); │ │ │ │ │ -1012 } │ │ │ │ │ -1013 │ │ │ │ │ -1015 // │ │ │ │ │ -1016 // checks for vector-scalar binary operations │ │ │ │ │ -1017 // │ │ │ │ │ +877 iterator _b_e_g_i_n(); │ │ │ │ │ +878 │ │ │ │ │ +879 iterator _e_n_d(); │ │ │ │ │ +880 │ │ │ │ │ +881 private: │ │ │ │ │ +882 │ │ │ │ │ +883 Map map_; │ │ │ │ │ +884 GlobalIndex index_; │ │ │ │ │ +885 Attribute attribute_; │ │ │ │ │ +886 bool noattribute; │ │ │ │ │ +887 }; │ │ │ │ │ +888 │ │ │ │ │ +889 template │ │ │ │ │ +_8_9_0 MPI_Datatype _M_P_I_T_r_a_i_t_s_<_I_n_d_e_x_P_a_i_r_<_T_G_,_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_A_> > >::getType() │ │ │ │ │ +891 { │ │ │ │ │ +892 if(type==MPI_DATATYPE_NULL) { │ │ │ │ │ +893 int length[2] = {1, 1}; │ │ │ │ │ +894 MPI_Aint base; │ │ │ │ │ +895 MPI_Aint disp[2]; │ │ │ │ │ +896 MPI_Datatype types[2] = {_M_P_I_T_r_a_i_t_s_<_T_G_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +897 _M_P_I_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_A_> >::getType()}; │ │ │ │ │ +898 _I_n_d_e_x_P_a_i_r_<_T_G_,_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_A_> > rep; │ │ │ │ │ +899 MPI_Get_address(&rep, &base); // lower bound of the datatype │ │ │ │ │ +900 MPI_Get_address(&(rep.global_), &disp[0]); │ │ │ │ │ +901 MPI_Get_address(&(rep.local_), &disp[1]); │ │ │ │ │ +902 for (MPI_Aint& d : disp) │ │ │ │ │ +903 d -= base; │ │ │ │ │ +904 │ │ │ │ │ +905 MPI_Datatype tmp; │ │ │ │ │ +906 MPI_Type_create_struct(2, length, disp, types, &tmp); │ │ │ │ │ +907 │ │ │ │ │ +908 MPI_Type_create_resized(tmp, 0, sizeof(_I_n_d_e_x_P_a_i_r │ │ │ │ │ +>), &type); │ │ │ │ │ +909 MPI_Type_commit(&type); │ │ │ │ │ +910 │ │ │ │ │ +911 MPI_Type_free(&tmp); │ │ │ │ │ +912 } │ │ │ │ │ +913 return type; │ │ │ │ │ +914 } │ │ │ │ │ +915 │ │ │ │ │ +916 template │ │ │ │ │ +917 MPI_Datatype _M_P_I_T_r_a_i_t_s_<_I_n_d_e_x_P_a_i_r_<_T_G_,_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_A_> > >:: │ │ │ │ │ +type=MPI_DATATYPE_NULL; │ │ │ │ │ +918 │ │ │ │ │ +919 template │ │ │ │ │ +_9_2_0 _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>_:_:_R_e_m_o_t_e_I_n_d_e_x(const T2& attribute, const _P_a_i_r_T_y_p_e* local) │ │ │ │ │ +921 : localIndex_(local), attribute_(static_cast<_s_t_d::underlying_type_t> │ │ │ │ │ +(attribute)) │ │ │ │ │ +922 {} │ │ │ │ │ +923 │ │ │ │ │ +924 template │ │ │ │ │ +_9_2_5 _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>_:_:_R_e_m_o_t_e_I_n_d_e_x(const T2& attribute) │ │ │ │ │ +926 : localIndex_(0), attribute_(static_cast<_s_t_d::underlying_type_t> │ │ │ │ │ +(attribute)) │ │ │ │ │ +927 {} │ │ │ │ │ +928 │ │ │ │ │ +929 template │ │ │ │ │ +_9_3_0 _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>_:_:_R_e_m_o_t_e_I_n_d_e_x() │ │ │ │ │ +931 : localIndex_(0), attribute_() │ │ │ │ │ +932 {} │ │ │ │ │ +933 template │ │ │ │ │ +_9_3_4 inline bool _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>_:_:_o_p_e_r_a_t_o_r_=_=(const _R_e_m_o_t_e_I_n_d_e_x& ri) const │ │ │ │ │ +935 { │ │ │ │ │ +936 return localIndex_==ri.localIndex_ && attribute_==ri._a_t_t_r_i_b_u_t_e; │ │ │ │ │ +937 } │ │ │ │ │ +938 │ │ │ │ │ +939 template │ │ │ │ │ +_9_4_0 inline bool _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>_:_:_o_p_e_r_a_t_o_r_!_=(const _R_e_m_o_t_e_I_n_d_e_x& ri) const │ │ │ │ │ +941 { │ │ │ │ │ +942 return localIndex_!=ri.localIndex_ || attribute_!=ri.attribute_; │ │ │ │ │ +943 } │ │ │ │ │ +944 │ │ │ │ │ +945 template │ │ │ │ │ +_9_4_6 inline const T2 _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>_:_:_a_t_t_r_i_b_u_t_e() const │ │ │ │ │ +947 { │ │ │ │ │ +948 return T2(attribute_); │ │ │ │ │ +949 } │ │ │ │ │ +950 │ │ │ │ │ +951 template │ │ │ │ │ +_9_5_2 inline const _I_n_d_e_x_P_a_i_r_<_T_1_,_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_2_> >& _R_e_m_o_t_e_I_n_d_e_x_<_T_1_,_T_2_>_:_: │ │ │ │ │ +_l_o_c_a_l_I_n_d_e_x_P_a_i_r() const │ │ │ │ │ +953 { │ │ │ │ │ +954 return *localIndex_; │ │ │ │ │ +955 } │ │ │ │ │ +956 │ │ │ │ │ +957 template │ │ │ │ │ +_9_5_8 inline _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& source, │ │ │ │ │ +959 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& destination, │ │ │ │ │ +960 const MPI_Comm& comm, │ │ │ │ │ +961 const std::vector& neighbours, │ │ │ │ │ +962 bool includeSelf_) │ │ │ │ │ +963 : source_(&source), target_(&destination), comm_(comm), │ │ │ │ │ +964 sourceSeqNo_(-1), destSeqNo_(-1), publicIgnored(false), firstBuild(true), │ │ │ │ │ +965 includeSelf(includeSelf_) │ │ │ │ │ +966 { │ │ │ │ │ +967 _s_e_t_N_e_i_g_h_b_o_u_r_s(_n_e_i_g_h_b_o_u_r_s); │ │ │ │ │ +968 } │ │ │ │ │ +969 │ │ │ │ │ +970 template │ │ │ │ │ +_9_7_1 void _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_s_e_t_I_n_c_l_u_d_e_S_e_l_f(bool b) │ │ │ │ │ +972 { │ │ │ │ │ +973 includeSelf=b; │ │ │ │ │ +974 } │ │ │ │ │ +975 │ │ │ │ │ +976 template │ │ │ │ │ +_9_7_7 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s() │ │ │ │ │ +978 : source_(0), target_(0), sourceSeqNo_(-1), │ │ │ │ │ +979 destSeqNo_(-1), publicIgnored(false), firstBuild(true), │ │ │ │ │ +980 includeSelf(false) │ │ │ │ │ +981 {} │ │ │ │ │ +982 │ │ │ │ │ +983 template │ │ │ │ │ +_9_8_4 void _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_s_e_t_I_n_d_e_x_S_e_t_s(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& source, │ │ │ │ │ +985 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& destination, │ │ │ │ │ +986 const MPI_Comm& comm, │ │ │ │ │ +987 const std::vector& neighbours) │ │ │ │ │ +988 { │ │ │ │ │ +989 free(); │ │ │ │ │ +990 source_ = &source; │ │ │ │ │ +991 target_ = &destination; │ │ │ │ │ +992 comm_ = comm; │ │ │ │ │ +993 firstBuild = true; │ │ │ │ │ +994 setNeighbours(neighbours); │ │ │ │ │ +995 } │ │ │ │ │ +996 │ │ │ │ │ +997 template │ │ │ │ │ +998 const typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& │ │ │ │ │ +_9_9_9 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_s_o_u_r_c_e_I_n_d_e_x_S_e_t() const │ │ │ │ │ +1000 { │ │ │ │ │ +1001 return *source_; │ │ │ │ │ +1002 } │ │ │ │ │ +1003 │ │ │ │ │ +1004 │ │ │ │ │ +1005 template │ │ │ │ │ +1006 const typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& │ │ │ │ │ +_1_0_0_7 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_d_e_s_t_i_n_a_t_i_o_n_I_n_d_e_x_S_e_t() const │ │ │ │ │ +1008 { │ │ │ │ │ +1009 return *target_; │ │ │ │ │ +1010 } │ │ │ │ │ +1011 │ │ │ │ │ +1012 │ │ │ │ │ +1013 template │ │ │ │ │ +_1_0_1_4 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_~_R_e_m_o_t_e_I_n_d_i_c_e_s() │ │ │ │ │ +1015 { │ │ │ │ │ +1016 free(); │ │ │ │ │ +1017 } │ │ │ │ │ 1018 │ │ │ │ │ -1019 // We check the following candidate operation │ │ │ │ │ -1020 // │ │ │ │ │ -1021 // vopres = vop1 @ sop2 │ │ │ │ │ -1022 // │ │ │ │ │ -1023 // against the reference operation │ │ │ │ │ -1024 // │ │ │ │ │ -1025 // arefres[l] = aref1[l] @ sref2 foreach l │ │ │ │ │ -1026 // │ │ │ │ │ -1027 // v... variables are simd-vectors, a... variables are arrays, and │ │ │ │ │ -1028 // s... variables are scalars. The operation may modify the left │ │ │ │ │ -1029 // operand, but if is does the modifications needs to happen in both the │ │ │ │ │ -1030 // candidate and the reference. │ │ │ │ │ -1031 // │ │ │ │ │ -1032 // We do the following checks: │ │ │ │ │ -1033 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -1034 // 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ -1035 // 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ -1036 // 4. sop2 is never modified │ │ │ │ │ -1037 // 5. sref2 is never modified │ │ │ │ │ -1038 // │ │ │ │ │ -1039 // In fact, if the property "sref2 is never modified" is violated that │ │ │ │ │ -1040 // means the operation is unsuitable for an automatic broadcast of the │ │ │ │ │ -1041 // second operand and should not be checked. There are no operations in │ │ │ │ │ -1042 // the standard where the second operand is modified like this, but │ │ │ │ │ -1043 // there are operations where the first operand is modified -- and this │ │ │ │ │ -1044 // check is used for those ops as well by exchanging the first and second │ │ │ │ │ -1045 // argument below. │ │ │ │ │ -1046 │ │ │ │ │ -1047 template │ │ │ │ │ -1048 std::enable_if_t > │ │ │ │ │ -1049 checkBinaryOpVS(MetaType, MetaType, Op op) │ │ │ │ │ -1050 { │ │ │ │ │ -1051#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ -1052 static_assert(std::is_same >, │ │ │ │ │ -1053 std::decay_t >::value, │ │ │ │ │ -1054 "Internal testsystem error: called with a scalar that " │ │ │ │ │ -1055 "does not match the vector type."); │ │ │ │ │ -1056 │ │ │ │ │ -1057 // initial values │ │ │ │ │ -1058 auto sinit2 = rightScalar>(); │ │ │ │ │ +1019 template │ │ │ │ │ +1020 template │ │ │ │ │ +_1_0_2_1 inline void _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_p_a_c_k_E_n_t_r_i_e_s │ │ │ │ │ +(_I_n_d_e_x_P_a_i_r_<_G_l_o_b_a_l_I_n_d_e_x_,_L_o_c_a_l_I_n_d_e_x_>** pairs, │ │ │ │ │ +1022 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ +1023 char* p_out, MPI_Datatype type, │ │ │ │ │ +1024 int bufferSize, │ │ │ │ │ +1025 int *position, │ │ │ │ │ +1026 [[maybe_unused]] int n) │ │ │ │ │ +1027 { │ │ │ │ │ +1028 // fill with own indices │ │ │ │ │ +1029 const auto end = indexSet._e_n_d(); │ │ │ │ │ +1030 │ │ │ │ │ +1031 //Now pack the source indices │ │ │ │ │ +1032 int i=0; │ │ │ │ │ +1033 for(auto index = indexSet.begin(); index != end; ++index) │ │ │ │ │ +1034 if(ignorePublic || index->local().isPublic()) { │ │ │ │ │ +1035 │ │ │ │ │ +1036 MPI_Pack(const_cast<_P_a_i_r_T_y_p_e*>(&(*index)), 1, │ │ │ │ │ +1037 type, │ │ │ │ │ +1038 p_out, bufferSize, position, comm_); │ │ │ │ │ +1039 pairs[i++] = const_cast<_P_a_i_r_T_y_p_e*>(&(*index)); │ │ │ │ │ +1040 │ │ │ │ │ +1041 } │ │ │ │ │ +1042 assert(i==n); │ │ │ │ │ +1043 } │ │ │ │ │ +1044 │ │ │ │ │ +1045 template │ │ │ │ │ +1046 inline int _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_n_o_P_u_b_l_i_c(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet) │ │ │ │ │ +1047 { │ │ │ │ │ +1048 │ │ │ │ │ +1049 int noPublic=0; │ │ │ │ │ +1050 │ │ │ │ │ +1051 const auto end=indexSet._e_n_d(); │ │ │ │ │ +1052 for(auto index=indexSet._b_e_g_i_n(); index!=end; ++index) │ │ │ │ │ +1053 if(index->local().isPublic()) │ │ │ │ │ +1054 noPublic++; │ │ │ │ │ +1055 │ │ │ │ │ +1056 return noPublic; │ │ │ │ │ +1057 │ │ │ │ │ +1058 } │ │ │ │ │ 1059 │ │ │ │ │ -1060 // reference arguments │ │ │ │ │ -1061 auto vref1 = leftVector>(); │ │ │ │ │ -1062 auto sref2 = sinit2; │ │ │ │ │ -1063 │ │ │ │ │ -1064 // candidate arguments │ │ │ │ │ -1065 auto vop1 = vref1; │ │ │ │ │ -1066 auto sop2 = sref2; │ │ │ │ │ -1067 │ │ │ │ │ -1068 // candidate operation │ │ │ │ │ -1069 auto &&vopres = op(static_cast(vop1), static_cast(sop2)); │ │ │ │ │ -1070 using VR = decltype(vopres); │ │ │ │ │ -1071 │ │ │ │ │ -1072 // check 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -1073 static_assert(lanes >() == _l_a_n_e_s >(), │ │ │ │ │ -1074 "The result must have the same number of lanes as the " │ │ │ │ │ -1075 "operands."); │ │ │ │ │ -1076 │ │ │ │ │ -1077 // check 4. sop2 is never modified │ │ │ │ │ -1078 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(sop2 == sinit2); │ │ │ │ │ +1060 │ │ │ │ │ +1061 template │ │ │ │ │ +1062 inline void RemoteIndices::unpackCreateRemote(char* p_in, PairType** │ │ │ │ │ +sourcePairs, │ │ │ │ │ +1063 PairType** destPairs, int remoteProc, │ │ │ │ │ +1064 int sourcePublish, int destPublish, │ │ │ │ │ +1065 int bufferSize, bool sendTwo, │ │ │ │ │ +1066 bool fromOurSelf) │ │ │ │ │ +1067 { │ │ │ │ │ +1068 │ │ │ │ │ +1069 // unpack the number of indices we received │ │ │ │ │ +1070 int noRemoteSource=-1, noRemoteDest=-1; │ │ │ │ │ +1071 char twoIndexSets=0; │ │ │ │ │ +1072 int position=0; │ │ │ │ │ +1073 // Did we receive two index sets? │ │ │ │ │ +1074 MPI_Unpack(p_in, bufferSize, &position, &twoIndexSets, 1, MPI_CHAR, │ │ │ │ │ +comm_); │ │ │ │ │ +1075 // The number of source indices received │ │ │ │ │ +1076 MPI_Unpack(p_in, bufferSize, &position, &noRemoteSource, 1, MPI_INT, │ │ │ │ │ +comm_); │ │ │ │ │ +1077 // The number of destination indices received │ │ │ │ │ +1078 MPI_Unpack(p_in, bufferSize, &position, &noRemoteDest, 1, MPI_INT, comm_); │ │ │ │ │ 1079 │ │ │ │ │ -1080 // do the reference operation, and simultaneously check 2. and 5. │ │ │ │ │ -1081 using T = _S_c_a_l_a_r >; │ │ │ │ │ -1082 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vopres))) │ │ │ │ │ -1083 { │ │ │ │ │ -1084 // check 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ -1085 // see the lengthy comment in `checkUnaryOpV()` as to why the │ │ │ │ │ -1086 // `static_cast` around the `op()` is necessary │ │ │ │ │ -1087 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ -1088 (_l_a_n_e(l, vopres) │ │ │ │ │ -1089 == static_cast(op(_l_a_n_e(l, static_cast(vref1)), │ │ │ │ │ -1090 static_cast(sref2) ))); │ │ │ │ │ -1091 // check 5. sref2 is never modified │ │ │ │ │ -1092 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(sref2 == sinit2); │ │ │ │ │ -1093 } │ │ │ │ │ -1094 │ │ │ │ │ -1095 // check 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ -1096 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop1))) │ │ │ │ │ -1097 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop1) == _l_a_n_e(l, vref1)); │ │ │ │ │ -1098 │ │ │ │ │ -1099#undef DUNE_SIMD_OPNAME │ │ │ │ │ -1100 } │ │ │ │ │ +1080 │ │ │ │ │ +1081 // Indices for which we receive │ │ │ │ │ +1082 RemoteIndexList* receive= new RemoteIndexList(); │ │ │ │ │ +1083 // Indices for which we send │ │ │ │ │ +1084 RemoteIndexList* send=0; │ │ │ │ │ +1085 │ │ │ │ │ +1086 MPI_Datatype type= _M_P_I_T_r_a_i_t_s_<_P_a_i_r_T_y_p_e_>_:_:_g_e_t_T_y_p_e(); │ │ │ │ │ +1087 │ │ │ │ │ +1088 if(!twoIndexSets) { │ │ │ │ │ +1089 if(sendTwo) { │ │ │ │ │ +1090 send = new RemoteIndexList(); │ │ │ │ │ +1091 // Create both remote index sets simultaneously │ │ │ │ │ +1092 unpackIndices(*send, *receive, noRemoteSource, sourcePairs, sourcePublish, │ │ │ │ │ +1093 destPairs, destPublish, p_in, type, &position, bufferSize); │ │ │ │ │ +1094 }else{ │ │ │ │ │ +1095 // we only need one list │ │ │ │ │ +1096 unpackIndices(*receive, noRemoteSource, sourcePairs, sourcePublish, │ │ │ │ │ +1097 p_in, type, &position, bufferSize, fromOurSelf); │ │ │ │ │ +1098 send=receive; │ │ │ │ │ +1099 } │ │ │ │ │ +1100 }else{ │ │ │ │ │ 1101 │ │ │ │ │ -1102 template │ │ │ │ │ -1103 std::enable_if_t > │ │ │ │ │ -1104 checkBinaryOpVS(MetaType, MetaType, Op op) │ │ │ │ │ -1105 { │ │ │ │ │ -1106 // log_ << "No " │ │ │ │ │ -1107 // << className())), T2)>() │ │ │ │ │ -1108 // << std::endl │ │ │ │ │ -1109 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ -1110 } │ │ │ │ │ -1111 │ │ │ │ │ -1112 template │ │ │ │ │ -1113 void checkBinaryOpVS(MetaType, MetaType, OpInfixComma) │ │ │ │ │ -1114 { │ │ │ │ │ -1115 static_assert(std::is_same >, │ │ │ │ │ -1116 std::decay_t >::value, │ │ │ │ │ -1117 "Internal testsystem error: called with a scalar that " │ │ │ │ │ -1118 "does not match the vector type."); │ │ │ │ │ -1119 │ │ │ │ │ -1120 checkCommaOp(leftVector>(), │ │ │ │ │ -1121 rightScalar>()); │ │ │ │ │ -1122 } │ │ │ │ │ -1123 │ │ │ │ │ -1125 // │ │ │ │ │ -1126 // cross-check scalar-vector binary operations against vector-vector │ │ │ │ │ -1127 // │ │ │ │ │ +1102 int oldPos=position; │ │ │ │ │ +1103 // Two index sets received │ │ │ │ │ +1104 unpackIndices(*receive, noRemoteSource, destPairs, destPublish, │ │ │ │ │ +1105 p_in, type, &position, bufferSize, fromOurSelf); │ │ │ │ │ +1106 if(!sendTwo) │ │ │ │ │ +1107 //unpack source entries again as destination entries │ │ │ │ │ +1108 position=oldPos; │ │ │ │ │ +1109 │ │ │ │ │ +1110 send = new RemoteIndexList(); │ │ │ │ │ +1111 unpackIndices(*send, noRemoteDest, sourcePairs, sourcePublish, │ │ │ │ │ +1112 p_in, type, &position, bufferSize, fromOurSelf); │ │ │ │ │ +1113 } │ │ │ │ │ +1114 │ │ │ │ │ +1115 if(receive->empty() && send->empty()) { │ │ │ │ │ +1116 if(send==receive) { │ │ │ │ │ +1117 delete send; │ │ │ │ │ +1118 }else{ │ │ │ │ │ +1119 delete send; │ │ │ │ │ +1120 delete receive; │ │ │ │ │ +1121 } │ │ │ │ │ +1122 }else{ │ │ │ │ │ +1123 remoteIndices_.insert(std::make_pair(remoteProc, │ │ │ │ │ +1124 std::make_pair(send,receive))); │ │ │ │ │ +1125 } │ │ │ │ │ +1126 } │ │ │ │ │ +1127 │ │ │ │ │ 1128 │ │ │ │ │ -1129 // We check the following candidate operation │ │ │ │ │ -1130 // │ │ │ │ │ -1131 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2) │ │ │ │ │ -1132 // │ │ │ │ │ -1133 // against the reference operation │ │ │ │ │ -1134 // │ │ │ │ │ -1135 // vrefres = vref1 @ sref2 │ │ │ │ │ -1136 // │ │ │ │ │ -1137 // v... variables are simd-vectors, a... variables are arrays, and │ │ │ │ │ -1138 // s... variables are scalars. │ │ │ │ │ -1139 // │ │ │ │ │ -1140 // We could check the following properties │ │ │ │ │ -1141 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -1142 // 2. lane(l, vopres) == lane(l, vrefres) foreach l │ │ │ │ │ -1143 // 3. lane(l, vop1) == lane(l, vref1) foreach l │ │ │ │ │ -1144 // but these are given by checking the operation against the scalar │ │ │ │ │ -1145 // operation in the vector@vector and vector@scalar cases above. │ │ │ │ │ -1146 // │ │ │ │ │ -1147 // The only thing left to check is: │ │ │ │ │ -1148 // 4. lane(l, vop2) foreach l is never modified │ │ │ │ │ -1149 │ │ │ │ │ -1150 template │ │ │ │ │ -1151 std::enable_if_t > │ │ │ │ │ -1152 checkBinaryOpVVAgainstVS(MetaType, MetaType, Op op) │ │ │ │ │ -1153 { │ │ │ │ │ -1154#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ -1155 static_assert(std::is_same >, │ │ │ │ │ -1156 std::decay_t >::value, │ │ │ │ │ -1157 "Internal testsystem error: called with a scalar that " │ │ │ │ │ -1158 "does not match the vector type."); │ │ │ │ │ -1159 │ │ │ │ │ -1160 // initial values │ │ │ │ │ -1161 auto sinit2 = rightScalar>(); │ │ │ │ │ -1162 │ │ │ │ │ -1163 // reference arguments │ │ │ │ │ -1164 auto vop1 = leftVector>(); │ │ │ │ │ -1165 using V2 = CopyRefQual; │ │ │ │ │ -1166 std::decay_t vop2(sinit2); │ │ │ │ │ -1167 │ │ │ │ │ -1168 // candidate operation │ │ │ │ │ -1169 op(static_cast(vop1), static_cast(vop2)); │ │ │ │ │ +1129 template │ │ │ │ │ +1130 template │ │ │ │ │ +1131 inline void RemoteIndices::buildRemote(bool includeSelf_) │ │ │ │ │ +1132 { │ │ │ │ │ +1133 // Processor configuration │ │ │ │ │ +1134 int rank, procs; │ │ │ │ │ +1135 MPI_Comm_rank(comm_, &rank); │ │ │ │ │ +1136 MPI_Comm_size(comm_, &procs); │ │ │ │ │ +1137 │ │ │ │ │ +1138 // number of local indices to publish │ │ │ │ │ +1139 // The indices of the destination will be send. │ │ │ │ │ +1140 int sourcePublish, destPublish; │ │ │ │ │ +1141 │ │ │ │ │ +1142 // Do we need to send two index sets? │ │ │ │ │ +1143 char sendTwo = (source_ != target_); │ │ │ │ │ +1144 │ │ │ │ │ +1145 if(procs==1 && !(sendTwo || includeSelf_)) │ │ │ │ │ +1146 // Nothing to communicate │ │ │ │ │ +1147 return; │ │ │ │ │ +1148 │ │ │ │ │ +1149 sourcePublish = (ignorePublic) ? source_->size() : noPublic(*source_); │ │ │ │ │ +1150 │ │ │ │ │ +1151 if(sendTwo) │ │ │ │ │ +1152 destPublish = (ignorePublic) ? target_->size() : noPublic(*target_); │ │ │ │ │ +1153 else │ │ │ │ │ +1154 // we only need to send one set of indices │ │ │ │ │ +1155 destPublish = 0; │ │ │ │ │ +1156 │ │ │ │ │ +1157 int maxPublish, publish=sourcePublish+destPublish; │ │ │ │ │ +1158 │ │ │ │ │ +1159 // Calculate maximum number of indices send │ │ │ │ │ +1160 MPI_Allreduce(&publish, &maxPublish, 1, MPI_INT, MPI_MAX, comm_); │ │ │ │ │ +1161 │ │ │ │ │ +1162 // allocate buffers │ │ │ │ │ +1163 PairType** destPairs; │ │ │ │ │ +1164 PairType** sourcePairs = new PairType*[sourcePublish>0 ? sourcePublish : │ │ │ │ │ +1]; │ │ │ │ │ +1165 │ │ │ │ │ +1166 if(sendTwo) │ │ │ │ │ +1167 destPairs = new PairType*[destPublish>0 ? destPublish : 1]; │ │ │ │ │ +1168 else │ │ │ │ │ +1169 destPairs=sourcePairs; │ │ │ │ │ 1170 │ │ │ │ │ -1171 // 4. lane(l, vop2) foreach l is never modified │ │ │ │ │ -1172 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop2))) │ │ │ │ │ -1173 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop2) == sinit2); │ │ │ │ │ -1174 │ │ │ │ │ -1175#undef DUNE_SIMD_OPNAME │ │ │ │ │ -1176 } │ │ │ │ │ -1177 │ │ │ │ │ -1178 template │ │ │ │ │ -1179 std::enable_if_t > │ │ │ │ │ -1180 checkBinaryOpVVAgainstVS(MetaType, MetaType, Op op) │ │ │ │ │ -1181 { │ │ │ │ │ -1182 // log_ << "No " │ │ │ │ │ -1183 // << className())), T2)>() │ │ │ │ │ -1184 // << std::endl │ │ │ │ │ -1185 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ -1186 } │ │ │ │ │ -1187 │ │ │ │ │ -1188 template │ │ │ │ │ -1189 void checkBinaryOpVVAgainstVS(MetaType, MetaType, OpInfixComma) │ │ │ │ │ -1190 { } │ │ │ │ │ +1171 char** buffer = new char*[2]; │ │ │ │ │ +1172 int bufferSize; │ │ │ │ │ +1173 int position=0; │ │ │ │ │ +1174 int intSize; │ │ │ │ │ +1175 int charSize; │ │ │ │ │ +1176 │ │ │ │ │ +1177 // calculate buffer size │ │ │ │ │ +1178 MPI_Datatype type = _M_P_I_T_r_a_i_t_s_<_P_a_i_r_T_y_p_e_>_:_:_g_e_t_T_y_p_e(); │ │ │ │ │ +1179 │ │ │ │ │ +1180 MPI_Pack_size(maxPublish, type, comm_, │ │ │ │ │ +1181 &bufferSize); │ │ │ │ │ +1182 MPI_Pack_size(1, MPI_INT, comm_, │ │ │ │ │ +1183 &intSize); │ │ │ │ │ +1184 MPI_Pack_size(1, MPI_CHAR, comm_, │ │ │ │ │ +1185 &charSize); │ │ │ │ │ +1186 // Our message will contain the following: │ │ │ │ │ +1187 // a bool whether two index sets where sent │ │ │ │ │ +1188 // the size of the source and the dest indexset, │ │ │ │ │ +1189 // then the source and destination indices │ │ │ │ │ +1190 bufferSize += 2 * intSize + charSize; │ │ │ │ │ 1191 │ │ │ │ │ -1193 // │ │ │ │ │ -1194 // checks for vector-proxy binary operations │ │ │ │ │ -1195 // │ │ │ │ │ +1192 if(bufferSize<=0) bufferSize=1; │ │ │ │ │ +1193 │ │ │ │ │ +1194 buffer[0] = new char[bufferSize]; │ │ │ │ │ +1195 buffer[1] = new char[bufferSize]; │ │ │ │ │ 1196 │ │ │ │ │ -1197 // We check the following candidate operation │ │ │ │ │ -1198 // │ │ │ │ │ -1199 // vopres = vop1 @ pop2 │ │ │ │ │ -1200 // │ │ │ │ │ -1201 // against the reference operation │ │ │ │ │ -1202 // │ │ │ │ │ -1203 // arefres[l] = aref1[l] @ sref2 foreach l │ │ │ │ │ -1204 // │ │ │ │ │ -1205 // v... variables are simd-vectors, a... variables are arrays, │ │ │ │ │ -1206 // p... variables are proxies of simd-vector entries and s... variables │ │ │ │ │ -1207 // are scalars. The operation may modify the left operand, but if is │ │ │ │ │ -1208 // does the modifications needs to happen in both the candidate and the │ │ │ │ │ -1209 // reference. │ │ │ │ │ -1210 // │ │ │ │ │ -1211 // We do the following checks: │ │ │ │ │ -1212 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -1213 // 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ -1214 // 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ -1215 // 4. pop2 is never modified │ │ │ │ │ -1216 // 5. sref2 is never modified │ │ │ │ │ -1217 // │ │ │ │ │ -1218 // In fact, if the property "sref2 is never modified" is violated that │ │ │ │ │ -1219 // means the operation is unsuitable for an automatic broadcast of the │ │ │ │ │ -1220 // second operand and should not be checked. There are no operations in │ │ │ │ │ -1221 // the standard where the second operand is modified like this, but │ │ │ │ │ -1222 // there are operations where the first operand is modified -- and this │ │ │ │ │ -1223 // check is used for those ops as well by exchanging the first and second │ │ │ │ │ -1224 // argument below. │ │ │ │ │ -1225 │ │ │ │ │ -1226 template │ │ │ │ │ -1227 std::enable_if_t > │ │ │ │ │ -1228 checkBinaryOpVP(MetaType, MetaType, Op op) │ │ │ │ │ -1229 { │ │ │ │ │ -1230 using P2 = decltype(_l_a_n_e(0, std::declval())); │ │ │ │ │ -1231 using T2 = CopyRefQual, V2>; │ │ │ │ │ -1232#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ -1233 static_assert(std::is_same, Scalar >::value, │ │ │ │ │ -1234 "Internal testsystem error: called with two vector " │ │ │ │ │ -1235 "types whose scalar types don't match."); │ │ │ │ │ -1236 │ │ │ │ │ -1237 // initial values │ │ │ │ │ -1238 auto sinit2 = rightScalar>(); │ │ │ │ │ -1239 │ │ │ │ │ -1240 // reference arguments │ │ │ │ │ -1241 auto vref1 = leftVector>(); │ │ │ │ │ -1242 auto sref2 = sinit2; │ │ │ │ │ -1243 │ │ │ │ │ -1244 // candidate arguments │ │ │ │ │ -1245 auto vop1 = vref1; │ │ │ │ │ -1246 auto vop2 = std::decay_t(Scalar(0)); │ │ │ │ │ -1247 _l_a_n_e(0, vop2) = sref2; // pop2 is just a name for `lane(0, vop2)` │ │ │ │ │ -1248 │ │ │ │ │ -1249 // candidate operation │ │ │ │ │ -1250 auto &&vopres = │ │ │ │ │ -1251 op(static_cast(vop1), _l_a_n_e(0, static_cast(vop2))); │ │ │ │ │ -1252 using VR = decltype(vopres); │ │ │ │ │ -1253 │ │ │ │ │ -1254 // check 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -1255 static_assert(lanes >() == _l_a_n_e_s >(), │ │ │ │ │ -1256 "The result must have the same number of lanes as the " │ │ │ │ │ -1257 "operands."); │ │ │ │ │ -1258 │ │ │ │ │ -1259 // check 4. pop2 is never modified │ │ │ │ │ -1260 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(0, vop2) == sinit2); │ │ │ │ │ -1261 │ │ │ │ │ -1262 // do the reference operation, and simultaneously check 2. and 5. │ │ │ │ │ -1263 using T = _S_c_a_l_a_r; │ │ │ │ │ -1264 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vopres))) │ │ │ │ │ -1265 { │ │ │ │ │ -1266 // check 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ -1267 // see the lengthy comment in `checkUnaryOpV()` as to why the │ │ │ │ │ -1268 // `static_cast` around the `op()` is necessary │ │ │ │ │ -1269 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ -1270 (_l_a_n_e(l, vopres) │ │ │ │ │ -1271 == static_cast(op(_l_a_n_e(l, static_cast(vref1)), │ │ │ │ │ -1272 static_cast(sref2) ))); │ │ │ │ │ -1273 // check 5. sref2 is never modified │ │ │ │ │ -1274 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(sref2 == sinit2); │ │ │ │ │ -1275 } │ │ │ │ │ -1276 │ │ │ │ │ -1277 // check 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ -1278 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop1))) │ │ │ │ │ -1279 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop1) == _l_a_n_e(l, vref1)); │ │ │ │ │ -1280 │ │ │ │ │ -1281#undef DUNE_SIMD_OPNAME │ │ │ │ │ -1282 } │ │ │ │ │ -1283 │ │ │ │ │ -1284 template │ │ │ │ │ -1285 std::enable_if_t > │ │ │ │ │ -1286 checkBinaryOpVP(MetaType, MetaType, Op op) │ │ │ │ │ -1287 { │ │ │ │ │ -1288 // log_ << "No " │ │ │ │ │ -1289 // << className())), T2)>() │ │ │ │ │ -1290 // << std::endl │ │ │ │ │ -1291 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ -1292 } │ │ │ │ │ -1293 │ │ │ │ │ -1294 template │ │ │ │ │ -1295 void checkBinaryOpVP(MetaType, MetaType, OpInfixComma) │ │ │ │ │ -1296 { │ │ │ │ │ -1297 // Don't really know how to check comma operator for proxies │ │ │ │ │ -1298 } │ │ │ │ │ -1299 │ │ │ │ │ -1301 // │ │ │ │ │ -1302 // checks for (scalar/proxy)-vector binary operations │ │ │ │ │ -1303 // │ │ │ │ │ -1304 │ │ │ │ │ -1305 template │ │ │ │ │ -1306 struct OpInfixSwappedArgs │ │ │ │ │ -1307 { │ │ │ │ │ -1308 Op orig; │ │ │ │ │ -1309 │ │ │ │ │ -1310 template │ │ │ │ │ -1311 decltype(auto) operator()(V1&& v1, V2&& v2) const │ │ │ │ │ -1312 { │ │ │ │ │ -1313 return orig(std::forward(v2), std::forward(v1)); │ │ │ │ │ -1314 } │ │ │ │ │ -1315 template │ │ │ │ │ -1316 auto scalar(S1&& s1, S2&& s2) const │ │ │ │ │ -1317 -> decltype(orig.scalar(std::forward(s2), std::forward(s1))); │ │ │ │ │ -1318 }; │ │ │ │ │ -1319 │ │ │ │ │ -1320 template │ │ │ │ │ -1321 void checkBinaryOpSV(MetaType t1, MetaType v2, Op op) │ │ │ │ │ -1322 { │ │ │ │ │ -1323 checkBinaryOpVS(v2, t1, OpInfixSwappedArgs{op}); │ │ │ │ │ -1324 } │ │ │ │ │ -1325 │ │ │ │ │ -1326 template │ │ │ │ │ -1327 void checkBinaryOpSV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ -1328 { │ │ │ │ │ -1329 static_assert(std::is_same, │ │ │ │ │ -1330 Scalar > >::value, │ │ │ │ │ -1331 "Internal testsystem error: called with a scalar that " │ │ │ │ │ -1332 "does not match the vector type."); │ │ │ │ │ -1333 │ │ │ │ │ -1334 checkCommaOp(leftScalar>(), │ │ │ │ │ -1335 rightVector>()); │ │ │ │ │ -1336 } │ │ │ │ │ +1197 │ │ │ │ │ +1198 // pack entries into buffer[0], p_out below! │ │ │ │ │ +1199 MPI_Pack(&sendTwo, 1, MPI_CHAR, buffer[0], bufferSize, &position, │ │ │ │ │ +1200 comm_); │ │ │ │ │ +1201 │ │ │ │ │ +1202 // The number of indices we send for each index set │ │ │ │ │ +1203 MPI_Pack(&sourcePublish, 1, MPI_INT, buffer[0], bufferSize, &position, │ │ │ │ │ +1204 comm_); │ │ │ │ │ +1205 MPI_Pack(&destPublish, 1, MPI_INT, buffer[0], bufferSize, &position, │ │ │ │ │ +1206 comm_); │ │ │ │ │ +1207 │ │ │ │ │ +1208 // Now pack the source indices and setup the destination pairs │ │ │ │ │ +1209 packEntries(sourcePairs, *source_, buffer[0], type, │ │ │ │ │ +1210 bufferSize, &position, sourcePublish); │ │ │ │ │ +1211 // If necessary send the dest indices and setup the source pairs │ │ │ │ │ +1212 if(sendTwo) │ │ │ │ │ +1213 packEntries(destPairs, *target_, buffer[0], type, │ │ │ │ │ +1214 bufferSize, &position, destPublish); │ │ │ │ │ +1215 │ │ │ │ │ +1216 │ │ │ │ │ +1217 // Update remote indices for ourself │ │ │ │ │ +1218 if(sendTwo|| includeSelf_) │ │ │ │ │ +1219 unpackCreateRemote(buffer[0], sourcePairs, destPairs, rank, sourcePublish, │ │ │ │ │ +1220 destPublish, bufferSize, sendTwo, includeSelf_); │ │ │ │ │ +1221 │ │ │ │ │ +1222 neighbourIds.erase(rank); │ │ │ │ │ +1223 │ │ │ │ │ +1224 if(neighbourIds.size()==0) │ │ │ │ │ +1225 { │ │ │ │ │ +1226 _D_u_n_e_:_:_d_v_v_e_r_b<::size_type size_type; │ │ │ │ │ +1262 size_type noNeighbours=neighbourIds.size(); │ │ │ │ │ +1263 │ │ │ │ │ +1264 // setup sends │ │ │ │ │ +1265 for(std::set::iterator neighbour=neighbourIds.begin(); │ │ │ │ │ +1266 neighbour!= neighbourIds.end(); ++neighbour) { │ │ │ │ │ +1267 // Only send the information to the neighbouring processors │ │ │ │ │ +1268 MPI_Issend(buffer[0], position , MPI_PACKED, *neighbour, commTag_, comm_, │ │ │ │ │ +req++); │ │ │ │ │ +1269 } │ │ │ │ │ +1270 │ │ │ │ │ +1271 //Test for received messages │ │ │ │ │ +1272 │ │ │ │ │ +1273 for(size_type received=0; received │ │ │ │ │ +1314 inline void RemoteIndices::unpackIndices(RemoteIndexList& remote, │ │ │ │ │ +1315 int remoteEntries, │ │ │ │ │ +1316 PairType** local, │ │ │ │ │ +1317 int localEntries, │ │ │ │ │ +1318 char* p_in, │ │ │ │ │ +1319 MPI_Datatype type, │ │ │ │ │ +1320 int* position, │ │ │ │ │ +1321 int bufferSize, │ │ │ │ │ +1322 bool fromOurSelf) │ │ │ │ │ +1323 { │ │ │ │ │ +1324 if(remoteEntries==0) │ │ │ │ │ +1325 return; │ │ │ │ │ +1326 │ │ │ │ │ +1327 PairType index; │ │ │ │ │ +1328 MPI_Unpack(p_in, bufferSize, position, &index, 1, │ │ │ │ │ +1329 type, comm_); │ │ │ │ │ +1330 GlobalIndex oldGlobal=index.global(); │ │ │ │ │ +1331 int n_in=0, localIndex=0; │ │ │ │ │ +1332 │ │ │ │ │ +1333 //Check if we know the global index │ │ │ │ │ +1334 while(localIndexglobal()==index.global()) { │ │ │ │ │ +1336 int oldLocalIndex=localIndex; │ │ │ │ │ 1337 │ │ │ │ │ -1338 template │ │ │ │ │ -1339 void checkBinaryOpPV(MetaType v1, MetaType v2, Op op) │ │ │ │ │ -1340 { │ │ │ │ │ -1341 checkBinaryOpVP(v2, v1, OpInfixSwappedArgs{op}); │ │ │ │ │ -1342 } │ │ │ │ │ -1343 │ │ │ │ │ -1344 template │ │ │ │ │ -1345 void checkBinaryOpPV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ -1346 { │ │ │ │ │ -1347 // Don't really know how to check comma operator for proxies │ │ │ │ │ -1348 } │ │ │ │ │ -1349 │ │ │ │ │ -1351 // │ │ │ │ │ -1352 // cross-check scalar-vector binary operations against vector-vector │ │ │ │ │ -1353 // │ │ │ │ │ -1354 │ │ │ │ │ -1355 // We check the following candidate operation │ │ │ │ │ -1356 // │ │ │ │ │ -1357 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2) │ │ │ │ │ -1358 // │ │ │ │ │ -1359 // against the reference operation │ │ │ │ │ -1360 // │ │ │ │ │ -1361 // vrefres = vref1 @ sref2 │ │ │ │ │ -1362 // │ │ │ │ │ -1363 // v... variables are simd-vectors, a... variables are arrays, and │ │ │ │ │ -1364 // s... variables are scalars. │ │ │ │ │ -1365 // │ │ │ │ │ -1366 // We could check the following properties │ │ │ │ │ -1367 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ -1368 // 2. lane(l, vopres) == lane(l, vrefres) foreach l │ │ │ │ │ -1369 // 3. lane(l, vop1) == lane(l, vref1) foreach l │ │ │ │ │ -1370 // but these are given by checking the operation against the scalar │ │ │ │ │ -1371 // operation in the vector@vector and vector@scalar cases above. │ │ │ │ │ -1372 // │ │ │ │ │ -1373 // The only thing left to check is: │ │ │ │ │ -1374 // 4. lane(l, vop2) foreach l is never modified │ │ │ │ │ -1375 │ │ │ │ │ -1376 template │ │ │ │ │ -1377 void checkBinaryOpVVAgainstSV(MetaType t1, MetaType v2, Op op) │ │ │ │ │ -1378 { │ │ │ │ │ -1379 checkBinaryOpVVAgainstVS(v2, t1, OpInfixSwappedArgs{op}); │ │ │ │ │ -1380 } │ │ │ │ │ -1381 │ │ │ │ │ -1382 template │ │ │ │ │ -1383 void checkBinaryOpVVAgainstSV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ -1384 { } │ │ │ │ │ +1338 while(localIndexglobal()==index.global()) { │ │ │ │ │ +1340 if(!fromOurSelf || index.local().attribute() != │ │ │ │ │ +1341 local[localIndex]->local().attribute()) │ │ │ │ │ +1342 // if index is from us it has to have a different attribute │ │ │ │ │ +1343 remote.push_back(RemoteIndex(index.local().attribute(), │ │ │ │ │ +1344 local[localIndex])); │ │ │ │ │ +1345 localIndex++; │ │ │ │ │ +1346 } │ │ │ │ │ +1347 │ │ │ │ │ +1348 // unpack next remote index │ │ │ │ │ +1349 if((++n_in) < remoteEntries) { │ │ │ │ │ +1350 MPI_Unpack(p_in, bufferSize, position, &index, 1, │ │ │ │ │ +1351 type, comm_); │ │ │ │ │ +1352 if(index.global()==oldGlobal) │ │ │ │ │ +1353 // Restart comparison for the same global indices │ │ │ │ │ +1354 localIndex=oldLocalIndex; │ │ │ │ │ +1355 else │ │ │ │ │ +1356 oldGlobal=index.global(); │ │ │ │ │ +1357 }else{ │ │ │ │ │ +1358 // No more received indices │ │ │ │ │ +1359 break; │ │ │ │ │ +1360 } │ │ │ │ │ +1361 continue; │ │ │ │ │ +1362 } │ │ │ │ │ +1363 │ │ │ │ │ +1364 if (local[localIndex]->global() │ │ │ │ │ -1392 void checkBinaryRefQual(Checker checker) │ │ │ │ │ -1393 { │ │ │ │ │ -1394 if constexpr (condition) { │ │ │ │ │ -1395 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(TypeList{}, [=] (auto t1) { │ │ │ │ │ -1396 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(TypeList{}, [=] (auto t2) { │ │ │ │ │ -1397 checker(t1, t2); │ │ │ │ │ -1398 }); │ │ │ │ │ -1399 }); │ │ │ │ │ -1400 } │ │ │ │ │ -1401 } │ │ │ │ │ -1402 │ │ │ │ │ -1403 template │ │ │ │ │ -1404 void _c_h_e_c_k_B_i_n_a_r_y_O_p_s(Checker checker) │ │ │ │ │ -1405 { │ │ │ │ │ -1406 using Std::bool_constant; │ │ │ │ │ -1407 │ │ │ │ │ -1408 constexpr bool isMask = std::is_same, bool>::value; │ │ │ │ │ -1409 │ │ │ │ │ -1410 constexpr bool do_ = false; │ │ │ │ │ -1411 constexpr bool do_SV = true; │ │ │ │ │ -1412 constexpr bool do_VV = true; │ │ │ │ │ -1413 constexpr bool do_VS = true; │ │ │ │ │ -1414 │ │ │ │ │ -1415#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME) \ │ │ │ │ │ -1416 checker(bool_constant{}, \ │ │ │ │ │ -1417 bool_constant{}, \ │ │ │ │ │ -1418 bool_constant{}, \ │ │ │ │ │ -1419 Op##NAME{}) │ │ │ │ │ +1386 template │ │ │ │ │ +1387 inline void RemoteIndices::unpackIndices(RemoteIndexList& send, │ │ │ │ │ +1388 RemoteIndexList& receive, │ │ │ │ │ +1389 int remoteEntries, │ │ │ │ │ +1390 PairType** localSource, │ │ │ │ │ +1391 int localSourceEntries, │ │ │ │ │ +1392 PairType** localDest, │ │ │ │ │ +1393 int localDestEntries, │ │ │ │ │ +1394 char* p_in, │ │ │ │ │ +1395 MPI_Datatype type, │ │ │ │ │ +1396 int* position, │ │ │ │ │ +1397 int bufferSize) │ │ │ │ │ +1398 { │ │ │ │ │ +1399 int n_in=0, sourceIndex=0, destIndex=0; │ │ │ │ │ +1400 │ │ │ │ │ +1401 //Check if we know the global index │ │ │ │ │ +1402 while(n_in= than the │ │ │ │ │ +one in the unpacked index │ │ │ │ │ +1410 while(sourceIndexglobal │ │ │ │ │ +()global │ │ │ │ │ +()global │ │ │ │ │ +()==index.global()) │ │ │ │ │ +1418 send.push_back(RemoteIndex(index.local().attribute(), │ │ │ │ │ +1419 localSource[sourceIndex])); │ │ │ │ │ 1420 │ │ │ │ │ -1421 // (Mask , Vector , Name ); │ │ │ │ │ -1422 │ │ │ │ │ -1423 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixMul ); │ │ │ │ │ -1424 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixDiv ); │ │ │ │ │ -1425 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixRemainder ); │ │ │ │ │ -1426 │ │ │ │ │ -1427 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixPlus ); │ │ │ │ │ -1428 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixMinus ); │ │ │ │ │ -1429 │ │ │ │ │ -1430 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixLeftShift ); │ │ │ │ │ -1431 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixRightShift ); │ │ │ │ │ -1432 │ │ │ │ │ -1433 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixLess ); │ │ │ │ │ -1434 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixGreater ); │ │ │ │ │ -1435 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixLessEqual ); │ │ │ │ │ -1436 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixGreaterEqual ); │ │ │ │ │ -1437 │ │ │ │ │ -1438 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixEqual ); │ │ │ │ │ -1439 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixNotEqual ); │ │ │ │ │ -1440 │ │ │ │ │ -1441 _D_U_N_E___S_I_M_D___D_O( , VV, , SV, VV, VS, InfixBitAnd ); │ │ │ │ │ -1442 _D_U_N_E___S_I_M_D___D_O( , VV, , SV, VV, VS, InfixBitXor ); │ │ │ │ │ -1443 _D_U_N_E___S_I_M_D___D_O( , VV, , SV, VV, VS, InfixBitOr ); │ │ │ │ │ +1421 if(destIndex < localDestEntries && localDest[destIndex]->global() == │ │ │ │ │ +index.global()) │ │ │ │ │ +1422 receive.push_back(RemoteIndex(index.local().attribute(), │ │ │ │ │ +1423 localDest[sourceIndex])); │ │ │ │ │ +1424 } │ │ │ │ │ +1425 │ │ │ │ │ +1426 } │ │ │ │ │ +1427 │ │ │ │ │ +1428 template │ │ │ │ │ +_1_4_2_9 inline void _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_f_r_e_e() │ │ │ │ │ +1430 { │ │ │ │ │ +1431 auto lend = remoteIndices_.end(); │ │ │ │ │ +1432 for(auto lists=remoteIndices_.begin(); lists != lend; ++lists) { │ │ │ │ │ +1433 if(lists->second.first==lists->second.second) { │ │ │ │ │ +1434 // there is only one remote index list. │ │ │ │ │ +1435 delete lists->second.first; │ │ │ │ │ +1436 }else{ │ │ │ │ │ +1437 delete lists->second.first; │ │ │ │ │ +1438 delete lists->second.second; │ │ │ │ │ +1439 } │ │ │ │ │ +1440 } │ │ │ │ │ +1441 remoteIndices_.clear(); │ │ │ │ │ +1442 firstBuild=true; │ │ │ │ │ +1443 } │ │ │ │ │ 1444 │ │ │ │ │ -1445 _D_U_N_E___S_I_M_D___D_O(SV, VV, VS, SV, VV, VS, InfixLogicAnd ); │ │ │ │ │ -1446 _D_U_N_E___S_I_M_D___D_O(SV, VV, VS, SV, VV, VS, InfixLogicOr ); │ │ │ │ │ -1447 │ │ │ │ │ -1448 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssign ); │ │ │ │ │ -1449 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignMul ); │ │ │ │ │ -1450 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignDiv ); │ │ │ │ │ -1451 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignRemainder ); │ │ │ │ │ -1452 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignPlus ); │ │ │ │ │ -1453 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignMinus ); │ │ │ │ │ -1454 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignLeftShift ); │ │ │ │ │ -1455 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignRightShift); │ │ │ │ │ -1456 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssignAnd ); │ │ │ │ │ -1457 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssignXor ); │ │ │ │ │ -1458 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssignOr ); │ │ │ │ │ -1459 │ │ │ │ │ -1460 _D_U_N_E___S_I_M_D___D_O(SV, VV, VS, SV, , VS, InfixComma ); │ │ │ │ │ -1461 │ │ │ │ │ -1462#undef DUNE_SIMD_DO │ │ │ │ │ -1463 } │ │ │ │ │ -1464 │ │ │ │ │ -1466 // │ │ │ │ │ -1467 // SIMD interface functions │ │ │ │ │ -1468 // │ │ │ │ │ +1445 template │ │ │ │ │ +_1_4_4_6 inline int _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_n_e_i_g_h_b_o_u_r_s() const │ │ │ │ │ +1447 { │ │ │ │ │ +1448 return remoteIndices_.size(); │ │ │ │ │ +1449 } │ │ │ │ │ +1450 │ │ │ │ │ +1451 template │ │ │ │ │ +1452 template │ │ │ │ │ +_1_4_5_3 inline void _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_r_e_b_u_i_l_d() │ │ │ │ │ +1454 { │ │ │ │ │ +1455 // Test whether a rebuild is Needed. │ │ │ │ │ +1456 if(firstBuild || │ │ │ │ │ +1457 ignorePublic!=publicIgnored || ! │ │ │ │ │ +1458 isSynced()) { │ │ │ │ │ +1459 free(); │ │ │ │ │ +1460 │ │ │ │ │ +1461 buildRemote(includeSelf); │ │ │ │ │ +1462 │ │ │ │ │ +1463 sourceSeqNo_ = source_->seqNo(); │ │ │ │ │ +1464 destSeqNo_ = target_->seqNo(); │ │ │ │ │ +1465 firstBuild=false; │ │ │ │ │ +1466 publicIgnored=ignorePublic; │ │ │ │ │ +1467 } │ │ │ │ │ +1468 │ │ │ │ │ 1469 │ │ │ │ │ -1470 template │ │ │ │ │ -1471 void checkAutoCopy() │ │ │ │ │ -1472 { │ │ │ │ │ -1473 using RValueResult = decltype(_a_u_t_o_C_o_p_y(_l_a_n_e(0, std::declval()))); │ │ │ │ │ -1474 static_assert(std::is_same >::value, │ │ │ │ │ -1475 "Result of autoCopy() must always be Scalar"); │ │ │ │ │ -1476 │ │ │ │ │ -1477 using MutableLValueResult = │ │ │ │ │ -1478 decltype(_a_u_t_o_C_o_p_y(_l_a_n_e(0, std::declval()))); │ │ │ │ │ -1479 static_assert(std::is_same >::value, │ │ │ │ │ -1480 "Result of autoCopy() must always be Scalar"); │ │ │ │ │ -1481 │ │ │ │ │ -1482 using ConstLValueResult = │ │ │ │ │ -1483 decltype(_a_u_t_o_C_o_p_y(_l_a_n_e(0, std::declval()))); │ │ │ │ │ -1484 static_assert(std::is_same >::value, │ │ │ │ │ -1485 "Result of autoCopy() must always be Scalar"); │ │ │ │ │ -1486 │ │ │ │ │ -1487 V vec = make123(); │ │ │ │ │ -1488 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ -1489 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_u_t_o_C_o_p_y(_l_a_n_e(l, vec)) == Scalar(l+1)); │ │ │ │ │ -1490 } │ │ │ │ │ -1491 │ │ │ │ │ -1492 // may only be called for mask types │ │ │ │ │ -1493 template │ │ │ │ │ -1494 void checkBoolReductions() │ │ │ │ │ -1495 { │ │ │ │ │ -1496 M trueVec(true); │ │ │ │ │ -1497 │ │ │ │ │ -1498 // mutable lvalue │ │ │ │ │ -1499 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ -1500 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ -1501 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ -1502 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ -1503 │ │ │ │ │ -1504 // const lvalue │ │ │ │ │ -1505 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ -1506 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ -1507 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ -1508 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ -1509 │ │ │ │ │ -1510 // rvalue │ │ │ │ │ -1511 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (M(true)) == true); │ │ │ │ │ -1512 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (M(true)) == true); │ │ │ │ │ -1513 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(M(true)) == false); │ │ │ │ │ -1514 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(M(true)) == false); │ │ │ │ │ -1515 │ │ │ │ │ -1516 M falseVec(false); │ │ │ │ │ -1517 │ │ │ │ │ -1518 // mutable lvalue │ │ │ │ │ -1519 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ -1520 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ -1521 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ -1522 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ -1523 │ │ │ │ │ -1524 // const lvalue │ │ │ │ │ -1525 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ -1526 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ -1527 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ -1528 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ -1529 │ │ │ │ │ -1530 // rvalue │ │ │ │ │ -1531 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (M(false)) == false); │ │ │ │ │ -1532 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (M(false)) == false); │ │ │ │ │ -1533 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(M(false)) == true); │ │ │ │ │ -1534 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(M(false)) == true); │ │ │ │ │ -1535 │ │ │ │ │ -1536 auto mixedVec = broadcast(0); │ │ │ │ │ -1537 for(std::size_t l = 0; l < _l_a_n_e_s(mixedVec); ++l) │ │ │ │ │ -1538 _l_a_n_e(l, mixedVec) = (l % 2); │ │ │ │ │ -1539 │ │ │ │ │ -1540 // mutable lvalue │ │ │ │ │ -1541 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1542 (_a_l_l_T_r_u_e (static_cast(mixedVec)) == false); │ │ │ │ │ -1543 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1544 (_a_n_y_T_r_u_e (static_cast(mixedVec)) == (lanes() > 1)); │ │ │ │ │ -1545 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1546 (_a_l_l_F_a_l_s_e(static_cast(mixedVec)) == (lanes() == 1)); │ │ │ │ │ -1547 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1548 (_a_n_y_F_a_l_s_e(static_cast(mixedVec)) == true); │ │ │ │ │ -1549 │ │ │ │ │ -1550 // const lvalue │ │ │ │ │ -1551 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1552 (_a_l_l_T_r_u_e (static_cast(mixedVec)) == false); │ │ │ │ │ -1553 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1554 (_a_n_y_T_r_u_e (static_cast(mixedVec)) == (lanes() > 1)); │ │ │ │ │ -1555 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1556 (_a_l_l_F_a_l_s_e(static_cast(mixedVec)) == (lanes() == 1)); │ │ │ │ │ -1557 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -1558 (_a_n_y_F_a_l_s_e(static_cast(mixedVec)) == true); │ │ │ │ │ -1559 │ │ │ │ │ -1560 // rvalue │ │ │ │ │ -1561 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (M(mixedVec)) == false); │ │ │ │ │ -1562 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (M(mixedVec)) == (lanes() > 1)); │ │ │ │ │ -1563 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(M(mixedVec)) == (lanes() == 1)); │ │ │ │ │ -1564 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(M(mixedVec)) == true); │ │ │ │ │ +1470 } │ │ │ │ │ +1471 │ │ │ │ │ +1472 template │ │ │ │ │ +_1_4_7_3 inline bool _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_i_s_S_y_n_c_e_d() const │ │ │ │ │ +1474 { │ │ │ │ │ +1475 return sourceSeqNo_==source_->seqNo() && destSeqNo_ ==target_->seqNo(); │ │ │ │ │ +1476 } │ │ │ │ │ +1477 │ │ │ │ │ +1478 template │ │ │ │ │ +1479 template │ │ │ │ │ +_1_4_8_0 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_> _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_g_e_t_M_o_d_i_f_i_e_r(int │ │ │ │ │ +process) │ │ │ │ │ +1481 { │ │ │ │ │ +1482 │ │ │ │ │ +1483 // The user are on their own now! │ │ │ │ │ +1484 // We assume they know what they are doing and just set the │ │ │ │ │ +1485 // remote indices to synced status. │ │ │ │ │ +1486 sourceSeqNo_ = source_->seqNo(); │ │ │ │ │ +1487 destSeqNo_ = target_->seqNo(); │ │ │ │ │ +1488 │ │ │ │ │ +1489 typename RemoteIndexMap::iterator found = remoteIndices_.find(process); │ │ │ │ │ +1490 │ │ │ │ │ +1491 if(found == remoteIndices_.end()) │ │ │ │ │ +1492 { │ │ │ │ │ +1493 if(source_ != target_) │ │ │ │ │ +1494 found = remoteIndices_._i_n_s_e_r_t(found, std::make_pair(process, │ │ │ │ │ +1495 std::make_pair(new _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t(), │ │ │ │ │ +1496 new _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t()))); │ │ │ │ │ +1497 else{ │ │ │ │ │ +1498 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t* rlist = new _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t(); │ │ │ │ │ +1499 found = remoteIndices_.insert(found, │ │ │ │ │ +1500 std::make_pair(process, │ │ │ │ │ +1501 std::make_pair(rlist, rlist))); │ │ │ │ │ +1502 } │ │ │ │ │ +1503 } │ │ │ │ │ +1504 │ │ │ │ │ +1505 firstBuild = false; │ │ │ │ │ +1506 │ │ │ │ │ +1507 if(send) │ │ │ │ │ +1508 return _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>(*source_, *(found- │ │ │ │ │ +>second.first)); │ │ │ │ │ +1509 else │ │ │ │ │ +1510 return _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>(*target_, *(found- │ │ │ │ │ +>second.second)); │ │ │ │ │ +1511 } │ │ │ │ │ +1512 │ │ │ │ │ +1513 template │ │ │ │ │ +1514 inline typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +_1_5_1_5 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_f_i_n_d(int proc) const │ │ │ │ │ +1516 { │ │ │ │ │ +1517 return remoteIndices_.find(proc); │ │ │ │ │ +1518 } │ │ │ │ │ +1519 │ │ │ │ │ +1520 template │ │ │ │ │ +1521 inline typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +_1_5_2_2 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_b_e_g_i_n() const │ │ │ │ │ +1523 { │ │ │ │ │ +1524 return remoteIndices_.begin(); │ │ │ │ │ +1525 } │ │ │ │ │ +1526 │ │ │ │ │ +1527 template │ │ │ │ │ +1528 inline typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +_1_5_2_9 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_e_n_d() const │ │ │ │ │ +1530 { │ │ │ │ │ +1531 return remoteIndices_.end(); │ │ │ │ │ +1532 } │ │ │ │ │ +1533 │ │ │ │ │ +1534 │ │ │ │ │ +1535 template │ │ │ │ │ +_1_5_3_6 bool _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_o_p_e_r_a_t_o_r_=_=(const _R_e_m_o_t_e_I_n_d_i_c_e_s& ri) const │ │ │ │ │ +1537 { │ │ │ │ │ +1538 if(neighbours()!=ri._n_e_i_g_h_b_o_u_r_s()) │ │ │ │ │ +1539 return false; │ │ │ │ │ +1540 │ │ │ │ │ +1541 const auto rend = remoteIndices_.end(); │ │ │ │ │ +1542 │ │ │ │ │ +1543 for(auto rindex = remoteIndices_.begin(), rindex1=ri.remoteIndices_.begin │ │ │ │ │ +(); rindex!=rend; ++rindex, ++rindex1) { │ │ │ │ │ +1544 if(rindex->first != rindex1->first) │ │ │ │ │ +1545 return false; │ │ │ │ │ +1546 if(*(rindex->second.first) != *(rindex1->second.first)) │ │ │ │ │ +1547 return false; │ │ │ │ │ +1548 if(*(rindex->second.second) != *(rindex1->second.second)) │ │ │ │ │ +1549 return false; │ │ │ │ │ +1550 } │ │ │ │ │ +1551 return true; │ │ │ │ │ +1552 } │ │ │ │ │ +1553 │ │ │ │ │ +1554 template │ │ │ │ │ +1555 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r(const │ │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ +1556 RemoteIndexList& rList) │ │ │ │ │ +1557 : rList_(&rList), indexSet_(&indexSet), iter_(rList.beginModify()), end_ │ │ │ │ │ +(rList.end()), first_(true) │ │ │ │ │ +1558 { │ │ │ │ │ +1559 if(MODIFYINDEXSET) { │ │ │ │ │ +1560 assert(indexSet_); │ │ │ │ │ +1561 for(ConstIterator iter=iter_; iter != end_; ++iter) │ │ │ │ │ +1562 glist_.push_back(iter->localIndexPair().global()); │ │ │ │ │ +1563 giter_ = glist_.beginModify(); │ │ │ │ │ +1564 } │ │ │ │ │ 1565 } │ │ │ │ │ 1566 │ │ │ │ │ -1567 template │ │ │ │ │ -1568 void checkCond() │ │ │ │ │ -1569 { │ │ │ │ │ -1570 using M = Mask; │ │ │ │ │ -1571 │ │ │ │ │ -1572 static_assert │ │ │ │ │ -1573 (std::is_same(), std::declval(), │ │ │ │ │ -1574 std::declval())), V>::value, │ │ │ │ │ -1575 "The result of cond(M, V, V) should have exactly the type V"); │ │ │ │ │ -1576 │ │ │ │ │ -1577 static_assert │ │ │ │ │ -1578 (std::is_same(), │ │ │ │ │ -1579 std::declval(), │ │ │ │ │ -1580 std::declval())), V>::value, │ │ │ │ │ -1581 "The result of cond(const M&, const V&, const V&) should have " │ │ │ │ │ -1582 "exactly the type V"); │ │ │ │ │ -1583 │ │ │ │ │ -1584 static_assert │ │ │ │ │ -1585 (std::is_same(), std::declval(), │ │ │ │ │ -1586 std::declval())), V>::value, │ │ │ │ │ -1587 "The result of cond(M&, V&, V&) should have exactly the type V"); │ │ │ │ │ -1588 │ │ │ │ │ -1589 V vec1 = leftVector(); │ │ │ │ │ -1590 V vec2 = rightVector(); │ │ │ │ │ -1591 │ │ │ │ │ -1592 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(M(true), vec1, vec2) == vec1)); │ │ │ │ │ -1593 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(M(false), vec1, vec2) == vec2)); │ │ │ │ │ +1567 template │ │ │ │ │ +_1_5_6_8 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r(const │ │ │ │ │ +_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>& other) │ │ │ │ │ +1569 : rList_(other.rList_), indexSet_(other.indexSet_), │ │ │ │ │ +1570 glist_(other.glist_), iter_(other.iter_), giter_(other.giter_), end_ │ │ │ │ │ +(other.end_), │ │ │ │ │ +1571 first_(other.first_), last_(other.last_) │ │ │ │ │ +1572 {} │ │ │ │ │ +1573 │ │ │ │ │ +1574 template │ │ │ │ │ +_1_5_7_5 inline void _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s() │ │ │ │ │ +1576 { │ │ │ │ │ +1577 if(MODIFYINDEXSET) { │ │ │ │ │ +1578 // repair pointers to local index set. │ │ │ │ │ +1579#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1580 if(indexSet_->state()!=_G_R_O_U_N_D) │ │ │ │ │ +1581 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_I_n_d_e_x_S_e_t_S_t_a_t_e, "Index has to be in ground mode for │ │ │ │ │ +repairing pointers to indices"); │ │ │ │ │ +1582#endif │ │ │ │ │ +1583 auto giter = glist_.begin(); │ │ │ │ │ +1584 auto index = indexSet_->begin(); │ │ │ │ │ +1585 │ │ │ │ │ +1586 for(auto iter=rList_->begin(); iter != end_; ++iter) { │ │ │ │ │ +1587 while(index->global()<*giter) { │ │ │ │ │ +1588 ++index; │ │ │ │ │ +1589#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1590 if(index == indexSet_->end()) │ │ │ │ │ +1591 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_P_o_s_i_t_i_o_n, "No such global index in set!"); │ │ │ │ │ +1592#endif │ │ │ │ │ +1593 } │ │ │ │ │ 1594 │ │ │ │ │ -1595 auto mixedResult = broadcast(0); │ │ │ │ │ -1596 auto mixedMask = broadcast(false); │ │ │ │ │ -1597 for(std::size_t l = 0; l < _l_a_n_e_s(mixedMask); ++l) │ │ │ │ │ -1598 { │ │ │ │ │ -1599 _l_a_n_e(l, mixedMask ) = (l % 2); │ │ │ │ │ -1600 _l_a_n_e(l, mixedResult) = _l_a_n_e(l, (l % 2) ? vec1 : vec2); │ │ │ │ │ +1595#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1596 if(index->global() != *giter) │ │ │ │ │ +1597 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_P_o_s_i_t_i_o_n, "No such global index in set!"); │ │ │ │ │ +1598#endif │ │ │ │ │ +1599 iter->localIndex_ = &(*index); │ │ │ │ │ +1600 } │ │ │ │ │ 1601 } │ │ │ │ │ -1602 │ │ │ │ │ -1603 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(mixedMask, vec1, vec2) == mixedResult)); │ │ │ │ │ -1604 } │ │ │ │ │ -1605 │ │ │ │ │ -1606 template │ │ │ │ │ -1607 void checkBoolCond() │ │ │ │ │ -1608 { │ │ │ │ │ -1609 static_assert │ │ │ │ │ -1610 (std::is_same(), std::declval(), │ │ │ │ │ -1611 std::declval())), V>::value, │ │ │ │ │ -1612 "The result of cond(bool, V, V) should have exactly the type V"); │ │ │ │ │ -1613 │ │ │ │ │ -1614 static_assert │ │ │ │ │ -1615 (std::is_same(), │ │ │ │ │ -1616 std::declval(), │ │ │ │ │ -1617 std::declval())), V>::value, │ │ │ │ │ -1618 "The result of cond(const bool&, const V&, const V&) should have " │ │ │ │ │ -1619 "exactly the type V"); │ │ │ │ │ -1620 │ │ │ │ │ -1621 static_assert │ │ │ │ │ -1622 (std::is_same(), │ │ │ │ │ -1623 std::declval(), │ │ │ │ │ -1624 std::declval())), V>::value, │ │ │ │ │ -1625 "The result of cond(bool&, V&, V&) should have exactly the type V"); │ │ │ │ │ +1602 } │ │ │ │ │ +1603 │ │ │ │ │ +1604 template │ │ │ │ │ +_1_6_0_5 inline void _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>_:_:_i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x& │ │ │ │ │ +index) │ │ │ │ │ +1606 { │ │ │ │ │ +1607 static_assert(!mode,"Not allowed if the mode indicates that new indices" │ │ │ │ │ +1608 "might be added to the underlying index set. Use " │ │ │ │ │ +1609 "insert(const RemoteIndex&, const GlobalIndex&) instead"); │ │ │ │ │ +1610 │ │ │ │ │ +1611#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1612 if(!first_ && index._l_o_c_a_l_I_n_d_e_x_P_a_i_r()._g_l_o_b_a_l()localIndexPair().global() < │ │ │ │ │ +index._l_o_c_a_l_I_n_d_e_x_P_a_i_r()._g_l_o_b_a_l()) { │ │ │ │ │ +1617 ++iter_; │ │ │ │ │ +1618 } │ │ │ │ │ +1619 │ │ │ │ │ +1620 // No duplicate entries allowed │ │ │ │ │ +1621 assert(iter_==end_ || iter_->localIndexPair().global() != │ │ │ │ │ +index._l_o_c_a_l_I_n_d_e_x_P_a_i_r()._g_l_o_b_a_l()); │ │ │ │ │ +1622 iter_.insert(index); │ │ │ │ │ +1623 last_ = index._l_o_c_a_l_I_n_d_e_x_P_a_i_r()._g_l_o_b_a_l(); │ │ │ │ │ +1624 first_ = false; │ │ │ │ │ +1625 } │ │ │ │ │ 1626 │ │ │ │ │ -1627 V vec1 = leftVector(); │ │ │ │ │ -1628 V vec2 = rightVector(); │ │ │ │ │ -1629 │ │ │ │ │ -1630 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(true, vec1, vec2) == vec1)); │ │ │ │ │ -1631 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(false, vec1, vec2) == vec2)); │ │ │ │ │ -1632 } │ │ │ │ │ -1633 │ │ │ │ │ -1634 template │ │ │ │ │ -1635 std::enable_if_t >::value> │ │ │ │ │ -1636 checkHorizontalMinMax() {} │ │ │ │ │ -1637 │ │ │ │ │ -1638 template │ │ │ │ │ -1639 std::enable_if_t >::value> │ │ │ │ │ -1640 checkHorizontalMinMax() │ │ │ │ │ -1641 { │ │ │ │ │ -1642 static_assert │ │ │ │ │ -1643 (std::is_same())), Scalar >::value, │ │ │ │ │ -1644 "The result of max(V) should be exactly Scalar"); │ │ │ │ │ -1645 │ │ │ │ │ -1646 static_assert │ │ │ │ │ -1647 (std::is_same())), Scalar >::value, │ │ │ │ │ -1648 "The result of min(V) should be exactly Scalar"); │ │ │ │ │ -1649 │ │ │ │ │ -1650 static_assert │ │ │ │ │ -1651 (std::is_same())), Scalar >::value, │ │ │ │ │ -1652 "The result of max(V) should be exactly Scalar"); │ │ │ │ │ -1653 │ │ │ │ │ -1654 static_assert │ │ │ │ │ -1655 (std::is_same())), Scalar >::value, │ │ │ │ │ -1656 "The result of min(V) should be exactly Scalar"); │ │ │ │ │ -1657 │ │ │ │ │ -1658 const V vec1 = leftVector(); │ │ │ │ │ +1627 template │ │ │ │ │ +_1_6_2_8 inline void _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>_:_:_i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x& │ │ │ │ │ +index, const _G_l_o_b_a_l_I_n_d_e_x& global) │ │ │ │ │ +1629 { │ │ │ │ │ +1630 static_assert(mode,"Not allowed if the mode indicates that no new indices" │ │ │ │ │ +1631 "might be added to the underlying index set. Use " │ │ │ │ │ +1632 "insert(const RemoteIndex&) instead"); │ │ │ │ │ +1633#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1634 if(!first_ && globallocalIndexPair().global() != global); │ │ │ │ │ +1645 iter_.insert(index); │ │ │ │ │ +1646 giter_.insert(global); │ │ │ │ │ +1647 │ │ │ │ │ +1648 last_ = global; │ │ │ │ │ +1649 first_ = false; │ │ │ │ │ +1650 } │ │ │ │ │ +1651 │ │ │ │ │ +1652 template │ │ │ │ │ +_1_6_5_3 bool _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_<_T_,_A_,_m_o_d_e_>_:_:_r_e_m_o_v_e(const _G_l_o_b_a_l_I_n_d_e_x& global) │ │ │ │ │ +1654 { │ │ │ │ │ +1655#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1656 if(!first_ && global(_l_a_n_e_s(vec1))); │ │ │ │ │ -1661 _D_U_N_E___S_I_M_D___C_H_E_C_K(_m_i_n(vec1) == Scalar(1)); │ │ │ │ │ -1662 } │ │ │ │ │ -1663 │ │ │ │ │ -1664 template │ │ │ │ │ -1665 std::enable_if_t >::value> │ │ │ │ │ -1666 checkBinaryMinMax() {} │ │ │ │ │ -1667 │ │ │ │ │ -1668 template │ │ │ │ │ -1669 std::enable_if_t >::value> │ │ │ │ │ -1670 checkBinaryMinMax() │ │ │ │ │ -1671 { │ │ │ │ │ -1672 using std::max; │ │ │ │ │ -1673 using std::min; │ │ │ │ │ -1674 │ │ │ │ │ -1675 static_assert │ │ │ │ │ -1676 (std::is_same(), │ │ │ │ │ -1677 std::declval())), V>::value, │ │ │ │ │ -1678 "The result of Simd::max(V, V) should be exactly V"); │ │ │ │ │ -1679 static_assert │ │ │ │ │ -1680 (std::is_same(), │ │ │ │ │ -1681 std::declval())), V>::value, │ │ │ │ │ -1682 "The result of Simd::min(V, V) should be exactly V"); │ │ │ │ │ -1683 │ │ │ │ │ -1684 static_assert │ │ │ │ │ -1685 (std::is_same(), │ │ │ │ │ -1686 std::declval())), V>::value, │ │ │ │ │ -1687 "The result of Simd::max(V&, V&) should be exactly V"); │ │ │ │ │ -1688 static_assert │ │ │ │ │ -1689 (std::is_same(), │ │ │ │ │ -1690 std::declval())), V>::value, │ │ │ │ │ -1691 "The result of Simd::min(V&, V&) should be exactly V"); │ │ │ │ │ -1692 │ │ │ │ │ -1693 const V arg1 = leftVector(); │ │ │ │ │ -1694 const V arg2 = rightVector(); │ │ │ │ │ -1695 │ │ │ │ │ -1696 V maxExp(Scalar(0)), minExp(Scalar(0)); │ │ │ │ │ -1697 for(auto l : _r_a_n_g_e(_l_a_n_e_s())) │ │ │ │ │ -1698 { │ │ │ │ │ -1699 _l_a_n_e(l, maxExp) = _m_a_x(_l_a_n_e(l, arg1), _l_a_n_e(l, arg2)); │ │ │ │ │ -1700 _l_a_n_e(l, minExp) = _m_i_n(_l_a_n_e(l, arg1), _l_a_n_e(l, arg2)); │ │ │ │ │ -1701 } │ │ │ │ │ -1702 │ │ │ │ │ -1703 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(maxExp == _S_i_m_d_:_:_m_a_x(arg1, arg2))); │ │ │ │ │ -1704 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(minExp == _S_i_m_d_:_:_m_i_n(arg1, arg2))); │ │ │ │ │ -1705 } │ │ │ │ │ -1706 │ │ │ │ │ -1707 template │ │ │ │ │ -1708 void checkIO() │ │ │ │ │ -1709 { │ │ │ │ │ -1710 const V vec1 = leftVector(); │ │ │ │ │ -1711 │ │ │ │ │ -1712 std::string reference; │ │ │ │ │ -1713 { │ │ │ │ │ -1714 const char *sep = ""; │ │ │ │ │ -1715 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vec1))) │ │ │ │ │ -1716 { │ │ │ │ │ -1717 std::ostringstream stream; │ │ │ │ │ -1718 stream << _l_a_n_e(l, vec1); │ │ │ │ │ +1660 bool found= false; │ │ │ │ │ +1661 │ │ │ │ │ +1662 if(MODIFYINDEXSET) { │ │ │ │ │ +1663 // Move to the correct position │ │ │ │ │ +1664 while(iter_!=end_ && *giter_< global) { │ │ │ │ │ +1665 ++giter_; │ │ │ │ │ +1666 ++iter_; │ │ │ │ │ +1667 } │ │ │ │ │ +1668 if(*giter_ == global) { │ │ │ │ │ +1669 giter_.remove(); │ │ │ │ │ +1670 iter_.remove(); │ │ │ │ │ +1671 found=true; │ │ │ │ │ +1672 } │ │ │ │ │ +1673 }else{ │ │ │ │ │ +1674 while(iter_!=end_ && iter_->localIndexPair().global() < global) │ │ │ │ │ +1675 ++iter_; │ │ │ │ │ +1676 │ │ │ │ │ +1677 if(iter_->localIndexPair().global()==global) { │ │ │ │ │ +1678 iter_.remove(); │ │ │ │ │ +1679 found = true; │ │ │ │ │ +1680 } │ │ │ │ │ +1681 } │ │ │ │ │ +1682 │ │ │ │ │ +1683 last_ = global; │ │ │ │ │ +1684 first_ = false; │ │ │ │ │ +1685 return found; │ │ │ │ │ +1686 } │ │ │ │ │ +1687 │ │ │ │ │ +1688 template │ │ │ │ │ +1689 template │ │ │ │ │ +_1_6_9_0 inline typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +_R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_i_t_e_r_a_t_o_r() const │ │ │ │ │ +1691 { │ │ │ │ │ +1692 return _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>(remoteIndices_, send); │ │ │ │ │ +1693 } │ │ │ │ │ +1694 │ │ │ │ │ +1695 template │ │ │ │ │ +_1_6_9_6 inline MPI_Comm _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_c_o_m_m_u_n_i_c_a_t_o_r() const │ │ │ │ │ +1697 { │ │ │ │ │ +1698 return comm_; │ │ │ │ │ +1699 │ │ │ │ │ +1700 } │ │ │ │ │ +1701 │ │ │ │ │ +1702 template │ │ │ │ │ +_1_7_0_3 _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r(const _R_e_m_o_t_e_I_n_d_e_x_M_a_p& pmap, │ │ │ │ │ +bool send) │ │ │ │ │ +1704 { │ │ │ │ │ +1705 │ │ │ │ │ +1706 const auto end = pmap.end(); │ │ │ │ │ +1707 for(auto process = pmap.begin(); process != end; ++process) { │ │ │ │ │ +1708 const _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t* list = send ? process->second.first : process- │ │ │ │ │ +>second.second; │ │ │ │ │ +1709 using ri_iterator = typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +1710 map_.insert(std::make_pair(process->first, │ │ │ │ │ +1711 std::pair(list->_b_e_g_i_n(), list->_e_n_d()))); │ │ │ │ │ +1712 } │ │ │ │ │ +1713 } │ │ │ │ │ +1714 │ │ │ │ │ +1715 template │ │ │ │ │ +_1_7_1_6 inline void _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_a_d_v_a_n_c_e(const GlobalIndex& index) │ │ │ │ │ +1717 { │ │ │ │ │ +1718 const auto end = map_.end(); │ │ │ │ │ 1719 │ │ │ │ │ -1720 reference += sep; │ │ │ │ │ -1721 reference += stream.str(); │ │ │ │ │ -1722 sep = ", "; │ │ │ │ │ -1723 } │ │ │ │ │ -1724 } │ │ │ │ │ -1725 │ │ │ │ │ -1726 { │ │ │ │ │ -1727 std::ostringstream stream; │ │ │ │ │ -1728 stream << _i_o(vec1); │ │ │ │ │ -1729 if(_l_a_n_e_s(vec1) == 1) │ │ │ │ │ -1730 _D_U_N_E___S_I_M_D___C_H_E_C_K(stream.str() == reference); │ │ │ │ │ -1731 else │ │ │ │ │ -1732 _D_U_N_E___S_I_M_D___C_H_E_C_K(stream.str() == "<" + reference + ">"); │ │ │ │ │ -1733 } │ │ │ │ │ -1734 │ │ │ │ │ -1735 { │ │ │ │ │ -1736 std::ostringstream stream; │ │ │ │ │ -1737 stream << _v_i_o(vec1); │ │ │ │ │ -1738 _D_U_N_E___S_I_M_D___C_H_E_C_K(stream.str() == "<" + reference + ">"); │ │ │ │ │ -1739 } │ │ │ │ │ +1720 for(auto iter = map_.begin(); iter != end;) { │ │ │ │ │ +1721 // Step the iterator until we are >= index │ │ │ │ │ +1722 typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r current = iter->second.first; │ │ │ │ │ +1723 typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r rend = iter->second.second; │ │ │ │ │ +1724 _R_e_m_o_t_e_I_n_d_e_x remoteIndex; │ │ │ │ │ +1725 if(current != rend) │ │ │ │ │ +1726 remoteIndex = *current; │ │ │ │ │ +1727 │ │ │ │ │ +1728 while(iter->second.first!=iter->second.second && iter->second.first- │ │ │ │ │ +>localIndexPair().global()second.first); │ │ │ │ │ +1730 │ │ │ │ │ +1731 // erase from the map if there are no more entries. │ │ │ │ │ +1732 if(iter->second.first == iter->second.second) │ │ │ │ │ +1733 map_.erase(iter++); │ │ │ │ │ +1734 else{ │ │ │ │ │ +1735 ++iter; │ │ │ │ │ +1736 } │ │ │ │ │ +1737 } │ │ │ │ │ +1738 index_=index; │ │ │ │ │ +1739 noattribute=true; │ │ │ │ │ 1740 } │ │ │ │ │ 1741 │ │ │ │ │ -1742#undef DUNE_SIMD_CHECK │ │ │ │ │ -1743 │ │ │ │ │ -1744 public: │ │ │ │ │ -1807 template void _c_h_e_c_k_T_y_p_e(); │ │ │ │ │ -1808 template void _c_h_e_c_k_N_o_n_O_p_s(); │ │ │ │ │ -1809 template void _c_h_e_c_k_U_n_a_r_y_O_p_s(); │ │ │ │ │ -1810 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s(); │ │ │ │ │ -1811 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_V_e_c_t_o_r(); │ │ │ │ │ -1812 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_S_c_a_l_a_r_V_e_c_t_o_r(); │ │ │ │ │ -1813 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_S_c_a_l_a_r(); │ │ │ │ │ -1814 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_P_r_o_x_y_V_e_c_t_o_r(); │ │ │ │ │ -1815 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_P_r_o_x_y(); │ │ │ │ │ +1742 template │ │ │ │ │ +_1_7_4_3 inline void _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_a_d_v_a_n_c_e(const GlobalIndex& index, │ │ │ │ │ +1744 const Attribute& attribute) │ │ │ │ │ +1745 { │ │ │ │ │ +1746 const auto end = map_.end(); │ │ │ │ │ +1747 │ │ │ │ │ +1748 for(auto iter = map_.begin(); iter != end;) { │ │ │ │ │ +1749 // Step the iterator until we are >= index │ │ │ │ │ +1750 typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r current = iter->second.first; │ │ │ │ │ +1751 typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r rend = iter->second.second; │ │ │ │ │ +1752 _R_e_m_o_t_e_I_n_d_e_x remoteIndex; │ │ │ │ │ +1753 if(current != rend) │ │ │ │ │ +1754 remoteIndex = *current; │ │ │ │ │ +1755 │ │ │ │ │ +1756 // Move to global index or bigger │ │ │ │ │ +1757 while(iter->second.first!=iter->second.second && iter->second.first- │ │ │ │ │ +>localIndexPair().global()second.first); │ │ │ │ │ +1759 │ │ │ │ │ +1760 // move to attribute or bigger │ │ │ │ │ +1761 while(iter->second.first!=iter->second.second │ │ │ │ │ +1762 && iter->second.first->localIndexPair().global()==index │ │ │ │ │ +1763 && iter->second.first->localIndexPair().local().attribute()second.first); │ │ │ │ │ +1765 │ │ │ │ │ +1766 // erase from the map if there are no more entries. │ │ │ │ │ +1767 if(iter->second.first == iter->second.second) │ │ │ │ │ +1768 map_.erase(iter++); │ │ │ │ │ +1769 else{ │ │ │ │ │ +1770 ++iter; │ │ │ │ │ +1771 } │ │ │ │ │ +1772 } │ │ │ │ │ +1773 index_=index; │ │ │ │ │ +1774 attribute_=attribute; │ │ │ │ │ +1775 noattribute=false; │ │ │ │ │ +1776 } │ │ │ │ │ +1777 │ │ │ │ │ +1778 template │ │ │ │ │ +_1_7_7_9 inline _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>& _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +1780 { │ │ │ │ │ +1781 const auto end = map_._e_n_d(); │ │ │ │ │ +1782 │ │ │ │ │ +1783 for(auto iter = map_.begin(); iter != end;) { │ │ │ │ │ +1784 // Step the iterator until we are >= index │ │ │ │ │ +1785 auto current = iter->second.first; │ │ │ │ │ +1786 auto rend = iter->second.second; │ │ │ │ │ +1787 │ │ │ │ │ +1788 // move all iterators pointing to the current global index to next value │ │ │ │ │ +1789 if(iter->second.first->localIndexPair().global()==index_ && │ │ │ │ │ +1790 (noattribute || iter->second.first->localIndexPair().local().attribute() │ │ │ │ │ +== attribute_)) │ │ │ │ │ +1791 ++(iter->second.first); │ │ │ │ │ +1792 │ │ │ │ │ +1793 // erase from the map if there are no more entries. │ │ │ │ │ +1794 if(iter->second.first == iter->second.second) │ │ │ │ │ +1795 map_.erase(iter++); │ │ │ │ │ +1796 else{ │ │ │ │ │ +1797 ++iter; │ │ │ │ │ +1798 } │ │ │ │ │ +1799 } │ │ │ │ │ +1800 return *this; │ │ │ │ │ +1801 } │ │ │ │ │ +1802 │ │ │ │ │ +1803 template │ │ │ │ │ +_1_8_0_4 inline bool _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_e_m_p_t_y() const │ │ │ │ │ +1805 { │ │ │ │ │ +1806 return map_.empty(); │ │ │ │ │ +1807 } │ │ │ │ │ +1808 │ │ │ │ │ +1809 template │ │ │ │ │ +1810 inline typename _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +_1_8_1_1 _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_b_e_g_i_n() │ │ │ │ │ +1812 { │ │ │ │ │ +1813 if(noattribute) │ │ │ │ │ +1814 return _i_t_e_r_a_t_o_r(map_.begin(), map_.end(), index_); │ │ │ │ │ +1815 else │ │ │ │ │ +1816 return _i_t_e_r_a_t_o_r(map_.begin(), map_.end(), index_, │ │ │ │ │ +1817 attribute_); │ │ │ │ │ +1818 } │ │ │ │ │ 1819 │ │ │ │ │ -1836 template class RebindPrune = _I_s_L_o_o_p, │ │ │ │ │ -1838 template class RebindAccept = _D_u_n_e_:_:_A_l_w_a_y_s_T_r_u_e> │ │ │ │ │ -_1_8_3_9 void _c_h_e_c_k() { │ │ │ │ │ -1840 // check whether the test for this type already started │ │ │ │ │ -1841 if(seen_.emplace(typeid (V)).second == false) │ │ │ │ │ -1842 { │ │ │ │ │ -1843 // type already seen, nothing to do │ │ │ │ │ -1844 return; │ │ │ │ │ -1845 } │ │ │ │ │ +1820 template │ │ │ │ │ +1821 inline typename _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +_1_8_2_2 _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_e_n_d() │ │ │ │ │ +1823 { │ │ │ │ │ +1824 return _i_t_e_r_a_t_o_r(map_.end(), map_.end(), index_); │ │ │ │ │ +1825 } │ │ │ │ │ +1826 │ │ │ │ │ +1827 template │ │ │ │ │ +_1_8_2_8 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const │ │ │ │ │ +_R_e_m_o_t_e_I_n_d_e_x_<_T_G_,_T_A_>& index) │ │ │ │ │ +1829 { │ │ │ │ │ +1830 os<<"[global="< │ │ │ │ │ +_1_8_3_5 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const │ │ │ │ │ +_R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>& indices) │ │ │ │ │ +1836 { │ │ │ │ │ +1837 int rank; │ │ │ │ │ +1838 MPI_Comm_rank(indices.comm_, &rank); │ │ │ │ │ +1839 const auto rend = indices.remoteIndices_.end(); │ │ │ │ │ +1840 │ │ │ │ │ +1841 for(auto rindex = indices.remoteIndices_.begin(); rindex!=rend; ++rindex) │ │ │ │ │ +{ │ │ │ │ │ +1842 os<first<<":"; │ │ │ │ │ +1843 │ │ │ │ │ +1844 if(!rindex->second.first->empty()) { │ │ │ │ │ +1845 os<<" send:"; │ │ │ │ │ 1846 │ │ │ │ │ -1847 // do these first so everything that appears after "Checking SIMD type │ │ │ │ │ -1848 // ..." really pertains to that type │ │ │ │ │ -1849 auto recurse = [this](auto w) { │ │ │ │ │ -1850 using W = typename decltype(w)::type; │ │ │ │ │ -1851 this->template check(); │ │ │ │ │ -1852 }; │ │ │ │ │ -1853 checkRebindOf(recurse); │ │ │ │ │ -1854 │ │ │ │ │ -1855 checkType(); │ │ │ │ │ -1856 } │ │ │ │ │ -1857 │ │ │ │ │ -_1_8_5_9 bool _g_o_o_d() const │ │ │ │ │ -1860 { │ │ │ │ │ -1861 return good_; │ │ │ │ │ -1862 } │ │ │ │ │ -1863 │ │ │ │ │ -1864 }; // class UnitTest │ │ │ │ │ -1865 │ │ │ │ │ -_1_8_6_6 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_T_y_p_e() │ │ │ │ │ -1867 { │ │ │ │ │ -1868 static_assert(std::is_same >::value, "Simd types " │ │ │ │ │ -1869 "must not be references, and must not include " │ │ │ │ │ -1870 "cv-qualifiers"); │ │ │ │ │ -1871 │ │ │ │ │ -1872 log_ << "Checking SIMD type " << className() << std::endl; │ │ │ │ │ -1873 │ │ │ │ │ -1874 checkNonOps(); │ │ │ │ │ -1875 checkUnaryOps(); │ │ │ │ │ -1876 checkBinaryOps(); │ │ │ │ │ -1877 } │ │ │ │ │ -_1_8_7_8 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_N_o_n_O_p_s() │ │ │ │ │ -1879 { │ │ │ │ │ -1880 constexpr auto isMask = typename std::is_same, bool>::type{}; │ │ │ │ │ -1881 │ │ │ │ │ -1882 checkLanes(); │ │ │ │ │ -1883 checkScalar(); │ │ │ │ │ -1884 │ │ │ │ │ -1885 checkDefaultConstruct(); │ │ │ │ │ -1886 checkLane(); │ │ │ │ │ -1887 checkCopyMoveConstruct(); │ │ │ │ │ -1888 checkImplCast(); │ │ │ │ │ -1889 checkBroadcast(); │ │ │ │ │ -1890 if constexpr (isMask) │ │ │ │ │ -1891 this->template checkBroadcastMaskConstruct(); │ │ │ │ │ -1892 else │ │ │ │ │ -1893 this->template checkBroadcastVectorConstruct(); │ │ │ │ │ -1894 checkBracedAssign(); │ │ │ │ │ -1895 checkBracedBroadcastAssign(); │ │ │ │ │ -1896 │ │ │ │ │ -1897 checkAutoCopy(); │ │ │ │ │ -1898 checkCond(); │ │ │ │ │ -1899 checkBoolCond(); │ │ │ │ │ -1900 │ │ │ │ │ -1901 if constexpr (isMask) │ │ │ │ │ -1902 this->template checkBoolReductions(); │ │ │ │ │ -1903 // checkBoolReductions() is not applicable for non-masks │ │ │ │ │ -1904 │ │ │ │ │ -1905 checkHorizontalMinMax(); │ │ │ │ │ -1906 checkBinaryMinMax(); │ │ │ │ │ -1907 checkIO(); │ │ │ │ │ -1908 } │ │ │ │ │ -_1_9_0_9 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_U_n_a_r_y_O_p_s() │ │ │ │ │ -1910 { │ │ │ │ │ -1911 if constexpr (std::is_same_v, bool>) { │ │ │ │ │ -1912 // check mask │ │ │ │ │ -1913 auto _c_h_e_c_k = [this](auto op) { │ │ │ │ │ -1914 this->template checkUnaryOpsV(op); │ │ │ │ │ -1915 }; │ │ │ │ │ -1916 │ │ │ │ │ -1917 // postfix │ │ │ │ │ -1918 // check(OpPostfixDecrement{}); │ │ │ │ │ -1919 // clang deprecation warning if bool++ is tested │ │ │ │ │ -1920 // check(OpPostfixIncrement{}); │ │ │ │ │ -1921 │ │ │ │ │ -1922 // prefix │ │ │ │ │ -1923 // check(OpPrefixDecrement{}); │ │ │ │ │ -1924 // clang deprecation warning if ++bool is tested │ │ │ │ │ -1925 // check(OpPrefixIncrement{}); │ │ │ │ │ -1926 │ │ │ │ │ -1927 // check(OpPrefixPlus{}); │ │ │ │ │ -1928 // check(OpPrefixMinus{}); │ │ │ │ │ -1929 _c_h_e_c_k(OpPrefixLogicNot{}); │ │ │ │ │ -1930 // check(OpPrefixBitNot{}); │ │ │ │ │ -1931 } │ │ │ │ │ -1932 else { │ │ │ │ │ -1933 // check vector │ │ │ │ │ -1934 auto _c_h_e_c_k = [this](auto op) { │ │ │ │ │ -1935 this->template checkUnaryOpsV(op); │ │ │ │ │ -1936 }; │ │ │ │ │ -1937 │ │ │ │ │ -1938 // postfix │ │ │ │ │ -1939 // check(OpPostfixDecrement{}); │ │ │ │ │ -1940 // check(OpPostfixIncrement{}); │ │ │ │ │ -1941 │ │ │ │ │ -1942 // prefix │ │ │ │ │ -1943 // check(OpPrefixDecrement{}); │ │ │ │ │ -1944 // check(OpPrefixIncrement{}); │ │ │ │ │ -1945 │ │ │ │ │ -1946 // check(OpPrefixPlus{}); │ │ │ │ │ -1947 _c_h_e_c_k(OpPrefixMinus{}); │ │ │ │ │ -1948 _c_h_e_c_k(OpPrefixLogicNot{}); │ │ │ │ │ -1949 _c_h_e_c_k(OpPrefixBitNot{}); │ │ │ │ │ -1950 } │ │ │ │ │ -1951 } │ │ │ │ │ -_1_9_5_2 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s() │ │ │ │ │ -1953 { │ │ │ │ │ -1954 checkBinaryOpsVectorVector(); │ │ │ │ │ -1955 checkBinaryOpsScalarVector(); │ │ │ │ │ -1956 checkBinaryOpsVectorScalar(); │ │ │ │ │ -1957 checkBinaryOpsProxyVector(); │ │ │ │ │ -1958 checkBinaryOpsVectorProxy(); │ │ │ │ │ -1959 } │ │ │ │ │ -_1_9_6_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_V_e_c_t_o_r() │ │ │ │ │ -1961 { │ │ │ │ │ -1962 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ -1963 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ -1964 this->checkBinaryOpVV(t1, t2, op); │ │ │ │ │ -1965 }; │ │ │ │ │ -1966 this->checkBinaryRefQual(_c_h_e_c_k); │ │ │ │ │ -1967 }; │ │ │ │ │ -1968 checkBinaryOps(checker); │ │ │ │ │ -1969 } │ │ │ │ │ -_1_9_7_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_S_c_a_l_a_r_V_e_c_t_o_r() │ │ │ │ │ -1971 { │ │ │ │ │ -1972 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ -1973 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ -1974 this->checkBinaryOpSV(t1, t2, op); │ │ │ │ │ -1975 }; │ │ │ │ │ -1976 this->checkBinaryRefQual, V, doSV>(_c_h_e_c_k); │ │ │ │ │ -1977 │ │ │ │ │ -1978 auto crossCheck = [this,op](auto t1, auto t2) { │ │ │ │ │ -1979 this->checkBinaryOpVVAgainstSV(t1, t2, op); │ │ │ │ │ -1980 }; │ │ │ │ │ -1981 this->checkBinaryRefQual, V, doSV && doVV>(crossCheck); │ │ │ │ │ -1982 }; │ │ │ │ │ -1983 checkBinaryOps(checker); │ │ │ │ │ -1984 } │ │ │ │ │ -_1_9_8_5 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_S_c_a_l_a_r() │ │ │ │ │ -1986 { │ │ │ │ │ -1987 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ -1988 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ -1989 this->checkBinaryOpVS(t1, t2, op); │ │ │ │ │ -1990 }; │ │ │ │ │ -1991 this->checkBinaryRefQual, doVS>(_c_h_e_c_k); │ │ │ │ │ -1992 │ │ │ │ │ -1993 auto crossCheck = [this,op](auto t1, auto t2) { │ │ │ │ │ -1994 this->checkBinaryOpVVAgainstVS(t1, t2, op); │ │ │ │ │ -1995 }; │ │ │ │ │ -1996 this->checkBinaryRefQual, doVV && doVS>(crossCheck); │ │ │ │ │ -1997 }; │ │ │ │ │ -1998 checkBinaryOps(checker); │ │ │ │ │ -1999 } │ │ │ │ │ -_2_0_0_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_P_r_o_x_y_V_e_c_t_o_r() │ │ │ │ │ -2001 { │ │ │ │ │ -2002 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ -2003 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ -2004 this->checkBinaryOpPV(t1, t2, op); │ │ │ │ │ -2005 }; │ │ │ │ │ -2006 this->checkBinaryRefQual(_c_h_e_c_k); │ │ │ │ │ -2007 }; │ │ │ │ │ -2008 checkBinaryOps(checker); │ │ │ │ │ -2009 } │ │ │ │ │ -_2_0_1_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_P_r_o_x_y() │ │ │ │ │ -2011 { │ │ │ │ │ -2012 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ -2013 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ -2014 this->checkBinaryOpVP(t1, t2, op); │ │ │ │ │ -2015 }; │ │ │ │ │ -2016 this->checkBinaryRefQual(_c_h_e_c_k); │ │ │ │ │ -2017 }; │ │ │ │ │ -2018 checkBinaryOps(checker); │ │ │ │ │ -2019 } │ │ │ │ │ -2020 │ │ │ │ │ -2021 } // namespace Simd │ │ │ │ │ -2022} // namespace Dune │ │ │ │ │ -2023 │ │ │ │ │ -2024#endif // DUNE_COMMON_SIMD_TEST_HH │ │ │ │ │ -_h_y_b_r_i_d_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -_l_o_o_p_._h_h │ │ │ │ │ -_i_o_._h_h │ │ │ │ │ -IO interface of the SIMD abstraction. │ │ │ │ │ -_D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P │ │ │ │ │ -#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL) │ │ │ │ │ -DDeeffiinniittiioonn test.hh:670 │ │ │ │ │ -_D_U_N_E___S_I_M_D___I_N_F_I_X___O_P │ │ │ │ │ -#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL) │ │ │ │ │ -DDeeffiinniittiioonn test.hh:784 │ │ │ │ │ -_D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ -#define DUNE_SIMD_CHECK_OP(expr) │ │ │ │ │ -DDeeffiinniittiioonn test.hh:191 │ │ │ │ │ -_D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ -#define DUNE_SIMD_CHECK(expr) │ │ │ │ │ -DDeeffiinniittiioonn test.hh:186 │ │ │ │ │ -_D_U_N_E___S_I_M_D___R_E_P_L___O_P │ │ │ │ │ -#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL) │ │ │ │ │ -DDeeffiinniittiioonn test.hh:818 │ │ │ │ │ -_D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P │ │ │ │ │ -#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL) │ │ │ │ │ -DDeeffiinniittiioonn test.hh:805 │ │ │ │ │ -_D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P │ │ │ │ │ -#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL) │ │ │ │ │ -DDeeffiinniittiioonn test.hh:681 │ │ │ │ │ -_D_U_N_E___S_I_M_D___D_O │ │ │ │ │ -#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME) │ │ │ │ │ -_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for reduction like operations on ranges. │ │ │ │ │ -_c_l_a_s_s_n_a_m_e_._h_h │ │ │ │ │ -A free function to provide the demangled class name of a given object or type │ │ │ │ │ -as a string. │ │ │ │ │ -_t_y_p_e_l_i_s_t_._h_h │ │ │ │ │ -_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ -static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ ->, std::integral_constant< T, to >) noexcept │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_T_y_p_e_L_i_s_t │ │ │ │ │ -std::tuple< MetaType< T >... > TypeList │ │ │ │ │ -A simple type list. │ │ │ │ │ -DDeeffiinniittiioonn typelist.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_H_y_b_r_i_d_:_:_f_o_r_E_a_c_h │ │ │ │ │ -constexpr void forEach(Range &&range, F &&f) │ │ │ │ │ -Range based for loop. │ │ │ │ │ -DDeeffiinniittiioonn hybridutilities.hh:268 │ │ │ │ │ -_D_u_n_e_:_:_a_u_t_o_C_o_p_y │ │ │ │ │ -constexpr AutonomousValue< T > autoCopy(T &&v) │ │ │ │ │ -Autonomous copy of an expression's value for use in auto type deduction. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:642 │ │ │ │ │ -_D_u_n_e_:_:_v_o_i_d___t │ │ │ │ │ -typename Impl::voider< Types... >::type void_t │ │ │ │ │ -Is void for all valid input types. The workhorse for C++11 SFINAE-techniques. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e │ │ │ │ │ -bool anyTrue(const Mask &mask) │ │ │ │ │ -Whether any entry is true │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:429 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_m_a_s_k_O_r │ │ │ │ │ -auto maskOr(const V1 &v1, const V2 &v2) │ │ │ │ │ -Logic or of masks. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:499 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_c_o_n_d │ │ │ │ │ -V cond(M &&mask, const V &ifTrue, const V &ifFalse) │ │ │ │ │ -Like the ?: operator. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:386 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_i_o │ │ │ │ │ -auto io(const V &v) │ │ │ │ │ -construct a stream inserter │ │ │ │ │ -DDeeffiinniittiioonn io.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_a_l_l_T_r_u_e │ │ │ │ │ -bool allTrue(const Mask &mask) │ │ │ │ │ -Whether all entries are true │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:439 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_v_i_o │ │ │ │ │ -auto vio(const V &v) │ │ │ │ │ -construct a stream inserter │ │ │ │ │ -DDeeffiinniittiioonn io.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_m_a_x │ │ │ │ │ -auto max(const V &v1, const V &v2) │ │ │ │ │ -The binary maximum value over two simd objects. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:409 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ -bool anyFalse(const Mask &mask) │ │ │ │ │ -Whether any entry is false │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:449 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ -constexpr std::size_t lanes() │ │ │ │ │ -Number of lanes in a SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ -decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ -Extract an element of a SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ -bool allFalse(const Mask &mask) │ │ │ │ │ -Whether all entries are false │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:459 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_m_a_s_k_A_n_d │ │ │ │ │ -auto maskAnd(const V1 &v1, const V2 &v2) │ │ │ │ │ -Logic and of masks. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:509 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ -typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ -Element type of some SIMD type. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_m_i_n │ │ │ │ │ -auto min(const V &v1, const V &v2) │ │ │ │ │ -The binary minimum value over two simd objects. │ │ │ │ │ -DDeeffiinniittiioonn simd/interface.hh:419 │ │ │ │ │ +1847 const auto send= rindex->second.first->end(); │ │ │ │ │ +1848 │ │ │ │ │ +1849 for(auto index = rindex->second.first->begin(); │ │ │ │ │ +1850 index != send; ++index) │ │ │ │ │ +1851 os<<*index<<" "; │ │ │ │ │ +1852 os<second.second->empty()) { │ │ │ │ │ +1855 os<first<<": "<<"receive: "; │ │ │ │ │ +1856 │ │ │ │ │ +1857 for(const auto& index : *(rindex->second.second)) │ │ │ │ │ +1858 os << index << " "; │ │ │ │ │ +1859 } │ │ │ │ │ +1860 os<_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +SLListConstIterator< RemoteIndex, Allocator > const_iterator │ │ │ │ │ +The constant iterator of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_<_ _G_l_o_b_a_l_I_n_d_e_x_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListModifyIterator< GlobalIndex, Allocator > ModifyIterator │ │ │ │ │ +The type of the iterator capable of deletion and insertion. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:103 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +Get an iterator pointing to the first element in the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:762 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +Get an iterator over the indices positioned at the first index. │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +Get an iterator over the indices positioned after the last index. │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ +TL LocalIndex │ │ │ │ │ +The type of the local index, e.g. ParallelLocalIndex. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:239 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_g_l_o_b_a_l │ │ │ │ │ +const GlobalIndex & global() const │ │ │ │ │ +Get the global index. │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_l_o_c_a_l │ │ │ │ │ +LocalIndex & local() │ │ │ │ │ +Get the local index. │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +TG GlobalIndex │ │ │ │ │ +the type of the global index. This type has to provide at least a operator< for │ │ │ │ │ +sorting. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:226 │ │ │ │ │ +_D_u_n_e_:_:_G_R_O_U_N_D │ │ │ │ │ +@ GROUND │ │ │ │ │ +The default mode. Indicates that the index set is ready to be used. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:186 │ │ │ │ │ +_D_u_n_e_:_:_d_v_v_e_r_b │ │ │ │ │ +DVVerbType dvverb(std::cout) │ │ │ │ │ +stream for very verbose output. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:95 │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_R_e_b_i_n_d_L_i_s_t │ │ │ │ │ -typename Impl::RemoveEnd< EndMark, TypeList< Types... > >::type RebindList │ │ │ │ │ -A list of types with the final element removed. │ │ │ │ │ -DDeeffiinniittiioonn test.hh:158 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_I_s_L_o_o_p │ │ │ │ │ -typename Impl::IsLoop< T >::type IsLoop │ │ │ │ │ -check whether a type is an instance of LoopSIMD │ │ │ │ │ -DDeeffiinniittiioonn test.hh:162 │ │ │ │ │ -_D_u_n_e_:_:_L_o_o_p_S_I_M_D │ │ │ │ │ -DDeeffiinniittiioonn loop.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_E_n_d_M_a_r_k │ │ │ │ │ -final element marker for RebindList │ │ │ │ │ -DDeeffiinniittiioonn test.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t │ │ │ │ │ -DDeeffiinniittiioonn test.hh:164 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_U_n_a_r_y_O_p_s │ │ │ │ │ -void checkUnaryOps() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1909 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s │ │ │ │ │ -void checkBinaryOps() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1952 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_S_c_a_l_a_r_V_e_c_t_o_r │ │ │ │ │ -void checkBinaryOpsScalarVector() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1970 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_T_y_p_e │ │ │ │ │ -void checkType() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1866 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k │ │ │ │ │ -void check() │ │ │ │ │ -run unit tests for simd vector type V │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1839 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_S_c_a_l_a_r │ │ │ │ │ -void checkBinaryOpsVectorScalar() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1985 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_g_o_o_d │ │ │ │ │ -bool good() const │ │ │ │ │ -whether all tests succeeded │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1859 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_V_e_c_t_o_r │ │ │ │ │ -void checkBinaryOpsVectorVector() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1960 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_N_o_n_O_p_s │ │ │ │ │ -void checkNonOps() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:1878 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_P_r_o_x_y │ │ │ │ │ -void checkBinaryOpsVectorProxy() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:2010 │ │ │ │ │ -_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_P_r_o_x_y_V_e_c_t_o_r │ │ │ │ │ -void checkBinaryOpsProxyVector() │ │ │ │ │ -DDeeffiinniittiioonn test.hh:2000 │ │ │ │ │ -_D_u_n_e_:_:_A_l_w_a_y_s_T_r_u_e │ │ │ │ │ -template which always yields a true value │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:134 │ │ │ │ │ -_s_i_m_d_._h_h │ │ │ │ │ -Include file for users of the SIMD abstraction layer. │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s │ │ │ │ │ +A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ +DDeeffiinniittiioonn mpitraits.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_:_:_g_e_t_T_y_p_e │ │ │ │ │ +static MPI_Datatype getType() │ │ │ │ │ +DDeeffiinniittiioonn mpitraits.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r │ │ │ │ │ +Default exception class for range errors. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:254 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ +A pair consisting of a global and local index. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_a_l_i_d_I_n_d_e_x_S_e_t_S_t_a_t_e │ │ │ │ │ +Exception indicating that the index set is not in the expected state. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:205 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Manager class for the mapping between local indices and globally unique │ │ │ │ │ +indices. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r │ │ │ │ │ +Class for recomputing missing indices of a distributed index set. │ │ │ │ │ +DDeeffiinniittiioonn indicessyncer.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r │ │ │ │ │ +Base class of all classes representing a communication interface. │ │ │ │ │ +DDeeffiinniittiioonn parallel/interface.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +An index present on the local process with an additional attribute flag. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +The indices present on remote processes. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_g_e_t_N_e_i_g_h_b_o_u_r_s │ │ │ │ │ +const std::set< int > & getNeighbours() const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:307 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex │ │ │ │ │ +Type of the remote indices we manage. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:231 │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ +RemoteIndices() │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:977 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s │ │ │ │ │ +friend void fillIndexSetHoles(const G &graph, Dune:: │ │ │ │ │ +OwnerOverlapCopyCommunication< T1, T2 > &oocomm) │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_s_e_t_I_n_d_e_x_S_e_t_s │ │ │ │ │ +void setIndexSets(const ParallelIndexSet &source, const ParallelIndexSet │ │ │ │ │ +&destination, const MPI_Comm &comm, const std::vector< int > &neighbours=std:: │ │ │ │ │ +vector< int >()) │ │ │ │ │ +Set the index sets and communicator we work with. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:984 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_f_r_e_e │ │ │ │ │ +void free() │ │ │ │ │ +Free the index lists. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1429 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s │ │ │ │ │ +friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename │ │ │ │ │ +T1::GlobalIndex, typename T1::LocalIndex::Attribute >, A2 > > &, RemoteIndices< │ │ │ │ │ +T1, A1 > &, const T1 &) │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ │ +The type of the global index. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:215 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_r_e_b_u_i_l_d │ │ │ │ │ +void rebuild() │ │ │ │ │ +Rebuilds the set of remote indices. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1453 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +T ParallelIndexSet │ │ │ │ │ +Type of the index set we use, e.g. ParallelLocalIndexSet. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +MPI_Comm communicator() const │ │ │ │ │ +Get the mpi communicator used. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1696 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ +LocalIndex::Attribute Attribute │ │ │ │ │ +The type of the attribute. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:226 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +CollectiveIteratorT iterator() const │ │ │ │ │ +Get an iterator for colletively iterating over the remote indices of all remote │ │ │ │ │ +processes. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1690 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_s_e_t_I_n_c_l_u_d_e_S_e_l_f │ │ │ │ │ +void setIncludeSelf(bool includeSelf) │ │ │ │ │ +Tell whether sending from indices of the processor to other indices on the same │ │ │ │ │ +processor is enabled ... │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:971 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +Get an iterator over all remote index lists. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1529 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const RemoteIndices &ri) const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1536 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_R_e_m_o_t_e_I_n_d_e_x_M_a_p │ │ │ │ │ +std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > │ │ │ │ │ +RemoteIndexMap │ │ │ │ │ +The type of the map from rank to remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:245 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_s_e_t_N_e_i_g_h_b_o_u_r_s │ │ │ │ │ +void setNeighbours(const C &neighbours) │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_g_e_t_M_o_d_i_f_i_e_r │ │ │ │ │ +RemoteIndexListModifier< T, A, mode > getModifier(int process) │ │ │ │ │ +Get a modifier for a remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1480 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_s_o_u_r_c_e_I_n_d_e_x_S_e_t │ │ │ │ │ +const ParallelIndexSet & sourceIndexSet() const │ │ │ │ │ +Get the index set at the source. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:999 │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ +~RemoteIndices() │ │ │ │ │ +Destructor. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1014 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t │ │ │ │ │ +Dune::SLList< RemoteIndex, Allocator > RemoteIndexList │ │ │ │ │ +The type of the remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:241 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_n_e_i_g_h_b_o_u_r_s │ │ │ │ │ +int neighbours() const │ │ │ │ │ +Get the number of processors we share indices with. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1446 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +CollectiveIterator< T, A > CollectiveIteratorT │ │ │ │ │ +The type of the collective iterator over all remote indices. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:210 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_d_e_s_t_i_n_a_t_i_o_n_I_n_d_e_x_S_e_t │ │ │ │ │ +const ParallelIndexSet & destinationIndexSet() const │ │ │ │ │ +Get the index set at destination. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1007 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > │ │ │ │ │ +Allocator │ │ │ │ │ +The type of the allocator for the remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_f_i_n_d │ │ │ │ │ +const_iterator find(int proc) const │ │ │ │ │ +Find an iterator over the remote index lists of a specific process. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1515 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_i_s_S_y_n_c_e_d │ │ │ │ │ +bool isSynced() const │ │ │ │ │ +Checks whether the remote indices are synced with the indexsets. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1473 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +Get an iterator over all remote index lists. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1522 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ │ +The type of the local index. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:221 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +RemoteIndexMap::const_iterator const_iterator │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:247 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +Information about an index residing on another processor. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ │ +const Attribute attribute() const │ │ │ │ │ +Get the attribute of the index on the remote process. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:946 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s │ │ │ │ │ +friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename │ │ │ │ │ +T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &, RemoteIndices< T, │ │ │ │ │ +A1 > &, const T &) │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const RemoteIndex &ri) const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:934 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +T1 GlobalIndex │ │ │ │ │ +the type of the global index. This type has to provide at least a operator< for │ │ │ │ │ +sorting. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ +T2 Attribute │ │ │ │ │ +The type of the attributes. Normally this will be an enumeration like. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_P_a_i_r_T_y_p_e │ │ │ │ │ +IndexPair< GlobalIndex, ParallelLocalIndex< Attribute > > PairType │ │ │ │ │ +The type of the index pair. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_l_o_c_a_l_I_n_d_e_x_P_a_i_r │ │ │ │ │ +const PairType & localIndexPair() const │ │ │ │ │ +Get the corresponding local index pair. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:952 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +RemoteIndex() │ │ │ │ │ +Parameterless Constructor. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:930 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const RemoteIndex &ri) const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:940 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r │ │ │ │ │ +Modifier for adding and/or deleting remote indices from the remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:551 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s │ │ │ │ │ +void repairLocalIndexPointers() │ │ │ │ │ +Repair the pointers to the local index pairs. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1575 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t │ │ │ │ │ +Dune::SLList< RemoteIndex, Allocator > RemoteIndexList │ │ │ │ │ +The type of the remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:602 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +A Allocator │ │ │ │ │ +The type of the allocator for the remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:598 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_i_n_s_e_r_t │ │ │ │ │ +void insert(const RemoteIndex &index) │ │ │ │ │ +Insert an index to the list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1605 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ │ +The type of the global index. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:578 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ │ +The type of the local index. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:583 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +RemoteIndexList::const_iterator ConstIterator │ │ │ │ │ +The type of the remote index list iterator. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:612 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListModifyIterator< RemoteIndex, Allocator > ModifyIterator │ │ │ │ │ +The type of the modifying iterator of the remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:607 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_r_e_m_o_v_e │ │ │ │ │ +bool remove(const GlobalIndex &global) │ │ │ │ │ +Remove a remote index. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1653 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +T ParallelIndexSet │ │ │ │ │ +Type of the index set we use. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:573 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r │ │ │ │ │ +RemoteIndexListModifier() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:676 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ +LocalIndex::Attribute Attribute │ │ │ │ │ +The type of the attribute. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:588 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex │ │ │ │ │ +Type of the remote indices we manage. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:593 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_M_O_D_I_F_Y_I_N_D_E_X_S_E_T │ │ │ │ │ +static constexpr bool MODIFYINDEXSET │ │ │ │ │ +If true the index set corresponding to the remote indices might get modified. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:568 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r │ │ │ │ │ +A collective iterator for moving over the remote indices for all processes │ │ │ │ │ +collectively. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:708 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +CollectiveIterator & operator++() │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1779 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1822 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r │ │ │ │ │ +CollectiveIterator(const RemoteIndexMap &map_, bool send) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1703 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_e_m_p_t_y │ │ │ │ │ +bool empty() const │ │ │ │ │ +Checks whether there are still iterators in the map. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1804 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ +void advance(const GlobalIndex &global) │ │ │ │ │ +Advances all underlying iterators. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1716 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_R_e_m_o_t_e_I_n_d_e_x_M_a_p │ │ │ │ │ +std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > │ │ │ │ │ +RemoteIndexMap │ │ │ │ │ +The type of the map from rank to remote index list. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:748 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:1811 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r_:_:_I_n_v_a_l_i_d_P_o_s_i_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:558 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +Iterator over the valid underlying iterators. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:792 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex │ │ │ │ │ +&index) │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:799 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +iterator(const iterator &other) │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:817 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +const RemoteIndex & operator*() const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:838 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_C_o_n_s_t_R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ +Map::iterator ConstRealIterator │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:795 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +iterator & operator++() │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:822 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ +const RemoteIndex * operator->() const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:850 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const iterator &other) const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:856 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_p_r_o_c_e_s_s │ │ │ │ │ +int process() const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:844 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex │ │ │ │ │ +index, Attribute attribute) │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:807 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const iterator &other) const │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:862 │ │ │ │ │ +_D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r_:_:_R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ +Map::iterator RealIterator │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:794 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +A constant iterator for the SLList. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:371 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r │ │ │ │ │ +A mutable iterator for the SLList. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:429 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t │ │ │ │ │ +A single linked list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:44 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00077.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: bigunsignedint.hh File Reference │ │ │ │ +dune-common: mpidata.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,102 +65,61 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ Functions
│ │ │ │ -
bigunsignedint.hh File Reference
│ │ │ │ +
mpidata.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Portable very large unsigned integers. │ │ │ │ +

Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls. │ │ │ │ More...

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <cstdint>
│ │ │ │ -#include <cstdlib>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/hash.hh>
│ │ │ │ +
#include <vector>
│ │ │ │ +#include <string>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/std/type_traits.hh>
│ │ │ │ +#include <dune/common/parallel/mpitraits.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::bigunsignedint< k >
 Portable very large unsigned integers. More...
struct  Dune::MPIData< T, Enable >
 
struct  Dune::IsNumber< bigunsignedint< k > >
 Declare big unsigned int is a number. More...
struct  Dune::MPIData< void >
 
struct  Dune::MPIData< T, std::void_t< std::tuple< decltype(std::declval< T >().data()), decltype(std::declval< T >().size()), typename std::decay_t< T >::value_type > > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  std
 STL namespace.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Macros

#define DUNE_BINOP(OP)
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<int k>
std::ostream & Dune::operator<< (std::ostream &s, const bigunsignedint< k > &x)
 
template<int k>
bigunsignedint< k > Dune::operator+ (const bigunsignedint< k > &x, std::uintmax_t y)
 
template<int k>
bigunsignedint< k > Dune::operator- (const bigunsignedint< k > &x, std::uintmax_t y)
 
template<int k>
bigunsignedint< k > Dune::operator* (const bigunsignedint< k > &x, std::uintmax_t y)
 
template<int k>
bigunsignedint< k > Dune::operator/ (const bigunsignedint< k > &x, std::uintmax_t y)
 
template<int k>
bigunsignedint< k > Dune::operator% (const bigunsignedint< k > &x, std::uintmax_t y)
 
template<int k>
bigunsignedint< k > Dune::operator+ (std::uintmax_t x, const bigunsignedint< k > &y)
 
template<int k>
bigunsignedint< k > Dune::operator- (std::uintmax_t x, const bigunsignedint< k > &y)
 
template<int k>
bigunsignedint< k > Dune::operator* (std::uintmax_t x, const bigunsignedint< k > &y)
 
template<int k>
bigunsignedint< k > Dune::operator/ (std::uintmax_t x, const bigunsignedint< k > &y)
 
template<int k>
bigunsignedint< k > Dune::operator% (std::uintmax_t x, const bigunsignedint< k > &y)
 
template<class T >
auto Dune::getMPIData (T &t)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Portable very large unsigned integers.

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

Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.

│ │ │ │ +

Furthermore it can be used to resize the object if possible. This makes it possible to receive a message with variable size. See Communication::rrecv.

│ │ │ │ +

To 'register' a new dynamic type for MPI communication specialize MPIData or overload getMPIData.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,86 +1,44 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -bigunsignedint.hh File Reference │ │ │ │ │ -Portable very large unsigned integers. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_a_s_h_._h_h> │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ +mpidata.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ +MPI calls. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_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_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_ _k_ _> │ │ │ │ │ -  Portable very large unsigned integers. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _E_n_a_b_l_e_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_N_u_m_b_e_r_<_ _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_ _k_ _>_ _> │ │ │ │ │ -  Declare big unsigned int is a number. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _> │ │ │ │ │ + _(_)_._d_a_t_a_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_: │ │ │ │ │ + _d_e_c_a_y___t_<_ _T_ _>_:_:_v_a_l_u_e___t_y_p_e_ _>_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _s_t_d │ │ │ │ │ -  STL namespace. │ │ │ │ │ -  │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___B_I_N_O_P(OP) │ │ │ │ │ -  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &s, const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k │ │ │ │ │ - > &x) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_+ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k > &x, std:: │ │ │ │ │ - uintmax_t y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_- (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k > &x, std:: │ │ │ │ │ - uintmax_t y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_* (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k > &x, std:: │ │ │ │ │ - uintmax_t y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_/ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k > &x, std:: │ │ │ │ │ - uintmax_t y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_% (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k > &x, std:: │ │ │ │ │ - uintmax_t y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_+ (std::uintmax_t x, const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k │ │ │ │ │ - > &y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_- (std::uintmax_t x, const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k │ │ │ │ │ - > &y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_* (std::uintmax_t x, const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k │ │ │ │ │ - > &y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_/ (std::uintmax_t x, const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k │ │ │ │ │ - > &y) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t< k >  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_% (std::uintmax_t x, const _b_i_g_u_n_s_i_g_n_e_d_i_n_t< k │ │ │ │ │ - > &y) │ │ │ │ │ +template │ │ │ │ │ +auto  _D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a (T &t) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Portable very large unsigned integers. │ │ │ │ │ - Author │ │ │ │ │ - Peter Bastian │ │ │ │ │ +Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ +MPI calls. │ │ │ │ │ +Furthermore it can be used to resize the object if possible. This makes it │ │ │ │ │ +possible to receive a message with variable size. See Communication::rrecv. │ │ │ │ │ +To 'register' a new dynamic type for MPI communication specialize MPIData or │ │ │ │ │ +overload getMPIData. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00077_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: bigunsignedint.hh Source File │ │ │ │ +dune-common: mpidata.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,803 +70,196 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
bigunsignedint.hh
│ │ │ │ +
mpidata.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │
5
│ │ │ │ -
6#ifndef DUNE_BIGUNSIGNEDINT_HH
│ │ │ │ -
7#define DUNE_BIGUNSIGNEDINT_HH
│ │ │ │ +
6#ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH
│ │ │ │ +
7#define DUNE_COMMON_PARALLEL_MPIDATA_HH
│ │ │ │
8
│ │ │ │ -
9#include <algorithm>
│ │ │ │ -
10#include <iostream>
│ │ │ │ -
11#include <limits>
│ │ │ │ -
12#include <cstdint>
│ │ │ │ -
13#include <cstdlib>
│ │ │ │ -
14#include <type_traits>
│ │ │ │ - │ │ │ │ -
16#include <dune/common/hash.hh>
│ │ │ │ +
9#include <vector>
│ │ │ │ +
10#include <string>
│ │ │ │ +
11
│ │ │ │ +
12#if HAVE_MPI
│ │ │ │ +
13
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
17
│ │ │ │ -
24namespace Dune
│ │ │ │ -
25{
│ │ │ │ -
26#if HAVE_MPI
│ │ │ │ -
27 template<class K>
│ │ │ │ -
28 struct MPITraits;
│ │ │ │ -
29#endif
│ │ │ │ -
30
│ │ │ │ -
36 namespace Impl {
│ │ │ │ -
37
│ │ │ │ -
38 // numeric_limits_helper provides std::numeric_limits access to the internals
│ │ │ │ -
39 // of bigunsignedint. Previously, the correct specialization of std::numeric_limits
│ │ │ │ -
40 // was a friend of bigunsignedint, but that creates problems on recent versions
│ │ │ │ -
41 // of clang with the alternative libc++ library, because that library declares the
│ │ │ │ -
42 // base template of std::numeric_limits as a class and clang subsequently complains
│ │ │ │ -
43 // if the friend declaration uses 'struct'. Unfortunately, libstdc++ uses a struct,
│ │ │ │ -
44 // making it impossible to keep clang happy for both standard libraries.
│ │ │ │ -
45 // So we move the access helper functionality into a custom struct and simply let
│ │ │ │ -
46 // the numeric_limits specialization inherit from the helper.
│ │ │ │ -
47
│ │ │ │ -
48 template<typename T>
│ │ │ │ -
49 struct numeric_limits_helper
│ │ │ │ -
50 {
│ │ │ │ -
51
│ │ │ │ -
52 protected:
│ │ │ │ -
53
│ │ │ │ -
54 static std::uint16_t& digit(T& big_unsigned_int, std::size_t i)
│ │ │ │ -
55 {
│ │ │ │ -
56 return big_unsigned_int.digit[i];
│ │ │ │ -
57 }
│ │ │ │ +
37namespace Dune{
│ │ │ │ +
38
│ │ │ │ +
39 template<class, class = void>
│ │ │ │ +
40 struct MPIData;
│ │ │ │ +
41
│ │ │ │ +
42 template<class T>
│ │ │ │ +
│ │ │ │ +
43 auto getMPIData(T& t){
│ │ │ │ +
44 return MPIData<T>(t);
│ │ │ │ +
45 }
│ │ │ │ +
│ │ │ │ +
46
│ │ │ │ +
47 // Default implementation for static datatypes
│ │ │ │ +
48 template<class T, class Enable>
│ │ │ │ +
│ │ │ │ +
49 struct MPIData
│ │ │ │ +
50 {
│ │ │ │ +
51 friend auto getMPIData<T>(T&);
│ │ │ │ +
52 protected:
│ │ │ │ + │ │ │ │ +
54
│ │ │ │ +
│ │ │ │ +
55 MPIData(T& t)
│ │ │ │ +
56 : data_(t)
│ │ │ │ +
57 {}
│ │ │ │ +
│ │ │ │
58
│ │ │ │ -
59 };
│ │ │ │ -
60
│ │ │ │ -
61 }
│ │ │ │ -
62
│ │ │ │ -
72 template<int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
74 public:
│ │ │ │ +
59 public:
│ │ │ │ +
│ │ │ │ +
60 void* ptr() const {
│ │ │ │ +
61 return (void*)&data_;
│ │ │ │ +
62 }
│ │ │ │ +
│ │ │ │ +
63
│ │ │ │ +
64 // indicates whether the datatype can be resized
│ │ │ │ +
65 static constexpr bool static_size = true;
│ │ │ │ +
66
│ │ │ │ +
│ │ │ │ +
67 int size() const{
│ │ │ │ +
68 return 1;
│ │ │ │ +
69 }
│ │ │ │ +
│ │ │ │ +
70
│ │ │ │ +
│ │ │ │ +
71 MPI_Datatype type() const {
│ │ │ │ +
72 return MPITraits<std::decay_t<T>>::getType();
│ │ │ │ +
73 }
│ │ │ │ +
│ │ │ │ +
74 };
│ │ │ │ +
│ │ │ │
75
│ │ │ │ -
76 // unsigned short is 16 bits wide, n is the number of digits needed
│ │ │ │ -
77 constexpr static int bits = std::numeric_limits<std::uint16_t>::digits;
│ │ │ │ -
78 constexpr static int n = k/bits+(k%bits!=0);
│ │ │ │ -
79 constexpr static int hexdigits = 4;
│ │ │ │ -
80 constexpr static int bitmask = 0xFFFF;
│ │ │ │ -
81 constexpr static int compbitmask = 0xFFFF0000;
│ │ │ │ -
82 constexpr static int overflowmask = 0x1;
│ │ │ │ -
83
│ │ │ │ - │ │ │ │ -
86
│ │ │ │ -
88 template<typename Signed>
│ │ │ │ -
89 bigunsignedint (Signed x, typename std::enable_if<std::is_integral<Signed>::value && std::is_signed<Signed>::value>::type* = 0);
│ │ │ │ -
90
│ │ │ │ -
92 bigunsignedint (std::uintmax_t x);
│ │ │ │ -
93
│ │ │ │ -
95 void print (std::ostream& s) const ;
│ │ │ │ -
96
│ │ │ │ - │ │ │ │ - │ │ │ │ -
100
│ │ │ │ - │ │ │ │ - │ │ │ │ +
76 // dummy implementation for void
│ │ │ │ +
77 template<>
│ │ │ │ +
│ │ │ │ +
78 struct MPIData<void>{
│ │ │ │ +
79 protected:
│ │ │ │ + │ │ │ │ +
81
│ │ │ │ +
82 public:
│ │ │ │ +
│ │ │ │ +
83 void* ptr(){
│ │ │ │ +
84 return nullptr;
│ │ │ │ +
85 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
86 int size(){
│ │ │ │ +
87 return 0;
│ │ │ │ +
88 }
│ │ │ │ +
│ │ │ │ +
89 void get(){}
│ │ │ │ +
│ │ │ │ +
90 MPI_Datatype type() const{
│ │ │ │ +
91 return MPI_INT;
│ │ │ │ +
92 }
│ │ │ │ +
│ │ │ │ +
93 };
│ │ │ │ +
│ │ │ │ +
94
│ │ │ │ +
95 // specializations:
│ │ │ │ +
96 // std::vector of static sized elements or std::string
│ │ │ │ +
97 template<class T>
│ │ │ │ +
│ │ │ │ +
98 struct MPIData<T, std::void_t<std::tuple<decltype(std::declval<T>().data()),
│ │ │ │ +
99 decltype(std::declval<T>().size()),
│ │ │ │ +
100 typename std::decay_t<T>::value_type>>>{
│ │ │ │ +
101 private:
│ │ │ │ +
102 template<class U>
│ │ │ │ +
103 using hasResizeOp = decltype(std::declval<U>().resize(0));
│ │ │ │
104
│ │ │ │ - │ │ │ │ - │ │ │ │ -
108
│ │ │ │ - │ │ │ │ -
111
│ │ │ │ - │ │ │ │ - │ │ │ │ -
117
│ │ │ │ - │ │ │ │ - │ │ │ │ -
123
│ │ │ │ - │ │ │ │ - │ │ │ │ -
127
│ │ │ │ - │ │ │ │ - │ │ │ │ -
131
│ │ │ │ - │ │ │ │ - │ │ │ │ -
135
│ │ │ │ - │ │ │ │ -
138
│ │ │ │ -
139
│ │ │ │ -
141 bigunsignedint<k> operator<< (int i) const;
│ │ │ │ -
142
│ │ │ │ -
144 bigunsignedint<k> operator>> (int i) const;
│ │ │ │ -
145
│ │ │ │ -
146
│ │ │ │ -
148 bool operator< (const bigunsignedint<k>& x) const;
│ │ │ │ -
149
│ │ │ │ -
151 bool operator<= (const bigunsignedint<k>& x) const;
│ │ │ │ -
152
│ │ │ │ -
154 bool operator> (const bigunsignedint<k>& x) const;
│ │ │ │ -
155
│ │ │ │ -
157 bool operator>= (const bigunsignedint<k>& x) const;
│ │ │ │ -
158
│ │ │ │ -
160 bool operator== (const bigunsignedint<k>& x) const;
│ │ │ │ -
161
│ │ │ │ -
163 bool operator!= (const bigunsignedint<k>& x) const;
│ │ │ │ -
164
│ │ │ │ -
165
│ │ │ │ -
167 // operator unsigned int () const;
│ │ │ │ -
168 std::uint_least32_t touint() const;
│ │ │ │ -
174 double todouble() const;
│ │ │ │ -
175
│ │ │ │ -
176 friend class bigunsignedint<k/2>;
│ │ │ │ -
177 friend struct Impl::numeric_limits_helper< bigunsignedint<k> >;
│ │ │ │ -
178
│ │ │ │ -
│ │ │ │ -
179 inline friend std::size_t hash_value(const bigunsignedint& arg)
│ │ │ │ -
180 {
│ │ │ │ -
181 return hash_range(arg.digit,arg.digit + arg.n);
│ │ │ │ -
182 }
│ │ │ │ -
│ │ │ │ -
183
│ │ │ │ -
184 private:
│ │ │ │ -
185 std::uint16_t digit[n];
│ │ │ │ -
186#if HAVE_MPI
│ │ │ │ -
187 friend struct MPITraits<bigunsignedint<k> >;
│ │ │ │ -
188#endif
│ │ │ │ -
189 inline void assign(std::uintmax_t x);
│ │ │ │ -
190
│ │ │ │ -
191
│ │ │ │ -
192 } ;
│ │ │ │ -
│ │ │ │ -
193
│ │ │ │ -
194 // Constructors
│ │ │ │ -
195 template<int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
197 {
│ │ │ │ -
198 assign(0u);
│ │ │ │ -
199 }
│ │ │ │ -
│ │ │ │ -
200
│ │ │ │ -
201 template<int k>
│ │ │ │ -
202 template<typename Signed>
│ │ │ │ -
│ │ │ │ -
203 bigunsignedint<k>::bigunsignedint (Signed y, typename std::enable_if<std::is_integral<Signed>::value && std::is_signed<Signed>::value>::type*)
│ │ │ │ -
204 {
│ │ │ │ -
205 if (y < 0)
│ │ │ │ -
206 DUNE_THROW(Dune::Exception, "Trying to construct a Dune::bigunsignedint from a negative integer: " << y);
│ │ │ │ -
207 assign(y);
│ │ │ │ -
208 }
│ │ │ │ -
│ │ │ │ -
209
│ │ │ │ -
210 template<int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
212 {
│ │ │ │ -
213 assign(x);
│ │ │ │ -
214 }
│ │ │ │ -
│ │ │ │ -
215 template<int k>
│ │ │ │ -
216 void bigunsignedint<k>::assign(std::uintmax_t x)
│ │ │ │ -
217 {
│ │ │ │ -
218 static const int no=std::min(static_cast<int>(n),
│ │ │ │ -
219 static_cast<int>(std::numeric_limits<std::uintmax_t>::digits/bits));
│ │ │ │ -
220
│ │ │ │ -
221 for(int i=0; i<no; ++i) {
│ │ │ │ -
222 digit[i] = (x&bitmask);
│ │ │ │ -
223 x=x>>bits;
│ │ │ │ -
224 }
│ │ │ │ -
225 for (unsigned int i=no; i<n; i++) digit[i]=0;
│ │ │ │ -
226 }
│ │ │ │ -
227
│ │ │ │ -
228 // export
│ │ │ │ -
229 template<int k>
│ │ │ │ -
│ │ │ │ -
230 inline std::uint_least32_t bigunsignedint<k>::touint () const
│ │ │ │ -
231 {
│ │ │ │ -
232 return (digit[1]<<bits)+digit[0];
│ │ │ │ -
233 }
│ │ │ │ -
│ │ │ │ -
234
│ │ │ │ -
235 template<int k>
│ │ │ │ -
│ │ │ │ -
236 inline double bigunsignedint<k>::todouble() const
│ │ │ │ -
237 {
│ │ │ │ -
238 int firstInZeroRange=n;
│ │ │ │ -
239 for(int i=n-1; i>=0; --i)
│ │ │ │ -
240 if(digit[i]!=0)
│ │ │ │ -
241 break;
│ │ │ │ -
242 else
│ │ │ │ -
243 --firstInZeroRange;
│ │ │ │ -
244 int representableDigits=std::numeric_limits<double>::digits/bits;
│ │ │ │ -
245 int lastInRepresentableRange=0;
│ │ │ │ -
246 if(representableDigits<firstInZeroRange)
│ │ │ │ -
247 lastInRepresentableRange=firstInZeroRange-representableDigits;
│ │ │ │ -
248 double val=0;
│ │ │ │ -
249 for(int i=firstInZeroRange-1; i>=lastInRepresentableRange; --i)
│ │ │ │ -
250 val =val*(1<<bits)+digit[i];
│ │ │ │ -
251 return val*(1<<(bits*lastInRepresentableRange));
│ │ │ │ -
252 }
│ │ │ │ -
│ │ │ │ -
253 // print
│ │ │ │ -
254 template<int k>
│ │ │ │ -
│ │ │ │ -
255 inline void bigunsignedint<k>::print (std::ostream& s) const
│ │ │ │ -
256 {
│ │ │ │ -
257 bool leading=false;
│ │ │ │ -
258
│ │ │ │ -
259 // print from left to right
│ │ │ │ -
260 for (int i=n-1; i>=0; i--)
│ │ │ │ -
261 for (int d=hexdigits-1; d>=0; d--)
│ │ │ │ -
262 {
│ │ │ │ -
263 // extract one hex digit
│ │ │ │ -
264 int current = (digit[i]>>(d*4))&0xF;
│ │ │ │ -
265 if (current!=0)
│ │ │ │ -
266 {
│ │ │ │ -
267 // s.setf(std::ios::noshowbase);
│ │ │ │ -
268 s << std::hex << current;
│ │ │ │ -
269 leading = false;
│ │ │ │ -
270 }
│ │ │ │ -
271 else if (!leading) s << std::hex << current;
│ │ │ │ -
272 }
│ │ │ │ -
273 if (leading) s << "0";
│ │ │ │ -
274 s << std::dec;
│ │ │ │ -
275 }
│ │ │ │ -
│ │ │ │ -
276
│ │ │ │ -
277 template <int k>
│ │ │ │ -
│ │ │ │ -
278 inline std::ostream& operator<< (std::ostream& s, const bigunsignedint<k>& x)
│ │ │ │ -
279 {
│ │ │ │ -
280 x.print(s);
│ │ │ │ -
281 return s;
│ │ │ │ -
282 }
│ │ │ │ -
│ │ │ │ -
283
│ │ │ │ -
│ │ │ │ -
284 #define DUNE_BINOP(OP) \
│ │ │ │ -
285 template <int k> \
│ │ │ │ -
286 inline bigunsignedint<k> bigunsignedint<k>::operator OP (const bigunsignedint<k> &x) const \
│ │ │ │ -
287 { \
│ │ │ │ -
288 auto temp = *this; \
│ │ │ │ -
289 temp OP##= x; \
│ │ │ │ -
290 return temp; \
│ │ │ │ -
291 }
│ │ │ │ -
│ │ │ │ -
292
│ │ │ │ -
293 DUNE_BINOP(+)
│ │ │ │ -
294 DUNE_BINOP(-)
│ │ │ │ -
295 DUNE_BINOP(*)
│ │ │ │ -
296 DUNE_BINOP(/)
│ │ │ │ -
297 DUNE_BINOP(%)
│ │ │ │ -
298 DUNE_BINOP(&)
│ │ │ │ -
299 DUNE_BINOP(^)
│ │ │ │ -
300 DUNE_BINOP(|)
│ │ │ │ -
301
│ │ │ │ -
302 #undef DUNE_BINOP
│ │ │ │ -
303
│ │ │ │ -
304 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
306 {
│ │ │ │ -
307 std::uint_fast32_t overflow=0;
│ │ │ │ -
308
│ │ │ │ -
309 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
310 {
│ │ │ │ -
311 std::uint_fast32_t sum = static_cast<std::uint_fast32_t>(digit[i]) + static_cast<std::uint_fast32_t>(x.digit[i]) + overflow;
│ │ │ │ -
312 digit[i] = sum&bitmask;
│ │ │ │ -
313 overflow = (sum>>bits)&overflowmask;
│ │ │ │ -
314 }
│ │ │ │ -
315 return *this;
│ │ │ │ -
316 }
│ │ │ │ -
│ │ │ │ -
317
│ │ │ │ -
318 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
320 {
│ │ │ │ -
321 std::int_fast32_t overflow=0;
│ │ │ │ -
322
│ │ │ │ -
323 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
324 {
│ │ │ │ -
325 std::int_fast32_t diff = static_cast<std::int_fast32_t>(digit[i]) - static_cast<std::int_fast32_t>(x.digit[i]) - overflow;
│ │ │ │ -
326 if (diff>=0)
│ │ │ │ -
327 {
│ │ │ │ -
328 digit[i] = static_cast<std::uint16_t>(diff);
│ │ │ │ -
329 overflow = 0;
│ │ │ │ -
330 }
│ │ │ │ -
331 else
│ │ │ │ -
332 {
│ │ │ │ -
333 digit[i] = static_cast<std::uint16_t>(diff+bitmask+1);
│ │ │ │ -
334 overflow = 1;
│ │ │ │ -
335 }
│ │ │ │ -
336 }
│ │ │ │ -
337 return *this;
│ │ │ │ -
338 }
│ │ │ │ -
│ │ │ │ -
339
│ │ │ │ -
340 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
342 {
│ │ │ │ -
343 bigunsignedint<2*k> finalproduct(0);
│ │ │ │ -
344
│ │ │ │ -
345 for (unsigned int m=0; m<n; m++) // digit in right factor
│ │ │ │ -
346 {
│ │ │ │ -
347 bigunsignedint<2*k> singleproduct(0);
│ │ │ │ -
348 std::uint_fast32_t overflow(0);
│ │ │ │ -
349 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
350 {
│ │ │ │ -
351 std::uint_fast32_t digitproduct = static_cast<std::uint_fast32_t>(digit[i])*static_cast<std::uint_fast32_t>(x.digit[m])+overflow;
│ │ │ │ -
352 singleproduct.digit[i+m] = static_cast<std::uint16_t>(digitproduct&bitmask);
│ │ │ │ -
353 overflow = (digitproduct>>bits)&bitmask;
│ │ │ │ -
354 }
│ │ │ │ -
355 finalproduct = finalproduct+singleproduct;
│ │ │ │ -
356 }
│ │ │ │ -
357
│ │ │ │ -
358 for (unsigned int i=0; i<n; i++) digit[i] = finalproduct.digit[i];
│ │ │ │ -
359 return *this;
│ │ │ │ -
360 }
│ │ │ │ -
│ │ │ │ -
361
│ │ │ │ -
362 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
364 {
│ │ │ │ -
365 std::uint_fast32_t overflow=1;
│ │ │ │ -
366
│ │ │ │ -
367 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
368 {
│ │ │ │ -
369 std::uint_fast32_t sum = static_cast<std::uint_fast32_t>(digit[i]) + overflow;
│ │ │ │ -
370 digit[i] = sum&bitmask;
│ │ │ │ -
371 overflow = (sum>>bits)&overflowmask;
│ │ │ │ -
372 }
│ │ │ │ -
373 return *this;
│ │ │ │ -
374 }
│ │ │ │ -
│ │ │ │ -
375
│ │ │ │ -
376 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
378 {
│ │ │ │ -
379 if(x==0)
│ │ │ │ -
380 DUNE_THROW(Dune::MathError, "division by zero!");
│ │ │ │ -
381
│ │ │ │ -
382 // better slow than nothing
│ │ │ │ -
383 bigunsignedint<k> result(0);
│ │ │ │ -
384
│ │ │ │ -
385 while (*this>=x)
│ │ │ │ -
386 {
│ │ │ │ -
387 ++result;
│ │ │ │ -
388 *this -= x;
│ │ │ │ -
389 }
│ │ │ │ -
390
│ │ │ │ -
391 *this = result;
│ │ │ │ -
392 return *this;
│ │ │ │ -
393 }
│ │ │ │ -
│ │ │ │ -
394
│ │ │ │ -
395 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
397 {
│ │ │ │ -
398 // better slow than nothing
│ │ │ │ -
399 while (*this>=x)
│ │ │ │ -
400 {
│ │ │ │ -
401 *this -= x;
│ │ │ │ -
402 }
│ │ │ │ -
403
│ │ │ │ -
404 return *this;
│ │ │ │ -
405 }
│ │ │ │ -
│ │ │ │ -
406
│ │ │ │ -
407 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
409 {
│ │ │ │ -
410 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
411 digit[i] = digit[i]&x.digit[i];
│ │ │ │ -
412 return *this;
│ │ │ │ -
413 }
│ │ │ │ -
│ │ │ │ -
414
│ │ │ │ -
415 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
417 {
│ │ │ │ -
418 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
419 digit[i] = digit[i]^x.digit[i];
│ │ │ │ -
420 return *this;
│ │ │ │ -
421 }
│ │ │ │ -
│ │ │ │ -
422
│ │ │ │ -
423 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
425 {
│ │ │ │ -
426 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
427 digit[i] = digit[i]|x.digit[i];
│ │ │ │ -
428 return *this;
│ │ │ │ -
429 }
│ │ │ │ -
│ │ │ │ -
430
│ │ │ │ -
431 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
433 {
│ │ │ │ -
434 bigunsignedint<k> result;
│ │ │ │ -
435 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
436 result.digit[i] = ~digit[i];
│ │ │ │ -
437 return result;
│ │ │ │ -
438 }
│ │ │ │ -
439
│ │ │ │ -
440 template <int k>
│ │ │ │ - │ │ │ │ -
442 {
│ │ │ │ -
443 bigunsignedint<k> result(0);
│ │ │ │ -
444
│ │ │ │ -
445 // multiples of bits
│ │ │ │ -
446 int j=shift/bits;
│ │ │ │ -
447 for (int i=n-1-j; i>=0; i--)
│ │ │ │ -
448 result.digit[i+j] = digit[i];
│ │ │ │ -
449
│ │ │ │ -
450 // remainder
│ │ │ │ -
451 j=shift%bits;
│ │ │ │ -
452 for (int i=n-1; i>=0; i--)
│ │ │ │ -
453 {
│ │ │ │ -
454 unsigned int temp = result.digit[i];
│ │ │ │ -
455 temp = temp<<j;
│ │ │ │ -
456 result.digit[i] = static_cast<std::uint16_t>(temp&bitmask);
│ │ │ │ -
457 temp = temp>>bits;
│ │ │ │ -
458 if (i+1<(int)n)
│ │ │ │ -
459 result.digit[i+1] = result.digit[i+1]|temp;
│ │ │ │ -
460 }
│ │ │ │ -
461
│ │ │ │ -
462 return result;
│ │ │ │ -
463 }
│ │ │ │ -
│ │ │ │ -
464
│ │ │ │ -
465 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
467 {
│ │ │ │ -
468 bigunsignedint<k> result(0);
│ │ │ │ -
469
│ │ │ │ -
470 // multiples of bits
│ │ │ │ -
471 int j=shift/bits;
│ │ │ │ -
472 for (unsigned int i=0; i<n-j; i++)
│ │ │ │ -
473 result.digit[i] = digit[i+j];
│ │ │ │ -
474
│ │ │ │ -
475 // remainder
│ │ │ │ -
476 j=shift%bits;
│ │ │ │ -
477 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
478 {
│ │ │ │ -
479 std::uint_fast32_t temp = result.digit[i];
│ │ │ │ -
480 temp = temp<<(bits-j);
│ │ │ │ -
481 result.digit[i] = static_cast<std::uint16_t>((temp&compbitmask)>>bits);
│ │ │ │ -
482 if (i>0)
│ │ │ │ -
483 result.digit[i-1] = result.digit[i-1] | (temp&bitmask);
│ │ │ │ -
484 }
│ │ │ │ -
485
│ │ │ │ -
486 return result;
│ │ │ │ -
487 }
│ │ │ │ -
│ │ │ │ -
488
│ │ │ │ -
489 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
491 {
│ │ │ │ -
492 for (unsigned int i=0; i<n; i++)
│ │ │ │ -
493 if (digit[i]!=x.digit[i]) return true;
│ │ │ │ -
494 return false;
│ │ │ │ -
495 }
│ │ │ │ -
│ │ │ │ -
496
│ │ │ │ -
497 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
499 {
│ │ │ │ -
500 return !((*this)!=x);
│ │ │ │ -
501 }
│ │ │ │ -
│ │ │ │ -
502
│ │ │ │ -
503 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
505 {
│ │ │ │ -
506 for (int i=n-1; i>=0; i--)
│ │ │ │ -
507 if (digit[i]<x.digit[i]) return true;
│ │ │ │ -
508 else if (digit[i]>x.digit[i]) return false;
│ │ │ │ -
509 return false;
│ │ │ │ -
510 }
│ │ │ │ -
│ │ │ │ -
511
│ │ │ │ -
512 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
514 {
│ │ │ │ -
515 for (int i=n-1; i>=0; i--)
│ │ │ │ -
516 if (digit[i]<x.digit[i]) return true;
│ │ │ │ -
517 else if (digit[i]>x.digit[i]) return false;
│ │ │ │ -
518 return true;
│ │ │ │ -
519 }
│ │ │ │ -
│ │ │ │ -
520
│ │ │ │ -
521 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
523 {
│ │ │ │ -
524 return !((*this)<=x);
│ │ │ │ -
525 }
│ │ │ │ -
│ │ │ │ -
526
│ │ │ │ -
527 template <int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
529 {
│ │ │ │ -
530 return !((*this)<x);
│ │ │ │ -
531 }
│ │ │ │ -
│ │ │ │ -
532
│ │ │ │ -
533
│ │ │ │ -
534 template <int k>
│ │ │ │ -
│ │ │ │ -
535 inline bigunsignedint<k> operator+ (const bigunsignedint<k>& x, std::uintmax_t y)
│ │ │ │ -
536 {
│ │ │ │ -
537 bigunsignedint<k> temp(y);
│ │ │ │ -
538 return x+temp;
│ │ │ │ -
539 }
│ │ │ │ -
│ │ │ │ -
540
│ │ │ │ -
541 template <int k>
│ │ │ │ -
│ │ │ │ -
542 inline bigunsignedint<k> operator- (const bigunsignedint<k>& x, std::uintmax_t y)
│ │ │ │ -
543 {
│ │ │ │ -
544 bigunsignedint<k> temp(y);
│ │ │ │ -
545 return x-temp;
│ │ │ │ -
546 }
│ │ │ │ -
│ │ │ │ -
547
│ │ │ │ -
548 template <int k>
│ │ │ │ -
│ │ │ │ -
549 inline bigunsignedint<k> operator* (const bigunsignedint<k>& x, std::uintmax_t y)
│ │ │ │ -
550 {
│ │ │ │ -
551 bigunsignedint<k> temp(y);
│ │ │ │ -
552 return x*temp;
│ │ │ │ -
553 }
│ │ │ │ -
│ │ │ │ -
554
│ │ │ │ -
555 template <int k>
│ │ │ │ -
│ │ │ │ -
556 inline bigunsignedint<k> operator/ (const bigunsignedint<k>& x, std::uintmax_t y)
│ │ │ │ -
557 {
│ │ │ │ -
558 bigunsignedint<k> temp(y);
│ │ │ │ -
559 return x/temp;
│ │ │ │ -
560 }
│ │ │ │ -
│ │ │ │ -
561
│ │ │ │ -
562 template <int k>
│ │ │ │ -
│ │ │ │ -
563 inline bigunsignedint<k> operator% (const bigunsignedint<k>& x, std::uintmax_t y)
│ │ │ │ -
564 {
│ │ │ │ -
565 bigunsignedint<k> temp(y);
│ │ │ │ -
566 return x%temp;
│ │ │ │ -
567 }
│ │ │ │ -
│ │ │ │ -
568
│ │ │ │ -
569 template <int k>
│ │ │ │ -
│ │ │ │ -
570 inline bigunsignedint<k> operator+ (std::uintmax_t x, const bigunsignedint<k>& y)
│ │ │ │ -
571 {
│ │ │ │ -
572 bigunsignedint<k> temp(x);
│ │ │ │ -
573 return temp+y;
│ │ │ │ -
574 }
│ │ │ │ -
│ │ │ │ -
575
│ │ │ │ -
576 template <int k>
│ │ │ │ -
│ │ │ │ -
577 inline bigunsignedint<k> operator- (std::uintmax_t x, const bigunsignedint<k>& y)
│ │ │ │ -
578 {
│ │ │ │ -
579 bigunsignedint<k> temp(x);
│ │ │ │ -
580 return temp-y;
│ │ │ │ -
581 }
│ │ │ │ -
│ │ │ │ -
582
│ │ │ │ -
583 template <int k>
│ │ │ │ -
│ │ │ │ -
584 inline bigunsignedint<k> operator* (std::uintmax_t x, const bigunsignedint<k>& y)
│ │ │ │ -
585 {
│ │ │ │ -
586 bigunsignedint<k> temp(x);
│ │ │ │ -
587 return temp*y;
│ │ │ │ -
588 }
│ │ │ │ -
│ │ │ │ -
589
│ │ │ │ -
590 template <int k>
│ │ │ │ -
│ │ │ │ -
591 inline bigunsignedint<k> operator/ (std::uintmax_t x, const bigunsignedint<k>& y)
│ │ │ │ -
592 {
│ │ │ │ -
593 bigunsignedint<k> temp(x);
│ │ │ │ -
594 return temp/y;
│ │ │ │ -
595 }
│ │ │ │ -
│ │ │ │ -
596
│ │ │ │ -
597 template <int k>
│ │ │ │ -
│ │ │ │ -
598 inline bigunsignedint<k> operator% (std::uintmax_t x, const bigunsignedint<k>& y)
│ │ │ │ -
599 {
│ │ │ │ -
600 bigunsignedint<k> temp(x);
│ │ │ │ -
601 return temp%y;
│ │ │ │ -
602 }
│ │ │ │ -
│ │ │ │ -
603
│ │ │ │ -
604 // Forward declare type-trait for numbers
│ │ │ │ -
605 template<class T> struct IsNumber;
│ │ │ │ -
606
│ │ │ │ -
608 template <int k>
│ │ │ │ -
609 struct IsNumber<bigunsignedint<k>> : public std::true_type {};
│ │ │ │ -
610
│ │ │ │ -
612}
│ │ │ │ -
613
│ │ │ │ -
614namespace std
│ │ │ │ -
615{
│ │ │ │ -
616 template<int k>
│ │ │ │ -
617 struct numeric_limits<Dune::bigunsignedint<k> >
│ │ │ │ -
618 : private Dune::Impl::numeric_limits_helper<Dune::bigunsignedint<k> > // for access to internal state of bigunsignedint
│ │ │ │ -
619 {
│ │ │ │ -
620 public:
│ │ │ │ -
621 static const bool is_specialized = true;
│ │ │ │ -
622
│ │ │ │ -
623 static Dune::bigunsignedint<k> min()
│ │ │ │ -
624 {
│ │ │ │ -
625 return static_cast<Dune::bigunsignedint<k> >(0);
│ │ │ │ -
626 }
│ │ │ │ -
627
│ │ │ │ - │ │ │ │ -
629 {
│ │ │ │ - │ │ │ │ -
631 for(std::size_t i=0; i < Dune::bigunsignedint<k>::n; ++i)
│ │ │ │ -
632 // access internal state via the helper base class
│ │ │ │ -
633 Dune::Impl::numeric_limits_helper<Dune::bigunsignedint<k> >::
│ │ │ │ -
634 digit(max_,i)=std::numeric_limits<std::uint16_t>::max();
│ │ │ │ -
635 return max_;
│ │ │ │ -
636 }
│ │ │ │ -
637
│ │ │ │ -
638
│ │ │ │ -
639 static const int digits = Dune::bigunsignedint<k>::bits *
│ │ │ │ - │ │ │ │ -
641 static const bool is_signed = false;
│ │ │ │ -
642 static const bool is_integer = true;
│ │ │ │ -
643 static const bool is_exact = true;
│ │ │ │ -
644 static const int radix = 2;
│ │ │ │ -
645
│ │ │ │ -
646 static Dune::bigunsignedint<k> epsilon()
│ │ │ │ -
647 {
│ │ │ │ -
648 return static_cast<Dune::bigunsignedint<k> >(0);
│ │ │ │ -
649 }
│ │ │ │ -
650
│ │ │ │ -
651 static Dune::bigunsignedint<k> round_error()
│ │ │ │ -
652 {
│ │ │ │ -
653 return static_cast<Dune::bigunsignedint<k> >(0);
│ │ │ │ -
654 }
│ │ │ │ -
655
│ │ │ │ -
656 static const int min_exponent = 0;
│ │ │ │ -
657 static const int min_exponent10 = 0;
│ │ │ │ -
658 static const int max_exponent = 0;
│ │ │ │ -
659 static const int max_exponent10 = 0;
│ │ │ │ -
660
│ │ │ │ -
661 static const bool has_infinity = false;
│ │ │ │ -
662 static const bool has_quiet_NaN = false;
│ │ │ │ -
663 static const bool has_signaling_NaN = false;
│ │ │ │ -
664
│ │ │ │ -
665 static const float_denorm_style has_denorm = denorm_absent;
│ │ │ │ -
666 static const bool has_denorm_loss = false;
│ │ │ │ -
667
│ │ │ │ -
668 static Dune::bigunsignedint<k> infinity() noexcept
│ │ │ │ -
669 {
│ │ │ │ -
670 return static_cast<Dune::bigunsignedint<k> >(0);
│ │ │ │ -
671 }
│ │ │ │ -
672
│ │ │ │ -
673 static Dune::bigunsignedint<k> quiet_NaN() noexcept
│ │ │ │ -
674 {
│ │ │ │ -
675 return static_cast<Dune::bigunsignedint<k> >(0);
│ │ │ │ -
676 }
│ │ │ │ -
677
│ │ │ │ -
678 static Dune::bigunsignedint<k> signaling_NaN() noexcept
│ │ │ │ -
679 {
│ │ │ │ -
680 return static_cast<Dune::bigunsignedint<k> >(0);
│ │ │ │ -
681 }
│ │ │ │ -
682
│ │ │ │ -
683 static Dune::bigunsignedint<k> denorm_min() noexcept
│ │ │ │ -
684 {
│ │ │ │ -
685 return static_cast<Dune::bigunsignedint<k> >(0);
│ │ │ │ -
686 }
│ │ │ │ -
687
│ │ │ │ -
688 static const bool is_iec559 = false;
│ │ │ │ -
689 static const bool is_bounded = true;
│ │ │ │ -
690 static const bool is_modulo = true;
│ │ │ │ -
691
│ │ │ │ -
692 static const bool traps = false;
│ │ │ │ -
693 static const bool tinyness_before = false;
│ │ │ │ -
694 static const float_round_style round_style = round_toward_zero;
│ │ │ │ -
695
│ │ │ │ -
696 };
│ │ │ │ -
697
│ │ │ │ -
698}
│ │ │ │ -
699
│ │ │ │ - │ │ │ │ -
701
│ │ │ │ -
702#endif
│ │ │ │ -
Support for calculating hash values of objects.
│ │ │ │ -
#define DUNE_DEFINE_HASH(template_args, type)
Defines the required struct specialization to make type hashable via Dune::hash.
Definition hash.hh:100
│ │ │ │ -
#define DUNE_HASH_TYPE(...)
Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.
Definition hash.hh:117
│ │ │ │ -
#define DUNE_HASH_TEMPLATE_ARGS(...)
Wrapper macro for the template arguments in DUNE_DEFINE_HASH.
Definition hash.hh:109
│ │ │ │ -
A few common exception classes.
│ │ │ │ -
bigunsignedint< k > & operator/=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:377
│ │ │ │ -
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:549
│ │ │ │ -
bigunsignedint< k > operator<<(int i) const
left shift
Definition bigunsignedint.hh:441
│ │ │ │ -
bigunsignedint< k > & operator+=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:305
│ │ │ │ -
bigunsignedint< k > & operator^=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:416
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ -
bool operator<=(const bigunsignedint< k > &x) const
less than or equal
Definition bigunsignedint.hh:513
│ │ │ │ -
void print(std::ostream &s) const
Print number in hex notation.
Definition bigunsignedint.hh:255
│ │ │ │ -
bool operator<(const bigunsignedint< k > &x) const
less than
Definition bigunsignedint.hh:504
│ │ │ │ -
bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:556
│ │ │ │ -
bool operator==(const bigunsignedint< k > &x) const
equal
Definition bigunsignedint.hh:498
│ │ │ │ -
bool operator!=(const bigunsignedint< k > &x) const
not equal
Definition bigunsignedint.hh:490
│ │ │ │ -
bigunsignedint()
Construct uninitialized.
Definition bigunsignedint.hh:196
│ │ │ │ -
bigunsignedint< k > & operator&=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:408
│ │ │ │ -
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:542
│ │ │ │ -
bool operator>=(const bigunsignedint< k > &x) const
greater or equal
Definition bigunsignedint.hh:528
│ │ │ │ -
bigunsignedint< k > operator>>(int i) const
right shift
Definition bigunsignedint.hh:466
│ │ │ │ -
bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:535
│ │ │ │ -
bigunsignedint< k > operator~() const
bitwise complement
Definition bigunsignedint.hh:432
│ │ │ │ -
bigunsignedint< k > & operator++()
prefix increment
Definition bigunsignedint.hh:363
│ │ │ │ -
bigunsignedint< k > & operator|=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:424
│ │ │ │ -
bigunsignedint< k > operator%(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:563
│ │ │ │ -
bigunsignedint< k > & operator%=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:396
│ │ │ │ -
double todouble() const
Convert to a double.
Definition bigunsignedint.hh:236
│ │ │ │ -
bigunsignedint< k > & operator-=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:319
│ │ │ │ -
bool operator>(const bigunsignedint< k > &x) const
greater than
Definition bigunsignedint.hh:522
│ │ │ │ -
bigunsignedint< k > & operator*=(const bigunsignedint< k > &x)
Definition bigunsignedint.hh:341
│ │ │ │ -
std::uint_least32_t touint() const
export to other types
Definition bigunsignedint.hh:230
│ │ │ │ -
#define DUNE_BINOP(OP)
Definition bigunsignedint.hh:284
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
105 protected:
│ │ │ │ +
106 friend auto getMPIData<T>(T&);
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
108 : data_(t)
│ │ │ │ +
109 {}
│ │ │ │ +
│ │ │ │ +
110 public:
│ │ │ │ +
111 static constexpr bool static_size = std::is_const<T>::value || !Std::is_detected_v<hasResizeOp, T>;
│ │ │ │ +
│ │ │ │ +
112 void* ptr() {
│ │ │ │ +
113 return (void*) data_.data();
│ │ │ │ +
114 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
115 int size() {
│ │ │ │ +
116 return data_.size();
│ │ │ │ +
117 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
118 MPI_Datatype type() const{
│ │ │ │ + │ │ │ │ +
120 }
│ │ │ │ +
│ │ │ │ +
121
│ │ │ │ +
122 template<class S = T>
│ │ │ │ +
│ │ │ │ +
123 auto /*void*/ resize(int size)
│ │ │ │ +
124 -> std::enable_if_t<!std::is_const<S>::value || !Std::is_detected_v<hasResizeOp, S>>
│ │ │ │ +
125 {
│ │ │ │ +
126 data_.resize(size);
│ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │ +
128
│ │ │ │ +
129 protected:
│ │ │ │ + │ │ │ │ +
131 };
│ │ │ │ +
│ │ │ │ +
132
│ │ │ │ +
133}
│ │ │ │ +
134
│ │ │ │ +
139#endif
│ │ │ │ +
140#endif
│ │ │ │ +
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ + │ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition typetraits.hh:40
│ │ │ │
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
std::size_t hash_range(It first, It last)
Hashes all elements in the range [first,last) and returns the combined hash.
Definition hash.hh:322
│ │ │ │ -
void assign(T &dst, const T &src, bool mask)
masked Simd assignment (scalar version)
Definition simd.hh:447
│ │ │ │ -
auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
Definition debugalign.hh:425
│ │ │ │ +
auto getMPIData(T &t)
Definition mpidata.hh:43
│ │ │ │
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
│ │ │ │ -
Portable very large unsigned integers.
Definition bigunsignedint.hh:73
│ │ │ │ -
static constexpr int overflowmask
Definition bigunsignedint.hh:82
│ │ │ │ -
bigunsignedint< k > operator|(const bigunsignedint< k > &x) const
bitwise or
│ │ │ │ -
static constexpr int hexdigits
Definition bigunsignedint.hh:79
│ │ │ │ -
bigunsignedint< k > operator^(const bigunsignedint< k > &x) const
bitwise exor
│ │ │ │ -
bigunsignedint< k > operator*(const bigunsignedint< k > &x) const
multiply
│ │ │ │ -
bigunsignedint< k > operator%(const bigunsignedint< k > &x) const
│ │ │ │ -
static constexpr int n
Definition bigunsignedint.hh:78
│ │ │ │ -
bigunsignedint< k > operator-(const bigunsignedint< k > &x) const
subtract
│ │ │ │ -
static constexpr int compbitmask
Definition bigunsignedint.hh:81
│ │ │ │ -
bigunsignedint< k > operator&(const bigunsignedint< k > &x) const
bitwise and
│ │ │ │ -
static constexpr int bits
Definition bigunsignedint.hh:77
│ │ │ │ -
bigunsignedint< k > operator/(const bigunsignedint< k > &x) const
│ │ │ │ -
bigunsignedint< k > operator+(const bigunsignedint< k > &x) const
add
│ │ │ │ -
friend std::size_t hash_value(const bigunsignedint &arg)
Definition bigunsignedint.hh:179
│ │ │ │ -
static constexpr int bitmask
Definition bigunsignedint.hh:80
│ │ │ │ -
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition typetraits.hh:194
│ │ │ │ -
Base class for Dune-Exceptions.
Definition exceptions.hh:96
│ │ │ │ -
Default exception class for mathematical errors.
Definition exceptions.hh:241
│ │ │ │ +
Definition mpidata.hh:50
│ │ │ │ +
T & data_
Definition mpidata.hh:53
│ │ │ │ +
MPI_Datatype type() const
Definition mpidata.hh:71
│ │ │ │ +
void * ptr() const
Definition mpidata.hh:60
│ │ │ │ +
int size() const
Definition mpidata.hh:67
│ │ │ │ +
static constexpr bool static_size
Definition mpidata.hh:65
│ │ │ │ +
MPIData(T &t)
Definition mpidata.hh:55
│ │ │ │ +
void get()
Definition mpidata.hh:89
│ │ │ │ +
MPIData()
Definition mpidata.hh:80
│ │ │ │ +
int size()
Definition mpidata.hh:86
│ │ │ │ +
void * ptr()
Definition mpidata.hh:83
│ │ │ │ +
MPI_Datatype type() const
Definition mpidata.hh:90
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
auto resize(int size) -> std::enable_if_t<!std::is_const< S >::value||!Std::is_detected_v< hasResizeOp, S > >
Definition mpidata.hh:123
│ │ │ │ + │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,897 +1,217 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -bigunsignedint.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpidata.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ 5 │ │ │ │ │ -6#ifndef DUNE_BIGUNSIGNEDINT_HH │ │ │ │ │ -7#define DUNE_BIGUNSIGNEDINT_HH │ │ │ │ │ +6#ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH │ │ │ │ │ +7#define DUNE_COMMON_PARALLEL_MPIDATA_HH │ │ │ │ │ 8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_a_s_h_._h_h> │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12#if HAVE_MPI │ │ │ │ │ +13 │ │ │ │ │ +14#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +16#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ 17 │ │ │ │ │ -24namespace _D_u_n_e │ │ │ │ │ -25{ │ │ │ │ │ -26#if HAVE_MPI │ │ │ │ │ -27 template │ │ │ │ │ -28 struct MPITraits; │ │ │ │ │ -29#endif │ │ │ │ │ -30 │ │ │ │ │ -36 namespace Impl { │ │ │ │ │ -37 │ │ │ │ │ -38 // numeric_limits_helper provides std::numeric_limits access to the │ │ │ │ │ -internals │ │ │ │ │ -39 // of bigunsignedint. Previously, the correct specialization of std:: │ │ │ │ │ -numeric_limits │ │ │ │ │ -40 // was a friend of bigunsignedint, but that creates problems on recent │ │ │ │ │ -versions │ │ │ │ │ -41 // of clang with the alternative libc++ library, because that library │ │ │ │ │ -declares the │ │ │ │ │ -42 // base template of std::numeric_limits as a class and clang subsequently │ │ │ │ │ -complains │ │ │ │ │ -43 // if the friend declaration uses 'struct'. Unfortunately, libstdc++ uses a │ │ │ │ │ -struct, │ │ │ │ │ -44 // making it impossible to keep clang happy for both standard libraries. │ │ │ │ │ -45 // So we move the access helper functionality into a custom struct and │ │ │ │ │ -simply let │ │ │ │ │ -46 // the numeric_limits specialization inherit from the helper. │ │ │ │ │ -47 │ │ │ │ │ -48 template │ │ │ │ │ -49 struct numeric_limits_helper │ │ │ │ │ +37namespace _D_u_n_e{ │ │ │ │ │ +38 │ │ │ │ │ +39 template │ │ │ │ │ +40 struct MPIData; │ │ │ │ │ +41 │ │ │ │ │ +42 template │ │ │ │ │ +_4_3 auto _g_e_t_M_P_I_D_a_t_a(T& t){ │ │ │ │ │ +44 return _M_P_I_D_a_t_a_<_T_>(t); │ │ │ │ │ +45 } │ │ │ │ │ +46 │ │ │ │ │ +47 // Default implementation for static datatypes │ │ │ │ │ +48 template │ │ │ │ │ +_4_9 struct _M_P_I_D_a_t_a │ │ │ │ │ 50 { │ │ │ │ │ -51 │ │ │ │ │ +51 friend auto getMPIData(T&); │ │ │ │ │ 52 protected: │ │ │ │ │ -53 │ │ │ │ │ -54 static std::uint16_t& digit(T& big_unsigned_int, std::size_t i) │ │ │ │ │ -55 { │ │ │ │ │ -56 return big_unsigned_int.digit[i]; │ │ │ │ │ -57 } │ │ │ │ │ +_5_3 T& _d_a_t_a__; │ │ │ │ │ +54 │ │ │ │ │ +_5_5 _M_P_I_D_a_t_a(T& t) │ │ │ │ │ +56 : _d_a_t_a__(t) │ │ │ │ │ +57 {} │ │ │ │ │ 58 │ │ │ │ │ -59 }; │ │ │ │ │ -60 │ │ │ │ │ -61 } │ │ │ │ │ -62 │ │ │ │ │ -72 template │ │ │ │ │ -_7_3 class _b_i_g_u_n_s_i_g_n_e_d_i_n_t { │ │ │ │ │ -74 public: │ │ │ │ │ +59 public: │ │ │ │ │ +_6_0 void* _p_t_r() const { │ │ │ │ │ +61 return (void*)&_d_a_t_a__; │ │ │ │ │ +62 } │ │ │ │ │ +63 │ │ │ │ │ +64 // indicates whether the datatype can be resized │ │ │ │ │ +_6_5 static constexpr bool _s_t_a_t_i_c___s_i_z_e = true; │ │ │ │ │ +66 │ │ │ │ │ +_6_7 int _s_i_z_e() const{ │ │ │ │ │ +68 return 1; │ │ │ │ │ +69 } │ │ │ │ │ +70 │ │ │ │ │ +_7_1 MPI_Datatype _t_y_p_e() const { │ │ │ │ │ +72 return _M_P_I_T_r_a_i_t_s_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>::getType(); │ │ │ │ │ +73 } │ │ │ │ │ +74 }; │ │ │ │ │ 75 │ │ │ │ │ -76 // unsigned short is 16 bits wide, n is the number of digits needed │ │ │ │ │ -_7_7 constexpr static int _b_i_t_s = std::numeric_limits::digits; │ │ │ │ │ -_7_8 constexpr static int _n = k/_b_i_t_s+(k%_b_i_t_s!=0); │ │ │ │ │ -_7_9 constexpr static int _h_e_x_d_i_g_i_t_s = 4; │ │ │ │ │ -_8_0 constexpr static int _b_i_t_m_a_s_k = 0xFFFF; │ │ │ │ │ -_8_1 constexpr static int _c_o_m_p_b_i_t_m_a_s_k = 0xFFFF0000; │ │ │ │ │ -_8_2 constexpr static int _o_v_e_r_f_l_o_w_m_a_s_k = 0x1; │ │ │ │ │ -83 │ │ │ │ │ -85 _b_i_g_u_n_s_i_g_n_e_d_i_n_t (); │ │ │ │ │ -86 │ │ │ │ │ -88 template │ │ │ │ │ -89 _b_i_g_u_n_s_i_g_n_e_d_i_n_t (Signed x, typename std::enable_if:: │ │ │ │ │ -value && std::is_signed::value>::type* = 0); │ │ │ │ │ -90 │ │ │ │ │ -92 _b_i_g_u_n_s_i_g_n_e_d_i_n_t (std::uintmax_t x); │ │ │ │ │ -93 │ │ │ │ │ -95 void _p_r_i_n_t (std::ostream& s) const ; │ │ │ │ │ -96 │ │ │ │ │ -_9_8 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_+_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -99 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_+_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ -100 │ │ │ │ │ -_1_0_2 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_-_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -103 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_-_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ +76 // dummy implementation for void │ │ │ │ │ +77 template<> │ │ │ │ │ +_7_8 struct _M_P_I_D_a_t_a{ │ │ │ │ │ +79 protected: │ │ │ │ │ +_8_0 _M_P_I_D_a_t_a() {} │ │ │ │ │ +81 │ │ │ │ │ +82 public: │ │ │ │ │ +_8_3 void* _p_t_r(){ │ │ │ │ │ +84 return nullptr; │ │ │ │ │ +85 } │ │ │ │ │ +_8_6 int _s_i_z_e(){ │ │ │ │ │ +87 return 0; │ │ │ │ │ +88 } │ │ │ │ │ +_8_9 void _g_e_t(){} │ │ │ │ │ +_9_0 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ +91 return MPI_INT; │ │ │ │ │ +92 } │ │ │ │ │ +93 }; │ │ │ │ │ +94 │ │ │ │ │ +95 // specializations: │ │ │ │ │ +96 // std::vector of static sized elements or std::string │ │ │ │ │ +97 template │ │ │ │ │ +_9_8 struct _M_P_I_D_a_t_a().data()), │ │ │ │ │ +99 decltype(std::declval().size()), │ │ │ │ │ +100 typename std::decay_t::value_type>>>{ │ │ │ │ │ +101 private: │ │ │ │ │ +102 template │ │ │ │ │ +103 using hasResizeOp = decltype(std::declval().resize(0)); │ │ │ │ │ 104 │ │ │ │ │ -_1_0_6 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_*_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -107 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_*_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ -108 │ │ │ │ │ -110 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_+_+_ (); │ │ │ │ │ -111 │ │ │ │ │ -_1_1_5 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_/_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -116 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_/_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ -117 │ │ │ │ │ -_1_2_1 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_%_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -122 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_%_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ -123 │ │ │ │ │ -_1_2_5 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_&_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -126 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_&_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ -127 │ │ │ │ │ -_1_2_9 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_^_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -130 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_^_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ -131 │ │ │ │ │ -_1_3_3 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_|_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -134 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _o_p_e_r_a_t_o_r_|_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x); │ │ │ │ │ -135 │ │ │ │ │ -137 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_~_ () const; │ │ │ │ │ -138 │ │ │ │ │ -139 │ │ │ │ │ -141 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_<_<_ (int i) const; │ │ │ │ │ -142 │ │ │ │ │ -144 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_>_>_ (int i) const; │ │ │ │ │ -145 │ │ │ │ │ -146 │ │ │ │ │ -148 bool _o_p_e_r_a_t_o_r_<_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -149 │ │ │ │ │ -151 bool _o_p_e_r_a_t_o_r_<_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -152 │ │ │ │ │ -154 bool _o_p_e_r_a_t_o_r_>_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -155 │ │ │ │ │ -157 bool _o_p_e_r_a_t_o_r_>_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -158 │ │ │ │ │ -160 bool _o_p_e_r_a_t_o_r_=_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -161 │ │ │ │ │ -163 bool _o_p_e_r_a_t_o_r_!_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const; │ │ │ │ │ -164 │ │ │ │ │ -165 │ │ │ │ │ -167 // operator unsigned int () const; │ │ │ │ │ -168 std::uint_least32_t _t_o_u_i_n_t() const; │ │ │ │ │ -_1_7_4 double _t_o_d_o_u_b_l_e() const; │ │ │ │ │ -175 │ │ │ │ │ -176 friend class _b_i_g_u_n_s_i_g_n_e_d_i_n_t; │ │ │ │ │ -177 friend struct Impl::numeric_limits_helper< _b_i_g_u_n_s_i_g_n_e_d_i_n_t >; │ │ │ │ │ -178 │ │ │ │ │ -_1_7_9 inline friend std::size_t _h_a_s_h___v_a_l_u_e(const _b_i_g_u_n_s_i_g_n_e_d_i_n_t& arg) │ │ │ │ │ -180 { │ │ │ │ │ -181 return _h_a_s_h___r_a_n_g_e(arg.digit,arg.digit + arg._n); │ │ │ │ │ -182 } │ │ │ │ │ -183 │ │ │ │ │ -184 private: │ │ │ │ │ -_1_8_5 std::uint16_t digit[_n]; │ │ │ │ │ -186#if HAVE_MPI │ │ │ │ │ -187 friend struct _M_P_I_T_r_a_i_t_s<_b_i_g_u_n_s_i_g_n_e_d_i_n_t >; │ │ │ │ │ -188#endif │ │ │ │ │ -189 inline void assign(std::uintmax_t x); │ │ │ │ │ -190 │ │ │ │ │ -191 │ │ │ │ │ -192 } ; │ │ │ │ │ -193 │ │ │ │ │ -194 // Constructors │ │ │ │ │ -195 template │ │ │ │ │ -_1_9_6 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t () │ │ │ │ │ -197 { │ │ │ │ │ -198 _a_s_s_i_g_n(0u); │ │ │ │ │ -199 } │ │ │ │ │ -200 │ │ │ │ │ -201 template │ │ │ │ │ -202 template │ │ │ │ │ -_2_0_3 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t (Signed y, typename std::enable_if::value && std::is_signed::value>::type*) │ │ │ │ │ -204 { │ │ │ │ │ -205 if (y < 0) │ │ │ │ │ -206 _D_U_N_E___T_H_R_O_W(_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n, "Trying to construct a Dune::bigunsignedint │ │ │ │ │ -from a negative integer: " << y); │ │ │ │ │ -207 _a_s_s_i_g_n(y); │ │ │ │ │ -208 } │ │ │ │ │ -209 │ │ │ │ │ -210 template │ │ │ │ │ -_2_1_1 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t (std::uintmax_t x) │ │ │ │ │ -212 { │ │ │ │ │ -213 _a_s_s_i_g_n(x); │ │ │ │ │ -214 } │ │ │ │ │ -215 template │ │ │ │ │ -216 void _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_a_s_s_i_g_n(std::uintmax_t x) │ │ │ │ │ -217 { │ │ │ │ │ -218 static const int no=std::min(static_cast(n), │ │ │ │ │ -219 static_cast(std::numeric_limits::digits/bits)); │ │ │ │ │ -220 │ │ │ │ │ -221 for(int i=0; i>bits; │ │ │ │ │ -224 } │ │ │ │ │ -225 for (unsigned int i=no; i │ │ │ │ │ -_2_3_0 inline std::uint_least32_t _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_t_o_u_i_n_t () const │ │ │ │ │ -231 { │ │ │ │ │ -232 return (digit[1]< │ │ │ │ │ -_2_3_6 inline double _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_t_o_d_o_u_b_l_e() const │ │ │ │ │ -237 { │ │ │ │ │ -238 int firstInZeroRange=n; │ │ │ │ │ -239 for(int i=n-1; i>=0; --i) │ │ │ │ │ -240 if(digit[i]!=0) │ │ │ │ │ -241 break; │ │ │ │ │ -242 else │ │ │ │ │ -243 --firstInZeroRange; │ │ │ │ │ -244 int representableDigits=std::numeric_limits::digits/bits; │ │ │ │ │ -245 int lastInRepresentableRange=0; │ │ │ │ │ -246 if(representableDigits=lastInRepresentableRange; --i) │ │ │ │ │ -250 val =val*(1< │ │ │ │ │ -_2_5_5 inline void _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_p_r_i_n_t (std::ostream& s) const │ │ │ │ │ -256 { │ │ │ │ │ -257 bool leading=false; │ │ │ │ │ -258 │ │ │ │ │ -259 // print from left to right │ │ │ │ │ -260 for (int i=n-1; i>=0; i--) │ │ │ │ │ -261 for (int d=hexdigits-1; d>=0; d--) │ │ │ │ │ -262 { │ │ │ │ │ -263 // extract one hex digit │ │ │ │ │ -264 int current = (digit[i]>>(d*4))&0xF; │ │ │ │ │ -265 if (current!=0) │ │ │ │ │ -266 { │ │ │ │ │ -267 // s.setf(std::ios::noshowbase); │ │ │ │ │ -268 s << std::hex << current; │ │ │ │ │ -269 leading = false; │ │ │ │ │ -270 } │ │ │ │ │ -271 else if (!leading) s << std::hex << current; │ │ │ │ │ -272 } │ │ │ │ │ -273 if (leading) s << "0"; │ │ │ │ │ -274 s << std::dec; │ │ │ │ │ -275 } │ │ │ │ │ -276 │ │ │ │ │ -277 template │ │ │ │ │ -_2_7_8 inline std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& │ │ │ │ │ -x) │ │ │ │ │ -279 { │ │ │ │ │ -280 x._p_r_i_n_t(s); │ │ │ │ │ -281 return s; │ │ │ │ │ -282 } │ │ │ │ │ -283 │ │ │ │ │ -_2_8_4 #define DUNE_BINOP(OP) \ │ │ │ │ │ -285 template \ │ │ │ │ │ -286 inline bigunsignedint bigunsignedint::operator OP (const │ │ │ │ │ -bigunsignedint &x) const \ │ │ │ │ │ -287 { \ │ │ │ │ │ -288 auto temp = *this; \ │ │ │ │ │ -289 temp OP##= x; \ │ │ │ │ │ -290 return temp; \ │ │ │ │ │ -291 } │ │ │ │ │ -292 │ │ │ │ │ -293 _D_U_N_E___B_I_N_O_P(+) │ │ │ │ │ -294 _D_U_N_E___B_I_N_O_P(-) │ │ │ │ │ -295 _D_U_N_E___B_I_N_O_P(*) │ │ │ │ │ -296 _D_U_N_E___B_I_N_O_P(/) │ │ │ │ │ -297 _D_U_N_E___B_I_N_O_P(%) │ │ │ │ │ -298 _D_U_N_E___B_I_N_O_P(&) │ │ │ │ │ -299 _D_U_N_E___B_I_N_O_P(^) │ │ │ │ │ -300 _D_U_N_E___B_I_N_O_P(|) │ │ │ │ │ -301 │ │ │ │ │ -302 #undef DUNE_BINOP │ │ │ │ │ -303 │ │ │ │ │ -304 template │ │ │ │ │ -_3_0_5 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_+_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -306 { │ │ │ │ │ -307 std::uint_fast32_t overflow=0; │ │ │ │ │ -308 │ │ │ │ │ -309 for (unsigned int i=0; i(digit[i]) + │ │ │ │ │ -static_cast(x.digit[i]) + overflow; │ │ │ │ │ -312 digit[i] = sum&bitmask; │ │ │ │ │ -313 overflow = (sum>>bits)&overflowmask; │ │ │ │ │ -314 } │ │ │ │ │ -315 return *this; │ │ │ │ │ -316 } │ │ │ │ │ -317 │ │ │ │ │ -318 template │ │ │ │ │ -_3_1_9 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_-_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -320 { │ │ │ │ │ -321 std::int_fast32_t overflow=0; │ │ │ │ │ -322 │ │ │ │ │ -323 for (unsigned int i=0; i(digit[i]) - │ │ │ │ │ -static_cast(x.digit[i]) - overflow; │ │ │ │ │ -326 if (diff>=0) │ │ │ │ │ -327 { │ │ │ │ │ -328 digit[i] = static_cast(diff); │ │ │ │ │ -329 overflow = 0; │ │ │ │ │ -330 } │ │ │ │ │ -331 else │ │ │ │ │ -332 { │ │ │ │ │ -333 digit[i] = static_cast(diff+bitmask+1); │ │ │ │ │ -334 overflow = 1; │ │ │ │ │ -335 } │ │ │ │ │ -336 } │ │ │ │ │ -337 return *this; │ │ │ │ │ -338 } │ │ │ │ │ -339 │ │ │ │ │ -340 template │ │ │ │ │ -_3_4_1 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_*_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -342 { │ │ │ │ │ -343 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_2_*_k_> finalproduct(0); │ │ │ │ │ -344 │ │ │ │ │ -345 for (unsigned int m=0; m singleproduct(0); │ │ │ │ │ -348 std::uint_fast32_t overflow(0); │ │ │ │ │ -349 for (unsigned int i=0; i(digit │ │ │ │ │ -[i])*static_cast(x.digit[m])+overflow; │ │ │ │ │ -352 singleproduct.digit[i+m] = static_cast │ │ │ │ │ -(digitproduct&bitmask); │ │ │ │ │ -353 overflow = (digitproduct>>bits)&bitmask; │ │ │ │ │ -354 } │ │ │ │ │ -355 finalproduct = finalproduct+singleproduct; │ │ │ │ │ -356 } │ │ │ │ │ -357 │ │ │ │ │ -358 for (unsigned int i=0; i │ │ │ │ │ -_3_6_3 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_+_+_ () │ │ │ │ │ -364 { │ │ │ │ │ -365 std::uint_fast32_t overflow=1; │ │ │ │ │ -366 │ │ │ │ │ -367 for (unsigned int i=0; i(digit[i]) + │ │ │ │ │ -overflow; │ │ │ │ │ -370 digit[i] = sum&bitmask; │ │ │ │ │ -371 overflow = (sum>>bits)&overflowmask; │ │ │ │ │ -372 } │ │ │ │ │ -373 return *this; │ │ │ │ │ -374 } │ │ │ │ │ -375 │ │ │ │ │ -376 template │ │ │ │ │ -_3_7_7 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_/_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -378 { │ │ │ │ │ -379 if(x==0) │ │ │ │ │ -380 _D_U_N_E___T_H_R_O_W(_D_u_n_e_:_:_M_a_t_h_E_r_r_o_r, "division by zero!"); │ │ │ │ │ -381 │ │ │ │ │ -382 // better slow than nothing │ │ │ │ │ -383 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> result(0); │ │ │ │ │ -384 │ │ │ │ │ -385 while (*this>=x) │ │ │ │ │ -386 { │ │ │ │ │ -387 ++result; │ │ │ │ │ -388 *this -= x; │ │ │ │ │ -389 } │ │ │ │ │ -390 │ │ │ │ │ -391 *this = result; │ │ │ │ │ -392 return *this; │ │ │ │ │ -393 } │ │ │ │ │ -394 │ │ │ │ │ -395 template │ │ │ │ │ -_3_9_6 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_%_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -397 { │ │ │ │ │ -398 // better slow than nothing │ │ │ │ │ -399 while (*this>=x) │ │ │ │ │ -400 { │ │ │ │ │ -401 *this -= x; │ │ │ │ │ -402 } │ │ │ │ │ -403 │ │ │ │ │ -404 return *this; │ │ │ │ │ -405 } │ │ │ │ │ -406 │ │ │ │ │ -407 template │ │ │ │ │ -_4_0_8 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_&_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -409 { │ │ │ │ │ -410 for (unsigned int i=0; i │ │ │ │ │ -_4_1_6 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_^_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -417 { │ │ │ │ │ -418 for (unsigned int i=0; i │ │ │ │ │ -_4_2_4 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_|_=_ (const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -425 { │ │ │ │ │ -426 for (unsigned int i=0; i │ │ │ │ │ -_4_3_2 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_~_ () const │ │ │ │ │ -433 { │ │ │ │ │ -434 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> result; │ │ │ │ │ -435 for (unsigned int i=0; i │ │ │ │ │ -441 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_<_<_ (int shift) const │ │ │ │ │ -442 { │ │ │ │ │ -443 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> result(0); │ │ │ │ │ -444 │ │ │ │ │ -445 // multiples of bits │ │ │ │ │ -446 int j=shift/bits; │ │ │ │ │ -447 for (int i=n-1-j; i>=0; i--) │ │ │ │ │ -448 result.digit[i+j] = digit[i]; │ │ │ │ │ -449 │ │ │ │ │ -450 // remainder │ │ │ │ │ -451 j=shift%bits; │ │ │ │ │ -452 for (int i=n-1; i>=0; i--) │ │ │ │ │ -453 { │ │ │ │ │ -454 unsigned int temp = result.digit[i]; │ │ │ │ │ -455 temp = temp<(temp&bitmask); │ │ │ │ │ -457 temp = temp>>bits; │ │ │ │ │ -458 if (i+1<(int)n) │ │ │ │ │ -459 result.digit[i+1] = result.digit[i+1]|temp; │ │ │ │ │ -460 } │ │ │ │ │ -461 │ │ │ │ │ -462 return result; │ │ │ │ │ -463 } │ │ │ │ │ -464 │ │ │ │ │ -465 template │ │ │ │ │ -_4_6_6 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_>_>_ (int shift) const │ │ │ │ │ -467 { │ │ │ │ │ -468 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> result(0); │ │ │ │ │ -469 │ │ │ │ │ -470 // multiples of bits │ │ │ │ │ -471 int j=shift/bits; │ │ │ │ │ -472 for (unsigned int i=0; i((temp&compbitmask)>>bits); │ │ │ │ │ -482 if (i>0) │ │ │ │ │ -483 result.digit[i-1] = result.digit[i-1] | (temp&bitmask); │ │ │ │ │ -484 } │ │ │ │ │ -485 │ │ │ │ │ -486 return result; │ │ │ │ │ -487 } │ │ │ │ │ -488 │ │ │ │ │ -489 template │ │ │ │ │ -_4_9_0 inline bool _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_!_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -const │ │ │ │ │ -491 { │ │ │ │ │ -492 for (unsigned int i=0; i │ │ │ │ │ -_4_9_8 inline bool _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_=_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -const │ │ │ │ │ -499 { │ │ │ │ │ -500 return !((*this)!=x); │ │ │ │ │ -501 } │ │ │ │ │ -502 │ │ │ │ │ -503 template │ │ │ │ │ -_5_0_4 inline bool _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_<_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const │ │ │ │ │ -505 { │ │ │ │ │ -506 for (int i=n-1; i>=0; i--) │ │ │ │ │ -507 if (digit[i]x.digit[i]) return false; │ │ │ │ │ -509 return false; │ │ │ │ │ -510 } │ │ │ │ │ -511 │ │ │ │ │ -512 template │ │ │ │ │ -_5_1_3 inline bool _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_<_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -const │ │ │ │ │ -514 { │ │ │ │ │ -515 for (int i=n-1; i>=0; i--) │ │ │ │ │ -516 if (digit[i]x.digit[i]) return false; │ │ │ │ │ -518 return true; │ │ │ │ │ -519 } │ │ │ │ │ -520 │ │ │ │ │ -521 template │ │ │ │ │ -_5_2_2 inline bool _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_>_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) const │ │ │ │ │ -523 { │ │ │ │ │ -524 return !((*this)<=x); │ │ │ │ │ -525 } │ │ │ │ │ -526 │ │ │ │ │ -527 template │ │ │ │ │ -_5_2_8 inline bool _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_o_p_e_r_a_t_o_r_>_=_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x) │ │ │ │ │ -const │ │ │ │ │ -529 { │ │ │ │ │ -530 return !((*this) │ │ │ │ │ -_5_3_5 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_+_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x, std:: │ │ │ │ │ -uintmax_t y) │ │ │ │ │ -536 { │ │ │ │ │ -537 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(y); │ │ │ │ │ -538 return x+temp; │ │ │ │ │ -539 } │ │ │ │ │ -540 │ │ │ │ │ -541 template │ │ │ │ │ -_5_4_2 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_-_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x, std:: │ │ │ │ │ -uintmax_t y) │ │ │ │ │ -543 { │ │ │ │ │ -544 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(y); │ │ │ │ │ -545 return x-temp; │ │ │ │ │ -546 } │ │ │ │ │ -547 │ │ │ │ │ -548 template │ │ │ │ │ -_5_4_9 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_*_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x, std:: │ │ │ │ │ -uintmax_t y) │ │ │ │ │ -550 { │ │ │ │ │ -551 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(y); │ │ │ │ │ -552 return x*temp; │ │ │ │ │ -553 } │ │ │ │ │ -554 │ │ │ │ │ -555 template │ │ │ │ │ -_5_5_6 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_/_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x, std:: │ │ │ │ │ -uintmax_t y) │ │ │ │ │ -557 { │ │ │ │ │ -558 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(y); │ │ │ │ │ -559 return x/temp; │ │ │ │ │ -560 } │ │ │ │ │ -561 │ │ │ │ │ -562 template │ │ │ │ │ -_5_6_3 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_%_ (const _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& x, std:: │ │ │ │ │ -uintmax_t y) │ │ │ │ │ -564 { │ │ │ │ │ -565 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(y); │ │ │ │ │ -566 return x%temp; │ │ │ │ │ -567 } │ │ │ │ │ -568 │ │ │ │ │ -569 template │ │ │ │ │ -_5_7_0 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_+_ (std::uintmax_t x, const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& y) │ │ │ │ │ -571 { │ │ │ │ │ -572 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(x); │ │ │ │ │ -573 return temp+y; │ │ │ │ │ -574 } │ │ │ │ │ -575 │ │ │ │ │ -576 template │ │ │ │ │ -_5_7_7 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_-_ (std::uintmax_t x, const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& y) │ │ │ │ │ -578 { │ │ │ │ │ -579 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(x); │ │ │ │ │ -580 return temp-y; │ │ │ │ │ -581 } │ │ │ │ │ -582 │ │ │ │ │ -583 template │ │ │ │ │ -_5_8_4 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_*_ (std::uintmax_t x, const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& y) │ │ │ │ │ -585 { │ │ │ │ │ -586 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(x); │ │ │ │ │ -587 return temp*y; │ │ │ │ │ -588 } │ │ │ │ │ -589 │ │ │ │ │ -590 template │ │ │ │ │ -_5_9_1 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_/_ (std::uintmax_t x, const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& y) │ │ │ │ │ -592 { │ │ │ │ │ -593 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(x); │ │ │ │ │ -594 return temp/y; │ │ │ │ │ -595 } │ │ │ │ │ -596 │ │ │ │ │ -597 template │ │ │ │ │ -_5_9_8 inline _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _o_p_e_r_a_t_o_r_%_ (std::uintmax_t x, const │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>& y) │ │ │ │ │ -599 { │ │ │ │ │ -600 _b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> temp(x); │ │ │ │ │ -601 return temp%y; │ │ │ │ │ -602 } │ │ │ │ │ -603 │ │ │ │ │ -604 // Forward declare type-trait for numbers │ │ │ │ │ -605 template struct IsNumber; │ │ │ │ │ -606 │ │ │ │ │ -608 template │ │ │ │ │ -_6_0_9 struct _I_s_N_u_m_b_e_r<_b_i_g_u_n_s_i_g_n_e_d_i_n_t> : public std::true_type {}; │ │ │ │ │ -610 │ │ │ │ │ -612} │ │ │ │ │ -613 │ │ │ │ │ -614namespace _s_t_d │ │ │ │ │ -615{ │ │ │ │ │ -616 template │ │ │ │ │ -617 struct numeric_limits<_D_u_n_e::bigunsignedint > │ │ │ │ │ -618 : private Dune::Impl::numeric_limits_helper > / │ │ │ │ │ -/ for access to internal state of bigunsignedint │ │ │ │ │ -619 { │ │ │ │ │ -620 public: │ │ │ │ │ -621 static const bool is_specialized = true; │ │ │ │ │ -622 │ │ │ │ │ -623 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> min() │ │ │ │ │ -624 { │ │ │ │ │ -625 return static_cast<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >(0); │ │ │ │ │ -626 } │ │ │ │ │ -627 │ │ │ │ │ -628 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> _m_a_x() │ │ │ │ │ -629 { │ │ │ │ │ -630 _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> max_; │ │ │ │ │ -631 for(std::size_t i=0; i < Dune::bigunsignedint::n; ++i) │ │ │ │ │ -632 // access internal state via the helper base class │ │ │ │ │ -633 Dune::Impl::numeric_limits_helper<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >:: │ │ │ │ │ -634 digit(max_,i)=_s_t_d::numeric_limits<_s_t_d::uint16_t>::_m_a_x(); │ │ │ │ │ -635 return max_; │ │ │ │ │ -636 } │ │ │ │ │ -637 │ │ │ │ │ -638 │ │ │ │ │ -639 static const int digits = _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_b_i_t_s * │ │ │ │ │ -640 _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_n; │ │ │ │ │ -641 static const bool is_signed = false; │ │ │ │ │ -642 static const bool is_integer = true; │ │ │ │ │ -643 static const bool is_exact = true; │ │ │ │ │ -644 static const int radix = 2; │ │ │ │ │ -645 │ │ │ │ │ -646 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> epsilon() │ │ │ │ │ -647 { │ │ │ │ │ -648 return static_cast<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >(0); │ │ │ │ │ -649 } │ │ │ │ │ -650 │ │ │ │ │ -651 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> round_error() │ │ │ │ │ -652 { │ │ │ │ │ -653 return static_cast<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >(0); │ │ │ │ │ -654 } │ │ │ │ │ -655 │ │ │ │ │ -656 static const int min_exponent = 0; │ │ │ │ │ -657 static const int min_exponent10 = 0; │ │ │ │ │ -658 static const int max_exponent = 0; │ │ │ │ │ -659 static const int max_exponent10 = 0; │ │ │ │ │ -660 │ │ │ │ │ -661 static const bool has_infinity = false; │ │ │ │ │ -662 static const bool has_quiet_NaN = false; │ │ │ │ │ -663 static const bool has_signaling_NaN = false; │ │ │ │ │ -664 │ │ │ │ │ -665 static const float_denorm_style has_denorm = denorm_absent; │ │ │ │ │ -666 static const bool has_denorm_loss = false; │ │ │ │ │ -667 │ │ │ │ │ -668 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> infinity() noexcept │ │ │ │ │ -669 { │ │ │ │ │ -670 return static_cast<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >(0); │ │ │ │ │ -671 } │ │ │ │ │ -672 │ │ │ │ │ -673 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> quiet_NaN() noexcept │ │ │ │ │ -674 { │ │ │ │ │ -675 return static_cast<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >(0); │ │ │ │ │ -676 } │ │ │ │ │ -677 │ │ │ │ │ -678 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> signaling_NaN() noexcept │ │ │ │ │ -679 { │ │ │ │ │ -680 return static_cast<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >(0); │ │ │ │ │ -681 } │ │ │ │ │ -682 │ │ │ │ │ -683 static _D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> denorm_min() noexcept │ │ │ │ │ -684 { │ │ │ │ │ -685 return static_cast<_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_> >(0); │ │ │ │ │ -686 } │ │ │ │ │ -687 │ │ │ │ │ -688 static const bool is_iec559 = false; │ │ │ │ │ -689 static const bool is_bounded = true; │ │ │ │ │ -690 static const bool is_modulo = true; │ │ │ │ │ -691 │ │ │ │ │ -692 static const bool traps = false; │ │ │ │ │ -693 static const bool tinyness_before = false; │ │ │ │ │ -694 static const float_round_style round_style = round_toward_zero; │ │ │ │ │ -695 │ │ │ │ │ -696 }; │ │ │ │ │ -697 │ │ │ │ │ -698} │ │ │ │ │ -699 │ │ │ │ │ -700_D_U_N_E___D_E_F_I_N_E___H_A_S_H(_D_U_N_E___H_A_S_H___T_E_M_P_L_A_T_E___A_R_G_S(int k),_D_U_N_E___H_A_S_H___T_Y_P_E(_D_u_n_e_:_: │ │ │ │ │ -_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>)) │ │ │ │ │ -701 │ │ │ │ │ -702#endif │ │ │ │ │ -_h_a_s_h_._h_h │ │ │ │ │ -Support for calculating hash values of objects. │ │ │ │ │ -_D_U_N_E___D_E_F_I_N_E___H_A_S_H │ │ │ │ │ -#define DUNE_DEFINE_HASH(template_args, type) │ │ │ │ │ -Defines the required struct specialization to make type hashable via Dune:: │ │ │ │ │ -hash. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:100 │ │ │ │ │ -_D_U_N_E___H_A_S_H___T_Y_P_E │ │ │ │ │ -#define DUNE_HASH_TYPE(...) │ │ │ │ │ -Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:117 │ │ │ │ │ -_D_U_N_E___H_A_S_H___T_E_M_P_L_A_T_E___A_R_G_S │ │ │ │ │ -#define DUNE_HASH_TEMPLATE_ARGS(...) │ │ │ │ │ -Wrapper macro for the template arguments in DUNE_DEFINE_HASH. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:109 │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ -bigunsignedint< k > & operator/=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:377 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:549 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -bigunsignedint< k > operator<<(int i) const │ │ │ │ │ -left shift │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:441 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ -bigunsignedint< k > & operator+=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:305 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_^_= │ │ │ │ │ -bigunsignedint< k > & operator^=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:416 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_<_= │ │ │ │ │ -bool operator<=(const bigunsignedint< k > &x) const │ │ │ │ │ -less than or equal │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:513 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_p_r_i_n_t │ │ │ │ │ -void print(std::ostream &s) const │ │ │ │ │ -Print number in hex notation. │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:255 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ │ -bool operator<(const bigunsignedint< k > &x) const │ │ │ │ │ -less than │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:504 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_/ │ │ │ │ │ -bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:556 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -bool operator==(const bigunsignedint< k > &x) const │ │ │ │ │ -equal │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:498 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -bool operator!=(const bigunsignedint< k > &x) const │ │ │ │ │ -not equal │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:490 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t │ │ │ │ │ -bigunsignedint() │ │ │ │ │ -Construct uninitialized. │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:196 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_&_= │ │ │ │ │ -bigunsignedint< k > & operator&=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:408 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ -bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:542 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_>_= │ │ │ │ │ -bool operator>=(const bigunsignedint< k > &x) const │ │ │ │ │ -greater or equal │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:528 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ -bigunsignedint< k > operator>>(int i) const │ │ │ │ │ -right shift │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ -bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:535 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_~ │ │ │ │ │ -bigunsignedint< k > operator~() const │ │ │ │ │ -bitwise complement │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:432 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -bigunsignedint< k > & operator++() │ │ │ │ │ -prefix increment │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:363 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_|_= │ │ │ │ │ -bigunsignedint< k > & operator|=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:424 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_% │ │ │ │ │ -bigunsignedint< k > operator%(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:563 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_%_= │ │ │ │ │ -bigunsignedint< k > & operator%=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:396 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_t_o_d_o_u_b_l_e │ │ │ │ │ -double todouble() const │ │ │ │ │ -Convert to a double. │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:236 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ -bigunsignedint< k > & operator-=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:319 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_> │ │ │ │ │ -bool operator>(const bigunsignedint< k > &x) const │ │ │ │ │ -greater than │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:522 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ -bigunsignedint< k > & operator*=(const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:341 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_t_o_u_i_n_t │ │ │ │ │ -std::uint_least32_t touint() const │ │ │ │ │ -export to other types │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:230 │ │ │ │ │ -_D_U_N_E___B_I_N_O_P │ │ │ │ │ -#define DUNE_BINOP(OP) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:284 │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +105 protected: │ │ │ │ │ +106 friend auto getMPIData(T&); │ │ │ │ │ +_1_0_7 _M_P_I_D_a_t_a(T& t) │ │ │ │ │ +108 : _d_a_t_a__(t) │ │ │ │ │ +109 {} │ │ │ │ │ +110 public: │ │ │ │ │ +_1_1_1 static constexpr bool _s_t_a_t_i_c___s_i_z_e = std::is_const::value || !Std:: │ │ │ │ │ +is_detected_v; │ │ │ │ │ +_1_1_2 void* _p_t_r() { │ │ │ │ │ +113 return (void*) _d_a_t_a__.data(); │ │ │ │ │ +114 } │ │ │ │ │ +_1_1_5 int _s_i_z_e() { │ │ │ │ │ +116 return _d_a_t_a__.size(); │ │ │ │ │ +117 } │ │ │ │ │ +_1_1_8 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ +119 return _M_P_I_T_r_a_i_t_s_<_t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_T_>_:_:_v_a_l_u_e___t_y_p_e>::getType(); │ │ │ │ │ +120 } │ │ │ │ │ +121 │ │ │ │ │ +122 template │ │ │ │ │ +_1_2_3 auto /*void*/ _r_e_s_i_z_e(int _s_i_z_e) │ │ │ │ │ +124 -> std::enable_if_t::value || !Std:: │ │ │ │ │ +is_detected_v> │ │ │ │ │ +125 { │ │ │ │ │ +126 _d_a_t_a__.resize(_s_i_z_e); │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +129 protected: │ │ │ │ │ +_1_3_0 T& _d_a_t_a__; │ │ │ │ │ +131 }; │ │ │ │ │ +132 │ │ │ │ │ +133} │ │ │ │ │ +134 │ │ │ │ │ +139#endif │ │ │ │ │ +140#endif │ │ │ │ │ +_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ +_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_u_n_e_:_:_v_o_i_d___t │ │ │ │ │ +typename Impl::voider< Types... >::type void_t │ │ │ │ │ +Is void for all valid input types. The workhorse for C++11 SFINAE-techniques. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:40 │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_h_a_s_h___r_a_n_g_e │ │ │ │ │ -std::size_t hash_range(It first, It last) │ │ │ │ │ -Hashes all elements in the range [first,last) and returns the combined hash. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:322 │ │ │ │ │ -_D_u_n_e_:_:_a_s_s_i_g_n │ │ │ │ │ -void assign(T &dst, const T &src, bool mask) │ │ │ │ │ -masked Simd assignment (scalar version) │ │ │ │ │ -DDeeffiinniittiioonn simd.hh:447 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_a_x │ │ │ │ │ -auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > │ │ │ │ │ -&b) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:425 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ +auto getMPIData(T &t) │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ _D_u_n_e_:_:_M_P_I_T_r_a_i_t_s │ │ │ │ │ A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ DDeeffiinniittiioonn mpitraits.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t │ │ │ │ │ -Portable very large unsigned integers. │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_v_e_r_f_l_o_w_m_a_s_k │ │ │ │ │ -static constexpr int overflowmask │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_| │ │ │ │ │ -bigunsignedint< k > operator|(const bigunsignedint< k > &x) const │ │ │ │ │ -bitwise or │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_h_e_x_d_i_g_i_t_s │ │ │ │ │ -static constexpr int hexdigits │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:79 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_^ │ │ │ │ │ -bigunsignedint< k > operator^(const bigunsignedint< k > &x) const │ │ │ │ │ -bitwise exor │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -bigunsignedint< k > operator*(const bigunsignedint< k > &x) const │ │ │ │ │ -multiply │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_% │ │ │ │ │ -bigunsignedint< k > operator%(const bigunsignedint< k > &x) const │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_n │ │ │ │ │ -static constexpr int n │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ -bigunsignedint< k > operator-(const bigunsignedint< k > &x) const │ │ │ │ │ -subtract │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_c_o_m_p_b_i_t_m_a_s_k │ │ │ │ │ -static constexpr int compbitmask │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_& │ │ │ │ │ -bigunsignedint< k > operator&(const bigunsignedint< k > &x) const │ │ │ │ │ -bitwise and │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_b_i_t_s │ │ │ │ │ -static constexpr int bits │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_/ │ │ │ │ │ -bigunsignedint< k > operator/(const bigunsignedint< k > &x) const │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ -bigunsignedint< k > operator+(const bigunsignedint< k > &x) const │ │ │ │ │ -add │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_h_a_s_h___v_a_l_u_e │ │ │ │ │ -friend std::size_t hash_value(const bigunsignedint &arg) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:179 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_b_i_t_m_a_s_k │ │ │ │ │ -static constexpr int bitmask │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_I_s_N_u_m_b_e_r │ │ │ │ │ -Whether this type acts as a scalar in the context of (hierarchically blocked) │ │ │ │ │ -containers. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n │ │ │ │ │ -Base class for Dune-Exceptions. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:96 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_E_r_r_o_r │ │ │ │ │ -Default exception class for mathematical errors. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:241 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_d_a_t_a__ │ │ │ │ │ +T & data_ │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_t_y_p_e │ │ │ │ │ +MPI_Datatype type() const │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_p_t_r │ │ │ │ │ +void * ptr() const │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_t_a_t_i_c___s_i_z_e │ │ │ │ │ +static constexpr bool static_size │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_M_P_I_D_a_t_a │ │ │ │ │ +MPIData(T &t) │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_g_e_t │ │ │ │ │ +void get() │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_M_P_I_D_a_t_a │ │ │ │ │ +MPIData() │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_s_i_z_e │ │ │ │ │ +int size() │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_p_t_r │ │ │ │ │ +void * ptr() │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:83 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_t_y_p_e │ │ │ │ │ +MPI_Datatype type() const │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ +_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_M_P_I_D_a_t_a │ │ │ │ │ +MPIData(T &t) │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:107 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ +_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_p_t_r │ │ │ │ │ +void * ptr() │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ +_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_s_i_z_e │ │ │ │ │ +int size() │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ +_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_d_a_t_a__ │ │ │ │ │ +T & data_ │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:130 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ +_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_r_e_s_i_z_e │ │ │ │ │ +auto resize(int size) -> std::enable_if_t::value||!Std:: │ │ │ │ │ +is_detected_v< hasResizeOp, S > > │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:123 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ +_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +MPI_Datatype type() const │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:118 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00080.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: type_traits.hh File Reference │ │ │ │ +dune-common: communicator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,102 +65,73 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Variables
│ │ │ │ -
type_traits.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#include <type_traits>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/typeutilities.hh>
│ │ │ │ + │ │ │ │ +

Provides utility classes for syncing distributed data via MPI communication. │ │ │ │ +More...

│ │ │ │ +
#include <cassert>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <map>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <mpi.h>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/parallel/interface.hh>
│ │ │ │ +#include <dune/common/parallel/remoteindices.hh>
│ │ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Std::nonesuch
 Type representing a lookup failure by std::detected_or and friends. More...
struct  Dune::SizeOne
 Flag for marking indexed data structures where data at each index is of the same size. More...
 
struct  Dune::VariableSize
 Flag for marking indexed data structures where the data at each index may be a variable multiple of another type. More...
 
struct  Dune::CommPolicy< V >
 Default policy used for communicating an indexed type. More...
 
struct  Dune::CommPolicy< V >::CommPolicy< VariableBlockVector< FieldVector< K, n >, A > >
 
struct  Dune::Std::conjunction< B >
 forms the logical conjunction of the type traits B... More...
class  Dune::CommPolicy< V >::CommunicationError
 Error thrown if there was a problem with the communication. More...
 
struct  Dune::Std::disjunction< B >
 forms the logical disjunction of the type traits B... More...
struct  Dune::CommPolicy< V >::CopyGatherScatter< T >
 GatherScatter default implementation that just copies data. More...
 
struct  Dune::Std::negation< B >
 forms the logical negation of the type traits B... More...
class  Dune::BufferedCommunicator
 A communicator that uses buffers to gather and scatter the data to be send or received. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Typedefs

template<typename Default , template< typename... > class Op, typename... Args>
using Dune::Std::detected_or = Impl::detector< Default, void, Op, Args... >
 Detects whether Op<Args...> is valid and makes the result available.
 
template<template< typename... > class Op, typename... Args>
using Dune::Std::is_detected = typename detected_or< nonesuch, Op, Args... >::value_t
 Detects whether Op<Args...> is valid.
 
template<template< typename... > class Op, typename... Args>
using Dune::Std::detected_t = typename detected_or< nonesuch, Op, Args... >::type
 Returns Op<Args...> if that is valid; otherwise returns nonesuch.
 
template<typename Default , template< typename... > class Op, typename... Args>
using Dune::Std::detected_or_t = typename detected_or< Default, Op, Args... >::type
 Returns Op<Args...> if that is valid; otherwise returns the fallback type Default.
 
template<typename Expected , template< typename... > class Op, typename... Args>
using Dune::Std::is_detected_exact = std::is_same< Expected, detected_t< Op, Args... > >
 Checks whether Op<Args...> is Expected without causing an error if Op<Args...> is invalid.
 
template<typename Target , template< typename... > class Op, typename... Args>
using Dune::Std::is_detected_convertible = std::is_convertible< Target, detected_t< Op, Args... > >
 Checks whether Op<Args...> is convertible to Target without causing an error if Op<Args...> is invalid.
 
template<template< typename... > class Fallback, template< typename... > class TargetType, typename... Args>
using Dune::detected_or_fallback_t = Std::detected_or_t< decltype(detail::warningIfNotDefined< Std::detected_t< Fallback, Args... > >(std::declval< const Std::detected_t< TargetType, Args... > * >())), TargetType, Args... >
 This type will be either TargetType<Args...> if it exists, or the Fallback<Args...> type.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Variables

template<template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_v = is_detected<Op,Args...>::value
 Detects whether Op<Args...> is valid and makes the result available as a value.
 
template<typename Expected , template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value
 Convenient access to the result value of is_detected_exact.
 
template<typename Target , template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value
 Convenient access to the result value of is_detected_convertible.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Provides utility classes for syncing distributed data via MPI communication.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,97 +1,59 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ -type_traits.hh File Reference │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +communicator.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ +Provides utility classes for syncing distributed data via MPI communication. │ │ │ │ │ +_M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_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_:_:_S_t_d_:_:_n_o_n_e_s_u_c_h │ │ │ │ │ -  Type representing a lookup failure by std::detected_or and friends. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_z_e_O_n_e │ │ │ │ │ +  Flag for marking indexed data structures where data at each index is │ │ │ │ │ + of the same size. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_d_:_:_c_o_n_j_u_n_c_t_i_o_n_<_ _B_ _> │ │ │ │ │ -  forms the logical conjunction of the type traits B... _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e │ │ │ │ │ +  Flag for marking indexed data structures where the data at each index │ │ │ │ │ + may be a variable multiple of another type. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_d_:_:_d_i_s_j_u_n_c_t_i_o_n_<_ _B_ _> │ │ │ │ │ -  forms the logical disjunction of the type traits B... _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _> │ │ │ │ │ +  Default policy used for communicating an indexed type. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_d_:_:_n_e_g_a_t_i_o_n_<_ _B_ _> │ │ │ │ │ -  forms the logical negation of the type traits B... _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _>_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_< │ │ │ │ │ + _K_,_ _n_ _>_,_ _A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _>_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_E_r_r_o_r │ │ │ │ │ +  Error thrown if there was a problem with the communication. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _>_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _T_ _> │ │ │ │ │ +  GatherScatter default implementation that just copies data. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +  A communicator that uses buffers to gather and scatter the data to be │ │ │ │ │ + send or received. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ -  │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template class Op, typename... Args> │ │ │ │ │ -using  _D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r = Impl::detector< Default, void, Op, Args... > │ │ │ │ │ -  Detects whether Op is valid and makes the result available. │ │ │ │ │ -  │ │ │ │ │ -template class Op, typename... Args> │ │ │ │ │ -using  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d = typename _d_e_t_e_c_t_e_d___o_r< _n_o_n_e_s_u_c_h, Op, Args... >:: │ │ │ │ │ - value_t │ │ │ │ │ -  Detects whether Op is valid. │ │ │ │ │ -  │ │ │ │ │ -template class Op, typename... Args> │ │ │ │ │ -using  _D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___t = typename _d_e_t_e_c_t_e_d___o_r< _n_o_n_e_s_u_c_h, Op, Args... >:: │ │ │ │ │ - type │ │ │ │ │ -  Returns Op if that is valid; otherwise returns nonesuch. │ │ │ │ │ -  │ │ │ │ │ -template class Op, typename... Args> │ │ │ │ │ -using  _D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t = typename _d_e_t_e_c_t_e_d___o_r< Default, Op, Args... │ │ │ │ │ - >::type │ │ │ │ │ -  Returns Op if that is valid; otherwise returns the fallback │ │ │ │ │ - type Default. │ │ │ │ │ -  │ │ │ │ │ -template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -using  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t = std::is_same< Expected, _d_e_t_e_c_t_e_d___t< Op, │ │ │ │ │ - Args... > > │ │ │ │ │ -  Checks whether Op is Expected without causing an error if │ │ │ │ │ - Op is invalid. │ │ │ │ │ -  │ │ │ │ │ -template class Op, typename... Args> │ │ │ │ │ -using  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e = std::is_convertible< Target, │ │ │ │ │ - _d_e_t_e_c_t_e_d___t< Op, Args... > > │ │ │ │ │ -  Checks whether Op is convertible to Target without causing an │ │ │ │ │ - error if Op is invalid. │ │ │ │ │ -  │ │ │ │ │ -template class Fallback, template< typename... > class │ │ │ │ │ -TargetType, typename... Args> │ │ │ │ │ -using  _D_u_n_e_:_:_d_e_t_e_c_t_e_d___o_r___f_a_l_l_b_a_c_k___t = _S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t< decltype(detail:: │ │ │ │ │ - warningIfNotDefined< _S_t_d_:_:_d_e_t_e_c_t_e_d___t< Fallback, Args... > >(std:: │ │ │ │ │ - declval< const _S_t_d_:_:_d_e_t_e_c_t_e_d___t< TargetType, Args... > * >())), │ │ │ │ │ - TargetType, Args... > │ │ │ │ │ -  This type will be either TargetType if it exists, or the │ │ │ │ │ - Fallback type. │ │ │ │ │ -  │ │ │ │ │ -VVaarriiaabblleess │ │ │ │ │ -template class Op, typename... Args> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___v = _i_s___d_e_t_e_c_t_e_d::value │ │ │ │ │ -  Detects whether Op is valid and makes the result │ │ │ │ │ - available as a value. │ │ │ │ │ -  │ │ │ │ │ -template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t___v = │ │ │ │ │ - _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t::value │ │ │ │ │ -  Convenient access to the result value of is_detected_exact. │ │ │ │ │ -  │ │ │ │ │ -template class Op, typename... Args> │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e___v = │ │ │ │ │ - _i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e::value │ │ │ │ │ -  Convenient access to the result value of │ │ │ │ │ - is_detected_convertible. │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Provides utility classes for syncing distributed data via MPI communication. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: type_traits.hh Source File │ │ │ │ +dune-common: communicator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,223 +70,1040 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
type_traits.hh
│ │ │ │ +
communicator.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_TYPE_TRAITS_HH
│ │ │ │ +
5#ifndef DUNE_COMMUNICATOR
│ │ │ │ +
6#define DUNE_COMMUNICATOR
│ │ │ │
7
│ │ │ │ -
8#include <type_traits>
│ │ │ │ - │ │ │ │ - │ │ │ │ -
11
│ │ │ │ -
12#if __has_include(<experimental/type_traits>)
│ │ │ │ -
13#include <experimental/type_traits>
│ │ │ │ -
14#endif
│ │ │ │ -
15
│ │ │ │ -
16namespace Dune
│ │ │ │ -
17{
│ │ │ │ +
8#if HAVE_MPI
│ │ │ │ +
9
│ │ │ │ +
10#include <cassert>
│ │ │ │ +
11#include <cstddef>
│ │ │ │ +
12#include <iostream>
│ │ │ │ +
13#include <map>
│ │ │ │ +
14#include <type_traits>
│ │ │ │ +
15#include <utility>
│ │ │ │ +
16
│ │ │ │ +
17#include <mpi.h>
│ │ │ │
18
│ │ │ │ -
20
│ │ │ │ -
29namespace Std
│ │ │ │ -
30{
│ │ │ │ -
31
│ │ │ │ -
34 using std::bool_constant;
│ │ │ │ -
35
│ │ │ │ -
36#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ -
37
│ │ │ │ -
38 using std::experimental::nonesuch;
│ │ │ │ -
39 using std::experimental::detected_or;
│ │ │ │ -
40 using std::experimental::is_detected;
│ │ │ │ -
41 using std::experimental::detected_t;
│ │ │ │ -
42 using std::experimental::is_detected_v;
│ │ │ │ -
43 using std::experimental::detected_or_t;
│ │ │ │ -
44 using std::experimental::is_detected_exact;
│ │ │ │ -
45 using std::experimental::is_detected_exact_v;
│ │ │ │ -
46 using std::experimental::is_detected_convertible;
│ │ │ │ -
47 using std::experimental::is_detected_convertible_v;
│ │ │ │ -
48
│ │ │ │ -
49#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ -
50
│ │ │ │ -
51 // fallback version of std::experimental::is_detected et al., heavily scribbled
│ │ │ │ -
52 // from cppreference.com (but there is actually not much implementation to the thing)
│ │ │ │ -
53
│ │ │ │ -
54#ifndef DOXYGEN
│ │ │ │ -
55
│ │ │ │ -
56 namespace Impl {
│ │ │ │ -
57
│ │ │ │ -
58 // default version of detector, this gets matched on failure
│ │ │ │ -
59 template<typename Default, typename Void, template<typename...> class Op, typename... Args>
│ │ │ │ -
60 struct detector
│ │ │ │ -
61 {
│ │ │ │ -
62 using value_t = std::false_type;
│ │ │ │ -
63 using type = Default;
│ │ │ │ -
64 };
│ │ │ │ -
65
│ │ │ │ -
66 // specialization of detector that matches if Op<Args...> can be instantiated
│ │ │ │ -
67 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ -
68 struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
│ │ │ │ -
69 {
│ │ │ │ -
70 using value_t = std::true_type;
│ │ │ │ -
71 using type = Op<Args...>;
│ │ │ │ -
72 };
│ │ │ │ -
73
│ │ │ │ -
74 }
│ │ │ │ -
75
│ │ │ │ -
76#endif // DOXYGEN
│ │ │ │ -
77
│ │ │ │ -
79
│ │ │ │ -
│ │ │ │ -
87 struct nonesuch
│ │ │ │ -
88 {
│ │ │ │ -
89 nonesuch() = delete;
│ │ │ │ -
90 ~nonesuch() = delete;
│ │ │ │ -
91 nonesuch(const nonesuch&) = delete;
│ │ │ │ -
92 void operator=(const nonesuch&) = delete;
│ │ │ │ -
93 };
│ │ │ │ -
│ │ │ │ -
94
│ │ │ │ -
96
│ │ │ │ -
127 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ -
128 using detected_or = Impl::detector<Default,void,Op,Args...>;
│ │ │ │ -
129
│ │ │ │ -
131
│ │ │ │ -
140 template<template<typename...> class Op, typename... Args>
│ │ │ │ -
141 using is_detected = typename detected_or<nonesuch,Op,Args...>::value_t;
│ │ │ │ -
142
│ │ │ │ -
143#ifdef __cpp_variable_templates
│ │ │ │ -
145
│ │ │ │ -
154 template<template<typename...> class Op, typename... Args>
│ │ │ │ -
155 constexpr bool is_detected_v = is_detected<Op,Args...>::value;
│ │ │ │ -
156#endif // __cpp_variable_templates
│ │ │ │ -
157
│ │ │ │ -
159
│ │ │ │ -
169 template<template<typename...> class Op, typename... Args>
│ │ │ │ -
170 using detected_t = typename detected_or<nonesuch,Op,Args...>::type;
│ │ │ │ -
171
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
23
│ │ │ │ +
24namespace Dune
│ │ │ │ +
25{
│ │ │ │ +
│ │ │ │ +
109 struct SizeOne
│ │ │ │ +
110 {};
│ │ │ │ +
│ │ │ │ +
111
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
118 {};
│ │ │ │ +
│ │ │ │ +
119
│ │ │ │ +
120
│ │ │ │ +
126 template<class V>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
128 {
│ │ │ │ +
140 typedef V Type;
│ │ │ │ +
141
│ │ │ │ +
147 typedef typename V::value_type IndexedType;
│ │ │ │ +
148
│ │ │ │ + │ │ │ │ +
154
│ │ │ │ +
163 static const void* getAddress(const V& v, int index);
│ │ │ │ +
164
│ │ │ │ +
170 static int getSize(const V&, int index);
│ │ │ │ +
171 };
│ │ │ │
172
│ │ │ │ +
173 template<class K, int n> class FieldVector;
│ │ │ │
174
│ │ │ │ -
184 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ -
185 using detected_or_t = typename detected_or<Default,Op,Args...>::type;
│ │ │ │ -
186
│ │ │ │ -
188
│ │ │ │ -
194 template<typename Expected, template<typename...> class Op, typename... Args>
│ │ │ │ -
195 using is_detected_exact = std::is_same<Expected,detected_t<Op,Args...>>;
│ │ │ │ +
175 template<class B, class A> class VariableBlockVector;
│ │ │ │ +
176
│ │ │ │ +
177 template<class K, class A, int n>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
179 {
│ │ │ │ + │ │ │ │ +
181
│ │ │ │ +
182 typedef typename Type::B IndexedType;
│ │ │ │ +
183
│ │ │ │ + │ │ │ │ +
185
│ │ │ │ +
186 static const void* getAddress(const Type& v, int i);
│ │ │ │ +
187
│ │ │ │ +
188 static int getSize(const Type& v, int i);
│ │ │ │ +
189 };
│ │ │ │ +
│ │ │ │ +
190
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
195 {};
│ │ │ │ +
│ │ │ │
196
│ │ │ │ -
197#ifdef __cpp_variable_templates
│ │ │ │ -
199
│ │ │ │ -
205 template<typename Expected, template<typename...> class Op, typename... Args>
│ │ │ │ -
206 constexpr bool is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value;
│ │ │ │ -
207#endif // __cpp_variable_templates
│ │ │ │ +
200 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
202 {
│ │ │ │ + │ │ │ │ +
204
│ │ │ │ +
205 static const IndexedType& gather(const T& vec, std::size_t i);
│ │ │ │ +
206
│ │ │ │ +
207 static void scatter(T& vec, const IndexedType& v, std::size_t i);
│ │ │ │
208
│ │ │ │ +
209 };
│ │ │ │ +
│ │ │ │
210
│ │ │ │ -
216 template<typename Target, template<typename...> class Op, typename... Args>
│ │ │ │ -
217 using is_detected_convertible = std::is_convertible<Target,detected_t<Op,Args...>>;
│ │ │ │ -
218
│ │ │ │ -
219#ifdef __cpp_variable_templates
│ │ │ │ -
221
│ │ │ │ -
227 template<typename Target, template<typename...> class Op, typename... Args>
│ │ │ │ -
228 constexpr bool is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value;
│ │ │ │ -
229#endif // __cpp_variable_templates
│ │ │ │ -
230
│ │ │ │ -
231#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ -
232
│ │ │ │ -
233
│ │ │ │ -
234
│ │ │ │ -
235 // conjunction
│ │ │ │ -
236 // -----------
│ │ │ │ -
237
│ │ │ │ -
245 template< class... B >
│ │ │ │ -
│ │ │ │ -
246 struct [[deprecated("Will be removed after release 2.8. Use std::conjunction instead.")]] conjunction
│ │ │ │ -
247 : std::conjunction<B...>
│ │ │ │ -
248 {};
│ │ │ │ -
│ │ │ │ -
249
│ │ │ │ -
250
│ │ │ │ -
251 // disjunction
│ │ │ │ -
252 // -----------
│ │ │ │ -
253
│ │ │ │ -
261 template< class... B >
│ │ │ │ -
│ │ │ │ -
262 struct [[deprecated("Will be removed after release 2.8. Use std::disjunction instead.")]] disjunction
│ │ │ │ -
263 : std::disjunction<B...>
│ │ │ │ -
264 {};
│ │ │ │ -
│ │ │ │ -
265
│ │ │ │ -
266
│ │ │ │ -
267 // negation
│ │ │ │ -
268 // --------
│ │ │ │ -
269
│ │ │ │ -
277 template<class B>
│ │ │ │ -
│ │ │ │ -
278 struct [[deprecated("Will be removed after release 2.8. Use std::negation instead.")]] negation
│ │ │ │ -
279 : std::negation<B>
│ │ │ │ -
280 {};
│ │ │ │ -
│ │ │ │ -
281
│ │ │ │ -
282} // namespace Std
│ │ │ │ -
283
│ │ │ │ -
284
│ │ │ │ -
285namespace detail
│ │ │ │ -
286{
│ │ │ │ -
287 template <class Type>
│ │ │ │ -
288 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code calling `detected_or_fallback_t` for getting the source of this warning!")]]
│ │ │ │ -
289 Type warningIfNotDefined(const Std::nonesuch*);
│ │ │ │ +
222 template<typename T>
│ │ │ │ +
223 class DatatypeCommunicator : public InterfaceBuilder
│ │ │ │ +
224 {
│ │ │ │ +
225 public:
│ │ │ │ +
226
│ │ │ │ +
230 typedef T ParallelIndexSet;
│ │ │ │ +
231
│ │ │ │ + │ │ │ │ +
236
│ │ │ │ +
240 typedef typename RemoteIndices::GlobalIndex GlobalIndex;
│ │ │ │ +
241
│ │ │ │ +
245 typedef typename RemoteIndices::Attribute Attribute;
│ │ │ │ +
246
│ │ │ │ +
250 typedef typename RemoteIndices::LocalIndex LocalIndex;
│ │ │ │ +
251
│ │ │ │ +
255 DatatypeCommunicator();
│ │ │ │ +
256
│ │ │ │ +
260 ~DatatypeCommunicator();
│ │ │ │ +
261
│ │ │ │ +
288 template<class T1, class T2, class V>
│ │ │ │ +
289 void build(const RemoteIndices& remoteIndices, const T1& sourceFlags, V& sendData, const T2& destFlags, V& receiveData);
│ │ │ │
290
│ │ │ │ -
291 template <class Type, class T>
│ │ │ │ -
292 Type warningIfNotDefined(const T*);
│ │ │ │ -
293}
│ │ │ │ -
294
│ │ │ │ -
296template <template<typename...> class Fallback,
│ │ │ │ -
297 template<typename...> class TargetType, typename... Args>
│ │ │ │ - │ │ │ │ -
299 detail::warningIfNotDefined<Std::detected_t<Fallback, Args...> >(std::declval<const Std::detected_t<TargetType, Args...>*>())),
│ │ │ │ -
300 TargetType, Args...>;
│ │ │ │ -
301
│ │ │ │ -
302
│ │ │ │ -
303} // namespace Dune
│ │ │ │ -
304
│ │ │ │ -
305#endif // #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Utilities for type computations, constraining overloads, ...
│ │ │ │ -
constexpr bool is_detected_exact_v
Convenient access to the result value of is_detected_exact.
Definition type_traits.hh:206
│ │ │ │ -
constexpr bool is_detected_convertible_v
Convenient access to the result value of is_detected_convertible.
Definition type_traits.hh:228
│ │ │ │ -
typename detected_or< Default, Op, Args... >::type detected_or_t
Returns Op<Args...> if that is valid; otherwise returns the fallback type Default.
Definition type_traits.hh:185
│ │ │ │ -
std::is_same< Expected, detected_t< Op, Args... > > is_detected_exact
Checks whether Op<Args...> is Expected without causing an error if Op<Args...> is invalid.
Definition type_traits.hh:195
│ │ │ │ -
typename detected_or< nonesuch, Op, Args... >::type detected_t
Returns Op<Args...> if that is valid; otherwise returns nonesuch.
Definition type_traits.hh:170
│ │ │ │ -
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition typetraits.hh:40
│ │ │ │ -
constexpr bool is_detected_v
Detects whether Op<Args...> is valid and makes the result available as a value.
Definition type_traits.hh:155
│ │ │ │ -
typename detected_or< nonesuch, Op, Args... >::value_t is_detected
Detects whether Op<Args...> is valid.
Definition type_traits.hh:141
│ │ │ │ -
Impl::detector< Default, void, Op, Args... > detected_or
Detects whether Op<Args...> is valid and makes the result available.
Definition type_traits.hh:128
│ │ │ │ -
std::is_convertible< Target, detected_t< Op, Args... > > is_detected_convertible
Checks whether Op<Args...> is convertible to Target without causing an error if Op<Args....
Definition type_traits.hh:217
│ │ │ │ -
STL namespace.
│ │ │ │ +
294 void forward();
│ │ │ │ +
295
│ │ │ │ +
299 void backward();
│ │ │ │ +
300
│ │ │ │ +
304 void free();
│ │ │ │ +
305 private:
│ │ │ │ +
309 constexpr static int commTag_ = 234;
│ │ │ │ +
310
│ │ │ │ +
314 const RemoteIndices* remoteIndices_;
│ │ │ │ +
315
│ │ │ │ +
316 typedef std::map<int,std::pair<MPI_Datatype,MPI_Datatype> >
│ │ │ │ +
317 MessageTypeMap;
│ │ │ │ +
318
│ │ │ │ +
322 MessageTypeMap messageTypes;
│ │ │ │ +
323
│ │ │ │ +
327 void* data_;
│ │ │ │ +
328
│ │ │ │ +
329 MPI_Request* requests_[2];
│ │ │ │ +
330
│ │ │ │ +
334 bool created_;
│ │ │ │ +
335
│ │ │ │ +
339 template<class V, bool FORWARD>
│ │ │ │ +
340 void createRequests(V& sendData, V& receiveData);
│ │ │ │ +
341
│ │ │ │ +
345 template<class T1, class T2, class V, bool send>
│ │ │ │ +
346 void createDataTypes(const T1& source, const T2& destination, V& data);
│ │ │ │ +
347
│ │ │ │ +
351 void sendRecv(MPI_Request* req);
│ │ │ │ +
352
│ │ │ │ +
356 struct IndexedTypeInformation
│ │ │ │ +
357 {
│ │ │ │ +
363 void build(int i)
│ │ │ │ +
364 {
│ │ │ │ +
365 length = new int[i];
│ │ │ │ +
366 displ = new MPI_Aint[i];
│ │ │ │ +
367 size = i;
│ │ │ │ +
368 }
│ │ │ │ +
369
│ │ │ │ +
373 void free()
│ │ │ │ +
374 {
│ │ │ │ +
375 delete[] length;
│ │ │ │ +
376 delete[] displ;
│ │ │ │ +
377 }
│ │ │ │ +
379 int* length;
│ │ │ │ +
381 MPI_Aint* displ;
│ │ │ │ +
387 int elements;
│ │ │ │ +
391 int size;
│ │ │ │ +
392 };
│ │ │ │ +
393
│ │ │ │ +
399 template<class V>
│ │ │ │ +
400 struct MPIDatatypeInformation
│ │ │ │ +
401 {
│ │ │ │ +
406 MPIDatatypeInformation(const V& data) : data_(data)
│ │ │ │ +
407 {}
│ │ │ │ +
408
│ │ │ │ +
414 void reserve(int proc, int size)
│ │ │ │ +
415 {
│ │ │ │ +
416 information_[proc].build(size);
│ │ │ │ +
417 }
│ │ │ │ +
424 void add(int proc, int local)
│ │ │ │ +
425 {
│ │ │ │ +
426 IndexedTypeInformation& info=information_[proc];
│ │ │ │ +
427 assert((info.elements)<info.size);
│ │ │ │ +
428 MPI_Get_address( const_cast<void*>(CommPolicy<V>::getAddress(data_, local)),
│ │ │ │ +
429 info.displ+info.elements);
│ │ │ │ +
430 info.length[info.elements]=CommPolicy<V>::getSize(data_, local);
│ │ │ │ +
431 info.elements++;
│ │ │ │ +
432 }
│ │ │ │ +
433
│ │ │ │ +
438 std::map<int,IndexedTypeInformation> information_;
│ │ │ │ +
442 const V& data_;
│ │ │ │ +
443
│ │ │ │ +
444 };
│ │ │ │ +
445
│ │ │ │ +
446 };
│ │ │ │ +
│ │ │ │ +
447
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
458 {
│ │ │ │ +
459
│ │ │ │ +
460 public:
│ │ │ │ + │ │ │ │ +
465
│ │ │ │ +
472 template<class Data, class Interface>
│ │ │ │ +
473 typename std::enable_if<std::is_same<SizeOne,typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type
│ │ │ │ +
474 build(const Interface& interface);
│ │ │ │ +
475
│ │ │ │ +
483 template<class Data, class Interface>
│ │ │ │ +
484 void build(const Data& source, const Data& target, const Interface& interface);
│ │ │ │ +
485
│ │ │ │ +
514 template<class GatherScatter, class Data>
│ │ │ │ +
515 void forward(const Data& source, Data& dest);
│ │ │ │ +
516
│ │ │ │ +
545 template<class GatherScatter, class Data>
│ │ │ │ +
546 void backward(Data& source, const Data& dest);
│ │ │ │ +
547
│ │ │ │ +
573 template<class GatherScatter, class Data>
│ │ │ │ +
574 void forward(Data& data);
│ │ │ │ +
575
│ │ │ │ +
601 template<class GatherScatter, class Data>
│ │ │ │ +
602 void backward(Data& data);
│ │ │ │ +
603
│ │ │ │ +
607 void free();
│ │ │ │ +
608
│ │ │ │ + │ │ │ │ +
613
│ │ │ │ +
614 private:
│ │ │ │ +
615
│ │ │ │ +
619 typedef std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
│ │ │ │ +
620 InterfaceMap;
│ │ │ │ +
621
│ │ │ │ +
622
│ │ │ │ +
626 template<class Data, typename IndexedTypeFlag>
│ │ │ │ +
627 struct MessageSizeCalculator
│ │ │ │ +
628 {};
│ │ │ │ +
629
│ │ │ │ +
634 template<class Data>
│ │ │ │ +
635 struct MessageSizeCalculator<Data,SizeOne>
│ │ │ │ +
636 {
│ │ │ │ +
643 inline int operator()(const InterfaceInformation& info) const;
│ │ │ │ +
652 inline int operator()(const Data& data, const InterfaceInformation& info) const;
│ │ │ │ +
653 };
│ │ │ │ +
654
│ │ │ │ +
659 template<class Data>
│ │ │ │ +
660 struct MessageSizeCalculator<Data,VariableSize>
│ │ │ │ +
661 {
│ │ │ │ +
670 inline int operator()(const Data& data, const InterfaceInformation& info) const;
│ │ │ │ +
671 };
│ │ │ │ +
672
│ │ │ │ +
676 template<class Data, class GatherScatter, bool send, typename IndexedTypeFlag>
│ │ │ │ +
677 struct MessageGatherer
│ │ │ │ +
678 {};
│ │ │ │ +
679
│ │ │ │ +
684 template<class Data, class GatherScatter, bool send>
│ │ │ │ +
685 struct MessageGatherer<Data,GatherScatter,send,SizeOne>
│ │ │ │ +
686 {
│ │ │ │ +
688 typedef typename CommPolicy<Data>::IndexedType Type;
│ │ │ │ +
689
│ │ │ │ +
694 typedef GatherScatter Gatherer;
│ │ │ │ +
695
│ │ │ │ +
701 constexpr static bool forward = send;
│ │ │ │ +
702
│ │ │ │ +
710 inline void operator()(const InterfaceMap& interface, const Data& data, Type* buffer, size_t bufferSize) const;
│ │ │ │ +
711 };
│ │ │ │ +
712
│ │ │ │ +
717 template<class Data, class GatherScatter, bool send>
│ │ │ │ +
718 struct MessageGatherer<Data,GatherScatter,send,VariableSize>
│ │ │ │ +
719 {
│ │ │ │ +
721 typedef typename CommPolicy<Data>::IndexedType Type;
│ │ │ │ +
722
│ │ │ │ +
727 typedef GatherScatter Gatherer;
│ │ │ │ +
728
│ │ │ │ +
734 constexpr static bool forward = send;
│ │ │ │ +
735
│ │ │ │ +
743 inline void operator()(const InterfaceMap& interface, const Data& data, Type* buffer, size_t bufferSize) const;
│ │ │ │ +
744 };
│ │ │ │ +
745
│ │ │ │ +
749 template<class Data, class GatherScatter, bool send, typename IndexedTypeFlag>
│ │ │ │ +
750 struct MessageScatterer
│ │ │ │ +
751 {};
│ │ │ │ +
752
│ │ │ │ +
757 template<class Data, class GatherScatter, bool send>
│ │ │ │ +
758 struct MessageScatterer<Data,GatherScatter,send,SizeOne>
│ │ │ │ +
759 {
│ │ │ │ +
761 typedef typename CommPolicy<Data>::IndexedType Type;
│ │ │ │ +
762
│ │ │ │ +
767 typedef GatherScatter Scatterer;
│ │ │ │ +
768
│ │ │ │ +
774 constexpr static bool forward = send;
│ │ │ │ +
775
│ │ │ │ +
783 inline void operator()(const InterfaceMap& interface, Data& data, Type* buffer, const int& proc) const;
│ │ │ │ +
784 };
│ │ │ │ +
789 template<class Data, class GatherScatter, bool send>
│ │ │ │ +
790 struct MessageScatterer<Data,GatherScatter,send,VariableSize>
│ │ │ │ +
791 {
│ │ │ │ +
793 typedef typename CommPolicy<Data>::IndexedType Type;
│ │ │ │ +
794
│ │ │ │ +
799 typedef GatherScatter Scatterer;
│ │ │ │ +
800
│ │ │ │ +
806 constexpr static bool forward = send;
│ │ │ │ +
807
│ │ │ │ +
815 inline void operator()(const InterfaceMap& interface, Data& data, Type* buffer, const int& proc) const;
│ │ │ │ +
816 };
│ │ │ │ +
817
│ │ │ │ +
821 struct MessageInformation
│ │ │ │ +
822 {
│ │ │ │ +
824 MessageInformation()
│ │ │ │ +
825 : start_(0), size_(0)
│ │ │ │ +
826 {}
│ │ │ │ +
827
│ │ │ │ +
835 MessageInformation(size_t start, size_t size)
│ │ │ │ +
836 : start_(start), size_(size)
│ │ │ │ +
837 {}
│ │ │ │ +
841 size_t start_;
│ │ │ │ +
845 size_t size_;
│ │ │ │ +
846 };
│ │ │ │ +
847
│ │ │ │ +
854 typedef std::map<int,std::pair<MessageInformation,MessageInformation> >
│ │ │ │ +
855 InformationMap;
│ │ │ │ +
859 InformationMap messageInformation_;
│ │ │ │ +
863 char* buffers_[2];
│ │ │ │ +
867 size_t bufferSize_[2];
│ │ │ │ +
868
│ │ │ │ +
872 constexpr static int commTag_ = 0;
│ │ │ │ +
873
│ │ │ │ +
877 std::map<int,std::pair<InterfaceInformation,InterfaceInformation> > interfaces_;
│ │ │ │ +
878
│ │ │ │ +
879 MPI_Comm communicator_;
│ │ │ │ +
880
│ │ │ │ +
884 template<class GatherScatter, bool FORWARD, class Data>
│ │ │ │ +
885 void sendRecv(const Data& source, Data& target);
│ │ │ │ +
886
│ │ │ │ +
887 };
│ │ │ │ +
│ │ │ │ +
888
│ │ │ │ +
889#ifndef DOXYGEN
│ │ │ │ +
890
│ │ │ │ +
891 template<class V>
│ │ │ │ +
892 inline const void* CommPolicy<V>::getAddress(const V& v, int index)
│ │ │ │ +
893 {
│ │ │ │ +
894 return &(v[index]);
│ │ │ │ +
895 }
│ │ │ │ +
896
│ │ │ │ +
897 template<class V>
│ │ │ │ +
898 inline int CommPolicy<V>::getSize([[maybe_unused]] const V& v, [[maybe_unused]] int index)
│ │ │ │ +
899 {
│ │ │ │ +
900 return 1;
│ │ │ │ +
901 }
│ │ │ │ +
902
│ │ │ │ +
903 template<class K, class A, int n>
│ │ │ │ +
904 inline const void* CommPolicy<VariableBlockVector<FieldVector<K, n>, A> >::getAddress(const Type& v, int index)
│ │ │ │ +
905 {
│ │ │ │ +
906 return &(v[index][0]);
│ │ │ │ +
907 }
│ │ │ │ +
908
│ │ │ │ +
909 template<class K, class A, int n>
│ │ │ │ +
910 inline int CommPolicy<VariableBlockVector<FieldVector<K, n>, A> >::getSize(const Type& v, int index)
│ │ │ │ +
911 {
│ │ │ │ +
912 return v[index].getsize();
│ │ │ │ +
913 }
│ │ │ │ +
914
│ │ │ │ +
915 template<class T>
│ │ │ │ +
916 inline const typename CopyGatherScatter<T>::IndexedType& CopyGatherScatter<T>::gather(const T & vec, std::size_t i)
│ │ │ │ +
917 {
│ │ │ │ +
918 return vec[i];
│ │ │ │ +
919 }
│ │ │ │ +
920
│ │ │ │ +
921 template<class T>
│ │ │ │ +
922 inline void CopyGatherScatter<T>::scatter(T& vec, const IndexedType& v, std::size_t i)
│ │ │ │ +
923 {
│ │ │ │ +
924 vec[i]=v;
│ │ │ │ +
925 }
│ │ │ │ +
926
│ │ │ │ +
927 template<typename T>
│ │ │ │ +
928 DatatypeCommunicator<T>::DatatypeCommunicator()
│ │ │ │ +
929 : remoteIndices_(0), created_(false)
│ │ │ │ +
930 {
│ │ │ │ +
931 requests_[0]=0;
│ │ │ │ +
932 requests_[1]=0;
│ │ │ │ +
933 }
│ │ │ │ +
934
│ │ │ │ +
935
│ │ │ │ +
936
│ │ │ │ +
937 template<typename T>
│ │ │ │ +
938 DatatypeCommunicator<T>::~DatatypeCommunicator()
│ │ │ │ +
939 {
│ │ │ │ +
940 free();
│ │ │ │ +
941 }
│ │ │ │ +
942
│ │ │ │ +
943 template<typename T>
│ │ │ │ +
944 template<class T1, class T2, class V>
│ │ │ │ +
945 inline void DatatypeCommunicator<T>::build(const RemoteIndices& remoteIndices,
│ │ │ │ +
946 const T1& source, V& sendData,
│ │ │ │ +
947 const T2& destination, V& receiveData)
│ │ │ │ +
948 {
│ │ │ │ +
949 remoteIndices_ = &remoteIndices;
│ │ │ │ +
950 free();
│ │ │ │ +
951 createDataTypes<T1,T2,V,false>(source,destination, receiveData);
│ │ │ │ +
952 createDataTypes<T1,T2,V,true>(source,destination, sendData);
│ │ │ │ +
953 createRequests<V,true>(sendData, receiveData);
│ │ │ │ +
954 createRequests<V,false>(receiveData, sendData);
│ │ │ │ +
955 created_=true;
│ │ │ │ +
956 }
│ │ │ │ +
957
│ │ │ │ +
958 template<typename T>
│ │ │ │ +
959 void DatatypeCommunicator<T>::free()
│ │ │ │ +
960 {
│ │ │ │ +
961 if(created_) {
│ │ │ │ +
962 delete[] requests_[0];
│ │ │ │ +
963 delete[] requests_[1];
│ │ │ │ +
964 typedef MessageTypeMap::iterator iterator;
│ │ │ │ +
965 typedef MessageTypeMap::const_iterator const_iterator;
│ │ │ │ +
966
│ │ │ │ +
967 const const_iterator end=messageTypes.end();
│ │ │ │ +
968
│ │ │ │ +
969 for(iterator process = messageTypes.begin(); process != end; ++process) {
│ │ │ │ +
970 MPI_Datatype *type = &(process->second.first);
│ │ │ │ +
971 int finalized=0;
│ │ │ │ +
972 MPI_Finalized(&finalized);
│ │ │ │ +
973 if(*type!=MPI_DATATYPE_NULL && !finalized)
│ │ │ │ +
974 MPI_Type_free(type);
│ │ │ │ +
975 type = &(process->second.second);
│ │ │ │ +
976 if(*type!=MPI_DATATYPE_NULL && !finalized)
│ │ │ │ +
977 MPI_Type_free(type);
│ │ │ │ +
978 }
│ │ │ │ +
979 messageTypes.clear();
│ │ │ │ +
980 created_=false;
│ │ │ │ +
981 }
│ │ │ │ +
982
│ │ │ │ +
983 }
│ │ │ │ +
984
│ │ │ │ +
985 template<typename T>
│ │ │ │ +
986 template<class T1, class T2, class V, bool send>
│ │ │ │ +
987 void DatatypeCommunicator<T>::createDataTypes(const T1& sourceFlags, const T2& destFlags, V& data)
│ │ │ │ +
988 {
│ │ │ │ +
989
│ │ │ │ +
990 MPIDatatypeInformation<V> dataInfo(data);
│ │ │ │ +
991 this->template buildInterface<RemoteIndices,T1,T2,MPIDatatypeInformation<V>,send>(*remoteIndices_,sourceFlags, destFlags, dataInfo);
│ │ │ │ +
992
│ │ │ │ +
993 typedef typename RemoteIndices::RemoteIndexMap::const_iterator const_iterator;
│ │ │ │ +
994 const const_iterator end=this->remoteIndices_->end();
│ │ │ │ +
995
│ │ │ │ +
996 // Allocate MPI_Datatypes and deallocate memory for the type construction.
│ │ │ │ +
997 for(const_iterator process=this->remoteIndices_->begin(); process != end; ++process) {
│ │ │ │ +
998 IndexedTypeInformation& info=dataInfo.information_[process->first];
│ │ │ │ +
999 // Shift the displacement
│ │ │ │ +
1000 MPI_Aint base;
│ │ │ │ +
1001 MPI_Get_address(const_cast<void *>(CommPolicy<V>::getAddress(data, 0)), &base);
│ │ │ │ +
1002
│ │ │ │ +
1003 for(int i=0; i< info.elements; i++) {
│ │ │ │ +
1004 info.displ[i]-=base;
│ │ │ │ +
1005 }
│ │ │ │ +
1006
│ │ │ │ +
1007 // Create data type
│ │ │ │ +
1008 MPI_Datatype* type = &( send ? messageTypes[process->first].first : messageTypes[process->first].second);
│ │ │ │ +
1009 MPI_Type_create_hindexed(info.elements, info.length, info.displ,
│ │ │ │ +
1010 MPITraits<typename CommPolicy<V>::IndexedType>::getType(), type);
│ │ │ │ +
1011 MPI_Type_commit(type);
│ │ │ │ +
1012 // Deallocate memory
│ │ │ │ +
1013 info.free();
│ │ │ │ +
1014 }
│ │ │ │ +
1015 }
│ │ │ │ +
1016
│ │ │ │ +
1017 template<typename T>
│ │ │ │ +
1018 template<class V, bool createForward>
│ │ │ │ +
1019 void DatatypeCommunicator<T>::createRequests(V& sendData, V& receiveData)
│ │ │ │ +
1020 {
│ │ │ │ +
1021 typedef std::map<int,std::pair<MPI_Datatype,MPI_Datatype> >::const_iterator MapIterator;
│ │ │ │ +
1022 int rank;
│ │ │ │ +
1023 static int index = createForward ? 1 : 0;
│ │ │ │ +
1024 int noMessages = messageTypes.size();
│ │ │ │ +
1025 // allocate request handles
│ │ │ │ +
1026 requests_[index] = new MPI_Request[2*noMessages];
│ │ │ │ +
1027 const MapIterator end = messageTypes.end();
│ │ │ │ +
1028 int request=0;
│ │ │ │ +
1029 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ +
1030
│ │ │ │ +
1031 // Set up the requests for receiving first
│ │ │ │ +
1032 for(MapIterator process = messageTypes.begin(); process != end;
│ │ │ │ +
1033 ++process, ++request) {
│ │ │ │ +
1034 MPI_Datatype type = createForward ? process->second.second : process->second.first;
│ │ │ │ +
1035 void* address = const_cast<void*>(CommPolicy<V>::getAddress(receiveData,0));
│ │ │ │ +
1036 MPI_Recv_init(address, 1, type, process->first, commTag_, this->remoteIndices_->communicator(), requests_[index]+request);
│ │ │ │ +
1037 }
│ │ │ │ +
1038
│ │ │ │ +
1039 // And now the send requests
│ │ │ │ +
1040
│ │ │ │ +
1041 for(MapIterator process = messageTypes.begin(); process != end;
│ │ │ │ +
1042 ++process, ++request) {
│ │ │ │ +
1043 MPI_Datatype type = createForward ? process->second.first : process->second.second;
│ │ │ │ +
1044 void* address = const_cast<void*>(CommPolicy<V>::getAddress(sendData, 0));
│ │ │ │ +
1045 MPI_Ssend_init(address, 1, type, process->first, commTag_, this->remoteIndices_->communicator(), requests_[index]+request);
│ │ │ │ +
1046 }
│ │ │ │ +
1047 }
│ │ │ │ +
1048
│ │ │ │ +
1049 template<typename T>
│ │ │ │ +
1050 void DatatypeCommunicator<T>::forward()
│ │ │ │ +
1051 {
│ │ │ │ +
1052 sendRecv(requests_[1]);
│ │ │ │ +
1053 }
│ │ │ │ +
1054
│ │ │ │ +
1055 template<typename T>
│ │ │ │ +
1056 void DatatypeCommunicator<T>::backward()
│ │ │ │ +
1057 {
│ │ │ │ +
1058 sendRecv(requests_[0]);
│ │ │ │ +
1059 }
│ │ │ │ +
1060
│ │ │ │ +
1061 template<typename T>
│ │ │ │ +
1062 void DatatypeCommunicator<T>::sendRecv(MPI_Request* requests)
│ │ │ │ +
1063 {
│ │ │ │ +
1064 int noMessages = messageTypes.size();
│ │ │ │ +
1065 // Start the receive calls first
│ │ │ │ +
1066 MPI_Startall(noMessages, requests);
│ │ │ │ +
1067 // Now the send calls
│ │ │ │ +
1068 MPI_Startall(noMessages, requests+noMessages);
│ │ │ │ +
1069
│ │ │ │ +
1070 // Wait for completion of the communication send first then receive
│ │ │ │ +
1071 MPI_Status* status=new MPI_Status[2*noMessages];
│ │ │ │ +
1072 for(int i=0; i<2*noMessages; i++)
│ │ │ │ +
1073 status[i].MPI_ERROR=MPI_SUCCESS;
│ │ │ │ +
1074
│ │ │ │ +
1075 int send = MPI_Waitall(noMessages, requests+noMessages, status+noMessages);
│ │ │ │ +
1076 int receive = MPI_Waitall(noMessages, requests, status);
│ │ │ │ +
1077
│ │ │ │ +
1078 // Error checks
│ │ │ │ +
1079 int success=1, globalSuccess=0;
│ │ │ │ +
1080 if(send==MPI_ERR_IN_STATUS) {
│ │ │ │ +
1081 int rank;
│ │ │ │ +
1082 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank);
│ │ │ │ +
1083 std::cerr<<rank<<": Error in sending :"<<std::endl;
│ │ │ │ +
1084 // Search for the error
│ │ │ │ +
1085 for(int i=noMessages; i< 2*noMessages; i++)
│ │ │ │ +
1086 if(status[i].MPI_ERROR!=MPI_SUCCESS) {
│ │ │ │ +
1087 char message[300];
│ │ │ │ +
1088 int messageLength;
│ │ │ │ +
1089 MPI_Error_string(status[i].MPI_ERROR, message, &messageLength);
│ │ │ │ +
1090 std::cerr<<" source="<<status[i].MPI_SOURCE<<" message: ";
│ │ │ │ +
1091 for(int j = 0; j < messageLength; j++)
│ │ │ │ +
1092 std::cout << message[j];
│ │ │ │ +
1093 }
│ │ │ │ +
1094 std::cerr<<std::endl;
│ │ │ │ +
1095 success=0;
│ │ │ │ +
1096 }
│ │ │ │ +
1097
│ │ │ │ +
1098 if(receive==MPI_ERR_IN_STATUS) {
│ │ │ │ +
1099 int rank;
│ │ │ │ +
1100 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank);
│ │ │ │ +
1101 std::cerr<<rank<<": Error in receiving!"<<std::endl;
│ │ │ │ +
1102 // Search for the error
│ │ │ │ +
1103 for(int i=0; i< noMessages; i++)
│ │ │ │ +
1104 if(status[i].MPI_ERROR!=MPI_SUCCESS) {
│ │ │ │ +
1105 char message[300];
│ │ │ │ +
1106 int messageLength;
│ │ │ │ +
1107 MPI_Error_string(status[i].MPI_ERROR, message, &messageLength);
│ │ │ │ +
1108 std::cerr<<" source="<<status[i].MPI_SOURCE<<" message: ";
│ │ │ │ +
1109 for(int j = 0; j < messageLength; j++)
│ │ │ │ +
1110 std::cerr << message[j];
│ │ │ │ +
1111 }
│ │ │ │ +
1112 std::cerr<<std::endl;
│ │ │ │ +
1113 success=0;
│ │ │ │ +
1114 }
│ │ │ │ +
1115
│ │ │ │ +
1116 MPI_Allreduce(&success, &globalSuccess, 1, MPI_INT, MPI_MIN, this->remoteIndices_->communicator());
│ │ │ │ +
1117
│ │ │ │ +
1118 delete[] status;
│ │ │ │ +
1119
│ │ │ │ +
1120 if(!globalSuccess)
│ │ │ │ +
1121 DUNE_THROW(CommunicationError, "A communication error occurred!");
│ │ │ │ +
1122
│ │ │ │ +
1123 }
│ │ │ │ +
1124
│ │ │ │ + │ │ │ │ +
1126 {
│ │ │ │ +
1127 buffers_[0]=0;
│ │ │ │ +
1128 buffers_[1]=0;
│ │ │ │ +
1129 bufferSize_[0]=0;
│ │ │ │ +
1130 bufferSize_[1]=0;
│ │ │ │ +
1131 }
│ │ │ │ +
1132
│ │ │ │ +
1133 template<class Data, class Interface>
│ │ │ │ +
1134 typename std::enable_if<std::is_same<SizeOne, typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type
│ │ │ │ +
1135 BufferedCommunicator::build(const Interface& interface)
│ │ │ │ +
1136 {
│ │ │ │ +
1137 interfaces_=interface.interfaces();
│ │ │ │ +
1138 communicator_=interface.communicator();
│ │ │ │ +
1139 typedef typename std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
│ │ │ │ +
1140 ::const_iterator const_iterator;
│ │ │ │ +
1141 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
│ │ │ │ +
1142 const const_iterator end = interfaces_.end();
│ │ │ │ +
1143 int lrank;
│ │ │ │ +
1144 MPI_Comm_rank(communicator_, &lrank);
│ │ │ │ +
1145
│ │ │ │ +
1146 bufferSize_[0]=0;
│ │ │ │ +
1147 bufferSize_[1]=0;
│ │ │ │ +
1148
│ │ │ │ +
1149 for(const_iterator interfacePair = interfaces_.begin();
│ │ │ │ +
1150 interfacePair != end; ++interfacePair) {
│ │ │ │ +
1151 int noSend = MessageSizeCalculator<Data,Flag>() (interfacePair->second.first);
│ │ │ │ +
1152 int noRecv = MessageSizeCalculator<Data,Flag>() (interfacePair->second.second);
│ │ │ │ +
1153 if (noSend + noRecv > 0)
│ │ │ │ +
1154 messageInformation_.insert(std::make_pair(interfacePair->first,
│ │ │ │ +
1155 std::make_pair(MessageInformation(bufferSize_[0],
│ │ │ │ +
1156 noSend*sizeof(typename CommPolicy<Data>::IndexedType)),
│ │ │ │ +
1157 MessageInformation(bufferSize_[1],
│ │ │ │ +
1158 noRecv*sizeof(typename CommPolicy<Data>::IndexedType)))));
│ │ │ │ +
1159 bufferSize_[0] += noSend;
│ │ │ │ +
1160 bufferSize_[1] += noRecv;
│ │ │ │ +
1161 }
│ │ │ │ +
1162
│ │ │ │ +
1163 // allocate the buffers
│ │ │ │ +
1164 bufferSize_[0] *= sizeof(typename CommPolicy<Data>::IndexedType);
│ │ │ │ +
1165 bufferSize_[1] *= sizeof(typename CommPolicy<Data>::IndexedType);
│ │ │ │ +
1166
│ │ │ │ +
1167 buffers_[0] = new char[bufferSize_[0]];
│ │ │ │ +
1168 buffers_[1] = new char[bufferSize_[1]];
│ │ │ │ +
1169 }
│ │ │ │ +
1170
│ │ │ │ +
1171 template<class Data, class Interface>
│ │ │ │ +
1172 void BufferedCommunicator::build(const Data& source, const Data& dest, const Interface& interface)
│ │ │ │ +
1173 {
│ │ │ │ +
1174
│ │ │ │ +
1175 interfaces_=interface.interfaces();
│ │ │ │ +
1176 communicator_=interface.communicator();
│ │ │ │ +
1177 typedef typename std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
│ │ │ │ +
1178 ::const_iterator const_iterator;
│ │ │ │ +
1179 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
│ │ │ │ +
1180 const const_iterator end = interfaces_.end();
│ │ │ │ +
1181
│ │ │ │ +
1182 bufferSize_[0]=0;
│ │ │ │ +
1183 bufferSize_[1]=0;
│ │ │ │ +
1184
│ │ │ │ +
1185 for(const_iterator interfacePair = interfaces_.begin();
│ │ │ │ +
1186 interfacePair != end; ++interfacePair) {
│ │ │ │ +
1187 int noSend = MessageSizeCalculator<Data,Flag>() (source, interfacePair->second.first);
│ │ │ │ +
1188 int noRecv = MessageSizeCalculator<Data,Flag>() (dest, interfacePair->second.second);
│ │ │ │ +
1189 if (noSend + noRecv > 0)
│ │ │ │ +
1190 messageInformation_.insert(std::make_pair(interfacePair->first,
│ │ │ │ +
1191 std::make_pair(MessageInformation(bufferSize_[0],
│ │ │ │ +
1192 noSend*sizeof(typename CommPolicy<Data>::IndexedType)),
│ │ │ │ +
1193 MessageInformation(bufferSize_[1],
│ │ │ │ +
1194 noRecv*sizeof(typename CommPolicy<Data>::IndexedType)))));
│ │ │ │ +
1195 bufferSize_[0] += noSend;
│ │ │ │ +
1196 bufferSize_[1] += noRecv;
│ │ │ │ +
1197 }
│ │ │ │ +
1198
│ │ │ │ +
1199 bufferSize_[0] *= sizeof(typename CommPolicy<Data>::IndexedType);
│ │ │ │ +
1200 bufferSize_[1] *= sizeof(typename CommPolicy<Data>::IndexedType);
│ │ │ │ +
1201 // allocate the buffers
│ │ │ │ +
1202 buffers_[0] = new char[bufferSize_[0]];
│ │ │ │ +
1203 buffers_[1] = new char[bufferSize_[1]];
│ │ │ │ +
1204 }
│ │ │ │ +
1205
│ │ │ │ +
1206 inline void BufferedCommunicator::free()
│ │ │ │ +
1207 {
│ │ │ │ +
1208 messageInformation_.clear();
│ │ │ │ +
1209 if(buffers_[0])
│ │ │ │ +
1210 delete[] buffers_[0];
│ │ │ │ +
1211
│ │ │ │ +
1212 if(buffers_[1])
│ │ │ │ +
1213 delete[] buffers_[1];
│ │ │ │ +
1214 buffers_[0]=buffers_[1]=0;
│ │ │ │ +
1215 }
│ │ │ │ +
1216
│ │ │ │ + │ │ │ │ +
1218 {
│ │ │ │ +
1219 free();
│ │ │ │ +
1220 }
│ │ │ │ +
1221
│ │ │ │ +
1222 template<class Data>
│ │ │ │ +
1223 inline int BufferedCommunicator::MessageSizeCalculator<Data,SizeOne>::operator()
│ │ │ │ +
1224 (const InterfaceInformation& info) const
│ │ │ │ +
1225 {
│ │ │ │ +
1226 return info.size();
│ │ │ │ +
1227 }
│ │ │ │ +
1228
│ │ │ │ +
1229
│ │ │ │ +
1230 template<class Data>
│ │ │ │ +
1231 inline int BufferedCommunicator::MessageSizeCalculator<Data,SizeOne>::operator()
│ │ │ │ +
1232 (const Data&, const InterfaceInformation& info) const
│ │ │ │ +
1233 {
│ │ │ │ +
1234 return operator()(info);
│ │ │ │ +
1235 }
│ │ │ │ +
1236
│ │ │ │ +
1237
│ │ │ │ +
1238 template<class Data>
│ │ │ │ +
1239 inline int BufferedCommunicator::MessageSizeCalculator<Data, VariableSize>::operator()
│ │ │ │ +
1240 (const Data& data, const InterfaceInformation& info) const
│ │ │ │ +
1241 {
│ │ │ │ +
1242 int entries=0;
│ │ │ │ +
1243
│ │ │ │ +
1244 for(size_t i=0; i < info.size(); i++)
│ │ │ │ +
1245 entries += CommPolicy<Data>::getSize(data,info[i]);
│ │ │ │ +
1246
│ │ │ │ +
1247 return entries;
│ │ │ │ +
1248 }
│ │ │ │ +
1249
│ │ │ │ +
1250
│ │ │ │ +
1251 template<class Data, class GatherScatter, bool FORWARD>
│ │ │ │ +
1252 inline void BufferedCommunicator::MessageGatherer<Data,GatherScatter,FORWARD,VariableSize>::operator()(const InterfaceMap& interfaces,const Data& data, Type* buffer, [[maybe_unused]] size_t bufferSize) const
│ │ │ │ +
1253 {
│ │ │ │ +
1254 typedef typename InterfaceMap::const_iterator
│ │ │ │ +
1255 const_iterator;
│ │ │ │ +
1256
│ │ │ │ +
1257 int rank;
│ │ │ │ +
1258 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ +
1259 const const_iterator end = interfaces.end();
│ │ │ │ +
1260 size_t index=0;
│ │ │ │ +
1261
│ │ │ │ +
1262 for(const_iterator interfacePair = interfaces.begin();
│ │ │ │ +
1263 interfacePair != end; ++interfacePair) {
│ │ │ │ +
1264 int size = forward ? interfacePair->second.first.size() :
│ │ │ │ +
1265 interfacePair->second.second.size();
│ │ │ │ +
1266
│ │ │ │ +
1267 for(int i=0; i < size; i++) {
│ │ │ │ +
1268 int local = forward ? interfacePair->second.first[i] :
│ │ │ │ +
1269 interfacePair->second.second[i];
│ │ │ │ +
1270 for(std::size_t j=0; j < CommPolicy<Data>::getSize(data, local); j++, index++) {
│ │ │ │ +
1271
│ │ │ │ +
1272#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1273 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy<Data>::IndexedType));
│ │ │ │ +
1274#endif
│ │ │ │ +
1275 buffer[index]=GatherScatter::gather(data, local, j);
│ │ │ │ +
1276 }
│ │ │ │ +
1277
│ │ │ │ +
1278 }
│ │ │ │ +
1279 }
│ │ │ │ +
1280
│ │ │ │ +
1281 }
│ │ │ │ +
1282
│ │ │ │ +
1283
│ │ │ │ +
1284 template<class Data, class GatherScatter, bool FORWARD>
│ │ │ │ +
1285 inline void BufferedCommunicator::MessageGatherer<Data,GatherScatter,FORWARD,SizeOne>::operator()(
│ │ │ │ +
1286 const InterfaceMap& interfaces, const Data& data, Type* buffer, [[maybe_unused]] size_t bufferSize) const
│ │ │ │ +
1287 {
│ │ │ │ +
1288 typedef typename InterfaceMap::const_iterator
│ │ │ │ +
1289 const_iterator;
│ │ │ │ +
1290 const const_iterator end = interfaces.end();
│ │ │ │ +
1291 size_t index = 0;
│ │ │ │ +
1292
│ │ │ │ +
1293 int rank;
│ │ │ │ +
1294 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ +
1295
│ │ │ │ +
1296 for(const_iterator interfacePair = interfaces.begin();
│ │ │ │ +
1297 interfacePair != end; ++interfacePair) {
│ │ │ │ +
1298 size_t size = FORWARD ? interfacePair->second.first.size() :
│ │ │ │ +
1299 interfacePair->second.second.size();
│ │ │ │ +
1300
│ │ │ │ +
1301 for(size_t i=0; i < size; i++) {
│ │ │ │ +
1302
│ │ │ │ +
1303#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1304 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy<Data>::IndexedType));
│ │ │ │ +
1305#endif
│ │ │ │ +
1306
│ │ │ │ +
1307 buffer[index++] = GatherScatter::gather(data, FORWARD ? interfacePair->second.first[i] :
│ │ │ │ +
1308 interfacePair->second.second[i]);
│ │ │ │ +
1309 }
│ │ │ │ +
1310 }
│ │ │ │ +
1311
│ │ │ │ +
1312 }
│ │ │ │ +
1313
│ │ │ │ +
1314
│ │ │ │ +
1315 template<class Data, class GatherScatter, bool FORWARD>
│ │ │ │ +
1316 inline void BufferedCommunicator::MessageScatterer<Data,GatherScatter,FORWARD,VariableSize>::operator()(const InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const
│ │ │ │ +
1317 {
│ │ │ │ +
1318 typedef typename InterfaceMap::value_type::second_type::first_type Information;
│ │ │ │ +
1319 const typename InterfaceMap::const_iterator infoPair = interfaces.find(proc);
│ │ │ │ +
1320
│ │ │ │ +
1321 assert(infoPair!=interfaces.end());
│ │ │ │ +
1322
│ │ │ │ +
1323 const Information& info = FORWARD ? infoPair->second.second :
│ │ │ │ +
1324 infoPair->second.first;
│ │ │ │ +
1325
│ │ │ │ +
1326 for(size_t i=0, index=0; i < info.size(); i++) {
│ │ │ │ +
1327 for(size_t j=0; j < CommPolicy<Data>::getSize(data, info[i]); j++)
│ │ │ │ +
1328 GatherScatter::scatter(data, buffer[index++], info[i], j);
│ │ │ │ +
1329 }
│ │ │ │ +
1330 }
│ │ │ │ +
1331
│ │ │ │ +
1332
│ │ │ │ +
1333 template<class Data, class GatherScatter, bool FORWARD>
│ │ │ │ +
1334 inline void BufferedCommunicator::MessageScatterer<Data,GatherScatter,FORWARD,SizeOne>::operator()(const InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const
│ │ │ │ +
1335 {
│ │ │ │ +
1336 typedef typename InterfaceMap::value_type::second_type::first_type Information;
│ │ │ │ +
1337 const typename InterfaceMap::const_iterator infoPair = interfaces.find(proc);
│ │ │ │ +
1338
│ │ │ │ +
1339 assert(infoPair!=interfaces.end());
│ │ │ │ +
1340
│ │ │ │ +
1341 const Information& info = FORWARD ? infoPair->second.second :
│ │ │ │ +
1342 infoPair->second.first;
│ │ │ │ +
1343
│ │ │ │ +
1344 for(size_t i=0; i < info.size(); i++) {
│ │ │ │ +
1345 GatherScatter::scatter(data, buffer[i], info[i]);
│ │ │ │ +
1346 }
│ │ │ │ +
1347 }
│ │ │ │ +
1348
│ │ │ │ +
1349
│ │ │ │ +
1350 template<class GatherScatter,class Data>
│ │ │ │ +
1351 void BufferedCommunicator::forward(Data& data)
│ │ │ │ +
1352 {
│ │ │ │ +
1353 this->template sendRecv<GatherScatter,true>(data, data);
│ │ │ │ +
1354 }
│ │ │ │ +
1355
│ │ │ │ +
1356
│ │ │ │ +
1357 template<class GatherScatter, class Data>
│ │ │ │ +
1358 void BufferedCommunicator::backward(Data& data)
│ │ │ │ +
1359 {
│ │ │ │ +
1360 this->template sendRecv<GatherScatter,false>(data, data);
│ │ │ │ +
1361 }
│ │ │ │ +
1362
│ │ │ │ +
1363
│ │ │ │ +
1364 template<class GatherScatter, class Data>
│ │ │ │ +
1365 void BufferedCommunicator::forward(const Data& source, Data& dest)
│ │ │ │ +
1366 {
│ │ │ │ +
1367 this->template sendRecv<GatherScatter,true>(source, dest);
│ │ │ │ +
1368 }
│ │ │ │ +
1369
│ │ │ │ +
1370
│ │ │ │ +
1371 template<class GatherScatter, class Data>
│ │ │ │ +
1372 void BufferedCommunicator::backward(Data& source, const Data& dest)
│ │ │ │ +
1373 {
│ │ │ │ +
1374 this->template sendRecv<GatherScatter,false>(dest, source);
│ │ │ │ +
1375 }
│ │ │ │ +
1376
│ │ │ │ +
1377
│ │ │ │ +
1378 template<class GatherScatter, bool FORWARD, class Data>
│ │ │ │ +
1379 void BufferedCommunicator::sendRecv(const Data& source, Data& dest)
│ │ │ │ +
1380 {
│ │ │ │ +
1381 int rank, lrank;
│ │ │ │ +
1382
│ │ │ │ +
1383 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
│ │ │ │ +
1384 MPI_Comm_rank(MPI_COMM_WORLD,&lrank);
│ │ │ │ +
1385
│ │ │ │ +
1386 typedef typename CommPolicy<Data>::IndexedType Type;
│ │ │ │ +
1387 Type *sendBuffer, *recvBuffer;
│ │ │ │ +
1388 size_t sendBufferSize;
│ │ │ │ +
1389#ifndef NDEBUG
│ │ │ │ +
1390 size_t recvBufferSize;
│ │ │ │ +
1391#endif
│ │ │ │ +
1392
│ │ │ │ +
1393 if(FORWARD) {
│ │ │ │ +
1394 sendBuffer = reinterpret_cast<Type*>(buffers_[0]);
│ │ │ │ +
1395 sendBufferSize = bufferSize_[0];
│ │ │ │ +
1396 recvBuffer = reinterpret_cast<Type*>(buffers_[1]);
│ │ │ │ +
1397#ifndef NDEBUG
│ │ │ │ +
1398 recvBufferSize = bufferSize_[1];
│ │ │ │ +
1399#endif
│ │ │ │ +
1400 }else{
│ │ │ │ +
1401 sendBuffer = reinterpret_cast<Type*>(buffers_[1]);
│ │ │ │ +
1402 sendBufferSize = bufferSize_[1];
│ │ │ │ +
1403 recvBuffer = reinterpret_cast<Type*>(buffers_[0]);
│ │ │ │ +
1404#ifndef NDEBUG
│ │ │ │ +
1405 recvBufferSize = bufferSize_[0];
│ │ │ │ +
1406#endif
│ │ │ │ +
1407 }
│ │ │ │ +
1408 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
│ │ │ │ +
1409
│ │ │ │ +
1410 MessageGatherer<Data,GatherScatter,FORWARD,Flag>() (interfaces_, source, sendBuffer, sendBufferSize);
│ │ │ │ +
1411
│ │ │ │ +
1412 MPI_Request* sendRequests = new MPI_Request[messageInformation_.size()];
│ │ │ │ +
1413 MPI_Request* recvRequests = new MPI_Request[messageInformation_.size()];
│ │ │ │ +
1414 /* Number of recvRequests that are not MPI_REQUEST_NULL */
│ │ │ │ +
1415 size_t numberOfRealRecvRequests = 0;
│ │ │ │ +
1416
│ │ │ │ +
1417 // Setup receive first
│ │ │ │ +
1418 typedef typename InformationMap::const_iterator const_iterator;
│ │ │ │ +
1419
│ │ │ │ +
1420 const const_iterator end = messageInformation_.end();
│ │ │ │ +
1421 size_t i=0;
│ │ │ │ +
1422 int* processMap = new int[messageInformation_.size()];
│ │ │ │ +
1423
│ │ │ │ +
1424 for(const_iterator info = messageInformation_.begin(); info != end; ++info, ++i) {
│ │ │ │ +
1425 processMap[i]=info->first;
│ │ │ │ +
1426 if(FORWARD) {
│ │ │ │ +
1427 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
│ │ │ │ +
1428 Dune::dvverb<<rank<<": receiving "<<info->second.second.size_<<" from "<<info->first<<std::endl;
│ │ │ │ +
1429 if(info->second.second.size_) {
│ │ │ │ +
1430 MPI_Irecv(recvBuffer+info->second.second.start_, info->second.second.size_,
│ │ │ │ +
1431 MPI_BYTE, info->first, commTag_, communicator_,
│ │ │ │ +
1432 recvRequests+i);
│ │ │ │ +
1433 numberOfRealRecvRequests += 1;
│ │ │ │ +
1434 } else {
│ │ │ │ +
1435 // Nothing to receive -> set request to inactive
│ │ │ │ +
1436 recvRequests[i]=MPI_REQUEST_NULL;
│ │ │ │ +
1437 }
│ │ │ │ +
1438 }else{
│ │ │ │ +
1439 assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= recvBufferSize );
│ │ │ │ +
1440 Dune::dvverb<<rank<<": receiving "<<info->second.first.size_<<" to "<<info->first<<std::endl;
│ │ │ │ +
1441 if(info->second.first.size_) {
│ │ │ │ +
1442 MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_,
│ │ │ │ +
1443 MPI_BYTE, info->first, commTag_, communicator_,
│ │ │ │ +
1444 recvRequests+i);
│ │ │ │ +
1445 numberOfRealRecvRequests += 1;
│ │ │ │ +
1446 } else {
│ │ │ │ +
1447 // Nothing to receive -> set request to inactive
│ │ │ │ +
1448 recvRequests[i]=MPI_REQUEST_NULL;
│ │ │ │ +
1449 }
│ │ │ │ +
1450 }
│ │ │ │ +
1451 }
│ │ │ │ +
1452
│ │ │ │ +
1453 // now the send requests
│ │ │ │ +
1454 i=0;
│ │ │ │ +
1455 for(const_iterator info = messageInformation_.begin(); info != end; ++info, ++i)
│ │ │ │ +
1456 if(FORWARD) {
│ │ │ │ +
1457 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
│ │ │ │ +
1458 Dune::dvverb<<rank<<": sending "<<info->second.first.size_<<" to "<<info->first<<std::endl;
│ │ │ │ +
1459 assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= sendBufferSize );
│ │ │ │ +
1460 if(info->second.first.size_)
│ │ │ │ +
1461 MPI_Issend(sendBuffer+info->second.first.start_, info->second.first.size_,
│ │ │ │ +
1462 MPI_BYTE, info->first, commTag_, communicator_,
│ │ │ │ +
1463 sendRequests+i);
│ │ │ │ +
1464 else
│ │ │ │ +
1465 // Nothing to send -> set request to inactive
│ │ │ │ +
1466 sendRequests[i]=MPI_REQUEST_NULL;
│ │ │ │ +
1467 }else{
│ │ │ │ +
1468 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= sendBufferSize );
│ │ │ │ +
1469 Dune::dvverb<<rank<<": sending "<<info->second.second.size_<<" to "<<info->first<<std::endl;
│ │ │ │ +
1470 if(info->second.second.size_)
│ │ │ │ +
1471 MPI_Issend(sendBuffer+info->second.second.start_, info->second.second.size_,
│ │ │ │ +
1472 MPI_BYTE, info->first, commTag_, communicator_,
│ │ │ │ +
1473 sendRequests+i);
│ │ │ │ +
1474 else
│ │ │ │ +
1475 // Nothing to send -> set request to inactive
│ │ │ │ +
1476 sendRequests[i]=MPI_REQUEST_NULL;
│ │ │ │ +
1477 }
│ │ │ │ +
1478
│ │ │ │ +
1479 // Wait for completion of receive and immediately start scatter
│ │ │ │ +
1480 i=0;
│ │ │ │ +
1481 //int success = 1;
│ │ │ │ +
1482 int finished = MPI_UNDEFINED;
│ │ │ │ +
1483 MPI_Status status; //[messageInformation_.size()];
│ │ │ │ +
1484 //MPI_Waitall(messageInformation_.size(), recvRequests, status);
│ │ │ │ +
1485
│ │ │ │ +
1486 for(i=0; i< numberOfRealRecvRequests; i++) {
│ │ │ │ +
1487 status.MPI_ERROR=MPI_SUCCESS;
│ │ │ │ +
1488 MPI_Waitany(messageInformation_.size(), recvRequests, &finished, &status);
│ │ │ │ +
1489 assert(finished != MPI_UNDEFINED);
│ │ │ │ +
1490
│ │ │ │ +
1491 if(status.MPI_ERROR==MPI_SUCCESS) {
│ │ │ │ +
1492 int& proc = processMap[finished];
│ │ │ │ +
1493 typename InformationMap::const_iterator infoIter = messageInformation_.find(proc);
│ │ │ │ +
1494 assert(infoIter != messageInformation_.end());
│ │ │ │ +
1495
│ │ │ │ +
1496 MessageInformation info = (FORWARD) ? infoIter->second.second : infoIter->second.first;
│ │ │ │ +
1497 assert(info.start_+info.size_ <= recvBufferSize);
│ │ │ │ +
1498
│ │ │ │ +
1499 MessageScatterer<Data,GatherScatter,FORWARD,Flag>() (interfaces_, dest, recvBuffer+info.start_, proc);
│ │ │ │ +
1500 }else{
│ │ │ │ +
1501 std::cerr<<rank<<": MPI_Error occurred while receiving message from "<<processMap[finished]<<std::endl;
│ │ │ │ +
1502 //success=0;
│ │ │ │ +
1503 }
│ │ │ │ +
1504 }
│ │ │ │ +
1505
│ │ │ │ +
1506 MPI_Status recvStatus;
│ │ │ │ +
1507
│ │ │ │ +
1508 // Wait for completion of sends
│ │ │ │ +
1509 for(i=0; i< messageInformation_.size(); i++)
│ │ │ │ +
1510 if(MPI_SUCCESS!=MPI_Wait(sendRequests+i, &recvStatus)) {
│ │ │ │ +
1511 std::cerr<<rank<<": MPI_Error occurred while sending message to "<<processMap[finished]<<std::endl;
│ │ │ │ +
1512 //success=0;
│ │ │ │ +
1513 }
│ │ │ │ +
1514 /*
│ │ │ │ +
1515 int globalSuccess;
│ │ │ │ +
1516 MPI_Allreduce(&success, &globalSuccess, 1, MPI_INT, MPI_MIN, interface_->communicator());
│ │ │ │ +
1517
│ │ │ │ +
1518 if(!globalSuccess)
│ │ │ │ +
1519 DUNE_THROW(CommunicationError, "A communication error occurred!");
│ │ │ │ +
1520 */
│ │ │ │ +
1521 delete[] processMap;
│ │ │ │ +
1522 delete[] sendRequests;
│ │ │ │ +
1523 delete[] recvRequests;
│ │ │ │ +
1524
│ │ │ │ +
1525 }
│ │ │ │ +
1526
│ │ │ │ +
1527#endif // DOXYGEN
│ │ │ │ +
1528
│ │ │ │ +
1530}
│ │ │ │ +
1531
│ │ │ │ +
1532#endif // HAVE_MPI
│ │ │ │ +
1533
│ │ │ │ +
1534#endif
│ │ │ │ +
Standard Dune debug streams.
│ │ │ │ +
Classes describing a distributed indexset.
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
DVVerbType dvverb(std::cout)
stream for very verbose output.
Definition stdstreams.hh:95
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Std::detected_or_t< decltype(detail::warningIfNotDefined< Std::detected_t< Fallback, Args... > >(std::declval< const Std::detected_t< TargetType, Args... > * >())), TargetType, Args... > detected_or_fallback_t
This type will be either TargetType<Args...> if it exists, or the Fallback<Args......
Definition type_traits.hh:300
│ │ │ │ -
Type representing a lookup failure by std::detected_or and friends.
Definition type_traits.hh:88
│ │ │ │ - │ │ │ │ -
nonesuch(const nonesuch &)=delete
│ │ │ │ -
void operator=(const nonesuch &)=delete
│ │ │ │ - │ │ │ │ -
forms the logical conjunction of the type traits B...
Definition type_traits.hh:248
│ │ │ │ -
forms the logical disjunction of the type traits B...
Definition type_traits.hh:264
│ │ │ │ -
forms the logical negation of the type traits B...
Definition type_traits.hh:280
│ │ │ │ +
Default exception class for I/O errors.
Definition exceptions.hh:231
│ │ │ │ +
Flag for marking indexed data structures where data at each index is of the same size.
Definition communicator.hh:110
│ │ │ │ +
Flag for marking indexed data structures where the data at each index may be a variable multiple of a...
Definition communicator.hh:118
│ │ │ │ +
Default policy used for communicating an indexed type.
Definition communicator.hh:128
│ │ │ │ +
V::value_type IndexedType
The type we get at each index with operator[].
Definition communicator.hh:147
│ │ │ │ +
static int getSize(const V &, int index)
Get the number of primitive elements at that index.
│ │ │ │ +
SizeOne IndexedTypeFlag
Whether the indexed type has variable size or there is always one value at each index.
Definition communicator.hh:153
│ │ │ │ +
static const void * getAddress(const V &v, int index)
Get the address of entry at an index.
│ │ │ │ +
V Type
The type the policy is for.
Definition communicator.hh:140
│ │ │ │ +
Definition communicator.hh:173
│ │ │ │ +
Definition communicator.hh:175
│ │ │ │ + │ │ │ │ + │ │ │ │ +
VariableBlockVector< FieldVector< K, n >, A > Type
Definition communicator.hh:180
│ │ │ │ + │ │ │ │ + │ │ │ │ +
Error thrown if there was a problem with the communication.
Definition communicator.hh:195
│ │ │ │ +
GatherScatter default implementation that just copies data.
Definition communicator.hh:202
│ │ │ │ +
static void scatter(T &vec, const IndexedType &v, std::size_t i)
│ │ │ │ +
CommPolicy< T >::IndexedType IndexedType
Definition communicator.hh:203
│ │ │ │ +
static const IndexedType & gather(const T &vec, std::size_t i)
│ │ │ │ +
A communicator that uses buffers to gather and scatter the data to be send or received.
Definition communicator.hh:458
│ │ │ │ +
void backward(Data &data)
Backward send where target and source are the same.
│ │ │ │ +
BufferedCommunicator()
Constructor.
│ │ │ │ +
~BufferedCommunicator()
Destructor.
│ │ │ │ +
void forward(const Data &source, Data &dest)
Send from source to target.
│ │ │ │ +
void free()
Free the allocated memory (i.e. buffers and message information.
│ │ │ │ +
std::enable_if< std::is_same< SizeOne, typenameCommPolicy< Data >::IndexedTypeFlag >::value, void >::type build(const Interface &interface)
Build the buffers and information for the communication process.
│ │ │ │ +
void backward(Data &source, const Data &dest)
Communicate in the reverse direction, i.e. send from target to source.
│ │ │ │ +
void build(const Data &source, const Data &target, const Interface &interface)
Build the buffers and information for the communication process.
│ │ │ │ +
void forward(Data &data)
Forward send where target and source are the same.
│ │ │ │ +
Manager class for the mapping between local indices and globally unique indices.
Definition indexset.hh:218
│ │ │ │ +
Base class of all classes representing a communication interface.
Definition parallel/interface.hh:35
│ │ │ │ +
Information describing an interface.
Definition parallel/interface.hh:101
│ │ │ │ +
Communication interface between remote and local indices.
Definition parallel/interface.hh:209
│ │ │ │ +
An index present on the local process.
Definition localindex.hh:35
│ │ │ │ +
The indices present on remote processes.
Definition remoteindices.hh:189
│ │ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition remoteindices.hh:215
│ │ │ │ +
LocalIndex::Attribute Attribute
The type of the attribute.
Definition remoteindices.hh:226
│ │ │ │ +
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition remoteindices.hh:221
│ │ │ │ +
Provides classes for building the communication interface between remote indices.
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,279 +1,1202 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -type_traits.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +communicator.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ +5#ifndef DUNE_COMMUNICATOR │ │ │ │ │ +6#define DUNE_COMMUNICATOR │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -10#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -11 │ │ │ │ │ -12#if __has_include() │ │ │ │ │ -13#include │ │ │ │ │ -14#endif │ │ │ │ │ -15 │ │ │ │ │ -16namespace _D_u_n_e │ │ │ │ │ -17{ │ │ │ │ │ +8#if HAVE_MPI │ │ │ │ │ +9 │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +17#include │ │ │ │ │ 18 │ │ │ │ │ -20 │ │ │ │ │ -29namespace Std │ │ │ │ │ -30{ │ │ │ │ │ -31 │ │ │ │ │ -34 using std::bool_constant; │ │ │ │ │ -35 │ │ │ │ │ -36#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -37 │ │ │ │ │ -38 using std::experimental::nonesuch; │ │ │ │ │ -39 using std::experimental::detected_or; │ │ │ │ │ -40 using std::experimental::is_detected; │ │ │ │ │ -41 using std::experimental::detected_t; │ │ │ │ │ -42 using std::experimental::is_detected_v; │ │ │ │ │ -43 using std::experimental::detected_or_t; │ │ │ │ │ -44 using std::experimental::is_detected_exact; │ │ │ │ │ -45 using std::experimental::is_detected_exact_v; │ │ │ │ │ -46 using std::experimental::is_detected_convertible; │ │ │ │ │ -47 using std::experimental::is_detected_convertible_v; │ │ │ │ │ -48 │ │ │ │ │ -49#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -50 │ │ │ │ │ -51 // fallback version of std::experimental::is_detected et al., heavily │ │ │ │ │ -scribbled │ │ │ │ │ -52 // from cppreference.com (but there is actually not much implementation to │ │ │ │ │ -the thing) │ │ │ │ │ -53 │ │ │ │ │ -54#ifndef DOXYGEN │ │ │ │ │ -55 │ │ │ │ │ -56 namespace Impl { │ │ │ │ │ -57 │ │ │ │ │ -58 // default version of detector, this gets matched on failure │ │ │ │ │ -59 template class Op, │ │ │ │ │ -typename... Args> │ │ │ │ │ -60 struct detector │ │ │ │ │ -61 { │ │ │ │ │ -62 using value_t = std::false_type; │ │ │ │ │ -63 using type = Default; │ │ │ │ │ -64 }; │ │ │ │ │ -65 │ │ │ │ │ -66 // specialization of detector that matches if Op can be │ │ │ │ │ -instantiated │ │ │ │ │ -67 template class Op, typename... Args> │ │ │ │ │ -68 struct detector>, Op, Args...> │ │ │ │ │ -69 { │ │ │ │ │ -70 using value_t = std::true_type; │ │ │ │ │ -71 using type = Op; │ │ │ │ │ -72 }; │ │ │ │ │ -73 │ │ │ │ │ -74 } │ │ │ │ │ -75 │ │ │ │ │ -76#endif // DOXYGEN │ │ │ │ │ -77 │ │ │ │ │ -79 │ │ │ │ │ -_8_7 struct _n_o_n_e_s_u_c_h │ │ │ │ │ -88 { │ │ │ │ │ -_8_9 _n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ -_9_0 _~_n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ -_9_1 _n_o_n_e_s_u_c_h(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ -_9_2 void _o_p_e_r_a_t_o_r_=(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ -93 }; │ │ │ │ │ -94 │ │ │ │ │ -96 │ │ │ │ │ -127 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -_1_2_8 using _d_e_t_e_c_t_e_d___o_r = Impl::detector; │ │ │ │ │ -129 │ │ │ │ │ -131 │ │ │ │ │ -140 template class Op, typename... Args> │ │ │ │ │ -_1_4_1 using _i_s___d_e_t_e_c_t_e_d = typename _d_e_t_e_c_t_e_d___o_r<_n_o_n_e_s_u_c_h,Op,Args...>::value_t; │ │ │ │ │ -142 │ │ │ │ │ -143#ifdef __cpp_variable_templates │ │ │ │ │ -145 │ │ │ │ │ -154 template class Op, typename... Args> │ │ │ │ │ -_1_5_5 constexpr bool _i_s___d_e_t_e_c_t_e_d___v = _i_s___d_e_t_e_c_t_e_d::value; │ │ │ │ │ -156#endif // __cpp_variable_templates │ │ │ │ │ -157 │ │ │ │ │ -159 │ │ │ │ │ -169 template class Op, typename... Args> │ │ │ │ │ -_1_7_0 using _d_e_t_e_c_t_e_d___t = typename _d_e_t_e_c_t_e_d___o_r<_n_o_n_e_s_u_c_h,Op,Args...>::type; │ │ │ │ │ -171 │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ +23 │ │ │ │ │ +24namespace _D_u_n_e │ │ │ │ │ +25{ │ │ │ │ │ +_1_0_9 struct _S_i_z_e_O_n_e │ │ │ │ │ +110 {}; │ │ │ │ │ +111 │ │ │ │ │ +_1_1_7 struct _V_a_r_i_a_b_l_e_S_i_z_e │ │ │ │ │ +118 {}; │ │ │ │ │ +119 │ │ │ │ │ +120 │ │ │ │ │ +126 template │ │ │ │ │ +_1_2_7 struct _C_o_m_m_P_o_l_i_c_y │ │ │ │ │ +128 { │ │ │ │ │ +_1_4_0 typedef V _T_y_p_e; │ │ │ │ │ +141 │ │ │ │ │ +_1_4_7 typedef typename V::value_type _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +148 │ │ │ │ │ +_1_5_3 typedef _S_i_z_e_O_n_e _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ +154 │ │ │ │ │ +_1_6_3 static const void* _g_e_t_A_d_d_r_e_s_s(const V& v, int index); │ │ │ │ │ +164 │ │ │ │ │ +_1_7_0 static int _g_e_t_S_i_z_e(const V&, int index); │ │ │ │ │ +171 }; │ │ │ │ │ 172 │ │ │ │ │ +_1_7_3 template class _F_i_e_l_d_V_e_c_t_o_r; │ │ │ │ │ 174 │ │ │ │ │ -184 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -_1_8_5 using _d_e_t_e_c_t_e_d___o_r___t = typename _d_e_t_e_c_t_e_d___o_r::type; │ │ │ │ │ -186 │ │ │ │ │ -188 │ │ │ │ │ -194 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -_1_9_5 using _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t = std::is_same>; │ │ │ │ │ +_1_7_5 template class _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r; │ │ │ │ │ +176 │ │ │ │ │ +177 template │ │ │ │ │ +_1_7_8 struct _C_o_m_m_P_o_l_i_c_y<_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r<_F_i_e_l_d_V_e_c_t_o_r, A> > │ │ │ │ │ +179 { │ │ │ │ │ +_1_8_0 typedef _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _n_>, A> _T_y_p_e; │ │ │ │ │ +181 │ │ │ │ │ +_1_8_2 typedef typename Type::B _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +183 │ │ │ │ │ +_1_8_4 typedef _V_a_r_i_a_b_l_e_S_i_z_e _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ +185 │ │ │ │ │ +_1_8_6 static const void* _g_e_t_A_d_d_r_e_s_s(const _T_y_p_e& v, int i); │ │ │ │ │ +187 │ │ │ │ │ +_1_8_8 static int _g_e_t_S_i_z_e(const _T_y_p_e& v, int i); │ │ │ │ │ +189 }; │ │ │ │ │ +190 │ │ │ │ │ +_1_9_4 class _C_o_m_m_u_n_i_c_a_t_i_o_n_E_r_r_o_r : public _I_O_E_r_r_o_r │ │ │ │ │ +195 {}; │ │ │ │ │ 196 │ │ │ │ │ -197#ifdef __cpp_variable_templates │ │ │ │ │ -199 │ │ │ │ │ -205 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -_2_0_6 constexpr bool _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t___v = │ │ │ │ │ -_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t::value; │ │ │ │ │ -207#endif // __cpp_variable_templates │ │ │ │ │ +200 template │ │ │ │ │ +_2_0_1 struct _C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +202 { │ │ │ │ │ +_2_0_3 typedef typename _C_o_m_m_P_o_l_i_c_y_<_T_>_:_:_I_n_d_e_x_e_d_T_y_p_e _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +204 │ │ │ │ │ +_2_0_5 static const _I_n_d_e_x_e_d_T_y_p_e& _g_a_t_h_e_r(const T& vec, std::size_t i); │ │ │ │ │ +206 │ │ │ │ │ +_2_0_7 static void _s_c_a_t_t_e_r(T& vec, const _I_n_d_e_x_e_d_T_y_p_e& v, std::size_t i); │ │ │ │ │ 208 │ │ │ │ │ +209 }; │ │ │ │ │ 210 │ │ │ │ │ -216 template class Op, typename... Args> │ │ │ │ │ -_2_1_7 using _i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e = std:: │ │ │ │ │ -is_convertible>; │ │ │ │ │ -218 │ │ │ │ │ -219#ifdef __cpp_variable_templates │ │ │ │ │ -221 │ │ │ │ │ -227 template class Op, typename... Args> │ │ │ │ │ -_2_2_8 constexpr bool _i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e___v = │ │ │ │ │ -_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e::value; │ │ │ │ │ -229#endif // __cpp_variable_templates │ │ │ │ │ -230 │ │ │ │ │ -231#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -232 │ │ │ │ │ -233 │ │ │ │ │ -234 │ │ │ │ │ -235 // conjunction │ │ │ │ │ -236 // ----------- │ │ │ │ │ -237 │ │ │ │ │ -245 template< class... B > │ │ │ │ │ -_2_4_6 struct [[deprecated("Will be removed after release 2.8. Use std:: │ │ │ │ │ -conjunction instead.")]] _c_o_n_j_u_n_c_t_i_o_n │ │ │ │ │ -247 : std::conjunction │ │ │ │ │ -248 {}; │ │ │ │ │ -249 │ │ │ │ │ -250 │ │ │ │ │ -251 // disjunction │ │ │ │ │ -252 // ----------- │ │ │ │ │ -253 │ │ │ │ │ -261 template< class... B > │ │ │ │ │ -_2_6_2 struct [[deprecated("Will be removed after release 2.8. Use std:: │ │ │ │ │ -disjunction instead.")]] _d_i_s_j_u_n_c_t_i_o_n │ │ │ │ │ -263 : std::disjunction │ │ │ │ │ -264 {}; │ │ │ │ │ -265 │ │ │ │ │ -266 │ │ │ │ │ -267 // negation │ │ │ │ │ -268 // -------- │ │ │ │ │ -269 │ │ │ │ │ -277 template │ │ │ │ │ -_2_7_8 struct [[deprecated("Will be removed after release 2.8. Use std::negation │ │ │ │ │ -instead.")]] _n_e_g_a_t_i_o_n │ │ │ │ │ -279 : std::negation │ │ │ │ │ -280 {}; │ │ │ │ │ -281 │ │ │ │ │ -282} // namespace Std │ │ │ │ │ -283 │ │ │ │ │ -284 │ │ │ │ │ -285namespace detail │ │ │ │ │ -286{ │ │ │ │ │ -287 template │ │ │ │ │ -288 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code │ │ │ │ │ -calling `detected_or_fallback_t` for getting the source of this warning!")]] │ │ │ │ │ -289 Type warningIfNotDefined(const _S_t_d_:_:_n_o_n_e_s_u_c_h*); │ │ │ │ │ +222 template │ │ │ │ │ +223 class DatatypeCommunicator : public _I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r │ │ │ │ │ +224 { │ │ │ │ │ +225 public: │ │ │ │ │ +226 │ │ │ │ │ +230 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +231 │ │ │ │ │ +235 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_<_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_> _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ +236 │ │ │ │ │ +240 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_G_l_o_b_a_l_I_n_d_e_x GlobalIndex; │ │ │ │ │ +241 │ │ │ │ │ +245 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_t_t_r_i_b_u_t_e Attribute; │ │ │ │ │ +246 │ │ │ │ │ +250 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_L_o_c_a_l_I_n_d_e_x _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ +251 │ │ │ │ │ +255 DatatypeCommunicator(); │ │ │ │ │ +256 │ │ │ │ │ +260 ~DatatypeCommunicator(); │ │ │ │ │ +261 │ │ │ │ │ +288 template │ │ │ │ │ +289 void build(const _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices, const T1& sourceFlags, V& │ │ │ │ │ +sendData, const T2& destFlags, V& receiveData); │ │ │ │ │ 290 │ │ │ │ │ -291 template │ │ │ │ │ -292 Type warningIfNotDefined(const T*); │ │ │ │ │ -293} │ │ │ │ │ -294 │ │ │ │ │ -296template class Fallback, │ │ │ │ │ -297 template class TargetType, typename... Args> │ │ │ │ │ -_2_9_8using _d_e_t_e_c_t_e_d___o_r___f_a_l_l_b_a_c_k___t = _S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t >(std:: │ │ │ │ │ -declval*>())), │ │ │ │ │ -300 TargetType, Args...>; │ │ │ │ │ -301 │ │ │ │ │ -302 │ │ │ │ │ -303} // namespace Dune │ │ │ │ │ -304 │ │ │ │ │ -305#endif // #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for type computations, constraining overloads, ... │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t___v │ │ │ │ │ -constexpr bool is_detected_exact_v │ │ │ │ │ -Convenient access to the result value of is_detected_exact. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:206 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e___v │ │ │ │ │ -constexpr bool is_detected_convertible_v │ │ │ │ │ -Convenient access to the result value of is_detected_convertible. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:228 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t │ │ │ │ │ -typename detected_or< Default, Op, Args... >::type detected_or_t │ │ │ │ │ -Returns Op if that is valid; otherwise returns the fallback type │ │ │ │ │ -Default. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:185 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t │ │ │ │ │ -std::is_same< Expected, detected_t< Op, Args... > > is_detected_exact │ │ │ │ │ -Checks whether Op is Expected without causing an error if Op │ │ │ │ │ -is invalid. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:195 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___t │ │ │ │ │ -typename detected_or< nonesuch, Op, Args... >::type detected_t │ │ │ │ │ -Returns Op if that is valid; otherwise returns nonesuch. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:170 │ │ │ │ │ -_D_u_n_e_:_:_v_o_i_d___t │ │ │ │ │ -typename Impl::voider< Types... >::type void_t │ │ │ │ │ -Is void for all valid input types. The workhorse for C++11 SFINAE-techniques. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___v │ │ │ │ │ -constexpr bool is_detected_v │ │ │ │ │ -Detects whether Op is valid and makes the result available as a value. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d │ │ │ │ │ -typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ -Detects whether Op is valid. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r │ │ │ │ │ -Impl::detector< Default, void, Op, Args... > detected_or │ │ │ │ │ -Detects whether Op is valid and makes the result available. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:128 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e │ │ │ │ │ -std::is_convertible< Target, detected_t< Op, Args... > > │ │ │ │ │ -is_detected_convertible │ │ │ │ │ -Checks whether Op is convertible to Target without causing an error if │ │ │ │ │ -Op > │ │ │ │ │ +317 MessageTypeMap; │ │ │ │ │ +318 │ │ │ │ │ +322 MessageTypeMap messageTypes; │ │ │ │ │ +323 │ │ │ │ │ +327 void* data_; │ │ │ │ │ +328 │ │ │ │ │ +329 MPI_Request* requests_[2]; │ │ │ │ │ +330 │ │ │ │ │ +334 bool created_; │ │ │ │ │ +335 │ │ │ │ │ +339 template │ │ │ │ │ +340 void createRequests(V& sendData, V& receiveData); │ │ │ │ │ +341 │ │ │ │ │ +345 template │ │ │ │ │ +346 void createDataTypes(const T1& source, const T2& destination, V& data); │ │ │ │ │ +347 │ │ │ │ │ +351 void sendRecv(MPI_Request* req); │ │ │ │ │ +352 │ │ │ │ │ +356 struct IndexedTypeInformation │ │ │ │ │ +357 { │ │ │ │ │ +363 void build(int i) │ │ │ │ │ +364 { │ │ │ │ │ +365 length = new int[i]; │ │ │ │ │ +366 displ = new MPI_Aint[i]; │ │ │ │ │ +367 size = i; │ │ │ │ │ +368 } │ │ │ │ │ +369 │ │ │ │ │ +373 void free() │ │ │ │ │ +374 { │ │ │ │ │ +375 delete[] length; │ │ │ │ │ +376 delete[] displ; │ │ │ │ │ +377 } │ │ │ │ │ +379 int* length; │ │ │ │ │ +381 MPI_Aint* displ; │ │ │ │ │ +387 int elements; │ │ │ │ │ +391 int size; │ │ │ │ │ +392 }; │ │ │ │ │ +393 │ │ │ │ │ +399 template │ │ │ │ │ +400 struct MPIDatatypeInformation │ │ │ │ │ +401 { │ │ │ │ │ +406 MPIDatatypeInformation(const V& data) : data_(data) │ │ │ │ │ +407 {} │ │ │ │ │ +408 │ │ │ │ │ +414 void reserve(int proc, int size) │ │ │ │ │ +415 { │ │ │ │ │ +416 information_[proc].build(size); │ │ │ │ │ +417 } │ │ │ │ │ +424 void add(int proc, int local) │ │ │ │ │ +425 { │ │ │ │ │ +426 IndexedTypeInformation& info=information_[proc]; │ │ │ │ │ +427 assert((info.elements)(CommPolicy::getAddress(data_, │ │ │ │ │ +local)), │ │ │ │ │ +429 info.displ+info.elements); │ │ │ │ │ +430 info.length[info.elements]=CommPolicy::getSize(data_, local); │ │ │ │ │ +431 info.elements++; │ │ │ │ │ +432 } │ │ │ │ │ +433 │ │ │ │ │ +438 std::map information_; │ │ │ │ │ +442 const V& data_; │ │ │ │ │ +443 │ │ │ │ │ +444 }; │ │ │ │ │ +445 │ │ │ │ │ +446 }; │ │ │ │ │ +447 │ │ │ │ │ +_4_5_7 class _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +458 { │ │ │ │ │ +459 │ │ │ │ │ +460 public: │ │ │ │ │ +_4_6_4 _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ +465 │ │ │ │ │ +472 template │ │ │ │ │ +473 typename std::enable_if:: │ │ │ │ │ +IndexedTypeFlag>::value, void>::type │ │ │ │ │ +_4_7_4 _b_u_i_l_d(const _I_n_t_e_r_f_a_c_e& interface); │ │ │ │ │ +475 │ │ │ │ │ +483 template │ │ │ │ │ +_4_8_4 void _b_u_i_l_d(const Data& source, const Data& target, const _I_n_t_e_r_f_a_c_e& │ │ │ │ │ +interface); │ │ │ │ │ +485 │ │ │ │ │ +514 template │ │ │ │ │ +_5_1_5 void _f_o_r_w_a_r_d(const Data& source, Data& dest); │ │ │ │ │ +516 │ │ │ │ │ +545 template │ │ │ │ │ +_5_4_6 void _b_a_c_k_w_a_r_d(Data& source, const Data& dest); │ │ │ │ │ +547 │ │ │ │ │ +573 template │ │ │ │ │ +_5_7_4 void _f_o_r_w_a_r_d(Data& data); │ │ │ │ │ +575 │ │ │ │ │ +601 template │ │ │ │ │ +_6_0_2 void _b_a_c_k_w_a_r_d(Data& data); │ │ │ │ │ +603 │ │ │ │ │ +_6_0_7 void _f_r_e_e(); │ │ │ │ │ +608 │ │ │ │ │ +_6_1_2 _~_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ +613 │ │ │ │ │ +614 private: │ │ │ │ │ +615 │ │ │ │ │ +619 typedef std::map > │ │ │ │ │ +620 InterfaceMap; │ │ │ │ │ +621 │ │ │ │ │ +622 │ │ │ │ │ +626 template │ │ │ │ │ +627 struct MessageSizeCalculator │ │ │ │ │ +628 {}; │ │ │ │ │ +629 │ │ │ │ │ +634 template │ │ │ │ │ +635 struct MessageSizeCalculator │ │ │ │ │ +636 { │ │ │ │ │ +643 inline int operator()(const _I_n_t_e_r_f_a_c_e_I_n_f_o_r_m_a_t_i_o_n& info) const; │ │ │ │ │ +652 inline int operator()(const Data& data, const _I_n_t_e_r_f_a_c_e_I_n_f_o_r_m_a_t_i_o_n& info) │ │ │ │ │ +const; │ │ │ │ │ +653 }; │ │ │ │ │ +654 │ │ │ │ │ +659 template │ │ │ │ │ +660 struct MessageSizeCalculator │ │ │ │ │ +661 { │ │ │ │ │ +670 inline int operator()(const Data& data, const InterfaceInformation& info) │ │ │ │ │ +const; │ │ │ │ │ +671 }; │ │ │ │ │ +672 │ │ │ │ │ +676 template │ │ │ │ │ +677 struct MessageGatherer │ │ │ │ │ +678 {}; │ │ │ │ │ +679 │ │ │ │ │ +684 template │ │ │ │ │ +685 struct MessageGatherer │ │ │ │ │ +686 { │ │ │ │ │ +688 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ +689 │ │ │ │ │ +694 typedef GatherScatter Gatherer; │ │ │ │ │ +695 │ │ │ │ │ +701 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ +702 │ │ │ │ │ +710 inline void operator()(const InterfaceMap& interface, const Data& data, │ │ │ │ │ +Type* buffer, size_t bufferSize) const; │ │ │ │ │ +711 }; │ │ │ │ │ +712 │ │ │ │ │ +717 template │ │ │ │ │ +718 struct MessageGatherer │ │ │ │ │ +719 { │ │ │ │ │ +721 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ +722 │ │ │ │ │ +727 typedef GatherScatter Gatherer; │ │ │ │ │ +728 │ │ │ │ │ +734 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ +735 │ │ │ │ │ +743 inline void operator()(const InterfaceMap& interface, const Data& data, │ │ │ │ │ +Type* buffer, size_t bufferSize) const; │ │ │ │ │ +744 }; │ │ │ │ │ +745 │ │ │ │ │ +749 template │ │ │ │ │ +750 struct MessageScatterer │ │ │ │ │ +751 {}; │ │ │ │ │ +752 │ │ │ │ │ +757 template │ │ │ │ │ +758 struct MessageScatterer │ │ │ │ │ +759 { │ │ │ │ │ +761 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ +762 │ │ │ │ │ +767 typedef GatherScatter Scatterer; │ │ │ │ │ +768 │ │ │ │ │ +774 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ +775 │ │ │ │ │ +783 inline void operator()(const InterfaceMap& interface, Data& data, Type* │ │ │ │ │ +buffer, const int& proc) const; │ │ │ │ │ +784 }; │ │ │ │ │ +789 template │ │ │ │ │ +790 struct MessageScatterer │ │ │ │ │ +791 { │ │ │ │ │ +793 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ +794 │ │ │ │ │ +799 typedef GatherScatter Scatterer; │ │ │ │ │ +800 │ │ │ │ │ +806 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ +807 │ │ │ │ │ +815 inline void operator()(const InterfaceMap& interface, Data& data, Type* │ │ │ │ │ +buffer, const int& proc) const; │ │ │ │ │ +816 }; │ │ │ │ │ +817 │ │ │ │ │ +821 struct MessageInformation │ │ │ │ │ +822 { │ │ │ │ │ +824 MessageInformation() │ │ │ │ │ +825 : start_(0), size_(0) │ │ │ │ │ +826 {} │ │ │ │ │ +827 │ │ │ │ │ +835 MessageInformation(size_t start, size_t size) │ │ │ │ │ +836 : start_(start), size_(size) │ │ │ │ │ +837 {} │ │ │ │ │ +841 size_t start_; │ │ │ │ │ +845 size_t size_; │ │ │ │ │ +846 }; │ │ │ │ │ +847 │ │ │ │ │ +854 typedef std::map > │ │ │ │ │ +855 InformationMap; │ │ │ │ │ +859 InformationMap messageInformation_; │ │ │ │ │ +863 char* buffers_[2]; │ │ │ │ │ +867 size_t bufferSize_[2]; │ │ │ │ │ +868 │ │ │ │ │ +872 constexpr static int commTag_ = 0; │ │ │ │ │ +873 │ │ │ │ │ +877 std::map > │ │ │ │ │ +interfaces_; │ │ │ │ │ +878 │ │ │ │ │ +879 MPI_Comm communicator_; │ │ │ │ │ +880 │ │ │ │ │ +884 template │ │ │ │ │ +885 void sendRecv(const Data& source, Data& target); │ │ │ │ │ +886 │ │ │ │ │ +887 }; │ │ │ │ │ +888 │ │ │ │ │ +889#ifndef DOXYGEN │ │ │ │ │ +890 │ │ │ │ │ +891 template │ │ │ │ │ +892 inline const void* _C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s(const V& v, int index) │ │ │ │ │ +893 { │ │ │ │ │ +894 return &(v[index]); │ │ │ │ │ +895 } │ │ │ │ │ +896 │ │ │ │ │ +897 template │ │ │ │ │ +898 inline int _C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_S_i_z_e([[maybe_unused]] const V& v, [ │ │ │ │ │ +[maybe_unused]] int index) │ │ │ │ │ +899 { │ │ │ │ │ +900 return 1; │ │ │ │ │ +901 } │ │ │ │ │ +902 │ │ │ │ │ +903 template │ │ │ │ │ +904 inline const void* CommPolicy, A> >:: │ │ │ │ │ +getAddress(const Type& v, int index) │ │ │ │ │ +905 { │ │ │ │ │ +906 return &(v[index][0]); │ │ │ │ │ +907 } │ │ │ │ │ +908 │ │ │ │ │ +909 template │ │ │ │ │ +910 inline int CommPolicy, A> >::getSize │ │ │ │ │ +(const Type& v, int index) │ │ │ │ │ +911 { │ │ │ │ │ +912 return v[index].getsize(); │ │ │ │ │ +913 } │ │ │ │ │ +914 │ │ │ │ │ +915 template │ │ │ │ │ +916 inline const typename CopyGatherScatter::IndexedType& │ │ │ │ │ +CopyGatherScatter::gather(const T & vec, std::size_t i) │ │ │ │ │ +917 { │ │ │ │ │ +918 return vec[i]; │ │ │ │ │ +919 } │ │ │ │ │ +920 │ │ │ │ │ +921 template │ │ │ │ │ +922 inline void CopyGatherScatter::scatter(T& vec, const IndexedType& v, │ │ │ │ │ +std::size_t i) │ │ │ │ │ +923 { │ │ │ │ │ +924 vec[i]=v; │ │ │ │ │ +925 } │ │ │ │ │ +926 │ │ │ │ │ +927 template │ │ │ │ │ +928 DatatypeCommunicator::DatatypeCommunicator() │ │ │ │ │ +929 : remoteIndices_(0), created_(false) │ │ │ │ │ +930 { │ │ │ │ │ +931 requests_[0]=0; │ │ │ │ │ +932 requests_[1]=0; │ │ │ │ │ +933 } │ │ │ │ │ +934 │ │ │ │ │ +935 │ │ │ │ │ +936 │ │ │ │ │ +937 template │ │ │ │ │ +938 DatatypeCommunicator::~DatatypeCommunicator() │ │ │ │ │ +939 { │ │ │ │ │ +940 free(); │ │ │ │ │ +941 } │ │ │ │ │ +942 │ │ │ │ │ +943 template │ │ │ │ │ +944 template │ │ │ │ │ +945 inline void DatatypeCommunicator::build(const RemoteIndices& │ │ │ │ │ +remoteIndices, │ │ │ │ │ +946 const T1& source, V& sendData, │ │ │ │ │ +947 const T2& destination, V& receiveData) │ │ │ │ │ +948 { │ │ │ │ │ +949 remoteIndices_ = &remoteIndices; │ │ │ │ │ +950 free(); │ │ │ │ │ +951 createDataTypes(source,destination, receiveData); │ │ │ │ │ +952 createDataTypes(source,destination, sendData); │ │ │ │ │ +953 createRequests(sendData, receiveData); │ │ │ │ │ +954 createRequests(receiveData, sendData); │ │ │ │ │ +955 created_=true; │ │ │ │ │ +956 } │ │ │ │ │ +957 │ │ │ │ │ +958 template │ │ │ │ │ +959 void DatatypeCommunicator::free() │ │ │ │ │ +960 { │ │ │ │ │ +961 if(created_) { │ │ │ │ │ +962 delete[] requests_[0]; │ │ │ │ │ +963 delete[] requests_[1]; │ │ │ │ │ +964 typedef MessageTypeMap::iterator iterator; │ │ │ │ │ +965 typedef MessageTypeMap::const_iterator const_iterator; │ │ │ │ │ +966 │ │ │ │ │ +967 const const_iterator end=messageTypes.end(); │ │ │ │ │ +968 │ │ │ │ │ +969 for(iterator process = messageTypes.begin(); process != end; ++process) { │ │ │ │ │ +970 MPI_Datatype *type = &(process->second.first); │ │ │ │ │ +971 int finalized=0; │ │ │ │ │ +972 MPI_Finalized(&finalized); │ │ │ │ │ +973 if(*type!=MPI_DATATYPE_NULL && !finalized) │ │ │ │ │ +974 MPI_Type_free(type); │ │ │ │ │ +975 type = &(process->second.second); │ │ │ │ │ +976 if(*type!=MPI_DATATYPE_NULL && !finalized) │ │ │ │ │ +977 MPI_Type_free(type); │ │ │ │ │ +978 } │ │ │ │ │ +979 messageTypes.clear(); │ │ │ │ │ +980 created_=false; │ │ │ │ │ +981 } │ │ │ │ │ +982 │ │ │ │ │ +983 } │ │ │ │ │ +984 │ │ │ │ │ +985 template │ │ │ │ │ +986 template │ │ │ │ │ +987 void DatatypeCommunicator::createDataTypes(const T1& sourceFlags, const │ │ │ │ │ +T2& destFlags, V& data) │ │ │ │ │ +988 { │ │ │ │ │ +989 │ │ │ │ │ +990 MPIDatatypeInformation dataInfo(data); │ │ │ │ │ +991 this->template │ │ │ │ │ +buildInterface,send> │ │ │ │ │ +(*remoteIndices_,sourceFlags, destFlags, dataInfo); │ │ │ │ │ +992 │ │ │ │ │ +993 typedef typename RemoteIndices::RemoteIndexMap::const_iterator │ │ │ │ │ +const_iterator; │ │ │ │ │ +994 const const_iterator end=this->remoteIndices_->end(); │ │ │ │ │ +995 │ │ │ │ │ +996 // Allocate MPI_Datatypes and deallocate memory for the type construction. │ │ │ │ │ +997 for(const_iterator process=this->remoteIndices_->begin(); process != end; │ │ │ │ │ +++process) { │ │ │ │ │ +998 IndexedTypeInformation& info=dataInfo.information_[process->first]; │ │ │ │ │ +999 // Shift the displacement │ │ │ │ │ +1000 MPI_Aint base; │ │ │ │ │ +1001 MPI_Get_address(const_cast(_C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s(data, 0)), │ │ │ │ │ +&base); │ │ │ │ │ +1002 │ │ │ │ │ +1003 for(int i=0; i< info.elements; i++) { │ │ │ │ │ +1004 info.displ[i]-=base; │ │ │ │ │ +1005 } │ │ │ │ │ +1006 │ │ │ │ │ +1007 // Create data type │ │ │ │ │ +1008 MPI_Datatype* type = &( send ? messageTypes[process->first].first : │ │ │ │ │ +messageTypes[process->first].second); │ │ │ │ │ +1009 MPI_Type_create_hindexed(info.elements, info.length, info.displ, │ │ │ │ │ +1010 MPITraits_:_:_I_n_d_e_x_e_d_T_y_p_e>::getType(), type); │ │ │ │ │ +1011 MPI_Type_commit(type); │ │ │ │ │ +1012 // Deallocate memory │ │ │ │ │ +1013 info.free(); │ │ │ │ │ +1014 } │ │ │ │ │ +1015 } │ │ │ │ │ +1016 │ │ │ │ │ +1017 template │ │ │ │ │ +1018 template │ │ │ │ │ +1019 void DatatypeCommunicator::createRequests(V& sendData, V& receiveData) │ │ │ │ │ +1020 { │ │ │ │ │ +1021 typedef std::map >:: │ │ │ │ │ +const_iterator MapIterator; │ │ │ │ │ +1022 int rank; │ │ │ │ │ +1023 static int index = createForward ? 1 : 0; │ │ │ │ │ +1024 int noMessages = messageTypes.size(); │ │ │ │ │ +1025 // allocate request handles │ │ │ │ │ +1026 requests_[index] = new MPI_Request[2*noMessages]; │ │ │ │ │ +1027 const MapIterator end = messageTypes.end(); │ │ │ │ │ +1028 int request=0; │ │ │ │ │ +1029 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ +1030 │ │ │ │ │ +1031 // Set up the requests for receiving first │ │ │ │ │ +1032 for(MapIterator process = messageTypes.begin(); process != end; │ │ │ │ │ +1033 ++process, ++request) { │ │ │ │ │ +1034 MPI_Datatype type = createForward ? process->second.second : process- │ │ │ │ │ +>second.first; │ │ │ │ │ +1035 void* address = const_cast(_C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s │ │ │ │ │ +(receiveData,0)); │ │ │ │ │ +1036 MPI_Recv_init(address, 1, type, process->first, commTag_, this- │ │ │ │ │ +>remoteIndices_->communicator(), requests_[index]+request); │ │ │ │ │ +1037 } │ │ │ │ │ +1038 │ │ │ │ │ +1039 // And now the send requests │ │ │ │ │ +1040 │ │ │ │ │ +1041 for(MapIterator process = messageTypes.begin(); process != end; │ │ │ │ │ +1042 ++process, ++request) { │ │ │ │ │ +1043 MPI_Datatype type = createForward ? process->second.first : process- │ │ │ │ │ +>second.second; │ │ │ │ │ +1044 void* address = const_cast(_C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s(sendData, 0)); │ │ │ │ │ +1045 MPI_Ssend_init(address, 1, type, process->first, commTag_, this- │ │ │ │ │ +>remoteIndices_->communicator(), requests_[index]+request); │ │ │ │ │ +1046 } │ │ │ │ │ +1047 } │ │ │ │ │ +1048 │ │ │ │ │ +1049 template │ │ │ │ │ +1050 void DatatypeCommunicator::forward() │ │ │ │ │ +1051 { │ │ │ │ │ +1052 sendRecv(requests_[1]); │ │ │ │ │ +1053 } │ │ │ │ │ +1054 │ │ │ │ │ +1055 template │ │ │ │ │ +1056 void DatatypeCommunicator::backward() │ │ │ │ │ +1057 { │ │ │ │ │ +1058 sendRecv(requests_[0]); │ │ │ │ │ +1059 } │ │ │ │ │ +1060 │ │ │ │ │ +1061 template │ │ │ │ │ +1062 void DatatypeCommunicator::sendRecv(MPI_Request* requests) │ │ │ │ │ +1063 { │ │ │ │ │ +1064 int noMessages = messageTypes.size(); │ │ │ │ │ +1065 // Start the receive calls first │ │ │ │ │ +1066 MPI_Startall(noMessages, requests); │ │ │ │ │ +1067 // Now the send calls │ │ │ │ │ +1068 MPI_Startall(noMessages, requests+noMessages); │ │ │ │ │ +1069 │ │ │ │ │ +1070 // Wait for completion of the communication send first then receive │ │ │ │ │ +1071 MPI_Status* status=new MPI_Status[2*noMessages]; │ │ │ │ │ +1072 for(int i=0; i<2*noMessages; i++) │ │ │ │ │ +1073 status[i].MPI_ERROR=MPI_SUCCESS; │ │ │ │ │ +1074 │ │ │ │ │ +1075 int send = MPI_Waitall(noMessages, requests+noMessages, │ │ │ │ │ +status+noMessages); │ │ │ │ │ +1076 int receive = MPI_Waitall(noMessages, requests, status); │ │ │ │ │ +1077 │ │ │ │ │ +1078 // Error checks │ │ │ │ │ +1079 int success=1, globalSuccess=0; │ │ │ │ │ +1080 if(send==MPI_ERR_IN_STATUS) { │ │ │ │ │ +1081 int rank; │ │ │ │ │ +1082 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank); │ │ │ │ │ +1083 std::cerr<remoteIndices_->communicator(), &rank); │ │ │ │ │ +1101 std::cerr<remoteIndices_->communicator()); │ │ │ │ │ +1117 │ │ │ │ │ +1118 delete[] status; │ │ │ │ │ +1119 │ │ │ │ │ +1120 if(!globalSuccess) │ │ │ │ │ +1121 _D_U_N_E___T_H_R_O_W(CommunicationError, "A communication error occurred!"); │ │ │ │ │ +1122 │ │ │ │ │ +1123 } │ │ │ │ │ +1124 │ │ │ │ │ +1125 inline _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r() │ │ │ │ │ +1126 { │ │ │ │ │ +1127 buffers_[0]=0; │ │ │ │ │ +1128 buffers_[1]=0; │ │ │ │ │ +1129 bufferSize_[0]=0; │ │ │ │ │ +1130 bufferSize_[1]=0; │ │ │ │ │ +1131 } │ │ │ │ │ +1132 │ │ │ │ │ +1133 template │ │ │ │ │ +1134 typename std::enable_if:: │ │ │ │ │ +IndexedTypeFlag>::value, void>::type │ │ │ │ │ +1135 _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d(const Interface& interface) │ │ │ │ │ +1136 { │ │ │ │ │ +1137 interfaces_=interface.interfaces(); │ │ │ │ │ +1138 communicator_=interface.communicator(); │ │ │ │ │ +1139 typedef typename std::map > │ │ │ │ │ +1140 ::const_iterator const_iterator; │ │ │ │ │ +1141 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g Flag; │ │ │ │ │ +1142 const const_iterator end = interfaces_.end(); │ │ │ │ │ +1143 int lrank; │ │ │ │ │ +1144 MPI_Comm_rank(communicator_, &lrank); │ │ │ │ │ +1145 │ │ │ │ │ +1146 bufferSize_[0]=0; │ │ │ │ │ +1147 bufferSize_[1]=0; │ │ │ │ │ +1148 │ │ │ │ │ +1149 for(const_iterator interfacePair = interfaces_.begin(); │ │ │ │ │ +1150 interfacePair != end; ++interfacePair) { │ │ │ │ │ +1151 int noSend = MessageSizeCalculator() (interfacePair- │ │ │ │ │ +>second.first); │ │ │ │ │ +1152 int noRecv = MessageSizeCalculator() (interfacePair- │ │ │ │ │ +>second.second); │ │ │ │ │ +1153 if (noSend + noRecv > 0) │ │ │ │ │ +1154 messageInformation_.insert(std::make_pair(interfacePair->first, │ │ │ │ │ +1155 std::make_pair(MessageInformation(bufferSize_[0], │ │ │ │ │ +1156 noSend*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e)), │ │ │ │ │ +1157 MessageInformation(bufferSize_[1], │ │ │ │ │ +1158 noRecv*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e))))); │ │ │ │ │ +1159 bufferSize_[0] += noSend; │ │ │ │ │ +1160 bufferSize_[1] += noRecv; │ │ │ │ │ +1161 } │ │ │ │ │ +1162 │ │ │ │ │ +1163 // allocate the buffers │ │ │ │ │ +1164 bufferSize_[0] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ +1165 bufferSize_[1] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ +1166 │ │ │ │ │ +1167 buffers_[0] = new char[bufferSize_[0]]; │ │ │ │ │ +1168 buffers_[1] = new char[bufferSize_[1]]; │ │ │ │ │ +1169 } │ │ │ │ │ +1170 │ │ │ │ │ +1171 template │ │ │ │ │ +1172 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d(const Data& source, const Data& dest, │ │ │ │ │ +const Interface& interface) │ │ │ │ │ +1173 { │ │ │ │ │ +1174 │ │ │ │ │ +1175 interfaces_=interface.interfaces(); │ │ │ │ │ +1176 communicator_=interface.communicator(); │ │ │ │ │ +1177 typedef typename std::map > │ │ │ │ │ +1178 ::const_iterator const_iterator; │ │ │ │ │ +1179 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g Flag; │ │ │ │ │ +1180 const const_iterator end = interfaces_.end(); │ │ │ │ │ +1181 │ │ │ │ │ +1182 bufferSize_[0]=0; │ │ │ │ │ +1183 bufferSize_[1]=0; │ │ │ │ │ +1184 │ │ │ │ │ +1185 for(const_iterator interfacePair = interfaces_.begin(); │ │ │ │ │ +1186 interfacePair != end; ++interfacePair) { │ │ │ │ │ +1187 int noSend = MessageSizeCalculator() (source, interfacePair- │ │ │ │ │ +>second.first); │ │ │ │ │ +1188 int noRecv = MessageSizeCalculator() (dest, interfacePair- │ │ │ │ │ +>second.second); │ │ │ │ │ +1189 if (noSend + noRecv > 0) │ │ │ │ │ +1190 messageInformation_.insert(std::make_pair(interfacePair->first, │ │ │ │ │ +1191 std::make_pair(MessageInformation(bufferSize_[0], │ │ │ │ │ +1192 noSend*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e)), │ │ │ │ │ +1193 MessageInformation(bufferSize_[1], │ │ │ │ │ +1194 noRecv*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e))))); │ │ │ │ │ +1195 bufferSize_[0] += noSend; │ │ │ │ │ +1196 bufferSize_[1] += noRecv; │ │ │ │ │ +1197 } │ │ │ │ │ +1198 │ │ │ │ │ +1199 bufferSize_[0] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ +1200 bufferSize_[1] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ +1201 // allocate the buffers │ │ │ │ │ +1202 buffers_[0] = new char[bufferSize_[0]]; │ │ │ │ │ +1203 buffers_[1] = new char[bufferSize_[1]]; │ │ │ │ │ +1204 } │ │ │ │ │ +1205 │ │ │ │ │ +1206 inline void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_r_e_e() │ │ │ │ │ +1207 { │ │ │ │ │ +1208 messageInformation_.clear(); │ │ │ │ │ +1209 if(buffers_[0]) │ │ │ │ │ +1210 delete[] buffers_[0]; │ │ │ │ │ +1211 │ │ │ │ │ +1212 if(buffers_[1]) │ │ │ │ │ +1213 delete[] buffers_[1]; │ │ │ │ │ +1214 buffers_[0]=buffers_[1]=0; │ │ │ │ │ +1215 } │ │ │ │ │ +1216 │ │ │ │ │ +1217 inline _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_~_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r() │ │ │ │ │ +1218 { │ │ │ │ │ +1219 _f_r_e_e(); │ │ │ │ │ +1220 } │ │ │ │ │ +1221 │ │ │ │ │ +1222 template │ │ │ │ │ +1223 inline int BufferedCommunicator::MessageSizeCalculator:: │ │ │ │ │ +operator() │ │ │ │ │ +1224 (const InterfaceInformation& info) const │ │ │ │ │ +1225 { │ │ │ │ │ +1226 return info.size(); │ │ │ │ │ +1227 } │ │ │ │ │ +1228 │ │ │ │ │ +1229 │ │ │ │ │ +1230 template │ │ │ │ │ +1231 inline int BufferedCommunicator::MessageSizeCalculator:: │ │ │ │ │ +operator() │ │ │ │ │ +1232 (const Data&, const InterfaceInformation& info) const │ │ │ │ │ +1233 { │ │ │ │ │ +1234 return operator()(info); │ │ │ │ │ +1235 } │ │ │ │ │ +1236 │ │ │ │ │ +1237 │ │ │ │ │ +1238 template │ │ │ │ │ +1239 inline int BufferedCommunicator::MessageSizeCalculator::operator() │ │ │ │ │ +1240 (const Data& data, const InterfaceInformation& info) const │ │ │ │ │ +1241 { │ │ │ │ │ +1242 int entries=0; │ │ │ │ │ +1243 │ │ │ │ │ +1244 for(size_t i=0; i < info.size(); i++) │ │ │ │ │ +1245 entries += _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_g_e_t_S_i_z_e(data,info[i]); │ │ │ │ │ +1246 │ │ │ │ │ +1247 return entries; │ │ │ │ │ +1248 } │ │ │ │ │ +1249 │ │ │ │ │ +1250 │ │ │ │ │ +1251 template │ │ │ │ │ +1252 inline void BufferedCommunicator:: │ │ │ │ │ +MessageGatherer::operator()(const │ │ │ │ │ +InterfaceMap& interfaces,const Data& data, Type* buffer, [[maybe_unused]] │ │ │ │ │ +size_t bufferSize) const │ │ │ │ │ +1253 { │ │ │ │ │ +1254 typedef typename InterfaceMap::const_iterator │ │ │ │ │ +1255 const_iterator; │ │ │ │ │ +1256 │ │ │ │ │ +1257 int rank; │ │ │ │ │ +1258 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ +1259 const const_iterator end = interfaces.end(); │ │ │ │ │ +1260 size_t index=0; │ │ │ │ │ +1261 │ │ │ │ │ +1262 for(const_iterator interfacePair = interfaces.begin(); │ │ │ │ │ +1263 interfacePair != end; ++interfacePair) { │ │ │ │ │ +1264 int size = forward ? interfacePair->second.first.size() : │ │ │ │ │ +1265 interfacePair->second.second.size(); │ │ │ │ │ +1266 │ │ │ │ │ +1267 for(int i=0; i < size; i++) { │ │ │ │ │ +1268 int local = forward ? interfacePair->second.first[i] : │ │ │ │ │ +1269 interfacePair->second.second[i]; │ │ │ │ │ +1270 for(std::size_t j=0; j < CommPolicy::getSize(data, local); j++, │ │ │ │ │ +index++) { │ │ │ │ │ +1271 │ │ │ │ │ +1272#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1273 assert(bufferSize>=(index+1)*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e)); │ │ │ │ │ +1274#endif │ │ │ │ │ +1275 buffer[index]=GatherScatter::gather(data, local, j); │ │ │ │ │ +1276 } │ │ │ │ │ +1277 │ │ │ │ │ +1278 } │ │ │ │ │ +1279 } │ │ │ │ │ +1280 │ │ │ │ │ +1281 } │ │ │ │ │ +1282 │ │ │ │ │ +1283 │ │ │ │ │ +1284 template │ │ │ │ │ +1285 inline void BufferedCommunicator:: │ │ │ │ │ +MessageGatherer::operator()( │ │ │ │ │ +1286 const InterfaceMap& interfaces, const Data& data, Type* buffer, [ │ │ │ │ │ +[maybe_unused]] size_t bufferSize) const │ │ │ │ │ +1287 { │ │ │ │ │ +1288 typedef typename InterfaceMap::const_iterator │ │ │ │ │ +1289 const_iterator; │ │ │ │ │ +1290 const const_iterator end = interfaces.end(); │ │ │ │ │ +1291 size_t index = 0; │ │ │ │ │ +1292 │ │ │ │ │ +1293 int rank; │ │ │ │ │ +1294 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ +1295 │ │ │ │ │ +1296 for(const_iterator interfacePair = interfaces.begin(); │ │ │ │ │ +1297 interfacePair != end; ++interfacePair) { │ │ │ │ │ +1298 size_t size = FORWARD ? interfacePair->second.first.size() : │ │ │ │ │ +1299 interfacePair->second.second.size(); │ │ │ │ │ +1300 │ │ │ │ │ +1301 for(size_t i=0; i < size; i++) { │ │ │ │ │ +1302 │ │ │ │ │ +1303#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1304 assert(bufferSize>=(index+1)*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e)); │ │ │ │ │ +1305#endif │ │ │ │ │ +1306 │ │ │ │ │ +1307 buffer[index++] = GatherScatter::gather(data, FORWARD ? interfacePair- │ │ │ │ │ +>second.first[i] : │ │ │ │ │ +1308 interfacePair->second.second[i]); │ │ │ │ │ +1309 } │ │ │ │ │ +1310 } │ │ │ │ │ +1311 │ │ │ │ │ +1312 } │ │ │ │ │ +1313 │ │ │ │ │ +1314 │ │ │ │ │ +1315 template │ │ │ │ │ +1316 inline void BufferedCommunicator:: │ │ │ │ │ +MessageScatterer::operator()(const │ │ │ │ │ +InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const │ │ │ │ │ +1317 { │ │ │ │ │ +1318 typedef typename InterfaceMap::value_type::second_type::first_type │ │ │ │ │ +Information; │ │ │ │ │ +1319 const typename InterfaceMap::const_iterator infoPair = interfaces.find │ │ │ │ │ +(proc); │ │ │ │ │ +1320 │ │ │ │ │ +1321 assert(infoPair!=interfaces.end()); │ │ │ │ │ +1322 │ │ │ │ │ +1323 const Information& info = FORWARD ? infoPair->second.second : │ │ │ │ │ +1324 infoPair->second.first; │ │ │ │ │ +1325 │ │ │ │ │ +1326 for(size_t i=0, index=0; i < info.size(); i++) { │ │ │ │ │ +1327 for(size_t j=0; j < CommPolicy::getSize(data, info[i]); j++) │ │ │ │ │ +1328 GatherScatter::scatter(data, buffer[index++], info[i], j); │ │ │ │ │ +1329 } │ │ │ │ │ +1330 } │ │ │ │ │ +1331 │ │ │ │ │ +1332 │ │ │ │ │ +1333 template │ │ │ │ │ +1334 inline void BufferedCommunicator:: │ │ │ │ │ +MessageScatterer::operator()(const │ │ │ │ │ +InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const │ │ │ │ │ +1335 { │ │ │ │ │ +1336 typedef typename InterfaceMap::value_type::second_type::first_type │ │ │ │ │ +Information; │ │ │ │ │ +1337 const typename InterfaceMap::const_iterator infoPair = interfaces.find │ │ │ │ │ +(proc); │ │ │ │ │ +1338 │ │ │ │ │ +1339 assert(infoPair!=interfaces.end()); │ │ │ │ │ +1340 │ │ │ │ │ +1341 const Information& info = FORWARD ? infoPair->second.second : │ │ │ │ │ +1342 infoPair->second.first; │ │ │ │ │ +1343 │ │ │ │ │ +1344 for(size_t i=0; i < info.size(); i++) { │ │ │ │ │ +1345 GatherScatter::scatter(data, buffer[i], info[i]); │ │ │ │ │ +1346 } │ │ │ │ │ +1347 } │ │ │ │ │ +1348 │ │ │ │ │ +1349 │ │ │ │ │ +1350 template │ │ │ │ │ +1351 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d(Data& data) │ │ │ │ │ +1352 { │ │ │ │ │ +1353 this->template sendRecv(data, data); │ │ │ │ │ +1354 } │ │ │ │ │ +1355 │ │ │ │ │ +1356 │ │ │ │ │ +1357 template │ │ │ │ │ +1358 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d(Data& data) │ │ │ │ │ +1359 { │ │ │ │ │ +1360 this->template sendRecv(data, data); │ │ │ │ │ +1361 } │ │ │ │ │ +1362 │ │ │ │ │ +1363 │ │ │ │ │ +1364 template │ │ │ │ │ +1365 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d(const Data& source, Data& dest) │ │ │ │ │ +1366 { │ │ │ │ │ +1367 this->template sendRecv(source, dest); │ │ │ │ │ +1368 } │ │ │ │ │ +1369 │ │ │ │ │ +1370 │ │ │ │ │ +1371 template │ │ │ │ │ +1372 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d(Data& source, const Data& dest) │ │ │ │ │ +1373 { │ │ │ │ │ +1374 this->template sendRecv(dest, source); │ │ │ │ │ +1375 } │ │ │ │ │ +1376 │ │ │ │ │ +1377 │ │ │ │ │ +1378 template │ │ │ │ │ +1379 void BufferedCommunicator::sendRecv(const Data& source, Data& dest) │ │ │ │ │ +1380 { │ │ │ │ │ +1381 int rank, lrank; │ │ │ │ │ +1382 │ │ │ │ │ +1383 MPI_Comm_rank(MPI_COMM_WORLD,&rank); │ │ │ │ │ +1384 MPI_Comm_rank(MPI_COMM_WORLD,&lrank); │ │ │ │ │ +1385 │ │ │ │ │ +1386 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ +1387 Type *sendBuffer, *recvBuffer; │ │ │ │ │ +1388 size_t sendBufferSize; │ │ │ │ │ +1389#ifndef NDEBUG │ │ │ │ │ +1390 size_t recvBufferSize; │ │ │ │ │ +1391#endif │ │ │ │ │ +1392 │ │ │ │ │ +1393 if(FORWARD) { │ │ │ │ │ +1394 sendBuffer = reinterpret_cast(buffers_[0]); │ │ │ │ │ +1395 sendBufferSize = bufferSize_[0]; │ │ │ │ │ +1396 recvBuffer = reinterpret_cast(buffers_[1]); │ │ │ │ │ +1397#ifndef NDEBUG │ │ │ │ │ +1398 recvBufferSize = bufferSize_[1]; │ │ │ │ │ +1399#endif │ │ │ │ │ +1400 }else{ │ │ │ │ │ +1401 sendBuffer = reinterpret_cast(buffers_[1]); │ │ │ │ │ +1402 sendBufferSize = bufferSize_[1]; │ │ │ │ │ +1403 recvBuffer = reinterpret_cast(buffers_[0]); │ │ │ │ │ +1404#ifndef NDEBUG │ │ │ │ │ +1405 recvBufferSize = bufferSize_[0]; │ │ │ │ │ +1406#endif │ │ │ │ │ +1407 } │ │ │ │ │ +1408 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g Flag; │ │ │ │ │ +1409 │ │ │ │ │ +1410 MessageGatherer() (interfaces_, source, │ │ │ │ │ +sendBuffer, sendBufferSize); │ │ │ │ │ +1411 │ │ │ │ │ +1412 MPI_Request* sendRequests = new MPI_Request[messageInformation_.size()]; │ │ │ │ │ +1413 MPI_Request* recvRequests = new MPI_Request[messageInformation_.size()]; │ │ │ │ │ +1414 /* Number of recvRequests that are not MPI_REQUEST_NULL */ │ │ │ │ │ +1415 size_t numberOfRealRecvRequests = 0; │ │ │ │ │ +1416 │ │ │ │ │ +1417 // Setup receive first │ │ │ │ │ +1418 typedef typename InformationMap::const_iterator const_iterator; │ │ │ │ │ +1419 │ │ │ │ │ +1420 const const_iterator end = messageInformation_.end(); │ │ │ │ │ +1421 size_t i=0; │ │ │ │ │ +1422 int* processMap = new int[messageInformation_.size()]; │ │ │ │ │ +1423 │ │ │ │ │ +1424 for(const_iterator info = messageInformation_.begin(); info != end; │ │ │ │ │ +++info, ++i) { │ │ │ │ │ +1425 processMap[i]=info->first; │ │ │ │ │ +1426 if(FORWARD) { │ │ │ │ │ +1427 assert(info->second.second.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e)+info->second.second.size_ <= recvBufferSize ); │ │ │ │ │ +1428 _D_u_n_e_:_:_d_v_v_e_r_b<second.second.size_<<" from │ │ │ │ │ +"<first<second.second.size_) { │ │ │ │ │ +1430 MPI_Irecv(recvBuffer+info->second.second.start_, info- │ │ │ │ │ +>second.second.size_, │ │ │ │ │ +1431 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ +1432 recvRequests+i); │ │ │ │ │ +1433 numberOfRealRecvRequests += 1; │ │ │ │ │ +1434 } else { │ │ │ │ │ +1435 // Nothing to receive -> set request to inactive │ │ │ │ │ +1436 recvRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ +1437 } │ │ │ │ │ +1438 }else{ │ │ │ │ │ +1439 assert(info->second.first.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e)+info->second.first.size_ <= recvBufferSize ); │ │ │ │ │ +1440 _D_u_n_e_:_:_d_v_v_e_r_b<second.first.size_<<" to │ │ │ │ │ +"<first<second.first.size_) { │ │ │ │ │ +1442 MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_, │ │ │ │ │ +1443 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ +1444 recvRequests+i); │ │ │ │ │ +1445 numberOfRealRecvRequests += 1; │ │ │ │ │ +1446 } else { │ │ │ │ │ +1447 // Nothing to receive -> set request to inactive │ │ │ │ │ +1448 recvRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ +1449 } │ │ │ │ │ +1450 } │ │ │ │ │ +1451 } │ │ │ │ │ +1452 │ │ │ │ │ +1453 // now the send requests │ │ │ │ │ +1454 i=0; │ │ │ │ │ +1455 for(const_iterator info = messageInformation_.begin(); info != end; │ │ │ │ │ +++info, ++i) │ │ │ │ │ +1456 if(FORWARD) { │ │ │ │ │ +1457 assert(info->second.second.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e)+info->second.second.size_ <= recvBufferSize ); │ │ │ │ │ +1458 _D_u_n_e_:_:_d_v_v_e_r_b<second.first.size_<<" to "<first<second.first.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e)+info->second.first.size_ <= sendBufferSize ); │ │ │ │ │ +1460 if(info->second.first.size_) │ │ │ │ │ +1461 MPI_Issend(sendBuffer+info->second.first.start_, info->second.first.size_, │ │ │ │ │ +1462 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ +1463 sendRequests+i); │ │ │ │ │ +1464 else │ │ │ │ │ +1465 // Nothing to send -> set request to inactive │ │ │ │ │ +1466 sendRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ +1467 }else{ │ │ │ │ │ +1468 assert(info->second.second.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e)+info->second.second.size_ <= sendBufferSize ); │ │ │ │ │ +1469 _D_u_n_e_:_:_d_v_v_e_r_b<second.second.size_<<" to "<first<second.second.size_) │ │ │ │ │ +1471 MPI_Issend(sendBuffer+info->second.second.start_, info- │ │ │ │ │ +>second.second.size_, │ │ │ │ │ +1472 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ +1473 sendRequests+i); │ │ │ │ │ +1474 else │ │ │ │ │ +1475 // Nothing to send -> set request to inactive │ │ │ │ │ +1476 sendRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ +1477 } │ │ │ │ │ +1478 │ │ │ │ │ +1479 // Wait for completion of receive and immediately start scatter │ │ │ │ │ +1480 i=0; │ │ │ │ │ +1481 //int success = 1; │ │ │ │ │ +1482 int finished = MPI_UNDEFINED; │ │ │ │ │ +1483 MPI_Status status; //[messageInformation_.size()]; │ │ │ │ │ +1484 //MPI_Waitall(messageInformation_.size(), recvRequests, status); │ │ │ │ │ +1485 │ │ │ │ │ +1486 for(i=0; i< numberOfRealRecvRequests; i++) { │ │ │ │ │ +1487 status.MPI_ERROR=MPI_SUCCESS; │ │ │ │ │ +1488 MPI_Waitany(messageInformation_.size(), recvRequests, &finished, &status); │ │ │ │ │ +1489 assert(finished != MPI_UNDEFINED); │ │ │ │ │ +1490 │ │ │ │ │ +1491 if(status.MPI_ERROR==MPI_SUCCESS) { │ │ │ │ │ +1492 int& proc = processMap[finished]; │ │ │ │ │ +1493 typename InformationMap::const_iterator infoIter = │ │ │ │ │ +messageInformation_.find(proc); │ │ │ │ │ +1494 assert(infoIter != messageInformation_.end()); │ │ │ │ │ +1495 │ │ │ │ │ +1496 MessageInformation info = (FORWARD) ? infoIter->second.second : infoIter- │ │ │ │ │ +>second.first; │ │ │ │ │ +1497 assert(info.start_+info.size_ <= recvBufferSize); │ │ │ │ │ +1498 │ │ │ │ │ +1499 MessageScatterer() (interfaces_, dest, │ │ │ │ │ +recvBuffer+info.start_, proc); │ │ │ │ │ +1500 }else{ │ │ │ │ │ +1501 std::cerr<communicator()); │ │ │ │ │ +1517 │ │ │ │ │ +1518 if(!globalSuccess) │ │ │ │ │ +1519 DUNE_THROW(CommunicationError, "A communication error occurred!"); │ │ │ │ │ +1520 */ │ │ │ │ │ +1521 delete[] processMap; │ │ │ │ │ +1522 delete[] sendRequests; │ │ │ │ │ +1523 delete[] recvRequests; │ │ │ │ │ +1524 │ │ │ │ │ +1525 } │ │ │ │ │ +1526 │ │ │ │ │ +1527#endif // DOXYGEN │ │ │ │ │ +1528 │ │ │ │ │ +1530} │ │ │ │ │ +1531 │ │ │ │ │ +1532#endif // HAVE_MPI │ │ │ │ │ +1533 │ │ │ │ │ +1534#endif │ │ │ │ │ +_s_t_d_s_t_r_e_a_m_s_._h_h │ │ │ │ │ +Standard Dune debug streams. │ │ │ │ │ +_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +Classes describing a distributed indexset. │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_d_v_v_e_r_b │ │ │ │ │ +DVVerbType dvverb(std::cout) │ │ │ │ │ +stream for very verbose output. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:95 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_d_e_t_e_c_t_e_d___o_r___f_a_l_l_b_a_c_k___t │ │ │ │ │ -Std::detected_or_t< decltype(detail::warningIfNotDefined< Std::detected_t< │ │ │ │ │ -Fallback, Args... > >(std::declval< const Std::detected_t< TargetType, Args... │ │ │ │ │ -> * >())), TargetType, Args... > detected_or_fallback_t │ │ │ │ │ -This type will be either TargetType if it exists, or the │ │ │ │ │ -Fallback_,_ _A_ _>_ _>_:_: │ │ │ │ │ +_g_e_t_S_i_z_e │ │ │ │ │ +static int getSize(const Type &v, int i) │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ +VariableSize IndexedTypeFlag │ │ │ │ │ +DDeeffiinniittiioonn communicator.hh:184 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ +_T_y_p_e │ │ │ │ │ +VariableBlockVector< FieldVector< K, n >, A > Type │ │ │ │ │ +DDeeffiinniittiioonn communicator.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ +_g_e_t_A_d_d_r_e_s_s │ │ │ │ │ +static const void * getAddress(const Type &v, int i) │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ +Type::B IndexedType │ │ │ │ │ +DDeeffiinniittiioonn communicator.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_E_r_r_o_r │ │ │ │ │ +Error thrown if there was a problem with the communication. │ │ │ │ │ +DDeeffiinniittiioonn communicator.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +GatherScatter default implementation that just copies data. │ │ │ │ │ +DDeeffiinniittiioonn communicator.hh:202 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_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 &vec, const IndexedType &v, std::size_t i) │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ +CommPolicy< T >::IndexedType IndexedType │ │ │ │ │ +DDeeffiinniittiioonn communicator.hh:203 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ +static const IndexedType & gather(const T &vec, std::size_t i) │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +A communicator that uses buffers to gather and scatter the data to be send or │ │ │ │ │ +received. │ │ │ │ │ +DDeeffiinniittiioonn communicator.hh:458 │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d │ │ │ │ │ +void backward(Data &data) │ │ │ │ │ +Backward send where target and source are the same. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +BufferedCommunicator() │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_~_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +~BufferedCommunicator() │ │ │ │ │ +Destructor. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d │ │ │ │ │ +void forward(const Data &source, Data &dest) │ │ │ │ │ +Send from source to target. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_r_e_e │ │ │ │ │ +void free() │ │ │ │ │ +Free the allocated memory (i.e. buffers and message information. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d │ │ │ │ │ +std::enable_if< std::is_same< SizeOne, typenameCommPolicy< Data >:: │ │ │ │ │ +IndexedTypeFlag >::value, void >::type build(const Interface &interface) │ │ │ │ │ +Build the buffers and information for the communication process. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d │ │ │ │ │ +void backward(Data &source, const Data &dest) │ │ │ │ │ +Communicate in the reverse direction, i.e. send from target to source. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d │ │ │ │ │ +void build(const Data &source, const Data &target, const Interface &interface) │ │ │ │ │ +Build the buffers and information for the communication process. │ │ │ │ │ +_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d │ │ │ │ │ +void forward(Data &data) │ │ │ │ │ +Forward send where target and source are the same. │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Manager class for the mapping between local indices and globally unique │ │ │ │ │ +indices. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r │ │ │ │ │ +Base class of all classes representing a communication interface. │ │ │ │ │ +DDeeffiinniittiioonn parallel/interface.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +Information describing an interface. │ │ │ │ │ +DDeeffiinniittiioonn parallel/interface.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e │ │ │ │ │ +Communication interface between remote and local indices. │ │ │ │ │ +DDeeffiinniittiioonn parallel/interface.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +An index present on the local process. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +The indices present on remote processes. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ │ +The type of the global index. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:215 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ +LocalIndex::Attribute Attribute │ │ │ │ │ +The type of the attribute. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:226 │ │ │ │ │ +_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ │ +The type of the local index. │ │ │ │ │ +DDeeffiinniittiioonn remoteindices.hh:221 │ │ │ │ │ +_i_n_t_e_r_f_a_c_e_._h_h │ │ │ │ │ +Provides classes for building the communication interface between remote │ │ │ │ │ +indices. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00083.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: utility.hh File Reference │ │ │ │ +dune-common: mpiguard.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,36 +65,52 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces
│ │ │ │ -
utility.hh File Reference
│ │ │ │ +
mpiguard.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <utility>
│ │ │ │ + │ │ │ │ +

Implements a MPIGuard which detects an error on a remote process. │ │ │ │ +More...

│ │ │ │ +
#include "mpihelper.hh"
│ │ │ │ +#include "communication.hh"
│ │ │ │ +#include "mpicommunication.hh"
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::MPIGuardError
 This exception is thrown if the MPIGuard detects an error on a remote process. More...
 
class  Dune::MPIGuard
 detects a thrown exception and communicates to all other processes More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Implements a MPIGuard which detects an error on a remote process.

│ │ │ │ +
Author
Christian Engwer
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,20 +1,35 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -utility.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +mpiguard.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Implements a MPIGuard which detects an error on a remote process. _M_o_r_e_._._. │ │ │ │ │ +#include "_m_p_i_h_e_l_p_e_r_._h_h" │ │ │ │ │ +#include "_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h" │ │ │ │ │ +#include "_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h" │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_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_:_:_M_P_I_G_u_a_r_d_E_r_r_o_r │ │ │ │ │ +  This exception is thrown if the _M_P_I_G_u_a_r_d detects an error on a remote │ │ │ │ │ + process. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_M_P_I_G_u_a_r_d │ │ │ │ │ +  detects a thrown exception and communicates to all other processes │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Implements a MPIGuard which detects an error on a remote process. │ │ │ │ │ + Author │ │ │ │ │ + Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: utility.hh Source File │ │ │ │ +dune-common: mpiguard.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,49 +70,212 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
utility.hh
│ │ │ │ +
mpiguard.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_STD_UTILITY_HH
│ │ │ │ -
4#define DUNE_COMMON_STD_UTILITY_HH
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │
5
│ │ │ │ -
6#include <utility>
│ │ │ │ -
7
│ │ │ │ -
8#warning dune/common/std/utility.hh is deprecated and will be removed after Dune 2.8.\
│ │ │ │ -
9 Include <utility> instead
│ │ │ │ -
10
│ │ │ │ -
11namespace Dune
│ │ │ │ -
12{
│ │ │ │ -
13
│ │ │ │ -
14 namespace Std
│ │ │ │ -
15 {
│ │ │ │ -
16
│ │ │ │ -
17 using std::integer_sequence;
│ │ │ │ -
18 using std::index_sequence;
│ │ │ │ -
19 using std::make_integer_sequence;
│ │ │ │ -
20 using std::make_index_sequence;
│ │ │ │ -
21 using std::index_sequence_for;
│ │ │ │ -
22
│ │ │ │ -
23 } // namespace Std
│ │ │ │ -
24
│ │ │ │ -
25} // namespace Dune
│ │ │ │ -
26
│ │ │ │ -
27#endif // #ifndef DUNE_COMMON_STD_UTILITY_HH
│ │ │ │ +
13#ifndef DUNE_COMMON_MPIGUARD_HH
│ │ │ │ +
14#define DUNE_COMMON_MPIGUARD_HH
│ │ │ │ +
15
│ │ │ │ +
16#include "mpihelper.hh"
│ │ │ │ +
17#include "communication.hh"
│ │ │ │ +
18#include "mpicommunication.hh"
│ │ │ │ + │ │ │ │ +
20
│ │ │ │ +
21namespace Dune
│ │ │ │ +
22{
│ │ │ │ +
23
│ │ │ │ +
24#ifndef DOXYGEN
│ │ │ │ +
25
│ │ │ │ +
26 /*
│ │ │ │ +
27 Interface class for the communication needed by MPIGuard
│ │ │ │ +
28 */
│ │ │ │ +
29 struct GuardCommunicator
│ │ │ │ +
30 {
│ │ │ │ +
31 // cleanup
│ │ │ │ +
32 virtual ~GuardCommunicator() {};
│ │ │ │ +
33 // all the communication methods we need
│ │ │ │ +
34 virtual int rank() = 0;
│ │ │ │ +
35 virtual int size() = 0;
│ │ │ │ +
36 virtual int sum(int i) = 0;
│ │ │ │ +
37 // create a new GuardCommunicator pointer
│ │ │ │ +
38 template <class C>
│ │ │ │ +
39 static GuardCommunicator * create(const Communication<C> & c);
│ │ │ │ +
40#if HAVE_MPI
│ │ │ │ +
41 inline
│ │ │ │ +
42 static GuardCommunicator * create(const MPI_Comm & c);
│ │ │ │ +
43#endif
│ │ │ │ +
44 };
│ │ │ │ +
45
│ │ │ │ +
46 namespace {
│ │ │ │ +
47 /*
│ │ │ │ +
48 templated implementation of different communication classes
│ │ │ │ +
49 */
│ │ │ │ +
50 // the default class will always fail, due to the missing implementation of "sum"
│ │ │ │ +
51 template <class Imp>
│ │ │ │ +
52 struct GenericGuardCommunicator
│ │ │ │ +
53 : public GuardCommunicator
│ │ │ │ +
54 {};
│ │ │ │ +
55 // specialization for Communication
│ │ │ │ +
56 template <class T>
│ │ │ │ +
57 struct GenericGuardCommunicator< Communication<T> >
│ │ │ │ +
58 : public GuardCommunicator
│ │ │ │ +
59 {
│ │ │ │ +
60 const Communication<T> comm;
│ │ │ │ +
61 GenericGuardCommunicator(const Communication<T> & c) :
│ │ │ │ +
62 comm(c) {}
│ │ │ │ +
63 int rank() override { return comm.rank(); };
│ │ │ │ +
64 int size() override { return comm.size(); };
│ │ │ │ +
65 int sum(int i) override { return comm.sum(i); }
│ │ │ │ +
66 };
│ │ │ │ +
67
│ │ │ │ +
68#if HAVE_MPI
│ │ │ │ +
69 // specialization for MPI_Comm
│ │ │ │ +
70 template <>
│ │ │ │ +
71 struct GenericGuardCommunicator<MPI_Comm>
│ │ │ │ +
72 : public GenericGuardCommunicator< Communication<MPI_Comm> >
│ │ │ │ +
73 {
│ │ │ │ +
74 GenericGuardCommunicator(const MPI_Comm & c) :
│ │ │ │ +
75 GenericGuardCommunicator< Communication<MPI_Comm> >(
│ │ │ │ +
76 Communication<MPI_Comm>(c)) {}
│ │ │ │ +
77 };
│ │ │ │ +
78#endif
│ │ │ │ +
79 } // anonymous namespace
│ │ │ │ +
80
│ │ │ │ +
81 template<class C>
│ │ │ │ +
82 GuardCommunicator * GuardCommunicator::create(const Communication<C> & comm)
│ │ │ │ +
83 {
│ │ │ │ +
84 return new GenericGuardCommunicator< Communication<C> >(comm);
│ │ │ │ +
85 }
│ │ │ │ +
86
│ │ │ │ +
87#if HAVE_MPI
│ │ │ │ +
88 GuardCommunicator * GuardCommunicator::create(const MPI_Comm & comm)
│ │ │ │ +
89 {
│ │ │ │ +
90 return new GenericGuardCommunicator< Communication<MPI_Comm> >(comm);
│ │ │ │ +
91 }
│ │ │ │ +
92#endif
│ │ │ │ +
93
│ │ │ │ +
94#endif
│ │ │ │ +
95
│ │ │ │ +
99 class MPIGuardError : public ParallelError {};
│ │ │ │ +
100
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
134 {
│ │ │ │ +
135 GuardCommunicator * comm_;
│ │ │ │ +
136 bool active_;
│ │ │ │ +
137
│ │ │ │ +
138 // we don't want to copy this class
│ │ │ │ +
139 MPIGuard (const MPIGuard &);
│ │ │ │ +
140
│ │ │ │ +
141 public:
│ │ │ │ +
│ │ │ │ +
146 MPIGuard (bool active=true) :
│ │ │ │ +
147 comm_(GuardCommunicator::create(
│ │ │ │ +
148 MPIHelper::getCommunication())),
│ │ │ │ +
149 active_(active)
│ │ │ │ +
150 {}
│ │ │ │ +
│ │ │ │ +
151
│ │ │ │ +
│ │ │ │ +
157 MPIGuard (MPIHelper & m, bool active=true) :
│ │ │ │ +
158 comm_(GuardCommunicator::create(
│ │ │ │ +
159 m.getCommunication())),
│ │ │ │ +
160 active_(active)
│ │ │ │ +
161 {}
│ │ │ │ +
│ │ │ │ +
162
│ │ │ │ +
173 template <class C>
│ │ │ │ +
│ │ │ │ +
174 MPIGuard (const C & comm, bool active=true) :
│ │ │ │ +
175 comm_(GuardCommunicator::create(comm)),
│ │ │ │ +
176 active_(active)
│ │ │ │ +
177 {}
│ │ │ │ +
│ │ │ │ +
178
│ │ │ │ +
179#if HAVE_MPI
│ │ │ │ +
│ │ │ │ +
180 MPIGuard (const MPI_Comm & comm, bool active=true) :
│ │ │ │ +
181 comm_(GuardCommunicator::create(comm)),
│ │ │ │ +
182 active_(active)
│ │ │ │ +
183 {}
│ │ │ │ +
│ │ │ │ +
184#endif
│ │ │ │ +
185
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
189 {
│ │ │ │ +
190 if (active_)
│ │ │ │ +
191 {
│ │ │ │ +
192 active_ = false;
│ │ │ │ +
193 finalize(false);
│ │ │ │ +
194 }
│ │ │ │ +
195 delete comm_;
│ │ │ │ +
196 }
│ │ │ │ +
│ │ │ │ +
197
│ │ │ │ +
│ │ │ │ +
202 void reactivate() {
│ │ │ │ +
203 if (active_ == true)
│ │ │ │ +
204 finalize();
│ │ │ │ +
205 active_ = true;
│ │ │ │ +
206 }
│ │ │ │ +
│ │ │ │ +
207
│ │ │ │ +
│ │ │ │ +
218 void finalize(bool success = true)
│ │ │ │ +
219 {
│ │ │ │ +
220 int result = success ? 0 : 1;
│ │ │ │ +
221 bool was_active = active_;
│ │ │ │ +
222 active_ = false;
│ │ │ │ +
223 result = comm_->sum(result);
│ │ │ │ +
224 if (result>0 && was_active)
│ │ │ │ +
225 {
│ │ │ │ +
226 DUNE_THROW(MPIGuardError, "Terminating process "
│ │ │ │ +
227 << comm_->rank() << " due to "
│ │ │ │ +
228 << result << " remote error(s)");
│ │ │ │ +
229 }
│ │ │ │ +
230 }
│ │ │ │ +
│ │ │ │ +
231 };
│ │ │ │ +
│ │ │ │ +
232
│ │ │ │ +
233}
│ │ │ │ +
234
│ │ │ │ +
235#endif // DUNE_COMMON_MPIGUARD_HH
│ │ │ │ +
Implements an utility class that provides collective communication methods for sequential programs.
│ │ │ │ +
Helpers for dealing with MPI.
│ │ │ │ +
Implements an utility class that provides MPI's collective communication methods.
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
Default exception if an error in the parallel communication of the program occurred.
Definition exceptions.hh:287
│ │ │ │ +
This exception is thrown if the MPIGuard detects an error on a remote process.
Definition mpiguard.hh:99
│ │ │ │ +
detects a thrown exception and communicates to all other processes
Definition mpiguard.hh:134
│ │ │ │ +
void reactivate()
reactivate the guard.
Definition mpiguard.hh:202
│ │ │ │ +
void finalize(bool success=true)
stop the guard.
Definition mpiguard.hh:218
│ │ │ │ +
~MPIGuard()
destroy the guard and check for undetected exceptions
Definition mpiguard.hh:188
│ │ │ │ +
MPIGuard(const C &comm, bool active=true)
create an MPIGuard operating on an arbitrary communicator.
Definition mpiguard.hh:174
│ │ │ │ +
MPIGuard(const MPI_Comm &comm, bool active=true)
Definition mpiguard.hh:180
│ │ │ │ +
MPIGuard(bool active=true)
create an MPIGuard operating on the Communicator of the global Dune::MPIHelper
Definition mpiguard.hh:146
│ │ │ │ +
MPIGuard(MPIHelper &m, bool active=true)
create an MPIGuard operating on the Communicator of a special Dune::MPIHelper m
Definition mpiguard.hh:157
│ │ │ │ +
A real mpi helper.
Definition mpihelper.hh:179
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,43 +1,227 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -utility.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpiguard.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_STD_UTILITY_HH │ │ │ │ │ -4#define DUNE_COMMON_STD_UTILITY_HH │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ 5 │ │ │ │ │ -6#include │ │ │ │ │ -7 │ │ │ │ │ -8#warning dune/common/std/utility.hh is deprecated and will be removed after │ │ │ │ │ -Dune 2.8.\ │ │ │ │ │ -9 Include instead │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e │ │ │ │ │ -12{ │ │ │ │ │ -13 │ │ │ │ │ -14 namespace Std │ │ │ │ │ -15 { │ │ │ │ │ -16 │ │ │ │ │ -17 using std::integer_sequence; │ │ │ │ │ -18 using std::index_sequence; │ │ │ │ │ -19 using std::make_integer_sequence; │ │ │ │ │ -20 using std::make_index_sequence; │ │ │ │ │ -21 using std::index_sequence_for; │ │ │ │ │ -22 │ │ │ │ │ -23 } // namespace Std │ │ │ │ │ -24 │ │ │ │ │ -25} // namespace Dune │ │ │ │ │ -26 │ │ │ │ │ -27#endif // #ifndef DUNE_COMMON_STD_UTILITY_HH │ │ │ │ │ +13#ifndef DUNE_COMMON_MPIGUARD_HH │ │ │ │ │ +14#define DUNE_COMMON_MPIGUARD_HH │ │ │ │ │ +15 │ │ │ │ │ +16#include "_m_p_i_h_e_l_p_e_r_._h_h" │ │ │ │ │ +17#include "_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h" │ │ │ │ │ +18#include "_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h" │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +20 │ │ │ │ │ +21namespace _D_u_n_e │ │ │ │ │ +22{ │ │ │ │ │ +23 │ │ │ │ │ +24#ifndef DOXYGEN │ │ │ │ │ +25 │ │ │ │ │ +26 /* │ │ │ │ │ +27 Interface class for the communication needed by MPIGuard │ │ │ │ │ +28 */ │ │ │ │ │ +29 struct GuardCommunicator │ │ │ │ │ +30 { │ │ │ │ │ +31 // cleanup │ │ │ │ │ +32 virtual ~GuardCommunicator() {}; │ │ │ │ │ +33 // all the communication methods we need │ │ │ │ │ +34 virtual int rank() = 0; │ │ │ │ │ +35 virtual int size() = 0; │ │ │ │ │ +36 virtual int sum(int i) = 0; │ │ │ │ │ +37 // create a new GuardCommunicator pointer │ │ │ │ │ +38 template │ │ │ │ │ +39 static GuardCommunicator * create(const Communication & c); │ │ │ │ │ +40#if HAVE_MPI │ │ │ │ │ +41 inline │ │ │ │ │ +42 static GuardCommunicator * create(const MPI_Comm & c); │ │ │ │ │ +43#endif │ │ │ │ │ +44 }; │ │ │ │ │ +45 │ │ │ │ │ +46 namespace { │ │ │ │ │ +47 /* │ │ │ │ │ +48 templated implementation of different communication classes │ │ │ │ │ +49 */ │ │ │ │ │ +50 // the default class will always fail, due to the missing implementation of │ │ │ │ │ +"sum" │ │ │ │ │ +51 template │ │ │ │ │ +52 struct GenericGuardCommunicator │ │ │ │ │ +53 : public GuardCommunicator │ │ │ │ │ +54 {}; │ │ │ │ │ +55 // specialization for Communication │ │ │ │ │ +56 template │ │ │ │ │ +57 struct GenericGuardCommunicator< Communication > │ │ │ │ │ +58 : public GuardCommunicator │ │ │ │ │ +59 { │ │ │ │ │ +60 const Communication comm; │ │ │ │ │ +61 GenericGuardCommunicator(const Communication & c) : │ │ │ │ │ +62 comm(c) {} │ │ │ │ │ +63 int rank() override { return comm.rank(); }; │ │ │ │ │ +64 int size() override { return comm.size(); }; │ │ │ │ │ +65 int sum(int i) override { return comm.sum(i); } │ │ │ │ │ +66 }; │ │ │ │ │ +67 │ │ │ │ │ +68#if HAVE_MPI │ │ │ │ │ +69 // specialization for MPI_Comm │ │ │ │ │ +70 template <> │ │ │ │ │ +71 struct GenericGuardCommunicator │ │ │ │ │ +72 : public GenericGuardCommunicator< Communication > │ │ │ │ │ +73 { │ │ │ │ │ +74 GenericGuardCommunicator(const MPI_Comm & c) : │ │ │ │ │ +75 GenericGuardCommunicator< Communication >( │ │ │ │ │ +76 Communication(c)) {} │ │ │ │ │ +77 }; │ │ │ │ │ +78#endif │ │ │ │ │ +79 } // anonymous namespace │ │ │ │ │ +80 │ │ │ │ │ +81 template │ │ │ │ │ +82 GuardCommunicator * GuardCommunicator::create(const Communication & comm) │ │ │ │ │ +83 { │ │ │ │ │ +84 return new GenericGuardCommunicator< Communication >(comm); │ │ │ │ │ +85 } │ │ │ │ │ +86 │ │ │ │ │ +87#if HAVE_MPI │ │ │ │ │ +88 GuardCommunicator * GuardCommunicator::create(const MPI_Comm & comm) │ │ │ │ │ +89 { │ │ │ │ │ +90 return new GenericGuardCommunicator< Communication >(comm); │ │ │ │ │ +91 } │ │ │ │ │ +92#endif │ │ │ │ │ +93 │ │ │ │ │ +94#endif │ │ │ │ │ +95 │ │ │ │ │ +_9_9 class _M_P_I_G_u_a_r_d_E_r_r_o_r : public _P_a_r_a_l_l_e_l_E_r_r_o_r {}; │ │ │ │ │ +100 │ │ │ │ │ +_1_3_3 class _M_P_I_G_u_a_r_d │ │ │ │ │ +134 { │ │ │ │ │ +135 GuardCommunicator * comm_; │ │ │ │ │ +136 bool active_; │ │ │ │ │ +137 │ │ │ │ │ +138 // we don't want to copy this class │ │ │ │ │ +139 _M_P_I_G_u_a_r_d (const _M_P_I_G_u_a_r_d &); │ │ │ │ │ +140 │ │ │ │ │ +141 public: │ │ │ │ │ +_1_4_6 _M_P_I_G_u_a_r_d (bool active=true) : │ │ │ │ │ +147 comm_(GuardCommunicator::create( │ │ │ │ │ +148 _M_P_I_H_e_l_p_e_r::getCommunication())), │ │ │ │ │ +149 active_(active) │ │ │ │ │ +150 {} │ │ │ │ │ +151 │ │ │ │ │ +_1_5_7 _M_P_I_G_u_a_r_d (_M_P_I_H_e_l_p_e_r & m, bool active=true) : │ │ │ │ │ +158 comm_(GuardCommunicator::create( │ │ │ │ │ +159 m.getCommunication())), │ │ │ │ │ +160 active_(active) │ │ │ │ │ +161 {} │ │ │ │ │ +162 │ │ │ │ │ +173 template │ │ │ │ │ +_1_7_4 _M_P_I_G_u_a_r_d (const C & comm, bool active=true) : │ │ │ │ │ +175 comm_(GuardCommunicator::create(comm)), │ │ │ │ │ +176 active_(active) │ │ │ │ │ +177 {} │ │ │ │ │ +178 │ │ │ │ │ +179#if HAVE_MPI │ │ │ │ │ +_1_8_0 _M_P_I_G_u_a_r_d (const MPI_Comm & comm, bool active=true) : │ │ │ │ │ +181 comm_(GuardCommunicator::create(comm)), │ │ │ │ │ +182 active_(active) │ │ │ │ │ +183 {} │ │ │ │ │ +184#endif │ │ │ │ │ +185 │ │ │ │ │ +_1_8_8 _~_M_P_I_G_u_a_r_d() │ │ │ │ │ +189 { │ │ │ │ │ +190 if (active_) │ │ │ │ │ +191 { │ │ │ │ │ +192 active_ = false; │ │ │ │ │ +193 _f_i_n_a_l_i_z_e(false); │ │ │ │ │ +194 } │ │ │ │ │ +195 delete comm_; │ │ │ │ │ +196 } │ │ │ │ │ +197 │ │ │ │ │ +_2_0_2 void _r_e_a_c_t_i_v_a_t_e() { │ │ │ │ │ +203 if (active_ == true) │ │ │ │ │ +204 _f_i_n_a_l_i_z_e(); │ │ │ │ │ +205 active_ = true; │ │ │ │ │ +206 } │ │ │ │ │ +207 │ │ │ │ │ +_2_1_8 void _f_i_n_a_l_i_z_e(bool success = true) │ │ │ │ │ +219 { │ │ │ │ │ +220 int result = success ? 0 : 1; │ │ │ │ │ +221 bool was_active = active_; │ │ │ │ │ +222 active_ = false; │ │ │ │ │ +223 result = comm_->sum(result); │ │ │ │ │ +224 if (result>0 && was_active) │ │ │ │ │ +225 { │ │ │ │ │ +226 _D_U_N_E___T_H_R_O_W(_M_P_I_G_u_a_r_d_E_r_r_o_r, "Terminating process " │ │ │ │ │ +227 << comm_->rank() << " due to " │ │ │ │ │ +228 << result << " remote error(s)"); │ │ │ │ │ +229 } │ │ │ │ │ +230 } │ │ │ │ │ +231 }; │ │ │ │ │ +232 │ │ │ │ │ +233} │ │ │ │ │ +234 │ │ │ │ │ +235#endif // DUNE_COMMON_MPIGUARD_HH │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides collective communication methods for │ │ │ │ │ +sequential programs. │ │ │ │ │ +_m_p_i_h_e_l_p_e_r_._h_h │ │ │ │ │ +Helpers for dealing with MPI. │ │ │ │ │ +_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides MPI's collective communication │ │ │ │ │ +methods. │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_E_r_r_o_r │ │ │ │ │ +Default exception if an error in the parallel communication of the program │ │ │ │ │ +occurred. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:287 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_E_r_r_o_r │ │ │ │ │ +This exception is thrown if the MPIGuard detects an error on a remote process. │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d │ │ │ │ │ +detects a thrown exception and communicates to all other processes │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:134 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_:_:_r_e_a_c_t_i_v_a_t_e │ │ │ │ │ +void reactivate() │ │ │ │ │ +reactivate the guard. │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:202 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_:_:_f_i_n_a_l_i_z_e │ │ │ │ │ +void finalize(bool success=true) │ │ │ │ │ +stop the guard. │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_:_:_~_M_P_I_G_u_a_r_d │ │ │ │ │ +~MPIGuard() │ │ │ │ │ +destroy the guard and check for undetected exceptions │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_:_:_M_P_I_G_u_a_r_d │ │ │ │ │ +MPIGuard(const C &comm, bool active=true) │ │ │ │ │ +create an MPIGuard operating on an arbitrary communicator. │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:174 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_:_:_M_P_I_G_u_a_r_d │ │ │ │ │ +MPIGuard(const MPI_Comm &comm, bool active=true) │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_:_:_M_P_I_G_u_a_r_d │ │ │ │ │ +MPIGuard(bool active=true) │ │ │ │ │ +create an MPIGuard operating on the Communicator of the global Dune::MPIHelper │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:146 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_G_u_a_r_d_:_:_M_P_I_G_u_a_r_d │ │ │ │ │ +MPIGuard(MPIHelper &m, bool active=true) │ │ │ │ │ +create an MPIGuard operating on the Communicator of a special Dune::MPIHelper m │ │ │ │ │ +DDeeffiinniittiioonn mpiguard.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ +A real mpi helper. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:179 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00086.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: variant.hh File Reference │ │ │ │ +dune-common: plocalindex.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,36 +65,67 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces
│ │ │ │ -
variant.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#include <variant>
│ │ │ │ + │ │ │ │ +

Provides classes for use as the local index in ParallelIndexSet for distributed computing. │ │ │ │ +More...

│ │ │ │ +
#include "localindex.hh"
│ │ │ │ +#include "indexset.hh"
│ │ │ │ +#include "mpitraits.hh"
│ │ │ │ +#include <iostream>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::ParallelLocalIndex< T >
 An index present on the local process with an additional attribute flag. More...
 
struct  Dune::LocalIndexComparator< ParallelLocalIndex< T > >
 
class  Dune::MPITraits< ParallelLocalIndex< T > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

template<class T >
std::ostream & Dune::operator<< (std::ostream &os, const ParallelLocalIndex< T > &index)
 Print the local index to a stream.
 
template<typename T >
bool Dune::operator== (const ParallelLocalIndex< T > &p1, const ParallelLocalIndex< T > &p2)
 
template<typename T >
bool Dune::operator!= (const ParallelLocalIndex< T > &p1, const ParallelLocalIndex< T > &p2)
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Provides classes for use as the local index in ParallelIndexSet for distributed computing.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,20 +1,51 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -variant.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ +plocalindex.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ +Provides classes for use as the local index in ParallelIndexSet for distributed │ │ │ │ │ +computing. _M_o_r_e_._._. │ │ │ │ │ +#include "_l_o_c_a_l_i_n_d_e_x_._h_h" │ │ │ │ │ +#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ +#include "_m_p_i_t_r_a_i_t_s_._h_h" │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ +CCllaasssseess │ │ │ │ │ + class   _D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_ _> │ │ │ │ │ +  An index present on the local process with an additional attribute │ │ │ │ │ + flag. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r_<_ _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_<_ _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T │ │ │ │ │ + > &index) │ │ │ │ │ +  Print the local index to a stream. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p1, const │ │ │ │ │ + _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p2) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p1, const │ │ │ │ │ + _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p2) │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Provides classes for use as the local index in ParallelIndexSet for distributed │ │ │ │ │ +computing. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: variant.hh Source File │ │ │ │ +dune-common: plocalindex.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,48 +70,306 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
variant.hh
│ │ │ │ +
plocalindex.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_STD_VARIANT_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_VARIANT_HH
│ │ │ │ -
7
│ │ │ │ -
8#warning dune/common/std/variant.hh is deprecated and will be removed after Dune 2.8.\
│ │ │ │ -
9 Include <variant> instead
│ │ │ │ -
10
│ │ │ │ -
11#include <variant>
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_PLOCALINDEX_HH
│ │ │ │ +
7#define DUNE_PLOCALINDEX_HH
│ │ │ │ +
8
│ │ │ │ +
9#include "localindex.hh"
│ │ │ │ +
10#include "indexset.hh"
│ │ │ │ +
11#include "mpitraits.hh"
│ │ │ │
12
│ │ │ │ -
13namespace Dune {
│ │ │ │ -
14namespace Std {
│ │ │ │ -
15 using std::variant;
│ │ │ │ -
16 using std::visit;
│ │ │ │ -
17 using std::variant_size;
│ │ │ │ -
18 using std::variant_size_v;
│ │ │ │ -
19 using std::get;
│ │ │ │ -
20 using std::get_if;
│ │ │ │ -
21 using std::holds_alternative;
│ │ │ │ -
22 using std::monostate;
│ │ │ │ -
23}
│ │ │ │ -
24}
│ │ │ │ -
25
│ │ │ │ -
26#endif
│ │ │ │ +
13#include <iostream>
│ │ │ │ +
14
│ │ │ │ +
15namespace Dune
│ │ │ │ +
16{
│ │ │ │ +
17
│ │ │ │ +
18
│ │ │ │ +
29 template<class T> class ParallelLocalIndex;
│ │ │ │ +
30
│ │ │ │ +
36 template<class T>
│ │ │ │ +
│ │ │ │ +
37 std::ostream& operator<<(std::ostream& os, const ParallelLocalIndex<T>& index)
│ │ │ │ +
38 {
│ │ │ │ +
39 os<<"{local="<<index.localIndex_<<", attr="<<T(index.attribute_)<<", public="
│ │ │ │ +
40 <<(index.public_ ? true : false)<<"}";
│ │ │ │ +
41 return os;
│ │ │ │ +
42 }
│ │ │ │ +
│ │ │ │ +
43
│ │ │ │ +
47 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
49 {
│ │ │ │ +
50#if HAVE_MPI
│ │ │ │ +
51 // friend declaration needed for MPITraits
│ │ │ │ +
52 friend struct MPITraits<ParallelLocalIndex<T> >;
│ │ │ │ +
53#endif
│ │ │ │ +
54 friend std::ostream& operator<<<>(std::ostream& os, const ParallelLocalIndex<T>& index);
│ │ │ │ +
55
│ │ │ │ +
56 public:
│ │ │ │ +
64 typedef T Attribute;
│ │ │ │ + │ │ │ │ +
74
│ │ │ │ +
83 ParallelLocalIndex(size_t localIndex, const Attribute& attribute, bool isPublic=true);
│ │ │ │ + │ │ │ │ +
90
│ │ │ │ +
91#if 0
│ │ │ │ + │ │ │ │ +
102#endif
│ │ │ │ +
103
│ │ │ │ +
108 inline const Attribute attribute() const;
│ │ │ │ +
109
│ │ │ │ +
114 inline void setAttribute(const Attribute& attribute);
│ │ │ │ +
115
│ │ │ │ +
120 inline size_t local() const;
│ │ │ │ +
121
│ │ │ │ +
125 inline operator size_t() const;
│ │ │ │ +
126
│ │ │ │ +
132 inline ParallelLocalIndex<Attribute>& operator=(size_t index);
│ │ │ │ +
133
│ │ │ │ +
138 inline bool isPublic() const;
│ │ │ │ +
139
│ │ │ │ +
144 inline LocalIndexState state() const;
│ │ │ │ +
145
│ │ │ │ +
150 inline void setState(const LocalIndexState& state);
│ │ │ │ +
151
│ │ │ │ +
152 private:
│ │ │ │ +
154 size_t localIndex_;
│ │ │ │ +
155
│ │ │ │ +
157 char attribute_;
│ │ │ │ +
158
│ │ │ │ +
160 char public_;
│ │ │ │ +
161
│ │ │ │ +
168 char state_;
│ │ │ │ +
169
│ │ │ │ +
170 };
│ │ │ │ +
│ │ │ │ +
171
│ │ │ │ +
172 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
174 const ParallelLocalIndex<T>& p2)
│ │ │ │ +
175 {
│ │ │ │ +
176 if(p1.local()!=p2.local())
│ │ │ │ +
177 return false;
│ │ │ │ +
178 if(p1.attribute()!=p2.attribute())
│ │ │ │ +
179 return false;
│ │ │ │ +
180 if(p1.isPublic()!=p2.isPublic())
│ │ │ │ +
181 return false;
│ │ │ │ +
182 return true;
│ │ │ │ +
183 }
│ │ │ │ +
│ │ │ │ +
184 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
186 const ParallelLocalIndex<T>& p2)
│ │ │ │ +
187 {
│ │ │ │ +
188 return !(p1==p2);
│ │ │ │ +
189 }
│ │ │ │ +
│ │ │ │ +
190
│ │ │ │ +
191
│ │ │ │ +
192 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
194 {
│ │ │ │ +
│ │ │ │ +
195 static bool compare(const ParallelLocalIndex<T>& t1,
│ │ │ │ +
196 const ParallelLocalIndex<T>& t2){
│ │ │ │ +
197 return t1.attribute()<t2.attribute();
│ │ │ │ +
198 }
│ │ │ │ +
│ │ │ │ +
199 };
│ │ │ │ +
│ │ │ │ +
200
│ │ │ │ +
201
│ │ │ │ +
202#if HAVE_MPI
│ │ │ │ +
203
│ │ │ │ +
205 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
207 {
│ │ │ │ +
208 public:
│ │ │ │ +
209 static MPI_Datatype getType();
│ │ │ │ +
210 private:
│ │ │ │ +
211 static MPI_Datatype type;
│ │ │ │ +
212
│ │ │ │ +
213 };
│ │ │ │ +
│ │ │ │ +
214
│ │ │ │ +
215#endif
│ │ │ │ +
216
│ │ │ │ +
217 template<class T>
│ │ │ │ +
│ │ │ │ +
218 ParallelLocalIndex<T>::ParallelLocalIndex(const T& attribute, bool isPublic)
│ │ │ │ +
219 : localIndex_(0), attribute_(static_cast<char>(attribute)),
│ │ │ │ +
220 public_(static_cast<char>(isPublic)), state_(static_cast<char>(VALID))
│ │ │ │ +
221 {}
│ │ │ │ +
│ │ │ │ +
222
│ │ │ │ +
223
│ │ │ │ +
224 template<class T>
│ │ │ │ +
│ │ │ │ +
225 ParallelLocalIndex<T>::ParallelLocalIndex(size_t local, const T& attribute, bool isPublic)
│ │ │ │ +
226 : localIndex_(local), attribute_(static_cast<char>(attribute)),
│ │ │ │ +
227 public_(static_cast<char>(isPublic)), state_(static_cast<char>(VALID))
│ │ │ │ +
228 {}
│ │ │ │ +
│ │ │ │ +
229
│ │ │ │ +
230 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
232 : localIndex_(0), attribute_(), public_(static_cast<char>(false)),
│ │ │ │ +
233 state_(static_cast<char>(VALID))
│ │ │ │ +
234 {}
│ │ │ │ +
│ │ │ │ +
235
│ │ │ │ +
236 template<class T>
│ │ │ │ +
│ │ │ │ +
237 inline const T ParallelLocalIndex<T>::attribute() const
│ │ │ │ +
238 {
│ │ │ │ +
239 return T(attribute_);
│ │ │ │ +
240 }
│ │ │ │ +
│ │ │ │ +
241
│ │ │ │ +
242 template<class T>
│ │ │ │ +
243 inline void
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
245 {
│ │ │ │ +
246 attribute_ = attribute;
│ │ │ │ +
247 }
│ │ │ │ +
│ │ │ │ +
248
│ │ │ │ +
249 template<class T>
│ │ │ │ +
│ │ │ │ +
250 inline size_t ParallelLocalIndex<T>::local() const
│ │ │ │ +
251 {
│ │ │ │ +
252 return localIndex_;
│ │ │ │ +
253 }
│ │ │ │ +
│ │ │ │ +
254
│ │ │ │ +
255 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
257 {
│ │ │ │ +
258 return localIndex_;
│ │ │ │ +
259 }
│ │ │ │ +
│ │ │ │ +
260
│ │ │ │ +
261 template<class T>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
264 {
│ │ │ │ +
265 localIndex_=index;
│ │ │ │ +
266 return *this;
│ │ │ │ +
267 }
│ │ │ │ +
│ │ │ │ +
268
│ │ │ │ +
269 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
271 {
│ │ │ │ +
272 return static_cast<bool>(public_);
│ │ │ │ +
273 }
│ │ │ │ +
│ │ │ │ +
274
│ │ │ │ +
275 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
277 {
│ │ │ │ +
278 return LocalIndexState(state_);
│ │ │ │ +
279 }
│ │ │ │ +
│ │ │ │ +
280
│ │ │ │ +
281 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
283 {
│ │ │ │ +
284 state_=static_cast<char>(state);
│ │ │ │ +
285 }
│ │ │ │ +
│ │ │ │ +
286
│ │ │ │ +
287#if HAVE_MPI
│ │ │ │ +
288
│ │ │ │ +
289 template<typename T>
│ │ │ │ +
│ │ │ │ +
290 MPI_Datatype MPITraits<ParallelLocalIndex<T> >::getType()
│ │ │ │ +
291 {
│ │ │ │ +
292
│ │ │ │ +
293 if(type==MPI_DATATYPE_NULL) {
│ │ │ │ +
294 int length = 1;
│ │ │ │ +
295 MPI_Aint base, disp;
│ │ │ │ +
296 MPI_Datatype types[1] = {MPITraits<char>::getType()};
│ │ │ │ + │ │ │ │ +
298 MPI_Get_address(&rep, &base);
│ │ │ │ +
299 MPI_Get_address(&(rep.attribute_), &disp);
│ │ │ │ +
300 disp -= base;
│ │ │ │ +
301
│ │ │ │ +
302 MPI_Datatype tmp;
│ │ │ │ +
303 MPI_Type_create_struct(1, &length, &disp, types, &tmp);
│ │ │ │ +
304
│ │ │ │ +
305 MPI_Type_create_resized(tmp, 0, sizeof(ParallelLocalIndex<T>), &type);
│ │ │ │ +
306 MPI_Type_commit(&type);
│ │ │ │ +
307
│ │ │ │ +
308 MPI_Type_free(&tmp);
│ │ │ │ +
309 }
│ │ │ │ +
310 return type;
│ │ │ │ +
311 }
│ │ │ │ +
│ │ │ │ +
312
│ │ │ │ +
313 template<typename T>
│ │ │ │ +
314 MPI_Datatype MPITraits<ParallelLocalIndex<T> >::type = MPI_DATATYPE_NULL;
│ │ │ │ +
315
│ │ │ │ +
316#endif
│ │ │ │ +
317
│ │ │ │ +
318
│ │ │ │ +
320} // namespace Dune
│ │ │ │ +
321
│ │ │ │ +
322#endif
│ │ │ │ +
Provides classes for use as the local index in ParallelIndexSet.
│ │ │ │ +
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ +
Provides a map between global and local indices.
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition iteratorfacades.hh:237
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition iteratorfacades.hh:259
│ │ │ │ +
bool isPublic() const
Check whether the index might also be known other processes.
Definition plocalindex.hh:270
│ │ │ │ +
void setAttribute(const Attribute &attribute)
Set the attribute of the index.
Definition plocalindex.hh:244
│ │ │ │ +
size_t local() const
get the local index.
Definition plocalindex.hh:250
│ │ │ │ +
LocalIndexState
The states available for the local indices.
Definition localindex.hh:28
│ │ │ │ +
void setState(const LocalIndexState &state)
Set the state.
Definition plocalindex.hh:282
│ │ │ │ +
ParallelLocalIndex< Attribute > & operator=(size_t index)
Assign a new local index.
Definition plocalindex.hh:263
│ │ │ │ +
LocalIndexState state() const
Get the state.
Definition plocalindex.hh:276
│ │ │ │ +
ParallelLocalIndex()
Parameterless constructor.
Definition plocalindex.hh:231
│ │ │ │ +
const Attribute attribute() const
Get the attribute of the index.
Definition plocalindex.hh:237
│ │ │ │ +
@ VALID
Definition localindex.hh:28
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
│ │ │ │ +
static MPI_Datatype getType()
Definition mpitraits.hh:48
│ │ │ │ +
Definition indexset.hh:615
│ │ │ │ +
An index present on the local process with an additional attribute flag.
Definition plocalindex.hh:49
│ │ │ │ +
T Attribute
The type of the attributes. Normally this will be an enumeration like.
Definition plocalindex.hh:64
│ │ │ │ +
static bool compare(const ParallelLocalIndex< T > &t1, const ParallelLocalIndex< T > &t2)
Definition plocalindex.hh:195
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,42 +1,325 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -variant.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +plocalindex.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_STD_VARIANT_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_VARIANT_HH │ │ │ │ │ -7 │ │ │ │ │ -8#warning dune/common/std/variant.hh is deprecated and will be removed after │ │ │ │ │ -Dune 2.8.\ │ │ │ │ │ -9 Include instead │ │ │ │ │ -10 │ │ │ │ │ -11#include │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_PLOCALINDEX_HH │ │ │ │ │ +7#define DUNE_PLOCALINDEX_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include "_l_o_c_a_l_i_n_d_e_x_._h_h" │ │ │ │ │ +10#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ +11#include "_m_p_i_t_r_a_i_t_s_._h_h" │ │ │ │ │ 12 │ │ │ │ │ -13namespace _D_u_n_e { │ │ │ │ │ -14namespace Std { │ │ │ │ │ -15 using std::variant; │ │ │ │ │ -16 using std::visit; │ │ │ │ │ -17 using std::variant_size; │ │ │ │ │ -18 using std::variant_size_v; │ │ │ │ │ -19 using std::get; │ │ │ │ │ -20 using std::get_if; │ │ │ │ │ -21 using std::holds_alternative; │ │ │ │ │ -22 using std::monostate; │ │ │ │ │ -23} │ │ │ │ │ -24} │ │ │ │ │ -25 │ │ │ │ │ -26#endif │ │ │ │ │ +13#include │ │ │ │ │ +14 │ │ │ │ │ +15namespace _D_u_n_e │ │ │ │ │ +16{ │ │ │ │ │ +17 │ │ │ │ │ +18 │ │ │ │ │ +29 template class ParallelLocalIndex; │ │ │ │ │ +30 │ │ │ │ │ +36 template │ │ │ │ │ +_3_7 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& │ │ │ │ │ +index) │ │ │ │ │ +38 { │ │ │ │ │ +39 os<<"{local="< │ │ │ │ │ +_4_8 class _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +49 { │ │ │ │ │ +50#if HAVE_MPI │ │ │ │ │ +51 // friend declaration needed for MPITraits │ │ │ │ │ +52 friend struct _M_P_I_T_r_a_i_t_s<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x >; │ │ │ │ │ +53#endif │ │ │ │ │ +54 friend std::ostream& operator<<<>(std::ostream& os, const │ │ │ │ │ +_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& index); │ │ │ │ │ +55 │ │ │ │ │ +56 public: │ │ │ │ │ +_6_4 typedef T _A_t_t_r_i_b_u_t_e; │ │ │ │ │ +73 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e, bool _i_s_P_u_b_l_i_c); │ │ │ │ │ +74 │ │ │ │ │ +83 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(size_t localIndex, const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e, bool │ │ │ │ │ +_i_s_P_u_b_l_i_c=true); │ │ │ │ │ +89 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(); │ │ │ │ │ +90 │ │ │ │ │ +91#if 0 │ │ │ │ │ +101 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e, size_t _l_o_c_a_l, bool │ │ │ │ │ +_i_s_P_u_b_l_i_c); │ │ │ │ │ +102#endif │ │ │ │ │ +103 │ │ │ │ │ +108 inline const _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() const; │ │ │ │ │ +109 │ │ │ │ │ +114 inline void _s_e_t_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); │ │ │ │ │ +115 │ │ │ │ │ +120 inline size_t _l_o_c_a_l() const; │ │ │ │ │ +121 │ │ │ │ │ +125 inline operator size_t() const; │ │ │ │ │ +126 │ │ │ │ │ +132 inline _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_A_t_t_r_i_b_u_t_e_>& _o_p_e_r_a_t_o_r_=(size_t index); │ │ │ │ │ +133 │ │ │ │ │ +138 inline bool _i_s_P_u_b_l_i_c() const; │ │ │ │ │ +139 │ │ │ │ │ +144 inline _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _s_t_a_t_e() const; │ │ │ │ │ +145 │ │ │ │ │ +150 inline void _s_e_t_S_t_a_t_e(const _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e& _s_t_a_t_e); │ │ │ │ │ +151 │ │ │ │ │ +152 private: │ │ │ │ │ +154 size_t localIndex_; │ │ │ │ │ +155 │ │ │ │ │ +157 char attribute_; │ │ │ │ │ +158 │ │ │ │ │ +160 char public_; │ │ │ │ │ +161 │ │ │ │ │ +168 char state_; │ │ │ │ │ +169 │ │ │ │ │ +170 }; │ │ │ │ │ +171 │ │ │ │ │ +172 template │ │ │ │ │ +_1_7_3 bool _o_p_e_r_a_t_o_r_=_=(const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p1, │ │ │ │ │ +174 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p2) │ │ │ │ │ +175 { │ │ │ │ │ +176 if(p1._l_o_c_a_l()!=p2._l_o_c_a_l()) │ │ │ │ │ +177 return false; │ │ │ │ │ +178 if(p1._a_t_t_r_i_b_u_t_e()!=p2._a_t_t_r_i_b_u_t_e()) │ │ │ │ │ +179 return false; │ │ │ │ │ +180 if(p1._i_s_P_u_b_l_i_c()!=p2._i_s_P_u_b_l_i_c()) │ │ │ │ │ +181 return false; │ │ │ │ │ +182 return true; │ │ │ │ │ +183 } │ │ │ │ │ +184 template │ │ │ │ │ +_1_8_5 bool _o_p_e_r_a_t_o_r_!_=(const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p1, │ │ │ │ │ +186 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p2) │ │ │ │ │ +187 { │ │ │ │ │ +188 return !(p1==p2); │ │ │ │ │ +189 } │ │ │ │ │ +190 │ │ │ │ │ +191 │ │ │ │ │ +192 template │ │ │ │ │ +_1_9_3 struct _L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x > │ │ │ │ │ +194 { │ │ │ │ │ +_1_9_5 static bool _c_o_m_p_a_r_e(const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& t1, │ │ │ │ │ +196 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& t2){ │ │ │ │ │ +197 return t1._a_t_t_r_i_b_u_t_e() │ │ │ │ │ +_2_0_6 class _M_P_I_T_r_a_i_t_s<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x > │ │ │ │ │ +207 { │ │ │ │ │ +208 public: │ │ │ │ │ +209 static MPI_Datatype _g_e_t_T_y_p_e(); │ │ │ │ │ +210 private: │ │ │ │ │ +211 static MPI_Datatype type; │ │ │ │ │ +212 │ │ │ │ │ +213 }; │ │ │ │ │ +214 │ │ │ │ │ +215#endif │ │ │ │ │ +216 │ │ │ │ │ +217 template │ │ │ │ │ +_2_1_8 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(const T& attribute, bool │ │ │ │ │ +isPublic) │ │ │ │ │ +219 : localIndex_(0), attribute_(static_cast(attribute)), │ │ │ │ │ +220 public_(static_cast(isPublic)), state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ +221 {} │ │ │ │ │ +222 │ │ │ │ │ +223 │ │ │ │ │ +224 template │ │ │ │ │ +_2_2_5 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(size_t local, const T& attribute, │ │ │ │ │ +bool isPublic) │ │ │ │ │ +226 : localIndex_(local), attribute_(static_cast(attribute)), │ │ │ │ │ +227 public_(static_cast(isPublic)), state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ +228 {} │ │ │ │ │ +229 │ │ │ │ │ +230 template │ │ │ │ │ +_2_3_1 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x() │ │ │ │ │ +232 : localIndex_(0), attribute_(), public_(static_cast(false)), │ │ │ │ │ +233 state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ +234 {} │ │ │ │ │ +235 │ │ │ │ │ +236 template │ │ │ │ │ +_2_3_7 inline const T _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_a_t_t_r_i_b_u_t_e() const │ │ │ │ │ +238 { │ │ │ │ │ +239 return T(attribute_); │ │ │ │ │ +240 } │ │ │ │ │ +241 │ │ │ │ │ +242 template │ │ │ │ │ +243 inline void │ │ │ │ │ +_2_4_4 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_s_e_t_A_t_t_r_i_b_u_t_e(const _A_t_t_r_i_b_u_t_e& attribute) │ │ │ │ │ +245 { │ │ │ │ │ +246 attribute_ = attribute; │ │ │ │ │ +247 } │ │ │ │ │ +248 │ │ │ │ │ +249 template │ │ │ │ │ +_2_5_0 inline size_t _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_l_o_c_a_l() const │ │ │ │ │ +251 { │ │ │ │ │ +252 return localIndex_; │ │ │ │ │ +253 } │ │ │ │ │ +254 │ │ │ │ │ +255 template │ │ │ │ │ +_2_5_6 inline _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_o_p_e_r_a_t_o_r size_t() const │ │ │ │ │ +257 { │ │ │ │ │ +258 return localIndex_; │ │ │ │ │ +259 } │ │ │ │ │ +260 │ │ │ │ │ +261 template │ │ │ │ │ +262 inline _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& │ │ │ │ │ +_2_6_3 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_o_p_e_r_a_t_o_r_=(size_t index) │ │ │ │ │ +264 { │ │ │ │ │ +265 localIndex_=index; │ │ │ │ │ +266 return *this; │ │ │ │ │ +267 } │ │ │ │ │ +268 │ │ │ │ │ +269 template │ │ │ │ │ +_2_7_0 inline bool _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_i_s_P_u_b_l_i_c() const │ │ │ │ │ +271 { │ │ │ │ │ +272 return static_cast(public_); │ │ │ │ │ +273 } │ │ │ │ │ +274 │ │ │ │ │ +275 template │ │ │ │ │ +_2_7_6 inline _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_s_t_a_t_e() const │ │ │ │ │ +277 { │ │ │ │ │ +278 return _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e(state_); │ │ │ │ │ +279 } │ │ │ │ │ +280 │ │ │ │ │ +281 template │ │ │ │ │ +_2_8_2 inline void _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_s_e_t_S_t_a_t_e(const _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e& state) │ │ │ │ │ +283 { │ │ │ │ │ +284 state_=static_cast(state); │ │ │ │ │ +285 } │ │ │ │ │ +286 │ │ │ │ │ +287#if HAVE_MPI │ │ │ │ │ +288 │ │ │ │ │ +289 template │ │ │ │ │ +_2_9_0 MPI_Datatype _M_P_I_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_> >::getType() │ │ │ │ │ +291 { │ │ │ │ │ +292 │ │ │ │ │ +293 if(type==MPI_DATATYPE_NULL) { │ │ │ │ │ +294 int length = 1; │ │ │ │ │ +295 MPI_Aint base, disp; │ │ │ │ │ +296 MPI_Datatype types[1] = {_M_P_I_T_r_a_i_t_s_<_c_h_a_r_>_:_:_g_e_t_T_y_p_e()}; │ │ │ │ │ +297 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_> rep; │ │ │ │ │ +298 MPI_Get_address(&rep, &base); │ │ │ │ │ +299 MPI_Get_address(&(rep.attribute_), &disp); │ │ │ │ │ +300 disp -= base; │ │ │ │ │ +301 │ │ │ │ │ +302 MPI_Datatype tmp; │ │ │ │ │ +303 MPI_Type_create_struct(1, &length, &disp, types, &tmp); │ │ │ │ │ +304 │ │ │ │ │ +305 MPI_Type_create_resized(tmp, 0, sizeof(_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>), &type); │ │ │ │ │ +306 MPI_Type_commit(&type); │ │ │ │ │ +307 │ │ │ │ │ +308 MPI_Type_free(&tmp); │ │ │ │ │ +309 } │ │ │ │ │ +310 return type; │ │ │ │ │ +311 } │ │ │ │ │ +312 │ │ │ │ │ +313 template │ │ │ │ │ +_3_1_4 MPI_Datatype _M_P_I_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_> >::type = MPI_DATATYPE_NULL; │ │ │ │ │ +315 │ │ │ │ │ +316#endif │ │ │ │ │ +317 │ │ │ │ │ +318 │ │ │ │ │ +320} // namespace Dune │ │ │ │ │ +321 │ │ │ │ │ +322#endif │ │ │ │ │ +_l_o_c_a_l_i_n_d_e_x_._h_h │ │ │ │ │ +Provides classes for use as the local index in ParallelIndexSet. │ │ │ │ │ +_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ +_i_n_d_e_x_s_e_t_._h_h │ │ │ │ │ +Provides a map between global and local indices. │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for equality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for inequality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_i_s_P_u_b_l_i_c │ │ │ │ │ +bool isPublic() const │ │ │ │ │ +Check whether the index might also be known other processes. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:270 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_s_e_t_A_t_t_r_i_b_u_t_e │ │ │ │ │ +void setAttribute(const Attribute &attribute) │ │ │ │ │ +Set the attribute of the index. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:244 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_l_o_c_a_l │ │ │ │ │ +size_t local() const │ │ │ │ │ +get the local index. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_S_t_a_t_e │ │ │ │ │ +LocalIndexState │ │ │ │ │ +The states available for the local indices. │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_s_e_t_S_t_a_t_e │ │ │ │ │ +void setState(const LocalIndexState &state) │ │ │ │ │ +Set the state. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +ParallelLocalIndex< Attribute > & operator=(size_t index) │ │ │ │ │ +Assign a new local index. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_s_t_a_t_e │ │ │ │ │ +LocalIndexState state() const │ │ │ │ │ +Get the state. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +ParallelLocalIndex() │ │ │ │ │ +Parameterless constructor. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:231 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ │ +const Attribute attribute() const │ │ │ │ │ +Get the attribute of the index. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_V_A_L_I_D │ │ │ │ │ +@ VALID │ │ │ │ │ +DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s │ │ │ │ │ +A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ +DDeeffiinniittiioonn mpitraits.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_:_:_g_e_t_T_y_p_e │ │ │ │ │ +static MPI_Datatype getType() │ │ │ │ │ +DDeeffiinniittiioonn mpitraits.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:615 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +An index present on the local process with an additional attribute flag. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ +T Attribute │ │ │ │ │ +The type of the attributes. Normally this will be an enumeration like. │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r_<_ _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_ _>_ _>_:_:_c_o_m_p_a_r_e │ │ │ │ │ +static bool compare(const ParallelLocalIndex< T > &t1, const │ │ │ │ │ +ParallelLocalIndex< T > &t2) │ │ │ │ │ +DDeeffiinniittiioonn plocalindex.hh:195 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00089.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: functional.hh File Reference │ │ │ │ +dune-common: future.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,42 +65,48 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
functional.hh File Reference
│ │ │ │ +
future.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <functional>
│ │ │ │ +
#include <memory>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Std::identity
 A function object type whose operator() returns its argument unchanged. More...
class  Dune::InvalidFutureException
 This exception is thrown when ready(), wait() or get() is called on an invalid future. A future is valid until get() is called and if it is not default-constructed and it was not moved from. More...
 
class  Dune::Future< T >
 Type-erasure for future-like objects. A future-like object is a object satisfying the interface of FutureBase. More...
 
class  Dune::PseudoFuture< T >
 A wrapper-class for a object which is ready immediately. More...
 
class  Dune::PseudoFuture< void >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,25 +1,33 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -functional.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +future.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_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 │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_d_:_:_i_d_e_n_t_i_t_y │ │ │ │ │ -  A function object type whose operator() returns its argument │ │ │ │ │ - unchanged. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ + This exception is thrown when ready(), wait() or get() is called on an │ │ │ │ │ +  invalid future. A future is valid until get() is called and if it is │ │ │ │ │ + not default-constructed and it was not moved from. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_F_u_t_u_r_e_<_ _T_ _> │ │ │ │ │ +  Type-erasure for future-like objects. A future-like object is a object │ │ │ │ │ + satisfying the interface of FutureBase. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _T_ _> │ │ │ │ │ +  A wrapper-class for a object which is ready immediately. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: functional.hh Source File │ │ │ │ +dune-common: future.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,54 +70,254 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
functional.hh
│ │ │ │ +
future.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ -
2// vi: set ts=8 sw=2 et sts=2:
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_FUNCTIONAL_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_PARALLEL_FUTURE_HH
│ │ │ │ +
6#define DUNE_COMMON_PARALLEL_FUTURE_HH
│ │ │ │
7
│ │ │ │ -
8#include <functional>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune
│ │ │ │ -
11{
│ │ │ │ +
8#include <memory>
│ │ │ │ + │ │ │ │ +
10
│ │ │ │ +
11namespace Dune{
│ │ │ │
12
│ │ │ │ -
13 namespace Std
│ │ │ │ -
14 {
│ │ │ │ -
15
│ │ │ │ -
22#if DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ -
23 using std::identity;
│ │ │ │ -
24#else //DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ -
│ │ │ │ -
25 struct identity {
│ │ │ │ -
26 template<class T>
│ │ │ │ -
27 constexpr T&& operator()(T&& t ) const noexcept {return std::forward<T>(t);}
│ │ │ │ -
28 };
│ │ │ │ -
│ │ │ │ -
29#endif
│ │ │ │ -
30 } // namespace Std
│ │ │ │ -
31
│ │ │ │ -
32} // namespace Dune
│ │ │ │ -
33
│ │ │ │ -
34#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
18 {};
│ │ │ │ +
│ │ │ │ +
19
│ │ │ │ +
20 // forward declaration
│ │ │ │ +
21 template<class T>
│ │ │ │ +
22 class PseudoFuture;
│ │ │ │ +
23
│ │ │ │ +
27 template<class T>
│ │ │ │ +
│ │ │ │ +
28 class Future{
│ │ │ │ +
29 // Future interface:
│ │ │ │ +
30 class FutureBase{
│ │ │ │ +
31 public:
│ │ │ │ +
32 virtual ~FutureBase() = default;
│ │ │ │ +
33 virtual void wait() = 0;
│ │ │ │ +
34 virtual bool ready() const = 0;
│ │ │ │ +
35 virtual bool valid() const = 0;
│ │ │ │ +
36 virtual T get() = 0;
│ │ │ │ +
37 };
│ │ │ │ +
38
│ │ │ │ +
39 // model class
│ │ │ │ +
40 template<class F>
│ │ │ │ +
41 class FutureModel
│ │ │ │ +
42 : public FutureBase
│ │ │ │ +
43 {
│ │ │ │ +
44 F _future;
│ │ │ │ +
45 public:
│ │ │ │ +
46 FutureModel(F&& f)
│ │ │ │ +
47 : _future(std::forward<F>(f))
│ │ │ │ +
48 {}
│ │ │ │ +
49
│ │ │ │ +
50 virtual void wait() override
│ │ │ │ +
51 {
│ │ │ │ +
52 _future.wait();
│ │ │ │ +
53 }
│ │ │ │ +
54
│ │ │ │ +
55 virtual bool ready() const override
│ │ │ │ +
56 {
│ │ │ │ +
57 return _future.ready();
│ │ │ │ +
58 }
│ │ │ │ +
59
│ │ │ │ +
60 virtual bool valid() const override
│ │ │ │ +
61 {
│ │ │ │ +
62 return _future.valid();
│ │ │ │ +
63 }
│ │ │ │ +
64
│ │ │ │ +
65 virtual T get() override{
│ │ │ │ +
66 return (T)_future.get();
│ │ │ │ +
67 }
│ │ │ │ +
68 };
│ │ │ │ +
69
│ │ │ │ +
70 std::unique_ptr<FutureBase> _future;
│ │ │ │ +
71 public:
│ │ │ │ +
72 template<class F>
│ │ │ │ +
│ │ │ │ +
73 Future(F&& f)
│ │ │ │ +
74 : _future(std::make_unique<FutureModel<F>>(std::forward<F>(f)))
│ │ │ │ +
75 {}
│ │ │ │ +
│ │ │ │ +
76
│ │ │ │ +
77 template<class U, std::enable_if_t<std::is_same<U,T>::value && !std::is_same<T,void>::value>>
│ │ │ │ +
│ │ │ │ +
78 Future(U&& data)
│ │ │ │ +
79 : _future(std::make_unique<FutureModel<PseudoFuture<T>>>(PseudoFuture<T>(std::forward<U>(data))))
│ │ │ │ +
80 {}
│ │ │ │ +
│ │ │ │ +
81
│ │ │ │ +
82 Future() = default;
│ │ │ │ +
83
│ │ │ │ +
│ │ │ │ +
87 void wait(){
│ │ │ │ +
88 _future->wait();
│ │ │ │ +
89 }
│ │ │ │ +
│ │ │ │ +
90
│ │ │ │ +
│ │ │ │ +
95 T get() {
│ │ │ │ +
96 return _future->get();
│ │ │ │ +
97 }
│ │ │ │ +
│ │ │ │ +
98
│ │ │ │ +
│ │ │ │ +
103 bool ready() const {
│ │ │ │ +
104 return _future->ready();
│ │ │ │ +
105 }
│ │ │ │ +
│ │ │ │ +
106
│ │ │ │ +
│ │ │ │ +
112 bool valid() const {
│ │ │ │ +
113 if(_future)
│ │ │ │ +
114 return _future->valid();
│ │ │ │ +
115 return false;
│ │ │ │ +
116 }
│ │ │ │ +
│ │ │ │ +
117 };
│ │ │ │ +
│ │ │ │ +
118
│ │ │ │ +
121 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
123 bool valid_;
│ │ │ │ +
124 T data_;
│ │ │ │ +
125 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
127 valid_(false)
│ │ │ │ +
128 {}
│ │ │ │ +
│ │ │ │ +
129
│ │ │ │ +
130 template<class U>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
132 valid_(true),
│ │ │ │ +
133 data_(std::forward<U>(u))
│ │ │ │ +
134 {}
│ │ │ │ +
│ │ │ │ +
135
│ │ │ │ +
│ │ │ │ +
136 void wait() {
│ │ │ │ +
137 if(!valid_)
│ │ │ │ +
138 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ +
139 }
│ │ │ │ +
│ │ │ │ +
140
│ │ │ │ +
│ │ │ │ +
141 bool ready() const {
│ │ │ │ +
142 if(!valid_)
│ │ │ │ +
143 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ +
144 return true;
│ │ │ │ +
145 }
│ │ │ │ +
│ │ │ │ +
146
│ │ │ │ +
│ │ │ │ +
147 T get() {
│ │ │ │ +
148 if(!valid_)
│ │ │ │ +
149 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ +
150 valid_ = false;
│ │ │ │ +
151 return std::forward<T>(data_);
│ │ │ │ +
152 }
│ │ │ │ +
│ │ │ │ +
153
│ │ │ │ +
│ │ │ │ +
154 bool valid() const {
│ │ │ │ +
155 return valid_;
│ │ │ │ +
156 }
│ │ │ │ +
│ │ │ │ +
157 };
│ │ │ │ +
│ │ │ │ +
158
│ │ │ │ +
159 template<>
│ │ │ │ +
│ │ │ │ +
160 class PseudoFuture<void>{
│ │ │ │ +
161 bool valid_;
│ │ │ │ +
162 public:
│ │ │ │ +
│ │ │ │ +
163 PseudoFuture(bool valid = false) :
│ │ │ │ +
164 valid_(valid)
│ │ │ │ +
165 {}
│ │ │ │ +
│ │ │ │ +
166
│ │ │ │ +
│ │ │ │ +
167 void wait(){
│ │ │ │ +
168 if(!valid_)
│ │ │ │ +
169 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ +
170 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
171 bool ready() const{
│ │ │ │ +
172 if(!valid_)
│ │ │ │ +
173 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ +
174 return true;
│ │ │ │ +
175 }
│ │ │ │ +
│ │ │ │ +
176
│ │ │ │ +
│ │ │ │ +
177 void get(){
│ │ │ │ +
178 if(!valid_)
│ │ │ │ +
179 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ +
180 valid_ = false;
│ │ │ │ +
181 }
│ │ │ │ +
│ │ │ │ +
182
│ │ │ │ +
│ │ │ │ +
183 bool valid() const{
│ │ │ │ +
184 return valid_;
│ │ │ │ +
185 }
│ │ │ │ +
│ │ │ │ +
186 };
│ │ │ │ +
│ │ │ │ +
187}
│ │ │ │ +
188
│ │ │ │ +
189#endif
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
A function object type whose operator() returns its argument unchanged.
Definition functional.hh:25
│ │ │ │ -
constexpr T && operator()(T &&t) const noexcept
Definition functional.hh:27
│ │ │ │ +
Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
Definition propertymap.hh:84
│ │ │ │ +
Default exception if a function was called while the object is not in a valid state for that function...
Definition exceptions.hh:281
│ │ │ │ +
This exception is thrown when ready(), wait() or get() is called on an invalid future....
Definition future.hh:18
│ │ │ │ +
A wrapper-class for a object which is ready immediately.
Definition future.hh:122
│ │ │ │ +
bool ready() const
Definition future.hh:141
│ │ │ │ +
T get()
Definition future.hh:147
│ │ │ │ +
PseudoFuture(U &&u)
Definition future.hh:131
│ │ │ │ +
PseudoFuture()
Definition future.hh:126
│ │ │ │ +
void wait()
Definition future.hh:136
│ │ │ │ +
bool valid() const
Definition future.hh:154
│ │ │ │ +
Type-erasure for future-like objects. A future-like object is a object satisfying the interface of Fu...
Definition future.hh:28
│ │ │ │ +
bool ready() const
Definition future.hh:103
│ │ │ │ +
void wait()
wait until the future is ready
Definition future.hh:87
│ │ │ │ +
Future(U &&data)
Definition future.hh:78
│ │ │ │ +
T get()
Waits until the future is ready and returns the resulting value.
Definition future.hh:95
│ │ │ │ +
Future()=default
│ │ │ │ +
bool valid() const
Checks whether the future is valid. I.e. ‘get()’ was not called on that future and when it was not de...
Definition future.hh:112
│ │ │ │ +
Future(F &&f)
Definition future.hh:73
│ │ │ │ +
bool ready() const
Definition future.hh:171
│ │ │ │ +
bool valid() const
Definition future.hh:183
│ │ │ │ +
void get()
Definition future.hh:177
│ │ │ │ +
PseudoFuture(bool valid=false)
Definition future.hh:163
│ │ │ │ +
void wait()
Definition future.hh:167
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,49 +1,264 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -functional.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +future.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// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set ts=8 sw=2 et sts=2: │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_PARALLEL_FUTURE_HH │ │ │ │ │ +6#define DUNE_COMMON_PARALLEL_FUTURE_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10namespace _D_u_n_e │ │ │ │ │ -11{ │ │ │ │ │ +8#include │ │ │ │ │ +9#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e{ │ │ │ │ │ 12 │ │ │ │ │ -13 namespace Std │ │ │ │ │ -14 { │ │ │ │ │ -15 │ │ │ │ │ -22#if DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ -23 using std::identity; │ │ │ │ │ -24#else //DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ -_2_5 struct _i_d_e_n_t_i_t_y { │ │ │ │ │ -26 template │ │ │ │ │ -_2_7 constexpr T&& _o_p_e_r_a_t_o_r_(_)(T&& t ) const noexcept {return std::forward(t);} │ │ │ │ │ -28 }; │ │ │ │ │ -29#endif │ │ │ │ │ -30 } // namespace Std │ │ │ │ │ -31 │ │ │ │ │ -32} // namespace Dune │ │ │ │ │ -33 │ │ │ │ │ -34#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ +_1_7 class _I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n : public _I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ +18 {}; │ │ │ │ │ +19 │ │ │ │ │ +20 // forward declaration │ │ │ │ │ +21 template │ │ │ │ │ +22 class _P_s_e_u_d_o_F_u_t_u_r_e; │ │ │ │ │ +23 │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 class _F_u_t_u_r_e{ │ │ │ │ │ +29 // Future interface: │ │ │ │ │ +30 class FutureBase{ │ │ │ │ │ +31 public: │ │ │ │ │ +32 virtual ~FutureBase() = default; │ │ │ │ │ +33 virtual void wait() = 0; │ │ │ │ │ +34 virtual bool ready() const = 0; │ │ │ │ │ +35 virtual bool valid() const = 0; │ │ │ │ │ +36 virtual T _g_e_t() = 0; │ │ │ │ │ +37 }; │ │ │ │ │ +38 │ │ │ │ │ +39 // model class │ │ │ │ │ +40 template │ │ │ │ │ +41 class FutureModel │ │ │ │ │ +42 : public FutureBase │ │ │ │ │ +43 { │ │ │ │ │ +44 F _future; │ │ │ │ │ +45 public: │ │ │ │ │ +46 FutureModel(F&& f) │ │ │ │ │ +47 : _future(std::forward(f)) │ │ │ │ │ +48 {} │ │ │ │ │ +49 │ │ │ │ │ +50 virtual void wait() override │ │ │ │ │ +51 { │ │ │ │ │ +52 _future.wait(); │ │ │ │ │ +53 } │ │ │ │ │ +54 │ │ │ │ │ +55 virtual bool ready() const override │ │ │ │ │ +56 { │ │ │ │ │ +57 return _future.ready(); │ │ │ │ │ +58 } │ │ │ │ │ +59 │ │ │ │ │ +60 virtual bool valid() const override │ │ │ │ │ +61 { │ │ │ │ │ +62 return _future.valid(); │ │ │ │ │ +63 } │ │ │ │ │ +64 │ │ │ │ │ +65 virtual T _g_e_t() override{ │ │ │ │ │ +66 return (T)_future.get(); │ │ │ │ │ +67 } │ │ │ │ │ +68 }; │ │ │ │ │ +69 │ │ │ │ │ +70 std::unique_ptr _future; │ │ │ │ │ +71 public: │ │ │ │ │ +72 template │ │ │ │ │ +_7_3 _F_u_t_u_r_e(F&& f) │ │ │ │ │ +74 : _future(_s_t_d::make_unique>(_s_t_d::forward(f))) │ │ │ │ │ +75 {} │ │ │ │ │ +76 │ │ │ │ │ +77 template::value && !std:: │ │ │ │ │ +is_same::value>> │ │ │ │ │ +_7_8 _F_u_t_u_r_e(U&& data) │ │ │ │ │ +79 : _future(_s_t_d::make_unique>>(_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ +(_s_t_d::forward(data)))) │ │ │ │ │ +80 {} │ │ │ │ │ +81 │ │ │ │ │ +_8_2 _F_u_t_u_r_e() = default; │ │ │ │ │ +83 │ │ │ │ │ +_8_7 void _w_a_i_t(){ │ │ │ │ │ +88 _future->wait(); │ │ │ │ │ +89 } │ │ │ │ │ +90 │ │ │ │ │ +_9_5 T _g_e_t() { │ │ │ │ │ +96 return _future->get(); │ │ │ │ │ +97 } │ │ │ │ │ +98 │ │ │ │ │ +_1_0_3 bool _r_e_a_d_y() const { │ │ │ │ │ +104 return _future->ready(); │ │ │ │ │ +105 } │ │ │ │ │ +106 │ │ │ │ │ +_1_1_2 bool _v_a_l_i_d() const { │ │ │ │ │ +113 if(_future) │ │ │ │ │ +114 return _future->valid(); │ │ │ │ │ +115 return false; │ │ │ │ │ +116 } │ │ │ │ │ +117 }; │ │ │ │ │ +118 │ │ │ │ │ +121 template │ │ │ │ │ +_1_2_2 class _P_s_e_u_d_o_F_u_t_u_r_e{ │ │ │ │ │ +123 bool valid_; │ │ │ │ │ +124 T data_; │ │ │ │ │ +125 public: │ │ │ │ │ +_1_2_6 _P_s_e_u_d_o_F_u_t_u_r_e() : │ │ │ │ │ +127 valid_(false) │ │ │ │ │ +128 {} │ │ │ │ │ +129 │ │ │ │ │ +130 template │ │ │ │ │ +_1_3_1 _P_s_e_u_d_o_F_u_t_u_r_e(U&& u) : │ │ │ │ │ +132 valid_(true), │ │ │ │ │ +133 data_(_s_t_d::forward(u)) │ │ │ │ │ +134 {} │ │ │ │ │ +135 │ │ │ │ │ +_1_3_6 void _w_a_i_t() { │ │ │ │ │ +137 if(!valid_) │ │ │ │ │ +138 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ +139 } │ │ │ │ │ +140 │ │ │ │ │ +_1_4_1 bool _r_e_a_d_y() const { │ │ │ │ │ +142 if(!valid_) │ │ │ │ │ +143 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ +144 return true; │ │ │ │ │ +145 } │ │ │ │ │ +146 │ │ │ │ │ +_1_4_7 T _g_e_t() { │ │ │ │ │ +148 if(!valid_) │ │ │ │ │ +149 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ +150 valid_ = false; │ │ │ │ │ +151 return std::forward(data_); │ │ │ │ │ +152 } │ │ │ │ │ +153 │ │ │ │ │ +_1_5_4 bool _v_a_l_i_d() const { │ │ │ │ │ +155 return valid_; │ │ │ │ │ +156 } │ │ │ │ │ +157 }; │ │ │ │ │ +158 │ │ │ │ │ +159 template<> │ │ │ │ │ +_1_6_0 class _P_s_e_u_d_o_F_u_t_u_r_e{ │ │ │ │ │ +161 bool valid_; │ │ │ │ │ +162 public: │ │ │ │ │ +_1_6_3 _P_s_e_u_d_o_F_u_t_u_r_e(bool _v_a_l_i_d = false) : │ │ │ │ │ +164 valid_(_v_a_l_i_d) │ │ │ │ │ +165 {} │ │ │ │ │ +166 │ │ │ │ │ +_1_6_7 void _w_a_i_t(){ │ │ │ │ │ +168 if(!valid_) │ │ │ │ │ +169 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ +170 } │ │ │ │ │ +_1_7_1 bool _r_e_a_d_y() const{ │ │ │ │ │ +172 if(!valid_) │ │ │ │ │ +173 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ +174 return true; │ │ │ │ │ +175 } │ │ │ │ │ +176 │ │ │ │ │ +_1_7_7 void _g_e_t(){ │ │ │ │ │ +178 if(!valid_) │ │ │ │ │ +179 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ +180 valid_ = false; │ │ │ │ │ +181 } │ │ │ │ │ +182 │ │ │ │ │ +_1_8_3 bool _v_a_l_i_d() const{ │ │ │ │ │ +184 return valid_; │ │ │ │ │ +185 } │ │ │ │ │ +186 }; │ │ │ │ │ +187} │ │ │ │ │ +188 │ │ │ │ │ +189#endif │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_d_e_n_t_i_t_y │ │ │ │ │ -A function object type whose operator() returns its argument unchanged. │ │ │ │ │ -DDeeffiinniittiioonn functional.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_d_e_n_t_i_t_y_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -constexpr T && operator()(T &&t) const noexcept │ │ │ │ │ -DDeeffiinniittiioonn functional.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ │ +Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const │ │ │ │ │ +Key &key) │ │ │ │ │ +DDeeffiinniittiioonn propertymap.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ +Default exception if a function was called while the object is not in a valid │ │ │ │ │ +state for that function... │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ +This exception is thrown when ready(), wait() or get() is called on an invalid │ │ │ │ │ +future.... │ │ │ │ │ +DDeeffiinniittiioonn future.hh:18 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ +A wrapper-class for a object which is ready immediately. │ │ │ │ │ +DDeeffiinniittiioonn future.hh:122 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ +bool ready() const │ │ │ │ │ +DDeeffiinniittiioonn future.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ +T get() │ │ │ │ │ +DDeeffiinniittiioonn future.hh:147 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ +PseudoFuture(U &&u) │ │ │ │ │ +DDeeffiinniittiioonn future.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ +PseudoFuture() │ │ │ │ │ +DDeeffiinniittiioonn future.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_w_a_i_t │ │ │ │ │ +void wait() │ │ │ │ │ +DDeeffiinniittiioonn future.hh:136 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_v_a_l_i_d │ │ │ │ │ +bool valid() const │ │ │ │ │ +DDeeffiinniittiioonn future.hh:154 │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e │ │ │ │ │ +Type-erasure for future-like objects. A future-like object is a object │ │ │ │ │ +satisfying the interface of Fu... │ │ │ │ │ +DDeeffiinniittiioonn future.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ +bool ready() const │ │ │ │ │ +DDeeffiinniittiioonn future.hh:103 │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e_:_:_w_a_i_t │ │ │ │ │ +void wait() │ │ │ │ │ +wait until the future is ready │ │ │ │ │ +DDeeffiinniittiioonn future.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ +Future(U &&data) │ │ │ │ │ +DDeeffiinniittiioonn future.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ +T get() │ │ │ │ │ +Waits until the future is ready and returns the resulting value. │ │ │ │ │ +DDeeffiinniittiioonn future.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ +Future()=default │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e_:_:_v_a_l_i_d │ │ │ │ │ +bool valid() const │ │ │ │ │ +Checks whether the future is valid. I.e. ‘get()’ was not called on that │ │ │ │ │ +future and when it was not de... │ │ │ │ │ +DDeeffiinniittiioonn future.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ +Future(F &&f) │ │ │ │ │ +DDeeffiinniittiioonn future.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_r_e_a_d_y │ │ │ │ │ +bool ready() const │ │ │ │ │ +DDeeffiinniittiioonn future.hh:171 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_v_a_l_i_d │ │ │ │ │ +bool valid() const │ │ │ │ │ +DDeeffiinniittiioonn future.hh:183 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_g_e_t │ │ │ │ │ +void get() │ │ │ │ │ +DDeeffiinniittiioonn future.hh:177 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ +PseudoFuture(bool valid=false) │ │ │ │ │ +DDeeffiinniittiioonn future.hh:163 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_w_a_i_t │ │ │ │ │ +void wait() │ │ │ │ │ +DDeeffiinniittiioonn future.hh:167 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00092.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: apply.hh File Reference │ │ │ │ +dune-common: selection.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,36 +65,53 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces
│ │ │ │ -
apply.hh File Reference
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ -
#include <tuple>
│ │ │ │ + │ │ │ │ +

Provides classes for selecting indices based on attribute flags. │ │ │ │ +More...

│ │ │ │ +
#include "indexset.hh"
│ │ │ │ +#include <dune/common/iteratorfacades.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::SelectionIterator< TS, TG, TL, N >
 A const iterator over an uncached selection. More...
 
class  Dune::UncachedSelection< TS, TG, TL, N >
 An uncached selection of indices. More...
 
class  Dune::Selection< TS, TG, TL, N >
 A cached selection of indices. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Provides classes for selecting indices based on attribute flags.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,20 +1,34 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -apply.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +selection.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ +Provides classes for selecting indices based on attribute flags. _M_o_r_e_._._. │ │ │ │ │ +#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_t_e_r_a_t_o_r_f_a_c_a_d_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_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_ _T_S_,_ _T_G_,_ _T_L_,_ _N_ _> │ │ │ │ │ +  A const iterator over an uncached selection. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_<_ _T_S_,_ _T_G_,_ _T_L_,_ _N_ _> │ │ │ │ │ +  An uncached selection of indices. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_<_ _T_S_,_ _T_G_,_ _T_L_,_ _N_ _> │ │ │ │ │ +  A cached selection of indices. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Provides classes for selecting indices based on attribute flags. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: apply.hh Source File │ │ │ │ +dune-common: selection.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,44 +70,322 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
apply.hh
│ │ │ │ +
selection.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_STD_APPLY_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_APPLY_HH
│ │ │ │ +
5#ifndef DUNE_SELECTION_HH
│ │ │ │ +
6#define DUNE_SELECTION_HH
│ │ │ │
7
│ │ │ │ -
8#include <tuple>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune
│ │ │ │ -
11{
│ │ │ │ -
│ │ │ │ -
12 namespace Std
│ │ │ │ -
13 {
│ │ │ │ -
14
│ │ │ │ -
17 using std::apply;
│ │ │ │ -
18
│ │ │ │ -
19 } // namespace Std
│ │ │ │ -
│ │ │ │ -
20} // namespace Dune
│ │ │ │ -
21
│ │ │ │ -
22#endif // #ifndef DUNE_COMMON_STD_APPLY_HH
│ │ │ │ +
8#include "indexset.hh"
│ │ │ │ + │ │ │ │ +
10
│ │ │ │ +
11namespace Dune
│ │ │ │ +
12{
│ │ │ │ +
27 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
29 {
│ │ │ │ +
30 public:
│ │ │ │ +
39 typedef TS AttributeSet;
│ │ │ │ +
40
│ │ │ │ + │ │ │ │ +
45
│ │ │ │ +
46 //typedef typename ParallelIndexSet::const_iterator ParallelIndexSetIterator;
│ │ │ │ +
47
│ │ │ │ +
48 typedef ConstArrayListIterator<IndexPair<TG,TL>, N, std::allocator<Dune::IndexPair<TG,TL> > > ParallelIndexSetIterator;
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
55 : iter_(iter), end_(end)
│ │ │ │ +
56 {
│ │ │ │ +
57 // Step to the first valid entry
│ │ │ │ +
58 while(iter_!=end_ && !AttributeSet::contains(iter_->local().attribute()))
│ │ │ │ +
59 ++iter_;
│ │ │ │ +
60 }
│ │ │ │ +
│ │ │ │ +
61
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
63 {
│ │ │ │ +
64 assert(iter_!=end_);
│ │ │ │ +
65 for(++iter_; iter_!=end_; ++iter_)
│ │ │ │ +
66 if(AttributeSet::contains(iter_->local().attribute()))
│ │ │ │ +
67 break;
│ │ │ │ +
68 }
│ │ │ │ +
│ │ │ │ +
69
│ │ │ │ +
70
│ │ │ │ +
│ │ │ │ +
71 uint32_t operator*() const
│ │ │ │ +
72 {
│ │ │ │ +
73 return iter_->local().local();
│ │ │ │ +
74 }
│ │ │ │ +
│ │ │ │ +
75
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
77 {
│ │ │ │ +
78 return iter_ == other.iter_;
│ │ │ │ +
79 }
│ │ │ │ +
│ │ │ │ +
80
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
82 {
│ │ │ │ +
83 return iter_ != other.iter_;
│ │ │ │ +
84 }
│ │ │ │ +
│ │ │ │ +
85
│ │ │ │ +
86 private:
│ │ │ │ + │ │ │ │ +
88 const ParallelIndexSetIterator end_;
│ │ │ │ +
89 };
│ │ │ │ +
│ │ │ │ +
90
│ │ │ │ +
91
│ │ │ │ +
95 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
97 {
│ │ │ │ +
98 public:
│ │ │ │ +
107 typedef TS AttributeSet;
│ │ │ │ +
108
│ │ │ │ +
112 typedef TG GlobalIndex;
│ │ │ │ +
113
│ │ │ │ +
120 typedef TL LocalIndex;
│ │ │ │ +
121
│ │ │ │ + │ │ │ │ +
126
│ │ │ │ + │ │ │ │ +
131
│ │ │ │ + │ │ │ │ +
136
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
138 : indexSet_()
│ │ │ │ +
139 {}
│ │ │ │ +
│ │ │ │ +
140
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
142 : indexSet_(&indexset)
│ │ │ │ +
143 {}
│ │ │ │ +
│ │ │ │ +
148 void setIndexSet(const ParallelIndexSet& indexset);
│ │ │ │ +
149
│ │ │ │ +
153 //const ParallelIndexSet& indexSet() const;
│ │ │ │ +
154
│ │ │ │ +
159 const_iterator begin() const;
│ │ │ │ +
160
│ │ │ │ +
165 const_iterator end() const;
│ │ │ │ +
166
│ │ │ │ +
167
│ │ │ │ +
168 private:
│ │ │ │ +
169 const ParallelIndexSet* indexSet_;
│ │ │ │ +
170
│ │ │ │ +
171 };
│ │ │ │ +
│ │ │ │ +
172
│ │ │ │ +
176 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
178 {
│ │ │ │ +
179 public:
│ │ │ │ +
188 typedef TS AttributeSet;
│ │ │ │ +
189
│ │ │ │ +
193 typedef TG GlobalIndex;
│ │ │ │ +
194
│ │ │ │ +
201 typedef TL LocalIndex;
│ │ │ │ +
202
│ │ │ │ + │ │ │ │ +
207
│ │ │ │ +
211 typedef uint32_t* iterator;
│ │ │ │ +
212
│ │ │ │ +
216 typedef uint32_t* const_iterator;
│ │ │ │ +
217
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
219 : selected_()
│ │ │ │ +
220 {}
│ │ │ │ +
│ │ │ │ +
221
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
223 : selected_(), size_(0), built_(false)
│ │ │ │ +
224 {
│ │ │ │ +
225 setIndexSet(indexset);
│ │ │ │ +
226 }
│ │ │ │ +
│ │ │ │ +
227
│ │ │ │ +
228 ~Selection();
│ │ │ │ +
229
│ │ │ │ +
234 void setIndexSet(const ParallelIndexSet& indexset);
│ │ │ │ +
235
│ │ │ │ +
239 void free();
│ │ │ │ +
240
│ │ │ │ +
244 //IndexSet indexSet() const;
│ │ │ │ +
245
│ │ │ │ +
250 const_iterator begin() const;
│ │ │ │ +
251
│ │ │ │ +
256 const_iterator end() const;
│ │ │ │ +
257
│ │ │ │ +
258
│ │ │ │ +
259 private:
│ │ │ │ +
260 uint32_t* selected_;
│ │ │ │ +
261 size_t size_;
│ │ │ │ +
262 bool built_;
│ │ │ │ +
263
│ │ │ │ +
264 };
│ │ │ │ +
│ │ │ │ +
265
│ │ │ │ +
266 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
268 {
│ │ │ │ +
269 if(built_)
│ │ │ │ +
270 free();
│ │ │ │ +
271
│ │ │ │ +
272 // Count the number of entries the selection has to hold
│ │ │ │ + │ │ │ │ +
274 const const_iterator end = indexset.end();
│ │ │ │ +
275 int entries = 0;
│ │ │ │ +
276
│ │ │ │ +
277 for(const_iterator index = indexset.begin(); index != end; ++index)
│ │ │ │ +
278 if(AttributeSet::contains(index->local().attribute()))
│ │ │ │ +
279 ++entries;
│ │ │ │ +
280
│ │ │ │ +
281 selected_ = new uint32_t[entries];
│ │ │ │ +
282 built_ = true;
│ │ │ │ +
283
│ │ │ │ +
284 entries = 0;
│ │ │ │ +
285 for(const_iterator index = indexset.begin(); index != end; ++index)
│ │ │ │ +
286 if(AttributeSet::contains(index->local().attribute()))
│ │ │ │ +
287 selected_[entries++]= index->local().local();
│ │ │ │ +
288
│ │ │ │ +
289 size_=entries;
│ │ │ │ +
290 built_=true;
│ │ │ │ +
291 }
│ │ │ │ +
│ │ │ │ +
292
│ │ │ │ +
293 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
295 {
│ │ │ │ +
296 return selected_;
│ │ │ │ +
297 }
│ │ │ │ +
│ │ │ │ +
298
│ │ │ │ +
299 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
301 {
│ │ │ │ +
302 return selected_+size_;
│ │ │ │ +
303 }
│ │ │ │ +
│ │ │ │ +
304
│ │ │ │ +
305 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
307 {
│ │ │ │ +
308 delete[] selected_;
│ │ │ │ +
309 size_=0;
│ │ │ │ +
310 built_=false;
│ │ │ │ +
311 }
│ │ │ │ +
│ │ │ │ +
312
│ │ │ │ +
313 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
315 {
│ │ │ │ +
316 if(built_)
│ │ │ │ +
317 free();
│ │ │ │ +
318 }
│ │ │ │ +
│ │ │ │ +
319
│ │ │ │ +
320 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
322 {
│ │ │ │ +
323 return SelectionIterator<TS,TG,TL,N>(indexSet_->begin(),
│ │ │ │ +
324 indexSet_->end());
│ │ │ │ +
325 }
│ │ │ │ +
│ │ │ │ +
326
│ │ │ │ +
327 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
329 {
│ │ │ │ +
330 return SelectionIterator<TS,TG,TL,N>(indexSet_->end(),
│ │ │ │ +
331 indexSet_->end());
│ │ │ │ +
332 }
│ │ │ │ +
│ │ │ │ +
333 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
335 {
│ │ │ │ +
336 indexSet_ = &indexset;
│ │ │ │ +
337 }
│ │ │ │ +
│ │ │ │ +
338
│ │ │ │ +
342}
│ │ │ │ +
343#endif
│ │ │ │ +
Provides a map between global and local indices.
│ │ │ │ +
This file implements iterator facade classes for writing stl conformant iterators.
│ │ │ │ +
const_iterator end() const
Get an iterator over the selected indices.
Definition selection.hh:328
│ │ │ │ +
void setIndexSet(const ParallelIndexSet &indexset)
Set the index set of the selection.
Definition selection.hh:267
│ │ │ │ +
void setIndexSet(const ParallelIndexSet &indexset)
Set the index set of the selection.
Definition selection.hh:334
│ │ │ │ +
iterator begin()
Get an iterator over the indices positioned at the first index.
│ │ │ │ +
iterator end()
Get an iterator over the indices positioned after the last index.
│ │ │ │ +
const_iterator end() const
Get an iterator over the selected indices.
Definition selection.hh:300
│ │ │ │ +
const_iterator begin() const
Get the index set we are a selection for.
Definition selection.hh:294
│ │ │ │ +
void free()
Free allocated memory.
Definition selection.hh:306
│ │ │ │ +
const_iterator begin() const
Get the index set we are a selection for.
Definition selection.hh:321
│ │ │ │ +
~Selection()
Definition selection.hh:314
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
A constant random access iterator for the Dune::ArrayList class.
Definition arraylist.hh:370
│ │ │ │ +
Manager class for the mapping between local indices and globally unique indices.
Definition indexset.hh:218
│ │ │ │ +
A const iterator over an uncached selection.
Definition selection.hh:29
│ │ │ │ +
ConstArrayListIterator< IndexPair< TG, TL >, N, std::allocator< Dune::IndexPair< TG, TL > > > ParallelIndexSetIterator
Definition selection.hh:48
│ │ │ │ +
void operator++()
Definition selection.hh:62
│ │ │ │ +
uint32_t operator*() const
Definition selection.hh:71
│ │ │ │ +
TS AttributeSet
The type of the Set of attributes.
Definition selection.hh:39
│ │ │ │ +
Dune::ParallelIndexSet< TG, TL, N > ParallelIndexSet
The type of the underlying index set.
Definition selection.hh:44
│ │ │ │ +
SelectionIterator(const ParallelIndexSetIterator &iter, const ParallelIndexSetIterator &end)
Constructor.
Definition selection.hh:54
│ │ │ │ +
bool operator!=(const SelectionIterator< TS, TG, TL, N > &other) const
Definition selection.hh:81
│ │ │ │ +
bool operator==(const SelectionIterator< TS, TG, TL, N > &other) const
Definition selection.hh:76
│ │ │ │ +
An uncached selection of indices.
Definition selection.hh:97
│ │ │ │ +
UncachedSelection()
Definition selection.hh:137
│ │ │ │ +
SelectionIterator< TS, TG, TL, N > iterator
The type of the iterator of the selected indices.
Definition selection.hh:130
│ │ │ │ +
TS AttributeSet
The type of the Set of attributes.
Definition selection.hh:107
│ │ │ │ +
iterator const_iterator
The type of the iterator of the selected indices.
Definition selection.hh:135
│ │ │ │ +
TG GlobalIndex
The type of the global index of the underlying index set.
Definition selection.hh:112
│ │ │ │ +
UncachedSelection(const ParallelIndexSet &indexset)
Definition selection.hh:141
│ │ │ │ +
Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet
The type of the underlying index set.
Definition selection.hh:125
│ │ │ │ +
TL LocalIndex
The type of the local index of the underlying index set.
Definition selection.hh:120
│ │ │ │ +
A cached selection of indices.
Definition selection.hh:178
│ │ │ │ +
TG GlobalIndex
The type of the global index of the underlying index set.
Definition selection.hh:193
│ │ │ │ +
Selection(const ParallelIndexSet &indexset)
Definition selection.hh:222
│ │ │ │ +
Selection()
Definition selection.hh:218
│ │ │ │ +
TL LocalIndex
The type of the local index of the underlying index set.
Definition selection.hh:201
│ │ │ │ +
TS AttributeSet
The type of the set of attributes.
Definition selection.hh:188
│ │ │ │ +
uint32_t * iterator
The type of the iterator of the selected indices.
Definition selection.hh:211
│ │ │ │ +
uint32_t * const_iterator
The type of the iterator of the selected indices.
Definition selection.hh:216
│ │ │ │ +
Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet
The type of the underlying index set.
Definition selection.hh:206
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,386 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -apply.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +selection.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_STD_APPLY_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_APPLY_HH │ │ │ │ │ +5#ifndef DUNE_SELECTION_HH │ │ │ │ │ +6#define DUNE_SELECTION_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10namespace _D_u_n_e │ │ │ │ │ -11{ │ │ │ │ │ -_1_2 namespace Std │ │ │ │ │ -13 { │ │ │ │ │ -14 │ │ │ │ │ -17 using std::apply; │ │ │ │ │ -18 │ │ │ │ │ -19 } // namespace Std │ │ │ │ │ -20} // namespace Dune │ │ │ │ │ -21 │ │ │ │ │ -22#endif // #ifndef DUNE_COMMON_STD_APPLY_HH │ │ │ │ │ +8#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ +9#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h> │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e │ │ │ │ │ +12{ │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 class _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ +29 { │ │ │ │ │ +30 public: │ │ │ │ │ +_3_9 typedef TS _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ +40 │ │ │ │ │ +_4_4 typedef _D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_> _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +45 │ │ │ │ │ +46 //typedef typename ParallelIndexSet::const_iterator │ │ │ │ │ +ParallelIndexSetIterator; │ │ │ │ │ +47 │ │ │ │ │ +_4_8 typedef _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>, N, std::allocator > > _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +_5_4 _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_I_t_e_r_a_t_o_r& iter, const │ │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_I_t_e_r_a_t_o_r& end) │ │ │ │ │ +55 : iter_(iter), end_(end) │ │ │ │ │ +56 { │ │ │ │ │ +57 // Step to the first valid entry │ │ │ │ │ +58 while(iter_!=end_ && !AttributeSet::contains(iter_->local().attribute())) │ │ │ │ │ +59 ++iter_; │ │ │ │ │ +60 } │ │ │ │ │ +61 │ │ │ │ │ +_6_2 void _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +63 { │ │ │ │ │ +64 assert(iter_!=end_); │ │ │ │ │ +65 for(++iter_; iter_!=end_; ++iter_) │ │ │ │ │ +66 if(AttributeSet::contains(iter_->local().attribute())) │ │ │ │ │ +67 break; │ │ │ │ │ +68 } │ │ │ │ │ +69 │ │ │ │ │ +70 │ │ │ │ │ +_7_1 uint32_t _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ +72 { │ │ │ │ │ +73 return iter_->local().local(); │ │ │ │ │ +74 } │ │ │ │ │ +75 │ │ │ │ │ +_7_6 bool _o_p_e_r_a_t_o_r_=_=(const _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_T_S_,_T_G_,_T_L_,_N_>& other) const │ │ │ │ │ +77 { │ │ │ │ │ +78 return iter_ == other.iter_; │ │ │ │ │ +79 } │ │ │ │ │ +80 │ │ │ │ │ +_8_1 bool _o_p_e_r_a_t_o_r_!_=(const _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_T_S_,_T_G_,_T_L_,_N_>& other) const │ │ │ │ │ +82 { │ │ │ │ │ +83 return iter_ != other.iter_; │ │ │ │ │ +84 } │ │ │ │ │ +85 │ │ │ │ │ +86 private: │ │ │ │ │ +87 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_I_t_e_r_a_t_o_r iter_; │ │ │ │ │ +88 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_I_t_e_r_a_t_o_r end_; │ │ │ │ │ +89 }; │ │ │ │ │ +90 │ │ │ │ │ +91 │ │ │ │ │ +95 template │ │ │ │ │ +_9_6 class _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n │ │ │ │ │ +97 { │ │ │ │ │ +98 public: │ │ │ │ │ +_1_0_7 typedef TS _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ +108 │ │ │ │ │ +_1_1_2 typedef TG _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +113 │ │ │ │ │ +_1_2_0 typedef TL _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ +121 │ │ │ │ │ +_1_2_5 typedef _D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_G_l_o_b_a_l_I_n_d_e_x_,_L_o_c_a_l_I_n_d_e_x_,_N_> _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +126 │ │ │ │ │ +_1_3_0 typedef _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_T_S_,_T_G_,_T_L_,_N_> _i_t_e_r_a_t_o_r; │ │ │ │ │ +131 │ │ │ │ │ +_1_3_5 typedef _i_t_e_r_a_t_o_r _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +136 │ │ │ │ │ +_1_3_7 _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n() │ │ │ │ │ +138 : indexSet_() │ │ │ │ │ +139 {} │ │ │ │ │ +140 │ │ │ │ │ +_1_4_1 _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexset) │ │ │ │ │ +142 : indexSet_(&indexset) │ │ │ │ │ +143 {} │ │ │ │ │ +148 void _s_e_t_I_n_d_e_x_S_e_t(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexset); │ │ │ │ │ +149 │ │ │ │ │ +153 //const ParallelIndexSet& indexSet() const; │ │ │ │ │ +154 │ │ │ │ │ +159 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ +160 │ │ │ │ │ +165 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ +166 │ │ │ │ │ +167 │ │ │ │ │ +168 private: │ │ │ │ │ +169 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* indexSet_; │ │ │ │ │ +170 │ │ │ │ │ +171 }; │ │ │ │ │ +172 │ │ │ │ │ +176 template │ │ │ │ │ +_1_7_7 class _S_e_l_e_c_t_i_o_n │ │ │ │ │ +178 { │ │ │ │ │ +179 public: │ │ │ │ │ +_1_8_8 typedef TS _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ +189 │ │ │ │ │ +_1_9_3 typedef TG _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +194 │ │ │ │ │ +_2_0_1 typedef TL _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ +202 │ │ │ │ │ +_2_0_6 typedef _D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_G_l_o_b_a_l_I_n_d_e_x_,_L_o_c_a_l_I_n_d_e_x_,_N_> _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +207 │ │ │ │ │ +_2_1_1 typedef uint32_t* _i_t_e_r_a_t_o_r; │ │ │ │ │ +212 │ │ │ │ │ +_2_1_6 typedef uint32_t* _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +217 │ │ │ │ │ +_2_1_8 _S_e_l_e_c_t_i_o_n() │ │ │ │ │ +219 : selected_() │ │ │ │ │ +220 {} │ │ │ │ │ +221 │ │ │ │ │ +_2_2_2 _S_e_l_e_c_t_i_o_n(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexset) │ │ │ │ │ +223 : selected_(), size_(0), built_(false) │ │ │ │ │ +224 { │ │ │ │ │ +225 _s_e_t_I_n_d_e_x_S_e_t(indexset); │ │ │ │ │ +226 } │ │ │ │ │ +227 │ │ │ │ │ +228 _~_S_e_l_e_c_t_i_o_n(); │ │ │ │ │ +229 │ │ │ │ │ +234 void _s_e_t_I_n_d_e_x_S_e_t(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexset); │ │ │ │ │ +235 │ │ │ │ │ +239 void _f_r_e_e(); │ │ │ │ │ +240 │ │ │ │ │ +244 //IndexSet indexSet() const; │ │ │ │ │ +245 │ │ │ │ │ +250 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ +251 │ │ │ │ │ +256 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ +257 │ │ │ │ │ +258 │ │ │ │ │ +259 private: │ │ │ │ │ +260 uint32_t* selected_; │ │ │ │ │ +261 size_t size_; │ │ │ │ │ +262 bool built_; │ │ │ │ │ +263 │ │ │ │ │ +264 }; │ │ │ │ │ +265 │ │ │ │ │ +266 template │ │ │ │ │ +_2_6_7 inline void _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_s_e_t_I_n_d_e_x_S_e_t(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& │ │ │ │ │ +indexset) │ │ │ │ │ +268 { │ │ │ │ │ +269 if(built_) │ │ │ │ │ +270 free(); │ │ │ │ │ +271 │ │ │ │ │ +272 // Count the number of entries the selection has to hold │ │ │ │ │ +273 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_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; │ │ │ │ │ +274 const _c_o_n_s_t___i_t_e_r_a_t_o_r end = indexset._e_n_d(); │ │ │ │ │ +275 int entries = 0; │ │ │ │ │ +276 │ │ │ │ │ +277 for(_c_o_n_s_t___i_t_e_r_a_t_o_r index = indexset._b_e_g_i_n(); index != end; ++index) │ │ │ │ │ +278 if(AttributeSet::contains(index->local().attribute())) │ │ │ │ │ +279 ++entries; │ │ │ │ │ +280 │ │ │ │ │ +281 selected_ = new uint32_t[entries]; │ │ │ │ │ +282 built_ = true; │ │ │ │ │ +283 │ │ │ │ │ +284 entries = 0; │ │ │ │ │ +285 for(_c_o_n_s_t___i_t_e_r_a_t_o_r index = indexset._b_e_g_i_n(); index != end; ++index) │ │ │ │ │ +286 if(AttributeSet::contains(index->local().attribute())) │ │ │ │ │ +287 selected_[entries++]= index->local().local(); │ │ │ │ │ +288 │ │ │ │ │ +289 size_=entries; │ │ │ │ │ +290 built_=true; │ │ │ │ │ +291 } │ │ │ │ │ +292 │ │ │ │ │ +293 template │ │ │ │ │ +_2_9_4 uint32_t* _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_b_e_g_i_n() const │ │ │ │ │ +295 { │ │ │ │ │ +296 return selected_; │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +299 template │ │ │ │ │ +_3_0_0 uint32_t* _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_e_n_d() const │ │ │ │ │ +301 { │ │ │ │ │ +302 return selected_+size_; │ │ │ │ │ +303 } │ │ │ │ │ +304 │ │ │ │ │ +305 template │ │ │ │ │ +_3_0_6 inline void _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_f_r_e_e() │ │ │ │ │ +307 { │ │ │ │ │ +308 delete[] selected_; │ │ │ │ │ +309 size_=0; │ │ │ │ │ +310 built_=false; │ │ │ │ │ +311 } │ │ │ │ │ +312 │ │ │ │ │ +313 template │ │ │ │ │ +_3_1_4 inline _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_~_S_e_l_e_c_t_i_o_n() │ │ │ │ │ +315 { │ │ │ │ │ +316 if(built_) │ │ │ │ │ +317 free(); │ │ │ │ │ +318 } │ │ │ │ │ +319 │ │ │ │ │ +320 template │ │ │ │ │ +_3_2_1 _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_T_S_,_T_G_,_T_L_,_N_> _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_b_e_g_i_n() const │ │ │ │ │ +322 { │ │ │ │ │ +323 return _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_T_S_,_T_G_,_T_L_,_N_>(indexSet_->begin(), │ │ │ │ │ +324 indexSet_->end()); │ │ │ │ │ +325 } │ │ │ │ │ +326 │ │ │ │ │ +327 template │ │ │ │ │ +_3_2_8 _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_T_S_,_T_G_,_T_L_,_N_> _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_e_n_d() const │ │ │ │ │ +329 { │ │ │ │ │ +330 return _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_T_S_,_T_G_,_T_L_,_N_>(indexSet_->end(), │ │ │ │ │ +331 indexSet_->end()); │ │ │ │ │ +332 } │ │ │ │ │ +333 template │ │ │ │ │ +_3_3_4 void _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_s_e_t_I_n_d_e_x_S_e_t(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& │ │ │ │ │ +indexset) │ │ │ │ │ +335 { │ │ │ │ │ +336 indexSet_ = &indexset; │ │ │ │ │ +337 } │ │ │ │ │ +338 │ │ │ │ │ +342} │ │ │ │ │ +343#endif │ │ │ │ │ +_i_n_d_e_x_s_e_t_._h_h │ │ │ │ │ +Provides a map between global and local indices. │ │ │ │ │ +_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h │ │ │ │ │ +This file implements iterator facade classes for writing stl conformant │ │ │ │ │ +iterators. │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +Get an iterator over the selected indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_s_e_t_I_n_d_e_x_S_e_t │ │ │ │ │ +void setIndexSet(const ParallelIndexSet &indexset) │ │ │ │ │ +Set the index set of the selection. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_s_e_t_I_n_d_e_x_S_e_t │ │ │ │ │ +void setIndexSet(const ParallelIndexSet &indexset) │ │ │ │ │ +Set the index set of the selection. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:334 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +Get an iterator over the indices positioned at the first index. │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +Get an iterator over the indices positioned after the last index. │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +Get an iterator over the selected indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +Get the index set we are a selection for. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:294 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_f_r_e_e │ │ │ │ │ +void free() │ │ │ │ │ +Free allocated memory. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:306 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +Get the index set we are a selection for. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:321 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_~_S_e_l_e_c_t_i_o_n │ │ │ │ │ +~Selection() │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:314 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +A constant random access iterator for the Dune::ArrayList class. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:370 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Manager class for the mapping between local indices and globally unique │ │ │ │ │ +indices. │ │ │ │ │ +DDeeffiinniittiioonn indexset.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ +A const iterator over an uncached selection. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstArrayListIterator< IndexPair< TG, TL >, N, std::allocator< Dune:: │ │ │ │ │ +IndexPair< TG, TL > > > ParallelIndexSetIterator │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +void operator++() │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:62 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +uint32_t operator*() const │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ +TS AttributeSet │ │ │ │ │ +The type of the Set of attributes. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::ParallelIndexSet< TG, TL, N > ParallelIndexSet │ │ │ │ │ +The type of the underlying index set. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ +SelectionIterator(const ParallelIndexSetIterator &iter, const │ │ │ │ │ +ParallelIndexSetIterator &end) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const SelectionIterator< TS, TG, TL, N > &other) const │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const SelectionIterator< TS, TG, TL, N > &other) const │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n │ │ │ │ │ +An uncached selection of indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:97 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n │ │ │ │ │ +UncachedSelection() │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:137 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +SelectionIterator< TS, TG, TL, N > iterator │ │ │ │ │ +The type of the iterator of the selected indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:130 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ +TS AttributeSet │ │ │ │ │ +The type of the Set of attributes. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:107 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +iterator const_iterator │ │ │ │ │ +The type of the iterator of the selected indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:135 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +TG GlobalIndex │ │ │ │ │ +The type of the global index of the underlying index set. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n │ │ │ │ │ +UncachedSelection(const ParallelIndexSet &indexset) │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet │ │ │ │ │ +The type of the underlying index set. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:125 │ │ │ │ │ +_D_u_n_e_:_:_U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +TL LocalIndex │ │ │ │ │ +The type of the local index of the underlying index set. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n │ │ │ │ │ +A cached selection of indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +TG GlobalIndex │ │ │ │ │ +The type of the global index of the underlying index set. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:193 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_S_e_l_e_c_t_i_o_n │ │ │ │ │ +Selection(const ParallelIndexSet &indexset) │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:222 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_S_e_l_e_c_t_i_o_n │ │ │ │ │ +Selection() │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +TL LocalIndex │ │ │ │ │ +The type of the local index of the underlying index set. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:201 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ +TS AttributeSet │ │ │ │ │ +The type of the set of attributes. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +uint32_t * iterator │ │ │ │ │ +The type of the iterator of the selected indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +uint32_t * const_iterator │ │ │ │ │ +The type of the iterator of the selected indices. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet │ │ │ │ │ +The type of the underlying index set. │ │ │ │ │ +DDeeffiinniittiioonn selection.hh:206 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00095.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: make_array.hh File Reference │ │ │ │ +dune-common: communication.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,45 +65,71 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ +Typedefs | │ │ │ │ Functions
│ │ │ │ -
make_array.hh File Reference
│ │ │ │ +
communication.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <type_traits>
│ │ │ │ + │ │ │ │ +

Implements an utility class that provides collective communication methods for sequential programs. │ │ │ │ +More...

│ │ │ │ +
#include <iostream>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <dune/common/binaryfunctions.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/parallel/future.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

struct  Dune::No_Comm
 
class  Dune::Communication< Communicator >
 Collective communication interface and sequential default implementation. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Typedefs

template<class T >
using Dune::CollectiveCommunication = Communication< T >
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<typename... Args>
std::array< typename std::common_type< Args... >::type, sizeof...(Args)> Dune::Std::make_array (const Args &... args)
 Create and initialize an array.
 
bool Dune::operator== (const No_Comm &, const No_Comm &)
 Comparison operator for MPI compatibility.
 
bool Dune::operator!= (const No_Comm &, const No_Comm &)
 Comparison operator for MPI compatibility.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Implements an utility class that provides collective communication methods for sequential programs.

│ │ │ │ +

An abstraction to the basic methods of parallel communication, following the message-passing paradigm.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,27 +1,49 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -make_array.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ +communication.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Implements an utility class that provides collective communication methods for │ │ │ │ │ +sequential programs. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_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 │ │ │ │ │ +struct   _D_u_n_e_:_:_N_o___C_o_m_m │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_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_ _> │ │ │ │ │ +  Collective communication interface and sequential default │ │ │ │ │ + implementation. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n = _C_o_m_m_u_n_i_c_a_t_i_o_n< T > │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -std::array< typename std::common_type< _D_u_n_e_:_:_S_t_d_:_:_m_a_k_e___a_r_r_a_y (const Args &... │ │ │ │ │ - Args... >::type, sizeof...(Args)>  args) │ │ │ │ │ -  Create and initialize an array. │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _N_o___C_o_m_m &, const _N_o___C_o_m_m &) │ │ │ │ │ +  Comparison operator for MPI compatibility. │ │ │ │ │ +  │ │ │ │ │ +bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _N_o___C_o_m_m &, const _N_o___C_o_m_m &) │ │ │ │ │ +  Comparison operator for MPI compatibility. │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Implements an utility class that provides collective communication methods for │ │ │ │ │ +sequential programs. │ │ │ │ │ +An abstraction to the basic methods of parallel communication, following the │ │ │ │ │ +message-passing paradigm. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: make_array.hh Source File │ │ │ │ +dune-common: communication.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,64 +70,417 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
make_array.hh
│ │ │ │ +
communication.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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_COMMON_STD_MAKE_ARRAY_HH
│ │ │ │ -
4#define DUNE_COMMON_STD_MAKE_ARRAY_HH
│ │ │ │ -
5
│ │ │ │ -
6#include <array>
│ │ │ │ -
7#include <type_traits>
│ │ │ │ -
8
│ │ │ │ -
9#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
│ │ │ │ -
10#include <experimental/array>
│ │ │ │ -
11#endif
│ │ │ │ -
12
│ │ │ │ -
13#warning make_array.hh is deprecated and will be removed after Dune 2.9. \
│ │ │ │ -
14 Use deduction guide of `std::array` or `std::to_array`.
│ │ │ │ -
15
│ │ │ │ -
16namespace Dune {
│ │ │ │ -
17namespace Std {
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ +
5#ifndef DUNE_COMMON_PARALLEL_COMMUNICATION_HH
│ │ │ │ +
6#define DUNE_COMMON_PARALLEL_COMMUNICATION_HH
│ │ │ │ +
14#include <iostream>
│ │ │ │ +
15#include <complex>
│ │ │ │ +
16#include <algorithm>
│ │ │ │ +
17#include <vector>
│ │ │ │
18
│ │ │ │ -
19#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
│ │ │ │ -
20
│ │ │ │ -
22 using std::experimental::make_array;
│ │ │ │ -
23
│ │ │ │ -
24#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
│ │ │ │ -
25
│ │ │ │ -
27
│ │ │ │ -
41 template <typename... Args>
│ │ │ │ -
42 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
│ │ │ │ -
│ │ │ │ -
43 make_array(const Args&... args) {
│ │ │ │ -
44 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
│ │ │ │ -
45 result = {{args...}};
│ │ │ │ -
46 return result;
│ │ │ │ -
47 }
│ │ │ │ -
│ │ │ │ -
48
│ │ │ │ -
49#endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
│ │ │ │ -
50
│ │ │ │ -
51}
│ │ │ │ -
52}
│ │ │ │ -
53
│ │ │ │ -
54#endif
│ │ │ │ -
std::array< typename std::common_type< Args... >::type, sizeof...(Args)> make_array(const Args &... args)
Create and initialize an array.
Definition make_array.hh:43
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
22
│ │ │ │ +
42namespace Dune
│ │ │ │ +
43{
│ │ │ │ +
44
│ │ │ │ +
45 /* define some type that definitely differs from MPI_Comm */
│ │ │ │ +
46 struct No_Comm {};
│ │ │ │ +
47
│ │ │ │ +
│ │ │ │ +
52 inline bool operator==(const No_Comm&, const No_Comm&)
│ │ │ │ +
53 {
│ │ │ │ +
54 return true;
│ │ │ │ +
55 }
│ │ │ │ +
│ │ │ │ +
56
│ │ │ │ +
│ │ │ │ +
61 inline bool operator!=(const No_Comm&, const No_Comm&)
│ │ │ │ +
62 {
│ │ │ │ +
63 return false;
│ │ │ │ +
64 }
│ │ │ │ +
│ │ │ │ +
65
│ │ │ │ +
98 template<typename Communicator>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
100 {
│ │ │ │ +
101 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
104 {}
│ │ │ │ +
│ │ │ │ +
105
│ │ │ │ +
│ │ │ │ +
110 Communication (const Communicator&)
│ │ │ │ +
111 {}
│ │ │ │ +
│ │ │ │ +
112
│ │ │ │ +
│ │ │ │ +
114 int rank () const
│ │ │ │ +
115 {
│ │ │ │ +
116 return 0;
│ │ │ │ +
117 }
│ │ │ │ +
│ │ │ │ +
118
│ │ │ │ +
│ │ │ │ +
120 operator No_Comm() const
│ │ │ │ +
121 {
│ │ │ │ +
122 return {};
│ │ │ │ +
123 }
│ │ │ │ +
│ │ │ │ +
124
│ │ │ │ +
│ │ │ │ +
126 int size () const
│ │ │ │ +
127 {
│ │ │ │ +
128 return 1;
│ │ │ │ +
129 }
│ │ │ │ +
│ │ │ │ +
130
│ │ │ │ +
134 template<class T>
│ │ │ │ +
│ │ │ │ +
135 int send([[maybe_unused]] const T& data,
│ │ │ │ +
136 [[maybe_unused]] int dest_rank,
│ │ │ │ +
137 [[maybe_unused]] int tag)
│ │ │ │ +
138 {
│ │ │ │ +
139 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
│ │ │ │ +
140 }
│ │ │ │ +
│ │ │ │ +
141
│ │ │ │ +
145 template<class T>
│ │ │ │ +
│ │ │ │ +
146 PseudoFuture<T> isend([[maybe_unused]] const T&& data,
│ │ │ │ +
147 [[maybe_unused]] int dest_rank,
│ │ │ │ +
148 [[maybe_unused]] int tag)
│ │ │ │ +
149 {
│ │ │ │ +
150 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
│ │ │ │ +
151 }
│ │ │ │ +
│ │ │ │ +
152
│ │ │ │ +
156 template<class T>
│ │ │ │ +
│ │ │ │ +
157 T recv([[maybe_unused]] T&& data,
│ │ │ │ +
158 [[maybe_unused]] int source_rank,
│ │ │ │ +
159 [[maybe_unused]] int tag,
│ │ │ │ +
160 [[maybe_unused]] void* status = 0)
│ │ │ │ +
161 {
│ │ │ │ +
162 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
│ │ │ │ +
163 }
│ │ │ │ +
│ │ │ │ +
164
│ │ │ │ +
168 template<class T>
│ │ │ │ +
│ │ │ │ +
169 PseudoFuture<T> irecv([[maybe_unused]] T&& data,
│ │ │ │ +
170 [[maybe_unused]] int source_rank,
│ │ │ │ +
171 [[maybe_unused]] int tag)
│ │ │ │ +
172 {
│ │ │ │ +
173 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
│ │ │ │ +
174 }
│ │ │ │ +
│ │ │ │ +
175
│ │ │ │ +
176 template<class T>
│ │ │ │ +
│ │ │ │ +
177 T rrecv([[maybe_unused]] T&& data,
│ │ │ │ +
178 [[maybe_unused]] int source_rank,
│ │ │ │ +
179 [[maybe_unused]] int tag,
│ │ │ │ +
180 [[maybe_unused]] void* status = 0) const
│ │ │ │ +
181 {
│ │ │ │ +
182 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
│ │ │ │ +
183 }
│ │ │ │ +
│ │ │ │ +
187 template<typename T>
│ │ │ │ +
│ │ │ │ +
188 T sum (const T& in) const
│ │ │ │ +
189 {
│ │ │ │ +
190 return in;
│ │ │ │ +
191 }
│ │ │ │ +
│ │ │ │ +
192
│ │ │ │ +
198 template<typename T>
│ │ │ │ +
│ │ │ │ +
199 int sum ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
│ │ │ │ +
200 {
│ │ │ │ +
201 return 0;
│ │ │ │ +
202 }
│ │ │ │ +
│ │ │ │ +
203
│ │ │ │ +
207 template<typename T>
│ │ │ │ +
│ │ │ │ +
208 T prod (const T& in) const
│ │ │ │ +
209 {
│ │ │ │ +
210 return in;
│ │ │ │ +
211 }
│ │ │ │ +
│ │ │ │ +
212
│ │ │ │ +
218 template<typename T>
│ │ │ │ +
│ │ │ │ +
219 int prod ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
│ │ │ │ +
220 {
│ │ │ │ +
221 return 0;
│ │ │ │ +
222 }
│ │ │ │ +
│ │ │ │ +
223
│ │ │ │ +
227 template<typename T>
│ │ │ │ +
│ │ │ │ +
228 T min (const T& in) const
│ │ │ │ +
229 {
│ │ │ │ +
230 return in;
│ │ │ │ +
231 }
│ │ │ │ +
│ │ │ │ +
232
│ │ │ │ +
238 template<typename T>
│ │ │ │ +
│ │ │ │ +
239 int min ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
│ │ │ │ +
240 {
│ │ │ │ +
241 return 0;
│ │ │ │ +
242 }
│ │ │ │ +
│ │ │ │ +
243
│ │ │ │ +
247 template<typename T>
│ │ │ │ +
│ │ │ │ +
248 T max (const T& in) const
│ │ │ │ +
249 {
│ │ │ │ +
250 return in;
│ │ │ │ +
251 }
│ │ │ │ +
│ │ │ │ +
252
│ │ │ │ +
258 template<typename T>
│ │ │ │ +
│ │ │ │ +
259 int max ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
│ │ │ │ +
260 {
│ │ │ │ +
261 return 0;
│ │ │ │ +
262 }
│ │ │ │ +
│ │ │ │ +
263
│ │ │ │ +
│ │ │ │ +
267 int barrier () const
│ │ │ │ +
268 {
│ │ │ │ +
269 return 0;
│ │ │ │ +
270 }
│ │ │ │ +
│ │ │ │ +
271
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
276 {
│ │ │ │ +
277 return {true}; // return a valid future
│ │ │ │ +
278 }
│ │ │ │ +
│ │ │ │ +
279
│ │ │ │ +
283 template<typename T>
│ │ │ │ +
│ │ │ │ +
284 int broadcast ([[maybe_unused]] T* inout,
│ │ │ │ +
285 [[maybe_unused]] int len,
│ │ │ │ +
286 [[maybe_unused]] int root) const
│ │ │ │ +
287 {
│ │ │ │ +
288 return 0;
│ │ │ │ +
289 }
│ │ │ │ +
│ │ │ │ +
290
│ │ │ │ +
294 template<class T>
│ │ │ │ +
│ │ │ │ +
295 PseudoFuture<T> ibroadcast(T&& data, int root) const{
│ │ │ │ +
296 return {std::forward<T>(data)};
│ │ │ │ +
297 }
│ │ │ │ +
│ │ │ │ +
298
│ │ │ │ +
299
│ │ │ │ +
312 template<typename T>
│ │ │ │ +
│ │ │ │ +
313 int gather (const T* in, T* out, int len, [[maybe_unused]] int root) const // note out must have same size as in
│ │ │ │ +
314 {
│ │ │ │ +
315 for (int i=0; i<len; i++)
│ │ │ │ +
316 out[i] = in[i];
│ │ │ │ +
317 return 0;
│ │ │ │ +
318 }
│ │ │ │ +
│ │ │ │ +
319
│ │ │ │ +
323 template<class TIN, class TOUT = std::vector<TIN>>
│ │ │ │ +
│ │ │ │ +
324 PseudoFuture<TOUT> igather(TIN&& data_in, TOUT&& data_out, int root){
│ │ │ │ +
325 *(data_out.begin()) = std::forward<TIN>(data_in);
│ │ │ │ +
326 return {std::forward<TOUT>(data_out)};
│ │ │ │ +
327 }
│ │ │ │ +
│ │ │ │ +
328
│ │ │ │ +
329
│ │ │ │ +
349 template<typename T>
│ │ │ │ +
│ │ │ │ +
350 int gatherv (const T* in,
│ │ │ │ +
351 int sendDataLen,
│ │ │ │ +
352 T* out,
│ │ │ │ +
353 [[maybe_unused]] int* recvDataLen,
│ │ │ │ +
354 int* displ,
│ │ │ │ +
355 [[maybe_unused]] int root) const
│ │ │ │ +
356 {
│ │ │ │ +
357 for (int i=*displ; i<sendDataLen; i++)
│ │ │ │ +
358 out[i] = in[i];
│ │ │ │ +
359 return 0;
│ │ │ │ +
360 }
│ │ │ │ +
│ │ │ │ +
361
│ │ │ │ +
375 template<typename T>
│ │ │ │ +
│ │ │ │ +
376 int scatter (const T* sendData, T* recvData, int len, [[maybe_unused]] int root) const // note out must have same size as in
│ │ │ │ +
377 {
│ │ │ │ +
378 for (int i=0; i<len; i++)
│ │ │ │ +
379 recvData[i] = sendData[i];
│ │ │ │ +
380 return 0;
│ │ │ │ +
381 }
│ │ │ │ +
│ │ │ │ +
382
│ │ │ │ +
386 template<class TIN, class TOUT = TIN>
│ │ │ │ +
│ │ │ │ +
387 PseudoFuture<TOUT> iscatter(TIN&& data_in, TOUT&& data_out, int root){
│ │ │ │ +
388 data_out = *(std::forward<TIN>(data_in).begin());
│ │ │ │ +
389 return {std::forward<TOUT>(data_out)};
│ │ │ │ +
390 }
│ │ │ │ +
│ │ │ │ +
391
│ │ │ │ +
410 template<typename T>
│ │ │ │ +
│ │ │ │ +
411 int scatterv (const T* sendData,int* sendDataLen, int* displ, T* recvData,
│ │ │ │ +
412 [[maybe_unused]] int recvDataLen, [[maybe_unused]] int root) const
│ │ │ │ +
413 {
│ │ │ │ +
414 for (int i=*displ; i<*sendDataLen; i++)
│ │ │ │ +
415 recvData[i] = sendData[i];
│ │ │ │ +
416 return 0;
│ │ │ │ +
417 }
│ │ │ │ +
│ │ │ │ +
418
│ │ │ │ +
432 template<typename T>
│ │ │ │ +
│ │ │ │ +
433 int allgather(const T* sbuf, int count, T* rbuf) const
│ │ │ │ +
434 {
│ │ │ │ +
435 for(const T* end=sbuf+count; sbuf < end; ++sbuf, ++rbuf)
│ │ │ │ +
436 *rbuf=*sbuf;
│ │ │ │ +
437 return 0;
│ │ │ │ +
438 }
│ │ │ │ +
│ │ │ │ +
439
│ │ │ │ +
444 template<class TIN, class TOUT = TIN>
│ │ │ │ +
│ │ │ │ +
445 PseudoFuture<TOUT> iallgather(TIN&& data_in, TOUT&& data_out){
│ │ │ │ +
446 return {std::forward<TOUT>(data_out)};
│ │ │ │ +
447 }
│ │ │ │ +
│ │ │ │ +
448
│ │ │ │ +
465 template<typename T>
│ │ │ │ +
│ │ │ │ +
466 int allgatherv (const T* in, int sendDataLen, T* out, [[maybe_unused]] int* recvDataLen, int* displ) const
│ │ │ │ +
467 {
│ │ │ │ +
468 for (int i=*displ; i<sendDataLen; i++)
│ │ │ │ +
469 out[i] = in[i];
│ │ │ │ +
470 return 0;
│ │ │ │ +
471 }
│ │ │ │ +
│ │ │ │ +
472
│ │ │ │ +
485 template<typename BinaryFunction, typename Type>
│ │ │ │ +
│ │ │ │ +
486 int allreduce([[maybe_unused]] Type* inout, [[maybe_unused]] int len) const
│ │ │ │ +
487 {
│ │ │ │ +
488 return 0;
│ │ │ │ +
489 }
│ │ │ │ +
│ │ │ │ +
490
│ │ │ │ +
495 template<class BinaryFunction, class TIN, class TOUT = TIN>
│ │ │ │ +
│ │ │ │ +
496 PseudoFuture<TOUT> iallreduce(TIN&& data_in, TOUT&& data_out){
│ │ │ │ +
497 data_out = std::forward<TIN>(data_in);
│ │ │ │ +
498 return {std::forward<TOUT>(data_out)};
│ │ │ │ +
499 }
│ │ │ │ +
│ │ │ │ +
500
│ │ │ │ +
505 template<class BinaryFunction, class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
507 return {std::forward<T>(data)};
│ │ │ │ +
508 }
│ │ │ │ +
│ │ │ │ +
509
│ │ │ │ +
510
│ │ │ │ +
524 template<typename BinaryFunction, typename Type>
│ │ │ │ +
│ │ │ │ +
525 int allreduce(const Type* in, Type* out, int len) const
│ │ │ │ +
526 {
│ │ │ │ +
527 std::copy(in, in+len, out);
│ │ │ │ +
528 return 0;
│ │ │ │ +
529 }
│ │ │ │ +
│ │ │ │ +
530
│ │ │ │ +
531 };
│ │ │ │ +
│ │ │ │ +
532
│ │ │ │ +
538 template<class T>
│ │ │ │ + │ │ │ │ +
540 [[deprecated("CollectiveCommunication is deprecated. Use Communication instead.")]]
│ │ │ │ + │ │ │ │ +
542}
│ │ │ │ +
543
│ │ │ │ +
544#endif
│ │ │ │ + │ │ │ │ +
helper classes to provide unique types for standard functions
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition iteratorfacades.hh:237
│ │ │ │ +
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition iteratorfacades.hh:259
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
Default exception if an error in the parallel communication of the program occurred.
Definition exceptions.hh:287
│ │ │ │ +
Definition communication.hh:46
│ │ │ │ +
Collective communication interface and sequential default implementation.
Definition communication.hh:100
│ │ │ │ +
PseudoFuture< TOUT > iallreduce(TIN &&data_in, TOUT &&data_out)
Compute something over all processes nonblocking.
Definition communication.hh:496
│ │ │ │ +
int send(const T &data, int dest_rank, int tag)
Sends the data to the dest_rank.
Definition communication.hh:135
│ │ │ │ +
int allreduce(const Type *in, Type *out, int len) const
Compute something over all processes for each component of an array and return the result in every pr...
Definition communication.hh:525
│ │ │ │ +
T max(const T &in) const
Compute the maximum of the argument over all processes and return the result in every process....
Definition communication.hh:248
│ │ │ │ +
int rank() const
Return rank, is between 0 and size()-1.
Definition communication.hh:114
│ │ │ │ +
T sum(const T &in) const
Compute the sum of the argument over all processes and return the result in every process....
Definition communication.hh:188
│ │ │ │ +
int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int recvDataLen, int root) const
Scatter arrays of variable length from a root to all other tasks.
Definition communication.hh:411
│ │ │ │ +
int prod(T *inout, int len) const
Compute the product over all processes for each component of an array and return the result in every ...
Definition communication.hh:219
│ │ │ │ +
T recv(T &&data, int source_rank, int tag, void *status=0)
Receives the data from the source_rank.
Definition communication.hh:157
│ │ │ │ +
PseudoFuture< T > isend(const T &&data, int dest_rank, int tag)
Sends the data to the dest_rank nonblocking.
Definition communication.hh:146
│ │ │ │ +
PseudoFuture< void > ibarrier() const
Nonblocking barrier.
Definition communication.hh:275
│ │ │ │ +
int allreduce(Type *inout, int len) const
Compute something over all processes for each component of an array and return the result in every pr...
Definition communication.hh:486
│ │ │ │ +
int size() const
Number of processes in set, is greater than 0.
Definition communication.hh:126
│ │ │ │ +
int sum(T *inout, int len) const
Compute the sum over all processes for each component of an array and return the result in every proc...
Definition communication.hh:199
│ │ │ │ +
int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ) const
Gathers data of variable length from all tasks and distribute it to all.
Definition communication.hh:466
│ │ │ │ +
T min(const T &in) const
Compute the minimum of the argument over all processes and return the result in every process....
Definition communication.hh:228
│ │ │ │ +
PseudoFuture< T > irecv(T &&data, int source_rank, int tag)
Receives the data from the source_rank nonblocking.
Definition communication.hh:169
│ │ │ │ +
int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, int root) const
Gather arrays of variable size on root task.
Definition communication.hh:350
│ │ │ │ +
PseudoFuture< T > ibroadcast(T &&data, int root) const
Distribute an array from the process with rank root to all other processes nonblocking.
Definition communication.hh:295
│ │ │ │ +
int allgather(const T *sbuf, int count, T *rbuf) const
Gathers data from all tasks and distribute it to all.
Definition communication.hh:433
│ │ │ │ +
int scatter(const T *sendData, T *recvData, int len, int root) const
Scatter array from a root to all other task.
Definition communication.hh:376
│ │ │ │ +
int gather(const T *in, T *out, int len, int root) const
Gather arrays on root task.
Definition communication.hh:313
│ │ │ │ +
PseudoFuture< T > iallreduce(T &&data)
Compute something over all processes nonblocking and in-place.
Definition communication.hh:506
│ │ │ │ +
Communication(const Communicator &)
Constructor with a given communicator.
Definition communication.hh:110
│ │ │ │ +
int max(T *inout, int len) const
Compute the maximum over all processes for each component of an array and return the result in every ...
Definition communication.hh:259
│ │ │ │ +
T prod(const T &in) const
Compute the product of the argument over all processes and return the result in every process....
Definition communication.hh:208
│ │ │ │ +
int broadcast(T *inout, int len, int root) const
Distribute an array from the process with rank root to all other processes.
Definition communication.hh:284
│ │ │ │ +
T rrecv(T &&data, int source_rank, int tag, void *status=0) const
Definition communication.hh:177
│ │ │ │ +
PseudoFuture< TOUT > iscatter(TIN &&data_in, TOUT &&data_out, int root)
Scatter array from a root to all other task nonblocking.
Definition communication.hh:387
│ │ │ │ +
int min(T *inout, int len) const
Compute the minimum over all processes for each component of an array and return the result in every ...
Definition communication.hh:239
│ │ │ │ +
int barrier() const
Wait until all processes have arrived at this point in the program.
Definition communication.hh:267
│ │ │ │ +
PseudoFuture< TOUT > igather(TIN &&data_in, TOUT &&data_out, int root)
Gather arrays on root task nonblocking.
Definition communication.hh:324
│ │ │ │ +
PseudoFuture< TOUT > iallgather(TIN &&data_in, TOUT &&data_out)
Gathers data from all tasks and distribute it to all nonblocking.
Definition communication.hh:445
│ │ │ │ +
Communication()
Construct default object.
Definition communication.hh:103
│ │ │ │ +
A wrapper-class for a object which is ready immediately.
Definition future.hh:122
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,59 +1,480 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -make_array.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +communication.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-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: 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_COMMON_STD_MAKE_ARRAY_HH │ │ │ │ │ -4#define DUNE_COMMON_STD_MAKE_ARRAY_HH │ │ │ │ │ -5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8 │ │ │ │ │ -9#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ -10#include │ │ │ │ │ -11#endif │ │ │ │ │ -12 │ │ │ │ │ -13#warning make_array.hh is deprecated and will be removed after Dune 2.9. \ │ │ │ │ │ -14 Use deduction guide of `std::array` or `std::to_array`. │ │ │ │ │ -15 │ │ │ │ │ -16namespace _D_u_n_e { │ │ │ │ │ -17namespace Std { │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +5#ifndef DUNE_COMMON_PARALLEL_COMMUNICATION_HH │ │ │ │ │ +6#define DUNE_COMMON_PARALLEL_COMMUNICATION_HH │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ 18 │ │ │ │ │ -19#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ -20 │ │ │ │ │ -22 using std::experimental::make_array; │ │ │ │ │ -23 │ │ │ │ │ -24#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ -25 │ │ │ │ │ -27 │ │ │ │ │ -41 template │ │ │ │ │ -42 std::array::type, sizeof...(Args)> │ │ │ │ │ -_4_3 _m_a_k_e___a_r_r_a_y(const Args&... args) { │ │ │ │ │ -44 std::array::type, sizeof...(Args)> │ │ │ │ │ -45 result = {{args...}}; │ │ │ │ │ -46 return result; │ │ │ │ │ -47 } │ │ │ │ │ -48 │ │ │ │ │ -49#endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ -50 │ │ │ │ │ -51} │ │ │ │ │ -52} │ │ │ │ │ -53 │ │ │ │ │ -54#endif │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_a_k_e___a_r_r_a_y │ │ │ │ │ -std::array< typename std::common_type< Args... >::type, sizeof...(Args)> │ │ │ │ │ -make_array(const Args &... args) │ │ │ │ │ -Create and initialize an array. │ │ │ │ │ -DDeeffiinniittiioonn make_array.hh:43 │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_e_._h_h> │ │ │ │ │ +22 │ │ │ │ │ +42namespace _D_u_n_e │ │ │ │ │ +43{ │ │ │ │ │ +44 │ │ │ │ │ +45 /* define some type that definitely differs from MPI_Comm */ │ │ │ │ │ +_4_6 struct _N_o___C_o_m_m {}; │ │ │ │ │ +47 │ │ │ │ │ +_5_2 inline bool _o_p_e_r_a_t_o_r_=_=(const _N_o___C_o_m_m&, const _N_o___C_o_m_m&) │ │ │ │ │ +53 { │ │ │ │ │ +54 return true; │ │ │ │ │ +55 } │ │ │ │ │ +56 │ │ │ │ │ +_6_1 inline bool _o_p_e_r_a_t_o_r_!_=(const _N_o___C_o_m_m&, const _N_o___C_o_m_m&) │ │ │ │ │ +62 { │ │ │ │ │ +63 return false; │ │ │ │ │ +64 } │ │ │ │ │ +65 │ │ │ │ │ +98 template │ │ │ │ │ +_9_9 class _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +100 { │ │ │ │ │ +101 public: │ │ │ │ │ +_1_0_3 _C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ +104 {} │ │ │ │ │ +105 │ │ │ │ │ +_1_1_0 _C_o_m_m_u_n_i_c_a_t_i_o_n (const Communicator&) │ │ │ │ │ +111 {} │ │ │ │ │ +112 │ │ │ │ │ +_1_1_4 int _r_a_n_k () const │ │ │ │ │ +115 { │ │ │ │ │ +116 return 0; │ │ │ │ │ +117 } │ │ │ │ │ +118 │ │ │ │ │ +_1_2_0 operator _N_o___C_o_m_m() const │ │ │ │ │ +121 { │ │ │ │ │ +122 return {}; │ │ │ │ │ +123 } │ │ │ │ │ +124 │ │ │ │ │ +_1_2_6 int _s_i_z_e () const │ │ │ │ │ +127 { │ │ │ │ │ +128 return 1; │ │ │ │ │ +129 } │ │ │ │ │ +130 │ │ │ │ │ +134 template │ │ │ │ │ +_1_3_5 int _s_e_n_d([[maybe_unused]] const T& data, │ │ │ │ │ +136 [[maybe_unused]] int dest_rank, │ │ │ │ │ +137 [[maybe_unused]] int tag) │ │ │ │ │ +138 { │ │ │ │ │ +139 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ +programs"); │ │ │ │ │ +140 } │ │ │ │ │ +141 │ │ │ │ │ +145 template │ │ │ │ │ +_1_4_6 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_s_e_n_d([[maybe_unused]] const T&& data, │ │ │ │ │ +147 [[maybe_unused]] int dest_rank, │ │ │ │ │ +148 [[maybe_unused]] int tag) │ │ │ │ │ +149 { │ │ │ │ │ +150 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ +programs"); │ │ │ │ │ +151 } │ │ │ │ │ +152 │ │ │ │ │ +156 template │ │ │ │ │ +_1_5_7 T _r_e_c_v([[maybe_unused]] T&& data, │ │ │ │ │ +158 [[maybe_unused]] int source_rank, │ │ │ │ │ +159 [[maybe_unused]] int tag, │ │ │ │ │ +160 [[maybe_unused]] void* status = 0) │ │ │ │ │ +161 { │ │ │ │ │ +162 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ +programs"); │ │ │ │ │ +163 } │ │ │ │ │ +164 │ │ │ │ │ +168 template │ │ │ │ │ +_1_6_9 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_r_e_c_v([[maybe_unused]] T&& data, │ │ │ │ │ +170 [[maybe_unused]] int source_rank, │ │ │ │ │ +171 [[maybe_unused]] int tag) │ │ │ │ │ +172 { │ │ │ │ │ +173 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ +programs"); │ │ │ │ │ +174 } │ │ │ │ │ +175 │ │ │ │ │ +176 template │ │ │ │ │ +_1_7_7 T _r_r_e_c_v([[maybe_unused]] T&& data, │ │ │ │ │ +178 [[maybe_unused]] int source_rank, │ │ │ │ │ +179 [[maybe_unused]] int tag, │ │ │ │ │ +180 [[maybe_unused]] void* status = 0) const │ │ │ │ │ +181 { │ │ │ │ │ +182 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ +programs"); │ │ │ │ │ +183 } │ │ │ │ │ +187 template │ │ │ │ │ +_1_8_8 T _s_u_m (const T& in) const │ │ │ │ │ +189 { │ │ │ │ │ +190 return in; │ │ │ │ │ +191 } │ │ │ │ │ +192 │ │ │ │ │ +198 template │ │ │ │ │ +_1_9_9 int _s_u_m ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ +200 { │ │ │ │ │ +201 return 0; │ │ │ │ │ +202 } │ │ │ │ │ +203 │ │ │ │ │ +207 template │ │ │ │ │ +_2_0_8 T _p_r_o_d (const T& in) const │ │ │ │ │ +209 { │ │ │ │ │ +210 return in; │ │ │ │ │ +211 } │ │ │ │ │ +212 │ │ │ │ │ +218 template │ │ │ │ │ +_2_1_9 int _p_r_o_d ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ +220 { │ │ │ │ │ +221 return 0; │ │ │ │ │ +222 } │ │ │ │ │ +223 │ │ │ │ │ +227 template │ │ │ │ │ +_2_2_8 T _m_i_n (const T& in) const │ │ │ │ │ +229 { │ │ │ │ │ +230 return in; │ │ │ │ │ +231 } │ │ │ │ │ +232 │ │ │ │ │ +238 template │ │ │ │ │ +_2_3_9 int _m_i_n ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ +240 { │ │ │ │ │ +241 return 0; │ │ │ │ │ +242 } │ │ │ │ │ +243 │ │ │ │ │ +247 template │ │ │ │ │ +_2_4_8 T _m_a_x (const T& in) const │ │ │ │ │ +249 { │ │ │ │ │ +250 return in; │ │ │ │ │ +251 } │ │ │ │ │ +252 │ │ │ │ │ +258 template │ │ │ │ │ +_2_5_9 int _m_a_x ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ +260 { │ │ │ │ │ +261 return 0; │ │ │ │ │ +262 } │ │ │ │ │ +263 │ │ │ │ │ +_2_6_7 int _b_a_r_r_i_e_r () const │ │ │ │ │ +268 { │ │ │ │ │ +269 return 0; │ │ │ │ │ +270 } │ │ │ │ │ +271 │ │ │ │ │ +_2_7_5 _P_s_e_u_d_o_F_u_t_u_r_e_<_v_o_i_d_> _i_b_a_r_r_i_e_r () const │ │ │ │ │ +276 { │ │ │ │ │ +277 return {true}; // return a valid future │ │ │ │ │ +278 } │ │ │ │ │ +279 │ │ │ │ │ +283 template │ │ │ │ │ +_2_8_4 int _b_r_o_a_d_c_a_s_t ([[maybe_unused]] T* inout, │ │ │ │ │ +285 [[maybe_unused]] int len, │ │ │ │ │ +286 [[maybe_unused]] int root) const │ │ │ │ │ +287 { │ │ │ │ │ +288 return 0; │ │ │ │ │ +289 } │ │ │ │ │ +290 │ │ │ │ │ +294 template │ │ │ │ │ +_2_9_5 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_b_r_o_a_d_c_a_s_t(T&& data, int root) const{ │ │ │ │ │ +296 return {std::forward(data)}; │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +299 │ │ │ │ │ +312 template │ │ │ │ │ +_3_1_3 int _g_a_t_h_e_r (const T* in, T* out, int len, [[maybe_unused]] int root) const │ │ │ │ │ +// note out must have same size as in │ │ │ │ │ +314 { │ │ │ │ │ +315 for (int i=0; i> │ │ │ │ │ +_3_2_4 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out, int root){ │ │ │ │ │ +325 *(data_out.begin()) = std::forward(data_in); │ │ │ │ │ +326 return {std::forward(data_out)}; │ │ │ │ │ +327 } │ │ │ │ │ +328 │ │ │ │ │ +329 │ │ │ │ │ +349 template │ │ │ │ │ +_3_5_0 int _g_a_t_h_e_r_v (const T* in, │ │ │ │ │ +351 int sendDataLen, │ │ │ │ │ +352 T* out, │ │ │ │ │ +353 [[maybe_unused]] int* recvDataLen, │ │ │ │ │ +354 int* displ, │ │ │ │ │ +355 [[maybe_unused]] int root) const │ │ │ │ │ +356 { │ │ │ │ │ +357 for (int i=*displ; i │ │ │ │ │ +_3_7_6 int _s_c_a_t_t_e_r (const T* sendData, T* recvData, int len, [[maybe_unused]] int │ │ │ │ │ +root) const // note out must have same size as in │ │ │ │ │ +377 { │ │ │ │ │ +378 for (int i=0; i │ │ │ │ │ +_3_8_7 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_s_c_a_t_t_e_r(TIN&& data_in, TOUT&& data_out, int root){ │ │ │ │ │ +388 data_out = *(std::forward(data_in).begin()); │ │ │ │ │ +389 return {std::forward(data_out)}; │ │ │ │ │ +390 } │ │ │ │ │ +391 │ │ │ │ │ +410 template │ │ │ │ │ +_4_1_1 int _s_c_a_t_t_e_r_v (const T* sendData,int* sendDataLen, int* displ, T* recvData, │ │ │ │ │ +412 [[maybe_unused]] int recvDataLen, [[maybe_unused]] int root) const │ │ │ │ │ +413 { │ │ │ │ │ +414 for (int i=*displ; i<*sendDataLen; i++) │ │ │ │ │ +415 recvData[i] = sendData[i]; │ │ │ │ │ +416 return 0; │ │ │ │ │ +417 } │ │ │ │ │ +418 │ │ │ │ │ +432 template │ │ │ │ │ +_4_3_3 int _a_l_l_g_a_t_h_e_r(const T* sbuf, int count, T* rbuf) const │ │ │ │ │ +434 { │ │ │ │ │ +435 for(const T* end=sbuf+count; sbuf < end; ++sbuf, ++rbuf) │ │ │ │ │ +436 *rbuf=*sbuf; │ │ │ │ │ +437 return 0; │ │ │ │ │ +438 } │ │ │ │ │ +439 │ │ │ │ │ +444 template │ │ │ │ │ +_4_4_5 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_a_l_l_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out){ │ │ │ │ │ +446 return {std::forward(data_out)}; │ │ │ │ │ +447 } │ │ │ │ │ +448 │ │ │ │ │ +465 template │ │ │ │ │ +_4_6_6 int _a_l_l_g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, [[maybe_unused]] int* │ │ │ │ │ +recvDataLen, int* displ) const │ │ │ │ │ +467 { │ │ │ │ │ +468 for (int i=*displ; i │ │ │ │ │ +_4_8_6 int _a_l_l_r_e_d_u_c_e([[maybe_unused]] Type* inout, [[maybe_unused]] int len) const │ │ │ │ │ +487 { │ │ │ │ │ +488 return 0; │ │ │ │ │ +489 } │ │ │ │ │ +490 │ │ │ │ │ +495 template │ │ │ │ │ +_4_9_6 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_a_l_l_r_e_d_u_c_e(TIN&& data_in, TOUT&& data_out){ │ │ │ │ │ +497 data_out = std::forward(data_in); │ │ │ │ │ +498 return {std::forward(data_out)}; │ │ │ │ │ +499 } │ │ │ │ │ +500 │ │ │ │ │ +505 template │ │ │ │ │ +_5_0_6 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_a_l_l_r_e_d_u_c_e(T&& data){ │ │ │ │ │ +507 return {std::forward(data)}; │ │ │ │ │ +508 } │ │ │ │ │ +509 │ │ │ │ │ +510 │ │ │ │ │ +524 template │ │ │ │ │ +_5_2_5 int _a_l_l_r_e_d_u_c_e(const Type* in, Type* out, int len) const │ │ │ │ │ +526 { │ │ │ │ │ +527 std::copy(in, in+len, out); │ │ │ │ │ +528 return 0; │ │ │ │ │ +529 } │ │ │ │ │ +530 │ │ │ │ │ +531 }; │ │ │ │ │ +532 │ │ │ │ │ +538 template │ │ │ │ │ +_5_3_9 using _C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +540 [[deprecated("CollectiveCommunication is deprecated. Use Communication │ │ │ │ │ +instead.")]] │ │ │ │ │ +541 = _C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_>; │ │ │ │ │ +542} │ │ │ │ │ +543 │ │ │ │ │ +544#endif │ │ │ │ │ +_f_u_t_u_r_e_._h_h │ │ │ │ │ +_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h │ │ │ │ │ +helper classes to provide unique types for standard functions │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for equality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for inequality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_E_r_r_o_r │ │ │ │ │ +Default exception if an error in the parallel communication of the program │ │ │ │ │ +occurred. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:287 │ │ │ │ │ +_D_u_n_e_:_:_N_o___C_o_m_m │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Collective communication interface and sequential default implementation. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ +PseudoFuture< TOUT > iallreduce(TIN &&data_in, TOUT &&data_out) │ │ │ │ │ +Compute something over all processes nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:496 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_e_n_d │ │ │ │ │ +int send(const T &data, int dest_rank, int tag) │ │ │ │ │ +Sends the data to the dest_rank. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:135 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ +int allreduce(const Type *in, Type *out, int len) const │ │ │ │ │ +Compute something over all processes for each component of an array and return │ │ │ │ │ +the result in every pr... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:525 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_a_x │ │ │ │ │ +T max(const T &in) const │ │ │ │ │ +Compute the maximum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:248 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_a_n_k │ │ │ │ │ +int rank() const │ │ │ │ │ +Return rank, is between 0 and size()-1. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:114 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_u_m │ │ │ │ │ +T sum(const T &in) const │ │ │ │ │ +Compute the sum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_c_a_t_t_e_r_v │ │ │ │ │ +int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int │ │ │ │ │ +recvDataLen, int root) const │ │ │ │ │ +Scatter arrays of variable length from a root to all other tasks. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:411 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_d │ │ │ │ │ +int prod(T *inout, int len) const │ │ │ │ │ +Compute the product over all processes for each component of an array and │ │ │ │ │ +return the result in every ... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_c_v │ │ │ │ │ +T recv(T &&data, int source_rank, int tag, void *status=0) │ │ │ │ │ +Receives the data from the source_rank. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_s_e_n_d │ │ │ │ │ +PseudoFuture< T > isend(const T &&data, int dest_rank, int tag) │ │ │ │ │ +Sends the data to the dest_rank nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:146 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_b_a_r_r_i_e_r │ │ │ │ │ +PseudoFuture< void > ibarrier() const │ │ │ │ │ +Nonblocking barrier. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ +int allreduce(Type *inout, int len) const │ │ │ │ │ +Compute something over all processes for each component of an array and return │ │ │ │ │ +the result in every pr... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:486 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +Number of processes in set, is greater than 0. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_u_m │ │ │ │ │ +int sum(T *inout, int len) const │ │ │ │ │ +Compute the sum over all processes for each component of an array and return │ │ │ │ │ +the result in every proc... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:199 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_g_a_t_h_e_r_v │ │ │ │ │ +int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int │ │ │ │ │ +*displ) const │ │ │ │ │ +Gathers data of variable length from all tasks and distribute it to all. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_i_n │ │ │ │ │ +T min(const T &in) const │ │ │ │ │ +Compute the minimum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:228 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_r_e_c_v │ │ │ │ │ +PseudoFuture< T > irecv(T &&data, int source_rank, int tag) │ │ │ │ │ +Receives the data from the source_rank nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:169 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_a_t_h_e_r_v │ │ │ │ │ +int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, │ │ │ │ │ +int root) const │ │ │ │ │ +Gather arrays of variable size on root task. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:350 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_b_r_o_a_d_c_a_s_t │ │ │ │ │ +PseudoFuture< T > ibroadcast(T &&data, int root) const │ │ │ │ │ +Distribute an array from the process with rank root to all other processes │ │ │ │ │ +nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:295 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_g_a_t_h_e_r │ │ │ │ │ +int allgather(const T *sbuf, int count, T *rbuf) const │ │ │ │ │ +Gathers data from all tasks and distribute it to all. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:433 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_c_a_t_t_e_r │ │ │ │ │ +int scatter(const T *sendData, T *recvData, int len, int root) const │ │ │ │ │ +Scatter array from a root to all other task. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:376 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_a_t_h_e_r │ │ │ │ │ +int gather(const T *in, T *out, int len, int root) const │ │ │ │ │ +Gather arrays on root task. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:313 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ +PseudoFuture< T > iallreduce(T &&data) │ │ │ │ │ +Compute something over all processes nonblocking and in-place. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:506 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Communication(const Communicator &) │ │ │ │ │ +Constructor with a given communicator. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_a_x │ │ │ │ │ +int max(T *inout, int len) const │ │ │ │ │ +Compute the maximum over all processes for each component of an array and │ │ │ │ │ +return the result in every ... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_d │ │ │ │ │ +T prod(const T &in) const │ │ │ │ │ +Compute the product of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:208 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_r_o_a_d_c_a_s_t │ │ │ │ │ +int broadcast(T *inout, int len, int root) const │ │ │ │ │ +Distribute an array from the process with rank root to all other processes. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:284 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_r_e_c_v │ │ │ │ │ +T rrecv(T &&data, int source_rank, int tag, void *status=0) const │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:177 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_s_c_a_t_t_e_r │ │ │ │ │ +PseudoFuture< TOUT > iscatter(TIN &&data_in, TOUT &&data_out, int root) │ │ │ │ │ +Scatter array from a root to all other task nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:387 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_i_n │ │ │ │ │ +int min(T *inout, int len) const │ │ │ │ │ +Compute the minimum over all processes for each component of an array and │ │ │ │ │ +return the result in every ... │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:239 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_a_r_r_i_e_r │ │ │ │ │ +int barrier() const │ │ │ │ │ +Wait until all processes have arrived at this point in the program. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_g_a_t_h_e_r │ │ │ │ │ +PseudoFuture< TOUT > igather(TIN &&data_in, TOUT &&data_out, int root) │ │ │ │ │ +Gather arrays on root task nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_a_l_l_g_a_t_h_e_r │ │ │ │ │ +PseudoFuture< TOUT > iallgather(TIN &&data_in, TOUT &&data_out) │ │ │ │ │ +Gathers data from all tasks and distribute it to all nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:445 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Communication() │ │ │ │ │ +Construct default object. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:103 │ │ │ │ │ +_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ +A wrapper-class for a object which is ready immediately. │ │ │ │ │ +DDeeffiinniittiioonn future.hh:122 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00098.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: referencehelper.hh File Reference │ │ │ │ +dune-common: mpihelper.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,65 +65,72 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions | │ │ │ │ -Variables
│ │ │ │ -
referencehelper.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
mpihelper.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <type_traits>
│ │ │ │ -#include <functional>
│ │ │ │ + │ │ │ │ +

Helpers for dealing with MPI. │ │ │ │ +More...

│ │ │ │ +
#include <cassert>
│ │ │ │ +#include <mpi.h>
│ │ │ │ +#include <mutex>
│ │ │ │ +#include <dune/common/parallel/communication.hh>
│ │ │ │ +#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ │ +#include <dune/common/visibility.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::FakeMPIHelper
 A fake mpi helper. More...
 
class  Dune::MPIHelper
 A real mpi helper. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Typedefs

template<class T >
using Dune::ResolveRef_t = std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))>
 Type trait to resolve std::reference_wrapper.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Functions

template<class T >
constexpr T & Dune::resolveRef (T &gf) noexcept
 Helper function to resolve std::reference_wrapper.
 
template<class T >
const auto & Dune::resolveRef (T &&gf)=delete
 
template<class T >
constexpr T & Dune::resolveRef (std::reference_wrapper< T > gf) noexcept
 Helper function to resolve std::reference_wrapper.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Variables

template<class T >
constexpr bool Dune::IsReferenceWrapper_v = Impl::IsReferenceWrapper<T>::value
 Helper to detect if given type is a std::reference_wrapper.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Helpers for dealing with MPI.

│ │ │ │ +

Basically there are two helpers available:

│ │ │ │ +
FakeMPIHelper
│ │ │ │ +
A class adhering to the interface of MPIHelper that does not need MPI at all. This can be used to create a sequential program even if MPI is used to compile it.
│ │ │ │ +
MPIHelper
│ │ │ │ +
A real MPI helper. When the singleton gets instantiated MPI_Init will be called and before the program exits MPI_Finalize will be called.
│ │ │ │ +
│ │ │ │ +

Example of who to use these classes:

│ │ │ │ +

A program that is parallel if compiled with MPI and sequential otherwise:

int main(int argc, char** argv){
│ │ │ │ +
typedef Dune::MPIHelper MPIHelper;
│ │ │ │ +
MPIHelper::instance(argc, argv);
│ │ │ │ +
typename MPIHelper::MPICommunicator world =
│ │ │ │ +
MPIHelper::getCommunicator();
│ │ │ │ +
...
│ │ │ │ +
int main(int argc, char **argv)
Definition mpi_collective_benchmark.cc:293
│ │ │ │ +
A real mpi helper.
Definition mpihelper.hh:179
│ │ │ │ +

If one wants to have sequential program even if the code is compiled with mpi then one simply has to exchange the typedef with

typedef Dune::MPIHelper FakeMPIHelper;
│ │ │ │ +

.

│ │ │ │ +

For checking whether we really use MPI or just fake please use MPIHelper::isFake (this is also possible at compile time!)

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,40 +1,62 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ -referencehelper.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +mpihelper.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Helpers for dealing with MPI. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_i_s_i_b_i_l_i_t_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_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r │ │ │ │ │ +  A fake mpi helper. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ +  A real mpi helper. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_R_e_s_o_l_v_e_R_e_f___t = std::remove_reference_t< decltype(_D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f │ │ │ │ │ - (std::declval< T & >()))> │ │ │ │ │ -  Type trait to resolve std::reference_wrapper. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -constexpr T &  _D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f (T &gf) noexcept │ │ │ │ │ -  Helper function to resolve std::reference_wrapper. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - const auto &  _D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f (T &&gf)=delete │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -constexpr T &  _D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f (std::reference_wrapper< T > gf) noexcept │ │ │ │ │ -  Helper function to resolve std::reference_wrapper. │ │ │ │ │ -  │ │ │ │ │ -VVaarriiaabblleess │ │ │ │ │ -template │ │ │ │ │ -constexpr bool  _D_u_n_e_:_:_I_s_R_e_f_e_r_e_n_c_e_W_r_a_p_p_e_r___v = Impl::IsReferenceWrapper::value │ │ │ │ │ -  Helper to detect if given type is a std::reference_wrapper. │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Helpers for dealing with MPI. │ │ │ │ │ +Basically there are two helpers available: │ │ │ │ │ + FakeMPIHelper │ │ │ │ │ + A class adhering to the interface of MPIHelper that does not need MPI at │ │ │ │ │ + all. This can be used to create a sequential program even if MPI is used │ │ │ │ │ + to compile it. │ │ │ │ │ + MPIHelper │ │ │ │ │ + A real MPI helper. When the singleton gets instantiated MPI_Init will be │ │ │ │ │ + called and before the program exits MPI_Finalize will be called. │ │ │ │ │ +Example of who to use these classes: │ │ │ │ │ +A program that is parallel if compiled with MPI and sequential otherwise: │ │ │ │ │ +int _m_a_i_n(int argc, char** argv){ │ │ │ │ │ +typedef _D_u_n_e_:_:_M_P_I_H_e_l_p_e_r MPIHelper; │ │ │ │ │ +MPIHelper::instance(argc, argv); │ │ │ │ │ +typename MPIHelper::MPICommunicator world = │ │ │ │ │ +MPIHelper::getCommunicator(); │ │ │ │ │ +... │ │ │ │ │ +_m_a_i_n │ │ │ │ │ +int main(int argc, char **argv) │ │ │ │ │ +DDeeffiinniittiioonn mpi_collective_benchmark.cc:293 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ +A real mpi helper. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:179 │ │ │ │ │ +If one wants to have sequential program even if the code is compiled with mpi │ │ │ │ │ +then one simply has to exchange the typedef with │ │ │ │ │ +typedef _D_u_n_e_:_:_M_P_I_H_e_l_p_e_r FakeMPIHelper; │ │ │ │ │ +. │ │ │ │ │ +For checking whether we really use MPI or just fake please use MPIHelper:: │ │ │ │ │ +isFake (this is also possible at compile time!) │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00098_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: referencehelper.hh Source File │ │ │ │ +dune-common: mpihelper.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,96 +70,267 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
referencehelper.hh
│ │ │ │ +
mpihelper.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_COMMON_REFERENCE_HELPER_HH
│ │ │ │ -
6#define DUNE_COMMON_REFERENCE_HELPER_HH
│ │ │ │ +
5#ifndef DUNE_MPIHELPER
│ │ │ │ +
6#define DUNE_MPIHELPER
│ │ │ │
7
│ │ │ │ -
8#include <type_traits>
│ │ │ │ -
9#include <functional>
│ │ │ │ -
10
│ │ │ │ -
11
│ │ │ │ +
8#if HAVE_MPI
│ │ │ │ +
9#include <cassert>
│ │ │ │ +
10#include <mpi.h>
│ │ │ │ +
11#endif
│ │ │ │
12
│ │ │ │ -
13namespace Dune {
│ │ │ │ +
13#include <mutex>
│ │ │ │
14
│ │ │ │ -
15namespace Impl {
│ │ │ │ -
16
│ │ │ │ -
17 template<class T>
│ │ │ │ -
18 class IsReferenceWrapper : public std::false_type {};
│ │ │ │ -
19
│ │ │ │ -
20 template<class T>
│ │ │ │ -
21 class IsReferenceWrapper<std::reference_wrapper<T>> : public std::true_type {};
│ │ │ │ -
22
│ │ │ │ -
23 template<class T>
│ │ │ │ -
24 class IsReferenceWrapper<const std::reference_wrapper<T>> : public std::true_type {};
│ │ │ │ -
25
│ │ │ │ -
26} // namespace Dune::Impl
│ │ │ │ -
27
│ │ │ │ -
28
│ │ │ │ -
34template<class T>
│ │ │ │ -
35constexpr bool IsReferenceWrapper_v = Impl::IsReferenceWrapper<T>::value;
│ │ │ │ -
36
│ │ │ │ -
37
│ │ │ │ -
46template<class T>
│ │ │ │ -
│ │ │ │ -
47constexpr T& resolveRef(T& gf) noexcept
│ │ │ │ -
48{
│ │ │ │ -
49 return gf;
│ │ │ │ -
50}
│ │ │ │ -
│ │ │ │ -
51
│ │ │ │ -
52
│ │ │ │ -
53// There's no overload for non std::reference_wrapper r-values,
│ │ │ │ -
54// because this may lead to undefined behavior whenever the
│ │ │ │ -
55// return value is stored.
│ │ │ │ -
56// Notice that deleting the overload is not necessary, but
│ │ │ │ -
57// helps to document that it is missing on purpose. It also
│ │ │ │ -
58// leads to nicer error messages.
│ │ │ │ -
59template<class T>
│ │ │ │ -
60const auto& resolveRef(T&& gf) = delete;
│ │ │ │ -
61
│ │ │ │ -
62
│ │ │ │ -
81template<class T>
│ │ │ │ -
│ │ │ │ -
82constexpr T& resolveRef(std::reference_wrapper<T> gf) noexcept
│ │ │ │ -
83{
│ │ │ │ -
84 return gf.get();
│ │ │ │ -
85}
│ │ │ │ -
│ │ │ │ + │ │ │ │ +
16#if HAVE_MPI
│ │ │ │ + │ │ │ │ + │ │ │ │ +
19#endif
│ │ │ │ + │ │ │ │ +
21
│ │ │ │ +
22namespace Dune
│ │ │ │ +
23{
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
74 {
│ │ │ │ +
75 public:
│ │ │ │ +
80 constexpr static bool isFake = true;
│ │ │ │ +
81
│ │ │ │ + │ │ │ │
86
│ │ │ │ -
87
│ │ │ │ -
88
│ │ │ │ -
99template<class T>
│ │ │ │ -
100using ResolveRef_t = std::remove_reference_t<decltype(Dune::resolveRef(std::declval<T&>()))>;
│ │ │ │ -
101
│ │ │ │ -
102
│ │ │ │ -
103} // namespace Dune
│ │ │ │ -
104
│ │ │ │ -
105
│ │ │ │ -
106
│ │ │ │ -
107#endif // DUNE_COMMON_REFERENCE_HELPER_HH
│ │ │ │ -
constexpr bool IsReferenceWrapper_v
Helper to detect if given type is a std::reference_wrapper.
Definition referencehelper.hh:35
│ │ │ │ -
constexpr T & resolveRef(T &gf) noexcept
Helper function to resolve std::reference_wrapper.
Definition referencehelper.hh:47
│ │ │ │ -
STL namespace.
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
94 {
│ │ │ │ +
95 static MPICommunicator comm;
│ │ │ │ +
96 return comm;
│ │ │ │ +
97 }
│ │ │ │ +
│ │ │ │ +
98
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
106 {
│ │ │ │ +
107 return getCommunicator();
│ │ │ │ +
108 }
│ │ │ │ +
│ │ │ │ +
109
│ │ │ │ +
110
│ │ │ │ +
111
│ │ │ │ +
117 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
119 {
│ │ │ │ + │ │ │ │ +
121 }
│ │ │ │ +
│ │ │ │ +
122
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
125 {
│ │ │ │ + │ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │ +
128
│ │ │ │ +
│ │ │ │ +
144 DUNE_EXPORT static FakeMPIHelper& instance([[maybe_unused]] int argc,
│ │ │ │ +
145 [[maybe_unused]] char** argv)
│ │ │ │ +
146 {
│ │ │ │ +
147 return instance();
│ │ │ │ +
148 }
│ │ │ │ +
│ │ │ │ +
149
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
151 {
│ │ │ │ +
152 static FakeMPIHelper singleton;
│ │ │ │ +
153 return singleton;
│ │ │ │ +
154 }
│ │ │ │ +
│ │ │ │ +
155
│ │ │ │ +
159 int rank () const { return 0; }
│ │ │ │ +
163 int size () const { return 1; }
│ │ │ │ +
164
│ │ │ │ +
165 private:
│ │ │ │ +
166 FakeMPIHelper() {}
│ │ │ │ +
167 FakeMPIHelper(const FakeMPIHelper&);
│ │ │ │ +
168 FakeMPIHelper& operator=(const FakeMPIHelper);
│ │ │ │ +
169 };
│ │ │ │ +
│ │ │ │ +
170
│ │ │ │ +
171#if HAVE_MPI
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
179 {
│ │ │ │ +
180 public:
│ │ │ │ +
185 constexpr static bool isFake = false;
│ │ │ │ +
186
│ │ │ │ +
190 typedef MPI_Comm MPICommunicator;
│ │ │ │ +
191
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
199 {
│ │ │ │ +
200 return MPI_COMM_WORLD;
│ │ │ │ +
201 }
│ │ │ │ +
│ │ │ │ +
202
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
210 {
│ │ │ │ +
211 return MPI_COMM_SELF;
│ │ │ │ +
212 }
│ │ │ │ +
│ │ │ │ +
213
│ │ │ │ +
219 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
222 {
│ │ │ │ + │ │ │ │ +
224 }
│ │ │ │ +
│ │ │ │ +
225
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
228 {
│ │ │ │ + │ │ │ │ +
230 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
246 DUNE_EXPORT static MPIHelper& instance(int& argc, char**& argv)
│ │ │ │ +
247 {
│ │ │ │ +
248 // create singleton instance
│ │ │ │ +
249 if (!instance_){
│ │ │ │ +
250 static std::mutex mutex;
│ │ │ │ +
251 std::lock_guard<std::mutex> guard(mutex);
│ │ │ │ +
252 if(!instance_)
│ │ │ │ +
253 instance_.reset(new MPIHelper(argc,argv));
│ │ │ │ +
254 }
│ │ │ │ +
255 return *instance_;
│ │ │ │ +
256 }
│ │ │ │ +
│ │ │ │ +
257
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
259 {
│ │ │ │ +
260 if(!instance_)
│ │ │ │ +
261 DUNE_THROW(InvalidStateException, "MPIHelper not initialized! Call MPIHelper::instance(argc, argv) with arguments first.");
│ │ │ │ +
262 return *instance_;
│ │ │ │ +
263 }
│ │ │ │ +
│ │ │ │ +
264
│ │ │ │ +
268 int rank () const { return rank_; }
│ │ │ │ +
272 int size () const { return size_; }
│ │ │ │ +
273
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
276 {
│ │ │ │ +
277 int wasFinalized = -1;
│ │ │ │ +
278 MPI_Finalized( &wasFinalized );
│ │ │ │ +
279 if(!wasFinalized && initializedHere_)
│ │ │ │ +
280 {
│ │ │ │ +
281 MPI_Finalize();
│ │ │ │ +
282 dverb << "Called MPI_Finalize on p=" << rank_ << "!" <<std::endl;
│ │ │ │ +
283 }
│ │ │ │ +
284
│ │ │ │ +
285 }
│ │ │ │ +
│ │ │ │ +
286
│ │ │ │ +
287 private:
│ │ │ │ +
288 int rank_;
│ │ │ │ +
289 int size_;
│ │ │ │ +
290 bool initializedHere_;
│ │ │ │ +
291 void prevent_warning(int){}
│ │ │ │ +
292 static inline std::unique_ptr<MPIHelper> instance_ = {};
│ │ │ │ +
293
│ │ │ │ +
295 MPIHelper(int& argc, char**& argv)
│ │ │ │ +
296 : initializedHere_(false)
│ │ │ │ +
297 {
│ │ │ │ +
298 int wasInitialized = -1;
│ │ │ │ +
299 MPI_Initialized( &wasInitialized );
│ │ │ │ +
300 if(!wasInitialized)
│ │ │ │ +
301 {
│ │ │ │ +
302 rank_ = -1;
│ │ │ │ +
303 size_ = -1;
│ │ │ │ +
304 static int is_initialized = MPI_Init(&argc, &argv);
│ │ │ │ +
305 prevent_warning(is_initialized);
│ │ │ │ +
306 initializedHere_ = true;
│ │ │ │ +
307 }
│ │ │ │ +
308
│ │ │ │ +
309 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
│ │ │ │ +
310 MPI_Comm_size(MPI_COMM_WORLD,&size_);
│ │ │ │ +
311
│ │ │ │ +
312 assert( rank_ >= 0 );
│ │ │ │ +
313 assert( size_ >= 1 );
│ │ │ │ +
314
│ │ │ │ +
315 dverb << "Called MPI_Init on p=" << rank_ << "!" << std::endl;
│ │ │ │ +
316 }
│ │ │ │ +
317
│ │ │ │ +
318 MPIHelper(const MPIHelper&);
│ │ │ │ +
319 MPIHelper& operator=(const MPIHelper);
│ │ │ │ +
320 };
│ │ │ │ +
│ │ │ │ +
321#else // !HAVE_MPI
│ │ │ │ +
322 // We do not have MPI therefore FakeMPIHelper
│ │ │ │ +
323 // is the MPIHelper
│ │ │ │ +
328 typedef FakeMPIHelper MPIHelper;
│ │ │ │ +
329
│ │ │ │ +
330#endif // !HAVE_MPI
│ │ │ │ +
331
│ │ │ │ +
332} // end namespace Dune
│ │ │ │ +
333#endif
│ │ │ │ +
Standard Dune debug streams.
│ │ │ │ +
Implements an utility class that provides collective communication methods for sequential programs.
│ │ │ │ +
Implements an utility class that provides MPI's collective communication methods.
│ │ │ │ +
Definition of macros controlling symbol visibility at the ABI level.
│ │ │ │ +
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition visibility.hh:20
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition stdstreams.hh:116
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))> ResolveRef_t
Type trait to resolve std::reference_wrapper.
Definition referencehelper.hh:100
│ │ │ │ +
Default exception if a function was called while the object is not in a valid state for that function...
Definition exceptions.hh:281
│ │ │ │ +
Definition communication.hh:46
│ │ │ │ +
Collective communication interface and sequential default implementation.
Definition communication.hh:100
│ │ │ │ +
A fake mpi helper.
Definition mpihelper.hh:74
│ │ │ │ +
static DUNE_EXPORT MPICommunicator getCommunicator()
get the default communicator
Definition mpihelper.hh:93
│ │ │ │ +
int size() const
return rank of process, i.e. one
Definition mpihelper.hh:163
│ │ │ │ +
static Communication< MPICommunicator > getCollectiveCommunication()
Definition mpihelper.hh:118
│ │ │ │ +
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition mpihelper.hh:105
│ │ │ │ +
No_Comm MPICommunicator
The type of the mpi communicator.
Definition mpihelper.hh:85
│ │ │ │ +
static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
Get the singleton instance of the helper.
Definition mpihelper.hh:144
│ │ │ │ +
static DUNE_EXPORT FakeMPIHelper & instance()
Definition mpihelper.hh:150
│ │ │ │ +
static Communication< MPICommunicator > getCommunication()
Definition mpihelper.hh:124
│ │ │ │ +
static constexpr bool isFake
Are we fake (i.e. pretend to have MPI support but are compiled without.)
Definition mpihelper.hh:80
│ │ │ │ +
int rank() const
return rank of process, i.e. zero
Definition mpihelper.hh:159
│ │ │ │ +
A real mpi helper.
Definition mpihelper.hh:179
│ │ │ │ +
int size() const
return number of processes
Definition mpihelper.hh:272
│ │ │ │ +
static DUNE_EXPORT MPIHelper & instance()
Definition mpihelper.hh:258
│ │ │ │ +
static constexpr bool isFake
Are we fake (i. e. pretend to have MPI support but are compiled without.
Definition mpihelper.hh:185
│ │ │ │ +
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition mpihelper.hh:246
│ │ │ │ +
static Communication< MPICommunicator > getCommunication()
Definition mpihelper.hh:227
│ │ │ │ +
~MPIHelper()
calls MPI_Finalize
Definition mpihelper.hh:275
│ │ │ │ +
int rank() const
return rank of process
Definition mpihelper.hh:268
│ │ │ │ +
MPI_Comm MPICommunicator
The type of the mpi communicator.
Definition mpihelper.hh:190
│ │ │ │ +
static MPICommunicator getCommunicator()
get the default communicator
Definition mpihelper.hh:198
│ │ │ │ +
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition mpihelper.hh:209
│ │ │ │ +
static Communication< MPICommunicator > getCollectiveCommunication()
Definition mpihelper.hh:221
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,98 +1,314 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -referencehelper.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpihelper.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_REFERENCE_HELPER_HH │ │ │ │ │ -6#define DUNE_COMMON_REFERENCE_HELPER_HH │ │ │ │ │ +5#ifndef DUNE_MPIHELPER │ │ │ │ │ +6#define DUNE_MPIHELPER │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11 │ │ │ │ │ +8#if HAVE_MPI │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#endif │ │ │ │ │ 12 │ │ │ │ │ -13namespace _D_u_n_e { │ │ │ │ │ +13#include │ │ │ │ │ 14 │ │ │ │ │ -15namespace Impl { │ │ │ │ │ -16 │ │ │ │ │ -17 template │ │ │ │ │ -18 class IsReferenceWrapper : public std::false_type {}; │ │ │ │ │ -19 │ │ │ │ │ -20 template │ │ │ │ │ -21 class IsReferenceWrapper<_s_t_d::reference_wrapper> : public std::true_type │ │ │ │ │ -{}; │ │ │ │ │ -22 │ │ │ │ │ -23 template │ │ │ │ │ -24 class IsReferenceWrapper> : public std:: │ │ │ │ │ -true_type {}; │ │ │ │ │ -25 │ │ │ │ │ -26} // namespace Dune::Impl │ │ │ │ │ -27 │ │ │ │ │ -28 │ │ │ │ │ -34template │ │ │ │ │ -_3_5constexpr bool _I_s_R_e_f_e_r_e_n_c_e_W_r_a_p_p_e_r___v = Impl::IsReferenceWrapper::value; │ │ │ │ │ -36 │ │ │ │ │ -37 │ │ │ │ │ -46template │ │ │ │ │ -_4_7constexpr T& _r_e_s_o_l_v_e_R_e_f(T& gf) noexcept │ │ │ │ │ -48{ │ │ │ │ │ -49 return gf; │ │ │ │ │ -50} │ │ │ │ │ -51 │ │ │ │ │ -52 │ │ │ │ │ -53// There's no overload for non std::reference_wrapper r-values, │ │ │ │ │ -54// because this may lead to undefined behavior whenever the │ │ │ │ │ -55// return value is stored. │ │ │ │ │ -56// Notice that deleting the overload is not necessary, but │ │ │ │ │ -57// helps to document that it is missing on purpose. It also │ │ │ │ │ -58// leads to nicer error messages. │ │ │ │ │ -59template │ │ │ │ │ -_6_0const auto& _r_e_s_o_l_v_e_R_e_f(T&& gf) = delete; │ │ │ │ │ -61 │ │ │ │ │ -62 │ │ │ │ │ -81template │ │ │ │ │ -_8_2constexpr T& _r_e_s_o_l_v_e_R_e_f(std::reference_wrapper gf) noexcept │ │ │ │ │ -83{ │ │ │ │ │ -84 return gf.get(); │ │ │ │ │ -85} │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +16#if HAVE_MPI │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ +19#endif │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_i_s_i_b_i_l_i_t_y_._h_h> │ │ │ │ │ +21 │ │ │ │ │ +22namespace _D_u_n_e │ │ │ │ │ +23{ │ │ │ │ │ +_7_3 class _F_a_k_e_M_P_I_H_e_l_p_e_r │ │ │ │ │ +74 { │ │ │ │ │ +75 public: │ │ │ │ │ +_8_0 constexpr static bool _i_s_F_a_k_e = true; │ │ │ │ │ +81 │ │ │ │ │ +_8_5 typedef _N_o___C_o_m_m _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ 86 │ │ │ │ │ -87 │ │ │ │ │ -88 │ │ │ │ │ -99template │ │ │ │ │ -_1_0_0using _R_e_s_o_l_v_e_R_e_f___t = std::remove_reference_t()))>; │ │ │ │ │ -101 │ │ │ │ │ -102 │ │ │ │ │ -103} // namespace Dune │ │ │ │ │ -104 │ │ │ │ │ -105 │ │ │ │ │ -106 │ │ │ │ │ -107#endif // DUNE_COMMON_REFERENCE_HELPER_HH │ │ │ │ │ -_D_u_n_e_:_:_I_s_R_e_f_e_r_e_n_c_e_W_r_a_p_p_e_r___v │ │ │ │ │ -constexpr bool IsReferenceWrapper_v │ │ │ │ │ -Helper to detect if given type is a std::reference_wrapper. │ │ │ │ │ -DDeeffiinniittiioonn referencehelper.hh:35 │ │ │ │ │ -_D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f │ │ │ │ │ -constexpr T & resolveRef(T &gf) noexcept │ │ │ │ │ -Helper function to resolve std::reference_wrapper. │ │ │ │ │ -DDeeffiinniittiioonn referencehelper.hh:47 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +_9_3 _D_U_N_E___E_X_P_O_R_T static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ +94 { │ │ │ │ │ +95 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r comm; │ │ │ │ │ +96 return comm; │ │ │ │ │ +97 } │ │ │ │ │ +98 │ │ │ │ │ +_1_0_5 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ +106 { │ │ │ │ │ +107 return _g_e_t_C_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ +108 } │ │ │ │ │ +109 │ │ │ │ │ +110 │ │ │ │ │ +111 │ │ │ │ │ +117 [[deprecated("getCollectionCommunication is deprecated. Use │ │ │ │ │ +getCommunication instead.")]] │ │ │ │ │ +_1_1_8 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> _g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ +119 { │ │ │ │ │ +120 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +121 } │ │ │ │ │ +122 │ │ │ │ │ +123 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> │ │ │ │ │ +_1_2_4 _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ +125 { │ │ │ │ │ +126 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +_1_4_4 _D_U_N_E___E_X_P_O_R_T static _F_a_k_e_M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e([[maybe_unused]] int argc, │ │ │ │ │ +145 [[maybe_unused]] char** argv) │ │ │ │ │ +146 { │ │ │ │ │ +147 return _i_n_s_t_a_n_c_e(); │ │ │ │ │ +148 } │ │ │ │ │ +149 │ │ │ │ │ +_1_5_0 _D_U_N_E___E_X_P_O_R_T static _F_a_k_e_M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e() │ │ │ │ │ +151 { │ │ │ │ │ +152 static _F_a_k_e_M_P_I_H_e_l_p_e_r singleton; │ │ │ │ │ +153 return singleton; │ │ │ │ │ +154 } │ │ │ │ │ +155 │ │ │ │ │ +_1_5_9 int _r_a_n_k () const { return 0; } │ │ │ │ │ +_1_6_3 int _s_i_z_e () const { return 1; } │ │ │ │ │ +164 │ │ │ │ │ +165 private: │ │ │ │ │ +166 _F_a_k_e_M_P_I_H_e_l_p_e_r() {} │ │ │ │ │ +167 FakeMPIHelper(const FakeMPIHelper&); │ │ │ │ │ +168 FakeMPIHelper& operator=(const FakeMPIHelper); │ │ │ │ │ +169 }; │ │ │ │ │ +170 │ │ │ │ │ +171#if HAVE_MPI │ │ │ │ │ +_1_7_8 class _M_P_I_H_e_l_p_e_r │ │ │ │ │ +179 { │ │ │ │ │ +180 public: │ │ │ │ │ +_1_8_5 constexpr static bool _i_s_F_a_k_e = false; │ │ │ │ │ +186 │ │ │ │ │ +_1_9_0 typedef MPI_Comm _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ +191 │ │ │ │ │ +_1_9_8 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ +199 { │ │ │ │ │ +200 return MPI_COMM_WORLD; │ │ │ │ │ +201 } │ │ │ │ │ +202 │ │ │ │ │ +_2_0_9 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ +210 { │ │ │ │ │ +211 return MPI_COMM_SELF; │ │ │ │ │ +212 } │ │ │ │ │ +213 │ │ │ │ │ +219 [[deprecated("getCollectionCommunication is deprecated. Use │ │ │ │ │ +getCommunication instead.")]] │ │ │ │ │ +220 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> │ │ │ │ │ +_2_2_1 _g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ +222 { │ │ │ │ │ +223 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +224 } │ │ │ │ │ +225 │ │ │ │ │ +226 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> │ │ │ │ │ +_2_2_7 _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ +228 { │ │ │ │ │ +229 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +230 } │ │ │ │ │ +_2_4_6 _D_U_N_E___E_X_P_O_R_T static _M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e(int& argc, char**& argv) │ │ │ │ │ +247 { │ │ │ │ │ +248 // create singleton instance │ │ │ │ │ +249 if (!instance_){ │ │ │ │ │ +250 static std::mutex mutex; │ │ │ │ │ +251 std::lock_guard guard(mutex); │ │ │ │ │ +252 if(!instance_) │ │ │ │ │ +253 instance_.reset(new _M_P_I_H_e_l_p_e_r(argc,argv)); │ │ │ │ │ +254 } │ │ │ │ │ +255 return *instance_; │ │ │ │ │ +256 } │ │ │ │ │ +257 │ │ │ │ │ +_2_5_8 _D_U_N_E___E_X_P_O_R_T static _M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e() │ │ │ │ │ +259 { │ │ │ │ │ +260 if(!instance_) │ │ │ │ │ +261 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n, "MPIHelper not initialized! Call │ │ │ │ │ +MPIHelper::instance(argc, argv) with arguments first."); │ │ │ │ │ +262 return *instance_; │ │ │ │ │ +263 } │ │ │ │ │ +264 │ │ │ │ │ +_2_6_8 int _r_a_n_k () const { return rank_; } │ │ │ │ │ +_2_7_2 int _s_i_z_e () const { return size_; } │ │ │ │ │ +273 │ │ │ │ │ +_2_7_5 _~_M_P_I_H_e_l_p_e_r() │ │ │ │ │ +276 { │ │ │ │ │ +277 int wasFinalized = -1; │ │ │ │ │ +278 MPI_Finalized( &wasFinalized ); │ │ │ │ │ +279 if(!wasFinalized && initializedHere_) │ │ │ │ │ +280 { │ │ │ │ │ +281 MPI_Finalize(); │ │ │ │ │ +282 _d_v_e_r_b << "Called MPI_Finalize on p=" << rank_ << "!" < instance_ = {}; │ │ │ │ │ +293 │ │ │ │ │ +295 MPIHelper(int& argc, char**& argv) │ │ │ │ │ +296 : initializedHere_(false) │ │ │ │ │ +297 { │ │ │ │ │ +298 int wasInitialized = -1; │ │ │ │ │ +299 MPI_Initialized( &wasInitialized ); │ │ │ │ │ +300 if(!wasInitialized) │ │ │ │ │ +301 { │ │ │ │ │ +302 rank_ = -1; │ │ │ │ │ +303 size_ = -1; │ │ │ │ │ +304 static int is_initialized = MPI_Init(&argc, &argv); │ │ │ │ │ +305 prevent_warning(is_initialized); │ │ │ │ │ +306 initializedHere_ = true; │ │ │ │ │ +307 } │ │ │ │ │ +308 │ │ │ │ │ +309 MPI_Comm_rank(MPI_COMM_WORLD,&rank_); │ │ │ │ │ +310 MPI_Comm_size(MPI_COMM_WORLD,&size_); │ │ │ │ │ +311 │ │ │ │ │ +312 assert( rank_ >= 0 ); │ │ │ │ │ +313 assert( size_ >= 1 ); │ │ │ │ │ +314 │ │ │ │ │ +315 _d_v_e_r_b << "Called MPI_Init on p=" << rank_ << "!" << std::endl; │ │ │ │ │ +316 } │ │ │ │ │ +317 │ │ │ │ │ +318 MPIHelper(const MPIHelper&); │ │ │ │ │ +319 MPIHelper& operator=(const MPIHelper); │ │ │ │ │ +320 }; │ │ │ │ │ +321#else // !HAVE_MPI │ │ │ │ │ +322 // We do not have MPI therefore FakeMPIHelper │ │ │ │ │ +323 // is the MPIHelper │ │ │ │ │ +328 typedef FakeMPIHelper MPIHelper; │ │ │ │ │ +329 │ │ │ │ │ +330#endif // !HAVE_MPI │ │ │ │ │ +331 │ │ │ │ │ +332} // end namespace Dune │ │ │ │ │ +333#endif │ │ │ │ │ +_s_t_d_s_t_r_e_a_m_s_._h_h │ │ │ │ │ +Standard Dune debug streams. │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides collective communication methods for │ │ │ │ │ +sequential programs. │ │ │ │ │ +_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides MPI's collective communication │ │ │ │ │ +methods. │ │ │ │ │ +_v_i_s_i_b_i_l_i_t_y_._h_h │ │ │ │ │ +Definition of macros controlling symbol visibility at the ABI level. │ │ │ │ │ +_D_U_N_E___E_X_P_O_R_T │ │ │ │ │ +#define DUNE_EXPORT │ │ │ │ │ +Export a symbol as part of the public ABI. │ │ │ │ │ +DDeeffiinniittiioonn visibility.hh:20 │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_d_v_e_r_b │ │ │ │ │ +DVerbType dverb(std::cout) │ │ │ │ │ +Singleton of verbose debug stream. │ │ │ │ │ +DDeeffiinniittiioonn stdstreams.hh:116 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_o_l_v_e_R_e_f___t │ │ │ │ │ -std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))> │ │ │ │ │ -ResolveRef_t │ │ │ │ │ -Type trait to resolve std::reference_wrapper. │ │ │ │ │ -DDeeffiinniittiioonn referencehelper.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ +Default exception if a function was called while the object is not in a valid │ │ │ │ │ +state for that function... │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_N_o___C_o_m_m │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Collective communication interface and sequential default implementation. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r │ │ │ │ │ +A fake mpi helper. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +static DUNE_EXPORT MPICommunicator getCommunicator() │ │ │ │ │ +get the default communicator │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +return rank of process, i.e. one │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:163 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +static Communication< MPICommunicator > getCollectiveCommunication() │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:118 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +static MPICommunicator getLocalCommunicator() │ │ │ │ │ +get a local communicator │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +No_Comm MPICommunicator │ │ │ │ │ +The type of the mpi communicator. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ +static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv) │ │ │ │ │ +Get the singleton instance of the helper. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:144 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ +static DUNE_EXPORT FakeMPIHelper & instance() │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +static Communication< MPICommunicator > getCommunication() │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:124 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_i_s_F_a_k_e │ │ │ │ │ +static constexpr bool isFake │ │ │ │ │ +Are we fake (i.e. pretend to have MPI support but are compiled without.) │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_r_a_n_k │ │ │ │ │ +int rank() const │ │ │ │ │ +return rank of process, i.e. zero │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:159 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ +A real mpi helper. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:179 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +return number of processes │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:272 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ +static DUNE_EXPORT MPIHelper & instance() │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:258 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_i_s_F_a_k_e │ │ │ │ │ +static constexpr bool isFake │ │ │ │ │ +Are we fake (i. e. pretend to have MPI support but are compiled without. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:185 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ +static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv) │ │ │ │ │ +Get the singleton instance of the helper. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:246 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +static Communication< MPICommunicator > getCommunication() │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:227 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_~_M_P_I_H_e_l_p_e_r │ │ │ │ │ +~MPIHelper() │ │ │ │ │ +calls MPI_Finalize │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_r_a_n_k │ │ │ │ │ +int rank() const │ │ │ │ │ +return rank of process │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:268 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +MPI_Comm MPICommunicator │ │ │ │ │ +The type of the mpi communicator. │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:190 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +static MPICommunicator getCommunicator() │ │ │ │ │ +get the default communicator │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:198 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +static MPICommunicator getLocalCommunicator() │ │ │ │ │ +get a local communicator │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +static Communication< MPICommunicator > getCollectiveCommunication() │ │ │ │ │ +DDeeffiinniittiioonn mpihelper.hh:221 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00101.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: quadmath.hh File Reference │ │ │ │ +dune-common: collectivecommunication.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,22 +65,23 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
quadmath.hh File Reference
│ │ │ │ +
collectivecommunication.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ +
#include <dune/common/parallel/communication.hh>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,10 +1,12 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -quadmath.hh File Reference │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +collectivecommunication.hh File Reference │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_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_. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: quadmath.hh Source File │ │ │ │ +dune-common: collectivecommunication.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,494 +70,27 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
quadmath.hh
│ │ │ │ +
collectivecommunication.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ -
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_QUADMATH_HH
│ │ │ │ -
6#define DUNE_QUADMATH_HH
│ │ │ │ -
7
│ │ │ │ -
8#if HAVE_QUADMATH
│ │ │ │ -
9#include <quadmath.h>
│ │ │ │ -
10
│ │ │ │ -
11#include <cmath>
│ │ │ │ -
12#include <cstddef>
│ │ │ │ -
13#include <cstdint>
│ │ │ │ -
14#include <cstdlib> // abs
│ │ │ │ -
15#include <istream>
│ │ │ │ -
16#include <ostream>
│ │ │ │ -
17#include <type_traits>
│ │ │ │ -
18#include <utility>
│ │ │ │ -
19
│ │ │ │ - │ │ │ │ - │ │ │ │ -
22
│ │ │ │ -
23namespace Dune
│ │ │ │ -
24{
│ │ │ │ -
25 namespace Impl
│ │ │ │ -
26 {
│ │ │ │ -
27 // forward declaration
│ │ │ │ -
28 class Float128;
│ │ │ │ -
29
│ │ │ │ -
30 } // end namespace Impl
│ │ │ │ -
31
│ │ │ │ -
32 using Impl::Float128;
│ │ │ │ -
33
│ │ │ │ -
34 // The purpose of this namespace is to move the `<cmath>` function overloads
│ │ │ │ -
35 // out of namespace `Dune`, see AlignedNumber in debugalign.hh.
│ │ │ │ -
36 namespace Impl
│ │ │ │ -
37 {
│ │ │ │ -
38 using float128_t = __float128;
│ │ │ │ -
39
│ │ │ │ -
41 class Float128
│ │ │ │ -
42 {
│ │ │ │ -
43 float128_t value_ = 0.0q;
│ │ │ │ -
44
│ │ │ │ -
45 public:
│ │ │ │ -
46 constexpr Float128() = default;
│ │ │ │ -
47 constexpr Float128(const float128_t& value) noexcept
│ │ │ │ -
48 : value_(value)
│ │ │ │ -
49 {}
│ │ │ │ -
50
│ │ │ │ -
51 // constructor from any floating-point or integer type
│ │ │ │ -
52 template <class T,
│ │ │ │ -
53 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
│ │ │ │ -
54 constexpr Float128(const T& value) noexcept
│ │ │ │ -
55 : value_(value)
│ │ │ │ -
56 {}
│ │ │ │ -
57
│ │ │ │ -
58 // constructor from pointer to null-terminated byte string
│ │ │ │ -
59 explicit Float128(const char* str) noexcept
│ │ │ │ -
60 : value_(strtoflt128(str, NULL))
│ │ │ │ -
61 {}
│ │ │ │ -
62
│ │ │ │ -
63 // accessors
│ │ │ │ -
64 constexpr operator float128_t() const noexcept { return value_; }
│ │ │ │ -
65
│ │ │ │ -
66 constexpr float128_t const& value() const noexcept { return value_; }
│ │ │ │ -
67 constexpr float128_t& value() noexcept { return value_; }
│ │ │ │ -
68
│ │ │ │ -
69 // I/O
│ │ │ │ -
70 template<class CharT, class Traits>
│ │ │ │ -
71 friend std::basic_istream<CharT, Traits>&
│ │ │ │ -
72 operator>>(std::basic_istream<CharT, Traits>& in, Float128& x)
│ │ │ │ -
73 {
│ │ │ │ -
74 std::string buf;
│ │ │ │ -
75 buf.reserve(128);
│ │ │ │ -
76 in >> buf;
│ │ │ │ -
77 x.value() = strtoflt128(buf.c_str(), NULL);
│ │ │ │ -
78 return in;
│ │ │ │ -
79 }
│ │ │ │ -
80
│ │ │ │ -
81 template<class CharT, class Traits>
│ │ │ │ -
82 friend std::basic_ostream<CharT, Traits>&
│ │ │ │ -
83 operator<<(std::basic_ostream<CharT, Traits>& out, const Float128& x)
│ │ │ │ -
84 {
│ │ │ │ -
85 const std::size_t bufSize = 128;
│ │ │ │ -
86 CharT buf[128];
│ │ │ │ -
87
│ │ │ │ -
88 std::string format = "%." + std::to_string(out.precision()) + "Q" +
│ │ │ │ -
89 ((out.flags() | std::ios_base::scientific) ? "e" : "f");
│ │ │ │ -
90 const int numChars = quadmath_snprintf(buf, bufSize, format.c_str(), x.value());
│ │ │ │ -
91 if (std::size_t(numChars) >= bufSize) {
│ │ │ │ -
92 DUNE_THROW(Dune::RangeError, "Failed to print Float128 value: buffer overflow");
│ │ │ │ -
93 }
│ │ │ │ -
94 out << buf;
│ │ │ │ -
95 return out;
│ │ │ │ -
96 }
│ │ │ │ -
97
│ │ │ │ -
98 // Increment, decrement
│ │ │ │ -
99 constexpr Float128& operator++() noexcept { ++value_; return *this; }
│ │ │ │ -
100 constexpr Float128& operator--() noexcept { --value_; return *this; }
│ │ │ │ -
101
│ │ │ │ -
102 constexpr Float128 operator++(int) noexcept { Float128 tmp{*this}; ++value_; return tmp; }
│ │ │ │ -
103 constexpr Float128 operator--(int) noexcept { Float128 tmp{*this}; --value_; return tmp; }
│ │ │ │ -
104
│ │ │ │ -
105 // unary operators
│ │ │ │ -
106 constexpr Float128 operator+() const noexcept { return Float128{+value_}; }
│ │ │ │ -
107 constexpr Float128 operator-() const noexcept { return Float128{-value_}; }
│ │ │ │ -
108
│ │ │ │ -
109 // assignment operators
│ │ │ │ -
110#define DUNE_ASSIGN_OP(OP) \
│ │ │ │ -
111 constexpr Float128& operator OP(const Float128& u) noexcept \
│ │ │ │ -
112 { \
│ │ │ │ -
113 value_ OP float128_t(u); \
│ │ │ │ -
114 return *this; \
│ │ │ │ -
115 } \
│ │ │ │ -
116 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
117
│ │ │ │ -
118 DUNE_ASSIGN_OP(+=);
│ │ │ │ -
119 DUNE_ASSIGN_OP(-=);
│ │ │ │ -
120
│ │ │ │ -
121 DUNE_ASSIGN_OP(*=);
│ │ │ │ -
122 DUNE_ASSIGN_OP(/=);
│ │ │ │ -
123
│ │ │ │ -
124#undef DUNE_ASSIGN_OP
│ │ │ │ -
125
│ │ │ │ -
126 }; // end class Float128
│ │ │ │ -
127
│ │ │ │ -
128 // binary operators:
│ │ │ │ -
129 // For symmetry provide overloads with arithmetic types
│ │ │ │ -
130 // in the first or second argument.
│ │ │ │ -
131#define DUNE_BINARY_OP(OP) \
│ │ │ │ -
132 constexpr Float128 operator OP(const Float128& t, \
│ │ │ │ -
133 const Float128& u) noexcept \
│ │ │ │ -
134 { \
│ │ │ │ -
135 return Float128{float128_t(t) OP float128_t(u)}; \
│ │ │ │ -
136 } \
│ │ │ │ -
137 constexpr Float128 operator OP(const float128_t& t, \
│ │ │ │ -
138 const Float128& u) noexcept \
│ │ │ │ -
139 { \
│ │ │ │ -
140 return Float128{t OP float128_t(u)}; \
│ │ │ │ -
141 } \
│ │ │ │ -
142 constexpr Float128 operator OP(const Float128& t, \
│ │ │ │ -
143 const float128_t& u) noexcept \
│ │ │ │ -
144 { \
│ │ │ │ -
145 return Float128{float128_t(t) OP u}; \
│ │ │ │ -
146 } \
│ │ │ │ -
147 template <class T, \
│ │ │ │ -
148 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \
│ │ │ │ -
149 constexpr Float128 operator OP(const T& t, \
│ │ │ │ -
150 const Float128& u) noexcept \
│ │ │ │ -
151 { \
│ │ │ │ -
152 return Float128{float128_t(t) OP float128_t(u)}; \
│ │ │ │ -
153 } \
│ │ │ │ -
154 template <class U, \
│ │ │ │ -
155 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \
│ │ │ │ -
156 constexpr Float128 operator OP(const Float128& t, \
│ │ │ │ -
157 const U& u) noexcept \
│ │ │ │ -
158 { \
│ │ │ │ -
159 return Float128{float128_t(t) OP float128_t(u)}; \
│ │ │ │ -
160 } \
│ │ │ │ -
161 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
162
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
167
│ │ │ │ -
168#undef DUNE_BINARY_OP
│ │ │ │ -
169
│ │ │ │ -
170 // logical operators:
│ │ │ │ -
171 // For symmetry provide overloads with arithmetic types
│ │ │ │ -
172 // in the first or second argument.
│ │ │ │ -
173#define DUNE_BINARY_BOOL_OP(OP) \
│ │ │ │ -
174 constexpr bool operator OP(const Float128& t, \
│ │ │ │ -
175 const Float128& u) noexcept \
│ │ │ │ -
176 { \
│ │ │ │ -
177 return float128_t(t) OP float128_t(u); \
│ │ │ │ -
178 } \
│ │ │ │ -
179 template <class T, \
│ │ │ │ -
180 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \
│ │ │ │ -
181 constexpr bool operator OP(const T& t, \
│ │ │ │ -
182 const Float128& u) noexcept \
│ │ │ │ -
183 { \
│ │ │ │ -
184 return float128_t(t) OP float128_t(u); \
│ │ │ │ -
185 } \
│ │ │ │ -
186 template <class U, \
│ │ │ │ -
187 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \
│ │ │ │ -
188 constexpr bool operator OP(const Float128& t, \
│ │ │ │ -
189 const U& u) noexcept \
│ │ │ │ -
190 { \
│ │ │ │ -
191 return float128_t(t) OP float128_t(u); \
│ │ │ │ -
192 } \
│ │ │ │ -
193 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
194
│ │ │ │ -
195 DUNE_BINARY_BOOL_OP(==);
│ │ │ │ -
196 DUNE_BINARY_BOOL_OP(!=);
│ │ │ │ -
197 DUNE_BINARY_BOOL_OP(<);
│ │ │ │ -
198 DUNE_BINARY_BOOL_OP(>);
│ │ │ │ -
199 DUNE_BINARY_BOOL_OP(<=);
│ │ │ │ -
200 DUNE_BINARY_BOOL_OP(>=);
│ │ │ │ -
201
│ │ │ │ -
202#undef DUNE_BINARY_BOOL_OP
│ │ │ │ -
203
│ │ │ │ -
204 // Overloads for the cmath functions
│ │ │ │ -
205
│ │ │ │ -
206 // function with name `name` redirects to quadmath function `func`
│ │ │ │ -
207#define DUNE_UNARY_FUNC(name,func) \
│ │ │ │ -
208 inline Float128 name(const Float128& u) noexcept \
│ │ │ │ -
209 { \
│ │ │ │ -
210 return Float128{func (float128_t(u))}; \
│ │ │ │ -
211 } \
│ │ │ │ -
212 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
213
│ │ │ │ -
214 // like DUNE_UNARY_FUNC but with custom return type
│ │ │ │ -
215#define DUNE_CUSTOM_UNARY_FUNC(type,name,func) \
│ │ │ │ -
216 inline type name(const Float128& u) noexcept \
│ │ │ │ -
217 { \
│ │ │ │ -
218 return (type)(func (float128_t(u))); \
│ │ │ │ -
219 } \
│ │ │ │ -
220 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
221
│ │ │ │ -
222 // redirects to quadmath function with two arguments
│ │ │ │ -
223#define DUNE_BINARY_FUNC(name,func) \
│ │ │ │ -
224 inline Float128 name(const Float128& t, \
│ │ │ │ -
225 const Float128& u) noexcept \
│ │ │ │ -
226 { \
│ │ │ │ -
227 return Float128{func (float128_t(t), float128_t(u))}; \
│ │ │ │ -
228 } \
│ │ │ │ -
229 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
230
│ │ │ │ -
231 DUNE_UNARY_FUNC(abs, fabsq);
│ │ │ │ -
232 DUNE_UNARY_FUNC(acos, acosq);
│ │ │ │ -
233 DUNE_UNARY_FUNC(acosh, acoshq);
│ │ │ │ -
234 DUNE_UNARY_FUNC(asin, asinq);
│ │ │ │ -
235 DUNE_UNARY_FUNC(asinh, asinhq);
│ │ │ │ -
236 DUNE_UNARY_FUNC(atan, atanq);
│ │ │ │ -
237 DUNE_UNARY_FUNC(atanh, atanhq);
│ │ │ │ -
238 DUNE_UNARY_FUNC(cbrt, cbrtq);
│ │ │ │ -
239 DUNE_UNARY_FUNC(ceil, ceilq);
│ │ │ │ -
240 DUNE_UNARY_FUNC(cos, cosq);
│ │ │ │ -
241 DUNE_UNARY_FUNC(cosh, coshq);
│ │ │ │ -
242 DUNE_UNARY_FUNC(erf, erfq);
│ │ │ │ -
243 DUNE_UNARY_FUNC(erfc, erfcq);
│ │ │ │ -
244 DUNE_UNARY_FUNC(exp, expq);
│ │ │ │ -
245 DUNE_UNARY_FUNC(expm1, expm1q);
│ │ │ │ -
246 DUNE_UNARY_FUNC(fabs, fabsq);
│ │ │ │ -
247 DUNE_UNARY_FUNC(floor, floorq);
│ │ │ │ -
248 DUNE_CUSTOM_UNARY_FUNC(int, ilogb, ilogbq);
│ │ │ │ -
249 DUNE_UNARY_FUNC(lgamma, lgammaq);
│ │ │ │ -
250 DUNE_CUSTOM_UNARY_FUNC(long long int, llrint, llrintq);
│ │ │ │ -
251 DUNE_CUSTOM_UNARY_FUNC(long long int, llround, llroundq);
│ │ │ │ -
252 DUNE_UNARY_FUNC(log, logq);
│ │ │ │ -
253 DUNE_UNARY_FUNC(log10, log10q);
│ │ │ │ -
254 DUNE_UNARY_FUNC(log1p, log1pq);
│ │ │ │ -
255 DUNE_UNARY_FUNC(log2, log2q);
│ │ │ │ -
256 // DUNE_UNARY_FUNC(logb, logbq); // not available in gcc5
│ │ │ │ -
257 DUNE_CUSTOM_UNARY_FUNC(long int, lrint, lrintq);
│ │ │ │ -
258 DUNE_CUSTOM_UNARY_FUNC(long int, lround, lroundq);
│ │ │ │ -
259 DUNE_UNARY_FUNC(nearbyint, nearbyintq);
│ │ │ │ -
260 DUNE_BINARY_FUNC(nextafter, nextafterq);
│ │ │ │ -
261 DUNE_BINARY_FUNC(pow, powq); // overload for integer argument see below
│ │ │ │ -
262 DUNE_UNARY_FUNC(rint, rintq);
│ │ │ │ -
263 DUNE_UNARY_FUNC(round, roundq);
│ │ │ │ -
264 DUNE_UNARY_FUNC(sin, sinq);
│ │ │ │ -
265 DUNE_UNARY_FUNC(sinh, sinhq);
│ │ │ │ -
266 DUNE_UNARY_FUNC(sqrt, sqrtq);
│ │ │ │ -
267 DUNE_UNARY_FUNC(tan, tanq);
│ │ │ │ -
268 DUNE_UNARY_FUNC(tanh, tanhq);
│ │ │ │ -
269 DUNE_UNARY_FUNC(tgamma, tgammaq);
│ │ │ │ -
270 DUNE_UNARY_FUNC(trunc, truncq);
│ │ │ │ -
271
│ │ │ │ -
272 DUNE_CUSTOM_UNARY_FUNC(bool, isfinite, finiteq);
│ │ │ │ -
273 DUNE_CUSTOM_UNARY_FUNC(bool, isinf, isinfq);
│ │ │ │ -
274 DUNE_CUSTOM_UNARY_FUNC(bool, isnan, isnanq);
│ │ │ │ -
275 DUNE_CUSTOM_UNARY_FUNC(bool, signbit, signbitq);
│ │ │ │ -
276
│ │ │ │ -
277#undef DUNE_UNARY_FUNC
│ │ │ │ -
278#undef DUNE_CUSTOM_UNARY_FUNC
│ │ │ │ -
279#undef DUNE_BINARY_FUNC
│ │ │ │ -
280
│ │ │ │ -
281 // like DUNE_BINARY_FUNC but provide overloads with arithmetic
│ │ │ │ -
282 // types in the first or second argument.
│ │ │ │ -
283#define DUNE_BINARY_ARITHMETIC_FUNC(name,func) \
│ │ │ │ -
284 inline Float128 name(const Float128& t, \
│ │ │ │ -
285 const Float128& u) noexcept \
│ │ │ │ -
286 { \
│ │ │ │ -
287 return Float128{func (float128_t(t), float128_t(u))}; \
│ │ │ │ -
288 } \
│ │ │ │ -
289 template <class T, \
│ │ │ │ -
290 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \
│ │ │ │ -
291 inline Float128 name(const T& t, \
│ │ │ │ -
292 const Float128& u) noexcept \
│ │ │ │ -
293 { \
│ │ │ │ -
294 return Float128{func (float128_t(t), float128_t(u))}; \
│ │ │ │ -
295 } \
│ │ │ │ -
296 template <class U, \
│ │ │ │ -
297 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \
│ │ │ │ -
298 inline Float128 name(const Float128& t, \
│ │ │ │ -
299 const U& u) noexcept \
│ │ │ │ -
300 { \
│ │ │ │ -
301 return Float128{func (float128_t(t), float128_t(u))}; \
│ │ │ │ -
302 } \
│ │ │ │ -
303 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ -
304
│ │ │ │ -
305 DUNE_BINARY_ARITHMETIC_FUNC(atan2,atan2q);
│ │ │ │ -
306 DUNE_BINARY_ARITHMETIC_FUNC(copysign,copysignq);
│ │ │ │ -
307 DUNE_BINARY_ARITHMETIC_FUNC(fdim,fdimq);
│ │ │ │ -
308 DUNE_BINARY_ARITHMETIC_FUNC(fmax,fmaxq);
│ │ │ │ -
309 DUNE_BINARY_ARITHMETIC_FUNC(fmin,fminq);
│ │ │ │ -
310 DUNE_BINARY_ARITHMETIC_FUNC(fmod,fmodq);
│ │ │ │ -
311 DUNE_BINARY_ARITHMETIC_FUNC(hypot,hypotq);
│ │ │ │ -
312 DUNE_BINARY_ARITHMETIC_FUNC(remainder,remainderq);
│ │ │ │ -
313
│ │ │ │ -
314#undef DUNE_BINARY_ARITHMETIC_FUNC
│ │ │ │ -
315
│ │ │ │ -
316 // some more cmath functions with special signature
│ │ │ │ -
317
│ │ │ │ -
318 inline Float128 fma(const Float128& t, const Float128& u, const Float128& v)
│ │ │ │ -
319 {
│ │ │ │ -
320 return Float128{fmaq(float128_t(t),float128_t(u),float128_t(v))};
│ │ │ │ -
321 }
│ │ │ │ -
322
│ │ │ │ -
323 inline Float128 frexp(const Float128& u, int* p)
│ │ │ │ -
324 {
│ │ │ │ -
325 return Float128{frexpq(float128_t(u), p)};
│ │ │ │ -
326 }
│ │ │ │ -
327
│ │ │ │ -
328 inline Float128 ldexp(const Float128& u, int p)
│ │ │ │ -
329 {
│ │ │ │ -
330 return Float128{ldexpq(float128_t(u), p)};
│ │ │ │ -
331 }
│ │ │ │ -
332
│ │ │ │ -
333 inline Float128 remquo(const Float128& t, const Float128& u, int* quo)
│ │ │ │ -
334 {
│ │ │ │ -
335 return Float128{remquoq(float128_t(t), float128_t(u), quo)};
│ │ │ │ -
336 }
│ │ │ │ -
337
│ │ │ │ -
338 inline Float128 scalbln(const Float128& u, long int e)
│ │ │ │ -
339 {
│ │ │ │ -
340 return Float128{scalblnq(float128_t(u), e)};
│ │ │ │ -
341 }
│ │ │ │ -
342
│ │ │ │ -
343 inline Float128 scalbn(const Float128& u, int e)
│ │ │ │ -
344 {
│ │ │ │ -
345 return Float128{scalbnq(float128_t(u), e)};
│ │ │ │ -
346 }
│ │ │ │ -
347
│ │ │ │ -
349 // NOTE: This is much faster than a pow(x, Float128(p)) call
│ │ │ │ -
350 // NOTE: This is a modified version of boost::math::cstdfloat::detail::pown
│ │ │ │ -
351 // (adapted to the type Float128) that is part of the Boost 1.65 Math toolkit 2.8.0
│ │ │ │ -
352 // and is implemented by Christopher Kormanyos, John Maddock, and Paul A. Bristow,
│ │ │ │ -
353 // distributed under the Boost Software License, Version 1.0
│ │ │ │ -
354 // (See http://www.boost.org/LICENSE_1_0.txt)
│ │ │ │ -
355 template <class Int,
│ │ │ │ -
356 std::enable_if_t<std::is_integral<Int>::value, int> = 0>
│ │ │ │ -
357 inline Float128 pow(const Float128& x, const Int p)
│ │ │ │ -
358 {
│ │ │ │ -
359 static const Float128 max_value = FLT128_MAX;
│ │ │ │ -
360 static const Float128 min_value = FLT128_MIN;
│ │ │ │ -
361 static const Float128 inf_value = float128_t{1} / float128_t{0};
│ │ │ │ -
362
│ │ │ │ -
363 const bool isneg = (x < 0);
│ │ │ │ -
364 const bool isnan = (x != x);
│ │ │ │ -
365 const bool isinf = (isneg ? bool(-x > max_value) : bool(+x > max_value));
│ │ │ │ -
366
│ │ │ │ -
367 if (isnan) { return x; }
│ │ │ │ -
368 if (isinf) { return Float128{nanq("")}; }
│ │ │ │ -
369
│ │ │ │ -
370 const Float128 abs_x = (isneg ? -x : x);
│ │ │ │ -
371 if (p < Int(0)) {
│ │ │ │ -
372 if (abs_x < min_value)
│ │ │ │ -
373 return (isneg ? -inf_value : +inf_value);
│ │ │ │ -
374 else
│ │ │ │ -
375 return Float128(1) / pow(x, Int(-p));
│ │ │ │ -
376 }
│ │ │ │ -
377
│ │ │ │ -
378 if (p == Int(0)) { return Float128(1); }
│ │ │ │ -
379 if (p == Int(1)) { return x; }
│ │ │ │ -
380 if (abs_x > max_value)
│ │ │ │ -
381 return (isneg ? -inf_value : +inf_value);
│ │ │ │ -
382
│ │ │ │ -
383 if (p == Int(2)) { return (x * x); }
│ │ │ │ -
384 if (p == Int(3)) { return ((x * x) * x); }
│ │ │ │ -
385 if (p == Int(4)) { const Float128 x2 = (x * x); return (x2 * x2); }
│ │ │ │ -
386
│ │ │ │ -
387 Float128 result = ((p % Int(2)) != Int(0)) ? x : Float128(1);
│ │ │ │ -
388 Float128 xn = x; // binary powers of x
│ │ │ │ -
389
│ │ │ │ -
390 Int p2 = p;
│ │ │ │ -
391 while (Int(p2 /= 2) != Int(0)) {
│ │ │ │ -
392 xn *= xn; // Square xn for each binary power
│ │ │ │ -
393
│ │ │ │ -
394 const bool has_binary_power = (Int(p2 % Int(2)) != Int(0));
│ │ │ │ -
395 if (has_binary_power)
│ │ │ │ -
396 result *= xn;
│ │ │ │ -
397 }
│ │ │ │ -
398
│ │ │ │ -
399 return result;
│ │ │ │ -
400 }
│ │ │ │ -
401
│ │ │ │ -
402
│ │ │ │ -
403 } // end namespace Impl
│ │ │ │ -
404
│ │ │ │ -
405 template <>
│ │ │ │ -
406 struct IsNumber<Impl::Float128>
│ │ │ │ -
407 : public std::true_type {};
│ │ │ │ -
408
│ │ │ │ -
409} // end namespace Dune
│ │ │ │ -
410
│ │ │ │ -
411namespace std
│ │ │ │ -
412{
│ │ │ │ -
413#ifndef NO_STD_NUMERIC_LIMITS_SPECIALIZATION
│ │ │ │ -
414 template <>
│ │ │ │ -
415 class numeric_limits<Dune::Impl::Float128>
│ │ │ │ -
416 {
│ │ │ │ -
417 using Float128 = Dune::Impl::Float128;
│ │ │ │ -
418 using float128_t = Dune::Impl::float128_t;
│ │ │ │ -
419
│ │ │ │ -
420 public:
│ │ │ │ -
421 static constexpr bool is_specialized = true;
│ │ │ │ -
422 static constexpr Float128 min() noexcept { return FLT128_MIN; }
│ │ │ │ -
423 static constexpr Float128 max() noexcept { return FLT128_MAX; }
│ │ │ │ -
424 static constexpr Float128 lowest() noexcept { return -FLT128_MAX; }
│ │ │ │ -
425 static constexpr int digits = FLT128_MANT_DIG;
│ │ │ │ -
426 static constexpr int digits10 = 34;
│ │ │ │ -
427 static constexpr int max_digits10 = 36;
│ │ │ │ -
428 static constexpr bool is_signed = true;
│ │ │ │ -
429 static constexpr bool is_integer = false;
│ │ │ │ -
430 static constexpr bool is_exact = false;
│ │ │ │ -
431 static constexpr int radix = 2;
│ │ │ │ -
432 static constexpr Float128 epsilon() noexcept { return FLT128_EPSILON; }
│ │ │ │ -
433 static constexpr Float128 round_error() noexcept { return float128_t{0.5}; }
│ │ │ │ -
434 static constexpr int min_exponent = FLT128_MIN_EXP;
│ │ │ │ -
435 static constexpr int min_exponent10 = FLT128_MIN_10_EXP;
│ │ │ │ -
436 static constexpr int max_exponent = FLT128_MAX_EXP;
│ │ │ │ -
437 static constexpr int max_exponent10 = FLT128_MAX_10_EXP;
│ │ │ │ -
438 static constexpr bool has_infinity = true;
│ │ │ │ -
439 static constexpr bool has_quiet_NaN = true;
│ │ │ │ -
440 static constexpr bool has_signaling_NaN = false;
│ │ │ │ -
441 static constexpr float_denorm_style has_denorm = denorm_present;
│ │ │ │ -
442 static constexpr bool has_denorm_loss = false;
│ │ │ │ -
443 static constexpr Float128 infinity() noexcept { return float128_t{1}/float128_t{0}; }
│ │ │ │ -
444 static Float128 quiet_NaN() noexcept { return nanq(""); }
│ │ │ │ -
445 static constexpr Float128 signaling_NaN() noexcept { return float128_t{}; }
│ │ │ │ -
446 static constexpr Float128 denorm_min() noexcept { return FLT128_DENORM_MIN; }
│ │ │ │ -
447 static constexpr bool is_iec559 = true;
│ │ │ │ -
448 static constexpr bool is_bounded = false;
│ │ │ │ -
449 static constexpr bool is_modulo = false;
│ │ │ │ -
450 static constexpr bool traps = false;
│ │ │ │ -
451 static constexpr bool tinyness_before = false;
│ │ │ │ -
452 static constexpr float_round_style round_style = round_to_nearest;
│ │ │ │ -
453 };
│ │ │ │ -
454#endif
│ │ │ │ -
455} // end namespace std
│ │ │ │ -
456
│ │ │ │ -
457#endif // HAVE_QUADMATH
│ │ │ │ -
458#endif // DUNE_QUADMATH_HH
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
A few common exception classes.
│ │ │ │ -
#define DUNE_BINARY_OP(OP)
Definition debugalign.hh:248
│ │ │ │ -
#define DUNE_UNARY_FUNC(name)
│ │ │ │ -
#define DUNE_ASSIGN_OP(OP)
Definition debugalign.hh:207
│ │ │ │ -
Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
Read a std::tuple.
Definition streamoperators.hh:43
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ -
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:542
│ │ │ │ -
bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:535
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ -
STL namespace.
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
T max_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:481
│ │ │ │ -
T min_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:487
│ │ │ │ -
auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
Definition debugalign.hh:447
│ │ │ │ -
auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
Definition debugalign.hh:425
│ │ │ │ -
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │ +Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: 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// Will be removed after the 2.7 release
│ │ │ │ +
4#warning "Deprecated header, use #include <dune/common/parallel/communication.hh> instead!"
│ │ │ │ + │ │ │ │ +
Implements an utility class that provides collective communication methods for sequential programs.
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,527 +1,21 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -quadmath.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +collectivecommunication.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_QUADMATH_HH │ │ │ │ │ -6#define DUNE_QUADMATH_HH │ │ │ │ │ -7 │ │ │ │ │ -8#if HAVE_QUADMATH │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include // abs │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -22 │ │ │ │ │ -23namespace _D_u_n_e │ │ │ │ │ -24{ │ │ │ │ │ -25 namespace Impl │ │ │ │ │ -26 { │ │ │ │ │ -27 // forward declaration │ │ │ │ │ -28 class Float128; │ │ │ │ │ -29 │ │ │ │ │ -30 } // end namespace Impl │ │ │ │ │ -31 │ │ │ │ │ -32 using Impl::Float128; │ │ │ │ │ -33 │ │ │ │ │ -34 // The purpose of this namespace is to move the `` function overloads │ │ │ │ │ -35 // out of namespace `Dune`, see AlignedNumber in debugalign.hh. │ │ │ │ │ -36 namespace Impl │ │ │ │ │ -37 { │ │ │ │ │ -38 using float128_t = __float128; │ │ │ │ │ -39 │ │ │ │ │ -41 class Float128 │ │ │ │ │ -42 { │ │ │ │ │ -43 float128_t value_ = 0.0q; │ │ │ │ │ -44 │ │ │ │ │ -45 public: │ │ │ │ │ -46 constexpr Float128() = default; │ │ │ │ │ -47 constexpr Float128(const float128_t& value) noexcept │ │ │ │ │ -48 : value_(value) │ │ │ │ │ -49 {} │ │ │ │ │ -50 │ │ │ │ │ -51 // constructor from any floating-point or integer type │ │ │ │ │ -52 template ::value, int> = 0> │ │ │ │ │ -54 constexpr Float128(const T& value) noexcept │ │ │ │ │ -55 : value_(value) │ │ │ │ │ -56 {} │ │ │ │ │ -57 │ │ │ │ │ -58 // constructor from pointer to null-terminated byte string │ │ │ │ │ -59 explicit Float128(const char* str) noexcept │ │ │ │ │ -60 : value_(strtoflt128(str, NULL)) │ │ │ │ │ -61 {} │ │ │ │ │ -62 │ │ │ │ │ -63 // accessors │ │ │ │ │ -64 constexpr operator float128_t() const noexcept { return value_; } │ │ │ │ │ -65 │ │ │ │ │ -66 constexpr float128_t const& value() const noexcept { return value_; } │ │ │ │ │ -67 constexpr float128_t& value() noexcept { return value_; } │ │ │ │ │ -68 │ │ │ │ │ -69 // I/O │ │ │ │ │ -70 template │ │ │ │ │ -71 friend std::basic_istream& │ │ │ │ │ -72 _o_p_e_r_a_t_o_r_>_>(std::basic_istream& in, Float128& x) │ │ │ │ │ -73 { │ │ │ │ │ -74 std::string buf; │ │ │ │ │ -75 buf.reserve(128); │ │ │ │ │ -76 in >> buf; │ │ │ │ │ -77 x.value() = strtoflt128(buf.c_str(), NULL); │ │ │ │ │ -78 return in; │ │ │ │ │ -79 } │ │ │ │ │ -80 │ │ │ │ │ -81 template │ │ │ │ │ -82 friend std::basic_ostream& │ │ │ │ │ -83 _o_p_e_r_a_t_o_r_<_<(std::basic_ostream& out, const Float128& x) │ │ │ │ │ -84 { │ │ │ │ │ -85 const std::size_t bufSize = 128; │ │ │ │ │ -86 CharT buf[128]; │ │ │ │ │ -87 │ │ │ │ │ -88 std::string format = "%." + std::to_string(out.precision()) + "Q" + │ │ │ │ │ -89 ((out.flags() | std::ios_base::scientific) ? "e" : "f"); │ │ │ │ │ -90 const int numChars = quadmath_snprintf(buf, bufSize, format.c_str(), x.value │ │ │ │ │ -()); │ │ │ │ │ -91 if (std::size_t(numChars) >= bufSize) { │ │ │ │ │ -92 _D_U_N_E___T_H_R_O_W(_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r, "Failed to print Float128 value: buffer │ │ │ │ │ -overflow"); │ │ │ │ │ -93 } │ │ │ │ │ -94 out << buf; │ │ │ │ │ -95 return out; │ │ │ │ │ -96 } │ │ │ │ │ -97 │ │ │ │ │ -98 // Increment, decrement │ │ │ │ │ -99 constexpr Float128& operator++() noexcept { ++value_; return *this; } │ │ │ │ │ -100 constexpr Float128& operator--() noexcept { --value_; return *this; } │ │ │ │ │ -101 │ │ │ │ │ -102 constexpr Float128 operator++(int) noexcept { Float128 tmp{*this}; │ │ │ │ │ -++value_; return tmp; } │ │ │ │ │ -103 constexpr Float128 operator--(int) noexcept { Float128 tmp{*this}; -- │ │ │ │ │ -value_; return tmp; } │ │ │ │ │ -104 │ │ │ │ │ -105 // unary operators │ │ │ │ │ -106 constexpr Float128 _o_p_e_r_a_t_o_r_+() const noexcept { return Float128{+value_}; } │ │ │ │ │ -107 constexpr Float128 _o_p_e_r_a_t_o_r_-() const noexcept { return Float128{-value_}; } │ │ │ │ │ -108 │ │ │ │ │ -109 // assignment operators │ │ │ │ │ -110#define DUNE_ASSIGN_OP(OP) \ │ │ │ │ │ -111 constexpr Float128& operator OP(const Float128& u) noexcept \ │ │ │ │ │ -112 { \ │ │ │ │ │ -113 value_ OP float128_t(u); \ │ │ │ │ │ -114 return *this; \ │ │ │ │ │ -115 } \ │ │ │ │ │ -116 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -117 │ │ │ │ │ -118 _D_U_N_E___A_S_S_I_G_N___O_P(+=); │ │ │ │ │ -119 _D_U_N_E___A_S_S_I_G_N___O_P(-=); │ │ │ │ │ -120 │ │ │ │ │ -121 _D_U_N_E___A_S_S_I_G_N___O_P(*=); │ │ │ │ │ -122 _D_U_N_E___A_S_S_I_G_N___O_P(/=); │ │ │ │ │ -123 │ │ │ │ │ -124#undef DUNE_ASSIGN_OP │ │ │ │ │ -125 │ │ │ │ │ -126 }; // end class Float128 │ │ │ │ │ -127 │ │ │ │ │ -128 // binary operators: │ │ │ │ │ -129 // For symmetry provide overloads with arithmetic types │ │ │ │ │ -130 // in the first or second argument. │ │ │ │ │ -131#define DUNE_BINARY_OP(OP) \ │ │ │ │ │ -132 constexpr Float128 operator OP(const Float128& t, \ │ │ │ │ │ -133 const Float128& u) noexcept \ │ │ │ │ │ -134 { \ │ │ │ │ │ -135 return Float128{float128_t(t) OP float128_t(u)}; \ │ │ │ │ │ -136 } \ │ │ │ │ │ -137 constexpr Float128 operator OP(const float128_t& t, \ │ │ │ │ │ -138 const Float128& u) noexcept \ │ │ │ │ │ -139 { \ │ │ │ │ │ -140 return Float128{t OP float128_t(u)}; \ │ │ │ │ │ -141 } \ │ │ │ │ │ -142 constexpr Float128 operator OP(const Float128& t, \ │ │ │ │ │ -143 const float128_t& u) noexcept \ │ │ │ │ │ -144 { \ │ │ │ │ │ -145 return Float128{float128_t(t) OP u}; \ │ │ │ │ │ -146 } \ │ │ │ │ │ -147 template ::value, int> = 0> \ │ │ │ │ │ -149 constexpr Float128 operator OP(const T& t, \ │ │ │ │ │ -150 const Float128& u) noexcept \ │ │ │ │ │ -151 { \ │ │ │ │ │ -152 return Float128{float128_t(t) OP float128_t(u)}; \ │ │ │ │ │ -153 } \ │ │ │ │ │ -154 template ::value, int> = 0> \ │ │ │ │ │ -156 constexpr Float128 operator OP(const Float128& t, \ │ │ │ │ │ -157 const U& u) noexcept \ │ │ │ │ │ -158 { \ │ │ │ │ │ -159 return Float128{float128_t(t) OP float128_t(u)}; \ │ │ │ │ │ -160 } \ │ │ │ │ │ -161 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -162 │ │ │ │ │ -163 _D_U_N_E___B_I_N_A_R_Y___O_P(+); │ │ │ │ │ -164 _D_U_N_E___B_I_N_A_R_Y___O_P(-); │ │ │ │ │ -165 _D_U_N_E___B_I_N_A_R_Y___O_P(*); │ │ │ │ │ -166 _D_U_N_E___B_I_N_A_R_Y___O_P(/); │ │ │ │ │ -167 │ │ │ │ │ -168#undef DUNE_BINARY_OP │ │ │ │ │ -169 │ │ │ │ │ -170 // logical operators: │ │ │ │ │ -171 // For symmetry provide overloads with arithmetic types │ │ │ │ │ -172 // in the first or second argument. │ │ │ │ │ -173#define DUNE_BINARY_BOOL_OP(OP) \ │ │ │ │ │ -174 constexpr bool operator OP(const Float128& t, \ │ │ │ │ │ -175 const Float128& u) noexcept \ │ │ │ │ │ -176 { \ │ │ │ │ │ -177 return float128_t(t) OP float128_t(u); \ │ │ │ │ │ -178 } \ │ │ │ │ │ -179 template ::value, int> = 0> \ │ │ │ │ │ -181 constexpr bool operator OP(const T& t, \ │ │ │ │ │ -182 const Float128& u) noexcept \ │ │ │ │ │ -183 { \ │ │ │ │ │ -184 return float128_t(t) OP float128_t(u); \ │ │ │ │ │ -185 } \ │ │ │ │ │ -186 template ::value, int> = 0> \ │ │ │ │ │ -188 constexpr bool operator OP(const Float128& t, \ │ │ │ │ │ -189 const U& u) noexcept \ │ │ │ │ │ -190 { \ │ │ │ │ │ -191 return float128_t(t) OP float128_t(u); \ │ │ │ │ │ -192 } \ │ │ │ │ │ -193 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -194 │ │ │ │ │ -195 DUNE_BINARY_BOOL_OP(==); │ │ │ │ │ -196 DUNE_BINARY_BOOL_OP(!=); │ │ │ │ │ -197 DUNE_BINARY_BOOL_OP(<); │ │ │ │ │ -198 DUNE_BINARY_BOOL_OP(>); │ │ │ │ │ -199 DUNE_BINARY_BOOL_OP(<=); │ │ │ │ │ -200 DUNE_BINARY_BOOL_OP(>=); │ │ │ │ │ -201 │ │ │ │ │ -202#undef DUNE_BINARY_BOOL_OP │ │ │ │ │ -203 │ │ │ │ │ -204 // Overloads for the cmath functions │ │ │ │ │ -205 │ │ │ │ │ -206 // function with name `name` redirects to quadmath function `func` │ │ │ │ │ -207#define DUNE_UNARY_FUNC(name,func) \ │ │ │ │ │ -208 inline Float128 name(const Float128& u) noexcept \ │ │ │ │ │ -209 { \ │ │ │ │ │ -210 return Float128{func (float128_t(u))}; \ │ │ │ │ │ -211 } \ │ │ │ │ │ -212 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -213 │ │ │ │ │ -214 // like DUNE_UNARY_FUNC but with custom return type │ │ │ │ │ -215#define DUNE_CUSTOM_UNARY_FUNC(type,name,func) \ │ │ │ │ │ -216 inline type name(const Float128& u) noexcept \ │ │ │ │ │ -217 { \ │ │ │ │ │ -218 return (type)(func (float128_t(u))); \ │ │ │ │ │ -219 } \ │ │ │ │ │ -220 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -221 │ │ │ │ │ -222 // redirects to quadmath function with two arguments │ │ │ │ │ -223#define DUNE_BINARY_FUNC(name,func) \ │ │ │ │ │ -224 inline Float128 name(const Float128& t, \ │ │ │ │ │ -225 const Float128& u) noexcept \ │ │ │ │ │ -226 { \ │ │ │ │ │ -227 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ -228 } \ │ │ │ │ │ -229 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -230 │ │ │ │ │ -231 _D_U_N_E___U_N_A_R_Y___F_U_N_C(abs, fabsq); │ │ │ │ │ -232 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acos, acosq); │ │ │ │ │ -233 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acosh, acoshq); │ │ │ │ │ -234 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asin, asinq); │ │ │ │ │ -235 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asinh, asinhq); │ │ │ │ │ -236 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atan, atanq); │ │ │ │ │ -237 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atanh, atanhq); │ │ │ │ │ -238 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cbrt, cbrtq); │ │ │ │ │ -239 _D_U_N_E___U_N_A_R_Y___F_U_N_C(ceil, ceilq); │ │ │ │ │ -240 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cos, cosq); │ │ │ │ │ -241 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cosh, coshq); │ │ │ │ │ -242 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erf, erfq); │ │ │ │ │ -243 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erfc, erfcq); │ │ │ │ │ -244 _D_U_N_E___U_N_A_R_Y___F_U_N_C(exp, expq); │ │ │ │ │ -245 _D_U_N_E___U_N_A_R_Y___F_U_N_C(expm1, expm1q); │ │ │ │ │ -246 _D_U_N_E___U_N_A_R_Y___F_U_N_C(fabs, fabsq); │ │ │ │ │ -247 _D_U_N_E___U_N_A_R_Y___F_U_N_C(floor, floorq); │ │ │ │ │ -248 DUNE_CUSTOM_UNARY_FUNC(int, ilogb, ilogbq); │ │ │ │ │ -249 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lgamma, lgammaq); │ │ │ │ │ -250 DUNE_CUSTOM_UNARY_FUNC(long long int, llrint, llrintq); │ │ │ │ │ -251 DUNE_CUSTOM_UNARY_FUNC(long long int, llround, llroundq); │ │ │ │ │ -252 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log, logq); │ │ │ │ │ -253 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log10, log10q); │ │ │ │ │ -254 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log1p, log1pq); │ │ │ │ │ -255 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log2, log2q); │ │ │ │ │ -256 // DUNE_UNARY_FUNC(logb, logbq); // not available in gcc5 │ │ │ │ │ -257 DUNE_CUSTOM_UNARY_FUNC(long int, lrint, lrintq); │ │ │ │ │ -258 DUNE_CUSTOM_UNARY_FUNC(long int, lround, lroundq); │ │ │ │ │ -259 _D_U_N_E___U_N_A_R_Y___F_U_N_C(nearbyint, nearbyintq); │ │ │ │ │ -260 DUNE_BINARY_FUNC(nextafter, nextafterq); │ │ │ │ │ -261 DUNE_BINARY_FUNC(pow, powq); // overload for integer argument see below │ │ │ │ │ -262 _D_U_N_E___U_N_A_R_Y___F_U_N_C(rint, rintq); │ │ │ │ │ -263 _D_U_N_E___U_N_A_R_Y___F_U_N_C(round, roundq); │ │ │ │ │ -264 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sin, sinq); │ │ │ │ │ -265 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sinh, sinhq); │ │ │ │ │ -266 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sqrt, sqrtq); │ │ │ │ │ -267 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tan, tanq); │ │ │ │ │ -268 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tanh, tanhq); │ │ │ │ │ -269 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tgamma, tgammaq); │ │ │ │ │ -270 _D_U_N_E___U_N_A_R_Y___F_U_N_C(trunc, truncq); │ │ │ │ │ -271 │ │ │ │ │ -272 DUNE_CUSTOM_UNARY_FUNC(bool, isfinite, finiteq); │ │ │ │ │ -273 DUNE_CUSTOM_UNARY_FUNC(bool, isinf, isinfq); │ │ │ │ │ -274 DUNE_CUSTOM_UNARY_FUNC(bool, isnan, isnanq); │ │ │ │ │ -275 DUNE_CUSTOM_UNARY_FUNC(bool, signbit, signbitq); │ │ │ │ │ -276 │ │ │ │ │ -277#undef DUNE_UNARY_FUNC │ │ │ │ │ -278#undef DUNE_CUSTOM_UNARY_FUNC │ │ │ │ │ -279#undef DUNE_BINARY_FUNC │ │ │ │ │ -280 │ │ │ │ │ -281 // like DUNE_BINARY_FUNC but provide overloads with arithmetic │ │ │ │ │ -282 // types in the first or second argument. │ │ │ │ │ -283#define DUNE_BINARY_ARITHMETIC_FUNC(name,func) \ │ │ │ │ │ -284 inline Float128 name(const Float128& t, \ │ │ │ │ │ -285 const Float128& u) noexcept \ │ │ │ │ │ -286 { \ │ │ │ │ │ -287 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ -288 } \ │ │ │ │ │ -289 template ::value, int> = 0> \ │ │ │ │ │ -291 inline Float128 name(const T& t, \ │ │ │ │ │ -292 const Float128& u) noexcept \ │ │ │ │ │ -293 { \ │ │ │ │ │ -294 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ -295 } \ │ │ │ │ │ -296 template ::value, int> = 0> \ │ │ │ │ │ -298 inline Float128 name(const Float128& t, \ │ │ │ │ │ -299 const U& u) noexcept \ │ │ │ │ │ -300 { \ │ │ │ │ │ -301 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ -302 } \ │ │ │ │ │ -303 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -304 │ │ │ │ │ -305 DUNE_BINARY_ARITHMETIC_FUNC(atan2,atan2q); │ │ │ │ │ -306 DUNE_BINARY_ARITHMETIC_FUNC(copysign,copysignq); │ │ │ │ │ -307 DUNE_BINARY_ARITHMETIC_FUNC(fdim,fdimq); │ │ │ │ │ -308 DUNE_BINARY_ARITHMETIC_FUNC(fmax,fmaxq); │ │ │ │ │ -309 DUNE_BINARY_ARITHMETIC_FUNC(fmin,fminq); │ │ │ │ │ -310 DUNE_BINARY_ARITHMETIC_FUNC(fmod,fmodq); │ │ │ │ │ -311 DUNE_BINARY_ARITHMETIC_FUNC(hypot,hypotq); │ │ │ │ │ -312 DUNE_BINARY_ARITHMETIC_FUNC(remainder,remainderq); │ │ │ │ │ -313 │ │ │ │ │ -314#undef DUNE_BINARY_ARITHMETIC_FUNC │ │ │ │ │ -315 │ │ │ │ │ -316 // some more cmath functions with special signature │ │ │ │ │ -317 │ │ │ │ │ -318 inline Float128 fma(const Float128& t, const Float128& u, const Float128& │ │ │ │ │ -v) │ │ │ │ │ -319 { │ │ │ │ │ -320 return Float128{fmaq(float128_t(t),float128_t(u),float128_t(v))}; │ │ │ │ │ -321 } │ │ │ │ │ -322 │ │ │ │ │ -323 inline Float128 frexp(const Float128& u, int* p) │ │ │ │ │ -324 { │ │ │ │ │ -325 return Float128{frexpq(float128_t(u), p)}; │ │ │ │ │ -326 } │ │ │ │ │ -327 │ │ │ │ │ -328 inline Float128 ldexp(const Float128& u, int p) │ │ │ │ │ -329 { │ │ │ │ │ -330 return Float128{ldexpq(float128_t(u), p)}; │ │ │ │ │ -331 } │ │ │ │ │ -332 │ │ │ │ │ -333 inline Float128 remquo(const Float128& t, const Float128& u, int* quo) │ │ │ │ │ -334 { │ │ │ │ │ -335 return Float128{remquoq(float128_t(t), float128_t(u), quo)}; │ │ │ │ │ -336 } │ │ │ │ │ -337 │ │ │ │ │ -338 inline Float128 scalbln(const Float128& u, long int e) │ │ │ │ │ -339 { │ │ │ │ │ -340 return Float128{scalblnq(float128_t(u), e)}; │ │ │ │ │ -341 } │ │ │ │ │ -342 │ │ │ │ │ -343 inline Float128 scalbn(const Float128& u, int e) │ │ │ │ │ -344 { │ │ │ │ │ -345 return Float128{scalbnq(float128_t(u), e)}; │ │ │ │ │ -346 } │ │ │ │ │ -347 │ │ │ │ │ -349 // NOTE: This is much faster than a pow(x, Float128(p)) call │ │ │ │ │ -350 // NOTE: This is a modified version of boost::math::cstdfloat::detail::pown │ │ │ │ │ -351 // (adapted to the type Float128) that is part of the Boost 1.65 Math │ │ │ │ │ -toolkit 2.8.0 │ │ │ │ │ -352 // and is implemented by Christopher Kormanyos, John Maddock, and Paul A. │ │ │ │ │ -Bristow, │ │ │ │ │ -353 // distributed under the Boost Software License, Version 1.0 │ │ │ │ │ -354 // (See http://www.boost.org/LICENSE_1_0.txt) │ │ │ │ │ -355 template ::value, int> = 0> │ │ │ │ │ -357 inline Float128 pow(const Float128& x, const Int p) │ │ │ │ │ -358 { │ │ │ │ │ -359 static const Float128 _m_a_x___v_a_l_u_e = FLT128_MAX; │ │ │ │ │ -360 static const Float128 _m_i_n___v_a_l_u_e = FLT128_MIN; │ │ │ │ │ -361 static const Float128 inf_value = float128_t{1} / float128_t{0}; │ │ │ │ │ -362 │ │ │ │ │ -363 const bool isneg = (x < 0); │ │ │ │ │ -364 const bool isnan = (x != x); │ │ │ │ │ -365 const bool isinf = (isneg ? bool(-x > _m_a_x___v_a_l_u_e) : bool(+x > _m_a_x___v_a_l_u_e)); │ │ │ │ │ -366 │ │ │ │ │ -367 if (isnan) { return x; } │ │ │ │ │ -368 if (isinf) { return Float128{nanq("")}; } │ │ │ │ │ -369 │ │ │ │ │ -370 const Float128 abs_x = (isneg ? -x : x); │ │ │ │ │ -371 if (p < Int(0)) { │ │ │ │ │ -372 if (abs_x < _m_i_n___v_a_l_u_e) │ │ │ │ │ -373 return (isneg ? -inf_value : +inf_value); │ │ │ │ │ -374 else │ │ │ │ │ -375 return Float128(1) / pow(x, Int(-p)); │ │ │ │ │ -376 } │ │ │ │ │ -377 │ │ │ │ │ -378 if (p == Int(0)) { return Float128(1); } │ │ │ │ │ -379 if (p == Int(1)) { return x; } │ │ │ │ │ -380 if (abs_x > _m_a_x___v_a_l_u_e) │ │ │ │ │ -381 return (isneg ? -inf_value : +inf_value); │ │ │ │ │ -382 │ │ │ │ │ -383 if (p == Int(2)) { return (x * x); } │ │ │ │ │ -384 if (p == Int(3)) { return ((x * x) * x); } │ │ │ │ │ -385 if (p == Int(4)) { const Float128 x2 = (x * x); return (x2 * x2); } │ │ │ │ │ -386 │ │ │ │ │ -387 Float128 result = ((p % Int(2)) != Int(0)) ? x : Float128(1); │ │ │ │ │ -388 Float128 xn = x; // binary powers of x │ │ │ │ │ -389 │ │ │ │ │ -390 Int p2 = p; │ │ │ │ │ -391 while (Int(p2 /= 2) != Int(0)) { │ │ │ │ │ -392 xn *= xn; // Square xn for each binary power │ │ │ │ │ -393 │ │ │ │ │ -394 const bool has_binary_power = (Int(p2 % Int(2)) != Int(0)); │ │ │ │ │ -395 if (has_binary_power) │ │ │ │ │ -396 result *= xn; │ │ │ │ │ -397 } │ │ │ │ │ -398 │ │ │ │ │ -399 return result; │ │ │ │ │ -400 } │ │ │ │ │ -401 │ │ │ │ │ -402 │ │ │ │ │ -403 } // end namespace Impl │ │ │ │ │ -404 │ │ │ │ │ -405 template <> │ │ │ │ │ -406 struct IsNumber │ │ │ │ │ -407 : public std::true_type {}; │ │ │ │ │ -408 │ │ │ │ │ -409} // end namespace Dune │ │ │ │ │ -410 │ │ │ │ │ -411namespace _s_t_d │ │ │ │ │ -412{ │ │ │ │ │ -413#ifndef NO_STD_NUMERIC_LIMITS_SPECIALIZATION │ │ │ │ │ -414 template <> │ │ │ │ │ -415 class numeric_limits<_D_u_n_e::Impl::Float128> │ │ │ │ │ -416 { │ │ │ │ │ -417 using Float128 = Dune::Impl::Float128; │ │ │ │ │ -418 using float128_t = Dune::Impl::float128_t; │ │ │ │ │ -419 │ │ │ │ │ -420 public: │ │ │ │ │ -421 static constexpr bool is_specialized = true; │ │ │ │ │ -422 static constexpr Float128 _m_i_n() noexcept { return FLT128_MIN; } │ │ │ │ │ -423 static constexpr Float128 _m_a_x() noexcept { return FLT128_MAX; } │ │ │ │ │ -424 static constexpr Float128 lowest() noexcept { return -FLT128_MAX; } │ │ │ │ │ -425 static constexpr int digits = FLT128_MANT_DIG; │ │ │ │ │ -426 static constexpr int digits10 = 34; │ │ │ │ │ -427 static constexpr int max_digits10 = 36; │ │ │ │ │ -428 static constexpr bool is_signed = true; │ │ │ │ │ -429 static constexpr bool is_integer = false; │ │ │ │ │ -430 static constexpr bool is_exact = false; │ │ │ │ │ -431 static constexpr int radix = 2; │ │ │ │ │ -432 static constexpr Float128 epsilon() noexcept { return FLT128_EPSILON; } │ │ │ │ │ -433 static constexpr Float128 round_error() noexcept { return float128_t{0.5}; │ │ │ │ │ -} │ │ │ │ │ -434 static constexpr int min_exponent = FLT128_MIN_EXP; │ │ │ │ │ -435 static constexpr int min_exponent10 = FLT128_MIN_10_EXP; │ │ │ │ │ -436 static constexpr int max_exponent = FLT128_MAX_EXP; │ │ │ │ │ -437 static constexpr int max_exponent10 = FLT128_MAX_10_EXP; │ │ │ │ │ -438 static constexpr bool has_infinity = true; │ │ │ │ │ -439 static constexpr bool has_quiet_NaN = true; │ │ │ │ │ -440 static constexpr bool has_signaling_NaN = false; │ │ │ │ │ -441 static constexpr float_denorm_style has_denorm = denorm_present; │ │ │ │ │ -442 static constexpr bool has_denorm_loss = false; │ │ │ │ │ -443 static constexpr Float128 infinity() noexcept { return float128_t{1}/ │ │ │ │ │ -float128_t{0}; } │ │ │ │ │ -444 static Float128 quiet_NaN() noexcept { return nanq(""); } │ │ │ │ │ -445 static constexpr Float128 signaling_NaN() noexcept { return float128_t{}; } │ │ │ │ │ -446 static constexpr Float128 denorm_min() noexcept { return FLT128_DENORM_MIN; │ │ │ │ │ -} │ │ │ │ │ -447 static constexpr bool is_iec559 = true; │ │ │ │ │ -448 static constexpr bool is_bounded = false; │ │ │ │ │ -449 static constexpr bool is_modulo = false; │ │ │ │ │ -450 static constexpr bool traps = false; │ │ │ │ │ -451 static constexpr bool tinyness_before = false; │ │ │ │ │ -452 static constexpr float_round_style round_style = round_to_nearest; │ │ │ │ │ -453 }; │ │ │ │ │ -454#endif │ │ │ │ │ -455} // end namespace std │ │ │ │ │ -456 │ │ │ │ │ -457#endif // HAVE_QUADMATH │ │ │ │ │ -458#endif // DUNE_QUADMATH_HH │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_U_N_E___B_I_N_A_R_Y___O_P │ │ │ │ │ -#define DUNE_BINARY_OP(OP) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:248 │ │ │ │ │ -_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ -#define DUNE_UNARY_FUNC(name) │ │ │ │ │ -_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ -#define DUNE_ASSIGN_OP(OP) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:207 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ -Stream & operator>>(Stream &stream, std::tuple< Ts... > &t) │ │ │ │ │ -Read a std::tuple. │ │ │ │ │ -DDeeffiinniittiioonn streamoperators.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ -bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:542 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ -bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:535 │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ -_D_u_n_e │ │ │ │ │ -Dune namespace. │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_m_a_x___v_a_l_u_e │ │ │ │ │ -T max_value(const AlignedNumber< T, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:481 │ │ │ │ │ -_D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ -T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:487 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_i_n │ │ │ │ │ -auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > │ │ │ │ │ -&b) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:447 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_a_x │ │ │ │ │ -auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > │ │ │ │ │ -&b) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:425 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r │ │ │ │ │ -Default exception class for range errors. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:254 │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3// Will be removed after the 2.7 release │ │ │ │ │ +4#warning "Deprecated header, use #include instead!" │ │ │ │ │ +5#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides collective communication methods for │ │ │ │ │ +sequential programs. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00104.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: gmpfield.hh File Reference │ │ │ │ +dune-common: mpicommunication.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,60 +65,114 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
gmpfield.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Macros | │ │ │ │ +Functions
│ │ │ │ +
mpicommunication.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Wrapper for the GNU multiprecision (GMP) library. │ │ │ │ +

Implements an utility class that provides MPI's collective communication methods. │ │ │ │ More...

│ │ │ │ -
#include <iostream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <gmpxx.h>
│ │ │ │ -#include <dune/common/promotiontraits.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ +
#include <algorithm>
│ │ │ │ +#include <functional>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <mpi.h>
│ │ │ │ +#include <dune/common/binaryfunctions.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/parallel/communication.hh>
│ │ │ │ +#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ +#include <dune/common/parallel/mpifuture.hh>
│ │ │ │ +#include <dune/common/parallel/mpidata.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GMPField< precision >
 Number class for high precision floating point number using the GMP library mpf_class implementation. More...
class  Dune::Generic_MPI_Op< Type, BinaryFunction, Enable >
 
struct  Dune::IsNumber< GMPField< precision > >
 
struct  Dune::PromotionTraits< GMPField< precision1 >, GMPField< precision2 > >
 
struct  Dune::PromotionTraits< GMPField< precision >, GMPField< precision > >
 
struct  Dune::PromotionTraits< GMPField< precision >, T >
 
struct  Dune::PromotionTraits< T, GMPField< precision > >
class  Dune::Communication< MPI_Comm >
 Specialization of Communication for MPI. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Macros

#define ComposeMPIOp(func, op)
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

 Dune::ComposeMPIOp (std::plus, MPI_SUM)
 
 Dune::ComposeMPIOp (std::multiplies, MPI_PROD)
 
 Dune::ComposeMPIOp (Min, MPI_MIN)
 
 Dune::ComposeMPIOp (Max, MPI_MAX)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Wrapper for the GNU multiprecision (GMP) library.

│ │ │ │ -
│ │ │ │ +

Implements an utility class that provides MPI's collective communication methods.

│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ ComposeMPIOp

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define ComposeMPIOp( func,
 op 
)
│ │ │ │ +
│ │ │ │ +Value:
template<class T, class S> \
│ │ │ │ +
class Generic_MPI_Op<T, func<S>, std::enable_if_t<MPITraits<S>::is_intrinsic> >{ \
│ │ │ │ +
public: \
│ │ │ │ +
static MPI_Op get(){ \
│ │ │ │ +
return op; \
│ │ │ │ +
} \
│ │ │ │ +
private: \
│ │ │ │ +
Generic_MPI_Op () {} \
│ │ │ │ +
Generic_MPI_Op (const Generic_MPI_Op & ) {} \
│ │ │ │ +
}
│ │ │ │ +
STL namespace.
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,40 +1,69 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -gmpfield.hh File Reference │ │ │ │ │ -Wrapper for the GNU multiprecision (GMP) library. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ +mpicommunication.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Implements an utility class that provides MPI's collective communication │ │ │ │ │ +methods. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_f_u_t_u_r_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._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_:_:_G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _> │ │ │ │ │ -  Number class for high precision floating point number using the GMP │ │ │ │ │ - library mpf_class implementation. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_G_e_n_e_r_i_c___M_P_I___O_p_<_ _T_y_p_e_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_,_ _E_n_a_b_l_e_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_N_u_m_b_e_r_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _> │ │ │ │ │ +  Specialization of _C_o_m_m_u_n_i_c_a_t_i_o_n for MPI. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_1_ _>_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_2_ _> │ │ │ │ │ - _> │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _> │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _C_o_m_p_o_s_e_M_P_I_O_p(func, op) │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _T_ _> │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (std::plus, MPI_SUM) │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _T_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _> │ │ │ │ │ +  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (std::multiplies, MPI_PROD) │ │ │ │ │   │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ +  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (_M_i_n, MPI_MIN) │ │ │ │ │ +  │ │ │ │ │ +  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (_M_a_x, MPI_MAX) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Wrapper for the GNU multiprecision (GMP) library. │ │ │ │ │ +Implements an utility class that provides MPI's collective communication │ │ │ │ │ +methods. │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? CCoommppoosseeMMPPIIOOpp ********** │ │ │ │ │ +#define ComposeMPIOp (   func, │ │ │ │ │ +   op  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +template \ │ │ │ │ │ +class Generic_MPI_Op, _s_t_d::enable_if_t::is_intrinsic> > │ │ │ │ │ +{ \ │ │ │ │ │ +public: \ │ │ │ │ │ +static MPI_Op get(){ \ │ │ │ │ │ +return op; \ │ │ │ │ │ +} \ │ │ │ │ │ +private: \ │ │ │ │ │ +Generic_MPI_Op () {} \ │ │ │ │ │ +Generic_MPI_Op (const Generic_MPI_Op & ) {} \ │ │ │ │ │ +} │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: gmpfield.hh Source File │ │ │ │ +dune-common: mpicommunication.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,145 +70,579 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
gmpfield.hh
│ │ │ │ +
mpicommunication.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_GMPFIELD_HH
│ │ │ │ -
6#define DUNE_GMPFIELD_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH
│ │ │ │ +
6#define DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH
│ │ │ │
7
│ │ │ │ -
12#include <iostream>
│ │ │ │ -
13#include <string>
│ │ │ │ -
14#include <type_traits>
│ │ │ │ -
15
│ │ │ │ -
16#if HAVE_GMP || DOXYGEN
│ │ │ │ +
16#if HAVE_MPI
│ │ │ │
17
│ │ │ │ -
18#include <gmpxx.h>
│ │ │ │ -
19
│ │ │ │ - │ │ │ │ - │ │ │ │ -
22
│ │ │ │ -
23namespace Dune
│ │ │ │ -
24{
│ │ │ │ -
25
│ │ │ │ -
30 template< unsigned int precision >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
32 : public mpf_class
│ │ │ │ -
33 {
│ │ │ │ -
34 typedef mpf_class Base;
│ │ │ │ -
35
│ │ │ │ -
36 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
39 : Base(0,precision)
│ │ │ │ -
40 {}
│ │ │ │ -
│ │ │ │ -
41
│ │ │ │ -
│ │ │ │ -
45 GMPField ( const char* str )
│ │ │ │ -
46 : Base(str,precision)
│ │ │ │ -
47 {}
│ │ │ │ -
│ │ │ │ -
48
│ │ │ │ -
│ │ │ │ -
52 GMPField ( const std::string& str )
│ │ │ │ -
53 : Base(str,precision)
│ │ │ │ -
54 {}
│ │ │ │ -
│ │ │ │ -
55
│ │ │ │ -
58 template< class T,
│ │ │ │ -
59 typename EnableIf = typename std::enable_if<
│ │ │ │ -
60 std::is_convertible<T, mpf_class>::value>::type
│ │ │ │ -
61 >
│ │ │ │ -
│ │ │ │ -
62 GMPField ( const T &v )
│ │ │ │ -
63 : Base( v,precision )
│ │ │ │ -
64 {}
│ │ │ │ -
│ │ │ │ -
65
│ │ │ │ -
66 // type conversion operators
│ │ │ │ -
│ │ │ │ -
67 operator double () const
│ │ │ │ -
68 {
│ │ │ │ -
69 return this->get_d();
│ │ │ │ -
70 }
│ │ │ │ -
│ │ │ │ -
71
│ │ │ │ -
72 };
│ │ │ │ +
18#include <algorithm>
│ │ │ │ +
19#include <functional>
│ │ │ │ +
20#include <memory>
│ │ │ │ +
21
│ │ │ │ +
22#include <mpi.h>
│ │ │ │ +
23
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
30
│ │ │ │ +
31namespace Dune
│ │ │ │ +
32{
│ │ │ │ +
33
│ │ │ │ +
34 //=======================================================
│ │ │ │ +
35 // use singleton pattern and template specialization to
│ │ │ │ +
36 // generate MPI operations
│ │ │ │ +
37 //=======================================================
│ │ │ │ +
38
│ │ │ │ +
39 template<typename Type, typename BinaryFunction, typename Enable=void>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
41 {
│ │ │ │ +
42
│ │ │ │ +
43 public:
│ │ │ │ +
│ │ │ │ +
44 static MPI_Op get ()
│ │ │ │ +
45 {
│ │ │ │ +
46 if (!op)
│ │ │ │ +
47 {
│ │ │ │ +
48 op = std::make_unique<MPI_Op>();
│ │ │ │ +
49 // The following line leaks an MPI operation object, because the corresponding
│ │ │ │ +
50 //`MPI_Op_free` is never called. It is never called because there is no easy
│ │ │ │ +
51 // way to call it at the right moment: right before the call to MPI_Finalize.
│ │ │ │ +
52 // See https://gitlab.dune-project.org/core/dune-istl/issues/80
│ │ │ │ +
53 MPI_Op_create((void (*)(void*, void*, int*, MPI_Datatype*))&operation,true,op.get());
│ │ │ │ +
54 }
│ │ │ │ +
55 return *op;
│ │ │ │ +
56 }
│ │ │ │ +
│ │ │ │ +
57 private:
│ │ │ │ +
58 static void operation (Type *in, Type *inout, int *len, MPI_Datatype*)
│ │ │ │ +
59 {
│ │ │ │ +
60 BinaryFunction func;
│ │ │ │ +
61
│ │ │ │ +
62 for (int i=0; i< *len; ++i, ++in, ++inout) {
│ │ │ │ +
63 Type temp;
│ │ │ │ +
64 temp = func(*in, *inout);
│ │ │ │ +
65 *inout = temp;
│ │ │ │ +
66 }
│ │ │ │ +
67 }
│ │ │ │ +
68 Generic_MPI_Op () {}
│ │ │ │ +
69 Generic_MPI_Op (const Generic_MPI_Op& ) {}
│ │ │ │ +
70 static std::unique_ptr<MPI_Op> op;
│ │ │ │ +
71 };
│ │ │ │
│ │ │ │ +
72
│ │ │ │
73
│ │ │ │ -
74 template <unsigned int precision>
│ │ │ │ -
│ │ │ │ -
75 struct IsNumber<GMPField<precision>>
│ │ │ │ -
76 : public std::integral_constant<bool, true> {
│ │ │ │ -
77 };
│ │ │ │ -
│ │ │ │ -
78
│ │ │ │ -
79 template< unsigned int precision1, unsigned int precision2 >
│ │ │ │ -
│ │ │ │ -
80 struct PromotionTraits<GMPField<precision1>, GMPField<precision2>>
│ │ │ │ -
81 {
│ │ │ │ -
82 typedef GMPField<(precision1 > precision2 ? precision1 : precision2)> PromotedType;
│ │ │ │ -
83 };
│ │ │ │ -
│ │ │ │ -
84
│ │ │ │ -
85 template< unsigned int precision >
│ │ │ │ -
│ │ │ │ -
86 struct PromotionTraits<GMPField<precision>,GMPField<precision>>
│ │ │ │ -
87 {
│ │ │ │ - │ │ │ │ -
89 };
│ │ │ │ -
│ │ │ │ -
90
│ │ │ │ -
91 template< unsigned int precision, class T >
│ │ │ │ -
│ │ │ │ -
92 struct PromotionTraits<GMPField<precision>, T>
│ │ │ │ -
93 {
│ │ │ │ - │ │ │ │ -
95 };
│ │ │ │ -
│ │ │ │ +
74 template<typename Type, typename BinaryFunction, typename Enable>
│ │ │ │ +
75 std::unique_ptr<MPI_Op> Generic_MPI_Op<Type,BinaryFunction, Enable>::op;
│ │ │ │ +
76
│ │ │ │ +
│ │ │ │ +
77#define ComposeMPIOp(func,op) \
│ │ │ │ +
78 template<class T, class S> \
│ │ │ │ +
79 class Generic_MPI_Op<T, func<S>, std::enable_if_t<MPITraits<S>::is_intrinsic> >{ \
│ │ │ │ +
80 public: \
│ │ │ │ +
81 static MPI_Op get(){ \
│ │ │ │ +
82 return op; \
│ │ │ │ +
83 } \
│ │ │ │ +
84 private: \
│ │ │ │ +
85 Generic_MPI_Op () {} \
│ │ │ │ +
86 Generic_MPI_Op (const Generic_MPI_Op & ) {} \
│ │ │ │ +
87 }
│ │ │ │ +
│ │ │ │ +
88
│ │ │ │ +
89
│ │ │ │ +
90 ComposeMPIOp(std::plus, MPI_SUM);
│ │ │ │ +
91 ComposeMPIOp(std::multiplies, MPI_PROD);
│ │ │ │ +
92 ComposeMPIOp(Min, MPI_MIN);
│ │ │ │ +
93 ComposeMPIOp(Max, MPI_MAX);
│ │ │ │ +
94
│ │ │ │ +
95#undef ComposeMPIOp
│ │ │ │
96
│ │ │ │ -
97 template< class T, unsigned int precision >
│ │ │ │ -
│ │ │ │ -
98 struct PromotionTraits<T, GMPField<precision>>
│ │ │ │ -
99 {
│ │ │ │ - │ │ │ │ -
101 };
│ │ │ │ -
│ │ │ │ -
102}
│ │ │ │ -
103
│ │ │ │ -
104#endif // HAVE_GMP
│ │ │ │ -
105
│ │ │ │ -
106#endif // #ifndef DUNE_GMPFIELD_HH
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Compute type of the result of an arithmetic operation involving two different number types.
│ │ │ │ +
97
│ │ │ │ +
98 //=======================================================
│ │ │ │ +
99 // use singleton pattern and template specialization to
│ │ │ │ +
100 // generate MPI operations
│ │ │ │ +
101 //=======================================================
│ │ │ │ +
102
│ │ │ │ +
106 template<>
│ │ │ │ +
│ │ │ │ +
107 class Communication<MPI_Comm>
│ │ │ │ +
108 {
│ │ │ │ +
109 public:
│ │ │ │ +
│ │ │ │ +
111 Communication (const MPI_Comm& c = MPI_COMM_WORLD)
│ │ │ │ +
112 : communicator(c)
│ │ │ │ +
113 {
│ │ │ │ +
114 if(communicator!=MPI_COMM_NULL) {
│ │ │ │ +
115 int initialized = 0;
│ │ │ │ +
116 MPI_Initialized(&initialized);
│ │ │ │ +
117 if (!initialized)
│ │ │ │ +
118 DUNE_THROW(ParallelError,"You must call MPIHelper::instance(argc,argv) in your main() function before using the MPI Communication!");
│ │ │ │ +
119 MPI_Comm_rank(communicator,&me);
│ │ │ │ +
120 MPI_Comm_size(communicator,&procs);
│ │ │ │ +
121 }else{
│ │ │ │ +
122 procs=0;
│ │ │ │ +
123 me=-1;
│ │ │ │ +
124 }
│ │ │ │ +
125 }
│ │ │ │ +
│ │ │ │ +
126
│ │ │ │ +
│ │ │ │ +
128 int rank () const
│ │ │ │ +
129 {
│ │ │ │ +
130 return me;
│ │ │ │ +
131 }
│ │ │ │ +
│ │ │ │ +
132
│ │ │ │ +
│ │ │ │ +
134 int size () const
│ │ │ │ +
135 {
│ │ │ │ +
136 return procs;
│ │ │ │ +
137 }
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
140 template<class T>
│ │ │ │ +
│ │ │ │ +
141 int send(const T& data, int dest_rank, int tag) const
│ │ │ │ +
142 {
│ │ │ │ +
143 auto mpi_data = getMPIData(data);
│ │ │ │ +
144 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
│ │ │ │ +
145 dest_rank, tag, communicator);
│ │ │ │ +
146 }
│ │ │ │ +
│ │ │ │ +
147
│ │ │ │ +
149 template<class T>
│ │ │ │ +
│ │ │ │ +
150 MPIFuture<const T> isend(const T&& data, int dest_rank, int tag) const
│ │ │ │ +
151 {
│ │ │ │ +
152 MPIFuture<const T> future(std::forward<const T>(data));
│ │ │ │ +
153 auto mpidata = future.get_mpidata();
│ │ │ │ +
154 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(),
│ │ │ │ +
155 dest_rank, tag, communicator, &future.req_);
│ │ │ │ +
156 return future;
│ │ │ │ +
157 }
│ │ │ │ +
│ │ │ │ +
158
│ │ │ │ +
160 template<class T>
│ │ │ │ +
│ │ │ │ +
161 T recv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
│ │ │ │ +
162 {
│ │ │ │ +
163 T lvalue_data(std::forward<T>(data));
│ │ │ │ +
164 auto mpi_data = getMPIData(lvalue_data);
│ │ │ │ +
165 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
│ │ │ │ +
166 source_rank, tag, communicator, status);
│ │ │ │ +
167 return lvalue_data;
│ │ │ │ +
168 }
│ │ │ │ +
│ │ │ │ +
169
│ │ │ │ +
171 template<class T>
│ │ │ │ +
│ │ │ │ +
172 MPIFuture<T> irecv(T&& data, int source_rank, int tag) const
│ │ │ │ +
173 {
│ │ │ │ +
174 MPIFuture<T> future(std::forward<T>(data));
│ │ │ │ +
175 auto mpidata = future.get_mpidata();
│ │ │ │ +
176 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(),
│ │ │ │ +
177 source_rank, tag, communicator, &future.req_);
│ │ │ │ +
178 return future;
│ │ │ │ +
179 }
│ │ │ │ +
│ │ │ │ +
180
│ │ │ │ +
181 template<class T>
│ │ │ │ +
│ │ │ │ +
182 T rrecv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
│ │ │ │ +
183 {
│ │ │ │ +
184 MPI_Status _status;
│ │ │ │ +
185 MPI_Message _message;
│ │ │ │ +
186 T lvalue_data(std::forward<T>(data));
│ │ │ │ +
187 auto mpi_data = getMPIData(lvalue_data);
│ │ │ │ +
188 static_assert(!mpi_data.static_size, "rrecv work only for non-static-sized types.");
│ │ │ │ +
189 if(status == MPI_STATUS_IGNORE)
│ │ │ │ +
190 status = &_status;
│ │ │ │ +
191 MPI_Mprobe(source_rank, tag, communicator, &_message, status);
│ │ │ │ +
192 int size;
│ │ │ │ +
193 MPI_Get_count(status, mpi_data.type(), &size);
│ │ │ │ +
194 mpi_data.resize(size);
│ │ │ │ +
195 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message, status);
│ │ │ │ +
196 return lvalue_data;
│ │ │ │ +
197 }
│ │ │ │ +
│ │ │ │ +
198
│ │ │ │ +
200 template<typename T>
│ │ │ │ +
│ │ │ │ +
201 T sum (const T& in) const
│ │ │ │ +
202 {
│ │ │ │ +
203 T out;
│ │ │ │ +
204 allreduce<std::plus<T> >(&in,&out,1);
│ │ │ │ +
205 return out;
│ │ │ │ +
206 }
│ │ │ │ +
│ │ │ │ +
207
│ │ │ │ +
209 template<typename T>
│ │ │ │ +
│ │ │ │ +
210 int sum (T* inout, int len) const
│ │ │ │ +
211 {
│ │ │ │ +
212 return allreduce<std::plus<T> >(inout,len);
│ │ │ │ +
213 }
│ │ │ │ +
│ │ │ │ +
214
│ │ │ │ +
216 template<typename T>
│ │ │ │ +
│ │ │ │ +
217 T prod (const T& in) const
│ │ │ │ +
218 {
│ │ │ │ +
219 T out;
│ │ │ │ +
220 allreduce<std::multiplies<T> >(&in,&out,1);
│ │ │ │ +
221 return out;
│ │ │ │ +
222 }
│ │ │ │ +
│ │ │ │ +
223
│ │ │ │ +
225 template<typename T>
│ │ │ │ +
│ │ │ │ +
226 int prod (T* inout, int len) const
│ │ │ │ +
227 {
│ │ │ │ +
228 return allreduce<std::multiplies<T> >(inout,len);
│ │ │ │ +
229 }
│ │ │ │ +
│ │ │ │ +
230
│ │ │ │ +
232 template<typename T>
│ │ │ │ +
│ │ │ │ +
233 T min (const T& in) const
│ │ │ │ +
234 {
│ │ │ │ +
235 T out;
│ │ │ │ +
236 allreduce<Min<T> >(&in,&out,1);
│ │ │ │ +
237 return out;
│ │ │ │ +
238 }
│ │ │ │ +
│ │ │ │ +
239
│ │ │ │ +
241 template<typename T>
│ │ │ │ +
│ │ │ │ +
242 int min (T* inout, int len) const
│ │ │ │ +
243 {
│ │ │ │ +
244 return allreduce<Min<T> >(inout,len);
│ │ │ │ +
245 }
│ │ │ │ +
│ │ │ │ +
246
│ │ │ │ +
247
│ │ │ │ +
249 template<typename T>
│ │ │ │ +
│ │ │ │ +
250 T max (const T& in) const
│ │ │ │ +
251 {
│ │ │ │ +
252 T out;
│ │ │ │ +
253 allreduce<Max<T> >(&in,&out,1);
│ │ │ │ +
254 return out;
│ │ │ │ +
255 }
│ │ │ │ +
│ │ │ │ +
256
│ │ │ │ +
258 template<typename T>
│ │ │ │ +
│ │ │ │ +
259 int max (T* inout, int len) const
│ │ │ │ +
260 {
│ │ │ │ +
261 return allreduce<Max<T> >(inout,len);
│ │ │ │ +
262 }
│ │ │ │ +
│ │ │ │ +
263
│ │ │ │ +
│ │ │ │ +
265 int barrier () const
│ │ │ │ +
266 {
│ │ │ │ +
267 return MPI_Barrier(communicator);
│ │ │ │ +
268 }
│ │ │ │ +
│ │ │ │ +
269
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
272 {
│ │ │ │ +
273 MPIFuture<void> future(true); // make a valid MPIFuture<void>
│ │ │ │ +
274 MPI_Ibarrier(communicator, &future.req_);
│ │ │ │ +
275 return future;
│ │ │ │ +
276 }
│ │ │ │ +
│ │ │ │ +
277
│ │ │ │ +
278
│ │ │ │ +
280 template<typename T>
│ │ │ │ +
│ │ │ │ +
281 int broadcast (T* inout, int len, int root) const
│ │ │ │ +
282 {
│ │ │ │ +
283 return MPI_Bcast(inout,len,MPITraits<T>::getType(),root,communicator);
│ │ │ │ +
284 }
│ │ │ │ +
│ │ │ │ +
285
│ │ │ │ +
287 template<class T>
│ │ │ │ +
│ │ │ │ +
288 MPIFuture<T> ibroadcast(T&& data, int root) const{
│ │ │ │ +
289 MPIFuture<T> future(std::forward<T>(data));
│ │ │ │ +
290 auto mpidata = future.get_mpidata();
│ │ │ │ +
291 MPI_Ibcast(mpidata.ptr(),
│ │ │ │ +
292 mpidata.size(),
│ │ │ │ +
293 mpidata.type(),
│ │ │ │ +
294 root,
│ │ │ │ +
295 communicator,
│ │ │ │ +
296 &future.req_);
│ │ │ │ +
297 return future;
│ │ │ │ +
298 }
│ │ │ │ +
│ │ │ │ +
299
│ │ │ │ +
302 template<typename T>
│ │ │ │ +
│ │ │ │ +
303 int gather (const T* in, T* out, int len, int root) const
│ │ │ │ +
304 {
│ │ │ │ +
305 return MPI_Gather(const_cast<T*>(in),len,MPITraits<T>::getType(),
│ │ │ │ +
306 out,len,MPITraits<T>::getType(),
│ │ │ │ +
307 root,communicator);
│ │ │ │ +
308 }
│ │ │ │ +
│ │ │ │ +
309
│ │ │ │ +
311 template<class TIN, class TOUT = std::vector<TIN>>
│ │ │ │ +
│ │ │ │ +
312 MPIFuture<TOUT, TIN> igather(TIN&& data_in, TOUT&& data_out, int root) const{
│ │ │ │ +
313 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ +
314 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ +
315 auto mpidata_out = future.get_mpidata();
│ │ │ │ +
316 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size());
│ │ │ │ +
317 int outlen = (me==root) * mpidata_in.size();
│ │ │ │ +
318 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
│ │ │ │ +
319 mpidata_out.ptr(), outlen, mpidata_out.type(),
│ │ │ │ +
320 root, communicator, &future.req_);
│ │ │ │ +
321 return future;
│ │ │ │ +
322 }
│ │ │ │ +
│ │ │ │ +
323
│ │ │ │ +
325 template<typename T>
│ │ │ │ +
│ │ │ │ +
326 int gatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ, int root) const
│ │ │ │ +
327 {
│ │ │ │ +
328 return MPI_Gatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
│ │ │ │ +
329 out,recvDataLen,displ,MPITraits<T>::getType(),
│ │ │ │ +
330 root,communicator);
│ │ │ │ +
331 }
│ │ │ │ +
│ │ │ │ +
332
│ │ │ │ +
335 template<typename T>
│ │ │ │ +
│ │ │ │ +
336 int scatter (const T* sendData, T* recvData, int len, int root) const
│ │ │ │ +
337 {
│ │ │ │ +
338 return MPI_Scatter(const_cast<T*>(sendData),len,MPITraits<T>::getType(),
│ │ │ │ +
339 recvData,len,MPITraits<T>::getType(),
│ │ │ │ +
340 root,communicator);
│ │ │ │ +
341 }
│ │ │ │ +
│ │ │ │ +
342
│ │ │ │ +
344 template<class TIN, class TOUT = TIN>
│ │ │ │ +
│ │ │ │ +
345 MPIFuture<TOUT, TIN> iscatter(TIN&& data_in, TOUT&& data_out, int root) const
│ │ │ │ +
346 {
│ │ │ │ +
347 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ +
348 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ +
349 auto mpidata_out = future.get_mpidata();
│ │ │ │ +
350 int inlen = (me==root) * mpidata_in.size()/procs;
│ │ │ │ +
351 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(),
│ │ │ │ +
352 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(),
│ │ │ │ +
353 root, communicator, &future.req_);
│ │ │ │ +
354 return future;
│ │ │ │ +
355 }
│ │ │ │ +
│ │ │ │ +
356
│ │ │ │ +
358 template<typename T>
│ │ │ │ +
│ │ │ │ +
359 int scatterv (const T* sendData, int* sendDataLen, int* displ, T* recvData, int recvDataLen, int root) const
│ │ │ │ +
360 {
│ │ │ │ +
361 return MPI_Scatterv(const_cast<T*>(sendData),sendDataLen,displ,MPITraits<T>::getType(),
│ │ │ │ +
362 recvData,recvDataLen,MPITraits<T>::getType(),
│ │ │ │ +
363 root,communicator);
│ │ │ │ +
364 }
│ │ │ │ +
│ │ │ │ +
365
│ │ │ │ +
366
│ │ │ │ +
│ │ │ │ +
367 operator MPI_Comm () const
│ │ │ │ +
368 {
│ │ │ │ +
369 return communicator;
│ │ │ │ +
370 }
│ │ │ │ +
│ │ │ │ +
371
│ │ │ │ +
373 template<typename T, typename T1>
│ │ │ │ +
│ │ │ │ +
374 int allgather(const T* sbuf, int count, T1* rbuf) const
│ │ │ │ +
375 {
│ │ │ │ +
376 return MPI_Allgather(const_cast<T*>(sbuf), count, MPITraits<T>::getType(),
│ │ │ │ +
377 rbuf, count, MPITraits<T1>::getType(),
│ │ │ │ +
378 communicator);
│ │ │ │ +
379 }
│ │ │ │ +
│ │ │ │ +
380
│ │ │ │ +
382 template<class TIN, class TOUT = TIN>
│ │ │ │ +
│ │ │ │ +
383 MPIFuture<TOUT, TIN> iallgather(TIN&& data_in, TOUT&& data_out) const
│ │ │ │ +
384 {
│ │ │ │ +
385 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ +
386 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ +
387 auto mpidata_out = future.get_mpidata();
│ │ │ │ +
388 assert(mpidata_in.size()*procs <= mpidata_out.size());
│ │ │ │ +
389 int outlen = mpidata_in.size();
│ │ │ │ +
390 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
│ │ │ │ +
391 mpidata_out.ptr(), outlen, mpidata_out.type(),
│ │ │ │ +
392 communicator, &future.req_);
│ │ │ │ +
393 return future;
│ │ │ │ +
394 }
│ │ │ │ +
│ │ │ │ +
395
│ │ │ │ +
397 template<typename T>
│ │ │ │ +
│ │ │ │ +
398 int allgatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ) const
│ │ │ │ +
399 {
│ │ │ │ +
400 return MPI_Allgatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
│ │ │ │ +
401 out,recvDataLen,displ,MPITraits<T>::getType(),
│ │ │ │ +
402 communicator);
│ │ │ │ +
403 }
│ │ │ │ +
│ │ │ │ +
404
│ │ │ │ +
406 template<typename BinaryFunction, typename Type>
│ │ │ │ +
│ │ │ │ +
407 int allreduce(Type* inout, int len) const
│ │ │ │ +
408 {
│ │ │ │ +
409 Type* out = new Type[len];
│ │ │ │ +
410 int ret = allreduce<BinaryFunction>(inout,out,len);
│ │ │ │ +
411 std::copy(out, out+len, inout);
│ │ │ │ +
412 delete[] out;
│ │ │ │ +
413 return ret;
│ │ │ │ +
414 }
│ │ │ │ +
│ │ │ │ +
415
│ │ │ │ +
416 template<typename BinaryFunction, typename Type>
│ │ │ │ +
│ │ │ │ +
417 Type allreduce(Type&& in) const{
│ │ │ │ +
418 Type lvalue_data = std::forward<Type>(in);
│ │ │ │ +
419 auto data = getMPIData(lvalue_data);
│ │ │ │ +
420 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(),
│ │ │ │ + │ │ │ │ +
422 communicator);
│ │ │ │ +
423 return lvalue_data;
│ │ │ │ +
424 }
│ │ │ │ +
│ │ │ │ +
425
│ │ │ │ +
427 template<class BinaryFunction, class TIN, class TOUT = TIN>
│ │ │ │ +
│ │ │ │ +
428 MPIFuture<TOUT, TIN> iallreduce(TIN&& data_in, TOUT&& data_out) const {
│ │ │ │ +
429 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ +
430 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ +
431 auto mpidata_out = future.get_mpidata();
│ │ │ │ +
432 assert(mpidata_out.size() == mpidata_in.size());
│ │ │ │ +
433 assert(mpidata_out.type() == mpidata_in.type());
│ │ │ │ +
434 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(),
│ │ │ │ +
435 mpidata_out.size(), mpidata_out.type(),
│ │ │ │ + │ │ │ │ +
437 communicator, &future.req_);
│ │ │ │ +
438 return future;
│ │ │ │ +
439 }
│ │ │ │ +
│ │ │ │ +
440
│ │ │ │ +
442 template<class BinaryFunction, class T>
│ │ │ │ +
│ │ │ │ +
443 MPIFuture<T> iallreduce(T&& data) const{
│ │ │ │ +
444 MPIFuture<T> future(std::forward<T>(data));
│ │ │ │ +
445 auto mpidata = future.get_mpidata();
│ │ │ │ +
446 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(),
│ │ │ │ +
447 mpidata.size(), mpidata.type(),
│ │ │ │ + │ │ │ │ +
449 communicator, &future.req_);
│ │ │ │ +
450 return future;
│ │ │ │ +
451 }
│ │ │ │ +
│ │ │ │ +
452
│ │ │ │ +
454 template<typename BinaryFunction, typename Type>
│ │ │ │ +
│ │ │ │ +
455 int allreduce(const Type* in, Type* out, int len) const
│ │ │ │ +
456 {
│ │ │ │ +
457 return MPI_Allreduce(const_cast<Type*>(in), out, len, MPITraits<Type>::getType(),
│ │ │ │ + │ │ │ │ +
459 }
│ │ │ │ +
│ │ │ │ +
460
│ │ │ │ +
461 private:
│ │ │ │ +
462 MPI_Comm communicator;
│ │ │ │ +
463 int me;
│ │ │ │ +
464 int procs;
│ │ │ │ +
465 };
│ │ │ │ +
│ │ │ │ +
466} // namespace dune
│ │ │ │ +
467
│ │ │ │ +
468#endif // HAVE_MPI
│ │ │ │ +
469
│ │ │ │ +
470#endif
│ │ │ │ + │ │ │ │ +
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ +
Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
│ │ │ │ +
Implements an utility class that provides collective communication methods for sequential programs.
│ │ │ │ +
#define ComposeMPIOp(func, op)
Definition mpicommunication.hh:77
│ │ │ │ +
helper classes to provide unique types for standard functions
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition typetraits.hh:194
│ │ │ │ -
Number class for high precision floating point number using the GMP library mpf_class implementation.
Definition gmpfield.hh:33
│ │ │ │ -
GMPField(const T &v)
initialize from a compatible scalar type
Definition gmpfield.hh:62
│ │ │ │ -
GMPField()
Definition gmpfield.hh:38
│ │ │ │ -
GMPField(const std::string &str)
initialize from a string
Definition gmpfield.hh:52
│ │ │ │ -
GMPField(const char *str)
initialize from a string
Definition gmpfield.hh:45
│ │ │ │ -
GMPField< precision > PromotedType
Definition gmpfield.hh:88
│ │ │ │ -
GMPField< precision > PromotedType
Definition gmpfield.hh:94
│ │ │ │ -
GMPField< precision > PromotedType
Definition gmpfield.hh:100
│ │ │ │ -
Compute type of the result of an arithmetic operation involving two different number types.
Definition promotiontraits.hh:27
│ │ │ │ +
auto getMPIData(T &t)
Definition mpidata.hh:43
│ │ │ │ +
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
│ │ │ │ +
Definition binaryfunctions.hh:18
│ │ │ │ +
Definition binaryfunctions.hh:34
│ │ │ │ +
Default exception if an error in the parallel communication of the program occurred.
Definition exceptions.hh:287
│ │ │ │ +
Collective communication interface and sequential default implementation.
Definition communication.hh:100
│ │ │ │ +
int size() const
Number of processes in set, is greater than 0.
Definition communication.hh:126
│ │ │ │ +
Definition mpicommunication.hh:41
│ │ │ │ +
static MPI_Op get()
Definition mpicommunication.hh:44
│ │ │ │ +
int max(T *inout, int len) const
Compute the maximum of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:259
│ │ │ │ +
int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ) const
Gathers data of variable length from all tasks and distribute it to all.
Definition mpicommunication.hh:398
│ │ │ │ +
T max(const T &in) const
Compute the maximum of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:250
│ │ │ │ +
MPIFuture< T > ibroadcast(T &&data, int root) const
Distribute an array from the process with rank root to all other processes nonblocking.
Definition mpicommunication.hh:288
│ │ │ │ +
MPIFuture< void > ibarrier() const
Nonblocking barrier.
Definition mpicommunication.hh:271
│ │ │ │ +
MPIFuture< const T > isend(const T &&data, int dest_rank, int tag) const
Sends the data to the dest_rank nonblocking.
Definition mpicommunication.hh:150
│ │ │ │ +
T recv(T &&data, int source_rank, int tag, MPI_Status *status=MPI_STATUS_IGNORE) const
Receives the data from the source_rank.
Definition mpicommunication.hh:161
│ │ │ │ +
int barrier() const
Wait until all processes have arrived at this point in the program.
Definition mpicommunication.hh:265
│ │ │ │ +
int rank() const
Return rank, is between 0 and size()-1.
Definition mpicommunication.hh:128
│ │ │ │ +
int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int recvDataLen, int root) const
Scatter arrays of variable length from a root to all other tasks.
Definition mpicommunication.hh:359
│ │ │ │ +
MPIFuture< TOUT, TIN > iallgather(TIN &&data_in, TOUT &&data_out) const
Gathers data from all tasks and distribute it to all nonblocking.
Definition mpicommunication.hh:383
│ │ │ │ +
Type allreduce(Type &&in) const
Definition mpicommunication.hh:417
│ │ │ │ +
int sum(T *inout, int len) const
Compute the sum of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:210
│ │ │ │ +
int broadcast(T *inout, int len, int root) const
Distribute an array from the process with rank root to all other processes.
Definition mpicommunication.hh:281
│ │ │ │ +
MPIFuture< T > iallreduce(T &&data) const
Compute something over all processes nonblocking.
Definition mpicommunication.hh:443
│ │ │ │ +
T sum(const T &in) const
Compute the sum of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:201
│ │ │ │ +
int allreduce(const Type *in, Type *out, int len) const
Definition mpicommunication.hh:455
│ │ │ │ +
MPIFuture< TOUT, TIN > iallreduce(TIN &&data_in, TOUT &&data_out) const
Compute something over all processes nonblocking.
Definition mpicommunication.hh:428
│ │ │ │ +
int size() const
Number of processes in set, is greater than 0.
Definition mpicommunication.hh:134
│ │ │ │ +
int gather(const T *in, T *out, int len, int root) const
Gather arrays on root task.
Definition mpicommunication.hh:303
│ │ │ │ +
int allreduce(Type *inout, int len) const
Compute something over all processes for each component of an array and return the result in every pr...
Definition mpicommunication.hh:407
│ │ │ │ +
T rrecv(T &&data, int source_rank, int tag, MPI_Status *status=MPI_STATUS_IGNORE) const
Definition mpicommunication.hh:182
│ │ │ │ +
int scatter(const T *sendData, T *recvData, int len, int root) const
Scatter array from a root to all other task.
Definition mpicommunication.hh:336
│ │ │ │ +
MPIFuture< T > irecv(T &&data, int source_rank, int tag) const
Receives the data from the source_rank nonblocking.
Definition mpicommunication.hh:172
│ │ │ │ +
int prod(T *inout, int len) const
Compute the product of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:226
│ │ │ │ +
MPIFuture< TOUT, TIN > igather(TIN &&data_in, TOUT &&data_out, int root) const
Gather arrays on root task nonblocking.
Definition mpicommunication.hh:312
│ │ │ │ +
T min(const T &in) const
Compute the minimum of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:233
│ │ │ │ +
Communication(const MPI_Comm &c=MPI_COMM_WORLD)
Instantiation using a MPI communicator.
Definition mpicommunication.hh:111
│ │ │ │ +
MPIFuture< TOUT, TIN > iscatter(TIN &&data_in, TOUT &&data_out, int root) const
Scatter array from a root to all other task nonblocking.
Definition mpicommunication.hh:345
│ │ │ │ +
int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, int root) const
Gather arrays of variable size on root task.
Definition mpicommunication.hh:326
│ │ │ │ +
int min(T *inout, int len) const
Compute the minimum of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:242
│ │ │ │ +
int allgather(const T *sbuf, int count, T1 *rbuf) const
Gathers data from all tasks and distribute it to all.
Definition mpicommunication.hh:374
│ │ │ │ +
int send(const T &data, int dest_rank, int tag) const
Sends the data to the dest_rank.
Definition mpicommunication.hh:141
│ │ │ │ +
T prod(const T &in) const
Compute the product of the argument over all processes and return the result in every process....
Definition mpicommunication.hh:217
│ │ │ │ +
Provides a future-like object for MPI communication. It contains the object that will be received and...
Definition mpifuture.hh:85
│ │ │ │ +
auto get_send_mpidata()
Definition mpifuture.hh:169
│ │ │ │ +
auto get_mpidata()
Definition mpifuture.hh:165
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,146 +1,664 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -gmpfield.hh │ │ │ │ │ + * _p_a_r_a_l_l_e_l │ │ │ │ │ +mpicommunication.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_GMPFIELD_HH │ │ │ │ │ -6#define DUNE_GMPFIELD_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH │ │ │ │ │ +6#define DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH │ │ │ │ │ 7 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#if HAVE_GMP || DOXYGEN │ │ │ │ │ +16#if HAVE_MPI │ │ │ │ │ 17 │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -22 │ │ │ │ │ -23namespace _D_u_n_e │ │ │ │ │ -24{ │ │ │ │ │ -25 │ │ │ │ │ -30 template< unsigned int precision > │ │ │ │ │ -_3_1 class _G_M_P_F_i_e_l_d │ │ │ │ │ -32 : public mpf_class │ │ │ │ │ -33 { │ │ │ │ │ -34 typedef mpf_class Base; │ │ │ │ │ -35 │ │ │ │ │ -36 public: │ │ │ │ │ -_3_8 _G_M_P_F_i_e_l_d () │ │ │ │ │ -39 : Base(0,precision) │ │ │ │ │ -40 {} │ │ │ │ │ -41 │ │ │ │ │ -_4_5 _G_M_P_F_i_e_l_d ( const char* str ) │ │ │ │ │ -46 : Base(str,precision) │ │ │ │ │ -47 {} │ │ │ │ │ -48 │ │ │ │ │ -_5_2 _G_M_P_F_i_e_l_d ( const std::string& str ) │ │ │ │ │ -53 : Base(str,precision) │ │ │ │ │ -54 {} │ │ │ │ │ -55 │ │ │ │ │ -58 template< class T, │ │ │ │ │ -59 typename EnableIf = typename std::enable_if< │ │ │ │ │ -60 std::is_convertible::value>::type │ │ │ │ │ -61 > │ │ │ │ │ -_6_2 _G_M_P_F_i_e_l_d ( const T &v ) │ │ │ │ │ -63 : Base( v,precision ) │ │ │ │ │ -64 {} │ │ │ │ │ -65 │ │ │ │ │ -66 // type conversion operators │ │ │ │ │ -_6_7 operator double () const │ │ │ │ │ -68 { │ │ │ │ │ -69 return this->get_d(); │ │ │ │ │ -70 } │ │ │ │ │ -71 │ │ │ │ │ -72 }; │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21 │ │ │ │ │ +22#include │ │ │ │ │ +23 │ │ │ │ │ +24#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ +25#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +26#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +27#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ +28#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_f_u_t_u_r_e_._h_h> │ │ │ │ │ +29#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ +30 │ │ │ │ │ +31namespace _D_u_n_e │ │ │ │ │ +32{ │ │ │ │ │ +33 │ │ │ │ │ +34 //======================================================= │ │ │ │ │ +35 // use singleton pattern and template specialization to │ │ │ │ │ +36 // generate MPI operations │ │ │ │ │ +37 //======================================================= │ │ │ │ │ +38 │ │ │ │ │ +39 template │ │ │ │ │ +_4_0 class _G_e_n_e_r_i_c___M_P_I___O_p │ │ │ │ │ +41 { │ │ │ │ │ +42 │ │ │ │ │ +43 public: │ │ │ │ │ +_4_4 static MPI_Op _g_e_t () │ │ │ │ │ +45 { │ │ │ │ │ +46 if (!op) │ │ │ │ │ +47 { │ │ │ │ │ +48 op = std::make_unique(); │ │ │ │ │ +49 // The following line leaks an MPI operation object, because the │ │ │ │ │ +corresponding │ │ │ │ │ +50 //`MPI_Op_free` is never called. It is never called because there is no easy │ │ │ │ │ +51 // way to call it at the right moment: right before the call to │ │ │ │ │ +MPI_Finalize. │ │ │ │ │ +52 // See https://gitlab.dune-project.org/core/dune-istl/issues/80 │ │ │ │ │ +53 MPI_Op_create((void (*)(void*, void*, int*, │ │ │ │ │ +MPI_Datatype*))&operation,true,op.get()); │ │ │ │ │ +54 } │ │ │ │ │ +55 return *op; │ │ │ │ │ +56 } │ │ │ │ │ +57 private: │ │ │ │ │ +58 static void operation (Type *in, Type *inout, int *len, MPI_Datatype*) │ │ │ │ │ +59 { │ │ │ │ │ +60 BinaryFunction func; │ │ │ │ │ +61 │ │ │ │ │ +62 for (int i=0; i< *len; ++i, ++in, ++inout) { │ │ │ │ │ +63 Type temp; │ │ │ │ │ +64 temp = func(*in, *inout); │ │ │ │ │ +65 *inout = temp; │ │ │ │ │ +66 } │ │ │ │ │ +67 } │ │ │ │ │ +68 Generic_MPI_Op () {} │ │ │ │ │ +69 Generic_MPI_Op (const Generic_MPI_Op& ) {} │ │ │ │ │ +70 static std::unique_ptr op; │ │ │ │ │ +71 }; │ │ │ │ │ +72 │ │ │ │ │ 73 │ │ │ │ │ -74 template │ │ │ │ │ -_7_5 struct _I_s_N_u_m_b_e_r<_G_M_P_F_i_e_l_d> │ │ │ │ │ -76 : public std::integral_constant { │ │ │ │ │ -77 }; │ │ │ │ │ -78 │ │ │ │ │ -79 template< unsigned int precision1, unsigned int precision2 > │ │ │ │ │ -_8_0 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s<_G_M_P_F_i_e_l_d, _G_M_P_F_i_e_l_d> │ │ │ │ │ -81 { │ │ │ │ │ -_8_2 typedef _G_M_P_F_i_e_l_d<(precision1 > precision2 ? precision1 : precision2)> │ │ │ │ │ -_P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ -83 }; │ │ │ │ │ -84 │ │ │ │ │ -85 template< unsigned int precision > │ │ │ │ │ -_8_6 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s<_G_M_P_F_i_e_l_d,_G_M_P_F_i_e_l_d> │ │ │ │ │ -87 { │ │ │ │ │ -_8_8 typedef _G_M_P_F_i_e_l_d_<_p_r_e_c_i_s_i_o_n_> _P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ -89 }; │ │ │ │ │ -90 │ │ │ │ │ -91 template< unsigned int precision, class T > │ │ │ │ │ -_9_2 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s<_G_M_P_F_i_e_l_d, T> │ │ │ │ │ -93 { │ │ │ │ │ -_9_4 typedef _G_M_P_F_i_e_l_d_<_p_r_e_c_i_s_i_o_n_> _P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ -95 }; │ │ │ │ │ +74 template │ │ │ │ │ +75 std::unique_ptr Generic_MPI_Op::op; │ │ │ │ │ +76 │ │ │ │ │ +_7_7#define ComposeMPIOp(func,op) \ │ │ │ │ │ +78 template \ │ │ │ │ │ +79 class Generic_MPI_Op, std::enable_if_t:: │ │ │ │ │ +is_intrinsic> >{ \ │ │ │ │ │ +80 public: \ │ │ │ │ │ +81 static MPI_Op get(){ \ │ │ │ │ │ +82 return op; \ │ │ │ │ │ +83 } \ │ │ │ │ │ +84 private: \ │ │ │ │ │ +85 Generic_MPI_Op () {} \ │ │ │ │ │ +86 Generic_MPI_Op (const Generic_MPI_Op & ) {} \ │ │ │ │ │ +87 } │ │ │ │ │ +88 │ │ │ │ │ +89 │ │ │ │ │ +_9_0 _C_o_m_p_o_s_e_M_P_I_O_p(std::plus, MPI_SUM); │ │ │ │ │ +_9_1 _C_o_m_p_o_s_e_M_P_I_O_p(std::multiplies, MPI_PROD); │ │ │ │ │ +_9_2 _C_o_m_p_o_s_e_M_P_I_O_p(_M_i_n, MPI_MIN); │ │ │ │ │ +_9_3 _C_o_m_p_o_s_e_M_P_I_O_p(_M_a_x, MPI_MAX); │ │ │ │ │ +94 │ │ │ │ │ +95#undef ComposeMPIOp │ │ │ │ │ 96 │ │ │ │ │ -97 template< class T, unsigned int precision > │ │ │ │ │ -_9_8 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s> │ │ │ │ │ -99 { │ │ │ │ │ -_1_0_0 typedef _G_M_P_F_i_e_l_d_<_p_r_e_c_i_s_i_o_n_> _P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ -101 }; │ │ │ │ │ -102} │ │ │ │ │ -103 │ │ │ │ │ -104#endif // HAVE_GMP │ │ │ │ │ -105 │ │ │ │ │ -106#endif // #ifndef DUNE_GMPFIELD_HH │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h │ │ │ │ │ -Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ -number types. │ │ │ │ │ +97 │ │ │ │ │ +98 //======================================================= │ │ │ │ │ +99 // use singleton pattern and template specialization to │ │ │ │ │ +100 // generate MPI operations │ │ │ │ │ +101 //======================================================= │ │ │ │ │ +102 │ │ │ │ │ +106 template<> │ │ │ │ │ +_1_0_7 class _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +108 { │ │ │ │ │ +109 public: │ │ │ │ │ +_1_1_1 _C_o_m_m_u_n_i_c_a_t_i_o_n (const MPI_Comm& c = MPI_COMM_WORLD) │ │ │ │ │ +112 : communicator(c) │ │ │ │ │ +113 { │ │ │ │ │ +114 if(communicator!=MPI_COMM_NULL) { │ │ │ │ │ +115 int initialized = 0; │ │ │ │ │ +116 MPI_Initialized(&initialized); │ │ │ │ │ +117 if (!initialized) │ │ │ │ │ +118 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r,"You must call MPIHelper::instance(argc,argv) in │ │ │ │ │ +your main() function before using the MPI Communication!"); │ │ │ │ │ +119 MPI_Comm_rank(communicator,&me); │ │ │ │ │ +120 MPI_Comm_size(communicator,&procs); │ │ │ │ │ +121 }else{ │ │ │ │ │ +122 procs=0; │ │ │ │ │ +123 me=-1; │ │ │ │ │ +124 } │ │ │ │ │ +125 } │ │ │ │ │ +126 │ │ │ │ │ +_1_2_8 int _r_a_n_k () const │ │ │ │ │ +129 { │ │ │ │ │ +130 return me; │ │ │ │ │ +131 } │ │ │ │ │ +132 │ │ │ │ │ +_1_3_4 int _s_i_z_e () const │ │ │ │ │ +135 { │ │ │ │ │ +136 return procs; │ │ │ │ │ +137 } │ │ │ │ │ +138 │ │ │ │ │ +140 template │ │ │ │ │ +_1_4_1 int _s_e_n_d(const T& data, int dest_rank, int tag) const │ │ │ │ │ +142 { │ │ │ │ │ +143 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ +144 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), │ │ │ │ │ +145 dest_rank, tag, communicator); │ │ │ │ │ +146 } │ │ │ │ │ +147 │ │ │ │ │ +149 template │ │ │ │ │ +_1_5_0 _M_P_I_F_u_t_u_r_e_<_c_o_n_s_t_ _T_> _i_s_e_n_d(const T&& data, int dest_rank, int tag) const │ │ │ │ │ +151 { │ │ │ │ │ +152 _M_P_I_F_u_t_u_r_e_<_c_o_n_s_t_ _T_> future(std::forward(data)); │ │ │ │ │ +153 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +154 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(), │ │ │ │ │ +155 dest_rank, tag, communicator, &future.req_); │ │ │ │ │ +156 return future; │ │ │ │ │ +157 } │ │ │ │ │ +158 │ │ │ │ │ +160 template │ │ │ │ │ +_1_6_1 T _r_e_c_v(T&& data, int source_rank, int tag, MPI_Status* status = │ │ │ │ │ +MPI_STATUS_IGNORE) const │ │ │ │ │ +162 { │ │ │ │ │ +163 T lvalue_data(std::forward(data)); │ │ │ │ │ +164 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ +165 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), │ │ │ │ │ +166 source_rank, tag, communicator, status); │ │ │ │ │ +167 return lvalue_data; │ │ │ │ │ +168 } │ │ │ │ │ +169 │ │ │ │ │ +171 template │ │ │ │ │ +_1_7_2 _M_P_I_F_u_t_u_r_e_<_T_> _i_r_e_c_v(T&& data, int source_rank, int tag) const │ │ │ │ │ +173 { │ │ │ │ │ +174 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ +175 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +176 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(), │ │ │ │ │ +177 source_rank, tag, communicator, &future.req_); │ │ │ │ │ +178 return future; │ │ │ │ │ +179 } │ │ │ │ │ +180 │ │ │ │ │ +181 template │ │ │ │ │ +_1_8_2 T _r_r_e_c_v(T&& data, int source_rank, int tag, MPI_Status* status = │ │ │ │ │ +MPI_STATUS_IGNORE) const │ │ │ │ │ +183 { │ │ │ │ │ +184 MPI_Status _status; │ │ │ │ │ +185 MPI_Message _message; │ │ │ │ │ +186 T lvalue_data(std::forward(data)); │ │ │ │ │ +187 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ +188 static_assert(!mpi_data.static_size, "rrecv work only for non-static-sized │ │ │ │ │ +types."); │ │ │ │ │ +189 if(status == MPI_STATUS_IGNORE) │ │ │ │ │ +190 status = &_status; │ │ │ │ │ +191 MPI_Mprobe(source_rank, tag, communicator, &_message, status); │ │ │ │ │ +192 int _s_i_z_e; │ │ │ │ │ +193 MPI_Get_count(status, mpi_data.type(), &_s_i_z_e); │ │ │ │ │ +194 mpi_data.resize(_s_i_z_e); │ │ │ │ │ +195 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message, │ │ │ │ │ +status); │ │ │ │ │ +196 return lvalue_data; │ │ │ │ │ +197 } │ │ │ │ │ +198 │ │ │ │ │ +200 template │ │ │ │ │ +_2_0_1 T _s_u_m (const T& in) const │ │ │ │ │ +202 { │ │ │ │ │ +203 T out; │ │ │ │ │ +204 allreduce >(&in,&out,1); │ │ │ │ │ +205 return out; │ │ │ │ │ +206 } │ │ │ │ │ +207 │ │ │ │ │ +209 template │ │ │ │ │ +_2_1_0 int _s_u_m (T* inout, int len) const │ │ │ │ │ +211 { │ │ │ │ │ +212 return allreduce >(inout,len); │ │ │ │ │ +213 } │ │ │ │ │ +214 │ │ │ │ │ +216 template │ │ │ │ │ +_2_1_7 T _p_r_o_d (const T& in) const │ │ │ │ │ +218 { │ │ │ │ │ +219 T out; │ │ │ │ │ +220 allreduce >(&in,&out,1); │ │ │ │ │ +221 return out; │ │ │ │ │ +222 } │ │ │ │ │ +223 │ │ │ │ │ +225 template │ │ │ │ │ +_2_2_6 int _p_r_o_d (T* inout, int len) const │ │ │ │ │ +227 { │ │ │ │ │ +228 return allreduce >(inout,len); │ │ │ │ │ +229 } │ │ │ │ │ +230 │ │ │ │ │ +232 template │ │ │ │ │ +_2_3_3 T _m_i_n (const T& in) const │ │ │ │ │ +234 { │ │ │ │ │ +235 T out; │ │ │ │ │ +236 allreduce >(&in,&out,1); │ │ │ │ │ +237 return out; │ │ │ │ │ +238 } │ │ │ │ │ +239 │ │ │ │ │ +241 template │ │ │ │ │ +_2_4_2 int _m_i_n (T* inout, int len) const │ │ │ │ │ +243 { │ │ │ │ │ +244 return allreduce >(inout,len); │ │ │ │ │ +245 } │ │ │ │ │ +246 │ │ │ │ │ +247 │ │ │ │ │ +249 template │ │ │ │ │ +_2_5_0 T _m_a_x (const T& in) const │ │ │ │ │ +251 { │ │ │ │ │ +252 T out; │ │ │ │ │ +253 allreduce >(&in,&out,1); │ │ │ │ │ +254 return out; │ │ │ │ │ +255 } │ │ │ │ │ +256 │ │ │ │ │ +258 template │ │ │ │ │ +_2_5_9 int _m_a_x (T* inout, int len) const │ │ │ │ │ +260 { │ │ │ │ │ +261 return allreduce >(inout,len); │ │ │ │ │ +262 } │ │ │ │ │ +263 │ │ │ │ │ +_2_6_5 int _b_a_r_r_i_e_r () const │ │ │ │ │ +266 { │ │ │ │ │ +267 return MPI_Barrier(communicator); │ │ │ │ │ +268 } │ │ │ │ │ +269 │ │ │ │ │ +_2_7_1 _M_P_I_F_u_t_u_r_e_<_v_o_i_d_> _i_b_a_r_r_i_e_r () const │ │ │ │ │ +272 { │ │ │ │ │ +273 _M_P_I_F_u_t_u_r_e_<_v_o_i_d_> future(true); // make a valid MPIFuture │ │ │ │ │ +274 MPI_Ibarrier(communicator, &future.req_); │ │ │ │ │ +275 return future; │ │ │ │ │ +276 } │ │ │ │ │ +277 │ │ │ │ │ +278 │ │ │ │ │ +280 template │ │ │ │ │ +_2_8_1 int _b_r_o_a_d_c_a_s_t (T* inout, int len, int root) const │ │ │ │ │ +282 { │ │ │ │ │ +283 return MPI_Bcast(inout,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(),root,communicator); │ │ │ │ │ +284 } │ │ │ │ │ +285 │ │ │ │ │ +287 template │ │ │ │ │ +_2_8_8 _M_P_I_F_u_t_u_r_e_<_T_> _i_b_r_o_a_d_c_a_s_t(T&& data, int root) const{ │ │ │ │ │ +289 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ +290 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +291 MPI_Ibcast(mpidata.ptr(), │ │ │ │ │ +292 mpidata.size(), │ │ │ │ │ +293 mpidata.type(), │ │ │ │ │ +294 root, │ │ │ │ │ +295 communicator, │ │ │ │ │ +296 &future.req_); │ │ │ │ │ +297 return future; │ │ │ │ │ +298 } │ │ │ │ │ +299 │ │ │ │ │ +302 template │ │ │ │ │ +_3_0_3 int _g_a_t_h_e_r (const T* in, T* out, int len, int root) const │ │ │ │ │ +304 { │ │ │ │ │ +305 return MPI_Gather(const_cast(in),len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +306 out,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +307 root,communicator); │ │ │ │ │ +308 } │ │ │ │ │ +309 │ │ │ │ │ +311 template> │ │ │ │ │ +_3_1_2 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out, int root) │ │ │ │ │ +const{ │ │ │ │ │ +313 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ +(data_in)); │ │ │ │ │ +314 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ +315 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +316 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size()); │ │ │ │ │ +317 int outlen = (me==root) * mpidata_in.size(); │ │ │ │ │ +318 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(), │ │ │ │ │ +319 mpidata_out.ptr(), outlen, mpidata_out.type(), │ │ │ │ │ +320 root, communicator, &future.req_); │ │ │ │ │ +321 return future; │ │ │ │ │ +322 } │ │ │ │ │ +323 │ │ │ │ │ +325 template │ │ │ │ │ +_3_2_6 int _g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, int* recvDataLen, int* │ │ │ │ │ +displ, int root) const │ │ │ │ │ +327 { │ │ │ │ │ +328 return MPI_Gatherv(const_cast(in),sendDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +329 out,recvDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +330 root,communicator); │ │ │ │ │ +331 } │ │ │ │ │ +332 │ │ │ │ │ +335 template │ │ │ │ │ +_3_3_6 int _s_c_a_t_t_e_r (const T* sendData, T* recvData, int len, int root) const │ │ │ │ │ +337 { │ │ │ │ │ +338 return MPI_Scatter(const_cast(sendData),len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +339 recvData,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +340 root,communicator); │ │ │ │ │ +341 } │ │ │ │ │ +342 │ │ │ │ │ +344 template │ │ │ │ │ +_3_4_5 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_s_c_a_t_t_e_r(TIN&& data_in, TOUT&& data_out, int root) │ │ │ │ │ +const │ │ │ │ │ +346 { │ │ │ │ │ +347 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ +(data_in)); │ │ │ │ │ +348 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ +349 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +350 int inlen = (me==root) * mpidata_in.size()/procs; │ │ │ │ │ +351 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(), │ │ │ │ │ +352 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(), │ │ │ │ │ +353 root, communicator, &future.req_); │ │ │ │ │ +354 return future; │ │ │ │ │ +355 } │ │ │ │ │ +356 │ │ │ │ │ +358 template │ │ │ │ │ +_3_5_9 int _s_c_a_t_t_e_r_v (const T* sendData, int* sendDataLen, int* displ, T* recvData, │ │ │ │ │ +int recvDataLen, int root) const │ │ │ │ │ +360 { │ │ │ │ │ +361 return MPI_Scatterv(const_cast │ │ │ │ │ +(sendData),sendDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +362 recvData,recvDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +363 root,communicator); │ │ │ │ │ +364 } │ │ │ │ │ +365 │ │ │ │ │ +366 │ │ │ │ │ +_3_6_7 operator MPI_Comm () const │ │ │ │ │ +368 { │ │ │ │ │ +369 return communicator; │ │ │ │ │ +370 } │ │ │ │ │ +371 │ │ │ │ │ +373 template │ │ │ │ │ +_3_7_4 int _a_l_l_g_a_t_h_e_r(const T* sbuf, int count, T1* rbuf) const │ │ │ │ │ +375 { │ │ │ │ │ +376 return MPI_Allgather(const_cast(sbuf), count, _M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +377 rbuf, count, _M_P_I_T_r_a_i_t_s_<_T_1_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +378 communicator); │ │ │ │ │ +379 } │ │ │ │ │ +380 │ │ │ │ │ +382 template │ │ │ │ │ +_3_8_3 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_a_l_l_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out) const │ │ │ │ │ +384 { │ │ │ │ │ +385 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ +(data_in)); │ │ │ │ │ +386 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ +387 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +388 assert(mpidata_in.size()*procs <= mpidata_out.size()); │ │ │ │ │ +389 int outlen = mpidata_in.size(); │ │ │ │ │ +390 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(), │ │ │ │ │ +391 mpidata_out.ptr(), outlen, mpidata_out.type(), │ │ │ │ │ +392 communicator, &future.req_); │ │ │ │ │ +393 return future; │ │ │ │ │ +394 } │ │ │ │ │ +395 │ │ │ │ │ +397 template │ │ │ │ │ +_3_9_8 int _a_l_l_g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, int* recvDataLen, │ │ │ │ │ +int* displ) const │ │ │ │ │ +399 { │ │ │ │ │ +400 return MPI_Allgatherv(const_cast(in),sendDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e │ │ │ │ │ +(), │ │ │ │ │ +401 out,recvDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ +402 communicator); │ │ │ │ │ +403 } │ │ │ │ │ +404 │ │ │ │ │ +406 template │ │ │ │ │ +_4_0_7 int _a_l_l_r_e_d_u_c_e(Type* inout, int len) const │ │ │ │ │ +408 { │ │ │ │ │ +409 Type* out = new Type[len]; │ │ │ │ │ +410 int ret = allreduce(inout,out,len); │ │ │ │ │ +411 std::copy(out, out+len, inout); │ │ │ │ │ +412 delete[] out; │ │ │ │ │ +413 return ret; │ │ │ │ │ +414 } │ │ │ │ │ +415 │ │ │ │ │ +416 template │ │ │ │ │ +_4_1_7 Type _a_l_l_r_e_d_u_c_e(Type&& in) const{ │ │ │ │ │ +418 Type lvalue_data = std::forward(in); │ │ │ │ │ +419 auto data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ +420 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(), │ │ │ │ │ +421 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_y_p_e_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()), │ │ │ │ │ +422 communicator); │ │ │ │ │ +423 return lvalue_data; │ │ │ │ │ +424 } │ │ │ │ │ +425 │ │ │ │ │ +427 template │ │ │ │ │ +_4_2_8 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_a_l_l_r_e_d_u_c_e(TIN&& data_in, TOUT&& data_out) const { │ │ │ │ │ +429 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ +(data_in)); │ │ │ │ │ +430 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ +431 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +432 assert(mpidata_out.size() == mpidata_in.size()); │ │ │ │ │ +433 assert(mpidata_out.type() == mpidata_in.type()); │ │ │ │ │ +434 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(), │ │ │ │ │ +435 mpidata_out.size(), mpidata_out.type(), │ │ │ │ │ +436 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_I_N_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()), │ │ │ │ │ +437 communicator, &future.req_); │ │ │ │ │ +438 return future; │ │ │ │ │ +439 } │ │ │ │ │ +440 │ │ │ │ │ +442 template │ │ │ │ │ +_4_4_3 _M_P_I_F_u_t_u_r_e_<_T_> _i_a_l_l_r_e_d_u_c_e(T&& data) const{ │ │ │ │ │ +444 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ +445 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ +446 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(), │ │ │ │ │ +447 mpidata.size(), mpidata.type(), │ │ │ │ │ +448 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()), │ │ │ │ │ +449 communicator, &future.req_); │ │ │ │ │ +450 return future; │ │ │ │ │ +451 } │ │ │ │ │ +452 │ │ │ │ │ +454 template │ │ │ │ │ +_4_5_5 int _a_l_l_r_e_d_u_c_e(const Type* in, Type* out, int len) const │ │ │ │ │ +456 { │ │ │ │ │ +457 return MPI_Allreduce(const_cast(in), out, len, _M_P_I_T_r_a_i_t_s_<_T_y_p_e_>_:_: │ │ │ │ │ +_g_e_t_T_y_p_e(), │ │ │ │ │ +458 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_y_p_e_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()),communicator); │ │ │ │ │ +459 } │ │ │ │ │ +460 │ │ │ │ │ +461 private: │ │ │ │ │ +462 MPI_Comm communicator; │ │ │ │ │ +463 int me; │ │ │ │ │ +464 int procs; │ │ │ │ │ +465 }; │ │ │ │ │ +466} // namespace dune │ │ │ │ │ +467 │ │ │ │ │ +468#endif // HAVE_MPI │ │ │ │ │ +469 │ │ │ │ │ +470#endif │ │ │ │ │ +_m_p_i_f_u_t_u_r_e_._h_h │ │ │ │ │ +_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ +_m_p_i_d_a_t_a_._h_h │ │ │ │ │ +Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ +MPI calls. │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ +Implements an utility class that provides collective communication methods for │ │ │ │ │ +sequential programs. │ │ │ │ │ +_C_o_m_p_o_s_e_M_P_I_O_p │ │ │ │ │ +#define ComposeMPIOp(func, op) │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:77 │ │ │ │ │ +_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h │ │ │ │ │ +helper classes to provide unique types for standard functions │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_I_s_N_u_m_b_e_r │ │ │ │ │ -Whether this type acts as a scalar in the context of (hierarchically blocked) │ │ │ │ │ -containers. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ -Number class for high precision floating point number using the GMP library │ │ │ │ │ -mpf_class implementation. │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ -GMPField(const T &v) │ │ │ │ │ -initialize from a compatible scalar type │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:62 │ │ │ │ │ -_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ -GMPField() │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ -GMPField(const std::string &str) │ │ │ │ │ -initialize from a string │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ -GMPField(const char *str) │ │ │ │ │ -initialize from a string │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _>_:_: │ │ │ │ │ -_P_r_o_m_o_t_e_d_T_y_p_e │ │ │ │ │ -GMPField< precision > PromotedType │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:88 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _T_ _>_:_:_P_r_o_m_o_t_e_d_T_y_p_e │ │ │ │ │ -GMPField< precision > PromotedType │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _T_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _>_:_:_P_r_o_m_o_t_e_d_T_y_p_e │ │ │ │ │ -GMPField< precision > PromotedType │ │ │ │ │ -DDeeffiinniittiioonn gmpfield.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s │ │ │ │ │ -Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ -number types. │ │ │ │ │ -DDeeffiinniittiioonn promotiontraits.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ +auto getMPIData(T &t) │ │ │ │ │ +DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s │ │ │ │ │ +A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ +DDeeffiinniittiioonn mpitraits.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_M_i_n │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:18 │ │ │ │ │ +_D_u_n_e_:_:_M_a_x │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_E_r_r_o_r │ │ │ │ │ +Default exception if an error in the parallel communication of the program │ │ │ │ │ +occurred. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:287 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Collective communication interface and sequential default implementation. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +Number of processes in set, is greater than 0. │ │ │ │ │ +DDeeffiinniittiioonn communication.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_G_e_n_e_r_i_c___M_P_I___O_p │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_G_e_n_e_r_i_c___M_P_I___O_p_:_:_g_e_t │ │ │ │ │ +static MPI_Op get() │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_a_x │ │ │ │ │ +int max(T *inout, int len) const │ │ │ │ │ +Compute the maximum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_g_a_t_h_e_r_v │ │ │ │ │ +int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int │ │ │ │ │ +*displ) const │ │ │ │ │ +Gathers data of variable length from all tasks and distribute it to all. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:398 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_a_x │ │ │ │ │ +T max(const T &in) const │ │ │ │ │ +Compute the maximum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_b_r_o_a_d_c_a_s_t │ │ │ │ │ +MPIFuture< T > ibroadcast(T &&data, int root) const │ │ │ │ │ +Distribute an array from the process with rank root to all other processes │ │ │ │ │ +nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:288 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_b_a_r_r_i_e_r │ │ │ │ │ +MPIFuture< void > ibarrier() const │ │ │ │ │ +Nonblocking barrier. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_s_e_n_d │ │ │ │ │ +MPIFuture< const T > isend(const T &&data, int dest_rank, int tag) const │ │ │ │ │ +Sends the data to the dest_rank nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_r_e_c_v │ │ │ │ │ +T recv(T &&data, int source_rank, int tag, MPI_Status │ │ │ │ │ +*status=MPI_STATUS_IGNORE) const │ │ │ │ │ +Receives the data from the source_rank. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:161 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_b_a_r_r_i_e_r │ │ │ │ │ +int barrier() const │ │ │ │ │ +Wait until all processes have arrived at this point in the program. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:265 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_r_a_n_k │ │ │ │ │ +int rank() const │ │ │ │ │ +Return rank, is between 0 and size()-1. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:128 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_c_a_t_t_e_r_v │ │ │ │ │ +int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int │ │ │ │ │ +recvDataLen, int root) const │ │ │ │ │ +Scatter arrays of variable length from a root to all other tasks. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:359 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_a_l_l_g_a_t_h_e_r │ │ │ │ │ +MPIFuture< TOUT, TIN > iallgather(TIN &&data_in, TOUT &&data_out) const │ │ │ │ │ +Gathers data from all tasks and distribute it to all nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:383 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ +Type allreduce(Type &&in) const │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:417 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_u_m │ │ │ │ │ +int sum(T *inout, int len) const │ │ │ │ │ +Compute the sum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:210 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_b_r_o_a_d_c_a_s_t │ │ │ │ │ +int broadcast(T *inout, int len, int root) const │ │ │ │ │ +Distribute an array from the process with rank root to all other processes. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ +MPIFuture< T > iallreduce(T &&data) const │ │ │ │ │ +Compute something over all processes nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:443 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_u_m │ │ │ │ │ +T sum(const T &in) const │ │ │ │ │ +Compute the sum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:201 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ +int allreduce(const Type *in, Type *out, int len) const │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:455 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ +MPIFuture< TOUT, TIN > iallreduce(TIN &&data_in, TOUT &&data_out) const │ │ │ │ │ +Compute something over all processes nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:428 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +Number of processes in set, is greater than 0. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:134 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_g_a_t_h_e_r │ │ │ │ │ +int gather(const T *in, T *out, int len, int root) const │ │ │ │ │ +Gather arrays on root task. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:303 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ +int allreduce(Type *inout, int len) const │ │ │ │ │ +Compute something over all processes for each component of an array and return │ │ │ │ │ +the result in every pr... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:407 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_r_r_e_c_v │ │ │ │ │ +T rrecv(T &&data, int source_rank, int tag, MPI_Status │ │ │ │ │ +*status=MPI_STATUS_IGNORE) const │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_c_a_t_t_e_r │ │ │ │ │ +int scatter(const T *sendData, T *recvData, int len, int root) const │ │ │ │ │ +Scatter array from a root to all other task. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:336 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_r_e_c_v │ │ │ │ │ +MPIFuture< T > irecv(T &&data, int source_rank, int tag) const │ │ │ │ │ +Receives the data from the source_rank nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:172 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_p_r_o_d │ │ │ │ │ +int prod(T *inout, int len) const │ │ │ │ │ +Compute the product of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:226 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_g_a_t_h_e_r │ │ │ │ │ +MPIFuture< TOUT, TIN > igather(TIN &&data_in, TOUT &&data_out, int root) const │ │ │ │ │ +Gather arrays on root task nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:312 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_i_n │ │ │ │ │ +T min(const T &in) const │ │ │ │ │ +Compute the minimum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:233 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +Communication(const MPI_Comm &c=MPI_COMM_WORLD) │ │ │ │ │ +Instantiation using a MPI communicator. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:111 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_s_c_a_t_t_e_r │ │ │ │ │ +MPIFuture< TOUT, TIN > iscatter(TIN &&data_in, TOUT &&data_out, int root) const │ │ │ │ │ +Scatter array from a root to all other task nonblocking. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:345 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_g_a_t_h_e_r_v │ │ │ │ │ +int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, │ │ │ │ │ +int root) const │ │ │ │ │ +Gather arrays of variable size on root task. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:326 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_i_n │ │ │ │ │ +int min(T *inout, int len) const │ │ │ │ │ +Compute the minimum of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:242 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_g_a_t_h_e_r │ │ │ │ │ +int allgather(const T *sbuf, int count, T1 *rbuf) const │ │ │ │ │ +Gathers data from all tasks and distribute it to all. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:374 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_e_n_d │ │ │ │ │ +int send(const T &data, int dest_rank, int tag) const │ │ │ │ │ +Sends the data to the dest_rank. │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_p_r_o_d │ │ │ │ │ +T prod(const T &in) const │ │ │ │ │ +Compute the product of the argument over all processes and return the result in │ │ │ │ │ +every process.... │ │ │ │ │ +DDeeffiinniittiioonn mpicommunication.hh:217 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ +Provides a future-like object for MPI communication. It contains the object │ │ │ │ │ +that will be received and... │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___s_e_n_d___m_p_i_d_a_t_a │ │ │ │ │ +auto get_send_mpidata() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:169 │ │ │ │ │ +_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___m_p_i_d_a_t_a │ │ │ │ │ +auto get_mpidata() │ │ │ │ │ +DDeeffiinniittiioonn mpifuture.hh:165 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00110.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: parametertreeparser.cc File Reference │ │ │ │ +dune-common: indexset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,32 +65,124 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
parametertreeparser.cc File Reference
│ │ │ │ +
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Enumerations | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ -
#include "parametertreeparser.hh"
│ │ │ │ -#include <cstdlib>
│ │ │ │ + │ │ │ │ +

Provides a map between global and local indices. │ │ │ │ +More...

│ │ │ │ +
#include <algorithm>
│ │ │ │ +#include <dune/common/arraylist.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ #include <iostream>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <sstream>
│ │ │ │ -#include <fstream>
│ │ │ │ -#include <set>
│ │ │ │ -#include <map>
│ │ │ │ -#include <algorithm>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ +#include "localindex.hh"
│ │ │ │ +#include <stdint.h>
│ │ │ │ +
│ │ │ │ +

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::IndexPair< TG, TL >
 A pair consisting of a global and local index. More...
 
class  Dune::InvalidIndexSetState
 Exception indicating that the index set is not in the expected state. More...
 
class  Dune::ParallelIndexSet< TG, TL, N >
 Manager class for the mapping between local indices and globally unique indices. More...
 
class  Dune::ParallelIndexSet< TG, TL, N >::iterator
 The iterator over the pairs. More...
 
class  Dune::GlobalLookupIndexSet< I >
 Decorates an index set with the possibility to find a global index that is mapped to a specific local. More...
 
struct  Dune::LocalIndexComparator< T >
 
struct  Dune::IndexSetSortFunctor< TG, TL >
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Namespaces

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

│ │ │ │ +Enumerations

enum  Dune::ParallelIndexSetState { Dune::GROUND │ │ │ │ +, Dune::RESIZE │ │ │ │ + }
 The states the index set can be in. More...
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Functions

template<class TG , class TL >
std::ostream & Dune::operator<< (std::ostream &os, const IndexPair< TG, TL > &pair)
 Print an index pair.
 
template<class TG , class TL >
bool Dune::operator== (const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
 
template<class TG , class TL >
bool Dune::operator!= (const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
 
template<class TG , class TL >
bool Dune::operator< (const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
 
template<class TG , class TL >
bool Dune::operator> (const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
 
template<class TG , class TL >
bool Dune::operator<= (const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
 
template<class TG , class TL >
bool Dune::operator>= (const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
 
template<class TG , class TL >
bool Dune::operator== (const IndexPair< TG, TL > &, const TG &)
 
template<class TG , class TL >
bool Dune::operator!= (const IndexPair< TG, TL > &, const TG &)
 
template<class TG , class TL >
bool Dune::operator< (const IndexPair< TG, TL > &, const TG &)
 
template<class TG , class TL >
bool Dune::operator> (const IndexPair< TG, TL > &, const TG &)
 
template<class TG , class TL >
bool Dune::operator<= (const IndexPair< TG, TL > &, const TG &)
 
template<class TG , class TL >
bool Dune::operator>= (const IndexPair< TG, TL > &, const TG &)
 
template<class TG , class TL , int N>
std::ostream & Dune::operator<< (std::ostream &os, const ParallelIndexSet< TG, TL, N > &indexSet)
 Print an index set.
 
│ │ │ │ +

Detailed Description

│ │ │ │ +

Provides a map between global and local indices.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,20 +1,108 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -parametertreeparser.cc File Reference │ │ │ │ │ -#include "_p_a_r_a_m_e_t_e_r_t_r_e_e_p_a_r_s_e_r_._h_h" │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ + * _p_a_r_a_l_l_e_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 │ │ │ │ │ +indexset.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ +Provides a map between global and local indices. _M_o_r_e_._._. │ │ │ │ │ #include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_a_r_r_a_y_l_i_s_t_._h_h> │ │ │ │ │ #include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include "_l_o_c_a_l_i_n_d_e_x_._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_:_:_I_n_d_e_x_P_a_i_r_<_ _T_G_,_ _T_L_ _> │ │ │ │ │ +  A pair consisting of a global and local index. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_I_n_v_a_l_i_d_I_n_d_e_x_S_e_t_S_t_a_t_e │ │ │ │ │ +  _E_x_c_e_p_t_i_o_n indicating that the index set is not in the expected state. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_ _T_G_,_ _T_L_,_ _N_ _> │ │ │ │ │ +  Manager class for the mapping between local indices and globally │ │ │ │ │ + unique indices. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_ _T_G_,_ _T_L_,_ _N_ _>_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +  The iterator over the pairs. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_ _I_ _> │ │ │ │ │ +  Decorates an index set with the possibility to find a global index │ │ │ │ │ + that is mapped to a specific local. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r_<_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_n_d_e_x_S_e_t_S_o_r_t_F_u_n_c_t_o_r_<_ _T_G_,_ _T_L_ _> │ │ │ │ │ +  │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │ +  │ │ │ │ │ +EEnnuummeerraattiioonnss │ │ │ │ │ +enum   _D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_S_t_a_t_e { _D_u_n_e_:_:_G_R_O_U_N_D , _D_u_n_e_:_:_R_E_S_I_Z_E } │ │ │ │ │ +  The states the index set can be in. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _I_n_d_e_x_P_a_i_r< TG, TL > │ │ │ │ │ + &pair) │ │ │ │ │ +  Print an index pair. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const _I_n_d_e_x_P_a_i_r< │ │ │ │ │ + TG, TL > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const _I_n_d_e_x_P_a_i_r< │ │ │ │ │ + TG, TL > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const _I_n_d_e_x_P_a_i_r< │ │ │ │ │ + TG, TL > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_> (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const _I_n_d_e_x_P_a_i_r< │ │ │ │ │ + TG, TL > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const _I_n_d_e_x_P_a_i_r< │ │ │ │ │ + TG, TL > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const _I_n_d_e_x_P_a_i_r< │ │ │ │ │ + TG, TL > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const TG &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const TG &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const TG &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_> (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const TG &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const TG &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_= (const _I_n_d_e_x_P_a_i_r< TG, TL > &, const TG &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t< TG, │ │ │ │ │ + TL, N > &indexSet) │ │ │ │ │ +  Print an index set. │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Provides a map between global and local indices. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00113.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: interfaces.hh File Reference │ │ │ │ +dune-common: alignedallocator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,38 +72,36 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
interfaces.hh File Reference
│ │ │ │ +
alignedallocator.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

Provides interfaces for detection of specific behavior. │ │ │ │ -More...

│ │ │ │ - │ │ │ │ +
#include "mallocallocator.hh"
│ │ │ │ +#include <cstdlib>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Cloneable
 An interface class for cloneable objects. More...
class  Dune::AlignedAllocator< T, Alignment >
 Allocators which guarantee alignment of the memory. More...
 
struct  Dune::AlignedAllocator< T, Alignment >::rebind< U >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Provides interfaces for detection of specific behavior.

│ │ │ │ -
Author
Robert Kloefkorn
│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,24 +1,23 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -interfaces.hh File Reference │ │ │ │ │ -Provides interfaces for detection of specific behavior. _M_o_r_e_._._. │ │ │ │ │ +alignedallocator.hh File Reference │ │ │ │ │ +#include "_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._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_l_o_n_e_a_b_l_e │ │ │ │ │ -  An interface class for cloneable objects. _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_<_ _T_,_ _A_l_i_g_n_m_e_n_t_ _> │ │ │ │ │ +  Allocators which guarantee alignment of the memory. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_<_ _T_,_ _A_l_i_g_n_m_e_n_t_ _>_:_:_r_e_b_i_n_d_<_ _U_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides interfaces for detection of specific behavior. │ │ │ │ │ - Author │ │ │ │ │ - Robert Kloefkorn │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00113_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: interfaces.hh Source File │ │ │ │ +dune-common: alignedallocator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,45 +74,122 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
interfaces.hh
│ │ │ │ +
alignedallocator.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_INTERFACES_HH
│ │ │ │ -
6#define DUNE_INTERFACES_HH
│ │ │ │ +
5#ifndef DUNE_ALIGNED_ALLOCATOR_HH
│ │ │ │ +
6#define DUNE_ALIGNED_ALLOCATOR_HH
│ │ │ │
7
│ │ │ │ -
13namespace Dune {
│ │ │ │ +
8#include "mallocallocator.hh"
│ │ │ │ +
9#include <cstdlib>
│ │ │ │ +
10
│ │ │ │ +
11
│ │ │ │ +
│ │ │ │ +
12namespace Dune
│ │ │ │ +
13{
│ │ │ │
14
│ │ │ │ -
│ │ │ │ -
16 struct Cloneable {
│ │ │ │ -
17
│ │ │ │ -
23 virtual Cloneable* clone() const = 0;
│ │ │ │ +
22 template<class T, int Alignment = -1>
│ │ │ │ +
│ │ │ │ + │ │ │ │
24
│ │ │ │ -
│ │ │ │ -
26 virtual ~Cloneable()
│ │ │ │ -
27 {}
│ │ │ │ -
│ │ │ │ -
28
│ │ │ │ -
29 };
│ │ │ │ -
│ │ │ │ -
30
│ │ │ │ -
31} // end namespace Dune
│ │ │ │ -
32#endif
│ │ │ │ +
25#if __APPLE__
│ │ │ │ +
26
│ │ │ │ +
27 /*
│ │ │ │ +
28 * macOS has pretty draconian restrictions on the
│ │ │ │ +
29 * alignments that you may ask for: It has to be
│ │ │ │ +
30 *
│ │ │ │ +
31 * 1) a power of 2
│ │ │ │ +
32 * 2) at least as large as sizeof(void*)
│ │ │ │ +
33 *
│ │ │ │ +
34 * So here is a little constexpr function that calculates just that
│ │ │ │ +
35 * (together with the correct starting value for align fed in further down).
│ │ │ │ +
36 */
│ │ │ │ +
37 static constexpr int fixAlignment(int align)
│ │ │ │ +
38 {
│ │ │ │ +
39 return ((Alignment==-1) ? std::alignment_of<T>::value : Alignment) > align
│ │ │ │ +
40 ? fixAlignment(align << 1) : align;
│ │ │ │ +
41 }
│ │ │ │ +
42
│ │ │ │ +
43#else
│ │ │ │ +
44
│ │ │ │ +
45 /*
│ │ │ │ +
46 * Non-Apple platforms we just have to check whether an explicit alignment was
│ │ │ │ +
47 * restricted or fall back to the default alignment of T.
│ │ │ │ +
48 */
│ │ │ │ +
49 static constexpr int fixAlignment(int align)
│ │ │ │ +
50 {
│ │ │ │ +
51 return (Alignment==-1) ? std::alignment_of<T>::value : Alignment;
│ │ │ │ +
52 }
│ │ │ │ +
53
│ │ │ │ +
54#endif
│ │ │ │ +
55
│ │ │ │ +
56 public:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
│ │ │ │ +
59 template <class U> struct rebind {
│ │ │ │ + │ │ │ │ +
61 };
│ │ │ │ +
│ │ │ │ +
62
│ │ │ │ +
63 static constexpr int alignment = fixAlignment(sizeof(void*));
│ │ │ │ +
64
│ │ │ │ +
│ │ │ │ +
66 pointer allocate(size_type n, [[maybe_unused]] const void* hint = 0)
│ │ │ │ +
67 {
│ │ │ │ +
68 if (n > this->max_size())
│ │ │ │ +
69 throw std::bad_alloc();
│ │ │ │ +
70
│ │ │ │ +
71#if __APPLE__
│ │ │ │ +
72 // Apple is also restrictive regarding the allocation size.
│ │ │ │ +
73 // size must be at least the alignment size.
│ │ │ │ +
74 size_type size = n * sizeof(T) >= alignment ? n * sizeof(T) : alignment;
│ │ │ │ +
75#else
│ │ │ │ +
76 size_type size = n * sizeof(T);
│ │ │ │ +
77#endif
│ │ │ │ +
78
│ │ │ │ +
79 /*
│ │ │ │ +
80 * Everybody else gets the standard treatment.
│ │ │ │ +
81 */
│ │ │ │ +
82 pointer ret = static_cast<pointer>(std::aligned_alloc(alignment, size));
│ │ │ │ +
83 if (!ret)
│ │ │ │ +
84 throw std::bad_alloc();
│ │ │ │ +
85
│ │ │ │ +
86 return ret;
│ │ │ │ +
87 }
│ │ │ │ +
│ │ │ │ +
88 };
│ │ │ │ +
│ │ │ │ +
89
│ │ │ │ +
90}
│ │ │ │ +
│ │ │ │ +
91
│ │ │ │ +
92#endif // DUNE_ALIGNED_ALLOCATOR_HH
│ │ │ │ +
Allocators that use malloc/free.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
An interface class for cloneable objects.
Definition interfaces.hh:16
│ │ │ │ -
virtual ~Cloneable()
Destructor.
Definition interfaces.hh:26
│ │ │ │ -
virtual Cloneable * clone() const =0
Clones the object clone needs to be redefined by an implementation class, with the return type covari...
│ │ │ │ +
Allocators which guarantee alignment of the memory.
Definition alignedallocator.hh:23
│ │ │ │ +
typename MallocAllocator< T >::size_type size_type
Definition alignedallocator.hh:58
│ │ │ │ +
pointer allocate(size_type n, const void *hint=0)
allocate n objects of type T
Definition alignedallocator.hh:66
│ │ │ │ +
typename MallocAllocator< T >::pointer pointer
Definition alignedallocator.hh:57
│ │ │ │ +
static constexpr int alignment
Definition alignedallocator.hh:63
│ │ │ │ +
Definition alignedallocator.hh:59
│ │ │ │ +
AlignedAllocator< U, Alignment > other
Definition alignedallocator.hh:60
│ │ │ │ +
Allocators implementation which simply calls malloc/free.
Definition mallocallocator.hh:24
│ │ │ │ +
T * pointer
Definition mallocallocator.hh:28
│ │ │ │ +
std::size_t size_type
Definition mallocallocator.hh:26
│ │ │ │ +
size_type max_size() const noexcept
max size for allocate
Definition mallocallocator.hh:74
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,45 +1,135 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -interfaces.hh │ │ │ │ │ +alignedallocator.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_INTERFACES_HH │ │ │ │ │ -6#define DUNE_INTERFACES_HH │ │ │ │ │ +5#ifndef DUNE_ALIGNED_ALLOCATOR_HH │ │ │ │ │ +6#define DUNE_ALIGNED_ALLOCATOR_HH │ │ │ │ │ 7 │ │ │ │ │ -13namespace _D_u_n_e { │ │ │ │ │ +8#include "_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._h_h" │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11 │ │ │ │ │ +_1_2namespace _D_u_n_e │ │ │ │ │ +13{ │ │ │ │ │ 14 │ │ │ │ │ -_1_6 struct _C_l_o_n_e_a_b_l_e { │ │ │ │ │ -17 │ │ │ │ │ -_2_3 virtual _C_l_o_n_e_a_b_l_e* _c_l_o_n_e() const = 0; │ │ │ │ │ +22 template │ │ │ │ │ +_2_3 class _A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r : public _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r { │ │ │ │ │ 24 │ │ │ │ │ -_2_6 virtual _~_C_l_o_n_e_a_b_l_e() │ │ │ │ │ -27 {} │ │ │ │ │ -28 │ │ │ │ │ -29 }; │ │ │ │ │ -30 │ │ │ │ │ -31} // end namespace Dune │ │ │ │ │ -32#endif │ │ │ │ │ +25#if __APPLE__ │ │ │ │ │ +26 │ │ │ │ │ +27 /* │ │ │ │ │ +28 * macOS has pretty draconian restrictions on the │ │ │ │ │ +29 * alignments that you may ask for: It has to be │ │ │ │ │ +30 * │ │ │ │ │ +31 * 1) a power of 2 │ │ │ │ │ +32 * 2) at least as large as sizeof(void*) │ │ │ │ │ +33 * │ │ │ │ │ +34 * So here is a little constexpr function that calculates just that │ │ │ │ │ +35 * (together with the correct starting value for align fed in further down). │ │ │ │ │ +36 */ │ │ │ │ │ +37 static constexpr int fixAlignment(int align) │ │ │ │ │ +38 { │ │ │ │ │ +39 return ((Alignment==-1) ? std::alignment_of::value : Alignment) > align │ │ │ │ │ +40 ? fixAlignment(align << 1) : align; │ │ │ │ │ +41 } │ │ │ │ │ +42 │ │ │ │ │ +43#else │ │ │ │ │ +44 │ │ │ │ │ +45 /* │ │ │ │ │ +46 * Non-Apple platforms we just have to check whether an explicit alignment │ │ │ │ │ +was │ │ │ │ │ +47 * restricted or fall back to the default alignment of T. │ │ │ │ │ +48 */ │ │ │ │ │ +49 static constexpr int fixAlignment(int align) │ │ │ │ │ +50 { │ │ │ │ │ +51 return (Alignment==-1) ? std::alignment_of::value : Alignment; │ │ │ │ │ +52 } │ │ │ │ │ +53 │ │ │ │ │ +54#endif │ │ │ │ │ +55 │ │ │ │ │ +56 public: │ │ │ │ │ +_5_7 using _p_o_i_n_t_e_r = typename _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_>_:_:_p_o_i_n_t_e_r; │ │ │ │ │ +_5_8 using _s_i_z_e___t_y_p_e = typename _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_>_:_:_s_i_z_e___t_y_p_e; │ │ │ │ │ +_5_9 template struct _r_e_b_i_n_d { │ │ │ │ │ +_6_0 typedef _A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_<_U_,_A_l_i_g_n_m_e_n_t_> _o_t_h_e_r; │ │ │ │ │ +61 }; │ │ │ │ │ +62 │ │ │ │ │ +_6_3 static constexpr int _a_l_i_g_n_m_e_n_t = fixAlignment(sizeof(void*)); │ │ │ │ │ +64 │ │ │ │ │ +_6_6 _p_o_i_n_t_e_r _a_l_l_o_c_a_t_e(_s_i_z_e___t_y_p_e n, [[maybe_unused]] const void* hint = 0) │ │ │ │ │ +67 { │ │ │ │ │ +68 if (n > this->_m_a_x___s_i_z_e()) │ │ │ │ │ +69 throw std::bad_alloc(); │ │ │ │ │ +70 │ │ │ │ │ +71#if __APPLE__ │ │ │ │ │ +72 // Apple is also restrictive regarding the allocation size. │ │ │ │ │ +73 // size must be at least the alignment size. │ │ │ │ │ +74 _s_i_z_e___t_y_p_e size = n * sizeof(T) >= _a_l_i_g_n_m_e_n_t ? n * sizeof(T) : _a_l_i_g_n_m_e_n_t; │ │ │ │ │ +75#else │ │ │ │ │ +76 _s_i_z_e___t_y_p_e size = n * sizeof(T); │ │ │ │ │ +77#endif │ │ │ │ │ +78 │ │ │ │ │ +79 /* │ │ │ │ │ +80 * Everybody else gets the standard treatment. │ │ │ │ │ +81 */ │ │ │ │ │ +82 _p_o_i_n_t_e_r ret = static_cast<_p_o_i_n_t_e_r>(std::aligned_alloc(_a_l_i_g_n_m_e_n_t, size)); │ │ │ │ │ +83 if (!ret) │ │ │ │ │ +84 throw std::bad_alloc(); │ │ │ │ │ +85 │ │ │ │ │ +86 return ret; │ │ │ │ │ +87 } │ │ │ │ │ +88 }; │ │ │ │ │ +89 │ │ │ │ │ +90} │ │ │ │ │ +91 │ │ │ │ │ +92#endif // DUNE_ALIGNED_ALLOCATOR_HH │ │ │ │ │ +_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._h_h │ │ │ │ │ +Allocators that use malloc/free. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_C_l_o_n_e_a_b_l_e │ │ │ │ │ -An interface class for cloneable objects. │ │ │ │ │ -DDeeffiinniittiioonn interfaces.hh:16 │ │ │ │ │ -_D_u_n_e_:_:_C_l_o_n_e_a_b_l_e_:_:_~_C_l_o_n_e_a_b_l_e │ │ │ │ │ -virtual ~Cloneable() │ │ │ │ │ -Destructor. │ │ │ │ │ -DDeeffiinniittiioonn interfaces.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_C_l_o_n_e_a_b_l_e_:_:_c_l_o_n_e │ │ │ │ │ -virtual Cloneable * clone() const =0 │ │ │ │ │ -Clones the object clone needs to be redefined by an implementation class, with │ │ │ │ │ -the return type covari... │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r │ │ │ │ │ +Allocators which guarantee alignment of the memory. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename MallocAllocator< T >::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ +pointer allocate(size_type n, const void *hint=0) │ │ │ │ │ +allocate n objects of type T │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ +typename MallocAllocator< T >::pointer pointer │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:57 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_a_l_i_g_n_m_e_n_t │ │ │ │ │ +static constexpr int alignment │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d_:_:_o_t_h_e_r │ │ │ │ │ +AlignedAllocator< U, Alignment > other │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r │ │ │ │ │ +Allocators implementation which simply calls malloc/free. │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ +T * pointer │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::size_t size_type │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_m_a_x___s_i_z_e │ │ │ │ │ +size_type max_size() const noexcept │ │ │ │ │ +max size for allocate │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:74 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00116.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: alignedallocator.hh File Reference │ │ │ │ +dune-common: version.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,38 +70,776 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
alignedallocator.hh File Reference
│ │ │ │ +Macros
│ │ │ │ +
version.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include "mallocallocator.hh"
│ │ │ │ -#include <cstdlib>
│ │ │ │ -
│ │ │ │ + │ │ │ │ +

Various macros to work with Dune module version numbers. │ │ │ │ +More...

│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::AlignedAllocator< T, Alignment >
 Allocators which guarantee alignment of the memory. More...
 
struct  Dune::AlignedAllocator< T, Alignment >::rebind< U >
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Namespaces

namespace  Dune
 Dune namespace.
 

│ │ │ │ +Macros

#define DUNE_VERSION_JOIN(module, type)   module ## _VERSION_ ## type
 Constructs the preprocessor name used in config.h to hold version numbers.
 
#define DUNE_VERSION_EQUAL(module, major, minor)
 True if 'module' has the version major.minor.
 
#define DUNE_VERSION_EQUAL_REV(module, major, minor, revision)
 True if 'module' has the version major.minor.revision.
 
#define DUNE_VERSION_GTE(module, major, minor)
 True if 'module' has the version major.minor or greater.
 
#define DUNE_VERSION_LT(module, major, minor)    ! DUNE_VERSION_GTE(module,major,minor)
 True if 'module' has a version less than major.minor.
 
#define DUNE_VERSION_NEWER(module, major, minor)    DUNE_VERSION_GTE(module,major,minor)
 True if 'module' has the version major.minor or newer.
 
#define DUNE_VERSION_GT(module, major, minor)
 True if 'module' has a version greater than major.minor.
 
#define DUNE_VERSION_LTE(module, major, minor)    ! DUNE_VERSION_GT(module,major,minor)
 True if 'module' has a version less than or equal to major.minor.
 
#define DUNE_VERSION_GTE_REV(module, major, minor, revision)
 True if 'module' has the version major.minor.revision or greater.
 
#define DUNE_VERSION_LT_REV(module, major, minor, revision)    ! DUNE_VERSION_GTE_REV(module,major,minor,revision)
 True if 'module' has a version lower than major.minor.revision.
 
#define DUNE_VERSION_NEWER_REV(module, major, minor, revision)    DUNE_VERSION_GTE_REV(module,major,minor,revision)
 True if 'module' has the version major.minor.revision or newer.
 
#define DUNE_VERSION_GT_REV(module, major, minor, revision)
 True if 'module' has a greater version than major.minor.revision.
 
#define DUNE_VERSION_LTE_REV(module, major, minor, revision)    ! DUNE_VERSION_GT_REV(module,major,minor,revision)
 True if 'module' has a version lower or equal to major.minor.revision.
 
#define DUNE_VERSION_ID(major, minor, revision)    ((unsigned int)((major << 24) + (minor << 16) + revision))
 Compute a unique uint id from the major, minor, and revision numbers.
 
#define DUNE_MODULE_VERSION_ID(module)    DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) )
 Compute a unique uint id for the given module.
 
│ │ │ │ +

Detailed Description

│ │ │ │ +

Various macros to work with Dune module version numbers.

│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DUNE_MODULE_VERSION_ID

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_MODULE_VERSION_ID( module)    DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) )
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

Compute a unique uint id for the given module.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_EQUAL

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_EQUAL( module,
 major,
 minor 
)
│ │ │ │ +
│ │ │ │ +Value:
((DUNE_VERSION_JOIN(module,MAJOR) == major) && \
│ │ │ │ +
(DUNE_VERSION_JOIN(module,MINOR) == minor))
│ │ │ │ +
#define DUNE_VERSION_JOIN(module, type)
Constructs the preprocessor name used in config.h to hold version numbers.
Definition version.hh:28
│ │ │ │ +
│ │ │ │ +

True if 'module' has the version major.minor.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_EQUAL_REV

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_EQUAL_REV( module,
 major,
 minor,
 revision 
)
│ │ │ │ +
│ │ │ │ +Value:
( DUNE_VERSION_EQUAL(module,major,minor) && \
│ │ │ │ +
(DUNE_VERSION_JOIN(module,REVISION) == revision))
│ │ │ │ +
#define DUNE_VERSION_EQUAL(module, major, minor)
True if 'module' has the version major.minor.
Definition version.hh:44
│ │ │ │ +
│ │ │ │ +

True if 'module' has the version major.minor.revision.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GT

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_GT( module,
 major,
 minor 
)
│ │ │ │ +
│ │ │ │ +Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)))
│ │ │ │ +
│ │ │ │ +

True if 'module' has a version greater than major.minor.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GT_REV

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_GT_REV( module,
 major,
 minor,
 revision 
)
│ │ │ │ +
│ │ │ │ +Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ +
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ +
&& (DUNE_VERSION_JOIN(module,REVISION) > revision)))
│ │ │ │ +
│ │ │ │ +

True if 'module' has a greater version than major.minor.revision.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GTE

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_GTE( module,
 major,
 minor 
)
│ │ │ │ +
│ │ │ │ +Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) >= minor)))
│ │ │ │ +
│ │ │ │ +

True if 'module' has the version major.minor or greater.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GTE_REV

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_GTE_REV( module,
 major,
 minor,
 revision 
)
│ │ │ │ +
│ │ │ │ +Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ +
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ +
&& (DUNE_VERSION_JOIN(module,REVISION) >= revision)))
│ │ │ │ +
│ │ │ │ +

True if 'module' has the version major.minor.revision or greater.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_ID

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_ID( major,
 minor,
 revision 
)    ((unsigned int)((major << 24) + (minor << 16) + revision))
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

Compute a unique uint id from the major, minor, and revision numbers.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_JOIN

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_JOIN( module,
 type 
)   module ## _VERSION_ ## type
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

Constructs the preprocessor name used in config.h to hold version numbers.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

│ │ │ │ +
Parameters
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
moduleThe name of the Dune module
typeThe version number type, one of MAJOR, MINOR, or REVISION
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

◆ DUNE_VERSION_LT

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_LT( module,
 major,
 minor 
)    ! DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

True if 'module' has a version less than major.minor.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_LT_REV

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_LT_REV( module,
 major,
 minor,
 revision 
)    ! DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

True if 'module' has a version lower than major.minor.revision.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_LTE

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_LTE( module,
 major,
 minor 
)    ! DUNE_VERSION_GT(module,major,minor)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

True if 'module' has a version less than or equal to major.minor.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_LTE_REV

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_LTE_REV( module,
 major,
 minor,
 revision 
)    ! DUNE_VERSION_GT_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

True if 'module' has a version lower or equal to major.minor.revision.

│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_NEWER

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_NEWER( module,
 major,
 minor 
)    DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

True if 'module' has the version major.minor or newer.

│ │ │ │ +
Note
Deprecated, use DUNE_VERSION_GTE instead.
│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_NEWER_REV

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_VERSION_NEWER_REV( module,
 major,
 minor,
 revision 
)    DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

True if 'module' has the version major.minor.revision or newer.

│ │ │ │ +
Note
Deprecated, use DUNE_VERSION_GTE_REV instead.
│ │ │ │ +

For the DUNE core modules you need to use the following module names:

    │ │ │ │ +
  • DUNE_COMMON for dune-common
  • │ │ │ │ +
  • DUNE_GRID for dune-grid
  • │ │ │ │ +
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ +
  • DUNE_ISTL for dune-istl
  • │ │ │ │ +
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ +
│ │ │ │ +

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,23 +1,349 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -alignedallocator.hh File Reference │ │ │ │ │ -#include "_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._h_h" │ │ │ │ │ -#include │ │ │ │ │ +_M_a_c_r_o_s │ │ │ │ │ +version.hh File Reference │ │ │ │ │ +Various macros to work with Dune module version numbers. _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_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_<_ _T_,_ _A_l_i_g_n_m_e_n_t_ _> │ │ │ │ │ -  Allocators which guarantee alignment of the memory. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_<_ _T_,_ _A_l_i_g_n_m_e_n_t_ _>_:_:_r_e_b_i_n_d_<_ _U_ _> │ │ │ │ │ -  │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module, type)   module ## _VERSION_ ## type │ │ │ │ │ +  Constructs the preprocessor name used in config.h to hold version │ │ │ │ │ + numbers. │ │ │ │ │   │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L(module, major, minor) │ │ │ │ │ +  True if 'module' has the version major.minor. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L___R_E_V(module, major, minor, revision) │ │ │ │ │ +  True if 'module' has the version major.minor.revision. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___G_T_E(module, major, minor) │ │ │ │ │ +  True if 'module' has the version major.minor or greater. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___L_T(module, major, minor)    ! _D_U_N_E___V_E_R_S_I_O_N___G_T_E │ │ │ │ │ + (module,major,minor) │ │ │ │ │ +  True if 'module' has a version less than major.minor. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___N_E_W_E_R(module, major, minor)    _D_U_N_E___V_E_R_S_I_O_N___G_T_E │ │ │ │ │ + (module,major,minor) │ │ │ │ │ +  True if 'module' has the version major.minor or newer. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___G_T(module, major, minor) │ │ │ │ │ +  True if 'module' has a version greater than major.minor. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___L_T_E(module, major, minor)    ! _D_U_N_E___V_E_R_S_I_O_N___G_T │ │ │ │ │ + (module,major,minor) │ │ │ │ │ +  True if 'module' has a version less than or equal to major.minor. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V(module, major, minor, revision) │ │ │ │ │ +  True if 'module' has the version major.minor.revision or greater. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___L_T___R_E_V(module, major, minor, revision)    ! │ │ │ │ │ + _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V(module,major,minor,revision) │ │ │ │ │ +  True if 'module' has a version lower than major.minor.revision. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___N_E_W_E_R___R_E_V(module, major, minor, revision)    │ │ │ │ │ + _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V(module,major,minor,revision) │ │ │ │ │ +  True if 'module' has the version major.minor.revision or newer. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___G_T___R_E_V(module, major, minor, revision) │ │ │ │ │ +  True if 'module' has a greater version than major.minor.revision. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___L_T_E___R_E_V(module, major, minor, revision)    ! │ │ │ │ │ + _D_U_N_E___V_E_R_S_I_O_N___G_T___R_E_V(module,major,minor,revision) │ │ │ │ │ +  True if 'module' has a version lower or equal to major.minor.revision. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___V_E_R_S_I_O_N___I_D(major, minor, revision)    ((unsigned int)((major << │ │ │ │ │ + 24) + (minor << 16) + revision)) │ │ │ │ │ +  Compute a unique uint id from the major, minor, and revision numbers. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___M_O_D_U_L_E___V_E_R_S_I_O_N___I_D(module)    _D_U_N_E___V_E_R_S_I_O_N___I_D( _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ + (module,MAJOR), _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MINOR), _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ + (module,REVISION) ) │ │ │ │ │ +  Compute a unique uint id for the given module. │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Various macros to work with Dune module version numbers. │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__MMOODDUULLEE__VVEERRSSIIOONN__IIDD ********** │ │ │ │ │ +     _D_U_N_E___V_E_R_S_I_O_N___I_D │ │ │ │ │ + ( _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR), │ │ │ │ │ +#define DUNE_MODULE_VERSION_ID (   module ) _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MINOR), │ │ │ │ │ + _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) │ │ │ │ │ + ) │ │ │ │ │ +Compute a unique uint id for the given module. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__EEQQUUAALL ********** │ │ │ │ │ +#define DUNE_VERSION_EQUAL (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && \ │ │ │ │ │ +(_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MINOR) == minor)) │ │ │ │ │ +_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ +#define DUNE_VERSION_JOIN(module, type) │ │ │ │ │ +Constructs the preprocessor name used in config.h to hold version numbers. │ │ │ │ │ +DDeeffiinniittiioonn version.hh:28 │ │ │ │ │ +True if 'module' has the version major.minor. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__EEQQUUAALL__RREEVV ********** │ │ │ │ │ +#define DUNE_VERSION_EQUAL_REV (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor, │ │ │ │ │ +   revision  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +( _D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L(module,major,minor) && \ │ │ │ │ │ +(_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) == revision)) │ │ │ │ │ +_D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L │ │ │ │ │ +#define DUNE_VERSION_EQUAL(module, major, minor) │ │ │ │ │ +True if 'module' has the version major.minor. │ │ │ │ │ +DDeeffiinniittiioonn version.hh:44 │ │ │ │ │ +True if 'module' has the version major.minor.revision. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTT ********** │ │ │ │ │ +#define DUNE_VERSION_GT (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ +|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ +(module,MINOR) > minor))) │ │ │ │ │ +True if 'module' has a version greater than major.minor. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTT__RREEVV ********** │ │ │ │ │ +#define DUNE_VERSION_GT_REV (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor, │ │ │ │ │ +   revision  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ +|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ +(module,MINOR) > minor)) \ │ │ │ │ │ +|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ +(module,MINOR) == minor) \ │ │ │ │ │ +&& (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) > revision))) │ │ │ │ │ +True if 'module' has a greater version than major.minor.revision. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTTEE ********** │ │ │ │ │ +#define DUNE_VERSION_GTE (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ +|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ +(module,MINOR) >= minor))) │ │ │ │ │ +True if 'module' has the version major.minor or greater. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTTEE__RREEVV ********** │ │ │ │ │ +#define DUNE_VERSION_GTE_REV (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor, │ │ │ │ │ +   revision  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ +|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ +(module,MINOR) > minor)) \ │ │ │ │ │ +|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ +(module,MINOR) == minor) \ │ │ │ │ │ +&& (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) >= revision))) │ │ │ │ │ +True if 'module' has the version major.minor.revision or greater. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__IIDD ********** │ │ │ │ │ +#define DUNE_VERSION_ID (   major, │ │ │ │ │ +   minor, │ │ │ │ │ +   revision  │ │ │ │ │ + )     ((unsigned int)((major << 24) + (minor << 16) + │ │ │ │ │ + revision)) │ │ │ │ │ +Compute a unique uint id from the major, minor, and revision numbers. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__JJOOIINN ********** │ │ │ │ │ +#define DUNE_VERSION_JOIN (   module, │ │ │ │ │ +   type  │ │ │ │ │ + )    module ## _VERSION_ ## type │ │ │ │ │ +Constructs the preprocessor name used in config.h to hold version numbers. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ + Parameters │ │ │ │ │ + module The name of the _D_u_n_e module │ │ │ │ │ + type The version number type, one of MAJOR, MINOR, or REVISION │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTT ********** │ │ │ │ │ +#define DUNE_VERSION_LT (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor  │ │ │ │ │ + )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T_E(module,major,minor) │ │ │ │ │ +True if 'module' has a version less than major.minor. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTT__RREEVV ********** │ │ │ │ │ +#define DUNE_VERSION_LT_REV (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor, │ │ │ │ │ +   revision  │ │ │ │ │ + )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V │ │ │ │ │ + (module,major,minor,revision) │ │ │ │ │ +True if 'module' has a version lower than major.minor.revision. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTTEE ********** │ │ │ │ │ +#define DUNE_VERSION_LTE (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor  │ │ │ │ │ + )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T(module,major,minor) │ │ │ │ │ +True if 'module' has a version less than or equal to major.minor. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTTEE__RREEVV ********** │ │ │ │ │ +#define DUNE_VERSION_LTE_REV (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor, │ │ │ │ │ +   revision  │ │ │ │ │ + )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T___R_E_V │ │ │ │ │ + (module,major,minor,revision) │ │ │ │ │ +True if 'module' has a version lower or equal to major.minor.revision. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__NNEEWWEERR ********** │ │ │ │ │ +#define DUNE_VERSION_NEWER (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor  │ │ │ │ │ + )     _D_U_N_E___V_E_R_S_I_O_N___G_T_E(module,major,minor) │ │ │ │ │ +True if 'module' has the version major.minor or newer. │ │ │ │ │ + Note │ │ │ │ │ + Deprecated, use DUNE_VERSION_GTE instead. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ +********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__NNEEWWEERR__RREEVV ********** │ │ │ │ │ +#define DUNE_VERSION_NEWER_REV (   module, │ │ │ │ │ +   major, │ │ │ │ │ +   minor, │ │ │ │ │ +   revision  │ │ │ │ │ + )     _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V │ │ │ │ │ + (module,major,minor,revision) │ │ │ │ │ +True if 'module' has the version major.minor.revision or newer. │ │ │ │ │ + Note │ │ │ │ │ + Deprecated, use DUNE_VERSION_GTE_REV instead. │ │ │ │ │ +For the DUNE core modules you need to use the following module names: │ │ │ │ │ + * DUNE_COMMON for dune-common │ │ │ │ │ + * DUNE_GRID for dune-grid │ │ │ │ │ + * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ + * DUNE_ISTL for dune-istl │ │ │ │ │ + * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ +For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ +underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ +module name in the context of this macro. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: alignedallocator.hh Source File │ │ │ │ +dune-common: version.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,122 +74,107 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
alignedallocator.hh
│ │ │ │ +
version.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_ALIGNED_ALLOCATOR_HH
│ │ │ │ -
6#define DUNE_ALIGNED_ALLOCATOR_HH
│ │ │ │ +
5#ifndef DUNE_VERSION_HH
│ │ │ │ +
6#define DUNE_VERSION_HH
│ │ │ │
7
│ │ │ │ -
8#include "mallocallocator.hh"
│ │ │ │ -
9#include <cstdlib>
│ │ │ │ -
10
│ │ │ │ -
11
│ │ │ │ -
│ │ │ │ -
12namespace Dune
│ │ │ │ -
13{
│ │ │ │ -
14
│ │ │ │ -
22 template<class T, int Alignment = -1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
24
│ │ │ │ -
25#if __APPLE__
│ │ │ │ -
26
│ │ │ │ -
27 /*
│ │ │ │ -
28 * macOS has pretty draconian restrictions on the
│ │ │ │ -
29 * alignments that you may ask for: It has to be
│ │ │ │ -
30 *
│ │ │ │ -
31 * 1) a power of 2
│ │ │ │ -
32 * 2) at least as large as sizeof(void*)
│ │ │ │ -
33 *
│ │ │ │ -
34 * So here is a little constexpr function that calculates just that
│ │ │ │ -
35 * (together with the correct starting value for align fed in further down).
│ │ │ │ -
36 */
│ │ │ │ -
37 static constexpr int fixAlignment(int align)
│ │ │ │ -
38 {
│ │ │ │ -
39 return ((Alignment==-1) ? std::alignment_of<T>::value : Alignment) > align
│ │ │ │ -
40 ? fixAlignment(align << 1) : align;
│ │ │ │ -
41 }
│ │ │ │ -
42
│ │ │ │ -
43#else
│ │ │ │ -
44
│ │ │ │ -
45 /*
│ │ │ │ -
46 * Non-Apple platforms we just have to check whether an explicit alignment was
│ │ │ │ -
47 * restricted or fall back to the default alignment of T.
│ │ │ │ -
48 */
│ │ │ │ -
49 static constexpr int fixAlignment(int align)
│ │ │ │ -
50 {
│ │ │ │ -
51 return (Alignment==-1) ? std::alignment_of<T>::value : Alignment;
│ │ │ │ -
52 }
│ │ │ │ -
53
│ │ │ │ -
54#endif
│ │ │ │ -
55
│ │ │ │ -
56 public:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
│ │ │ │ -
59 template <class U> struct rebind {
│ │ │ │ - │ │ │ │ -
61 };
│ │ │ │ -
│ │ │ │ -
62
│ │ │ │ -
63 static constexpr int alignment = fixAlignment(sizeof(void*));
│ │ │ │ -
64
│ │ │ │ -
│ │ │ │ -
66 pointer allocate(size_type n, [[maybe_unused]] const void* hint = 0)
│ │ │ │ -
67 {
│ │ │ │ -
68 if (n > this->max_size())
│ │ │ │ -
69 throw std::bad_alloc();
│ │ │ │ -
70
│ │ │ │ -
71#if __APPLE__
│ │ │ │ -
72 // Apple is also restrictive regarding the allocation size.
│ │ │ │ -
73 // size must be at least the alignment size.
│ │ │ │ -
74 size_type size = n * sizeof(T) >= alignment ? n * sizeof(T) : alignment;
│ │ │ │ -
75#else
│ │ │ │ -
76 size_type size = n * sizeof(T);
│ │ │ │ -
77#endif
│ │ │ │ -
78
│ │ │ │ -
79 /*
│ │ │ │ -
80 * Everybody else gets the standard treatment.
│ │ │ │ -
81 */
│ │ │ │ -
82 pointer ret = static_cast<pointer>(std::aligned_alloc(alignment, size));
│ │ │ │ -
83 if (!ret)
│ │ │ │ -
84 throw std::bad_alloc();
│ │ │ │ -
85
│ │ │ │ -
86 return ret;
│ │ │ │ -
87 }
│ │ │ │ -
│ │ │ │ -
88 };
│ │ │ │ -
│ │ │ │ -
89
│ │ │ │ -
90}
│ │ │ │ -
│ │ │ │ -
91
│ │ │ │ -
92#endif // DUNE_ALIGNED_ALLOCATOR_HH
│ │ │ │ -
Allocators that use malloc/free.
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Allocators which guarantee alignment of the memory.
Definition alignedallocator.hh:23
│ │ │ │ -
typename MallocAllocator< T >::size_type size_type
Definition alignedallocator.hh:58
│ │ │ │ -
pointer allocate(size_type n, const void *hint=0)
allocate n objects of type T
Definition alignedallocator.hh:66
│ │ │ │ -
typename MallocAllocator< T >::pointer pointer
Definition alignedallocator.hh:57
│ │ │ │ -
static constexpr int alignment
Definition alignedallocator.hh:63
│ │ │ │ -
Definition alignedallocator.hh:59
│ │ │ │ -
AlignedAllocator< U, Alignment > other
Definition alignedallocator.hh:60
│ │ │ │ -
Allocators implementation which simply calls malloc/free.
Definition mallocallocator.hh:24
│ │ │ │ -
T * pointer
Definition mallocallocator.hh:28
│ │ │ │ -
std::size_t size_type
Definition mallocallocator.hh:26
│ │ │ │ -
size_type max_size() const noexcept
max size for allocate
Definition mallocallocator.hh:74
│ │ │ │ +
28#define DUNE_VERSION_JOIN(module,type) module ## _VERSION_ ## type
│ │ │ │ +
29
│ │ │ │ +
│ │ │ │ +
44#define DUNE_VERSION_EQUAL(module,major,minor) \
│ │ │ │ +
45 ((DUNE_VERSION_JOIN(module,MAJOR) == major) && \
│ │ │ │ +
46 (DUNE_VERSION_JOIN(module,MINOR) == minor))
│ │ │ │ +
│ │ │ │ +
47
│ │ │ │ +
│ │ │ │ +
62#define DUNE_VERSION_EQUAL_REV(module,major,minor,revision) \
│ │ │ │ +
63 ( DUNE_VERSION_EQUAL(module,major,minor) && \
│ │ │ │ +
64 (DUNE_VERSION_JOIN(module,REVISION) == revision))
│ │ │ │ +
│ │ │ │ +
65
│ │ │ │ +
│ │ │ │ +
80#define DUNE_VERSION_GTE(module,major,minor) \
│ │ │ │ +
81 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
82 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) >= minor)))
│ │ │ │ +
│ │ │ │ +
83
│ │ │ │ +
│ │ │ │ +
98#define DUNE_VERSION_LT(module,major,minor) \
│ │ │ │ +
99 ! DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ +
│ │ │ │ +
100
│ │ │ │ +
│ │ │ │ +
116#define DUNE_VERSION_NEWER(module,major,minor) \
│ │ │ │ +
117 DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ +
│ │ │ │ +
118
│ │ │ │ +
│ │ │ │ +
133#define DUNE_VERSION_GT(module,major,minor) \
│ │ │ │ +
134 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
135 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)))
│ │ │ │ +
│ │ │ │ +
136
│ │ │ │ +
│ │ │ │ +
151#define DUNE_VERSION_LTE(module,major,minor) \
│ │ │ │ +
152 ! DUNE_VERSION_GT(module,major,minor)
│ │ │ │ +
│ │ │ │ +
153
│ │ │ │ +
│ │ │ │ +
168#define DUNE_VERSION_GTE_REV(module,major,minor,revision) \
│ │ │ │ +
169 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
170 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ +
171 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ +
172 && (DUNE_VERSION_JOIN(module,REVISION) >= revision)))
│ │ │ │ +
│ │ │ │ +
173
│ │ │ │ +
│ │ │ │ +
188#define DUNE_VERSION_LT_REV(module,major,minor,revision) \
│ │ │ │ +
189 ! DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ +
190
│ │ │ │ +
│ │ │ │ +
206#define DUNE_VERSION_NEWER_REV(module,major,minor,revision) \
│ │ │ │ +
207 DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ +
208
│ │ │ │ +
│ │ │ │ +
223#define DUNE_VERSION_GT_REV(module,major,minor,revision) \
│ │ │ │ +
224 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
225 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ +
226 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ +
227 && (DUNE_VERSION_JOIN(module,REVISION) > revision)))
│ │ │ │ +
│ │ │ │ +
228
│ │ │ │ +
│ │ │ │ +
243#define DUNE_VERSION_LTE_REV(module,major,minor,revision) \
│ │ │ │ +
244 ! DUNE_VERSION_GT_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ +
245
│ │ │ │ +
│ │ │ │ +
260#define DUNE_VERSION_ID(major,minor,revision) \
│ │ │ │ +
261 ((unsigned int)((major << 24) + (minor << 16) + revision))
│ │ │ │ +
│ │ │ │ +
262
│ │ │ │ +
│ │ │ │ +
277#define DUNE_MODULE_VERSION_ID(module) \
│ │ │ │ +
278 DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) )
│ │ │ │ +
│ │ │ │ +
279
│ │ │ │ +
280#endif
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,135 +1,80 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -alignedallocator.hh │ │ │ │ │ +version.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_ALIGNED_ALLOCATOR_HH │ │ │ │ │ -6#define DUNE_ALIGNED_ALLOCATOR_HH │ │ │ │ │ +5#ifndef DUNE_VERSION_HH │ │ │ │ │ +6#define DUNE_VERSION_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include "_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._h_h" │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11 │ │ │ │ │ -_1_2namespace _D_u_n_e │ │ │ │ │ -13{ │ │ │ │ │ -14 │ │ │ │ │ -22 template │ │ │ │ │ -_2_3 class _A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r : public _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r { │ │ │ │ │ -24 │ │ │ │ │ -25#if __APPLE__ │ │ │ │ │ -26 │ │ │ │ │ -27 /* │ │ │ │ │ -28 * macOS has pretty draconian restrictions on the │ │ │ │ │ -29 * alignments that you may ask for: It has to be │ │ │ │ │ -30 * │ │ │ │ │ -31 * 1) a power of 2 │ │ │ │ │ -32 * 2) at least as large as sizeof(void*) │ │ │ │ │ -33 * │ │ │ │ │ -34 * So here is a little constexpr function that calculates just that │ │ │ │ │ -35 * (together with the correct starting value for align fed in further down). │ │ │ │ │ -36 */ │ │ │ │ │ -37 static constexpr int fixAlignment(int align) │ │ │ │ │ -38 { │ │ │ │ │ -39 return ((Alignment==-1) ? std::alignment_of::value : Alignment) > align │ │ │ │ │ -40 ? fixAlignment(align << 1) : align; │ │ │ │ │ -41 } │ │ │ │ │ -42 │ │ │ │ │ -43#else │ │ │ │ │ -44 │ │ │ │ │ -45 /* │ │ │ │ │ -46 * Non-Apple platforms we just have to check whether an explicit alignment │ │ │ │ │ -was │ │ │ │ │ -47 * restricted or fall back to the default alignment of T. │ │ │ │ │ -48 */ │ │ │ │ │ -49 static constexpr int fixAlignment(int align) │ │ │ │ │ -50 { │ │ │ │ │ -51 return (Alignment==-1) ? std::alignment_of::value : Alignment; │ │ │ │ │ -52 } │ │ │ │ │ -53 │ │ │ │ │ -54#endif │ │ │ │ │ -55 │ │ │ │ │ -56 public: │ │ │ │ │ -_5_7 using _p_o_i_n_t_e_r = typename _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_>_:_:_p_o_i_n_t_e_r; │ │ │ │ │ -_5_8 using _s_i_z_e___t_y_p_e = typename _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_>_:_:_s_i_z_e___t_y_p_e; │ │ │ │ │ -_5_9 template struct _r_e_b_i_n_d { │ │ │ │ │ -_6_0 typedef _A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_<_U_,_A_l_i_g_n_m_e_n_t_> _o_t_h_e_r; │ │ │ │ │ -61 }; │ │ │ │ │ -62 │ │ │ │ │ -_6_3 static constexpr int _a_l_i_g_n_m_e_n_t = fixAlignment(sizeof(void*)); │ │ │ │ │ -64 │ │ │ │ │ -_6_6 _p_o_i_n_t_e_r _a_l_l_o_c_a_t_e(_s_i_z_e___t_y_p_e n, [[maybe_unused]] const void* hint = 0) │ │ │ │ │ -67 { │ │ │ │ │ -68 if (n > this->_m_a_x___s_i_z_e()) │ │ │ │ │ -69 throw std::bad_alloc(); │ │ │ │ │ -70 │ │ │ │ │ -71#if __APPLE__ │ │ │ │ │ -72 // Apple is also restrictive regarding the allocation size. │ │ │ │ │ -73 // size must be at least the alignment size. │ │ │ │ │ -74 _s_i_z_e___t_y_p_e size = n * sizeof(T) >= _a_l_i_g_n_m_e_n_t ? n * sizeof(T) : _a_l_i_g_n_m_e_n_t; │ │ │ │ │ -75#else │ │ │ │ │ -76 _s_i_z_e___t_y_p_e size = n * sizeof(T); │ │ │ │ │ -77#endif │ │ │ │ │ -78 │ │ │ │ │ -79 /* │ │ │ │ │ -80 * Everybody else gets the standard treatment. │ │ │ │ │ -81 */ │ │ │ │ │ -82 _p_o_i_n_t_e_r ret = static_cast<_p_o_i_n_t_e_r>(std::aligned_alloc(_a_l_i_g_n_m_e_n_t, size)); │ │ │ │ │ -83 if (!ret) │ │ │ │ │ -84 throw std::bad_alloc(); │ │ │ │ │ -85 │ │ │ │ │ -86 return ret; │ │ │ │ │ -87 } │ │ │ │ │ -88 }; │ │ │ │ │ -89 │ │ │ │ │ -90} │ │ │ │ │ -91 │ │ │ │ │ -92#endif // DUNE_ALIGNED_ALLOCATOR_HH │ │ │ │ │ -_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._h_h │ │ │ │ │ -Allocators that use malloc/free. │ │ │ │ │ -_D_u_n_e │ │ │ │ │ -Dune namespace. │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r │ │ │ │ │ -Allocators which guarantee alignment of the memory. │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -typename MallocAllocator< T >::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ -pointer allocate(size_type n, const void *hint=0) │ │ │ │ │ -allocate n objects of type T │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ -typename MallocAllocator< T >::pointer pointer │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_a_l_i_g_n_m_e_n_t │ │ │ │ │ -static constexpr int alignment │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_A_l_i_g_n_e_d_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d_:_:_o_t_h_e_r │ │ │ │ │ -AlignedAllocator< U, Alignment > other │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r │ │ │ │ │ -Allocators implementation which simply calls malloc/free. │ │ │ │ │ -DDeeffiinniittiioonn mallocallocator.hh:24 │ │ │ │ │ -_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ -T * pointer │ │ │ │ │ -DDeeffiinniittiioonn mallocallocator.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -DDeeffiinniittiioonn mallocallocator.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_m_a_x___s_i_z_e │ │ │ │ │ -size_type max_size() const noexcept │ │ │ │ │ -max size for allocate │ │ │ │ │ -DDeeffiinniittiioonn mallocallocator.hh:74 │ │ │ │ │ +_2_8#define DUNE_VERSION_JOIN(module,type) module ## _VERSION_ ## type │ │ │ │ │ +29 │ │ │ │ │ +_4_4#define DUNE_VERSION_EQUAL(module,major,minor) \ │ │ │ │ │ +45 ((DUNE_VERSION_JOIN(module,MAJOR) == major) && \ │ │ │ │ │ +46 (DUNE_VERSION_JOIN(module,MINOR) == minor)) │ │ │ │ │ +47 │ │ │ │ │ +_6_2#define DUNE_VERSION_EQUAL_REV(module,major,minor,revision) \ │ │ │ │ │ +63 ( DUNE_VERSION_EQUAL(module,major,minor) && \ │ │ │ │ │ +64 (DUNE_VERSION_JOIN(module,REVISION) == revision)) │ │ │ │ │ +65 │ │ │ │ │ +_8_0#define DUNE_VERSION_GTE(module,major,minor) \ │ │ │ │ │ +81 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +82 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) >= minor))) │ │ │ │ │ +83 │ │ │ │ │ +_9_8#define DUNE_VERSION_LT(module,major,minor) \ │ │ │ │ │ +99 ! DUNE_VERSION_GTE(module,major,minor) │ │ │ │ │ +100 │ │ │ │ │ +_1_1_6#define DUNE_VERSION_NEWER(module,major,minor) \ │ │ │ │ │ +117 DUNE_VERSION_GTE(module,major,minor) │ │ │ │ │ +118 │ │ │ │ │ +_1_3_3#define DUNE_VERSION_GT(module,major,minor) \ │ │ │ │ │ +134 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +135 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) > minor))) │ │ │ │ │ +136 │ │ │ │ │ +_1_5_1#define DUNE_VERSION_LTE(module,major,minor) \ │ │ │ │ │ +152 ! DUNE_VERSION_GT(module,major,minor) │ │ │ │ │ +153 │ │ │ │ │ +_1_6_8#define DUNE_VERSION_GTE_REV(module,major,minor,revision) \ │ │ │ │ │ +169 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +170 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) > minor)) \ │ │ │ │ │ +171 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) == minor) \ │ │ │ │ │ +172 && (DUNE_VERSION_JOIN(module,REVISION) >= revision))) │ │ │ │ │ +173 │ │ │ │ │ +_1_8_8#define DUNE_VERSION_LT_REV(module,major,minor,revision) \ │ │ │ │ │ +189 ! DUNE_VERSION_GTE_REV(module,major,minor,revision) │ │ │ │ │ +190 │ │ │ │ │ +_2_0_6#define DUNE_VERSION_NEWER_REV(module,major,minor,revision) \ │ │ │ │ │ +207 DUNE_VERSION_GTE_REV(module,major,minor,revision) │ │ │ │ │ +208 │ │ │ │ │ +_2_2_3#define DUNE_VERSION_GT_REV(module,major,minor,revision) \ │ │ │ │ │ +224 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +225 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) > minor)) \ │ │ │ │ │ +226 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) == minor) \ │ │ │ │ │ +227 && (DUNE_VERSION_JOIN(module,REVISION) > revision))) │ │ │ │ │ +228 │ │ │ │ │ +_2_4_3#define DUNE_VERSION_LTE_REV(module,major,minor,revision) \ │ │ │ │ │ +244 ! DUNE_VERSION_GT_REV(module,major,minor,revision) │ │ │ │ │ +245 │ │ │ │ │ +_2_6_0#define DUNE_VERSION_ID(major,minor,revision) \ │ │ │ │ │ +261 ((unsigned int)((major << 24) + (minor << 16) + revision)) │ │ │ │ │ +262 │ │ │ │ │ +_2_7_7#define DUNE_MODULE_VERSION_ID(module) \ │ │ │ │ │ +278 DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) ) │ │ │ │ │ +279 │ │ │ │ │ +280#endif │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00119.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: typetraits.hh File Reference │ │ │ │ +dune-common: binaryfunctions.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,135 +71,40 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions
│ │ │ │ -
typetraits.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
binaryfunctions.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Traits for type conversions and type information. │ │ │ │ +

helper classes to provide unique types for standard functions │ │ │ │ More...

│ │ │ │ -
#include <complex>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <vector>
│ │ │ │ +
#include <algorithm>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Empty
 Just an empty class. More...
struct  Dune::Min< Type >
 
struct  Dune::IsInteroperable< T1, T2 >
 Checks whether two types are interoperable. More...
 
struct  Dune::EnableIfInterOperable< T1, T2, Type >
 Enable typedef if two types are interoperable. More...
 
struct  Dune::AlwaysFalse< T >
 template which always yields a false value More...
 
struct  Dune::AlwaysTrue< T >
 template which always yields a true value More...
 
struct  Dune::IsCallable< F(Args...), R >
 Check if a type is callable with ()-operator and given arguments. More...
 
struct  Dune::IsNumber< T >
 Whether this type acts as a scalar in the context of (hierarchically blocked) containers. More...
 
struct  Dune::HasNaN< T >
 Whether this type has a value of NaN. More...
 
struct  Dune::IsIndexable< T, I >
 Type trait to determine whether an instance of T has an operator[](I), i.e. whether it can be indexed with an index of type I. More...
 
struct  Dune::IsIterable< T, typename >
 typetrait to check that a class has begin() and end() members More...
 
struct  Dune::IsTuple< T >
 Check if T is a std::tuple<...> More...
 
struct  Dune::IsTupleOrDerived< T >
 Check if T derived from a std::tuple<...> More...
 
struct  Dune::IsIntegralConstant< T >
 Check if T is an std::integral_constant<I, i> More...
 
struct  Dune::SizeOf< T >
 Compute size of variadic type list. More...
 
struct  Dune::AutonomousValueType< T >
 Type free of internal references that T can be converted to. More...
 
struct  Dune::AutonomousValueType< T & >
 Specialization to remove lvalue references. More...
 
struct  Dune::AutonomousValueType< T && >
 Specialization to remove rvalue references. More...
 
struct  Dune::AutonomousValueType< const T >
 Specialization to remove const qualifiers. More...
 
struct  Dune::AutonomousValueType< volatile T >
 Specialization to remove volatile qualifiers. More...
 
struct  Dune::AutonomousValueType< std::vector< bool >::reference >
 Specialization for the proxies of vector<bool> More...
 
struct  Dune::AutonomousValueType< volatile const T >
 Specialization to remove both const and volatile qualifiers. More...
struct  Dune::Max< Type >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Typedefs

template<class... Types>
using Dune::void_t = typename Impl::voider< Types... >::type
 Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
 
template<class Type >
using Dune::field_t = typename FieldTraits< Type >::field_type
 Convenient access to FieldTraits<Type>::field_type.
 
template<class Type >
using Dune::real_t = typename FieldTraits< Type >::real_type
 Convenient access to FieldTraits<Type>::real_type.
 
template<class T >
using Dune::AutonomousValue = typename AutonomousValueType< T >::type
 Type free of internal references that T can be converted to.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

template<class T , T... t, std::size_t index>
constexpr auto Dune::integerSequenceEntry (std::integer_sequence< T, t... >, std::integral_constant< std::size_t, index > i)
 Get entry of std::integer_sequence.
 
template<class T >
constexpr AutonomousValue< T > Dune::autoCopy (T &&v)
 Autonomous copy of an expression's value for use in auto type deduction.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Traits for type conversions and type information.

│ │ │ │ -
Author
Markus Blatt, Christian Engwer
│ │ │ │ +

helper classes to provide unique types for standard functions

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,121 +1,24 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -typetraits.hh File Reference │ │ │ │ │ -Traits for type conversions and type information. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +binaryfunctions.hh File Reference │ │ │ │ │ +helper classes to provide unique types for standard functions _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_:_:_E_m_p_t_y │ │ │ │ │ -  Just an empty class. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_M_i_n_<_ _T_y_p_e_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_I_n_t_e_r_o_p_e_r_a_b_l_e_<_ _T_1_,_ _T_2_ _> │ │ │ │ │ -  Checks whether two types are interoperable. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e_<_ _T_1_,_ _T_2_,_ _T_y_p_e_ _> │ │ │ │ │ -  Enable typedef if two types are interoperable. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_l_w_a_y_s_F_a_l_s_e_<_ _T_ _> │ │ │ │ │ -  template which always yields a false value _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_l_w_a_y_s_T_r_u_e_<_ _T_ _> │ │ │ │ │ -  template which always yields a true value _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_C_a_l_l_a_b_l_e_<_ _F_(_A_r_g_s_._._._)_,_ _R_ _> │ │ │ │ │ -  Check if a type is callable with ()-operator and given arguments. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_N_u_m_b_e_r_<_ _T_ _> │ │ │ │ │ -  Whether this type acts as a scalar in the context of (hierarchically │ │ │ │ │ - blocked) containers. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_H_a_s_N_a_N_<_ _T_ _> │ │ │ │ │ -  Whether this type has a value of NaN. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_I_n_d_e_x_a_b_l_e_<_ _T_,_ _I_ _> │ │ │ │ │ -  Type trait to determine whether an instance of T has an operator[](I), │ │ │ │ │ - i.e. whether it can be indexed with an index of type I. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_I_t_e_r_a_b_l_e_<_ _T_,_ _t_y_p_e_n_a_m_e_ _> │ │ │ │ │ -  typetrait to check that a class has begin() and end() members _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_T_u_p_l_e_<_ _T_ _> │ │ │ │ │ -  Check if T is a std::tuple<...> _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_T_u_p_l_e_O_r_D_e_r_i_v_e_d_<_ _T_ _> │ │ │ │ │ -  Check if T derived from a std::tuple<...> _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_I_n_t_e_g_r_a_l_C_o_n_s_t_a_n_t_<_ _T_ _> │ │ │ │ │ -  Check if T is an std::integral_constant _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_z_e_O_f_<_ _T_ _> │ │ │ │ │ -  Compute size of variadic type list. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _T_ _> │ │ │ │ │ -  Type free of internal references that T can be converted to. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _T_ _&_ _> │ │ │ │ │ -  Specialization to remove lvalue references. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _T_ _&_&_ _> │ │ │ │ │ -  Specialization to remove rvalue references. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _c_o_n_s_t_ _T_ _> │ │ │ │ │ -  Specialization to remove const qualifiers. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _v_o_l_a_t_i_l_e_ _T_ _> │ │ │ │ │ -  Specialization to remove volatile qualifiers. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _b_o_o_l_ _>_:_:_r_e_f_e_r_e_n_c_e_ _> │ │ │ │ │ -  Specialization for the proxies of vector _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _v_o_l_a_t_i_l_e_ _c_o_n_s_t_ _T_ _> │ │ │ │ │ -  Specialization to remove both const and volatile qualifiers. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_x_<_ _T_y_p_e_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_v_o_i_d___t = typename Impl::voider< Types... >::type │ │ │ │ │ -  Is void for all valid input types. The workhorse for C++11 SFINAE- │ │ │ │ │ - techniques. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_f_i_e_l_d___t = typename _F_i_e_l_d_T_r_a_i_t_s< Type >::field_type │ │ │ │ │ -  Convenient access to _F_i_e_l_d_T_r_a_i_t_s_<_T_y_p_e_>_:_:_f_i_e_l_d___t_y_p_e. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_r_e_a_l___t = typename _F_i_e_l_d_T_r_a_i_t_s< Type >::real_type │ │ │ │ │ -  Convenient access to _F_i_e_l_d_T_r_a_i_t_s_<_T_y_p_e_>_:_:_r_e_a_l___t_y_p_e. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e = typename _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e< T >::type │ │ │ │ │ -  Type free of internal references that T can be converted to. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - constexpr auto  _D_u_n_e_:_:_i_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y (std:: │ │ │ │ │ - integer_sequence< T, t... >, std:: │ │ │ │ │ - integral_constant< std::size_t, index > i) │ │ │ │ │ -  Get entry of std::integer_sequence. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -constexpr _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e< T >  _D_u_n_e_:_:_a_u_t_o_C_o_p_y (T &&v) │ │ │ │ │ -  Autonomous copy of an expression's value for │ │ │ │ │ - use in auto type deduction. │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt, Christian Engwer │ │ │ │ │ +helper classes to provide unique types for standard functions │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: typetraits.hh Source File │ │ │ │ +dune-common: binaryfunctions.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,411 +74,81 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
typetraits.hh
│ │ │ │ +
binaryfunctions.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_TYPETRAITS_HH
│ │ │ │ -
6#define DUNE_TYPETRAITS_HH
│ │ │ │ +
5#ifndef DUNE_BINARYFUNCTIONS_HH
│ │ │ │ +
6#define DUNE_BINARYFUNCTIONS_HH
│ │ │ │
7
│ │ │ │ -
8#include <complex>
│ │ │ │ -
9#include <type_traits>
│ │ │ │ -
10#include <utility>
│ │ │ │ -
11#include <vector>
│ │ │ │ -
12
│ │ │ │ -
13namespace Dune
│ │ │ │ -
14{
│ │ │ │ -
15
│ │ │ │ -
16 namespace Impl
│ │ │ │ -
17 {
│ │ │ │ -
19
│ │ │ │ -
23 template <class...>
│ │ │ │ -
24 struct voider
│ │ │ │ -
25 {
│ │ │ │ -
26 using type = void;
│ │ │ │ -
27 };
│ │ │ │ -
28 }
│ │ │ │ -
29
│ │ │ │ +
12#include <algorithm>
│ │ │ │ +
13
│ │ │ │ +
14namespace Dune
│ │ │ │ +
15{
│ │ │ │ +
16 template<typename Type>
│ │ │ │ +
│ │ │ │ +
17 struct Min
│ │ │ │ +
18 {
│ │ │ │ +
19 using first_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │ +
20
│ │ │ │ +
21 using second_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │ +
22
│ │ │ │ +
23 using result_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │ +
24
│ │ │ │ +
│ │ │ │ +
25 Type operator()(const Type& t1, const Type& t2) const
│ │ │ │ +
26 {
│ │ │ │ +
27 using std::min;
│ │ │ │ +
28 return min(t1,t2);
│ │ │ │ +
29 }
│ │ │ │ +
│ │ │ │ +
30 };
│ │ │ │ +
│ │ │ │
31
│ │ │ │ -
39 template <class... Types>
│ │ │ │ -
40 using void_t = typename Impl::voider<Types...>::type;
│ │ │ │ -
41
│ │ │ │ -
55 struct Empty {};
│ │ │ │ -
56
│ │ │ │ -
63 template<class T1, class T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
65 {
│ │ │ │ -
70 constexpr static bool value = std::is_convertible<T1,T2>::value || std::is_convertible<T2,T1>::value;
│ │ │ │ -
71 };
│ │ │ │ -
│ │ │ │ -
72
│ │ │ │ -
78 template<class T1, class T2, class Type>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
80 : public std::enable_if<IsInteroperable<T1,T2>::value, Type>
│ │ │ │ -
81 {};
│ │ │ │ -
│ │ │ │ -
82
│ │ │ │ -
100
│ │ │ │ -
116
│ │ │ │ -
123 template<typename T>
│ │ │ │ -
124 struct AlwaysFalse : public std::false_type {};
│ │ │ │ -
125
│ │ │ │ -
133 template<typename T>
│ │ │ │ -
134 struct AlwaysTrue : public std::true_type {};
│ │ │ │ -
135
│ │ │ │ -
161 template<typename D, typename R = void>
│ │ │ │ - │ │ │ │ -
163
│ │ │ │ -
168 template<typename R, typename F, typename... Args>
│ │ │ │ -
│ │ │ │ -
169 struct IsCallable<F(Args...), R>
│ │ │ │ -
170 : public std::bool_constant<
│ │ │ │ -
171 std::is_invocable_r_v<R, F, Args...>
│ │ │ │ -
172 && !std::is_member_pointer_v<std::decay_t<F>>
│ │ │ │ -
173 > {};
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
177
│ │ │ │ -
192 template <typename T>
│ │ │ │ -
│ │ │ │ -
193 struct IsNumber
│ │ │ │ -
194 : public std::integral_constant<bool, std::is_arithmetic<T>::value> {
│ │ │ │ -
195 };
│ │ │ │ -
│ │ │ │ -
196
│ │ │ │ -
197#ifndef DOXYGEN
│ │ │ │ -
198
│ │ │ │ -
199 template <typename T>
│ │ │ │ -
200 struct IsNumber<std::complex<T>>
│ │ │ │ -
201 : public std::integral_constant<bool, IsNumber<T>::value> {
│ │ │ │ -
202 };
│ │ │ │ -
203
│ │ │ │ -
204#endif // DOXYGEN
│ │ │ │ -
205
│ │ │ │ -
207
│ │ │ │ -
210 template <typename T>
│ │ │ │ -
│ │ │ │ -
211 struct HasNaN
│ │ │ │ -
212 : public std::integral_constant<bool, std::is_floating_point<T>::value> {
│ │ │ │ -
213 };
│ │ │ │ -
│ │ │ │ -
214
│ │ │ │ -
215#ifndef DOXYGEN
│ │ │ │ -
216
│ │ │ │ -
217 template <typename T>
│ │ │ │ -
218 struct HasNaN<std::complex<T>>
│ │ │ │ -
219 : public std::integral_constant<bool, std::is_floating_point<T>::value> {
│ │ │ │ -
220 };
│ │ │ │ -
221
│ │ │ │ -
222#endif // DOXYGEN
│ │ │ │ -
223
│ │ │ │ -
224#ifndef DOXYGEN
│ │ │ │ -
225
│ │ │ │ -
226 namespace Impl {
│ │ │ │ -
227
│ │ │ │ -
228 template<typename T, typename I, typename = int>
│ │ │ │ -
229 struct IsIndexable
│ │ │ │ -
230 : public std::false_type
│ │ │ │ -
231 {};
│ │ │ │ -
232
│ │ │ │ -
233 template<typename T, typename I>
│ │ │ │ -
234 struct IsIndexable<T,I,typename std::enable_if<(sizeof(std::declval<T>()[std::declval<I>()]) > 0),int>::type>
│ │ │ │ -
235 : public std::true_type
│ │ │ │ -
236 {};
│ │ │ │ -
237
│ │ │ │ -
238 }
│ │ │ │ -
239
│ │ │ │ -
240#endif // DOXYGEN
│ │ │ │ -
241
│ │ │ │ -
243
│ │ │ │ -
247 template<typename T, typename I = std::size_t>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
249 : public Impl::IsIndexable<T,I>
│ │ │ │ -
250 {};
│ │ │ │ -
│ │ │ │ -
251
│ │ │ │ -
252#ifndef DOXYGEN
│ │ │ │ -
253
│ │ │ │ -
254 namespace Impl {
│ │ │ │ -
255 // This function does nothing.
│ │ │ │ -
256 // By passing expressions to this function one can avoid
│ │ │ │ -
257 // "value computed is not used" warnings that may show up
│ │ │ │ -
258 // in a comma expression.
│ │ │ │ -
259 template<class...T>
│ │ │ │ -
260 void ignore(T&&... /*t*/)
│ │ │ │ -
261 {}
│ │ │ │ -
262 }
│ │ │ │ -
263
│ │ │ │ -
264#endif // DOXYGEN
│ │ │ │ -
265
│ │ │ │ -
269 // default version, gets picked if SFINAE fails
│ │ │ │ -
270 template<typename T, typename = void>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
272 : public std::false_type
│ │ │ │ -
273 {};
│ │ │ │ -
│ │ │ │ -
274
│ │ │ │ -
275#ifndef DOXYGEN
│ │ │ │ -
276 // version for types with begin() and end()
│ │ │ │ -
277 template<typename T>
│ │ │ │ -
278 struct IsIterable<T, decltype(Impl::ignore(
│ │ │ │ -
279 std::declval<T>().begin(),
│ │ │ │ -
280 std::declval<T>().end(),
│ │ │ │ -
281 std::declval<T>().begin() != std::declval<T>().end(),
│ │ │ │ -
282 decltype(std::declval<T>().begin()){std::declval<T>().end()},
│ │ │ │ -
283 ++(std::declval<std::add_lvalue_reference_t<decltype(std::declval<T>().begin())>>()),
│ │ │ │ -
284 *(std::declval<T>().begin())
│ │ │ │ -
285 ))>
│ │ │ │ -
286 : public std::true_type
│ │ │ │ -
287 {};
│ │ │ │ -
288#endif
│ │ │ │ -
289
│ │ │ │ -
290#ifndef DOXYGEN
│ │ │ │ -
291 // this is just a forward declaration
│ │ │ │ -
292 template <class> struct FieldTraits;
│ │ │ │ -
293#endif
│ │ │ │ -
294
│ │ │ │ -
296 template <class Type>
│ │ │ │ - │ │ │ │ -
298
│ │ │ │ -
300 template <class Type>
│ │ │ │ - │ │ │ │ -
302
│ │ │ │ -
303
│ │ │ │ -
304#ifndef DOXYGEN
│ │ │ │ -
305
│ │ │ │ -
306 // Implementation of IsTuple
│ │ │ │ -
307 namespace Impl {
│ │ │ │ -
308
│ │ │ │ -
309 template<class T>
│ │ │ │ -
310 struct IsTuple : public std::false_type
│ │ │ │ -
311 {};
│ │ │ │ -
312
│ │ │ │ -
313 template<class... T>
│ │ │ │ -
314 struct IsTuple<std::tuple<T...>> : public std::true_type
│ │ │ │ -
315 {};
│ │ │ │ -
316
│ │ │ │ -
317 } // namespace Impl
│ │ │ │ -
318
│ │ │ │ -
319#endif // DOXYGEN
│ │ │ │ -
320
│ │ │ │ -
326 template<class T>
│ │ │ │ -
│ │ │ │ -
327 struct IsTuple :
│ │ │ │ -
328 public Impl::IsTuple<T>
│ │ │ │ -
329 {};
│ │ │ │ -
│ │ │ │ -
330
│ │ │ │ -
331
│ │ │ │ -
332#ifndef DOXYGEN
│ │ │ │ -
333
│ │ │ │ -
334 // Implementation of IsTupleOrDerived
│ │ │ │ -
335 namespace Impl {
│ │ │ │ -
336
│ │ │ │ -
337 template<class... T, class Dummy>
│ │ │ │ -
338 std::true_type isTupleOrDerived(const std::tuple<T...>*, Dummy)
│ │ │ │ -
339 { return {}; }
│ │ │ │ -
340
│ │ │ │ -
341 template<class Dummy>
│ │ │ │ -
342 std::false_type isTupleOrDerived(const void*, Dummy)
│ │ │ │ -
343 { return {}; }
│ │ │ │ -
344
│ │ │ │ -
345 } // namespace Impl
│ │ │ │ -
346
│ │ │ │ -
347#endif // DOXYGEN
│ │ │ │ -
348
│ │ │ │ -
354 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
356 public decltype(Impl::isTupleOrDerived(std::declval<T*>(), true))
│ │ │ │ -
357 {};
│ │ │ │ -
│ │ │ │ -
358
│ │ │ │ -
359
│ │ │ │ -
360#ifndef DOXYGEN
│ │ │ │ -
361
│ │ │ │ -
362 // Implementation of is IsIntegralConstant
│ │ │ │ -
363 namespace Impl {
│ │ │ │ -
364
│ │ │ │ -
365 template<class T>
│ │ │ │ -
366 struct IsIntegralConstant : public std::false_type
│ │ │ │ -
367 {};
│ │ │ │ -
368
│ │ │ │ -
369 template<class T, T t>
│ │ │ │ -
370 struct IsIntegralConstant<std::integral_constant<T, t>> : public std::true_type
│ │ │ │ -
371 {};
│ │ │ │ -
372
│ │ │ │ -
373 } // namespace Impl
│ │ │ │ -
374
│ │ │ │ -
375#endif // DOXYGEN
│ │ │ │ -
376
│ │ │ │ -
382 template<class T>
│ │ │ │ -
│ │ │ │ -
383 struct IsIntegralConstant : public Impl::IsIntegralConstant<std::decay_t<T>>
│ │ │ │ -
384 {};
│ │ │ │ -
│ │ │ │ -
385
│ │ │ │ -
386
│ │ │ │ -
387
│ │ │ │ -
401 template<typename... T>
│ │ │ │ -
│ │ │ │ -
402 struct SizeOf
│ │ │ │ -
403 : public std::integral_constant<std::size_t,sizeof...(T)>
│ │ │ │ -
404 {};
│ │ │ │ -
│ │ │ │ -
405
│ │ │ │ -
406
│ │ │ │ -
407#ifndef DOXYGEN
│ │ │ │ -
408
│ │ │ │ -
409 namespace Impl {
│ │ │ │ -
410
│ │ │ │ -
411 template<class T, T...>
│ │ │ │ -
412 struct IntegerSequenceHelper;
│ │ │ │ -
413
│ │ │ │ -
414 // Helper struct to compute the i-th entry of a std::integer_sequence
│ │ │ │ -
415 //
│ │ │ │ -
416 // This could also be implemented using std::get<index>(std::make_tuple(t...)).
│ │ │ │ -
417 // However, the gcc-6 implementation of std::make_tuple increases the instantiation
│ │ │ │ -
418 // depth by 15 levels for each argument, such that the maximal instantiation depth
│ │ │ │ -
419 // is easily hit, especially with clang where it is set to 256.
│ │ │ │ -
420 template<class T, T head, T... tail>
│ │ │ │ -
421 struct IntegerSequenceHelper<T, head, tail...>
│ │ │ │ -
422 {
│ │ │ │ -
423
│ │ │ │ -
424 // get first entry
│ │ │ │ -
425 static constexpr auto get(std::integral_constant<std::size_t, 0>)
│ │ │ │ -
426 {
│ │ │ │ -
427 return std::integral_constant<T, head>();
│ │ │ │ -
428 }
│ │ │ │ -
429
│ │ │ │ -
430 // call get with first entry cut off and decremented index
│ │ │ │ -
431 template<std::size_t index,
│ │ │ │ -
432 std::enable_if_t<(index > 0) and (index < sizeof...(tail)+1), int> = 0>
│ │ │ │ -
433 static constexpr auto get(std::integral_constant<std::size_t, index>)
│ │ │ │ -
434 {
│ │ │ │ -
435 return IntegerSequenceHelper<T, tail...>::get(std::integral_constant<std::size_t, index-1>());
│ │ │ │ -
436 }
│ │ │ │ -
437
│ │ │ │ -
438 // use static assertion if index exceeds size
│ │ │ │ -
439 template<std::size_t index,
│ │ │ │ -
440 std::enable_if_t<(index >= sizeof...(tail)+1), int> = 0>
│ │ │ │ -
441 static constexpr auto get(std::integral_constant<std::size_t, index>)
│ │ │ │ -
442 {
│ │ │ │ -
443 static_assert(index < sizeof...(tail)+1, "index used in IntegerSequenceEntry exceed size");
│ │ │ │ -
444 }
│ │ │ │ -
445 };
│ │ │ │ -
446
│ │ │ │ -
447 } // end namespace Impl
│ │ │ │ -
448
│ │ │ │ -
449#endif // DOXYGEN
│ │ │ │ -
450
│ │ │ │ -
451
│ │ │ │ -
461 template<class T, T... t, std::size_t index>
│ │ │ │ -
│ │ │ │ -
462 constexpr auto integerSequenceEntry(std::integer_sequence<T, t...> /*seq*/, std::integral_constant<std::size_t, index> i)
│ │ │ │ -
463 {
│ │ │ │ -
464 static_assert(index < sizeof...(t), "index used in IntegerSequenceEntry exceed size");
│ │ │ │ -
465 return Impl::IntegerSequenceHelper<T, t...>::get(i);
│ │ │ │ -
466 }
│ │ │ │ -
│ │ │ │ -
467
│ │ │ │ -
468
│ │ │ │ -
475 template<class IntegerSequence, std::size_t index>
│ │ │ │ - │ │ │ │ -
477
│ │ │ │ -
478#ifndef DOXYGEN
│ │ │ │ -
479
│ │ │ │ -
480 template<class T, T... t, std::size_t i>
│ │ │ │ -
481 struct IntegerSequenceEntry<std::integer_sequence<T, t...>, i>
│ │ │ │ -
482 : public decltype(Impl::IntegerSequenceHelper<T, t...>::get(std::integral_constant<std::size_t, i>()))
│ │ │ │ -
483 {};
│ │ │ │ -
484
│ │ │ │ -
485#endif // DOXYGEN
│ │ │ │ -
486
│ │ │ │ -
500 template<class T>
│ │ │ │ -
501 struct AutonomousValueType { using type = T; };
│ │ │ │ -
502
│ │ │ │ -
504 template<class T>
│ │ │ │ - │ │ │ │ -
506
│ │ │ │ -
508 template<class T>
│ │ │ │ - │ │ │ │ -
510
│ │ │ │ -
512 template<class T>
│ │ │ │ - │ │ │ │ -
514
│ │ │ │ -
516 template<class T>
│ │ │ │ -
517 struct AutonomousValueType<volatile T> : AutonomousValueType<T> {};
│ │ │ │ -
518
│ │ │ │ -
520 template<>
│ │ │ │ -
│ │ │ │ -
521 struct AutonomousValueType<std::vector<bool>::reference>
│ │ │ │ -
522 {
│ │ │ │ -
523 using type = bool;
│ │ │ │ -
524 };
│ │ │ │ -
│ │ │ │ -
525
│ │ │ │ -
527 template<class T>
│ │ │ │ -
528 struct AutonomousValueType<volatile const T> : AutonomousValueType<T> {};
│ │ │ │ -
529
│ │ │ │ -
557 template<class T>
│ │ │ │ - │ │ │ │ -
559
│ │ │ │ -
641 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
643 {
│ │ │ │ -
644 return v;
│ │ │ │ -
645 }
│ │ │ │ -
│ │ │ │ -
646
│ │ │ │ -
648}
│ │ │ │ -
649#endif
│ │ │ │ -
constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::integral_constant< std::size_t, index > i)
Get entry of std::integer_sequence.
Definition typetraits.hh:462
│ │ │ │ -
typename FieldTraits< Type >::real_type real_t
Convenient access to FieldTraits<Type>::real_type.
Definition typetraits.hh:301
│ │ │ │ -
constexpr AutonomousValue< T > autoCopy(T &&v)
Autonomous copy of an expression's value for use in auto type deduction.
Definition typetraits.hh:642
│ │ │ │ -
typename AutonomousValueType< T >::type AutonomousValue
Type free of internal references that T can be converted to.
Definition typetraits.hh:558
│ │ │ │ -
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition typetraits.hh:40
│ │ │ │ -
typename FieldTraits< Type >::field_type field_t
Convenient access to FieldTraits<Type>::field_type.
Definition typetraits.hh:297
│ │ │ │ -
STL namespace.
│ │ │ │ +
32 template<typename Type>
│ │ │ │ +
│ │ │ │ +
33 struct Max
│ │ │ │ +
34 {
│ │ │ │ +
35 using first_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │ +
36
│ │ │ │ +
37 using second_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │ +
38
│ │ │ │ +
39 using result_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │ +
40
│ │ │ │ +
│ │ │ │ +
41 Type operator()(const Type& t1, const Type& t2) const
│ │ │ │ +
42 {
│ │ │ │ +
43 using std::max;
│ │ │ │ +
44 return max(t1,t2);
│ │ │ │ +
45 }
│ │ │ │ +
│ │ │ │ +
46 };
│ │ │ │ +
│ │ │ │ +
47}
│ │ │ │ +
48
│ │ │ │ +
49#endif
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
Definition propertymap.hh:84
│ │ │ │ -
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition typetraits.hh:194
│ │ │ │ -
T field_type
export the type representing the field
Definition ftraits.hh:28
│ │ │ │ -
T real_type
export the type representing the real type of the field
Definition ftraits.hh:30
│ │ │ │ -
Just an empty class.
Definition typetraits.hh:55
│ │ │ │ -
Checks whether two types are interoperable.
Definition typetraits.hh:65
│ │ │ │ -
static constexpr bool value
True if either a conversion from T1 to T2 or vice versa exists.
Definition typetraits.hh:70
│ │ │ │ -
Enable typedef if two types are interoperable.
Definition typetraits.hh:81
│ │ │ │ -
template which always yields a false value
Definition typetraits.hh:124
│ │ │ │ -
template which always yields a true value
Definition typetraits.hh:134
│ │ │ │ -
Check if a type is callable with ()-operator and given arguments.
Definition typetraits.hh:162
│ │ │ │ -
Whether this type has a value of NaN.
Definition typetraits.hh:212
│ │ │ │ -
Type trait to determine whether an instance of T has an operator[](I), i.e. whether it can be indexed...
Definition typetraits.hh:250
│ │ │ │ -
typetrait to check that a class has begin() and end() members
Definition typetraits.hh:273
│ │ │ │ -
Check if T is a std::tuple<...>
Definition typetraits.hh:329
│ │ │ │ -
Check if T derived from a std::tuple<...>
Definition typetraits.hh:357
│ │ │ │ -
Check if T is an std::integral_constant<I, i>
Definition typetraits.hh:384
│ │ │ │ -
Compute size of variadic type list.
Definition typetraits.hh:404
│ │ │ │ -
Get entry of std::integer_sequence.
Definition typetraits.hh:476
│ │ │ │ -
Type free of internal references that T can be converted to.
Definition typetraits.hh:501
│ │ │ │ -
T type
Definition typetraits.hh:501
│ │ │ │ - │ │ │ │ +
Definition binaryfunctions.hh:18
│ │ │ │ +
Type result_type
Definition binaryfunctions.hh:23
│ │ │ │ +
Type operator()(const Type &t1, const Type &t2) const
Definition binaryfunctions.hh:25
│ │ │ │ +
Type first_argument_type
Definition binaryfunctions.hh:19
│ │ │ │ +
Type second_argument_type
Definition binaryfunctions.hh:21
│ │ │ │ +
Definition binaryfunctions.hh:34
│ │ │ │ +
Type operator()(const Type &t1, const Type &t2) const
Definition binaryfunctions.hh:41
│ │ │ │ +
Type result_type
Definition binaryfunctions.hh:39
│ │ │ │ +
Type first_argument_type
Definition binaryfunctions.hh:35
│ │ │ │ +
Type second_argument_type
Definition binaryfunctions.hh:37
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,462 +1,93 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -typetraits.hh │ │ │ │ │ +binaryfunctions.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_TYPETRAITS_HH │ │ │ │ │ -6#define DUNE_TYPETRAITS_HH │ │ │ │ │ +5#ifndef DUNE_BINARYFUNCTIONS_HH │ │ │ │ │ +6#define DUNE_BINARYFUNCTIONS_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12 │ │ │ │ │ -13namespace _D_u_n_e │ │ │ │ │ -14{ │ │ │ │ │ -15 │ │ │ │ │ -16 namespace Impl │ │ │ │ │ -17 { │ │ │ │ │ -19 │ │ │ │ │ -23 template │ │ │ │ │ -24 struct voider │ │ │ │ │ -25 { │ │ │ │ │ -26 using type = void; │ │ │ │ │ -27 }; │ │ │ │ │ -28 } │ │ │ │ │ -29 │ │ │ │ │ +12#include │ │ │ │ │ +13 │ │ │ │ │ +14namespace _D_u_n_e │ │ │ │ │ +15{ │ │ │ │ │ +16 template │ │ │ │ │ +_1_7 struct _M_i_n │ │ │ │ │ +18 { │ │ │ │ │ +_1_9 using _f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ +following similar deprecations in C++17")]] = Type; │ │ │ │ │ +20 │ │ │ │ │ +_2_1 using _s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ +following similar deprecations in C++17")]] = Type; │ │ │ │ │ +22 │ │ │ │ │ +_2_3 using _r_e_s_u_l_t___t_y_p_e [[deprecated("This type alias is deprecated following │ │ │ │ │ +similar deprecations in C++17")]] = Type; │ │ │ │ │ +24 │ │ │ │ │ +_2_5 Type _o_p_e_r_a_t_o_r_(_)(const Type& t1, const Type& t2) const │ │ │ │ │ +26 { │ │ │ │ │ +27 using std::min; │ │ │ │ │ +28 return min(t1,t2); │ │ │ │ │ +29 } │ │ │ │ │ +30 }; │ │ │ │ │ 31 │ │ │ │ │ -39 template │ │ │ │ │ -_4_0 using _v_o_i_d___t = typename Impl::voider::type; │ │ │ │ │ -41 │ │ │ │ │ -_5_5 struct _E_m_p_t_y {}; │ │ │ │ │ -56 │ │ │ │ │ -63 template │ │ │ │ │ -_6_4 struct _I_s_I_n_t_e_r_o_p_e_r_a_b_l_e │ │ │ │ │ -65 { │ │ │ │ │ -_7_0 constexpr static bool _v_a_l_u_e = std::is_convertible::value || std:: │ │ │ │ │ -is_convertible::value; │ │ │ │ │ -71 }; │ │ │ │ │ -72 │ │ │ │ │ -78 template │ │ │ │ │ -_7_9 struct _E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e │ │ │ │ │ -80 : public std::enable_if::value, Type> │ │ │ │ │ -81 {}; │ │ │ │ │ -82 │ │ │ │ │ -100 │ │ │ │ │ -116 │ │ │ │ │ -123 template │ │ │ │ │ -_1_2_4 struct _A_l_w_a_y_s_F_a_l_s_e : public std::false_type {}; │ │ │ │ │ -125 │ │ │ │ │ -133 template │ │ │ │ │ -_1_3_4 struct _A_l_w_a_y_s_T_r_u_e : public std::true_type {}; │ │ │ │ │ -135 │ │ │ │ │ -161 template │ │ │ │ │ -_1_6_2 struct _I_s_C_a_l_l_a_b_l_e; │ │ │ │ │ -163 │ │ │ │ │ -168 template │ │ │ │ │ -_1_6_9 struct _I_s_C_a_l_l_a_b_l_e │ │ │ │ │ -170 : public std::bool_constant< │ │ │ │ │ -171 std::is_invocable_r_v │ │ │ │ │ -172 && !std::is_member_pointer_v> │ │ │ │ │ -173 > {}; │ │ │ │ │ -174 │ │ │ │ │ -177 │ │ │ │ │ -192 template │ │ │ │ │ -_1_9_3 struct _I_s_N_u_m_b_e_r │ │ │ │ │ -194 : public std::integral_constant::value> { │ │ │ │ │ -195 }; │ │ │ │ │ -196 │ │ │ │ │ -197#ifndef DOXYGEN │ │ │ │ │ -198 │ │ │ │ │ -199 template │ │ │ │ │ -200 struct _I_s_N_u_m_b_e_r<_s_t_d::complex> │ │ │ │ │ -201 : public std::integral_constant::value> { │ │ │ │ │ -202 }; │ │ │ │ │ -203 │ │ │ │ │ -204#endif // DOXYGEN │ │ │ │ │ -205 │ │ │ │ │ -207 │ │ │ │ │ -210 template │ │ │ │ │ -_2_1_1 struct _H_a_s_N_a_N │ │ │ │ │ -212 : public std::integral_constant::value> { │ │ │ │ │ -213 }; │ │ │ │ │ -214 │ │ │ │ │ -215#ifndef DOXYGEN │ │ │ │ │ -216 │ │ │ │ │ -217 template │ │ │ │ │ -218 struct _H_a_s_N_a_N<_s_t_d::complex> │ │ │ │ │ -219 : public std::integral_constant::value> { │ │ │ │ │ -220 }; │ │ │ │ │ -221 │ │ │ │ │ -222#endif // DOXYGEN │ │ │ │ │ -223 │ │ │ │ │ -224#ifndef DOXYGEN │ │ │ │ │ -225 │ │ │ │ │ -226 namespace Impl { │ │ │ │ │ -227 │ │ │ │ │ -228 template │ │ │ │ │ -229 struct IsIndexable │ │ │ │ │ -230 : public std::false_type │ │ │ │ │ -231 {}; │ │ │ │ │ -232 │ │ │ │ │ -233 template │ │ │ │ │ -234 struct IsIndexable() │ │ │ │ │ -[std::declval()]) > 0),int>::type> │ │ │ │ │ -235 : public std::true_type │ │ │ │ │ -236 {}; │ │ │ │ │ -237 │ │ │ │ │ -238 } │ │ │ │ │ -239 │ │ │ │ │ -240#endif // DOXYGEN │ │ │ │ │ -241 │ │ │ │ │ -243 │ │ │ │ │ -247 template │ │ │ │ │ -_2_4_8 struct _I_s_I_n_d_e_x_a_b_l_e │ │ │ │ │ -249 : public Impl::IsIndexable │ │ │ │ │ -250 {}; │ │ │ │ │ -251 │ │ │ │ │ -252#ifndef DOXYGEN │ │ │ │ │ -253 │ │ │ │ │ -254 namespace Impl { │ │ │ │ │ -255 // This function does nothing. │ │ │ │ │ -256 // By passing expressions to this function one can avoid │ │ │ │ │ -257 // "value computed is not used" warnings that may show up │ │ │ │ │ -258 // in a comma expression. │ │ │ │ │ -259 template │ │ │ │ │ -260 void ignore(T&&... /*t*/) │ │ │ │ │ -261 {} │ │ │ │ │ -262 } │ │ │ │ │ -263 │ │ │ │ │ -264#endif // DOXYGEN │ │ │ │ │ -265 │ │ │ │ │ -269 // default version, gets picked if SFINAE fails │ │ │ │ │ -270 template │ │ │ │ │ -_2_7_1 struct _I_s_I_t_e_r_a_b_l_e │ │ │ │ │ -272 : public std::false_type │ │ │ │ │ -273 {}; │ │ │ │ │ -274 │ │ │ │ │ -275#ifndef DOXYGEN │ │ │ │ │ -276 // version for types with begin() and end() │ │ │ │ │ -277 template │ │ │ │ │ -278 struct _I_s_I_t_e_r_a_b_l_e().begin(), │ │ │ │ │ -280 std::declval().end(), │ │ │ │ │ -281 std::declval().begin() != std::declval().end(), │ │ │ │ │ -282 decltype(std::declval().begin()){std::declval().end()}, │ │ │ │ │ -283 ++(std::declval │ │ │ │ │ -().begin())>>()), │ │ │ │ │ -284 *(std::declval().begin()) │ │ │ │ │ -285 ))> │ │ │ │ │ -286 : public std::true_type │ │ │ │ │ -287 {}; │ │ │ │ │ -288#endif │ │ │ │ │ -289 │ │ │ │ │ -290#ifndef DOXYGEN │ │ │ │ │ -291 // this is just a forward declaration │ │ │ │ │ -292 template struct FieldTraits; │ │ │ │ │ -293#endif │ │ │ │ │ -294 │ │ │ │ │ -296 template │ │ │ │ │ -_2_9_7 using _f_i_e_l_d___t = typename _F_i_e_l_d_T_r_a_i_t_s_<_T_y_p_e_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -298 │ │ │ │ │ -300 template │ │ │ │ │ -_3_0_1 using _r_e_a_l___t = typename _F_i_e_l_d_T_r_a_i_t_s_<_T_y_p_e_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ -302 │ │ │ │ │ -303 │ │ │ │ │ -304#ifndef DOXYGEN │ │ │ │ │ -305 │ │ │ │ │ -306 // Implementation of IsTuple │ │ │ │ │ -307 namespace Impl { │ │ │ │ │ -308 │ │ │ │ │ -309 template │ │ │ │ │ -310 struct _I_s_T_u_p_l_e : public std::false_type │ │ │ │ │ -311 {}; │ │ │ │ │ -312 │ │ │ │ │ -313 template │ │ │ │ │ -314 struct _I_s_T_u_p_l_e<_s_t_d::tuple> : public std::true_type │ │ │ │ │ -315 {}; │ │ │ │ │ -316 │ │ │ │ │ -317 } // namespace Impl │ │ │ │ │ -318 │ │ │ │ │ -319#endif // DOXYGEN │ │ │ │ │ -320 │ │ │ │ │ -326 template │ │ │ │ │ -_3_2_7 struct _I_s_T_u_p_l_e : │ │ │ │ │ -328 public Impl::IsTuple │ │ │ │ │ -329 {}; │ │ │ │ │ -330 │ │ │ │ │ -331 │ │ │ │ │ -332#ifndef DOXYGEN │ │ │ │ │ -333 │ │ │ │ │ -334 // Implementation of IsTupleOrDerived │ │ │ │ │ -335 namespace Impl { │ │ │ │ │ -336 │ │ │ │ │ -337 template │ │ │ │ │ -338 std::true_type isTupleOrDerived(const std::tuple*, Dummy) │ │ │ │ │ -339 { return {}; } │ │ │ │ │ -340 │ │ │ │ │ -341 template │ │ │ │ │ -342 std::false_type isTupleOrDerived(const void*, Dummy) │ │ │ │ │ -343 { return {}; } │ │ │ │ │ -344 │ │ │ │ │ -345 } // namespace Impl │ │ │ │ │ -346 │ │ │ │ │ -347#endif // DOXYGEN │ │ │ │ │ -348 │ │ │ │ │ -354 template │ │ │ │ │ -_3_5_5 struct _I_s_T_u_p_l_e_O_r_D_e_r_i_v_e_d : │ │ │ │ │ -356 public decltype(Impl::isTupleOrDerived(std::declval(), true)) │ │ │ │ │ -357 {}; │ │ │ │ │ -358 │ │ │ │ │ -359 │ │ │ │ │ -360#ifndef DOXYGEN │ │ │ │ │ -361 │ │ │ │ │ -362 // Implementation of is IsIntegralConstant │ │ │ │ │ -363 namespace Impl { │ │ │ │ │ -364 │ │ │ │ │ -365 template │ │ │ │ │ -366 struct _I_s_I_n_t_e_g_r_a_l_C_o_n_s_t_a_n_t : public std::false_type │ │ │ │ │ -367 {}; │ │ │ │ │ -368 │ │ │ │ │ -369 template │ │ │ │ │ -370 struct IsIntegralConstant<_s_t_d::integral_constant> : public std:: │ │ │ │ │ -true_type │ │ │ │ │ -371 {}; │ │ │ │ │ -372 │ │ │ │ │ -373 } // namespace Impl │ │ │ │ │ -374 │ │ │ │ │ -375#endif // DOXYGEN │ │ │ │ │ -376 │ │ │ │ │ -382 template │ │ │ │ │ -_3_8_3 struct _I_s_I_n_t_e_g_r_a_l_C_o_n_s_t_a_n_t : public Impl::IsIntegralConstant> │ │ │ │ │ -384 {}; │ │ │ │ │ -385 │ │ │ │ │ -386 │ │ │ │ │ -387 │ │ │ │ │ -401 template │ │ │ │ │ -_4_0_2 struct _S_i_z_e_O_f │ │ │ │ │ -403 : public std::integral_constant │ │ │ │ │ -404 {}; │ │ │ │ │ -405 │ │ │ │ │ -406 │ │ │ │ │ -407#ifndef DOXYGEN │ │ │ │ │ -408 │ │ │ │ │ -409 namespace Impl { │ │ │ │ │ -410 │ │ │ │ │ -411 template │ │ │ │ │ -412 struct IntegerSequenceHelper; │ │ │ │ │ -413 │ │ │ │ │ -414 // Helper struct to compute the i-th entry of a std::integer_sequence │ │ │ │ │ -415 // │ │ │ │ │ -416 // This could also be implemented using std::get(std::make_tuple │ │ │ │ │ -(t...)). │ │ │ │ │ -417 // However, the gcc-6 implementation of std::make_tuple increases the │ │ │ │ │ -instantiation │ │ │ │ │ -418 // depth by 15 levels for each argument, such that the maximal │ │ │ │ │ -instantiation depth │ │ │ │ │ -419 // is easily hit, especially with clang where it is set to 256. │ │ │ │ │ -420 template │ │ │ │ │ -421 struct IntegerSequenceHelper │ │ │ │ │ -422 { │ │ │ │ │ -423 │ │ │ │ │ -424 // get first entry │ │ │ │ │ -425 static constexpr auto _g_e_t(std::integral_constant) │ │ │ │ │ -426 { │ │ │ │ │ -427 return std::integral_constant(); │ │ │ │ │ -428 } │ │ │ │ │ -429 │ │ │ │ │ -430 // call get with first entry cut off and decremented index │ │ │ │ │ -431 template 0) and (index < sizeof...(tail)+1), int> = 0> │ │ │ │ │ -433 static constexpr auto get(std::integral_constant) │ │ │ │ │ -434 { │ │ │ │ │ -435 return IntegerSequenceHelper::get(std::integral_constant()); │ │ │ │ │ -436 } │ │ │ │ │ -437 │ │ │ │ │ -438 // use static assertion if index exceeds size │ │ │ │ │ -439 template= sizeof...(tail)+1), int> = 0> │ │ │ │ │ -441 static constexpr auto _g_e_t(std::integral_constant) │ │ │ │ │ -442 { │ │ │ │ │ -443 static_assert(index < sizeof...(tail)+1, "index used in │ │ │ │ │ -IntegerSequenceEntry exceed size"); │ │ │ │ │ -444 } │ │ │ │ │ -445 }; │ │ │ │ │ -446 │ │ │ │ │ -447 } // end namespace Impl │ │ │ │ │ -448 │ │ │ │ │ -449#endif // DOXYGEN │ │ │ │ │ -450 │ │ │ │ │ -451 │ │ │ │ │ -461 template │ │ │ │ │ -_4_6_2 constexpr auto _i_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y(std::integer_sequence /*seq*/, │ │ │ │ │ -std::integral_constant i) │ │ │ │ │ -463 { │ │ │ │ │ -464 static_assert(index < sizeof...(t), "index used in IntegerSequenceEntry │ │ │ │ │ -exceed size"); │ │ │ │ │ -465 return Impl::IntegerSequenceHelper::get(i); │ │ │ │ │ -466 } │ │ │ │ │ -467 │ │ │ │ │ -468 │ │ │ │ │ -475 template │ │ │ │ │ -_4_7_6 struct _I_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y; │ │ │ │ │ -477 │ │ │ │ │ -478#ifndef DOXYGEN │ │ │ │ │ -479 │ │ │ │ │ -480 template │ │ │ │ │ -481 struct _I_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y<_s_t_d::integer_sequence, i> │ │ │ │ │ -482 : public decltype(Impl::IntegerSequenceHelper::get(std:: │ │ │ │ │ -integral_constant())) │ │ │ │ │ -483 {}; │ │ │ │ │ -484 │ │ │ │ │ -485#endif // DOXYGEN │ │ │ │ │ -486 │ │ │ │ │ -500 template │ │ │ │ │ -_5_0_1 struct _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e { using _t_y_p_e = T; }; │ │ │ │ │ -502 │ │ │ │ │ -504 template │ │ │ │ │ -_5_0_5 struct _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e : _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_T_> {}; │ │ │ │ │ -506 │ │ │ │ │ -508 template │ │ │ │ │ -_5_0_9 struct _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e : _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_T_> {}; │ │ │ │ │ -510 │ │ │ │ │ -512 template │ │ │ │ │ -_5_1_3 struct _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e : _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e {}; │ │ │ │ │ -514 │ │ │ │ │ -516 template │ │ │ │ │ -_5_1_7 struct _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e : _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e {}; │ │ │ │ │ -518 │ │ │ │ │ -520 template<> │ │ │ │ │ -_5_2_1 struct _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e<_s_t_d::vector::reference> │ │ │ │ │ -522 { │ │ │ │ │ -_5_2_3 using _t_y_p_e = bool; │ │ │ │ │ -524 }; │ │ │ │ │ -525 │ │ │ │ │ -527 template │ │ │ │ │ -_5_2_8 struct _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e : _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e {}; │ │ │ │ │ -529 │ │ │ │ │ -557 template │ │ │ │ │ -_5_5_8 using _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e = typename _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_T_>_:_:_t_y_p_e; │ │ │ │ │ -559 │ │ │ │ │ -641 template │ │ │ │ │ -_6_4_2 constexpr _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_<_T_> _a_u_t_o_C_o_p_y(T &&v) │ │ │ │ │ -643 { │ │ │ │ │ -644 return v; │ │ │ │ │ -645 } │ │ │ │ │ -646 │ │ │ │ │ -648} │ │ │ │ │ -649#endif │ │ │ │ │ -_D_u_n_e_:_:_i_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y │ │ │ │ │ -constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std:: │ │ │ │ │ -integral_constant< std::size_t, index > i) │ │ │ │ │ -Get entry of std::integer_sequence. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:462 │ │ │ │ │ -_D_u_n_e_:_:_r_e_a_l___t │ │ │ │ │ -typename FieldTraits< Type >::real_type real_t │ │ │ │ │ -Convenient access to FieldTraits::real_type. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:301 │ │ │ │ │ -_D_u_n_e_:_:_a_u_t_o_C_o_p_y │ │ │ │ │ -constexpr AutonomousValue< T > autoCopy(T &&v) │ │ │ │ │ -Autonomous copy of an expression's value for use in auto type deduction. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:642 │ │ │ │ │ -_D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e │ │ │ │ │ -typename AutonomousValueType< T >::type AutonomousValue │ │ │ │ │ -Type free of internal references that T can be converted to. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:558 │ │ │ │ │ -_D_u_n_e_:_:_v_o_i_d___t │ │ │ │ │ -typename Impl::voider< Types... >::type void_t │ │ │ │ │ -Is void for all valid input types. The workhorse for C++11 SFINAE-techniques. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_f_i_e_l_d___t │ │ │ │ │ -typename FieldTraits< Type >::field_type field_t │ │ │ │ │ -Convenient access to FieldTraits::field_type. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:297 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +32 template │ │ │ │ │ +_3_3 struct _M_a_x │ │ │ │ │ +34 { │ │ │ │ │ +_3_5 using _f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ +following similar deprecations in C++17")]] = Type; │ │ │ │ │ +36 │ │ │ │ │ +_3_7 using _s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ +following similar deprecations in C++17")]] = Type; │ │ │ │ │ +38 │ │ │ │ │ +_3_9 using _r_e_s_u_l_t___t_y_p_e [[deprecated("This type alias is deprecated following │ │ │ │ │ +similar deprecations in C++17")]] = Type; │ │ │ │ │ +40 │ │ │ │ │ +_4_1 Type _o_p_e_r_a_t_o_r_(_)(const Type& t1, const Type& t2) const │ │ │ │ │ +42 { │ │ │ │ │ +43 using std::max; │ │ │ │ │ +44 return max(t1,t2); │ │ │ │ │ +45 } │ │ │ │ │ +46 }; │ │ │ │ │ +47} │ │ │ │ │ +48 │ │ │ │ │ +49#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ │ -Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const │ │ │ │ │ -Key &key) │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_I_s_N_u_m_b_e_r │ │ │ │ │ -Whether this type acts as a scalar in the context of (hierarchically blocked) │ │ │ │ │ -containers. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -T field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -T real_type │ │ │ │ │ -export the type representing the real type of the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_E_m_p_t_y │ │ │ │ │ -Just an empty class. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_I_s_I_n_t_e_r_o_p_e_r_a_b_l_e │ │ │ │ │ -Checks whether two types are interoperable. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_I_s_I_n_t_e_r_o_p_e_r_a_b_l_e_:_:_v_a_l_u_e │ │ │ │ │ -static constexpr bool value │ │ │ │ │ -True if either a conversion from T1 to T2 or vice versa exists. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_E_n_a_b_l_e_I_f_I_n_t_e_r_O_p_e_r_a_b_l_e │ │ │ │ │ -Enable typedef if two types are interoperable. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_A_l_w_a_y_s_F_a_l_s_e │ │ │ │ │ -template which always yields a false value │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:124 │ │ │ │ │ -_D_u_n_e_:_:_A_l_w_a_y_s_T_r_u_e │ │ │ │ │ -template which always yields a true value │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:134 │ │ │ │ │ -_D_u_n_e_:_:_I_s_C_a_l_l_a_b_l_e │ │ │ │ │ -Check if a type is callable with ()-operator and given arguments. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:162 │ │ │ │ │ -_D_u_n_e_:_:_H_a_s_N_a_N │ │ │ │ │ -Whether this type has a value of NaN. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:212 │ │ │ │ │ -_D_u_n_e_:_:_I_s_I_n_d_e_x_a_b_l_e │ │ │ │ │ -Type trait to determine whether an instance of T has an operator[](I), i.e. │ │ │ │ │ -whether it can be indexed... │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:250 │ │ │ │ │ -_D_u_n_e_:_:_I_s_I_t_e_r_a_b_l_e │ │ │ │ │ -typetrait to check that a class has begin() and end() members │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:273 │ │ │ │ │ -_D_u_n_e_:_:_I_s_T_u_p_l_e │ │ │ │ │ -Check if T is a std::tuple<...> │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:329 │ │ │ │ │ -_D_u_n_e_:_:_I_s_T_u_p_l_e_O_r_D_e_r_i_v_e_d │ │ │ │ │ -Check if T derived from a std::tuple<...> │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:357 │ │ │ │ │ -_D_u_n_e_:_:_I_s_I_n_t_e_g_r_a_l_C_o_n_s_t_a_n_t │ │ │ │ │ -Check if T is an std::integral_constant │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:384 │ │ │ │ │ -_D_u_n_e_:_:_S_i_z_e_O_f │ │ │ │ │ -Compute size of variadic type list. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:404 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y │ │ │ │ │ -Get entry of std::integer_sequence. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:476 │ │ │ │ │ -_D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e │ │ │ │ │ -Type free of internal references that T can be converted to. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:501 │ │ │ │ │ -_D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ -T type │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:501 │ │ │ │ │ -_D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_T_y_p_e_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _b_o_o_l_ _>_:_:_r_e_f_e_r_e_n_c_e_ _>_:_:_t_y_p_e │ │ │ │ │ -bool type │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:523 │ │ │ │ │ +_D_u_n_e_:_:_M_i_n │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:18 │ │ │ │ │ +_D_u_n_e_:_:_M_i_n_:_:_r_e_s_u_l_t___t_y_p_e │ │ │ │ │ +Type result_type │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_M_i_n_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +Type operator()(const Type &t1, const Type &t2) const │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_M_i_n_:_:_f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ +Type first_argument_type │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_M_i_n_:_:_s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ +Type second_argument_type │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:21 │ │ │ │ │ +_D_u_n_e_:_:_M_a_x │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_M_a_x_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +Type operator()(const Type &t1, const Type &t2) const │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_M_a_x_:_:_r_e_s_u_l_t___t_y_p_e │ │ │ │ │ +Type result_type │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_M_a_x_:_:_f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ +Type first_argument_type │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_M_a_x_:_:_s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ +Type second_argument_type │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:37 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00122.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: version.hh File Reference │ │ │ │ +dune-common: shared_ptr.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,776 +70,58 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Macros
│ │ │ │ -
version.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
shared_ptr.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Various macros to work with Dune module version numbers. │ │ │ │ +

This file implements several utilities related to std::shared_ptr. │ │ │ │ More...

│ │ │ │ - │ │ │ │ +
#include <memory>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Macros

#define DUNE_VERSION_JOIN(module, type)   module ## _VERSION_ ## type
 Constructs the preprocessor name used in config.h to hold version numbers.
 
#define DUNE_VERSION_EQUAL(module, major, minor)
 True if 'module' has the version major.minor.
 
#define DUNE_VERSION_EQUAL_REV(module, major, minor, revision)
 True if 'module' has the version major.minor.revision.
 
#define DUNE_VERSION_GTE(module, major, minor)
 True if 'module' has the version major.minor or greater.
 
#define DUNE_VERSION_LT(module, major, minor)    ! DUNE_VERSION_GTE(module,major,minor)
 True if 'module' has a version less than major.minor.
 
#define DUNE_VERSION_NEWER(module, major, minor)    DUNE_VERSION_GTE(module,major,minor)
 True if 'module' has the version major.minor or newer.
 
#define DUNE_VERSION_GT(module, major, minor)
 True if 'module' has a version greater than major.minor.
 
#define DUNE_VERSION_LTE(module, major, minor)    ! DUNE_VERSION_GT(module,major,minor)
 True if 'module' has a version less than or equal to major.minor.
 
#define DUNE_VERSION_GTE_REV(module, major, minor, revision)
 True if 'module' has the version major.minor.revision or greater.
 
#define DUNE_VERSION_LT_REV(module, major, minor, revision)    ! DUNE_VERSION_GTE_REV(module,major,minor,revision)
 True if 'module' has a version lower than major.minor.revision.
 
#define DUNE_VERSION_NEWER_REV(module, major, minor, revision)    DUNE_VERSION_GTE_REV(module,major,minor,revision)
 True if 'module' has the version major.minor.revision or newer.
 
#define DUNE_VERSION_GT_REV(module, major, minor, revision)
 True if 'module' has a greater version than major.minor.revision.
 
#define DUNE_VERSION_LTE_REV(module, major, minor, revision)    ! DUNE_VERSION_GT_REV(module,major,minor,revision)
 True if 'module' has a version lower or equal to major.minor.revision.
 
#define DUNE_VERSION_ID(major, minor, revision)    ((unsigned int)((major << 24) + (minor << 16) + revision))
 Compute a unique uint id from the major, minor, and revision numbers.
 
#define DUNE_MODULE_VERSION_ID(module)    DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) )
 Compute a unique uint id for the given module.
 

│ │ │ │ +Classes

struct  Dune::null_deleter< T >
 implements the Deleter concept of shared_ptr without deleting anything More...
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Namespaces

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

│ │ │ │ +Functions

template<typename T >
std::shared_ptr< T > Dune::stackobject_to_shared_ptr (T &t)
 Create a shared_ptr for a stack-allocated object.
 
template<class T >
auto Dune::wrap_or_move (T &&t)
 Capture R-value reference to shared_ptr.
 
template<class T >
auto Dune::wrap_or_move (T &t)
 Capture L-value reference to std::shared_ptr.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Various macros to work with Dune module version numbers.

│ │ │ │ -

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ DUNE_MODULE_VERSION_ID

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_MODULE_VERSION_ID( module)    DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) )
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

Compute a unique uint id for the given module.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_EQUAL

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_EQUAL( module,
 major,
 minor 
)
│ │ │ │ -
│ │ │ │ -Value:
((DUNE_VERSION_JOIN(module,MAJOR) == major) && \
│ │ │ │ -
(DUNE_VERSION_JOIN(module,MINOR) == minor))
│ │ │ │ -
#define DUNE_VERSION_JOIN(module, type)
Constructs the preprocessor name used in config.h to hold version numbers.
Definition version.hh:28
│ │ │ │ -
│ │ │ │ -

True if 'module' has the version major.minor.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_EQUAL_REV

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_EQUAL_REV( module,
 major,
 minor,
 revision 
)
│ │ │ │ -
│ │ │ │ -Value:
( DUNE_VERSION_EQUAL(module,major,minor) && \
│ │ │ │ -
(DUNE_VERSION_JOIN(module,REVISION) == revision))
│ │ │ │ -
#define DUNE_VERSION_EQUAL(module, major, minor)
True if 'module' has the version major.minor.
Definition version.hh:44
│ │ │ │ -
│ │ │ │ -

True if 'module' has the version major.minor.revision.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GT

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_GT( module,
 major,
 minor 
)
│ │ │ │ -
│ │ │ │ -Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)))
│ │ │ │ -
│ │ │ │ -

True if 'module' has a version greater than major.minor.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GT_REV

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_GT_REV( module,
 major,
 minor,
 revision 
)
│ │ │ │ -
│ │ │ │ -Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ -
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ -
&& (DUNE_VERSION_JOIN(module,REVISION) > revision)))
│ │ │ │ -
│ │ │ │ -

True if 'module' has a greater version than major.minor.revision.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GTE

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_GTE( module,
 major,
 minor 
)
│ │ │ │ -
│ │ │ │ -Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) >= minor)))
│ │ │ │ -
│ │ │ │ -

True if 'module' has the version major.minor or greater.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_GTE_REV

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_GTE_REV( module,
 major,
 minor,
 revision 
)
│ │ │ │ -
│ │ │ │ -Value:
((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ -
|| ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ -
&& (DUNE_VERSION_JOIN(module,REVISION) >= revision)))
│ │ │ │ -
│ │ │ │ -

True if 'module' has the version major.minor.revision or greater.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_ID

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_ID( major,
 minor,
 revision 
)    ((unsigned int)((major << 24) + (minor << 16) + revision))
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

Compute a unique uint id from the major, minor, and revision numbers.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_JOIN

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_JOIN( module,
 type 
)   module ## _VERSION_ ## type
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

Constructs the preprocessor name used in config.h to hold version numbers.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

│ │ │ │ -
Parameters
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
moduleThe name of the Dune module
typeThe version number type, one of MAJOR, MINOR, or REVISION
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ DUNE_VERSION_LT

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_LT( module,
 major,
 minor 
)    ! DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

True if 'module' has a version less than major.minor.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_LT_REV

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_LT_REV( module,
 major,
 minor,
 revision 
)    ! DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

True if 'module' has a version lower than major.minor.revision.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_LTE

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_LTE( module,
 major,
 minor 
)    ! DUNE_VERSION_GT(module,major,minor)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

True if 'module' has a version less than or equal to major.minor.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_LTE_REV

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_LTE_REV( module,
 major,
 minor,
 revision 
)    ! DUNE_VERSION_GT_REV(module,major,minor,revision)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

True if 'module' has a version lower or equal to major.minor.revision.

│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_NEWER

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_NEWER( module,
 major,
 minor 
)    DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

True if 'module' has the version major.minor or newer.

│ │ │ │ -
Note
Deprecated, use DUNE_VERSION_GTE instead.
│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

◆ DUNE_VERSION_NEWER_REV

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_VERSION_NEWER_REV( module,
 major,
 minor,
 revision 
)    DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

True if 'module' has the version major.minor.revision or newer.

│ │ │ │ -
Note
Deprecated, use DUNE_VERSION_GTE_REV instead.
│ │ │ │ -

For the DUNE core modules you need to use the following module names:

    │ │ │ │ -
  • DUNE_COMMON for dune-common
  • │ │ │ │ -
  • DUNE_GRID for dune-grid
  • │ │ │ │ -
  • DUNE_GEOMETRY for dune-geometry
  • │ │ │ │ -
  • DUNE_ISTL for dune-istl
  • │ │ │ │ -
  • DUNE_LOCALFUNCTIONS for dune-localfunctions
  • │ │ │ │ -
│ │ │ │ -

For external DUNE modules, you should capitalize the name and replace '-' by underscores. For example for the module foo-bar you need to use FOO_BAR as module name in the context of this macro.

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

This file implements several utilities related to std::shared_ptr.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,349 +1,40 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_M_a_c_r_o_s │ │ │ │ │ -version.hh File Reference │ │ │ │ │ -Various macros to work with Dune module version numbers. _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 │ │ │ │ │ +shared_ptr.hh File Reference │ │ │ │ │ +This file implements several utilities related to std::shared_ptr. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_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_. │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module, type)   module ## _VERSION_ ## type │ │ │ │ │ -  Constructs the preprocessor name used in config.h to hold version │ │ │ │ │ - numbers. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L(module, major, minor) │ │ │ │ │ -  True if 'module' has the version major.minor. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L___R_E_V(module, major, minor, revision) │ │ │ │ │ -  True if 'module' has the version major.minor.revision. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___G_T_E(module, major, minor) │ │ │ │ │ -  True if 'module' has the version major.minor or greater. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___L_T(module, major, minor)    ! _D_U_N_E___V_E_R_S_I_O_N___G_T_E │ │ │ │ │ - (module,major,minor) │ │ │ │ │ -  True if 'module' has a version less than major.minor. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___N_E_W_E_R(module, major, minor)    _D_U_N_E___V_E_R_S_I_O_N___G_T_E │ │ │ │ │ - (module,major,minor) │ │ │ │ │ -  True if 'module' has the version major.minor or newer. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___G_T(module, major, minor) │ │ │ │ │ -  True if 'module' has a version greater than major.minor. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___L_T_E(module, major, minor)    ! _D_U_N_E___V_E_R_S_I_O_N___G_T │ │ │ │ │ - (module,major,minor) │ │ │ │ │ -  True if 'module' has a version less than or equal to major.minor. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V(module, major, minor, revision) │ │ │ │ │ -  True if 'module' has the version major.minor.revision or greater. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___L_T___R_E_V(module, major, minor, revision)    ! │ │ │ │ │ - _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V(module,major,minor,revision) │ │ │ │ │ -  True if 'module' has a version lower than major.minor.revision. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___N_E_W_E_R___R_E_V(module, major, minor, revision)    │ │ │ │ │ - _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V(module,major,minor,revision) │ │ │ │ │ -  True if 'module' has the version major.minor.revision or newer. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___G_T___R_E_V(module, major, minor, revision) │ │ │ │ │ -  True if 'module' has a greater version than major.minor.revision. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___L_T_E___R_E_V(module, major, minor, revision)    ! │ │ │ │ │ - _D_U_N_E___V_E_R_S_I_O_N___G_T___R_E_V(module,major,minor,revision) │ │ │ │ │ -  True if 'module' has a version lower or equal to major.minor.revision. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___V_E_R_S_I_O_N___I_D(major, minor, revision)    ((unsigned int)((major << │ │ │ │ │ - 24) + (minor << 16) + revision)) │ │ │ │ │ -  Compute a unique uint id from the major, minor, and revision numbers. │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___M_O_D_U_L_E___V_E_R_S_I_O_N___I_D(module)    _D_U_N_E___V_E_R_S_I_O_N___I_D( _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ - (module,MAJOR), _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MINOR), _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ - (module,REVISION) ) │ │ │ │ │ -  Compute a unique uint id for the given module. │ │ │ │ │ +CCllaasssseess │ │ │ │ │ +struct   _D_u_n_e_:_:_n_u_l_l___d_e_l_e_t_e_r_<_ _T_ _> │ │ │ │ │ +  implements the Deleter concept of shared_ptr without deleting anything │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::shared_ptr< T >  _D_u_n_e_:_:_s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r (T &t) │ │ │ │ │ +  Create a shared_ptr for a stack-allocated object. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_w_r_a_p___o_r___m_o_v_e (T &&t) │ │ │ │ │ +  Capture R-value reference to shared_ptr. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_w_r_a_p___o_r___m_o_v_e (T &t) │ │ │ │ │ +  Capture L-value reference to std::shared_ptr. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Various macros to work with Dune module version numbers. │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__MMOODDUULLEE__VVEERRSSIIOONN__IIDD ********** │ │ │ │ │ -     _D_U_N_E___V_E_R_S_I_O_N___I_D │ │ │ │ │ - ( _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR), │ │ │ │ │ -#define DUNE_MODULE_VERSION_ID (   module ) _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MINOR), │ │ │ │ │ - _D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) │ │ │ │ │ - ) │ │ │ │ │ -Compute a unique uint id for the given module. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__EEQQUUAALL ********** │ │ │ │ │ -#define DUNE_VERSION_EQUAL (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && \ │ │ │ │ │ -(_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MINOR) == minor)) │ │ │ │ │ -_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ -#define DUNE_VERSION_JOIN(module, type) │ │ │ │ │ -Constructs the preprocessor name used in config.h to hold version numbers. │ │ │ │ │ -DDeeffiinniittiioonn version.hh:28 │ │ │ │ │ -True if 'module' has the version major.minor. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__EEQQUUAALL__RREEVV ********** │ │ │ │ │ -#define DUNE_VERSION_EQUAL_REV (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor, │ │ │ │ │ -   revision  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -( _D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L(module,major,minor) && \ │ │ │ │ │ -(_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) == revision)) │ │ │ │ │ -_D_U_N_E___V_E_R_S_I_O_N___E_Q_U_A_L │ │ │ │ │ -#define DUNE_VERSION_EQUAL(module, major, minor) │ │ │ │ │ -True if 'module' has the version major.minor. │ │ │ │ │ -DDeeffiinniittiioonn version.hh:44 │ │ │ │ │ -True if 'module' has the version major.minor.revision. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTT ********** │ │ │ │ │ -#define DUNE_VERSION_GT (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ -|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ -(module,MINOR) > minor))) │ │ │ │ │ -True if 'module' has a version greater than major.minor. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTT__RREEVV ********** │ │ │ │ │ -#define DUNE_VERSION_GT_REV (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor, │ │ │ │ │ -   revision  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ -|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ -(module,MINOR) > minor)) \ │ │ │ │ │ -|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ -(module,MINOR) == minor) \ │ │ │ │ │ -&& (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) > revision))) │ │ │ │ │ -True if 'module' has a greater version than major.minor.revision. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTTEE ********** │ │ │ │ │ -#define DUNE_VERSION_GTE (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ -|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ -(module,MINOR) >= minor))) │ │ │ │ │ -True if 'module' has the version major.minor or greater. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__GGTTEE__RREEVV ********** │ │ │ │ │ -#define DUNE_VERSION_GTE_REV (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor, │ │ │ │ │ -   revision  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) > major) \ │ │ │ │ │ -|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ -(module,MINOR) > minor)) \ │ │ │ │ │ -|| ((_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,MAJOR) == major) && (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N │ │ │ │ │ -(module,MINOR) == minor) \ │ │ │ │ │ -&& (_D_U_N_E___V_E_R_S_I_O_N___J_O_I_N(module,REVISION) >= revision))) │ │ │ │ │ -True if 'module' has the version major.minor.revision or greater. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__IIDD ********** │ │ │ │ │ -#define DUNE_VERSION_ID (   major, │ │ │ │ │ -   minor, │ │ │ │ │ -   revision  │ │ │ │ │ - )     ((unsigned int)((major << 24) + (minor << 16) + │ │ │ │ │ - revision)) │ │ │ │ │ -Compute a unique uint id from the major, minor, and revision numbers. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__JJOOIINN ********** │ │ │ │ │ -#define DUNE_VERSION_JOIN (   module, │ │ │ │ │ -   type  │ │ │ │ │ - )    module ## _VERSION_ ## type │ │ │ │ │ -Constructs the preprocessor name used in config.h to hold version numbers. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ - Parameters │ │ │ │ │ - module The name of the _D_u_n_e module │ │ │ │ │ - type The version number type, one of MAJOR, MINOR, or REVISION │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTT ********** │ │ │ │ │ -#define DUNE_VERSION_LT (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor  │ │ │ │ │ - )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T_E(module,major,minor) │ │ │ │ │ -True if 'module' has a version less than major.minor. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTT__RREEVV ********** │ │ │ │ │ -#define DUNE_VERSION_LT_REV (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor, │ │ │ │ │ -   revision  │ │ │ │ │ - )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V │ │ │ │ │ - (module,major,minor,revision) │ │ │ │ │ -True if 'module' has a version lower than major.minor.revision. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTTEE ********** │ │ │ │ │ -#define DUNE_VERSION_LTE (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor  │ │ │ │ │ - )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T(module,major,minor) │ │ │ │ │ -True if 'module' has a version less than or equal to major.minor. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__LLTTEE__RREEVV ********** │ │ │ │ │ -#define DUNE_VERSION_LTE_REV (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor, │ │ │ │ │ -   revision  │ │ │ │ │ - )     ! _D_U_N_E___V_E_R_S_I_O_N___G_T___R_E_V │ │ │ │ │ - (module,major,minor,revision) │ │ │ │ │ -True if 'module' has a version lower or equal to major.minor.revision. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__NNEEWWEERR ********** │ │ │ │ │ -#define DUNE_VERSION_NEWER (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor  │ │ │ │ │ - )     _D_U_N_E___V_E_R_S_I_O_N___G_T_E(module,major,minor) │ │ │ │ │ -True if 'module' has the version major.minor or newer. │ │ │ │ │ - Note │ │ │ │ │ - Deprecated, use DUNE_VERSION_GTE instead. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ -********** _?◆_? DDUUNNEE__VVEERRSSIIOONN__NNEEWWEERR__RREEVV ********** │ │ │ │ │ -#define DUNE_VERSION_NEWER_REV (   module, │ │ │ │ │ -   major, │ │ │ │ │ -   minor, │ │ │ │ │ -   revision  │ │ │ │ │ - )     _D_U_N_E___V_E_R_S_I_O_N___G_T_E___R_E_V │ │ │ │ │ - (module,major,minor,revision) │ │ │ │ │ -True if 'module' has the version major.minor.revision or newer. │ │ │ │ │ - Note │ │ │ │ │ - Deprecated, use DUNE_VERSION_GTE_REV instead. │ │ │ │ │ -For the DUNE core modules you need to use the following module names: │ │ │ │ │ - * DUNE_COMMON for dune-common │ │ │ │ │ - * DUNE_GRID for dune-grid │ │ │ │ │ - * DUNE_GEOMETRY for dune-geometry │ │ │ │ │ - * DUNE_ISTL for dune-istl │ │ │ │ │ - * DUNE_LOCALFUNCTIONS for dune-localfunctions │ │ │ │ │ -For external DUNE modules, you should capitalize the name and replace '-' by │ │ │ │ │ -underscores. For example for the module foo-bar you need to use FOO_BAR as │ │ │ │ │ -module name in the context of this macro. │ │ │ │ │ +This file implements several utilities related to std::shared_ptr. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: version.hh Source File │ │ │ │ +dune-common: shared_ptr.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,107 +74,72 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
version.hh
│ │ │ │ +
shared_ptr.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5#ifndef DUNE_VERSION_HH
│ │ │ │ -
6#define DUNE_VERSION_HH
│ │ │ │ -
7
│ │ │ │ -
28#define DUNE_VERSION_JOIN(module,type) module ## _VERSION_ ## type
│ │ │ │ -
29
│ │ │ │ -
│ │ │ │ -
44#define DUNE_VERSION_EQUAL(module,major,minor) \
│ │ │ │ -
45 ((DUNE_VERSION_JOIN(module,MAJOR) == major) && \
│ │ │ │ -
46 (DUNE_VERSION_JOIN(module,MINOR) == minor))
│ │ │ │ -
│ │ │ │ -
47
│ │ │ │ -
│ │ │ │ -
62#define DUNE_VERSION_EQUAL_REV(module,major,minor,revision) \
│ │ │ │ -
63 ( DUNE_VERSION_EQUAL(module,major,minor) && \
│ │ │ │ -
64 (DUNE_VERSION_JOIN(module,REVISION) == revision))
│ │ │ │ -
│ │ │ │ -
65
│ │ │ │ -
│ │ │ │ -
80#define DUNE_VERSION_GTE(module,major,minor) \
│ │ │ │ -
81 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
82 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) >= minor)))
│ │ │ │ -
│ │ │ │ -
83
│ │ │ │ -
│ │ │ │ -
98#define DUNE_VERSION_LT(module,major,minor) \
│ │ │ │ -
99 ! DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_SHARED_PTR_HH
│ │ │ │ +
7#define DUNE_SHARED_PTR_HH
│ │ │ │ +
8
│ │ │ │ +
9#include <memory>
│ │ │ │ +
10
│ │ │ │ + │ │ │ │ +
17namespace Dune
│ │ │ │ +
18{
│ │ │ │ +
47 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
49 {
│ │ │ │ +
50 void operator() (T*) const {}
│ │ │ │ +
51 };
│ │ │ │ +
│ │ │ │ +
52
│ │ │ │ +
71 template<typename T>
│ │ │ │ +
│ │ │ │ +
72 inline std::shared_ptr<T> stackobject_to_shared_ptr(T & t)
│ │ │ │ +
73 {
│ │ │ │ +
74 return std::shared_ptr<T>(&t, null_deleter<T>());
│ │ │ │ +
75 }
│ │ │ │ +
│ │ │ │ +
76
│ │ │ │ +
77
│ │ │ │ +
95 template<class T>
│ │ │ │ +
│ │ │ │ +
96 auto wrap_or_move(T&& t)
│ │ │ │ +
97 {
│ │ │ │ +
98 return std::make_shared<std::decay_t<T>>(std::forward<T>(t));
│ │ │ │ +
99 }
│ │ │ │
│ │ │ │
100
│ │ │ │ -
│ │ │ │ -
116#define DUNE_VERSION_NEWER(module,major,minor) \
│ │ │ │ -
117 DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ -
│ │ │ │ -
118
│ │ │ │ -
│ │ │ │ -
133#define DUNE_VERSION_GT(module,major,minor) \
│ │ │ │ -
134 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
135 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)))
│ │ │ │ -
│ │ │ │ -
136
│ │ │ │ -
│ │ │ │ -
151#define DUNE_VERSION_LTE(module,major,minor) \
│ │ │ │ -
152 ! DUNE_VERSION_GT(module,major,minor)
│ │ │ │ -
│ │ │ │ -
153
│ │ │ │ -
│ │ │ │ -
168#define DUNE_VERSION_GTE_REV(module,major,minor,revision) \
│ │ │ │ -
169 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
170 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ -
171 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ -
172 && (DUNE_VERSION_JOIN(module,REVISION) >= revision)))
│ │ │ │ -
│ │ │ │ -
173
│ │ │ │ -
│ │ │ │ -
188#define DUNE_VERSION_LT_REV(module,major,minor,revision) \
│ │ │ │ -
189 ! DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ -
│ │ │ │ -
190
│ │ │ │ -
│ │ │ │ -
206#define DUNE_VERSION_NEWER_REV(module,major,minor,revision) \
│ │ │ │ -
207 DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ -
│ │ │ │ -
208
│ │ │ │ -
│ │ │ │ -
223#define DUNE_VERSION_GT_REV(module,major,minor,revision) \
│ │ │ │ -
224 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ -
225 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ -
226 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ -
227 && (DUNE_VERSION_JOIN(module,REVISION) > revision)))
│ │ │ │ -
│ │ │ │ -
228
│ │ │ │ -
│ │ │ │ -
243#define DUNE_VERSION_LTE_REV(module,major,minor,revision) \
│ │ │ │ -
244 ! DUNE_VERSION_GT_REV(module,major,minor,revision)
│ │ │ │ -
│ │ │ │ -
245
│ │ │ │ -
│ │ │ │ -
260#define DUNE_VERSION_ID(major,minor,revision) \
│ │ │ │ -
261 ((unsigned int)((major << 24) + (minor << 16) + revision))
│ │ │ │ -
│ │ │ │ -
262
│ │ │ │ -
│ │ │ │ -
277#define DUNE_MODULE_VERSION_ID(module) \
│ │ │ │ -
278 DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) )
│ │ │ │ -
│ │ │ │ -
279
│ │ │ │ -
280#endif
│ │ │ │ +
118 template<class T>
│ │ │ │ +
│ │ │ │ +
119 auto wrap_or_move(T& t)
│ │ │ │ +
120 {
│ │ │ │ + │ │ │ │ +
122 }
│ │ │ │ +
│ │ │ │ +
123
│ │ │ │ +
124}
│ │ │ │ +
125#endif
│ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition shared_ptr.hh:72
│ │ │ │ +
auto wrap_or_move(T &&t)
Capture R-value reference to shared_ptr.
Definition shared_ptr.hh:96
│ │ │ │ +
implements the Deleter concept of shared_ptr without deleting anything
Definition shared_ptr.hh:49
│ │ │ │ +
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition shared_ptr.hh:72
│ │ │ │ +
void operator()(T *) const
Definition shared_ptr.hh:50
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,80 +1,74 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -version.hh │ │ │ │ │ +shared_ptr.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_VERSION_HH │ │ │ │ │ -6#define DUNE_VERSION_HH │ │ │ │ │ -7 │ │ │ │ │ -_2_8#define DUNE_VERSION_JOIN(module,type) module ## _VERSION_ ## type │ │ │ │ │ -29 │ │ │ │ │ -_4_4#define DUNE_VERSION_EQUAL(module,major,minor) \ │ │ │ │ │ -45 ((DUNE_VERSION_JOIN(module,MAJOR) == major) && \ │ │ │ │ │ -46 (DUNE_VERSION_JOIN(module,MINOR) == minor)) │ │ │ │ │ -47 │ │ │ │ │ -_6_2#define DUNE_VERSION_EQUAL_REV(module,major,minor,revision) \ │ │ │ │ │ -63 ( DUNE_VERSION_EQUAL(module,major,minor) && \ │ │ │ │ │ -64 (DUNE_VERSION_JOIN(module,REVISION) == revision)) │ │ │ │ │ -65 │ │ │ │ │ -_8_0#define DUNE_VERSION_GTE(module,major,minor) \ │ │ │ │ │ -81 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ -82 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ -(module,MINOR) >= minor))) │ │ │ │ │ -83 │ │ │ │ │ -_9_8#define DUNE_VERSION_LT(module,major,minor) \ │ │ │ │ │ -99 ! DUNE_VERSION_GTE(module,major,minor) │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_SHARED_PTR_HH │ │ │ │ │ +7#define DUNE_SHARED_PTR_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +17namespace _D_u_n_e │ │ │ │ │ +18{ │ │ │ │ │ +47 template │ │ │ │ │ +_4_8 struct _n_u_l_l___d_e_l_e_t_e_r │ │ │ │ │ +49 { │ │ │ │ │ +_5_0 void _o_p_e_r_a_t_o_r_(_)_ (T*) const {} │ │ │ │ │ +51 }; │ │ │ │ │ +52 │ │ │ │ │ +71 template │ │ │ │ │ +_7_2 inline std::shared_ptr _s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r(T & t) │ │ │ │ │ +73 { │ │ │ │ │ +74 return std::shared_ptr(&t, _n_u_l_l___d_e_l_e_t_e_r_<_T_>()); │ │ │ │ │ +75 } │ │ │ │ │ +76 │ │ │ │ │ +77 │ │ │ │ │ +95 template │ │ │ │ │ +_9_6 auto _w_r_a_p___o_r___m_o_v_e(T&& t) │ │ │ │ │ +97 { │ │ │ │ │ +98 return std::make_shared>(std::forward(t)); │ │ │ │ │ +99 } │ │ │ │ │ 100 │ │ │ │ │ -_1_1_6#define DUNE_VERSION_NEWER(module,major,minor) \ │ │ │ │ │ -117 DUNE_VERSION_GTE(module,major,minor) │ │ │ │ │ -118 │ │ │ │ │ -_1_3_3#define DUNE_VERSION_GT(module,major,minor) \ │ │ │ │ │ -134 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ -135 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ -(module,MINOR) > minor))) │ │ │ │ │ -136 │ │ │ │ │ -_1_5_1#define DUNE_VERSION_LTE(module,major,minor) \ │ │ │ │ │ -152 ! DUNE_VERSION_GT(module,major,minor) │ │ │ │ │ -153 │ │ │ │ │ -_1_6_8#define DUNE_VERSION_GTE_REV(module,major,minor,revision) \ │ │ │ │ │ -169 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ -170 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ -(module,MINOR) > minor)) \ │ │ │ │ │ -171 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ -(module,MINOR) == minor) \ │ │ │ │ │ -172 && (DUNE_VERSION_JOIN(module,REVISION) >= revision))) │ │ │ │ │ -173 │ │ │ │ │ -_1_8_8#define DUNE_VERSION_LT_REV(module,major,minor,revision) \ │ │ │ │ │ -189 ! DUNE_VERSION_GTE_REV(module,major,minor,revision) │ │ │ │ │ -190 │ │ │ │ │ -_2_0_6#define DUNE_VERSION_NEWER_REV(module,major,minor,revision) \ │ │ │ │ │ -207 DUNE_VERSION_GTE_REV(module,major,minor,revision) │ │ │ │ │ -208 │ │ │ │ │ -_2_2_3#define DUNE_VERSION_GT_REV(module,major,minor,revision) \ │ │ │ │ │ -224 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ -225 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ -(module,MINOR) > minor)) \ │ │ │ │ │ -226 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ -(module,MINOR) == minor) \ │ │ │ │ │ -227 && (DUNE_VERSION_JOIN(module,REVISION) > revision))) │ │ │ │ │ -228 │ │ │ │ │ -_2_4_3#define DUNE_VERSION_LTE_REV(module,major,minor,revision) \ │ │ │ │ │ -244 ! DUNE_VERSION_GT_REV(module,major,minor,revision) │ │ │ │ │ -245 │ │ │ │ │ -_2_6_0#define DUNE_VERSION_ID(major,minor,revision) \ │ │ │ │ │ -261 ((unsigned int)((major << 24) + (minor << 16) + revision)) │ │ │ │ │ -262 │ │ │ │ │ -_2_7_7#define DUNE_MODULE_VERSION_ID(module) \ │ │ │ │ │ -278 DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN │ │ │ │ │ -(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) ) │ │ │ │ │ -279 │ │ │ │ │ -280#endif │ │ │ │ │ +118 template │ │ │ │ │ +_1_1_9 auto _w_r_a_p___o_r___m_o_v_e(T& t) │ │ │ │ │ +120 { │ │ │ │ │ +121 return _s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r(t); │ │ │ │ │ +122 } │ │ │ │ │ +123 │ │ │ │ │ +124} │ │ │ │ │ +125#endif │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r │ │ │ │ │ +std::shared_ptr< T > stackobject_to_shared_ptr(T &t) │ │ │ │ │ +Create a shared_ptr for a stack-allocated object. │ │ │ │ │ +DDeeffiinniittiioonn shared_ptr.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_w_r_a_p___o_r___m_o_v_e │ │ │ │ │ +auto wrap_or_move(T &&t) │ │ │ │ │ +Capture R-value reference to shared_ptr. │ │ │ │ │ +DDeeffiinniittiioonn shared_ptr.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_n_u_l_l___d_e_l_e_t_e_r │ │ │ │ │ +implements the Deleter concept of shared_ptr without deleting anything │ │ │ │ │ +DDeeffiinniittiioonn shared_ptr.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_n_u_l_l___d_e_l_e_t_e_r_:_:_s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r │ │ │ │ │ +std::shared_ptr< T > stackobject_to_shared_ptr(T &t) │ │ │ │ │ +Create a shared_ptr for a stack-allocated object. │ │ │ │ │ +DDeeffiinniittiioonn shared_ptr.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_n_u_l_l___d_e_l_e_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(T *) const │ │ │ │ │ +DDeeffiinniittiioonn shared_ptr.hh:50 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00125.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: float_cmp.hh File Reference │ │ │ │ +dune-common: fmatrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,99 +72,104 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Enumerations | │ │ │ │ Functions
│ │ │ │ -
float_cmp.hh File Reference
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Various ways to compare floating-point numbers. │ │ │ │ +

Implements a matrix constructed from a given type representing a field and compile-time given number of rows and columns. │ │ │ │ More...

│ │ │ │ -
#include "float_cmp.cc"
│ │ │ │ +
#include <cmath>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <initializer_list>
│ │ │ │ +#include <dune/common/boundschecking.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/densematrix.hh>
│ │ │ │ +#include <dune/common/precision.hh>
│ │ │ │ +#include <dune/common/promotiontraits.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/matrixconcepts.hh>
│ │ │ │ +#include "fmatrixev.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::FloatCmp::DefaultEpsilon< T, style >
 mapping from a value type and a compare style to a default epsilon More...
struct  Dune::DenseMatVecTraits< FieldMatrix< K, ROWS, COLS > >
 
class  Dune::FloatCmpOps< T, cstyle_, rstyle_ >
 Class encapsulating a default epsilon. More...
struct  Dune::FieldTraits< FieldMatrix< K, ROWS, COLS > >
 
class  Dune::FieldMatrix< K, ROWS, COLS >
 A dense n x m matrix. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::FloatCmp
namespace  Dune::FMatrixHelp
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Enumerations

enum  Dune::FloatCmp::CmpStyle { Dune::FloatCmp::relativeWeak │ │ │ │ -, Dune::FloatCmp::relativeStrong │ │ │ │ -, Dune::FloatCmp::absolute │ │ │ │ -, Dune::FloatCmp::defaultCmpStyle = relativeWeak │ │ │ │ - }
 
enum  Dune::FloatCmp::RoundingStyle {
│ │ │ │ -  Dune::FloatCmp::towardZero │ │ │ │ -, Dune::FloatCmp::towardInf │ │ │ │ -, Dune::FloatCmp::downward │ │ │ │ -, Dune::FloatCmp::upward │ │ │ │ -,
│ │ │ │ -  Dune::FloatCmp::defaultRoundingStyle = towardZero │ │ │ │ -
│ │ │ │ - }
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<class T , CmpStyle style>
bool Dune::FloatCmp::eq (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
 test for equality using epsilon
 
template<class T , CmpStyle style>
bool Dune::FloatCmp::ne (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
 test for inequality using epsilon
 
template<class T , CmpStyle style>
bool Dune::FloatCmp::gt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
 test if first greater than second
 
template<class T , CmpStyle style>
bool Dune::FloatCmp::lt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
 test if first lesser than second
 
template<class T , CmpStyle style>
bool Dune::FloatCmp::ge (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
 test if first greater or equal second
 
template<class T , CmpStyle style>
bool Dune::FloatCmp::le (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
 test if first lesser or equal second
 
template<class I , class T , CmpStyle cstyle, RoundingStyle rstyle>
Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
 round using epsilon
 
template<class I , class T , CmpStyle cstyle, RoundingStyle rstyle>
Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
 truncate using epsilon
 
template<typename K >
static K Dune::FMatrixHelp::invertMatrix (const FieldMatrix< K, 1, 1 > &matrix, FieldMatrix< K, 1, 1 > &inverse)
 invert scalar without changing the original matrix
 
template<typename K >
static K Dune::FMatrixHelp::invertMatrix_retTransposed (const FieldMatrix< K, 1, 1 > &matrix, FieldMatrix< K, 1, 1 > &inverse)
 invert scalar without changing the original matrix
 
template<typename K >
static K Dune::FMatrixHelp::invertMatrix (const FieldMatrix< K, 2, 2 > &matrix, FieldMatrix< K, 2, 2 > &inverse)
 invert 2x2 Matrix without changing the original matrix
 
template<typename K >
static K Dune::FMatrixHelp::invertMatrix_retTransposed (const FieldMatrix< K, 2, 2 > &matrix, FieldMatrix< K, 2, 2 > &inverse)
 
template<typename K >
static K Dune::FMatrixHelp::invertMatrix (const FieldMatrix< K, 3, 3 > &matrix, FieldMatrix< K, 3, 3 > &inverse)
 invert 3x3 Matrix without changing the original matrix
 
template<typename K >
static K Dune::FMatrixHelp::invertMatrix_retTransposed (const FieldMatrix< K, 3, 3 > &matrix, FieldMatrix< K, 3, 3 > &inverse)
 invert 3x3 Matrix without changing the original matrix
 
template<class K , int m, int n, int p>
static void Dune::FMatrixHelp::multMatrix (const FieldMatrix< K, m, n > &A, const FieldMatrix< K, n, p > &B, FieldMatrix< K, m, p > &ret)
 calculates ret = A * B
 
template<typename K , int rows, int cols>
static void Dune::FMatrixHelp::multTransposedMatrix (const FieldMatrix< K, rows, cols > &matrix, FieldMatrix< K, cols, cols > &ret)
 calculates ret= A_t*A
 
template<typename K , int rows, int cols>
static void Dune::FMatrixHelp::multAssignTransposed (const FieldMatrix< K, rows, cols > &matrix, const FieldVector< K, rows > &x, FieldVector< K, cols > &ret)
 calculates ret = matrix^T * x
 
template<typename K , int rows, int cols>
static FieldVector< K, rows > Dune::FMatrixHelp::mult (const FieldMatrix< K, rows, cols > &matrix, const FieldVector< K, cols > &x)
 calculates ret = matrix * x
 
template<typename K , int rows, int cols>
static FieldVector< K, cols > Dune::FMatrixHelp::multTransposed (const FieldMatrix< K, rows, cols > &matrix, const FieldVector< K, rows > &x)
 calculates ret = matrix^T * x
 
│ │ │ │

Detailed Description

│ │ │ │ -

Various ways to compare floating-point numbers.

│ │ │ │ +

Implements a matrix constructed from a given type representing a field and compile-time given number of rows and columns.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,81 +1,117 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -float_cmp.hh File Reference │ │ │ │ │ -Various ways to compare floating-point numbers. _M_o_r_e_._._. │ │ │ │ │ -#include "_f_l_o_a_t___c_m_p_._c_c" │ │ │ │ │ +_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 │ │ │ │ │ +fmatrix.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ +Implements a matrix constructed from a given type representing a field and │ │ │ │ │ +compile-time given number of rows and columns. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_e_c_i_s_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_r_i_x_c_o_n_c_e_p_t_s_._h_h> │ │ │ │ │ +#include "_f_m_a_t_r_i_x_e_v_._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_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_ _T_,_ _s_t_y_l_e_ _> │ │ │ │ │ -  mapping from a value type and a compare style to a default epsilon │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_<_ _T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___ _> │ │ │ │ │ -  Class encapsulating a default epsilon. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _> │ │ │ │ │ +  A dense n x m matrix. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_F_l_o_a_t_C_m_p │ │ │ │ │ -  │ │ │ │ │ -EEnnuummeerraattiioonnss │ │ │ │ │ -enum   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_C_m_p_S_t_y_l_e { _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_e_l_a_t_i_v_e_W_e_a_k , _D_u_n_e_:_: │ │ │ │ │ - _F_l_o_a_t_C_m_p_:_:_r_e_l_a_t_i_v_e_S_t_r_o_n_g , _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_a_b_s_o_l_u_t_e , _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_: │ │ │ │ │ - _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e = relativeWeak } │ │ │ │ │ -  │ │ │ │ │ -enum   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_R_o_u_n_d_i_n_g_S_t_y_l_e { │ │ │ │ │ -   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_o_w_a_r_d_Z_e_r_o , _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_o_w_a_r_d_I_n_f , _D_u_n_e_:_: │ │ │ │ │ - _F_l_o_a_t_C_m_p_:_:_d_o_w_n_w_a_r_d , _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_u_p_w_a_r_d , │ │ │ │ │ -   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_d_e_f_a_u_l_t_R_o_u_n_d_i_n_g_S_t_y_l_e = towardZero │ │ │ │ │ - } │ │ │ │ │ +namespace   _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_e_q (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test for equality using epsilon │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_n_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test for inequality using epsilon │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_t (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first greater than second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_t (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first lesser than second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first greater or equal second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first lesser or equal second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_o_u_n_d (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, cstyle >::value()) │ │ │ │ │ -  round using epsilon │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_r_u_n_c (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, cstyle >::value()) │ │ │ │ │ -  truncate using epsilon │ │ │ │ │ +template │ │ │ │ │ + static K  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x (const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, 1, 1 > &matrix, _F_i_e_l_d_M_a_t_r_i_x< K, │ │ │ │ │ + 1, 1 > &inverse) │ │ │ │ │ +  invert scalar without changing the original │ │ │ │ │ + matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static K  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x___r_e_t_T_r_a_n_s_p_o_s_e_d │ │ │ │ │ + (const _F_i_e_l_d_M_a_t_r_i_x< K, 1, 1 > &matrix, │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, 1, 1 > &inverse) │ │ │ │ │ +  invert scalar without changing the original │ │ │ │ │ + matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static K  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x (const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, 2, 2 > &matrix, _F_i_e_l_d_M_a_t_r_i_x< K, │ │ │ │ │ + 2, 2 > &inverse) │ │ │ │ │ +  invert 2x2 Matrix without changing the original │ │ │ │ │ + matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static K  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x___r_e_t_T_r_a_n_s_p_o_s_e_d │ │ │ │ │ + (const _F_i_e_l_d_M_a_t_r_i_x< K, 2, 2 > &matrix, │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, 2, 2 > &inverse) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static K  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x (const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, 3, 3 > &matrix, _F_i_e_l_d_M_a_t_r_i_x< K, │ │ │ │ │ + 3, 3 > &inverse) │ │ │ │ │ +  invert 3x3 Matrix without changing the original │ │ │ │ │ + matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static K  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x___r_e_t_T_r_a_n_s_p_o_s_e_d │ │ │ │ │ + (const _F_i_e_l_d_M_a_t_r_i_x< K, 3, 3 > &matrix, │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, 3, 3 > &inverse) │ │ │ │ │ +  invert 3x3 Matrix without changing the original │ │ │ │ │ + matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static void  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_M_a_t_r_i_x (const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &A, const _F_i_e_l_d_M_a_t_r_i_x< K, │ │ │ │ │ + n, p > &B, _F_i_e_l_d_M_a_t_r_i_x< K, m, p > &ret) │ │ │ │ │ +  calculates ret = A * B │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static void  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_T_r_a_n_s_p_o_s_e_d_M_a_t_r_i_x (const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, rows, cols > &matrix, │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, cols, cols > &ret) │ │ │ │ │ +  calculates ret= A_t*A │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static void  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_A_s_s_i_g_n_T_r_a_n_s_p_o_s_e_d (const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, rows, cols > &matrix, const │ │ │ │ │ + _F_i_e_l_d_V_e_c_t_o_r< K, rows > &x, _F_i_e_l_d_V_e_c_t_o_r< K, cols │ │ │ │ │ + > &ret) │ │ │ │ │ +  calculates ret = matrix^T * x │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static _F_i_e_l_d_V_e_c_t_o_r< K, rows >  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t (const _F_i_e_l_d_M_a_t_r_i_x< K, │ │ │ │ │ + rows, cols > &matrix, const _F_i_e_l_d_V_e_c_t_o_r< K, cols │ │ │ │ │ + > &x) │ │ │ │ │ +  calculates ret = matrix * x │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static _F_i_e_l_d_V_e_c_t_o_r< K, cols >  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_T_r_a_n_s_p_o_s_e_d (const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, rows, cols > &matrix, const │ │ │ │ │ + _F_i_e_l_d_V_e_c_t_o_r< K, rows > &x) │ │ │ │ │ +  calculates ret = matrix^T * x │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Various ways to compare floating-point numbers. │ │ │ │ │ +Implements a matrix constructed from a given type representing a field and │ │ │ │ │ +compile-time given number of rows and columns. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00125_source.html │ │ │ │ @@ -22,3013 +22,10431 @@ │ │ │ │ 00000150: 656e 743d 2244 6f78 7967 656e 2031 2e39 ent="Doxygen 1.9 │ │ │ │ 00000160: 2e38 222f 3e0a 3c6d 6574 6120 6e61 6d65 .8"/>..dune-common: │ │ │ │ -000001c0: 666c 6f61 745f 636d 702e 6868 2053 6f75 float_cmp.hh Sou │ │ │ │ -000001d0: 7263 6520 4669 6c65 3c2f 7469 746c 653e rce File │ │ │ │ -000001e0: 0a3c 6c69 6e6b 2068 7265 663d 2274 6162 ... │ │ │ │ -00000290: 0a3c 6c69 6e6b 2068 7265 663d 2273 6561 .....< │ │ │ │ -00000670: 7363 7269 7074 2074 7970 653d 2274 6578 script type="tex │ │ │ │ -00000680: 742f 6a61 7661 7363 7269 7074 223e 0a2f t/javascript">./ │ │ │ │ -00000690: 2a20 406c 6963 656e 7365 206d 6167 6e65 * @license magne │ │ │ │ -000006a0: 743a 3f78 743d 7572 6e3a 6274 6968 3a64 t:?xt=urn:btih:d │ │ │ │ -000006b0: 3364 3961 3961 3635 3935 3532 3166 3936 3d9a9a6595521f96 │ │ │ │ -000006c0: 3636 6135 6539 3463 6338 3330 6461 6238 66a5e94cc830dab8 │ │ │ │ -000006d0: 3362 3635 3639 3926 616d 703b 646e 3d65 3b65699&dn=e │ │ │ │ -000006e0: 7870 6174 2e74 7874 204d 4954 202a 2f0a xpat.txt MIT */. │ │ │ │ -000006f0: 2428 6675 6e63 7469 6f6e 2829 207b 0a20 $(function() {. │ │ │ │ -00000700: 2069 6e69 744d 656e 7528 2727 2c74 7275 initMenu('',tru │ │ │ │ -00000710: 652c 6661 6c73 652c 2773 6561 7263 682e e,false,'search. │ │ │ │ -00000720: 7068 7027 2c27 5365 6172 6368 2729 3b0a php','Search');. │ │ │ │ -00000730: 2020 2428 646f 6375 6d65 6e74 292e 7265 $(document).re │ │ │ │ -00000740: 6164 7928 6675 6e63 7469 6f6e 2829 207b ady(function() { │ │ │ │ -00000750: 2069 6e69 745f 7365 6172 6368 2829 3b20 init_search(); │ │ │ │ -00000760: 7d29 3b0a 7d29 3b0a 2f2a 2040 6c69 6365 });.});./* @lice │ │ │ │ -00000770: 6e73 652d 656e 6420 2a2f 0a3c 2f73 6372 nse-end */..
.< │ │ │ │ -000007a0: 7363 7269 7074 2074 7970 653d 2274 6578 script type="tex │ │ │ │ -000007b0: 742f 6a61 7661 7363 7269 7074 223e 0a2f t/javascript">./ │ │ │ │ -000007c0: 2a20 406c 6963 656e 7365 206d 6167 6e65 * @license magne │ │ │ │ -000007d0: 743a 3f78 743d 7572 6e3a 6274 6968 3a64 t:?xt=urn:btih:d │ │ │ │ -000007e0: 3364 3961 3961 3635 3935 3532 3166 3936 3d9a9a6595521f96 │ │ │ │ -000007f0: 3636 6135 6539 3463 6338 3330 6461 6238 66a5e94cc830dab8 │ │ │ │ -00000800: 3362 3635 3639 3926 616d 703b 646e 3d65 3b65699&dn=e │ │ │ │ -00000810: 7870 6174 2e74 7874 204d 4954 202a 2f0a xpat.txt MIT */. │ │ │ │ -00000820: 2428 646f 6375 6d65 6e74 292e 7265 6164 $(document).read │ │ │ │ -00000830: 7928 6675 6e63 7469 6f6e 2829 207b 2069 y(function() { i │ │ │ │ -00000840: 6e69 745f 636f 6465 666f 6c64 2830 293b nit_codefold(0); │ │ │ │ -00000850: 207d 293b 0a2f 2a20 406c 6963 656e 7365 });./* @license │ │ │ │ -00000860: 2d65 6e64 202a 2f0a 3c2f 7363 7269 7074 -end */....
.. │ │ │ │ -00000970: 3c21 2d2d 2069 6672 616d 6520 7368 6f77 .< │ │ │ │ -000009b0: 6469 7620 6964 3d22 4d53 6561 7263 6852 div id="MSearchR │ │ │ │ -000009c0: 6573 756c 7473 5769 6e64 6f77 223e 0a3c esultsWindow">.< │ │ │ │ -000009d0: 6469 7620 6964 3d22 4d53 6561 7263 6852 div id="MSearchR │ │ │ │ -000009e0: 6573 756c 7473 223e 0a3c 6469 7620 636c esults">.
. │ │ │ │ -00000a10: 0a3c 6469 7620 6964 3d22 5352 5265 7375 .
.
L │ │ │ │ -00000a50: 6f61 6469 6e67 2e2e 2e3c 2f64 6976 3e0a oading...
. │ │ │ │ -00000a60: 3c64 6976 2063 6c61 7373 3d22 5352 5374 .
No │ │ │ │ -00000ac0: 4d61 7463 6865 733c 2f64 6976 3e0a 3c2f Matches
..
..
....
. │ │ │ │ -00000c10: 203c 6469 7620 636c 6173 733d 2268 6561
flo │ │ │ │ -00000c40: 6174 5f63 6d70 2e68 683c 2f64 6976 3e3c at_cmp.hh
< │ │ │ │ -00000c50: 2f64 6976 3e0a 3c2f 6469 763e 3c21 2d2d /div>.
.
│ │ │ │ -00000c80: 0a3c 6120 6872 6566 3d22 6130 3031 3235 .Go to the │ │ │ │ -00000ca0: 2064 6f63 756d 656e 7461 7469 6f6e 206f documentation o │ │ │ │ -00000cb0: 6620 7468 6973 2066 696c 652e 3c2f 613e f this file. │ │ │ │ -00000cc0: 3c64 6976 2063 6c61 7373 3d22 6672 6167
│ │ │ │ -00000d20: 2020 313c 2f73 7061 6e3e 3c73 7061 6e20 1 │ │ │ │ -00000d40: 2f2f 202d 2a2d 2074 6162 2d77 6964 7468 // -*- tab-width │ │ │ │ -00000d50: 3a20 343b 2069 6e64 656e 742d 7461 6273 : 4; indent-tabs │ │ │ │ -00000d60: 2d6d 6f64 653a 206e 696c 3b20 632d 6261 -mode: nil; c-ba │ │ │ │ -00000d70: 7369 632d 6f66 6673 6574 3a20 3220 2d2a sic-offset: 2 -* │ │ │ │ -00000d80: 2d3c 2f73 7061 6e3e 3c2f 6469 763e 0a3c -
.< │ │ │ │ -00000d90: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00000da0: 3e3c 6120 6964 3d22 6c30 3030 3032 2220 > 2// vi: │ │ │ │ -00000e00: 7365 7420 6574 2074 733d 3420 7377 3d32 set et ts=4 sw=2 │ │ │ │ -00000e10: 2073 7473 3d32 3a3c 2f73 7061 6e3e 3c2f sts=2:.
│ │ │ │ -00000e70: 2033 3c2f 7370 616e 3e3c 7370 616e 2063 3/ │ │ │ │ -00000e90: 2f20 5350 4458 2d46 696c 6543 6f70 7972 / SPDX-FileCopyr │ │ │ │ -00000ea0: 6967 6874 496e 666f 3a20 436f 7079 7269 ightInfo: Copyri │ │ │ │ -00000eb0: 6768 7420 2843 2920 4455 4e45 2050 726f ght (C) DUNE Pro │ │ │ │ -00000ec0: 6a65 6374 2063 6f6e 7472 6962 7574 6f72 ject contributor │ │ │ │ -00000ed0: 732c 2073 6565 2066 696c 6520 4c49 4345 s, see file LICE │ │ │ │ -00000ee0: 4e53 452e 6d64 2069 6e20 6d6f 6475 6c65 NSE.md in module │ │ │ │ -00000ef0: 2072 6f6f 743c 2f73 7061 6e3e 3c2f 6469 root.
4 │ │ │ │ -00000f50: 3c2f 7370 616e 3e3c 7370 616e 2063 6c61 // │ │ │ │ -00000f70: 5350 4458 2d4c 6963 656e 7365 2d49 6465 SPDX-License-Ide │ │ │ │ -00000f80: 6e74 6966 6965 723a 204c 6963 656e 7365 ntifier: License │ │ │ │ -00000f90: 5265 662d 4750 4c2d 322e 302d 6f6e 6c79 Ref-GPL-2.0-only │ │ │ │ -00000fa0: 2d77 6974 682d 4455 4e45 2d65 7863 6570 -with-DUNE-excep │ │ │ │ -00000fb0: 7469 6f6e 3c2f 7370 616e 3e3c 2f64 6976 tion
.
5< │ │ │ │ -00001010: 2f73 7061 6e3e 3c73 7061 6e20 636c 6173 /span>#ifndef DUNE_CO │ │ │ │ -00001040: 4d4d 4f4e 5f46 4c4f 4154 5f43 4d50 5f48 MMON_FLOAT_CMP_H │ │ │ │ -00001050: 483c 2f73 7061 6e3e 3c2f 6469 763e 0a3c H
.< │ │ │ │ -00001060: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00001070: 3e3c 6120 6964 3d22 6c30 3030 3036 2220 > 6#d │ │ │ │ -000010d0: 6566 696e 6520 4455 4e45 5f43 4f4d 4d4f efine DUNE_COMMO │ │ │ │ -000010e0: 4e5f 464c 4f41 545f 434d 505f 4848 3c2f N_FLOAT_CMP_HH
.
< │ │ │ │ -00001130: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00001140: 6e6f 223e 2020 2020 373c 2f73 7061 6e3e no"> 7 │ │ │ │ -00001150: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
.
│ │ │ │ -000011a0: 2020 2039 373c 2f73 7061 6e3e 3c73 7061 97namespace Dune {.
10 │ │ │ │ -00001260: 303c 2f73 7061 6e3e 2020 3c73 7061 6e20 0 │ │ │ │ -00001280: 6e61 6d65 7370 6163 6520 3c2f 7370 616e namespace FloatCmp {
.
101< │ │ │ │ -000012f0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ -00001310: 2f2f 2062 6173 6963 2063 6f6e 7374 616e // basic constan │ │ │ │ -00001320: 7473 3c2f 7370 616e 3e3c 2f64 6976 3e0a ts
. │ │ │ │ -00001330: 3c64 6976 2063 6c61 7373 3d22 666f 6c64
.
< │ │ │ │ -000013c0: 6120 636c 6173 733d 226c 696e 6522 2068 a class="line" h │ │ │ │ -000013d0: 7265 663d 2261 3030 3430 392e 6874 6d6c ref="a00409.html │ │ │ │ -000013e0: 2367 6134 6165 6237 3539 6564 3964 6538 #ga4aeb759ed9de8 │ │ │ │ -000013f0: 6234 3737 6131 3535 3439 3261 6562 3237 b477a155492aeb27 │ │ │ │ -00001400: 3839 6222 3e20 2031 3034 3c2f 613e 3c2f 89b"> 104 e │ │ │ │ -00001430: 6e75 6d3c 2f73 7061 6e3e 203c 6120 636c num │ │ │ │ -00001490: 436d 7053 7479 6c65 3c2f 613e 207b 3c2f CmpStyle {.
106 │ │ │ │ -000015e0: 7265 6c61 7469 7665 5765 616b 3c2f 613e relativeWeak │ │ │ │ -000015f0: 2c3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ,
.
│ │ │ │ -00001640: 3c61 2063 6c61 7373 3d22 6c69 6e65 2220 108 relativeStron │ │ │ │ -00001740: 673c 2f61 3e2c 3c2f 6469 763e 0a3c 6469 g,
.< │ │ │ │ -00001760: 6120 6964 3d22 6c30 3031 3130 2220 6e61 a id="l00110" na │ │ │ │ -00001770: 6d65 3d22 6c30 3031 3130 223e 3c2f 613e me="l00110"> │ │ │ │ -00001780: 3c73 7061 6e20 636c 6173 733d 226c 696e 1 │ │ │ │ -00001800: 3130 3c2f 613e 3c2f 7370 616e 3e20 2020 10 │ │ │ │ -00001810: 2020 203c 6120 636c 6173 733d 2263 6f64 absolute │ │ │ │ -00001890: 3c2f 613e 2c3c 2f64 6976 3e0a 3c64 6976 ,
.
< │ │ │ │ -000018d0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -000018e0: 6e6f 223e 2020 3131 323c 2f73 7061 6e3e no"> 112 │ │ │ │ -000018f0: 2020 2020 2020 3c61 2063 6c61 7373 3d22 defau │ │ │ │ -00001970: 6c74 436d 7053 7479 6c65 3c2f 613e 203d ltCmpStyle = │ │ │ │ -00001980: 203c 6120 636c 6173 733d 2263 6f64 6520 relativeWe │ │ │ │ -00001a00: 616b 3c2f 613e 3c2f 6469 763e 0a3c 6469 ak
.< │ │ │ │ -00001a20: 6120 6964 3d22 6c30 3031 3133 2220 6e61 a id="l00113" na │ │ │ │ -00001a30: 6d65 3d22 6c30 3031 3133 223e 3c2f 613e me="l00113"> │ │ │ │ -00001a40: 3c73 7061 6e20 636c 6173 733d 226c 696e 1 │ │ │ │ -00001ac0: 3133 3c2f 613e 3c2f 7370 616e 3e20 2020 13 │ │ │ │ -00001ad0: 207d 3b3c 2f64 6976 3e0a 3c2f 6469 763e };
.
│ │ │ │ -00001ae0: 0a3c 6469 7620 636c 6173 733d 2266 6f6c .
.
│ │ │ │ -00001b70: 3c61 2063 6c61 7373 3d22 6c69 6e65 2220 116< │ │ │ │ -00001bc0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ -00001be0: 656e 756d 3c2f 7370 616e 3e20 3c61 2063 enum RoundingStyle {
..
< │ │ │ │ -00001de0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00001df0: 6e6f 223e 3c61 2063 6c61 7373 3d22 6c69 no"> 12 │ │ │ │ -00001e60: 303c 2f61 3e3c 2f73 7061 6e3e 2020 2020 0 │ │ │ │ -00001e70: 2020 3c61 2063 6c61 7373 3d22 636f 6465 towardInf │ │ │ │ -00001ef0: 3c2f 613e 2c3c 2f64 6976 3e0a 3c64 6976 ,
.
< │ │ │ │ -00001f30: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00001f40: 6e6f 223e 3c61 2063 6c61 7373 3d22 6c69 no"> 12 │ │ │ │ -00001fb0: 323c 2f61 3e3c 2f73 7061 6e3e 2020 2020 2 │ │ │ │ -00001fc0: 2020 3c61 2063 6c61 7373 3d22 636f 6465 downward< │ │ │ │ -00002040: 2f61 3e2c 3c2f 6469 763e 0a3c 6469 7620 /a>,
.
124 │ │ │ │ -00002100: 3c2f 613e 3c2f 7370 616e 3e20 2020 2020 │ │ │ │ -00002110: 203c 6120 636c 6173 733d 2263 6f64 6520 upward │ │ │ │ -00002190: 2c3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ,
.
│ │ │ │ -000021e0: 2020 3132 363c 2f73 7061 6e3e 2020 2020 126 │ │ │ │ -000021f0: 2020 3c61 2063 6c61 7373 3d22 636f 6465 defaultRo │ │ │ │ -00002270: 756e 6469 6e67 5374 796c 653c 2f61 3e20 undingStyle │ │ │ │ -00002280: 3d20 3c61 2063 6c61 7373 3d22 636f 6465 = towardZer │ │ │ │ -00002300: 6f3c 2f61 3e3c 2f64 6976 3e0a 3c64 6976 o
.
< │ │ │ │ -00002340: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00002350: 6e6f 223e 3c61 2063 6c61 7373 3d22 6c69 no"> 12 │ │ │ │ -000023c0: 373c 2f61 3e3c 2f73 7061 6e3e 2020 2020 7 │ │ │ │ -000023d0: 7d3b 3c2f 6469 763e 0a3c 2f64 6976 3e0a };
.
. │ │ │ │ -000023e0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
< │ │ │ │ -00002470: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00002480: 6e6f 223e 2020 3132 393c 2f73 7061 6e3e no"> 129 │ │ │ │ -00002490: 2020 2020 3c73 7061 6e20 636c 6173 733d templa │ │ │ │ -000024b0: 7465 3c2f 7370 616e 3e26 6c74 3b3c 7370 te<class │ │ │ │ -000024e0: 5426 6774 3b20 3c73 7061 6e20 636c 6173 T> stru │ │ │ │ -00002500: 6374 203c 2f73 7061 6e3e 4570 7369 6c6f ct Epsilo │ │ │ │ -00002510: 6e54 7970 653b 3c2f 6469 763e 0a3c 6469 nType;
.< │ │ │ │ -00002530: 6120 6964 3d22 6c30 3031 3330 2220 6e61 a id="l00130" na │ │ │ │ -00002540: 6d65 3d22 6c30 3031 3330 223e 3c2f 613e me="l00130"> │ │ │ │ -00002550: 3c73 7061 6e20 636c 6173 733d 226c 696e 130
.
132 .
1 │ │ │ │ -00002620: 3337 3c2f 7370 616e 3e20 2020 203c 7370 37 template<clas │ │ │ │ -00002670: 733c 2f73 7061 6e3e 2054 2c20 436d 7053 s T, CmpS │ │ │ │ -00002680: 7479 6c65 2073 7479 6c65 203d 2064 6566 tyle style = def │ │ │ │ -00002690: 6175 6c74 436d 7053 7479 6c65 2667 743b aultCmpStyle> │ │ │ │ -000026a0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
. │ │ │ │ -00002700: 3c61 2069 643d 226c 3030 3133 3822 206e 138 struct De │ │ │ │ -000027c0: 6661 756c 7445 7073 696c 6f6e 3c2f 613e faultEpsilon │ │ │ │ -000027d0: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
.
140< │ │ │ │ -00002870: 2f73 7061 6e3e 2020 2020 2020 3c73 7061 /span> static │ │ │ │ -000028a0: 3c73 7061 6e20 636c 6173 733d 226b 6579 typename EpsilonTyp │ │ │ │ -00002920: 6526 6c74 3b54 2667 743b 3a3a 5479 7065 e<T>::Type │ │ │ │ -00002930: 3c2f 613e 203c 6120 636c 6173 733d 2263 value( │ │ │ │ -00002990: 293b 3c2f 6469 763e 0a3c 6469 7620 636c );
.
141 │ │ │ │ -000029f0: 207d 3b3c 2f64 6976 3e0a 3c2f 6469 763e };
.
│ │ │ │ -00002a00: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ -00002a70: 6120 6964 3d22 6c30 3031 3433 2220 6e61 a id="l00143" na │ │ │ │ -00002a80: 6d65 3d22 6c30 3031 3433 223e 3c2f 613e me="l00143"> │ │ │ │ -00002a90: 3c73 7061 6e20 636c 6173 733d 226c 696e 143 // op │ │ │ │ -00002ad0: 6572 6174 696f 6e73 2069 6e20 6675 6e63 erations in func │ │ │ │ -00002ae0: 7469 6f6e 616c 2073 7479 6c65 3c2f 7370 tional style
.
144 < │ │ │ │ -00002b50: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -00002ba0: 3134 373c 2f73 7061 6e3e 203c 2f64 6976 147
.
149< │ │ │ │ -00002c00: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
. │ │ │ │ -00002c20: 3c61 2069 643d 226c 3030 3135 3622 206e 156 temp │ │ │ │ -00002c80: 6c61 7465 3c2f 7370 616e 3e20 266c 743b late < │ │ │ │ -00002c90: 3c73 7061 6e20 636c 6173 733d 226b 6579 class
T, CmpSt │ │ │ │ -00002d10: 796c 653c 2f61 3e20 7374 796c 6520 3c73 yle style /*= defaultC │ │ │ │ -00002d40: 6d70 5374 796c 652a 2f3c 2f73 7061 6e3e mpStyle*/ │ │ │ │ -00002d50: 2667 743b 3c2f 6469 763e 0a3c 6469 7620 >
.
157 │ │ │ │ -00002db0: 2020 203c 7370 616e 2063 6c61 7373 3d22 boo │ │ │ │ -00002dd0: 6c3c 2f73 7061 6e3e 203c 6120 636c 6173 l eq(const T &firs │ │ │ │ -00002e60: 742c 3c2f 6469 763e 0a3c 6469 7620 636c t,
.
158 │ │ │ │ -00002ec0: 2020 2020 2020 2020 203c 7370 616e 2063 c │ │ │ │ -00002ee0: 6f6e 7374 3c2f 7370 616e 3e20 5420 2661 onst T &a │ │ │ │ -00002ef0: 6d70 3b73 6563 6f6e 642c 3c2f 6469 763e mp;second,
│ │ │ │ -00002f00: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ -00003060: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ -000030d0: 6120 6964 3d22 6c30 3031 3639 2220 6e61 a id="l00169" na │ │ │ │ -000030e0: 6d65 3d22 6c30 3031 3639 223e 3c2f 613e me="l00169"> │ │ │ │ -000030f0: 3c73 7061 6e20 636c 6173 733d 226c 696e 169 templ │ │ │ │ -00003130: 6174 653c 2f73 7061 6e3e 2026 6c74 3b3c ate << │ │ │ │ -00003140: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00003150: 6f72 6422 3e63 6c61 7373 203c 2f73 7061 ord">class T, CmpSty │ │ │ │ -000031c0: 6c65 3c2f 613e 2073 7479 6c65 203c 7370 le style /*= defaultCm │ │ │ │ -000031f0: 7053 7479 6c65 2a2f 3c2f 7370 616e 3e26 pStyle*/& │ │ │ │ -00003200: 6774 3b3c 2f64 6976 3e0a 3c64 6976 2063 gt;
.
170 │ │ │ │ -00003260: 2020 3c73 7061 6e20 636c 6173 733d 226b bool │ │ │ │ -00003280: 3c2f 7370 616e 3e20 3c61 2063 6c61 7373 ne │ │ │ │ -000032e0: 283c 7370 616e 2063 6c61 7373 3d22 6b65 (const T &first │ │ │ │ -00003310: 2c3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ,
.
│ │ │ │ -00003360: 2020 3137 313c 2f73 7061 6e3e 2020 2020 171 │ │ │ │ -00003370: 2020 2020 2020 2020 3c73 7061 6e20 636c co │ │ │ │ -00003390: 6e73 743c 2f73 7061 6e3e 2054 2026 616d nst T &am │ │ │ │ -000033a0: 703b 7365 636f 6e64 2c3c 2f64 6976 3e0a p;second,
. │ │ │ │ -000033b0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
< │ │ │ │ -000033e0: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 172 │ │ │ │ -00003410: 3c73 7061 6e20 636c 6173 733d 226b 6579 typename EpsilonTyp │ │ │ │ -00003490: 6526 6c74 3b54 2667 743b 3a3a 5479 7065 e<T>::Type │ │ │ │ -000034a0: 3c2f 613e 2065 7073 696c 6f6e 203d 203c epsilon = < │ │ │ │ -000034b0: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ -000034c0: 5f73 7472 7563 7422 2068 7265 663d 2261 _struct" href="a │ │ │ │ -000034d0: 3031 3731 362e 6874 6d6c 223e 4465 6661 01716.html">Defa │ │ │ │ -000034e0: 756c 7445 7073 696c 6f6e 266c 743b 542c ultEpsilon<T, │ │ │ │ -000034f0: 2073 7479 6c65 2667 743b 3a3a 7661 6c75 style>::valu │ │ │ │ -00003500: 653c 2f61 3e28 2929 3b3c 2f64 6976 3e0a e());
. │ │ │ │ -00003510: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
.
< │ │ │ │ -000035a0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -000035b0: 6e6f 223e 2020 3138 353c 2f73 7061 6e3e no"> 185 │ │ │ │ -000035c0: 2020 2020 3c73 7061 6e20 636c 6173 733d templa │ │ │ │ -000035e0: 7465 3c2f 7370 616e 3e20 266c 743b 3c73 te <class T, CmpStyl │ │ │ │ -00003670: 653c 2f61 3e20 7374 796c 6520 3c73 7061 e style /*= defaultCmp │ │ │ │ -000036a0: 5374 796c 652a 2f3c 2f73 7061 6e3e 2667 Style*/&g │ │ │ │ -000036b0: 743b 3c2f 6469 763e 0a3c 6469 7620 636c t;
.
186 │ │ │ │ -00003710: 203c 7370 616e 2063 6c61 7373 3d22 6b65 bool< │ │ │ │ -00003730: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> gt( │ │ │ │ -00003790: 3c73 7061 6e20 636c 6173 733d 226b 6579 const T &first, │ │ │ │ -000037c0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
│ │ │ │ -00003810: 2031 3837 3c2f 7370 616e 3e20 2020 2020 187 │ │ │ │ -00003820: 2020 2020 2020 203c 7370 616e 2063 6c61 con │ │ │ │ -00003840: 7374 3c2f 7370 616e 3e20 5420 2661 6d70 st T & │ │ │ │ -00003850: 3b73 6563 6f6e 642c 3c2f 6469 763e 0a3c ;second,
.< │ │ │ │ -00003860: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00003870: 3e3c 6120 6964 3d22 6c30 3031 3838 2220 > 188 < │ │ │ │ -000038c0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -000038d0: 6f72 6422 3e74 7970 656e 616d 653c 2f73 ord">typename
EpsilonType │ │ │ │ -00003940: 266c 743b 5426 6774 3b3a 3a54 7970 653c <T>::Type< │ │ │ │ -00003950: 2f61 3e20 6570 7369 6c6f 6e20 3d20 3c61 /a> epsilon = Defau │ │ │ │ -00003990: 6c74 4570 7369 6c6f 6e26 6c74 3b54 2c20 ltEpsilon<T, │ │ │ │ -000039a0: 7374 796c 6526 6774 3b3a 3a76 616c 7565 style>::value │ │ │ │ -000039b0: 3c2f 613e 2829 293b 3c2f 6469 763e 0a3c ());.< │ │ │ │ -000039c0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -000039d0: 3e3c 6120 6964 3d22 6c30 3031 3930 2220 > 190 .
201 │ │ │ │ -00003a70: 2020 203c 7370 616e 2063 6c61 7373 3d22 templat │ │ │ │ -00003a90: 653c 2f73 7061 6e3e 2026 6c74 3b3c 7370 e <class │ │ │ │ -00003ac0: 542c 203c 6120 636c 6173 733d 2263 6f64 T, CmpStyle │ │ │ │ -00003b20: 3c2f 613e 2073 7479 6c65 203c 7370 616e style /*= defaultCmpS │ │ │ │ -00003b50: 7479 6c65 2a2f 3c2f 7370 616e 3e26 6774 tyle*/> │ │ │ │ -00003b60: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
.
│ │ │ │ -00003bb0: 2020 3230 323c 2f73 7061 6e3e 2020 2020 202 │ │ │ │ -00003bc0: 3c73 7061 6e20 636c 6173 733d 226b 6579 bool lt(< │ │ │ │ -00003c40: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00003c50: 6f72 6422 3e63 6f6e 7374 3c2f 7370 616e ord">const T &first,< │ │ │ │ -00003c70: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -00003cc0: 3230 333c 2f73 7061 6e3e 2020 2020 2020 203 │ │ │ │ -00003cd0: 2020 2020 2020 3c73 7061 6e20 636c 6173 cons │ │ │ │ -00003cf0: 743c 2f73 7061 6e3e 2054 2026 616d 703b t T & │ │ │ │ -00003d00: 7365 636f 6e64 2c3c 2f64 6976 3e0a 3c64 second,
. │ │ │ │ -00003d20: 3c61 2069 643d 226c 3030 3230 3422 206e 204 typename EpsilonType& │ │ │ │ -00003df0: 6c74 3b54 2667 743b 3a3a 5479 7065 3c2f lt;T>::Type epsilon = Defaul │ │ │ │ -00003e40: 7445 7073 696c 6f6e 266c 743b 542c 2073 tEpsilon<T, s │ │ │ │ -00003e50: 7479 6c65 2667 743b 3a3a 7661 6c75 653c tyle>::value< │ │ │ │ -00003e60: 2f61 3e28 2929 3b3c 2f64 6976 3e0a 3c64 /a>());
. │ │ │ │ -00003e80: 3c61 2069 643d 226c 3030 3230 3622 206e 206 .
217 │ │ │ │ -00003f20: 2020 3c73 7061 6e20 636c 6173 733d 226b template │ │ │ │ -00003f40: 3c2f 7370 616e 3e20 266c 743b 3c73 7061 <class T │ │ │ │ -00003f70: 2c20 3c61 2063 6c61 7373 3d22 636f 6465 , CmpStyle< │ │ │ │ -00003fd0: 2f61 3e20 7374 796c 6520 3c73 7061 6e20 /a> style │ │ │ │ -00003ff0: 2f2a 3d20 6465 6661 756c 7443 6d70 5374 /*= defaultCmpSt │ │ │ │ -00004000: 796c 652a 2f3c 2f73 7061 6e3e 2667 743b yle*/> │ │ │ │ -00004010: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
│ │ │ │ -00004060: 2032 3138 3c2f 7370 616e 3e20 2020 203c 218 < │ │ │ │ -00004070: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00004080: 6f72 6474 7970 6522 3e62 6f6f 6c3c 2f73 ordtype">bool ge(const │ │ │ │ -00004110: 2054 2026 616d 703b 6669 7273 742c 3c2f T &first,.
2 │ │ │ │ -00004170: 3139 3c2f 7370 616e 3e20 2020 2020 2020 19 │ │ │ │ -00004180: 2020 2020 203c 7370 616e 2063 6c61 7373 const │ │ │ │ -000041a0: 3c2f 7370 616e 3e20 5420 2661 6d70 3b73 T &s │ │ │ │ -000041b0: 6563 6f6e 642c 3c2f 6469 763e 0a3c 6469 econd,
.< │ │ │ │ -000041d0: 6120 6964 3d22 6c30 3032 3230 2220 6e61 a id="l00220" na │ │ │ │ -000041e0: 6d65 3d22 6c30 3032 3230 223e 3c2f 613e me="l00220"> │ │ │ │ -000041f0: 3c73 7061 6e20 636c 6173 733d 226c 696e 220 typename EpsilonType&l │ │ │ │ -000042a0: 743b 5426 6774 3b3a 3a54 7970 653c 2f61 t;T>::Type epsilon = Default │ │ │ │ -000042f0: 4570 7369 6c6f 6e26 6c74 3b54 2c20 7374 Epsilon<T, st │ │ │ │ -00004300: 796c 6526 6774 3b3a 3a76 616c 7565 3c2f yle>::value());
.< │ │ │ │ -00004330: 6120 6964 3d22 6c30 3032 3232 2220 6e61 a id="l00222" na │ │ │ │ -00004340: 6d65 3d22 6c30 3032 3232 223e 3c2f 613e me="l00222"> │ │ │ │ -00004350: 3c73 7061 6e20 636c 6173 733d 226c 696e 222 .
233 │ │ │ │ -000043d0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 template< │ │ │ │ -000043f0: 2f73 7061 6e3e 2026 6c74 3b3c 7370 616e /span> <class T, │ │ │ │ -00004420: 203c 6120 636c 6173 733d 2263 6f64 6520 CmpStyle style / │ │ │ │ -000044a0: 2a3d 2064 6566 6175 6c74 436d 7053 7479 *= defaultCmpSty │ │ │ │ -000044b0: 6c65 2a2f 3c2f 7370 616e 3e26 6774 3b3c le*/>< │ │ │ │ -000044c0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -00004510: 3233 343c 2f73 7061 6e3e 2020 2020 3c73 234 bool le(const │ │ │ │ -000045c0: 5420 2661 6d70 3b66 6972 7374 2c3c 2f64 T &first,.
23 │ │ │ │ -00004620: 353c 2f73 7061 6e3e 2020 2020 2020 2020 5 │ │ │ │ -00004630: 2020 2020 3c73 7061 6e20 636c 6173 733d const< │ │ │ │ -00004650: 2f73 7061 6e3e 2054 2026 616d 703b 7365 /span> T &se │ │ │ │ -00004660: 636f 6e64 2c3c 2f64 6976 3e0a 3c64 6976 cond,
.
< │ │ │ │ -000046a0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -000046b0: 6e6f 223e 2020 3233 363c 2f73 7061 6e3e no"> 236 │ │ │ │ -000046c0: 2020 2020 2020 2020 2020 2020 3c73 7061 typename EpsilonType< │ │ │ │ -00004750: 3b54 2667 743b 3a3a 5479 7065 3c2f 613e ;T>::Type │ │ │ │ -00004760: 2065 7073 696c 6f6e 203d 203c 6120 636c epsilon = DefaultE │ │ │ │ -000047a0: 7073 696c 6f6e 266c 743b 542c 2073 7479 psilon<T, sty │ │ │ │ -000047b0: 6c65 2667 743b 3a3a 7661 6c75 653c 2f61 le>::value());
.
< │ │ │ │ -00004800: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00004810: 6e6f 223e 2020 3233 373c 2f73 7061 6e3e no"> 237 │ │ │ │ -00004820: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
.
│ │ │ │ -00004870: 2020 3233 383c 2f73 7061 6e3e 2020 2020 238 │ │ │ │ -00004880: 3c73 7061 6e20 636c 6173 733d 2263 6f6d // roundin │ │ │ │ -000048a0: 6720 6f70 6572 6174 696f 6e73 3c2f 7370 g operations
.
240 < │ │ │ │ -00004910: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -00004960: 3235 333c 2f73 7061 6e3e 2020 2020 3c73 253 template<cla │ │ │ │ -000049b0: 7373 203c 2f73 7061 6e3e 492c 203c 7370 ss I, class │ │ │ │ -000049e0: 542c 203c 6120 636c 6173 733d 2263 6f64 T, CmpStyle │ │ │ │ -00004a40: 3c2f 613e 2063 7374 796c 6520 3c73 7061 cstyle /*= defaultCmp │ │ │ │ -00004a70: 5374 796c 652a 2f3c 2f73 7061 6e3e 2c20 Style*/, │ │ │ │ -00004a80: 3c61 2063 6c61 7373 3d22 636f 6465 2068 RoundingSty │ │ │ │ -00004ae0: 6c65 3c2f 613e 2072 7374 796c 6520 3c73 le rstyle /*= defaultR │ │ │ │ -00004b10: 6f75 6e64 696e 6753 7479 6c65 2a2f 3c2f oundingStyle*/>
. │ │ │ │ -00004b30: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
< │ │ │ │ -00004b60: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 254 I roun │ │ │ │ -00004be0: 643c 2f61 3e28 3c73 7061 6e20 636c 6173 d(cons │ │ │ │ -00004c00: 743c 2f73 7061 6e3e 2054 2026 616d 703b t T & │ │ │ │ -00004c10: 7661 6c2c 203c 7370 616e 2063 6c61 7373 val, typen │ │ │ │ -00004c30: 616d 653c 2f73 7061 6e3e 203c 6120 636c ame Epsil │ │ │ │ -00004c90: 6f6e 5479 7065 266c 743b 5426 6774 3b3a onType<T>: │ │ │ │ -00004ca0: 3a54 7970 653c 2f61 3e20 6570 7369 6c6f :Type epsilo │ │ │ │ -00004cb0: 6e20 3d20 3c61 2063 6c61 7373 3d22 636f n = DefaultEpsilon& │ │ │ │ -00004cf0: 6c74 3b54 2c20 6373 7479 6c65 2667 743b lt;T, cstyle> │ │ │ │ -00004d00: 3a3a 7661 6c75 653c 2f61 3e28 2929 3b3c ::value());< │ │ │ │ -00004d10: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -00004d60: 3235 353c 2f73 7061 6e3e 2020 2020 3c73 255 // truncatio │ │ │ │ -00004d90: 6e3c 2f73 7061 6e3e 3c2f 6469 763e 0a3c n
.< │ │ │ │ -00004da0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00004db0: 3e3c 6120 6964 3d22 6c30 3032 3537 2220 > 257
.
270 │ │ │ │ -00004e50: 2020 203c 7370 616e 2063 6c61 7373 3d22 templat │ │ │ │ -00004e70: 653c 2f73 7061 6e3e 266c 743b 3c73 7061 e<class I │ │ │ │ -00004ea0: 2c20 3c73 7061 6e20 636c 6173 733d 226b , class T, Cmp │ │ │ │ -00004f20: 5374 796c 653c 2f61 3e20 6373 7479 6c65 Style cstyle │ │ │ │ -00004f30: 203c 7370 616e 2063 6c61 7373 3d22 636f /*= defau │ │ │ │ -00004f50: 6c74 436d 7053 7479 6c65 2a2f 3c2f 7370 ltCmpStyle*/, Roundi │ │ │ │ -00004fc0: 6e67 5374 796c 653c 2f61 3e20 7273 7479 ngStyle rsty │ │ │ │ -00004fd0: 6c65 203c 7370 616e 2063 6c61 7373 3d22 le /*= def │ │ │ │ -00004ff0: 6175 6c74 526f 756e 6469 6e67 5374 796c aultRoundingStyl │ │ │ │ -00005000: 652a 2f3c 2f73 7061 6e3e 2667 743b 3c2f e*/>.
2 │ │ │ │ -00005060: 3731 3c2f 7370 616e 3e20 2020 2049 203c 71 I < │ │ │ │ -00005070: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ -00005080: 5f66 756e 6374 696f 6e22 2068 7265 663d _function" href= │ │ │ │ -00005090: 2261 3030 3430 392e 6874 6d6c 2367 6137 "a00409.html#ga7 │ │ │ │ -000050a0: 3865 6166 3836 6232 3132 3336 6635 6335 8eaf86b21236f5c5 │ │ │ │ -000050b0: 3533 3336 3732 3465 3931 3164 6130 3822 5336724e911da08" │ │ │ │ -000050c0: 3e74 7275 6e63 3c2f 613e 283c 7370 616e >trunc(const T │ │ │ │ -000050f0: 2661 6d70 3b76 616c 2c20 3c73 7061 6e20 &val, │ │ │ │ -00005110: 7479 7065 6e61 6d65 3c2f 7370 616e 3e20 typename │ │ │ │ -00005120: 3c61 2063 6c61 7373 3d22 636f 6465 2068 │ │ │ │ -00005170: 4570 7369 6c6f 6e54 7970 6526 6c74 3b54 EpsilonType<T │ │ │ │ -00005180: 2667 743b 3a3a 5479 7065 3c2f 613e 2065 >::Type e │ │ │ │ -00005190: 7073 696c 6f6e 203d 203c 6120 636c 6173 psilon = DefaultEps │ │ │ │ -000051d0: 696c 6f6e 266c 743b 542c 2063 7374 796c ilon<T, cstyl │ │ │ │ -000051e0: 6526 6774 3b3a 3a76 616c 7565 3c2f 613e e>::value │ │ │ │ -000051f0: 2829 293b 3c2f 6469 763e 0a3c 6469 7620 ());
.
272 │ │ │ │ -00005250: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
│ │ │ │ -000052a0: 2032 3734 3c2f 7370 616e 3e20 2020 203c 274 < │ │ │ │ -000052b0: 7370 616e 2063 6c61 7373 3d22 636f 6d6d span class="comm │ │ │ │ -000052c0: 656e 7422 3e2f 2f20 6772 6f75 7020 466c ent">// group Fl │ │ │ │ -000052d0: 6f61 7443 6d70 3c2f 7370 616e 3e3c 2f64 oatCmp.
27 │ │ │ │ -00005330: 353c 2f73 7061 6e3e 2020 7d20 3c73 7061 5 } //namespace Fl │ │ │ │ -00005360: 6f61 7443 6d70 3c2f 7370 616e 3e3c 2f64 oatCmp.
27 │ │ │ │ -000053c0: 363c 2f73 7061 6e3e 203c 2f64 6976 3e0a 6
. │ │ │ │ -000053d0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
.
< │ │ │ │ -00005460: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00005470: 6e6f 223e 2020 3237 383c 2f73 7061 6e3e no"> 278 │ │ │ │ -00005480: 2020 3c73 7061 6e20 636c 6173 733d 2263 // oo in │ │ │ │ -000054a0: 7465 7266 6163 653c 2f73 7061 6e3e 3c2f terface.
2 │ │ │ │ -00005500: 3830 3c2f 7370 616e 3e20 3c2f 6469 763e 80
│ │ │ │ -00005510: 0a3c 6469 7620 636c 6173 733d 226c 696e .
│ │ │ │ -00005540: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 286 tem │ │ │ │ -00005580: 706c 6174 653c 2f73 7061 6e3e 266c 743b plate< │ │ │ │ -00005590: 3c73 7061 6e20 636c 6173 733d 226b 6579 class T, Float │ │ │ │ -00005610: 436d 703a 3a43 6d70 5374 796c 653c 2f61 Cmp::CmpStyle cstyle_ = FloatCmp::defau │ │ │ │ -000056b0: 6c74 436d 7053 7479 6c65 3c2f 613e 2c3c ltCmpStyle,< │ │ │ │ +000001c0: 666d 6174 7269 782e 6868 2053 6f75 7263 fmatrix.hh Sourc │ │ │ │ +000001d0: 6520 4669 6c65 3c2f 7469 746c 653e 0a3c e File.< │ │ │ │ +000001e0: 6c69 6e6b 2068 7265 663d 2274 6162 732e link href="tabs. │ │ │ │ +000001f0: 6373 7322 2072 656c 3d22 7374 796c 6573 css" rel="styles │ │ │ │ +00000200: 6865 6574 2220 7479 7065 3d22 7465 7874 heet" type="text │ │ │ │ +00000210: 2f63 7373 222f 3e0a 3c73 6372 6970 7420 /css"/>. │ │ │ │ +00000250: 0a3c 7363 7269 7074 2074 7970 653d 2274 ..< │ │ │ │ +00000290: 6c69 6e6b 2068 7265 663d 2273 6561 7263 link href="searc │ │ │ │ +000002a0: 682f 7365 6172 6368 2e63 7373 2220 7265 h/search.css" re │ │ │ │ +000002b0: 6c3d 2273 7479 6c65 7368 6565 7422 2074 l="stylesheet" t │ │ │ │ +000002c0: 7970 653d 2274 6578 742f 6373 7322 2f3e ype="text/css"/> │ │ │ │ +000002d0: 0a3c 7363 7269 7074 2074 7970 653d 2274 ...../* │ │ │ │ +00000690: 406c 6963 656e 7365 206d 6167 6e65 743a @license magnet: │ │ │ │ +000006a0: 3f78 743d 7572 6e3a 6274 6968 3a64 3364 ?xt=urn:btih:d3d │ │ │ │ +000006b0: 3961 3961 3635 3935 3532 3166 3936 3636 9a9a6595521f9666 │ │ │ │ +000006c0: 6135 6539 3463 6338 3330 6461 6238 3362 a5e94cc830dab83b │ │ │ │ +000006d0: 3635 3639 3926 616d 703b 646e 3d65 7870 65699&dn=exp │ │ │ │ +000006e0: 6174 2e74 7874 204d 4954 202a 2f0a 2428 at.txt MIT */.$( │ │ │ │ +000006f0: 6675 6e63 7469 6f6e 2829 207b 0a20 2069 function() {. i │ │ │ │ +00000700: 6e69 744d 656e 7528 2727 2c74 7275 652c nitMenu('',true, │ │ │ │ +00000710: 6661 6c73 652c 2773 6561 7263 682e 7068 false,'search.ph │ │ │ │ +00000720: 7027 2c27 5365 6172 6368 2729 3b0a 2020 p','Search');. │ │ │ │ +00000730: 2428 646f 6375 6d65 6e74 292e 7265 6164 $(document).read │ │ │ │ +00000740: 7928 6675 6e63 7469 6f6e 2829 207b 2069 y(function() { i │ │ │ │ +00000750: 6e69 745f 7365 6172 6368 2829 3b20 7d29 nit_search(); }) │ │ │ │ +00000760: 3b0a 7d29 3b0a 2f2a 2040 6c69 6365 6e73 ;.});./* @licens │ │ │ │ +00000770: 652d 656e 6420 2a2f 0a3c 2f73 6372 6970 e-end */..
../* │ │ │ │ +000007c0: 406c 6963 656e 7365 206d 6167 6e65 743a @license magnet: │ │ │ │ +000007d0: 3f78 743d 7572 6e3a 6274 6968 3a64 3364 ?xt=urn:btih:d3d │ │ │ │ +000007e0: 3961 3961 3635 3935 3532 3166 3936 3636 9a9a6595521f9666 │ │ │ │ +000007f0: 6135 6539 3463 6338 3330 6461 6238 3362 a5e94cc830dab83b │ │ │ │ +00000800: 3635 3639 3926 616d 703b 646e 3d65 7870 65699&dn=exp │ │ │ │ +00000810: 6174 2e74 7874 204d 4954 202a 2f0a 2428 at.txt MIT */.$( │ │ │ │ +00000820: 646f 6375 6d65 6e74 292e 7265 6164 7928 document).ready( │ │ │ │ +00000830: 6675 6e63 7469 6f6e 2829 207b 2069 6e69 function() { ini │ │ │ │ +00000840: 745f 636f 6465 666f 6c64 2830 293b 207d t_codefold(0); } │ │ │ │ +00000850: 293b 0a2f 2a20 406c 6963 656e 7365 2d65 );./* @license-e │ │ │ │ +00000860: 6e64 202a 2f0a 3c2f 7363 7269 7074 3e0a nd */.. │ │ │ │ +00000870: 3c21 2d2d 2077 696e 646f 7720 7368 6f77 .
.
.....
.
.< │ │ │ │ +00000a10: 6469 7620 6964 3d22 5352 5265 7375 6c74 div id="SRResult │ │ │ │ +00000a20: 7322 3e3c 2f64 6976 3e0a 3c64 6976 2063 s">
.
Loa │ │ │ │ +00000a50: 6469 6e67 2e2e 2e3c 2f64 6976 3e0a 3c64 ding...
.Searching...< │ │ │ │ +00000a90: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
No Ma │ │ │ │ +00000ac0: 7463 6865 733c 2f64 6976 3e0a 3c2f 6469 tches
..
.
│ │ │ │ +00000ae0: 0a3c 2f64 6976 3e0a 0a3c 6469 7620 6964 .
..
. < │ │ │ │ +00000b10: 756c 3e0a 3c6c 6920 636c 6173 733d 226e ul>.
  • dune< │ │ │ │ +00000b70: 2f6c 693e 3c6c 6920 636c 6173 733d 226e /li>
  • common
  • ..
    .
    . < │ │ │ │ +00000c10: 6469 7620 636c 6173 733d 2268 6561 6465 div class="heade │ │ │ │ +00000c20: 7274 6974 6c65 223e 3c64 6976 2063 6c61 rtitle">
    fmatr │ │ │ │ +00000c40: 6978 2e68 683c 2f64 6976 3e3c 2f64 6976 ix.hh
    .
    .
    .Go to the doc │ │ │ │ +00000ca0: 756d 656e 7461 7469 6f6e 206f 6620 7468 umentation of th │ │ │ │ +00000cb0: 6973 2066 696c 652e 3c2f 613e 3c64 6976 is file.
    1< │ │ │ │ +00000d20: 2f73 7061 6e3e 3c73 7061 6e20 636c 6173 /span>// - │ │ │ │ +00000d40: 2a2d 2074 6162 2d77 6964 7468 3a20 343b *- tab-width: 4; │ │ │ │ +00000d50: 2069 6e64 656e 742d 7461 6273 2d6d 6f64 indent-tabs-mod │ │ │ │ +00000d60: 653a 206e 696c 3b20 632d 6261 7369 632d e: nil; c-basic- │ │ │ │ +00000d70: 6f66 6673 6574 3a20 3220 2d2a 2d3c 2f73 offset: 2 -*-
    .
    2< │ │ │ │ +00000de0: 7370 616e 2063 6c61 7373 3d22 636f 6d6d span class="comm │ │ │ │ +00000df0: 656e 7422 3e2f 2f20 7669 3a20 7365 7420 ent">// vi: set │ │ │ │ +00000e00: 6574 2074 733d 3420 7377 3d32 2073 7473 et ts=4 sw=2 sts │ │ │ │ +00000e10: 3d32 3a3c 2f73 7061 6e3e 3c2f 6469 763e =2:
    │ │ │ │ +00000e20: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00000e50: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 3// SP │ │ │ │ +00000e90: 4458 2d46 696c 6543 6f70 7972 6967 6874 DX-FileCopyright │ │ │ │ +00000ea0: 496e 666f 3a20 436f 7079 7269 6768 7420 Info: Copyright │ │ │ │ +00000eb0: 2843 2920 4455 4e45 2050 726f 6a65 6374 (C) DUNE Project │ │ │ │ +00000ec0: 2063 6f6e 7472 6962 7574 6f72 732c 2073 contributors, s │ │ │ │ +00000ed0: 6565 2066 696c 6520 4c49 4345 4e53 452e ee file LICENSE. │ │ │ │ +00000ee0: 6d64 2069 6e20 6d6f 6475 6c65 2072 6f6f md in module roo │ │ │ │ +00000ef0: 743c 2f73 7061 6e3e 3c2f 6469 763e 0a3c t
    .< │ │ │ │ +00000f00: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00000f10: 3e3c 6120 6964 3d22 6c30 3030 3034 2220 > 4// SPDX │ │ │ │ +00000f70: 2d4c 6963 656e 7365 2d49 6465 6e74 6966 -License-Identif │ │ │ │ +00000f80: 6965 723a 204c 6963 656e 7365 5265 662d ier: LicenseRef- │ │ │ │ +00000f90: 4750 4c2d 322e 302d 6f6e 6c79 2d77 6974 GPL-2.0-only-wit │ │ │ │ +00000fa0: 682d 4455 4e45 2d65 7863 6570 7469 6f6e h-DUNE-exception │ │ │ │ +00000fb0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    . │ │ │ │ +00000fd0: 3c61 2069 643d 226c 3030 3030 3522 206e 5#if │ │ │ │ +00001030: 6e64 6566 2044 554e 455f 464d 4154 5249 ndef DUNE_FMATRI │ │ │ │ +00001040: 585f 4848 3c2f 7370 616e 3e3c 2f64 6976 X_HH
    .
    6< │ │ │ │ +000010a0: 2f73 7061 6e3e 3c73 7061 6e20 636c 6173 /span>#define DUNE_FM │ │ │ │ +000010d0: 4154 5249 585f 4848 3c2f 7370 616e 3e3c ATRIX_HH< │ │ │ │ +000010e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00001130: 2020 373c 2f73 7061 6e3e 203c 2f64 6976 7
    .
    8< │ │ │ │ +00001190: 2f73 7061 6e3e 3c73 7061 6e20 636c 6173 /span>#include <cm │ │ │ │ +000011c0: 6174 6826 6774 3b3c 2f73 7061 6e3e 3c2f ath>.
    │ │ │ │ +00001220: 2039 3c2f 7370 616e 3e3c 7370 616e 2063 9#include < │ │ │ │ +00001250: 3b63 7374 6464 6566 2667 743b 3c2f 7370 ;cstddef>
    .
    10#includ │ │ │ │ +000012e0: 6520 266c 743b 696f 7374 7265 616d 2667 e <iostream&g │ │ │ │ +000012f0: 743b 3c2f 7370 616e 3e3c 2f64 6976 3e0a t;
    . │ │ │ │ +00001300: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    │ │ │ │ +000013e0: 2020 3132 3c2f 7370 616e 3e3c 7370 616e 12#include & │ │ │ │ +00001410: 6c74 3b69 6e69 7469 616c 697a 6572 5f6c lt;initializer_l │ │ │ │ +00001420: 6973 7426 6774 3b3c 2f73 7061 6e3e 3c2f ist>.
    │ │ │ │ +00001480: 3133 3c2f 7370 616e 3e20 3c2f 6469 763e 13
    │ │ │ │ +00001490: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +000014c0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 14 │ │ │ │ +00001500: 2369 6e63 6c75 6465 2026 6c74 3b3c 6120 #include < │ │ │ │ +00001530: 6475 6e65 2f63 6f6d 6d6f 6e2f 626f 756e dune/common/boun │ │ │ │ +00001540: 6473 6368 6563 6b69 6e67 2e68 683c 2f61 dschecking.hh>.
    15 │ │ │ │ +000015b0: 3c2f 7370 616e 3e3c 7370 616e 2063 6c61 #include << │ │ │ │ +000015e0: 6120 636c 6173 733d 2263 6f64 6522 2068 a class="code" h │ │ │ │ +000015f0: 7265 663d 2261 3030 3334 372e 6874 6d6c ref="a00347.html │ │ │ │ +00001600: 223e 6475 6e65 2f63 6f6d 6d6f 6e2f 6578 ">dune/common/ex │ │ │ │ +00001610: 6365 7074 696f 6e73 2e68 683c 2f61 3e26 ceptions.hh& │ │ │ │ +00001620: 6774 3b3c 2f73 7061 6e3e 3c2f 6469 763e gt;
    │ │ │ │ +00001630: 0a3c 6469 7620 636c 6173 733d 226c 696e ..
    < │ │ │ │ +00001730: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00001740: 6e6f 223e 2020 2031 373c 2f73 7061 6e3e no"> 17 │ │ │ │ +00001750: 3c73 7061 6e20 636c 6173 733d 2270 7265 #incl │ │ │ │ +00001770: 7564 6520 266c 743b 3c61 2063 6c61 7373 ude <dune/ │ │ │ │ +000017a0: 636f 6d6d 6f6e 2f64 656e 7365 6d61 7472 common/densematr │ │ │ │ +000017b0: 6978 2e68 683c 2f61 3e26 6774 3b3c 2f73 ix.hh>
    .
    18< │ │ │ │ +00001820: 7370 616e 2063 6c61 7373 3d22 7072 6570 span class="prep │ │ │ │ +00001830: 726f 6365 7373 6f72 223e 2369 6e63 6c75 rocessor">#inclu │ │ │ │ +00001840: 6465 2026 6c74 3b3c 6120 636c 6173 733d de <dune/c │ │ │ │ +00001870: 6f6d 6d6f 6e2f 7072 6563 6973 696f 6e2e ommon/precision. │ │ │ │ +00001880: 6868 3c2f 613e 2667 743b 3c2f 7370 616e hh>
    .
    │ │ │ │ +000018e0: 2020 2031 393c 2f73 7061 6e3e 3c73 7061 19#include │ │ │ │ +00001910: 266c 743b 3c61 2063 6c61 7373 3d22 636f <dune/comm │ │ │ │ +00001940: 6f6e 2f70 726f 6d6f 7469 6f6e 7472 6169 on/promotiontrai │ │ │ │ +00001950: 7473 2e68 683c 2f61 3e26 6774 3b3c 2f73 ts.hh>
    .
    20< │ │ │ │ +000019c0: 7370 616e 2063 6c61 7373 3d22 7072 6570 span class="prep │ │ │ │ +000019d0: 726f 6365 7373 6f72 223e 2369 6e63 6c75 rocessor">#inclu │ │ │ │ +000019e0: 6465 2026 6c74 3b3c 6120 636c 6173 733d de <dune/c │ │ │ │ +00001a10: 6f6d 6d6f 6e2f 7479 7065 7472 6169 7473 ommon/typetraits │ │ │ │ +00001a20: 2e68 683c 2f61 3e26 6774 3b3c 2f73 7061 .hh>
    ..
    22 │ │ │ │ +00001b60: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00001bb0: 2020 3233 3c2f 7370 616e 3e3c 7370 616e 23namespace Dune
    │ │ │ │ +00001c20: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +00001c90: 6120 6964 3d22 6c30 3030 3235 2220 6e61 a id="l00025" na │ │ │ │ +00001ca0: 6d65 3d22 6c30 3030 3235 223e 3c2f 613e me="l00025"> │ │ │ │ +00001cb0: 3c73 7061 6e20 636c 6173 733d 226c 696e 25
    .
    26 < │ │ │ │ +00001d30: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00001d40: 6f72 6422 3e6e 616d 6573 7061 6365 203c ord">namespace < │ │ │ │ +00001d50: 2f73 7061 6e3e 496d 706c 3c2f 6469 763e /span>Impl
    │ │ │ │ +00001d60: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +00001dc0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00001dd0: 3e3c 6120 6964 3d22 6c30 3030 3238 2220 > 28
    .
    29 │ │ │ │ +00001e70: 2020 203c 7370 616e 2063 6c61 7373 3d22 templat │ │ │ │ +00001e90: 653c 2f73 7061 6e3e 266c 743b 3c73 7061 e<class M │ │ │ │ +00001ec0: 2667 743b 3c2f 6469 763e 0a3c 6469 7620 >
    .
    30 │ │ │ │ +00001f20: 2020 203c 7370 616e 2063 6c61 7373 3d22 class < │ │ │ │ +00001f40: 2f73 7061 6e3e 436f 6c75 6d6e 5665 6374 /span>ColumnVect │ │ │ │ +00001f50: 6f72 5669 6577 3c2f 6469 763e 0a3c 6469 orView
    .< │ │ │ │ +00001f70: 6120 6964 3d22 6c30 3030 3331 2220 6e61 a id="l00031" na │ │ │ │ +00001f80: 6d65 3d22 6c30 3030 3331 223e 3c2f 613e me="l00031"> │ │ │ │ +00001f90: 3c73 7061 6e20 636c 6173 733d 226c 696e 31 {
    .< │ │ │ │ +00001fd0: 6120 6964 3d22 6c30 3030 3332 2220 6e61 a id="l00032" na │ │ │ │ +00001fe0: 6d65 3d22 6c30 3030 3332 223e 3c2f 613e me="l00032"> │ │ │ │ +00001ff0: 3c73 7061 6e20 636c 6173 733d 226c 696e 32 publi │ │ │ │ +00002030: 633c 2f73 7061 6e3e 3a3c 2f64 6976 3e0a c:
    . │ │ │ │ +00002040: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    < │ │ │ │ +000020d0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +000020e0: 6e6f 223e 2020 2033 343c 2f73 7061 6e3e no"> 34 │ │ │ │ +000020f0: 2020 2020 2020 3c73 7061 6e20 636c 6173 usin │ │ │ │ +00002110: 6720 3c2f 7370 616e 3e76 616c 7565 5f74 g value_t │ │ │ │ +00002120: 7970 6520 3d20 3c73 7061 6e20 636c 6173 ype = type │ │ │ │ +00002140: 6e61 6d65 3c2f 7370 616e 3e20 4d3a 3a76 name M::v │ │ │ │ +00002150: 616c 7565 5f74 7970 653b 3c2f 6469 763e alue_type;
    │ │ │ │ +00002160: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00002190: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 35 using si │ │ │ │ +000021e0: 7a65 5f74 7970 6520 3d20 3c73 7061 6e20 ze_type = │ │ │ │ +00002200: 7479 7065 6e61 6d65 3c2f 7370 616e 3e20 typename │ │ │ │ +00002210: 4d3a 3a73 697a 655f 7479 7065 3b3c 2f64 M::size_type;.
    3 │ │ │ │ +00002270: 363c 2f73 7061 6e3e 203c 2f64 6976 3e0a 6
    . │ │ │ │ +00002280: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    │ │ │ │ +00002380: 2020 2033 383c 2f73 7061 6e3e 2020 2020 38 │ │ │ │ +00002390: 2020 2020 6d61 7472 6978 5f28 6d61 7472 matrix_(matr │ │ │ │ +000023a0: 6978 292c 3c2f 6469 763e 0a3c 6469 7620 ix),
    .
    39 │ │ │ │ +00002400: 2020 2020 2020 2063 6f6c 5f28 636f 6c29 col_(col) │ │ │ │ +00002410: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00002460: 2020 3430 3c2f 7370 616e 3e20 2020 2020 40 │ │ │ │ +00002470: 207b 7d3c 2f64 6976 3e0a 3c64 6976 2063 {}
    .
    41 < │ │ │ │ +000024d0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00002520: 2034 323c 2f73 7061 6e3e 2020 2020 2020 42 │ │ │ │ +00002530: 3c73 7061 6e20 636c 6173 733d 226b 6579 constexpr< │ │ │ │ +00002550: 2f73 7061 6e3e 2073 697a 655f 7479 7065 /span> size_type │ │ │ │ +00002560: 204e 2028 293c 7370 616e 2063 6c61 7373 N () cons │ │ │ │ +00002580: 7420 3c2f 7370 616e 3e7b 3c2f 6469 763e t {
    │ │ │ │ +00002590: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +000025c0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 43 return matrix_.N() │ │ │ │ +00002620: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +00002670: 2020 2034 343c 2f73 7061 6e3e 2020 2020 44 │ │ │ │ +00002680: 2020 7d3c 2f64 6976 3e0a 3c64 6976 2063 }
    .
    45 < │ │ │ │ +000026e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00002730: 2034 363c 2f73 7061 6e3e 2020 2020 2020 46 │ │ │ │ +00002740: 3c73 7061 6e20 636c 6173 733d 226b 6579 template<c │ │ │ │ +00002780: 6c61 7373 203c 2f73 7061 6e3e 4d5f 203d lass M_ = │ │ │ │ +00002790: 204d 2c3c 2f64 6976 3e0a 3c64 6976 2063 M,
    .
    47 │ │ │ │ +000027f0: 2020 2020 2020 7374 643a 3a65 6e61 626c std::enabl │ │ │ │ +00002800: 655f 6966 5f74 266c 743b 7374 643a 3a69 e_if_t<std::i │ │ │ │ +00002810: 735f 7361 6d65 5f76 266c 743b 4d5f 2c4d s_same_v<M_,M │ │ │ │ +00002820: 2667 743b 2061 6e64 206e 6f74 2073 7464 > and not std │ │ │ │ +00002830: 3a3a 6973 5f63 6f6e 7374 5f76 266c 743b ::is_const_v< │ │ │ │ +00002840: 4d5f 2667 743b 2c20 3c73 7061 6e20 636c M_>, int> │ │ │ │ +00002870: 203d 2030 2667 743b 3c2f 6469 763e 0a3c = 0>
    .< │ │ │ │ +00002880: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00002890: 3e3c 6120 6964 3d22 6c30 3030 3438 2220 > 48
    c │ │ │ │ +000028f0: 6f6e 7374 6578 7072 3c2f 7370 616e 3e20 onstexpr │ │ │ │ +00002900: 7661 6c75 655f 7479 7065 2661 6d70 3b20 value_type& │ │ │ │ +00002910: 6f70 6572 6174 6f72 5b5d 2028 7369 7a65 operator[] (size │ │ │ │ +00002920: 5f74 7970 6520 726f 7729 207b 3c2f 6469 _type row) {.
    49 │ │ │ │ +00002980: 3c2f 7370 616e 3e20 2020 2020 2020 203c < │ │ │ │ +00002990: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +000029a0: 6f72 6466 6c6f 7722 3e72 6574 7572 6e3c ordflow">return< │ │ │ │ +000029b0: 2f73 7061 6e3e 206d 6174 7269 785f 5b72 /span> matrix_[r │ │ │ │ +000029c0: 6f77 5d5b 636f 6c5f 5d3b 3c2f 6469 763e ow][col_];
    │ │ │ │ +000029d0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..
    53 │ │ │ │ +00002be0: 2020 2020 203c 7370 616e 2063 6c61 7373 r │ │ │ │ +00002c00: 6574 7572 6e3c 2f73 7061 6e3e 206d 6174 eturn mat │ │ │ │ +00002c10: 7269 785f 5b72 6f77 5d5b 636f 6c5f 5d3b rix_[row][col_]; │ │ │ │ +00002c20: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00002c70: 2020 3534 3c2f 7370 616e 3e20 2020 2020 54 │ │ │ │ +00002c80: 207d 3c2f 6469 763e 0a3c 6469 7620 636c }
    .
    55 .
    │ │ │ │ +00002d30: 3536 3c2f 7370 616e 3e20 2020 203c 7370 56 protected:
    .
    57 │ │ │ │ +00002dc0: 2020 2020 204d 2661 6d70 3b20 6d61 7472 M& matr │ │ │ │ +00002dd0: 6978 5f3b 3c2f 6469 763e 0a3c 6469 7620 ix_;
    .
    58 │ │ │ │ +00002e30: 2020 2020 203c 7370 616e 2063 6c61 7373 const │ │ │ │ +00002e50: 3c2f 7370 616e 3e20 7369 7a65 5f74 7970 size_typ │ │ │ │ +00002e60: 6520 636f 6c5f 3b3c 2f64 6976 3e0a 3c64 e col_;
    . │ │ │ │ +00002e80: 3c61 2069 643d 226c 3030 3035 3922 206e 59
    };
    .< │ │ │ │ +00002ed0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00002ee0: 3e3c 6120 6964 3d22 6c30 3030 3630 2220 > 60
    .
    61 │ │ │ │ +00002f80: 207d 3c2f 6469 763e 0a3c 6469 7620 636c }
    .
    62 .
    │ │ │ │ +00003030: 3633 3c2f 7370 616e 3e20 203c 7370 616e 63 template │ │ │ │ +00003060: 266c 743b 3c73 7061 6e20 636c 6173 733d <typena │ │ │ │ +00003080: 6d65 3c2f 7370 616e 3e20 4d26 6774 3b3c me M>< │ │ │ │ +00003090: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +000030e0: 2036 343c 2f73 7061 6e3e 2020 3c73 7061 64 struct │ │ │ │ +00003110: 4669 656c 6454 7261 6974 7326 6c74 3b20 FieldTraits< │ │ │ │ +00003120: 496d 706c 3a3a 436f 6c75 6d6e 5665 6374 Impl::ColumnVect │ │ │ │ +00003130: 6f72 5669 6577 266c 743b 4d26 6774 3b20 orView<M> │ │ │ │ +00003140: 2667 743b 3c2f 6469 763e 0a3c 6469 7620 >
    .
    65 │ │ │ │ +000031a0: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    ..
    │ │ │ │ +00003370: 2020 3637 3c2f 7370 616e 3e20 2020 203c 67 < │ │ │ │ +00003380: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00003390: 6f72 6422 3e75 7369 6e67 203c 2f73 7061 ord">using real_type │ │ │ │ +00003400: 3d20 3c73 7061 6e20 636c 6173 733d 226b = typename │ │ │ │ +00003420: 3c2f 7370 616e 3e20 3c61 2063 6c61 7373 FieldTra │ │ │ │ +00003480: 6974 7326 6c74 3b4d 2667 743b 3a3a 7265 its<M>::re │ │ │ │ +00003490: 616c 5f74 7970 653c 2f61 3e3b 3c2f 6469 al_type;.
    68 │ │ │ │ +000034f0: 3c2f 7370 616e 3e20 207d 3b3c 2f64 6976 };
    .
    69< │ │ │ │ +00003550: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
    . │ │ │ │ +00003570: 3c61 2069 643d 226c 3030 3038 3122 206e 81 templa │ │ │ │ +000035d0: 7465 3c2f 7370 616e 3e26 6c74 3b20 3c73 te< class │ │ │ │ +00003600: 204b 2c20 3c73 7061 6e20 636c 6173 733d K, in │ │ │ │ +00003620: 743c 2f73 7061 6e3e 2052 4f57 532c 203c t ROWS, < │ │ │ │ +00003630: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00003640: 6f72 6474 7970 6522 3e69 6e74 3c2f 7370 ordtype">int COLS = ROWS │ │ │ │ +00003660: 2667 743b 203c 7370 616e 2063 6c61 7373 > class │ │ │ │ +00003680: 203c 2f73 7061 6e3e 4669 656c 644d 6174 FieldMat │ │ │ │ +00003690: 7269 783b 3c2f 6469 763e 0a3c 6469 7620 rix;
    .
    82 │ │ │ │ +000036f0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00003740: 2020 3833 3c2f 7370 616e 3e20 3c2f 6469 83 .
    84 │ │ │ │ +000037a0: 3c2f 7370 616e 3e20 203c 7370 616e 2063 t │ │ │ │ +000037c0: 656d 706c 6174 653c 2f73 7061 6e3e 266c emplate&l │ │ │ │ +000037d0: 743b 203c 7370 616e 2063 6c61 7373 3d22 t; class K, int RO │ │ │ │ +00003820: 5753 2c20 3c73 7061 6e20 636c 6173 733d WS, in │ │ │ │ +00003840: 743c 2f73 7061 6e3e 2043 4f4c 5320 2667 t COLS &g │ │ │ │ +00003850: 743b 3c2f 6469 763e 0a3c 6469 7620 636c t;
    .
    . │ │ │ │ +000038a0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    86< │ │ │ │ +00003a30: 2f73 7061 6e3e 2020 7b3c 2f64 6976 3e0a /span> {
    . │ │ │ │ +00003a40: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .< │ │ │ │ +00003bd0: 6120 6964 3d22 6c30 3030 3838 2220 6e61 a id="l00088" na │ │ │ │ +00003be0: 6d65 3d22 6c30 3030 3838 223e 3c2f 613e me="l00088"> │ │ │ │ +00003bf0: 3c73 7061 6e20 636c 6173 733d 226c 696e 88
    .
    89 │ │ │ │ +00003c70: 203c 7370 616e 2063 6c61 7373 3d22 636f // each r │ │ │ │ +00003c90: 6f77 2069 7320 696d 706c 656d 656e 7465 ow is implemente │ │ │ │ +00003ca0: 6420 6279 2061 2066 6965 6c64 2076 6563 d by a field vec │ │ │ │ +00003cb0: 746f 723c 2f73 7061 6e3e 3c2f 6469 763e tor
    │ │ │ │ +00003cc0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00003cf0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d │ │ │ │ +00003d50: 2039 303c 2f61 3e3c 2f73 7061 6e3e 2020 90 │ │ │ │ +00003d60: 2020 3c73 7061 6e20 636c 6173 733d 226b typedef< │ │ │ │ +00003d80: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> FieldVector&l │ │ │ │ +00003dc0: 743b 4b2c 434f 4c53 2667 743b 3c2f 613e t;K,COLS> │ │ │ │ +00003dd0: 203c 6120 636c 6173 733d 2263 6f64 6520 row_type;.
    │ │ │ │ +00003e80: 3931 3c2f 7370 616e 3e20 3c2f 6469 763e 91
    │ │ │ │ +00003e90: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00003ec0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d │ │ │ │ +00003f20: 2039 323c 2f61 3e3c 2f73 7061 6e3e 2020 92 │ │ │ │ +00003f30: 2020 3c73 7061 6e20 636c 6173 733d 226b typedef< │ │ │ │ +00003f50: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> row_type │ │ │ │ +00003f90: 2661 6d70 3b3c 6120 636c 6173 733d 2263 &row_referen │ │ │ │ +00003ff0: 6365 3c2f 613e 3b3c 2f64 6976 3e0a 3c64 ce;
    . │ │ │ │ +00004010: 3c61 2069 643d 226c 3030 3039 3322 206e 93 │ │ │ │ +00004090: 3c2f 613e 3c2f 7370 616e 3e20 2020 203c < │ │ │ │ +000040a0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +000040b0: 6f72 6422 3e74 7970 6564 6566 3c2f 7370 ord">typedef const< │ │ │ │ +000040e0: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> row_type │ │ │ │ +00004120: 2661 6d70 3b3c 6120 636c 6173 733d 2263 &const_row_r │ │ │ │ +00004180: 6566 6572 656e 6365 3c2f 613e 3b3c 2f64 eference;.
    9 │ │ │ │ +000041e0: 343c 2f73 7061 6e3e 203c 2f64 6976 3e0a 4
    . │ │ │ │ +000041f0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +00004220: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> │ │ │ │ +00004280: 3935 3c2f 613e 3c2f 7370 616e 3e20 2020 95 │ │ │ │ +00004290: 203c 7370 616e 2063 6c61 7373 3d22 6b65 typedef std::array │ │ │ │ +000042c0: 266c 743b 726f 775f 7479 7065 2c52 4f57 <row_type,ROW │ │ │ │ +000042d0: 5326 6774 3b20 3c61 2063 6c61 7373 3d22 S> container_ │ │ │ │ +00004330: 7479 7065 3c2f 613e 3b3c 2f64 6976 3e0a type;
    . │ │ │ │ +00004340: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 . │ │ │ │ +00004480: 3c61 2069 643d 226c 3030 3039 3722 206e 97 │ │ │ │ +00004500: 3c2f 613e 3c2f 7370 616e 3e20 2020 203c < │ │ │ │ +00004510: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00004520: 6f72 6422 3e74 7970 6564 6566 3c2f 7370 ord">typedef typena │ │ │ │ +00004550: 6d65 3c2f 7370 616e 3e20 636f 6e74 6169 me contai │ │ │ │ +00004560: 6e65 725f 7479 7065 3a3a 7369 7a65 5f74 ner_type::size_t │ │ │ │ +00004570: 7970 6520 3c61 2063 6c61 7373 3d22 636f ype size_type;
    .
    98 } │ │ │ │ +00004630: 3b3c 2f64 6976 3e0a 3c2f 6469 763e 0a3c ;
    .
    .< │ │ │ │ +00004640: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00004650: 3e3c 6120 6964 3d22 6c30 3030 3939 2220 > 99
    .
    100 │ │ │ │ +000046f0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 template< │ │ │ │ +00004710: 2f73 7061 6e3e 266c 743b 203c 7370 616e /span>< class K, │ │ │ │ +00004740: 203c 7370 616e 2063 6c61 7373 3d22 6b65 int ROWS, int │ │ │ │ +00004790: 2043 4f4c 5320 2667 743b 3c2f 6469 763e COLS >
    │ │ │ │ +000047a0: 0a3c 6469 7620 636c 6173 733d 2266 6f6c .
    .
    │ │ │ │ +00004830: 3c61 2063 6c61 7373 3d22 6c69 6e65 2220 101 struc │ │ │ │ +00004880: 7420 3c2f 7370 616e 3e3c 6120 636c 6173 t FieldTrait │ │ │ │ +000048c0: 733c 2f61 3e26 6c74 3b20 3c61 2063 6c61 s< FieldMatri │ │ │ │ +00004900: 783c 2f61 3e26 6c74 3b4b 2c52 4f57 532c x<K,ROWS, │ │ │ │ +00004910: 434f 4c53 2667 743b 2026 6774 3b3c 2f64 COLS> >.
    10 │ │ │ │ +00004970: 323c 2f73 7061 6e3e 2020 7b3c 2f64 6976 2 {
    .
    │ │ │ │ +00004a10: 2031 3033 3c2f 613e 3c2f 7370 616e 3e20 103 │ │ │ │ +00004a20: 2020 203c 7370 616e 2063 6c61 7373 3d22 typedef │ │ │ │ +00004a40: 3c2f 7370 616e 3e20 3c73 7061 6e20 636c ty │ │ │ │ +00004a60: 7065 6e61 6d65 3c2f 7370 616e 3e20 3c61 pename Fi │ │ │ │ +00004ac0: 656c 6454 7261 6974 7326 6c74 3b4b 2667 eldTraits<K&g │ │ │ │ +00004ad0: 743b 3a3a 6669 656c 645f 7479 7065 3c2f t;::field_type field_type;
    .
    104< │ │ │ │ +00004be0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +00004c00: 7479 7065 6465 663c 2f73 7061 6e3e 203c typedef < │ │ │ │ +00004c10: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00004c20: 6f72 6422 3e74 7970 656e 616d 653c 2f73 ord">typename FieldTraits │ │ │ │ +00004c90: 266c 743b 4b26 6774 3b3a 3a72 6561 6c5f <K>::real_ │ │ │ │ +00004ca0: 7479 7065 3c2f 613e 203c 6120 636c 6173 type real_ty │ │ │ │ +00004d00: 7065 3c2f 613e 3b3c 2f64 6976 3e0a 3c64 pe;
    . │ │ │ │ +00004d20: 3c61 2069 643d 226c 3030 3130 3522 206e 105 };
    ..
    10 │ │ │ │ +00004dc0: 363c 2f73 7061 6e3e 203c 2f64 6976 3e0a 6
    . │ │ │ │ +00004dd0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +00004e00: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 115 temp │ │ │ │ +00004e40: 6c61 7465 3c2f 7370 616e 3e26 6c74 3b3c late<< │ │ │ │ +00004e50: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00004e60: 6f72 6422 3e63 6c61 7373 3c2f 7370 616e ord">class K, i │ │ │ │ +00004e90: 6e74 3c2f 7370 616e 3e20 524f 5753 2c20 nt ROWS, │ │ │ │ +00004ea0: 3c73 7061 6e20 636c 6173 733d 226b 6579 int COLS>.
    .
    116< │ │ │ │ +00004f90: 2f73 7061 6e3e 2020 3c73 7061 6e20 636c /span> cl │ │ │ │ +00004fb0: 6173 7320 3c2f 7370 616e 3e3c 6120 636c ass FieldMatr │ │ │ │ +00004ff0: 6978 3c2f 613e 203a 203c 7370 616e 2063 ix : p │ │ │ │ +00005010: 7562 6c69 633c 2f73 7061 6e3e 203c 6120 ublic DenseMa │ │ │ │ +00005050: 7472 6978 3c2f 613e 266c 743b 2046 6965 trix< Fie │ │ │ │ +00005060: 6c64 4d61 7472 6978 266c 743b 4b2c 524f ldMatrix<K,RO │ │ │ │ +00005070: 5753 2c43 4f4c 5326 6774 3b20 2667 743b WS,COLS> > │ │ │ │ +00005080: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000050d0: 2031 3137 3c2f 7370 616e 3e20 207b 3c2f 117 {.
    1 │ │ │ │ +00005130: 3138 3c2f 7370 616e 3e20 2020 2073 7464 18 std │ │ │ │ +00005140: 3a3a 6172 7261 7926 6c74 3b20 4669 656c ::array< Fiel │ │ │ │ +00005150: 6456 6563 746f 7226 6c74 3b4b 2c43 4f4c dVector<K,COL │ │ │ │ +00005160: 5326 6774 3b2c 2052 4f57 5320 2667 743b S>, ROWS > │ │ │ │ +00005170: 205f 6461 7461 3b3c 2f64 6976 3e0a 3c64 _data;
    . │ │ │ │ +00005190: 3c61 2069 643d 226c 3030 3131 3922 206e 119 type │ │ │ │ +000051f0: 6465 663c 2f73 7061 6e3e 203c 6120 636c def DenseMatr │ │ │ │ +00005230: 6978 266c 743b 2046 6965 6c64 4d61 7472 ix< FieldMatr │ │ │ │ +00005240: 6978 266c 743b 4b2c 524f 5753 2c43 4f4c ix<K,ROWS,COL │ │ │ │ +00005250: 5326 6774 3b3c 2f61 3e20 2667 743b 203c S> > < │ │ │ │ +00005260: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +00005270: 5f63 6c61 7373 2220 6872 6566 3d22 6130 _class" href="a0 │ │ │ │ +00005280: 3134 3030 2e68 746d 6c22 3e42 6173 653c 1400.html">Base< │ │ │ │ +00005290: 2f61 3e3b 3c2f 6469 763e 0a3c 6469 7620 /a>;
    .
    120 │ │ │ │ +000052f0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 public:
    .
    < │ │ │ │ +00005350: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00005360: 6e6f 223e 2020 3132 313c 2f73 7061 6e3e no"> 121 │ │ │ │ +00005370: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ +000053c0: 3c61 2063 6c61 7373 3d22 6c69 6e65 2220 123 c │ │ │ │ +00005430: 6f6e 7374 6578 7072 3c2f 7370 616e 3e20 onstexpr │ │ │ │ +00005440: 3c73 7061 6e20 636c 6173 733d 226b 6579 static in │ │ │ │ +00005480: 743c 2f73 7061 6e3e 203c 6120 636c 6173 t rows = ROWS;
    │ │ │ │ +000054f0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00005520: 3c2f 613e 3c73 7061 6e20 636c 6173 733d │ │ │ │ +00005580: 3132 353c 2f61 3e3c 2f73 7061 6e3e 2020 125 │ │ │ │ +00005590: 2020 3c73 7061 6e20 636c 6173 733d 226b constexp │ │ │ │ +000055b0: 723c 2f73 7061 6e3e 203c 7370 616e 2063 r s │ │ │ │ +000055d0: 7461 7469 633c 2f73 7061 6e3e 203c 7370 tatic int cols = CO │ │ │ │ +00005660: 4c53 3b3c 2f64 6976 3e0a 3c64 6976 2063 LS;
    .
    126 < │ │ │ │ 000056c0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ -00005710: 3238 373c 2f73 7061 6e3e 2020 2020 2020 287 │ │ │ │ -00005720: 3c61 2063 6c61 7373 3d22 636f 6465 2068 FloatCmp::R │ │ │ │ -00005780: 6f75 6e64 696e 6753 7479 6c65 3c2f 613e oundingStyle │ │ │ │ -00005790: 2072 7374 796c 655f 203d 203c 6120 636c rstyle_ = │ │ │ │ -00005810: 466c 6f61 7443 6d70 3a3a 6465 6661 756c FloatCmp::defaul │ │ │ │ -00005820: 7452 6f75 6e64 696e 6753 7479 6c65 3c2f tRoundingStyle>
    ..
    │ │ │ │ -000058f0: 2032 3838 3c2f 613e 3c2f 7370 616e 3e20 288 │ │ │ │ -00005900: 203c 7370 616e 2063 6c61 7373 3d22 6b65 class │ │ │ │ -00005950: 466c 6f61 7443 6d70 4f70 733c 2f61 3e20 FloatCmpOps │ │ │ │ -00005960: 7b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 {
    .
    │ │ │ │ -000059b0: 2020 3238 393c 2f73 7061 6e3e 2020 2020 289 │ │ │ │ -000059c0: 3c73 7061 6e20 636c 6173 733d 226b 6579 typedef FloatC │ │ │ │ -00005a40: 6d70 3a3a 436d 7053 7479 6c65 3c2f 613e mp::CmpStyle │ │ │ │ -00005a50: 203c 6120 636c 6173 733d 2263 6f64 6520 CmpStyle;
    .
    290 │ │ │ │ -00005b10: 2020 3c73 7061 6e20 636c 6173 733d 226b typedef< │ │ │ │ -00005b30: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> Floa │ │ │ │ -00005b90: 7443 6d70 3a3a 526f 756e 6469 6e67 5374 tCmp::RoundingSt │ │ │ │ -00005ba0: 796c 653c 2f61 3e20 3c61 2063 6c61 7373 yle Rou │ │ │ │ -00005c00: 6e64 696e 6753 7479 6c65 3c2f 613e 3b3c ndingStyle;< │ │ │ │ -00005c10: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ -00005c60: 3239 313c 2f73 7061 6e3e 203c 2f64 6976 291
    .
    292< │ │ │ │ -00005cc0: 2f73 7061 6e3e 2020 3c73 7061 6e20 636c /span> pu │ │ │ │ -00005ce0: 626c 6963 3c2f 7370 616e 3e3a 3c2f 6469 blic:.
    293 │ │ │ │ -00005d40: 3c2f 7370 616e 3e20 2020 203c 7370 616e // record templ │ │ │ │ -00005d70: 6174 6520 7061 7261 6d65 7465 7273 3c2f ate parameters
    .
    < │ │ │ │ -00005dc0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00005dd0: 6e6f 223e 3c61 2063 6c61 7373 3d22 6c69 no"> 295 static │ │ │ │ -00005e50: 203c 7370 616e 2063 6c61 7373 3d22 6b65 const CmpStyl │ │ │ │ -00005ed0: 653c 2f61 3e20 3c61 2063 6c61 7373 3d22 e cstyle = cstyle_;.
    │ │ │ │ -00005fd0: 2020 3239 373c 2f61 3e3c 2f73 7061 6e3e 297 │ │ │ │ -00005fe0: 2020 2020 3c73 7061 6e20 636c 6173 733d static │ │ │ │ -00006000: 3c2f 7370 616e 3e20 3c73 7061 6e20 636c co │ │ │ │ -00006020: 6e73 743c 2f73 7061 6e3e 203c 6120 636c nst │ │ │ │ -00006080: 526f 756e 6469 6e67 5374 796c 653c 2f61 RoundingStyle rstyle = │ │ │ │ -000060f0: 7273 7479 6c65 5f3b 3c2f 6469 763e 0a3c rstyle_;
    .< │ │ │ │ -00006100: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00006110: 3e3c 6120 6964 3d22 6c30 3032 3939 2220 > 29 │ │ │ │ -00006190: 393c 2f61 3e3c 2f73 7061 6e3e 2020 2020 9 │ │ │ │ -000061a0: 3c73 7061 6e20 636c 6173 733d 226b 6579 typedef T ValueType │ │ │ │ -00006220: 3c2f 613e 3b3c 2f64 6976 3e0a 3c64 6976 ;
    .
    < │ │ │ │ -00006260: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00006270: 6e6f 223e 2020 3330 313c 2f73 7061 6e3e no"> 301 │ │ │ │ -00006280: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ -000062d0: 3c61 2063 6c61 7373 3d22 6c69 6e65 2220 304 t │ │ │ │ -00006340: 7970 6564 6566 3c2f 7370 616e 3e20 3c73 ypedef typename FloatCmp::Ep │ │ │ │ -000063d0: 7369 6c6f 6e54 7970 6526 6c74 3b54 2667 silonType<T&g │ │ │ │ -000063e0: 743b 3a3a 5479 7065 3c2f 613e 203c 6120 t;::Type Eps │ │ │ │ -00006440: 696c 6f6e 5479 7065 3c2f 613e 3b3c 2f64 ilonType;.
    30 │ │ │ │ -000064a0: 353c 2f73 7061 6e3e 203c 2f64 6976 3e0a 5
    . │ │ │ │ -000064b0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    307< │ │ │ │ -00006580: 2f73 7061 6e3e 2020 2020 3c61 2063 6c61 /span> Epsilo │ │ │ │ -000065e0: 6e54 7970 653c 2f61 3e20 6570 7369 6c6f nType epsilo │ │ │ │ -000065f0: 6e5f 3b3c 2f64 6976 3e0a 3c64 6976 2063 n_;
    .
    308 < │ │ │ │ -00006650: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>..< │ │ │ │ -00006780: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00006790: 3e3c 6120 6964 3d22 6c30 3033 3130 2220 > 310
    .
    311 │ │ │ │ -00006830: 203c 7370 616e 2063 6c61 7373 3d22 6b65 public:
    .
    < │ │ │ │ -00006890: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -000068a0: 6e6f 223e 2020 3331 333c 2f73 7061 6e3e no"> 313 │ │ │ │ -000068b0: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .. │ │ │ │ -00006a80: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ -00006b10: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00006b20: 6e6f 223e 2020 3331 393c 2f73 7061 6e3e no"> 319 │ │ │ │ -00006b30: 2020 2020 3c61 2063 6c61 7373 3d22 636f EpsilonType< │ │ │ │ -00006b90: 2f61 3e20 3c61 2063 6c61 7373 3d22 636f /a> epsilon │ │ │ │ -00006bf0: 2829 203c 7370 616e 2063 6c61 7373 3d22 () const;
    .< │ │ │ │ -00006c30: 6120 6964 3d22 6c30 3033 3231 2220 6e61 a id="l00321" na │ │ │ │ -00006c40: 6d65 3d22 6c30 3033 3231 223e 3c2f 613e me="l00321"> │ │ │ │ -00006c50: 3c73 7061 6e20 636c 6173 733d 226c 696e 321 v │ │ │ │ -00006c90: 6f69 643c 2f73 7061 6e3e 203c 6120 636c oid epsi │ │ │ │ -00006cf0: 6c6f 6e3c 2f61 3e28 3c61 2063 6c61 7373 lon(EpsilonT │ │ │ │ -00006d50: 7970 653c 2f61 3e20 6570 7369 6c6f 6e5f ype epsilon_ │ │ │ │ -00006d60: 5f29 3b3c 2f64 6976 3e0a 3c64 6976 2063 _);
    .
    322 < │ │ │ │ -00006dc0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ -00006e10: 3332 343c 2f73 7061 6e3e 2020 2020 3c73 324 bool eq(const < │ │ │ │ -00006ec0: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ -00006ed0: 5f74 7970 6564 6566 2220 6872 6566 3d22 _typedef" href=" │ │ │ │ -00006ee0: 6130 3137 3230 2e68 746d 6c23 6164 3233 a01720.html#ad23 │ │ │ │ -00006ef0: 3035 6537 6530 3531 3431 6631 3634 3730 05e7e05141f16470 │ │ │ │ -00006f00: 6164 3163 3431 3738 3833 3463 3222 3e56 ad1c4178834c2">V │ │ │ │ -00006f10: 616c 7565 5479 7065 3c2f 613e 2026 616d alueType &am │ │ │ │ -00006f20: 703b 6669 7273 742c 203c 7370 616e 2063 p;first, c │ │ │ │ -00006f40: 6f6e 7374 3c2f 7370 616e 3e20 3c61 2063 onst Valu │ │ │ │ -00006fa0: 6554 7970 653c 2f61 3e20 2661 6d70 3b73 eType &s │ │ │ │ -00006fb0: 6563 6f6e 6429 203c 7370 616e 2063 6c61 econd) con │ │ │ │ -00006fd0: 7374 3c2f 7370 616e 3e3b 3c2f 6469 763e st;
    │ │ │ │ -00006fe0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ -00007050: 6120 6964 3d22 6c30 3033 3239 2220 6e61 a id="l00329" na │ │ │ │ -00007060: 6d65 3d22 6c30 3033 3239 223e 3c2f 613e me="l00329"> │ │ │ │ -00007070: 3c73 7061 6e20 636c 6173 733d 226c 696e 329 b │ │ │ │ -000070b0: 6f6f 6c3c 2f73 7061 6e3e 203c 6120 636c ool ne(const ValueType< │ │ │ │ -00007190: 2f61 3e20 2661 6d70 3b66 6972 7374 2c20 /a> &first, │ │ │ │ -000071a0: 3c73 7061 6e20 636c 6173 733d 226b 6579 const ValueType │ │ │ │ -00007220: 2026 616d 703b 7365 636f 6e64 2920 3c73 &second) const │ │ │ │ -00007250: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ -000072a0: 2020 3333 313c 2f73 7061 6e3e 203c 2f64 331 .
    33 │ │ │ │ -00007300: 353c 2f73 7061 6e3e 2020 2020 3c73 7061 5 bool gt( │ │ │ │ -000073a0: 636f 6e73 743c 2f73 7061 6e3e 203c 6120 const Val │ │ │ │ -00007400: 7565 5479 7065 3c2f 613e 2026 616d 703b ueType & │ │ │ │ -00007410: 6669 7273 742c 203c 7370 616e 2063 6c61 first, con │ │ │ │ -00007430: 7374 3c2f 7370 616e 3e20 3c61 2063 6c61 st ValueT │ │ │ │ -00007490: 7970 653c 2f61 3e20 2661 6d70 3b73 6563 ype &sec │ │ │ │ -000074a0: 6f6e 6429 203c 7370 616e 2063 6c61 7373 ond) const │ │ │ │ -000074c0: 3c2f 7370 616e 3e3b 3c2f 6469 763e 0a3c ;
    .< │ │ │ │ -000074d0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -000074e0: 3e3c 6120 6964 3d22 6c30 3033 3337 2220 > 337
    .
    341 │ │ │ │ -00007580: 2020 203c 7370 616e 2063 6c61 7373 3d22 boo │ │ │ │ -000075a0: 6c3c 2f73 7061 6e3e 203c 6120 636c 6173 l lt │ │ │ │ -00007600: 283c 7370 616e 2063 6c61 7373 3d22 6b65 (const ValueType &first, const │ │ │ │ -000076b0: 203c 6120 636c 6173 733d 2263 6f64 6520 ValueType & │ │ │ │ -00007710: 616d 703b 7365 636f 6e64 2920 3c73 7061 amp;second) const;< │ │ │ │ -00007740: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ -00007790: 3334 333c 2f73 7061 6e3e 203c 2f64 6976 343
    .
    347< │ │ │ │ -000077f0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> bool │ │ │ │ -00007820: 3c61 2063 6c61 7373 3d22 636f 6465 2068 ge(co │ │ │ │ -00007890: 6e73 743c 2f73 7061 6e3e 203c 6120 636c nst Value │ │ │ │ -000078f0: 5479 7065 3c2f 613e 2026 616d 703b 6669 Type &fi │ │ │ │ -00007900: 7273 742c 203c 7370 616e 2063 6c61 7373 rst, const │ │ │ │ -00007920: 3c2f 7370 616e 3e20 3c61 2063 6c61 7373 ValueTyp │ │ │ │ -00007980: 653c 2f61 3e20 2661 6d70 3b73 6563 6f6e e &secon │ │ │ │ -00007990: 6429 203c 7370 616e 2063 6c61 7373 3d22 d) const;
    .< │ │ │ │ -000079d0: 6120 6964 3d22 6c30 3033 3439 2220 6e61 a id="l00349" na │ │ │ │ -000079e0: 6d65 3d22 6c30 3033 3439 223e 3c2f 613e me="l00349"> │ │ │ │ -000079f0: 3c73 7061 6e20 636c 6173 733d 226c 696e 349
    .
    353 │ │ │ │ -00007a70: 203c 7370 616e 2063 6c61 7373 3d22 6b65 bool< │ │ │ │ -00007a90: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> le(< │ │ │ │ -00007af0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00007b00: 6f72 6422 3e63 6f6e 7374 3c2f 7370 616e ord">const ValueType │ │ │ │ -00007b70: 2661 6d70 3b66 6972 7374 2c20 3c73 7061 &first, const < │ │ │ │ -00007ba0: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ -00007bb0: 5f74 7970 6564 6566 2220 6872 6566 3d22 _typedef" href=" │ │ │ │ -00007bc0: 6130 3137 3230 2e68 746d 6c23 6164 3233 a01720.html#ad23 │ │ │ │ -00007bd0: 3035 6537 6530 3531 3431 6631 3634 3730 05e7e05141f16470 │ │ │ │ -00007be0: 6164 3163 3431 3738 3833 3463 3222 3e56 ad1c4178834c2">V │ │ │ │ -00007bf0: 616c 7565 5479 7065 3c2f 613e 2026 616d alueType &am │ │ │ │ -00007c00: 703b 7365 636f 6e64 2920 3c73 7061 6e20 p;second) │ │ │ │ -00007c20: 636f 6e73 743c 2f73 7061 6e3e 3b3c 2f64 const;.
    35 │ │ │ │ -00007c80: 343c 2f73 7061 6e3e 203c 2f64 6976 3e0a 4
    . │ │ │ │ -00007c90: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ -00007d20: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00007d30: 6e6f 223e 2020 3336 353c 2f73 7061 6e3e no"> 365 │ │ │ │ -00007d40: 2020 2020 3c73 7061 6e20 636c 6173 733d templa │ │ │ │ -00007d60: 7465 3c2f 7370 616e 3e26 6c74 3b3c 7370 te<class │ │ │ │ -00007d90: 4926 6774 3b3c 2f64 6976 3e0a 3c64 6976 I>
    .
    < │ │ │ │ -00007dd0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00007de0: 6e6f 223e 2020 3336 363c 2f73 7061 6e3e no"> 366 │ │ │ │ -00007df0: 2020 2020 4920 3c61 2063 6c61 7373 3d22 I round │ │ │ │ -00007e50: 283c 7370 616e 2063 6c61 7373 3d22 6b65 (const ValueType &val) const;< │ │ │ │ -00007f00: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ -00007f50: 3336 373c 2f73 7061 6e3e 203c 2f64 6976 367
    .
    369< │ │ │ │ -00007fb0: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
    . │ │ │ │ -00007fd0: 3c61 2069 643d 226c 3030 3337 3822 206e 378 temp │ │ │ │ -00008030: 6c61 7465 3c2f 7370 616e 3e26 6c74 3b3c late<< │ │ │ │ -00008040: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00008050: 6f72 6422 3e63 6c61 7373 3c2f 7370 616e ord">class I>
    . │ │ │ │ -00008080: 3c61 2069 643d 226c 3030 3337 3922 206e 379 I trunc(const ValueType< │ │ │ │ -000081a0: 2f61 3e20 2661 6d70 3b76 616c 2920 3c73 /a> &val) const │ │ │ │ -000081d0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ -00008220: 2020 3338 303c 2f73 7061 6e3e 203c 2f64 380 .
    38 │ │ │ │ -00008280: 313c 2f73 7061 6e3e 2020 7d3b 3c2f 6469 1 };.
    .
    382 < │ │ │ │ -000082f0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ -00008340: 3338 333c 2f73 7061 6e3e 7d20 3c73 7061 383} //namespace Du │ │ │ │ -00008370: 6e65 3c2f 7370 616e 3e3c 2f64 6976 3e0a ne
    . │ │ │ │ -00008380: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ -00008410: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00008420: 6e6f 223e 2020 3338 353c 2f73 7061 6e3e no"> 385 │ │ │ │ -00008430: 3c73 7061 6e20 636c 6173 733d 2270 7265 #incl │ │ │ │ -00008450: 7564 6520 2671 756f 743b 3c61 2063 6c61 ude "flo │ │ │ │ -00008480: 6174 5f63 6d70 2e63 633c 2f61 3e26 7175 at_cmp.cc&qu │ │ │ │ -00008490: 6f74 3b3c 2f73 7061 6e3e 3c2f 6469 763e ot;
    │ │ │ │ -000084a0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ -00008510: 6120 6964 3d22 6c30 3033 3837 2220 6e61 a id="l00387" na │ │ │ │ -00008520: 6d65 3d22 6c30 3033 3837 223e 3c2f 613e me="l00387"> │ │ │ │ -00008530: 3c73 7061 6e20 636c 6173 733d 226c 696e 387#end │ │ │ │ -00008570: 6966 203c 2f73 7061 6e3e 3c73 7061 6e20 if │ │ │ │ -00008590: 2f2f 4455 4e45 5f43 4f4d 4d4f 4e5f 464c //DUNE_COMMON_FL │ │ │ │ -000085a0: 4f41 545f 434d 505f 4848 3c2f 7370 616e OAT_CMP_HH
    .
    < │ │ │ │ -000085f0: 6120 6872 6566 3d22 6130 3031 3730 2e68 a href="a00170.h │ │ │ │ -00008600: 746d 6c22 3e66 6c6f 6174 5f63 6d70 2e63 tml">float_cmp.c │ │ │ │ -00008610: 633c 2f61 3e3c 2f64 6976 3e3c 2f64 6976 c
    .
    bool ne(con │ │ │ │ -000086f0: 7374 2054 2026 616d 703b 6669 7273 742c st T &first, │ │ │ │ -00008700: 2063 6f6e 7374 2054 2026 616d 703b 7365 const T &se │ │ │ │ -00008710: 636f 6e64 2c20 7479 7065 6e61 6d65 2045 cond, typename E │ │ │ │ -00008720: 7073 696c 6f6e 5479 7065 266c 743b 2054 psilonType< T │ │ │ │ -00008730: 2026 6774 3b3a 3a54 7970 6520 6570 7369 >::Type epsi │ │ │ │ -00008740: 6c6f 6e29 3c2f 6469 763e 3c64 6976 2063 lon)
    tes │ │ │ │ -00008760: 7420 666f 7220 696e 6571 7561 6c69 7479 t for inequality │ │ │ │ -00008770: 2075 7369 6e67 2065 7073 696c 6f6e 3c2f using epsilon
    Defini │ │ │ │ -000087a0: 7469 6f6e 3c2f 623e 2066 6c6f 6174 5f63 tion float_c │ │ │ │ -000087b0: 6d70 2e63 633a 3135 313c 2f64 6976 3e3c mp.cc:151
    < │ │ │ │ -000087c0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    C │ │ │ │ -00008890: 6d70 5374 796c 653c 2f64 6976 3e3c 6469 mpStyle
    │ │ │ │ -000088b0: 3c62 3e44 6566 696e 6974 696f 6e3c 2f62 Definition float_cmp.hh:1 │ │ │ │ -000088d0: 3034 3c2f 6469 763e 3c2f 6469 763e 0a3c 04
    .< │ │ │ │ -000088e0: 6469 7620 636c 6173 733d 2274 7463 2220 div class="ttc" │ │ │ │ -000088f0: 6964 3d22 6161 3030 3430 395f 6874 6d6c id="aa00409_html │ │ │ │ -00008900: 5f67 6135 3063 3933 6536 3933 6631 3032 _ga50c93e693f102 │ │ │ │ -00008910: 3239 3863 3631 6563 6231 3437 3538 6638 298c61ecb14758f8 │ │ │ │ -00008920: 6435 6222 3e3c 6469 7620 636c 6173 733d d5b">bool eq(const │ │ │ │ -000089b0: 5420 2661 6d70 3b66 6972 7374 2c20 636f T &first, co │ │ │ │ -000089c0: 6e73 7420 5420 2661 6d70 3b73 6563 6f6e nst T &secon │ │ │ │ -000089d0: 642c 2074 7970 656e 616d 6520 4570 7369 d, typename Epsi │ │ │ │ -000089e0: 6c6f 6e54 7970 6526 6c74 3b20 5420 2667 lonType< T &g │ │ │ │ -000089f0: 743b 3a3a 5479 7065 2065 7073 696c 6f6e t;::Type epsilon │ │ │ │ -00008a00: 293c 2f64 6976 3e3c 6469 7620 636c 6173 )
    test f │ │ │ │ -00008a20: 6f72 2065 7175 616c 6974 7920 7573 696e or equality usin │ │ │ │ -00008a30: 6720 6570 7369 6c6f 6e3c 2f64 6976 3e3c g epsilon
    < │ │ │ │ -00008a40: 6469 7620 636c 6173 733d 2274 7464 6566 div class="ttdef │ │ │ │ -00008a50: 223e 3c62 3e44 6566 696e 6974 696f 6e3c ">Definition< │ │ │ │ -00008a60: 2f62 3e20 666c 6f61 745f 636d 702e 6363 /b> float_cmp.cc │ │ │ │ -00008a70: 3a31 3434 3c2f 6469 763e 3c2f 6469 763e :144
    │ │ │ │ -00008a80: 0a3c 6469 7620 636c 6173 733d 2274 7463 .
    Dune::FloatC │ │ │ │ -00008b20: 6d70 3a3a 726f 756e 643c 2f61 3e3c 2f64 mp::round
    I round(c │ │ │ │ -00008b50: 6f6e 7374 2054 2026 616d 703b 7661 6c2c onst T &val, │ │ │ │ -00008b60: 2074 7970 656e 616d 6520 4570 7369 6c6f typename Epsilo │ │ │ │ -00008b70: 6e54 7970 6526 6c74 3b20 5420 2667 743b nType< T > │ │ │ │ -00008b80: 3a3a 5479 7065 2065 7073 696c 6f6e 293c ::Type epsilon)< │ │ │ │ -00008b90: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    round us │ │ │ │ -00008bb0: 696e 6720 6570 7369 6c6f 6e3c 2f64 6976 ing epsilon
    Definitio │ │ │ │ -00008be0: 6e3c 2f62 3e20 666c 6f61 745f 636d 702e n float_cmp. │ │ │ │ -00008bf0: 6363 3a33 3131 3c2f 6469 763e 3c2f 6469 cc:311
    .
    Dune::Floa │ │ │ │ -00008ca0: 7443 6d70 3a3a 7472 756e 633c 2f61 3e3c tCmp::trunc< │ │ │ │ -00008cb0: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    I trunc │ │ │ │ -00008cd0: 2863 6f6e 7374 2054 2026 616d 703b 7661 (const T &va │ │ │ │ -00008ce0: 6c2c 2074 7970 656e 616d 6520 4570 7369 l, typename Epsi │ │ │ │ -00008cf0: 6c6f 6e54 7970 6526 6c74 3b20 5420 2667 lonType< T &g │ │ │ │ -00008d00: 743b 3a3a 5479 7065 2065 7073 696c 6f6e t;::Type epsilon │ │ │ │ -00008d10: 293c 2f64 6976 3e3c 6469 7620 636c 6173 )
    trunca │ │ │ │ -00008d30: 7465 2075 7369 6e67 2065 7073 696c 6f6e te using epsilon │ │ │ │ -00008d40: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    Defi │ │ │ │ -00008d60: 6e69 7469 6f6e 3c2f 623e 2066 6c6f 6174 nition float │ │ │ │ -00008d70: 5f63 6d70 2e63 633a 3430 373c 2f64 6976 _cmp.cc:407
    .
    Dune: │ │ │ │ -00008e20: 3a46 6c6f 6174 436d 703a 3a52 6f75 6e64 :FloatCmp::Round │ │ │ │ -00008e30: 696e 6753 7479 6c65 3c2f 613e 3c2f 6469 ingStyle
    RoundingSt │ │ │ │ -00008e60: 796c 653c 2f64 6976 3e3c 6469 7620 636c yle
    D │ │ │ │ -00008e80: 6566 696e 6974 696f 6e3c 2f62 3e20 666c efinition fl │ │ │ │ -00008e90: 6f61 745f 636d 702e 6868 3a31 3136 3c2f oat_cmp.hh:116
    .
    bo │ │ │ │ -00008f70: 6f6c 206c 7428 636f 6e73 7420 5420 2661 ol lt(const T &a │ │ │ │ -00008f80: 6d70 3b66 6972 7374 2c20 636f 6e73 7420 mp;first, const │ │ │ │ -00008f90: 5420 2661 6d70 3b73 6563 6f6e 642c 2074 T &second, t │ │ │ │ -00008fa0: 7970 656e 616d 6520 4570 7369 6c6f 6e54 ypename EpsilonT │ │ │ │ -00008fb0: 7970 6526 6c74 3b20 5420 2667 743b 3a3a ype< T >:: │ │ │ │ -00008fc0: 5479 7065 2065 7073 696c 6f6e 293c 2f64 Type epsilon)
    test if fi │ │ │ │ -00008ff0: 7273 7420 6c65 7373 6572 2074 6861 6e20 rst lesser than │ │ │ │ -00009000: 7365 636f 6e64 3c2f 6469 763e 3c64 6976 second
    < │ │ │ │ -00009020: 623e 4465 6669 6e69 7469 6f6e 3c2f 623e b>Definition │ │ │ │ -00009030: 2066 6c6f 6174 5f63 6d70 2e63 633a 3136 float_cmp.cc:16 │ │ │ │ -00009040: 353c 2f64 6976 3e3c 2f64 6976 3e0a 3c64 5
    .bool gt(const T │ │ │ │ -00009120: 2026 616d 703b 6669 7273 742c 2063 6f6e &first, con │ │ │ │ -00009130: 7374 2054 2026 616d 703b 7365 636f 6e64 st T &second │ │ │ │ -00009140: 2c20 7479 7065 6e61 6d65 2045 7073 696c , typename Epsil │ │ │ │ -00009150: 6f6e 5479 7065 266c 743b 2054 2026 6774 onType< T > │ │ │ │ -00009160: 3b3a 3a54 7970 6520 6570 7369 6c6f 6e29 ;::Type epsilon) │ │ │ │ -00009170: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    test if │ │ │ │ -00009190: 2066 6972 7374 2067 7265 6174 6572 2074 first greater t │ │ │ │ -000091a0: 6861 6e20 7365 636f 6e64 3c2f 6469 763e han second
    │ │ │ │ -000091b0: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    Definition │ │ │ │ -000091d0: 3c2f 623e 2066 6c6f 6174 5f63 6d70 2e63 float_cmp.c │ │ │ │ -000091e0: 633a 3135 383c 2f64 6976 3e3c 2f64 6976 c:158
    .
    bool ge(con │ │ │ │ -000092c0: 7374 2054 2026 616d 703b 6669 7273 742c st T &first, │ │ │ │ -000092d0: 2063 6f6e 7374 2054 2026 616d 703b 7365 const T &se │ │ │ │ -000092e0: 636f 6e64 2c20 7479 7065 6e61 6d65 2045 cond, typename E │ │ │ │ -000092f0: 7073 696c 6f6e 5479 7065 266c 743b 2054 psilonType< T │ │ │ │ -00009300: 2026 6774 3b3a 3a54 7970 6520 6570 7369 >::Type epsi │ │ │ │ -00009310: 6c6f 6e29 3c2f 6469 763e 3c64 6976 2063 lon)
    tes │ │ │ │ -00009330: 7420 6966 2066 6972 7374 2067 7265 6174 t if first great │ │ │ │ -00009340: 6572 206f 7220 6571 7561 6c20 7365 636f er or equal seco │ │ │ │ -00009350: 6e64 3c2f 6469 763e 3c64 6976 2063 6c61 nd
    De │ │ │ │ -00009370: 6669 6e69 7469 6f6e 3c2f 623e 2066 6c6f finition flo │ │ │ │ -00009380: 6174 5f63 6d70 2e63 633a 3137 323c 2f64 at_cmp.cc:172
    . │ │ │ │ -00009540: 0a3c 6469 7620 636c 6173 733d 2274 7463 .
    @ defaultCm │ │ │ │ -00009660: 7053 7479 6c65 3c2f 6469 763e 3c64 6976 pStyle
    t │ │ │ │ -00009680: 6865 2067 6c6f 6261 6c20 6465 6661 756c he global defaul │ │ │ │ -00009690: 7420 636f 6d70 6172 6520 7374 796c 6520 t compare style │ │ │ │ -000096a0: 2872 656c 6174 6976 655f 7765 616b 293c (relative_weak)< │ │ │ │ -000096b0: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ -000096d0: 6974 696f 6e3c 2f62 3e20 666c 6f61 745f ition float_ │ │ │ │ -000096e0: 636d 702e 6868 3a31 3132 3c2f 6469 763e cmp.hh:112
    │ │ │ │ -000096f0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    < │ │ │ │ -00009760: 6469 7620 636c 6173 733d 2274 746e 616d div class="ttnam │ │ │ │ -00009770: 6522 3e3c 6120 6872 6566 3d22 6130 3034 e">Du │ │ │ │ -000097d0: 6e65 3a3a 466c 6f61 7443 6d70 3a3a 7265 ne::FloatCmp::re │ │ │ │ -000097e0: 6c61 7469 7665 5374 726f 6e67 3c2f 613e lativeStrong │ │ │ │ -000097f0: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    @ rela │ │ │ │ -00009810: 7469 7665 5374 726f 6e67 3c2f 6469 763e tiveStrong
    │ │ │ │ -00009820: 3c64 6976 2063 6c61 7373 3d22 7474 646f
    |a-b|/|a| < │ │ │ │ -00009840: 3b3d 2065 7073 696c 6f6e 2026 616d 703b ;= epsilon & │ │ │ │ -00009850: 2661 6d70 3b20 7c61 2d62 7c2f 7c62 7c20 & |a-b|/|b| │ │ │ │ -00009860: 266c 743b 3d20 6570 7369 6c6f 6e3c 2f64 <= epsilon
    Definit │ │ │ │ -00009890: 696f 6e3c 2f62 3e20 666c 6f61 745f 636d ion float_cm │ │ │ │ -000098a0: 702e 6868 3a31 3038 3c2f 6469 763e 3c2f p.hh:108
    .
    Dune │ │ │ │ -00009990: 3a3a 466c 6f61 7443 6d70 3a3a 7265 6c61 ::FloatCmp::rela │ │ │ │ -000099a0: 7469 7665 5765 616b 3c2f 613e 3c2f 6469 tiveWeak
    @ relative │ │ │ │ -000099d0: 5765 616b 3c2f 6469 763e 3c64 6976 2063 Weak
    |a- │ │ │ │ -000099f0: 627c 2f7c 617c 2026 6c74 3b3d 2065 7073 b|/|a| <= eps │ │ │ │ -00009a00: 696c 6f6e 207c 7c20 7c61 2d62 7c2f 7c62 ilon || |a-b|/|b │ │ │ │ -00009a10: 7c20 266c 743b 3d20 6570 7369 6c6f 6e3c | <= epsilon< │ │ │ │ -00009a20: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ -00009a40: 6974 696f 6e3c 2f62 3e20 666c 6f61 745f ition float_ │ │ │ │ -00009a50: 636d 702e 6868 3a31 3036 3c2f 6469 763e cmp.hh:106
    │ │ │ │ -00009a60: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    < │ │ │ │ -00009ad0: 6469 7620 636c 6173 733d 2274 746e 616d div class="ttnam │ │ │ │ -00009ae0: 6522 3e3c 6120 6872 6566 3d22 6130 3034 e">Du │ │ │ │ -00009b40: 6e65 3a3a 466c 6f61 7443 6d70 3a3a 6162 ne::FloatCmp::ab │ │ │ │ -00009b50: 736f 6c75 7465 3c2f 613e 3c2f 6469 763e solute
    │ │ │ │ -00009b60: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    @ absolute
    |a-b| < │ │ │ │ -00009ba0: 3b3d 2065 7073 696c 6f6e 3c2f 6469 763e ;= epsilon
    │ │ │ │ -00009bb0: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    Definition │ │ │ │ -00009bd0: 3c2f 623e 2066 6c6f 6174 5f63 6d70 2e68 float_cmp.h │ │ │ │ -00009be0: 683a 3131 303c 2f64 6976 3e3c 2f64 6976 h:110
    .
    @ towardZero
    always rou │ │ │ │ -00009d30: 6e64 2074 6f77 6172 6420 303c 2f64 6976 nd toward 0
    Definitio │ │ │ │ -00009d60: 6e3c 2f62 3e20 666c 6f61 745f 636d 702e n float_cmp. │ │ │ │ -00009d70: 6868 3a31 3138 3c2f 6469 763e 3c2f 6469 hh:118
    .
    < │ │ │ │ -00009e00: 6120 6872 6566 3d22 6130 3034 3039 2e68 a href="a00409.h │ │ │ │ -00009e10: 746d 6c23 6767 6138 3530 3765 3937 3163 tml#gga8507e971c │ │ │ │ -00009e20: 3435 3234 3361 6564 3263 3464 6531 6233 45243aed2c4de1b3 │ │ │ │ -00009e30: 3733 3663 6130 3461 3062 6131 6139 6238 736ca04a0ba1a9b8 │ │ │ │ -00009e40: 6363 6530 3033 3466 3662 3061 3662 6566 cce0034f6b0a6bef │ │ │ │ -00009e50: 3462 3165 6236 3730 223e 4475 6e65 3a3a 4b1eb670">Dune:: │ │ │ │ -00009e60: 466c 6f61 7443 6d70 3a3a 746f 7761 7264 FloatCmp::toward │ │ │ │ -00009e70: 496e 663c 2f61 3e3c 2f64 6976 3e3c 6469 Inf
    @ towardInf
    always roun │ │ │ │ -00009ec0: 6420 6177 6179 2066 726f 6d20 303c 2f64 d away from 0
    Definit │ │ │ │ -00009ef0: 696f 6e3c 2f62 3e20 666c 6f61 745f 636d ion float_cm │ │ │ │ -00009f00: 702e 6868 3a31 3230 3c2f 6469 763e 3c2f p.hh:120
    .
    │ │ │ │ -0000a020: 4020 7570 7761 7264 3c2f 6469 763e 3c64 @ upward
    round toward
    Definit │ │ │ │ -0000a070: 696f 6e3c 2f62 3e20 666c 6f61 745f 636d ion float_cm │ │ │ │ -0000a080: 702e 6868 3a31 3234 3c2f 6469 763e 3c2f p.hh:124
    .@ downward
    round towar │ │ │ │ -0000a1d0: 643c 2f64 6976 3e3c 6469 7620 636c 6173 d
    Def │ │ │ │ -0000a1f0: 696e 6974 696f 6e3c 2f62 3e20 666c 6f61 inition floa │ │ │ │ -0000a200: 745f 636d 702e 6868 3a31 3232 3c2f 6469 t_cmp.hh:122
    .the global defa │ │ │ │ -0000a370: 756c 7420 726f 756e 6469 6e67 2073 7479 ult rounding sty │ │ │ │ -0000a380: 6c65 2028 746f 7761 7264 5f7a 6572 6f29 le (toward_zero) │ │ │ │ -0000a390: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    Defi │ │ │ │ -0000a3b0: 6e69 7469 6f6e 3c2f 623e 2066 6c6f 6174 nition float │ │ │ │ -0000a3c0: 5f63 6d70 2e68 683a 3132 363c 2f64 6976 _cmp.hh:126
    .
    < │ │ │ │ -0000a410: 6120 6872 6566 3d22 6130 3034 3235 2e68 a href="a00425.h │ │ │ │ -0000a420: 746d 6c22 3e44 756e 653c 2f61 3e3c 2f64 tml">Dune
    Dune names │ │ │ │ -0000a450: 7061 6365 2e3c 2f64 6976 3e3c 6469 7620 pace.
    Definition │ │ │ │ -0000a480: 616c 6967 6e65 6461 6c6c 6f63 6174 6f72 alignedallocator │ │ │ │ -0000a490: 2e68 683a 3133 3c2f 6469 763e 3c2f 6469 .hh:13
    .
    < │ │ │ │ -0000a560: 6469 7620 636c 6173 733d 2274 7464 6563 div class="ttdec │ │ │ │ -0000a570: 6922 3e54 2054 7970 653c 2f64 6976 3e3c i">T Type
    < │ │ │ │ -0000a580: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ -0000a590: 223e 5468 6520 6570 7369 6c6f 6e20 7479 ">The epsilon ty │ │ │ │ -0000a5a0: 7065 2063 6f72 7265 7370 6f6e 6469 6e67 pe corresponding │ │ │ │ -0000a5b0: 2074 6f20 7661 6c75 6520 7479 7065 2054 to value type T │ │ │ │ -0000a5c0: 2e3c 2f64 6976 3e3c 6469 7620 636c 6173 .
    Def │ │ │ │ -0000a5e0: 696e 6974 696f 6e3c 2f62 3e20 666c 6f61 inition floa │ │ │ │ -0000a5f0: 745f 636d 702e 6363 3a32 353c 2f64 6976 t_cmp.cc:25
    .
    < │ │ │ │ -0000a640: 6120 6872 6566 3d22 6130 3137 3136 2e68 a href="a01716.h │ │ │ │ -0000a650: 746d 6c22 3e44 756e 653a 3a46 6c6f 6174 tml">Dune::Float │ │ │ │ -0000a660: 436d 703a 3a44 6566 6175 6c74 4570 7369 Cmp::DefaultEpsi │ │ │ │ -0000a670: 6c6f 6e3c 2f61 3e3c 2f64 6976 3e3c 6469 lon
    │ │ │ │ -0000a690: 6d61 7070 696e 6720 6672 6f6d 2061 2076 mapping from a v │ │ │ │ -0000a6a0: 616c 7565 2074 7970 6520 616e 6420 6120 alue type and a │ │ │ │ -0000a6b0: 636f 6d70 6172 6520 7374 796c 6520 746f compare style to │ │ │ │ -0000a6c0: 2061 2064 6566 6175 6c74 2065 7073 696c a default epsil │ │ │ │ -0000a6d0: 6f6e 3c2f 6469 763e 3c64 6976 2063 6c61 on
    De │ │ │ │ -0000a6f0: 6669 6e69 7469 6f6e 3c2f 623e 2066 6c6f finition flo │ │ │ │ -0000a700: 6174 5f63 6d70 2e68 683a 3133 383c 2f64 at_cmp.hh:138
    .
    st │ │ │ │ -0000a7f0: 6174 6963 2045 7073 696c 6f6e 5479 7065 atic EpsilonType │ │ │ │ -0000a800: 266c 743b 2054 2026 6774 3b3a 3a54 7970 < T >::Typ │ │ │ │ -0000a810: 6520 7661 6c75 6528 293c 2f64 6976 3e3c e value()
    < │ │ │ │ -0000a820: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ -0000a830: 223e 5265 7475 726e 7320 7468 6520 6465 ">Returns the de │ │ │ │ -0000a840: 6661 756c 7420 6570 7369 6c6f 6e20 666f fault epsilon fo │ │ │ │ -0000a850: 7220 7468 6520 6769 7665 6e20 7661 6c75 r the given valu │ │ │ │ -0000a860: 6520 7479 7065 2061 6e64 2063 6f6d 7061 e type and compa │ │ │ │ -0000a870: 7265 2073 7479 6c65 2e3c 2f64 6976 3e3c re style.
    < │ │ │ │ -0000a880: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Class encapsula │ │ │ │ -0000a910: 7469 6e67 2061 2064 6566 6175 6c74 2065 ting a default e │ │ │ │ -0000a920: 7073 696c 6f6e 2e3c 2f64 6976 3e3c 6469 psilon.
    │ │ │ │ -0000a940: 3c62 3e44 6566 696e 6974 696f 6e3c 2f62 Definition float_cmp.hh:2 │ │ │ │ -0000a960: 3838 3c2f 6469 763e 3c2f 6469 763e 0a3c 88
    .< │ │ │ │ -0000a970: 6469 7620 636c 6173 733d 2274 7463 2220 div class="ttc" │ │ │ │ -0000a980: 6964 3d22 6161 3031 3732 305f 6874 6d6c id="aa01720_html │ │ │ │ -0000a990: 5f61 3135 3764 6263 3363 6135 3631 3466 _a157dbc3ca5614f │ │ │ │ -0000a9a0: 3533 6531 3239 6266 6333 3232 6564 6535 53e129bfc322ede5 │ │ │ │ -0000a9b0: 3964 223e 3c64 6976 2063 6c61 7373 3d22 9d">< │ │ │ │ -0000aa20: 6469 7620 636c 6173 733d 2274 7464 6563 div class="ttdec │ │ │ │ -0000aa30: 6922 3e62 6f6f 6c20 6c65 2863 6f6e 7374 i">bool le(const │ │ │ │ -0000aa40: 2056 616c 7565 5479 7065 2026 616d 703b ValueType & │ │ │ │ -0000aa50: 6669 7273 742c 2063 6f6e 7374 2056 616c first, const Val │ │ │ │ -0000aa60: 7565 5479 7065 2026 616d 703b 7365 636f ueType &seco │ │ │ │ -0000aa70: 6e64 2920 636f 6e73 743c 2f64 6976 3e3c nd) const
    < │ │ │ │ -0000aa80: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ -0000aa90: 223e 7465 7374 2069 6620 6669 7273 7420 ">test if first │ │ │ │ -0000aaa0: 6c65 7373 6572 206f 7220 6571 7561 6c20 lesser or equal │ │ │ │ -0000aab0: 7365 636f 6e64 3c2f 6469 763e 3c64 6976 second
    < │ │ │ │ -0000aad0: 623e 4465 6669 6e69 7469 6f6e 3c2f 623e b>Definition │ │ │ │ -0000aae0: 2066 6c6f 6174 5f63 6d70 2e63 633a 3438 float_cmp.cc:48 │ │ │ │ -0000aaf0: 363c 2f64 6976 3e3c 2f64 6976 3e0a 3c64 6
    .bool eq(const │ │ │ │ -0000abd0: 5661 6c75 6554 7970 6520 2661 6d70 3b66 ValueType &f │ │ │ │ -0000abe0: 6972 7374 2c20 636f 6e73 7420 5661 6c75 irst, const Valu │ │ │ │ -0000abf0: 6554 7970 6520 2661 6d70 3b73 6563 6f6e eType &secon │ │ │ │ -0000ac00: 6429 2063 6f6e 7374 3c2f 6469 763e 3c64 d) const
    test for equali │ │ │ │ -0000ac30: 7479 2075 7369 6e67 2065 7073 696c 6f6e ty using epsilon │ │ │ │ -0000ac40: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    Defi │ │ │ │ -0000ac60: 6e69 7469 6f6e 3c2f 623e 2066 6c6f 6174 nition float │ │ │ │ -0000ac70: 5f63 6d70 2e63 633a 3435 313c 2f64 6976 _cmp.cc:451
    .
    │ │ │ │ -0000ad50: 7374 6174 6963 2063 6f6e 7374 2043 6d70 static const Cmp │ │ │ │ -0000ad60: 5374 796c 6520 6373 7479 6c65 3c2f 6469 Style cstyle
    How compari │ │ │ │ -0000ad90: 736f 6e73 2061 7265 2064 6f6e 652e 3c2f sons are done.
    Defini │ │ │ │ -0000adc0: 7469 6f6e 3c2f 623e 2066 6c6f 6174 5f63 tion float_c │ │ │ │ -0000add0: 6d70 2e68 683a 3239 353c 2f64 6976 3e3c mp.hh:295
    < │ │ │ │ -0000ade0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    < │ │ │ │ -0000ae40: 6120 6872 6566 3d22 6130 3137 3230 2e68 a href="a01720.h │ │ │ │ -0000ae50: 746d 6c23 6137 6134 3462 6331 6335 6635 tml#a7a44bc1c5f5 │ │ │ │ -0000ae60: 6461 6236 6531 3830 6365 3231 3736 3963 dab6e180ce21769c │ │ │ │ -0000ae70: 3139 3333 3622 3e44 756e 653a 3a46 6c6f 19336">Dune::Flo │ │ │ │ -0000ae80: 6174 436d 704f 7073 3a3a 6c74 3c2f 613e atCmpOps::lt │ │ │ │ -0000ae90: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    bool l │ │ │ │ -0000aeb0: 7428 636f 6e73 7420 5661 6c75 6554 7970 t(const ValueTyp │ │ │ │ -0000aec0: 6520 2661 6d70 3b66 6972 7374 2c20 636f e &first, co │ │ │ │ -0000aed0: 6e73 7420 5661 6c75 6554 7970 6520 2661 nst ValueType &a │ │ │ │ -0000aee0: 6d70 3b73 6563 6f6e 6429 2063 6f6e 7374 mp;second) const │ │ │ │ -0000aef0: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    test if │ │ │ │ -0000af10: 2066 6972 7374 206c 6573 7365 7220 7468 first lesser th │ │ │ │ -0000af20: 616e 2073 6563 6f6e 643c 2f64 6976 3e3c an second
    < │ │ │ │ -0000af30: 6469 7620 636c 6173 733d 2274 7464 6566 div class="ttdef │ │ │ │ -0000af40: 223e 3c62 3e44 6566 696e 6974 696f 6e3c ">Definition< │ │ │ │ -0000af50: 2f62 3e20 666c 6f61 745f 636d 702e 6363 /b> float_cmp.cc │ │ │ │ -0000af60: 3a34 3732 3c2f 6469 763e 3c2f 6469 763e :472
    │ │ │ │ -0000af70: 0a3c 6469 7620 636c 6173 733d 2274 7463 .
    bool ge(con │ │ │ │ -0000b040: 7374 2056 616c 7565 5479 7065 2026 616d st ValueType &am │ │ │ │ -0000b050: 703b 6669 7273 742c 2063 6f6e 7374 2056 p;first, const V │ │ │ │ -0000b060: 616c 7565 5479 7065 2026 616d 703b 7365 alueType &se │ │ │ │ -0000b070: 636f 6e64 2920 636f 6e73 743c 2f64 6976 cond) const
    test if firs │ │ │ │ -0000b0a0: 7420 6772 6561 7465 7220 6f72 2065 7175 t greater or equ │ │ │ │ -0000b0b0: 616c 2073 6563 6f6e 643c 2f64 6976 3e3c al second
    < │ │ │ │ -0000b0c0: 6469 7620 636c 6173 733d 2274 7464 6566 div class="ttdef │ │ │ │ -0000b0d0: 223e 3c62 3e44 6566 696e 6974 696f 6e3c ">Definition< │ │ │ │ -0000b0e0: 2f62 3e20 666c 6f61 745f 636d 702e 6363 /b> float_cmp.cc │ │ │ │ -0000b0f0: 3a34 3739 3c2f 6469 763e 3c2f 6469 763e :479
    │ │ │ │ -0000b100: 0a3c 6469 7620 636c 6173 733d 2274 7463 .
    Dune::FloatCmp │ │ │ │ -0000b1a0: 4f70 733a 3a72 7374 796c 653c 2f61 3e3c Ops::rstyle< │ │ │ │ -0000b1b0: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    static │ │ │ │ -0000b1d0: 636f 6e73 7420 526f 756e 6469 6e67 5374 const RoundingSt │ │ │ │ -0000b1e0: 796c 6520 7273 7479 6c65 3c2f 6469 763e yle rstyle
    │ │ │ │ -0000b1f0: 3c64 6976 2063 6c61 7373 3d22 7474 646f
    How rounding │ │ │ │ -0000b210: 6973 2064 6f6e 652e 3c2f 6469 763e 3c64 is done.
    Definition float_cmp.hh: │ │ │ │ -0000b250: 3239 373c 2f64 6976 3e3c 2f64 6976 3e0a 297
    . │ │ │ │ -0000b260: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    Flo │ │ │ │ -0000b330: 6174 436d 703a 3a45 7073 696c 6f6e 5479 atCmp::EpsilonTy │ │ │ │ -0000b340: 7065 266c 743b 2054 2026 6774 3b3a 3a54 pe< T >::T │ │ │ │ -0000b350: 7970 6520 4570 7369 6c6f 6e54 7970 653c ype EpsilonType< │ │ │ │ -0000b360: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Type of │ │ │ │ -0000b380: 7468 6520 6570 7369 6c6f 6e2e 3c2f 6469 the epsilon.
    Definiti │ │ │ │ -0000b3b0: 6f6e 3c2f 623e 2066 6c6f 6174 5f63 6d70 on float_cmp │ │ │ │ -0000b3c0: 2e68 683a 3330 343c 2f64 6976 3e3c 2f64 .hh:304
    .
    Dune::Float │ │ │ │ -0000b470: 436d 704f 7073 3a3a 6e65 3c2f 613e 3c2f CmpOps::ne
    bool ne( │ │ │ │ -0000b4a0: 636f 6e73 7420 5661 6c75 6554 7970 6520 const ValueType │ │ │ │ -0000b4b0: 2661 6d70 3b66 6972 7374 2c20 636f 6e73 &first, cons │ │ │ │ -0000b4c0: 7420 5661 6c75 6554 7970 6520 2661 6d70 t ValueType & │ │ │ │ -0000b4d0: 3b73 6563 6f6e 6429 2063 6f6e 7374 3c2f ;second) const
    test for │ │ │ │ -0000b500: 696e 6571 7561 6c69 7479 2075 7369 6e67 inequality using │ │ │ │ -0000b510: 2065 7073 696c 6f6e 3c2f 6469 763e 3c64 epsilon
    Definition float_cmp.cc: │ │ │ │ -0000b550: 3435 383c 2f64 6976 3e3c 2f64 6976 3e0a 458
    . │ │ │ │ -0000b560: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    T Val │ │ │ │ -0000b630: 7565 5479 7065 3c2f 6469 763e 3c64 6976 ueType
    T │ │ │ │ -0000b650: 7970 6520 6f66 2074 6865 2076 616c 7565 ype of the value │ │ │ │ -0000b660: 7320 746f 2063 6f6d 7061 7265 2e3c 2f64 s to compare.
    Definit │ │ │ │ -0000b690: 696f 6e3c 2f62 3e20 666c 6f61 745f 636d ion float_cm │ │ │ │ -0000b6a0: 702e 6868 3a32 3939 3c2f 6469 763e 3c2f p.hh:299
    .
    Ep │ │ │ │ -0000b780: 7369 6c6f 6e54 7970 6520 6570 7369 6c6f silonType epsilo │ │ │ │ -0000b790: 6e28 2920 636f 6e73 743c 2f64 6976 3e3c n() const
    < │ │ │ │ -0000b7a0: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ -0000b7b0: 223e 7265 7475 726e 2074 6865 2063 7572 ">return the cur │ │ │ │ -0000b7c0: 7265 6e74 2065 7073 696c 6f6e 3c2f 6469 rent epsilon
    Definiti │ │ │ │ -0000b7f0: 6f6e 3c2f 623e 2066 6c6f 6174 5f63 6d70 on float_cmp │ │ │ │ -0000b800: 2e63 633a 3433 363c 2f64 6976 3e3c 2f64 .cc:436
    .
    I rou │ │ │ │ -0000b8e0: 6e64 2863 6f6e 7374 2056 616c 7565 5479 nd(const ValueTy │ │ │ │ -0000b8f0: 7065 2026 616d 703b 7661 6c29 2063 6f6e pe &val) con │ │ │ │ -0000b900: 7374 3c2f 6469 763e 3c64 6976 2063 6c61 st
    round │ │ │ │ -0000b920: 2075 7369 6e67 2065 7073 696c 6f6e 3c2f using epsilon
    Defini │ │ │ │ -0000b950: 7469 6f6e 3c2f 623e 2066 6c6f 6174 5f63 tion float_c │ │ │ │ -0000b960: 6d70 2e63 633a 3439 353c 2f64 6976 3e3c mp.cc:495
    < │ │ │ │ -0000b970: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    < │ │ │ │ -0000b9d0: 6120 6872 6566 3d22 6130 3137 3230 2e68 a href="a01720.h │ │ │ │ -0000b9e0: 746d 6c23 6165 6561 6637 6138 3862 3365 tml#aeeaf7a88b3e │ │ │ │ -0000b9f0: 3738 3236 3535 6431 6231 3333 3661 3962 782655d1b1336a9b │ │ │ │ -0000ba00: 3732 6638 3322 3e44 756e 653a 3a46 6c6f 72f83">Dune::Flo │ │ │ │ -0000ba10: 6174 436d 704f 7073 3a3a 7472 756e 633c atCmpOps::trunc< │ │ │ │ -0000ba20: 2f61 3e3c 2f64 6976 3e3c 6469 7620 636c /a>
    I t │ │ │ │ -0000ba40: 7275 6e63 2863 6f6e 7374 2056 616c 7565 runc(const Value │ │ │ │ -0000ba50: 5479 7065 2026 616d 703b 7661 6c29 2063 Type &val) c │ │ │ │ -0000ba60: 6f6e 7374 3c2f 6469 763e 3c64 6976 2063 onst
    tru │ │ │ │ -0000ba80: 6e63 6174 6520 7573 696e 6720 6570 7369 ncate using epsi │ │ │ │ -0000ba90: 6c6f 6e3c 2f64 6976 3e3c 6469 7620 636c lon
    D │ │ │ │ -0000bab0: 6566 696e 6974 696f 6e3c 2f62 3e20 666c efinition fl │ │ │ │ -0000bac0: 6f61 745f 636d 702e 6363 3a35 3033 3c2f oat_cmp.cc:503
    .
    │ │ │ │ -0000bb20: 3c64 6976 2063 6c61 7373 3d22 7474 6e61
    b │ │ │ │ -0000bba0: 6f6f 6c20 6774 2863 6f6e 7374 2056 616c ool gt(const Val │ │ │ │ -0000bbb0: 7565 5479 7065 2026 616d 703b 6669 7273 ueType &firs │ │ │ │ -0000bbc0: 742c 2063 6f6e 7374 2056 616c 7565 5479 t, const ValueTy │ │ │ │ -0000bbd0: 7065 2026 616d 703b 7365 636f 6e64 2920 pe &second) │ │ │ │ -0000bbe0: 636f 6e73 743c 2f64 6976 3e3c 6469 7620 const
    te │ │ │ │ -0000bc00: 7374 2069 6620 6669 7273 7420 6772 6561 st if first grea │ │ │ │ -0000bc10: 7465 7220 7468 616e 2073 6563 6f6e 643c ter than second< │ │ │ │ -0000bc20: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ -0000bc40: 6974 696f 6e3c 2f62 3e20 666c 6f61 745f ition float_ │ │ │ │ -0000bc50: 636d 702e 6363 3a34 3635 3c2f 6469 763e cmp.cc:465
    │ │ │ │ -0000bc60: 3c2f 6469 763e 0a3c 2f64 6976 3e3c 212d
    .
    . │ │ │ │ -0000bcb0: 0a3c 6872 2063 6c61 7373 3d22 666f 6f74 .
    .Generated b │ │ │ │ -0000bcf0: 7926 2331 3630 3b3c 6120 6872 6566 3d22 y doxygen 1.9.8.
    .< │ │ │ │ -0000bd90: 2f62 6f64 793e 0a3c 2f68 746d 6c3e 0a /body>.. │ │ │ │ +000056e0: 3030 3132 3722 206e 616d 653d 226c 3030 00127" name="l00 │ │ │ │ +000056f0: 3132 3722 3e3c 2f61 3e3c 7370 616e 2063 127"> 127 typ │ │ │ │ +00005780: 6564 6566 3c2f 7370 616e 3e20 3c73 7061 edef typename Base::size_typ │ │ │ │ +00005810: 653c 2f61 3e20 3c61 2063 6c61 7373 3d22 e size_type< │ │ │ │ +00005870: 2f61 3e3b 3c2f 6469 763e 0a3c 6469 7620 /a>;
    .
    128 typedef │ │ │ │ +00005940: 203c 7370 616e 2063 6c61 7373 3d22 6b65 typename< │ │ │ │ +00005960: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> Base::row_typ │ │ │ │ +000059a0: 653c 2f61 3e20 3c61 2063 6c61 7373 3d22 e row_type;
    .
    129 < │ │ │ │ +00005a60: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>..< │ │ │ │ +00005c00: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00005c10: 3e3c 6120 6964 3d22 6c30 3031 3331 2220 > 13 │ │ │ │ +00005c90: 313c 2f61 3e3c 2f73 7061 6e3e 2020 2020 1 │ │ │ │ +00005ca0: 3c73 7061 6e20 636c 6173 733d 226b 6579 typedef typen │ │ │ │ +00005ce0: 616d 653c 2f73 7061 6e3e 203c 6120 636c ame Base::con │ │ │ │ +00005d20: 7374 5f72 6f77 5f72 6566 6572 656e 6365 st_row_reference │ │ │ │ +00005d30: 3c2f 613e 203c 6120 636c 6173 733d 2263 const_row_r │ │ │ │ +00005d90: 6566 6572 656e 6365 3c2f 613e 3b3c 2f64 eference;.
    13 │ │ │ │ +00005df0: 323c 2f73 7061 6e3e 203c 2f64 6976 3e0a 2
    . │ │ │ │ +00005e00: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 . │ │ │ │ +00005e90: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +00005ec0: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 1 │ │ │ │ +00005f20: 3336 3c2f 613e 3c2f 7370 616e 3e20 2020 36 │ │ │ │ +00005f30: 203c 7370 616e 2063 6c61 7373 3d22 6b65 constexpr │ │ │ │ +00005f50: 3c2f 7370 616e 3e20 3c61 2063 6c61 7373 FieldMa │ │ │ │ +00005fb0: 7472 6978 3c2f 613e 2829 203d 203c 7370 trix() = default;
    .< │ │ │ │ +00006000: 6120 6964 3d22 6c30 3031 3337 2220 6e61 a id="l00137" na │ │ │ │ +00006010: 6d65 3d22 6c30 3031 3337 223e 3c2f 613e me="l00137"> │ │ │ │ +00006020: 3c73 7061 6e20 636c 6173 733d 226c 696e 137
    .
    .< │ │ │ │ +00006090: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +000060a0: 3e3c 6120 6964 3d22 6c30 3031 3430 2220 > 14 │ │ │ │ +00006120: 303c 2f61 3e3c 2f73 7061 6e3e 2020 2020 0 │ │ │ │ +00006130: 3c61 2063 6c61 7373 3d22 636f 6465 2068 FieldMatrix │ │ │ │ +00006190: 2873 7464 3a3a 696e 6974 6961 6c69 7a65 (std::initialize │ │ │ │ +000061a0: 725f 6c69 7374 266c 743b 3c61 2063 6c61 r_list<Dune::Fiel │ │ │ │ +000061e0: 6456 6563 746f 7226 6c74 3b4b 2c20 636f dVector<K, co │ │ │ │ +000061f0: 6c73 2667 743b 3c2f 613e 2026 6774 3b20 ls> > │ │ │ │ +00006200: 3c73 7061 6e20 636c 6173 733d 226b 6579 const &l) {.
    141 │ │ │ │ +00006280: 3c2f 7370 616e 3e20 2020 2020 2061 7373 ass │ │ │ │ +00006290: 6572 7428 6c2e 7369 7a65 2829 203d 3d20 ert(l.size() == │ │ │ │ +000062a0: 3c61 2063 6c61 7373 3d22 636f 6465 2068 rows); // Actually, t │ │ │ │ +00006320: 6869 7320 6973 206e 6f74 206e 6565 6465 his is not neede │ │ │ │ +00006330: 6420 616e 7920 6d6f 7265 213c 2f73 7061 d any more!
    .
    142 │ │ │ │ +000063a0: 2020 2073 7464 3a3a 636f 7079 5f6e 286c std::copy_n(l │ │ │ │ +000063b0: 2e62 6567 696e 2829 2c20 7374 643a 3a6d .begin(), std::m │ │ │ │ +000063c0: 696e 283c 7370 616e 2063 6c61 7373 3d22 in(static_ │ │ │ │ +000063e0: 6361 7374 266c 743b 3c2f 7370 616e 3e73 cast<s │ │ │ │ +000063f0: 7464 3a3a 7369 7a65 5f74 3c73 7061 6e20 td::size_t │ │ │ │ +00006410: 2667 743b 3c2f 7370 616e 3e28 524f 5753 >(ROWS │ │ │ │ +00006420: 292c 3c2f 6469 763e 0a3c 6469 7620 636c ),
    .
    143 │ │ │ │ +00006480: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +00006490: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +000064a0: 2020 206c 2e73 697a 6528 2929 2c3c 2f64 l.size()),.
    14 │ │ │ │ +00006500: 343c 2f73 7061 6e3e 2020 2020 2020 2020 4 │ │ │ │ +00006510: 2020 2020 2020 2020 205f 6461 7461 2e62 _data.b │ │ │ │ +00006520: 6567 696e 2829 293b 3c2f 6469 763e 0a3c egin());
    .< │ │ │ │ +00006530: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00006540: 3e3c 6120 6964 3d22 6c30 3031 3435 2220 > 145 }
    .< │ │ │ │ +00006590: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +000065e0: 3134 363c 2f73 7061 6e3e 203c 2f64 6976 146
    .
    147< │ │ │ │ +00006640: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +00006660: 7465 6d70 6c61 7465 3c2f 7370 616e 3e20 template │ │ │ │ +00006670: 266c 743b 3c73 7061 6e20 636c 6173 733d <class │ │ │ │ +00006690: 3c2f 7370 616e 3e54 2c3c 2f64 6976 3e0a T,
    . │ │ │ │ +000066a0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +00006780: 3c64 6976 2063 6c61 7373 3d22 666f 6c64
    .
    149 FieldMat │ │ │ │ +000068c0: 7269 783c 2f61 3e28 5420 3c73 7061 6e20 rix(T │ │ │ │ +000068e0: 636f 6e73 743c 2f73 7061 6e3e 2661 6d70 const& │ │ │ │ +000068f0: 3b20 7268 7329 3c2f 6469 763e 0a3c 6469 ; rhs)
    .< │ │ │ │ +00006910: 6120 6964 3d22 6c30 3031 3530 2220 6e61 a id="l00150" na │ │ │ │ +00006920: 6d65 3d22 6c30 3031 3530 223e 3c2f 613e me="l00150"> │ │ │ │ +00006930: 3c73 7061 6e20 636c 6173 733d 226c 696e 150 {
    .< │ │ │ │ +00006970: 6120 6964 3d22 6c30 3031 3531 2220 6e61 a id="l00151" na │ │ │ │ +00006980: 6d65 3d22 6c30 3031 3531 223e 3c2f 613e me="l00151"> │ │ │ │ +00006990: 3c73 7061 6e20 636c 6173 733d 226c 696e 151 *th │ │ │ │ +000069d0: 6973 3c2f 7370 616e 3e20 3d20 7268 733b is = rhs; │ │ │ │ +000069e0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00006a30: 2031 3532 3c2f 7370 616e 3e20 2020 207d 152 } │ │ │ │ +00006a40: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c64
    .
    . │ │ │ │ +00006a60: 3c61 2069 643d 226c 3030 3135 3322 206e 153
    .
    154 │ │ │ │ +00006b00: 2020 3c73 7061 6e20 636c 6173 733d 226b using Base::opera │ │ │ │ +00006b30: 746f 723d 3b3c 2f64 6976 3e0a 3c64 6976 tor=;
    .
    < │ │ │ │ +00006b70: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00006b80: 6e6f 223e 2020 3135 353c 2f73 7061 6e3e no"> 155 │ │ │ │ +00006b90: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ +00006be0: 3c61 2063 6c61 7373 3d22 6c69 6e65 2220 157 FieldMatrix │ │ │ │ +00006c70: 3c2f 613e 2661 6d70 3b20 3c61 2063 6c61 & opera │ │ │ │ +00006cd0: 746f 723d 3c2f 613e 283c 7370 616e 2063 tor=(c │ │ │ │ +00006cf0: 6f6e 7374 3c2f 7370 616e 3e20 3c61 2063 onst FieldMat │ │ │ │ +00006d30: 7269 783c 2f61 3e26 616d 703b 2920 3d20 rix&) = │ │ │ │ +00006d40: 3c73 7061 6e20 636c 6173 733d 226b 6579 defaul │ │ │ │ +00006d60: 743c 2f73 7061 6e3e 3b3c 2f64 6976 3e0a t;
    . │ │ │ │ +00006d70: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ +00006e00: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00006e10: 6e6f 223e 2020 3136 303c 2f73 7061 6e3e no"> 160 │ │ │ │ +00006e20: 2020 2020 3c73 7061 6e20 636c 6173 733d templa │ │ │ │ +00006e40: 7465 3c2f 7370 616e 3e26 6c74 3b3c 7370 te<typename T>
    .< │ │ │ │ +00006e80: 6469 7620 636c 6173 733d 2266 6f6c 646f div class="foldo │ │ │ │ +00006e90: 7065 6e22 2069 643d 2266 6f6c 646f 7065 pen" id="foldope │ │ │ │ +00006ea0: 6e30 3031 3631 2220 6461 7461 2d73 7461 n00161" data-sta │ │ │ │ +00006eb0: 7274 3d22 7b22 2064 6174 612d 656e 643d rt="{" data-end= │ │ │ │ +00006ec0: 227d 223e 0a3c 6469 7620 636c 6173 733d "}">..
    │ │ │ │ +000070d0: 2020 3136 323c 2f73 7061 6e3e 2020 2020 162 │ │ │ │ +000070e0: 7b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 {
    .
    │ │ │ │ +00007130: 2020 3136 333c 2f73 7061 6e3e 2020 2020 163 │ │ │ │ +00007140: 2020 5f64 6174 6120 3d20 782e 5f64 6174 _data = x._dat │ │ │ │ +00007150: 613b 3c2f 6469 763e 0a3c 6469 7620 636c a;
    .
    164 │ │ │ │ +000071b0: 2020 203c 7370 616e 2063 6c61 7373 3d22 ret │ │ │ │ +000071d0: 7572 6e3c 2f73 7061 6e3e 202a 3c73 7061 urn *this;.
    1 │ │ │ │ +00007250: 3635 3c2f 7370 616e 3e20 2020 207d 3c2f 65 }.
    .
    < │ │ │ │ +000072a0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +000072b0: 6e6f 223e 2020 3136 363c 2f73 7061 6e3e no"> 166 │ │ │ │ +000072c0: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ +00007310: 2020 3136 383c 2f73 7061 6e3e 2020 2020 168 │ │ │ │ +00007320: 3c73 7061 6e20 636c 6173 733d 226b 6579 template < │ │ │ │ +00007360: 7479 7065 6e61 6d65 3c2f 7370 616e 3e20 typename │ │ │ │ +00007370: 542c 203c 7370 616e 2063 6c61 7373 3d22 T, int │ │ │ │ +00007390: 3c2f 7370 616e 3e20 726f 7773 2c20 3c73 rows, int cols>
    .
    │ │ │ │ +00007460: 2031 3639 3c2f 613e 3c2f 7370 616e 3e20 169 │ │ │ │ +00007470: 2020 203c 6120 636c 6173 733d 2263 6f64 F │ │ │ │ +000074a0: 6965 6c64 4d61 7472 6978 3c2f 613e 2661 ieldMatrix&a │ │ │ │ +000074b0: 6d70 3b20 3c61 2063 6c61 7373 3d22 636f mp; operator=(F │ │ │ │ +00007540: 6965 6c64 4d61 7472 6978 266c 743b 542c ieldMatrix<T, │ │ │ │ +00007550: 726f 7773 2c63 6f6c 7326 6774 3b3c 2f61 rows,cols> const&) = delete │ │ │ │ +000075b0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +00007600: 2020 3137 303c 2f73 7061 6e3e 203c 2f64 170 .
    ..
    │ │ │ │ +00007820: 2031 3733 3c2f 7370 616e 3e3c 7370 616e 173 {..< │ │ │ │ +00007910: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00007920: 3e3c 6120 6964 3d22 6c30 3031 3735 2220 > 175 for( < │ │ │ │ +00007990: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +000079a0: 6f72 6474 7970 6522 3e69 6e74 3c2f 7370 ordtype">int i = 0; i < │ │ │ │ +000079c0: 3b20 524f 5753 3b20 2b2b 6920 293c 2f64 ; ROWS; ++i ).
    17 │ │ │ │ +00007a20: 363c 2f73 7061 6e3e 2020 2020 2020 2020 6 │ │ │ │ +00007a30: 3c73 7061 6e20 636c 6173 733d 226b 6579 for( │ │ │ │ +00007a70: 696e 743c 2f73 7061 6e3e 206a 203d 2030 int j = 0 │ │ │ │ +00007a80: 3b20 6a20 266c 743b 2043 4f4c 533b 202b ; j < COLS; + │ │ │ │ +00007a90: 2b6a 2029 3c2f 6469 763e 0a3c 6469 7620 +j )
    .
    177 │ │ │ │ +00007af0: 2020 2020 2020 2020 2041 545b 6a5d 5b69 AT[j][i │ │ │ │ +00007b00: 5d20 3d20 282a 3c73 7061 6e20 636c 6173 ] = (*this │ │ │ │ +00007b20: 3c2f 7370 616e 3e29 5b69 5d5b 6a5d 3b3c )[i][j];< │ │ │ │ +00007b30: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00007b80: 3137 383c 2f73 7061 6e3e 2020 2020 2020 178 │ │ │ │ +00007b90: 3c73 7061 6e20 636c 6173 733d 226b 6579 return │ │ │ │ +00007bb0: 3c2f 7370 616e 3e20 4154 3b3c 2f64 6976 AT;
    .
    179< │ │ │ │ +00007c10: 2f73 7061 6e3e 2020 2020 7d3c 2f64 6976 /span> }
    .
    .
    180 .
    1 │ │ │ │ +00007cd0: 3832 3c2f 7370 616e 3e20 2020 203c 7370 82 template <cla │ │ │ │ +00007d20: 7373 3c2f 7370 616e 3e20 4f74 6865 7253 ss OtherS │ │ │ │ +00007d30: 6361 6c61 7226 6774 3b3c 2f64 6976 3e0a calar>
    . │ │ │ │ +00007d40: 3c64 6976 2063 6c61 7373 3d22 666f 6c64
    .
    < │ │ │ │ +00007dd0: 6120 636c 6173 733d 226c 696e 6522 2068 a class="line" h │ │ │ │ +00007de0: 7265 663d 2261 3031 3430 382e 6874 6d6c ref="a01408.html │ │ │ │ +00007df0: 2361 6536 3033 3366 3231 3764 3264 6531 #ae6033f217d2de1 │ │ │ │ +00007e00: 6337 6330 6464 6431 3038 3435 3966 6638 c7c0ddd108459ff8 │ │ │ │ +00007e10: 6163 223e 2020 3138 333c 2f61 3e3c 2f73 ac"> 183 fr │ │ │ │ +00007e40: 6965 6e64 3c2f 7370 616e 3e20 3c73 7061 iend auto ope │ │ │ │ +00007ec0: 7261 746f 722b 203c 2f61 3e28 203c 7370 rator+ ( const │ │ │ │ +00007ef0: 3c61 2063 6c61 7373 3d22 636f 6465 2068 Fiel │ │ │ │ +00007f20: 644d 6174 7269 783c 2f61 3e26 616d 703b dMatrix& │ │ │ │ +00007f30: 206d 6174 7269 7841 2c3c 2f64 6976 3e0a matrixA,
    . │ │ │ │ +00007f40: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 . │ │ │ │ +00008040: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +000080a0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 │ │ │ │ +00008190: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +00008200: 6120 6964 3d22 6c30 3031 3838 2220 6e61 a id="l00188" na │ │ │ │ +00008210: 6d65 3d22 6c30 3031 3838 223e 3c2f 613e me="l00188"> │ │ │ │ +00008220: 3c73 7061 6e20 636c 6173 733d 226c 696e 188 for (siz │ │ │ │ +000082c0: 655f 7479 7065 3c2f 613e 2069 203d 2030 e_type i = 0 │ │ │ │ +000082d0: 3b20 6920 266c 743b 2052 4f57 533b 202b ; i < ROWS; + │ │ │ │ +000082e0: 2b69 293c 2f64 6976 3e0a 3c64 6976 2063 +i)
    .
    189 │ │ │ │ +00008340: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +00008360: 666f 723c 2f73 7061 6e3e 2028 3c61 2063 for (size │ │ │ │ +000083c0: 5f74 7970 653c 2f61 3e20 6a20 3d20 303b _type j = 0; │ │ │ │ +000083d0: 206a 2026 6c74 3b20 434f 4c53 3b20 2b2b j < COLS; ++ │ │ │ │ +000083e0: 6a29 3c2f 6469 763e 0a3c 6469 7620 636c j)
    .
    190 │ │ │ │ +00008440: 2020 2020 2020 2072 6573 756c 745b 695d result[i] │ │ │ │ +00008450: 5b6a 5d20 3d20 6d61 7472 6978 415b 695d [j] = matrixA[i] │ │ │ │ +00008460: 5b6a 5d20 2b20 6d61 7472 6978 425b 695d [j] + matrixB[i] │ │ │ │ +00008470: 5b6a 5d3b 3c2f 6469 763e 0a3c 6469 7620 [j];
    .
    191 │ │ │ │ +000084d0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00008520: 2031 3932 3c2f 7370 616e 3e20 2020 2020 192 │ │ │ │ +00008530: 203c 7370 616e 2063 6c61 7373 3d22 6b65 retur │ │ │ │ +00008550: 6e3c 2f73 7061 6e3e 2072 6573 756c 743b n result; │ │ │ │ +00008560: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000085b0: 2031 3933 3c2f 7370 616e 3e20 2020 207d 193 } │ │ │ │ +000085c0: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c64
    .
    . │ │ │ │ +000085e0: 3c61 2069 643d 226c 3030 3139 3422 206e 194
    .
    196 │ │ │ │ +00008680: 2020 3c73 7061 6e20 636c 6173 733d 226b template │ │ │ │ +000086a0: 3c2f 7370 616e 3e20 266c 743b 3c73 7061 <class O │ │ │ │ +000086d0: 7468 6572 5363 616c 6172 2667 743b 3c2f therScalar>.
    .
    < │ │ │ │ +00008760: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00008770: 6e6f 223e 3c61 2063 6c61 7373 3d22 6c69 no"> 197 friend │ │ │ │ +000087f0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 auto operator- │ │ │ │ +00008870: 2820 3c73 7061 6e20 636c 6173 733d 226b ( const FieldMatrix │ │ │ │ +000088d0: 2661 6d70 3b20 6d61 7472 6978 412c 3c2f & matrixA,.
    1 │ │ │ │ +00008930: 3938 3c2f 7370 616e 3e20 2020 2020 2020 98 │ │ │ │ +00008940: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +00008950: 2020 2020 203c 7370 616e 2063 6c61 7373 const │ │ │ │ +00008970: 3c2f 7370 616e 3e20 3c61 2063 6c61 7373 FieldMatrix& │ │ │ │ +000089b0: 6c74 3b4f 7468 6572 5363 616c 6172 2c52 lt;OtherScalar,R │ │ │ │ +000089c0: 4f57 532c 434f 4c53 2667 743b 3c2f 613e OWS,COLS> │ │ │ │ +000089d0: 2661 6d70 3b20 6d61 7472 6978 4229 3c2f & matrixB).
    1 │ │ │ │ +00008a30: 3939 3c2f 7370 616e 3e20 2020 207b 3c2f 99 {.
    2 │ │ │ │ +00008a90: 3030 3c2f 7370 616e 3e20 2020 2020 203c 00 < │ │ │ │ +00008aa0: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +00008ab0: 5f63 6c61 7373 2220 6872 6566 3d22 6130 _class" href="a0 │ │ │ │ +00008ac0: 3134 3038 2e68 746d 6c22 3e46 6965 6c64 1408.html">Field │ │ │ │ +00008ad0: 4d61 7472 6978 266c 743b 7479 7065 6e61 Matrix<typena │ │ │ │ +00008ae0: 6d65 2050 726f 6d6f 7469 6f6e 5472 6169 me PromotionTrai │ │ │ │ +00008af0: 7473 266c 743b 4b2c 4f74 6865 7253 6361 ts<K,OtherSca │ │ │ │ +00008b00: 6c61 7226 6774 3b3a 3a50 726f 6d6f 7465 lar>::Promote │ │ │ │ +00008b10: 6454 7970 653c 2f61 3e2c 524f 5753 2c43 dType,ROWS,C │ │ │ │ +00008b20: 4f4c 5326 6774 3b20 7265 7375 6c74 3b3c OLS> result;< │ │ │ │ +00008b30: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00008b80: 3230 313c 2f73 7061 6e3e 203c 2f64 6976 201
    .
    202< │ │ │ │ +00008be0: 2f73 7061 6e3e 2020 2020 2020 3c73 7061 /span> for │ │ │ │ +00008c10: 2028 3c61 2063 6c61 7373 3d22 636f 6465 (size_type │ │ │ │ +00008c70: 6920 3d20 303b 2069 2026 6c74 3b20 524f i = 0; i < RO │ │ │ │ +00008c80: 5753 3b20 2b2b 6929 3c2f 6469 763e 0a3c WS; ++i)
    .< │ │ │ │ +00008c90: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00008ca0: 3e3c 6120 6964 3d22 6c30 3032 3033 2220 > 203 for │ │ │ │ +00008d10: 283c 6120 636c 6173 733d 2263 6f64 6520 (size_type j │ │ │ │ +00008d70: 203d 2030 3b20 6a20 266c 743b 2043 4f4c = 0; j < COL │ │ │ │ +00008d80: 533b 202b 2b6a 293c 2f64 6976 3e0a 3c64 S; ++j)
    . │ │ │ │ +00008da0: 3c61 2069 643d 226c 3030 3230 3422 206e 204 resu │ │ │ │ +00008df0: 6c74 5b69 5d5b 6a5d 203d 206d 6174 7269 lt[i][j] = matri │ │ │ │ +00008e00: 7841 5b69 5d5b 6a5d 202d 206d 6174 7269 xA[i][j] - matri │ │ │ │ +00008e10: 7842 5b69 5d5b 6a5d 3b3c 2f64 6976 3e0a xB[i][j];
    . │ │ │ │ +00008e20: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ +00008eb0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00008ec0: 6e6f 223e 2020 3230 363c 2f73 7061 6e3e no"> 206 │ │ │ │ +00008ed0: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +00008ef0: 7265 7475 726e 3c2f 7370 616e 3e20 7265 return re │ │ │ │ +00008f00: 7375 6c74 3b3c 2f64 6976 3e0a 3c64 6976 sult;
    .
    < │ │ │ │ +00008f40: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00008f50: 6e6f 223e 2020 3230 373c 2f73 7061 6e3e no"> 207 │ │ │ │ +00008f60: 2020 2020 7d3c 2f64 6976 3e0a 3c2f 6469 }
    ..
    208 │ │ │ │ +00008fc0: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +00008fd0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00008fe0: 3e3c 6120 6964 3d22 6c30 3032 3130 2220 > 210 tem │ │ │ │ +00009040: 706c 6174 653c 2f73 7061 6e3e 2026 6c74 plate < │ │ │ │ +00009050: 3b3c 7370 616e 2063 6c61 7373 3d22 6b65 ;class Scalar,
    .
    211< │ │ │ │ +000090d0: 2f73 7061 6e3e 2020 2020 2020 2020 2020 /span> │ │ │ │ +000090e0: 2020 2020 7374 643a 3a65 6e61 626c 655f std::enable_ │ │ │ │ +000090f0: 6966 5f74 266c 743b 4973 4e75 6d62 6572 if_t<IsNumber │ │ │ │ +00009100: 266c 743b 5363 616c 6172 2667 743b 3a3a <Scalar>:: │ │ │ │ +00009110: 7661 6c75 652c 203c 7370 616e 2063 6c61 value, int> │ │ │ │ +00009140: 3d20 3026 6774 3b3c 2f64 6976 3e0a 3c64 = 0>
    ..
    212 frie │ │ │ │ +00009250: 6e64 3c2f 7370 616e 3e20 3c73 7061 6e20 nd │ │ │ │ +00009270: 6175 746f 3c2f 7370 616e 3e20 3c61 2063 auto opera │ │ │ │ +000092d0: 746f 722a 203c 2f61 3e28 203c 7370 616e tor* ( const FieldM │ │ │ │ +00009330: 6174 7269 783c 2f61 3e26 616d 703b 206d atrix& m │ │ │ │ +00009340: 6174 7269 782c 2053 6361 6c61 7220 7363 atrix, Scalar sc │ │ │ │ +00009350: 616c 6172 293c 2f64 6976 3e0a 3c64 6976 alar)
    .
    < │ │ │ │ +00009390: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +000093a0: 6e6f 223e 2020 3231 333c 2f73 7061 6e3e no"> 213 │ │ │ │ +000093b0: 2020 2020 7b3c 2f64 6976 3e0a 3c64 6976 {
    .
    < │ │ │ │ +000093f0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00009400: 6e6f 223e 2020 3231 343c 2f73 7061 6e3e no"> 214 │ │ │ │ +00009410: 2020 2020 2020 3c61 2063 6c61 7373 3d22 FieldMatrix< │ │ │ │ +00009450: 3b74 7970 656e 616d 6520 5072 6f6d 6f74 ;typename Promot │ │ │ │ +00009460: 696f 6e54 7261 6974 7326 6c74 3b4b 2c53 ionTraits<K,S │ │ │ │ +00009470: 6361 6c61 7226 6774 3b3a 3a50 726f 6d6f calar>::Promo │ │ │ │ +00009480: 7465 6454 7970 653c 2f61 3e2c 524f 5753 tedType,ROWS │ │ │ │ +00009490: 2c43 4f4c 5326 6774 3b20 7265 7375 6c74 ,COLS> result │ │ │ │ +000094a0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +000094f0: 2020 3231 353c 2f73 7061 6e3e 203c 2f64 215 .
    21 │ │ │ │ +00009550: 363c 2f73 7061 6e3e 2020 2020 2020 3c73 6 for (size_type i = 0; i < │ │ │ │ +000095f0: 524f 5753 3b20 2b2b 6929 3c2f 6469 763e ROWS; ++i)
    │ │ │ │ +00009600: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00009630: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 217 for (size_type │ │ │ │ +000096e0: 206a 203d 2030 3b20 6a20 266c 743b 2043 j = 0; j < C │ │ │ │ +000096f0: 4f4c 533b 202b 2b6a 293c 2f64 6976 3e0a OLS; ++j)
    . │ │ │ │ +00009700: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    219 < │ │ │ │ +000097e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00009830: 3232 303c 2f73 7061 6e3e 2020 2020 2020 220 │ │ │ │ +00009840: 3c73 7061 6e20 636c 6173 733d 226b 6579 return │ │ │ │ +00009860: 3c2f 7370 616e 3e20 7265 7375 6c74 3b3c result;< │ │ │ │ +00009870: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +000098c0: 3232 313c 2f73 7061 6e3e 2020 2020 7d3c 221 }< │ │ │ │ +000098d0: 2f64 6976 3e0a 3c2f 6469 763e 0a3c 6469 /div>.
    .< │ │ │ │ +000098f0: 6120 6964 3d22 6c30 3032 3232 2220 6e61 a id="l00222" na │ │ │ │ +00009900: 6d65 3d22 6c30 3032 3232 223e 3c2f 613e me="l00222"> │ │ │ │ +00009910: 3c73 7061 6e20 636c 6173 733d 226c 696e 222
    .
    224 │ │ │ │ +00009990: 203c 7370 616e 2063 6c61 7373 3d22 6b65 template< │ │ │ │ +000099b0: 2f73 7061 6e3e 2026 6c74 3b3c 7370 616e /span> <class Sc │ │ │ │ +000099e0: 616c 6172 2c3c 2f64 6976 3e0a 3c64 6976 alar,
    .
    < │ │ │ │ +00009a20: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00009a30: 6e6f 223e 2020 3232 353c 2f73 7061 6e3e no"> 225 │ │ │ │ +00009a40: 2020 2020 2020 2020 2020 2020 2020 7374 st │ │ │ │ +00009a50: 643a 3a65 6e61 626c 655f 6966 5f74 266c d::enable_if_t&l │ │ │ │ +00009a60: 743b 4973 4e75 6d62 6572 266c 743b 5363 t;IsNumber<Sc │ │ │ │ +00009a70: 616c 6172 2667 743b 3a3a 7661 6c75 652c alar>::value, │ │ │ │ +00009a80: 203c 7370 616e 2063 6c61 7373 3d22 6b65 int> = 0> │ │ │ │ +00009ab0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    .< │ │ │ │ +00009b00: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00009b10: 3e3c 6120 6964 3d22 6c30 3032 3236 2220 > 22 │ │ │ │ +00009b90: 363c 2f61 3e3c 2f73 7061 6e3e 2020 2020 6 │ │ │ │ +00009ba0: 3c73 7061 6e20 636c 6173 733d 226b 6579 friend auto operator* < │ │ │ │ +00009c40: 2f61 3e28 2053 6361 6c61 7220 7363 616c /a>( Scalar scal │ │ │ │ +00009c50: 6172 2c20 3c73 7061 6e20 636c 6173 733d ar, const< │ │ │ │ +00009c70: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> FieldMatrix& matrix)< │ │ │ │ +00009cc0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00009d10: 3232 373c 2f73 7061 6e3e 2020 2020 7b3c 227 {< │ │ │ │ +00009d20: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>..
    229< │ │ │ │ +00009e60: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
    . │ │ │ │ +00009e80: 3c61 2069 643d 226c 3030 3233 3022 206e 230 for (si │ │ │ │ +00009f40: 7a65 5f74 7970 653c 2f61 3e20 6920 3d20 ze_type i = │ │ │ │ +00009f50: 303b 2069 2026 6c74 3b20 524f 5753 3b20 0; i < ROWS; │ │ │ │ +00009f60: 2b2b 6929 3c2f 6469 763e 0a3c 6469 7620 ++i)
    .
    231 │ │ │ │ +00009fc0: 2020 2020 2020 203c 7370 616e 2063 6c61 for (siz │ │ │ │ +0000a040: 655f 7479 7065 3c2f 613e 206a 203d 2030 e_type j = 0 │ │ │ │ +0000a050: 3b20 6a20 266c 743b 2043 4f4c 533b 202b ; j < COLS; + │ │ │ │ +0000a060: 2b6a 293c 2f64 6976 3e0a 3c64 6976 2063 +j)
    .
    232 │ │ │ │ +0000a0c0: 2020 2020 2020 2020 7265 7375 6c74 5b69 result[i │ │ │ │ +0000a0d0: 5d5b 6a5d 203d 2073 6361 6c61 7220 2a20 ][j] = scalar * │ │ │ │ +0000a0e0: 6d61 7472 6978 5b69 5d5b 6a5d 3b3c 2f64 matrix[i][j];.
    23 │ │ │ │ +0000a140: 333c 2f73 7061 6e3e 203c 2f64 6976 3e0a 3
    . │ │ │ │ +0000a150: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +0000a1e0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 . │ │ │ │ +0000a240: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0000a290: 2032 3336 3c2f 7370 616e 3e20 3c2f 6469 236 .
    238 │ │ │ │ +0000a2f0: 3c2f 7370 616e 3e20 2020 203c 7370 616e template │ │ │ │ +0000a320: 2026 6c74 3b3c 7370 616e 2063 6c61 7373 <class │ │ │ │ +0000a340: 203c 2f73 7061 6e3e 5363 616c 6172 2c3c Scalar,< │ │ │ │ +0000a350: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000a3a0: 3233 393c 2f73 7061 6e3e 2020 2020 2020 239 │ │ │ │ +0000a3b0: 2020 2020 2020 2020 7374 643a 3a65 6e61 std::ena │ │ │ │ +0000a3c0: 626c 655f 6966 5f74 266c 743b 4973 4e75 ble_if_t<IsNu │ │ │ │ +0000a3d0: 6d62 6572 266c 743b 5363 616c 6172 2667 mber<Scalar&g │ │ │ │ +0000a3e0: 743b 3a3a 7661 6c75 652c 203c 7370 616e t;::value, int& │ │ │ │ +0000a410: 6774 3b20 3d20 3026 6774 3b3c 2f64 6976 gt; = 0>
    .
    .
    240< │ │ │ │ +0000a500: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +0000a520: 6672 6965 6e64 3c2f 7370 616e 3e20 3c73 friend auto │ │ │ │ +0000a550: 3c61 2063 6c61 7373 3d22 636f 6465 2068 o │ │ │ │ +0000a5a0: 7065 7261 746f 722f 203c 2f61 3e28 203c perator/ ( < │ │ │ │ +0000a5b0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000a5c0: 6f72 6422 3e63 6f6e 7374 3c2f 7370 616e ord">const Fi │ │ │ │ +0000a600: 656c 644d 6174 7269 783c 2f61 3e26 616d eldMatrix&am │ │ │ │ +0000a610: 703b 206d 6174 7269 782c 2053 6361 6c61 p; matrix, Scala │ │ │ │ +0000a620: 7220 7363 616c 6172 293c 2f64 6976 3e0a r scalar)
    . │ │ │ │ +0000a630: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 . │ │ │ │ +0000a690: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    < │ │ │ │ +0000a7b0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0000a7c0: 6e6f 223e 2020 3234 333c 2f73 7061 6e3e no"> 243 │ │ │ │ +0000a7d0: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ +0000a820: 2020 3234 343c 2f73 7061 6e3e 2020 2020 244 │ │ │ │ +0000a830: 2020 3c73 7061 6e20 636c 6173 733d 226b for< │ │ │ │ +0000a850: 2f73 7061 6e3e 2028 3c61 2063 6c61 7373 /span> (size_typ │ │ │ │ +0000a8b0: 653c 2f61 3e20 6920 3d20 303b 2069 2026 e i = 0; i & │ │ │ │ +0000a8c0: 6c74 3b20 524f 5753 3b20 2b2b 6929 3c2f lt; ROWS; ++i).
    2 │ │ │ │ +0000a920: 3435 3c2f 7370 616e 3e20 2020 2020 2020 45 │ │ │ │ +0000a930: 203c 7370 616e 2063 6c61 7373 3d22 6b65 for (size_type │ │ │ │ +0000a9b0: 3c2f 613e 206a 203d 2030 3b20 6a20 266c j = 0; j &l │ │ │ │ +0000a9c0: 743b 2043 4f4c 533b 202b 2b6a 293c 2f64 t; COLS; ++j).
    24 │ │ │ │ +0000aa20: 363c 2f73 7061 6e3e 2020 2020 2020 2020 6 │ │ │ │ +0000aa30: 2020 7265 7375 6c74 5b69 5d5b 6a5d 203d result[i][j] = │ │ │ │ +0000aa40: 206d 6174 7269 785b 695d 5b6a 5d20 2f20 matrix[i][j] / │ │ │ │ +0000aa50: 7363 616c 6172 3b3c 2f64 6976 3e0a 3c64 scalar;
    . │ │ │ │ +0000aa70: 3c61 2069 643d 226c 3030 3234 3722 206e 247
    .
    248 │ │ │ │ +0000ab10: 2020 2020 3c73 7061 6e20 636c 6173 733d re │ │ │ │ +0000ab30: 7475 726e 3c2f 7370 616e 3e20 7265 7375 turn resu │ │ │ │ +0000ab40: 6c74 3b3c 2f64 6976 3e0a 3c64 6976 2063 lt;
    .
    249 │ │ │ │ +0000aba0: 2020 7d3c 2f64 6976 3e0a 3c2f 6469 763e }
    .
    │ │ │ │ +0000abb0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +0000ac20: 6120 6964 3d22 6c30 3032 3533 2220 6e61 a id="l00253" na │ │ │ │ +0000ac30: 6d65 3d22 6c30 3032 3533 223e 3c2f 613e me="l00253"> │ │ │ │ +0000ac40: 3c73 7061 6e20 636c 6173 733d 226c 696e 253 templ │ │ │ │ +0000ac80: 6174 653c 2f73 7061 6e3e 2026 6c74 3b3c ate << │ │ │ │ +0000ac90: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000aca0: 6f72 6422 3e63 6c61 7373 3c2f 7370 616e ord">class OtherScalar, < │ │ │ │ +0000acc0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000acd0: 6f72 6474 7970 6522 3e69 6e74 3c2f 7370 ordtype">int otherCols> │ │ │ │ +0000acf0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    ..
    │ │ │ │ +0000af40: 2020 3235 353c 2f73 7061 6e3e 2020 2020 255 │ │ │ │ +0000af50: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +0000af60: 2020 2020 2020 2020 3c73 7061 6e20 636c co │ │ │ │ +0000af80: 6e73 743c 2f73 7061 6e3e 203c 6120 636c nst FieldMatr │ │ │ │ +0000afc0: 6978 266c 743b 4f74 6865 7253 6361 6c61 ix<OtherScala │ │ │ │ +0000afd0: 722c 2043 4f4c 532c 206f 7468 6572 436f r, COLS, otherCo │ │ │ │ +0000afe0: 6c73 2667 743b 3c2f 613e 2661 6d70 3b20 ls>& │ │ │ │ +0000aff0: 6d61 7472 6978 4229 3c2f 6469 763e 0a3c matrixB)
    .< │ │ │ │ +0000b000: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0000b010: 3e3c 6120 6964 3d22 6c30 3032 3536 2220 > 256 {
    .< │ │ │ │ +0000b060: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0000b070: 3e3c 6120 6964 3d22 6c30 3032 3537 2220 > 257 FieldMatrix │ │ │ │ +0000b0f0: 266c 743b 7479 7065 6e61 6d65 2050 726f <typename Pro │ │ │ │ +0000b100: 6d6f 7469 6f6e 5472 6169 7473 266c 743b motionTraits< │ │ │ │ +0000b110: 4b2c 4f74 6865 7253 6361 6c61 7226 6774 K,OtherScalar> │ │ │ │ +0000b120: 3b3a 3a50 726f 6d6f 7465 6454 7970 653c ;::PromotedType< │ │ │ │ +0000b130: 2f61 3e2c 524f 5753 2c6f 7468 6572 436f /a>,ROWS,otherCo │ │ │ │ +0000b140: 6c73 2667 743b 2072 6573 756c 743b 3c2f ls> result;.
    2 │ │ │ │ +0000b1a0: 3538 3c2f 7370 616e 3e20 3c2f 6469 763e 58
    │ │ │ │ +0000b1b0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000b1e0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 259 for │ │ │ │ +0000b230: 283c 6120 636c 6173 733d 2263 6f64 6520 (size_type i │ │ │ │ +0000b290: 203d 2030 3b20 6920 266c 743b 206d 6174 = 0; i < mat │ │ │ │ +0000b2a0: 7269 7841 2e3c 6120 636c 6173 733d 2263 rixA.mat_rows(); ++i)
    │ │ │ │ +0000b310: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000b340: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 260 for (size_type │ │ │ │ +0000b3f0: 206a 203d 2030 3b20 6a20 266c 743b 206d j = 0; j < m │ │ │ │ +0000b400: 6174 7269 7842 2e3c 6120 636c 6173 733d atrixB.mat_cols │ │ │ │ +0000b460: 3c2f 613e 2829 3b20 2b2b 6a29 3c2f 6469 (); ++j).
    261 │ │ │ │ +0000b4c0: 3c2f 7370 616e 3e20 2020 2020 2020 207b { │ │ │ │ +0000b4d0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0000b520: 2032 3632 3c2f 7370 616e 3e20 2020 2020 262 │ │ │ │ +0000b530: 2020 2020 2072 6573 756c 745b 695d 5b6a result[i][j │ │ │ │ +0000b540: 5d20 3d20 303b 3c2f 6469 763e 0a3c 6469 ] = 0;
    .< │ │ │ │ +0000b560: 6120 6964 3d22 6c30 3032 3633 2220 6e61 a id="l00263" na │ │ │ │ +0000b570: 6d65 3d22 6c30 3032 3633 223e 3c2f 613e me="l00263"> │ │ │ │ +0000b580: 3c73 7061 6e20 636c 6173 733d 226c 696e 263 for │ │ │ │ +0000b5d0: 283c 6120 636c 6173 733d 2263 6f64 6520 (size_type k │ │ │ │ +0000b630: 203d 2030 3b20 6b20 266c 743b 206d 6174 = 0; k < mat │ │ │ │ +0000b640: 7269 7841 2e3c 6120 636c 6173 733d 2263 rixA.mat_cols(); ++k)
    │ │ │ │ +0000b6b0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000b6e0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 264 │ │ │ │ +0000b710: 2072 6573 756c 745b 695d 5b6a 5d20 2b3d result[i][j] += │ │ │ │ +0000b720: 206d 6174 7269 7841 5b69 5d5b 6b5d 202a matrixA[i][k] * │ │ │ │ +0000b730: 206d 6174 7269 7842 5b6b 5d5b 6a5d 3b3c matrixB[k][j];< │ │ │ │ +0000b740: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000b790: 3236 353c 2f73 7061 6e3e 2020 2020 2020 265 │ │ │ │ +0000b7a0: 2020 7d3c 2f64 6976 3e0a 3c64 6976 2063 }
    .
    266 < │ │ │ │ +0000b800: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000b850: 3236 373c 2f73 7061 6e3e 2020 2020 2020 267 │ │ │ │ +0000b860: 3c73 7061 6e20 636c 6173 733d 226b 6579 return │ │ │ │ +0000b880: 3c2f 7370 616e 3e20 7265 7375 6c74 3b3c result;< │ │ │ │ +0000b890: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000b8e0: 3236 383c 2f73 7061 6e3e 2020 2020 7d3c 268 }< │ │ │ │ +0000b8f0: 2f64 6976 3e0a 3c2f 6469 763e 0a3c 6469 /div>.
    .< │ │ │ │ +0000b910: 6120 6964 3d22 6c30 3032 3639 2220 6e61 a id="l00269" na │ │ │ │ +0000b920: 6d65 3d22 6c30 3032 3639 223e 3c2f 613e me="l00269"> │ │ │ │ +0000b930: 3c73 7061 6e20 636c 6173 733d 226c 696e 269
    .
    276 │ │ │ │ +0000b9b0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 template< │ │ │ │ +0000b9d0: 2f73 7061 6e3e 2026 6c74 3b3c 7370 616e /span> <class Ot │ │ │ │ +0000ba00: 6865 724d 6174 7269 782c 2073 7464 3a3a herMatrix, std:: │ │ │ │ +0000ba10: 656e 6162 6c65 5f69 665f 7426 6c74 3b3c enable_if_t<< │ │ │ │ +0000ba20: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000ba70: 3237 373c 2f73 7061 6e3e 2020 2020 2020 277 │ │ │ │ +0000ba80: 496d 706c 3a3a 4973 5374 6174 6963 5369 Impl::IsStaticSi │ │ │ │ +0000ba90: 7a65 4d61 7472 6978 5f76 266c 743b 4f74 zeMatrix_v<Ot │ │ │ │ +0000baa0: 6865 724d 6174 7269 7826 6774 3b3c 2f64 herMatrix>.
    27 │ │ │ │ +0000bb00: 383c 2f73 7061 6e3e 2020 2020 2020 616e 8 an │ │ │ │ +0000bb10: 6420 6e6f 7420 496d 706c 3a3a 4973 4669 d not Impl::IsFi │ │ │ │ +0000bb20: 656c 644d 6174 7269 785f 7626 6c74 3b4f eldMatrix_v<O │ │ │ │ +0000bb30: 7468 6572 4d61 7472 6978 2667 743b 3c2f therMatrix>.
    2 │ │ │ │ +0000bb90: 3739 3c2f 7370 616e 3e20 2020 2020 202c 79 , │ │ │ │ +0000bba0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 int> = 0> │ │ │ │ +0000bbd0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    ..
    │ │ │ │ +0000be20: 2020 3238 313c 2f73 7061 6e3e 2020 2020 281 │ │ │ │ +0000be30: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +0000be40: 2020 2020 2020 2020 3c73 7061 6e20 636c co │ │ │ │ +0000be60: 6e73 743c 2f73 7061 6e3e 204f 7468 6572 nst Other │ │ │ │ +0000be70: 4d61 7472 6978 2661 6d70 3b20 6d61 7472 Matrix& matr │ │ │ │ +0000be80: 6978 4229 3c2f 6469 763e 0a3c 6469 7620 ixB)
    .
    282 │ │ │ │ +0000bee0: 2020 207b 3c2f 6469 763e 0a3c 6469 7620 {
    .
    283 │ │ │ │ +0000bf40: 2020 2020 203c 7370 616e 2063 6c61 7373 using │ │ │ │ +0000bf60: 203c 2f73 7061 6e3e 4669 656c 6420 3d20 Field = │ │ │ │ +0000bf70: 3c73 7061 6e20 636c 6173 733d 226b 6579 typename PromotionT │ │ │ │ +0000bff0: 7261 6974 7326 6c74 3b4b 2c20 7479 7065 raits<K, type │ │ │ │ +0000c000: 6e61 6d65 204f 7468 6572 4d61 7472 6978 name OtherMatrix │ │ │ │ +0000c010: 3a3a 6669 656c 645f 7479 7065 2667 743b ::field_type> │ │ │ │ +0000c020: 3a3a 5072 6f6d 6f74 6564 5479 7065 3c2f ::PromotedType;
    ..
    285 │ │ │ │ +0000c160: 2020 2020 3c73 7061 6e20 636c 6173 733d fo │ │ │ │ +0000c180: 723c 2f73 7061 6e3e 2028 7374 643a 3a73 r (std::s │ │ │ │ +0000c190: 697a 655f 7420 6a3d 303b 206a 266c 743b ize_t j=0; j< │ │ │ │ +0000c1a0: 3c61 2063 6c61 7373 3d22 636f 6465 2068 rows; ++j)< │ │ │ │ +0000c200: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000c250: 3238 363c 2f73 7061 6e3e 2020 2020 2020 286 │ │ │ │ +0000c260: 2020 6d61 7472 6978 422e 3c61 2063 6c61 matrixB.mtv(matrixA[j], r │ │ │ │ +0000c2d0: 6573 756c 745b 6a5d 293b 3c2f 6469 763e esult[j]);
    │ │ │ │ +0000c2e0: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ +0000c370: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ +0000c3d0: 0a3c 2f64 6976 3e0a 3c64 6976 2063 6c61 .
    .
    │ │ │ │ +0000c420: 2020 3238 393c 2f73 7061 6e3e 203c 2f64 289 .
    29 │ │ │ │ +0000c480: 363c 2f73 7061 6e3e 2020 2020 3c73 7061 6 template <clas │ │ │ │ +0000c4d0: 7320 3c2f 7370 616e 3e4f 7468 6572 4d61 s OtherMa │ │ │ │ +0000c4e0: 7472 6978 2c20 7374 643a 3a65 6e61 626c trix, std::enabl │ │ │ │ +0000c4f0: 655f 6966 5f74 266c 743b 3c2f 6469 763e e_if_t<
    │ │ │ │ +0000c500: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000c530: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 297 Impl: │ │ │ │ +0000c560: 3a49 7353 7461 7469 6353 697a 654d 6174 :IsStaticSizeMat │ │ │ │ +0000c570: 7269 785f 7626 6c74 3b4f 7468 6572 4d61 rix_v<OtherMa │ │ │ │ +0000c580: 7472 6978 2667 743b 3c2f 6469 763e 0a3c trix>
    .< │ │ │ │ +0000c590: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0000c5a0: 3e3c 6120 6964 3d22 6c30 3032 3938 2220 > 298 and not │ │ │ │ +0000c5f0: 2049 6d70 6c3a 3a49 7346 6965 6c64 4d61 Impl::IsFieldMa │ │ │ │ +0000c600: 7472 6978 5f76 266c 743b 4f74 6865 724d trix_v<OtherM │ │ │ │ +0000c610: 6174 7269 7826 6774 3b3c 2f64 6976 3e0a atrix>
    . │ │ │ │ +0000c620: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +0000c650: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 299 , int │ │ │ │ +0000c6a0: 2667 743b 203d 2030 2667 743b 3c2f 6469 > = 0>.
    .
    300 │ │ │ │ +0000c790: 3c2f 7370 616e 3e20 2020 203c 7370 616e friend < │ │ │ │ +0000c7c0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000c7d0: 6f72 6422 3e61 7574 6f3c 2f73 7061 6e3e ord">auto │ │ │ │ +0000c7e0: 203c 6120 636c 6173 733d 2263 6f64 6520 │ │ │ │ +0000c830: 6f70 6572 6174 6f72 2a20 3c2f 613e 2820 operator* ( │ │ │ │ +0000c840: 3c73 7061 6e20 636c 6173 733d 226b 6579 const OtherMatrix&a │ │ │ │ +0000c870: 6d70 3b20 6d61 7472 6978 412c 3c2f 6469 mp; matrixA,.
    301 │ │ │ │ +0000c8d0: 3c2f 7370 616e 3e20 2020 2020 2020 2020 │ │ │ │ +0000c8e0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +0000c8f0: 2020 203c 7370 616e 2063 6c61 7373 3d22 const FieldMatrix& matrixB)< │ │ │ │ +0000c960: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000c9b0: 3330 323c 2f73 7061 6e3e 2020 2020 7b3c 302 {< │ │ │ │ +0000c9c0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000ca10: 3330 333c 2f73 7061 6e3e 2020 2020 2020 303 │ │ │ │ +0000ca20: 3c73 7061 6e20 636c 6173 733d 226b 6579 using Field = typename │ │ │ │ +0000ca70: 203c 6120 636c 6173 733d 2263 6f64 6520 PromotionTraits │ │ │ │ +0000cad0: 266c 743b 4b2c 2074 7970 656e 616d 6520 <K, typename │ │ │ │ +0000cae0: 4f74 6865 724d 6174 7269 783a 3a66 6965 OtherMatrix::fie │ │ │ │ +0000caf0: 6c64 5f74 7970 6526 6774 3b3a 3a50 726f ld_type>::Pro │ │ │ │ +0000cb00: 6d6f 7465 6454 7970 653c 2f61 3e3b 3c2f motedType;.
    3 │ │ │ │ +0000cb60: 3034 3c2f 7370 616e 3e20 2020 2020 203c 04 < │ │ │ │ +0000cb70: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +0000cb80: 5f63 6c61 7373 2220 6872 6566 3d22 6130 _class" href="a0 │ │ │ │ +0000cb90: 3134 3038 2e68 746d 6c22 3e44 756e 653a 1408.html">Dune: │ │ │ │ +0000cba0: 3a46 6965 6c64 4d61 7472 6978 266c 743b :FieldMatrix< │ │ │ │ +0000cbb0: 4669 656c 642c 204f 7468 6572 4d61 7472 Field, OtherMatr │ │ │ │ +0000cbc0: 6978 3a3a 726f 7773 2c20 636f 6c73 2667 ix::rows, cols&g │ │ │ │ +0000cbd0: 743b 3c2f 613e 2072 6573 756c 743b 3c2f t; result;.
    3 │ │ │ │ +0000cc30: 3035 3c2f 7370 616e 3e20 2020 2020 203c 05 < │ │ │ │ +0000cc40: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000cc50: 6f72 6466 6c6f 7722 3e66 6f72 3c2f 7370 ordflow">for (std::size_t │ │ │ │ +0000cc70: 206a 3d30 3b20 6a26 6c74 3b3c 6120 636c j=0; j<cols │ │ │ │ +0000ccd0: 3c2f 613e 3b20 2b2b 6a29 3c2f 6469 763e ; ++j)
    │ │ │ │ +0000cce0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000cd10: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 306 {.
    307 │ │ │ │ +0000cd90: 3c2f 7370 616e 3e20 2020 2020 2020 203c < │ │ │ │ +0000cda0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000cdb0: 6f72 6422 3e61 7574 6f3c 2f73 7061 6e3e ord">auto │ │ │ │ +0000cdc0: 2042 5f6a 203d 2049 6d70 6c3a 3a43 6f6c B_j = Impl::Col │ │ │ │ +0000cdd0: 756d 6e56 6563 746f 7256 6965 7728 6d61 umnVectorView(ma │ │ │ │ +0000cde0: 7472 6978 422c 206a 293b 3c2f 6469 763e trixB, j);
    │ │ │ │ +0000cdf0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000ce20: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 308 auto r │ │ │ │ +0000ce70: 6573 756c 745f 6a20 3d20 496d 706c 3a3a esult_j = Impl:: │ │ │ │ +0000ce80: 436f 6c75 6d6e 5665 6374 6f72 5669 6577 ColumnVectorView │ │ │ │ +0000ce90: 2872 6573 756c 742c 206a 293b 3c2f 6469 (result, j);.
    309 │ │ │ │ +0000cef0: 3c2f 7370 616e 3e20 2020 2020 2020 206d m │ │ │ │ +0000cf00: 6174 7269 7841 2e6d 7628 425f 6a2c 2072 atrixA.mv(B_j, r │ │ │ │ +0000cf10: 6573 756c 745f 6a29 3b3c 2f64 6976 3e0a esult_j);
    . │ │ │ │ +0000cf20: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    311< │ │ │ │ +0000cfd0: 2f73 7061 6e3e 2020 2020 2020 3c73 7061 /span> return result;
    .
    312< │ │ │ │ +0000d060: 2f73 7061 6e3e 2020 2020 7d3c 2f64 6976 /span> }
    .
    .
    313 .
    3 │ │ │ │ +0000d120: 3135 3c2f 7370 616e 3e20 2020 203c 7370 15 template< │ │ │ │ +0000d170: 696e 743c 2f73 7061 6e3e 206c 2667 743b int l> │ │ │ │ +0000d180: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    .< │ │ │ │ +0000d1e0: 6120 6964 3d22 6c30 3033 3136 2220 6e61 a id="l00316" na │ │ │ │ +0000d1f0: 6d65 3d22 6c30 3033 3136 223e 3c2f 613e me="l00316"> │ │ │ │ +0000d200: 3c73 7061 6e20 636c 6173 733d 226c 696e 316< │ │ │ │ +0000d260: 2f61 3e3c 2f73 7061 6e3e 2020 2020 3c61 /a> FieldM │ │ │ │ +0000d2a0: 6174 7269 7826 6c74 3b4b 2c6c 2c63 6f6c atrix<K,l,col │ │ │ │ +0000d2b0: 7326 6774 3b3c 2f61 3e20 3c61 2063 6c61 s> leftm │ │ │ │ +0000d310: 756c 7469 706c 7961 6e79 3c2f 613e 2028 ultiplyany ( │ │ │ │ +0000d320: 3c73 7061 6e20 636c 6173 733d 226b 6579 const F │ │ │ │ +0000d370: 6965 6c64 4d61 7472 6978 266c 743b 4b2c ieldMatrix<K, │ │ │ │ +0000d380: 6c2c 726f 7773 2667 743b 3c2f 613e 2661 l,rows>&a │ │ │ │ +0000d390: 6d70 3b20 3c61 2063 6c61 7373 3d22 636f mp; M) const.
    3 │ │ │ │ +0000d460: 3137 3c2f 7370 616e 3e3c 7370 616e 2063 17 │ │ │ │ +0000d480: 2020 203c 2f73 7061 6e3e 7b3c 2f64 6976 {
    . │ │ │ │ +0000d540: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +0000d5b0: 6120 6964 3d22 6c30 3033 3230 2220 6e61 a id="l00320" na │ │ │ │ +0000d5c0: 6d65 3d22 6c30 3033 3230 223e 3c2f 613e me="l00320"> │ │ │ │ +0000d5d0: 3c73 7061 6e20 636c 6173 733d 226c 696e 320 for (siz │ │ │ │ +0000d670: 655f 7479 7065 3c2f 613e 2069 3d30 3b20 e_type i=0; │ │ │ │ +0000d680: 6926 6c74 3b6c 3b20 692b 2b29 207b 3c2f i<l; i++) {.
    3 │ │ │ │ +0000d6e0: 3231 3c2f 7370 616e 3e20 2020 2020 2020 21 │ │ │ │ +0000d6f0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 for (size_type │ │ │ │ +0000d770: 3c2f 613e 206a 3d30 3b20 6a26 6c74 3b3c j=0; j<< │ │ │ │ +0000d780: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +0000d790: 5f76 6172 6961 626c 6522 2068 7265 663d _variable" href= │ │ │ │ +0000d7a0: 2261 3031 3430 382e 6874 6d6c 2361 6332 "a01408.html#ac2 │ │ │ │ +0000d7b0: 3831 3666 3164 3036 3766 3533 3333 3636 816f1d067f533366 │ │ │ │ +0000d7c0: 3239 3763 3035 3366 3037 3039 3962 223e 297c053f07099b"> │ │ │ │ +0000d7d0: 636f 6c73 3c2f 613e 3b20 6a2b 2b29 207b cols; j++) { │ │ │ │ +0000d7e0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0000d830: 2033 3232 3c2f 7370 616e 3e20 2020 2020 322 │ │ │ │ +0000d840: 2020 2020 2043 5b69 5d5b 6a5d 203d 2030 C[i][j] = 0 │ │ │ │ +0000d850: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +0000d8a0: 2020 3332 333c 2f73 7061 6e3e 2020 2020 323 │ │ │ │ +0000d8b0: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +0000d8d0: 666f 723c 2f73 7061 6e3e 2028 3c61 2063 for (size │ │ │ │ +0000d930: 5f74 7970 653c 2f61 3e20 6b3d 303b 206b _type k=0; k │ │ │ │ +0000d940: 266c 743b 3c61 2063 6c61 7373 3d22 636f <rows; k │ │ │ │ +0000d9a0: 2b2b 293c 2f64 6976 3e0a 3c64 6976 2063 ++)
    .
    324 │ │ │ │ +0000da00: 2020 2020 2020 2020 2020 435b 695d 5b6a C[i][j │ │ │ │ +0000da10: 5d20 2b3d 203c 6120 636c 6173 733d 2263 ] += M[i][k │ │ │ │ +0000da70: 5d2a 282a 3c73 7061 6e20 636c 6173 733d ]*(*this)[k][j];.
    32 │ │ │ │ +0000daf0: 353c 2f73 7061 6e3e 2020 2020 2020 2020 5 │ │ │ │ +0000db00: 7d3c 2f64 6976 3e0a 3c64 6976 2063 6c61 }
    .
    │ │ │ │ +0000db50: 2020 3332 363c 2f73 7061 6e3e 2020 2020 326 │ │ │ │ +0000db60: 2020 7d3c 2f64 6976 3e0a 3c64 6976 2063 }
    .
    327 │ │ │ │ +0000dbc0: 2020 2020 3c73 7061 6e20 636c 6173 733d re │ │ │ │ +0000dbe0: 7475 726e 3c2f 7370 616e 3e20 433b 3c2f turn C;.
    3 │ │ │ │ +0000dc40: 3238 3c2f 7370 616e 3e20 2020 207d 3c2f 28 }.
    .
    < │ │ │ │ +0000dc90: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0000dca0: 6e6f 223e 2020 3332 393c 2f73 7061 6e3e no"> 329 │ │ │ │ +0000dcb0: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ +0000dd00: 2020 3333 303c 2f73 7061 6e3e 2020 2020 330 │ │ │ │ +0000dd10: 3c73 7061 6e20 636c 6173 733d 226b 6579 using Base::rightm │ │ │ │ +0000dd90: 756c 7469 706c 793c 2f61 3e3b 3c2f 6469 ultiply;.
    331 │ │ │ │ +0000ddf0: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +0000de00: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0000de10: 3e3c 6120 6964 3d22 6c30 3033 3333 2220 > 333 tem │ │ │ │ +0000de70: 706c 6174 653c 2f73 7061 6e3e 2026 6c74 plate < │ │ │ │ +0000de80: 3b3c 7370 616e 2063 6c61 7373 3d22 6b65 ;int r, int c& │ │ │ │ +0000ded0: 6774 3b3c 2f64 6976 3e0a 3c64 6976 2063 gt;
    .
    . │ │ │ │ +0000df20: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +0000df50: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 3 │ │ │ │ +0000dfb0: 3334 3c2f 613e 3c2f 7370 616e 3e20 2020 34 │ │ │ │ +0000dfc0: 203c 6120 636c 6173 733d 2263 6f64 6520 Fie │ │ │ │ +0000dff0: 6c64 4d61 7472 6978 3c2f 613e 2661 6d70 ldMatrix& │ │ │ │ +0000e000: 3b20 3c61 2063 6c61 7373 3d22 636f 6465 ; rightmultiply │ │ │ │ +0000e060: 3c2f 613e 2028 3c73 7061 6e20 636c 6173 (cons │ │ │ │ +0000e080: 743c 2f73 7061 6e3e 203c 6120 636c 6173 t FieldMatrix │ │ │ │ +0000e0c0: 266c 743b 4b2c 722c 6326 6774 3b3c 2f61 <K,r,c>& M).
    3 │ │ │ │ +0000e180: 3335 3c2f 7370 616e 3e20 2020 207b 3c2f 35 {.
    3 │ │ │ │ +0000e1e0: 3336 3c2f 7370 616e 3e20 2020 2020 203c 36 < │ │ │ │ +0000e1f0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000e200: 6f72 6422 3e73 7461 7469 635f 6173 7365 ord">static_asse │ │ │ │ +0000e210: 7274 3c2f 7370 616e 3e28 7220 3d3d 2063 rt(r == c │ │ │ │ +0000e220: 2c20 3c73 7061 6e20 636c 6173 733d 2273 , &q │ │ │ │ +0000e240: 756f 743b 4361 6e6e 6f74 2072 6967 6874 uot;Cannot right │ │ │ │ +0000e250: 6d75 6c74 6970 6c79 2077 6974 6820 6e6f multiply with no │ │ │ │ +0000e260: 6e2d 7371 7561 7265 206d 6174 7269 7826 n-square matrix& │ │ │ │ +0000e270: 7175 6f74 3b3c 2f73 7061 6e3e 293b 3c2f quot;);.
    3 │ │ │ │ +0000e2d0: 3337 3c2f 7370 616e 3e20 2020 2020 203c 37 < │ │ │ │ +0000e2e0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000e2f0: 6f72 6422 3e73 7461 7469 635f 6173 7365 ord">static_asse │ │ │ │ +0000e300: 7274 3c2f 7370 616e 3e28 7220 3d3d 203c rt(r == < │ │ │ │ +0000e310: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +0000e320: 5f76 6172 6961 626c 6522 2068 7265 663d _variable" href= │ │ │ │ +0000e330: 2261 3031 3430 382e 6874 6d6c 2361 6332 "a01408.html#ac2 │ │ │ │ +0000e340: 3831 3666 3164 3036 3766 3533 3333 3636 816f1d067f533366 │ │ │ │ +0000e350: 3239 3763 3035 3366 3037 3039 3962 223e 297c053f07099b"> │ │ │ │ +0000e360: 636f 6c73 3c2f 613e 2c20 3c73 7061 6e20 cols, "Size │ │ │ │ +0000e390: 206d 6973 6d61 7463 6826 7175 6f74 3b3c mismatch"< │ │ │ │ +0000e3a0: 2f73 7061 6e3e 293b 3c2f 6469 763e 0a3c /span>);
    .< │ │ │ │ +0000e3b0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0000e3c0: 3e3c 6120 6964 3d22 6c30 3033 3338 2220 > 338 FieldMatrix │ │ │ │ +0000e440: 266c 743b 4b2c 726f 7773 2c63 6f6c 7326 <K,rows,cols& │ │ │ │ +0000e450: 6774 3b3c 2f61 3e20 4328 2a3c 7370 616e gt; C(*this);.
    3 │ │ │ │ +0000e4d0: 3339 3c2f 7370 616e 3e20 3c2f 6469 763e 39
    │ │ │ │ +0000e4e0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000e510: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 340 for │ │ │ │ +0000e560: 283c 6120 636c 6173 733d 2263 6f64 6520 (size_type i │ │ │ │ +0000e5c0: 3d30 3b20 6926 6c74 3b3c 6120 636c 6173 =0; i<rows; i++)
    .< │ │ │ │ +0000e630: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0000e640: 3e3c 6120 6964 3d22 6c30 3033 3431 2220 > 341 for │ │ │ │ +0000e6b0: 283c 6120 636c 6173 733d 2263 6f64 6520 (size_type j │ │ │ │ +0000e710: 3d30 3b20 6a26 6c74 3b3c 6120 636c 6173 =0; j<cols; j++) {
    │ │ │ │ +0000e780: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000e7b0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 342 ( │ │ │ │ +0000e7e0: 2a74 6869 7329 5b69 5d5b 6a5d 203d 2030 *this)[i][j] = 0 │ │ │ │ +0000e7f0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +0000e840: 2020 3334 333c 2f73 7061 6e3e 2020 2020 343 │ │ │ │ +0000e850: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +0000e870: 666f 723c 2f73 7061 6e3e 2028 3c61 2063 for (size │ │ │ │ +0000e8d0: 5f74 7970 653c 2f61 3e20 6b3d 303b 206b _type k=0; k │ │ │ │ +0000e8e0: 266c 743b 3c61 2063 6c61 7373 3d22 636f <cols; k │ │ │ │ +0000e940: 2b2b 293c 2f64 6976 3e0a 3c64 6976 2063 ++)
    .
    344 │ │ │ │ +0000e9a0: 2020 2020 2020 2020 2020 282a 3c73 7061 (*this)[i │ │ │ │ +0000e9d0: 5d5b 6a5d 202b 3d20 435b 695d 5b6b 5d2a ][j] += C[i][k]* │ │ │ │ +0000e9e0: 3c61 2063 6c61 7373 3d22 636f 6465 2068 M[k][j];.
    34 │ │ │ │ +0000ea90: 353c 2f73 7061 6e3e 2020 2020 2020 2020 5 │ │ │ │ +0000eaa0: 7d3c 2f64 6976 3e0a 3c64 6976 2063 6c61 }
    .
    │ │ │ │ +0000eaf0: 2020 3334 363c 2f73 7061 6e3e 2020 2020 346 │ │ │ │ +0000eb00: 2020 3c73 7061 6e20 636c 6173 733d 226b retu │ │ │ │ +0000eb20: 726e 3c2f 7370 616e 3e20 2a3c 7370 616e rn *this;.
    34 │ │ │ │ +0000eba0: 373c 2f73 7061 6e3e 2020 2020 7d3c 2f64 7 }.
    .
    348 │ │ │ │ +0000ec10: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0000ec60: 2033 3530 3c2f 7370 616e 3e20 2020 203c 350 < │ │ │ │ +0000ec70: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0000ec80: 6f72 6422 3e74 656d 706c 6174 653c 2f73 ord">template<int l&g │ │ │ │ +0000ecc0: 743b 3c2f 6469 763e 0a3c 6469 7620 636c t;
    ..
    │ │ │ │ +0000efa0: 2020 3335 323c 2f73 7061 6e3e 3c73 7061 352 {.
    3 │ │ │ │ +0000f020: 3533 3c2f 7370 616e 3e20 2020 2020 203c 53 < │ │ │ │ +0000f030: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +0000f040: 5f63 6c61 7373 2220 6872 6566 3d22 6130 _class" href="a0 │ │ │ │ +0000f050: 3134 3038 2e68 746d 6c22 3e46 6965 6c64 1408.html">Field │ │ │ │ +0000f060: 4d61 7472 6978 266c 743b 4b2c 726f 7773 Matrix<K,rows │ │ │ │ +0000f070: 2c6c 2667 743b 3c2f 613e 2043 3b3c 2f64 ,l> C;.
    35 │ │ │ │ +0000f0d0: 343c 2f73 7061 6e3e 203c 2f64 6976 3e0a 4
    . │ │ │ │ +0000f0e0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +0000f230: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +0000f260: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 356 for │ │ │ │ +0000f2b0: 2028 3c61 2063 6c61 7373 3d22 636f 6465 (size_type │ │ │ │ +0000f310: 6a3d 303b 206a 266c 743b 6c3b 206a 2b2b j=0; j<l; j++ │ │ │ │ +0000f320: 2920 7b3c 2f64 6976 3e0a 3c64 6976 2063 ) {
    .
    357 │ │ │ │ +0000f380: 2020 2020 2020 2020 435b 695d 5b6a 5d20 C[i][j] │ │ │ │ +0000f390: 3d20 303b 3c2f 6469 763e 0a3c 6469 7620 = 0;
    .
    358 │ │ │ │ +0000f3f0: 2020 2020 2020 2020 203c 7370 616e 2063 for (< │ │ │ │ +0000f420: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +0000f430: 5f74 7970 6564 6566 2220 6872 6566 3d22 _typedef" href=" │ │ │ │ +0000f440: 6130 3134 3038 2e68 746d 6c23 6133 3966 a01408.html#a39f │ │ │ │ +0000f450: 3061 6561 3935 3264 3061 3130 6362 6335 0aea952d0a10cbc5 │ │ │ │ +0000f460: 6263 6135 3863 3465 3939 3266 3122 3e73 bca58c4e992f1">s │ │ │ │ +0000f470: 697a 655f 7479 7065 3c2f 613e 206b 3d30 ize_type k=0 │ │ │ │ +0000f480: 3b20 6b26 6c74 3b3c 6120 636c 6173 733d ; k<cols │ │ │ │ +0000f4e0: 3b20 6b2b 2b29 3c2f 6469 763e 0a3c 6469 ; k++)
    .< │ │ │ │ +0000f500: 6120 6964 3d22 6c30 3033 3539 2220 6e61 a id="l00359" na │ │ │ │ +0000f510: 6d65 3d22 6c30 3033 3539 223e 3c2f 613e me="l00359"> │ │ │ │ +0000f520: 3c73 7061 6e20 636c 6173 733d 226c 696e 359 C[i │ │ │ │ +0000f550: 5d5b 6a5d 202b 3d20 282a 3c73 7061 6e20 ][j] += (* │ │ │ │ +0000f570: 7468 6973 3c2f 7370 616e 3e29 5b69 5d5b this)[i][ │ │ │ │ +0000f580: 6b5d 2a3c 6120 636c 6173 733d 2263 6f64 k]*M[k][j]; │ │ │ │ +0000f5e0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0000f630: 2033 3630 3c2f 7370 616e 3e20 2020 2020 360 │ │ │ │ +0000f640: 2020 207d 3c2f 6469 763e 0a3c 6469 7620 }
    .
    361 │ │ │ │ +0000f6a0: 2020 2020 207d 3c2f 6469 763e 0a3c 6469 }
    .< │ │ │ │ +0000f6c0: 6120 6964 3d22 6c30 3033 3632 2220 6e61 a id="l00362" na │ │ │ │ +0000f6d0: 6d65 3d22 6c30 3033 3632 223e 3c2f 613e me="l00362"> │ │ │ │ +0000f6e0: 3c73 7061 6e20 636c 6173 733d 226c 696e 362 return C │ │ │ │ +0000f730: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +0000f780: 2020 3336 333c 2f73 7061 6e3e 2020 2020 363 │ │ │ │ +0000f790: 7d3c 2f64 6976 3e0a 3c2f 6469 763e 0a3c }
    .
    .< │ │ │ │ +0000f7a0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0000f7b0: 3e3c 6120 6964 3d22 6c30 3033 3634 2220 > 364
    .
    365 │ │ │ │ +0000f850: 2020 203c 7370 616e 2063 6c61 7373 3d22 // make │ │ │ │ +0000f870: 2074 6869 7320 7468 696e 6720 6120 6d61 this thing a ma │ │ │ │ +0000f880: 7472 6978 3c2f 7370 616e 3e3c 2f64 6976 trix
    .
    │ │ │ │ +0000f920: 2033 3636 3c2f 613e 3c2f 7370 616e 3e20 366 │ │ │ │ +0000f930: 2020 203c 7370 616e 2063 6c61 7373 3d22 static< │ │ │ │ +0000f950: 2f73 7061 6e3e 203c 7370 616e 2063 6c61 /span> con │ │ │ │ +0000f970: 7374 6578 7072 3c2f 7370 616e 3e20 3c61 stexpr si │ │ │ │ +0000f9d0: 7a65 5f74 7970 653c 2f61 3e20 3c61 2063 ze_type mat │ │ │ │ +0000fa30: 5f72 6f77 733c 2f61 3e28 2920 7b20 3c73 _rows() { return ROWS; }.
    367 stati │ │ │ │ +0000fb30: 633c 2f73 7061 6e3e 203c 7370 616e 2063 c c │ │ │ │ +0000fb50: 6f6e 7374 6578 7072 3c2f 7370 616e 3e20 onstexpr │ │ │ │ +0000fb60: 3c61 2063 6c61 7373 3d22 636f 6465 2068 │ │ │ │ +0000fbb0: 7369 7a65 5f74 7970 653c 2f61 3e20 3c61 size_type m │ │ │ │ +0000fc10: 6174 5f63 6f6c 733c 2f61 3e28 2920 7b20 at_cols() { │ │ │ │ +0000fc20: 3c73 7061 6e20 636c 6173 733d 226b 6579 return │ │ │ │ +0000fc40: 3c2f 7370 616e 3e20 434f 4c53 3b20 7d3c COLS; }< │ │ │ │ +0000fc50: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0000fca0: 3336 383c 2f73 7061 6e3e 203c 2f64 6976 368
    .
    . │ │ │ │ +0000fea0: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ +0000ff00: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0000ff30: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 371 DUNE_ │ │ │ │ +0000ffb0: 4153 5345 5254 5f42 4f55 4e44 533c 2f61 ASSERT_BOUNDS(i < ROWS);< │ │ │ │ +0000ffd0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00010020: 3337 323c 2f73 7061 6e3e 2020 2020 2020 372 │ │ │ │ +00010030: 3c73 7061 6e20 636c 6173 733d 226b 6579 return │ │ │ │ +00010050: 3c2f 7370 616e 3e20 5f64 6174 615b 695d _data[i] │ │ │ │ +00010060: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +000100b0: 2020 3337 333c 2f73 7061 6e3e 2020 2020 373 │ │ │ │ +000100c0: 7d3c 2f64 6976 3e0a 3c2f 6469 763e 0a3c }
    .
    .< │ │ │ │ +000100d0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +000100e0: 3e3c 6120 6964 3d22 6c30 3033 3734 2220 > 374
    .
    │ │ │ │ +00010170: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +000101a0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d │ │ │ │ +00010200: 3337 353c 2f61 3e3c 2f73 7061 6e3e 2020 375 │ │ │ │ +00010210: 2020 3c61 2063 6c61 7373 3d22 636f 6465 co │ │ │ │ +00010240: 6e73 745f 726f 775f 7265 6665 7265 6e63 nst_row_referenc │ │ │ │ +00010250: 653c 2f61 3e20 3c61 2063 6c61 7373 3d22 e mat_acces │ │ │ │ +000102b0: 733c 2f61 3e20 2820 3c61 2063 6c61 7373 s ( size_typ │ │ │ │ +00010310: 653c 2f61 3e20 6920 293c 7370 616e 2063 e i ) │ │ │ │ +00010330: 636f 6e73 743c 2f73 7061 6e3e 3c2f 6469 const.
    376 │ │ │ │ +00010390: 3c2f 7370 616e 3e3c 7370 616e 2063 6c61 │ │ │ │ +000103b0: 203c 2f73 7061 6e3e 7b3c 2f64 6976 3e0a {
    . │ │ │ │ +000103c0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +000103f0: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 377 DUNE_A │ │ │ │ +00010470: 5353 4552 545f 424f 554e 4453 3c2f 613e SSERT_BOUNDS │ │ │ │ +00010480: 2869 2026 6c74 3b20 524f 5753 293b 3c2f (i < ROWS);.
    3 │ │ │ │ +000104e0: 3738 3c2f 7370 616e 3e20 2020 2020 203c 78 < │ │ │ │ +000104f0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00010500: 6f72 6466 6c6f 7722 3e72 6574 7572 6e3c ordflow">return< │ │ │ │ +00010510: 2f73 7061 6e3e 205f 6461 7461 5b69 5d3b /span> _data[i]; │ │ │ │ +00010520: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00010570: 2033 3739 3c2f 7370 616e 3e20 2020 207d 379 } │ │ │ │ +00010580: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c64
    .
    . │ │ │ │ +000105a0: 3c61 2069 643d 226c 3030 3338 3022 206e 380 };
    ..
    38 │ │ │ │ +00010640: 313c 2f73 7061 6e3e 203c 2f64 6976 3e0a 1
    . │ │ │ │ +00010650: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +00010710: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +00010740: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 385 template&l │ │ │ │ +00010770: 743b 636c 6173 7320 4b26 6774 3b3c 2f64 t;class K>.
    38 │ │ │ │ +000107d0: 363c 2f73 7061 6e3e 2020 3c73 7061 6e20 6 │ │ │ │ +000107f0: 636c 6173 7320 3c2f 7370 616e 3e46 6965 class Fie │ │ │ │ +00010800: 6c64 4d61 7472 6978 266c 743b 4b2c 312c ldMatrix<K,1, │ │ │ │ +00010810: 3126 6774 3b20 3a20 3c73 7061 6e20 636c 1> : pu │ │ │ │ +00010830: 626c 6963 3c2f 7370 616e 3e20 4465 6e73 blic Dens │ │ │ │ +00010840: 654d 6174 7269 7826 6c74 3b20 4669 656c eMatrix< Fiel │ │ │ │ +00010850: 644d 6174 7269 7826 6c74 3b4b 2c31 2c31 dMatrix<K,1,1 │ │ │ │ +00010860: 2667 743b 2026 6774 3b3c 2f64 6976 3e0a > >
    . │ │ │ │ +00010870: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +000108e0: 3c61 2069 643d 226c 3030 3338 3822 206e 388 FieldVecto │ │ │ │ +00010930: 7226 6c74 3b4b 2c31 2667 743b 205f 6461 r<K,1> _da │ │ │ │ +00010940: 7461 3b3c 2f64 6976 3e0a 3c64 6976 2063 ta;
    .
    389 │ │ │ │ +000109a0: 2020 3c73 7061 6e20 636c 6173 733d 226b typedef< │ │ │ │ +000109c0: 2f73 7061 6e3e 2044 656e 7365 4d61 7472 /span> DenseMatr │ │ │ │ +000109d0: 6978 266c 743b 2046 6965 6c64 4d61 7472 ix< FieldMatr │ │ │ │ +000109e0: 6978 266c 743b 4b2c 312c 3126 6774 3b20 ix<K,1,1> │ │ │ │ +000109f0: 2667 743b 2042 6173 653b 3c2f 6469 763e > Base;
    │ │ │ │ +00010a00: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00010a30: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 390 pub │ │ │ │ +00010a70: 6c69 633c 2f73 7061 6e3e 3a3c 2f64 6976 lic:
    .
    391< │ │ │ │ +00010ad0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +00010af0: 2f2f 2073 7461 6e64 6172 6420 636f 6e73 // standard cons │ │ │ │ +00010b00: 7472 7563 746f 7220 616e 6420 6576 6572 tructor and ever │ │ │ │ +00010b10: 7974 6869 6e67 2069 7320 7375 6666 6963 ything is suffic │ │ │ │ +00010b20: 6965 6e74 202e 2e2e 3c2f 7370 616e 3e3c ient ...< │ │ │ │ +00010b30: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00010b80: 3339 323c 2f73 7061 6e3e 203c 2f64 6976 392
    .
    393< │ │ │ │ +00010be0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +00010c00: 2f2f 3d3d 3d3d 3d20 7479 7065 2064 6566 //===== type def │ │ │ │ +00010c10: 696e 6974 696f 6e73 2061 6e64 2063 6f6e initions and con │ │ │ │ +00010c20: 7374 616e 7473 3c2f 7370 616e 3e3c 2f64 stants.
    39 │ │ │ │ +00010c80: 343c 2f73 7061 6e3e 203c 2f64 6976 3e0a 4
    . │ │ │ │ +00010c90: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ +00010e30: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00010e40: 6e6f 223e 2020 3339 373c 2f73 7061 6e3e no"> 397 │ │ │ │ +00010e50: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ +00010ea0: 2020 3430 303c 2f73 7061 6e3e 2020 2020 400 │ │ │ │ +00010eb0: 3c73 7061 6e20 636c 6173 733d 226b 6579 constexpr< │ │ │ │ +00010ed0: 2f73 7061 6e3e 203c 7370 616e 2063 6c61 /span> sta │ │ │ │ +00010ef0: 7469 633c 2f73 7061 6e3e 203c 7370 616e tic int │ │ │ │ +00010f20: 3c61 2063 6c61 7373 3d22 636f 6465 2068 blocklevel │ │ │ │ +00010f80: 3d20 313b 3c2f 6469 763e 0a3c 6469 7620 = 1;
    .
    401 │ │ │ │ +00010fe0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00011030: 2034 3032 3c2f 7370 616e 3e20 2020 203c 402 < │ │ │ │ +00011040: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00011050: 6f72 6422 3e74 7970 6564 6566 3c2f 7370 ord">typedef typena │ │ │ │ +00011080: 6d65 3c2f 7370 616e 3e20 3c61 2063 6c61 me Base:: │ │ │ │ +000110e0: 726f 775f 7479 7065 3c2f 613e 203c 6120 row_type row │ │ │ │ +00011140: 5f74 7970 653c 2f61 3e3b 3c2f 6469 763e _type;
    │ │ │ │ +00011150: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +000111c0: 6120 6964 3d22 6c30 3034 3034 2220 6e61 a id="l00404" na │ │ │ │ +000111d0: 6d65 3d22 6c30 3034 3034 223e 3c2f 613e me="l00404"> │ │ │ │ +000111e0: 3c73 7061 6e20 636c 6173 733d 226c 696e 404 typed │ │ │ │ +00011220: 6566 3c2f 7370 616e 3e20 3c73 7061 6e20 ef │ │ │ │ +00011240: 7479 7065 6e61 6d65 3c2f 7370 616e 3e20 typename │ │ │ │ +00011250: 3c61 2063 6c61 7373 3d22 636f 6465 2068 │ │ │ │ +000112a0: 4261 7365 3a3a 726f 775f 7265 6665 7265 Base::row_refere │ │ │ │ +000112b0: 6e63 653c 2f61 3e20 3c61 2063 6c61 7373 nce row_refe │ │ │ │ +00011310: 7265 6e63 653c 2f61 3e3b 3c2f 6469 763e rence;
    │ │ │ │ +00011320: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ +000114a0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +00011510: 6120 6964 3d22 6c30 3034 3039 2220 6e61 a id="l00409" na │ │ │ │ +00011520: 6d65 3d22 6c30 3034 3039 223e 3c2f 613e me="l00409"> │ │ │ │ +00011530: 3c73 7061 6e20 636c 6173 733d 226c 696e 409 const │ │ │ │ +00011570: 6578 7072 3c2f 7370 616e 3e20 3c73 7061 expr static │ │ │ │ +000115a0: 3c73 7061 6e20 636c 6173 733d 226b 6579 int rows = │ │ │ │ +00011620: 2031 3b3c 2f64 6976 3e0a 3c64 6976 2063 1;
    .
    412 │ │ │ │ +00011680: 2020 3c73 7061 6e20 636c 6173 733d 226b constexp │ │ │ │ +000116a0: 723c 2f73 7061 6e3e 203c 7370 616e 2063 r s │ │ │ │ +000116c0: 7461 7469 633c 2f73 7061 6e3e 203c 7370 tatic int cols = 1; │ │ │ │ +00011750: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000117a0: 2034 3133 3c2f 7370 616e 3e20 3c2f 6469 413 .
    414 │ │ │ │ +00011800: 3c2f 7370 616e 3e20 2020 203c 7370 616e //===== constru │ │ │ │ +00011830: 6374 6f72 733c 2f73 7061 6e3e 3c2f 6469 ctors.
    417 │ │ │ │ +00011890: 3c2f 7370 616e 3e20 2020 203c 7370 616e constexpr FieldMatrix() = default; │ │ │ │ +00011950: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000119a0: 2034 3138 3c2f 7370 616e 3e20 3c2f 6469 418 .
    421 │ │ │ │ +00011a00: 3c2f 7370 616e 3e20 2020 203c 6120 636c Fiel │ │ │ │ +00011a60: 644d 6174 7269 783c 2f61 3e28 7374 643a dMatrix(std: │ │ │ │ +00011a70: 3a69 6e69 7469 616c 697a 6572 5f6c 6973 :initializer_lis │ │ │ │ +00011a80: 7426 6c74 3b3c 6120 636c 6173 733d 2263 t<Dune::FieldVect │ │ │ │ +00011ac0: 6f72 266c 743b 4b2c 2031 2667 743b 3c2f or<K, 1>> con │ │ │ │ +00011af0: 7374 3c2f 7370 616e 3e20 2661 6d70 3b6c st &l │ │ │ │ +00011b00: 293c 2f64 6976 3e0a 3c64 6976 2063 6c61 )
    .
    │ │ │ │ +00011b50: 2020 3432 323c 2f73 7061 6e3e 2020 2020 422 │ │ │ │ +00011b60: 7b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 {
    .
    │ │ │ │ +00011bb0: 2020 3432 333c 2f73 7061 6e3e 2020 2020 423 │ │ │ │ +00011bc0: 2020 7374 643a 3a63 6f70 795f 6e28 6c2e std::copy_n(l. │ │ │ │ +00011bd0: 6265 6769 6e28 292c 2073 7464 3a3a 6d69 begin(), std::mi │ │ │ │ +00011be0: 6e28 3c73 7061 6e20 636c 6173 733d 226b n(static_c │ │ │ │ +00011c00: 6173 7426 6c74 3b3c 2f73 7061 6e3e 2073 ast< s │ │ │ │ +00011c10: 7464 3a3a 7369 7a65 5f74 203c 7370 616e td::size_t >( 1 │ │ │ │ +00011c40: 292c 206c 2e73 697a 6528 2929 2c20 2661 ), l.size()), &a │ │ │ │ +00011c50: 6d70 3b5f 6461 7461 293b 3c2f 6469 763e mp;_data);
    │ │ │ │ +00011c60: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ +00011cc0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +00011d30: 6120 6964 3d22 6c30 3034 3236 2220 6e61 a id="l00426" na │ │ │ │ +00011d40: 6d65 3d22 6c30 3034 3236 223e 3c2f 613e me="l00426"> │ │ │ │ +00011d50: 3c73 7061 6e20 636c 6173 733d 226c 696e 426 templ │ │ │ │ +00011d90: 6174 653c 2f73 7061 6e3e 2026 6c74 3b3c ate << │ │ │ │ +00011da0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00011db0: 6f72 6422 3e63 6c61 7373 203c 2f73 7061 ord">class T,
    .
    427 │ │ │ │ +00011e20: 2020 2020 2020 2020 2020 2020 203c 7370 typename = std::enable │ │ │ │ +00011e60: 5f69 665f 7426 6c74 3b48 6173 4465 6e73 _if_t<HasDens │ │ │ │ +00011e70: 654d 6174 7269 7841 7373 6967 6e65 7226 eMatrixAssigner& │ │ │ │ +00011e80: 6c74 3b46 6965 6c64 4d61 7472 6978 2c20 lt;FieldMatrix, │ │ │ │ +00011e90: 5426 6774 3b3a 3a76 616c 7565 2667 743b T>::value> │ │ │ │ +00011ea0: 2667 743b 3c2f 6469 763e 0a3c 6469 7620 >
    ..
    429 │ │ │ │ +00011ff0: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    .
    430 │ │ │ │ +00012050: 2020 202a 3c73 7061 6e20 636c 6173 733d *this = rhs;.
    431 │ │ │ │ +000120d0: 3c2f 7370 616e 3e20 2020 207d 3c2f 6469 }.
    432 │ │ │ │ +00012130: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +00012140: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00012150: 3e3c 6120 6964 3d22 6c30 3034 3333 2220 > 433 usi │ │ │ │ +000121b0: 6e67 203c 2f73 7061 6e3e 4261 7365 3a3a ng Base:: │ │ │ │ +000121c0: 6f70 6572 6174 6f72 3d3b 3c2f 6469 763e operator=;
    │ │ │ │ +000121d0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +00012240: 6120 6964 3d22 6c30 3034 3336 2220 6e61 a id="l00436" na │ │ │ │ +00012250: 6d65 3d22 6c30 3034 3336 223e 3c2f 613e me="l00436"> │ │ │ │ +00012260: 3c73 7061 6e20 636c 6173 733d 226c 696e 436 FieldMatrix │ │ │ │ +00012290: 266c 743b 4b2c 2031 2c20 3126 6774 3b20 <K, 1, 1> │ │ │ │ +000122a0: 3c61 2063 6c61 7373 3d22 636f 6465 2068 transposed( │ │ │ │ +00012300: 293c 7370 616e 2063 6c61 7373 3d22 6b65 ) const
    .
    437< │ │ │ │ +00012380: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00012390: 6f72 6422 3e20 2020 203c 2f73 7061 6e3e ord"> │ │ │ │ +000123a0: 7b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 {
    .
    │ │ │ │ +000123f0: 2020 3433 383c 2f73 7061 6e3e 2020 2020 438 │ │ │ │ +00012400: 2020 3c73 7061 6e20 636c 6173 733d 226b retu │ │ │ │ +00012420: 726e 3c2f 7370 616e 3e20 2a3c 7370 616e rn *this;.
    43 │ │ │ │ +000124a0: 393c 2f73 7061 6e3e 2020 2020 7d3c 2f64 9 }.
    44 │ │ │ │ +00012500: 303c 2f73 7061 6e3e 203c 2f64 6976 3e0a 0
    . │ │ │ │ +00012510: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    443 │ │ │ │ +00012620: 2020 203c 7370 616e 2063 6c61 7373 3d22 friend< │ │ │ │ +00012640: 2f73 7061 6e3e 203c 7370 616e 2063 6c61 /span> aut │ │ │ │ +00012660: 6f3c 2f73 7061 6e3e 203c 6120 636c 6173 o operator │ │ │ │ +000126c0: 2b20 3c2f 613e 2820 3c73 7061 6e20 636c + ( co │ │ │ │ +000126e0: 6e73 743c 2f73 7061 6e3e 203c 6120 636c nst Fiel │ │ │ │ +00012740: 644d 6174 7269 783c 2f61 3e26 616d 703b dMatrix& │ │ │ │ +00012750: 206d 6174 7269 7841 2c3c 2f64 6976 3e0a matrixA,
    . │ │ │ │ +00012760: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    445 │ │ │ │ +00012880: 2020 7b3c 2f64 6976 3e0a 3c64 6976 2063 {
    .
    446 │ │ │ │ +000128e0: 2020 2020 3c73 7061 6e20 636c 6173 733d re │ │ │ │ +00012900: 7475 726e 3c2f 7370 616e 3e20 4669 656c turn Fiel │ │ │ │ +00012910: 644d 6174 7269 7826 6c74 3b74 7970 656e dMatrix<typen │ │ │ │ +00012920: 616d 6520 5072 6f6d 6f74 696f 6e54 7261 ame PromotionTra │ │ │ │ +00012930: 6974 7326 6c74 3b4b 2c4f 7468 6572 5363 its<K,OtherSc │ │ │ │ +00012940: 616c 6172 2667 743b 3a3a 5072 6f6d 6f74 alar>::Promot │ │ │ │ +00012950: 6564 5479 7065 2c31 2c31 2667 743b 7b6d edType,1,1>{m │ │ │ │ +00012960: 6174 7269 7841 5b30 5d5b 305d 202b 206d atrixA[0][0] + m │ │ │ │ +00012970: 6174 7269 7842 5b30 5d5b 305d 7d3b 3c2f atrixB[0][0]};.
    4 │ │ │ │ +000129d0: 3437 3c2f 7370 616e 3e20 2020 207d 3c2f 47 }.
    4 │ │ │ │ +00012a30: 3438 3c2f 7370 616e 3e20 3c2f 6469 763e 48
    │ │ │ │ +00012a40: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00012a70: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 450 t │ │ │ │ +00012ab0: 656d 706c 6174 653c 2f73 7061 6e3e 2026 emplate & │ │ │ │ +00012ac0: 6c74 3b3c 7370 616e 2063 6c61 7373 3d22 lt;class < │ │ │ │ +00012ae0: 2f73 7061 6e3e 3c61 2063 6c61 7373 3d22 /span>Scalar,
    .
    451 │ │ │ │ +00012ba0: 2020 2020 2020 2020 2020 2073 7464 3a3a std:: │ │ │ │ +00012bb0: 656e 6162 6c65 5f69 665f 7426 6c74 3b49 enable_if_t<I │ │ │ │ +00012bc0: 734e 756d 6265 7226 6c74 3b53 6361 6c61 sNumber<Scala │ │ │ │ +00012bd0: 7226 6774 3b3a 3a76 616c 7565 2c20 3c73 r>::value, int> = 0>.
    4 │ │ │ │ +00012c60: 3532 3c2f 7370 616e 3e20 2020 203c 7370 52 friend │ │ │ │ +00012c90: 203c 7370 616e 2063 6c61 7373 3d22 6b65 auto operator+ │ │ │ │ +00012d10: 2820 3c73 7061 6e20 636c 6173 733d 226b ( const FieldMatri │ │ │ │ +00012d90: 783c 2f61 3e26 616d 703b 206d 6174 7269 x& matri │ │ │ │ +00012da0: 782c 3c2f 6469 763e 0a3c 6469 7620 636c x,
    .
    453 │ │ │ │ +00012e00: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +00012e10: 2020 2020 2020 2020 203c 7370 616e 2063 c │ │ │ │ +00012e30: 6f6e 7374 3c2f 7370 616e 3e20 5363 616c onst Scal │ │ │ │ +00012e40: 6172 2661 6d70 3b20 7363 616c 6172 293c ar& scalar)< │ │ │ │ +00012e50: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00012ea0: 3435 343c 2f73 7061 6e3e 2020 2020 7b3c 454 {< │ │ │ │ +00012eb0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00012f00: 3435 353c 2f73 7061 6e3e 2020 2020 2020 455 │ │ │ │ +00012f10: 3c73 7061 6e20 636c 6173 733d 226b 6579 return │ │ │ │ +00012f30: 3c2f 7370 616e 3e20 4669 656c 644d 6174 FieldMat │ │ │ │ +00012f40: 7269 7826 6c74 3b74 7970 656e 616d 6520 rix<typename │ │ │ │ +00012f50: 5072 6f6d 6f74 696f 6e54 7261 6974 7326 PromotionTraits& │ │ │ │ +00012f60: 6c74 3b4b 2c53 6361 6c61 7226 6774 3b3a lt;K,Scalar>: │ │ │ │ +00012f70: 3a50 726f 6d6f 7465 6454 7970 652c 312c :PromotedType,1, │ │ │ │ +00012f80: 3126 6774 3b7b 6d61 7472 6978 5b30 5d5b 1>{matrix[0][ │ │ │ │ +00012f90: 305d 202b 2073 6361 6c61 727d 3b3c 2f64 0] + scalar};.
    45 │ │ │ │ +00012ff0: 363c 2f73 7061 6e3e 2020 2020 7d3c 2f64 6 }.
    45 │ │ │ │ +00013050: 373c 2f73 7061 6e3e 203c 2f64 6976 3e0a 7
    . │ │ │ │ +00013060: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    │ │ │ │ +000131b0: 2020 3436 303c 2f73 7061 6e3e 2020 2020 460 │ │ │ │ +000131c0: 2020 2020 2020 2020 2020 7374 643a 3a65 std::e │ │ │ │ +000131d0: 6e61 626c 655f 6966 5f74 266c 743b 4973 nable_if_t<Is │ │ │ │ +000131e0: 4e75 6d62 6572 266c 743b 5363 616c 6172 Number<Scalar │ │ │ │ +000131f0: 2667 743b 3a3a 7661 6c75 652c 203c 7370 >::value, int> = 0>.
    46 │ │ │ │ +00013280: 313c 2f73 7061 6e3e 2020 2020 3c73 7061 1 friend │ │ │ │ +000132b0: 3c73 7061 6e20 636c 6173 733d 226b 6579 auto operator+ ( │ │ │ │ +00013330: 203c 7370 616e 2063 6c61 7373 3d22 6b65 const Scalar& │ │ │ │ +00013360: 7363 616c 6172 2c3c 2f64 6976 3e0a 3c64 scalar,
    . │ │ │ │ +00013380: 3c61 2069 643d 226c 3030 3436 3222 206e 462 │ │ │ │ +000133d0: 2020 2020 2020 2020 2020 2020 2020 3c73 const │ │ │ │ +00013400: 203c 6120 636c 6173 733d 2263 6f64 6520 FieldMatrix& matrix).
    4 │ │ │ │ +000134c0: 3633 3c2f 7370 616e 3e20 2020 207b 3c2f 63 {.
    4 │ │ │ │ +00013520: 3634 3c2f 7370 616e 3e20 2020 2020 203c 64 < │ │ │ │ +00013530: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00013540: 6f72 6466 6c6f 7722 3e72 6574 7572 6e3c ordflow">return< │ │ │ │ +00013550: 2f73 7061 6e3e 2046 6965 6c64 4d61 7472 /span> FieldMatr │ │ │ │ +00013560: 6978 266c 743b 7479 7065 6e61 6d65 2050 ix<typename P │ │ │ │ +00013570: 726f 6d6f 7469 6f6e 5472 6169 7473 266c romotionTraits&l │ │ │ │ +00013580: 743b 5363 616c 6172 2c4b 2667 743b 3a3a t;Scalar,K>:: │ │ │ │ +00013590: 5072 6f6d 6f74 6564 5479 7065 2c31 2c31 PromotedType,1,1 │ │ │ │ +000135a0: 2667 743b 7b73 6361 6c61 7220 2b20 6d61 >{scalar + ma │ │ │ │ +000135b0: 7472 6978 5b30 5d5b 305d 7d3b 3c2f 6469 trix[0][0]};.
    465 │ │ │ │ +00013610: 3c2f 7370 616e 3e20 2020 207d 3c2f 6469 }.
    466 │ │ │ │ +00013670: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +00013680: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00013690: 3e3c 6120 6964 3d22 6c30 3034 3638 2220 > 468 tem │ │ │ │ +000136f0: 706c 6174 653c 2f73 7061 6e3e 2026 6c74 plate < │ │ │ │ +00013700: 3b3c 7370 616e 2063 6c61 7373 3d22 6b65 ;class OtherScalar& │ │ │ │ +00013730: 6774 3b3c 2f64 6976 3e0a 3c64 6976 2063 gt;
    .
    469 │ │ │ │ +00013790: 2020 3c73 7061 6e20 636c 6173 733d 226b friend auto │ │ │ │ +000137d0: 3c2f 7370 616e 3e20 3c61 2063 6c61 7373 operator- │ │ │ │ +00013830: 203c 2f61 3e28 203c 7370 616e 2063 6c61 ( con │ │ │ │ +00013850: 7374 3c2f 7370 616e 3e20 3c61 2063 6c61 st Field │ │ │ │ +000138b0: 4d61 7472 6978 3c2f 613e 2661 6d70 3b20 Matrix& │ │ │ │ +000138c0: 6d61 7472 6978 412c 3c2f 6469 763e 0a3c matrixA,
    .< │ │ │ │ +000138d0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +000138e0: 3e3c 6120 6964 3d22 6c30 3034 3730 2220 > 470 │ │ │ │ +00013930: 2020 2020 2020 2020 2020 2020 2020 203c < │ │ │ │ +00013940: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00013950: 6f72 6422 3e63 6f6e 7374 3c2f 7370 616e ord">const FieldMatrix< │ │ │ │ +00013970: 3b4f 7468 6572 5363 616c 6172 2c31 2c31 ;OtherScalar,1,1 │ │ │ │ +00013980: 2667 743b 2661 6d70 3b20 6d61 7472 6978 >& matrix │ │ │ │ +00013990: 4229 3c2f 6469 763e 0a3c 6469 7620 636c B)
    .
    471 │ │ │ │ +000139f0: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    .
    472 │ │ │ │ +00013a50: 2020 203c 7370 616e 2063 6c61 7373 3d22 ret │ │ │ │ +00013a70: 7572 6e3c 2f73 7061 6e3e 2046 6965 6c64 urn Field │ │ │ │ +00013a80: 4d61 7472 6978 266c 743b 7479 7065 6e61 Matrix<typena │ │ │ │ +00013a90: 6d65 2050 726f 6d6f 7469 6f6e 5472 6169 me PromotionTrai │ │ │ │ +00013aa0: 7473 266c 743b 4b2c 4f74 6865 7253 6361 ts<K,OtherSca │ │ │ │ +00013ab0: 6c61 7226 6774 3b3a 3a50 726f 6d6f 7465 lar>::Promote │ │ │ │ +00013ac0: 6454 7970 652c 312c 3126 6774 3b7b 6d61 dType,1,1>{ma │ │ │ │ +00013ad0: 7472 6978 415b 305d 5b30 5d20 2d20 6d61 trixA[0][0] - ma │ │ │ │ +00013ae0: 7472 6978 425b 305d 5b30 5d7d 3b3c 2f64 trixB[0][0]};.
    47 │ │ │ │ +00013b40: 333c 2f73 7061 6e3e 2020 2020 7d3c 2f64 3 }.
    47 │ │ │ │ +00013ba0: 343c 2f73 7061 6e3e 203c 2f64 6976 3e0a 4
    . │ │ │ │ +00013bb0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    │ │ │ │ +00013d00: 2020 3437 373c 2f73 7061 6e3e 2020 2020 477 │ │ │ │ +00013d10: 2020 2020 2020 2020 2020 7374 643a 3a65 std::e │ │ │ │ +00013d20: 6e61 626c 655f 6966 5f74 266c 743b 4973 nable_if_t<Is │ │ │ │ +00013d30: 4e75 6d62 6572 266c 743b 5363 616c 6172 Number<Scalar │ │ │ │ +00013d40: 2667 743b 3a3a 7661 6c75 652c 203c 7370 >::value, int> = 0>.
    47 │ │ │ │ +00013dd0: 383c 2f73 7061 6e3e 2020 2020 3c73 7061 8 friend │ │ │ │ +00013e00: 3c73 7061 6e20 636c 6173 733d 226b 6579 auto operator- ( │ │ │ │ +00013e80: 203c 7370 616e 2063 6c61 7373 3d22 6b65 const FieldMatrix │ │ │ │ +00013f00: 3c2f 613e 2661 6d70 3b20 6d61 7472 6978 & matrix │ │ │ │ +00013f10: 2c3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ,
    .
    │ │ │ │ +00013f60: 2020 3437 393c 2f73 7061 6e3e 2020 2020 479 │ │ │ │ +00013f70: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +00013f80: 2020 2020 2020 2020 3c73 7061 6e20 636c co │ │ │ │ +00013fa0: 6e73 743c 2f73 7061 6e3e 2053 6361 6c61 nst Scala │ │ │ │ +00013fb0: 7226 616d 703b 2073 6361 6c61 7229 3c2f r& scalar).
    4 │ │ │ │ +00014010: 3830 3c2f 7370 616e 3e20 2020 207b 3c2f 80 {.
    4 │ │ │ │ +00014070: 3831 3c2f 7370 616e 3e20 2020 2020 203c 81 < │ │ │ │ +00014080: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00014090: 6f72 6466 6c6f 7722 3e72 6574 7572 6e3c ordflow">return< │ │ │ │ +000140a0: 2f73 7061 6e3e 2046 6965 6c64 4d61 7472 /span> FieldMatr │ │ │ │ +000140b0: 6978 266c 743b 7479 7065 6e61 6d65 2050 ix<typename P │ │ │ │ +000140c0: 726f 6d6f 7469 6f6e 5472 6169 7473 266c romotionTraits&l │ │ │ │ +000140d0: 743b 4b2c 5363 616c 6172 2667 743b 3a3a t;K,Scalar>:: │ │ │ │ +000140e0: 5072 6f6d 6f74 6564 5479 7065 2c31 2c31 PromotedType,1,1 │ │ │ │ +000140f0: 2667 743b 7b6d 6174 7269 785b 305d 5b30 >{matrix[0][0 │ │ │ │ +00014100: 5d20 2d20 7363 616c 6172 7d3b 3c2f 6469 ] - scalar};.
    482 │ │ │ │ +00014160: 3c2f 7370 616e 3e20 2020 207d 3c2f 6469 }.
    483 │ │ │ │ +000141c0: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +000141d0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +000141e0: 3e3c 6120 6964 3d22 6c30 3034 3835 2220 > 485 tem │ │ │ │ +00014240: 706c 6174 653c 2f73 7061 6e3e 2026 6c74 plate < │ │ │ │ +00014250: 3b3c 7370 616e 2063 6c61 7373 3d22 6b65 ;class Scalar, │ │ │ │ +000142d0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00014320: 2034 3836 3c2f 7370 616e 3e20 2020 2020 486 │ │ │ │ +00014330: 2020 2020 2020 2020 2073 7464 3a3a 656e std::en │ │ │ │ +00014340: 6162 6c65 5f69 665f 7426 6c74 3b49 734e able_if_t<IsN │ │ │ │ +00014350: 756d 6265 7226 6c74 3b53 6361 6c61 7226 umber<Scalar& │ │ │ │ +00014360: 6774 3b3a 3a76 616c 7565 2c20 3c73 7061 gt;::value, int │ │ │ │ +00014390: 2667 743b 203d 2030 2667 743b 3c2f 6469 > = 0>.
    487 │ │ │ │ +000143f0: 3c2f 7370 616e 3e20 2020 203c 7370 616e friend < │ │ │ │ +00014420: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00014430: 6f72 6422 3e61 7574 6f3c 2f73 7061 6e3e ord">auto │ │ │ │ +00014440: 203c 6120 636c 6173 733d 2263 6f64 6520 │ │ │ │ +00014490: 6f70 6572 6174 6f72 2d20 3c2f 613e 2820 operator- ( │ │ │ │ +000144a0: 3c73 7061 6e20 636c 6173 733d 226b 6579 const Scalar& s │ │ │ │ +000144d0: 6361 6c61 722c 3c2f 6469 763e 0a3c 6469 calar,
    .< │ │ │ │ +000144f0: 6120 6964 3d22 6c30 3034 3838 2220 6e61 a id="l00488" na │ │ │ │ +00014500: 6d65 3d22 6c30 3034 3838 223e 3c2f 613e me="l00488"> │ │ │ │ +00014510: 3c73 7061 6e20 636c 6173 733d 226c 696e 488 │ │ │ │ +00014540: 2020 2020 2020 2020 2020 2020 203c 7370 const │ │ │ │ +00014570: 3c61 2063 6c61 7373 3d22 636f 6465 2068 FieldMatrix │ │ │ │ +000145d0: 2661 6d70 3b20 6d61 7472 6978 293c 2f64 & matrix).
    48 │ │ │ │ +00014630: 393c 2f73 7061 6e3e 2020 2020 7b3c 2f64 9 {.
    49 │ │ │ │ +00014690: 303c 2f73 7061 6e3e 2020 2020 2020 3c73 0 return FieldMatri │ │ │ │ +000146d0: 7826 6c74 3b74 7970 656e 616d 6520 5072 x<typename Pr │ │ │ │ +000146e0: 6f6d 6f74 696f 6e54 7261 6974 7326 6c74 omotionTraits< │ │ │ │ +000146f0: 3b53 6361 6c61 722c 4b26 6774 3b3a 3a50 ;Scalar,K>::P │ │ │ │ +00014700: 726f 6d6f 7465 6454 7970 652c 312c 3126 romotedType,1,1& │ │ │ │ +00014710: 6774 3b7b 7363 616c 6172 202d 206d 6174 gt;{scalar - mat │ │ │ │ +00014720: 7269 785b 305d 5b30 5d7d 3b3c 2f64 6976 rix[0][0]};
    .
    491< │ │ │ │ +00014780: 2f73 7061 6e3e 2020 2020 7d3c 2f64 6976 /span> }
    .
    492< │ │ │ │ +000147e0: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
    . │ │ │ │ +00014800: 3c61 2069 643d 226c 3030 3439 3422 206e 494 temp │ │ │ │ +00014860: 6c61 7465 3c2f 7370 616e 3e20 266c 743b late < │ │ │ │ +00014870: 3c73 7061 6e20 636c 6173 733d 226b 6579 class Scalar,< │ │ │ │ +000148f0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00014940: 3439 353c 2f73 7061 6e3e 2020 2020 2020 495 │ │ │ │ +00014950: 2020 2020 2020 2020 7374 643a 3a65 6e61 std::ena │ │ │ │ +00014960: 626c 655f 6966 5f74 266c 743b 4973 4e75 ble_if_t<IsNu │ │ │ │ +00014970: 6d62 6572 266c 743b 5363 616c 6172 2667 mber<Scalar&g │ │ │ │ +00014980: 743b 3a3a 7661 6c75 652c 203c 7370 616e t;::value, int& │ │ │ │ +000149b0: 6774 3b20 3d20 3026 6774 3b3c 2f64 6976 gt; = 0>
    .
    496< │ │ │ │ +00014a10: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +00014a30: 6672 6965 6e64 3c2f 7370 616e 3e20 3c73 friend auto │ │ │ │ +00014a60: 3c61 2063 6c61 7373 3d22 636f 6465 2068 o │ │ │ │ +00014ab0: 7065 7261 746f 722a 203c 2f61 3e28 203c perator* ( < │ │ │ │ +00014ac0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00014ad0: 6f72 6422 3e63 6f6e 7374 3c2f 7370 616e ord">const FieldMatrix& matrix, │ │ │ │ +00014b50: 5363 616c 6172 2073 6361 6c61 7229 3c2f Scalar scalar).
    4 │ │ │ │ +00014bb0: 3937 3c2f 7370 616e 3e20 2020 207b 3c2f 97 {.
    4 │ │ │ │ +00014c10: 3938 3c2f 7370 616e 3e20 2020 2020 203c 98 < │ │ │ │ +00014c20: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00014c30: 6f72 6466 6c6f 7722 3e72 6574 7572 6e3c ordflow">return< │ │ │ │ +00014c40: 2f73 7061 6e3e 2046 6965 6c64 4d61 7472 /span> FieldMatr │ │ │ │ +00014c50: 6978 266c 743b 7479 7065 6e61 6d65 2050 ix<typename P │ │ │ │ +00014c60: 726f 6d6f 7469 6f6e 5472 6169 7473 266c romotionTraits&l │ │ │ │ +00014c70: 743b 4b2c 5363 616c 6172 2667 743b 3a3a t;K,Scalar>:: │ │ │ │ +00014c80: 5072 6f6d 6f74 6564 5479 7065 2c31 2c31 PromotedType,1,1 │ │ │ │ +00014c90: 2667 743b 207b 6d61 7472 6978 5b30 5d5b > {matrix[0][ │ │ │ │ +00014ca0: 305d 202a 2073 6361 6c61 727d 3b3c 2f64 0] * scalar};.
    49 │ │ │ │ +00014d00: 393c 2f73 7061 6e3e 2020 2020 7d3c 2f64 9 }.
    50 │ │ │ │ +00014d60: 303c 2f73 7061 6e3e 203c 2f64 6976 3e0a 0
    . │ │ │ │ +00014d70: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    │ │ │ │ +00014ec0: 2020 3530 333c 2f73 7061 6e3e 2020 2020 503 │ │ │ │ +00014ed0: 2020 2020 2020 2020 2020 7374 643a 3a65 std::e │ │ │ │ +00014ee0: 6e61 626c 655f 6966 5f74 266c 743b 4973 nable_if_t<Is │ │ │ │ +00014ef0: 4e75 6d62 6572 266c 743b 5363 616c 6172 Number<Scalar │ │ │ │ +00014f00: 2667 743b 3a3a 7661 6c75 652c 203c 7370 >::value, int> = 0>.
    50 │ │ │ │ +00014f90: 343c 2f73 7061 6e3e 2020 2020 3c73 7061 4 friend │ │ │ │ +00014fc0: 3c73 7061 6e20 636c 6173 733d 226b 6579 auto operator* ( │ │ │ │ +00015040: 2053 6361 6c61 7220 7363 616c 6172 2c20 Scalar scalar, │ │ │ │ +00015050: 3c73 7061 6e20 636c 6173 733d 226b 6579 const FieldMatrix< │ │ │ │ +000150d0: 2f61 3e26 616d 703b 206d 6174 7269 7829 /a>& matrix) │ │ │ │ +000150e0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00015130: 2035 3035 3c2f 7370 616e 3e20 2020 207b 505 { │ │ │ │ +00015140: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00015190: 2035 3036 3c2f 7370 616e 3e20 2020 2020 506 │ │ │ │ +000151a0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 retur │ │ │ │ +000151c0: 6e3c 2f73 7061 6e3e 2046 6965 6c64 4d61 n FieldMa │ │ │ │ +000151d0: 7472 6978 266c 743b 7479 7065 6e61 6d65 trix<typename │ │ │ │ +000151e0: 2050 726f 6d6f 7469 6f6e 5472 6169 7473 PromotionTraits │ │ │ │ +000151f0: 266c 743b 4b2c 5363 616c 6172 2667 743b <K,Scalar> │ │ │ │ +00015200: 3a3a 5072 6f6d 6f74 6564 5479 7065 2c31 ::PromotedType,1 │ │ │ │ +00015210: 2c31 2667 743b 207b 7363 616c 6172 202a ,1> {scalar * │ │ │ │ +00015220: 206d 6174 7269 785b 305d 5b30 5d7d 3b3c matrix[0][0]};< │ │ │ │ +00015230: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00015280: 3530 373c 2f73 7061 6e3e 2020 2020 7d3c 507 }< │ │ │ │ +00015290: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +000152e0: 3530 383c 2f73 7061 6e3e 203c 2f64 6976 508
    .
    510< │ │ │ │ +00015340: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +00015360: 7465 6d70 6c61 7465 3c2f 7370 616e 3e20 template │ │ │ │ +00015370: 266c 743b 3c73 7061 6e20 636c 6173 733d <class │ │ │ │ +00015390: 3c2f 7370 616e 3e3c 6120 636c 6173 733d Scalar,
    .
    511 │ │ │ │ +00015450: 2020 2020 2020 2020 2020 2020 7374 643a std: │ │ │ │ +00015460: 3a65 6e61 626c 655f 6966 5f74 266c 743b :enable_if_t< │ │ │ │ +00015470: 4973 4e75 6d62 6572 266c 743b 5363 616c IsNumber<Scal │ │ │ │ +00015480: 6172 2667 743b 3a3a 7661 6c75 652c 203c ar>::value, < │ │ │ │ +00015490: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +000154a0: 6f72 6474 7970 6522 3e69 6e74 3c2f 7370 ordtype">int> = 0>< │ │ │ │ +000154c0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00015510: 3531 323c 2f73 7061 6e3e 2020 2020 3c73 512 friend auto operator/ ( const FieldMatr │ │ │ │ +00015640: 6978 3c2f 613e 2661 6d70 3b20 6d61 7472 ix& matr │ │ │ │ +00015650: 6978 2c20 5363 616c 6172 2073 6361 6c61 ix, Scalar scala │ │ │ │ +00015660: 7229 3c2f 6469 763e 0a3c 6469 7620 636c r)
    .
    513 │ │ │ │ +000156c0: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    .
    514 │ │ │ │ +00015720: 2020 203c 7370 616e 2063 6c61 7373 3d22 ret │ │ │ │ +00015740: 7572 6e3c 2f73 7061 6e3e 2046 6965 6c64 urn Field │ │ │ │ +00015750: 4d61 7472 6978 266c 743b 7479 7065 6e61 Matrix<typena │ │ │ │ +00015760: 6d65 2050 726f 6d6f 7469 6f6e 5472 6169 me PromotionTrai │ │ │ │ +00015770: 7473 266c 743b 4b2c 5363 616c 6172 2667 ts<K,Scalar&g │ │ │ │ +00015780: 743b 3a3a 5072 6f6d 6f74 6564 5479 7065 t;::PromotedType │ │ │ │ +00015790: 2c31 2c31 2667 743b 207b 6d61 7472 6978 ,1,1> {matrix │ │ │ │ +000157a0: 5b30 5d5b 305d 202f 2073 6361 6c61 727d [0][0] / scalar} │ │ │ │ +000157b0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +00015800: 2020 3531 353c 2f73 7061 6e3e 2020 2020 515 │ │ │ │ +00015810: 7d3c 2f64 6976 3e0a 3c64 6976 2063 6c61 }
    .
    │ │ │ │ +00015860: 2020 3531 363c 2f73 7061 6e3e 203c 2f64 516 .
    51 │ │ │ │ +000158c0: 373c 2f73 7061 6e3e 2020 2020 3c73 7061 7 //===== solve< │ │ │ │ +000158f0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    .< │ │ │ │ +00015910: 6120 6964 3d22 6c30 3035 3138 2220 6e61 a id="l00518" na │ │ │ │ +00015920: 6d65 3d22 6c30 3035 3138 223e 3c2f 613e me="l00518"> │ │ │ │ +00015930: 3c73 7061 6e20 636c 6173 733d 226c 696e 518
    .
    521 │ │ │ │ +000159b0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 template< │ │ │ │ +000159d0: 2f73 7061 6e3e 2026 6c74 3b3c 7370 616e /span> <class Ot │ │ │ │ +00015a00: 6865 7253 6361 6c61 722c 203c 7370 616e herScalar, int │ │ │ │ +00015a30: 6f74 6865 7243 6f6c 7326 6774 3b3c 2f64 otherCols>.
    52 │ │ │ │ +00015a90: 323c 2f73 7061 6e3e 2020 2020 3c73 7061 2 friend │ │ │ │ +00015ac0: 3c73 7061 6e20 636c 6173 733d 226b 6579 auto operator* ( │ │ │ │ +00015b40: 203c 7370 616e 2063 6c61 7373 3d22 6b65 const FieldMatrix │ │ │ │ +00015bc0: 3c2f 613e 2661 6d70 3b20 6d61 7472 6978 & matrix │ │ │ │ +00015bd0: 412c 3c2f 6469 763e 0a3c 6469 7620 636c A,
    .
    523 │ │ │ │ +00015c30: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +00015c40: 2020 2020 2020 2020 203c 7370 616e 2063 c │ │ │ │ +00015c60: 6f6e 7374 3c2f 7370 616e 3e20 4669 656c onst Fiel │ │ │ │ +00015c70: 644d 6174 7269 7826 6c74 3b4f 7468 6572 dMatrix<Other │ │ │ │ +00015c80: 5363 616c 6172 2c20 312c 206f 7468 6572 Scalar, 1, other │ │ │ │ +00015c90: 436f 6c73 2667 743b 2661 6d70 3b20 6d61 Cols>& ma │ │ │ │ +00015ca0: 7472 6978 4229 3c2f 6469 763e 0a3c 6469 trixB)
    .< │ │ │ │ +00015cc0: 6120 6964 3d22 6c30 3035 3234 2220 6e61 a id="l00524" na │ │ │ │ +00015cd0: 6d65 3d22 6c30 3035 3234 223e 3c2f 613e me="l00524"> │ │ │ │ +00015ce0: 3c73 7061 6e20 636c 6173 733d 226c 696e 524 {
    .< │ │ │ │ +00015d20: 6120 6964 3d22 6c30 3035 3235 2220 6e61 a id="l00525" na │ │ │ │ +00015d30: 6d65 3d22 6c30 3035 3235 223e 3c2f 613e me="l00525"> │ │ │ │ +00015d40: 3c73 7061 6e20 636c 6173 733d 226c 696e 525 FieldMatr │ │ │ │ +00015d70: 6978 266c 743b 7479 7065 6e61 6d65 2050 ix<typename P │ │ │ │ +00015d80: 726f 6d6f 7469 6f6e 5472 6169 7473 266c romotionTraits&l │ │ │ │ +00015d90: 743b 4b2c 4f74 6865 7253 6361 6c61 7226 t;K,OtherScalar& │ │ │ │ +00015da0: 6774 3b3a 3a50 726f 6d6f 7465 6454 7970 gt;::PromotedTyp │ │ │ │ +00015db0: 652c 312c 6f74 6865 7243 6f6c 7326 6774 e,1,otherCols> │ │ │ │ +00015dc0: 3b20 7265 7375 6c74 3b3c 2f64 6976 3e0a ; result;
    . │ │ │ │ +00015dd0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    < │ │ │ │ +00015e60: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00015e70: 6e6f 223e 2020 3532 373c 2f73 7061 6e3e no"> 527 │ │ │ │ +00015e80: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +00015ea0: 666f 723c 2f73 7061 6e3e 2028 3c61 2063 for (size │ │ │ │ +00015f00: 5f74 7970 653c 2f61 3e20 6a20 3d20 303b _type j = 0; │ │ │ │ +00015f10: 206a 2026 6c74 3b20 6d61 7472 6978 422e j < matrixB. │ │ │ │ +00015f20: 6d61 745f 636f 6c73 2829 3b20 2b2b 6a29 mat_cols(); ++j) │ │ │ │ +00015f30: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00015f80: 2035 3238 3c2f 7370 616e 3e20 2020 2020 528 │ │ │ │ +00015f90: 2020 2072 6573 756c 745b 305d 5b6a 5d20 result[0][j] │ │ │ │ +00015fa0: 3d20 6d61 7472 6978 415b 305d 5b30 5d20 = matrixA[0][0] │ │ │ │ +00015fb0: 2a20 6d61 7472 6978 425b 305d 5b6a 5d3b * matrixB[0][j]; │ │ │ │ +00015fc0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00016010: 2035 3239 3c2f 7370 616e 3e20 3c2f 6469 529 .
    530 │ │ │ │ +00016070: 3c2f 7370 616e 3e20 2020 2020 203c 7370 return result;.
    531 │ │ │ │ +00016100: 3c2f 7370 616e 3e20 2020 207d 3c2f 6469 }.
    532 │ │ │ │ +00016160: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +00016170: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00016180: 3e3c 6120 6964 3d22 6c30 3035 3339 2220 > 539 tem │ │ │ │ +000161e0: 706c 6174 653c 2f73 7061 6e3e 2026 6c74 plate < │ │ │ │ +000161f0: 3b3c 7370 616e 2063 6c61 7373 3d22 6b65 ;class
    OtherMatrix, │ │ │ │ +00016220: 2073 7464 3a3a 656e 6162 6c65 5f69 665f std::enable_if_ │ │ │ │ +00016230: 7426 6c74 3b3c 2f64 6976 3e0a 3c64 6976 t<
    .
    < │ │ │ │ +00016270: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00016280: 6e6f 223e 2020 3534 303c 2f73 7061 6e3e no"> 540 │ │ │ │ +00016290: 2020 2020 2020 496d 706c 3a3a 4973 5374 Impl::IsSt │ │ │ │ +000162a0: 6174 6963 5369 7a65 4d61 7472 6978 5f76 aticSizeMatrix_v │ │ │ │ +000162b0: 266c 743b 4f74 6865 724d 6174 7269 7826 <OtherMatrix& │ │ │ │ +000162c0: 6774 3b3c 2f64 6976 3e0a 3c64 6976 2063 gt;
    .
    541 │ │ │ │ +00016320: 2020 2020 616e 6420 6e6f 7420 496d 706c and not Impl │ │ │ │ +00016330: 3a3a 4973 4669 656c 644d 6174 7269 785f ::IsFieldMatrix_ │ │ │ │ +00016340: 7626 6c74 3b4f 7468 6572 4d61 7472 6978 v<OtherMatrix │ │ │ │ +00016350: 2667 743b 3c2f 6469 763e 0a3c 6469 7620 >
    .
    542 │ │ │ │ +000163b0: 2020 2020 2061 6e64 2028 4f74 6865 724d and (OtherM │ │ │ │ +000163c0: 6174 7269 783a 3a72 6f77 733d 3d31 293c atrix::rows==1)< │ │ │ │ +000163d0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00016420: 3534 333c 2f73 7061 6e3e 2020 2020 2020 543 │ │ │ │ +00016430: 2c20 3c73 7061 6e20 636c 6173 733d 226b , int< │ │ │ │ +00016450: 2f73 7061 6e3e 2667 743b 203d 2030 2667 /span>> = 0&g │ │ │ │ +00016460: 743b 3c2f 6469 763e 0a3c 6469 7620 636c t;
    .
    544 │ │ │ │ +000164c0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 friend auto< │ │ │ │ +00016500: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> operator* │ │ │ │ +00016560: 3c2f 613e 2820 3c73 7061 6e20 636c 6173 ( cons │ │ │ │ +00016580: 743c 2f73 7061 6e3e 203c 6120 636c 6173 t FieldM │ │ │ │ +000165e0: 6174 7269 783c 2f61 3e26 616d 703b 206d atrix& m │ │ │ │ +000165f0: 6174 7269 7841 2c3c 2f64 6976 3e0a 3c64 atrixA,
    . │ │ │ │ +00016610: 3c61 2069 643d 226c 3030 3534 3522 206e 545 │ │ │ │ +00016660: 2020 2020 2020 2020 2020 2020 2020 3c73 const │ │ │ │ +00016690: 204f 7468 6572 4d61 7472 6978 2661 6d70 OtherMatrix& │ │ │ │ +000166a0: 3b20 6d61 7472 6978 4229 3c2f 6469 763e ; matrixB)
    │ │ │ │ +000166b0: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ +00016710: 0a3c 6469 7620 636c 6173 733d 226c 696e .. │ │ │ │ +00016860: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 . │ │ │ │ +00016930: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    < │ │ │ │ +00016a60: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00016a70: 6e6f 223e 2020 3535 303c 2f73 7061 6e3e no"> 550 │ │ │ │ +00016a80: 2020 2020 2020 2020 6d61 7472 6978 422e matrixB. │ │ │ │ +00016a90: 6d74 7628 6d61 7472 6978 415b 6a5d 2c20 mtv(matrixA[j], │ │ │ │ +00016aa0: 7265 7375 6c74 5b6a 5d29 3b3c 2f64 6976 result[j]);
    .
    551< │ │ │ │ +00016b00: 2f73 7061 6e3e 2020 2020 2020 3c73 7061 /span> return result;
    .
    552< │ │ │ │ +00016b90: 2f73 7061 6e3e 2020 2020 7d3c 2f64 6976 /span> }
    .
    553< │ │ │ │ +00016bf0: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
    . │ │ │ │ +00016c10: 3c61 2069 643d 226c 3030 3536 3022 206e 560 temp │ │ │ │ +00016c70: 6c61 7465 3c2f 7370 616e 3e20 266c 743b late < │ │ │ │ +00016c80: 3c73 7061 6e20 636c 6173 733d 226b 6579 class OtherMatrix, │ │ │ │ +00016cb0: 7374 643a 3a65 6e61 626c 655f 6966 5f74 std::enable_if_t │ │ │ │ +00016cc0: 266c 743b 3c2f 6469 763e 0a3c 6469 7620 <
    .
    561 │ │ │ │ +00016d20: 2020 2020 2049 6d70 6c3a 3a49 7353 7461 Impl::IsSta │ │ │ │ +00016d30: 7469 6353 697a 654d 6174 7269 785f 7626 ticSizeMatrix_v& │ │ │ │ +00016d40: 6c74 3b4f 7468 6572 4d61 7472 6978 2667 lt;OtherMatrix&g │ │ │ │ +00016d50: 743b 3c2f 6469 763e 0a3c 6469 7620 636c t;
    .
    562 │ │ │ │ +00016db0: 2020 2061 6e64 206e 6f74 2049 6d70 6c3a and not Impl: │ │ │ │ +00016dc0: 3a49 7346 6965 6c64 4d61 7472 6978 5f76 :IsFieldMatrix_v │ │ │ │ +00016dd0: 266c 743b 4f74 6865 724d 6174 7269 7826 <OtherMatrix& │ │ │ │ +00016de0: 6774 3b3c 2f64 6976 3e0a 3c64 6976 2063 gt;
    .
    563 │ │ │ │ +00016e40: 2020 2020 616e 6420 284f 7468 6572 4d61 and (OtherMa │ │ │ │ +00016e50: 7472 6978 3a3a 636f 6c73 3d3d 3129 3c2f trix::cols==1).
    5 │ │ │ │ +00016eb0: 3634 3c2f 7370 616e 3e20 2020 2020 202c 64 , │ │ │ │ +00016ec0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 int> = 0> │ │ │ │ +00016ef0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    ..
    │ │ │ │ +00017080: 2020 3536 363c 2f73 7061 6e3e 2020 2020 566 │ │ │ │ +00017090: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +000170a0: 2020 2020 2020 2020 3c73 7061 6e20 636c co │ │ │ │ +000170c0: 6e73 743c 2f73 7061 6e3e 203c 6120 636c nst Fiel │ │ │ │ +00017120: 644d 6174 7269 783c 2f61 3e26 616d 703b dMatrix& │ │ │ │ +00017130: 206d 6174 7269 7842 293c 2f64 6976 3e0a matrixB)
    . │ │ │ │ +00017140: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +000171a0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .< │ │ │ │ +000172f0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00017300: 3e3c 6120 6964 3d22 6c30 3035 3639 2220 > 569 Dune::Field │ │ │ │ +00017380: 4d61 7472 6978 266c 743b 4669 656c 642c Matrix<Field, │ │ │ │ +00017390: 204f 7468 6572 4d61 7472 6978 3a3a 726f OtherMatrix::ro │ │ │ │ +000173a0: 7773 2c20 636f 6c73 2667 743b 3c2f 613e ws, cols> │ │ │ │ +000173b0: 2072 6573 756c 743b 3c2f 6469 763e 0a3c result;
    .< │ │ │ │ +000173c0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +000173d0: 3e3c 6120 6964 3d22 6c30 3035 3730 2220 > 570 for (s │ │ │ │ +00017440: 7464 3a3a 7369 7a65 5f74 206a 3d30 3b20 td::size_t j=0; │ │ │ │ +00017450: 6a26 6c74 3b3c 6120 636c 6173 733d 2263 j<cols; │ │ │ │ +000174b0: 2b2b 6a29 3c2f 6469 763e 0a3c 6469 7620 ++j)
    .
    571 │ │ │ │ +00017510: 2020 2020 207b 3c2f 6469 763e 0a3c 6469 {
    .< │ │ │ │ +00017530: 6120 6964 3d22 6c30 3035 3732 2220 6e61 a id="l00572" na │ │ │ │ +00017540: 6d65 3d22 6c30 3035 3732 223e 3c2f 613e me="l00572"> │ │ │ │ +00017550: 3c73 7061 6e20 636c 6173 733d 226c 696e 572 a │ │ │ │ +00017590: 7574 6f3c 2f73 7061 6e3e 2042 5f6a 203d uto B_j = │ │ │ │ +000175a0: 2049 6d70 6c3a 3a43 6f6c 756d 6e56 6563 Impl::ColumnVec │ │ │ │ +000175b0: 746f 7256 6965 7728 6d61 7472 6978 422c torView(matrixB, │ │ │ │ +000175c0: 206a 293b 3c2f 6469 763e 0a3c 6469 7620 j);
    .
    573 │ │ │ │ +00017620: 2020 2020 2020 203c 7370 616e 2063 6c61 aut │ │ │ │ +00017640: 6f3c 2f73 7061 6e3e 2072 6573 756c 745f o result_ │ │ │ │ +00017650: 6a20 3d20 496d 706c 3a3a 436f 6c75 6d6e j = Impl::Column │ │ │ │ +00017660: 5665 6374 6f72 5669 6577 2872 6573 756c VectorView(resul │ │ │ │ +00017670: 742c 206a 293b 3c2f 6469 763e 0a3c 6469 t, j);
    .< │ │ │ │ +00017690: 6120 6964 3d22 6c30 3035 3734 2220 6e61 a id="l00574" na │ │ │ │ +000176a0: 6d65 3d22 6c30 3035 3734 223e 3c2f 613e me="l00574"> │ │ │ │ +000176b0: 3c73 7061 6e20 636c 6173 733d 226c 696e 574 matrixA │ │ │ │ +000176e0: 2e6d 7628 425f 6a2c 2072 6573 756c 745f .mv(B_j, result_ │ │ │ │ +000176f0: 6a29 3b3c 2f64 6976 3e0a 3c64 6976 2063 j);
    .
    575 │ │ │ │ +00017750: 2020 2020 7d3c 2f64 6976 3e0a 3c64 6976 }
    .
    < │ │ │ │ +00017790: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +000177a0: 6e6f 223e 2020 3537 363c 2f73 7061 6e3e no"> 576 │ │ │ │ +000177b0: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +000177d0: 7265 7475 726e 3c2f 7370 616e 3e20 7265 return re │ │ │ │ +000177e0: 7375 6c74 3b3c 2f64 6976 3e0a 3c64 6976 sult;
    .
    < │ │ │ │ +00017820: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00017830: 6e6f 223e 2020 3537 373c 2f73 7061 6e3e no"> 577 │ │ │ │ +00017840: 2020 2020 7d3c 2f64 6976 3e0a 3c64 6976 }
    .
    < │ │ │ │ +00017880: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00017890: 6e6f 223e 2020 3537 383c 2f73 7061 6e3e no"> 578 │ │ │ │ +000178a0: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
    .
    │ │ │ │ +000178f0: 2020 3538 303c 2f73 7061 6e3e 2020 2020 580 │ │ │ │ +00017900: 3c73 7061 6e20 636c 6173 733d 226b 6579 template<int l& │ │ │ │ +00017950: 6774 3b3c 2f64 6976 3e0a 3c64 6976 2063 gt;
    .
    581 │ │ │ │ +000179b0: 2020 4669 656c 644d 6174 7269 7826 6c74 FieldMatrix< │ │ │ │ +000179c0: 3b4b 2c6c 2c31 2667 743b 203c 6120 636c ;K,l,1> left │ │ │ │ +00017a20: 6d75 6c74 6970 6c79 616e 793c 2f61 3e20 multiplyany │ │ │ │ +00017a30: 283c 7370 616e 2063 6c61 7373 3d22 6b65 (const FieldMatrix& │ │ │ │ +00017a60: 6c74 3b4b 2c6c 2c31 2667 743b 2661 6d70 lt;K,l,1>& │ │ │ │ +00017a70: 3b20 3c61 2063 6c61 7373 3d22 636f 6465 ; M) │ │ │ │ +00017ae0: 636f 6e73 743c 2f73 7061 6e3e 3c2f 6469 const.
    582 │ │ │ │ +00017b40: 3c2f 7370 616e 3e3c 7370 616e 2063 6c61 │ │ │ │ +00017b60: 203c 2f73 7061 6e3e 7b3c 2f64 6976 3e0a {
    . │ │ │ │ +00017b70: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ +00017c20: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00017c30: 6e6f 223e 2020 3538 343c 2f73 7061 6e3e no"> 584 │ │ │ │ +00017c40: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +00017c60: 666f 723c 2f73 7061 6e3e 2028 3c61 2063 for (size │ │ │ │ +00017cc0: 5f74 7970 653c 2f61 3e20 6a3d 303b 206a _type j=0; j │ │ │ │ +00017cd0: 266c 743b 6c3b 206a 2b2b 293c 2f64 6976 <l; j++)
    .
    585< │ │ │ │ +00017d30: 2f73 7061 6e3e 2020 2020 2020 2020 435b /span> C[ │ │ │ │ +00017d40: 6a5d 5b30 5d20 3d20 3c61 2063 6c61 7373 j][0] = M[j │ │ │ │ +00017da0: 5d5b 305d 2a28 2a3c 7370 616e 2063 6c61 ][0]*(*thi │ │ │ │ +00017dc0: 733c 2f73 7061 6e3e 295b 305d 5b30 5d3b s)[0][0]; │ │ │ │ +00017dd0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00017e20: 2035 3836 3c2f 7370 616e 3e20 2020 2020 586 │ │ │ │ +00017e30: 203c 7370 616e 2063 6c61 7373 3d22 6b65 retur │ │ │ │ +00017e50: 6e3c 2f73 7061 6e3e 2043 3b3c 2f64 6976 n C;
    .
    587< │ │ │ │ +00017eb0: 2f73 7061 6e3e 2020 2020 7d3c 2f64 6976 /span> }
    .
    588< │ │ │ │ +00017f10: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
    . │ │ │ │ +00017f30: 3c61 2069 643d 226c 3030 3539 3022 206e 590 FieldMatr │ │ │ │ +00017fd0: 6978 3c2f 613e 2661 6d70 3b20 3c61 2063 ix& rig │ │ │ │ +00018030: 6874 6d75 6c74 6970 6c79 3c2f 613e 2028 htmultiply ( │ │ │ │ +00018040: 3c73 7061 6e20 636c 6173 733d 226b 6579 const FieldMatrix< │ │ │ │ +000180c0: 2f61 3e26 616d 703b 203c 6120 636c 6173 /a>& M) │ │ │ │ +00018120: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00018170: 2035 3931 3c2f 7370 616e 3e20 2020 207b 591 { │ │ │ │ +00018180: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000181d0: 2035 3932 3c2f 7370 616e 3e20 2020 2020 592 │ │ │ │ +000181e0: 205f 6461 7461 5b30 5d20 2a3d 203c 6120 _data[0] *= M< │ │ │ │ +00018240: 2f61 3e5b 305d 5b30 5d3b 3c2f 6469 763e /a>[0][0];
    │ │ │ │ +00018250: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +00018310: 6120 6964 3d22 6c30 3035 3934 2220 6e61 a id="l00594" na │ │ │ │ +00018320: 6d65 3d22 6c30 3035 3934 223e 3c2f 613e me="l00594"> │ │ │ │ +00018330: 3c73 7061 6e20 636c 6173 733d 226c 696e 594 }
    .< │ │ │ │ +00018370: 6120 6964 3d22 6c30 3035 3935 2220 6e61 a id="l00595" na │ │ │ │ +00018380: 6d65 3d22 6c30 3035 3935 223e 3c2f 613e me="l00595"> │ │ │ │ +00018390: 3c73 7061 6e20 636c 6173 733d 226c 696e 595
    .
    597 │ │ │ │ +00018410: 203c 7370 616e 2063 6c61 7373 3d22 6b65 template< │ │ │ │ +00018430: 2f73 7061 6e3e 266c 743b 3c73 7061 6e20 /span><int l │ │ │ │ +00018460: 2667 743b 3c2f 6469 763e 0a3c 6469 7620 >
    .
    598 │ │ │ │ +000184c0: 2020 2046 6965 6c64 4d61 7472 6978 266c FieldMatrix&l │ │ │ │ +000184d0: 743b 4b2c 312c 6c26 6774 3b20 3c61 2063 t;K,1,l> rig │ │ │ │ +00018530: 6874 6d75 6c74 6970 6c79 616e 793c 2f61 htmultiplyany (const FieldMatri │ │ │ │ +00018570: 7826 6c74 3b4b 2c31 2c6c 2667 743b 2661 x<K,1,l>&a │ │ │ │ +00018580: 6d70 3b20 3c61 2063 6c61 7373 3d22 636f mp; M) const.
    5 │ │ │ │ +00018650: 3939 3c2f 7370 616e 3e3c 7370 616e 2063 99 │ │ │ │ +00018670: 2020 203c 2f73 7061 6e3e 7b3c 2f64 6976 {
    .
    600< │ │ │ │ +000186d0: 2f73 7061 6e3e 2020 2020 2020 4669 656c /span> Fiel │ │ │ │ +000186e0: 644d 6174 7269 7826 6c74 3b4b 2c31 2c6c dMatrix<K,1,l │ │ │ │ +000186f0: 2667 743b 2043 3b3c 2f64 6976 3e0a 3c64 > C;
    . │ │ │ │ +00018710: 3c61 2069 643d 226c 3030 3630 3122 206e 601
    .
    602 │ │ │ │ +000187b0: 2020 2020 3c73 7061 6e20 636c 6173 733d fo │ │ │ │ +000187d0: 723c 2f73 7061 6e3e 2028 3c61 2063 6c61 r (size_t │ │ │ │ +00018830: 7970 653c 2f61 3e20 6a3d 303b 206a 266c ype j=0; j&l │ │ │ │ +00018840: 743b 6c3b 206a 2b2b 293c 2f64 6976 3e0a t;l; j++)
    . │ │ │ │ +00018850: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    < │ │ │ │ +00018880: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 603 C[0] │ │ │ │ +000188b0: 5b6a 5d20 3d20 3c61 2063 6c61 7373 3d22 [j] = M[0][ │ │ │ │ +00018910: 6a5d 2a5f 6461 7461 5b30 5d3b 3c2f 6469 j]*_data[0];.
    604 │ │ │ │ +00018970: 3c2f 7370 616e 3e20 2020 2020 203c 7370 return C;
    . │ │ │ │ +000189c0: 3c61 2069 643d 226c 3030 3630 3522 206e 605 }
    . │ │ │ │ +00018a20: 3c61 2069 643d 226c 3030 3630 3622 206e 606
    .
    607 │ │ │ │ +00018ac0: 2020 3c73 7061 6e20 636c 6173 733d 2263 // make │ │ │ │ +00018ae0: 7468 6973 2074 6869 6e67 2061 206d 6174 this thing a mat │ │ │ │ +00018af0: 7269 783c 2f73 7061 6e3e 3c2f 6469 763e rix
    │ │ │ │ +00018b00: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00018b30: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 608 s │ │ │ │ +00018b70: 7461 7469 633c 2f73 7061 6e3e 203c 7370 tatic constexpr size_type mat_rows( │ │ │ │ +00018c60: 2920 7b20 3c73 7061 6e20 636c 6173 733d ) { re │ │ │ │ +00018c80: 7475 726e 3c2f 7370 616e 3e20 313b 207d turn 1; } │ │ │ │ +00018c90: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00018ce0: 2036 3039 3c2f 7370 616e 3e20 2020 203c 609 < │ │ │ │ +00018cf0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00018d00: 6f72 6422 3e73 7461 7469 633c 2f73 7061 ord">static constex │ │ │ │ +00018d30: 7072 3c2f 7370 616e 3e20 3c61 2063 6c61 pr size_t │ │ │ │ +00018d90: 7970 653c 2f61 3e20 3c61 2063 6c61 7373 ype mat_col │ │ │ │ +00018df0: 733c 2f61 3e28 2920 7b20 3c73 7061 6e20 s() { return 1; }
    .< │ │ │ │ +00018e40: 6120 6964 3d22 6c30 3036 3130 2220 6e61 a id="l00610" na │ │ │ │ +00018e50: 6d65 3d22 6c30 3036 3130 223e 3c2f 613e me="l00610"> │ │ │ │ +00018e60: 3c73 7061 6e20 636c 6173 733d 226c 696e 610
    ..
    < │ │ │ │ +00019050: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00019060: 6e6f 223e 2020 3631 323c 2f73 7061 6e3e no"> 612 │ │ │ │ +00019070: 2020 2020 7b3c 2f64 6976 3e0a 3c64 6976 {
    .
    < │ │ │ │ +000190b0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +000190c0: 6e6f 223e 2020 3631 333c 2f73 7061 6e3e no"> 613 │ │ │ │ +000190d0: 2020 2020 2020 3c61 2063 6c61 7373 3d22 DUNE_ASSER │ │ │ │ +00019130: 545f 424f 554e 4453 3c2f 613e 2869 203d T_BOUNDS(i = │ │ │ │ +00019140: 3d20 3029 3b3c 2f64 6976 3e0a 3c64 6976 = 0);
    .
    < │ │ │ │ +00019180: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00019190: 6e6f 223e 2020 3631 343c 2f73 7061 6e3e no"> 614 │ │ │ │ +000191a0: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +000191c0: 7265 7475 726e 3c2f 7370 616e 3e20 5f64 return _d │ │ │ │ +000191d0: 6174 613b 3c2f 6469 763e 0a3c 6469 7620 ata;
    .
    615 │ │ │ │ +00019230: 2020 207d 3c2f 6469 763e 0a3c 6469 7620 }
    .
    616 │ │ │ │ +00019290: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000192e0: 2036 3137 3c2f 7370 616e 3e20 2020 203c 617 < │ │ │ │ +000192f0: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +00019300: 5f74 7970 6564 6566 2220 6872 6566 3d22 _typedef" href=" │ │ │ │ +00019310: 6130 3134 3038 2e68 746d 6c23 6132 3930 a01408.html#a290 │ │ │ │ +00019320: 6430 6236 3937 3131 6439 6538 6166 3137 d0b69711d9e8af17 │ │ │ │ +00019330: 3833 6263 3533 3232 6664 6334 6522 3e63 83bc5322fdc4e">c │ │ │ │ +00019340: 6f6e 7374 5f72 6f77 5f72 6566 6572 656e onst_row_referen │ │ │ │ +00019350: 6365 3c2f 613e 203c 6120 636c 6173 733d ce mat_acce │ │ │ │ +000193b0: 7373 3c2f 613e 2028 5b5b 6d61 7962 655f ss ([[maybe_ │ │ │ │ +000193c0: 756e 7573 6564 5d5d 203c 6120 636c 6173 unused]] size_ty │ │ │ │ +00019420: 7065 3c2f 613e 2069 293c 7370 616e 2063 pe i) │ │ │ │ +00019440: 636f 6e73 743c 2f73 7061 6e3e 3c2f 6469 const.
    618 │ │ │ │ +000194a0: 3c2f 7370 616e 3e3c 7370 616e 2063 6c61 │ │ │ │ +000194c0: 203c 2f73 7061 6e3e 7b3c 2f64 6976 3e0a {
    . │ │ │ │ +000194d0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +000195a0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .< │ │ │ │ +00019630: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +00019640: 3e3c 6120 6964 3d22 6c30 3036 3231 2220 > 621 }
    .< │ │ │ │ +00019690: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +000196a0: 3e3c 6120 6964 3d22 6c30 3036 3232 2220 > 622
    .
    624 │ │ │ │ +00019740: 2020 203c 6120 636c 6173 733d 2263 6f64 FieldMatrix< │ │ │ │ +000197a0: 2f61 3e26 616d 703b 203c 6120 636c 6173 /a>& operat │ │ │ │ +00019800: 6f72 2b3d 203c 2f61 3e28 3c73 7061 6e20 or+= ( │ │ │ │ +00019820: 636f 6e73 743c 2f73 7061 6e3e 204b 2661 const K&a │ │ │ │ +00019830: 6d70 3b20 6b29 3c2f 6469 763e 0a3c 6469 mp; k)
    .< │ │ │ │ +00019850: 6120 6964 3d22 6c30 3036 3235 2220 6e61 a id="l00625" na │ │ │ │ +00019860: 6d65 3d22 6c30 3036 3235 223e 3c2f 613e me="l00625"> │ │ │ │ +00019870: 3c73 7061 6e20 636c 6173 733d 226c 696e 625 {
    .< │ │ │ │ +000198b0: 6120 6964 3d22 6c30 3036 3236 2220 6e61 a id="l00626" na │ │ │ │ +000198c0: 6d65 3d22 6c30 3036 3236 223e 3c2f 613e me="l00626"> │ │ │ │ +000198d0: 3c73 7061 6e20 636c 6173 733d 226c 696e 626 _data[0] │ │ │ │ +00019900: 2b3d 206b 3b3c 2f64 6976 3e0a 3c64 6976 += k;
    .
    < │ │ │ │ +00019940: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +00019950: 6e6f 223e 2020 3632 373c 2f73 7061 6e3e no"> 627 │ │ │ │ +00019960: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +00019980: 7265 7475 726e 3c2f 7370 616e 3e20 282a return (* │ │ │ │ +00019990: 3c73 7061 6e20 636c 6173 733d 226b 6579 this);
    .
    628 │ │ │ │ +00019a10: 2020 7d3c 2f64 6976 3e0a 3c64 6976 2063 }
    .
    629 < │ │ │ │ +00019a70: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00019ac0: 3633 313c 2f73 7061 6e3e 2020 2020 3c61 631 F │ │ │ │ +00019b20: 6965 6c64 4d61 7472 6978 3c2f 613e 2661 ieldMatrix&a │ │ │ │ +00019b30: 6d70 3b20 3c61 2063 6c61 7373 3d22 636f mp; operator-= │ │ │ │ +00019b90: 3c2f 613e 283c 7370 616e 2063 6c61 7373 (const │ │ │ │ +00019bb0: 3c2f 7370 616e 3e20 4b26 616d 703b 206b K& k │ │ │ │ +00019bc0: 293c 2f64 6976 3e0a 3c64 6976 2063 6c61 )
    .
    │ │ │ │ +00019c10: 2020 3633 323c 2f73 7061 6e3e 2020 2020 632 │ │ │ │ +00019c20: 7b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 {
    .
    │ │ │ │ +00019c70: 2020 3633 333c 2f73 7061 6e3e 2020 2020 633 │ │ │ │ +00019c80: 2020 5f64 6174 615b 305d 202d 3d20 6b3b _data[0] -= k; │ │ │ │ +00019c90: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00019ce0: 2036 3334 3c2f 7370 616e 3e20 2020 2020 634 │ │ │ │ +00019cf0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 retur │ │ │ │ +00019d10: 6e3c 2f73 7061 6e3e 2028 2a3c 7370 616e n (*this);.
    6 │ │ │ │ +00019d90: 3335 3c2f 7370 616e 3e20 2020 207d 3c2f 35 }.
    6 │ │ │ │ +00019df0: 3336 3c2f 7370 616e 3e20 3c2f 6469 763e 36
    │ │ │ │ +00019e00: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00019e30: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 638 FieldM │ │ │ │ +00019eb0: 6174 7269 783c 2f61 3e26 616d 703b 203c atrix& < │ │ │ │ +00019ec0: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +00019ed0: 5f66 756e 6374 696f 6e22 2068 7265 663d _function" href= │ │ │ │ +00019ee0: 2261 3031 3430 302e 6874 6d6c 2361 3732 "a01400.html#a72 │ │ │ │ +00019ef0: 3162 3262 6334 6432 3239 3538 6561 3562 1b2bc4d22958ea5b │ │ │ │ +00019f00: 3037 6165 3535 3935 6636 3239 3537 223e 07ae5595f62957"> │ │ │ │ +00019f10: 6f70 6572 6174 6f72 2a3d 203c 2f61 3e28 operator*= ( │ │ │ │ +00019f20: 3c73 7061 6e20 636c 6173 733d 226b 6579 const K& k).
    639 │ │ │ │ +00019fa0: 3c2f 7370 616e 3e20 2020 207b 3c2f 6469 {.
    640 │ │ │ │ +0001a000: 3c2f 7370 616e 3e20 2020 2020 205f 6461 _da │ │ │ │ +0001a010: 7461 5b30 5d20 2a3d 206b 3b3c 2f64 6976 ta[0] *= k;
    .
    641< │ │ │ │ +0001a070: 2f73 7061 6e3e 2020 2020 2020 3c73 7061 /span> return (*this │ │ │ │ +0001a0c0: 3c2f 7370 616e 3e29 3b3c 2f64 6976 3e0a );
    . │ │ │ │ +0001a0d0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +0001a130: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 .
    < │ │ │ │ +0001a1c0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0001a1d0: 6e6f 223e 2020 3634 353c 2f73 7061 6e3e no"> 645 │ │ │ │ +0001a1e0: 2020 2020 3c61 2063 6c61 7373 3d22 636f FieldMatrix │ │ │ │ +0001a240: 3c2f 613e 2661 6d70 3b20 3c61 2063 6c61 & opera │ │ │ │ +0001a2a0: 746f 722f 3d20 3c2f 613e 283c 7370 616e tor/= (const K& │ │ │ │ +0001a2d0: 616d 703b 206b 293c 2f64 6976 3e0a 3c64 amp; k)
    . │ │ │ │ +0001a2f0: 3c61 2069 643d 226c 3030 3634 3622 206e 646 {
    . │ │ │ │ +0001a350: 3c61 2069 643d 226c 3030 3634 3722 206e 647 _data[0] │ │ │ │ +0001a3a0: 202f 3d20 6b3b 3c2f 6469 763e 0a3c 6469 /= k;
    .< │ │ │ │ +0001a3c0: 6120 6964 3d22 6c30 3036 3438 2220 6e61 a id="l00648" na │ │ │ │ +0001a3d0: 6d65 3d22 6c30 3036 3438 223e 3c2f 613e me="l00648"> │ │ │ │ +0001a3e0: 3c73 7061 6e20 636c 6173 733d 226c 696e 648 return ( │ │ │ │ +0001a430: 2a3c 7370 616e 2063 6c61 7373 3d22 6b65 *this);
    .
    649 │ │ │ │ +0001a4b0: 2020 207d 3c2f 6469 763e 0a3c 6469 7620 }
    .
    650 │ │ │ │ +0001a510: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001a560: 2036 3531 3c2f 7370 616e 3e20 2020 203c 651 < │ │ │ │ +0001a570: 7370 616e 2063 6c61 7373 3d22 636f 6d6d span class="comm │ │ │ │ +0001a580: 656e 7422 3e2f 2f3d 3d3d 3d3d 2063 6f6e ent">//===== con │ │ │ │ +0001a590: 7665 7273 696f 6e20 6f70 6572 6174 6f72 version operator │ │ │ │ +0001a5a0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    . │ │ │ │ +0001a5c0: 3c61 2069 643d 226c 3030 3635 3222 206e 652
    .
    653 │ │ │ │ +0001a660: 2020 3c73 7061 6e20 636c 6173 733d 226b operator │ │ │ │ +0001a680: 3c2f 7370 616e 3e20 3c73 7061 6e20 636c co │ │ │ │ +0001a6a0: 6e73 743c 2f73 7061 6e3e 204b 2661 6d70 nst K& │ │ │ │ +0001a6b0: 3b20 2829 203c 7370 616e 2063 6c61 7373 ; () const │ │ │ │ +0001a6d0: 3c2f 7370 616e 3e20 7b20 3c73 7061 6e20 { return _data[0]; }.
    65 │ │ │ │ +0001a760: 343c 2f73 7061 6e3e 203c 2f64 6976 3e0a 4
    . │ │ │ │ +0001a770: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .< │ │ │ │ +0001a7d0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001a7e0: 3e3c 6120 6964 3d22 6c30 3036 3536 2220 > 656
    .
    658 │ │ │ │ +0001a880: 203c 7370 616e 2063 6c61 7373 3d22 6b65 template< │ │ │ │ +0001a8a0: 2f73 7061 6e3e 266c 743b 3c73 7061 6e20 /span>< │ │ │ │ +0001a8c0: 7479 7065 6e61 6d65 3c2f 7370 616e 3e20 typename │ │ │ │ +0001a8d0: 4b26 6774 3b3c 2f64 6976 3e0a 3c64 6976 K>
    .
    < │ │ │ │ +0001a910: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0001a920: 6e6f 223e 2020 3635 393c 2f73 7061 6e3e no"> 659 │ │ │ │ +0001a930: 2020 7374 643a 3a6f 7374 7265 616d 2661 std::ostream&a │ │ │ │ +0001a940: 6d70 3b20 3c61 2063 6c61 7373 3d22 636f mp; operator&l │ │ │ │ +0001a9a0: 743b 266c 743b 203c 2f61 3e28 7374 643a t;< (std: │ │ │ │ +0001a9b0: 3a6f 7374 7265 616d 2661 6d70 3b20 732c :ostream& s, │ │ │ │ +0001a9c0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 const FieldMatrix& │ │ │ │ +0001a9f0: 6c74 3b4b 2c31 2c31 2667 743b 2661 6d70 lt;K,1,1>& │ │ │ │ +0001aa00: 3b20 6129 3c2f 6469 763e 0a3c 6469 7620 ; a)
    .
    660 │ │ │ │ +0001aa60: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    .
    661 │ │ │ │ +0001aac0: 2073 2026 6c74 3b26 6c74 3b20 615b 305d s << a[0] │ │ │ │ +0001aad0: 5b30 5d3b 3c2f 6469 763e 0a3c 6469 7620 [0];
    .
    662 │ │ │ │ +0001ab30: 2020 203c 7370 616e 2063 6c61 7373 3d22 ret │ │ │ │ +0001ab50: 7572 6e3c 2f73 7061 6e3e 2073 3b3c 2f64 urn s;.
    66 │ │ │ │ +0001abb0: 333c 2f73 7061 6e3e 2020 7d3c 2f64 6976 3 }
    .
    664< │ │ │ │ +0001ac10: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
    . │ │ │ │ +0001ac30: 3c61 2069 643d 226c 3030 3636 3522 206e 665#en │ │ │ │ +0001ac90: 6469 6620 3c2f 7370 616e 3e3c 7370 616e dif // DOXYGEN
    .
    666 .
    .
    667< │ │ │ │ +0001ade0: 2f73 7061 6e3e 2020 3c73 7061 6e20 636c /span> na │ │ │ │ +0001ae00: 6d65 7370 6163 6520 3c2f 7370 616e 3e46 mespace F │ │ │ │ +0001ae10: 4d61 7472 6978 4865 6c70 207b 3c2f 6469 MatrixHelp {.
    668 │ │ │ │ +0001ae70: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +0001ae80: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001ae90: 3e3c 6120 6964 3d22 6c30 3036 3730 2220 > 670 tem │ │ │ │ +0001aef0: 706c 6174 653c 2f73 7061 6e3e 2026 6c74 plate < │ │ │ │ +0001af00: 3b3c 7370 616e 2063 6c61 7373 3d22 6b65 ;typename< │ │ │ │ +0001af20: 2f73 7061 6e3e 204b 2667 743b 3c2f 6469 /span> K>.
    .
    671< │ │ │ │ +0001b010: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +0001b030: 7374 6174 6963 3c2f 7370 616e 3e20 3c73 static inline K invertMatri │ │ │ │ +0001b0c0: 783c 2f61 3e20 283c 7370 616e 2063 6c61 x (con │ │ │ │ +0001b0e0: 7374 3c2f 7370 616e 3e20 3c61 2063 6c61 st FieldMatri │ │ │ │ +0001b120: 7826 6c74 3b4b 2c31 2c31 2667 743b 3c2f x<K,1,1> &matrix, │ │ │ │ +0001b140: 3c61 2063 6c61 7373 3d22 636f 6465 2068 Fiel │ │ │ │ +0001b170: 644d 6174 7269 7826 6c74 3b4b 2c31 2c31 dMatrix<K,1,1 │ │ │ │ +0001b180: 2667 743b 3c2f 613e 2026 616d 703b 696e > &in │ │ │ │ +0001b190: 7665 7273 6529 3c2f 6469 763e 0a3c 6469 verse)
    .< │ │ │ │ +0001b1b0: 6120 6964 3d22 6c30 3036 3732 2220 6e61 a id="l00672" na │ │ │ │ +0001b1c0: 6d65 3d22 6c30 3036 3732 223e 3c2f 613e me="l00672"> │ │ │ │ +0001b1d0: 3c73 7061 6e20 636c 6173 733d 226c 696e 672 {
    .< │ │ │ │ +0001b210: 6120 6964 3d22 6c30 3036 3733 2220 6e61 a id="l00673" na │ │ │ │ +0001b220: 6d65 3d22 6c30 3036 3733 223e 3c2f 613e me="l00673"> │ │ │ │ +0001b230: 3c73 7061 6e20 636c 6173 733d 226c 696e 673 usi │ │ │ │ +0001b270: 6e67 203c 2f73 7061 6e3e 7265 616c 5f74 ng real_t │ │ │ │ +0001b280: 7970 6520 3d20 3c73 7061 6e20 636c 6173 ype = type │ │ │ │ +0001b2a0: 6e61 6d65 3c2f 7370 616e 3e20 3c61 2063 name Fiel │ │ │ │ +0001b300: 6454 7261 6974 7326 6c74 3b4b 2667 743b dTraits<K> │ │ │ │ +0001b310: 3a3a 7265 616c 5f74 7970 653c 2f61 3e3b ::real_type; │ │ │ │ +0001b320: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001b370: 2036 3734 3c2f 7370 616e 3e20 2020 2020 674 │ │ │ │ +0001b380: 2069 6e76 6572 7365 5b30 5d5b 305d 203d inverse[0][0] = │ │ │ │ +0001b390: 2072 6561 6c5f 7479 7065 2831 2e30 292f real_type(1.0)/ │ │ │ │ +0001b3a0: 6d61 7472 6978 5b30 5d5b 305d 3b3c 2f64 matrix[0][0];.
    67 │ │ │ │ +0001b400: 353c 2f73 7061 6e3e 2020 2020 2020 3c73 5 return matrix[0][ │ │ │ │ +0001b440: 305d 3b3c 2f64 6976 3e0a 3c64 6976 2063 0];
    .
    676 │ │ │ │ +0001b4a0: 2020 7d3c 2f64 6976 3e0a 3c2f 6469 763e }
    .
    │ │ │ │ +0001b4b0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ +0001b520: 6120 6964 3d22 6c30 3036 3739 2220 6e61 a id="l00679" na │ │ │ │ +0001b530: 6d65 3d22 6c30 3036 3739 223e 3c2f 613e me="l00679"> │ │ │ │ +0001b540: 3c73 7061 6e20 636c 6173 733d 226c 696e 679 templ │ │ │ │ +0001b580: 6174 653c 2f73 7061 6e3e 2026 6c74 3b3c ate << │ │ │ │ +0001b590: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0001b5a0: 6f72 6422 3e74 7970 656e 616d 653c 2f73 ord">typename K>
    │ │ │ │ +0001b5c0: 0a3c 6469 7620 636c 6173 733d 2266 6f6c .
    .
    < │ │ │ │ +0001b650: 6120 636c 6173 733d 226c 696e 6522 2068 a class="line" h │ │ │ │ +0001b660: 7265 663d 2261 3030 3433 362e 6874 6d6c ref="a00436.html │ │ │ │ +0001b670: 2361 3637 3135 3538 3135 6230 3334 3737 #a67155815b03477 │ │ │ │ +0001b680: 3331 3239 6432 3162 6665 3339 3932 6630 3129d21bfe3992f0 │ │ │ │ +0001b690: 6236 223e 2020 3638 303c 2f61 3e3c 2f73 b6"> 680 st │ │ │ │ +0001b6c0: 6174 6963 3c2f 7370 616e 3e20 3c73 7061 atic inline │ │ │ │ +0001b6f0: 4b20 3c61 2063 6c61 7373 3d22 636f 6465 K invertMatrix_ │ │ │ │ +0001b750: 7265 7454 7261 6e73 706f 7365 643c 2f61 retTransposed (const FieldMatrix< │ │ │ │ +0001b7c0: 3b4b 2c31 2c31 2667 743b 3c2f 613e 2026 ;K,1,1> & │ │ │ │ +0001b7d0: 616d 703b 6d61 7472 6978 2c20 3c61 2063 amp;matrix, FieldMat │ │ │ │ +0001b810: 7269 7826 6c74 3b4b 2c31 2c31 2667 743b rix<K,1,1> │ │ │ │ +0001b820: 3c2f 613e 2026 616d 703b 696e 7665 7273 &invers │ │ │ │ +0001b830: 6529 3c2f 6469 763e 0a3c 6469 7620 636c e)
    .
    681 │ │ │ │ +0001b890: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    .
    682 │ │ │ │ +0001b8f0: 2020 203c 7370 616e 2063 6c61 7373 3d22 ret │ │ │ │ +0001b910: 7572 6e3c 2f73 7061 6e3e 203c 6120 636c urn inve │ │ │ │ +0001b970: 7274 4d61 7472 6978 3c2f 613e 286d 6174 rtMatrix(mat │ │ │ │ +0001b980: 7269 782c 696e 7665 7273 6529 3b3c 2f64 rix,inverse);.
    68 │ │ │ │ +0001b9e0: 333c 2f73 7061 6e3e 2020 2020 7d3c 2f64 3 }.
    .
    684 │ │ │ │ +0001ba50: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001baa0: 2036 3835 3c2f 7370 616e 3e20 3c2f 6469 685 .
    687 │ │ │ │ +0001bb00: 3c2f 7370 616e 3e20 2020 203c 7370 616e template │ │ │ │ +0001bb30: 2026 6c74 3b3c 7370 616e 2063 6c61 7373 <typen │ │ │ │ +0001bb50: 616d 653c 2f73 7061 6e3e 204b 2667 743b ame K> │ │ │ │ +0001bb60: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    .< │ │ │ │ +0001bbc0: 6120 6964 3d22 6c30 3036 3838 2220 6e61 a id="l00688" na │ │ │ │ +0001bbd0: 6d65 3d22 6c30 3036 3838 223e 3c2f 613e me="l00688"> │ │ │ │ +0001bbe0: 3c73 7061 6e20 636c 6173 733d 226c 696e 688< │ │ │ │ +0001bc40: 2f61 3e3c 2f73 7061 6e3e 2020 2020 3c73 /a> static inline K invertM │ │ │ │ +0001bcf0: 6174 7269 783c 2f61 3e20 283c 7370 616e atrix (const FieldM │ │ │ │ +0001bd50: 6174 7269 7826 6c74 3b4b 2c32 2c32 2667 atrix<K,2,2&g │ │ │ │ +0001bd60: 743b 3c2f 613e 2026 616d 703b 6d61 7472 t; &matr │ │ │ │ +0001bd70: 6978 2c20 3c61 2063 6c61 7373 3d22 636f ix, │ │ │ │ +0001bda0: 4669 656c 644d 6174 7269 7826 6c74 3b4b FieldMatrix<K │ │ │ │ +0001bdb0: 2c32 2c32 2667 743b 3c2f 613e 2026 616d ,2,2> &am │ │ │ │ +0001bdc0: 703b 696e 7665 7273 6529 3c2f 6469 763e p;inverse)
    │ │ │ │ +0001bdd0: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ +0001be30: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0001be60: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 690 using re │ │ │ │ +0001beb0: 616c 5f74 7970 6520 3d20 3c73 7061 6e20 al_type = │ │ │ │ +0001bed0: 7479 7065 6e61 6d65 3c2f 7370 616e 3e20 typename │ │ │ │ +0001bee0: 3c61 2063 6c61 7373 3d22 636f 6465 2068 │ │ │ │ +0001bf30: 4669 656c 6454 7261 6974 7326 6c74 3b4b FieldTraits<K │ │ │ │ +0001bf40: 2667 743b 3a3a 7265 616c 5f74 7970 653c >::real_type< │ │ │ │ +0001bf50: 2f61 3e3b 3c2f 6469 763e 0a3c 6469 7620 /a>;
    .
    691 │ │ │ │ +0001bfb0: 2020 2020 203c 7370 616e 2063 6c61 7373 // co │ │ │ │ +0001bfd0: 6465 2067 656e 6572 6174 6564 2062 7920 de generated by │ │ │ │ +0001bfe0: 6d61 706c 653c 2f73 7061 6e3e 3c2f 6469 maple.
    692 │ │ │ │ +0001c040: 3c2f 7370 616e 3e20 2020 2020 204b 2064 K d │ │ │ │ +0001c050: 6574 203d 2028 6d61 7472 6978 5b30 5d5b et = (matrix[0][ │ │ │ │ +0001c060: 305d 2a6d 6174 7269 785b 315d 5b31 5d20 0]*matrix[1][1] │ │ │ │ +0001c070: 2d20 6d61 7472 6978 5b30 5d5b 315d 2a6d - matrix[0][1]*m │ │ │ │ +0001c080: 6174 7269 785b 315d 5b30 5d29 3b3c 2f64 atrix[1][0]);.
    69 │ │ │ │ +0001c0e0: 333c 2f73 7061 6e3e 2020 2020 2020 4b20 3 K │ │ │ │ +0001c0f0: 6465 745f 3120 3d20 7265 616c 5f74 7970 det_1 = real_typ │ │ │ │ +0001c100: 6528 312e 3029 2f64 6574 3b3c 2f64 6976 e(1.0)/det;
    .
    694< │ │ │ │ +0001c160: 2f73 7061 6e3e 2020 2020 2020 696e 7665 /span> inve │ │ │ │ +0001c170: 7273 655b 305d 5b30 5d20 3d20 2020 6d61 rse[0][0] = ma │ │ │ │ +0001c180: 7472 6978 5b31 5d5b 315d 202a 2064 6574 trix[1][1] * det │ │ │ │ +0001c190: 5f31 3b3c 2f64 6976 3e0a 3c64 6976 2063 _1;
    .
    695 │ │ │ │ +0001c1f0: 2020 2020 696e 7665 7273 655b 305d 5b31 inverse[0][1 │ │ │ │ +0001c200: 5d20 3d20 2d20 6d61 7472 6978 5b30 5d5b ] = - matrix[0][ │ │ │ │ +0001c210: 315d 202a 2064 6574 5f31 3b3c 2f64 6976 1] * det_1;
    .
    696< │ │ │ │ +0001c270: 2f73 7061 6e3e 2020 2020 2020 696e 7665 /span> inve │ │ │ │ +0001c280: 7273 655b 315d 5b30 5d20 3d20 2d20 6d61 rse[1][0] = - ma │ │ │ │ +0001c290: 7472 6978 5b31 5d5b 305d 202a 2064 6574 trix[1][0] * det │ │ │ │ +0001c2a0: 5f31 3b3c 2f64 6976 3e0a 3c64 6976 2063 _1;
    .
    697 │ │ │ │ +0001c300: 2020 2020 696e 7665 7273 655b 315d 5b31 inverse[1][1 │ │ │ │ +0001c310: 5d20 3d20 2020 6d61 7472 6978 5b30 5d5b ] = matrix[0][ │ │ │ │ +0001c320: 305d 202a 2064 6574 5f31 3b3c 2f64 6976 0] * det_1;
    .
    698< │ │ │ │ +0001c380: 2f73 7061 6e3e 2020 2020 2020 3c73 7061 /span> return det;
    .< │ │ │ │ +0001c3c0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001c3d0: 3e3c 6120 6964 3d22 6c30 3036 3939 2220 > 699 }
    .< │ │ │ │ +0001c420: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001c470: 3730 303c 2f73 7061 6e3e 203c 2f64 6976 700
    .
    703< │ │ │ │ +0001c4d0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +0001c4f0: 7465 6d70 6c61 7465 3c2f 7370 616e 3e20 template │ │ │ │ +0001c500: 266c 743b 3c73 7061 6e20 636c 6173 733d <typena │ │ │ │ +0001c520: 6d65 3c2f 7370 616e 3e20 4b26 6774 3b3c me K>< │ │ │ │ +0001c530: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.. │ │ │ │ +0001c820: 3c61 2069 643d 226c 3030 3730 3622 206e 706 us │ │ │ │ +0001c880: 696e 6720 3c2f 7370 616e 3e72 6561 6c5f ing real_ │ │ │ │ +0001c890: 7479 7065 203d 203c 7370 616e 2063 6c61 type = typ │ │ │ │ +0001c8b0: 656e 616d 653c 2f73 7061 6e3e 203c 6120 ename Fie │ │ │ │ +0001c910: 6c64 5472 6169 7473 266c 743b 4b26 6774 ldTraits<K> │ │ │ │ +0001c920: 3b3a 3a72 6561 6c5f 7479 7065 3c2f 613e ;::real_type │ │ │ │ +0001c930: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +0001c980: 2020 3730 373c 2f73 7061 6e3e 2020 2020 707 │ │ │ │ +0001c990: 2020 3c73 7061 6e20 636c 6173 733d 2263 // code │ │ │ │ +0001c9b0: 6765 6e65 7261 7465 6420 6279 206d 6170 generated by map │ │ │ │ +0001c9c0: 6c65 3c2f 7370 616e 3e3c 2f64 6976 3e0a le
    . │ │ │ │ +0001c9d0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    │ │ │ │ +0001ca70: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0001caa0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 709 K det │ │ │ │ +0001cad0: 5f31 203d 2072 6561 6c5f 7479 7065 2831 _1 = real_type(1 │ │ │ │ +0001cae0: 2e30 292f 6465 743b 3c2f 6469 763e 0a3c .0)/det;
    .< │ │ │ │ +0001caf0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001cb00: 3e3c 6120 6964 3d22 6c30 3037 3130 2220 > 710 inverse │ │ │ │ +0001cb50: 5b30 5d5b 305d 203d 2020 206d 6174 7269 [0][0] = matri │ │ │ │ +0001cb60: 785b 315d 5b31 5d20 2a20 6465 745f 313b x[1][1] * det_1; │ │ │ │ +0001cb70: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001cbc0: 2037 3131 3c2f 7370 616e 3e20 2020 2020 711 │ │ │ │ +0001cbd0: 2069 6e76 6572 7365 5b31 5d5b 305d 203d inverse[1][0] = │ │ │ │ +0001cbe0: 202d 206d 6174 7269 785b 305d 5b31 5d20 - matrix[0][1] │ │ │ │ +0001cbf0: 2a20 6465 745f 313b 3c2f 6469 763e 0a3c * det_1;
    .< │ │ │ │ +0001cc00: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001cc10: 3e3c 6120 6964 3d22 6c30 3037 3132 2220 > 712 inverse │ │ │ │ +0001cc60: 5b30 5d5b 315d 203d 202d 206d 6174 7269 [0][1] = - matri │ │ │ │ +0001cc70: 785b 315d 5b30 5d20 2a20 6465 745f 313b x[1][0] * det_1; │ │ │ │ +0001cc80: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001ccd0: 2037 3133 3c2f 7370 616e 3e20 2020 2020 713 │ │ │ │ +0001cce0: 2069 6e76 6572 7365 5b31 5d5b 315d 203d inverse[1][1] = │ │ │ │ +0001ccf0: 2020 206d 6174 7269 785b 305d 5b30 5d20 matrix[0][0] │ │ │ │ +0001cd00: 2a20 6465 745f 313b 3c2f 6469 763e 0a3c * det_1;
    .< │ │ │ │ +0001cd10: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001cd20: 3e3c 6120 6964 3d22 6c30 3037 3134 2220 > 714 return │ │ │ │ +0001cd90: 2064 6574 3b3c 2f64 6976 3e0a 3c64 6976 det;
    .
    < │ │ │ │ +0001cdd0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0001cde0: 6e6f 223e 2020 3731 353c 2f73 7061 6e3e no"> 715 │ │ │ │ +0001cdf0: 2020 2020 7d3c 2f64 6976 3e0a 3c2f 6469 }
    ..
    716 │ │ │ │ +0001ce50: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
    .< │ │ │ │ +0001ce60: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001ce70: 3e3c 6120 6964 3d22 6c30 3037 3138 2220 > 718 tem │ │ │ │ +0001ced0: 706c 6174 653c 2f73 7061 6e3e 2026 6c74 plate < │ │ │ │ +0001cee0: 3b3c 7370 616e 2063 6c61 7373 3d22 6b65 ;typename< │ │ │ │ +0001cf00: 2f73 7061 6e3e 204b 2667 743b 3c2f 6469 /span> K>.
    .
    719< │ │ │ │ +0001cff0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +0001d010: 7374 6174 6963 3c2f 7370 616e 3e20 3c73 static inline K invertMatri │ │ │ │ +0001d0a0: 783c 2f61 3e20 283c 7370 616e 2063 6c61 x (con │ │ │ │ +0001d0c0: 7374 3c2f 7370 616e 3e20 3c61 2063 6c61 st FieldMatri │ │ │ │ +0001d100: 7826 6c74 3b4b 2c33 2c33 2667 743b 3c2f x<K,3,3> &matrix, │ │ │ │ +0001d120: 3c61 2063 6c61 7373 3d22 636f 6465 2068 Fiel │ │ │ │ +0001d150: 644d 6174 7269 7826 6c74 3b4b 2c33 2c33 dMatrix<K,3,3 │ │ │ │ +0001d160: 2667 743b 3c2f 613e 2026 616d 703b 696e > &in │ │ │ │ +0001d170: 7665 7273 6529 3c2f 6469 763e 0a3c 6469 verse)
    .< │ │ │ │ +0001d190: 6120 6964 3d22 6c30 3037 3230 2220 6e61 a id="l00720" na │ │ │ │ +0001d1a0: 6d65 3d22 6c30 3037 3230 223e 3c2f 613e me="l00720"> │ │ │ │ +0001d1b0: 3c73 7061 6e20 636c 6173 733d 226c 696e 720 {
    .< │ │ │ │ +0001d1f0: 6120 6964 3d22 6c30 3037 3231 2220 6e61 a id="l00721" na │ │ │ │ +0001d200: 6d65 3d22 6c30 3037 3231 223e 3c2f 613e me="l00721"> │ │ │ │ +0001d210: 3c73 7061 6e20 636c 6173 733d 226c 696e 721 usi │ │ │ │ +0001d250: 6e67 203c 2f73 7061 6e3e 7265 616c 5f74 ng real_t │ │ │ │ +0001d260: 7970 6520 3d20 3c73 7061 6e20 636c 6173 ype = type │ │ │ │ +0001d280: 6e61 6d65 3c2f 7370 616e 3e20 3c61 2063 name Fiel │ │ │ │ +0001d2e0: 6454 7261 6974 7326 6c74 3b4b 2667 743b dTraits<K> │ │ │ │ +0001d2f0: 3a3a 7265 616c 5f74 7970 653c 2f61 3e3b ::real_type; │ │ │ │ +0001d300: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001d350: 2037 3232 3c2f 7370 616e 3e20 2020 2020 722 │ │ │ │ +0001d360: 203c 7370 616e 2063 6c61 7373 3d22 636f // code g │ │ │ │ +0001d380: 656e 6572 6174 6564 2062 7920 6d61 706c enerated by mapl │ │ │ │ +0001d390: 653c 2f73 7061 6e3e 3c2f 6469 763e 0a3c e
    .< │ │ │ │ +0001d3a0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001d3b0: 3e3c 6120 6964 3d22 6c30 3037 3233 2220 > 723 K t4 = │ │ │ │ +0001d400: 206d 6174 7269 785b 305d 5b30 5d20 2a20 matrix[0][0] * │ │ │ │ +0001d410: 6d61 7472 6978 5b31 5d5b 315d 3b3c 2f64 matrix[1][1];.
    72 │ │ │ │ +0001d470: 343c 2f73 7061 6e3e 2020 2020 2020 4b20 4 K │ │ │ │ +0001d480: 7436 2020 3d20 6d61 7472 6978 5b30 5d5b t6 = matrix[0][ │ │ │ │ +0001d490: 305d 202a 206d 6174 7269 785b 315d 5b32 0] * matrix[1][2 │ │ │ │ +0001d4a0: 5d3b 3c2f 6469 763e 0a3c 6469 7620 636c ];
    .
    725 │ │ │ │ +0001d500: 2020 204b 2074 3820 203d 206d 6174 7269 K t8 = matri │ │ │ │ +0001d510: 785b 305d 5b31 5d20 2a20 6d61 7472 6978 x[0][1] * matrix │ │ │ │ +0001d520: 5b31 5d5b 305d 3b3c 2f64 6976 3e0a 3c64 [1][0];
    . │ │ │ │ +0001d540: 3c61 2069 643d 226c 3030 3732 3622 206e 726
    K t10 = │ │ │ │ +0001d590: 6d61 7472 6978 5b30 5d5b 325d 202a 206d matrix[0][2] * m │ │ │ │ +0001d5a0: 6174 7269 785b 315d 5b30 5d3b 3c2f 6469 atrix[1][0];.
    727 │ │ │ │ +0001d600: 3c2f 7370 616e 3e20 2020 2020 204b 2074 K t │ │ │ │ +0001d610: 3132 203d 206d 6174 7269 785b 305d 5b31 12 = matrix[0][1 │ │ │ │ +0001d620: 5d20 2a20 6d61 7472 6978 5b32 5d5b 305d ] * matrix[2][0] │ │ │ │ +0001d630: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +0001d680: 2020 3732 383c 2f73 7061 6e3e 2020 2020 728 │ │ │ │ +0001d690: 2020 4b20 7431 3420 3d20 6d61 7472 6978 K t14 = matrix │ │ │ │ +0001d6a0: 5b30 5d5b 325d 202a 206d 6174 7269 785b [0][2] * matrix[ │ │ │ │ +0001d6b0: 325d 5b30 5d3b 3c2f 6469 763e 0a3c 6469 2][0];
    .< │ │ │ │ +0001d6d0: 6120 6964 3d22 6c30 3037 3239 2220 6e61 a id="l00729" na │ │ │ │ +0001d6e0: 6d65 3d22 6c30 3037 3239 223e 3c2f 613e me="l00729"> │ │ │ │ +0001d6f0: 3c73 7061 6e20 636c 6173 733d 226c 696e 729
    .
    730 │ │ │ │ +0001d770: 2020 204b 2064 6574 203d 2028 7434 2a6d K det = (t4*m │ │ │ │ +0001d780: 6174 7269 785b 325d 5b32 5d2d 7436 2a6d atrix[2][2]-t6*m │ │ │ │ +0001d790: 6174 7269 785b 325d 5b31 5d2d 7438 2a6d atrix[2][1]-t8*m │ │ │ │ +0001d7a0: 6174 7269 785b 325d 5b32 5d2b 3c2f 6469 atrix[2][2]+.
    731 │ │ │ │ +0001d800: 3c2f 7370 616e 3e20 2020 2020 2020 2020 │ │ │ │ +0001d810: 2020 2020 2020 7431 302a 6d61 7472 6978 t10*matrix │ │ │ │ +0001d820: 5b32 5d5b 315d 2b74 3132 2a6d 6174 7269 [2][1]+t12*matri │ │ │ │ +0001d830: 785b 315d 5b32 5d2d 7431 342a 6d61 7472 x[1][2]-t14*matr │ │ │ │ +0001d840: 6978 5b31 5d5b 315d 293b 3c2f 6469 763e ix[1][1]);
    │ │ │ │ +0001d850: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0001d880: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 732 K t17 │ │ │ │ +0001d8b0: 203d 2072 6561 6c5f 7479 7065 2831 2e30 = real_type(1.0 │ │ │ │ +0001d8c0: 292f 6465 743b 3c2f 6469 763e 0a3c 6469 )/det;
    .< │ │ │ │ +0001d8e0: 6120 6964 3d22 6c30 3037 3333 2220 6e61 a id="l00733" na │ │ │ │ +0001d8f0: 6d65 3d22 6c30 3037 3333 223e 3c2f 613e me="l00733"> │ │ │ │ +0001d900: 3c73 7061 6e20 636c 6173 733d 226c 696e 733
    .
    734 │ │ │ │ +0001d980: 2020 2069 6e76 6572 7365 5b30 5d5b 305d inverse[0][0] │ │ │ │ +0001d990: 203d 2020 286d 6174 7269 785b 315d 5b31 = (matrix[1][1 │ │ │ │ +0001d9a0: 5d20 2a20 6d61 7472 6978 5b32 5d5b 325d ] * matrix[2][2] │ │ │ │ +0001d9b0: 202d 206d 6174 7269 785b 315d 5b32 5d20 - matrix[1][2] │ │ │ │ +0001d9c0: 2a20 6d61 7472 6978 5b32 5d5b 315d 292a * matrix[2][1])* │ │ │ │ +0001d9d0: 7431 373b 3c2f 6469 763e 0a3c 6469 7620 t17;
    .
    735 │ │ │ │ +0001da30: 2020 2020 2069 6e76 6572 7365 5b30 5d5b inverse[0][ │ │ │ │ +0001da40: 315d 203d 202d 286d 6174 7269 785b 305d 1] = -(matrix[0] │ │ │ │ +0001da50: 5b31 5d20 2a20 6d61 7472 6978 5b32 5d5b [1] * matrix[2][ │ │ │ │ +0001da60: 325d 202d 206d 6174 7269 785b 305d 5b32 2] - matrix[0][2 │ │ │ │ +0001da70: 5d20 2a20 6d61 7472 6978 5b32 5d5b 315d ] * matrix[2][1] │ │ │ │ +0001da80: 292a 7431 373b 3c2f 6469 763e 0a3c 6469 )*t17;
    .< │ │ │ │ +0001daa0: 6120 6964 3d22 6c30 3037 3336 2220 6e61 a id="l00736" na │ │ │ │ +0001dab0: 6d65 3d22 6c30 3037 3336 223e 3c2f 613e me="l00736"> │ │ │ │ +0001dac0: 3c73 7061 6e20 636c 6173 733d 226c 696e 736 inverse[0 │ │ │ │ +0001daf0: 5d5b 325d 203d 2020 286d 6174 7269 785b ][2] = (matrix[ │ │ │ │ +0001db00: 305d 5b31 5d20 2a20 6d61 7472 6978 5b31 0][1] * matrix[1 │ │ │ │ +0001db10: 5d5b 325d 202d 206d 6174 7269 785b 305d ][2] - matrix[0] │ │ │ │ +0001db20: 5b32 5d20 2a20 6d61 7472 6978 5b31 5d5b [2] * matrix[1][ │ │ │ │ +0001db30: 315d 292a 7431 373b 3c2f 6469 763e 0a3c 1])*t17;
    .< │ │ │ │ +0001db40: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001db50: 3e3c 6120 6964 3d22 6c30 3037 3337 2220 > 737 inverse │ │ │ │ +0001dba0: 5b31 5d5b 305d 203d 202d 286d 6174 7269 [1][0] = -(matri │ │ │ │ +0001dbb0: 785b 315d 5b30 5d20 2a20 6d61 7472 6978 x[1][0] * matrix │ │ │ │ +0001dbc0: 5b32 5d5b 325d 202d 206d 6174 7269 785b [2][2] - matrix[ │ │ │ │ +0001dbd0: 315d 5b32 5d20 2a20 6d61 7472 6978 5b32 1][2] * matrix[2 │ │ │ │ +0001dbe0: 5d5b 305d 292a 7431 373b 3c2f 6469 763e ][0])*t17;
    │ │ │ │ +0001dbf0: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0001dc20: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 738 inver │ │ │ │ +0001dc50: 7365 5b31 5d5b 315d 203d 2020 286d 6174 se[1][1] = (mat │ │ │ │ +0001dc60: 7269 785b 305d 5b30 5d20 2a20 6d61 7472 rix[0][0] * matr │ │ │ │ +0001dc70: 6978 5b32 5d5b 325d 202d 2074 3134 2920 ix[2][2] - t14) │ │ │ │ +0001dc80: 2a20 7431 373b 3c2f 6469 763e 0a3c 6469 * t17;
    .< │ │ │ │ +0001dca0: 6120 6964 3d22 6c30 3037 3339 2220 6e61 a id="l00739" na │ │ │ │ +0001dcb0: 6d65 3d22 6c30 3037 3339 223e 3c2f 613e me="l00739"> │ │ │ │ +0001dcc0: 3c73 7061 6e20 636c 6173 733d 226c 696e 739 inverse[1 │ │ │ │ +0001dcf0: 5d5b 325d 203d 202d 2874 362d 7431 3029 ][2] = -(t6-t10) │ │ │ │ +0001dd00: 202a 2074 3137 3b3c 2f64 6976 3e0a 3c64 * t17;
    . │ │ │ │ +0001dd20: 3c61 2069 643d 226c 3030 3734 3022 206e 740 inverse[ │ │ │ │ +0001dd70: 325d 5b30 5d20 3d20 2028 6d61 7472 6978 2][0] = (matrix │ │ │ │ +0001dd80: 5b31 5d5b 305d 202a 206d 6174 7269 785b [1][0] * matrix[ │ │ │ │ +0001dd90: 325d 5b31 5d20 2d20 6d61 7472 6978 5b31 2][1] - matrix[1 │ │ │ │ +0001dda0: 5d5b 315d 202a 206d 6174 7269 785b 325d ][1] * matrix[2] │ │ │ │ +0001ddb0: 5b30 5d29 202a 2074 3137 3b3c 2f64 6976 [0]) * t17;
    .
    741< │ │ │ │ +0001de10: 2f73 7061 6e3e 2020 2020 2020 696e 7665 /span> inve │ │ │ │ +0001de20: 7273 655b 325d 5b31 5d20 3d20 2d28 6d61 rse[2][1] = -(ma │ │ │ │ +0001de30: 7472 6978 5b30 5d5b 305d 202a 206d 6174 trix[0][0] * mat │ │ │ │ +0001de40: 7269 785b 325d 5b31 5d20 2d20 7431 3229 rix[2][1] - t12) │ │ │ │ +0001de50: 202a 2074 3137 3b3c 2f64 6976 3e0a 3c64 * t17;
    . │ │ │ │ +0001de70: 3c61 2069 643d 226c 3030 3734 3222 206e 742 inverse[ │ │ │ │ +0001dec0: 325d 5b32 5d20 3d20 2028 7434 2d74 3829 2][2] = (t4-t8) │ │ │ │ +0001ded0: 202a 2074 3137 3b3c 2f64 6976 3e0a 3c64 * t17;
    . │ │ │ │ +0001def0: 3c61 2069 643d 226c 3030 3734 3322 206e 743
    .
    744 │ │ │ │ +0001df90: 2020 2020 3c73 7061 6e20 636c 6173 733d re │ │ │ │ +0001dfb0: 7475 726e 3c2f 7370 616e 3e20 6465 743b turn det; │ │ │ │ +0001dfc0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001e010: 2037 3435 3c2f 7370 616e 3e20 2020 207d 745 } │ │ │ │ +0001e020: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c64
    .
    . │ │ │ │ +0001e040: 3c61 2069 643d 226c 3030 3734 3622 206e 746
    .
    748 │ │ │ │ +0001e0e0: 2020 3c73 7061 6e20 636c 6173 733d 226b template │ │ │ │ +0001e100: 3c2f 7370 616e 3e20 266c 743b 3c73 7061 <typename K>
    ..
    749 stati │ │ │ │ +0001e240: 633c 2f73 7061 6e3e 203c 7370 616e 2063 c i │ │ │ │ +0001e260: 6e6c 696e 653c 2f73 7061 6e3e 204b 203c nline K < │ │ │ │ +0001e270: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +0001e280: 5f66 756e 6374 696f 6e22 2068 7265 663d _function" href= │ │ │ │ +0001e290: 2261 3030 3433 362e 6874 6d6c 2361 3637 "a00436.html#a67 │ │ │ │ +0001e2a0: 3135 3538 3135 6230 3334 3737 3331 3239 155815b034773129 │ │ │ │ +0001e2b0: 6432 3162 6665 3339 3932 6630 6236 223e d21bfe3992f0b6"> │ │ │ │ +0001e2c0: 696e 7665 7274 4d61 7472 6978 5f72 6574 invertMatrix_ret │ │ │ │ +0001e2d0: 5472 616e 7370 6f73 6564 3c2f 613e 2028 Transposed ( │ │ │ │ +0001e2e0: 3c73 7061 6e20 636c 6173 733d 226b 6579 const F │ │ │ │ +0001e330: 6965 6c64 4d61 7472 6978 266c 743b 4b2c ieldMatrix<K, │ │ │ │ +0001e340: 332c 3326 6774 3b3c 2f61 3e20 2661 6d70 3,3> & │ │ │ │ +0001e350: 3b6d 6174 7269 782c 203c 6120 636c 6173 ;matrix, FieldMatrix │ │ │ │ +0001e390: 266c 743b 4b2c 332c 3326 6774 3b3c 2f61 <K,3,3> &inverse)< │ │ │ │ +0001e3b0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001e400: 3735 303c 2f73 7061 6e3e 2020 2020 7b3c 750 {< │ │ │ │ +0001e410: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001e460: 3735 313c 2f73 7061 6e3e 2020 2020 2020 751 │ │ │ │ +0001e470: 3c73 7061 6e20 636c 6173 733d 226b 6579 using real_type = < │ │ │ │ +0001e4a0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0001e4b0: 6f72 6422 3e74 7970 656e 616d 653c 2f73 ord">typename FieldTraits │ │ │ │ +0001e520: 266c 743b 4b26 6774 3b3a 3a72 6561 6c5f <K>::real_ │ │ │ │ +0001e530: 7479 7065 3c2f 613e 3b3c 2f64 6976 3e0a type;
    . │ │ │ │ +0001e540: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    │ │ │ │ +0001e620: 2020 3735 333c 2f73 7061 6e3e 2020 2020 753 │ │ │ │ +0001e630: 2020 4b20 7434 2020 3d20 6d61 7472 6978 K t4 = matrix │ │ │ │ +0001e640: 5b30 5d5b 305d 202a 206d 6174 7269 785b [0][0] * matrix[ │ │ │ │ +0001e650: 315d 5b31 5d3b 3c2f 6469 763e 0a3c 6469 1][1];
    .< │ │ │ │ +0001e670: 6120 6964 3d22 6c30 3037 3534 2220 6e61 a id="l00754" na │ │ │ │ +0001e680: 6d65 3d22 6c30 3037 3534 223e 3c2f 613e me="l00754"> │ │ │ │ +0001e690: 3c73 7061 6e20 636c 6173 733d 226c 696e 754 K t6 = m │ │ │ │ +0001e6c0: 6174 7269 785b 305d 5b30 5d20 2a20 6d61 atrix[0][0] * ma │ │ │ │ +0001e6d0: 7472 6978 5b31 5d5b 325d 3b3c 2f64 6976 trix[1][2];
    .
    755< │ │ │ │ +0001e730: 2f73 7061 6e3e 2020 2020 2020 4b20 7438 /span> K t8 │ │ │ │ +0001e740: 2020 3d20 6d61 7472 6978 5b30 5d5b 315d = matrix[0][1] │ │ │ │ +0001e750: 202a 206d 6174 7269 785b 315d 5b30 5d3b * matrix[1][0]; │ │ │ │ +0001e760: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001e7b0: 2037 3536 3c2f 7370 616e 3e20 2020 2020 756 │ │ │ │ +0001e7c0: 204b 2074 3130 203d 206d 6174 7269 785b K t10 = matrix[ │ │ │ │ +0001e7d0: 305d 5b32 5d20 2a20 6d61 7472 6978 5b31 0][2] * matrix[1 │ │ │ │ +0001e7e0: 5d5b 305d 3b3c 2f64 6976 3e0a 3c64 6976 ][0];
    .
    < │ │ │ │ +0001e820: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0001e830: 6e6f 223e 2020 3735 373c 2f73 7061 6e3e no"> 757 │ │ │ │ +0001e840: 2020 2020 2020 4b20 7431 3220 3d20 6d61 K t12 = ma │ │ │ │ +0001e850: 7472 6978 5b30 5d5b 315d 202a 206d 6174 trix[0][1] * mat │ │ │ │ +0001e860: 7269 785b 325d 5b30 5d3b 3c2f 6469 763e rix[2][0];
    │ │ │ │ +0001e870: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0001e8a0: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 758 K t14 │ │ │ │ +0001e8d0: 203d 206d 6174 7269 785b 305d 5b32 5d20 = matrix[0][2] │ │ │ │ +0001e8e0: 2a20 6d61 7472 6978 5b32 5d5b 305d 3b3c * matrix[2][0];< │ │ │ │ +0001e8f0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001e940: 3735 393c 2f73 7061 6e3e 203c 2f64 6976 759
    .
    760< │ │ │ │ +0001e9a0: 2f73 7061 6e3e 2020 2020 2020 4b20 6465 /span> K de │ │ │ │ +0001e9b0: 7420 3d20 2874 342a 6d61 7472 6978 5b32 t = (t4*matrix[2 │ │ │ │ +0001e9c0: 5d5b 325d 2d74 362a 6d61 7472 6978 5b32 ][2]-t6*matrix[2 │ │ │ │ +0001e9d0: 5d5b 315d 2d74 382a 6d61 7472 6978 5b32 ][1]-t8*matrix[2 │ │ │ │ +0001e9e0: 5d5b 325d 2b3c 2f64 6976 3e0a 3c64 6976 ][2]+
    .
    < │ │ │ │ +0001ea20: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0001ea30: 6e6f 223e 2020 3736 313c 2f73 7061 6e3e no"> 761 │ │ │ │ +0001ea40: 2020 2020 2020 2020 2020 2020 2020 2074 t │ │ │ │ +0001ea50: 3130 2a6d 6174 7269 785b 325d 5b31 5d2b 10*matrix[2][1]+ │ │ │ │ +0001ea60: 7431 322a 6d61 7472 6978 5b31 5d5b 325d t12*matrix[1][2] │ │ │ │ +0001ea70: 2d74 3134 2a6d 6174 7269 785b 315d 5b31 -t14*matrix[1][1 │ │ │ │ +0001ea80: 5d29 3b3c 2f64 6976 3e0a 3c64 6976 2063 ]);
    .
    762 │ │ │ │ +0001eae0: 2020 2020 4b20 7431 3720 3d20 7265 616c K t17 = real │ │ │ │ +0001eaf0: 5f74 7970 6528 312e 3029 2f64 6574 3b3c _type(1.0)/det;< │ │ │ │ +0001eb00: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001eb50: 3736 333c 2f73 7061 6e3e 203c 2f64 6976 763
    .
    764< │ │ │ │ +0001ebb0: 2f73 7061 6e3e 2020 2020 2020 696e 7665 /span> inve │ │ │ │ +0001ebc0: 7273 655b 305d 5b30 5d20 3d20 2028 6d61 rse[0][0] = (ma │ │ │ │ +0001ebd0: 7472 6978 5b31 5d5b 315d 202a 206d 6174 trix[1][1] * mat │ │ │ │ +0001ebe0: 7269 785b 325d 5b32 5d20 2d20 6d61 7472 rix[2][2] - matr │ │ │ │ +0001ebf0: 6978 5b31 5d5b 325d 202a 206d 6174 7269 ix[1][2] * matri │ │ │ │ +0001ec00: 785b 325d 5b31 5d29 2a74 3137 3b3c 2f64 x[2][1])*t17;.
    76 │ │ │ │ +0001ec60: 353c 2f73 7061 6e3e 2020 2020 2020 696e 5 in │ │ │ │ +0001ec70: 7665 7273 655b 315d 5b30 5d20 3d20 2d28 verse[1][0] = -( │ │ │ │ +0001ec80: 6d61 7472 6978 5b30 5d5b 315d 202a 206d matrix[0][1] * m │ │ │ │ +0001ec90: 6174 7269 785b 325d 5b32 5d20 2d20 6d61 atrix[2][2] - ma │ │ │ │ +0001eca0: 7472 6978 5b30 5d5b 325d 202a 206d 6174 trix[0][2] * mat │ │ │ │ +0001ecb0: 7269 785b 325d 5b31 5d29 2a74 3137 3b3c rix[2][1])*t17;< │ │ │ │ +0001ecc0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001ed10: 3736 363c 2f73 7061 6e3e 2020 2020 2020 766 │ │ │ │ +0001ed20: 696e 7665 7273 655b 325d 5b30 5d20 3d20 inverse[2][0] = │ │ │ │ +0001ed30: 2028 6d61 7472 6978 5b30 5d5b 315d 202a (matrix[0][1] * │ │ │ │ +0001ed40: 206d 6174 7269 785b 315d 5b32 5d20 2d20 matrix[1][2] - │ │ │ │ +0001ed50: 6d61 7472 6978 5b30 5d5b 325d 202a 206d matrix[0][2] * m │ │ │ │ +0001ed60: 6174 7269 785b 315d 5b31 5d29 2a74 3137 atrix[1][1])*t17 │ │ │ │ +0001ed70: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +0001edc0: 2020 3736 373c 2f73 7061 6e3e 2020 2020 767 │ │ │ │ +0001edd0: 2020 696e 7665 7273 655b 305d 5b31 5d20 inverse[0][1] │ │ │ │ +0001ede0: 3d20 2d28 6d61 7472 6978 5b31 5d5b 305d = -(matrix[1][0] │ │ │ │ +0001edf0: 202a 206d 6174 7269 785b 325d 5b32 5d20 * matrix[2][2] │ │ │ │ +0001ee00: 2d20 6d61 7472 6978 5b31 5d5b 325d 202a - matrix[1][2] * │ │ │ │ +0001ee10: 206d 6174 7269 785b 325d 5b30 5d29 2a74 matrix[2][0])*t │ │ │ │ +0001ee20: 3137 3b3c 2f64 6976 3e0a 3c64 6976 2063 17;
    .
    768 │ │ │ │ +0001ee80: 2020 2020 696e 7665 7273 655b 315d 5b31 inverse[1][1 │ │ │ │ +0001ee90: 5d20 3d20 2028 6d61 7472 6978 5b30 5d5b ] = (matrix[0][ │ │ │ │ +0001eea0: 305d 202a 206d 6174 7269 785b 325d 5b32 0] * matrix[2][2 │ │ │ │ +0001eeb0: 5d20 2d20 7431 3429 202a 2074 3137 3b3c ] - t14) * t17;< │ │ │ │ +0001eec0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001ef10: 3736 393c 2f73 7061 6e3e 2020 2020 2020 769 │ │ │ │ +0001ef20: 696e 7665 7273 655b 325d 5b31 5d20 3d20 inverse[2][1] = │ │ │ │ +0001ef30: 2d28 7436 2d74 3130 2920 2a20 7431 373b -(t6-t10) * t17; │ │ │ │ +0001ef40: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001ef90: 2037 3730 3c2f 7370 616e 3e20 2020 2020 770 │ │ │ │ +0001efa0: 2069 6e76 6572 7365 5b30 5d5b 325d 203d inverse[0][2] = │ │ │ │ +0001efb0: 2020 286d 6174 7269 785b 315d 5b30 5d20 (matrix[1][0] │ │ │ │ +0001efc0: 2a20 6d61 7472 6978 5b32 5d5b 315d 202d * matrix[2][1] - │ │ │ │ +0001efd0: 206d 6174 7269 785b 315d 5b31 5d20 2a20 matrix[1][1] * │ │ │ │ +0001efe0: 6d61 7472 6978 5b32 5d5b 305d 2920 2a20 matrix[2][0]) * │ │ │ │ +0001eff0: 7431 373b 3c2f 6469 763e 0a3c 6469 7620 t17;
    .
    771 │ │ │ │ +0001f050: 2020 2020 2069 6e76 6572 7365 5b31 5d5b inverse[1][ │ │ │ │ +0001f060: 325d 203d 202d 286d 6174 7269 785b 305d 2] = -(matrix[0] │ │ │ │ +0001f070: 5b30 5d20 2a20 6d61 7472 6978 5b32 5d5b [0] * matrix[2][ │ │ │ │ +0001f080: 315d 202d 2074 3132 2920 2a20 7431 373b 1] - t12) * t17; │ │ │ │ +0001f090: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001f0e0: 2037 3732 3c2f 7370 616e 3e20 2020 2020 772 │ │ │ │ +0001f0f0: 2069 6e76 6572 7365 5b32 5d5b 325d 203d inverse[2][2] = │ │ │ │ +0001f100: 2020 2874 342d 7438 2920 2a20 7431 373b (t4-t8) * t17; │ │ │ │ +0001f110: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001f160: 2037 3733 3c2f 7370 616e 3e20 3c2f 6469 773 .
    774 │ │ │ │ +0001f1c0: 3c2f 7370 616e 3e20 2020 2020 203c 7370 return det;
    . │ │ │ │ +0001f200: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    . │ │ │ │ +0001f260: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001f2b0: 2037 3736 3c2f 7370 616e 3e20 3c2f 6469 776 .
    778 │ │ │ │ +0001f310: 3c2f 7370 616e 3e20 2020 203c 7370 616e template │ │ │ │ +0001f340: 266c 743b 203c 7370 616e 2063 6c61 7373 < class │ │ │ │ +0001f360: 3c2f 7370 616e 3e20 4b2c 203c 7370 616e K, int │ │ │ │ +0001f390: 6d2c 203c 7370 616e 2063 6c61 7373 3d22 m, int │ │ │ │ +0001f3b0: 3c2f 7370 616e 3e20 6e2c 203c 7370 616e n, int │ │ │ │ +0001f3e0: 7020 2667 743b 3c2f 6469 763e 0a3c 6469 p >
    ..
    │ │ │ │ +0001f4c0: 2020 3737 393c 2f61 3e3c 2f73 7061 6e3e 779 │ │ │ │ +0001f4d0: 2020 2020 3c73 7061 6e20 636c 6173 733d static │ │ │ │ +0001f4f0: 3c2f 7370 616e 3e20 3c73 7061 6e20 636c in │ │ │ │ +0001f510: 6c69 6e65 3c2f 7370 616e 3e20 3c73 7061 line void multMatrix ( const< │ │ │ │ +0001f5c0: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> FieldMatrix&l │ │ │ │ +0001f600: 743b 204b 2c20 6d2c 206e 2026 6774 3b3c t; K, m, n >< │ │ │ │ +0001f610: 2f61 3e20 2661 6d70 3b41 2c3c 2f64 6976 /a> &A,
    .
    780< │ │ │ │ +0001f670: 2f73 7061 6e3e 2020 2020 2020 2020 2020 /span> │ │ │ │ +0001f680: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +0001f690: 2020 2020 2020 2020 2020 3c73 7061 6e20 │ │ │ │ +0001f6b0: 636f 6e73 743c 2f73 7061 6e3e 203c 6120 const FieldMa │ │ │ │ +0001f6f0: 7472 6978 266c 743b 204b 2c20 6e2c 2070 trix< K, n, p │ │ │ │ +0001f700: 2026 6774 3b3c 2f61 3e20 2661 6d70 3b42 > &B │ │ │ │ +0001f710: 2c3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ,
    .
    │ │ │ │ +0001f760: 2020 3738 313c 2f73 7061 6e3e 2020 2020 781 │ │ │ │ +0001f770: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +0001f780: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ +0001f790: 3c61 2063 6c61 7373 3d22 636f 6465 2068 Fiel │ │ │ │ +0001f7c0: 644d 6174 7269 7826 6c74 3b20 4b2c 206d dMatrix< K, m │ │ │ │ +0001f7d0: 2c20 7020 2667 743b 3c2f 613e 2026 616d , p > &am │ │ │ │ +0001f7e0: 703b 7265 7420 293c 2f64 6976 3e0a 3c64 p;ret )
    . │ │ │ │ +0001f800: 3c61 2069 643d 226c 3030 3738 3222 206e 782 {
    . │ │ │ │ +0001f860: 3c61 2069 643d 226c 3030 3738 3322 206e 783 ty │ │ │ │ +0001f8c0: 7065 6465 663c 2f73 7061 6e3e 203c 7370 pedef typename F │ │ │ │ +0001f920: 6965 6c64 4d61 7472 6978 266c 743b 204b ieldMatrix< K │ │ │ │ +0001f930: 2c20 6d2c 2070 2026 6774 3b3c 2f61 3e20 , m, p > │ │ │ │ +0001f940: 3a3a 2073 697a 655f 7479 7065 2073 697a :: size_type siz │ │ │ │ +0001f950: 655f 7479 7065 3b3c 2f64 6976 3e0a 3c64 e_type;
    . │ │ │ │ +0001f970: 3c61 2069 643d 226c 3030 3738 3422 206e 784
    .
    785 │ │ │ │ +0001fa10: 2020 2020 3c73 7061 6e20 636c 6173 733d fo │ │ │ │ +0001fa30: 723c 2f73 7061 6e3e 2820 7369 7a65 5f74 r( size_t │ │ │ │ +0001fa40: 7970 6520 6920 3d20 303b 2069 2026 6c74 ype i = 0; i < │ │ │ │ +0001fa50: 3b20 6d3b 202b 2b69 2029 3c2f 6469 763e ; m; ++i )
    │ │ │ │ +0001fa60: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +0001fa90: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 786 {.
    787 │ │ │ │ +0001fb10: 3c2f 7370 616e 3e20 2020 2020 2020 203c < │ │ │ │ +0001fb20: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +0001fb30: 6f72 6466 6c6f 7722 3e66 6f72 3c2f 7370 ordflow">for( size_type j │ │ │ │ +0001fb50: 203d 2030 3b20 6a20 266c 743b 2070 3b20 = 0; j < p; │ │ │ │ +0001fb60: 2b2b 6a20 293c 2f64 6976 3e0a 3c64 6976 ++j )
    .
    < │ │ │ │ +0001fba0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0001fbb0: 6e6f 223e 2020 3738 383c 2f73 7061 6e3e no"> 788 │ │ │ │ +0001fbc0: 2020 2020 2020 2020 7b3c 2f64 6976 3e0a {
    . │ │ │ │ +0001fbd0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    < │ │ │ │ +0001fc80: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ +0001fc90: 6e6f 223e 2020 3739 303c 2f73 7061 6e3e no"> 790 │ │ │ │ +0001fca0: 2020 2020 2020 2020 2020 3c73 7061 6e20 for( │ │ │ │ +0001fcd0: 7369 7a65 5f74 7970 6520 6b20 3d20 303b size_type k = 0; │ │ │ │ +0001fce0: 206b 2026 6c74 3b20 6e3b 202b 2b6b 2029 k < n; ++k ) │ │ │ │ +0001fcf0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +0001fd40: 2037 3931 3c2f 7370 616e 3e20 2020 2020 791 │ │ │ │ +0001fd50: 2020 2020 2020 2072 6574 5b20 6920 5d5b ret[ i ][ │ │ │ │ +0001fd60: 206a 205d 202b 3d20 415b 2069 205d 5b20 j ] += A[ i ][ │ │ │ │ +0001fd70: 6b20 5d20 2a20 425b 206b 205d 5b20 6a20 k ] * B[ k ][ j │ │ │ │ +0001fd80: 5d3b 3c2f 6469 763e 0a3c 6469 7620 636c ];
    .
    792 │ │ │ │ +0001fde0: 2020 2020 207d 3c2f 6469 763e 0a3c 6469 }
    .< │ │ │ │ +0001fe00: 6120 6964 3d22 6c30 3037 3933 2220 6e61 a id="l00793" na │ │ │ │ +0001fe10: 6d65 3d22 6c30 3037 3933 223e 3c2f 613e me="l00793"> │ │ │ │ +0001fe20: 3c73 7061 6e20 636c 6173 733d 226c 696e 793 }
    .< │ │ │ │ +0001fe50: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ +0001fe60: 3e3c 6120 6964 3d22 6c30 3037 3934 2220 > 794 }
    .< │ │ │ │ +0001feb0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +0001ff00: 3739 353c 2f73 7061 6e3e 203c 2f64 6976 795
    .
    797< │ │ │ │ +0001ff60: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ +0001ff80: 7465 6d70 6c61 7465 3c2f 7370 616e 3e20 template │ │ │ │ +0001ff90: 266c 743b 3c73 7061 6e20 636c 6173 733d <typena │ │ │ │ +0001ffb0: 6d65 3c2f 7370 616e 3e20 4b2c 203c 7370 me K, int rows, int col │ │ │ │ +00020010: 7326 6774 3b3c 2f64 6976 3e0a 3c64 6976 s>
    .
    .
    │ │ │ │ +000200f0: 2037 3938 3c2f 613e 3c2f 7370 616e 3e20 798 │ │ │ │ +00020100: 2020 203c 7370 616e 2063 6c61 7373 3d22 static< │ │ │ │ +00020120: 2f73 7061 6e3e 203c 7370 616e 2063 6c61 /span> inl │ │ │ │ +00020140: 696e 653c 2f73 7061 6e3e 203c 7370 616e ine void │ │ │ │ +00020170: 203c 6120 636c 6173 733d 2263 6f64 6520 multTransposed │ │ │ │ +000201d0: 4d61 7472 6978 3c2f 613e 283c 7370 616e Matrix(const FieldM │ │ │ │ +00020230: 6174 7269 7826 6c74 3b4b 2c72 6f77 732c atrix<K,rows, │ │ │ │ +00020240: 636f 6c73 2667 743b 3c2f 613e 2026 616d cols> &am │ │ │ │ +00020250: 703b 6d61 7472 6978 2c20 3c61 2063 6c61 p;matrix, FieldMatri │ │ │ │ +00020290: 7826 6c74 3b4b 2c63 6f6c 732c 636f 6c73 x<K,cols,cols │ │ │ │ +000202a0: 2667 743b 3c2f 613e 2661 6d70 3b20 7265 >& re │ │ │ │ +000202b0: 7429 3c2f 6469 763e 0a3c 6469 7620 636c t)
    .
    799 │ │ │ │ +00020310: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    .
    800 │ │ │ │ +00020370: 2020 203c 7370 616e 2063 6c61 7373 3d22 typedef │ │ │ │ +00020390: 3c2f 7370 616e 3e20 3c73 7061 6e20 636c ty │ │ │ │ +000203b0: 7065 6e61 6d65 3c2f 7370 616e 3e20 3c61 pename Fi │ │ │ │ +00020410: 656c 644d 6174 7269 7826 6c74 3b4b 2c72 eldMatrix<K,r │ │ │ │ +00020420: 6f77 732c 636f 6c73 2667 743b 3a3a 7369 ows,cols>::si │ │ │ │ +00020430: 7a65 5f74 7970 653c 2f61 3e20 7369 7a65 ze_type size │ │ │ │ +00020440: 5f74 7970 653b 3c2f 6469 763e 0a3c 6469 _type;
    .< │ │ │ │ +00020460: 6120 6964 3d22 6c30 3038 3031 2220 6e61 a id="l00801" na │ │ │ │ +00020470: 6d65 3d22 6c30 3038 3031 223e 3c2f 613e me="l00801"> │ │ │ │ +00020480: 3c73 7061 6e20 636c 6173 733d 226c 696e 801
    .
    802 │ │ │ │ +00020500: 2020 203c 7370 616e 2063 6c61 7373 3d22 for │ │ │ │ +00020520: 3c2f 7370 616e 3e28 7369 7a65 5f74 7970 (size_typ │ │ │ │ +00020530: 6520 693d 303b 2069 266c 743b 636f 6c73 e i=0; i<cols │ │ │ │ +00020540: 3b20 692b 2b29 3c2f 6469 763e 0a3c 6469 ; i++)
    .< │ │ │ │ +00020560: 6120 6964 3d22 6c30 3038 3033 2220 6e61 a id="l00803" na │ │ │ │ +00020570: 6d65 3d22 6c30 3038 3033 223e 3c2f 613e me="l00803"> │ │ │ │ +00020580: 3c73 7061 6e20 636c 6173 733d 226c 696e 803 for(si │ │ │ │ +000205d0: 7a65 5f74 7970 6520 6a3d 303b 206a 266c ze_type j=0; j&l │ │ │ │ +000205e0: 743b 636f 6c73 3b20 6a2b 2b29 3c2f 6469 t;cols; j++).
    804 │ │ │ │ +00020640: 3c2f 7370 616e 3e20 2020 2020 2020 207b { │ │ │ │ +00020650: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000206a0: 2038 3035 3c2f 7370 616e 3e20 2020 2020 805 │ │ │ │ +000206b0: 2020 2020 2072 6574 5b69 5d5b 6a5d 3d30 ret[i][j]=0 │ │ │ │ +000206c0: 2e30 3b3c 2f64 6976 3e0a 3c64 6976 2063 .0;
    .
    806 │ │ │ │ +00020720: 2020 2020 2020 2020 3c73 7061 6e20 636c for(siz │ │ │ │ +00020750: 655f 7479 7065 206b 3d30 3b20 6b26 6c74 e_type k=0; k< │ │ │ │ +00020760: 3b72 6f77 733b 206b 2b2b 293c 2f64 6976 ;rows; k++)
    .
    807< │ │ │ │ +000207c0: 2f73 7061 6e3e 2020 2020 2020 2020 2020 /span> │ │ │ │ +000207d0: 2020 7265 745b 695d 5b6a 5d2b 3d6d 6174 ret[i][j]+=mat │ │ │ │ +000207e0: 7269 785b 6b5d 5b69 5d2a 6d61 7472 6978 rix[k][i]*matrix │ │ │ │ +000207f0: 5b6b 5d5b 6a5d 3b3c 2f64 6976 3e0a 3c64 [k][j];
    . │ │ │ │ +00020810: 3c61 2069 643d 226c 3030 3830 3822 206e 808 }
    .
    809< │ │ │ │ +000208b0: 2f73 7061 6e3e 2020 2020 7d3c 2f64 6976 /span> }
    .
    .
    810 .
    8 │ │ │ │ +00020970: 3131 3c2f 7370 616e 3e20 2020 203c 7370 11 using │ │ │ │ +000209a0: 3c61 2063 6c61 7373 3d22 636f 6465 2068 Dune::DenseMatr │ │ │ │ +00020a00: 6978 4865 6c70 3a3a 6d75 6c74 4173 7369 ixHelp::multAssi │ │ │ │ +00020a10: 676e 3c2f 613e 3b3c 2f64 6976 3e0a 3c64 gn;
    . │ │ │ │ +00020a30: 3c61 2069 643d 226c 3030 3831 3222 206e 812
    .
    814 │ │ │ │ +00020ad0: 2020 3c73 7061 6e20 636c 6173 733d 226b template │ │ │ │ +00020af0: 3c2f 7370 616e 3e20 266c 743b 3c73 7061 <typename K, i │ │ │ │ +00020b40: 6e74 3c2f 7370 616e 3e20 726f 7773 2c20 nt rows, │ │ │ │ +00020b50: 3c73 7061 6e20 636c 6173 733d 226b 6579 int cols>.
    .
    815 │ │ │ │ +00020c60: 3c2f 7370 616e 3e20 2020 203c 7370 616e static < │ │ │ │ +00020c90: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00020ca0: 6f72 6422 3e69 6e6c 696e 653c 2f73 7061 ord">inline voi │ │ │ │ +00020cd0: 643c 2f73 7061 6e3e 203c 6120 636c 6173 d multAs │ │ │ │ +00020d30: 7369 676e 5472 616e 7370 6f73 6564 3c2f signTransposed( const< │ │ │ │ +00020d60: 2f73 7061 6e3e 203c 6120 636c 6173 733d /span> FieldMatrix&l │ │ │ │ +00020da0: 743b 4b2c 726f 7773 2c63 6f6c 7326 6774 t;K,rows,cols> │ │ │ │ +00020db0: 3b3c 2f61 3e20 2661 6d70 3b6d 6174 7269 ; &matri │ │ │ │ +00020dc0: 782c 203c 7370 616e 2063 6c61 7373 3d22 x, const FieldVector< │ │ │ │ +00020e20: 3b4b 2c72 6f77 7326 6774 3b3c 2f61 3e20 ;K,rows> │ │ │ │ +00020e30: 2661 6d70 3b20 782c 203c 6120 636c 6173 & x, FieldVector │ │ │ │ +00020e70: 266c 743b 4b2c 636f 6c73 2667 743b 3c2f <K,cols> & ret).
    81 │ │ │ │ +00020ee0: 363c 2f73 7061 6e3e 2020 2020 7b3c 2f64 6 {.
    81 │ │ │ │ +00020f40: 373c 2f73 7061 6e3e 2020 2020 2020 3c73 7 typedef typenam │ │ │ │ +00020f90: 653c 2f73 7061 6e3e 203c 6120 636c 6173 e FieldMa │ │ │ │ +00020ff0: 7472 6978 266c 743b 4b2c 726f 7773 2c63 trix<K,rows,c │ │ │ │ +00021000: 6f6c 7326 6774 3b3a 3a73 697a 655f 7479 ols>::size_ty │ │ │ │ +00021010: 7065 3c2f 613e 2073 697a 655f 7479 7065 pe size_type │ │ │ │ +00021020: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +00021070: 2020 3831 383c 2f73 7061 6e3e 203c 2f64 818 .
    81 │ │ │ │ +000210d0: 393c 2f73 7061 6e3e 2020 2020 2020 3c73 9 for(size_type i=0 │ │ │ │ +00021110: 3b20 6926 6c74 3b63 6f6c 733b 202b 2b69 ; i<cols; ++i │ │ │ │ +00021120: 293c 2f64 6976 3e0a 3c64 6976 2063 6c61 )
    .
    │ │ │ │ +00021170: 2020 3832 303c 2f73 7061 6e3e 2020 2020 820 │ │ │ │ +00021180: 2020 7b3c 2f64 6976 3e0a 3c64 6976 2063 {
    .
    821 │ │ │ │ +000211e0: 2020 2020 2020 7265 745b 695d 203d 2030 ret[i] = 0 │ │ │ │ +000211f0: 2e30 3b3c 2f64 6976 3e0a 3c64 6976 2063 .0;
    .
    822 │ │ │ │ +00021250: 2020 2020 2020 3c73 7061 6e20 636c 6173 │ │ │ │ +00021270: 666f 723c 2f73 7061 6e3e 2873 697a 655f for(size_ │ │ │ │ +00021280: 7479 7065 206a 3d30 3b20 6a26 6c74 3b72 type j=0; j<r │ │ │ │ +00021290: 6f77 733b 202b 2b6a 293c 2f64 6976 3e0a ows; ++j)
    . │ │ │ │ +000212a0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    │ │ │ │ +00021320: 0a3c 6469 7620 636c 6173 733d 226c 696e .
    │ │ │ │ +00021350: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 824 }.
    825 │ │ │ │ +000213d0: 3c2f 7370 616e 3e20 2020 207d 3c2f 6469 }.
    .
    826 < │ │ │ │ +00021440: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00021490: 3832 383c 2f73 7061 6e3e 2020 2020 3c73 828 template <ty │ │ │ │ +000214e0: 7065 6e61 6d65 3c2f 7370 616e 3e20 4b2c pename K, │ │ │ │ +000214f0: 203c 7370 616e 2063 6c61 7373 3d22 6b65 int rows, int │ │ │ │ +00021540: 2063 6f6c 7326 6774 3b3c 2f64 6976 3e0a cols>
    . │ │ │ │ +00021550: 3c64 6976 2063 6c61 7373 3d22 666f 6c64
    .
    829 sta │ │ │ │ +00021650: 7469 633c 2f73 7061 6e3e 203c 7370 616e tic inline < │ │ │ │ +00021680: 6120 636c 6173 733d 2263 6f64 6520 686c a class="code hl │ │ │ │ +00021690: 5f63 6c61 7373 2220 6872 6566 3d22 6130 _class" href="a0 │ │ │ │ +000216a0: 3134 3132 2e68 746d 6c22 3e46 6965 6c64 1412.html">Field │ │ │ │ +000216b0: 5665 6374 6f72 266c 743b 4b2c 726f 7773 Vector<K,rows │ │ │ │ +000216c0: 2667 743b 3c2f 613e 203c 6120 636c 6173 > mult(const FieldMatrix< │ │ │ │ +00021780: 3b4b 2c72 6f77 732c 636f 6c73 2667 743b ;K,rows,cols> │ │ │ │ +00021790: 3c2f 613e 2026 616d 703b 6d61 7472 6978 &matrix │ │ │ │ +000217a0: 2c20 3c73 7061 6e20 636c 6173 733d 226b , const FieldVector< │ │ │ │ +00021800: 4b2c 636f 6c73 2667 743b 3c2f 613e 2026 K,cols> & │ │ │ │ +00021810: 616d 703b 2078 293c 2f64 6976 3e0a 3c64 amp; x)
    . │ │ │ │ +00021830: 3c61 2069 643d 226c 3030 3833 3022 206e 830 {
    . │ │ │ │ +00021890: 3c61 2069 643d 226c 3030 3833 3122 206e 831 FieldVector& │ │ │ │ +00021910: 6c74 3b4b 2c72 6f77 7326 6774 3b3c 2f61 lt;K,rows> ret;
    .< │ │ │ │ +00021940: 6120 6964 3d22 6c30 3038 3332 2220 6e61 a id="l00832" na │ │ │ │ +00021950: 6d65 3d22 6c30 3038 3332 223e 3c2f 613e me="l00832"> │ │ │ │ +00021960: 3c73 7061 6e20 636c 6173 733d 226c 696e 832 multAssig │ │ │ │ +00021990: 6e28 6d61 7472 6978 2c78 2c72 6574 293b n(matrix,x,ret); │ │ │ │ +000219a0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +000219f0: 2038 3333 3c2f 7370 616e 3e20 2020 2020 833 │ │ │ │ +00021a00: 203c 7370 616e 2063 6c61 7373 3d22 6b65 retur │ │ │ │ +00021a20: 6e3c 2f73 7061 6e3e 2072 6574 3b3c 2f64 n ret;.
    83 │ │ │ │ +00021a80: 343c 2f73 7061 6e3e 2020 2020 7d3c 2f64 4 }.
    .
    835 │ │ │ │ +00021af0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    │ │ │ │ +00021b40: 2038 3337 3c2f 7370 616e 3e20 2020 203c 837 < │ │ │ │ +00021b50: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00021b60: 6f72 6422 3e74 656d 706c 6174 653c 2f73 ord">template <t │ │ │ │ +00021b90: 7970 656e 616d 653c 2f73 7061 6e3e 204b ypename K │ │ │ │ +00021ba0: 2c20 3c73 7061 6e20 636c 6173 733d 226b , int< │ │ │ │ +00021bc0: 2f73 7061 6e3e 2072 6f77 732c 203c 7370 /span> rows, int cols>
    │ │ │ │ +00021c00: 0a3c 6469 7620 636c 6173 733d 2266 6f6c .
    .
    < │ │ │ │ +00021c90: 6120 636c 6173 733d 226c 696e 6522 2068 a class="line" h │ │ │ │ +00021ca0: 7265 663d 2261 3030 3433 362e 6874 6d6c ref="a00436.html │ │ │ │ +00021cb0: 2361 3635 3937 3633 6262 6564 3437 6439 #a659763bbed47d9 │ │ │ │ +00021cc0: 3362 3061 3033 6439 6463 3264 3439 6336 3b0a03d9dc2d49c6 │ │ │ │ +00021cd0: 6630 223e 2020 3833 383c 2f61 3e3c 2f73 f0"> 838 st │ │ │ │ +00021d00: 6174 6963 3c2f 7370 616e 3e20 3c73 7061 atic inline │ │ │ │ +00021d30: 3c61 2063 6c61 7373 3d22 636f 6465 2068 Fiel │ │ │ │ +00021d60: 6456 6563 746f 7226 6c74 3b4b 2c63 6f6c dVector<K,col │ │ │ │ +00021d70: 7326 6774 3b3c 2f61 3e20 3c61 2063 6c61 s> multT │ │ │ │ +00021dd0: 7261 6e73 706f 7365 643c 2f61 3e28 3c73 ransposed(const │ │ │ │ +00021e00: 203c 6120 636c 6173 733d 2263 6f64 6520 Fie │ │ │ │ +00021e30: 6c64 4d61 7472 6978 266c 743b 4b2c 726f ldMatrix<K,ro │ │ │ │ +00021e40: 7773 2c63 6f6c 7326 6774 3b3c 2f61 3e20 ws,cols> │ │ │ │ +00021e50: 2661 6d70 3b6d 6174 7269 782c 203c 7370 &matrix, const │ │ │ │ +00021e80: 3c61 2063 6c61 7373 3d22 636f 6465 2068 Fiel │ │ │ │ +00021eb0: 6456 6563 746f 7226 6c74 3b4b 2c72 6f77 dVector<K,row │ │ │ │ +00021ec0: 7326 6774 3b3c 2f61 3e20 2661 6d70 3b20 s> & │ │ │ │ +00021ed0: 7829 3c2f 6469 763e 0a3c 6469 7620 636c x)
    .
    839 │ │ │ │ +00021f30: 207b 3c2f 6469 763e 0a3c 6469 7620 636c {
    .
    840 │ │ │ │ +00021f90: 2020 203c 6120 636c 6173 733d 2263 6f64 F │ │ │ │ +00021fc0: 6965 6c64 5665 6374 6f72 266c 743b 4b2c ieldVector<K, │ │ │ │ +00021fd0: 636f 6c73 2667 743b 3c2f 613e 2072 6574 cols> ret │ │ │ │ +00021fe0: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
    .
    │ │ │ │ +00022030: 2020 3834 313c 2f73 7061 6e3e 2020 2020 841 │ │ │ │ +00022040: 2020 3c61 2063 6c61 7373 3d22 636f 6465 multAssignTra │ │ │ │ +000220a0: 6e73 706f 7365 643c 2f61 3e28 206d 6174 nsposed( mat │ │ │ │ +000220b0: 7269 782c 2078 2c20 7265 7420 293b 3c2f rix, x, ret );.
    8 │ │ │ │ +00022110: 3432 3c2f 7370 616e 3e20 2020 2020 203c 42 < │ │ │ │ +00022120: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ +00022130: 6f72 6466 6c6f 7722 3e72 6574 7572 6e3c ordflow">return< │ │ │ │ +00022140: 2f73 7061 6e3e 2072 6574 3b3c 2f64 6976 /span> ret;
    .
    843< │ │ │ │ +000221a0: 2f73 7061 6e3e 2020 2020 7d3c 2f64 6976 /span> }
    .
    .
    844 .
    8 │ │ │ │ +00022260: 3435 3c2f 7370 616e 3e20 207d 203c 7370 45 } // end namesp │ │ │ │ +00022290: 6163 6520 464d 6174 7269 7848 656c 703c ace FMatrixHelp< │ │ │ │ +000222a0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 2f64 /span>
    ..
    84 │ │ │ │ +00022300: 363c 2f73 7061 6e3e 203c 2f64 6976 3e0a 6
    . │ │ │ │ +00022310: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
    .
    850 < │ │ │ │ +000223f0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    │ │ │ │ +00022440: 3835 313c 2f73 7061 6e3e 3c73 7061 6e20 851#include &q │ │ │ │ +00022470: 756f 743b 3c61 2063 6c61 7373 3d22 636f uot;fmatrixev │ │ │ │ +000224a0: 2e68 683c 2f61 3e26 7175 6f74 3b3c 2f73 .hh"
    .
    852< │ │ │ │ +00022510: 7370 616e 2063 6c61 7373 3d22 7072 6570 span class="prep │ │ │ │ +00022520: 726f 6365 7373 6f72 223e 2365 6e64 6966 rocessor">#endif │ │ │ │ +00022530: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .
    matri │ │ │ │ +00022590: 7863 6f6e 6365 7074 732e 6868 3c2f 613e xconcepts.hh │ │ │ │ +000225a0: 3c2f 6469 763e 3c2f 6469 763e 0a3c 6469
    . │ │ │ │ +000225d0: 3c64 6976 2063 6c61 7373 3d22 7474 6e61
    densem │ │ │ │ +00022600: 6174 7269 782e 6868 3c2f 613e 3c2f 6469 atrix.hh
    Implements │ │ │ │ +00022630: 6120 6d61 7472 6978 2063 6f6e 7374 7275 a matrix constru │ │ │ │ +00022640: 6374 6564 2066 726f 6d20 6120 6769 7665 cted from a give │ │ │ │ +00022650: 6e20 7479 7065 2072 6570 7265 7365 6e74 n type represent │ │ │ │ +00022660: 696e 6720 6120 6669 656c 6420 616e 6420 ing a field and │ │ │ │ +00022670: 6120 636f 6d70 696c 652d 7469 6d65 2067 a compile-time g │ │ │ │ +00022680: 6976 656e 206e 756d 6265 2e2e 2e3c 2f64 iven numbe...
    .
    boundsche │ │ │ │ +000226f0: 636b 696e 672e 6868 3c2f 613e 3c2f 6469 cking.hh
    Macro for w │ │ │ │ +00022720: 7261 7070 696e 6720 626f 756e 6461 7279 rapping boundary │ │ │ │ +00022730: 2063 6865 636b 732e 3c2f 6469 763e 3c2f checks.
    .
    fvector.hh │ │ │ │ +000227a0: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    Impleme │ │ │ │ +000227c0: 6e74 7320 6120 7665 6374 6f72 2063 6f6e nts a vector con │ │ │ │ +000227d0: 7374 7275 6374 6564 2066 726f 6d20 6120 structed from a │ │ │ │ +000227e0: 6769 7665 6e20 7479 7065 2072 6570 7265 given type repre │ │ │ │ +000227f0: 7365 6e74 696e 6720 6120 6669 656c 6420 senting a field │ │ │ │ +00022800: 616e 6420 6120 636f 6d70 696c 652d 7469 and a compile-ti │ │ │ │ +00022810: 6d65 2067 6976 656e 2073 697a 652e 3c2f me given size.
    .Eigenvalue comp │ │ │ │ +000228b0: 7574 6174 696f 6e73 2066 6f72 2074 6865 utations for the │ │ │ │ +000228c0: 2046 6965 6c64 4d61 7472 6978 2063 6c61 FieldMatrix cla │ │ │ │ +000228d0: 7373 2e3c 2f64 6976 3e3c 2f64 6976 3e0a ss.
    . │ │ │ │ +000228e0: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    typ │ │ │ │ +00022930: 6574 7261 6974 732e 6868 3c2f 613e 3c2f etraits.hh
    Traits fo │ │ │ │ +00022960: 7220 7479 7065 2063 6f6e 7665 7273 696f r type conversio │ │ │ │ +00022970: 6e73 2061 6e64 2074 7970 6520 696e 666f ns and type info │ │ │ │ +00022980: 726d 6174 696f 6e2e 3c2f 6469 763e 3c2f rmation.
    .
    Compute type of │ │ │ │ +00022a20: 2074 6865 2072 6573 756c 7420 6f66 2061 the result of a │ │ │ │ +00022a30: 6e20 6172 6974 686d 6574 6963 206f 7065 n arithmetic ope │ │ │ │ +00022a40: 7261 7469 6f6e 2069 6e76 6f6c 7669 6e67 ration involving │ │ │ │ +00022a50: 2074 776f 2064 6966 6665 7265 6e74 206e two different n │ │ │ │ +00022a60: 756d 6265 7220 7479 7065 732e 3c2f 6469 umber types.
    .
    │ │ │ │ +00022ab0: 3c61 2068 7265 663d 2261 3030 3331 342e precision. │ │ │ │ +00022ad0: 6868 3c2f 613e 3c2f 6469 763e 3c64 6976 hh
    V │ │ │ │ +00022af0: 6172 696f 7573 2070 7265 6369 7369 6f6e arious precision │ │ │ │ +00022b00: 2073 6574 7469 6e67 7320 666f 7220 6361 settings for ca │ │ │ │ +00022b10: 6c63 756c 6174 696f 6e73 2077 6974 6820 lculations with │ │ │ │ +00022b20: 4669 656c 644d 6174 7269 7820 616e 6420 FieldMatrix and │ │ │ │ +00022b30: 4669 656c 6456 6563 746f 722e 3c2f 6469 FieldVector.
    .
    │ │ │ │ +00022b80: 3c61 2068 7265 663d 2261 3030 3334 372e exceptions │ │ │ │ +00022ba0: 2e68 683c 2f61 3e3c 2f64 6976 3e3c 6469 .hh
    │ │ │ │ +00022bc0: 4120 6665 7720 636f 6d6d 6f6e 2065 7863 A few common exc │ │ │ │ +00022bd0: 6570 7469 6f6e 2063 6c61 7373 6573 2e3c eption classes.< │ │ │ │ +00022be0: 2f64 6976 3e3c 2f64 6976 3e0a 3c64 6976 /div>
    .
    # │ │ │ │ +00022cb0: 6465 6669 6e65 2044 554e 455f 4153 5345 define DUNE_ASSE │ │ │ │ +00022cc0: 5254 5f42 4f55 4e44 5328 636f 6e64 293c RT_BOUNDS(cond)< │ │ │ │ +00022cd0: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    If DUNE_ │ │ │ │ +00022cf0: 4348 4543 4b5f 424f 554e 4453 2069 7320 CHECK_BOUNDS is │ │ │ │ +00022d00: 6465 6669 6e65 643a 2063 6865 636b 2069 defined: check i │ │ │ │ +00022d10: 6620 636f 6e64 6974 696f 6e20 636f 6e64 f condition cond │ │ │ │ +00022d20: 2068 6f6c 6473 3b20 6f74 6865 7277 6973 holds; otherwis │ │ │ │ +00022d30: 652c 2064 6f20 6e6f 7468 696e 672e 3c2f e, do nothing.
    Defini │ │ │ │ +00022d60: 7469 6f6e 3c2f 623e 2062 6f75 6e64 7363 tion boundsc │ │ │ │ +00022d70: 6865 636b 696e 672e 6868 3a33 303c 2f64 hecking.hh:30
    .
    │ │ │ │ +00022dd0: 3c64 6976 2063 6c61 7373 3d22 7474 6e61 std::ostream &a │ │ │ │ +00022e60: 6d70 3b20 6f70 6572 6174 6f72 266c 743b mp; operator< │ │ │ │ +00022e70: 266c 743b 2873 7464 3a3a 6f73 7472 6561 <(std::ostrea │ │ │ │ +00022e80: 6d20 2661 6d70 3b73 2c20 636f 6e73 7420 m &s, const │ │ │ │ +00022e90: 6269 6775 6e73 6967 6e65 6469 6e74 266c bigunsignedint&l │ │ │ │ +00022ea0: 743b 206b 2026 6774 3b20 2661 6d70 3b78 t; k > &x │ │ │ │ +00022eb0: 293c 2f64 6976 3e3c 6469 7620 636c 6173 )
    Def │ │ │ │ +00022ed0: 696e 6974 696f 6e3c 2f62 3e20 6269 6775 inition bigu │ │ │ │ +00022ee0: 6e73 6967 6e65 6469 6e74 2e68 683a 3237 nsignedint.hh:27 │ │ │ │ +00022ef0: 383c 2f64 6976 3e3c 2f64 6976 3e0a 3c64 8
    .typename Overlo │ │ │ │ +00022fd0: 6164 733a 3a53 6361 6c61 7254 7970 6526 ads::ScalarType& │ │ │ │ +00022fe0: 6c74 3b20 7374 643a 3a64 6563 6179 5f74 lt; std::decay_t │ │ │ │ +00022ff0: 266c 743b 2056 2026 6774 3b20 2667 743b < V > > │ │ │ │ +00023000: 3a3a 7479 7065 2053 6361 6c61 723c 2f64 ::type Scalar
    Element ty │ │ │ │ +00023030: 7065 206f 6620 736f 6d65 2053 494d 4420 pe of some SIMD │ │ │ │ +00023040: 7479 7065 2e3c 2f64 6976 3e3c 6469 7620 type.
    Definition │ │ │ │ +00023070: 7369 6d64 2f69 6e74 6572 6661 6365 2e68 simd/interface.h │ │ │ │ +00023080: 683a 3233 353c 2f64 6976 3e3c 2f64 6976 h:235
    .
    │ │ │ │ +00023100: 4475 6e65 206e 616d 6573 7061 6365 2e3c Dune namespace.< │ │ │ │ +00023110: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ +00023130: 6974 696f 6e3c 2f62 3e20 616c 6967 6e65 ition aligne │ │ │ │ +00023140: 6461 6c6c 6f63 6174 6f72 2e68 683a 3133 dallocator.hh:13 │ │ │ │ +00023150: 3c2f 6469 763e 3c2f 6469 763e 0a3c 6469
    . │ │ │ │ +000232d0: 6361 6c63 756c 6174 6573 2072 6574 203d calculates ret = │ │ │ │ +000232e0: 206d 6174 7269 7820 2a20 783c 2f64 6976 matrix * x
    < │ │ │ │ +00023330: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    < │ │ │ │ +00023390: 6120 6872 6566 3d22 6130 3034 3336 2e68 a href="a00436.h │ │ │ │ +000233a0: 746d 6c23 6136 3539 3736 3362 6265 6434 tml#a659763bbed4 │ │ │ │ +000233b0: 3764 3933 6230 6130 3364 3964 6332 6434 7d93b0a03d9dc2d4 │ │ │ │ +000233c0: 3963 3666 3022 3e44 756e 653a 3a46 4d61 9c6f0">Dune::FMa │ │ │ │ +000233d0: 7472 6978 4865 6c70 3a3a 6d75 6c74 5472 trixHelp::multTr │ │ │ │ +000233e0: 616e 7370 6f73 6564 3c2f 613e 3c2f 6469 ansposed
    static Fie │ │ │ │ +00023410: 6c64 5665 6374 6f72 266c 743b 204b 2c20 ldVector< K, │ │ │ │ +00023420: 636f 6c73 2026 6774 3b20 6d75 6c74 5472 cols > multTr │ │ │ │ +00023430: 616e 7370 6f73 6564 2863 6f6e 7374 2046 ansposed(const F │ │ │ │ +00023440: 6965 6c64 4d61 7472 6978 266c 743b 204b ieldMatrix< K │ │ │ │ +00023450: 2c20 726f 7773 2c20 636f 6c73 2026 6774 , rows, cols > │ │ │ │ +00023460: 3b20 2661 6d70 3b6d 6174 7269 782c 2063 ; &matrix, c │ │ │ │ +00023470: 6f6e 7374 2046 6965 6c64 5665 6374 6f72 onst FieldVector │ │ │ │ +00023480: 266c 743b 204b 2c20 726f 7773 2026 6774 < K, rows > │ │ │ │ +00023490: 3b20 2661 6d70 3b78 293c 2f64 6976 3e3c ; &x)
    < │ │ │ │ +000234a0: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ +000234b0: 223e 6361 6c63 756c 6174 6573 2072 6574 ">calculates ret │ │ │ │ +000234c0: 203d 206d 6174 7269 785e 5420 2a20 783c = matrix^T * x< │ │ │ │ +000234d0: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ +000234f0: 6974 696f 6e3c 2f62 3e20 666d 6174 7269 ition fmatri │ │ │ │ +00023500: 782e 6868 3a38 3338 3c2f 6469 763e 3c2f x.hh:838
    .
    static K invert │ │ │ │ +00023600: 4d61 7472 6978 5f72 6574 5472 616e 7370 Matrix_retTransp │ │ │ │ +00023610: 6f73 6564 2863 6f6e 7374 2046 6965 6c64 osed(const Field │ │ │ │ +00023620: 4d61 7472 6978 266c 743b 204b 2c20 312c Matrix< K, 1, │ │ │ │ +00023630: 2031 2026 6774 3b20 2661 6d70 3b6d 6174 1 > &mat │ │ │ │ +00023640: 7269 782c 2046 6965 6c64 4d61 7472 6978 rix, FieldMatrix │ │ │ │ +00023650: 266c 743b 204b 2c20 312c 2031 2026 6774 < K, 1, 1 > │ │ │ │ +00023660: 3b20 2661 6d70 3b69 6e76 6572 7365 293c ; &inverse)< │ │ │ │ +00023670: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    invert s │ │ │ │ +00023690: 6361 6c61 7220 7769 7468 6f75 7420 6368 calar without ch │ │ │ │ +000236a0: 616e 6769 6e67 2074 6865 206f 7269 6769 anging the origi │ │ │ │ +000236b0: 6e61 6c20 6d61 7472 6978 3c2f 6469 763e nal matrix
    │ │ │ │ +000236c0: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    Definition │ │ │ │ +000236e0: 3c2f 623e 2066 6d61 7472 6978 2e68 683a fmatrix.hh: │ │ │ │ +000236f0: 3638 303c 2f64 6976 3e3c 2f64 6976 3e0a 680
    . │ │ │ │ +00023700: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    stat │ │ │ │ +000237d0: 6963 2076 6f69 6420 6d75 6c74 4d61 7472 ic void multMatr │ │ │ │ +000237e0: 6978 2863 6f6e 7374 2046 6965 6c64 4d61 ix(const FieldMa │ │ │ │ +000237f0: 7472 6978 266c 743b 204b 2c20 6d2c 206e trix< K, m, n │ │ │ │ +00023800: 2026 6774 3b20 2661 6d70 3b41 2c20 636f > &A, co │ │ │ │ +00023810: 6e73 7420 4669 656c 644d 6174 7269 7826 nst FieldMatrix& │ │ │ │ +00023820: 6c74 3b20 4b2c 206e 2c20 7020 2667 743b lt; K, n, p > │ │ │ │ +00023830: 2026 616d 703b 422c 2046 6965 6c64 4d61 &B, FieldMa │ │ │ │ +00023840: 7472 6978 266c 743b 204b 2c20 6d2c 2070 trix< K, m, p │ │ │ │ +00023850: 2026 6774 3b20 2661 6d70 3b72 6574 293c > &ret)< │ │ │ │ +00023860: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    calculat │ │ │ │ +00023880: 6573 2072 6574 203d 2041 202a 2042 3c2f es ret = A * B
    Defini │ │ │ │ +000238b0: 7469 6f6e 3c2f 623e 2066 6d61 7472 6978 tion fmatrix │ │ │ │ +000238c0: 2e68 683a 3737 393c 2f64 6976 3e3c 2f64 .hh:779
    .
    static K inver │ │ │ │ +000239b0: 744d 6174 7269 7828 636f 6e73 7420 4669 tMatrix(const Fi │ │ │ │ +000239c0: 656c 644d 6174 7269 7826 6c74 3b20 4b2c eldMatrix< K, │ │ │ │ +000239d0: 2031 2c20 3120 2667 743b 2026 616d 703b 1, 1 > & │ │ │ │ +000239e0: 6d61 7472 6978 2c20 4669 656c 644d 6174 matrix, FieldMat │ │ │ │ +000239f0: 7269 7826 6c74 3b20 4b2c 2031 2c20 3120 rix< K, 1, 1 │ │ │ │ +00023a00: 2667 743b 2026 616d 703b 696e 7665 7273 > &invers │ │ │ │ +00023a10: 6529 3c2f 6469 763e 3c64 6976 2063 6c61 e)
    inver │ │ │ │ +00023a30: 7420 7363 616c 6172 2077 6974 686f 7574 t scalar without │ │ │ │ +00023a40: 2063 6861 6e67 696e 6720 7468 6520 6f72 changing the or │ │ │ │ +00023a50: 6967 696e 616c 206d 6174 7269 783c 2f64 iginal matrix
    Definit │ │ │ │ +00023a80: 696f 6e3c 2f62 3e20 666d 6174 7269 782e ion fmatrix. │ │ │ │ +00023a90: 6868 3a36 3731 3c2f 6469 763e 3c2f 6469 hh:671
    .
    Dune::FMatri │ │ │ │ +00023b40: 7848 656c 703a 3a6d 756c 743c 2f61 3e3c xHelp::mult< │ │ │ │ +00023b50: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    static │ │ │ │ +00023b70: 4669 656c 6456 6563 746f 7226 6c74 3b20 FieldVector< │ │ │ │ +00023b80: 4b2c 2072 6f77 7320 2667 743b 206d 756c K, rows > mul │ │ │ │ +00023b90: 7428 636f 6e73 7420 4669 656c 644d 6174 t(const FieldMat │ │ │ │ +00023ba0: 7269 7826 6c74 3b20 4b2c 2072 6f77 732c rix< K, rows, │ │ │ │ +00023bb0: 2063 6f6c 7320 2667 743b 2026 616d 703b cols > & │ │ │ │ +00023bc0: 6d61 7472 6978 2c20 636f 6e73 7420 4669 matrix, const Fi │ │ │ │ +00023bd0: 656c 6456 6563 746f 7226 6c74 3b20 4b2c eldVector< K, │ │ │ │ +00023be0: 2063 6f6c 7320 2667 743b 2026 616d 703b cols > & │ │ │ │ +00023bf0: 7829 3c2f 6469 763e 3c64 6976 2063 6c61 x)
    calcu │ │ │ │ +00023c10: 6c61 7465 7320 7265 7420 3d20 6d61 7472 lates ret = matr │ │ │ │ +00023c20: 6978 202a 2078 3c2f 6469 763e 3c64 6976 ix * x
    < │ │ │ │ +00023c40: 623e 4465 6669 6e69 7469 6f6e 3c2f 623e b>Definition │ │ │ │ +00023c50: 2066 6d61 7472 6978 2e68 683a 3832 393c fmatrix.hh:829< │ │ │ │ +00023c60: 2f64 6976 3e3c 2f64 6976 3e0a 3c64 6976 /div>
    .
    static void mu │ │ │ │ +00023d50: 6c74 5472 616e 7370 6f73 6564 4d61 7472 ltTransposedMatr │ │ │ │ +00023d60: 6978 2863 6f6e 7374 2046 6965 6c64 4d61 ix(const FieldMa │ │ │ │ +00023d70: 7472 6978 266c 743b 204b 2c20 726f 7773 trix< K, rows │ │ │ │ +00023d80: 2c20 636f 6c73 2026 6774 3b20 2661 6d70 , cols > & │ │ │ │ +00023d90: 3b6d 6174 7269 782c 2046 6965 6c64 4d61 ;matrix, FieldMa │ │ │ │ +00023da0: 7472 6978 266c 743b 204b 2c20 636f 6c73 trix< K, cols │ │ │ │ +00023db0: 2c20 636f 6c73 2026 6774 3b20 2661 6d70 , cols > & │ │ │ │ +00023dc0: 3b72 6574 293c 2f64 6976 3e3c 6469 7620 ;ret)
    ca │ │ │ │ +00023de0: 6c63 756c 6174 6573 2072 6574 3d20 415f lculates ret= A_ │ │ │ │ +00023df0: 742a 413c 2f64 6976 3e3c 6469 7620 636c t*A
    D │ │ │ │ +00023e10: 6566 696e 6974 696f 6e3c 2f62 3e20 666d efinition fm │ │ │ │ +00023e20: 6174 7269 782e 6868 3a37 3938 3c2f 6469 atrix.hh:798
    .
    s │ │ │ │ +00023f10: 7461 7469 6320 766f 6964 206d 756c 7441 tatic void multA │ │ │ │ +00023f20: 7373 6967 6e54 7261 6e73 706f 7365 6428 ssignTransposed( │ │ │ │ +00023f30: 636f 6e73 7420 4669 656c 644d 6174 7269 const FieldMatri │ │ │ │ +00023f40: 7826 6c74 3b20 4b2c 2072 6f77 732c 2063 x< K, rows, c │ │ │ │ +00023f50: 6f6c 7320 2667 743b 2026 616d 703b 6d61 ols > &ma │ │ │ │ +00023f60: 7472 6978 2c20 636f 6e73 7420 4669 656c trix, const Fiel │ │ │ │ +00023f70: 6456 6563 746f 7226 6c74 3b20 4b2c 2072 dVector< K, r │ │ │ │ +00023f80: 6f77 7320 2667 743b 2026 616d 703b 782c ows > &x, │ │ │ │ +00023f90: 2046 6965 6c64 5665 6374 6f72 266c 743b FieldVector< │ │ │ │ +00023fa0: 204b 2c20 636f 6c73 2026 6774 3b20 2661 K, cols > &a │ │ │ │ +00023fb0: 6d70 3b72 6574 293c 2f64 6976 3e3c 6469 mp;ret)
    │ │ │ │ +00023fd0: 6361 6c63 756c 6174 6573 2072 6574 203d calculates ret = │ │ │ │ +00023fe0: 206d 6174 7269 785e 5420 2a20 783c 2f64 matrix^T * x
    Definit │ │ │ │ +00024010: 696f 6e3c 2f62 3e20 666d 6174 7269 782e ion fmatrix. │ │ │ │ +00024020: 6868 3a38 3135 3c2f 6469 763e 3c2f 6469 hh:815
    .
    A │ │ │ │ +000240b0: 6465 6e73 6520 6e20 7820 6d20 6d61 7472 dense n x m matr │ │ │ │ +000240c0: 6978 2e3c 2f64 6976 3e3c 6469 7620 636c ix.
    D │ │ │ │ +000240e0: 6566 696e 6974 696f 6e3c 2f62 3e20 6465 efinition de │ │ │ │ +000240f0: 6e73 656d 6174 7269 782e 6868 3a31 3430 nsematrix.hh:140 │ │ │ │ +00024100: 3c2f 6469 763e 3c2f 6469 763e 0a3c 6469
    .void mtv(const │ │ │ │ +000241e0: 2058 2026 616d 703b 782c 2059 2026 616d X &x, Y &am │ │ │ │ +000241f0: 703b 7929 2063 6f6e 7374 3c2f 6469 763e p;y) const
    │ │ │ │ +00024200: 3c64 6976 2063 6c61 7373 3d22 7474 646f
    y = A^T x
    Definiti │ │ │ │ +00024240: 6f6e 3c2f 623e 2064 656e 7365 6d61 7472 on densematr │ │ │ │ +00024250: 6978 2e68 683a 3338 373c 2f64 6976 3e3c ix.hh:387
    < │ │ │ │ +00024260: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    < │ │ │ │ +000242c0: 6120 6872 6566 3d22 6130 3134 3030 2e68 a href="a01400.h │ │ │ │ +000242d0: 746d 6c23 6135 6434 3339 3561 6563 3163 tml#a5d4395aec1c │ │ │ │ +000242e0: 6330 3538 3065 6439 3635 3165 3962 3030 c0580ed9651e9b00 │ │ │ │ +000242f0: 3433 3462 3722 3e44 756e 653a 3a44 656e 434b7">Dune::Den │ │ │ │ +00024300: 7365 4d61 7472 6978 266c 743b 2046 6965 seMatrix< Fie │ │ │ │ +00024310: 6c64 4d61 7472 6978 266c 743b 204b 2c20 ldMatrix< K, │ │ │ │ +00024320: 524f 5753 2c20 434f 4c53 2026 6774 3b20 ROWS, COLS > │ │ │ │ +00024330: 2667 743b 3a3a 4d3c 2f61 3e3c 2f64 6976 >::M
    constexpr s │ │ │ │ +00024360: 697a 655f 7479 7065 204d 2829 2063 6f6e ize_type M() con │ │ │ │ +00024370: 7374 3c2f 6469 763e 3c64 6976 2063 6c61 st
    numbe │ │ │ │ +00024390: 7220 6f66 2063 6f6c 756d 6e73 3c2f 6469 r of columns
    Definiti │ │ │ │ +000243c0: 6f6e 3c2f 623e 2064 656e 7365 6d61 7472 on densematr │ │ │ │ +000243d0: 6978 2e68 683a 3730 333c 2f64 6976 3e3c ix.hh:703
    < │ │ │ │ +000243e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    < │ │ │ │ +00024440: 6120 6872 6566 3d22 6130 3134 3030 2e68 a href="a01400.h │ │ │ │ +00024450: 746d 6c23 6136 3563 3861 6638 6538 6666 tml#a65c8af8e8ff │ │ │ │ +00024460: 3232 3135 3563 3238 3663 3961 3765 6230 22155c286c9a7eb0 │ │ │ │ +00024470: 3335 3438 3222 3e44 756e 653a 3a44 656e 35482">Dune::Den │ │ │ │ +00024480: 7365 4d61 7472 6978 266c 743b 2046 6965 seMatrix< Fie │ │ │ │ +00024490: 6c64 4d61 7472 6978 266c 743b 204b 2c20 ldMatrix< K, │ │ │ │ +000244a0: 524f 5753 2c20 434f 4c53 2026 6774 3b20 ROWS, COLS > │ │ │ │ +000244b0: 2667 743b 3a3a 7269 6768 746d 756c 7469 >::rightmulti │ │ │ │ +000244c0: 706c 793c 2f61 3e3c 2f64 6976 3e3c 6469 ply
    FieldMatrix< │ │ │ │ +000244f0: 204b 2c20 524f 5753 2c20 434f 4c53 2026 K, ROWS, COLS & │ │ │ │ +00024500: 6774 3b20 2661 6d70 3b20 7269 6768 746d gt; & rightm │ │ │ │ +00024510: 756c 7469 706c 7928 636f 6e73 7420 4465 ultiply(const De │ │ │ │ +00024520: 6e73 654d 6174 7269 7826 6c74 3b20 4d32 nseMatrix< M2 │ │ │ │ +00024530: 2026 6774 3b20 2661 6d70 3b4d 293c 2f64 > &M)
    Multiplies │ │ │ │ +00024560: 204d 2066 726f 6d20 7468 6520 7269 6768 M from the righ │ │ │ │ +00024570: 7420 746f 2074 6869 7320 6d61 7472 6978 t to this matrix │ │ │ │ +00024580: 2e3c 2f64 6976 3e3c 6469 7620 636c 6173 .
    Def │ │ │ │ +000245a0: 696e 6974 696f 6e3c 2f62 3e20 6465 6e73 inition dens │ │ │ │ +000245b0: 656d 6174 7269 782e 6868 3a36 3435 3c2f ematrix.hh:645
    .
    │ │ │ │ +00024610: 3c64 6976 2063 6c61 7373 3d22 7474 6e61 < │ │ │ │ +000246b0: 6469 7620 636c 6173 733d 2274 7464 6563 div class="ttdec │ │ │ │ +000246c0: 6922 3e64 6572 6976 6564 5f74 7970 6520 i">derived_type │ │ │ │ +000246d0: 2661 6d70 3b20 6f70 6572 6174 6f72 2f3d & operator/= │ │ │ │ +000246e0: 2863 6f6e 7374 2066 6965 6c64 5f74 7970 (const field_typ │ │ │ │ +000246f0: 6520 2661 6d70 3b6b 293c 2f64 6976 3e3c e &k)
    < │ │ │ │ +00024700: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ +00024710: 223e 7665 6374 6f72 2073 7061 6365 2064 ">vector space d │ │ │ │ +00024720: 6976 6973 696f 6e20 6279 2073 6361 6c61 ivision by scala │ │ │ │ +00024730: 723c 2f64 6976 3e3c 6469 7620 636c 6173 r
    Def │ │ │ │ +00024750: 696e 6974 696f 6e3c 2f62 3e20 6465 6e73 inition dens │ │ │ │ +00024760: 656d 6174 7269 782e 6868 3a33 3239 3c2f ematrix.hh:329
    .
    │ │ │ │ +000247c0: 3c64 6976 2063 6c61 7373 3d22 7474 6e61 < │ │ │ │ +00024860: 6469 7620 636c 6173 733d 2274 7464 6563 div class="ttdec │ │ │ │ +00024870: 6922 3e64 6572 6976 6564 5f74 7970 6520 i">derived_type │ │ │ │ +00024880: 2661 6d70 3b20 6f70 6572 6174 6f72 2a3d & operator*= │ │ │ │ +00024890: 2863 6f6e 7374 2066 6965 6c64 5f74 7970 (const field_typ │ │ │ │ +000248a0: 6520 2661 6d70 3b6b 293c 2f64 6976 3e3c e &k)
    < │ │ │ │ +000248b0: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ +000248c0: 223e 7665 6374 6f72 2073 7061 6365 206d ">vector space m │ │ │ │ +000248d0: 756c 7469 706c 6963 6174 696f 6e20 7769 ultiplication wi │ │ │ │ +000248e0: 7468 2073 6361 6c61 723c 2f64 6976 3e3c th scalar
    < │ │ │ │ +000248f0: 6469 7620 636c 6173 733d 2274 7464 6566 div class="ttdef │ │ │ │ +00024900: 223e 3c62 3e44 6566 696e 6974 696f 6e3c ">Definition< │ │ │ │ +00024910: 2f62 3e20 6465 6e73 656d 6174 7269 782e /b> densematrix. │ │ │ │ +00024920: 6868 3a33 3231 3c2f 6469 763e 3c2f 6469 hh:321
    .
    deriv │ │ │ │ +00024a30: 6564 5f74 7970 6520 2661 6d70 3b20 6f70 ed_type & op │ │ │ │ +00024a40: 6572 6174 6f72 2d3d 2863 6f6e 7374 2044 erator-=(const D │ │ │ │ +00024a50: 656e 7365 4d61 7472 6978 266c 743b 204f enseMatrix< O │ │ │ │ +00024a60: 7468 6572 2026 6774 3b20 2661 6d70 3b78 ther > &x │ │ │ │ +00024a70: 293c 2f64 6976 3e3c 6469 7620 636c 6173 )
    vector │ │ │ │ +00024a90: 2073 7061 6365 2073 7562 7472 6163 7469 space subtracti │ │ │ │ +00024aa0: 6f6e 3c2f 6469 763e 3c64 6976 2063 6c61 on
    De │ │ │ │ +00024ac0: 6669 6e69 7469 6f6e 3c2f 623e 2064 656e finition den │ │ │ │ +00024ad0: 7365 6d61 7472 6978 2e68 683a 3331 323c sematrix.hh:312< │ │ │ │ +00024ae0: 2f64 6976 3e3c 2f64 6976 3e0a 3c64 6976 /div>
    .
    │ │ │ │ +00024bd0: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    static const │ │ │ │ +00024bf0: 6578 7072 2069 6e74 2062 6c6f 636b 6c65 expr int blockle │ │ │ │ +00024c00: 7665 6c3c 2f64 6976 3e3c 6469 7620 636c vel
    The │ │ │ │ +00024c20: 6e75 6d62 6572 206f 6620 626c 6f63 6b20 number of block │ │ │ │ +00024c30: 6c65 7665 6c73 2077 6520 636f 6e74 6169 levels we contai │ │ │ │ +00024c40: 6e2e 2054 6869 7320 6973 2074 6865 206c n. This is the l │ │ │ │ +00024c50: 6561 662c 2074 6861 7420 6973 2c20 312e eaf, that is, 1. │ │ │ │ +00024c60: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    Defi │ │ │ │ +00024c80: 6e69 7469 6f6e 3c2f 623e 2064 656e 7365 nition dense │ │ │ │ +00024c90: 6d61 7472 6978 2e68 683a 3137 383c 2f64 matrix.hh:178
    .
    │ │ │ │ +00024da0: 5472 6169 7473 3a3a 726f 775f 7479 7065 Traits::row_type │ │ │ │ +00024db0: 2072 6f77 5f74 7970 653c 2f64 6976 3e3c row_type
    < │ │ │ │ +00024dc0: 6469 7620 636c 6173 733d 2274 7464 6f63 div class="ttdoc │ │ │ │ +00024dd0: 223e 5468 6520 7479 7065 2075 7365 6420 ">The type used │ │ │ │ +00024de0: 746f 2072 6570 7265 7365 6e74 2061 2072 to represent a r │ │ │ │ +00024df0: 6f77 2028 6d75 7374 2066 756c 6669 6c6c ow (must fulfill │ │ │ │ +00024e00: 2074 6865 2044 756e 653a 3a44 656e 7365 the Dune::Dense │ │ │ │ +00024e10: 5665 6374 6f72 2069 6e74 6572 6661 6365 Vector interface │ │ │ │ +00024e20: 293c 2f64 6976 3e3c 6469 7620 636c 6173 )
    Def │ │ │ │ +00024e40: 696e 6974 696f 6e3c 2f62 3e20 6465 6e73 inition dens │ │ │ │ +00024e50: 656d 6174 7269 782e 6868 3a31 3639 3c2f ematrix.hh:169
    .
    │ │ │ │ +00024eb0: 3c64 6976 2063 6c61 7373 3d22 7474 6e61 Traits::size_t │ │ │ │ +00024f70: 7970 6520 7369 7a65 5f74 7970 653c 2f64 ype size_type
    The type u │ │ │ │ +00024fa0: 7365 6420 666f 7220 7468 6520 696e 6465 sed for the inde │ │ │ │ +00024fb0: 7820 6163 6365 7373 2061 6e64 2073 697a x access and siz │ │ │ │ +00024fc0: 6520 6f70 6572 6174 696f 6e2e 3c2f 6469 e operation.
    Definiti │ │ │ │ +00024ff0: 6f6e 3c2f 623e 2064 656e 7365 6d61 7472 on densematr │ │ │ │ +00025000: 6978 2e68 683a 3136 363c 2f64 6976 3e3c ix.hh:166
    < │ │ │ │ +00025010: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    < │ │ │ │ +00025070: 6120 6872 6566 3d22 6130 3134 3030 2e68 a href="a01400.h │ │ │ │ +00025080: 746d 6c23 6164 3839 3134 6266 3431 3434 tml#ad8914bf4144 │ │ │ │ +00025090: 3936 3765 3130 3931 6534 6530 3231 3565 967e1091e4e0215e │ │ │ │ +000250a0: 6665 3330 3522 3e44 756e 653a 3a44 656e fe305">Dune::Den │ │ │ │ +000250b0: 7365 4d61 7472 6978 266c 743b 2046 6965 seMatrix< Fie │ │ │ │ +000250c0: 6c64 4d61 7472 6978 266c 743b 204b 2c20 ldMatrix< K, │ │ │ │ +000250d0: 524f 5753 2c20 434f 4c53 2026 6774 3b20 ROWS, COLS > │ │ │ │ +000250e0: 2667 743b 3a3a 636f 6e73 745f 726f 775f >::const_row_ │ │ │ │ +000250f0: 7265 6665 7265 6e63 653c 2f61 3e3c 2f64 reference
    Traits::c │ │ │ │ +00025120: 6f6e 7374 5f72 6f77 5f72 6566 6572 656e onst_row_referen │ │ │ │ +00025130: 6365 2063 6f6e 7374 5f72 6f77 5f72 6566 ce const_row_ref │ │ │ │ +00025140: 6572 656e 6365 3c2f 6469 763e 3c64 6976 erence
    T │ │ │ │ +00025160: 6865 2074 7970 6520 7573 6564 2074 6f20 he type used to │ │ │ │ +00025170: 7265 7072 6573 656e 7420 6120 7265 6665 represent a refe │ │ │ │ +00025180: 7265 6e63 6520 746f 2061 2063 6f6e 7374 rence to a const │ │ │ │ +00025190: 616e 7420 726f 7720 2875 7375 616c 6c79 ant row (usually │ │ │ │ +000251a0: 2063 6f6e 7374 2072 6f77 5f74 7970 6520 const row_type │ │ │ │ +000251b0: 2661 6d70 3b29 3c2f 6469 763e 3c64 6976 &)
    < │ │ │ │ +000251d0: 623e 4465 6669 6e69 7469 6f6e 3c2f 623e b>Definition │ │ │ │ +000251e0: 2064 656e 7365 6d61 7472 6978 2e68 683a densematrix.hh: │ │ │ │ +000251f0: 3137 353c 2f64 6976 3e3c 2f64 6976 3e0a 175
    . │ │ │ │ +00025200: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    Trait │ │ │ │ +00025300: 733a 3a72 6f77 5f72 6566 6572 656e 6365 s::row_reference │ │ │ │ +00025310: 2072 6f77 5f72 6566 6572 656e 6365 3c2f row_reference
    The type │ │ │ │ +00025340: 7573 6564 2074 6f20 7265 7072 6573 656e used to represen │ │ │ │ +00025350: 7420 6120 7265 6665 7265 6e63 6520 746f t a reference to │ │ │ │ +00025360: 2061 2072 6f77 2028 7573 7561 6c6c 7920 a row (usually │ │ │ │ +00025370: 726f 775f 7479 7065 2026 616d 703b 293c row_type &)< │ │ │ │ +00025380: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ +000253a0: 6974 696f 6e3c 2f62 3e20 6465 6e73 656d ition densem │ │ │ │ +000253b0: 6174 7269 782e 6868 3a31 3732 3c2f 6469 atrix.hh:172
    .derived_type &a │ │ │ │ +000254d0: 6d70 3b20 6f70 6572 6174 6f72 2b3d 2863 mp; operator+=(c │ │ │ │ +000254e0: 6f6e 7374 2044 656e 7365 4d61 7472 6978 onst DenseMatrix │ │ │ │ +000254f0: 266c 743b 204f 7468 6572 2026 6774 3b20 < Other > │ │ │ │ +00025500: 2661 6d70 3b78 293c 2f64 6976 3e3c 6469 &x)
    │ │ │ │ +00025520: 7665 6374 6f72 2073 7061 6365 2061 6464 vector space add │ │ │ │ +00025530: 6974 696f 6e3c 2f64 6976 3e3c 6469 7620 ition
    Definition │ │ │ │ +00025560: 6465 6e73 656d 6174 7269 782e 6868 3a32 densematrix.hh:2 │ │ │ │ +00025570: 3839 3c2f 6469 763e 3c2f 6469 763e 0a3c 89
    .< │ │ │ │ +00025580: 6469 7620 636c 6173 733d 2274 7463 2220 div class="ttc" │ │ │ │ +00025590: 6964 3d22 6161 3031 3430 385f 6874 6d6c id="aa01408_html │ │ │ │ +000255a0: 223e 3c64 6976 2063 6c61 7373 3d22 7474 ">
    A dens │ │ │ │ +00025600: 6520 6e20 7820 6d20 6d61 7472 6978 2e3c e n x m matrix.< │ │ │ │ +00025610: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ +00025630: 6974 696f 6e3c 2f62 3e20 666d 6174 7269 ition fmatri │ │ │ │ +00025640: 782e 6868 3a31 3137 3c2f 6469 763e 3c2f x.hh:117
    .
    s │ │ │ │ +00025720: 7461 7469 6320 636f 6e73 7465 7870 7220 tatic constexpr │ │ │ │ +00025730: 7369 7a65 5f74 7970 6520 6d61 745f 636f size_type mat_co │ │ │ │ +00025740: 6c73 2829 3c2f 6469 763e 3c64 6976 2063 ls()
    │ │ │ │ +00025760: 4465 6669 6e69 7469 6f6e 3c2f 623e 2066 Definition f │ │ │ │ +00025770: 6d61 7472 6978 2e68 683a 3336 373c 2f64 matrix.hh:367
    .
    < │ │ │ │ +000257d0: 6469 7620 636c 6173 733d 2274 746e 616d div class="ttnam │ │ │ │ +000257e0: 6522 3e3c 6120 6872 6566 3d22 6130 3134 e">Dune: │ │ │ │ +00025820: 3a46 6965 6c64 4d61 7472 6978 3a3a 4669 :FieldMatrix::Fi │ │ │ │ +00025830: 656c 644d 6174 7269 783c 2f61 3e3c 2f64 eldMatrix
    constexpr │ │ │ │ +00025860: 2046 6965 6c64 4d61 7472 6978 2829 3d64 FieldMatrix()=d │ │ │ │ +00025870: 6566 6175 6c74 3c2f 6469 763e 3c64 6976 efault
    D │ │ │ │ +00025890: 6566 6175 6c74 2063 6f6e 7374 7275 6374 efault construct │ │ │ │ +000258a0: 6f72 2e3c 2f64 6976 3e3c 2f64 6976 3e0a or.
    . │ │ │ │ +000258b0: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    Base::const │ │ │ │ +00025990: 5f72 6f77 5f72 6566 6572 656e 6365 2063 _row_reference c │ │ │ │ +000259a0: 6f6e 7374 5f72 6f77 5f72 6566 6572 656e onst_row_referen │ │ │ │ +000259b0: 6365 3c2f 6469 763e 3c64 6976 2063 6c61 ce
    De │ │ │ │ +000259d0: 6669 6e69 7469 6f6e 3c2f 623e 2066 6d61 finition fma │ │ │ │ +000259e0: 7472 6978 2e68 683a 3133 313c 2f64 6976 trix.hh:131
    .< │ │ │ │ +00025ab0: 6469 7620 636c 6173 733d 2274 7464 6563 div class="ttdec │ │ │ │ +00025ac0: 6922 3e46 6965 6c64 4d61 7472 6978 2026 i">FieldMatrix & │ │ │ │ +00025ad0: 616d 703b 206f 7065 7261 746f 723d 2863 amp; operator=(c │ │ │ │ +00025ae0: 6f6e 7374 2046 6965 6c64 4d61 7472 6978 onst FieldMatrix │ │ │ │ +00025af0: 266c 743b 2054 2c20 524f 5753 2c20 434f < T, ROWS, CO │ │ │ │ +00025b00: 4c53 2026 6774 3b20 2661 6d70 3b78 293c LS > &x)< │ │ │ │ +00025b10: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    copy ass │ │ │ │ +00025b30: 6967 6e6d 656e 7420 6672 6f6d 2046 6965 ignment from Fie │ │ │ │ +00025b40: 6c64 4d61 7472 6978 206f 7665 7220 6120 ldMatrix over a │ │ │ │ +00025b50: 6469 6666 6572 656e 7420 6669 656c 643c different field< │ │ │ │ +00025b60: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ +00025b80: 6974 696f 6e3c 2f62 3e20 666d 6174 7269 ition fmatri │ │ │ │ +00025b90: 782e 6868 3a31 3631 3c2f 6469 763e 3c2f x.hh:161
    .
    Dune::Fiel │ │ │ │ +00025c40: 644d 6174 7269 783a 3a72 6967 6874 6d75 dMatrix::rightmu │ │ │ │ +00025c50: 6c74 6970 6c79 616e 793c 2f61 3e3c 2f64 ltiplyany
    FieldMatr │ │ │ │ +00025c80: 6978 266c 743b 204b 2c20 726f 7773 2c20 ix< K, rows, │ │ │ │ +00025c90: 6c20 2667 743b 2072 6967 6874 6d75 6c74 l > rightmult │ │ │ │ +00025ca0: 6970 6c79 616e 7928 636f 6e73 7420 4669 iplyany(const Fi │ │ │ │ +00025cb0: 656c 644d 6174 7269 7826 6c74 3b20 4b2c eldMatrix< K, │ │ │ │ +00025cc0: 2063 6f6c 732c 206c 2026 6774 3b20 2661 cols, l > &a │ │ │ │ +00025cd0: 6d70 3b4d 2920 636f 6e73 743c 2f64 6976 mp;M) const
    Multiplies M │ │ │ │ +00025d00: 2066 726f 6d20 7468 6520 7269 6768 7420 from the right │ │ │ │ +00025d10: 746f 2074 6869 7320 6d61 7472 6978 2c20 to this matrix, │ │ │ │ +00025d20: 7468 6973 206d 6174 7269 7820 6973 206e this matrix is n │ │ │ │ +00025d30: 6f74 206d 6f64 6966 6965 642e 3c2f 6469 ot modified.
    Definiti │ │ │ │ +00025d60: 6f6e 3c2f 623e 2066 6d61 7472 6978 2e68 on fmatrix.h │ │ │ │ +00025d70: 683a 3335 313c 2f64 6976 3e3c 2f64 6976 h:351
    .
    . │ │ │ │ +00025f60: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    Base::size_t │ │ │ │ +00025f80: 7970 6520 7369 7a65 5f74 7970 653c 2f64 ype size_type
    Definit │ │ │ │ +00025fb0: 696f 6e3c 2f62 3e20 666d 6174 7269 782e ion fmatrix. │ │ │ │ +00025fc0: 6868 3a31 3237 3c2f 6469 763e 3c2f 6469 hh:127
    .
    │ │ │ │ +00026090: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    FieldMatrix& │ │ │ │ +000260b0: 6c74 3b20 4b2c 206c 2c20 636f 6c73 2026 lt; K, l, cols & │ │ │ │ +000260c0: 6774 3b20 6c65 6674 6d75 6c74 6970 6c79 gt; leftmultiply │ │ │ │ +000260d0: 616e 7928 636f 6e73 7420 4669 656c 644d any(const FieldM │ │ │ │ +000260e0: 6174 7269 7826 6c74 3b20 4b2c 206c 2c20 atrix< K, l, │ │ │ │ +000260f0: 726f 7773 2026 6774 3b20 2661 6d70 3b4d rows > &M │ │ │ │ +00026100: 2920 636f 6e73 743c 2f64 6976 3e3c 6469 ) const
    │ │ │ │ +00026120: 4d75 6c74 6970 6c69 6573 204d 2066 726f Multiplies M fro │ │ │ │ +00026130: 6d20 7468 6520 6c65 6674 2074 6f20 7468 m the left to th │ │ │ │ +00026140: 6973 206d 6174 7269 782c 2074 6869 7320 is matrix, this │ │ │ │ +00026150: 6d61 7472 6978 2069 7320 6e6f 7420 6d6f matrix is not mo │ │ │ │ +00026160: 6469 6669 6564 2e3c 2f64 6976 3e3c 6469 dified.
    │ │ │ │ +00026180: 3c62 3e44 6566 696e 6974 696f 6e3c 2f62 Definition fmatrix.hh:316 │ │ │ │ +000261a0: 3c2f 6469 763e 3c2f 6469 763e 0a3c 6469
    . │ │ │ │ +00026310: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    Definition │ │ │ │ +00026330: 3c2f 623e 2066 6d61 7472 6978 2e68 683a fmatrix.hh: │ │ │ │ +00026340: 3333 343c 2f64 6976 3e3c 2f64 6976 3e0a 334
    . │ │ │ │ +00026350: 3c64 6976 2063 6c61 7373 3d22 7474 6322 . │ │ │ │ +00026480: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    frien │ │ │ │ +00026550: 6420 6175 746f 206f 7065 7261 746f 722a d auto operator* │ │ │ │ +00026560: 2863 6f6e 7374 2046 6965 6c64 4d61 7472 (const FieldMatr │ │ │ │ +00026570: 6978 2026 616d 703b 6d61 7472 6978 2c20 ix &matrix, │ │ │ │ +00026580: 5363 616c 6172 2073 6361 6c61 7229 3c2f Scalar scalar)
    vector sp │ │ │ │ +000265b0: 6163 6520 6d75 6c74 6970 6c69 6361 7469 ace multiplicati │ │ │ │ +000265c0: 6f6e 2077 6974 6820 7363 616c 6172 3c2f on with scalar
    Defini │ │ │ │ +000265f0: 7469 6f6e 3c2f 623e 2066 6d61 7472 6978 tion fmatrix │ │ │ │ +00026600: 2e68 683a 3231 323c 2f64 6976 3e3c 2f64 .hh:212
    .
    F │ │ │ │ +000266e0: 6965 6c64 4d61 7472 6978 2026 616d 703b ieldMatrix & │ │ │ │ +000266f0: 206f 7065 7261 746f 723d 2846 6965 6c64 operator=(Field │ │ │ │ +00026700: 4d61 7472 6978 266c 743b 2054 2c20 726f Matrix< T, ro │ │ │ │ +00026710: 7773 2c20 636f 6c73 2026 6774 3b20 636f ws, cols > co │ │ │ │ +00026720: 6e73 7420 2661 6d70 3b29 3d64 656c 6574 nst &)=delet │ │ │ │ +00026730: 653c 2f64 6976 3e3c 6469 7620 636c 6173 e
    no cop │ │ │ │ +00026750: 7920 6173 7369 676e 6d65 6e74 2066 726f y assignment fro │ │ │ │ +00026760: 6d20 4669 656c 644d 6174 7269 7820 6f66 m FieldMatrix of │ │ │ │ +00026770: 2064 6966 6665 7265 6e74 2073 697a 653c different size< │ │ │ │ +00026780: 2f64 6976 3e3c 2f64 6976 3e0a 3c64 6976 /div>
    .
    Base: │ │ │ │ +00026860: 3a72 6f77 5f72 6566 6572 656e 6365 2072 :row_reference r │ │ │ │ +00026870: 6f77 5f72 6566 6572 656e 6365 3c2f 6469 ow_reference
    Definiti │ │ │ │ +000268a0: 6f6e 3c2f 623e 2066 6d61 7472 6978 2e68 on fmatrix.h │ │ │ │ +000268b0: 683a 3133 303c 2f64 6976 3e3c 2f64 6976 h:130
    .
    ro │ │ │ │ +00026990: 775f 7265 6665 7265 6e63 6520 6d61 745f w_reference mat_ │ │ │ │ +000269a0: 6163 6365 7373 2873 697a 655f 7479 7065 access(size_type │ │ │ │ +000269b0: 2069 293c 2f64 6976 3e3c 6469 7620 636c i)
    D │ │ │ │ +000269d0: 6566 696e 6974 696f 6e3c 2f62 3e20 666d efinition fm │ │ │ │ +000269e0: 6174 7269 782e 6868 3a33 3639 3c2f 6469 atrix.hh:369
    .
    s │ │ │ │ +00026ac0: 7461 7469 6320 636f 6e73 7465 7870 7220 tatic constexpr │ │ │ │ +00026ad0: 696e 7420 726f 7773 3c2f 6469 763e 3c64 int rows
    The number of r │ │ │ │ +00026b00: 6f77 732e 3c2f 6469 763e 3c64 6976 2063 ows.
    │ │ │ │ +00026b20: 4465 6669 6e69 7469 6f6e 3c2f 623e 2066 Definition f │ │ │ │ +00026b30: 6d61 7472 6978 2e68 683a 3132 333c 2f64 matrix.hh:123
    .
    < │ │ │ │ +00026b90: 6469 7620 636c 6173 733d 2274 746e 616d div class="ttnam │ │ │ │ +00026ba0: 6522 3e3c 6120 6872 6566 3d22 6130 3134 e">Dune: │ │ │ │ +00026be0: 3a46 6965 6c64 4d61 7472 6978 3a3a 7472 :FieldMatrix::tr │ │ │ │ +00026bf0: 616e 7370 6f73 6564 3c2f 613e 3c2f 6469 ansposed
    FieldMatri │ │ │ │ +00026c20: 7826 6c74 3b20 4b2c 2043 4f4c 532c 2052 x< K, COLS, R │ │ │ │ +00026c30: 4f57 5320 2667 743b 2074 7261 6e73 706f OWS > transpo │ │ │ │ +00026c40: 7365 6428 2920 636f 6e73 743c 2f64 6976 sed() const
    Return trans │ │ │ │ +00026c70: 706f 7365 6420 6f66 2074 6865 206d 6174 posed of the mat │ │ │ │ +00026c80: 7269 7820 6173 2046 6965 6c64 4d61 7472 rix as FieldMatr │ │ │ │ +00026c90: 6978 2e3c 2f64 6976 3e3c 6469 7620 636c ix.
    D │ │ │ │ +00026cb0: 6566 696e 6974 696f 6e3c 2f62 3e20 666d efinition fm │ │ │ │ +00026cc0: 6174 7269 782e 6868 3a31 3732 3c2f 6469 atrix.hh:172
    .< │ │ │ │ +00026d90: 6469 7620 636c 6173 733d 2274 7464 6563 div class="ttdec │ │ │ │ +00026da0: 6922 3e73 7461 7469 6320 636f 6e73 7465 i">static conste │ │ │ │ +00026db0: 7870 7220 7369 7a65 5f74 7970 6520 6d61 xpr size_type ma │ │ │ │ +00026dc0: 745f 726f 7773 2829 3c2f 6469 763e 3c64 t_rows()
    Definition fmatrix.hh:36 │ │ │ │ +00026e00: 363c 2f64 6976 3e3c 2f64 6976 3e0a 3c64 6
    .
    Field │ │ │ │ +00026ee0: 4d61 7472 6978 2873 7464 3a3a 696e 6974 Matrix(std::init │ │ │ │ +00026ef0: 6961 6c69 7a65 725f 6c69 7374 266c 743b ializer_list< │ │ │ │ +00026f00: 2044 756e 653a 3a46 6965 6c64 5665 6374 Dune::FieldVect │ │ │ │ +00026f10: 6f72 266c 743b 204b 2c20 636f 6c73 2026 or< K, cols & │ │ │ │ +00026f20: 6774 3b20 2667 743b 2063 6f6e 7374 2026 gt; > const & │ │ │ │ +00026f30: 616d 703b 6c29 3c2f 6469 763e 3c64 6976 amp;l)
    C │ │ │ │ +00026f50: 6f6e 7374 7275 6374 6f72 2069 6e69 7469 onstructor initi │ │ │ │ +00026f60: 616c 697a 696e 6720 7468 6520 6d61 7472 alizing the matr │ │ │ │ +00026f70: 6978 2066 726f 6d20 6120 6c69 7374 206f ix from a list o │ │ │ │ +00026f80: 6620 7665 6374 6f72 2e3c 2f64 6976 3e3c f vector.
    < │ │ │ │ +00026f90: 6469 7620 636c 6173 733d 2274 7464 6566 div class="ttdef │ │ │ │ +00026fa0: 223e 3c62 3e44 6566 696e 6974 696f 6e3c ">Definition< │ │ │ │ +00026fb0: 2f62 3e20 666d 6174 7269 782e 6868 3a31 /b> fmatrix.hh:1 │ │ │ │ +00026fc0: 3430 3c2f 6469 763e 3c2f 6469 763e 0a3c 40
    .< │ │ │ │ +00026fd0: 6469 7620 636c 6173 733d 2274 7463 2220 div class="ttc" │ │ │ │ +00026fe0: 6964 3d22 6161 3031 3430 385f 6874 6d6c id="aa01408_html │ │ │ │ +00026ff0: 5f61 6332 3831 3666 3164 3036 3766 3533 _ac2816f1d067f53 │ │ │ │ +00027000: 3333 3636 3239 3763 3035 3366 3037 3039 3366297c053f0709 │ │ │ │ +00027010: 3962 223e 3c64 6976 2063 6c61 7373 3d22 9b">
    static cons │ │ │ │ +000270a0: 7465 7870 7220 696e 7420 636f 6c73 3c2f texpr int cols
    The numbe │ │ │ │ +000270d0: 7220 6f66 2063 6f6c 756d 6e73 2e3c 2f64 r of columns.
    Definit │ │ │ │ +00027100: 696f 6e3c 2f62 3e20 666d 6174 7269 782e ion fmatrix. │ │ │ │ +00027110: 6868 3a31 3235 3c2f 6469 763e 3c2f 6469 hh:125
    .
    fr │ │ │ │ +000271f0: 6965 6e64 2061 7574 6f20 6f70 6572 6174 iend auto operat │ │ │ │ +00027200: 6f72 2f28 636f 6e73 7420 4669 656c 644d or/(const FieldM │ │ │ │ +00027210: 6174 7269 7820 2661 6d70 3b6d 6174 7269 atrix &matri │ │ │ │ +00027220: 782c 2053 6361 6c61 7220 7363 616c 6172 x, Scalar scalar │ │ │ │ +00027230: 293c 2f64 6976 3e3c 6469 7620 636c 6173 )
    vector │ │ │ │ +00027250: 2073 7061 6365 2064 6976 6973 696f 6e20 space division │ │ │ │ +00027260: 6279 2073 6361 6c61 723c 2f64 6976 3e3c by scalar
    < │ │ │ │ +00027270: 6469 7620 636c 6173 733d 2274 7464 6566 div class="ttdef │ │ │ │ +00027280: 223e 3c62 3e44 6566 696e 6974 696f 6e3c ">Definition< │ │ │ │ +00027290: 2f62 3e20 666d 6174 7269 782e 6868 3a32 /b> fmatrix.hh:2 │ │ │ │ +000272a0: 3430 3c2f 6469 763e 3c2f 6469 763e 0a3c 40
    .< │ │ │ │ +000272b0: 6469 7620 636c 6173 733d 2274 7463 2220 div class="ttc" │ │ │ │ +000272c0: 6964 3d22 6161 3031 3430 385f 6874 6d6c id="aa01408_html │ │ │ │ +000272d0: 5f61 6536 3033 3366 3231 3764 3264 6531 _ae6033f217d2de1 │ │ │ │ +000272e0: 6337 6330 6464 6431 3038 3435 3966 6638 c7c0ddd108459ff8 │ │ │ │ +000272f0: 6163 223e 3c64 6976 2063 6c61 7373 3d22 ac">
    friend │ │ │ │ +00027380: 2061 7574 6f20 6f70 6572 6174 6f72 2b28 auto operator+( │ │ │ │ +00027390: 636f 6e73 7420 4669 656c 644d 6174 7269 const FieldMatri │ │ │ │ +000273a0: 7820 2661 6d70 3b6d 6174 7269 7841 2c20 x &matrixA, │ │ │ │ +000273b0: 636f 6e73 7420 4669 656c 644d 6174 7269 const FieldMatri │ │ │ │ +000273c0: 7826 6c74 3b20 4f74 6865 7253 6361 6c61 x< OtherScala │ │ │ │ +000273d0: 722c 2052 4f57 532c 2043 4f4c 5320 2667 r, ROWS, COLS &g │ │ │ │ +000273e0: 743b 2026 616d 703b 6d61 7472 6978 4229 t; &matrixB) │ │ │ │ +000273f0: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    vector │ │ │ │ +00027410: 7370 6163 6520 6164 6469 7469 6f6e 20e2 space addition . │ │ │ │ +00027420: 8093 2074 776f 2d61 7267 756d 656e 7420 .. two-argument │ │ │ │ +00027430: 7665 7273 696f 6e3c 2f64 6976 3e3c 6469 version
    │ │ │ │ +00027450: 3c62 3e44 6566 696e 6974 696f 6e3c 2f62 Definition fmatrix.hh:183 │ │ │ │ +00027470: 3c2f 6469 763e 3c2f 6469 763e 0a3c 6469
    .
    Du │ │ │ │ +00027510: 6e65 3a3a 4669 656c 644d 6174 7269 783a ne::FieldMatrix: │ │ │ │ +00027520: 3a6f 7065 7261 746f 723d 3c2f 613e 3c2f :operator=
    FieldMat │ │ │ │ +00027550: 7269 7820 2661 6d70 3b20 6f70 6572 6174 rix & operat │ │ │ │ +00027560: 6f72 3d28 636f 6e73 7420 4669 656c 644d or=(const FieldM │ │ │ │ +00027570: 6174 7269 7820 2661 6d70 3b29 3d64 6566 atrix &)=def │ │ │ │ +00027580: 6175 6c74 3c2f 6469 763e 3c64 6976 2063 ault
    cop │ │ │ │ +000275a0: 7920 6173 7369 676e 6d65 6e74 206f 7065 y assignment ope │ │ │ │ +000275b0: 7261 746f 723c 2f64 6976 3e3c 2f64 6976 rator
    .
    vect │ │ │ │ +00027720: 6f72 2073 7061 6365 2073 7562 7472 6163 or space subtrac │ │ │ │ +00027730: 7469 6f6e 20e2 8093 2074 776f 2d61 7267 tion ... two-arg │ │ │ │ +00027740: 756d 656e 7420 7665 7273 696f 6e3c 2f64 ument version
    Definit │ │ │ │ +00027770: 696f 6e3c 2f62 3e20 666d 6174 7269 782e ion fmatrix. │ │ │ │ +00027780: 6868 3a31 3937 3c2f 6469 763e 3c2f 6469 hh:197
    .
    c │ │ │ │ +00027860: 6f6e 7374 5f72 6f77 5f72 6566 6572 656e onst_row_referen │ │ │ │ +00027870: 6365 206d 6174 5f61 6363 6573 7328 7369 ce mat_access(si │ │ │ │ +00027880: 7a65 5f74 7970 6520 6929 2063 6f6e 7374 ze_type i) const │ │ │ │ +00027890: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    Defi │ │ │ │ +000278b0: 6e69 7469 6f6e 3c2f 623e 2066 6d61 7472 nition fmatr │ │ │ │ +000278c0: 6978 2e68 683a 3337 353c 2f64 6976 3e3c ix.hh:375
    < │ │ │ │ +000278d0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    vector space ou │ │ │ │ +00027960: 7420 6f66 2061 2074 656e 736f 7220 7072 t of a tensor pr │ │ │ │ +00027970: 6f64 7563 7420 6f66 2066 6965 6c64 732e oduct of fields. │ │ │ │ +00027980: 3c2f 6469 763e 3c64 6976 2063 6c61 7373
    Defi │ │ │ │ +000279a0: 6e69 7469 6f6e 3c2f 623e 2066 7665 6374 nition fvect │ │ │ │ +000279b0: 6f72 2e68 683a 3935 3c2f 6469 763e 3c2f or.hh:95
    .
    Dune::Dens │ │ │ │ +00027a60: 654d 6174 5665 6354 7261 6974 7326 6c74 eMatVecTraits< │ │ │ │ +00027a70: 3b20 4669 656c 644d 6174 7269 7826 6c74 ; FieldMatrix< │ │ │ │ +00027a80: 3b20 4b2c 2052 4f57 532c 2043 4f4c 5320 ; K, ROWS, COLS │ │ │ │ +00027a90: 2667 743b 2026 6774 3b3a 3a63 6f6e 7461 > >::conta │ │ │ │ +00027aa0: 696e 6572 5f74 7970 653c 2f61 3e3c 2f64 iner_type
    std::arra │ │ │ │ +00027ad0: 7926 6c74 3b20 726f 775f 7479 7065 2c20 y< row_type, │ │ │ │ +00027ae0: 524f 5753 2026 6774 3b20 636f 6e74 6169 ROWS > contai │ │ │ │ +00027af0: 6e65 725f 7479 7065 3c2f 6469 763e 3c64 ner_type
    Definition fmatrix.hh:95 │ │ │ │ +00027b30: 3c2f 6469 763e 3c2f 6469 763e 0a3c 6469
    . │ │ │ │ +00027cb0: 0a3c 6469 7620 636c 6173 733d 2274 7463 .. │ │ │ │ +00027e00: 3c64 6976 2063 6c61 7373 3d22 7474 6322
    Dune::DenseMatV │ │ │ │ +00027ea0: 6563 5472 6169 7473 266c 743b 2046 6965 ecTraits< Fie │ │ │ │ +00027eb0: 6c64 4d61 7472 6978 266c 743b 204b 2c20 ldMatrix< K, │ │ │ │ +00027ec0: 524f 5753 2c20 434f 4c53 2026 6774 3b20 ROWS, COLS > │ │ │ │ +00027ed0: 2667 743b 3a3a 636f 6e73 745f 726f 775f >::const_row_ │ │ │ │ +00027ee0: 7265 6665 7265 6e63 653c 2f61 3e3c 2f64 reference
    const row │ │ │ │ +00027f10: 5f74 7970 6520 2661 6d70 3b20 636f 6e73 _type & cons │ │ │ │ +00027f20: 745f 726f 775f 7265 6665 7265 6e63 653c t_row_reference< │ │ │ │ +00027f30: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    Defin │ │ │ │ +00027f50: 6974 696f 6e3c 2f62 3e20 666d 6174 7269 ition fmatri │ │ │ │ +00027f60: 782e 6868 3a39 333c 2f64 6976 3e3c 2f64 x.hh:93
    .
    │ │ │ │ +00028070: 4669 656c 6456 6563 746f 7226 6c74 3b20 FieldVector< │ │ │ │ +00028080: 4b2c 2043 4f4c 5320 2667 743b 2072 6f77 K, COLS > row │ │ │ │ +00028090: 5f74 7970 653c 2f64 6976 3e3c 6469 7620 _type
    Definition │ │ │ │ +000280c0: 666d 6174 7269 782e 6868 3a39 303c 2f64 fmatrix.hh:90
    .
    < │ │ │ │ +00028120: 6469 7620 636c 6173 733d 2274 746e 616d div class="ttnam │ │ │ │ +00028130: 6522 3e3c 6120 6872 6566 3d22 6130 3137 e">Dune: │ │ │ │ +00028170: 3a44 656e 7365 4d61 7456 6563 5472 6169 :DenseMatVecTrai │ │ │ │ +00028180: 7473 266c 743b 2046 6965 6c64 4d61 7472 ts< FieldMatr │ │ │ │ +00028190: 6978 266c 743b 204b 2c20 524f 5753 2c20 ix< K, ROWS, │ │ │ │ +000281a0: 434f 4c53 2026 6774 3b20 2667 743b 3a3a COLS > >:: │ │ │ │ +000281b0: 7369 7a65 5f74 7970 653c 2f61 3e3c 2f64 size_type
    container │ │ │ │ +000281e0: 5f74 7970 653a 3a73 697a 655f 7479 7065 _type::size_type │ │ │ │ +000281f0: 2073 697a 655f 7479 7065 3c2f 6469 763e size_type
    │ │ │ │ +00028200: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    Definition │ │ │ │ +00028220: 3c2f 623e 2066 6d61 7472 6978 2e68 683a fmatrix.hh: │ │ │ │ +00028230: 3937 3c2f 6469 763e 3c2f 6469 763e 0a3c 97
    .< │ │ │ │ +00028240: 6469 7620 636c 6173 733d 2274 7463 2220 div class="ttc" │ │ │ │ +00028250: 6964 3d22 6161 3031 3733 325f 6874 6d6c id="aa01732_html │ │ │ │ +00028260: 5f61 6366 3564 3334 6637 3736 3561 3931 _acf5d34f7765a91 │ │ │ │ +00028270: 6137 3837 3661 6436 6664 3663 3637 6434 a7876ad6fd6c67d4 │ │ │ │ +00028280: 3131 223e 3c64 6976 2063 6c61 7373 3d22 11">
    │ │ │ │ +00028340: 726f 775f 7479 7065 2026 616d 703b 2072 row_type & r │ │ │ │ +00028350: 6f77 5f72 6566 6572 656e 6365 3c2f 6469 ow_reference
    Definiti │ │ │ │ +00028380: 6f6e 3c2f 623e 2066 6d61 7472 6978 2e68 on fmatrix.h │ │ │ │ +00028390: 683a 3932 3c2f 6469 763e 3c2f 6469 763e h:92
    │ │ │ │ +000283a0: 0a3c 6469 7620 636c 6173 733d 2274 7463 .
    Dune::FieldTra │ │ │ │ +00028440: 6974 7326 6c74 3b20 4669 656c 644d 6174 its< FieldMat │ │ │ │ +00028450: 7269 7826 6c74 3b20 4b2c 2052 4f57 532c rix< K, ROWS, │ │ │ │ +00028460: 2043 4f4c 5320 2667 743b 2026 6774 3b3a COLS > >: │ │ │ │ +00028470: 3a66 6965 6c64 5f74 7970 653c 2f61 3e3c :field_type< │ │ │ │ +00028480: 2f64 6976 3e3c 6469 7620 636c 6173 733d /div>
    FieldTr │ │ │ │ +000284a0: 6169 7473 266c 743b 204b 2026 6774 3b3a aits< K >: │ │ │ │ +000284b0: 3a66 6965 6c64 5f74 7970 6520 6669 656c :field_type fiel │ │ │ │ +000284c0: 645f 7479 7065 3c2f 6469 763e 3c64 6976 d_type
    < │ │ │ │ +000284e0: 623e 4465 6669 6e69 7469 6f6e 3c2f 623e b>Definition │ │ │ │ +000284f0: 2066 6d61 7472 6978 2e68 683a 3130 333c fmatrix.hh:103< │ │ │ │ +00028500: 2f64 6976 3e3c 2f64 6976 3e0a 3c64 6976 /div>
    .
    < │ │ │ │ +000285f0: 6469 7620 636c 6173 733d 2274 7464 6563 div class="ttdec │ │ │ │ +00028600: 6922 3e46 6965 6c64 5472 6169 7473 266c i">FieldTraits&l │ │ │ │ +00028610: 743b 204b 2026 6774 3b3a 3a72 6561 6c5f t; K >::real_ │ │ │ │ +00028620: 7479 7065 2072 6561 6c5f 7479 7065 3c2f type real_type
    Defini │ │ │ │ +00028650: 7469 6f6e 3c2f 623e 2066 6d61 7472 6978 tion fmatrix │ │ │ │ +00028660: 2e68 683a 3130 343c 2f64 6976 3e3c 2f64 .hh:104
    .
    < │ │ │ │ +000286f0: 623e 4465 6669 6e69 7469 6f6e 3c2f 623e b>Definition │ │ │ │ +00028700: 2066 7472 6169 7473 2e68 683a 3236 3c2f ftraits.hh:26
    .
    │ │ │ │ +00028760: 3c64 6976 2063 6c61 7373 3d22 7474 6e61
    Dune │ │ │ │ +000287b0: 3a3a 4669 656c 6454 7261 6974 733a 3a66 ::FieldTraits::f │ │ │ │ +000287c0: 6965 6c64 5f74 7970 653c 2f61 3e3c 2f64 ield_type
    T field_t │ │ │ │ +000287f0: 7970 653c 2f64 6976 3e3c 6469 7620 636c ype
    expo │ │ │ │ +00028810: 7274 2074 6865 2074 7970 6520 7265 7072 rt the type repr │ │ │ │ +00028820: 6573 656e 7469 6e67 2074 6865 2066 6965 esenting the fie │ │ │ │ +00028830: 6c64 3c2f 6469 763e 3c64 6976 2063 6c61 ld
    De │ │ │ │ +00028850: 6669 6e69 7469 6f6e 3c2f 623e 2066 7472 finition ftr │ │ │ │ +00028860: 6169 7473 2e68 683a 3238 3c2f 6469 763e aits.hh:28
    │ │ │ │ +00028870: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    T real_type
    export the │ │ │ │ +00028970: 2074 7970 6520 7265 7072 6573 656e 7469 type representi │ │ │ │ +00028980: 6e67 2074 6865 2072 6561 6c20 7479 7065 ng the real type │ │ │ │ +00028990: 206f 6620 7468 6520 6669 656c 643c 2f64 of the field
    Definit │ │ │ │ +000289c0: 696f 6e3c 2f62 3e20 6674 7261 6974 732e ion ftraits. │ │ │ │ +000289d0: 6868 3a33 303c 2f64 6976 3e3c 2f64 6976 hh:30
    .
    │ │ │ │ +00028a50: 3c64 6976 2063 6c61 7373 3d22 7474 6465
    Definition │ │ │ │ +00028a70: 3c2f 623e 206d 6174 7665 6374 7261 6974 matvectrait │ │ │ │ +00028a80: 732e 6868 3a33 313c 2f64 6976 3e3c 2f64 s.hh:31
    .
    Dune::Promo │ │ │ │ +00028b30: 7469 6f6e 5472 6169 7473 3a3a 5072 6f6d tionTraits::Prom │ │ │ │ +00028b40: 6f74 6564 5479 7065 3c2f 613e 3c2f 6469 otedType
    decltype(s │ │ │ │ +00028b70: 7464 3a3a 6465 636c 7661 6c26 6c74 3b20 td::declval< │ │ │ │ +00028b80: 5431 2026 6774 3b28 292b 7374 643a 3a64 T1 >()+std::d │ │ │ │ +00028b90: 6563 6c76 616c 266c 743b 2054 3220 2667 eclval< T2 &g │ │ │ │ +00028ba0: 743b 2829 2920 5072 6f6d 6f74 6564 5479 t;()) PromotedTy │ │ │ │ +00028bb0: 7065 3c2f 6469 763e 3c64 6976 2063 6c61 pe
    De │ │ │ │ +00028bd0: 6669 6e69 7469 6f6e 3c2f 623e 2070 726f finition pro │ │ │ │ +00028be0: 6d6f 7469 6f6e 7472 6169 7473 2e68 683a motiontraits.hh: │ │ │ │ +00028bf0: 3238 3c2f 6469 763e 3c2f 6469 763e 0a3c 28
    .< │ │ │ │ +00028c00: 2f64 6976 3e3c 212d 2d20 6672 6167 6d65 /div>
    ..
    .Gen │ │ │ │ +00028c80: 6572 6174 6564 2062 7926 2331 3630 3b3c erated by < │ │ │ │ +00028c90: 6120 6872 6566 3d22 6874 7470 733a 2f2f a href="https:// │ │ │ │ +00028ca0: 7777 772e 646f 7879 6765 6e2e 6f72 672f www.doxygen.org/ │ │ │ │ +00028cb0: 696e 6465 782e 6874 6d6c 223e 3c69 6d67 index.html">d
│ │ │ │ +00028d00: 6f78 7967 656e 222f 3e3c 2f61 3e20 312e  oxygen 1. │ │ │ │ +00028d10: 392e 380a 3c2f 736d 616c 6c3e 3c2f 6164 9.8...< │ │ │ │ +00028d30: 2f68 746d 6c3e 0a /html>. │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,298 +1,1059 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -float_cmp.hh │ │ │ │ │ +fmatrix.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_FLOAT_CMP_HH │ │ │ │ │ -6#define DUNE_COMMON_FLOAT_CMP_HH │ │ │ │ │ +5#ifndef DUNE_FMATRIX_HH │ │ │ │ │ +6#define DUNE_FMATRIX_HH │ │ │ │ │ 7 │ │ │ │ │ -97namespace _D_u_n_e { │ │ │ │ │ -100 namespace FloatCmp { │ │ │ │ │ -101 // basic constants │ │ │ │ │ -_1_0_4 enum _C_m_p_S_t_y_l_e { │ │ │ │ │ -_1_0_6 _r_e_l_a_t_i_v_e_W_e_a_k, │ │ │ │ │ -_1_0_8 _r_e_l_a_t_i_v_e_S_t_r_o_n_g, │ │ │ │ │ -_1_1_0 _a_b_s_o_l_u_t_e, │ │ │ │ │ -112 _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e = _r_e_l_a_t_i_v_e_W_e_a_k │ │ │ │ │ -_1_1_3 }; │ │ │ │ │ -_1_1_6 enum _R_o_u_n_d_i_n_g_S_t_y_l_e { │ │ │ │ │ -_1_1_8 _t_o_w_a_r_d_Z_e_r_o, │ │ │ │ │ -_1_2_0 _t_o_w_a_r_d_I_n_f, │ │ │ │ │ -_1_2_2 _d_o_w_n_w_a_r_d, │ │ │ │ │ -_1_2_4 _u_p_w_a_r_d, │ │ │ │ │ -126 _d_e_f_a_u_l_t_R_o_u_n_d_i_n_g_S_t_y_l_e = _t_o_w_a_r_d_Z_e_r_o │ │ │ │ │ -_1_2_7 }; │ │ │ │ │ -128 │ │ │ │ │ -129 template struct EpsilonType; │ │ │ │ │ -130 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13 │ │ │ │ │ +14#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +16#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_e_c_i_s_i_o_n_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_r_i_x_c_o_n_c_e_p_t_s_._h_h> │ │ │ │ │ +22 │ │ │ │ │ +23namespace _D_u_n_e │ │ │ │ │ +24{ │ │ │ │ │ +25 │ │ │ │ │ +26 namespace Impl │ │ │ │ │ +27 { │ │ │ │ │ +28 │ │ │ │ │ +29 template │ │ │ │ │ +30 class ColumnVectorView │ │ │ │ │ +31 { │ │ │ │ │ +32 public: │ │ │ │ │ +33 │ │ │ │ │ +34 using value_type = typename M::value_type; │ │ │ │ │ +35 using size_type = typename M::size_type; │ │ │ │ │ +36 │ │ │ │ │ +37 constexpr ColumnVectorView(M& matrix, size_type col) : │ │ │ │ │ +38 matrix_(matrix), │ │ │ │ │ +39 col_(col) │ │ │ │ │ +40 {} │ │ │ │ │ +41 │ │ │ │ │ +42 constexpr size_type N () const { │ │ │ │ │ +43 return matrix_.N(); │ │ │ │ │ +44 } │ │ │ │ │ +45 │ │ │ │ │ +46 template and not std::is_const_v, int> = 0> │ │ │ │ │ +48 constexpr value_type& operator[] (size_type row) { │ │ │ │ │ +49 return matrix_[row][col_]; │ │ │ │ │ +50 } │ │ │ │ │ +51 │ │ │ │ │ +52 constexpr const value_type& operator[] (size_type row) const { │ │ │ │ │ +53 return matrix_[row][col_]; │ │ │ │ │ +54 } │ │ │ │ │ +55 │ │ │ │ │ +56 protected: │ │ │ │ │ +57 M& matrix_; │ │ │ │ │ +58 const size_type col_; │ │ │ │ │ +59 }; │ │ │ │ │ +60 │ │ │ │ │ +61 } │ │ │ │ │ +62 │ │ │ │ │ +63 template │ │ │ │ │ +64 struct FieldTraits< Impl::ColumnVectorView > │ │ │ │ │ +65 { │ │ │ │ │ +66 using _f_i_e_l_d___t_y_p_e = typename _F_i_e_l_d_T_r_a_i_t_s_<_M_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +67 using _r_e_a_l___t_y_p_e = typename _F_i_e_l_d_T_r_a_i_t_s_<_M_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +68 }; │ │ │ │ │ +69 │ │ │ │ │ +81 template< class K, int ROWS, int COLS = ROWS > class FieldMatrix; │ │ │ │ │ +82 │ │ │ │ │ +83 │ │ │ │ │ +84 template< class K, int ROWS, int COLS > │ │ │ │ │ +_8_5 struct _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s< _F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ │ +86 { │ │ │ │ │ +_8_7 typedef _F_i_e_l_d_M_a_t_r_i_x_<_K_,_R_O_W_S_,_C_O_L_S_> _d_e_r_i_v_e_d___t_y_p_e; │ │ │ │ │ +88 │ │ │ │ │ +89 // each row is implemented by a field vector │ │ │ │ │ +_9_0 typedef _F_i_e_l_d_V_e_c_t_o_r_<_K_,_C_O_L_S_> _r_o_w___t_y_p_e; │ │ │ │ │ +91 │ │ │ │ │ +_9_2 typedef _r_o_w___t_y_p_e &_r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_9_3 typedef const _r_o_w___t_y_p_e &_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +94 │ │ │ │ │ +_9_5 typedef std::array _c_o_n_t_a_i_n_e_r___t_y_p_e; │ │ │ │ │ +_9_6 typedef K _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_9_7 typedef typename container_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +98 }; │ │ │ │ │ +99 │ │ │ │ │ +100 template< class K, int ROWS, int COLS > │ │ │ │ │ +_1_0_1 struct _F_i_e_l_d_T_r_a_i_t_s< _F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ │ +102 { │ │ │ │ │ +_1_0_3 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_0_4 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ +105 }; │ │ │ │ │ +106 │ │ │ │ │ +115 template │ │ │ │ │ +_1_1_6 class _F_i_e_l_d_M_a_t_r_i_x : public _D_e_n_s_e_M_a_t_r_i_x< FieldMatrix > │ │ │ │ │ +117 { │ │ │ │ │ +118 std::array< FieldVector, ROWS > _data; │ │ │ │ │ +119 typedef _D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_K_,_R_O_W_S_,_C_O_L_S_> > _B_a_s_e; │ │ │ │ │ +120 public: │ │ │ │ │ +121 │ │ │ │ │ +_1_2_3 constexpr static int _r_o_w_s = ROWS; │ │ │ │ │ +_1_2_5 constexpr static int _c_o_l_s = COLS; │ │ │ │ │ +126 │ │ │ │ │ +_1_2_7 typedef typename _B_a_s_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +_1_2_8 typedef typename _B_a_s_e_:_:_r_o_w___t_y_p_e _r_o_w___t_y_p_e; │ │ │ │ │ +129 │ │ │ │ │ +_1_3_0 typedef typename _B_a_s_e_:_:_r_o_w___r_e_f_e_r_e_n_c_e _r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_1_3_1 typedef typename _B_a_s_e_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e _c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ 132 │ │ │ │ │ -137 template │ │ │ │ │ -_1_3_8 struct _D_e_f_a_u_l_t_E_p_s_i_l_o_n { │ │ │ │ │ -_1_4_0 static typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e _v_a_l_u_e(); │ │ │ │ │ -141 }; │ │ │ │ │ -142 │ │ │ │ │ -143 // operations in functional style │ │ │ │ │ -144 │ │ │ │ │ -147 │ │ │ │ │ -149 │ │ │ │ │ -156 template │ │ │ │ │ -157 bool _e_q(const T &first, │ │ │ │ │ -158 const T &second, │ │ │ │ │ -159 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ -161 │ │ │ │ │ -169 template │ │ │ │ │ -170 bool _n_e(const T &first, │ │ │ │ │ -171 const T &second, │ │ │ │ │ -172 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ -174 │ │ │ │ │ -185 template │ │ │ │ │ -186 bool _g_t(const T &first, │ │ │ │ │ -187 const T &second, │ │ │ │ │ -188 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ -190 │ │ │ │ │ -201 template │ │ │ │ │ -202 bool _l_t(const T &first, │ │ │ │ │ -203 const T &second, │ │ │ │ │ -204 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ -206 │ │ │ │ │ -217 template │ │ │ │ │ -218 bool _g_e(const T &first, │ │ │ │ │ -219 const T &second, │ │ │ │ │ -220 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ +133 //===== constructors │ │ │ │ │ +_1_3_6 constexpr _F_i_e_l_d_M_a_t_r_i_x() = default; │ │ │ │ │ +137 │ │ │ │ │ +_1_4_0 _F_i_e_l_d_M_a_t_r_i_x(std::initializer_list<_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _c_o_l_s_> > const &l) { │ │ │ │ │ +141 assert(l.size() == _r_o_w_s); // Actually, this is not needed any more! │ │ │ │ │ +142 std::copy_n(l.begin(), std::min(static_cast(ROWS), │ │ │ │ │ +143 l.size()), │ │ │ │ │ +144 _data.begin()); │ │ │ │ │ +145 } │ │ │ │ │ +146 │ │ │ │ │ +147 template ::value>> │ │ │ │ │ +_1_4_9 _F_i_e_l_d_M_a_t_r_i_x(T const& rhs) │ │ │ │ │ +150 { │ │ │ │ │ +151 *this = rhs; │ │ │ │ │ +152 } │ │ │ │ │ +153 │ │ │ │ │ +154 using Base::operator=; │ │ │ │ │ +155 │ │ │ │ │ +_1_5_7 _F_i_e_l_d_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=(const _F_i_e_l_d_M_a_t_r_i_x&) = default; │ │ │ │ │ +158 │ │ │ │ │ +160 template │ │ │ │ │ +_1_6_1 _F_i_e_l_d_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=(const _F_i_e_l_d_M_a_t_r_i_x_<_T_,_ _R_O_W_S_,_ _C_O_L_S_>& x) │ │ │ │ │ +162 { │ │ │ │ │ +163 _data = x._data; │ │ │ │ │ +164 return *this; │ │ │ │ │ +165 } │ │ │ │ │ +166 │ │ │ │ │ +168 template │ │ │ │ │ +_1_6_9 _F_i_e_l_d_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=(_F_i_e_l_d_M_a_t_r_i_x_<_T_,_r_o_w_s_,_c_o_l_s_> const&) = delete; │ │ │ │ │ +170 │ │ │ │ │ +_1_7_2 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _C_O_L_S_,_ _R_O_W_S_> _t_r_a_n_s_p_o_s_e_d() const │ │ │ │ │ +173 { │ │ │ │ │ +174 _D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _C_O_L_S_,_ _R_O_W_S_> AT; │ │ │ │ │ +175 for( int i = 0; i < ROWS; ++i ) │ │ │ │ │ +176 for( int j = 0; j < COLS; ++j ) │ │ │ │ │ +177 AT[j][i] = (*this)[i][j]; │ │ │ │ │ +178 return AT; │ │ │ │ │ +179 } │ │ │ │ │ +180 │ │ │ │ │ +182 template │ │ │ │ │ +_1_8_3 friend auto _o_p_e_r_a_t_o_r_+_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +184 const _F_i_e_l_d_M_a_t_r_i_x_<_O_t_h_e_r_S_c_a_l_a_r_,_R_O_W_S_,_C_O_L_S_>& matrixB) │ │ │ │ │ +185 { │ │ │ │ │ +186 _F_i_e_l_d_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_O_t_h_e_r_S_c_a_l_a_r_>_:_: │ │ │ │ │ +_P_r_o_m_o_t_e_d_T_y_p_e,ROWS,COLS> result; │ │ │ │ │ +187 │ │ │ │ │ +188 for (_s_i_z_e___t_y_p_e i = 0; i < ROWS; ++i) │ │ │ │ │ +189 for (_s_i_z_e___t_y_p_e j = 0; j < COLS; ++j) │ │ │ │ │ +190 result[i][j] = matrixA[i][j] + matrixB[i][j]; │ │ │ │ │ +191 │ │ │ │ │ +192 return result; │ │ │ │ │ +193 } │ │ │ │ │ +194 │ │ │ │ │ +196 template │ │ │ │ │ +_1_9_7 friend auto _o_p_e_r_a_t_o_r_-_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +198 const _F_i_e_l_d_M_a_t_r_i_x_<_O_t_h_e_r_S_c_a_l_a_r_,_R_O_W_S_,_C_O_L_S_>& matrixB) │ │ │ │ │ +199 { │ │ │ │ │ +200 _F_i_e_l_d_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_O_t_h_e_r_S_c_a_l_a_r_>_:_: │ │ │ │ │ +_P_r_o_m_o_t_e_d_T_y_p_e,ROWS,COLS> result; │ │ │ │ │ +201 │ │ │ │ │ +202 for (_s_i_z_e___t_y_p_e i = 0; i < ROWS; ++i) │ │ │ │ │ +203 for (_s_i_z_e___t_y_p_e j = 0; j < COLS; ++j) │ │ │ │ │ +204 result[i][j] = matrixA[i][j] - matrixB[i][j]; │ │ │ │ │ +205 │ │ │ │ │ +206 return result; │ │ │ │ │ +207 } │ │ │ │ │ +208 │ │ │ │ │ +210 template ::value, int> = 0> │ │ │ │ │ +_2_1_2 friend auto _o_p_e_r_a_t_o_r_*_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrix, Scalar scalar) │ │ │ │ │ +213 { │ │ │ │ │ +214 _F_i_e_l_d_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_S_c_a_l_a_r_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e,ROWS,COLS> │ │ │ │ │ +result; │ │ │ │ │ +215 │ │ │ │ │ +216 for (_s_i_z_e___t_y_p_e i = 0; i < ROWS; ++i) │ │ │ │ │ +217 for (_s_i_z_e___t_y_p_e j = 0; j < COLS; ++j) │ │ │ │ │ +218 result[i][j] = matrix[i][j] * scalar; │ │ │ │ │ +219 │ │ │ │ │ +220 return result; │ │ │ │ │ +221 } │ │ │ │ │ 222 │ │ │ │ │ -233 template │ │ │ │ │ -234 bool _l_e(const T &first, │ │ │ │ │ -235 const T &second, │ │ │ │ │ -236 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ -237 │ │ │ │ │ -238 // rounding operations │ │ │ │ │ -240 │ │ │ │ │ -253 template │ │ │ │ │ -254 I _r_o_u_n_d(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ -255 // truncation │ │ │ │ │ -257 │ │ │ │ │ -270 template │ │ │ │ │ -271 I _t_r_u_n_c(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e()); │ │ │ │ │ -272 │ │ │ │ │ -274 // group FloatCmp │ │ │ │ │ -275 } //namespace FloatCmp │ │ │ │ │ -276 │ │ │ │ │ -277 │ │ │ │ │ -278 // oo interface │ │ │ │ │ -280 │ │ │ │ │ -286 template │ │ │ │ │ -_2_8_8 class _F_l_o_a_t_C_m_p_O_p_s { │ │ │ │ │ -289 typedef _F_l_o_a_t_C_m_p_:_:_C_m_p_S_t_y_l_e _C_m_p_S_t_y_l_e; │ │ │ │ │ -290 typedef _F_l_o_a_t_C_m_p_:_:_R_o_u_n_d_i_n_g_S_t_y_l_e _R_o_u_n_d_i_n_g_S_t_y_l_e; │ │ │ │ │ -291 │ │ │ │ │ -292 public: │ │ │ │ │ -293 // record template parameters │ │ │ │ │ -_2_9_5 static const _C_m_p_S_t_y_l_e _c_s_t_y_l_e = cstyle_; │ │ │ │ │ -_2_9_7 static const _R_o_u_n_d_i_n_g_S_t_y_l_e _r_s_t_y_l_e = rstyle_; │ │ │ │ │ -_2_9_9 typedef T _V_a_l_u_e_T_y_p_e; │ │ │ │ │ -301 │ │ │ │ │ -_3_0_4 typedef typename _F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e _E_p_s_i_l_o_n_T_y_p_e; │ │ │ │ │ -305 │ │ │ │ │ -306 private: │ │ │ │ │ -307 _E_p_s_i_l_o_n_T_y_p_e epsilon_; │ │ │ │ │ -308 │ │ │ │ │ -309 typedef _F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_E_p_s_i_l_o_n_T_y_p_e_,_ _c_s_t_y_l_e_> _D_e_f_a_u_l_t_E_p_s_i_l_o_n; │ │ │ │ │ -310 │ │ │ │ │ -311 public: │ │ │ │ │ +224 template ::value, int> = 0> │ │ │ │ │ +_2_2_6 friend auto _o_p_e_r_a_t_o_r_*_ ( Scalar scalar, const _F_i_e_l_d_M_a_t_r_i_x& matrix) │ │ │ │ │ +227 { │ │ │ │ │ +228 _F_i_e_l_d_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_S_c_a_l_a_r_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e,ROWS,COLS> │ │ │ │ │ +result; │ │ │ │ │ +229 │ │ │ │ │ +230 for (_s_i_z_e___t_y_p_e i = 0; i < ROWS; ++i) │ │ │ │ │ +231 for (_s_i_z_e___t_y_p_e j = 0; j < COLS; ++j) │ │ │ │ │ +232 result[i][j] = scalar * matrix[i][j]; │ │ │ │ │ +233 │ │ │ │ │ +234 return result; │ │ │ │ │ +235 } │ │ │ │ │ +236 │ │ │ │ │ +238 template ::value, int> = 0> │ │ │ │ │ +_2_4_0 friend auto _o_p_e_r_a_t_o_r_/_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrix, Scalar scalar) │ │ │ │ │ +241 { │ │ │ │ │ +242 _F_i_e_l_d_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_S_c_a_l_a_r_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e,ROWS,COLS> │ │ │ │ │ +result; │ │ │ │ │ +243 │ │ │ │ │ +244 for (_s_i_z_e___t_y_p_e i = 0; i < ROWS; ++i) │ │ │ │ │ +245 for (_s_i_z_e___t_y_p_e j = 0; j < COLS; ++j) │ │ │ │ │ +246 result[i][j] = matrix[i][j] / scalar; │ │ │ │ │ +247 │ │ │ │ │ +248 return result; │ │ │ │ │ +249 } │ │ │ │ │ +250 │ │ │ │ │ +253 template │ │ │ │ │ +_2_5_4 friend auto _o_p_e_r_a_t_o_r_*_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +255 const _F_i_e_l_d_M_a_t_r_i_x_<_O_t_h_e_r_S_c_a_l_a_r_,_ _C_O_L_S_,_ _o_t_h_e_r_C_o_l_s_>& matrixB) │ │ │ │ │ +256 { │ │ │ │ │ +257 _F_i_e_l_d_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_O_t_h_e_r_S_c_a_l_a_r_>_:_: │ │ │ │ │ +_P_r_o_m_o_t_e_d_T_y_p_e,ROWS,otherCols> result; │ │ │ │ │ +258 │ │ │ │ │ +259 for (_s_i_z_e___t_y_p_e i = 0; i < matrixA._m_a_t___r_o_w_s(); ++i) │ │ │ │ │ +260 for (_s_i_z_e___t_y_p_e j = 0; j < matrixB._m_a_t___c_o_l_s(); ++j) │ │ │ │ │ +261 { │ │ │ │ │ +262 result[i][j] = 0; │ │ │ │ │ +263 for (_s_i_z_e___t_y_p_e k = 0; k < matrixA._m_a_t___c_o_l_s(); ++k) │ │ │ │ │ +264 result[i][j] += matrixA[i][k] * matrixB[k][j]; │ │ │ │ │ +265 } │ │ │ │ │ +266 │ │ │ │ │ +267 return result; │ │ │ │ │ +268 } │ │ │ │ │ +269 │ │ │ │ │ +276 template │ │ │ │ │ +278 and not Impl::IsFieldMatrix_v │ │ │ │ │ +279 , int> = 0> │ │ │ │ │ +_2_8_0 friend auto _o_p_e_r_a_t_o_r_*_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +281 const OtherMatrix& matrixB) │ │ │ │ │ +282 { │ │ │ │ │ +283 using Field = typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_ _t_y_p_e_n_a_m_e_ _O_t_h_e_r_M_a_t_r_i_x_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +284 _D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_<_F_i_e_l_d_,_ _r_o_w_s_ _,_O_t_h_e_r_M_a_t_r_i_x_:_:_c_o_l_s_> result; │ │ │ │ │ +285 for (std::size_t j=0; j<_r_o_w_s; ++j) │ │ │ │ │ +286 matrixB._m_t_v(matrixA[j], result[j]); │ │ │ │ │ +287 return result; │ │ │ │ │ +288 } │ │ │ │ │ +289 │ │ │ │ │ +296 template │ │ │ │ │ +298 and not Impl::IsFieldMatrix_v │ │ │ │ │ +299 , int> = 0> │ │ │ │ │ +_3_0_0 friend auto _o_p_e_r_a_t_o_r_*_ ( const OtherMatrix& matrixA, │ │ │ │ │ +301 const _F_i_e_l_d_M_a_t_r_i_x& matrixB) │ │ │ │ │ +302 { │ │ │ │ │ +303 using Field = typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_ _t_y_p_e_n_a_m_e_ _O_t_h_e_r_M_a_t_r_i_x_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +304 _D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_<_F_i_e_l_d_,_ _O_t_h_e_r_M_a_t_r_i_x_:_:_r_o_w_s_,_ _c_o_l_s_> result; │ │ │ │ │ +305 for (std::size_t j=0; j<_c_o_l_s; ++j) │ │ │ │ │ +306 { │ │ │ │ │ +307 auto B_j = Impl::ColumnVectorView(matrixB, j); │ │ │ │ │ +308 auto result_j = Impl::ColumnVectorView(result, j); │ │ │ │ │ +309 matrixA.mv(B_j, result_j); │ │ │ │ │ +310 } │ │ │ │ │ +311 return result; │ │ │ │ │ +312 } │ │ │ │ │ 313 │ │ │ │ │ -316 _F_l_o_a_t_C_m_p_O_p_s(_E_p_s_i_l_o_n_T_y_p_e _e_p_s_i_l_o_n = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_:_:_v_a_l_u_e()); │ │ │ │ │ -317 │ │ │ │ │ -319 _E_p_s_i_l_o_n_T_y_p_e _e_p_s_i_l_o_n() const; │ │ │ │ │ -321 void _e_p_s_i_l_o_n(_E_p_s_i_l_o_n_T_y_p_e epsilon__); │ │ │ │ │ -322 │ │ │ │ │ -324 bool _e_q(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const; │ │ │ │ │ -326 │ │ │ │ │ -329 bool _n_e(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const; │ │ │ │ │ +315 template │ │ │ │ │ +_3_1_6 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_l_,_c_o_l_s_> _l_e_f_t_m_u_l_t_i_p_l_y_a_n_y (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_l_,_r_o_w_s_>& _M) │ │ │ │ │ +const │ │ │ │ │ +317 { │ │ │ │ │ +318 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_l_,_c_o_l_s_> C; │ │ │ │ │ +319 │ │ │ │ │ +320 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_3_3_4 _F_i_e_l_d_M_a_t_r_i_x& _r_i_g_h_t_m_u_l_t_i_p_l_y (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_,_c_>& _M) │ │ │ │ │ +335 { │ │ │ │ │ +336 static_assert(r == c, "Cannot rightmultiply with non-square matrix"); │ │ │ │ │ +337 static_assert(r == _c_o_l_s, "Size mismatch"); │ │ │ │ │ +338 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_> C(*this); │ │ │ │ │ +339 │ │ │ │ │ +340 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s; i++) │ │ │ │ │ +341 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s; j++) { │ │ │ │ │ +342 (*this)[i][j] = 0; │ │ │ │ │ +343 for (_s_i_z_e___t_y_p_e k=0; k<_c_o_l_s; k++) │ │ │ │ │ +344 (*this)[i][j] += C[i][k]*_M[k][j]; │ │ │ │ │ +345 } │ │ │ │ │ +346 return *this; │ │ │ │ │ +347 } │ │ │ │ │ +348 │ │ │ │ │ +350 template │ │ │ │ │ +_3_5_1 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_l_> _r_i_g_h_t_m_u_l_t_i_p_l_y_a_n_y (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_c_o_l_s_,_l_>& _M) │ │ │ │ │ +const │ │ │ │ │ +352 { │ │ │ │ │ +353 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_l_> C; │ │ │ │ │ 354 │ │ │ │ │ -356 │ │ │ │ │ -365 template │ │ │ │ │ -366 I _r_o_u_n_d(const _V_a_l_u_e_T_y_p_e &val) const; │ │ │ │ │ -367 │ │ │ │ │ -369 │ │ │ │ │ -378 template │ │ │ │ │ -379 I _t_r_u_n_c(const _V_a_l_u_e_T_y_p_e &val) const; │ │ │ │ │ -380 │ │ │ │ │ -381 }; │ │ │ │ │ -382 │ │ │ │ │ -383} //namespace Dune │ │ │ │ │ -384 │ │ │ │ │ -385#include "_f_l_o_a_t___c_m_p_._c_c" │ │ │ │ │ -386 │ │ │ │ │ -387#endif //DUNE_COMMON_FLOAT_CMP_HH │ │ │ │ │ -_f_l_o_a_t___c_m_p_._c_c │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_n_e │ │ │ │ │ -bool ne(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test for inequality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:151 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_C_m_p_S_t_y_l_e │ │ │ │ │ -CmpStyle │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_e_q │ │ │ │ │ -bool eq(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test for equality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:144 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_o_u_n_d │ │ │ │ │ -I round(const T &val, typename EpsilonType< T >::Type epsilon) │ │ │ │ │ -round using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:311 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_r_u_n_c │ │ │ │ │ -I trunc(const T &val, typename EpsilonType< T >::Type epsilon) │ │ │ │ │ -truncate using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:407 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_R_o_u_n_d_i_n_g_S_t_y_l_e │ │ │ │ │ -RoundingStyle │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_t │ │ │ │ │ -bool lt(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first lesser than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:165 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_t │ │ │ │ │ -bool gt(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first greater than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:158 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_e │ │ │ │ │ -bool ge(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first greater or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:172 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_e │ │ │ │ │ -bool le(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first lesser or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:179 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_d_e_f_a_u_l_t_C_m_p_S_t_y_l_e │ │ │ │ │ -@ defaultCmpStyle │ │ │ │ │ -the global default compare style (relative_weak) │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_e_l_a_t_i_v_e_S_t_r_o_n_g │ │ │ │ │ -@ relativeStrong │ │ │ │ │ -|a-b|/|a| <= epsilon && |a-b|/|b| <= epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:108 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_e_l_a_t_i_v_e_W_e_a_k │ │ │ │ │ -@ relativeWeak │ │ │ │ │ -|a-b|/|a| <= epsilon || |a-b|/|b| <= epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_a_b_s_o_l_u_t_e │ │ │ │ │ -@ absolute │ │ │ │ │ -|a-b| <= epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_o_w_a_r_d_Z_e_r_o │ │ │ │ │ -@ towardZero │ │ │ │ │ -always round toward 0 │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_o_w_a_r_d_I_n_f │ │ │ │ │ -@ towardInf │ │ │ │ │ -always round away from 0 │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_u_p_w_a_r_d │ │ │ │ │ -@ upward │ │ │ │ │ -round toward │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:124 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_d_o_w_n_w_a_r_d │ │ │ │ │ -@ downward │ │ │ │ │ -round toward │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:122 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_d_e_f_a_u_l_t_R_o_u_n_d_i_n_g_S_t_y_l_e │ │ │ │ │ -@ defaultRoundingStyle │ │ │ │ │ -the global default rounding style (toward_zero) │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:126 │ │ │ │ │ +355 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s; i++) { │ │ │ │ │ +356 for (_s_i_z_e___t_y_p_e j=0; j │ │ │ │ │ +386 class FieldMatrix : public DenseMatrix< FieldMatrix > │ │ │ │ │ +387 { │ │ │ │ │ +388 FieldVector _data; │ │ │ │ │ +389 typedef DenseMatrix< FieldMatrix > Base; │ │ │ │ │ +390 public: │ │ │ │ │ +391 // standard constructor and everything is sufficient ... │ │ │ │ │ +392 │ │ │ │ │ +393 //===== type definitions and constants │ │ │ │ │ +394 │ │ │ │ │ +396 typedef typename _B_a_s_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +397 │ │ │ │ │ +400 constexpr static int _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ +401 │ │ │ │ │ +402 typedef typename _B_a_s_e_:_:_r_o_w___t_y_p_e _r_o_w___t_y_p_e; │ │ │ │ │ +403 │ │ │ │ │ +404 typedef typename _B_a_s_e_:_:_r_o_w___r_e_f_e_r_e_n_c_e _r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +405 typedef typename _B_a_s_e_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e _c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +406 │ │ │ │ │ +409 constexpr static int _r_o_w_s = 1; │ │ │ │ │ +412 constexpr static int _c_o_l_s = 1; │ │ │ │ │ +413 │ │ │ │ │ +414 //===== constructors │ │ │ │ │ +417 constexpr _F_i_e_l_d_M_a_t_r_i_x() = default; │ │ │ │ │ +418 │ │ │ │ │ +421 _F_i_e_l_d_M_a_t_r_i_x(std::initializer_list<_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _1_>> const &l) │ │ │ │ │ +422 { │ │ │ │ │ +423 std::copy_n(l.begin(), std::min(static_cast< std::size_t >( 1 ), l.size()), │ │ │ │ │ +&_data); │ │ │ │ │ +424 } │ │ │ │ │ +425 │ │ │ │ │ +426 template ::value>> │ │ │ │ │ +428 _F_i_e_l_d_M_a_t_r_i_x(T const& rhs) │ │ │ │ │ +429 { │ │ │ │ │ +430 *this = rhs; │ │ │ │ │ +431 } │ │ │ │ │ +432 │ │ │ │ │ +433 using Base::operator=; │ │ │ │ │ +434 │ │ │ │ │ +436 FieldMatrix _t_r_a_n_s_p_o_s_e_d() const │ │ │ │ │ +437 { │ │ │ │ │ +438 return *this; │ │ │ │ │ +439 } │ │ │ │ │ +440 │ │ │ │ │ +442 template │ │ │ │ │ +443 friend auto _o_p_e_r_a_t_o_r_+_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +444 const FieldMatrix& matrixB) │ │ │ │ │ +445 { │ │ │ │ │ +446 return FieldMatrix:: │ │ │ │ │ +PromotedType,1,1>{matrixA[0][0] + matrixB[0][0]}; │ │ │ │ │ +447 } │ │ │ │ │ +448 │ │ │ │ │ +450 template ::value, int> = 0> │ │ │ │ │ +452 friend auto _o_p_e_r_a_t_o_r_+_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrix, │ │ │ │ │ +453 const Scalar& scalar) │ │ │ │ │ +454 { │ │ │ │ │ +455 return FieldMatrix::PromotedType,1,1> │ │ │ │ │ +{matrix[0][0] + scalar}; │ │ │ │ │ +456 } │ │ │ │ │ +457 │ │ │ │ │ +459 template ::value, int> = 0> │ │ │ │ │ +461 friend auto _o_p_e_r_a_t_o_r_+_ ( const Scalar& scalar, │ │ │ │ │ +462 const _F_i_e_l_d_M_a_t_r_i_x& matrix) │ │ │ │ │ +463 { │ │ │ │ │ +464 return FieldMatrix::PromotedType,1,1> │ │ │ │ │ +{scalar + matrix[0][0]}; │ │ │ │ │ +465 } │ │ │ │ │ +466 │ │ │ │ │ +468 template │ │ │ │ │ +469 friend auto _o_p_e_r_a_t_o_r_-_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +470 const FieldMatrix& matrixB) │ │ │ │ │ +471 { │ │ │ │ │ +472 return FieldMatrix:: │ │ │ │ │ +PromotedType,1,1>{matrixA[0][0] - matrixB[0][0]}; │ │ │ │ │ +473 } │ │ │ │ │ +474 │ │ │ │ │ +476 template ::value, int> = 0> │ │ │ │ │ +478 friend auto _o_p_e_r_a_t_o_r_-_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrix, │ │ │ │ │ +479 const Scalar& scalar) │ │ │ │ │ +480 { │ │ │ │ │ +481 return FieldMatrix::PromotedType,1,1> │ │ │ │ │ +{matrix[0][0] - scalar}; │ │ │ │ │ +482 } │ │ │ │ │ +483 │ │ │ │ │ +485 template ::value, int> = 0> │ │ │ │ │ +487 friend auto _o_p_e_r_a_t_o_r_-_ ( const Scalar& scalar, │ │ │ │ │ +488 const _F_i_e_l_d_M_a_t_r_i_x& matrix) │ │ │ │ │ +489 { │ │ │ │ │ +490 return FieldMatrix::PromotedType,1,1> │ │ │ │ │ +{scalar - matrix[0][0]}; │ │ │ │ │ +491 } │ │ │ │ │ +492 │ │ │ │ │ +494 template ::value, int> = 0> │ │ │ │ │ +496 friend auto _o_p_e_r_a_t_o_r_*_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrix, Scalar scalar) │ │ │ │ │ +497 { │ │ │ │ │ +498 return FieldMatrix::PromotedType,1,1> │ │ │ │ │ +{matrix[0][0] * scalar}; │ │ │ │ │ +499 } │ │ │ │ │ +500 │ │ │ │ │ +502 template ::value, int> = 0> │ │ │ │ │ +504 friend auto _o_p_e_r_a_t_o_r_*_ ( Scalar scalar, const _F_i_e_l_d_M_a_t_r_i_x& matrix) │ │ │ │ │ +505 { │ │ │ │ │ +506 return FieldMatrix::PromotedType,1,1> │ │ │ │ │ +{scalar * matrix[0][0]}; │ │ │ │ │ +507 } │ │ │ │ │ +508 │ │ │ │ │ +510 template ::value, int> = 0> │ │ │ │ │ +512 friend auto _o_p_e_r_a_t_o_r_/_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrix, Scalar scalar) │ │ │ │ │ +513 { │ │ │ │ │ +514 return FieldMatrix::PromotedType,1,1> │ │ │ │ │ +{matrix[0][0] / scalar}; │ │ │ │ │ +515 } │ │ │ │ │ +516 │ │ │ │ │ +517 //===== solve │ │ │ │ │ +518 │ │ │ │ │ +521 template │ │ │ │ │ +522 friend auto _o_p_e_r_a_t_o_r_*_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +523 const FieldMatrix& matrixB) │ │ │ │ │ +524 { │ │ │ │ │ +525 FieldMatrix:: │ │ │ │ │ +PromotedType,1,otherCols> result; │ │ │ │ │ +526 │ │ │ │ │ +527 for (_s_i_z_e___t_y_p_e j = 0; j < matrixB.mat_cols(); ++j) │ │ │ │ │ +528 result[0][j] = matrixA[0][0] * matrixB[0][j]; │ │ │ │ │ +529 │ │ │ │ │ +530 return result; │ │ │ │ │ +531 } │ │ │ │ │ +532 │ │ │ │ │ +539 template │ │ │ │ │ +541 and not Impl::IsFieldMatrix_v │ │ │ │ │ +542 and (OtherMatrix::rows==1) │ │ │ │ │ +543 , int> = 0> │ │ │ │ │ +544 friend auto _o_p_e_r_a_t_o_r_*_ ( const _F_i_e_l_d_M_a_t_r_i_x& matrixA, │ │ │ │ │ +545 const OtherMatrix& matrixB) │ │ │ │ │ +546 { │ │ │ │ │ +547 using Field = typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_ _t_y_p_e_n_a_m_e_ _O_t_h_e_r_M_a_t_r_i_x_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +548 _D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_<_F_i_e_l_d_,_ _r_o_w_s_ _,_O_t_h_e_r_M_a_t_r_i_x_:_:_c_o_l_s_> result; │ │ │ │ │ +549 for (std::size_t j=0; j<_r_o_w_s; ++j) │ │ │ │ │ +550 matrixB.mtv(matrixA[j], result[j]); │ │ │ │ │ +551 return result; │ │ │ │ │ +552 } │ │ │ │ │ +553 │ │ │ │ │ +560 template │ │ │ │ │ +562 and not Impl::IsFieldMatrix_v │ │ │ │ │ +563 and (OtherMatrix::cols==1) │ │ │ │ │ +564 , int> = 0> │ │ │ │ │ +565 friend auto _o_p_e_r_a_t_o_r_*_ ( const OtherMatrix& matrixA, │ │ │ │ │ +566 const _F_i_e_l_d_M_a_t_r_i_x& matrixB) │ │ │ │ │ +567 { │ │ │ │ │ +568 using Field = typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_ _t_y_p_e_n_a_m_e_ _O_t_h_e_r_M_a_t_r_i_x_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +569 _D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_<_F_i_e_l_d_,_ _O_t_h_e_r_M_a_t_r_i_x_:_:_r_o_w_s_,_ _c_o_l_s_> result; │ │ │ │ │ +570 for (std::size_t j=0; j<_c_o_l_s; ++j) │ │ │ │ │ +571 { │ │ │ │ │ +572 auto B_j = Impl::ColumnVectorView(matrixB, j); │ │ │ │ │ +573 auto result_j = Impl::ColumnVectorView(result, j); │ │ │ │ │ +574 matrixA.mv(B_j, result_j); │ │ │ │ │ +575 } │ │ │ │ │ +576 return result; │ │ │ │ │ +577 } │ │ │ │ │ +578 │ │ │ │ │ +580 template │ │ │ │ │ +581 FieldMatrix _l_e_f_t_m_u_l_t_i_p_l_y_a_n_y (const FieldMatrix& _M) const │ │ │ │ │ +582 { │ │ │ │ │ +583 FieldMatrix C; │ │ │ │ │ +584 for (_s_i_z_e___t_y_p_e j=0; j │ │ │ │ │ +598 FieldMatrix _r_i_g_h_t_m_u_l_t_i_p_l_y_a_n_y (const FieldMatrix& _M) const │ │ │ │ │ +599 { │ │ │ │ │ +600 FieldMatrix C; │ │ │ │ │ +601 │ │ │ │ │ +602 for (_s_i_z_e___t_y_p_e j=0; j │ │ │ │ │ +659 std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const FieldMatrix& a) │ │ │ │ │ +660 { │ │ │ │ │ +661 s << a[0][0]; │ │ │ │ │ +662 return s; │ │ │ │ │ +663 } │ │ │ │ │ +664 │ │ │ │ │ +665#endif // DOXYGEN │ │ │ │ │ +666 │ │ │ │ │ +_6_6_7 namespace FMatrixHelp { │ │ │ │ │ +668 │ │ │ │ │ +670 template │ │ │ │ │ +_6_7_1 static inline K _i_n_v_e_r_t_M_a_t_r_i_x (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_> &matrix, │ │ │ │ │ +_F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_> &inverse) │ │ │ │ │ +672 { │ │ │ │ │ +673 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +674 inverse[0][0] = real_type(1.0)/matrix[0][0]; │ │ │ │ │ +675 return matrix[0][0]; │ │ │ │ │ +676 } │ │ │ │ │ +677 │ │ │ │ │ +679 template │ │ │ │ │ +_6_8_0 static inline K _i_n_v_e_r_t_M_a_t_r_i_x___r_e_t_T_r_a_n_s_p_o_s_e_d (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_> │ │ │ │ │ +&matrix, _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_> &inverse) │ │ │ │ │ +681 { │ │ │ │ │ +682 return _i_n_v_e_r_t_M_a_t_r_i_x(matrix,inverse); │ │ │ │ │ +683 } │ │ │ │ │ +684 │ │ │ │ │ +685 │ │ │ │ │ +687 template │ │ │ │ │ +_6_8_8 static inline K _i_n_v_e_r_t_M_a_t_r_i_x (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_2_,_2_> &matrix, │ │ │ │ │ +_F_i_e_l_d_M_a_t_r_i_x_<_K_,_2_,_2_> &inverse) │ │ │ │ │ +689 { │ │ │ │ │ +690 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +691 // code generated by maple │ │ │ │ │ +692 K det = (matrix[0][0]*matrix[1][1] - matrix[0][1]*matrix[1][0]); │ │ │ │ │ +693 K det_1 = real_type(1.0)/det; │ │ │ │ │ +694 inverse[0][0] = matrix[1][1] * det_1; │ │ │ │ │ +695 inverse[0][1] = - matrix[0][1] * det_1; │ │ │ │ │ +696 inverse[1][0] = - matrix[1][0] * det_1; │ │ │ │ │ +697 inverse[1][1] = matrix[0][0] * det_1; │ │ │ │ │ +698 return det; │ │ │ │ │ +699 } │ │ │ │ │ +700 │ │ │ │ │ +703 template │ │ │ │ │ +_7_0_4 static inline K _i_n_v_e_r_t_M_a_t_r_i_x___r_e_t_T_r_a_n_s_p_o_s_e_d (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_2_,_2_> │ │ │ │ │ +&matrix, _F_i_e_l_d_M_a_t_r_i_x_<_K_,_2_,_2_> &inverse) │ │ │ │ │ +705 { │ │ │ │ │ +706 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +707 // code generated by maple │ │ │ │ │ +708 K det = (matrix[0][0]*matrix[1][1] - matrix[0][1]*matrix[1][0]); │ │ │ │ │ +709 K det_1 = real_type(1.0)/det; │ │ │ │ │ +710 inverse[0][0] = matrix[1][1] * det_1; │ │ │ │ │ +711 inverse[1][0] = - matrix[0][1] * det_1; │ │ │ │ │ +712 inverse[0][1] = - matrix[1][0] * det_1; │ │ │ │ │ +713 inverse[1][1] = matrix[0][0] * det_1; │ │ │ │ │ +714 return det; │ │ │ │ │ +715 } │ │ │ │ │ +716 │ │ │ │ │ +718 template │ │ │ │ │ +_7_1_9 static inline K _i_n_v_e_r_t_M_a_t_r_i_x (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_3_,_3_> &matrix, │ │ │ │ │ +_F_i_e_l_d_M_a_t_r_i_x_<_K_,_3_,_3_> &inverse) │ │ │ │ │ +720 { │ │ │ │ │ +721 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +722 // code generated by maple │ │ │ │ │ +723 K t4 = matrix[0][0] * matrix[1][1]; │ │ │ │ │ +724 K t6 = matrix[0][0] * matrix[1][2]; │ │ │ │ │ +725 K t8 = matrix[0][1] * matrix[1][0]; │ │ │ │ │ +726 K t10 = matrix[0][2] * matrix[1][0]; │ │ │ │ │ +727 K t12 = matrix[0][1] * matrix[2][0]; │ │ │ │ │ +728 K t14 = matrix[0][2] * matrix[2][0]; │ │ │ │ │ +729 │ │ │ │ │ +730 K det = (t4*matrix[2][2]-t6*matrix[2][1]-t8*matrix[2][2]+ │ │ │ │ │ +731 t10*matrix[2][1]+t12*matrix[1][2]-t14*matrix[1][1]); │ │ │ │ │ +732 K t17 = real_type(1.0)/det; │ │ │ │ │ +733 │ │ │ │ │ +734 inverse[0][0] = (matrix[1][1] * matrix[2][2] - matrix[1][2] * matrix[2] │ │ │ │ │ +[1])*t17; │ │ │ │ │ +735 inverse[0][1] = -(matrix[0][1] * matrix[2][2] - matrix[0][2] * matrix[2] │ │ │ │ │ +[1])*t17; │ │ │ │ │ +736 inverse[0][2] = (matrix[0][1] * matrix[1][2] - matrix[0][2] * matrix[1] │ │ │ │ │ +[1])*t17; │ │ │ │ │ +737 inverse[1][0] = -(matrix[1][0] * matrix[2][2] - matrix[1][2] * matrix[2] │ │ │ │ │ +[0])*t17; │ │ │ │ │ +738 inverse[1][1] = (matrix[0][0] * matrix[2][2] - t14) * t17; │ │ │ │ │ +739 inverse[1][2] = -(t6-t10) * t17; │ │ │ │ │ +740 inverse[2][0] = (matrix[1][0] * matrix[2][1] - matrix[1][1] * matrix[2][0]) │ │ │ │ │ +* t17; │ │ │ │ │ +741 inverse[2][1] = -(matrix[0][0] * matrix[2][1] - t12) * t17; │ │ │ │ │ +742 inverse[2][2] = (t4-t8) * t17; │ │ │ │ │ +743 │ │ │ │ │ +744 return det; │ │ │ │ │ +745 } │ │ │ │ │ +746 │ │ │ │ │ +748 template │ │ │ │ │ +_7_4_9 static inline K _i_n_v_e_r_t_M_a_t_r_i_x___r_e_t_T_r_a_n_s_p_o_s_e_d (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_3_,_3_> │ │ │ │ │ +&matrix, _F_i_e_l_d_M_a_t_r_i_x_<_K_,_3_,_3_> &inverse) │ │ │ │ │ +750 { │ │ │ │ │ +751 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +752 // code generated by maple │ │ │ │ │ +753 K t4 = matrix[0][0] * matrix[1][1]; │ │ │ │ │ +754 K t6 = matrix[0][0] * matrix[1][2]; │ │ │ │ │ +755 K t8 = matrix[0][1] * matrix[1][0]; │ │ │ │ │ +756 K t10 = matrix[0][2] * matrix[1][0]; │ │ │ │ │ +757 K t12 = matrix[0][1] * matrix[2][0]; │ │ │ │ │ +758 K t14 = matrix[0][2] * matrix[2][0]; │ │ │ │ │ +759 │ │ │ │ │ +760 K det = (t4*matrix[2][2]-t6*matrix[2][1]-t8*matrix[2][2]+ │ │ │ │ │ +761 t10*matrix[2][1]+t12*matrix[1][2]-t14*matrix[1][1]); │ │ │ │ │ +762 K t17 = real_type(1.0)/det; │ │ │ │ │ +763 │ │ │ │ │ +764 inverse[0][0] = (matrix[1][1] * matrix[2][2] - matrix[1][2] * matrix[2] │ │ │ │ │ +[1])*t17; │ │ │ │ │ +765 inverse[1][0] = -(matrix[0][1] * matrix[2][2] - matrix[0][2] * matrix[2] │ │ │ │ │ +[1])*t17; │ │ │ │ │ +766 inverse[2][0] = (matrix[0][1] * matrix[1][2] - matrix[0][2] * matrix[1] │ │ │ │ │ +[1])*t17; │ │ │ │ │ +767 inverse[0][1] = -(matrix[1][0] * matrix[2][2] - matrix[1][2] * matrix[2] │ │ │ │ │ +[0])*t17; │ │ │ │ │ +768 inverse[1][1] = (matrix[0][0] * matrix[2][2] - t14) * t17; │ │ │ │ │ +769 inverse[2][1] = -(t6-t10) * t17; │ │ │ │ │ +770 inverse[0][2] = (matrix[1][0] * matrix[2][1] - matrix[1][1] * matrix[2][0]) │ │ │ │ │ +* t17; │ │ │ │ │ +771 inverse[1][2] = -(matrix[0][0] * matrix[2][1] - t12) * t17; │ │ │ │ │ +772 inverse[2][2] = (t4-t8) * t17; │ │ │ │ │ +773 │ │ │ │ │ +774 return det; │ │ │ │ │ +775 } │ │ │ │ │ +776 │ │ │ │ │ +778 template< class K, int m, int n, int p > │ │ │ │ │ +_7_7_9 static inline void _m_u_l_t_M_a_t_r_i_x ( const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &A, │ │ │ │ │ +780 const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _p_ _> &B, │ │ │ │ │ +781 _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _p_ _> &ret ) │ │ │ │ │ +782 { │ │ │ │ │ +783 typedef typename _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _p_ _> :: size_type size_type; │ │ │ │ │ +784 │ │ │ │ │ +785 for( size_type i = 0; i < m; ++i ) │ │ │ │ │ +786 { │ │ │ │ │ +787 for( size_type j = 0; j < p; ++j ) │ │ │ │ │ +788 { │ │ │ │ │ +789 ret[ i ][ j ] = K( 0 ); │ │ │ │ │ +790 for( size_type k = 0; k < n; ++k ) │ │ │ │ │ +791 ret[ i ][ j ] += A[ i ][ k ] * B[ k ][ j ]; │ │ │ │ │ +792 } │ │ │ │ │ +793 } │ │ │ │ │ +794 } │ │ │ │ │ +795 │ │ │ │ │ +797 template │ │ │ │ │ +_7_9_8 static inline void _m_u_l_t_T_r_a_n_s_p_o_s_e_d_M_a_t_r_i_x(const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_> │ │ │ │ │ +&matrix, _F_i_e_l_d_M_a_t_r_i_x_<_K_,_c_o_l_s_,_c_o_l_s_>& ret) │ │ │ │ │ +799 { │ │ │ │ │ +800 typedef typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_>_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ +801 │ │ │ │ │ +802 for(size_type i=0; i │ │ │ │ │ +_8_1_5 static inline void _m_u_l_t_A_s_s_i_g_n_T_r_a_n_s_p_o_s_e_d( const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_> │ │ │ │ │ +&matrix, const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_r_o_w_s_> & x, _F_i_e_l_d_V_e_c_t_o_r_<_K_,_c_o_l_s_> & ret) │ │ │ │ │ +816 { │ │ │ │ │ +817 typedef typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_>_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ +818 │ │ │ │ │ +819 for(size_type i=0; i │ │ │ │ │ +_8_2_9 static inline _F_i_e_l_d_V_e_c_t_o_r_<_K_,_r_o_w_s_> _m_u_l_t(const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_> │ │ │ │ │ +&matrix, const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_c_o_l_s_> & x) │ │ │ │ │ +830 { │ │ │ │ │ +831 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_r_o_w_s_> ret; │ │ │ │ │ +832 multAssign(matrix,x,ret); │ │ │ │ │ +833 return ret; │ │ │ │ │ +834 } │ │ │ │ │ +835 │ │ │ │ │ +837 template │ │ │ │ │ +_8_3_8 static inline _F_i_e_l_d_V_e_c_t_o_r_<_K_,_c_o_l_s_> _m_u_l_t_T_r_a_n_s_p_o_s_e_d(const │ │ │ │ │ +_F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_> &matrix, const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_r_o_w_s_> & x) │ │ │ │ │ +839 { │ │ │ │ │ +840 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_c_o_l_s_> ret; │ │ │ │ │ +841 _m_u_l_t_A_s_s_i_g_n_T_r_a_n_s_p_o_s_e_d( matrix, x, ret ); │ │ │ │ │ +842 return ret; │ │ │ │ │ +843 } │ │ │ │ │ +844 │ │ │ │ │ +845 } // end namespace FMatrixHelp │ │ │ │ │ +846 │ │ │ │ │ +849} // end namespace │ │ │ │ │ +850 │ │ │ │ │ +851#include "_f_m_a_t_r_i_x_e_v_._h_h" │ │ │ │ │ +852#endif │ │ │ │ │ +_m_a_t_r_i_x_c_o_n_c_e_p_t_s_._h_h │ │ │ │ │ +_d_e_n_s_e_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implements a matrix constructed from a given type representing a field and a │ │ │ │ │ +compile-time given numbe... │ │ │ │ │ +_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ +Macro for wrapping boundary checks. │ │ │ │ │ +_f_v_e_c_t_o_r_._h_h │ │ │ │ │ +Implements a vector constructed from a given type representing a field and a │ │ │ │ │ +compile-time given size. │ │ │ │ │ +_f_m_a_t_r_i_x_e_v_._h_h │ │ │ │ │ +Eigenvalue computations for the FieldMatrix class. │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h │ │ │ │ │ +Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ +number types. │ │ │ │ │ +_p_r_e_c_i_s_i_o_n_._h_h │ │ │ │ │ +Various precision settings for calculations with FieldMatrix and FieldVector. │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ +#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ +If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ +nothing. │ │ │ │ │ +DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ +typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ +Element type of some SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_:_:_T_y_p_e │ │ │ │ │ -T Type │ │ │ │ │ -The epsilon type corresponding to value type T. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:25 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n │ │ │ │ │ -mapping from a value type and a compare style to a default epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:138 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_:_:_v_a_l_u_e │ │ │ │ │ -static EpsilonType< T >::Type value() │ │ │ │ │ -Returns the default epsilon for the given value type and compare style. │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s │ │ │ │ │ -Class encapsulating a default epsilon. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:288 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_l_e │ │ │ │ │ -bool le(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first lesser or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:486 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_e_q │ │ │ │ │ -bool eq(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test for equality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:451 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_c_s_t_y_l_e │ │ │ │ │ -static const CmpStyle cstyle │ │ │ │ │ -How comparisons are done. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:295 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_l_t │ │ │ │ │ -bool lt(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first lesser than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:472 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_g_e │ │ │ │ │ -bool ge(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first greater or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:479 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_r_s_t_y_l_e │ │ │ │ │ -static const RoundingStyle rstyle │ │ │ │ │ -How rounding is done. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:297 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_E_p_s_i_l_o_n_T_y_p_e │ │ │ │ │ -FloatCmp::EpsilonType< T >::Type EpsilonType │ │ │ │ │ -Type of the epsilon. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:304 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_n_e │ │ │ │ │ -bool ne(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test for inequality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:458 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -T ValueType │ │ │ │ │ -Type of the values to compare. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_e_p_s_i_l_o_n │ │ │ │ │ -EpsilonType epsilon() const │ │ │ │ │ -return the current epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:436 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_r_o_u_n_d │ │ │ │ │ -I round(const ValueType &val) const │ │ │ │ │ -round using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:495 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_t_r_u_n_c │ │ │ │ │ -I trunc(const ValueType &val) const │ │ │ │ │ -truncate using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:503 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_g_t │ │ │ │ │ -bool gt(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first greater than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:465 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_A_s_s_i_g_n │ │ │ │ │ +static void multAssign(const DenseMatrix< MAT > &matrix, const DenseVector< V1 │ │ │ │ │ +> &x, DenseVector< V2 > &ret) │ │ │ │ │ +calculates ret = matrix * x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:1169 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_T_r_a_n_s_p_o_s_e_d │ │ │ │ │ +static FieldVector< K, cols > multTransposed(const FieldMatrix< K, rows, cols > │ │ │ │ │ +&matrix, const FieldVector< K, rows > &x) │ │ │ │ │ +calculates ret = matrix^T * x │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:838 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x___r_e_t_T_r_a_n_s_p_o_s_e_d │ │ │ │ │ +static K invertMatrix_retTransposed(const FieldMatrix< K, 1, 1 > &matrix, │ │ │ │ │ +FieldMatrix< K, 1, 1 > &inverse) │ │ │ │ │ +invert scalar without changing the original matrix │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:680 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_M_a_t_r_i_x │ │ │ │ │ +static void multMatrix(const FieldMatrix< K, m, n > &A, const FieldMatrix< K, │ │ │ │ │ +n, p > &B, FieldMatrix< K, m, p > &ret) │ │ │ │ │ +calculates ret = A * B │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:779 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_i_n_v_e_r_t_M_a_t_r_i_x │ │ │ │ │ +static K invertMatrix(const FieldMatrix< K, 1, 1 > &matrix, FieldMatrix< K, 1, │ │ │ │ │ +1 > &inverse) │ │ │ │ │ +invert scalar without changing the original matrix │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:671 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t │ │ │ │ │ +static FieldVector< K, rows > mult(const FieldMatrix< K, rows, cols > &matrix, │ │ │ │ │ +const FieldVector< K, cols > &x) │ │ │ │ │ +calculates ret = matrix * x │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:829 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_T_r_a_n_s_p_o_s_e_d_M_a_t_r_i_x │ │ │ │ │ +static void multTransposedMatrix(const FieldMatrix< K, rows, cols > &matrix, │ │ │ │ │ +FieldMatrix< K, cols, cols > &ret) │ │ │ │ │ +calculates ret= A_t*A │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:798 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_A_s_s_i_g_n_T_r_a_n_s_p_o_s_e_d │ │ │ │ │ +static void multAssignTransposed(const FieldMatrix< K, rows, cols > &matrix, │ │ │ │ │ +const FieldVector< K, rows > &x, FieldVector< K, cols > &ret) │ │ │ │ │ +calculates ret = matrix^T * x │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:815 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x │ │ │ │ │ +A dense n x m matrix. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ +void mtv(const X &x, Y &y) const │ │ │ │ │ +y = A^T x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:387 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_M │ │ │ │ │ +constexpr size_type M() const │ │ │ │ │ +number of columns │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:703 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_r_i_g_h_t_m_u_l_t_i_p_l_y │ │ │ │ │ +FieldMatrix< K, ROWS, COLS > & rightmultiply(const DenseMatrix< M2 > &M) │ │ │ │ │ +Multiplies M from the right to this matrix. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:645 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ +derived_type & operator/=(const field_type &k) │ │ │ │ │ +vector space division by scalar │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:329 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ +derived_type & operator*=(const field_type &k) │ │ │ │ │ +vector space multiplication with scalar │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:321 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ +derived_type & operator-=(const DenseMatrix< Other > &x) │ │ │ │ │ +vector space subtraction │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:312 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ +static constexpr int blocklevel │ │ │ │ │ +The number of block levels we contain. This is the leaf, that is, 1. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_r_o_w___t_y_p_e │ │ │ │ │ +Traits::row_type row_type │ │ │ │ │ +The type used to represent a row (must fulfill the Dune::DenseVector interface) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:169 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Traits::size_type size_type │ │ │ │ │ +The type used for the index access and size operation. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +Traits::const_row_reference const_row_reference │ │ │ │ │ +The type used to represent a reference to a constant row (usually const │ │ │ │ │ +row_type &) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +Traits::row_reference row_reference │ │ │ │ │ +The type used to represent a reference to a row (usually row_type &) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:172 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ +derived_type & operator+=(const DenseMatrix< Other > &x) │ │ │ │ │ +vector space addition │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:289 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +A dense n x m matrix. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:117 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_m_a_t___c_o_l_s │ │ │ │ │ +static constexpr size_type mat_cols() │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:367 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +constexpr FieldMatrix()=default │ │ │ │ │ +Default constructor. │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +Base::const_row_reference const_row_reference │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +FieldMatrix & operator=(const FieldMatrix< T, ROWS, COLS > &x) │ │ │ │ │ +copy assignment from FieldMatrix over a different field │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:161 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_r_i_g_h_t_m_u_l_t_i_p_l_y_a_n_y │ │ │ │ │ +FieldMatrix< K, rows, l > rightmultiplyany(const FieldMatrix< K, cols, l > &M) │ │ │ │ │ +const │ │ │ │ │ +Multiplies M from the right to this matrix, this matrix is not modified. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:351 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ +Base::row_type row_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:128 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Base::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:127 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_l_e_f_t_m_u_l_t_i_p_l_y_a_n_y │ │ │ │ │ +FieldMatrix< K, l, cols > leftmultiplyany(const FieldMatrix< K, l, rows > &M) │ │ │ │ │ +const │ │ │ │ │ +Multiplies M from the left to this matrix, this matrix is not modified. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:316 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_r_i_g_h_t_m_u_l_t_i_p_l_y │ │ │ │ │ +FieldMatrix & rightmultiply(const FieldMatrix< K, r, c > &M) │ │ │ │ │ +Multiplies M from the right to this matrix. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:334 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +FieldMatrix(T const &rhs) │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +friend auto operator*(const FieldMatrix &matrix, Scalar scalar) │ │ │ │ │ +vector space multiplication with scalar │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:212 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +FieldMatrix & operator=(FieldMatrix< T, rows, cols > const &)=delete │ │ │ │ │ +no copy assignment from FieldMatrix of different size │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +Base::row_reference row_reference │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:130 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_m_a_t___a_c_c_e_s_s │ │ │ │ │ +row_reference mat_access(size_type i) │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:369 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_r_o_w_s │ │ │ │ │ +static constexpr int rows │ │ │ │ │ +The number of rows. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:123 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_t_r_a_n_s_p_o_s_e_d │ │ │ │ │ +FieldMatrix< K, COLS, ROWS > transposed() const │ │ │ │ │ +Return transposed of the matrix as FieldMatrix. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:172 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_m_a_t___r_o_w_s │ │ │ │ │ +static constexpr size_type mat_rows() │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:366 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +FieldMatrix(std::initializer_list< Dune::FieldVector< K, cols > > const &l) │ │ │ │ │ +Constructor initializing the matrix from a list of vector. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_c_o_l_s │ │ │ │ │ +static constexpr int cols │ │ │ │ │ +The number of columns. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:125 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/ │ │ │ │ │ +friend auto operator/(const FieldMatrix &matrix, Scalar scalar) │ │ │ │ │ +vector space division by scalar │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:240 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ +friend auto operator+(const FieldMatrix &matrixA, const FieldMatrix< │ │ │ │ │ +OtherScalar, ROWS, COLS > &matrixB) │ │ │ │ │ +vector space addition – two-argument version │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:183 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +FieldMatrix & operator=(const FieldMatrix &)=default │ │ │ │ │ +copy assignment operator │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +friend auto operator-(const FieldMatrix &matrixA, const FieldMatrix< │ │ │ │ │ +OtherScalar, ROWS, COLS > &matrixB) │ │ │ │ │ +vector space subtraction – two-argument version │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:197 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_m_a_t___a_c_c_e_s_s │ │ │ │ │ +const_row_reference mat_access(size_type i) const │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:375 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ +vector space out of a tensor product of fields. │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_c_o_n_t_a_i_n_e_r___t_y_p_e │ │ │ │ │ +std::array< row_type, ROWS > container_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +FieldMatrix< K, ROWS, COLS > derived_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +K value_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +const row_type & const_row_reference │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_r_o_w___t_y_p_e │ │ │ │ │ +FieldVector< K, COLS > row_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +container_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:97 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +row_type & row_reference │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< K >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:103 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _R_O_W_S_,_ _C_O_L_S_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< K >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +T field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +T real_type │ │ │ │ │ +export the type representing the real type of the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn matvectraits.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_:_:_P_r_o_m_o_t_e_d_T_y_p_e │ │ │ │ │ +decltype(std::declval< T1 >()+std::declval< T2 >()) PromotedType │ │ │ │ │ +DDeeffiinniittiioonn promotiontraits.hh:28 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00128.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: dynmatrixev.hh File Reference │ │ │ │ +dune-common: classname.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,44 +72,47 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Namespaces | │ │ │ │ Functions
    │ │ │ │ -
    dynmatrixev.hh File Reference
    │ │ │ │ +
    classname.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    utility functions to compute eigenvalues for dense matrices. │ │ │ │ +

    A free function to provide the demangled class name of a given object or type as a string. │ │ │ │ More...

    │ │ │ │ -
    #include <algorithm>
    │ │ │ │ +
    #include <cstdlib>
    │ │ │ │ #include <memory>
    │ │ │ │ -#include "dynmatrix.hh"
    │ │ │ │ -#include "fmatrixev.hh"
    │ │ │ │ +#include <string>
    │ │ │ │ +#include <typeinfo>
    │ │ │ │ +#include <type_traits>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::DynamicMatrixHelp
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<typename K , class C >
    static void Dune::DynamicMatrixHelp::eigenValuesNonSym (const DynamicMatrix< K > &matrix, DynamicVector< C > &eigenValues, std::vector< DynamicVector< K > > *eigenVectors=nullptr)
     calculates the eigenvalues of a symmetric field matrix
     
    template<class T >
    std::string Dune::className ()
     Provide the demangled class name of a type T as a string.
     
    template<class T >
    std::string Dune::className (T &&v)
     Provide the demangled class name of a given object as a string.
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    utility functions to compute eigenvalues for dense matrices.

    │ │ │ │ +

    A free function to provide the demangled class name of a given object or type as a string.

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,31 +1,34 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -dynmatrixev.hh File Reference │ │ │ │ │ -utility functions to compute eigenvalues for dense matrices. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +classname.hh File Reference │ │ │ │ │ +A free function to provide the demangled class name of a given object or type │ │ │ │ │ +as a string. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include "_d_y_n_m_a_t_r_i_x_._h_h" │ │ │ │ │ -#include "_f_m_a_t_r_i_x_e_v_._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 │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_H_e_l_p │ │ │ │ │ -  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -static void  _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_N_o_n_S_y_m (const _D_y_n_a_m_i_c_M_a_t_r_i_x< K │ │ │ │ │ - > &matrix, _D_y_n_a_m_i_c_V_e_c_t_o_r< C > &eigenValues, std::vector< │ │ │ │ │ - _D_y_n_a_m_i_c_V_e_c_t_o_r< K > > *eigenVectors=nullptr) │ │ │ │ │ -  calculates the eigenvalues of a symmetric field matrix │ │ │ │ │ +template │ │ │ │ │ +std::string  _D_u_n_e_:_:_c_l_a_s_s_N_a_m_e () │ │ │ │ │ +  Provide the demangled class name of a type T as a string. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::string  _D_u_n_e_:_:_c_l_a_s_s_N_a_m_e (T &&v) │ │ │ │ │ +  Provide the demangled class name of a given object as a string. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -utility functions to compute eigenvalues for dense matrices. │ │ │ │ │ +A free function to provide the demangled class name of a given object or type │ │ │ │ │ +as a string. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00128_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: dynmatrixev.hh Source File │ │ │ │ +dune-common: classname.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,123 +74,95 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    dynmatrixev.hh
    │ │ │ │ +
    classname.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_DYNMATRIXEIGENVALUES_HH
    │ │ │ │ -
    6#define DUNE_DYNMATRIXEIGENVALUES_HH
    │ │ │ │ +
    5#ifndef DUNE_CLASSNAME_HH
    │ │ │ │ +
    6#define DUNE_CLASSNAME_HH
    │ │ │ │
    7
    │ │ │ │ -
    8#include <algorithm>
    │ │ │ │ -
    9#include <memory>
    │ │ │ │ -
    10
    │ │ │ │ -
    11#include "dynmatrix.hh"
    │ │ │ │ -
    12#include "fmatrixev.hh"
    │ │ │ │ -
    13
    │ │ │ │ -
    22namespace Dune {
    │ │ │ │ +
    13#include <cstdlib>
    │ │ │ │ +
    14#include <memory>
    │ │ │ │ +
    15#include <string>
    │ │ │ │ +
    16#include <typeinfo>
    │ │ │ │ +
    17#include <type_traits>
    │ │ │ │ +
    18
    │ │ │ │ +
    19#if __has_include(<cxxabi.h>) && !DISABLE_CXA_DEMANGLE
    │ │ │ │ +
    20#define HAVE_CXA_DEMANGLE 1
    │ │ │ │ +
    21#include <cxxabi.h>
    │ │ │ │ +
    22#endif // #if HAVE_CXA_DEMANGLE
    │ │ │ │
    23
    │ │ │ │ -
    │ │ │ │ -
    24 namespace DynamicMatrixHelp {
    │ │ │ │ +
    24namespace Dune {
    │ │ │ │
    25
    │ │ │ │ -
    26#if HAVE_LAPACK
    │ │ │ │ -
    27 using Dune::FMatrixHelp::eigenValuesNonsymLapackCall;
    │ │ │ │ -
    28#endif
    │ │ │ │ -
    29
    │ │ │ │ -
    38 template <typename K, class C>
    │ │ │ │ -
    │ │ │ │ -
    39 static void eigenValuesNonSym(const DynamicMatrix<K>& matrix,
    │ │ │ │ -
    40 DynamicVector<C>& eigenValues,
    │ │ │ │ -
    41 std::vector<DynamicVector<K>>* eigenVectors = nullptr
    │ │ │ │ -
    42 )
    │ │ │ │ -
    43 {
    │ │ │ │ -
    44
    │ │ │ │ -
    45#if HAVE_LAPACK
    │ │ │ │ -
    46 {
    │ │ │ │ -
    47 const long int N = matrix.rows();
    │ │ │ │ -
    48 const char jobvl = 'n';
    │ │ │ │ -
    49 const char jobvr = eigenVectors ? 'v' : 'n';
    │ │ │ │ -
    50
    │ │ │ │ -
    51
    │ │ │ │ -
    52 // matrix to put into dgeev
    │ │ │ │ -
    53 auto matrixVector = std::make_unique<double[]>(N*N);
    │ │ │ │ -
    54
    │ │ │ │ -
    55 // copy matrix
    │ │ │ │ -
    56 int row = 0;
    │ │ │ │ -
    57 for(int i=0; i<N; ++i)
    │ │ │ │ -
    58 {
    │ │ │ │ -
    59 for(int j=0; j<N; ++j, ++row)
    │ │ │ │ -
    60 {
    │ │ │ │ -
    61 matrixVector[ row ] = matrix[ i ][ j ];
    │ │ │ │ -
    62 }
    │ │ │ │ -
    63 }
    │ │ │ │ -
    64
    │ │ │ │ -
    65 // working memory
    │ │ │ │ -
    66 auto eigenR = std::make_unique<double[]>(N);
    │ │ │ │ -
    67 auto eigenI = std::make_unique<double[]>(N);
    │ │ │ │ -
    68
    │ │ │ │ -
    69 const long int lwork = eigenVectors ? 4*N : 3*N;
    │ │ │ │ -
    70 auto work = std::make_unique<double[]>(lwork);
    │ │ │ │ -
    71 auto vr = eigenVectors ? std::make_unique<double[]>(N*N) : std::unique_ptr<double[]>{};
    │ │ │ │ -
    72
    │ │ │ │ -
    73 // return value information
    │ │ │ │ -
    74 long int info = 0;
    │ │ │ │ -
    75
    │ │ │ │ -
    76 // call LAPACK routine (see fmatrixev_ext.cc)
    │ │ │ │ -
    77 eigenValuesNonsymLapackCall(&jobvl, &jobvr, &N, matrixVector.get(), &N,
    │ │ │ │ -
    78 eigenR.get(), eigenI.get(), nullptr, &N, vr.get(), &N, work.get(),
    │ │ │ │ -
    79 &lwork, &info);
    │ │ │ │ -
    80
    │ │ │ │ -
    81 if( info != 0 )
    │ │ │ │ -
    82 {
    │ │ │ │ -
    83 std::cerr << "For matrix " << matrix << " eigenvalue calculation failed! " << std::endl;
    │ │ │ │ -
    84 DUNE_THROW(InvalidStateException,"eigenValues: Eigenvalue calculation failed!");
    │ │ │ │ -
    85 }
    │ │ │ │ -
    86
    │ │ │ │ -
    87 eigenValues.resize(N);
    │ │ │ │ -
    88 for (int i=0; i<N; ++i)
    │ │ │ │ -
    89 eigenValues[i] = std::complex<double>(eigenR[i], eigenI[i]);
    │ │ │ │ -
    90
    │ │ │ │ -
    91 if (eigenVectors) {
    │ │ │ │ -
    92 eigenVectors->resize(N);
    │ │ │ │ -
    93 for (int i = 0; i < N; ++i) {
    │ │ │ │ -
    94 auto& v = (*eigenVectors)[i];
    │ │ │ │ -
    95 v.resize(N);
    │ │ │ │ -
    96 std::copy(vr.get() + N*i, vr.get() + N*(i+1), &v[0]);
    │ │ │ │ -
    97 }
    │ │ │ │ -
    98 }
    │ │ │ │ -
    99 }
    │ │ │ │ -
    100#else // #if HAVE_LAPACK
    │ │ │ │ -
    101 DUNE_THROW(NotImplemented,"LAPACK not found!");
    │ │ │ │ -
    102#endif
    │ │ │ │ -
    103 }
    │ │ │ │ -
    │ │ │ │ -
    104 }
    │ │ │ │ -
    │ │ │ │ -
    105
    │ │ │ │ -
    106}
    │ │ │ │ -
    108#endif
    │ │ │ │ -
    This file implements a dense matrix with dynamic numbers of rows and columns.
    │ │ │ │ -
    Eigenvalue computations for the FieldMatrix class.
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ +
    26 namespace Impl {
    │ │ │ │ +
    27
    │ │ │ │ +
    28 inline std::string demangle(std::string name)
    │ │ │ │ +
    29 {
    │ │ │ │ +
    30#if HAVE_CXA_DEMANGLE
    │ │ │ │ +
    31 int status;
    │ │ │ │ +
    32 std::unique_ptr<char, void(*)(void*)>
    │ │ │ │ +
    33 demangled(abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status),
    │ │ │ │ +
    34 std::free);
    │ │ │ │ +
    35 if( demangled )
    │ │ │ │ +
    36 name = demangled.get();
    │ │ │ │ +
    37#endif // #if HAVE_CXA_DEMANGLE
    │ │ │ │ +
    38 return name;
    │ │ │ │ +
    39 }
    │ │ │ │ +
    40 }
    │ │ │ │ +
    41
    │ │ │ │ +
    43 /*
    │ │ │ │ +
    44 * \ingroup CxxUtilities
    │ │ │ │ +
    45 */
    │ │ │ │ +
    46 template <class T>
    │ │ │ │ +
    │ │ │ │ +
    47 std::string className ()
    │ │ │ │ +
    48 {
    │ │ │ │ +
    49 typedef typename std::remove_reference<T>::type TR;
    │ │ │ │ +
    50 std::string className = Impl::demangle( typeid( TR ).name() );
    │ │ │ │ +
    51 if (std::is_const<TR>::value)
    │ │ │ │ +
    52 className += " const";
    │ │ │ │ +
    53 if (std::is_volatile<TR>::value)
    │ │ │ │ +
    54 className += " volatile";
    │ │ │ │ +
    55 if (std::is_lvalue_reference<T>::value)
    │ │ │ │ +
    56 className += "&";
    │ │ │ │ +
    57 else if (std::is_rvalue_reference<T>::value)
    │ │ │ │ +
    58 className += "&&";
    │ │ │ │ +
    59 return className;
    │ │ │ │ +
    60 }
    │ │ │ │ +
    │ │ │ │ +
    61
    │ │ │ │ +
    63 /*
    │ │ │ │ +
    64 * \ingroup CxxUtilities
    │ │ │ │ +
    65 */
    │ │ │ │ +
    66 template <class T>
    │ │ │ │ +
    │ │ │ │ +
    67 std::string className ( T&& v)
    │ │ │ │ +
    68 {
    │ │ │ │ +
    69 typedef typename std::remove_reference<T>::type TR;
    │ │ │ │ +
    70 std::string className = Impl::demangle( typeid(v).name() );
    │ │ │ │ +
    71 if (std::is_const<TR>::value)
    │ │ │ │ +
    72 className += " const";
    │ │ │ │ +
    73 if (std::is_volatile<TR>::value)
    │ │ │ │ +
    74 className += " volatile";
    │ │ │ │ +
    75 return className;
    │ │ │ │ +
    76 }
    │ │ │ │ +
    │ │ │ │ +
    77} // namespace Dune
    │ │ │ │ +
    78
    │ │ │ │ +
    79#endif // DUNE_CLASSNAME_HH
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    static void eigenValuesNonSym(const DynamicMatrix< K > &matrix, DynamicVector< C > &eigenValues, std::vector< DynamicVector< K > > *eigenVectors=nullptr)
    calculates the eigenvalues of a symmetric field matrix
    Definition dynmatrixev.hh:39
    │ │ │ │ -
    constexpr size_type rows() const
    number of rows
    Definition densematrix.hh:709
    │ │ │ │ -
    Construct a matrix with a dynamic size.
    Definition dynmatrix.hh:61
    │ │ │ │ -
    Construct a vector with a dynamic size.
    Definition dynvector.hh:59
    │ │ │ │ -
    void resize(size_type n, value_type c=value_type())
    Definition dynvector.hh:141
    │ │ │ │ -
    Default exception for dummy implementations.
    Definition exceptions.hh:263
    │ │ │ │ -
    Default exception if a function was called while the object is not in a valid state for that function...
    Definition exceptions.hh:281
    │ │ │ │ +
    std::string className()
    Provide the demangled class name of a type T as a string.
    Definition classname.hh:47
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,140 +1,90 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -dynmatrixev.hh │ │ │ │ │ +classname.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_DYNMATRIXEIGENVALUES_HH │ │ │ │ │ -6#define DUNE_DYNMATRIXEIGENVALUES_HH │ │ │ │ │ +5#ifndef DUNE_CLASSNAME_HH │ │ │ │ │ +6#define DUNE_CLASSNAME_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11#include "_d_y_n_m_a_t_r_i_x_._h_h" │ │ │ │ │ -12#include "_f_m_a_t_r_i_x_e_v_._h_h" │ │ │ │ │ -13 │ │ │ │ │ -22namespace _D_u_n_e { │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18 │ │ │ │ │ +19#if __has_include() && !DISABLE_CXA_DEMANGLE │ │ │ │ │ +20#define HAVE_CXA_DEMANGLE 1 │ │ │ │ │ +21#include │ │ │ │ │ +22#endif // #if HAVE_CXA_DEMANGLE │ │ │ │ │ 23 │ │ │ │ │ -_2_4 namespace DynamicMatrixHelp { │ │ │ │ │ +24namespace _D_u_n_e { │ │ │ │ │ 25 │ │ │ │ │ -26#if HAVE_LAPACK │ │ │ │ │ -27 using Dune::FMatrixHelp::eigenValuesNonsymLapackCall; │ │ │ │ │ -28#endif │ │ │ │ │ -29 │ │ │ │ │ -38 template │ │ │ │ │ -_3_9 static void _e_i_g_e_n_V_a_l_u_e_s_N_o_n_S_y_m(const _D_y_n_a_m_i_c_M_a_t_r_i_x_<_K_>& matrix, │ │ │ │ │ -40 _D_y_n_a_m_i_c_V_e_c_t_o_r_<_C_>& eigenValues, │ │ │ │ │ -41 std::vector<_D_y_n_a_m_i_c_V_e_c_t_o_r_<_K_>>* eigenVectors = nullptr │ │ │ │ │ -42 ) │ │ │ │ │ -43 { │ │ │ │ │ -44 │ │ │ │ │ -45#if HAVE_LAPACK │ │ │ │ │ -46 { │ │ │ │ │ -47 const long int N = matrix._r_o_w_s(); │ │ │ │ │ -48 const char jobvl = 'n'; │ │ │ │ │ -49 const char jobvr = eigenVectors ? 'v' : 'n'; │ │ │ │ │ -50 │ │ │ │ │ -51 │ │ │ │ │ -52 // matrix to put into dgeev │ │ │ │ │ -53 auto matrixVector = std::make_unique(N*N); │ │ │ │ │ -54 │ │ │ │ │ -55 // copy matrix │ │ │ │ │ -56 int row = 0; │ │ │ │ │ -57 for(int i=0; i(N); │ │ │ │ │ -67 auto eigenI = std::make_unique(N); │ │ │ │ │ -68 │ │ │ │ │ -69 const long int lwork = eigenVectors ? 4*N : 3*N; │ │ │ │ │ -70 auto work = std::make_unique(lwork); │ │ │ │ │ -71 auto vr = eigenVectors ? std::make_unique(N*N) : std:: │ │ │ │ │ -unique_ptr{}; │ │ │ │ │ -72 │ │ │ │ │ -73 // return value information │ │ │ │ │ -74 long int info = 0; │ │ │ │ │ -75 │ │ │ │ │ -76 // call LAPACK routine (see fmatrixev_ext.cc) │ │ │ │ │ -77 eigenValuesNonsymLapackCall(&jobvl, &jobvr, &N, matrixVector.get(), &N, │ │ │ │ │ -78 eigenR.get(), eigenI.get(), nullptr, &N, vr.get(), &N, work.get(), │ │ │ │ │ -79 &lwork, &info); │ │ │ │ │ -80 │ │ │ │ │ -81 if( info != 0 ) │ │ │ │ │ -82 { │ │ │ │ │ -83 std::cerr << "For matrix " << matrix << " eigenvalue calculation failed! " │ │ │ │ │ -<< std::endl; │ │ │ │ │ -84 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n,"eigenValues: Eigenvalue calculation │ │ │ │ │ -failed!"); │ │ │ │ │ -85 } │ │ │ │ │ -86 │ │ │ │ │ -87 eigenValues._r_e_s_i_z_e(N); │ │ │ │ │ -88 for (int i=0; i(eigenR[i], eigenI[i]); │ │ │ │ │ -90 │ │ │ │ │ -91 if (eigenVectors) { │ │ │ │ │ -92 eigenVectors->_r_e_s_i_z_e(N); │ │ │ │ │ -93 for (int i = 0; i < N; ++i) { │ │ │ │ │ -94 auto& v = (*eigenVectors)[i]; │ │ │ │ │ -95 v.resize(N); │ │ │ │ │ -96 std::copy(vr.get() + N*i, vr.get() + N*(i+1), &v[0]); │ │ │ │ │ -97 } │ │ │ │ │ -98 } │ │ │ │ │ -99 } │ │ │ │ │ -100#else // #if HAVE_LAPACK │ │ │ │ │ -101 _D_U_N_E___T_H_R_O_W(_N_o_t_I_m_p_l_e_m_e_n_t_e_d,"LAPACK not found!"); │ │ │ │ │ -102#endif │ │ │ │ │ -103 } │ │ │ │ │ -104 } │ │ │ │ │ -105 │ │ │ │ │ -106} │ │ │ │ │ -108#endif │ │ │ │ │ -_d_y_n_m_a_t_r_i_x_._h_h │ │ │ │ │ -This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ │ -_f_m_a_t_r_i_x_e_v_._h_h │ │ │ │ │ -Eigenvalue computations for the FieldMatrix class. │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +26 namespace Impl { │ │ │ │ │ +27 │ │ │ │ │ +28 inline std::string demangle(std::string name) │ │ │ │ │ +29 { │ │ │ │ │ +30#if HAVE_CXA_DEMANGLE │ │ │ │ │ +31 int status; │ │ │ │ │ +32 std::unique_ptr │ │ │ │ │ +33 demangled(abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status), │ │ │ │ │ +34 std::free); │ │ │ │ │ +35 if( demangled ) │ │ │ │ │ +36 name = demangled.get(); │ │ │ │ │ +37#endif // #if HAVE_CXA_DEMANGLE │ │ │ │ │ +38 return name; │ │ │ │ │ +39 } │ │ │ │ │ +40 } │ │ │ │ │ +41 │ │ │ │ │ +43 /* │ │ │ │ │ +44 * \ingroup CxxUtilities │ │ │ │ │ +45 */ │ │ │ │ │ +46 template │ │ │ │ │ +_4_7 std::string _c_l_a_s_s_N_a_m_e () │ │ │ │ │ +48 { │ │ │ │ │ +49 typedef typename std::remove_reference::type TR; │ │ │ │ │ +50 std::string _c_l_a_s_s_N_a_m_e = Impl::demangle( typeid( TR ).name() ); │ │ │ │ │ +51 if (std::is_const::value) │ │ │ │ │ +52 _c_l_a_s_s_N_a_m_e += " const"; │ │ │ │ │ +53 if (std::is_volatile::value) │ │ │ │ │ +54 _c_l_a_s_s_N_a_m_e += " volatile"; │ │ │ │ │ +55 if (std::is_lvalue_reference::value) │ │ │ │ │ +56 _c_l_a_s_s_N_a_m_e += "&"; │ │ │ │ │ +57 else if (std::is_rvalue_reference::value) │ │ │ │ │ +58 _c_l_a_s_s_N_a_m_e += "&&"; │ │ │ │ │ +59 return _c_l_a_s_s_N_a_m_e; │ │ │ │ │ +60 } │ │ │ │ │ +61 │ │ │ │ │ +63 /* │ │ │ │ │ +64 * \ingroup CxxUtilities │ │ │ │ │ +65 */ │ │ │ │ │ +66 template │ │ │ │ │ +_6_7 std::string _c_l_a_s_s_N_a_m_e ( T&& v) │ │ │ │ │ +68 { │ │ │ │ │ +69 typedef typename std::remove_reference::type TR; │ │ │ │ │ +70 std::string _c_l_a_s_s_N_a_m_e = Impl::demangle( typeid(v).name() ); │ │ │ │ │ +71 if (std::is_const::value) │ │ │ │ │ +72 _c_l_a_s_s_N_a_m_e += " const"; │ │ │ │ │ +73 if (std::is_volatile::value) │ │ │ │ │ +74 _c_l_a_s_s_N_a_m_e += " volatile"; │ │ │ │ │ +75 return _c_l_a_s_s_N_a_m_e; │ │ │ │ │ +76 } │ │ │ │ │ +77} // namespace Dune │ │ │ │ │ +78 │ │ │ │ │ +79#endif // DUNE_CLASSNAME_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_N_o_n_S_y_m │ │ │ │ │ -static void eigenValuesNonSym(const DynamicMatrix< K > &matrix, DynamicVector< │ │ │ │ │ -C > &eigenValues, std::vector< DynamicVector< K > > *eigenVectors=nullptr) │ │ │ │ │ -calculates the eigenvalues of a symmetric field matrix │ │ │ │ │ -DDeeffiinniittiioonn dynmatrixev.hh:39 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_r_o_w_s │ │ │ │ │ -constexpr size_type rows() const │ │ │ │ │ -number of rows │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:709 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ -Construct a matrix with a dynamic size. │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ -Construct a vector with a dynamic size. │ │ │ │ │ -DDeeffiinniittiioonn dynvector.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_r_e_s_i_z_e │ │ │ │ │ -void resize(size_type n, value_type c=value_type()) │ │ │ │ │ -DDeeffiinniittiioonn dynvector.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_N_o_t_I_m_p_l_e_m_e_n_t_e_d │ │ │ │ │ -Default exception for dummy implementations. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ -Default exception if a function was called while the object is not in a valid │ │ │ │ │ -state for that function... │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_c_l_a_s_s_N_a_m_e │ │ │ │ │ +std::string className() │ │ │ │ │ +Provide the demangled class name of a type T as a string. │ │ │ │ │ +DDeeffiinniittiioonn classname.hh:47 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00131.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: hash.hh File Reference │ │ │ │ +dune-common: math.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,174 +74,191 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Macros | │ │ │ │ Functions
    │ │ │ │ -
    hash.hh File Reference
    │ │ │ │ +
    math.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Support for calculating hash values of objects. │ │ │ │ +

    Some useful basic math stuff. │ │ │ │ More...

    │ │ │ │ -
    #include <functional>
    │ │ │ │ -#include <dune/common/typetraits.hh>
    │ │ │ │ +
    #include <cmath>
    │ │ │ │ +#include <complex>
    │ │ │ │ +#include <limits>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <dune/common/typeutilities.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::hash< T >
     Functor for hashing objects of type T. More...
    struct  Dune::StandardMathematicalConstants< T >
     Standard implementation of MathematicalConstants. More...
     
    struct  Dune::MathematicalConstants< Field >
     Provides commonly used mathematical constants. More...
     
    struct  Dune::Factorial< m >
     
    struct  Dune::Factorial< 0 >
     end of recursion of factorial via specialization More...
     
    struct  Dune::MathOverloads::ADLTag
     Tag to make sure the functions in this namespace can be found by ADL. More...
     
    struct  Dune::MathImpl::isUnorderedImpl
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::MathOverloads
     namespace for customization of math functions with Dune-Semantics
     
    namespace  Dune::MathImpl
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Macros

    #define DUNE_DEFINE_HASH(template_args, type)
     Defines the required struct specialization to make type hashable via Dune::hash.
     
    #define DUNE_HASH_TEMPLATE_ARGS(...)
     Wrapper macro for the template arguments in DUNE_DEFINE_HASH.
     
    #define DUNE_HASH_TYPE(...)
     Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.
     
    #define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction)
     
    #define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function)
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<typename T >
    void Dune::hash_combine (std::size_t &seed, const T &arg)
     Calculates the hash value of arg and combines it in-place with seed.
     
    template<typename It >
    std::size_t Dune::hash_range (It first, It last)
     Hashes all elements in the range [first,last) and returns the combined hash.
     
    template<typename It >
    void Dune::hash_range (std::size_t &seed, It first, It last)
     Hashes all elements in the range [first,last) and combines the hashes in-place with seed.
     
    template<class Base , class Exponent >
    constexpr Base Dune::power (Base m, Exponent p)
     Power method for integer exponents.
     
    template<class T >
    static constexpr T Dune::factorial (const T &n) noexcept
     calculate the factorial of n as a constexpr
     
    template<class T , T n>
    static constexpr auto Dune::factorial (std::integral_constant< T, n >) noexcept
     calculate the factorial of n as a constexpr
     
    template<class T >
    static constexpr T Dune::binomial (const T &n, const T &k) noexcept
     calculate the binomial coefficient n over k as a constexpr
     
    template<class T , T n, T k>
    static constexpr auto Dune::binomial (std::integral_constant< T, n >, std::integral_constant< T, k >) noexcept
     calculate the binomial coefficient n over k as a constexpr
     
    template<class T , T n>
    static constexpr auto Dune::binomial (std::integral_constant< T, n >, std::integral_constant< T, n >) noexcept
     
    template<class K >
    Dune::conjugateComplex (const K &x)
     compute conjugate complex of x
     
    template<class T >
    int Dune::sign (const T &val)
     Return the sign of the value.
     
     Dune::MathOverloads::DUNE_COMMON_MATH_ISFUNCTION (isNaN, isnan)
     
     Dune::MathOverloads::DUNE_COMMON_MATH_ISFUNCTION (isInf, isinf)
     
     Dune::MathOverloads::DUNE_COMMON_MATH_ISFUNCTION (isFinite, isfinite)
     
    template<class T >
    auto Dune::MathOverloads::isUnordered (const T &t1, const T &t2, PriorityTag< 1 >, ADLTag) -> decltype(isUnordered(t1, t2))
     
    template<class T >
    auto Dune::MathOverloads::isUnordered (const T &t1, const T &t2, PriorityTag< 0 >, ADLTag)
     
     Dune::MathImpl::DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (isNaN)
     
     Dune::MathImpl::DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (isInf)
     
     Dune::MathImpl::DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (isFinite)
     
    template<class T , class = std::enable_if_t<Impl::isComplexLike<T>::value>>
    auto Dune::MathOverloads::isNaN (const T &t, PriorityTag< 2 >, ADLTag)
     
    template<class T , class = std::enable_if_t<Impl::isComplexLike<T>::value>>
    auto Dune::MathOverloads::isInf (const T &t, PriorityTag< 2 >, ADLTag)
     
    template<class T , class = std::enable_if_t<Impl::isComplexLike<T>::value>>
    auto Dune::MathOverloads::isFinite (const T &t, PriorityTag< 2 >, ADLTag)
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Support for calculating hash values of objects.

    │ │ │ │ -

    This file provides the functor Dune::hash to calculate hash values and some infrastructure to simplify extending Dune::hash for user-defined types, independent of the actual underlying implementation.

    │ │ │ │ +

    Some useful basic math stuff.

    │ │ │ │

    Macro Definition Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ DUNE_DEFINE_HASH

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_COMMON_MATH_ISFUNCTION

    │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    #define DUNE_DEFINE_HASH#define DUNE_COMMON_MATH_ISFUNCTION( template_args, function,
     type stdfunction 
    )
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Defines the required struct specialization to make type hashable via Dune::hash.

    │ │ │ │ -

    In order to calculate the hash, operator() of the generated specialization will return the result of an unqualified call to the global function hash_value(const type&). As the call is not qualified, the function will be found using argument-dependent lookup, allowing implementors to conveniently place it inside the class body.

    │ │ │ │ -

    Consider the following type:

    │ │ │ │ -
    namespace ns {
    │ │ │ │ -
    template<typename A, int i>
    │ │ │ │ -
    class Foo
    │ │ │ │ -
    {
    │ │ │ │ -
    ...
    │ │ │ │ -
    };
    │ │ │ │ -
    }
    │ │ │ │ -

    In order to add support for Dune::hash, you need to extend the definition like this:

    │ │ │ │ -
    namespace ns {
    │ │ │ │ -
    template<typename A, int i>
    │ │ │ │ -
    class Foo
    │ │ │ │ -
    {
    │ │ │ │ -
    ...
    │ │ │ │ -
    // The keyword "friend" turns this into a global function that is a friend of Foo.
    │ │ │ │ -
    inline friend std::size_t hash_value(const Foo& arg)
    │ │ │ │ -
    {
    │ │ │ │ -
    return ...;
    │ │ │ │ -
    }
    │ │ │ │ -
    };
    │ │ │ │ -
    }
    │ │ │ │ -
    │ │ │ │ -
    // Define hash struct specialization
    │ │ │ │ - │ │ │ │ -
    #define DUNE_DEFINE_HASH(template_args, type)
    Defines the required struct specialization to make type hashable via Dune::hash.
    Definition hash.hh:100
    │ │ │ │ -
    #define DUNE_HASH_TYPE(...)
    Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.
    Definition hash.hh:117
    │ │ │ │ -
    #define DUNE_HASH_TEMPLATE_ARGS(...)
    Wrapper macro for the template arguments in DUNE_DEFINE_HASH.
    Definition hash.hh:109
    │ │ │ │ -
    Warning
    As the specialization has to be placed in the original namespace of the hash struct (e.g. std), this macro must be called from the global namespace!
    │ │ │ │ -
    Parameters
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    template_argsThe template arguments required by the hash struct specialization, wrapped in a call to DUNE_HASH_TEMPLATE_ARGS. If this is a complete specialization, call DUNE_HASH_TEMPLATE_ARGS without arguments.
    typeThe exact type of the specialization, wrapped in a call to DUNE_HASH_TYPE.
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ DUNE_HASH_TEMPLATE_ARGS

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    #define DUNE_HASH_TEMPLATE_ARGS( ...)
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    Wrapper macro for the template arguments in DUNE_DEFINE_HASH.

    │ │ │ │ -

    This macro should always be used as a wrapper for the template arguments when calling DUNE_DEFINE_HASH. It works around some preprocessor limitations when the template arguments contain commas or the list is completely empty.

    │ │ │ │ - │ │ │ │ +Value:
    template<class T> \
    │ │ │ │ +
    auto function(const T &t, PriorityTag<1>, ADLTag) \
    │ │ │ │ +
    -> decltype(function(t)) { \
    │ │ │ │ +
    return function(t); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T> \
    │ │ │ │ +
    auto function(const T &t, PriorityTag<0>, ADLTag) { \
    │ │ │ │ +
    using std::stdfunction; \
    │ │ │ │ +
    return stdfunction(t); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    ◆ DUNE_HASH_TYPE

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR

    │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    #define DUNE_HASH_TYPE#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR( ...)function)
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.

    │ │ │ │ -

    This macro should always be used as a wrapper for the type of the specialization when calling DUNE_DEFINE_HASH. It works around some preprocessor limitations when the type contains commas.

    │ │ │ │ - │ │ │ │ +Value:
    struct function##Impl { \
    │ │ │ │ +
    template<class T> \
    │ │ │ │ +
    constexpr auto operator()(const T &t) const { \
    │ │ │ │ +
    return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    }; \
    │ │ │ │ +
    static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,129 +1,154 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ _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 │ │ │ │ │ -hash.hh File Reference │ │ │ │ │ -Support for calculating hash values of objects. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +math.hh File Reference │ │ │ │ │ +Some useful basic math stuff. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_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 │ │ │ │ │ -struct   _D_u_n_e_:_:_h_a_s_h_<_ _T_ _> │ │ │ │ │ -  Functor for hashing objects of type T. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_<_ _T_ _> │ │ │ │ │ +  Standard implementation of _M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_<_ _F_i_e_l_d_ _> │ │ │ │ │ +  Provides commonly used mathematical constants. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_a_c_t_o_r_i_a_l_<_ _m_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_a_c_t_o_r_i_a_l_<_ _0_ _> │ │ │ │ │ +  end of recursion of factorial via specialization _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +  Tag to make sure the functions in this namespace can be found by ADL. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_i_s_U_n_o_r_d_e_r_e_d_I_m_p_l │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___D_E_F_I_N_E___H_A_S_H(template_args, type) │ │ │ │ │ -  Defines the required struct specialization to make type hashable via │ │ │ │ │ - _D_u_n_e_:_:_h_a_s_h. │ │ │ │ │ +namespace   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s │ │ │ │ │ +  namespace for customization of math functions with Dune-Semantics │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___H_A_S_H___T_E_M_P_L_A_T_E___A_R_G_S(...) │ │ │ │ │ -  Wrapper macro for the template arguments in DUNE_DEFINE_HASH. │ │ │ │ │ +namespace   _D_u_n_e_:_:_M_a_t_h_I_m_p_l │ │ │ │ │ +  │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(function, stdfunction) │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___H_A_S_H___T_Y_P_E(...) │ │ │ │ │ -  Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH. │ │ │ │ │ +#define  _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(function) │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_h_a_s_h___c_o_m_b_i_n_e (std::size_t &seed, const T &arg) │ │ │ │ │ -  Calculates the hash value of arg and combines it in-place with │ │ │ │ │ - seed. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -std::size_t  _D_u_n_e_:_:_h_a_s_h___r_a_n_g_e (It first, It last) │ │ │ │ │ -  Hashes all elements in the range [first,last) and returns the │ │ │ │ │ - combined hash. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_h_a_s_h___r_a_n_g_e (std::size_t &seed, It first, It last) │ │ │ │ │ -  Hashes all elements in the range [first,last) and combines the │ │ │ │ │ - hashes in-place with seed. │ │ │ │ │ +template │ │ │ │ │ + constexpr Base  _D_u_n_e_:_:_p_o_w_e_r (Base m, Exponent p) │ │ │ │ │ +  _P_o_w_e_r method for integer exponents. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static constexpr T  _D_u_n_e_:_:_f_a_c_t_o_r_i_a_l (const T &n) noexcept │ │ │ │ │ +  calculate the factorial of n as a constexpr │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static constexpr auto  _D_u_n_e_:_:_f_a_c_t_o_r_i_a_l (std::integral_constant< T, n >) │ │ │ │ │ + noexcept │ │ │ │ │ +  calculate the factorial of n as a constexpr │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + static constexpr T  _D_u_n_e_:_:_b_i_n_o_m_i_a_l (const T &n, const T &k) noexcept │ │ │ │ │ +  calculate the binomial coefficient n over k as a │ │ │ │ │ + constexpr │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static constexpr auto  _D_u_n_e_:_:_b_i_n_o_m_i_a_l (std::integral_constant< T, n >, std:: │ │ │ │ │ + integral_constant< T, k >) noexcept │ │ │ │ │ +  calculate the binomial coefficient n over k as a │ │ │ │ │ + constexpr │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static constexpr auto  _D_u_n_e_:_:_b_i_n_o_m_i_a_l (std::integral_constant< T, n >, std:: │ │ │ │ │ + integral_constant< T, n >) noexcept │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + K  _D_u_n_e_:_:_c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x (const K &x) │ │ │ │ │ +  compute conjugate complex of x │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + int  _D_u_n_e_:_:_s_i_g_n (const T &val) │ │ │ │ │ +  Return the sign of the value. │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N (_i_s_N_a_N, │ │ │ │ │ + isnan) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N (_i_s_I_n_f, │ │ │ │ │ + isinf) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N │ │ │ │ │ + (_i_s_F_i_n_i_t_e, isfinite) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d (const T &t1, const T │ │ │ │ │ + &t2, _P_r_i_o_r_i_t_y_T_a_g< 1 >, _A_D_L_T_a_g) -> decltype(isUnordered │ │ │ │ │ + (t1, t2)) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d (const T &t1, const T │ │ │ │ │ + &t2, _P_r_i_o_r_i_t_y_T_a_g< 0 >, _A_D_L_T_a_g) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ + (isNaN) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ + (isInf) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ + (isFinite) │ │ │ │ │ +  │ │ │ │ │ +template::value>> │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N (const T &t, _P_r_i_o_r_i_t_y_T_a_g< 2 │ │ │ │ │ + >, _A_D_L_T_a_g) │ │ │ │ │ +  │ │ │ │ │ +template::value>> │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f (const T &t, _P_r_i_o_r_i_t_y_T_a_g< 2 │ │ │ │ │ + >, _A_D_L_T_a_g) │ │ │ │ │ +  │ │ │ │ │ +template::value>> │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e (const T &t, _P_r_i_o_r_i_t_y_T_a_g< │ │ │ │ │ + 2 >, _A_D_L_T_a_g) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Support for calculating hash values of objects. │ │ │ │ │ -This file provides the functor _D_u_n_e_:_:_h_a_s_h to calculate hash values and some │ │ │ │ │ -infrastructure to simplify extending _D_u_n_e_:_:_h_a_s_h for user-defined types, │ │ │ │ │ -independent of the actual underlying implementation. │ │ │ │ │ +Some useful basic math stuff. │ │ │ │ │ ********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__DDEEFFIINNEE__HHAASSHH ********** │ │ │ │ │ -#define DUNE_DEFINE_HASH (   template_args, │ │ │ │ │ -   type  │ │ │ │ │ - ) │ │ │ │ │ -Defines the required struct specialization to make type hashable via _D_u_n_e_:_: │ │ │ │ │ -_h_a_s_h. │ │ │ │ │ -In order to calculate the hash, operator() of the generated specialization will │ │ │ │ │ -return the result of an unqualified call to the global function hash_value │ │ │ │ │ -(const type&). As the call is not qualified, the function will be found using │ │ │ │ │ -argument-dependent lookup, allowing implementors to conveniently place it │ │ │ │ │ -inside the class body. │ │ │ │ │ -Consider the following type: │ │ │ │ │ -namespace ns { │ │ │ │ │ -template │ │ │ │ │ -class Foo │ │ │ │ │ -{ │ │ │ │ │ -... │ │ │ │ │ -}; │ │ │ │ │ -} │ │ │ │ │ -In order to add support for _D_u_n_e_:_:_h_a_s_h, you need to extend the definition like │ │ │ │ │ -this: │ │ │ │ │ -namespace ns { │ │ │ │ │ -template │ │ │ │ │ -class Foo │ │ │ │ │ -{ │ │ │ │ │ -... │ │ │ │ │ -// The keyword "friend" turns this into a global function that is a friend of │ │ │ │ │ -Foo. │ │ │ │ │ -inline friend std::size_t hash_value(const Foo& arg) │ │ │ │ │ -{ │ │ │ │ │ -return ...; │ │ │ │ │ -} │ │ │ │ │ -}; │ │ │ │ │ -} │ │ │ │ │ -// Define hash struct specialization │ │ │ │ │ -_D_U_N_E___D_E_F_I_N_E___H_A_S_H(_D_U_N_E___H_A_S_H___T_E_M_P_L_A_T_E___A_R_G_S(typename A, int i),_D_U_N_E___H_A_S_H___T_Y_P_E │ │ │ │ │ -(Foo)) │ │ │ │ │ -_D_U_N_E___D_E_F_I_N_E___H_A_S_H │ │ │ │ │ -#define DUNE_DEFINE_HASH(template_args, type) │ │ │ │ │ -Defines the required struct specialization to make type hashable via Dune:: │ │ │ │ │ -hash. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:100 │ │ │ │ │ -_D_U_N_E___H_A_S_H___T_Y_P_E │ │ │ │ │ -#define DUNE_HASH_TYPE(...) │ │ │ │ │ -Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:117 │ │ │ │ │ -_D_U_N_E___H_A_S_H___T_E_M_P_L_A_T_E___A_R_G_S │ │ │ │ │ -#define DUNE_HASH_TEMPLATE_ARGS(...) │ │ │ │ │ -Wrapper macro for the template arguments in DUNE_DEFINE_HASH. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:109 │ │ │ │ │ - Warning │ │ │ │ │ - As the specialization has to be placed in the original namespace of the │ │ │ │ │ - hash struct (e.g. std), this macro mmuusstt be called from the global │ │ │ │ │ - namespace! │ │ │ │ │ - Parameters │ │ │ │ │ - The template arguments required by the hash struct │ │ │ │ │ - specialization, wrapped in a call to │ │ │ │ │ - template_args DUNE_HASH_TEMPLATE_ARGS. If this is a complete │ │ │ │ │ - specialization, call DUNE_HASH_TEMPLATE_ARGS without │ │ │ │ │ - arguments. │ │ │ │ │ - type The exact type of the specialization, wrapped in a call to │ │ │ │ │ - DUNE_HASH_TYPE. │ │ │ │ │ -********** _?◆_? DDUUNNEE__HHAASSHH__TTEEMMPPLLAATTEE__AARRGGSS ********** │ │ │ │ │ -#define DUNE_HASH_TEMPLATE_ARGS (   ...... ) │ │ │ │ │ -Wrapper macro for the template arguments in DUNE_DEFINE_HASH. │ │ │ │ │ -This macro should always be used as a wrapper for the template arguments when │ │ │ │ │ -calling DUNE_DEFINE_HASH. It works around some preprocessor limitations when │ │ │ │ │ -the template arguments contain commas or the list is completely empty. │ │ │ │ │ -********** _?◆_? DDUUNNEE__HHAASSHH__TTYYPPEE ********** │ │ │ │ │ -#define DUNE_HASH_TYPE (   ...... ) │ │ │ │ │ -Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH. │ │ │ │ │ -This macro should always be used as a wrapper for the type of the │ │ │ │ │ -specialization when calling DUNE_DEFINE_HASH. It works around some preprocessor │ │ │ │ │ -limitations when the type contains commas. │ │ │ │ │ +********** _?◆_? DDUUNNEE__CCOOMMMMOONN__MMAATTHH__IISSFFUUNNCCTTIIOONN ********** │ │ │ │ │ +#define DUNE_COMMON_MATH_ISFUNCTION (   function, │ │ │ │ │ +   stdfunction  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +template \ │ │ │ │ │ +auto function(const T &t, PriorityTag<1>, ADLTag) \ │ │ │ │ │ +-> decltype(function(t)) { \ │ │ │ │ │ +return function(t); \ │ │ │ │ │ +} \ │ │ │ │ │ +template \ │ │ │ │ │ +auto function(const T &t, PriorityTag<0>, ADLTag) { \ │ │ │ │ │ +using std::stdfunction; \ │ │ │ │ │ +return stdfunction(t); \ │ │ │ │ │ +} \ │ │ │ │ │ +static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +********** _?◆_? DDUUNNEE__CCOOMMMMOONN__MMAATTHH__IISSFFUUNNCCTTIIOONN__FFUUNNCCTTOORR ********** │ │ │ │ │ +#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (   function ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +struct function##Impl { \ │ │ │ │ │ +template \ │ │ │ │ │ +constexpr auto operator()(const T &t) const { \ │ │ │ │ │ +return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \ │ │ │ │ │ +} \ │ │ │ │ │ +}; \ │ │ │ │ │ +static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: hash.hh Source File │ │ │ │ +dune-common: math.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,289 +74,373 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    hash.hh
    │ │ │ │ +
    math.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_HASH_HH
    │ │ │ │ -
    6#define DUNE_COMMON_HASH_HH
    │ │ │ │ +
    5#ifndef DUNE_MATH_HH
    │ │ │ │ +
    6#define DUNE_MATH_HH
    │ │ │ │
    7
    │ │ │ │ -
    8#include <functional>
    │ │ │ │ -
    9
    │ │ │ │ - │ │ │ │ -
    11
    │ │ │ │ -
    24// ********************************************************************************
    │ │ │ │ -
    25// Doxygen documentation
    │ │ │ │ -
    26// ********************************************************************************
    │ │ │ │ -
    27
    │ │ │ │ -
    28#ifdef DOXYGEN
    │ │ │ │ -
    29
    │ │ │ │ -
    30namespace Dune {
    │ │ │ │ -
    31
    │ │ │ │ -
    33
    │ │ │ │ -
    38 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    39 struct hash
    │ │ │ │ -
    40 {
    │ │ │ │ -
    41
    │ │ │ │ -
    │ │ │ │ -
    43 std::size_t operator()(const T& t) const
    │ │ │ │ -
    44 {
    │ │ │ │ -
    45 return hash(t);
    │ │ │ │ -
    46 }
    │ │ │ │ -
    │ │ │ │ -
    47
    │ │ │ │ -
    48 };
    │ │ │ │ -
    │ │ │ │ -
    49
    │ │ │ │ -
    50}
    │ │ │ │ -
    51
    │ │ │ │ -
    53
    │ │ │ │ -
    100#define DUNE_DEFINE_HASH(template_args,type)
    │ │ │ │ -
    101
    │ │ │ │ -
    102
    │ │ │ │ -
    104
    │ │ │ │ -
    109#define DUNE_HASH_TEMPLATE_ARGS(...)
    │ │ │ │ -
    110
    │ │ │ │ -
    112
    │ │ │ │ -
    117#define DUNE_HASH_TYPE(...)
    │ │ │ │ -
    118
    │ │ │ │ -
    119#else // DOXYGEN - hide all the ugly implementation
    │ │ │ │ -
    120
    │ │ │ │ -
    121
    │ │ │ │ -
    122
    │ │ │ │ -
    123// ********************************************************************************
    │ │ │ │ -
    124// C++11 support
    │ │ │ │ -
    125// ********************************************************************************
    │ │ │ │ +
    12#include <cmath>
    │ │ │ │ +
    13#include <complex>
    │ │ │ │ +
    14#include <limits>
    │ │ │ │ +
    15#include <type_traits>
    │ │ │ │ +
    16
    │ │ │ │ + │ │ │ │ +
    18
    │ │ │ │ +
    19namespace Dune
    │ │ │ │ +
    20{
    │ │ │ │ +
    21
    │ │ │ │ +
    32 template< class T >
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    34 {
    │ │ │ │ +
    │ │ │ │ +
    38 static const T e ()
    │ │ │ │ +
    39 {
    │ │ │ │ +
    40 using std::exp;
    │ │ │ │ +
    41 static const T e = exp( T( 1 ) );
    │ │ │ │ +
    42 return e;
    │ │ │ │ +
    43 }
    │ │ │ │ +
    │ │ │ │ +
    44
    │ │ │ │ +
    │ │ │ │ +
    48 static const T pi ()
    │ │ │ │ +
    49 {
    │ │ │ │ +
    50 using std::acos;
    │ │ │ │ +
    51 static const T pi = acos( T( -1 ) );
    │ │ │ │ +
    52 return pi;
    │ │ │ │ +
    53 }
    │ │ │ │ +
    │ │ │ │ +
    54 };
    │ │ │ │ +
    │ │ │ │ +
    55
    │ │ │ │ +
    56
    │ │ │ │ +
    64 template< class Field >
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    66 : public StandardMathematicalConstants<Field>
    │ │ │ │ +
    67 {};
    │ │ │ │ +
    │ │ │ │ +
    68
    │ │ │ │ +
    69
    │ │ │ │ +
    74 template <class Base, class Exponent>
    │ │ │ │ +
    │ │ │ │ +
    75 constexpr Base power(Base m, Exponent p)
    │ │ │ │ +
    76 {
    │ │ │ │ +
    77 static_assert(std::numeric_limits<Exponent>::is_integer, "Exponent must be an integer type!");
    │ │ │ │ +
    78
    │ │ │ │ +
    79 auto result = Base(1);
    │ │ │ │ +
    80 auto absp = (p<0) ? -p : p; // This is simply abs, but std::abs is not constexpr
    │ │ │ │ +
    81 for (Exponent i = Exponent(0); i<absp; i++)
    │ │ │ │ +
    82 result *= m;
    │ │ │ │ +
    83
    │ │ │ │ +
    84 if (p<0)
    │ │ │ │ +
    85 result = Base(1)/result;
    │ │ │ │ +
    86
    │ │ │ │ +
    87 return result;
    │ │ │ │ +
    88 }
    │ │ │ │ +
    │ │ │ │ +
    89
    │ │ │ │ +
    92 template <int m>
    │ │ │ │ +
    │ │ │ │ +
    93 struct Factorial
    │ │ │ │ +
    94 {
    │ │ │ │ +
    96 static constexpr int factorial = m * Factorial<m-1>::factorial;
    │ │ │ │ +
    97 };
    │ │ │ │ +
    │ │ │ │ +
    98
    │ │ │ │ +
    100 template <>
    │ │ │ │ +
    │ │ │ │ +
    101 struct [[deprecated("Use function factorial instead! Will be removed after Dune 2.9")]] Factorial<0>
    │ │ │ │ +
    102 {
    │ │ │ │ +
    103 // 0! = 1
    │ │ │ │ +
    104 static constexpr int factorial = 1;
    │ │ │ │ +
    105 };
    │ │ │ │ +
    │ │ │ │ +
    106
    │ │ │ │ +
    107
    │ │ │ │ +
    109 // T has to be an integral type
    │ │ │ │ +
    110 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    111 constexpr inline static T factorial(const T& n) noexcept
    │ │ │ │ +
    112 {
    │ │ │ │ +
    113 static_assert(std::numeric_limits<T>::is_integer, "`factorial(n)` has to be called with an integer type.");
    │ │ │ │ +
    114 T fac = 1;
    │ │ │ │ +
    115 for(T k = 0; k < n; ++k)
    │ │ │ │ +
    116 fac *= k+1;
    │ │ │ │ +
    117 return fac;
    │ │ │ │ +
    118 }
    │ │ │ │ +
    │ │ │ │ +
    119
    │ │ │ │ +
    121 template<class T, T n>
    │ │ │ │ +
    │ │ │ │ +
    122 constexpr inline static auto factorial (std::integral_constant<T, n>) noexcept
    │ │ │ │ +
    123 {
    │ │ │ │ +
    124 return std::integral_constant<T, factorial(n)>{};
    │ │ │ │ +
    125 }
    │ │ │ │ +
    │ │ │ │
    126
    │ │ │ │ -
    127// import std::hash into Dune namespace
    │ │ │ │ -
    128namespace Dune {
    │ │ │ │ -
    129
    │ │ │ │ -
    130 using std::hash;
    │ │ │ │ -
    131
    │ │ │ │ -
    132}
    │ │ │ │ -
    133
    │ │ │ │ -
    134// Macro for defining a std::hash specialization for type.
    │ │ │ │ -
    135// This should not be called directly. Call DUNE_DEFINE_HASH
    │ │ │ │ -
    136// instead.
    │ │ │ │ -
    137#define DUNE_DEFINE_STD_HASH(template_args,type) \
    │ │ │ │ -
    138 namespace std { \
    │ │ │ │ -
    139 \
    │ │ │ │ -
    140 template<template_args> \
    │ │ │ │ -
    141 struct hash<type> \
    │ │ │ │ -
    142 { \
    │ │ │ │ -
    143 \
    │ │ │ │ -
    144 typedef type argument_type; \
    │ │ │ │ -
    145 typedef std::size_t result_type; \
    │ │ │ │ -
    146 \
    │ │ │ │ -
    147 std::size_t operator()(const type& arg) const \
    │ │ │ │ -
    148 { \
    │ │ │ │ -
    149 return hash_value(arg); \
    │ │ │ │ -
    150 } \
    │ │ │ │ -
    151 }; \
    │ │ │ │ -
    152 \
    │ │ │ │ -
    153 template<template_args> \
    │ │ │ │ -
    154 struct hash<const type> \
    │ │ │ │ -
    155 { \
    │ │ │ │ -
    156 \
    │ │ │ │ -
    157 typedef type argument_type; \
    │ │ │ │ -
    158 typedef std::size_t result_type; \
    │ │ │ │ -
    159 \
    │ │ │ │ -
    160 std::size_t operator()(const type& arg) const \
    │ │ │ │ -
    161 { \
    │ │ │ │ -
    162 return hash_value(arg); \
    │ │ │ │ -
    163 } \
    │ │ │ │ -
    164 }; \
    │ │ │ │ -
    165 \
    │ │ │ │ -
    166 } \
    │ │ │ │ -
    167
    │ │ │ │ -
    168// Wrapper macro for template arguments.
    │ │ │ │ -
    169// This is required because the template arguments can contain commas,
    │ │ │ │ -
    170// which will create a macro argument list of unknown length. That in itself
    │ │ │ │ -
    171// would not be a problem, but DUNE_DEFINE_HASH has to be called with two argument
    │ │ │ │ -
    172// lists of unknown length. So this macro wraps its arguments with parentheses,
    │ │ │ │ -
    173// turning it into a single argument. The result is used as the parameter list of
    │ │ │ │ -
    174// an expansion macro in the calls to the implementation-specific macros
    │ │ │ │ -
    175// for C++11 and TR1. Noto that technically, this trick is only legal for C++11,
    │ │ │ │ -
    176// but pretty much every compiler supports variadic macros in C++03 mode, as they
    │ │ │ │ -
    177// are part of C99.
    │ │ │ │ -
    178#define DUNE_HASH_TEMPLATE_ARGS(...) (__VA_ARGS__)
    │ │ │ │ -
    179
    │ │ │ │ -
    180// Wrapper macro for type to be hashed.
    │ │ │ │ -
    181// See above for rationale.
    │ │ │ │ -
    182#define DUNE_HASH_TYPE(...) (__VA_ARGS__)
    │ │ │ │ -
    183
    │ │ │ │ -
    184// Expansion macro for the parenthesized argument lists created by
    │ │ │ │ -
    185// DUNE_HASH_TEMPLATE_ARGS and DUNE_HASH_TYPE.
    │ │ │ │ -
    186#define DUNE_HASH_EXPAND_VA_ARGS(...) __VA_ARGS__
    │ │ │ │ -
    187
    │ │ │ │ -
    188// Define specializations for all discovered hash implementations.
    │ │ │ │ -
    189#define DUNE_DEFINE_HASH(template_args,type) \
    │ │ │ │ -
    190 DUNE_DEFINE_STD_HASH(DUNE_HASH_EXPAND_VA_ARGS template_args, DUNE_HASH_EXPAND_VA_ARGS type) \
    │ │ │ │ -
    191
    │ │ │ │ -
    192
    │ │ │ │ -
    193#endif // DOXYGEN
    │ │ │ │ +
    127
    │ │ │ │ +
    129 // T has to be an integral type
    │ │ │ │ +
    130 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    131 constexpr inline static T binomial (const T& n, const T& k) noexcept
    │ │ │ │ +
    132 {
    │ │ │ │ +
    133 static_assert(std::numeric_limits<T>::is_integer, "`binomial(n, k)` has to be called with an integer type.");
    │ │ │ │ +
    134
    │ │ │ │ +
    135 if( k < 0 || k > n )
    │ │ │ │ +
    136 return 0;
    │ │ │ │ +
    137
    │ │ │ │ +
    138 if (2*k > n)
    │ │ │ │ +
    139 return binomial(n, n-k);
    │ │ │ │ +
    140
    │ │ │ │ +
    141 T bin = 1;
    │ │ │ │ +
    142 for(auto i = n-k; i < n; ++i)
    │ │ │ │ +
    143 bin *= i+1;
    │ │ │ │ +
    144 return bin / factorial(k);
    │ │ │ │ +
    145 }
    │ │ │ │ +
    │ │ │ │ +
    146
    │ │ │ │ +
    148 template<class T, T n, T k>
    │ │ │ │ +
    │ │ │ │ +
    149 constexpr inline static auto binomial (std::integral_constant<T, n>, std::integral_constant<T, k>) noexcept
    │ │ │ │ +
    150 {
    │ │ │ │ +
    151 return std::integral_constant<T, binomial(n, k)>{};
    │ │ │ │ +
    152 }
    │ │ │ │ +
    │ │ │ │ +
    153
    │ │ │ │ +
    154 template<class T, T n>
    │ │ │ │ +
    │ │ │ │ +
    155 constexpr inline static auto binomial (std::integral_constant<T, n>, std::integral_constant<T, n>) noexcept
    │ │ │ │ +
    156 {
    │ │ │ │ +
    157 return std::integral_constant<T, (n >= 0 ? 1 : 0)>{};
    │ │ │ │ +
    158 }
    │ │ │ │ +
    │ │ │ │ +
    159
    │ │ │ │ +
    160
    │ │ │ │ +
    162 // conjugate complex does nothing for non-complex types
    │ │ │ │ +
    163 template<class K>
    │ │ │ │ +
    │ │ │ │ +
    164 inline K conjugateComplex (const K& x)
    │ │ │ │ +
    165 {
    │ │ │ │ +
    166 return x;
    │ │ │ │ +
    167 }
    │ │ │ │ +
    │ │ │ │ +
    168
    │ │ │ │ +
    169#ifndef DOXYGEN
    │ │ │ │ +
    170 // specialization for complex
    │ │ │ │ +
    171 template<class K>
    │ │ │ │ +
    172 inline std::complex<K> conjugateComplex (const std::complex<K>& c)
    │ │ │ │ +
    173 {
    │ │ │ │ +
    174 return std::complex<K>(c.real(),-c.imag());
    │ │ │ │ +
    175 }
    │ │ │ │ +
    176#endif
    │ │ │ │ +
    177
    │ │ │ │ +
    179 template <class T>
    │ │ │ │ +
    │ │ │ │ +
    180 int sign(const T& val)
    │ │ │ │ +
    181 {
    │ │ │ │ +
    182 return (val < 0 ? -1 : 1);
    │ │ │ │ +
    183 }
    │ │ │ │ +
    │ │ │ │ +
    184
    │ │ │ │ +
    185
    │ │ │ │ +
    186 namespace Impl {
    │ │ │ │ +
    187 // Returns whether a given type behaves like std::complex<>, i.e. whether
    │ │ │ │ +
    188 // real() and imag() are defined
    │ │ │ │ +
    189 template<class T>
    │ │ │ │ +
    190 struct isComplexLike {
    │ │ │ │ +
    191 private:
    │ │ │ │ +
    192 template<class U>
    │ │ │ │ +
    193 static auto test(U* u) -> decltype(u->real(), u->imag(), std::true_type());
    │ │ │ │
    194
    │ │ │ │ -
    195
    │ │ │ │ -
    196
    │ │ │ │ -
    197// ********************************************************************************
    │ │ │ │ -
    198// Some utility functions for combining hashes of member variables.
    │ │ │ │ -
    199// ********************************************************************************
    │ │ │ │ -
    200
    │ │ │ │ -
    201namespace Dune {
    │ │ │ │ +
    195 template<class U>
    │ │ │ │ +
    196 static auto test(...) -> decltype(std::false_type());
    │ │ │ │ +
    197
    │ │ │ │ +
    198 public:
    │ │ │ │ +
    199 static const bool value = decltype(test<T>(0))::value;
    │ │ │ │ +
    200 };
    │ │ │ │ +
    201 } // namespace Impl
    │ │ │ │
    202
    │ │ │ │ -
    203 // The following functions are an implementation of the proposed hash extensions for
    │ │ │ │ -
    204 // the C++ standard by Peter Dimov
    │ │ │ │ -
    205 // (cf. http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf, issue 6.18).
    │ │ │ │ -
    206 // They are also contained in the boost::functional::hash library by Daniel James, but
    │ │ │ │ -
    207 // that implementation uses boost::hash internally, while we want to use Dune::hash. They
    │ │ │ │ -
    208 // are also considered for inclusion in TR2 (then based on std::hash, of course).
    │ │ │ │ -
    209
    │ │ │ │ -
    210#ifndef DOXYGEN
    │ │ │ │ -
    211
    │ │ │ │ -
    212 // helper struct for providing different hash combining algorithms dependent on
    │ │ │ │ -
    213 // the size of size_t.
    │ │ │ │ -
    214 // hash_combiner has to be specialized for the size (in bytes) of std::size_t.
    │ │ │ │ -
    215 // Specialized versions should provide a method
    │ │ │ │ -
    216 //
    │ │ │ │ -
    217 // template <typename typeof_size_t, typename T>
    │ │ │ │ -
    218 // void operator()(typeof_size_t& seed, const T& arg) const;
    │ │ │ │ -
    219 //
    │ │ │ │ -
    220 // that will be called by the interface function hash_combine() described further below.
    │ │ │ │ -
    221 // The redundant template parameter typeof_size_t is needed to avoid warnings for the
    │ │ │ │ -
    222 // unused 64-bit specialization on 32-bit systems.
    │ │ │ │ -
    223 //
    │ │ │ │ -
    224 // There is no default implementation!
    │ │ │ │ -
    225 template<int sizeof_size_t>
    │ │ │ │ -
    226 struct hash_combiner;
    │ │ │ │ -
    227
    │ │ │ │ +
    204
    │ │ │ │ +
    227 namespace MathOverloads {
    │ │ │ │
    228
    │ │ │ │ -
    229 // hash combining for 64-bit platforms.
    │ │ │ │ -
    230 template<>
    │ │ │ │ -
    231 struct hash_combiner<8>
    │ │ │ │ -
    232 {
    │ │ │ │ -
    233
    │ │ │ │ -
    234 template<typename typeof_size_t, typename T>
    │ │ │ │ -
    235 void operator()(typeof_size_t& seed, const T& arg) const
    │ │ │ │ -
    236 {
    │ │ │ │ -
    237 static_assert(sizeof(typeof_size_t)==8, "hash_combiner::operator() instantiated with nonmatching type and size");
    │ │ │ │ -
    238
    │ │ │ │ -
    239 // The following algorithm for combining two 64-bit hash values is inspired by a similar
    │ │ │ │ -
    240 // function in CityHash (http://cityhash.googlecode.com/svn-history/r2/trunk/src/city.h),
    │ │ │ │ -
    241 // which is in turn based on ideas from the MurmurHash library. The basic idea is easy to
    │ │ │ │ -
    242 // grasp, though: New information is XORed into the existing hash multiple times at different
    │ │ │ │ -
    243 // places (using shift operations), and the resulting pattern is spread over the complete
    │ │ │ │ -
    244 // range of available bits via multiplication with a "magic" constant. The constants used
    │ │ │ │ -
    245 // below (47 and 0x9ddfea08eb382d69ULL) are taken from the CityHash implementation.
    │ │ │ │ -
    246 //
    │ │ │ │ -
    247 // We opted not to use the mixing algorithm proposed in the C++ working group defect list at
    │ │ │ │ -
    248 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf, p. 57f. because it
    │ │ │ │ -
    249 // has very bad hash distribution properties if you apply it to lists of very small numbers,
    │ │ │ │ -
    250 // an application that is frequent in PDELab's ordering framework.
    │ │ │ │ -
    251
    │ │ │ │ -
    252 Dune::hash<T> hasher;
    │ │ │ │ -
    253 const typeof_size_t kMul = 0x9ddfea08eb382d69ULL;
    │ │ │ │ -
    254 typeof_size_t h = hasher(arg);
    │ │ │ │ -
    255 typeof_size_t a = (seed ^ h) * kMul;
    │ │ │ │ -
    256 a ^= (a >> 47);
    │ │ │ │ -
    257 typeof_size_t b = (h ^ a) * kMul;
    │ │ │ │ -
    258 b ^= (b >> 47);
    │ │ │ │ -
    259 b *= kMul;
    │ │ │ │ -
    260 seed = b;
    │ │ │ │ -
    261 }
    │ │ │ │ +
    230 struct ADLTag {};
    │ │ │ │ +
    231
    │ │ │ │ +
    │ │ │ │ +
    232#define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction) \
    │ │ │ │ +
    233 template<class T> \
    │ │ │ │ +
    234 auto function(const T &t, PriorityTag<1>, ADLTag) \
    │ │ │ │ +
    235 -> decltype(function(t)) { \
    │ │ │ │ +
    236 return function(t); \
    │ │ │ │ +
    237 } \
    │ │ │ │ +
    238 template<class T> \
    │ │ │ │ +
    239 auto function(const T &t, PriorityTag<0>, ADLTag) { \
    │ │ │ │ +
    240 using std::stdfunction; \
    │ │ │ │ +
    241 return stdfunction(t); \
    │ │ │ │ +
    242 } \
    │ │ │ │ +
    243 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │ +
    244
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    248#undef DUNE_COMMON_MATH_ISFUNCTION
    │ │ │ │ +
    249
    │ │ │ │ +
    250 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    251 auto isUnordered(const T &t1, const T &t2, PriorityTag<1>, ADLTag)
    │ │ │ │ +
    252 -> decltype(isUnordered(t1, t2)) {
    │ │ │ │ +
    253 return isUnordered(t1, t2);
    │ │ │ │ +
    254 }
    │ │ │ │ +
    │ │ │ │ +
    255
    │ │ │ │ +
    256 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    257 auto isUnordered(const T &t1, const T &t2, PriorityTag<0>, ADLTag) {
    │ │ │ │ +
    258 using std::isunordered;
    │ │ │ │ +
    259 return isunordered(t1, t2);
    │ │ │ │ +
    260 }
    │ │ │ │ +
    │ │ │ │ +
    261 }
    │ │ │ │
    262
    │ │ │ │ -
    263 };
    │ │ │ │ +
    │ │ │ │ +
    263 namespace MathImpl {
    │ │ │ │
    264
    │ │ │ │ -
    265
    │ │ │ │ -
    266 // hash combining for 32-bit platforms.
    │ │ │ │ -
    267 template<>
    │ │ │ │ -
    268 struct hash_combiner<4>
    │ │ │ │ -
    269 {
    │ │ │ │ -
    270
    │ │ │ │ -
    271 template<typename typeof_size_t, typename T>
    │ │ │ │ -
    272 void operator()(typeof_size_t& seed, const T& arg) const
    │ │ │ │ -
    273 {
    │ │ │ │ -
    274 static_assert(sizeof(typeof_size_t)==4, "hash_combiner::operator() instantiated with nonmatching type and size");
    │ │ │ │ -
    275
    │ │ │ │ -
    276 // The default algorithm above requires a 64-bit std::size_t. The following algorithm is a
    │ │ │ │ -
    277 // 32-bit compatible fallback, again inspired by CityHash and MurmurHash
    │ │ │ │ -
    278 // (http://cityhash.googlecode.com/svn-history/r2/trunk/src/city.cc).
    │ │ │ │ -
    279 // It uses 32-bit constants and relies on rotation instead of multiplication to spread the
    │ │ │ │ -
    280 // mixed bits as that is apparently more efficient on IA-32. The constants used below are again
    │ │ │ │ -
    281 // taken from CityHash, in particular from the file referenced above.
    │ │ │ │ +
    265 // NOTE: it is important that these functors have names different from the
    │ │ │ │ +
    266 // names of the functions they are forwarding to. Otherwise the
    │ │ │ │ +
    267 // unqualified call would find the functor type, not a function, and ADL
    │ │ │ │ +
    268 // would never be attempted.
    │ │ │ │ +
    │ │ │ │ +
    269#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function) \
    │ │ │ │ +
    270 struct function##Impl { \
    │ │ │ │ +
    271 template<class T> \
    │ │ │ │ +
    272 constexpr auto operator()(const T &t) const { \
    │ │ │ │ +
    273 return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \
    │ │ │ │ +
    274 } \
    │ │ │ │ +
    275 }; \
    │ │ │ │ +
    276 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │ +
    277
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    281#undef DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR
    │ │ │ │
    282
    │ │ │ │ -
    283 Dune::hash<T> hasher;
    │ │ │ │ -
    284 const typeof_size_t c1 = 0xcc9e2d51;
    │ │ │ │ -
    285 const typeof_size_t c2 = 0x1b873593;
    │ │ │ │ -
    286 const typeof_size_t c3 = 0xe6546b64;
    │ │ │ │ -
    287 typeof_size_t h = hasher(arg);
    │ │ │ │ -
    288 typeof_size_t a = seed * c1;
    │ │ │ │ -
    289 a = (a >> 17) | (a << (32 - 17));
    │ │ │ │ -
    290 a *= c2;
    │ │ │ │ -
    291 h ^= a;
    │ │ │ │ -
    292 h = (h >> 19) | (h << (32 - 19));
    │ │ │ │ -
    293 seed = h * 5 + c3;
    │ │ │ │ -
    294 }
    │ │ │ │ -
    295
    │ │ │ │ -
    296 };
    │ │ │ │ -
    297
    │ │ │ │ -
    298#endif // DOXYGEN
    │ │ │ │ -
    299
    │ │ │ │ -
    301
    │ │ │ │ -
    306 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    307 inline void hash_combine(std::size_t& seed, const T& arg)
    │ │ │ │ -
    308 {
    │ │ │ │ -
    309 hash_combiner<sizeof(std::size_t)>()(seed,arg);
    │ │ │ │ -
    310 }
    │ │ │ │ -
    │ │ │ │ -
    311
    │ │ │ │ -
    313
    │ │ │ │ -
    321 template<typename It>
    │ │ │ │ -
    │ │ │ │ -
    322 inline std::size_t hash_range(It first, It last)
    │ │ │ │ -
    323 {
    │ │ │ │ -
    324 std::size_t seed = 0;
    │ │ │ │ -
    325 for (; first != last; ++first)
    │ │ │ │ -
    326 {
    │ │ │ │ -
    327 hash_combine(seed,*first);
    │ │ │ │ -
    328 }
    │ │ │ │ -
    329 return seed;
    │ │ │ │ -
    330 }
    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    284 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    285 constexpr auto operator()(const T &t1, const T &t2) const {
    │ │ │ │ +
    286 return isUnordered(t1, t2, PriorityTag<10>{}, MathOverloads::ADLTag{});
    │ │ │ │ +
    287 }
    │ │ │ │ +
    │ │ │ │ +
    288 };
    │ │ │ │ +
    │ │ │ │ +
    289
    │ │ │ │ +
    290 } //MathImpl
    │ │ │ │ +
    │ │ │ │ +
    291
    │ │ │ │ +
    292
    │ │ │ │ +
    293 namespace Impl {
    │ │ │ │ +
    294 /* This helper has a math functor as a static constexpr member. Doing
    │ │ │ │ +
    295 this as a static member of a template struct means we can do this
    │ │ │ │ +
    296 without violating the ODR or putting the definition into a separate
    │ │ │ │ +
    297 compilation unit, while still still ensuring the functor is the same
    │ │ │ │ +
    298 lvalue across all compilation units.
    │ │ │ │ +
    299 */
    │ │ │ │ +
    300 template<class T>
    │ │ │ │ +
    301 struct MathDummy
    │ │ │ │ +
    302 {
    │ │ │ │ +
    303 static constexpr T value{};
    │ │ │ │ +
    304 };
    │ │ │ │ +
    305
    │ │ │ │ +
    306 template<class T>
    │ │ │ │ +
    307 constexpr T MathDummy<T>::value;
    │ │ │ │ +
    308
    │ │ │ │ +
    309 } //namespace Impl
    │ │ │ │ +
    310
    │ │ │ │ +
    311 namespace {
    │ │ │ │ +
    312 /* Provide the math functors directly in the `Dune` namespace.
    │ │ │ │ +
    313
    │ │ │ │ +
    314 This actually declares a different name in each translation unit, but
    │ │ │ │ +
    315 they all resolve to the same lvalue.
    │ │ │ │ +
    316 */
    │ │ │ │ +
    317
    │ │ │ │ +
    319
    │ │ │ │ +
    323 constexpr auto const &isNaN = Impl::MathDummy<MathImpl::isNaNImpl>::value;
    │ │ │ │ +
    324
    │ │ │ │ +
    326
    │ │ │ │ +
    330 constexpr auto const &isInf = Impl::MathDummy<MathImpl::isInfImpl>::value;
    │ │ │ │
    331
    │ │ │ │
    333
    │ │ │ │ -
    340 template<typename It>
    │ │ │ │ -
    │ │ │ │ -
    341 inline void hash_range(std::size_t& seed, It first, It last)
    │ │ │ │ -
    342 {
    │ │ │ │ -
    343 for (; first != last; ++first)
    │ │ │ │ -
    344 {
    │ │ │ │ -
    345 hash_combine(seed,*first);
    │ │ │ │ -
    346 }
    │ │ │ │ -
    347 }
    │ │ │ │ -
    │ │ │ │ -
    348
    │ │ │ │ -
    349} // end namespace Dune
    │ │ │ │ -
    350
    │ │ │ │ -
    351#endif // DUNE_COMMON_HASH_HH
    │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ +
    337 constexpr auto const &isFinite = Impl::MathDummy<MathImpl::isFiniteImpl>::value;
    │ │ │ │ +
    338
    │ │ │ │ +
    340
    │ │ │ │ +
    345 constexpr auto const &isUnordered = Impl::MathDummy<MathImpl::isUnorderedImpl>::value;
    │ │ │ │ +
    346 }
    │ │ │ │ +
    347
    │ │ │ │ +
    348 namespace MathOverloads {
    │ │ │ │ +
    349 /*Overloads for complex types*/
    │ │ │ │ +
    350 template<class T, class = std::enable_if_t<Impl::isComplexLike<T>::value> >
    │ │ │ │ +
    │ │ │ │ +
    351 auto isNaN(const T &t, PriorityTag<2>, ADLTag) {
    │ │ │ │ +
    352 return Dune::isNaN(real(t)) || Dune::isNaN(imag(t));
    │ │ │ │ +
    353 }
    │ │ │ │ +
    │ │ │ │ +
    354
    │ │ │ │ +
    355 template<class T, class = std::enable_if_t<Impl::isComplexLike<T>::value> >
    │ │ │ │ +
    │ │ │ │ +
    356 auto isInf(const T &t, PriorityTag<2>, ADLTag) {
    │ │ │ │ +
    357 return Dune::isInf(real(t)) || Dune::isInf(imag(t));
    │ │ │ │ +
    358 }
    │ │ │ │ +
    │ │ │ │ +
    359
    │ │ │ │ +
    360 template<class T, class = std::enable_if_t<Impl::isComplexLike<T>::value> >
    │ │ │ │ +
    │ │ │ │ +
    361 auto isFinite(const T &t, PriorityTag<2>, ADLTag) {
    │ │ │ │ +
    362 return Dune::isFinite(real(t)) && Dune::isFinite(imag(t));
    │ │ │ │ +
    363 }
    │ │ │ │ +
    │ │ │ │ +
    364 } //MathOverloads
    │ │ │ │ +
    365}
    │ │ │ │ +
    366
    │ │ │ │ +
    367#endif // #ifndef DUNE_MATH_HH
    │ │ │ │ +
    #define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function)
    Definition math.hh:269
    │ │ │ │ +
    #define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction)
    Definition math.hh:232
    │ │ │ │ +
    Utilities for type computations, constraining overloads, ...
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    std::size_t hash_range(It first, It last)
    Hashes all elements in the range [first,last) and returns the combined hash.
    Definition hash.hh:322
    │ │ │ │ -
    void hash_combine(std::size_t &seed, const T &arg)
    Calculates the hash value of arg and combines it in-place with seed.
    Definition hash.hh:307
    │ │ │ │ -
    Functor for hashing objects of type T.
    Definition hash.hh:40
    │ │ │ │ -
    std::size_t operator()(const T &t) const
    Calculates the hash of t.
    Definition hash.hh:43
    │ │ │ │ +
    static constexpr T binomial(const T &n, const T &k) noexcept
    calculate the binomial coefficient n over k as a constexpr
    Definition math.hh:131
    │ │ │ │ +
    constexpr Base power(Base m, Exponent p)
    Power method for integer exponents.
    Definition math.hh:75
    │ │ │ │ +
    static constexpr T factorial(const T &n) noexcept
    calculate the factorial of n as a constexpr
    Definition math.hh:111
    │ │ │ │ +
    int sign(const T &val)
    Return the sign of the value.
    Definition math.hh:180
    │ │ │ │ +
    K conjugateComplex(const K &x)
    compute conjugate complex of x
    Definition math.hh:164
    │ │ │ │ +
    bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:604
    │ │ │ │ +
    bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:594
    │ │ │ │ +
    auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:584
    │ │ │ │ +
    bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:614
    │ │ │ │ +
    Standard implementation of MathematicalConstants.
    Definition math.hh:34
    │ │ │ │ +
    static const T e()
    Euler's number.
    Definition math.hh:38
    │ │ │ │ +
    static const T pi()
    Archimedes' constant.
    Definition math.hh:48
    │ │ │ │ +
    Provides commonly used mathematical constants.
    Definition math.hh:67
    │ │ │ │ +
    Definition math.hh:94
    │ │ │ │ +
    static constexpr int factorial
    factorial stores m!
    Definition math.hh:96
    │ │ │ │ +
    Tag to make sure the functions in this namespace can be found by ADL.
    Definition math.hh:230
    │ │ │ │ +
    Definition math.hh:283
    │ │ │ │ +
    constexpr auto operator()(const T &t1, const T &t2) const
    Definition math.hh:285
    │ │ │ │ +
    Helper class for tagging priorities.
    Definition typeutilities.hh:73
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,329 +1,381 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -hash.hh │ │ │ │ │ +math.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_HASH_HH │ │ │ │ │ -6#define DUNE_COMMON_HASH_HH │ │ │ │ │ +5#ifndef DUNE_MATH_HH │ │ │ │ │ +6#define DUNE_MATH_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -11 │ │ │ │ │ -24/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -25// Doxygen documentation │ │ │ │ │ -26/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -27 │ │ │ │ │ -28#ifdef DOXYGEN │ │ │ │ │ -29 │ │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ │ -31 │ │ │ │ │ -33 │ │ │ │ │ -38 template │ │ │ │ │ -_3_9 struct _h_a_s_h │ │ │ │ │ -40 { │ │ │ │ │ -41 │ │ │ │ │ -_4_3 std::size_t _o_p_e_r_a_t_o_r_(_)(const T& t) const │ │ │ │ │ -44 { │ │ │ │ │ -45 return _h_a_s_h(t); │ │ │ │ │ -46 } │ │ │ │ │ -47 │ │ │ │ │ -48 }; │ │ │ │ │ -49 │ │ │ │ │ -50} │ │ │ │ │ -51 │ │ │ │ │ -53 │ │ │ │ │ -_1_0_0#define DUNE_DEFINE_HASH(template_args,type) │ │ │ │ │ -101 │ │ │ │ │ -102 │ │ │ │ │ -104 │ │ │ │ │ -_1_0_9#define DUNE_HASH_TEMPLATE_ARGS(...) │ │ │ │ │ -110 │ │ │ │ │ -112 │ │ │ │ │ -_1_1_7#define DUNE_HASH_TYPE(...) │ │ │ │ │ -118 │ │ │ │ │ -119#else // DOXYGEN - hide all the ugly implementation │ │ │ │ │ -120 │ │ │ │ │ -121 │ │ │ │ │ -122 │ │ │ │ │ -123/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -124// C++11 support │ │ │ │ │ -125/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +18 │ │ │ │ │ +19namespace _D_u_n_e │ │ │ │ │ +20{ │ │ │ │ │ +21 │ │ │ │ │ +32 template< class T > │ │ │ │ │ +_3_3 struct _S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ +34 { │ │ │ │ │ +_3_8 static const T _e () │ │ │ │ │ +39 { │ │ │ │ │ +40 using std::exp; │ │ │ │ │ +41 static const T _e = exp( T( 1 ) ); │ │ │ │ │ +42 return _e; │ │ │ │ │ +43 } │ │ │ │ │ +44 │ │ │ │ │ +_4_8 static const T _p_i () │ │ │ │ │ +49 { │ │ │ │ │ +50 using std::acos; │ │ │ │ │ +51 static const T _p_i = acos( T( -1 ) ); │ │ │ │ │ +52 return _p_i; │ │ │ │ │ +53 } │ │ │ │ │ +54 }; │ │ │ │ │ +55 │ │ │ │ │ +56 │ │ │ │ │ +64 template< class Field > │ │ │ │ │ +_6_5 struct _M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ +66 : public _S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ +67 {}; │ │ │ │ │ +68 │ │ │ │ │ +69 │ │ │ │ │ +74 template │ │ │ │ │ +_7_5 constexpr Base _p_o_w_e_r(Base m, Exponent p) │ │ │ │ │ +76 { │ │ │ │ │ +77 static_assert(std::numeric_limits::is_integer, "Exponent must be │ │ │ │ │ +an integer type!"); │ │ │ │ │ +78 │ │ │ │ │ +79 auto result = Base(1); │ │ │ │ │ +80 auto absp = (p<0) ? -p : p; // This is simply abs, but std::abs is not │ │ │ │ │ +constexpr │ │ │ │ │ +81 for (Exponent i = Exponent(0); i │ │ │ │ │ +_9_3 struct _F_a_c_t_o_r_i_a_l │ │ │ │ │ +94 { │ │ │ │ │ +_9_6 static constexpr int _f_a_c_t_o_r_i_a_l = m * _F_a_c_t_o_r_i_a_l_:_:_f_a_c_t_o_r_i_a_l; │ │ │ │ │ +97 }; │ │ │ │ │ +98 │ │ │ │ │ +100 template <> │ │ │ │ │ +_1_0_1 struct [[deprecated("Use function factorial instead! Will be removed after │ │ │ │ │ +Dune 2.9")]] _F_a_c_t_o_r_i_a_l<0> │ │ │ │ │ +102 { │ │ │ │ │ +103 // 0! = 1 │ │ │ │ │ +_1_0_4 static constexpr int _f_a_c_t_o_r_i_a_l = 1; │ │ │ │ │ +105 }; │ │ │ │ │ +106 │ │ │ │ │ +107 │ │ │ │ │ +109 // T has to be an integral type │ │ │ │ │ +110 template │ │ │ │ │ +_1_1_1 constexpr inline static T _f_a_c_t_o_r_i_a_l(const T& n) noexcept │ │ │ │ │ +112 { │ │ │ │ │ +113 static_assert(std::numeric_limits::is_integer, "`factorial(n)` has to be │ │ │ │ │ +called with an integer type."); │ │ │ │ │ +114 T fac = 1; │ │ │ │ │ +115 for(T k = 0; k < n; ++k) │ │ │ │ │ +116 fac *= k+1; │ │ │ │ │ +117 return fac; │ │ │ │ │ +118 } │ │ │ │ │ +119 │ │ │ │ │ +121 template │ │ │ │ │ +_1_2_2 constexpr inline static auto _f_a_c_t_o_r_i_a_l (std::integral_constant) │ │ │ │ │ +noexcept │ │ │ │ │ +123 { │ │ │ │ │ +124 return std::integral_constant{}; │ │ │ │ │ +125 } │ │ │ │ │ 126 │ │ │ │ │ -127// import std::hash into Dune namespace │ │ │ │ │ -128namespace _D_u_n_e { │ │ │ │ │ -129 │ │ │ │ │ -130 using std::hash; │ │ │ │ │ -131 │ │ │ │ │ -132} │ │ │ │ │ -133 │ │ │ │ │ -134// Macro for defining a std::hash specialization for type. │ │ │ │ │ -135// This should not be called directly. Call DUNE_DEFINE_HASH │ │ │ │ │ -136// instead. │ │ │ │ │ -137#define DUNE_DEFINE_STD_HASH(template_args,type) \ │ │ │ │ │ -138 namespace std { \ │ │ │ │ │ -139 \ │ │ │ │ │ -140 template \ │ │ │ │ │ -141 struct hash \ │ │ │ │ │ -142 { \ │ │ │ │ │ -143 \ │ │ │ │ │ -144 typedef type argument_type; \ │ │ │ │ │ -145 typedef std::size_t result_type; \ │ │ │ │ │ -146 \ │ │ │ │ │ -147 std::size_t operator()(const type& arg) const \ │ │ │ │ │ -148 { \ │ │ │ │ │ -149 return hash_value(arg); \ │ │ │ │ │ -150 } \ │ │ │ │ │ -151 }; \ │ │ │ │ │ -152 \ │ │ │ │ │ -153 template \ │ │ │ │ │ -154 struct hash \ │ │ │ │ │ -155 { \ │ │ │ │ │ -156 \ │ │ │ │ │ -157 typedef type argument_type; \ │ │ │ │ │ -158 typedef std::size_t result_type; \ │ │ │ │ │ -159 \ │ │ │ │ │ -160 std::size_t operator()(const type& arg) const \ │ │ │ │ │ -161 { \ │ │ │ │ │ -162 return hash_value(arg); \ │ │ │ │ │ -163 } \ │ │ │ │ │ -164 }; \ │ │ │ │ │ -165 \ │ │ │ │ │ -166 } \ │ │ │ │ │ -167 │ │ │ │ │ -168// Wrapper macro for template arguments. │ │ │ │ │ -169// This is required because the template arguments can contain commas, │ │ │ │ │ -170// which will create a macro argument list of unknown length. That in itself │ │ │ │ │ -171// would not be a problem, but DUNE_DEFINE_HASH has to be called with two │ │ │ │ │ -argument │ │ │ │ │ -172// lists of unknown length. So this macro wraps its arguments with │ │ │ │ │ -parentheses, │ │ │ │ │ -173// turning it into a single argument. The result is used as the parameter │ │ │ │ │ -list of │ │ │ │ │ -174// an expansion macro in the calls to the implementation-specific macros │ │ │ │ │ -175// for C++11 and TR1. Noto that technically, this trick is only legal for │ │ │ │ │ -C++11, │ │ │ │ │ -176// but pretty much every compiler supports variadic macros in C++03 mode, as │ │ │ │ │ -they │ │ │ │ │ -177// are part of C99. │ │ │ │ │ -178#define DUNE_HASH_TEMPLATE_ARGS(...) (__VA_ARGS__) │ │ │ │ │ -179 │ │ │ │ │ -180// Wrapper macro for type to be hashed. │ │ │ │ │ -181// See above for rationale. │ │ │ │ │ -182#define DUNE_HASH_TYPE(...) (__VA_ARGS__) │ │ │ │ │ -183 │ │ │ │ │ -184// Expansion macro for the parenthesized argument lists created by │ │ │ │ │ -185// DUNE_HASH_TEMPLATE_ARGS and DUNE_HASH_TYPE. │ │ │ │ │ -186#define DUNE_HASH_EXPAND_VA_ARGS(...) __VA_ARGS__ │ │ │ │ │ -187 │ │ │ │ │ -188// Define specializations for all discovered hash implementations. │ │ │ │ │ -189#define DUNE_DEFINE_HASH(template_args,type) \ │ │ │ │ │ -190 DUNE_DEFINE_STD_HASH(DUNE_HASH_EXPAND_VA_ARGS template_args, │ │ │ │ │ -DUNE_HASH_EXPAND_VA_ARGS type) \ │ │ │ │ │ -191 │ │ │ │ │ -192 │ │ │ │ │ -193#endif // DOXYGEN │ │ │ │ │ +127 │ │ │ │ │ +129 // T has to be an integral type │ │ │ │ │ +130 template │ │ │ │ │ +_1_3_1 constexpr inline static T _b_i_n_o_m_i_a_l (const T& n, const T& k) noexcept │ │ │ │ │ +132 { │ │ │ │ │ +133 static_assert(std::numeric_limits::is_integer, "`binomial(n, k)` has to │ │ │ │ │ +be called with an integer type."); │ │ │ │ │ +134 │ │ │ │ │ +135 if( k < 0 || k > n ) │ │ │ │ │ +136 return 0; │ │ │ │ │ +137 │ │ │ │ │ +138 if (2*k > n) │ │ │ │ │ +139 return _b_i_n_o_m_i_a_l(n, n-k); │ │ │ │ │ +140 │ │ │ │ │ +141 T bin = 1; │ │ │ │ │ +142 for(auto i = n-k; i < n; ++i) │ │ │ │ │ +143 bin *= i+1; │ │ │ │ │ +144 return bin / _f_a_c_t_o_r_i_a_l(k); │ │ │ │ │ +145 } │ │ │ │ │ +146 │ │ │ │ │ +148 template │ │ │ │ │ +_1_4_9 constexpr inline static auto _b_i_n_o_m_i_a_l (std::integral_constant, std:: │ │ │ │ │ +integral_constant) noexcept │ │ │ │ │ +150 { │ │ │ │ │ +151 return std::integral_constant{}; │ │ │ │ │ +152 } │ │ │ │ │ +153 │ │ │ │ │ +154 template │ │ │ │ │ +_1_5_5 constexpr inline static auto _b_i_n_o_m_i_a_l (std::integral_constant, std:: │ │ │ │ │ +integral_constant) noexcept │ │ │ │ │ +156 { │ │ │ │ │ +157 return std::integral_constant= 0 ? 1 : 0)>{}; │ │ │ │ │ +158 } │ │ │ │ │ +159 │ │ │ │ │ +160 │ │ │ │ │ +162 // conjugate complex does nothing for non-complex types │ │ │ │ │ +163 template │ │ │ │ │ +_1_6_4 inline K _c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x (const K& x) │ │ │ │ │ +165 { │ │ │ │ │ +166 return x; │ │ │ │ │ +167 } │ │ │ │ │ +168 │ │ │ │ │ +169#ifndef DOXYGEN │ │ │ │ │ +170 // specialization for complex │ │ │ │ │ +171 template │ │ │ │ │ +172 inline std::complex _c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x (const std::complex& c) │ │ │ │ │ +173 { │ │ │ │ │ +174 return std::complex(c.real(),-c.imag()); │ │ │ │ │ +175 } │ │ │ │ │ +176#endif │ │ │ │ │ +177 │ │ │ │ │ +179 template │ │ │ │ │ +_1_8_0 int _s_i_g_n(const T& val) │ │ │ │ │ +181 { │ │ │ │ │ +182 return (val < 0 ? -1 : 1); │ │ │ │ │ +183 } │ │ │ │ │ +184 │ │ │ │ │ +185 │ │ │ │ │ +186 namespace Impl { │ │ │ │ │ +187 // Returns whether a given type behaves like std::complex<>, i.e. whether │ │ │ │ │ +188 // real() and imag() are defined │ │ │ │ │ +189 template │ │ │ │ │ +190 struct isComplexLike { │ │ │ │ │ +191 private: │ │ │ │ │ +192 template │ │ │ │ │ +193 static auto test(U* u) -> decltype(u->real(), u->imag(), std::true_type()); │ │ │ │ │ 194 │ │ │ │ │ -195 │ │ │ │ │ -196 │ │ │ │ │ -197/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -198// Some utility functions for combining hashes of member variables. │ │ │ │ │ -199/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -200 │ │ │ │ │ -201namespace _D_u_n_e { │ │ │ │ │ +195 template │ │ │ │ │ +196 static auto test(...) -> decltype(std::false_type()); │ │ │ │ │ +197 │ │ │ │ │ +198 public: │ │ │ │ │ +199 static const bool value = decltype(test(0))::value; │ │ │ │ │ +200 }; │ │ │ │ │ +201 } // namespace Impl │ │ │ │ │ 202 │ │ │ │ │ -203 // The following functions are an implementation of the proposed hash │ │ │ │ │ -extensions for │ │ │ │ │ -204 // the C++ standard by Peter Dimov │ │ │ │ │ -205 // (cf. http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf, │ │ │ │ │ -issue 6.18). │ │ │ │ │ -206 // They are also contained in the boost::functional::hash library by Daniel │ │ │ │ │ -James, but │ │ │ │ │ -207 // that implementation uses boost::hash internally, while we want to use │ │ │ │ │ -Dune::hash. They │ │ │ │ │ -208 // are also considered for inclusion in TR2 (then based on std::hash, of │ │ │ │ │ -course). │ │ │ │ │ -209 │ │ │ │ │ -210#ifndef DOXYGEN │ │ │ │ │ -211 │ │ │ │ │ -212 // helper struct for providing different hash combining algorithms │ │ │ │ │ -dependent on │ │ │ │ │ -213 // the size of size_t. │ │ │ │ │ -214 // hash_combiner has to be specialized for the size (in bytes) of std:: │ │ │ │ │ -size_t. │ │ │ │ │ -215 // Specialized versions should provide a method │ │ │ │ │ -216 // │ │ │ │ │ -217 // template │ │ │ │ │ -218 // void operator()(typeof_size_t& seed, const T& arg) const; │ │ │ │ │ -219 // │ │ │ │ │ -220 // that will be called by the interface function hash_combine() described │ │ │ │ │ -further below. │ │ │ │ │ -221 // The redundant template parameter typeof_size_t is needed to avoid │ │ │ │ │ -warnings for the │ │ │ │ │ -222 // unused 64-bit specialization on 32-bit systems. │ │ │ │ │ -223 // │ │ │ │ │ -224 // There is no default implementation! │ │ │ │ │ -225 template │ │ │ │ │ -226 struct hash_combiner; │ │ │ │ │ -227 │ │ │ │ │ +204 │ │ │ │ │ +227 namespace MathOverloads { │ │ │ │ │ 228 │ │ │ │ │ -229 // hash combining for 64-bit platforms. │ │ │ │ │ -230 template<> │ │ │ │ │ -231 struct hash_combiner<8> │ │ │ │ │ -232 { │ │ │ │ │ -233 │ │ │ │ │ -234 template │ │ │ │ │ -235 void operator()(typeof_size_t& seed, const T& arg) const │ │ │ │ │ -236 { │ │ │ │ │ -237 static_assert(sizeof(typeof_size_t)==8, "hash_combiner::operator() │ │ │ │ │ -instantiated with nonmatching type and size"); │ │ │ │ │ -238 │ │ │ │ │ -239 // The following algorithm for combining two 64-bit hash values is inspired │ │ │ │ │ -by a similar │ │ │ │ │ -240 // function in CityHash (http://cityhash.googlecode.com/svn-history/r2/ │ │ │ │ │ -trunk/src/city.h), │ │ │ │ │ -241 // which is in turn based on ideas from the MurmurHash library. The basic │ │ │ │ │ -idea is easy to │ │ │ │ │ -242 // grasp, though: New information is XORed into the existing hash multiple │ │ │ │ │ -times at different │ │ │ │ │ -243 // places (using shift operations), and the resulting pattern is spread │ │ │ │ │ -over the complete │ │ │ │ │ -244 // range of available bits via multiplication with a "magic" constant. The │ │ │ │ │ -constants used │ │ │ │ │ -245 // below (47 and 0x9ddfea08eb382d69ULL) are taken from the CityHash │ │ │ │ │ -implementation. │ │ │ │ │ -246 // │ │ │ │ │ -247 // We opted not to use the mixing algorithm proposed in the C++ working │ │ │ │ │ -group defect list at │ │ │ │ │ -248 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf, p. │ │ │ │ │ -57f. because it │ │ │ │ │ -249 // has very bad hash distribution properties if you apply it to lists of │ │ │ │ │ -very small numbers, │ │ │ │ │ -250 // an application that is frequent in PDELab's ordering framework. │ │ │ │ │ -251 │ │ │ │ │ -252 _D_u_n_e_:_:_h_a_s_h_<_T_> hasher; │ │ │ │ │ -253 const typeof_size_t kMul = 0x9ddfea08eb382d69ULL; │ │ │ │ │ -254 typeof_size_t h = hasher(arg); │ │ │ │ │ -255 typeof_size_t a = (seed ^ h) * kMul; │ │ │ │ │ -256 a ^= (a >> 47); │ │ │ │ │ -257 typeof_size_t b = (h ^ a) * kMul; │ │ │ │ │ -258 b ^= (b >> 47); │ │ │ │ │ -259 b *= kMul; │ │ │ │ │ -260 seed = b; │ │ │ │ │ +_2_3_0 struct _A_D_L_T_a_g {}; │ │ │ │ │ +231 │ │ │ │ │ +_2_3_2#define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction) \ │ │ │ │ │ +233 template \ │ │ │ │ │ +234 auto function(const T &t, PriorityTag<1>, ADLTag) \ │ │ │ │ │ +235 -> decltype(function(t)) { \ │ │ │ │ │ +236 return function(t); \ │ │ │ │ │ +237 } \ │ │ │ │ │ +238 template \ │ │ │ │ │ +239 auto function(const T &t, PriorityTag<0>, ADLTag) { \ │ │ │ │ │ +240 using std::stdfunction; \ │ │ │ │ │ +241 return stdfunction(t); \ │ │ │ │ │ +242 } \ │ │ │ │ │ +243 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +244 │ │ │ │ │ +_2_4_5 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(_i_s_N_a_N,isnan); │ │ │ │ │ +_2_4_6 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(_i_s_I_n_f,isinf); │ │ │ │ │ +_2_4_7 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(_i_s_F_i_n_i_t_e,isfinite); │ │ │ │ │ +248#undef DUNE_COMMON_MATH_ISFUNCTION │ │ │ │ │ +249 │ │ │ │ │ +250 template │ │ │ │ │ +_2_5_1 auto _i_s_U_n_o_r_d_e_r_e_d(const T &t1, const T &t2, _P_r_i_o_r_i_t_y_T_a_g_<_1_>, _A_D_L_T_a_g) │ │ │ │ │ +252 -> decltype(_i_s_U_n_o_r_d_e_r_e_d(t1, t2)) { │ │ │ │ │ +253 return _i_s_U_n_o_r_d_e_r_e_d(t1, t2); │ │ │ │ │ +254 } │ │ │ │ │ +255 │ │ │ │ │ +256 template │ │ │ │ │ +_2_5_7 auto _i_s_U_n_o_r_d_e_r_e_d(const T &t1, const T &t2, _P_r_i_o_r_i_t_y_T_a_g_<_0_>, _A_D_L_T_a_g) { │ │ │ │ │ +258 using std::isunordered; │ │ │ │ │ +259 return isunordered(t1, t2); │ │ │ │ │ +260 } │ │ │ │ │ 261 } │ │ │ │ │ 262 │ │ │ │ │ -263 }; │ │ │ │ │ +_2_6_3 namespace MathImpl { │ │ │ │ │ 264 │ │ │ │ │ -265 │ │ │ │ │ -266 // hash combining for 32-bit platforms. │ │ │ │ │ -267 template<> │ │ │ │ │ -268 struct hash_combiner<4> │ │ │ │ │ -269 { │ │ │ │ │ -270 │ │ │ │ │ -271 template │ │ │ │ │ -272 void operator()(typeof_size_t& seed, const T& arg) const │ │ │ │ │ -273 { │ │ │ │ │ -274 static_assert(sizeof(typeof_size_t)==4, "hash_combiner::operator() │ │ │ │ │ -instantiated with nonmatching type and size"); │ │ │ │ │ -275 │ │ │ │ │ -276 // The default algorithm above requires a 64-bit std::size_t. The following │ │ │ │ │ -algorithm is a │ │ │ │ │ -277 // 32-bit compatible fallback, again inspired by CityHash and MurmurHash │ │ │ │ │ -278 // (http://cityhash.googlecode.com/svn-history/r2/trunk/src/city.cc). │ │ │ │ │ -279 // It uses 32-bit constants and relies on rotation instead of │ │ │ │ │ -multiplication to spread the │ │ │ │ │ -280 // mixed bits as that is apparently more efficient on IA-32. The constants │ │ │ │ │ -used below are again │ │ │ │ │ -281 // taken from CityHash, in particular from the file referenced above. │ │ │ │ │ +265 // NOTE: it is important that these functors have names different from the │ │ │ │ │ +266 // names of the functions they are forwarding to. Otherwise the │ │ │ │ │ +267 // unqualified call would find the functor type, not a function, and ADL │ │ │ │ │ +268 // would never be attempted. │ │ │ │ │ +_2_6_9#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function) \ │ │ │ │ │ +270 struct function##Impl { \ │ │ │ │ │ +271 template \ │ │ │ │ │ +272 constexpr auto operator()(const T &t) const { \ │ │ │ │ │ +273 return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \ │ │ │ │ │ +274 } \ │ │ │ │ │ +275 }; \ │ │ │ │ │ +276 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +277 │ │ │ │ │ +_2_7_8 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(isNaN); │ │ │ │ │ +_2_7_9 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(isInf); │ │ │ │ │ +_2_8_0 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(isFinite); │ │ │ │ │ +281#undef DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR │ │ │ │ │ 282 │ │ │ │ │ -283 _D_u_n_e_:_:_h_a_s_h_<_T_> hasher; │ │ │ │ │ -284 const typeof_size_t c1 = 0xcc9e2d51; │ │ │ │ │ -285 const typeof_size_t c2 = 0x1b873593; │ │ │ │ │ -286 const typeof_size_t c3 = 0xe6546b64; │ │ │ │ │ -287 typeof_size_t h = hasher(arg); │ │ │ │ │ -288 typeof_size_t a = seed * c1; │ │ │ │ │ -289 a = (a >> 17) | (a << (32 - 17)); │ │ │ │ │ -290 a *= c2; │ │ │ │ │ -291 h ^= a; │ │ │ │ │ -292 h = (h >> 19) | (h << (32 - 19)); │ │ │ │ │ -293 seed = h * 5 + c3; │ │ │ │ │ -294 } │ │ │ │ │ -295 │ │ │ │ │ -296 }; │ │ │ │ │ -297 │ │ │ │ │ -298#endif // DOXYGEN │ │ │ │ │ -299 │ │ │ │ │ -301 │ │ │ │ │ -306 template │ │ │ │ │ -_3_0_7 inline void _h_a_s_h___c_o_m_b_i_n_e(std::size_t& seed, const T& arg) │ │ │ │ │ -308 { │ │ │ │ │ -309 hash_combiner()(seed,arg); │ │ │ │ │ -310 } │ │ │ │ │ -311 │ │ │ │ │ +_2_8_3 struct _i_s_U_n_o_r_d_e_r_e_d_I_m_p_l { │ │ │ │ │ +284 template │ │ │ │ │ +_2_8_5 constexpr auto _o_p_e_r_a_t_o_r_(_)(const T &t1, const T &t2) const { │ │ │ │ │ +286 return isUnordered(t1, t2, _P_r_i_o_r_i_t_y_T_a_g_<_1_0_>{}, _M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g{}); │ │ │ │ │ +287 } │ │ │ │ │ +288 }; │ │ │ │ │ +289 │ │ │ │ │ +290 } //MathImpl │ │ │ │ │ +291 │ │ │ │ │ +292 │ │ │ │ │ +293 namespace Impl { │ │ │ │ │ +294 /* This helper has a math functor as a static constexpr member. Doing │ │ │ │ │ +295 this as a static member of a template struct means we can do this │ │ │ │ │ +296 without violating the ODR or putting the definition into a separate │ │ │ │ │ +297 compilation unit, while still still ensuring the functor is the same │ │ │ │ │ +298 lvalue across all compilation units. │ │ │ │ │ +299 */ │ │ │ │ │ +300 template │ │ │ │ │ +301 struct MathDummy │ │ │ │ │ +302 { │ │ │ │ │ +303 static constexpr T value{}; │ │ │ │ │ +304 }; │ │ │ │ │ +305 │ │ │ │ │ +306 template │ │ │ │ │ +307 constexpr T MathDummy::value; │ │ │ │ │ +308 │ │ │ │ │ +309 } //namespace Impl │ │ │ │ │ +310 │ │ │ │ │ +311 namespace { │ │ │ │ │ +312 /* Provide the math functors directly in the `Dune` namespace. │ │ │ │ │ 313 │ │ │ │ │ -321 template │ │ │ │ │ -_3_2_2 inline std::size_t _h_a_s_h___r_a_n_g_e(It first, It last) │ │ │ │ │ -323 { │ │ │ │ │ -324 std::size_t seed = 0; │ │ │ │ │ -325 for (; first != last; ++first) │ │ │ │ │ -326 { │ │ │ │ │ -327 _h_a_s_h___c_o_m_b_i_n_e(seed,*first); │ │ │ │ │ -328 } │ │ │ │ │ -329 return seed; │ │ │ │ │ -330 } │ │ │ │ │ +314 This actually declares a different name in each translation unit, but │ │ │ │ │ +315 they all resolve to the same lvalue. │ │ │ │ │ +316 */ │ │ │ │ │ +317 │ │ │ │ │ +319 │ │ │ │ │ +323 constexpr auto const &_i_s_N_a_N = Impl::MathDummy::value; │ │ │ │ │ +324 │ │ │ │ │ +326 │ │ │ │ │ +330 constexpr auto const &_i_s_I_n_f = Impl::MathDummy::value; │ │ │ │ │ 331 │ │ │ │ │ 333 │ │ │ │ │ -340 template │ │ │ │ │ -_3_4_1 inline void _h_a_s_h___r_a_n_g_e(std::size_t& seed, It first, It last) │ │ │ │ │ -342 { │ │ │ │ │ -343 for (; first != last; ++first) │ │ │ │ │ -344 { │ │ │ │ │ -345 _h_a_s_h___c_o_m_b_i_n_e(seed,*first); │ │ │ │ │ +337 constexpr auto const &_i_s_F_i_n_i_t_e = Impl::MathDummy:: │ │ │ │ │ +value; │ │ │ │ │ +338 │ │ │ │ │ +340 │ │ │ │ │ +345 constexpr auto const &_i_s_U_n_o_r_d_e_r_e_d = Impl::MathDummy::value; │ │ │ │ │ 346 } │ │ │ │ │ -347 } │ │ │ │ │ -348 │ │ │ │ │ -349} // end namespace Dune │ │ │ │ │ -350 │ │ │ │ │ -351#endif // DUNE_COMMON_HASH_HH │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ +347 │ │ │ │ │ +348 namespace MathOverloads { │ │ │ │ │ +349 /*Overloads for complex types*/ │ │ │ │ │ +350 template::value> > │ │ │ │ │ +_3_5_1 auto _i_s_N_a_N(const T &t, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ +352 return Dune::isNaN(real(t)) || Dune::isNaN(imag(t)); │ │ │ │ │ +353 } │ │ │ │ │ +354 │ │ │ │ │ +355 template::value> > │ │ │ │ │ +_3_5_6 auto _i_s_I_n_f(const T &t, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ +357 return Dune::isInf(real(t)) || Dune::isInf(imag(t)); │ │ │ │ │ +358 } │ │ │ │ │ +359 │ │ │ │ │ +360 template::value> > │ │ │ │ │ +_3_6_1 auto _i_s_F_i_n_i_t_e(const T &t, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ +362 return Dune::isFinite(real(t)) && Dune::isFinite(imag(t)); │ │ │ │ │ +363 } │ │ │ │ │ +364 } //MathOverloads │ │ │ │ │ +365} │ │ │ │ │ +366 │ │ │ │ │ +367#endif // #ifndef DUNE_MATH_HH │ │ │ │ │ +_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ +#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function) │ │ │ │ │ +DDeeffiinniittiioonn math.hh:269 │ │ │ │ │ +_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N │ │ │ │ │ +#define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction) │ │ │ │ │ +DDeeffiinniittiioonn math.hh:232 │ │ │ │ │ +_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +Utilities for type computations, constraining overloads, ... │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_h_a_s_h___r_a_n_g_e │ │ │ │ │ -std::size_t hash_range(It first, It last) │ │ │ │ │ -Hashes all elements in the range [first,last) and returns the combined hash. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:322 │ │ │ │ │ -_D_u_n_e_:_:_h_a_s_h___c_o_m_b_i_n_e │ │ │ │ │ -void hash_combine(std::size_t &seed, const T &arg) │ │ │ │ │ -Calculates the hash value of arg and combines it in-place with seed. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:307 │ │ │ │ │ -_D_u_n_e_:_:_h_a_s_h │ │ │ │ │ -Functor for hashing objects of type T. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_h_a_s_h_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -std::size_t operator()(const T &t) const │ │ │ │ │ -Calculates the hash of t. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_b_i_n_o_m_i_a_l │ │ │ │ │ +static constexpr T binomial(const T &n, const T &k) noexcept │ │ │ │ │ +calculate the binomial coefficient n over k as a constexpr │ │ │ │ │ +DDeeffiinniittiioonn math.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_p_o_w_e_r │ │ │ │ │ +constexpr Base power(Base m, Exponent p) │ │ │ │ │ +Power method for integer exponents. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_f_a_c_t_o_r_i_a_l │ │ │ │ │ +static constexpr T factorial(const T &n) noexcept │ │ │ │ │ +calculate the factorial of n as a constexpr │ │ │ │ │ +DDeeffiinniittiioonn math.hh:111 │ │ │ │ │ +_D_u_n_e_:_:_s_i_g_n │ │ │ │ │ +int sign(const T &val) │ │ │ │ │ +Return the sign of the value. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x │ │ │ │ │ +K conjugateComplex(const K &x) │ │ │ │ │ +compute conjugate complex of x │ │ │ │ │ +DDeeffiinniittiioonn math.hh:164 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N │ │ │ │ │ +bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:604 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f │ │ │ │ │ +bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:594 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e │ │ │ │ │ +auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:584 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d │ │ │ │ │ +bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, │ │ │ │ │ +PriorityTag< 2 >, ADLTag) │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:614 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ +Standard implementation of MathematicalConstants. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_:_:_e │ │ │ │ │ +static const T e() │ │ │ │ │ +Euler's number. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_:_:_p_i │ │ │ │ │ +static const T pi() │ │ │ │ │ +Archimedes' constant. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ +Provides commonly used mathematical constants. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_F_a_c_t_o_r_i_a_l │ │ │ │ │ +DDeeffiinniittiioonn math.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_F_a_c_t_o_r_i_a_l_:_:_f_a_c_t_o_r_i_a_l │ │ │ │ │ +static constexpr int factorial │ │ │ │ │ +factorial stores m! │ │ │ │ │ +DDeeffiinniittiioonn math.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +Tag to make sure the functions in this namespace can be found by ADL. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_i_s_U_n_o_r_d_e_r_e_d_I_m_p_l │ │ │ │ │ +DDeeffiinniittiioonn math.hh:283 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_i_s_U_n_o_r_d_e_r_e_d_I_m_p_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +constexpr auto operator()(const T &t1, const T &t2) const │ │ │ │ │ +DDeeffiinniittiioonn math.hh:285 │ │ │ │ │ +_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g │ │ │ │ │ +Helper class for tagging priorities. │ │ │ │ │ +DDeeffiinniittiioonn typeutilities.hh:73 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00134.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: math.hh File Reference │ │ │ │ +dune-common: indices.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,197 +70,114 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ -Functions
    │ │ │ │ -
    math.hh File Reference
    │ │ │ │ +Typedefs | │ │ │ │ +Functions | │ │ │ │ +Variables
    │ │ │ │ +
    indices.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Some useful basic math stuff. │ │ │ │ -More...

    │ │ │ │ -
    #include <cmath>
    │ │ │ │ -#include <complex>
    │ │ │ │ -#include <limits>
    │ │ │ │ +
    #include <cstddef>
    │ │ │ │ #include <type_traits>
    │ │ │ │ -#include <dune/common/typeutilities.hh>
    │ │ │ │ +#include <utility>
    │ │ │ │ +#include <dune/common/keywords.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    struct  Dune::StandardMathematicalConstants< T >
     Standard implementation of MathematicalConstants. More...
     
    struct  Dune::MathematicalConstants< Field >
     Provides commonly used mathematical constants. More...
     
    struct  Dune::Factorial< m >
     
    struct  Dune::Factorial< 0 >
     end of recursion of factorial via specialization More...
     
    struct  Dune::MathOverloads::ADLTag
     Tag to make sure the functions in this namespace can be found by ADL. More...
     
    struct  Dune::MathImpl::isUnorderedImpl
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::MathOverloads
     namespace for customization of math functions with Dune-Semantics
     
    namespace  Dune::MathImpl
    namespace  Dune::Indices
     Namespace with predefined compile time indices for the range [0,19].
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ -Macros

    #define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction)
     
    #define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function)
     

    │ │ │ │ +Typedefs

    template<std::size_t i>
    using Dune::index_constant = std::integral_constant< std::size_t, i >
     An index constant with value i.
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ Functions

    template<class Base , class Exponent >
    constexpr Base Dune::power (Base m, Exponent p)
     Power method for integer exponents.
     
    template<class T >
    static constexpr T Dune::factorial (const T &n) noexcept
     calculate the factorial of n as a constexpr
     
    template<class T , T n>
    static constexpr auto Dune::factorial (std::integral_constant< T, n >) noexcept
     calculate the factorial of n as a constexpr
     
    template<class T >
    static constexpr T Dune::binomial (const T &n, const T &k) noexcept
     calculate the binomial coefficient n over k as a constexpr
     
    template<class T , T n, T k>
    static constexpr auto Dune::binomial (std::integral_constant< T, n >, std::integral_constant< T, k >) noexcept
     calculate the binomial coefficient n over k as a constexpr
     
    template<class T , T n>
    static constexpr auto Dune::binomial (std::integral_constant< T, n >, std::integral_constant< T, n >) noexcept
     
    template<class K >
    Dune::conjugateComplex (const K &x)
     compute conjugate complex of x
     
    template<class T >
    int Dune::sign (const T &val)
     Return the sign of the value.
     
     Dune::MathOverloads::DUNE_COMMON_MATH_ISFUNCTION (isNaN, isnan)
     
     Dune::MathOverloads::DUNE_COMMON_MATH_ISFUNCTION (isInf, isinf)
     
     Dune::MathOverloads::DUNE_COMMON_MATH_ISFUNCTION (isFinite, isfinite)
     
    template<class T >
    auto Dune::MathOverloads::isUnordered (const T &t1, const T &t2, PriorityTag< 1 >, ADLTag) -> decltype(isUnordered(t1, t2))
     
    template<class T >
    auto Dune::MathOverloads::isUnordered (const T &t1, const T &t2, PriorityTag< 0 >, ADLTag)
     
     Dune::MathImpl::DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (isNaN)
     
     Dune::MathImpl::DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (isInf)
     
     Dune::MathImpl::DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (isFinite)
     
    template<class T , class = std::enable_if_t<Impl::isComplexLike<T>::value>>
    auto Dune::MathOverloads::isNaN (const T &t, PriorityTag< 2 >, ADLTag)
     
    template<class T , class = std::enable_if_t<Impl::isComplexLike<T>::value>>
    auto Dune::MathOverloads::isInf (const T &t, PriorityTag< 2 >, ADLTag)
     
    template<class T , class = std::enable_if_t<Impl::isComplexLike<T>::value>>
    auto Dune::MathOverloads::isFinite (const T &t, PriorityTag< 2 >, ADLTag)
     
    template<class F , class I , I... i>
    decltype(auto) constexpr Dune::unpackIntegerSequence (F &&f, std::integer_sequence< I, i... > sequence)
     Unpack an std::integer_sequence<I,i...> to std::integral_constant<I,i>...
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Variables

    constexpr index_constant< 0 > Dune::Indices::_0 = {}
     Compile time index with value 0.
     
    constexpr index_constant< 1 > Dune::Indices::_1 = {}
     Compile time index with value 1.
     
    constexpr index_constant< 2 > Dune::Indices::_2 = {}
     Compile time index with value 2.
     
    constexpr index_constant< 3 > Dune::Indices::_3 = {}
     Compile time index with value 3.
     
    constexpr index_constant< 4 > Dune::Indices::_4 = {}
     Compile time index with value 4.
     
    constexpr index_constant< 5 > Dune::Indices::_5 = {}
     Compile time index with value 5.
     
    constexpr index_constant< 6 > Dune::Indices::_6 = {}
     Compile time index with value 6.
     
    constexpr index_constant< 7 > Dune::Indices::_7 = {}
     Compile time index with value 7.
     
    constexpr index_constant< 8 > Dune::Indices::_8 = {}
     Compile time index with value 8.
     
    constexpr index_constant< 9 > Dune::Indices::_9 = {}
     Compile time index with value 9.
     
    constexpr index_constant< 10 > Dune::Indices::_10 = {}
     Compile time index with value 10.
     
    constexpr index_constant< 11 > Dune::Indices::_11 = {}
     Compile time index with value 11.
     
    constexpr index_constant< 12 > Dune::Indices::_12 = {}
     Compile time index with value 12.
     
    constexpr index_constant< 13 > Dune::Indices::_13 = {}
     Compile time index with value 13.
     
    constexpr index_constant< 14 > Dune::Indices::_14 = {}
     Compile time index with value 14.
     
    constexpr index_constant< 15 > Dune::Indices::_15 = {}
     Compile time index with value 15.
     
    constexpr index_constant< 16 > Dune::Indices::_16 = {}
     Compile time index with value 16.
     
    constexpr index_constant< 17 > Dune::Indices::_17 = {}
     Compile time index with value 17.
     
    constexpr index_constant< 18 > Dune::Indices::_18 = {}
     Compile time index with value 18.
     
    constexpr index_constant< 19 > Dune::Indices::_19 = {}
     Compile time index with value 19.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Some useful basic math stuff.

    │ │ │ │ -

    Macro Definition Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ DUNE_COMMON_MATH_ISFUNCTION

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    #define DUNE_COMMON_MATH_ISFUNCTION( function,
     stdfunction 
    )
    │ │ │ │ -
    │ │ │ │ -Value:
    template<class T> \
    │ │ │ │ -
    auto function(const T &t, PriorityTag<1>, ADLTag) \
    │ │ │ │ -
    -> decltype(function(t)) { \
    │ │ │ │ -
    return function(t); \
    │ │ │ │ -
    } \
    │ │ │ │ -
    template<class T> \
    │ │ │ │ -
    auto function(const T &t, PriorityTag<0>, ADLTag) { \
    │ │ │ │ -
    using std::stdfunction; \
    │ │ │ │ -
    return stdfunction(t); \
    │ │ │ │ -
    } \
    │ │ │ │ -
    static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    #define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR( function)
    │ │ │ │ -
    │ │ │ │ -Value:
    struct function##Impl { \
    │ │ │ │ -
    template<class T> \
    │ │ │ │ -
    constexpr auto operator()(const T &t) const { \
    │ │ │ │ -
    return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \
    │ │ │ │ -
    } \
    │ │ │ │ -
    }; \
    │ │ │ │ -
    static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,154 +1,96 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -math.hh File Reference │ │ │ │ │ -Some useful basic math stuff. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +indices.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_k_e_y_w_o_r_d_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_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_<_ _T_ _> │ │ │ │ │ -  Standard implementation of _M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s. _M_o_r_e_._._. │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_<_ _F_i_e_l_d_ _> │ │ │ │ │ -  Provides commonly used mathematical constants. _M_o_r_e_._._. │ │ │ │ │ +namespace   _D_u_n_e_:_:_I_n_d_i_c_e_s │ │ │ │ │ +  Namespace with predefined compile time indices for the range │ │ │ │ │ + [0,19]. │ │ │ │ │ +  │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t = std::integral_constant< std::size_t, i > │ │ │ │ │ +  An index constant with value i. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_F_a_c_t_o_r_i_a_l_<_ _m_ _> │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +decltype(auto) constexpr  _D_u_n_e_:_:_u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e (F &&f, std:: │ │ │ │ │ + integer_sequence< I, i... > sequence) │ │ │ │ │ +  Unpack an std::integer_sequence to std:: │ │ │ │ │ + integral_constant... │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_F_a_c_t_o_r_i_a_l_<_ _0_ _> │ │ │ │ │ -  end of recursion of factorial via specialization _M_o_r_e_._._. │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 0 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___0 = {} │ │ │ │ │ +  Compile time index with value 0. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ -  Tag to make sure the functions in this namespace can be found by ADL. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 1 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1 = {} │ │ │ │ │ +  Compile time index with value 1. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_i_s_U_n_o_r_d_e_r_e_d_I_m_p_l │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 2 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___2 = {} │ │ │ │ │ +  Compile time index with value 2. │ │ │ │ │   │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 3 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___3 = {} │ │ │ │ │ +  Compile time index with value 3. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s │ │ │ │ │ -  namespace for customization of math functions with Dune-Semantics │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 4 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___4 = {} │ │ │ │ │ +  Compile time index with value 4. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_M_a_t_h_I_m_p_l │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 5 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___5 = {} │ │ │ │ │ +  Compile time index with value 5. │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(function, stdfunction) │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 6 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___6 = {} │ │ │ │ │ +  Compile time index with value 6. │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(function) │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 7 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___7 = {} │ │ │ │ │ +  Compile time index with value 7. │ │ │ │ │ +  │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 8 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___8 = {} │ │ │ │ │ +  Compile time index with value 8. │ │ │ │ │ +  │ │ │ │ │ + constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 9 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___9 = {} │ │ │ │ │ +  Compile time index with value 9. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 10 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_0 = {} │ │ │ │ │ +  Compile time index with value 10. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 11 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_1 = {} │ │ │ │ │ +  Compile time index with value 11. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 12 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_2 = {} │ │ │ │ │ +  Compile time index with value 12. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 13 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_3 = {} │ │ │ │ │ +  Compile time index with value 13. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 14 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_4 = {} │ │ │ │ │ +  Compile time index with value 14. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 15 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_5 = {} │ │ │ │ │ +  Compile time index with value 15. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 16 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_6 = {} │ │ │ │ │ +  Compile time index with value 16. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 17 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_7 = {} │ │ │ │ │ +  Compile time index with value 17. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 18 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_8 = {} │ │ │ │ │ +  Compile time index with value 18. │ │ │ │ │ +  │ │ │ │ │ +constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 19 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_9 = {} │ │ │ │ │ +  Compile time index with value 19. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - constexpr Base  _D_u_n_e_:_:_p_o_w_e_r (Base m, Exponent p) │ │ │ │ │ -  _P_o_w_e_r method for integer exponents. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - static constexpr T  _D_u_n_e_:_:_f_a_c_t_o_r_i_a_l (const T &n) noexcept │ │ │ │ │ -  calculate the factorial of n as a constexpr │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -static constexpr auto  _D_u_n_e_:_:_f_a_c_t_o_r_i_a_l (std::integral_constant< T, n >) │ │ │ │ │ - noexcept │ │ │ │ │ -  calculate the factorial of n as a constexpr │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - static constexpr T  _D_u_n_e_:_:_b_i_n_o_m_i_a_l (const T &n, const T &k) noexcept │ │ │ │ │ -  calculate the binomial coefficient n over k as a │ │ │ │ │ - constexpr │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -static constexpr auto  _D_u_n_e_:_:_b_i_n_o_m_i_a_l (std::integral_constant< T, n >, std:: │ │ │ │ │ - integral_constant< T, k >) noexcept │ │ │ │ │ -  calculate the binomial coefficient n over k as a │ │ │ │ │ - constexpr │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -static constexpr auto  _D_u_n_e_:_:_b_i_n_o_m_i_a_l (std::integral_constant< T, n >, std:: │ │ │ │ │ - integral_constant< T, n >) noexcept │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - K  _D_u_n_e_:_:_c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x (const K &x) │ │ │ │ │ -  compute conjugate complex of x │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - int  _D_u_n_e_:_:_s_i_g_n (const T &val) │ │ │ │ │ -  Return the sign of the value. │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N (_i_s_N_a_N, │ │ │ │ │ - isnan) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N (_i_s_I_n_f, │ │ │ │ │ - isinf) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N │ │ │ │ │ - (_i_s_F_i_n_i_t_e, isfinite) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d (const T &t1, const T │ │ │ │ │ - &t2, _P_r_i_o_r_i_t_y_T_a_g< 1 >, _A_D_L_T_a_g) -> decltype(isUnordered │ │ │ │ │ - (t1, t2)) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d (const T &t1, const T │ │ │ │ │ - &t2, _P_r_i_o_r_i_t_y_T_a_g< 0 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ - (isNaN) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ - (isInf) │ │ │ │ │ -  │ │ │ │ │ -   _D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ - (isFinite) │ │ │ │ │ -  │ │ │ │ │ -template::value>> │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N (const T &t, _P_r_i_o_r_i_t_y_T_a_g< 2 │ │ │ │ │ - >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -template::value>> │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f (const T &t, _P_r_i_o_r_i_t_y_T_a_g< 2 │ │ │ │ │ - >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -template::value>> │ │ │ │ │ - auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e (const T &t, _P_r_i_o_r_i_t_y_T_a_g< │ │ │ │ │ - 2 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Some useful basic math stuff. │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__CCOOMMMMOONN__MMAATTHH__IISSFFUUNNCCTTIIOONN ********** │ │ │ │ │ -#define DUNE_COMMON_MATH_ISFUNCTION (   function, │ │ │ │ │ -   stdfunction  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -template \ │ │ │ │ │ -auto function(const T &t, PriorityTag<1>, ADLTag) \ │ │ │ │ │ --> decltype(function(t)) { \ │ │ │ │ │ -return function(t); \ │ │ │ │ │ -} \ │ │ │ │ │ -template \ │ │ │ │ │ -auto function(const T &t, PriorityTag<0>, ADLTag) { \ │ │ │ │ │ -using std::stdfunction; \ │ │ │ │ │ -return stdfunction(t); \ │ │ │ │ │ -} \ │ │ │ │ │ -static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -********** _?◆_? DDUUNNEE__CCOOMMMMOONN__MMAATTHH__IISSFFUUNNCCTTIIOONN__FFUUNNCCTTOORR ********** │ │ │ │ │ -#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR (   function ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -struct function##Impl { \ │ │ │ │ │ -template \ │ │ │ │ │ -constexpr auto operator()(const T &t) const { \ │ │ │ │ │ -return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \ │ │ │ │ │ -} \ │ │ │ │ │ -}; \ │ │ │ │ │ -static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00134_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: math.hh Source File │ │ │ │ +dune-common: indices.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,373 +74,120 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    math.hh
    │ │ │ │ +
    indices.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_MATH_HH
    │ │ │ │ -
    6#define DUNE_MATH_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    12#include <cmath>
    │ │ │ │ -
    13#include <complex>
    │ │ │ │ -
    14#include <limits>
    │ │ │ │ -
    15#include <type_traits>
    │ │ │ │ -
    16
    │ │ │ │ - │ │ │ │ -
    18
    │ │ │ │ -
    19namespace Dune
    │ │ │ │ -
    20{
    │ │ │ │ -
    21
    │ │ │ │ -
    32 template< class T >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    34 {
    │ │ │ │ -
    │ │ │ │ -
    38 static const T e ()
    │ │ │ │ -
    39 {
    │ │ │ │ -
    40 using std::exp;
    │ │ │ │ -
    41 static const T e = exp( T( 1 ) );
    │ │ │ │ -
    42 return e;
    │ │ │ │ -
    43 }
    │ │ │ │ -
    │ │ │ │ -
    44
    │ │ │ │ -
    │ │ │ │ -
    48 static const T pi ()
    │ │ │ │ -
    49 {
    │ │ │ │ -
    50 using std::acos;
    │ │ │ │ -
    51 static const T pi = acos( T( -1 ) );
    │ │ │ │ -
    52 return pi;
    │ │ │ │ -
    53 }
    │ │ │ │ -
    │ │ │ │ -
    54 };
    │ │ │ │ -
    │ │ │ │ -
    55
    │ │ │ │ -
    56
    │ │ │ │ -
    64 template< class Field >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    66 : public StandardMathematicalConstants<Field>
    │ │ │ │ -
    67 {};
    │ │ │ │ -
    │ │ │ │ -
    68
    │ │ │ │ +
    5
    │ │ │ │ +
    6#ifndef DUNE_COMMON_INDICES_HH
    │ │ │ │ +
    7#define DUNE_COMMON_INDICES_HH
    │ │ │ │ +
    8
    │ │ │ │ +
    9#include <cstddef>
    │ │ │ │ +
    10#include <type_traits>
    │ │ │ │ +
    11#include <utility>
    │ │ │ │ +
    12
    │ │ │ │ + │ │ │ │ +
    14
    │ │ │ │ +
    15namespace Dune
    │ │ │ │ +
    16{
    │ │ │ │ +
    29 template<std::size_t i>
    │ │ │ │ +
    30 using index_constant = std::integral_constant<std::size_t, i>;
    │ │ │ │ +
    31
    │ │ │ │ +
    32
    │ │ │ │ +
    33
    │ │ │ │ +
    │ │ │ │ +
    50 namespace Indices
    │ │ │ │ +
    51 {
    │ │ │ │ + │ │ │ │ +
    54
    │ │ │ │ + │ │ │ │ +
    57
    │ │ │ │ + │ │ │ │ +
    60
    │ │ │ │ + │ │ │ │ +
    63
    │ │ │ │ + │ │ │ │ +
    66
    │ │ │ │ + │ │ │ │
    69
    │ │ │ │ -
    74 template <class Base, class Exponent>
    │ │ │ │ -
    │ │ │ │ -
    75 constexpr Base power(Base m, Exponent p)
    │ │ │ │ -
    76 {
    │ │ │ │ -
    77 static_assert(std::numeric_limits<Exponent>::is_integer, "Exponent must be an integer type!");
    │ │ │ │ + │ │ │ │ +
    72
    │ │ │ │ + │ │ │ │ +
    75
    │ │ │ │ + │ │ │ │
    78
    │ │ │ │ -
    79 auto result = Base(1);
    │ │ │ │ -
    80 auto absp = (p<0) ? -p : p; // This is simply abs, but std::abs is not constexpr
    │ │ │ │ -
    81 for (Exponent i = Exponent(0); i<absp; i++)
    │ │ │ │ -
    82 result *= m;
    │ │ │ │ -
    83
    │ │ │ │ -
    84 if (p<0)
    │ │ │ │ -
    85 result = Base(1)/result;
    │ │ │ │ -
    86
    │ │ │ │ -
    87 return result;
    │ │ │ │ -
    88 }
    │ │ │ │ -
    │ │ │ │ -
    89
    │ │ │ │ -
    92 template <int m>
    │ │ │ │ -
    │ │ │ │ -
    93 struct Factorial
    │ │ │ │ -
    94 {
    │ │ │ │ -
    96 static constexpr int factorial = m * Factorial<m-1>::factorial;
    │ │ │ │ -
    97 };
    │ │ │ │ -
    │ │ │ │ -
    98
    │ │ │ │ -
    100 template <>
    │ │ │ │ -
    │ │ │ │ -
    101 struct [[deprecated("Use function factorial instead! Will be removed after Dune 2.9")]] Factorial<0>
    │ │ │ │ -
    102 {
    │ │ │ │ -
    103 // 0! = 1
    │ │ │ │ -
    104 static constexpr int factorial = 1;
    │ │ │ │ -
    105 };
    │ │ │ │ -
    │ │ │ │ -
    106
    │ │ │ │ -
    107
    │ │ │ │ -
    109 // T has to be an integral type
    │ │ │ │ -
    110 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    111 constexpr inline static T factorial(const T& n) noexcept
    │ │ │ │ -
    112 {
    │ │ │ │ -
    113 static_assert(std::numeric_limits<T>::is_integer, "`factorial(n)` has to be called with an integer type.");
    │ │ │ │ -
    114 T fac = 1;
    │ │ │ │ -
    115 for(T k = 0; k < n; ++k)
    │ │ │ │ -
    116 fac *= k+1;
    │ │ │ │ -
    117 return fac;
    │ │ │ │ -
    118 }
    │ │ │ │ -
    │ │ │ │ -
    119
    │ │ │ │ -
    121 template<class T, T n>
    │ │ │ │ -
    │ │ │ │ -
    122 constexpr inline static auto factorial (std::integral_constant<T, n>) noexcept
    │ │ │ │ -
    123 {
    │ │ │ │ -
    124 return std::integral_constant<T, factorial(n)>{};
    │ │ │ │ -
    125 }
    │ │ │ │ -
    │ │ │ │ -
    126
    │ │ │ │ -
    127
    │ │ │ │ -
    129 // T has to be an integral type
    │ │ │ │ -
    130 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    131 constexpr inline static T binomial (const T& n, const T& k) noexcept
    │ │ │ │ -
    132 {
    │ │ │ │ -
    133 static_assert(std::numeric_limits<T>::is_integer, "`binomial(n, k)` has to be called with an integer type.");
    │ │ │ │ -
    134
    │ │ │ │ -
    135 if( k < 0 || k > n )
    │ │ │ │ -
    136 return 0;
    │ │ │ │ -
    137
    │ │ │ │ -
    138 if (2*k > n)
    │ │ │ │ -
    139 return binomial(n, n-k);
    │ │ │ │ -
    140
    │ │ │ │ -
    141 T bin = 1;
    │ │ │ │ -
    142 for(auto i = n-k; i < n; ++i)
    │ │ │ │ -
    143 bin *= i+1;
    │ │ │ │ -
    144 return bin / factorial(k);
    │ │ │ │ -
    145 }
    │ │ │ │ -
    │ │ │ │ -
    146
    │ │ │ │ -
    148 template<class T, T n, T k>
    │ │ │ │ -
    │ │ │ │ -
    149 constexpr inline static auto binomial (std::integral_constant<T, n>, std::integral_constant<T, k>) noexcept
    │ │ │ │ -
    150 {
    │ │ │ │ -
    151 return std::integral_constant<T, binomial(n, k)>{};
    │ │ │ │ -
    152 }
    │ │ │ │ -
    │ │ │ │ -
    153
    │ │ │ │ -
    154 template<class T, T n>
    │ │ │ │ -
    │ │ │ │ -
    155 constexpr inline static auto binomial (std::integral_constant<T, n>, std::integral_constant<T, n>) noexcept
    │ │ │ │ -
    156 {
    │ │ │ │ -
    157 return std::integral_constant<T, (n >= 0 ? 1 : 0)>{};
    │ │ │ │ -
    158 }
    │ │ │ │ -
    │ │ │ │ -
    159
    │ │ │ │ -
    160
    │ │ │ │ -
    162 // conjugate complex does nothing for non-complex types
    │ │ │ │ -
    163 template<class K>
    │ │ │ │ -
    │ │ │ │ -
    164 inline K conjugateComplex (const K& x)
    │ │ │ │ -
    165 {
    │ │ │ │ -
    166 return x;
    │ │ │ │ -
    167 }
    │ │ │ │ -
    │ │ │ │ -
    168
    │ │ │ │ -
    169#ifndef DOXYGEN
    │ │ │ │ -
    170 // specialization for complex
    │ │ │ │ -
    171 template<class K>
    │ │ │ │ -
    172 inline std::complex<K> conjugateComplex (const std::complex<K>& c)
    │ │ │ │ -
    173 {
    │ │ │ │ -
    174 return std::complex<K>(c.real(),-c.imag());
    │ │ │ │ -
    175 }
    │ │ │ │ -
    176#endif
    │ │ │ │ -
    177
    │ │ │ │ -
    179 template <class T>
    │ │ │ │ -
    │ │ │ │ -
    180 int sign(const T& val)
    │ │ │ │ -
    181 {
    │ │ │ │ -
    182 return (val < 0 ? -1 : 1);
    │ │ │ │ -
    183 }
    │ │ │ │ -
    │ │ │ │ -
    184
    │ │ │ │ -
    185
    │ │ │ │ -
    186 namespace Impl {
    │ │ │ │ -
    187 // Returns whether a given type behaves like std::complex<>, i.e. whether
    │ │ │ │ -
    188 // real() and imag() are defined
    │ │ │ │ -
    189 template<class T>
    │ │ │ │ -
    190 struct isComplexLike {
    │ │ │ │ -
    191 private:
    │ │ │ │ -
    192 template<class U>
    │ │ │ │ -
    193 static auto test(U* u) -> decltype(u->real(), u->imag(), std::true_type());
    │ │ │ │ -
    194
    │ │ │ │ -
    195 template<class U>
    │ │ │ │ -
    196 static auto test(...) -> decltype(std::false_type());
    │ │ │ │ -
    197
    │ │ │ │ -
    198 public:
    │ │ │ │ -
    199 static const bool value = decltype(test<T>(0))::value;
    │ │ │ │ -
    200 };
    │ │ │ │ -
    201 } // namespace Impl
    │ │ │ │ -
    202
    │ │ │ │ -
    204
    │ │ │ │ -
    227 namespace MathOverloads {
    │ │ │ │ -
    228
    │ │ │ │ -
    230 struct ADLTag {};
    │ │ │ │ -
    231
    │ │ │ │ -
    │ │ │ │ -
    232#define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction) \
    │ │ │ │ -
    233 template<class T> \
    │ │ │ │ -
    234 auto function(const T &t, PriorityTag<1>, ADLTag) \
    │ │ │ │ -
    235 -> decltype(function(t)) { \
    │ │ │ │ -
    236 return function(t); \
    │ │ │ │ -
    237 } \
    │ │ │ │ -
    238 template<class T> \
    │ │ │ │ -
    239 auto function(const T &t, PriorityTag<0>, ADLTag) { \
    │ │ │ │ -
    240 using std::stdfunction; \
    │ │ │ │ -
    241 return stdfunction(t); \
    │ │ │ │ -
    242 } \
    │ │ │ │ -
    243 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ -
    │ │ │ │ -
    244
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    248#undef DUNE_COMMON_MATH_ISFUNCTION
    │ │ │ │ -
    249
    │ │ │ │ -
    250 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    251 auto isUnordered(const T &t1, const T &t2, PriorityTag<1>, ADLTag)
    │ │ │ │ -
    252 -> decltype(isUnordered(t1, t2)) {
    │ │ │ │ -
    253 return isUnordered(t1, t2);
    │ │ │ │ -
    254 }
    │ │ │ │ -
    │ │ │ │ -
    255
    │ │ │ │ -
    256 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    257 auto isUnordered(const T &t1, const T &t2, PriorityTag<0>, ADLTag) {
    │ │ │ │ -
    258 using std::isunordered;
    │ │ │ │ -
    259 return isunordered(t1, t2);
    │ │ │ │ -
    260 }
    │ │ │ │ -
    │ │ │ │ -
    261 }
    │ │ │ │ -
    262
    │ │ │ │ -
    │ │ │ │ -
    263 namespace MathImpl {
    │ │ │ │ -
    264
    │ │ │ │ -
    265 // NOTE: it is important that these functors have names different from the
    │ │ │ │ -
    266 // names of the functions they are forwarding to. Otherwise the
    │ │ │ │ -
    267 // unqualified call would find the functor type, not a function, and ADL
    │ │ │ │ -
    268 // would never be attempted.
    │ │ │ │ -
    │ │ │ │ -
    269#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function) \
    │ │ │ │ -
    270 struct function##Impl { \
    │ │ │ │ -
    271 template<class T> \
    │ │ │ │ -
    272 constexpr auto operator()(const T &t) const { \
    │ │ │ │ -
    273 return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \
    │ │ │ │ -
    274 } \
    │ │ │ │ -
    275 }; \
    │ │ │ │ -
    276 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ -
    │ │ │ │ -
    277
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    281#undef DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR
    │ │ │ │ -
    282
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    284 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    285 constexpr auto operator()(const T &t1, const T &t2) const {
    │ │ │ │ -
    286 return isUnordered(t1, t2, PriorityTag<10>{}, MathOverloads::ADLTag{});
    │ │ │ │ -
    287 }
    │ │ │ │ -
    │ │ │ │ -
    288 };
    │ │ │ │ -
    │ │ │ │ -
    289
    │ │ │ │ -
    290 } //MathImpl
    │ │ │ │ -
    │ │ │ │ -
    291
    │ │ │ │ -
    292
    │ │ │ │ -
    293 namespace Impl {
    │ │ │ │ -
    294 /* This helper has a math functor as a static constexpr member. Doing
    │ │ │ │ -
    295 this as a static member of a template struct means we can do this
    │ │ │ │ -
    296 without violating the ODR or putting the definition into a separate
    │ │ │ │ -
    297 compilation unit, while still still ensuring the functor is the same
    │ │ │ │ -
    298 lvalue across all compilation units.
    │ │ │ │ -
    299 */
    │ │ │ │ -
    300 template<class T>
    │ │ │ │ -
    301 struct MathDummy
    │ │ │ │ -
    302 {
    │ │ │ │ -
    303 static constexpr T value{};
    │ │ │ │ -
    304 };
    │ │ │ │ -
    305
    │ │ │ │ -
    306 template<class T>
    │ │ │ │ -
    307 constexpr T MathDummy<T>::value;
    │ │ │ │ -
    308
    │ │ │ │ -
    309 } //namespace Impl
    │ │ │ │ -
    310
    │ │ │ │ -
    311 namespace {
    │ │ │ │ -
    312 /* Provide the math functors directly in the `Dune` namespace.
    │ │ │ │ -
    313
    │ │ │ │ -
    314 This actually declares a different name in each translation unit, but
    │ │ │ │ -
    315 they all resolve to the same lvalue.
    │ │ │ │ -
    316 */
    │ │ │ │ -
    317
    │ │ │ │ -
    319
    │ │ │ │ -
    323 constexpr auto const &isNaN = Impl::MathDummy<MathImpl::isNaNImpl>::value;
    │ │ │ │ -
    324
    │ │ │ │ -
    326
    │ │ │ │ -
    330 constexpr auto const &isInf = Impl::MathDummy<MathImpl::isInfImpl>::value;
    │ │ │ │ -
    331
    │ │ │ │ -
    333
    │ │ │ │ -
    337 constexpr auto const &isFinite = Impl::MathDummy<MathImpl::isFiniteImpl>::value;
    │ │ │ │ -
    338
    │ │ │ │ -
    340
    │ │ │ │ -
    345 constexpr auto const &isUnordered = Impl::MathDummy<MathImpl::isUnorderedImpl>::value;
    │ │ │ │ -
    346 }
    │ │ │ │ -
    347
    │ │ │ │ -
    348 namespace MathOverloads {
    │ │ │ │ -
    349 /*Overloads for complex types*/
    │ │ │ │ -
    350 template<class T, class = std::enable_if_t<Impl::isComplexLike<T>::value> >
    │ │ │ │ -
    │ │ │ │ -
    351 auto isNaN(const T &t, PriorityTag<2>, ADLTag) {
    │ │ │ │ -
    352 return Dune::isNaN(real(t)) || Dune::isNaN(imag(t));
    │ │ │ │ -
    353 }
    │ │ │ │ -
    │ │ │ │ -
    354
    │ │ │ │ -
    355 template<class T, class = std::enable_if_t<Impl::isComplexLike<T>::value> >
    │ │ │ │ -
    │ │ │ │ -
    356 auto isInf(const T &t, PriorityTag<2>, ADLTag) {
    │ │ │ │ -
    357 return Dune::isInf(real(t)) || Dune::isInf(imag(t));
    │ │ │ │ -
    358 }
    │ │ │ │ -
    │ │ │ │ -
    359
    │ │ │ │ -
    360 template<class T, class = std::enable_if_t<Impl::isComplexLike<T>::value> >
    │ │ │ │ -
    │ │ │ │ -
    361 auto isFinite(const T &t, PriorityTag<2>, ADLTag) {
    │ │ │ │ -
    362 return Dune::isFinite(real(t)) && Dune::isFinite(imag(t));
    │ │ │ │ -
    363 }
    │ │ │ │ -
    │ │ │ │ -
    364 } //MathOverloads
    │ │ │ │ -
    365}
    │ │ │ │ -
    366
    │ │ │ │ -
    367#endif // #ifndef DUNE_MATH_HH
    │ │ │ │ -
    #define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function)
    Definition math.hh:269
    │ │ │ │ -
    #define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction)
    Definition math.hh:232
    │ │ │ │ -
    Utilities for type computations, constraining overloads, ...
    │ │ │ │ + │ │ │ │ +
    81
    │ │ │ │ + │ │ │ │ +
    84
    │ │ │ │ + │ │ │ │ +
    87
    │ │ │ │ + │ │ │ │ +
    90
    │ │ │ │ + │ │ │ │ +
    93
    │ │ │ │ + │ │ │ │ +
    96
    │ │ │ │ + │ │ │ │ +
    99
    │ │ │ │ + │ │ │ │ +
    102
    │ │ │ │ + │ │ │ │ +
    105
    │ │ │ │ + │ │ │ │ +
    108
    │ │ │ │ + │ │ │ │ +
    111
    │ │ │ │ +
    112 } // namespace Indices
    │ │ │ │ +
    │ │ │ │ +
    113
    │ │ │ │ +
    124 template<class F, class I, I... i>
    │ │ │ │ +
    │ │ │ │ +
    125 decltype(auto) constexpr unpackIntegerSequence(F&& f, std::integer_sequence<I, i...> sequence)
    │ │ │ │ +
    126 {
    │ │ │ │ +
    127 return f(std::integral_constant<I, i>()...);
    │ │ │ │ +
    128 }
    │ │ │ │ +
    │ │ │ │ +
    129
    │ │ │ │ +
    130} //namespace Dune
    │ │ │ │ +
    131
    │ │ │ │ +
    132#endif // DUNE_COMMON_INDICES_HH
    │ │ │ │ +
    Definitions of several macros that conditionally make C++ syntax available.
    │ │ │ │ +
    #define DUNE_INLINE_VARIABLE
    Definition keywords.hh:19
    │ │ │ │ +
    constexpr index_constant< 16 > _16
    Compile time index with value 16.
    Definition indices.hh:101
    │ │ │ │ +
    constexpr index_constant< 15 > _15
    Compile time index with value 15.
    Definition indices.hh:98
    │ │ │ │ +
    constexpr index_constant< 8 > _8
    Compile time index with value 8.
    Definition indices.hh:77
    │ │ │ │ +
    constexpr index_constant< 7 > _7
    Compile time index with value 7.
    Definition indices.hh:74
    │ │ │ │ +
    constexpr index_constant< 0 > _0
    Compile time index with value 0.
    Definition indices.hh:53
    │ │ │ │ +
    constexpr index_constant< 9 > _9
    Compile time index with value 9.
    Definition indices.hh:80
    │ │ │ │ +
    constexpr index_constant< 14 > _14
    Compile time index with value 14.
    Definition indices.hh:95
    │ │ │ │ +
    constexpr index_constant< 1 > _1
    Compile time index with value 1.
    Definition indices.hh:56
    │ │ │ │ +
    constexpr index_constant< 3 > _3
    Compile time index with value 3.
    Definition indices.hh:62
    │ │ │ │ +
    constexpr index_constant< 12 > _12
    Compile time index with value 12.
    Definition indices.hh:89
    │ │ │ │ +
    decltype(auto) constexpr unpackIntegerSequence(F &&f, std::integer_sequence< I, i... > sequence)
    Unpack an std::integer_sequence<I,i...> to std::integral_constant<I,i>...
    Definition indices.hh:125
    │ │ │ │ +
    constexpr index_constant< 11 > _11
    Compile time index with value 11.
    Definition indices.hh:86
    │ │ │ │ +
    constexpr index_constant< 18 > _18
    Compile time index with value 18.
    Definition indices.hh:107
    │ │ │ │ +
    constexpr index_constant< 13 > _13
    Compile time index with value 13.
    Definition indices.hh:92
    │ │ │ │ +
    constexpr index_constant< 5 > _5
    Compile time index with value 5.
    Definition indices.hh:68
    │ │ │ │ +
    constexpr index_constant< 17 > _17
    Compile time index with value 17.
    Definition indices.hh:104
    │ │ │ │ +
    constexpr index_constant< 10 > _10
    Compile time index with value 10.
    Definition indices.hh:83
    │ │ │ │ +
    constexpr index_constant< 2 > _2
    Compile time index with value 2.
    Definition indices.hh:59
    │ │ │ │ +
    std::integral_constant< std::size_t, i > index_constant
    An index constant with value i.
    Definition indices.hh:30
    │ │ │ │ +
    constexpr index_constant< 19 > _19
    Compile time index with value 19.
    Definition indices.hh:110
    │ │ │ │ +
    constexpr index_constant< 6 > _6
    Compile time index with value 6.
    Definition indices.hh:71
    │ │ │ │ +
    constexpr index_constant< 4 > _4
    Compile time index with value 4.
    Definition indices.hh:65
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    static constexpr T binomial(const T &n, const T &k) noexcept
    calculate the binomial coefficient n over k as a constexpr
    Definition math.hh:131
    │ │ │ │ -
    constexpr Base power(Base m, Exponent p)
    Power method for integer exponents.
    Definition math.hh:75
    │ │ │ │ -
    static constexpr T factorial(const T &n) noexcept
    calculate the factorial of n as a constexpr
    Definition math.hh:111
    │ │ │ │ -
    int sign(const T &val)
    Return the sign of the value.
    Definition math.hh:180
    │ │ │ │ -
    K conjugateComplex(const K &x)
    compute conjugate complex of x
    Definition math.hh:164
    │ │ │ │ -
    bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:604
    │ │ │ │ -
    bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:594
    │ │ │ │ -
    auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:584
    │ │ │ │ -
    bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:614
    │ │ │ │ -
    Standard implementation of MathematicalConstants.
    Definition math.hh:34
    │ │ │ │ -
    static const T e()
    Euler's number.
    Definition math.hh:38
    │ │ │ │ -
    static const T pi()
    Archimedes' constant.
    Definition math.hh:48
    │ │ │ │ -
    Provides commonly used mathematical constants.
    Definition math.hh:67
    │ │ │ │ -
    Definition math.hh:94
    │ │ │ │ -
    static constexpr int factorial
    factorial stores m!
    Definition math.hh:96
    │ │ │ │ -
    Tag to make sure the functions in this namespace can be found by ADL.
    Definition math.hh:230
    │ │ │ │ -
    Definition math.hh:283
    │ │ │ │ -
    constexpr auto operator()(const T &t1, const T &t2) const
    Definition math.hh:285
    │ │ │ │ -
    Helper class for tagging priorities.
    Definition typeutilities.hh:73
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,381 +1,183 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -math.hh │ │ │ │ │ +indices.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_MATH_HH │ │ │ │ │ -6#define DUNE_MATH_HH │ │ │ │ │ -7 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16 │ │ │ │ │ -17#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ -18 │ │ │ │ │ -19namespace _D_u_n_e │ │ │ │ │ -20{ │ │ │ │ │ -21 │ │ │ │ │ -32 template< class T > │ │ │ │ │ -_3_3 struct _S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ -34 { │ │ │ │ │ -_3_8 static const T _e () │ │ │ │ │ -39 { │ │ │ │ │ -40 using std::exp; │ │ │ │ │ -41 static const T _e = exp( T( 1 ) ); │ │ │ │ │ -42 return _e; │ │ │ │ │ -43 } │ │ │ │ │ -44 │ │ │ │ │ -_4_8 static const T _p_i () │ │ │ │ │ -49 { │ │ │ │ │ -50 using std::acos; │ │ │ │ │ -51 static const T _p_i = acos( T( -1 ) ); │ │ │ │ │ -52 return _p_i; │ │ │ │ │ -53 } │ │ │ │ │ -54 }; │ │ │ │ │ -55 │ │ │ │ │ -56 │ │ │ │ │ -64 template< class Field > │ │ │ │ │ -_6_5 struct _M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ -66 : public _S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ -67 {}; │ │ │ │ │ -68 │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_COMMON_INDICES_HH │ │ │ │ │ +7#define DUNE_COMMON_INDICES_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13#include <_d_u_n_e_/_c_o_m_m_o_n_/_k_e_y_w_o_r_d_s_._h_h> │ │ │ │ │ +14 │ │ │ │ │ +15namespace _D_u_n_e │ │ │ │ │ +16{ │ │ │ │ │ +29 template │ │ │ │ │ +_3_0 using _i_n_d_e_x___c_o_n_s_t_a_n_t = std::integral_constant; │ │ │ │ │ +31 │ │ │ │ │ +32 │ │ │ │ │ +33 │ │ │ │ │ +_5_0 namespace Indices │ │ │ │ │ +51 { │ │ │ │ │ +_5_3 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _0_> ___0 = {}; │ │ │ │ │ +54 │ │ │ │ │ +_5_6 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _1_> ___1 = {}; │ │ │ │ │ +57 │ │ │ │ │ +_5_9 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _2_> ___2 = {}; │ │ │ │ │ +60 │ │ │ │ │ +_6_2 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _3_> ___3 = {}; │ │ │ │ │ +63 │ │ │ │ │ +_6_5 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _4_> ___4 = {}; │ │ │ │ │ +66 │ │ │ │ │ +_6_8 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _5_> ___5 = {}; │ │ │ │ │ 69 │ │ │ │ │ -74 template │ │ │ │ │ -_7_5 constexpr Base _p_o_w_e_r(Base m, Exponent p) │ │ │ │ │ -76 { │ │ │ │ │ -77 static_assert(std::numeric_limits::is_integer, "Exponent must be │ │ │ │ │ -an integer type!"); │ │ │ │ │ +_7_1 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _6_> ___6 = {}; │ │ │ │ │ +72 │ │ │ │ │ +_7_4 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _7_> ___7 = {}; │ │ │ │ │ +75 │ │ │ │ │ +_7_7 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _8_> ___8 = {}; │ │ │ │ │ 78 │ │ │ │ │ -79 auto result = Base(1); │ │ │ │ │ -80 auto absp = (p<0) ? -p : p; // This is simply abs, but std::abs is not │ │ │ │ │ -constexpr │ │ │ │ │ -81 for (Exponent i = Exponent(0); i │ │ │ │ │ -_9_3 struct _F_a_c_t_o_r_i_a_l │ │ │ │ │ -94 { │ │ │ │ │ -_9_6 static constexpr int _f_a_c_t_o_r_i_a_l = m * _F_a_c_t_o_r_i_a_l_:_:_f_a_c_t_o_r_i_a_l; │ │ │ │ │ -97 }; │ │ │ │ │ -98 │ │ │ │ │ -100 template <> │ │ │ │ │ -_1_0_1 struct [[deprecated("Use function factorial instead! Will be removed after │ │ │ │ │ -Dune 2.9")]] _F_a_c_t_o_r_i_a_l<0> │ │ │ │ │ -102 { │ │ │ │ │ -103 // 0! = 1 │ │ │ │ │ -_1_0_4 static constexpr int _f_a_c_t_o_r_i_a_l = 1; │ │ │ │ │ -105 }; │ │ │ │ │ -106 │ │ │ │ │ -107 │ │ │ │ │ -109 // T has to be an integral type │ │ │ │ │ -110 template │ │ │ │ │ -_1_1_1 constexpr inline static T _f_a_c_t_o_r_i_a_l(const T& n) noexcept │ │ │ │ │ -112 { │ │ │ │ │ -113 static_assert(std::numeric_limits::is_integer, "`factorial(n)` has to be │ │ │ │ │ -called with an integer type."); │ │ │ │ │ -114 T fac = 1; │ │ │ │ │ -115 for(T k = 0; k < n; ++k) │ │ │ │ │ -116 fac *= k+1; │ │ │ │ │ -117 return fac; │ │ │ │ │ -118 } │ │ │ │ │ -119 │ │ │ │ │ -121 template │ │ │ │ │ -_1_2_2 constexpr inline static auto _f_a_c_t_o_r_i_a_l (std::integral_constant) │ │ │ │ │ -noexcept │ │ │ │ │ -123 { │ │ │ │ │ -124 return std::integral_constant{}; │ │ │ │ │ -125 } │ │ │ │ │ -126 │ │ │ │ │ -127 │ │ │ │ │ -129 // T has to be an integral type │ │ │ │ │ -130 template │ │ │ │ │ -_1_3_1 constexpr inline static T _b_i_n_o_m_i_a_l (const T& n, const T& k) noexcept │ │ │ │ │ -132 { │ │ │ │ │ -133 static_assert(std::numeric_limits::is_integer, "`binomial(n, k)` has to │ │ │ │ │ -be called with an integer type."); │ │ │ │ │ -134 │ │ │ │ │ -135 if( k < 0 || k > n ) │ │ │ │ │ -136 return 0; │ │ │ │ │ -137 │ │ │ │ │ -138 if (2*k > n) │ │ │ │ │ -139 return _b_i_n_o_m_i_a_l(n, n-k); │ │ │ │ │ -140 │ │ │ │ │ -141 T bin = 1; │ │ │ │ │ -142 for(auto i = n-k; i < n; ++i) │ │ │ │ │ -143 bin *= i+1; │ │ │ │ │ -144 return bin / _f_a_c_t_o_r_i_a_l(k); │ │ │ │ │ -145 } │ │ │ │ │ -146 │ │ │ │ │ -148 template │ │ │ │ │ -_1_4_9 constexpr inline static auto _b_i_n_o_m_i_a_l (std::integral_constant, std:: │ │ │ │ │ -integral_constant) noexcept │ │ │ │ │ -150 { │ │ │ │ │ -151 return std::integral_constant{}; │ │ │ │ │ -152 } │ │ │ │ │ -153 │ │ │ │ │ -154 template │ │ │ │ │ -_1_5_5 constexpr inline static auto _b_i_n_o_m_i_a_l (std::integral_constant, std:: │ │ │ │ │ -integral_constant) noexcept │ │ │ │ │ -156 { │ │ │ │ │ -157 return std::integral_constant= 0 ? 1 : 0)>{}; │ │ │ │ │ -158 } │ │ │ │ │ -159 │ │ │ │ │ -160 │ │ │ │ │ -162 // conjugate complex does nothing for non-complex types │ │ │ │ │ -163 template │ │ │ │ │ -_1_6_4 inline K _c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x (const K& x) │ │ │ │ │ -165 { │ │ │ │ │ -166 return x; │ │ │ │ │ -167 } │ │ │ │ │ -168 │ │ │ │ │ -169#ifndef DOXYGEN │ │ │ │ │ -170 // specialization for complex │ │ │ │ │ -171 template │ │ │ │ │ -172 inline std::complex _c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x (const std::complex& c) │ │ │ │ │ -173 { │ │ │ │ │ -174 return std::complex(c.real(),-c.imag()); │ │ │ │ │ -175 } │ │ │ │ │ -176#endif │ │ │ │ │ -177 │ │ │ │ │ -179 template │ │ │ │ │ -_1_8_0 int _s_i_g_n(const T& val) │ │ │ │ │ -181 { │ │ │ │ │ -182 return (val < 0 ? -1 : 1); │ │ │ │ │ -183 } │ │ │ │ │ -184 │ │ │ │ │ -185 │ │ │ │ │ -186 namespace Impl { │ │ │ │ │ -187 // Returns whether a given type behaves like std::complex<>, i.e. whether │ │ │ │ │ -188 // real() and imag() are defined │ │ │ │ │ -189 template │ │ │ │ │ -190 struct isComplexLike { │ │ │ │ │ -191 private: │ │ │ │ │ -192 template │ │ │ │ │ -193 static auto test(U* u) -> decltype(u->real(), u->imag(), std::true_type()); │ │ │ │ │ -194 │ │ │ │ │ -195 template │ │ │ │ │ -196 static auto test(...) -> decltype(std::false_type()); │ │ │ │ │ -197 │ │ │ │ │ -198 public: │ │ │ │ │ -199 static const bool value = decltype(test(0))::value; │ │ │ │ │ -200 }; │ │ │ │ │ -201 } // namespace Impl │ │ │ │ │ -202 │ │ │ │ │ -204 │ │ │ │ │ -227 namespace MathOverloads { │ │ │ │ │ -228 │ │ │ │ │ -_2_3_0 struct _A_D_L_T_a_g {}; │ │ │ │ │ -231 │ │ │ │ │ -_2_3_2#define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction) \ │ │ │ │ │ -233 template \ │ │ │ │ │ -234 auto function(const T &t, PriorityTag<1>, ADLTag) \ │ │ │ │ │ -235 -> decltype(function(t)) { \ │ │ │ │ │ -236 return function(t); \ │ │ │ │ │ -237 } \ │ │ │ │ │ -238 template \ │ │ │ │ │ -239 auto function(const T &t, PriorityTag<0>, ADLTag) { \ │ │ │ │ │ -240 using std::stdfunction; \ │ │ │ │ │ -241 return stdfunction(t); \ │ │ │ │ │ -242 } \ │ │ │ │ │ -243 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -244 │ │ │ │ │ -_2_4_5 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(_i_s_N_a_N,isnan); │ │ │ │ │ -_2_4_6 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(_i_s_I_n_f,isinf); │ │ │ │ │ -_2_4_7 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N(_i_s_F_i_n_i_t_e,isfinite); │ │ │ │ │ -248#undef DUNE_COMMON_MATH_ISFUNCTION │ │ │ │ │ -249 │ │ │ │ │ -250 template │ │ │ │ │ -_2_5_1 auto _i_s_U_n_o_r_d_e_r_e_d(const T &t1, const T &t2, _P_r_i_o_r_i_t_y_T_a_g_<_1_>, _A_D_L_T_a_g) │ │ │ │ │ -252 -> decltype(_i_s_U_n_o_r_d_e_r_e_d(t1, t2)) { │ │ │ │ │ -253 return _i_s_U_n_o_r_d_e_r_e_d(t1, t2); │ │ │ │ │ -254 } │ │ │ │ │ -255 │ │ │ │ │ -256 template │ │ │ │ │ -_2_5_7 auto _i_s_U_n_o_r_d_e_r_e_d(const T &t1, const T &t2, _P_r_i_o_r_i_t_y_T_a_g_<_0_>, _A_D_L_T_a_g) { │ │ │ │ │ -258 using std::isunordered; │ │ │ │ │ -259 return isunordered(t1, t2); │ │ │ │ │ -260 } │ │ │ │ │ -261 } │ │ │ │ │ -262 │ │ │ │ │ -_2_6_3 namespace MathImpl { │ │ │ │ │ -264 │ │ │ │ │ -265 // NOTE: it is important that these functors have names different from the │ │ │ │ │ -266 // names of the functions they are forwarding to. Otherwise the │ │ │ │ │ -267 // unqualified call would find the functor type, not a function, and ADL │ │ │ │ │ -268 // would never be attempted. │ │ │ │ │ -_2_6_9#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function) \ │ │ │ │ │ -270 struct function##Impl { \ │ │ │ │ │ -271 template \ │ │ │ │ │ -272 constexpr auto operator()(const T &t) const { \ │ │ │ │ │ -273 return function(t, PriorityTag<10>{}, MathOverloads::ADLTag{}); \ │ │ │ │ │ -274 } \ │ │ │ │ │ -275 }; \ │ │ │ │ │ -276 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ -277 │ │ │ │ │ -_2_7_8 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(isNaN); │ │ │ │ │ -_2_7_9 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(isInf); │ │ │ │ │ -_2_8_0 _D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R(isFinite); │ │ │ │ │ -281#undef DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR │ │ │ │ │ -282 │ │ │ │ │ -_2_8_3 struct _i_s_U_n_o_r_d_e_r_e_d_I_m_p_l { │ │ │ │ │ -284 template │ │ │ │ │ -_2_8_5 constexpr auto _o_p_e_r_a_t_o_r_(_)(const T &t1, const T &t2) const { │ │ │ │ │ -286 return isUnordered(t1, t2, _P_r_i_o_r_i_t_y_T_a_g_<_1_0_>{}, _M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g{}); │ │ │ │ │ -287 } │ │ │ │ │ -288 }; │ │ │ │ │ -289 │ │ │ │ │ -290 } //MathImpl │ │ │ │ │ -291 │ │ │ │ │ -292 │ │ │ │ │ -293 namespace Impl { │ │ │ │ │ -294 /* This helper has a math functor as a static constexpr member. Doing │ │ │ │ │ -295 this as a static member of a template struct means we can do this │ │ │ │ │ -296 without violating the ODR or putting the definition into a separate │ │ │ │ │ -297 compilation unit, while still still ensuring the functor is the same │ │ │ │ │ -298 lvalue across all compilation units. │ │ │ │ │ -299 */ │ │ │ │ │ -300 template │ │ │ │ │ -301 struct MathDummy │ │ │ │ │ -302 { │ │ │ │ │ -303 static constexpr T value{}; │ │ │ │ │ -304 }; │ │ │ │ │ -305 │ │ │ │ │ -306 template │ │ │ │ │ -307 constexpr T MathDummy::value; │ │ │ │ │ -308 │ │ │ │ │ -309 } //namespace Impl │ │ │ │ │ -310 │ │ │ │ │ -311 namespace { │ │ │ │ │ -312 /* Provide the math functors directly in the `Dune` namespace. │ │ │ │ │ -313 │ │ │ │ │ -314 This actually declares a different name in each translation unit, but │ │ │ │ │ -315 they all resolve to the same lvalue. │ │ │ │ │ -316 */ │ │ │ │ │ -317 │ │ │ │ │ -319 │ │ │ │ │ -323 constexpr auto const &_i_s_N_a_N = Impl::MathDummy::value; │ │ │ │ │ -324 │ │ │ │ │ -326 │ │ │ │ │ -330 constexpr auto const &_i_s_I_n_f = Impl::MathDummy::value; │ │ │ │ │ -331 │ │ │ │ │ -333 │ │ │ │ │ -337 constexpr auto const &_i_s_F_i_n_i_t_e = Impl::MathDummy:: │ │ │ │ │ -value; │ │ │ │ │ -338 │ │ │ │ │ -340 │ │ │ │ │ -345 constexpr auto const &_i_s_U_n_o_r_d_e_r_e_d = Impl::MathDummy::value; │ │ │ │ │ -346 } │ │ │ │ │ -347 │ │ │ │ │ -348 namespace MathOverloads { │ │ │ │ │ -349 /*Overloads for complex types*/ │ │ │ │ │ -350 template::value> > │ │ │ │ │ -_3_5_1 auto _i_s_N_a_N(const T &t, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ -352 return Dune::isNaN(real(t)) || Dune::isNaN(imag(t)); │ │ │ │ │ -353 } │ │ │ │ │ -354 │ │ │ │ │ -355 template::value> > │ │ │ │ │ -_3_5_6 auto _i_s_I_n_f(const T &t, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ -357 return Dune::isInf(real(t)) || Dune::isInf(imag(t)); │ │ │ │ │ -358 } │ │ │ │ │ -359 │ │ │ │ │ -360 template::value> > │ │ │ │ │ -_3_6_1 auto _i_s_F_i_n_i_t_e(const T &t, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ -362 return Dune::isFinite(real(t)) && Dune::isFinite(imag(t)); │ │ │ │ │ -363 } │ │ │ │ │ -364 } //MathOverloads │ │ │ │ │ -365} │ │ │ │ │ -366 │ │ │ │ │ -367#endif // #ifndef DUNE_MATH_HH │ │ │ │ │ -_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N___F_U_N_C_T_O_R │ │ │ │ │ -#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function) │ │ │ │ │ -DDeeffiinniittiioonn math.hh:269 │ │ │ │ │ -_D_U_N_E___C_O_M_M_O_N___M_A_T_H___I_S_F_U_N_C_T_I_O_N │ │ │ │ │ -#define DUNE_COMMON_MATH_ISFUNCTION(function, stdfunction) │ │ │ │ │ -DDeeffiinniittiioonn math.hh:232 │ │ │ │ │ -_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ -Utilities for type computations, constraining overloads, ... │ │ │ │ │ +_8_0 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _9_> ___9 = {}; │ │ │ │ │ +81 │ │ │ │ │ +_8_3 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_0_> ___1_0 = {}; │ │ │ │ │ +84 │ │ │ │ │ +_8_6 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_1_> ___1_1 = {}; │ │ │ │ │ +87 │ │ │ │ │ +_8_9 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_2_> ___1_2 = {}; │ │ │ │ │ +90 │ │ │ │ │ +_9_2 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_3_> ___1_3 = {}; │ │ │ │ │ +93 │ │ │ │ │ +_9_5 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_4_> ___1_4 = {}; │ │ │ │ │ +96 │ │ │ │ │ +_9_8 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_5_> ___1_5 = {}; │ │ │ │ │ +99 │ │ │ │ │ +_1_0_1 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_6_> ___1_6 = {}; │ │ │ │ │ +102 │ │ │ │ │ +_1_0_4 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_7_> ___1_7 = {}; │ │ │ │ │ +105 │ │ │ │ │ +_1_0_7 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_8_> ___1_8 = {}; │ │ │ │ │ +108 │ │ │ │ │ +_1_1_0 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_9_> ___1_9 = {}; │ │ │ │ │ +111 │ │ │ │ │ +112 } // namespace Indices │ │ │ │ │ +113 │ │ │ │ │ +124 template │ │ │ │ │ +_1_2_5 decltype(auto) constexpr _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e(F&& f, std:: │ │ │ │ │ +integer_sequence sequence) │ │ │ │ │ +126 { │ │ │ │ │ +127 return f(std::integral_constant()...); │ │ │ │ │ +128 } │ │ │ │ │ +129 │ │ │ │ │ +130} //namespace Dune │ │ │ │ │ +131 │ │ │ │ │ +132#endif // DUNE_COMMON_INDICES_HH │ │ │ │ │ +_k_e_y_w_o_r_d_s_._h_h │ │ │ │ │ +Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ │ +_D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E │ │ │ │ │ +#define DUNE_INLINE_VARIABLE │ │ │ │ │ +DDeeffiinniittiioonn keywords.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_6 │ │ │ │ │ +constexpr index_constant< 16 > _16 │ │ │ │ │ +Compile time index with value 16. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_5 │ │ │ │ │ +constexpr index_constant< 15 > _15 │ │ │ │ │ +Compile time index with value 15. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:98 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___8 │ │ │ │ │ +constexpr index_constant< 8 > _8 │ │ │ │ │ +Compile time index with value 8. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___7 │ │ │ │ │ +constexpr index_constant< 7 > _7 │ │ │ │ │ +Compile time index with value 7. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___0 │ │ │ │ │ +constexpr index_constant< 0 > _0 │ │ │ │ │ +Compile time index with value 0. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___9 │ │ │ │ │ +constexpr index_constant< 9 > _9 │ │ │ │ │ +Compile time index with value 9. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_4 │ │ │ │ │ +constexpr index_constant< 14 > _14 │ │ │ │ │ +Compile time index with value 14. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1 │ │ │ │ │ +constexpr index_constant< 1 > _1 │ │ │ │ │ +Compile time index with value 1. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___3 │ │ │ │ │ +constexpr index_constant< 3 > _3 │ │ │ │ │ +Compile time index with value 3. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:62 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_2 │ │ │ │ │ +constexpr index_constant< 12 > _12 │ │ │ │ │ +Compile time index with value 12. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e │ │ │ │ │ +decltype(auto) constexpr unpackIntegerSequence(F &&f, std::integer_sequence< I, │ │ │ │ │ +i... > sequence) │ │ │ │ │ +Unpack an std::integer_sequence to std::integral_constant... │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:125 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_1 │ │ │ │ │ +constexpr index_constant< 11 > _11 │ │ │ │ │ +Compile time index with value 11. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_8 │ │ │ │ │ +constexpr index_constant< 18 > _18 │ │ │ │ │ +Compile time index with value 18. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:107 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_3 │ │ │ │ │ +constexpr index_constant< 13 > _13 │ │ │ │ │ +Compile time index with value 13. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___5 │ │ │ │ │ +constexpr index_constant< 5 > _5 │ │ │ │ │ +Compile time index with value 5. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:68 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_7 │ │ │ │ │ +constexpr index_constant< 17 > _17 │ │ │ │ │ +Compile time index with value 17. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_0 │ │ │ │ │ +constexpr index_constant< 10 > _10 │ │ │ │ │ +Compile time index with value 10. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:83 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___2 │ │ │ │ │ +constexpr index_constant< 2 > _2 │ │ │ │ │ +Compile time index with value 2. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t │ │ │ │ │ +std::integral_constant< std::size_t, i > index_constant │ │ │ │ │ +An index constant with value i. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_9 │ │ │ │ │ +constexpr index_constant< 19 > _19 │ │ │ │ │ +Compile time index with value 19. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___6 │ │ │ │ │ +constexpr index_constant< 6 > _6 │ │ │ │ │ +Compile time index with value 6. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___4 │ │ │ │ │ +constexpr index_constant< 4 > _4 │ │ │ │ │ +Compile time index with value 4. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:65 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_b_i_n_o_m_i_a_l │ │ │ │ │ -static constexpr T binomial(const T &n, const T &k) noexcept │ │ │ │ │ -calculate the binomial coefficient n over k as a constexpr │ │ │ │ │ -DDeeffiinniittiioonn math.hh:131 │ │ │ │ │ -_D_u_n_e_:_:_p_o_w_e_r │ │ │ │ │ -constexpr Base power(Base m, Exponent p) │ │ │ │ │ -Power method for integer exponents. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_f_a_c_t_o_r_i_a_l │ │ │ │ │ -static constexpr T factorial(const T &n) noexcept │ │ │ │ │ -calculate the factorial of n as a constexpr │ │ │ │ │ -DDeeffiinniittiioonn math.hh:111 │ │ │ │ │ -_D_u_n_e_:_:_s_i_g_n │ │ │ │ │ -int sign(const T &val) │ │ │ │ │ -Return the sign of the value. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x │ │ │ │ │ -K conjugateComplex(const K &x) │ │ │ │ │ -compute conjugate complex of x │ │ │ │ │ -DDeeffiinniittiioonn math.hh:164 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N │ │ │ │ │ -bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:604 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f │ │ │ │ │ -bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:594 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e │ │ │ │ │ -auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:584 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d │ │ │ │ │ -bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, │ │ │ │ │ -PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:614 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ -Standard implementation of MathematicalConstants. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:34 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_:_:_e │ │ │ │ │ -static const T e() │ │ │ │ │ -Euler's number. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_n_d_a_r_d_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_:_:_p_i │ │ │ │ │ -static const T pi() │ │ │ │ │ -Archimedes' constant. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:48 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s │ │ │ │ │ -Provides commonly used mathematical constants. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_F_a_c_t_o_r_i_a_l │ │ │ │ │ -DDeeffiinniittiioonn math.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_F_a_c_t_o_r_i_a_l_:_:_f_a_c_t_o_r_i_a_l │ │ │ │ │ -static constexpr int factorial │ │ │ │ │ -factorial stores m! │ │ │ │ │ -DDeeffiinniittiioonn math.hh:96 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ -Tag to make sure the functions in this namespace can be found by ADL. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_i_s_U_n_o_r_d_e_r_e_d_I_m_p_l │ │ │ │ │ -DDeeffiinniittiioonn math.hh:283 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_I_m_p_l_:_:_i_s_U_n_o_r_d_e_r_e_d_I_m_p_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -constexpr auto operator()(const T &t1, const T &t2) const │ │ │ │ │ -DDeeffiinniittiioonn math.hh:285 │ │ │ │ │ -_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g │ │ │ │ │ -Helper class for tagging priorities. │ │ │ │ │ -DDeeffiinniittiioonn typeutilities.hh:73 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00137.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: indent.hh File Reference │ │ │ │ +dune-common: base.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,54 +65,53 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
    │ │ │ │ -
    indent.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ + │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Utility class for handling nested indentation in output. │ │ │ │ +

    Basic definitions for SIMD Implementations. │ │ │ │ More...

    │ │ │ │ -
    #include <ostream>
    │ │ │ │ -#include <string>
    │ │ │ │ -
    │ │ │ │ + │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::Indent
     Utility class for handling nested indentation in output. More...
    struct  Dune::Simd::Overloads::ADLTag< i >
     
    struct  Dune::Simd::Overloads::ADLTag< 0 >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

    │ │ │ │ Namespaces

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

    │ │ │ │ -Functions

    std::ostream & Dune::operator<< (std::ostream &s, const Indent &indent)
     write indentation to a stream
     
    namespace  Dune::Simd
     Namespace for vectorization interface functions used by library developers.
     
    namespace  Dune::Simd::Overloads
     Namespace for the overloads and specializations that make up a SIMD implementation.
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Utility class for handling nested indentation in output.

    │ │ │ │ -
    Author
    Jö Fahlke
    │ │ │ │ +

    Basic definitions for SIMD Implementations.

    │ │ │ │ +

    This file provides basic definitions and template declarations that are used to write SIMD abstraction layers.

    │ │ │ │ +

    This file should never be included by users of the SIMD abstraction. Include <dune/common/simd/simd.hh> instead.

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,31 +1,37 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -indent.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n │ │ │ │ │ -Utility class for handling nested indentation in output. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +base.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _A_b_s_t_r_a_c_t_i_o_n_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e │ │ │ │ │ +Basic definitions for SIMD Implementations. _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_:_:_I_n_d_e_n_t │ │ │ │ │ -  Utility class for handling nested indentation in output. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g_<_ _i_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g_<_ _0_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &s, const _I_n_d_e_n_t &indent) │ │ │ │ │ -  write indentation to a stream │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ +  Namespace for vectorization interface functions used by library │ │ │ │ │ + developers. │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ +  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ + implementation. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Utility class for handling nested indentation in output. │ │ │ │ │ - Author │ │ │ │ │ - Jö Fahlke │ │ │ │ │ +Basic definitions for SIMD Implementations. │ │ │ │ │ +This file provides basic definitions and template declarations that are used to │ │ │ │ │ +write SIMD abstraction layers. │ │ │ │ │ +This file should never be included by users of the SIMD abstraction. Include │ │ │ │ │ +<_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> instead. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00137_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: indent.hh Source File │ │ │ │ +dune-common: base.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,111 +70,66 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    indent.hh
    │ │ │ │ +
    base.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_INDENT_HH
    │ │ │ │ -
    6#define DUNE_COMMON_INDENT_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include <ostream>
    │ │ │ │ -
    9#include <string>
    │ │ │ │ -
    10
    │ │ │ │ -
    11namespace Dune {
    │ │ │ │ -
    22
    │ │ │ │ -
    │ │ │ │ -
    52 class Indent
    │ │ │ │ -
    53 {
    │ │ │ │ -
    54 const Indent* parent;
    │ │ │ │ -
    55 std::string basic_indent;
    │ │ │ │ -
    56 unsigned level;
    │ │ │ │ -
    57
    │ │ │ │ -
    58 public:
    │ │ │ │ -
    60
    │ │ │ │ -
    │ │ │ │ -
    63 inline Indent(const std::string& basic_indent_ = " ", unsigned level_ = 0)
    │ │ │ │ -
    64 : parent(0), basic_indent(basic_indent_), level(level_)
    │ │ │ │ -
    65 { }
    │ │ │ │ -
    │ │ │ │ -
    66
    │ │ │ │ -
    │ │ │ │ -
    68 inline Indent(unsigned level_)
    │ │ │ │ -
    69 : parent(0), basic_indent(" "), level(level_)
    │ │ │ │ -
    70 { }
    │ │ │ │ -
    │ │ │ │ -
    71
    │ │ │ │ -
    73
    │ │ │ │ -
    │ │ │ │ -
    76 inline Indent(const Indent* parent_,
    │ │ │ │ -
    77 const std::string& basic_indent_ = " ", unsigned level_ = 1)
    │ │ │ │ -
    78 : parent(parent_), basic_indent(basic_indent_), level(level_)
    │ │ │ │ -
    79 { }
    │ │ │ │ -
    │ │ │ │ -
    80
    │ │ │ │ -
    │ │ │ │ -
    82 inline Indent(const Indent* parent_, unsigned level_)
    │ │ │ │ -
    83 : parent(parent_), basic_indent(" "), level(level_)
    │ │ │ │ -
    84 { }
    │ │ │ │ -
    │ │ │ │ -
    85
    │ │ │ │ -
    │ │ │ │ -
    87 inline Indent operator+(const std::string& newindent) const {
    │ │ │ │ -
    88 return Indent(this, newindent);
    │ │ │ │ -
    89 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    91 inline Indent operator+(unsigned morelevel) const {
    │ │ │ │ -
    92 return Indent(parent, basic_indent, level+morelevel);
    │ │ │ │ -
    93 }
    │ │ │ │ -
    │ │ │ │ -
    95 inline Indent& operator++() { ++level; return *this; }
    │ │ │ │ -
    97 inline Indent& operator--() { if ( level > 0 ) --level; return *this; }
    │ │ │ │ -
    98
    │ │ │ │ -
    100 friend inline std::ostream& operator<<(std::ostream& s,
    │ │ │ │ -
    101 const Indent& indent);
    │ │ │ │ -
    102 };
    │ │ │ │ -
    │ │ │ │ -
    103
    │ │ │ │ -
    │ │ │ │ -
    105 inline std::ostream& operator<<(std::ostream& s, const Indent& indent) {
    │ │ │ │ -
    106 if(indent.parent)
    │ │ │ │ -
    107 s << *indent.parent;
    │ │ │ │ -
    108 for(unsigned i = 0; i < indent.level; ++i)
    │ │ │ │ -
    109 s << indent.basic_indent;
    │ │ │ │ -
    110 return s;
    │ │ │ │ -
    111 }
    │ │ │ │ -
    │ │ │ │ -
    112
    │ │ │ │ -
    115} // namespace Dune
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_BASE_HH
    │ │ │ │ +
    4#define DUNE_COMMON_SIMD_BASE_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    92namespace Dune {
    │ │ │ │ +
    93 namespace Simd {
    │ │ │ │ +
    94
    │ │ │ │ +
    97
    │ │ │ │ +
    112 namespace Overloads {
    │ │ │ │ +
    113
    │ │ │ │
    116
    │ │ │ │ -
    117#endif // DUNE_COMMON_INDENT_HH
    │ │ │ │ -
    Indent operator+(const std::string &newindent) const
    create new indentation object with this one as parent
    Definition indent.hh:87
    │ │ │ │ -
    Indent(unsigned level_)
    setup without parent and basic_indentation of two spaces
    Definition indent.hh:68
    │ │ │ │ -
    Indent operator+(unsigned morelevel) const
    create a copy of this indentation object with raised level
    Definition indent.hh:91
    │ │ │ │ -
    Indent(const Indent *parent_, unsigned level_)
    setup with parent
    Definition indent.hh:82
    │ │ │ │ -
    Indent & operator++()
    raise indentation level
    Definition indent.hh:95
    │ │ │ │ -
    Indent(const std::string &basic_indent_=" ", unsigned level_=0)
    setup without parent
    Definition indent.hh:63
    │ │ │ │ -
    Indent & operator--()
    lower indentation level
    Definition indent.hh:97
    │ │ │ │ -
    friend std::ostream & operator<<(std::ostream &s, const Indent &indent)
    write indentation to a stream
    Definition indent.hh:105
    │ │ │ │ -
    Indent(const Indent *parent_, const std::string &basic_indent_=" ", unsigned level_=1)
    setup with parent
    Definition indent.hh:76
    │ │ │ │ -
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │ +
    118
    │ │ │ │ +
    181 template<unsigned i, bool = true>
    │ │ │ │ +
    182 struct ADLTag;
    │ │ │ │ +
    183
    │ │ │ │ +
    184 template<unsigned i>
    │ │ │ │ +
    185 struct ADLTag<i> : ADLTag<i-1> {};
    │ │ │ │ +
    186
    │ │ │ │ +
    187 template<>
    │ │ │ │ +
    188 struct ADLTag<0> {};
    │ │ │ │ +
    189
    │ │ │ │ +
    191
    │ │ │ │ +
    195 template<class V, class SFINAETag = void>
    │ │ │ │ +
    196 struct ScalarType;
    │ │ │ │ +
    197
    │ │ │ │ +
    199
    │ │ │ │ +
    203 template<class S, class V, class SFINAETag = void>
    │ │ │ │ +
    204 struct RebindType;
    │ │ │ │ +
    205
    │ │ │ │ +
    207
    │ │ │ │ +
    211 template<class V, class SFINAETag = void>
    │ │ │ │ +
    212 struct LaneCount;
    │ │ │ │ +
    213
    │ │ │ │ +
    215
    │ │ │ │ +
    216 } // namespace Overloads
    │ │ │ │ +
    217 } // namespace Simd
    │ │ │ │ +
    218} // namespace Dune
    │ │ │ │ +
    219
    │ │ │ │ +
    220#endif // DUNE_COMMON_SIMD_BASE_HH
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Utility class for handling nested indentation in output.
    Definition indent.hh:53
    │ │ │ │ +
    Tag used to force late-binding lookup in Dune::Simd::Overloads.
    Definition base.hh:182
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:60
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:67
    │ │ │ │ +
    should be derived from a Dune::index_constant
    Definition standard.hh:74
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,119 +1,67 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -indent.hh │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +base.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_INDENT_HH │ │ │ │ │ -6#define DUNE_COMMON_INDENT_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e { │ │ │ │ │ -22 │ │ │ │ │ -_5_2 class _I_n_d_e_n_t │ │ │ │ │ -53 { │ │ │ │ │ -54 const _I_n_d_e_n_t* parent; │ │ │ │ │ -55 std::string basic_indent; │ │ │ │ │ -56 unsigned level; │ │ │ │ │ -57 │ │ │ │ │ -58 public: │ │ │ │ │ -60 │ │ │ │ │ -_6_3 inline _I_n_d_e_n_t(const std::string& basic_indent_ = " ", unsigned level_ = 0) │ │ │ │ │ -64 : parent(0), basic_indent(basic_indent_), level(level_) │ │ │ │ │ -65 { } │ │ │ │ │ -66 │ │ │ │ │ -_6_8 inline _I_n_d_e_n_t(unsigned level_) │ │ │ │ │ -69 : parent(0), basic_indent(" "), level(level_) │ │ │ │ │ -70 { } │ │ │ │ │ -71 │ │ │ │ │ -73 │ │ │ │ │ -_7_6 inline _I_n_d_e_n_t(const _I_n_d_e_n_t* parent_, │ │ │ │ │ -77 const std::string& basic_indent_ = " ", unsigned level_ = 1) │ │ │ │ │ -78 : parent(parent_), basic_indent(basic_indent_), level(level_) │ │ │ │ │ -79 { } │ │ │ │ │ -80 │ │ │ │ │ -_8_2 inline _I_n_d_e_n_t(const _I_n_d_e_n_t* parent_, unsigned level_) │ │ │ │ │ -83 : parent(parent_), basic_indent(" "), level(level_) │ │ │ │ │ -84 { } │ │ │ │ │ -85 │ │ │ │ │ -_8_7 inline _I_n_d_e_n_t _o_p_e_r_a_t_o_r_+(const std::string& newindent) const { │ │ │ │ │ -88 return _I_n_d_e_n_t(this, newindent); │ │ │ │ │ -89 } │ │ │ │ │ -_9_1 inline _I_n_d_e_n_t _o_p_e_r_a_t_o_r_+(unsigned morelevel) const { │ │ │ │ │ -92 return _I_n_d_e_n_t(parent, basic_indent, level+morelevel); │ │ │ │ │ -93 } │ │ │ │ │ -_9_5 inline _I_n_d_e_n_t& _o_p_e_r_a_t_o_r_+_+() { ++level; return *this; } │ │ │ │ │ -_9_7 inline _I_n_d_e_n_t& _o_p_e_r_a_t_o_r_-_-() { if ( level > 0 ) --level; return *this; } │ │ │ │ │ -98 │ │ │ │ │ -100 friend inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& s, │ │ │ │ │ -101 const _I_n_d_e_n_t& indent); │ │ │ │ │ -102 }; │ │ │ │ │ -103 │ │ │ │ │ -_1_0_5 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& s, const _I_n_d_e_n_t& indent) { │ │ │ │ │ -106 if(indent.parent) │ │ │ │ │ -107 s << *indent.parent; │ │ │ │ │ -108 for(unsigned i = 0; i < indent.level; ++i) │ │ │ │ │ -109 s << indent.basic_indent; │ │ │ │ │ -110 return s; │ │ │ │ │ -111 } │ │ │ │ │ -112 │ │ │ │ │ -115} // namespace Dune │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_SIMD_BASE_HH │ │ │ │ │ +4#define DUNE_COMMON_SIMD_BASE_HH │ │ │ │ │ +5 │ │ │ │ │ +92namespace _D_u_n_e { │ │ │ │ │ +93 namespace Simd { │ │ │ │ │ +94 │ │ │ │ │ +97 │ │ │ │ │ +112 namespace Overloads { │ │ │ │ │ +113 │ │ │ │ │ 116 │ │ │ │ │ -117#endif // DUNE_COMMON_INDENT_HH │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ -Indent operator+(const std::string &newindent) const │ │ │ │ │ -create new indentation object with this one as parent │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_I_n_d_e_n_t │ │ │ │ │ -Indent(unsigned level_) │ │ │ │ │ -setup without parent and basic_indentation of two spaces │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:68 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ -Indent operator+(unsigned morelevel) const │ │ │ │ │ -create a copy of this indentation object with raised level │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_I_n_d_e_n_t │ │ │ │ │ -Indent(const Indent *parent_, unsigned level_) │ │ │ │ │ -setup with parent │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -Indent & operator++() │ │ │ │ │ -raise indentation level │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_I_n_d_e_n_t │ │ │ │ │ -Indent(const std::string &basic_indent_=" ", unsigned level_=0) │ │ │ │ │ -setup without parent │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ -Indent & operator--() │ │ │ │ │ -lower indentation level │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:97 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -friend std::ostream & operator<<(std::ostream &s, const Indent &indent) │ │ │ │ │ -write indentation to a stream │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:105 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t_:_:_I_n_d_e_n_t │ │ │ │ │ -Indent(const Indent *parent_, const std::string &basic_indent_=" ", unsigned │ │ │ │ │ -level_=1) │ │ │ │ │ -setup with parent │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +118 │ │ │ │ │ +181 template │ │ │ │ │ +_1_8_2 struct _A_D_L_T_a_g; │ │ │ │ │ +183 │ │ │ │ │ +184 template │ │ │ │ │ +_1_8_5 struct _A_D_L_T_a_g : _A_D_L_T_a_g {}; │ │ │ │ │ +186 │ │ │ │ │ +187 template<> │ │ │ │ │ +_1_8_8 struct _A_D_L_T_a_g<0> {}; │ │ │ │ │ +189 │ │ │ │ │ +191 │ │ │ │ │ +195 template │ │ │ │ │ +196 struct _S_c_a_l_a_r_T_y_p_e; │ │ │ │ │ +197 │ │ │ │ │ +199 │ │ │ │ │ +203 template │ │ │ │ │ +204 struct _R_e_b_i_n_d_T_y_p_e; │ │ │ │ │ +205 │ │ │ │ │ +207 │ │ │ │ │ +211 template │ │ │ │ │ +212 struct _L_a_n_e_C_o_u_n_t; │ │ │ │ │ +213 │ │ │ │ │ +215 │ │ │ │ │ +216 } // namespace Overloads │ │ │ │ │ +217 } // namespace Simd │ │ │ │ │ +218} // namespace Dune │ │ │ │ │ +219 │ │ │ │ │ +220#endif // DUNE_COMMON_SIMD_BASE_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_n_t │ │ │ │ │ -Utility class for handling nested indentation in output. │ │ │ │ │ -DDeeffiinniittiioonn indent.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ +DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t │ │ │ │ │ +should be derived from a Dune::index_constant │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:74 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00140.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: tuplevector.hh File Reference │ │ │ │ +dune-common: standard.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,57 +65,86 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
    │ │ │ │ -
    tuplevector.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ + │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Provides the TupleVector class that augments std::tuple by operator[]. │ │ │ │ +

    SIMD abstractions for the standard built-in types. │ │ │ │ More...

    │ │ │ │ -
    #include <tuple>
    │ │ │ │ +
    #include <cstddef>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ #include <utility>
    │ │ │ │ -#include <dune/common/indices.hh>
    │ │ │ │ -#include <dune/common/typetraits.hh>
    │ │ │ │ -#include <dune/common/std/type_traits.hh>
    │ │ │ │ +#include <dune/common/indices.hh>
    │ │ │ │ +#include <dune/common/simd/base.hh>
    │ │ │ │ +#include <dune/common/simd/defaults.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::TupleVector< T >
     A class augmenting std::tuple by element access via operator[]. More...
    struct  Dune::Simd::Overloads::ScalarType< V, class >
     should have a member type type More...
     
    struct  Dune::Simd::Overloads::RebindType< S, class, class >
     should have a member type type More...
     
    struct  Dune::Simd::Overloads::LaneCount< class, class >
     should be derived from a Dune::index_constant More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Simd
     Namespace for vectorization interface functions used by library developers.
     
    namespace  Dune::Simd::Overloads
     Namespace for the overloads and specializations that make up a SIMD implementation.
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<class... T>
    constexpr auto Dune::makeTupleVector (T &&... t)
     
    Specialized classes and overloaded functions
    template<class V >
    Dune::Simd::Overloads::lane (ADLTag< 2 >, std::size_t, V v)
     implements Simd::lane()
     
    template<class V >
    V & Dune::Simd::Overloads::lane (ADLTag< 3 >, std::size_t, V &v)
     
    bool Dune::Simd::Overloads::anyTrue (ADLTag< 2 >, bool mask)
     implements Simd::anyTrue()
     
    bool Dune::Simd::Overloads::allTrue (ADLTag< 2 >, bool mask)
     implements Simd::allTrue()
     
    bool Dune::Simd::Overloads::anyFalse (ADLTag< 2 >, bool mask)
     implements Simd::anyFalse()
     
    bool Dune::Simd::Overloads::allFalse (ADLTag< 2 >, bool mask)
     implements Simd::allFalse()
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Provides the TupleVector class that augments std::tuple by operator[].

    │ │ │ │ -
    Author
    Carsten Gräser
    │ │ │ │ +

    SIMD abstractions for the standard built-in types.

    │ │ │ │ +

    This file should not normally be included by users of the SIMD abstraction (i.e. other Dune headers). Neither should it be included by the translation units passing built-in types to Dune headers that in turn support SIMD types through the SIMD abstraction. Dune-functionality always supports built-in types. Either because that functionality does not support SIMD types and so only supports built-in types, or if it does support SIMD types it must include <dune/common/simd/simd.hh>, which in turn includes this header.

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,33 +1,73 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -tuplevector.hh File Reference │ │ │ │ │ -Provides the TupleVector class that augments std::tuple by operator[]. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +standard.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _A_p_p_l_i_c_a_t_i_o_n_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e » _S_I_M_D_ _A_b_s_t_r_a_c_t_i_o_n │ │ │ │ │ +_I_m_p_l_e_m_e_n_t_a_t_i_o_n_ _f_o_r_ _s_t_a_n_d_a_r_d_ _t_y_p_e_s │ │ │ │ │ +SIMD abstractions for the standard built-in types. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ #include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_d_e_f_a_u_l_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_:_:_T_u_p_l_e_V_e_c_t_o_r_<_ _T_ _> │ │ │ │ │ -  A class augmenting std::tuple by element access via operator[]. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_<_ _V_,_ _c_l_a_s_s_ _> │ │ │ │ │ +  should have a member type type _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e_<_ _S_,_ _c_l_a_s_s_,_ _c_l_a_s_s_ _> │ │ │ │ │ +  should have a member type type _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t_<_ _c_l_a_s_s_,_ _c_l_a_s_s_ _> │ │ │ │ │ +  should be derived from a _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ +  Namespace for vectorization interface functions used by library │ │ │ │ │ + developers. │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ +  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ + implementation. │ │ │ │ │ +  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -constexpr auto  _D_u_n_e_:_:_m_a_k_e_T_u_p_l_e_V_e_c_t_o_r (T &&... t) │ │ │ │ │ +Specialized classes and overloaded functions │ │ │ │ │ +template │ │ │ │ │ + V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 2 >, std::size_t, V v) │ │ │ │ │ +  implements _S_i_m_d_:_:_l_a_n_e_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + V &  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 3 >, std::size_t, V &v) │ │ │ │ │ +  │ │ │ │ │ +bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ +  implements _S_i_m_d_:_:_a_n_y_T_r_u_e_(_) │ │ │ │ │ +  │ │ │ │ │ +bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ +  implements _S_i_m_d_:_:_a_l_l_T_r_u_e_(_) │ │ │ │ │ +  │ │ │ │ │ +bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ +  implements _S_i_m_d_:_:_a_n_y_F_a_l_s_e_(_) │ │ │ │ │ +  │ │ │ │ │ +bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e (_A_D_L_T_a_g< 2 >, bool _m_a_s_k) │ │ │ │ │ +  implements _S_i_m_d_:_:_a_l_l_F_a_l_s_e_(_) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides the TupleVector class that augments std::tuple by operator[]. │ │ │ │ │ - Author │ │ │ │ │ - Carsten Gräser │ │ │ │ │ +SIMD abstractions for the standard built-in types. │ │ │ │ │ +This file should not normally be included by users of the SIMD abstraction │ │ │ │ │ +(i.e. other _D_u_n_e headers). Neither should it be included by the translation │ │ │ │ │ +units passing built-in types to _D_u_n_e headers that in turn support SIMD types │ │ │ │ │ +through the SIMD abstraction. Dune-functionality always supports built-in │ │ │ │ │ +types. Either because that functionality does not support SIMD types and so │ │ │ │ │ +only supports built-in types, or if it does support SIMD types it must include │ │ │ │ │ +<_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h>, which in turn includes this header. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00140_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: tuplevector.hh Source File │ │ │ │ +dune-common: standard.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,124 +70,102 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    tuplevector.hh
    │ │ │ │ +
    standard.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_TUPLEVECTOR_HH
    │ │ │ │ -
    6#define DUNE_COMMON_TUPLEVECTOR_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include <tuple>
    │ │ │ │ -
    9#include <utility>
    │ │ │ │ -
    10
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    14
    │ │ │ │ -
    15
    │ │ │ │ -
    16
    │ │ │ │ -
    23namespace Dune
    │ │ │ │ -
    24{
    │ │ │ │ -
    25
    │ │ │ │ -
    26
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_STANDARD_HH
    │ │ │ │ +
    4#define DUNE_COMMON_SIMD_STANDARD_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    20#include <cstddef>
    │ │ │ │ +
    21#include <type_traits>
    │ │ │ │ +
    22#include <utility>
    │ │ │ │ +
    23
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
    27
    │ │ │ │ -
    33template<class... T>
    │ │ │ │ -
    │ │ │ │ -
    34class TupleVector : public std::tuple<T...>
    │ │ │ │ -
    35{
    │ │ │ │ -
    36 using Base = std::tuple<T...>;
    │ │ │ │ -
    37
    │ │ │ │ -
    38 template<class... TT>
    │ │ │ │ -
    39 using TupleConstructorDetector = decltype(Base(std::declval<TT&&>()...));
    │ │ │ │ -
    40
    │ │ │ │ -
    41 template<class... TT>
    │ │ │ │ -
    42 using hasTupleConstructor = Dune::Std::is_detected<TupleConstructorDetector, TT...>;
    │ │ │ │ -
    43
    │ │ │ │ -
    44
    │ │ │ │ -
    45public:
    │ │ │ │ -
    46
    │ │ │ │ -
    53 template<class... TT,
    │ │ │ │ -
    54 std::enable_if_t<hasTupleConstructor<TT...>::value, int> = 0>
    │ │ │ │ -
    │ │ │ │ -
    55 constexpr TupleVector(TT&&... tt) :
    │ │ │ │ -
    56 Base(std::forward<TT>(tt)...)
    │ │ │ │ -
    57 {}
    │ │ │ │ -
    │ │ │ │ -
    58
    │ │ │ │ -
    │ │ │ │ -
    61 constexpr TupleVector()
    │ │ │ │ -
    62 {}
    │ │ │ │ -
    │ │ │ │ +
    45namespace Dune {
    │ │ │ │ +
    46 namespace Simd {
    │ │ │ │ +
    47
    │ │ │ │ +
    48 namespace Overloads {
    │ │ │ │ +
    49
    │ │ │ │ +
    56
    │ │ │ │ +
    59 template<class V, class>
    │ │ │ │ +
    60 struct ScalarType { using type = V; };
    │ │ │ │ +
    61
    │ │ │ │
    63
    │ │ │ │ -
    66 template<std::size_t i>
    │ │ │ │ -
    │ │ │ │ -
    67 constexpr decltype(auto) operator[](const Dune::index_constant<i>&) const
    │ │ │ │ -
    68 {
    │ │ │ │ -
    69 return std::get<i>(*this);
    │ │ │ │ -
    70 }
    │ │ │ │ -
    │ │ │ │ -
    71
    │ │ │ │ -
    74 template<std::size_t i>
    │ │ │ │ -
    │ │ │ │ -
    75 decltype(auto) operator[](const Dune::index_constant<i>&)
    │ │ │ │ -
    76 {
    │ │ │ │ -
    77 return std::get<i>(*this);
    │ │ │ │ -
    78 }
    │ │ │ │ -
    │ │ │ │ -
    79
    │ │ │ │ -
    │ │ │ │ -
    81 static constexpr std::size_t size()
    │ │ │ │ -
    82 {
    │ │ │ │ -
    83 return std::tuple_size<Base>::value;
    │ │ │ │ -
    84 }
    │ │ │ │ -
    │ │ │ │ -
    85};
    │ │ │ │ -
    │ │ │ │ -
    86
    │ │ │ │ -
    87
    │ │ │ │ -
    88
    │ │ │ │ -
    89template<class... T>
    │ │ │ │ -
    │ │ │ │ -
    90constexpr auto makeTupleVector(T&&... t)
    │ │ │ │ -
    91{
    │ │ │ │ -
    92 // The std::decay_t<T> is is a slight simplification,
    │ │ │ │ -
    93 // because std::reference_wrapper needs special care.
    │ │ │ │ -
    94 return TupleVector<std::decay_t<T>...>(std::forward<T>(t)...);
    │ │ │ │ -
    95}
    │ │ │ │ +
    66 template<class S, class, class>
    │ │ │ │ +
    67 struct RebindType { using type = S; };
    │ │ │ │ +
    68
    │ │ │ │ +
    70
    │ │ │ │ +
    73 template<class, class>
    │ │ │ │ +
    74 struct LaneCount : public index_constant<1> { };
    │ │ │ │ +
    75
    │ │ │ │ +
    77
    │ │ │ │ +
    86 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    87 V lane(ADLTag<2>, std::size_t, V v)
    │ │ │ │ +
    88 {
    │ │ │ │ +
    89 return v;
    │ │ │ │ +
    90 }
    │ │ │ │ +
    │ │ │ │ +
    91
    │ │ │ │ +
    92 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    93 V &lane(ADLTag<3>, std::size_t, V &v)
    │ │ │ │ +
    94 {
    │ │ │ │ +
    95 return v;
    │ │ │ │ +
    96 }
    │ │ │ │
    │ │ │ │ -
    96
    │ │ │ │
    97
    │ │ │ │ -
    98
    │ │ │ │ -
    99} // namespace Dune
    │ │ │ │ +
    98 // No Simd::cond() implementation, the overload for bool masks in the
    │ │ │ │ +
    99 // interface is sufficient
    │ │ │ │
    100
    │ │ │ │ -
    101#endif // DUNE_COMMON_TUPLEVECTOR_HH
    │ │ │ │ - │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ - │ │ │ │ +
    102 inline bool anyTrue(ADLTag<2>, bool mask) { return mask; }
    │ │ │ │ +
    103
    │ │ │ │ +
    105 inline bool allTrue(ADLTag<2>, bool mask) { return mask; }
    │ │ │ │ +
    106
    │ │ │ │ +
    108 inline bool anyFalse(ADLTag<2>, bool mask) { return !mask; }
    │ │ │ │ +
    109
    │ │ │ │ +
    111 inline bool allFalse(ADLTag<2>, bool mask) { return !mask; }
    │ │ │ │ +
    112
    │ │ │ │ +
    114
    │ │ │ │ +
    115 } // namespace Overloads
    │ │ │ │ +
    116 } // namespace Simd
    │ │ │ │ +
    117} // namespace Dune
    │ │ │ │ +
    118
    │ │ │ │ +
    119#endif // DUNE_COMMON_SIMD_STANDARD_HH
    │ │ │ │ + │ │ │ │ +
    Basic definitions for SIMD Implementations.
    │ │ │ │ +
    Default implementations for SIMD Implementations.
    │ │ │ │
    std::integral_constant< std::size_t, i > index_constant
    An index constant with value i.
    Definition indices.hh:30
    │ │ │ │ -
    typename detected_or< nonesuch, Op, Args... >::value_t is_detected
    Detects whether Op<Args...> is valid.
    Definition type_traits.hh:141
    │ │ │ │ -
    STL namespace.
    │ │ │ │ +
    Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
    implements Simd::mask()
    Definition defaults.hh:153
    │ │ │ │ +
    bool allFalse(ADLTag< 0 >, const Mask &mask)
    implements Simd::allFalse()
    Definition defaults.hh:124
    │ │ │ │ +
    bool allTrue(ADLTag< 0 >, const Mask &mask)
    implements Simd::allTrue()
    Definition defaults.hh:104
    │ │ │ │ +
    bool anyFalse(ADLTag< 0 >, const Mask &mask)
    implements Simd::anyFalse()
    Definition defaults.hh:114
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    constexpr auto makeTupleVector(T &&... t)
    Definition tuplevector.hh:90
    │ │ │ │ -
    A class augmenting std::tuple by element access via operator[].
    Definition tuplevector.hh:35
    │ │ │ │ -
    static constexpr std::size_t size()
    Number of elements of the tuple.
    Definition tuplevector.hh:81
    │ │ │ │ -
    constexpr TupleVector(TT &&... tt)
    Construct from a set of arguments.
    Definition tuplevector.hh:55
    │ │ │ │ -
    constexpr TupleVector()
    Default constructor.
    Definition tuplevector.hh:61
    │ │ │ │ +
    bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
    Definition debugalign.hh:543
    │ │ │ │ +
    T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
    Definition debugalign.hh:520
    │ │ │ │ +
    Tag used to force late-binding lookup in Dune::Simd::Overloads.
    Definition base.hh:182
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:60
    │ │ │ │ +
    V type
    Definition standard.hh:60
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:67
    │ │ │ │ +
    S type
    Definition standard.hh:67
    │ │ │ │ +
    should be derived from a Dune::index_constant
    Definition standard.hh:74
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,124 +1,124 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -tuplevector.hh │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +standard.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_TUPLEVECTOR_HH │ │ │ │ │ -6#define DUNE_COMMON_TUPLEVECTOR_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -12#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -13#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ -14 │ │ │ │ │ -15 │ │ │ │ │ -16 │ │ │ │ │ -23namespace _D_u_n_e │ │ │ │ │ -24{ │ │ │ │ │ -25 │ │ │ │ │ -26 │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_SIMD_STANDARD_HH │ │ │ │ │ +4#define DUNE_COMMON_SIMD_STANDARD_HH │ │ │ │ │ +5 │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22#include │ │ │ │ │ +23 │ │ │ │ │ +24#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +25#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ +26#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_d_e_f_a_u_l_t_s_._h_h> │ │ │ │ │ 27 │ │ │ │ │ -33template │ │ │ │ │ -_3_4class _T_u_p_l_e_V_e_c_t_o_r : public std::tuple │ │ │ │ │ -35{ │ │ │ │ │ -36 using Base = std::tuple; │ │ │ │ │ -37 │ │ │ │ │ -38 template │ │ │ │ │ -39 using TupleConstructorDetector = decltype(Base(std::declval()...)); │ │ │ │ │ -40 │ │ │ │ │ -41 template │ │ │ │ │ -42 using hasTupleConstructor = _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d; │ │ │ │ │ -43 │ │ │ │ │ -44 │ │ │ │ │ -45public: │ │ │ │ │ -46 │ │ │ │ │ -53 template::value, int> = 0> │ │ │ │ │ -_5_5 constexpr _T_u_p_l_e_V_e_c_t_o_r(TT&&... tt) : │ │ │ │ │ -56 Base(_s_t_d::forward(tt)...) │ │ │ │ │ -57 {} │ │ │ │ │ -58 │ │ │ │ │ -_6_1 constexpr _T_u_p_l_e_V_e_c_t_o_r() │ │ │ │ │ -62 {} │ │ │ │ │ +45namespace _D_u_n_e { │ │ │ │ │ +46 namespace Simd { │ │ │ │ │ +47 │ │ │ │ │ +48 namespace Overloads { │ │ │ │ │ +49 │ │ │ │ │ +56 │ │ │ │ │ +59 template │ │ │ │ │ +_6_0 struct _S_c_a_l_a_r_T_y_p_e { using _t_y_p_e = V; }; │ │ │ │ │ +61 │ │ │ │ │ 63 │ │ │ │ │ -66 template │ │ │ │ │ -_6_7 constexpr decltype(auto) operator[](const _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t_<_i_>&) const │ │ │ │ │ -68 { │ │ │ │ │ -69 return std::get(*this); │ │ │ │ │ -70 } │ │ │ │ │ -71 │ │ │ │ │ -74 template │ │ │ │ │ -_7_5 decltype(auto) operator[](const _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t_<_i_>&) │ │ │ │ │ -76 { │ │ │ │ │ -77 return std::get(*this); │ │ │ │ │ -78 } │ │ │ │ │ -79 │ │ │ │ │ -_8_1 static constexpr std::size_t _s_i_z_e() │ │ │ │ │ -82 { │ │ │ │ │ -83 return std::tuple_size::value; │ │ │ │ │ -84 } │ │ │ │ │ -85}; │ │ │ │ │ -86 │ │ │ │ │ -87 │ │ │ │ │ -88 │ │ │ │ │ -89template │ │ │ │ │ -_9_0constexpr auto _m_a_k_e_T_u_p_l_e_V_e_c_t_o_r(T&&... t) │ │ │ │ │ -91{ │ │ │ │ │ -92 // The std::decay_t is is a slight simplification, │ │ │ │ │ -93 // because std::reference_wrapper needs special care. │ │ │ │ │ -94 return _T_u_p_l_e_V_e_c_t_o_r_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>...>(std::forward(t)...); │ │ │ │ │ -95} │ │ │ │ │ -96 │ │ │ │ │ +66 template │ │ │ │ │ +_6_7 struct _R_e_b_i_n_d_T_y_p_e { using _t_y_p_e = S; }; │ │ │ │ │ +68 │ │ │ │ │ +70 │ │ │ │ │ +73 template │ │ │ │ │ +_7_4 struct _L_a_n_e_C_o_u_n_t : public _i_n_d_e_x___c_o_n_s_t_a_n_t<1> { }; │ │ │ │ │ +75 │ │ │ │ │ +77 │ │ │ │ │ +86 template │ │ │ │ │ +_8_7 V _l_a_n_e(_A_D_L_T_a_g_<_2_>, std::size_t, V v) │ │ │ │ │ +88 { │ │ │ │ │ +89 return v; │ │ │ │ │ +90 } │ │ │ │ │ +91 │ │ │ │ │ +92 template │ │ │ │ │ +_9_3 V &_l_a_n_e(_A_D_L_T_a_g_<_3_>, std::size_t, V &v) │ │ │ │ │ +94 { │ │ │ │ │ +95 return v; │ │ │ │ │ +96 } │ │ │ │ │ 97 │ │ │ │ │ -98 │ │ │ │ │ -99} // namespace Dune │ │ │ │ │ +98 // No Simd::cond() implementation, the overload for bool masks in the │ │ │ │ │ +99 // interface is sufficient │ │ │ │ │ 100 │ │ │ │ │ -101#endif // DUNE_COMMON_TUPLEVECTOR_HH │ │ │ │ │ -_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ +_1_0_2 inline bool _a_n_y_T_r_u_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return _m_a_s_k; } │ │ │ │ │ +103 │ │ │ │ │ +_1_0_5 inline bool _a_l_l_T_r_u_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return _m_a_s_k; } │ │ │ │ │ +106 │ │ │ │ │ +_1_0_8 inline bool _a_n_y_F_a_l_s_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return !_m_a_s_k; } │ │ │ │ │ +109 │ │ │ │ │ +_1_1_1 inline bool _a_l_l_F_a_l_s_e(_A_D_L_T_a_g_<_2_>, bool _m_a_s_k) { return !_m_a_s_k; } │ │ │ │ │ +112 │ │ │ │ │ +114 │ │ │ │ │ +115 } // namespace Overloads │ │ │ │ │ +116 } // namespace Simd │ │ │ │ │ +117} // namespace Dune │ │ │ │ │ +118 │ │ │ │ │ +119#endif // DUNE_COMMON_SIMD_STANDARD_HH │ │ │ │ │ _i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_b_a_s_e_._h_h │ │ │ │ │ +Basic definitions for SIMD Implementations. │ │ │ │ │ +_d_e_f_a_u_l_t_s_._h_h │ │ │ │ │ +Default implementations for SIMD Implementations. │ │ │ │ │ _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t │ │ │ │ │ std::integral_constant< std::size_t, i > index_constant │ │ │ │ │ An index constant with value i. │ │ │ │ │ DDeeffiinniittiioonn indices.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d │ │ │ │ │ -typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ -Detects whether Op is valid. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:141 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k │ │ │ │ │ +Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) │ │ │ │ │ +implements Simd::mask() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ +bool allFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::allFalse() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:124 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e │ │ │ │ │ +bool allTrue(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::allTrue() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ +bool anyFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::anyFalse() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:114 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_m_a_k_e_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ -constexpr auto makeTupleVector(T &&... t) │ │ │ │ │ -DDeeffiinniittiioonn tuplevector.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ -A class augmenting std::tuple by element access via operator[]. │ │ │ │ │ -DDeeffiinniittiioonn tuplevector.hh:35 │ │ │ │ │ -_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ -static constexpr std::size_t size() │ │ │ │ │ -Number of elements of the tuple. │ │ │ │ │ -DDeeffiinniittiioonn tuplevector.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r_:_:_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ -constexpr TupleVector(TT &&... tt) │ │ │ │ │ -Construct from a set of arguments. │ │ │ │ │ -DDeeffiinniittiioonn tuplevector.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r_:_:_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ -constexpr TupleVector() │ │ │ │ │ -Default constructor. │ │ │ │ │ -DDeeffiinniittiioonn tuplevector.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:543 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e │ │ │ │ │ +T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ +DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ +V type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ +S type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t │ │ │ │ │ +should be derived from a Dune::index_constant │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:74 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00143.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: dynmatrix.hh File Reference │ │ │ │ +dune-common: loop.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,57 +65,681 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces
    │ │ │ │ -
    dynmatrix.hh File Reference
    │ │ │ │ +Namespaces | │ │ │ │ +Macros | │ │ │ │ +Functions
    │ │ │ │ +
    loop.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ -More...

    │ │ │ │ -
    #include <cmath>
    │ │ │ │ +
    #include <array>
    │ │ │ │ +#include <cmath>
    │ │ │ │ #include <cstddef>
    │ │ │ │ -#include <iostream>
    │ │ │ │ -#include <initializer_list>
    │ │ │ │ -#include <dune/common/boundschecking.hh>
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -#include <dune/common/dynvector.hh>
    │ │ │ │ -#include <dune/common/densematrix.hh>
    │ │ │ │ -#include <dune/common/typetraits.hh>
    │ │ │ │ +#include <cstdlib>
    │ │ │ │ +#include <cstdint>
    │ │ │ │ +#include <ostream>
    │ │ │ │ +#include <dune/common/math.hh>
    │ │ │ │ +#include <dune/common/simd/simd.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::DenseMatVecTraits< DynamicMatrix< K > >
    class  Dune::LoopSIMD< T, S, A >
     
    struct  Dune::Simd::Overloads::ScalarType< LoopSIMD< T, S, A > >
     
    struct  Dune::Simd::Overloads::RebindType< U, LoopSIMD< T, S, A > >
     
    struct  Dune::FieldTraits< DynamicMatrix< K > >
    struct  Dune::Simd::Overloads::LaneCount< LoopSIMD< T, S, A > >
     
    class  Dune::DynamicMatrix< K >
     Construct a matrix with a dynamic size. More...
    struct  Dune::IsNumber< LoopSIMD< T, S, A > >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Simd
     Namespace for vectorization interface functions used by library developers.
     
    namespace  Dune::Simd::Overloads
     Namespace for the overloads and specializations that make up a SIMD implementation.
     
    namespace  Dune::MathOverloads
     namespace for customization of math functions with Dune-Semantics
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ +Macros

    #define DUNE_PRAGMA_OMP_SIMD
     
    #define DUNE_SIMD_LOOP_PREFIX_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_UNARY_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_POSTFIX_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_BINARY_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_BITSHIFT_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_COMPARISON_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL)
     
    #define DUNE_SIMD_LOOP_CMATH_UNARY_OP(expr)
     
    #define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN(expr, returnType)
     
    #define DUNE_SIMD_LOOP_STD_UNARY_OP(expr)
     
    #define DUNE_SIMD_LOOP_STD_BINARY_OP(expr)
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Functions

     Dune::DUNE_SIMD_LOOP_BINARY_OP (+)
     
     Dune::DUNE_SIMD_LOOP_BINARY_OP (-)
     
    DUNE_SIMD_LOOP_BINARY_OP * Dune::DUNE_SIMD_LOOP_BINARY_OP (/);DUNE_SIMD_LOOP_BINARY_OP(%
     
    DUNE_SIMD_LOOP_BINARY_OP & Dune::DUNE_SIMD_LOOP_BINARY_OP (|);DUNE_SIMD_LOOP_BINARY_OP(^
     
     Dune::DUNE_SIMD_LOOP_BITSHIFT_OP (<<)
     
     Dune::DUNE_SIMD_LOOP_BITSHIFT_OP (> >)
     
     Dune::DUNE_SIMD_LOOP_COMPARISON_OP (<)
     
     Dune::DUNE_SIMD_LOOP_COMPARISON_OP (<=)
     
     Dune::DUNE_SIMD_LOOP_COMPARISON_OP (>=)
     
     Dune::DUNE_SIMD_LOOP_COMPARISON_OP (!=)
     
    DUNE_SIMD_LOOP_BOOLEAN_OP && Dune::DUNE_SIMD_LOOP_BOOLEAN_OP (||);template< class T, std::size_t S, std::size_t A > std::ostream &operator<<(std::ostream &os, const LoopSIMD< T, S, A > &v
     
    template<class T , std::size_t S, std::size_t A>
    auto Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, LoopSIMD< T, S, A > &&v) -> decltype(std::move(Simd::lane(l%lanes< T >(), v[l/lanes< T >()])))
     
    template<class T , std::size_t S, std::size_t A>
    auto Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, const LoopSIMD< T, S, A > &v) -> decltype(Simd::lane(l%lanes< T >(), v[l/lanes< T >()]))
     
    template<class T , std::size_t S, std::size_t A>
    auto Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, LoopSIMD< T, S, A > &v) -> decltype(Simd::lane(l%lanes< T >(), v[l/lanes< T >()]))
     
    template<class T , std::size_t S, std::size_t AM, std::size_t AD>
    auto Dune::Simd::Overloads::cond (ADLTag< 5 >, Simd::Mask< LoopSIMD< T, S, AM > > mask, LoopSIMD< T, S, AD > ifTrue, LoopSIMD< T, S, AD > ifFalse)
     
    template<class M , class T , std::size_t S, std::size_t A>
    auto Dune::Simd::Overloads::cond (ADLTag< 5, std::is_same< bool, Simd::Scalar< M > >::value &&Simd::lanes< M >()==Simd::lanes< LoopSIMD< T, S, A > >()>, M mask, LoopSIMD< T, S, A > ifTrue, LoopSIMD< T, S, A > ifFalse)
     
    template<class M , std::size_t S, std::size_t A>
    bool Dune::Simd::Overloads::anyTrue (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
     
    template<class M , std::size_t S, std::size_t A>
    bool Dune::Simd::Overloads::allTrue (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
     
    template<class M , std::size_t S, std::size_t A>
    bool Dune::Simd::Overloads::anyFalse (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
     
    template<class M , std::size_t S, std::size_t A>
    bool Dune::Simd::Overloads::allFalse (ADLTag< 5 >, LoopSIMD< M, S, A > mask)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cos)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sin)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tan)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (acos)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (asin)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (atan)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cosh)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sinh)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tanh)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (acosh)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (asinh)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (atanh)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (exp)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log10)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (exp2)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (expm1)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (ilogb, int)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log1p)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log2)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (logb)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sqrt)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cbrt)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (erf)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (erfc)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tgamma)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (lgamma)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (ceil)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (floor)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (trunc)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (round)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (lround, long)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (llround, long long)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (rint)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (lrint, long)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (llrint, long long)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (nearbyint)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (fabs)
     
     Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (abs)
     
     Dune::DUNE_SIMD_LOOP_STD_UNARY_OP (real)
     
     Dune::DUNE_SIMD_LOOP_STD_UNARY_OP (imag)
     
     Dune::DUNE_SIMD_LOOP_STD_BINARY_OP (max)
     
     Dune::DUNE_SIMD_LOOP_STD_BINARY_OP (min)
     
    template<class T , std::size_t S, std::size_t A>
    auto Dune::MathOverloads::isNaN (const LoopSIMD< T, S, A > &v, PriorityTag< 3 >, ADLTag)
     
    template<class T , std::size_t S, std::size_t A>
    auto Dune::MathOverloads::isInf (const LoopSIMD< T, S, A > &v, PriorityTag< 3 >, ADLTag)
     
    template<class T , std::size_t S, std::size_t A>
    auto Dune::MathOverloads::isFinite (const LoopSIMD< T, S, A > &v, PriorityTag< 3 >, ADLTag)
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    This file implements a dense matrix with dynamic numbers of rows and columns.

    │ │ │ │ -
    │ │ │ │ +

    Macro Definition Documentation

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_PRAGMA_OMP_SIMD

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_PRAGMA_OMP_SIMD
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_ASSIGNMENT_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_ASSIGNMENT_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    auto operator SYMBOL(const Simd::Scalar<T> s) { \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    (*this)[i] SYMBOL s; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return *this; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    (*this)[i] SYMBOL v[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return *this; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_BINARY_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_BINARY_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = s SYMBOL v[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_BITSHIFT_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_BITSHIFT_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A, class U> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A, class U, std::size_t AU> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    const LoopSIMD<U,S,AU> &w) { \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_BOOLEAN_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_BOOLEAN_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
    │ │ │ │ +
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const Simd::Mask<T> s, const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = s SYMBOL v[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_CMATH_UNARY_OP( expr)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A, typename Sfinae = \
    │ │ │ │ +
    typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
    │ │ │ │ +
    auto expr(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    using std::expr; \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    out[i] = expr(v[i]); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN( expr,
     returnType 
    )
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A, typename Sfinae = \
    │ │ │ │ +
    typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
    │ │ │ │ +
    auto expr(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    using std::expr; \
    │ │ │ │ +
    LoopSIMD<returnType,S> out; \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    out[i] = expr(v[i]); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_COMPARISON_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_COMPARISON_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A, class U> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
    │ │ │ │ +
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = s SYMBOL v[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_POSTFIX_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_POSTFIX_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    auto operator SYMBOL(int){ \
    │ │ │ │ +
    LoopSIMD<T,S,A> out = *this; \
    │ │ │ │ +
    SYMBOL(*this); \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_PREFIX_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_PREFIX_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    auto operator SYMBOL() { \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    SYMBOL(*this)[i]; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return *this; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_STD_BINARY_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_STD_BINARY_OP( expr)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto expr(const LoopSIMD<T,S,A> &v, const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    using std::expr; \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    out[i] = expr(v[i],w[i]); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_STD_UNARY_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_STD_UNARY_OP( expr)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto expr(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    using std::expr; \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    out[i] = expr(v[i]); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    \
    │ │ │ │ +
    template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    auto expr(const LoopSIMD<std::complex<T>,S,A> &v) { \
    │ │ │ │ +
    using std::expr; \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    out[i] = expr(v[i]); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_LOOP_UNARY_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_LOOP_UNARY_OP( SYMBOL)
    │ │ │ │ +
    │ │ │ │ +Value:
    auto operator SYMBOL() const { \
    │ │ │ │ +
    LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    out[i] = SYMBOL((*this)[i]); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    return out; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +1,489 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -dynmatrix.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ -This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ │ -_M_o_r_e_._._. │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +_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 │ │ │ │ │ +loop.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_y_n_v_e_c_t_o_r_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ #include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_<_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _> │ │ │ │ │ -  Construct a matrix with a dynamic size. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e_<_ _U_,_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t_<_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_N_u_m_b_e_r_<_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ +  Namespace for vectorization interface functions used by library │ │ │ │ │ + developers. │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ +  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ + implementation. │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s │ │ │ │ │ +  namespace for customization of math functions with Dune-Semantics │ │ │ │ │ +  │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___P_R_A_G_M_A___O_M_P___S_I_M_D │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___P_R_E_F_I_X___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___U_N_A_R_Y___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___P_O_S_T_F_I_X___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___B_I_T_S_H_I_F_T___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___B_O_O_L_E_A_N___O_P(SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P(expr) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N(expr, returnType) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___U_N_A_R_Y___O_P(expr) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___B_I_N_A_R_Y___O_P(expr) │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P (+) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P (-) │ │ │ │ │ +  │ │ │ │ │ + DUNE_SIMD_LOOP_BINARY_OP *  _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P (/ │ │ │ │ │ + );DUNE_SIMD_LOOP_BINARY_OP(% │ │ │ │ │ +  │ │ │ │ │ + DUNE_SIMD_LOOP_BINARY_OP &  _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P │ │ │ │ │ + (|);DUNE_SIMD_LOOP_BINARY_OP(^ │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_T_S_H_I_F_T___O_P (<<) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_I_T_S_H_I_F_T___O_P (> >) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (<) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (<=) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (>=) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P (!=) │ │ │ │ │ +  │ │ │ │ │ +DUNE_SIMD_LOOP_BOOLEAN_OP &&  _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___B_O_O_L_E_A_N___O_P (||);template< │ │ │ │ │ + class T, std::size_t S, std::size_t A > std:: │ │ │ │ │ + ostream &operator<<(std::ostream &os, const │ │ │ │ │ + _L_o_o_p_S_I_M_D< T, S, A > &v │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, std:: │ │ │ │ │ + size_t l, _L_o_o_p_S_I_M_D< T, S, A > &&v) -> decltype │ │ │ │ │ + (std::move(Simd::lane(l%_l_a_n_e_s< T >(), v[l/_l_a_n_e_s< │ │ │ │ │ + T >()]))) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, std:: │ │ │ │ │ + size_t l, const _L_o_o_p_S_I_M_D< T, S, A > &v) - │ │ │ │ │ + > decltype(Simd::lane(l%_l_a_n_e_s< T >(), v[l/_l_a_n_e_s< │ │ │ │ │ + T >()])) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, std:: │ │ │ │ │ + size_t l, _L_o_o_p_S_I_M_D< T, S, A > &v) -> decltype │ │ │ │ │ + (Simd::lane(l%_l_a_n_e_s< T >(), v[l/_l_a_n_e_s< T >()])) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d (_A_D_L_T_a_g< 5 >, _S_i_m_d_:_: │ │ │ │ │ + _M_a_s_k< _L_o_o_p_S_I_M_D< T, S, AM > > _m_a_s_k, _L_o_o_p_S_I_M_D< T, │ │ │ │ │ + S, AD > ifTrue, _L_o_o_p_S_I_M_D< T, S, AD > ifFalse) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d (_A_D_L_T_a_g< 5, std:: │ │ │ │ │ + is_same< bool, _S_i_m_d_:_:_S_c_a_l_a_r< M > >::value │ │ │ │ │ + &&_S_i_m_d_:_:_l_a_n_e_s< M >()==_S_i_m_d_:_:_l_a_n_e_s< _L_o_o_p_S_I_M_D< T, │ │ │ │ │ + S, A > >()>, M _m_a_s_k, _L_o_o_p_S_I_M_D< T, S, A > ifTrue, │ │ │ │ │ + _L_o_o_p_S_I_M_D< T, S, A > ifFalse) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + _L_o_o_p_S_I_M_D< M, S, A > _m_a_s_k) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (cos) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (sin) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (tan) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (acos) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (asin) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (atan) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (cosh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (sinh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (tanh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (acosh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (asinh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (atanh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (exp) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log10) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (exp2) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (expm1) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ + (ilogb, int) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log1p) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (log2) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (logb) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (sqrt) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (cbrt) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (erf) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (erfc) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (tgamma) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (lgamma) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (ceil) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (floor) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (trunc) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (round) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ + (lround, long) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ + (llround, long long) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (rint) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ + (lrint, long) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ + (llrint, long long) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (nearbyint) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (fabs) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P (abs) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___U_N_A_R_Y___O_P (real) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___U_N_A_R_Y___O_P (imag) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___B_I_N_A_R_Y___O_P (max) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___B_I_N_A_R_Y___O_P (min) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N (const _L_o_o_p_S_I_M_D< T, S, │ │ │ │ │ + A > &v, _P_r_i_o_r_i_t_y_T_a_g< 3 >, _A_D_L_T_a_g) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f (const _L_o_o_p_S_I_M_D< T, S, │ │ │ │ │ + A > &v, _P_r_i_o_r_i_t_y_T_a_g< 3 >, _A_D_L_T_a_g) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e (const _L_o_o_p_S_I_M_D< T, │ │ │ │ │ + S, A > &v, _P_r_i_o_r_i_t_y_T_a_g< 3 >, _A_D_L_T_a_g) │ │ │ │ │ +  │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__PPRRAAGGMMAA__OOMMPP__SSIIMMDD ********** │ │ │ │ │ +#define DUNE_PRAGMA_OMP_SIMD │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__LLOOOOPP__AASSSSIIGGNNMMEENNTT__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_LOOP_ASSIGNMENT_OP (   SYMBOL ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +auto operator SYMBOL(const Simd::Scalar s) { \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i &v) { \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, const Simd::Scalar s) { \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const Simd::Scalar s, const LoopSIMD &v) { \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +const LoopSIMD &w) { \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, const U s) { \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +const LoopSIMD &w) { \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, const Simd::Scalar s) { \ │ │ │ │ │ +Simd::Mask> out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const Simd::Mask s, const LoopSIMD &v) { \ │ │ │ │ │ +Simd::Mask> out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +const LoopSIMD &w) { \ │ │ │ │ │ +Simd::Mask> out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i>::value> > \ │ │ │ │ │ +auto expr(const LoopSIMD &v) { \ │ │ │ │ │ +using std::expr; \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +for(std::size_t i=0; i>::value> > \ │ │ │ │ │ +auto expr(const LoopSIMD &v) { \ │ │ │ │ │ +using std::expr; \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, const U s) { \ │ │ │ │ │ +Simd::Mask> out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const Simd::Scalar s, const LoopSIMD &v) { \ │ │ │ │ │ +Simd::Mask> out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +const LoopSIMD &w) { \ │ │ │ │ │ +Simd::Mask> out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i out = *this; \ │ │ │ │ │ +SYMBOL(*this); \ │ │ │ │ │ +return out; \ │ │ │ │ │ +} \ │ │ │ │ │ +static_assert(true, "expecting ;") │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__LLOOOOPP__PPRREEFFIIXX__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_LOOP_PREFIX_OP (   SYMBOL ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +auto operator SYMBOL() { \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto expr(const LoopSIMD &v, const LoopSIMD &w) { \ │ │ │ │ │ +using std::expr; \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto expr(const LoopSIMD &v) { \ │ │ │ │ │ +using std::expr; \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +for(std::size_t i=0; i \ │ │ │ │ │ +auto expr(const LoopSIMD,S,A> &v) { \ │ │ │ │ │ +using std::expr; \ │ │ │ │ │ +LoopSIMD out; \ │ │ │ │ │ +for(std::size_t i=0; i out; \ │ │ │ │ │ +DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +for(std::size_t i=0; i │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: dynmatrix.hh Source File │ │ │ │ +dune-common: loop.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,219 +70,766 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    dynmatrix.hh
    │ │ │ │ +
    loop.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_DYNMATRIX_HH
    │ │ │ │ -
    6#define DUNE_DYNMATRIX_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include <cmath>
    │ │ │ │ -
    9#include <cstddef>
    │ │ │ │ -
    10#include <iostream>
    │ │ │ │ -
    11#include <initializer_list>
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_LOOP_HH
    │ │ │ │ +
    4#define DUNE_COMMON_SIMD_LOOP_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    6#include <array>
    │ │ │ │ +
    7#include <cmath>
    │ │ │ │ +
    8#include <cstddef>
    │ │ │ │ +
    9#include <cstdlib>
    │ │ │ │ +
    10#include <cstdint>
    │ │ │ │ +
    11#include <ostream>
    │ │ │ │
    12
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
    13#include <dune/common/math.hh>
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    16
    │ │ │ │ +
    17namespace Dune {
    │ │ │ │
    18
    │ │ │ │ -
    19namespace Dune
    │ │ │ │ -
    20{
    │ │ │ │ -
    21
    │ │ │ │ -
    31 template< class K > class DynamicMatrix;
    │ │ │ │ -
    32
    │ │ │ │ -
    33 template< class K >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    35 {
    │ │ │ │ - │ │ │ │ -
    37
    │ │ │ │ - │ │ │ │ -
    39
    │ │ │ │ - │ │ │ │ - │ │ │ │ +
    19
    │ │ │ │ +
    20/*
    │ │ │ │ +
    21 * silence warnings from GCC about using integer operands on a bool
    │ │ │ │ +
    22 * (when instantiated for T=bool)
    │ │ │ │ +
    23 */
    │ │ │ │ +
    24#if __GNUC__ >= 7
    │ │ │ │ +
    25# pragma GCC diagnostic push
    │ │ │ │ +
    26# pragma GCC diagnostic ignored "-Wbool-operation"
    │ │ │ │ +
    27# pragma GCC diagnostic ignored "-Wint-in-bool-context"
    │ │ │ │ +
    28# define GCC_WARNING_DISABLED
    │ │ │ │ +
    29#endif
    │ │ │ │ +
    30
    │ │ │ │ +
    31/*
    │ │ │ │ +
    32 * silence warnings from Clang about using bitwise operands on
    │ │ │ │ +
    33 * a bool (when instantiated for T=bool)
    │ │ │ │ +
    34 */
    │ │ │ │ +
    35#ifdef __clang__
    │ │ │ │ +
    36#if __has_warning("-Wbitwise-instead-of-logical")
    │ │ │ │ +
    37# pragma clang diagnostic push
    │ │ │ │ +
    38# pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
    │ │ │ │ +
    39# define CLANG_WARNING_DISABLED
    │ │ │ │ +
    40#endif
    │ │ │ │ +
    41#endif
    │ │ │ │
    42
    │ │ │ │ -
    43 typedef std::vector<K> container_type;
    │ │ │ │ -
    44 typedef K value_type;
    │ │ │ │ -
    45 typedef typename container_type::size_type size_type;
    │ │ │ │ -
    46 };
    │ │ │ │ -
    │ │ │ │ -
    47
    │ │ │ │ -
    48 template< class K >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    50 {
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    53 };
    │ │ │ │ -
    │ │ │ │ -
    54
    │ │ │ │ -
    59 template<class K>
    │ │ │ │ -
    │ │ │ │ -
    60 class DynamicMatrix : public DenseMatrix< DynamicMatrix<K> >
    │ │ │ │ -
    61 {
    │ │ │ │ -
    62 std::vector< DynamicVector<K> > _data;
    │ │ │ │ - │ │ │ │ -
    64 public:
    │ │ │ │ -
    65 typedef typename Base::size_type size_type;
    │ │ │ │ -
    66 typedef typename Base::value_type value_type;
    │ │ │ │ -
    67 typedef typename Base::row_type row_type;
    │ │ │ │ +
    43/*
    │ │ │ │ +
    44 * Introduce a simd pragma if OpenMP is available in standard version >= 4
    │ │ │ │ +
    45 */
    │ │ │ │ +
    46#if _OPENMP >= 201307
    │ │ │ │ +
    47 #define DUNE_PRAGMA_OMP_SIMD _Pragma("omp simd")
    │ │ │ │ +
    48#else
    │ │ │ │ +
    49 #define DUNE_PRAGMA_OMP_SIMD
    │ │ │ │ +
    50#endif
    │ │ │ │ +
    51
    │ │ │ │ +
    52
    │ │ │ │ +
    64 template<class T, std::size_t S, std::size_t A = 0>
    │ │ │ │ +
    │ │ │ │ +
    65 class alignas(A==0?alignof(T):A) LoopSIMD : public std::array<T,S> {
    │ │ │ │ +
    66
    │ │ │ │ +
    67 public:
    │ │ │ │
    68
    │ │ │ │ -
    69 //===== constructors
    │ │ │ │ - │ │ │ │ -
    72
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    75 _data(r, row_type(c, v) )
    │ │ │ │ -
    76 {}
    │ │ │ │ +
    69 //default constructor
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    71 assert(reinterpret_cast<uintptr_t>(this) % std::min(alignof(LoopSIMD<T,S,A>),alignof(std::max_align_t)) == 0);
    │ │ │ │ +
    72 }
    │ │ │ │ +
    │ │ │ │ +
    73
    │ │ │ │ +
    74 // broadcast constructor initializing the content with a given value
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    76 this->fill(i);
    │ │ │ │ +
    77 }
    │ │ │ │
    │ │ │ │ -
    77
    │ │ │ │ +
    78
    │ │ │ │ +
    79 template<std::size_t OA>
    │ │ │ │
    │ │ │ │ -
    80 DynamicMatrix (std::initializer_list<DynamicVector<K>> const &ll)
    │ │ │ │ -
    81 : _data(ll)
    │ │ │ │ -
    82 {}
    │ │ │ │ -
    │ │ │ │ -
    83
    │ │ │ │ -
    84
    │ │ │ │ -
    85 template <class T,
    │ │ │ │ -
    86 typename = std::enable_if_t<!Dune::IsNumber<T>::value && HasDenseMatrixAssigner<DynamicMatrix, T>::value>>
    │ │ │ │ -
    │ │ │ │ -
    87 DynamicMatrix(T const& rhs)
    │ │ │ │ -
    88 {
    │ │ │ │ -
    89 *this = rhs;
    │ │ │ │ -
    90 }
    │ │ │ │ -
    │ │ │ │ -
    91
    │ │ │ │ -
    92 //==== resize related methods
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    107 {
    │ │ │ │ -
    108 _data.resize(0);
    │ │ │ │ -
    109 _data.resize(r, row_type(c, v) );
    │ │ │ │ -
    110 }
    │ │ │ │ -
    │ │ │ │ -
    111
    │ │ │ │ -
    112 //===== assignment
    │ │ │ │ -
    113 // General assignment with resizing
    │ │ │ │ -
    114 template <typename T,
    │ │ │ │ -
    115 typename = std::enable_if_t<!Dune::IsNumber<T>::value>>
    │ │ │ │ -
    │ │ │ │ -
    116 DynamicMatrix& operator=(T const& rhs) {
    │ │ │ │ -
    117 _data.resize(rhs.N());
    │ │ │ │ -
    118 std::fill(_data.begin(), _data.end(), row_type(rhs.M(), K(0)));
    │ │ │ │ -
    119 Base::operator=(rhs);
    │ │ │ │ -
    120 return *this;
    │ │ │ │ -
    121 }
    │ │ │ │ -
    │ │ │ │ -
    122
    │ │ │ │ -
    123 // Specialisation: scalar assignment (no resizing)
    │ │ │ │ -
    124 template <typename T,
    │ │ │ │ -
    125 typename = std::enable_if_t<Dune::IsNumber<T>::value>>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    127 std::fill(_data.begin(), _data.end(), scalar);
    │ │ │ │ -
    128 return *this;
    │ │ │ │ -
    129 }
    │ │ │ │ +
    80 explicit LoopSIMD(const LoopSIMD<T,S,OA>& other)
    │ │ │ │ +
    81 : std::array<T,S>(other)
    │ │ │ │ +
    82 {
    │ │ │ │ +
    83 assert(reinterpret_cast<uintptr_t>(this) % std::min(alignof(LoopSIMD<T,S,A>),alignof(std::max_align_t)) == 0);
    │ │ │ │ +
    84 }
    │ │ │ │ +
    │ │ │ │ +
    85
    │ │ │ │ +
    86 /*
    │ │ │ │ +
    87 * Definition of basic operators
    │ │ │ │ +
    88 */
    │ │ │ │ +
    89
    │ │ │ │ +
    90 //Prefix operators
    │ │ │ │ +
    │ │ │ │ +
    91#define DUNE_SIMD_LOOP_PREFIX_OP(SYMBOL) \
    │ │ │ │ +
    92 auto operator SYMBOL() { \
    │ │ │ │ +
    93 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    94 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    95 SYMBOL(*this)[i]; \
    │ │ │ │ +
    96 } \
    │ │ │ │ +
    97 return *this; \
    │ │ │ │ +
    98 } \
    │ │ │ │ +
    99 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    100
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    103#undef DUNE_SIMD_LOOP_PREFIX_OP
    │ │ │ │ +
    104
    │ │ │ │ +
    105 //Unary operators
    │ │ │ │ +
    │ │ │ │ +
    106#define DUNE_SIMD_LOOP_UNARY_OP(SYMBOL) \
    │ │ │ │ +
    107 auto operator SYMBOL() const { \
    │ │ │ │ +
    108 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    109 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    110 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    111 out[i] = SYMBOL((*this)[i]); \
    │ │ │ │ +
    112 } \
    │ │ │ │ +
    113 return out; \
    │ │ │ │ +
    114 } \
    │ │ │ │ +
    115 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    116
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    120
    │ │ │ │ +
    │ │ │ │ +
    121 auto operator!() const {
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    124 for(std::size_t i=0; i<S; i++){
    │ │ │ │ +
    125 out[i] = !((*this)[i]);
    │ │ │ │ +
    126 }
    │ │ │ │ +
    127 return out;
    │ │ │ │ +
    128 }
    │ │ │ │
    │ │ │ │ +
    129#undef DUNE_SIMD_LOOP_UNARY_OP
    │ │ │ │
    130
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    133 {
    │ │ │ │ -
    134 DynamicMatrix AT(this->M(), this->N());
    │ │ │ │ -
    135 for( size_type i = 0; i < this->N(); ++i )
    │ │ │ │ -
    136 for( size_type j = 0; j < this->M(); ++j )
    │ │ │ │ -
    137 AT[j][i] = (*this)[i][j];
    │ │ │ │ -
    138 return AT;
    │ │ │ │ -
    139 }
    │ │ │ │ -
    │ │ │ │ -
    140
    │ │ │ │ -
    141 // make this thing a matrix
    │ │ │ │ -
    142 size_type mat_rows() const { return _data.size(); }
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    144 assert(this->rows());
    │ │ │ │ -
    145 return _data.front().size();
    │ │ │ │ -
    146 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    148 DUNE_ASSERT_BOUNDS(i < _data.size());
    │ │ │ │ -
    149 return _data[i];
    │ │ │ │ -
    150 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    151 const row_type & mat_access(size_type i) const {
    │ │ │ │ -
    152 DUNE_ASSERT_BOUNDS(i < _data.size());
    │ │ │ │ -
    153 return _data[i];
    │ │ │ │ -
    154 }
    │ │ │ │ -
    │ │ │ │ -
    155 };
    │ │ │ │ -
    │ │ │ │ -
    156
    │ │ │ │ -
    159} // end namespace
    │ │ │ │ -
    160
    │ │ │ │ -
    161#endif
    │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ -
    Macro for wrapping boundary checks.
    │ │ │ │ -
    Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
    │ │ │ │ -
    This file implements a dense vector with a dynamic size.
    │ │ │ │ -
    A few common exception classes.
    │ │ │ │ -
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition boundschecking.hh:30
    │ │ │ │ +
    131 //Postfix operators
    │ │ │ │ +
    │ │ │ │ +
    132#define DUNE_SIMD_LOOP_POSTFIX_OP(SYMBOL) \
    │ │ │ │ +
    133 auto operator SYMBOL(int){ \
    │ │ │ │ +
    134 LoopSIMD<T,S,A> out = *this; \
    │ │ │ │ +
    135 SYMBOL(*this); \
    │ │ │ │ +
    136 return out; \
    │ │ │ │ +
    137 } \
    │ │ │ │ +
    138 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    139
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    142#undef DUNE_SIMD_LOOP_POSTFIX_OP
    │ │ │ │ +
    143
    │ │ │ │ +
    144 //Assignment operators
    │ │ │ │ +
    │ │ │ │ +
    145#define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL) \
    │ │ │ │ +
    146 auto operator SYMBOL(const Simd::Scalar<T> s) { \
    │ │ │ │ +
    147 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    148 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    149 (*this)[i] SYMBOL s; \
    │ │ │ │ +
    150 } \
    │ │ │ │ +
    151 return *this; \
    │ │ │ │ +
    152 } \
    │ │ │ │ +
    153 \
    │ │ │ │ +
    154 auto operator SYMBOL(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    155 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    156 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    157 (*this)[i] SYMBOL v[i]; \
    │ │ │ │ +
    158 } \
    │ │ │ │ +
    159 return *this; \
    │ │ │ │ +
    160 } \
    │ │ │ │ +
    161 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    162
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    173#undef DUNE_SIMD_LOOP_ASSIGNMENT_OP
    │ │ │ │ +
    174 };
    │ │ │ │ +
    │ │ │ │ +
    175
    │ │ │ │ +
    176 //Arithmetic operators
    │ │ │ │ +
    │ │ │ │ +
    177#define DUNE_SIMD_LOOP_BINARY_OP(SYMBOL) \
    │ │ │ │ +
    178 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    179 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
    │ │ │ │ +
    180 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    181 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    182 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    183 out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    184 } \
    │ │ │ │ +
    185 return out; \
    │ │ │ │ +
    186 } \
    │ │ │ │ +
    187 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    188 auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    189 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    190 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    191 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    192 out[i] = s SYMBOL v[i]; \
    │ │ │ │ +
    193 } \
    │ │ │ │ +
    194 return out; \
    │ │ │ │ +
    195 } \
    │ │ │ │ +
    196 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    197 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    198 const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    199 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    200 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    201 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    202 out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    203 } \
    │ │ │ │ +
    204 return out; \
    │ │ │ │ +
    205 } \
    │ │ │ │ +
    206 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    207
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    213
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    217
    │ │ │ │ +
    218#undef DUNE_SIMD_LOOP_BINARY_OP
    │ │ │ │ +
    219
    │ │ │ │ +
    220 //Bitshift operators
    │ │ │ │ +
    │ │ │ │ +
    221#define DUNE_SIMD_LOOP_BITSHIFT_OP(SYMBOL) \
    │ │ │ │ +
    222 template<class T, std::size_t S, std::size_t A, class U> \
    │ │ │ │ +
    223 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
    │ │ │ │ +
    224 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    225 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    226 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    227 out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    228 } \
    │ │ │ │ +
    229 return out; \
    │ │ │ │ +
    230 } \
    │ │ │ │ +
    231 template<class T, std::size_t S, std::size_t A, class U, std::size_t AU> \
    │ │ │ │ +
    232 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    233 const LoopSIMD<U,S,AU> &w) { \
    │ │ │ │ +
    234 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    235 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    236 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    237 out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    238 } \
    │ │ │ │ +
    239 return out; \
    │ │ │ │ +
    240 } \
    │ │ │ │ +
    241 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    242
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    245
    │ │ │ │ +
    246#undef DUNE_SIMD_LOOP_BITSHIFT_OP
    │ │ │ │ +
    247
    │ │ │ │ +
    248 //Comparison operators
    │ │ │ │ +
    │ │ │ │ +
    249#define DUNE_SIMD_LOOP_COMPARISON_OP(SYMBOL) \
    │ │ │ │ +
    250 template<class T, std::size_t S, std::size_t A, class U> \
    │ │ │ │ +
    251 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
    │ │ │ │ +
    252 Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    253 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    254 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    255 out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    256 } \
    │ │ │ │ +
    257 return out; \
    │ │ │ │ +
    258 } \
    │ │ │ │ +
    259 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    260 auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    261 Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    262 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    263 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    264 out[i] = s SYMBOL v[i]; \
    │ │ │ │ +
    265 } \
    │ │ │ │ +
    266 return out; \
    │ │ │ │ +
    267 } \
    │ │ │ │ +
    268 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    269 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    270 const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    271 Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    272 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    273 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    274 out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    275 } \
    │ │ │ │ +
    276 return out; \
    │ │ │ │ +
    277 } \
    │ │ │ │ +
    278 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    279
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    286#undef DUNE_SIMD_LOOP_COMPARISON_OP
    │ │ │ │ +
    287
    │ │ │ │ +
    288 //Boolean operators
    │ │ │ │ +
    │ │ │ │ +
    289#define DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL) \
    │ │ │ │ +
    290 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    291 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
    │ │ │ │ +
    292 Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    293 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    294 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    295 out[i] = v[i] SYMBOL s; \
    │ │ │ │ +
    296 } \
    │ │ │ │ +
    297 return out; \
    │ │ │ │ +
    298 } \
    │ │ │ │ +
    299 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    300 auto operator SYMBOL(const Simd::Mask<T> s, const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    301 Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    302 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    303 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    304 out[i] = s SYMBOL v[i]; \
    │ │ │ │ +
    305 } \
    │ │ │ │ +
    306 return out; \
    │ │ │ │ +
    307 } \
    │ │ │ │ +
    308 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    309 auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    │ │ │ │ +
    310 const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    311 Simd::Mask<LoopSIMD<T,S,A>> out; \
    │ │ │ │ +
    312 DUNE_PRAGMA_OMP_SIMD \
    │ │ │ │ +
    313 for(std::size_t i=0; i<S; i++){ \
    │ │ │ │ +
    314 out[i] = v[i] SYMBOL w[i]; \
    │ │ │ │ +
    315 } \
    │ │ │ │ +
    316 return out; \
    │ │ │ │ +
    317 } \
    │ │ │ │ +
    318 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    319
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    322#undef DUNE_SIMD_LOOP_BOOLEAN_OP
    │ │ │ │ +
    323
    │ │ │ │ +
    324 //prints a given LoopSIMD
    │ │ │ │ +
    325 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    326 std::ostream& operator<< (std::ostream &os, const LoopSIMD<T,S,A> &v) {
    │ │ │ │ +
    327 os << "[";
    │ │ │ │ +
    328 for(std::size_t i=0; i<S-1; i++) {
    │ │ │ │ +
    329 os << v[i] << ", ";
    │ │ │ │ +
    330 }
    │ │ │ │ +
    331 os << v[S-1] << "]";
    │ │ │ │ +
    332 return os;
    │ │ │ │ +
    333 }
    │ │ │ │ +
    │ │ │ │ +
    334
    │ │ │ │ +
    335 namespace Simd {
    │ │ │ │ +
    336 namespace Overloads {
    │ │ │ │ +
    337 /*
    │ │ │ │ +
    338 * Implementation/Overloads of the functions needed for
    │ │ │ │ +
    339 * SIMD-interface-compatibility
    │ │ │ │ +
    340 */
    │ │ │ │ +
    341
    │ │ │ │ +
    342 //Implementation of SIMD-interface-types
    │ │ │ │ +
    343 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ +
    344 struct ScalarType<LoopSIMD<T,S,A>> {
    │ │ │ │ + │ │ │ │ +
    346 };
    │ │ │ │ +
    │ │ │ │ +
    347
    │ │ │ │ +
    348 template<class U, class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ +
    349 struct RebindType<U, LoopSIMD<T,S,A>> {
    │ │ │ │ + │ │ │ │ +
    351 };
    │ │ │ │ +
    │ │ │ │ +
    352
    │ │ │ │ +
    353 //Implementation of SIMD-interface-functionality
    │ │ │ │ +
    354 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    355 struct LaneCount<LoopSIMD<T,S,A>> : index_constant<S*lanes<T>()> {};
    │ │ │ │ +
    356
    │ │ │ │ +
    357 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ +
    358 auto lane(ADLTag<5>, std::size_t l, LoopSIMD<T,S,A> &&v)
    │ │ │ │ +
    359 -> decltype(std::move(Simd::lane(l%lanes<T>(), v[l/lanes<T>()])))
    │ │ │ │ +
    360 {
    │ │ │ │ +
    361 return std::move(Simd::lane(l%lanes<T>(), v[l/lanes<T>()]));
    │ │ │ │ +
    362 }
    │ │ │ │ +
    │ │ │ │ +
    363
    │ │ │ │ +
    364 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ +
    365 auto lane(ADLTag<5>, std::size_t l, const LoopSIMD<T,S,A> &v)
    │ │ │ │ +
    366 -> decltype(Simd::lane(l%lanes<T>(), v[l/lanes<T>()]))
    │ │ │ │ +
    367 {
    │ │ │ │ +
    368 return Simd::lane(l%lanes<T>(), v[l/lanes<T>()]);
    │ │ │ │ +
    369 }
    │ │ │ │ +
    │ │ │ │ +
    370
    │ │ │ │ +
    371 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ +
    372 auto lane(ADLTag<5>, std::size_t l, LoopSIMD<T,S,A> &v)
    │ │ │ │ +
    373 -> decltype(Simd::lane(l%lanes<T>(), v[l/lanes<T>()]))
    │ │ │ │ +
    374 {
    │ │ │ │ +
    375 return Simd::lane(l%lanes<T>(), v[l/lanes<T>()]);
    │ │ │ │ +
    376 }
    │ │ │ │ +
    │ │ │ │ +
    377
    │ │ │ │ +
    378 template<class T, std::size_t S, std::size_t AM, std::size_t AD>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    380 LoopSIMD<T,S,AD> ifTrue, LoopSIMD<T,S,AD> ifFalse) {
    │ │ │ │ + │ │ │ │ +
    382 for(std::size_t i=0; i<S; i++) {
    │ │ │ │ +
    383 out[i] = Simd::cond(mask[i], ifTrue[i], ifFalse[i]);
    │ │ │ │ +
    384 }
    │ │ │ │ +
    385 return out;
    │ │ │ │ +
    386 }
    │ │ │ │ +
    │ │ │ │ +
    387
    │ │ │ │ +
    388 template<class M, class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ +
    389 auto cond(ADLTag<5, std::is_same<bool, Simd::Scalar<M> >::value
    │ │ │ │ +
    390 && Simd::lanes<M>() == Simd::lanes<LoopSIMD<T,S,A> >()>,
    │ │ │ │ +
    391 M mask, LoopSIMD<T,S,A> ifTrue, LoopSIMD<T,S,A> ifFalse)
    │ │ │ │ +
    392 {
    │ │ │ │ +
    393 LoopSIMD<T,S,A> out;
    │ │ │ │ +
    394 for(auto l : range(Simd::lanes(mask)))
    │ │ │ │ +
    395 Simd::lane(l, out) = Simd::lane(l, mask) ? Simd::lane(l, ifTrue) : Simd::lane(l, ifFalse);
    │ │ │ │ +
    396 return out;
    │ │ │ │ +
    397 }
    │ │ │ │ +
    │ │ │ │ +
    398
    │ │ │ │ +
    399 template<class M, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    401 bool out = false;
    │ │ │ │ +
    402 for(std::size_t i=0; i<S; i++) {
    │ │ │ │ +
    403 out |= Simd::anyTrue(mask[i]);
    │ │ │ │ +
    404 }
    │ │ │ │ +
    405 return out;
    │ │ │ │ +
    406 }
    │ │ │ │ +
    │ │ │ │ +
    407
    │ │ │ │ +
    408 template<class M, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    410 bool out = true;
    │ │ │ │ +
    411 for(std::size_t i=0; i<S; i++) {
    │ │ │ │ +
    412 out &= Simd::allTrue(mask[i]);
    │ │ │ │ +
    413 }
    │ │ │ │ +
    414 return out;
    │ │ │ │ +
    415 }
    │ │ │ │ +
    │ │ │ │ +
    416
    │ │ │ │ +
    417 template<class M, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    419 bool out = false;
    │ │ │ │ +
    420 for(std::size_t i=0; i<S; i++) {
    │ │ │ │ +
    421 out |= Simd::anyFalse(mask[i]);
    │ │ │ │ +
    422 }
    │ │ │ │ +
    423 return out;
    │ │ │ │ +
    424 }
    │ │ │ │ +
    │ │ │ │ +
    425
    │ │ │ │ +
    426 template<class M, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    428 bool out = true;
    │ │ │ │ +
    429 for(std::size_t i=0; i<S; i++) {
    │ │ │ │ +
    430 out &= Simd::allFalse(mask[i]);
    │ │ │ │ +
    431 }
    │ │ │ │ +
    432 return out;
    │ │ │ │ +
    433 }
    │ │ │ │ +
    │ │ │ │ +
    434 } //namespace Overloads
    │ │ │ │ +
    435
    │ │ │ │ +
    436 } //namespace Simd
    │ │ │ │ +
    437
    │ │ │ │ +
    438
    │ │ │ │ +
    439 /*
    │ │ │ │ +
    440 * Overloads the unary cmath-operations. Operations requiring
    │ │ │ │ +
    441 * or returning more than one argument are not supported.
    │ │ │ │ +
    442 * Due to inconsistency with the return values, cmath-operations
    │ │ │ │ +
    443 * on integral types are also not supported-
    │ │ │ │ +
    444 */
    │ │ │ │ +
    445
    │ │ │ │ +
    │ │ │ │ +
    446#define DUNE_SIMD_LOOP_CMATH_UNARY_OP(expr) \
    │ │ │ │ +
    447 template<class T, std::size_t S, std::size_t A, typename Sfinae = \
    │ │ │ │ +
    448 typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
    │ │ │ │ +
    449 auto expr(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    450 using std::expr; \
    │ │ │ │ +
    451 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    452 for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    453 out[i] = expr(v[i]); \
    │ │ │ │ +
    454 } \
    │ │ │ │ +
    455 return out; \
    │ │ │ │ +
    456 } \
    │ │ │ │ +
    457 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    458
    │ │ │ │ +
    │ │ │ │ +
    459#define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN(expr, returnType) \
    │ │ │ │ +
    460 template<class T, std::size_t S, std::size_t A, typename Sfinae = \
    │ │ │ │ +
    461 typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
    │ │ │ │ +
    462 auto expr(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    463 using std::expr; \
    │ │ │ │ +
    464 LoopSIMD<returnType,S> out; \
    │ │ │ │ +
    465 for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    466 out[i] = expr(v[i]); \
    │ │ │ │ +
    467 } \
    │ │ │ │ +
    468 return out; \
    │ │ │ │ +
    469 } \
    │ │ │ │ +
    470 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    471
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    484
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    494
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    497
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    502
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    513
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    516
    │ │ │ │ +
    517#undef DUNE_SIMD_LOOP_CMATH_UNARY_OP
    │ │ │ │ +
    518#undef DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN
    │ │ │ │ +
    519
    │ │ │ │ +
    520
    │ │ │ │ +
    521 /* not implemented cmath-functions:
    │ │ │ │ +
    522 * atan2
    │ │ │ │ +
    523 * frexp, idexp
    │ │ │ │ +
    524 * modf
    │ │ │ │ +
    525 * scalbn, scalbln
    │ │ │ │ +
    526 * pow
    │ │ │ │ +
    527 * hypot
    │ │ │ │ +
    528 * remainder, remquo
    │ │ │ │ +
    529 * copysign
    │ │ │ │ +
    530 * nan
    │ │ │ │ +
    531 * nextafter, nexttoward
    │ │ │ │ +
    532 * fdim, fmax, fmin
    │ │ │ │ +
    533 */
    │ │ │ │ +
    534
    │ │ │ │ +
    535 /*
    │ │ │ │ +
    536 * Overloads specific functions usually provided by the std library
    │ │ │ │ +
    537 * More overloads will be provided should the need arise.
    │ │ │ │ +
    538 */
    │ │ │ │ +
    539
    │ │ │ │ +
    │ │ │ │ +
    540#define DUNE_SIMD_LOOP_STD_UNARY_OP(expr) \
    │ │ │ │ +
    541 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    542 auto expr(const LoopSIMD<T,S,A> &v) { \
    │ │ │ │ +
    543 using std::expr; \
    │ │ │ │ +
    544 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    545 for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    546 out[i] = expr(v[i]); \
    │ │ │ │ +
    547 } \
    │ │ │ │ +
    548 return out; \
    │ │ │ │ +
    549 } \
    │ │ │ │ +
    550 \
    │ │ │ │ +
    551 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    552 auto expr(const LoopSIMD<std::complex<T>,S,A> &v) { \
    │ │ │ │ +
    553 using std::expr; \
    │ │ │ │ +
    554 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    555 for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    556 out[i] = expr(v[i]); \
    │ │ │ │ +
    557 } \
    │ │ │ │ +
    558 return out; \
    │ │ │ │ +
    559 } \
    │ │ │ │ +
    560 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    561
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    564
    │ │ │ │ +
    565#undef DUNE_SIMD_LOOP_STD_UNARY_OP
    │ │ │ │ +
    566
    │ │ │ │ +
    │ │ │ │ +
    567#define DUNE_SIMD_LOOP_STD_BINARY_OP(expr) \
    │ │ │ │ +
    568 template<class T, std::size_t S, std::size_t A> \
    │ │ │ │ +
    569 auto expr(const LoopSIMD<T,S,A> &v, const LoopSIMD<T,S,A> &w) { \
    │ │ │ │ +
    570 using std::expr; \
    │ │ │ │ +
    571 LoopSIMD<T,S,A> out; \
    │ │ │ │ +
    572 for(std::size_t i=0; i<S; i++) { \
    │ │ │ │ +
    573 out[i] = expr(v[i],w[i]); \
    │ │ │ │ +
    574 } \
    │ │ │ │ +
    575 return out; \
    │ │ │ │ +
    576 } \
    │ │ │ │ +
    577 static_assert(true, "expecting ;")
    │ │ │ │ +
    │ │ │ │ +
    578
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    581
    │ │ │ │ +
    582#undef DUNE_SIMD_LOOP_STD_BINARY_OP
    │ │ │ │ +
    583
    │ │ │ │ +
    584 namespace MathOverloads {
    │ │ │ │ +
    585 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    588 for(auto l : range(S))
    │ │ │ │ +
    589 out[l] = Dune::isNaN(v[l]);
    │ │ │ │ +
    590 return out;
    │ │ │ │ +
    591 }
    │ │ │ │ +
    │ │ │ │ +
    592
    │ │ │ │ +
    593 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    596 for(auto l : range(S))
    │ │ │ │ +
    597 out[l] = Dune::isInf(v[l]);
    │ │ │ │ +
    598 return out;
    │ │ │ │ +
    599 }
    │ │ │ │ +
    │ │ │ │ +
    600
    │ │ │ │ +
    601 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    604 for(auto l : range(S))
    │ │ │ │ +
    605 out[l] = Dune::isFinite(v[l]);
    │ │ │ │ +
    606 return out;
    │ │ │ │ +
    607 }
    │ │ │ │ +
    │ │ │ │ +
    608 } //namespace MathOverloads
    │ │ │ │ +
    609
    │ │ │ │ +
    610 template<class T, std::size_t S, std::size_t A>
    │ │ │ │ +
    │ │ │ │ +
    611 struct IsNumber<LoopSIMD<T,S,A>> :
    │ │ │ │ +
    612 public std::integral_constant<bool, IsNumber<T>::value>{
    │ │ │ │ +
    613 };
    │ │ │ │ +
    │ │ │ │ +
    614
    │ │ │ │ +
    615#ifdef CLANG_WARNING_DISABLED
    │ │ │ │ +
    616# pragma clang diagnostic pop
    │ │ │ │ +
    617# undef CLANG_WARNING_DISABLED
    │ │ │ │ +
    618#endif
    │ │ │ │ +
    619
    │ │ │ │ +
    620#ifdef GCC_WARNING_DISABLED
    │ │ │ │ +
    621# pragma GCC diagnostic pop
    │ │ │ │ +
    622# undef GCC_WARNING_DISABLED
    │ │ │ │ +
    623#endif
    │ │ │ │ +
    624
    │ │ │ │ +
    625} //namespace Dune
    │ │ │ │ +
    626
    │ │ │ │ +
    627#endif
    │ │ │ │ +
    Some useful basic math stuff.
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_BINARY_OP(SYMBOL)
    Definition loop.hh:177
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL)
    Definition loop.hh:289
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_STD_BINARY_OP(expr)
    Definition loop.hh:567
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_STD_UNARY_OP(expr)
    Definition loop.hh:540
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_BITSHIFT_OP(SYMBOL)
    Definition loop.hh:221
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_CMATH_UNARY_OP(expr)
    Definition loop.hh:446
    │ │ │ │ +
    #define DUNE_PRAGMA_OMP_SIMD
    Definition loop.hh:49
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN(expr, returnType)
    Definition loop.hh:459
    │ │ │ │ +
    #define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL)
    Definition loop.hh:145
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    std::integral_constant< std::size_t, i > index_constant
    An index constant with value i.
    Definition indices.hh:30
    │ │ │ │ +
    static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
    Definition rangeutilities.hh:300
    │ │ │ │ +
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │ +
    bool anyTrue(const Mask &mask)
    Whether any entry is true
    Definition simd/interface.hh:429
    │ │ │ │ +
    V cond(M &&mask, const V &ifTrue, const V &ifFalse)
    Like the ?: operator.
    Definition simd/interface.hh:386
    │ │ │ │ +
    bool allTrue(const Mask &mask)
    Whether all entries are true
    Definition simd/interface.hh:439
    │ │ │ │ +
    bool anyFalse(const Mask &mask)
    Whether any entry is false
    Definition simd/interface.hh:449
    │ │ │ │ +
    constexpr std::size_t lanes()
    Number of lanes in a SIMD type.
    Definition simd/interface.hh:305
    │ │ │ │ +
    decltype(auto) lane(std::size_t l, V &&v)
    Extract an element of a SIMD type.
    Definition simd/interface.hh:324
    │ │ │ │ +
    Rebind< bool, V > Mask
    Mask type type of some SIMD type.
    Definition simd/interface.hh:289
    │ │ │ │ +
    bool allFalse(const Mask &mask)
    Whether all entries are false
    Definition simd/interface.hh:459
    │ │ │ │ +
    typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
    Element type of some SIMD type.
    Definition simd/interface.hh:235
    │ │ │ │ +
    Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
    implements Simd::mask()
    Definition defaults.hh:153
    │ │ │ │ +
    bool allFalse(ADLTag< 0 >, const Mask &mask)
    implements Simd::allFalse()
    Definition defaults.hh:124
    │ │ │ │ +
    bool allTrue(ADLTag< 0 >, const Mask &mask)
    implements Simd::allTrue()
    Definition defaults.hh:104
    │ │ │ │ +
    bool anyFalse(ADLTag< 0 >, const Mask &mask)
    implements Simd::anyFalse()
    Definition defaults.hh:114
    │ │ │ │ +
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    A dense n x m matrix.
    Definition densematrix.hh:140
    │ │ │ │ -
    derived_type & operator=(const RHS &rhs)
    Definition densematrix.hh:279
    │ │ │ │ -
    constexpr size_type M() const
    number of columns
    Definition densematrix.hh:703
    │ │ │ │ -
    Traits::value_type value_type
    export the type representing the field
    Definition densematrix.hh:157
    │ │ │ │ -
    constexpr size_type rows() const
    number of rows
    Definition densematrix.hh:709
    │ │ │ │ -
    constexpr size_type N() const
    number of rows
    Definition densematrix.hh:697
    │ │ │ │ -
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition densematrix.hh:166
    │ │ │ │ -
    Construct a matrix with a dynamic size.
    Definition dynmatrix.hh:61
    │ │ │ │ -
    size_type mat_cols() const
    Definition dynmatrix.hh:143
    │ │ │ │ -
    DynamicMatrix(std::initializer_list< DynamicVector< K > > const &ll)
    Constructor initializing the matrix from a list of vector.
    Definition dynmatrix.hh:80
    │ │ │ │ -
    Base::row_type row_type
    Definition dynmatrix.hh:67
    │ │ │ │ -
    DynamicMatrix transposed() const
    Return transposed of the matrix as DynamicMatrix.
    Definition dynmatrix.hh:132
    │ │ │ │ -
    Base::value_type value_type
    Definition dynmatrix.hh:66
    │ │ │ │ -
    row_type & mat_access(size_type i)
    Definition dynmatrix.hh:147
    │ │ │ │ -
    Base::size_type size_type
    Definition dynmatrix.hh:65
    │ │ │ │ -
    size_type mat_rows() const
    Definition dynmatrix.hh:142
    │ │ │ │ -
    DynamicMatrix(T const &rhs)
    Definition dynmatrix.hh:87
    │ │ │ │ -
    const row_type & mat_access(size_type i) const
    Definition dynmatrix.hh:151
    │ │ │ │ -
    void resize(size_type r, size_type c, value_type v=value_type())
    resize matrix to r × c
    Definition dynmatrix.hh:106
    │ │ │ │ -
    DynamicMatrix & operator=(T const &rhs)
    Definition dynmatrix.hh:116
    │ │ │ │ -
    DynamicMatrix()
    Default constructor.
    Definition dynmatrix.hh:71
    │ │ │ │ -
    DynamicMatrix(size_type r, size_type c, value_type v=value_type())
    Constructor initializing the whole matrix with a scalar.
    Definition dynmatrix.hh:74
    │ │ │ │ -
    DynamicMatrix & operator=(T scalar)
    Definition dynmatrix.hh:126
    │ │ │ │ -
    container_type::size_type size_type
    Definition dynmatrix.hh:45
    │ │ │ │ -
    DynamicVector< K > row_type
    Definition dynmatrix.hh:38
    │ │ │ │ -
    row_type & row_reference
    Definition dynmatrix.hh:40
    │ │ │ │ -
    K value_type
    Definition dynmatrix.hh:44
    │ │ │ │ -
    DynamicMatrix< K > derived_type
    Definition dynmatrix.hh:36
    │ │ │ │ -
    const row_type & const_row_reference
    Definition dynmatrix.hh:41
    │ │ │ │ -
    std::vector< K > container_type
    Definition dynmatrix.hh:43
    │ │ │ │ -
    FieldTraits< K >::real_type real_type
    Definition dynmatrix.hh:52
    │ │ │ │ -
    FieldTraits< K >::field_type field_type
    Definition dynmatrix.hh:51
    │ │ │ │ -
    Construct a vector with a dynamic size.
    Definition dynvector.hh:59
    │ │ │ │ -
    Definition ftraits.hh:26
    │ │ │ │ -
    T field_type
    export the type representing the field
    Definition ftraits.hh:28
    │ │ │ │ -
    T real_type
    export the type representing the real type of the field
    Definition ftraits.hh:30
    │ │ │ │ -
    Definition matvectraits.hh:31
    │ │ │ │ +
    DUNE_SIMD_LOOP_COMPARISON_OP(<)
    │ │ │ │ +
    bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
    Definition debugalign.hh:543
    │ │ │ │ +
    const AlignedNumber< T, align > & cond(ADLTag< 5 >, AlignedNumber< bool, align > mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align > &ifFalse)
    Definition debugalign.hh:535
    │ │ │ │ +
    T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
    Definition debugalign.hh:520
    │ │ │ │ +
    bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:604
    │ │ │ │ +
    bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:594
    │ │ │ │ +
    auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:584
    │ │ │ │ +
    Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
    Definition typetraits.hh:194
    │ │ │ │ +
    Tag to make sure the functions in this namespace can be found by ADL.
    Definition math.hh:230
    │ │ │ │ +
    Tag used to force late-binding lookup in Dune::Simd::Overloads.
    Definition base.hh:182
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:60
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:67
    │ │ │ │ +
    should be derived from a Dune::index_constant
    Definition standard.hh:74
    │ │ │ │ +
    Definition loop.hh:65
    │ │ │ │ +
    LoopSIMD(Simd::Scalar< T > i)
    Definition loop.hh:75
    │ │ │ │ +
    DUNE_SIMD_LOOP_PREFIX_OP(++)
    │ │ │ │ +
    auto operator!() const
    Definition loop.hh:121
    │ │ │ │ +
    DUNE_SIMD_LOOP_POSTFIX_OP(--)
    │ │ │ │ +
    DUNE_SIMD_LOOP_ASSIGNMENT_OP * DUNE_SIMD_LOOP_ASSIGNMENT_OP(/=);DUNE_SIMD_LOOP_ASSIGNMENT_OP(%=
    │ │ │ │ +
    DUNE_SIMD_LOOP_ASSIGNMENT_OP & DUNE_SIMD_LOOP_ASSIGNMENT_OP(|=);DUNE_SIMD_LOOP_ASSIGNMENT_OP(^=
    │ │ │ │ +
    DUNE_SIMD_LOOP_UNARY_OP(-)
    │ │ │ │ +
    DUNE_SIMD_LOOP_PREFIX_OP(--)
    │ │ │ │ +
    DUNE_SIMD_LOOP_POSTFIX_OP(++)
    │ │ │ │ +
    DUNE_SIMD_LOOP_ASSIGNMENT_OP(-=)
    │ │ │ │ +
    LoopSIMD(const LoopSIMD< T, S, OA > &other)
    Definition loop.hh:80
    │ │ │ │ +
    LoopSIMD()
    Definition loop.hh:70
    │ │ │ │ +
    DUNE_SIMD_LOOP_UNARY_OP(~)
    │ │ │ │ +
    DUNE_SIMD_LOOP_ASSIGNMENT_OP(+=)
    │ │ │ │ +
    DUNE_SIMD_LOOP_UNARY_OP(+)
    │ │ │ │ +
    DUNE_SIMD_LOOP_ASSIGNMENT_OP(<<=)
    │ │ │ │ +
    DUNE_SIMD_LOOP_ASSIGNMENT_OP(> >=)
    │ │ │ │ +
    Simd::Scalar< T > type
    Definition loop.hh:345
    │ │ │ │ +
    Helper class for tagging priorities.
    Definition typeutilities.hh:73
    │ │ │ │ +
    Include file for users of the SIMD abstraction layer.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,280 +1,821 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -dynmatrix.hh │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +loop.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_DYNMATRIX_HH │ │ │ │ │ -6#define DUNE_DYNMATRIX_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_SIMD_LOOP_HH │ │ │ │ │ +4#define DUNE_COMMON_SIMD_LOOP_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ 12 │ │ │ │ │ -13#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ -14#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_y_n_v_e_c_t_o_r_._h_h> │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ -17#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +13#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ +14#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +16 │ │ │ │ │ +17namespace _D_u_n_e { │ │ │ │ │ 18 │ │ │ │ │ -19namespace _D_u_n_e │ │ │ │ │ -20{ │ │ │ │ │ -21 │ │ │ │ │ -31 template< class K > class DynamicMatrix; │ │ │ │ │ -32 │ │ │ │ │ -33 template< class K > │ │ │ │ │ -_3_4 struct _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s< _D_y_n_a_m_i_c_M_a_t_r_i_x > │ │ │ │ │ -35 { │ │ │ │ │ -_3_6 typedef _D_y_n_a_m_i_c_M_a_t_r_i_x_<_K_> _d_e_r_i_v_e_d___t_y_p_e; │ │ │ │ │ -37 │ │ │ │ │ -_3_8 typedef _D_y_n_a_m_i_c_V_e_c_t_o_r_<_K_> _r_o_w___t_y_p_e; │ │ │ │ │ -39 │ │ │ │ │ -_4_0 typedef _r_o_w___t_y_p_e &_r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -_4_1 typedef const _r_o_w___t_y_p_e &_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +19 │ │ │ │ │ +20/* │ │ │ │ │ +21 * silence warnings from GCC about using integer operands on a bool │ │ │ │ │ +22 * (when instantiated for T=bool) │ │ │ │ │ +23 */ │ │ │ │ │ +24#if __GNUC__ >= 7 │ │ │ │ │ +25# pragma GCC diagnostic push │ │ │ │ │ +26# pragma GCC diagnostic ignored "-Wbool-operation" │ │ │ │ │ +27# pragma GCC diagnostic ignored "-Wint-in-bool-context" │ │ │ │ │ +28# define GCC_WARNING_DISABLED │ │ │ │ │ +29#endif │ │ │ │ │ +30 │ │ │ │ │ +31/* │ │ │ │ │ +32 * silence warnings from Clang about using bitwise operands on │ │ │ │ │ +33 * a bool (when instantiated for T=bool) │ │ │ │ │ +34 */ │ │ │ │ │ +35#ifdef __clang__ │ │ │ │ │ +36#if __has_warning("-Wbitwise-instead-of-logical") │ │ │ │ │ +37# pragma clang diagnostic push │ │ │ │ │ +38# pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" │ │ │ │ │ +39# define CLANG_WARNING_DISABLED │ │ │ │ │ +40#endif │ │ │ │ │ +41#endif │ │ │ │ │ 42 │ │ │ │ │ -_4_3 typedef std::vector _c_o_n_t_a_i_n_e_r___t_y_p_e; │ │ │ │ │ -_4_4 typedef K _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_4_5 typedef typename container_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -46 }; │ │ │ │ │ -47 │ │ │ │ │ -48 template< class K > │ │ │ │ │ -_4_9 struct _F_i_e_l_d_T_r_a_i_t_s< _D_y_n_a_m_i_c_M_a_t_r_i_x > │ │ │ │ │ -50 { │ │ │ │ │ -_5_1 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_5_2 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ -53 }; │ │ │ │ │ -54 │ │ │ │ │ -59 template │ │ │ │ │ -_6_0 class _D_y_n_a_m_i_c_M_a_t_r_i_x : public _D_e_n_s_e_M_a_t_r_i_x< DynamicMatrix > │ │ │ │ │ -61 { │ │ │ │ │ -62 std::vector< DynamicVector > _data; │ │ │ │ │ -63 typedef _D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_K_> > _B_a_s_e; │ │ │ │ │ -64 public: │ │ │ │ │ -_6_5 typedef typename _B_a_s_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ -_6_6 typedef typename _B_a_s_e_:_:_v_a_l_u_e___t_y_p_e _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_6_7 typedef typename _B_a_s_e_:_:_r_o_w___t_y_p_e _r_o_w___t_y_p_e; │ │ │ │ │ +43/* │ │ │ │ │ +44 * Introduce a simd pragma if OpenMP is available in standard version >= 4 │ │ │ │ │ +45 */ │ │ │ │ │ +46#if _OPENMP >= 201307 │ │ │ │ │ +47 #define DUNE_PRAGMA_OMP_SIMD _Pragma("omp simd") │ │ │ │ │ +48#else │ │ │ │ │ +_4_9 #define DUNE_PRAGMA_OMP_SIMD │ │ │ │ │ +50#endif │ │ │ │ │ +51 │ │ │ │ │ +52 │ │ │ │ │ +64 template │ │ │ │ │ +_6_5 class alignas(A==0?alignof(T):A) _L_o_o_p_S_I_M_D : public std::array { │ │ │ │ │ +66 │ │ │ │ │ +67 public: │ │ │ │ │ 68 │ │ │ │ │ -69 //===== constructors │ │ │ │ │ -_7_1 _D_y_n_a_m_i_c_M_a_t_r_i_x () {} │ │ │ │ │ -72 │ │ │ │ │ -_7_4 _D_y_n_a_m_i_c_M_a_t_r_i_x (_s_i_z_e___t_y_p_e r, _s_i_z_e___t_y_p_e c, _v_a_l_u_e___t_y_p_e v = _v_a_l_u_e___t_y_p_e() ) : │ │ │ │ │ -75 _data(r, _r_o_w___t_y_p_e(c, v) ) │ │ │ │ │ -76 {} │ │ │ │ │ -77 │ │ │ │ │ -_8_0 _D_y_n_a_m_i_c_M_a_t_r_i_x (std::initializer_list<_D_y_n_a_m_i_c_V_e_c_t_o_r_<_K_>> const &ll) │ │ │ │ │ -81 : _data(ll) │ │ │ │ │ -82 {} │ │ │ │ │ -83 │ │ │ │ │ -84 │ │ │ │ │ -85 template ::value && │ │ │ │ │ -HasDenseMatrixAssigner::value>> │ │ │ │ │ -_8_7 _D_y_n_a_m_i_c_M_a_t_r_i_x(T const& rhs) │ │ │ │ │ -88 { │ │ │ │ │ -89 *this = rhs; │ │ │ │ │ -90 } │ │ │ │ │ -91 │ │ │ │ │ -92 //==== resize related methods │ │ │ │ │ -_1_0_6 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e r, _s_i_z_e___t_y_p_e c, _v_a_l_u_e___t_y_p_e v = _v_a_l_u_e___t_y_p_e() ) │ │ │ │ │ -107 { │ │ │ │ │ -108 _data.resize(0); │ │ │ │ │ -109 _data.resize(r, _r_o_w___t_y_p_e(c, v) ); │ │ │ │ │ -110 } │ │ │ │ │ -111 │ │ │ │ │ -112 //===== assignment │ │ │ │ │ -113 // General assignment with resizing │ │ │ │ │ -114 template ::value>> │ │ │ │ │ -_1_1_6 _D_y_n_a_m_i_c_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=(T const& rhs) { │ │ │ │ │ -117 _data._r_e_s_i_z_e(rhs.N()); │ │ │ │ │ -118 std::fill(_data.begin(), _data.end(), _r_o_w___t_y_p_e(rhs.M(), K(0))); │ │ │ │ │ -119 _B_a_s_e_:_:_o_p_e_r_a_t_o_r_=(rhs); │ │ │ │ │ -120 return *this; │ │ │ │ │ -121 } │ │ │ │ │ -122 │ │ │ │ │ -123 // Specialisation: scalar assignment (no resizing) │ │ │ │ │ -124 template ::value>> │ │ │ │ │ -_1_2_6 _D_y_n_a_m_i_c_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=(T scalar) { │ │ │ │ │ -127 std::fill(_data.begin(), _data.end(), scalar); │ │ │ │ │ -128 return *this; │ │ │ │ │ -129 } │ │ │ │ │ +69 //default constructor │ │ │ │ │ +_7_0 _L_o_o_p_S_I_M_D() { │ │ │ │ │ +71 assert(reinterpret_cast(this) % std::min(alignof │ │ │ │ │ +(_L_o_o_p_S_I_M_D_<_T_,_S_,_A_>),alignof(std::max_align_t)) == 0); │ │ │ │ │ +72 } │ │ │ │ │ +73 │ │ │ │ │ +74 // broadcast constructor initializing the content with a given value │ │ │ │ │ +_7_5 _L_o_o_p_S_I_M_D(_S_i_m_d_:_:_S_c_a_l_a_r_<_T_> i) : _L_o_o_p_S_I_M_D() { │ │ │ │ │ +76 this->fill(i); │ │ │ │ │ +77 } │ │ │ │ │ +78 │ │ │ │ │ +79 template │ │ │ │ │ +_8_0 explicit _L_o_o_p_S_I_M_D(const _L_o_o_p_S_I_M_D_<_T_,_S_,_O_A_>& other) │ │ │ │ │ +81 : _s_t_d::array(other) │ │ │ │ │ +82 { │ │ │ │ │ +83 assert(reinterpret_cast(this) % std::min(alignof │ │ │ │ │ +(_L_o_o_p_S_I_M_D_<_T_,_S_,_A_>),alignof(std::max_align_t)) == 0); │ │ │ │ │ +84 } │ │ │ │ │ +85 │ │ │ │ │ +86 /* │ │ │ │ │ +87 * Definition of basic operators │ │ │ │ │ +88 */ │ │ │ │ │ +89 │ │ │ │ │ +90 //Prefix operators │ │ │ │ │ +_9_1#define DUNE_SIMD_LOOP_PREFIX_OP(SYMBOL) \ │ │ │ │ │ +92 auto operator SYMBOL() { \ │ │ │ │ │ +93 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +94 for(std::size_t i=0; i out; \ │ │ │ │ │ +109 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +110 for(std::size_t i=0; i> out; │ │ │ │ │ +123 _D_U_N_E___P_R_A_G_M_A___O_M_P___S_I_M_D │ │ │ │ │ +124 for(std::size_t i=0; i_M(), this->_N()); │ │ │ │ │ -135 for( size_type i = 0; i < this->_N(); ++i ) │ │ │ │ │ -136 for( _s_i_z_e___t_y_p_e j = 0; j < this->_M(); ++j ) │ │ │ │ │ -137 AT[j][i] = (*this)[i][j]; │ │ │ │ │ -138 return AT; │ │ │ │ │ -139 } │ │ │ │ │ -140 │ │ │ │ │ -141 // make this thing a matrix │ │ │ │ │ -_1_4_2 _s_i_z_e___t_y_p_e _m_a_t___r_o_w_s() const { return _data.size(); } │ │ │ │ │ -_1_4_3 _s_i_z_e___t_y_p_e _m_a_t___c_o_l_s() const { │ │ │ │ │ -144 assert(this->_r_o_w_s()); │ │ │ │ │ -145 return _data.front().size(); │ │ │ │ │ -146 } │ │ │ │ │ -_1_4_7 _r_o_w___t_y_p_e & _m_a_t___a_c_c_e_s_s(_s_i_z_e___t_y_p_e i) { │ │ │ │ │ -148 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _data.size()); │ │ │ │ │ -149 return _data[i]; │ │ │ │ │ -150 } │ │ │ │ │ -_1_5_1 const _r_o_w___t_y_p_e & _m_a_t___a_c_c_e_s_s(_s_i_z_e___t_y_p_e i) const { │ │ │ │ │ -152 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _data.size()); │ │ │ │ │ -153 return _data[i]; │ │ │ │ │ -154 } │ │ │ │ │ -155 }; │ │ │ │ │ -156 │ │ │ │ │ -159} // end namespace │ │ │ │ │ -160 │ │ │ │ │ -161#endif │ │ │ │ │ +131 //Postfix operators │ │ │ │ │ +_1_3_2#define DUNE_SIMD_LOOP_POSTFIX_OP(SYMBOL) \ │ │ │ │ │ +133 auto operator SYMBOL(int){ \ │ │ │ │ │ +134 LoopSIMD out = *this; \ │ │ │ │ │ +135 SYMBOL(*this); \ │ │ │ │ │ +136 return out; \ │ │ │ │ │ +137 } \ │ │ │ │ │ +138 static_assert(true, "expecting ;") │ │ │ │ │ +139 │ │ │ │ │ +_1_4_0 _D_U_N_E___S_I_M_D___L_O_O_P___P_O_S_T_F_I_X___O_P(++); │ │ │ │ │ +_1_4_1 _D_U_N_E___S_I_M_D___L_O_O_P___P_O_S_T_F_I_X___O_P(--); │ │ │ │ │ +142#undef DUNE_SIMD_LOOP_POSTFIX_OP │ │ │ │ │ +143 │ │ │ │ │ +144 //Assignment operators │ │ │ │ │ +_1_4_5#define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL) \ │ │ │ │ │ +146 auto operator SYMBOL(const Simd::Scalar s) { \ │ │ │ │ │ +147 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +148 for(std::size_t i=0; i &v) { \ │ │ │ │ │ +155 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +156 for(std::size_t i=0; i>=); │ │ │ │ │ +_1_7_0 _D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P(&=); │ │ │ │ │ +171 _D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P(|=); │ │ │ │ │ +172 _D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P(^=); │ │ │ │ │ +173#undef DUNE_SIMD_LOOP_ASSIGNMENT_OP │ │ │ │ │ +174 }; │ │ │ │ │ +175 │ │ │ │ │ +176 //Arithmetic operators │ │ │ │ │ +_1_7_7#define DUNE_SIMD_LOOP_BINARY_OP(SYMBOL) \ │ │ │ │ │ +178 template \ │ │ │ │ │ +179 auto operator SYMBOL(const LoopSIMD &v, const Simd::Scalar s) { \ │ │ │ │ │ +180 LoopSIMD out; \ │ │ │ │ │ +181 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +182 for(std::size_t i=0; i \ │ │ │ │ │ +188 auto operator SYMBOL(const Simd::Scalar s, const LoopSIMD &v) { \ │ │ │ │ │ +189 LoopSIMD out; \ │ │ │ │ │ +190 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +191 for(std::size_t i=0; i \ │ │ │ │ │ +197 auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +198 const LoopSIMD &w) { \ │ │ │ │ │ +199 LoopSIMD out; \ │ │ │ │ │ +200 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +201 for(std::size_t i=0; i \ │ │ │ │ │ +223 auto operator SYMBOL(const LoopSIMD &v, const U s) { \ │ │ │ │ │ +224 LoopSIMD out; \ │ │ │ │ │ +225 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +226 for(std::size_t i=0; i \ │ │ │ │ │ +232 auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +233 const LoopSIMD &w) { \ │ │ │ │ │ +234 LoopSIMD out; \ │ │ │ │ │ +235 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +236 for(std::size_t i=0; i>); │ │ │ │ │ +245 │ │ │ │ │ +246#undef DUNE_SIMD_LOOP_BITSHIFT_OP │ │ │ │ │ +247 │ │ │ │ │ +248 //Comparison operators │ │ │ │ │ +_2_4_9#define DUNE_SIMD_LOOP_COMPARISON_OP(SYMBOL) \ │ │ │ │ │ +250 template \ │ │ │ │ │ +251 auto operator SYMBOL(const LoopSIMD &v, const U s) { \ │ │ │ │ │ +252 Simd::Mask> out; \ │ │ │ │ │ +253 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +254 for(std::size_t i=0; i \ │ │ │ │ │ +260 auto operator SYMBOL(const Simd::Scalar s, const LoopSIMD &v) { \ │ │ │ │ │ +261 Simd::Mask> out; \ │ │ │ │ │ +262 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +263 for(std::size_t i=0; i \ │ │ │ │ │ +269 auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +270 const LoopSIMD &w) { \ │ │ │ │ │ +271 Simd::Mask> out; \ │ │ │ │ │ +272 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +273 for(std::size_t i=0; i); │ │ │ │ │ +_2_8_2 _D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P(<=); │ │ │ │ │ +_2_8_3 _D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P(>=); │ │ │ │ │ +284 _D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P(==); │ │ │ │ │ +_2_8_5 _D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P(!=); │ │ │ │ │ +286#undef DUNE_SIMD_LOOP_COMPARISON_OP │ │ │ │ │ +287 │ │ │ │ │ +288 //Boolean operators │ │ │ │ │ +_2_8_9#define DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL) \ │ │ │ │ │ +290 template \ │ │ │ │ │ +291 auto operator SYMBOL(const LoopSIMD &v, const Simd::Scalar s) { \ │ │ │ │ │ +292 Simd::Mask> out; \ │ │ │ │ │ +293 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +294 for(std::size_t i=0; i \ │ │ │ │ │ +300 auto operator SYMBOL(const Simd::Mask s, const LoopSIMD &v) { \ │ │ │ │ │ +301 Simd::Mask> out; \ │ │ │ │ │ +302 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +303 for(std::size_t i=0; i \ │ │ │ │ │ +309 auto operator SYMBOL(const LoopSIMD &v, \ │ │ │ │ │ +310 const LoopSIMD &w) { \ │ │ │ │ │ +311 Simd::Mask> out; \ │ │ │ │ │ +312 DUNE_PRAGMA_OMP_SIMD \ │ │ │ │ │ +313 for(std::size_t i=0; i │ │ │ │ │ +326 std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream &os, const _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> &v) { │ │ │ │ │ +327 os << "["; │ │ │ │ │ +328 for(std::size_t i=0; i │ │ │ │ │ +_3_4_4 struct _S_c_a_l_a_r_T_y_p_e<_L_o_o_p_S_I_M_D> { │ │ │ │ │ +_3_4_5 using _t_y_p_e = _S_i_m_d_:_:_S_c_a_l_a_r_<_T_>; │ │ │ │ │ +346 }; │ │ │ │ │ +347 │ │ │ │ │ +348 template │ │ │ │ │ +_3_4_9 struct _R_e_b_i_n_d_T_y_p_e> { │ │ │ │ │ +_3_5_0 using _t_y_p_e = _L_o_o_p_S_I_M_D_<_S_i_m_d_:_:_R_e_b_i_n_d_<_U_,_ _T_>,S,A>; │ │ │ │ │ +351 }; │ │ │ │ │ +352 │ │ │ │ │ +353 //Implementation of SIMD-interface-functionality │ │ │ │ │ +354 template │ │ │ │ │ +_3_5_5 struct _L_a_n_e_C_o_u_n_t<_L_o_o_p_S_I_M_D> : _i_n_d_e_x___c_o_n_s_t_a_n_t()> {}; │ │ │ │ │ +356 │ │ │ │ │ +357 template │ │ │ │ │ +_3_5_8 auto _l_a_n_e(_A_D_L_T_a_g_<_5_>, std::size_t l, _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> &&v) │ │ │ │ │ +359 -> decltype(std::move(_S_i_m_d_:_:_l_a_n_e(l%lanes(), v[l/lanes()]))) │ │ │ │ │ +360 { │ │ │ │ │ +361 return std::move(_S_i_m_d_:_:_l_a_n_e(l%lanes(), v[l/lanes()])); │ │ │ │ │ +362 } │ │ │ │ │ +363 │ │ │ │ │ +364 template │ │ │ │ │ +_3_6_5 auto _l_a_n_e(_A_D_L_T_a_g_<_5_>, std::size_t l, const _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> &v) │ │ │ │ │ +366 -> decltype(_S_i_m_d_:_:_l_a_n_e(l%lanes(), v[l/lanes()])) │ │ │ │ │ +367 { │ │ │ │ │ +368 return _S_i_m_d_:_:_l_a_n_e(l%lanes(), v[l/lanes()]); │ │ │ │ │ +369 } │ │ │ │ │ +370 │ │ │ │ │ +371 template │ │ │ │ │ +_3_7_2 auto _l_a_n_e(_A_D_L_T_a_g_<_5_>, std::size_t l, _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> &v) │ │ │ │ │ +373 -> decltype(_S_i_m_d_:_:_l_a_n_e(l%lanes(), v[l/lanes()])) │ │ │ │ │ +374 { │ │ │ │ │ +375 return _S_i_m_d_:_:_l_a_n_e(l%lanes(), v[l/lanes()]); │ │ │ │ │ +376 } │ │ │ │ │ +377 │ │ │ │ │ +378 template │ │ │ │ │ +_3_7_9 auto _c_o_n_d(_A_D_L_T_a_g_<_5_>, _S_i_m_d_:_:_M_a_s_k<_L_o_o_p_S_I_M_D_<_T_,_S_,_A_M_>> _m_a_s_k, │ │ │ │ │ +380 _L_o_o_p_S_I_M_D_<_T_,_S_,_A_D_> ifTrue, _L_o_o_p_S_I_M_D_<_T_,_S_,_A_D_> ifFalse) { │ │ │ │ │ +381 _L_o_o_p_S_I_M_D_<_T_,_S_,_A_D_> out; │ │ │ │ │ +382 for(std::size_t i=0; i │ │ │ │ │ +_3_8_9 auto _c_o_n_d(_A_D_L_T_a_g<5, std::is_same >::value │ │ │ │ │ +390 && Simd::lanes() == _S_i_m_d_:_:_l_a_n_e_s<_L_o_o_p_S_I_M_D_<_T_,_S_,_A_> >()>, │ │ │ │ │ +391 M _m_a_s_k, _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> ifTrue, _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> ifFalse) │ │ │ │ │ +392 { │ │ │ │ │ +393 _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> out; │ │ │ │ │ +394 for(auto l : _r_a_n_g_e(_S_i_m_d_:_:_l_a_n_e_s(_m_a_s_k))) │ │ │ │ │ +395 _S_i_m_d_:_:_l_a_n_e(l, out) = _S_i_m_d_:_:_l_a_n_e(l, _m_a_s_k) ? _S_i_m_d_:_:_l_a_n_e(l, ifTrue) : _S_i_m_d_:_: │ │ │ │ │ +_l_a_n_e(l, ifFalse); │ │ │ │ │ +396 return out; │ │ │ │ │ +397 } │ │ │ │ │ +398 │ │ │ │ │ +399 template │ │ │ │ │ +_4_0_0 bool _a_n_y_T_r_u_e(_A_D_L_T_a_g_<_5_>, _L_o_o_p_S_I_M_D_<_M_,_S_,_A_> _m_a_s_k) { │ │ │ │ │ +401 bool out = false; │ │ │ │ │ +402 for(std::size_t i=0; i │ │ │ │ │ +_4_0_9 bool _a_l_l_T_r_u_e(_A_D_L_T_a_g_<_5_>, _L_o_o_p_S_I_M_D_<_M_,_S_,_A_> _m_a_s_k) { │ │ │ │ │ +410 bool out = true; │ │ │ │ │ +411 for(std::size_t i=0; i │ │ │ │ │ +_4_1_8 bool _a_n_y_F_a_l_s_e(_A_D_L_T_a_g_<_5_>, _L_o_o_p_S_I_M_D_<_M_,_S_,_A_> _m_a_s_k) { │ │ │ │ │ +419 bool out = false; │ │ │ │ │ +420 for(std::size_t i=0; i │ │ │ │ │ +_4_2_7 bool _a_l_l_F_a_l_s_e(_A_D_L_T_a_g_<_5_>, _L_o_o_p_S_I_M_D_<_M_,_S_,_A_> _m_a_s_k) { │ │ │ │ │ +428 bool out = true; │ │ │ │ │ +429 for(std::size_t i=0; i>::value> > \ │ │ │ │ │ +449 auto expr(const LoopSIMD &v) { \ │ │ │ │ │ +450 using std::expr; \ │ │ │ │ │ +451 LoopSIMD out; \ │ │ │ │ │ +452 for(std::size_t i=0; i>::value> > \ │ │ │ │ │ +462 auto expr(const LoopSIMD &v) { \ │ │ │ │ │ +463 using std::expr; \ │ │ │ │ │ +464 LoopSIMD out; \ │ │ │ │ │ +465 for(std::size_t i=0; i \ │ │ │ │ │ +542 auto expr(const LoopSIMD &v) { \ │ │ │ │ │ +543 using std::expr; \ │ │ │ │ │ +544 LoopSIMD out; \ │ │ │ │ │ +545 for(std::size_t i=0; i \ │ │ │ │ │ +552 auto expr(const LoopSIMD,S,A> &v) { \ │ │ │ │ │ +553 using std::expr; \ │ │ │ │ │ +554 LoopSIMD out; \ │ │ │ │ │ +555 for(std::size_t i=0; i \ │ │ │ │ │ +569 auto expr(const LoopSIMD &v, const LoopSIMD &w) { \ │ │ │ │ │ +570 using std::expr; \ │ │ │ │ │ +571 LoopSIMD out; \ │ │ │ │ │ +572 for(std::size_t i=0; i │ │ │ │ │ +_5_8_6 auto _i_s_N_a_N(const _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> &v, _P_r_i_o_r_i_t_y_T_a_g_<_3_>, _A_D_L_T_a_g) { │ │ │ │ │ +587 _S_i_m_d_:_:_M_a_s_k_<_L_o_o_p_S_I_M_D_<_T_,_S_,_A_>> out; │ │ │ │ │ +588 for(auto l : _r_a_n_g_e(S)) │ │ │ │ │ +589 out[l] = Dune::isNaN(v[l]); │ │ │ │ │ +590 return out; │ │ │ │ │ +591 } │ │ │ │ │ +592 │ │ │ │ │ +593 template │ │ │ │ │ +_5_9_4 auto _i_s_I_n_f(const _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> &v, _P_r_i_o_r_i_t_y_T_a_g_<_3_>, _A_D_L_T_a_g) { │ │ │ │ │ +595 _S_i_m_d_:_:_M_a_s_k_<_L_o_o_p_S_I_M_D_<_T_,_S_,_A_>> out; │ │ │ │ │ +596 for(auto l : _r_a_n_g_e(S)) │ │ │ │ │ +597 out[l] = Dune::isInf(v[l]); │ │ │ │ │ +598 return out; │ │ │ │ │ +599 } │ │ │ │ │ +600 │ │ │ │ │ +601 template │ │ │ │ │ +_6_0_2 auto _i_s_F_i_n_i_t_e(const _L_o_o_p_S_I_M_D_<_T_,_S_,_A_> &v, _P_r_i_o_r_i_t_y_T_a_g_<_3_>, _A_D_L_T_a_g) { │ │ │ │ │ +603 _S_i_m_d_:_:_M_a_s_k_<_L_o_o_p_S_I_M_D_<_T_,_S_,_A_>> out; │ │ │ │ │ +604 for(auto l : _r_a_n_g_e(S)) │ │ │ │ │ +605 out[l] = Dune::isFinite(v[l]); │ │ │ │ │ +606 return out; │ │ │ │ │ +607 } │ │ │ │ │ +608 } //namespace MathOverloads │ │ │ │ │ +609 │ │ │ │ │ +610 template │ │ │ │ │ +_6_1_1 struct _I_s_N_u_m_b_e_r<_L_o_o_p_S_I_M_D> : │ │ │ │ │ +612 public std::integral_constant::value>{ │ │ │ │ │ +613 }; │ │ │ │ │ +614 │ │ │ │ │ +615#ifdef CLANG_WARNING_DISABLED │ │ │ │ │ +616# pragma clang diagnostic pop │ │ │ │ │ +617# undef CLANG_WARNING_DISABLED │ │ │ │ │ +618#endif │ │ │ │ │ +619 │ │ │ │ │ +620#ifdef GCC_WARNING_DISABLED │ │ │ │ │ +621# pragma GCC diagnostic pop │ │ │ │ │ +622# undef GCC_WARNING_DISABLED │ │ │ │ │ +623#endif │ │ │ │ │ +624 │ │ │ │ │ +625} //namespace Dune │ │ │ │ │ +626 │ │ │ │ │ +627#endif │ │ │ │ │ +_m_a_t_h_._h_h │ │ │ │ │ +Some useful basic math stuff. │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___B_I_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_SIMD_LOOP_BINARY_OP(SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:177 │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___B_O_O_L_E_A_N___O_P │ │ │ │ │ +#define DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:289 │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___B_I_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_SIMD_LOOP_STD_BINARY_OP(expr) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:567 │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___S_T_D___U_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_SIMD_LOOP_STD_UNARY_OP(expr) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:540 │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___B_I_T_S_H_I_F_T___O_P │ │ │ │ │ +#define DUNE_SIMD_LOOP_BITSHIFT_OP(SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:221 │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_SIMD_LOOP_CMATH_UNARY_OP(expr) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:446 │ │ │ │ │ +_D_U_N_E___P_R_A_G_M_A___O_M_P___S_I_M_D │ │ │ │ │ +#define DUNE_PRAGMA_OMP_SIMD │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:49 │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___C_M_A_T_H___U_N_A_R_Y___O_P___W_I_T_H___R_E_T_U_R_N │ │ │ │ │ +#define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN(expr, returnType) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:459 │ │ │ │ │ +_D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P │ │ │ │ │ +#define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:145 │ │ │ │ │ _t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ Traits for type conversions and type information. │ │ │ │ │ -_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ -Macro for wrapping boundary checks. │ │ │ │ │ -_d_e_n_s_e_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implements a matrix constructed from a given type representing a field and a │ │ │ │ │ -compile-time given numbe... │ │ │ │ │ -_d_y_n_v_e_c_t_o_r_._h_h │ │ │ │ │ -This file implements a dense vector with a dynamic size. │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ -#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ -If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ -nothing. │ │ │ │ │ -DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t │ │ │ │ │ +std::integral_constant< std::size_t, i > index_constant │ │ │ │ │ +An index constant with value i. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ +static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ +>, std::integral_constant< T, to >) noexcept │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(const Mask &mask) │ │ │ │ │ +Whether any entry is true │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:429 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_c_o_n_d │ │ │ │ │ +V cond(M &&mask, const V &ifTrue, const V &ifFalse) │ │ │ │ │ +Like the ?: operator. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:386 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_l_l_T_r_u_e │ │ │ │ │ +bool allTrue(const Mask &mask) │ │ │ │ │ +Whether all entries are true │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:439 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ +bool anyFalse(const Mask &mask) │ │ │ │ │ +Whether any entry is false │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ +constexpr std::size_t lanes() │ │ │ │ │ +Number of lanes in a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ +decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ +Extract an element of a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_M_a_s_k │ │ │ │ │ +Rebind< bool, V > Mask │ │ │ │ │ +Mask type type of some SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:289 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ +bool allFalse(const Mask &mask) │ │ │ │ │ +Whether all entries are false │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:459 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ +typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ +Element type of some SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k │ │ │ │ │ +Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) │ │ │ │ │ +implements Simd::mask() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ +bool allFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::allFalse() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:124 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e │ │ │ │ │ +bool allTrue(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::allTrue() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ +bool anyFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::anyFalse() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:114 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x │ │ │ │ │ -A dense n x m matrix. │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -derived_type & operator=(const RHS &rhs) │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:279 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_M │ │ │ │ │ -constexpr size_type M() const │ │ │ │ │ -number of columns │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:703 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -Traits::value_type value_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:157 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_o_w_s │ │ │ │ │ -constexpr size_type rows() const │ │ │ │ │ -number of rows │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:709 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_N │ │ │ │ │ -constexpr size_type N() const │ │ │ │ │ -number of rows │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:697 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Traits::size_type size_type │ │ │ │ │ -The type used for the index access and size operation. │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:166 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ -Construct a matrix with a dynamic size. │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___c_o_l_s │ │ │ │ │ -size_type mat_cols() const │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ -DynamicMatrix(std::initializer_list< DynamicVector< K > > const &ll) │ │ │ │ │ -Constructor initializing the matrix from a list of vector. │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ -Base::row_type row_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_t_r_a_n_s_p_o_s_e_d │ │ │ │ │ -DynamicMatrix transposed() const │ │ │ │ │ -Return transposed of the matrix as DynamicMatrix. │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:132 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -Base::value_type value_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___a_c_c_e_s_s │ │ │ │ │ -row_type & mat_access(size_type i) │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Base::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___r_o_w_s │ │ │ │ │ -size_type mat_rows() const │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ -DynamicMatrix(T const &rhs) │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___a_c_c_e_s_s │ │ │ │ │ -const row_type & mat_access(size_type i) const │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:151 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_r_e_s_i_z_e │ │ │ │ │ -void resize(size_type r, size_type c, value_type v=value_type()) │ │ │ │ │ -resize matrix to r × c │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -DynamicMatrix & operator=(T const &rhs) │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ -DynamicMatrix() │ │ │ │ │ -Default constructor. │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ -DynamicMatrix(size_type r, size_type c, value_type v=value_type()) │ │ │ │ │ -Constructor initializing the whole matrix with a scalar. │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -DynamicMatrix & operator=(T scalar) │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -container_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_o_w___t_y_p_e │ │ │ │ │ -DynamicVector< K > row_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ -row_type & row_reference │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -K value_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ -DynamicMatrix< K > derived_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ -const row_type & const_row_reference │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_c_o_n_t_a_i_n_e_r___t_y_p_e │ │ │ │ │ -std::vector< K > container_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -FieldTraits< K >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -FieldTraits< K >::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn dynmatrix.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ -Construct a vector with a dynamic size. │ │ │ │ │ -DDeeffiinniittiioonn dynvector.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -T field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -T real_type │ │ │ │ │ -export the type representing the real type of the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn matvectraits.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_D_U_N_E___S_I_M_D___L_O_O_P___C_O_M_P_A_R_I_S_O_N___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_COMPARISON_OP(<) │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:543 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d │ │ │ │ │ +const AlignedNumber< T, align > & cond(ADLTag< 5 >, AlignedNumber< bool, align │ │ │ │ │ +> mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align │ │ │ │ │ +> &ifFalse) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:535 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e │ │ │ │ │ +T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N │ │ │ │ │ +bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:604 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f │ │ │ │ │ +bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:594 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e │ │ │ │ │ +auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:584 │ │ │ │ │ +_D_u_n_e_:_:_I_s_N_u_m_b_e_r │ │ │ │ │ +Whether this type acts as a scalar in the context of (hierarchically blocked) │ │ │ │ │ +containers. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +Tag to make sure the functions in this namespace can be found by ADL. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ +DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t │ │ │ │ │ +should be derived from a Dune::index_constant │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_L_o_o_p_S_I_M_D │ │ │ │ │ +LoopSIMD(Simd::Scalar< T > i) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___P_R_E_F_I_X___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_PREFIX_OP(++) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_o_p_e_r_a_t_o_r_! │ │ │ │ │ +auto operator!() const │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:121 │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___P_O_S_T_F_I_X___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_POSTFIX_OP(--) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_ASSIGNMENT_OP * DUNE_SIMD_LOOP_ASSIGNMENT_OP(/ │ │ │ │ │ +=);DUNE_SIMD_LOOP_ASSIGNMENT_OP(%= │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_ASSIGNMENT_OP & DUNE_SIMD_LOOP_ASSIGNMENT_OP │ │ │ │ │ +(|=);DUNE_SIMD_LOOP_ASSIGNMENT_OP(^= │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___U_N_A_R_Y___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_UNARY_OP(-) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___P_R_E_F_I_X___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_PREFIX_OP(--) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___P_O_S_T_F_I_X___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_POSTFIX_OP(++) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_ASSIGNMENT_OP(-=) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_L_o_o_p_S_I_M_D │ │ │ │ │ +LoopSIMD(const LoopSIMD< T, S, OA > &other) │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_L_o_o_p_S_I_M_D │ │ │ │ │ +LoopSIMD() │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___U_N_A_R_Y___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_UNARY_OP(~) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_ASSIGNMENT_OP(+=) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___U_N_A_R_Y___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_UNARY_OP(+) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_ASSIGNMENT_OP(<<=) │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D_:_:_D_U_N_E___S_I_M_D___L_O_O_P___A_S_S_I_G_N_M_E_N_T___O_P │ │ │ │ │ +DUNE_SIMD_LOOP_ASSIGNMENT_OP(> >=) │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_<_ _L_o_o_p_S_I_M_D_<_ _T_,_ _S_,_ _A_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +Simd::Scalar< T > type │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:345 │ │ │ │ │ +_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g │ │ │ │ │ +Helper class for tagging priorities. │ │ │ │ │ +DDeeffiinniittiioonn typeutilities.hh:73 │ │ │ │ │ +_s_i_m_d_._h_h │ │ │ │ │ +Include file for users of the SIMD abstraction layer. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00146.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: shared_ptr.hh File Reference │ │ │ │ +dune-common: simd.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,56 +72,94 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ +Typedefs | │ │ │ │ Functions
    │ │ │ │ -
    shared_ptr.hh File Reference
    │ │ │ │ +
    simd.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    This file implements several utilities related to std::shared_ptr. │ │ │ │ +

    Abstractions for support of dedicated SIMD data types. │ │ │ │ More...

    │ │ │ │ -
    #include <memory>
    │ │ │ │ -#include <dune/common/typetraits.hh>
    │ │ │ │ +
    #include <cassert>
    │ │ │ │ +#include <cstddef>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <utility>
    │ │ │ │ +#include <dune/common/conditional.hh>
    │ │ │ │ +#include <dune/common/debugalign.hh>
    │ │ │ │ +#include <dune/common/rangeutilities.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │ +#include <dune/common/vc.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::null_deleter< T >
     implements the Deleter concept of shared_ptr without deleting anything More...
    struct  Dune::SimdScalarTypeTraits< T >
     
    struct  Dune::SimdScalarTypeTraits< AlignedNumber< T, align > >
     deduce the underlying scalar data type of an AlignedNumber More...
     
    struct  Dune::SimdIndexTypeTraits< V, typename >
     
    struct  Dune::SimdMaskTypeTraits< V, typename >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

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

    │ │ │ │ +Typedefs

    template<typename T >
    using Dune::SimdScalar = typename SimdScalarTypeTraits< T >::type
     
    template<typename V >
    using Dune::SimdIndex = typename SimdIndexTypeTraits< V >::type
     An simd vector of indices corresponding to a simd vector V.
     
    template<typename V >
    using Dune::SimdMask = typename SimdMaskTypeTraits< V >::type
     A simd vector of truth values corresponding to a simd vector V.
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<typename T >
    std::shared_ptr< T > Dune::stackobject_to_shared_ptr (T &t)
     Create a shared_ptr for a stack-allocated object.
     
    template<class T >
    auto Dune::wrap_or_move (T &&t)
     Capture R-value reference to shared_ptr.
     
    template<class T >
    auto Dune::wrap_or_move (T &t)
     Capture L-value reference to std::shared_ptr.
     
    template<class T >
    std::size_t Dune::lanes (const T &)
     get the number of lanes of a simd vector (scalar version)
     
    template<class T >
    Dune::lane (std::size_t l, const T &v)
     access a lane of a simd vector (scalar version)
     
    template<class T >
    T & Dune::lane (std::size_t l, T &v)
     access a lane of a simd vector (scalar version)
     
    template<class T >
    void Dune::assign (T &dst, const T &src, bool mask)
     masked Simd assignment (scalar version)
     
    template<class T >
    void Dune::swap (T &v1, T &v2, bool mask)
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    This file implements several utilities related to std::shared_ptr.

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

    Abstractions for support of dedicated SIMD data types.

    │ │ │ │ +

    Libraries like Vc (https://github.com/VcDevel/Vc) add high-level data types for SIMD (or vectorization) support in C++. Most of these operations mimic the behavior of a numerical data type. Some boolean operations can not be implemented in a compatible way to trivial data types.

    │ │ │ │ +

    This header contains additional abstractions to help writing code that works with trivial numerical data types (like double) and Vc vectorization data types.

    │ │ │ │ +

    See also the conditional.hh and range_utils.hh headers.

    │ │ │ │ +
    Deprecated:
    Use the newer simd architecture from dune/common/simd/simd.hh instead.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,40 +1,79 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -shared_ptr.hh File Reference │ │ │ │ │ -This file implements several utilities related to std::shared_ptr. _M_o_r_e_._._. │ │ │ │ │ -#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 │ │ │ │ │ +simd.hh File Reference │ │ │ │ │ +Abstractions for support of dedicated SIMD data types. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_o_n_d_i_t_i_o_n_a_l_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_b_u_g_a_l_i_g_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ #include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_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_:_:_n_u_l_l___d_e_l_e_t_e_r_<_ _T_ _> │ │ │ │ │ -  implements the Deleter concept of shared_ptr without deleting anything │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _> │ │ │ │ │ +  deduce the underlying scalar data type of an AlignedNumber _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s_<_ _V_,_ _t_y_p_e_n_a_m_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s_<_ _V_,_ _t_y_p_e_n_a_m_e_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ template │ │ │ │ │ -std::shared_ptr< T >  _D_u_n_e_:_:_s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r (T &t) │ │ │ │ │ -  Create a shared_ptr for a stack-allocated object. │ │ │ │ │ +using  _D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r = typename _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s< T >::type │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_S_i_m_d_I_n_d_e_x = typename _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s< V >::type │ │ │ │ │ +  An simd vector of indices corresponding to a simd vector V. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_S_i_m_d_M_a_s_k = typename _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s< V >::type │ │ │ │ │ +  A simd vector of truth values corresponding to a simd vector V. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::size_t  _D_u_n_e_:_:_l_a_n_e_s (const T &) │ │ │ │ │ +  get the number of lanes of a simd vector (scalar version) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + T  _D_u_n_e_:_:_l_a_n_e (std::size_t l, const T &v) │ │ │ │ │ +  access a lane of a simd vector (scalar version) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + T &  _D_u_n_e_:_:_l_a_n_e (std::size_t l, T &v) │ │ │ │ │ +  access a lane of a simd vector (scalar version) │ │ │ │ │   │ │ │ │ │ template │ │ │ │ │ - auto  _D_u_n_e_:_:_w_r_a_p___o_r___m_o_v_e (T &&t) │ │ │ │ │ -  Capture R-value reference to shared_ptr. │ │ │ │ │ + void  _D_u_n_e_:_:_a_s_s_i_g_n (T &dst, const T &src, bool mask) │ │ │ │ │ +  masked _S_i_m_d assignment (scalar version) │ │ │ │ │   │ │ │ │ │ template │ │ │ │ │ - auto  _D_u_n_e_:_:_w_r_a_p___o_r___m_o_v_e (T &t) │ │ │ │ │ -  Capture L-value reference to std::shared_ptr. │ │ │ │ │ + void  _D_u_n_e_:_:_s_w_a_p (T &v1, T &v2, bool mask) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements several utilities related to std::shared_ptr. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +Abstractions for support of dedicated SIMD data types. │ │ │ │ │ +Libraries like Vc (_h_t_t_p_s_:_/_/_g_i_t_h_u_b_._c_o_m_/_V_c_D_e_v_e_l_/_V_c) add high-level data types for │ │ │ │ │ +SIMD (or vectorization) support in C++. Most of these operations mimic the │ │ │ │ │ +behavior of a numerical data type. Some boolean operations can not be │ │ │ │ │ +implemented in a compatible way to trivial data types. │ │ │ │ │ +This header contains additional abstractions to help writing code that works │ │ │ │ │ +with trivial numerical data types (like double) and Vc vectorization data │ │ │ │ │ +types. │ │ │ │ │ +See also the _c_o_n_d_i_t_i_o_n_a_l_._h_h and range_utils.hh headers. │ │ │ │ │ + _DD_ee_pp_rr_ee_cc_aa_tt_ee_dd_:: │ │ │ │ │ + Use the newer simd architecture from _d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h instead. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00146_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: shared_ptr.hh Source File │ │ │ │ +dune-common: simd.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,72 +74,518 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    shared_ptr.hh
    │ │ │ │ +
    simd.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_HH
    │ │ │ │ +
    4#define DUNE_COMMON_SIMD_HH
    │ │ │ │
    5
    │ │ │ │ -
    6#ifndef DUNE_SHARED_PTR_HH
    │ │ │ │ -
    7#define DUNE_SHARED_PTR_HH
    │ │ │ │ +
    6#warning dune/common/simd.hh is deprecated.
    │ │ │ │ +
    7#warning Use the new infrastructure from dune/common/simd/simd.h instead.
    │ │ │ │
    8
    │ │ │ │ -
    9#include <memory>
    │ │ │ │ -
    10
    │ │ │ │ - │ │ │ │ -
    17namespace Dune
    │ │ │ │ -
    18{
    │ │ │ │ -
    47 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    49 {
    │ │ │ │ -
    50 void operator() (T*) const {}
    │ │ │ │ -
    51 };
    │ │ │ │ -
    │ │ │ │ +
    30#include <cassert>
    │ │ │ │ +
    31#include <cstddef>
    │ │ │ │ +
    32#include <type_traits>
    │ │ │ │ +
    33#include <utility>
    │ │ │ │ +
    34
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    38#if HAVE_VC
    │ │ │ │ +
    39// include Vc part of new simd interface to provide compatibility for
    │ │ │ │ +
    40// functionality that has been switched over.
    │ │ │ │ + │ │ │ │ +
    42#endif
    │ │ │ │ + │ │ │ │ +
    44#include <dune/common/vc.hh>
    │ │ │ │ +
    45
    │ │ │ │ +
    46namespace Dune
    │ │ │ │ +
    47{
    │ │ │ │ +
    48
    │ │ │ │ +
    49#if HAVE_VC
    │ │ │ │ +
    50 namespace VcImpl {
    │ │ │ │
    52
    │ │ │ │ -
    71 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    72 inline std::shared_ptr<T> stackobject_to_shared_ptr(T & t)
    │ │ │ │ -
    73 {
    │ │ │ │ -
    74 return std::shared_ptr<T>(&t, null_deleter<T>());
    │ │ │ │ -
    75 }
    │ │ │ │ -
    │ │ │ │ -
    76
    │ │ │ │ -
    77
    │ │ │ │ -
    95 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    96 auto wrap_or_move(T&& t)
    │ │ │ │ -
    97 {
    │ │ │ │ -
    98 return std::make_shared<std::decay_t<T>>(std::forward<T>(t));
    │ │ │ │ -
    99 }
    │ │ │ │ -
    │ │ │ │ -
    100
    │ │ │ │ -
    118 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    119 auto wrap_or_move(T& t)
    │ │ │ │ -
    120 {
    │ │ │ │ - │ │ │ │ -
    122 }
    │ │ │ │ -
    │ │ │ │ -
    123
    │ │ │ │ -
    124}
    │ │ │ │ -
    125#endif
    │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ +
    61 template<class V>
    │ │ │ │ +
    62 class Proxy
    │ │ │ │ +
    63 {
    │ │ │ │ +
    64 static_assert(std::is_same<V, std::decay_t<V> >::value, "Class Proxy "
    │ │ │ │ +
    65 "may only be instantiated with unqualified types");
    │ │ │ │ +
    66 public:
    │ │ │ │ +
    67 using value_type = typename V::value_type;
    │ │ │ │ +
    68
    │ │ │ │ +
    69 private:
    │ │ │ │ +
    70 static_assert(std::is_arithmetic<value_type>::value,
    │ │ │ │ +
    71 "Only arithmetic types are supported");
    │ │ │ │ +
    72 V &vec_;
    │ │ │ │ +
    73 std::size_t idx_;
    │ │ │ │ +
    74
    │ │ │ │ +
    75 public:
    │ │ │ │ +
    76 Proxy(std::size_t idx, V &vec)
    │ │ │ │ +
    77 : vec_(vec), idx_(idx)
    │ │ │ │ +
    78 { }
    │ │ │ │ +
    79
    │ │ │ │ +
    80 operator value_type() const { return vec_[idx_]; }
    │ │ │ │ +
    81
    │ │ │ │ +
    82 // postfix operators
    │ │ │ │ +
    83
    │ │ │ │ +
    84 template<class T = value_type,
    │ │ │ │ +
    85 class = std::enable_if_t<!std::is_same<T, bool>::value> >
    │ │ │ │ +
    86 value_type operator++(int) { return vec_[idx_]++; }
    │ │ │ │ +
    87 template<class T = value_type,
    │ │ │ │ +
    88 class = std::enable_if_t<!std::is_same<T, bool>::value> >
    │ │ │ │ +
    89 value_type operator--(int) { return vec_[idx_]--; }
    │ │ │ │ +
    90
    │ │ │ │ +
    91 // unary (prefix) operators
    │ │ │ │ +
    92 template<class T = value_type,
    │ │ │ │ +
    93 class = std::enable_if_t<!std::is_same<T, bool>::value> >
    │ │ │ │ +
    94 Proxy &operator++() { ++(vec_[idx_]); return *this; }
    │ │ │ │ +
    95 template<class T = value_type,
    │ │ │ │ +
    96 class = std::enable_if_t<!std::is_same<T, bool>::value> >
    │ │ │ │ +
    97 Proxy &operator--() { --(vec_[idx_]); return *this; }
    │ │ │ │ +
    98 decltype(auto) operator!() const { return !(vec_[idx_]); }
    │ │ │ │ +
    99 decltype(auto) operator+() const { return +(vec_[idx_]); }
    │ │ │ │ +
    100 decltype(auto) operator-() const { return -(vec_[idx_]); }
    │ │ │ │ +
    101 template<class T = value_type,
    │ │ │ │ +
    102 class = std::enable_if_t<std::is_integral<T>::value> >
    │ │ │ │ +
    103 decltype(auto) operator~() const { return ~(vec_[idx_]); }
    │ │ │ │ +
    104
    │ │ │ │ +
    105 // binary operators
    │ │ │ │ +
    106#define DUNE_SIMD_VC_BINARY_OP(OP) \
    │ │ │ │ +
    107 template<class T> \
    │ │ │ │ +
    108 auto operator OP(T &&o) const \
    │ │ │ │ +
    109 -> decltype(vec_[idx_] OP valueCast(std::forward<T>(o))) \
    │ │ │ │ +
    110 { \
    │ │ │ │ +
    111 return vec_[idx_] OP valueCast(std::forward<T>(o)); \
    │ │ │ │ +
    112 } \
    │ │ │ │ +
    113 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    114
    │ │ │ │ +
    115 DUNE_SIMD_VC_BINARY_OP(*);
    │ │ │ │ +
    116 DUNE_SIMD_VC_BINARY_OP(/);
    │ │ │ │ +
    117 DUNE_SIMD_VC_BINARY_OP(%);
    │ │ │ │ +
    118
    │ │ │ │ +
    119 DUNE_SIMD_VC_BINARY_OP(+);
    │ │ │ │ +
    120 DUNE_SIMD_VC_BINARY_OP(-);
    │ │ │ │ +
    121
    │ │ │ │ +
    122 DUNE_SIMD_VC_BINARY_OP(<<);
    │ │ │ │ +
    123 DUNE_SIMD_VC_BINARY_OP(>>);
    │ │ │ │ +
    124
    │ │ │ │ +
    125 DUNE_SIMD_VC_BINARY_OP(<);
    │ │ │ │ +
    126 DUNE_SIMD_VC_BINARY_OP(>);
    │ │ │ │ +
    127 DUNE_SIMD_VC_BINARY_OP(<=);
    │ │ │ │ +
    128 DUNE_SIMD_VC_BINARY_OP(>=);
    │ │ │ │ +
    129
    │ │ │ │ +
    130 DUNE_SIMD_VC_BINARY_OP(==);
    │ │ │ │ +
    131 DUNE_SIMD_VC_BINARY_OP(!=);
    │ │ │ │ +
    132
    │ │ │ │ +
    133 DUNE_SIMD_VC_BINARY_OP(&);
    │ │ │ │ +
    134 DUNE_SIMD_VC_BINARY_OP(^);
    │ │ │ │ +
    135 DUNE_SIMD_VC_BINARY_OP(|);
    │ │ │ │ +
    136
    │ │ │ │ +
    137 DUNE_SIMD_VC_BINARY_OP(&&);
    │ │ │ │ +
    138 DUNE_SIMD_VC_BINARY_OP(||);
    │ │ │ │ +
    139#undef DUNE_SIMD_VC_BINARY_OP
    │ │ │ │ +
    140
    │ │ │ │ +
    141#define DUNE_SIMD_VC_ASSIGNMENT(OP) \
    │ │ │ │ +
    142 template<class T> \
    │ │ │ │ +
    143 auto operator OP(T &&o) \
    │ │ │ │ +
    144 -> std::enable_if_t<AlwaysTrue<decltype( \
    │ │ │ │ +
    145 vec_[idx_] OP valueCast(std::forward<T>(o)) \
    │ │ │ │ +
    146 )>::value, Proxy&> \
    │ │ │ │ +
    147 { \
    │ │ │ │ +
    148 vec_[idx_] OP valueCast(std::forward<T>(o)); \
    │ │ │ │ +
    149 return *this; \
    │ │ │ │ +
    150 } \
    │ │ │ │ +
    151 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    152
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    164#undef DUNE_SIMD_VC_ASSIGNMENT
    │ │ │ │ +
    165
    │ │ │ │ +
    166 // swap on proxies swaps the proxied vector entries. As such, it
    │ │ │ │ +
    167 // applies to rvalues of proxies too, not just lvalues
    │ │ │ │ +
    168 template<class V1, class V2>
    │ │ │ │ +
    169 friend void swap(Proxy<V1>, Proxy<V2>);
    │ │ │ │ +
    170
    │ │ │ │ +
    171 template<class T>
    │ │ │ │ +
    172 friend void swap(Proxy p1, T& s2)
    │ │ │ │ +
    173 {
    │ │ │ │ +
    174 // don't use swap() ourselves -- not supported by Vc 1.3.0 (but is
    │ │ │ │ +
    175 // supported by Vc 1.3.2)
    │ │ │ │ +
    176 T tmp = p1.vec_[p1.idx_];
    │ │ │ │ +
    177 p1.vec_[p1.idx_] = s2;
    │ │ │ │ +
    178 s2 = tmp;
    │ │ │ │ +
    179 }
    │ │ │ │ +
    180
    │ │ │ │ +
    181 template<class T>
    │ │ │ │ +
    182 friend void swap(T& s1, Proxy p2)
    │ │ │ │ +
    183 {
    │ │ │ │ +
    184 T tmp = s1;
    │ │ │ │ +
    185 s1 = p2.vec_[p2.idx_];
    │ │ │ │ +
    186 p2.vec_[p2.idx_] = tmp;
    │ │ │ │ +
    187 }
    │ │ │ │ +
    188 };
    │ │ │ │ +
    189
    │ │ │ │ +
    190 template<class V1, class V2>
    │ │ │ │ +
    191 void swap(Proxy<V1> p1, Proxy<V2> p2)
    │ │ │ │ +
    192 {
    │ │ │ │ +
    193 typename V1::value_type tmp = p1.vec_[p1.idx_];
    │ │ │ │ +
    194 p1.vec_[p1.idx_] = p2.vec_[p2.idx_];
    │ │ │ │ +
    195 p2.vec_[p2.idx_] = tmp;
    │ │ │ │ +
    196 }
    │ │ │ │ +
    197 } // namespace VcImpl
    │ │ │ │ +
    198#endif // HAVE_VC
    │ │ │ │ +
    199
    │ │ │ │ +
    200 template<typename T>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    202 {
    │ │ │ │ +
    203 using type = T;
    │ │ │ │ +
    204 };
    │ │ │ │ +
    │ │ │ │ +
    205
    │ │ │ │ +
    206 template<typename T>
    │ │ │ │ + │ │ │ │ +
    208
    │ │ │ │ +
    209#if HAVE_VC
    │ │ │ │ +
    210 /*
    │ │ │ │ +
    211 Add Vc specializations for the SimdScalarTypeTraits trais class
    │ │ │ │ +
    212 */
    │ │ │ │ +
    213 template<typename T, typename A>
    │ │ │ │ +
    214 struct SimdScalarTypeTraits< Vc::Vector<T,A> >
    │ │ │ │ +
    215 {
    │ │ │ │ +
    216 using type = T;
    │ │ │ │ +
    217 };
    │ │ │ │ +
    218
    │ │ │ │ +
    219 template<typename T, std::size_t N, typename V, std::size_t M>
    │ │ │ │ +
    220 struct SimdScalarTypeTraits< Vc::SimdArray<T,N,V,M> >
    │ │ │ │ +
    221 {
    │ │ │ │ +
    222 using type = T;
    │ │ │ │ +
    223 };
    │ │ │ │ +
    224#endif // HAVE_VC
    │ │ │ │ +
    225
    │ │ │ │ +
    227 template<typename T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    229 {
    │ │ │ │ +
    230 using type = T;
    │ │ │ │ +
    231 };
    │ │ │ │ +
    │ │ │ │ +
    232
    │ │ │ │ +
    233 template<typename V, typename = void>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    235 using type = std::size_t;
    │ │ │ │ +
    236 };
    │ │ │ │ +
    │ │ │ │ +
    237
    │ │ │ │ +
    239
    │ │ │ │ +
    245 template<typename V>
    │ │ │ │ + │ │ │ │ +
    247
    │ │ │ │ +
    248#if HAVE_VC
    │ │ │ │ +
    249 template<typename T, typename A>
    │ │ │ │ +
    250 struct SimdIndexTypeTraits<Vc::Vector<T, A> > {
    │ │ │ │ +
    251 using type = typename Vc::Vector<T, A>::index_type;
    │ │ │ │ +
    252 };
    │ │ │ │ +
    253
    │ │ │ │ +
    254 template<typename T, std::size_t n, typename V>
    │ │ │ │ +
    255 struct SimdIndexTypeTraits<Vc::SimdArray<T, n, V> > {
    │ │ │ │ +
    256 using type = typename Vc::SimdArray<T, n, V>::index_type;
    │ │ │ │ +
    257 };
    │ │ │ │ +
    258#endif // HAVE_VC
    │ │ │ │ +
    259
    │ │ │ │ +
    260 template<typename V, typename = void>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    262 using type = bool;
    │ │ │ │ +
    263 };
    │ │ │ │ +
    │ │ │ │ +
    264
    │ │ │ │ +
    266
    │ │ │ │ +
    269 template<typename V>
    │ │ │ │ + │ │ │ │ +
    271
    │ │ │ │ +
    272#if HAVE_VC
    │ │ │ │ +
    273 template<typename T, typename A>
    │ │ │ │ +
    274 struct SimdMaskTypeTraits<Vc::Vector<T, A> > {
    │ │ │ │ +
    275 using type = typename Vc::Vector<T, A>::mask_type;
    │ │ │ │ +
    276 };
    │ │ │ │ +
    277
    │ │ │ │ +
    278 template<typename T, std::size_t n, typename V>
    │ │ │ │ +
    279 struct SimdMaskTypeTraits<Vc::SimdArray<T, n, V> > {
    │ │ │ │ +
    280 using type = typename Vc::SimdArray<T, n, V>::mask_type;
    │ │ │ │ +
    281 };
    │ │ │ │ +
    282#endif // HAVE_VC
    │ │ │ │ +
    283
    │ │ │ │ +
    284#if HAVE_VC
    │ │ │ │ +
    285 /*
    │ │ │ │ +
    286 Add Vc specializations for cond(), see conditional.hh
    │ │ │ │ +
    287 */
    │ │ │ │ +
    288 template<typename T, typename A>
    │ │ │ │ +
    289 Vc::Vector<T,A> cond(const Vc::Mask<T,A> & b,
    │ │ │ │ +
    290 const Vc::Vector<T,A> & v1,
    │ │ │ │ +
    291 const Vc::Vector<T,A> & v2)
    │ │ │ │ +
    292 {
    │ │ │ │ +
    293 return std::move(Vc::iif(b, v1, v2));
    │ │ │ │ +
    294 }
    │ │ │ │ +
    295
    │ │ │ │ +
    296 template<typename T, std::size_t N, typename V, std::size_t M>
    │ │ │ │ +
    297 Vc::SimdArray<T,N,V,M> cond(const typename Vc::SimdArray<T,N,V,M>::mask_type & b,
    │ │ │ │ +
    298 const Vc::SimdArray<T,N,V,M> & v1,
    │ │ │ │ +
    299 const Vc::SimdArray<T,N,V,M> & v2)
    │ │ │ │ +
    300 {
    │ │ │ │ +
    301 return std::move(Vc::iif(b, v1, v2));
    │ │ │ │ +
    302 }
    │ │ │ │ +
    303#endif // HAVE_VC
    │ │ │ │ +
    304
    │ │ │ │ +
    305#if HAVE_VC
    │ │ │ │ +
    306 /*
    │ │ │ │ +
    307 Add Vc specializations for several boolean operations, see rangeutitlities.hh:
    │ │ │ │ +
    308
    │ │ │ │ +
    309 max_value, min_value, any_true, all_true
    │ │ │ │ +
    310 */
    │ │ │ │ +
    311 template<typename T, typename A>
    │ │ │ │ +
    312 T max_value(const Vc::Vector<T,A> & v)
    │ │ │ │ +
    313 {
    │ │ │ │ +
    314 return v.max();
    │ │ │ │ +
    315 }
    │ │ │ │ +
    316
    │ │ │ │ +
    317 template<typename T, std::size_t N, typename V, std::size_t M>
    │ │ │ │ +
    318 double max_value(const Vc::SimdArray<T,N,V,M> & v)
    │ │ │ │ +
    319 {
    │ │ │ │ +
    320 return v.max();
    │ │ │ │ +
    321 }
    │ │ │ │ +
    322
    │ │ │ │ +
    323 template<typename T, typename A>
    │ │ │ │ +
    324 T min_value(const Vc::Vector<T,A> & v)
    │ │ │ │ +
    325 {
    │ │ │ │ +
    326 return v.min();
    │ │ │ │ +
    327 }
    │ │ │ │ +
    328
    │ │ │ │ +
    329 template<typename T, std::size_t N, typename V, std::size_t M>
    │ │ │ │ +
    330 double min_value(const Vc::SimdArray<T,N,V,M> & v)
    │ │ │ │ +
    331 {
    │ │ │ │ +
    332 return v.min();
    │ │ │ │ +
    333 }
    │ │ │ │ +
    334
    │ │ │ │ +
    335 template<typename T, typename A>
    │ │ │ │ +
    336 bool any_true(const Vc::Mask<T,A> & v)
    │ │ │ │ +
    337 {
    │ │ │ │ +
    338 return Vc::any_of(v);
    │ │ │ │ +
    339 }
    │ │ │ │ +
    340
    │ │ │ │ +
    341 template<typename T, std::size_t N, typename V, std::size_t M>
    │ │ │ │ +
    342 bool any_true(const Vc::SimdMaskArray<T,N,V,M> & v)
    │ │ │ │ +
    343 {
    │ │ │ │ +
    344 return Vc::any_of(v);
    │ │ │ │ +
    345 }
    │ │ │ │ +
    346
    │ │ │ │ +
    347 template<typename T, typename A>
    │ │ │ │ +
    348 bool all_true(const Vc::Mask<T,A> & v)
    │ │ │ │ +
    349 {
    │ │ │ │ +
    350 return Vc::all_of(v);
    │ │ │ │ +
    351 }
    │ │ │ │ +
    352
    │ │ │ │ +
    353 template<typename T, std::size_t N, typename V, std::size_t M>
    │ │ │ │ +
    354 bool all_true(const Vc::SimdMaskArray<T,N,V,M> & v)
    │ │ │ │ +
    355 {
    │ │ │ │ +
    356 return Vc::all_of(v);
    │ │ │ │ +
    357 }
    │ │ │ │ +
    358#endif // HAVE_VC
    │ │ │ │ +
    359
    │ │ │ │ +
    361 template<class T>
    │ │ │ │ +
    362 std::size_t lanes(const T &) { return 1; }
    │ │ │ │ +
    363
    │ │ │ │ +
    365 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    366 T lane(std::size_t l, const T &v)
    │ │ │ │ +
    367 {
    │ │ │ │ +
    368 assert(l == 0);
    │ │ │ │ +
    369 return v;
    │ │ │ │ +
    370 }
    │ │ │ │ +
    │ │ │ │ +
    371
    │ │ │ │ +
    373 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    374 T &lane(std::size_t l, T &v)
    │ │ │ │ +
    375 {
    │ │ │ │ +
    376 assert(l == 0);
    │ │ │ │ +
    377 return v;
    │ │ │ │ +
    378 }
    │ │ │ │ +
    │ │ │ │ +
    379
    │ │ │ │ +
    380#if HAVE_VC
    │ │ │ │ +
    381 template<class T, class A>
    │ │ │ │ +
    382 std::size_t lanes(const Vc::Vector<T, A> &)
    │ │ │ │ +
    383 {
    │ │ │ │ +
    384 return Vc::Vector<T, A>::size();
    │ │ │ │ +
    385 }
    │ │ │ │ +
    386
    │ │ │ │ +
    387 template<class T, class A>
    │ │ │ │ +
    388 T lane(std::size_t l, const Vc::Vector<T, A> &v)
    │ │ │ │ +
    389 {
    │ │ │ │ +
    390 assert(l < lanes(v));
    │ │ │ │ +
    391 return v[l];
    │ │ │ │ +
    392 }
    │ │ │ │ +
    393
    │ │ │ │ +
    394 template<class T, class A>
    │ │ │ │ +
    395 auto lane(std::size_t l, Vc::Vector<T, A> &v)
    │ │ │ │ +
    396 {
    │ │ │ │ +
    397 assert(l < lanes(v));
    │ │ │ │ +
    398 return VcImpl::Proxy<Vc::Vector<T, A> >{l, v};
    │ │ │ │ +
    399 }
    │ │ │ │ +
    400
    │ │ │ │ +
    401 template<class T, std::size_t n, class V>
    │ │ │ │ +
    402 std::size_t lanes(const Vc::SimdArray<T, n, V> &)
    │ │ │ │ +
    403 {
    │ │ │ │ +
    404 return n;
    │ │ │ │ +
    405 }
    │ │ │ │ +
    406
    │ │ │ │ +
    407 template<class T, std::size_t n, class V>
    │ │ │ │ +
    408 T lane(std::size_t l, const Vc::SimdArray<T, n, V> &v)
    │ │ │ │ +
    409 {
    │ │ │ │ +
    410 assert(l < n);
    │ │ │ │ +
    411 return v[l];
    │ │ │ │ +
    412 }
    │ │ │ │ +
    413
    │ │ │ │ +
    414 template<class T, std::size_t n, class V>
    │ │ │ │ +
    415 auto lane(std::size_t l, Vc::SimdArray<T, n, V> &v)
    │ │ │ │ +
    416 {
    │ │ │ │ +
    417 assert(l < n);
    │ │ │ │ +
    418 return VcImpl::Proxy<Vc::SimdArray<T, n, V> >{l, v};
    │ │ │ │ +
    419 }
    │ │ │ │ +
    420
    │ │ │ │ +
    421 template<class T, std::size_t n, class V>
    │ │ │ │ +
    422 std::size_t lanes(const Vc::SimdMaskArray<T, n, V> &)
    │ │ │ │ +
    423 {
    │ │ │ │ +
    424 return n;
    │ │ │ │ +
    425 }
    │ │ │ │ +
    426
    │ │ │ │ +
    427 template<class T, std::size_t n, class V>
    │ │ │ │ +
    428 bool lane(std::size_t l, const Vc::SimdMaskArray<T, n, V> &v)
    │ │ │ │ +
    429 {
    │ │ │ │ +
    430 assert(l < n);
    │ │ │ │ +
    431 return v[l];
    │ │ │ │ +
    432 }
    │ │ │ │ +
    433
    │ │ │ │ +
    434 template<class T, std::size_t n, class V>
    │ │ │ │ +
    435 auto lane(std::size_t l, Vc::SimdMaskArray<T, n, V> &v)
    │ │ │ │ +
    436 {
    │ │ │ │ +
    437 assert(l < n);
    │ │ │ │ +
    438 return VcImpl::Proxy<Vc::SimdMaskArray<T, n, V> >{l, v};
    │ │ │ │ +
    439 }
    │ │ │ │ +
    440#endif // HAVE_VC
    │ │ │ │ +
    441
    │ │ │ │ +
    443
    │ │ │ │ +
    446 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    447 void assign(T &dst, const T &src, bool mask)
    │ │ │ │ +
    448 {
    │ │ │ │ +
    449 if(mask) dst = src;
    │ │ │ │ +
    450 }
    │ │ │ │ +
    │ │ │ │ +
    451
    │ │ │ │ +
    452#if HAVE_VC
    │ │ │ │ +
    453 /*
    │ │ │ │ +
    454 Add Vc specializations for masked assignment
    │ │ │ │ +
    455 */
    │ │ │ │ +
    456 template<class T, class A>
    │ │ │ │ +
    457 void assign(Vc::Vector<T, A> &dst, const Vc::Vector<T, A> &src,
    │ │ │ │ +
    458 typename Vc::Vector<T, A>::mask_type mask)
    │ │ │ │ +
    459 {
    │ │ │ │ +
    460 dst(mask) = src;
    │ │ │ │ +
    461 }
    │ │ │ │ +
    462
    │ │ │ │ +
    463 template<class T, std::size_t n, class V>
    │ │ │ │ +
    464 void assign(Vc::SimdArray<T, n, V> &dst, const Vc::SimdArray<T, n, V> &src,
    │ │ │ │ +
    465 typename Vc::SimdArray<T, n, V>::mask_type mask)
    │ │ │ │ +
    466 {
    │ │ │ │ +
    467 dst(mask) = src;
    │ │ │ │ +
    468 }
    │ │ │ │ +
    469#endif // HAVE_VC
    │ │ │ │ +
    470
    │ │ │ │ +
    471 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    472 void swap(T &v1, T &v2, bool mask)
    │ │ │ │ +
    473 {
    │ │ │ │ +
    474 using std::swap;
    │ │ │ │ +
    475 if(mask) swap(v1, v2);
    │ │ │ │ +
    476 }
    │ │ │ │ +
    │ │ │ │ +
    477
    │ │ │ │ +
    478#if HAVE_VC
    │ │ │ │ +
    479 /*
    │ │ │ │ +
    480 Add Vc specializations for masked swap
    │ │ │ │ +
    481 */
    │ │ │ │ +
    482 template<class T, class A>
    │ │ │ │ +
    483 void swap(Vc::Vector<T, A> &v1, Vc::Vector<T, A> &v2,
    │ │ │ │ +
    484 typename Vc::Vector<T, A>::mask_type mask)
    │ │ │ │ +
    485 {
    │ │ │ │ +
    486 auto tmp = v1;
    │ │ │ │ +
    487 v1(mask) = v2;
    │ │ │ │ +
    488 v2(mask) = tmp;
    │ │ │ │ +
    489 }
    │ │ │ │ +
    490
    │ │ │ │ +
    491 template<class T, std::size_t n, class V>
    │ │ │ │ +
    492 void swap(Vc::SimdArray<T, n, V> &v1, Vc::SimdArray<T, n, V> &v2,
    │ │ │ │ +
    493 typename Vc::SimdArray<T, n, V>::mask_type mask)
    │ │ │ │ +
    494 {
    │ │ │ │ +
    495 auto tmp = v1;
    │ │ │ │ +
    496 v1(mask) = v2;
    │ │ │ │ +
    497 v2(mask) = tmp;
    │ │ │ │ +
    498 }
    │ │ │ │ +
    499#endif // HAVE_VC
    │ │ │ │ +
    500
    │ │ │ │ +
    501} // end namespace Dune
    │ │ │ │ +
    502
    │ │ │ │ +
    503#endif // DUNE_COMMON_SIMD_HH
    │ │ │ │ +
    Utilities for reduction like operations on ranges.
    │ │ │ │ +
    Compatibility header for including <Vc/Vc>
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
    Create a shared_ptr for a stack-allocated object.
    Definition shared_ptr.hh:72
    │ │ │ │ -
    auto wrap_or_move(T &&t)
    Capture R-value reference to shared_ptr.
    Definition shared_ptr.hh:96
    │ │ │ │ -
    implements the Deleter concept of shared_ptr without deleting anything
    Definition shared_ptr.hh:49
    │ │ │ │ -
    std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
    Create a shared_ptr for a stack-allocated object.
    Definition shared_ptr.hh:72
    │ │ │ │ -
    void operator()(T *) const
    Definition shared_ptr.hh:50
    │ │ │ │ +
    bool any_true(const AlignedNumber< bool, align > &val)
    Definition debugalign.hh:493
    │ │ │ │ +
    bool all_true(const AlignedNumber< bool, align > &val)
    Definition debugalign.hh:499
    │ │ │ │ +
    typename SimdIndexTypeTraits< V >::type SimdIndex
    An simd vector of indices corresponding to a simd vector V.
    Definition simd.hh:246
    │ │ │ │ +
    typename SimdScalarTypeTraits< T >::type SimdScalar
    Definition simd.hh:207
    │ │ │ │ +
    typename SimdMaskTypeTraits< V >::type SimdMask
    A simd vector of truth values corresponding to a simd vector V.
    Definition simd.hh:270
    │ │ │ │ +
    T lane(std::size_t l, const T &v)
    access a lane of a simd vector (scalar version)
    Definition simd.hh:366
    │ │ │ │ +
    void swap(T &v1, T &v2, bool mask)
    Definition simd.hh:472
    │ │ │ │ +
    void assign(T &dst, const T &src, bool mask)
    masked Simd assignment (scalar version)
    Definition simd.hh:447
    │ │ │ │ +
    const T1 cond(bool b, const T1 &v1, const T2 &v2)
    conditional evaluate
    Definition conditional.hh:28
    │ │ │ │ +
    T max_value(const AlignedNumber< T, align > &val)
    Definition debugalign.hh:481
    │ │ │ │ +
    T min_value(const AlignedNumber< T, align > &val)
    Definition debugalign.hh:487
    │ │ │ │ +
    std::size_t lanes(const T &)
    get the number of lanes of a simd vector (scalar version)
    Definition simd.hh:362
    │ │ │ │ +
    aligned wrappers for arithmetic types
    Definition debugalign.hh:115
    │ │ │ │ +
    Definition simd.hh:202
    │ │ │ │ +
    T type
    Definition simd.hh:203
    │ │ │ │ + │ │ │ │ +
    Definition simd.hh:234
    │ │ │ │ +
    std::size_t type
    Definition simd.hh:235
    │ │ │ │ +
    Definition simd.hh:261
    │ │ │ │ +
    bool type
    Definition simd.hh:262
    │ │ │ │ +
    SIMD abstractions for Vc.
    │ │ │ │ +
    #define DUNE_SIMD_VC_ASSIGNMENT(OP)
    Definition simd/vc.hh:224
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,74 +1,549 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -shared_ptr.hh │ │ │ │ │ +simd.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_SIMD_HH │ │ │ │ │ +4#define DUNE_COMMON_SIMD_HH │ │ │ │ │ 5 │ │ │ │ │ -6#ifndef DUNE_SHARED_PTR_HH │ │ │ │ │ -7#define DUNE_SHARED_PTR_HH │ │ │ │ │ +6#warning dune/common/simd.hh is deprecated. │ │ │ │ │ +7#warning Use the new infrastructure from dune/common/simd/simd.h instead. │ │ │ │ │ 8 │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -17namespace _D_u_n_e │ │ │ │ │ -18{ │ │ │ │ │ -47 template │ │ │ │ │ -_4_8 struct _n_u_l_l___d_e_l_e_t_e_r │ │ │ │ │ -49 { │ │ │ │ │ -_5_0 void _o_p_e_r_a_t_o_r_(_)_ (T*) const {} │ │ │ │ │ -51 }; │ │ │ │ │ +30#include │ │ │ │ │ +31#include │ │ │ │ │ +32#include │ │ │ │ │ +33#include │ │ │ │ │ +34 │ │ │ │ │ +35#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_o_n_d_i_t_i_o_n_a_l_._h_h> │ │ │ │ │ +36#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_b_u_g_a_l_i_g_n_._h_h> │ │ │ │ │ +37#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +38#if HAVE_VC │ │ │ │ │ +39// include Vc part of new simd interface to provide compatibility for │ │ │ │ │ +40// functionality that has been switched over. │ │ │ │ │ +41#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_v_c_._h_h> │ │ │ │ │ +42#endif │ │ │ │ │ +43#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +44#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_c_._h_h> │ │ │ │ │ +45 │ │ │ │ │ +46namespace _D_u_n_e │ │ │ │ │ +47{ │ │ │ │ │ +48 │ │ │ │ │ +49#if HAVE_VC │ │ │ │ │ +50 namespace VcImpl { │ │ │ │ │ 52 │ │ │ │ │ -71 template │ │ │ │ │ -_7_2 inline std::shared_ptr _s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r(T & t) │ │ │ │ │ -73 { │ │ │ │ │ -74 return std::shared_ptr(&t, _n_u_l_l___d_e_l_e_t_e_r_<_T_>()); │ │ │ │ │ -75 } │ │ │ │ │ -76 │ │ │ │ │ -77 │ │ │ │ │ -95 template │ │ │ │ │ -_9_6 auto _w_r_a_p___o_r___m_o_v_e(T&& t) │ │ │ │ │ -97 { │ │ │ │ │ -98 return std::make_shared>(std::forward(t)); │ │ │ │ │ -99 } │ │ │ │ │ -100 │ │ │ │ │ -118 template │ │ │ │ │ -_1_1_9 auto _w_r_a_p___o_r___m_o_v_e(T& t) │ │ │ │ │ -120 { │ │ │ │ │ -121 return _s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r(t); │ │ │ │ │ -122 } │ │ │ │ │ -123 │ │ │ │ │ -124} │ │ │ │ │ -125#endif │ │ │ │ │ +61 template │ │ │ │ │ +62 class Proxy │ │ │ │ │ +63 { │ │ │ │ │ +64 static_assert(std::is_same >::value, "Class Proxy " │ │ │ │ │ +65 "may only be instantiated with unqualified types"); │ │ │ │ │ +66 public: │ │ │ │ │ +67 using value_type = typename V::value_type; │ │ │ │ │ +68 │ │ │ │ │ +69 private: │ │ │ │ │ +70 static_assert(std::is_arithmetic::value, │ │ │ │ │ +71 "Only arithmetic types are supported"); │ │ │ │ │ +72 V &vec_; │ │ │ │ │ +73 std::size_t idx_; │ │ │ │ │ +74 │ │ │ │ │ +75 public: │ │ │ │ │ +76 Proxy(std::size_t idx, V &vec) │ │ │ │ │ +77 : vec_(vec), idx_(idx) │ │ │ │ │ +78 { } │ │ │ │ │ +79 │ │ │ │ │ +80 operator value_type() const { return vec_[idx_]; } │ │ │ │ │ +81 │ │ │ │ │ +82 // postfix operators │ │ │ │ │ +83 │ │ │ │ │ +84 template::value> > │ │ │ │ │ +86 value_type operator++(int) { return vec_[idx_]++; } │ │ │ │ │ +87 template::value> > │ │ │ │ │ +89 value_type operator--(int) { return vec_[idx_]--; } │ │ │ │ │ +90 │ │ │ │ │ +91 // unary (prefix) operators │ │ │ │ │ +92 template::value> > │ │ │ │ │ +94 Proxy &operator++() { ++(vec_[idx_]); return *this; } │ │ │ │ │ +95 template::value> > │ │ │ │ │ +97 Proxy &operator--() { --(vec_[idx_]); return *this; } │ │ │ │ │ +98 decltype(auto) operator!() const { return !(vec_[idx_]); } │ │ │ │ │ +99 decltype(auto) operator+() const { return +(vec_[idx_]); } │ │ │ │ │ +100 decltype(auto) operator-() const { return -(vec_[idx_]); } │ │ │ │ │ +101 template::value> > │ │ │ │ │ +103 decltype(auto) operator~() const { return ~(vec_[idx_]); } │ │ │ │ │ +104 │ │ │ │ │ +105 // binary operators │ │ │ │ │ +106#define DUNE_SIMD_VC_BINARY_OP(OP) \ │ │ │ │ │ +107 template \ │ │ │ │ │ +108 auto operator OP(T &&o) const \ │ │ │ │ │ +109 -> decltype(vec_[idx_] OP valueCast(std::forward(o))) \ │ │ │ │ │ +110 { \ │ │ │ │ │ +111 return vec_[idx_] OP valueCast(std::forward(o)); \ │ │ │ │ │ +112 } \ │ │ │ │ │ +113 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +114 │ │ │ │ │ +115 DUNE_SIMD_VC_BINARY_OP(*); │ │ │ │ │ +116 DUNE_SIMD_VC_BINARY_OP(/); │ │ │ │ │ +117 DUNE_SIMD_VC_BINARY_OP(%); │ │ │ │ │ +118 │ │ │ │ │ +119 DUNE_SIMD_VC_BINARY_OP(+); │ │ │ │ │ +120 DUNE_SIMD_VC_BINARY_OP(-); │ │ │ │ │ +121 │ │ │ │ │ +122 DUNE_SIMD_VC_BINARY_OP(<<); │ │ │ │ │ +123 DUNE_SIMD_VC_BINARY_OP(>>); │ │ │ │ │ +124 │ │ │ │ │ +125 DUNE_SIMD_VC_BINARY_OP(<); │ │ │ │ │ +126 DUNE_SIMD_VC_BINARY_OP(>); │ │ │ │ │ +127 DUNE_SIMD_VC_BINARY_OP(<=); │ │ │ │ │ +128 DUNE_SIMD_VC_BINARY_OP(>=); │ │ │ │ │ +129 │ │ │ │ │ +130 DUNE_SIMD_VC_BINARY_OP(==); │ │ │ │ │ +131 DUNE_SIMD_VC_BINARY_OP(!=); │ │ │ │ │ +132 │ │ │ │ │ +133 DUNE_SIMD_VC_BINARY_OP(&); │ │ │ │ │ +134 DUNE_SIMD_VC_BINARY_OP(^); │ │ │ │ │ +135 DUNE_SIMD_VC_BINARY_OP(|); │ │ │ │ │ +136 │ │ │ │ │ +137 DUNE_SIMD_VC_BINARY_OP(&&); │ │ │ │ │ +138 DUNE_SIMD_VC_BINARY_OP(||); │ │ │ │ │ +139#undef DUNE_SIMD_VC_BINARY_OP │ │ │ │ │ +140 │ │ │ │ │ +141#define DUNE_SIMD_VC_ASSIGNMENT(OP) \ │ │ │ │ │ +142 template \ │ │ │ │ │ +143 auto operator OP(T &&o) \ │ │ │ │ │ +144 -> std::enable_if_t(o)) \ │ │ │ │ │ +146 )>::value, Proxy&> \ │ │ │ │ │ +147 { \ │ │ │ │ │ +148 vec_[idx_] OP valueCast(std::forward(o)); \ │ │ │ │ │ +149 return *this; \ │ │ │ │ │ +150 } \ │ │ │ │ │ +151 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +152 │ │ │ │ │ +153 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(=); │ │ │ │ │ +154 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(*=); │ │ │ │ │ +155 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(/=); │ │ │ │ │ +156 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(%=); │ │ │ │ │ +157 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(+=); │ │ │ │ │ +158 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(-=); │ │ │ │ │ +159 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(<<=); │ │ │ │ │ +160 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(>>=); │ │ │ │ │ +161 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(&=); │ │ │ │ │ +162 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(^=); │ │ │ │ │ +163 _D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T(|=); │ │ │ │ │ +164#undef DUNE_SIMD_VC_ASSIGNMENT │ │ │ │ │ +165 │ │ │ │ │ +166 // swap on proxies swaps the proxied vector entries. As such, it │ │ │ │ │ +167 // applies to rvalues of proxies too, not just lvalues │ │ │ │ │ +168 template │ │ │ │ │ +169 friend void _s_w_a_p(Proxy, Proxy); │ │ │ │ │ +170 │ │ │ │ │ +171 template │ │ │ │ │ +172 friend void _s_w_a_p(Proxy p1, T& s2) │ │ │ │ │ +173 { │ │ │ │ │ +174 // don't use swap() ourselves -- not supported by Vc 1.3.0 (but is │ │ │ │ │ +175 // supported by Vc 1.3.2) │ │ │ │ │ +176 T tmp = p1.vec_[p1.idx_]; │ │ │ │ │ +177 p1.vec_[p1.idx_] = s2; │ │ │ │ │ +178 s2 = tmp; │ │ │ │ │ +179 } │ │ │ │ │ +180 │ │ │ │ │ +181 template │ │ │ │ │ +182 friend void _s_w_a_p(T& s1, Proxy p2) │ │ │ │ │ +183 { │ │ │ │ │ +184 T tmp = s1; │ │ │ │ │ +185 s1 = p2.vec_[p2.idx_]; │ │ │ │ │ +186 p2.vec_[p2.idx_] = tmp; │ │ │ │ │ +187 } │ │ │ │ │ +188 }; │ │ │ │ │ +189 │ │ │ │ │ +190 template │ │ │ │ │ +191 void _s_w_a_p(Proxy p1, Proxy p2) │ │ │ │ │ +192 { │ │ │ │ │ +193 typename V1::value_type tmp = p1.vec_[p1.idx_]; │ │ │ │ │ +194 p1.vec_[p1.idx_] = p2.vec_[p2.idx_]; │ │ │ │ │ +195 p2.vec_[p2.idx_] = tmp; │ │ │ │ │ +196 } │ │ │ │ │ +197 } // namespace VcImpl │ │ │ │ │ +198#endif // HAVE_VC │ │ │ │ │ +199 │ │ │ │ │ +200 template │ │ │ │ │ +_2_0_1 struct _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ +202 { │ │ │ │ │ +_2_0_3 using _t_y_p_e = T; │ │ │ │ │ +204 }; │ │ │ │ │ +205 │ │ │ │ │ +206 template │ │ │ │ │ +_2_0_7 using _S_i_m_d_S_c_a_l_a_r = typename _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_T_>_:_:_t_y_p_e; │ │ │ │ │ +208 │ │ │ │ │ +209#if HAVE_VC │ │ │ │ │ +210 /* │ │ │ │ │ +211 Add Vc specializations for the SimdScalarTypeTraits trais class │ │ │ │ │ +212 */ │ │ │ │ │ +213 template │ │ │ │ │ +214 struct _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s< Vc::Vector > │ │ │ │ │ +215 { │ │ │ │ │ +216 using _t_y_p_e = T; │ │ │ │ │ +217 }; │ │ │ │ │ +218 │ │ │ │ │ +219 template │ │ │ │ │ +220 struct SimdScalarTypeTraits< Vc::SimdArray > │ │ │ │ │ +221 { │ │ │ │ │ +222 using _t_y_p_e = T; │ │ │ │ │ +223 }; │ │ │ │ │ +224#endif // HAVE_VC │ │ │ │ │ +225 │ │ │ │ │ +227 template │ │ │ │ │ +_2_2_8 struct _S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s< _A_l_i_g_n_e_d_N_u_m_b_e_r > │ │ │ │ │ +229 { │ │ │ │ │ +_2_3_0 using _t_y_p_e = T; │ │ │ │ │ +231 }; │ │ │ │ │ +232 │ │ │ │ │ +233 template │ │ │ │ │ +_2_3_4 struct _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s { │ │ │ │ │ +_2_3_5 using _t_y_p_e = std::size_t; │ │ │ │ │ +236 }; │ │ │ │ │ +237 │ │ │ │ │ +239 │ │ │ │ │ +245 template │ │ │ │ │ +_2_4_6 using _S_i_m_d_I_n_d_e_x = typename _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s_<_V_>_:_:_t_y_p_e; │ │ │ │ │ +247 │ │ │ │ │ +248#if HAVE_VC │ │ │ │ │ +249 template │ │ │ │ │ +250 struct _S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s > { │ │ │ │ │ +251 using _t_y_p_e = typename Vc::Vector::index_type; │ │ │ │ │ +252 }; │ │ │ │ │ +253 │ │ │ │ │ +254 template │ │ │ │ │ +255 struct SimdIndexTypeTraits > { │ │ │ │ │ +256 using _t_y_p_e = typename Vc::SimdArray::index_type; │ │ │ │ │ +257 }; │ │ │ │ │ +258#endif // HAVE_VC │ │ │ │ │ +259 │ │ │ │ │ +260 template │ │ │ │ │ +_2_6_1 struct _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s { │ │ │ │ │ +_2_6_2 using _t_y_p_e = bool; │ │ │ │ │ +263 }; │ │ │ │ │ +264 │ │ │ │ │ +266 │ │ │ │ │ +269 template │ │ │ │ │ +_2_7_0 using _S_i_m_d_M_a_s_k = typename _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s_<_V_>_:_:_t_y_p_e; │ │ │ │ │ +271 │ │ │ │ │ +272#if HAVE_VC │ │ │ │ │ +273 template │ │ │ │ │ +274 struct _S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s > { │ │ │ │ │ +275 using _t_y_p_e = typename Vc::Vector::mask_type; │ │ │ │ │ +276 }; │ │ │ │ │ +277 │ │ │ │ │ +278 template │ │ │ │ │ +279 struct SimdMaskTypeTraits > { │ │ │ │ │ +280 using _t_y_p_e = typename Vc::SimdArray::mask_type; │ │ │ │ │ +281 }; │ │ │ │ │ +282#endif // HAVE_VC │ │ │ │ │ +283 │ │ │ │ │ +284#if HAVE_VC │ │ │ │ │ +285 /* │ │ │ │ │ +286 Add Vc specializations for cond(), see conditional.hh │ │ │ │ │ +287 */ │ │ │ │ │ +288 template │ │ │ │ │ +289 Vc::Vector _c_o_n_d(const Vc::Mask & b, │ │ │ │ │ +290 const Vc::Vector & v1, │ │ │ │ │ +291 const Vc::Vector & v2) │ │ │ │ │ +292 { │ │ │ │ │ +293 return std::move(Vc::iif(b, v1, v2)); │ │ │ │ │ +294 } │ │ │ │ │ +295 │ │ │ │ │ +296 template │ │ │ │ │ +297 Vc::SimdArray _c_o_n_d(const typename Vc::SimdArray:: │ │ │ │ │ +mask_type & b, │ │ │ │ │ +298 const Vc::SimdArray & v1, │ │ │ │ │ +299 const Vc::SimdArray & v2) │ │ │ │ │ +300 { │ │ │ │ │ +301 return std::move(Vc::iif(b, v1, v2)); │ │ │ │ │ +302 } │ │ │ │ │ +303#endif // HAVE_VC │ │ │ │ │ +304 │ │ │ │ │ +305#if HAVE_VC │ │ │ │ │ +306 /* │ │ │ │ │ +307 Add Vc specializations for several boolean operations, see │ │ │ │ │ +rangeutitlities.hh: │ │ │ │ │ +308 │ │ │ │ │ +309 max_value, min_value, any_true, all_true │ │ │ │ │ +310 */ │ │ │ │ │ +311 template │ │ │ │ │ +312 T _m_a_x___v_a_l_u_e(const Vc::Vector & v) │ │ │ │ │ +313 { │ │ │ │ │ +314 return v.max(); │ │ │ │ │ +315 } │ │ │ │ │ +316 │ │ │ │ │ +317 template │ │ │ │ │ +318 double _m_a_x___v_a_l_u_e(const Vc::SimdArray & v) │ │ │ │ │ +319 { │ │ │ │ │ +320 return v.max(); │ │ │ │ │ +321 } │ │ │ │ │ +322 │ │ │ │ │ +323 template │ │ │ │ │ +324 T _m_i_n___v_a_l_u_e(const Vc::Vector & v) │ │ │ │ │ +325 { │ │ │ │ │ +326 return v.min(); │ │ │ │ │ +327 } │ │ │ │ │ +328 │ │ │ │ │ +329 template │ │ │ │ │ +330 double _m_i_n___v_a_l_u_e(const Vc::SimdArray & v) │ │ │ │ │ +331 { │ │ │ │ │ +332 return v.min(); │ │ │ │ │ +333 } │ │ │ │ │ +334 │ │ │ │ │ +335 template │ │ │ │ │ +336 bool _a_n_y___t_r_u_e(const Vc::Mask & v) │ │ │ │ │ +337 { │ │ │ │ │ +338 return Vc::any_of(v); │ │ │ │ │ +339 } │ │ │ │ │ +340 │ │ │ │ │ +341 template │ │ │ │ │ +342 bool _a_n_y___t_r_u_e(const Vc::SimdMaskArray & v) │ │ │ │ │ +343 { │ │ │ │ │ +344 return Vc::any_of(v); │ │ │ │ │ +345 } │ │ │ │ │ +346 │ │ │ │ │ +347 template │ │ │ │ │ +348 bool _a_l_l___t_r_u_e(const Vc::Mask & v) │ │ │ │ │ +349 { │ │ │ │ │ +350 return Vc::all_of(v); │ │ │ │ │ +351 } │ │ │ │ │ +352 │ │ │ │ │ +353 template │ │ │ │ │ +354 bool _a_l_l___t_r_u_e(const Vc::SimdMaskArray & v) │ │ │ │ │ +355 { │ │ │ │ │ +356 return Vc::all_of(v); │ │ │ │ │ +357 } │ │ │ │ │ +358#endif // HAVE_VC │ │ │ │ │ +359 │ │ │ │ │ +361 template │ │ │ │ │ +_3_6_2 std::size_t _l_a_n_e_s(const T &) { return 1; } │ │ │ │ │ +363 │ │ │ │ │ +365 template │ │ │ │ │ +_3_6_6 T _l_a_n_e(std::size_t l, const T &v) │ │ │ │ │ +367 { │ │ │ │ │ +368 assert(l == 0); │ │ │ │ │ +369 return v; │ │ │ │ │ +370 } │ │ │ │ │ +371 │ │ │ │ │ +373 template │ │ │ │ │ +_3_7_4 T &_l_a_n_e(std::size_t l, T &v) │ │ │ │ │ +375 { │ │ │ │ │ +376 assert(l == 0); │ │ │ │ │ +377 return v; │ │ │ │ │ +378 } │ │ │ │ │ +379 │ │ │ │ │ +380#if HAVE_VC │ │ │ │ │ +381 template │ │ │ │ │ +382 std::size_t _l_a_n_e_s(const Vc::Vector &) │ │ │ │ │ +383 { │ │ │ │ │ +384 return Vc::Vector::size(); │ │ │ │ │ +385 } │ │ │ │ │ +386 │ │ │ │ │ +387 template │ │ │ │ │ +388 T _l_a_n_e(std::size_t l, const Vc::Vector &v) │ │ │ │ │ +389 { │ │ │ │ │ +390 assert(l < _l_a_n_e_s(v)); │ │ │ │ │ +391 return v[l]; │ │ │ │ │ +392 } │ │ │ │ │ +393 │ │ │ │ │ +394 template │ │ │ │ │ +395 auto _l_a_n_e(std::size_t l, Vc::Vector &v) │ │ │ │ │ +396 { │ │ │ │ │ +397 assert(l < _l_a_n_e_s(v)); │ │ │ │ │ +398 return VcImpl::Proxy >{l, v}; │ │ │ │ │ +399 } │ │ │ │ │ +400 │ │ │ │ │ +401 template │ │ │ │ │ +402 std::size_t _l_a_n_e_s(const Vc::SimdArray &) │ │ │ │ │ +403 { │ │ │ │ │ +404 return n; │ │ │ │ │ +405 } │ │ │ │ │ +406 │ │ │ │ │ +407 template │ │ │ │ │ +408 T _l_a_n_e(std::size_t l, const Vc::SimdArray &v) │ │ │ │ │ +409 { │ │ │ │ │ +410 assert(l < n); │ │ │ │ │ +411 return v[l]; │ │ │ │ │ +412 } │ │ │ │ │ +413 │ │ │ │ │ +414 template │ │ │ │ │ +415 auto _l_a_n_e(std::size_t l, Vc::SimdArray &v) │ │ │ │ │ +416 { │ │ │ │ │ +417 assert(l < n); │ │ │ │ │ +418 return VcImpl::Proxy >{l, v}; │ │ │ │ │ +419 } │ │ │ │ │ +420 │ │ │ │ │ +421 template │ │ │ │ │ +422 std::size_t _l_a_n_e_s(const Vc::SimdMaskArray &) │ │ │ │ │ +423 { │ │ │ │ │ +424 return n; │ │ │ │ │ +425 } │ │ │ │ │ +426 │ │ │ │ │ +427 template │ │ │ │ │ +428 bool _l_a_n_e(std::size_t l, const Vc::SimdMaskArray &v) │ │ │ │ │ +429 { │ │ │ │ │ +430 assert(l < n); │ │ │ │ │ +431 return v[l]; │ │ │ │ │ +432 } │ │ │ │ │ +433 │ │ │ │ │ +434 template │ │ │ │ │ +435 auto _l_a_n_e(std::size_t l, Vc::SimdMaskArray &v) │ │ │ │ │ +436 { │ │ │ │ │ +437 assert(l < n); │ │ │ │ │ +438 return VcImpl::Proxy >{l, v}; │ │ │ │ │ +439 } │ │ │ │ │ +440#endif // HAVE_VC │ │ │ │ │ +441 │ │ │ │ │ +443 │ │ │ │ │ +446 template │ │ │ │ │ +_4_4_7 void _a_s_s_i_g_n(T &dst, const T &src, bool mask) │ │ │ │ │ +448 { │ │ │ │ │ +449 if(mask) dst = src; │ │ │ │ │ +450 } │ │ │ │ │ +451 │ │ │ │ │ +452#if HAVE_VC │ │ │ │ │ +453 /* │ │ │ │ │ +454 Add Vc specializations for masked assignment │ │ │ │ │ +455 */ │ │ │ │ │ +456 template │ │ │ │ │ +457 void _a_s_s_i_g_n(Vc::Vector &dst, const Vc::Vector &src, │ │ │ │ │ +458 typename Vc::Vector::mask_type mask) │ │ │ │ │ +459 { │ │ │ │ │ +460 dst(mask) = src; │ │ │ │ │ +461 } │ │ │ │ │ +462 │ │ │ │ │ +463 template │ │ │ │ │ +464 void _a_s_s_i_g_n(Vc::SimdArray &dst, const Vc::SimdArray &src, │ │ │ │ │ +465 typename Vc::SimdArray::mask_type mask) │ │ │ │ │ +466 { │ │ │ │ │ +467 dst(mask) = src; │ │ │ │ │ +468 } │ │ │ │ │ +469#endif // HAVE_VC │ │ │ │ │ +470 │ │ │ │ │ +471 template │ │ │ │ │ +_4_7_2 void _s_w_a_p(T &v1, T &v2, bool mask) │ │ │ │ │ +473 { │ │ │ │ │ +474 using std::swap; │ │ │ │ │ +475 if(mask) _s_w_a_p(v1, v2); │ │ │ │ │ +476 } │ │ │ │ │ +477 │ │ │ │ │ +478#if HAVE_VC │ │ │ │ │ +479 /* │ │ │ │ │ +480 Add Vc specializations for masked swap │ │ │ │ │ +481 */ │ │ │ │ │ +482 template │ │ │ │ │ +483 void _s_w_a_p(Vc::Vector &v1, Vc::Vector &v2, │ │ │ │ │ +484 typename Vc::Vector::mask_type mask) │ │ │ │ │ +485 { │ │ │ │ │ +486 auto tmp = v1; │ │ │ │ │ +487 v1(mask) = v2; │ │ │ │ │ +488 v2(mask) = tmp; │ │ │ │ │ +489 } │ │ │ │ │ +490 │ │ │ │ │ +491 template │ │ │ │ │ +492 void _s_w_a_p(Vc::SimdArray &v1, Vc::SimdArray &v2, │ │ │ │ │ +493 typename Vc::SimdArray::mask_type mask) │ │ │ │ │ +494 { │ │ │ │ │ +495 auto tmp = v1; │ │ │ │ │ +496 v1(mask) = v2; │ │ │ │ │ +497 v2(mask) = tmp; │ │ │ │ │ +498 } │ │ │ │ │ +499#endif // HAVE_VC │ │ │ │ │ +500 │ │ │ │ │ +501} // end namespace Dune │ │ │ │ │ +502 │ │ │ │ │ +503#endif // DUNE_COMMON_SIMD_HH │ │ │ │ │ +_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +Utilities for reduction like operations on ranges. │ │ │ │ │ +_v_c_._h_h │ │ │ │ │ +Compatibility header for including │ │ │ │ │ +_d_e_b_u_g_a_l_i_g_n_._h_h │ │ │ │ │ +_c_o_n_d_i_t_i_o_n_a_l_._h_h │ │ │ │ │ _t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ Traits for type conversions and type information. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r │ │ │ │ │ -std::shared_ptr< T > stackobject_to_shared_ptr(T &t) │ │ │ │ │ -Create a shared_ptr for a stack-allocated object. │ │ │ │ │ -DDeeffiinniittiioonn shared_ptr.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_w_r_a_p___o_r___m_o_v_e │ │ │ │ │ -auto wrap_or_move(T &&t) │ │ │ │ │ -Capture R-value reference to shared_ptr. │ │ │ │ │ -DDeeffiinniittiioonn shared_ptr.hh:96 │ │ │ │ │ -_D_u_n_e_:_:_n_u_l_l___d_e_l_e_t_e_r │ │ │ │ │ -implements the Deleter concept of shared_ptr without deleting anything │ │ │ │ │ -DDeeffiinniittiioonn shared_ptr.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_n_u_l_l___d_e_l_e_t_e_r_:_:_s_t_a_c_k_o_b_j_e_c_t___t_o___s_h_a_r_e_d___p_t_r │ │ │ │ │ -std::shared_ptr< T > stackobject_to_shared_ptr(T &t) │ │ │ │ │ -Create a shared_ptr for a stack-allocated object. │ │ │ │ │ -DDeeffiinniittiioonn shared_ptr.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_n_u_l_l___d_e_l_e_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(T *) const │ │ │ │ │ -DDeeffiinniittiioonn shared_ptr.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_a_n_y___t_r_u_e │ │ │ │ │ +bool any_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:493 │ │ │ │ │ +_D_u_n_e_:_:_a_l_l___t_r_u_e │ │ │ │ │ +bool all_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:499 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_I_n_d_e_x │ │ │ │ │ +typename SimdIndexTypeTraits< V >::type SimdIndex │ │ │ │ │ +An simd vector of indices corresponding to a simd vector V. │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:246 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r │ │ │ │ │ +typename SimdScalarTypeTraits< T >::type SimdScalar │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:207 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_M_a_s_k │ │ │ │ │ +typename SimdMaskTypeTraits< V >::type SimdMask │ │ │ │ │ +A simd vector of truth values corresponding to a simd vector V. │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:270 │ │ │ │ │ +_D_u_n_e_:_:_l_a_n_e │ │ │ │ │ +T lane(std::size_t l, const T &v) │ │ │ │ │ +access a lane of a simd vector (scalar version) │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:366 │ │ │ │ │ +_D_u_n_e_:_:_s_w_a_p │ │ │ │ │ +void swap(T &v1, T &v2, bool mask) │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:472 │ │ │ │ │ +_D_u_n_e_:_:_a_s_s_i_g_n │ │ │ │ │ +void assign(T &dst, const T &src, bool mask) │ │ │ │ │ +masked Simd assignment (scalar version) │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:447 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_d │ │ │ │ │ +const T1 cond(bool b, const T1 &v1, const T2 &v2) │ │ │ │ │ +conditional evaluate │ │ │ │ │ +DDeeffiinniittiioonn conditional.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_m_a_x___v_a_l_u_e │ │ │ │ │ +T max_value(const AlignedNumber< T, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:481 │ │ │ │ │ +_D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ +T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:487 │ │ │ │ │ +_D_u_n_e_:_:_l_a_n_e_s │ │ │ │ │ +std::size_t lanes(const T &) │ │ │ │ │ +get the number of lanes of a simd vector (scalar version) │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:362 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ +aligned wrappers for arithmetic types │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:202 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ +T type │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:203 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +T type │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:234 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_I_n_d_e_x_T_y_p_e_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ +std::size_t type │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:235 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:261 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_M_a_s_k_T_y_p_e_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ +bool type │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:262 │ │ │ │ │ +_v_c_._h_h │ │ │ │ │ +SIMD abstractions for Vc. │ │ │ │ │ +_D_U_N_E___S_I_M_D___V_C___A_S_S_I_G_N_M_E_N_T │ │ │ │ │ +#define DUNE_SIMD_VC_ASSIGNMENT(OP) │ │ │ │ │ +DDeeffiinniittiioonn simd/vc.hh:224 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00149.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: propertymap.hh File Reference │ │ │ │ +dune-common: test.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,84 +65,496 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
    │ │ │ │ -
    propertymap.hh File Reference
    │ │ │ │ +Macros | │ │ │ │ +Typedefs
    │ │ │ │ +
    test.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include <cstddef>
    │ │ │ │ -#include <iterator>
    │ │ │ │ + │ │ │ │ +

    Common tests for simd abstraction implementations. │ │ │ │ +More...

    │ │ │ │ +
    #include <algorithm>
    │ │ │ │ +#include <cstddef>
    │ │ │ │ +#include <iostream>
    │ │ │ │ +#include <sstream>
    │ │ │ │ +#include <string>
    │ │ │ │ #include <type_traits>
    │ │ │ │ +#include <typeindex>
    │ │ │ │ +#include <typeinfo>
    │ │ │ │ +#include <unordered_set>
    │ │ │ │ +#include <utility>
    │ │ │ │ +#include <dune/common/classname.hh>
    │ │ │ │ +#include <dune/common/hybridutilities.hh>
    │ │ │ │ +#include <dune/common/rangeutilities.hh>
    │ │ │ │ +#include <dune/common/simd/io.hh>
    │ │ │ │ +#include <dune/common/simd/loop.hh>
    │ │ │ │ +#include <dune/common/simd/simd.hh>
    │ │ │ │ +#include <dune/common/std/type_traits.hh>
    │ │ │ │ +#include <dune/common/typelist.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::PropertyMapTraits< PM >
     
    struct  Dune::ReadablePropertyMapTag
     Tag for the category of readable property maps. More...
     
    struct  Dune::WritablePropertyMapTag
     Tag for the category of writable property maps. More...
     
    struct  Dune::ReadWritePropertyMapTag
     Tag for the category of readable and writable property maps. More...
     
    struct  Dune::LvaluePropertyMapTag
     Tag for the category of lvalue property maps. More...
     
    struct  Dune::PropertyMapTraits< T * >
     
    struct  Dune::PropertyMapTraits< const T * >
     
    struct  Dune::RAPropertyMapHelper< Reference, PropertyMap >
    struct  Dune::Simd::EndMark
     final element marker for RebindList More...
     
    class  Dune::IteratorPropertyMap< RAI, IM, T, R >
     Adapter to turn a random access iterator into a property map. More...
     
    class  Dune::AssociativePropertyMap< T >
     An adapter to turn an unique associative container into a property map. More...
     
    class  Dune::ConstAssociativePropertyMap< T >
     An adaptor to turn an unique associative container into a property map. More...
     
    struct  Dune::IdentityMap
     A property map that applies the identity function to integers. More...
     
    struct  Dune::PropertyMapTypeSelector< T, C >
     Selector for the property map type. More...
    class  Dune::Simd::UnitTest
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Simd
     Namespace for vectorization interface functions used by library developers.
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Macros

    #define DUNE_SIMD_CHECK(expr)    ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr))
     
    #define DUNE_SIMD_CHECK_OP(expr)
     
    #define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL)
     
    #define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL)
     
    #define DUNE_SIMD_OPNAME   (className<Op(V)>())
     
    #define DUNE_SIMD_INFIX_OP(NAME, SYMBOL)
     
    #define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL)
     
    #define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL)
     
    #define DUNE_SIMD_OPNAME   (className<OpInfixComma(T1, T2)>())
     
    #define DUNE_SIMD_OPNAME   (className<Op(V1, V2)>())
     
    #define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
     
    #define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
     
    #define DUNE_SIMD_OPNAME   (className<Op(V1, P2)>())
     
    #define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME)
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ -Functions

    template<class Reference , class PropertyMap , class Key >
    Reference Dune::get (const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
     
    template<class Reference , class PropertyMap , class Key , class Value >
    void Dune::put (const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key, const Value &value)
     

    │ │ │ │ +Typedefs

    template<class... Types>
    using Dune::Simd::RebindList = typename Impl::RemoveEnd< EndMark, TypeList< Types... > >::type
     A list of types with the final element removed.
     
    template<class T >
    using Dune::Simd::IsLoop = typename Impl::IsLoop< T >::type
     check whether a type is an instance of LoopSIMD
     
    │ │ │ │ +

    Detailed Description

    │ │ │ │ +

    Common tests for simd abstraction implementations.

    │ │ │ │ +

    This file is an interface header and may be included without restrictions.

    │ │ │ │ +

    Macro Definition Documentation

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_ASSIGN_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_ASSIGN_OP( NAME,
     SYMBOL 
    )
    │ │ │ │ +
    │ │ │ │ +Value:
    struct OpInfix##NAME \
    │ │ │ │ +
    { \
    │ │ │ │ +
    template<class V1, class V2> \
    │ │ │ │ +
    decltype(auto) operator()(V1&& v1, V2&& v2) const \
    │ │ │ │ +
    { \
    │ │ │ │ +
    return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class S1, class S2> \
    │ │ │ │ +
    auto scalar(S1& s1, S2&& s2) const \
    │ │ │ │ +
    -> decltype(s1 SYMBOL std::forward<S2>(s2)); \
    │ │ │ │ +
    }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_CHECK

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_CHECK( expr)    ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr))
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_CHECK_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_CHECK_OP( expr)
    │ │ │ │ +
    │ │ │ │ +Value:
    ((expr) ? void() : complain(__FILE__, __LINE__, __func__, \
    │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_OPNAME
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_DO

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_DO( M1,
     M2,
     M3,
     V1,
     V2,
     V3,
     NAME 
    )
    │ │ │ │ +
    │ │ │ │ +Value:
    checker(bool_constant<isMask ? do_##M1 : do_##V1>{}, \
    │ │ │ │ +
    bool_constant<isMask ? do_##M2 : do_##V2>{}, \
    │ │ │ │ +
    bool_constant<isMask ? do_##M3 : do_##V3>{}, \
    │ │ │ │ +
    Op##NAME{})
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_INFIX_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_INFIX_OP( NAME,
     SYMBOL 
    )
    │ │ │ │ +
    │ │ │ │ +Value:
    struct OpInfix##NAME \
    │ │ │ │ +
    { \
    │ │ │ │ +
    template<class V1, class V2> \
    │ │ │ │ +
    decltype(auto) operator()(V1&& v1, V2&& v2) const \
    │ │ │ │ +
    { \
    │ │ │ │ +
    return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class S1, class S2> \
    │ │ │ │ +
    auto scalar(S1&& s1, S2&& s2) const \
    │ │ │ │ +
    -> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
    │ │ │ │ +
    }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_OPNAME [1/6]

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_OPNAME   (className<Op(V)>())
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_OPNAME [2/6]

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_OPNAME   (className<OpInfixComma(T1, T2)>())
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_OPNAME [3/6]

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_OPNAME   (className<Op(V1, V2)>())
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_OPNAME [4/6]

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_OPNAME [5/6]

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_OPNAME   (className<Op(V1, T2)>())
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_OPNAME [6/6]

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_OPNAME   (className<Op(V1, P2)>())
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_POSTFIX_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_POSTFIX_OP( NAME,
     SYMBOL 
    )
    │ │ │ │ +
    │ │ │ │ +Value:
    struct OpPostfix##NAME \
    │ │ │ │ +
    { \
    │ │ │ │ +
    template<class V> \
    │ │ │ │ +
    auto operator()(V&& v) const \
    │ │ │ │ +
    -> decltype(std::forward<V>(v) SYMBOL) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    return std::forward<V>(v) SYMBOL; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_PREFIX_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_PREFIX_OP( NAME,
     SYMBOL 
    )
    │ │ │ │ +
    │ │ │ │ +Value:
    struct OpPrefix##NAME \
    │ │ │ │ +
    { \
    │ │ │ │ +
    template<class V> \
    │ │ │ │ +
    auto operator()(V&& v) const \
    │ │ │ │ +
    -> decltype(SYMBOL std::forward<V>(v)) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    return SYMBOL std::forward<V>(v); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_SIMD_REPL_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_REPL_OP( NAME,
     REPLFN,
     SYMBOL 
    )
    │ │ │ │ +
    │ │ │ │ +Value:
    struct OpInfix##NAME \
    │ │ │ │ +
    { \
    │ │ │ │ +
    template<class V1, class V2> \
    │ │ │ │ +
    decltype(auto) operator()(V1&& v1, V2&& v2) const \
    │ │ │ │ +
    { \
    │ │ │ │ +
    return Simd::REPLFN(std::forward<V1>(v1), std::forward<V2>(v2)); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    template<class S1, class S2> \
    │ │ │ │ +
    auto scalar(S1&& s1, S2&& s2) const \
    │ │ │ │ +
    -> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
    │ │ │ │ +
    }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,65 +1,203 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -propertymap.hh File Reference │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s | _T_y_p_e_d_e_f_s │ │ │ │ │ +test.hh File Reference │ │ │ │ │ +Common tests for simd abstraction implementations. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_y_b_r_i_d_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_o_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_l_o_o_p_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _P_M_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_E_n_d_M_a_r_k │ │ │ │ │ +  final element marker for RebindList _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_R_e_a_d_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -  Tag for the category of readable property maps. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_W_r_i_t_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -  Tag for the category of writable property maps. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_R_e_a_d_W_r_i_t_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -  Tag for the category of readable and writable property maps. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -  Tag for the category of lvalue property maps. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _T_ _*_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _*_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r_<_ _R_e_f_e_r_e_n_c_e_,_ _P_r_o_p_e_r_t_y_M_a_p_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_<_ _R_A_I_,_ _I_M_,_ _T_,_ _R_ _> │ │ │ │ │ -  Adapter to turn a random access iterator into a property map. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p_<_ _T_ _> │ │ │ │ │ -  An adapter to turn an unique associative container into a property │ │ │ │ │ - map. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_C_o_n_s_t_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p_<_ _T_ _> │ │ │ │ │ -  An adaptor to turn an unique associative container into a property │ │ │ │ │ - map. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p │ │ │ │ │ -  A property map that applies the identity function to integers. _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_<_ _T_,_ _C_ _> │ │ │ │ │ -  Selector for the property map type. _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -Reference  _D_u_n_e_:_:_g_e_t (const _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r< Reference, PropertyMap > │ │ │ │ │ - &pmap, const Key &key) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_p_u_t (const _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r< Reference, PropertyMap > │ │ │ │ │ - &pmap, const Key &key, const Value &value) │ │ │ │ │ -  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ +  Namespace for vectorization interface functions used by library │ │ │ │ │ + developers. │ │ │ │ │ +  │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___C_H_E_C_K(expr)    ((expr) ? void() : complain(__FILE__, │ │ │ │ │ + __LINE__, __func__, #expr)) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(expr) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P(NAME, SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P(NAME, SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(NAME, SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(NAME, SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___R_E_P_L___O_P(NAME, REPLFN, SYMBOL) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___O_P_N_A_M_E   (className()) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___S_I_M_D___D_O(M1, M2, M3, V1, V2, V3, NAME) │ │ │ │ │ +  │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_S_i_m_d_:_:_R_e_b_i_n_d_L_i_s_t = typename Impl::RemoveEnd< _E_n_d_M_a_r_k, _T_y_p_e_L_i_s_t< │ │ │ │ │ + Types... > >::type │ │ │ │ │ +  A list of types with the final element removed. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_S_i_m_d_:_:_I_s_L_o_o_p = typename Impl::IsLoop< T >::type │ │ │ │ │ +  check whether a type is an instance of _L_o_o_p_S_I_M_D │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Common tests for simd abstraction implementations. │ │ │ │ │ +This file is an interface header and may be included without restrictions. │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__AASSSSIIGGNN__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_ASSIGN_OP (   NAME, │ │ │ │ │ +   SYMBOL  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +struct OpInfix##NAME \ │ │ │ │ │ +{ \ │ │ │ │ │ +template \ │ │ │ │ │ +decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ +{ \ │ │ │ │ │ +return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ +} \ │ │ │ │ │ +template \ │ │ │ │ │ +auto scalar(S1& s1, S2&& s2) const \ │ │ │ │ │ +-> decltype(s1 SYMBOL std::forward(s2)); \ │ │ │ │ │ +} │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__CCHHEECCKK ********** │ │ │ │ │ +#define DUNE_SIMD_CHECK (   expr )     ((expr) ? void() : complain(__FILE__, │ │ │ │ │ + __LINE__, __func__, #expr)) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__CCHHEECCKK__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_CHECK_OP (   expr ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +((expr) ? void() : complain(__FILE__, __LINE__, __func__, \ │ │ │ │ │ +_D_U_N_E___S_I_M_D___O_P_N_A_M_E, #expr)) │ │ │ │ │ +_D_U_N_E___S_I_M_D___O_P_N_A_M_E │ │ │ │ │ +#define DUNE_SIMD_OPNAME │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__DDOO ********** │ │ │ │ │ +#define DUNE_SIMD_DO (   M1, │ │ │ │ │ +   M2, │ │ │ │ │ +   M3, │ │ │ │ │ +   V1, │ │ │ │ │ +   V2, │ │ │ │ │ +   V3, │ │ │ │ │ +   NAME  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +checker(bool_constant{}, \ │ │ │ │ │ +bool_constant{}, \ │ │ │ │ │ +bool_constant{}, \ │ │ │ │ │ +Op##NAME{}) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__IINNFFIIXX__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_INFIX_OP (   NAME, │ │ │ │ │ +   SYMBOL  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +struct OpInfix##NAME \ │ │ │ │ │ +{ \ │ │ │ │ │ +template \ │ │ │ │ │ +decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ +{ \ │ │ │ │ │ +return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ +} \ │ │ │ │ │ +template \ │ │ │ │ │ +auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ +-> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ +} │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[11//66]] ********** │ │ │ │ │ +#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[22//66]] ********** │ │ │ │ │ +#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[33//66]] ********** │ │ │ │ │ +#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[44//66]] ********** │ │ │ │ │ +#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[55//66]] ********** │ │ │ │ │ +#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__OOPPNNAAMMEE [[66//66]] ********** │ │ │ │ │ +#define DUNE_SIMD_OPNAME   (className()) │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__PPOOSSTTFFIIXX__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_POSTFIX_OP (   NAME, │ │ │ │ │ +   SYMBOL  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +struct OpPostfix##NAME \ │ │ │ │ │ +{ \ │ │ │ │ │ +template \ │ │ │ │ │ +auto operator()(V&& v) const \ │ │ │ │ │ +-> decltype(std::forward(v) SYMBOL) \ │ │ │ │ │ +{ \ │ │ │ │ │ +return std::forward(v) SYMBOL; \ │ │ │ │ │ +} \ │ │ │ │ │ +} │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__PPRREEFFIIXX__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_PREFIX_OP (   NAME, │ │ │ │ │ +   SYMBOL  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +struct OpPrefix##NAME \ │ │ │ │ │ +{ \ │ │ │ │ │ +template \ │ │ │ │ │ +auto operator()(V&& v) const \ │ │ │ │ │ +-> decltype(SYMBOL std::forward(v)) \ │ │ │ │ │ +{ \ │ │ │ │ │ +return SYMBOL std::forward(v); \ │ │ │ │ │ +} \ │ │ │ │ │ +} │ │ │ │ │ +********** _?◆_? DDUUNNEE__SSIIMMDD__RREEPPLL__OOPP ********** │ │ │ │ │ +#define DUNE_SIMD_REPL_OP (   NAME, │ │ │ │ │ +   REPLFN, │ │ │ │ │ +   SYMBOL  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +struct OpInfix##NAME \ │ │ │ │ │ +{ \ │ │ │ │ │ +template \ │ │ │ │ │ +decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ +{ \ │ │ │ │ │ +return Simd::REPLFN(std::forward(v1), std::forward(v2)); \ │ │ │ │ │ +} \ │ │ │ │ │ +template \ │ │ │ │ │ +auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ +-> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ +} │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00149_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: propertymap.hh Source File │ │ │ │ +dune-common: test.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,311 +70,2026 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    propertymap.hh
    │ │ │ │ +
    test.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_PROPERTYMAP_HH
    │ │ │ │ -
    6#define DUNE_PROPERTYMAP_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include <cstddef>
    │ │ │ │ -
    9#include <iterator>
    │ │ │ │ -
    10#include <type_traits>
    │ │ │ │ -
    11
    │ │ │ │ -
    12namespace Dune
    │ │ │ │ -
    13{
    │ │ │ │ -
    14
    │ │ │ │ -
    15 template<class PM>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    17 {
    │ │ │ │ -
    21 typedef typename PM::KeyType KeyType;
    │ │ │ │ -
    25 typedef typename PM::ValueType ValueType;
    │ │ │ │ -
    29 typedef typename PM::Reference Reference;
    │ │ │ │ -
    33 typedef typename PM::Category Category;
    │ │ │ │ -
    34 };
    │ │ │ │ -
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_TEST_HH
    │ │ │ │ +
    4#define DUNE_COMMON_SIMD_TEST_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    12#include <algorithm>
    │ │ │ │ +
    13#include <cstddef>
    │ │ │ │ +
    14#include <iostream>
    │ │ │ │ +
    15#include <sstream>
    │ │ │ │ +
    16#include <string>
    │ │ │ │ +
    17#include <type_traits>
    │ │ │ │ +
    18#include <typeindex>
    │ │ │ │ +
    19#include <typeinfo>
    │ │ │ │ +
    20#include <unordered_set>
    │ │ │ │ +
    21#include <utility>
    │ │ │ │ +
    22
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    32
    │ │ │ │ +
    33namespace Dune {
    │ │ │ │ +
    34 namespace Simd {
    │ │ │ │
    35
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    38 {};
    │ │ │ │ -
    │ │ │ │ -
    39
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    42 {};
    │ │ │ │ -
    │ │ │ │ -
    43
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    50 {};
    │ │ │ │ -
    │ │ │ │ -
    51
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    57 {};
    │ │ │ │ -
    │ │ │ │ -
    58
    │ │ │ │ -
    59 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    61 {
    │ │ │ │ -
    62 typedef T ValueType;
    │ │ │ │ - │ │ │ │ -
    64 typedef std::ptrdiff_t KeyType;
    │ │ │ │ - │ │ │ │ -
    66 };
    │ │ │ │ -
    │ │ │ │ +
    36 namespace Impl {
    │ │ │ │ +
    37
    │ │ │ │ +
    38 template<class T, class SFINAE = void>
    │ │ │ │ +
    39 struct LessThenComparable : std::false_type {};
    │ │ │ │ +
    40 template<class T>
    │ │ │ │ +
    41 struct LessThenComparable<T, std::void_t<decltype(std::declval<T>()
    │ │ │ │ +
    42 < std::declval<T>())> > :
    │ │ │ │ +
    43 std::true_type
    │ │ │ │ +
    44 {};
    │ │ │ │ +
    45
    │ │ │ │ +
    46 template<class Dst, class Src>
    │ │ │ │ +
    47 struct CopyConstHelper
    │ │ │ │ +
    48 {
    │ │ │ │ +
    49 using type = Dst;
    │ │ │ │ +
    50 };
    │ │ │ │ +
    51 template<class Dst, class Src>
    │ │ │ │ +
    52 struct CopyConstHelper<Dst, const Src>
    │ │ │ │ +
    53 {
    │ │ │ │ +
    54 using type = std::add_const_t<Dst>;
    │ │ │ │ +
    55 };
    │ │ │ │ +
    56
    │ │ │ │ +
    57 template<class Dst, class Src>
    │ │ │ │ +
    58 struct CopyVolatileHelper
    │ │ │ │ +
    59 {
    │ │ │ │ +
    60 using type = Dst;
    │ │ │ │ +
    61 };
    │ │ │ │ +
    62 template<class Dst, class Src>
    │ │ │ │ +
    63 struct CopyVolatileHelper<Dst, volatile Src>
    │ │ │ │ +
    64 {
    │ │ │ │ +
    65 using type = std::add_volatile_t<Dst>;
    │ │ │ │ +
    66 };
    │ │ │ │
    67
    │ │ │ │ -
    68
    │ │ │ │ -
    69 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    70 struct PropertyMapTraits<const T*>
    │ │ │ │ -
    71 {
    │ │ │ │ -
    72 typedef T ValueType;
    │ │ │ │ -
    73 typedef const ValueType& Reference;
    │ │ │ │ -
    74 typedef std::ptrdiff_t KeyType;
    │ │ │ │ - │ │ │ │ -
    76 };
    │ │ │ │ -
    │ │ │ │ -
    77
    │ │ │ │ -
    78 template<class Reference, class PropertyMap>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    80 {};
    │ │ │ │ -
    │ │ │ │ -
    81
    │ │ │ │ -
    82 template<class Reference, class PropertyMap, class Key>
    │ │ │ │ -
    83 inline Reference
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    85 const Key& key)
    │ │ │ │ -
    86 {
    │ │ │ │ -
    87 return static_cast<const PropertyMap&>(pmap)[key];
    │ │ │ │ -
    88 }
    │ │ │ │ -
    │ │ │ │ -
    89
    │ │ │ │ -
    90 template<class Reference, class PropertyMap, class Key, class Value>
    │ │ │ │ -
    91 inline void
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    93 const Key& key, const Value& value)
    │ │ │ │ -
    94 {
    │ │ │ │ -
    95 static_assert(std::is_convertible<typename PropertyMap::Category,WritablePropertyMapTag>::value,
    │ │ │ │ -
    96 "WritablePropertyMapTag required!");
    │ │ │ │ -
    97 static_cast<const PropertyMap&>(pmap)[key] = value;
    │ │ │ │ -
    98 }
    │ │ │ │ -
    │ │ │ │ -
    99
    │ │ │ │ -
    103 template<class RAI, class IM,
    │ │ │ │ -
    104 class T = typename std::iterator_traits<RAI>::value_type,
    │ │ │ │ -
    105 class R = typename std::iterator_traits<RAI>::reference>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    107 : public RAPropertyMapHelper<R,IteratorPropertyMap<RAI,IM,T,R> >
    │ │ │ │ -
    108 {
    │ │ │ │ -
    109 public:
    │ │ │ │ - │ │ │ │ -
    114
    │ │ │ │ -
    120 typedef IM IndexMap;
    │ │ │ │ -
    121
    │ │ │ │ -
    125 typedef typename IndexMap::KeyType KeyType;
    │ │ │ │ -
    126
    │ │ │ │ -
    130 typedef T ValueType;
    │ │ │ │ -
    131
    │ │ │ │ -
    135 typedef R Reference;
    │ │ │ │ -
    136
    │ │ │ │ - │ │ │ │ +
    68 template<class Dst, class Src>
    │ │ │ │ +
    69 struct CopyReferenceHelper
    │ │ │ │ +
    70 {
    │ │ │ │ +
    71 using type = Dst;
    │ │ │ │ +
    72 };
    │ │ │ │ +
    73 template<class Dst, class Src>
    │ │ │ │ +
    74 struct CopyReferenceHelper<Dst, Src&>
    │ │ │ │ +
    75 {
    │ │ │ │ +
    76 using type = std::add_lvalue_reference_t<Dst>;
    │ │ │ │ +
    77 };
    │ │ │ │ +
    78
    │ │ │ │ +
    79 template<class Dst, class Src>
    │ │ │ │ +
    80 struct CopyReferenceHelper<Dst, Src&&>
    │ │ │ │ +
    81 {
    │ │ │ │ +
    82 using type = std::add_rvalue_reference_t<Dst>;
    │ │ │ │ +
    83 };
    │ │ │ │ +
    84
    │ │ │ │ +
    85 template<class Dst, class Src>
    │ │ │ │ +
    86 using CopyRefQual = typename CopyReferenceHelper<
    │ │ │ │ +
    87 typename CopyVolatileHelper<
    │ │ │ │ +
    88 typename CopyConstHelper<
    │ │ │ │ +
    89 std::decay_t<Dst>,
    │ │ │ │ +
    90 std::remove_reference_t<Src>
    │ │ │ │ +
    91 >::type,
    │ │ │ │ +
    92 std::remove_reference_t<Src>
    │ │ │ │ +
    93 >::type,
    │ │ │ │ +
    94 Src
    │ │ │ │ +
    95 >::type;
    │ │ │ │ +
    96
    │ │ │ │ +
    97 template<class Mark, class Types,
    │ │ │ │ +
    98 class Indices =
    │ │ │ │ +
    99 std::make_index_sequence<TypeListSize<Types>::value - 1> >
    │ │ │ │ +
    100 struct RemoveEnd;
    │ │ │ │ +
    101 template<class Mark, class Types, std::size_t... I>
    │ │ │ │ +
    102 struct RemoveEnd<Mark, Types, std::index_sequence<I...>>
    │ │ │ │ +
    103 {
    │ │ │ │ +
    104 using Back = TypeListEntry_t<TypeListSize<Types>::value - 1, Types>;
    │ │ │ │ +
    105 static_assert(std::is_same<Mark, Back>::value,
    │ │ │ │ +
    106 "TypeList not terminated by proper EndMark");
    │ │ │ │ +
    107 using type = TypeList<TypeListEntry_t<I, Types>...>;
    │ │ │ │ +
    108 };
    │ │ │ │ +
    109
    │ │ │ │ +
    110 template<class T, class List, class = void>
    │ │ │ │ +
    111 struct TypeInList;
    │ │ │ │ +
    112
    │ │ │ │ +
    113 template<class T>
    │ │ │ │ +
    114 struct TypeInList<T, TypeList<> > : std::false_type {};
    │ │ │ │ +
    115
    │ │ │ │ +
    116 template<class T, class... Rest>
    │ │ │ │ +
    117 struct TypeInList<T, TypeList<T, Rest...> > : std::true_type {};
    │ │ │ │ +
    118
    │ │ │ │ +
    119 template<class T, class Head, class... Rest>
    │ │ │ │ +
    120 struct TypeInList<T, TypeList<Head, Rest...>,
    │ │ │ │ +
    121 std::enable_if_t<!std::is_same<T, Head>::value> > :
    │ │ │ │ +
    122 TypeInList<T, TypeList<Rest...> >::type
    │ │ │ │ +
    123 {};
    │ │ │ │ +
    124
    │ │ │ │ +
    125 template<class T>
    │ │ │ │ +
    126 struct IsLoop : std::false_type {};
    │ │ │ │ +
    127 template<class T, std::size_t S>
    │ │ │ │ +
    128 struct IsLoop<LoopSIMD<T, S> > : std::true_type {};
    │ │ │ │ +
    129
    │ │ │ │ +
    130 // used inside static_assert to trick the compiler into printing a list
    │ │ │ │ +
    131 // of types:
    │ │ │ │ +
    132 //
    │ │ │ │ +
    133 // static_assert(debugTypes<V>(Std::bool_constant<condition>{}), "msg");
    │ │ │ │ +
    134 //
    │ │ │ │ +
    135 // Should include what the type `V` expands to in the error message.
    │ │ │ │ +
    136 template<class...>
    │ │ │ │ +
    137 constexpr bool debugTypes(std::true_type) { return true; }
    │ │ │ │ +
    138 template<class... Types>
    │ │ │ │ +
    139 [[deprecated]]
    │ │ │ │ +
    140 constexpr bool debugTypes(std::false_type) { return false; }
    │ │ │ │
    141
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    150 const IndexMap& im=IndexMap())
    │ │ │ │ -
    151 : iter_(iter), indexMap_(im)
    │ │ │ │ -
    152 {}
    │ │ │ │ -
    │ │ │ │ -
    153
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    156 : iter_(), indexMap_()
    │ │ │ │ -
    157 {}
    │ │ │ │ -
    │ │ │ │ -
    158
    │ │ │ │ -
    │ │ │ │ -
    160 inline Reference operator[](KeyType key) const
    │ │ │ │ -
    161 {
    │ │ │ │ -
    162 return *(iter_ + get(indexMap_, key));
    │ │ │ │ -
    163 }
    │ │ │ │ -
    │ │ │ │ -
    164
    │ │ │ │ -
    165 private:
    │ │ │ │ - │ │ │ │ -
    169 IndexMap indexMap_;
    │ │ │ │ -
    170 };
    │ │ │ │ -
    │ │ │ │ -
    171
    │ │ │ │ -
    176 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    178 : RAPropertyMapHelper<typename T::value_type::second_type&,
    │ │ │ │ -
    179 AssociativePropertyMap<T> >
    │ │ │ │ -
    180 {
    │ │ │ │ -
    184 typedef T UniqueAssociativeContainer;
    │ │ │ │ -
    185
    │ │ │ │ -
    189 typedef typename UniqueAssociativeContainer::value_type::first_type
    │ │ │ │ -
    190 KeyType;
    │ │ │ │ -
    191
    │ │ │ │ -
    195 typedef typename UniqueAssociativeContainer::value_type::second_type
    │ │ │ │ -
    196 ValueType;
    │ │ │ │ -
    197
    │ │ │ │ -
    201 typedef ValueType& Reference;
    │ │ │ │ -
    202
    │ │ │ │ - │ │ │ │ +
    142 } // namespace Impl
    │ │ │ │ +
    143
    │ │ │ │ +
    145 struct EndMark {};
    │ │ │ │ +
    147
    │ │ │ │ +
    156 template<class... Types>
    │ │ │ │ + │ │ │ │ +
    158 typename Impl::RemoveEnd<EndMark, TypeList<Types...> >::type;
    │ │ │ │ +
    159
    │ │ │ │ +
    161 template<class T>
    │ │ │ │ +
    162 using IsLoop = typename Impl::IsLoop<T>::type;
    │ │ │ │ +
    163
    │ │ │ │ +
    │ │ │ │ +
    164 class UnitTest {
    │ │ │ │ +
    165 bool good_ = true;
    │ │ │ │ +
    166 std::ostream &log_ = std::cerr;
    │ │ │ │ +
    167 // records the types for which checks have started running to avoid
    │ │ │ │ +
    168 // infinite recursion
    │ │ │ │ +
    169 std::unordered_set<std::type_index> seen_;
    │ │ │ │ +
    170
    │ │ │ │ +
    172 //
    │ │ │ │ +
    173 // Helper functions
    │ │ │ │ +
    174 //
    │ │ │ │ +
    175
    │ │ │ │ +
    176 void complain(const char *file, int line, const char *func,
    │ │ │ │ +
    177 const char *expr);
    │ │ │ │ +
    178
    │ │ │ │ +
    179 void complain(const char *file, int line, const char *func,
    │ │ │ │ +
    180 const std::string &opname, const char *expr);
    │ │ │ │ +
    181
    │ │ │ │ +
    182 // This macro is defined only within this file, do not use anywhere
    │ │ │ │ +
    183 // else. Doing the actual printing in an external function dramatically
    │ │ │ │ +
    184 // reduces memory use during compilation. Defined in such a way that
    │ │ │ │ +
    185 // the call will only happen for failed checks.
    │ │ │ │ +
    │ │ │ │ +
    186#define DUNE_SIMD_CHECK(expr) \
    │ │ │ │ +
    187 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr))
    │ │ │ │ +
    │ │ │ │ +
    188
    │ │ │ │ +
    189 // the function using this macro must define a way to compute the
    │ │ │ │ +
    190 // operator name in DUNE_SIMD_OPNAME
    │ │ │ │ +
    │ │ │ │ +
    191#define DUNE_SIMD_CHECK_OP(expr) \
    │ │ │ │ +
    192 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, \
    │ │ │ │ +
    193 DUNE_SIMD_OPNAME, #expr))
    │ │ │ │ +
    │ │ │ │ +
    194
    │ │ │ │ +
    195 // "cast" into a prvalue
    │ │ │ │ +
    196 template<class T>
    │ │ │ │ +
    197 static std::decay_t<T> prvalue(T &&t)
    │ │ │ │ +
    198 {
    │ │ │ │ +
    199 return std::forward<T>(t);
    │ │ │ │ +
    200 }
    │ │ │ │ +
    201
    │ │ │ │ +
    202 // whether the vector is 42 in all lanes
    │ │ │ │ +
    203 template<class V>
    │ │ │ │ +
    204 static bool is42(const V &v)
    │ │ │ │ +
    205 {
    │ │ │ │ +
    206 bool good = true;
    │ │ │ │
    207
    │ │ │ │ - │ │ │ │ -
    210 : map_(0)
    │ │ │ │ -
    211 {}
    │ │ │ │ -
    212
    │ │ │ │ -
    214 inline AssociativePropertyMap(UniqueAssociativeContainer& map)
    │ │ │ │ -
    215 : map_(&map)
    │ │ │ │ -
    216 {}
    │ │ │ │ -
    217
    │ │ │ │ -
    222 inline Reference operator[](KeyType key) const
    │ │ │ │ -
    223 {
    │ │ │ │ -
    224 return map_->find(key)->second;
    │ │ │ │ -
    225 }
    │ │ │ │ -
    226 private:
    │ │ │ │ -
    227 UniqueAssociativeContainer* map_;
    │ │ │ │ -
    228 };
    │ │ │ │ -
    │ │ │ │ -
    229
    │ │ │ │ -
    234 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    236 : RAPropertyMapHelper<const typename T::value_type::second_type&,
    │ │ │ │ -
    237 ConstAssociativePropertyMap<T> >
    │ │ │ │ -
    238 {
    │ │ │ │ -
    242 typedef T UniqueAssociativeContainer;
    │ │ │ │ -
    243
    │ │ │ │ -
    247 typedef typename UniqueAssociativeContainer::value_type::first_type
    │ │ │ │ -
    248 KeyType;
    │ │ │ │ -
    249
    │ │ │ │ -
    253 typedef typename UniqueAssociativeContainer::value_type::second_type
    │ │ │ │ -
    254 ValueType;
    │ │ │ │ -
    255
    │ │ │ │ -
    259 typedef const ValueType& Reference;
    │ │ │ │ -
    260
    │ │ │ │ - │ │ │ │ +
    208 for(std::size_t l = 0; l < lanes(v); ++l)
    │ │ │ │ +
    209 // need to cast in case we have a mask type
    │ │ │ │ +
    210 good &= (lane(l, v) == Scalar<V>(42));
    │ │ │ │ +
    211
    │ │ │ │ +
    212 return good;
    │ │ │ │ +
    213 }
    │ │ │ │ +
    214
    │ │ │ │ +
    215 // make a vector that contains the sequence { 1, 2, ... }
    │ │ │ │ +
    216 template<class V>
    │ │ │ │ +
    217 static V make123()
    │ │ │ │ +
    218 {
    │ │ │ │ +
    219 // initialize to avoid undefined behaviour if assigning to lane()
    │ │ │ │ +
    220 // involves lvalue-to-rvalue conversions, e.g. due to bitmask
    │ │ │ │ +
    221 // operations. Avoid using broadcast<V>() for initialization to avoid
    │ │ │ │ +
    222 // test interdependencies.
    │ │ │ │ +
    223 V vec(Scalar<V>(0));
    │ │ │ │ +
    224 for(std::size_t l = 0; l < lanes(vec); ++l)
    │ │ │ │ +
    225 lane(l, vec) = l + 1;
    │ │ │ │ +
    226 return vec;
    │ │ │ │ +
    227 }
    │ │ │ │ +
    228
    │ │ │ │ +
    229 // whether the vector contains the sequence { 1, 2, ... }
    │ │ │ │ +
    230 template<class V>
    │ │ │ │ +
    231 static bool is123(const V &v)
    │ │ │ │ +
    232 {
    │ │ │ │ +
    233 bool good = true;
    │ │ │ │ +
    234
    │ │ │ │ +
    235 for(std::size_t l = 0; l < lanes(v); ++l)
    │ │ │ │ +
    236 // need to cast in case we have a mask type
    │ │ │ │ +
    237 good &= (lane(l, v) == Scalar<V>(l+1));
    │ │ │ │ +
    238
    │ │ │ │ +
    239 return good;
    │ │ │ │ +
    240 }
    │ │ │ │ +
    241
    │ │ │ │ +
    242 template<class V>
    │ │ │ │ +
    243 static V leftVector()
    │ │ │ │ +
    244 {
    │ │ │ │ +
    245 // Avoid using broadcast<V>() for initialization to avoid test
    │ │ │ │ +
    246 // interdependencies.
    │ │ │ │ +
    247 V res(Scalar<V>(0));
    │ │ │ │ +
    248 for(std::size_t l = 0; l < lanes(res); ++l)
    │ │ │ │ +
    249 lane(l, res) = Scalar<V>(l+1);
    │ │ │ │ +
    250 return res;
    │ │ │ │ +
    251 }
    │ │ │ │ +
    252
    │ │ │ │ +
    253 template<class V>
    │ │ │ │ +
    254 static V rightVector()
    │ │ │ │ +
    255 {
    │ │ │ │ +
    256 // Avoid using broadcast<V>() for initialization to avoid test
    │ │ │ │ +
    257 // interdependencies.
    │ │ │ │ +
    258 V res(Scalar<V>(0));
    │ │ │ │ +
    259 for(std::size_t l = 0; l < lanes(res); ++l)
    │ │ │ │ +
    260 // do not exceed number of bits in char (for shifts)
    │ │ │ │ +
    261 // avoid 0 (for / and %)
    │ │ │ │ +
    262 lane(l, res) = Scalar<V>((l)%7+1);
    │ │ │ │ +
    263 return res;
    │ │ │ │ +
    264 }
    │ │ │ │
    265
    │ │ │ │ - │ │ │ │ -
    268 : map_(0)
    │ │ │ │ -
    269 {}
    │ │ │ │ -
    270
    │ │ │ │ -
    272 inline ConstAssociativePropertyMap(const UniqueAssociativeContainer& map)
    │ │ │ │ -
    273 : map_(&map)
    │ │ │ │ -
    274 {}
    │ │ │ │ -
    275
    │ │ │ │ -
    280 inline Reference operator[](KeyType key) const
    │ │ │ │ -
    281 {
    │ │ │ │ -
    282 return map_->find(key)->second;
    │ │ │ │ -
    283 }
    │ │ │ │ -
    284 private:
    │ │ │ │ -
    285 const UniqueAssociativeContainer* map_;
    │ │ │ │ -
    286 };
    │ │ │ │ -
    │ │ │ │ -
    287
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    292 : public RAPropertyMapHelper<std::size_t, IdentityMap>
    │ │ │ │ -
    293 {
    │ │ │ │ -
    295 typedef std::size_t KeyType;
    │ │ │ │ -
    296
    │ │ │ │ -
    298 typedef std::size_t ValueType;
    │ │ │ │ -
    299
    │ │ │ │ -
    301 typedef std::size_t Reference;
    │ │ │ │ -
    302
    │ │ │ │ - │ │ │ │ -
    305
    │ │ │ │ -
    │ │ │ │ -
    306 inline ValueType operator[](const KeyType& key) const
    │ │ │ │ -
    307 {
    │ │ │ │ -
    308 return key;
    │ │ │ │ -
    309 }
    │ │ │ │ -
    │ │ │ │ -
    310 };
    │ │ │ │ -
    │ │ │ │ -
    311
    │ │ │ │ -
    312
    │ │ │ │ -
    318 template<typename T, typename C>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    320 {
    │ │ │ │ -
    324 typedef T Tag;
    │ │ │ │ -
    329 typedef C Container;
    │ │ │ │ -
    330 };
    │ │ │ │ -
    │ │ │ │ -
    331
    │ │ │ │ -
    332}
    │ │ │ │ -
    333
    │ │ │ │ -
    334#endif
    │ │ │ │ +
    266 template<class T>
    │ │ │ │ +
    267 static T leftScalar()
    │ │ │ │ +
    268 {
    │ │ │ │ +
    269 return T(42);
    │ │ │ │ +
    270 }
    │ │ │ │ +
    271
    │ │ │ │ +
    272 template<class T>
    │ │ │ │ +
    273 static T rightScalar()
    │ │ │ │ +
    274 {
    │ │ │ │ +
    275 // do not exceed number of bits in char (for shifts)
    │ │ │ │ +
    276 // avoid 0 (for / and %)
    │ │ │ │ +
    277 return T(5);
    │ │ │ │ +
    278 }
    │ │ │ │ +
    279
    │ │ │ │ +
    280 template<class Dst, class Src>
    │ │ │ │ +
    281 using CopyRefQual = Impl::CopyRefQual<Dst, Src>;
    │ │ │ │ +
    282
    │ │ │ │ +
    283 // test whether the Op supports the operation on scalars. We do not use
    │ │ │ │ +
    284 // `lane()` to obtain the scalars, because that might return a proxy
    │ │ │ │ +
    285 // object, and we are interested in what exactly the scalar type can do,
    │ │ │ │ +
    286 // no a proxy that might have more overloads than needed. In addition,
    │ │ │ │ +
    287 // `lane()` may not preserve `const` and reference qualifiers.
    │ │ │ │ +
    288 template<class Op, class... Vectors>
    │ │ │ │ +
    289 using ScalarResult =
    │ │ │ │ +
    290 decltype(std::declval<Op>().
    │ │ │ │ +
    291 scalar(std::declval<CopyRefQual<Scalar<Vectors>,
    │ │ │ │ +
    292 Vectors> >()...));
    │ │ │ │ +
    293
    │ │ │ │ +
    295 //
    │ │ │ │ +
    296 // Check associated types
    │ │ │ │ +
    297 //
    │ │ │ │ +
    298
    │ │ │ │ +
    299 template<class V>
    │ │ │ │ +
    300 void checkScalar()
    │ │ │ │ +
    301 {
    │ │ │ │ +
    302 // check that the type Scalar<V> exists
    │ │ │ │ +
    303 using T = Scalar<V>;
    │ │ │ │ +
    304
    │ │ │ │ +
    305 static_assert(std::is_same<T, std::decay_t<T> >::value, "Scalar types "
    │ │ │ │ +
    306 "must not be references, and must not include "
    │ │ │ │ +
    307 "cv-qualifiers");
    │ │ │ │ +
    308 [[maybe_unused]] T a{};
    │ │ │ │ +
    309 }
    │ │ │ │ +
    310
    │ │ │ │ +
    311 template<class V>
    │ │ │ │ +
    312 [[deprecated("Warning: please include bool in the Rebinds for "
    │ │ │ │ +
    313 "simd type V, as Masks are not checked otherwise.")]]
    │ │ │ │ +
    314 void warnMissingMaskRebind(std::true_type) {}
    │ │ │ │ +
    315 template<class V>
    │ │ │ │ +
    316 void warnMissingMaskRebind(std::false_type) {}
    │ │ │ │ +
    317
    │ │ │ │ +
    318 template<class V, class Rebinds, template<class> class RebindPrune,
    │ │ │ │ +
    319 template<class> class RebindAccept, class Recurse>
    │ │ │ │ +
    320 void checkRebindOf(Recurse recurse)
    │ │ │ │ +
    321 {
    │ │ │ │ +
    322 Hybrid::forEach(Rebinds{}, [this,recurse](auto target) {
    │ │ │ │ +
    323 using T = typename decltype(target)::type;
    │ │ │ │ +
    324
    │ │ │ │ +
    325 // check that the rebound type exists
    │ │ │ │ +
    326 using W = Rebind<T, V>;
    │ │ │ │ +
    327 log_ << "Type " << className<V>() << " rebound to "
    │ │ │ │ +
    328 << className<T>() << " is " << className<W>() << std::endl;
    │ │ │ │ +
    329
    │ │ │ │ +
    330 static_assert(std::is_same<W, std::decay_t<W> >::value, "Rebound "
    │ │ │ │ +
    331 "types must not be references, and must not include "
    │ │ │ │ +
    332 "cv-qualifiers");
    │ │ │ │ +
    333 static_assert(lanes<V>() == lanes<W>(), "Rebound types must have "
    │ │ │ │ +
    334 "the same number of lanes as the original vector "
    │ │ │ │ +
    335 "types");
    │ │ │ │ +
    336 static_assert(std::is_same<T, Scalar<W> >::value, "Rebound types "
    │ │ │ │ +
    337 "must have the bound-to scalar type");
    │ │ │ │ +
    338
    │ │ │ │ +
    339 if constexpr (RebindPrune<W>{}) {
    │ │ │ │ +
    340 log_ << "Pruning check of Simd type " << className<W>()
    │ │ │ │ +
    341 << std::endl;
    │ │ │ │ +
    342 }
    │ │ │ │ +
    343 else {
    │ │ │ │ +
    344 using Impl::debugTypes;
    │ │ │ │ +
    345 static_assert(debugTypes<T, V, W>(RebindAccept<W>{}),
    │ │ │ │ +
    346 "Rebind<T, V> is W, but that is not accepted "
    │ │ │ │ +
    347 "by RebindAccept");
    │ │ │ │ +
    348 recurse(MetaType<W>{});
    │ │ │ │ +
    349 }
    │ │ │ │ +
    350 });
    │ │ │ │ +
    351
    │ │ │ │ +
    352 static_assert(std::is_same<Rebind<Scalar<V>, V>, V>::value, "A type "
    │ │ │ │ +
    353 "rebound to its own scalar type must be the same type "
    │ │ │ │ +
    354 "as the original type");
    │ │ │ │ +
    355 static_assert(std::is_same<Rebind<bool, V>, Mask<V> >::value, "A type "
    │ │ │ │ +
    356 "rebound to bool must be the mask type for that type");
    │ │ │ │ +
    357
    │ │ │ │ +
    358 constexpr bool hasBool = Impl::TypeInList<bool, Rebinds>::value;
    │ │ │ │ +
    359 warnMissingMaskRebind<V>(Std::bool_constant<!hasBool>{});
    │ │ │ │ +
    360 }
    │ │ │ │ +
    361
    │ │ │ │ +
    363 //
    │ │ │ │ +
    364 // Fundamental checks
    │ │ │ │ +
    365 //
    │ │ │ │ +
    366
    │ │ │ │ +
    367 template<class V>
    │ │ │ │ +
    368 void checkLanes()
    │ │ │ │ +
    369 {
    │ │ │ │ +
    370 // check lanes
    │ │ │ │ +
    371 static_assert(std::is_same<std::size_t, decltype(lanes<V>())>::value,
    │ │ │ │ +
    372 "return type of lanes<V>() should be std::size_t");
    │ │ │ │ +
    373 static_assert(std::is_same<std::size_t, decltype(lanes(V{}))>::value,
    │ │ │ │ +
    374 "return type of lanes(V{}) should be std::size_t");
    │ │ │ │ +
    375
    │ │ │ │ +
    376 // the result of lanes<V>() must be constexpr
    │ │ │ │ +
    377 [[maybe_unused]] constexpr auto size = lanes<V>();
    │ │ │ │ +
    378 // but the result of lanes(vec) does not need to be constexpr
    │ │ │ │ +
    379 DUNE_SIMD_CHECK(lanes<V>() == lanes(V{}));
    │ │ │ │ +
    380 }
    │ │ │ │ +
    381
    │ │ │ │ +
    382 template<class V>
    │ │ │ │ +
    383 void checkDefaultConstruct()
    │ │ │ │ +
    384 {
    │ │ │ │ +
    385 { [[maybe_unused]] V vec; }
    │ │ │ │ +
    386 { [[maybe_unused]] V vec{}; }
    │ │ │ │ +
    387 { [[maybe_unused]] V vec = {}; }
    │ │ │ │ +
    388 }
    │ │ │ │ +
    389
    │ │ │ │ +
    390 template<class V>
    │ │ │ │ +
    391 void checkLane()
    │ │ │ │ +
    392 {
    │ │ │ │ +
    393 // Avoid using broadcast<V>() for initialization to avoid test
    │ │ │ │ +
    394 // interdependencies.
    │ │ │ │ +
    395 V vec(Scalar<V>(0));
    │ │ │ │ +
    396 // check lane() on mutable lvalues
    │ │ │ │ +
    397 for(std::size_t l = 0; l < lanes(vec); ++l)
    │ │ │ │ +
    398 lane(l, vec) = l + 1;
    │ │ │ │ +
    399 for(std::size_t l = 0; l < lanes(vec); ++l)
    │ │ │ │ +
    400 DUNE_SIMD_CHECK(lane(l, vec) == Scalar<V>(l + 1));
    │ │ │ │ +
    401 using MLRes = decltype(lane(0, vec));
    │ │ │ │ +
    402 static_assert(std::is_same<MLRes, Scalar<V>&>::value ||
    │ │ │ │ +
    403 std::is_same<MLRes, std::decay_t<MLRes> >::value,
    │ │ │ │ +
    404 "Result of lane() on a mutable lvalue vector must "
    │ │ │ │ +
    405 "either be a mutable reference to a scalar of that "
    │ │ │ │ +
    406 "vector or a proxy object (which itself may not be a "
    │ │ │ │ +
    407 "reference nor const).");
    │ │ │ │ +
    408
    │ │ │ │ +
    409 // check lane() on const lvalues
    │ │ │ │ +
    410 const V &vec2 = vec;
    │ │ │ │ +
    411 for(std::size_t l = 0; l < lanes(vec); ++l)
    │ │ │ │ +
    412 DUNE_SIMD_CHECK(lane(l, vec2) == Scalar<V>(l + 1));
    │ │ │ │ +
    413 using CLRes = decltype(lane(0, vec2));
    │ │ │ │ +
    414 static_assert(std::is_same<CLRes, const Scalar<V>&>::value ||
    │ │ │ │ +
    415 std::is_same<CLRes, std::decay_t<CLRes> >::value,
    │ │ │ │ +
    416 "Result of lane() on a const lvalue vector must "
    │ │ │ │ +
    417 "either be a const lvalue reference to a scalar of that "
    │ │ │ │ +
    418 "vector or a proxy object (which itself may not be a "
    │ │ │ │ +
    419 "reference nor const).");
    │ │ │ │ +
    420 static_assert(!std::is_assignable<CLRes, Scalar<V> >::value,
    │ │ │ │ +
    421 "Result of lane() on a const lvalue vector must not be "
    │ │ │ │ +
    422 "assignable from a scalar.");
    │ │ │ │ +
    423
    │ │ │ │ +
    424 // check lane() on rvalues
    │ │ │ │ +
    425 for(std::size_t l = 0; l < lanes(vec); ++l)
    │ │ │ │ +
    426 DUNE_SIMD_CHECK(lane(l, prvalue(vec)) == Scalar<V>(l + 1));
    │ │ │ │ +
    427 using RRes = decltype(lane(0, prvalue(vec)));
    │ │ │ │ +
    428 // TODO: do we really want to allow Scalar<V>&& here? If we allow it,
    │ │ │ │ +
    429 // then `auto &&res = lane(0, vec*vec);` creates a dangling reference,
    │ │ │ │ +
    430 // and the scalar (and even the vector types) are small enough to be
    │ │ │ │ +
    431 // passed in registers anyway. On the other hand, the only comparable
    │ │ │ │ +
    432 // accessor function in the standard library that I can think of is
    │ │ │ │ +
    433 // std::get(), and that does return an rvalue reference in this
    │ │ │ │ +
    434 // situation. However, that cannot assume anything about the size of
    │ │ │ │ +
    435 // the returned types.
    │ │ │ │ +
    436 static_assert(std::is_same<RRes, Scalar<V> >::value ||
    │ │ │ │ +
    437 std::is_same<RRes, Scalar<V>&&>::value,
    │ │ │ │ +
    438 "Result of lane() on a rvalue vector V must be "
    │ │ │ │ +
    439 "Scalar<V> or Scalar<V>&&.");
    │ │ │ │ +
    440 // Can't assert non-assignable, fails for any typical class,
    │ │ │ │ +
    441 // e.g. std::complex<>. Would need to return const Scalar<V> or const
    │ │ │ │ +
    442 // Scalar<V>&&, which would inhibit moving from the return value.
    │ │ │ │ +
    443 // static_assert(!std::is_assignable<RRes, Scalar<V> >::value,
    │ │ │ │ +
    444 // "Result of lane() on a rvalue vector must not be "
    │ │ │ │ +
    445 // "assignable from a scalar.");
    │ │ │ │ +
    446 }
    │ │ │ │ +
    447
    │ │ │ │ +
    448 // check non-default constructors
    │ │ │ │ +
    449 template<class V>
    │ │ │ │ +
    450 void checkCopyMoveConstruct()
    │ │ │ │ +
    451 {
    │ │ │ │ +
    452 // elided copy/move constructors
    │ │ │ │ +
    453 { V vec (make123<V>()); DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    454 { V vec = make123<V>() ; DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    455 { V vec {make123<V>()}; DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    456 { V vec = {make123<V>()}; DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    457
    │ │ │ │ +
    458 // copy constructors
    │ │ │ │ +
    459 { V ref(make123<V>()); V vec (ref);
    │ │ │ │ +
    460 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
    │ │ │ │ +
    461 { V ref(make123<V>()); V vec = ref ;
    │ │ │ │ +
    462 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
    │ │ │ │ +
    463 { V ref(make123<V>()); V vec {ref};
    │ │ │ │ +
    464 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
    │ │ │ │ +
    465 { V ref(make123<V>()); V vec = {ref};
    │ │ │ │ +
    466 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
    │ │ │ │ +
    467 { const V ref(make123<V>()); V vec (ref);
    │ │ │ │ +
    468 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    469 { const V ref(make123<V>()); V vec = ref ;
    │ │ │ │ +
    470 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    471 { const V ref(make123<V>()); V vec {ref};
    │ │ │ │ +
    472 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    473 { const V ref(make123<V>()); V vec = {ref};
    │ │ │ │ +
    474 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    475
    │ │ │ │ +
    476 // move constructors
    │ │ │ │ +
    477 { V ref(make123<V>()); V vec (std::move(ref));
    │ │ │ │ +
    478 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    479 { V ref(make123<V>()); V vec = std::move(ref) ;
    │ │ │ │ +
    480 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    481 { V ref(make123<V>()); V vec {std::move(ref)};
    │ │ │ │ +
    482 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    483 { V ref(make123<V>()); V vec = {std::move(ref)};
    │ │ │ │ +
    484 DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    485 }
    │ │ │ │ +
    486
    │ │ │ │ +
    487 template<class V>
    │ │ │ │ +
    488 void checkBroadcastVectorConstruct()
    │ │ │ │ +
    489 {
    │ │ │ │ +
    490 // broadcast copy constructors
    │ │ │ │ +
    491 { Scalar<V> ref = 42; V vec (ref);
    │ │ │ │ +
    492 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    493 { Scalar<V> ref = 42; V vec = ref ;
    │ │ │ │ +
    494 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    495 // { Scalar<V> ref = 42; V vec {ref};
    │ │ │ │ +
    496 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    497 // { Scalar<V> ref = 42; V vec = {ref};
    │ │ │ │ +
    498 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    499 { const Scalar<V> ref = 42; V vec (ref);
    │ │ │ │ +
    500 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    501 { const Scalar<V> ref = 42; V vec = ref ;
    │ │ │ │ +
    502 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    503 // { const Scalar<V> ref = 42; V vec {ref};
    │ │ │ │ +
    504 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    505 // { const Scalar<V> ref = 42; V vec = {ref};
    │ │ │ │ +
    506 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    507
    │ │ │ │ +
    508 // broadcast move constructors
    │ │ │ │ +
    509 { Scalar<V> ref = 42; V vec (std::move(ref));
    │ │ │ │ +
    510 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    511 { Scalar<V> ref = 42; V vec = std::move(ref) ;
    │ │ │ │ +
    512 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    513 // { Scalar<V> ref = 42; V vec {std::move(ref)};
    │ │ │ │ +
    514 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    515 // { Scalar<V> ref = 42; V vec = {std::move(ref)};
    │ │ │ │ +
    516 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    517 }
    │ │ │ │ +
    518
    │ │ │ │ +
    519 template<class V>
    │ │ │ │ +
    520 void checkBroadcastMaskConstruct()
    │ │ │ │ +
    521 {
    │ │ │ │ +
    522 // broadcast copy constructors
    │ │ │ │ +
    523 { Scalar<V> ref = 42; V vec (ref);
    │ │ │ │ +
    524 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    525 // { Scalar<V> ref = 42; V vec = ref ;
    │ │ │ │ +
    526 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    527 { Scalar<V> ref = 42; V vec {ref};
    │ │ │ │ +
    528 DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    529 // { Scalar<V> ref = 42; V vec = {ref};
    │ │ │ │ +
    530 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    531 { const Scalar<V> ref = 42; V vec (ref);
    │ │ │ │ +
    532 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    533 // { const Scalar<V> ref = 42; V vec = ref ;
    │ │ │ │ +
    534 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    535 { const Scalar<V> ref = 42; V vec {ref};
    │ │ │ │ +
    536 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    537 // { const Scalar<V> ref = 42; V vec = {ref};
    │ │ │ │ +
    538 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    539
    │ │ │ │ +
    540 // broadcast move constructors
    │ │ │ │ +
    541 { Scalar<V> ref = 42; V vec (std::move(ref));
    │ │ │ │ +
    542 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    543 // { Scalar<V> ref = 42; V vec = std::move(ref) ;
    │ │ │ │ +
    544 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    545 { Scalar<V> ref = 42; V vec {std::move(ref)};
    │ │ │ │ +
    546 DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    547 // { Scalar<V> ref = 42; V vec = {std::move(ref)};
    │ │ │ │ +
    548 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    549 }
    │ │ │ │ +
    550
    │ │ │ │ +
    551 // check the implCast function
    │ │ │ │ +
    552 template<class FromV, class ToV>
    │ │ │ │ +
    553 void checkImplCast()
    │ │ │ │ +
    554 {
    │ │ │ │ +
    555 { // lvalue arg
    │ │ │ │ +
    556 FromV fromVec = make123<FromV>();
    │ │ │ │ +
    557 auto toVec = implCast<ToV>(fromVec);
    │ │ │ │ +
    558 static_assert(std::is_same<decltype(toVec), ToV>::value,
    │ │ │ │ +
    559 "Unexpected result type for implCast<ToV>(FromV&)");
    │ │ │ │ +
    560 DUNE_SIMD_CHECK(is123(fromVec));
    │ │ │ │ +
    561 DUNE_SIMD_CHECK(is123(toVec));
    │ │ │ │ +
    562 }
    │ │ │ │ +
    563
    │ │ │ │ +
    564 { // const lvalue arg
    │ │ │ │ +
    565 const FromV fromVec = make123<FromV>();
    │ │ │ │ +
    566 auto toVec = implCast<ToV>(fromVec);
    │ │ │ │ +
    567 static_assert(std::is_same<decltype(toVec), ToV>::value,
    │ │ │ │ +
    568 "Unexpected result type for implCast<ToV>(const "
    │ │ │ │ +
    569 "FromV&)");
    │ │ │ │ +
    570 DUNE_SIMD_CHECK(is123(toVec));
    │ │ │ │ +
    571 }
    │ │ │ │ +
    572
    │ │ │ │ +
    573 { // rvalue arg
    │ │ │ │ +
    574 auto toVec = implCast<ToV>(make123<FromV>());
    │ │ │ │ +
    575 static_assert(std::is_same<decltype(toVec), ToV>::value,
    │ │ │ │ +
    576 "Unexpected result type for implCast<ToV>(FromV&&)");
    │ │ │ │ +
    577 DUNE_SIMD_CHECK(is123(toVec));
    │ │ │ │ +
    578 }
    │ │ │ │ +
    579 }
    │ │ │ │ +
    580
    │ │ │ │ +
    581 // check the implCast function
    │ │ │ │ +
    582 template<class V>
    │ │ │ │ +
    583 void checkImplCast()
    │ │ │ │ +
    584 {
    │ │ │ │ +
    585 // check against LoopSIMD
    │ │ │ │ +
    586 using LoopV = Dune::LoopSIMD<Scalar<V>, lanes<V>()>;
    │ │ │ │ +
    587
    │ │ │ │ +
    588 checkImplCast<V, V>();
    │ │ │ │ +
    589 checkImplCast<V, LoopV>();
    │ │ │ │ +
    590 checkImplCast<LoopV, V>();
    │ │ │ │ +
    591 }
    │ │ │ │ +
    592
    │ │ │ │ +
    593 // check the broadcast function
    │ │ │ │ +
    594 template<class V>
    │ │ │ │ +
    595 void checkBroadcast()
    │ │ │ │ +
    596 {
    │ │ │ │ +
    597 // broadcast function
    │ │ │ │ +
    598 { // lvalue arg
    │ │ │ │ +
    599 Scalar<V> ref = 42;
    │ │ │ │ +
    600 auto vec = broadcast<V>(ref);
    │ │ │ │ +
    601 static_assert(std::is_same<decltype(vec), V>::value,
    │ │ │ │ +
    602 "Unexpected result type for broadcast<V>()");
    │ │ │ │ +
    603 DUNE_SIMD_CHECK(is42(vec));
    │ │ │ │ +
    604 DUNE_SIMD_CHECK(ref == Scalar<V>(42));
    │ │ │ │ +
    605 }
    │ │ │ │ +
    606
    │ │ │ │ +
    607 { // const lvalue arg
    │ │ │ │ +
    608 const Scalar<V> ref = 42;
    │ │ │ │ +
    609 auto vec = broadcast<V>(ref);
    │ │ │ │ +
    610 static_assert(std::is_same<decltype(vec), V>::value,
    │ │ │ │ +
    611 "Unexpected result type for broadcast<V>()");
    │ │ │ │ +
    612 DUNE_SIMD_CHECK(is42(vec));
    │ │ │ │ +
    613 }
    │ │ │ │ +
    614
    │ │ │ │ +
    615 { // rvalue arg
    │ │ │ │ +
    616 auto vec = broadcast<V>(Scalar<V>(42));
    │ │ │ │ +
    617 static_assert(std::is_same<decltype(vec), V>::value,
    │ │ │ │ +
    618 "Unexpected result type for broadcast<V>()");
    │ │ │ │ +
    619 DUNE_SIMD_CHECK(is42(vec));
    │ │ │ │ +
    620 }
    │ │ │ │ +
    621
    │ │ │ │ +
    622 { // int arg
    │ │ │ │ +
    623 auto vec = broadcast<V>(42);
    │ │ │ │ +
    624 static_assert(std::is_same<decltype(vec), V>::value,
    │ │ │ │ +
    625 "Unexpected result type for broadcast<V>()");
    │ │ │ │ +
    626 DUNE_SIMD_CHECK(is42(vec));
    │ │ │ │ +
    627 }
    │ │ │ │ +
    628
    │ │ │ │ +
    629 { // double arg
    │ │ │ │ +
    630 auto vec = broadcast<V>(42.0);
    │ │ │ │ +
    631 static_assert(std::is_same<decltype(vec), V>::value,
    │ │ │ │ +
    632 "Unexpected result type for broadcast<V>()");
    │ │ │ │ +
    633 DUNE_SIMD_CHECK(is42(vec));
    │ │ │ │ +
    634 }
    │ │ │ │ +
    635 }
    │ │ │ │ +
    636
    │ │ │ │ +
    637 template<class V>
    │ │ │ │ +
    638 void checkBracedAssign()
    │ │ │ │ +
    639 {
    │ │ │ │ +
    640 // copy assignment
    │ │ │ │ +
    641 { V ref = make123<V>(); V vec; vec = {ref};
    │ │ │ │ +
    642 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
    │ │ │ │ +
    643 { const V ref = make123<V>(); V vec; vec = {ref};
    │ │ │ │ +
    644 DUNE_SIMD_CHECK(is123(vec)); DUNE_SIMD_CHECK(is123(ref)); }
    │ │ │ │ +
    645
    │ │ │ │ +
    646 // move assignment
    │ │ │ │ +
    647 { V vec; vec = {make123<V>()}; DUNE_SIMD_CHECK(is123(vec)); }
    │ │ │ │ +
    648 }
    │ │ │ │ +
    649
    │ │ │ │ +
    650 template<class V>
    │ │ │ │ +
    651 void checkBracedBroadcastAssign()
    │ │ │ │ +
    652 {
    │ │ │ │ +
    653 // nothing works here
    │ │ │ │ +
    654 // // broadcast copy assignment
    │ │ │ │ +
    655 // { Scalar<V> ref = 42; V vec; vec = {ref};
    │ │ │ │ +
    656 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar<V>(42)); }
    │ │ │ │ +
    657 // { const Scalar<V> ref = 42; V vec; vec = {ref};
    │ │ │ │ +
    658 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    659
    │ │ │ │ +
    660 // // broadcast move assignment
    │ │ │ │ +
    661 // { Scalar<V> ref = 42; V vec; vec = {std::move(ref)};
    │ │ │ │ +
    662 // DUNE_SIMD_CHECK(is42(vec)); }
    │ │ │ │ +
    663 }
    │ │ │ │ +
    664
    │ │ │ │ +
    666 //
    │ │ │ │ +
    667 // checks for unary operators
    │ │ │ │ +
    668 //
    │ │ │ │ +
    669
    │ │ │ │ +
    │ │ │ │ +
    670#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL) \
    │ │ │ │ +
    671 struct OpPostfix##NAME \
    │ │ │ │ +
    672 { \
    │ │ │ │ +
    673 template<class V> \
    │ │ │ │ +
    674 auto operator()(V&& v) const \
    │ │ │ │ +
    675 -> decltype(std::forward<V>(v) SYMBOL) \
    │ │ │ │ +
    676 { \
    │ │ │ │ +
    677 return std::forward<V>(v) SYMBOL; \
    │ │ │ │ +
    678 } \
    │ │ │ │ +
    679 }
    │ │ │ │ +
    │ │ │ │ +
    680
    │ │ │ │ +
    │ │ │ │ +
    681#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL) \
    │ │ │ │ +
    682 struct OpPrefix##NAME \
    │ │ │ │ +
    683 { \
    │ │ │ │ +
    684 template<class V> \
    │ │ │ │ +
    685 auto operator()(V&& v) const \
    │ │ │ │ +
    686 -> decltype(SYMBOL std::forward<V>(v)) \
    │ │ │ │ +
    687 { \
    │ │ │ │ +
    688 return SYMBOL std::forward<V>(v); \
    │ │ │ │ +
    689 } \
    │ │ │ │ +
    690 }
    │ │ │ │ +
    │ │ │ │ +
    691
    │ │ │ │ +
    692 DUNE_SIMD_POSTFIX_OP(Decrement, -- );
    │ │ │ │ +
    693 DUNE_SIMD_POSTFIX_OP(Increment, ++ );
    │ │ │ │ +
    694
    │ │ │ │ +
    695 DUNE_SIMD_PREFIX_OP (Decrement, -- );
    │ │ │ │ +
    696 DUNE_SIMD_PREFIX_OP (Increment, ++ );
    │ │ │ │ +
    697
    │ │ │ │ +
    698 DUNE_SIMD_PREFIX_OP (Plus, + );
    │ │ │ │ +
    699 DUNE_SIMD_PREFIX_OP (Minus, - );
    │ │ │ │ +
    700 DUNE_SIMD_PREFIX_OP (LogicNot, ! );
    │ │ │ │ +
    701 // Do not warn about ~ being applied to bool. (1) Yes, doing that is
    │ │ │ │ +
    702 // weird, but we do want to test the weird stuff too. (2) It avoids
    │ │ │ │ +
    703 // running into <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82040> on
    │ │ │ │ +
    704 // g++-7.0 through 7.2. Also, ignore -Wpragmas to not warn about an
    │ │ │ │ +
    705 // unknown -Wbool-operation on compilers that do not know that option.
    │ │ │ │ +
    706#pragma GCC diagnostic push
    │ │ │ │ +
    707#pragma GCC diagnostic ignored "-Wpragmas"
    │ │ │ │ +
    708#pragma GCC diagnostic ignored "-Wunknown-warning-option" // clang 6.0.1
    │ │ │ │ +
    709#pragma GCC diagnostic ignored "-Wbool-operation"
    │ │ │ │ +
    710 DUNE_SIMD_PREFIX_OP (BitNot, ~ );
    │ │ │ │ +
    711#pragma GCC diagnostic pop
    │ │ │ │ +
    712
    │ │ │ │ +
    713#undef DUNE_SIMD_POSTFIX_OP
    │ │ │ │ +
    714#undef DUNE_SIMD_PREFIX_OP
    │ │ │ │ +
    715
    │ │ │ │ +
    716 template<class V, class Op>
    │ │ │ │ +
    717 std::enable_if_t<
    │ │ │ │ +
    718 IsCallable<Op(decltype(lane(0, std::declval<V>())))>::value>
    │ │ │ │ +
    719 checkUnaryOpV(Op op)
    │ │ │ │ +
    720 {
    │ │ │ │ +
    721#define DUNE_SIMD_OPNAME (className<Op(V)>())
    │ │ │ │ +
    722 // arguments
    │ │ │ │ +
    723 auto val = leftVector<std::decay_t<V>>();
    │ │ │ │ +
    724
    │ │ │ │ +
    725 // copy the arguments in case V is a references
    │ │ │ │ +
    726 auto arg = val;
    │ │ │ │ +
    727 auto &&result = op(static_cast<V>(arg));
    │ │ │ │ +
    728 using T = Scalar<std::decay_t<decltype(result)> >;
    │ │ │ │ +
    729 for(std::size_t l = 0; l < lanes(val); ++l)
    │ │ │ │ +
    730 {
    │ │ │ │ +
    731 // `op` might promote the argument. This is a problem if the
    │ │ │ │ +
    732 // argument of the operation on the right of the `==` is
    │ │ │ │ +
    733 // e.g. `(unsigned short)1` and the operation is e.g. unary `-`.
    │ │ │ │ +
    734 // Then the argument is promoted to `int` before applying the
    │ │ │ │ +
    735 // negation, and the result is `(int)-1`. However, the left side of
    │ │ │ │ +
    736 // the `==` is still `(unsigned short)-1`, which typically is the
    │ │ │ │ +
    737 // same as `(unsigned short)65535`. The `==` promotes the left side
    │ │ │ │ +
    738 // before comparing, so that becomes `(int)65535`. It will then
    │ │ │ │ +
    739 // compare `(int)65535` and `(int)-1` and rightly declare them to be
    │ │ │ │ +
    740 // not equal.
    │ │ │ │ +
    741
    │ │ │ │ +
    742 // To work around this, we explicitly convert the right side of the
    │ │ │ │ +
    743 // `==` to the scalar type before comparing.
    │ │ │ │ + │ │ │ │ +
    745 (lane(l, result)
    │ │ │ │ +
    746 == static_cast<T>(op(lane(l, static_cast<V>(val)))));
    │ │ │ │ +
    747 }
    │ │ │ │ +
    748 // op might modify val, verify that any such modification also happens
    │ │ │ │ +
    749 // in the vector case
    │ │ │ │ +
    750 for(std::size_t l = 0; l < lanes<std::decay_t<V> >(); ++l)
    │ │ │ │ +
    751 DUNE_SIMD_CHECK_OP(lane(l, val) == lane(l, arg));
    │ │ │ │ +
    752#undef DUNE_SIMD_OPNAME
    │ │ │ │ +
    753 }
    │ │ │ │ +
    754
    │ │ │ │ +
    755 template<class V, class Op>
    │ │ │ │ +
    756 std::enable_if_t<
    │ │ │ │ +
    757 not IsCallable<Op(decltype(lane(0, std::declval<V>())))>::value>
    │ │ │ │ +
    758 checkUnaryOpV(Op op)
    │ │ │ │ +
    759 {
    │ │ │ │ +
    760 // log_ << "No " << className<Op(decltype(lane(0, std::declval<V>())))>()
    │ │ │ │ +
    761 // << std::endl
    │ │ │ │ +
    762 // << " ==> Not checking " << className<Op(V)>() << std::endl;
    │ │ │ │ +
    763 }
    │ │ │ │ +
    764
    │ │ │ │ +
    765 template<class V, class Op>
    │ │ │ │ +
    766 void checkUnaryOpsV(Op op)
    │ │ │ │ +
    767 {
    │ │ │ │ +
    768 checkUnaryOpV<V&>(op);
    │ │ │ │ +
    769 checkUnaryOpV<const V&>(op);
    │ │ │ │ +
    770 checkUnaryOpV<V&&>(op);
    │ │ │ │ +
    771 }
    │ │ │ │ +
    772
    │ │ │ │ +
    774 //
    │ │ │ │ +
    775 // checks for binary operators
    │ │ │ │ +
    776 //
    │ │ │ │ +
    777
    │ │ │ │ +
    778 // The operators contain an `operator()`, which will be invoked for both
    │ │ │ │ +
    779 // scalar and vector arguments. The function `scalar()` is used the
    │ │ │ │ +
    780 // test whether the scalar types support the operation (via
    │ │ │ │ +
    781 // `ScalarResult`). The difference is that `scalar()` should only ever
    │ │ │ │ +
    782 // receive `const`-ref-qualified version of `Scalar<V>`, while the
    │ │ │ │ +
    783 // `operator()` may also be called with proxies representing scalars.
    │ │ │ │ +
    │ │ │ │ +
    784#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL) \
    │ │ │ │ +
    785 struct OpInfix##NAME \
    │ │ │ │ +
    786 { \
    │ │ │ │ +
    787 template<class V1, class V2> \
    │ │ │ │ +
    788 decltype(auto) operator()(V1&& v1, V2&& v2) const \
    │ │ │ │ +
    789 { \
    │ │ │ │ +
    790 return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
    │ │ │ │ +
    791 } \
    │ │ │ │ +
    792 template<class S1, class S2> \
    │ │ │ │ +
    793 auto scalar(S1&& s1, S2&& s2) const \
    │ │ │ │ +
    794 -> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
    │ │ │ │ +
    795 }
    │ │ │ │ +
    │ │ │ │ +
    796
    │ │ │ │ +
    797 // for assign ops, accept only non-const lvalue arguments for scalars.
    │ │ │ │ +
    798 // This is needed for class scalars (e.g. std::complex) because
    │ │ │ │ +
    799 // non-const class rvalues are actually usually assignable. Though that
    │ │ │ │ +
    800 // assignment happens to a temporary, and thus is lost. Except that the
    │ │ │ │ +
    801 // tests would bind the result of the assignment to a reference. And
    │ │ │ │ +
    802 // because that result is returned from a function by reference, even
    │ │ │ │ +
    803 // though it is a temporary passed as an argument to that function,
    │ │ │ │ +
    804 // accessing the result later is undefined behaviour.
    │ │ │ │ +
    │ │ │ │ +
    805#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL) \
    │ │ │ │ +
    806 struct OpInfix##NAME \
    │ │ │ │ +
    807 { \
    │ │ │ │ +
    808 template<class V1, class V2> \
    │ │ │ │ +
    809 decltype(auto) operator()(V1&& v1, V2&& v2) const \
    │ │ │ │ +
    810 { \
    │ │ │ │ +
    811 return std::forward<V1>(v1) SYMBOL std::forward<V2>(v2); \
    │ │ │ │ +
    812 } \
    │ │ │ │ +
    813 template<class S1, class S2> \
    │ │ │ │ +
    814 auto scalar(S1& s1, S2&& s2) const \
    │ │ │ │ +
    815 -> decltype(s1 SYMBOL std::forward<S2>(s2)); \
    │ │ │ │ +
    816 }
    │ │ │ │ +
    │ │ │ │ +
    817
    │ │ │ │ +
    │ │ │ │ +
    818#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL) \
    │ │ │ │ +
    819 struct OpInfix##NAME \
    │ │ │ │ +
    820 { \
    │ │ │ │ +
    821 template<class V1, class V2> \
    │ │ │ │ +
    822 decltype(auto) operator()(V1&& v1, V2&& v2) const \
    │ │ │ │ +
    823 { \
    │ │ │ │ +
    824 return Simd::REPLFN(std::forward<V1>(v1), std::forward<V2>(v2)); \
    │ │ │ │ +
    825 } \
    │ │ │ │ +
    826 template<class S1, class S2> \
    │ │ │ │ +
    827 auto scalar(S1&& s1, S2&& s2) const \
    │ │ │ │ +
    828 -> decltype(std::forward<S1>(s1) SYMBOL std::forward<S2>(s2)); \
    │ │ │ │ +
    829 }
    │ │ │ │ +
    │ │ │ │ +
    830
    │ │ │ │ +
    831 DUNE_SIMD_INFIX_OP(Mul, * );
    │ │ │ │ +
    832 DUNE_SIMD_INFIX_OP(Div, / );
    │ │ │ │ +
    833 DUNE_SIMD_INFIX_OP(Remainder, % );
    │ │ │ │ +
    834
    │ │ │ │ +
    835 DUNE_SIMD_INFIX_OP(Plus, + );
    │ │ │ │ +
    836 DUNE_SIMD_INFIX_OP(Minus, - );
    │ │ │ │ +
    837
    │ │ │ │ +
    838 DUNE_SIMD_INFIX_OP(LeftShift, << );
    │ │ │ │ +
    839 DUNE_SIMD_INFIX_OP(RightShift, >> );
    │ │ │ │ +
    840
    │ │ │ │ +
    841 DUNE_SIMD_INFIX_OP(Less, < );
    │ │ │ │ +
    842 DUNE_SIMD_INFIX_OP(Greater, > );
    │ │ │ │ +
    843 DUNE_SIMD_INFIX_OP(LessEqual, <= );
    │ │ │ │ +
    844 DUNE_SIMD_INFIX_OP(GreaterEqual, >= );
    │ │ │ │ +
    845
    │ │ │ │ +
    846 DUNE_SIMD_INFIX_OP(Equal, == );
    │ │ │ │ +
    847 DUNE_SIMD_INFIX_OP(NotEqual, != );
    │ │ │ │ +
    848
    │ │ │ │ +
    849 DUNE_SIMD_INFIX_OP(BitAnd, & );
    │ │ │ │ +
    850 DUNE_SIMD_INFIX_OP(BitXor, ^ );
    │ │ │ │ +
    851 DUNE_SIMD_INFIX_OP(BitOr, | );
    │ │ │ │ +
    852
    │ │ │ │ +
    853 // Those are not supported in any meaningful way by vectorclass
    │ │ │ │ +
    854 // We need to test replacement functions maskAnd() and maskOr() instead.
    │ │ │ │ +
    855 DUNE_SIMD_REPL_OP(LogicAnd, maskAnd, && );
    │ │ │ │ +
    856 DUNE_SIMD_REPL_OP(LogicOr, maskOr, || );
    │ │ │ │ +
    857
    │ │ │ │ +
    858 DUNE_SIMD_ASSIGN_OP(Assign, = );
    │ │ │ │ +
    859 DUNE_SIMD_ASSIGN_OP(AssignMul, *= );
    │ │ │ │ +
    860 DUNE_SIMD_ASSIGN_OP(AssignDiv, /= );
    │ │ │ │ +
    861 DUNE_SIMD_ASSIGN_OP(AssignRemainder, %= );
    │ │ │ │ +
    862 DUNE_SIMD_ASSIGN_OP(AssignPlus, += );
    │ │ │ │ +
    863 DUNE_SIMD_ASSIGN_OP(AssignMinus, -= );
    │ │ │ │ +
    864 DUNE_SIMD_ASSIGN_OP(AssignLeftShift, <<=);
    │ │ │ │ +
    865 DUNE_SIMD_ASSIGN_OP(AssignRightShift, >>=);
    │ │ │ │ +
    866 DUNE_SIMD_ASSIGN_OP(AssignAnd, &= );
    │ │ │ │ +
    867 DUNE_SIMD_ASSIGN_OP(AssignXor, ^= );
    │ │ │ │ +
    868 DUNE_SIMD_ASSIGN_OP(AssignOr, |= );
    │ │ │ │ +
    869
    │ │ │ │ +
    870#undef DUNE_SIMD_INFIX_OP
    │ │ │ │ +
    871#undef DUNE_SIMD_REPL_OP
    │ │ │ │ +
    872#undef DUNE_SIMD_ASSIGN_OP
    │ │ │ │ +
    873
    │ │ │ │ +
    874 // just used as a tag
    │ │ │ │ +
    875 struct OpInfixComma {};
    │ │ │ │ +
    876
    │ │ │ │ +
    877 template<class T1, class T2>
    │ │ │ │ +
    878 void checkCommaOp(const std::decay_t<T1> &val1,
    │ │ │ │ +
    879 const std::decay_t<T2> &val2)
    │ │ │ │ +
    880 {
    │ │ │ │ +
    881#define DUNE_SIMD_OPNAME (className<OpInfixComma(T1, T2)>())
    │ │ │ │ +
    882 static_assert(std::is_same<decltype((std::declval<T1>(),
    │ │ │ │ +
    883 std::declval<T2>())), T2>::value,
    │ │ │ │ +
    884 "Type and value category of the comma operator must "
    │ │ │ │ +
    885 "match that of the second operand");
    │ │ │ │ +
    886
    │ │ │ │ +
    887 // copy the arguments in case T1 or T2 are references
    │ │ │ │ +
    888 auto arg1 = val1;
    │ │ │ │ +
    889 auto arg2 = val2;
    │ │ │ │ +
    890 // Do not warn that the left side of the comma operator is unused.
    │ │ │ │ +
    891 // Seems to work for g++-4.9 and clang++-3.8. Appears to be harmless
    │ │ │ │ +
    892 // for icpc (14 and 17), and icpc does not seem to issue a warning
    │ │ │ │ +
    893 // anyway.
    │ │ │ │ +
    894#pragma GCC diagnostic push
    │ │ │ │ +
    895#pragma GCC diagnostic ignored "-Wunused-value"
    │ │ │ │ +
    896 auto &&result = (static_cast<T1>(arg1),
    │ │ │ │ +
    897 static_cast<T2>(arg2));
    │ │ │ │ +
    898#pragma GCC diagnostic pop
    │ │ │ │ +
    899 if(std::is_reference<T2>::value)
    │ │ │ │ +
    900 {
    │ │ │ │ +
    901 // comma should return the same object as the second argument for
    │ │ │ │ +
    902 // lvalues and xvalues
    │ │ │ │ +
    903 DUNE_SIMD_CHECK_OP(&result == &arg2);
    │ │ │ │ +
    904 // it should not modify any arguments
    │ │ │ │ +
    905 DUNE_SIMD_CHECK_OP(allTrue(val1 == arg1));
    │ │ │ │ +
    906 DUNE_SIMD_CHECK_OP(allTrue(val2 == arg2));
    │ │ │ │ +
    907 }
    │ │ │ │ +
    908 else
    │ │ │ │ +
    909 {
    │ │ │ │ +
    910 // comma should return the same value as the second argument for
    │ │ │ │ +
    911 // prvalues
    │ │ │ │ +
    912 DUNE_SIMD_CHECK_OP(allTrue(result == arg2));
    │ │ │ │ +
    913 // it should not modify any arguments
    │ │ │ │ +
    914 DUNE_SIMD_CHECK_OP(allTrue(val1 == arg1));
    │ │ │ │ +
    915 // second argument is a prvalue, any modifications happen to a
    │ │ │ │ +
    916 // temporary and we can't detect them
    │ │ │ │ +
    917 }
    │ │ │ │ +
    918#undef DUNE_SIMD_OPNAME
    │ │ │ │ +
    919 }
    │ │ │ │ +
    920
    │ │ │ │ +
    922 //
    │ │ │ │ +
    923 // checks for vector-vector binary operations
    │ │ │ │ +
    924 //
    │ │ │ │ +
    925
    │ │ │ │ +
    926 // We check the following candidate operation
    │ │ │ │ +
    927 //
    │ │ │ │ +
    928 // vopres = vop1 @ vop2
    │ │ │ │ +
    929 //
    │ │ │ │ +
    930 // against the reference operation
    │ │ │ │ +
    931 //
    │ │ │ │ +
    932 // arefres[l] = aref1[l] @ aref2[l] foreach l
    │ │ │ │ +
    933 //
    │ │ │ │ +
    934 // v... variables are simd-vectors and a... variables are arrays. The
    │ │ │ │ +
    935 // operation may modify the operands, but if is does the modification
    │ │ │ │ +
    936 // needs to happen in both the candidate and the reference.
    │ │ │ │ +
    937 //
    │ │ │ │ +
    938 // We do the following checks:
    │ │ │ │ +
    939 // 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    940 // 2. lane(l, vopres) == arefres[l] foreach l
    │ │ │ │ +
    941 // 3. lane(l, vop1) == aref1[l] foreach l
    │ │ │ │ +
    942 // 4. lane(l, vop2) == aref2[l] foreach l
    │ │ │ │ +
    943 template<class V1, class V2, class Op>
    │ │ │ │ +
    944 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, V2> >
    │ │ │ │ +
    945 checkBinaryOpVV(MetaType<V1>, MetaType<V2>, Op op)
    │ │ │ │ +
    946 {
    │ │ │ │ +
    947#define DUNE_SIMD_OPNAME (className<Op(V1, V2)>())
    │ │ │ │ +
    948 static_assert(std::is_same<std::decay_t<V1>, std::decay_t<V2> >::value,
    │ │ │ │ +
    949 "Internal testsystem error: called with two types that "
    │ │ │ │ +
    950 "don't decay to the same thing");
    │ │ │ │ +
    951
    │ │ │ │ +
    952 // reference arguments
    │ │ │ │ +
    953 auto vref1 = leftVector<std::decay_t<V1>>();
    │ │ │ │ +
    954 auto vref2 = rightVector<std::decay_t<V2>>();
    │ │ │ │ +
    955
    │ │ │ │ +
    956 // candidate arguments
    │ │ │ │ +
    957 auto vop1 = vref1;
    │ │ │ │ +
    958 auto vop2 = vref2;
    │ │ │ │ +
    959
    │ │ │ │ +
    960 // candidate operation
    │ │ │ │ +
    961 auto &&vopres = op(static_cast<V1>(vop1), static_cast<V2>(vop2));
    │ │ │ │ +
    962 using VR = decltype(vopres);
    │ │ │ │ +
    963
    │ │ │ │ +
    964 // check 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    965 static_assert(lanes<std::decay_t<VR> >() == lanes<std::decay_t<V1> >(),
    │ │ │ │ +
    966 "The result must have the same number of lanes as the "
    │ │ │ │ +
    967 "operands.");
    │ │ │ │ +
    968
    │ │ │ │ +
    969 // do the reference operation, and simultaneously
    │ │ │ │ +
    970 // check 2. lane(l, vopres) == arefres[l] foreach l
    │ │ │ │ +
    971 using T = Scalar<std::decay_t<VR> >;
    │ │ │ │ +
    972 for(auto l : range(lanes(vopres)))
    │ │ │ │ +
    973 {
    │ │ │ │ +
    974 // see the lengthy comment in `checkUnaryOpV()` as to why the
    │ │ │ │ +
    975 // `static_cast` around the `op()` is necessary
    │ │ │ │ + │ │ │ │ +
    977 (lane(l, vopres)
    │ │ │ │ +
    978 == static_cast<T>(op(lane(l, static_cast<V1>(vref1)),
    │ │ │ │ +
    979 lane(l, static_cast<V2>(vref2)))));
    │ │ │ │ +
    980 }
    │ │ │ │ +
    981
    │ │ │ │ +
    982 // check 3. lane(l, vop1) == aref1[l] foreach l
    │ │ │ │ +
    983 for(auto l : range(lanes(vop1)))
    │ │ │ │ +
    984 DUNE_SIMD_CHECK_OP(lane(l, vop1) == lane(l, vref1));
    │ │ │ │ +
    985
    │ │ │ │ +
    986 // check 4. lane(l, vop2) == aref2[l] foreach l
    │ │ │ │ +
    987 for(auto l : range(lanes(vop2)))
    │ │ │ │ +
    988 DUNE_SIMD_CHECK_OP(lane(l, vop2) == lane(l, vref2));
    │ │ │ │ +
    989
    │ │ │ │ +
    990#undef DUNE_SIMD_OPNAME
    │ │ │ │ +
    991 }
    │ │ │ │ +
    992
    │ │ │ │ +
    993 template<class V1, class V2, class Op>
    │ │ │ │ +
    994 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, V2> >
    │ │ │ │ +
    995 checkBinaryOpVV(MetaType<V1>, MetaType<V2>, Op op)
    │ │ │ │ +
    996 {
    │ │ │ │ +
    997 // log_ << "No " << className<Op(decltype(lane(0, std::declval<V1>())),
    │ │ │ │ +
    998 // decltype(lane(0, std::declval<V2>())))>()
    │ │ │ │ +
    999 // << std::endl
    │ │ │ │ +
    1000 // << " ==> Not checking " << className<Op(V1, V2)>() << std::endl;
    │ │ │ │ +
    1001 }
    │ │ │ │ +
    1002
    │ │ │ │ +
    1003 template<class V1, class V2>
    │ │ │ │ +
    1004 void checkBinaryOpVV(MetaType<V1>, MetaType<V2>, OpInfixComma)
    │ │ │ │ +
    1005 {
    │ │ │ │ +
    1006 static_assert(std::is_same<std::decay_t<V1>, std::decay_t<V2> >::value,
    │ │ │ │ +
    1007 "Internal testsystem error: called with two types that "
    │ │ │ │ +
    1008 "don't decay to the same thing");
    │ │ │ │ +
    1009
    │ │ │ │ +
    1010 checkCommaOp<V1, V2>(leftVector<std::decay_t<V1>>(),
    │ │ │ │ +
    1011 rightVector<std::decay_t<V2>>());
    │ │ │ │ +
    1012 }
    │ │ │ │ +
    1013
    │ │ │ │ +
    1015 //
    │ │ │ │ +
    1016 // checks for vector-scalar binary operations
    │ │ │ │ +
    1017 //
    │ │ │ │ +
    1018
    │ │ │ │ +
    1019 // We check the following candidate operation
    │ │ │ │ +
    1020 //
    │ │ │ │ +
    1021 // vopres = vop1 @ sop2
    │ │ │ │ +
    1022 //
    │ │ │ │ +
    1023 // against the reference operation
    │ │ │ │ +
    1024 //
    │ │ │ │ +
    1025 // arefres[l] = aref1[l] @ sref2 foreach l
    │ │ │ │ +
    1026 //
    │ │ │ │ +
    1027 // v... variables are simd-vectors, a... variables are arrays, and
    │ │ │ │ +
    1028 // s... variables are scalars. The operation may modify the left
    │ │ │ │ +
    1029 // operand, but if is does the modifications needs to happen in both the
    │ │ │ │ +
    1030 // candidate and the reference.
    │ │ │ │ +
    1031 //
    │ │ │ │ +
    1032 // We do the following checks:
    │ │ │ │ +
    1033 // 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    1034 // 2. lane(l, vopres) == arefres[l] foreach l
    │ │ │ │ +
    1035 // 3. lane(l, vop1) == aref1[l] foreach l
    │ │ │ │ +
    1036 // 4. sop2 is never modified
    │ │ │ │ +
    1037 // 5. sref2 is never modified
    │ │ │ │ +
    1038 //
    │ │ │ │ +
    1039 // In fact, if the property "sref2 is never modified" is violated that
    │ │ │ │ +
    1040 // means the operation is unsuitable for an automatic broadcast of the
    │ │ │ │ +
    1041 // second operand and should not be checked. There are no operations in
    │ │ │ │ +
    1042 // the standard where the second operand is modified like this, but
    │ │ │ │ +
    1043 // there are operations where the first operand is modified -- and this
    │ │ │ │ +
    1044 // check is used for those ops as well by exchanging the first and second
    │ │ │ │ +
    1045 // argument below.
    │ │ │ │ +
    1046
    │ │ │ │ +
    1047 template<class V1, class T2, class Op>
    │ │ │ │ +
    1048 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, T2> >
    │ │ │ │ +
    1049 checkBinaryOpVS(MetaType<V1>, MetaType<T2>, Op op)
    │ │ │ │ +
    1050 {
    │ │ │ │ +
    1051#define DUNE_SIMD_OPNAME (className<Op(V1, T2)>())
    │ │ │ │ +
    1052 static_assert(std::is_same<Scalar<std::decay_t<V1> >,
    │ │ │ │ +
    1053 std::decay_t<T2> >::value,
    │ │ │ │ +
    1054 "Internal testsystem error: called with a scalar that "
    │ │ │ │ +
    1055 "does not match the vector type.");
    │ │ │ │ +
    1056
    │ │ │ │ +
    1057 // initial values
    │ │ │ │ +
    1058 auto sinit2 = rightScalar<std::decay_t<T2>>();
    │ │ │ │ +
    1059
    │ │ │ │ +
    1060 // reference arguments
    │ │ │ │ +
    1061 auto vref1 = leftVector<std::decay_t<V1>>();
    │ │ │ │ +
    1062 auto sref2 = sinit2;
    │ │ │ │ +
    1063
    │ │ │ │ +
    1064 // candidate arguments
    │ │ │ │ +
    1065 auto vop1 = vref1;
    │ │ │ │ +
    1066 auto sop2 = sref2;
    │ │ │ │ +
    1067
    │ │ │ │ +
    1068 // candidate operation
    │ │ │ │ +
    1069 auto &&vopres = op(static_cast<V1>(vop1), static_cast<T2>(sop2));
    │ │ │ │ +
    1070 using VR = decltype(vopres);
    │ │ │ │ +
    1071
    │ │ │ │ +
    1072 // check 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    1073 static_assert(lanes<std::decay_t<VR> >() == lanes<std::decay_t<V1> >(),
    │ │ │ │ +
    1074 "The result must have the same number of lanes as the "
    │ │ │ │ +
    1075 "operands.");
    │ │ │ │ +
    1076
    │ │ │ │ +
    1077 // check 4. sop2 is never modified
    │ │ │ │ +
    1078 DUNE_SIMD_CHECK_OP(sop2 == sinit2);
    │ │ │ │ +
    1079
    │ │ │ │ +
    1080 // do the reference operation, and simultaneously check 2. and 5.
    │ │ │ │ +
    1081 using T = Scalar<std::decay_t<decltype(vopres)> >;
    │ │ │ │ +
    1082 for(auto l : range(lanes(vopres)))
    │ │ │ │ +
    1083 {
    │ │ │ │ +
    1084 // check 2. lane(l, vopres) == arefres[l] foreach l
    │ │ │ │ +
    1085 // see the lengthy comment in `checkUnaryOpV()` as to why the
    │ │ │ │ +
    1086 // `static_cast` around the `op()` is necessary
    │ │ │ │ + │ │ │ │ +
    1088 (lane(l, vopres)
    │ │ │ │ +
    1089 == static_cast<T>(op(lane(l, static_cast<V1>(vref1)),
    │ │ │ │ +
    1090 static_cast<T2>(sref2) )));
    │ │ │ │ +
    1091 // check 5. sref2 is never modified
    │ │ │ │ +
    1092 DUNE_SIMD_CHECK_OP(sref2 == sinit2);
    │ │ │ │ +
    1093 }
    │ │ │ │ +
    1094
    │ │ │ │ +
    1095 // check 3. lane(l, vop1) == aref1[l] foreach l
    │ │ │ │ +
    1096 for(auto l : range(lanes(vop1)))
    │ │ │ │ +
    1097 DUNE_SIMD_CHECK_OP(lane(l, vop1) == lane(l, vref1));
    │ │ │ │ +
    1098
    │ │ │ │ +
    1099#undef DUNE_SIMD_OPNAME
    │ │ │ │ +
    1100 }
    │ │ │ │ +
    1101
    │ │ │ │ +
    1102 template<class V1, class T2, class Op>
    │ │ │ │ +
    1103 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, T2> >
    │ │ │ │ +
    1104 checkBinaryOpVS(MetaType<V1>, MetaType<T2>, Op op)
    │ │ │ │ +
    1105 {
    │ │ │ │ +
    1106 // log_ << "No "
    │ │ │ │ +
    1107 // << className<Op(decltype(lane(0, std::declval<V1>())), T2)>()
    │ │ │ │ +
    1108 // << std::endl
    │ │ │ │ +
    1109 // << " ==> Not checking " << className<Op(V1, T2)>() << std::endl;
    │ │ │ │ +
    1110 }
    │ │ │ │ +
    1111
    │ │ │ │ +
    1112 template<class V1, class T2>
    │ │ │ │ +
    1113 void checkBinaryOpVS(MetaType<V1>, MetaType<T2>, OpInfixComma)
    │ │ │ │ +
    1114 {
    │ │ │ │ +
    1115 static_assert(std::is_same<Scalar<std::decay_t<V1> >,
    │ │ │ │ +
    1116 std::decay_t<T2> >::value,
    │ │ │ │ +
    1117 "Internal testsystem error: called with a scalar that "
    │ │ │ │ +
    1118 "does not match the vector type.");
    │ │ │ │ +
    1119
    │ │ │ │ +
    1120 checkCommaOp<V1, T2>(leftVector<std::decay_t<V1>>(),
    │ │ │ │ +
    1121 rightScalar<std::decay_t<T2>>());
    │ │ │ │ +
    1122 }
    │ │ │ │ +
    1123
    │ │ │ │ +
    1125 //
    │ │ │ │ +
    1126 // cross-check scalar-vector binary operations against vector-vector
    │ │ │ │ +
    1127 //
    │ │ │ │ +
    1128
    │ │ │ │ +
    1129 // We check the following candidate operation
    │ │ │ │ +
    1130 //
    │ │ │ │ +
    1131 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2)
    │ │ │ │ +
    1132 //
    │ │ │ │ +
    1133 // against the reference operation
    │ │ │ │ +
    1134 //
    │ │ │ │ +
    1135 // vrefres = vref1 @ sref2
    │ │ │ │ +
    1136 //
    │ │ │ │ +
    1137 // v... variables are simd-vectors, a... variables are arrays, and
    │ │ │ │ +
    1138 // s... variables are scalars.
    │ │ │ │ +
    1139 //
    │ │ │ │ +
    1140 // We could check the following properties
    │ │ │ │ +
    1141 // 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    1142 // 2. lane(l, vopres) == lane(l, vrefres) foreach l
    │ │ │ │ +
    1143 // 3. lane(l, vop1) == lane(l, vref1) foreach l
    │ │ │ │ +
    1144 // but these are given by checking the operation against the scalar
    │ │ │ │ +
    1145 // operation in the vector@vector and vector@scalar cases above.
    │ │ │ │ +
    1146 //
    │ │ │ │ +
    1147 // The only thing left to check is:
    │ │ │ │ +
    1148 // 4. lane(l, vop2) foreach l is never modified
    │ │ │ │ +
    1149
    │ │ │ │ +
    1150 template<class V1, class T2, class Op>
    │ │ │ │ +
    1151 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, T2> >
    │ │ │ │ +
    1152 checkBinaryOpVVAgainstVS(MetaType<V1>, MetaType<T2>, Op op)
    │ │ │ │ +
    1153 {
    │ │ │ │ +
    1154#define DUNE_SIMD_OPNAME (className<Op(V1, T2)>())
    │ │ │ │ +
    1155 static_assert(std::is_same<Scalar<std::decay_t<V1> >,
    │ │ │ │ +
    1156 std::decay_t<T2> >::value,
    │ │ │ │ +
    1157 "Internal testsystem error: called with a scalar that "
    │ │ │ │ +
    1158 "does not match the vector type.");
    │ │ │ │ +
    1159
    │ │ │ │ +
    1160 // initial values
    │ │ │ │ +
    1161 auto sinit2 = rightScalar<std::decay_t<T2>>();
    │ │ │ │ +
    1162
    │ │ │ │ +
    1163 // reference arguments
    │ │ │ │ +
    1164 auto vop1 = leftVector<std::decay_t<V1>>();
    │ │ │ │ +
    1165 using V2 = CopyRefQual<V1, T2>;
    │ │ │ │ +
    1166 std::decay_t<V2> vop2(sinit2);
    │ │ │ │ +
    1167
    │ │ │ │ +
    1168 // candidate operation
    │ │ │ │ +
    1169 op(static_cast<V1>(vop1), static_cast<V2>(vop2));
    │ │ │ │ +
    1170
    │ │ │ │ +
    1171 // 4. lane(l, vop2) foreach l is never modified
    │ │ │ │ +
    1172 for(auto l : range(lanes(vop2)))
    │ │ │ │ +
    1173 DUNE_SIMD_CHECK_OP(lane(l, vop2) == sinit2);
    │ │ │ │ +
    1174
    │ │ │ │ +
    1175#undef DUNE_SIMD_OPNAME
    │ │ │ │ +
    1176 }
    │ │ │ │ +
    1177
    │ │ │ │ +
    1178 template<class V1, class T2, class Op>
    │ │ │ │ +
    1179 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, T2> >
    │ │ │ │ +
    1180 checkBinaryOpVVAgainstVS(MetaType<V1>, MetaType<T2>, Op op)
    │ │ │ │ +
    1181 {
    │ │ │ │ +
    1182 // log_ << "No "
    │ │ │ │ +
    1183 // << className<Op(decltype(lane(0, std::declval<V1>())), T2)>()
    │ │ │ │ +
    1184 // << std::endl
    │ │ │ │ +
    1185 // << " ==> Not checking " << className<Op(V1, T2)>() << std::endl;
    │ │ │ │ +
    1186 }
    │ │ │ │ +
    1187
    │ │ │ │ +
    1188 template<class V1, class T2>
    │ │ │ │ +
    1189 void checkBinaryOpVVAgainstVS(MetaType<V1>, MetaType<T2>, OpInfixComma)
    │ │ │ │ +
    1190 { }
    │ │ │ │ +
    1191
    │ │ │ │ +
    1193 //
    │ │ │ │ +
    1194 // checks for vector-proxy binary operations
    │ │ │ │ +
    1195 //
    │ │ │ │ +
    1196
    │ │ │ │ +
    1197 // We check the following candidate operation
    │ │ │ │ +
    1198 //
    │ │ │ │ +
    1199 // vopres = vop1 @ pop2
    │ │ │ │ +
    1200 //
    │ │ │ │ +
    1201 // against the reference operation
    │ │ │ │ +
    1202 //
    │ │ │ │ +
    1203 // arefres[l] = aref1[l] @ sref2 foreach l
    │ │ │ │ +
    1204 //
    │ │ │ │ +
    1205 // v... variables are simd-vectors, a... variables are arrays,
    │ │ │ │ +
    1206 // p... variables are proxies of simd-vector entries and s... variables
    │ │ │ │ +
    1207 // are scalars. The operation may modify the left operand, but if is
    │ │ │ │ +
    1208 // does the modifications needs to happen in both the candidate and the
    │ │ │ │ +
    1209 // reference.
    │ │ │ │ +
    1210 //
    │ │ │ │ +
    1211 // We do the following checks:
    │ │ │ │ +
    1212 // 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    1213 // 2. lane(l, vopres) == arefres[l] foreach l
    │ │ │ │ +
    1214 // 3. lane(l, vop1) == aref1[l] foreach l
    │ │ │ │ +
    1215 // 4. pop2 is never modified
    │ │ │ │ +
    1216 // 5. sref2 is never modified
    │ │ │ │ +
    1217 //
    │ │ │ │ +
    1218 // In fact, if the property "sref2 is never modified" is violated that
    │ │ │ │ +
    1219 // means the operation is unsuitable for an automatic broadcast of the
    │ │ │ │ +
    1220 // second operand and should not be checked. There are no operations in
    │ │ │ │ +
    1221 // the standard where the second operand is modified like this, but
    │ │ │ │ +
    1222 // there are operations where the first operand is modified -- and this
    │ │ │ │ +
    1223 // check is used for those ops as well by exchanging the first and second
    │ │ │ │ +
    1224 // argument below.
    │ │ │ │ +
    1225
    │ │ │ │ +
    1226 template<class V1, class V2, class Op>
    │ │ │ │ +
    1227 std::enable_if_t<Std::is_detected_v<ScalarResult, Op, V1, V2> >
    │ │ │ │ +
    1228 checkBinaryOpVP(MetaType<V1>, MetaType<V2>, Op op)
    │ │ │ │ +
    1229 {
    │ │ │ │ +
    1230 using P2 = decltype(lane(0, std::declval<V2>()));
    │ │ │ │ +
    1231 using T2 = CopyRefQual<Scalar<V2>, V2>;
    │ │ │ │ +
    1232#define DUNE_SIMD_OPNAME (className<Op(V1, P2)>())
    │ │ │ │ +
    1233 static_assert(std::is_same<Scalar<V1>, Scalar<V2> >::value,
    │ │ │ │ +
    1234 "Internal testsystem error: called with two vector "
    │ │ │ │ +
    1235 "types whose scalar types don't match.");
    │ │ │ │ +
    1236
    │ │ │ │ +
    1237 // initial values
    │ │ │ │ +
    1238 auto sinit2 = rightScalar<Scalar<V2>>();
    │ │ │ │ +
    1239
    │ │ │ │ +
    1240 // reference arguments
    │ │ │ │ +
    1241 auto vref1 = leftVector<std::decay_t<V1>>();
    │ │ │ │ +
    1242 auto sref2 = sinit2;
    │ │ │ │ +
    1243
    │ │ │ │ +
    1244 // candidate arguments
    │ │ │ │ +
    1245 auto vop1 = vref1;
    │ │ │ │ +
    1246 auto vop2 = std::decay_t<V2>(Scalar<V2>(0));
    │ │ │ │ +
    1247 lane(0, vop2) = sref2; // pop2 is just a name for `lane(0, vop2)`
    │ │ │ │ +
    1248
    │ │ │ │ +
    1249 // candidate operation
    │ │ │ │ +
    1250 auto &&vopres =
    │ │ │ │ +
    1251 op(static_cast<V1>(vop1), lane(0, static_cast<V2>(vop2)));
    │ │ │ │ +
    1252 using VR = decltype(vopres);
    │ │ │ │ +
    1253
    │ │ │ │ +
    1254 // check 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    1255 static_assert(lanes<std::decay_t<VR> >() == lanes<std::decay_t<V1> >(),
    │ │ │ │ +
    1256 "The result must have the same number of lanes as the "
    │ │ │ │ +
    1257 "operands.");
    │ │ │ │ +
    1258
    │ │ │ │ +
    1259 // check 4. pop2 is never modified
    │ │ │ │ +
    1260 DUNE_SIMD_CHECK_OP(lane(0, vop2) == sinit2);
    │ │ │ │ +
    1261
    │ │ │ │ +
    1262 // do the reference operation, and simultaneously check 2. and 5.
    │ │ │ │ +
    1263 using T = Scalar<decltype(vopres)>;
    │ │ │ │ +
    1264 for(auto l : range(lanes(vopres)))
    │ │ │ │ +
    1265 {
    │ │ │ │ +
    1266 // check 2. lane(l, vopres) == arefres[l] foreach l
    │ │ │ │ +
    1267 // see the lengthy comment in `checkUnaryOpV()` as to why the
    │ │ │ │ +
    1268 // `static_cast` around the `op()` is necessary
    │ │ │ │ + │ │ │ │ +
    1270 (lane(l, vopres)
    │ │ │ │ +
    1271 == static_cast<T>(op(lane(l, static_cast<V1>(vref1)),
    │ │ │ │ +
    1272 static_cast<T2>(sref2) )));
    │ │ │ │ +
    1273 // check 5. sref2 is never modified
    │ │ │ │ +
    1274 DUNE_SIMD_CHECK_OP(sref2 == sinit2);
    │ │ │ │ +
    1275 }
    │ │ │ │ +
    1276
    │ │ │ │ +
    1277 // check 3. lane(l, vop1) == aref1[l] foreach l
    │ │ │ │ +
    1278 for(auto l : range(lanes(vop1)))
    │ │ │ │ +
    1279 DUNE_SIMD_CHECK_OP(lane(l, vop1) == lane(l, vref1));
    │ │ │ │ +
    1280
    │ │ │ │ +
    1281#undef DUNE_SIMD_OPNAME
    │ │ │ │ +
    1282 }
    │ │ │ │ +
    1283
    │ │ │ │ +
    1284 template<class V1, class V2, class Op>
    │ │ │ │ +
    1285 std::enable_if_t<!Std::is_detected_v<ScalarResult, Op, V1, V2> >
    │ │ │ │ +
    1286 checkBinaryOpVP(MetaType<V1>, MetaType<V2>, Op op)
    │ │ │ │ +
    1287 {
    │ │ │ │ +
    1288 // log_ << "No "
    │ │ │ │ +
    1289 // << className<Op(decltype(lane(0, std::declval<V1>())), T2)>()
    │ │ │ │ +
    1290 // << std::endl
    │ │ │ │ +
    1291 // << " ==> Not checking " << className<Op(V1, T2)>() << std::endl;
    │ │ │ │ +
    1292 }
    │ │ │ │ +
    1293
    │ │ │ │ +
    1294 template<class V1, class V2>
    │ │ │ │ +
    1295 void checkBinaryOpVP(MetaType<V1>, MetaType<V2>, OpInfixComma)
    │ │ │ │ +
    1296 {
    │ │ │ │ +
    1297 // Don't really know how to check comma operator for proxies
    │ │ │ │ +
    1298 }
    │ │ │ │ +
    1299
    │ │ │ │ +
    1301 //
    │ │ │ │ +
    1302 // checks for (scalar/proxy)-vector binary operations
    │ │ │ │ +
    1303 //
    │ │ │ │ +
    1304
    │ │ │ │ +
    1305 template<class Op>
    │ │ │ │ +
    1306 struct OpInfixSwappedArgs
    │ │ │ │ +
    1307 {
    │ │ │ │ +
    1308 Op orig;
    │ │ │ │ +
    1309
    │ │ │ │ +
    1310 template<class V1, class V2>
    │ │ │ │ +
    1311 decltype(auto) operator()(V1&& v1, V2&& v2) const
    │ │ │ │ +
    1312 {
    │ │ │ │ +
    1313 return orig(std::forward<V2>(v2), std::forward<V1>(v1));
    │ │ │ │ +
    1314 }
    │ │ │ │ +
    1315 template<class S1, class S2>
    │ │ │ │ +
    1316 auto scalar(S1&& s1, S2&& s2) const
    │ │ │ │ +
    1317 -> decltype(orig.scalar(std::forward<S2>(s2), std::forward<S1>(s1)));
    │ │ │ │ +
    1318 };
    │ │ │ │ +
    1319
    │ │ │ │ +
    1320 template<class T1, class V2, class Op>
    │ │ │ │ +
    1321 void checkBinaryOpSV(MetaType<T1> t1, MetaType<V2> v2, Op op)
    │ │ │ │ +
    1322 {
    │ │ │ │ +
    1323 checkBinaryOpVS(v2, t1, OpInfixSwappedArgs<Op>{op});
    │ │ │ │ +
    1324 }
    │ │ │ │ +
    1325
    │ │ │ │ +
    1326 template<class T1, class V2>
    │ │ │ │ +
    1327 void checkBinaryOpSV(MetaType<T1>, MetaType<V2>, OpInfixComma)
    │ │ │ │ +
    1328 {
    │ │ │ │ +
    1329 static_assert(std::is_same<std::decay_t<T1>,
    │ │ │ │ +
    1330 Scalar<std::decay_t<V2> > >::value,
    │ │ │ │ +
    1331 "Internal testsystem error: called with a scalar that "
    │ │ │ │ +
    1332 "does not match the vector type.");
    │ │ │ │ +
    1333
    │ │ │ │ +
    1334 checkCommaOp<T1, V2>(leftScalar<std::decay_t<T1>>(),
    │ │ │ │ +
    1335 rightVector<std::decay_t<V2>>());
    │ │ │ │ +
    1336 }
    │ │ │ │ +
    1337
    │ │ │ │ +
    1338 template<class V1, class V2, class Op>
    │ │ │ │ +
    1339 void checkBinaryOpPV(MetaType<V1> v1, MetaType<V2> v2, Op op)
    │ │ │ │ +
    1340 {
    │ │ │ │ +
    1341 checkBinaryOpVP(v2, v1, OpInfixSwappedArgs<Op>{op});
    │ │ │ │ +
    1342 }
    │ │ │ │ +
    1343
    │ │ │ │ +
    1344 template<class V1, class V2>
    │ │ │ │ +
    1345 void checkBinaryOpPV(MetaType<V1>, MetaType<V2>, OpInfixComma)
    │ │ │ │ +
    1346 {
    │ │ │ │ +
    1347 // Don't really know how to check comma operator for proxies
    │ │ │ │ +
    1348 }
    │ │ │ │ +
    1349
    │ │ │ │ +
    1351 //
    │ │ │ │ +
    1352 // cross-check scalar-vector binary operations against vector-vector
    │ │ │ │ +
    1353 //
    │ │ │ │ +
    1354
    │ │ │ │ +
    1355 // We check the following candidate operation
    │ │ │ │ +
    1356 //
    │ │ │ │ +
    1357 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2)
    │ │ │ │ +
    1358 //
    │ │ │ │ +
    1359 // against the reference operation
    │ │ │ │ +
    1360 //
    │ │ │ │ +
    1361 // vrefres = vref1 @ sref2
    │ │ │ │ +
    1362 //
    │ │ │ │ +
    1363 // v... variables are simd-vectors, a... variables are arrays, and
    │ │ │ │ +
    1364 // s... variables are scalars.
    │ │ │ │ +
    1365 //
    │ │ │ │ +
    1366 // We could check the following properties
    │ │ │ │ +
    1367 // 1. lanes(vopres) == lanes(vop1)
    │ │ │ │ +
    1368 // 2. lane(l, vopres) == lane(l, vrefres) foreach l
    │ │ │ │ +
    1369 // 3. lane(l, vop1) == lane(l, vref1) foreach l
    │ │ │ │ +
    1370 // but these are given by checking the operation against the scalar
    │ │ │ │ +
    1371 // operation in the vector@vector and vector@scalar cases above.
    │ │ │ │ +
    1372 //
    │ │ │ │ +
    1373 // The only thing left to check is:
    │ │ │ │ +
    1374 // 4. lane(l, vop2) foreach l is never modified
    │ │ │ │ +
    1375
    │ │ │ │ +
    1376 template<class T1, class V2, class Op>
    │ │ │ │ +
    1377 void checkBinaryOpVVAgainstSV(MetaType<T1> t1, MetaType<V2> v2, Op op)
    │ │ │ │ +
    1378 {
    │ │ │ │ +
    1379 checkBinaryOpVVAgainstVS(v2, t1, OpInfixSwappedArgs<Op>{op});
    │ │ │ │ +
    1380 }
    │ │ │ │ +
    1381
    │ │ │ │ +
    1382 template<class V1, class T2>
    │ │ │ │ +
    1383 void checkBinaryOpVVAgainstSV(MetaType<V1>, MetaType<T2>, OpInfixComma)
    │ │ │ │ +
    1384 { }
    │ │ │ │ +
    1385
    │ │ │ │ +
    1387 //
    │ │ │ │ +
    1388 // Invoke the checks for all combinations
    │ │ │ │ +
    1389 //
    │ │ │ │ +
    1390
    │ │ │ │ +
    1391 template<class T1, class T2, bool condition, class Checker>
    │ │ │ │ +
    1392 void checkBinaryRefQual(Checker checker)
    │ │ │ │ +
    1393 {
    │ │ │ │ +
    1394 if constexpr (condition) {
    │ │ │ │ +
    1395 Hybrid::forEach(TypeList<T1&, const T1&, T1&&>{}, [=] (auto t1) {
    │ │ │ │ +
    1396 Hybrid::forEach(TypeList<T2&, const T2&, T2&&>{}, [=] (auto t2) {
    │ │ │ │ +
    1397 checker(t1, t2);
    │ │ │ │ +
    1398 });
    │ │ │ │ +
    1399 });
    │ │ │ │ +
    1400 }
    │ │ │ │ +
    1401 }
    │ │ │ │ +
    1402
    │ │ │ │ +
    1403 template<class V, class Checker>
    │ │ │ │ +
    1404 void checkBinaryOps(Checker checker)
    │ │ │ │ +
    1405 {
    │ │ │ │ +
    1406 using Std::bool_constant;
    │ │ │ │ +
    1407
    │ │ │ │ +
    1408 constexpr bool isMask = std::is_same<Scalar<V>, bool>::value;
    │ │ │ │ +
    1409
    │ │ │ │ +
    1410 constexpr bool do_ = false;
    │ │ │ │ +
    1411 constexpr bool do_SV = true;
    │ │ │ │ +
    1412 constexpr bool do_VV = true;
    │ │ │ │ +
    1413 constexpr bool do_VS = true;
    │ │ │ │ +
    1414
    │ │ │ │ +
    1415#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME) \
    │ │ │ │ +
    1416 checker(bool_constant<isMask ? do_##M1 : do_##V1>{}, \
    │ │ │ │ +
    1417 bool_constant<isMask ? do_##M2 : do_##V2>{}, \
    │ │ │ │ +
    1418 bool_constant<isMask ? do_##M3 : do_##V3>{}, \
    │ │ │ │ +
    1419 Op##NAME{})
    │ │ │ │ +
    1420
    │ │ │ │ +
    1421 // (Mask , Vector , Name );
    │ │ │ │ +
    1422
    │ │ │ │ +
    1423 DUNE_SIMD_DO( , , , SV, VV, VS, InfixMul );
    │ │ │ │ +
    1424 DUNE_SIMD_DO( , , , SV, VV, VS, InfixDiv );
    │ │ │ │ +
    1425 DUNE_SIMD_DO( , , , SV, VV, VS, InfixRemainder );
    │ │ │ │ +
    1426
    │ │ │ │ +
    1427 DUNE_SIMD_DO( , , , SV, VV, VS, InfixPlus );
    │ │ │ │ +
    1428 DUNE_SIMD_DO( , , , SV, VV, VS, InfixMinus );
    │ │ │ │ +
    1429
    │ │ │ │ +
    1430 DUNE_SIMD_DO( , , , , VV, VS, InfixLeftShift );
    │ │ │ │ +
    1431 DUNE_SIMD_DO( , , , , VV, VS, InfixRightShift );
    │ │ │ │ +
    1432
    │ │ │ │ +
    1433 DUNE_SIMD_DO( , , , SV, VV, VS, InfixLess );
    │ │ │ │ +
    1434 DUNE_SIMD_DO( , , , SV, VV, VS, InfixGreater );
    │ │ │ │ +
    1435 DUNE_SIMD_DO( , , , SV, VV, VS, InfixLessEqual );
    │ │ │ │ +
    1436 DUNE_SIMD_DO( , , , SV, VV, VS, InfixGreaterEqual );
    │ │ │ │ +
    1437
    │ │ │ │ +
    1438 DUNE_SIMD_DO( , , , SV, VV, VS, InfixEqual );
    │ │ │ │ +
    1439 DUNE_SIMD_DO( , , , SV, VV, VS, InfixNotEqual );
    │ │ │ │ +
    1440
    │ │ │ │ +
    1441 DUNE_SIMD_DO( , VV, , SV, VV, VS, InfixBitAnd );
    │ │ │ │ +
    1442 DUNE_SIMD_DO( , VV, , SV, VV, VS, InfixBitXor );
    │ │ │ │ +
    1443 DUNE_SIMD_DO( , VV, , SV, VV, VS, InfixBitOr );
    │ │ │ │ +
    1444
    │ │ │ │ +
    1445 DUNE_SIMD_DO(SV, VV, VS, SV, VV, VS, InfixLogicAnd );
    │ │ │ │ +
    1446 DUNE_SIMD_DO(SV, VV, VS, SV, VV, VS, InfixLogicOr );
    │ │ │ │ +
    1447
    │ │ │ │ +
    1448 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssign );
    │ │ │ │ +
    1449 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignMul );
    │ │ │ │ +
    1450 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignDiv );
    │ │ │ │ +
    1451 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignRemainder );
    │ │ │ │ +
    1452 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignPlus );
    │ │ │ │ +
    1453 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignMinus );
    │ │ │ │ +
    1454 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignLeftShift );
    │ │ │ │ +
    1455 DUNE_SIMD_DO( , , , , VV, VS, InfixAssignRightShift);
    │ │ │ │ +
    1456 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssignAnd );
    │ │ │ │ +
    1457 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssignXor );
    │ │ │ │ +
    1458 DUNE_SIMD_DO( , VV, , , VV, VS, InfixAssignOr );
    │ │ │ │ +
    1459
    │ │ │ │ +
    1460 DUNE_SIMD_DO(SV, VV, VS, SV, , VS, InfixComma );
    │ │ │ │ +
    1461
    │ │ │ │ +
    1462#undef DUNE_SIMD_DO
    │ │ │ │ +
    1463 }
    │ │ │ │ +
    1464
    │ │ │ │ +
    1466 //
    │ │ │ │ +
    1467 // SIMD interface functions
    │ │ │ │ +
    1468 //
    │ │ │ │ +
    1469
    │ │ │ │ +
    1470 template<class V>
    │ │ │ │ +
    1471 void checkAutoCopy()
    │ │ │ │ +
    1472 {
    │ │ │ │ +
    1473 using RValueResult = decltype(autoCopy(lane(0, std::declval<V>())));
    │ │ │ │ +
    1474 static_assert(std::is_same<RValueResult, Scalar<V> >::value,
    │ │ │ │ +
    1475 "Result of autoCopy() must always be Scalar<V>");
    │ │ │ │ +
    1476
    │ │ │ │ +
    1477 using MutableLValueResult =
    │ │ │ │ +
    1478 decltype(autoCopy(lane(0, std::declval<V&>())));
    │ │ │ │ +
    1479 static_assert(std::is_same<MutableLValueResult, Scalar<V> >::value,
    │ │ │ │ +
    1480 "Result of autoCopy() must always be Scalar<V>");
    │ │ │ │ +
    1481
    │ │ │ │ +
    1482 using ConstLValueResult =
    │ │ │ │ +
    1483 decltype(autoCopy(lane(0, std::declval<const V&>())));
    │ │ │ │ +
    1484 static_assert(std::is_same<ConstLValueResult, Scalar<V> >::value,
    │ │ │ │ +
    1485 "Result of autoCopy() must always be Scalar<V>");
    │ │ │ │ +
    1486
    │ │ │ │ +
    1487 V vec = make123<V>();
    │ │ │ │ +
    1488 for(std::size_t l = 0; l < lanes(vec); ++l)
    │ │ │ │ +
    1489 DUNE_SIMD_CHECK(autoCopy(lane(l, vec)) == Scalar<V>(l+1));
    │ │ │ │ +
    1490 }
    │ │ │ │ +
    1491
    │ │ │ │ +
    1492 // may only be called for mask types
    │ │ │ │ +
    1493 template<class M>
    │ │ │ │ +
    1494 void checkBoolReductions()
    │ │ │ │ +
    1495 {
    │ │ │ │ +
    1496 M trueVec(true);
    │ │ │ │ +
    1497
    │ │ │ │ +
    1498 // mutable lvalue
    │ │ │ │ +
    1499 DUNE_SIMD_CHECK(allTrue (static_cast<M&>(trueVec)) == true);
    │ │ │ │ +
    1500 DUNE_SIMD_CHECK(anyTrue (static_cast<M&>(trueVec)) == true);
    │ │ │ │ +
    1501 DUNE_SIMD_CHECK(allFalse(static_cast<M&>(trueVec)) == false);
    │ │ │ │ +
    1502 DUNE_SIMD_CHECK(anyFalse(static_cast<M&>(trueVec)) == false);
    │ │ │ │ +
    1503
    │ │ │ │ +
    1504 // const lvalue
    │ │ │ │ +
    1505 DUNE_SIMD_CHECK(allTrue (static_cast<const M&>(trueVec)) == true);
    │ │ │ │ +
    1506 DUNE_SIMD_CHECK(anyTrue (static_cast<const M&>(trueVec)) == true);
    │ │ │ │ +
    1507 DUNE_SIMD_CHECK(allFalse(static_cast<const M&>(trueVec)) == false);
    │ │ │ │ +
    1508 DUNE_SIMD_CHECK(anyFalse(static_cast<const M&>(trueVec)) == false);
    │ │ │ │ +
    1509
    │ │ │ │ +
    1510 // rvalue
    │ │ │ │ +
    1511 DUNE_SIMD_CHECK(allTrue (M(true)) == true);
    │ │ │ │ +
    1512 DUNE_SIMD_CHECK(anyTrue (M(true)) == true);
    │ │ │ │ +
    1513 DUNE_SIMD_CHECK(allFalse(M(true)) == false);
    │ │ │ │ +
    1514 DUNE_SIMD_CHECK(anyFalse(M(true)) == false);
    │ │ │ │ +
    1515
    │ │ │ │ +
    1516 M falseVec(false);
    │ │ │ │ +
    1517
    │ │ │ │ +
    1518 // mutable lvalue
    │ │ │ │ +
    1519 DUNE_SIMD_CHECK(allTrue (static_cast<M&>(falseVec)) == false);
    │ │ │ │ +
    1520 DUNE_SIMD_CHECK(anyTrue (static_cast<M&>(falseVec)) == false);
    │ │ │ │ +
    1521 DUNE_SIMD_CHECK(allFalse(static_cast<M&>(falseVec)) == true);
    │ │ │ │ +
    1522 DUNE_SIMD_CHECK(anyFalse(static_cast<M&>(falseVec)) == true);
    │ │ │ │ +
    1523
    │ │ │ │ +
    1524 // const lvalue
    │ │ │ │ +
    1525 DUNE_SIMD_CHECK(allTrue (static_cast<const M&>(falseVec)) == false);
    │ │ │ │ +
    1526 DUNE_SIMD_CHECK(anyTrue (static_cast<const M&>(falseVec)) == false);
    │ │ │ │ +
    1527 DUNE_SIMD_CHECK(allFalse(static_cast<const M&>(falseVec)) == true);
    │ │ │ │ +
    1528 DUNE_SIMD_CHECK(anyFalse(static_cast<const M&>(falseVec)) == true);
    │ │ │ │ +
    1529
    │ │ │ │ +
    1530 // rvalue
    │ │ │ │ +
    1531 DUNE_SIMD_CHECK(allTrue (M(false)) == false);
    │ │ │ │ +
    1532 DUNE_SIMD_CHECK(anyTrue (M(false)) == false);
    │ │ │ │ +
    1533 DUNE_SIMD_CHECK(allFalse(M(false)) == true);
    │ │ │ │ +
    1534 DUNE_SIMD_CHECK(anyFalse(M(false)) == true);
    │ │ │ │ +
    1535
    │ │ │ │ +
    1536 auto mixedVec = broadcast<M>(0);
    │ │ │ │ +
    1537 for(std::size_t l = 0; l < lanes(mixedVec); ++l)
    │ │ │ │ +
    1538 lane(l, mixedVec) = (l % 2);
    │ │ │ │ +
    1539
    │ │ │ │ +
    1540 // mutable lvalue
    │ │ │ │ + │ │ │ │ +
    1542 (allTrue (static_cast<M&>(mixedVec)) == false);
    │ │ │ │ + │ │ │ │ +
    1544 (anyTrue (static_cast<M&>(mixedVec)) == (lanes<M>() > 1));
    │ │ │ │ + │ │ │ │ +
    1546 (allFalse(static_cast<M&>(mixedVec)) == (lanes<M>() == 1));
    │ │ │ │ + │ │ │ │ +
    1548 (anyFalse(static_cast<M&>(mixedVec)) == true);
    │ │ │ │ +
    1549
    │ │ │ │ +
    1550 // const lvalue
    │ │ │ │ + │ │ │ │ +
    1552 (allTrue (static_cast<const M&>(mixedVec)) == false);
    │ │ │ │ + │ │ │ │ +
    1554 (anyTrue (static_cast<const M&>(mixedVec)) == (lanes<M>() > 1));
    │ │ │ │ + │ │ │ │ +
    1556 (allFalse(static_cast<const M&>(mixedVec)) == (lanes<M>() == 1));
    │ │ │ │ + │ │ │ │ +
    1558 (anyFalse(static_cast<const M&>(mixedVec)) == true);
    │ │ │ │ +
    1559
    │ │ │ │ +
    1560 // rvalue
    │ │ │ │ +
    1561 DUNE_SIMD_CHECK(allTrue (M(mixedVec)) == false);
    │ │ │ │ +
    1562 DUNE_SIMD_CHECK(anyTrue (M(mixedVec)) == (lanes<M>() > 1));
    │ │ │ │ +
    1563 DUNE_SIMD_CHECK(allFalse(M(mixedVec)) == (lanes<M>() == 1));
    │ │ │ │ +
    1564 DUNE_SIMD_CHECK(anyFalse(M(mixedVec)) == true);
    │ │ │ │ +
    1565 }
    │ │ │ │ +
    1566
    │ │ │ │ +
    1567 template<class V>
    │ │ │ │ +
    1568 void checkCond()
    │ │ │ │ +
    1569 {
    │ │ │ │ +
    1570 using M = Mask<V>;
    │ │ │ │ +
    1571
    │ │ │ │ +
    1572 static_assert
    │ │ │ │ +
    1573 (std::is_same<decltype(cond(std::declval<M>(), std::declval<V>(),
    │ │ │ │ +
    1574 std::declval<V>())), V>::value,
    │ │ │ │ +
    1575 "The result of cond(M, V, V) should have exactly the type V");
    │ │ │ │ +
    1576
    │ │ │ │ +
    1577 static_assert
    │ │ │ │ +
    1578 (std::is_same<decltype(cond(std::declval<const M&>(),
    │ │ │ │ +
    1579 std::declval<const V&>(),
    │ │ │ │ +
    1580 std::declval<const V&>())), V>::value,
    │ │ │ │ +
    1581 "The result of cond(const M&, const V&, const V&) should have "
    │ │ │ │ +
    1582 "exactly the type V");
    │ │ │ │ +
    1583
    │ │ │ │ +
    1584 static_assert
    │ │ │ │ +
    1585 (std::is_same<decltype(cond(std::declval<M&>(), std::declval<V&>(),
    │ │ │ │ +
    1586 std::declval<V&>())), V>::value,
    │ │ │ │ +
    1587 "The result of cond(M&, V&, V&) should have exactly the type V");
    │ │ │ │ +
    1588
    │ │ │ │ +
    1589 V vec1 = leftVector<V>();
    │ │ │ │ +
    1590 V vec2 = rightVector<V>();
    │ │ │ │ +
    1591
    │ │ │ │ +
    1592 DUNE_SIMD_CHECK(allTrue(cond(M(true), vec1, vec2) == vec1));
    │ │ │ │ +
    1593 DUNE_SIMD_CHECK(allTrue(cond(M(false), vec1, vec2) == vec2));
    │ │ │ │ +
    1594
    │ │ │ │ +
    1595 auto mixedResult = broadcast<V>(0);
    │ │ │ │ +
    1596 auto mixedMask = broadcast<M>(false);
    │ │ │ │ +
    1597 for(std::size_t l = 0; l < lanes(mixedMask); ++l)
    │ │ │ │ +
    1598 {
    │ │ │ │ +
    1599 lane(l, mixedMask ) = (l % 2);
    │ │ │ │ +
    1600 lane(l, mixedResult) = lane(l, (l % 2) ? vec1 : vec2);
    │ │ │ │ +
    1601 }
    │ │ │ │ +
    1602
    │ │ │ │ +
    1603 DUNE_SIMD_CHECK(allTrue(cond(mixedMask, vec1, vec2) == mixedResult));
    │ │ │ │ +
    1604 }
    │ │ │ │ +
    1605
    │ │ │ │ +
    1606 template<class V>
    │ │ │ │ +
    1607 void checkBoolCond()
    │ │ │ │ +
    1608 {
    │ │ │ │ +
    1609 static_assert
    │ │ │ │ +
    1610 (std::is_same<decltype(cond(std::declval<bool>(), std::declval<V>(),
    │ │ │ │ +
    1611 std::declval<V>())), V>::value,
    │ │ │ │ +
    1612 "The result of cond(bool, V, V) should have exactly the type V");
    │ │ │ │ +
    1613
    │ │ │ │ +
    1614 static_assert
    │ │ │ │ +
    1615 (std::is_same<decltype(cond(std::declval<const bool&>(),
    │ │ │ │ +
    1616 std::declval<const V&>(),
    │ │ │ │ +
    1617 std::declval<const V&>())), V>::value,
    │ │ │ │ +
    1618 "The result of cond(const bool&, const V&, const V&) should have "
    │ │ │ │ +
    1619 "exactly the type V");
    │ │ │ │ +
    1620
    │ │ │ │ +
    1621 static_assert
    │ │ │ │ +
    1622 (std::is_same<decltype(cond(std::declval<bool&>(),
    │ │ │ │ +
    1623 std::declval<V&>(),
    │ │ │ │ +
    1624 std::declval<V&>())), V>::value,
    │ │ │ │ +
    1625 "The result of cond(bool&, V&, V&) should have exactly the type V");
    │ │ │ │ +
    1626
    │ │ │ │ +
    1627 V vec1 = leftVector<V>();
    │ │ │ │ +
    1628 V vec2 = rightVector<V>();
    │ │ │ │ +
    1629
    │ │ │ │ +
    1630 DUNE_SIMD_CHECK(allTrue(cond(true, vec1, vec2) == vec1));
    │ │ │ │ +
    1631 DUNE_SIMD_CHECK(allTrue(cond(false, vec1, vec2) == vec2));
    │ │ │ │ +
    1632 }
    │ │ │ │ +
    1633
    │ │ │ │ +
    1634 template<class V>
    │ │ │ │ +
    1635 std::enable_if_t<!Impl::LessThenComparable<Scalar<V> >::value>
    │ │ │ │ +
    1636 checkHorizontalMinMax() {}
    │ │ │ │ +
    1637
    │ │ │ │ +
    1638 template<class V>
    │ │ │ │ +
    1639 std::enable_if_t<Impl::LessThenComparable<Scalar<V> >::value>
    │ │ │ │ +
    1640 checkHorizontalMinMax()
    │ │ │ │ +
    1641 {
    │ │ │ │ +
    1642 static_assert
    │ │ │ │ +
    1643 (std::is_same<decltype(max(std::declval<V>())), Scalar<V> >::value,
    │ │ │ │ +
    1644 "The result of max(V) should be exactly Scalar<V>");
    │ │ │ │ +
    1645
    │ │ │ │ +
    1646 static_assert
    │ │ │ │ +
    1647 (std::is_same<decltype(min(std::declval<V>())), Scalar<V> >::value,
    │ │ │ │ +
    1648 "The result of min(V) should be exactly Scalar<V>");
    │ │ │ │ +
    1649
    │ │ │ │ +
    1650 static_assert
    │ │ │ │ +
    1651 (std::is_same<decltype(max(std::declval<V&>())), Scalar<V> >::value,
    │ │ │ │ +
    1652 "The result of max(V) should be exactly Scalar<V>");
    │ │ │ │ +
    1653
    │ │ │ │ +
    1654 static_assert
    │ │ │ │ +
    1655 (std::is_same<decltype(min(std::declval<V&>())), Scalar<V> >::value,
    │ │ │ │ +
    1656 "The result of min(V) should be exactly Scalar<V>");
    │ │ │ │ +
    1657
    │ │ │ │ +
    1658 const V vec1 = leftVector<V>();
    │ │ │ │ +
    1659
    │ │ │ │ +
    1660 DUNE_SIMD_CHECK(max(vec1) == Scalar<V>(lanes(vec1)));
    │ │ │ │ +
    1661 DUNE_SIMD_CHECK(min(vec1) == Scalar<V>(1));
    │ │ │ │ +
    1662 }
    │ │ │ │ +
    1663
    │ │ │ │ +
    1664 template<class V>
    │ │ │ │ +
    1665 std::enable_if_t<!Impl::LessThenComparable<Scalar<V> >::value>
    │ │ │ │ +
    1666 checkBinaryMinMax() {}
    │ │ │ │ +
    1667
    │ │ │ │ +
    1668 template<class V>
    │ │ │ │ +
    1669 std::enable_if_t<Impl::LessThenComparable<Scalar<V> >::value>
    │ │ │ │ +
    1670 checkBinaryMinMax()
    │ │ │ │ +
    1671 {
    │ │ │ │ +
    1672 using std::max;
    │ │ │ │ +
    1673 using std::min;
    │ │ │ │ +
    1674
    │ │ │ │ +
    1675 static_assert
    │ │ │ │ +
    1676 (std::is_same<decltype(Simd::max(std::declval<V>(),
    │ │ │ │ +
    1677 std::declval<V>())), V>::value,
    │ │ │ │ +
    1678 "The result of Simd::max(V, V) should be exactly V");
    │ │ │ │ +
    1679 static_assert
    │ │ │ │ +
    1680 (std::is_same<decltype(Simd::min(std::declval<V>(),
    │ │ │ │ +
    1681 std::declval<V>())), V>::value,
    │ │ │ │ +
    1682 "The result of Simd::min(V, V) should be exactly V");
    │ │ │ │ +
    1683
    │ │ │ │ +
    1684 static_assert
    │ │ │ │ +
    1685 (std::is_same<decltype(Simd::max(std::declval<V&>(),
    │ │ │ │ +
    1686 std::declval<V&>())), V>::value,
    │ │ │ │ +
    1687 "The result of Simd::max(V&, V&) should be exactly V");
    │ │ │ │ +
    1688 static_assert
    │ │ │ │ +
    1689 (std::is_same<decltype(Simd::min(std::declval<V&>(),
    │ │ │ │ +
    1690 std::declval<V&>())), V>::value,
    │ │ │ │ +
    1691 "The result of Simd::min(V&, V&) should be exactly V");
    │ │ │ │ +
    1692
    │ │ │ │ +
    1693 const V arg1 = leftVector<V>();
    │ │ │ │ +
    1694 const V arg2 = rightVector<V>();
    │ │ │ │ +
    1695
    │ │ │ │ +
    1696 V maxExp(Scalar<V>(0)), minExp(Scalar<V>(0));
    │ │ │ │ +
    1697 for(auto l : range(lanes<V>()))
    │ │ │ │ +
    1698 {
    │ │ │ │ +
    1699 lane(l, maxExp) = max(lane(l, arg1), lane(l, arg2));
    │ │ │ │ +
    1700 lane(l, minExp) = min(lane(l, arg1), lane(l, arg2));
    │ │ │ │ +
    1701 }
    │ │ │ │ +
    1702
    │ │ │ │ +
    1703 DUNE_SIMD_CHECK(allTrue(maxExp == Simd::max(arg1, arg2)));
    │ │ │ │ +
    1704 DUNE_SIMD_CHECK(allTrue(minExp == Simd::min(arg1, arg2)));
    │ │ │ │ +
    1705 }
    │ │ │ │ +
    1706
    │ │ │ │ +
    1707 template<class V>
    │ │ │ │ +
    1708 void checkIO()
    │ │ │ │ +
    1709 {
    │ │ │ │ +
    1710 const V vec1 = leftVector<V>();
    │ │ │ │ +
    1711
    │ │ │ │ +
    1712 std::string reference;
    │ │ │ │ +
    1713 {
    │ │ │ │ +
    1714 const char *sep = "";
    │ │ │ │ +
    1715 for(auto l : range(lanes(vec1)))
    │ │ │ │ +
    1716 {
    │ │ │ │ +
    1717 std::ostringstream stream;
    │ │ │ │ +
    1718 stream << lane(l, vec1);
    │ │ │ │ +
    1719
    │ │ │ │ +
    1720 reference += sep;
    │ │ │ │ +
    1721 reference += stream.str();
    │ │ │ │ +
    1722 sep = ", ";
    │ │ │ │ +
    1723 }
    │ │ │ │ +
    1724 }
    │ │ │ │ +
    1725
    │ │ │ │ +
    1726 {
    │ │ │ │ +
    1727 std::ostringstream stream;
    │ │ │ │ +
    1728 stream << io(vec1);
    │ │ │ │ +
    1729 if(lanes(vec1) == 1)
    │ │ │ │ +
    1730 DUNE_SIMD_CHECK(stream.str() == reference);
    │ │ │ │ +
    1731 else
    │ │ │ │ +
    1732 DUNE_SIMD_CHECK(stream.str() == "<" + reference + ">");
    │ │ │ │ +
    1733 }
    │ │ │ │ +
    1734
    │ │ │ │ +
    1735 {
    │ │ │ │ +
    1736 std::ostringstream stream;
    │ │ │ │ +
    1737 stream << vio(vec1);
    │ │ │ │ +
    1738 DUNE_SIMD_CHECK(stream.str() == "<" + reference + ">");
    │ │ │ │ +
    1739 }
    │ │ │ │ +
    1740 }
    │ │ │ │ +
    1741
    │ │ │ │ +
    1742#undef DUNE_SIMD_CHECK
    │ │ │ │ +
    1743
    │ │ │ │ +
    1744 public:
    │ │ │ │ +
    1807 template<class V> void checkType();
    │ │ │ │ +
    1808 template<class V> void checkNonOps();
    │ │ │ │ +
    1809 template<class V> void checkUnaryOps();
    │ │ │ │ +
    1810 template<class V> void checkBinaryOps();
    │ │ │ │ +
    1811 template<class V> void checkBinaryOpsVectorVector();
    │ │ │ │ +
    1812 template<class V> void checkBinaryOpsScalarVector();
    │ │ │ │ +
    1813 template<class V> void checkBinaryOpsVectorScalar();
    │ │ │ │ +
    1814 template<class V> void checkBinaryOpsProxyVector();
    │ │ │ │ +
    1815 template<class V> void checkBinaryOpsVectorProxy();
    │ │ │ │ +
    1819
    │ │ │ │ +
    1836 template<class V, class Rebinds,
    │ │ │ │ +
    1837 template<class> class RebindPrune = IsLoop,
    │ │ │ │ +
    1838 template<class> class RebindAccept = Dune::AlwaysTrue>
    │ │ │ │ +
    │ │ │ │ +
    1839 void check() {
    │ │ │ │ +
    1840 // check whether the test for this type already started
    │ │ │ │ +
    1841 if(seen_.emplace(typeid (V)).second == false)
    │ │ │ │ +
    1842 {
    │ │ │ │ +
    1843 // type already seen, nothing to do
    │ │ │ │ +
    1844 return;
    │ │ │ │ +
    1845 }
    │ │ │ │ +
    1846
    │ │ │ │ +
    1847 // do these first so everything that appears after "Checking SIMD type
    │ │ │ │ +
    1848 // ..." really pertains to that type
    │ │ │ │ +
    1849 auto recurse = [this](auto w) {
    │ │ │ │ +
    1850 using W = typename decltype(w)::type;
    │ │ │ │ +
    1851 this->template check<W, Rebinds, RebindPrune, RebindAccept>();
    │ │ │ │ +
    1852 };
    │ │ │ │ +
    1853 checkRebindOf<V, Rebinds, RebindPrune, RebindAccept>(recurse);
    │ │ │ │ +
    1854
    │ │ │ │ +
    1855 checkType<V>();
    │ │ │ │ +
    1856 }
    │ │ │ │ +
    │ │ │ │ +
    1857
    │ │ │ │ +
    │ │ │ │ +
    1859 bool good() const
    │ │ │ │ +
    1860 {
    │ │ │ │ +
    1861 return good_;
    │ │ │ │ +
    1862 }
    │ │ │ │ +
    │ │ │ │ +
    1863
    │ │ │ │ +
    1864 }; // class UnitTest
    │ │ │ │ +
    │ │ │ │ +
    1865
    │ │ │ │ +
    │ │ │ │ +
    1866 template<class V> void UnitTest::checkType()
    │ │ │ │ +
    1867 {
    │ │ │ │ +
    1868 static_assert(std::is_same<V, std::decay_t<V> >::value, "Simd types "
    │ │ │ │ +
    1869 "must not be references, and must not include "
    │ │ │ │ +
    1870 "cv-qualifiers");
    │ │ │ │ +
    1871
    │ │ │ │ +
    1872 log_ << "Checking SIMD type " << className<V>() << std::endl;
    │ │ │ │ +
    1873
    │ │ │ │ +
    1874 checkNonOps<V>();
    │ │ │ │ +
    1875 checkUnaryOps<V>();
    │ │ │ │ +
    1876 checkBinaryOps<V>();
    │ │ │ │ +
    1877 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    1878 template<class V> void UnitTest::checkNonOps()
    │ │ │ │ +
    1879 {
    │ │ │ │ +
    1880 constexpr auto isMask = typename std::is_same<Scalar<V>, bool>::type{};
    │ │ │ │ +
    1881
    │ │ │ │ +
    1882 checkLanes<V>();
    │ │ │ │ +
    1883 checkScalar<V>();
    │ │ │ │ +
    1884
    │ │ │ │ +
    1885 checkDefaultConstruct<V>();
    │ │ │ │ +
    1886 checkLane<V>();
    │ │ │ │ +
    1887 checkCopyMoveConstruct<V>();
    │ │ │ │ +
    1888 checkImplCast<V>();
    │ │ │ │ +
    1889 checkBroadcast<V>();
    │ │ │ │ +
    1890 if constexpr (isMask)
    │ │ │ │ +
    1891 this->template checkBroadcastMaskConstruct<V>();
    │ │ │ │ +
    1892 else
    │ │ │ │ +
    1893 this->template checkBroadcastVectorConstruct<V>();
    │ │ │ │ +
    1894 checkBracedAssign<V>();
    │ │ │ │ +
    1895 checkBracedBroadcastAssign<V>();
    │ │ │ │ +
    1896
    │ │ │ │ +
    1897 checkAutoCopy<V>();
    │ │ │ │ +
    1898 checkCond<V>();
    │ │ │ │ +
    1899 checkBoolCond<V>();
    │ │ │ │ +
    1900
    │ │ │ │ +
    1901 if constexpr (isMask)
    │ │ │ │ +
    1902 this->template checkBoolReductions<V>();
    │ │ │ │ +
    1903 // checkBoolReductions() is not applicable for non-masks
    │ │ │ │ +
    1904
    │ │ │ │ +
    1905 checkHorizontalMinMax<V>();
    │ │ │ │ +
    1906 checkBinaryMinMax<V>();
    │ │ │ │ +
    1907 checkIO<V>();
    │ │ │ │ +
    1908 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    1909 template<class V> void UnitTest::checkUnaryOps()
    │ │ │ │ +
    1910 {
    │ │ │ │ +
    1911 if constexpr (std::is_same_v<Scalar<V>, bool>) {
    │ │ │ │ +
    1912 // check mask
    │ │ │ │ +
    1913 auto check = [this](auto op) {
    │ │ │ │ +
    1914 this->template checkUnaryOpsV<V>(op);
    │ │ │ │ +
    1915 };
    │ │ │ │ +
    1916
    │ │ │ │ +
    1917 // postfix
    │ │ │ │ +
    1918 // check(OpPostfixDecrement{});
    │ │ │ │ +
    1919 // clang deprecation warning if bool++ is tested
    │ │ │ │ +
    1920 // check(OpPostfixIncrement{});
    │ │ │ │ +
    1921
    │ │ │ │ +
    1922 // prefix
    │ │ │ │ +
    1923 // check(OpPrefixDecrement{});
    │ │ │ │ +
    1924 // clang deprecation warning if ++bool is tested
    │ │ │ │ +
    1925 // check(OpPrefixIncrement{});
    │ │ │ │ +
    1926
    │ │ │ │ +
    1927 // check(OpPrefixPlus{});
    │ │ │ │ +
    1928 // check(OpPrefixMinus{});
    │ │ │ │ +
    1929 check(OpPrefixLogicNot{});
    │ │ │ │ +
    1930 // check(OpPrefixBitNot{});
    │ │ │ │ +
    1931 }
    │ │ │ │ +
    1932 else {
    │ │ │ │ +
    1933 // check vector
    │ │ │ │ +
    1934 auto check = [this](auto op) {
    │ │ │ │ +
    1935 this->template checkUnaryOpsV<V>(op);
    │ │ │ │ +
    1936 };
    │ │ │ │ +
    1937
    │ │ │ │ +
    1938 // postfix
    │ │ │ │ +
    1939 // check(OpPostfixDecrement{});
    │ │ │ │ +
    1940 // check(OpPostfixIncrement{});
    │ │ │ │ +
    1941
    │ │ │ │ +
    1942 // prefix
    │ │ │ │ +
    1943 // check(OpPrefixDecrement{});
    │ │ │ │ +
    1944 // check(OpPrefixIncrement{});
    │ │ │ │ +
    1945
    │ │ │ │ +
    1946 // check(OpPrefixPlus{});
    │ │ │ │ +
    1947 check(OpPrefixMinus{});
    │ │ │ │ +
    1948 check(OpPrefixLogicNot{});
    │ │ │ │ +
    1949 check(OpPrefixBitNot{});
    │ │ │ │ +
    1950 }
    │ │ │ │ +
    1951 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    1952 template<class V> void UnitTest::checkBinaryOps()
    │ │ │ │ +
    1953 {
    │ │ │ │ +
    1954 checkBinaryOpsVectorVector<V>();
    │ │ │ │ +
    1955 checkBinaryOpsScalarVector<V>();
    │ │ │ │ +
    1956 checkBinaryOpsVectorScalar<V>();
    │ │ │ │ +
    1957 checkBinaryOpsProxyVector<V>();
    │ │ │ │ +
    1958 checkBinaryOpsVectorProxy<V>();
    │ │ │ │ +
    1959 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    1961 {
    │ │ │ │ +
    1962 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
    │ │ │ │ +
    1963 auto check = [this,op](auto t1, auto t2) {
    │ │ │ │ +
    1964 this->checkBinaryOpVV(t1, t2, op);
    │ │ │ │ +
    1965 };
    │ │ │ │ +
    1966 this->checkBinaryRefQual<V, V, doVV>(check);
    │ │ │ │ +
    1967 };
    │ │ │ │ +
    1968 checkBinaryOps<V>(checker);
    │ │ │ │ +
    1969 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    1971 {
    │ │ │ │ +
    1972 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
    │ │ │ │ +
    1973 auto check = [this,op](auto t1, auto t2) {
    │ │ │ │ +
    1974 this->checkBinaryOpSV(t1, t2, op);
    │ │ │ │ +
    1975 };
    │ │ │ │ +
    1976 this->checkBinaryRefQual<Scalar<V>, V, doSV>(check);
    │ │ │ │ +
    1977
    │ │ │ │ +
    1978 auto crossCheck = [this,op](auto t1, auto t2) {
    │ │ │ │ +
    1979 this->checkBinaryOpVVAgainstSV(t1, t2, op);
    │ │ │ │ +
    1980 };
    │ │ │ │ +
    1981 this->checkBinaryRefQual<Scalar<V>, V, doSV && doVV>(crossCheck);
    │ │ │ │ +
    1982 };
    │ │ │ │ +
    1983 checkBinaryOps<V>(checker);
    │ │ │ │ +
    1984 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    1986 {
    │ │ │ │ +
    1987 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
    │ │ │ │ +
    1988 auto check = [this,op](auto t1, auto t2) {
    │ │ │ │ +
    1989 this->checkBinaryOpVS(t1, t2, op);
    │ │ │ │ +
    1990 };
    │ │ │ │ +
    1991 this->checkBinaryRefQual<V, Scalar<V>, doVS>(check);
    │ │ │ │ +
    1992
    │ │ │ │ +
    1993 auto crossCheck = [this,op](auto t1, auto t2) {
    │ │ │ │ +
    1994 this->checkBinaryOpVVAgainstVS(t1, t2, op);
    │ │ │ │ +
    1995 };
    │ │ │ │ +
    1996 this->checkBinaryRefQual<V, Scalar<V>, doVV && doVS>(crossCheck);
    │ │ │ │ +
    1997 };
    │ │ │ │ +
    1998 checkBinaryOps<V>(checker);
    │ │ │ │ +
    1999 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    2001 {
    │ │ │ │ +
    2002 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
    │ │ │ │ +
    2003 auto check = [this,op](auto t1, auto t2) {
    │ │ │ │ +
    2004 this->checkBinaryOpPV(t1, t2, op);
    │ │ │ │ +
    2005 };
    │ │ │ │ +
    2006 this->checkBinaryRefQual<V, V, doSV>(check);
    │ │ │ │ +
    2007 };
    │ │ │ │ +
    2008 checkBinaryOps<V>(checker);
    │ │ │ │ +
    2009 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    2011 {
    │ │ │ │ +
    2012 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) {
    │ │ │ │ +
    2013 auto check = [this,op](auto t1, auto t2) {
    │ │ │ │ +
    2014 this->checkBinaryOpVP(t1, t2, op);
    │ │ │ │ +
    2015 };
    │ │ │ │ +
    2016 this->checkBinaryRefQual<V, V, doVS>(check);
    │ │ │ │ +
    2017 };
    │ │ │ │ +
    2018 checkBinaryOps<V>(checker);
    │ │ │ │ +
    2019 }
    │ │ │ │ +
    │ │ │ │ +
    2020
    │ │ │ │ +
    2021 } // namespace Simd
    │ │ │ │ +
    2022} // namespace Dune
    │ │ │ │ +
    2023
    │ │ │ │ +
    2024#endif // DUNE_COMMON_SIMD_TEST_HH
    │ │ │ │ +
    Utilities for reduction like operations on ranges.
    │ │ │ │ +
    A free function to provide the demangled class name of a given object or type as a string.
    │ │ │ │ + │ │ │ │ +
    #define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL)
    Definition test.hh:670
    │ │ │ │ +
    #define DUNE_SIMD_INFIX_OP(NAME, SYMBOL)
    Definition test.hh:784
    │ │ │ │ +
    #define DUNE_SIMD_CHECK_OP(expr)
    Definition test.hh:191
    │ │ │ │ +
    #define DUNE_SIMD_CHECK(expr)
    Definition test.hh:186
    │ │ │ │ +
    #define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL)
    Definition test.hh:818
    │ │ │ │ +
    #define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL)
    Definition test.hh:805
    │ │ │ │ +
    #define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL)
    Definition test.hh:681
    │ │ │ │ +
    #define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME)
    │ │ │ │ +
    IO interface of the SIMD abstraction.
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
    Definition rangeutilities.hh:300
    │ │ │ │ +
    std::tuple< MetaType< T >... > TypeList
    A simple type list.
    Definition typelist.hh:87
    │ │ │ │ +
    constexpr void forEach(Range &&range, F &&f)
    Range based for loop.
    Definition hybridutilities.hh:268
    │ │ │ │ +
    constexpr AutonomousValue< T > autoCopy(T &&v)
    Autonomous copy of an expression's value for use in auto type deduction.
    Definition typetraits.hh:642
    │ │ │ │ +
    typename Impl::voider< Types... >::type void_t
    Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
    Definition typetraits.hh:40
    │ │ │ │ +
    bool anyTrue(const Mask &mask)
    Whether any entry is true
    Definition simd/interface.hh:429
    │ │ │ │ +
    auto maskOr(const V1 &v1, const V2 &v2)
    Logic or of masks.
    Definition simd/interface.hh:499
    │ │ │ │ +
    V cond(M &&mask, const V &ifTrue, const V &ifFalse)
    Like the ?: operator.
    Definition simd/interface.hh:386
    │ │ │ │ +
    auto io(const V &v)
    construct a stream inserter
    Definition io.hh:106
    │ │ │ │ +
    bool allTrue(const Mask &mask)
    Whether all entries are true
    Definition simd/interface.hh:439
    │ │ │ │ +
    auto vio(const V &v)
    construct a stream inserter
    Definition io.hh:90
    │ │ │ │ +
    auto max(const V &v1, const V &v2)
    The binary maximum value over two simd objects.
    Definition simd/interface.hh:409
    │ │ │ │ +
    bool anyFalse(const Mask &mask)
    Whether any entry is false
    Definition simd/interface.hh:449
    │ │ │ │ +
    constexpr std::size_t lanes()
    Number of lanes in a SIMD type.
    Definition simd/interface.hh:305
    │ │ │ │ +
    decltype(auto) lane(std::size_t l, V &&v)
    Extract an element of a SIMD type.
    Definition simd/interface.hh:324
    │ │ │ │ +
    bool allFalse(const Mask &mask)
    Whether all entries are false
    Definition simd/interface.hh:459
    │ │ │ │ +
    auto maskAnd(const V1 &v1, const V2 &v2)
    Logic and of masks.
    Definition simd/interface.hh:509
    │ │ │ │ +
    typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
    Element type of some SIMD type.
    Definition simd/interface.hh:235
    │ │ │ │ +
    auto min(const V &v1, const V &v2)
    The binary minimum value over two simd objects.
    Definition simd/interface.hh:419
    │ │ │ │ +
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    void put(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key, const Value &value)
    Definition propertymap.hh:92
    │ │ │ │ -
    Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
    Definition propertymap.hh:84
    │ │ │ │ -
    Definition propertymap.hh:17
    │ │ │ │ -
    PM::ValueType ValueType
    The type of the values of the property map.
    Definition propertymap.hh:25
    │ │ │ │ -
    PM::Category Category
    The category the property map belongs to.
    Definition propertymap.hh:33
    │ │ │ │ -
    PM::Reference Reference
    The type of the reference to the values.
    Definition propertymap.hh:29
    │ │ │ │ -
    PM::KeyType KeyType
    The type of the key of the property map.
    Definition propertymap.hh:21
    │ │ │ │ -
    Tag for the category of readable property maps.
    Definition propertymap.hh:38
    │ │ │ │ -
    Tag for the category of writable property maps.
    Definition propertymap.hh:42
    │ │ │ │ -
    Tag for the category of readable and writable property maps.
    Definition propertymap.hh:50
    │ │ │ │ -
    Tag for the category of lvalue property maps.
    Definition propertymap.hh:57
    │ │ │ │ -
    ValueType & Reference
    Definition propertymap.hh:63
    │ │ │ │ -
    std::ptrdiff_t KeyType
    Definition propertymap.hh:64
    │ │ │ │ -
    T ValueType
    Definition propertymap.hh:62
    │ │ │ │ -
    LvaluePropertyMapTag Category
    Definition propertymap.hh:65
    │ │ │ │ -
    std::ptrdiff_t KeyType
    Definition propertymap.hh:74
    │ │ │ │ -
    const ValueType & Reference
    Definition propertymap.hh:73
    │ │ │ │ -
    T ValueType
    Definition propertymap.hh:72
    │ │ │ │ -
    LvaluePropertyMapTag Category
    Definition propertymap.hh:75
    │ │ │ │ -
    Definition propertymap.hh:80
    │ │ │ │ -
    Adapter to turn a random access iterator into a property map.
    Definition propertymap.hh:108
    │ │ │ │ -
    IndexMap::KeyType KeyType
    The key type of the property map.
    Definition propertymap.hh:125
    │ │ │ │ -
    R Reference
    The reference type of the property map.
    Definition propertymap.hh:135
    │ │ │ │ -
    T ValueType
    The value type of the property map.
    Definition propertymap.hh:130
    │ │ │ │ -
    Reference operator[](KeyType key) const
    Access the a value by reference.
    Definition propertymap.hh:160
    │ │ │ │ -
    IteratorPropertyMap(RandomAccessIterator iter, const IndexMap &im=IndexMap())
    Constructor.
    Definition propertymap.hh:149
    │ │ │ │ -
    IteratorPropertyMap()
    Constructor.
    Definition propertymap.hh:155
    │ │ │ │ -
    IM IndexMap
    The type of the index map.
    Definition propertymap.hh:120
    │ │ │ │ -
    RAI RandomAccessIterator
    The type of the random access iterator.
    Definition propertymap.hh:113
    │ │ │ │ -
    LvaluePropertyMapTag Category
    The category of this property map.
    Definition propertymap.hh:140
    │ │ │ │ -
    An adapter to turn an unique associative container into a property map.
    Definition propertymap.hh:180
    │ │ │ │ -
    An adaptor to turn an unique associative container into a property map.
    Definition propertymap.hh:238
    │ │ │ │ -
    A property map that applies the identity function to integers.
    Definition propertymap.hh:293
    │ │ │ │ -
    std::size_t ValueType
    The value type of the map.
    Definition propertymap.hh:298
    │ │ │ │ -
    std::size_t KeyType
    The key type of the map.
    Definition propertymap.hh:295
    │ │ │ │ -
    ValueType operator[](const KeyType &key) const
    Definition propertymap.hh:306
    │ │ │ │ -
    std::size_t Reference
    The reference type of the map.
    Definition propertymap.hh:301
    │ │ │ │ -
    ReadablePropertyMapTag Category
    The category of the map.
    Definition propertymap.hh:304
    │ │ │ │ -
    Selector for the property map type.
    Definition propertymap.hh:320
    │ │ │ │ -
    T Tag
    the tag identifying the property.
    Definition propertymap.hh:324
    │ │ │ │ -
    C Container
    The container type to whose entries the properties are attached.
    Definition propertymap.hh:329
    │ │ │ │ +
    typename Impl::RemoveEnd< EndMark, TypeList< Types... > >::type RebindList
    A list of types with the final element removed.
    Definition test.hh:158
    │ │ │ │ +
    typename Impl::IsLoop< T >::type IsLoop
    check whether a type is an instance of LoopSIMD
    Definition test.hh:162
    │ │ │ │ +
    Definition loop.hh:65
    │ │ │ │ +
    final element marker for RebindList
    Definition test.hh:145
    │ │ │ │ +
    Definition test.hh:164
    │ │ │ │ +
    void checkUnaryOps()
    Definition test.hh:1909
    │ │ │ │ +
    void checkBinaryOps()
    Definition test.hh:1952
    │ │ │ │ +
    void checkBinaryOpsScalarVector()
    Definition test.hh:1970
    │ │ │ │ +
    void checkType()
    Definition test.hh:1866
    │ │ │ │ +
    void check()
    run unit tests for simd vector type V
    Definition test.hh:1839
    │ │ │ │ +
    void checkBinaryOpsVectorScalar()
    Definition test.hh:1985
    │ │ │ │ +
    bool good() const
    whether all tests succeeded
    Definition test.hh:1859
    │ │ │ │ +
    void checkBinaryOpsVectorVector()
    Definition test.hh:1960
    │ │ │ │ +
    void checkNonOps()
    Definition test.hh:1878
    │ │ │ │ +
    void checkBinaryOpsVectorProxy()
    Definition test.hh:2010
    │ │ │ │ +
    void checkBinaryOpsProxyVector()
    Definition test.hh:2000
    │ │ │ │ +
    template which always yields a true value
    Definition typetraits.hh:134
    │ │ │ │ +
    Include file for users of the SIMD abstraction layer.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,367 +1,2096 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -propertymap.hh │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +test.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_PROPERTYMAP_HH │ │ │ │ │ -6#define DUNE_PROPERTYMAP_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11 │ │ │ │ │ -12namespace _D_u_n_e │ │ │ │ │ -13{ │ │ │ │ │ -14 │ │ │ │ │ -15 template │ │ │ │ │ -_1_6 struct _P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s │ │ │ │ │ -17 { │ │ │ │ │ -_2_1 typedef typename PM::KeyType _K_e_y_T_y_p_e; │ │ │ │ │ -_2_5 typedef typename PM::ValueType _V_a_l_u_e_T_y_p_e; │ │ │ │ │ -_2_9 typedef typename PM::Reference _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -_3_3 typedef typename PM::Category _C_a_t_e_g_o_r_y; │ │ │ │ │ -34 }; │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_SIMD_TEST_HH │ │ │ │ │ +4#define DUNE_COMMON_SIMD_TEST_HH │ │ │ │ │ +5 │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22 │ │ │ │ │ +23#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ +24#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_y_b_r_i_d_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +25#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +26#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_o_._h_h> │ │ │ │ │ +27#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_l_o_o_p_._h_h> │ │ │ │ │ +28#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ +29#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +30#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ +31#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +32 │ │ │ │ │ +33namespace _D_u_n_e { │ │ │ │ │ +34 namespace Simd { │ │ │ │ │ 35 │ │ │ │ │ -_3_7 struct _R_e_a_d_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -38 {}; │ │ │ │ │ -39 │ │ │ │ │ -_4_1 struct _W_r_i_t_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -42 {}; │ │ │ │ │ -43 │ │ │ │ │ -_4_8 struct _R_e_a_d_W_r_i_t_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -49 : public _R_e_a_d_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g, public _W_r_i_t_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -50 {}; │ │ │ │ │ -51 │ │ │ │ │ -_5_5 struct _L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -56 : public _R_e_a_d_W_r_i_t_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -57 {}; │ │ │ │ │ -58 │ │ │ │ │ -59 template │ │ │ │ │ -_6_0 struct _P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s │ │ │ │ │ -61 { │ │ │ │ │ -_6_2 typedef T _V_a_l_u_e_T_y_p_e; │ │ │ │ │ -_6_3 typedef _V_a_l_u_e_T_y_p_e& _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -_6_4 typedef std::ptrdiff_t _K_e_y_T_y_p_e; │ │ │ │ │ -_6_5 typedef _L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g _C_a_t_e_g_o_r_y; │ │ │ │ │ +36 namespace Impl { │ │ │ │ │ +37 │ │ │ │ │ +38 template │ │ │ │ │ +39 struct LessThenComparable : std::false_type {}; │ │ │ │ │ +40 template │ │ │ │ │ +41 struct LessThenComparable() │ │ │ │ │ +42 < std::declval())> > : │ │ │ │ │ +43 std::true_type │ │ │ │ │ +44 {}; │ │ │ │ │ +45 │ │ │ │ │ +46 template │ │ │ │ │ +47 struct CopyConstHelper │ │ │ │ │ +48 { │ │ │ │ │ +49 using type = Dst; │ │ │ │ │ +50 }; │ │ │ │ │ +51 template │ │ │ │ │ +52 struct CopyConstHelper │ │ │ │ │ +53 { │ │ │ │ │ +54 using type = std::add_const_t; │ │ │ │ │ +55 }; │ │ │ │ │ +56 │ │ │ │ │ +57 template │ │ │ │ │ +58 struct CopyVolatileHelper │ │ │ │ │ +59 { │ │ │ │ │ +60 using type = Dst; │ │ │ │ │ +61 }; │ │ │ │ │ +62 template │ │ │ │ │ +63 struct CopyVolatileHelper │ │ │ │ │ +64 { │ │ │ │ │ +65 using type = std::add_volatile_t; │ │ │ │ │ 66 }; │ │ │ │ │ 67 │ │ │ │ │ -68 │ │ │ │ │ -69 template │ │ │ │ │ -_7_0 struct _P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s │ │ │ │ │ -71 { │ │ │ │ │ -_7_2 typedef T _V_a_l_u_e_T_y_p_e; │ │ │ │ │ -_7_3 typedef const _V_a_l_u_e_T_y_p_e& _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -_7_4 typedef std::ptrdiff_t _K_e_y_T_y_p_e; │ │ │ │ │ -_7_5 typedef _L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g _C_a_t_e_g_o_r_y; │ │ │ │ │ -76 }; │ │ │ │ │ -77 │ │ │ │ │ -78 template │ │ │ │ │ -_7_9 struct _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r │ │ │ │ │ -80 {}; │ │ │ │ │ -81 │ │ │ │ │ -82 template │ │ │ │ │ -83 inline Reference │ │ │ │ │ -_8_4 _g_e_t(const _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r_<_R_e_f_e_r_e_n_c_e_,_P_r_o_p_e_r_t_y_M_a_p_>& pmap, │ │ │ │ │ -85 const Key& key) │ │ │ │ │ -86 { │ │ │ │ │ -87 return static_cast(pmap)[key]; │ │ │ │ │ -88 } │ │ │ │ │ -89 │ │ │ │ │ -90 template │ │ │ │ │ -91 inline void │ │ │ │ │ -_9_2 _p_u_t(const _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r_<_R_e_f_e_r_e_n_c_e_,_P_r_o_p_e_r_t_y_M_a_p_>& pmap, │ │ │ │ │ -93 const Key& key, const Value& value) │ │ │ │ │ -94 { │ │ │ │ │ -95 static_assert(std::is_convertible::value, │ │ │ │ │ -96 "WritablePropertyMapTag required!"); │ │ │ │ │ -97 static_cast(pmap)[key] = value; │ │ │ │ │ -98 } │ │ │ │ │ -99 │ │ │ │ │ -103 template::value_type, │ │ │ │ │ -105 class R = typename std::iterator_traits::reference> │ │ │ │ │ -_1_0_6 class _I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -107 : public _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r > │ │ │ │ │ -108 { │ │ │ │ │ -109 public: │ │ │ │ │ -_1_1_3 typedef RAI _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r; │ │ │ │ │ -114 │ │ │ │ │ -_1_2_0 typedef IM _I_n_d_e_x_M_a_p; │ │ │ │ │ -121 │ │ │ │ │ -_1_2_5 typedef typename IndexMap::KeyType _K_e_y_T_y_p_e; │ │ │ │ │ -126 │ │ │ │ │ -_1_3_0 typedef T _V_a_l_u_e_T_y_p_e; │ │ │ │ │ -131 │ │ │ │ │ -_1_3_5 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -136 │ │ │ │ │ -_1_4_0 typedef _L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g _C_a_t_e_g_o_r_y; │ │ │ │ │ +68 template │ │ │ │ │ +69 struct CopyReferenceHelper │ │ │ │ │ +70 { │ │ │ │ │ +71 using type = Dst; │ │ │ │ │ +72 }; │ │ │ │ │ +73 template │ │ │ │ │ +74 struct CopyReferenceHelper │ │ │ │ │ +75 { │ │ │ │ │ +76 using type = std::add_lvalue_reference_t; │ │ │ │ │ +77 }; │ │ │ │ │ +78 │ │ │ │ │ +79 template │ │ │ │ │ +80 struct CopyReferenceHelper │ │ │ │ │ +81 { │ │ │ │ │ +82 using type = std::add_rvalue_reference_t; │ │ │ │ │ +83 }; │ │ │ │ │ +84 │ │ │ │ │ +85 template │ │ │ │ │ +86 using CopyRefQual = typename CopyReferenceHelper< │ │ │ │ │ +87 typename CopyVolatileHelper< │ │ │ │ │ +88 typename CopyConstHelper< │ │ │ │ │ +89 std::decay_t, │ │ │ │ │ +90 std::remove_reference_t │ │ │ │ │ +91 >::type, │ │ │ │ │ +92 std::remove_reference_t │ │ │ │ │ +93 >::type, │ │ │ │ │ +94 Src │ │ │ │ │ +95 >::type; │ │ │ │ │ +96 │ │ │ │ │ +97 template::value - 1> > │ │ │ │ │ +100 struct RemoveEnd; │ │ │ │ │ +101 template │ │ │ │ │ +102 struct RemoveEnd> │ │ │ │ │ +103 { │ │ │ │ │ +104 using Back = TypeListEntry_t::value - 1, Types>; │ │ │ │ │ +105 static_assert(std::is_same::value, │ │ │ │ │ +106 "TypeList not terminated by proper EndMark"); │ │ │ │ │ +107 using type = TypeList...>; │ │ │ │ │ +108 }; │ │ │ │ │ +109 │ │ │ │ │ +110 template │ │ │ │ │ +111 struct TypeInList; │ │ │ │ │ +112 │ │ │ │ │ +113 template │ │ │ │ │ +114 struct TypeInList > : std::false_type {}; │ │ │ │ │ +115 │ │ │ │ │ +116 template │ │ │ │ │ +117 struct TypeInList > : std::true_type {}; │ │ │ │ │ +118 │ │ │ │ │ +119 template │ │ │ │ │ +120 struct TypeInList, │ │ │ │ │ +121 _s_t_d::enable_if_t::value> > : │ │ │ │ │ +122 TypeInList >::type │ │ │ │ │ +123 {}; │ │ │ │ │ +124 │ │ │ │ │ +125 template │ │ │ │ │ +126 struct _I_s_L_o_o_p : std::false_type {}; │ │ │ │ │ +127 template │ │ │ │ │ +128 struct _I_s_L_o_o_p > : std::true_type {}; │ │ │ │ │ +129 │ │ │ │ │ +130 // used inside static_assert to trick the compiler into printing a list │ │ │ │ │ +131 // of types: │ │ │ │ │ +132 // │ │ │ │ │ +133 // static_assert(debugTypes(Std::bool_constant{}), "msg"); │ │ │ │ │ +134 // │ │ │ │ │ +135 // Should include what the type `V` expands to in the error message. │ │ │ │ │ +136 template │ │ │ │ │ +137 constexpr bool debugTypes(std::true_type) { return true; } │ │ │ │ │ +138 template │ │ │ │ │ +139 [[deprecated]] │ │ │ │ │ +140 constexpr bool debugTypes(std::false_type) { return false; } │ │ │ │ │ 141 │ │ │ │ │ -_1_4_9 inline _I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p(_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r iter, │ │ │ │ │ -150 const _I_n_d_e_x_M_a_p& im=_I_n_d_e_x_M_a_p()) │ │ │ │ │ -151 : iter_(iter), indexMap_(im) │ │ │ │ │ -152 {} │ │ │ │ │ -153 │ │ │ │ │ -_1_5_5 inline _I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ │ -156 : iter_(), indexMap_() │ │ │ │ │ -157 {} │ │ │ │ │ -158 │ │ │ │ │ -_1_6_0 inline _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](_K_e_y_T_y_p_e key) const │ │ │ │ │ -161 { │ │ │ │ │ -162 return *(iter_ + _g_e_t(indexMap_, key)); │ │ │ │ │ -163 } │ │ │ │ │ -164 │ │ │ │ │ -165 private: │ │ │ │ │ -167 _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r iter_; │ │ │ │ │ -169 _I_n_d_e_x_M_a_p indexMap_; │ │ │ │ │ -170 }; │ │ │ │ │ -171 │ │ │ │ │ -176 template │ │ │ │ │ -_1_7_7 class _A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -178 : _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r > │ │ │ │ │ -180 { │ │ │ │ │ -184 typedef T UniqueAssociativeContainer; │ │ │ │ │ -185 │ │ │ │ │ -189 typedef typename UniqueAssociativeContainer::value_type::first_type │ │ │ │ │ -190 KeyType; │ │ │ │ │ -191 │ │ │ │ │ -195 typedef typename UniqueAssociativeContainer::value_type::second_type │ │ │ │ │ -196 ValueType; │ │ │ │ │ -197 │ │ │ │ │ -201 typedef ValueType& Reference; │ │ │ │ │ -202 │ │ │ │ │ -206 typedef _L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g _C_a_t_e_g_o_r_y; │ │ │ │ │ +142 } // namespace Impl │ │ │ │ │ +143 │ │ │ │ │ +_1_4_5 struct _E_n_d_M_a_r_k {}; │ │ │ │ │ +147 │ │ │ │ │ +156 template │ │ │ │ │ +_1_5_7 using _R_e_b_i_n_d_L_i_s_t = │ │ │ │ │ +158 typename Impl::RemoveEnd<_E_n_d_M_a_r_k, _T_y_p_e_L_i_s_t >::type; │ │ │ │ │ +159 │ │ │ │ │ +161 template │ │ │ │ │ +_1_6_2 using _I_s_L_o_o_p = typename Impl::IsLoop::type; │ │ │ │ │ +163 │ │ │ │ │ +_1_6_4 class _U_n_i_t_T_e_s_t { │ │ │ │ │ +165 bool good_ = true; │ │ │ │ │ +166 std::ostream &log_ = std::cerr; │ │ │ │ │ +167 // records the types for which checks have started running to avoid │ │ │ │ │ +168 // infinite recursion │ │ │ │ │ +169 std::unordered_set seen_; │ │ │ │ │ +170 │ │ │ │ │ +172 // │ │ │ │ │ +173 // Helper functions │ │ │ │ │ +174 // │ │ │ │ │ +175 │ │ │ │ │ +176 void complain(const char *file, int line, const char *func, │ │ │ │ │ +177 const char *expr); │ │ │ │ │ +178 │ │ │ │ │ +179 void complain(const char *file, int line, const char *func, │ │ │ │ │ +180 const std::string &opname, const char *expr); │ │ │ │ │ +181 │ │ │ │ │ +182 // This macro is defined only within this file, do not use anywhere │ │ │ │ │ +183 // else. Doing the actual printing in an external function dramatically │ │ │ │ │ +184 // reduces memory use during compilation. Defined in such a way that │ │ │ │ │ +185 // the call will only happen for failed checks. │ │ │ │ │ +_1_8_6#define DUNE_SIMD_CHECK(expr) \ │ │ │ │ │ +187 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, #expr)) │ │ │ │ │ +188 │ │ │ │ │ +189 // the function using this macro must define a way to compute the │ │ │ │ │ +190 // operator name in DUNE_SIMD_OPNAME │ │ │ │ │ +_1_9_1#define DUNE_SIMD_CHECK_OP(expr) \ │ │ │ │ │ +192 ((expr) ? void() : complain(__FILE__, __LINE__, __func__, \ │ │ │ │ │ +193 DUNE_SIMD_OPNAME, #expr)) │ │ │ │ │ +194 │ │ │ │ │ +195 // "cast" into a prvalue │ │ │ │ │ +196 template │ │ │ │ │ +197 static std::decay_t prvalue(T &&t) │ │ │ │ │ +198 { │ │ │ │ │ +199 return std::forward(t); │ │ │ │ │ +200 } │ │ │ │ │ +201 │ │ │ │ │ +202 // whether the vector is 42 in all lanes │ │ │ │ │ +203 template │ │ │ │ │ +204 static bool is42(const V &v) │ │ │ │ │ +205 { │ │ │ │ │ +206 bool _g_o_o_d = true; │ │ │ │ │ 207 │ │ │ │ │ -209 inline _A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ │ -210 : map_(0) │ │ │ │ │ -211 {} │ │ │ │ │ -212 │ │ │ │ │ -214 inline _A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p(UniqueAssociativeContainer& map) │ │ │ │ │ -215 : map_(&map) │ │ │ │ │ -216 {} │ │ │ │ │ -217 │ │ │ │ │ -222 inline Reference operator[](KeyType key) const │ │ │ │ │ -223 { │ │ │ │ │ -224 return map_->find(key)->second; │ │ │ │ │ -225 } │ │ │ │ │ -226 private: │ │ │ │ │ -227 UniqueAssociativeContainer* map_; │ │ │ │ │ -228 }; │ │ │ │ │ -229 │ │ │ │ │ -234 template │ │ │ │ │ -_2_3_5 class _C_o_n_s_t_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -236 : _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r > │ │ │ │ │ -238 { │ │ │ │ │ -242 typedef T UniqueAssociativeContainer; │ │ │ │ │ -243 │ │ │ │ │ -247 typedef typename UniqueAssociativeContainer::value_type::first_type │ │ │ │ │ -248 KeyType; │ │ │ │ │ -249 │ │ │ │ │ -253 typedef typename UniqueAssociativeContainer::value_type::second_type │ │ │ │ │ -254 ValueType; │ │ │ │ │ -255 │ │ │ │ │ -259 typedef const ValueType& Reference; │ │ │ │ │ -260 │ │ │ │ │ -264 typedef _L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g _C_a_t_e_g_o_r_y; │ │ │ │ │ +208 for(std::size_t l = 0; l < _l_a_n_e_s(v); ++l) │ │ │ │ │ +209 // need to cast in case we have a mask type │ │ │ │ │ +210 _g_o_o_d &= (_l_a_n_e(l, v) == Scalar(42)); │ │ │ │ │ +211 │ │ │ │ │ +212 return _g_o_o_d; │ │ │ │ │ +213 } │ │ │ │ │ +214 │ │ │ │ │ +215 // make a vector that contains the sequence { 1, 2, ... } │ │ │ │ │ +216 template │ │ │ │ │ +217 static V make123() │ │ │ │ │ +218 { │ │ │ │ │ +219 // initialize to avoid undefined behaviour if assigning to lane() │ │ │ │ │ +220 // involves lvalue-to-rvalue conversions, e.g. due to bitmask │ │ │ │ │ +221 // operations. Avoid using broadcast() for initialization to avoid │ │ │ │ │ +222 // test interdependencies. │ │ │ │ │ +223 V vec(Scalar(0)); │ │ │ │ │ +224 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ +225 _l_a_n_e(l, vec) = l + 1; │ │ │ │ │ +226 return vec; │ │ │ │ │ +227 } │ │ │ │ │ +228 │ │ │ │ │ +229 // whether the vector contains the sequence { 1, 2, ... } │ │ │ │ │ +230 template │ │ │ │ │ +231 static bool is123(const V &v) │ │ │ │ │ +232 { │ │ │ │ │ +233 bool _g_o_o_d = true; │ │ │ │ │ +234 │ │ │ │ │ +235 for(std::size_t l = 0; l < _l_a_n_e_s(v); ++l) │ │ │ │ │ +236 // need to cast in case we have a mask type │ │ │ │ │ +237 _g_o_o_d &= (_l_a_n_e(l, v) == Scalar(l+1)); │ │ │ │ │ +238 │ │ │ │ │ +239 return _g_o_o_d; │ │ │ │ │ +240 } │ │ │ │ │ +241 │ │ │ │ │ +242 template │ │ │ │ │ +243 static V leftVector() │ │ │ │ │ +244 { │ │ │ │ │ +245 // Avoid using broadcast() for initialization to avoid test │ │ │ │ │ +246 // interdependencies. │ │ │ │ │ +247 V res(Scalar(0)); │ │ │ │ │ +248 for(std::size_t l = 0; l < _l_a_n_e_s(res); ++l) │ │ │ │ │ +249 _l_a_n_e(l, res) = Scalar(l+1); │ │ │ │ │ +250 return res; │ │ │ │ │ +251 } │ │ │ │ │ +252 │ │ │ │ │ +253 template │ │ │ │ │ +254 static V rightVector() │ │ │ │ │ +255 { │ │ │ │ │ +256 // Avoid using broadcast() for initialization to avoid test │ │ │ │ │ +257 // interdependencies. │ │ │ │ │ +258 V res(Scalar(0)); │ │ │ │ │ +259 for(std::size_t l = 0; l < _l_a_n_e_s(res); ++l) │ │ │ │ │ +260 // do not exceed number of bits in char (for shifts) │ │ │ │ │ +261 // avoid 0 (for / and %) │ │ │ │ │ +262 _l_a_n_e(l, res) = Scalar((l)%7+1); │ │ │ │ │ +263 return res; │ │ │ │ │ +264 } │ │ │ │ │ 265 │ │ │ │ │ -267 inline _C_o_n_s_t_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ │ -268 : map_(0) │ │ │ │ │ -269 {} │ │ │ │ │ -270 │ │ │ │ │ -272 inline _C_o_n_s_t_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p(const UniqueAssociativeContainer& map) │ │ │ │ │ -273 : map_(&map) │ │ │ │ │ -274 {} │ │ │ │ │ -275 │ │ │ │ │ -280 inline Reference operator[](KeyType key) const │ │ │ │ │ -281 { │ │ │ │ │ -282 return map_->find(key)->second; │ │ │ │ │ -283 } │ │ │ │ │ -284 private: │ │ │ │ │ -285 const UniqueAssociativeContainer* map_; │ │ │ │ │ -286 }; │ │ │ │ │ -287 │ │ │ │ │ -_2_9_1 struct _I_d_e_n_t_i_t_y_M_a_p │ │ │ │ │ -292 : public _R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r │ │ │ │ │ -293 { │ │ │ │ │ -_2_9_5 typedef std::size_t _K_e_y_T_y_p_e; │ │ │ │ │ -296 │ │ │ │ │ -_2_9_8 typedef std::size_t _V_a_l_u_e_T_y_p_e; │ │ │ │ │ -299 │ │ │ │ │ -_3_0_1 typedef std::size_t _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -302 │ │ │ │ │ -_3_0_4 typedef _R_e_a_d_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g _C_a_t_e_g_o_r_y; │ │ │ │ │ -305 │ │ │ │ │ -_3_0_6 inline _V_a_l_u_e_T_y_p_e _o_p_e_r_a_t_o_r_[_](const _K_e_y_T_y_p_e& key) const │ │ │ │ │ -307 { │ │ │ │ │ -308 return key; │ │ │ │ │ +266 template │ │ │ │ │ +267 static T leftScalar() │ │ │ │ │ +268 { │ │ │ │ │ +269 return T(42); │ │ │ │ │ +270 } │ │ │ │ │ +271 │ │ │ │ │ +272 template │ │ │ │ │ +273 static T rightScalar() │ │ │ │ │ +274 { │ │ │ │ │ +275 // do not exceed number of bits in char (for shifts) │ │ │ │ │ +276 // avoid 0 (for / and %) │ │ │ │ │ +277 return T(5); │ │ │ │ │ +278 } │ │ │ │ │ +279 │ │ │ │ │ +280 template │ │ │ │ │ +281 using CopyRefQual = Impl::CopyRefQual; │ │ │ │ │ +282 │ │ │ │ │ +283 // test whether the Op supports the operation on scalars. We do not use │ │ │ │ │ +284 // `lane()` to obtain the scalars, because that might return a proxy │ │ │ │ │ +285 // object, and we are interested in what exactly the scalar type can do, │ │ │ │ │ +286 // no a proxy that might have more overloads than needed. In addition, │ │ │ │ │ +287 // `lane()` may not preserve `const` and reference qualifiers. │ │ │ │ │ +288 template │ │ │ │ │ +289 using ScalarResult = │ │ │ │ │ +290 decltype(std::declval(). │ │ │ │ │ +291 scalar(std::declval, │ │ │ │ │ +292 Vectors> >()...)); │ │ │ │ │ +293 │ │ │ │ │ +295 // │ │ │ │ │ +296 // Check associated types │ │ │ │ │ +297 // │ │ │ │ │ +298 │ │ │ │ │ +299 template │ │ │ │ │ +300 void checkScalar() │ │ │ │ │ +301 { │ │ │ │ │ +302 // check that the type Scalar exists │ │ │ │ │ +303 using T = Scalar; │ │ │ │ │ +304 │ │ │ │ │ +305 static_assert(std::is_same >::value, "Scalar types " │ │ │ │ │ +306 "must not be references, and must not include " │ │ │ │ │ +307 "cv-qualifiers"); │ │ │ │ │ +308 [[maybe_unused]] T a{}; │ │ │ │ │ 309 } │ │ │ │ │ -310 }; │ │ │ │ │ -311 │ │ │ │ │ -312 │ │ │ │ │ -318 template │ │ │ │ │ -_3_1_9 struct _P_r_o_p_e_r_t_y_M_a_p_T_y_p_e_S_e_l_e_c_t_o_r │ │ │ │ │ -320 { │ │ │ │ │ -_3_2_4 typedef T _T_a_g; │ │ │ │ │ -_3_2_9 typedef C _C_o_n_t_a_i_n_e_r; │ │ │ │ │ -330 }; │ │ │ │ │ -331 │ │ │ │ │ -332} │ │ │ │ │ -333 │ │ │ │ │ -334#endif │ │ │ │ │ +310 │ │ │ │ │ +311 template │ │ │ │ │ +312 [[deprecated("Warning: please include bool in the Rebinds for " │ │ │ │ │ +313 "simd type V, as Masks are not checked otherwise.")]] │ │ │ │ │ +314 void warnMissingMaskRebind(std::true_type) {} │ │ │ │ │ +315 template │ │ │ │ │ +316 void warnMissingMaskRebind(std::false_type) {} │ │ │ │ │ +317 │ │ │ │ │ +318 template class RebindPrune, │ │ │ │ │ +319 template class RebindAccept, class Recurse> │ │ │ │ │ +320 void checkRebindOf(Recurse recurse) │ │ │ │ │ +321 { │ │ │ │ │ +322 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(Rebinds{}, [this,recurse](auto target) { │ │ │ │ │ +323 using T = typename decltype(target)::type; │ │ │ │ │ +324 │ │ │ │ │ +325 // check that the rebound type exists │ │ │ │ │ +326 using W = Rebind; │ │ │ │ │ +327 log_ << "Type " << className() << " rebound to " │ │ │ │ │ +328 << className() << " is " << className() << std::endl; │ │ │ │ │ +329 │ │ │ │ │ +330 static_assert(std::is_same >::value, "Rebound " │ │ │ │ │ +331 "types must not be references, and must not include " │ │ │ │ │ +332 "cv-qualifiers"); │ │ │ │ │ +333 static_assert(lanes() == lanes(), "Rebound types must have " │ │ │ │ │ +334 "the same number of lanes as the original vector " │ │ │ │ │ +335 "types"); │ │ │ │ │ +336 static_assert(std::is_same >::value, "Rebound types " │ │ │ │ │ +337 "must have the bound-to scalar type"); │ │ │ │ │ +338 │ │ │ │ │ +339 if constexpr (RebindPrune{}) { │ │ │ │ │ +340 log_ << "Pruning check of Simd type " << className() │ │ │ │ │ +341 << std::endl; │ │ │ │ │ +342 } │ │ │ │ │ +343 else { │ │ │ │ │ +344 using Impl::debugTypes; │ │ │ │ │ +345 static_assert(debugTypes(RebindAccept{}), │ │ │ │ │ +346 "Rebind is W, but that is not accepted " │ │ │ │ │ +347 "by RebindAccept"); │ │ │ │ │ +348 recurse(MetaType{}); │ │ │ │ │ +349 } │ │ │ │ │ +350 }); │ │ │ │ │ +351 │ │ │ │ │ +352 static_assert(std::is_same, V>, V>::value, "A type " │ │ │ │ │ +353 "rebound to its own scalar type must be the same type " │ │ │ │ │ +354 "as the original type"); │ │ │ │ │ +355 static_assert(std::is_same, Mask >::value, "A type " │ │ │ │ │ +356 "rebound to bool must be the mask type for that type"); │ │ │ │ │ +357 │ │ │ │ │ +358 constexpr bool hasBool = Impl::TypeInList::value; │ │ │ │ │ +359 warnMissingMaskRebind(Std::bool_constant{}); │ │ │ │ │ +360 } │ │ │ │ │ +361 │ │ │ │ │ +363 // │ │ │ │ │ +364 // Fundamental checks │ │ │ │ │ +365 // │ │ │ │ │ +366 │ │ │ │ │ +367 template │ │ │ │ │ +368 void checkLanes() │ │ │ │ │ +369 { │ │ │ │ │ +370 // check lanes │ │ │ │ │ +371 static_assert(std::is_same())>::value, │ │ │ │ │ +372 "return type of lanes() should be std::size_t"); │ │ │ │ │ +373 static_assert(std::is_same::value, │ │ │ │ │ +374 "return type of lanes(V{}) should be std::size_t"); │ │ │ │ │ +375 │ │ │ │ │ +376 // the result of lanes() must be constexpr │ │ │ │ │ +377 [[maybe_unused]] constexpr auto size = lanes(); │ │ │ │ │ +378 // but the result of lanes(vec) does not need to be constexpr │ │ │ │ │ +379 _D_U_N_E___S_I_M_D___C_H_E_C_K(lanes() == _l_a_n_e_s(V{})); │ │ │ │ │ +380 } │ │ │ │ │ +381 │ │ │ │ │ +382 template │ │ │ │ │ +383 void checkDefaultConstruct() │ │ │ │ │ +384 { │ │ │ │ │ +385 { [[maybe_unused]] V vec; } │ │ │ │ │ +386 { [[maybe_unused]] V vec{}; } │ │ │ │ │ +387 { [[maybe_unused]] V vec = {}; } │ │ │ │ │ +388 } │ │ │ │ │ +389 │ │ │ │ │ +390 template │ │ │ │ │ +391 void checkLane() │ │ │ │ │ +392 { │ │ │ │ │ +393 // Avoid using broadcast() for initialization to avoid test │ │ │ │ │ +394 // interdependencies. │ │ │ │ │ +395 V vec(Scalar(0)); │ │ │ │ │ +396 // check lane() on mutable lvalues │ │ │ │ │ +397 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ +398 _l_a_n_e(l, vec) = l + 1; │ │ │ │ │ +399 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ +400 _D_U_N_E___S_I_M_D___C_H_E_C_K(_l_a_n_e(l, vec) == Scalar(l + 1)); │ │ │ │ │ +401 using MLRes = decltype(_l_a_n_e(0, vec)); │ │ │ │ │ +402 static_assert(std::is_same&>::value || │ │ │ │ │ +403 std::is_same >::value, │ │ │ │ │ +404 "Result of lane() on a mutable lvalue vector must " │ │ │ │ │ +405 "either be a mutable reference to a scalar of that " │ │ │ │ │ +406 "vector or a proxy object (which itself may not be a " │ │ │ │ │ +407 "reference nor const)."); │ │ │ │ │ +408 │ │ │ │ │ +409 // check lane() on const lvalues │ │ │ │ │ +410 const V &vec2 = vec; │ │ │ │ │ +411 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ +412 _D_U_N_E___S_I_M_D___C_H_E_C_K(_l_a_n_e(l, vec2) == Scalar(l + 1)); │ │ │ │ │ +413 using CLRes = decltype(_l_a_n_e(0, vec2)); │ │ │ │ │ +414 static_assert(std::is_same&>::value || │ │ │ │ │ +415 std::is_same >::value, │ │ │ │ │ +416 "Result of lane() on a const lvalue vector must " │ │ │ │ │ +417 "either be a const lvalue reference to a scalar of that " │ │ │ │ │ +418 "vector or a proxy object (which itself may not be a " │ │ │ │ │ +419 "reference nor const)."); │ │ │ │ │ +420 static_assert(!std::is_assignable >::value, │ │ │ │ │ +421 "Result of lane() on a const lvalue vector must not be " │ │ │ │ │ +422 "assignable from a scalar."); │ │ │ │ │ +423 │ │ │ │ │ +424 // check lane() on rvalues │ │ │ │ │ +425 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ +426 _D_U_N_E___S_I_M_D___C_H_E_C_K(_l_a_n_e(l, prvalue(vec)) == Scalar(l + 1)); │ │ │ │ │ +427 using RRes = decltype(_l_a_n_e(0, prvalue(vec))); │ │ │ │ │ +428 // TODO: do we really want to allow Scalar&& here? If we allow it, │ │ │ │ │ +429 // then `auto &&res = lane(0, vec*vec);` creates a dangling reference, │ │ │ │ │ +430 // and the scalar (and even the vector types) are small enough to be │ │ │ │ │ +431 // passed in registers anyway. On the other hand, the only comparable │ │ │ │ │ +432 // accessor function in the standard library that I can think of is │ │ │ │ │ +433 // std::get(), and that does return an rvalue reference in this │ │ │ │ │ +434 // situation. However, that cannot assume anything about the size of │ │ │ │ │ +435 // the returned types. │ │ │ │ │ +436 static_assert(std::is_same >::value || │ │ │ │ │ +437 std::is_same&&>::value, │ │ │ │ │ +438 "Result of lane() on a rvalue vector V must be " │ │ │ │ │ +439 "Scalar or Scalar&&."); │ │ │ │ │ +440 // Can't assert non-assignable, fails for any typical class, │ │ │ │ │ +441 // e.g. std::complex<>. Would need to return const Scalar or const │ │ │ │ │ +442 // Scalar&&, which would inhibit moving from the return value. │ │ │ │ │ +443 // static_assert(!std::is_assignable >::value, │ │ │ │ │ +444 // "Result of lane() on a rvalue vector must not be " │ │ │ │ │ +445 // "assignable from a scalar."); │ │ │ │ │ +446 } │ │ │ │ │ +447 │ │ │ │ │ +448 // check non-default constructors │ │ │ │ │ +449 template │ │ │ │ │ +450 void checkCopyMoveConstruct() │ │ │ │ │ +451 { │ │ │ │ │ +452 // elided copy/move constructors │ │ │ │ │ +453 { V vec (make123()); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +454 { V vec = make123() ; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +455 { V vec {make123()}; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +456 { V vec = {make123()}; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +457 │ │ │ │ │ +458 // copy constructors │ │ │ │ │ +459 { V ref(make123()); V vec (ref); │ │ │ │ │ +460 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ +461 { V ref(make123()); V vec = ref ; │ │ │ │ │ +462 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ +463 { V ref(make123()); V vec {ref}; │ │ │ │ │ +464 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ +465 { V ref(make123()); V vec = {ref}; │ │ │ │ │ +466 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ +467 { const V ref(make123()); V vec (ref); │ │ │ │ │ +468 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +469 { const V ref(make123()); V vec = ref ; │ │ │ │ │ +470 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +471 { const V ref(make123()); V vec {ref}; │ │ │ │ │ +472 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +473 { const V ref(make123()); V vec = {ref}; │ │ │ │ │ +474 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +475 │ │ │ │ │ +476 // move constructors │ │ │ │ │ +477 { V ref(make123()); V vec (std::move(ref)); │ │ │ │ │ +478 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +479 { V ref(make123()); V vec = std::move(ref) ; │ │ │ │ │ +480 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +481 { V ref(make123()); V vec {std::move(ref)}; │ │ │ │ │ +482 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +483 { V ref(make123()); V vec = {std::move(ref)}; │ │ │ │ │ +484 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +485 } │ │ │ │ │ +486 │ │ │ │ │ +487 template │ │ │ │ │ +488 void checkBroadcastVectorConstruct() │ │ │ │ │ +489 { │ │ │ │ │ +490 // broadcast copy constructors │ │ │ │ │ +491 { Scalar ref = 42; V vec (ref); │ │ │ │ │ +492 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ +493 { Scalar ref = 42; V vec = ref ; │ │ │ │ │ +494 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ +495 // { Scalar ref = 42; V vec {ref}; │ │ │ │ │ +496 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ +497 // { Scalar ref = 42; V vec = {ref}; │ │ │ │ │ +498 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ +499 { const Scalar ref = 42; V vec (ref); │ │ │ │ │ +500 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +501 { const Scalar ref = 42; V vec = ref ; │ │ │ │ │ +502 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +503 // { const Scalar ref = 42; V vec {ref}; │ │ │ │ │ +504 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +505 // { const Scalar ref = 42; V vec = {ref}; │ │ │ │ │ +506 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +507 │ │ │ │ │ +508 // broadcast move constructors │ │ │ │ │ +509 { Scalar ref = 42; V vec (std::move(ref)); │ │ │ │ │ +510 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +511 { Scalar ref = 42; V vec = std::move(ref) ; │ │ │ │ │ +512 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +513 // { Scalar ref = 42; V vec {std::move(ref)}; │ │ │ │ │ +514 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +515 // { Scalar ref = 42; V vec = {std::move(ref)}; │ │ │ │ │ +516 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +517 } │ │ │ │ │ +518 │ │ │ │ │ +519 template │ │ │ │ │ +520 void checkBroadcastMaskConstruct() │ │ │ │ │ +521 { │ │ │ │ │ +522 // broadcast copy constructors │ │ │ │ │ +523 { Scalar ref = 42; V vec (ref); │ │ │ │ │ +524 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ +525 // { Scalar ref = 42; V vec = ref ; │ │ │ │ │ +526 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ +527 { Scalar ref = 42; V vec {ref}; │ │ │ │ │ +528 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); } │ │ │ │ │ +529 // { Scalar ref = 42; V vec = {ref}; │ │ │ │ │ +530 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ +531 { const Scalar ref = 42; V vec (ref); │ │ │ │ │ +532 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +533 // { const Scalar ref = 42; V vec = ref ; │ │ │ │ │ +534 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +535 { const Scalar ref = 42; V vec {ref}; │ │ │ │ │ +536 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +537 // { const Scalar ref = 42; V vec = {ref}; │ │ │ │ │ +538 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +539 │ │ │ │ │ +540 // broadcast move constructors │ │ │ │ │ +541 { Scalar ref = 42; V vec (std::move(ref)); │ │ │ │ │ +542 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +543 // { Scalar ref = 42; V vec = std::move(ref) ; │ │ │ │ │ +544 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +545 { Scalar ref = 42; V vec {std::move(ref)}; │ │ │ │ │ +546 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); } │ │ │ │ │ +547 // { Scalar ref = 42; V vec = {std::move(ref)}; │ │ │ │ │ +548 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +549 } │ │ │ │ │ +550 │ │ │ │ │ +551 // check the implCast function │ │ │ │ │ +552 template │ │ │ │ │ +553 void checkImplCast() │ │ │ │ │ +554 { │ │ │ │ │ +555 { // lvalue arg │ │ │ │ │ +556 FromV fromVec = make123(); │ │ │ │ │ +557 auto toVec = implCast(fromVec); │ │ │ │ │ +558 static_assert(std::is_same::value, │ │ │ │ │ +559 "Unexpected result type for implCast(FromV&)"); │ │ │ │ │ +560 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(fromVec)); │ │ │ │ │ +561 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(toVec)); │ │ │ │ │ +562 } │ │ │ │ │ +563 │ │ │ │ │ +564 { // const lvalue arg │ │ │ │ │ +565 const FromV fromVec = make123(); │ │ │ │ │ +566 auto toVec = implCast(fromVec); │ │ │ │ │ +567 static_assert(std::is_same::value, │ │ │ │ │ +568 "Unexpected result type for implCast(const " │ │ │ │ │ +569 "FromV&)"); │ │ │ │ │ +570 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(toVec)); │ │ │ │ │ +571 } │ │ │ │ │ +572 │ │ │ │ │ +573 { // rvalue arg │ │ │ │ │ +574 auto toVec = implCast(make123()); │ │ │ │ │ +575 static_assert(std::is_same::value, │ │ │ │ │ +576 "Unexpected result type for implCast(FromV&&)"); │ │ │ │ │ +577 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(toVec)); │ │ │ │ │ +578 } │ │ │ │ │ +579 } │ │ │ │ │ +580 │ │ │ │ │ +581 // check the implCast function │ │ │ │ │ +582 template │ │ │ │ │ +583 void checkImplCast() │ │ │ │ │ +584 { │ │ │ │ │ +585 // check against LoopSIMD │ │ │ │ │ +586 using LoopV = _D_u_n_e_:_:_L_o_o_p_S_I_M_D_<_S_c_a_l_a_r_<_V_>, lanes()>; │ │ │ │ │ +587 │ │ │ │ │ +588 checkImplCast(); │ │ │ │ │ +589 checkImplCast(); │ │ │ │ │ +590 checkImplCast(); │ │ │ │ │ +591 } │ │ │ │ │ +592 │ │ │ │ │ +593 // check the broadcast function │ │ │ │ │ +594 template │ │ │ │ │ +595 void checkBroadcast() │ │ │ │ │ +596 { │ │ │ │ │ +597 // broadcast function │ │ │ │ │ +598 { // lvalue arg │ │ │ │ │ +599 Scalar ref = 42; │ │ │ │ │ +600 auto vec = broadcast(ref); │ │ │ │ │ +601 static_assert(std::is_same::value, │ │ │ │ │ +602 "Unexpected result type for broadcast()"); │ │ │ │ │ +603 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ +604 _D_U_N_E___S_I_M_D___C_H_E_C_K(ref == Scalar(42)); │ │ │ │ │ +605 } │ │ │ │ │ +606 │ │ │ │ │ +607 { // const lvalue arg │ │ │ │ │ +608 const Scalar ref = 42; │ │ │ │ │ +609 auto vec = broadcast(ref); │ │ │ │ │ +610 static_assert(std::is_same::value, │ │ │ │ │ +611 "Unexpected result type for broadcast()"); │ │ │ │ │ +612 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ +613 } │ │ │ │ │ +614 │ │ │ │ │ +615 { // rvalue arg │ │ │ │ │ +616 auto vec = broadcast(Scalar(42)); │ │ │ │ │ +617 static_assert(std::is_same::value, │ │ │ │ │ +618 "Unexpected result type for broadcast()"); │ │ │ │ │ +619 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ +620 } │ │ │ │ │ +621 │ │ │ │ │ +622 { // int arg │ │ │ │ │ +623 auto vec = broadcast(42); │ │ │ │ │ +624 static_assert(std::is_same::value, │ │ │ │ │ +625 "Unexpected result type for broadcast()"); │ │ │ │ │ +626 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ +627 } │ │ │ │ │ +628 │ │ │ │ │ +629 { // double arg │ │ │ │ │ +630 auto vec = broadcast(42.0); │ │ │ │ │ +631 static_assert(std::is_same::value, │ │ │ │ │ +632 "Unexpected result type for broadcast()"); │ │ │ │ │ +633 _D_U_N_E___S_I_M_D___C_H_E_C_K(is42(vec)); │ │ │ │ │ +634 } │ │ │ │ │ +635 } │ │ │ │ │ +636 │ │ │ │ │ +637 template │ │ │ │ │ +638 void checkBracedAssign() │ │ │ │ │ +639 { │ │ │ │ │ +640 // copy assignment │ │ │ │ │ +641 { V ref = make123(); V vec; vec = {ref}; │ │ │ │ │ +642 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ +643 { const V ref = make123(); V vec; vec = {ref}; │ │ │ │ │ +644 _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(ref)); } │ │ │ │ │ +645 │ │ │ │ │ +646 // move assignment │ │ │ │ │ +647 { V vec; vec = {make123()}; _D_U_N_E___S_I_M_D___C_H_E_C_K(is123(vec)); } │ │ │ │ │ +648 } │ │ │ │ │ +649 │ │ │ │ │ +650 template │ │ │ │ │ +651 void checkBracedBroadcastAssign() │ │ │ │ │ +652 { │ │ │ │ │ +653 // nothing works here │ │ │ │ │ +654 // // broadcast copy assignment │ │ │ │ │ +655 // { Scalar ref = 42; V vec; vec = {ref}; │ │ │ │ │ +656 // DUNE_SIMD_CHECK(is42(vec)); DUNE_SIMD_CHECK(ref == Scalar(42)); } │ │ │ │ │ +657 // { const Scalar ref = 42; V vec; vec = {ref}; │ │ │ │ │ +658 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +659 │ │ │ │ │ +660 // // broadcast move assignment │ │ │ │ │ +661 // { Scalar ref = 42; V vec; vec = {std::move(ref)}; │ │ │ │ │ +662 // DUNE_SIMD_CHECK(is42(vec)); } │ │ │ │ │ +663 } │ │ │ │ │ +664 │ │ │ │ │ +666 // │ │ │ │ │ +667 // checks for unary operators │ │ │ │ │ +668 // │ │ │ │ │ +669 │ │ │ │ │ +_6_7_0#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL) \ │ │ │ │ │ +671 struct OpPostfix##NAME \ │ │ │ │ │ +672 { \ │ │ │ │ │ +673 template \ │ │ │ │ │ +674 auto operator()(V&& v) const \ │ │ │ │ │ +675 -> decltype(std::forward(v) SYMBOL) \ │ │ │ │ │ +676 { \ │ │ │ │ │ +677 return std::forward(v) SYMBOL; \ │ │ │ │ │ +678 } \ │ │ │ │ │ +679 } │ │ │ │ │ +680 │ │ │ │ │ +_6_8_1#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL) \ │ │ │ │ │ +682 struct OpPrefix##NAME \ │ │ │ │ │ +683 { \ │ │ │ │ │ +684 template \ │ │ │ │ │ +685 auto operator()(V&& v) const \ │ │ │ │ │ +686 -> decltype(SYMBOL std::forward(v)) \ │ │ │ │ │ +687 { \ │ │ │ │ │ +688 return SYMBOL std::forward(v); \ │ │ │ │ │ +689 } \ │ │ │ │ │ +690 } │ │ │ │ │ +691 │ │ │ │ │ +692 _D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P(Decrement, -- ); │ │ │ │ │ +693 _D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P(Increment, ++ ); │ │ │ │ │ +694 │ │ │ │ │ +695 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Decrement, -- ); │ │ │ │ │ +696 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Increment, ++ ); │ │ │ │ │ +697 │ │ │ │ │ +698 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Plus, + ); │ │ │ │ │ +699 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (Minus, - ); │ │ │ │ │ +700 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (LogicNot, ! ); │ │ │ │ │ +701 // Do not warn about ~ being applied to bool. (1) Yes, doing that is │ │ │ │ │ +702 // weird, but we do want to test the weird stuff too. (2) It avoids │ │ │ │ │ +703 // running into on │ │ │ │ │ +704 // g++-7.0 through 7.2. Also, ignore -Wpragmas to not warn about an │ │ │ │ │ +705 // unknown -Wbool-operation on compilers that do not know that option. │ │ │ │ │ +706#pragma GCC diagnostic push │ │ │ │ │ +707#pragma GCC diagnostic ignored "-Wpragmas" │ │ │ │ │ +708#pragma GCC diagnostic ignored "-Wunknown-warning-option" // clang 6.0.1 │ │ │ │ │ +709#pragma GCC diagnostic ignored "-Wbool-operation" │ │ │ │ │ +710 _D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P (BitNot, ~ ); │ │ │ │ │ +711#pragma GCC diagnostic pop │ │ │ │ │ +712 │ │ │ │ │ +713#undef DUNE_SIMD_POSTFIX_OP │ │ │ │ │ +714#undef DUNE_SIMD_PREFIX_OP │ │ │ │ │ +715 │ │ │ │ │ +716 template │ │ │ │ │ +717 std::enable_if_t< │ │ │ │ │ +718 IsCallable())))>::value> │ │ │ │ │ +719 checkUnaryOpV(Op op) │ │ │ │ │ +720 { │ │ │ │ │ +721#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ +722 // arguments │ │ │ │ │ +723 auto val = leftVector>(); │ │ │ │ │ +724 │ │ │ │ │ +725 // copy the arguments in case V is a references │ │ │ │ │ +726 auto arg = val; │ │ │ │ │ +727 auto &&result = op(static_cast(arg)); │ │ │ │ │ +728 using T = _S_c_a_l_a_r >; │ │ │ │ │ +729 for(std::size_t l = 0; l < _l_a_n_e_s(val); ++l) │ │ │ │ │ +730 { │ │ │ │ │ +731 // `op` might promote the argument. This is a problem if the │ │ │ │ │ +732 // argument of the operation on the right of the `==` is │ │ │ │ │ +733 // e.g. `(unsigned short)1` and the operation is e.g. unary `-`. │ │ │ │ │ +734 // Then the argument is promoted to `int` before applying the │ │ │ │ │ +735 // negation, and the result is `(int)-1`. However, the left side of │ │ │ │ │ +736 // the `==` is still `(unsigned short)-1`, which typically is the │ │ │ │ │ +737 // same as `(unsigned short)65535`. The `==` promotes the left side │ │ │ │ │ +738 // before comparing, so that becomes `(int)65535`. It will then │ │ │ │ │ +739 // compare `(int)65535` and `(int)-1` and rightly declare them to be │ │ │ │ │ +740 // not equal. │ │ │ │ │ +741 │ │ │ │ │ +742 // To work around this, we explicitly convert the right side of the │ │ │ │ │ +743 // `==` to the scalar type before comparing. │ │ │ │ │ +744 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ +745 (_l_a_n_e(l, result) │ │ │ │ │ +746 == static_cast(op(_l_a_n_e(l, static_cast(val))))); │ │ │ │ │ +747 } │ │ │ │ │ +748 // op might modify val, verify that any such modification also happens │ │ │ │ │ +749 // in the vector case │ │ │ │ │ +750 for(std::size_t l = 0; l < lanes >(); ++l) │ │ │ │ │ +751 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, val) == _l_a_n_e(l, arg)); │ │ │ │ │ +752#undef DUNE_SIMD_OPNAME │ │ │ │ │ +753 } │ │ │ │ │ +754 │ │ │ │ │ +755 template │ │ │ │ │ +756 std::enable_if_t< │ │ │ │ │ +757 not IsCallable())))>::value> │ │ │ │ │ +758 checkUnaryOpV(Op op) │ │ │ │ │ +759 { │ │ │ │ │ +760 // log_ << "No " << className())))>() │ │ │ │ │ +761 // << std::endl │ │ │ │ │ +762 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ +763 } │ │ │ │ │ +764 │ │ │ │ │ +765 template │ │ │ │ │ +766 void checkUnaryOpsV(Op op) │ │ │ │ │ +767 { │ │ │ │ │ +768 checkUnaryOpV(op); │ │ │ │ │ +769 checkUnaryOpV(op); │ │ │ │ │ +770 checkUnaryOpV(op); │ │ │ │ │ +771 } │ │ │ │ │ +772 │ │ │ │ │ +774 // │ │ │ │ │ +775 // checks for binary operators │ │ │ │ │ +776 // │ │ │ │ │ +777 │ │ │ │ │ +778 // The operators contain an `operator()`, which will be invoked for both │ │ │ │ │ +779 // scalar and vector arguments. The function `scalar()` is used the │ │ │ │ │ +780 // test whether the scalar types support the operation (via │ │ │ │ │ +781 // `ScalarResult`). The difference is that `scalar()` should only ever │ │ │ │ │ +782 // receive `const`-ref-qualified version of `Scalar`, while the │ │ │ │ │ +783 // `operator()` may also be called with proxies representing scalars. │ │ │ │ │ +_7_8_4#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL) \ │ │ │ │ │ +785 struct OpInfix##NAME \ │ │ │ │ │ +786 { \ │ │ │ │ │ +787 template \ │ │ │ │ │ +788 decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ +789 { \ │ │ │ │ │ +790 return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ +791 } \ │ │ │ │ │ +792 template \ │ │ │ │ │ +793 auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ +794 -> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ +795 } │ │ │ │ │ +796 │ │ │ │ │ +797 // for assign ops, accept only non-const lvalue arguments for scalars. │ │ │ │ │ +798 // This is needed for class scalars (e.g. std::complex) because │ │ │ │ │ +799 // non-const class rvalues are actually usually assignable. Though that │ │ │ │ │ +800 // assignment happens to a temporary, and thus is lost. Except that the │ │ │ │ │ +801 // tests would bind the result of the assignment to a reference. And │ │ │ │ │ +802 // because that result is returned from a function by reference, even │ │ │ │ │ +803 // though it is a temporary passed as an argument to that function, │ │ │ │ │ +804 // accessing the result later is undefined behaviour. │ │ │ │ │ +_8_0_5#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL) \ │ │ │ │ │ +806 struct OpInfix##NAME \ │ │ │ │ │ +807 { \ │ │ │ │ │ +808 template \ │ │ │ │ │ +809 decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ +810 { \ │ │ │ │ │ +811 return std::forward(v1) SYMBOL std::forward(v2); \ │ │ │ │ │ +812 } \ │ │ │ │ │ +813 template \ │ │ │ │ │ +814 auto scalar(S1& s1, S2&& s2) const \ │ │ │ │ │ +815 -> decltype(s1 SYMBOL std::forward(s2)); \ │ │ │ │ │ +816 } │ │ │ │ │ +817 │ │ │ │ │ +_8_1_8#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL) \ │ │ │ │ │ +819 struct OpInfix##NAME \ │ │ │ │ │ +820 { \ │ │ │ │ │ +821 template \ │ │ │ │ │ +822 decltype(auto) operator()(V1&& v1, V2&& v2) const \ │ │ │ │ │ +823 { \ │ │ │ │ │ +824 return Simd::REPLFN(std::forward(v1), std::forward(v2)); \ │ │ │ │ │ +825 } \ │ │ │ │ │ +826 template \ │ │ │ │ │ +827 auto scalar(S1&& s1, S2&& s2) const \ │ │ │ │ │ +828 -> decltype(std::forward(s1) SYMBOL std::forward(s2)); \ │ │ │ │ │ +829 } │ │ │ │ │ +830 │ │ │ │ │ +831 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Mul, * ); │ │ │ │ │ +832 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Div, / ); │ │ │ │ │ +833 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Remainder, % ); │ │ │ │ │ +834 │ │ │ │ │ +835 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Plus, + ); │ │ │ │ │ +836 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Minus, - ); │ │ │ │ │ +837 │ │ │ │ │ +838 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(LeftShift, << ); │ │ │ │ │ +839 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(RightShift, >> ); │ │ │ │ │ +840 │ │ │ │ │ +841 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Less, < ); │ │ │ │ │ +842 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Greater, > ); │ │ │ │ │ +843 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(LessEqual, <= ); │ │ │ │ │ +844 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(GreaterEqual, >= ); │ │ │ │ │ +845 │ │ │ │ │ +846 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(Equal, == ); │ │ │ │ │ +847 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(NotEqual, != ); │ │ │ │ │ +848 │ │ │ │ │ +849 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(BitAnd, & ); │ │ │ │ │ +850 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(BitXor, ^ ); │ │ │ │ │ +851 _D_U_N_E___S_I_M_D___I_N_F_I_X___O_P(BitOr, | ); │ │ │ │ │ +852 │ │ │ │ │ +853 // Those are not supported in any meaningful way by vectorclass │ │ │ │ │ +854 // We need to test replacement functions maskAnd() and maskOr() instead. │ │ │ │ │ +855 _D_U_N_E___S_I_M_D___R_E_P_L___O_P(LogicAnd, _m_a_s_k_A_n_d, && ); │ │ │ │ │ +856 _D_U_N_E___S_I_M_D___R_E_P_L___O_P(LogicOr, _m_a_s_k_O_r, || ); │ │ │ │ │ +857 │ │ │ │ │ +858 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(Assign, = ); │ │ │ │ │ +859 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignMul, *= ); │ │ │ │ │ +860 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignDiv, /= ); │ │ │ │ │ +861 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignRemainder, %= ); │ │ │ │ │ +862 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignPlus, += ); │ │ │ │ │ +863 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignMinus, -= ); │ │ │ │ │ +864 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignLeftShift, <<=); │ │ │ │ │ +865 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignRightShift, >>=); │ │ │ │ │ +866 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignAnd, &= ); │ │ │ │ │ +867 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignXor, ^= ); │ │ │ │ │ +868 _D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P(AssignOr, |= ); │ │ │ │ │ +869 │ │ │ │ │ +870#undef DUNE_SIMD_INFIX_OP │ │ │ │ │ +871#undef DUNE_SIMD_REPL_OP │ │ │ │ │ +872#undef DUNE_SIMD_ASSIGN_OP │ │ │ │ │ +873 │ │ │ │ │ +874 // just used as a tag │ │ │ │ │ +875 struct OpInfixComma {}; │ │ │ │ │ +876 │ │ │ │ │ +877 template │ │ │ │ │ +878 void checkCommaOp(const std::decay_t &val1, │ │ │ │ │ +879 const std::decay_t &val2) │ │ │ │ │ +880 { │ │ │ │ │ +881#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ +882 static_assert(std::is_same(), │ │ │ │ │ +883 std::declval())), T2>::value, │ │ │ │ │ +884 "Type and value category of the comma operator must " │ │ │ │ │ +885 "match that of the second operand"); │ │ │ │ │ +886 │ │ │ │ │ +887 // copy the arguments in case T1 or T2 are references │ │ │ │ │ +888 auto arg1 = val1; │ │ │ │ │ +889 auto arg2 = val2; │ │ │ │ │ +890 // Do not warn that the left side of the comma operator is unused. │ │ │ │ │ +891 // Seems to work for g++-4.9 and clang++-3.8. Appears to be harmless │ │ │ │ │ +892 // for icpc (14 and 17), and icpc does not seem to issue a warning │ │ │ │ │ +893 // anyway. │ │ │ │ │ +894#pragma GCC diagnostic push │ │ │ │ │ +895#pragma GCC diagnostic ignored "-Wunused-value" │ │ │ │ │ +896 auto &&result = (static_cast(arg1), │ │ │ │ │ +897 static_cast(arg2)); │ │ │ │ │ +898#pragma GCC diagnostic pop │ │ │ │ │ +899 if(std::is_reference::value) │ │ │ │ │ +900 { │ │ │ │ │ +901 // comma should return the same object as the second argument for │ │ │ │ │ +902 // lvalues and xvalues │ │ │ │ │ +903 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(&result == &arg2); │ │ │ │ │ +904 // it should not modify any arguments │ │ │ │ │ +905 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(val1 == arg1)); │ │ │ │ │ +906 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(val2 == arg2)); │ │ │ │ │ +907 } │ │ │ │ │ +908 else │ │ │ │ │ +909 { │ │ │ │ │ +910 // comma should return the same value as the second argument for │ │ │ │ │ +911 // prvalues │ │ │ │ │ +912 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(result == arg2)); │ │ │ │ │ +913 // it should not modify any arguments │ │ │ │ │ +914 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_a_l_l_T_r_u_e(val1 == arg1)); │ │ │ │ │ +915 // second argument is a prvalue, any modifications happen to a │ │ │ │ │ +916 // temporary and we can't detect them │ │ │ │ │ +917 } │ │ │ │ │ +918#undef DUNE_SIMD_OPNAME │ │ │ │ │ +919 } │ │ │ │ │ +920 │ │ │ │ │ +922 // │ │ │ │ │ +923 // checks for vector-vector binary operations │ │ │ │ │ +924 // │ │ │ │ │ +925 │ │ │ │ │ +926 // We check the following candidate operation │ │ │ │ │ +927 // │ │ │ │ │ +928 // vopres = vop1 @ vop2 │ │ │ │ │ +929 // │ │ │ │ │ +930 // against the reference operation │ │ │ │ │ +931 // │ │ │ │ │ +932 // arefres[l] = aref1[l] @ aref2[l] foreach l │ │ │ │ │ +933 // │ │ │ │ │ +934 // v... variables are simd-vectors and a... variables are arrays. The │ │ │ │ │ +935 // operation may modify the operands, but if is does the modification │ │ │ │ │ +936 // needs to happen in both the candidate and the reference. │ │ │ │ │ +937 // │ │ │ │ │ +938 // We do the following checks: │ │ │ │ │ +939 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +940 // 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ +941 // 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ +942 // 4. lane(l, vop2) == aref2[l] foreach l │ │ │ │ │ +943 template │ │ │ │ │ +944 std::enable_if_t > │ │ │ │ │ +945 checkBinaryOpVV(MetaType, MetaType, Op op) │ │ │ │ │ +946 { │ │ │ │ │ +947#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ +948 static_assert(std::is_same, std::decay_t >::value, │ │ │ │ │ +949 "Internal testsystem error: called with two types that " │ │ │ │ │ +950 "don't decay to the same thing"); │ │ │ │ │ +951 │ │ │ │ │ +952 // reference arguments │ │ │ │ │ +953 auto vref1 = leftVector>(); │ │ │ │ │ +954 auto vref2 = rightVector>(); │ │ │ │ │ +955 │ │ │ │ │ +956 // candidate arguments │ │ │ │ │ +957 auto vop1 = vref1; │ │ │ │ │ +958 auto vop2 = vref2; │ │ │ │ │ +959 │ │ │ │ │ +960 // candidate operation │ │ │ │ │ +961 auto &&vopres = op(static_cast(vop1), static_cast(vop2)); │ │ │ │ │ +962 using VR = decltype(vopres); │ │ │ │ │ +963 │ │ │ │ │ +964 // check 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +965 static_assert(lanes >() == _l_a_n_e_s >(), │ │ │ │ │ +966 "The result must have the same number of lanes as the " │ │ │ │ │ +967 "operands."); │ │ │ │ │ +968 │ │ │ │ │ +969 // do the reference operation, and simultaneously │ │ │ │ │ +970 // check 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ +971 using T = Scalar >; │ │ │ │ │ +972 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vopres))) │ │ │ │ │ +973 { │ │ │ │ │ +974 // see the lengthy comment in `checkUnaryOpV()` as to why the │ │ │ │ │ +975 // `static_cast` around the `op()` is necessary │ │ │ │ │ +976 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ +977 (_l_a_n_e(l, vopres) │ │ │ │ │ +978 == static_cast(op(_l_a_n_e(l, static_cast(vref1)), │ │ │ │ │ +979 _l_a_n_e(l, static_cast(vref2))))); │ │ │ │ │ +980 } │ │ │ │ │ +981 │ │ │ │ │ +982 // check 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ +983 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop1))) │ │ │ │ │ +984 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop1) == _l_a_n_e(l, vref1)); │ │ │ │ │ +985 │ │ │ │ │ +986 // check 4. lane(l, vop2) == aref2[l] foreach l │ │ │ │ │ +987 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop2))) │ │ │ │ │ +988 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop2) == _l_a_n_e(l, vref2)); │ │ │ │ │ +989 │ │ │ │ │ +990#undef DUNE_SIMD_OPNAME │ │ │ │ │ +991 } │ │ │ │ │ +992 │ │ │ │ │ +993 template │ │ │ │ │ +994 std::enable_if_t > │ │ │ │ │ +995 checkBinaryOpVV(MetaType, MetaType, Op op) │ │ │ │ │ +996 { │ │ │ │ │ +997 // log_ << "No " << className())), │ │ │ │ │ +998 // decltype(lane(0, std::declval())))>() │ │ │ │ │ +999 // << std::endl │ │ │ │ │ +1000 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ +1001 } │ │ │ │ │ +1002 │ │ │ │ │ +1003 template │ │ │ │ │ +1004 void checkBinaryOpVV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ +1005 { │ │ │ │ │ +1006 static_assert(std::is_same, std::decay_t >::value, │ │ │ │ │ +1007 "Internal testsystem error: called with two types that " │ │ │ │ │ +1008 "don't decay to the same thing"); │ │ │ │ │ +1009 │ │ │ │ │ +1010 checkCommaOp(leftVector>(), │ │ │ │ │ +1011 rightVector>()); │ │ │ │ │ +1012 } │ │ │ │ │ +1013 │ │ │ │ │ +1015 // │ │ │ │ │ +1016 // checks for vector-scalar binary operations │ │ │ │ │ +1017 // │ │ │ │ │ +1018 │ │ │ │ │ +1019 // We check the following candidate operation │ │ │ │ │ +1020 // │ │ │ │ │ +1021 // vopres = vop1 @ sop2 │ │ │ │ │ +1022 // │ │ │ │ │ +1023 // against the reference operation │ │ │ │ │ +1024 // │ │ │ │ │ +1025 // arefres[l] = aref1[l] @ sref2 foreach l │ │ │ │ │ +1026 // │ │ │ │ │ +1027 // v... variables are simd-vectors, a... variables are arrays, and │ │ │ │ │ +1028 // s... variables are scalars. The operation may modify the left │ │ │ │ │ +1029 // operand, but if is does the modifications needs to happen in both the │ │ │ │ │ +1030 // candidate and the reference. │ │ │ │ │ +1031 // │ │ │ │ │ +1032 // We do the following checks: │ │ │ │ │ +1033 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +1034 // 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ +1035 // 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ +1036 // 4. sop2 is never modified │ │ │ │ │ +1037 // 5. sref2 is never modified │ │ │ │ │ +1038 // │ │ │ │ │ +1039 // In fact, if the property "sref2 is never modified" is violated that │ │ │ │ │ +1040 // means the operation is unsuitable for an automatic broadcast of the │ │ │ │ │ +1041 // second operand and should not be checked. There are no operations in │ │ │ │ │ +1042 // the standard where the second operand is modified like this, but │ │ │ │ │ +1043 // there are operations where the first operand is modified -- and this │ │ │ │ │ +1044 // check is used for those ops as well by exchanging the first and second │ │ │ │ │ +1045 // argument below. │ │ │ │ │ +1046 │ │ │ │ │ +1047 template │ │ │ │ │ +1048 std::enable_if_t > │ │ │ │ │ +1049 checkBinaryOpVS(MetaType, MetaType, Op op) │ │ │ │ │ +1050 { │ │ │ │ │ +1051#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ +1052 static_assert(std::is_same >, │ │ │ │ │ +1053 std::decay_t >::value, │ │ │ │ │ +1054 "Internal testsystem error: called with a scalar that " │ │ │ │ │ +1055 "does not match the vector type."); │ │ │ │ │ +1056 │ │ │ │ │ +1057 // initial values │ │ │ │ │ +1058 auto sinit2 = rightScalar>(); │ │ │ │ │ +1059 │ │ │ │ │ +1060 // reference arguments │ │ │ │ │ +1061 auto vref1 = leftVector>(); │ │ │ │ │ +1062 auto sref2 = sinit2; │ │ │ │ │ +1063 │ │ │ │ │ +1064 // candidate arguments │ │ │ │ │ +1065 auto vop1 = vref1; │ │ │ │ │ +1066 auto sop2 = sref2; │ │ │ │ │ +1067 │ │ │ │ │ +1068 // candidate operation │ │ │ │ │ +1069 auto &&vopres = op(static_cast(vop1), static_cast(sop2)); │ │ │ │ │ +1070 using VR = decltype(vopres); │ │ │ │ │ +1071 │ │ │ │ │ +1072 // check 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +1073 static_assert(lanes >() == _l_a_n_e_s >(), │ │ │ │ │ +1074 "The result must have the same number of lanes as the " │ │ │ │ │ +1075 "operands."); │ │ │ │ │ +1076 │ │ │ │ │ +1077 // check 4. sop2 is never modified │ │ │ │ │ +1078 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(sop2 == sinit2); │ │ │ │ │ +1079 │ │ │ │ │ +1080 // do the reference operation, and simultaneously check 2. and 5. │ │ │ │ │ +1081 using T = _S_c_a_l_a_r >; │ │ │ │ │ +1082 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vopres))) │ │ │ │ │ +1083 { │ │ │ │ │ +1084 // check 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ +1085 // see the lengthy comment in `checkUnaryOpV()` as to why the │ │ │ │ │ +1086 // `static_cast` around the `op()` is necessary │ │ │ │ │ +1087 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ +1088 (_l_a_n_e(l, vopres) │ │ │ │ │ +1089 == static_cast(op(_l_a_n_e(l, static_cast(vref1)), │ │ │ │ │ +1090 static_cast(sref2) ))); │ │ │ │ │ +1091 // check 5. sref2 is never modified │ │ │ │ │ +1092 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(sref2 == sinit2); │ │ │ │ │ +1093 } │ │ │ │ │ +1094 │ │ │ │ │ +1095 // check 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ +1096 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop1))) │ │ │ │ │ +1097 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop1) == _l_a_n_e(l, vref1)); │ │ │ │ │ +1098 │ │ │ │ │ +1099#undef DUNE_SIMD_OPNAME │ │ │ │ │ +1100 } │ │ │ │ │ +1101 │ │ │ │ │ +1102 template │ │ │ │ │ +1103 std::enable_if_t > │ │ │ │ │ +1104 checkBinaryOpVS(MetaType, MetaType, Op op) │ │ │ │ │ +1105 { │ │ │ │ │ +1106 // log_ << "No " │ │ │ │ │ +1107 // << className())), T2)>() │ │ │ │ │ +1108 // << std::endl │ │ │ │ │ +1109 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ +1110 } │ │ │ │ │ +1111 │ │ │ │ │ +1112 template │ │ │ │ │ +1113 void checkBinaryOpVS(MetaType, MetaType, OpInfixComma) │ │ │ │ │ +1114 { │ │ │ │ │ +1115 static_assert(std::is_same >, │ │ │ │ │ +1116 std::decay_t >::value, │ │ │ │ │ +1117 "Internal testsystem error: called with a scalar that " │ │ │ │ │ +1118 "does not match the vector type."); │ │ │ │ │ +1119 │ │ │ │ │ +1120 checkCommaOp(leftVector>(), │ │ │ │ │ +1121 rightScalar>()); │ │ │ │ │ +1122 } │ │ │ │ │ +1123 │ │ │ │ │ +1125 // │ │ │ │ │ +1126 // cross-check scalar-vector binary operations against vector-vector │ │ │ │ │ +1127 // │ │ │ │ │ +1128 │ │ │ │ │ +1129 // We check the following candidate operation │ │ │ │ │ +1130 // │ │ │ │ │ +1131 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2) │ │ │ │ │ +1132 // │ │ │ │ │ +1133 // against the reference operation │ │ │ │ │ +1134 // │ │ │ │ │ +1135 // vrefres = vref1 @ sref2 │ │ │ │ │ +1136 // │ │ │ │ │ +1137 // v... variables are simd-vectors, a... variables are arrays, and │ │ │ │ │ +1138 // s... variables are scalars. │ │ │ │ │ +1139 // │ │ │ │ │ +1140 // We could check the following properties │ │ │ │ │ +1141 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +1142 // 2. lane(l, vopres) == lane(l, vrefres) foreach l │ │ │ │ │ +1143 // 3. lane(l, vop1) == lane(l, vref1) foreach l │ │ │ │ │ +1144 // but these are given by checking the operation against the scalar │ │ │ │ │ +1145 // operation in the vector@vector and vector@scalar cases above. │ │ │ │ │ +1146 // │ │ │ │ │ +1147 // The only thing left to check is: │ │ │ │ │ +1148 // 4. lane(l, vop2) foreach l is never modified │ │ │ │ │ +1149 │ │ │ │ │ +1150 template │ │ │ │ │ +1151 std::enable_if_t > │ │ │ │ │ +1152 checkBinaryOpVVAgainstVS(MetaType, MetaType, Op op) │ │ │ │ │ +1153 { │ │ │ │ │ +1154#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ +1155 static_assert(std::is_same >, │ │ │ │ │ +1156 std::decay_t >::value, │ │ │ │ │ +1157 "Internal testsystem error: called with a scalar that " │ │ │ │ │ +1158 "does not match the vector type."); │ │ │ │ │ +1159 │ │ │ │ │ +1160 // initial values │ │ │ │ │ +1161 auto sinit2 = rightScalar>(); │ │ │ │ │ +1162 │ │ │ │ │ +1163 // reference arguments │ │ │ │ │ +1164 auto vop1 = leftVector>(); │ │ │ │ │ +1165 using V2 = CopyRefQual; │ │ │ │ │ +1166 std::decay_t vop2(sinit2); │ │ │ │ │ +1167 │ │ │ │ │ +1168 // candidate operation │ │ │ │ │ +1169 op(static_cast(vop1), static_cast(vop2)); │ │ │ │ │ +1170 │ │ │ │ │ +1171 // 4. lane(l, vop2) foreach l is never modified │ │ │ │ │ +1172 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop2))) │ │ │ │ │ +1173 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop2) == sinit2); │ │ │ │ │ +1174 │ │ │ │ │ +1175#undef DUNE_SIMD_OPNAME │ │ │ │ │ +1176 } │ │ │ │ │ +1177 │ │ │ │ │ +1178 template │ │ │ │ │ +1179 std::enable_if_t > │ │ │ │ │ +1180 checkBinaryOpVVAgainstVS(MetaType, MetaType, Op op) │ │ │ │ │ +1181 { │ │ │ │ │ +1182 // log_ << "No " │ │ │ │ │ +1183 // << className())), T2)>() │ │ │ │ │ +1184 // << std::endl │ │ │ │ │ +1185 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ +1186 } │ │ │ │ │ +1187 │ │ │ │ │ +1188 template │ │ │ │ │ +1189 void checkBinaryOpVVAgainstVS(MetaType, MetaType, OpInfixComma) │ │ │ │ │ +1190 { } │ │ │ │ │ +1191 │ │ │ │ │ +1193 // │ │ │ │ │ +1194 // checks for vector-proxy binary operations │ │ │ │ │ +1195 // │ │ │ │ │ +1196 │ │ │ │ │ +1197 // We check the following candidate operation │ │ │ │ │ +1198 // │ │ │ │ │ +1199 // vopres = vop1 @ pop2 │ │ │ │ │ +1200 // │ │ │ │ │ +1201 // against the reference operation │ │ │ │ │ +1202 // │ │ │ │ │ +1203 // arefres[l] = aref1[l] @ sref2 foreach l │ │ │ │ │ +1204 // │ │ │ │ │ +1205 // v... variables are simd-vectors, a... variables are arrays, │ │ │ │ │ +1206 // p... variables are proxies of simd-vector entries and s... variables │ │ │ │ │ +1207 // are scalars. The operation may modify the left operand, but if is │ │ │ │ │ +1208 // does the modifications needs to happen in both the candidate and the │ │ │ │ │ +1209 // reference. │ │ │ │ │ +1210 // │ │ │ │ │ +1211 // We do the following checks: │ │ │ │ │ +1212 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +1213 // 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ +1214 // 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ +1215 // 4. pop2 is never modified │ │ │ │ │ +1216 // 5. sref2 is never modified │ │ │ │ │ +1217 // │ │ │ │ │ +1218 // In fact, if the property "sref2 is never modified" is violated that │ │ │ │ │ +1219 // means the operation is unsuitable for an automatic broadcast of the │ │ │ │ │ +1220 // second operand and should not be checked. There are no operations in │ │ │ │ │ +1221 // the standard where the second operand is modified like this, but │ │ │ │ │ +1222 // there are operations where the first operand is modified -- and this │ │ │ │ │ +1223 // check is used for those ops as well by exchanging the first and second │ │ │ │ │ +1224 // argument below. │ │ │ │ │ +1225 │ │ │ │ │ +1226 template │ │ │ │ │ +1227 std::enable_if_t > │ │ │ │ │ +1228 checkBinaryOpVP(MetaType, MetaType, Op op) │ │ │ │ │ +1229 { │ │ │ │ │ +1230 using P2 = decltype(_l_a_n_e(0, std::declval())); │ │ │ │ │ +1231 using T2 = CopyRefQual, V2>; │ │ │ │ │ +1232#define DUNE_SIMD_OPNAME (className()) │ │ │ │ │ +1233 static_assert(std::is_same, Scalar >::value, │ │ │ │ │ +1234 "Internal testsystem error: called with two vector " │ │ │ │ │ +1235 "types whose scalar types don't match."); │ │ │ │ │ +1236 │ │ │ │ │ +1237 // initial values │ │ │ │ │ +1238 auto sinit2 = rightScalar>(); │ │ │ │ │ +1239 │ │ │ │ │ +1240 // reference arguments │ │ │ │ │ +1241 auto vref1 = leftVector>(); │ │ │ │ │ +1242 auto sref2 = sinit2; │ │ │ │ │ +1243 │ │ │ │ │ +1244 // candidate arguments │ │ │ │ │ +1245 auto vop1 = vref1; │ │ │ │ │ +1246 auto vop2 = std::decay_t(Scalar(0)); │ │ │ │ │ +1247 _l_a_n_e(0, vop2) = sref2; // pop2 is just a name for `lane(0, vop2)` │ │ │ │ │ +1248 │ │ │ │ │ +1249 // candidate operation │ │ │ │ │ +1250 auto &&vopres = │ │ │ │ │ +1251 op(static_cast(vop1), _l_a_n_e(0, static_cast(vop2))); │ │ │ │ │ +1252 using VR = decltype(vopres); │ │ │ │ │ +1253 │ │ │ │ │ +1254 // check 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +1255 static_assert(lanes >() == _l_a_n_e_s >(), │ │ │ │ │ +1256 "The result must have the same number of lanes as the " │ │ │ │ │ +1257 "operands."); │ │ │ │ │ +1258 │ │ │ │ │ +1259 // check 4. pop2 is never modified │ │ │ │ │ +1260 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(0, vop2) == sinit2); │ │ │ │ │ +1261 │ │ │ │ │ +1262 // do the reference operation, and simultaneously check 2. and 5. │ │ │ │ │ +1263 using T = _S_c_a_l_a_r; │ │ │ │ │ +1264 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vopres))) │ │ │ │ │ +1265 { │ │ │ │ │ +1266 // check 2. lane(l, vopres) == arefres[l] foreach l │ │ │ │ │ +1267 // see the lengthy comment in `checkUnaryOpV()` as to why the │ │ │ │ │ +1268 // `static_cast` around the `op()` is necessary │ │ │ │ │ +1269 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ +1270 (_l_a_n_e(l, vopres) │ │ │ │ │ +1271 == static_cast(op(_l_a_n_e(l, static_cast(vref1)), │ │ │ │ │ +1272 static_cast(sref2) ))); │ │ │ │ │ +1273 // check 5. sref2 is never modified │ │ │ │ │ +1274 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(sref2 == sinit2); │ │ │ │ │ +1275 } │ │ │ │ │ +1276 │ │ │ │ │ +1277 // check 3. lane(l, vop1) == aref1[l] foreach l │ │ │ │ │ +1278 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vop1))) │ │ │ │ │ +1279 _D_U_N_E___S_I_M_D___C_H_E_C_K___O_P(_l_a_n_e(l, vop1) == _l_a_n_e(l, vref1)); │ │ │ │ │ +1280 │ │ │ │ │ +1281#undef DUNE_SIMD_OPNAME │ │ │ │ │ +1282 } │ │ │ │ │ +1283 │ │ │ │ │ +1284 template │ │ │ │ │ +1285 std::enable_if_t > │ │ │ │ │ +1286 checkBinaryOpVP(MetaType, MetaType, Op op) │ │ │ │ │ +1287 { │ │ │ │ │ +1288 // log_ << "No " │ │ │ │ │ +1289 // << className())), T2)>() │ │ │ │ │ +1290 // << std::endl │ │ │ │ │ +1291 // << " ==> Not checking " << className() << std::endl; │ │ │ │ │ +1292 } │ │ │ │ │ +1293 │ │ │ │ │ +1294 template │ │ │ │ │ +1295 void checkBinaryOpVP(MetaType, MetaType, OpInfixComma) │ │ │ │ │ +1296 { │ │ │ │ │ +1297 // Don't really know how to check comma operator for proxies │ │ │ │ │ +1298 } │ │ │ │ │ +1299 │ │ │ │ │ +1301 // │ │ │ │ │ +1302 // checks for (scalar/proxy)-vector binary operations │ │ │ │ │ +1303 // │ │ │ │ │ +1304 │ │ │ │ │ +1305 template │ │ │ │ │ +1306 struct OpInfixSwappedArgs │ │ │ │ │ +1307 { │ │ │ │ │ +1308 Op orig; │ │ │ │ │ +1309 │ │ │ │ │ +1310 template │ │ │ │ │ +1311 decltype(auto) operator()(V1&& v1, V2&& v2) const │ │ │ │ │ +1312 { │ │ │ │ │ +1313 return orig(std::forward(v2), std::forward(v1)); │ │ │ │ │ +1314 } │ │ │ │ │ +1315 template │ │ │ │ │ +1316 auto scalar(S1&& s1, S2&& s2) const │ │ │ │ │ +1317 -> decltype(orig.scalar(std::forward(s2), std::forward(s1))); │ │ │ │ │ +1318 }; │ │ │ │ │ +1319 │ │ │ │ │ +1320 template │ │ │ │ │ +1321 void checkBinaryOpSV(MetaType t1, MetaType v2, Op op) │ │ │ │ │ +1322 { │ │ │ │ │ +1323 checkBinaryOpVS(v2, t1, OpInfixSwappedArgs{op}); │ │ │ │ │ +1324 } │ │ │ │ │ +1325 │ │ │ │ │ +1326 template │ │ │ │ │ +1327 void checkBinaryOpSV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ +1328 { │ │ │ │ │ +1329 static_assert(std::is_same, │ │ │ │ │ +1330 Scalar > >::value, │ │ │ │ │ +1331 "Internal testsystem error: called with a scalar that " │ │ │ │ │ +1332 "does not match the vector type."); │ │ │ │ │ +1333 │ │ │ │ │ +1334 checkCommaOp(leftScalar>(), │ │ │ │ │ +1335 rightVector>()); │ │ │ │ │ +1336 } │ │ │ │ │ +1337 │ │ │ │ │ +1338 template │ │ │ │ │ +1339 void checkBinaryOpPV(MetaType v1, MetaType v2, Op op) │ │ │ │ │ +1340 { │ │ │ │ │ +1341 checkBinaryOpVP(v2, v1, OpInfixSwappedArgs{op}); │ │ │ │ │ +1342 } │ │ │ │ │ +1343 │ │ │ │ │ +1344 template │ │ │ │ │ +1345 void checkBinaryOpPV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ +1346 { │ │ │ │ │ +1347 // Don't really know how to check comma operator for proxies │ │ │ │ │ +1348 } │ │ │ │ │ +1349 │ │ │ │ │ +1351 // │ │ │ │ │ +1352 // cross-check scalar-vector binary operations against vector-vector │ │ │ │ │ +1353 // │ │ │ │ │ +1354 │ │ │ │ │ +1355 // We check the following candidate operation │ │ │ │ │ +1356 // │ │ │ │ │ +1357 // vopres = vop1 @ vop2, where vop2 = broadcast(sref2) │ │ │ │ │ +1358 // │ │ │ │ │ +1359 // against the reference operation │ │ │ │ │ +1360 // │ │ │ │ │ +1361 // vrefres = vref1 @ sref2 │ │ │ │ │ +1362 // │ │ │ │ │ +1363 // v... variables are simd-vectors, a... variables are arrays, and │ │ │ │ │ +1364 // s... variables are scalars. │ │ │ │ │ +1365 // │ │ │ │ │ +1366 // We could check the following properties │ │ │ │ │ +1367 // 1. lanes(vopres) == lanes(vop1) │ │ │ │ │ +1368 // 2. lane(l, vopres) == lane(l, vrefres) foreach l │ │ │ │ │ +1369 // 3. lane(l, vop1) == lane(l, vref1) foreach l │ │ │ │ │ +1370 // but these are given by checking the operation against the scalar │ │ │ │ │ +1371 // operation in the vector@vector and vector@scalar cases above. │ │ │ │ │ +1372 // │ │ │ │ │ +1373 // The only thing left to check is: │ │ │ │ │ +1374 // 4. lane(l, vop2) foreach l is never modified │ │ │ │ │ +1375 │ │ │ │ │ +1376 template │ │ │ │ │ +1377 void checkBinaryOpVVAgainstSV(MetaType t1, MetaType v2, Op op) │ │ │ │ │ +1378 { │ │ │ │ │ +1379 checkBinaryOpVVAgainstVS(v2, t1, OpInfixSwappedArgs{op}); │ │ │ │ │ +1380 } │ │ │ │ │ +1381 │ │ │ │ │ +1382 template │ │ │ │ │ +1383 void checkBinaryOpVVAgainstSV(MetaType, MetaType, OpInfixComma) │ │ │ │ │ +1384 { } │ │ │ │ │ +1385 │ │ │ │ │ +1387 // │ │ │ │ │ +1388 // Invoke the checks for all combinations │ │ │ │ │ +1389 // │ │ │ │ │ +1390 │ │ │ │ │ +1391 template │ │ │ │ │ +1392 void checkBinaryRefQual(Checker checker) │ │ │ │ │ +1393 { │ │ │ │ │ +1394 if constexpr (condition) { │ │ │ │ │ +1395 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(TypeList{}, [=] (auto t1) { │ │ │ │ │ +1396 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(TypeList{}, [=] (auto t2) { │ │ │ │ │ +1397 checker(t1, t2); │ │ │ │ │ +1398 }); │ │ │ │ │ +1399 }); │ │ │ │ │ +1400 } │ │ │ │ │ +1401 } │ │ │ │ │ +1402 │ │ │ │ │ +1403 template │ │ │ │ │ +1404 void _c_h_e_c_k_B_i_n_a_r_y_O_p_s(Checker checker) │ │ │ │ │ +1405 { │ │ │ │ │ +1406 using Std::bool_constant; │ │ │ │ │ +1407 │ │ │ │ │ +1408 constexpr bool isMask = std::is_same, bool>::value; │ │ │ │ │ +1409 │ │ │ │ │ +1410 constexpr bool do_ = false; │ │ │ │ │ +1411 constexpr bool do_SV = true; │ │ │ │ │ +1412 constexpr bool do_VV = true; │ │ │ │ │ +1413 constexpr bool do_VS = true; │ │ │ │ │ +1414 │ │ │ │ │ +1415#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME) \ │ │ │ │ │ +1416 checker(bool_constant{}, \ │ │ │ │ │ +1417 bool_constant{}, \ │ │ │ │ │ +1418 bool_constant{}, \ │ │ │ │ │ +1419 Op##NAME{}) │ │ │ │ │ +1420 │ │ │ │ │ +1421 // (Mask , Vector , Name ); │ │ │ │ │ +1422 │ │ │ │ │ +1423 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixMul ); │ │ │ │ │ +1424 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixDiv ); │ │ │ │ │ +1425 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixRemainder ); │ │ │ │ │ +1426 │ │ │ │ │ +1427 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixPlus ); │ │ │ │ │ +1428 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixMinus ); │ │ │ │ │ +1429 │ │ │ │ │ +1430 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixLeftShift ); │ │ │ │ │ +1431 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixRightShift ); │ │ │ │ │ +1432 │ │ │ │ │ +1433 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixLess ); │ │ │ │ │ +1434 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixGreater ); │ │ │ │ │ +1435 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixLessEqual ); │ │ │ │ │ +1436 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixGreaterEqual ); │ │ │ │ │ +1437 │ │ │ │ │ +1438 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixEqual ); │ │ │ │ │ +1439 _D_U_N_E___S_I_M_D___D_O( , , , SV, VV, VS, InfixNotEqual ); │ │ │ │ │ +1440 │ │ │ │ │ +1441 _D_U_N_E___S_I_M_D___D_O( , VV, , SV, VV, VS, InfixBitAnd ); │ │ │ │ │ +1442 _D_U_N_E___S_I_M_D___D_O( , VV, , SV, VV, VS, InfixBitXor ); │ │ │ │ │ +1443 _D_U_N_E___S_I_M_D___D_O( , VV, , SV, VV, VS, InfixBitOr ); │ │ │ │ │ +1444 │ │ │ │ │ +1445 _D_U_N_E___S_I_M_D___D_O(SV, VV, VS, SV, VV, VS, InfixLogicAnd ); │ │ │ │ │ +1446 _D_U_N_E___S_I_M_D___D_O(SV, VV, VS, SV, VV, VS, InfixLogicOr ); │ │ │ │ │ +1447 │ │ │ │ │ +1448 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssign ); │ │ │ │ │ +1449 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignMul ); │ │ │ │ │ +1450 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignDiv ); │ │ │ │ │ +1451 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignRemainder ); │ │ │ │ │ +1452 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignPlus ); │ │ │ │ │ +1453 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignMinus ); │ │ │ │ │ +1454 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignLeftShift ); │ │ │ │ │ +1455 _D_U_N_E___S_I_M_D___D_O( , , , , VV, VS, InfixAssignRightShift); │ │ │ │ │ +1456 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssignAnd ); │ │ │ │ │ +1457 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssignXor ); │ │ │ │ │ +1458 _D_U_N_E___S_I_M_D___D_O( , VV, , , VV, VS, InfixAssignOr ); │ │ │ │ │ +1459 │ │ │ │ │ +1460 _D_U_N_E___S_I_M_D___D_O(SV, VV, VS, SV, , VS, InfixComma ); │ │ │ │ │ +1461 │ │ │ │ │ +1462#undef DUNE_SIMD_DO │ │ │ │ │ +1463 } │ │ │ │ │ +1464 │ │ │ │ │ +1466 // │ │ │ │ │ +1467 // SIMD interface functions │ │ │ │ │ +1468 // │ │ │ │ │ +1469 │ │ │ │ │ +1470 template │ │ │ │ │ +1471 void checkAutoCopy() │ │ │ │ │ +1472 { │ │ │ │ │ +1473 using RValueResult = decltype(_a_u_t_o_C_o_p_y(_l_a_n_e(0, std::declval()))); │ │ │ │ │ +1474 static_assert(std::is_same >::value, │ │ │ │ │ +1475 "Result of autoCopy() must always be Scalar"); │ │ │ │ │ +1476 │ │ │ │ │ +1477 using MutableLValueResult = │ │ │ │ │ +1478 decltype(_a_u_t_o_C_o_p_y(_l_a_n_e(0, std::declval()))); │ │ │ │ │ +1479 static_assert(std::is_same >::value, │ │ │ │ │ +1480 "Result of autoCopy() must always be Scalar"); │ │ │ │ │ +1481 │ │ │ │ │ +1482 using ConstLValueResult = │ │ │ │ │ +1483 decltype(_a_u_t_o_C_o_p_y(_l_a_n_e(0, std::declval()))); │ │ │ │ │ +1484 static_assert(std::is_same >::value, │ │ │ │ │ +1485 "Result of autoCopy() must always be Scalar"); │ │ │ │ │ +1486 │ │ │ │ │ +1487 V vec = make123(); │ │ │ │ │ +1488 for(std::size_t l = 0; l < _l_a_n_e_s(vec); ++l) │ │ │ │ │ +1489 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_u_t_o_C_o_p_y(_l_a_n_e(l, vec)) == Scalar(l+1)); │ │ │ │ │ +1490 } │ │ │ │ │ +1491 │ │ │ │ │ +1492 // may only be called for mask types │ │ │ │ │ +1493 template │ │ │ │ │ +1494 void checkBoolReductions() │ │ │ │ │ +1495 { │ │ │ │ │ +1496 M trueVec(true); │ │ │ │ │ +1497 │ │ │ │ │ +1498 // mutable lvalue │ │ │ │ │ +1499 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ +1500 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ +1501 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ +1502 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ +1503 │ │ │ │ │ +1504 // const lvalue │ │ │ │ │ +1505 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ +1506 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(trueVec)) == true); │ │ │ │ │ +1507 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ +1508 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(trueVec)) == false); │ │ │ │ │ +1509 │ │ │ │ │ +1510 // rvalue │ │ │ │ │ +1511 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (M(true)) == true); │ │ │ │ │ +1512 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (M(true)) == true); │ │ │ │ │ +1513 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(M(true)) == false); │ │ │ │ │ +1514 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(M(true)) == false); │ │ │ │ │ +1515 │ │ │ │ │ +1516 M falseVec(false); │ │ │ │ │ +1517 │ │ │ │ │ +1518 // mutable lvalue │ │ │ │ │ +1519 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ +1520 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ +1521 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ +1522 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ +1523 │ │ │ │ │ +1524 // const lvalue │ │ │ │ │ +1525 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ +1526 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (static_cast(falseVec)) == false); │ │ │ │ │ +1527 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ +1528 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(static_cast(falseVec)) == true); │ │ │ │ │ +1529 │ │ │ │ │ +1530 // rvalue │ │ │ │ │ +1531 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (M(false)) == false); │ │ │ │ │ +1532 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (M(false)) == false); │ │ │ │ │ +1533 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(M(false)) == true); │ │ │ │ │ +1534 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(M(false)) == true); │ │ │ │ │ +1535 │ │ │ │ │ +1536 auto mixedVec = broadcast(0); │ │ │ │ │ +1537 for(std::size_t l = 0; l < _l_a_n_e_s(mixedVec); ++l) │ │ │ │ │ +1538 _l_a_n_e(l, mixedVec) = (l % 2); │ │ │ │ │ +1539 │ │ │ │ │ +1540 // mutable lvalue │ │ │ │ │ +1541 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1542 (_a_l_l_T_r_u_e (static_cast(mixedVec)) == false); │ │ │ │ │ +1543 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1544 (_a_n_y_T_r_u_e (static_cast(mixedVec)) == (lanes() > 1)); │ │ │ │ │ +1545 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1546 (_a_l_l_F_a_l_s_e(static_cast(mixedVec)) == (lanes() == 1)); │ │ │ │ │ +1547 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1548 (_a_n_y_F_a_l_s_e(static_cast(mixedVec)) == true); │ │ │ │ │ +1549 │ │ │ │ │ +1550 // const lvalue │ │ │ │ │ +1551 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1552 (_a_l_l_T_r_u_e (static_cast(mixedVec)) == false); │ │ │ │ │ +1553 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1554 (_a_n_y_T_r_u_e (static_cast(mixedVec)) == (lanes() > 1)); │ │ │ │ │ +1555 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1556 (_a_l_l_F_a_l_s_e(static_cast(mixedVec)) == (lanes() == 1)); │ │ │ │ │ +1557 _D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +1558 (_a_n_y_F_a_l_s_e(static_cast(mixedVec)) == true); │ │ │ │ │ +1559 │ │ │ │ │ +1560 // rvalue │ │ │ │ │ +1561 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e (M(mixedVec)) == false); │ │ │ │ │ +1562 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_T_r_u_e (M(mixedVec)) == (lanes() > 1)); │ │ │ │ │ +1563 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_F_a_l_s_e(M(mixedVec)) == (lanes() == 1)); │ │ │ │ │ +1564 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_n_y_F_a_l_s_e(M(mixedVec)) == true); │ │ │ │ │ +1565 } │ │ │ │ │ +1566 │ │ │ │ │ +1567 template │ │ │ │ │ +1568 void checkCond() │ │ │ │ │ +1569 { │ │ │ │ │ +1570 using M = Mask; │ │ │ │ │ +1571 │ │ │ │ │ +1572 static_assert │ │ │ │ │ +1573 (std::is_same(), std::declval(), │ │ │ │ │ +1574 std::declval())), V>::value, │ │ │ │ │ +1575 "The result of cond(M, V, V) should have exactly the type V"); │ │ │ │ │ +1576 │ │ │ │ │ +1577 static_assert │ │ │ │ │ +1578 (std::is_same(), │ │ │ │ │ +1579 std::declval(), │ │ │ │ │ +1580 std::declval())), V>::value, │ │ │ │ │ +1581 "The result of cond(const M&, const V&, const V&) should have " │ │ │ │ │ +1582 "exactly the type V"); │ │ │ │ │ +1583 │ │ │ │ │ +1584 static_assert │ │ │ │ │ +1585 (std::is_same(), std::declval(), │ │ │ │ │ +1586 std::declval())), V>::value, │ │ │ │ │ +1587 "The result of cond(M&, V&, V&) should have exactly the type V"); │ │ │ │ │ +1588 │ │ │ │ │ +1589 V vec1 = leftVector(); │ │ │ │ │ +1590 V vec2 = rightVector(); │ │ │ │ │ +1591 │ │ │ │ │ +1592 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(M(true), vec1, vec2) == vec1)); │ │ │ │ │ +1593 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(M(false), vec1, vec2) == vec2)); │ │ │ │ │ +1594 │ │ │ │ │ +1595 auto mixedResult = broadcast(0); │ │ │ │ │ +1596 auto mixedMask = broadcast(false); │ │ │ │ │ +1597 for(std::size_t l = 0; l < _l_a_n_e_s(mixedMask); ++l) │ │ │ │ │ +1598 { │ │ │ │ │ +1599 _l_a_n_e(l, mixedMask ) = (l % 2); │ │ │ │ │ +1600 _l_a_n_e(l, mixedResult) = _l_a_n_e(l, (l % 2) ? vec1 : vec2); │ │ │ │ │ +1601 } │ │ │ │ │ +1602 │ │ │ │ │ +1603 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(mixedMask, vec1, vec2) == mixedResult)); │ │ │ │ │ +1604 } │ │ │ │ │ +1605 │ │ │ │ │ +1606 template │ │ │ │ │ +1607 void checkBoolCond() │ │ │ │ │ +1608 { │ │ │ │ │ +1609 static_assert │ │ │ │ │ +1610 (std::is_same(), std::declval(), │ │ │ │ │ +1611 std::declval())), V>::value, │ │ │ │ │ +1612 "The result of cond(bool, V, V) should have exactly the type V"); │ │ │ │ │ +1613 │ │ │ │ │ +1614 static_assert │ │ │ │ │ +1615 (std::is_same(), │ │ │ │ │ +1616 std::declval(), │ │ │ │ │ +1617 std::declval())), V>::value, │ │ │ │ │ +1618 "The result of cond(const bool&, const V&, const V&) should have " │ │ │ │ │ +1619 "exactly the type V"); │ │ │ │ │ +1620 │ │ │ │ │ +1621 static_assert │ │ │ │ │ +1622 (std::is_same(), │ │ │ │ │ +1623 std::declval(), │ │ │ │ │ +1624 std::declval())), V>::value, │ │ │ │ │ +1625 "The result of cond(bool&, V&, V&) should have exactly the type V"); │ │ │ │ │ +1626 │ │ │ │ │ +1627 V vec1 = leftVector(); │ │ │ │ │ +1628 V vec2 = rightVector(); │ │ │ │ │ +1629 │ │ │ │ │ +1630 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(true, vec1, vec2) == vec1)); │ │ │ │ │ +1631 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(_c_o_n_d(false, vec1, vec2) == vec2)); │ │ │ │ │ +1632 } │ │ │ │ │ +1633 │ │ │ │ │ +1634 template │ │ │ │ │ +1635 std::enable_if_t >::value> │ │ │ │ │ +1636 checkHorizontalMinMax() {} │ │ │ │ │ +1637 │ │ │ │ │ +1638 template │ │ │ │ │ +1639 std::enable_if_t >::value> │ │ │ │ │ +1640 checkHorizontalMinMax() │ │ │ │ │ +1641 { │ │ │ │ │ +1642 static_assert │ │ │ │ │ +1643 (std::is_same())), Scalar >::value, │ │ │ │ │ +1644 "The result of max(V) should be exactly Scalar"); │ │ │ │ │ +1645 │ │ │ │ │ +1646 static_assert │ │ │ │ │ +1647 (std::is_same())), Scalar >::value, │ │ │ │ │ +1648 "The result of min(V) should be exactly Scalar"); │ │ │ │ │ +1649 │ │ │ │ │ +1650 static_assert │ │ │ │ │ +1651 (std::is_same())), Scalar >::value, │ │ │ │ │ +1652 "The result of max(V) should be exactly Scalar"); │ │ │ │ │ +1653 │ │ │ │ │ +1654 static_assert │ │ │ │ │ +1655 (std::is_same())), Scalar >::value, │ │ │ │ │ +1656 "The result of min(V) should be exactly Scalar"); │ │ │ │ │ +1657 │ │ │ │ │ +1658 const V vec1 = leftVector(); │ │ │ │ │ +1659 │ │ │ │ │ +1660 _D_U_N_E___S_I_M_D___C_H_E_C_K(_m_a_x(vec1) == Scalar(_l_a_n_e_s(vec1))); │ │ │ │ │ +1661 _D_U_N_E___S_I_M_D___C_H_E_C_K(_m_i_n(vec1) == Scalar(1)); │ │ │ │ │ +1662 } │ │ │ │ │ +1663 │ │ │ │ │ +1664 template │ │ │ │ │ +1665 std::enable_if_t >::value> │ │ │ │ │ +1666 checkBinaryMinMax() {} │ │ │ │ │ +1667 │ │ │ │ │ +1668 template │ │ │ │ │ +1669 std::enable_if_t >::value> │ │ │ │ │ +1670 checkBinaryMinMax() │ │ │ │ │ +1671 { │ │ │ │ │ +1672 using std::max; │ │ │ │ │ +1673 using std::min; │ │ │ │ │ +1674 │ │ │ │ │ +1675 static_assert │ │ │ │ │ +1676 (std::is_same(), │ │ │ │ │ +1677 std::declval())), V>::value, │ │ │ │ │ +1678 "The result of Simd::max(V, V) should be exactly V"); │ │ │ │ │ +1679 static_assert │ │ │ │ │ +1680 (std::is_same(), │ │ │ │ │ +1681 std::declval())), V>::value, │ │ │ │ │ +1682 "The result of Simd::min(V, V) should be exactly V"); │ │ │ │ │ +1683 │ │ │ │ │ +1684 static_assert │ │ │ │ │ +1685 (std::is_same(), │ │ │ │ │ +1686 std::declval())), V>::value, │ │ │ │ │ +1687 "The result of Simd::max(V&, V&) should be exactly V"); │ │ │ │ │ +1688 static_assert │ │ │ │ │ +1689 (std::is_same(), │ │ │ │ │ +1690 std::declval())), V>::value, │ │ │ │ │ +1691 "The result of Simd::min(V&, V&) should be exactly V"); │ │ │ │ │ +1692 │ │ │ │ │ +1693 const V arg1 = leftVector(); │ │ │ │ │ +1694 const V arg2 = rightVector(); │ │ │ │ │ +1695 │ │ │ │ │ +1696 V maxExp(Scalar(0)), minExp(Scalar(0)); │ │ │ │ │ +1697 for(auto l : _r_a_n_g_e(_l_a_n_e_s())) │ │ │ │ │ +1698 { │ │ │ │ │ +1699 _l_a_n_e(l, maxExp) = _m_a_x(_l_a_n_e(l, arg1), _l_a_n_e(l, arg2)); │ │ │ │ │ +1700 _l_a_n_e(l, minExp) = _m_i_n(_l_a_n_e(l, arg1), _l_a_n_e(l, arg2)); │ │ │ │ │ +1701 } │ │ │ │ │ +1702 │ │ │ │ │ +1703 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(maxExp == _S_i_m_d_:_:_m_a_x(arg1, arg2))); │ │ │ │ │ +1704 _D_U_N_E___S_I_M_D___C_H_E_C_K(_a_l_l_T_r_u_e(minExp == _S_i_m_d_:_:_m_i_n(arg1, arg2))); │ │ │ │ │ +1705 } │ │ │ │ │ +1706 │ │ │ │ │ +1707 template │ │ │ │ │ +1708 void checkIO() │ │ │ │ │ +1709 { │ │ │ │ │ +1710 const V vec1 = leftVector(); │ │ │ │ │ +1711 │ │ │ │ │ +1712 std::string reference; │ │ │ │ │ +1713 { │ │ │ │ │ +1714 const char *sep = ""; │ │ │ │ │ +1715 for(auto l : _r_a_n_g_e(_l_a_n_e_s(vec1))) │ │ │ │ │ +1716 { │ │ │ │ │ +1717 std::ostringstream stream; │ │ │ │ │ +1718 stream << _l_a_n_e(l, vec1); │ │ │ │ │ +1719 │ │ │ │ │ +1720 reference += sep; │ │ │ │ │ +1721 reference += stream.str(); │ │ │ │ │ +1722 sep = ", "; │ │ │ │ │ +1723 } │ │ │ │ │ +1724 } │ │ │ │ │ +1725 │ │ │ │ │ +1726 { │ │ │ │ │ +1727 std::ostringstream stream; │ │ │ │ │ +1728 stream << _i_o(vec1); │ │ │ │ │ +1729 if(_l_a_n_e_s(vec1) == 1) │ │ │ │ │ +1730 _D_U_N_E___S_I_M_D___C_H_E_C_K(stream.str() == reference); │ │ │ │ │ +1731 else │ │ │ │ │ +1732 _D_U_N_E___S_I_M_D___C_H_E_C_K(stream.str() == "<" + reference + ">"); │ │ │ │ │ +1733 } │ │ │ │ │ +1734 │ │ │ │ │ +1735 { │ │ │ │ │ +1736 std::ostringstream stream; │ │ │ │ │ +1737 stream << _v_i_o(vec1); │ │ │ │ │ +1738 _D_U_N_E___S_I_M_D___C_H_E_C_K(stream.str() == "<" + reference + ">"); │ │ │ │ │ +1739 } │ │ │ │ │ +1740 } │ │ │ │ │ +1741 │ │ │ │ │ +1742#undef DUNE_SIMD_CHECK │ │ │ │ │ +1743 │ │ │ │ │ +1744 public: │ │ │ │ │ +1807 template void _c_h_e_c_k_T_y_p_e(); │ │ │ │ │ +1808 template void _c_h_e_c_k_N_o_n_O_p_s(); │ │ │ │ │ +1809 template void _c_h_e_c_k_U_n_a_r_y_O_p_s(); │ │ │ │ │ +1810 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s(); │ │ │ │ │ +1811 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_V_e_c_t_o_r(); │ │ │ │ │ +1812 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_S_c_a_l_a_r_V_e_c_t_o_r(); │ │ │ │ │ +1813 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_S_c_a_l_a_r(); │ │ │ │ │ +1814 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_P_r_o_x_y_V_e_c_t_o_r(); │ │ │ │ │ +1815 template void _c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_P_r_o_x_y(); │ │ │ │ │ +1819 │ │ │ │ │ +1836 template class RebindPrune = _I_s_L_o_o_p, │ │ │ │ │ +1838 template class RebindAccept = _D_u_n_e_:_:_A_l_w_a_y_s_T_r_u_e> │ │ │ │ │ +_1_8_3_9 void _c_h_e_c_k() { │ │ │ │ │ +1840 // check whether the test for this type already started │ │ │ │ │ +1841 if(seen_.emplace(typeid (V)).second == false) │ │ │ │ │ +1842 { │ │ │ │ │ +1843 // type already seen, nothing to do │ │ │ │ │ +1844 return; │ │ │ │ │ +1845 } │ │ │ │ │ +1846 │ │ │ │ │ +1847 // do these first so everything that appears after "Checking SIMD type │ │ │ │ │ +1848 // ..." really pertains to that type │ │ │ │ │ +1849 auto recurse = [this](auto w) { │ │ │ │ │ +1850 using W = typename decltype(w)::type; │ │ │ │ │ +1851 this->template check(); │ │ │ │ │ +1852 }; │ │ │ │ │ +1853 checkRebindOf(recurse); │ │ │ │ │ +1854 │ │ │ │ │ +1855 checkType(); │ │ │ │ │ +1856 } │ │ │ │ │ +1857 │ │ │ │ │ +_1_8_5_9 bool _g_o_o_d() const │ │ │ │ │ +1860 { │ │ │ │ │ +1861 return good_; │ │ │ │ │ +1862 } │ │ │ │ │ +1863 │ │ │ │ │ +1864 }; // class UnitTest │ │ │ │ │ +1865 │ │ │ │ │ +_1_8_6_6 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_T_y_p_e() │ │ │ │ │ +1867 { │ │ │ │ │ +1868 static_assert(std::is_same >::value, "Simd types " │ │ │ │ │ +1869 "must not be references, and must not include " │ │ │ │ │ +1870 "cv-qualifiers"); │ │ │ │ │ +1871 │ │ │ │ │ +1872 log_ << "Checking SIMD type " << className() << std::endl; │ │ │ │ │ +1873 │ │ │ │ │ +1874 checkNonOps(); │ │ │ │ │ +1875 checkUnaryOps(); │ │ │ │ │ +1876 checkBinaryOps(); │ │ │ │ │ +1877 } │ │ │ │ │ +_1_8_7_8 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_N_o_n_O_p_s() │ │ │ │ │ +1879 { │ │ │ │ │ +1880 constexpr auto isMask = typename std::is_same, bool>::type{}; │ │ │ │ │ +1881 │ │ │ │ │ +1882 checkLanes(); │ │ │ │ │ +1883 checkScalar(); │ │ │ │ │ +1884 │ │ │ │ │ +1885 checkDefaultConstruct(); │ │ │ │ │ +1886 checkLane(); │ │ │ │ │ +1887 checkCopyMoveConstruct(); │ │ │ │ │ +1888 checkImplCast(); │ │ │ │ │ +1889 checkBroadcast(); │ │ │ │ │ +1890 if constexpr (isMask) │ │ │ │ │ +1891 this->template checkBroadcastMaskConstruct(); │ │ │ │ │ +1892 else │ │ │ │ │ +1893 this->template checkBroadcastVectorConstruct(); │ │ │ │ │ +1894 checkBracedAssign(); │ │ │ │ │ +1895 checkBracedBroadcastAssign(); │ │ │ │ │ +1896 │ │ │ │ │ +1897 checkAutoCopy(); │ │ │ │ │ +1898 checkCond(); │ │ │ │ │ +1899 checkBoolCond(); │ │ │ │ │ +1900 │ │ │ │ │ +1901 if constexpr (isMask) │ │ │ │ │ +1902 this->template checkBoolReductions(); │ │ │ │ │ +1903 // checkBoolReductions() is not applicable for non-masks │ │ │ │ │ +1904 │ │ │ │ │ +1905 checkHorizontalMinMax(); │ │ │ │ │ +1906 checkBinaryMinMax(); │ │ │ │ │ +1907 checkIO(); │ │ │ │ │ +1908 } │ │ │ │ │ +_1_9_0_9 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_U_n_a_r_y_O_p_s() │ │ │ │ │ +1910 { │ │ │ │ │ +1911 if constexpr (std::is_same_v, bool>) { │ │ │ │ │ +1912 // check mask │ │ │ │ │ +1913 auto _c_h_e_c_k = [this](auto op) { │ │ │ │ │ +1914 this->template checkUnaryOpsV(op); │ │ │ │ │ +1915 }; │ │ │ │ │ +1916 │ │ │ │ │ +1917 // postfix │ │ │ │ │ +1918 // check(OpPostfixDecrement{}); │ │ │ │ │ +1919 // clang deprecation warning if bool++ is tested │ │ │ │ │ +1920 // check(OpPostfixIncrement{}); │ │ │ │ │ +1921 │ │ │ │ │ +1922 // prefix │ │ │ │ │ +1923 // check(OpPrefixDecrement{}); │ │ │ │ │ +1924 // clang deprecation warning if ++bool is tested │ │ │ │ │ +1925 // check(OpPrefixIncrement{}); │ │ │ │ │ +1926 │ │ │ │ │ +1927 // check(OpPrefixPlus{}); │ │ │ │ │ +1928 // check(OpPrefixMinus{}); │ │ │ │ │ +1929 _c_h_e_c_k(OpPrefixLogicNot{}); │ │ │ │ │ +1930 // check(OpPrefixBitNot{}); │ │ │ │ │ +1931 } │ │ │ │ │ +1932 else { │ │ │ │ │ +1933 // check vector │ │ │ │ │ +1934 auto _c_h_e_c_k = [this](auto op) { │ │ │ │ │ +1935 this->template checkUnaryOpsV(op); │ │ │ │ │ +1936 }; │ │ │ │ │ +1937 │ │ │ │ │ +1938 // postfix │ │ │ │ │ +1939 // check(OpPostfixDecrement{}); │ │ │ │ │ +1940 // check(OpPostfixIncrement{}); │ │ │ │ │ +1941 │ │ │ │ │ +1942 // prefix │ │ │ │ │ +1943 // check(OpPrefixDecrement{}); │ │ │ │ │ +1944 // check(OpPrefixIncrement{}); │ │ │ │ │ +1945 │ │ │ │ │ +1946 // check(OpPrefixPlus{}); │ │ │ │ │ +1947 _c_h_e_c_k(OpPrefixMinus{}); │ │ │ │ │ +1948 _c_h_e_c_k(OpPrefixLogicNot{}); │ │ │ │ │ +1949 _c_h_e_c_k(OpPrefixBitNot{}); │ │ │ │ │ +1950 } │ │ │ │ │ +1951 } │ │ │ │ │ +_1_9_5_2 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s() │ │ │ │ │ +1953 { │ │ │ │ │ +1954 checkBinaryOpsVectorVector(); │ │ │ │ │ +1955 checkBinaryOpsScalarVector(); │ │ │ │ │ +1956 checkBinaryOpsVectorScalar(); │ │ │ │ │ +1957 checkBinaryOpsProxyVector(); │ │ │ │ │ +1958 checkBinaryOpsVectorProxy(); │ │ │ │ │ +1959 } │ │ │ │ │ +_1_9_6_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_V_e_c_t_o_r() │ │ │ │ │ +1961 { │ │ │ │ │ +1962 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ +1963 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ +1964 this->checkBinaryOpVV(t1, t2, op); │ │ │ │ │ +1965 }; │ │ │ │ │ +1966 this->checkBinaryRefQual(_c_h_e_c_k); │ │ │ │ │ +1967 }; │ │ │ │ │ +1968 checkBinaryOps(checker); │ │ │ │ │ +1969 } │ │ │ │ │ +_1_9_7_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_S_c_a_l_a_r_V_e_c_t_o_r() │ │ │ │ │ +1971 { │ │ │ │ │ +1972 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ +1973 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ +1974 this->checkBinaryOpSV(t1, t2, op); │ │ │ │ │ +1975 }; │ │ │ │ │ +1976 this->checkBinaryRefQual, V, doSV>(_c_h_e_c_k); │ │ │ │ │ +1977 │ │ │ │ │ +1978 auto crossCheck = [this,op](auto t1, auto t2) { │ │ │ │ │ +1979 this->checkBinaryOpVVAgainstSV(t1, t2, op); │ │ │ │ │ +1980 }; │ │ │ │ │ +1981 this->checkBinaryRefQual, V, doSV && doVV>(crossCheck); │ │ │ │ │ +1982 }; │ │ │ │ │ +1983 checkBinaryOps(checker); │ │ │ │ │ +1984 } │ │ │ │ │ +_1_9_8_5 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_S_c_a_l_a_r() │ │ │ │ │ +1986 { │ │ │ │ │ +1987 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ +1988 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ +1989 this->checkBinaryOpVS(t1, t2, op); │ │ │ │ │ +1990 }; │ │ │ │ │ +1991 this->checkBinaryRefQual, doVS>(_c_h_e_c_k); │ │ │ │ │ +1992 │ │ │ │ │ +1993 auto crossCheck = [this,op](auto t1, auto t2) { │ │ │ │ │ +1994 this->checkBinaryOpVVAgainstVS(t1, t2, op); │ │ │ │ │ +1995 }; │ │ │ │ │ +1996 this->checkBinaryRefQual, doVV && doVS>(crossCheck); │ │ │ │ │ +1997 }; │ │ │ │ │ +1998 checkBinaryOps(checker); │ │ │ │ │ +1999 } │ │ │ │ │ +_2_0_0_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_P_r_o_x_y_V_e_c_t_o_r() │ │ │ │ │ +2001 { │ │ │ │ │ +2002 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ +2003 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ +2004 this->checkBinaryOpPV(t1, t2, op); │ │ │ │ │ +2005 }; │ │ │ │ │ +2006 this->checkBinaryRefQual(_c_h_e_c_k); │ │ │ │ │ +2007 }; │ │ │ │ │ +2008 checkBinaryOps(checker); │ │ │ │ │ +2009 } │ │ │ │ │ +_2_0_1_0 template void _U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_P_r_o_x_y() │ │ │ │ │ +2011 { │ │ │ │ │ +2012 auto checker = [this](auto doSV, auto doVV, auto doVS, auto op) { │ │ │ │ │ +2013 auto _c_h_e_c_k = [this,op](auto t1, auto t2) { │ │ │ │ │ +2014 this->checkBinaryOpVP(t1, t2, op); │ │ │ │ │ +2015 }; │ │ │ │ │ +2016 this->checkBinaryRefQual(_c_h_e_c_k); │ │ │ │ │ +2017 }; │ │ │ │ │ +2018 checkBinaryOps(checker); │ │ │ │ │ +2019 } │ │ │ │ │ +2020 │ │ │ │ │ +2021 } // namespace Simd │ │ │ │ │ +2022} // namespace Dune │ │ │ │ │ +2023 │ │ │ │ │ +2024#endif // DUNE_COMMON_SIMD_TEST_HH │ │ │ │ │ +_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +Utilities for reduction like operations on ranges. │ │ │ │ │ +_c_l_a_s_s_n_a_m_e_._h_h │ │ │ │ │ +A free function to provide the demangled class name of a given object or type │ │ │ │ │ +as a string. │ │ │ │ │ +_l_o_o_p_._h_h │ │ │ │ │ +_D_U_N_E___S_I_M_D___P_O_S_T_F_I_X___O_P │ │ │ │ │ +#define DUNE_SIMD_POSTFIX_OP(NAME, SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn test.hh:670 │ │ │ │ │ +_D_U_N_E___S_I_M_D___I_N_F_I_X___O_P │ │ │ │ │ +#define DUNE_SIMD_INFIX_OP(NAME, SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn test.hh:784 │ │ │ │ │ +_D_U_N_E___S_I_M_D___C_H_E_C_K___O_P │ │ │ │ │ +#define DUNE_SIMD_CHECK_OP(expr) │ │ │ │ │ +DDeeffiinniittiioonn test.hh:191 │ │ │ │ │ +_D_U_N_E___S_I_M_D___C_H_E_C_K │ │ │ │ │ +#define DUNE_SIMD_CHECK(expr) │ │ │ │ │ +DDeeffiinniittiioonn test.hh:186 │ │ │ │ │ +_D_U_N_E___S_I_M_D___R_E_P_L___O_P │ │ │ │ │ +#define DUNE_SIMD_REPL_OP(NAME, REPLFN, SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn test.hh:818 │ │ │ │ │ +_D_U_N_E___S_I_M_D___A_S_S_I_G_N___O_P │ │ │ │ │ +#define DUNE_SIMD_ASSIGN_OP(NAME, SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn test.hh:805 │ │ │ │ │ +_D_U_N_E___S_I_M_D___P_R_E_F_I_X___O_P │ │ │ │ │ +#define DUNE_SIMD_PREFIX_OP(NAME, SYMBOL) │ │ │ │ │ +DDeeffiinniittiioonn test.hh:681 │ │ │ │ │ +_D_U_N_E___S_I_M_D___D_O │ │ │ │ │ +#define DUNE_SIMD_DO(M1, M2, M3, V1, V2, V3, NAME) │ │ │ │ │ +_i_o_._h_h │ │ │ │ │ +IO interface of the SIMD abstraction. │ │ │ │ │ +_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ +_h_y_b_r_i_d_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +_t_y_p_e_l_i_s_t_._h_h │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ +static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ +>, std::integral_constant< T, to >) noexcept │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_T_y_p_e_L_i_s_t │ │ │ │ │ +std::tuple< MetaType< T >... > TypeList │ │ │ │ │ +A simple type list. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_f_o_r_E_a_c_h │ │ │ │ │ +constexpr void forEach(Range &&range, F &&f) │ │ │ │ │ +Range based for loop. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:268 │ │ │ │ │ +_D_u_n_e_:_:_a_u_t_o_C_o_p_y │ │ │ │ │ +constexpr AutonomousValue< T > autoCopy(T &&v) │ │ │ │ │ +Autonomous copy of an expression's value for use in auto type deduction. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:642 │ │ │ │ │ +_D_u_n_e_:_:_v_o_i_d___t │ │ │ │ │ +typename Impl::voider< Types... >::type void_t │ │ │ │ │ +Is void for all valid input types. The workhorse for C++11 SFINAE-techniques. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(const Mask &mask) │ │ │ │ │ +Whether any entry is true │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:429 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_m_a_s_k_O_r │ │ │ │ │ +auto maskOr(const V1 &v1, const V2 &v2) │ │ │ │ │ +Logic or of masks. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:499 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_c_o_n_d │ │ │ │ │ +V cond(M &&mask, const V &ifTrue, const V &ifFalse) │ │ │ │ │ +Like the ?: operator. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:386 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_i_o │ │ │ │ │ +auto io(const V &v) │ │ │ │ │ +construct a stream inserter │ │ │ │ │ +DDeeffiinniittiioonn io.hh:106 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_l_l_T_r_u_e │ │ │ │ │ +bool allTrue(const Mask &mask) │ │ │ │ │ +Whether all entries are true │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:439 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_v_i_o │ │ │ │ │ +auto vio(const V &v) │ │ │ │ │ +construct a stream inserter │ │ │ │ │ +DDeeffiinniittiioonn io.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_m_a_x │ │ │ │ │ +auto max(const V &v1, const V &v2) │ │ │ │ │ +The binary maximum value over two simd objects. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:409 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ +bool anyFalse(const Mask &mask) │ │ │ │ │ +Whether any entry is false │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ +constexpr std::size_t lanes() │ │ │ │ │ +Number of lanes in a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ +decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ +Extract an element of a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ +bool allFalse(const Mask &mask) │ │ │ │ │ +Whether all entries are false │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:459 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_m_a_s_k_A_n_d │ │ │ │ │ +auto maskAnd(const V1 &v1, const V2 &v2) │ │ │ │ │ +Logic and of masks. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:509 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ +typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ +Element type of some SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_m_i_n │ │ │ │ │ +auto min(const V &v1, const V &v2) │ │ │ │ │ +The binary minimum value over two simd objects. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:419 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_p_u_t │ │ │ │ │ -void put(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key │ │ │ │ │ -&key, const Value &value) │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ │ -Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const │ │ │ │ │ -Key &key) │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -PM::ValueType ValueType │ │ │ │ │ -The type of the values of the property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -PM::Category Category │ │ │ │ │ -The category the property map belongs to. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -PM::Reference Reference │ │ │ │ │ -The type of the reference to the values. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_:_:_K_e_y_T_y_p_e │ │ │ │ │ -PM::KeyType KeyType │ │ │ │ │ -The type of the key of the property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:21 │ │ │ │ │ -_D_u_n_e_:_:_R_e_a_d_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -Tag for the category of readable property maps. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_W_r_i_t_a_b_l_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -Tag for the category of writable property maps. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:42 │ │ │ │ │ -_D_u_n_e_:_:_R_e_a_d_W_r_i_t_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -Tag for the category of readable and writable property maps. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_L_v_a_l_u_e_P_r_o_p_e_r_t_y_M_a_p_T_a_g │ │ │ │ │ -Tag for the category of lvalue property maps. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _T_ _*_ _>_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -ValueType & Reference │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _T_ _*_ _>_:_:_K_e_y_T_y_p_e │ │ │ │ │ -std::ptrdiff_t KeyType │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _T_ _*_ _>_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -T ValueType │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:62 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _T_ _*_ _>_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -LvaluePropertyMapTag Category │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _*_ _>_:_:_K_e_y_T_y_p_e │ │ │ │ │ -std::ptrdiff_t KeyType │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _*_ _>_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -const ValueType & Reference │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _*_ _>_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -T ValueType │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _*_ _>_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -LvaluePropertyMapTag Category │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_R_A_P_r_o_p_e_r_t_y_M_a_p_H_e_l_p_e_r │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -Adapter to turn a random access iterator into a property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:108 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_K_e_y_T_y_p_e │ │ │ │ │ -IndexMap::KeyType KeyType │ │ │ │ │ -The key type of the property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:125 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_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 property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:135 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -T ValueType │ │ │ │ │ -The value type of the property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:130 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -Reference operator[](KeyType key) const │ │ │ │ │ -Access the a value by reference. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:160 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -IteratorPropertyMap(RandomAccessIterator iter, const IndexMap &im=IndexMap()) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -IteratorPropertyMap() │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_I_n_d_e_x_M_a_p │ │ │ │ │ -IM IndexMap │ │ │ │ │ -The type of the index map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r │ │ │ │ │ -RAI RandomAccessIterator │ │ │ │ │ -The type of the random access iterator. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:113 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_P_r_o_p_e_r_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -LvaluePropertyMapTag Category │ │ │ │ │ -The category of this property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -An adapter to turn an unique associative container into a property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_s_s_o_c_i_a_t_i_v_e_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -An adaptor to turn an unique associative container into a property map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:238 │ │ │ │ │ -_D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p │ │ │ │ │ -A property map that applies the identity function to integers. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -std::size_t ValueType │ │ │ │ │ -The value type of the map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:298 │ │ │ │ │ -_D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p_:_:_K_e_y_T_y_p_e │ │ │ │ │ -std::size_t KeyType │ │ │ │ │ -The key type of the map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:295 │ │ │ │ │ -_D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -ValueType operator[](const KeyType &key) const │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:306 │ │ │ │ │ -_D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -std::size_t Reference │ │ │ │ │ -The reference type of the map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:301 │ │ │ │ │ -_D_u_n_e_:_:_I_d_e_n_t_i_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -ReadablePropertyMapTag Category │ │ │ │ │ -The category of the map. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:304 │ │ │ │ │ -_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 │ │ │ │ │ -Selector for the property map type. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:320 │ │ │ │ │ -_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_:_:_T_a_g │ │ │ │ │ -T Tag │ │ │ │ │ -the tag identifying the property. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:324 │ │ │ │ │ -_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_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ -C Container │ │ │ │ │ -The container type to whose entries the properties are attached. │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:329 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_R_e_b_i_n_d_L_i_s_t │ │ │ │ │ +typename Impl::RemoveEnd< EndMark, TypeList< Types... > >::type RebindList │ │ │ │ │ +A list of types with the final element removed. │ │ │ │ │ +DDeeffiinniittiioonn test.hh:158 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_I_s_L_o_o_p │ │ │ │ │ +typename Impl::IsLoop< T >::type IsLoop │ │ │ │ │ +check whether a type is an instance of LoopSIMD │ │ │ │ │ +DDeeffiinniittiioonn test.hh:162 │ │ │ │ │ +_D_u_n_e_:_:_L_o_o_p_S_I_M_D │ │ │ │ │ +DDeeffiinniittiioonn loop.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_E_n_d_M_a_r_k │ │ │ │ │ +final element marker for RebindList │ │ │ │ │ +DDeeffiinniittiioonn test.hh:145 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t │ │ │ │ │ +DDeeffiinniittiioonn test.hh:164 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_U_n_a_r_y_O_p_s │ │ │ │ │ +void checkUnaryOps() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1909 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s │ │ │ │ │ +void checkBinaryOps() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1952 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_S_c_a_l_a_r_V_e_c_t_o_r │ │ │ │ │ +void checkBinaryOpsScalarVector() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1970 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_T_y_p_e │ │ │ │ │ +void checkType() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1866 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k │ │ │ │ │ +void check() │ │ │ │ │ +run unit tests for simd vector type V │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1839 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_S_c_a_l_a_r │ │ │ │ │ +void checkBinaryOpsVectorScalar() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1985 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_g_o_o_d │ │ │ │ │ +bool good() const │ │ │ │ │ +whether all tests succeeded │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1859 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_V_e_c_t_o_r │ │ │ │ │ +void checkBinaryOpsVectorVector() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1960 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_N_o_n_O_p_s │ │ │ │ │ +void checkNonOps() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:1878 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_V_e_c_t_o_r_P_r_o_x_y │ │ │ │ │ +void checkBinaryOpsVectorProxy() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:2010 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_U_n_i_t_T_e_s_t_:_:_c_h_e_c_k_B_i_n_a_r_y_O_p_s_P_r_o_x_y_V_e_c_t_o_r │ │ │ │ │ +void checkBinaryOpsProxyVector() │ │ │ │ │ +DDeeffiinniittiioonn test.hh:2000 │ │ │ │ │ +_D_u_n_e_:_:_A_l_w_a_y_s_T_r_u_e │ │ │ │ │ +template which always yields a true value │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:134 │ │ │ │ │ +_s_i_m_d_._h_h │ │ │ │ │ +Include file for users of the SIMD abstraction layer. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00152.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: function.hh File Reference │ │ │ │ +dune-common: defaults.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,82 +65,127 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Macros | │ │ │ │ -Functions
    │ │ │ │ -
    function.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ + │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Simple base class templates for functions. │ │ │ │ +

    Default implementations for SIMD Implementations. │ │ │ │ More...

    │ │ │ │ -
    #include <utility>
    │ │ │ │ -#include <dune/common/deprecated.hh>
    │ │ │ │ -#include "typetraits.hh"
    │ │ │ │ +
    #include <algorithm>
    │ │ │ │ +#include <cstddef>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <dune/common/rangeutilities.hh>
    │ │ │ │ +#include <dune/common/simd/base.hh>
    │ │ │ │ +#include <dune/common/simd/interface.hh>
    │ │ │ │ +#include <dune/common/typelist.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    class  Dune::Function< Domain, Range >
     Base class template for function classes. More...
     
    struct  Dune::Function< Domain, Range >::Traits
     Traits class containing raw types. More...
     
    class  Dune::VirtualFunction< DomainType, RangeType >
     Virtual base class template for function classes. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

    │ │ │ │ Namespaces

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

    │ │ │ │ -Macros

    #define DUNE_FUNCTION_HH
     
    namespace  Dune::Simd
     Namespace for vectorization interface functions used by library developers.
     
    namespace  Dune::Simd::Overloads
     Namespace for the overloads and specializations that make up a SIMD implementation.
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<typename Domain , typename Range , typename F >
    Impl::LambdaVirtualFunction< Domain, Range, std::decay_t< F > > Dune::makeVirtualFunction (F &&f)
     make VirtualFunction out of a function object
     
    Overloadable and default functions

    This group contains functions that you, as an abstraction developer, must implement. All functions that are deleted must be provided, functions that have a default implementation may be left unimplemented if the default behaviour is satisfactory.

    │ │ │ │ +
    template<class V >
    decltype(auto) Dune::Simd::Overloads::lane (ADLTag< 0 >, std::size_t l, V v)=delete
     implements Simd::lane()
     
    template<class V >
    constexpr V Dune::Simd::Overloads::implCast (ADLTag< 0 >, MetaType< V >, const V &u)
     implements Simd::implCast<V>(V)
     
    template<class V , class U >
    constexpr V Dune::Simd::Overloads::implCast (ADLTag< 0 >, MetaType< V >, const U &u)
     implements Simd::implCast<V>(U)
     
    template<class V , class S >
    auto Dune::Simd::Overloads::broadcast (ADLTag< 0 >, MetaType< V >, S s)
     implements Simd::broadcast<V>()
     
    template<class V >
    Dune::Simd::Overloads::cond (ADLTag< 0 >, const Mask< V > &mask, const V &ifTrue, const V &ifFalse)=delete
     implements Simd::cond()
     
    template<class V >
    auto Dune::Simd::Overloads::max (ADLTag< 0 >, const V &v1, const V &v2)
     implements binary Simd::max()
     
    template<class V >
    auto Dune::Simd::Overloads::min (ADLTag< 0 >, const V &v1, const V &v2)
     implements binary Simd::min()
     
    template<class Mask >
    bool Dune::Simd::Overloads::anyTrue (ADLTag< 0 >, const Mask &mask)=delete
     implements Simd::anyTrue()
     
    template<class Mask >
    bool Dune::Simd::Overloads::allTrue (ADLTag< 0 >, const Mask &mask)
     implements Simd::allTrue()
     
    template<class Mask >
    bool Dune::Simd::Overloads::anyFalse (ADLTag< 0 >, const Mask &mask)
     implements Simd::anyFalse()
     
    template<class Mask >
    bool Dune::Simd::Overloads::allFalse (ADLTag< 0 >, const Mask &mask)
     implements Simd::allFalse()
     
    template<class V >
    auto Dune::Simd::Overloads::max (ADLTag< 0 >, const V &v)
     implements Simd::maxValue()
     
    template<class V >
    auto Dune::Simd::Overloads::min (ADLTag< 0 >, const V &v)
     implements Simd::minValue()
     
    template<class V >
    Mask< V > Dune::Simd::Overloads::mask (ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
     implements Simd::mask()
     
    template<class V >
    auto Dune::Simd::Overloads::mask (ADLTag< 0, !std::is_same< V, Mask< V > >::value >, const V &v)
     implements Simd::mask()
     
    template<class V1 , class V2 >
    auto Dune::Simd::Overloads::maskOr (ADLTag< 0 >, const V1 &v1, const V2 &v2)
     implements Simd::maskOr()
     
    template<class V1 , class V2 >
    auto Dune::Simd::Overloads::maskAnd (ADLTag< 0 >, const V1 &v1, const V2 &v2)
     implements Simd::maskAnd()
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Simple base class templates for functions.

    │ │ │ │ -

    Macro Definition Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ DUNE_FUNCTION_HH

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    #define DUNE_FUNCTION_HH
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ +

    Default implementations for SIMD Implementations.

    │ │ │ │ +

    This file provides default overloads for SIMD implementation functions, and deleted placeholders where there are no default implementations.

    │ │ │ │ +

    This file should never be included by users of the SIMD abstraction. Include <dune/common/simd/simd.hh> instead.

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,45 +1,126 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -function.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n │ │ │ │ │ -Simple base class templates for functions. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_p_r_e_c_a_t_e_d_._h_h> │ │ │ │ │ -#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +defaults.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _A_b_s_t_r_a_c_t_i_o_n_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e │ │ │ │ │ +Default implementations for SIMD Implementations. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_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_:_:_F_u_n_c_t_i_o_n_<_ _D_o_m_a_i_n_,_ _R_a_n_g_e_ _> │ │ │ │ │ -  Base class template for function classes. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_u_n_c_t_i_o_n_<_ _D_o_m_a_i_n_,_ _R_a_n_g_e_ _>_:_:_T_r_a_i_t_s │ │ │ │ │ -  _T_r_a_i_t_s class containing raw types. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_<_ _D_o_m_a_i_n_T_y_p_e_,_ _R_a_n_g_e_T_y_p_e_ _> │ │ │ │ │ -  Virtual base class template for function classes. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___F_U_N_C_T_I_O_N___H_H │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ +  Namespace for vectorization interface functions used by library │ │ │ │ │ + developers. │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ +  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ + implementation. │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -Impl::LambdaVirtualFunction< Domain, │ │ │ │ │ - Range, std::decay_t< F > >  _D_u_n_e_:_:_m_a_k_e_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n (F &&f) │ │ │ │ │ -  make _V_i_r_t_u_a_l_F_u_n_c_t_i_o_n out of a function │ │ │ │ │ - object │ │ │ │ │ +Overloadable and default functions │ │ │ │ │ +This group contains functions that you, as an abstraction developer, must │ │ │ │ │ +implement. All functions that are deleted must be provided, functions that have │ │ │ │ │ +a default implementation may be left unimplemented if the default behaviour is │ │ │ │ │ +satisfactory. │ │ │ │ │ +template │ │ │ │ │ +decltype(auto)  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 0 >, std::size_t l, V │ │ │ │ │ + v)=delete │ │ │ │ │ +  implements _S_i_m_d_:_:_l_a_n_e_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_i_m_p_l_C_a_s_t (_A_D_L_T_a_g< 0 >, _M_e_t_a_T_y_p_e< V >, │ │ │ │ │ + const V &u) │ │ │ │ │ +  implements Simd::implCast(V) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_i_m_p_l_C_a_s_t (_A_D_L_T_a_g< 0 >, _M_e_t_a_T_y_p_e< V >, │ │ │ │ │ + const U &u) │ │ │ │ │ +  implements Simd::implCast(U) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_b_r_o_a_d_c_a_s_t (_A_D_L_T_a_g< 0 >, _M_e_t_a_T_y_p_e< V >, S │ │ │ │ │ + s) │ │ │ │ │ +  implements _S_i_m_d_:_:_b_r_o_a_d_c_a_s_t_<_V_>_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + V  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d (_A_D_L_T_a_g< 0 >, const _M_a_s_k< V > │ │ │ │ │ + &_m_a_s_k, const V &ifTrue, const V &ifFalse)=delete │ │ │ │ │ +  implements _S_i_m_d_:_:_c_o_n_d_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_x (_A_D_L_T_a_g< 0 >, const V &v1, const V │ │ │ │ │ + &v2) │ │ │ │ │ +  implements binary _S_i_m_d_:_:_m_a_x_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_i_n (_A_D_L_T_a_g< 0 >, const V &v1, const V │ │ │ │ │ + &v2) │ │ │ │ │ +  implements binary _S_i_m_d_:_:_m_i_n_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k │ │ │ │ │ + &_m_a_s_k)=delete │ │ │ │ │ +  implements _S_i_m_d_:_:_a_n_y_T_r_u_e_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ +  implements _S_i_m_d_:_:_a_l_l_T_r_u_e_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ +  implements _S_i_m_d_:_:_a_n_y_F_a_l_s_e_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e (_A_D_L_T_a_g< 0 >, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ +  implements _S_i_m_d_:_:_a_l_l_F_a_l_s_e_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_x (_A_D_L_T_a_g< 0 >, const V &v) │ │ │ │ │ +  implements Simd::maxValue() │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_i_n (_A_D_L_T_a_g< 0 >, const V &v) │ │ │ │ │ +  implements Simd::minValue() │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + _M_a_s_k< V >  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k (_A_D_L_T_a_g< 0, std::is_same< V, _M_a_s_k< │ │ │ │ │ + V > >::value >, const V &v) │ │ │ │ │ +  implements _S_i_m_d_:_:_m_a_s_k_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k (_A_D_L_T_a_g< 0, !std::is_same< V, _M_a_s_k< │ │ │ │ │ + V > >::value >, const V &v) │ │ │ │ │ +  implements _S_i_m_d_:_:_m_a_s_k_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_O_r (_A_D_L_T_a_g< 0 >, const V1 &v1, const │ │ │ │ │ + V2 &v2) │ │ │ │ │ +  implements _S_i_m_d_:_:_m_a_s_k_O_r_(_) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_A_n_d (_A_D_L_T_a_g< 0 >, const V1 &v1, │ │ │ │ │ + const V2 &v2) │ │ │ │ │ +  implements _S_i_m_d_:_:_m_a_s_k_A_n_d_(_) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Simple base class templates for functions. │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__FFUUNNCCTTIIOONN__HHHH ********** │ │ │ │ │ -#define DUNE_FUNCTION_HH │ │ │ │ │ +Default implementations for SIMD Implementations. │ │ │ │ │ +This file provides default overloads for SIMD implementation functions, and │ │ │ │ │ +deleted placeholders where there are no default implementations. │ │ │ │ │ +This file should never be included by users of the SIMD abstraction. Include │ │ │ │ │ +<_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> instead. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00152_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: function.hh Source File │ │ │ │ +dune-common: defaults.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,147 +70,215 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    function.hh
    │ │ │ │ +
    defaults.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_FUNCTION_HH_SILENCE_DEPRECATION
    │ │ │ │ -
    6#warning This file is deprecated after Dune 2.7! Use C++ function objects and std::function stuff instead!
    │ │ │ │ -
    7#else // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION
    │ │ │ │ -
    8#undef DUNE_FUNCTION_HH_SILENCE_DEPRECATION
    │ │ │ │ -
    9#endif // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION
    │ │ │ │ -
    10
    │ │ │ │ -
    11#ifndef DUNE_FUNCTION_HH
    │ │ │ │ -
    12#define DUNE_FUNCTION_HH
    │ │ │ │ -
    13
    │ │ │ │ -
    14#include <utility>
    │ │ │ │ -
    15
    │ │ │ │ - │ │ │ │ -
    17#include "typetraits.hh"
    │ │ │ │ -
    18
    │ │ │ │ -
    19namespace Dune {
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_DEFAULTS_HH
    │ │ │ │ +
    4#define DUNE_COMMON_SIMD_DEFAULTS_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    17#include <algorithm>
    │ │ │ │ +
    18#include <cstddef>
    │ │ │ │ +
    19#include <type_traits>
    │ │ │ │
    20
    │ │ │ │ -
    36 template <class Domain, class Range>
    │ │ │ │ -
    │ │ │ │ -
    37 class
    │ │ │ │ -
    38 [[deprecated("Dune::Function is deprecated after Dune 2.7. Use C++ "
    │ │ │ │ -
    39 "function objects instead!")]]
    │ │ │ │ - │ │ │ │ -
    41 {
    │ │ │ │ -
    42 typedef typename std::remove_cv<typename std::remove_reference< Domain >::type >::type RawDomainType;
    │ │ │ │ -
    43 typedef typename std::remove_cv<typename std::remove_reference< Range >::type >::type RawRangeType;
    │ │ │ │ -
    44
    │ │ │ │ -
    45 public:
    │ │ │ │ -
    46
    │ │ │ │ -
    48 typedef RawRangeType RangeType;
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    26
    │ │ │ │ +
    27namespace Dune {
    │ │ │ │ +
    28 namespace Simd {
    │ │ │ │ +
    29 namespace Overloads {
    │ │ │ │ +
    30
    │ │ │ │ +
    47 template<class V>
    │ │ │ │ +
    48 decltype(auto) lane(ADLTag<0>, std::size_t l, V v) = delete;
    │ │ │ │
    49
    │ │ │ │ -
    51 typedef RawDomainType DomainType;
    │ │ │ │ -
    52
    │ │ │ │ -
    │ │ │ │ -
    54 struct Traits
    │ │ │ │ -
    55 {
    │ │ │ │ -
    56 typedef RawDomainType DomainType;
    │ │ │ │ -
    57 typedef RawRangeType RangeType;
    │ │ │ │ -
    58 };
    │ │ │ │ -
    │ │ │ │ -
    59
    │ │ │ │ -
    66 void evaluate(const typename Traits::DomainType& x, typename Traits::RangeType& y) const;
    │ │ │ │ -
    67 }; // end of Function class
    │ │ │ │ -
    │ │ │ │ -
    68
    │ │ │ │ -
    69
    │ │ │ │ -
    70
    │ │ │ │ - │ │ │ │ -
    82 template <class DomainType, class RangeType>
    │ │ │ │ -
    │ │ │ │ -
    83 class
    │ │ │ │ -
    84 [[deprecated("Dune::VirtualFunction is deprecated after Dune 2.7. Use C++ "
    │ │ │ │ -
    85 "function objects and std::function instead!")]]
    │ │ │ │ - │ │ │ │ -
    87 {
    │ │ │ │ -
    88 public:
    │ │ │ │ - │ │ │ │ -
    90
    │ │ │ │ -
    91 virtual ~VirtualFunction() {}
    │ │ │ │ -
    98 virtual void evaluate(const typename Traits::DomainType& x, typename Traits::RangeType& y) const = 0;
    │ │ │ │ -
    99 }; // end of VirtualFunction class
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    101
    │ │ │ │ -
    102 namespace Impl {
    │ │ │ │ -
    103
    │ │ │ │ - │ │ │ │ -
    105 template<typename Domain, typename Range, typename F>
    │ │ │ │ -
    106 class LambdaVirtualFunction final
    │ │ │ │ -
    107 : public VirtualFunction<Domain, Range>
    │ │ │ │ -
    108 {
    │ │ │ │ -
    109 public:
    │ │ │ │ -
    110 LambdaVirtualFunction(F&& f)
    │ │ │ │ -
    111 : f_(std::move(f))
    │ │ │ │ -
    112 {}
    │ │ │ │ -
    113
    │ │ │ │ -
    114 LambdaVirtualFunction(const F& f)
    │ │ │ │ -
    115 : f_(f)
    │ │ │ │ -
    116 {}
    │ │ │ │ -
    117
    │ │ │ │ -
    118 void evaluate(const Domain& x, Range& y) const override
    │ │ │ │ -
    119 {
    │ │ │ │ -
    120 y = f_(x);
    │ │ │ │ -
    121 }
    │ │ │ │ -
    122
    │ │ │ │ -
    123 private:
    │ │ │ │ -
    124 const F f_;
    │ │ │ │ -
    125 };
    │ │ │ │ - │ │ │ │ -
    127
    │ │ │ │ -
    128 } /* namespace Impl */
    │ │ │ │ -
    129
    │ │ │ │ -
    149 template<typename Domain, typename Range, typename F>
    │ │ │ │ -
    150 [[deprecated("Dune::LambdaVirtualFunction is deprecated after Dune 2.7. "
    │ │ │ │ -
    151 "Use std::function instead!")]]
    │ │ │ │ -
    152 Impl::LambdaVirtualFunction< Domain, Range, std::decay_t<F> >
    │ │ │ │ +
    51 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    52 constexpr V implCast(ADLTag<0>, MetaType<V>, const V &u)
    │ │ │ │ +
    53 {
    │ │ │ │ +
    54 return u;
    │ │ │ │ +
    55 }
    │ │ │ │ +
    │ │ │ │ +
    56
    │ │ │ │ +
    58 template<class V, class U>
    │ │ │ │ +
    │ │ │ │ +
    59 constexpr V implCast(ADLTag<0>, MetaType<V>, const U &u)
    │ │ │ │ +
    60 {
    │ │ │ │ +
    61 V result(Simd::Scalar<V>(0));
    │ │ │ │ +
    62 for(auto l : range(Simd::lanes(u)))
    │ │ │ │ +
    63 Simd::lane(l, result) = Simd::lane(l, u);
    │ │ │ │ +
    64 return result;
    │ │ │ │ +
    65 }
    │ │ │ │ +
    │ │ │ │ +
    66
    │ │ │ │ +
    68 template<class V, class S>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    70 {
    │ │ │ │ +
    71 return V(Simd::Scalar<V>(s));
    │ │ │ │ +
    72 }
    │ │ │ │ +
    │ │ │ │ +
    73
    │ │ │ │ +
    75 template<class V>
    │ │ │ │ + │ │ │ │ +
    77 const V &ifTrue, const V &ifFalse) = delete;
    │ │ │ │ +
    78
    │ │ │ │ +
    80 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    81 auto max(ADLTag<0>, const V &v1, const V &v2)
    │ │ │ │ +
    82 {
    │ │ │ │ +
    83 using std::max;
    │ │ │ │ +
    84 return max(v1, v2);
    │ │ │ │ +
    85 }
    │ │ │ │ +
    │ │ │ │ +
    86
    │ │ │ │ +
    88 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    89 auto min(ADLTag<0>, const V &v1, const V &v2)
    │ │ │ │ +
    90 {
    │ │ │ │ +
    91 using std::min;
    │ │ │ │ +
    92 return min(v1, v2);
    │ │ │ │ +
    93 }
    │ │ │ │ +
    │ │ │ │ +
    94
    │ │ │ │ +
    96 template<class Mask>
    │ │ │ │ +
    97 bool anyTrue(ADLTag<0>, const Mask &mask) = delete;
    │ │ │ │ +
    98
    │ │ │ │ +
    100
    │ │ │ │ +
    103 template<class Mask>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    105 {
    │ │ │ │ +
    106 return !Dune::Simd::anyTrue(!mask);
    │ │ │ │ +
    107 }
    │ │ │ │ +
    │ │ │ │ +
    108
    │ │ │ │ +
    110
    │ │ │ │ +
    113 template<class Mask>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    115 {
    │ │ │ │ +
    116 return Dune::Simd::anyTrue(!mask);
    │ │ │ │ +
    117 }
    │ │ │ │ +
    │ │ │ │ +
    118
    │ │ │ │ +
    120
    │ │ │ │ +
    123 template<class Mask>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    125 {
    │ │ │ │ +
    126 return !Dune::Simd::anyTrue(mask);
    │ │ │ │ +
    127 }
    │ │ │ │ +
    │ │ │ │ +
    128
    │ │ │ │ +
    130 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    131 auto max(ADLTag<0>, const V &v)
    │ │ │ │ +
    132 {
    │ │ │ │ +
    133 Scalar<V> m = Simd::lane(0, v);
    │ │ │ │ +
    134 for(std::size_t l = 1; l < Simd::lanes(v); ++l)
    │ │ │ │ +
    135 if(m < Simd::lane(l, v))
    │ │ │ │ +
    136 m = Simd::lane(l, v);
    │ │ │ │ +
    137 return m;
    │ │ │ │ +
    138 }
    │ │ │ │ +
    │ │ │ │ +
    139
    │ │ │ │ +
    141 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    142 auto min(ADLTag<0>, const V &v)
    │ │ │ │ +
    143 {
    │ │ │ │ +
    144 Scalar<V> m = Simd::lane(0, v);
    │ │ │ │ +
    145 for(std::size_t l = 1; l < Simd::lanes(v); ++l)
    │ │ │ │ +
    146 if(Simd::lane(l, v) < m)
    │ │ │ │ +
    147 m = Simd::lane(l, v);
    │ │ │ │ +
    148 return m;
    │ │ │ │ +
    149 }
    │ │ │ │ +
    │ │ │ │ +
    150
    │ │ │ │ +
    152 template<class V>
    │ │ │ │
    │ │ │ │ - │ │ │ │ -
    154 {
    │ │ │ │ -
    155 return {std::forward<F>(f)};
    │ │ │ │ -
    156 }
    │ │ │ │ -
    │ │ │ │ -
    157
    │ │ │ │ -
    160} // end namespace
    │ │ │ │ -
    161
    │ │ │ │ -
    162#endif
    │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ -
    Definition of the DUNE_NO_DEPRECATED_* macros.
    │ │ │ │ -
    Impl::LambdaVirtualFunction< Domain, Range, std::decay_t< F > > makeVirtualFunction(F &&f)
    make VirtualFunction out of a function object
    Definition function.hh:153
    │ │ │ │ -
    #define DUNE_NO_DEPRECATED_END
    Ignore deprecation warnings (end)
    Definition deprecated.hh:38
    │ │ │ │ -
    #define DUNE_NO_DEPRECATED_BEGIN
    Ignore deprecation warnings (start)
    Definition deprecated.hh:32
    │ │ │ │ +
    153 Mask<V> mask(ADLTag<0, std::is_same<V, Mask<V> >::value>,
    │ │ │ │ +
    154 const V &v)
    │ │ │ │ +
    155 {
    │ │ │ │ +
    156 return v;
    │ │ │ │ +
    157 }
    │ │ │ │ +
    │ │ │ │ +
    158
    │ │ │ │ +
    160 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    161 auto mask(ADLTag<0, !std::is_same<V, Mask<V> >::value>,
    │ │ │ │ +
    162 const V &v)
    │ │ │ │ +
    163 {
    │ │ │ │ +
    164 using Copy = AutonomousValue<V>; // just in case we are handed a proxy
    │ │ │ │ +
    165 return v != Copy(Scalar<Copy>(0));
    │ │ │ │ +
    166 }
    │ │ │ │ +
    │ │ │ │ +
    167
    │ │ │ │ +
    169 template<class V1, class V2>
    │ │ │ │ +
    │ │ │ │ +
    170 auto maskOr(ADLTag<0>, const V1 &v1, const V2 &v2)
    │ │ │ │ +
    171 {
    │ │ │ │ +
    172 return Simd::mask(v1) || Simd::mask(v2);
    │ │ │ │ +
    173 }
    │ │ │ │ +
    │ │ │ │ +
    174
    │ │ │ │ +
    176 template<class V1, class V2>
    │ │ │ │ +
    │ │ │ │ +
    177 auto maskAnd(ADLTag<0>, const V1 &v1, const V2 &v2)
    │ │ │ │ +
    178 {
    │ │ │ │ +
    179 return Simd::mask(v1) && Simd::mask(v2);
    │ │ │ │ +
    180 }
    │ │ │ │ +
    │ │ │ │ +
    181
    │ │ │ │ +
    184 } // namespace Overloads
    │ │ │ │ +
    185 } // namespace Simd
    │ │ │ │ +
    186} // namespace Dune
    │ │ │ │ +
    187
    │ │ │ │ +
    188#endif // DUNE_COMMON_SIMD_DEFAULTS_HH
    │ │ │ │ +
    Utilities for reduction like operations on ranges.
    │ │ │ │ +
    Basic definitions for SIMD Implementations.
    │ │ │ │ + │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
    Definition rangeutilities.hh:300
    │ │ │ │ +
    typename AutonomousValueType< T >::type AutonomousValue
    Type free of internal references that T can be converted to.
    Definition typetraits.hh:558
    │ │ │ │ +
    bool anyTrue(const Mask &mask)
    Whether any entry is true
    Definition simd/interface.hh:429
    │ │ │ │ +
    auto mask(const V &v)
    Convert to mask, analogue of bool(s) for scalars.
    Definition simd/interface.hh:489
    │ │ │ │ +
    constexpr std::size_t lanes()
    Number of lanes in a SIMD type.
    Definition simd/interface.hh:305
    │ │ │ │ +
    decltype(auto) lane(std::size_t l, V &&v)
    Extract an element of a SIMD type.
    Definition simd/interface.hh:324
    │ │ │ │ +
    Rebind< bool, V > Mask
    Mask type type of some SIMD type.
    Definition simd/interface.hh:289
    │ │ │ │ +
    typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
    Element type of some SIMD type.
    Definition simd/interface.hh:235
    │ │ │ │ +
    Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
    implements Simd::mask()
    Definition defaults.hh:153
    │ │ │ │ +
    constexpr V implCast(ADLTag< 0 >, MetaType< V >, const V &u)
    implements Simd::implCast<V>(V)
    Definition defaults.hh:52
    │ │ │ │ +
    bool allFalse(ADLTag< 0 >, const Mask &mask)
    implements Simd::allFalse()
    Definition defaults.hh:124
    │ │ │ │ +
    bool allTrue(ADLTag< 0 >, const Mask &mask)
    implements Simd::allTrue()
    Definition defaults.hh:104
    │ │ │ │ +
    auto maskAnd(ADLTag< 0 >, const V1 &v1, const V2 &v2)
    implements Simd::maskAnd()
    Definition defaults.hh:177
    │ │ │ │ +
    auto maskOr(ADLTag< 0 >, const V1 &v1, const V2 &v2)
    implements Simd::maskOr()
    Definition defaults.hh:170
    │ │ │ │ +
    bool anyFalse(ADLTag< 0 >, const Mask &mask)
    implements Simd::anyFalse()
    Definition defaults.hh:114
    │ │ │ │ +
    auto min(ADLTag< 0 >, const V &v1, const V &v2)
    implements binary Simd::min()
    Definition defaults.hh:89
    │ │ │ │ +
    auto broadcast(ADLTag< 0 >, MetaType< V >, S s)
    implements Simd::broadcast<V>()
    Definition defaults.hh:69
    │ │ │ │ +
    auto max(ADLTag< 0 >, const V &v1, const V &v2)
    implements binary Simd::max()
    Definition defaults.hh:81
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Base class template for function classes.
    Definition function.hh:41
    │ │ │ │ -
    RawDomainType DomainType
    Raw type of output variable with removed reference and constness.
    Definition function.hh:51
    │ │ │ │ -
    void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
    Function evaluation.
    │ │ │ │ -
    RawRangeType RangeType
    Raw type of input variable with removed reference and constness.
    Definition function.hh:48
    │ │ │ │ -
    Traits class containing raw types.
    Definition function.hh:55
    │ │ │ │ -
    RawDomainType DomainType
    Definition function.hh:56
    │ │ │ │ -
    RawRangeType RangeType
    Definition function.hh:57
    │ │ │ │ -
    Virtual base class template for function classes.
    Definition function.hh:87
    │ │ │ │ -
    Function< constDomainType &, RangeType & >::Traits Traits
    Definition function.hh:89
    │ │ │ │ -
    virtual ~VirtualFunction()
    Definition function.hh:91
    │ │ │ │ -
    virtual void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const =0
    Function evaluation.
    │ │ │ │ +
    bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
    Definition debugalign.hh:543
    │ │ │ │ +
    const AlignedNumber< T, align > & cond(ADLTag< 5 >, AlignedNumber< bool, align > mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align > &ifFalse)
    Definition debugalign.hh:535
    │ │ │ │ +
    T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
    Definition debugalign.hh:520
    │ │ │ │ +
    Tag used to force late-binding lookup in Dune::Simd::Overloads.
    Definition base.hh:182
    │ │ │ │ +
    A type that refers to another type.
    Definition typelist.hh:33
    │ │ │ │ +
    User interface of the SIMD abstraction.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,174 +1,250 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -function.hh │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +defaults.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ -6#warning This file is deprecated after Dune 2.7! Use C++ function objects and │ │ │ │ │ -std::function stuff instead! │ │ │ │ │ -7#else // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ -8#undef DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ -9#endif // !DUNE_FUNCTION_HH_SILENCE_DEPRECATION │ │ │ │ │ -10 │ │ │ │ │ -11#ifndef DUNE_FUNCTION_HH │ │ │ │ │ -_1_2#define DUNE_FUNCTION_HH │ │ │ │ │ -13 │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_p_r_e_c_a_t_e_d_._h_h> │ │ │ │ │ -17#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ -18 │ │ │ │ │ -19namespace _D_u_n_e { │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_SIMD_DEFAULTS_HH │ │ │ │ │ +4#define DUNE_COMMON_SIMD_DEFAULTS_HH │ │ │ │ │ +5 │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ 20 │ │ │ │ │ -36 template │ │ │ │ │ -_3_7 class │ │ │ │ │ -38 [[deprecated("Dune::Function is deprecated after Dune 2.7. Use C++ " │ │ │ │ │ -39 "function objects instead!")]] │ │ │ │ │ -40 _F_u_n_c_t_i_o_n │ │ │ │ │ -41 { │ │ │ │ │ -42 typedef typename std::remove_cv:: │ │ │ │ │ -type >::type RawDomainType; │ │ │ │ │ -43 typedef typename std::remove_cv:: │ │ │ │ │ -type >::type RawRangeType; │ │ │ │ │ -44 │ │ │ │ │ -45 public: │ │ │ │ │ -46 │ │ │ │ │ -_4_8 typedef RawRangeType _R_a_n_g_e_T_y_p_e; │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ +23#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ +24#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_l_i_s_t_._h_h> │ │ │ │ │ +25#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +26 │ │ │ │ │ +27namespace _D_u_n_e { │ │ │ │ │ +28 namespace Simd { │ │ │ │ │ +29 namespace Overloads { │ │ │ │ │ +30 │ │ │ │ │ +47 template │ │ │ │ │ +_4_8 decltype(auto) _l_a_n_e(_A_D_L_T_a_g_<_0_>, std::size_t l, V v) = delete; │ │ │ │ │ 49 │ │ │ │ │ -_5_1 typedef RawDomainType _D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ -52 │ │ │ │ │ -_5_4 struct _T_r_a_i_t_s │ │ │ │ │ -55 { │ │ │ │ │ -_5_6 typedef RawDomainType _D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ -_5_7 typedef RawRangeType _R_a_n_g_e_T_y_p_e; │ │ │ │ │ -58 }; │ │ │ │ │ -59 │ │ │ │ │ -_6_6 void _e_v_a_l_u_a_t_e(const typename _T_r_a_i_t_s_:_:_D_o_m_a_i_n_T_y_p_e& x, typename _T_r_a_i_t_s_:_: │ │ │ │ │ -_R_a_n_g_e_T_y_p_e& y) const; │ │ │ │ │ -67 }; // end of Function class │ │ │ │ │ -68 │ │ │ │ │ -69 │ │ │ │ │ -70 │ │ │ │ │ -71 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___B_E_G_I_N │ │ │ │ │ -82 template │ │ │ │ │ -_8_3 class │ │ │ │ │ -84 [[deprecated("Dune::VirtualFunction is deprecated after Dune 2.7. Use C++ " │ │ │ │ │ -85 "function objects and std::function instead!")]] │ │ │ │ │ -86 _V_i_r_t_u_a_l_F_u_n_c_t_i_o_n : public _F_u_n_c_t_i_o_n_<_c_o_n_s_t_ _D_o_m_a_i_n_T_y_p_e_&_,_ _R_a_n_g_e_T_y_p_e_&_> │ │ │ │ │ -87 { │ │ │ │ │ -88 public: │ │ │ │ │ -_8_9 typedef typename _F_u_n_c_t_i_o_n_<_c_o_n_s_t_ _D_o_m_a_i_n_T_y_p_e_&_,_ _R_a_n_g_e_T_y_p_e_&_>_:_:_T_r_a_i_t_s _T_r_a_i_t_s; │ │ │ │ │ -90 │ │ │ │ │ -_9_1 virtual _~_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n() {} │ │ │ │ │ -_9_8 virtual void _e_v_a_l_u_a_t_e(const typename _T_r_a_i_t_s_:_:_D_o_m_a_i_n_T_y_p_e& x, typename │ │ │ │ │ -_T_r_a_i_t_s_:_:_R_a_n_g_e_T_y_p_e& y) const = 0; │ │ │ │ │ -99 }; // end of VirtualFunction class │ │ │ │ │ -100 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___E_N_D │ │ │ │ │ -101 │ │ │ │ │ -102 namespace Impl { │ │ │ │ │ -103 │ │ │ │ │ -104 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___B_E_G_I_N │ │ │ │ │ -105 template │ │ │ │ │ -106 class LambdaVirtualFunction final │ │ │ │ │ -107 : public _V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ -108 { │ │ │ │ │ -109 public: │ │ │ │ │ -110 LambdaVirtualFunction(F&& f) │ │ │ │ │ -111 : f_(std::move(f)) │ │ │ │ │ -112 {} │ │ │ │ │ -113 │ │ │ │ │ -114 LambdaVirtualFunction(const F& f) │ │ │ │ │ -115 : f_(f) │ │ │ │ │ -116 {} │ │ │ │ │ -117 │ │ │ │ │ -118 void evaluate(const Domain& x, Range& y) const override │ │ │ │ │ -119 { │ │ │ │ │ -120 y = f_(x); │ │ │ │ │ -121 } │ │ │ │ │ -122 │ │ │ │ │ -123 private: │ │ │ │ │ -124 const F f_; │ │ │ │ │ -125 }; │ │ │ │ │ -126 _D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___E_N_D │ │ │ │ │ -127 │ │ │ │ │ -128 } /* namespace Impl */ │ │ │ │ │ -129 │ │ │ │ │ -149 template │ │ │ │ │ -150 [[deprecated("Dune::LambdaVirtualFunction is deprecated after Dune 2.7. " │ │ │ │ │ -151 "Use std::function instead!")]] │ │ │ │ │ -152 Impl::LambdaVirtualFunction< Domain, Range, std::decay_t > │ │ │ │ │ -_1_5_3 _m_a_k_e_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n(F&& f) │ │ │ │ │ -154 { │ │ │ │ │ -155 return {std::forward(f)}; │ │ │ │ │ -156 } │ │ │ │ │ -157 │ │ │ │ │ -160} // end namespace │ │ │ │ │ -161 │ │ │ │ │ -162#endif │ │ │ │ │ +51 template │ │ │ │ │ +_5_2 constexpr V _i_m_p_l_C_a_s_t(_A_D_L_T_a_g_<_0_>, _M_e_t_a_T_y_p_e_<_V_>, const V &u) │ │ │ │ │ +53 { │ │ │ │ │ +54 return u; │ │ │ │ │ +55 } │ │ │ │ │ +56 │ │ │ │ │ +58 template │ │ │ │ │ +_5_9 constexpr V _i_m_p_l_C_a_s_t(_A_D_L_T_a_g_<_0_>, _M_e_t_a_T_y_p_e_<_V_>, const U &u) │ │ │ │ │ +60 { │ │ │ │ │ +61 V result(_S_i_m_d_:_:_S_c_a_l_a_r_<_V_>(0)); │ │ │ │ │ +62 for(auto l : _r_a_n_g_e(_S_i_m_d_:_:_l_a_n_e_s(u))) │ │ │ │ │ +63 _S_i_m_d_:_:_l_a_n_e(l, result) = _S_i_m_d_:_:_l_a_n_e(l, u); │ │ │ │ │ +64 return result; │ │ │ │ │ +65 } │ │ │ │ │ +66 │ │ │ │ │ +68 template │ │ │ │ │ +_6_9 auto _b_r_o_a_d_c_a_s_t(_A_D_L_T_a_g_<_0_>, _M_e_t_a_T_y_p_e_<_V_>, S s) │ │ │ │ │ +70 { │ │ │ │ │ +71 return V(_S_i_m_d_:_:_S_c_a_l_a_r_<_V_>(s)); │ │ │ │ │ +72 } │ │ │ │ │ +73 │ │ │ │ │ +75 template │ │ │ │ │ +_7_6 V _c_o_n_d(_A_D_L_T_a_g_<_0_>, const _M_a_s_k_<_V_> &_m_a_s_k, │ │ │ │ │ +77 const V &ifTrue, const V &ifFalse) = delete; │ │ │ │ │ +78 │ │ │ │ │ +80 template │ │ │ │ │ +_8_1 auto _m_a_x(_A_D_L_T_a_g_<_0_>, const V &v1, const V &v2) │ │ │ │ │ +82 { │ │ │ │ │ +83 using std::max; │ │ │ │ │ +84 return _m_a_x(v1, v2); │ │ │ │ │ +85 } │ │ │ │ │ +86 │ │ │ │ │ +88 template │ │ │ │ │ +_8_9 auto _m_i_n(_A_D_L_T_a_g_<_0_>, const V &v1, const V &v2) │ │ │ │ │ +90 { │ │ │ │ │ +91 using std::min; │ │ │ │ │ +92 return _m_i_n(v1, v2); │ │ │ │ │ +93 } │ │ │ │ │ +94 │ │ │ │ │ +96 template │ │ │ │ │ +_9_7 bool _a_n_y_T_r_u_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) = delete; │ │ │ │ │ +98 │ │ │ │ │ +100 │ │ │ │ │ +103 template │ │ │ │ │ +_1_0_4 bool _a_l_l_T_r_u_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ +105 { │ │ │ │ │ +106 return !_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e(!_m_a_s_k); │ │ │ │ │ +107 } │ │ │ │ │ +108 │ │ │ │ │ +110 │ │ │ │ │ +113 template │ │ │ │ │ +_1_1_4 bool _a_n_y_F_a_l_s_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ +115 { │ │ │ │ │ +116 return _D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e(!_m_a_s_k); │ │ │ │ │ +117 } │ │ │ │ │ +118 │ │ │ │ │ +120 │ │ │ │ │ +123 template │ │ │ │ │ +_1_2_4 bool _a_l_l_F_a_l_s_e(_A_D_L_T_a_g_<_0_>, const _M_a_s_k &_m_a_s_k) │ │ │ │ │ +125 { │ │ │ │ │ +126 return !_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e(_m_a_s_k); │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +130 template │ │ │ │ │ +_1_3_1 auto _m_a_x(_A_D_L_T_a_g_<_0_>, const V &v) │ │ │ │ │ +132 { │ │ │ │ │ +133 _S_c_a_l_a_r_<_V_> m = _S_i_m_d_:_:_l_a_n_e(0, v); │ │ │ │ │ +134 for(std::size_t l = 1; l < _S_i_m_d_:_:_l_a_n_e_s(v); ++l) │ │ │ │ │ +135 if(m < _S_i_m_d_:_:_l_a_n_e(l, v)) │ │ │ │ │ +136 m = _S_i_m_d_:_:_l_a_n_e(l, v); │ │ │ │ │ +137 return m; │ │ │ │ │ +138 } │ │ │ │ │ +139 │ │ │ │ │ +141 template │ │ │ │ │ +_1_4_2 auto _m_i_n(_A_D_L_T_a_g_<_0_>, const V &v) │ │ │ │ │ +143 { │ │ │ │ │ +144 _S_c_a_l_a_r_<_V_> m = _S_i_m_d_:_:_l_a_n_e(0, v); │ │ │ │ │ +145 for(std::size_t l = 1; l < _S_i_m_d_:_:_l_a_n_e_s(v); ++l) │ │ │ │ │ +146 if(_S_i_m_d_:_:_l_a_n_e(l, v) < m) │ │ │ │ │ +147 m = _S_i_m_d_:_:_l_a_n_e(l, v); │ │ │ │ │ +148 return m; │ │ │ │ │ +149 } │ │ │ │ │ +150 │ │ │ │ │ +152 template │ │ │ │ │ +_1_5_3 _M_a_s_k_<_V_> _m_a_s_k(_A_D_L_T_a_g<0, std::is_same >::value>, │ │ │ │ │ +154 const V &v) │ │ │ │ │ +155 { │ │ │ │ │ +156 return v; │ │ │ │ │ +157 } │ │ │ │ │ +158 │ │ │ │ │ +160 template │ │ │ │ │ +_1_6_1 auto _m_a_s_k(_A_D_L_T_a_g<0, !std::is_same >::value>, │ │ │ │ │ +162 const V &v) │ │ │ │ │ +163 { │ │ │ │ │ +164 using Copy = _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_<_V_>; // just in case we are handed a proxy │ │ │ │ │ +165 return v != Copy(_S_c_a_l_a_r_<_C_o_p_y_>(0)); │ │ │ │ │ +166 } │ │ │ │ │ +167 │ │ │ │ │ +169 template │ │ │ │ │ +_1_7_0 auto _m_a_s_k_O_r(_A_D_L_T_a_g_<_0_>, const V1 &v1, const V2 &v2) │ │ │ │ │ +171 { │ │ │ │ │ +172 return _S_i_m_d_:_:_m_a_s_k(v1) || _S_i_m_d_:_:_m_a_s_k(v2); │ │ │ │ │ +173 } │ │ │ │ │ +174 │ │ │ │ │ +176 template │ │ │ │ │ +_1_7_7 auto _m_a_s_k_A_n_d(_A_D_L_T_a_g_<_0_>, const V1 &v1, const V2 &v2) │ │ │ │ │ +178 { │ │ │ │ │ +179 return _S_i_m_d_:_:_m_a_s_k(v1) && _S_i_m_d_:_:_m_a_s_k(v2); │ │ │ │ │ +180 } │ │ │ │ │ +181 │ │ │ │ │ +184 } // namespace Overloads │ │ │ │ │ +185 } // namespace Simd │ │ │ │ │ +186} // namespace Dune │ │ │ │ │ +187 │ │ │ │ │ +188#endif // DUNE_COMMON_SIMD_DEFAULTS_HH │ │ │ │ │ +_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +Utilities for reduction like operations on ranges. │ │ │ │ │ +_b_a_s_e_._h_h │ │ │ │ │ +Basic definitions for SIMD Implementations. │ │ │ │ │ +_t_y_p_e_l_i_s_t_._h_h │ │ │ │ │ _t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ Traits for type conversions and type information. │ │ │ │ │ -_d_e_p_r_e_c_a_t_e_d_._h_h │ │ │ │ │ -Definition of the DUNE_NO_DEPRECATED_* macros. │ │ │ │ │ -_D_u_n_e_:_:_m_a_k_e_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ -Impl::LambdaVirtualFunction< Domain, Range, std::decay_t< F > > │ │ │ │ │ -makeVirtualFunction(F &&f) │ │ │ │ │ -make VirtualFunction out of a function object │ │ │ │ │ -DDeeffiinniittiioonn function.hh:153 │ │ │ │ │ -_D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___E_N_D │ │ │ │ │ -#define DUNE_NO_DEPRECATED_END │ │ │ │ │ -Ignore deprecation warnings (end) │ │ │ │ │ -DDeeffiinniittiioonn deprecated.hh:38 │ │ │ │ │ -_D_U_N_E___N_O___D_E_P_R_E_C_A_T_E_D___B_E_G_I_N │ │ │ │ │ -#define DUNE_NO_DEPRECATED_BEGIN │ │ │ │ │ -Ignore deprecation warnings (start) │ │ │ │ │ -DDeeffiinniittiioonn deprecated.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ +static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ +>, std::integral_constant< T, to >) noexcept │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_A_u_t_o_n_o_m_o_u_s_V_a_l_u_e │ │ │ │ │ +typename AutonomousValueType< T >::type AutonomousValue │ │ │ │ │ +Type free of internal references that T can be converted to. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:558 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(const Mask &mask) │ │ │ │ │ +Whether any entry is true │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:429 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_m_a_s_k │ │ │ │ │ +auto mask(const V &v) │ │ │ │ │ +Convert to mask, analogue of bool(s) for scalars. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:489 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ +constexpr std::size_t lanes() │ │ │ │ │ +Number of lanes in a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ +decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ +Extract an element of a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_M_a_s_k │ │ │ │ │ +Rebind< bool, V > Mask │ │ │ │ │ +Mask type type of some SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:289 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ +typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ +Element type of some SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k │ │ │ │ │ +Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) │ │ │ │ │ +implements Simd::mask() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_i_m_p_l_C_a_s_t │ │ │ │ │ +constexpr V implCast(ADLTag< 0 >, MetaType< V >, const V &u) │ │ │ │ │ +implements Simd::implCast(V) │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_F_a_l_s_e │ │ │ │ │ +bool allFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::allFalse() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:124 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_l_l_T_r_u_e │ │ │ │ │ +bool allTrue(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::allTrue() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_A_n_d │ │ │ │ │ +auto maskAnd(ADLTag< 0 >, const V1 &v1, const V2 &v2) │ │ │ │ │ +implements Simd::maskAnd() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:177 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k_O_r │ │ │ │ │ +auto maskOr(ADLTag< 0 >, const V1 &v1, const V2 &v2) │ │ │ │ │ +implements Simd::maskOr() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:170 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_F_a_l_s_e │ │ │ │ │ +bool anyFalse(ADLTag< 0 >, const Mask &mask) │ │ │ │ │ +implements Simd::anyFalse() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:114 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_i_n │ │ │ │ │ +auto min(ADLTag< 0 >, const V &v1, const V &v2) │ │ │ │ │ +implements binary Simd::min() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_b_r_o_a_d_c_a_s_t │ │ │ │ │ +auto broadcast(ADLTag< 0 >, MetaType< V >, S s) │ │ │ │ │ +implements Simd::broadcast() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_x │ │ │ │ │ +auto max(ADLTag< 0 >, const V &v1, const V &v2) │ │ │ │ │ +implements binary Simd::max() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:81 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_F_u_n_c_t_i_o_n │ │ │ │ │ -Base class template for function classes. │ │ │ │ │ -DDeeffiinniittiioonn function.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_D_o_m_a_i_n_T_y_p_e │ │ │ │ │ -RawDomainType DomainType │ │ │ │ │ -Raw type of output variable with removed reference and constness. │ │ │ │ │ -DDeeffiinniittiioonn function.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_e_v_a_l_u_a_t_e │ │ │ │ │ -void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType │ │ │ │ │ -&y) const │ │ │ │ │ -Function evaluation. │ │ │ │ │ -_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_R_a_n_g_e_T_y_p_e │ │ │ │ │ -RawRangeType RangeType │ │ │ │ │ -Raw type of input variable with removed reference and constness. │ │ │ │ │ -DDeeffiinniittiioonn function.hh:48 │ │ │ │ │ -_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s │ │ │ │ │ -Traits class containing raw types. │ │ │ │ │ -DDeeffiinniittiioonn function.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s_:_:_D_o_m_a_i_n_T_y_p_e │ │ │ │ │ -RawDomainType DomainType │ │ │ │ │ -DDeeffiinniittiioonn function.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s_:_:_R_a_n_g_e_T_y_p_e │ │ │ │ │ -RawRangeType RangeType │ │ │ │ │ -DDeeffiinniittiioonn function.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ -Virtual base class template for function classes. │ │ │ │ │ -DDeeffiinniittiioonn function.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_:_:_T_r_a_i_t_s │ │ │ │ │ -Function< constDomainType &, RangeType & >::Traits Traits │ │ │ │ │ -DDeeffiinniittiioonn function.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_:_:_~_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n │ │ │ │ │ -virtual ~VirtualFunction() │ │ │ │ │ -DDeeffiinniittiioonn function.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_V_i_r_t_u_a_l_F_u_n_c_t_i_o_n_:_:_e_v_a_l_u_a_t_e │ │ │ │ │ -virtual void evaluate(const typename Traits::DomainType &x, typename Traits:: │ │ │ │ │ -RangeType &y) const =0 │ │ │ │ │ -Function evaluation. │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:543 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d │ │ │ │ │ +const AlignedNumber< T, align > & cond(ADLTag< 5 >, AlignedNumber< bool, align │ │ │ │ │ +> mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align │ │ │ │ │ +> &ifFalse) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:535 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e │ │ │ │ │ +T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ +DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_M_e_t_a_T_y_p_e │ │ │ │ │ +A type that refers to another type. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:33 │ │ │ │ │ +_i_n_t_e_r_f_a_c_e_._h_h │ │ │ │ │ +User interface of the SIMD abstraction. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00155.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: stdstreams.cc File Reference │ │ │ │ +dune-common: test.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,53 +65,25 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -Namespaces | │ │ │ │ -Variables
    │ │ │ │ -
    stdstreams.cc File Reference
    │ │ │ │ +
    test.cc File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include "stdstreams.hh"
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Namespaces

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

    │ │ │ │ -Variables

    DVVerbType Dune::dvverb (std::cout)
     stream for very verbose output.
     
    DVerbType Dune::dverb (std::cout)
     Singleton of verbose debug stream.
     
    DInfoType Dune::dinfo (std::cout)
     Stream for informative output.
     
    DWarnType Dune::dwarn (std::cerr)
     Stream for warnings indicating problems.
     
    DGraveType Dune::dgrave (std::cerr)
     Stream for warnings indicating fatal errors.
     
    DErrType Dune::derr (std::cerr)
     Stream for error messages.
     
    │ │ │ │ -
    │ │ │ │ +
    #include <config.h>
    │ │ │ │ +#include <ostream>
    │ │ │ │ +#include <string>
    │ │ │ │ +#include <dune/common/simd/test.hh>
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,34 +1,14 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _V_a_r_i_a_b_l_e_s │ │ │ │ │ -stdstreams.cc File Reference │ │ │ │ │ -#include "_s_t_d_s_t_r_e_a_m_s_._h_h" │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -VVaarriiaabblleess │ │ │ │ │ -_D_V_V_e_r_b_T_y_p_e  _D_u_n_e_:_:_d_v_v_e_r_b (std::cout) │ │ │ │ │ -  stream for very verbose output. │ │ │ │ │ -  │ │ │ │ │ - _D_V_e_r_b_T_y_p_e  _D_u_n_e_:_:_d_v_e_r_b (std::cout) │ │ │ │ │ -  _S_i_n_g_l_e_t_o_n of verbose debug stream. │ │ │ │ │ -  │ │ │ │ │ - _D_I_n_f_o_T_y_p_e  _D_u_n_e_:_:_d_i_n_f_o (std::cout) │ │ │ │ │ -  Stream for informative output. │ │ │ │ │ -  │ │ │ │ │ - _D_W_a_r_n_T_y_p_e  _D_u_n_e_:_:_d_w_a_r_n (std::cerr) │ │ │ │ │ -  Stream for warnings indicating problems. │ │ │ │ │ -  │ │ │ │ │ -_D_G_r_a_v_e_T_y_p_e  _D_u_n_e_:_:_d_g_r_a_v_e (std::cerr) │ │ │ │ │ -  Stream for warnings indicating fatal errors. │ │ │ │ │ -  │ │ │ │ │ - _D_E_r_r_T_y_p_e  _D_u_n_e_:_:_d_e_r_r (std::cerr) │ │ │ │ │ -  Stream for error messages. │ │ │ │ │ -  │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +test.cc File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_t_e_s_t_._h_h> │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00158.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: diagonalmatrix.hh File Reference │ │ │ │ +dune-common: io.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,80 +65,76 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces
    │ │ │ │ -
    diagonalmatrix.hh File Reference
    │ │ │ │ +Namespaces | │ │ │ │ +Functions
    │ │ │ │ + │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    This file implements a quadratic diagonal matrix of fixed size. │ │ │ │ +

    IO interface of the SIMD abstraction. │ │ │ │ More...

    │ │ │ │ -
    #include <algorithm>
    │ │ │ │ -#include <cassert>
    │ │ │ │ -#include <cmath>
    │ │ │ │ -#include <complex>
    │ │ │ │ -#include <cstddef>
    │ │ │ │ -#include <initializer_list>
    │ │ │ │ -#include <iostream>
    │ │ │ │ -#include <memory>
    │ │ │ │ -#include <dune/common/boundschecking.hh>
    │ │ │ │ -#include <dune/common/densematrix.hh>
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -#include <dune/common/fmatrix.hh>
    │ │ │ │ -#include <dune/common/fvector.hh>
    │ │ │ │ -#include <dune/common/genericiterator.hh>
    │ │ │ │ -#include <dune/common/typetraits.hh>
    │ │ │ │ +
    #include <ios>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <dune/common/rangeutilities.hh>
    │ │ │ │ +#include <dune/common/simd/simd.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::DiagonalMatrix< K, n >
     A diagonal matrix of static size. More...
     
    struct  Dune::FieldTraits< DiagonalMatrix< K, n > >
     
    class  Dune::DiagonalMatrixWrapper< DiagonalMatrixType >
     
    class  Dune::DiagonalRowVectorConst< K, n >
     
    class  Dune::DiagonalRowVector< K, n >
     
    struct  Dune::const_reference< DiagonalRowVector< K, n > >
     
    struct  Dune::const_reference< DiagonalRowVectorConst< K, n > >
     
    struct  Dune::mutable_reference< DiagonalRowVector< K, n > >
     
    struct  Dune::mutable_reference< DiagonalRowVectorConst< K, n > >
     
    class  Dune::ContainerWrapperIterator< CW, T, R >
     Iterator class for sparse vector-like containers. More...
     
    struct  Dune::DenseMatrixAssigner< DenseMatrix, DiagonalMatrix< field, N > >
    class  Dune::SimdImpl::Inserter< T >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::SimdImpl
     
    namespace  Dune::Simd
     Namespace for vectorization interface functions used by library developers.
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Functions

    template<class V , class = std::enable_if_t<Simd::lanes<V>() != 1>>
    Inserter< V > Dune::SimdImpl::io (const V &v)
     
    template<class V , class = std::enable_if_t<Simd::lanes<V>() == 1>>
    Simd::Scalar< V > Dune::SimdImpl::io (const V &v)
     
    IO interface

    Templates and functions in this group provide syntactic sugar for IO. They are implemented using the functionality from SimdInterfaceBase, and are not customizable by implementations.

    │ │ │ │ +
    template<class V >
    auto Dune::Simd::vio (const V &v)
     construct a stream inserter
     
    template<class V >
    auto Dune::Simd::io (const V &v)
     construct a stream inserter
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    This file implements a quadratic diagonal matrix of fixed size.

    │ │ │ │ +

    IO interface of the SIMD abstraction.

    │ │ │ │ +

    This file provides IO interface functions of the SIMD abstraction layer.

    │ │ │ │ +

    This file is intended for direct inclusion by header making use of the IO interface.

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,58 +1,56 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -diagonalmatrix.hh File Reference │ │ │ │ │ -This file implements a quadratic diagonal matrix of fixed size. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_m_a_t_r_i_x_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h> │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +_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 │ │ │ │ │ +_C_o_m_m_o_n » _V_e_c_t_o_r_i_z_a_t_i_o_n » _L_i_b_r_a_r_y_ _D_e_v_e_l_o_p_e_r_'_s_ _I_n_t_e_r_f_a_c_e │ │ │ │ │ +IO interface of the SIMD abstraction. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ #include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_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_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _> │ │ │ │ │ -  A diagonal matrix of static size. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_T_y_p_e_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_ _K_,_ _n_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_ _K_,_ _n_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_ _K_,_ _n_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_ _K_,_ _n_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_ _K_,_ _n_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_ _K_,_ _n_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_<_ _C_W_,_ _T_,_ _R_ _> │ │ │ │ │ -  Iterator class for sparse vector-like containers. _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_,_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _f_i_e_l_d_,_ _N_ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d_I_m_p_l │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ +  Namespace for vectorization interface functions used by library │ │ │ │ │ + developers. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template() != 1>> │ │ │ │ │ + _I_n_s_e_r_t_e_r< V >  _D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_i_o (const V &v) │ │ │ │ │ +  │ │ │ │ │ +template() == 1>> │ │ │ │ │ +_S_i_m_d_:_:_S_c_a_l_a_r< V >  _D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_i_o (const V &v) │ │ │ │ │ +  │ │ │ │ │ +IO interface │ │ │ │ │ +Templates and functions in this group provide syntactic sugar for IO. They are │ │ │ │ │ +implemented using the functionality from SimdInterfaceBase, and are not │ │ │ │ │ +customizable by implementations. │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_v_i_o (const V &v) │ │ │ │ │ +  construct a stream inserter │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_S_i_m_d_:_:_i_o (const V &v) │ │ │ │ │ +  construct a stream inserter │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements a quadratic diagonal matrix of fixed size. │ │ │ │ │ +IO interface of the SIMD abstraction. │ │ │ │ │ +This file provides IO interface functions of the SIMD abstraction layer. │ │ │ │ │ +This file is intended for direct inclusion by header making use of the IO │ │ │ │ │ +interface. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00158_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: diagonalmatrix.hh Source File │ │ │ │ +dune-common: io.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1357 +70,125 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    diagonalmatrix.hh
    │ │ │ │ +
    io.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_DIAGONAL_MATRIX_HH
    │ │ │ │ -
    6#define DUNE_DIAGONAL_MATRIX_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    12#include <algorithm>
    │ │ │ │ -
    13#include <cassert>
    │ │ │ │ -
    14#include <cmath>
    │ │ │ │ -
    15#include <complex>
    │ │ │ │ -
    16#include <cstddef>
    │ │ │ │ -
    17#include <initializer_list>
    │ │ │ │ -
    18#include <iostream>
    │ │ │ │ -
    19#include <memory>
    │ │ │ │ -
    20
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    28
    │ │ │ │ -
    29
    │ │ │ │ -
    30namespace Dune {
    │ │ │ │ -
    31
    │ │ │ │ -
    32 template< class K, int n > class DiagonalRowVectorConst;
    │ │ │ │ -
    33 template< class K, int n > class DiagonalRowVector;
    │ │ │ │ -
    34 template< class DiagonalMatrixType > class DiagonalMatrixWrapper;
    │ │ │ │ -
    35 template< class C, class T, class R> class ContainerWrapperIterator;
    │ │ │ │ -
    36
    │ │ │ │ -
    51 template<class K, int n>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    53 {
    │ │ │ │ - │ │ │ │ -
    55
    │ │ │ │ -
    56 public:
    │ │ │ │ -
    57 //===== type definitions and constants
    │ │ │ │ -
    58
    │ │ │ │ -
    60 typedef K value_type;
    │ │ │ │ - │ │ │ │ -
    62
    │ │ │ │ -
    64 typedef K block_type;
    │ │ │ │ -
    65
    │ │ │ │ -
    67 typedef std::size_t size_type;
    │ │ │ │ -
    68
    │ │ │ │ -
    70 constexpr static int blocklevel = 1;
    │ │ │ │ -
    71
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    79
    │ │ │ │ -
    81 constexpr static int rows = n;
    │ │ │ │ -
    83 constexpr static int cols = n;
    │ │ │ │ -
    84
    │ │ │ │ -
    85 //==== size
    │ │ │ │ -
    86
    │ │ │ │ -
    │ │ │ │ -
    87 static constexpr size_type size ()
    │ │ │ │ -
    88 {
    │ │ │ │ -
    89 return rows;
    │ │ │ │ -
    90 }
    │ │ │ │ -
    │ │ │ │ -
    91
    │ │ │ │ -
    92 //===== constructors
    │ │ │ │ -
    93
    │ │ │ │ -
    95 constexpr DiagonalMatrix() = default;
    │ │ │ │ -
    96
    │ │ │ │ -
    │ │ │ │ -
    98 DiagonalMatrix (const K& k)
    │ │ │ │ -
    99 : diag_(k)
    │ │ │ │ -
    100 {}
    │ │ │ │ -
    │ │ │ │ -
    101
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    104 : diag_(diag)
    │ │ │ │ -
    105 {}
    │ │ │ │ -
    │ │ │ │ -
    106
    │ │ │ │ -
    │ │ │ │ -
    115 DiagonalMatrix (std::initializer_list<K> const &l)
    │ │ │ │ -
    116 {
    │ │ │ │ -
    117 std::copy_n(l.begin(), std::min(static_cast<std::size_t>(rows),
    │ │ │ │ -
    118 l.size()),
    │ │ │ │ -
    119 diag_.begin());
    │ │ │ │ -
    120 }
    │ │ │ │ -
    │ │ │ │ -
    121
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    124 {
    │ │ │ │ -
    125 diag_ = k;
    │ │ │ │ -
    126 return *this;
    │ │ │ │ -
    127 }
    │ │ │ │ -
    │ │ │ │ -
    128
    │ │ │ │ -
    │ │ │ │ -
    130 bool identical(const DiagonalMatrix<K,n>& other) const
    │ │ │ │ -
    131 {
    │ │ │ │ -
    132 return (this==&other);
    │ │ │ │ -
    133 }
    │ │ │ │ -
    │ │ │ │ -
    134
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    137 {
    │ │ │ │ -
    138 return *this;
    │ │ │ │ -
    139 }
    │ │ │ │ -
    │ │ │ │ -
    140
    │ │ │ │ -
    141 //===== iterator interface to rows of the matrix
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    150
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    153 {
    │ │ │ │ -
    154 return Iterator(WrapperType(this),0);
    │ │ │ │ -
    155 }
    │ │ │ │ -
    │ │ │ │ -
    156
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    159 {
    │ │ │ │ -
    160 return Iterator(WrapperType(this),n);
    │ │ │ │ -
    161 }
    │ │ │ │ -
    │ │ │ │ -
    162
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    166 {
    │ │ │ │ -
    167 return Iterator(WrapperType(this),n-1);
    │ │ │ │ -
    168 }
    │ │ │ │ -
    │ │ │ │ -
    169
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    173 {
    │ │ │ │ -
    174 return Iterator(WrapperType(this),-1);
    │ │ │ │ -
    175 }
    │ │ │ │ -
    │ │ │ │ -
    176
    │ │ │ │ -
    177
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    186
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    189 {
    │ │ │ │ -
    190 return ConstIterator(WrapperType(this),0);
    │ │ │ │ -
    191 }
    │ │ │ │ -
    │ │ │ │ -
    192
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    195 {
    │ │ │ │ -
    196 return ConstIterator(WrapperType(this),n);
    │ │ │ │ -
    197 }
    │ │ │ │ -
    │ │ │ │ -
    198
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    202 {
    │ │ │ │ -
    203 return ConstIterator(WrapperType(this),n-1);
    │ │ │ │ -
    204 }
    │ │ │ │ -
    │ │ │ │ -
    205
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    209 {
    │ │ │ │ -
    210 return ConstIterator(WrapperType(this),-1);
    │ │ │ │ -
    211 }
    │ │ │ │ -
    │ │ │ │ -
    212
    │ │ │ │ -
    213
    │ │ │ │ -
    214
    │ │ │ │ -
    215 //===== vector space arithmetic
    │ │ │ │ -
    216
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    219 {
    │ │ │ │ -
    220 diag_ += y.diag_;
    │ │ │ │ -
    221 return *this;
    │ │ │ │ -
    222 }
    │ │ │ │ -
    │ │ │ │ -
    223
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    226 {
    │ │ │ │ -
    227 diag_ -= y.diag_;
    │ │ │ │ -
    228 return *this;
    │ │ │ │ -
    229 }
    │ │ │ │ -
    │ │ │ │ -
    230
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    233 {
    │ │ │ │ -
    234 diag_ += k;
    │ │ │ │ -
    235 return *this;
    │ │ │ │ -
    236 }
    │ │ │ │ -
    │ │ │ │ -
    237
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    240 {
    │ │ │ │ -
    241 diag_ -= k;
    │ │ │ │ -
    242 return *this;
    │ │ │ │ -
    243 }
    │ │ │ │ -
    │ │ │ │ -
    244
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    247 {
    │ │ │ │ -
    248 diag_ *= k;
    │ │ │ │ -
    249 return *this;
    │ │ │ │ -
    250 }
    │ │ │ │ -
    │ │ │ │ -
    251
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    254 {
    │ │ │ │ -
    255 diag_ /= k;
    │ │ │ │ -
    256 return *this;
    │ │ │ │ -
    257 }
    │ │ │ │ -
    │ │ │ │ -
    258
    │ │ │ │ -
    259 //===== comparison ops
    │ │ │ │ -
    260
    │ │ │ │ -
    │ │ │ │ -
    262 bool operator==(const DiagonalMatrix& other) const
    │ │ │ │ -
    263 {
    │ │ │ │ -
    264 return diag_==other.diagonal();
    │ │ │ │ -
    265 }
    │ │ │ │ -
    │ │ │ │ -
    266
    │ │ │ │ -
    │ │ │ │ -
    268 bool operator!=(const DiagonalMatrix& other) const
    │ │ │ │ -
    269 {
    │ │ │ │ -
    270 return diag_!=other.diagonal();
    │ │ │ │ -
    271 }
    │ │ │ │ -
    │ │ │ │ -
    272
    │ │ │ │ -
    273
    │ │ │ │ -
    274 //===== linear maps
    │ │ │ │ -
    275
    │ │ │ │ -
    277 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    278 void mv (const X& x, Y& y) const
    │ │ │ │ -
    279 {
    │ │ │ │ -
    280#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    281 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    282 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    283#endif
    │ │ │ │ -
    284 for (size_type i=0; i<n; ++i)
    │ │ │ │ -
    285 y[i] = diag_[i] * x[i];
    │ │ │ │ -
    286 }
    │ │ │ │ -
    │ │ │ │ -
    287
    │ │ │ │ -
    289 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    290 void mtv (const X& x, Y& y) const
    │ │ │ │ -
    291 {
    │ │ │ │ -
    292 mv(x, y);
    │ │ │ │ -
    293 }
    │ │ │ │ -
    │ │ │ │ -
    294
    │ │ │ │ -
    296 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    297 void umv (const X& x, Y& y) const
    │ │ │ │ -
    298 {
    │ │ │ │ -
    299#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    300 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    301 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    302#endif
    │ │ │ │ -
    303 for (size_type i=0; i<n; ++i)
    │ │ │ │ -
    304 y[i] += diag_[i] * x[i];
    │ │ │ │ -
    305 }
    │ │ │ │ -
    │ │ │ │ -
    306
    │ │ │ │ -
    308 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    309 void umtv (const X& x, Y& y) const
    │ │ │ │ -
    310 {
    │ │ │ │ -
    311#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    312 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    313 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    314#endif
    │ │ │ │ -
    315 for (size_type i=0; i<n; ++i)
    │ │ │ │ -
    316 y[i] += diag_[i] * x[i];
    │ │ │ │ -
    317 }
    │ │ │ │ -
    │ │ │ │ -
    318
    │ │ │ │ -
    320 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    321 void umhv (const X& x, Y& y) const
    │ │ │ │ -
    322 {
    │ │ │ │ -
    323#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    324 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    325 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    326#endif
    │ │ │ │ -
    327 for (size_type i=0; i<n; i++)
    │ │ │ │ -
    328 y[i] += conjugateComplex(diag_[i])*x[i];
    │ │ │ │ -
    329 }
    │ │ │ │ -
    │ │ │ │ -
    330
    │ │ │ │ -
    332 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    333 void mmv (const X& x, Y& y) const
    │ │ │ │ -
    334 {
    │ │ │ │ -
    335#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    336 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    337 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    338#endif
    │ │ │ │ -
    339 for (size_type i=0; i<n; ++i)
    │ │ │ │ -
    340 y[i] -= diag_[i] * x[i];
    │ │ │ │ -
    341 }
    │ │ │ │ -
    │ │ │ │ -
    342
    │ │ │ │ -
    344 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    345 void mmtv (const X& x, Y& y) const
    │ │ │ │ -
    346 {
    │ │ │ │ -
    347#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    348 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    349 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    350#endif
    │ │ │ │ -
    351 for (size_type i=0; i<n; ++i)
    │ │ │ │ -
    352 y[i] -= diag_[i] * x[i];
    │ │ │ │ -
    353 }
    │ │ │ │ -
    │ │ │ │ -
    354
    │ │ │ │ -
    356 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    357 void mmhv (const X& x, Y& y) const
    │ │ │ │ -
    358 {
    │ │ │ │ -
    359#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    360 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    361 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    362#endif
    │ │ │ │ -
    363 for (size_type i=0; i<n; i++)
    │ │ │ │ -
    364 y[i] -= conjugateComplex(diag_[i])*x[i];
    │ │ │ │ -
    365 }
    │ │ │ │ -
    │ │ │ │ -
    366
    │ │ │ │ -
    368 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    369 void usmv (const typename FieldTraits<Y>::field_type & alpha,
    │ │ │ │ -
    370 const X& x, Y& y) const
    │ │ │ │ -
    371 {
    │ │ │ │ -
    372#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    373 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    374 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    375#endif
    │ │ │ │ -
    376 for (size_type i=0; i<n; i++)
    │ │ │ │ -
    377 y[i] += alpha * diag_[i] * x[i];
    │ │ │ │ -
    378 }
    │ │ │ │ -
    │ │ │ │ -
    379
    │ │ │ │ -
    381 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    382 void usmtv (const typename FieldTraits<Y>::field_type & alpha,
    │ │ │ │ -
    383 const X& x, Y& y) const
    │ │ │ │ -
    384 {
    │ │ │ │ -
    385#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    386 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    387 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    388#endif
    │ │ │ │ -
    389 for (size_type i=0; i<n; i++)
    │ │ │ │ -
    390 y[i] += alpha * diag_[i] * x[i];
    │ │ │ │ -
    391 }
    │ │ │ │ -
    │ │ │ │ -
    392
    │ │ │ │ -
    394 template<class X, class Y>
    │ │ │ │ -
    │ │ │ │ -
    395 void usmhv (const typename FieldTraits<Y>::field_type & alpha,
    │ │ │ │ -
    396 const X& x, Y& y) const
    │ │ │ │ -
    397 {
    │ │ │ │ -
    398#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ -
    399 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    400 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
    │ │ │ │ -
    401#endif
    │ │ │ │ -
    402 for (size_type i=0; i<n; i++)
    │ │ │ │ -
    403 y[i] += alpha * conjugateComplex(diag_[i]) * x[i];
    │ │ │ │ -
    404 }
    │ │ │ │ -
    │ │ │ │ -
    405
    │ │ │ │ -
    406 //===== norms
    │ │ │ │ -
    407
    │ │ │ │ -
    │ │ │ │ -
    409 double frobenius_norm () const
    │ │ │ │ -
    410 {
    │ │ │ │ -
    411 return diag_.two_norm();
    │ │ │ │ -
    412 }
    │ │ │ │ -
    │ │ │ │ -
    413
    │ │ │ │ -
    │ │ │ │ -
    415 double frobenius_norm2 () const
    │ │ │ │ -
    416 {
    │ │ │ │ -
    417 return diag_.two_norm2();
    │ │ │ │ -
    418 }
    │ │ │ │ -
    │ │ │ │ -
    419
    │ │ │ │ -
    │ │ │ │ -
    421 double infinity_norm () const
    │ │ │ │ -
    422 {
    │ │ │ │ -
    423 return diag_.infinity_norm();
    │ │ │ │ -
    424 }
    │ │ │ │ -
    │ │ │ │ -
    425
    │ │ │ │ -
    │ │ │ │ -
    427 double infinity_norm_real () const
    │ │ │ │ -
    428 {
    │ │ │ │ -
    429 return diag_.infinity_norm_real();
    │ │ │ │ -
    430 }
    │ │ │ │ -
    │ │ │ │ -
    431
    │ │ │ │ -
    432
    │ │ │ │ -
    433
    │ │ │ │ -
    434 //===== solve
    │ │ │ │ -
    435
    │ │ │ │ -
    437 template<class V>
    │ │ │ │ -
    │ │ │ │ -
    438 void solve (V& x, const V& b) const
    │ │ │ │ -
    439 {
    │ │ │ │ -
    440 for (int i=0; i<n; i++)
    │ │ │ │ -
    441 x[i] = b[i]/diag_[i];
    │ │ │ │ -
    442 }
    │ │ │ │ -
    │ │ │ │ -
    443
    │ │ │ │ -
    │ │ │ │ -
    445 void invert()
    │ │ │ │ -
    446 {
    │ │ │ │ -
    447 using real_type = typename FieldTraits<K>::real_type;
    │ │ │ │ -
    448 for (int i=0; i<n; i++)
    │ │ │ │ -
    449 diag_[i] = real_type(1.0)/diag_[i];
    │ │ │ │ -
    450 }
    │ │ │ │ -
    │ │ │ │ -
    451
    │ │ │ │ -
    │ │ │ │ -
    453 K determinant () const
    │ │ │ │ -
    454 {
    │ │ │ │ -
    455 K det = diag_[0];
    │ │ │ │ -
    456 for (int i=1; i<n; i++)
    │ │ │ │ -
    457 det *= diag_[i];
    │ │ │ │ -
    458 return det;
    │ │ │ │ -
    459 }
    │ │ │ │ -
    │ │ │ │ -
    460
    │ │ │ │ -
    461
    │ │ │ │ -
    462
    │ │ │ │ -
    463 //===== matrix-matrix multiplication
    │ │ │ │ -
    464
    │ │ │ │ -
    467 template <class OtherScalar>
    │ │ │ │ -
    │ │ │ │ -
    468 friend auto operator* ( const DiagonalMatrix& matrixA,
    │ │ │ │ -
    469 const DiagonalMatrix<OtherScalar, n>& matrixB)
    │ │ │ │ -
    470 {
    │ │ │ │ - │ │ │ │ -
    472 for(int i=0; i<n; ++i)
    │ │ │ │ -
    473 result.diagonal(i) = matrixA.diagonal(i)*matrixB.diagonal(i);
    │ │ │ │ -
    474 return result;
    │ │ │ │ -
    475 }
    │ │ │ │ -
    │ │ │ │ -
    476
    │ │ │ │ -
    477
    │ │ │ │ -
    478
    │ │ │ │ -
    479 //===== sizes
    │ │ │ │ -
    480
    │ │ │ │ -
    │ │ │ │ -
    482 static constexpr size_type N ()
    │ │ │ │ -
    483 {
    │ │ │ │ -
    484 return n;
    │ │ │ │ -
    485 }
    │ │ │ │ -
    │ │ │ │ -
    486
    │ │ │ │ -
    │ │ │ │ -
    488 static constexpr size_type M ()
    │ │ │ │ -
    489 {
    │ │ │ │ -
    490 return n;
    │ │ │ │ -
    491 }
    │ │ │ │ -
    │ │ │ │ -
    492
    │ │ │ │ -
    493
    │ │ │ │ -
    494
    │ │ │ │ -
    495 //===== query
    │ │ │ │ -
    496
    │ │ │ │ -
    │ │ │ │ -
    498 bool exists (size_type i, size_type j) const
    │ │ │ │ -
    499 {
    │ │ │ │ -
    500 DUNE_ASSERT_BOUNDS(i >= 0 && i < n);
    │ │ │ │ -
    501 DUNE_ASSERT_BOUNDS(j >= 0 && j < n);
    │ │ │ │ -
    502 return i==j;
    │ │ │ │ -
    503 }
    │ │ │ │ -
    │ │ │ │ -
    504
    │ │ │ │ -
    505
    │ │ │ │ -
    506
    │ │ │ │ -
    │ │ │ │ -
    508 friend std::ostream& operator<< (std::ostream& s, const DiagonalMatrix<K,n>& a)
    │ │ │ │ -
    509 {
    │ │ │ │ -
    510 for (size_type i=0; i<n; i++) {
    │ │ │ │ -
    511 for (size_type j=0; j<n; j++)
    │ │ │ │ -
    512 s << ((i==j) ? a.diag_[i] : 0) << " ";
    │ │ │ │ -
    513 s << std::endl;
    │ │ │ │ -
    514 }
    │ │ │ │ -
    515 return s;
    │ │ │ │ -
    516 }
    │ │ │ │ -
    │ │ │ │ -
    517
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    520 {
    │ │ │ │ -
    521 return reference(const_cast<K*>(&diag_[i]), i);
    │ │ │ │ -
    522 }
    │ │ │ │ -
    │ │ │ │ -
    523
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    526 {
    │ │ │ │ -
    527 return const_reference(const_cast<K*>(&diag_[i]), i);
    │ │ │ │ -
    528 }
    │ │ │ │ -
    │ │ │ │ -
    529
    │ │ │ │ -
    │ │ │ │ -
    531 const K& diagonal(size_type i) const
    │ │ │ │ -
    532 {
    │ │ │ │ -
    533 return diag_[i];
    │ │ │ │ -
    534 }
    │ │ │ │ -
    │ │ │ │ -
    535
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    538 {
    │ │ │ │ -
    539 return diag_[i];
    │ │ │ │ -
    540 }
    │ │ │ │ -
    │ │ │ │ -
    541
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    544 {
    │ │ │ │ -
    545 return diag_;
    │ │ │ │ -
    546 }
    │ │ │ │ -
    │ │ │ │ -
    547
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    550 {
    │ │ │ │ -
    551 return diag_;
    │ │ │ │ -
    552 }
    │ │ │ │ -
    │ │ │ │ -
    553
    │ │ │ │ -
    554 private:
    │ │ │ │ -
    555
    │ │ │ │ -
    556 // the data, a FieldVector storing the diagonal
    │ │ │ │ -
    557 FieldVector<K,n> diag_;
    │ │ │ │ -
    558 };
    │ │ │ │ -
    │ │ │ │ -
    559
    │ │ │ │ -
    560 template< class K, int n >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    562 {
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    565 };
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_SIMD_IO_HH
    │ │ │ │ +
    4#define DUNE_COMMON_SIMD_IO_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    16#include <ios>
    │ │ │ │ +
    17#include <type_traits>
    │ │ │ │ +
    18
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    22
    │ │ │ │ +
    23namespace Dune {
    │ │ │ │ +
    24
    │ │ │ │ +
    │ │ │ │ +
    25 namespace SimdImpl {
    │ │ │ │ +
    26
    │ │ │ │ +
    27 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    28 class Inserter {
    │ │ │ │ +
    29 T value_;
    │ │ │ │ +
    30
    │ │ │ │ +
    31 public:
    │ │ │ │ +
    32 Inserter(const T &value) : value_(value) {}
    │ │ │ │ +
    33
    │ │ │ │ +
    34 template<class Stream,
    │ │ │ │ +
    35 class = std::enable_if_t<std::is_base_of<std::ios_base,
    │ │ │ │ +
    36 Stream>::value> >
    │ │ │ │ +
    │ │ │ │ +
    37 friend Stream& operator<<(Stream &out, const Inserter &ins)
    │ │ │ │ +
    38 {
    │ │ │ │ +
    39 const char *sep = "<";
    │ │ │ │ +
    40 for(auto l : range(Simd::lanes(ins.value_)))
    │ │ │ │ +
    41 {
    │ │ │ │ +
    42 out << sep << autoCopy(Simd::lane(l, ins.value_));
    │ │ │ │ +
    43 sep = ", ";
    │ │ │ │ +
    44 }
    │ │ │ │ +
    45 out << '>';
    │ │ │ │ +
    46 return out;
    │ │ │ │ +
    47 }
    │ │ │ │ +
    │ │ │ │ +
    48 };
    │ │ │ │ +
    │ │ │ │ +
    49
    │ │ │ │ +
    50 template<class V, class = std::enable_if_t<Simd::lanes<V>() != 1> >
    │ │ │ │ +
    │ │ │ │ +
    51 Inserter<V> io(const V &v)
    │ │ │ │ +
    52 {
    │ │ │ │ +
    53 return { v };
    │ │ │ │ +
    54 }
    │ │ │ │
    │ │ │ │ -
    566
    │ │ │ │ -
    567
    │ │ │ │ -
    568#ifndef DOXYGEN // hide specialization
    │ │ │ │ -
    571 template< class K >
    │ │ │ │ -
    572 class DiagonalMatrix<K, 1> : public FieldMatrix<K, 1, 1>
    │ │ │ │ -
    573 {
    │ │ │ │ -
    574 typedef FieldMatrix<K,1,1> Base;
    │ │ │ │ -
    575 public:
    │ │ │ │ -
    577 typedef typename Base::size_type size_type;
    │ │ │ │ -
    578
    │ │ │ │ -
    581 constexpr static int blocklevel = 1;
    │ │ │ │ -
    582
    │ │ │ │ -
    583 typedef typename Base::row_type row_type;
    │ │ │ │ -
    584
    │ │ │ │ -
    585 typedef typename Base::row_reference row_reference;
    │ │ │ │ -
    586 typedef typename Base::const_row_reference const_row_reference;
    │ │ │ │ -
    587
    │ │ │ │ -
    590 constexpr static int rows = 1;
    │ │ │ │ -
    593 constexpr static int cols = 1;
    │ │ │ │ -
    594
    │ │ │ │ -
    595
    │ │ │ │ -
    597 constexpr DiagonalMatrix() = default;
    │ │ │ │ -
    598
    │ │ │ │ -
    600 DiagonalMatrix(const K& scalar)
    │ │ │ │ -
    601 {
    │ │ │ │ -
    602 (*this)[0][0] = scalar;
    │ │ │ │ -
    603 }
    │ │ │ │ -
    604
    │ │ │ │ -
    606 const K& diagonal(size_type) const
    │ │ │ │ -
    607 {
    │ │ │ │ -
    608 return (*this)[0][0];
    │ │ │ │ -
    609 }
    │ │ │ │ -
    610
    │ │ │ │ - │ │ │ │ -
    613 {
    │ │ │ │ -
    614 return (*this)[0][0];
    │ │ │ │ -
    615 }
    │ │ │ │ -
    616
    │ │ │ │ -
    618 const FieldVector<K,1>& diagonal() const
    │ │ │ │ -
    619 {
    │ │ │ │ -
    620 return (*this)[0];
    │ │ │ │ -
    621 }
    │ │ │ │ -
    622
    │ │ │ │ -
    624 FieldVector<K,1>& diagonal()
    │ │ │ │ -
    625 {
    │ │ │ │ -
    626 return (*this)[0];
    │ │ │ │ -
    627 }
    │ │ │ │ -
    628
    │ │ │ │ -
    630 DiagonalMatrix<K, 1> transposed() const
    │ │ │ │ -
    631 {
    │ │ │ │ -
    632 return *this;
    │ │ │ │ -
    633 }
    │ │ │ │ -
    634
    │ │ │ │ -
    637 template <class OtherScalar>
    │ │ │ │ -
    638 friend auto operator* ( const DiagonalMatrix& matrixA,
    │ │ │ │ -
    639 const DiagonalMatrix<OtherScalar, 1>& matrixB)
    │ │ │ │ -
    640 {
    │ │ │ │ -
    641 return DiagonalMatrix<typename PromotionTraits<K,OtherScalar>::PromotedType, 1>{matrixA.diagonal(0)*matrixB.diagonal(0)};
    │ │ │ │ -
    642 }
    │ │ │ │ -
    643
    │ │ │ │ -
    644 };
    │ │ │ │ -
    645#endif
    │ │ │ │ -
    646
    │ │ │ │ -
    647
    │ │ │ │ -
    648 template<class DiagonalMatrixType>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    650 {
    │ │ │ │ -
    651 typedef typename DiagonalMatrixType::reference reference;
    │ │ │ │ -
    652 typedef typename DiagonalMatrixType::const_reference const_reference;
    │ │ │ │ -
    653 typedef typename DiagonalMatrixType::field_type K;
    │ │ │ │ - │ │ │ │ -
    655 typedef std::size_t size_type;
    │ │ │ │ - │ │ │ │ -
    657
    │ │ │ │ -
    658 friend class ContainerWrapperIterator<const MyType, reference, reference>;
    │ │ │ │ -
    659 friend class ContainerWrapperIterator<const MyType, const_reference, const_reference>;
    │ │ │ │ -
    660
    │ │ │ │ -
    661 public:
    │ │ │ │ -
    662
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    664 mat_(0)
    │ │ │ │ -
    665 {}
    │ │ │ │ -
    │ │ │ │ -
    666
    │ │ │ │ -
    │ │ │ │ -
    667 DiagonalMatrixWrapper(const DiagonalMatrixType* mat) :
    │ │ │ │ -
    668 mat_(const_cast<DiagonalMatrixType*>(mat))
    │ │ │ │ -
    669 {}
    │ │ │ │ -
    │ │ │ │ -
    670
    │ │ │ │ -
    │ │ │ │ -
    671 size_type realIndex(int i) const
    │ │ │ │ -
    672 {
    │ │ │ │ -
    673 return i;
    │ │ │ │ -
    674 }
    │ │ │ │ -
    │ │ │ │ -
    675
    │ │ │ │ -
    │ │ │ │ -
    676 row_type* pointer(int i) const
    │ │ │ │ -
    677 {
    │ │ │ │ -
    678 row_ = row_type(&(mat_->diagonal(i)), i);
    │ │ │ │ -
    679 return &row_;
    │ │ │ │ -
    680 }
    │ │ │ │ -
    │ │ │ │ -
    681
    │ │ │ │ -
    │ │ │ │ -
    682 bool identical(const DiagonalMatrixWrapper& other) const
    │ │ │ │ -
    683 {
    │ │ │ │ -
    684 return mat_==other.mat_;
    │ │ │ │ -
    685 }
    │ │ │ │ -
    │ │ │ │ -
    686
    │ │ │ │ -
    687 private:
    │ │ │ │ -
    688
    │ │ │ │ -
    689 mutable DiagonalMatrixType* mat_;
    │ │ │ │ -
    690 mutable row_type row_;
    │ │ │ │ -
    691 };
    │ │ │ │ -
    │ │ │ │ -
    692
    │ │ │ │ -
    696 template< class K, int n >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    698 {
    │ │ │ │ -
    699 template<class DiagonalMatrixType>
    │ │ │ │ - │ │ │ │ -
    701 friend class ContainerWrapperIterator<DiagonalRowVectorConst<K,n>, const K, const K&>;
    │ │ │ │ -
    702
    │ │ │ │ -
    703 public:
    │ │ │ │ -
    704 // remember size of vector
    │ │ │ │ -
    705 constexpr static int dimension = n;
    │ │ │ │ -
    706
    │ │ │ │ -
    707 // standard constructor and everything is sufficient ...
    │ │ │ │ -
    708
    │ │ │ │ -
    709 //===== type definitions and constants
    │ │ │ │ -
    710
    │ │ │ │ -
    712 typedef K field_type;
    │ │ │ │ -
    713
    │ │ │ │ -
    715 typedef K block_type;
    │ │ │ │ -
    716
    │ │ │ │ -
    718 typedef std::size_t size_type;
    │ │ │ │ -
    719
    │ │ │ │ -
    721 constexpr static int blocklevel = 1;
    │ │ │ │ -
    722
    │ │ │ │ -
    724 constexpr static int size = n;
    │ │ │ │ -
    725
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    728 p_(0),
    │ │ │ │ -
    729 row_(0)
    │ │ │ │ -
    730 {}
    │ │ │ │ -
    │ │ │ │ -
    731
    │ │ │ │ -
    │ │ │ │ -
    733 explicit DiagonalRowVectorConst (K* p, int col) :
    │ │ │ │ -
    734 p_(p),
    │ │ │ │ -
    735 row_(col)
    │ │ │ │ -
    736 {}
    │ │ │ │ -
    │ │ │ │ -
    737
    │ │ │ │ -
    738 //===== access to components
    │ │ │ │ -
    739
    │ │ │ │ -
    │ │ │ │ -
    741 const K& operator[] ([[maybe_unused]] size_type i) const
    │ │ │ │ -
    742 {
    │ │ │ │ - │ │ │ │ -
    744 return *p_;
    │ │ │ │ -
    745 }
    │ │ │ │ -
    │ │ │ │ -
    746
    │ │ │ │ -
    747 // check if row is identical to other row (not only identical values)
    │ │ │ │ -
    748 // since this is a proxy class we need to check equality of the stored pointer
    │ │ │ │ -
    │ │ │ │ -
    749 bool identical(const DiagonalRowVectorConst<K,n>& other) const
    │ │ │ │ -
    750 {
    │ │ │ │ -
    751 return ((p_ == other.p_)and (row_ == other.row_));
    │ │ │ │ -
    752 }
    │ │ │ │ -
    │ │ │ │ -
    753
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    758
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    761 {
    │ │ │ │ -
    762 return ConstIterator(*this,0);
    │ │ │ │ -
    763 }
    │ │ │ │ -
    │ │ │ │ -
    764
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    767 {
    │ │ │ │ -
    768 return ConstIterator(*this,1);
    │ │ │ │ -
    769 }
    │ │ │ │ -
    │ │ │ │ -
    770
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    774 {
    │ │ │ │ -
    775 return ConstIterator(*this,0);
    │ │ │ │ -
    776 }
    │ │ │ │ -
    │ │ │ │ -
    777
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    781 {
    │ │ │ │ -
    782 return ConstIterator(*this,-1);
    │ │ │ │ -
    783 }
    │ │ │ │ -
    │ │ │ │ -
    784
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    787 {
    │ │ │ │ -
    788 return ((p_==y.p_)and (row_==y.row_));
    │ │ │ │ -
    789 }
    │ │ │ │ -
    │ │ │ │ -
    790
    │ │ │ │ -
    791 //===== sizes
    │ │ │ │ -
    792
    │ │ │ │ -
    │ │ │ │ -
    794 size_type N () const
    │ │ │ │ -
    795 {
    │ │ │ │ -
    796 return n;
    │ │ │ │ -
    797 }
    │ │ │ │ -
    │ │ │ │ -
    798
    │ │ │ │ -
    │ │ │ │ -
    800 size_type dim () const
    │ │ │ │ -
    801 {
    │ │ │ │ -
    802 return n;
    │ │ │ │ -
    803 }
    │ │ │ │ -
    │ │ │ │ -
    804
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    807 {
    │ │ │ │ -
    808 return row_;
    │ │ │ │ -
    809 }
    │ │ │ │ -
    │ │ │ │ -
    810
    │ │ │ │ -
    │ │ │ │ -
    812 const K& diagonal() const
    │ │ │ │ -
    813 {
    │ │ │ │ -
    814 return *p_;
    │ │ │ │ -
    815 }
    │ │ │ │ -
    │ │ │ │ -
    816
    │ │ │ │ -
    817 protected:
    │ │ │ │ -
    818
    │ │ │ │ -
    │ │ │ │ -
    819 size_type realIndex([[maybe_unused]] int i) const
    │ │ │ │ -
    820 {
    │ │ │ │ -
    821 return rowIndex();
    │ │ │ │ -
    822 }
    │ │ │ │ -
    │ │ │ │ -
    823
    │ │ │ │ -
    │ │ │ │ -
    824 K* pointer([[maybe_unused]] size_type i) const
    │ │ │ │ -
    825 {
    │ │ │ │ -
    826 return const_cast<K*>(p_);
    │ │ │ │ -
    827 }
    │ │ │ │ -
    │ │ │ │ -
    828
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    830 {
    │ │ │ │ -
    831 return this;
    │ │ │ │ -
    832 }
    │ │ │ │ -
    │ │ │ │ -
    833
    │ │ │ │ -
    834 // the data, very simply a pointer to the diagonal value and the row number
    │ │ │ │ -
    835 K* p_;
    │ │ │ │ - │ │ │ │ -
    837 };
    │ │ │ │ -
    │ │ │ │ -
    838
    │ │ │ │ -
    839 template< class K, int n >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    841 {
    │ │ │ │ -
    842 template<class DiagonalMatrixType>
    │ │ │ │ - │ │ │ │ -
    844 friend class ContainerWrapperIterator<DiagonalRowVector<K,n>, K, K&>;
    │ │ │ │ -
    845
    │ │ │ │ -
    846 public:
    │ │ │ │ -
    847 // standard constructor and everything is sufficient ...
    │ │ │ │ -
    848
    │ │ │ │ -
    849 //===== type definitions and constants
    │ │ │ │ -
    850
    │ │ │ │ -
    852 typedef K field_type;
    │ │ │ │ -
    853
    │ │ │ │ -
    855 typedef K block_type;
    │ │ │ │ -
    856
    │ │ │ │ -
    858 typedef std::size_t size_type;
    │ │ │ │ -
    859
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    862 {}
    │ │ │ │ -
    │ │ │ │ -
    863
    │ │ │ │ -
    │ │ │ │ -
    865 explicit DiagonalRowVector (K* p, int col) : DiagonalRowVectorConst<K,n>(p, col)
    │ │ │ │ -
    866 {}
    │ │ │ │ -
    │ │ │ │ -
    867
    │ │ │ │ -
    868 //===== assignment from scalar
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    871 {
    │ │ │ │ -
    872 *p_ = k;
    │ │ │ │ -
    873 return *this;
    │ │ │ │ -
    874 }
    │ │ │ │ -
    │ │ │ │ -
    875
    │ │ │ │ -
    876 //===== access to components
    │ │ │ │ -
    877
    │ │ │ │ -
    │ │ │ │ -
    879 K& operator[] ([[maybe_unused]] size_type i)
    │ │ │ │ -
    880 {
    │ │ │ │ - │ │ │ │ -
    882 return *p_;
    │ │ │ │ -
    883 }
    │ │ │ │ -
    │ │ │ │ -
    884
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    889
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    892 {
    │ │ │ │ -
    893 return Iterator(*this, 0);
    │ │ │ │ -
    894 }
    │ │ │ │ -
    │ │ │ │ -
    895
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    898 {
    │ │ │ │ -
    899 return Iterator(*this, 1);
    │ │ │ │ -
    900 }
    │ │ │ │ -
    │ │ │ │ -
    901
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    905 {
    │ │ │ │ -
    906 return Iterator(*this, 0);
    │ │ │ │ -
    907 }
    │ │ │ │ -
    │ │ │ │ -
    908
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    912 {
    │ │ │ │ -
    913 return Iterator(*this, -1);
    │ │ │ │ -
    914 }
    │ │ │ │ -
    │ │ │ │ -
    915
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    920
    │ │ │ │ - │ │ │ │ -
    922 using DiagonalRowVectorConst<K,n>::operator[];
    │ │ │ │ -
    923 using DiagonalRowVectorConst<K,n>::operator==;
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    928 using DiagonalRowVectorConst<K,n>::N;
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    932
    │ │ │ │ -
    933 protected:
    │ │ │ │ -
    934
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    936 {
    │ │ │ │ -
    937 return this;
    │ │ │ │ -
    938 }
    │ │ │ │ -
    │ │ │ │ -
    939
    │ │ │ │ -
    940 private:
    │ │ │ │ -
    941
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    944 };
    │ │ │ │ -
    │ │ │ │ -
    945
    │ │ │ │ -
    946
    │ │ │ │ -
    947 // implement type traits
    │ │ │ │ -
    948 template<class K, int n>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    950 {
    │ │ │ │ - │ │ │ │ -
    952 };
    │ │ │ │ -
    │ │ │ │ -
    953
    │ │ │ │ -
    954 template<class K, int n>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    956 {
    │ │ │ │ - │ │ │ │ -
    958 };
    │ │ │ │ -
    │ │ │ │ -
    959
    │ │ │ │ -
    960 template<class K, int n>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    962 {
    │ │ │ │ - │ │ │ │ -
    964 };
    │ │ │ │ -
    │ │ │ │ -
    965
    │ │ │ │ -
    966 template<class K, int n>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    968 {
    │ │ │ │ - │ │ │ │ -
    970 };
    │ │ │ │ -
    │ │ │ │ -
    971
    │ │ │ │ -
    972
    │ │ │ │ -
    973
    │ │ │ │ -
    996 template<class CW, class T, class R>
    │ │ │ │ -
    │ │ │ │ -
    997 class ContainerWrapperIterator : public BidirectionalIteratorFacade<ContainerWrapperIterator<CW,T,R>,T, R, int>
    │ │ │ │ -
    998 {
    │ │ │ │ -
    999 typedef typename std::remove_const<CW>::type NonConstCW;
    │ │ │ │ -
    1000
    │ │ │ │ -
    1001 friend class ContainerWrapperIterator<CW, typename mutable_reference<T>::type, typename mutable_reference<R>::type>;
    │ │ │ │ -
    1002 friend class ContainerWrapperIterator<CW, typename const_reference<T>::type, typename const_reference<R>::type>;
    │ │ │ │ -
    1003
    │ │ │ │ -
    1004 typedef ContainerWrapperIterator<CW, typename mutable_reference<T>::type, typename mutable_reference<R>::type> MyType;
    │ │ │ │ -
    1005 typedef ContainerWrapperIterator<CW, typename const_reference<T>::type, typename const_reference<R>::type> MyConstType;
    │ │ │ │ -
    1006
    │ │ │ │ -
    1007 public:
    │ │ │ │ -
    1008
    │ │ │ │ -
    1009 // Constructors needed by the facade iterators.
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    1011 containerWrapper_(),
    │ │ │ │ -
    1012 position_(0)
    │ │ │ │ -
    1013 {}
    │ │ │ │ -
    │ │ │ │ -
    1014
    │ │ │ │ -
    │ │ │ │ -
    1015 ContainerWrapperIterator(CW containerWrapper, int position) :
    │ │ │ │ -
    1016 containerWrapper_(containerWrapper),
    │ │ │ │ -
    1017 position_(position)
    │ │ │ │ -
    1018 {}
    │ │ │ │ -
    │ │ │ │ -
    1019
    │ │ │ │ -
    1020 template<class OtherContainerWrapperIteratorType>
    │ │ │ │ -
    │ │ │ │ -
    1021 ContainerWrapperIterator(OtherContainerWrapperIteratorType& other) :
    │ │ │ │ -
    1022 containerWrapper_(other.containerWrapper_),
    │ │ │ │ -
    1023 position_(other.position_)
    │ │ │ │ -
    1024 {}
    │ │ │ │ -
    │ │ │ │ -
    1025
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    1027 containerWrapper_(other.containerWrapper_),
    │ │ │ │ -
    1028 position_(other.position_)
    │ │ │ │ -
    1029 {}
    │ │ │ │ -
    │ │ │ │ -
    1030
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    1032 containerWrapper_(other.containerWrapper_),
    │ │ │ │ -
    1033 position_(other.position_)
    │ │ │ │ -
    1034 {}
    │ │ │ │ -
    │ │ │ │ -
    1035
    │ │ │ │ -
    1036 template<class OtherContainerWrapperIteratorType>
    │ │ │ │ -
    │ │ │ │ -
    1037 ContainerWrapperIterator& operator=(OtherContainerWrapperIteratorType& other)
    │ │ │ │ -
    1038 {
    │ │ │ │ -
    1039 containerWrapper_ = other.containerWrapper_;
    │ │ │ │ -
    1040 position_ = other.position_;
    │ │ │ │ -
    1041 return *this;
    │ │ │ │ -
    1042 }
    │ │ │ │ -
    │ │ │ │ -
    1043
    │ │ │ │ -
    1044 // This operator is needed since we can not get the address of the
    │ │ │ │ -
    1045 // temporary object returned by dereference
    │ │ │ │ -
    │ │ │ │ -
    1046 T* operator->() const
    │ │ │ │ -
    1047 {
    │ │ │ │ -
    1048 return containerWrapper_.pointer(position_);
    │ │ │ │ -
    1049 }
    │ │ │ │ -
    │ │ │ │ -
    1050
    │ │ │ │ -
    1051 // Methods needed by the forward iterator
    │ │ │ │ -
    │ │ │ │ -
    1052 bool equals(const MyType& other) const
    │ │ │ │ -
    1053 {
    │ │ │ │ -
    1054 return position_ == other.position_ && containerWrapper_.identical(other.containerWrapper_);
    │ │ │ │ -
    1055 }
    │ │ │ │ -
    │ │ │ │ -
    1056
    │ │ │ │ -
    │ │ │ │ -
    1057 bool equals(const MyConstType& other) const
    │ │ │ │ -
    1058 {
    │ │ │ │ -
    1059 return position_ == other.position_ && containerWrapper_.identical(other.containerWrapper_);
    │ │ │ │ -
    1060 }
    │ │ │ │ -
    │ │ │ │ -
    1061
    │ │ │ │ -
    │ │ │ │ -
    1062 R dereference() const
    │ │ │ │ -
    1063 {
    │ │ │ │ -
    1064 return *containerWrapper_.pointer(position_);
    │ │ │ │ -
    1065 }
    │ │ │ │ -
    │ │ │ │ -
    1066
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    1068 {
    │ │ │ │ -
    1069 ++position_;
    │ │ │ │ -
    1070 }
    │ │ │ │ -
    │ │ │ │ -
    1071
    │ │ │ │ -
    1072 // Additional function needed by BidirectionalIterator
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    1074 {
    │ │ │ │ -
    1075 --position_;
    │ │ │ │ -
    1076 }
    │ │ │ │ -
    │ │ │ │ -
    1077
    │ │ │ │ -
    1078 // Additional function needed by RandomAccessIterator
    │ │ │ │ -
    │ │ │ │ -
    1079 R elementAt(int i) const
    │ │ │ │ -
    1080 {
    │ │ │ │ -
    1081 return *containerWrapper_.pointer(position_+i);
    │ │ │ │ -
    1082 }
    │ │ │ │ -
    │ │ │ │ -
    1083
    │ │ │ │ -
    │ │ │ │ -
    1084 void advance(int n)
    │ │ │ │ -
    1085 {
    │ │ │ │ -
    1086 position_=position_+n;
    │ │ │ │ -
    1087 }
    │ │ │ │ -
    │ │ │ │ -
    1088
    │ │ │ │ -
    1089 template<class OtherContainerWrapperIteratorType>
    │ │ │ │ -
    │ │ │ │ -
    1090 std::ptrdiff_t distanceTo(OtherContainerWrapperIteratorType& other) const
    │ │ │ │ -
    1091 {
    │ │ │ │ -
    1092 assert(containerWrapper_.identical(other));
    │ │ │ │ -
    1093 return other.position_ - position_;
    │ │ │ │ -
    1094 }
    │ │ │ │ -
    │ │ │ │ -
    1095
    │ │ │ │ -
    │ │ │ │ -
    1096 std::ptrdiff_t index() const
    │ │ │ │ -
    1097 {
    │ │ │ │ -
    1098 return containerWrapper_.realIndex(position_);
    │ │ │ │ -
    1099 }
    │ │ │ │ -
    │ │ │ │ -
    1100
    │ │ │ │ -
    1101 private:
    │ │ │ │ -
    1102 NonConstCW containerWrapper_;
    │ │ │ │ -
    1103 size_t position_;
    │ │ │ │ -
    1104 };
    │ │ │ │ +
    55
    │ │ │ │ +
    56 template<class V, class = std::enable_if_t<Simd::lanes<V>() == 1> >
    │ │ │ │ +
    │ │ │ │ +
    57 Simd::Scalar<V> io(const V &v)
    │ │ │ │ +
    58 {
    │ │ │ │ +
    59 return Simd::lane(0, v);
    │ │ │ │ +
    60 }
    │ │ │ │
    │ │ │ │ -
    1105
    │ │ │ │ -
    1106 template <class DenseMatrix, class field, int N>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    1108 static void apply(DenseMatrix& denseMatrix,
    │ │ │ │ -
    1109 DiagonalMatrix<field, N> const& rhs) {
    │ │ │ │ -
    1110 DUNE_ASSERT_BOUNDS(denseMatrix.M() == N);
    │ │ │ │ -
    1111 DUNE_ASSERT_BOUNDS(denseMatrix.N() == N);
    │ │ │ │ -
    1112 denseMatrix = field(0);
    │ │ │ │ -
    1113 for (int i = 0; i < N; ++i)
    │ │ │ │ -
    1114 denseMatrix[i][i] = rhs.diagonal()[i];
    │ │ │ │ -
    1115 }
    │ │ │ │ +
    61
    │ │ │ │ +
    62 }
    │ │ │ │
    │ │ │ │ -
    1116 };
    │ │ │ │ +
    63
    │ │ │ │ +
    64 namespace Simd {
    │ │ │ │ +
    65
    │ │ │ │ +
    82
    │ │ │ │ +
    89 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    90 auto vio(const V &v)
    │ │ │ │ +
    91 {
    │ │ │ │ +
    92 return SimdImpl::Inserter<V>{ v };
    │ │ │ │ +
    93 }
    │ │ │ │
    │ │ │ │ -
    1117 /* @} */
    │ │ │ │ -
    1118} // end namespace
    │ │ │ │ -
    1119#endif
    │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ -
    Implements a vector constructed from a given type representing a field and a compile-time given size.
    │ │ │ │ -
    Implements a matrix constructed from a given type representing a field and compile-time given number ...
    │ │ │ │ -
    Macro for wrapping boundary checks.
    │ │ │ │ -
    Implements a generic iterator class for writing stl conformant iterators.
    │ │ │ │ -
    Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
    │ │ │ │ -
    A few common exception classes.
    │ │ │ │ -
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition boundschecking.hh:30
    │ │ │ │ -
    ConstIterator beforeBegin() const
    Definition diagonalmatrix.hh:208
    │ │ │ │ -
    DiagonalMatrix< K, n > transposed() const
    Return transposed of the matrix as DiagonalMatrix.
    Definition diagonalmatrix.hh:136
    │ │ │ │ -
    void mmhv(const X &x, Y &y) const
    y -= A^H x
    Definition diagonalmatrix.hh:357
    │ │ │ │ -
    DiagonalMatrix & operator*=(const K &k)
    vector space multiplication with scalar
    Definition diagonalmatrix.hh:246
    │ │ │ │ -
    FieldTraits< K >::field_type field_type
    Definition diagonalmatrix.hh:563
    │ │ │ │ -
    std::size_t size_type
    The type used for the index access and size operations.
    Definition diagonalmatrix.hh:67
    │ │ │ │ -
    size_type dim() const
    dimension of the vector space
    Definition diagonalmatrix.hh:800
    │ │ │ │ -
    ConstIterator ConstRowIterator
    rename the iterators for easier access
    Definition diagonalmatrix.hh:183
    │ │ │ │ -
    row_type row_reference
    Definition diagonalmatrix.hh:75
    │ │ │ │ -
    K & operator[](size_type i)
    random access
    Definition diagonalmatrix.hh:879
    │ │ │ │ -
    ContainerWrapperIterator & operator=(OtherContainerWrapperIteratorType &other)
    Definition diagonalmatrix.hh:1037
    │ │ │ │ -
    static constexpr int rows
    The number of rows.
    Definition diagonalmatrix.hh:81
    │ │ │ │ -
    static constexpr size_type M()
    number of blocks in column direction
    Definition diagonalmatrix.hh:488
    │ │ │ │ -
    FieldVector< K, n > & diagonal()
    Get reference to diagonal vector.
    Definition diagonalmatrix.hh:549
    │ │ │ │ -
    void usmhv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
    y += alpha A^H x
    Definition diagonalmatrix.hh:395
    │ │ │ │ -
    Iterator iterator
    typedef for stl compliant access
    Definition diagonalmatrix.hh:888
    │ │ │ │ -
    void increment()
    Definition diagonalmatrix.hh:1067
    │ │ │ │ -
    static constexpr int blocklevel
    The number of block levels we contain. This is the leaf, that is, 1.
    Definition diagonalmatrix.hh:70
    │ │ │ │ -
    DiagonalRowVectorConst< K, n > type
    Definition diagonalmatrix.hh:957
    │ │ │ │ -
    T * operator->() const
    Definition diagonalmatrix.hh:1046
    │ │ │ │ -
    static constexpr int size
    The size of this vector.
    Definition diagonalmatrix.hh:724
    │ │ │ │ -
    K * pointer(size_type i) const
    Definition diagonalmatrix.hh:824
    │ │ │ │ -
    K field_type
    export the type representing the field
    Definition diagonalmatrix.hh:712
    │ │ │ │ -
    DiagonalRowVector< K, n > type
    Definition diagonalmatrix.hh:963
    │ │ │ │ -
    ConstIterator beforeEnd() const
    Definition diagonalmatrix.hh:773
    │ │ │ │ -
    const_row_type::ConstIterator ConstColIterator
    rename the iterators for easier access
    Definition diagonalmatrix.hh:185
    │ │ │ │ -
    bool exists(size_type i, size_type j) const
    return true when (i,j) is in pattern
    Definition diagonalmatrix.hh:498
    │ │ │ │ -
    ContainerWrapperIterator< const WrapperType, const_reference, const_reference > ConstIterator
    Iterator class for sequential access.
    Definition diagonalmatrix.hh:179
    │ │ │ │ -
    const_row_type const_row_reference
    Definition diagonalmatrix.hh:78
    │ │ │ │ -
    static constexpr size_type size()
    Definition diagonalmatrix.hh:87
    │ │ │ │ -
    size_type row_
    Definition diagonalmatrix.hh:836
    │ │ │ │ -
    ContainerWrapperIterator(CW containerWrapper, int position)
    Definition diagonalmatrix.hh:1015
    │ │ │ │ -
    DiagonalRowVector(K *p, int col)
    Constructor making vector with identical coordinates.
    Definition diagonalmatrix.hh:865
    │ │ │ │ -
    K & diagonal(size_type i)
    Get reference to diagonal entry.
    Definition diagonalmatrix.hh:537
    │ │ │ │ -
    void solve(V &x, const V &b) const
    Solve system A x = b.
    Definition diagonalmatrix.hh:438
    │ │ │ │ -
    static constexpr size_type N()
    number of blocks in row direction
    Definition diagonalmatrix.hh:482
    │ │ │ │ -
    Iterator beforeBegin()
    Definition diagonalmatrix.hh:911
    │ │ │ │ -
    ContainerWrapperIterator(OtherContainerWrapperIteratorType &other)
    Definition diagonalmatrix.hh:1021
    │ │ │ │ -
    const_reference operator[](size_type i) const
    Return const_reference object as row replacement.
    Definition diagonalmatrix.hh:525
    │ │ │ │ -
    Iterator iterator
    typedef for stl compliant access
    Definition diagonalmatrix.hh:145
    │ │ │ │ -
    ConstIterator begin() const
    begin ConstIterator
    Definition diagonalmatrix.hh:760
    │ │ │ │ -
    ConstIterator const_iterator
    typedef for stl compliant access
    Definition diagonalmatrix.hh:919
    │ │ │ │ -
    bool identical(const DiagonalRowVectorConst< K, n > &other) const
    Definition diagonalmatrix.hh:749
    │ │ │ │ -
    DiagonalMatrix & operator-=(const DiagonalMatrix &y)
    vector space subtraction
    Definition diagonalmatrix.hh:225
    │ │ │ │ -
    DiagonalRowVectorConst(K *p, int col)
    Constructor making vector with identical coordinates.
    Definition diagonalmatrix.hh:733
    │ │ │ │ -
    void mmtv(const X &x, Y &y) const
    y -= A^T x
    Definition diagonalmatrix.hh:345
    │ │ │ │ -
    static constexpr int blocklevel
    The number of block levels we contain.
    Definition diagonalmatrix.hh:721
    │ │ │ │ -
    row_type * pointer(int i) const
    Definition diagonalmatrix.hh:676
    │ │ │ │ -
    DiagonalMatrix(const K &k)
    Constructor initializing the whole matrix with a scalar.
    Definition diagonalmatrix.hh:98
    │ │ │ │ -
    ContainerWrapperIterator< DiagonalRowVector< K, n >, K, K & > Iterator
    Iterator class for sequential access.
    Definition diagonalmatrix.hh:886
    │ │ │ │ -
    R elementAt(int i) const
    Definition diagonalmatrix.hh:1079
    │ │ │ │ -
    std::ptrdiff_t distanceTo(OtherContainerWrapperIteratorType &other) const
    Definition diagonalmatrix.hh:1090
    │ │ │ │ -
    Iterator beforeEnd()
    Definition diagonalmatrix.hh:904
    │ │ │ │ -
    void umtv(const X &x, Y &y) const
    y += A^T x
    Definition diagonalmatrix.hh:309
    │ │ │ │ -
    ConstIterator const_iterator
    typedef for stl compliant access
    Definition diagonalmatrix.hh:757
    │ │ │ │ -
    double infinity_norm_real() const
    simplified infinity norm (uses Manhattan norm for complex values)
    Definition diagonalmatrix.hh:427
    │ │ │ │ -
    DiagonalMatrixWrapper(const DiagonalMatrixType *mat)
    Definition diagonalmatrix.hh:667
    │ │ │ │ -
    void umv(const X &x, Y &y) const
    y += A x
    Definition diagonalmatrix.hh:297
    │ │ │ │ -
    ContainerWrapperIterator< const WrapperType, reference, reference > Iterator
    Iterator class for sequential access.
    Definition diagonalmatrix.hh:143
    │ │ │ │ -
    DiagonalRowVector< K, n > type
    Definition diagonalmatrix.hh:969
    │ │ │ │ -
    void mv(const X &x, Y &y) const
    y = A x
    Definition diagonalmatrix.hh:278
    │ │ │ │ -
    double frobenius_norm() const
    frobenius norm: sqrt(sum over squared values of entries)
    Definition diagonalmatrix.hh:409
    │ │ │ │ -
    ConstIterator end() const
    end iterator
    Definition diagonalmatrix.hh:194
    │ │ │ │ -
    static constexpr int cols
    The number of columns.
    Definition diagonalmatrix.hh:83
    │ │ │ │ -
    static constexpr int dimension
    Definition diagonalmatrix.hh:705
    │ │ │ │ -
    K * p_
    Definition diagonalmatrix.hh:835
    │ │ │ │ -
    size_type rowIndex() const
    index of this row in surrounding matrix
    Definition diagonalmatrix.hh:806
    │ │ │ │ -
    R dereference() const
    Definition diagonalmatrix.hh:1062
    │ │ │ │ -
    DiagonalRowVector & operator=(const K &k)
    Assignment operator for scalar.
    Definition diagonalmatrix.hh:870
    │ │ │ │ -
    bool operator!=(const DiagonalMatrix &other) const
    incomparison operator
    Definition diagonalmatrix.hh:268
    │ │ │ │ -
    value_type field_type
    Definition diagonalmatrix.hh:61
    │ │ │ │ -
    void advance(int n)
    Definition diagonalmatrix.hh:1084
    │ │ │ │ -
    ConstIterator begin() const
    begin iterator
    Definition diagonalmatrix.hh:188
    │ │ │ │ -
    Iterator begin()
    begin iterator
    Definition diagonalmatrix.hh:891
    │ │ │ │ -
    void mmv(const X &x, Y &y) const
    y -= A x
    Definition diagonalmatrix.hh:333
    │ │ │ │ -
    DiagonalMatrix & operator/=(const K &k)
    vector space division by scalar
    Definition diagonalmatrix.hh:253
    │ │ │ │ -
    ConstIterator const_iterator
    typedef for stl compliant access
    Definition diagonalmatrix.hh:181
    │ │ │ │ -
    const_row_type const_reference
    Definition diagonalmatrix.hh:77
    │ │ │ │ -
    bool identical(const DiagonalMatrix< K, n > &other) const
    Check if matrix is the same object as the other matrix.
    Definition diagonalmatrix.hh:130
    │ │ │ │ -
    friend auto operator*(const DiagonalMatrix &matrixA, const DiagonalMatrix< OtherScalar, n > &matrixB)
    Matrix-matrix multiplication.
    Definition diagonalmatrix.hh:468
    │ │ │ │ -
    size_type realIndex(int i) const
    Definition diagonalmatrix.hh:671
    │ │ │ │ -
    Iterator end()
    end iterator
    Definition diagonalmatrix.hh:158
    │ │ │ │ -
    const K & operator[](size_type i) const
    same for read only access
    Definition diagonalmatrix.hh:741
    │ │ │ │ -
    DiagonalRowVector()
    Constructor making uninitialized vector.
    Definition diagonalmatrix.hh:861
    │ │ │ │ -
    row_type reference
    Definition diagonalmatrix.hh:74
    │ │ │ │ -
    DiagonalRowVectorConst * operator&()
    Definition diagonalmatrix.hh:829
    │ │ │ │ -
    bool operator==(const DiagonalRowVectorConst &y) const
    Binary vector comparison.
    Definition diagonalmatrix.hh:786
    │ │ │ │ -
    double frobenius_norm2() const
    square of frobenius norm, need for block recursion
    Definition diagonalmatrix.hh:415
    │ │ │ │ -
    constexpr DiagonalMatrix()=default
    Default constructor.
    │ │ │ │ -
    void mtv(const X &x, Y &y) const
    y = A^T x
    Definition diagonalmatrix.hh:290
    │ │ │ │ -
    ContainerWrapperIterator< DiagonalRowVectorConst< K, n >, const K, const K & > ConstIterator
    ConstIterator class for sequential access.
    Definition diagonalmatrix.hh:917
    │ │ │ │ -
    bool identical(const DiagonalMatrixWrapper &other) const
    Definition diagonalmatrix.hh:682
    │ │ │ │ -
    void usmtv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
    y += alpha A^T x
    Definition diagonalmatrix.hh:382
    │ │ │ │ -
    void decrement()
    Definition diagonalmatrix.hh:1073
    │ │ │ │ -
    std::ptrdiff_t index() const
    Definition diagonalmatrix.hh:1096
    │ │ │ │ -
    const FieldVector< K, n > & diagonal() const
    Get const reference to diagonal vector.
    Definition diagonalmatrix.hh:543
    │ │ │ │ -
    void invert()
    Compute inverse.
    Definition diagonalmatrix.hh:445
    │ │ │ │ -
    DiagonalRowVector * operator&()
    Definition diagonalmatrix.hh:935
    │ │ │ │ -
    const K & diagonal(size_type i) const
    Get const reference to diagonal entry.
    Definition diagonalmatrix.hh:531
    │ │ │ │ -
    size_type N() const
    number of blocks in the vector (are of size 1 here)
    Definition diagonalmatrix.hh:794
    │ │ │ │ -
    DiagonalMatrix(std::initializer_list< K > const &l)
    Construct diagonal matrix from an initializer list.
    Definition diagonalmatrix.hh:115
    │ │ │ │ -
    row_type::Iterator ColIterator
    rename the iterators for easier access
    Definition diagonalmatrix.hh:149
    │ │ │ │ -
    K field_type
    export the type representing the field
    Definition diagonalmatrix.hh:852
    │ │ │ │ -
    reference operator[](size_type i)
    Return reference object as row replacement.
    Definition diagonalmatrix.hh:519
    │ │ │ │ -
    DiagonalRowVectorConst< K, n > type
    Definition diagonalmatrix.hh:951
    │ │ │ │ -
    Iterator end()
    end iterator
    Definition diagonalmatrix.hh:897
    │ │ │ │ -
    DiagonalMatrix(const FieldVector< K, n > &diag)
    Constructor initializing the diagonal with a vector.
    Definition diagonalmatrix.hh:103
    │ │ │ │ -
    std::size_t size_type
    The type used for the index access and size operation.
    Definition diagonalmatrix.hh:858
    │ │ │ │ -
    void usmv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
    y += alpha A x
    Definition diagonalmatrix.hh:369
    │ │ │ │ -
    double infinity_norm() const
    infinity norm (row sum norm, how to generalize for blocks?)
    Definition diagonalmatrix.hh:421
    │ │ │ │ -
    DiagonalMatrix & operator+=(const DiagonalMatrix &y)
    vector space addition
    Definition diagonalmatrix.hh:218
    │ │ │ │ -
    K block_type
    export the type representing the components
    Definition diagonalmatrix.hh:64
    │ │ │ │ -
    void umhv(const X &x, Y &y) const
    y += A^H x
    Definition diagonalmatrix.hh:321
    │ │ │ │ -
    Iterator beforeBegin()
    Definition diagonalmatrix.hh:172
    │ │ │ │ -
    static void apply(DenseMatrix &denseMatrix, DiagonalMatrix< field, N > const &rhs)
    Definition diagonalmatrix.hh:1108
    │ │ │ │ -
    ContainerWrapperIterator(const MyType &other)
    Definition diagonalmatrix.hh:1026
    │ │ │ │ -
    ConstIterator end() const
    end ConstIterator
    Definition diagonalmatrix.hh:766
    │ │ │ │ -
    std::size_t size_type
    The type used for the index access and size operation.
    Definition diagonalmatrix.hh:718
    │ │ │ │ -
    DiagonalMatrix & operator=(const K &k)
    Assignment from a scalar.
    Definition diagonalmatrix.hh:123
    │ │ │ │ -
    DiagonalRowVectorConst()
    Constructor making uninitialized vector.
    Definition diagonalmatrix.hh:727
    │ │ │ │ -
    Iterator beforeEnd()
    Definition diagonalmatrix.hh:165
    │ │ │ │ -
    size_type realIndex(int i) const
    Definition diagonalmatrix.hh:819
    │ │ │ │ -
    friend std::ostream & operator<<(std::ostream &s, const DiagonalMatrix< K, n > &a)
    Sends the matrix to an output stream.
    Definition diagonalmatrix.hh:508
    │ │ │ │ -
    K value_type
    export the type representing the field
    Definition diagonalmatrix.hh:60
    │ │ │ │ -
    K block_type
    export the type representing the components
    Definition diagonalmatrix.hh:715
    │ │ │ │ -
    K determinant() const
    calculates the determinant of this matrix
    Definition diagonalmatrix.hh:453
    │ │ │ │ -
    FieldTraits< K >::real_type real_type
    Definition diagonalmatrix.hh:564
    │ │ │ │ -
    ConstIterator beforeBegin() const
    Definition diagonalmatrix.hh:780
    │ │ │ │ -
    DiagonalMatrixWrapper()
    Definition diagonalmatrix.hh:663
    │ │ │ │ -
    ContainerWrapperIterator< DiagonalRowVectorConst< K, n >, const K, const K & > ConstIterator
    ConstIterator class for sequential access.
    Definition diagonalmatrix.hh:755
    │ │ │ │ -
    Iterator begin()
    begin iterator
    Definition diagonalmatrix.hh:152
    │ │ │ │ -
    bool operator==(const DiagonalMatrix &other) const
    comparison operator
    Definition diagonalmatrix.hh:262
    │ │ │ │ -
    DiagonalRowVectorConst< K, n > const_row_type
    Definition diagonalmatrix.hh:76
    │ │ │ │ -
    DiagonalRowVector< K, n > row_type
    Each row is implemented by a field vector.
    Definition diagonalmatrix.hh:73
    │ │ │ │ -
    bool equals(const MyType &other) const
    Definition diagonalmatrix.hh:1052
    │ │ │ │ -
    Iterator RowIterator
    rename the iterators for easier access
    Definition diagonalmatrix.hh:147
    │ │ │ │ -
    K block_type
    export the type representing the components
    Definition diagonalmatrix.hh:855
    │ │ │ │ -
    ConstIterator beforeEnd() const
    Definition diagonalmatrix.hh:201
    │ │ │ │ -
    const K & diagonal() const
    the diagonal value
    Definition diagonalmatrix.hh:812
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ +
    94
    │ │ │ │ +
    96
    │ │ │ │ +
    105 template<class V>
    │ │ │ │ +
    │ │ │ │ +
    106 auto io(const V &v)
    │ │ │ │ +
    107 {
    │ │ │ │ +
    108 return SimdImpl::io(v);
    │ │ │ │ +
    109 }
    │ │ │ │ +
    │ │ │ │ +
    110
    │ │ │ │ +
    112
    │ │ │ │ +
    114
    │ │ │ │ +
    115 } // namespace Simd
    │ │ │ │ +
    116} // namespace Dune
    │ │ │ │ +
    117
    │ │ │ │ +
    118#endif // DUNE_COMMON_SIMD_IO_HH
    │ │ │ │ +
    Utilities for reduction like operations on ranges.
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
    Definition rangeutilities.hh:300
    │ │ │ │ +
    constexpr AutonomousValue< T > autoCopy(T &&v)
    Autonomous copy of an expression's value for use in auto type deduction.
    Definition typetraits.hh:642
    │ │ │ │ +
    auto io(const V &v)
    construct a stream inserter
    Definition io.hh:106
    │ │ │ │ +
    auto vio(const V &v)
    construct a stream inserter
    Definition io.hh:90
    │ │ │ │ +
    constexpr std::size_t lanes()
    Number of lanes in a SIMD type.
    Definition simd/interface.hh:305
    │ │ │ │ +
    decltype(auto) lane(std::size_t l, V &&v)
    Extract an element of a SIMD type.
    Definition simd/interface.hh:324
    │ │ │ │ +
    typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
    Element type of some SIMD type.
    Definition simd/interface.hh:235
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    K conjugateComplex(const K &x)
    compute conjugate complex of x
    Definition math.hh:164
    │ │ │ │ -
    A dense n x m matrix.
    Definition densematrix.hh:140
    │ │ │ │ -
    constexpr size_type M() const
    number of columns
    Definition densematrix.hh:703
    │ │ │ │ -
    constexpr size_type N() const
    number of rows
    Definition densematrix.hh:697
    │ │ │ │ -
    A dense n x m matrix.
    Definition fmatrix.hh:117
    │ │ │ │ -
    vector space out of a tensor product of fields.
    Definition fvector.hh:95
    │ │ │ │ -
    you have to specialize this structure for any type that should be assignable to a DenseMatrix
    Definition densematrix.hh:59
    │ │ │ │ -
    Error thrown if operations of a FieldMatrix fail.
    Definition densematrix.hh:126
    │ │ │ │ -
    FieldTraits< value_type >::real_type two_norm2() const
    square of two norm (sum over squared values of entries), need for block recursion
    Definition densevector.hh:650
    │ │ │ │ -
    FieldTraits< value_type >::real_type two_norm() const
    two norm sqrt(sum over squared values of entries)
    Definition densevector.hh:641
    │ │ │ │ -
    Iterator begin()
    begin iterator
    Definition densevector.hh:347
    │ │ │ │ -
    FieldTraits< vt >::real_type infinity_norm() const
    infinity norm (maximum of absolute values of entries)
    Definition densevector.hh:661
    │ │ │ │ -
    FieldTraits< vt >::real_type infinity_norm_real() const
    simplified infinity norm (uses Manhattan norm for complex values)
    Definition densevector.hh:677
    │ │ │ │ -
    Definition diagonalmatrix.hh:698
    │ │ │ │ -
    Definition diagonalmatrix.hh:841
    │ │ │ │ -
    Definition diagonalmatrix.hh:650
    │ │ │ │ -
    Iterator class for sparse vector-like containers.
    Definition diagonalmatrix.hh:998
    │ │ │ │ -
    ContainerWrapperIterator(const MyConstType &other)
    Definition diagonalmatrix.hh:1031
    │ │ │ │ -
    bool equals(const MyConstType &other) const
    Definition diagonalmatrix.hh:1057
    │ │ │ │ -
    A diagonal matrix of static size.
    Definition diagonalmatrix.hh:53
    │ │ │ │ -
    Definition ftraits.hh:26
    │ │ │ │ -
    T field_type
    export the type representing the field
    Definition ftraits.hh:28
    │ │ │ │ -
    T real_type
    export the type representing the real type of the field
    Definition ftraits.hh:30
    │ │ │ │ -
    Get the 'const' version of a reference to a mutable object.
    Definition genericiterator.hh:87
    │ │ │ │ -
    get the 'mutable' version of a reference to a const object
    Definition genericiterator.hh:116
    │ │ │ │ -
    Facade class for stl conformant bidirectional iterators.
    Definition iteratorfacades.hh:274
    │ │ │ │ +
    Inserter< V > io(const V &v)
    Definition io.hh:51
    │ │ │ │ +
    Definition io.hh:28
    │ │ │ │ +
    Inserter(const T &value)
    Definition io.hh:32
    │ │ │ │ +
    friend Stream & operator<<(Stream &out, const Inserter &ins)
    Definition io.hh:37
    │ │ │ │ +
    Include file for users of the SIMD abstraction layer.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1601 +1,135 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -diagonalmatrix.hh │ │ │ │ │ + * _s_i_m_d │ │ │ │ │ +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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_DIAGONAL_MATRIX_HH │ │ │ │ │ -6#define DUNE_DIAGONAL_MATRIX_HH │ │ │ │ │ -7 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20 │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ -22#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ -23#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_m_a_t_r_i_x_._h_h> │ │ │ │ │ -25#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ -26#include <_d_u_n_e_/_c_o_m_m_o_n_/_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h> │ │ │ │ │ -27#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -28 │ │ │ │ │ -29 │ │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ │ -31 │ │ │ │ │ -32 template< class K, int n > class DiagonalRowVectorConst; │ │ │ │ │ -33 template< class K, int n > class DiagonalRowVector; │ │ │ │ │ -34 template< class DiagonalMatrixType > class DiagonalMatrixWrapper; │ │ │ │ │ -35 template< class C, class T, class R> class ContainerWrapperIterator; │ │ │ │ │ -36 │ │ │ │ │ -51 template │ │ │ │ │ -_5_2 class _D_i_a_g_o_n_a_l_M_a_t_r_i_x │ │ │ │ │ -53 { │ │ │ │ │ -54 typedef _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_K_,_n_> > _W_r_a_p_p_e_r_T_y_p_e; │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_SIMD_IO_HH │ │ │ │ │ +4#define DUNE_COMMON_SIMD_IO_HH │ │ │ │ │ +5 │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18 │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +22 │ │ │ │ │ +23namespace _D_u_n_e { │ │ │ │ │ +24 │ │ │ │ │ +_2_5 namespace SimdImpl { │ │ │ │ │ +26 │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 class _I_n_s_e_r_t_e_r { │ │ │ │ │ +29 T value_; │ │ │ │ │ +30 │ │ │ │ │ +31 public: │ │ │ │ │ +_3_2 _I_n_s_e_r_t_e_r(const T &value) : value_(value) {} │ │ │ │ │ +33 │ │ │ │ │ +34 template::value> > │ │ │ │ │ +_3_7 friend Stream& _o_p_e_r_a_t_o_r_<_<(Stream &out, const _I_n_s_e_r_t_e_r &ins) │ │ │ │ │ +38 { │ │ │ │ │ +39 const char *sep = "<"; │ │ │ │ │ +40 for(auto l : _r_a_n_g_e(_S_i_m_d_:_:_l_a_n_e_s(ins.value_))) │ │ │ │ │ +41 { │ │ │ │ │ +42 out << sep << _a_u_t_o_C_o_p_y(_S_i_m_d_:_:_l_a_n_e(l, ins.value_)); │ │ │ │ │ +43 sep = ", "; │ │ │ │ │ +44 } │ │ │ │ │ +45 out << '>'; │ │ │ │ │ +46 return out; │ │ │ │ │ +47 } │ │ │ │ │ +48 }; │ │ │ │ │ +49 │ │ │ │ │ +50 template() != 1> > │ │ │ │ │ +_5_1 _I_n_s_e_r_t_e_r_<_V_> _i_o(const V &v) │ │ │ │ │ +52 { │ │ │ │ │ +53 return { v }; │ │ │ │ │ +54 } │ │ │ │ │ 55 │ │ │ │ │ -56 public: │ │ │ │ │ -57 //===== type definitions and constants │ │ │ │ │ -58 │ │ │ │ │ -_6_0 typedef K _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_6_1 typedef _v_a_l_u_e___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -62 │ │ │ │ │ -_6_4 typedef K _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +56 template() == 1> > │ │ │ │ │ +_5_7 _S_i_m_d_:_:_S_c_a_l_a_r_<_V_> _i_o(const V &v) │ │ │ │ │ +58 { │ │ │ │ │ +59 return _S_i_m_d_:_:_l_a_n_e(0, v); │ │ │ │ │ +60 } │ │ │ │ │ +61 │ │ │ │ │ +62 } │ │ │ │ │ +63 │ │ │ │ │ +64 namespace Simd { │ │ │ │ │ 65 │ │ │ │ │ -_6_7 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -68 │ │ │ │ │ -_7_0 constexpr static int _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ -71 │ │ │ │ │ -_7_3 typedef _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_K_,_n_> _r_o_w___t_y_p_e; │ │ │ │ │ -_7_4 typedef _r_o_w___t_y_p_e _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -_7_5 typedef _r_o_w___t_y_p_e _r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -_7_6 typedef _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_K_,_n_> _c_o_n_s_t___r_o_w___t_y_p_e; │ │ │ │ │ -_7_7 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; │ │ │ │ │ -_7_8 typedef _c_o_n_s_t___r_o_w___t_y_p_e _c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -79 │ │ │ │ │ -_8_1 constexpr static int _r_o_w_s = n; │ │ │ │ │ -_8_3 constexpr static int _c_o_l_s = n; │ │ │ │ │ -84 │ │ │ │ │ -85 //==== size │ │ │ │ │ -86 │ │ │ │ │ -_8_7 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e () │ │ │ │ │ -88 { │ │ │ │ │ -89 return _r_o_w_s; │ │ │ │ │ -90 } │ │ │ │ │ -91 │ │ │ │ │ -92 //===== constructors │ │ │ │ │ -93 │ │ │ │ │ -_9_5 constexpr _D_i_a_g_o_n_a_l_M_a_t_r_i_x() = default; │ │ │ │ │ +82 │ │ │ │ │ +89 template │ │ │ │ │ +_9_0 auto _v_i_o(const V &v) │ │ │ │ │ +91 { │ │ │ │ │ +92 return _S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_<_V_>{ v }; │ │ │ │ │ +93 } │ │ │ │ │ +94 │ │ │ │ │ 96 │ │ │ │ │ -_9_8 _D_i_a_g_o_n_a_l_M_a_t_r_i_x (const K& k) │ │ │ │ │ -99 : diag_(k) │ │ │ │ │ -100 {} │ │ │ │ │ -101 │ │ │ │ │ -_1_0_3 _D_i_a_g_o_n_a_l_M_a_t_r_i_x (const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_n_>& diag) │ │ │ │ │ -104 : diag_(diag) │ │ │ │ │ -105 {} │ │ │ │ │ -106 │ │ │ │ │ -_1_1_5 _D_i_a_g_o_n_a_l_M_a_t_r_i_x (std::initializer_list const &l) │ │ │ │ │ -116 { │ │ │ │ │ -117 std::copy_n(l.begin(), std::min(static_cast(_r_o_w_s), │ │ │ │ │ -118 l.size()), │ │ │ │ │ -119 diag_._b_e_g_i_n()); │ │ │ │ │ -120 } │ │ │ │ │ -121 │ │ │ │ │ -_1_2_3 _D_i_a_g_o_n_a_l_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const K& k) │ │ │ │ │ -124 { │ │ │ │ │ -125 diag_ = k; │ │ │ │ │ -126 return *this; │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -_1_3_0 bool _i_d_e_n_t_i_c_a_l(const _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_K_,_n_>& other) const │ │ │ │ │ -131 { │ │ │ │ │ -132 return (this==&other); │ │ │ │ │ -133 } │ │ │ │ │ -134 │ │ │ │ │ -_1_3_6 _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_K_,_ _n_> _t_r_a_n_s_p_o_s_e_d() const │ │ │ │ │ -137 { │ │ │ │ │ -138 return *this; │ │ │ │ │ -139 } │ │ │ │ │ -140 │ │ │ │ │ -141 //===== iterator interface to rows of the matrix │ │ │ │ │ -_1_4_3 typedef _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _W_r_a_p_p_e_r_T_y_p_e_,_ _r_e_f_e_r_e_n_c_e_,_ _r_e_f_e_r_e_n_c_e_> │ │ │ │ │ -_I_t_e_r_a_t_o_r; │ │ │ │ │ -_1_4_5 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ │ -_1_4_7 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ -_1_4_9 typedef typename _r_o_w___t_y_p_e_:_:_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -150 │ │ │ │ │ -_1_5_2 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ -153 { │ │ │ │ │ -154 return _I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),0); │ │ │ │ │ -155 } │ │ │ │ │ -156 │ │ │ │ │ -_1_5_8 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ -159 { │ │ │ │ │ -160 return _I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),n); │ │ │ │ │ -161 } │ │ │ │ │ -162 │ │ │ │ │ -_1_6_5 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ -166 { │ │ │ │ │ -167 return _I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),n-1); │ │ │ │ │ -168 } │ │ │ │ │ -169 │ │ │ │ │ -_1_7_2 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ -173 { │ │ │ │ │ -174 return _I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),-1); │ │ │ │ │ -175 } │ │ │ │ │ -176 │ │ │ │ │ -177 │ │ │ │ │ -_1_7_9 typedef _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _W_r_a_p_p_e_r_T_y_p_e_,_ _c_o_n_s_t___r_e_f_e_r_e_n_c_e_, │ │ │ │ │ -_c_o_n_s_t___r_e_f_e_r_e_n_c_e_> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -_1_8_1 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_8_3 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_8_5 typedef typename _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 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -186 │ │ │ │ │ -_1_8_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ -189 { │ │ │ │ │ -190 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),0); │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -_1_9_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ -195 { │ │ │ │ │ -196 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),n); │ │ │ │ │ -197 } │ │ │ │ │ -198 │ │ │ │ │ -_2_0_1 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ -202 { │ │ │ │ │ -203 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),n-1); │ │ │ │ │ -204 } │ │ │ │ │ -205 │ │ │ │ │ -_2_0_8 _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 │ │ │ │ │ -209 { │ │ │ │ │ -210 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_W_r_a_p_p_e_r_T_y_p_e(this),-1); │ │ │ │ │ -211 } │ │ │ │ │ -212 │ │ │ │ │ -213 │ │ │ │ │ -214 │ │ │ │ │ -215 //===== vector space arithmetic │ │ │ │ │ -216 │ │ │ │ │ -_2_1_8 _D_i_a_g_o_n_a_l_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _D_i_a_g_o_n_a_l_M_a_t_r_i_x& y) │ │ │ │ │ -219 { │ │ │ │ │ -220 diag_ += y.diag_; │ │ │ │ │ -221 return *this; │ │ │ │ │ -222 } │ │ │ │ │ -223 │ │ │ │ │ -_2_2_5 _D_i_a_g_o_n_a_l_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _D_i_a_g_o_n_a_l_M_a_t_r_i_x& y) │ │ │ │ │ -226 { │ │ │ │ │ -227 diag_ -= y.diag_; │ │ │ │ │ -228 return *this; │ │ │ │ │ -229 } │ │ │ │ │ -230 │ │ │ │ │ -_2_3_2 _D_i_a_g_o_n_a_l_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const K& k) │ │ │ │ │ -233 { │ │ │ │ │ -234 diag_ += k; │ │ │ │ │ -235 return *this; │ │ │ │ │ -236 } │ │ │ │ │ -237 │ │ │ │ │ -_2_3_9 _D_i_a_g_o_n_a_l_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const K& k) │ │ │ │ │ -240 { │ │ │ │ │ -241 diag_ -= k; │ │ │ │ │ -242 return *this; │ │ │ │ │ -243 } │ │ │ │ │ -244 │ │ │ │ │ -_2_4_6 _D_i_a_g_o_n_a_l_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const K& k) │ │ │ │ │ -247 { │ │ │ │ │ -248 diag_ *= k; │ │ │ │ │ -249 return *this; │ │ │ │ │ -250 } │ │ │ │ │ -251 │ │ │ │ │ -_2_5_3 _D_i_a_g_o_n_a_l_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_/_=_ (const K& k) │ │ │ │ │ -254 { │ │ │ │ │ -255 diag_ /= k; │ │ │ │ │ -256 return *this; │ │ │ │ │ -257 } │ │ │ │ │ -258 │ │ │ │ │ -259 //===== comparison ops │ │ │ │ │ -260 │ │ │ │ │ -_2_6_2 bool _o_p_e_r_a_t_o_r_=_=(const _D_i_a_g_o_n_a_l_M_a_t_r_i_x& other) const │ │ │ │ │ -263 { │ │ │ │ │ -264 return diag_==other._d_i_a_g_o_n_a_l(); │ │ │ │ │ -265 } │ │ │ │ │ -266 │ │ │ │ │ -_2_6_8 bool _o_p_e_r_a_t_o_r_!_=(const _D_i_a_g_o_n_a_l_M_a_t_r_i_x& other) const │ │ │ │ │ -269 { │ │ │ │ │ -270 return diag_!=other._d_i_a_g_o_n_a_l(); │ │ │ │ │ -271 } │ │ │ │ │ -272 │ │ │ │ │ -273 │ │ │ │ │ -274 //===== linear maps │ │ │ │ │ -275 │ │ │ │ │ -277 template │ │ │ │ │ -_2_7_8 void _m_v (const X& x, Y& y) const │ │ │ │ │ -279 { │ │ │ │ │ -280#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -281 if (x.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -282 if (y.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -283#endif │ │ │ │ │ -284 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_2_9_0 void _m_t_v (const X& x, Y& y) const │ │ │ │ │ -291 { │ │ │ │ │ -292 _m_v(x, y); │ │ │ │ │ -293 } │ │ │ │ │ -294 │ │ │ │ │ -296 template │ │ │ │ │ -_2_9_7 void _u_m_v (const X& x, Y& y) const │ │ │ │ │ -298 { │ │ │ │ │ -299#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -300 if (x.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -301 if (y.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -302#endif │ │ │ │ │ -303 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_0_9 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ -310 { │ │ │ │ │ -311#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -312 if (x.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -313 if (y.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -314#endif │ │ │ │ │ -315 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_2_1 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ -322 { │ │ │ │ │ -323#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -324 if (x.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -325 if (y.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -326#endif │ │ │ │ │ -327 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_3_3 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ -334 { │ │ │ │ │ -335#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -336 if (x.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -337 if (y.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -338#endif │ │ │ │ │ -339 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_4_5 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ -346 { │ │ │ │ │ -347#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -348 if (x.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -349 if (y.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -350#endif │ │ │ │ │ -351 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_5_7 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ -358 { │ │ │ │ │ -359#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -360 if (x.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -361 if (y.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -362#endif │ │ │ │ │ -363 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_6_9 void _u_s_m_v (const typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e & alpha, │ │ │ │ │ -370 const X& x, Y& y) const │ │ │ │ │ -371 { │ │ │ │ │ -372#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -373 if (x.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -374 if (y.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -375#endif │ │ │ │ │ -376 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_8_2 void _u_s_m_t_v (const typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e & alpha, │ │ │ │ │ -383 const X& x, Y& y) const │ │ │ │ │ -384 { │ │ │ │ │ -385#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -386 if (x.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -387 if (y.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -388#endif │ │ │ │ │ -389 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_9_5 void _u_s_m_h_v (const typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e & alpha, │ │ │ │ │ -396 const X& x, Y& y) const │ │ │ │ │ -397 { │ │ │ │ │ -398#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -399 if (x.N()!=_N()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -400 if (y.N()!=_M()) _D_U_N_E___T_H_R_O_W(_F_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -401#endif │ │ │ │ │ -402 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_4_3_8 void _s_o_l_v_e (V& x, const V& b) const │ │ │ │ │ -439 { │ │ │ │ │ -440 for (int i=0; i_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ -448 for (int i=0; i │ │ │ │ │ -_4_6_8 friend auto _o_p_e_r_a_t_o_r_*_ ( const _D_i_a_g_o_n_a_l_M_a_t_r_i_x& matrixA, │ │ │ │ │ -469 const _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_O_t_h_e_r_S_c_a_l_a_r_,_ _n_>& matrixB) │ │ │ │ │ -470 { │ │ │ │ │ -471 auto result = _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_O_t_h_e_r_S_c_a_l_a_r_>_:_: │ │ │ │ │ -_P_r_o_m_o_t_e_d_T_y_p_e, n>{}; │ │ │ │ │ -472 for(int i=0; i= 0 && i < n); │ │ │ │ │ -501 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(j >= 0 && j < n); │ │ │ │ │ -502 return i==j; │ │ │ │ │ -503 } │ │ │ │ │ -504 │ │ │ │ │ -505 │ │ │ │ │ -506 │ │ │ │ │ -_5_0_8 friend std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const │ │ │ │ │ -_D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_K_,_n_>& a) │ │ │ │ │ -509 { │ │ │ │ │ -510 for (_s_i_z_e___t_y_p_e i=0; i(&diag_[i]), i); │ │ │ │ │ -522 } │ │ │ │ │ -523 │ │ │ │ │ -_5_2_5 _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 │ │ │ │ │ -526 { │ │ │ │ │ -527 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(const_cast(&diag_[i]), i); │ │ │ │ │ -528 } │ │ │ │ │ -529 │ │ │ │ │ -_5_3_1 const K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -532 { │ │ │ │ │ -533 return diag_[i]; │ │ │ │ │ -534 } │ │ │ │ │ -535 │ │ │ │ │ -_5_3_7 K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e i) │ │ │ │ │ -538 { │ │ │ │ │ -539 return diag_[i]; │ │ │ │ │ -540 } │ │ │ │ │ -541 │ │ │ │ │ -_5_4_3 const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_n_>& _d_i_a_g_o_n_a_l() const │ │ │ │ │ -544 { │ │ │ │ │ -545 return diag_; │ │ │ │ │ -546 } │ │ │ │ │ -547 │ │ │ │ │ -_5_4_9 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_n_>& _d_i_a_g_o_n_a_l() │ │ │ │ │ -550 { │ │ │ │ │ -551 return diag_; │ │ │ │ │ -552 } │ │ │ │ │ -553 │ │ │ │ │ -554 private: │ │ │ │ │ -555 │ │ │ │ │ -556 // the data, a FieldVector storing the diagonal │ │ │ │ │ -557 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_n_> diag_; │ │ │ │ │ -558 }; │ │ │ │ │ -559 │ │ │ │ │ -560 template< class K, int n > │ │ │ │ │ -_5_6_1 struct _F_i_e_l_d_T_r_a_i_t_s< _D_i_a_g_o_n_a_l_M_a_t_r_i_x > │ │ │ │ │ -562 { │ │ │ │ │ -_5_6_3 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_5_6_4 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ -565 }; │ │ │ │ │ -566 │ │ │ │ │ -567 │ │ │ │ │ -568#ifndef DOXYGEN // hide specialization │ │ │ │ │ -571 template< class K > │ │ │ │ │ -572 class _D_i_a_g_o_n_a_l_M_a_t_r_i_x : public _F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ -573 { │ │ │ │ │ -574 typedef _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_> Base; │ │ │ │ │ -575 public: │ │ │ │ │ -577 typedef typename Base::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -578 │ │ │ │ │ -581 constexpr static int _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ -582 │ │ │ │ │ -583 typedef typename Base::row_type _r_o_w___t_y_p_e; │ │ │ │ │ -584 │ │ │ │ │ -585 typedef typename Base::row_reference _r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -586 typedef typename Base::const_row_reference _c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -587 │ │ │ │ │ -590 constexpr static int _r_o_w_s = 1; │ │ │ │ │ -593 constexpr static int _c_o_l_s = 1; │ │ │ │ │ -594 │ │ │ │ │ -595 │ │ │ │ │ -597 constexpr _D_i_a_g_o_n_a_l_M_a_t_r_i_x() = default; │ │ │ │ │ -598 │ │ │ │ │ -600 _D_i_a_g_o_n_a_l_M_a_t_r_i_x(const K& scalar) │ │ │ │ │ -601 { │ │ │ │ │ -602 (*this)[0][0] = scalar; │ │ │ │ │ -603 } │ │ │ │ │ -604 │ │ │ │ │ -606 const K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e) const │ │ │ │ │ -607 { │ │ │ │ │ -608 return (*this)[0][0]; │ │ │ │ │ -609 } │ │ │ │ │ -610 │ │ │ │ │ -612 K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e) │ │ │ │ │ -613 { │ │ │ │ │ -614 return (*this)[0][0]; │ │ │ │ │ -615 } │ │ │ │ │ -616 │ │ │ │ │ -618 const FieldVector& _d_i_a_g_o_n_a_l() const │ │ │ │ │ -619 { │ │ │ │ │ -620 return (*this)[0]; │ │ │ │ │ -621 } │ │ │ │ │ -622 │ │ │ │ │ -624 FieldVector& _d_i_a_g_o_n_a_l() │ │ │ │ │ -625 { │ │ │ │ │ -626 return (*this)[0]; │ │ │ │ │ -627 } │ │ │ │ │ -628 │ │ │ │ │ -630 DiagonalMatrix _t_r_a_n_s_p_o_s_e_d() const │ │ │ │ │ -631 { │ │ │ │ │ -632 return *this; │ │ │ │ │ -633 } │ │ │ │ │ -634 │ │ │ │ │ -637 template │ │ │ │ │ -638 friend auto _o_p_e_r_a_t_o_r_*_ ( const _D_i_a_g_o_n_a_l_M_a_t_r_i_x& matrixA, │ │ │ │ │ -639 const DiagonalMatrix& matrixB) │ │ │ │ │ -640 { │ │ │ │ │ -641 return DiagonalMatrix:: │ │ │ │ │ -PromotedType, 1>{matrixA.diagonal(0)*matrixB.diagonal(0)}; │ │ │ │ │ -642 } │ │ │ │ │ -643 │ │ │ │ │ -644 }; │ │ │ │ │ -645#endif │ │ │ │ │ -646 │ │ │ │ │ -647 │ │ │ │ │ -648 template │ │ │ │ │ -_6_4_9 class _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r │ │ │ │ │ -650 { │ │ │ │ │ -651 typedef typename DiagonalMatrixType::reference reference; │ │ │ │ │ -652 typedef typename DiagonalMatrixType::const_reference const_reference; │ │ │ │ │ -653 typedef typename DiagonalMatrixType::field_type K; │ │ │ │ │ -654 typedef _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_K_,_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_T_y_p_e_:_:_r_o_w_s_> _r_o_w___t_y_p_e; │ │ │ │ │ -655 typedef std::size_t size_type; │ │ │ │ │ -_6_5_6 typedef _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_T_y_p_e_> _M_y_T_y_p_e; │ │ │ │ │ -657 │ │ │ │ │ -658 friend class _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r; │ │ │ │ │ -659 friend class _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r; │ │ │ │ │ -660 │ │ │ │ │ -661 public: │ │ │ │ │ -662 │ │ │ │ │ -_6_6_3 _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r() : │ │ │ │ │ -664 mat_(0) │ │ │ │ │ -665 {} │ │ │ │ │ -666 │ │ │ │ │ -_6_6_7 _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r(const DiagonalMatrixType* mat) : │ │ │ │ │ -668 mat_(const_cast(mat)) │ │ │ │ │ -669 {} │ │ │ │ │ -670 │ │ │ │ │ -_6_7_1 size_type _r_e_a_l_I_n_d_e_x(int i) const │ │ │ │ │ -672 { │ │ │ │ │ -673 return i; │ │ │ │ │ -674 } │ │ │ │ │ -675 │ │ │ │ │ -_6_7_6 _r_o_w___t_y_p_e* _p_o_i_n_t_e_r(int i) const │ │ │ │ │ -677 { │ │ │ │ │ -678 row_ = _r_o_w___t_y_p_e(&(mat_->diagonal(i)), i); │ │ │ │ │ -679 return &row_; │ │ │ │ │ -680 } │ │ │ │ │ -681 │ │ │ │ │ -_6_8_2 bool _i_d_e_n_t_i_c_a_l(const _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r& other) const │ │ │ │ │ -683 { │ │ │ │ │ -684 return mat_==other.mat_; │ │ │ │ │ -685 } │ │ │ │ │ -686 │ │ │ │ │ -687 private: │ │ │ │ │ -688 │ │ │ │ │ -689 mutable DiagonalMatrixType* mat_; │ │ │ │ │ -690 mutable row_type row_; │ │ │ │ │ -691 }; │ │ │ │ │ -692 │ │ │ │ │ -696 template< class K, int n > │ │ │ │ │ -_6_9_7 class _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t │ │ │ │ │ -698 { │ │ │ │ │ -699 template │ │ │ │ │ -_7_0_0 friend class _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r; │ │ │ │ │ -701 friend class _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r<_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t, const K, │ │ │ │ │ -const K&>; │ │ │ │ │ -702 │ │ │ │ │ -703 public: │ │ │ │ │ -704 // remember size of vector │ │ │ │ │ -_7_0_5 constexpr static int _d_i_m_e_n_s_i_o_n = n; │ │ │ │ │ -706 │ │ │ │ │ -707 // standard constructor and everything is sufficient ... │ │ │ │ │ -708 │ │ │ │ │ -709 //===== type definitions and constants │ │ │ │ │ -710 │ │ │ │ │ -_7_1_2 typedef K _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -713 │ │ │ │ │ -_7_1_5 typedef K _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -716 │ │ │ │ │ -_7_1_8 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -719 │ │ │ │ │ -_7_2_1 constexpr static int _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ -722 │ │ │ │ │ -_7_2_4 constexpr static int _s_i_z_e = n; │ │ │ │ │ -725 │ │ │ │ │ -_7_2_7 _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t() : │ │ │ │ │ -728 _p__(0), │ │ │ │ │ -729 _r_o_w__(0) │ │ │ │ │ -730 {} │ │ │ │ │ -731 │ │ │ │ │ -_7_3_3 explicit _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t (K* p, int col) : │ │ │ │ │ -734 _p__(p), │ │ │ │ │ -735 _r_o_w__(col) │ │ │ │ │ -736 {} │ │ │ │ │ -737 │ │ │ │ │ -738 //===== access to components │ │ │ │ │ -739 │ │ │ │ │ -_7_4_1 const K& _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] _s_i_z_e___t_y_p_e i) const │ │ │ │ │ -742 { │ │ │ │ │ -743 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i == _r_o_w__); │ │ │ │ │ -744 return *_p__; │ │ │ │ │ -745 } │ │ │ │ │ -746 │ │ │ │ │ -747 // check if row is identical to other row (not only identical values) │ │ │ │ │ -748 // since this is a proxy class we need to check equality of the stored │ │ │ │ │ -pointer │ │ │ │ │ -_7_4_9 bool _i_d_e_n_t_i_c_a_l(const _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_K_,_n_>& other) const │ │ │ │ │ -750 { │ │ │ │ │ -751 return ((_p__ == other._p__)and (_r_o_w__ == other._r_o_w__)); │ │ │ │ │ -752 } │ │ │ │ │ -753 │ │ │ │ │ -_7_5_5 typedef _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_<_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_K_,_n_>, const K, │ │ │ │ │ -const K&> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -_7_5_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; │ │ │ │ │ -758 │ │ │ │ │ -_7_6_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ -761 { │ │ │ │ │ -762 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ -763 } │ │ │ │ │ -764 │ │ │ │ │ -_7_6_6 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ -767 { │ │ │ │ │ -768 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,1); │ │ │ │ │ -769 } │ │ │ │ │ -770 │ │ │ │ │ -_7_7_3 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ -774 { │ │ │ │ │ -775 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ -776 } │ │ │ │ │ -777 │ │ │ │ │ -_7_8_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ │ -781 { │ │ │ │ │ -782 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,-1); │ │ │ │ │ -783 } │ │ │ │ │ -784 │ │ │ │ │ -_7_8_6 bool _o_p_e_r_a_t_o_r_=_=_ (const _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t& y) const │ │ │ │ │ -787 { │ │ │ │ │ -788 return ((_p__==y._p__)and (_r_o_w__==y._r_o_w__)); │ │ │ │ │ -789 } │ │ │ │ │ -790 │ │ │ │ │ -791 //===== sizes │ │ │ │ │ -792 │ │ │ │ │ -_7_9_4 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ -795 { │ │ │ │ │ -796 return n; │ │ │ │ │ -797 } │ │ │ │ │ -798 │ │ │ │ │ -_8_0_0 _s_i_z_e___t_y_p_e _d_i_m () const │ │ │ │ │ -801 { │ │ │ │ │ -802 return n; │ │ │ │ │ -803 } │ │ │ │ │ -804 │ │ │ │ │ -_8_0_6 _s_i_z_e___t_y_p_e _r_o_w_I_n_d_e_x() const │ │ │ │ │ -807 { │ │ │ │ │ -808 return _r_o_w__; │ │ │ │ │ -809 } │ │ │ │ │ -810 │ │ │ │ │ -_8_1_2 const K& _d_i_a_g_o_n_a_l() const │ │ │ │ │ -813 { │ │ │ │ │ -814 return *_p__; │ │ │ │ │ -815 } │ │ │ │ │ -816 │ │ │ │ │ -817 protected: │ │ │ │ │ -818 │ │ │ │ │ -_8_1_9 _s_i_z_e___t_y_p_e _r_e_a_l_I_n_d_e_x([[maybe_unused]] int i) const │ │ │ │ │ -820 { │ │ │ │ │ -821 return _r_o_w_I_n_d_e_x(); │ │ │ │ │ -822 } │ │ │ │ │ -823 │ │ │ │ │ -_8_2_4 K* _p_o_i_n_t_e_r([[maybe_unused]] _s_i_z_e___t_y_p_e i) const │ │ │ │ │ -825 { │ │ │ │ │ -826 return const_cast(_p__); │ │ │ │ │ -827 } │ │ │ │ │ -828 │ │ │ │ │ -_8_2_9 _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t* _o_p_e_r_a_t_o_r_&() │ │ │ │ │ -830 { │ │ │ │ │ -831 return this; │ │ │ │ │ -832 } │ │ │ │ │ -833 │ │ │ │ │ -834 // the data, very simply a pointer to the diagonal value and the row number │ │ │ │ │ -_8_3_5 K* _p__; │ │ │ │ │ -_8_3_6 _s_i_z_e___t_y_p_e _r_o_w__; │ │ │ │ │ -837 }; │ │ │ │ │ -838 │ │ │ │ │ -839 template< class K, int n > │ │ │ │ │ -_8_4_0 class _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r : public _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t │ │ │ │ │ -841 { │ │ │ │ │ -842 template │ │ │ │ │ -_8_4_3 friend class _D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r; │ │ │ │ │ -844 friend class _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r<_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r, K, K&>; │ │ │ │ │ -845 │ │ │ │ │ -846 public: │ │ │ │ │ -847 // standard constructor and everything is sufficient ... │ │ │ │ │ -848 │ │ │ │ │ -849 //===== type definitions and constants │ │ │ │ │ -850 │ │ │ │ │ -_8_5_2 typedef K _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -853 │ │ │ │ │ -_8_5_5 typedef K _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -856 │ │ │ │ │ -_8_5_8 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -859 │ │ │ │ │ -_8_6_1 _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r() : _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t() │ │ │ │ │ -862 {} │ │ │ │ │ -863 │ │ │ │ │ -_8_6_5 explicit _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r (K* p, int col) : _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t(p, │ │ │ │ │ -col) │ │ │ │ │ -866 {} │ │ │ │ │ -867 │ │ │ │ │ -868 //===== assignment from scalar │ │ │ │ │ -_8_7_0 _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r& _o_p_e_r_a_t_o_r_=_ (const K& k) │ │ │ │ │ -871 { │ │ │ │ │ -872 *_p__ = k; │ │ │ │ │ -873 return *this; │ │ │ │ │ -874 } │ │ │ │ │ -875 │ │ │ │ │ -876 //===== access to components │ │ │ │ │ -877 │ │ │ │ │ -_8_7_9 K& _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] _s_i_z_e___t_y_p_e i) │ │ │ │ │ -880 { │ │ │ │ │ -881 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i == _r_o_w__); │ │ │ │ │ -882 return *_p__; │ │ │ │ │ -883 } │ │ │ │ │ -884 │ │ │ │ │ -_8_8_6 typedef _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_<_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_K_,_n_>, K, K&> _I_t_e_r_a_t_o_r; │ │ │ │ │ -_8_8_8 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ │ -889 │ │ │ │ │ -_8_9_1 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ -892 { │ │ │ │ │ -893 return _I_t_e_r_a_t_o_r(*this, 0); │ │ │ │ │ -894 } │ │ │ │ │ -895 │ │ │ │ │ -_8_9_7 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ -898 { │ │ │ │ │ -899 return _I_t_e_r_a_t_o_r(*this, 1); │ │ │ │ │ -900 } │ │ │ │ │ -901 │ │ │ │ │ -_9_0_4 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ -905 { │ │ │ │ │ -906 return _I_t_e_r_a_t_o_r(*this, 0); │ │ │ │ │ -907 } │ │ │ │ │ -908 │ │ │ │ │ -_9_1_1 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ -912 { │ │ │ │ │ -913 return _I_t_e_r_a_t_o_r(*this, -1); │ │ │ │ │ -914 } │ │ │ │ │ -915 │ │ │ │ │ -_9_1_7 typedef _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_<_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_K_,_n_>, const K, │ │ │ │ │ -const K&> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -_9_1_9 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; │ │ │ │ │ -920 │ │ │ │ │ -921 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_i_d_e_n_t_i_c_a_l; │ │ │ │ │ -922 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t::operator[]; │ │ │ │ │ -923 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t::operator==; │ │ │ │ │ -924 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_e_g_i_n; │ │ │ │ │ -925 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_e_n_d; │ │ │ │ │ -926 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_e_f_o_r_e_E_n_d; │ │ │ │ │ -927 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_e_f_o_r_e_B_e_g_i_n; │ │ │ │ │ -928 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_N; │ │ │ │ │ -929 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_d_i_m; │ │ │ │ │ -930 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_r_o_w_I_n_d_e_x; │ │ │ │ │ -931 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_d_i_a_g_o_n_a_l; │ │ │ │ │ -932 │ │ │ │ │ -933 protected: │ │ │ │ │ -934 │ │ │ │ │ -_9_3_5 _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r* _o_p_e_r_a_t_o_r_&() │ │ │ │ │ -936 { │ │ │ │ │ -937 return this; │ │ │ │ │ -938 } │ │ │ │ │ -939 │ │ │ │ │ -940 private: │ │ │ │ │ -941 │ │ │ │ │ -942 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_p__; │ │ │ │ │ -943 using _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_r_o_w__; │ │ │ │ │ -944 }; │ │ │ │ │ -945 │ │ │ │ │ -946 │ │ │ │ │ -947 // implement type traits │ │ │ │ │ -948 template │ │ │ │ │ -_9_4_9 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e< _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r > │ │ │ │ │ -950 { │ │ │ │ │ -_9_5_1 typedef _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_K_,_n_> _t_y_p_e; │ │ │ │ │ -952 }; │ │ │ │ │ -953 │ │ │ │ │ -954 template │ │ │ │ │ -_9_5_5 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e< _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t > │ │ │ │ │ -956 { │ │ │ │ │ -_9_5_7 typedef _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_K_,_n_> _t_y_p_e; │ │ │ │ │ -958 }; │ │ │ │ │ -959 │ │ │ │ │ -960 template │ │ │ │ │ -_9_6_1 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e< _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r > │ │ │ │ │ -962 { │ │ │ │ │ -_9_6_3 typedef _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_K_,_n_> _t_y_p_e; │ │ │ │ │ -964 }; │ │ │ │ │ -965 │ │ │ │ │ -966 template │ │ │ │ │ -_9_6_7 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e< _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t > │ │ │ │ │ -968 { │ │ │ │ │ -_9_6_9 typedef _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_K_,_n_> _t_y_p_e; │ │ │ │ │ -970 }; │ │ │ │ │ -971 │ │ │ │ │ -972 │ │ │ │ │ -973 │ │ │ │ │ -996 template │ │ │ │ │ -_9_9_7 class _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r : public │ │ │ │ │ -_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e,T, R, int> │ │ │ │ │ -998 { │ │ │ │ │ -_9_9_9 typedef typename std::remove_const::type NonConstCW; │ │ │ │ │ -1000 │ │ │ │ │ -1001 friend class _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r:: │ │ │ │ │ -type, typename _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e::type>; │ │ │ │ │ -1002 friend class _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r:: │ │ │ │ │ -type, typename const_reference::type>; │ │ │ │ │ -1003 │ │ │ │ │ -1004 typedef _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -typename mutable_reference::type> _M_y_T_y_p_e; │ │ │ │ │ -1005 typedef _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -typename const_reference::type> _M_y_C_o_n_s_t_T_y_p_e; │ │ │ │ │ -1006 │ │ │ │ │ -1007 public: │ │ │ │ │ -1008 │ │ │ │ │ -1009 // Constructors needed by the facade iterators. │ │ │ │ │ -_1_0_1_0 _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r() : │ │ │ │ │ -1011 containerWrapper_(), │ │ │ │ │ -1012 position_(0) │ │ │ │ │ -1013 {} │ │ │ │ │ -1014 │ │ │ │ │ -_1_0_1_5 _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r(CW containerWrapper, int position) : │ │ │ │ │ -1016 containerWrapper_(containerWrapper), │ │ │ │ │ -1017 position_(position) │ │ │ │ │ -1018 {} │ │ │ │ │ -1019 │ │ │ │ │ -1020 template │ │ │ │ │ -_1_0_2_1 _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r(OtherContainerWrapperIteratorType& other) : │ │ │ │ │ -1022 containerWrapper_(other.containerWrapper_), │ │ │ │ │ -1023 position_(other.position_) │ │ │ │ │ -1024 {} │ │ │ │ │ -1025 │ │ │ │ │ -_1_0_2_6 _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r(const _M_y_T_y_p_e& other) : │ │ │ │ │ -1027 containerWrapper_(other.containerWrapper_), │ │ │ │ │ -1028 position_(other.position_) │ │ │ │ │ -1029 {} │ │ │ │ │ -1030 │ │ │ │ │ -_1_0_3_1 _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r(const _M_y_C_o_n_s_t_T_y_p_e& other) : │ │ │ │ │ -1032 containerWrapper_(other.containerWrapper_), │ │ │ │ │ -1033 position_(other.position_) │ │ │ │ │ -1034 {} │ │ │ │ │ -1035 │ │ │ │ │ -1036 template │ │ │ │ │ -_1_0_3_7 _C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(OtherContainerWrapperIteratorType& │ │ │ │ │ -other) │ │ │ │ │ -1038 { │ │ │ │ │ -1039 containerWrapper_ = other.containerWrapper_; │ │ │ │ │ -1040 position_ = other.position_; │ │ │ │ │ -1041 return *this; │ │ │ │ │ -1042 } │ │ │ │ │ -1043 │ │ │ │ │ -1044 // This operator is needed since we can not get the address of the │ │ │ │ │ -1045 // temporary object returned by dereference │ │ │ │ │ -_1_0_4_6 T* _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ -1047 { │ │ │ │ │ -1048 return containerWrapper_.pointer(position_); │ │ │ │ │ -1049 } │ │ │ │ │ -1050 │ │ │ │ │ -1051 // Methods needed by the forward iterator │ │ │ │ │ -_1_0_5_2 bool _e_q_u_a_l_s(const _M_y_T_y_p_e& other) const │ │ │ │ │ -1053 { │ │ │ │ │ -1054 return position_ == other.position_ && containerWrapper_.identical │ │ │ │ │ -(other.containerWrapper_); │ │ │ │ │ -1055 } │ │ │ │ │ -1056 │ │ │ │ │ -_1_0_5_7 bool _e_q_u_a_l_s(const _M_y_C_o_n_s_t_T_y_p_e& other) const │ │ │ │ │ -1058 { │ │ │ │ │ -1059 return position_ == other.position_ && containerWrapper_.identical │ │ │ │ │ -(other.containerWrapper_); │ │ │ │ │ -1060 } │ │ │ │ │ -1061 │ │ │ │ │ -_1_0_6_2 R _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ -1063 { │ │ │ │ │ -1064 return *containerWrapper_.pointer(position_); │ │ │ │ │ -1065 } │ │ │ │ │ -1066 │ │ │ │ │ -_1_0_6_7 void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ -1068 { │ │ │ │ │ -1069 ++position_; │ │ │ │ │ -1070 } │ │ │ │ │ -1071 │ │ │ │ │ -1072 // Additional function needed by BidirectionalIterator │ │ │ │ │ -_1_0_7_3 void _d_e_c_r_e_m_e_n_t() │ │ │ │ │ -1074 { │ │ │ │ │ -1075 --position_; │ │ │ │ │ -1076 } │ │ │ │ │ -1077 │ │ │ │ │ -1078 // Additional function needed by RandomAccessIterator │ │ │ │ │ -_1_0_7_9 R _e_l_e_m_e_n_t_A_t(int i) const │ │ │ │ │ -1080 { │ │ │ │ │ -1081 return *containerWrapper_.pointer(position_+i); │ │ │ │ │ -1082 } │ │ │ │ │ -1083 │ │ │ │ │ -_1_0_8_4 void _a_d_v_a_n_c_e(int n) │ │ │ │ │ -1085 { │ │ │ │ │ -1086 position_=position_+n; │ │ │ │ │ -1087 } │ │ │ │ │ -1088 │ │ │ │ │ -1089 template │ │ │ │ │ -_1_0_9_0 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(OtherContainerWrapperIteratorType& other) const │ │ │ │ │ -1091 { │ │ │ │ │ -1092 assert(containerWrapper_.identical(other)); │ │ │ │ │ -1093 return other.position_ - position_; │ │ │ │ │ -1094 } │ │ │ │ │ -1095 │ │ │ │ │ -_1_0_9_6 std::ptrdiff_t _i_n_d_e_x() const │ │ │ │ │ -1097 { │ │ │ │ │ -1098 return containerWrapper_.realIndex(position_); │ │ │ │ │ -1099 } │ │ │ │ │ -1100 │ │ │ │ │ -1101 private: │ │ │ │ │ -1102 NonConstCW containerWrapper_; │ │ │ │ │ -1103 size_t position_; │ │ │ │ │ -1104 }; │ │ │ │ │ -1105 │ │ │ │ │ -1106 template │ │ │ │ │ -_1_1_0_7 struct _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, _D_i_a_g_o_n_a_l_M_a_t_r_i_x> { │ │ │ │ │ -_1_1_0_8 static void _a_p_p_l_y(_D_e_n_s_e_M_a_t_r_i_x& denseMatrix, │ │ │ │ │ -1109 _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_f_i_e_l_d_,_ _N_> const& rhs) { │ │ │ │ │ -1110 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(denseMatrix._M() == N); │ │ │ │ │ -1111 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(denseMatrix._N() == N); │ │ │ │ │ -1112 denseMatrix = field(0); │ │ │ │ │ -1113 for (int i = 0; i < N; ++i) │ │ │ │ │ -1114 denseMatrix[i][i] = rhs._d_i_a_g_o_n_a_l()[i]; │ │ │ │ │ -1115 } │ │ │ │ │ -1116 }; │ │ │ │ │ -1117 /* @} */ │ │ │ │ │ -1118} // end namespace │ │ │ │ │ -1119#endif │ │ │ │ │ +105 template │ │ │ │ │ +_1_0_6 auto _i_o(const V &v) │ │ │ │ │ +107 { │ │ │ │ │ +108 return _S_i_m_d_I_m_p_l_:_:_i_o(v); │ │ │ │ │ +109 } │ │ │ │ │ +110 │ │ │ │ │ +112 │ │ │ │ │ +114 │ │ │ │ │ +115 } // namespace Simd │ │ │ │ │ +116} // namespace Dune │ │ │ │ │ +117 │ │ │ │ │ +118#endif // DUNE_COMMON_SIMD_IO_HH │ │ │ │ │ +_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +Utilities for reduction like operations on ranges. │ │ │ │ │ _t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ Traits for type conversions and type information. │ │ │ │ │ -_f_v_e_c_t_o_r_._h_h │ │ │ │ │ -Implements a vector constructed from a given type representing a field and a │ │ │ │ │ -compile-time given size. │ │ │ │ │ -_f_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implements a matrix constructed from a given type representing a field and │ │ │ │ │ -compile-time given number ... │ │ │ │ │ -_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ -Macro for wrapping boundary checks. │ │ │ │ │ -_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h │ │ │ │ │ -Implements a generic iterator class for writing stl conformant iterators. │ │ │ │ │ -_d_e_n_s_e_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implements a matrix constructed from a given type representing a field and a │ │ │ │ │ -compile-time given numbe... │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ -#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ -If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ -nothing. │ │ │ │ │ -DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -ConstIterator beforeBegin() const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:208 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_t_r_a_n_s_p_o_s_e_d │ │ │ │ │ -DiagonalMatrix< K, n > transposed() const │ │ │ │ │ -Return transposed of the matrix as DiagonalMatrix. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:136 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ -void mmhv(const X &x, Y &y) const │ │ │ │ │ -y -= A^H x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:357 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ -DiagonalMatrix & operator*=(const K &k) │ │ │ │ │ -vector space multiplication with scalar │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:246 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -FieldTraits< K >::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:563 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_d_i_m │ │ │ │ │ -size_type dim() const │ │ │ │ │ -dimension of the vector space │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:800 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:183 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ -row_type row_reference │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -K & operator[](size_type i) │ │ │ │ │ -random access │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:879 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -ContainerWrapperIterator & operator=(OtherContainerWrapperIteratorType &other) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1037 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_r_o_w_s │ │ │ │ │ -static constexpr int rows │ │ │ │ │ -The number of rows. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_M │ │ │ │ │ -static constexpr size_type M() │ │ │ │ │ -number of blocks in column direction │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:488 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ -FieldVector< K, n > & diagonal() │ │ │ │ │ -Get reference to diagonal vector. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:549 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ -void usmhv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y │ │ │ │ │ -&y) const │ │ │ │ │ -y += alpha A^H x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:395 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -Iterator iterator │ │ │ │ │ -typedef for stl compliant access │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:888 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1067 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ -static constexpr int blocklevel │ │ │ │ │ -The number of block levels we contain. This is the leaf, that is, 1. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_ _K_,_ _n_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -DiagonalRowVectorConst< K, n > type │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:957 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ -T * operator->() const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1046 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_s_i_z_e │ │ │ │ │ -static constexpr int size │ │ │ │ │ -The size of this vector. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:724 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_p_o_i_n_t_e_r │ │ │ │ │ -K * pointer(size_type i) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:824 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -K field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:712 │ │ │ │ │ -_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_ _K_,_ _n_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -DiagonalRowVector< K, n > type │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:963 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -ConstIterator beforeEnd() const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:773 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:185 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:498 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:179 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ -const_row_type const_row_reference │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_s_i_z_e │ │ │ │ │ -static constexpr size_type size() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_r_o_w__ │ │ │ │ │ -size_type row_ │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:836 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r │ │ │ │ │ -ContainerWrapperIterator(CW containerWrapper, int position) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1015 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r │ │ │ │ │ -DiagonalRowVector(K *p, int col) │ │ │ │ │ -Constructor making vector with identical coordinates. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:865 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ -K & diagonal(size_type i) │ │ │ │ │ -Get reference to diagonal entry. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:537 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:438 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_N │ │ │ │ │ -static constexpr size_type N() │ │ │ │ │ -number of blocks in row direction │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:482 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -Iterator beforeBegin() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:911 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r │ │ │ │ │ -ContainerWrapperIterator(OtherContainerWrapperIteratorType &other) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1021 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:525 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -Iterator iterator │ │ │ │ │ -typedef for stl compliant access │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_e_g_i_n │ │ │ │ │ -ConstIterator begin() const │ │ │ │ │ -begin ConstIterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:760 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator const_iterator │ │ │ │ │ -typedef for stl compliant access │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:919 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_i_d_e_n_t_i_c_a_l │ │ │ │ │ -bool identical(const DiagonalRowVectorConst< K, n > &other) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:749 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ -DiagonalMatrix & operator-=(const DiagonalMatrix &y) │ │ │ │ │ -vector space subtraction │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:225 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t │ │ │ │ │ -DiagonalRowVectorConst(K *p, int col) │ │ │ │ │ -Constructor making vector with identical coordinates. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:733 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ -void mmtv(const X &x, Y &y) const │ │ │ │ │ -y -= A^T x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:345 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ -static constexpr int blocklevel │ │ │ │ │ -The number of block levels we contain. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:721 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ -row_type * pointer(int i) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:676 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x │ │ │ │ │ -DiagonalMatrix(const K &k) │ │ │ │ │ -Constructor initializing the whole matrix with a scalar. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:98 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -ContainerWrapperIterator< DiagonalRowVector< K, n >, K, K & > Iterator │ │ │ │ │ -Iterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:886 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ -R elementAt(int i) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1079 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -std::ptrdiff_t distanceTo(OtherContainerWrapperIteratorType &other) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1090 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -Iterator beforeEnd() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:904 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ -void umtv(const X &x, Y &y) const │ │ │ │ │ -y += A^T x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:309 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator const_iterator │ │ │ │ │ -typedef for stl compliant access │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:757 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ -double infinity_norm_real() const │ │ │ │ │ -simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:427 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r │ │ │ │ │ -DiagonalMatrixWrapper(const DiagonalMatrixType *mat) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:667 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ -void umv(const X &x, Y &y) const │ │ │ │ │ -y += A x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:297 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_<_ _K_,_ _n_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -DiagonalRowVector< K, n > type │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:969 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ -void mv(const X &x, Y &y) const │ │ │ │ │ -y = A x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ -double frobenius_norm() const │ │ │ │ │ -frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:409 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -ConstIterator end() const │ │ │ │ │ -end iterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_c_o_l_s │ │ │ │ │ -static constexpr int cols │ │ │ │ │ -The number of columns. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:83 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_d_i_m_e_n_s_i_o_n │ │ │ │ │ -static constexpr int dimension │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:705 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_p__ │ │ │ │ │ -K * p_ │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:835 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_r_o_w_I_n_d_e_x │ │ │ │ │ -size_type rowIndex() const │ │ │ │ │ -index of this row in surrounding matrix │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:806 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ -R dereference() const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1062 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -DiagonalRowVector & operator=(const K &k) │ │ │ │ │ -Assignment operator for scalar. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:870 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -bool operator!=(const DiagonalMatrix &other) const │ │ │ │ │ -incomparison operator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:268 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -value_type field_type │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ -void advance(int n) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1084 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ -ConstIterator begin() const │ │ │ │ │ -begin iterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ -Iterator begin() │ │ │ │ │ -begin iterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:891 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ -void mmv(const X &x, Y &y) const │ │ │ │ │ -y -= A x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:333 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ -DiagonalMatrix & operator/=(const K &k) │ │ │ │ │ -vector space division by scalar │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:253 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:181 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_i_d_e_n_t_i_c_a_l │ │ │ │ │ -bool identical(const DiagonalMatrix< K, n > &other) const │ │ │ │ │ -Check if matrix is the same object as the other matrix. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:130 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -friend auto operator*(const DiagonalMatrix &matrixA, const DiagonalMatrix< │ │ │ │ │ -OtherScalar, n > &matrixB) │ │ │ │ │ -Matrix-matrix multiplication. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:468 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_:_:_r_e_a_l_I_n_d_e_x │ │ │ │ │ -size_type realIndex(int i) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:671 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -Iterator end() │ │ │ │ │ -end iterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:158 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -const K & operator[](size_type i) const │ │ │ │ │ -same for read only access │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:741 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r │ │ │ │ │ -DiagonalRowVector() │ │ │ │ │ -Constructor making uninitialized vector. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:861 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -row_type reference │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_o_p_e_r_a_t_o_r_& │ │ │ │ │ -DiagonalRowVectorConst * operator&() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:829 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -bool operator==(const DiagonalRowVectorConst &y) const │ │ │ │ │ -Binary vector comparison. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:786 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ -double frobenius_norm2() const │ │ │ │ │ -square of frobenius norm, need for block recursion │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:415 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x │ │ │ │ │ -constexpr DiagonalMatrix()=default │ │ │ │ │ -Default constructor. │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ -void mtv(const X &x, Y &y) const │ │ │ │ │ -y = A^T x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:290 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ContainerWrapperIterator< DiagonalRowVectorConst< K, n >, const K, const K & > │ │ │ │ │ -ConstIterator │ │ │ │ │ -ConstIterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:917 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_:_:_i_d_e_n_t_i_c_a_l │ │ │ │ │ -bool identical(const DiagonalMatrixWrapper &other) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:682 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ -void usmtv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y │ │ │ │ │ -&y) const │ │ │ │ │ -y += alpha A^T x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:382 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ -void decrement() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1073 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ -std::ptrdiff_t index() const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1096 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ -const FieldVector< K, n > & diagonal() const │ │ │ │ │ -Get const reference to diagonal vector. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:543 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_i_n_v_e_r_t │ │ │ │ │ -void invert() │ │ │ │ │ -Compute inverse. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:445 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_& │ │ │ │ │ -DiagonalRowVector * operator&() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:935 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ -const K & diagonal(size_type i) const │ │ │ │ │ -Get const reference to diagonal entry. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:531 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_N │ │ │ │ │ -size_type N() const │ │ │ │ │ -number of blocks in the vector (are of size 1 here) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:794 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x │ │ │ │ │ -DiagonalMatrix(std::initializer_list< K > const &l) │ │ │ │ │ -Construct diagonal matrix from an initializer list. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -K field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:852 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:519 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_<_ _K_,_ _n_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -DiagonalRowVectorConst< K, n > type │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:951 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ -Iterator end() │ │ │ │ │ -end iterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:897 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x │ │ │ │ │ -DiagonalMatrix(const FieldVector< K, n > &diag) │ │ │ │ │ -Constructor initializing the diagonal with a vector. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:103 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -The type used for the index access and size operation. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:858 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ -void usmv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) │ │ │ │ │ -const │ │ │ │ │ -y += alpha A x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:369 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ -double infinity_norm() const │ │ │ │ │ -infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:421 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ -DiagonalMatrix & operator+=(const DiagonalMatrix &y) │ │ │ │ │ -vector space addition │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:218 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ -void umhv(const X &x, Y &y) const │ │ │ │ │ -y += A^H x │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:321 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -Iterator beforeBegin() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:172 │ │ │ │ │ -_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_,_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _f_i_e_l_d_,_ _N_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ │ -static void apply(DenseMatrix &denseMatrix, DiagonalMatrix< field, N > const │ │ │ │ │ -&rhs) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1108 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r │ │ │ │ │ -ContainerWrapperIterator(const MyType &other) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1026 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_e_n_d │ │ │ │ │ -ConstIterator end() const │ │ │ │ │ -end ConstIterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:766 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -The type used for the index access and size operation. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:718 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -DiagonalMatrix & operator=(const K &k) │ │ │ │ │ -Assignment from a scalar. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:123 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t │ │ │ │ │ -DiagonalRowVectorConst() │ │ │ │ │ -Constructor making uninitialized vector. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:727 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -Iterator beforeEnd() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:165 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_r_e_a_l_I_n_d_e_x │ │ │ │ │ -size_type realIndex(int i) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:819 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -friend std::ostream & operator<<(std::ostream &s, const DiagonalMatrix< K, n > │ │ │ │ │ -&a) │ │ │ │ │ -Sends the matrix to an output stream. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:508 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -K value_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -K block_type │ │ │ │ │ -export the type representing the components │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:715 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:453 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -FieldTraits< K >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:564 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -ConstIterator beforeBegin() const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:780 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r │ │ │ │ │ -DiagonalMatrixWrapper() │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:663 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ContainerWrapperIterator< DiagonalRowVectorConst< K, n >, const K, const K & > │ │ │ │ │ -ConstIterator │ │ │ │ │ -ConstIterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:755 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ -Iterator begin() │ │ │ │ │ -begin iterator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:152 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -bool operator==(const DiagonalMatrix &other) const │ │ │ │ │ -comparison operator │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:262 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const MyType &other) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1052 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_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 diagonalmatrix.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -K block_type │ │ │ │ │ -export the type representing the components │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:855 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -ConstIterator beforeEnd() const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:201 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ -const K & diagonal() const │ │ │ │ │ -the diagonal value │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:812 │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ +static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ +>, std::integral_constant< T, to >) noexcept │ │ │ │ │ +DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_a_u_t_o_C_o_p_y │ │ │ │ │ +constexpr AutonomousValue< T > autoCopy(T &&v) │ │ │ │ │ +Autonomous copy of an expression's value for use in auto type deduction. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:642 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_i_o │ │ │ │ │ +auto io(const V &v) │ │ │ │ │ +construct a stream inserter │ │ │ │ │ +DDeeffiinniittiioonn io.hh:106 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_v_i_o │ │ │ │ │ +auto vio(const V &v) │ │ │ │ │ +construct a stream inserter │ │ │ │ │ +DDeeffiinniittiioonn io.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ +constexpr std::size_t lanes() │ │ │ │ │ +Number of lanes in a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ +decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ +Extract an element of a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_S_c_a_l_a_r │ │ │ │ │ +typename Overloads::ScalarType< std::decay_t< V > >::type Scalar │ │ │ │ │ +Element type of some SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:235 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x │ │ │ │ │ -K conjugateComplex(const K &x) │ │ │ │ │ -compute conjugate complex of x │ │ │ │ │ -DDeeffiinniittiioonn math.hh:164 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x │ │ │ │ │ -A dense n x m matrix. │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_M │ │ │ │ │ -constexpr size_type M() const │ │ │ │ │ -number of columns │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:703 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_N │ │ │ │ │ -constexpr size_type N() const │ │ │ │ │ -number of rows │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:697 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ -A dense n x m matrix. │ │ │ │ │ -DDeeffiinniittiioonn fmatrix.hh:117 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -vector space out of a tensor product of fields. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_A_s_s_i_g_n_e_r │ │ │ │ │ -you have to specialize this structure for any type that should be assignable to │ │ │ │ │ -a DenseMatrix │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_F_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ │ -Error thrown if operations of a FieldMatrix fail. │ │ │ │ │ -DDeeffiinniittiioonn densematrix.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_t_w_o___n_o_r_m_2 │ │ │ │ │ -FieldTraits< value_type >::real_type two_norm2() const │ │ │ │ │ -square of two norm (sum over squared values of entries), need for block │ │ │ │ │ -recursion │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:650 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_t_w_o___n_o_r_m │ │ │ │ │ -FieldTraits< value_type >::real_type two_norm() const │ │ │ │ │ -two norm sqrt(sum over squared values of entries) │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:641 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ -Iterator begin() │ │ │ │ │ -begin iterator │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ -FieldTraits< vt >::real_type infinity_norm() const │ │ │ │ │ -infinity norm (maximum of absolute values of entries) │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:661 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ -FieldTraits< vt >::real_type infinity_norm_real() const │ │ │ │ │ -simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:677 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r_C_o_n_s_t │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:698 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_R_o_w_V_e_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:841 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x_W_r_a_p_p_e_r │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:650 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator class for sparse vector-like containers. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:998 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r │ │ │ │ │ -ContainerWrapperIterator(const MyConstType &other) │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1031 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_t_a_i_n_e_r_W_r_a_p_p_e_r_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const MyConstType &other) const │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:1057 │ │ │ │ │ -_D_u_n_e_:_:_D_i_a_g_o_n_a_l_M_a_t_r_i_x │ │ │ │ │ -A diagonal matrix of static size. │ │ │ │ │ -DDeeffiinniittiioonn diagonalmatrix.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -T field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -T real_type │ │ │ │ │ -export the type representing the real type of the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -Get the 'const' version of a reference to a mutable object. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e │ │ │ │ │ -get the 'mutable' version of a reference to a const object │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_B_i_d_i_r_e_c_t_i_o_n_a_l_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -Facade class for stl conformant bidirectional iterators. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:274 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_i_o │ │ │ │ │ +Inserter< V > io(const V &v) │ │ │ │ │ +DDeeffiinniittiioonn io.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r │ │ │ │ │ +DDeeffiinniittiioonn io.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_:_:_I_n_s_e_r_t_e_r │ │ │ │ │ +Inserter(const T &value) │ │ │ │ │ +DDeeffiinniittiioonn io.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_I_m_p_l_:_:_I_n_s_e_r_t_e_r_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +friend Stream & operator<<(Stream &out, const Inserter &ins) │ │ │ │ │ +DDeeffiinniittiioonn io.hh:37 │ │ │ │ │ +_s_i_m_d_._h_h │ │ │ │ │ +Include file for users of the SIMD abstraction layer. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00161.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: assertandreturn.hh File Reference │ │ │ │ +dune-common: vc.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -69,29 +69,25 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -Macros
    │ │ │ │ -
    assertandreturn.hh File Reference
    │ │ │ │ +
    vc.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include <cassert>
    │ │ │ │ -
    │ │ │ │ + │ │ │ │ +

    Compatibility header for including <Vc/Vc> │ │ │ │ +More...

    │ │ │ │ + │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Macros

    #define DUNE_ASSERT_AND_RETURN(C, X)   (!(C) ? throw [&](){assert(!#C);return 0;}() : 0), X
     Asserts a condition and return on success in constexpr context.
     
    │ │ │ │ -
    │ │ │ │ +

    Detailed Description

    │ │ │ │ +

    Compatibility header for including <Vc/Vc>

    │ │ │ │ +

    Certain versions (1.3.2) of Vc (https://github.com/VcDevel/Vc) have a problem with certain compiler versions (g++ 7.2.0) in c++17 mode, see #88.

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,17 +1,15 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_M_a_c_r_o_s │ │ │ │ │ -assertandreturn.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +vc.hh File Reference │ │ │ │ │ +Compatibility header for including _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_. │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___A_S_S_E_R_T___A_N_D___R_E_T_U_R_N(C, X)   (!(C) ? throw [&](){assert(!#C);return │ │ │ │ │ - 0;}() : 0), X │ │ │ │ │ -  Asserts a condition and return on success in constexpr context. │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Compatibility header for including │ │ │ │ │ +Certain versions (1.3.2) of Vc (_h_t_t_p_s_:_/_/_g_i_t_h_u_b_._c_o_m_/_V_c_D_e_v_e_l_/_V_c) have a problem │ │ │ │ │ +with certain compiler versions (g++ 7.2.0) in c++17 mode, see #88. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00161_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: assertandreturn.hh Source File │ │ │ │ +dune-common: vc.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,36 +74,38 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    assertandreturn.hh
    │ │ │ │ +
    vc.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_ASSERTANDRETURN_HH
    │ │ │ │ -
    6#define DUNE_COMMON_ASSERTANDRETURN_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include <cassert>
    │ │ │ │ -
    9
    │ │ │ │ -
    11
    │ │ │ │ -
    19#ifdef NDEBUG
    │ │ │ │ -
    20 #define DUNE_ASSERT_AND_RETURN(C,X) X
    │ │ │ │ -
    21#else
    │ │ │ │ -
    22 #define DUNE_ASSERT_AND_RETURN(C,X) (!(C) ? throw [&](){assert(!#C);return 0;}() : 0), X
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_VC_HH
    │ │ │ │ +
    4#define DUNE_COMMON_VC_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    15#if HAVE_VC
    │ │ │ │ +
    16
    │ │ │ │ +
    17// include Vc's macro definitions
    │ │ │ │ +
    18#include <Vc/global.h>
    │ │ │ │ +
    19
    │ │ │ │ +
    20// undefine the macro that signals C++17 support, if set
    │ │ │ │ +
    21#ifdef Vc_CXX17
    │ │ │ │ +
    22#undef Vc_CXX17
    │ │ │ │
    23#endif
    │ │ │ │
    24
    │ │ │ │ -
    25
    │ │ │ │ -
    26
    │ │ │ │ -
    27#endif // DUNE_COMMON_ASSERTANDRETURN_HH
    │ │ │ │ +
    25// include the rest of Vc
    │ │ │ │ +
    26#include <Vc/Vc>
    │ │ │ │ +
    27
    │ │ │ │ +
    28#endif // HAVE_VC
    │ │ │ │ +
    29
    │ │ │ │ +
    30#endif // DUNE_COMMON_VC_HH
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,31 +1,32 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -assertandreturn.hh │ │ │ │ │ +vc.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_ASSERTANDRETURN_HH │ │ │ │ │ -6#define DUNE_COMMON_ASSERTANDRETURN_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -11 │ │ │ │ │ -19#ifdef NDEBUG │ │ │ │ │ -20 #define DUNE_ASSERT_AND_RETURN(C,X) X │ │ │ │ │ -21#else │ │ │ │ │ -_2_2 #define DUNE_ASSERT_AND_RETURN(C,X) (!(C) ? throw [&](){assert(!#C);return │ │ │ │ │ -0;}() : 0), X │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_VC_HH │ │ │ │ │ +4#define DUNE_COMMON_VC_HH │ │ │ │ │ +5 │ │ │ │ │ +15#if HAVE_VC │ │ │ │ │ +16 │ │ │ │ │ +17// include Vc's macro definitions │ │ │ │ │ +18#include │ │ │ │ │ +19 │ │ │ │ │ +20// undefine the macro that signals C++17 support, if set │ │ │ │ │ +21#ifdef Vc_CXX17 │ │ │ │ │ +22#undef Vc_CXX17 │ │ │ │ │ 23#endif │ │ │ │ │ 24 │ │ │ │ │ -25 │ │ │ │ │ -26 │ │ │ │ │ -27#endif // DUNE_COMMON_ASSERTANDRETURN_HH │ │ │ │ │ +25// include the rest of Vc │ │ │ │ │ +26#include │ │ │ │ │ +27 │ │ │ │ │ +28#endif // HAVE_VC │ │ │ │ │ +29 │ │ │ │ │ +30#endif // DUNE_COMMON_VC_HH │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00164.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: proxymemberaccess.hh File Reference │ │ │ │ +dune-common: quadmath.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -69,43 +69,19 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -Namespaces | │ │ │ │ -Functions
    │ │ │ │ -
    proxymemberaccess.hh File Reference
    │ │ │ │ +
    quadmath.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    infrastructure for supporting operator->() on both references and proxies │ │ │ │ -More...

    │ │ │ │ -
    #include <type_traits>
    │ │ │ │ -#include <utility>
    │ │ │ │ -
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Namespaces

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

    │ │ │ │ -Functions

    template<typename T >
    pointer_or_proxy_holder Dune::handle_proxy_member_access (T &&t)
     Transparent support for providing member access to both lvalues and rvalues (temporary proxies).
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    infrastructure for supporting operator->() on both references and proxies

    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,28 +1,10 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -proxymemberaccess.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _U_t_i_l_i_t_i_e_s » _C_+_+_ _u_t_i_l_i_t_i_e_s_ _a_n_d_ _b_a_c_k_p_o_r_t_s │ │ │ │ │ -infrastructure for supporting operator->() on both references and proxies │ │ │ │ │ -_M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +quadmath.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_. │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -pointer_or_proxy_holder  _D_u_n_e_:_:_h_a_n_d_l_e___p_r_o_x_y___m_e_m_b_e_r___a_c_c_e_s_s (T &&t) │ │ │ │ │ -  Transparent support for providing member access to │ │ │ │ │ - both lvalues and rvalues (temporary proxies). │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -infrastructure for supporting operator->() on both references and proxies │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00164_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: proxymemberaccess.hh Source File │ │ │ │ +dune-common: quadmath.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,107 +74,490 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    proxymemberaccess.hh
    │ │ │ │ +
    quadmath.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_PROXYMEMBERACCESS_HH
    │ │ │ │ -
    6#define DUNE_COMMON_PROXYMEMBERACCESS_HH
    │ │ │ │ +
    5#ifndef DUNE_QUADMATH_HH
    │ │ │ │ +
    6#define DUNE_QUADMATH_HH
    │ │ │ │
    7
    │ │ │ │ -
    14#include <type_traits>
    │ │ │ │ -
    15#include <utility>
    │ │ │ │ -
    16
    │ │ │ │ -
    17namespace Dune {
    │ │ │ │ -
    18
    │ │ │ │ -
    19 namespace Impl {
    │ │ │ │ -
    20
    │ │ │ │ -
    21 // helper struct to store a temporary / proxy
    │ │ │ │ -
    22 // for the duration of the member access
    │ │ │ │ -
    23 template<typename T>
    │ │ │ │ -
    24 struct member_access_proxy_holder
    │ │ │ │ -
    25 {
    │ │ │ │ -
    26
    │ │ │ │ -
    27 // only support moving the temporary into the holder object
    │ │ │ │ -
    28 member_access_proxy_holder(T&& t)
    │ │ │ │ -
    29 : _t(std::move(t))
    │ │ │ │ -
    30 {}
    │ │ │ │ +
    8#if HAVE_QUADMATH
    │ │ │ │ +
    9#include <quadmath.h>
    │ │ │ │ +
    10
    │ │ │ │ +
    11#include <cmath>
    │ │ │ │ +
    12#include <cstddef>
    │ │ │ │ +
    13#include <cstdint>
    │ │ │ │ +
    14#include <cstdlib> // abs
    │ │ │ │ +
    15#include <istream>
    │ │ │ │ +
    16#include <ostream>
    │ │ │ │ +
    17#include <type_traits>
    │ │ │ │ +
    18#include <utility>
    │ │ │ │ +
    19
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    22
    │ │ │ │ +
    23namespace Dune
    │ │ │ │ +
    24{
    │ │ │ │ +
    25 namespace Impl
    │ │ │ │ +
    26 {
    │ │ │ │ +
    27 // forward declaration
    │ │ │ │ +
    28 class Float128;
    │ │ │ │ +
    29
    │ │ │ │ +
    30 } // end namespace Impl
    │ │ │ │
    31
    │ │ │ │ -
    32 // The object is fundamentally a temporary, i.e. an rvalue,
    │ │ │ │ -
    33 //
    │ │ │ │ -
    34 const T* operator->() const
    │ │ │ │ -
    35 {
    │ │ │ │ -
    36 return &_t;
    │ │ │ │ -
    37 }
    │ │ │ │ -
    38
    │ │ │ │ -
    39 T _t;
    │ │ │ │ -
    40
    │ │ │ │ -
    41 };
    │ │ │ │ -
    42
    │ │ │ │ -
    43 } // end Impl namespace
    │ │ │ │ +
    32 using Impl::Float128;
    │ │ │ │ +
    33
    │ │ │ │ +
    34 // The purpose of this namespace is to move the `<cmath>` function overloads
    │ │ │ │ +
    35 // out of namespace `Dune`, see AlignedNumber in debugalign.hh.
    │ │ │ │ +
    36 namespace Impl
    │ │ │ │ +
    37 {
    │ │ │ │ +
    38 using float128_t = __float128;
    │ │ │ │ +
    39
    │ │ │ │ +
    41 class Float128
    │ │ │ │ +
    42 {
    │ │ │ │ +
    43 float128_t value_ = 0.0q;
    │ │ │ │
    44
    │ │ │ │ -
    45
    │ │ │ │ -
    46#ifdef DOXYGEN
    │ │ │ │ -
    47
    │ │ │ │ -
    49
    │ │ │ │ -
    79 template<typename T>
    │ │ │ │ -
    80 pointer_or_proxy_holder
    │ │ │ │ - │ │ │ │ -
    82
    │ │ │ │ -
    83#else // DOXYGEN
    │ │ │ │ -
    84
    │ │ │ │ -
    85
    │ │ │ │ -
    86 // This version matches lvalues (the C++ type deduction rules state that
    │ │ │ │ -
    87 // the T&& signature deduces to a reference iff the argument is an lvalue).
    │ │ │ │ -
    88 // As the argument is an lvalue, we do not have to worry about its lifetime
    │ │ │ │ -
    89 // and can just return its address.
    │ │ │ │ -
    90 template<typename T>
    │ │ │ │ -
    91 inline typename std::enable_if<
    │ │ │ │ -
    92 std::is_lvalue_reference<T>::value,
    │ │ │ │ -
    93 typename std::add_pointer<
    │ │ │ │ -
    94 typename std::remove_reference<
    │ │ │ │ -
    95 T
    │ │ │ │ -
    96 >::type
    │ │ │ │ -
    97 >::type
    │ │ │ │ -
    98 >::type
    │ │ │ │ - │ │ │ │ -
    100 {
    │ │ │ │ -
    101 return &target;
    │ │ │ │ -
    102 }
    │ │ │ │ -
    103
    │ │ │ │ -
    104 // This version matches rvalues (the C++ type deduction rules state that
    │ │ │ │ -
    105 // the T&& signature deduces to a non-reference iff the argument is an rvalue).
    │ │ │ │ -
    106 // In this case, we have to capture the rvalue in a new object to make sure it
    │ │ │ │ -
    107 // is kept alive for the duration of the member access. For this purpose, we move
    │ │ │ │ -
    108 // it into a member_access_proxy_holder instance.
    │ │ │ │ -
    109 template<typename T>
    │ │ │ │ -
    110 inline typename std::enable_if<
    │ │ │ │ -
    111 !std::is_lvalue_reference<T>::value,
    │ │ │ │ -
    112 Impl::member_access_proxy_holder<T>
    │ │ │ │ -
    113 >::type
    │ │ │ │ - │ │ │ │ -
    115 {
    │ │ │ │ -
    116 return {std::forward<T>(target)};
    │ │ │ │ -
    117 }
    │ │ │ │ -
    118
    │ │ │ │ -
    119#endif // DOXYGEN
    │ │ │ │ +
    45 public:
    │ │ │ │ +
    46 constexpr Float128() = default;
    │ │ │ │ +
    47 constexpr Float128(const float128_t& value) noexcept
    │ │ │ │ +
    48 : value_(value)
    │ │ │ │ +
    49 {}
    │ │ │ │ +
    50
    │ │ │ │ +
    51 // constructor from any floating-point or integer type
    │ │ │ │ +
    52 template <class T,
    │ │ │ │ +
    53 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
    │ │ │ │ +
    54 constexpr Float128(const T& value) noexcept
    │ │ │ │ +
    55 : value_(value)
    │ │ │ │ +
    56 {}
    │ │ │ │ +
    57
    │ │ │ │ +
    58 // constructor from pointer to null-terminated byte string
    │ │ │ │ +
    59 explicit Float128(const char* str) noexcept
    │ │ │ │ +
    60 : value_(strtoflt128(str, NULL))
    │ │ │ │ +
    61 {}
    │ │ │ │ +
    62
    │ │ │ │ +
    63 // accessors
    │ │ │ │ +
    64 constexpr operator float128_t() const noexcept { return value_; }
    │ │ │ │ +
    65
    │ │ │ │ +
    66 constexpr float128_t const& value() const noexcept { return value_; }
    │ │ │ │ +
    67 constexpr float128_t& value() noexcept { return value_; }
    │ │ │ │ +
    68
    │ │ │ │ +
    69 // I/O
    │ │ │ │ +
    70 template<class CharT, class Traits>
    │ │ │ │ +
    71 friend std::basic_istream<CharT, Traits>&
    │ │ │ │ +
    72 operator>>(std::basic_istream<CharT, Traits>& in, Float128& x)
    │ │ │ │ +
    73 {
    │ │ │ │ +
    74 std::string buf;
    │ │ │ │ +
    75 buf.reserve(128);
    │ │ │ │ +
    76 in >> buf;
    │ │ │ │ +
    77 x.value() = strtoflt128(buf.c_str(), NULL);
    │ │ │ │ +
    78 return in;
    │ │ │ │ +
    79 }
    │ │ │ │ +
    80
    │ │ │ │ +
    81 template<class CharT, class Traits>
    │ │ │ │ +
    82 friend std::basic_ostream<CharT, Traits>&
    │ │ │ │ +
    83 operator<<(std::basic_ostream<CharT, Traits>& out, const Float128& x)
    │ │ │ │ +
    84 {
    │ │ │ │ +
    85 const std::size_t bufSize = 128;
    │ │ │ │ +
    86 CharT buf[128];
    │ │ │ │ +
    87
    │ │ │ │ +
    88 std::string format = "%." + std::to_string(out.precision()) + "Q" +
    │ │ │ │ +
    89 ((out.flags() | std::ios_base::scientific) ? "e" : "f");
    │ │ │ │ +
    90 const int numChars = quadmath_snprintf(buf, bufSize, format.c_str(), x.value());
    │ │ │ │ +
    91 if (std::size_t(numChars) >= bufSize) {
    │ │ │ │ +
    92 DUNE_THROW(Dune::RangeError, "Failed to print Float128 value: buffer overflow");
    │ │ │ │ +
    93 }
    │ │ │ │ +
    94 out << buf;
    │ │ │ │ +
    95 return out;
    │ │ │ │ +
    96 }
    │ │ │ │ +
    97
    │ │ │ │ +
    98 // Increment, decrement
    │ │ │ │ +
    99 constexpr Float128& operator++() noexcept { ++value_; return *this; }
    │ │ │ │ +
    100 constexpr Float128& operator--() noexcept { --value_; return *this; }
    │ │ │ │ +
    101
    │ │ │ │ +
    102 constexpr Float128 operator++(int) noexcept { Float128 tmp{*this}; ++value_; return tmp; }
    │ │ │ │ +
    103 constexpr Float128 operator--(int) noexcept { Float128 tmp{*this}; --value_; return tmp; }
    │ │ │ │ +
    104
    │ │ │ │ +
    105 // unary operators
    │ │ │ │ +
    106 constexpr Float128 operator+() const noexcept { return Float128{+value_}; }
    │ │ │ │ +
    107 constexpr Float128 operator-() const noexcept { return Float128{-value_}; }
    │ │ │ │ +
    108
    │ │ │ │ +
    109 // assignment operators
    │ │ │ │ +
    110#define DUNE_ASSIGN_OP(OP) \
    │ │ │ │ +
    111 constexpr Float128& operator OP(const Float128& u) noexcept \
    │ │ │ │ +
    112 { \
    │ │ │ │ +
    113 value_ OP float128_t(u); \
    │ │ │ │ +
    114 return *this; \
    │ │ │ │ +
    115 } \
    │ │ │ │ +
    116 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    117
    │ │ │ │ +
    118 DUNE_ASSIGN_OP(+=);
    │ │ │ │ +
    119 DUNE_ASSIGN_OP(-=);
    │ │ │ │
    120
    │ │ │ │ -
    121} // namespace Dune
    │ │ │ │ -
    122
    │ │ │ │ -
    123#endif // DUNE_COMMON_PROXYMEMBERACCESS_HH
    │ │ │ │ -
    pointer_or_proxy_holder handle_proxy_member_access(T &&t)
    Transparent support for providing member access to both lvalues and rvalues (temporary proxies).
    │ │ │ │ +
    121 DUNE_ASSIGN_OP(*=);
    │ │ │ │ +
    122 DUNE_ASSIGN_OP(/=);
    │ │ │ │ +
    123
    │ │ │ │ +
    124#undef DUNE_ASSIGN_OP
    │ │ │ │ +
    125
    │ │ │ │ +
    126 }; // end class Float128
    │ │ │ │ +
    127
    │ │ │ │ +
    128 // binary operators:
    │ │ │ │ +
    129 // For symmetry provide overloads with arithmetic types
    │ │ │ │ +
    130 // in the first or second argument.
    │ │ │ │ +
    131#define DUNE_BINARY_OP(OP) \
    │ │ │ │ +
    132 constexpr Float128 operator OP(const Float128& t, \
    │ │ │ │ +
    133 const Float128& u) noexcept \
    │ │ │ │ +
    134 { \
    │ │ │ │ +
    135 return Float128{float128_t(t) OP float128_t(u)}; \
    │ │ │ │ +
    136 } \
    │ │ │ │ +
    137 constexpr Float128 operator OP(const float128_t& t, \
    │ │ │ │ +
    138 const Float128& u) noexcept \
    │ │ │ │ +
    139 { \
    │ │ │ │ +
    140 return Float128{t OP float128_t(u)}; \
    │ │ │ │ +
    141 } \
    │ │ │ │ +
    142 constexpr Float128 operator OP(const Float128& t, \
    │ │ │ │ +
    143 const float128_t& u) noexcept \
    │ │ │ │ +
    144 { \
    │ │ │ │ +
    145 return Float128{float128_t(t) OP u}; \
    │ │ │ │ +
    146 } \
    │ │ │ │ +
    147 template <class T, \
    │ │ │ │ +
    148 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \
    │ │ │ │ +
    149 constexpr Float128 operator OP(const T& t, \
    │ │ │ │ +
    150 const Float128& u) noexcept \
    │ │ │ │ +
    151 { \
    │ │ │ │ +
    152 return Float128{float128_t(t) OP float128_t(u)}; \
    │ │ │ │ +
    153 } \
    │ │ │ │ +
    154 template <class U, \
    │ │ │ │ +
    155 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \
    │ │ │ │ +
    156 constexpr Float128 operator OP(const Float128& t, \
    │ │ │ │ +
    157 const U& u) noexcept \
    │ │ │ │ +
    158 { \
    │ │ │ │ +
    159 return Float128{float128_t(t) OP float128_t(u)}; \
    │ │ │ │ +
    160 } \
    │ │ │ │ +
    161 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    162
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    167
    │ │ │ │ +
    168#undef DUNE_BINARY_OP
    │ │ │ │ +
    169
    │ │ │ │ +
    170 // logical operators:
    │ │ │ │ +
    171 // For symmetry provide overloads with arithmetic types
    │ │ │ │ +
    172 // in the first or second argument.
    │ │ │ │ +
    173#define DUNE_BINARY_BOOL_OP(OP) \
    │ │ │ │ +
    174 constexpr bool operator OP(const Float128& t, \
    │ │ │ │ +
    175 const Float128& u) noexcept \
    │ │ │ │ +
    176 { \
    │ │ │ │ +
    177 return float128_t(t) OP float128_t(u); \
    │ │ │ │ +
    178 } \
    │ │ │ │ +
    179 template <class T, \
    │ │ │ │ +
    180 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \
    │ │ │ │ +
    181 constexpr bool operator OP(const T& t, \
    │ │ │ │ +
    182 const Float128& u) noexcept \
    │ │ │ │ +
    183 { \
    │ │ │ │ +
    184 return float128_t(t) OP float128_t(u); \
    │ │ │ │ +
    185 } \
    │ │ │ │ +
    186 template <class U, \
    │ │ │ │ +
    187 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \
    │ │ │ │ +
    188 constexpr bool operator OP(const Float128& t, \
    │ │ │ │ +
    189 const U& u) noexcept \
    │ │ │ │ +
    190 { \
    │ │ │ │ +
    191 return float128_t(t) OP float128_t(u); \
    │ │ │ │ +
    192 } \
    │ │ │ │ +
    193 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    194
    │ │ │ │ +
    195 DUNE_BINARY_BOOL_OP(==);
    │ │ │ │ +
    196 DUNE_BINARY_BOOL_OP(!=);
    │ │ │ │ +
    197 DUNE_BINARY_BOOL_OP(<);
    │ │ │ │ +
    198 DUNE_BINARY_BOOL_OP(>);
    │ │ │ │ +
    199 DUNE_BINARY_BOOL_OP(<=);
    │ │ │ │ +
    200 DUNE_BINARY_BOOL_OP(>=);
    │ │ │ │ +
    201
    │ │ │ │ +
    202#undef DUNE_BINARY_BOOL_OP
    │ │ │ │ +
    203
    │ │ │ │ +
    204 // Overloads for the cmath functions
    │ │ │ │ +
    205
    │ │ │ │ +
    206 // function with name `name` redirects to quadmath function `func`
    │ │ │ │ +
    207#define DUNE_UNARY_FUNC(name,func) \
    │ │ │ │ +
    208 inline Float128 name(const Float128& u) noexcept \
    │ │ │ │ +
    209 { \
    │ │ │ │ +
    210 return Float128{func (float128_t(u))}; \
    │ │ │ │ +
    211 } \
    │ │ │ │ +
    212 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    213
    │ │ │ │ +
    214 // like DUNE_UNARY_FUNC but with custom return type
    │ │ │ │ +
    215#define DUNE_CUSTOM_UNARY_FUNC(type,name,func) \
    │ │ │ │ +
    216 inline type name(const Float128& u) noexcept \
    │ │ │ │ +
    217 { \
    │ │ │ │ +
    218 return (type)(func (float128_t(u))); \
    │ │ │ │ +
    219 } \
    │ │ │ │ +
    220 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    221
    │ │ │ │ +
    222 // redirects to quadmath function with two arguments
    │ │ │ │ +
    223#define DUNE_BINARY_FUNC(name,func) \
    │ │ │ │ +
    224 inline Float128 name(const Float128& t, \
    │ │ │ │ +
    225 const Float128& u) noexcept \
    │ │ │ │ +
    226 { \
    │ │ │ │ +
    227 return Float128{func (float128_t(t), float128_t(u))}; \
    │ │ │ │ +
    228 } \
    │ │ │ │ +
    229 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    230
    │ │ │ │ +
    231 DUNE_UNARY_FUNC(abs, fabsq);
    │ │ │ │ +
    232 DUNE_UNARY_FUNC(acos, acosq);
    │ │ │ │ +
    233 DUNE_UNARY_FUNC(acosh, acoshq);
    │ │ │ │ +
    234 DUNE_UNARY_FUNC(asin, asinq);
    │ │ │ │ +
    235 DUNE_UNARY_FUNC(asinh, asinhq);
    │ │ │ │ +
    236 DUNE_UNARY_FUNC(atan, atanq);
    │ │ │ │ +
    237 DUNE_UNARY_FUNC(atanh, atanhq);
    │ │ │ │ +
    238 DUNE_UNARY_FUNC(cbrt, cbrtq);
    │ │ │ │ +
    239 DUNE_UNARY_FUNC(ceil, ceilq);
    │ │ │ │ +
    240 DUNE_UNARY_FUNC(cos, cosq);
    │ │ │ │ +
    241 DUNE_UNARY_FUNC(cosh, coshq);
    │ │ │ │ +
    242 DUNE_UNARY_FUNC(erf, erfq);
    │ │ │ │ +
    243 DUNE_UNARY_FUNC(erfc, erfcq);
    │ │ │ │ +
    244 DUNE_UNARY_FUNC(exp, expq);
    │ │ │ │ +
    245 DUNE_UNARY_FUNC(expm1, expm1q);
    │ │ │ │ +
    246 DUNE_UNARY_FUNC(fabs, fabsq);
    │ │ │ │ +
    247 DUNE_UNARY_FUNC(floor, floorq);
    │ │ │ │ +
    248 DUNE_CUSTOM_UNARY_FUNC(int, ilogb, ilogbq);
    │ │ │ │ +
    249 DUNE_UNARY_FUNC(lgamma, lgammaq);
    │ │ │ │ +
    250 DUNE_CUSTOM_UNARY_FUNC(long long int, llrint, llrintq);
    │ │ │ │ +
    251 DUNE_CUSTOM_UNARY_FUNC(long long int, llround, llroundq);
    │ │ │ │ +
    252 DUNE_UNARY_FUNC(log, logq);
    │ │ │ │ +
    253 DUNE_UNARY_FUNC(log10, log10q);
    │ │ │ │ +
    254 DUNE_UNARY_FUNC(log1p, log1pq);
    │ │ │ │ +
    255 DUNE_UNARY_FUNC(log2, log2q);
    │ │ │ │ +
    256 // DUNE_UNARY_FUNC(logb, logbq); // not available in gcc5
    │ │ │ │ +
    257 DUNE_CUSTOM_UNARY_FUNC(long int, lrint, lrintq);
    │ │ │ │ +
    258 DUNE_CUSTOM_UNARY_FUNC(long int, lround, lroundq);
    │ │ │ │ +
    259 DUNE_UNARY_FUNC(nearbyint, nearbyintq);
    │ │ │ │ +
    260 DUNE_BINARY_FUNC(nextafter, nextafterq);
    │ │ │ │ +
    261 DUNE_BINARY_FUNC(pow, powq); // overload for integer argument see below
    │ │ │ │ +
    262 DUNE_UNARY_FUNC(rint, rintq);
    │ │ │ │ +
    263 DUNE_UNARY_FUNC(round, roundq);
    │ │ │ │ +
    264 DUNE_UNARY_FUNC(sin, sinq);
    │ │ │ │ +
    265 DUNE_UNARY_FUNC(sinh, sinhq);
    │ │ │ │ +
    266 DUNE_UNARY_FUNC(sqrt, sqrtq);
    │ │ │ │ +
    267 DUNE_UNARY_FUNC(tan, tanq);
    │ │ │ │ +
    268 DUNE_UNARY_FUNC(tanh, tanhq);
    │ │ │ │ +
    269 DUNE_UNARY_FUNC(tgamma, tgammaq);
    │ │ │ │ +
    270 DUNE_UNARY_FUNC(trunc, truncq);
    │ │ │ │ +
    271
    │ │ │ │ +
    272 DUNE_CUSTOM_UNARY_FUNC(bool, isfinite, finiteq);
    │ │ │ │ +
    273 DUNE_CUSTOM_UNARY_FUNC(bool, isinf, isinfq);
    │ │ │ │ +
    274 DUNE_CUSTOM_UNARY_FUNC(bool, isnan, isnanq);
    │ │ │ │ +
    275 DUNE_CUSTOM_UNARY_FUNC(bool, signbit, signbitq);
    │ │ │ │ +
    276
    │ │ │ │ +
    277#undef DUNE_UNARY_FUNC
    │ │ │ │ +
    278#undef DUNE_CUSTOM_UNARY_FUNC
    │ │ │ │ +
    279#undef DUNE_BINARY_FUNC
    │ │ │ │ +
    280
    │ │ │ │ +
    281 // like DUNE_BINARY_FUNC but provide overloads with arithmetic
    │ │ │ │ +
    282 // types in the first or second argument.
    │ │ │ │ +
    283#define DUNE_BINARY_ARITHMETIC_FUNC(name,func) \
    │ │ │ │ +
    284 inline Float128 name(const Float128& t, \
    │ │ │ │ +
    285 const Float128& u) noexcept \
    │ │ │ │ +
    286 { \
    │ │ │ │ +
    287 return Float128{func (float128_t(t), float128_t(u))}; \
    │ │ │ │ +
    288 } \
    │ │ │ │ +
    289 template <class T, \
    │ │ │ │ +
    290 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \
    │ │ │ │ +
    291 inline Float128 name(const T& t, \
    │ │ │ │ +
    292 const Float128& u) noexcept \
    │ │ │ │ +
    293 { \
    │ │ │ │ +
    294 return Float128{func (float128_t(t), float128_t(u))}; \
    │ │ │ │ +
    295 } \
    │ │ │ │ +
    296 template <class U, \
    │ │ │ │ +
    297 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \
    │ │ │ │ +
    298 inline Float128 name(const Float128& t, \
    │ │ │ │ +
    299 const U& u) noexcept \
    │ │ │ │ +
    300 { \
    │ │ │ │ +
    301 return Float128{func (float128_t(t), float128_t(u))}; \
    │ │ │ │ +
    302 } \
    │ │ │ │ +
    303 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    304
    │ │ │ │ +
    305 DUNE_BINARY_ARITHMETIC_FUNC(atan2,atan2q);
    │ │ │ │ +
    306 DUNE_BINARY_ARITHMETIC_FUNC(copysign,copysignq);
    │ │ │ │ +
    307 DUNE_BINARY_ARITHMETIC_FUNC(fdim,fdimq);
    │ │ │ │ +
    308 DUNE_BINARY_ARITHMETIC_FUNC(fmax,fmaxq);
    │ │ │ │ +
    309 DUNE_BINARY_ARITHMETIC_FUNC(fmin,fminq);
    │ │ │ │ +
    310 DUNE_BINARY_ARITHMETIC_FUNC(fmod,fmodq);
    │ │ │ │ +
    311 DUNE_BINARY_ARITHMETIC_FUNC(hypot,hypotq);
    │ │ │ │ +
    312 DUNE_BINARY_ARITHMETIC_FUNC(remainder,remainderq);
    │ │ │ │ +
    313
    │ │ │ │ +
    314#undef DUNE_BINARY_ARITHMETIC_FUNC
    │ │ │ │ +
    315
    │ │ │ │ +
    316 // some more cmath functions with special signature
    │ │ │ │ +
    317
    │ │ │ │ +
    318 inline Float128 fma(const Float128& t, const Float128& u, const Float128& v)
    │ │ │ │ +
    319 {
    │ │ │ │ +
    320 return Float128{fmaq(float128_t(t),float128_t(u),float128_t(v))};
    │ │ │ │ +
    321 }
    │ │ │ │ +
    322
    │ │ │ │ +
    323 inline Float128 frexp(const Float128& u, int* p)
    │ │ │ │ +
    324 {
    │ │ │ │ +
    325 return Float128{frexpq(float128_t(u), p)};
    │ │ │ │ +
    326 }
    │ │ │ │ +
    327
    │ │ │ │ +
    328 inline Float128 ldexp(const Float128& u, int p)
    │ │ │ │ +
    329 {
    │ │ │ │ +
    330 return Float128{ldexpq(float128_t(u), p)};
    │ │ │ │ +
    331 }
    │ │ │ │ +
    332
    │ │ │ │ +
    333 inline Float128 remquo(const Float128& t, const Float128& u, int* quo)
    │ │ │ │ +
    334 {
    │ │ │ │ +
    335 return Float128{remquoq(float128_t(t), float128_t(u), quo)};
    │ │ │ │ +
    336 }
    │ │ │ │ +
    337
    │ │ │ │ +
    338 inline Float128 scalbln(const Float128& u, long int e)
    │ │ │ │ +
    339 {
    │ │ │ │ +
    340 return Float128{scalblnq(float128_t(u), e)};
    │ │ │ │ +
    341 }
    │ │ │ │ +
    342
    │ │ │ │ +
    343 inline Float128 scalbn(const Float128& u, int e)
    │ │ │ │ +
    344 {
    │ │ │ │ +
    345 return Float128{scalbnq(float128_t(u), e)};
    │ │ │ │ +
    346 }
    │ │ │ │ +
    347
    │ │ │ │ +
    349 // NOTE: This is much faster than a pow(x, Float128(p)) call
    │ │ │ │ +
    350 // NOTE: This is a modified version of boost::math::cstdfloat::detail::pown
    │ │ │ │ +
    351 // (adapted to the type Float128) that is part of the Boost 1.65 Math toolkit 2.8.0
    │ │ │ │ +
    352 // and is implemented by Christopher Kormanyos, John Maddock, and Paul A. Bristow,
    │ │ │ │ +
    353 // distributed under the Boost Software License, Version 1.0
    │ │ │ │ +
    354 // (See http://www.boost.org/LICENSE_1_0.txt)
    │ │ │ │ +
    355 template <class Int,
    │ │ │ │ +
    356 std::enable_if_t<std::is_integral<Int>::value, int> = 0>
    │ │ │ │ +
    357 inline Float128 pow(const Float128& x, const Int p)
    │ │ │ │ +
    358 {
    │ │ │ │ +
    359 static const Float128 max_value = FLT128_MAX;
    │ │ │ │ +
    360 static const Float128 min_value = FLT128_MIN;
    │ │ │ │ +
    361 static const Float128 inf_value = float128_t{1} / float128_t{0};
    │ │ │ │ +
    362
    │ │ │ │ +
    363 const bool isneg = (x < 0);
    │ │ │ │ +
    364 const bool isnan = (x != x);
    │ │ │ │ +
    365 const bool isinf = (isneg ? bool(-x > max_value) : bool(+x > max_value));
    │ │ │ │ +
    366
    │ │ │ │ +
    367 if (isnan) { return x; }
    │ │ │ │ +
    368 if (isinf) { return Float128{nanq("")}; }
    │ │ │ │ +
    369
    │ │ │ │ +
    370 const Float128 abs_x = (isneg ? -x : x);
    │ │ │ │ +
    371 if (p < Int(0)) {
    │ │ │ │ +
    372 if (abs_x < min_value)
    │ │ │ │ +
    373 return (isneg ? -inf_value : +inf_value);
    │ │ │ │ +
    374 else
    │ │ │ │ +
    375 return Float128(1) / pow(x, Int(-p));
    │ │ │ │ +
    376 }
    │ │ │ │ +
    377
    │ │ │ │ +
    378 if (p == Int(0)) { return Float128(1); }
    │ │ │ │ +
    379 if (p == Int(1)) { return x; }
    │ │ │ │ +
    380 if (abs_x > max_value)
    │ │ │ │ +
    381 return (isneg ? -inf_value : +inf_value);
    │ │ │ │ +
    382
    │ │ │ │ +
    383 if (p == Int(2)) { return (x * x); }
    │ │ │ │ +
    384 if (p == Int(3)) { return ((x * x) * x); }
    │ │ │ │ +
    385 if (p == Int(4)) { const Float128 x2 = (x * x); return (x2 * x2); }
    │ │ │ │ +
    386
    │ │ │ │ +
    387 Float128 result = ((p % Int(2)) != Int(0)) ? x : Float128(1);
    │ │ │ │ +
    388 Float128 xn = x; // binary powers of x
    │ │ │ │ +
    389
    │ │ │ │ +
    390 Int p2 = p;
    │ │ │ │ +
    391 while (Int(p2 /= 2) != Int(0)) {
    │ │ │ │ +
    392 xn *= xn; // Square xn for each binary power
    │ │ │ │ +
    393
    │ │ │ │ +
    394 const bool has_binary_power = (Int(p2 % Int(2)) != Int(0));
    │ │ │ │ +
    395 if (has_binary_power)
    │ │ │ │ +
    396 result *= xn;
    │ │ │ │ +
    397 }
    │ │ │ │ +
    398
    │ │ │ │ +
    399 return result;
    │ │ │ │ +
    400 }
    │ │ │ │ +
    401
    │ │ │ │ +
    402
    │ │ │ │ +
    403 } // end namespace Impl
    │ │ │ │ +
    404
    │ │ │ │ +
    405 template <>
    │ │ │ │ +
    406 struct IsNumber<Impl::Float128>
    │ │ │ │ +
    407 : public std::true_type {};
    │ │ │ │ +
    408
    │ │ │ │ +
    409} // end namespace Dune
    │ │ │ │ +
    410
    │ │ │ │ +
    411namespace std
    │ │ │ │ +
    412{
    │ │ │ │ +
    413#ifndef NO_STD_NUMERIC_LIMITS_SPECIALIZATION
    │ │ │ │ +
    414 template <>
    │ │ │ │ +
    415 class numeric_limits<Dune::Impl::Float128>
    │ │ │ │ +
    416 {
    │ │ │ │ +
    417 using Float128 = Dune::Impl::Float128;
    │ │ │ │ +
    418 using float128_t = Dune::Impl::float128_t;
    │ │ │ │ +
    419
    │ │ │ │ +
    420 public:
    │ │ │ │ +
    421 static constexpr bool is_specialized = true;
    │ │ │ │ +
    422 static constexpr Float128 min() noexcept { return FLT128_MIN; }
    │ │ │ │ +
    423 static constexpr Float128 max() noexcept { return FLT128_MAX; }
    │ │ │ │ +
    424 static constexpr Float128 lowest() noexcept { return -FLT128_MAX; }
    │ │ │ │ +
    425 static constexpr int digits = FLT128_MANT_DIG;
    │ │ │ │ +
    426 static constexpr int digits10 = 34;
    │ │ │ │ +
    427 static constexpr int max_digits10 = 36;
    │ │ │ │ +
    428 static constexpr bool is_signed = true;
    │ │ │ │ +
    429 static constexpr bool is_integer = false;
    │ │ │ │ +
    430 static constexpr bool is_exact = false;
    │ │ │ │ +
    431 static constexpr int radix = 2;
    │ │ │ │ +
    432 static constexpr Float128 epsilon() noexcept { return FLT128_EPSILON; }
    │ │ │ │ +
    433 static constexpr Float128 round_error() noexcept { return float128_t{0.5}; }
    │ │ │ │ +
    434 static constexpr int min_exponent = FLT128_MIN_EXP;
    │ │ │ │ +
    435 static constexpr int min_exponent10 = FLT128_MIN_10_EXP;
    │ │ │ │ +
    436 static constexpr int max_exponent = FLT128_MAX_EXP;
    │ │ │ │ +
    437 static constexpr int max_exponent10 = FLT128_MAX_10_EXP;
    │ │ │ │ +
    438 static constexpr bool has_infinity = true;
    │ │ │ │ +
    439 static constexpr bool has_quiet_NaN = true;
    │ │ │ │ +
    440 static constexpr bool has_signaling_NaN = false;
    │ │ │ │ +
    441 static constexpr float_denorm_style has_denorm = denorm_present;
    │ │ │ │ +
    442 static constexpr bool has_denorm_loss = false;
    │ │ │ │ +
    443 static constexpr Float128 infinity() noexcept { return float128_t{1}/float128_t{0}; }
    │ │ │ │ +
    444 static Float128 quiet_NaN() noexcept { return nanq(""); }
    │ │ │ │ +
    445 static constexpr Float128 signaling_NaN() noexcept { return float128_t{}; }
    │ │ │ │ +
    446 static constexpr Float128 denorm_min() noexcept { return FLT128_DENORM_MIN; }
    │ │ │ │ +
    447 static constexpr bool is_iec559 = true;
    │ │ │ │ +
    448 static constexpr bool is_bounded = false;
    │ │ │ │ +
    449 static constexpr bool is_modulo = false;
    │ │ │ │ +
    450 static constexpr bool traps = false;
    │ │ │ │ +
    451 static constexpr bool tinyness_before = false;
    │ │ │ │ +
    452 static constexpr float_round_style round_style = round_to_nearest;
    │ │ │ │ +
    453 };
    │ │ │ │ +
    454#endif
    │ │ │ │ +
    455} // end namespace std
    │ │ │ │ +
    456
    │ │ │ │ +
    457#endif // HAVE_QUADMATH
    │ │ │ │ +
    458#endif // DUNE_QUADMATH_HH
    │ │ │ │ +
    #define DUNE_BINARY_OP(OP)
    Definition debugalign.hh:248
    │ │ │ │ +
    #define DUNE_UNARY_FUNC(name)
    │ │ │ │ +
    #define DUNE_ASSIGN_OP(OP)
    Definition debugalign.hh:207
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    A few common exception classes.
    │ │ │ │ +
    Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
    Read a std::tuple.
    Definition streamoperators.hh:43
    │ │ │ │ +
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │ +
    bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:542
    │ │ │ │ +
    bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:535
    │ │ │ │ +
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ +
    T max_value(const AlignedNumber< T, align > &val)
    Definition debugalign.hh:481
    │ │ │ │ +
    T min_value(const AlignedNumber< T, align > &val)
    Definition debugalign.hh:487
    │ │ │ │ +
    auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition debugalign.hh:447
    │ │ │ │ +
    auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition debugalign.hh:425
    │ │ │ │ +
    Default exception class for range errors.
    Definition exceptions.hh:254
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,110 +1,527 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -proxymemberaccess.hh │ │ │ │ │ +quadmath.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_PROXYMEMBERACCESS_HH │ │ │ │ │ -6#define DUNE_COMMON_PROXYMEMBERACCESS_HH │ │ │ │ │ +5#ifndef DUNE_QUADMATH_HH │ │ │ │ │ +6#define DUNE_QUADMATH_HH │ │ │ │ │ 7 │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16 │ │ │ │ │ -17namespace _D_u_n_e { │ │ │ │ │ -18 │ │ │ │ │ -19 namespace Impl { │ │ │ │ │ -20 │ │ │ │ │ -21 // helper struct to store a temporary / proxy │ │ │ │ │ -22 // for the duration of the member access │ │ │ │ │ -23 template │ │ │ │ │ -24 struct member_access_proxy_holder │ │ │ │ │ -25 { │ │ │ │ │ -26 │ │ │ │ │ -27 // only support moving the temporary into the holder object │ │ │ │ │ -28 member_access_proxy_holder(T&& t) │ │ │ │ │ -29 : _t(_s_t_d::move(t)) │ │ │ │ │ -30 {} │ │ │ │ │ +8#if HAVE_QUADMATH │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include // abs │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19 │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +22 │ │ │ │ │ +23namespace _D_u_n_e │ │ │ │ │ +24{ │ │ │ │ │ +25 namespace Impl │ │ │ │ │ +26 { │ │ │ │ │ +27 // forward declaration │ │ │ │ │ +28 class Float128; │ │ │ │ │ +29 │ │ │ │ │ +30 } // end namespace Impl │ │ │ │ │ 31 │ │ │ │ │ -32 // The object is fundamentally a temporary, i.e. an rvalue, │ │ │ │ │ -33 // │ │ │ │ │ -34 const T* operator->() const │ │ │ │ │ -35 { │ │ │ │ │ -36 return &_t; │ │ │ │ │ -37 } │ │ │ │ │ -38 │ │ │ │ │ -39 T _t; │ │ │ │ │ -40 │ │ │ │ │ -41 }; │ │ │ │ │ -42 │ │ │ │ │ -43 } // end Impl namespace │ │ │ │ │ +32 using Impl::Float128; │ │ │ │ │ +33 │ │ │ │ │ +34 // The purpose of this namespace is to move the `` function overloads │ │ │ │ │ +35 // out of namespace `Dune`, see AlignedNumber in debugalign.hh. │ │ │ │ │ +36 namespace Impl │ │ │ │ │ +37 { │ │ │ │ │ +38 using float128_t = __float128; │ │ │ │ │ +39 │ │ │ │ │ +41 class Float128 │ │ │ │ │ +42 { │ │ │ │ │ +43 float128_t value_ = 0.0q; │ │ │ │ │ 44 │ │ │ │ │ -45 │ │ │ │ │ -46#ifdef DOXYGEN │ │ │ │ │ -47 │ │ │ │ │ -49 │ │ │ │ │ -79 template │ │ │ │ │ -80 pointer_or_proxy_holder │ │ │ │ │ -_8_1 _h_a_n_d_l_e___p_r_o_x_y___m_e_m_b_e_r___a_c_c_e_s_s(T&& t); │ │ │ │ │ -82 │ │ │ │ │ -83#else // DOXYGEN │ │ │ │ │ -84 │ │ │ │ │ -85 │ │ │ │ │ -86 // This version matches lvalues (the C++ type deduction rules state that │ │ │ │ │ -87 // the T&& signature deduces to a reference iff the argument is an lvalue). │ │ │ │ │ -88 // As the argument is an lvalue, we do not have to worry about its lifetime │ │ │ │ │ -89 // and can just return its address. │ │ │ │ │ -90 template │ │ │ │ │ -91 inline typename std::enable_if< │ │ │ │ │ -92 std::is_lvalue_reference::value, │ │ │ │ │ -93 typename std::add_pointer< │ │ │ │ │ -94 typename std::remove_reference< │ │ │ │ │ -95 T │ │ │ │ │ -96 >::type │ │ │ │ │ -97 >::type │ │ │ │ │ -98 >::type │ │ │ │ │ -99 _h_a_n_d_l_e___p_r_o_x_y___m_e_m_b_e_r___a_c_c_e_s_s(T&& target) │ │ │ │ │ -100 { │ │ │ │ │ -101 return ⌖ │ │ │ │ │ -102 } │ │ │ │ │ -103 │ │ │ │ │ -104 // This version matches rvalues (the C++ type deduction rules state that │ │ │ │ │ -105 // the T&& signature deduces to a non-reference iff the argument is an │ │ │ │ │ -rvalue). │ │ │ │ │ -106 // In this case, we have to capture the rvalue in a new object to make sure │ │ │ │ │ -it │ │ │ │ │ -107 // is kept alive for the duration of the member access. For this purpose, │ │ │ │ │ -we move │ │ │ │ │ -108 // it into a member_access_proxy_holder instance. │ │ │ │ │ -109 template │ │ │ │ │ -110 inline typename std::enable_if< │ │ │ │ │ -111 !std::is_lvalue_reference::value, │ │ │ │ │ -112 Impl::member_access_proxy_holder │ │ │ │ │ -113 >::type │ │ │ │ │ -114 _h_a_n_d_l_e___p_r_o_x_y___m_e_m_b_e_r___a_c_c_e_s_s(T&& target) │ │ │ │ │ -115 { │ │ │ │ │ -116 return {std::forward(target)}; │ │ │ │ │ -117 } │ │ │ │ │ -118 │ │ │ │ │ -119#endif // DOXYGEN │ │ │ │ │ +45 public: │ │ │ │ │ +46 constexpr Float128() = default; │ │ │ │ │ +47 constexpr Float128(const float128_t& value) noexcept │ │ │ │ │ +48 : value_(value) │ │ │ │ │ +49 {} │ │ │ │ │ +50 │ │ │ │ │ +51 // constructor from any floating-point or integer type │ │ │ │ │ +52 template ::value, int> = 0> │ │ │ │ │ +54 constexpr Float128(const T& value) noexcept │ │ │ │ │ +55 : value_(value) │ │ │ │ │ +56 {} │ │ │ │ │ +57 │ │ │ │ │ +58 // constructor from pointer to null-terminated byte string │ │ │ │ │ +59 explicit Float128(const char* str) noexcept │ │ │ │ │ +60 : value_(strtoflt128(str, NULL)) │ │ │ │ │ +61 {} │ │ │ │ │ +62 │ │ │ │ │ +63 // accessors │ │ │ │ │ +64 constexpr operator float128_t() const noexcept { return value_; } │ │ │ │ │ +65 │ │ │ │ │ +66 constexpr float128_t const& value() const noexcept { return value_; } │ │ │ │ │ +67 constexpr float128_t& value() noexcept { return value_; } │ │ │ │ │ +68 │ │ │ │ │ +69 // I/O │ │ │ │ │ +70 template │ │ │ │ │ +71 friend std::basic_istream& │ │ │ │ │ +72 _o_p_e_r_a_t_o_r_>_>(std::basic_istream& in, Float128& x) │ │ │ │ │ +73 { │ │ │ │ │ +74 std::string buf; │ │ │ │ │ +75 buf.reserve(128); │ │ │ │ │ +76 in >> buf; │ │ │ │ │ +77 x.value() = strtoflt128(buf.c_str(), NULL); │ │ │ │ │ +78 return in; │ │ │ │ │ +79 } │ │ │ │ │ +80 │ │ │ │ │ +81 template │ │ │ │ │ +82 friend std::basic_ostream& │ │ │ │ │ +83 _o_p_e_r_a_t_o_r_<_<(std::basic_ostream& out, const Float128& x) │ │ │ │ │ +84 { │ │ │ │ │ +85 const std::size_t bufSize = 128; │ │ │ │ │ +86 CharT buf[128]; │ │ │ │ │ +87 │ │ │ │ │ +88 std::string format = "%." + std::to_string(out.precision()) + "Q" + │ │ │ │ │ +89 ((out.flags() | std::ios_base::scientific) ? "e" : "f"); │ │ │ │ │ +90 const int numChars = quadmath_snprintf(buf, bufSize, format.c_str(), x.value │ │ │ │ │ +()); │ │ │ │ │ +91 if (std::size_t(numChars) >= bufSize) { │ │ │ │ │ +92 _D_U_N_E___T_H_R_O_W(_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r, "Failed to print Float128 value: buffer │ │ │ │ │ +overflow"); │ │ │ │ │ +93 } │ │ │ │ │ +94 out << buf; │ │ │ │ │ +95 return out; │ │ │ │ │ +96 } │ │ │ │ │ +97 │ │ │ │ │ +98 // Increment, decrement │ │ │ │ │ +99 constexpr Float128& operator++() noexcept { ++value_; return *this; } │ │ │ │ │ +100 constexpr Float128& operator--() noexcept { --value_; return *this; } │ │ │ │ │ +101 │ │ │ │ │ +102 constexpr Float128 operator++(int) noexcept { Float128 tmp{*this}; │ │ │ │ │ +++value_; return tmp; } │ │ │ │ │ +103 constexpr Float128 operator--(int) noexcept { Float128 tmp{*this}; -- │ │ │ │ │ +value_; return tmp; } │ │ │ │ │ +104 │ │ │ │ │ +105 // unary operators │ │ │ │ │ +106 constexpr Float128 _o_p_e_r_a_t_o_r_+() const noexcept { return Float128{+value_}; } │ │ │ │ │ +107 constexpr Float128 _o_p_e_r_a_t_o_r_-() const noexcept { return Float128{-value_}; } │ │ │ │ │ +108 │ │ │ │ │ +109 // assignment operators │ │ │ │ │ +110#define DUNE_ASSIGN_OP(OP) \ │ │ │ │ │ +111 constexpr Float128& operator OP(const Float128& u) noexcept \ │ │ │ │ │ +112 { \ │ │ │ │ │ +113 value_ OP float128_t(u); \ │ │ │ │ │ +114 return *this; \ │ │ │ │ │ +115 } \ │ │ │ │ │ +116 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +117 │ │ │ │ │ +118 _D_U_N_E___A_S_S_I_G_N___O_P(+=); │ │ │ │ │ +119 _D_U_N_E___A_S_S_I_G_N___O_P(-=); │ │ │ │ │ 120 │ │ │ │ │ -121} // namespace Dune │ │ │ │ │ -122 │ │ │ │ │ -123#endif // DUNE_COMMON_PROXYMEMBERACCESS_HH │ │ │ │ │ -_D_u_n_e_:_:_h_a_n_d_l_e___p_r_o_x_y___m_e_m_b_e_r___a_c_c_e_s_s │ │ │ │ │ -pointer_or_proxy_holder handle_proxy_member_access(T &&t) │ │ │ │ │ -Transparent support for providing member access to both lvalues and rvalues │ │ │ │ │ -(temporary proxies). │ │ │ │ │ +121 _D_U_N_E___A_S_S_I_G_N___O_P(*=); │ │ │ │ │ +122 _D_U_N_E___A_S_S_I_G_N___O_P(/=); │ │ │ │ │ +123 │ │ │ │ │ +124#undef DUNE_ASSIGN_OP │ │ │ │ │ +125 │ │ │ │ │ +126 }; // end class Float128 │ │ │ │ │ +127 │ │ │ │ │ +128 // binary operators: │ │ │ │ │ +129 // For symmetry provide overloads with arithmetic types │ │ │ │ │ +130 // in the first or second argument. │ │ │ │ │ +131#define DUNE_BINARY_OP(OP) \ │ │ │ │ │ +132 constexpr Float128 operator OP(const Float128& t, \ │ │ │ │ │ +133 const Float128& u) noexcept \ │ │ │ │ │ +134 { \ │ │ │ │ │ +135 return Float128{float128_t(t) OP float128_t(u)}; \ │ │ │ │ │ +136 } \ │ │ │ │ │ +137 constexpr Float128 operator OP(const float128_t& t, \ │ │ │ │ │ +138 const Float128& u) noexcept \ │ │ │ │ │ +139 { \ │ │ │ │ │ +140 return Float128{t OP float128_t(u)}; \ │ │ │ │ │ +141 } \ │ │ │ │ │ +142 constexpr Float128 operator OP(const Float128& t, \ │ │ │ │ │ +143 const float128_t& u) noexcept \ │ │ │ │ │ +144 { \ │ │ │ │ │ +145 return Float128{float128_t(t) OP u}; \ │ │ │ │ │ +146 } \ │ │ │ │ │ +147 template ::value, int> = 0> \ │ │ │ │ │ +149 constexpr Float128 operator OP(const T& t, \ │ │ │ │ │ +150 const Float128& u) noexcept \ │ │ │ │ │ +151 { \ │ │ │ │ │ +152 return Float128{float128_t(t) OP float128_t(u)}; \ │ │ │ │ │ +153 } \ │ │ │ │ │ +154 template ::value, int> = 0> \ │ │ │ │ │ +156 constexpr Float128 operator OP(const Float128& t, \ │ │ │ │ │ +157 const U& u) noexcept \ │ │ │ │ │ +158 { \ │ │ │ │ │ +159 return Float128{float128_t(t) OP float128_t(u)}; \ │ │ │ │ │ +160 } \ │ │ │ │ │ +161 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +162 │ │ │ │ │ +163 _D_U_N_E___B_I_N_A_R_Y___O_P(+); │ │ │ │ │ +164 _D_U_N_E___B_I_N_A_R_Y___O_P(-); │ │ │ │ │ +165 _D_U_N_E___B_I_N_A_R_Y___O_P(*); │ │ │ │ │ +166 _D_U_N_E___B_I_N_A_R_Y___O_P(/); │ │ │ │ │ +167 │ │ │ │ │ +168#undef DUNE_BINARY_OP │ │ │ │ │ +169 │ │ │ │ │ +170 // logical operators: │ │ │ │ │ +171 // For symmetry provide overloads with arithmetic types │ │ │ │ │ +172 // in the first or second argument. │ │ │ │ │ +173#define DUNE_BINARY_BOOL_OP(OP) \ │ │ │ │ │ +174 constexpr bool operator OP(const Float128& t, \ │ │ │ │ │ +175 const Float128& u) noexcept \ │ │ │ │ │ +176 { \ │ │ │ │ │ +177 return float128_t(t) OP float128_t(u); \ │ │ │ │ │ +178 } \ │ │ │ │ │ +179 template ::value, int> = 0> \ │ │ │ │ │ +181 constexpr bool operator OP(const T& t, \ │ │ │ │ │ +182 const Float128& u) noexcept \ │ │ │ │ │ +183 { \ │ │ │ │ │ +184 return float128_t(t) OP float128_t(u); \ │ │ │ │ │ +185 } \ │ │ │ │ │ +186 template ::value, int> = 0> \ │ │ │ │ │ +188 constexpr bool operator OP(const Float128& t, \ │ │ │ │ │ +189 const U& u) noexcept \ │ │ │ │ │ +190 { \ │ │ │ │ │ +191 return float128_t(t) OP float128_t(u); \ │ │ │ │ │ +192 } \ │ │ │ │ │ +193 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +194 │ │ │ │ │ +195 DUNE_BINARY_BOOL_OP(==); │ │ │ │ │ +196 DUNE_BINARY_BOOL_OP(!=); │ │ │ │ │ +197 DUNE_BINARY_BOOL_OP(<); │ │ │ │ │ +198 DUNE_BINARY_BOOL_OP(>); │ │ │ │ │ +199 DUNE_BINARY_BOOL_OP(<=); │ │ │ │ │ +200 DUNE_BINARY_BOOL_OP(>=); │ │ │ │ │ +201 │ │ │ │ │ +202#undef DUNE_BINARY_BOOL_OP │ │ │ │ │ +203 │ │ │ │ │ +204 // Overloads for the cmath functions │ │ │ │ │ +205 │ │ │ │ │ +206 // function with name `name` redirects to quadmath function `func` │ │ │ │ │ +207#define DUNE_UNARY_FUNC(name,func) \ │ │ │ │ │ +208 inline Float128 name(const Float128& u) noexcept \ │ │ │ │ │ +209 { \ │ │ │ │ │ +210 return Float128{func (float128_t(u))}; \ │ │ │ │ │ +211 } \ │ │ │ │ │ +212 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +213 │ │ │ │ │ +214 // like DUNE_UNARY_FUNC but with custom return type │ │ │ │ │ +215#define DUNE_CUSTOM_UNARY_FUNC(type,name,func) \ │ │ │ │ │ +216 inline type name(const Float128& u) noexcept \ │ │ │ │ │ +217 { \ │ │ │ │ │ +218 return (type)(func (float128_t(u))); \ │ │ │ │ │ +219 } \ │ │ │ │ │ +220 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +221 │ │ │ │ │ +222 // redirects to quadmath function with two arguments │ │ │ │ │ +223#define DUNE_BINARY_FUNC(name,func) \ │ │ │ │ │ +224 inline Float128 name(const Float128& t, \ │ │ │ │ │ +225 const Float128& u) noexcept \ │ │ │ │ │ +226 { \ │ │ │ │ │ +227 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ +228 } \ │ │ │ │ │ +229 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +230 │ │ │ │ │ +231 _D_U_N_E___U_N_A_R_Y___F_U_N_C(abs, fabsq); │ │ │ │ │ +232 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acos, acosq); │ │ │ │ │ +233 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acosh, acoshq); │ │ │ │ │ +234 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asin, asinq); │ │ │ │ │ +235 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asinh, asinhq); │ │ │ │ │ +236 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atan, atanq); │ │ │ │ │ +237 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atanh, atanhq); │ │ │ │ │ +238 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cbrt, cbrtq); │ │ │ │ │ +239 _D_U_N_E___U_N_A_R_Y___F_U_N_C(ceil, ceilq); │ │ │ │ │ +240 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cos, cosq); │ │ │ │ │ +241 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cosh, coshq); │ │ │ │ │ +242 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erf, erfq); │ │ │ │ │ +243 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erfc, erfcq); │ │ │ │ │ +244 _D_U_N_E___U_N_A_R_Y___F_U_N_C(exp, expq); │ │ │ │ │ +245 _D_U_N_E___U_N_A_R_Y___F_U_N_C(expm1, expm1q); │ │ │ │ │ +246 _D_U_N_E___U_N_A_R_Y___F_U_N_C(fabs, fabsq); │ │ │ │ │ +247 _D_U_N_E___U_N_A_R_Y___F_U_N_C(floor, floorq); │ │ │ │ │ +248 DUNE_CUSTOM_UNARY_FUNC(int, ilogb, ilogbq); │ │ │ │ │ +249 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lgamma, lgammaq); │ │ │ │ │ +250 DUNE_CUSTOM_UNARY_FUNC(long long int, llrint, llrintq); │ │ │ │ │ +251 DUNE_CUSTOM_UNARY_FUNC(long long int, llround, llroundq); │ │ │ │ │ +252 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log, logq); │ │ │ │ │ +253 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log10, log10q); │ │ │ │ │ +254 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log1p, log1pq); │ │ │ │ │ +255 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log2, log2q); │ │ │ │ │ +256 // DUNE_UNARY_FUNC(logb, logbq); // not available in gcc5 │ │ │ │ │ +257 DUNE_CUSTOM_UNARY_FUNC(long int, lrint, lrintq); │ │ │ │ │ +258 DUNE_CUSTOM_UNARY_FUNC(long int, lround, lroundq); │ │ │ │ │ +259 _D_U_N_E___U_N_A_R_Y___F_U_N_C(nearbyint, nearbyintq); │ │ │ │ │ +260 DUNE_BINARY_FUNC(nextafter, nextafterq); │ │ │ │ │ +261 DUNE_BINARY_FUNC(pow, powq); // overload for integer argument see below │ │ │ │ │ +262 _D_U_N_E___U_N_A_R_Y___F_U_N_C(rint, rintq); │ │ │ │ │ +263 _D_U_N_E___U_N_A_R_Y___F_U_N_C(round, roundq); │ │ │ │ │ +264 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sin, sinq); │ │ │ │ │ +265 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sinh, sinhq); │ │ │ │ │ +266 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sqrt, sqrtq); │ │ │ │ │ +267 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tan, tanq); │ │ │ │ │ +268 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tanh, tanhq); │ │ │ │ │ +269 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tgamma, tgammaq); │ │ │ │ │ +270 _D_U_N_E___U_N_A_R_Y___F_U_N_C(trunc, truncq); │ │ │ │ │ +271 │ │ │ │ │ +272 DUNE_CUSTOM_UNARY_FUNC(bool, isfinite, finiteq); │ │ │ │ │ +273 DUNE_CUSTOM_UNARY_FUNC(bool, isinf, isinfq); │ │ │ │ │ +274 DUNE_CUSTOM_UNARY_FUNC(bool, isnan, isnanq); │ │ │ │ │ +275 DUNE_CUSTOM_UNARY_FUNC(bool, signbit, signbitq); │ │ │ │ │ +276 │ │ │ │ │ +277#undef DUNE_UNARY_FUNC │ │ │ │ │ +278#undef DUNE_CUSTOM_UNARY_FUNC │ │ │ │ │ +279#undef DUNE_BINARY_FUNC │ │ │ │ │ +280 │ │ │ │ │ +281 // like DUNE_BINARY_FUNC but provide overloads with arithmetic │ │ │ │ │ +282 // types in the first or second argument. │ │ │ │ │ +283#define DUNE_BINARY_ARITHMETIC_FUNC(name,func) \ │ │ │ │ │ +284 inline Float128 name(const Float128& t, \ │ │ │ │ │ +285 const Float128& u) noexcept \ │ │ │ │ │ +286 { \ │ │ │ │ │ +287 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ +288 } \ │ │ │ │ │ +289 template ::value, int> = 0> \ │ │ │ │ │ +291 inline Float128 name(const T& t, \ │ │ │ │ │ +292 const Float128& u) noexcept \ │ │ │ │ │ +293 { \ │ │ │ │ │ +294 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ +295 } \ │ │ │ │ │ +296 template ::value, int> = 0> \ │ │ │ │ │ +298 inline Float128 name(const Float128& t, \ │ │ │ │ │ +299 const U& u) noexcept \ │ │ │ │ │ +300 { \ │ │ │ │ │ +301 return Float128{func (float128_t(t), float128_t(u))}; \ │ │ │ │ │ +302 } \ │ │ │ │ │ +303 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +304 │ │ │ │ │ +305 DUNE_BINARY_ARITHMETIC_FUNC(atan2,atan2q); │ │ │ │ │ +306 DUNE_BINARY_ARITHMETIC_FUNC(copysign,copysignq); │ │ │ │ │ +307 DUNE_BINARY_ARITHMETIC_FUNC(fdim,fdimq); │ │ │ │ │ +308 DUNE_BINARY_ARITHMETIC_FUNC(fmax,fmaxq); │ │ │ │ │ +309 DUNE_BINARY_ARITHMETIC_FUNC(fmin,fminq); │ │ │ │ │ +310 DUNE_BINARY_ARITHMETIC_FUNC(fmod,fmodq); │ │ │ │ │ +311 DUNE_BINARY_ARITHMETIC_FUNC(hypot,hypotq); │ │ │ │ │ +312 DUNE_BINARY_ARITHMETIC_FUNC(remainder,remainderq); │ │ │ │ │ +313 │ │ │ │ │ +314#undef DUNE_BINARY_ARITHMETIC_FUNC │ │ │ │ │ +315 │ │ │ │ │ +316 // some more cmath functions with special signature │ │ │ │ │ +317 │ │ │ │ │ +318 inline Float128 fma(const Float128& t, const Float128& u, const Float128& │ │ │ │ │ +v) │ │ │ │ │ +319 { │ │ │ │ │ +320 return Float128{fmaq(float128_t(t),float128_t(u),float128_t(v))}; │ │ │ │ │ +321 } │ │ │ │ │ +322 │ │ │ │ │ +323 inline Float128 frexp(const Float128& u, int* p) │ │ │ │ │ +324 { │ │ │ │ │ +325 return Float128{frexpq(float128_t(u), p)}; │ │ │ │ │ +326 } │ │ │ │ │ +327 │ │ │ │ │ +328 inline Float128 ldexp(const Float128& u, int p) │ │ │ │ │ +329 { │ │ │ │ │ +330 return Float128{ldexpq(float128_t(u), p)}; │ │ │ │ │ +331 } │ │ │ │ │ +332 │ │ │ │ │ +333 inline Float128 remquo(const Float128& t, const Float128& u, int* quo) │ │ │ │ │ +334 { │ │ │ │ │ +335 return Float128{remquoq(float128_t(t), float128_t(u), quo)}; │ │ │ │ │ +336 } │ │ │ │ │ +337 │ │ │ │ │ +338 inline Float128 scalbln(const Float128& u, long int e) │ │ │ │ │ +339 { │ │ │ │ │ +340 return Float128{scalblnq(float128_t(u), e)}; │ │ │ │ │ +341 } │ │ │ │ │ +342 │ │ │ │ │ +343 inline Float128 scalbn(const Float128& u, int e) │ │ │ │ │ +344 { │ │ │ │ │ +345 return Float128{scalbnq(float128_t(u), e)}; │ │ │ │ │ +346 } │ │ │ │ │ +347 │ │ │ │ │ +349 // NOTE: This is much faster than a pow(x, Float128(p)) call │ │ │ │ │ +350 // NOTE: This is a modified version of boost::math::cstdfloat::detail::pown │ │ │ │ │ +351 // (adapted to the type Float128) that is part of the Boost 1.65 Math │ │ │ │ │ +toolkit 2.8.0 │ │ │ │ │ +352 // and is implemented by Christopher Kormanyos, John Maddock, and Paul A. │ │ │ │ │ +Bristow, │ │ │ │ │ +353 // distributed under the Boost Software License, Version 1.0 │ │ │ │ │ +354 // (See http://www.boost.org/LICENSE_1_0.txt) │ │ │ │ │ +355 template ::value, int> = 0> │ │ │ │ │ +357 inline Float128 pow(const Float128& x, const Int p) │ │ │ │ │ +358 { │ │ │ │ │ +359 static const Float128 _m_a_x___v_a_l_u_e = FLT128_MAX; │ │ │ │ │ +360 static const Float128 _m_i_n___v_a_l_u_e = FLT128_MIN; │ │ │ │ │ +361 static const Float128 inf_value = float128_t{1} / float128_t{0}; │ │ │ │ │ +362 │ │ │ │ │ +363 const bool isneg = (x < 0); │ │ │ │ │ +364 const bool isnan = (x != x); │ │ │ │ │ +365 const bool isinf = (isneg ? bool(-x > _m_a_x___v_a_l_u_e) : bool(+x > _m_a_x___v_a_l_u_e)); │ │ │ │ │ +366 │ │ │ │ │ +367 if (isnan) { return x; } │ │ │ │ │ +368 if (isinf) { return Float128{nanq("")}; } │ │ │ │ │ +369 │ │ │ │ │ +370 const Float128 abs_x = (isneg ? -x : x); │ │ │ │ │ +371 if (p < Int(0)) { │ │ │ │ │ +372 if (abs_x < _m_i_n___v_a_l_u_e) │ │ │ │ │ +373 return (isneg ? -inf_value : +inf_value); │ │ │ │ │ +374 else │ │ │ │ │ +375 return Float128(1) / pow(x, Int(-p)); │ │ │ │ │ +376 } │ │ │ │ │ +377 │ │ │ │ │ +378 if (p == Int(0)) { return Float128(1); } │ │ │ │ │ +379 if (p == Int(1)) { return x; } │ │ │ │ │ +380 if (abs_x > _m_a_x___v_a_l_u_e) │ │ │ │ │ +381 return (isneg ? -inf_value : +inf_value); │ │ │ │ │ +382 │ │ │ │ │ +383 if (p == Int(2)) { return (x * x); } │ │ │ │ │ +384 if (p == Int(3)) { return ((x * x) * x); } │ │ │ │ │ +385 if (p == Int(4)) { const Float128 x2 = (x * x); return (x2 * x2); } │ │ │ │ │ +386 │ │ │ │ │ +387 Float128 result = ((p % Int(2)) != Int(0)) ? x : Float128(1); │ │ │ │ │ +388 Float128 xn = x; // binary powers of x │ │ │ │ │ +389 │ │ │ │ │ +390 Int p2 = p; │ │ │ │ │ +391 while (Int(p2 /= 2) != Int(0)) { │ │ │ │ │ +392 xn *= xn; // Square xn for each binary power │ │ │ │ │ +393 │ │ │ │ │ +394 const bool has_binary_power = (Int(p2 % Int(2)) != Int(0)); │ │ │ │ │ +395 if (has_binary_power) │ │ │ │ │ +396 result *= xn; │ │ │ │ │ +397 } │ │ │ │ │ +398 │ │ │ │ │ +399 return result; │ │ │ │ │ +400 } │ │ │ │ │ +401 │ │ │ │ │ +402 │ │ │ │ │ +403 } // end namespace Impl │ │ │ │ │ +404 │ │ │ │ │ +405 template <> │ │ │ │ │ +406 struct IsNumber │ │ │ │ │ +407 : public std::true_type {}; │ │ │ │ │ +408 │ │ │ │ │ +409} // end namespace Dune │ │ │ │ │ +410 │ │ │ │ │ +411namespace _s_t_d │ │ │ │ │ +412{ │ │ │ │ │ +413#ifndef NO_STD_NUMERIC_LIMITS_SPECIALIZATION │ │ │ │ │ +414 template <> │ │ │ │ │ +415 class numeric_limits<_D_u_n_e::Impl::Float128> │ │ │ │ │ +416 { │ │ │ │ │ +417 using Float128 = Dune::Impl::Float128; │ │ │ │ │ +418 using float128_t = Dune::Impl::float128_t; │ │ │ │ │ +419 │ │ │ │ │ +420 public: │ │ │ │ │ +421 static constexpr bool is_specialized = true; │ │ │ │ │ +422 static constexpr Float128 _m_i_n() noexcept { return FLT128_MIN; } │ │ │ │ │ +423 static constexpr Float128 _m_a_x() noexcept { return FLT128_MAX; } │ │ │ │ │ +424 static constexpr Float128 lowest() noexcept { return -FLT128_MAX; } │ │ │ │ │ +425 static constexpr int digits = FLT128_MANT_DIG; │ │ │ │ │ +426 static constexpr int digits10 = 34; │ │ │ │ │ +427 static constexpr int max_digits10 = 36; │ │ │ │ │ +428 static constexpr bool is_signed = true; │ │ │ │ │ +429 static constexpr bool is_integer = false; │ │ │ │ │ +430 static constexpr bool is_exact = false; │ │ │ │ │ +431 static constexpr int radix = 2; │ │ │ │ │ +432 static constexpr Float128 epsilon() noexcept { return FLT128_EPSILON; } │ │ │ │ │ +433 static constexpr Float128 round_error() noexcept { return float128_t{0.5}; │ │ │ │ │ +} │ │ │ │ │ +434 static constexpr int min_exponent = FLT128_MIN_EXP; │ │ │ │ │ +435 static constexpr int min_exponent10 = FLT128_MIN_10_EXP; │ │ │ │ │ +436 static constexpr int max_exponent = FLT128_MAX_EXP; │ │ │ │ │ +437 static constexpr int max_exponent10 = FLT128_MAX_10_EXP; │ │ │ │ │ +438 static constexpr bool has_infinity = true; │ │ │ │ │ +439 static constexpr bool has_quiet_NaN = true; │ │ │ │ │ +440 static constexpr bool has_signaling_NaN = false; │ │ │ │ │ +441 static constexpr float_denorm_style has_denorm = denorm_present; │ │ │ │ │ +442 static constexpr bool has_denorm_loss = false; │ │ │ │ │ +443 static constexpr Float128 infinity() noexcept { return float128_t{1}/ │ │ │ │ │ +float128_t{0}; } │ │ │ │ │ +444 static Float128 quiet_NaN() noexcept { return nanq(""); } │ │ │ │ │ +445 static constexpr Float128 signaling_NaN() noexcept { return float128_t{}; } │ │ │ │ │ +446 static constexpr Float128 denorm_min() noexcept { return FLT128_DENORM_MIN; │ │ │ │ │ +} │ │ │ │ │ +447 static constexpr bool is_iec559 = true; │ │ │ │ │ +448 static constexpr bool is_bounded = false; │ │ │ │ │ +449 static constexpr bool is_modulo = false; │ │ │ │ │ +450 static constexpr bool traps = false; │ │ │ │ │ +451 static constexpr bool tinyness_before = false; │ │ │ │ │ +452 static constexpr float_round_style round_style = round_to_nearest; │ │ │ │ │ +453 }; │ │ │ │ │ +454#endif │ │ │ │ │ +455} // end namespace std │ │ │ │ │ +456 │ │ │ │ │ +457#endif // HAVE_QUADMATH │ │ │ │ │ +458#endif // DUNE_QUADMATH_HH │ │ │ │ │ +_D_U_N_E___B_I_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_BINARY_OP(OP) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:248 │ │ │ │ │ +_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ +#define DUNE_UNARY_FUNC(name) │ │ │ │ │ +_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +#define DUNE_ASSIGN_OP(OP) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:207 │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ +Stream & operator>>(Stream &stream, std::tuple< Ts... > &t) │ │ │ │ │ +Read a std::tuple. │ │ │ │ │ +DDeeffiinniittiioonn streamoperators.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:542 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ +bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:535 │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_m_a_x___v_a_l_u_e │ │ │ │ │ +T max_value(const AlignedNumber< T, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:481 │ │ │ │ │ +_D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ +T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:487 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_i_n │ │ │ │ │ +auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > │ │ │ │ │ +&b) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:447 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_a_x │ │ │ │ │ +auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > │ │ │ │ │ +&b) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:425 │ │ │ │ │ +_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r │ │ │ │ │ +Default exception class for range errors. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:254 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00167.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: iteratorrange.hh File Reference │ │ │ │ +dune-common: debugalign.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,33 +70,45 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ -Namespaces
    │ │ │ │ -
    iteratorrange.hh File Reference
    │ │ │ │ +Namespaces | │ │ │ │ +Functions
    │ │ │ │ +
    debugalign.cc File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    class  Dune::IteratorRange< Iterator >
     Simple range between a begin and an end iterator. More...
     
    │ │ │ │ +
    #include <config.h>
    │ │ │ │ +#include <cstddef>
    │ │ │ │ +#include <cstdlib>
    │ │ │ │ +#include <functional>
    │ │ │ │ +#include <ios>
    │ │ │ │ +#include <iostream>
    │ │ │ │ +#include <utility>
    │ │ │ │ +#include <dune/common/debugalign.hh>
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

    │ │ │ │ Namespaces

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

    │ │ │ │ +Functions

    static void Dune::defaultViolatedAlignment (const char *className, std::size_t expectedAlignment, const void *address)
     default alignment violation handler
     
    ViolatedAlignmentHandlerDune::violatedAlignmentHandler ()
     access the handler called by violatedAlignment()
     
    void Dune::violatedAlignment (const char *className, std::size_t expectedAlignment, const void *address)
     called when an alignment violation is detected
     
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,19 +1,35 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -iteratorrange.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_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e_<_ _I_t_e_r_a_t_o_r_ _> │ │ │ │ │ -  Simple range between a begin and an end iterator. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +debugalign.cc File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_b_u_g_a_l_i_g_n_._h_h> │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ + static void  _D_u_n_e_:_:_d_e_f_a_u_l_t_V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t (const char │ │ │ │ │ + *_c_l_a_s_s_N_a_m_e, std::size_t expectedAlignment, const │ │ │ │ │ + void *address) │ │ │ │ │ +  default alignment violation handler │ │ │ │ │ +  │ │ │ │ │ +_V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r &  _D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r () │ │ │ │ │ +  access the handler called by _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_(_) │ │ │ │ │ +  │ │ │ │ │ + void  _D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t (const char *_c_l_a_s_s_N_a_m_e, │ │ │ │ │ + std::size_t expectedAlignment, const void *address) │ │ │ │ │ +  called when an alignment violation is detected │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00170.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: float_cmp.cc File Reference │ │ │ │ +dune-common: streamoperators.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,120 +70,52 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
    │ │ │ │ -
    float_cmp.cc File Reference
    │ │ │ │ +
    streamoperators.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include "float_cmp.hh"
    │ │ │ │ -#include <vector>
    │ │ │ │ -#include <limits>
    │ │ │ │ -#include <algorithm>
    │ │ │ │ -#include <cstdlib>
    │ │ │ │ -#include <dune/common/fvector.hh>
    │ │ │ │ + │ │ │ │ +

    Implementation of stream operators for std::array and std::tuple. │ │ │ │ +More...

    │ │ │ │ +
    #include <array>
    │ │ │ │ +#include <tuple>
    │ │ │ │ +#include <utility>
    │ │ │ │ +#include <dune/common/hybridutilities.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    struct  Dune::FloatCmp::EpsilonType< T >
     Mapping of value type to epsilon type. More...
     
    struct  Dune::FloatCmp::EpsilonType< std::vector< T, A > >
     Specialization of EpsilonType for std::vector. More...
     
    struct  Dune::FloatCmp::EpsilonType< FieldVector< T, n > >
     Specialization of EpsilonType for Dune::FieldVector. More...
     
    struct  Dune::FloatCmp::DefaultEpsilon< T, relativeWeak >
     
    struct  Dune::FloatCmp::DefaultEpsilon< T, relativeStrong >
     
    struct  Dune::FloatCmp::DefaultEpsilon< T, absolute >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::FloatCmp
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<class T , CmpStyle style>
    bool Dune::FloatCmp::eq (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
     test for equality using epsilon
     
    template<class T , CmpStyle style>
    bool Dune::FloatCmp::ne (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
     test for inequality using epsilon
     
    template<class T , CmpStyle style>
    bool Dune::FloatCmp::gt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
     test if first greater than second
     
    template<class T , CmpStyle style>
    bool Dune::FloatCmp::lt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
     test if first lesser than second
     
    template<class T , CmpStyle style>
    bool Dune::FloatCmp::ge (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
     test if first greater or equal second
     
    template<class T , CmpStyle style>
    bool Dune::FloatCmp::le (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())
     test if first lesser or equal second
     
    template<class T >
    bool Dune::FloatCmp::eq (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::ne (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::gt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::lt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::ge (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::le (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class I , class T , CmpStyle cstyle, RoundingStyle rstyle>
    Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     round using epsilon
     
    template<class I , class T , CmpStyle cstyle>
    Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     
    template<class I , class T >
    Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class I , class T , CmpStyle cstyle, RoundingStyle rstyle>
    Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     truncate using epsilon
     
    template<class I , class T , CmpStyle cstyle>
    Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     
    template<class I , class T >
    Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<typename Stream , typename... Ts>
    Stream & Dune::operator<< (Stream &stream, const std::tuple< Ts... > &t)
     Print a std::tuple.
     
    template<typename Stream , typename... Ts>
    Stream & Dune::operator>> (Stream &stream, std::tuple< Ts... > &t)
     Read a std::tuple.
     
    template<typename Stream , typename T , std::size_t N>
    Stream & Dune::operator<< (Stream &stream, const std::array< T, N > &a)
     Print a std::array.
     
    │ │ │ │ -
    │ │ │ │ +

    Detailed Description

    │ │ │ │ +

    Implementation of stream operators for std::array and std::tuple.

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,126 +1,35 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -float_cmp.cc File Reference │ │ │ │ │ -#include "_f_l_o_a_t___c_m_p_._h_h" │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +streamoperators.hh File Reference │ │ │ │ │ +Implementation of stream operators for std::array and std::tuple. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_y_b_r_i_d_u_t_i_l_i_t_i_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 │ │ │ │ │ -struct   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_<_ _T_ _> │ │ │ │ │ -  Mapping of value type to epsilon type. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ -  Specialization of _E_p_s_i_l_o_n_T_y_p_e for std::vector. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _n_ _>_ _> │ │ │ │ │ -  Specialization of _E_p_s_i_l_o_n_T_y_p_e for _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_ _T_,_ _r_e_l_a_t_i_v_e_W_e_a_k_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_ _T_,_ _r_e_l_a_t_i_v_e_S_t_r_o_n_g_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_ _T_,_ _a_b_s_o_l_u_t_e_ _> │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_F_l_o_a_t_C_m_p │ │ │ │ │ -  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_e_q (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test for equality using epsilon │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_n_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test for inequality using epsilon │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_t (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first greater than second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_t (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first lesser than second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first greater or equal second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, style >::value()) │ │ │ │ │ -  test if first lesser or equal second │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_e_q (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >:: │ │ │ │ │ - value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_n_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >:: │ │ │ │ │ - value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_t (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >:: │ │ │ │ │ - value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_t (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >:: │ │ │ │ │ - value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >:: │ │ │ │ │ - value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_e (const T &first, const T &second, typename │ │ │ │ │ - _E_p_s_i_l_o_n_T_y_p_e< T >::Type epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >:: │ │ │ │ │ - value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_o_u_n_d (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, cstyle >::value()) │ │ │ │ │ -  round using epsilon │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_o_u_n_d (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, cstyle >::value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_o_u_n_d (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >::value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_r_u_n_c (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, cstyle >::value()) │ │ │ │ │ -  truncate using epsilon │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_r_u_n_c (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, cstyle >::value()) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - I  _D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_r_u_n_c (const T &val, typename _E_p_s_i_l_o_n_T_y_p_e< T >::Type │ │ │ │ │ - epsilon=_D_e_f_a_u_l_t_E_p_s_i_l_o_n< T, _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e >::value()) │ │ │ │ │ +template │ │ │ │ │ +Stream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (Stream &stream, const std::tuple< Ts... > &t) │ │ │ │ │ +  Print a std::tuple. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +Stream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_> (Stream &stream, std::tuple< Ts... > &t) │ │ │ │ │ +  Read a std::tuple. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +Stream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (Stream &stream, const std::array< T, N > &a) │ │ │ │ │ +  Print a std::array. │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Implementation of stream operators for std::array and std::tuple. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00170_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: float_cmp.cc Source File │ │ │ │ +dune-common: streamoperators.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,627 +74,83 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    float_cmp.cc
    │ │ │ │ +
    streamoperators.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#include "float_cmp.hh"
    │ │ │ │ -
    6
    │ │ │ │ -
    7#include <vector>
    │ │ │ │ -
    8#include <limits>
    │ │ │ │ -
    9#include <algorithm>
    │ │ │ │ -
    10#include <cstdlib>
    │ │ │ │ - │ │ │ │ -
    12
    │ │ │ │ -
    13namespace Dune {
    │ │ │ │ -
    14
    │ │ │ │ -
    15
    │ │ │ │ -
    │ │ │ │ -
    16 namespace FloatCmp {
    │ │ │ │ -
    17 // traits
    │ │ │ │ -
    19
    │ │ │ │ -
    │ │ │ │ -
    23 template<class T> struct EpsilonType {
    │ │ │ │ -
    25 typedef T Type;
    │ │ │ │ -
    26 };
    │ │ │ │ -
    │ │ │ │ -
    28
    │ │ │ │ -
    33 template<class T, typename A>
    │ │ │ │ -
    │ │ │ │ -
    34 struct EpsilonType<std::vector<T, A> > {
    │ │ │ │ -
    36 typedef typename EpsilonType<T>::Type Type;
    │ │ │ │ -
    37 };
    │ │ │ │ -
    │ │ │ │ -
    39
    │ │ │ │ -
    44 template<class T, int n>
    │ │ │ │ -
    │ │ │ │ -
    45 struct EpsilonType<FieldVector<T, n> > {
    │ │ │ │ -
    47 typedef typename EpsilonType<T>::Type Type;
    │ │ │ │ -
    48 };
    │ │ │ │ +
    5
    │ │ │ │ +
    6#ifndef DUNE_STREAMOPERATORS_HH
    │ │ │ │ +
    7#define DUNE_STREAMOPERATORS_HH
    │ │ │ │ +
    8
    │ │ │ │ +
    13#include <array>
    │ │ │ │ +
    14#include <tuple>
    │ │ │ │ +
    15#include <utility>
    │ │ │ │ +
    16
    │ │ │ │ + │ │ │ │ +
    18
    │ │ │ │ +
    19namespace Dune
    │ │ │ │ +
    20{
    │ │ │ │ +
    27 template<typename Stream, typename... Ts>
    │ │ │ │ +
    │ │ │ │ +
    28 inline Stream& operator<<(Stream& stream, const std::tuple<Ts...>& t)
    │ │ │ │ +
    29 {
    │ │ │ │ +
    30 stream<<"[";
    │ │ │ │ +
    31 if(sizeof...(Ts)>0)
    │ │ │ │ +
    32 {
    │ │ │ │ +
    33 Hybrid::forEach(std::make_index_sequence<sizeof...(Ts)-1>{},
    │ │ │ │ +
    34 [&](auto i){stream<<std::get<i>(t)<<",";});
    │ │ │ │ +
    35 stream<<std::get<sizeof...(Ts)-1>(t);
    │ │ │ │ +
    36 }
    │ │ │ │ +
    37 stream<<"]";
    │ │ │ │ +
    38 return stream;
    │ │ │ │ +
    39 }
    │ │ │ │ +
    │ │ │ │ +
    40
    │ │ │ │ +
    42 template<typename Stream, typename... Ts>
    │ │ │ │ +
    │ │ │ │ +
    43 inline Stream& operator>>(Stream& stream, std::tuple<Ts...>& t)
    │ │ │ │ +
    44 {
    │ │ │ │ +
    45 Hybrid::forEach(std::make_index_sequence<sizeof...(Ts)>{},
    │ │ │ │ +
    46 [&](auto i){stream>>std::get<i>(t);});
    │ │ │ │ +
    47 return stream;
    │ │ │ │ +
    48 }
    │ │ │ │
    │ │ │ │
    49
    │ │ │ │ -
    50 // default epsilon
    │ │ │ │ -
    51 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    53 static typename EpsilonType<T>::Type value()
    │ │ │ │ -
    54 { return std::numeric_limits<typename EpsilonType<T>::Type>::epsilon()*8.; }
    │ │ │ │ -
    │ │ │ │ -
    55 };
    │ │ │ │ -
    │ │ │ │ -
    56 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    58 static typename EpsilonType<T>::Type value()
    │ │ │ │ -
    59 { return std::numeric_limits<typename EpsilonType<T>::Type>::epsilon()*8.; }
    │ │ │ │ -
    │ │ │ │ -
    60 };
    │ │ │ │ -
    │ │ │ │ -
    61 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    63 static typename EpsilonType<T>::Type value()
    │ │ │ │ -
    64 { return std::max(std::numeric_limits<typename EpsilonType<T>::Type>::epsilon(), 1e-6); }
    │ │ │ │ -
    │ │ │ │ -
    65 };
    │ │ │ │ -
    │ │ │ │ -
    66
    │ │ │ │ -
    67 namespace Impl {
    │ │ │ │ -
    68 // basic comparison
    │ │ │ │ -
    69 template<class T, CmpStyle style = defaultCmpStyle>
    │ │ │ │ -
    70 struct eq_t;
    │ │ │ │ -
    71 template<class T>
    │ │ │ │ -
    72 struct eq_t<T, relativeWeak> {
    │ │ │ │ -
    73 static bool eq(const T &first,
    │ │ │ │ -
    74 const T &second,
    │ │ │ │ - │ │ │ │ -
    76 {
    │ │ │ │ -
    77 using std::abs;
    │ │ │ │ -
    78 return abs(first - second) <= epsilon*std::max(abs(first), abs(second));
    │ │ │ │ -
    79 }
    │ │ │ │ -
    80 };
    │ │ │ │ -
    81 template<class T>
    │ │ │ │ -
    82 struct eq_t<T, relativeStrong> {
    │ │ │ │ -
    83 static bool eq(const T &first,
    │ │ │ │ -
    84 const T &second,
    │ │ │ │ - │ │ │ │ -
    86 {
    │ │ │ │ -
    87 using std::abs;
    │ │ │ │ -
    88 return abs(first - second) <= epsilon*std::min(abs(first), abs(second));
    │ │ │ │ -
    89 }
    │ │ │ │ -
    90 };
    │ │ │ │ -
    91 template<class T>
    │ │ │ │ -
    92 struct eq_t<T, absolute> {
    │ │ │ │ -
    93 static bool eq(const T &first,
    │ │ │ │ -
    94 const T &second,
    │ │ │ │ - │ │ │ │ -
    96 {
    │ │ │ │ -
    97 using std::abs;
    │ │ │ │ -
    98 return abs(first-second) <= epsilon;
    │ │ │ │ -
    99 }
    │ │ │ │ -
    100 };
    │ │ │ │ -
    101 template<class T, CmpStyle cstyle>
    │ │ │ │ -
    102 struct eq_t_std_vec {
    │ │ │ │ -
    103 typedef std::vector<T> V;
    │ │ │ │ -
    104 static bool eq(const V &first,
    │ │ │ │ -
    105 const V &second,
    │ │ │ │ -
    106 typename EpsilonType<V>::Type epsilon = DefaultEpsilon<V>::value()) {
    │ │ │ │ -
    107 auto size = first.size();
    │ │ │ │ -
    108 if(size != second.size()) return false;
    │ │ │ │ -
    109 for(unsigned int i = 0; i < size; ++i)
    │ │ │ │ -
    110 if(!eq_t<T, cstyle>::eq(first[i], second[i], epsilon))
    │ │ │ │ -
    111 return false;
    │ │ │ │ -
    112 return true;
    │ │ │ │ -
    113 }
    │ │ │ │ -
    114 };
    │ │ │ │ -
    115 template< class T>
    │ │ │ │ -
    116 struct eq_t<std::vector<T>, relativeWeak> : eq_t_std_vec<T, relativeWeak> {};
    │ │ │ │ -
    117 template< class T>
    │ │ │ │ -
    118 struct eq_t<std::vector<T>, relativeStrong> : eq_t_std_vec<T, relativeStrong> {};
    │ │ │ │ -
    119 template< class T>
    │ │ │ │ -
    120 struct eq_t<std::vector<T>, absolute> : eq_t_std_vec<T, absolute> {};
    │ │ │ │ -
    121
    │ │ │ │ -
    122 template<class T, int n, CmpStyle cstyle>
    │ │ │ │ -
    123 struct eq_t_fvec {
    │ │ │ │ -
    124 typedef Dune::FieldVector<T, n> V;
    │ │ │ │ -
    125 static bool eq(const V &first,
    │ │ │ │ -
    126 const V &second,
    │ │ │ │ -
    127 typename EpsilonType<V>::Type epsilon = DefaultEpsilon<V>::value()) {
    │ │ │ │ -
    128 for(int i = 0; i < n; ++i)
    │ │ │ │ -
    129 if(!eq_t<T, cstyle>::eq(first[i], second[i], epsilon))
    │ │ │ │ -
    130 return false;
    │ │ │ │ -
    131 return true;
    │ │ │ │ -
    132 }
    │ │ │ │ -
    133 };
    │ │ │ │ -
    134 template< class T, int n >
    │ │ │ │ -
    135 struct eq_t< Dune::FieldVector<T, n>, relativeWeak> : eq_t_fvec<T, n, relativeWeak> {};
    │ │ │ │ -
    136 template< class T, int n >
    │ │ │ │ -
    137 struct eq_t< Dune::FieldVector<T, n>, relativeStrong> : eq_t_fvec<T, n, relativeStrong> {};
    │ │ │ │ -
    138 template< class T, int n >
    │ │ │ │ -
    139 struct eq_t< Dune::FieldVector<T, n>, absolute> : eq_t_fvec<T, n, absolute> {};
    │ │ │ │ -
    140 } // namespace Impl
    │ │ │ │ -
    141
    │ │ │ │ -
    142 // operations in functional style
    │ │ │ │ -
    143 template <class T, CmpStyle style>
    │ │ │ │ -
    │ │ │ │ -
    144 bool eq(const T &first,
    │ │ │ │ -
    145 const T &second,
    │ │ │ │ -
    146 typename EpsilonType<T>::Type epsilon)
    │ │ │ │ -
    147 {
    │ │ │ │ -
    148 return Impl::eq_t<T, style>::eq(first, second, epsilon);
    │ │ │ │ -
    149 }
    │ │ │ │ -
    │ │ │ │ -
    150 template <class T, CmpStyle style>
    │ │ │ │ -
    │ │ │ │ -
    151 bool ne(const T &first,
    │ │ │ │ -
    152 const T &second,
    │ │ │ │ -
    153 typename EpsilonType<T>::Type epsilon)
    │ │ │ │ -
    154 {
    │ │ │ │ -
    155 return !eq<T, style>(first, second, epsilon);
    │ │ │ │ -
    156 }
    │ │ │ │ -
    │ │ │ │ -
    157 template <class T, CmpStyle style>
    │ │ │ │ -
    │ │ │ │ -
    158 bool gt(const T &first,
    │ │ │ │ -
    159 const T &second,
    │ │ │ │ -
    160 typename EpsilonType<T>::Type epsilon)
    │ │ │ │ -
    161 {
    │ │ │ │ -
    162 return first > second && ne<T, style>(first, second, epsilon);
    │ │ │ │ -
    163 }
    │ │ │ │ -
    │ │ │ │ -
    164 template <class T, CmpStyle style>
    │ │ │ │ -
    │ │ │ │ -
    165 bool lt(const T &first,
    │ │ │ │ -
    166 const T &second,
    │ │ │ │ -
    167 typename EpsilonType<T>::Type epsilon)
    │ │ │ │ -
    168 {
    │ │ │ │ -
    169 return first < second && ne<T, style>(first, second, epsilon);
    │ │ │ │ -
    170 }
    │ │ │ │ -
    │ │ │ │ -
    171 template <class T, CmpStyle style>
    │ │ │ │ -
    │ │ │ │ -
    172 bool ge(const T &first,
    │ │ │ │ -
    173 const T &second,
    │ │ │ │ -
    174 typename EpsilonType<T>::Type epsilon)
    │ │ │ │ -
    175 {
    │ │ │ │ -
    176 return first > second || eq<T, style>(first, second, epsilon);
    │ │ │ │ -
    177 }
    │ │ │ │ -
    │ │ │ │ -
    178 template <class T, CmpStyle style>
    │ │ │ │ -
    │ │ │ │ -
    179 bool le(const T &first,
    │ │ │ │ -
    180 const T &second,
    │ │ │ │ -
    181 typename EpsilonType<T>::Type epsilon)
    │ │ │ │ -
    182 {
    │ │ │ │ -
    183 return first < second || eq<T, style>(first, second, epsilon);
    │ │ │ │ -
    184 }
    │ │ │ │ -
    │ │ │ │ -
    185
    │ │ │ │ -
    186 // default template arguments
    │ │ │ │ -
    187 template <class T>
    │ │ │ │ -
    │ │ │ │ -
    188 bool eq(const T &first,
    │ │ │ │ -
    189 const T &second,
    │ │ │ │ - │ │ │ │ -
    191 {
    │ │ │ │ -
    192 return eq<T, defaultCmpStyle>(first, second, epsilon);
    │ │ │ │ -
    193 }
    │ │ │ │ -
    │ │ │ │ -
    194 template <class T>
    │ │ │ │ -
    │ │ │ │ -
    195 bool ne(const T &first,
    │ │ │ │ -
    196 const T &second,
    │ │ │ │ - │ │ │ │ -
    198 {
    │ │ │ │ -
    199 return ne<T, defaultCmpStyle>(first, second, epsilon);
    │ │ │ │ -
    200 }
    │ │ │ │ -
    │ │ │ │ -
    201 template <class T>
    │ │ │ │ -
    │ │ │ │ -
    202 bool gt(const T &first,
    │ │ │ │ -
    203 const T &second,
    │ │ │ │ - │ │ │ │ -
    205 {
    │ │ │ │ -
    206 return gt<T, defaultCmpStyle>(first, second, epsilon);
    │ │ │ │ -
    207 }
    │ │ │ │ -
    │ │ │ │ -
    208 template <class T>
    │ │ │ │ -
    │ │ │ │ -
    209 bool lt(const T &first,
    │ │ │ │ -
    210 const T &second,
    │ │ │ │ - │ │ │ │ -
    212 {
    │ │ │ │ -
    213 return lt<T, defaultCmpStyle>(first, second, epsilon);
    │ │ │ │ -
    214 }
    │ │ │ │ -
    │ │ │ │ -
    215 template <class T>
    │ │ │ │ -
    │ │ │ │ -
    216 bool ge(const T &first,
    │ │ │ │ -
    217 const T &second,
    │ │ │ │ - │ │ │ │ -
    219 {
    │ │ │ │ -
    220 return ge<T, defaultCmpStyle>(first, second, epsilon);
    │ │ │ │ -
    221 }
    │ │ │ │ -
    │ │ │ │ -
    222 template <class T>
    │ │ │ │ -
    │ │ │ │ -
    223 bool le(const T &first,
    │ │ │ │ -
    224 const T &second,
    │ │ │ │ - │ │ │ │ -
    226 {
    │ │ │ │ -
    227 return le<T, defaultCmpStyle>(first, second, epsilon);
    │ │ │ │ -
    228 }
    │ │ │ │ -
    │ │ │ │ -
    229
    │ │ │ │ -
    230 // rounding operations
    │ │ │ │ -
    231 namespace Impl {
    │ │ │ │ -
    232 template<class I, class T, CmpStyle cstyle = defaultCmpStyle, RoundingStyle rstyle = defaultRoundingStyle>
    │ │ │ │ -
    233 struct round_t;
    │ │ │ │ -
    234 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    235 struct round_t<I, T, cstyle, downward> {
    │ │ │ │ -
    236 static I
    │ │ │ │ -
    237 round(const T &val,
    │ │ │ │ - │ │ │ │ -
    239 // first get an approximation
    │ │ │ │ -
    240 I lower = I(val);
    │ │ │ │ -
    241 I upper;
    │ │ │ │ -
    242 if(eq<T, cstyle>(T(lower), val, epsilon)) return lower;
    │ │ │ │ -
    243 if(T(lower) > val) { upper = lower; lower--; }
    │ │ │ │ -
    244 else upper = lower+1;
    │ │ │ │ -
    245 if(le<T, cstyle>(val - T(lower), T(upper) - val, epsilon))
    │ │ │ │ -
    246 return lower;
    │ │ │ │ -
    247 else return upper;
    │ │ │ │ -
    248 }
    │ │ │ │ -
    249 };
    │ │ │ │ -
    250 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    251 struct round_t<I, T, cstyle, upward> {
    │ │ │ │ -
    252 static I
    │ │ │ │ -
    253 round(const T &val,
    │ │ │ │ - │ │ │ │ -
    255 // first get an approximation
    │ │ │ │ -
    256 I lower = I(val);
    │ │ │ │ -
    257 I upper;
    │ │ │ │ -
    258 if(eq<T, cstyle>(T(lower), val, epsilon)) return lower;
    │ │ │ │ -
    259 if(T(lower) > val) { upper = lower; lower--; }
    │ │ │ │ -
    260 else upper = lower+1;
    │ │ │ │ -
    261 if(lt<T, cstyle>(val - T(lower), T(upper) - val, epsilon))
    │ │ │ │ -
    262 return lower;
    │ │ │ │ -
    263 else return upper;
    │ │ │ │ -
    264 }
    │ │ │ │ -
    265 };
    │ │ │ │ -
    266 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    267 struct round_t<I, T, cstyle, towardZero> {
    │ │ │ │ -
    268 static I
    │ │ │ │ -
    269 round(const T &val,
    │ │ │ │ - │ │ │ │ -
    271 if(val > T(0))
    │ │ │ │ -
    272 return round_t<I, T, cstyle, downward>::round(val, epsilon);
    │ │ │ │ -
    273 else return round_t<I, T, cstyle, upward>::round(val, epsilon);
    │ │ │ │ -
    274 }
    │ │ │ │ -
    275 };
    │ │ │ │ -
    276 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    277 struct round_t<I, T, cstyle, towardInf> {
    │ │ │ │ -
    278 static I
    │ │ │ │ -
    279 round(const T &val,
    │ │ │ │ - │ │ │ │ -
    281 if(val > T(0))
    │ │ │ │ -
    282 return round_t<I, T, cstyle, upward>::round(val, epsilon);
    │ │ │ │ -
    283 else return round_t<I, T, cstyle, downward>::round(val, epsilon);
    │ │ │ │ -
    284 }
    │ │ │ │ -
    285 };
    │ │ │ │ -
    286 template<class I, class T, CmpStyle cstyle, RoundingStyle rstyle>
    │ │ │ │ -
    287 struct round_t<std::vector<I>, std::vector<T>, cstyle, rstyle> {
    │ │ │ │ -
    288 static std::vector<I>
    │ │ │ │ -
    289 round(const T &val,
    │ │ │ │ - │ │ │ │ -
    291 unsigned int size = val.size();
    │ │ │ │ -
    292 std::vector<I> res(size);
    │ │ │ │ -
    293 for(unsigned int i = 0; i < size; ++i)
    │ │ │ │ -
    294 res[i] = round_t<I, T, cstyle, rstyle>::round(val[i], epsilon);
    │ │ │ │ -
    295 return res;
    │ │ │ │ -
    296 }
    │ │ │ │ -
    297 };
    │ │ │ │ -
    298 template<class I, class T, int n, CmpStyle cstyle, RoundingStyle rstyle>
    │ │ │ │ -
    299 struct round_t<Dune::FieldVector<I, n>, Dune::FieldVector<T, n>, cstyle, rstyle> {
    │ │ │ │ - │ │ │ │ -
    301 round(const T &val,
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    304 for(int i = 0; i < n; ++i)
    │ │ │ │ -
    305 res[i] = round_t<I, T, cstyle, rstyle>::round(val[i], epsilon);
    │ │ │ │ -
    306 return res;
    │ │ │ │ -
    307 }
    │ │ │ │ -
    308 };
    │ │ │ │ -
    309 } // end namespace Impl
    │ │ │ │ -
    310 template<class I, class T, CmpStyle cstyle, RoundingStyle rstyle>
    │ │ │ │ -
    │ │ │ │ -
    311 I round(const T &val, typename EpsilonType<T>::Type epsilon /*= DefaultEpsilon<T, cstyle>::value()*/)
    │ │ │ │ -
    312 {
    │ │ │ │ -
    313 return Impl::round_t<I, T, cstyle, rstyle>::round(val, epsilon);
    │ │ │ │ -
    314 }
    │ │ │ │ -
    │ │ │ │ -
    315 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    │ │ │ │ -
    316 I round(const T &val, typename EpsilonType<T>::Type epsilon = DefaultEpsilon<T, cstyle>::value())
    │ │ │ │ -
    317 {
    │ │ │ │ -
    318 return round<I, T, cstyle, defaultRoundingStyle>(val, epsilon);
    │ │ │ │ -
    319 }
    │ │ │ │ -
    │ │ │ │ -
    320 template<class I, class T, RoundingStyle rstyle>
    │ │ │ │ -
    321 I round(const T &val, typename EpsilonType<T>::Type epsilon = DefaultEpsilon<T, defaultCmpStyle>::value())
    │ │ │ │ -
    322 {
    │ │ │ │ -
    323 return round<I, T, defaultCmpStyle, rstyle>(val, epsilon);
    │ │ │ │ -
    324 }
    │ │ │ │ -
    325 template<class I, class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    327 {
    │ │ │ │ -
    328 return round<I, T, defaultCmpStyle>(val, epsilon);
    │ │ │ │ -
    329 }
    │ │ │ │ -
    │ │ │ │ -
    330
    │ │ │ │ -
    331 // truncation
    │ │ │ │ -
    332 namespace Impl {
    │ │ │ │ -
    333 template<class I, class T, CmpStyle cstyle = defaultCmpStyle, RoundingStyle rstyle = defaultRoundingStyle>
    │ │ │ │ -
    334 struct trunc_t;
    │ │ │ │ -
    335 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    336 struct trunc_t<I, T, cstyle, downward> {
    │ │ │ │ -
    337 static I
    │ │ │ │ -
    338 trunc(const T &val,
    │ │ │ │ - │ │ │ │ -
    340 // this should be optimized away unless needed
    │ │ │ │ -
    341 if(!std::numeric_limits<I>::is_signed)
    │ │ │ │ -
    342 // make sure this works for all useful cases even if I is an unsigned type
    │ │ │ │ -
    343 if(eq<T, cstyle>(val, T(0), epsilon)) return I(0);
    │ │ │ │ -
    344 // first get an approximation
    │ │ │ │ -
    345 I lower = I(val); // now |val-lower| < 1
    │ │ │ │ -
    346 // make sure we're really lower in case the cast truncated to an unexpected direction
    │ │ │ │ -
    347 if(T(lower) > val) lower--; // now val-lower < 1
    │ │ │ │ -
    348 // check whether lower + 1 is approximately val
    │ │ │ │ -
    349 if(eq<T, cstyle>(T(lower+1), val, epsilon))
    │ │ │ │ -
    350 return lower+1;
    │ │ │ │ -
    351 else return lower;
    │ │ │ │ -
    352 }
    │ │ │ │ -
    353 };
    │ │ │ │ -
    354 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    355 struct trunc_t<I, T, cstyle, upward> {
    │ │ │ │ -
    356 static I
    │ │ │ │ -
    357 trunc(const T &val,
    │ │ │ │ - │ │ │ │ -
    359 I upper = trunc_t<I, T, cstyle, downward>::trunc(val, epsilon);
    │ │ │ │ -
    360 if(ne<T, cstyle>(T(upper), val, epsilon)) ++upper;
    │ │ │ │ -
    361 return upper;
    │ │ │ │ -
    362 }
    │ │ │ │ -
    363 };
    │ │ │ │ -
    364 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    365 struct trunc_t<I, T, cstyle, towardZero> {
    │ │ │ │ -
    366 static I
    │ │ │ │ -
    367 trunc(const T &val,
    │ │ │ │ - │ │ │ │ -
    369 if(val > T(0)) return trunc_t<I, T, cstyle, downward>::trunc(val, epsilon);
    │ │ │ │ -
    370 else return trunc_t<I, T, cstyle, upward>::trunc(val, epsilon);
    │ │ │ │ -
    371 }
    │ │ │ │ -
    372 };
    │ │ │ │ -
    373 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    374 struct trunc_t<I, T, cstyle, towardInf> {
    │ │ │ │ -
    375 static I
    │ │ │ │ -
    376 trunc(const T &val,
    │ │ │ │ - │ │ │ │ -
    378 if(val > T(0)) return trunc_t<I, T, cstyle, upward>::trunc(val, epsilon);
    │ │ │ │ -
    379 else return trunc_t<I, T, cstyle, downward>::trunc(val, epsilon);
    │ │ │ │ -
    380 }
    │ │ │ │ -
    381 };
    │ │ │ │ -
    382 template<class I, class T, CmpStyle cstyle, RoundingStyle rstyle>
    │ │ │ │ -
    383 struct trunc_t<std::vector<I>, std::vector<T>, cstyle, rstyle> {
    │ │ │ │ -
    384 static std::vector<I>
    │ │ │ │ -
    385 trunc(const std::vector<T> &val,
    │ │ │ │ - │ │ │ │ -
    387 unsigned int size = val.size();
    │ │ │ │ -
    388 std::vector<I> res(size);
    │ │ │ │ -
    389 for(unsigned int i = 0; i < size; ++i)
    │ │ │ │ -
    390 res[i] = trunc_t<I, T, cstyle, rstyle>::trunc(val[i], epsilon);
    │ │ │ │ -
    391 return res;
    │ │ │ │ -
    392 }
    │ │ │ │ -
    393 };
    │ │ │ │ -
    394 template<class I, class T, int n, CmpStyle cstyle, RoundingStyle rstyle>
    │ │ │ │ -
    395 struct trunc_t<Dune::FieldVector<I, n>, Dune::FieldVector<T, n>, cstyle, rstyle> {
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    400 for(int i = 0; i < n; ++i)
    │ │ │ │ -
    401 res[i] = trunc_t<I, T, cstyle, rstyle>::trunc(val[i], epsilon);
    │ │ │ │ -
    402 return res;
    │ │ │ │ -
    403 }
    │ │ │ │ -
    404 };
    │ │ │ │ -
    405 } // namespace Impl
    │ │ │ │ -
    406 template<class I, class T, CmpStyle cstyle, RoundingStyle rstyle>
    │ │ │ │ -
    │ │ │ │ -
    407 I trunc(const T &val, typename EpsilonType<T>::Type epsilon /*= DefaultEpsilon<T, cstyle>::value()*/)
    │ │ │ │ -
    408 {
    │ │ │ │ -
    409 return Impl::trunc_t<I, T, cstyle, rstyle>::trunc(val, epsilon);
    │ │ │ │ -
    410 }
    │ │ │ │ -
    │ │ │ │ -
    411 template<class I, class T, CmpStyle cstyle>
    │ │ │ │ -
    │ │ │ │ -
    412 I trunc(const T &val, typename EpsilonType<T>::Type epsilon = DefaultEpsilon<T, cstyle>::value())
    │ │ │ │ -
    413 {
    │ │ │ │ -
    414 return trunc<I, T, cstyle, defaultRoundingStyle>(val, epsilon);
    │ │ │ │ -
    415 }
    │ │ │ │ -
    │ │ │ │ -
    416 template<class I, class T, RoundingStyle rstyle>
    │ │ │ │ -
    417 I trunc(const T &val, typename EpsilonType<T>::Type epsilon = DefaultEpsilon<T, defaultCmpStyle>::value())
    │ │ │ │ -
    418 {
    │ │ │ │ -
    419 return trunc<I, T, defaultCmpStyle, rstyle>(val, epsilon);
    │ │ │ │ -
    420 }
    │ │ │ │ -
    421 template<class I, class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    423 {
    │ │ │ │ -
    424 return trunc<I, T, defaultCmpStyle>(val, epsilon);
    │ │ │ │ -
    425 }
    │ │ │ │ -
    │ │ │ │ -
    426 } //namespace Dune
    │ │ │ │ -
    │ │ │ │ -
    427
    │ │ │ │ -
    428 // oo interface
    │ │ │ │ -
    429 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    431 FloatCmpOps(EpsilonType epsilon) : epsilon_(epsilon) {}
    │ │ │ │ -
    │ │ │ │ -
    432
    │ │ │ │ -
    433
    │ │ │ │ -
    434 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    437 {
    │ │ │ │ -
    438 return epsilon_;
    │ │ │ │ -
    439 }
    │ │ │ │ -
    │ │ │ │ -
    440
    │ │ │ │ -
    441 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    442 void
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    444 {
    │ │ │ │ -
    445 epsilon_ = epsilon__;
    │ │ │ │ -
    446 }
    │ │ │ │ -
    │ │ │ │ -
    447
    │ │ │ │ -
    448
    │ │ │ │ -
    449 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    451 eq(const ValueType &first, const ValueType &second) const
    │ │ │ │ -
    452 {
    │ │ │ │ -
    453 return Dune::FloatCmp::eq<ValueType, cstyle>(first, second, epsilon_);
    │ │ │ │ -
    454 }
    │ │ │ │ -
    │ │ │ │ -
    455
    │ │ │ │ -
    456 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    458 ne(const ValueType &first, const ValueType &second) const
    │ │ │ │ -
    459 {
    │ │ │ │ -
    460 return Dune::FloatCmp::ne<ValueType, cstyle>(first, second, epsilon_);
    │ │ │ │ -
    461 }
    │ │ │ │ -
    │ │ │ │ -
    462
    │ │ │ │ -
    463 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    465 gt(const ValueType &first, const ValueType &second) const
    │ │ │ │ -
    466 {
    │ │ │ │ -
    467 return Dune::FloatCmp::gt<ValueType, cstyle>(first, second, epsilon_);
    │ │ │ │ -
    468 }
    │ │ │ │ -
    │ │ │ │ -
    469
    │ │ │ │ -
    470 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    472 lt(const ValueType &first, const ValueType &second) const
    │ │ │ │ -
    473 {
    │ │ │ │ -
    474 return Dune::FloatCmp::lt<ValueType, cstyle>(first, second, epsilon_);
    │ │ │ │ -
    475 }
    │ │ │ │ -
    │ │ │ │ -
    476
    │ │ │ │ -
    477 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    479 ge(const ValueType &first, const ValueType &second) const
    │ │ │ │ -
    480 {
    │ │ │ │ -
    481 return Dune::FloatCmp::ge<ValueType, cstyle>(first, second, epsilon_);
    │ │ │ │ -
    482 }
    │ │ │ │ -
    │ │ │ │ -
    483
    │ │ │ │ -
    484 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    486 le(const ValueType &first, const ValueType &second) const
    │ │ │ │ -
    487 {
    │ │ │ │ -
    488 return Dune::FloatCmp::le<ValueType, cstyle>(first, second, epsilon_);
    │ │ │ │ -
    489 }
    │ │ │ │ -
    │ │ │ │ -
    490
    │ │ │ │ -
    491
    │ │ │ │ -
    492 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    493 template<class I>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    495 round(const ValueType &val) const
    │ │ │ │ -
    496 {
    │ │ │ │ -
    497 return Dune::FloatCmp::round<I, ValueType, cstyle, rstyle_>(val, epsilon_);
    │ │ │ │ -
    498 }
    │ │ │ │ -
    │ │ │ │ -
    499
    │ │ │ │ -
    500 template<class T, FloatCmp::CmpStyle cstyle_, FloatCmp::RoundingStyle rstyle_>
    │ │ │ │ -
    501 template<class I>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    503 trunc(const ValueType &val) const
    │ │ │ │ -
    504 {
    │ │ │ │ -
    505 return Dune::FloatCmp::trunc<I, ValueType, cstyle, rstyle_>(val, epsilon_);
    │ │ │ │ -
    506 }
    │ │ │ │ -
    │ │ │ │ -
    507
    │ │ │ │ -
    508} //namespace Dune
    │ │ │ │ -
    Various ways to compare floating-point numbers.
    │ │ │ │ -
    Implements a vector constructed from a given type representing a field and a compile-time given size.
    │ │ │ │ -
    bool ne(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
    test for inequality using epsilon
    Definition float_cmp.cc:151
    │ │ │ │ -
    bool eq(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
    test for equality using epsilon
    Definition float_cmp.cc:144
    │ │ │ │ -
    I round(const T &val, typename EpsilonType< T >::Type epsilon)
    round using epsilon
    Definition float_cmp.cc:311
    │ │ │ │ -
    I trunc(const T &val, typename EpsilonType< T >::Type epsilon)
    truncate using epsilon
    Definition float_cmp.cc:407
    │ │ │ │ -
    bool lt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
    test if first lesser than second
    Definition float_cmp.cc:165
    │ │ │ │ -
    bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
    test if first greater than second
    Definition float_cmp.cc:158
    │ │ │ │ -
    bool ge(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
    test if first greater or equal second
    Definition float_cmp.cc:172
    │ │ │ │ -
    bool le(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
    test if first lesser or equal second
    Definition float_cmp.cc:179
    │ │ │ │ -
    @ relativeStrong
    |a-b|/|a| <= epsilon && |a-b|/|b| <= epsilon
    Definition float_cmp.hh:108
    │ │ │ │ -
    @ relativeWeak
    |a-b|/|a| <= epsilon || |a-b|/|b| <= epsilon
    Definition float_cmp.hh:106
    │ │ │ │ -
    @ absolute
    |a-b| <= epsilon
    Definition float_cmp.hh:110
    │ │ │ │ -
    @ towardZero
    always round toward 0
    Definition float_cmp.hh:118
    │ │ │ │ -
    @ towardInf
    always round away from 0
    Definition float_cmp.hh:120
    │ │ │ │ -
    @ upward
    round toward
    Definition float_cmp.hh:124
    │ │ │ │ -
    @ downward
    round toward
    Definition float_cmp.hh:122
    │ │ │ │ -
    STL namespace.
    │ │ │ │ +
    51 template<typename Stream, typename T, std::size_t N>
    │ │ │ │ +
    │ │ │ │ +
    52 inline Stream& operator<<(Stream& stream, const std::array<T,N>& a)
    │ │ │ │ +
    53 {
    │ │ │ │ +
    54 stream<<"[";
    │ │ │ │ +
    55 if(N>0)
    │ │ │ │ +
    56 {
    │ │ │ │ +
    57 for(std::size_t i=0; i<N-1; ++i)
    │ │ │ │ +
    58 stream<<a[i]<<",";
    │ │ │ │ +
    59 stream<<a[N-1];
    │ │ │ │ +
    60 }
    │ │ │ │ +
    61 stream<<"]";
    │ │ │ │ +
    62 return stream;
    │ │ │ │ +
    63 }
    │ │ │ │ +
    │ │ │ │ +
    64
    │ │ │ │ +
    67} // end namespace Dune
    │ │ │ │ +
    68
    │ │ │ │ +
    69#endif
    │ │ │ │ + │ │ │ │ +
    Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
    Read a std::tuple.
    Definition streamoperators.hh:43
    │ │ │ │ +
    constexpr void forEach(Range &&range, F &&f)
    Range based for loop.
    Definition hybridutilities.hh:268
    │ │ │ │ +
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    vector space out of a tensor product of fields.
    Definition fvector.hh:95
    │ │ │ │ -
    Mapping of value type to epsilon type.
    Definition float_cmp.cc:23
    │ │ │ │ -
    T Type
    The epsilon type corresponding to value type T.
    Definition float_cmp.cc:25
    │ │ │ │ -
    EpsilonType< T >::Type Type
    The epsilon type corresponding to value type std::vector<T, A>
    Definition float_cmp.cc:36
    │ │ │ │ -
    EpsilonType< T >::Type Type
    The epsilon type corresponding to value type Dune::FieldVector<T, n>
    Definition float_cmp.cc:47
    │ │ │ │ -
    static EpsilonType< T >::Type value()
    Definition float_cmp.cc:53
    │ │ │ │ -
    static EpsilonType< T >::Type value()
    Definition float_cmp.cc:58
    │ │ │ │ -
    static EpsilonType< T >::Type value()
    Definition float_cmp.cc:63
    │ │ │ │ -
    mapping from a value type and a compare style to a default epsilon
    Definition float_cmp.hh:138
    │ │ │ │ -
    static EpsilonType< T >::Type value()
    Returns the default epsilon for the given value type and compare style.
    │ │ │ │ -
    bool le(const ValueType &first, const ValueType &second) const
    test if first lesser or equal second
    Definition float_cmp.cc:486
    │ │ │ │ -
    FloatCmpOps(EpsilonType epsilon=DefaultEpsilon::value())
    construct an operations object
    Definition float_cmp.cc:431
    │ │ │ │ -
    bool eq(const ValueType &first, const ValueType &second) const
    test for equality using epsilon
    Definition float_cmp.cc:451
    │ │ │ │ -
    bool lt(const ValueType &first, const ValueType &second) const
    test if first lesser than second
    Definition float_cmp.cc:472
    │ │ │ │ -
    bool ge(const ValueType &first, const ValueType &second) const
    test if first greater or equal second
    Definition float_cmp.cc:479
    │ │ │ │ -
    FloatCmp::EpsilonType< T >::Type EpsilonType
    Type of the epsilon.
    Definition float_cmp.hh:304
    │ │ │ │ -
    bool ne(const ValueType &first, const ValueType &second) const
    test for inequality using epsilon
    Definition float_cmp.cc:458
    │ │ │ │ -
    T ValueType
    Type of the values to compare.
    Definition float_cmp.hh:299
    │ │ │ │ -
    EpsilonType epsilon() const
    return the current epsilon
    Definition float_cmp.cc:436
    │ │ │ │ -
    I round(const ValueType &val) const
    round using epsilon
    Definition float_cmp.cc:495
    │ │ │ │ -
    I trunc(const ValueType &val) const
    truncate using epsilon
    Definition float_cmp.cc:503
    │ │ │ │ -
    bool gt(const ValueType &first, const ValueType &second) const
    test if first greater than second
    Definition float_cmp.cc:465
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,707 +1,81 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -float_cmp.cc │ │ │ │ │ +streamoperators.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#include "_f_l_o_a_t___c_m_p_._h_h" │ │ │ │ │ -6 │ │ │ │ │ -7#include │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ -12 │ │ │ │ │ -13namespace _D_u_n_e { │ │ │ │ │ -14 │ │ │ │ │ -15 │ │ │ │ │ -_1_6 namespace FloatCmp { │ │ │ │ │ -17 // traits │ │ │ │ │ -19 │ │ │ │ │ -_2_3 template struct _E_p_s_i_l_o_n_T_y_p_e { │ │ │ │ │ -_2_5 typedef T _T_y_p_e; │ │ │ │ │ -26 }; │ │ │ │ │ -28 │ │ │ │ │ -33 template │ │ │ │ │ -_3_4 struct _E_p_s_i_l_o_n_T_y_p_e<_s_t_d::vector > { │ │ │ │ │ -_3_6 typedef typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e _T_y_p_e; │ │ │ │ │ -37 }; │ │ │ │ │ -39 │ │ │ │ │ -44 template │ │ │ │ │ -_4_5 struct _E_p_s_i_l_o_n_T_y_p_e<_F_i_e_l_d_V_e_c_t_o_r > { │ │ │ │ │ -_4_7 typedef typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e _T_y_p_e; │ │ │ │ │ -48 }; │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_STREAMOPERATORS_HH │ │ │ │ │ +7#define DUNE_STREAMOPERATORS_HH │ │ │ │ │ +8 │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_y_b_r_i_d_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +18 │ │ │ │ │ +19namespace _D_u_n_e │ │ │ │ │ +20{ │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 inline Stream& _o_p_e_r_a_t_o_r_<_<(Stream& stream, const std::tuple& t) │ │ │ │ │ +29 { │ │ │ │ │ +30 stream<<"["; │ │ │ │ │ +31 if(sizeof...(Ts)>0) │ │ │ │ │ +32 { │ │ │ │ │ +33 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(std::make_index_sequence{}, │ │ │ │ │ +34 [&](auto i){stream<(t)<<",";}); │ │ │ │ │ +35 stream<(t); │ │ │ │ │ +36 } │ │ │ │ │ +37 stream<<"]"; │ │ │ │ │ +38 return stream; │ │ │ │ │ +39 } │ │ │ │ │ +40 │ │ │ │ │ +42 template │ │ │ │ │ +_4_3 inline Stream& _o_p_e_r_a_t_o_r_>_>(Stream& stream, std::tuple& t) │ │ │ │ │ +44 { │ │ │ │ │ +45 _H_y_b_r_i_d_:_:_f_o_r_E_a_c_h(std::make_index_sequence{}, │ │ │ │ │ +46 [&](auto i){stream>>std::get(t);}); │ │ │ │ │ +47 return stream; │ │ │ │ │ +48 } │ │ │ │ │ 49 │ │ │ │ │ -50 // default epsilon │ │ │ │ │ -51 template │ │ │ │ │ -_5_2 struct _D_e_f_a_u_l_t_E_p_s_i_l_o_n { │ │ │ │ │ -_5_3 static typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e _v_a_l_u_e() │ │ │ │ │ -54 { return std::numeric_limits::Type>::epsilon()*8.; } │ │ │ │ │ -55 }; │ │ │ │ │ -56 template │ │ │ │ │ -_5_7 struct _D_e_f_a_u_l_t_E_p_s_i_l_o_n { │ │ │ │ │ -_5_8 static typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e _v_a_l_u_e() │ │ │ │ │ -59 { return std::numeric_limits::Type>::epsilon()*8.; } │ │ │ │ │ -60 }; │ │ │ │ │ -61 template │ │ │ │ │ -_6_2 struct _D_e_f_a_u_l_t_E_p_s_i_l_o_n { │ │ │ │ │ -_6_3 static typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e _v_a_l_u_e() │ │ │ │ │ -64 { return std::max(std::numeric_limits_:_:_T_y_p_e>:: │ │ │ │ │ -epsilon(), 1e-6); } │ │ │ │ │ -65 }; │ │ │ │ │ -66 │ │ │ │ │ -67 namespace Impl { │ │ │ │ │ -68 // basic comparison │ │ │ │ │ -69 template │ │ │ │ │ -70 struct eq_t; │ │ │ │ │ -71 template │ │ │ │ │ -72 struct eq_t { │ │ │ │ │ -73 static bool _e_q(const T &first, │ │ │ │ │ -74 const T &second, │ │ │ │ │ -75 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_>_:_:_v_a_l_u_e()) │ │ │ │ │ -76 { │ │ │ │ │ -77 using std::abs; │ │ │ │ │ -78 return abs(first - second) <= epsilon*std::max(abs(first), abs(second)); │ │ │ │ │ -79 } │ │ │ │ │ -80 }; │ │ │ │ │ -81 template │ │ │ │ │ -82 struct eq_t { │ │ │ │ │ -83 static bool _e_q(const T &first, │ │ │ │ │ -84 const T &second, │ │ │ │ │ -85 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_>_:_:_v_a_l_u_e()) │ │ │ │ │ -86 { │ │ │ │ │ -87 using std::abs; │ │ │ │ │ -88 return abs(first - second) <= epsilon*std::min(abs(first), abs(second)); │ │ │ │ │ -89 } │ │ │ │ │ -90 }; │ │ │ │ │ -91 template │ │ │ │ │ -92 struct eq_t { │ │ │ │ │ -93 static bool _e_q(const T &first, │ │ │ │ │ -94 const T &second, │ │ │ │ │ -95 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_>_:_:_v_a_l_u_e()) │ │ │ │ │ -96 { │ │ │ │ │ -97 using std::abs; │ │ │ │ │ -98 return abs(first-second) <= epsilon; │ │ │ │ │ -99 } │ │ │ │ │ -100 }; │ │ │ │ │ -101 template │ │ │ │ │ -102 struct eq_t_std_vec { │ │ │ │ │ -103 typedef std::vector V; │ │ │ │ │ -104 static bool _e_q(const V &first, │ │ │ │ │ -105 const V &second, │ │ │ │ │ -106 typename _E_p_s_i_l_o_n_T_y_p_e_<_V_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_V_>_:_:_v_a_l_u_e()) { │ │ │ │ │ -107 auto size = first.size(); │ │ │ │ │ -108 if(size != second.size()) return false; │ │ │ │ │ -109 for(unsigned int i = 0; i < size; ++i) │ │ │ │ │ -110 if(!eq_t::eq(first[i], second[i], epsilon)) │ │ │ │ │ -111 return false; │ │ │ │ │ -112 return true; │ │ │ │ │ -113 } │ │ │ │ │ -114 }; │ │ │ │ │ -115 template< class T> │ │ │ │ │ -116 struct eq_t<_s_t_d::vector, _r_e_l_a_t_i_v_e_W_e_a_k> : eq_t_std_vec │ │ │ │ │ -{}; │ │ │ │ │ -117 template< class T> │ │ │ │ │ -118 struct eq_t<_s_t_d::vector, _r_e_l_a_t_i_v_e_S_t_r_o_n_g> : eq_t_std_vec {}; │ │ │ │ │ -119 template< class T> │ │ │ │ │ -120 struct eq_t<_s_t_d::vector, _a_b_s_o_l_u_t_e> : eq_t_std_vec {}; │ │ │ │ │ -121 │ │ │ │ │ -122 template │ │ │ │ │ -123 struct eq_t_fvec { │ │ │ │ │ -124 typedef _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _n_> V; │ │ │ │ │ -125 static bool _e_q(const V &first, │ │ │ │ │ -126 const V &second, │ │ │ │ │ -127 typename _E_p_s_i_l_o_n_T_y_p_e_<_V_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_V_>_:_:_v_a_l_u_e()) { │ │ │ │ │ -128 for(int i = 0; i < n; ++i) │ │ │ │ │ -129 if(!eq_t::eq(first[i], second[i], epsilon)) │ │ │ │ │ -130 return false; │ │ │ │ │ -131 return true; │ │ │ │ │ -132 } │ │ │ │ │ -133 }; │ │ │ │ │ -134 template< class T, int n > │ │ │ │ │ -135 struct eq_t< _D_u_n_e::FieldVector, _r_e_l_a_t_i_v_e_W_e_a_k> : eq_t_fvec {}; │ │ │ │ │ -136 template< class T, int n > │ │ │ │ │ -137 struct eq_t< _D_u_n_e::FieldVector, _r_e_l_a_t_i_v_e_S_t_r_o_n_g> : eq_t_fvec {}; │ │ │ │ │ -138 template< class T, int n > │ │ │ │ │ -139 struct eq_t< _D_u_n_e::FieldVector, _a_b_s_o_l_u_t_e> : eq_t_fvec │ │ │ │ │ -{}; │ │ │ │ │ -140 } // namespace Impl │ │ │ │ │ -141 │ │ │ │ │ -142 // operations in functional style │ │ │ │ │ -143 template │ │ │ │ │ -_1_4_4 bool _e_q(const T &first, │ │ │ │ │ -145 const T &second, │ │ │ │ │ -146 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon) │ │ │ │ │ -147 { │ │ │ │ │ -148 return Impl::eq_t::eq(first, second, epsilon); │ │ │ │ │ -149 } │ │ │ │ │ -150 template │ │ │ │ │ -_1_5_1 bool _n_e(const T &first, │ │ │ │ │ -152 const T &second, │ │ │ │ │ -153 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon) │ │ │ │ │ -154 { │ │ │ │ │ -155 return !eq(first, second, epsilon); │ │ │ │ │ -156 } │ │ │ │ │ -157 template │ │ │ │ │ -_1_5_8 bool _g_t(const T &first, │ │ │ │ │ -159 const T &second, │ │ │ │ │ -160 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon) │ │ │ │ │ -161 { │ │ │ │ │ -162 return first > second && ne(first, second, epsilon); │ │ │ │ │ -163 } │ │ │ │ │ -164 template │ │ │ │ │ -_1_6_5 bool _l_t(const T &first, │ │ │ │ │ -166 const T &second, │ │ │ │ │ -167 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon) │ │ │ │ │ -168 { │ │ │ │ │ -169 return first < second && ne(first, second, epsilon); │ │ │ │ │ -170 } │ │ │ │ │ -171 template │ │ │ │ │ -_1_7_2 bool _g_e(const T &first, │ │ │ │ │ -173 const T &second, │ │ │ │ │ -174 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon) │ │ │ │ │ -175 { │ │ │ │ │ -176 return first > second || eq(first, second, epsilon); │ │ │ │ │ -177 } │ │ │ │ │ -178 template │ │ │ │ │ -_1_7_9 bool _l_e(const T &first, │ │ │ │ │ -180 const T &second, │ │ │ │ │ -181 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon) │ │ │ │ │ -182 { │ │ │ │ │ -183 return first < second || eq(first, second, epsilon); │ │ │ │ │ -184 } │ │ │ │ │ -185 │ │ │ │ │ -186 // default template arguments │ │ │ │ │ -187 template │ │ │ │ │ -_1_8_8 bool _e_q(const T &first, │ │ │ │ │ -189 const T &second, │ │ │ │ │ -190 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_, │ │ │ │ │ -_d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -191 { │ │ │ │ │ -192 return eq(first, second, epsilon); │ │ │ │ │ -193 } │ │ │ │ │ -194 template │ │ │ │ │ -_1_9_5 bool _n_e(const T &first, │ │ │ │ │ -196 const T &second, │ │ │ │ │ -197 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_, │ │ │ │ │ -_d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -198 { │ │ │ │ │ -199 return ne(first, second, epsilon); │ │ │ │ │ -200 } │ │ │ │ │ -201 template │ │ │ │ │ -_2_0_2 bool _g_t(const T &first, │ │ │ │ │ -203 const T &second, │ │ │ │ │ -204 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_, │ │ │ │ │ -_d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -205 { │ │ │ │ │ -206 return gt(first, second, epsilon); │ │ │ │ │ -207 } │ │ │ │ │ -208 template │ │ │ │ │ -_2_0_9 bool _l_t(const T &first, │ │ │ │ │ -210 const T &second, │ │ │ │ │ -211 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_, │ │ │ │ │ -_d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -212 { │ │ │ │ │ -213 return lt(first, second, epsilon); │ │ │ │ │ -214 } │ │ │ │ │ -215 template │ │ │ │ │ -_2_1_6 bool _g_e(const T &first, │ │ │ │ │ -217 const T &second, │ │ │ │ │ -218 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_, │ │ │ │ │ -_d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -219 { │ │ │ │ │ -220 return ge(first, second, epsilon); │ │ │ │ │ -221 } │ │ │ │ │ -222 template │ │ │ │ │ -_2_2_3 bool _l_e(const T &first, │ │ │ │ │ -224 const T &second, │ │ │ │ │ -225 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = _D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_, │ │ │ │ │ -_d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -226 { │ │ │ │ │ -227 return le(first, second, epsilon); │ │ │ │ │ -228 } │ │ │ │ │ -229 │ │ │ │ │ -230 // rounding operations │ │ │ │ │ -231 namespace Impl { │ │ │ │ │ -232 template │ │ │ │ │ -233 struct round_t; │ │ │ │ │ -234 template │ │ │ │ │ -235 struct round_t { │ │ │ │ │ -236 static I │ │ │ │ │ -237 _r_o_u_n_d(const T &val, │ │ │ │ │ -238 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -239 // first get an approximation │ │ │ │ │ -240 I lower = I(val); │ │ │ │ │ -241 I upper; │ │ │ │ │ -242 if(eq(T(lower), val, epsilon)) return lower; │ │ │ │ │ -243 if(T(lower) > val) { upper = lower; lower--; } │ │ │ │ │ -244 else upper = lower+1; │ │ │ │ │ -245 if(le(val - T(lower), T(upper) - val, epsilon)) │ │ │ │ │ -246 return lower; │ │ │ │ │ -247 else return upper; │ │ │ │ │ -248 } │ │ │ │ │ -249 }; │ │ │ │ │ -250 template │ │ │ │ │ -251 struct round_t { │ │ │ │ │ -252 static I │ │ │ │ │ -253 _r_o_u_n_d(const T &val, │ │ │ │ │ -254 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -255 // first get an approximation │ │ │ │ │ -256 I lower = I(val); │ │ │ │ │ -257 I upper; │ │ │ │ │ -258 if(eq(T(lower), val, epsilon)) return lower; │ │ │ │ │ -259 if(T(lower) > val) { upper = lower; lower--; } │ │ │ │ │ -260 else upper = lower+1; │ │ │ │ │ -261 if(lt(val - T(lower), T(upper) - val, epsilon)) │ │ │ │ │ -262 return lower; │ │ │ │ │ -263 else return upper; │ │ │ │ │ -264 } │ │ │ │ │ -265 }; │ │ │ │ │ -266 template │ │ │ │ │ -267 struct round_t { │ │ │ │ │ -268 static I │ │ │ │ │ -269 _r_o_u_n_d(const T &val, │ │ │ │ │ -270 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -271 if(val > T(0)) │ │ │ │ │ -272 return round_t::round(val, epsilon); │ │ │ │ │ -273 else return round_t::round(val, epsilon); │ │ │ │ │ -274 } │ │ │ │ │ -275 }; │ │ │ │ │ -276 template │ │ │ │ │ -277 struct round_t { │ │ │ │ │ -278 static I │ │ │ │ │ -279 _r_o_u_n_d(const T &val, │ │ │ │ │ -280 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -281 if(val > T(0)) │ │ │ │ │ -282 return round_t::round(val, epsilon); │ │ │ │ │ -283 else return round_t::round(val, epsilon); │ │ │ │ │ -284 } │ │ │ │ │ -285 }; │ │ │ │ │ -286 template │ │ │ │ │ -287 struct round_t<_s_t_d::vector, std::vector, cstyle, rstyle> { │ │ │ │ │ -288 static std::vector │ │ │ │ │ -289 _r_o_u_n_d(const T &val, │ │ │ │ │ -290 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -291 unsigned int size = val.size(); │ │ │ │ │ -292 std::vector res(size); │ │ │ │ │ -293 for(unsigned int i = 0; i < size; ++i) │ │ │ │ │ -294 res[i] = round_t::round(val[i], epsilon); │ │ │ │ │ -295 return res; │ │ │ │ │ -296 } │ │ │ │ │ -297 }; │ │ │ │ │ -298 template │ │ │ │ │ -299 struct round_t<_D_u_n_e::FieldVector, _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r, cstyle, │ │ │ │ │ -rstyle> { │ │ │ │ │ -300 static _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_I_,_ _n_> │ │ │ │ │ -301 _r_o_u_n_d(const T &val, │ │ │ │ │ -302 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -303 _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_I_,_ _n_> res; │ │ │ │ │ -304 for(int i = 0; i < n; ++i) │ │ │ │ │ -305 res[i] = round_t::round(val[i], epsilon); │ │ │ │ │ -306 return res; │ │ │ │ │ -307 } │ │ │ │ │ -308 }; │ │ │ │ │ -309 } // end namespace Impl │ │ │ │ │ -310 template │ │ │ │ │ -_3_1_1 I _r_o_u_n_d(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon /*= │ │ │ │ │ -DefaultEpsilon::value()*/) │ │ │ │ │ -312 { │ │ │ │ │ -313 return Impl::round_t::round(val, epsilon); │ │ │ │ │ -314 } │ │ │ │ │ -315 template │ │ │ │ │ -_3_1_6 I _r_o_u_n_d(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -317 { │ │ │ │ │ -318 return round(val, epsilon); │ │ │ │ │ -319 } │ │ │ │ │ -320 template │ │ │ │ │ -321 I _r_o_u_n_d(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -322 { │ │ │ │ │ -323 return round(val, epsilon); │ │ │ │ │ -324 } │ │ │ │ │ -325 template │ │ │ │ │ -_3_2_6 I _r_o_u_n_d(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -327 { │ │ │ │ │ -328 return round(val, epsilon); │ │ │ │ │ -329 } │ │ │ │ │ -330 │ │ │ │ │ -331 // truncation │ │ │ │ │ -332 namespace Impl { │ │ │ │ │ -333 template │ │ │ │ │ -334 struct trunc_t; │ │ │ │ │ -335 template │ │ │ │ │ -336 struct trunc_t { │ │ │ │ │ -337 static I │ │ │ │ │ -338 _t_r_u_n_c(const T &val, │ │ │ │ │ -339 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -340 // this should be optimized away unless needed │ │ │ │ │ -341 if(!std::numeric_limits::is_signed) │ │ │ │ │ -342 // make sure this works for all useful cases even if I is an unsigned type │ │ │ │ │ -343 if(eq(val, T(0), epsilon)) return I(0); │ │ │ │ │ -344 // first get an approximation │ │ │ │ │ -345 I lower = I(val); // now |val-lower| < 1 │ │ │ │ │ -346 // make sure we're really lower in case the cast truncated to an unexpected │ │ │ │ │ -direction │ │ │ │ │ -347 if(T(lower) > val) lower--; // now val-lower < 1 │ │ │ │ │ -348 // check whether lower + 1 is approximately val │ │ │ │ │ -349 if(eq(T(lower+1), val, epsilon)) │ │ │ │ │ -350 return lower+1; │ │ │ │ │ -351 else return lower; │ │ │ │ │ -352 } │ │ │ │ │ -353 }; │ │ │ │ │ -354 template │ │ │ │ │ -355 struct trunc_t { │ │ │ │ │ -356 static I │ │ │ │ │ -357 _t_r_u_n_c(const T &val, │ │ │ │ │ -358 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -359 I upper = trunc_t::trunc(val, epsilon); │ │ │ │ │ -360 if(ne(T(upper), val, epsilon)) ++upper; │ │ │ │ │ -361 return upper; │ │ │ │ │ -362 } │ │ │ │ │ -363 }; │ │ │ │ │ -364 template │ │ │ │ │ -365 struct trunc_t { │ │ │ │ │ -366 static I │ │ │ │ │ -367 _t_r_u_n_c(const T &val, │ │ │ │ │ -368 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -369 if(val > T(0)) return trunc_t::trunc(val, epsilon); │ │ │ │ │ -370 else return trunc_t::trunc(val, epsilon); │ │ │ │ │ -371 } │ │ │ │ │ -372 }; │ │ │ │ │ -373 template │ │ │ │ │ -374 struct trunc_t { │ │ │ │ │ -375 static I │ │ │ │ │ -376 _t_r_u_n_c(const T &val, │ │ │ │ │ -377 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -378 if(val > T(0)) return trunc_t::trunc(val, epsilon); │ │ │ │ │ -379 else return trunc_t::trunc(val, epsilon); │ │ │ │ │ -380 } │ │ │ │ │ -381 }; │ │ │ │ │ -382 template │ │ │ │ │ -383 struct trunc_t<_s_t_d::vector, std::vector, cstyle, rstyle> { │ │ │ │ │ -384 static std::vector │ │ │ │ │ -385 _t_r_u_n_c(const std::vector &val, │ │ │ │ │ -386 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -387 unsigned int size = val.size(); │ │ │ │ │ -388 std::vector res(size); │ │ │ │ │ -389 for(unsigned int i = 0; i < size; ++i) │ │ │ │ │ -390 res[i] = trunc_t::trunc(val[i], epsilon); │ │ │ │ │ -391 return res; │ │ │ │ │ -392 } │ │ │ │ │ -393 }; │ │ │ │ │ -394 template │ │ │ │ │ -395 struct trunc_t<_D_u_n_e::FieldVector, _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r, cstyle, │ │ │ │ │ -rstyle> { │ │ │ │ │ -396 static _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_I_,_ _n_> │ │ │ │ │ -397 _t_r_u_n_c(const _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _n_> &val, │ │ │ │ │ -398 typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = (_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e │ │ │ │ │ -())) { │ │ │ │ │ -399 _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_I_,_ _n_> res; │ │ │ │ │ -400 for(int i = 0; i < n; ++i) │ │ │ │ │ -401 res[i] = trunc_t::trunc(val[i], epsilon); │ │ │ │ │ -402 return res; │ │ │ │ │ -403 } │ │ │ │ │ -404 }; │ │ │ │ │ -405 } // namespace Impl │ │ │ │ │ -406 template │ │ │ │ │ -_4_0_7 I _t_r_u_n_c(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon /*= │ │ │ │ │ -DefaultEpsilon::value()*/) │ │ │ │ │ -408 { │ │ │ │ │ -409 return Impl::trunc_t::trunc(val, epsilon); │ │ │ │ │ -410 } │ │ │ │ │ -411 template │ │ │ │ │ -_4_1_2 I _t_r_u_n_c(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _c_s_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -413 { │ │ │ │ │ -414 return trunc(val, epsilon); │ │ │ │ │ -415 } │ │ │ │ │ -416 template │ │ │ │ │ -417 I _t_r_u_n_c(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -418 { │ │ │ │ │ -419 return trunc(val, epsilon); │ │ │ │ │ -420 } │ │ │ │ │ -421 template │ │ │ │ │ -_4_2_2 I _t_r_u_n_c(const T &val, typename _E_p_s_i_l_o_n_T_y_p_e_<_T_>_:_:_T_y_p_e epsilon = │ │ │ │ │ -_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_T_,_ _d_e_f_a_u_l_t_C_m_p_S_t_y_l_e_>_:_:_v_a_l_u_e()) │ │ │ │ │ -423 { │ │ │ │ │ -424 return trunc(val, epsilon); │ │ │ │ │ -425 } │ │ │ │ │ -426 } //namespace Dune │ │ │ │ │ -427 │ │ │ │ │ -428 // oo interface │ │ │ │ │ -429 template │ │ │ │ │ -_4_3_0 _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -431_ _F_l_o_a_t_C_m_p_O_p_s(_E_p_s_i_l_o_n_T_y_p_e epsilon) : epsilon_(epsilon) {} │ │ │ │ │ -432 │ │ │ │ │ -433 │ │ │ │ │ -434 template │ │ │ │ │ -435 typename _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_:_E_p_s_i_l_o_n_T_y_p_e │ │ │ │ │ -_4_3_6 _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_:_e_p_s_i_l_o_n() const │ │ │ │ │ -437 { │ │ │ │ │ -438 return epsilon_; │ │ │ │ │ -439 } │ │ │ │ │ -440 │ │ │ │ │ -441 template │ │ │ │ │ -442 void │ │ │ │ │ -_4_4_3 _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_:_e_p_s_i_l_o_n(_E_p_s_i_l_o_n_T_y_p_e epsilon__) │ │ │ │ │ -444 { │ │ │ │ │ -445 epsilon_ = epsilon__; │ │ │ │ │ -446 } │ │ │ │ │ -447 │ │ │ │ │ -448 │ │ │ │ │ -449 template │ │ │ │ │ -_4_5_0 bool _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -451_ _e_q(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const │ │ │ │ │ -452 { │ │ │ │ │ -453 return Dune::FloatCmp::eq(first, second, epsilon_); │ │ │ │ │ -454 } │ │ │ │ │ -455 │ │ │ │ │ -456 template │ │ │ │ │ -_4_5_7 bool _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -458_ _n_e(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const │ │ │ │ │ -459 { │ │ │ │ │ -460 return Dune::FloatCmp::ne(first, second, epsilon_); │ │ │ │ │ -461 } │ │ │ │ │ -462 │ │ │ │ │ -463 template │ │ │ │ │ -_4_6_4 bool _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -465_ _g_t(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const │ │ │ │ │ -466 { │ │ │ │ │ -467 return Dune::FloatCmp::gt(first, second, epsilon_); │ │ │ │ │ -468 } │ │ │ │ │ -469 │ │ │ │ │ -470 template │ │ │ │ │ -_4_7_1 bool _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -472_ _l_t(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const │ │ │ │ │ -473 { │ │ │ │ │ -474 return Dune::FloatCmp::lt(first, second, epsilon_); │ │ │ │ │ -475 } │ │ │ │ │ -476 │ │ │ │ │ -477 template │ │ │ │ │ -_4_7_8 bool _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -479_ _g_e(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const │ │ │ │ │ -480 { │ │ │ │ │ -481 return Dune::FloatCmp::ge(first, second, epsilon_); │ │ │ │ │ -482 } │ │ │ │ │ -483 │ │ │ │ │ -484 template │ │ │ │ │ -_4_8_5 bool _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -486_ _l_e(const _V_a_l_u_e_T_y_p_e &first, const _V_a_l_u_e_T_y_p_e &second) const │ │ │ │ │ -487 { │ │ │ │ │ -488 return Dune::FloatCmp::le(first, second, epsilon_); │ │ │ │ │ -489 } │ │ │ │ │ -490 │ │ │ │ │ -491 │ │ │ │ │ -492 template │ │ │ │ │ -493 template │ │ │ │ │ -_4_9_4 I _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -495_ _r_o_u_n_d(const _V_a_l_u_e_T_y_p_e &val) const │ │ │ │ │ -496 { │ │ │ │ │ -497 return Dune::FloatCmp::round(val, epsilon_); │ │ │ │ │ -498 } │ │ │ │ │ -499 │ │ │ │ │ -500 template │ │ │ │ │ -501 template │ │ │ │ │ -_5_0_2 I _F_l_o_a_t_C_m_p_O_p_s_<_T_,_ _c_s_t_y_l_e___,_ _r_s_t_y_l_e___>_:_: │ │ │ │ │ -503_ _t_r_u_n_c(const _V_a_l_u_e_T_y_p_e &val) const │ │ │ │ │ -504 { │ │ │ │ │ -505 return Dune::FloatCmp::trunc(val, epsilon_); │ │ │ │ │ -506 } │ │ │ │ │ -507 │ │ │ │ │ -508} //namespace Dune │ │ │ │ │ -_f_l_o_a_t___c_m_p_._h_h │ │ │ │ │ -Various ways to compare floating-point numbers. │ │ │ │ │ -_f_v_e_c_t_o_r_._h_h │ │ │ │ │ -Implements a vector constructed from a given type representing a field and a │ │ │ │ │ -compile-time given size. │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_n_e │ │ │ │ │ -bool ne(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test for inequality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:151 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_e_q │ │ │ │ │ -bool eq(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test for equality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:144 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_o_u_n_d │ │ │ │ │ -I round(const T &val, typename EpsilonType< T >::Type epsilon) │ │ │ │ │ -round using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:311 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_r_u_n_c │ │ │ │ │ -I trunc(const T &val, typename EpsilonType< T >::Type epsilon) │ │ │ │ │ -truncate using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:407 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_t │ │ │ │ │ -bool lt(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first lesser than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:165 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_t │ │ │ │ │ -bool gt(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first greater than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:158 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_g_e │ │ │ │ │ -bool ge(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first greater or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:172 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_l_e │ │ │ │ │ -bool le(const T &first, const T &second, typename EpsilonType< T >::Type │ │ │ │ │ -epsilon) │ │ │ │ │ -test if first lesser or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:179 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_e_l_a_t_i_v_e_S_t_r_o_n_g │ │ │ │ │ -@ relativeStrong │ │ │ │ │ -|a-b|/|a| <= epsilon && |a-b|/|b| <= epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:108 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_r_e_l_a_t_i_v_e_W_e_a_k │ │ │ │ │ -@ relativeWeak │ │ │ │ │ -|a-b|/|a| <= epsilon || |a-b|/|b| <= epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_a_b_s_o_l_u_t_e │ │ │ │ │ -@ absolute │ │ │ │ │ -|a-b| <= epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_o_w_a_r_d_Z_e_r_o │ │ │ │ │ -@ towardZero │ │ │ │ │ -always round toward 0 │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_t_o_w_a_r_d_I_n_f │ │ │ │ │ -@ towardInf │ │ │ │ │ -always round away from 0 │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_u_p_w_a_r_d │ │ │ │ │ -@ upward │ │ │ │ │ -round toward │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:124 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_d_o_w_n_w_a_r_d │ │ │ │ │ -@ downward │ │ │ │ │ -round toward │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:122 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +51 template │ │ │ │ │ +_5_2 inline Stream& _o_p_e_r_a_t_o_r_<_<(Stream& stream, const std::array& a) │ │ │ │ │ +53 { │ │ │ │ │ +54 stream<<"["; │ │ │ │ │ +55 if(N>0) │ │ │ │ │ +56 { │ │ │ │ │ +57 for(std::size_t i=0; i_> │ │ │ │ │ +Stream & operator>>(Stream &stream, std::tuple< Ts... > &t) │ │ │ │ │ +Read a std::tuple. │ │ │ │ │ +DDeeffiinniittiioonn streamoperators.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_f_o_r_E_a_c_h │ │ │ │ │ +constexpr void forEach(Range &&range, F &&f) │ │ │ │ │ +Range based for loop. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:268 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -vector space out of a tensor product of fields. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e │ │ │ │ │ -Mapping of value type to epsilon type. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:23 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_:_:_T_y_p_e │ │ │ │ │ -T Type │ │ │ │ │ -The epsilon type corresponding to value type T. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:25 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_T_y_p_e │ │ │ │ │ -EpsilonType< T >::Type Type │ │ │ │ │ -The epsilon type corresponding to value type std::vector │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:36 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_E_p_s_i_l_o_n_T_y_p_e_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _n_ _>_ _>_:_:_T_y_p_e │ │ │ │ │ -EpsilonType< T >::Type Type │ │ │ │ │ -The epsilon type corresponding to value type Dune::FieldVector │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:47 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_ _T_,_ _r_e_l_a_t_i_v_e_W_e_a_k_ _>_:_:_v_a_l_u_e │ │ │ │ │ -static EpsilonType< T >::Type value() │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:53 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_ _T_,_ _r_e_l_a_t_i_v_e_S_t_r_o_n_g_ _>_:_:_v_a_l_u_e │ │ │ │ │ -static EpsilonType< T >::Type value() │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:58 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_<_ _T_,_ _a_b_s_o_l_u_t_e_ _>_:_:_v_a_l_u_e │ │ │ │ │ -static EpsilonType< T >::Type value() │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:63 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n │ │ │ │ │ -mapping from a value type and a compare style to a default epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:138 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_:_:_D_e_f_a_u_l_t_E_p_s_i_l_o_n_:_:_v_a_l_u_e │ │ │ │ │ -static EpsilonType< T >::Type value() │ │ │ │ │ -Returns the default epsilon for the given value type and compare style. │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_l_e │ │ │ │ │ -bool le(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first lesser or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:486 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_F_l_o_a_t_C_m_p_O_p_s │ │ │ │ │ -FloatCmpOps(EpsilonType epsilon=DefaultEpsilon::value()) │ │ │ │ │ -construct an operations object │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:431 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_e_q │ │ │ │ │ -bool eq(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test for equality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:451 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_l_t │ │ │ │ │ -bool lt(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first lesser than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:472 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_g_e │ │ │ │ │ -bool ge(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first greater or equal second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:479 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_E_p_s_i_l_o_n_T_y_p_e │ │ │ │ │ -FloatCmp::EpsilonType< T >::Type EpsilonType │ │ │ │ │ -Type of the epsilon. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:304 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_n_e │ │ │ │ │ -bool ne(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test for inequality using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:458 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -T ValueType │ │ │ │ │ -Type of the values to compare. │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_e_p_s_i_l_o_n │ │ │ │ │ -EpsilonType epsilon() const │ │ │ │ │ -return the current epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:436 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_r_o_u_n_d │ │ │ │ │ -I round(const ValueType &val) const │ │ │ │ │ -round using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:495 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_t_r_u_n_c │ │ │ │ │ -I trunc(const ValueType &val) const │ │ │ │ │ -truncate using epsilon │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:503 │ │ │ │ │ -_D_u_n_e_:_:_F_l_o_a_t_C_m_p_O_p_s_:_:_g_t │ │ │ │ │ -bool gt(const ValueType &first, const ValueType &second) const │ │ │ │ │ -test if first greater than second │ │ │ │ │ -DDeeffiinniittiioonn float_cmp.cc:465 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00173.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: reservedvector.hh File Reference │ │ │ │ +dune-common: ftraits.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,71 +71,47 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Macros
    │ │ │ │ -
    reservedvector.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ +
    ftraits.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    An stl-compliant random-access container which stores everything on the stack. │ │ │ │ +

    Type traits to determine the type of reals (when working with complex numbers) │ │ │ │ More...

    │ │ │ │ -
    #include <algorithm>
    │ │ │ │ -#include <array>
    │ │ │ │ -#include <cassert>
    │ │ │ │ -#include <iostream>
    │ │ │ │ -#include <iterator>
    │ │ │ │ -#include <cstddef>
    │ │ │ │ -#include <initializer_list>
    │ │ │ │ -#include <dune/common/hash.hh>
    │ │ │ │ +
    #include <complex>
    │ │ │ │ +#include <vector>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::ReservedVector< T, n >
     A Vector class with statically reserved memory. More...
    struct  Dune::FieldTraits< T >
     
    struct  Dune::FieldTraits< const T >
     
    struct  Dune::FieldTraits< std::complex< T > >
     
    struct  Dune::FieldTraits< T[N] >
     
    struct  Dune::FieldTraits< std::vector< T > >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

    │ │ │ │ Namespaces

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

    │ │ │ │ -Macros

    #define CHECKSIZE(X)   {}
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    An stl-compliant random-access container which stores everything on the stack.

    │ │ │ │ -

    Macro Definition Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ CHECKSIZE

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    #define CHECKSIZE( X)   {}
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ +

    Type traits to determine the type of reals (when working with complex numbers)

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +1,32 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ │ -reservedvector.hh File Reference │ │ │ │ │ -An stl-compliant random-access container which stores everything on the stack. │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +ftraits.hh File Reference │ │ │ │ │ +Type traits to determine the type of reals (when working with complex numbers) │ │ │ │ │ _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_a_s_h_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_<_ _T_,_ _n_ _> │ │ │ │ │ -  A Vector class with statically reserved memory. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _T_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _T_[_N_]_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _T_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _C_H_E_C_K_S_I_Z_E(X)   {} │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -An stl-compliant random-access container which stores everything on the stack. │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? CCHHEECCKKSSIIZZEE ********** │ │ │ │ │ -#define CHECKSIZE (   X )    {} │ │ │ │ │ +Type traits to determine the type of reals (when working with complex numbers) │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00173_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: reservedvector.hh Source File │ │ │ │ +dune-common: ftraits.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,528 +74,90 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    reservedvector.hh
    │ │ │ │ +
    ftraits.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_RESERVEDVECTOR_HH
    │ │ │ │ -
    6#define DUNE_COMMON_RESERVEDVECTOR_HH
    │ │ │ │ +
    5#ifndef DUNE_FTRAITS_HH
    │ │ │ │ +
    6#define DUNE_FTRAITS_HH
    │ │ │ │
    7
    │ │ │ │ -
    12#include <algorithm>
    │ │ │ │ -
    13#include <array>
    │ │ │ │ -
    14#include <cassert>
    │ │ │ │ -
    15#include <iostream>
    │ │ │ │ -
    16#include <iterator>
    │ │ │ │ -
    17#include <cstddef>
    │ │ │ │ -
    18#include <initializer_list>
    │ │ │ │ -
    19
    │ │ │ │ -
    20#include <dune/common/hash.hh>
    │ │ │ │ -
    21
    │ │ │ │ -
    22#ifdef CHECK_RESERVEDVECTOR
    │ │ │ │ -
    23#define CHECKSIZE(X) assert(X)
    │ │ │ │ -
    24#else
    │ │ │ │ -
    25#define CHECKSIZE(X) {}
    │ │ │ │ -
    26#endif
    │ │ │ │ -
    27
    │ │ │ │ -
    28namespace Dune
    │ │ │ │ -
    29{
    │ │ │ │ -
    45 template<class T, int n>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    47 {
    │ │ │ │ -
    48 using storage_type = std::array<T,n>;
    │ │ │ │ -
    49
    │ │ │ │ -
    50 public:
    │ │ │ │ -
    51
    │ │ │ │ -
    55 typedef typename storage_type::value_type value_type;
    │ │ │ │ -
    57 typedef typename storage_type::pointer pointer;
    │ │ │ │ -
    59 typedef typename storage_type::const_pointer const_pointer;
    │ │ │ │ -
    61 typedef typename storage_type::reference reference;
    │ │ │ │ -
    63 typedef typename storage_type::const_reference const_reference;
    │ │ │ │ -
    65 typedef typename storage_type::size_type size_type;
    │ │ │ │ -
    67 typedef typename storage_type::difference_type difference_type;
    │ │ │ │ -
    69 typedef typename storage_type::iterator iterator;
    │ │ │ │ -
    71 typedef typename storage_type::const_iterator const_iterator;
    │ │ │ │ -
    73 typedef std::reverse_iterator<iterator> reverse_iterator;
    │ │ │ │ -
    75 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
    │ │ │ │ -
    76
    │ │ │ │ -
    │ │ │ │ -
    82 constexpr ReservedVector()
    │ │ │ │ -
    83 noexcept(std::is_nothrow_default_constructible_v<value_type>)
    │ │ │ │ -
    84 : storage_()
    │ │ │ │ -
    85 , size_(0)
    │ │ │ │ -
    86 {}
    │ │ │ │ -
    │ │ │ │ -
    87
    │ │ │ │ -
    │ │ │ │ -
    89 explicit constexpr ReservedVector(size_type count)
    │ │ │ │ -
    90 noexcept(std::is_nothrow_default_constructible_v<value_type>)
    │ │ │ │ -
    91 : storage_()
    │ │ │ │ -
    92 , size_(count)
    │ │ │ │ -
    93 {
    │ │ │ │ -
    94 assert(count <= n);
    │ │ │ │ -
    95 }
    │ │ │ │ -
    │ │ │ │ -
    96
    │ │ │ │ -
    │ │ │ │ -
    98 constexpr ReservedVector(size_type count, const value_type& value)
    │ │ │ │ -
    99 noexcept(std::is_nothrow_copy_assignable_v<value_type> &&
    │ │ │ │ -
    100 noexcept(ReservedVector(count)))
    │ │ │ │ -
    101 : ReservedVector(count)
    │ │ │ │ -
    102 {
    │ │ │ │ -
    103 for (size_type i=0; i<count; ++i)
    │ │ │ │ -
    104 storage_[i] = value;
    │ │ │ │ -
    105 }
    │ │ │ │ -
    │ │ │ │ -
    106
    │ │ │ │ -
    108 template<class InputIt,
    │ │ │ │ -
    109 std::enable_if_t<std::is_convertible_v<typename std::iterator_traits<InputIt>::value_type, value_type>, int> = 0>
    │ │ │ │ -
    │ │ │ │ -
    110 constexpr ReservedVector(InputIt first, InputIt last)
    │ │ │ │ -
    111 noexcept(std::is_nothrow_copy_assignable_v<value_type> &&
    │ │ │ │ -
    112 noexcept(ReservedVector()))
    │ │ │ │ - │ │ │ │ -
    114 {
    │ │ │ │ -
    115 for (size_type i=0; i<n && first!=last; ++i,++size_)
    │ │ │ │ -
    116 storage_[i] = *first++;
    │ │ │ │ -
    117 assert(first == last);
    │ │ │ │ -
    118 }
    │ │ │ │ -
    │ │ │ │ -
    119
    │ │ │ │ -
    │ │ │ │ -
    121 constexpr ReservedVector(std::initializer_list<value_type> const& l)
    │ │ │ │ -
    122 noexcept(std::is_nothrow_copy_assignable_v<value_type> &&
    │ │ │ │ -
    123 noexcept(ReservedVector(l.begin(),l.end())))
    │ │ │ │ -
    124 : ReservedVector(l.begin(),l.end())
    │ │ │ │ -
    125 {}
    │ │ │ │ -
    │ │ │ │ -
    126
    │ │ │ │ -
    │ │ │ │ -
    132 constexpr bool operator== (const ReservedVector& that) const noexcept
    │ │ │ │ -
    133 {
    │ │ │ │ -
    134 if (size() != that.size())
    │ │ │ │ -
    135 return false;
    │ │ │ │ -
    136 for (size_type i=0; i<size(); ++i)
    │ │ │ │ -
    137 if (!(storage_[i]==that.storage_[i]))
    │ │ │ │ -
    138 return false;
    │ │ │ │ -
    139 return true;
    │ │ │ │ -
    140 }
    │ │ │ │ -
    │ │ │ │ -
    141
    │ │ │ │ -
    │ │ │ │ -
    143 constexpr bool operator!= (const ReservedVector& that) const noexcept
    │ │ │ │ -
    144 {
    │ │ │ │ -
    145 return !(*this == that);
    │ │ │ │ -
    146 }
    │ │ │ │ -
    │ │ │ │ -
    147
    │ │ │ │ -
    │ │ │ │ -
    149 constexpr bool operator< (const ReservedVector& that) const noexcept
    │ │ │ │ -
    150 {
    │ │ │ │ -
    151 for (size_type i=0; i<std::min(size(),that.size()); ++i) {
    │ │ │ │ -
    152 if (storage_[i] < that.storage_[i]) return true;
    │ │ │ │ -
    153 if (that.storage_[i] < storage_[i]) return false;
    │ │ │ │ -
    154 }
    │ │ │ │ -
    155 return size() < that.size();
    │ │ │ │ -
    156 }
    │ │ │ │ -
    │ │ │ │ -
    157
    │ │ │ │ -
    │ │ │ │ -
    159 constexpr bool operator> (const ReservedVector& that) const noexcept
    │ │ │ │ -
    160 {
    │ │ │ │ -
    161 return that < *this;
    │ │ │ │ -
    162 }
    │ │ │ │ -
    │ │ │ │ -
    163
    │ │ │ │ -
    │ │ │ │ -
    165 constexpr bool operator<= (const ReservedVector& that) const noexcept
    │ │ │ │ -
    166 {
    │ │ │ │ -
    167 return !(*this > that);
    │ │ │ │ -
    168 }
    │ │ │ │ -
    │ │ │ │ -
    169
    │ │ │ │ -
    │ │ │ │ -
    171 constexpr bool operator>= (const ReservedVector& that) const noexcept
    │ │ │ │ -
    172 {
    │ │ │ │ -
    173 return !(*this < that);
    │ │ │ │ -
    174 }
    │ │ │ │ -
    │ │ │ │ -
    175
    │ │ │ │ -
    │ │ │ │ -
    181 constexpr void clear() noexcept
    │ │ │ │ -
    182 {
    │ │ │ │ -
    183 size_ = 0;
    │ │ │ │ -
    184 }
    │ │ │ │ -
    │ │ │ │ -
    185
    │ │ │ │ -
    │ │ │ │ -
    187 constexpr void resize(size_type s) noexcept
    │ │ │ │ -
    188 {
    │ │ │ │ -
    189 CHECKSIZE(s<=n);
    │ │ │ │ -
    190 size_ = s;
    │ │ │ │ -
    191 }
    │ │ │ │ -
    │ │ │ │ -
    192
    │ │ │ │ -
    │ │ │ │ -
    194 constexpr void push_back(const value_type& t)
    │ │ │ │ -
    195 noexcept(std::is_nothrow_copy_assignable_v<value_type>)
    │ │ │ │ -
    196 {
    │ │ │ │ -
    197 CHECKSIZE(size_<n);
    │ │ │ │ -
    198 storage_[size_++] = t;
    │ │ │ │ -
    199 }
    │ │ │ │ -
    │ │ │ │ -
    200
    │ │ │ │ -
    │ │ │ │ -
    202 constexpr void push_back(value_type&& t)
    │ │ │ │ -
    203 noexcept(std::is_nothrow_move_assignable_v<value_type>)
    │ │ │ │ -
    204 {
    │ │ │ │ -
    205 CHECKSIZE(size_<n);
    │ │ │ │ -
    206 storage_[size_++] = std::move(t);
    │ │ │ │ -
    207 }
    │ │ │ │ -
    │ │ │ │ -
    208
    │ │ │ │ -
    210 template<class... Args>
    │ │ │ │ -
    │ │ │ │ -
    211 reference emplace_back(Args&&... args)
    │ │ │ │ -
    212 noexcept(std::is_nothrow_constructible_v<value_type,decltype(args)...>)
    │ │ │ │ -
    213 {
    │ │ │ │ -
    214 CHECKSIZE(size_<n);
    │ │ │ │ -
    215 value_type* p = &storage_[size_++];
    │ │ │ │ -
    216 // first destroy any previously (default) constructed element at that location
    │ │ │ │ -
    217 p->~value_type();
    │ │ │ │ -
    218 // construct the value_type in place
    │ │ │ │ -
    219 // NOTE: This is not an integral constant expression.
    │ │ │ │ -
    220 // With c++20 we could use std::construct_at
    │ │ │ │ -
    221 ::new (const_cast<void*>(static_cast<const volatile void*>(p)))
    │ │ │ │ -
    222 value_type(std::forward<Args>(args)...);
    │ │ │ │ -
    223 return *p;
    │ │ │ │ -
    224 }
    │ │ │ │ -
    │ │ │ │ -
    225
    │ │ │ │ -
    │ │ │ │ -
    227 constexpr void pop_back() noexcept
    │ │ │ │ -
    228 {
    │ │ │ │ -
    229 if (! empty()) size_--;
    │ │ │ │ -
    230 }
    │ │ │ │ -
    │ │ │ │ -
    231
    │ │ │ │ -
    │ │ │ │ -
    237 constexpr iterator begin() noexcept
    │ │ │ │ -
    238 {
    │ │ │ │ -
    239 return storage_.begin();
    │ │ │ │ -
    240 }
    │ │ │ │ -
    │ │ │ │ -
    241
    │ │ │ │ -
    │ │ │ │ -
    243 constexpr const_iterator begin() const noexcept
    │ │ │ │ -
    244 {
    │ │ │ │ -
    245 return storage_.begin();
    │ │ │ │ -
    246 }
    │ │ │ │ -
    │ │ │ │ -
    247
    │ │ │ │ -
    │ │ │ │ -
    249 constexpr const_iterator cbegin() const noexcept
    │ │ │ │ -
    250 {
    │ │ │ │ -
    251 return storage_.cbegin();
    │ │ │ │ -
    252 }
    │ │ │ │ -
    │ │ │ │ -
    253
    │ │ │ │ -
    │ │ │ │ -
    255 constexpr reverse_iterator rbegin() noexcept
    │ │ │ │ -
    256 {
    │ │ │ │ -
    257 return reverse_iterator{begin()+size()};
    │ │ │ │ -
    258 }
    │ │ │ │ -
    │ │ │ │ -
    259
    │ │ │ │ -
    │ │ │ │ -
    261 constexpr const_reverse_iterator rbegin() const noexcept
    │ │ │ │ -
    262 {
    │ │ │ │ - │ │ │ │ -
    264 }
    │ │ │ │ -
    │ │ │ │ -
    265
    │ │ │ │ -
    │ │ │ │ -
    267 constexpr const_reverse_iterator crbegin() const noexcept
    │ │ │ │ -
    268 {
    │ │ │ │ - │ │ │ │ -
    270 }
    │ │ │ │ -
    │ │ │ │ -
    271
    │ │ │ │ -
    │ │ │ │ -
    273 constexpr iterator end() noexcept
    │ │ │ │ -
    274 {
    │ │ │ │ -
    275 return storage_.begin()+size();
    │ │ │ │ -
    276 }
    │ │ │ │ -
    │ │ │ │ -
    277
    │ │ │ │ -
    │ │ │ │ -
    279 constexpr const_iterator end() const noexcept
    │ │ │ │ -
    280 {
    │ │ │ │ -
    281 return storage_.begin()+size();
    │ │ │ │ -
    282 }
    │ │ │ │ -
    │ │ │ │ -
    283
    │ │ │ │ -
    │ │ │ │ -
    285 constexpr const_iterator cend() const noexcept
    │ │ │ │ -
    286 {
    │ │ │ │ -
    287 return storage_.cbegin()+size();
    │ │ │ │ -
    288 }
    │ │ │ │ -
    │ │ │ │ -
    289
    │ │ │ │ -
    │ │ │ │ -
    291 constexpr reverse_iterator rend() noexcept
    │ │ │ │ -
    292 {
    │ │ │ │ -
    293 return reverse_iterator{begin()};
    │ │ │ │ -
    294 }
    │ │ │ │ -
    │ │ │ │ -
    295
    │ │ │ │ -
    │ │ │ │ -
    297 constexpr const_reverse_iterator rend() const noexcept
    │ │ │ │ -
    298 {
    │ │ │ │ - │ │ │ │ -
    300 }
    │ │ │ │ -
    │ │ │ │ -
    301
    │ │ │ │ -
    │ │ │ │ -
    303 constexpr const_reverse_iterator crend() const noexcept
    │ │ │ │ -
    304 {
    │ │ │ │ - │ │ │ │ -
    306 }
    │ │ │ │ -
    │ │ │ │ -
    307
    │ │ │ │ -
    │ │ │ │ -
    313 constexpr reference at(size_type i)
    │ │ │ │ -
    314 {
    │ │ │ │ -
    315 if (!(i < size()))
    │ │ │ │ -
    316 throw std::out_of_range("Index out of range");
    │ │ │ │ -
    317 return storage_[i];
    │ │ │ │ -
    318 }
    │ │ │ │ -
    │ │ │ │ -
    319
    │ │ │ │ -
    │ │ │ │ -
    321 constexpr const_reference at(size_type i) const
    │ │ │ │ -
    322 {
    │ │ │ │ -
    323 if (!(i < size()))
    │ │ │ │ -
    324 throw std::out_of_range("Index out of range");
    │ │ │ │ -
    325 return storage_[i];
    │ │ │ │ -
    326 }
    │ │ │ │ -
    │ │ │ │ -
    327
    │ │ │ │ -
    │ │ │ │ -
    329 constexpr reference operator[] (size_type i) noexcept
    │ │ │ │ -
    330 {
    │ │ │ │ -
    331 CHECKSIZE(size_>i);
    │ │ │ │ -
    332 return storage_[i];
    │ │ │ │ -
    333 }
    │ │ │ │ -
    │ │ │ │ -
    334
    │ │ │ │ -
    │ │ │ │ -
    336 constexpr const_reference operator[] (size_type i) const noexcept
    │ │ │ │ -
    337 {
    │ │ │ │ -
    338 CHECKSIZE(size_>i);
    │ │ │ │ -
    339 return storage_[i];
    │ │ │ │ -
    340 }
    │ │ │ │ -
    │ │ │ │ -
    341
    │ │ │ │ -
    │ │ │ │ -
    343 constexpr reference front() noexcept
    │ │ │ │ -
    344 {
    │ │ │ │ -
    345 CHECKSIZE(size_>0);
    │ │ │ │ -
    346 return storage_[0];
    │ │ │ │ -
    347 }
    │ │ │ │ -
    │ │ │ │ -
    348
    │ │ │ │ -
    │ │ │ │ -
    350 constexpr const_reference front() const noexcept
    │ │ │ │ -
    351 {
    │ │ │ │ -
    352 CHECKSIZE(size_>0);
    │ │ │ │ -
    353 return storage_[0];
    │ │ │ │ -
    354 }
    │ │ │ │ -
    │ │ │ │ -
    355
    │ │ │ │ -
    │ │ │ │ -
    357 constexpr reference back() noexcept
    │ │ │ │ -
    358 {
    │ │ │ │ -
    359 CHECKSIZE(size_>0);
    │ │ │ │ -
    360 return storage_[size_-1];
    │ │ │ │ -
    361 }
    │ │ │ │ -
    │ │ │ │ -
    362
    │ │ │ │ -
    │ │ │ │ -
    364 constexpr const_reference back() const noexcept
    │ │ │ │ -
    365 {
    │ │ │ │ -
    366 CHECKSIZE(size_>0);
    │ │ │ │ -
    367 return storage_[size_-1];
    │ │ │ │ -
    368 }
    │ │ │ │ -
    │ │ │ │ -
    369
    │ │ │ │ -
    │ │ │ │ -
    371 constexpr pointer data() noexcept
    │ │ │ │ -
    372 {
    │ │ │ │ -
    373 return storage_.data();
    │ │ │ │ -
    374 }
    │ │ │ │ -
    │ │ │ │ -
    375
    │ │ │ │ -
    │ │ │ │ -
    377 constexpr const_pointer data() const noexcept
    │ │ │ │ -
    378 {
    │ │ │ │ -
    379 return storage_.data();
    │ │ │ │ -
    380 }
    │ │ │ │ -
    │ │ │ │ -
    381
    │ │ │ │ -
    │ │ │ │ -
    387 constexpr size_type size() const noexcept
    │ │ │ │ -
    388 {
    │ │ │ │ -
    389 return size_;
    │ │ │ │ -
    390 }
    │ │ │ │ -
    │ │ │ │ -
    391
    │ │ │ │ -
    │ │ │ │ -
    393 constexpr bool empty() const noexcept
    │ │ │ │ -
    394 {
    │ │ │ │ -
    395 return size_==0;
    │ │ │ │ -
    396 }
    │ │ │ │ -
    │ │ │ │ -
    397
    │ │ │ │ -
    │ │ │ │ -
    399 static constexpr size_type capacity() noexcept
    │ │ │ │ -
    400 {
    │ │ │ │ -
    401 return n;
    │ │ │ │ -
    402 }
    │ │ │ │ -
    │ │ │ │ -
    403
    │ │ │ │ -
    │ │ │ │ -
    405 static constexpr size_type max_size() noexcept
    │ │ │ │ -
    406 {
    │ │ │ │ -
    407 return n;
    │ │ │ │ -
    408 }
    │ │ │ │ -
    │ │ │ │ -
    409
    │ │ │ │ -
    │ │ │ │ -
    415 constexpr void fill(const value_type& value)
    │ │ │ │ -
    416 noexcept(std::is_nothrow_copy_assignable_v<value_type>)
    │ │ │ │ -
    417 {
    │ │ │ │ -
    418 for (size_type i=0; i<size(); ++i)
    │ │ │ │ -
    419 storage_[i] = value;
    │ │ │ │ -
    420 }
    │ │ │ │ -
    │ │ │ │ -
    421
    │ │ │ │ -
    │ │ │ │ -
    423 void swap(ReservedVector& other)
    │ │ │ │ -
    424 noexcept(std::is_nothrow_swappable_v<value_type>)
    │ │ │ │ -
    425 {
    │ │ │ │ -
    426 using std::swap;
    │ │ │ │ -
    427 swap(storage_, other.storage_);
    │ │ │ │ -
    428 swap(size_, other.size_);
    │ │ │ │ -
    429 }
    │ │ │ │ -
    │ │ │ │ -
    430
    │ │ │ │ -
    │ │ │ │ -
    434 friend std::ostream& operator<< (std::ostream& s, const ReservedVector& v)
    │ │ │ │ -
    435 {
    │ │ │ │ -
    436 for (size_type i=0; i<v.size(); i++)
    │ │ │ │ -
    437 s << v[i] << " ";
    │ │ │ │ -
    438 return s;
    │ │ │ │ -
    439 }
    │ │ │ │ -
    │ │ │ │ -
    440
    │ │ │ │ -
    │ │ │ │ -
    441 inline friend std::size_t hash_value(const ReservedVector& v) noexcept
    │ │ │ │ -
    442 {
    │ │ │ │ -
    443 return hash_range(v.storage_.data(),v.storage_.data()+v.size_);
    │ │ │ │ -
    444 }
    │ │ │ │ -
    │ │ │ │ -
    445
    │ │ │ │ -
    446 private:
    │ │ │ │ -
    447 storage_type storage_;
    │ │ │ │ -
    448 size_type size_;
    │ │ │ │ -
    449 };
    │ │ │ │ -
    │ │ │ │ -
    450
    │ │ │ │ -
    451}
    │ │ │ │ -
    452
    │ │ │ │ - │ │ │ │ -
    454
    │ │ │ │ -
    455#undef CHECKSIZE
    │ │ │ │ -
    456
    │ │ │ │ -
    457#endif // DUNE_COMMON_RESERVEDVECTOR_HH
    │ │ │ │ -
    Support for calculating hash values of objects.
    │ │ │ │ -
    #define DUNE_DEFINE_HASH(template_args, type)
    Defines the required struct specialization to make type hashable via Dune::hash.
    Definition hash.hh:100
    │ │ │ │ -
    #define DUNE_HASH_TYPE(...)
    Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.
    Definition hash.hh:117
    │ │ │ │ -
    #define DUNE_HASH_TEMPLATE_ARGS(...)
    Wrapper macro for the template arguments in DUNE_DEFINE_HASH.
    Definition hash.hh:109
    │ │ │ │ -
    #define CHECKSIZE(X)
    Definition reservedvector.hh:25
    │ │ │ │ +
    12#include <complex>
    │ │ │ │ +
    13#include <vector>
    │ │ │ │ +
    14
    │ │ │ │ +
    15namespace Dune {
    │ │ │ │ +
    16
    │ │ │ │ +
    24 template<class T>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    26 {
    │ │ │ │ +
    28 typedef T field_type;
    │ │ │ │ +
    30 typedef T real_type;
    │ │ │ │ +
    31 };
    │ │ │ │ +
    │ │ │ │ +
    32
    │ │ │ │ +
    33 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    34 struct FieldTraits<const T>
    │ │ │ │ +
    35 {
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    38 };
    │ │ │ │ +
    │ │ │ │ +
    39
    │ │ │ │ +
    40 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    41 struct FieldTraits< std::complex<T> >
    │ │ │ │ +
    42 {
    │ │ │ │ +
    43 typedef std::complex<T> field_type;
    │ │ │ │ +
    44 typedef T real_type;
    │ │ │ │ +
    45 };
    │ │ │ │ +
    │ │ │ │ +
    46
    │ │ │ │ +
    47 template<class T, unsigned int N>
    │ │ │ │ +
    │ │ │ │ +
    48 struct FieldTraits< T[N] >
    │ │ │ │ +
    49 {
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    52 };
    │ │ │ │ +
    │ │ │ │ +
    53
    │ │ │ │ +
    54 template<class T>
    │ │ │ │ +
    │ │ │ │ +
    55 struct FieldTraits< std::vector<T> >
    │ │ │ │ +
    56 {
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    59 };
    │ │ │ │ +
    │ │ │ │ +
    60
    │ │ │ │ +
    61} // end namespace Dune
    │ │ │ │ +
    62
    │ │ │ │ +
    63#endif // DUNE_FTRAITS_HH
    │ │ │ │
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    std::size_t hash_range(It first, It last)
    Hashes all elements in the range [first,last) and returns the combined hash.
    Definition hash.hh:322
    │ │ │ │ -
    A Vector class with statically reserved memory.
    Definition reservedvector.hh:47
    │ │ │ │ -
    constexpr const_reference front() const noexcept
    Returns const reference to first element of vector.
    Definition reservedvector.hh:350
    │ │ │ │ -
    constexpr const_reverse_iterator crend() const noexcept
    Returns a const reverse-iterator pointing to the begin of the vector.
    Definition reservedvector.hh:303
    │ │ │ │ -
    constexpr ReservedVector(size_type count) noexcept(std::is_nothrow_default_constructible_v< value_type >)
    Constructs the vector with count elements that will be default-initialized.
    Definition reservedvector.hh:89
    │ │ │ │ -
    constexpr void fill(const value_type &value) noexcept(std::is_nothrow_copy_assignable_v< value_type >)
    Fill the container with the value.
    Definition reservedvector.hh:415
    │ │ │ │ -
    storage_type::pointer pointer
    Pointer to T.
    Definition reservedvector.hh:57
    │ │ │ │ -
    constexpr reverse_iterator rbegin() noexcept
    Returns a const reverse-iterator pointing to the end of the vector.
    Definition reservedvector.hh:255
    │ │ │ │ -
    constexpr bool operator<=(const ReservedVector &that) const noexcept
    Lexicographically compares the values in the vector this with that
    Definition reservedvector.hh:165
    │ │ │ │ -
    constexpr bool operator>(const ReservedVector &that) const noexcept
    Lexicographically compares the values in the vector this with that
    Definition reservedvector.hh:159
    │ │ │ │ -
    constexpr const_reverse_iterator rend() const noexcept
    Returns a const reverse-iterator pointing to the begin of the vector.
    Definition reservedvector.hh:297
    │ │ │ │ -
    static constexpr size_type max_size() noexcept
    Returns the maximum length of the vector.
    Definition reservedvector.hh:405
    │ │ │ │ -
    constexpr const_reference at(size_type i) const
    Returns a const reference to the i'th element.
    Definition reservedvector.hh:321
    │ │ │ │ -
    std::reverse_iterator< iterator > reverse_iterator
    Reverse iterator.
    Definition reservedvector.hh:73
    │ │ │ │ -
    constexpr iterator end() noexcept
    Returns an iterator pointing to the end of the vector.
    Definition reservedvector.hh:273
    │ │ │ │ -
    constexpr bool operator<(const ReservedVector &that) const noexcept
    Lexicographically compares the values in the vector this with that
    Definition reservedvector.hh:149
    │ │ │ │ -
    constexpr size_type size() const noexcept
    Returns number of elements in the vector.
    Definition reservedvector.hh:387
    │ │ │ │ -
    constexpr bool empty() const noexcept
    Returns true if vector has no elements.
    Definition reservedvector.hh:393
    │ │ │ │ -
    constexpr iterator begin() noexcept
    Returns a iterator pointing to the beginning of the vector.
    Definition reservedvector.hh:237
    │ │ │ │ -
    constexpr void push_back(const value_type &t) noexcept(std::is_nothrow_copy_assignable_v< value_type >)
    Appends an element to the end of a vector, up to the maximum size n, O(1) time.
    Definition reservedvector.hh:194
    │ │ │ │ -
    constexpr reverse_iterator rend() noexcept
    Returns a const reverse-iterator pointing to the begin of the vector.
    Definition reservedvector.hh:291
    │ │ │ │ -
    storage_type::iterator iterator
    Iterator used to iterate through a vector.
    Definition reservedvector.hh:69
    │ │ │ │ -
    constexpr const_iterator cbegin() const noexcept
    Returns a const_iterator pointing to the beginning of the vector.
    Definition reservedvector.hh:249
    │ │ │ │ -
    std::reverse_iterator< const_iterator > const_reverse_iterator
    Const reverse iterator.
    Definition reservedvector.hh:75
    │ │ │ │ -
    constexpr pointer data() noexcept
    Returns pointer to the underlying memory.
    Definition reservedvector.hh:371
    │ │ │ │ -
    constexpr const_reference back() const noexcept
    Returns const reference to last element of vector.
    Definition reservedvector.hh:364
    │ │ │ │ -
    friend std::ostream & operator<<(std::ostream &s, const ReservedVector &v)
    Send ReservedVector to an output stream.
    Definition reservedvector.hh:434
    │ │ │ │ -
    constexpr bool operator==(const ReservedVector &that) const noexcept
    Compares the values in the vector this with that for equality.
    Definition reservedvector.hh:132
    │ │ │ │ -
    constexpr void pop_back() noexcept
    Erases the last element of the vector, O(1) time.
    Definition reservedvector.hh:227
    │ │ │ │ -
    friend std::size_t hash_value(const ReservedVector &v) noexcept
    Definition reservedvector.hh:441
    │ │ │ │ -
    storage_type::difference_type difference_type
    A signed integral type.
    Definition reservedvector.hh:67
    │ │ │ │ -
    constexpr const_iterator end() const noexcept
    Returns a const_iterator pointing to the end of the vector.
    Definition reservedvector.hh:279
    │ │ │ │ -
    constexpr void clear() noexcept
    Erases all elements.
    Definition reservedvector.hh:181
    │ │ │ │ -
    constexpr ReservedVector() noexcept(std::is_nothrow_default_constructible_v< value_type >)
    Constructs an empty vector.
    Definition reservedvector.hh:82
    │ │ │ │ -
    storage_type::const_iterator const_iterator
    Const iterator used to iterate through a vector.
    Definition reservedvector.hh:71
    │ │ │ │ -
    reference emplace_back(Args &&... args) noexcept(std::is_nothrow_constructible_v< value_type, decltype(args)... >)
    Appends an element to the end of a vector by constructing it in place.
    Definition reservedvector.hh:211
    │ │ │ │ -
    storage_type::size_type size_type
    An unsigned integral type.
    Definition reservedvector.hh:65
    │ │ │ │ -
    constexpr bool operator>=(const ReservedVector &that) const noexcept
    Lexicographically compares the values in the vector this with that
    Definition reservedvector.hh:171
    │ │ │ │ -
    storage_type::const_reference const_reference
    Const reference to T.
    Definition reservedvector.hh:63
    │ │ │ │ -
    void swap(ReservedVector &other) noexcept(std::is_nothrow_swappable_v< value_type >)
    Swap the content with another vector.
    Definition reservedvector.hh:423
    │ │ │ │ -
    constexpr ReservedVector(InputIt first, InputIt last) noexcept(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector()))
    Constructs the vector from an iterator range [first,last)
    Definition reservedvector.hh:110
    │ │ │ │ -
    constexpr const_pointer data() const noexcept
    Returns const pointer to the underlying memory.
    Definition reservedvector.hh:377
    │ │ │ │ -
    constexpr reference at(size_type i)
    Returns reference to the i'th element.
    Definition reservedvector.hh:313
    │ │ │ │ -
    constexpr const_iterator cend() const noexcept
    Returns a const_iterator pointing to the end of the vector.
    Definition reservedvector.hh:285
    │ │ │ │ -
    constexpr reference back() noexcept
    Returns reference to last element of vector.
    Definition reservedvector.hh:357
    │ │ │ │ -
    constexpr const_reverse_iterator rbegin() const noexcept
    Returns a const reverse-iterator pointing to the end of the vector.
    Definition reservedvector.hh:261
    │ │ │ │ -
    storage_type::value_type value_type
    The type of object, T, stored in the vector.
    Definition reservedvector.hh:55
    │ │ │ │ -
    constexpr const_iterator begin() const noexcept
    Returns a const_iterator pointing to the beginning of the vector.
    Definition reservedvector.hh:243
    │ │ │ │ -
    constexpr ReservedVector(size_type count, const value_type &value) noexcept(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector(count)))
    Constructs the vector with count copies of elements with value value.
    Definition reservedvector.hh:98
    │ │ │ │ -
    constexpr reference operator[](size_type i) noexcept
    Returns reference to the i'th element.
    Definition reservedvector.hh:329
    │ │ │ │ -
    constexpr reference front() noexcept
    Returns reference to first element of vector.
    Definition reservedvector.hh:343
    │ │ │ │ -
    storage_type::const_pointer const_pointer
    Const pointer to T.
    Definition reservedvector.hh:59
    │ │ │ │ -
    constexpr ReservedVector(std::initializer_list< value_type > const &l) noexcept(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector(l.begin(), l.end())))
    Constructs the vector from an initializer list.
    Definition reservedvector.hh:121
    │ │ │ │ -
    constexpr bool operator!=(const ReservedVector &that) const noexcept
    Compares the values in the vector this with that for not equality.
    Definition reservedvector.hh:143
    │ │ │ │ -
    constexpr void resize(size_type s) noexcept
    Specifies a new size for the vector.
    Definition reservedvector.hh:187
    │ │ │ │ -
    static constexpr size_type capacity() noexcept
    Returns current capacity (allocated memory) of the vector.
    Definition reservedvector.hh:399
    │ │ │ │ -
    storage_type::reference reference
    Reference to T.
    Definition reservedvector.hh:61
    │ │ │ │ -
    constexpr const_reverse_iterator crbegin() const noexcept
    Returns a const reverse-iterator pointing to the end of the vector.
    Definition reservedvector.hh:267
    │ │ │ │ -
    constexpr void push_back(value_type &&t) noexcept(std::is_nothrow_move_assignable_v< value_type >)
    Appends an element to the end of a vector by moving the value, up to the maximum size n,...
    Definition reservedvector.hh:202
    │ │ │ │ +
    Definition ftraits.hh:26
    │ │ │ │ +
    T field_type
    export the type representing the field
    Definition ftraits.hh:28
    │ │ │ │ +
    T real_type
    export the type representing the real type of the field
    Definition ftraits.hh:30
    │ │ │ │ +
    FieldTraits< T >::field_type field_type
    Definition ftraits.hh:36
    │ │ │ │ +
    FieldTraits< T >::real_type real_type
    Definition ftraits.hh:37
    │ │ │ │ +
    T real_type
    Definition ftraits.hh:44
    │ │ │ │ +
    std::complex< T > field_type
    Definition ftraits.hh:43
    │ │ │ │ +
    FieldTraits< T >::field_type field_type
    Definition ftraits.hh:50
    │ │ │ │ +
    FieldTraits< T >::real_type real_type
    Definition ftraits.hh:51
    │ │ │ │ +
    FieldTraits< T >::real_type real_type
    Definition ftraits.hh:58
    │ │ │ │ +
    FieldTraits< T >::field_type field_type
    Definition ftraits.hh:57
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,633 +1,100 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -reservedvector.hh │ │ │ │ │ +ftraits.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_RESERVEDVECTOR_HH │ │ │ │ │ -6#define DUNE_COMMON_RESERVEDVECTOR_HH │ │ │ │ │ +5#ifndef DUNE_FTRAITS_HH │ │ │ │ │ +6#define DUNE_FTRAITS_HH │ │ │ │ │ 7 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20#include <_d_u_n_e_/_c_o_m_m_o_n_/_h_a_s_h_._h_h> │ │ │ │ │ -21 │ │ │ │ │ -22#ifdef CHECK_RESERVEDVECTOR │ │ │ │ │ -23#define CHECKSIZE(X) assert(X) │ │ │ │ │ -24#else │ │ │ │ │ -_2_5#define CHECKSIZE(X) {} │ │ │ │ │ -26#endif │ │ │ │ │ -27 │ │ │ │ │ -28namespace _D_u_n_e │ │ │ │ │ -29{ │ │ │ │ │ -45 template │ │ │ │ │ -_4_6 class _R_e_s_e_r_v_e_d_V_e_c_t_o_r │ │ │ │ │ -47 { │ │ │ │ │ -48 using storage_type = std::array; │ │ │ │ │ -49 │ │ │ │ │ -50 public: │ │ │ │ │ -51 │ │ │ │ │ -_5_5 typedef typename storage_type::value_type _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_5_7 typedef typename storage_type::pointer _p_o_i_n_t_e_r; │ │ │ │ │ -_5_9 typedef typename storage_type::const_pointer _c_o_n_s_t___p_o_i_n_t_e_r; │ │ │ │ │ -_6_1 typedef typename storage_type::reference _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -_6_3 typedef typename storage_type::const_reference _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -_6_5 typedef typename storage_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -_6_7 typedef typename storage_type::difference_type _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ -_6_9 typedef typename storage_type::iterator _i_t_e_r_a_t_o_r; │ │ │ │ │ -_7_1 typedef typename storage_type::const_iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -_7_3 typedef std::reverse_iterator _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r; │ │ │ │ │ -_7_5 typedef std::reverse_iterator _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r; │ │ │ │ │ -76 │ │ │ │ │ -_8_2 constexpr _R_e_s_e_r_v_e_d_V_e_c_t_o_r() │ │ │ │ │ -83 noexcept(_s_t_d::is_nothrow_default_constructible_v<_v_a_l_u_e___t_y_p_e>) │ │ │ │ │ -84 : storage_() │ │ │ │ │ -85 , size_(0) │ │ │ │ │ -86 {} │ │ │ │ │ -87 │ │ │ │ │ -_8_9 explicit constexpr _R_e_s_e_r_v_e_d_V_e_c_t_o_r(_s_i_z_e___t_y_p_e count) │ │ │ │ │ -90 noexcept(std::is_nothrow_default_constructible_v) │ │ │ │ │ -91 : storage_() │ │ │ │ │ -92 , size_(count) │ │ │ │ │ -93 { │ │ │ │ │ -94 assert(count <= n); │ │ │ │ │ -95 } │ │ │ │ │ -96 │ │ │ │ │ -_9_8 constexpr _R_e_s_e_r_v_e_d_V_e_c_t_o_r(_s_i_z_e___t_y_p_e count, const _v_a_l_u_e___t_y_p_e& value) │ │ │ │ │ -99 noexcept(std::is_nothrow_copy_assignable_v && │ │ │ │ │ -100 noexcept(_R_e_s_e_r_v_e_d_V_e_c_t_o_r(count))) │ │ │ │ │ -101 : _R_e_s_e_r_v_e_d_V_e_c_t_o_r(count) │ │ │ │ │ -102 { │ │ │ │ │ -103 for (_s_i_z_e___t_y_p_e i=0; i::value_type, _v_a_l_u_e___t_y_p_e>, int> = 0> │ │ │ │ │ -_1_1_0 constexpr _R_e_s_e_r_v_e_d_V_e_c_t_o_r(InputIt first, InputIt last) │ │ │ │ │ -111 noexcept(std::is_nothrow_copy_assignable_v && │ │ │ │ │ -112 noexcept(_R_e_s_e_r_v_e_d_V_e_c_t_o_r())) │ │ │ │ │ -113 : _R_e_s_e_r_v_e_d_V_e_c_t_o_r() │ │ │ │ │ -114 { │ │ │ │ │ -115 for (_s_i_z_e___t_y_p_e i=0; i const& l) │ │ │ │ │ -122 noexcept(std::is_nothrow_copy_assignable_v && │ │ │ │ │ -123 noexcept(_R_e_s_e_r_v_e_d_V_e_c_t_o_r(l.begin(),l.end()))) │ │ │ │ │ -124 : _R_e_s_e_r_v_e_d_V_e_c_t_o_r(l.begin(),l.end()) │ │ │ │ │ -125 {} │ │ │ │ │ -126 │ │ │ │ │ -_1_3_2 constexpr bool _o_p_e_r_a_t_o_r_=_=_ (const _R_e_s_e_r_v_e_d_V_e_c_t_o_r& that) const noexcept │ │ │ │ │ -133 { │ │ │ │ │ -134 if (_s_i_z_e() != that.size()) │ │ │ │ │ -135 return false; │ │ │ │ │ -136 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); ++i) │ │ │ │ │ -137 if (!(storage_[i]==that.storage_[i])) │ │ │ │ │ -138 return false; │ │ │ │ │ -139 return true; │ │ │ │ │ -140 } │ │ │ │ │ -141 │ │ │ │ │ -_1_4_3 constexpr bool _o_p_e_r_a_t_o_r_!_=_ (const _R_e_s_e_r_v_e_d_V_e_c_t_o_r& that) const noexcept │ │ │ │ │ -144 { │ │ │ │ │ -145 return !(*this == that); │ │ │ │ │ -146 } │ │ │ │ │ -147 │ │ │ │ │ -_1_4_9 constexpr bool _o_p_e_r_a_t_o_r_<_ (const _R_e_s_e_r_v_e_d_V_e_c_t_o_r& that) const noexcept │ │ │ │ │ -150 { │ │ │ │ │ -151 for (_s_i_z_e___t_y_p_e i=0; i_ (const _R_e_s_e_r_v_e_d_V_e_c_t_o_r& that) const noexcept │ │ │ │ │ -160 { │ │ │ │ │ -161 return that < *this; │ │ │ │ │ -162 } │ │ │ │ │ -163 │ │ │ │ │ -_1_6_5 constexpr bool _o_p_e_r_a_t_o_r_<_=_ (const _R_e_s_e_r_v_e_d_V_e_c_t_o_r& that) const noexcept │ │ │ │ │ -166 { │ │ │ │ │ -167 return !(*this > that); │ │ │ │ │ -168 } │ │ │ │ │ -169 │ │ │ │ │ -_1_7_1 constexpr bool _o_p_e_r_a_t_o_r_>_=_ (const _R_e_s_e_r_v_e_d_V_e_c_t_o_r& that) const noexcept │ │ │ │ │ -172 { │ │ │ │ │ -173 return !(*this < that); │ │ │ │ │ -174 } │ │ │ │ │ -175 │ │ │ │ │ -_1_8_1 constexpr void _c_l_e_a_r() noexcept │ │ │ │ │ -182 { │ │ │ │ │ -183 size_ = 0; │ │ │ │ │ -184 } │ │ │ │ │ -185 │ │ │ │ │ -_1_8_7 constexpr void _r_e_s_i_z_e(_s_i_z_e___t_y_p_e s) noexcept │ │ │ │ │ -188 { │ │ │ │ │ -189 _C_H_E_C_K_S_I_Z_E(s<=n); │ │ │ │ │ -190 size_ = s; │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -_1_9_4 constexpr void _p_u_s_h___b_a_c_k(const _v_a_l_u_e___t_y_p_e& t) │ │ │ │ │ -195 noexcept(std::is_nothrow_copy_assignable_v) │ │ │ │ │ -196 { │ │ │ │ │ -197 _C_H_E_C_K_S_I_Z_E(size_) │ │ │ │ │ -204 { │ │ │ │ │ -205 _C_H_E_C_K_S_I_Z_E(size_ │ │ │ │ │ -_2_1_1 _r_e_f_e_r_e_n_c_e _e_m_p_l_a_c_e___b_a_c_k(Args&&... args) │ │ │ │ │ -212 noexcept(std::is_nothrow_constructible_v<_v_a_l_u_e___t_y_p_e,decltype(args)...>) │ │ │ │ │ -213 { │ │ │ │ │ -214 _C_H_E_C_K_S_I_Z_E(size_~value_type(); │ │ │ │ │ -218 // construct the value_type in place │ │ │ │ │ -219 // NOTE: This is not an integral constant expression. │ │ │ │ │ -220 // With c++20 we could use std::construct_at │ │ │ │ │ -221 ::new (const_cast(static_cast(p))) │ │ │ │ │ -222 _v_a_l_u_e___t_y_p_e(std::forward(args)...); │ │ │ │ │ -223 return *p; │ │ │ │ │ -224 } │ │ │ │ │ -225 │ │ │ │ │ -_2_2_7 constexpr void _p_o_p___b_a_c_k() noexcept │ │ │ │ │ -228 { │ │ │ │ │ -229 if (! _e_m_p_t_y()) size_--; │ │ │ │ │ -230 } │ │ │ │ │ -231 │ │ │ │ │ -_2_3_7 constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n() noexcept │ │ │ │ │ -238 { │ │ │ │ │ -239 return storage_.begin(); │ │ │ │ │ -240 } │ │ │ │ │ -241 │ │ │ │ │ -_2_4_3 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const noexcept │ │ │ │ │ -244 { │ │ │ │ │ -245 return storage_.begin(); │ │ │ │ │ -246 } │ │ │ │ │ -247 │ │ │ │ │ -_2_4_9 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _c_b_e_g_i_n() const noexcept │ │ │ │ │ -250 { │ │ │ │ │ -251 return storage_.cbegin(); │ │ │ │ │ -252 } │ │ │ │ │ -253 │ │ │ │ │ -_2_5_5 constexpr _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_b_e_g_i_n() noexcept │ │ │ │ │ -256 { │ │ │ │ │ -257 return _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()+_s_i_z_e()}; │ │ │ │ │ -258 } │ │ │ │ │ -259 │ │ │ │ │ -_2_6_1 constexpr _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_b_e_g_i_n() const noexcept │ │ │ │ │ -262 { │ │ │ │ │ -263 return _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()+_s_i_z_e()}; │ │ │ │ │ -264 } │ │ │ │ │ -265 │ │ │ │ │ -_2_6_7 constexpr _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _c_r_b_e_g_i_n() const noexcept │ │ │ │ │ -268 { │ │ │ │ │ -269 return _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()+_s_i_z_e()}; │ │ │ │ │ -270 } │ │ │ │ │ -271 │ │ │ │ │ -_2_7_3 constexpr _i_t_e_r_a_t_o_r _e_n_d() noexcept │ │ │ │ │ -274 { │ │ │ │ │ -275 return storage_.begin()+_s_i_z_e(); │ │ │ │ │ -276 } │ │ │ │ │ -277 │ │ │ │ │ -_2_7_9 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const noexcept │ │ │ │ │ -280 { │ │ │ │ │ -281 return storage_.begin()+_s_i_z_e(); │ │ │ │ │ -282 } │ │ │ │ │ -283 │ │ │ │ │ -_2_8_5 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _c_e_n_d() const noexcept │ │ │ │ │ -286 { │ │ │ │ │ -287 return storage_.cbegin()+_s_i_z_e(); │ │ │ │ │ -288 } │ │ │ │ │ -289 │ │ │ │ │ -_2_9_1 constexpr _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_e_n_d() noexcept │ │ │ │ │ -292 { │ │ │ │ │ -293 return _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()}; │ │ │ │ │ -294 } │ │ │ │ │ -295 │ │ │ │ │ -_2_9_7 constexpr _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_e_n_d() const noexcept │ │ │ │ │ -298 { │ │ │ │ │ -299 return _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()}; │ │ │ │ │ -300 } │ │ │ │ │ -301 │ │ │ │ │ -_3_0_3 constexpr _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _c_r_e_n_d() const noexcept │ │ │ │ │ -304 { │ │ │ │ │ -305 return _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()}; │ │ │ │ │ -306 } │ │ │ │ │ -307 │ │ │ │ │ -_3_1_3 constexpr _r_e_f_e_r_e_n_c_e _a_t(_s_i_z_e___t_y_p_e i) │ │ │ │ │ -314 { │ │ │ │ │ -315 if (!(i < _s_i_z_e())) │ │ │ │ │ -316 throw std::out_of_range("Index out of range"); │ │ │ │ │ -317 return storage_[i]; │ │ │ │ │ -318 } │ │ │ │ │ -319 │ │ │ │ │ -_3_2_1 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _a_t(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -322 { │ │ │ │ │ -323 if (!(i < _s_i_z_e())) │ │ │ │ │ -324 throw std::out_of_range("Index out of range"); │ │ │ │ │ -325 return storage_[i]; │ │ │ │ │ -326 } │ │ │ │ │ -327 │ │ │ │ │ -_3_2_9 constexpr _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) noexcept │ │ │ │ │ -330 { │ │ │ │ │ -331 _C_H_E_C_K_S_I_Z_E(size_>i); │ │ │ │ │ -332 return storage_[i]; │ │ │ │ │ -333 } │ │ │ │ │ -334 │ │ │ │ │ -_3_3_6 constexpr _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 noexcept │ │ │ │ │ -337 { │ │ │ │ │ -338 _C_H_E_C_K_S_I_Z_E(size_>i); │ │ │ │ │ -339 return storage_[i]; │ │ │ │ │ -340 } │ │ │ │ │ -341 │ │ │ │ │ -_3_4_3 constexpr _r_e_f_e_r_e_n_c_e _f_r_o_n_t() noexcept │ │ │ │ │ -344 { │ │ │ │ │ -345 _C_H_E_C_K_S_I_Z_E(size_>0); │ │ │ │ │ -346 return storage_[0]; │ │ │ │ │ -347 } │ │ │ │ │ -348 │ │ │ │ │ -_3_5_0 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _f_r_o_n_t() const noexcept │ │ │ │ │ -351 { │ │ │ │ │ -352 _C_H_E_C_K_S_I_Z_E(size_>0); │ │ │ │ │ -353 return storage_[0]; │ │ │ │ │ -354 } │ │ │ │ │ -355 │ │ │ │ │ -_3_5_7 constexpr _r_e_f_e_r_e_n_c_e _b_a_c_k() noexcept │ │ │ │ │ -358 { │ │ │ │ │ -359 _C_H_E_C_K_S_I_Z_E(size_>0); │ │ │ │ │ -360 return storage_[size_-1]; │ │ │ │ │ -361 } │ │ │ │ │ -362 │ │ │ │ │ -_3_6_4 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _b_a_c_k() const noexcept │ │ │ │ │ -365 { │ │ │ │ │ -366 _C_H_E_C_K_S_I_Z_E(size_>0); │ │ │ │ │ -367 return storage_[size_-1]; │ │ │ │ │ -368 } │ │ │ │ │ -369 │ │ │ │ │ -_3_7_1 constexpr _p_o_i_n_t_e_r _d_a_t_a() noexcept │ │ │ │ │ -372 { │ │ │ │ │ -373 return storage_.data(); │ │ │ │ │ -374 } │ │ │ │ │ -375 │ │ │ │ │ -_3_7_7 constexpr _c_o_n_s_t___p_o_i_n_t_e_r _d_a_t_a() const noexcept │ │ │ │ │ -378 { │ │ │ │ │ -379 return storage_.data(); │ │ │ │ │ -380 } │ │ │ │ │ -381 │ │ │ │ │ -_3_8_7 constexpr _s_i_z_e___t_y_p_e _s_i_z_e() const noexcept │ │ │ │ │ -388 { │ │ │ │ │ -389 return size_; │ │ │ │ │ -390 } │ │ │ │ │ -391 │ │ │ │ │ -_3_9_3 constexpr bool _e_m_p_t_y() const noexcept │ │ │ │ │ -394 { │ │ │ │ │ -395 return size_==0; │ │ │ │ │ -396 } │ │ │ │ │ -397 │ │ │ │ │ -_3_9_9 static constexpr _s_i_z_e___t_y_p_e _c_a_p_a_c_i_t_y() noexcept │ │ │ │ │ -400 { │ │ │ │ │ -401 return n; │ │ │ │ │ -402 } │ │ │ │ │ -403 │ │ │ │ │ -_4_0_5 static constexpr _s_i_z_e___t_y_p_e _m_a_x___s_i_z_e() noexcept │ │ │ │ │ -406 { │ │ │ │ │ -407 return n; │ │ │ │ │ -408 } │ │ │ │ │ -409 │ │ │ │ │ -_4_1_5 constexpr void _f_i_l_l(const _v_a_l_u_e___t_y_p_e& value) │ │ │ │ │ -416 noexcept(std::is_nothrow_copy_assignable_v) │ │ │ │ │ -417 { │ │ │ │ │ -418 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); ++i) │ │ │ │ │ -419 storage_[i] = value; │ │ │ │ │ -420 } │ │ │ │ │ -421 │ │ │ │ │ -_4_2_3 void _s_w_a_p(_R_e_s_e_r_v_e_d_V_e_c_t_o_r& other) │ │ │ │ │ -424 noexcept(std::is_nothrow_swappable_v) │ │ │ │ │ -425 { │ │ │ │ │ -426 using std::swap; │ │ │ │ │ -427 _s_w_a_p(storage_, other.storage_); │ │ │ │ │ -428 _s_w_a_p(size_, other.size_); │ │ │ │ │ -429 } │ │ │ │ │ -430 │ │ │ │ │ -_4_3_4 friend std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const _R_e_s_e_r_v_e_d_V_e_c_t_o_r& v) │ │ │ │ │ -435 { │ │ │ │ │ -436 for (_s_i_z_e___t_y_p_e i=0; i)) │ │ │ │ │ -454 │ │ │ │ │ -455#undef CHECKSIZE │ │ │ │ │ -456 │ │ │ │ │ -457#endif // DUNE_COMMON_RESERVEDVECTOR_HH │ │ │ │ │ -_h_a_s_h_._h_h │ │ │ │ │ -Support for calculating hash values of objects. │ │ │ │ │ -_D_U_N_E___D_E_F_I_N_E___H_A_S_H │ │ │ │ │ -#define DUNE_DEFINE_HASH(template_args, type) │ │ │ │ │ -Defines the required struct specialization to make type hashable via Dune:: │ │ │ │ │ -hash. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:100 │ │ │ │ │ -_D_U_N_E___H_A_S_H___T_Y_P_E │ │ │ │ │ -#define DUNE_HASH_TYPE(...) │ │ │ │ │ -Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:117 │ │ │ │ │ -_D_U_N_E___H_A_S_H___T_E_M_P_L_A_T_E___A_R_G_S │ │ │ │ │ -#define DUNE_HASH_TEMPLATE_ARGS(...) │ │ │ │ │ -Wrapper macro for the template arguments in DUNE_DEFINE_HASH. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:109 │ │ │ │ │ -_C_H_E_C_K_S_I_Z_E │ │ │ │ │ -#define CHECKSIZE(X) │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:25 │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14 │ │ │ │ │ +15namespace _D_u_n_e { │ │ │ │ │ +16 │ │ │ │ │ +24 template │ │ │ │ │ +_2_5 struct _F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ +26 { │ │ │ │ │ +_2_8 typedef T _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_3_0 typedef T _r_e_a_l___t_y_p_e; │ │ │ │ │ +31 }; │ │ │ │ │ +32 │ │ │ │ │ +33 template │ │ │ │ │ +_3_4 struct _F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ +35 { │ │ │ │ │ +_3_6 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_T_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_3_7 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_T_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ +38 }; │ │ │ │ │ +39 │ │ │ │ │ +40 template │ │ │ │ │ +_4_1 struct _F_i_e_l_d_T_r_a_i_t_s< _s_t_d::complex > │ │ │ │ │ +42 { │ │ │ │ │ +_4_3 typedef std::complex _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_4_4 typedef T _r_e_a_l___t_y_p_e; │ │ │ │ │ +45 }; │ │ │ │ │ +46 │ │ │ │ │ +47 template │ │ │ │ │ +_4_8 struct _F_i_e_l_d_T_r_a_i_t_s< T[N] > │ │ │ │ │ +49 { │ │ │ │ │ +_5_0 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_T_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_5_1 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_T_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ +52 }; │ │ │ │ │ +53 │ │ │ │ │ +54 template │ │ │ │ │ +_5_5 struct _F_i_e_l_d_T_r_a_i_t_s< _s_t_d::vector > │ │ │ │ │ +56 { │ │ │ │ │ +_5_7 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_T_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_5_8 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_T_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ +59 }; │ │ │ │ │ +60 │ │ │ │ │ +61} // end namespace Dune │ │ │ │ │ +62 │ │ │ │ │ +63#endif // DUNE_FTRAITS_HH │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_h_a_s_h___r_a_n_g_e │ │ │ │ │ -std::size_t hash_range(It first, It last) │ │ │ │ │ -Hashes all elements in the range [first,last) and returns the combined hash. │ │ │ │ │ -DDeeffiinniittiioonn hash.hh:322 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r │ │ │ │ │ -A Vector class with statically reserved memory. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_f_r_o_n_t │ │ │ │ │ -constexpr const_reference front() const noexcept │ │ │ │ │ -Returns const reference to first element of vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:350 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_r_e_n_d │ │ │ │ │ -constexpr const_reverse_iterator crend() const noexcept │ │ │ │ │ -Returns a const reverse-iterator pointing to the begin of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:303 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r │ │ │ │ │ -constexpr ReservedVector(size_type count) noexcept(std:: │ │ │ │ │ -is_nothrow_default_constructible_v< value_type >) │ │ │ │ │ -Constructs the vector with count elements that will be default-initialized. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_f_i_l_l │ │ │ │ │ -constexpr void fill(const value_type &value) noexcept(std:: │ │ │ │ │ -is_nothrow_copy_assignable_v< value_type >) │ │ │ │ │ -Fill the container with the value. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:415 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ -storage_type::pointer pointer │ │ │ │ │ -Pointer to T. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_r_b_e_g_i_n │ │ │ │ │ -constexpr reverse_iterator rbegin() noexcept │ │ │ │ │ -Returns a const reverse-iterator pointing to the end of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:255 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_<_= │ │ │ │ │ -constexpr bool operator<=(const ReservedVector &that) const noexcept │ │ │ │ │ -Lexicographically compares the values in the vector this with that │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:165 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_> │ │ │ │ │ -constexpr bool operator>(const ReservedVector &that) const noexcept │ │ │ │ │ -Lexicographically compares the values in the vector this with that │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:159 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_r_e_n_d │ │ │ │ │ -constexpr const_reverse_iterator rend() const noexcept │ │ │ │ │ -Returns a const reverse-iterator pointing to the begin of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:297 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_m_a_x___s_i_z_e │ │ │ │ │ -static constexpr size_type max_size() noexcept │ │ │ │ │ -Returns the maximum length of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:405 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_a_t │ │ │ │ │ -constexpr const_reference at(size_type i) const │ │ │ │ │ -Returns a const reference to the i'th element. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:321 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r │ │ │ │ │ -std::reverse_iterator< iterator > reverse_iterator │ │ │ │ │ -Reverse iterator. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ -constexpr iterator end() noexcept │ │ │ │ │ -Returns an iterator pointing to the end of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:273 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ │ -constexpr bool operator<(const ReservedVector &that) const noexcept │ │ │ │ │ -Lexicographically compares the values in the vector this with that │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ -constexpr size_type size() const noexcept │ │ │ │ │ -Returns number of elements in the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:387 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_e_m_p_t_y │ │ │ │ │ -constexpr bool empty() const noexcept │ │ │ │ │ -Returns true if vector has no elements. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:393 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ -constexpr iterator begin() noexcept │ │ │ │ │ -Returns a iterator pointing to the beginning of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ -constexpr void push_back(const value_type &t) noexcept(std:: │ │ │ │ │ -is_nothrow_copy_assignable_v< value_type >) │ │ │ │ │ -Appends an element to the end of a vector, up to the maximum size n, O(1) time. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_r_e_n_d │ │ │ │ │ -constexpr reverse_iterator rend() noexcept │ │ │ │ │ -Returns a const reverse-iterator pointing to the begin of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:291 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -storage_type::iterator iterator │ │ │ │ │ -Iterator used to iterate through a vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_b_e_g_i_n │ │ │ │ │ -constexpr const_iterator cbegin() const noexcept │ │ │ │ │ -Returns a const_iterator pointing to the beginning of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:249 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r │ │ │ │ │ -std::reverse_iterator< const_iterator > const_reverse_iterator │ │ │ │ │ -Const reverse iterator. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_d_a_t_a │ │ │ │ │ -constexpr pointer data() noexcept │ │ │ │ │ -Returns pointer to the underlying memory. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:371 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_b_a_c_k │ │ │ │ │ -constexpr const_reference back() const noexcept │ │ │ │ │ -Returns const reference to last element of vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:364 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -friend std::ostream & operator<<(std::ostream &s, const ReservedVector &v) │ │ │ │ │ -Send ReservedVector to an output stream. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:434 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -constexpr bool operator==(const ReservedVector &that) const noexcept │ │ │ │ │ -Compares the values in the vector this with that for equality. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:132 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_p_o_p___b_a_c_k │ │ │ │ │ -constexpr void pop_back() noexcept │ │ │ │ │ -Erases the last element of the vector, O(1) time. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:227 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_h_a_s_h___v_a_l_u_e │ │ │ │ │ -friend std::size_t hash_value(const ReservedVector &v) noexcept │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:441 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -storage_type::difference_type difference_type │ │ │ │ │ -A signed integral type. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ -constexpr const_iterator end() const noexcept │ │ │ │ │ -Returns a const_iterator pointing to the end of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:279 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_l_e_a_r │ │ │ │ │ -constexpr void clear() noexcept │ │ │ │ │ -Erases all elements. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:181 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r │ │ │ │ │ -constexpr ReservedVector() noexcept(std::is_nothrow_default_constructible_v< │ │ │ │ │ -value_type >) │ │ │ │ │ -Constructs an empty vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -storage_type::const_iterator const_iterator │ │ │ │ │ -Const iterator used to iterate through a vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_e_m_p_l_a_c_e___b_a_c_k │ │ │ │ │ -reference emplace_back(Args &&... args) noexcept(std:: │ │ │ │ │ -is_nothrow_constructible_v< value_type, decltype(args)... >) │ │ │ │ │ -Appends an element to the end of a vector by constructing it in place. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:211 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -storage_type::size_type size_type │ │ │ │ │ -An unsigned integral type. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_>_= │ │ │ │ │ -constexpr bool operator>=(const ReservedVector &that) const noexcept │ │ │ │ │ -Lexicographically compares the values in the vector this with that │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -storage_type::const_reference const_reference │ │ │ │ │ -Const reference to T. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_s_w_a_p │ │ │ │ │ -void swap(ReservedVector &other) noexcept(std::is_nothrow_swappable_v< │ │ │ │ │ -value_type >) │ │ │ │ │ -Swap the content with another vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:423 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r │ │ │ │ │ -constexpr ReservedVector(InputIt first, InputIt last) noexcept(std:: │ │ │ │ │ -is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector())) │ │ │ │ │ -Constructs the vector from an iterator range [first,last) │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_d_a_t_a │ │ │ │ │ -constexpr const_pointer data() const noexcept │ │ │ │ │ -Returns const pointer to the underlying memory. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:377 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_a_t │ │ │ │ │ -constexpr reference at(size_type i) │ │ │ │ │ -Returns reference to the i'th element. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:313 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_e_n_d │ │ │ │ │ -constexpr const_iterator cend() const noexcept │ │ │ │ │ -Returns a const_iterator pointing to the end of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:285 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_b_a_c_k │ │ │ │ │ -constexpr reference back() noexcept │ │ │ │ │ -Returns reference to last element of vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:357 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_r_b_e_g_i_n │ │ │ │ │ -constexpr const_reverse_iterator rbegin() const noexcept │ │ │ │ │ -Returns a const reverse-iterator pointing to the end of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -storage_type::value_type value_type │ │ │ │ │ -The type of object, T, stored in the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ -constexpr const_iterator begin() const noexcept │ │ │ │ │ -Returns a const_iterator pointing to the beginning of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:243 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r │ │ │ │ │ -constexpr ReservedVector(size_type count, const value_type &value) noexcept │ │ │ │ │ -(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector │ │ │ │ │ -(count))) │ │ │ │ │ -Constructs the vector with count copies of elements with value value. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:98 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -constexpr reference operator[](size_type i) noexcept │ │ │ │ │ -Returns reference to the i'th element. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:329 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_f_r_o_n_t │ │ │ │ │ -constexpr reference front() noexcept │ │ │ │ │ -Returns reference to first element of vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:343 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ -storage_type::const_pointer const_pointer │ │ │ │ │ -Const pointer to T. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r │ │ │ │ │ -constexpr ReservedVector(std::initializer_list< value_type > const &l) noexcept │ │ │ │ │ -(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector │ │ │ │ │ -(l.begin(), l.end()))) │ │ │ │ │ -Constructs the vector from an initializer list. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:121 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -constexpr bool operator!=(const ReservedVector &that) const noexcept │ │ │ │ │ -Compares the values in the vector this with that for not equality. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_r_e_s_i_z_e │ │ │ │ │ -constexpr void resize(size_type s) noexcept │ │ │ │ │ -Specifies a new size for the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:187 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_a_p_a_c_i_t_y │ │ │ │ │ -static constexpr size_type capacity() noexcept │ │ │ │ │ -Returns current capacity (allocated memory) of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:399 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -storage_type::reference reference │ │ │ │ │ -Reference to T. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_c_r_b_e_g_i_n │ │ │ │ │ -constexpr const_reverse_iterator crbegin() const noexcept │ │ │ │ │ -Returns a const reverse-iterator pointing to the end of the vector. │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_R_e_s_e_r_v_e_d_V_e_c_t_o_r_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ -constexpr void push_back(value_type &&t) noexcept(std:: │ │ │ │ │ -is_nothrow_move_assignable_v< value_type >) │ │ │ │ │ -Appends an element to the end of a vector by moving the value, up to the │ │ │ │ │ -maximum size n,... │ │ │ │ │ -DDeeffiinniittiioonn reservedvector.hh:202 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +T field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +T real_type │ │ │ │ │ +export the type representing the real type of the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< T >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _c_o_n_s_t_ _T_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< T >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _T_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +T real_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _T_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +std::complex< T > field_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _T_[_N_]_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< T >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _T_[_N_]_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< T >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _T_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< T >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _T_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< T >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:57 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00176.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: to_unique_ptr.hh File Reference │ │ │ │ +dune-common: matrixconcepts.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,43 +70,29 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions
    │ │ │ │ -
    to_unique_ptr.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ +
    matrixconcepts.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include <memory>
    │ │ │ │ +
    #include <utility>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <dune/common/std/type_traits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Namespaces

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

    │ │ │ │ -Typedefs

    template<class T >
    using Dune::ToUniquePtr = std::unique_ptr< T >
     Alias for std::unique_ptr introduced as transition wrapper.
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

    │ │ │ │ -Functions

    template<class T , class... Args>
    std::unique_ptr< T > Dune::makeToUnique (Args &&... args)
     Alias for std::make_unique introduced as transition wrapper.
     
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,27 +1,18 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -to_unique_ptr.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +matrixconcepts.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_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_. │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_T_o_U_n_i_q_u_e_P_t_r = std::unique_ptr< T > │ │ │ │ │ -  Alias for std::unique_ptr introduced as transition wrapper. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -std::unique_ptr< T >  _D_u_n_e_:_:_m_a_k_e_T_o_U_n_i_q_u_e (Args &&... args) │ │ │ │ │ -  Alias for std::make_unique introduced as transition │ │ │ │ │ - wrapper. │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00176_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: to_unique_ptr.hh Source File │ │ │ │ +dune-common: matrixconcepts.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,48 +74,109 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    to_unique_ptr.hh
    │ │ │ │ +
    matrixconcepts.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5
    │ │ │ │ -
    6#ifndef DUNE_TO_UNIQUE_PTR_HH
    │ │ │ │ -
    7#define DUNE_TO_UNIQUE_PTR_HH
    │ │ │ │ +
    5#ifndef DUNE_COMMON_MATRIXCONCEPTS_HH
    │ │ │ │ +
    6#define DUNE_COMMON_MATRIXCONCEPTS_HH
    │ │ │ │ +
    7
    │ │ │ │
    8
    │ │ │ │ -
    9#warning to_unique_ptr.hh and ToUniquePtr are deprecated. Use std::unique_ptr or std::shared_ptr instead.
    │ │ │ │ -
    10
    │ │ │ │ -
    11#include <memory>
    │ │ │ │ +
    9
    │ │ │ │ +
    10#include <utility>
    │ │ │ │ +
    11#include <type_traits>
    │ │ │ │
    12
    │ │ │ │ -
    13namespace Dune
    │ │ │ │ -
    14{
    │ │ │ │ -
    17 template <class T>
    │ │ │ │ -
    18 using ToUniquePtr [[deprecated]] = std::unique_ptr<T>;
    │ │ │ │ -
    19
    │ │ │ │ -
    22 template <class T, class... Args>
    │ │ │ │ -
    │ │ │ │ -
    23 [[deprecated]] std::unique_ptr<T> makeToUnique (Args&&... args)
    │ │ │ │ -
    24 {
    │ │ │ │ -
    25 return std::make_unique(std::forward<Args>(args)...);
    │ │ │ │ -
    26 }
    │ │ │ │ -
    │ │ │ │ -
    27
    │ │ │ │ -
    28} // end namespace Dune
    │ │ │ │ + │ │ │ │ +
    14
    │ │ │ │ +
    15
    │ │ │ │ +
    16
    │ │ │ │ +
    17namespace Dune {
    │ │ │ │ +
    18
    │ │ │ │ +
    19 template<class, int, int>
    │ │ │ │ +
    20 class FieldMatrix;
    │ │ │ │ +
    21
    │ │ │ │ +
    22 template<class>
    │ │ │ │ +
    23 class DynamicMatrix;
    │ │ │ │ +
    24
    │ │ │ │ +
    25}
    │ │ │ │ +
    26
    │ │ │ │ +
    27namespace Dune::Impl {
    │ │ │ │ +
    28
    │ │ │ │
    29
    │ │ │ │ -
    30#endif // DUNE_TO_UNIQUE_PTR_HH
    │ │ │ │ +
    30 // Some traits for checking matrix concepts. Currently these are
    │ │ │ │ +
    31 // all technical internal helpers that just serve different headers
    │ │ │ │ +
    32 // to do internal checks and are thus collected here.
    │ │ │ │ +
    33
    │ │ │ │ +
    34 template<class T>
    │ │ │ │ +
    35 using IsMatrixHelper = std::void_t<decltype(std::declval<T>().N(), std::declval<T>().M())>;
    │ │ │ │ +
    36
    │ │ │ │ +
    37 template<class T>
    │ │ │ │ +
    38 struct IsMatrix : public Dune::Std::is_detected<IsMatrixHelper, T> {};
    │ │ │ │ +
    39
    │ │ │ │ +
    40 // Check if T is a matrix by checking for member functions N() and M().
    │ │ │ │ +
    41 template<class T>
    │ │ │ │ +
    42 constexpr bool IsMatrix_v = Impl::IsMatrix<T>::value;
    │ │ │ │ +
    43
    │ │ │ │ +
    44
    │ │ │ │ +
    45
    │ │ │ │ +
    46 template<class T>
    │ │ │ │ +
    47 using IsStaticSizeMatrixHelper = std::void_t<decltype(T::rows, T::cols)>;
    │ │ │ │ +
    48
    │ │ │ │ +
    49 template<class T>
    │ │ │ │ +
    50 struct IsStaticSizeMatrix : public Dune::Std::is_detected<IsStaticSizeMatrixHelper, T> {};
    │ │ │ │ +
    51
    │ │ │ │ +
    52 // Check if T is a statically sized matrix by checking for static members rows and cols.
    │ │ │ │ +
    53 template<class T>
    │ │ │ │ +
    54 constexpr bool IsStaticSizeMatrix_v = Impl::IsStaticSizeMatrix<T>::value;
    │ │ │ │ +
    55
    │ │ │ │ +
    56
    │ │ │ │ +
    57
    │ │ │ │ +
    58 template<class T>
    │ │ │ │ +
    59 class IsFieldMatrix : public std::false_type {};
    │ │ │ │ +
    60
    │ │ │ │ +
    61 template< class K, int ROWS, int COLS>
    │ │ │ │ +
    62 class IsFieldMatrix<Dune::FieldMatrix<K, ROWS, COLS>> : public std::true_type {};
    │ │ │ │ +
    63
    │ │ │ │ +
    64 // Check if T is an instance of FieldMatrix
    │ │ │ │ +
    65 template<class T>
    │ │ │ │ +
    66 constexpr bool IsFieldMatrix_v = Impl::IsFieldMatrix<T>::value;
    │ │ │ │ +
    67
    │ │ │ │ +
    68
    │ │ │ │ +
    69
    │ │ │ │ +
    70 template<class T>
    │ │ │ │ +
    71 class IsDenseMatrix : public std::false_type {};
    │ │ │ │ +
    72
    │ │ │ │ +
    73 template<class K, int ROWS, int COLS>
    │ │ │ │ +
    74 class IsDenseMatrix<Dune::FieldMatrix<K, ROWS, COLS>> : public std::true_type {};
    │ │ │ │ +
    75
    │ │ │ │ +
    76 template<class K>
    │ │ │ │ +
    77 class IsDenseMatrix<Dune::DynamicMatrix<K>> : public std::true_type {};
    │ │ │ │ +
    78
    │ │ │ │ +
    79 // Check if T is a dense matrix. This is implemented by specialization.
    │ │ │ │ +
    80 template<class T>
    │ │ │ │ +
    81 constexpr bool IsDenseMatrix_v = Impl::IsDenseMatrix<T>::value;
    │ │ │ │ +
    82
    │ │ │ │ +
    83
    │ │ │ │ +
    84
    │ │ │ │ +
    85} // namespace Dune::Impl
    │ │ │ │ +
    86
    │ │ │ │ +
    87
    │ │ │ │ +
    88
    │ │ │ │ +
    89#endif // DUNE_COMMON_MATRIXCONCEPTS_HH
    │ │ │ │ + │ │ │ │ +
    typename detected_or< nonesuch, Op, Args... >::value_t is_detected
    Detects whether Op<Args...> is valid.
    Definition type_traits.hh:141
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    std::unique_ptr< T > makeToUnique(Args &&... args)
    Alias for std::make_unique introduced as transition wrapper.
    Definition to_unique_ptr.hh:23
    │ │ │ │ -
    std::unique_ptr< T > ToUniquePtr
    Alias for std::unique_ptr introduced as transition wrapper.
    Definition to_unique_ptr.hh:18
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,49 +1,113 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -to_unique_ptr.hh │ │ │ │ │ +matrixconcepts.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5 │ │ │ │ │ -6#ifndef DUNE_TO_UNIQUE_PTR_HH │ │ │ │ │ -7#define DUNE_TO_UNIQUE_PTR_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_MATRIXCONCEPTS_HH │ │ │ │ │ +6#define DUNE_COMMON_MATRIXCONCEPTS_HH │ │ │ │ │ +7 │ │ │ │ │ 8 │ │ │ │ │ -9#warning to_unique_ptr.hh and ToUniquePtr are deprecated. Use std::unique_ptr │ │ │ │ │ -or std::shared_ptr instead. │ │ │ │ │ -10 │ │ │ │ │ -11#include │ │ │ │ │ +9 │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ 12 │ │ │ │ │ -13namespace _D_u_n_e │ │ │ │ │ -14{ │ │ │ │ │ -17 template │ │ │ │ │ -_1_8 using _T_o_U_n_i_q_u_e_P_t_r [[deprecated]] = std::unique_ptr; │ │ │ │ │ -19 │ │ │ │ │ -22 template │ │ │ │ │ -_2_3 [[deprecated]] std::unique_ptr _m_a_k_e_T_o_U_n_i_q_u_e (Args&&... args) │ │ │ │ │ -24 { │ │ │ │ │ -25 return std::make_unique(std::forward(args)...); │ │ │ │ │ -26 } │ │ │ │ │ -27 │ │ │ │ │ -28} // end namespace Dune │ │ │ │ │ +13#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +14 │ │ │ │ │ +15 │ │ │ │ │ +16 │ │ │ │ │ +17namespace _D_u_n_e { │ │ │ │ │ +18 │ │ │ │ │ +19 template │ │ │ │ │ +20 class FieldMatrix; │ │ │ │ │ +21 │ │ │ │ │ +22 template │ │ │ │ │ +23 class DynamicMatrix; │ │ │ │ │ +24 │ │ │ │ │ +25} │ │ │ │ │ +26 │ │ │ │ │ +27namespace Dune::Impl { │ │ │ │ │ +28 │ │ │ │ │ 29 │ │ │ │ │ -30#endif // DUNE_TO_UNIQUE_PTR_HH │ │ │ │ │ +30 // Some traits for checking matrix concepts. Currently these are │ │ │ │ │ +31 // all technical internal helpers that just serve different headers │ │ │ │ │ +32 // to do internal checks and are thus collected here. │ │ │ │ │ +33 │ │ │ │ │ +34 template │ │ │ │ │ +35 using IsMatrixHelper = std::void_t().N(), std:: │ │ │ │ │ +declval().M())>; │ │ │ │ │ +36 │ │ │ │ │ +37 template │ │ │ │ │ +38 struct IsMatrix : public _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d {}; │ │ │ │ │ +39 │ │ │ │ │ +40 // Check if T is a matrix by checking for member functions N() and M(). │ │ │ │ │ +41 template │ │ │ │ │ +42 constexpr bool IsMatrix_v = Impl::IsMatrix::value; │ │ │ │ │ +43 │ │ │ │ │ +44 │ │ │ │ │ +45 │ │ │ │ │ +46 template │ │ │ │ │ +47 using IsStaticSizeMatrixHelper = std::void_t; │ │ │ │ │ +48 │ │ │ │ │ +49 template │ │ │ │ │ +50 struct IsStaticSizeMatrix : public _D_u_n_e_:_:_S_t_d_:_: │ │ │ │ │ +_i_s___d_e_t_e_c_t_e_d {}; │ │ │ │ │ +51 │ │ │ │ │ +52 // Check if T is a statically sized matrix by checking for static members │ │ │ │ │ +rows and cols. │ │ │ │ │ +53 template │ │ │ │ │ +54 constexpr bool IsStaticSizeMatrix_v = Impl::IsStaticSizeMatrix::value; │ │ │ │ │ +55 │ │ │ │ │ +56 │ │ │ │ │ +57 │ │ │ │ │ +58 template │ │ │ │ │ +59 class IsFieldMatrix : public std::false_type {}; │ │ │ │ │ +60 │ │ │ │ │ +61 template< class K, int ROWS, int COLS> │ │ │ │ │ +62 class IsFieldMatrix<_D_u_n_e::FieldMatrix> : public std:: │ │ │ │ │ +true_type {}; │ │ │ │ │ +63 │ │ │ │ │ +64 // Check if T is an instance of FieldMatrix │ │ │ │ │ +65 template │ │ │ │ │ +66 constexpr bool IsFieldMatrix_v = Impl::IsFieldMatrix::value; │ │ │ │ │ +67 │ │ │ │ │ +68 │ │ │ │ │ +69 │ │ │ │ │ +70 template │ │ │ │ │ +71 class IsDenseMatrix : public std::false_type {}; │ │ │ │ │ +72 │ │ │ │ │ +73 template │ │ │ │ │ +74 class IsDenseMatrix<_D_u_n_e::FieldMatrix> : public std:: │ │ │ │ │ +true_type {}; │ │ │ │ │ +75 │ │ │ │ │ +76 template │ │ │ │ │ +77 class IsDenseMatrix<_D_u_n_e::DynamicMatrix> : public std::true_type {}; │ │ │ │ │ +78 │ │ │ │ │ +79 // Check if T is a dense matrix. This is implemented by specialization. │ │ │ │ │ +80 template │ │ │ │ │ +81 constexpr bool IsDenseMatrix_v = Impl::IsDenseMatrix::value; │ │ │ │ │ +82 │ │ │ │ │ +83 │ │ │ │ │ +84 │ │ │ │ │ +85} // namespace Dune::Impl │ │ │ │ │ +86 │ │ │ │ │ +87 │ │ │ │ │ +88 │ │ │ │ │ +89#endif // DUNE_COMMON_MATRIXCONCEPTS_HH │ │ │ │ │ +_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d │ │ │ │ │ +typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ +Detects whether Op is valid. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:141 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_m_a_k_e_T_o_U_n_i_q_u_e │ │ │ │ │ -std::unique_ptr< T > makeToUnique(Args &&... args) │ │ │ │ │ -Alias for std::make_unique introduced as transition wrapper. │ │ │ │ │ -DDeeffiinniittiioonn to_unique_ptr.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_T_o_U_n_i_q_u_e_P_t_r │ │ │ │ │ -std::unique_ptr< T > ToUniquePtr │ │ │ │ │ -Alias for std::unique_ptr introduced as transition wrapper. │ │ │ │ │ -DDeeffiinniittiioonn to_unique_ptr.hh:18 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00179.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: fvector.hh File Reference │ │ │ │ +dune-common: stdthread.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,85 +70,64 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ +Macros | │ │ │ │ Functions
    │ │ │ │ - │ │ │ │ +
    stdthread.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Implements a vector constructed from a given type representing a field and a compile-time given size. │ │ │ │ -More...

    │ │ │ │ -
    #include <array>
    │ │ │ │ -#include <cmath>
    │ │ │ │ -#include <cstddef>
    │ │ │ │ -#include <cstdlib>
    │ │ │ │ -#include <complex>
    │ │ │ │ -#include <cstring>
    │ │ │ │ -#include <utility>
    │ │ │ │ -#include <initializer_list>
    │ │ │ │ -#include <algorithm>
    │ │ │ │ -#include "typetraits.hh"
    │ │ │ │ -#include "exceptions.hh"
    │ │ │ │ -#include "ftraits.hh"
    │ │ │ │ -#include "densevector.hh"
    │ │ │ │ -#include "boundschecking.hh"
    │ │ │ │ -#include <dune/common/math.hh>
    │ │ │ │ -#include <dune/common/promotiontraits.hh>
    │ │ │ │ -
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    struct  Dune::DenseMatVecTraits< FieldVector< K, SIZE > >
     
    struct  Dune::FieldTraits< FieldVector< K, SIZE > >
     
    struct  Dune::IsFieldVectorSizeCorrect< C, SIZE >
     TMP to check the size of a DenseVectors statically, if possible. More...
     
    struct  Dune::IsFieldVectorSizeCorrect< FieldVector< T, SIZE >, SIZE >
     
    struct  Dune::IsFieldVectorSizeCorrect< FieldVector< T, SIZE1 >, SIZE >
     
    class  Dune::FieldVector< K, SIZE >
     vector space out of a tensor product of fields. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::MathOverloads
     namespace for customization of math functions with Dune-Semantics
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Macros

    #define DUNE_ASSERT_CALL_ONCE()    ::Dune::assertCallOnce(__FILE__, __LINE__, __func__)
     Make sure call_once() works and provide a helpful error message otherwise.
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<class K , int SIZE>
    auto Dune::MathOverloads::isFinite (const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
     
    template<class K , int SIZE>
    bool Dune::MathOverloads::isInf (const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
     
    template<class K , int SIZE, typename = std::enable_if_t<HasNaN<K>::value>>
    bool Dune::MathOverloads::isNaN (const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
     
    template<class K , typename = std::enable_if_t<HasNaN<K>::value>>
    bool Dune::MathOverloads::isUnordered (const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, PriorityTag< 2 >, ADLTag)
     
    void Dune::doAssertCallOnce (const char *file, int line, const char *function)
     
    void Dune::assertCallOnce (const char *file=nullptr, int line=-1, const char *function=nullptr)
     Make sure call_once() works and provide a helpful error message otherwise.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Implements a vector constructed from a given type representing a field and a compile-time given size.

    │ │ │ │ -
    │ │ │ │ +

    Macro Definition Documentation

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_ASSERT_CALL_ONCE

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_ASSERT_CALL_ONCE()    ::Dune::assertCallOnce(__FILE__, __LINE__, __func__)
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    Make sure call_once() works and provide a helpful error message otherwise.

    │ │ │ │ +

    This calls assertCallOnce() and automatically provides information about the caller in the error message.

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,73 +1,36 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -fvector.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ -Implements a vector constructed from a given type representing a field and a │ │ │ │ │ -compile-time given size. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ -#include "_e_x_c_e_p_t_i_o_n_s_._h_h" │ │ │ │ │ -#include "_f_t_r_a_i_t_s_._h_h" │ │ │ │ │ -#include "_d_e_n_s_e_v_e_c_t_o_r_._h_h" │ │ │ │ │ -#include "_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h" │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ +_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 │ │ │ │ │ +stdthread.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 │ │ │ │ │ -struct   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t_<_ _C_,_ _S_I_Z_E_ _> │ │ │ │ │ -  TMP to check the size of a DenseVectors statically, if possible. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _S_I_Z_E_ _>_,_ _S_I_Z_E_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _S_I_Z_E_1_ _>_,_ _S_I_Z_E_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _> │ │ │ │ │ -  vector space out of a tensor product of fields. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s │ │ │ │ │ -  namespace for customization of math functions with Dune-Semantics │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___A_S_S_E_R_T___C_A_L_L___O_N_C_E()    _:_:_D_u_n_e_:_:_a_s_s_e_r_t_C_a_l_l_O_n_c_e(__FILE__, __LINE__, │ │ │ │ │ + __func__) │ │ │ │ │ +  Make sure call_once() works and provide a helpful error message │ │ │ │ │ + otherwise. │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -auto  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e (const _F_i_e_l_d_V_e_c_t_o_r< K, SIZE > &b, │ │ │ │ │ - _P_r_i_o_r_i_t_y_T_a_g< 2 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f (const _F_i_e_l_d_V_e_c_t_o_r< K, SIZE > &b, _P_r_i_o_r_i_t_y_T_a_g< │ │ │ │ │ - 2 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -template::value>> │ │ │ │ │ -bool  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N (const _F_i_e_l_d_V_e_c_t_o_r< K, SIZE > &b, _P_r_i_o_r_i_t_y_T_a_g< │ │ │ │ │ - 2 >, _A_D_L_T_a_g) │ │ │ │ │ -  │ │ │ │ │ -template::value>> │ │ │ │ │ -bool  _D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d (const _F_i_e_l_d_V_e_c_t_o_r< K, 1 > &b, const │ │ │ │ │ - _F_i_e_l_d_V_e_c_t_o_r< K, 1 > &c, _P_r_i_o_r_i_t_y_T_a_g< 2 >, _A_D_L_T_a_g) │ │ │ │ │ +void  _D_u_n_e_:_:_d_o_A_s_s_e_r_t_C_a_l_l_O_n_c_e (const char *file, int line, const char *function) │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implements a vector constructed from a given type representing a field and a │ │ │ │ │ -compile-time given size. │ │ │ │ │ +void  _D_u_n_e_:_:_a_s_s_e_r_t_C_a_l_l_O_n_c_e (const char *file=nullptr, int line=-1, const char │ │ │ │ │ + *function=nullptr) │ │ │ │ │ +  Make sure call_once() works and provide a helpful error message │ │ │ │ │ + otherwise. │ │ │ │ │ +  │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__AASSSSEERRTT__CCAALLLL__OONNCCEE ********** │ │ │ │ │ +#define DUNE_ASSERT_CALL_ONCE ( )     _:_:_D_u_n_e_:_:_a_s_s_e_r_t_C_a_l_l_O_n_c_e(__FILE__, │ │ │ │ │ + __LINE__, __func__) │ │ │ │ │ +Make sure call_once() works and provide a helpful error message otherwise. │ │ │ │ │ +This calls assertCallOnce() and automatically provides information about the │ │ │ │ │ +caller in the error message. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00179_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: fvector.hh Source File │ │ │ │ +dune-common: stdthread.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,639 +74,54 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    fvector.hh
    │ │ │ │ +
    stdthread.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_FVECTOR_HH
    │ │ │ │ -
    6#define DUNE_FVECTOR_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include <array>
    │ │ │ │ -
    9#include <cmath>
    │ │ │ │ -
    10#include <cstddef>
    │ │ │ │ -
    11#include <cstdlib>
    │ │ │ │ -
    12#include <complex>
    │ │ │ │ -
    13#include <cstring>
    │ │ │ │ -
    14#include <utility>
    │ │ │ │ -
    15#include <initializer_list>
    │ │ │ │ -
    16#include <algorithm>
    │ │ │ │ +
    5
    │ │ │ │ +
    6#ifndef DUNE_COMMON_STDTHREAD_HH
    │ │ │ │ +
    7#define DUNE_COMMON_STDTHREAD_HH
    │ │ │ │ +
    8
    │ │ │ │ +
    9namespace Dune
    │ │ │ │ +
    10{
    │ │ │ │ +
    11
    │ │ │ │ +
    12 // used internally by assertCallOnce for the actual check
    │ │ │ │ +
    13 void doAssertCallOnce(const char *file, int line, const char *function);
    │ │ │ │ +
    14
    │ │ │ │
    17
    │ │ │ │ -
    18#include "typetraits.hh"
    │ │ │ │ -
    19#include "exceptions.hh"
    │ │ │ │ -
    20
    │ │ │ │ -
    21#include "ftraits.hh"
    │ │ │ │ -
    22#include "densevector.hh"
    │ │ │ │ -
    23#include "boundschecking.hh"
    │ │ │ │ -
    24
    │ │ │ │ -
    25#include <dune/common/math.hh>
    │ │ │ │ - │ │ │ │ -
    27
    │ │ │ │ -
    28namespace Dune {
    │ │ │ │ -
    29
    │ │ │ │ -
    39 template< class K, int SIZE > class FieldVector;
    │ │ │ │ -
    40 template< class K, int SIZE >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    42 {
    │ │ │ │ - │ │ │ │ -
    44 typedef std::array<K,SIZE> container_type;
    │ │ │ │ -
    45 typedef K value_type;
    │ │ │ │ -
    46 typedef typename container_type::size_type size_type;
    │ │ │ │ -
    47 };
    │ │ │ │ -
    │ │ │ │ -
    48
    │ │ │ │ -
    49 template< class K, int SIZE >
    │ │ │ │ -
    │ │ │ │ -
    50 struct FieldTraits< FieldVector<K,SIZE> >
    │ │ │ │ -
    51 {
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    54 };
    │ │ │ │ -
    │ │ │ │ -
    55
    │ │ │ │ -
    64 template<typename C, int SIZE>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    66 {
    │ │ │ │ -
    71 constexpr static bool value = true;
    │ │ │ │ -
    72 };
    │ │ │ │ -
    │ │ │ │ -
    73
    │ │ │ │ -
    74 template<typename T, int SIZE>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    76 {
    │ │ │ │ -
    77 constexpr static bool value = true;
    │ │ │ │ -
    78 };
    │ │ │ │ -
    │ │ │ │ -
    79
    │ │ │ │ -
    80 template<typename T, int SIZE, int SIZE1>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    82 {
    │ │ │ │ -
    83 constexpr static bool value = false;
    │ │ │ │ -
    84 };
    │ │ │ │ -
    │ │ │ │ -
    85
    │ │ │ │ -
    86
    │ │ │ │ -
    92 template< class K, int SIZE >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    94 public DenseVector< FieldVector<K,SIZE> >
    │ │ │ │ -
    95 {
    │ │ │ │ -
    96 std::array<K,SIZE> _data;
    │ │ │ │ - │ │ │ │ -
    98 public:
    │ │ │ │ -
    100 constexpr static int dimension = SIZE;
    │ │ │ │ -
    101
    │ │ │ │ -
    102 typedef typename Base::size_type size_type;
    │ │ │ │ -
    103 typedef typename Base::value_type value_type;
    │ │ │ │ -
    104
    │ │ │ │ - │ │ │ │ -
    107
    │ │ │ │ - │ │ │ │ -
    110
    │ │ │ │ -
    │ │ │ │ -
    112 constexpr FieldVector()
    │ │ │ │ -
    113 : _data{{}}
    │ │ │ │ -
    114 {}
    │ │ │ │ -
    │ │ │ │ -
    115
    │ │ │ │ -
    │ │ │ │ -
    117 explicit FieldVector (const K& t)
    │ │ │ │ -
    118 {
    │ │ │ │ -
    119 std::fill(_data.begin(),_data.end(),t);
    │ │ │ │ -
    120 }
    │ │ │ │ -
    │ │ │ │ -
    121
    │ │ │ │ -
    122#if __GNUC__ == 5 && !defined(__clang__)
    │ │ │ │ -
    123 // `... = default;` causes an internal compiler error on GCC 5.4 (Ubuntu 16.04)
    │ │ │ │ -
    125 FieldVector(const FieldVector& x) : _data(x._data) {}
    │ │ │ │ -
    126#else
    │ │ │ │ -
    128 FieldVector (const FieldVector&) = default;
    │ │ │ │ -
    129#endif
    │ │ │ │ -
    130
    │ │ │ │ -
    │ │ │ │ -
    132 FieldVector (std::initializer_list<K> const &l)
    │ │ │ │ -
    133 {
    │ │ │ │ -
    134 assert(l.size() == dimension);// Actually, this is not needed any more!
    │ │ │ │ -
    135 std::copy_n(l.begin(), std::min(static_cast<std::size_t>(dimension),
    │ │ │ │ -
    136 l.size()),
    │ │ │ │ -
    137 _data.begin());
    │ │ │ │ -
    138 }
    │ │ │ │ -
    │ │ │ │ -
    139
    │ │ │ │ -
    141 FieldVector& operator= (const FieldVector&) = default;
    │ │ │ │ -
    142
    │ │ │ │ -
    143 template <typename T>
    │ │ │ │ -
    │ │ │ │ -
    144 FieldVector& operator= (const FieldVector<T, SIZE>& x)
    │ │ │ │ -
    145 {
    │ │ │ │ -
    146 std::copy_n(x.begin(), SIZE, _data.begin());
    │ │ │ │ -
    147 return *this;
    │ │ │ │ -
    148 }
    │ │ │ │ -
    │ │ │ │ -
    149
    │ │ │ │ -
    150 template<typename T, int N>
    │ │ │ │ - │ │ │ │ -
    152
    │ │ │ │ -
    164 template<class C>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    166 [[maybe_unused]] typename std::enable_if<IsFieldVectorSizeCorrect<C,SIZE>::value>::type* dummy=0)
    │ │ │ │ -
    167 {
    │ │ │ │ -
    168 // do a run-time size check, for the case that x is not a FieldVector
    │ │ │ │ -
    169 assert(x.size() == SIZE); // Actually this is not needed any more!
    │ │ │ │ -
    170 std::copy_n(x.begin(), std::min(static_cast<std::size_t>(SIZE),x.size()), _data.begin());
    │ │ │ │ -
    171 }
    │ │ │ │ -
    │ │ │ │ -
    172
    │ │ │ │ -
    174 template<class K1>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    176 {
    │ │ │ │ -
    177 std::copy_n(x.begin(), SIZE, _data.begin());
    │ │ │ │ -
    178 }
    │ │ │ │ -
    │ │ │ │ -
    179
    │ │ │ │ -
    180 template<typename T, int N>
    │ │ │ │ -
    181 explicit FieldVector(const FieldVector<T, N>&) = delete;
    │ │ │ │ -
    182
    │ │ │ │ -
    183 using Base::operator=;
    │ │ │ │ -
    184
    │ │ │ │ -
    185 // make this thing a vector
    │ │ │ │ -
    186 static constexpr size_type size () { return SIZE; }
    │ │ │ │ -
    187
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    189 DUNE_ASSERT_BOUNDS(i < SIZE);
    │ │ │ │ -
    190 return _data[i];
    │ │ │ │ -
    191 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    192 const K & operator[](size_type i) const {
    │ │ │ │ -
    193 DUNE_ASSERT_BOUNDS(i < SIZE);
    │ │ │ │ -
    194 return _data[i];
    │ │ │ │ -
    195 }
    │ │ │ │ -
    │ │ │ │ -
    196
    │ │ │ │ -
    │ │ │ │ -
    198 K* data() noexcept
    │ │ │ │ -
    199 {
    │ │ │ │ -
    200 return _data.data();
    │ │ │ │ -
    201 }
    │ │ │ │ -
    │ │ │ │ -
    202
    │ │ │ │ -
    │ │ │ │ -
    204 const K* data() const noexcept
    │ │ │ │ -
    205 {
    │ │ │ │ -
    206 return _data.data();
    │ │ │ │ -
    207 }
    │ │ │ │ -
    │ │ │ │ -
    208
    │ │ │ │ -
    210 template <class Scalar,
    │ │ │ │ -
    211 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
    │ │ │ │ -
    │ │ │ │ -
    212 friend auto operator* ( const FieldVector& vector, Scalar scalar)
    │ │ │ │ -
    213 {
    │ │ │ │ - │ │ │ │ -
    215
    │ │ │ │ -
    216 for (size_type i = 0; i < vector.size(); ++i)
    │ │ │ │ -
    217 result[i] = vector[i] * scalar;
    │ │ │ │ -
    218
    │ │ │ │ -
    219 return result;
    │ │ │ │ -
    220 }
    │ │ │ │ -
    │ │ │ │ -
    221
    │ │ │ │ -
    223 template <class Scalar,
    │ │ │ │ -
    224 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
    │ │ │ │ -
    │ │ │ │ -
    225 friend auto operator* ( Scalar scalar, const FieldVector& vector)
    │ │ │ │ -
    226 {
    │ │ │ │ - │ │ │ │ -
    228
    │ │ │ │ -
    229 for (size_type i = 0; i < vector.size(); ++i)
    │ │ │ │ -
    230 result[i] = scalar * vector[i];
    │ │ │ │ -
    231
    │ │ │ │ -
    232 return result;
    │ │ │ │ -
    233 }
    │ │ │ │ -
    │ │ │ │ -
    234
    │ │ │ │ -
    236 template <class Scalar,
    │ │ │ │ -
    237 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
    │ │ │ │ -
    │ │ │ │ -
    238 friend auto operator/ ( const FieldVector& vector, Scalar scalar)
    │ │ │ │ -
    239 {
    │ │ │ │ - │ │ │ │ -
    241
    │ │ │ │ -
    242 for (size_type i = 0; i < vector.size(); ++i)
    │ │ │ │ -
    243 result[i] = vector[i] / scalar;
    │ │ │ │ -
    244
    │ │ │ │ -
    245 return result;
    │ │ │ │ -
    246 }
    │ │ │ │ -
    │ │ │ │ -
    247
    │ │ │ │ -
    248 };
    │ │ │ │ -
    │ │ │ │ -
    249
    │ │ │ │ -
    261 template<class K, int SIZE>
    │ │ │ │ -
    │ │ │ │ -
    262 inline std::istream &operator>> ( std::istream &in,
    │ │ │ │ - │ │ │ │ -
    264 {
    │ │ │ │ - │ │ │ │ -
    266 for( typename FieldVector<K, SIZE>::size_type i = 0; i < SIZE; ++i )
    │ │ │ │ -
    267 in >> w[ i ];
    │ │ │ │ -
    268 if(in)
    │ │ │ │ -
    269 v = w;
    │ │ │ │ -
    270 return in;
    │ │ │ │ -
    271 }
    │ │ │ │ -
    │ │ │ │ -
    272
    │ │ │ │ -
    273#ifndef DOXYGEN
    │ │ │ │ -
    274 template< class K >
    │ │ │ │ -
    275 struct DenseMatVecTraits< FieldVector<K,1> >
    │ │ │ │ -
    276 {
    │ │ │ │ -
    277 typedef FieldVector<K,1> derived_type;
    │ │ │ │ -
    278 typedef K container_type;
    │ │ │ │ -
    279 typedef K value_type;
    │ │ │ │ -
    280 typedef size_t size_type;
    │ │ │ │ -
    281 };
    │ │ │ │ -
    282
    │ │ │ │ -
    285 template<class K>
    │ │ │ │ -
    286 class FieldVector<K, 1> :
    │ │ │ │ -
    287 public DenseVector< FieldVector<K,1> >
    │ │ │ │ -
    288 {
    │ │ │ │ -
    289 K _data;
    │ │ │ │ -
    290 typedef DenseVector< FieldVector<K,1> > Base;
    │ │ │ │ -
    291 public:
    │ │ │ │ -
    293 constexpr static int dimension = 1;
    │ │ │ │ -
    294
    │ │ │ │ -
    295 typedef typename Base::size_type size_type;
    │ │ │ │ -
    296
    │ │ │ │ -
    298 typedef K& reference;
    │ │ │ │ -
    299
    │ │ │ │ -
    301 typedef const K& const_reference;
    │ │ │ │ -
    302
    │ │ │ │ -
    303 //===== construction
    │ │ │ │ -
    304
    │ │ │ │ -
    306 constexpr FieldVector ()
    │ │ │ │ -
    307 : _data()
    │ │ │ │ -
    308 {}
    │ │ │ │ -
    309
    │ │ │ │ -
    311 template<typename T,
    │ │ │ │ -
    312 typename EnableIf = typename std::enable_if<
    │ │ │ │ -
    313 std::is_convertible<T, K>::value &&
    │ │ │ │ -
    314 ! std::is_base_of<DenseVector<typename FieldTraits<T>::field_type>, K
    │ │ │ │ -
    315 >::value
    │ │ │ │ -
    316 >::type
    │ │ │ │ -
    317 >
    │ │ │ │ -
    318 FieldVector (const T& k) : _data(k) {}
    │ │ │ │ -
    319
    │ │ │ │ -
    321 template<class C,
    │ │ │ │ -
    322 std::enable_if_t<
    │ │ │ │ -
    323 std::is_assignable<K&, typename DenseVector<C>::value_type>::value, int> = 0>
    │ │ │ │ -
    324 FieldVector (const DenseVector<C> & x)
    │ │ │ │ -
    325 {
    │ │ │ │ -
    326 static_assert(((bool)IsFieldVectorSizeCorrect<C,1>::value), "FieldVectors do not match in dimension!");
    │ │ │ │ -
    327 assert(x.size() == 1);
    │ │ │ │ -
    328 _data = x[0];
    │ │ │ │ -
    329 }
    │ │ │ │ -
    330
    │ │ │ │ -
    332 FieldVector(const FieldVector&) = default;
    │ │ │ │ -
    333
    │ │ │ │ -
    335 FieldVector& operator=(const FieldVector&) = default;
    │ │ │ │ -
    336
    │ │ │ │ -
    337 template <typename T>
    │ │ │ │ -
    338 FieldVector& operator= (const FieldVector<T, 1>& other)
    │ │ │ │ -
    339 {
    │ │ │ │ -
    340 _data = other[0];
    │ │ │ │ -
    341 return *this;
    │ │ │ │ -
    342 }
    │ │ │ │ -
    343
    │ │ │ │ -
    344 template<typename T, int N>
    │ │ │ │ -
    345 FieldVector& operator=(const FieldVector<T, N>&) = delete;
    │ │ │ │ -
    346
    │ │ │ │ -
    348 FieldVector (std::initializer_list<K> const &l)
    │ │ │ │ -
    349 {
    │ │ │ │ -
    350 assert(l.size() == 1);
    │ │ │ │ -
    351 _data = *l.begin();
    │ │ │ │ -
    352 }
    │ │ │ │ -
    353
    │ │ │ │ -
    355 template<typename T,
    │ │ │ │ -
    356 typename EnableIf = typename std::enable_if<
    │ │ │ │ -
    357 std::is_assignable<K&, T>::value &&
    │ │ │ │ -
    358 ! std::is_base_of<DenseVector<typename FieldTraits<T>::field_type>, K
    │ │ │ │ -
    359 >::value
    │ │ │ │ -
    360 >::type
    │ │ │ │ -
    361 >
    │ │ │ │ -
    362 inline FieldVector& operator= (const T& k)
    │ │ │ │ -
    363 {
    │ │ │ │ -
    364 _data = k;
    │ │ │ │ -
    365 return *this;
    │ │ │ │ -
    366 }
    │ │ │ │ -
    367
    │ │ │ │ -
    368 //===== forward methods to container
    │ │ │ │ -
    369 static constexpr size_type size () { return 1; }
    │ │ │ │ -
    370
    │ │ │ │ -
    371 K & operator[]([[maybe_unused]] size_type i)
    │ │ │ │ -
    372 {
    │ │ │ │ -
    373 DUNE_ASSERT_BOUNDS(i == 0);
    │ │ │ │ -
    374 return _data;
    │ │ │ │ -
    375 }
    │ │ │ │ -
    376 const K & operator[]([[maybe_unused]] size_type i) const
    │ │ │ │ -
    377 {
    │ │ │ │ -
    378 DUNE_ASSERT_BOUNDS(i == 0);
    │ │ │ │ -
    379 return _data;
    │ │ │ │ -
    380 }
    │ │ │ │ -
    381
    │ │ │ │ -
    383 K* data() noexcept
    │ │ │ │ -
    384 {
    │ │ │ │ -
    385 return &_data;
    │ │ │ │ -
    386 }
    │ │ │ │ -
    387
    │ │ │ │ -
    389 const K* data() const noexcept
    │ │ │ │ -
    390 {
    │ │ │ │ -
    391 return &_data;
    │ │ │ │ -
    392 }
    │ │ │ │ -
    393
    │ │ │ │ -
    394 //===== conversion operator
    │ │ │ │ -
    395
    │ │ │ │ -
    397 operator K& () { return _data; }
    │ │ │ │ -
    398
    │ │ │ │ -
    400 operator const K& () const { return _data; }
    │ │ │ │ -
    401 };
    │ │ │ │ -
    402
    │ │ │ │ -
    403 /* ----- FV / FV ----- */
    │ │ │ │ -
    404 /* mostly not necessary as these operations are already covered via the cast operator */
    │ │ │ │ -
    405
    │ │ │ │ -
    407 template<class K>
    │ │ │ │ -
    408 inline bool operator> (const FieldVector<K,1>& a, const FieldVector<K,1>& b)
    │ │ │ │ -
    409 {
    │ │ │ │ -
    410 return a[0]>b[0];
    │ │ │ │ -
    411 }
    │ │ │ │ -
    412
    │ │ │ │ -
    414 template<class K>
    │ │ │ │ -
    415 inline bool operator>= (const FieldVector<K,1>& a, const FieldVector<K,1>& b)
    │ │ │ │ -
    416 {
    │ │ │ │ -
    417 return a[0]>=b[0];
    │ │ │ │ -
    418 }
    │ │ │ │ -
    419
    │ │ │ │ -
    421 template<class K>
    │ │ │ │ -
    422 inline bool operator< (const FieldVector<K,1>& a, const FieldVector<K,1>& b)
    │ │ │ │ -
    423 {
    │ │ │ │ -
    424 return a[0]<b[0];
    │ │ │ │ -
    425 }
    │ │ │ │ -
    426
    │ │ │ │ -
    428 template<class K>
    │ │ │ │ -
    429 inline bool operator<= (const FieldVector<K,1>& a, const FieldVector<K,1>& b)
    │ │ │ │ -
    430 {
    │ │ │ │ -
    431 return a[0]<=b[0];
    │ │ │ │ -
    432 }
    │ │ │ │ -
    433
    │ │ │ │ -
    434 /* ----- FV / scalar ----- */
    │ │ │ │ -
    435
    │ │ │ │ -
    437 template<class K>
    │ │ │ │ -
    438 inline FieldVector<K,1> operator+ (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    439 {
    │ │ │ │ -
    440 return a[0]+b;
    │ │ │ │ -
    441 }
    │ │ │ │ -
    442
    │ │ │ │ -
    444 template<class K>
    │ │ │ │ -
    445 inline FieldVector<K,1> operator- (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    446 {
    │ │ │ │ -
    447 return a[0]-b;
    │ │ │ │ -
    448 }
    │ │ │ │ -
    449
    │ │ │ │ -
    451 template<class K>
    │ │ │ │ -
    452 inline FieldVector<K,1> operator* (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    453 {
    │ │ │ │ -
    454 return a[0]*b;
    │ │ │ │ -
    455 }
    │ │ │ │ -
    456
    │ │ │ │ -
    458 template<class K>
    │ │ │ │ -
    459 inline FieldVector<K,1> operator/ (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    460 {
    │ │ │ │ -
    461 return a[0]/b;
    │ │ │ │ -
    462 }
    │ │ │ │ -
    463
    │ │ │ │ -
    465 template<class K>
    │ │ │ │ -
    466 inline bool operator> (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    467 {
    │ │ │ │ -
    468 return a[0]>b;
    │ │ │ │ -
    469 }
    │ │ │ │ -
    470
    │ │ │ │ -
    472 template<class K>
    │ │ │ │ -
    473 inline bool operator>= (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    474 {
    │ │ │ │ -
    475 return a[0]>=b;
    │ │ │ │ -
    476 }
    │ │ │ │ -
    477
    │ │ │ │ -
    479 template<class K>
    │ │ │ │ -
    480 inline bool operator< (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    481 {
    │ │ │ │ -
    482 return a[0]<b;
    │ │ │ │ -
    483 }
    │ │ │ │ -
    484
    │ │ │ │ -
    486 template<class K>
    │ │ │ │ -
    487 inline bool operator<= (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    488 {
    │ │ │ │ -
    489 return a[0]<=b;
    │ │ │ │ -
    490 }
    │ │ │ │ -
    491
    │ │ │ │ -
    493 template<class K>
    │ │ │ │ -
    494 inline bool operator== (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    495 {
    │ │ │ │ -
    496 return a[0]==b;
    │ │ │ │ -
    497 }
    │ │ │ │ -
    498
    │ │ │ │ -
    500 template<class K>
    │ │ │ │ -
    501 inline bool operator!= (const FieldVector<K,1>& a, const K b)
    │ │ │ │ -
    502 {
    │ │ │ │ -
    503 return a[0]!=b;
    │ │ │ │ -
    504 }
    │ │ │ │ -
    505
    │ │ │ │ -
    506 /* ----- scalar / FV ------ */
    │ │ │ │ -
    507
    │ │ │ │ -
    509 template<class K>
    │ │ │ │ -
    510 inline FieldVector<K,1> operator+ (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    511 {
    │ │ │ │ -
    512 return a+b[0];
    │ │ │ │ -
    513 }
    │ │ │ │ -
    514
    │ │ │ │ -
    516 template<class K>
    │ │ │ │ -
    517 inline FieldVector<K,1> operator- (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    518 {
    │ │ │ │ -
    519 return a-b[0];
    │ │ │ │ -
    520 }
    │ │ │ │ -
    521
    │ │ │ │ -
    523 template<class K>
    │ │ │ │ -
    524 inline FieldVector<K,1> operator* (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    525 {
    │ │ │ │ -
    526 return a*b[0];
    │ │ │ │ -
    527 }
    │ │ │ │ -
    528
    │ │ │ │ -
    530 template<class K>
    │ │ │ │ -
    531 inline FieldVector<K,1> operator/ (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    532 {
    │ │ │ │ -
    533 return a/b[0];
    │ │ │ │ -
    534 }
    │ │ │ │ -
    535
    │ │ │ │ -
    537 template<class K>
    │ │ │ │ -
    538 inline bool operator> (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    539 {
    │ │ │ │ -
    540 return a>b[0];
    │ │ │ │ -
    541 }
    │ │ │ │ -
    542
    │ │ │ │ -
    544 template<class K>
    │ │ │ │ -
    545 inline bool operator>= (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    546 {
    │ │ │ │ -
    547 return a>=b[0];
    │ │ │ │ -
    548 }
    │ │ │ │ -
    549
    │ │ │ │ -
    551 template<class K>
    │ │ │ │ -
    552 inline bool operator< (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    553 {
    │ │ │ │ -
    554 return a<b[0];
    │ │ │ │ -
    555 }
    │ │ │ │ -
    556
    │ │ │ │ -
    558 template<class K>
    │ │ │ │ -
    559 inline bool operator<= (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    560 {
    │ │ │ │ -
    561 return a<=b[0];
    │ │ │ │ -
    562 }
    │ │ │ │ -
    563
    │ │ │ │ -
    565 template<class K>
    │ │ │ │ -
    566 inline bool operator== (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    567 {
    │ │ │ │ -
    568 return a==b[0];
    │ │ │ │ -
    569 }
    │ │ │ │ -
    570
    │ │ │ │ -
    572 template<class K>
    │ │ │ │ -
    573 inline bool operator!= (const K a, const FieldVector<K,1>& b)
    │ │ │ │ -
    574 {
    │ │ │ │ -
    575 return a!=b[0];
    │ │ │ │ -
    576 }
    │ │ │ │ -
    577#endif
    │ │ │ │ -
    578
    │ │ │ │ -
    579 /* Overloads for common classification functions */
    │ │ │ │ -
    │ │ │ │ -
    580 namespace MathOverloads {
    │ │ │ │ -
    581
    │ │ │ │ -
    582 // ! Returns whether all entries are finite
    │ │ │ │ -
    583 template<class K, int SIZE>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    585 bool out = true;
    │ │ │ │ -
    586 for(int i=0; i<SIZE; i++) {
    │ │ │ │ -
    587 out &= Dune::isFinite(b[i]);
    │ │ │ │ -
    588 }
    │ │ │ │ -
    589 return out;
    │ │ │ │ -
    590 }
    │ │ │ │ -
    │ │ │ │ -
    591
    │ │ │ │ -
    592 // ! Returns whether any entry is infinite
    │ │ │ │ -
    593 template<class K, int SIZE>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    595 bool out = false;
    │ │ │ │ -
    596 for(int i=0; i<SIZE; i++) {
    │ │ │ │ -
    597 out |= Dune::isInf(b[i]);
    │ │ │ │ -
    598 }
    │ │ │ │ -
    599 return out;
    │ │ │ │ -
    600 }
    │ │ │ │ -
    │ │ │ │ -
    601
    │ │ │ │ -
    602 // ! Returns whether any entry is NaN
    │ │ │ │ -
    603 template<class K, int SIZE, typename = std::enable_if_t<HasNaN<K>::value>>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    605 bool out = false;
    │ │ │ │ -
    606 for(int i=0; i<SIZE; i++) {
    │ │ │ │ -
    607 out |= Dune::isNaN(b[i]);
    │ │ │ │ -
    608 }
    │ │ │ │ -
    609 return out;
    │ │ │ │ -
    610 }
    │ │ │ │ -
    │ │ │ │ -
    611
    │ │ │ │ -
    612 // ! Returns true if either b or c is NaN
    │ │ │ │ -
    613 template<class K, typename = std::enable_if_t<HasNaN<K>::value>>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    616 return Dune::isUnordered(b[0],c[0]);
    │ │ │ │ -
    617 }
    │ │ │ │ -
    │ │ │ │ -
    618 } //MathOverloads
    │ │ │ │ -
    │ │ │ │ -
    619
    │ │ │ │ -
    622} // end namespace
    │ │ │ │ -
    623
    │ │ │ │ -
    624#endif
    │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ -
    Some useful basic math stuff.
    │ │ │ │ -
    Type traits to determine the type of reals (when working with complex numbers)
    │ │ │ │ -
    Macro for wrapping boundary checks.
    │ │ │ │ -
    Implements the dense vector interface, with an exchangeable storage class.
    │ │ │ │ -
    A few common exception classes.
    │ │ │ │ -
    Compute type of the result of an arithmetic operation involving two different number types.
    │ │ │ │ -
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition boundschecking.hh:30
    │ │ │ │ -
    bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:549
    │ │ │ │ -
    bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:556
    │ │ │ │ +
    │ │ │ │ +
    35 inline void assertCallOnce(const char *file = nullptr, int line = -1,
    │ │ │ │ +
    36 const char *function = nullptr)
    │ │ │ │ +
    37 {
    │ │ │ │ +
    38 // make sure to call this only the first time this function is invoked
    │ │ │ │ +
    39 [[maybe_unused]] static const bool works
    │ │ │ │ +
    40 = (doAssertCallOnce(file, line, function), true);
    │ │ │ │ +
    41 }
    │ │ │ │ +
    │ │ │ │ +
    42
    │ │ │ │ +
    45
    │ │ │ │ +
    │ │ │ │ +
    49#define DUNE_ASSERT_CALL_ONCE() \
    │ │ │ │ +
    50 ::Dune::assertCallOnce(__FILE__, __LINE__, __func__)
    │ │ │ │ +
    │ │ │ │ +
    51
    │ │ │ │ +
    52} // namespace Dune
    │ │ │ │ +
    53
    │ │ │ │ +
    54#endif // DUNE_COMMON_STDTHREAD_HH
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:604
    │ │ │ │ -
    bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:594
    │ │ │ │ -
    auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:584
    │ │ │ │ -
    bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, PriorityTag< 2 >, ADLTag)
    Definition fvector.hh:614
    │ │ │ │ -
    vector space out of a tensor product of fields.
    Definition fvector.hh:95
    │ │ │ │ -
    K * data() noexcept
    return pointer to underlying array
    Definition fvector.hh:198
    │ │ │ │ -
    constexpr FieldVector()
    Constructor making default-initialized vector.
    Definition fvector.hh:112
    │ │ │ │ -
    const value_type & const_reference
    The type used for const references to the vector entry.
    Definition fvector.hh:109
    │ │ │ │ -
    Base::size_type size_type
    Definition fvector.hh:102
    │ │ │ │ -
    FieldVector(const DenseVector< C > &x, typename std::enable_if< IsFieldVectorSizeCorrect< C, SIZE >::value >::type *dummy=0)
    Copy constructor from a second vector of possibly different type.
    Definition fvector.hh:165
    │ │ │ │ -
    FieldVector(const FieldVector< T, N > &)=delete
    │ │ │ │ -
    FieldVector(const K &t)
    Constructor making vector with identical coordinates.
    Definition fvector.hh:117
    │ │ │ │ -
    FieldVector(std::initializer_list< K > const &l)
    Construct from a std::initializer_list.
    Definition fvector.hh:132
    │ │ │ │ -
    const K * data() const noexcept
    return pointer to underlying array
    Definition fvector.hh:204
    │ │ │ │ -
    static constexpr int dimension
    The size of this vector.
    Definition fvector.hh:100
    │ │ │ │ -
    FieldVector(const FieldVector< K1, SIZE > &x)
    Constructor making vector with identical coordinates.
    Definition fvector.hh:175
    │ │ │ │ -
    static constexpr size_type size()
    Definition fvector.hh:186
    │ │ │ │ -
    K & operator[](size_type i)
    Definition fvector.hh:188
    │ │ │ │ -
    value_type & reference
    The type used for references to the vector entry.
    Definition fvector.hh:106
    │ │ │ │ -
    Base::value_type value_type
    Definition fvector.hh:103
    │ │ │ │ -
    const K & operator[](size_type i) const
    Definition fvector.hh:192
    │ │ │ │ -
    FieldVector & operator=(const FieldVector< T, N > &)=delete
    │ │ │ │ -
    FieldVector(const FieldVector &)=default
    Copy constructor.
    │ │ │ │ -
    Interface for a class of dense vectors over a given field.
    Definition densevector.hh:229
    │ │ │ │ -
    Traits::value_type value_type
    export the type representing the field
    Definition densevector.hh:250
    │ │ │ │ -
    Iterator begin()
    begin iterator
    Definition densevector.hh:347
    │ │ │ │ -
    size_type size() const
    size method
    Definition densevector.hh:336
    │ │ │ │ -
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition densevector.hh:259
    │ │ │ │ -
    Definition ftraits.hh:26
    │ │ │ │ -
    T field_type
    export the type representing the field
    Definition ftraits.hh:28
    │ │ │ │ -
    T real_type
    export the type representing the real type of the field
    Definition ftraits.hh:30
    │ │ │ │ - │ │ │ │ -
    std::array< K, SIZE > container_type
    Definition fvector.hh:44
    │ │ │ │ -
    container_type::size_type size_type
    Definition fvector.hh:46
    │ │ │ │ -
    FieldVector< K, SIZE > derived_type
    Definition fvector.hh:43
    │ │ │ │ -
    FieldTraits< K >::real_type real_type
    Definition fvector.hh:53
    │ │ │ │ -
    FieldTraits< K >::field_type field_type
    Definition fvector.hh:52
    │ │ │ │ -
    TMP to check the size of a DenseVectors statically, if possible.
    Definition fvector.hh:66
    │ │ │ │ -
    static constexpr bool value
    True if C is not of type FieldVector or its dimension is not equal SIZE.
    Definition fvector.hh:71
    │ │ │ │ -
    Tag to make sure the functions in this namespace can be found by ADL.
    Definition math.hh:230
    │ │ │ │ -
    Definition matvectraits.hh:31
    │ │ │ │ -
    Helper class for tagging priorities.
    Definition typeutilities.hh:73
    │ │ │ │ +
    void assertCallOnce(const char *file=nullptr, int line=-1, const char *function=nullptr)
    Make sure call_once() works and provide a helpful error message otherwise.
    Definition stdthread.hh:35
    │ │ │ │ +
    void doAssertCallOnce(const char *file, int line, const char *function)
    Definition stdthread.cc:42
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,713 +1,52 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -fvector.hh │ │ │ │ │ +stdthread.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_FVECTOR_HH │ │ │ │ │ -6#define DUNE_FVECTOR_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_COMMON_STDTHREAD_HH │ │ │ │ │ +7#define DUNE_COMMON_STDTHREAD_HH │ │ │ │ │ +8 │ │ │ │ │ +9namespace _D_u_n_e │ │ │ │ │ +10{ │ │ │ │ │ +11 │ │ │ │ │ +12 // used internally by assertCallOnce for the actual check │ │ │ │ │ +13 void _d_o_A_s_s_e_r_t_C_a_l_l_O_n_c_e(const char *file, int line, const char *function); │ │ │ │ │ +14 │ │ │ │ │ 17 │ │ │ │ │ -18#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ -19#include "_e_x_c_e_p_t_i_o_n_s_._h_h" │ │ │ │ │ -20 │ │ │ │ │ -21#include "_f_t_r_a_i_t_s_._h_h" │ │ │ │ │ -22#include "_d_e_n_s_e_v_e_c_t_o_r_._h_h" │ │ │ │ │ -23#include "_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h" │ │ │ │ │ -24 │ │ │ │ │ -25#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ -26#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ -27 │ │ │ │ │ -28namespace _D_u_n_e { │ │ │ │ │ -29 │ │ │ │ │ -39 template< class K, int SIZE > class FieldVector; │ │ │ │ │ -40 template< class K, int SIZE > │ │ │ │ │ -_4_1 struct _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s< _F_i_e_l_d_V_e_c_t_o_r > │ │ │ │ │ -42 { │ │ │ │ │ -_4_3 typedef _F_i_e_l_d_V_e_c_t_o_r_<_K_,_S_I_Z_E_> _d_e_r_i_v_e_d___t_y_p_e; │ │ │ │ │ -_4_4 typedef std::array _c_o_n_t_a_i_n_e_r___t_y_p_e; │ │ │ │ │ -_4_5 typedef K _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_4_6 typedef typename container_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -47 }; │ │ │ │ │ -48 │ │ │ │ │ -49 template< class K, int SIZE > │ │ │ │ │ -_5_0 struct _F_i_e_l_d_T_r_a_i_t_s< _F_i_e_l_d_V_e_c_t_o_r > │ │ │ │ │ -51 { │ │ │ │ │ -_5_2 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_5_3 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ -54 }; │ │ │ │ │ -55 │ │ │ │ │ -64 template │ │ │ │ │ -_6_5 struct _I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t │ │ │ │ │ -66 { │ │ │ │ │ -_7_1 constexpr static bool _v_a_l_u_e = true; │ │ │ │ │ -72 }; │ │ │ │ │ -73 │ │ │ │ │ -74 template │ │ │ │ │ -_7_5 struct _I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t<_F_i_e_l_d_V_e_c_t_o_r,SIZE> │ │ │ │ │ -76 { │ │ │ │ │ -_7_7 constexpr static bool _v_a_l_u_e = true; │ │ │ │ │ -78 }; │ │ │ │ │ -79 │ │ │ │ │ -80 template │ │ │ │ │ -_8_1 struct _I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t<_F_i_e_l_d_V_e_c_t_o_r,SIZE> │ │ │ │ │ -82 { │ │ │ │ │ -_8_3 constexpr static bool _v_a_l_u_e = false; │ │ │ │ │ -84 }; │ │ │ │ │ -85 │ │ │ │ │ -86 │ │ │ │ │ -92 template< class K, int SIZE > │ │ │ │ │ -_9_3 class _F_i_e_l_d_V_e_c_t_o_r : │ │ │ │ │ -94 public _D_e_n_s_e_V_e_c_t_o_r< FieldVector > │ │ │ │ │ -95 { │ │ │ │ │ -96 std::array _data; │ │ │ │ │ -97 typedef _D_e_n_s_e_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_K_,_S_I_Z_E_> > _B_a_s_e; │ │ │ │ │ -98 public: │ │ │ │ │ -_1_0_0 constexpr static int _d_i_m_e_n_s_i_o_n = SIZE; │ │ │ │ │ -101 │ │ │ │ │ -_1_0_2 typedef typename _B_a_s_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ -_1_0_3 typedef typename _B_a_s_e_:_:_v_a_l_u_e___t_y_p_e _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -104 │ │ │ │ │ -_1_0_6 typedef _v_a_l_u_e___t_y_p_e& _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -107 │ │ │ │ │ -_1_0_9 typedef const _v_a_l_u_e___t_y_p_e& _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -110 │ │ │ │ │ -_1_1_2 constexpr _F_i_e_l_d_V_e_c_t_o_r() │ │ │ │ │ -113 : _data{{}} │ │ │ │ │ -114 {} │ │ │ │ │ -115 │ │ │ │ │ -_1_1_7 explicit _F_i_e_l_d_V_e_c_t_o_r (const K& t) │ │ │ │ │ -118 { │ │ │ │ │ -119 std::fill(_data.begin(),_data.end(),t); │ │ │ │ │ -120 } │ │ │ │ │ -121 │ │ │ │ │ -122#if __GNUC__ == 5 && !defined(__clang__) │ │ │ │ │ -123 // `... = default;` causes an internal compiler error on GCC 5.4 (Ubuntu │ │ │ │ │ -16.04) │ │ │ │ │ -125 _F_i_e_l_d_V_e_c_t_o_r(const _F_i_e_l_d_V_e_c_t_o_r& x) : _data(x._data) {} │ │ │ │ │ -126#else │ │ │ │ │ -_1_2_8 _F_i_e_l_d_V_e_c_t_o_r (const _F_i_e_l_d_V_e_c_t_o_r&) = default; │ │ │ │ │ -129#endif │ │ │ │ │ -130 │ │ │ │ │ -_1_3_2 _F_i_e_l_d_V_e_c_t_o_r (std::initializer_list const &l) │ │ │ │ │ -133 { │ │ │ │ │ -134 assert(l.size() == dimension);// Actually, this is not needed any more! │ │ │ │ │ -135 std::copy_n(l.begin(), std::min(static_cast(dimension), │ │ │ │ │ -136 l.size()), │ │ │ │ │ -137 _data.begin()); │ │ │ │ │ -138 } │ │ │ │ │ -139 │ │ │ │ │ -_1_4_1 _F_i_e_l_d_V_e_c_t_o_r& operator= (const _F_i_e_l_d_V_e_c_t_o_r&) = default; │ │ │ │ │ -142 │ │ │ │ │ -143 template │ │ │ │ │ -_1_4_4 _F_i_e_l_d_V_e_c_t_o_r& operator= (const _F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _S_I_Z_E_>& x) │ │ │ │ │ -145 { │ │ │ │ │ -146 std::copy_n(x._b_e_g_i_n(), SIZE, _data.begin()); │ │ │ │ │ -147 return *this; │ │ │ │ │ -148 } │ │ │ │ │ -149 │ │ │ │ │ -150 template │ │ │ │ │ -_1_5_1 _F_i_e_l_d_V_e_c_t_o_r& _o_p_e_r_a_t_o_r_=(const _F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _N_>&) = delete; │ │ │ │ │ -152 │ │ │ │ │ -164 template │ │ │ │ │ -_1_6_5 _F_i_e_l_d_V_e_c_t_o_r (const _D_e_n_s_e_V_e_c_t_o_r_<_C_> & x, │ │ │ │ │ -166 [[maybe_unused]] typename std::enable_if<_I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t_<_C_,_S_I_Z_E_>_:_: │ │ │ │ │ -_v_a_l_u_e>::type* dummy=0) │ │ │ │ │ -167 { │ │ │ │ │ -168 // do a run-time size check, for the case that x is not a FieldVector │ │ │ │ │ -169 assert(x._s_i_z_e() == SIZE); // Actually this is not needed any more! │ │ │ │ │ -170 std::copy_n(x._b_e_g_i_n(), std::min(static_cast(SIZE),x._s_i_z_e()), │ │ │ │ │ -_data.begin()); │ │ │ │ │ -171 } │ │ │ │ │ -172 │ │ │ │ │ -174 template │ │ │ │ │ -_1_7_5 explicit _F_i_e_l_d_V_e_c_t_o_r (const _F_i_e_l_d_V_e_c_t_o_r_<_K_1_,_S_I_Z_E_> & x) │ │ │ │ │ -176 { │ │ │ │ │ -177 std::copy_n(x._b_e_g_i_n(), SIZE, _data.begin()); │ │ │ │ │ -178 } │ │ │ │ │ -179 │ │ │ │ │ -180 template │ │ │ │ │ -_1_8_1 explicit _F_i_e_l_d_V_e_c_t_o_r(const _F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _N_>&) = delete; │ │ │ │ │ -182 │ │ │ │ │ -183 using Base::operator=; │ │ │ │ │ -184 │ │ │ │ │ -185 // make this thing a vector │ │ │ │ │ -_1_8_6 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e () { return SIZE; } │ │ │ │ │ -187 │ │ │ │ │ -_1_8_8 K & _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e i) { │ │ │ │ │ -189 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < SIZE); │ │ │ │ │ -190 return _data[i]; │ │ │ │ │ -191 } │ │ │ │ │ -_1_9_2 const K & _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e i) const { │ │ │ │ │ -193 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < SIZE); │ │ │ │ │ -194 return _data[i]; │ │ │ │ │ -195 } │ │ │ │ │ -196 │ │ │ │ │ -_1_9_8 K* _d_a_t_a() noexcept │ │ │ │ │ -199 { │ │ │ │ │ -200 return _data.data(); │ │ │ │ │ -201 } │ │ │ │ │ -202 │ │ │ │ │ -_2_0_4 const K* _d_a_t_a() const noexcept │ │ │ │ │ -205 { │ │ │ │ │ -206 return _data.data(); │ │ │ │ │ -207 } │ │ │ │ │ -208 │ │ │ │ │ -210 template ::value, int> = 0> │ │ │ │ │ -_2_1_2 friend auto _o_p_e_r_a_t_o_r_*_ ( const _F_i_e_l_d_V_e_c_t_o_r& vector, Scalar scalar) │ │ │ │ │ -213 { │ │ │ │ │ -214 _F_i_e_l_d_V_e_c_t_o_r_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_,_S_c_a_l_a_r_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e,SIZE> │ │ │ │ │ -result; │ │ │ │ │ -215 │ │ │ │ │ -216 for (_s_i_z_e___t_y_p_e i = 0; i < vector._s_i_z_e(); ++i) │ │ │ │ │ -217 result[i] = vector[i] * scalar; │ │ │ │ │ -218 │ │ │ │ │ -219 return result; │ │ │ │ │ -220 } │ │ │ │ │ -221 │ │ │ │ │ -223 template ::value, int> = 0> │ │ │ │ │ -_2_2_5 friend auto _o_p_e_r_a_t_o_r_*_ ( Scalar scalar, const _F_i_e_l_d_V_e_c_t_o_r& vector) │ │ │ │ │ -226 { │ │ │ │ │ -227 _F_i_e_l_d_V_e_c_t_o_r_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_,_S_c_a_l_a_r_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e,SIZE> │ │ │ │ │ -result; │ │ │ │ │ -228 │ │ │ │ │ -229 for (_s_i_z_e___t_y_p_e i = 0; i < vector._s_i_z_e(); ++i) │ │ │ │ │ -230 result[i] = scalar * vector[i]; │ │ │ │ │ -231 │ │ │ │ │ -232 return result; │ │ │ │ │ -233 } │ │ │ │ │ -234 │ │ │ │ │ -236 template ::value, int> = 0> │ │ │ │ │ -_2_3_8 friend auto _o_p_e_r_a_t_o_r_/_ ( const _F_i_e_l_d_V_e_c_t_o_r& vector, Scalar scalar) │ │ │ │ │ -239 { │ │ │ │ │ -240 _F_i_e_l_d_V_e_c_t_o_r_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_,_S_c_a_l_a_r_>_:_:_P_r_o_m_o_t_e_d_T_y_p_e,SIZE> │ │ │ │ │ -result; │ │ │ │ │ -241 │ │ │ │ │ -242 for (_s_i_z_e___t_y_p_e i = 0; i < vector._s_i_z_e(); ++i) │ │ │ │ │ -243 result[i] = vector[i] / scalar; │ │ │ │ │ -244 │ │ │ │ │ -245 return result; │ │ │ │ │ -246 } │ │ │ │ │ -247 │ │ │ │ │ -248 }; │ │ │ │ │ -249 │ │ │ │ │ -261 template │ │ │ │ │ -_2_6_2 inline std::istream &operator>> ( std::istream &in, │ │ │ │ │ -263 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _S_I_Z_E_> &v ) │ │ │ │ │ -264 { │ │ │ │ │ -265 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _S_I_Z_E_> w; │ │ │ │ │ -266 for( typename _F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _S_I_Z_E_>_:_:_s_i_z_e___t_y_p_e i = 0; i < SIZE; ++i ) │ │ │ │ │ -267 in >> w[ i ]; │ │ │ │ │ -268 if(in) │ │ │ │ │ -269 v = w; │ │ │ │ │ -270 return in; │ │ │ │ │ -271 } │ │ │ │ │ -272 │ │ │ │ │ -273#ifndef DOXYGEN │ │ │ │ │ -274 template< class K > │ │ │ │ │ -275 struct _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s< _F_i_e_l_d_V_e_c_t_o_r > │ │ │ │ │ -276 { │ │ │ │ │ -277 typedef _F_i_e_l_d_V_e_c_t_o_r_<_K_,_1_> derived_type; │ │ │ │ │ -278 typedef K container_type; │ │ │ │ │ -279 typedef K value_type; │ │ │ │ │ -280 typedef size_t size_type; │ │ │ │ │ -281 }; │ │ │ │ │ -282 │ │ │ │ │ -285 template │ │ │ │ │ -286 class FieldVector : │ │ │ │ │ -287 public DenseVector< FieldVector > │ │ │ │ │ -288 { │ │ │ │ │ -289 K _data; │ │ │ │ │ -290 typedef DenseVector< FieldVector > Base; │ │ │ │ │ -291 public: │ │ │ │ │ -293 constexpr static int dimension = 1; │ │ │ │ │ -294 │ │ │ │ │ -295 typedef typename Base::size_type size_type; │ │ │ │ │ -296 │ │ │ │ │ -298 typedef K& reference; │ │ │ │ │ -299 │ │ │ │ │ -301 typedef const K& const_reference; │ │ │ │ │ -302 │ │ │ │ │ -303 //===== construction │ │ │ │ │ -304 │ │ │ │ │ -306 constexpr FieldVector () │ │ │ │ │ -307 : _data() │ │ │ │ │ -308 {} │ │ │ │ │ -309 │ │ │ │ │ -311 template::value && │ │ │ │ │ -314 ! std::is_base_of::field_type>, K │ │ │ │ │ -315 >::value │ │ │ │ │ -316 >::type │ │ │ │ │ -317 > │ │ │ │ │ -318 FieldVector (const T& k) : _data(k) {} │ │ │ │ │ -319 │ │ │ │ │ -321 template::value_type>::value, int> = │ │ │ │ │ -0> │ │ │ │ │ -324 FieldVector (const DenseVector & x) │ │ │ │ │ -325 { │ │ │ │ │ -326 static_assert(((bool)IsFieldVectorSizeCorrect::value), "FieldVectors │ │ │ │ │ -do not match in dimension!"); │ │ │ │ │ -327 assert(x.size() == 1); │ │ │ │ │ -328 _data = x[0]; │ │ │ │ │ -329 } │ │ │ │ │ -330 │ │ │ │ │ -332 FieldVector(const FieldVector&) = default; │ │ │ │ │ -333 │ │ │ │ │ -335 FieldVector& operator=(const FieldVector&) = default; │ │ │ │ │ -336 │ │ │ │ │ -337 template │ │ │ │ │ -338 FieldVector& operator= (const FieldVector& other) │ │ │ │ │ -339 { │ │ │ │ │ -340 _data = other[0]; │ │ │ │ │ -341 return *this; │ │ │ │ │ -342 } │ │ │ │ │ -343 │ │ │ │ │ -344 template │ │ │ │ │ -345 FieldVector& operator=(const FieldVector&) = delete; │ │ │ │ │ -346 │ │ │ │ │ -348 FieldVector (std::initializer_list const &l) │ │ │ │ │ -349 { │ │ │ │ │ -350 assert(l.size() == 1); │ │ │ │ │ -351 _data = *l.begin(); │ │ │ │ │ -352 } │ │ │ │ │ -353 │ │ │ │ │ -355 template::value && │ │ │ │ │ -358 ! std::is_base_of::field_type>, K │ │ │ │ │ -359 >::value │ │ │ │ │ -360 >::type │ │ │ │ │ -361 > │ │ │ │ │ -362 inline FieldVector& operator= (const T& k) │ │ │ │ │ -363 { │ │ │ │ │ -364 _data = k; │ │ │ │ │ -365 return *this; │ │ │ │ │ -366 } │ │ │ │ │ -367 │ │ │ │ │ -368 //===== forward methods to container │ │ │ │ │ -369 static constexpr size_type size () { return 1; } │ │ │ │ │ -370 │ │ │ │ │ -371 K & operator[]([[maybe_unused]] size_type i) │ │ │ │ │ -372 { │ │ │ │ │ -373 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i == 0); │ │ │ │ │ -374 return _data; │ │ │ │ │ -375 } │ │ │ │ │ -376 const K & operator[]([[maybe_unused]] size_type i) const │ │ │ │ │ -377 { │ │ │ │ │ -378 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i == 0); │ │ │ │ │ -379 return _data; │ │ │ │ │ -380 } │ │ │ │ │ -381 │ │ │ │ │ -383 K* data() noexcept │ │ │ │ │ -384 { │ │ │ │ │ -385 return &_data; │ │ │ │ │ -386 } │ │ │ │ │ -387 │ │ │ │ │ -389 const K* data() const noexcept │ │ │ │ │ -390 { │ │ │ │ │ -391 return &_data; │ │ │ │ │ -392 } │ │ │ │ │ -393 │ │ │ │ │ -394 //===== conversion operator │ │ │ │ │ -395 │ │ │ │ │ -397 operator K& () { return _data; } │ │ │ │ │ -398 │ │ │ │ │ -400 operator const K& () const { return _data; } │ │ │ │ │ -401 }; │ │ │ │ │ -402 │ │ │ │ │ -403 /* ----- FV / FV ----- */ │ │ │ │ │ -404 /* mostly not necessary as these operations are already covered via the │ │ │ │ │ -cast operator */ │ │ │ │ │ -405 │ │ │ │ │ -407 template │ │ │ │ │ -408 inline bool operator> (const FieldVector& a, const FieldVector& │ │ │ │ │ -b) │ │ │ │ │ -409 { │ │ │ │ │ -410 return a[0]>b[0]; │ │ │ │ │ -411 } │ │ │ │ │ -412 │ │ │ │ │ -414 template │ │ │ │ │ -415 inline bool operator>= (const FieldVector& a, const FieldVector& │ │ │ │ │ -b) │ │ │ │ │ -416 { │ │ │ │ │ -417 return a[0]>=b[0]; │ │ │ │ │ -418 } │ │ │ │ │ -419 │ │ │ │ │ -421 template │ │ │ │ │ -422 inline bool operator< (const FieldVector& a, const FieldVector& │ │ │ │ │ -b) │ │ │ │ │ -423 { │ │ │ │ │ -424 return a[0] │ │ │ │ │ -429 inline bool operator<= (const FieldVector& a, const FieldVector& │ │ │ │ │ -b) │ │ │ │ │ -430 { │ │ │ │ │ -431 return a[0]<=b[0]; │ │ │ │ │ -432 } │ │ │ │ │ -433 │ │ │ │ │ -434 /* ----- FV / scalar ----- */ │ │ │ │ │ -435 │ │ │ │ │ -437 template │ │ │ │ │ -438 inline FieldVector operator+ (const FieldVector& a, const K b) │ │ │ │ │ -439 { │ │ │ │ │ -440 return a[0]+b; │ │ │ │ │ -441 } │ │ │ │ │ -442 │ │ │ │ │ -444 template │ │ │ │ │ -445 inline FieldVector operator- (const FieldVector& a, const K b) │ │ │ │ │ -446 { │ │ │ │ │ -447 return a[0]-b; │ │ │ │ │ -448 } │ │ │ │ │ -449 │ │ │ │ │ -451 template │ │ │ │ │ -452 inline FieldVector operator* (const FieldVector& a, const K b) │ │ │ │ │ -453 { │ │ │ │ │ -454 return a[0]*b; │ │ │ │ │ -455 } │ │ │ │ │ -456 │ │ │ │ │ -458 template │ │ │ │ │ -459 inline FieldVector operator/ (const FieldVector& a, const K b) │ │ │ │ │ -460 { │ │ │ │ │ -461 return a[0]/b; │ │ │ │ │ -462 } │ │ │ │ │ -463 │ │ │ │ │ -465 template │ │ │ │ │ -466 inline bool operator> (const FieldVector& a, const K b) │ │ │ │ │ -467 { │ │ │ │ │ -468 return a[0]>b; │ │ │ │ │ -469 } │ │ │ │ │ -470 │ │ │ │ │ -472 template │ │ │ │ │ -473 inline bool operator>= (const FieldVector& a, const K b) │ │ │ │ │ -474 { │ │ │ │ │ -475 return a[0]>=b; │ │ │ │ │ -476 } │ │ │ │ │ -477 │ │ │ │ │ -479 template │ │ │ │ │ -480 inline bool operator< (const FieldVector& a, const K b) │ │ │ │ │ -481 { │ │ │ │ │ -482 return a[0] │ │ │ │ │ -487 inline bool operator<= (const FieldVector& a, const K b) │ │ │ │ │ -488 { │ │ │ │ │ -489 return a[0]<=b; │ │ │ │ │ -490 } │ │ │ │ │ -491 │ │ │ │ │ -493 template │ │ │ │ │ -494 inline bool operator== (const FieldVector& a, const K b) │ │ │ │ │ -495 { │ │ │ │ │ -496 return a[0]==b; │ │ │ │ │ -497 } │ │ │ │ │ -498 │ │ │ │ │ -500 template │ │ │ │ │ -501 inline bool operator!= (const FieldVector& a, const K b) │ │ │ │ │ -502 { │ │ │ │ │ -503 return a[0]!=b; │ │ │ │ │ -504 } │ │ │ │ │ -505 │ │ │ │ │ -506 /* ----- scalar / FV ------ */ │ │ │ │ │ -507 │ │ │ │ │ -509 template │ │ │ │ │ -510 inline FieldVector operator+ (const K a, const FieldVector& b) │ │ │ │ │ -511 { │ │ │ │ │ -512 return a+b[0]; │ │ │ │ │ -513 } │ │ │ │ │ -514 │ │ │ │ │ -516 template │ │ │ │ │ -517 inline FieldVector operator- (const K a, const FieldVector& b) │ │ │ │ │ -518 { │ │ │ │ │ -519 return a-b[0]; │ │ │ │ │ -520 } │ │ │ │ │ -521 │ │ │ │ │ -523 template │ │ │ │ │ -524 inline FieldVector operator* (const K a, const FieldVector& b) │ │ │ │ │ -525 { │ │ │ │ │ -526 return a*b[0]; │ │ │ │ │ -527 } │ │ │ │ │ -528 │ │ │ │ │ -530 template │ │ │ │ │ -531 inline FieldVector operator/ (const K a, const FieldVector& b) │ │ │ │ │ -532 { │ │ │ │ │ -533 return a/b[0]; │ │ │ │ │ -534 } │ │ │ │ │ -535 │ │ │ │ │ -537 template │ │ │ │ │ -538 inline bool operator> (const K a, const FieldVector& b) │ │ │ │ │ -539 { │ │ │ │ │ -540 return a>b[0]; │ │ │ │ │ -541 } │ │ │ │ │ -542 │ │ │ │ │ -544 template │ │ │ │ │ -545 inline bool operator>= (const K a, const FieldVector& b) │ │ │ │ │ -546 { │ │ │ │ │ -547 return a>=b[0]; │ │ │ │ │ -548 } │ │ │ │ │ -549 │ │ │ │ │ -551 template │ │ │ │ │ -552 inline bool operator< (const K a, const FieldVector& b) │ │ │ │ │ -553 { │ │ │ │ │ -554 return a │ │ │ │ │ -559 inline bool operator<= (const K a, const FieldVector& b) │ │ │ │ │ -560 { │ │ │ │ │ -561 return a<=b[0]; │ │ │ │ │ -562 } │ │ │ │ │ -563 │ │ │ │ │ -565 template │ │ │ │ │ -566 inline bool operator== (const K a, const FieldVector& b) │ │ │ │ │ -567 { │ │ │ │ │ -568 return a==b[0]; │ │ │ │ │ -569 } │ │ │ │ │ -570 │ │ │ │ │ -572 template │ │ │ │ │ -573 inline bool operator!= (const K a, const FieldVector& b) │ │ │ │ │ -574 { │ │ │ │ │ -575 return a!=b[0]; │ │ │ │ │ -576 } │ │ │ │ │ -577#endif │ │ │ │ │ -578 │ │ │ │ │ -579 /* Overloads for common classification functions */ │ │ │ │ │ -_5_8_0 namespace MathOverloads { │ │ │ │ │ -581 │ │ │ │ │ -582 // ! Returns whether all entries are finite │ │ │ │ │ -583 template │ │ │ │ │ -_5_8_4 auto _i_s_F_i_n_i_t_e(const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_S_I_Z_E_> &b, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ -585 bool out = true; │ │ │ │ │ -586 for(int i=0; i │ │ │ │ │ -_5_9_4 bool _i_s_I_n_f(const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_S_I_Z_E_> &b, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ -595 bool out = false; │ │ │ │ │ -596 for(int i=0; i::value>> │ │ │ │ │ -_6_0_4 bool _i_s_N_a_N(const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_S_I_Z_E_> &b, _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ -605 bool out = false; │ │ │ │ │ -606 for(int i=0; i::value>> │ │ │ │ │ -_6_1_4 bool _i_s_U_n_o_r_d_e_r_e_d(const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_1_> &b, const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_1_> &c, │ │ │ │ │ -615 _P_r_i_o_r_i_t_y_T_a_g_<_2_>, _A_D_L_T_a_g) { │ │ │ │ │ -616 return Dune::isUnordered(b[0],c[0]); │ │ │ │ │ -617 } │ │ │ │ │ -618 } //MathOverloads │ │ │ │ │ -619 │ │ │ │ │ -622} // end namespace │ │ │ │ │ -623 │ │ │ │ │ -624#endif │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_m_a_t_h_._h_h │ │ │ │ │ -Some useful basic math stuff. │ │ │ │ │ -_f_t_r_a_i_t_s_._h_h │ │ │ │ │ -Type traits to determine the type of reals (when working with complex numbers) │ │ │ │ │ -_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ -Macro for wrapping boundary checks. │ │ │ │ │ -_d_e_n_s_e_v_e_c_t_o_r_._h_h │ │ │ │ │ -Implements the dense vector interface, with an exchangeable storage class. │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h │ │ │ │ │ -Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ -number types. │ │ │ │ │ -_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ -#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ -If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ -nothing. │ │ │ │ │ -DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:549 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_/ │ │ │ │ │ -bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:556 │ │ │ │ │ +_3_5 inline void _a_s_s_e_r_t_C_a_l_l_O_n_c_e(const char *file = nullptr, int line = -1, │ │ │ │ │ +36 const char *function = nullptr) │ │ │ │ │ +37 { │ │ │ │ │ +38 // make sure to call this only the first time this function is invoked │ │ │ │ │ +39 [[maybe_unused]] static const bool works │ │ │ │ │ +40 = (_d_o_A_s_s_e_r_t_C_a_l_l_O_n_c_e(file, line, function), true); │ │ │ │ │ +41 } │ │ │ │ │ +42 │ │ │ │ │ +45 │ │ │ │ │ +_4_9#define DUNE_ASSERT_CALL_ONCE() \ │ │ │ │ │ +50 ::Dune::assertCallOnce(__FILE__, __LINE__, __func__) │ │ │ │ │ +51 │ │ │ │ │ +52} // namespace Dune │ │ │ │ │ +53 │ │ │ │ │ +54#endif // DUNE_COMMON_STDTHREAD_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_N_a_N │ │ │ │ │ -bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:604 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_I_n_f │ │ │ │ │ -bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:594 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_F_i_n_i_t_e │ │ │ │ │ -auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:584 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_i_s_U_n_o_r_d_e_r_e_d │ │ │ │ │ -bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, │ │ │ │ │ -PriorityTag< 2 >, ADLTag) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:614 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -vector space out of a tensor product of fields. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_d_a_t_a │ │ │ │ │ -K * data() noexcept │ │ │ │ │ -return pointer to underlying array │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:198 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -constexpr FieldVector() │ │ │ │ │ -Constructor making default-initialized vector. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -const value_type & const_reference │ │ │ │ │ -The type used for const references to the vector entry. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:109 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Base::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:102 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -FieldVector(const DenseVector< C > &x, typename std::enable_if< │ │ │ │ │ -IsFieldVectorSizeCorrect< C, SIZE >::value >::type *dummy=0) │ │ │ │ │ -Copy constructor from a second vector of possibly different type. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:165 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -FieldVector(const FieldVector< T, N > &)=delete │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -FieldVector(const K &t) │ │ │ │ │ -Constructor making vector with identical coordinates. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:117 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -FieldVector(std::initializer_list< K > const &l) │ │ │ │ │ -Construct from a std::initializer_list. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:132 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_d_a_t_a │ │ │ │ │ -const K * data() const noexcept │ │ │ │ │ -return pointer to underlying array │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:204 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_d_i_m_e_n_s_i_o_n │ │ │ │ │ -static constexpr int dimension │ │ │ │ │ -The size of this vector. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -FieldVector(const FieldVector< K1, SIZE > &x) │ │ │ │ │ -Constructor making vector with identical coordinates. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:175 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ -static constexpr size_type size() │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:186 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -K & operator[](size_type i) │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -value_type & reference │ │ │ │ │ -The type used for references to the vector entry. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -Base::value_type value_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:103 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -const K & operator[](size_type i) const │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:192 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -FieldVector & operator=(const FieldVector< T, N > &)=delete │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -FieldVector(const FieldVector &)=default │ │ │ │ │ -Copy constructor. │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r │ │ │ │ │ -Interface for a class of dense vectors over a given field. │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:229 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -Traits::value_type value_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:250 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ -Iterator begin() │ │ │ │ │ -begin iterator │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ -size_type size() const │ │ │ │ │ -size method │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:336 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Traits::size_type size_type │ │ │ │ │ -The type used for the index access and size operation. │ │ │ │ │ -DDeeffiinniittiioonn densevector.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -T field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -T real_type │ │ │ │ │ -export the type representing the real type of the field │ │ │ │ │ -DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -K value_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_c_o_n_t_a_i_n_e_r___t_y_p_e │ │ │ │ │ -std::array< K, SIZE > container_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -container_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ -FieldVector< K, SIZE > derived_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -FieldTraits< K >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _S_I_Z_E_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -FieldTraits< K >::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t │ │ │ │ │ -TMP to check the size of a DenseVectors statically, if possible. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_I_s_F_i_e_l_d_V_e_c_t_o_r_S_i_z_e_C_o_r_r_e_c_t_:_:_v_a_l_u_e │ │ │ │ │ -static constexpr bool value │ │ │ │ │ -True if C is not of type FieldVector or its dimension is not equal SIZE. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_h_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ -Tag to make sure the functions in this namespace can be found by ADL. │ │ │ │ │ -DDeeffiinniittiioonn math.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn matvectraits.hh:31 │ │ │ │ │ -_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g │ │ │ │ │ -Helper class for tagging priorities. │ │ │ │ │ -DDeeffiinniittiioonn typeutilities.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_a_s_s_e_r_t_C_a_l_l_O_n_c_e │ │ │ │ │ +void assertCallOnce(const char *file=nullptr, int line=-1, const char │ │ │ │ │ +*function=nullptr) │ │ │ │ │ +Make sure call_once() works and provide a helpful error message otherwise. │ │ │ │ │ +DDeeffiinniittiioonn stdthread.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_d_o_A_s_s_e_r_t_C_a_l_l_O_n_c_e │ │ │ │ │ +void doAssertCallOnce(const char *file, int line, const char *function) │ │ │ │ │ +DDeeffiinniittiioonn stdthread.cc:42 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00182.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: indices.hh File Reference │ │ │ │ +dune-common: debugallocator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -69,115 +69,19 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions | │ │ │ │ -Variables
    │ │ │ │ -
    indices.hh File Reference
    │ │ │ │ +
    debugallocator.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include <cstddef>
    │ │ │ │ -#include <type_traits>
    │ │ │ │ -#include <utility>
    │ │ │ │ -#include <dune/common/keywords.hh>
    │ │ │ │ -
    │ │ │ │ + │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Indices
     Namespace with predefined compile time indices for the range [0,19].
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Typedefs

    template<std::size_t i>
    using Dune::index_constant = std::integral_constant< std::size_t, i >
     An index constant with value i.
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Functions

    template<class F , class I , I... i>
    decltype(auto) constexpr Dune::unpackIntegerSequence (F &&f, std::integer_sequence< I, i... > sequence)
     Unpack an std::integer_sequence<I,i...> to std::integral_constant<I,i>...
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Variables

    constexpr index_constant< 0 > Dune::Indices::_0 = {}
     Compile time index with value 0.
     
    constexpr index_constant< 1 > Dune::Indices::_1 = {}
     Compile time index with value 1.
     
    constexpr index_constant< 2 > Dune::Indices::_2 = {}
     Compile time index with value 2.
     
    constexpr index_constant< 3 > Dune::Indices::_3 = {}
     Compile time index with value 3.
     
    constexpr index_constant< 4 > Dune::Indices::_4 = {}
     Compile time index with value 4.
     
    constexpr index_constant< 5 > Dune::Indices::_5 = {}
     Compile time index with value 5.
     
    constexpr index_constant< 6 > Dune::Indices::_6 = {}
     Compile time index with value 6.
     
    constexpr index_constant< 7 > Dune::Indices::_7 = {}
     Compile time index with value 7.
     
    constexpr index_constant< 8 > Dune::Indices::_8 = {}
     Compile time index with value 8.
     
    constexpr index_constant< 9 > Dune::Indices::_9 = {}
     Compile time index with value 9.
     
    constexpr index_constant< 10 > Dune::Indices::_10 = {}
     Compile time index with value 10.
     
    constexpr index_constant< 11 > Dune::Indices::_11 = {}
     Compile time index with value 11.
     
    constexpr index_constant< 12 > Dune::Indices::_12 = {}
     Compile time index with value 12.
     
    constexpr index_constant< 13 > Dune::Indices::_13 = {}
     Compile time index with value 13.
     
    constexpr index_constant< 14 > Dune::Indices::_14 = {}
     Compile time index with value 14.
     
    constexpr index_constant< 15 > Dune::Indices::_15 = {}
     Compile time index with value 15.
     
    constexpr index_constant< 16 > Dune::Indices::_16 = {}
     Compile time index with value 16.
     
    constexpr index_constant< 17 > Dune::Indices::_17 = {}
     Compile time index with value 17.
     
    constexpr index_constant< 18 > Dune::Indices::_18 = {}
     Compile time index with value 18.
     
    constexpr index_constant< 19 > Dune::Indices::_19 = {}
     Compile time index with value 19.
     
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,96 +1,10 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ -indices.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_k_e_y_w_o_r_d_s_._h_h> │ │ │ │ │ +debugallocator.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_. │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_I_n_d_i_c_e_s │ │ │ │ │ -  Namespace with predefined compile time indices for the range │ │ │ │ │ - [0,19]. │ │ │ │ │ -  │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t = std::integral_constant< std::size_t, i > │ │ │ │ │ -  An index constant with value i. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -decltype(auto) constexpr  _D_u_n_e_:_:_u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e (F &&f, std:: │ │ │ │ │ - integer_sequence< I, i... > sequence) │ │ │ │ │ -  Unpack an std::integer_sequence to std:: │ │ │ │ │ - integral_constant... │ │ │ │ │ -  │ │ │ │ │ -VVaarriiaabblleess │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 0 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___0 = {} │ │ │ │ │ -  Compile time index with value 0. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 1 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1 = {} │ │ │ │ │ -  Compile time index with value 1. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 2 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___2 = {} │ │ │ │ │ -  Compile time index with value 2. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 3 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___3 = {} │ │ │ │ │ -  Compile time index with value 3. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 4 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___4 = {} │ │ │ │ │ -  Compile time index with value 4. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 5 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___5 = {} │ │ │ │ │ -  Compile time index with value 5. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 6 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___6 = {} │ │ │ │ │ -  Compile time index with value 6. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 7 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___7 = {} │ │ │ │ │ -  Compile time index with value 7. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 8 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___8 = {} │ │ │ │ │ -  Compile time index with value 8. │ │ │ │ │ -  │ │ │ │ │ - constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 9 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___9 = {} │ │ │ │ │ -  Compile time index with value 9. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 10 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_0 = {} │ │ │ │ │ -  Compile time index with value 10. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 11 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_1 = {} │ │ │ │ │ -  Compile time index with value 11. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 12 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_2 = {} │ │ │ │ │ -  Compile time index with value 12. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 13 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_3 = {} │ │ │ │ │ -  Compile time index with value 13. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 14 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_4 = {} │ │ │ │ │ -  Compile time index with value 14. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 15 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_5 = {} │ │ │ │ │ -  Compile time index with value 15. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 16 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_6 = {} │ │ │ │ │ -  Compile time index with value 16. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 17 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_7 = {} │ │ │ │ │ -  Compile time index with value 17. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 18 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_8 = {} │ │ │ │ │ -  Compile time index with value 18. │ │ │ │ │ -  │ │ │ │ │ -constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t< 19 >  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_9 = {} │ │ │ │ │ -  Compile time index with value 19. │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00182_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: indices.hh Source File │ │ │ │ +dune-common: debugallocator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,119 +74,344 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    indices.hh
    │ │ │ │ +
    debugallocator.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5
    │ │ │ │ -
    6#ifndef DUNE_COMMON_INDICES_HH
    │ │ │ │ -
    7#define DUNE_COMMON_INDICES_HH
    │ │ │ │ -
    8
    │ │ │ │ -
    9#include <cstddef>
    │ │ │ │ -
    10#include <type_traits>
    │ │ │ │ -
    11#include <utility>
    │ │ │ │ -
    12
    │ │ │ │ - │ │ │ │ -
    14
    │ │ │ │ -
    15namespace Dune
    │ │ │ │ -
    16{
    │ │ │ │ -
    29 template<std::size_t i>
    │ │ │ │ -
    30 using index_constant = std::integral_constant<std::size_t, i>;
    │ │ │ │ +
    5#ifndef DUNE_DEBUG_ALLOCATOR_HH
    │ │ │ │ +
    6#define DUNE_DEBUG_ALLOCATOR_HH
    │ │ │ │ +
    7
    │ │ │ │ +
    8#if __has_include(<sys/mman.h>)
    │ │ │ │ +
    9
    │ │ │ │ +
    10#include <sys/mman.h>
    │ │ │ │ +
    11#define HAVE_SYS_MMAN_H 1
    │ │ │ │ +
    12#define HAVE_MPROTECT 1
    │ │ │ │ +
    13
    │ │ │ │ +
    14#include <exception>
    │ │ │ │ +
    15#include <typeinfo>
    │ │ │ │ +
    16#include <vector>
    │ │ │ │ +
    17#include <iostream>
    │ │ │ │ +
    18#include <cstring>
    │ │ │ │ +
    19#include <cstdint>
    │ │ │ │ +
    20#include <cstdlib>
    │ │ │ │ +
    21#include <new>
    │ │ │ │ +
    22
    │ │ │ │ +
    23#include "mallocallocator.hh"
    │ │ │ │ +
    24
    │ │ │ │ +
    25namespace Dune
    │ │ │ │ +
    26{
    │ │ │ │ +
    27
    │ │ │ │ +
    28#ifndef DOXYGEN // hide implementation details from doxygen
    │ │ │ │ +
    29 namespace DebugMemory
    │ │ │ │ +
    30 {
    │ │ │ │
    31
    │ │ │ │ -
    32
    │ │ │ │ +
    32 extern const std::ptrdiff_t page_size;
    │ │ │ │
    33
    │ │ │ │ -
    │ │ │ │ -
    50 namespace Indices
    │ │ │ │ -
    51 {
    │ │ │ │ - │ │ │ │ -
    54
    │ │ │ │ - │ │ │ │ -
    57
    │ │ │ │ - │ │ │ │ -
    60
    │ │ │ │ - │ │ │ │ +
    34 struct AllocationManager
    │ │ │ │ +
    35 {
    │ │ │ │ +
    36 typedef std::size_t size_type;
    │ │ │ │ +
    37 typedef std::ptrdiff_t difference_type;
    │ │ │ │ +
    38 typedef void* pointer;
    │ │ │ │ +
    39
    │ │ │ │ +
    40 protected:
    │ │ │ │ +
    41 static void allocation_error(const char* msg);
    │ │ │ │ +
    42
    │ │ │ │ +
    43 struct AllocationInfo;
    │ │ │ │ +
    44 friend struct AllocationInfo;
    │ │ │ │ +
    45
    │ │ │ │ +
    46#define ALLOCATION_ASSERT(A) { if (!(A)) \
    │ │ │ │ +
    47 { allocation_error("Assertion " # A " failed");\
    │ │ │ │ +
    48 }\
    │ │ │ │ +
    49};
    │ │ │ │ +
    50
    │ │ │ │ +
    51 struct AllocationInfo
    │ │ │ │ +
    52 {
    │ │ │ │ +
    53 AllocationInfo(const std::type_info & t) : type(&t) {}
    │ │ │ │ +
    54 const std::type_info * type;
    │ │ │ │ +
    55
    │ │ │ │ +
    56 pointer page_ptr;
    │ │ │ │ +
    57 pointer ptr;
    │ │ │ │ +
    58 size_type pages;
    │ │ │ │ +
    59 size_type capacity;
    │ │ │ │ +
    60 size_type size;
    │ │ │ │ +
    61 bool not_free;
    │ │ │ │ +
    62 };
    │ │ │ │
    63
    │ │ │ │ - │ │ │ │ -
    66
    │ │ │ │ - │ │ │ │ -
    69
    │ │ │ │ - │ │ │ │ -
    72
    │ │ │ │ - │ │ │ │ -
    75
    │ │ │ │ - │ │ │ │ -
    78
    │ │ │ │ - │ │ │ │ -
    81
    │ │ │ │ - │ │ │ │ -
    84
    │ │ │ │ - │ │ │ │ -
    87
    │ │ │ │ - │ │ │ │ -
    90
    │ │ │ │ - │ │ │ │ -
    93
    │ │ │ │ - │ │ │ │ -
    96
    │ │ │ │ - │ │ │ │ -
    99
    │ │ │ │ - │ │ │ │ -
    102
    │ │ │ │ - │ │ │ │ -
    105
    │ │ │ │ - │ │ │ │ -
    108
    │ │ │ │ - │ │ │ │ -
    111
    │ │ │ │ -
    112 } // namespace Indices
    │ │ │ │ -
    │ │ │ │ -
    113
    │ │ │ │ -
    124 template<class F, class I, I... i>
    │ │ │ │ -
    │ │ │ │ -
    125 decltype(auto) constexpr unpackIntegerSequence(F&& f, std::integer_sequence<I, i...> sequence)
    │ │ │ │ -
    126 {
    │ │ │ │ -
    127 return f(std::integral_constant<I, i>()...);
    │ │ │ │ -
    128 }
    │ │ │ │ -
    │ │ │ │ -
    129
    │ │ │ │ -
    130} //namespace Dune
    │ │ │ │ -
    131
    │ │ │ │ -
    132#endif // DUNE_COMMON_INDICES_HH
    │ │ │ │ -
    Definitions of several macros that conditionally make C++ syntax available.
    │ │ │ │ -
    #define DUNE_INLINE_VARIABLE
    Definition keywords.hh:19
    │ │ │ │ -
    constexpr index_constant< 16 > _16
    Compile time index with value 16.
    Definition indices.hh:101
    │ │ │ │ -
    constexpr index_constant< 15 > _15
    Compile time index with value 15.
    Definition indices.hh:98
    │ │ │ │ -
    constexpr index_constant< 8 > _8
    Compile time index with value 8.
    Definition indices.hh:77
    │ │ │ │ -
    constexpr index_constant< 7 > _7
    Compile time index with value 7.
    Definition indices.hh:74
    │ │ │ │ -
    constexpr index_constant< 0 > _0
    Compile time index with value 0.
    Definition indices.hh:53
    │ │ │ │ -
    constexpr index_constant< 9 > _9
    Compile time index with value 9.
    Definition indices.hh:80
    │ │ │ │ -
    constexpr index_constant< 14 > _14
    Compile time index with value 14.
    Definition indices.hh:95
    │ │ │ │ -
    constexpr index_constant< 1 > _1
    Compile time index with value 1.
    Definition indices.hh:56
    │ │ │ │ -
    constexpr index_constant< 3 > _3
    Compile time index with value 3.
    Definition indices.hh:62
    │ │ │ │ -
    constexpr index_constant< 12 > _12
    Compile time index with value 12.
    Definition indices.hh:89
    │ │ │ │ -
    decltype(auto) constexpr unpackIntegerSequence(F &&f, std::integer_sequence< I, i... > sequence)
    Unpack an std::integer_sequence<I,i...> to std::integral_constant<I,i>...
    Definition indices.hh:125
    │ │ │ │ -
    constexpr index_constant< 11 > _11
    Compile time index with value 11.
    Definition indices.hh:86
    │ │ │ │ -
    constexpr index_constant< 18 > _18
    Compile time index with value 18.
    Definition indices.hh:107
    │ │ │ │ -
    constexpr index_constant< 13 > _13
    Compile time index with value 13.
    Definition indices.hh:92
    │ │ │ │ -
    constexpr index_constant< 5 > _5
    Compile time index with value 5.
    Definition indices.hh:68
    │ │ │ │ -
    constexpr index_constant< 17 > _17
    Compile time index with value 17.
    Definition indices.hh:104
    │ │ │ │ -
    constexpr index_constant< 10 > _10
    Compile time index with value 10.
    Definition indices.hh:83
    │ │ │ │ -
    constexpr index_constant< 2 > _2
    Compile time index with value 2.
    Definition indices.hh:59
    │ │ │ │ -
    std::integral_constant< std::size_t, i > index_constant
    An index constant with value i.
    Definition indices.hh:30
    │ │ │ │ -
    constexpr index_constant< 19 > _19
    Compile time index with value 19.
    Definition indices.hh:110
    │ │ │ │ -
    constexpr index_constant< 6 > _6
    Compile time index with value 6.
    Definition indices.hh:71
    │ │ │ │ -
    constexpr index_constant< 4 > _4
    Compile time index with value 4.
    Definition indices.hh:65
    │ │ │ │ +
    64 typedef MallocAllocator<AllocationInfo> Alloc;
    │ │ │ │ +
    65 typedef std::vector<AllocationInfo, Alloc> AllocationList;
    │ │ │ │ +
    66 AllocationList allocation_list;
    │ │ │ │ +
    67
    │ │ │ │ +
    68 private:
    │ │ │ │ +
    69 void memprotect([[maybe_unused]] void* from,
    │ │ │ │ +
    70 [[maybe_unused]] difference_type len,
    │ │ │ │ +
    71 [[maybe_unused]] int prot)
    │ │ │ │ +
    72 {
    │ │ │ │ +
    73#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
    │ │ │ │ +
    74 int result = mprotect(from, len, prot);
    │ │ │ │ +
    75 if (result == -1)
    │ │ │ │ +
    76 {
    │ │ │ │ +
    77
    │ │ │ │ +
    78 std::cerr << "ERROR: (" << result << ": " << strerror(result) << ")" << std::endl;
    │ │ │ │ +
    79 std::cerr << " Failed to ";
    │ │ │ │ +
    80 if (prot == PROT_NONE)
    │ │ │ │ +
    81 std::cerr << "protect ";
    │ │ │ │ +
    82 else
    │ │ │ │ +
    83 std::cerr << "unprotect ";
    │ │ │ │ +
    84 std::cerr << "memory range: "
    │ │ │ │ +
    85 << from << ", "
    │ │ │ │ +
    86 << static_cast<void*>(
    │ │ │ │ +
    87 static_cast<char*>(from) + len)
    │ │ │ │ +
    88 << std::endl;
    │ │ │ │ +
    89 abort();
    │ │ │ │ +
    90 }
    │ │ │ │ +
    91#else
    │ │ │ │ +
    92 std::cerr << "WARNING: memory protection not available" << std::endl;
    │ │ │ │ +
    93#endif
    │ │ │ │ +
    94 }
    │ │ │ │ +
    95
    │ │ │ │ +
    96 public:
    │ │ │ │ +
    97
    │ │ │ │ +
    98 ~AllocationManager ()
    │ │ │ │ +
    99 {
    │ │ │ │ +
    100 AllocationList::iterator it;
    │ │ │ │ +
    101 bool error = false;
    │ │ │ │ +
    102 for (it=allocation_list.begin(); it!=allocation_list.end(); it++)
    │ │ │ │ +
    103 {
    │ │ │ │ +
    104 if (it->not_free)
    │ │ │ │ +
    105 {
    │ │ │ │ +
    106 std::cerr << "ERROR: found memory chunk still in use: " <<
    │ │ │ │ +
    107 it->capacity << " bytes at " << it->ptr << std::endl;
    │ │ │ │ +
    108 error = true;
    │ │ │ │ +
    109 }
    │ │ │ │ +
    110 munmap(it->page_ptr, it->pages * page_size);
    │ │ │ │ +
    111 }
    │ │ │ │ +
    112 if (error)
    │ │ │ │ +
    113 allocation_error("lost allocations");
    │ │ │ │ +
    114 }
    │ │ │ │ +
    115
    │ │ │ │ +
    116 template<typename T>
    │ │ │ │ +
    117 T* allocate(size_type n)
    │ │ │ │ +
    118 {
    │ │ │ │ +
    119 // setup chunk info
    │ │ │ │ +
    120 AllocationInfo ai(typeid(T));
    │ │ │ │ +
    121 ai.size = n;
    │ │ │ │ +
    122 ai.capacity = n * sizeof(T);
    │ │ │ │ +
    123 ai.pages = (ai.capacity) / page_size + 2;
    │ │ │ │ +
    124 ai.not_free = true;
    │ │ │ │ +
    125 size_type overlap = ai.capacity % page_size;
    │ │ │ │ +
    126 ai.page_ptr = mmap(NULL, ai.pages * page_size,
    │ │ │ │ +
    127 PROT_READ | PROT_WRITE,
    │ │ │ │ +
    128#ifdef __APPLE__
    │ │ │ │ +
    129 MAP_ANON | MAP_PRIVATE,
    │ │ │ │ +
    130#else
    │ │ │ │ +
    131 MAP_ANONYMOUS | MAP_PRIVATE,
    │ │ │ │ +
    132#endif
    │ │ │ │ +
    133 -1, 0);
    │ │ │ │ +
    134 if (MAP_FAILED == ai.page_ptr)
    │ │ │ │ +
    135 {
    │ │ │ │ +
    136 throw std::bad_alloc();
    │ │ │ │ +
    137 }
    │ │ │ │ +
    138 ai.ptr = static_cast<char*>(ai.page_ptr) + page_size - overlap;
    │ │ │ │ +
    139 // write protect memory behind the actual data
    │ │ │ │ +
    140 memprotect(static_cast<char*>(ai.page_ptr) + (ai.pages-1) * page_size,
    │ │ │ │ +
    141 page_size,
    │ │ │ │ +
    142 PROT_NONE);
    │ │ │ │ +
    143 // remember the chunk
    │ │ │ │ +
    144 allocation_list.push_back(ai);
    │ │ │ │ +
    145 // return the ptr
    │ │ │ │ +
    146 return static_cast<T*>(ai.ptr);
    │ │ │ │ +
    147 }
    │ │ │ │ +
    148
    │ │ │ │ +
    149 template<typename T>
    │ │ │ │ +
    150 void deallocate(T* ptr, size_type n = 0) noexcept
    │ │ │ │ +
    151 {
    │ │ │ │ +
    152 // compute page address
    │ │ │ │ +
    153 void* page_ptr =
    │ │ │ │ +
    154 static_cast<void*>(
    │ │ │ │ +
    155 (char*)(ptr) - ((std::uintptr_t)(ptr) % page_size));
    │ │ │ │ +
    156 // search list
    │ │ │ │ +
    157 AllocationList::iterator it;
    │ │ │ │ +
    158 unsigned int i = 0;
    │ │ │ │ +
    159 for (it=allocation_list.begin(); it!=allocation_list.end(); it++, i++)
    │ │ │ │ +
    160 {
    │ │ │ │ +
    161 if (it->page_ptr == page_ptr)
    │ │ │ │ +
    162 {
    │ │ │ │ +
    163 // std::cout << "found memory_block in allocation " << i << std::endl;
    │ │ │ │ +
    164 // sanity checks
    │ │ │ │ +
    165 if (n != 0)
    │ │ │ │ +
    166 ALLOCATION_ASSERT(n == it->size);
    │ │ │ │ +
    167 ALLOCATION_ASSERT(ptr == it->ptr);
    │ │ │ │ +
    168 ALLOCATION_ASSERT(true == it->not_free);
    │ │ │ │ +
    169 ALLOCATION_ASSERT(typeid(T) == *(it->type));
    │ │ │ │ +
    170 // free memory
    │ │ │ │ +
    171 it->not_free = false;
    │ │ │ │ +
    172#if DEBUG_ALLOCATOR_KEEP
    │ │ │ │ +
    173 // write protect old memory
    │ │ │ │ +
    174 memprotect(it->page_ptr,
    │ │ │ │ +
    175 (it->pages) * page_size,
    │ │ │ │ +
    176 PROT_NONE);
    │ │ │ │ +
    177#else
    │ │ │ │ +
    178 // unprotect old memory
    │ │ │ │ +
    179 memprotect(it->page_ptr,
    │ │ │ │ +
    180 (it->pages) * page_size,
    │ │ │ │ +
    181 PROT_READ | PROT_WRITE);
    │ │ │ │ +
    182 munmap(it->page_ptr, it->pages * page_size);
    │ │ │ │ +
    183 // remove chunk info
    │ │ │ │ +
    184 allocation_list.erase(it);
    │ │ │ │ +
    185#endif
    │ │ │ │ +
    186 return;
    │ │ │ │ +
    187 }
    │ │ │ │ +
    188 }
    │ │ │ │ +
    189 allocation_error("memory block not found");
    │ │ │ │ +
    190 }
    │ │ │ │ +
    191 };
    │ │ │ │ +
    192#undef ALLOCATION_ASSERT
    │ │ │ │ +
    193
    │ │ │ │ +
    194 extern AllocationManager alloc_man;
    │ │ │ │ +
    195 } // end namespace DebugMemory
    │ │ │ │ +
    196#endif // DOXYGEN
    │ │ │ │ +
    197
    │ │ │ │ +
    198 template<class T>
    │ │ │ │ +
    199 class DebugAllocator;
    │ │ │ │ +
    200
    │ │ │ │ +
    201 // specialize for void
    │ │ │ │ +
    202 template <>
    │ │ │ │ +
    203 class DebugAllocator<void> {
    │ │ │ │ +
    204 public:
    │ │ │ │ +
    205 typedef void* pointer;
    │ │ │ │ +
    206 typedef const void* const_pointer;
    │ │ │ │ +
    207 // reference to void members are impossible.
    │ │ │ │ +
    208 typedef void value_type;
    │ │ │ │ +
    209 template <class U> struct rebind {
    │ │ │ │ +
    210 typedef DebugAllocator<U> other;
    │ │ │ │ +
    211 };
    │ │ │ │ +
    212 };
    │ │ │ │ +
    213
    │ │ │ │ +
    214 // actual implementation
    │ │ │ │ +
    233 template <class T>
    │ │ │ │ +
    234 class DebugAllocator {
    │ │ │ │ +
    235 public:
    │ │ │ │ +
    236 typedef std::size_t size_type;
    │ │ │ │ +
    237 typedef std::ptrdiff_t difference_type;
    │ │ │ │ +
    238 typedef T* pointer;
    │ │ │ │ +
    239 typedef const T* const_pointer;
    │ │ │ │ +
    240 typedef T& reference;
    │ │ │ │ +
    241 typedef const T& const_reference;
    │ │ │ │ +
    242 typedef T value_type;
    │ │ │ │ +
    243 template <class U> struct rebind {
    │ │ │ │ +
    244 typedef DebugAllocator<U> other;
    │ │ │ │ +
    245 };
    │ │ │ │ +
    246
    │ │ │ │ +
    248 DebugAllocator() noexcept {}
    │ │ │ │ +
    250 template <class U>
    │ │ │ │ +
    251 DebugAllocator(const DebugAllocator<U>&) noexcept {}
    │ │ │ │ +
    253 ~DebugAllocator() noexcept {}
    │ │ │ │ +
    254
    │ │ │ │ +
    255 pointer address(reference x) const
    │ │ │ │ +
    256 {
    │ │ │ │ +
    257 return &x;
    │ │ │ │ +
    258 }
    │ │ │ │ +
    259 const_pointer address(const_reference x) const
    │ │ │ │ +
    260 {
    │ │ │ │ +
    261 return &x;
    │ │ │ │ +
    262 }
    │ │ │ │ +
    263
    │ │ │ │ +
    265 pointer allocate(size_type n,
    │ │ │ │ +
    266 [[maybe_unused]] DebugAllocator<void>::const_pointer hint = 0)
    │ │ │ │ +
    267 {
    │ │ │ │ +
    268 return DebugMemory::alloc_man.allocate<T>(n);
    │ │ │ │ +
    269 }
    │ │ │ │ +
    270
    │ │ │ │ +
    272 void deallocate(pointer p, size_type n)
    │ │ │ │ +
    273 {
    │ │ │ │ +
    274 DebugMemory::alloc_man.deallocate<T>(p,n);
    │ │ │ │ +
    275 }
    │ │ │ │ +
    276
    │ │ │ │ +
    278 size_type max_size() const noexcept
    │ │ │ │ +
    279 {
    │ │ │ │ +
    280 return size_type(-1) / sizeof(T);
    │ │ │ │ +
    281 }
    │ │ │ │ +
    282
    │ │ │ │ +
    284 void construct(pointer p, const T& val)
    │ │ │ │ +
    285 {
    │ │ │ │ +
    286 ::new((void*)p)T(val);
    │ │ │ │ +
    287 }
    │ │ │ │ +
    288
    │ │ │ │ +
    290 template<typename ... Args>
    │ │ │ │ +
    291 void construct(pointer p, Args&&... args)
    │ │ │ │ +
    292 {
    │ │ │ │ +
    293 ::new((void *)p)T(std::forward<Args>(args) ...);
    │ │ │ │ +
    294 }
    │ │ │ │ +
    295
    │ │ │ │ +
    297 void destroy(pointer p)
    │ │ │ │ +
    298 {
    │ │ │ │ +
    299 p->~T();
    │ │ │ │ +
    300 }
    │ │ │ │ +
    301 };
    │ │ │ │ +
    302
    │ │ │ │ +
    304 template<class T>
    │ │ │ │ +
    305 constexpr bool
    │ │ │ │ +
    306 operator==(const DebugAllocator<T> &, const DebugAllocator<T> &)
    │ │ │ │ +
    307 {
    │ │ │ │ +
    308 return true;
    │ │ │ │ +
    309 }
    │ │ │ │ +
    310
    │ │ │ │ +
    312 template<class T>
    │ │ │ │ +
    313 constexpr bool
    │ │ │ │ +
    314 operator!=(const DebugAllocator<T> &, const DebugAllocator<T> &)
    │ │ │ │ +
    315 {
    │ │ │ │ +
    316 return false;
    │ │ │ │ +
    317 }
    │ │ │ │ +
    318}
    │ │ │ │ +
    319
    │ │ │ │ +
    320#ifdef DEBUG_NEW_DELETE
    │ │ │ │ +
    321void * operator new(size_t size)
    │ │ │ │ +
    322{
    │ │ │ │ +
    323 // try to allocate size bytes
    │ │ │ │ +
    324 void *p = Dune::DebugMemory::alloc_man.allocate<char>(size);
    │ │ │ │ +
    325#if DEBUG_NEW_DELETE > 2
    │ │ │ │ +
    326 std::cout << "NEW " << size
    │ │ │ │ +
    327 << " -> " << p
    │ │ │ │ +
    328 << std::endl;
    │ │ │ │ +
    329#endif
    │ │ │ │ +
    330 return p;
    │ │ │ │ +
    331}
    │ │ │ │ +
    332
    │ │ │ │ +
    333void operator delete(void * p) noexcept
    │ │ │ │ +
    334{
    │ │ │ │ +
    335#if DEBUG_NEW_DELETE > 2
    │ │ │ │ +
    336 std::cout << "FREE " << p << std::endl;
    │ │ │ │ +
    337#endif
    │ │ │ │ +
    338 Dune::DebugMemory::alloc_man.deallocate<char>(static_cast<char*>(p));
    │ │ │ │ +
    339}
    │ │ │ │ +
    340
    │ │ │ │ +
    341void operator delete(void * p, size_t size) noexcept
    │ │ │ │ +
    342{
    │ │ │ │ +
    343#if DEBUG_NEW_DELETE > 2
    │ │ │ │ +
    344 std::cout << "FREE " << p << std::endl;
    │ │ │ │ +
    345#endif
    │ │ │ │ +
    346 Dune::DebugMemory::alloc_man.deallocate<char>(static_cast<char*>(p), size);
    │ │ │ │ +
    347}
    │ │ │ │ +
    348
    │ │ │ │ +
    349#endif // DEBUG_NEW_DELETE
    │ │ │ │ +
    350
    │ │ │ │ +
    351#endif // __has_include(<sys/mman.h>)
    │ │ │ │ +
    352
    │ │ │ │ +
    353#endif // DUNE_DEBUG_ALLOCATOR_HH
    │ │ │ │ +
    Allocators that use malloc/free.
    │ │ │ │ +
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition iteratorfacades.hh:237
    │ │ │ │ +
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition iteratorfacades.hh:259
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,183 +1,353 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -indices.hh │ │ │ │ │ +debugallocator.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5 │ │ │ │ │ -6#ifndef DUNE_COMMON_INDICES_HH │ │ │ │ │ -7#define DUNE_COMMON_INDICES_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12 │ │ │ │ │ -13#include <_d_u_n_e_/_c_o_m_m_o_n_/_k_e_y_w_o_r_d_s_._h_h> │ │ │ │ │ -14 │ │ │ │ │ -15namespace _D_u_n_e │ │ │ │ │ -16{ │ │ │ │ │ -29 template │ │ │ │ │ -_3_0 using _i_n_d_e_x___c_o_n_s_t_a_n_t = std::integral_constant; │ │ │ │ │ +5#ifndef DUNE_DEBUG_ALLOCATOR_HH │ │ │ │ │ +6#define DUNE_DEBUG_ALLOCATOR_HH │ │ │ │ │ +7 │ │ │ │ │ +8#if __has_include() │ │ │ │ │ +9 │ │ │ │ │ +10#include │ │ │ │ │ +11#define HAVE_SYS_MMAN_H 1 │ │ │ │ │ +12#define HAVE_MPROTECT 1 │ │ │ │ │ +13 │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22 │ │ │ │ │ +23#include "_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._h_h" │ │ │ │ │ +24 │ │ │ │ │ +25namespace _D_u_n_e │ │ │ │ │ +26{ │ │ │ │ │ +27 │ │ │ │ │ +28#ifndef DOXYGEN // hide implementation details from doxygen │ │ │ │ │ +29 namespace DebugMemory │ │ │ │ │ +30 { │ │ │ │ │ 31 │ │ │ │ │ -32 │ │ │ │ │ +32 extern const std::ptrdiff_t page_size; │ │ │ │ │ 33 │ │ │ │ │ -_5_0 namespace Indices │ │ │ │ │ -51 { │ │ │ │ │ -_5_3 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _0_> ___0 = {}; │ │ │ │ │ -54 │ │ │ │ │ -_5_6 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _1_> ___1 = {}; │ │ │ │ │ -57 │ │ │ │ │ -_5_9 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _2_> ___2 = {}; │ │ │ │ │ -60 │ │ │ │ │ -_6_2 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _3_> ___3 = {}; │ │ │ │ │ +34 struct AllocationManager │ │ │ │ │ +35 { │ │ │ │ │ +36 typedef std::size_t size_type; │ │ │ │ │ +37 typedef std::ptrdiff_t difference_type; │ │ │ │ │ +38 typedef void* pointer; │ │ │ │ │ +39 │ │ │ │ │ +40 protected: │ │ │ │ │ +41 static void allocation_error(const char* msg); │ │ │ │ │ +42 │ │ │ │ │ +43 struct AllocationInfo; │ │ │ │ │ +44 friend struct AllocationInfo; │ │ │ │ │ +45 │ │ │ │ │ +46#define ALLOCATION_ASSERT(A) { if (!(A)) \ │ │ │ │ │ +47 { allocation_error("Assertion " # A " failed");\ │ │ │ │ │ +48 }\ │ │ │ │ │ +49}; │ │ │ │ │ +50 │ │ │ │ │ +51 struct AllocationInfo │ │ │ │ │ +52 { │ │ │ │ │ +53 AllocationInfo(const std::type_info & t) : type(&t) {} │ │ │ │ │ +54 const std::type_info * type; │ │ │ │ │ +55 │ │ │ │ │ +56 pointer page_ptr; │ │ │ │ │ +57 pointer ptr; │ │ │ │ │ +58 size_type pages; │ │ │ │ │ +59 size_type capacity; │ │ │ │ │ +60 size_type size; │ │ │ │ │ +61 bool not_free; │ │ │ │ │ +62 }; │ │ │ │ │ 63 │ │ │ │ │ -_6_5 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _4_> ___4 = {}; │ │ │ │ │ -66 │ │ │ │ │ -_6_8 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _5_> ___5 = {}; │ │ │ │ │ -69 │ │ │ │ │ -_7_1 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _6_> ___6 = {}; │ │ │ │ │ -72 │ │ │ │ │ -_7_4 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _7_> ___7 = {}; │ │ │ │ │ -75 │ │ │ │ │ -_7_7 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _8_> ___8 = {}; │ │ │ │ │ -78 │ │ │ │ │ -_8_0 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _9_> ___9 = {}; │ │ │ │ │ -81 │ │ │ │ │ -_8_3 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_0_> ___1_0 = {}; │ │ │ │ │ -84 │ │ │ │ │ -_8_6 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_1_> ___1_1 = {}; │ │ │ │ │ -87 │ │ │ │ │ -_8_9 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_2_> ___1_2 = {}; │ │ │ │ │ -90 │ │ │ │ │ -_9_2 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_3_> ___1_3 = {}; │ │ │ │ │ -93 │ │ │ │ │ -_9_5 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_4_> ___1_4 = {}; │ │ │ │ │ -96 │ │ │ │ │ -_9_8 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_5_> ___1_5 = {}; │ │ │ │ │ -99 │ │ │ │ │ -_1_0_1 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_6_> ___1_6 = {}; │ │ │ │ │ -102 │ │ │ │ │ -_1_0_4 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_7_> ___1_7 = {}; │ │ │ │ │ -105 │ │ │ │ │ -_1_0_7 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_8_> ___1_8 = {}; │ │ │ │ │ -108 │ │ │ │ │ -_1_1_0 _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_9_> ___1_9 = {}; │ │ │ │ │ -111 │ │ │ │ │ -112 } // namespace Indices │ │ │ │ │ -113 │ │ │ │ │ -124 template │ │ │ │ │ -_1_2_5 decltype(auto) constexpr _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e(F&& f, std:: │ │ │ │ │ -integer_sequence sequence) │ │ │ │ │ -126 { │ │ │ │ │ -127 return f(std::integral_constant()...); │ │ │ │ │ -128 } │ │ │ │ │ -129 │ │ │ │ │ -130} //namespace Dune │ │ │ │ │ -131 │ │ │ │ │ -132#endif // DUNE_COMMON_INDICES_HH │ │ │ │ │ -_k_e_y_w_o_r_d_s_._h_h │ │ │ │ │ -Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ │ -_D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E │ │ │ │ │ -#define DUNE_INLINE_VARIABLE │ │ │ │ │ -DDeeffiinniittiioonn keywords.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_6 │ │ │ │ │ -constexpr index_constant< 16 > _16 │ │ │ │ │ -Compile time index with value 16. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:101 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_5 │ │ │ │ │ -constexpr index_constant< 15 > _15 │ │ │ │ │ -Compile time index with value 15. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:98 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___8 │ │ │ │ │ -constexpr index_constant< 8 > _8 │ │ │ │ │ -Compile time index with value 8. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___7 │ │ │ │ │ -constexpr index_constant< 7 > _7 │ │ │ │ │ -Compile time index with value 7. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___0 │ │ │ │ │ -constexpr index_constant< 0 > _0 │ │ │ │ │ -Compile time index with value 0. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___9 │ │ │ │ │ -constexpr index_constant< 9 > _9 │ │ │ │ │ -Compile time index with value 9. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_4 │ │ │ │ │ -constexpr index_constant< 14 > _14 │ │ │ │ │ -Compile time index with value 14. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1 │ │ │ │ │ -constexpr index_constant< 1 > _1 │ │ │ │ │ -Compile time index with value 1. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___3 │ │ │ │ │ -constexpr index_constant< 3 > _3 │ │ │ │ │ -Compile time index with value 3. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:62 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_2 │ │ │ │ │ -constexpr index_constant< 12 > _12 │ │ │ │ │ -Compile time index with value 12. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e │ │ │ │ │ -decltype(auto) constexpr unpackIntegerSequence(F &&f, std::integer_sequence< I, │ │ │ │ │ -i... > sequence) │ │ │ │ │ -Unpack an std::integer_sequence to std::integral_constant... │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:125 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_1 │ │ │ │ │ -constexpr index_constant< 11 > _11 │ │ │ │ │ -Compile time index with value 11. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_8 │ │ │ │ │ -constexpr index_constant< 18 > _18 │ │ │ │ │ -Compile time index with value 18. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:107 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_3 │ │ │ │ │ -constexpr index_constant< 13 > _13 │ │ │ │ │ -Compile time index with value 13. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___5 │ │ │ │ │ -constexpr index_constant< 5 > _5 │ │ │ │ │ -Compile time index with value 5. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:68 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_7 │ │ │ │ │ -constexpr index_constant< 17 > _17 │ │ │ │ │ -Compile time index with value 17. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_0 │ │ │ │ │ -constexpr index_constant< 10 > _10 │ │ │ │ │ -Compile time index with value 10. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:83 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___2 │ │ │ │ │ -constexpr index_constant< 2 > _2 │ │ │ │ │ -Compile time index with value 2. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t │ │ │ │ │ -std::integral_constant< std::size_t, i > index_constant │ │ │ │ │ -An index constant with value i. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___1_9 │ │ │ │ │ -constexpr index_constant< 19 > _19 │ │ │ │ │ -Compile time index with value 19. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___6 │ │ │ │ │ -constexpr index_constant< 6 > _6 │ │ │ │ │ -Compile time index with value 6. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:___4 │ │ │ │ │ -constexpr index_constant< 4 > _4 │ │ │ │ │ -Compile time index with value 4. │ │ │ │ │ -DDeeffiinniittiioonn indices.hh:65 │ │ │ │ │ +64 typedef MallocAllocator Alloc; │ │ │ │ │ +65 typedef std::vector AllocationList; │ │ │ │ │ +66 AllocationList allocation_list; │ │ │ │ │ +67 │ │ │ │ │ +68 private: │ │ │ │ │ +69 void memprotect([[maybe_unused]] void* from, │ │ │ │ │ +70 [[maybe_unused]] difference_type len, │ │ │ │ │ +71 [[maybe_unused]] int prot) │ │ │ │ │ +72 { │ │ │ │ │ +73#if HAVE_SYS_MMAN_H && HAVE_MPROTECT │ │ │ │ │ +74 int result = mprotect(from, len, prot); │ │ │ │ │ +75 if (result == -1) │ │ │ │ │ +76 { │ │ │ │ │ +77 │ │ │ │ │ +78 std::cerr << "ERROR: (" << result << ": " << strerror(result) << ")" << │ │ │ │ │ +std::endl; │ │ │ │ │ +79 std::cerr << " Failed to "; │ │ │ │ │ +80 if (prot == PROT_NONE) │ │ │ │ │ +81 std::cerr << "protect "; │ │ │ │ │ +82 else │ │ │ │ │ +83 std::cerr << "unprotect "; │ │ │ │ │ +84 std::cerr << "memory range: " │ │ │ │ │ +85 << from << ", " │ │ │ │ │ +86 << static_cast( │ │ │ │ │ +87 static_cast(from) + len) │ │ │ │ │ +88 << std::endl; │ │ │ │ │ +89 abort(); │ │ │ │ │ +90 } │ │ │ │ │ +91#else │ │ │ │ │ +92 std::cerr << "WARNING: memory protection not available" << std::endl; │ │ │ │ │ +93#endif │ │ │ │ │ +94 } │ │ │ │ │ +95 │ │ │ │ │ +96 public: │ │ │ │ │ +97 │ │ │ │ │ +98 ~AllocationManager () │ │ │ │ │ +99 { │ │ │ │ │ +100 AllocationList::iterator it; │ │ │ │ │ +101 bool error = false; │ │ │ │ │ +102 for (it=allocation_list.begin(); it!=allocation_list.end(); it++) │ │ │ │ │ +103 { │ │ │ │ │ +104 if (it->not_free) │ │ │ │ │ +105 { │ │ │ │ │ +106 std::cerr << "ERROR: found memory chunk still in use: " << │ │ │ │ │ +107 it->capacity << " bytes at " << it->ptr << std::endl; │ │ │ │ │ +108 error = true; │ │ │ │ │ +109 } │ │ │ │ │ +110 munmap(it->page_ptr, it->pages * page_size); │ │ │ │ │ +111 } │ │ │ │ │ +112 if (error) │ │ │ │ │ +113 allocation_error("lost allocations"); │ │ │ │ │ +114 } │ │ │ │ │ +115 │ │ │ │ │ +116 template │ │ │ │ │ +117 T* allocate(size_type n) │ │ │ │ │ +118 { │ │ │ │ │ +119 // setup chunk info │ │ │ │ │ +120 AllocationInfo ai(typeid(T)); │ │ │ │ │ +121 ai.size = n; │ │ │ │ │ +122 ai.capacity = n * sizeof(T); │ │ │ │ │ +123 ai.pages = (ai.capacity) / page_size + 2; │ │ │ │ │ +124 ai.not_free = true; │ │ │ │ │ +125 size_type overlap = ai.capacity % page_size; │ │ │ │ │ +126 ai.page_ptr = mmap(NULL, ai.pages * page_size, │ │ │ │ │ +127 PROT_READ | PROT_WRITE, │ │ │ │ │ +128#ifdef __APPLE__ │ │ │ │ │ +129 MAP_ANON | MAP_PRIVATE, │ │ │ │ │ +130#else │ │ │ │ │ +131 MAP_ANONYMOUS | MAP_PRIVATE, │ │ │ │ │ +132#endif │ │ │ │ │ +133 -1, 0); │ │ │ │ │ +134 if (MAP_FAILED == ai.page_ptr) │ │ │ │ │ +135 { │ │ │ │ │ +136 throw std::bad_alloc(); │ │ │ │ │ +137 } │ │ │ │ │ +138 ai.ptr = static_cast(ai.page_ptr) + page_size - overlap; │ │ │ │ │ +139 // write protect memory behind the actual data │ │ │ │ │ +140 memprotect(static_cast(ai.page_ptr) + (ai.pages-1) * page_size, │ │ │ │ │ +141 page_size, │ │ │ │ │ +142 PROT_NONE); │ │ │ │ │ +143 // remember the chunk │ │ │ │ │ +144 allocation_list.push_back(ai); │ │ │ │ │ +145 // return the ptr │ │ │ │ │ +146 return static_cast(ai.ptr); │ │ │ │ │ +147 } │ │ │ │ │ +148 │ │ │ │ │ +149 template │ │ │ │ │ +150 void deallocate(T* ptr, size_type n = 0) noexcept │ │ │ │ │ +151 { │ │ │ │ │ +152 // compute page address │ │ │ │ │ +153 void* page_ptr = │ │ │ │ │ +154 static_cast( │ │ │ │ │ +155 (char*)(ptr) - ((std::uintptr_t)(ptr) % page_size)); │ │ │ │ │ +156 // search list │ │ │ │ │ +157 AllocationList::iterator it; │ │ │ │ │ +158 unsigned int i = 0; │ │ │ │ │ +159 for (it=allocation_list.begin(); it!=allocation_list.end(); it++, i++) │ │ │ │ │ +160 { │ │ │ │ │ +161 if (it->page_ptr == page_ptr) │ │ │ │ │ +162 { │ │ │ │ │ +163 // std::cout << "found memory_block in allocation " << i << std::endl; │ │ │ │ │ +164 // sanity checks │ │ │ │ │ +165 if (n != 0) │ │ │ │ │ +166 ALLOCATION_ASSERT(n == it->size); │ │ │ │ │ +167 ALLOCATION_ASSERT(ptr == it->ptr); │ │ │ │ │ +168 ALLOCATION_ASSERT(true == it->not_free); │ │ │ │ │ +169 ALLOCATION_ASSERT(typeid(T) == *(it->type)); │ │ │ │ │ +170 // free memory │ │ │ │ │ +171 it->not_free = false; │ │ │ │ │ +172#if DEBUG_ALLOCATOR_KEEP │ │ │ │ │ +173 // write protect old memory │ │ │ │ │ +174 memprotect(it->page_ptr, │ │ │ │ │ +175 (it->pages) * page_size, │ │ │ │ │ +176 PROT_NONE); │ │ │ │ │ +177#else │ │ │ │ │ +178 // unprotect old memory │ │ │ │ │ +179 memprotect(it->page_ptr, │ │ │ │ │ +180 (it->pages) * page_size, │ │ │ │ │ +181 PROT_READ | PROT_WRITE); │ │ │ │ │ +182 munmap(it->page_ptr, it->pages * page_size); │ │ │ │ │ +183 // remove chunk info │ │ │ │ │ +184 allocation_list.erase(it); │ │ │ │ │ +185#endif │ │ │ │ │ +186 return; │ │ │ │ │ +187 } │ │ │ │ │ +188 } │ │ │ │ │ +189 allocation_error("memory block not found"); │ │ │ │ │ +190 } │ │ │ │ │ +191 }; │ │ │ │ │ +192#undef ALLOCATION_ASSERT │ │ │ │ │ +193 │ │ │ │ │ +194 extern AllocationManager alloc_man; │ │ │ │ │ +195 } // end namespace DebugMemory │ │ │ │ │ +196#endif // DOXYGEN │ │ │ │ │ +197 │ │ │ │ │ +198 template │ │ │ │ │ +199 class DebugAllocator; │ │ │ │ │ +200 │ │ │ │ │ +201 // specialize for void │ │ │ │ │ +202 template <> │ │ │ │ │ +203 class DebugAllocator { │ │ │ │ │ +204 public: │ │ │ │ │ +205 typedef void* pointer; │ │ │ │ │ +206 typedef const void* const_pointer; │ │ │ │ │ +207 // reference to void members are impossible. │ │ │ │ │ +208 typedef void value_type; │ │ │ │ │ +209 template struct rebind { │ │ │ │ │ +210 typedef DebugAllocator other; │ │ │ │ │ +211 }; │ │ │ │ │ +212 }; │ │ │ │ │ +213 │ │ │ │ │ +214 // actual implementation │ │ │ │ │ +233 template │ │ │ │ │ +234 class DebugAllocator { │ │ │ │ │ +235 public: │ │ │ │ │ +236 typedef std::size_t size_type; │ │ │ │ │ +237 typedef std::ptrdiff_t difference_type; │ │ │ │ │ +238 typedef T* pointer; │ │ │ │ │ +239 typedef const T* const_pointer; │ │ │ │ │ +240 typedef T& reference; │ │ │ │ │ +241 typedef const T& const_reference; │ │ │ │ │ +242 typedef T value_type; │ │ │ │ │ +243 template struct rebind { │ │ │ │ │ +244 typedef DebugAllocator other; │ │ │ │ │ +245 }; │ │ │ │ │ +246 │ │ │ │ │ +248 DebugAllocator() noexcept {} │ │ │ │ │ +250 template │ │ │ │ │ +251 DebugAllocator(const DebugAllocator&) noexcept {} │ │ │ │ │ +253 ~DebugAllocator() noexcept {} │ │ │ │ │ +254 │ │ │ │ │ +255 pointer address(reference x) const │ │ │ │ │ +256 { │ │ │ │ │ +257 return &x; │ │ │ │ │ +258 } │ │ │ │ │ +259 const_pointer address(const_reference x) const │ │ │ │ │ +260 { │ │ │ │ │ +261 return &x; │ │ │ │ │ +262 } │ │ │ │ │ +263 │ │ │ │ │ +265 pointer allocate(size_type n, │ │ │ │ │ +266 [[maybe_unused]] DebugAllocator::const_pointer hint = 0) │ │ │ │ │ +267 { │ │ │ │ │ +268 return DebugMemory::alloc_man.allocate(n); │ │ │ │ │ +269 } │ │ │ │ │ +270 │ │ │ │ │ +272 void deallocate(pointer p, size_type n) │ │ │ │ │ +273 { │ │ │ │ │ +274 DebugMemory::alloc_man.deallocate(p,n); │ │ │ │ │ +275 } │ │ │ │ │ +276 │ │ │ │ │ +278 size_type max_size() const noexcept │ │ │ │ │ +279 { │ │ │ │ │ +280 return size_type(-1) / sizeof(T); │ │ │ │ │ +281 } │ │ │ │ │ +282 │ │ │ │ │ +284 void construct(pointer p, const T& val) │ │ │ │ │ +285 { │ │ │ │ │ +286 ::new((void*)p)T(val); │ │ │ │ │ +287 } │ │ │ │ │ +288 │ │ │ │ │ +290 template │ │ │ │ │ +291 void construct(pointer p, Args&&... args) │ │ │ │ │ +292 { │ │ │ │ │ +293 ::new((void *)p)T(std::forward(args) ...); │ │ │ │ │ +294 } │ │ │ │ │ +295 │ │ │ │ │ +297 void destroy(pointer p) │ │ │ │ │ +298 { │ │ │ │ │ +299 p->~T(); │ │ │ │ │ +300 } │ │ │ │ │ +301 }; │ │ │ │ │ +302 │ │ │ │ │ +304 template │ │ │ │ │ +305 constexpr bool │ │ │ │ │ +306 _o_p_e_r_a_t_o_r_=_=(const DebugAllocator &, const DebugAllocator &) │ │ │ │ │ +307 { │ │ │ │ │ +308 return true; │ │ │ │ │ +309 } │ │ │ │ │ +310 │ │ │ │ │ +312 template │ │ │ │ │ +313 constexpr bool │ │ │ │ │ +314 _o_p_e_r_a_t_o_r_!_=(const DebugAllocator &, const DebugAllocator &) │ │ │ │ │ +315 { │ │ │ │ │ +316 return false; │ │ │ │ │ +317 } │ │ │ │ │ +318} │ │ │ │ │ +319 │ │ │ │ │ +320#ifdef DEBUG_NEW_DELETE │ │ │ │ │ +321void * operator new(size_t size) │ │ │ │ │ +322{ │ │ │ │ │ +323 // try to allocate size bytes │ │ │ │ │ +324 void *p = Dune::DebugMemory::alloc_man.allocate(size); │ │ │ │ │ +325#if DEBUG_NEW_DELETE > 2 │ │ │ │ │ +326 std::cout << "NEW " << size │ │ │ │ │ +327 << " -> " << p │ │ │ │ │ +328 << std::endl; │ │ │ │ │ +329#endif │ │ │ │ │ +330 return p; │ │ │ │ │ +331} │ │ │ │ │ +332 │ │ │ │ │ +333void operator delete(void * p) noexcept │ │ │ │ │ +334{ │ │ │ │ │ +335#if DEBUG_NEW_DELETE > 2 │ │ │ │ │ +336 std::cout << "FREE " << p << std::endl; │ │ │ │ │ +337#endif │ │ │ │ │ +338 Dune::DebugMemory::alloc_man.deallocate(static_cast(p)); │ │ │ │ │ +339} │ │ │ │ │ +340 │ │ │ │ │ +341void operator delete(void * p, size_t size) noexcept │ │ │ │ │ +342{ │ │ │ │ │ +343#if DEBUG_NEW_DELETE > 2 │ │ │ │ │ +344 std::cout << "FREE " << p << std::endl; │ │ │ │ │ +345#endif │ │ │ │ │ +346 Dune::DebugMemory::alloc_man.deallocate(static_cast(p), size); │ │ │ │ │ +347} │ │ │ │ │ +348 │ │ │ │ │ +349#endif // DEBUG_NEW_DELETE │ │ │ │ │ +350 │ │ │ │ │ +351#endif // __has_include() │ │ │ │ │ +352 │ │ │ │ │ +353#endif // DUNE_DEBUG_ALLOCATOR_HH │ │ │ │ │ +_m_a_l_l_o_c_a_l_l_o_c_a_t_o_r_._h_h │ │ │ │ │ +Allocators that use malloc/free. │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for equality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ +ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ +V2, R2, D > &rhs) │ │ │ │ │ +Checks for inequality. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00185.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: rangeutilities.hh File Reference │ │ │ │ +dune-common: debugalign.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,119 +72,378 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ +Macros | │ │ │ │ +Typedefs | │ │ │ │ Functions | │ │ │ │ Variables
    │ │ │ │ -
    rangeutilities.hh File Reference
    │ │ │ │ +
    debugalign.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Utilities for reduction like operations on ranges. │ │ │ │ -More...

    │ │ │ │ -
    #include <dune/common/typetraits.hh>
    │ │ │ │ -#include <algorithm>
    │ │ │ │ -#include <utility>
    │ │ │ │ +
    #include <algorithm>
    │ │ │ │ +#include <cassert>
    │ │ │ │ +#include <cmath>
    │ │ │ │ +#include <complex>
    │ │ │ │ +#include <cstddef>
    │ │ │ │ +#include <cstdint>
    │ │ │ │ +#include <cstdlib>
    │ │ │ │ +#include <functional>
    │ │ │ │ +#include <istream>
    │ │ │ │ +#include <ostream>
    │ │ │ │ #include <type_traits>
    │ │ │ │ -#include <bitset>
    │ │ │ │ +#include <utility>
    │ │ │ │ +#include <dune/common/classname.hh>
    │ │ │ │ +#include <dune/common/indices.hh>
    │ │ │ │ +#include <dune/common/simd/base.hh>
    │ │ │ │ +#include <dune/common/simd/defaults.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::IntegralRange< T >
     dynamic integer range for use in range-based for loops More...
    class  Dune::AlignedBase< align, Impl >
     CRTP base mixin class to check alignment. More...
     
    class  Dune::StaticIntegralRange< T, to, from >
     static integer range for use in range-based for loops More...
    struct  Dune::IsNumber< AlignedNumberImpl::AlignedNumber< T, align > >
     
    struct  Dune::ValueTransformationTag
     Tag to enable value based transformations in TransformedRangeView. More...
    class  Dune::AlignedNumberImpl::AlignedNumber< T, align >
     aligned wrappers for arithmetic types More...
     
    struct  Dune::IteratorTransformationTag
     Tag to enable iterator based transformations in TransformedRangeView. More...
    struct  Dune::Simd::Overloads::ScalarType< AlignedNumber< T, align > >
     
    class  Dune::TransformedRangeView< R, F, T >
     A range transforming the values of another range on-the-fly. More...
    struct  Dune::Simd::Overloads::RebindType< U, AlignedNumber< T, align > >
     
    struct  Dune::Simd::Overloads::LaneCount< AlignedNumber< T, align > >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::AlignedNumberImpl
     
    namespace  Dune::Simd
     Namespace for vectorization interface functions used by library developers.
     
    namespace  Dune::Simd::Overloads
     Namespace for the overloads and specializations that make up a SIMD implementation.
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ +Macros

    #define DUNE_ASSIGN_OP(OP)
     
    #define DUNE_BINARY_OP(OP)
     
    #define DUNE_UNARY_FUNC(name)
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Typedefs

    using Dune::ViolatedAlignmentHandler = std::function< void(const char *, std::size_t, const void *)>
     type of the handler called by violatedAlignment()
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
    T::value_type Dune::max_value (const T &v)
     compute the maximum value over a range
     
    template<typename T , typename std::enable_if<!IsIterable< T >::value, int >::type = 0>
    const T & Dune::max_value (const T &v)
     
    template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
    T::value_type Dune::min_value (const T &v)
     compute the minimum value over a range
     
    template<typename T , typename std::enable_if<!IsIterable< T >::value, int >::type = 0>
    const T & Dune::min_value (const T &v)
     
    template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
    bool Dune::any_true (const T &v)
     similar to std::bitset<N>::any() return true, if any entries is true
     
    template<std::size_t N>
    bool Dune::any_true (const std::bitset< N > &b)
     
    template<typename T , typename std::enable_if< IsIterable< T >::value, int >::type = 0>
    bool Dune::all_true (const T &v)
     similar to std::bitset<N>::all() return true, if any entries is true
     
    template<std::size_t N>
    bool Dune::all_true (const std::bitset< N > &b)
     
    template<class T , class U , std::enable_if_t< std::is_same< std::decay_t< T >, std::decay_t< U > >::value, int > = 0, std::enable_if_t< std::is_integral< std::decay_t< T > >::value, int > = 0>
    static IntegralRange< std::decay_t< T > > Dune::range (T &&from, U &&to) noexcept
     free standing function for setting up a range based for loop over an integer range for (auto i: range(0,10)) // 0,1,2,3,4,5,6,7,8,9 or for (auto i: range(-10,10)) // -10,-9,..,8,9 or for (auto i: range(10)) // 0,1,2,3,4,5,6,7,8,9
     
    template<class T , std::enable_if_t< std::is_integral< std::decay_t< T > >::value, int > = 0>
    static IntegralRange< std::decay_t< T > > Dune::range (T &&to) noexcept
     
    template<class T , std::enable_if_t< std::is_enum< std::decay_t< T > >::value, int > = 0>
    static IntegralRange< std::underlying_type_t< std::decay_t< T > > > Dune::range (T &&to) noexcept
     
    template<class T , T to>
    static StaticIntegralRange< T, to > Dune::range (std::integral_constant< T, to >) noexcept
     
    template<class R , class F >
    auto Dune::transformedRangeView (R &&range, const F &f)
     Create a TransformedRangeView.
     
    template<class R , class F >
    auto Dune::iteratorTransformedRangeView (R &&range, const F &f)
     Create a TransformedRangeView using an iterator transformation.
     
    template<class Range >
    auto Dune::sparseRange (Range &&range)
     Allow structured-binding for-loops for sparse iterators.
     
    ViolatedAlignmentHandlerDune::violatedAlignmentHandler ()
     access the handler called by violatedAlignment()
     
    void Dune::violatedAlignment (const char *className, std::size_t expectedAlignment, const void *address)
     called when an alignment violation is detected
     
    bool Dune::isAligned (const void *p, std::size_t align)
     check whether an address conforms to the given alignment
     
    template<std::size_t align = debugAlignment, class T >
    AlignedNumber< T, align > Dune::aligned (T value)
     align a value to a certain alignment
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (+)
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (-)
     
    DUNE_BINARY_OP * Dune::AlignedNumberImpl::DUNE_BINARY_OP (/);DUNE_BINARY_OP(%
     
    DUNE_BINARY_OP^ Dune::AlignedNumberImpl::DUNE_BINARY_OP (&);DUNE_BINARY_OP(|
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (<<)
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (> >)
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (==)
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (!=)
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (<=)
     
     Dune::AlignedNumberImpl::DUNE_BINARY_OP (>=)
     
    DUNE_BINARY_OP && Dune::AlignedNumberImpl::DUNE_BINARY_OP (||);#define DUNE_UNARY_FUNC(name) DUNE_UNARY_FUNC(abs
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (acos)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (acosh)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (asin)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (asinh)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (atan)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (atanh)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (cbrt)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (ceil)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (cos)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (cosh)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (erf)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (erfc)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (exp)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (exp2)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (expm1)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (fabs)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (floor)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (ilogb)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (lgamma)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (llrint)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (llround)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (log)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (log10)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (log1p)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (log2)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (logb)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (lrint)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (lround)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (nearbyint)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (rint)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (round)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (sin)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (sinh)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (sqrt)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (tan)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (tanh)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (tgamma)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (trunc)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (isfinite)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (isinf)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (isnan)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (isnormal)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (signbit)
     
     Dune::AlignedNumberImpl::DUNE_UNARY_FUNC (real)
     
    template<class T , std::size_t align>
    auto Dune::AlignedNumberImpl::max (const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
     
    template<class T , std::size_t align>
    auto Dune::AlignedNumberImpl::max (const T &a, const AlignedNumber< T, align > &b)
     
    template<class T , std::size_t align>
    auto Dune::AlignedNumberImpl::max (const AlignedNumber< T, align > &a, const T &b)
     
    template<class T , std::size_t align>
    auto Dune::AlignedNumberImpl::min (const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
     
    template<class T , std::size_t align>
    auto Dune::AlignedNumberImpl::min (const T &a, const AlignedNumber< T, align > &b)
     
    template<class T , std::size_t align>
    auto Dune::AlignedNumberImpl::min (const AlignedNumber< T, align > &a, const T &b)
     
    template<class T , std::size_t align>
    AlignedNumber< T, align > Dune::cond (const AlignedNumber< bool, align > &b, const AlignedNumber< T, align > &v1, const AlignedNumber< T, align > &v2)
     
    template<class T , std::size_t align>
    Dune::max_value (const AlignedNumber< T, align > &val)
     
    template<class T , std::size_t align>
    Dune::min_value (const AlignedNumber< T, align > &val)
     
    template<std::size_t align>
    bool Dune::any_true (const AlignedNumber< bool, align > &val)
     
    template<std::size_t align>
    bool Dune::all_true (const AlignedNumber< bool, align > &val)
     
    template<class T , std::size_t align>
    T & Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
     
    template<class T , std::size_t align>
    Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, const AlignedNumber< T, align > &v)
     
    template<class T , std::size_t align>
    const AlignedNumber< T, align > & Dune::Simd::Overloads::cond (ADLTag< 5 >, AlignedNumber< bool, align > mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align > &ifFalse)
     
    template<std::size_t align>
    bool Dune::Simd::Overloads::anyTrue (ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Variables

    template<class T , T from, T to>
    static StaticIntegralRange< T, to, from > Dune::range (std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
     
    static constexpr auto Dune::debugAlignment = 2*alignof(std::max_align_t)
     an alignment large enough to trigger alignment errors
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Utilities for reduction like operations on ranges.

    │ │ │ │ -
    Author
    Christian Engwer
    │ │ │ │ -
    │ │ │ │ +

    Macro Definition Documentation

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_ASSIGN_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_ASSIGN_OP( OP)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class U, std::size_t uAlign, \
    │ │ │ │ +
    class = std::enable_if_t< \
    │ │ │ │ +
    ( uAlign <= align && \
    │ │ │ │ +
    sizeof(std::declval<T&>() OP std::declval<U>()) ) \
    │ │ │ │ +
    > > \
    │ │ │ │ +
    AlignedNumber &operator OP(const AlignedNumber<U, uAlign> &u) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    value_ OP U(u); \
    │ │ │ │ +
    return *this; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    \
    │ │ │ │ +
    template<class U, \
    │ │ │ │ +
    class = std::void_t<decltype(std::declval<T&>() OP \
    │ │ │ │ +
    std::declval<U>())> > \
    │ │ │ │ +
    AlignedNumber &operator OP(const U &u) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    value_ OP u; \
    │ │ │ │ +
    return *this; \
    │ │ │ │ +
    } \
    │ │ │ │ +
    \
    │ │ │ │ +
    static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    STL namespace.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_BINARY_OP

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_BINARY_OP( OP)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t tAlign, class U, std::size_t uAlign, \
    │ │ │ │ +
    class = std::void_t<decltype(std::declval<T>() \
    │ │ │ │ +
    OP std::declval<U>())> > \
    │ │ │ │ +
    decltype(auto) \
    │ │ │ │ +
    operator OP(const AlignedNumber<T, tAlign> &t, \
    │ │ │ │ +
    const AlignedNumber<U, uAlign> &u) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    /* can't use std::max(); not constexpr */ \
    │ │ │ │ +
    return aligned<(tAlign > uAlign ? tAlign : uAlign)>(T(t) OP U(u)); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    \
    │ │ │ │ +
    template<class T, class U, std::size_t uAlign, \
    │ │ │ │ +
    class = std::void_t<decltype(std::declval<T>() \
    │ │ │ │ +
    OP std::declval<U>())> > \
    │ │ │ │ +
    decltype(auto) \
    │ │ │ │ +
    operator OP(const T &t, const AlignedNumber<U, uAlign> &u) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    return aligned<uAlign>(t OP U(u)); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    \
    │ │ │ │ +
    template<class T, std::size_t tAlign, class U, \
    │ │ │ │ +
    class = std::void_t<decltype(std::declval<T>() \
    │ │ │ │ +
    OP std::declval<U>())> > \
    │ │ │ │ +
    decltype(auto) \
    │ │ │ │ +
    operator OP(const AlignedNumber<T, tAlign> &t, const U &u) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    return aligned<tAlign>(T(t) OP u); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    \
    │ │ │ │ +
    static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_UNARY_FUNC

    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    #define DUNE_UNARY_FUNC( name)
    │ │ │ │ +
    │ │ │ │ +Value:
    template<class T, std::size_t align> \
    │ │ │ │ +
    decltype(auto) name(const AlignedNumber<T, align> &u) \
    │ │ │ │ +
    { \
    │ │ │ │ +
    using std::name; \
    │ │ │ │ +
    return aligned<align>(name(T(u))); \
    │ │ │ │ +
    } \
    │ │ │ │ +
    static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,132 +1,388 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ -rangeutilities.hh File Reference │ │ │ │ │ -Utilities for reduction like operations on ranges. _M_o_r_e_._._. │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._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 | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +debugalign.hh File Reference │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_d_e_f_a_u_l_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_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_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_<_ _T_ _> │ │ │ │ │ -  dynamic integer range for use in range-based for loops _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e_<_ _a_l_i_g_n_,_ _I_m_p_l_ _> │ │ │ │ │ +  CRTP base mixin class to check alignment. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_N_u_m_b_e_r_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _> │ │ │ │ │ +  aligned wrappers for arithmetic types _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_<_ _T_,_ _t_o_,_ _f_r_o_m_ _> │ │ │ │ │ -  static integer range for use in range-based for loops _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ -  Tag to enable value based transformations in _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ -  Tag to enable iterator based transformations in _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e_<_ _U_,_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_<_ _R_,_ _F_,_ _T_ _> │ │ │ │ │ -  A range transforming the values of another range on-the-fly. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d │ │ │ │ │ +  Namespace for vectorization interface functions used by library │ │ │ │ │ + developers. │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s │ │ │ │ │ +  Namespace for the overloads and specializations that make up a SIMD │ │ │ │ │ + implementation. │ │ │ │ │ +  │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___A_S_S_I_G_N___O_P(OP) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___B_I_N_A_R_Y___O_P(OP) │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___U_N_A_R_Y___F_U_N_C(name) │ │ │ │ │ +  │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +using  _D_u_n_e_:_:_V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r = std::function< void(const char *, std:: │ │ │ │ │ + size_t, const void *)> │ │ │ │ │ +  type of the handler called by _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_(_) │ │ │ │ │ +  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template::value, int >:: │ │ │ │ │ -type = 0> │ │ │ │ │ - T::value_type  _D_u_n_e_:_:_m_a_x___v_a_l_u_e (const T &v) │ │ │ │ │ -  compute the maximum value over a range │ │ │ │ │ -  │ │ │ │ │ -template::value, int >:: │ │ │ │ │ -type = 0> │ │ │ │ │ - const T &  _D_u_n_e_:_:_m_a_x___v_a_l_u_e (const T &v) │ │ │ │ │ -  │ │ │ │ │ -template::value, int >:: │ │ │ │ │ -type = 0> │ │ │ │ │ - T::value_type  _D_u_n_e_:_:_m_i_n___v_a_l_u_e (const T &v) │ │ │ │ │ -  compute the minimum value over a range │ │ │ │ │ -  │ │ │ │ │ -template::value, int >:: │ │ │ │ │ -type = 0> │ │ │ │ │ - const T &  _D_u_n_e_:_:_m_i_n___v_a_l_u_e (const T &v) │ │ │ │ │ -  │ │ │ │ │ -template::value, int >:: │ │ │ │ │ -type = 0> │ │ │ │ │ - bool  _D_u_n_e_:_:_a_n_y___t_r_u_e (const T &v) │ │ │ │ │ -  similar to std::bitset::any() return │ │ │ │ │ - true, if any entries is true │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_a_n_y___t_r_u_e (const std::bitset< N > │ │ │ │ │ - &b) │ │ │ │ │ -  │ │ │ │ │ -template::value, int >:: │ │ │ │ │ -type = 0> │ │ │ │ │ - bool  _D_u_n_e_:_:_a_l_l___t_r_u_e (const T &v) │ │ │ │ │ -  similar to std::bitset::all() return │ │ │ │ │ - true, if any entries is true │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_a_l_l___t_r_u_e (const std::bitset< N > │ │ │ │ │ - &b) │ │ │ │ │ -  │ │ │ │ │ -template, │ │ │ │ │ -std::decay_t< U > >::value, int > = 0, std::enable_if_t< std::is_integral< │ │ │ │ │ -std::decay_t< T > >::value, int > = 0> │ │ │ │ │ -static _I_n_t_e_g_r_a_l_R_a_n_g_e< std::decay_t< T > │ │ │ │ │ - >  _D_u_n_e_:_:_r_a_n_g_e (T &&from, U &&to) noexcept │ │ │ │ │ - free standing function for setting up a │ │ │ │ │ - range based for loop over an integer │ │ │ │ │ - range for (auto i: _r_a_n_g_e_(_0_,_1_0_)) / │ │ │ │ │ -  / 0,1,2,3,4,5,6,7,8,9 or for (auto i: │ │ │ │ │ - range(-10,10)) // -10,-9,..,8,9 or for │ │ │ │ │ - (auto i: _r_a_n_g_e_(_1_0_)) / │ │ │ │ │ - / 0,1,2,3,4,5,6,7,8,9 │ │ │ │ │ -  │ │ │ │ │ -template >:: │ │ │ │ │ -value, int > = 0> │ │ │ │ │ -static _I_n_t_e_g_r_a_l_R_a_n_g_e< std::decay_t< T > │ │ │ │ │ - >  _D_u_n_e_:_:_r_a_n_g_e (T &&to) noexcept │ │ │ │ │ -  │ │ │ │ │ -template >::value, │ │ │ │ │ -int > = 0> │ │ │ │ │ - static _I_n_t_e_g_r_a_l_R_a_n_g_e< std:: │ │ │ │ │ - underlying_type_t< std::decay_t< T > > │ │ │ │ │ - >  _D_u_n_e_:_:_r_a_n_g_e (T &&to) noexcept │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e< T, to >  _D_u_n_e_:_:_r_a_n_g_e (std::integral_constant< T, │ │ │ │ │ - to >) noexcept │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_t_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w (R &&_r_a_n_g_e, │ │ │ │ │ - const F &f) │ │ │ │ │ -  Create a _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w (R │ │ │ │ │ - &&_r_a_n_g_e, const F &f) │ │ │ │ │ -  Create a _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w using an │ │ │ │ │ - iterator transformation. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_s_p_a_r_s_e_R_a_n_g_e (Range &&_r_a_n_g_e) │ │ │ │ │ -  Allow structured-binding for-loops for │ │ │ │ │ - sparse iterators. │ │ │ │ │ + _V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r &  _D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r () │ │ │ │ │ +  access the handler called by │ │ │ │ │ + _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_(_) │ │ │ │ │ +  │ │ │ │ │ + void  _D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t (const char │ │ │ │ │ + *_c_l_a_s_s_N_a_m_e, std::size_t expectedAlignment, │ │ │ │ │ + const void *address) │ │ │ │ │ +  called when an alignment violation is │ │ │ │ │ + detected │ │ │ │ │ +  │ │ │ │ │ + bool  _D_u_n_e_:_:_i_s_A_l_i_g_n_e_d (const void *p, std::size_t │ │ │ │ │ + align) │ │ │ │ │ +  check whether an address conforms to the │ │ │ │ │ + given alignment │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align >  _D_u_n_e_:_:_a_l_i_g_n_e_d (T value) │ │ │ │ │ +  align a value to a certain alignment │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (+) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (-) │ │ │ │ │ +  │ │ │ │ │ + DUNE_BINARY_OP *  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (/ │ │ │ │ │ + );DUNE_BINARY_OP(% │ │ │ │ │ +  │ │ │ │ │ + DUNE_BINARY_OP^  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P │ │ │ │ │ + (&);DUNE_BINARY_OP(| │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (<<) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (> │ │ │ │ │ + >) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (==) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (!=) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (<=) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P (>=) │ │ │ │ │ +  │ │ │ │ │ + DUNE_BINARY_OP &&  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___B_I_N_A_R_Y___O_P │ │ │ │ │ + (||);#define _D_U_N_E___U_N_A_R_Y___F_U_N_C(name) │ │ │ │ │ + _D_U_N_E___U_N_A_R_Y___F_U_N_C(abs │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (acos) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (acosh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (asin) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (asinh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (atan) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (atanh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (cbrt) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (ceil) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (cos) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (cosh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (erf) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (erfc) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (exp) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (exp2) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (expm1) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (fabs) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (floor) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (ilogb) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (lgamma) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (llrint) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (llround) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (log) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (log10) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (log1p) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (log2) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (logb) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (lrint) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (lround) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (nearbyint) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (rint) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (round) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (sin) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (sinh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (sqrt) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (tan) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (tanh) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (tgamma) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (trunc) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (isfinite) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (isinf) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (isnan) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (isnormal) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (signbit) │ │ │ │ │ +  │ │ │ │ │ +   _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ + (real) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_a_x (const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &a, const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &b) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_a_x (const T &a, │ │ │ │ │ + const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &b) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_a_x (const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &a, const T &b) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_i_n (const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &a, const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &b) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_i_n (const T &a, │ │ │ │ │ + const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &b) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + auto  _D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_i_n (const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &a, const T &b) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align >  _D_u_n_e_:_:_c_o_n_d (const _A_l_i_g_n_e_d_N_u_m_b_e_r< bool, align │ │ │ │ │ + > &b, const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &v1, │ │ │ │ │ + const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &v2) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + T  _D_u_n_e_:_:_m_a_x___v_a_l_u_e (const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, │ │ │ │ │ + align > &val) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + T  _D_u_n_e_:_:_m_i_n___v_a_l_u_e (const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, │ │ │ │ │ + align > &val) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_a_n_y___t_r_u_e (const _A_l_i_g_n_e_d_N_u_m_b_e_r< bool, │ │ │ │ │ + align > &val) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_a_l_l___t_r_u_e (const _A_l_i_g_n_e_d_N_u_m_b_e_r< bool, │ │ │ │ │ + align > &val) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + T &  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + std::size_t l, _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &v) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + T  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + std::size_t l, const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align │ │ │ │ │ + > &v) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +const _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_c_o_n_d (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< bool, align > _m_a_s_k, const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &ifTrue, const │ │ │ │ │ + _A_l_i_g_n_e_d_N_u_m_b_e_r< T, align > &ifFalse) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e (_A_D_L_T_a_g< 5 >, │ │ │ │ │ + const _A_l_i_g_n_e_d_N_u_m_b_e_r< bool, align > &_m_a_s_k) │ │ │ │ │   │ │ │ │ │ VVaarriiaabblleess │ │ │ │ │ -template │ │ │ │ │ -static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e< T, to, from _D_u_n_e_:_:_r_a_n_g_e (std::integral_constant< T, │ │ │ │ │ - >  from >, std::integral_constant< T, to │ │ │ │ │ - >) noexcept │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Utilities for reduction like operations on ranges. │ │ │ │ │ - Author │ │ │ │ │ - Christian Engwer │ │ │ │ │ +static constexpr auto  _D_u_n_e_:_:_d_e_b_u_g_A_l_i_g_n_m_e_n_t = 2*alignof(std::max_align_t) │ │ │ │ │ +  an alignment large enough to trigger alignment errors │ │ │ │ │ +  │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__AASSSSIIGGNN__OOPP ********** │ │ │ │ │ +#define DUNE_ASSIGN_OP (   OP ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +template() OP std::declval()) ) \ │ │ │ │ │ +> > \ │ │ │ │ │ +AlignedNumber &operator OP(const AlignedNumber &u) \ │ │ │ │ │ +{ \ │ │ │ │ │ +value_ OP U(u); \ │ │ │ │ │ +return *this; \ │ │ │ │ │ +} \ │ │ │ │ │ +\ │ │ │ │ │ +template() OP \ │ │ │ │ │ +_s_t_d::declval())> > \ │ │ │ │ │ +AlignedNumber &operator OP(const U &u) \ │ │ │ │ │ +{ \ │ │ │ │ │ +value_ OP u; \ │ │ │ │ │ +return *this; \ │ │ │ │ │ +} \ │ │ │ │ │ +\ │ │ │ │ │ +static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ +********** _?◆_? DDUUNNEE__BBIINNAARRYY__OOPP ********** │ │ │ │ │ +#define DUNE_BINARY_OP (   OP ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +template() \ │ │ │ │ │ +OP std::declval())> > \ │ │ │ │ │ +decltype(auto) \ │ │ │ │ │ +operator OP(const AlignedNumber &t, \ │ │ │ │ │ +const AlignedNumber &u) \ │ │ │ │ │ +{ \ │ │ │ │ │ +/* can't use std::max(); not constexpr */ \ │ │ │ │ │ +return aligned<(tAlign > uAlign ? tAlign : uAlign)>(T(t) OP U(u)); \ │ │ │ │ │ +} \ │ │ │ │ │ +\ │ │ │ │ │ +template() \ │ │ │ │ │ +OP std::declval())> > \ │ │ │ │ │ +decltype(auto) \ │ │ │ │ │ +operator OP(const T &t, const AlignedNumber &u) \ │ │ │ │ │ +{ \ │ │ │ │ │ +return aligned(t OP U(u)); \ │ │ │ │ │ +} \ │ │ │ │ │ +\ │ │ │ │ │ +template() \ │ │ │ │ │ +OP std::declval())> > \ │ │ │ │ │ +decltype(auto) \ │ │ │ │ │ +operator OP(const AlignedNumber &t, const U &u) \ │ │ │ │ │ +{ \ │ │ │ │ │ +return aligned(T(t) OP u); \ │ │ │ │ │ +} \ │ │ │ │ │ +\ │ │ │ │ │ +static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +********** _?◆_? DDUUNNEE__UUNNAARRYY__FFUUNNCC ********** │ │ │ │ │ +#define DUNE_UNARY_FUNC (   name ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +template \ │ │ │ │ │ +decltype(auto) name(const AlignedNumber &u) \ │ │ │ │ │ +{ \ │ │ │ │ │ +using std::name; \ │ │ │ │ │ +return aligned(name(T(u))); \ │ │ │ │ │ +} \ │ │ │ │ │ +static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00185_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: rangeutilities.hh Source File │ │ │ │ +dune-common: debugalign.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,707 +74,664 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    rangeutilities.hh
    │ │ │ │ +
    debugalign.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_RANGE_UTILITIES_HH
    │ │ │ │ -
    6#define DUNE_COMMON_RANGE_UTILITIES_HH
    │ │ │ │ +
    5#ifndef DUNE_DEBUGALIGN_HH
    │ │ │ │ +
    6#define DUNE_DEBUGALIGN_HH
    │ │ │ │
    7
    │ │ │ │ - │ │ │ │ -
    9#include <algorithm>
    │ │ │ │ -
    10#include <utility>
    │ │ │ │ -
    11#include <type_traits>
    │ │ │ │ -
    12#include <bitset>
    │ │ │ │ -
    13
    │ │ │ │ -
    21namespace Dune
    │ │ │ │ -
    22{
    │ │ │ │ -
    23
    │ │ │ │ -
    34 template <typename T,
    │ │ │ │ -
    35 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    36 typename T::value_type
    │ │ │ │ -
    │ │ │ │ -
    37 max_value(const T & v) {
    │ │ │ │ -
    38 using std::max_element;
    │ │ │ │ -
    39 return *max_element(v.begin(), v.end());
    │ │ │ │ -
    40 }
    │ │ │ │ -
    │ │ │ │ +
    8#include <algorithm>
    │ │ │ │ +
    9#include <cassert>
    │ │ │ │ +
    10#include <cmath>
    │ │ │ │ +
    11#include <complex>
    │ │ │ │ +
    12#include <cstddef>
    │ │ │ │ +
    13#include <cstdint>
    │ │ │ │ +
    14#include <cstdlib> // abs
    │ │ │ │ +
    15#include <functional>
    │ │ │ │ +
    16#include <istream>
    │ │ │ │ +
    17#include <ostream>
    │ │ │ │ +
    18#include <type_traits>
    │ │ │ │ +
    19#include <utility>
    │ │ │ │ +
    20
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    26
    │ │ │ │ +
    27namespace Dune {
    │ │ │ │ +
    28
    │ │ │ │ + │ │ │ │ +
    31 std::function<void(const char*, std::size_t, const void*)>;
    │ │ │ │ +
    32
    │ │ │ │ +
    34
    │ │ │ │ + │ │ │ │
    41
    │ │ │ │ -
    42 template <typename T,
    │ │ │ │ -
    43 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    44 const T & max_value(const T & v) { return v; }
    │ │ │ │ -
    45
    │ │ │ │ -
    51 template <typename T,
    │ │ │ │ -
    52 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    53 typename T::value_type
    │ │ │ │ -
    │ │ │ │ -
    54 min_value(const T & v) {
    │ │ │ │ -
    55 using std::min_element;
    │ │ │ │ -
    56 return *min_element(v.begin(), v.end());
    │ │ │ │ -
    57 }
    │ │ │ │ -
    │ │ │ │ -
    58
    │ │ │ │ -
    59 template <typename T,
    │ │ │ │ -
    60 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    61 const T & min_value(const T & v) { return v; }
    │ │ │ │ -
    62
    │ │ │ │ -
    68 template <typename T,
    │ │ │ │ -
    69 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    │ │ │ │ -
    70 bool any_true(const T & v) {
    │ │ │ │ -
    71 bool b = false;
    │ │ │ │ -
    72 for (const auto & e : v)
    │ │ │ │ -
    73 b = b or bool(e);
    │ │ │ │ -
    74 return b;
    │ │ │ │ -
    75 }
    │ │ │ │ -
    │ │ │ │ -
    76
    │ │ │ │ -
    77 template <typename T,
    │ │ │ │ -
    78 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    79 bool any_true(const T & v) { return v; }
    │ │ │ │ -
    80
    │ │ │ │ -
    81 template<std::size_t N>
    │ │ │ │ -
    │ │ │ │ -
    82 bool any_true(const std::bitset<N> & b)
    │ │ │ │ -
    83 {
    │ │ │ │ -
    84 return b.any();
    │ │ │ │ -
    85 }
    │ │ │ │ -
    │ │ │ │ -
    86
    │ │ │ │ -
    92 template <typename T,
    │ │ │ │ -
    93 typename std::enable_if<IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    │ │ │ │ -
    94 bool all_true(const T & v) {
    │ │ │ │ -
    95 bool b = true;
    │ │ │ │ -
    96 for (const auto & e : v)
    │ │ │ │ -
    97 b = b and bool(e);
    │ │ │ │ -
    98 return b;
    │ │ │ │ -
    99 }
    │ │ │ │ -
    │ │ │ │ -
    100
    │ │ │ │ -
    101 template <typename T,
    │ │ │ │ -
    102 typename std::enable_if<!IsIterable<T>::value, int>::type = 0>
    │ │ │ │ -
    103 bool all_true(const T & v) { return v; }
    │ │ │ │ -
    104
    │ │ │ │ -
    105 template<std::size_t N>
    │ │ │ │ -
    │ │ │ │ -
    106 bool all_true(const std::bitset<N> & b)
    │ │ │ │ -
    107 {
    │ │ │ │ -
    108 return b.all();
    │ │ │ │ -
    109 }
    │ │ │ │ +
    43
    │ │ │ │ +
    52 void violatedAlignment(const char *className, std::size_t expectedAlignment,
    │ │ │ │ +
    53 const void *address);
    │ │ │ │ +
    54
    │ │ │ │ +
    │ │ │ │ +
    56 inline bool isAligned(const void *p, std::size_t align)
    │ │ │ │ +
    57 {
    │ │ │ │ +
    58 // a more portable way to do this would be to abuse std::align(), but that
    │ │ │ │ +
    59 // isn't supported by g++-4.9 yet
    │ │ │ │ +
    60 return std::uintptr_t(p) % align == 0;
    │ │ │ │ +
    61 }
    │ │ │ │
    │ │ │ │ +
    62
    │ │ │ │ +
    64 template<std::size_t align, class Impl>
    │ │ │ │ +
    │ │ │ │ +
    65 class alignas(align) AlignedBase
    │ │ │ │ +
    66 {
    │ │ │ │ +
    67 void checkAlignment() const
    │ │ │ │ +
    68 {
    │ │ │ │ +
    69 auto pimpl = static_cast<const Impl*>(this);
    │ │ │ │ +
    70 if(!isAligned(pimpl, align))
    │ │ │ │ +
    71 violatedAlignment(className<Impl>().c_str(), align, pimpl);
    │ │ │ │ +
    72 }
    │ │ │ │ +
    73 public:
    │ │ │ │ +
    74 AlignedBase() { checkAlignment(); }
    │ │ │ │ +
    75 AlignedBase(const AlignedBase &) { checkAlignment(); }
    │ │ │ │ +
    76 AlignedBase(AlignedBase &&) { checkAlignment(); }
    │ │ │ │ +
    77 ~AlignedBase() { checkAlignment(); }
    │ │ │ │ +
    78
    │ │ │ │ +
    79 AlignedBase& operator=(const AlignedBase &) = default;
    │ │ │ │ + │ │ │ │ +
    81 };
    │ │ │ │ +
    │ │ │ │ +
    82
    │ │ │ │ +
    84 static constexpr auto debugAlignment = 2*alignof(std::max_align_t);
    │ │ │ │ +
    85
    │ │ │ │ +
    │ │ │ │ +
    86 namespace AlignedNumberImpl {
    │ │ │ │ +
    87
    │ │ │ │ +
    88 template<class T, std::size_t align = debugAlignment>
    │ │ │ │ +
    89 class AlignedNumber;
    │ │ │ │ +
    90
    │ │ │ │ +
    91 } // namespace AlignedNumberImpl
    │ │ │ │ +
    │ │ │ │ +
    92
    │ │ │ │ + │ │ │ │ +
    94
    │ │ │ │ +
    95 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ +
    96 struct IsNumber<AlignedNumberImpl::AlignedNumber<T,align>>
    │ │ │ │ +
    97 : public std::true_type {};
    │ │ │ │ +
    │ │ │ │ +
    98
    │ │ │ │ +
    100 template<std::size_t align = debugAlignment, class T>
    │ │ │ │ +
    101 AlignedNumber<T, align> aligned(T value) { return { std::move(value) }; }
    │ │ │ │ +
    102
    │ │ │ │ +
    103 // The purpose of this namespace is to move the `<cmath>` function overloads
    │ │ │ │ +
    104 // out of namespace `Dune`. This avoids problems where people called
    │ │ │ │ +
    105 // e.g. `sqrt(1.0)` inside the `Dune` namespace, without first doing `using
    │ │ │ │ +
    106 // std::sqrt;`. Without any `Dune::sqrt()`, such a use will find
    │ │ │ │ +
    107 // `::sqrt()`, but with `Dune::sqrt()` it will find only `Dune::sqrt()`,
    │ │ │ │ +
    108 // which does not have an overload for `double`.
    │ │ │ │ +
    109 namespace AlignedNumberImpl {
    │ │ │ │
    110
    │ │ │ │ -
    111
    │ │ │ │ -
    112
    │ │ │ │ -
    113 namespace Impl
    │ │ │ │ -
    114 {
    │ │ │ │ -
    115
    │ │ │ │ -
    116 template <class T>
    │ │ │ │ -
    117 class IntegralRangeIterator
    │ │ │ │ -
    118 {
    │ │ │ │ -
    119 public:
    │ │ │ │ -
    120 typedef std::random_access_iterator_tag iterator_category;
    │ │ │ │ -
    121 typedef T value_type;
    │ │ │ │ -
    122 typedef std::make_signed_t<T> difference_type;
    │ │ │ │ -
    123 typedef const T *pointer;
    │ │ │ │ -
    124 typedef T reference;
    │ │ │ │ +
    112 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    114 : public AlignedBase<align, AlignedNumber<T, align> >
    │ │ │ │ +
    115 {
    │ │ │ │ +
    116 T value_;
    │ │ │ │ +
    117
    │ │ │ │ +
    118 public:
    │ │ │ │ +
    119 AlignedNumber() = default;
    │ │ │ │ +
    120 AlignedNumber(T value) : value_(std::move(value)) {}
    │ │ │ │ +
    121 template<class U, std::size_t uAlign,
    │ │ │ │ +
    122 class = std::enable_if_t<(align >= uAlign) &&
    │ │ │ │ +
    123 std::is_convertible<U, T>::value> >
    │ │ │ │ +
    124 AlignedNumber(const AlignedNumber<U, uAlign> &o) : value_(U(o)) {}
    │ │ │ │
    125
    │ │ │ │ -
    126 constexpr IntegralRangeIterator() noexcept : value_(0) {}
    │ │ │ │ -
    127 constexpr explicit IntegralRangeIterator(value_type value) noexcept : value_(value) {}
    │ │ │ │ -
    128
    │ │ │ │ -
    129 pointer operator->() const noexcept { return &value_; }
    │ │ │ │ -
    130 constexpr reference operator*() const noexcept { return value_; }
    │ │ │ │ -
    131
    │ │ │ │ -
    132 constexpr reference operator[]( difference_type n ) const noexcept { return (value_ + n); }
    │ │ │ │ +
    126 // accessors
    │ │ │ │ +
    127 template<class U,
    │ │ │ │ +
    128 class = std::enable_if_t<std::is_convertible<T, U>::value> >
    │ │ │ │ +
    129 explicit operator U() const { return value_; }
    │ │ │ │ +
    130
    │ │ │ │ +
    131 const T &value() const { return value_; }
    │ │ │ │ +
    132 T &value() { return value_; }
    │ │ │ │
    133
    │ │ │ │ -
    134 constexpr bool operator==(const IntegralRangeIterator & other) const noexcept { return (value_ == other.value_); }
    │ │ │ │ -
    135 constexpr bool operator!=(const IntegralRangeIterator & other) const noexcept { return (value_ != other.value_); }
    │ │ │ │ -
    136
    │ │ │ │ -
    137 constexpr bool operator<(const IntegralRangeIterator & other) const noexcept { return (value_ <= other.value_); }
    │ │ │ │ -
    138 constexpr bool operator<=(const IntegralRangeIterator & other) const noexcept { return (value_ <= other.value_); }
    │ │ │ │ -
    139 constexpr bool operator>(const IntegralRangeIterator & other) const noexcept { return (value_ >= other.value_); }
    │ │ │ │ -
    140 constexpr bool operator>=(const IntegralRangeIterator & other) const noexcept { return (value_ >= other.value_); }
    │ │ │ │ +
    134 // I/O
    │ │ │ │ +
    135 template<class charT, class Traits>
    │ │ │ │ +
    136 friend std::basic_istream<charT, Traits>&
    │ │ │ │ +
    │ │ │ │ +
    137 operator>>(std::basic_istream<charT, Traits>& str, AlignedNumber &u)
    │ │ │ │ +
    138 {
    │ │ │ │ +
    139 return str >> u.value_;
    │ │ │ │ +
    140 }
    │ │ │ │ +
    │ │ │ │
    141
    │ │ │ │ -
    142 IntegralRangeIterator& operator++() noexcept { ++value_; return *this; }
    │ │ │ │ -
    143 IntegralRangeIterator operator++(int) noexcept { IntegralRangeIterator copy( *this ); ++(*this); return copy; }
    │ │ │ │ -
    144
    │ │ │ │ -
    145 IntegralRangeIterator& operator--() noexcept { --value_; return *this; }
    │ │ │ │ -
    146 IntegralRangeIterator operator--(int) noexcept { IntegralRangeIterator copy( *this ); --(*this); return copy; }
    │ │ │ │ -
    147
    │ │ │ │ -
    148 IntegralRangeIterator& operator+=(difference_type n) noexcept { value_ += n; return *this; }
    │ │ │ │ -
    149 IntegralRangeIterator& operator-=(difference_type n) noexcept { value_ -= n; return *this; }
    │ │ │ │ -
    150
    │ │ │ │ -
    151 friend constexpr IntegralRangeIterator operator+(const IntegralRangeIterator &a, difference_type n) noexcept { return IntegralRangeIterator(a.value_ + n); }
    │ │ │ │ -
    152 friend constexpr IntegralRangeIterator operator+(difference_type n, const IntegralRangeIterator &a) noexcept { return IntegralRangeIterator(a.value_ + n); }
    │ │ │ │ -
    153 friend constexpr IntegralRangeIterator operator-(const IntegralRangeIterator &a, difference_type n) noexcept { return IntegralRangeIterator(a.value_ - n); }
    │ │ │ │ -
    154
    │ │ │ │ -
    155 constexpr difference_type operator-(const IntegralRangeIterator &other) const noexcept { return (static_cast<difference_type>(value_) - static_cast<difference_type>(other.value_)); }
    │ │ │ │ -
    156
    │ │ │ │ -
    157 private:
    │ │ │ │ -
    158 value_type value_;
    │ │ │ │ -
    159 };
    │ │ │ │ -
    160
    │ │ │ │ -
    161 } // namespace Impl
    │ │ │ │ -
    162
    │ │ │ │ -
    163
    │ │ │ │ +
    142 template<class charT, class Traits>
    │ │ │ │ +
    │ │ │ │ +
    143 friend std::basic_ostream<charT, Traits>&
    │ │ │ │ +
    144 operator<<(std::basic_ostream<charT, Traits>& str,
    │ │ │ │ +
    145 const AlignedNumber &u)
    │ │ │ │ +
    146 {
    │ │ │ │ +
    147 return str << u.value_;
    │ │ │ │ +
    148 }
    │ │ │ │ +
    │ │ │ │ +
    149
    │ │ │ │ +
    150 // The trick with `template<class U = T, class = std::void_t<expr(U)> >` is
    │ │ │ │ +
    151 // needed because at least g++-4.9 seems to evaluates a default argument
    │ │ │ │ +
    152 // in `template<class = std::void_t<expr(T))> >` as soon as possible and will
    │ │ │ │ +
    153 // error out if `expr(T)` is invalid. E.g. for `expr(T)` =
    │ │ │ │ +
    154 // `decltype(--std::declval<T&>())`, instantiating `AlignedNumber<bool>`
    │ │ │ │ +
    155 // will result in an unrecoverable error (`--` cannot be applied to a
    │ │ │ │ +
    156 // `bool`).
    │ │ │ │ +
    157
    │ │ │ │ +
    158 // Increment, decrement
    │ │ │ │ +
    159 template<class U = T, class = std::void_t<decltype(++std::declval<U&>())> >
    │ │ │ │ +
    160 AlignedNumber &operator++() { ++value_; return *this; }
    │ │ │ │ +
    161
    │ │ │ │ +
    162 template<class U = T, class = std::void_t<decltype(--std::declval<U&>())> >
    │ │ │ │ +
    163 AlignedNumber &operator--() { --value_; return *this; }
    │ │ │ │
    164
    │ │ │ │ -
    173 template <class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    175 {
    │ │ │ │ -
    176 public:
    │ │ │ │ -
    178 typedef T value_type;
    │ │ │ │ -
    180 typedef Impl::IntegralRangeIterator<T> iterator;
    │ │ │ │ -
    182 typedef std::make_unsigned_t<T> size_type;
    │ │ │ │ -
    183
    │ │ │ │ -
    185 constexpr IntegralRange(value_type from, value_type to) noexcept : from_(from), to_(to) {}
    │ │ │ │ -
    187 constexpr explicit IntegralRange(value_type to) noexcept : from_(0), to_(to) {}
    │ │ │ │ -
    189 constexpr IntegralRange(std::pair<value_type, value_type> range) noexcept : from_(range.first), to_(range.second) {}
    │ │ │ │ -
    190
    │ │ │ │ -
    192 constexpr iterator begin() const noexcept { return iterator(from_); }
    │ │ │ │ -
    194 constexpr iterator end() const noexcept { return iterator(to_); }
    │ │ │ │ -
    195
    │ │ │ │ -
    197 constexpr value_type operator[](const value_type &i) const noexcept { return (from_ + i); }
    │ │ │ │ -
    198
    │ │ │ │ -
    200 constexpr bool empty() const noexcept { return (from_ == to_); }
    │ │ │ │ -
    202 constexpr size_type size() const noexcept { return (static_cast<size_type>(to_) - static_cast<size_type>(from_)); }
    │ │ │ │ -
    203
    │ │ │ │ -
    204 private:
    │ │ │ │ -
    205 value_type from_, to_;
    │ │ │ │ -
    206 };
    │ │ │ │ -
    │ │ │ │ -
    207
    │ │ │ │ -
    208
    │ │ │ │ -
    223 template <class T, T to, T from = 0>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    225 {
    │ │ │ │ -
    226 template <T ofs, T... i>
    │ │ │ │ -
    227 static std::integer_sequence<T, (i+ofs)...> shift_integer_sequence(std::integer_sequence<T, i...>);
    │ │ │ │ -
    228
    │ │ │ │ -
    229 public:
    │ │ │ │ -
    231 typedef T value_type;
    │ │ │ │ -
    233 typedef Impl::IntegralRangeIterator<T> iterator;
    │ │ │ │ -
    235 typedef std::make_unsigned_t<T> size_type;
    │ │ │ │ +
    165 template<class U = T, class = std::void_t<decltype(std::declval<U&>()++)> >
    │ │ │ │ +
    166 decltype(auto) operator++(int) { return aligned<align>(value_++); }
    │ │ │ │ +
    167
    │ │ │ │ +
    168 template<class U = T, class = std::void_t<decltype(std::declval<U&>()--)> >
    │ │ │ │ +
    169 decltype(auto) operator--(int) { return aligned<align>(value_--); }
    │ │ │ │ +
    170
    │ │ │ │ +
    171 // unary operators
    │ │ │ │ +
    172 template<class U = T,
    │ │ │ │ +
    173 class = std::void_t<decltype(+std::declval<const U&>())> >
    │ │ │ │ +
    174 decltype(auto) operator+() const { return aligned<align>(+value_); }
    │ │ │ │ +
    175
    │ │ │ │ +
    176 template<class U = T,
    │ │ │ │ +
    177 class = std::void_t<decltype(-std::declval<const U&>())> >
    │ │ │ │ +
    178 decltype(auto) operator-() const { return aligned<align>(-value_); }
    │ │ │ │ +
    179
    │ │ │ │ +
    180 /*
    │ │ │ │ +
    181 * silence warnings from GCC about using `~` on a bool
    │ │ │ │ +
    182 * (when instantiated for T=bool)
    │ │ │ │ +
    183 */
    │ │ │ │ +
    184#if __GNUC__ >= 7
    │ │ │ │ +
    185# pragma GCC diagnostic push
    │ │ │ │ +
    186# pragma GCC diagnostic ignored "-Wbool-operation"
    │ │ │ │ +
    187#endif
    │ │ │ │ +
    188#ifdef __clang__
    │ │ │ │ +
    189# pragma clang diagnostic push
    │ │ │ │ +
    190# pragma clang diagnostic ignored "-Wbool-operation"
    │ │ │ │ +
    191#endif
    │ │ │ │ +
    192 template<class U = T,
    │ │ │ │ +
    193 class = std::void_t<decltype(~std::declval<const U&>())> >
    │ │ │ │ +
    194 decltype(auto) operator~() const { return aligned<align>(~value_); }
    │ │ │ │ +
    195#if __GNUC__ >= 7
    │ │ │ │ +
    196# pragma GCC diagnostic pop
    │ │ │ │ +
    197#endif
    │ │ │ │ +
    198#ifdef __clang__
    │ │ │ │ +
    199# pragma clang diagnostic pop
    │ │ │ │ +
    200#endif
    │ │ │ │ +
    201
    │ │ │ │ +
    202 template<class U = T,
    │ │ │ │ +
    203 class = std::void_t<decltype(!std::declval<const U&>())> >
    │ │ │ │ +
    204 decltype(auto) operator!() const { return aligned<align>(!value_); }
    │ │ │ │ +
    205
    │ │ │ │ +
    206 // assignment operators
    │ │ │ │ +
    │ │ │ │ +
    207#define DUNE_ASSIGN_OP(OP) \
    │ │ │ │ +
    208 template<class U, std::size_t uAlign, \
    │ │ │ │ +
    209 class = std::enable_if_t< \
    │ │ │ │ +
    210 ( uAlign <= align && \
    │ │ │ │ +
    211 sizeof(std::declval<T&>() OP std::declval<U>()) ) \
    │ │ │ │ +
    212 > > \
    │ │ │ │ +
    213 AlignedNumber &operator OP(const AlignedNumber<U, uAlign> &u) \
    │ │ │ │ +
    214 { \
    │ │ │ │ +
    215 value_ OP U(u); \
    │ │ │ │ +
    216 return *this; \
    │ │ │ │ +
    217 } \
    │ │ │ │ +
    218 \
    │ │ │ │ +
    219 template<class U, \
    │ │ │ │ +
    220 class = std::void_t<decltype(std::declval<T&>() OP \
    │ │ │ │ +
    221 std::declval<U>())> > \
    │ │ │ │ +
    222 AlignedNumber &operator OP(const U &u) \
    │ │ │ │ +
    223 { \
    │ │ │ │ +
    224 value_ OP u; \
    │ │ │ │ +
    225 return *this; \
    │ │ │ │ +
    226 } \
    │ │ │ │ +
    227 \
    │ │ │ │ +
    228 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │ +
    229
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    232
    │ │ │ │ + │ │ │ │ +
    234 DUNE_ASSIGN_OP(/=);
    │ │ │ │ +
    235 DUNE_ASSIGN_OP(%=);
    │ │ │ │
    236
    │ │ │ │ -
    238 typedef decltype(shift_integer_sequence<from>(std::make_integer_sequence<T, to-from>())) integer_sequence;
    │ │ │ │ -
    239
    │ │ │ │ -
    241 constexpr StaticIntegralRange() noexcept = default;
    │ │ │ │ -
    242
    │ │ │ │ -
    244 constexpr operator IntegralRange<T>() const noexcept { return {from, to}; }
    │ │ │ │ -
    246 constexpr operator integer_sequence() const noexcept { return {}; }
    │ │ │ │ -
    247
    │ │ │ │ -
    249 static constexpr iterator begin() noexcept { return iterator(from); }
    │ │ │ │ -
    251 static constexpr iterator end() noexcept { return iterator(to); }
    │ │ │ │ -
    252
    │ │ │ │ -
    254 template <class U, U i>
    │ │ │ │ -
    │ │ │ │ -
    255 constexpr auto operator[](const std::integral_constant<U, i> &) const noexcept
    │ │ │ │ -
    256 -> std::integral_constant<value_type, from + static_cast<value_type>(i)>
    │ │ │ │ -
    257 {
    │ │ │ │ -
    258 return {};
    │ │ │ │ -
    259 }
    │ │ │ │ -
    │ │ │ │ -
    260
    │ │ │ │ -
    262 constexpr value_type operator[](const size_type &i) const noexcept { return (from + static_cast<value_type>(i)); }
    │ │ │ │ -
    263
    │ │ │ │ -
    265 static constexpr std::integral_constant<bool, from == to> empty() noexcept { return {}; }
    │ │ │ │ -
    267 static constexpr std::integral_constant<size_type, static_cast<size_type>(to) - static_cast<size_type>(from) > size() noexcept { return {}; }
    │ │ │ │ -
    268 };
    │ │ │ │ -
    │ │ │ │ -
    269
    │ │ │ │ -
    279 template<class T, class U,
    │ │ │ │ -
    280 std::enable_if_t<std::is_same<std::decay_t<T>, std::decay_t<U>>::value, int> = 0,
    │ │ │ │ -
    281 std::enable_if_t<std::is_integral<std::decay_t<T>>::value, int> = 0>
    │ │ │ │ -
    │ │ │ │ -
    282 inline static IntegralRange<std::decay_t<T>> range(T &&from, U &&to) noexcept
    │ │ │ │ -
    283 {
    │ │ │ │ -
    284 return IntegralRange<std::decay_t<T>>(std::forward<T>(from), std::forward<U>(to));
    │ │ │ │ -
    285 }
    │ │ │ │ -
    │ │ │ │ + │ │ │ │ +
    238 DUNE_ASSIGN_OP(&=);
    │ │ │ │ +
    239 DUNE_ASSIGN_OP(|=);
    │ │ │ │ +
    240
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    243
    │ │ │ │ +
    244#undef DUNE_ASSIGN_OP
    │ │ │ │ +
    245 };
    │ │ │ │ +
    │ │ │ │ +
    246
    │ │ │ │ +
    247 // binary operators
    │ │ │ │ +
    │ │ │ │ +
    248#define DUNE_BINARY_OP(OP) \
    │ │ │ │ +
    249 template<class T, std::size_t tAlign, class U, std::size_t uAlign, \
    │ │ │ │ +
    250 class = std::void_t<decltype(std::declval<T>() \
    │ │ │ │ +
    251 OP std::declval<U>())> > \
    │ │ │ │ +
    252 decltype(auto) \
    │ │ │ │ +
    253 operator OP(const AlignedNumber<T, tAlign> &t, \
    │ │ │ │ +
    254 const AlignedNumber<U, uAlign> &u) \
    │ │ │ │ +
    255 { \
    │ │ │ │ +
    256 /* can't use std::max(); not constexpr */ \
    │ │ │ │ +
    257 return aligned<(tAlign > uAlign ? tAlign : uAlign)>(T(t) OP U(u)); \
    │ │ │ │ +
    258 } \
    │ │ │ │ +
    259 \
    │ │ │ │ +
    260 template<class T, class U, std::size_t uAlign, \
    │ │ │ │ +
    261 class = std::void_t<decltype(std::declval<T>() \
    │ │ │ │ +
    262 OP std::declval<U>())> > \
    │ │ │ │ +
    263 decltype(auto) \
    │ │ │ │ +
    264 operator OP(const T &t, const AlignedNumber<U, uAlign> &u) \
    │ │ │ │ +
    265 { \
    │ │ │ │ +
    266 return aligned<uAlign>(t OP U(u)); \
    │ │ │ │ +
    267 } \
    │ │ │ │ +
    268 \
    │ │ │ │ +
    269 template<class T, std::size_t tAlign, class U, \
    │ │ │ │ +
    270 class = std::void_t<decltype(std::declval<T>() \
    │ │ │ │ +
    271 OP std::declval<U>())> > \
    │ │ │ │ +
    272 decltype(auto) \
    │ │ │ │ +
    273 operator OP(const AlignedNumber<T, tAlign> &t, const U &u) \
    │ │ │ │ +
    274 { \
    │ │ │ │ +
    275 return aligned<tAlign>(T(t) OP u); \
    │ │ │ │ +
    276 } \
    │ │ │ │ +
    277 \
    │ │ │ │ +
    278 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    │ │ │ │ +
    279
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    282
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
    286
    │ │ │ │ -
    287 template<class T, std::enable_if_t<std::is_integral<std::decay_t<T>>::value, int> = 0>
    │ │ │ │ -
    │ │ │ │ -
    288 inline static IntegralRange<std::decay_t<T>> range(T &&to) noexcept
    │ │ │ │ -
    289 {
    │ │ │ │ -
    290 return IntegralRange<std::decay_t<T>>(std::forward<T>(to));
    │ │ │ │ -
    291 }
    │ │ │ │ -
    │ │ │ │ -
    292
    │ │ │ │ -
    293 template<class T, std::enable_if_t<std::is_enum<std::decay_t<T>>::value, int> = 0>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    295 {
    │ │ │ │ -
    296 return IntegralRange<std::underlying_type_t<std::decay_t<T>>>(std::forward<T>(to));
    │ │ │ │ -
    297 }
    │ │ │ │ -
    │ │ │ │ -
    298
    │ │ │ │ -
    299 template<class T, T from, T to>
    │ │ │ │ -
    │ │ │ │ -
    300 inline static StaticIntegralRange<T, to, from> range(std::integral_constant<T, from>, std::integral_constant<T, to>) noexcept
    │ │ │ │ -
    301 {
    │ │ │ │ -
    302 return {};
    │ │ │ │ -
    303 }
    │ │ │ │ -
    │ │ │ │ -
    304
    │ │ │ │ -
    305 template<class T, T to>
    │ │ │ │ -
    │ │ │ │ -
    306 inline static StaticIntegralRange<T, to> range(std::integral_constant<T, to>) noexcept
    │ │ │ │ -
    307 {
    │ │ │ │ -
    308 return {};
    │ │ │ │ -
    309 }
    │ │ │ │ -
    │ │ │ │ -
    310
    │ │ │ │ -
    311
    │ │ │ │ -
    312
    │ │ │ │ - │ │ │ │ -
    317
    │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    290
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    293
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    300
    │ │ │ │ + │ │ │ │ +
    302 DUNE_BINARY_OP(||);
    │ │ │ │ +
    303
    │ │ │ │ +
    304#undef DUNE_BINARY_OP
    │ │ │ │ +
    305
    │ │ │ │ +
    307 //
    │ │ │ │ +
    308 // Overloads for the functions provided by the standard library
    │ │ │ │ +
    309 //
    │ │ │ │ +
    310#define DUNE_UNARY_FUNC(name) \
    │ │ │ │ +
    311 template<class T, std::size_t align> \
    │ │ │ │ +
    312 decltype(auto) name(const AlignedNumber<T, align> &u) \
    │ │ │ │ +
    313 { \
    │ │ │ │ +
    314 using std::name; \
    │ │ │ │ +
    315 return aligned<align>(name(T(u))); \
    │ │ │ │ +
    316 } \
    │ │ │ │ +
    317 static_assert(true, "Require semicolon to unconfuse editors")
    │ │ │ │ +
    318
    │ │ │ │ +
    319 //
    │ │ │ │ +
    320 // <cmath> functions
    │ │ │ │ +
    321 //
    │ │ │ │
    322
    │ │ │ │ -
    323 namespace Impl
    │ │ │ │ -
    324 {
    │ │ │ │ -
    325
    │ │ │ │ -
    326 // Helper class to mimic a pointer for proxy objects.
    │ │ │ │ -
    327 // This is needed to implement operator-> on an iterator
    │ │ │ │ -
    328 // using proxy-values. It stores the proxy value but
    │ │ │ │ -
    329 // provides operator-> like a pointer.
    │ │ │ │ -
    330 template<class ProxyType>
    │ │ │ │ -
    331 class PointerProxy
    │ │ │ │ -
    332 {
    │ │ │ │ -
    333 public:
    │ │ │ │ -
    334 PointerProxy(ProxyType&& p) : p_(p)
    │ │ │ │ -
    335 {}
    │ │ │ │ -
    336
    │ │ │ │ -
    337 ProxyType* operator->()
    │ │ │ │ -
    338 {
    │ │ │ │ -
    339 return &p_;
    │ │ │ │ -
    340 }
    │ │ │ │ -
    341
    │ │ │ │ -
    342 ProxyType p_;
    │ │ │ │ -
    343 };
    │ │ │ │ -
    344
    │ │ │ │ -
    345 // An iterator transforming a wrapped iterator using
    │ │ │ │ -
    346 // an unary function. It inherits the iterator-category
    │ │ │ │ -
    347 // of the underlying iterator.
    │ │ │ │ -
    348 template <class I, class F, class TransformationType, class C = typename std::iterator_traits<I>::iterator_category>
    │ │ │ │ -
    349 class TransformedRangeIterator;
    │ │ │ │ -
    350
    │ │ │ │ -
    351 template <class I, class F, class TransformationType>
    │ │ │ │ -
    352 class TransformedRangeIterator<I,F,TransformationType,std::forward_iterator_tag>
    │ │ │ │ -
    353 {
    │ │ │ │ -
    354 protected:
    │ │ │ │ -
    355
    │ │ │ │ -
    356 static decltype(auto) transform(const F& f, const I& it) {
    │ │ │ │ -
    357 if constexpr (std::is_same_v<TransformationType,IteratorTransformationTag>)
    │ │ │ │ -
    358 return f(it);
    │ │ │ │ -
    359 else
    │ │ │ │ -
    360 return f(*it);
    │ │ │ │ -
    361 }
    │ │ │ │ -
    362
    │ │ │ │ -
    363 public:
    │ │ │ │ -
    364 using iterator_category = std::forward_iterator_tag;
    │ │ │ │ -
    365 using reference = decltype(transform(std::declval<F>(), std::declval<I>()));
    │ │ │ │ -
    366 using value_type = std::decay_t<reference>;
    │ │ │ │ -
    367 using pointer = PointerProxy<value_type>;
    │ │ │ │ -
    368
    │ │ │ │ -
    369 // If we later want to allow standalone TransformedRangeIterators,
    │ │ │ │ -
    370 // we could customize the FunctionPointer to be a default-constructible,
    │ │ │ │ -
    371 // copy-assignable type storing a function but acting like a pointer
    │ │ │ │ -
    372 // to function.
    │ │ │ │ -
    373 using FunctionPointer = const F*;
    │ │ │ │ -
    374
    │ │ │ │ -
    375 constexpr TransformedRangeIterator(const I& it, FunctionPointer f) noexcept :
    │ │ │ │ -
    376 it_(it),
    │ │ │ │ -
    377 f_(f)
    │ │ │ │ -
    378 {}
    │ │ │ │ -
    379
    │ │ │ │ -
    380 // Explicitly initialize members. Using a plain
    │ │ │ │ -
    381 //
    │ │ │ │ -
    382 // constexpr TransformedRangeIterator() noexcept {}
    │ │ │ │ -
    383 //
    │ │ │ │ -
    384 // would default-initialize the members while
    │ │ │ │ -
    385 //
    │ │ │ │ -
    386 // constexpr TransformedRangeIterator() noexcept : it_(), f_() {}
    │ │ │ │ -
    387 //
    │ │ │ │ -
    388 // leads to value-initialization. This is a case where
    │ │ │ │ -
    389 // both are really different. If it_ is a raw pointer (i.e. POD)
    │ │ │ │ -
    390 // then default-initialization leaves it uninitialized while
    │ │ │ │ -
    391 // value-initialization zero-initializes it.
    │ │ │ │ -
    392 constexpr TransformedRangeIterator() noexcept :
    │ │ │ │ -
    393 it_(),
    │ │ │ │ -
    394 f_()
    │ │ │ │ -
    395 {}
    │ │ │ │ -
    396
    │ │ │ │ -
    397 // Dereferencing returns a value created by the function
    │ │ │ │ -
    398 constexpr reference operator*() const noexcept {
    │ │ │ │ -
    399 return transform(*f_, it_);
    │ │ │ │ -
    400 }
    │ │ │ │ +
    323 // note: only unary functions are provided at the moment. Getting all the
    │ │ │ │ +
    324 // overloads right for functions with more than one argument is tricky.
    │ │ │ │ +
    325 // All <cmath> functions appear in the list below in the order they are
    │ │ │ │ +
    326 // listed in in the standard, but the unimplemented ones are commented
    │ │ │ │ +
    327 // out.
    │ │ │ │ +
    328
    │ │ │ │ +
    329 // note: abs is provided by both <cstdlib> (for integer) and <cmath> (for
    │ │ │ │ +
    330 // floating point). This overload works for both.
    │ │ │ │ +
    331 DUNE_UNARY_FUNC(abs);
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    337 // atan2
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    341 // copysign
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    350 // fdim
    │ │ │ │ + │ │ │ │ +
    352 // fma
    │ │ │ │ +
    353 // fmax
    │ │ │ │ +
    354 // fmin
    │ │ │ │ +
    355 // fmod
    │ │ │ │ +
    356 // frexp
    │ │ │ │ +
    357 // hypos
    │ │ │ │ + │ │ │ │ +
    359 // ldexp
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    370 // modf
    │ │ │ │ +
    371 DUNE_UNARY_FUNC(nearbyint);
    │ │ │ │ +
    372 // nextafter
    │ │ │ │ +
    373 // nexttoward
    │ │ │ │ +
    374 // pow
    │ │ │ │ +
    375 // remainder
    │ │ │ │ +
    376 // remquo
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    379 // scalbln
    │ │ │ │ +
    380 // scalbn
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    388
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    394
    │ │ │ │ +
    395 // isgreater
    │ │ │ │ +
    396 // isgreaterequal
    │ │ │ │ +
    397 // isless
    │ │ │ │ +
    398 // islessequal
    │ │ │ │ +
    399 // islessgreater
    │ │ │ │ +
    400 // isunordered
    │ │ │ │
    401
    │ │ │ │ -
    402 // Dereferencing returns a value created by the function
    │ │ │ │ -
    403 pointer operator->() const noexcept {
    │ │ │ │ -
    404 return transform(*f_, it_);
    │ │ │ │ -
    405 }
    │ │ │ │ -
    406
    │ │ │ │ -
    407 constexpr TransformedRangeIterator& operator=(const TransformedRangeIterator& other) = default;
    │ │ │ │ -
    408
    │ │ │ │ -
    409 constexpr bool operator==(const TransformedRangeIterator& other) const noexcept {
    │ │ │ │ -
    410 return (it_ == other.it_);
    │ │ │ │ -
    411 }
    │ │ │ │ -
    412
    │ │ │ │ -
    413 constexpr bool operator!=(const TransformedRangeIterator& other) const noexcept {
    │ │ │ │ -
    414 return (it_ != other.it_);
    │ │ │ │ -
    415 }
    │ │ │ │ -
    416
    │ │ │ │ -
    417 TransformedRangeIterator& operator++() noexcept {
    │ │ │ │ -
    418 ++it_;
    │ │ │ │ -
    419 return *this;
    │ │ │ │ -
    420 }
    │ │ │ │ -
    421
    │ │ │ │ -
    422 TransformedRangeIterator operator++(int) noexcept {
    │ │ │ │ -
    423 TransformedRangeIterator copy(*this);
    │ │ │ │ -
    424 ++(*this);
    │ │ │ │ -
    425 return copy;
    │ │ │ │ -
    426 }
    │ │ │ │ -
    427
    │ │ │ │ -
    428 protected:
    │ │ │ │ -
    429 I it_;
    │ │ │ │ -
    430 FunctionPointer f_;
    │ │ │ │ -
    431 };
    │ │ │ │ -
    432
    │ │ │ │ -
    433
    │ │ │ │ -
    434
    │ │ │ │ -
    435 template <class I, class F, class T>
    │ │ │ │ -
    436 class TransformedRangeIterator<I,F,T,std::bidirectional_iterator_tag> :
    │ │ │ │ -
    437 public TransformedRangeIterator<I,F,T,std::forward_iterator_tag>
    │ │ │ │ -
    438 {
    │ │ │ │ -
    439 protected:
    │ │ │ │ -
    440 using Base = TransformedRangeIterator<I,F,T,std::forward_iterator_tag>;
    │ │ │ │ -
    441 using Base::it_;
    │ │ │ │ -
    442 using Base::f_;
    │ │ │ │ -
    443 public:
    │ │ │ │ -
    444 using iterator_category = std::bidirectional_iterator_tag;
    │ │ │ │ -
    445 using reference = typename Base::reference;
    │ │ │ │ -
    446 using value_type = typename Base::value_type;
    │ │ │ │ -
    447 using pointer = typename Base::pointer;
    │ │ │ │ -
    448
    │ │ │ │ -
    449 using FunctionPointer = typename Base::FunctionPointer;
    │ │ │ │ -
    450
    │ │ │ │ -
    451 using Base::Base;
    │ │ │ │ -
    452
    │ │ │ │ -
    453 // Member functions of the forward_iterator that need
    │ │ │ │ -
    454 // to be redefined because the base class methods return a
    │ │ │ │ -
    455 // forward_iterator.
    │ │ │ │ -
    456 constexpr TransformedRangeIterator& operator=(const TransformedRangeIterator& other) = default;
    │ │ │ │ -
    457
    │ │ │ │ -
    458 TransformedRangeIterator& operator++() noexcept {
    │ │ │ │ -
    459 ++it_;
    │ │ │ │ -
    460 return *this;
    │ │ │ │ -
    461 }
    │ │ │ │ -
    462
    │ │ │ │ -
    463 TransformedRangeIterator operator++(int) noexcept {
    │ │ │ │ -
    464 TransformedRangeIterator copy(*this);
    │ │ │ │ -
    465 ++(*this);
    │ │ │ │ -
    466 return copy;
    │ │ │ │ -
    467 }
    │ │ │ │ -
    468
    │ │ │ │ -
    469 // Additional member functions of bidirectional_iterator
    │ │ │ │ -
    470 TransformedRangeIterator& operator--() noexcept {
    │ │ │ │ -
    471 --(this->it_);
    │ │ │ │ -
    472 return *this;
    │ │ │ │ -
    473 }
    │ │ │ │ -
    474
    │ │ │ │ -
    475 TransformedRangeIterator operator--(int) noexcept {
    │ │ │ │ -
    476 TransformedRangeIterator copy(*this);
    │ │ │ │ -
    477 --(*this);
    │ │ │ │ -
    478 return copy;
    │ │ │ │ -
    479 }
    │ │ │ │ -
    480 };
    │ │ │ │ -
    481
    │ │ │ │ -
    482
    │ │ │ │ -
    483
    │ │ │ │ -
    484 template <class I, class F, class T>
    │ │ │ │ -
    485 class TransformedRangeIterator<I,F,T,std::random_access_iterator_tag> :
    │ │ │ │ -
    486 public TransformedRangeIterator<I,F,T,std::bidirectional_iterator_tag>
    │ │ │ │ -
    487 {
    │ │ │ │ -
    488 protected:
    │ │ │ │ -
    489 using Base = TransformedRangeIterator<I,F,T,std::bidirectional_iterator_tag>;
    │ │ │ │ -
    490 using Base::it_;
    │ │ │ │ -
    491 using Base::f_;
    │ │ │ │ -
    492 public:
    │ │ │ │ -
    493 using iterator_category = std::random_access_iterator_tag;
    │ │ │ │ -
    494 using reference = typename Base::reference;
    │ │ │ │ -
    495 using value_type = typename Base::value_type;
    │ │ │ │ -
    496 using pointer = typename Base::pointer;
    │ │ │ │ -
    497 using difference_type = typename std::iterator_traits<I>::difference_type;
    │ │ │ │ -
    498
    │ │ │ │ -
    499 using FunctionPointer = typename Base::FunctionPointer;
    │ │ │ │ -
    500
    │ │ │ │ -
    501 using Base::Base;
    │ │ │ │ -
    502
    │ │ │ │ -
    503 // Member functions of the forward_iterator that need
    │ │ │ │ -
    504 // to be redefined because the base class methods return a
    │ │ │ │ -
    505 // forward_iterator.
    │ │ │ │ -
    506 constexpr TransformedRangeIterator& operator=(const TransformedRangeIterator& other) = default;
    │ │ │ │ +
    402 //
    │ │ │ │ +
    403 // <complex> functions
    │ │ │ │ +
    404 //
    │ │ │ │ +
    405
    │ │ │ │ +
    406 // not all functions are implemented, and unlike for <cmath>, no
    │ │ │ │ +
    407 // comprehensive list is provided
    │ │ │ │ + │ │ │ │ +
    409
    │ │ │ │ +
    410#undef DUNE_UNARY_FUNC
    │ │ │ │ +
    411
    │ │ │ │ +
    412 // We need to overload min() and max() since they require types to be
    │ │ │ │ +
    413 // LessThanComparable, which requires `a<b` to be "convertible to bool".
    │ │ │ │ +
    414 // That wording seems to be a leftover from C++03, and today is probably
    │ │ │ │ +
    415 // equivalent to "implicitly convertible". There is also issue 2114
    │ │ │ │ +
    416 // <https://cplusplus.github.io/LWG/issue2114> in the standard (still open
    │ │ │ │ +
    417 // as of 2018-07-06), which strives to require both "implicitly" and
    │ │ │ │ +
    418 // "contextually" convertible -- plus a few other things.
    │ │ │ │ +
    419 //
    │ │ │ │ +
    420 // We do not want our debug type to automatically decay to the underlying
    │ │ │ │ +
    421 // type, so we do not want to make the conversion non-explicit. So the
    │ │ │ │ +
    422 // only option left is to overload min() and max().
    │ │ │ │ +
    423
    │ │ │ │ +
    424 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    427 {
    │ │ │ │ +
    428 using std::max;
    │ │ │ │ +
    429 return aligned<align>(max(T(a), T(b)));
    │ │ │ │ +
    430 }
    │ │ │ │ +
    │ │ │ │ +
    431
    │ │ │ │ +
    432 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ +
    433 auto max(const T &a, const AlignedNumber<T, align> &b)
    │ │ │ │ +
    434 {
    │ │ │ │ +
    435 using std::max;
    │ │ │ │ +
    436 return aligned<align>(max(a, T(b)));
    │ │ │ │ +
    437 }
    │ │ │ │ +
    │ │ │ │ +
    438
    │ │ │ │ +
    439 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ +
    440 auto max(const AlignedNumber<T, align> &a, const T &b)
    │ │ │ │ +
    441 {
    │ │ │ │ +
    442 using std::max;
    │ │ │ │ +
    443 return aligned<align>(max(T(a), b));
    │ │ │ │ +
    444 }
    │ │ │ │ +
    │ │ │ │ +
    445
    │ │ │ │ +
    446 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    449 {
    │ │ │ │ +
    450 using std::min;
    │ │ │ │ +
    451 return aligned<align>(min(T(a), T(b)));
    │ │ │ │ +
    452 }
    │ │ │ │ +
    │ │ │ │ +
    453
    │ │ │ │ +
    454 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ +
    455 auto min(const T &a, const AlignedNumber<T, align> &b)
    │ │ │ │ +
    456 {
    │ │ │ │ +
    457 using std::min;
    │ │ │ │ +
    458 return aligned<align>(min(a, T(b)));
    │ │ │ │ +
    459 }
    │ │ │ │ +
    │ │ │ │ +
    460
    │ │ │ │ +
    461 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ +
    462 auto min(const AlignedNumber<T, align> &a, const T &b)
    │ │ │ │ +
    463 {
    │ │ │ │ +
    464 using std::min;
    │ │ │ │ +
    465 return aligned<align>(min(T(a), b));
    │ │ │ │ +
    466 }
    │ │ │ │ +
    │ │ │ │ +
    467
    │ │ │ │ +
    468 } // namespace AlignedNumberImpl
    │ │ │ │ +
    469
    │ │ │ │ +
    470 // SIMD-like functions from "conditional.hh"
    │ │ │ │ +
    471 template<class T, std::size_t align>
    │ │ │ │ +
    472 AlignedNumber<T, align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    475 {
    │ │ │ │ +
    476 return b ? v1 : v2;
    │ │ │ │ +
    477 }
    │ │ │ │ +
    │ │ │ │ +
    478
    │ │ │ │ +
    479 // SIMD-like functions from "rangeutilities.hh"
    │ │ │ │ +
    480 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    482 {
    │ │ │ │ +
    483 return T(val);
    │ │ │ │ +
    484 }
    │ │ │ │ +
    │ │ │ │ +
    485
    │ │ │ │ +
    486 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    488 {
    │ │ │ │ +
    489 return T(val);
    │ │ │ │ +
    490 }
    │ │ │ │ +
    │ │ │ │ +
    491
    │ │ │ │ +
    492 template<std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    494 {
    │ │ │ │ +
    495 return bool(val);
    │ │ │ │ +
    496 }
    │ │ │ │ +
    │ │ │ │ +
    497
    │ │ │ │ +
    498 template<std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    500 {
    │ │ │ │ +
    501 return bool(val);
    │ │ │ │ +
    502 }
    │ │ │ │ +
    │ │ │ │ +
    503
    │ │ │ │ +
    504 // SIMD-like functionality from "simd/interface.hh"
    │ │ │ │ +
    │ │ │ │ +
    505 namespace Simd {
    │ │ │ │ +
    │ │ │ │ +
    506 namespace Overloads {
    │ │ │ │
    507
    │ │ │ │ -
    508 TransformedRangeIterator& operator++() noexcept {
    │ │ │ │ -
    509 ++it_;
    │ │ │ │ -
    510 return *this;
    │ │ │ │ -
    511 }
    │ │ │ │ -
    512
    │ │ │ │ -
    513 TransformedRangeIterator operator++(int) noexcept {
    │ │ │ │ -
    514 TransformedRangeIterator copy(*this);
    │ │ │ │ -
    515 ++(*this);
    │ │ │ │ -
    516 return copy;
    │ │ │ │ -
    517 }
    │ │ │ │ +
    508 template<class T, std::size_t align>
    │ │ │ │ + │ │ │ │ +
    510
    │ │ │ │ +
    511 template<class U, class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ +
    512 struct RebindType<U, AlignedNumber<T, align> > {
    │ │ │ │ + │ │ │ │ +
    514 };
    │ │ │ │ +
    │ │ │ │ +
    515
    │ │ │ │ +
    516 template<class T, std::size_t align>
    │ │ │ │ +
    517 struct LaneCount<AlignedNumber<T, align> > : index_constant<1> {};
    │ │ │ │
    518
    │ │ │ │ -
    519 // Member functions of the bidirectional_iterator that need
    │ │ │ │ -
    520 // to be redefined because the base class methods return a
    │ │ │ │ -
    521 // bidirectional_iterator.
    │ │ │ │ -
    522 TransformedRangeIterator& operator--() noexcept {
    │ │ │ │ -
    523 --(this->it_);
    │ │ │ │ -
    524 return *this;
    │ │ │ │ -
    525 }
    │ │ │ │ -
    526
    │ │ │ │ -
    527 TransformedRangeIterator operator--(int) noexcept {
    │ │ │ │ -
    528 TransformedRangeIterator copy(*this);
    │ │ │ │ -
    529 --(*this);
    │ │ │ │ -
    530 return copy;
    │ │ │ │ +
    519 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    521 {
    │ │ │ │ +
    522 assert(l == 0);
    │ │ │ │ +
    523 return v.value();
    │ │ │ │ +
    524 }
    │ │ │ │ +
    │ │ │ │ +
    525
    │ │ │ │ +
    526 template<class T, std::size_t align>
    │ │ │ │ +
    │ │ │ │ +
    527 T lane(ADLTag<5>, std::size_t l, const AlignedNumber<T, align> &v)
    │ │ │ │ +
    528 {
    │ │ │ │ +
    529 assert(l == 0);
    │ │ │ │ +
    530 return v.value();
    │ │ │ │
    531 }
    │ │ │ │ +
    │ │ │ │
    532
    │ │ │ │ -
    533 // Additional member functions of random_access_iterator
    │ │ │ │ -
    534 TransformedRangeIterator& operator+=(difference_type n) noexcept {
    │ │ │ │ -
    535 it_ += n;
    │ │ │ │ -
    536 return *this;
    │ │ │ │ -
    537 }
    │ │ │ │ -
    538
    │ │ │ │ -
    539 TransformedRangeIterator& operator-=(difference_type n) noexcept {
    │ │ │ │ -
    540 it_ -= n;
    │ │ │ │ -
    541 return *this;
    │ │ │ │ -
    542 }
    │ │ │ │ -
    543
    │ │ │ │ -
    544 bool operator<(const TransformedRangeIterator& other) noexcept {
    │ │ │ │ -
    545 return it_<other.it_;
    │ │ │ │ +
    533 template<class T, std::size_t align>
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    536 const AlignedNumber<T, align> &ifTrue,
    │ │ │ │ +
    537 const AlignedNumber<T, align> &ifFalse)
    │ │ │ │ +
    538 {
    │ │ │ │ +
    539 return mask ? ifTrue : ifFalse;
    │ │ │ │ +
    540 }
    │ │ │ │ +
    │ │ │ │ +
    541
    │ │ │ │ +
    542 template<std::size_t align>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    544 {
    │ │ │ │ +
    545 return bool(mask);
    │ │ │ │
    546 }
    │ │ │ │ +
    │ │ │ │
    547
    │ │ │ │ -
    548 bool operator<=(const TransformedRangeIterator& other) noexcept {
    │ │ │ │ -
    549 return it_<=other.it_;
    │ │ │ │ -
    550 }
    │ │ │ │ +
    548 } // namespace Overloads
    │ │ │ │ +
    │ │ │ │ +
    549
    │ │ │ │ +
    550 } // namespace Simd
    │ │ │ │ +
    │ │ │ │
    551
    │ │ │ │ -
    552 bool operator>(const TransformedRangeIterator& other) noexcept {
    │ │ │ │ -
    553 return it_>other.it_;
    │ │ │ │ -
    554 }
    │ │ │ │ -
    555
    │ │ │ │ -
    556 bool operator>=(const TransformedRangeIterator& other) noexcept {
    │ │ │ │ -
    557 return it_>=other.it_;
    │ │ │ │ -
    558 }
    │ │ │ │ -
    559
    │ │ │ │ -
    560 reference operator[](difference_type n) noexcept {
    │ │ │ │ -
    561 return Base::transform(*f_, it_+n);
    │ │ │ │ -
    562 }
    │ │ │ │ -
    563
    │ │ │ │ -
    564 friend
    │ │ │ │ -
    565 TransformedRangeIterator operator+(const TransformedRangeIterator& it, difference_type n) noexcept {
    │ │ │ │ -
    566 return TransformedRangeIterator(it.it_+n, it.f_);
    │ │ │ │ -
    567 }
    │ │ │ │ -
    568
    │ │ │ │ -
    569 friend
    │ │ │ │ -
    570 TransformedRangeIterator operator+(difference_type n, const TransformedRangeIterator& it) noexcept {
    │ │ │ │ -
    571 return TransformedRangeIterator(n+it.it_, it.f_);
    │ │ │ │ -
    572 }
    │ │ │ │ -
    573
    │ │ │ │ -
    574 friend
    │ │ │ │ -
    575 TransformedRangeIterator operator-(const TransformedRangeIterator& it, difference_type n) noexcept {
    │ │ │ │ -
    576 return TransformedRangeIterator(it.it_-n, it.f_);
    │ │ │ │ -
    577 }
    │ │ │ │ -
    578
    │ │ │ │ -
    579 friend
    │ │ │ │ -
    580 difference_type operator-(const TransformedRangeIterator& first, const TransformedRangeIterator& second) noexcept {
    │ │ │ │ -
    581 return first.it_-second.it_;
    │ │ │ │ -
    582 }
    │ │ │ │ -
    583 };
    │ │ │ │ -
    584
    │ │ │ │ -
    585
    │ │ │ │ -
    586 } // namespace Impl
    │ │ │ │ -
    587
    │ │ │ │ -
    588
    │ │ │ │ -
    589
    │ │ │ │ -
    626 template <class R, class F, class T=ValueTransformationTag>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    628 {
    │ │ │ │ -
    629 using RawConstIterator = std::decay_t<decltype(std::declval<const R>().begin())>;
    │ │ │ │ -
    630 using RawIterator = std::decay_t<decltype(std::declval<R>().begin())>;
    │ │ │ │ -
    631
    │ │ │ │ -
    632 public:
    │ │ │ │ -
    633
    │ │ │ │ -
    640 using const_iterator = Impl::TransformedRangeIterator<RawConstIterator, F, T>;
    │ │ │ │ -
    641
    │ │ │ │ -
    648 using iterator = Impl::TransformedRangeIterator<RawIterator, F, T>;
    │ │ │ │ -
    649
    │ │ │ │ -
    656 using RawRange = std::remove_reference_t<R>;
    │ │ │ │ -
    657
    │ │ │ │ -
    661 template<class RR>
    │ │ │ │ -
    │ │ │ │ -
    662 constexpr TransformedRangeView(RR&& rawRange, const F& f) noexcept :
    │ │ │ │ -
    663 rawRange_(std::forward<RR>(rawRange)),
    │ │ │ │ -
    664 f_(f)
    │ │ │ │ -
    665 {
    │ │ │ │ -
    666 static_assert(std::is_same_v<T, ValueTransformationTag> or std::is_same_v<T, IteratorTransformationTag>,
    │ │ │ │ -
    667 "The TransformationType passed to TransformedRangeView has to be either ValueTransformationTag or IteratorTransformationTag.");
    │ │ │ │ -
    668 }
    │ │ │ │ -
    │ │ │ │ -
    669
    │ │ │ │ -
    │ │ │ │ -
    678 constexpr const_iterator begin() const noexcept {
    │ │ │ │ -
    679 return const_iterator(rawRange_.begin(), &f_);
    │ │ │ │ -
    680 }
    │ │ │ │ -
    │ │ │ │ -
    681
    │ │ │ │ -
    │ │ │ │ -
    682 constexpr iterator begin() noexcept {
    │ │ │ │ -
    683 return iterator(rawRange_.begin(), &f_);
    │ │ │ │ -
    684 }
    │ │ │ │ -
    │ │ │ │ -
    685
    │ │ │ │ -
    │ │ │ │ -
    694 constexpr const_iterator end() const noexcept {
    │ │ │ │ -
    695 return const_iterator(rawRange_.end(), &f_);
    │ │ │ │ -
    696 }
    │ │ │ │ -
    │ │ │ │ -
    697
    │ │ │ │ -
    │ │ │ │ -
    698 constexpr iterator end() noexcept {
    │ │ │ │ -
    699 return iterator(rawRange_.end(), &f_);
    │ │ │ │ -
    700 }
    │ │ │ │ -
    │ │ │ │ -
    701
    │ │ │ │ -
    712 template<class Dummy=R,
    │ │ │ │ -
    713 class = std::void_t<decltype(std::declval<Dummy>().size())>>
    │ │ │ │ -
    │ │ │ │ -
    714 auto size() const
    │ │ │ │ -
    715 {
    │ │ │ │ -
    716 return rawRange_.size();
    │ │ │ │ -
    717 }
    │ │ │ │ -
    │ │ │ │ -
    718
    │ │ │ │ -
    │ │ │ │ -
    722 const RawRange& rawRange() const
    │ │ │ │ -
    723 {
    │ │ │ │ -
    724 return rawRange_;
    │ │ │ │ -
    725 }
    │ │ │ │ -
    │ │ │ │ -
    726
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    731 {
    │ │ │ │ -
    732 return rawRange_;
    │ │ │ │ -
    733 }
    │ │ │ │ -
    │ │ │ │ -
    734
    │ │ │ │ -
    735 private:
    │ │ │ │ -
    736 R rawRange_;
    │ │ │ │ -
    737 F f_;
    │ │ │ │ -
    738 };
    │ │ │ │ -
    │ │ │ │ -
    739
    │ │ │ │ -
    768 template <class R, class F>
    │ │ │ │ -
    │ │ │ │ -
    769 auto transformedRangeView(R&& range, const F& f)
    │ │ │ │ -
    770 {
    │ │ │ │ - │ │ │ │ -
    772 }
    │ │ │ │ -
    │ │ │ │ -
    773
    │ │ │ │ -
    801 template <class R, class F>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    803 {
    │ │ │ │ - │ │ │ │ -
    805 }
    │ │ │ │ -
    │ │ │ │ -
    806
    │ │ │ │ -
    807
    │ │ │ │ -
    820 template<class Range>
    │ │ │ │ -
    │ │ │ │ -
    821 auto sparseRange(Range&& range) {
    │ │ │ │ -
    822 return Dune::iteratorTransformedRangeView(std::forward<Range>(range), [](auto&& it) {
    │ │ │ │ -
    823 return std::tuple<decltype(*it), decltype(it.index())>(*it, it.index());
    │ │ │ │ -
    824 });
    │ │ │ │ -
    825 }
    │ │ │ │ -
    │ │ │ │ -
    826
    │ │ │ │ -
    831}
    │ │ │ │ -
    832
    │ │ │ │ -
    833#endif // DUNE_COMMON_RANGE_UTILITIES_HH
    │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ -
    auto sparseRange(Range &&range)
    Allow structured-binding for-loops for sparse iterators.
    Definition rangeutilities.hh:821
    │ │ │ │ -
    auto iteratorTransformedRangeView(R &&range, const F &f)
    Create a TransformedRangeView using an iterator transformation.
    Definition rangeutilities.hh:802
    │ │ │ │ -
    auto transformedRangeView(R &&range, const F &f)
    Create a TransformedRangeView.
    Definition rangeutilities.hh:769
    │ │ │ │ -
    static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
    Definition rangeutilities.hh:300
    │ │ │ │ -
    bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:549
    │ │ │ │ -
    bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:542
    │ │ │ │ -
    bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:535
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition iteratorfacades.hh:637
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition iteratorfacades.hh:683
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition iteratorfacades.hh:660
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition iteratorfacades.hh:237
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition iteratorfacades.hh:705
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition iteratorfacades.hh:259
    │ │ │ │ +
    552} // namespace Dune
    │ │ │ │ +
    553
    │ │ │ │ +
    554#endif // DUNE_DEBUGALIGN_HH
    │ │ │ │ +
    A free function to provide the demangled class name of a given object or type as a string.
    │ │ │ │ + │ │ │ │ +
    Basic definitions for SIMD Implementations.
    │ │ │ │ +
    Default implementations for SIMD Implementations.
    │ │ │ │ +
    #define DUNE_BINARY_OP(OP)
    Definition debugalign.hh:248
    │ │ │ │ +
    #define DUNE_UNARY_FUNC(name)
    │ │ │ │ +
    #define DUNE_ASSIGN_OP(OP)
    Definition debugalign.hh:207
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    std::integral_constant< std::size_t, i > index_constant
    An index constant with value i.
    Definition indices.hh:30
    │ │ │ │ +
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │ +
    Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
    implements Simd::mask()
    Definition defaults.hh:153
    │ │ │ │
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ +
    void violatedAlignment(const char *className, std::size_t expectedAlignment, const void *address)
    called when an alignment violation is detected
    Definition debugalign.cc:39
    │ │ │ │
    bool any_true(const AlignedNumber< bool, align > &val)
    Definition debugalign.hh:493
    │ │ │ │
    bool all_true(const AlignedNumber< bool, align > &val)
    Definition debugalign.hh:499
    │ │ │ │ +
    std::string className()
    Provide the demangled class name of a type T as a string.
    Definition classname.hh:47
    │ │ │ │ +
    static constexpr auto debugAlignment
    an alignment large enough to trigger alignment errors
    Definition debugalign.hh:84
    │ │ │ │ +
    const T1 cond(bool b, const T1 &v1, const T2 &v2)
    conditional evaluate
    Definition conditional.hh:28
    │ │ │ │ +
    AlignedNumber< T, align > aligned(T value)
    align a value to a certain alignment
    Definition debugalign.hh:101
    │ │ │ │ +
    ViolatedAlignmentHandler & violatedAlignmentHandler()
    access the handler called by violatedAlignment()
    Definition debugalign.cc:33
    │ │ │ │ +
    bool isAligned(const void *p, std::size_t align)
    check whether an address conforms to the given alignment
    Definition debugalign.hh:56
    │ │ │ │
    T max_value(const AlignedNumber< T, align > &val)
    Definition debugalign.hh:481
    │ │ │ │ +
    std::function< void(const char *, std::size_t, const void *)> ViolatedAlignmentHandler
    type of the handler called by violatedAlignment()
    Definition debugalign.hh:31
    │ │ │ │
    T min_value(const AlignedNumber< T, align > &val)
    Definition debugalign.hh:487
    │ │ │ │ -
    dynamic integer range for use in range-based for loops
    Definition rangeutilities.hh:175
    │ │ │ │ -
    constexpr iterator begin() const noexcept
    obtain a random-access iterator to the first element
    Definition rangeutilities.hh:192
    │ │ │ │ -
    constexpr iterator end() const noexcept
    obtain a random-access iterator past the last element
    Definition rangeutilities.hh:194
    │ │ │ │ -
    std::make_unsigned_t< T > size_type
    unsigned integer type corresponding to value_type
    Definition rangeutilities.hh:182
    │ │ │ │ -
    Impl::IntegralRangeIterator< T > iterator
    type of iterator
    Definition rangeutilities.hh:180
    │ │ │ │ -
    constexpr value_type operator[](const value_type &i) const noexcept
    access specified element
    Definition rangeutilities.hh:197
    │ │ │ │ -
    constexpr bool empty() const noexcept
    check whether the range is empty
    Definition rangeutilities.hh:200
    │ │ │ │ -
    constexpr IntegralRange(std::pair< value_type, value_type > range) noexcept
    construct integer range std::pair
    Definition rangeutilities.hh:189
    │ │ │ │ -
    constexpr IntegralRange(value_type from, value_type to) noexcept
    construct integer range [from, to)
    Definition rangeutilities.hh:185
    │ │ │ │ -
    constexpr size_type size() const noexcept
    obtain number of elements in the range
    Definition rangeutilities.hh:202
    │ │ │ │ -
    constexpr IntegralRange(value_type to) noexcept
    construct integer range [0, to)
    Definition rangeutilities.hh:187
    │ │ │ │ -
    T value_type
    type of integers contained in the range
    Definition rangeutilities.hh:178
    │ │ │ │ -
    static integer range for use in range-based for loops
    Definition rangeutilities.hh:225
    │ │ │ │ -
    static constexpr iterator end() noexcept
    obtain a random-access iterator past the last element
    Definition rangeutilities.hh:251
    │ │ │ │ -
    decltype(shift_integer_sequence< from >(std::make_integer_sequence< T, to-from >())) integer_sequence
    type of corresponding std::integer_sequence
    Definition rangeutilities.hh:238
    │ │ │ │ -
    constexpr StaticIntegralRange() noexcept=default
    default constructor
    │ │ │ │ -
    std::make_unsigned_t< T > size_type
    unsigned integer type corresponding to value_type
    Definition rangeutilities.hh:235
    │ │ │ │ -
    T value_type
    type of integers contained in the range
    Definition rangeutilities.hh:231
    │ │ │ │ -
    constexpr auto operator[](const std::integral_constant< U, i > &) const noexcept -> std::integral_constant< value_type, from+static_cast< value_type >(i)>
    access specified element (static version)
    Definition rangeutilities.hh:255
    │ │ │ │ -
    static constexpr std::integral_constant< bool, from==to > empty() noexcept
    check whether the range is empty
    Definition rangeutilities.hh:265
    │ │ │ │ -
    static constexpr iterator begin() noexcept
    obtain a random-access iterator to the first element
    Definition rangeutilities.hh:249
    │ │ │ │ -
    constexpr value_type operator[](const size_type &i) const noexcept
    access specified element (dynamic version)
    Definition rangeutilities.hh:262
    │ │ │ │ -
    Impl::IntegralRangeIterator< T > iterator
    type of iterator
    Definition rangeutilities.hh:233
    │ │ │ │ -
    static constexpr std::integral_constant< size_type, static_cast< size_type >(to) - static_cast< size_type >(from) > size() noexcept
    obtain number of elements in the range
    Definition rangeutilities.hh:267
    │ │ │ │ -
    Tag to enable value based transformations in TransformedRangeView.
    Definition rangeutilities.hh:316
    │ │ │ │ -
    Tag to enable iterator based transformations in TransformedRangeView.
    Definition rangeutilities.hh:321
    │ │ │ │ -
    A range transforming the values of another range on-the-fly.
    Definition rangeutilities.hh:628
    │ │ │ │ -
    auto size() const
    Obtain the size of the range.
    Definition rangeutilities.hh:714
    │ │ │ │ -
    constexpr iterator end() noexcept
    Definition rangeutilities.hh:698
    │ │ │ │ -
    std::remove_reference_t< R > RawRange
    Export type of the wrapped untransformed range.
    Definition rangeutilities.hh:656
    │ │ │ │ -
    Impl::TransformedRangeIterator< RawConstIterator, F, T > const_iterator
    Const iterator type.
    Definition rangeutilities.hh:640
    │ │ │ │ -
    constexpr iterator begin() noexcept
    Definition rangeutilities.hh:682
    │ │ │ │ -
    constexpr TransformedRangeView(RR &&rawRange, const F &f) noexcept
    Construct from range and function.
    Definition rangeutilities.hh:662
    │ │ │ │ -
    const RawRange & rawRange() const
    Export the wrapped untransformed range.
    Definition rangeutilities.hh:722
    │ │ │ │ -
    Impl::TransformedRangeIterator< RawIterator, F, T > iterator
    Iterator type.
    Definition rangeutilities.hh:648
    │ │ │ │ -
    constexpr const_iterator begin() const noexcept
    Obtain a iterator to the first element.
    Definition rangeutilities.hh:678
    │ │ │ │ -
    constexpr const_iterator end() const noexcept
    Obtain a iterator past the last element.
    Definition rangeutilities.hh:694
    │ │ │ │ -
    RawRange & rawRange()
    Export the wrapped untransformed range.
    Definition rangeutilities.hh:730
    │ │ │ │ +
    auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition debugalign.hh:447
    │ │ │ │ +
    auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition debugalign.hh:425
    │ │ │ │ +
    bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
    Definition debugalign.hh:543
    │ │ │ │ +
    T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
    Definition debugalign.hh:520
    │ │ │ │ +
    Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
    Definition typetraits.hh:194
    │ │ │ │ +
    CRTP base mixin class to check alignment.
    Definition debugalign.hh:66
    │ │ │ │ +
    ~AlignedBase()
    Definition debugalign.hh:77
    │ │ │ │ +
    AlignedBase & operator=(AlignedBase &&)=default
    │ │ │ │ +
    AlignedBase(AlignedBase &&)
    Definition debugalign.hh:76
    │ │ │ │ +
    AlignedBase & operator=(const AlignedBase &)=default
    │ │ │ │ +
    AlignedBase(const AlignedBase &)
    Definition debugalign.hh:75
    │ │ │ │ +
    AlignedBase()
    Definition debugalign.hh:74
    │ │ │ │ +
    aligned wrappers for arithmetic types
    Definition debugalign.hh:115
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    decltype(auto) operator+() const
    Definition debugalign.hh:174
    │ │ │ │ + │ │ │ │ +
    decltype(auto) operator--(int)
    Definition debugalign.hh:169
    │ │ │ │ +
    DUNE_ASSIGN_OP * DUNE_ASSIGN_OP(/=);DUNE_ASSIGN_OP(%=
    │ │ │ │ +
    decltype(auto) operator++(int)
    Definition debugalign.hh:166
    │ │ │ │ +
    decltype(auto) operator!() const
    Definition debugalign.hh:204
    │ │ │ │ +
    T & value()
    Definition debugalign.hh:132
    │ │ │ │ +
    const T & value() const
    Definition debugalign.hh:131
    │ │ │ │ +
    DUNE_ASSIGN_OP^ DUNE_ASSIGN_OP(&=);DUNE_ASSIGN_OP(|=
    │ │ │ │ +
    friend std::basic_istream< charT, Traits > & operator>>(std::basic_istream< charT, Traits > &str, AlignedNumber &u)
    Definition debugalign.hh:137
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    decltype(auto) operator~() const
    Definition debugalign.hh:194
    │ │ │ │ +
    AlignedNumber(T value)
    Definition debugalign.hh:120
    │ │ │ │ +
    AlignedNumber(const AlignedNumber< U, uAlign > &o)
    Definition debugalign.hh:124
    │ │ │ │ +
    decltype(auto) operator-() const
    Definition debugalign.hh:178
    │ │ │ │ + │ │ │ │ +
    Tag used to force late-binding lookup in Dune::Simd::Overloads.
    Definition base.hh:182
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:60
    │ │ │ │ +
    should have a member type type
    Definition standard.hh:67
    │ │ │ │ +
    should be derived from a Dune::index_constant
    Definition standard.hh:74
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,880 +1,728 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -rangeutilities.hh │ │ │ │ │ +debugalign.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_RANGE_UTILITIES_HH │ │ │ │ │ -6#define DUNE_COMMON_RANGE_UTILITIES_HH │ │ │ │ │ +5#ifndef DUNE_DEBUGALIGN_HH │ │ │ │ │ +6#define DUNE_DEBUGALIGN_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -21namespace _D_u_n_e │ │ │ │ │ -22{ │ │ │ │ │ -23 │ │ │ │ │ -34 template ::value, int>::type = 0> │ │ │ │ │ -36 typename T::value_type │ │ │ │ │ -_3_7 _m_a_x___v_a_l_u_e(const T & v) { │ │ │ │ │ -38 using std::max_element; │ │ │ │ │ -39 return *max_element(v.begin(), v.end()); │ │ │ │ │ -40 } │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include // abs │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20 │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +23#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_b_a_s_e_._h_h> │ │ │ │ │ +24#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_d_e_f_a_u_l_t_s_._h_h> │ │ │ │ │ +25#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +26 │ │ │ │ │ +27namespace _D_u_n_e { │ │ │ │ │ +28 │ │ │ │ │ +_3_0 using _V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r = │ │ │ │ │ +31 std::function; │ │ │ │ │ +32 │ │ │ │ │ +34 │ │ │ │ │ +40 _V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r &_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r(); │ │ │ │ │ 41 │ │ │ │ │ -42 template ::value, int>::type = 0> │ │ │ │ │ -_4_4 const T & _m_a_x___v_a_l_u_e(const T & v) { return v; } │ │ │ │ │ -45 │ │ │ │ │ -51 template ::value, int>::type = 0> │ │ │ │ │ -53 typename T::value_type │ │ │ │ │ -_5_4 _m_i_n___v_a_l_u_e(const T & v) { │ │ │ │ │ -55 using std::min_element; │ │ │ │ │ -56 return *min_element(v.begin(), v.end()); │ │ │ │ │ -57 } │ │ │ │ │ -58 │ │ │ │ │ -59 template ::value, int>::type = 0> │ │ │ │ │ -_6_1 const T & _m_i_n___v_a_l_u_e(const T & v) { return v; } │ │ │ │ │ +43 │ │ │ │ │ +52 void _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t(const char *_c_l_a_s_s_N_a_m_e, std::size_t expectedAlignment, │ │ │ │ │ +53 const void *address); │ │ │ │ │ +54 │ │ │ │ │ +_5_6 inline bool _i_s_A_l_i_g_n_e_d(const void *p, std::size_t align) │ │ │ │ │ +57 { │ │ │ │ │ +58 // a more portable way to do this would be to abuse std::align(), but that │ │ │ │ │ +59 // isn't supported by g++-4.9 yet │ │ │ │ │ +60 return std::uintptr_t(p) % align == 0; │ │ │ │ │ +61 } │ │ │ │ │ 62 │ │ │ │ │ -68 template ::value, int>::type = 0> │ │ │ │ │ -_7_0 bool _a_n_y___t_r_u_e(const T & v) { │ │ │ │ │ -71 bool b = false; │ │ │ │ │ -72 for (const auto & e : v) │ │ │ │ │ -73 b = b or bool(e); │ │ │ │ │ -74 return b; │ │ │ │ │ -75 } │ │ │ │ │ -76 │ │ │ │ │ -77 template ::value, int>::type = 0> │ │ │ │ │ -79 bool _a_n_y___t_r_u_e(const T & v) { return v; } │ │ │ │ │ -80 │ │ │ │ │ -81 template │ │ │ │ │ -_8_2 bool _a_n_y___t_r_u_e(const std::bitset & b) │ │ │ │ │ -83 { │ │ │ │ │ -84 return b.any(); │ │ │ │ │ -85 } │ │ │ │ │ -86 │ │ │ │ │ -92 template ::value, int>::type = 0> │ │ │ │ │ -_9_4 bool _a_l_l___t_r_u_e(const T & v) { │ │ │ │ │ -95 bool b = true; │ │ │ │ │ -96 for (const auto & e : v) │ │ │ │ │ -97 b = b and bool(e); │ │ │ │ │ -98 return b; │ │ │ │ │ -99 } │ │ │ │ │ -100 │ │ │ │ │ -101 template ::value, int>::type = 0> │ │ │ │ │ -103 bool _a_l_l___t_r_u_e(const T & v) { return v; } │ │ │ │ │ -104 │ │ │ │ │ -105 template │ │ │ │ │ -_1_0_6 bool _a_l_l___t_r_u_e(const std::bitset & b) │ │ │ │ │ -107 { │ │ │ │ │ -108 return b.all(); │ │ │ │ │ -109 } │ │ │ │ │ +64 template │ │ │ │ │ +_6_5 class alignas(align) _A_l_i_g_n_e_d_B_a_s_e │ │ │ │ │ +66 { │ │ │ │ │ +67 void checkAlignment() const │ │ │ │ │ +68 { │ │ │ │ │ +69 auto pimpl = static_cast(this); │ │ │ │ │ +70 if(!_i_s_A_l_i_g_n_e_d(pimpl, align)) │ │ │ │ │ +71 _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t(className().c_str(), align, pimpl); │ │ │ │ │ +72 } │ │ │ │ │ +73 public: │ │ │ │ │ +_7_4 _A_l_i_g_n_e_d_B_a_s_e() { checkAlignment(); } │ │ │ │ │ +_7_5 _A_l_i_g_n_e_d_B_a_s_e(const _A_l_i_g_n_e_d_B_a_s_e &) { checkAlignment(); } │ │ │ │ │ +_7_6 _A_l_i_g_n_e_d_B_a_s_e(_A_l_i_g_n_e_d_B_a_s_e &&) { checkAlignment(); } │ │ │ │ │ +_7_7 _~_A_l_i_g_n_e_d_B_a_s_e() { checkAlignment(); } │ │ │ │ │ +78 │ │ │ │ │ +_7_9 _A_l_i_g_n_e_d_B_a_s_e& _o_p_e_r_a_t_o_r_=(const _A_l_i_g_n_e_d_B_a_s_e &) = default; │ │ │ │ │ +_8_0 _A_l_i_g_n_e_d_B_a_s_e& _o_p_e_r_a_t_o_r_=(_A_l_i_g_n_e_d_B_a_s_e &&) = default; │ │ │ │ │ +81 }; │ │ │ │ │ +82 │ │ │ │ │ +_8_4 static constexpr auto _d_e_b_u_g_A_l_i_g_n_m_e_n_t = 2*alignof(std::max_align_t); │ │ │ │ │ +85 │ │ │ │ │ +_8_6 namespace AlignedNumberImpl { │ │ │ │ │ +87 │ │ │ │ │ +88 template │ │ │ │ │ +89 class _A_l_i_g_n_e_d_N_u_m_b_e_r; │ │ │ │ │ +90 │ │ │ │ │ +91 } // namespace AlignedNumberImpl │ │ │ │ │ +92 │ │ │ │ │ +93 using _A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r; │ │ │ │ │ +94 │ │ │ │ │ +95 template │ │ │ │ │ +_9_6 struct _I_s_N_u_m_b_e_r> │ │ │ │ │ +97 : public std::true_type {}; │ │ │ │ │ +98 │ │ │ │ │ +100 template │ │ │ │ │ +_1_0_1 _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> _a_l_i_g_n_e_d(T value) { return { std::move(value) }; } │ │ │ │ │ +102 │ │ │ │ │ +103 // The purpose of this namespace is to move the `` function │ │ │ │ │ +overloads │ │ │ │ │ +104 // out of namespace `Dune`. This avoids problems where people called │ │ │ │ │ +105 // e.g. `sqrt(1.0)` inside the `Dune` namespace, without first doing `using │ │ │ │ │ +106 // std::sqrt;`. Without any `Dune::sqrt()`, such a use will find │ │ │ │ │ +107 // `::sqrt()`, but with `Dune::sqrt()` it will find only `Dune::sqrt()`, │ │ │ │ │ +108 // which does not have an overload for `double`. │ │ │ │ │ +109 namespace AlignedNumberImpl { │ │ │ │ │ 110 │ │ │ │ │ -111 │ │ │ │ │ -112 │ │ │ │ │ -113 namespace Impl │ │ │ │ │ -114 { │ │ │ │ │ -115 │ │ │ │ │ -116 template │ │ │ │ │ -117 class IntegralRangeIterator │ │ │ │ │ -118 { │ │ │ │ │ -119 public: │ │ │ │ │ -120 typedef std::random_access_iterator_tag iterator_category; │ │ │ │ │ -121 typedef T value_type; │ │ │ │ │ -122 typedef std::make_signed_t difference_type; │ │ │ │ │ -123 typedef const T *pointer; │ │ │ │ │ -124 typedef T reference; │ │ │ │ │ +112 template │ │ │ │ │ +_1_1_3 class _A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ +114 : public _A_l_i_g_n_e_d_B_a_s_e > │ │ │ │ │ +115 { │ │ │ │ │ +116 T value_; │ │ │ │ │ +117 │ │ │ │ │ +118 public: │ │ │ │ │ +_1_1_9 _A_l_i_g_n_e_d_N_u_m_b_e_r() = default; │ │ │ │ │ +_1_2_0 _A_l_i_g_n_e_d_N_u_m_b_e_r(T value) : value_(_s_t_d::move(value)) {} │ │ │ │ │ +121 template= uAlign) && │ │ │ │ │ +123 std::is_convertible::value> > │ │ │ │ │ +_1_2_4 _A_l_i_g_n_e_d_N_u_m_b_e_r(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_U_,_ _u_A_l_i_g_n_> &o) : value_(U(o)) {} │ │ │ │ │ 125 │ │ │ │ │ -126 constexpr IntegralRangeIterator() noexcept : value_(0) {} │ │ │ │ │ -127 constexpr explicit IntegralRangeIterator(value_type value) noexcept : │ │ │ │ │ -value_(value) {} │ │ │ │ │ -128 │ │ │ │ │ -129 pointer operator->() const noexcept { return &value_; } │ │ │ │ │ -130 constexpr reference _o_p_e_r_a_t_o_r_*() const noexcept { return value_; } │ │ │ │ │ -131 │ │ │ │ │ -132 constexpr reference operator[]( difference_type n ) const noexcept { return │ │ │ │ │ -(value_ + n); } │ │ │ │ │ +126 // accessors │ │ │ │ │ +127 template::value> > │ │ │ │ │ +_1_2_9 explicit operator U() const { return value_; } │ │ │ │ │ +130 │ │ │ │ │ +_1_3_1 const T &_v_a_l_u_e() const { return value_; } │ │ │ │ │ +_1_3_2 T &_v_a_l_u_e() { return value_; } │ │ │ │ │ 133 │ │ │ │ │ -134 constexpr bool _o_p_e_r_a_t_o_r_=_=(const IntegralRangeIterator & other) const │ │ │ │ │ -noexcept { return (value_ == other.value_); } │ │ │ │ │ -135 constexpr bool _o_p_e_r_a_t_o_r_!_=(const IntegralRangeIterator & other) const │ │ │ │ │ -noexcept { return (value_ != other.value_); } │ │ │ │ │ -136 │ │ │ │ │ -137 constexpr bool _o_p_e_r_a_t_o_r_<(const IntegralRangeIterator & other) const │ │ │ │ │ -noexcept { return (value_ <= other.value_); } │ │ │ │ │ -138 constexpr bool _o_p_e_r_a_t_o_r_<_=(const IntegralRangeIterator & other) const │ │ │ │ │ -noexcept { return (value_ <= other.value_); } │ │ │ │ │ -139 constexpr bool _o_p_e_r_a_t_o_r_>(const IntegralRangeIterator & other) const │ │ │ │ │ -noexcept { return (value_ >= other.value_); } │ │ │ │ │ -140 constexpr bool _o_p_e_r_a_t_o_r_>_=(const IntegralRangeIterator & other) const │ │ │ │ │ -noexcept { return (value_ >= other.value_); } │ │ │ │ │ +134 // I/O │ │ │ │ │ +135 template │ │ │ │ │ +136 friend std::basic_istream& │ │ │ │ │ +_1_3_7 _o_p_e_r_a_t_o_r_>_>(std::basic_istream& str, _A_l_i_g_n_e_d_N_u_m_b_e_r &u) │ │ │ │ │ +138 { │ │ │ │ │ +139 return str >> u.value_; │ │ │ │ │ +140 } │ │ │ │ │ 141 │ │ │ │ │ -142 IntegralRangeIterator& operator++() noexcept { ++value_; return *this; } │ │ │ │ │ -143 IntegralRangeIterator operator++(int) noexcept { IntegralRangeIterator copy │ │ │ │ │ -( *this ); ++(*this); return copy; } │ │ │ │ │ -144 │ │ │ │ │ -145 IntegralRangeIterator& operator--() noexcept { --value_; return *this; } │ │ │ │ │ -146 IntegralRangeIterator operator--(int) noexcept { IntegralRangeIterator copy │ │ │ │ │ -( *this ); --(*this); return copy; } │ │ │ │ │ -147 │ │ │ │ │ -148 IntegralRangeIterator& operator+=(difference_type n) noexcept { value_ += │ │ │ │ │ -n; return *this; } │ │ │ │ │ -149 IntegralRangeIterator& operator-=(difference_type n) noexcept { value_ - │ │ │ │ │ -= n; return *this; } │ │ │ │ │ -150 │ │ │ │ │ -151 friend constexpr IntegralRangeIterator _o_p_e_r_a_t_o_r_+(const │ │ │ │ │ -IntegralRangeIterator &a, difference_type n) noexcept { return │ │ │ │ │ -IntegralRangeIterator(a.value_ + n); } │ │ │ │ │ -152 friend constexpr IntegralRangeIterator _o_p_e_r_a_t_o_r_+(difference_type n, const │ │ │ │ │ -IntegralRangeIterator &a) noexcept { return IntegralRangeIterator(a.value_ + │ │ │ │ │ -n); } │ │ │ │ │ -153 friend constexpr IntegralRangeIterator _o_p_e_r_a_t_o_r_-(const │ │ │ │ │ -IntegralRangeIterator &a, difference_type n) noexcept { return │ │ │ │ │ -IntegralRangeIterator(a.value_ - n); } │ │ │ │ │ -154 │ │ │ │ │ -155 constexpr difference_type _o_p_e_r_a_t_o_r_-(const IntegralRangeIterator &other) │ │ │ │ │ -const noexcept { return (static_cast(value_) - │ │ │ │ │ -static_cast(other.value_)); } │ │ │ │ │ -156 │ │ │ │ │ -157 private: │ │ │ │ │ -158 value_type value_; │ │ │ │ │ -159 }; │ │ │ │ │ -160 │ │ │ │ │ -161 } // namespace Impl │ │ │ │ │ -162 │ │ │ │ │ -163 │ │ │ │ │ +142 template │ │ │ │ │ +_1_4_3 friend std::basic_ostream& │ │ │ │ │ +144 _o_p_e_r_a_t_o_r_<_<(std::basic_ostream& str, │ │ │ │ │ +145 const _A_l_i_g_n_e_d_N_u_m_b_e_r &u) │ │ │ │ │ +146 { │ │ │ │ │ +147 return str << u.value_; │ │ │ │ │ +148 } │ │ │ │ │ +149 │ │ │ │ │ +150 // The trick with `template >` is │ │ │ │ │ +151 // needed because at least g++-4.9 seems to evaluates a default argument │ │ │ │ │ +152 // in `template >` as soon as possible and │ │ │ │ │ +will │ │ │ │ │ +153 // error out if `expr(T)` is invalid. E.g. for `expr(T)` = │ │ │ │ │ +154 // `decltype(--std::declval())`, instantiating `AlignedNumber` │ │ │ │ │ +155 // will result in an unrecoverable error (`--` cannot be applied to a │ │ │ │ │ +156 // `bool`). │ │ │ │ │ +157 │ │ │ │ │ +158 // Increment, decrement │ │ │ │ │ +159 template())> > │ │ │ │ │ +_1_6_0 _A_l_i_g_n_e_d_N_u_m_b_e_r &operator++() { ++value_; return *this; } │ │ │ │ │ +161 │ │ │ │ │ +162 template())> > │ │ │ │ │ +_1_6_3 _A_l_i_g_n_e_d_N_u_m_b_e_r &operator--() { --value_; return *this; } │ │ │ │ │ 164 │ │ │ │ │ -173 template │ │ │ │ │ -_1_7_4 class _I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -175 { │ │ │ │ │ -176 public: │ │ │ │ │ -_1_7_8 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_1_8_0 typedef Impl::IntegralRangeIterator _i_t_e_r_a_t_o_r; │ │ │ │ │ -_1_8_2 typedef std::make_unsigned_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -183 │ │ │ │ │ -_1_8_5 constexpr _I_n_t_e_g_r_a_l_R_a_n_g_e(_v_a_l_u_e___t_y_p_e from, _v_a_l_u_e___t_y_p_e to) noexcept : from_ │ │ │ │ │ -(from), to_(to) {} │ │ │ │ │ -_1_8_7 constexpr explicit _I_n_t_e_g_r_a_l_R_a_n_g_e(_v_a_l_u_e___t_y_p_e to) noexcept : from_(0), to_ │ │ │ │ │ -(to) {} │ │ │ │ │ -_1_8_9 constexpr _I_n_t_e_g_r_a_l_R_a_n_g_e(std::pair _r_a_n_g_e) noexcept : │ │ │ │ │ -from_(_r_a_n_g_e.first), to_(_r_a_n_g_e.second) {} │ │ │ │ │ -190 │ │ │ │ │ -_1_9_2 constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n() const noexcept { return _i_t_e_r_a_t_o_r(from_); } │ │ │ │ │ -_1_9_4 constexpr _i_t_e_r_a_t_o_r _e_n_d() const noexcept { return _i_t_e_r_a_t_o_r(to_); } │ │ │ │ │ -195 │ │ │ │ │ -_1_9_7 constexpr _v_a_l_u_e___t_y_p_e _o_p_e_r_a_t_o_r_[_](const _v_a_l_u_e___t_y_p_e &i) const noexcept │ │ │ │ │ -{ return (from_ + i); } │ │ │ │ │ -198 │ │ │ │ │ -_2_0_0 constexpr bool _e_m_p_t_y() const noexcept { return (from_ == to_); } │ │ │ │ │ -_2_0_2 constexpr _s_i_z_e___t_y_p_e _s_i_z_e() const noexcept { return (static_cast<_s_i_z_e___t_y_p_e> │ │ │ │ │ -(to_) - static_cast<_s_i_z_e___t_y_p_e>(from_)); } │ │ │ │ │ -203 │ │ │ │ │ -204 private: │ │ │ │ │ -205 _v_a_l_u_e___t_y_p_e from_, to_; │ │ │ │ │ -206 }; │ │ │ │ │ -207 │ │ │ │ │ -208 │ │ │ │ │ -223 template │ │ │ │ │ -_2_2_4 class _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -225 { │ │ │ │ │ -226 template │ │ │ │ │ -227 static std::integer_sequence shift_integer_sequence(std:: │ │ │ │ │ -integer_sequence); │ │ │ │ │ -228 │ │ │ │ │ -229 public: │ │ │ │ │ -_2_3_1 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_2_3_3 typedef Impl::IntegralRangeIterator _i_t_e_r_a_t_o_r; │ │ │ │ │ -_2_3_5 typedef std::make_unsigned_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +165 template()++)> > │ │ │ │ │ +_1_6_6 decltype(auto) _o_p_e_r_a_t_o_r_+_+(int) { return aligned(value_++); } │ │ │ │ │ +167 │ │ │ │ │ +168 template()--)> > │ │ │ │ │ +_1_6_9 decltype(auto) _o_p_e_r_a_t_o_r_-_-(int) { return aligned(value_--); } │ │ │ │ │ +170 │ │ │ │ │ +171 // unary operators │ │ │ │ │ +172 template())> > │ │ │ │ │ +_1_7_4 decltype(auto) _o_p_e_r_a_t_o_r_+() const { return aligned(+value_); } │ │ │ │ │ +175 │ │ │ │ │ +176 template())> > │ │ │ │ │ +_1_7_8 decltype(auto) _o_p_e_r_a_t_o_r_-() const { return aligned(-value_); } │ │ │ │ │ +179 │ │ │ │ │ +180 /* │ │ │ │ │ +181 * silence warnings from GCC about using `~` on a bool │ │ │ │ │ +182 * (when instantiated for T=bool) │ │ │ │ │ +183 */ │ │ │ │ │ +184#if __GNUC__ >= 7 │ │ │ │ │ +185# pragma GCC diagnostic push │ │ │ │ │ +186# pragma GCC diagnostic ignored "-Wbool-operation" │ │ │ │ │ +187#endif │ │ │ │ │ +188#ifdef __clang__ │ │ │ │ │ +189# pragma clang diagnostic push │ │ │ │ │ +190# pragma clang diagnostic ignored "-Wbool-operation" │ │ │ │ │ +191#endif │ │ │ │ │ +192 template())> > │ │ │ │ │ +_1_9_4 decltype(auto) _o_p_e_r_a_t_o_r_~() const { return aligned(~value_); } │ │ │ │ │ +195#if __GNUC__ >= 7 │ │ │ │ │ +196# pragma GCC diagnostic pop │ │ │ │ │ +197#endif │ │ │ │ │ +198#ifdef __clang__ │ │ │ │ │ +199# pragma clang diagnostic pop │ │ │ │ │ +200#endif │ │ │ │ │ +201 │ │ │ │ │ +202 template())> > │ │ │ │ │ +_2_0_4 decltype(auto) _o_p_e_r_a_t_o_r_!() const { return aligned(!value_); } │ │ │ │ │ +205 │ │ │ │ │ +206 // assignment operators │ │ │ │ │ +_2_0_7#define DUNE_ASSIGN_OP(OP) \ │ │ │ │ │ +208 template() OP std::declval()) ) \ │ │ │ │ │ +212 > > \ │ │ │ │ │ +213 AlignedNumber &operator OP(const AlignedNumber &u) \ │ │ │ │ │ +214 { \ │ │ │ │ │ +215 value_ OP U(u); \ │ │ │ │ │ +216 return *this; \ │ │ │ │ │ +217 } \ │ │ │ │ │ +218 \ │ │ │ │ │ +219 template() OP \ │ │ │ │ │ +221 std::declval())> > \ │ │ │ │ │ +222 AlignedNumber &operator OP(const U &u) \ │ │ │ │ │ +223 { \ │ │ │ │ │ +224 value_ OP u; \ │ │ │ │ │ +225 return *this; \ │ │ │ │ │ +226 } \ │ │ │ │ │ +227 \ │ │ │ │ │ +228 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +229 │ │ │ │ │ +_2_3_0 _D_U_N_E___A_S_S_I_G_N___O_P(+=); │ │ │ │ │ +_2_3_1 _D_U_N_E___A_S_S_I_G_N___O_P(-=); │ │ │ │ │ +232 │ │ │ │ │ +_2_3_3 _D_U_N_E___A_S_S_I_G_N___O_P(*=); │ │ │ │ │ +234 _D_U_N_E___A_S_S_I_G_N___O_P(/=); │ │ │ │ │ +235 _D_U_N_E___A_S_S_I_G_N___O_P(%=); │ │ │ │ │ 236 │ │ │ │ │ -_2_3_8 typedef decltype(shift_integer_sequence(std::make_integer_sequence())) _i_n_t_e_g_e_r___s_e_q_u_e_n_c_e; │ │ │ │ │ -239 │ │ │ │ │ -_2_4_1 constexpr _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e() noexcept = default; │ │ │ │ │ -242 │ │ │ │ │ -_2_4_4 constexpr operator _I_n_t_e_g_r_a_l_R_a_n_g_e() const noexcept { return {from, to}; } │ │ │ │ │ -_2_4_6 constexpr operator _i_n_t_e_g_e_r___s_e_q_u_e_n_c_e() const noexcept { return {}; } │ │ │ │ │ -247 │ │ │ │ │ -_2_4_9 static constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n() noexcept { return _i_t_e_r_a_t_o_r(from); } │ │ │ │ │ -_2_5_1 static constexpr _i_t_e_r_a_t_o_r _e_n_d() noexcept { return _i_t_e_r_a_t_o_r(to); } │ │ │ │ │ -252 │ │ │ │ │ -254 template │ │ │ │ │ -_2_5_5 constexpr auto _o_p_e_r_a_t_o_r_[_](const std::integral_constant &) const │ │ │ │ │ -noexcept │ │ │ │ │ -256 -> std::integral_constant(i)> │ │ │ │ │ -257 { │ │ │ │ │ -258 return {}; │ │ │ │ │ -259 } │ │ │ │ │ -260 │ │ │ │ │ -_2_6_2 constexpr _v_a_l_u_e___t_y_p_e _o_p_e_r_a_t_o_r_[_](const _s_i_z_e___t_y_p_e &i) const noexcept { return │ │ │ │ │ -(from + static_cast<_v_a_l_u_e___t_y_p_e>(i)); } │ │ │ │ │ -263 │ │ │ │ │ -_2_6_5 static constexpr std::integral_constant _e_m_p_t_y() noexcept │ │ │ │ │ -{ return {}; } │ │ │ │ │ -_2_6_7 static constexpr std::integral_constant │ │ │ │ │ -(to) - static_cast<_s_i_z_e___t_y_p_e>(from) > _s_i_z_e() noexcept { return {}; } │ │ │ │ │ -268 }; │ │ │ │ │ -269 │ │ │ │ │ -279 template, std::decay_t>::value, │ │ │ │ │ -int> = 0, │ │ │ │ │ -281 std::enable_if_t>::value, int> = 0> │ │ │ │ │ -_2_8_2 inline static _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>> _r_a_n_g_e(T &&from, U &&to) │ │ │ │ │ -noexcept │ │ │ │ │ -283 { │ │ │ │ │ -284 return _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>(std::forward(from), std:: │ │ │ │ │ -forward(to)); │ │ │ │ │ -285 } │ │ │ │ │ +_2_3_7 _D_U_N_E___A_S_S_I_G_N___O_P(^=); │ │ │ │ │ +238 _D_U_N_E___A_S_S_I_G_N___O_P(&=); │ │ │ │ │ +239 _D_U_N_E___A_S_S_I_G_N___O_P(|=); │ │ │ │ │ +240 │ │ │ │ │ +_2_4_1 _D_U_N_E___A_S_S_I_G_N___O_P(<<=); │ │ │ │ │ +_2_4_2 _D_U_N_E___A_S_S_I_G_N___O_P(>>=); │ │ │ │ │ +243 │ │ │ │ │ +244#undef DUNE_ASSIGN_OP │ │ │ │ │ +245 }; │ │ │ │ │ +246 │ │ │ │ │ +247 // binary operators │ │ │ │ │ +_2_4_8#define DUNE_BINARY_OP(OP) \ │ │ │ │ │ +249 template() \ │ │ │ │ │ +251 OP std::declval())> > \ │ │ │ │ │ +252 decltype(auto) \ │ │ │ │ │ +253 operator OP(const AlignedNumber &t, \ │ │ │ │ │ +254 const AlignedNumber &u) \ │ │ │ │ │ +255 { \ │ │ │ │ │ +256 /* can't use std::max(); not constexpr */ \ │ │ │ │ │ +257 return aligned<(tAlign > uAlign ? tAlign : uAlign)>(T(t) OP U(u)); \ │ │ │ │ │ +258 } \ │ │ │ │ │ +259 \ │ │ │ │ │ +260 template() \ │ │ │ │ │ +262 OP std::declval())> > \ │ │ │ │ │ +263 decltype(auto) \ │ │ │ │ │ +264 operator OP(const T &t, const AlignedNumber &u) \ │ │ │ │ │ +265 { \ │ │ │ │ │ +266 return aligned(t OP U(u)); \ │ │ │ │ │ +267 } \ │ │ │ │ │ +268 \ │ │ │ │ │ +269 template() \ │ │ │ │ │ +271 OP std::declval())> > \ │ │ │ │ │ +272 decltype(auto) \ │ │ │ │ │ +273 operator OP(const AlignedNumber &t, const U &u) \ │ │ │ │ │ +274 { \ │ │ │ │ │ +275 return aligned(T(t) OP u); \ │ │ │ │ │ +276 } \ │ │ │ │ │ +277 \ │ │ │ │ │ +278 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +279 │ │ │ │ │ +_2_8_0 _D_U_N_E___B_I_N_A_R_Y___O_P(+); │ │ │ │ │ +_2_8_1 _D_U_N_E___B_I_N_A_R_Y___O_P(-); │ │ │ │ │ +282 │ │ │ │ │ +_2_8_3 _D_U_N_E___B_I_N_A_R_Y___O_P(*); │ │ │ │ │ +284 _D_U_N_E___B_I_N_A_R_Y___O_P(/); │ │ │ │ │ +285 _D_U_N_E___B_I_N_A_R_Y___O_P(%); │ │ │ │ │ 286 │ │ │ │ │ -287 template>:: │ │ │ │ │ -value, int> = 0> │ │ │ │ │ -_2_8_8 inline static _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>> _r_a_n_g_e(T &&to) noexcept │ │ │ │ │ -289 { │ │ │ │ │ -290 return _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>(std::forward(to)); │ │ │ │ │ -291 } │ │ │ │ │ -292 │ │ │ │ │ -293 template>::value, │ │ │ │ │ -int> = 0> │ │ │ │ │ -_2_9_4 inline static _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_u_n_d_e_r_l_y_i_n_g___t_y_p_e___t_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>> _r_a_n_g_e │ │ │ │ │ -(T &&to) noexcept │ │ │ │ │ -295 { │ │ │ │ │ -296 return _I_n_t_e_g_r_a_l_R_a_n_g_e_<_s_t_d_:_:_u_n_d_e_r_l_y_i_n_g___t_y_p_e___t_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>>(std:: │ │ │ │ │ -forward(to)); │ │ │ │ │ -297 } │ │ │ │ │ -298 │ │ │ │ │ -299 template │ │ │ │ │ -_3_0_0 inline static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_<_T_,_ _t_o_,_ _f_r_o_m_> _r_a_n_g_e(std:: │ │ │ │ │ -integral_constant, std::integral_constant) noexcept │ │ │ │ │ -301 { │ │ │ │ │ -302 return {}; │ │ │ │ │ -303 } │ │ │ │ │ -304 │ │ │ │ │ -305 template │ │ │ │ │ -_3_0_6 inline static _S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_<_T_,_ _t_o_> _r_a_n_g_e(std::integral_constant) noexcept │ │ │ │ │ -307 { │ │ │ │ │ -308 return {}; │ │ │ │ │ -309 } │ │ │ │ │ -310 │ │ │ │ │ -311 │ │ │ │ │ -312 │ │ │ │ │ -_3_1_6 struct _V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g {}; │ │ │ │ │ -317 │ │ │ │ │ -_3_2_1 struct _I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g {}; │ │ │ │ │ +_2_8_7 _D_U_N_E___B_I_N_A_R_Y___O_P(^); │ │ │ │ │ +288 _D_U_N_E___B_I_N_A_R_Y___O_P(&); │ │ │ │ │ +289 _D_U_N_E___B_I_N_A_R_Y___O_P(|); │ │ │ │ │ +290 │ │ │ │ │ +_2_9_1 _D_U_N_E___B_I_N_A_R_Y___O_P(<<); │ │ │ │ │ +_2_9_2 _D_U_N_E___B_I_N_A_R_Y___O_P(>>); │ │ │ │ │ +293 │ │ │ │ │ +_2_9_4 _D_U_N_E___B_I_N_A_R_Y___O_P(==); │ │ │ │ │ +_2_9_5 _D_U_N_E___B_I_N_A_R_Y___O_P(!=); │ │ │ │ │ +296 _D_U_N_E___B_I_N_A_R_Y___O_P(<); │ │ │ │ │ +297 _D_U_N_E___B_I_N_A_R_Y___O_P(>); │ │ │ │ │ +_2_9_8 _D_U_N_E___B_I_N_A_R_Y___O_P(<=); │ │ │ │ │ +_2_9_9 _D_U_N_E___B_I_N_A_R_Y___O_P(>=); │ │ │ │ │ +300 │ │ │ │ │ +_3_0_1 _D_U_N_E___B_I_N_A_R_Y___O_P(&&); │ │ │ │ │ +302 _D_U_N_E___B_I_N_A_R_Y___O_P(||); │ │ │ │ │ +303 │ │ │ │ │ +304#undef DUNE_BINARY_OP │ │ │ │ │ +305 │ │ │ │ │ +307 // │ │ │ │ │ +308 // Overloads for the functions provided by the standard library │ │ │ │ │ +309 // │ │ │ │ │ +310#define DUNE_UNARY_FUNC(name) \ │ │ │ │ │ +311 template \ │ │ │ │ │ +312 decltype(auto) name(const AlignedNumber &u) \ │ │ │ │ │ +313 { \ │ │ │ │ │ +314 using std::name; \ │ │ │ │ │ +315 return aligned(name(T(u))); \ │ │ │ │ │ +316 } \ │ │ │ │ │ +317 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +318 │ │ │ │ │ +319 // │ │ │ │ │ +320 // functions │ │ │ │ │ +321 // │ │ │ │ │ 322 │ │ │ │ │ -323 namespace Impl │ │ │ │ │ -324 { │ │ │ │ │ -325 │ │ │ │ │ -326 // Helper class to mimic a pointer for proxy objects. │ │ │ │ │ -327 // This is needed to implement operator-> on an iterator │ │ │ │ │ -328 // using proxy-values. It stores the proxy value but │ │ │ │ │ -329 // provides operator-> like a pointer. │ │ │ │ │ -330 template │ │ │ │ │ -331 class PointerProxy │ │ │ │ │ -332 { │ │ │ │ │ -333 public: │ │ │ │ │ -334 PointerProxy(ProxyType&& p) : p_(p) │ │ │ │ │ -335 {} │ │ │ │ │ -336 │ │ │ │ │ -337 ProxyType* operator->() │ │ │ │ │ -338 { │ │ │ │ │ -339 return &p_; │ │ │ │ │ -340 } │ │ │ │ │ -341 │ │ │ │ │ -342 ProxyType p_; │ │ │ │ │ -343 }; │ │ │ │ │ -344 │ │ │ │ │ -345 // An iterator transforming a wrapped iterator using │ │ │ │ │ -346 // an unary function. It inherits the iterator-category │ │ │ │ │ -347 // of the underlying iterator. │ │ │ │ │ -348 template ::iterator_category> │ │ │ │ │ -349 class TransformedRangeIterator; │ │ │ │ │ -350 │ │ │ │ │ -351 template │ │ │ │ │ -352 class TransformedRangeIterator │ │ │ │ │ -353 { │ │ │ │ │ -354 protected: │ │ │ │ │ -355 │ │ │ │ │ -356 static decltype(auto) transform(const F& f, const I& it) { │ │ │ │ │ -357 if constexpr (std::is_same_v) │ │ │ │ │ -358 return f(it); │ │ │ │ │ -359 else │ │ │ │ │ -360 return f(*it); │ │ │ │ │ -361 } │ │ │ │ │ -362 │ │ │ │ │ -363 public: │ │ │ │ │ -364 using iterator_category = std::forward_iterator_tag; │ │ │ │ │ -365 using reference = decltype(transform(std::declval(), std::declval │ │ │ │ │ -())); │ │ │ │ │ -366 using value_type = std::decay_t; │ │ │ │ │ -367 using pointer = PointerProxy; │ │ │ │ │ -368 │ │ │ │ │ -369 // If we later want to allow standalone TransformedRangeIterators, │ │ │ │ │ -370 // we could customize the FunctionPointer to be a default-constructible, │ │ │ │ │ -371 // copy-assignable type storing a function but acting like a pointer │ │ │ │ │ -372 // to function. │ │ │ │ │ -373 using FunctionPointer = const F*; │ │ │ │ │ -374 │ │ │ │ │ -375 constexpr TransformedRangeIterator(const I& it, FunctionPointer f) noexcept │ │ │ │ │ -: │ │ │ │ │ -376 it_(it), │ │ │ │ │ -377 f_(f) │ │ │ │ │ -378 {} │ │ │ │ │ -379 │ │ │ │ │ -380 // Explicitly initialize members. Using a plain │ │ │ │ │ -381 // │ │ │ │ │ -382 // constexpr TransformedRangeIterator() noexcept {} │ │ │ │ │ -383 // │ │ │ │ │ -384 // would default-initialize the members while │ │ │ │ │ -385 // │ │ │ │ │ -386 // constexpr TransformedRangeIterator() noexcept : it_(), f_() {} │ │ │ │ │ -387 // │ │ │ │ │ -388 // leads to value-initialization. This is a case where │ │ │ │ │ -389 // both are really different. If it_ is a raw pointer (i.e. POD) │ │ │ │ │ -390 // then default-initialization leaves it uninitialized while │ │ │ │ │ -391 // value-initialization zero-initializes it. │ │ │ │ │ -392 constexpr TransformedRangeIterator() noexcept : │ │ │ │ │ -393 it_(), │ │ │ │ │ -394 f_() │ │ │ │ │ -395 {} │ │ │ │ │ -396 │ │ │ │ │ -397 // Dereferencing returns a value created by the function │ │ │ │ │ -398 constexpr reference _o_p_e_r_a_t_o_r_*() const noexcept { │ │ │ │ │ -399 return transform(*f_, it_); │ │ │ │ │ -400 } │ │ │ │ │ +323 // note: only unary functions are provided at the moment. Getting all the │ │ │ │ │ +324 // overloads right for functions with more than one argument is tricky. │ │ │ │ │ +325 // All functions appear in the list below in the order they are │ │ │ │ │ +326 // listed in in the standard, but the unimplemented ones are commented │ │ │ │ │ +327 // out. │ │ │ │ │ +328 │ │ │ │ │ +329 // note: abs is provided by both (for integer) and (for │ │ │ │ │ +330 // floating point). This overload works for both. │ │ │ │ │ +331 _D_U_N_E___U_N_A_R_Y___F_U_N_C(abs); │ │ │ │ │ +_3_3_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acos); │ │ │ │ │ +_3_3_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acosh); │ │ │ │ │ +_3_3_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asin); │ │ │ │ │ +_3_3_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asinh); │ │ │ │ │ +_3_3_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atan); │ │ │ │ │ +337 // atan2 │ │ │ │ │ +_3_3_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atanh); │ │ │ │ │ +_3_3_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cbrt); │ │ │ │ │ +_3_4_0 _D_U_N_E___U_N_A_R_Y___F_U_N_C(ceil); │ │ │ │ │ +341 // copysign │ │ │ │ │ +_3_4_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cos); │ │ │ │ │ +_3_4_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cosh); │ │ │ │ │ +_3_4_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erf); │ │ │ │ │ +_3_4_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erfc); │ │ │ │ │ +_3_4_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(exp); │ │ │ │ │ +_3_4_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(exp2); │ │ │ │ │ +_3_4_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(expm1); │ │ │ │ │ +_3_4_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(fabs); │ │ │ │ │ +350 // fdim │ │ │ │ │ +_3_5_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(floor); │ │ │ │ │ +352 // fma │ │ │ │ │ +353 // fmax │ │ │ │ │ +354 // fmin │ │ │ │ │ +355 // fmod │ │ │ │ │ +356 // frexp │ │ │ │ │ +357 // hypos │ │ │ │ │ +_3_5_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(ilogb); │ │ │ │ │ +359 // ldexp │ │ │ │ │ +_3_6_0 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lgamma); │ │ │ │ │ +_3_6_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(llrint); │ │ │ │ │ +_3_6_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(llround); │ │ │ │ │ +_3_6_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log); │ │ │ │ │ +_3_6_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log10); │ │ │ │ │ +_3_6_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log1p); │ │ │ │ │ +_3_6_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log2); │ │ │ │ │ +_3_6_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(logb); │ │ │ │ │ +_3_6_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lrint); │ │ │ │ │ +_3_6_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lround); │ │ │ │ │ +370 // modf │ │ │ │ │ +_3_7_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(nearbyint); │ │ │ │ │ +372 // nextafter │ │ │ │ │ +373 // nexttoward │ │ │ │ │ +374 // pow │ │ │ │ │ +375 // remainder │ │ │ │ │ +376 // remquo │ │ │ │ │ +_3_7_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(rint); │ │ │ │ │ +_3_7_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(round); │ │ │ │ │ +379 // scalbln │ │ │ │ │ +380 // scalbn │ │ │ │ │ +_3_8_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sin); │ │ │ │ │ +_3_8_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sinh); │ │ │ │ │ +_3_8_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sqrt); │ │ │ │ │ +_3_8_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tan); │ │ │ │ │ +_3_8_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tanh); │ │ │ │ │ +_3_8_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tgamma); │ │ │ │ │ +_3_8_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(trunc); │ │ │ │ │ +388 │ │ │ │ │ +_3_8_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isfinite); │ │ │ │ │ +_3_9_0 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isinf); │ │ │ │ │ +_3_9_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isnan); │ │ │ │ │ +_3_9_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isnormal); │ │ │ │ │ +_3_9_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(signbit); │ │ │ │ │ +394 │ │ │ │ │ +395 // isgreater │ │ │ │ │ +396 // isgreaterequal │ │ │ │ │ +397 // isless │ │ │ │ │ +398 // islessequal │ │ │ │ │ +399 // islessgreater │ │ │ │ │ +400 // isunordered │ │ │ │ │ 401 │ │ │ │ │ -402 // Dereferencing returns a value created by the function │ │ │ │ │ -403 pointer operator->() const noexcept { │ │ │ │ │ -404 return transform(*f_, it_); │ │ │ │ │ -405 } │ │ │ │ │ -406 │ │ │ │ │ -407 constexpr TransformedRangeIterator& operator=(const │ │ │ │ │ -TransformedRangeIterator& other) = default; │ │ │ │ │ -408 │ │ │ │ │ -409 constexpr bool _o_p_e_r_a_t_o_r_=_=(const TransformedRangeIterator& other) const │ │ │ │ │ -noexcept { │ │ │ │ │ -410 return (it_ == other.it_); │ │ │ │ │ -411 } │ │ │ │ │ -412 │ │ │ │ │ -413 constexpr bool _o_p_e_r_a_t_o_r_!_=(const TransformedRangeIterator& other) const │ │ │ │ │ -noexcept { │ │ │ │ │ -414 return (it_ != other.it_); │ │ │ │ │ -415 } │ │ │ │ │ -416 │ │ │ │ │ -417 TransformedRangeIterator& operator++() noexcept { │ │ │ │ │ -418 ++it_; │ │ │ │ │ -419 return *this; │ │ │ │ │ -420 } │ │ │ │ │ -421 │ │ │ │ │ -422 TransformedRangeIterator operator++(int) noexcept { │ │ │ │ │ -423 TransformedRangeIterator copy(*this); │ │ │ │ │ -424 ++(*this); │ │ │ │ │ -425 return copy; │ │ │ │ │ -426 } │ │ │ │ │ -427 │ │ │ │ │ -428 protected: │ │ │ │ │ -429 I it_; │ │ │ │ │ -430 FunctionPointer f_; │ │ │ │ │ -431 }; │ │ │ │ │ -432 │ │ │ │ │ -433 │ │ │ │ │ -434 │ │ │ │ │ -435 template │ │ │ │ │ -436 class TransformedRangeIterator : │ │ │ │ │ -437 public TransformedRangeIterator │ │ │ │ │ -438 { │ │ │ │ │ -439 protected: │ │ │ │ │ -440 using Base = TransformedRangeIterator; │ │ │ │ │ -441 using Base::it_; │ │ │ │ │ -442 using Base::f_; │ │ │ │ │ -443 public: │ │ │ │ │ -444 using iterator_category = std::bidirectional_iterator_tag; │ │ │ │ │ -445 using reference = typename Base::reference; │ │ │ │ │ -446 using value_type = typename Base::value_type; │ │ │ │ │ -447 using pointer = typename Base::pointer; │ │ │ │ │ -448 │ │ │ │ │ -449 using FunctionPointer = typename Base::FunctionPointer; │ │ │ │ │ -450 │ │ │ │ │ -451 using Base::Base; │ │ │ │ │ -452 │ │ │ │ │ -453 // Member functions of the forward_iterator that need │ │ │ │ │ -454 // to be redefined because the base class methods return a │ │ │ │ │ -455 // forward_iterator. │ │ │ │ │ -456 constexpr TransformedRangeIterator& operator=(const │ │ │ │ │ -TransformedRangeIterator& other) = default; │ │ │ │ │ -457 │ │ │ │ │ -458 TransformedRangeIterator& operator++() noexcept { │ │ │ │ │ -459 ++it_; │ │ │ │ │ -460 return *this; │ │ │ │ │ -461 } │ │ │ │ │ -462 │ │ │ │ │ -463 TransformedRangeIterator operator++(int) noexcept { │ │ │ │ │ -464 TransformedRangeIterator copy(*this); │ │ │ │ │ -465 ++(*this); │ │ │ │ │ -466 return copy; │ │ │ │ │ -467 } │ │ │ │ │ -468 │ │ │ │ │ -469 // Additional member functions of bidirectional_iterator │ │ │ │ │ -470 TransformedRangeIterator& operator--() noexcept { │ │ │ │ │ -471 --(this->it_); │ │ │ │ │ -472 return *this; │ │ │ │ │ -473 } │ │ │ │ │ -474 │ │ │ │ │ -475 TransformedRangeIterator operator--(int) noexcept { │ │ │ │ │ -476 TransformedRangeIterator copy(*this); │ │ │ │ │ -477 --(*this); │ │ │ │ │ -478 return copy; │ │ │ │ │ -479 } │ │ │ │ │ -480 }; │ │ │ │ │ -481 │ │ │ │ │ -482 │ │ │ │ │ -483 │ │ │ │ │ -484 template │ │ │ │ │ -485 class TransformedRangeIterator : │ │ │ │ │ -486 public TransformedRangeIterator │ │ │ │ │ -487 { │ │ │ │ │ -488 protected: │ │ │ │ │ -489 using Base = TransformedRangeIterator; │ │ │ │ │ -490 using Base::it_; │ │ │ │ │ -491 using Base::f_; │ │ │ │ │ -492 public: │ │ │ │ │ -493 using iterator_category = std::random_access_iterator_tag; │ │ │ │ │ -494 using reference = typename Base::reference; │ │ │ │ │ -495 using value_type = typename Base::value_type; │ │ │ │ │ -496 using pointer = typename Base::pointer; │ │ │ │ │ -497 using difference_type = typename std::iterator_traits::difference_type; │ │ │ │ │ -498 │ │ │ │ │ -499 using FunctionPointer = typename Base::FunctionPointer; │ │ │ │ │ -500 │ │ │ │ │ -501 using Base::Base; │ │ │ │ │ -502 │ │ │ │ │ -503 // Member functions of the forward_iterator that need │ │ │ │ │ -504 // to be redefined because the base class methods return a │ │ │ │ │ -505 // forward_iterator. │ │ │ │ │ -506 constexpr TransformedRangeIterator& operator=(const │ │ │ │ │ -TransformedRangeIterator& other) = default; │ │ │ │ │ +402 // │ │ │ │ │ +403 // functions │ │ │ │ │ +404 // │ │ │ │ │ +405 │ │ │ │ │ +406 // not all functions are implemented, and unlike for , no │ │ │ │ │ +407 // comprehensive list is provided │ │ │ │ │ +_4_0_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(real); │ │ │ │ │ +409 │ │ │ │ │ +410#undef DUNE_UNARY_FUNC │ │ │ │ │ +411 │ │ │ │ │ +412 // We need to overload min() and max() since they require types to be │ │ │ │ │ +413 // LessThanComparable, which requires `a in the standard (still open │ │ │ │ │ +417 // as of 2018-07-06), which strives to require both "implicitly" and │ │ │ │ │ +418 // "contextually" convertible -- plus a few other things. │ │ │ │ │ +419 // │ │ │ │ │ +420 // We do not want our debug type to automatically decay to the underlying │ │ │ │ │ +421 // type, so we do not want to make the conversion non-explicit. So the │ │ │ │ │ +422 // only option left is to overload min() and max(). │ │ │ │ │ +423 │ │ │ │ │ +424 template │ │ │ │ │ +_4_2_5 auto _m_a_x(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, │ │ │ │ │ +426 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +427 { │ │ │ │ │ +428 using std::max; │ │ │ │ │ +429 return aligned(_m_a_x(T(a), T(b))); │ │ │ │ │ +430 } │ │ │ │ │ +431 │ │ │ │ │ +432 template │ │ │ │ │ +_4_3_3 auto _m_a_x(const T &a, const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +434 { │ │ │ │ │ +435 using std::max; │ │ │ │ │ +436 return aligned(_m_a_x(a, T(b))); │ │ │ │ │ +437 } │ │ │ │ │ +438 │ │ │ │ │ +439 template │ │ │ │ │ +_4_4_0 auto _m_a_x(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, const T &b) │ │ │ │ │ +441 { │ │ │ │ │ +442 using std::max; │ │ │ │ │ +443 return aligned(_m_a_x(T(a), b)); │ │ │ │ │ +444 } │ │ │ │ │ +445 │ │ │ │ │ +446 template │ │ │ │ │ +_4_4_7 auto _m_i_n(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, │ │ │ │ │ +448 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +449 { │ │ │ │ │ +450 using std::min; │ │ │ │ │ +451 return aligned(_m_i_n(T(a), T(b))); │ │ │ │ │ +452 } │ │ │ │ │ +453 │ │ │ │ │ +454 template │ │ │ │ │ +_4_5_5 auto _m_i_n(const T &a, const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +456 { │ │ │ │ │ +457 using std::min; │ │ │ │ │ +458 return aligned(_m_i_n(a, T(b))); │ │ │ │ │ +459 } │ │ │ │ │ +460 │ │ │ │ │ +461 template │ │ │ │ │ +_4_6_2 auto _m_i_n(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, const T &b) │ │ │ │ │ +463 { │ │ │ │ │ +464 using std::min; │ │ │ │ │ +465 return aligned(_m_i_n(T(a), b)); │ │ │ │ │ +466 } │ │ │ │ │ +467 │ │ │ │ │ +468 } // namespace AlignedNumberImpl │ │ │ │ │ +469 │ │ │ │ │ +470 // SIMD-like functions from "conditional.hh" │ │ │ │ │ +471 template │ │ │ │ │ +472 AlignedNumber │ │ │ │ │ +_4_7_3 _c_o_n_d(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_b_o_o_l_,_ _a_l_i_g_n_> &b, │ │ │ │ │ +474 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &v1, const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &v2) │ │ │ │ │ +475 { │ │ │ │ │ +476 return b ? v1 : v2; │ │ │ │ │ +477 } │ │ │ │ │ +478 │ │ │ │ │ +479 // SIMD-like functions from "rangeutilities.hh" │ │ │ │ │ +480 template │ │ │ │ │ +_4_8_1 T _m_a_x___v_a_l_u_e(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_>& val) │ │ │ │ │ +482 { │ │ │ │ │ +483 return T(val); │ │ │ │ │ +484 } │ │ │ │ │ +485 │ │ │ │ │ +486 template │ │ │ │ │ +_4_8_7 T _m_i_n___v_a_l_u_e(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_>& val) │ │ │ │ │ +488 { │ │ │ │ │ +489 return T(val); │ │ │ │ │ +490 } │ │ │ │ │ +491 │ │ │ │ │ +492 template │ │ │ │ │ +_4_9_3 bool _a_n_y___t_r_u_e(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_b_o_o_l_,_ _a_l_i_g_n_>& val) │ │ │ │ │ +494 { │ │ │ │ │ +495 return bool(val); │ │ │ │ │ +496 } │ │ │ │ │ +497 │ │ │ │ │ +498 template │ │ │ │ │ +_4_9_9 bool _a_l_l___t_r_u_e(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_b_o_o_l_,_ _a_l_i_g_n_>& val) │ │ │ │ │ +500 { │ │ │ │ │ +501 return bool(val); │ │ │ │ │ +502 } │ │ │ │ │ +503 │ │ │ │ │ +504 // SIMD-like functionality from "simd/interface.hh" │ │ │ │ │ +_5_0_5 namespace Simd { │ │ │ │ │ +_5_0_6 namespace Overloads { │ │ │ │ │ 507 │ │ │ │ │ -508 TransformedRangeIterator& operator++() noexcept { │ │ │ │ │ -509 ++it_; │ │ │ │ │ -510 return *this; │ │ │ │ │ -511 } │ │ │ │ │ -512 │ │ │ │ │ -513 TransformedRangeIterator operator++(int) noexcept { │ │ │ │ │ -514 TransformedRangeIterator copy(*this); │ │ │ │ │ -515 ++(*this); │ │ │ │ │ -516 return copy; │ │ │ │ │ -517 } │ │ │ │ │ +508 template │ │ │ │ │ +_5_0_9 struct _S_c_a_l_a_r_T_y_p_e_<_A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> > { using _t_y_p_e = T; }; │ │ │ │ │ +510 │ │ │ │ │ +511 template │ │ │ │ │ +_5_1_2 struct _R_e_b_i_n_d_T_y_p_e > { │ │ │ │ │ +_5_1_3 using _t_y_p_e = _A_l_i_g_n_e_d_N_u_m_b_e_r_<_U_,_ _a_l_i_g_n_>; │ │ │ │ │ +514 }; │ │ │ │ │ +515 │ │ │ │ │ +516 template │ │ │ │ │ +_5_1_7 struct _L_a_n_e_C_o_u_n_t<_A_l_i_g_n_e_d_N_u_m_b_e_r > : _i_n_d_e_x___c_o_n_s_t_a_n_t<1> {}; │ │ │ │ │ 518 │ │ │ │ │ -519 // Member functions of the bidirectional_iterator that need │ │ │ │ │ -520 // to be redefined because the base class methods return a │ │ │ │ │ -521 // bidirectional_iterator. │ │ │ │ │ -522 TransformedRangeIterator& operator--() noexcept { │ │ │ │ │ -523 --(this->it_); │ │ │ │ │ -524 return *this; │ │ │ │ │ -525 } │ │ │ │ │ -526 │ │ │ │ │ -527 TransformedRangeIterator operator--(int) noexcept { │ │ │ │ │ -528 TransformedRangeIterator copy(*this); │ │ │ │ │ -529 --(*this); │ │ │ │ │ -530 return copy; │ │ │ │ │ +519 template │ │ │ │ │ +_5_2_0 T& _l_a_n_e(_A_D_L_T_a_g_<_5_>, std::size_t l, _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &v) │ │ │ │ │ +521 { │ │ │ │ │ +522 assert(l == 0); │ │ │ │ │ +523 return v._v_a_l_u_e(); │ │ │ │ │ +524 } │ │ │ │ │ +525 │ │ │ │ │ +526 template │ │ │ │ │ +_5_2_7 T _l_a_n_e(_A_D_L_T_a_g_<_5_>, std::size_t l, const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &v) │ │ │ │ │ +528 { │ │ │ │ │ +529 assert(l == 0); │ │ │ │ │ +530 return v._v_a_l_u_e(); │ │ │ │ │ 531 } │ │ │ │ │ 532 │ │ │ │ │ -533 // Additional member functions of random_access_iterator │ │ │ │ │ -534 TransformedRangeIterator& operator+=(difference_type n) noexcept { │ │ │ │ │ -535 it_ += n; │ │ │ │ │ -536 return *this; │ │ │ │ │ -537 } │ │ │ │ │ -538 │ │ │ │ │ -539 TransformedRangeIterator& operator-=(difference_type n) noexcept { │ │ │ │ │ -540 it_ -= n; │ │ │ │ │ -541 return *this; │ │ │ │ │ -542 } │ │ │ │ │ -543 │ │ │ │ │ -544 bool _o_p_e_r_a_t_o_r_<(const TransformedRangeIterator& other) noexcept { │ │ │ │ │ -545 return it_ │ │ │ │ │ +534 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> & │ │ │ │ │ +_5_3_5 _c_o_n_d(_A_D_L_T_a_g_<_5_>, _A_l_i_g_n_e_d_N_u_m_b_e_r_<_b_o_o_l_,_ _a_l_i_g_n_> mask, │ │ │ │ │ +536 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &ifTrue, │ │ │ │ │ +537 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &ifFalse) │ │ │ │ │ +538 { │ │ │ │ │ +539 return _m_a_s_k ? ifTrue : ifFalse; │ │ │ │ │ +540 } │ │ │ │ │ +541 │ │ │ │ │ +542 template │ │ │ │ │ +_5_4_3 bool _a_n_y_T_r_u_e(_A_D_L_T_a_g_<_5_>, const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_b_o_o_l_,_ _a_l_i_g_n_> &mask) │ │ │ │ │ +544 { │ │ │ │ │ +545 return bool(_m_a_s_k); │ │ │ │ │ 546 } │ │ │ │ │ 547 │ │ │ │ │ -548 bool _o_p_e_r_a_t_o_r_<_=(const TransformedRangeIterator& other) noexcept { │ │ │ │ │ -549 return it_<=other.it_; │ │ │ │ │ -550 } │ │ │ │ │ +548 } // namespace Overloads │ │ │ │ │ +549 │ │ │ │ │ +550 } // namespace Simd │ │ │ │ │ 551 │ │ │ │ │ -552 bool _o_p_e_r_a_t_o_r_>(const TransformedRangeIterator& other) noexcept { │ │ │ │ │ -553 return it_>other.it_; │ │ │ │ │ -554 } │ │ │ │ │ -555 │ │ │ │ │ -556 bool _o_p_e_r_a_t_o_r_>_=(const TransformedRangeIterator& other) noexcept { │ │ │ │ │ -557 return it_>=other.it_; │ │ │ │ │ -558 } │ │ │ │ │ -559 │ │ │ │ │ -560 reference operator[](difference_type n) noexcept { │ │ │ │ │ -561 return Base::transform(*f_, it_+n); │ │ │ │ │ -562 } │ │ │ │ │ -563 │ │ │ │ │ -564 friend │ │ │ │ │ -565 TransformedRangeIterator _o_p_e_r_a_t_o_r_+(const TransformedRangeIterator& it, │ │ │ │ │ -difference_type n) noexcept { │ │ │ │ │ -566 return TransformedRangeIterator(it.it_+n, it.f_); │ │ │ │ │ -567 } │ │ │ │ │ -568 │ │ │ │ │ -569 friend │ │ │ │ │ -570 TransformedRangeIterator _o_p_e_r_a_t_o_r_+(difference_type n, const │ │ │ │ │ -TransformedRangeIterator& it) noexcept { │ │ │ │ │ -571 return TransformedRangeIterator(n+it.it_, it.f_); │ │ │ │ │ -572 } │ │ │ │ │ -573 │ │ │ │ │ -574 friend │ │ │ │ │ -575 TransformedRangeIterator _o_p_e_r_a_t_o_r_-(const TransformedRangeIterator& it, │ │ │ │ │ -difference_type n) noexcept { │ │ │ │ │ -576 return TransformedRangeIterator(it.it_-n, it.f_); │ │ │ │ │ -577 } │ │ │ │ │ -578 │ │ │ │ │ -579 friend │ │ │ │ │ -580 difference_type _o_p_e_r_a_t_o_r_-(const TransformedRangeIterator& first, const │ │ │ │ │ -TransformedRangeIterator& second) noexcept { │ │ │ │ │ -581 return first.it_-second.it_; │ │ │ │ │ -582 } │ │ │ │ │ -583 }; │ │ │ │ │ -584 │ │ │ │ │ -585 │ │ │ │ │ -586 } // namespace Impl │ │ │ │ │ -587 │ │ │ │ │ -588 │ │ │ │ │ -589 │ │ │ │ │ -626 template │ │ │ │ │ -_6_2_7 class _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ -628 { │ │ │ │ │ -629 using RawConstIterator = std::decay_t │ │ │ │ │ -()._b_e_g_i_n())>; │ │ │ │ │ -630 using RawIterator = std::decay_t().begin())>; │ │ │ │ │ -631 │ │ │ │ │ -632 public: │ │ │ │ │ -633 │ │ │ │ │ -_6_4_0 using _c_o_n_s_t___i_t_e_r_a_t_o_r = Impl::TransformedRangeIterator; │ │ │ │ │ -641 │ │ │ │ │ -_6_4_8 using _i_t_e_r_a_t_o_r = Impl::TransformedRangeIterator; │ │ │ │ │ -649 │ │ │ │ │ -_6_5_6 using _R_a_w_R_a_n_g_e = std::remove_reference_t; │ │ │ │ │ -657 │ │ │ │ │ -661 template │ │ │ │ │ -_6_6_2 constexpr _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(RR&& _r_a_w_R_a_n_g_e, const F& f) noexcept : │ │ │ │ │ -663 rawRange_(std::forward(_r_a_w_R_a_n_g_e)), │ │ │ │ │ -664 f_(f) │ │ │ │ │ -665 { │ │ │ │ │ -666 static_assert(std::is_same_v or std:: │ │ │ │ │ -is_same_v, │ │ │ │ │ -667 "The TransformationType passed to TransformedRangeView has to be either │ │ │ │ │ -ValueTransformationTag or IteratorTransformationTag."); │ │ │ │ │ -668 } │ │ │ │ │ -669 │ │ │ │ │ -_6_7_8 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const noexcept { │ │ │ │ │ -679 return _c_o_n_s_t___i_t_e_r_a_t_o_r(rawRange_.begin(), &f_); │ │ │ │ │ -680 } │ │ │ │ │ -681 │ │ │ │ │ -_6_8_2 constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n() noexcept { │ │ │ │ │ -683 return _i_t_e_r_a_t_o_r(rawRange_.begin(), &f_); │ │ │ │ │ -684 } │ │ │ │ │ -685 │ │ │ │ │ -_6_9_4 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const noexcept { │ │ │ │ │ -695 return _c_o_n_s_t___i_t_e_r_a_t_o_r(rawRange_.end(), &f_); │ │ │ │ │ -696 } │ │ │ │ │ -697 │ │ │ │ │ -_6_9_8 constexpr _i_t_e_r_a_t_o_r _e_n_d() noexcept { │ │ │ │ │ -699 return _i_t_e_r_a_t_o_r(rawRange_.end(), &f_); │ │ │ │ │ -700 } │ │ │ │ │ -701 │ │ │ │ │ -712 template().size())>> │ │ │ │ │ -_7_1_4 auto _s_i_z_e() const │ │ │ │ │ -715 { │ │ │ │ │ -716 return rawRange_.size(); │ │ │ │ │ -717 } │ │ │ │ │ -718 │ │ │ │ │ -_7_2_2 const _R_a_w_R_a_n_g_e& _r_a_w_R_a_n_g_e() const │ │ │ │ │ -723 { │ │ │ │ │ -724 return rawRange_; │ │ │ │ │ -725 } │ │ │ │ │ -726 │ │ │ │ │ -_7_3_0 _R_a_w_R_a_n_g_e& _r_a_w_R_a_n_g_e() │ │ │ │ │ -731 { │ │ │ │ │ -732 return rawRange_; │ │ │ │ │ -733 } │ │ │ │ │ -734 │ │ │ │ │ -735 private: │ │ │ │ │ -736 R rawRange_; │ │ │ │ │ -737 F f_; │ │ │ │ │ -738 }; │ │ │ │ │ -739 │ │ │ │ │ -768 template │ │ │ │ │ -_7_6_9 auto _t_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(R&& _r_a_n_g_e, const F& f) │ │ │ │ │ -770 { │ │ │ │ │ -771 return _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_<_R_,_ _F_,_ _V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g_>(std::forward │ │ │ │ │ -(_r_a_n_g_e), f); │ │ │ │ │ -772 } │ │ │ │ │ -773 │ │ │ │ │ -801 template │ │ │ │ │ -_8_0_2 auto _i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(R&& _r_a_n_g_e, const F& f) │ │ │ │ │ -803 { │ │ │ │ │ -804 return _T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_<_R_,_ _F_,_ _I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g_>(std:: │ │ │ │ │ -forward(_r_a_n_g_e), f); │ │ │ │ │ -805 } │ │ │ │ │ -806 │ │ │ │ │ -807 │ │ │ │ │ -820 template │ │ │ │ │ -_8_2_1 auto _s_p_a_r_s_e_R_a_n_g_e(Range&& _r_a_n_g_e) { │ │ │ │ │ -822 return _D_u_n_e_:_:_i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w(std::forward(_r_a_n_g_e), [] │ │ │ │ │ -(auto&& it) { │ │ │ │ │ -823 return std::tuple(*it, it.index()); │ │ │ │ │ -824 }); │ │ │ │ │ -825 } │ │ │ │ │ -826 │ │ │ │ │ -831} │ │ │ │ │ -832 │ │ │ │ │ -833#endif // DUNE_COMMON_RANGE_UTILITIES_HH │ │ │ │ │ +552} // namespace Dune │ │ │ │ │ +553 │ │ │ │ │ +554#endif // DUNE_DEBUGALIGN_HH │ │ │ │ │ +_c_l_a_s_s_n_a_m_e_._h_h │ │ │ │ │ +A free function to provide the demangled class name of a given object or type │ │ │ │ │ +as a string. │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_b_a_s_e_._h_h │ │ │ │ │ +Basic definitions for SIMD Implementations. │ │ │ │ │ +_d_e_f_a_u_l_t_s_._h_h │ │ │ │ │ +Default implementations for SIMD Implementations. │ │ │ │ │ +_D_U_N_E___B_I_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_BINARY_OP(OP) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:248 │ │ │ │ │ +_D_U_N_E___U_N_A_R_Y___F_U_N_C │ │ │ │ │ +#define DUNE_UNARY_FUNC(name) │ │ │ │ │ +_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +#define DUNE_ASSIGN_OP(OP) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:207 │ │ │ │ │ _t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ Traits for type conversions and type information. │ │ │ │ │ -_D_u_n_e_:_:_s_p_a_r_s_e_R_a_n_g_e │ │ │ │ │ -auto sparseRange(Range &&range) │ │ │ │ │ -Allow structured-binding for-loops for sparse iterators. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:821 │ │ │ │ │ -_D_u_n_e_:_:_i_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ -auto iteratorTransformedRangeView(R &&range, const F &f) │ │ │ │ │ -Create a TransformedRangeView using an iterator transformation. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:802 │ │ │ │ │ -_D_u_n_e_:_:_t_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ -auto transformedRangeView(R &&range, const F &f) │ │ │ │ │ -Create a TransformedRangeView. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:769 │ │ │ │ │ -_D_u_n_e_:_:_r_a_n_g_e │ │ │ │ │ -static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from │ │ │ │ │ ->, std::integral_constant< T, to >) noexcept │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:549 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ -bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:542 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ -bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:535 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator<(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:637 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_> │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator>(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:683 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator<=(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:660 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for equality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator>=(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:705 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for inequality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t │ │ │ │ │ +std::integral_constant< std::size_t, i > index_constant │ │ │ │ │ +An index constant with value i. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k │ │ │ │ │ +Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) │ │ │ │ │ +implements Simd::mask() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:153 │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t │ │ │ │ │ +void violatedAlignment(const char *className, std::size_t expectedAlignment, │ │ │ │ │ +const void *address) │ │ │ │ │ +called when an alignment violation is detected │ │ │ │ │ +DDeeffiinniittiioonn debugalign.cc:39 │ │ │ │ │ _D_u_n_e_:_:_a_n_y___t_r_u_e │ │ │ │ │ bool any_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ DDeeffiinniittiioonn debugalign.hh:493 │ │ │ │ │ _D_u_n_e_:_:_a_l_l___t_r_u_e │ │ │ │ │ bool all_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ DDeeffiinniittiioonn debugalign.hh:499 │ │ │ │ │ +_D_u_n_e_:_:_c_l_a_s_s_N_a_m_e │ │ │ │ │ +std::string className() │ │ │ │ │ +Provide the demangled class name of a type T as a string. │ │ │ │ │ +DDeeffiinniittiioonn classname.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_d_e_b_u_g_A_l_i_g_n_m_e_n_t │ │ │ │ │ +static constexpr auto debugAlignment │ │ │ │ │ +an alignment large enough to trigger alignment errors │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_d │ │ │ │ │ +const T1 cond(bool b, const T1 &v1, const T2 &v2) │ │ │ │ │ +conditional evaluate │ │ │ │ │ +DDeeffiinniittiioonn conditional.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_a_l_i_g_n_e_d │ │ │ │ │ +AlignedNumber< T, align > aligned(T value) │ │ │ │ │ +align a value to a certain alignment │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r │ │ │ │ │ +ViolatedAlignmentHandler & violatedAlignmentHandler() │ │ │ │ │ +access the handler called by violatedAlignment() │ │ │ │ │ +DDeeffiinniittiioonn debugalign.cc:33 │ │ │ │ │ +_D_u_n_e_:_:_i_s_A_l_i_g_n_e_d │ │ │ │ │ +bool isAligned(const void *p, std::size_t align) │ │ │ │ │ +check whether an address conforms to the given alignment │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:56 │ │ │ │ │ _D_u_n_e_:_:_m_a_x___v_a_l_u_e │ │ │ │ │ T max_value(const AlignedNumber< T, align > &val) │ │ │ │ │ DDeeffiinniittiioonn debugalign.hh:481 │ │ │ │ │ +_D_u_n_e_:_:_V_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t_H_a_n_d_l_e_r │ │ │ │ │ +std::function< void(const char *, std::size_t, const void *)> │ │ │ │ │ +ViolatedAlignmentHandler │ │ │ │ │ +type of the handler called by violatedAlignment() │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:31 │ │ │ │ │ _D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ DDeeffiinniittiioonn debugalign.hh:487 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -dynamic integer range for use in range-based for loops │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:175 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_b_e_g_i_n │ │ │ │ │ -constexpr iterator begin() const noexcept │ │ │ │ │ -obtain a random-access iterator to the first element │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:192 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_n_d │ │ │ │ │ -constexpr iterator end() const noexcept │ │ │ │ │ -obtain a random-access iterator past the last element │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::make_unsigned_t< T > size_type │ │ │ │ │ -unsigned integer type corresponding to value_type │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -Impl::IntegralRangeIterator< T > iterator │ │ │ │ │ -type of iterator │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -constexpr value_type operator[](const value_type &i) const noexcept │ │ │ │ │ -access specified element │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:197 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_m_p_t_y │ │ │ │ │ -constexpr bool empty() const noexcept │ │ │ │ │ -check whether the range is empty │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:200 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -constexpr IntegralRange(std::pair< value_type, value_type > range) noexcept │ │ │ │ │ -construct integer range std::pair │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:189 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -constexpr IntegralRange(value_type from, value_type to) noexcept │ │ │ │ │ -construct integer range [from, to) │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:185 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e │ │ │ │ │ -constexpr size_type size() const noexcept │ │ │ │ │ -obtain number of elements in the range │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:202 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -constexpr IntegralRange(value_type to) noexcept │ │ │ │ │ -construct integer range [0, to) │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:187 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -T value_type │ │ │ │ │ -type of integers contained in the range │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:178 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -static integer range for use in range-based for loops │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:225 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_n_d │ │ │ │ │ -static constexpr iterator end() noexcept │ │ │ │ │ -obtain a random-access iterator past the last element │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:251 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_i_n_t_e_g_e_r___s_e_q_u_e_n_c_e │ │ │ │ │ -decltype(shift_integer_sequence< from >(std::make_integer_sequence< T, to-from │ │ │ │ │ ->())) integer_sequence │ │ │ │ │ -type of corresponding std::integer_sequence │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:238 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e │ │ │ │ │ -constexpr StaticIntegralRange() noexcept=default │ │ │ │ │ -default constructor │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::make_unsigned_t< T > size_type │ │ │ │ │ -unsigned integer type corresponding to value_type │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:235 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -T value_type │ │ │ │ │ -type of integers contained in the range │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:231 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -constexpr auto operator[](const std::integral_constant< U, i > &) const │ │ │ │ │ -noexcept -> std::integral_constant< value_type, from+static_cast< value_type > │ │ │ │ │ -(i)> │ │ │ │ │ -access specified element (static version) │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:255 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_e_m_p_t_y │ │ │ │ │ -static constexpr std::integral_constant< bool, from==to > empty() noexcept │ │ │ │ │ -check whether the range is empty │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_b_e_g_i_n │ │ │ │ │ -static constexpr iterator begin() noexcept │ │ │ │ │ -obtain a random-access iterator to the first element │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:249 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -constexpr value_type operator[](const size_type &i) const noexcept │ │ │ │ │ -access specified element (dynamic version) │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:262 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -Impl::IntegralRangeIterator< T > iterator │ │ │ │ │ -type of iterator │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:233 │ │ │ │ │ -_D_u_n_e_:_:_S_t_a_t_i_c_I_n_t_e_g_r_a_l_R_a_n_g_e_:_:_s_i_z_e │ │ │ │ │ -static constexpr std::integral_constant< size_type, static_cast< size_type > │ │ │ │ │ -(to) - static_cast< size_type >(from) > size() noexcept │ │ │ │ │ -obtain number of elements in the range │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_V_a_l_u_e_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ -Tag to enable value based transformations in TransformedRangeView. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:316 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_T_r_a_n_s_f_o_r_m_a_t_i_o_n_T_a_g │ │ │ │ │ -Tag to enable iterator based transformations in TransformedRangeView. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:321 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ -A range transforming the values of another range on-the-fly. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:628 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_s_i_z_e │ │ │ │ │ -auto size() const │ │ │ │ │ -Obtain the size of the range. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:714 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_e_n_d │ │ │ │ │ -constexpr iterator end() noexcept │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:698 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_R_a_w_R_a_n_g_e │ │ │ │ │ -std::remove_reference_t< R > RawRange │ │ │ │ │ -Export type of the wrapped untransformed range. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:656 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -Impl::TransformedRangeIterator< RawConstIterator, F, T > const_iterator │ │ │ │ │ -Const iterator type. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:640 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_b_e_g_i_n │ │ │ │ │ -constexpr iterator begin() noexcept │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:682 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w │ │ │ │ │ -constexpr TransformedRangeView(RR &&rawRange, const F &f) noexcept │ │ │ │ │ -Construct from range and function. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:662 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_r_a_w_R_a_n_g_e │ │ │ │ │ -const RawRange & rawRange() const │ │ │ │ │ -Export the wrapped untransformed range. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:722 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -Impl::TransformedRangeIterator< RawIterator, F, T > iterator │ │ │ │ │ -Iterator type. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:648 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_b_e_g_i_n │ │ │ │ │ -constexpr const_iterator begin() const noexcept │ │ │ │ │ -Obtain a iterator to the first element. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:678 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_e_n_d │ │ │ │ │ -constexpr const_iterator end() const noexcept │ │ │ │ │ -Obtain a iterator past the last element. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:694 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_e_d_R_a_n_g_e_V_i_e_w_:_:_r_a_w_R_a_n_g_e │ │ │ │ │ -RawRange & rawRange() │ │ │ │ │ -Export the wrapped untransformed range. │ │ │ │ │ -DDeeffiinniittiioonn rangeutilities.hh:730 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_i_n │ │ │ │ │ +auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > │ │ │ │ │ +&b) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:447 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_m_a_x │ │ │ │ │ +auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > │ │ │ │ │ +&b) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:425 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:543 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_l_a_n_e │ │ │ │ │ +T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_I_s_N_u_m_b_e_r │ │ │ │ │ +Whether this type acts as a scalar in the context of (hierarchically blocked) │ │ │ │ │ +containers. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e │ │ │ │ │ +CRTP base mixin class to check alignment. │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e_:_:_~_A_l_i_g_n_e_d_B_a_s_e │ │ │ │ │ +~AlignedBase() │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +AlignedBase & operator=(AlignedBase &&)=default │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e_:_:_A_l_i_g_n_e_d_B_a_s_e │ │ │ │ │ +AlignedBase(AlignedBase &&) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +AlignedBase & operator=(const AlignedBase &)=default │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e_:_:_A_l_i_g_n_e_d_B_a_s_e │ │ │ │ │ +AlignedBase(const AlignedBase &) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_B_a_s_e_:_:_A_l_i_g_n_e_d_B_a_s_e │ │ │ │ │ +AlignedBase() │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ +aligned wrappers for arithmetic types │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +DUNE_ASSIGN_OP(<<=) │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +DUNE_ASSIGN_OP(-=) │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ +decltype(auto) operator+() const │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:174 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +DUNE_ASSIGN_OP(+=) │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ +decltype(auto) operator--(int) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:169 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +DUNE_ASSIGN_OP * DUNE_ASSIGN_OP(/=);DUNE_ASSIGN_OP(%= │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +decltype(auto) operator++(int) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_o_p_e_r_a_t_o_r_! │ │ │ │ │ +decltype(auto) operator!() const │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:204 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_v_a_l_u_e │ │ │ │ │ +T & value() │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:132 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_v_a_l_u_e │ │ │ │ │ +const T & value() const │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +DUNE_ASSIGN_OP^ DUNE_ASSIGN_OP(&=);DUNE_ASSIGN_OP(|= │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ +friend std::basic_istream< charT, Traits > & operator>>(std::basic_istream< │ │ │ │ │ +charT, Traits > &str, AlignedNumber &u) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:137 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_D_U_N_E___A_S_S_I_G_N___O_P │ │ │ │ │ +DUNE_ASSIGN_OP(> >=) │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ +AlignedNumber()=default │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_o_p_e_r_a_t_o_r_~ │ │ │ │ │ +decltype(auto) operator~() const │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ +AlignedNumber(T value) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ +AlignedNumber(const AlignedNumber< U, uAlign > &o) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:124 │ │ │ │ │ +_D_u_n_e_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_I_m_p_l_:_:_A_l_i_g_n_e_d_N_u_m_b_e_r_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +decltype(auto) operator-() const │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e_<_ _A_l_i_g_n_e_d_N_u_m_b_e_r_<_ _T_,_ _a_l_i_g_n_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +T type │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:509 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_A_D_L_T_a_g │ │ │ │ │ +Tag used to force late-binding lookup in Dune::Simd::Overloads. │ │ │ │ │ +DDeeffiinniittiioonn base.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_S_c_a_l_a_r_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_R_e_b_i_n_d_T_y_p_e │ │ │ │ │ +should have a member type type │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_L_a_n_e_C_o_u_n_t │ │ │ │ │ +should be derived from a Dune::index_constant │ │ │ │ │ +DDeeffiinniittiioonn standard.hh:74 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00188.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: fmatrixev.cc File Reference │ │ │ │ +dune-common: scalarmatrixview.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,43 +70,41 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Macros
    │ │ │ │ -
    fmatrixev.cc File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ +
    scalarmatrixview.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include <iostream>
    │ │ │ │ -#include <cmath>
    │ │ │ │ -#include <cassert>
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Macros

    #define DUNE_FMATRIXEIGENVALUES_CC
     
    │ │ │ │ -

    Macro Definition Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ DUNE_FMATRIXEIGENVALUES_CC

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    #define DUNE_FMATRIXEIGENVALUES_CC
    │ │ │ │ -
    │ │ │ │ │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ +

    Implements a scalar matrix view wrapper around an existing scalar. │ │ │ │ +More...

    │ │ │ │ +
    #include <cstddef>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <ostream>
    │ │ │ │ +#include <dune/common/boundschecking.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │ +#include <dune/common/matvectraits.hh>
    │ │ │ │ +#include <dune/common/densematrix.hh>
    │ │ │ │ +#include <dune/common/fmatrix.hh>
    │ │ │ │ +#include <dune/common/scalarvectorview.hh>
    │ │ │ │ +
    │ │ │ │ +

    Go to the source code of this file.

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

    │ │ │ │ +Namespaces

    namespace  Dune
     Dune namespace.
     
    │ │ │ │ +

    Detailed Description

    │ │ │ │ +

    Implements a scalar matrix view wrapper around an existing scalar.

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,20 +1,28 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_M_a_c_r_o_s │ │ │ │ │ -fmatrixev.cc File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___F_M_A_T_R_I_X_E_I_G_E_N_V_A_L_U_E_S___C_C │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +scalarmatrixview.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ +Implements a scalar matrix view wrapper around an existing scalar. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_v_e_c_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_m_a_t_r_i_x_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_c_a_l_a_r_v_e_c_t_o_r_v_i_e_w_._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 │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__FFMMAATTRRIIXXEEIIGGEENNVVAALLUUEESS__CCCC ********** │ │ │ │ │ -#define DUNE_FMATRIXEIGENVALUES_CC │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Implements a scalar matrix view wrapper around an existing scalar. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00191.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: arraylist.hh File Reference │ │ │ │ +dune-common: dynmatrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,49 +72,50 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces
    │ │ │ │ -
    arraylist.hh File Reference
    │ │ │ │ +
    dynmatrix.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Implements a random-access container that can efficiently change size (similar to std::deque) │ │ │ │ +

    This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ More...

    │ │ │ │ -
    #include <array>
    │ │ │ │ -#include <cassert>
    │ │ │ │ -#include <memory>
    │ │ │ │ -#include <vector>
    │ │ │ │ -#include "iteratorfacades.hh"
    │ │ │ │ +
    #include <cmath>
    │ │ │ │ +#include <cstddef>
    │ │ │ │ +#include <iostream>
    │ │ │ │ +#include <initializer_list>
    │ │ │ │ +#include <dune/common/boundschecking.hh>
    │ │ │ │ +#include <dune/common/exceptions.hh>
    │ │ │ │ +#include <dune/common/dynvector.hh>
    │ │ │ │ +#include <dune/common/densematrix.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::ArrayList< T, N, A >
     A dynamically growing random access list. More...
    struct  Dune::DenseMatVecTraits< DynamicMatrix< K > >
     
    class  Dune::ArrayListIterator< T, N, A >
     A random access iterator for the Dune::ArrayList class. More...
    struct  Dune::FieldTraits< DynamicMatrix< K > >
     
    class  Dune::ConstArrayListIterator< T, N, A >
     A constant random access iterator for the Dune::ArrayList class. More...
    class  Dune::DynamicMatrix< K >
     Construct a matrix with a dynamic size. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Implements a random-access container that can efficiently change size (similar to std::deque)

    │ │ │ │ -

    This file implements the class ArrayList which behaves like dynamically growing array together with the class ArrayListIterator which is random access iterator as needed by the stl for sorting and other algorithms.

    Author
    Markus Blatt
    │ │ │ │ +

    This file implements a dense matrix with dynamic numbers of rows and columns.

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,41 +1,37 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -arraylist.hh File Reference │ │ │ │ │ -Implements a random-access container that can efficiently change size (similar │ │ │ │ │ -to std::deque) _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h" │ │ │ │ │ +dynmatrix.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ +This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ │ +_M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_y_n_v_e_c_t_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_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_:_:_A_r_r_a_y_L_i_s_t_<_ _T_,_ _N_,_ _A_ _> │ │ │ │ │ -  A dynamically growing random access list. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _> │ │ │ │ │   │ │ │ │ │ -class   _D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_ _T_,_ _N_,_ _A_ _> │ │ │ │ │ -  A random access iterator for the _D_u_n_e_:_:_A_r_r_a_y_L_i_s_t class. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _> │ │ │ │ │   │ │ │ │ │ -class   _D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_ _T_,_ _N_,_ _A_ _> │ │ │ │ │ -  A constant random access iterator for the _D_u_n_e_:_:_A_r_r_a_y_L_i_s_t class. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _> │ │ │ │ │ +  Construct a matrix with a dynamic size. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implements a random-access container that can efficiently change size (similar │ │ │ │ │ -to std::deque) │ │ │ │ │ -This file implements the class ArrayList which behaves like dynamically growing │ │ │ │ │ -array together with the class ArrayListIterator which is random access iterator │ │ │ │ │ -as needed by the stl for sorting and other algorithms. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00191_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: arraylist.hh Source File │ │ │ │ +dune-common: dynmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,623 +74,215 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    arraylist.hh
    │ │ │ │ +
    dynmatrix.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5
    │ │ │ │ -
    6#ifndef DUNE_COMMON_ARRAYLIST_HH
    │ │ │ │ -
    7#define DUNE_COMMON_ARRAYLIST_HH
    │ │ │ │ -
    8
    │ │ │ │ -
    9#include <array>
    │ │ │ │ -
    10#include <cassert>
    │ │ │ │ -
    11#include <memory>
    │ │ │ │ -
    12#include <vector>
    │ │ │ │ -
    13#include "iteratorfacades.hh"
    │ │ │ │ -
    14
    │ │ │ │ -
    15namespace Dune
    │ │ │ │ -
    16{
    │ │ │ │ -
    17 // forward declaration
    │ │ │ │ -
    18 template<class T, int N, class A>
    │ │ │ │ -
    19 class ArrayListIterator;
    │ │ │ │ -
    20
    │ │ │ │ -
    21 template<class T, int N, class A>
    │ │ │ │ -
    22 class ConstArrayListIterator;
    │ │ │ │ -
    23
    │ │ │ │ -
    60 template<class T, int N=100, class A=std::allocator<T> >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    62 {
    │ │ │ │ -
    63 public:
    │ │ │ │ -
    69 typedef T MemberType;
    │ │ │ │ -
    70
    │ │ │ │ -
    74 typedef T value_type;
    │ │ │ │ -
    75
    │ │ │ │ -
    79 typedef T& reference;
    │ │ │ │ -
    80
    │ │ │ │ -
    84 typedef const T& const_reference;
    │ │ │ │ -
    85
    │ │ │ │ -
    89 typedef T* pointer;
    │ │ │ │ -
    90
    │ │ │ │ -
    94 typedef const T* const_pointer;
    │ │ │ │ -
    95
    │ │ │ │ -
    100 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    │ │ │ │ -
    101
    │ │ │ │ - │ │ │ │ -
    106
    │ │ │ │ - │ │ │ │ +
    5#ifndef DUNE_DYNMATRIX_HH
    │ │ │ │ +
    6#define DUNE_DYNMATRIX_HH
    │ │ │ │ +
    7
    │ │ │ │ +
    8#include <cmath>
    │ │ │ │ +
    9#include <cstddef>
    │ │ │ │ +
    10#include <iostream>
    │ │ │ │ +
    11#include <initializer_list>
    │ │ │ │ +
    12
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    18
    │ │ │ │ +
    19namespace Dune
    │ │ │ │ +
    20{
    │ │ │ │ +
    21
    │ │ │ │ +
    31 template< class K > class DynamicMatrix;
    │ │ │ │ +
    32
    │ │ │ │ +
    33 template< class K >
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    35 {
    │ │ │ │ + │ │ │ │ +
    37
    │ │ │ │ + │ │ │ │ +
    39
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    42
    │ │ │ │ +
    43 typedef std::vector<K> container_type;
    │ │ │ │ +
    44 typedef K value_type;
    │ │ │ │ +
    45 typedef typename container_type::size_type size_type;
    │ │ │ │ +
    46 };
    │ │ │ │ +
    │ │ │ │ +
    47
    │ │ │ │ +
    48 template< class K >
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    50 {
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    53 };
    │ │ │ │ +
    │ │ │ │ +
    54
    │ │ │ │ +
    59 template<class K>
    │ │ │ │ +
    │ │ │ │ +
    60 class DynamicMatrix : public DenseMatrix< DynamicMatrix<K> >
    │ │ │ │ +
    61 {
    │ │ │ │ +
    62 std::vector< DynamicVector<K> > _data;
    │ │ │ │ + │ │ │ │ +
    64 public:
    │ │ │ │ +
    65 typedef typename Base::size_type size_type;
    │ │ │ │ +
    66 typedef typename Base::value_type value_type;
    │ │ │ │ +
    67 typedef typename Base::row_type row_type;
    │ │ │ │ +
    68
    │ │ │ │ +
    69 //===== constructors
    │ │ │ │ + │ │ │ │ +
    72
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    75 _data(r, row_type(c, v) )
    │ │ │ │ +
    76 {}
    │ │ │ │ +
    │ │ │ │ +
    77
    │ │ │ │ +
    │ │ │ │ +
    80 DynamicMatrix (std::initializer_list<DynamicVector<K>> const &ll)
    │ │ │ │ +
    81 : _data(ll)
    │ │ │ │ +
    82 {}
    │ │ │ │ +
    │ │ │ │ +
    83
    │ │ │ │ +
    84
    │ │ │ │ +
    85 template <class T,
    │ │ │ │ +
    86 typename = std::enable_if_t<!Dune::IsNumber<T>::value && HasDenseMatrixAssigner<DynamicMatrix, T>::value>>
    │ │ │ │ +
    │ │ │ │ +
    87 DynamicMatrix(T const& rhs)
    │ │ │ │ +
    88 {
    │ │ │ │ +
    89 *this = rhs;
    │ │ │ │ +
    90 }
    │ │ │ │ +
    │ │ │ │ +
    91
    │ │ │ │ +
    92 //==== resize related methods
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    107 {
    │ │ │ │ +
    108 _data.resize(0);
    │ │ │ │ +
    109 _data.resize(r, row_type(c, v) );
    │ │ │ │ +
    110 }
    │ │ │ │ +
    │ │ │ │
    111
    │ │ │ │ -
    115 typedef std::size_t size_type;
    │ │ │ │ -
    116
    │ │ │ │ -
    120 typedef std::ptrdiff_t difference_type;
    │ │ │ │ -
    121
    │ │ │ │ +
    112 //===== assignment
    │ │ │ │ +
    113 // General assignment with resizing
    │ │ │ │ +
    114 template <typename T,
    │ │ │ │ +
    115 typename = std::enable_if_t<!Dune::IsNumber<T>::value>>
    │ │ │ │ +
    │ │ │ │ +
    116 DynamicMatrix& operator=(T const& rhs) {
    │ │ │ │ +
    117 _data.resize(rhs.N());
    │ │ │ │ +
    118 std::fill(_data.begin(), _data.end(), row_type(rhs.M(), K(0)));
    │ │ │ │ +
    119 Base::operator=(rhs);
    │ │ │ │ +
    120 return *this;
    │ │ │ │ +
    121 }
    │ │ │ │ +
    │ │ │ │ +
    122
    │ │ │ │ +
    123 // Specialisation: scalar assignment (no resizing)
    │ │ │ │ +
    124 template <typename T,
    │ │ │ │ +
    125 typename = std::enable_if_t<Dune::IsNumber<T>::value>>
    │ │ │ │
    │ │ │ │ - │ │ │ │ -
    127
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    134
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    140
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    146
    │ │ │ │ -
    │ │ │ │ -
    151 inline void push_back(const_reference entry);
    │ │ │ │ -
    152
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    159
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    166
    │ │ │ │ -
    │ │ │ │ -
    171 inline size_type size() const;
    │ │ │ │ -
    172
    │ │ │ │ -
    │ │ │ │ -
    180 inline void purge();
    │ │ │ │ -
    181
    │ │ │ │ -
    │ │ │ │ -
    185 inline void clear();
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    190
    │ │ │ │ -
    191 private:
    │ │ │ │ -
    192
    │ │ │ │ -
    196 using SmartPointerAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::shared_ptr< std::array<MemberType,chunkSize_> > >;
    │ │ │ │ -
    197
    │ │ │ │ -
    201 using ArrayAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::array<MemberType,chunkSize_> >;
    │ │ │ │ -
    202
    │ │ │ │ -
    206 friend class ArrayListIterator<T,N,A>;
    │ │ │ │ -
    207 friend class ConstArrayListIterator<T,N,A>;
    │ │ │ │ -
    208
    │ │ │ │ -
    210 std::vector<std::shared_ptr<std::array<MemberType,chunkSize_> >,
    │ │ │ │ -
    211 SmartPointerAllocator> chunks_;
    │ │ │ │ -
    220 size_type capacity_;
    │ │ │ │ -
    222 size_type size_;
    │ │ │ │ -
    224 size_type start_;
    │ │ │ │ -
    233 inline reference elementAt(size_type i);
    │ │ │ │ -
    234
    │ │ │ │ -
    243 inline const_reference elementAt(size_type i) const;
    │ │ │ │ -
    244 };
    │ │ │ │ -
    245
    │ │ │ │ -
    246
    │ │ │ │ -
    250 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ -
    251 class ArrayListIterator : public RandomAccessIteratorFacade<ArrayListIterator<T,N,A>,
    │ │ │ │ -
    252 typename A::value_type,
    │ │ │ │ -
    253 typename A::value_type &,
    │ │ │ │ -
    254 typename A::difference_type>
    │ │ │ │ -
    255 {
    │ │ │ │ -
    256
    │ │ │ │ -
    257 friend class ArrayList<T,N,A>;
    │ │ │ │ -
    258 friend class ConstArrayListIterator<T,N,A>;
    │ │ │ │ -
    259 public:
    │ │ │ │ -
    263 typedef typename A::value_type MemberType;
    │ │ │ │ -
    264
    │ │ │ │ -
    265 typedef typename A::difference_type difference_type;
    │ │ │ │ -
    266
    │ │ │ │ -
    267 typedef typename A::size_type size_type;
    │ │ │ │ -
    268
    │ │ │ │ -
    269 using reference = typename A::value_type &;
    │ │ │ │ -
    270
    │ │ │ │ -
    271 using const_reference = typename A::value_type const&;
    │ │ │ │ -
    272
    │ │ │ │ -
    278 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    │ │ │ │ -
    279
    │ │ │ │ -
    280
    │ │ │ │ -
    286 inline bool equals(const ArrayListIterator<MemberType,N,A>& other) const;
    │ │ │ │ -
    287
    │ │ │ │ -
    293 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    │ │ │ │ -
    294
    │ │ │ │ -
    298 inline void increment();
    │ │ │ │ -
    299
    │ │ │ │ -
    303 inline void decrement();
    │ │ │ │ -
    304
    │ │ │ │ -
    309 inline reference elementAt(size_type i) const;
    │ │ │ │ -
    310
    │ │ │ │ -
    315 inline reference dereference() const;
    │ │ │ │ -
    316
    │ │ │ │ -
    328 inline void eraseToHere();
    │ │ │ │ -
    329
    │ │ │ │ -
    331 inline size_type position(){return position_;}
    │ │ │ │ -
    332
    │ │ │ │ -
    334 inline void advance(difference_type n);
    │ │ │ │ -
    335
    │ │ │ │ -
    337 inline difference_type distanceTo(const ArrayListIterator<T,N,A>& other) const;
    │ │ │ │ -
    338
    │ │ │ │ -
    │ │ │ │ -
    340 inline ArrayListIterator() : position_(0), list_(nullptr)
    │ │ │ │ -
    341 {}
    │ │ │ │ -
    │ │ │ │ -
    342
    │ │ │ │ -
    343 private:
    │ │ │ │ - │ │ │ │ -
    350
    │ │ │ │ -
    354 size_type position_;
    │ │ │ │ - │ │ │ │ -
    359 };
    │ │ │ │ -
    │ │ │ │ -
    360
    │ │ │ │ -
    364 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    366 : public RandomAccessIteratorFacade<ConstArrayListIterator<T,N,A>,
    │ │ │ │ -
    367 const typename A::value_type,
    │ │ │ │ -
    368 typename A::value_type const&,
    │ │ │ │ -
    369 typename A::difference_type>
    │ │ │ │ -
    370 {
    │ │ │ │ -
    371
    │ │ │ │ -
    372 friend class ArrayList<T,N,A>;
    │ │ │ │ -
    373 friend class ArrayListIterator<T,N,A>;
    │ │ │ │ -
    374
    │ │ │ │ -
    375 public:
    │ │ │ │ -
    379 typedef typename A::value_type MemberType;
    │ │ │ │ -
    380
    │ │ │ │ -
    381 typedef typename A::difference_type difference_type;
    │ │ │ │ -
    382
    │ │ │ │ -
    383 typedef typename A::size_type size_type;
    │ │ │ │ -
    384
    │ │ │ │ -
    385 using reference = typename A::value_type &;
    │ │ │ │ -
    386
    │ │ │ │ -
    387 using const_reference = typename A::value_type const&;
    │ │ │ │ -
    388
    │ │ │ │ -
    394 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    │ │ │ │ -
    395
    │ │ │ │ -
    │ │ │ │ -
    401 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    │ │ │ │ -
    402
    │ │ │ │ -
    │ │ │ │ -
    406 inline void increment();
    │ │ │ │ -
    407
    │ │ │ │ -
    │ │ │ │ -
    411 inline void decrement();
    │ │ │ │ -
    412
    │ │ │ │ -
    │ │ │ │ -
    414 inline void advance(difference_type n);
    │ │ │ │ -
    415
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    418
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    424
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    430
    │ │ │ │ -
    │ │ │ │ -
    431 inline ConstArrayListIterator() : position_(0), list_(nullptr)
    │ │ │ │ -
    432 {}
    │ │ │ │ -
    │ │ │ │ -
    433
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    435
    │ │ │ │ -
    436 private:
    │ │ │ │ -
    437
    │ │ │ │ -
    443 inline ConstArrayListIterator(const ArrayList<T,N,A>& arrayList, size_type position);
    │ │ │ │ -
    444
    │ │ │ │ -
    448 size_type position_;
    │ │ │ │ -
    452 const ArrayList<T,N,A>* list_;
    │ │ │ │ -
    453 };
    │ │ │ │ -
    454
    │ │ │ │ -
    455
    │ │ │ │ -
    456 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    458 : capacity_(0), size_(0), start_(0)
    │ │ │ │ -
    459 {
    │ │ │ │ -
    460 chunks_.reserve(100);
    │ │ │ │ -
    461 }
    │ │ │ │ -
    │ │ │ │ -
    462
    │ │ │ │ -
    463 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    465 capacity_=0;
    │ │ │ │ -
    466 size_=0;
    │ │ │ │ -
    467 start_=0;
    │ │ │ │ -
    468 chunks_.clear();
    │ │ │ │ -
    469 }
    │ │ │ │ -
    │ │ │ │ -
    470
    │ │ │ │ -
    471 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    473 {
    │ │ │ │ -
    474 return size_;
    │ │ │ │ -
    475 }
    │ │ │ │ -
    │ │ │ │ -
    476
    │ │ │ │ -
    477 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    479 {
    │ │ │ │ -
    480 size_t index=start_+size_;
    │ │ │ │ -
    481 if(index==capacity_)
    │ │ │ │ -
    482 {
    │ │ │ │ -
    483 chunks_.push_back(std::make_shared<std::array<MemberType,chunkSize_> >());
    │ │ │ │ -
    484 capacity_ += chunkSize_;
    │ │ │ │ -
    485 }
    │ │ │ │ -
    486 elementAt(index)=entry;
    │ │ │ │ -
    487 ++size_;
    │ │ │ │ -
    488 }
    │ │ │ │ -
    │ │ │ │ -
    489
    │ │ │ │ -
    490 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    492 {
    │ │ │ │ -
    493 return elementAt(start_+i);
    │ │ │ │ -
    494 }
    │ │ │ │ -
    │ │ │ │ -
    495
    │ │ │ │ -
    496
    │ │ │ │ -
    497 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    499 {
    │ │ │ │ -
    500 return elementAt(start_+i);
    │ │ │ │ -
    501 }
    │ │ │ │ -
    │ │ │ │ -
    502
    │ │ │ │ -
    503 template<class T, int N, class A>
    │ │ │ │ - │ │ │ │ -
    505 {
    │ │ │ │ -
    506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    │ │ │ │ -
    507 }
    │ │ │ │ -
    508
    │ │ │ │ -
    509
    │ │ │ │ -
    510 template<class T, int N, class A>
    │ │ │ │ -
    511 typename ArrayList<T,N,A>::const_reference ArrayList<T,N,A>::elementAt(size_type i) const
    │ │ │ │ -
    512 {
    │ │ │ │ -
    513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    │ │ │ │ -
    514 }
    │ │ │ │ -
    515
    │ │ │ │ -
    516 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    518 {
    │ │ │ │ -
    519 return ArrayListIterator<T,N,A>(*this, start_);
    │ │ │ │ -
    520 }
    │ │ │ │ -
    │ │ │ │ -
    521
    │ │ │ │ -
    522 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    524 {
    │ │ │ │ -
    525 return ConstArrayListIterator<T,N,A>(*this, start_);
    │ │ │ │ -
    526 }
    │ │ │ │ -
    │ │ │ │ -
    527
    │ │ │ │ -
    528 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    530 {
    │ │ │ │ -
    531 return ArrayListIterator<T,N,A>(*this, start_+size_);
    │ │ │ │ -
    532 }
    │ │ │ │ -
    │ │ │ │ -
    533
    │ │ │ │ -
    534 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    536 {
    │ │ │ │ -
    537 return ConstArrayListIterator<T,N,A>(*this, start_+size_);
    │ │ │ │ -
    538 }
    │ │ │ │ -
    │ │ │ │ -
    539
    │ │ │ │ -
    540 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    542 {
    │ │ │ │ -
    543 // Distance to copy to the left.
    │ │ │ │ -
    544 size_t distance = start_/chunkSize_;
    │ │ │ │ -
    545 if(distance>0) {
    │ │ │ │ -
    546 // Number of chunks with entries in it;
    │ │ │ │ -
    547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ );
    │ │ │ │ -
    548
    │ │ │ │ -
    549 // Copy chunks to the left.
    │ │ │ │ -
    550 std::copy(chunks_.begin()+distance,
    │ │ │ │ -
    551 chunks_.begin()+(distance+chunks), chunks_.begin());
    │ │ │ │ -
    552
    │ │ │ │ -
    553 // Calculate new parameters
    │ │ │ │ -
    554 start_ = start_ % chunkSize_;
    │ │ │ │ -
    555 //capacity += distance * chunkSize_;
    │ │ │ │ -
    556 }
    │ │ │ │ -
    557 }
    │ │ │ │ -
    │ │ │ │ -
    558
    │ │ │ │ -
    559 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    561 {
    │ │ │ │ -
    562 position_+=i;
    │ │ │ │ -
    563 }
    │ │ │ │ -
    │ │ │ │ -
    564
    │ │ │ │ -
    565 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    567 {
    │ │ │ │ -
    568 position_+=i;
    │ │ │ │ -
    569 }
    │ │ │ │ -
    │ │ │ │ -
    570
    │ │ │ │ -
    571
    │ │ │ │ -
    572 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    574 {
    │ │ │ │ -
    575 // Makes only sense if we reference a common list
    │ │ │ │ -
    576 assert(list_==(other.list_));
    │ │ │ │ -
    577 return position_==other.position_ ;
    │ │ │ │ -
    578 }
    │ │ │ │ -
    │ │ │ │ -
    579
    │ │ │ │ -
    580
    │ │ │ │ -
    581 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    583 {
    │ │ │ │ -
    584 // Makes only sense if we reference a common list
    │ │ │ │ -
    585 assert(list_==(other.list_));
    │ │ │ │ -
    586 return position_==other.position_ ;
    │ │ │ │ -
    587 }
    │ │ │ │ -
    │ │ │ │ -
    588
    │ │ │ │ -
    589
    │ │ │ │ -
    590 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    592 {
    │ │ │ │ -
    593 // Makes only sense if we reference a common list
    │ │ │ │ -
    594 assert(list_==(other.list_));
    │ │ │ │ -
    595 return position_==other.position_ ;
    │ │ │ │ -
    596 }
    │ │ │ │ -
    │ │ │ │ -
    597
    │ │ │ │ -
    598 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    600 {
    │ │ │ │ -
    601 ++position_;
    │ │ │ │ -
    602 }
    │ │ │ │ -
    │ │ │ │ -
    603
    │ │ │ │ -
    604 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    606 {
    │ │ │ │ -
    607 ++position_;
    │ │ │ │ -
    608 }
    │ │ │ │ -
    │ │ │ │ -
    609
    │ │ │ │ -
    610 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    612 {
    │ │ │ │ -
    613 --position_;
    │ │ │ │ -
    614 }
    │ │ │ │ -
    │ │ │ │ -
    615
    │ │ │ │ -
    616 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    618 {
    │ │ │ │ -
    619 --position_;
    │ │ │ │ -
    620 }
    │ │ │ │ -
    │ │ │ │ -
    621
    │ │ │ │ -
    622 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    624 {
    │ │ │ │ -
    625 return list_->elementAt(i+position_);
    │ │ │ │ -
    626 }
    │ │ │ │ -
    │ │ │ │ -
    627
    │ │ │ │ -
    628 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    630 {
    │ │ │ │ -
    631 return list_->elementAt(i+position_);
    │ │ │ │ -
    632 }
    │ │ │ │ -
    │ │ │ │ -
    633
    │ │ │ │ -
    634 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    636 {
    │ │ │ │ -
    637 return list_->elementAt(position_);
    │ │ │ │ -
    638 }
    │ │ │ │ -
    │ │ │ │ -
    639
    │ │ │ │ -
    640 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    642 {
    │ │ │ │ -
    643 return list_->elementAt(position_);
    │ │ │ │ -
    644 }
    │ │ │ │ -
    │ │ │ │ -
    645
    │ │ │ │ -
    646 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    648 {
    │ │ │ │ -
    649 // Makes only sense if we reference a common list
    │ │ │ │ -
    650 assert(list_==(other.list_));
    │ │ │ │ -
    651 return other.position_ - position_;
    │ │ │ │ -
    652 }
    │ │ │ │ -
    │ │ │ │ -
    653
    │ │ │ │ -
    654 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    656 {
    │ │ │ │ -
    657 // Makes only sense if we reference a common list
    │ │ │ │ -
    658 assert(list_==(other.list_));
    │ │ │ │ -
    659 return other.position_ - position_;
    │ │ │ │ -
    660 }
    │ │ │ │ -
    │ │ │ │ -
    661
    │ │ │ │ -
    662 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    664 {
    │ │ │ │ -
    665 list_->size_ -= ++position_ - list_->start_;
    │ │ │ │ -
    666 // chunk number of the new position.
    │ │ │ │ -
    667 size_t posChunkStart = position_ / chunkSize_;
    │ │ │ │ -
    668 // number of chunks to deallocate
    │ │ │ │ -
    669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_)
    │ │ │ │ -
    670 / chunkSize_;
    │ │ │ │ -
    671 list_->start_ = position_;
    │ │ │ │ -
    672
    │ │ │ │ -
    673 // Deallocate memory not needed any more.
    │ │ │ │ -
    674 for(size_t chunk=0; chunk<chunks; chunk++) {
    │ │ │ │ -
    675 --posChunkStart;
    │ │ │ │ -
    676 list_->chunks_[posChunkStart].reset();
    │ │ │ │ -
    677 }
    │ │ │ │ -
    678
    │ │ │ │ -
    679 // Capacity stays the same as the chunks before us
    │ │ │ │ -
    680 // are still there. They null pointers.
    │ │ │ │ -
    681 assert(list_->start_+list_->size_<=list_->capacity_);
    │ │ │ │ -
    682 }
    │ │ │ │ -
    │ │ │ │ -
    683
    │ │ │ │ -
    684 template<class T, int N, class A>
    │ │ │ │ - │ │ │ │ -
    686 : position_(position), list_(&arrayList)
    │ │ │ │ -
    687 {}
    │ │ │ │ -
    688
    │ │ │ │ -
    689
    │ │ │ │ -
    690 template<class T, int N, class A>
    │ │ │ │ -
    691 ConstArrayListIterator<T,N,A>::ConstArrayListIterator(const ArrayList<T,N,A>& arrayList,
    │ │ │ │ -
    692 size_type position)
    │ │ │ │ -
    693 : position_(position), list_(&arrayList)
    │ │ │ │ -
    694 {}
    │ │ │ │ -
    695
    │ │ │ │ -
    696 template<class T, int N, class A>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    698 : position_(other.position_), list_(other.list_)
    │ │ │ │ -
    699 {}
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    700
    │ │ │ │ -
    701
    │ │ │ │ -
    703}
    │ │ │ │ -
    704#endif
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ + │ │ │ │ +
    127 std::fill(_data.begin(), _data.end(), scalar);
    │ │ │ │ +
    128 return *this;
    │ │ │ │ +
    129 }
    │ │ │ │ +
    │ │ │ │ +
    130
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    133 {
    │ │ │ │ +
    134 DynamicMatrix AT(this->M(), this->N());
    │ │ │ │ +
    135 for( size_type i = 0; i < this->N(); ++i )
    │ │ │ │ +
    136 for( size_type j = 0; j < this->M(); ++j )
    │ │ │ │ +
    137 AT[j][i] = (*this)[i][j];
    │ │ │ │ +
    138 return AT;
    │ │ │ │ +
    139 }
    │ │ │ │
    │ │ │ │ +
    140
    │ │ │ │ +
    141 // make this thing a matrix
    │ │ │ │ +
    142 size_type mat_rows() const { return _data.size(); }
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    144 assert(this->rows());
    │ │ │ │ +
    145 return _data.front().size();
    │ │ │ │ +
    146 }
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    148 DUNE_ASSERT_BOUNDS(i < _data.size());
    │ │ │ │ +
    149 return _data[i];
    │ │ │ │ +
    150 }
    │ │ │ │
    │ │ │ │ -
    This file implements iterator facade classes for writing stl conformant iterators.
    │ │ │ │ -
    reference operator[](size_type i)
    Get the element at specific position.
    Definition arraylist.hh:491
    │ │ │ │ -
    iterator begin()
    Get an iterator that is positioned at the first element.
    Definition arraylist.hh:517
    │ │ │ │ -
    bool equals(const ArrayListIterator< MemberType, N, A > &other) const
    Comares two iterators.
    Definition arraylist.hh:573
    │ │ │ │ -
    void increment()
    Increment the iterator.
    Definition arraylist.hh:599
    │ │ │ │ -
    size_type size() const
    Get the number of elements in the list.
    Definition arraylist.hh:472
    │ │ │ │ -
    ConstArrayListIterator(const ArrayListIterator< T, N, A > &other)
    Definition arraylist.hh:697
    │ │ │ │ -
    void purge()
    Purge the list.
    Definition arraylist.hh:541
    │ │ │ │ -
    void decrement()
    decrement the iterator.
    Definition arraylist.hh:611
    │ │ │ │ -
    void eraseToHere()
    Erase all entries before the current position and the one at the current position.
    Definition arraylist.hh:663
    │ │ │ │ -
    ArrayList()
    Constructs an Array list with one chunk.
    Definition arraylist.hh:457
    │ │ │ │ -
    const_iterator begin() const
    Get a random access iterator that is positioned at the first element.
    Definition arraylist.hh:523
    │ │ │ │ -
    void increment()
    Increment the iterator.
    Definition arraylist.hh:605
    │ │ │ │ -
    iterator end()
    Get a random access iterator positioned after the last element.
    Definition arraylist.hh:529
    │ │ │ │ -
    const_reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition arraylist.hh:629
    │ │ │ │ -
    const_reference operator[](size_type i) const
    Get the element at specific position.
    Definition arraylist.hh:498
    │ │ │ │ -
    void decrement()
    decrement the iterator.
    Definition arraylist.hh:617
    │ │ │ │ -
    void advance(difference_type n)
    Definition arraylist.hh:566
    │ │ │ │ -
    const_iterator end() const
    Get a random access iterator positioned after the last element.
    Definition arraylist.hh:535
    │ │ │ │ -
    const_reference dereference() const
    Access the element at the current position.
    Definition arraylist.hh:641
    │ │ │ │ -
    void clear()
    Delete all entries from the list.
    Definition arraylist.hh:464
    │ │ │ │ -
    reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition arraylist.hh:623
    │ │ │ │ -
    bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const
    Comares to iterators.
    Definition arraylist.hh:591
    │ │ │ │ -
    void advance(difference_type n)
    Definition arraylist.hh:560
    │ │ │ │ -
    difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other) const
    Definition arraylist.hh:655
    │ │ │ │ -
    reference dereference() const
    Access the element at the current position.
    Definition arraylist.hh:635
    │ │ │ │ -
    void push_back(const_reference entry)
    Append an entry to the list.
    Definition arraylist.hh:478
    │ │ │ │ -
    difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const
    Definition arraylist.hh:647
    │ │ │ │ +
    │ │ │ │ +
    151 const row_type & mat_access(size_type i) const {
    │ │ │ │ +
    152 DUNE_ASSERT_BOUNDS(i < _data.size());
    │ │ │ │ +
    153 return _data[i];
    │ │ │ │ +
    154 }
    │ │ │ │ +
    │ │ │ │ +
    155 };
    │ │ │ │ +
    │ │ │ │ +
    156
    │ │ │ │ +
    159} // end namespace
    │ │ │ │ +
    160
    │ │ │ │ +
    161#endif
    │ │ │ │ +
    Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
    │ │ │ │ +
    Macro for wrapping boundary checks.
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    This file implements a dense vector with a dynamic size.
    │ │ │ │ +
    A few common exception classes.
    │ │ │ │ +
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition boundschecking.hh:30
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    A random access iterator for the Dune::ArrayList class.
    Definition arraylist.hh:255
    │ │ │ │ -
    size_type position()
    Definition arraylist.hh:331
    │ │ │ │ -
    A::value_type MemberType
    The member type.
    Definition arraylist.hh:263
    │ │ │ │ -
    ArrayListIterator()
    Standard constructor.
    Definition arraylist.hh:340
    │ │ │ │ -
    A::difference_type difference_type
    Definition arraylist.hh:265
    │ │ │ │ -
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition arraylist.hh:278
    │ │ │ │ -
    A::size_type size_type
    Definition arraylist.hh:267
    │ │ │ │ -
    typename A::value_type const & const_reference
    Definition arraylist.hh:271
    │ │ │ │ -
    typename A::value_type & reference
    Definition arraylist.hh:269
    │ │ │ │ -
    A constant random access iterator for the Dune::ArrayList class.
    Definition arraylist.hh:370
    │ │ │ │ -
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition arraylist.hh:394
    │ │ │ │ -
    typename A::value_type & reference
    Definition arraylist.hh:385
    │ │ │ │ -
    ConstArrayListIterator()
    Definition arraylist.hh:431
    │ │ │ │ -
    A::value_type MemberType
    The member type.
    Definition arraylist.hh:379
    │ │ │ │ -
    A::difference_type difference_type
    Definition arraylist.hh:381
    │ │ │ │ -
    typename A::value_type const & const_reference
    Definition arraylist.hh:387
    │ │ │ │ -
    A::size_type size_type
    Definition arraylist.hh:383
    │ │ │ │ -
    A dynamically growing random access list.
    Definition arraylist.hh:62
    │ │ │ │ -
    T value_type
    Value type for stl compliance.
    Definition arraylist.hh:74
    │ │ │ │ -
    static constexpr int chunkSize_
    The number of elements in one chunk of the list. This has to be at least one. The default is 100.
    Definition arraylist.hh:100
    │ │ │ │ -
    const T * const_pointer
    The type of a const pointer to the type we store.
    Definition arraylist.hh:94
    │ │ │ │ -
    ArrayListIterator< MemberType, N, A > iterator
    A random access iterator.
    Definition arraylist.hh:105
    │ │ │ │ -
    const T & const_reference
    The type of a const reference to the type we store.
    Definition arraylist.hh:84
    │ │ │ │ -
    T & reference
    The type of a reference to the type we store.
    Definition arraylist.hh:79
    │ │ │ │ -
    std::size_t size_type
    The size type.
    Definition arraylist.hh:115
    │ │ │ │ -
    T MemberType
    The member type that is stored.
    Definition arraylist.hh:69
    │ │ │ │ -
    T * pointer
    The type of a pointer to the type we store.
    Definition arraylist.hh:89
    │ │ │ │ -
    ConstArrayListIterator< MemberType, N, A > const_iterator
    A constant random access iterator.
    Definition arraylist.hh:110
    │ │ │ │ -
    std::ptrdiff_t difference_type
    The difference type.
    Definition arraylist.hh:120
    │ │ │ │ -
    Base class for stl conformant forward iterators.
    Definition iteratorfacades.hh:434
    │ │ │ │ +
    A dense n x m matrix.
    Definition densematrix.hh:140
    │ │ │ │ +
    derived_type & operator=(const RHS &rhs)
    Definition densematrix.hh:279
    │ │ │ │ +
    constexpr size_type M() const
    number of columns
    Definition densematrix.hh:703
    │ │ │ │ +
    Traits::value_type value_type
    export the type representing the field
    Definition densematrix.hh:157
    │ │ │ │ +
    constexpr size_type rows() const
    number of rows
    Definition densematrix.hh:709
    │ │ │ │ +
    constexpr size_type N() const
    number of rows
    Definition densematrix.hh:697
    │ │ │ │ +
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition densematrix.hh:166
    │ │ │ │ +
    Construct a matrix with a dynamic size.
    Definition dynmatrix.hh:61
    │ │ │ │ +
    size_type mat_cols() const
    Definition dynmatrix.hh:143
    │ │ │ │ +
    DynamicMatrix(std::initializer_list< DynamicVector< K > > const &ll)
    Constructor initializing the matrix from a list of vector.
    Definition dynmatrix.hh:80
    │ │ │ │ +
    Base::row_type row_type
    Definition dynmatrix.hh:67
    │ │ │ │ +
    DynamicMatrix transposed() const
    Return transposed of the matrix as DynamicMatrix.
    Definition dynmatrix.hh:132
    │ │ │ │ +
    Base::value_type value_type
    Definition dynmatrix.hh:66
    │ │ │ │ +
    row_type & mat_access(size_type i)
    Definition dynmatrix.hh:147
    │ │ │ │ +
    Base::size_type size_type
    Definition dynmatrix.hh:65
    │ │ │ │ +
    size_type mat_rows() const
    Definition dynmatrix.hh:142
    │ │ │ │ +
    DynamicMatrix(T const &rhs)
    Definition dynmatrix.hh:87
    │ │ │ │ +
    const row_type & mat_access(size_type i) const
    Definition dynmatrix.hh:151
    │ │ │ │ +
    void resize(size_type r, size_type c, value_type v=value_type())
    resize matrix to r × c
    Definition dynmatrix.hh:106
    │ │ │ │ +
    DynamicMatrix & operator=(T const &rhs)
    Definition dynmatrix.hh:116
    │ │ │ │ +
    DynamicMatrix()
    Default constructor.
    Definition dynmatrix.hh:71
    │ │ │ │ +
    DynamicMatrix(size_type r, size_type c, value_type v=value_type())
    Constructor initializing the whole matrix with a scalar.
    Definition dynmatrix.hh:74
    │ │ │ │ +
    DynamicMatrix & operator=(T scalar)
    Definition dynmatrix.hh:126
    │ │ │ │ +
    container_type::size_type size_type
    Definition dynmatrix.hh:45
    │ │ │ │ +
    DynamicVector< K > row_type
    Definition dynmatrix.hh:38
    │ │ │ │ +
    row_type & row_reference
    Definition dynmatrix.hh:40
    │ │ │ │ +
    K value_type
    Definition dynmatrix.hh:44
    │ │ │ │ +
    DynamicMatrix< K > derived_type
    Definition dynmatrix.hh:36
    │ │ │ │ +
    const row_type & const_row_reference
    Definition dynmatrix.hh:41
    │ │ │ │ +
    std::vector< K > container_type
    Definition dynmatrix.hh:43
    │ │ │ │ +
    FieldTraits< K >::real_type real_type
    Definition dynmatrix.hh:52
    │ │ │ │ +
    FieldTraits< K >::field_type field_type
    Definition dynmatrix.hh:51
    │ │ │ │ +
    Construct a vector with a dynamic size.
    Definition dynvector.hh:59
    │ │ │ │ +
    Definition ftraits.hh:26
    │ │ │ │ +
    T field_type
    export the type representing the field
    Definition ftraits.hh:28
    │ │ │ │ +
    T real_type
    export the type representing the real type of the field
    Definition ftraits.hh:30
    │ │ │ │ +
    Definition matvectraits.hh:31
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,698 +1,280 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -arraylist.hh │ │ │ │ │ +dynmatrix.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5 │ │ │ │ │ -6#ifndef DUNE_COMMON_ARRAYLIST_HH │ │ │ │ │ -7#define DUNE_COMMON_ARRAYLIST_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include "_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h" │ │ │ │ │ -14 │ │ │ │ │ -15namespace _D_u_n_e │ │ │ │ │ -16{ │ │ │ │ │ -17 // forward declaration │ │ │ │ │ -18 template │ │ │ │ │ -19 class ArrayListIterator; │ │ │ │ │ -20 │ │ │ │ │ -21 template │ │ │ │ │ -22 class ConstArrayListIterator; │ │ │ │ │ -23 │ │ │ │ │ -60 template > │ │ │ │ │ -_6_1 class _A_r_r_a_y_L_i_s_t │ │ │ │ │ -62 { │ │ │ │ │ -63 public: │ │ │ │ │ -_6_9 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ -70 │ │ │ │ │ -_7_4 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -75 │ │ │ │ │ -_7_9 typedef T& _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -80 │ │ │ │ │ -_8_4 typedef const T& _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -85 │ │ │ │ │ -_8_9 typedef T* _p_o_i_n_t_e_r; │ │ │ │ │ -90 │ │ │ │ │ -_9_4 typedef const T* _c_o_n_s_t___p_o_i_n_t_e_r; │ │ │ │ │ -95 │ │ │ │ │ -_1_0_0 constexpr static int _c_h_u_n_k_S_i_z_e__ = (N > 0) ? N : 1; │ │ │ │ │ -101 │ │ │ │ │ -_1_0_5 typedef _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_> _i_t_e_r_a_t_o_r; │ │ │ │ │ -106 │ │ │ │ │ -_1_1_0 typedef _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_> _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +5#ifndef DUNE_DYNMATRIX_HH │ │ │ │ │ +6#define DUNE_DYNMATRIX_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +14#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_y_n_v_e_c_t_o_r_._h_h> │ │ │ │ │ +16#include <_d_u_n_e_/_c_o_m_m_o_n_/_d_e_n_s_e_m_a_t_r_i_x_._h_h> │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +18 │ │ │ │ │ +19namespace _D_u_n_e │ │ │ │ │ +20{ │ │ │ │ │ +21 │ │ │ │ │ +31 template< class K > class DynamicMatrix; │ │ │ │ │ +32 │ │ │ │ │ +33 template< class K > │ │ │ │ │ +_3_4 struct _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s< _D_y_n_a_m_i_c_M_a_t_r_i_x > │ │ │ │ │ +35 { │ │ │ │ │ +_3_6 typedef _D_y_n_a_m_i_c_M_a_t_r_i_x_<_K_> _d_e_r_i_v_e_d___t_y_p_e; │ │ │ │ │ +37 │ │ │ │ │ +_3_8 typedef _D_y_n_a_m_i_c_V_e_c_t_o_r_<_K_> _r_o_w___t_y_p_e; │ │ │ │ │ +39 │ │ │ │ │ +_4_0 typedef _r_o_w___t_y_p_e &_r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_4_1 typedef const _r_o_w___t_y_p_e &_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +42 │ │ │ │ │ +_4_3 typedef std::vector _c_o_n_t_a_i_n_e_r___t_y_p_e; │ │ │ │ │ +_4_4 typedef K _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_4_5 typedef typename container_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +46 }; │ │ │ │ │ +47 │ │ │ │ │ +48 template< class K > │ │ │ │ │ +_4_9 struct _F_i_e_l_d_T_r_a_i_t_s< _D_y_n_a_m_i_c_M_a_t_r_i_x > │ │ │ │ │ +50 { │ │ │ │ │ +_5_1 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_5_2 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ +53 }; │ │ │ │ │ +54 │ │ │ │ │ +59 template │ │ │ │ │ +_6_0 class _D_y_n_a_m_i_c_M_a_t_r_i_x : public _D_e_n_s_e_M_a_t_r_i_x< DynamicMatrix > │ │ │ │ │ +61 { │ │ │ │ │ +62 std::vector< DynamicVector > _data; │ │ │ │ │ +63 typedef _D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_K_> > _B_a_s_e; │ │ │ │ │ +64 public: │ │ │ │ │ +_6_5 typedef typename _B_a_s_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +_6_6 typedef typename _B_a_s_e_:_:_v_a_l_u_e___t_y_p_e _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_6_7 typedef typename _B_a_s_e_:_:_r_o_w___t_y_p_e _r_o_w___t_y_p_e; │ │ │ │ │ +68 │ │ │ │ │ +69 //===== constructors │ │ │ │ │ +_7_1 _D_y_n_a_m_i_c_M_a_t_r_i_x () {} │ │ │ │ │ +72 │ │ │ │ │ +_7_4 _D_y_n_a_m_i_c_M_a_t_r_i_x (_s_i_z_e___t_y_p_e r, _s_i_z_e___t_y_p_e c, _v_a_l_u_e___t_y_p_e v = _v_a_l_u_e___t_y_p_e() ) : │ │ │ │ │ +75 _data(r, _r_o_w___t_y_p_e(c, v) ) │ │ │ │ │ +76 {} │ │ │ │ │ +77 │ │ │ │ │ +_8_0 _D_y_n_a_m_i_c_M_a_t_r_i_x (std::initializer_list<_D_y_n_a_m_i_c_V_e_c_t_o_r_<_K_>> const &ll) │ │ │ │ │ +81 : _data(ll) │ │ │ │ │ +82 {} │ │ │ │ │ +83 │ │ │ │ │ +84 │ │ │ │ │ +85 template ::value && │ │ │ │ │ +HasDenseMatrixAssigner::value>> │ │ │ │ │ +_8_7 _D_y_n_a_m_i_c_M_a_t_r_i_x(T const& rhs) │ │ │ │ │ +88 { │ │ │ │ │ +89 *this = rhs; │ │ │ │ │ +90 } │ │ │ │ │ +91 │ │ │ │ │ +92 //==== resize related methods │ │ │ │ │ +_1_0_6 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e r, _s_i_z_e___t_y_p_e c, _v_a_l_u_e___t_y_p_e v = _v_a_l_u_e___t_y_p_e() ) │ │ │ │ │ +107 { │ │ │ │ │ +108 _data.resize(0); │ │ │ │ │ +109 _data.resize(r, _r_o_w___t_y_p_e(c, v) ); │ │ │ │ │ +110 } │ │ │ │ │ 111 │ │ │ │ │ -_1_1_5 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -116 │ │ │ │ │ -_1_2_0 typedef std::ptrdiff_t _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ -121 │ │ │ │ │ -_1_2_6 _i_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ │ -127 │ │ │ │ │ -_1_3_3 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ -134 │ │ │ │ │ -_1_3_9 _i_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ │ +112 //===== assignment │ │ │ │ │ +113 // General assignment with resizing │ │ │ │ │ +114 template ::value>> │ │ │ │ │ +_1_1_6 _D_y_n_a_m_i_c_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=(T const& rhs) { │ │ │ │ │ +117 _data._r_e_s_i_z_e(rhs.N()); │ │ │ │ │ +118 std::fill(_data.begin(), _data.end(), _r_o_w___t_y_p_e(rhs.M(), K(0))); │ │ │ │ │ +119 _B_a_s_e_:_:_o_p_e_r_a_t_o_r_=(rhs); │ │ │ │ │ +120 return *this; │ │ │ │ │ +121 } │ │ │ │ │ +122 │ │ │ │ │ +123 // Specialisation: scalar assignment (no resizing) │ │ │ │ │ +124 template ::value>> │ │ │ │ │ +_1_2_6 _D_y_n_a_m_i_c_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=(T scalar) { │ │ │ │ │ +127 std::fill(_data.begin(), _data.end(), scalar); │ │ │ │ │ +128 return *this; │ │ │ │ │ +129 } │ │ │ │ │ +130 │ │ │ │ │ +_1_3_2 _D_y_n_a_m_i_c_M_a_t_r_i_x _t_r_a_n_s_p_o_s_e_d() const │ │ │ │ │ +133 { │ │ │ │ │ +134 _D_y_n_a_m_i_c_M_a_t_r_i_x AT(this->_M(), this->_N()); │ │ │ │ │ +135 for( size_type i = 0; i < this->_N(); ++i ) │ │ │ │ │ +136 for( _s_i_z_e___t_y_p_e j = 0; j < this->_M(); ++j ) │ │ │ │ │ +137 AT[j][i] = (*this)[i][j]; │ │ │ │ │ +138 return AT; │ │ │ │ │ +139 } │ │ │ │ │ 140 │ │ │ │ │ -_1_4_5 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ -146 │ │ │ │ │ -_1_5_1 inline void _p_u_s_h___b_a_c_k(_c_o_n_s_t___r_e_f_e_r_e_n_c_e entry); │ │ │ │ │ -152 │ │ │ │ │ -_1_5_8 inline _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); │ │ │ │ │ -159 │ │ │ │ │ -_1_6_5 inline _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; │ │ │ │ │ -166 │ │ │ │ │ -_1_7_1 inline _s_i_z_e___t_y_p_e _s_i_z_e() const; │ │ │ │ │ -172 │ │ │ │ │ -_1_8_0 inline void _p_u_r_g_e(); │ │ │ │ │ -181 │ │ │ │ │ -_1_8_5 inline void _c_l_e_a_r(); │ │ │ │ │ -_1_8_9 _A_r_r_a_y_L_i_s_t(); │ │ │ │ │ -190 │ │ │ │ │ -191 private: │ │ │ │ │ -192 │ │ │ │ │ -196 using SmartPointerAllocator = typename std::allocator_traits::template │ │ │ │ │ -rebind_alloc< std::shared_ptr< std::array > >; │ │ │ │ │ -197 │ │ │ │ │ -201 using ArrayAllocator = typename std::allocator_traits::template │ │ │ │ │ -rebind_alloc< std::array >; │ │ │ │ │ -202 │ │ │ │ │ -206 friend class _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -207 friend class _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -208 │ │ │ │ │ -210 std::vector >, │ │ │ │ │ -211 SmartPointerAllocator> chunks_; │ │ │ │ │ -220 _s_i_z_e___t_y_p_e capacity_; │ │ │ │ │ -222 _s_i_z_e___t_y_p_e size_; │ │ │ │ │ -224 _s_i_z_e___t_y_p_e start_; │ │ │ │ │ -233 inline _r_e_f_e_r_e_n_c_e elementAt(_s_i_z_e___t_y_p_e i); │ │ │ │ │ -234 │ │ │ │ │ -_2_4_3 inline _c_o_n_s_t___r_e_f_e_r_e_n_c_e elementAt(_s_i_z_e___t_y_p_e i) const; │ │ │ │ │ -244 }; │ │ │ │ │ -245 │ │ │ │ │ -246 │ │ │ │ │ -250 template │ │ │ │ │ -_2_5_1 class _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r : public │ │ │ │ │ -_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e, │ │ │ │ │ -252 typename A::value_type, │ │ │ │ │ -253 typename A::value_type &, │ │ │ │ │ -254 typename A::difference_type> │ │ │ │ │ -255 { │ │ │ │ │ -256 │ │ │ │ │ -257 friend class _A_r_r_a_y_L_i_s_t; │ │ │ │ │ -258 friend class _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -259 public: │ │ │ │ │ -_2_6_3 typedef typename A::value_type _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ -264 │ │ │ │ │ -_2_6_5 typedef typename A::difference_type _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ -266 │ │ │ │ │ -_2_6_7 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -268 │ │ │ │ │ -_2_6_9 using _r_e_f_e_r_e_n_c_e = typename A::value_type &; │ │ │ │ │ -270 │ │ │ │ │ -_2_7_1 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = typename A::value_type const&; │ │ │ │ │ -272 │ │ │ │ │ -_2_7_8 constexpr static int _c_h_u_n_k_S_i_z_e__ = (N > 0) ? N : 1; │ │ │ │ │ -279 │ │ │ │ │ -280 │ │ │ │ │ -286 inline bool _e_q_u_a_l_s(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const; │ │ │ │ │ -287 │ │ │ │ │ -293 inline bool _e_q_u_a_l_s(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) │ │ │ │ │ -const; │ │ │ │ │ -294 │ │ │ │ │ -298 inline void _i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -299 │ │ │ │ │ -303 inline void _d_e_c_r_e_m_e_n_t(); │ │ │ │ │ -304 │ │ │ │ │ -309 inline _r_e_f_e_r_e_n_c_e _e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const; │ │ │ │ │ -310 │ │ │ │ │ -315 inline _r_e_f_e_r_e_n_c_e _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ │ -316 │ │ │ │ │ -328 inline void _e_r_a_s_e_T_o_H_e_r_e(); │ │ │ │ │ -329 │ │ │ │ │ -_3_3_1 inline _s_i_z_e___t_y_p_e _p_o_s_i_t_i_o_n(){return position_;} │ │ │ │ │ -332 │ │ │ │ │ -334 inline void _a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n); │ │ │ │ │ -335 │ │ │ │ │ -337 inline _d_i_f_f_e_r_e_n_c_e___t_y_p_e _d_i_s_t_a_n_c_e_T_o(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other) │ │ │ │ │ -const; │ │ │ │ │ -338 │ │ │ │ │ -_3_4_0 inline _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r() : position_(0), list_(nullptr) │ │ │ │ │ -341 {} │ │ │ │ │ -342 │ │ │ │ │ -343 private: │ │ │ │ │ -349 inline _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(_A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>& arrayList, _s_i_z_e___t_y_p_e _p_o_s_i_t_i_o_n); │ │ │ │ │ -350 │ │ │ │ │ -354 _s_i_z_e___t_y_p_e position_; │ │ │ │ │ -_3_5_8 _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>* list_; │ │ │ │ │ -359 }; │ │ │ │ │ -360 │ │ │ │ │ -364 template │ │ │ │ │ -_3_6_5 class _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -366 : public _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e, │ │ │ │ │ -367 const typename A::value_type, │ │ │ │ │ -368 typename A::value_type const&, │ │ │ │ │ -369 typename A::difference_type> │ │ │ │ │ -370 { │ │ │ │ │ -371 │ │ │ │ │ -372 friend class _A_r_r_a_y_L_i_s_t; │ │ │ │ │ -373 friend class _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -374 │ │ │ │ │ -375 public: │ │ │ │ │ -_3_7_9 typedef typename A::value_type _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ -380 │ │ │ │ │ -_3_8_1 typedef typename A::difference_type _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ -382 │ │ │ │ │ -_3_8_3 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -384 │ │ │ │ │ -_3_8_5 using _r_e_f_e_r_e_n_c_e = typename A::value_type &; │ │ │ │ │ -386 │ │ │ │ │ -_3_8_7 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = typename A::value_type const&; │ │ │ │ │ -388 │ │ │ │ │ -_3_9_4 constexpr static int _c_h_u_n_k_S_i_z_e__ = (N > 0) ? N : 1; │ │ │ │ │ -395 │ │ │ │ │ -_4_0_1 inline bool _e_q_u_a_l_s(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) │ │ │ │ │ -const; │ │ │ │ │ -402 │ │ │ │ │ -_4_0_6 inline void _i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -407 │ │ │ │ │ -_4_1_1 inline void _d_e_c_r_e_m_e_n_t(); │ │ │ │ │ -412 │ │ │ │ │ -_4_1_4 inline void _a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n); │ │ │ │ │ -415 │ │ │ │ │ -_4_1_7 inline _d_i_f_f_e_r_e_n_c_e___t_y_p_e _d_i_s_t_a_n_c_e_T_o(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& │ │ │ │ │ -other) const; │ │ │ │ │ -418 │ │ │ │ │ -_4_2_3 inline _c_o_n_s_t___r_e_f_e_r_e_n_c_e _e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const; │ │ │ │ │ -424 │ │ │ │ │ -_4_2_9 inline _c_o_n_s_t___r_e_f_e_r_e_n_c_e _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ │ -430 │ │ │ │ │ -_4_3_1 inline _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r() : position_(0), list_(nullptr) │ │ │ │ │ -432 {} │ │ │ │ │ -433 │ │ │ │ │ -_4_3_4 inline _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other); │ │ │ │ │ -435 │ │ │ │ │ -436 private: │ │ │ │ │ -437 │ │ │ │ │ -443 inline _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>& arrayList, _s_i_z_e___t_y_p_e │ │ │ │ │ -position); │ │ │ │ │ -444 │ │ │ │ │ -448 _s_i_z_e___t_y_p_e position_; │ │ │ │ │ -452 const _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>* list_; │ │ │ │ │ -453 }; │ │ │ │ │ -454 │ │ │ │ │ -455 │ │ │ │ │ -456 template │ │ │ │ │ -_4_5_7 _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_A_r_r_a_y_L_i_s_t() │ │ │ │ │ -458 : capacity_(0), size_(0), start_(0) │ │ │ │ │ -459 { │ │ │ │ │ -460 chunks_.reserve(100); │ │ │ │ │ -461 } │ │ │ │ │ -462 │ │ │ │ │ -463 template │ │ │ │ │ -_4_6_4 void _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_c_l_e_a_r(){ │ │ │ │ │ -465 capacity_=0; │ │ │ │ │ -466 size_=0; │ │ │ │ │ -467 start_=0; │ │ │ │ │ -468 chunks_.clear(); │ │ │ │ │ -469 } │ │ │ │ │ -470 │ │ │ │ │ -471 template │ │ │ │ │ -_4_7_2 size_t _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_s_i_z_e() const │ │ │ │ │ -473 { │ │ │ │ │ -474 return size_; │ │ │ │ │ -475 } │ │ │ │ │ -476 │ │ │ │ │ -477 template │ │ │ │ │ -_4_7_8 void _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_p_u_s_h___b_a_c_k(_c_o_n_s_t___r_e_f_e_r_e_n_c_e entry) │ │ │ │ │ -479 { │ │ │ │ │ -480 size_t index=start_+size_; │ │ │ │ │ -481 if(index==capacity_) │ │ │ │ │ -482 { │ │ │ │ │ -483 chunks_.push_back(std::make_shared >()); │ │ │ │ │ -484 capacity_ += chunkSize_; │ │ │ │ │ -485 } │ │ │ │ │ -486 elementAt(index)=entry; │ │ │ │ │ -487 ++size_; │ │ │ │ │ -488 } │ │ │ │ │ -489 │ │ │ │ │ -490 template │ │ │ │ │ -_4_9_1 typename _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e │ │ │ │ │ -i) │ │ │ │ │ -492 { │ │ │ │ │ -493 return elementAt(start_+i); │ │ │ │ │ -494 } │ │ │ │ │ -495 │ │ │ │ │ -496 │ │ │ │ │ -497 template │ │ │ │ │ -_4_9_8 typename _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -499 { │ │ │ │ │ -500 return elementAt(start_+i); │ │ │ │ │ -501 } │ │ │ │ │ -502 │ │ │ │ │ -503 template │ │ │ │ │ -504 typename _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_e_l_e_m_e_n_t_A_t(size_type │ │ │ │ │ -i) │ │ │ │ │ -505 { │ │ │ │ │ -506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_); │ │ │ │ │ -507 } │ │ │ │ │ -508 │ │ │ │ │ -509 │ │ │ │ │ -510 template │ │ │ │ │ -511 typename ArrayList::const_reference ArrayList::elementAt │ │ │ │ │ -(size_type i) const │ │ │ │ │ -512 { │ │ │ │ │ -513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_); │ │ │ │ │ -514 } │ │ │ │ │ -515 │ │ │ │ │ -516 template │ │ │ │ │ -_5_1_7 _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_b_e_g_i_n() │ │ │ │ │ -518 { │ │ │ │ │ -519 return _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_); │ │ │ │ │ -520 } │ │ │ │ │ -521 │ │ │ │ │ -522 template │ │ │ │ │ -_5_2_3 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_b_e_g_i_n() const │ │ │ │ │ -524 { │ │ │ │ │ -525 return _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_); │ │ │ │ │ -526 } │ │ │ │ │ -527 │ │ │ │ │ -528 template │ │ │ │ │ -_5_2_9 _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_e_n_d() │ │ │ │ │ -530 { │ │ │ │ │ -531 return _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_+size_); │ │ │ │ │ -532 } │ │ │ │ │ -533 │ │ │ │ │ -534 template │ │ │ │ │ -_5_3_5 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_e_n_d() const │ │ │ │ │ -536 { │ │ │ │ │ -537 return _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_+size_); │ │ │ │ │ -538 } │ │ │ │ │ -539 │ │ │ │ │ -540 template │ │ │ │ │ -_5_4_1 void _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_p_u_r_g_e() │ │ │ │ │ -542 { │ │ │ │ │ -543 // Distance to copy to the left. │ │ │ │ │ -544 size_t distance = start_/chunkSize_; │ │ │ │ │ -545 if(distance>0) { │ │ │ │ │ -546 // Number of chunks with entries in it; │ │ │ │ │ -547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ ); │ │ │ │ │ -548 │ │ │ │ │ -549 // Copy chunks to the left. │ │ │ │ │ -550 std::copy(chunks_.begin()+distance, │ │ │ │ │ -551 chunks_.begin()+(distance+chunks), chunks_.begin()); │ │ │ │ │ -552 │ │ │ │ │ -553 // Calculate new parameters │ │ │ │ │ -554 start_ = start_ % chunkSize_; │ │ │ │ │ -555 //capacity += distance * chunkSize_; │ │ │ │ │ -556 } │ │ │ │ │ -557 } │ │ │ │ │ -558 │ │ │ │ │ -559 template │ │ │ │ │ -_5_6_0 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e i) │ │ │ │ │ -561 { │ │ │ │ │ -562 position_+=i; │ │ │ │ │ -563 } │ │ │ │ │ -564 │ │ │ │ │ -565 template │ │ │ │ │ -_5_6_6 void _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e i) │ │ │ │ │ -567 { │ │ │ │ │ -568 position_+=i; │ │ │ │ │ -569 } │ │ │ │ │ -570 │ │ │ │ │ -571 │ │ │ │ │ -572 template │ │ │ │ │ -_5_7_3 bool _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_q_u_a_l_s(const │ │ │ │ │ -_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const │ │ │ │ │ -574 { │ │ │ │ │ -575 // Makes only sense if we reference a common list │ │ │ │ │ -576 assert(list_==(other.list_)); │ │ │ │ │ -577 return position_==other.position_ ; │ │ │ │ │ -578 } │ │ │ │ │ -579 │ │ │ │ │ -580 │ │ │ │ │ -581 template │ │ │ │ │ -_5_8_2 bool _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_q_u_a_l_s(const │ │ │ │ │ -_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const │ │ │ │ │ -583 { │ │ │ │ │ -584 // Makes only sense if we reference a common list │ │ │ │ │ -585 assert(list_==(other.list_)); │ │ │ │ │ -586 return position_==other.position_ ; │ │ │ │ │ -587 } │ │ │ │ │ -588 │ │ │ │ │ -589 │ │ │ │ │ -590 template │ │ │ │ │ -_5_9_1 bool _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_q_u_a_l_s(const │ │ │ │ │ -_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const │ │ │ │ │ -592 { │ │ │ │ │ -593 // Makes only sense if we reference a common list │ │ │ │ │ -594 assert(list_==(other.list_)); │ │ │ │ │ -595 return position_==other.position_ ; │ │ │ │ │ -596 } │ │ │ │ │ -597 │ │ │ │ │ -598 template │ │ │ │ │ -_5_9_9 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_i_n_c_r_e_m_e_n_t() │ │ │ │ │ -600 { │ │ │ │ │ -601 ++position_; │ │ │ │ │ -602 } │ │ │ │ │ -603 │ │ │ │ │ -604 template │ │ │ │ │ -_6_0_5 void _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_i_n_c_r_e_m_e_n_t() │ │ │ │ │ -606 { │ │ │ │ │ -607 ++position_; │ │ │ │ │ -608 } │ │ │ │ │ -609 │ │ │ │ │ -610 template │ │ │ │ │ -_6_1_1 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_e_c_r_e_m_e_n_t() │ │ │ │ │ -612 { │ │ │ │ │ -613 --position_; │ │ │ │ │ -614 } │ │ │ │ │ -615 │ │ │ │ │ -616 template │ │ │ │ │ -_6_1_7 void _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_e_c_r_e_m_e_n_t() │ │ │ │ │ -618 { │ │ │ │ │ -619 --position_; │ │ │ │ │ -620 } │ │ │ │ │ -621 │ │ │ │ │ -622 template │ │ │ │ │ -_6_2_3 typename _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_: │ │ │ │ │ -_e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -624 { │ │ │ │ │ -625 return list_->elementAt(i+position_); │ │ │ │ │ -626 } │ │ │ │ │ -627 │ │ │ │ │ -628 template │ │ │ │ │ -_6_2_9 typename _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -630 { │ │ │ │ │ -631 return list_->elementAt(i+position_); │ │ │ │ │ -632 } │ │ │ │ │ -633 │ │ │ │ │ -634 template │ │ │ │ │ -_6_3_5 typename _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_: │ │ │ │ │ -_d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ -636 { │ │ │ │ │ -637 return list_->elementAt(position_); │ │ │ │ │ -638 } │ │ │ │ │ -639 │ │ │ │ │ -640 template │ │ │ │ │ -_6_4_1 typename _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ -642 { │ │ │ │ │ -643 return list_->elementAt(position_); │ │ │ │ │ -644 } │ │ │ │ │ -645 │ │ │ │ │ -646 template │ │ │ │ │ -_6_4_7 typename _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_s_t_a_n_c_e_T_o(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other) │ │ │ │ │ -const │ │ │ │ │ -648 { │ │ │ │ │ -649 // Makes only sense if we reference a common list │ │ │ │ │ -650 assert(list_==(other.list_)); │ │ │ │ │ -651 return other.position_ - position_; │ │ │ │ │ -652 } │ │ │ │ │ -653 │ │ │ │ │ -654 template │ │ │ │ │ -_6_5_5 typename _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_s_t_a_n_c_e_T_o(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& │ │ │ │ │ -other) const │ │ │ │ │ -656 { │ │ │ │ │ -657 // Makes only sense if we reference a common list │ │ │ │ │ -658 assert(list_==(other.list_)); │ │ │ │ │ -659 return other.position_ - position_; │ │ │ │ │ -660 } │ │ │ │ │ -661 │ │ │ │ │ -662 template │ │ │ │ │ -_6_6_3 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_r_a_s_e_T_o_H_e_r_e() │ │ │ │ │ -664 { │ │ │ │ │ -665 list_->size_ -= ++position_ - list_->start_; │ │ │ │ │ -666 // chunk number of the new position. │ │ │ │ │ -667 size_t posChunkStart = position_ / chunkSize_; │ │ │ │ │ -668 // number of chunks to deallocate │ │ │ │ │ -669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_) │ │ │ │ │ -670 / chunkSize_; │ │ │ │ │ -671 list_->start_ = position_; │ │ │ │ │ -672 │ │ │ │ │ -673 // Deallocate memory not needed any more. │ │ │ │ │ -674 for(size_t chunk=0; chunkchunks_[posChunkStart].reset(); │ │ │ │ │ -677 } │ │ │ │ │ -678 │ │ │ │ │ -679 // Capacity stays the same as the chunks before us │ │ │ │ │ -680 // are still there. They null pointers. │ │ │ │ │ -681 assert(list_->start_+list_->size_<=list_->capacity_); │ │ │ │ │ -682 } │ │ │ │ │ -683 │ │ │ │ │ -684 template │ │ │ │ │ -685 _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(_A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>& arrayList, │ │ │ │ │ -size_type position) │ │ │ │ │ -686 : position_(position), list_(&arrayList) │ │ │ │ │ -687 {} │ │ │ │ │ -688 │ │ │ │ │ -689 │ │ │ │ │ -690 template │ │ │ │ │ -691 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const │ │ │ │ │ -ArrayList& arrayList, │ │ │ │ │ -692 size_type position) │ │ │ │ │ -693 : position_(position), list_(&arrayList) │ │ │ │ │ -694 {} │ │ │ │ │ -695 │ │ │ │ │ -696 template │ │ │ │ │ -_6_9_7 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const │ │ │ │ │ -_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other) │ │ │ │ │ -698 : position_(other.position_), list_(other.list_) │ │ │ │ │ -699 {} │ │ │ │ │ -700 │ │ │ │ │ -701 │ │ │ │ │ -703} │ │ │ │ │ -704#endif │ │ │ │ │ -_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h │ │ │ │ │ -This file implements iterator facade classes for writing stl conformant │ │ │ │ │ -iterators. │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -reference operator[](size_type i) │ │ │ │ │ -Get the element at specific position. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:491 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ -iterator begin() │ │ │ │ │ -Get an iterator that is positioned at the first element. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:517 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const ArrayListIterator< MemberType, N, A > &other) const │ │ │ │ │ -Comares two iterators. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:573 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -Increment the iterator. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:599 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_s_i_z_e │ │ │ │ │ -size_type size() const │ │ │ │ │ -Get the number of elements in the list. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:472 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstArrayListIterator(const ArrayListIterator< T, N, A > &other) │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:697 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_p_u_r_g_e │ │ │ │ │ -void purge() │ │ │ │ │ -Purge the list. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:541 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ -void decrement() │ │ │ │ │ -decrement the iterator. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:611 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_r_a_s_e_T_o_H_e_r_e │ │ │ │ │ -void eraseToHere() │ │ │ │ │ -Erase all entries before the current position and the one at the current │ │ │ │ │ -position. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:663 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_A_r_r_a_y_L_i_s_t │ │ │ │ │ -ArrayList() │ │ │ │ │ -Constructs an Array list with one chunk. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:457 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -Get a random access iterator that is positioned at the first element. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:523 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -Increment the iterator. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:605 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_e_n_d │ │ │ │ │ -iterator end() │ │ │ │ │ -Get a random access iterator positioned after the last element. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:529 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ -const_reference elementAt(size_type i) const │ │ │ │ │ -Get the value of the list at an arbitrary position. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:629 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -const_reference operator[](size_type i) const │ │ │ │ │ -Get the element at specific position. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:498 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ -void decrement() │ │ │ │ │ -decrement the iterator. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:617 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ -void advance(difference_type n) │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:566 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -Get a random access iterator positioned after the last element. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:535 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ -const_reference dereference() const │ │ │ │ │ -Access the element at the current position. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:641 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_l_e_a_r │ │ │ │ │ -void clear() │ │ │ │ │ -Delete all entries from the list. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:464 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ -reference elementAt(size_type i) const │ │ │ │ │ -Get the value of the list at an arbitrary position. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:623 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const │ │ │ │ │ -Comares to iterators. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:591 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ -void advance(difference_type n) │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other) │ │ │ │ │ -const │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:655 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ -reference dereference() const │ │ │ │ │ -Access the element at the current position. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:635 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ -void push_back(const_reference entry) │ │ │ │ │ -Append an entry to the list. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:478 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:647 │ │ │ │ │ +141 // make this thing a matrix │ │ │ │ │ +_1_4_2 _s_i_z_e___t_y_p_e _m_a_t___r_o_w_s() const { return _data.size(); } │ │ │ │ │ +_1_4_3 _s_i_z_e___t_y_p_e _m_a_t___c_o_l_s() const { │ │ │ │ │ +144 assert(this->_r_o_w_s()); │ │ │ │ │ +145 return _data.front().size(); │ │ │ │ │ +146 } │ │ │ │ │ +_1_4_7 _r_o_w___t_y_p_e & _m_a_t___a_c_c_e_s_s(_s_i_z_e___t_y_p_e i) { │ │ │ │ │ +148 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _data.size()); │ │ │ │ │ +149 return _data[i]; │ │ │ │ │ +150 } │ │ │ │ │ +_1_5_1 const _r_o_w___t_y_p_e & _m_a_t___a_c_c_e_s_s(_s_i_z_e___t_y_p_e i) const { │ │ │ │ │ +152 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _data.size()); │ │ │ │ │ +153 return _data[i]; │ │ │ │ │ +154 } │ │ │ │ │ +155 }; │ │ │ │ │ +156 │ │ │ │ │ +159} // end namespace │ │ │ │ │ +160 │ │ │ │ │ +161#endif │ │ │ │ │ +_d_e_n_s_e_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implements a matrix constructed from a given type representing a field and a │ │ │ │ │ +compile-time given numbe... │ │ │ │ │ +_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ +Macro for wrapping boundary checks. │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_d_y_n_v_e_c_t_o_r_._h_h │ │ │ │ │ +This file implements a dense vector with a dynamic size. │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ +#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ +If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ +nothing. │ │ │ │ │ +DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -A random access iterator for the Dune::ArrayList class. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:255 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_p_o_s_i_t_i_o_n │ │ │ │ │ -size_type position() │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:331 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ -A::value_type MemberType │ │ │ │ │ -The member type. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ArrayListIterator() │ │ │ │ │ -Standard constructor. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:340 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -A::difference_type difference_type │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_h_u_n_k_S_i_z_e__ │ │ │ │ │ -static constexpr int chunkSize_ │ │ │ │ │ -The number of elements in one chunk of the list. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -typename A::value_type const & const_reference │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -typename A::value_type & reference │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:269 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -A constant random access iterator for the Dune::ArrayList class. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:370 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_h_u_n_k_S_i_z_e__ │ │ │ │ │ -static constexpr int chunkSize_ │ │ │ │ │ -The number of elements in one chunk of the list. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:394 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -typename A::value_type & reference │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:385 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstArrayListIterator() │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:431 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ -A::value_type MemberType │ │ │ │ │ -The member type. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:379 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -A::difference_type difference_type │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:381 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -typename A::value_type const & const_reference │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:387 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:383 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t │ │ │ │ │ -A dynamically growing random access list. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:62 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -T value_type │ │ │ │ │ -Value type for stl compliance. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_h_u_n_k_S_i_z_e__ │ │ │ │ │ -static constexpr int chunkSize_ │ │ │ │ │ -The number of elements in one chunk of the list. This has to be at least one. │ │ │ │ │ -The default is 100. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ -const T * const_pointer │ │ │ │ │ -The type of a const pointer to the type we store. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -ArrayListIterator< MemberType, N, A > iterator │ │ │ │ │ -A random access iterator. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:105 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -const T & const_reference │ │ │ │ │ -The type of a const reference to the type we store. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -T & reference │ │ │ │ │ -The type of a reference to the type we store. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:79 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -The size type. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ -T MemberType │ │ │ │ │ -The member type that is stored. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_p_o_i_n_t_e_r │ │ │ │ │ -T * pointer │ │ │ │ │ -The type of a pointer to the type we store. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -ConstArrayListIterator< MemberType, N, A > const_iterator │ │ │ │ │ -A constant random access iterator. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -std::ptrdiff_t difference_type │ │ │ │ │ -The difference type. │ │ │ │ │ -DDeeffiinniittiioonn arraylist.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -Base class for stl conformant forward iterators. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:434 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x │ │ │ │ │ +A dense n x m matrix. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +derived_type & operator=(const RHS &rhs) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:279 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_M │ │ │ │ │ +constexpr size_type M() const │ │ │ │ │ +number of columns │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:703 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +Traits::value_type value_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_o_w_s │ │ │ │ │ +constexpr size_type rows() const │ │ │ │ │ +number of rows │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:709 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_N │ │ │ │ │ +constexpr size_type N() const │ │ │ │ │ +number of rows │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:697 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Traits::size_type size_type │ │ │ │ │ +The type used for the index access and size operation. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ +Construct a matrix with a dynamic size. │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___c_o_l_s │ │ │ │ │ +size_type mat_cols() const │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:143 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ +DynamicMatrix(std::initializer_list< DynamicVector< K > > const &ll) │ │ │ │ │ +Constructor initializing the matrix from a list of vector. │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ +Base::row_type row_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_t_r_a_n_s_p_o_s_e_d │ │ │ │ │ +DynamicMatrix transposed() const │ │ │ │ │ +Return transposed of the matrix as DynamicMatrix. │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:132 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +Base::value_type value_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___a_c_c_e_s_s │ │ │ │ │ +row_type & mat_access(size_type i) │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:147 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Base::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___r_o_w_s │ │ │ │ │ +size_type mat_rows() const │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ +DynamicMatrix(T const &rhs) │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_m_a_t___a_c_c_e_s_s │ │ │ │ │ +const row_type & mat_access(size_type i) const │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_r_e_s_i_z_e │ │ │ │ │ +void resize(size_type r, size_type c, value_type v=value_type()) │ │ │ │ │ +resize matrix to r × c │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:106 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +DynamicMatrix & operator=(T const &rhs) │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ +DynamicMatrix() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x │ │ │ │ │ +DynamicMatrix(size_type r, size_type c, value_type v=value_type()) │ │ │ │ │ +Constructor initializing the whole matrix with a scalar. │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +DynamicMatrix & operator=(T scalar) │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +container_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_o_w___t_y_p_e │ │ │ │ │ +DynamicVector< K > row_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +row_type & row_reference │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +K value_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +DynamicMatrix< K > derived_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +const row_type & const_row_reference │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_c_o_n_t_a_i_n_e_r___t_y_p_e │ │ │ │ │ +std::vector< K > container_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< K >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _K_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< K >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn dynmatrix.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +Construct a vector with a dynamic size. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +T field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +T real_type │ │ │ │ │ +export the type representing the real type of the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn matvectraits.hh:31 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00194.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: binaryfunctions.hh File Reference │ │ │ │ +dune-common: densematrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,40 +71,72 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces
    │ │ │ │ -
    binaryfunctions.hh File Reference
    │ │ │ │ +Namespaces | │ │ │ │ +Functions
    │ │ │ │ +
    densematrix.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    helper classes to provide unique types for standard functions │ │ │ │ +

    Implements a matrix constructed from a given type representing a field and a compile-time given number of rows and columns. │ │ │ │ More...

    │ │ │ │ -
    #include <algorithm>
    │ │ │ │ +
    #include <cmath>
    │ │ │ │ +#include <cstddef>
    │ │ │ │ +#include <iostream>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <utility>
    │ │ │ │ +#include <vector>
    │ │ │ │ +#include <dune/common/boundschecking.hh>
    │ │ │ │ +#include <dune/common/classname.hh>
    │ │ │ │ +#include <dune/common/exceptions.hh>
    │ │ │ │ +#include <dune/common/fvector.hh>
    │ │ │ │ +#include <dune/common/math.hh>
    │ │ │ │ +#include <dune/common/precision.hh>
    │ │ │ │ +#include <dune/common/simd/simd.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │ +#include <dune/common/scalarvectorview.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::Min< Type >
    struct  Dune::FieldTraits< DenseMatrix< M > >
     
    struct  Dune::Max< Type >
    class  Dune::FMatrixError
     Error thrown if operations of a FieldMatrix fail. More...
     
    class  Dune::DenseMatrix< MAT >
     A dense n x m matrix. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::DenseMatrixHelp
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Functions

    template<typename MAT , typename V1 , typename V2 >
    static void Dune::DenseMatrixHelp::multAssign (const DenseMatrix< MAT > &matrix, const DenseVector< V1 > &x, DenseVector< V2 > &ret)
     calculates ret = matrix * x
     
    template<typename MAT >
    std::ostream & Dune::operator<< (std::ostream &s, const DenseMatrix< MAT > &a)
     Sends the matrix to an output stream.
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    helper classes to provide unique types for standard functions

    │ │ │ │ +

    Implements a matrix constructed from a given type representing a field and a compile-time given number of rows and columns.

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,24 +1,57 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -binaryfunctions.hh File Reference │ │ │ │ │ -helper classes to provide unique types for standard functions _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 │ │ │ │ │ +densematrix.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ +Implements a matrix constructed from a given type representing a field and a │ │ │ │ │ +compile-time given number of rows and columns. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_e_c_i_s_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_c_a_l_a_r_v_e_c_t_o_r_v_i_e_w_._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_:_:_M_i_n_<_ _T_y_p_e_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_e_n_s_e_M_a_t_r_i_x_<_ _M_ _>_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_x_<_ _T_y_p_e_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_F_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ │ +  Error thrown if operations of a _F_i_e_l_d_M_a_t_r_i_x fail. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_<_ _M_A_T_ _> │ │ │ │ │ +  A dense n x m matrix. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_H_e_l_p │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ + static void  _D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_A_s_s_i_g_n (const _D_e_n_s_e_M_a_t_r_i_x< MAT > │ │ │ │ │ + &matrix, const _D_e_n_s_e_V_e_c_t_o_r< V1 > &x, _D_e_n_s_e_V_e_c_t_o_r< V2 > &ret) │ │ │ │ │ +  calculates ret = matrix * x │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &s, const _D_e_n_s_e_M_a_t_r_i_x< MAT > &a) │ │ │ │ │ +  Sends the matrix to an output stream. │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -helper classes to provide unique types for standard functions │ │ │ │ │ +Implements a matrix constructed from a given type representing a field and a │ │ │ │ │ +compile-time given number of rows and columns. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00194_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: binaryfunctions.hh Source File │ │ │ │ +dune-common: densematrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,81 +74,1304 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    binaryfunctions.hh
    │ │ │ │ +
    densematrix.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_BINARYFUNCTIONS_HH
    │ │ │ │ -
    6#define DUNE_BINARYFUNCTIONS_HH
    │ │ │ │ +
    5#ifndef DUNE_DENSEMATRIX_HH
    │ │ │ │ +
    6#define DUNE_DENSEMATRIX_HH
    │ │ │ │
    7
    │ │ │ │ -
    12#include <algorithm>
    │ │ │ │ -
    13
    │ │ │ │ -
    14namespace Dune
    │ │ │ │ -
    15{
    │ │ │ │ -
    16 template<typename Type>
    │ │ │ │ -
    │ │ │ │ -
    17 struct Min
    │ │ │ │ -
    18 {
    │ │ │ │ -
    19 using first_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
    │ │ │ │ -
    20
    │ │ │ │ -
    21 using second_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
    │ │ │ │ -
    22
    │ │ │ │ -
    23 using result_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
    │ │ │ │ +
    8#include <cmath>
    │ │ │ │ +
    9#include <cstddef>
    │ │ │ │ +
    10#include <iostream>
    │ │ │ │ +
    11#include <type_traits>
    │ │ │ │ +
    12#include <utility>
    │ │ │ │ +
    13#include <vector>
    │ │ │ │ +
    14
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    19#include <dune/common/math.hh>
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
    24
    │ │ │ │ -
    │ │ │ │ -
    25 Type operator()(const Type& t1, const Type& t2) const
    │ │ │ │ -
    26 {
    │ │ │ │ -
    27 using std::min;
    │ │ │ │ -
    28 return min(t1,t2);
    │ │ │ │ -
    29 }
    │ │ │ │ -
    │ │ │ │ -
    30 };
    │ │ │ │ -
    │ │ │ │ -
    31
    │ │ │ │ -
    32 template<typename Type>
    │ │ │ │ -
    │ │ │ │ -
    33 struct Max
    │ │ │ │ -
    34 {
    │ │ │ │ -
    35 using first_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
    │ │ │ │ +
    25namespace Dune
    │ │ │ │ +
    26{
    │ │ │ │ +
    27
    │ │ │ │ +
    28 template<typename M> class DenseMatrix;
    │ │ │ │ +
    29
    │ │ │ │ +
    30 template<typename M>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    32 {
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    35 };
    │ │ │ │ +
    │ │ │ │
    36
    │ │ │ │ -
    37 using second_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
    │ │ │ │ -
    38
    │ │ │ │ -
    39 using result_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
    │ │ │ │ -
    40
    │ │ │ │ -
    │ │ │ │ -
    41 Type operator()(const Type& t1, const Type& t2) const
    │ │ │ │ -
    42 {
    │ │ │ │ -
    43 using std::max;
    │ │ │ │ -
    44 return max(t1,t2);
    │ │ │ │ -
    45 }
    │ │ │ │ -
    │ │ │ │ -
    46 };
    │ │ │ │ -
    │ │ │ │ -
    47}
    │ │ │ │ -
    48
    │ │ │ │ -
    49#endif
    │ │ │ │ +
    37 template<class K, int N, int M> class FieldMatrix;
    │ │ │ │ +
    38 template<class K, int N> class FieldVector;
    │ │ │ │ +
    39
    │ │ │ │ +
    58 template< class DenseMatrix, class RHS >
    │ │ │ │ + │ │ │ │ +
    60
    │ │ │ │ +
    61#ifndef DOXYGEN
    │ │ │ │ +
    62 namespace Impl
    │ │ │ │ +
    63 {
    │ │ │ │ +
    64
    │ │ │ │ +
    65 template< class DenseMatrix, class RHS, class = void >
    │ │ │ │ + │ │ │ │ +
    67 {};
    │ │ │ │ +
    68
    │ │ │ │ +
    69 template< class DenseMatrix, class RHS >
    │ │ │ │ +
    70 class DenseMatrixAssigner< DenseMatrix, RHS, std::enable_if_t< Dune::IsNumber< RHS >::value > >
    │ │ │ │ +
    71 {
    │ │ │ │ +
    72 public:
    │ │ │ │ +
    73 static void apply ( DenseMatrix &denseMatrix, const RHS &rhs )
    │ │ │ │ +
    74 {
    │ │ │ │ +
    75 typedef typename DenseMatrix::field_type field_type;
    │ │ │ │ +
    76 std::fill( denseMatrix.begin(), denseMatrix.end(), static_cast< field_type >( rhs ) );
    │ │ │ │ +
    77 }
    │ │ │ │ +
    78 };
    │ │ │ │ +
    79
    │ │ │ │ +
    80 template< class DenseMatrix, class RHS >
    │ │ │ │ +
    81 class DenseMatrixAssigner< DenseMatrix, RHS, std::enable_if_t< !std::is_same< typename RHS::const_iterator, void >::value
    │ │ │ │ +
    82 && std::is_convertible< typename RHS::const_iterator::value_type, typename DenseMatrix::iterator::value_type >::value > >
    │ │ │ │ +
    83 {
    │ │ │ │ +
    84 public:
    │ │ │ │ +
    85 static void apply ( DenseMatrix &denseMatrix, const RHS &rhs )
    │ │ │ │ +
    86 {
    │ │ │ │ +
    87 DUNE_ASSERT_BOUNDS(rhs.N() == denseMatrix.N());
    │ │ │ │ +
    88 DUNE_ASSERT_BOUNDS(rhs.M() == denseMatrix.M());
    │ │ │ │ +
    89 typename DenseMatrix::iterator tIt = std::begin(denseMatrix);
    │ │ │ │ +
    90 typename RHS::const_iterator sIt = std::begin(rhs);
    │ │ │ │ +
    91 for(; sIt != std::end(rhs); ++tIt, ++sIt)
    │ │ │ │ +
    92 std::copy(std::begin(*sIt), std::end(*sIt), std::begin(*tIt));
    │ │ │ │ +
    93 }
    │ │ │ │ +
    94 };
    │ │ │ │ +
    95
    │ │ │ │ +
    96 } // namespace Impl
    │ │ │ │ +
    97
    │ │ │ │ +
    98
    │ │ │ │ +
    99
    │ │ │ │ +
    100 template< class DenseMatrix, class RHS >
    │ │ │ │ +
    101 struct DenseMatrixAssigner
    │ │ │ │ +
    102 : public Impl::DenseMatrixAssigner< DenseMatrix, RHS >
    │ │ │ │ +
    103 {};
    │ │ │ │ +
    104
    │ │ │ │ +
    105
    │ │ │ │ +
    106 namespace Impl
    │ │ │ │ +
    107 {
    │ │ │ │ +
    108
    │ │ │ │ +
    109 template< class DenseMatrix, class RHS >
    │ │ │ │ +
    110 std::true_type hasDenseMatrixAssigner ( DenseMatrix &, const RHS &, decltype( Dune::DenseMatrixAssigner< DenseMatrix, RHS >::apply( std::declval< DenseMatrix & >(), std::declval< const RHS & >() ) ) * = nullptr );
    │ │ │ │ +
    111
    │ │ │ │ +
    112 std::false_type hasDenseMatrixAssigner ( ... );
    │ │ │ │ +
    113
    │ │ │ │ +
    114 } // namespace Impl
    │ │ │ │ +
    115
    │ │ │ │ +
    116 template< class DenseMatrix, class RHS >
    │ │ │ │ +
    117 struct HasDenseMatrixAssigner
    │ │ │ │ +
    118 : public decltype( Impl::hasDenseMatrixAssigner( std::declval< DenseMatrix & >(), std::declval< const RHS & >() ) )
    │ │ │ │ +
    119 {};
    │ │ │ │ +
    120
    │ │ │ │ +
    121#endif // #ifndef DOXYGEN
    │ │ │ │ +
    122
    │ │ │ │ +
    123
    │ │ │ │ +
    124
    │ │ │ │ +
    126 class FMatrixError : public MathError {};
    │ │ │ │ +
    127
    │ │ │ │ +
    138 template<typename MAT>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    140 {
    │ │ │ │ + │ │ │ │ +
    142
    │ │ │ │ +
    143 // Curiously recurring template pattern
    │ │ │ │ +
    144 constexpr MAT & asImp() { return static_cast<MAT&>(*this); }
    │ │ │ │ +
    145 constexpr const MAT & asImp() const { return static_cast<const MAT&>(*this); }
    │ │ │ │ +
    146
    │ │ │ │ +
    147 template <class>
    │ │ │ │ +
    148 friend class DenseMatrix;
    │ │ │ │ +
    149
    │ │ │ │ +
    150 public:
    │ │ │ │ +
    151 //===== type definitions and constants
    │ │ │ │ +
    152
    │ │ │ │ +
    154 typedef typename Traits::derived_type derived_type;
    │ │ │ │ +
    155
    │ │ │ │ +
    157 typedef typename Traits::value_type value_type;
    │ │ │ │ +
    158
    │ │ │ │ +
    160 typedef typename Traits::value_type field_type;
    │ │ │ │ +
    161
    │ │ │ │ +
    163 typedef typename Traits::value_type block_type;
    │ │ │ │ +
    164
    │ │ │ │ +
    166 typedef typename Traits::size_type size_type;
    │ │ │ │ +
    167
    │ │ │ │ +
    169 typedef typename Traits::row_type row_type;
    │ │ │ │ +
    170
    │ │ │ │ +
    172 typedef typename Traits::row_reference row_reference;
    │ │ │ │ +
    173
    │ │ │ │ +
    175 typedef typename Traits::const_row_reference const_row_reference;
    │ │ │ │ +
    176
    │ │ │ │ +
    178 constexpr static int blocklevel = 1;
    │ │ │ │ +
    179
    │ │ │ │ +
    180 private:
    │ │ │ │ +
    183 using simd_index_type = Simd::Rebind<std::size_t, value_type>;
    │ │ │ │ +
    184
    │ │ │ │ +
    185 public:
    │ │ │ │ +
    186 //===== access to components
    │ │ │ │ +
    187
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    190 {
    │ │ │ │ +
    191 return asImp().mat_access(i);
    │ │ │ │ +
    192 }
    │ │ │ │ +
    │ │ │ │ +
    193
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    195 {
    │ │ │ │ +
    196 return asImp().mat_access(i);
    │ │ │ │ +
    197 }
    │ │ │ │ +
    │ │ │ │ +
    198
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    201 {
    │ │ │ │ +
    202 return rows();
    │ │ │ │ +
    203 }
    │ │ │ │ +
    │ │ │ │ +
    204
    │ │ │ │ +
    205 //===== iterator interface to rows of the matrix
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    213 typedef typename std::remove_reference<row_reference>::type::Iterator ColIterator;
    │ │ │ │ +
    214
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    217 {
    │ │ │ │ +
    218 return Iterator(*this,0);
    │ │ │ │ +
    219 }
    │ │ │ │ +
    │ │ │ │ +
    220
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    223 {
    │ │ │ │ +
    224 return Iterator(*this,rows());
    │ │ │ │ +
    225 }
    │ │ │ │ +
    │ │ │ │ +
    226
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    230 {
    │ │ │ │ +
    231 return Iterator(*this,rows()-1);
    │ │ │ │ +
    232 }
    │ │ │ │ +
    │ │ │ │ +
    233
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    237 {
    │ │ │ │ +
    238 return Iterator(*this,-1);
    │ │ │ │ +
    239 }
    │ │ │ │ +
    │ │ │ │ +
    240
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    248 typedef typename std::remove_reference<const_row_reference>::type::ConstIterator ConstColIterator;
    │ │ │ │ +
    249
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    252 {
    │ │ │ │ +
    253 return ConstIterator(*this,0);
    │ │ │ │ +
    254 }
    │ │ │ │ +
    │ │ │ │ +
    255
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    258 {
    │ │ │ │ +
    259 return ConstIterator(*this,rows());
    │ │ │ │ +
    260 }
    │ │ │ │ +
    │ │ │ │ +
    261
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    265 {
    │ │ │ │ +
    266 return ConstIterator(*this,rows()-1);
    │ │ │ │ +
    267 }
    │ │ │ │ +
    │ │ │ │ +
    268
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    272 {
    │ │ │ │ +
    273 return ConstIterator(*this,-1);
    │ │ │ │ +
    274 }
    │ │ │ │ +
    │ │ │ │ +
    275
    │ │ │ │ +
    276 //===== assignment
    │ │ │ │ +
    277
    │ │ │ │ +
    278 template< class RHS, class = std::enable_if_t< HasDenseMatrixAssigner< MAT, RHS >::value > >
    │ │ │ │ +
    │ │ │ │ +
    279 derived_type &operator= ( const RHS &rhs )
    │ │ │ │ +
    280 {
    │ │ │ │ + │ │ │ │ +
    282 return asImp();
    │ │ │ │ +
    283 }
    │ │ │ │ +
    │ │ │ │ +
    284
    │ │ │ │ +
    285 //===== vector space arithmetic
    │ │ │ │ +
    286
    │ │ │ │ +
    288 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    290 {
    │ │ │ │ +
    291 DUNE_ASSERT_BOUNDS(rows() == x.rows());
    │ │ │ │ +
    292 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    293 (*this)[i] += x[i];
    │ │ │ │ +
    294 return asImp();
    │ │ │ │ +
    295 }
    │ │ │ │ +
    │ │ │ │ +
    296
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    299 {
    │ │ │ │ +
    300 MAT result;
    │ │ │ │ +
    301 using idx_type = typename decltype(result)::size_type;
    │ │ │ │ +
    302
    │ │ │ │ +
    303 for (idx_type i = 0; i < rows(); ++i)
    │ │ │ │ +
    304 for (idx_type j = 0; j < cols(); ++j)
    │ │ │ │ +
    305 result[i][j] = - asImp()[i][j];
    │ │ │ │ +
    306
    │ │ │ │ +
    307 return result;
    │ │ │ │ +
    308 }
    │ │ │ │ +
    │ │ │ │ +
    309
    │ │ │ │ +
    311 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    313 {
    │ │ │ │ +
    314 DUNE_ASSERT_BOUNDS(rows() == x.rows());
    │ │ │ │ +
    315 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    316 (*this)[i] -= x[i];
    │ │ │ │ +
    317 return asImp();
    │ │ │ │ +
    318 }
    │ │ │ │ +
    │ │ │ │ +
    319
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    322 {
    │ │ │ │ +
    323 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    324 (*this)[i] *= k;
    │ │ │ │ +
    325 return asImp();
    │ │ │ │ +
    326 }
    │ │ │ │ +
    │ │ │ │ +
    327
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    330 {
    │ │ │ │ +
    331 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    332 (*this)[i] /= k;
    │ │ │ │ +
    333 return asImp();
    │ │ │ │ +
    334 }
    │ │ │ │ +
    │ │ │ │ +
    335
    │ │ │ │ +
    337 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    339 {
    │ │ │ │ +
    340 DUNE_ASSERT_BOUNDS(rows() == x.rows());
    │ │ │ │ +
    341 for( size_type i = 0; i < rows(); ++i )
    │ │ │ │ +
    342 (*this)[ i ].axpy( a, x[ i ] );
    │ │ │ │ +
    343 return asImp();
    │ │ │ │ +
    344 }
    │ │ │ │ +
    │ │ │ │ +
    345
    │ │ │ │ +
    347 template <class Other>
    │ │ │ │ +
    │ │ │ │ +
    348 bool operator== (const DenseMatrix<Other>& x) const
    │ │ │ │ +
    349 {
    │ │ │ │ +
    350 DUNE_ASSERT_BOUNDS(rows() == x.rows());
    │ │ │ │ +
    351 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    352 if ((*this)[i]!=x[i])
    │ │ │ │ +
    353 return false;
    │ │ │ │ +
    354 return true;
    │ │ │ │ +
    355 }
    │ │ │ │ +
    │ │ │ │ +
    357 template <class Other>
    │ │ │ │ +
    │ │ │ │ +
    358 bool operator!= (const DenseMatrix<Other>& x) const
    │ │ │ │ +
    359 {
    │ │ │ │ +
    360 return !operator==(x);
    │ │ │ │ +
    361 }
    │ │ │ │ +
    │ │ │ │ +
    362
    │ │ │ │ +
    363
    │ │ │ │ +
    364 //===== linear maps
    │ │ │ │ +
    365
    │ │ │ │ +
    367 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    368 void mv (const X& x, Y& y) const
    │ │ │ │ +
    369 {
    │ │ │ │ +
    370 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    371 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    372 DUNE_ASSERT_BOUNDS((void*)(&x) != (void*)(&y));
    │ │ │ │ +
    373 DUNE_ASSERT_BOUNDS(xx.N() == M());
    │ │ │ │ +
    374 DUNE_ASSERT_BOUNDS(yy.N() == N());
    │ │ │ │ +
    375
    │ │ │ │ +
    376 using y_field_type = typename FieldTraits<Y>::field_type;
    │ │ │ │ +
    377 for (size_type i=0; i<rows(); ++i)
    │ │ │ │ +
    378 {
    │ │ │ │ +
    379 yy[i] = y_field_type(0);
    │ │ │ │ +
    380 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    381 yy[i] += (*this)[i][j] * xx[j];
    │ │ │ │ +
    382 }
    │ │ │ │ +
    383 }
    │ │ │ │ +
    │ │ │ │ +
    384
    │ │ │ │ +
    386 template< class X, class Y >
    │ │ │ │ +
    │ │ │ │ +
    387 void mtv ( const X &x, Y &y ) const
    │ │ │ │ +
    388 {
    │ │ │ │ +
    389 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    390 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    391 DUNE_ASSERT_BOUNDS((void*)(&x) != (void*)(&y));
    │ │ │ │ +
    392 DUNE_ASSERT_BOUNDS(xx.N() == N());
    │ │ │ │ +
    393 DUNE_ASSERT_BOUNDS(yy.N() == M());
    │ │ │ │ +
    394
    │ │ │ │ +
    395 using y_field_type = typename FieldTraits<Y>::field_type;
    │ │ │ │ +
    396 for(size_type i = 0; i < cols(); ++i)
    │ │ │ │ +
    397 {
    │ │ │ │ +
    398 yy[i] = y_field_type(0);
    │ │ │ │ +
    399 for(size_type j = 0; j < rows(); ++j)
    │ │ │ │ +
    400 yy[i] += (*this)[j][i] * xx[j];
    │ │ │ │ +
    401 }
    │ │ │ │ +
    402 }
    │ │ │ │ +
    │ │ │ │ +
    403
    │ │ │ │ +
    405 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    406 void umv (const X& x, Y& y) const
    │ │ │ │ +
    407 {
    │ │ │ │ +
    408 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    409 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    410 DUNE_ASSERT_BOUNDS(xx.N() == M());
    │ │ │ │ +
    411 DUNE_ASSERT_BOUNDS(yy.N() == N());
    │ │ │ │ +
    412 for (size_type i=0; i<rows(); ++i)
    │ │ │ │ +
    413 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    414 yy[i] += (*this)[i][j] * xx[j];
    │ │ │ │ +
    415 }
    │ │ │ │ +
    │ │ │ │ +
    416
    │ │ │ │ +
    418 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    419 void umtv (const X& x, Y& y) const
    │ │ │ │ +
    420 {
    │ │ │ │ +
    421 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    422 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    423 DUNE_ASSERT_BOUNDS(xx.N() == N());
    │ │ │ │ +
    424 DUNE_ASSERT_BOUNDS(yy.N() == M());
    │ │ │ │ +
    425 for(size_type i = 0; i<rows(); ++i)
    │ │ │ │ +
    426 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    427 yy[j] += (*this)[i][j]*xx[i];
    │ │ │ │ +
    428 }
    │ │ │ │ +
    │ │ │ │ +
    429
    │ │ │ │ +
    431 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    432 void umhv (const X& x, Y& y) const
    │ │ │ │ +
    433 {
    │ │ │ │ +
    434 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    435 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    436 DUNE_ASSERT_BOUNDS(xx.N() == N());
    │ │ │ │ +
    437 DUNE_ASSERT_BOUNDS(yy.N() == M());
    │ │ │ │ +
    438 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    439 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    440 yy[j] += conjugateComplex((*this)[i][j])*xx[i];
    │ │ │ │ +
    441 }
    │ │ │ │ +
    │ │ │ │ +
    442
    │ │ │ │ +
    444 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    445 void mmv (const X& x, Y& y) const
    │ │ │ │ +
    446 {
    │ │ │ │ +
    447 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    448 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    449 DUNE_ASSERT_BOUNDS(xx.N() == M());
    │ │ │ │ +
    450 DUNE_ASSERT_BOUNDS(yy.N() == N());
    │ │ │ │ +
    451 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    452 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    453 yy[i] -= (*this)[i][j] * xx[j];
    │ │ │ │ +
    454 }
    │ │ │ │ +
    │ │ │ │ +
    455
    │ │ │ │ +
    457 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    458 void mmtv (const X& x, Y& y) const
    │ │ │ │ +
    459 {
    │ │ │ │ +
    460 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    461 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    462 DUNE_ASSERT_BOUNDS(xx.N() == N());
    │ │ │ │ +
    463 DUNE_ASSERT_BOUNDS(yy.N() == M());
    │ │ │ │ +
    464 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    465 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    466 yy[j] -= (*this)[i][j]*xx[i];
    │ │ │ │ +
    467 }
    │ │ │ │ +
    │ │ │ │ +
    468
    │ │ │ │ +
    470 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    471 void mmhv (const X& x, Y& y) const
    │ │ │ │ +
    472 {
    │ │ │ │ +
    473 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    474 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    475 DUNE_ASSERT_BOUNDS(xx.N() == N());
    │ │ │ │ +
    476 DUNE_ASSERT_BOUNDS(yy.N() == M());
    │ │ │ │ +
    477 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    478 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    479 yy[j] -= conjugateComplex((*this)[i][j])*xx[i];
    │ │ │ │ +
    480 }
    │ │ │ │ +
    │ │ │ │ +
    481
    │ │ │ │ +
    483 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    484 void usmv (const typename FieldTraits<Y>::field_type & alpha,
    │ │ │ │ +
    485 const X& x, Y& y) const
    │ │ │ │ +
    486 {
    │ │ │ │ +
    487 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    488 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    489 DUNE_ASSERT_BOUNDS(xx.N() == M());
    │ │ │ │ +
    490 DUNE_ASSERT_BOUNDS(yy.N() == N());
    │ │ │ │ +
    491 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    492 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    493 yy[i] += alpha * (*this)[i][j] * xx[j];
    │ │ │ │ +
    494 }
    │ │ │ │ +
    │ │ │ │ +
    495
    │ │ │ │ +
    497 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    498 void usmtv (const typename FieldTraits<Y>::field_type & alpha,
    │ │ │ │ +
    499 const X& x, Y& y) const
    │ │ │ │ +
    500 {
    │ │ │ │ +
    501 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    502 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    503 DUNE_ASSERT_BOUNDS(xx.N() == N());
    │ │ │ │ +
    504 DUNE_ASSERT_BOUNDS(yy.N() == M());
    │ │ │ │ +
    505 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    506 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    507 yy[j] += alpha*(*this)[i][j]*xx[i];
    │ │ │ │ +
    508 }
    │ │ │ │ +
    │ │ │ │ +
    509
    │ │ │ │ +
    511 template<class X, class Y>
    │ │ │ │ +
    │ │ │ │ +
    512 void usmhv (const typename FieldTraits<Y>::field_type & alpha,
    │ │ │ │ +
    513 const X& x, Y& y) const
    │ │ │ │ +
    514 {
    │ │ │ │ +
    515 auto&& xx = Impl::asVector(x);
    │ │ │ │ +
    516 auto&& yy = Impl::asVector(y);
    │ │ │ │ +
    517 DUNE_ASSERT_BOUNDS(xx.N() == N());
    │ │ │ │ +
    518 DUNE_ASSERT_BOUNDS(yy.N() == M());
    │ │ │ │ +
    519 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    520 for (size_type j=0; j<cols(); j++)
    │ │ │ │ +
    521 yy[j] +=
    │ │ │ │ +
    522 alpha*conjugateComplex((*this)[i][j])*xx[i];
    │ │ │ │ +
    523 }
    │ │ │ │ +
    │ │ │ │ +
    524
    │ │ │ │ +
    525 //===== norms
    │ │ │ │ +
    526
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    529 {
    │ │ │ │ +
    530 typename FieldTraits<value_type>::real_type sum=(0.0);
    │ │ │ │ +
    531 for (size_type i=0; i<rows(); ++i) sum += (*this)[i].two_norm2();
    │ │ │ │ +
    532 return fvmeta::sqrt(sum);
    │ │ │ │ +
    533 }
    │ │ │ │ +
    │ │ │ │ +
    534
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    537 {
    │ │ │ │ +
    538 typename FieldTraits<value_type>::real_type sum=(0.0);
    │ │ │ │ +
    539 for (size_type i=0; i<rows(); ++i) sum += (*this)[i].two_norm2();
    │ │ │ │ +
    540 return sum;
    │ │ │ │ +
    541 }
    │ │ │ │ +
    │ │ │ │ +
    542
    │ │ │ │ +
    544 template <typename vt = value_type,
    │ │ │ │ +
    545 typename std::enable_if<!HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    547 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    548 using std::max;
    │ │ │ │ +
    549
    │ │ │ │ +
    550 real_type norm = 0;
    │ │ │ │ +
    551 for (auto const &x : *this) {
    │ │ │ │ +
    552 real_type const a = x.one_norm();
    │ │ │ │ +
    553 norm = max(a, norm);
    │ │ │ │ +
    554 }
    │ │ │ │ +
    555 return norm;
    │ │ │ │ +
    556 }
    │ │ │ │ +
    │ │ │ │ +
    557
    │ │ │ │ +
    559 template <typename vt = value_type,
    │ │ │ │ +
    560 typename std::enable_if<!HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    562 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    563 using std::max;
    │ │ │ │ +
    564
    │ │ │ │ +
    565 real_type norm = 0;
    │ │ │ │ +
    566 for (auto const &x : *this) {
    │ │ │ │ +
    567 real_type const a = x.one_norm_real();
    │ │ │ │ +
    568 norm = max(a, norm);
    │ │ │ │ +
    569 }
    │ │ │ │ +
    570 return norm;
    │ │ │ │ +
    571 }
    │ │ │ │ +
    │ │ │ │ +
    572
    │ │ │ │ +
    574 template <typename vt = value_type,
    │ │ │ │ +
    575 typename std::enable_if<HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    577 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    578 using std::max;
    │ │ │ │ +
    579
    │ │ │ │ +
    580 real_type norm = 0;
    │ │ │ │ +
    581 real_type isNaN = 1;
    │ │ │ │ +
    582 for (auto const &x : *this) {
    │ │ │ │ +
    583 real_type const a = x.one_norm();
    │ │ │ │ +
    584 norm = max(a, norm);
    │ │ │ │ +
    585 isNaN += a;
    │ │ │ │ +
    586 }
    │ │ │ │ +
    587 return norm * (isNaN / isNaN);
    │ │ │ │ +
    588 }
    │ │ │ │ +
    │ │ │ │ +
    589
    │ │ │ │ +
    591 template <typename vt = value_type,
    │ │ │ │ +
    592 typename std::enable_if<HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    594 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    595 using std::max;
    │ │ │ │ +
    596
    │ │ │ │ +
    597 real_type norm = 0;
    │ │ │ │ +
    598 real_type isNaN = 1;
    │ │ │ │ +
    599 for (auto const &x : *this) {
    │ │ │ │ +
    600 real_type const a = x.one_norm_real();
    │ │ │ │ +
    601 norm = max(a, norm);
    │ │ │ │ +
    602 isNaN += a;
    │ │ │ │ +
    603 }
    │ │ │ │ +
    604 return norm * (isNaN / isNaN);
    │ │ │ │ +
    605 }
    │ │ │ │ +
    │ │ │ │ +
    606
    │ │ │ │ +
    607 //===== solve
    │ │ │ │ +
    608
    │ │ │ │ +
    613 template <class V1, class V2>
    │ │ │ │ +
    614 void solve (V1& x, const V2& b, bool doPivoting = true) const;
    │ │ │ │ +
    615
    │ │ │ │ +
    620 void invert(bool doPivoting = true);
    │ │ │ │ +
    621
    │ │ │ │ +
    623 field_type determinant (bool doPivoting = true) const;
    │ │ │ │ +
    624
    │ │ │ │ +
    626 template<typename M2>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    628 {
    │ │ │ │ +
    629 DUNE_ASSERT_BOUNDS(M.rows() == M.cols());
    │ │ │ │ +
    630 DUNE_ASSERT_BOUNDS(M.rows() == rows());
    │ │ │ │ +
    631 AutonomousValue<MAT> C(asImp());
    │ │ │ │ +
    632
    │ │ │ │ +
    633 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    634 for (size_type j=0; j<cols(); j++) {
    │ │ │ │ +
    635 (*this)[i][j] = 0;
    │ │ │ │ +
    636 for (size_type k=0; k<rows(); k++)
    │ │ │ │ +
    637 (*this)[i][j] += M[i][k]*C[k][j];
    │ │ │ │ +
    638 }
    │ │ │ │ +
    639
    │ │ │ │ +
    640 return asImp();
    │ │ │ │ +
    641 }
    │ │ │ │ +
    │ │ │ │ +
    642
    │ │ │ │ +
    644 template<typename M2>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    646 {
    │ │ │ │ +
    647 DUNE_ASSERT_BOUNDS(M.rows() == M.cols());
    │ │ │ │ +
    648 DUNE_ASSERT_BOUNDS(M.cols() == cols());
    │ │ │ │ +
    649 AutonomousValue<MAT> C(asImp());
    │ │ │ │ +
    650
    │ │ │ │ +
    651 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    652 for (size_type j=0; j<cols(); j++) {
    │ │ │ │ +
    653 (*this)[i][j] = 0;
    │ │ │ │ +
    654 for (size_type k=0; k<cols(); k++)
    │ │ │ │ +
    655 (*this)[i][j] += C[i][k]*M[k][j];
    │ │ │ │ +
    656 }
    │ │ │ │ +
    657 return asImp();
    │ │ │ │ +
    658 }
    │ │ │ │ +
    │ │ │ │ +
    659
    │ │ │ │ +
    660#if 0
    │ │ │ │ +
    662 template<int l>
    │ │ │ │ +
    663 DenseMatrix<K,l,cols> leftmultiplyany (const FieldMatrix<K,l,rows>& M) const
    │ │ │ │ +
    664 {
    │ │ │ │ + │ │ │ │ +
    666
    │ │ │ │ +
    667 for (size_type i=0; i<l; i++) {
    │ │ │ │ +
    668 for (size_type j=0; j<cols(); j++) {
    │ │ │ │ +
    669 C[i][j] = 0;
    │ │ │ │ +
    670 for (size_type k=0; k<rows(); k++)
    │ │ │ │ +
    671 C[i][j] += M[i][k]*(*this)[k][j];
    │ │ │ │ +
    672 }
    │ │ │ │ +
    673 }
    │ │ │ │ +
    674 return C;
    │ │ │ │ +
    675 }
    │ │ │ │ +
    676
    │ │ │ │ +
    678 template<int l>
    │ │ │ │ +
    679 FieldMatrix<K,rows,l> rightmultiplyany (const FieldMatrix<K,cols,l>& M) const
    │ │ │ │ +
    680 {
    │ │ │ │ +
    681 FieldMatrix<K,rows,l> C;
    │ │ │ │ +
    682
    │ │ │ │ +
    683 for (size_type i=0; i<rows(); i++) {
    │ │ │ │ +
    684 for (size_type j=0; j<l; j++) {
    │ │ │ │ +
    685 C[i][j] = 0;
    │ │ │ │ +
    686 for (size_type k=0; k<cols(); k++)
    │ │ │ │ +
    687 C[i][j] += (*this)[i][k]*M[k][j];
    │ │ │ │ +
    688 }
    │ │ │ │ +
    689 }
    │ │ │ │ +
    690 return C;
    │ │ │ │ +
    691 }
    │ │ │ │ +
    692#endif
    │ │ │ │ +
    693
    │ │ │ │ +
    694 //===== sizes
    │ │ │ │ +
    695
    │ │ │ │ +
    │ │ │ │ +
    697 constexpr size_type N () const
    │ │ │ │ +
    698 {
    │ │ │ │ +
    699 return rows();
    │ │ │ │ +
    700 }
    │ │ │ │ +
    │ │ │ │ +
    701
    │ │ │ │ +
    │ │ │ │ +
    703 constexpr size_type M () const
    │ │ │ │ +
    704 {
    │ │ │ │ +
    705 return cols();
    │ │ │ │ +
    706 }
    │ │ │ │ +
    │ │ │ │ +
    707
    │ │ │ │ +
    │ │ │ │ +
    709 constexpr size_type rows() const
    │ │ │ │ +
    710 {
    │ │ │ │ +
    711 return asImp().mat_rows();
    │ │ │ │ +
    712 }
    │ │ │ │ +
    │ │ │ │ +
    713
    │ │ │ │ +
    │ │ │ │ +
    715 constexpr size_type cols() const
    │ │ │ │ +
    716 {
    │ │ │ │ +
    717 return asImp().mat_cols();
    │ │ │ │ +
    718 }
    │ │ │ │ +
    │ │ │ │ +
    719
    │ │ │ │ +
    720 //===== query
    │ │ │ │ +
    721
    │ │ │ │ +
    │ │ │ │ +
    723 bool exists ([[maybe_unused]] size_type i, [[maybe_unused]] size_type j) const
    │ │ │ │ +
    724 {
    │ │ │ │ +
    725 DUNE_ASSERT_BOUNDS(i >= 0 && i < rows());
    │ │ │ │ +
    726 DUNE_ASSERT_BOUNDS(j >= 0 && j < cols());
    │ │ │ │ +
    727 return true;
    │ │ │ │ +
    728 }
    │ │ │ │ +
    │ │ │ │ +
    729
    │ │ │ │ +
    730 protected:
    │ │ │ │ +
    731
    │ │ │ │ +
    732#ifndef DOXYGEN
    │ │ │ │ +
    733 struct ElimPivot
    │ │ │ │ +
    734 {
    │ │ │ │ +
    735 ElimPivot(std::vector<simd_index_type> & pivot);
    │ │ │ │ +
    736
    │ │ │ │ +
    737 void swap(std::size_t i, simd_index_type j);
    │ │ │ │ +
    738
    │ │ │ │ +
    739 template<typename T>
    │ │ │ │ +
    740 void operator()(const T&, int, int)
    │ │ │ │ +
    741 {}
    │ │ │ │ +
    742
    │ │ │ │ +
    743 std::vector<simd_index_type> & pivot_;
    │ │ │ │ +
    744 };
    │ │ │ │ +
    745
    │ │ │ │ +
    746 template<typename V>
    │ │ │ │ +
    747 struct Elim
    │ │ │ │ +
    748 {
    │ │ │ │ +
    749 Elim(V& rhs);
    │ │ │ │ +
    750
    │ │ │ │ +
    751 void swap(std::size_t i, simd_index_type j);
    │ │ │ │ +
    752
    │ │ │ │ +
    753 void operator()(const typename V::field_type& factor, int k, int i);
    │ │ │ │ +
    754
    │ │ │ │ +
    755 V* rhs_;
    │ │ │ │ +
    756 };
    │ │ │ │ +
    757
    │ │ │ │ +
    758 struct ElimDet
    │ │ │ │ +
    759 {
    │ │ │ │ +
    760 ElimDet(field_type& sign) : sign_(sign)
    │ │ │ │ +
    761 { sign_ = 1; }
    │ │ │ │ +
    762
    │ │ │ │ +
    763 void swap(std::size_t i, simd_index_type j)
    │ │ │ │ +
    764 {
    │ │ │ │ +
    765 sign_ *=
    │ │ │ │ +
    766 Simd::cond(simd_index_type(i) == j, field_type(1), field_type(-1));
    │ │ │ │ +
    767 }
    │ │ │ │ +
    768
    │ │ │ │ +
    769 void operator()(const field_type&, int, int)
    │ │ │ │ +
    770 {}
    │ │ │ │ +
    771
    │ │ │ │ +
    772 field_type& sign_;
    │ │ │ │ +
    773 };
    │ │ │ │ +
    774#endif // DOXYGEN
    │ │ │ │ +
    775
    │ │ │ │ +
    777
    │ │ │ │ +
    815 template<class Func, class Mask>
    │ │ │ │ +
    816 static void luDecomposition(DenseMatrix<MAT>& A, Func func,
    │ │ │ │ +
    817 Mask &nonsingularLanes, bool throwEarly, bool doPivoting);
    │ │ │ │ +
    818 };
    │ │ │ │ +
    │ │ │ │ +
    819
    │ │ │ │ +
    820#ifndef DOXYGEN
    │ │ │ │ +
    821 template<typename MAT>
    │ │ │ │ +
    822 DenseMatrix<MAT>::ElimPivot::ElimPivot(std::vector<simd_index_type> & pivot)
    │ │ │ │ +
    823 : pivot_(pivot)
    │ │ │ │ +
    824 {
    │ │ │ │ +
    825 typedef typename std::vector<size_type>::size_type size_type;
    │ │ │ │ +
    826 for(size_type i=0; i < pivot_.size(); ++i) pivot_[i]=i;
    │ │ │ │ +
    827 }
    │ │ │ │ +
    828
    │ │ │ │ +
    829 template<typename MAT>
    │ │ │ │ +
    830 void DenseMatrix<MAT>::ElimPivot::swap(std::size_t i, simd_index_type j)
    │ │ │ │ +
    831 {
    │ │ │ │ +
    832 pivot_[i] =
    │ │ │ │ +
    833 Simd::cond(Simd::Scalar<simd_index_type>(i) == j, pivot_[i], j);
    │ │ │ │ +
    834 }
    │ │ │ │ +
    835
    │ │ │ │ +
    836 template<typename MAT>
    │ │ │ │ +
    837 template<typename V>
    │ │ │ │ +
    838 DenseMatrix<MAT>::Elim<V>::Elim(V& rhs)
    │ │ │ │ +
    839 : rhs_(&rhs)
    │ │ │ │ +
    840 {}
    │ │ │ │ +
    841
    │ │ │ │ +
    842 template<typename MAT>
    │ │ │ │ +
    843 template<typename V>
    │ │ │ │ +
    844 void DenseMatrix<MAT>::Elim<V>::swap(std::size_t i, simd_index_type j)
    │ │ │ │ +
    845 {
    │ │ │ │ +
    846 using std::swap;
    │ │ │ │ +
    847
    │ │ │ │ +
    848 // see the comment in luDecomposition()
    │ │ │ │ +
    849 for(std::size_t l = 0; l < Simd::lanes(j); ++l)
    │ │ │ │ +
    850 swap(Simd::lane(l, (*rhs_)[ i ]),
    │ │ │ │ +
    851 Simd::lane(l, (*rhs_)[Simd::lane(l, j)]));
    │ │ │ │ +
    852 }
    │ │ │ │ +
    853
    │ │ │ │ +
    854 template<typename MAT>
    │ │ │ │ +
    855 template<typename V>
    │ │ │ │ +
    856 void DenseMatrix<MAT>::
    │ │ │ │ +
    857 Elim<V>::operator()(const typename V::field_type& factor, int k, int i)
    │ │ │ │ +
    858 {
    │ │ │ │ +
    859 (*rhs_)[k] -= factor*(*rhs_)[i];
    │ │ │ │ +
    860 }
    │ │ │ │ +
    861
    │ │ │ │ +
    862 template<typename MAT>
    │ │ │ │ +
    863 template<typename Func, class Mask>
    │ │ │ │ +
    864 inline void DenseMatrix<MAT>::
    │ │ │ │ +
    865 luDecomposition(DenseMatrix<MAT>& A, Func func, Mask &nonsingularLanes,
    │ │ │ │ +
    866 bool throwEarly, bool doPivoting)
    │ │ │ │ +
    867 {
    │ │ │ │ +
    868 using std::max;
    │ │ │ │ +
    869 using std::swap;
    │ │ │ │ +
    870
    │ │ │ │ +
    871 typedef typename FieldTraits<value_type>::real_type real_type;
    │ │ │ │ +
    872
    │ │ │ │ +
    873 // LU decomposition of A in A
    │ │ │ │ +
    874 for (size_type i=0; i<A.rows(); i++) // loop over all rows
    │ │ │ │ +
    875 {
    │ │ │ │ +
    876 real_type pivmax = fvmeta::absreal(A[i][i]);
    │ │ │ │ +
    877
    │ │ │ │ +
    878 if (doPivoting)
    │ │ │ │ +
    879 {
    │ │ │ │ +
    880 // compute maximum of column
    │ │ │ │ +
    881 simd_index_type imax=i;
    │ │ │ │ +
    882 for (size_type k=i+1; k<A.rows(); k++)
    │ │ │ │ +
    883 {
    │ │ │ │ +
    884 auto abs = fvmeta::absreal(A[k][i]);
    │ │ │ │ +
    885 auto mask = abs > pivmax;
    │ │ │ │ +
    886 pivmax = Simd::cond(mask, abs, pivmax);
    │ │ │ │ +
    887 imax = Simd::cond(mask, simd_index_type(k), imax);
    │ │ │ │ +
    888 }
    │ │ │ │ +
    889 // swap rows
    │ │ │ │ +
    890 for (size_type j=0; j<A.rows(); j++)
    │ │ │ │ +
    891 {
    │ │ │ │ +
    892 // This is a swap operation where the second operand is scattered,
    │ │ │ │ +
    893 // and on top of that is also extracted from deep within a
    │ │ │ │ +
    894 // moderately complicated data structure (a DenseMatrix), where we
    │ │ │ │ +
    895 // can't assume much on the memory layout. On intel processors,
    │ │ │ │ +
    896 // the only instruction that might help us here is vgather, but it
    │ │ │ │ +
    897 // is unclear whether that is even faster than a software
    │ │ │ │ +
    898 // implementation, and we would also need vscatter which does not
    │ │ │ │ +
    899 // exist. So break vectorization here and do it manually.
    │ │ │ │ +
    900 for(std::size_t l = 0; l < Simd::lanes(A[i][j]); ++l)
    │ │ │ │ +
    901 swap(Simd::lane(l, A[i][j]),
    │ │ │ │ +
    902 Simd::lane(l, A[Simd::lane(l, imax)][j]));
    │ │ │ │ +
    903 }
    │ │ │ │ +
    904 func.swap(i, imax); // swap the pivot or rhs
    │ │ │ │ +
    905 }
    │ │ │ │ +
    906
    │ │ │ │ +
    907 // singular ?
    │ │ │ │ +
    908 nonsingularLanes = nonsingularLanes && (pivmax != real_type(0));
    │ │ │ │ +
    909 if (throwEarly) {
    │ │ │ │ +
    910 if(!Simd::allTrue(nonsingularLanes))
    │ │ │ │ +
    911 DUNE_THROW(FMatrixError, "matrix is singular");
    │ │ │ │ +
    912 }
    │ │ │ │ +
    913 else { // !throwEarly
    │ │ │ │ +
    914 if(!Simd::anyTrue(nonsingularLanes))
    │ │ │ │ +
    915 return;
    │ │ │ │ +
    916 }
    │ │ │ │ +
    917
    │ │ │ │ +
    918 // eliminate
    │ │ │ │ +
    919 for (size_type k=i+1; k<A.rows(); k++)
    │ │ │ │ +
    920 {
    │ │ │ │ +
    921 // in the simd case, A[i][i] may be close to zero in some lanes. Pray
    │ │ │ │ +
    922 // that the result is no worse than a quiet NaN.
    │ │ │ │ +
    923 field_type factor = A[k][i]/A[i][i];
    │ │ │ │ +
    924 A[k][i] = factor;
    │ │ │ │ +
    925 for (size_type j=i+1; j<A.rows(); j++)
    │ │ │ │ +
    926 A[k][j] -= factor*A[i][j];
    │ │ │ │ +
    927 func(factor, k, i);
    │ │ │ │ +
    928 }
    │ │ │ │ +
    929 }
    │ │ │ │ +
    930 }
    │ │ │ │ +
    931
    │ │ │ │ +
    932 template<typename MAT>
    │ │ │ │ +
    933 template <class V1, class V2>
    │ │ │ │ +
    934 inline void DenseMatrix<MAT>::solve(V1& x, const V2& b, bool doPivoting) const
    │ │ │ │ +
    935 {
    │ │ │ │ +
    936 using real_type = typename FieldTraits<value_type>::real_type;
    │ │ │ │ +
    937 // never mind those ifs, because they get optimized away
    │ │ │ │ +
    938 if (rows()!=cols())
    │ │ │ │ +
    939 DUNE_THROW(FMatrixError, "Can't solve for a " << rows() << "x" << cols() << " matrix!");
    │ │ │ │ +
    940
    │ │ │ │ +
    941 if (rows()==1) {
    │ │ │ │ +
    942
    │ │ │ │ +
    943#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ +
    944 if (Simd::anyTrue(fvmeta::absreal((*this)[0][0])
    │ │ │ │ + │ │ │ │ +
    946 DUNE_THROW(FMatrixError,"matrix is singular");
    │ │ │ │ +
    947#endif
    │ │ │ │ +
    948 x[0] = b[0]/(*this)[0][0];
    │ │ │ │ +
    949
    │ │ │ │ +
    950 }
    │ │ │ │ +
    951 else if (rows()==2) {
    │ │ │ │ +
    952
    │ │ │ │ +
    953 field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1][0];
    │ │ │ │ +
    954#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ +
    955 if (Simd::anyTrue(fvmeta::absreal(detinv)
    │ │ │ │ + │ │ │ │ +
    957 DUNE_THROW(FMatrixError,"matrix is singular");
    │ │ │ │ +
    958#endif
    │ │ │ │ +
    959 detinv = real_type(1.0)/detinv;
    │ │ │ │ +
    960
    │ │ │ │ +
    961 x[0] = detinv*((*this)[1][1]*b[0]-(*this)[0][1]*b[1]);
    │ │ │ │ +
    962 x[1] = detinv*((*this)[0][0]*b[1]-(*this)[1][0]*b[0]);
    │ │ │ │ +
    963
    │ │ │ │ +
    964 }
    │ │ │ │ +
    965 else if (rows()==3) {
    │ │ │ │ +
    966
    │ │ │ │ +
    967 field_type d = determinant(doPivoting);
    │ │ │ │ +
    968#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ +
    969 if (Simd::anyTrue(fvmeta::absreal(d)
    │ │ │ │ + │ │ │ │ +
    971 DUNE_THROW(FMatrixError,"matrix is singular");
    │ │ │ │ +
    972#endif
    │ │ │ │ +
    973
    │ │ │ │ +
    974 x[0] = (b[0]*(*this)[1][1]*(*this)[2][2] - b[0]*(*this)[2][1]*(*this)[1][2]
    │ │ │ │ +
    975 - b[1] *(*this)[0][1]*(*this)[2][2] + b[1]*(*this)[2][1]*(*this)[0][2]
    │ │ │ │ +
    976 + b[2] *(*this)[0][1]*(*this)[1][2] - b[2]*(*this)[1][1]*(*this)[0][2]) / d;
    │ │ │ │ +
    977
    │ │ │ │ +
    978 x[1] = ((*this)[0][0]*b[1]*(*this)[2][2] - (*this)[0][0]*b[2]*(*this)[1][2]
    │ │ │ │ +
    979 - (*this)[1][0] *b[0]*(*this)[2][2] + (*this)[1][0]*b[2]*(*this)[0][2]
    │ │ │ │ +
    980 + (*this)[2][0] *b[0]*(*this)[1][2] - (*this)[2][0]*b[1]*(*this)[0][2]) / d;
    │ │ │ │ +
    981
    │ │ │ │ +
    982 x[2] = ((*this)[0][0]*(*this)[1][1]*b[2] - (*this)[0][0]*(*this)[2][1]*b[1]
    │ │ │ │ +
    983 - (*this)[1][0] *(*this)[0][1]*b[2] + (*this)[1][0]*(*this)[2][1]*b[0]
    │ │ │ │ +
    984 + (*this)[2][0] *(*this)[0][1]*b[1] - (*this)[2][0]*(*this)[1][1]*b[0]) / d;
    │ │ │ │ +
    985
    │ │ │ │ +
    986 }
    │ │ │ │ +
    987 else {
    │ │ │ │ +
    988
    │ │ │ │ +
    989 V1& rhs = x; // use x to store rhs
    │ │ │ │ +
    990 rhs = b; // copy data
    │ │ │ │ +
    991 Elim<V1> elim(rhs);
    │ │ │ │ +
    992 AutonomousValue<MAT> A(asImp());
    │ │ │ │ +
    993 Simd::Mask<typename FieldTraits<value_type>::real_type>
    │ │ │ │ +
    994 nonsingularLanes(true);
    │ │ │ │ +
    995
    │ │ │ │ +
    996 AutonomousValue<MAT>::luDecomposition(A, elim, nonsingularLanes, true, doPivoting);
    │ │ │ │ +
    997
    │ │ │ │ +
    998 // backsolve
    │ │ │ │ +
    999 for(int i=rows()-1; i>=0; i--) {
    │ │ │ │ +
    1000 for (size_type j=i+1; j<rows(); j++)
    │ │ │ │ +
    1001 rhs[i] -= A[i][j]*x[j];
    │ │ │ │ +
    1002 x[i] = rhs[i]/A[i][i];
    │ │ │ │ +
    1003 }
    │ │ │ │ +
    1004 }
    │ │ │ │ +
    1005 }
    │ │ │ │ +
    1006
    │ │ │ │ +
    1007 template<typename MAT>
    │ │ │ │ +
    1008 inline void DenseMatrix<MAT>::invert(bool doPivoting)
    │ │ │ │ +
    1009 {
    │ │ │ │ +
    1010 using real_type = typename FieldTraits<MAT>::real_type;
    │ │ │ │ +
    1011 using std::swap;
    │ │ │ │ +
    1012
    │ │ │ │ +
    1013 // never mind those ifs, because they get optimized away
    │ │ │ │ +
    1014 if (rows()!=cols())
    │ │ │ │ +
    1015 DUNE_THROW(FMatrixError, "Can't invert a " << rows() << "x" << cols() << " matrix!");
    │ │ │ │ +
    1016
    │ │ │ │ +
    1017 if (rows()==1) {
    │ │ │ │ +
    1018
    │ │ │ │ +
    1019#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ +
    1020 if (Simd::anyTrue(fvmeta::absreal((*this)[0][0])
    │ │ │ │ + │ │ │ │ +
    1022 DUNE_THROW(FMatrixError,"matrix is singular");
    │ │ │ │ +
    1023#endif
    │ │ │ │ +
    1024 (*this)[0][0] = real_type( 1 ) / (*this)[0][0];
    │ │ │ │ +
    1025
    │ │ │ │ +
    1026 }
    │ │ │ │ +
    1027 else if (rows()==2) {
    │ │ │ │ +
    1028
    │ │ │ │ +
    1029 field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1][0];
    │ │ │ │ +
    1030#ifdef DUNE_FMatrix_WITH_CHECKING
    │ │ │ │ +
    1031 if (Simd::anyTrue(fvmeta::absreal(detinv)
    │ │ │ │ + │ │ │ │ +
    1033 DUNE_THROW(FMatrixError,"matrix is singular");
    │ │ │ │ +
    1034#endif
    │ │ │ │ +
    1035 detinv = real_type( 1 ) / detinv;
    │ │ │ │ +
    1036
    │ │ │ │ +
    1037 field_type temp=(*this)[0][0];
    │ │ │ │ +
    1038 (*this)[0][0] = (*this)[1][1]*detinv;
    │ │ │ │ +
    1039 (*this)[0][1] = -(*this)[0][1]*detinv;
    │ │ │ │ +
    1040 (*this)[1][0] = -(*this)[1][0]*detinv;
    │ │ │ │ +
    1041 (*this)[1][1] = temp*detinv;
    │ │ │ │ +
    1042
    │ │ │ │ +
    1043 }
    │ │ │ │ +
    1044 else if (rows()==3)
    │ │ │ │ +
    1045 {
    │ │ │ │ +
    1046 using K = field_type;
    │ │ │ │ +
    1047 // code generated by maple
    │ │ │ │ +
    1048 K t4 = (*this)[0][0] * (*this)[1][1];
    │ │ │ │ +
    1049 K t6 = (*this)[0][0] * (*this)[1][2];
    │ │ │ │ +
    1050 K t8 = (*this)[0][1] * (*this)[1][0];
    │ │ │ │ +
    1051 K t10 = (*this)[0][2] * (*this)[1][0];
    │ │ │ │ +
    1052 K t12 = (*this)[0][1] * (*this)[2][0];
    │ │ │ │ +
    1053 K t14 = (*this)[0][2] * (*this)[2][0];
    │ │ │ │ +
    1054
    │ │ │ │ +
    1055 K det = (t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+
    │ │ │ │ +
    1056 t10*(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]);
    │ │ │ │ +
    1057 K t17 = K(1.0)/det;
    │ │ │ │ +
    1058
    │ │ │ │ +
    1059 K matrix01 = (*this)[0][1];
    │ │ │ │ +
    1060 K matrix00 = (*this)[0][0];
    │ │ │ │ +
    1061 K matrix10 = (*this)[1][0];
    │ │ │ │ +
    1062 K matrix11 = (*this)[1][1];
    │ │ │ │ +
    1063
    │ │ │ │ +
    1064 (*this)[0][0] = ((*this)[1][1] * (*this)[2][2] - (*this)[1][2] * (*this)[2][1])*t17;
    │ │ │ │ +
    1065 (*this)[0][1] = -((*this)[0][1] * (*this)[2][2] - (*this)[0][2] * (*this)[2][1])*t17;
    │ │ │ │ +
    1066 (*this)[0][2] = (matrix01 * (*this)[1][2] - (*this)[0][2] * (*this)[1][1])*t17;
    │ │ │ │ +
    1067 (*this)[1][0] = -((*this)[1][0] * (*this)[2][2] - (*this)[1][2] * (*this)[2][0])*t17;
    │ │ │ │ +
    1068 (*this)[1][1] = (matrix00 * (*this)[2][2] - t14) * t17;
    │ │ │ │ +
    1069 (*this)[1][2] = -(t6-t10) * t17;
    │ │ │ │ +
    1070 (*this)[2][0] = (matrix10 * (*this)[2][1] - matrix11 * (*this)[2][0]) * t17;
    │ │ │ │ +
    1071 (*this)[2][1] = -(matrix00 * (*this)[2][1] - t12) * t17;
    │ │ │ │ +
    1072 (*this)[2][2] = (t4-t8) * t17;
    │ │ │ │ +
    1073 }
    │ │ │ │ +
    1074 else {
    │ │ │ │ +
    1075 using std::swap;
    │ │ │ │ +
    1076
    │ │ │ │ +
    1077 AutonomousValue<MAT> A(asImp());
    │ │ │ │ +
    1078 std::vector<simd_index_type> pivot(rows());
    │ │ │ │ +
    1079 Simd::Mask<typename FieldTraits<value_type>::real_type>
    │ │ │ │ +
    1080 nonsingularLanes(true);
    │ │ │ │ +
    1081 AutonomousValue<MAT>::luDecomposition(A, ElimPivot(pivot), nonsingularLanes, true, doPivoting);
    │ │ │ │ +
    1082 auto& L=A;
    │ │ │ │ +
    1083 auto& U=A;
    │ │ │ │ +
    1084
    │ │ │ │ +
    1085 // initialize inverse
    │ │ │ │ +
    1086 *this=field_type();
    │ │ │ │ +
    1087
    │ │ │ │ +
    1088 for(size_type i=0; i<rows(); ++i)
    │ │ │ │ +
    1089 (*this)[i][i]=1;
    │ │ │ │ +
    1090
    │ │ │ │ +
    1091 // L Y = I; multiple right hand sides
    │ │ │ │ +
    1092 for (size_type i=0; i<rows(); i++)
    │ │ │ │ +
    1093 for (size_type j=0; j<i; j++)
    │ │ │ │ +
    1094 for (size_type k=0; k<rows(); k++)
    │ │ │ │ +
    1095 (*this)[i][k] -= L[i][j]*(*this)[j][k];
    │ │ │ │ +
    1096
    │ │ │ │ +
    1097 // U A^{-1} = Y
    │ │ │ │ +
    1098 for (size_type i=rows(); i>0;) {
    │ │ │ │ +
    1099 --i;
    │ │ │ │ +
    1100 for (size_type k=0; k<rows(); k++) {
    │ │ │ │ +
    1101 for (size_type j=i+1; j<rows(); j++)
    │ │ │ │ +
    1102 (*this)[i][k] -= U[i][j]*(*this)[j][k];
    │ │ │ │ +
    1103 (*this)[i][k] /= U[i][i];
    │ │ │ │ +
    1104 }
    │ │ │ │ +
    1105 }
    │ │ │ │ +
    1106
    │ │ │ │ +
    1107 for(size_type i=rows(); i>0; ) {
    │ │ │ │ +
    1108 --i;
    │ │ │ │ +
    1109 for(std::size_t l = 0; l < Simd::lanes((*this)[0][0]); ++l)
    │ │ │ │ +
    1110 {
    │ │ │ │ +
    1111 std::size_t pi = Simd::lane(l, pivot[i]);
    │ │ │ │ +
    1112 if(i!=pi)
    │ │ │ │ +
    1113 for(size_type j=0; j<rows(); ++j)
    │ │ │ │ +
    1114 swap(Simd::lane(l, (*this)[j][pi]),
    │ │ │ │ +
    1115 Simd::lane(l, (*this)[j][ i]));
    │ │ │ │ +
    1116 }
    │ │ │ │ +
    1117 }
    │ │ │ │ +
    1118 }
    │ │ │ │ +
    1119 }
    │ │ │ │ +
    1120
    │ │ │ │ +
    1121 // implementation of the determinant
    │ │ │ │ +
    1122 template<typename MAT>
    │ │ │ │ +
    1123 inline typename DenseMatrix<MAT>::field_type
    │ │ │ │ +
    1124 DenseMatrix<MAT>::determinant(bool doPivoting) const
    │ │ │ │ +
    1125 {
    │ │ │ │ +
    1126 // never mind those ifs, because they get optimized away
    │ │ │ │ +
    1127 if (rows()!=cols())
    │ │ │ │ +
    1128 DUNE_THROW(FMatrixError, "There is no determinant for a " << rows() << "x" << cols() << " matrix!");
    │ │ │ │ +
    1129
    │ │ │ │ +
    1130 if (rows()==1)
    │ │ │ │ +
    1131 return (*this)[0][0];
    │ │ │ │ +
    1132
    │ │ │ │ +
    1133 if (rows()==2)
    │ │ │ │ +
    1134 return (*this)[0][0]*(*this)[1][1] - (*this)[0][1]*(*this)[1][0];
    │ │ │ │ +
    1135
    │ │ │ │ +
    1136 if (rows()==3) {
    │ │ │ │ +
    1137 // code generated by maple
    │ │ │ │ +
    1138 field_type t4 = (*this)[0][0] * (*this)[1][1];
    │ │ │ │ +
    1139 field_type t6 = (*this)[0][0] * (*this)[1][2];
    │ │ │ │ +
    1140 field_type t8 = (*this)[0][1] * (*this)[1][0];
    │ │ │ │ +
    1141 field_type t10 = (*this)[0][2] * (*this)[1][0];
    │ │ │ │ +
    1142 field_type t12 = (*this)[0][1] * (*this)[2][0];
    │ │ │ │ +
    1143 field_type t14 = (*this)[0][2] * (*this)[2][0];
    │ │ │ │ +
    1144
    │ │ │ │ +
    1145 return (t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+
    │ │ │ │ +
    1146 t10*(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]);
    │ │ │ │ +
    1147
    │ │ │ │ +
    1148 }
    │ │ │ │ +
    1149
    │ │ │ │ +
    1150 AutonomousValue<MAT> A(asImp());
    │ │ │ │ +
    1151 field_type det;
    │ │ │ │ +
    1152 Simd::Mask<typename FieldTraits<value_type>::real_type>
    │ │ │ │ +
    1153 nonsingularLanes(true);
    │ │ │ │ +
    1154
    │ │ │ │ +
    1155 AutonomousValue<MAT>::luDecomposition(A, ElimDet(det), nonsingularLanes, false, doPivoting);
    │ │ │ │ +
    1156 det = Simd::cond(nonsingularLanes, det, field_type(0));
    │ │ │ │ +
    1157
    │ │ │ │ +
    1158 for (size_type i = 0; i < rows(); ++i)
    │ │ │ │ +
    1159 det *= A[i][i];
    │ │ │ │ +
    1160 return det;
    │ │ │ │ +
    1161 }
    │ │ │ │ +
    1162
    │ │ │ │ +
    1163#endif // DOXYGEN
    │ │ │ │ +
    1164
    │ │ │ │ +
    │ │ │ │ +
    1165 namespace DenseMatrixHelp {
    │ │ │ │ +
    1166
    │ │ │ │ +
    1168 template <typename MAT, typename V1, typename V2>
    │ │ │ │ +
    │ │ │ │ +
    1169 static inline void multAssign(const DenseMatrix<MAT> &matrix, const DenseVector<V1> & x, DenseVector<V2> & ret)
    │ │ │ │ +
    1170 {
    │ │ │ │ +
    1171 DUNE_ASSERT_BOUNDS(x.size() == matrix.cols());
    │ │ │ │ +
    1172 DUNE_ASSERT_BOUNDS(ret.size() == matrix.rows());
    │ │ │ │ +
    1173 typedef typename DenseMatrix<MAT>::size_type size_type;
    │ │ │ │ +
    1174
    │ │ │ │ +
    1175 for(size_type i=0; i<matrix.rows(); ++i)
    │ │ │ │ +
    1176 {
    │ │ │ │ +
    1177 ret[i] = 0.0;
    │ │ │ │ +
    1178 for(size_type j=0; j<matrix.cols(); ++j)
    │ │ │ │ +
    1179 {
    │ │ │ │ +
    1180 ret[i] += matrix[i][j]*x[j];
    │ │ │ │ +
    1181 }
    │ │ │ │ +
    1182 }
    │ │ │ │ +
    1183 }
    │ │ │ │ +
    │ │ │ │ +
    1184
    │ │ │ │ +
    1185#if 0
    │ │ │ │ +
    1187 template <typename K, int rows, int cols>
    │ │ │ │ +
    1188 static inline void multAssignTransposed( const FieldMatrix<K,rows,cols> &matrix, const FieldVector<K,rows> & x, FieldVector<K,cols> & ret)
    │ │ │ │ +
    1189 {
    │ │ │ │ +
    1190 typedef typename FieldMatrix<K,rows,cols>::size_type size_type;
    │ │ │ │ +
    1191
    │ │ │ │ +
    1192 for(size_type i=0; i<cols(); ++i)
    │ │ │ │ +
    1193 {
    │ │ │ │ +
    1194 ret[i] = 0.0;
    │ │ │ │ +
    1195 for(size_type j=0; j<rows(); ++j)
    │ │ │ │ +
    1196 ret[i] += matrix[j][i]*x[j];
    │ │ │ │ +
    1197 }
    │ │ │ │ +
    1198 }
    │ │ │ │ +
    1199
    │ │ │ │ +
    1201 template <typename K, int rows, int cols>
    │ │ │ │ +
    1202 static inline FieldVector<K,rows> mult(const FieldMatrix<K,rows,cols> &matrix, const FieldVector<K,cols> & x)
    │ │ │ │ +
    1203 {
    │ │ │ │ +
    1204 FieldVector<K,rows> ret;
    │ │ │ │ +
    1205 multAssign(matrix,x,ret);
    │ │ │ │ +
    1206 return ret;
    │ │ │ │ +
    1207 }
    │ │ │ │ +
    1208
    │ │ │ │ +
    1210 template <typename K, int rows, int cols>
    │ │ │ │ +
    1211 static inline FieldVector<K,cols> multTransposed(const FieldMatrix<K,rows,cols> &matrix, const FieldVector<K,rows> & x)
    │ │ │ │ +
    1212 {
    │ │ │ │ +
    1213 FieldVector<K,cols> ret;
    │ │ │ │ +
    1214 multAssignTransposed( matrix, x, ret );
    │ │ │ │ +
    1215 return ret;
    │ │ │ │ +
    1216 }
    │ │ │ │ +
    1217#endif
    │ │ │ │ +
    1218
    │ │ │ │ +
    1219 } // end namespace DenseMatrixHelp
    │ │ │ │ +
    │ │ │ │ +
    1220
    │ │ │ │ +
    1222 template<typename MAT>
    │ │ │ │ +
    │ │ │ │ +
    1223 std::ostream& operator<< (std::ostream& s, const DenseMatrix<MAT>& a)
    │ │ │ │ +
    1224 {
    │ │ │ │ +
    1225 for (typename DenseMatrix<MAT>::size_type i=0; i<a.rows(); i++)
    │ │ │ │ +
    1226 s << a[i] << std::endl;
    │ │ │ │ +
    1227 return s;
    │ │ │ │ +
    1228 }
    │ │ │ │ +
    │ │ │ │ +
    1229
    │ │ │ │ +
    1232} // end namespace Dune
    │ │ │ │ +
    1233
    │ │ │ │ +
    1234#endif
    │ │ │ │ +
    Implements a scalar vector view wrapper around an existing scalar.
    │ │ │ │ +
    A free function to provide the demangled class name of a given object or type as a string.
    │ │ │ │ +
    Some useful basic math stuff.
    │ │ │ │ +
    Macro for wrapping boundary checks.
    │ │ │ │ +
    Implements a vector constructed from a given type representing a field and a compile-time given size.
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    Various precision settings for calculations with FieldMatrix and FieldVector.
    │ │ │ │ +
    A few common exception classes.
    │ │ │ │ +
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition boundschecking.hh:30
    │ │ │ │ +
    typename AutonomousValueType< T >::type AutonomousValue
    Type free of internal references that T can be converted to.
    Definition typetraits.hh:558
    │ │ │ │ +
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │ +
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ +
    bool anyTrue(const Mask &mask)
    Whether any entry is true
    Definition simd/interface.hh:429
    │ │ │ │ +
    V cond(M &&mask, const V &ifTrue, const V &ifFalse)
    Like the ?: operator.
    Definition simd/interface.hh:386
    │ │ │ │ +
    bool allTrue(const Mask &mask)
    Whether all entries are true
    Definition simd/interface.hh:439
    │ │ │ │ +
    typename Overloads::RebindType< std::decay_t< S >, std::decay_t< V > >::type Rebind
    Construct SIMD type with different scalar type.
    Definition simd/interface.hh:253
    │ │ │ │ +
    constexpr std::size_t lanes()
    Number of lanes in a SIMD type.
    Definition simd/interface.hh:305
    │ │ │ │ +
    decltype(auto) lane(std::size_t l, V &&v)
    Extract an element of a SIMD type.
    Definition simd/interface.hh:324
    │ │ │ │ +
    Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
    implements Simd::mask()
    Definition defaults.hh:153
    │ │ │ │ +
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Definition binaryfunctions.hh:18
    │ │ │ │ -
    Type result_type
    Definition binaryfunctions.hh:23
    │ │ │ │ -
    Type operator()(const Type &t1, const Type &t2) const
    Definition binaryfunctions.hh:25
    │ │ │ │ -
    Type first_argument_type
    Definition binaryfunctions.hh:19
    │ │ │ │ -
    Type second_argument_type
    Definition binaryfunctions.hh:21
    │ │ │ │ -
    Definition binaryfunctions.hh:34
    │ │ │ │ -
    Type operator()(const Type &t1, const Type &t2) const
    Definition binaryfunctions.hh:41
    │ │ │ │ -
    Type result_type
    Definition binaryfunctions.hh:39
    │ │ │ │ -
    Type first_argument_type
    Definition binaryfunctions.hh:35
    │ │ │ │ -
    Type second_argument_type
    Definition binaryfunctions.hh:37
    │ │ │ │ +
    void swap(T &v1, T &v2, bool mask)
    Definition simd.hh:472
    │ │ │ │ +
    int sign(const T &val)
    Return the sign of the value.
    Definition math.hh:180
    │ │ │ │ +
    K conjugateComplex(const K &x)
    compute conjugate complex of x
    Definition math.hh:164
    │ │ │ │ +
    static void multAssign(const DenseMatrix< MAT > &matrix, const DenseVector< V1 > &x, DenseVector< V2 > &ret)
    calculates ret = matrix * x
    Definition densematrix.hh:1169
    │ │ │ │ +
    A dense n x m matrix.
    Definition densematrix.hh:140
    │ │ │ │ +
    ConstIterator const_iterator
    typedef for stl compliant access
    Definition densematrix.hh:244
    │ │ │ │ +
    derived_type operator-() const
    Matrix negation.
    Definition densematrix.hh:298
    │ │ │ │ +
    void solve(V1 &x, const V2 &b, bool doPivoting=true) const
    Solve system A x = b.
    │ │ │ │ +
    void mv(const X &x, Y &y) const
    y = A x
    Definition densematrix.hh:368
    │ │ │ │ +
    Traits::value_type field_type
    export the type representing the field
    Definition densematrix.hh:160
    │ │ │ │ +
    derived_type & axpy(const field_type &a, const DenseMatrix< Other > &x)
    vector space axpy operation (*this += a x)
    Definition densematrix.hh:338
    │ │ │ │ +
    ConstIterator beforeEnd() const
    Definition densematrix.hh:264
    │ │ │ │ +
    derived_type & operator=(const RHS &rhs)
    Definition densematrix.hh:279
    │ │ │ │ +
    void mmtv(const X &x, Y &y) const
    y -= A^T x
    Definition densematrix.hh:458
    │ │ │ │ +
    FieldTraits< vt >::real_type infinity_norm_real() const
    simplified infinity norm (uses Manhattan norm for complex values)
    Definition densematrix.hh:561
    │ │ │ │ +
    std::remove_reference< const_row_reference >::type::ConstIterator ConstColIterator
    rename the iterators for easier access
    Definition densematrix.hh:248
    │ │ │ │ +
    ConstIterator beforeBegin() const
    Definition densematrix.hh:271
    │ │ │ │ +
    void invert(bool doPivoting=true)
    Compute inverse.
    │ │ │ │ +
    static void luDecomposition(DenseMatrix< MAT > &A, Func func, Mask &nonsingularLanes, bool throwEarly, bool doPivoting)
    do an LU-Decomposition on matrix A
    │ │ │ │ +
    Traits::value_type block_type
    export the type representing the components
    Definition densematrix.hh:163
    │ │ │ │ +
    void mtv(const X &x, Y &y) const
    y = A^T x
    Definition densematrix.hh:387
    │ │ │ │ +
    constexpr size_type cols() const
    number of columns
    Definition densematrix.hh:715
    │ │ │ │ +
    size_type size() const
    size method (number of rows)
    Definition densematrix.hh:200
    │ │ │ │ +
    constexpr size_type M() const
    number of columns
    Definition densematrix.hh:703
    │ │ │ │ +
    MAT & rightmultiply(const DenseMatrix< M2 > &M)
    Multiplies M from the right to this matrix.
    Definition densematrix.hh:645
    │ │ │ │ +
    Iterator end()
    end iterator
    Definition densematrix.hh:222
    │ │ │ │ +
    Iterator beforeBegin()
    Definition densematrix.hh:236
    │ │ │ │ +
    derived_type & operator/=(const field_type &k)
    vector space division by scalar
    Definition densematrix.hh:329
    │ │ │ │ +
    derived_type & operator*=(const field_type &k)
    vector space multiplication with scalar
    Definition densematrix.hh:321
    │ │ │ │ +
    Iterator beforeEnd()
    Definition densematrix.hh:229
    │ │ │ │ +
    Traits::value_type value_type
    export the type representing the field
    Definition densematrix.hh:157
    │ │ │ │ +
    void usmv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
    y += alpha A x
    Definition densematrix.hh:484
    │ │ │ │ +
    void usmhv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
    y += alpha A^H x
    Definition densematrix.hh:512
    │ │ │ │ +
    void mmv(const X &x, Y &y) const
    y -= A x
    Definition densematrix.hh:445
    │ │ │ │ +
    constexpr size_type rows() const
    number of rows
    Definition densematrix.hh:709
    │ │ │ │ +
    MAT & leftmultiply(const DenseMatrix< M2 > &M)
    Multiplies M from the left to this matrix.
    Definition densematrix.hh:627
    │ │ │ │ +
    void usmtv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
    y += alpha A^T x
    Definition densematrix.hh:498
    │ │ │ │ +
    derived_type & operator-=(const DenseMatrix< Other > &x)
    vector space subtraction
    Definition densematrix.hh:312
    │ │ │ │ +
    bool operator!=(const DenseMatrix< Other > &x) const
    Binary matrix incomparison.
    Definition densematrix.hh:358
    │ │ │ │ +
    void mmhv(const X &x, Y &y) const
    y -= A^H x
    Definition densematrix.hh:471
    │ │ │ │ +
    Traits::derived_type derived_type
    type of derived matrix class
    Definition densematrix.hh:154
    │ │ │ │ +
    row_reference operator[](size_type i)
    random access
    Definition densematrix.hh:189
    │ │ │ │ +
    bool exists(size_type i, size_type j) const
    return true when (i,j) is in pattern
    Definition densematrix.hh:723
    │ │ │ │ +
    Iterator RowIterator
    rename the iterators for easier access
    Definition densematrix.hh:211
    │ │ │ │ +
    static constexpr int blocklevel
    The number of block levels we contain. This is the leaf, that is, 1.
    Definition densematrix.hh:178
    │ │ │ │ +
    FieldTraits< value_type >::real_type frobenius_norm() const
    frobenius norm: sqrt(sum over squared values of entries)
    Definition densematrix.hh:528
    │ │ │ │ +
    void umv(const X &x, Y &y) const
    y += A x
    Definition densematrix.hh:406
    │ │ │ │ +
    DenseIterator< const DenseMatrix, const row_type, const_row_reference > ConstIterator
    Iterator class for sequential access.
    Definition densematrix.hh:242
    │ │ │ │ +
    FieldTraits< vt >::real_type infinity_norm() const
    infinity norm (row sum norm, how to generalize for blocks?)
    Definition densematrix.hh:546
    │ │ │ │ +
    Traits::row_type row_type
    The type used to represent a row (must fulfill the Dune::DenseVector interface)
    Definition densematrix.hh:169
    │ │ │ │ +
    constexpr size_type N() const
    number of rows
    Definition densematrix.hh:697
    │ │ │ │ +
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition densematrix.hh:166
    │ │ │ │ +
    Traits::const_row_reference const_row_reference
    The type used to represent a reference to a constant row (usually const row_type &)
    Definition densematrix.hh:175
    │ │ │ │ +
    FieldTraits< value_type >::real_type frobenius_norm2() const
    square of frobenius norm, need for block recursion
    Definition densematrix.hh:536
    │ │ │ │ +
    std::remove_reference< row_reference >::type::Iterator ColIterator
    rename the iterators for easier access
    Definition densematrix.hh:213
    │ │ │ │ +
    Traits::row_reference row_reference
    The type used to represent a reference to a row (usually row_type &)
    Definition densematrix.hh:172
    │ │ │ │ +
    bool operator==(const DenseMatrix< Other > &x) const
    Binary matrix comparison.
    Definition densematrix.hh:348
    │ │ │ │ +
    Iterator iterator
    typedef for stl compliant access
    Definition densematrix.hh:209
    │ │ │ │ +
    ConstIterator ConstRowIterator
    rename the iterators for easier access
    Definition densematrix.hh:246
    │ │ │ │ +
    DenseIterator< DenseMatrix, row_type, row_reference > Iterator
    Iterator class for sequential access.
    Definition densematrix.hh:207
    │ │ │ │ +
    void umtv(const X &x, Y &y) const
    y += A^T x
    Definition densematrix.hh:419
    │ │ │ │ +
    ConstIterator begin() const
    begin iterator
    Definition densematrix.hh:251
    │ │ │ │ +
    field_type determinant(bool doPivoting=true) const
    calculates the determinant of this matrix
    │ │ │ │ +
    Iterator begin()
    begin iterator
    Definition densematrix.hh:216
    │ │ │ │ +
    void umhv(const X &x, Y &y) const
    y += A^H x
    Definition densematrix.hh:432
    │ │ │ │ +
    derived_type & operator+=(const DenseMatrix< Other > &x)
    vector space addition
    Definition densematrix.hh:289
    │ │ │ │ +
    ConstIterator end() const
    end iterator
    Definition densematrix.hh:257
    │ │ │ │ +
    const FieldTraits< typenameDenseMatVecTraits< M >::value_type >::real_type real_type
    Definition densematrix.hh:34
    │ │ │ │ +
    const FieldTraits< typenameDenseMatVecTraits< M >::value_type >::field_type field_type
    Definition densematrix.hh:33
    │ │ │ │ +
    A dense n x m matrix.
    Definition fmatrix.hh:117
    │ │ │ │ +
    Base::size_type size_type
    Definition fmatrix.hh:127
    │ │ │ │ +
    vector space out of a tensor product of fields.
    Definition fvector.hh:95
    │ │ │ │ +
    you have to specialize this structure for any type that should be assignable to a DenseMatrix
    Definition densematrix.hh:59
    │ │ │ │ +
    Error thrown if operations of a FieldMatrix fail.
    Definition densematrix.hh:126
    │ │ │ │ +
    Interface for a class of dense vectors over a given field.
    Definition densevector.hh:229
    │ │ │ │ +
    size_type size() const
    size method
    Definition densevector.hh:336
    │ │ │ │ +
    Generic iterator class for dense vector and matrix implementations.
    Definition densevector.hh:131
    │ │ │ │ +
    Default exception class for mathematical errors.
    Definition exceptions.hh:241
    │ │ │ │ +
    Definition ftraits.hh:26
    │ │ │ │ +
    T field_type
    export the type representing the field
    Definition ftraits.hh:28
    │ │ │ │ +
    T real_type
    export the type representing the real type of the field
    Definition ftraits.hh:30
    │ │ │ │ +
    Definition matvectraits.hh:31
    │ │ │ │ +
    static ctype absolute_limit()
    return threshold to declare matrix singular
    Definition precision.hh:28
    │ │ │ │ +
    Include file for users of the SIMD abstraction layer.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,93 +1,1521 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -binaryfunctions.hh │ │ │ │ │ +densematrix.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_BINARYFUNCTIONS_HH │ │ │ │ │ -6#define DUNE_BINARYFUNCTIONS_HH │ │ │ │ │ +5#ifndef DUNE_DENSEMATRIX_HH │ │ │ │ │ +6#define DUNE_DENSEMATRIX_HH │ │ │ │ │ 7 │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14namespace _D_u_n_e │ │ │ │ │ -15{ │ │ │ │ │ -16 template │ │ │ │ │ -_1_7 struct _M_i_n │ │ │ │ │ -18 { │ │ │ │ │ -_1_9 using _f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ -following similar deprecations in C++17")]] = Type; │ │ │ │ │ -20 │ │ │ │ │ -_2_1 using _s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ -following similar deprecations in C++17")]] = Type; │ │ │ │ │ -22 │ │ │ │ │ -_2_3 using _r_e_s_u_l_t___t_y_p_e [[deprecated("This type alias is deprecated following │ │ │ │ │ -similar deprecations in C++17")]] = Type; │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14 │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h> │ │ │ │ │ +16#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_e_c_i_s_i_o_n_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_i_m_d_/_s_i_m_d_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +23#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_c_a_l_a_r_v_e_c_t_o_r_v_i_e_w_._h_h> │ │ │ │ │ 24 │ │ │ │ │ -_2_5 Type _o_p_e_r_a_t_o_r_(_)(const Type& t1, const Type& t2) const │ │ │ │ │ -26 { │ │ │ │ │ -27 using std::min; │ │ │ │ │ -28 return min(t1,t2); │ │ │ │ │ -29 } │ │ │ │ │ -30 }; │ │ │ │ │ -31 │ │ │ │ │ -32 template │ │ │ │ │ -_3_3 struct _M_a_x │ │ │ │ │ -34 { │ │ │ │ │ -_3_5 using _f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ -following similar deprecations in C++17")]] = Type; │ │ │ │ │ +25namespace _D_u_n_e │ │ │ │ │ +26{ │ │ │ │ │ +27 │ │ │ │ │ +28 template class DenseMatrix; │ │ │ │ │ +29 │ │ │ │ │ +30 template │ │ │ │ │ +_3_1 struct _F_i_e_l_d_T_r_a_i_t_s< _D_e_n_s_e_M_a_t_r_i_x > │ │ │ │ │ +32 { │ │ │ │ │ +_3_3 typedef const typename _F_i_e_l_d_T_r_a_i_t_s_<_ _t_y_p_e_n_a_m_e_ _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_M_>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e >_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_3_4 typedef const typename _F_i_e_l_d_T_r_a_i_t_s_<_ _t_y_p_e_n_a_m_e_ _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_M_>_:_: │ │ │ │ │ +_v_a_l_u_e___t_y_p_e >_:_:_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ +35 }; │ │ │ │ │ 36 │ │ │ │ │ -_3_7 using _s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e [[deprecated("This type alias is deprecated │ │ │ │ │ -following similar deprecations in C++17")]] = Type; │ │ │ │ │ -38 │ │ │ │ │ -_3_9 using _r_e_s_u_l_t___t_y_p_e [[deprecated("This type alias is deprecated following │ │ │ │ │ -similar deprecations in C++17")]] = Type; │ │ │ │ │ -40 │ │ │ │ │ -_4_1 Type _o_p_e_r_a_t_o_r_(_)(const Type& t1, const Type& t2) const │ │ │ │ │ -42 { │ │ │ │ │ -43 using std::max; │ │ │ │ │ -44 return max(t1,t2); │ │ │ │ │ -45 } │ │ │ │ │ -46 }; │ │ │ │ │ -47} │ │ │ │ │ -48 │ │ │ │ │ -49#endif │ │ │ │ │ +37 template class _F_i_e_l_d_M_a_t_r_i_x; │ │ │ │ │ +38 template class _F_i_e_l_d_V_e_c_t_o_r; │ │ │ │ │ +39 │ │ │ │ │ +58 template< class DenseMatrix, class RHS > │ │ │ │ │ +_5_9 struct _D_e_n_s_e_M_a_t_r_i_x_A_s_s_i_g_n_e_r; │ │ │ │ │ +60 │ │ │ │ │ +61#ifndef DOXYGEN │ │ │ │ │ +62 namespace Impl │ │ │ │ │ +63 { │ │ │ │ │ +64 │ │ │ │ │ +65 template< class DenseMatrix, class RHS, class = void > │ │ │ │ │ +66 class _D_e_n_s_e_M_a_t_r_i_x_A_s_s_i_g_n_e_r │ │ │ │ │ +67 {}; │ │ │ │ │ +68 │ │ │ │ │ +69 template< class DenseMatrix, class RHS > │ │ │ │ │ +70 class _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, RHS, _s_t_d::enable_if_t< Dune:: │ │ │ │ │ +IsNumber< RHS >::value > > │ │ │ │ │ +71 { │ │ │ │ │ +72 public: │ │ │ │ │ +73 static void apply ( _D_e_n_s_e_M_a_t_r_i_x &denseMatrix, const RHS &rhs ) │ │ │ │ │ +74 { │ │ │ │ │ +75 typedef typename _D_e_n_s_e_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e field_type; │ │ │ │ │ +76 std::fill( denseMatrix._b_e_g_i_n(), denseMatrix._e_n_d(), static_cast< field_type > │ │ │ │ │ +( rhs ) ); │ │ │ │ │ +77 } │ │ │ │ │ +78 }; │ │ │ │ │ +79 │ │ │ │ │ +80 template< class DenseMatrix, class RHS > │ │ │ │ │ +81 class DenseMatrixAssigner< DenseMatrix, RHS, _s_t_d::enable_if_t< !std:: │ │ │ │ │ +is_same< typename RHS::const_iterator, void >::value │ │ │ │ │ +82 && std::is_convertible< typename RHS::const_iterator::value_type, typename │ │ │ │ │ +DenseMatrix::iterator::value_type >::value > > │ │ │ │ │ +83 { │ │ │ │ │ +84 public: │ │ │ │ │ +85 static void apply ( DenseMatrix &denseMatrix, const RHS &rhs ) │ │ │ │ │ +86 { │ │ │ │ │ +87 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(rhs.N() == denseMatrix.N()); │ │ │ │ │ +88 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(rhs.M() == denseMatrix.M()); │ │ │ │ │ +89 typename DenseMatrix::iterator tIt = std::begin(denseMatrix); │ │ │ │ │ +90 typename RHS::const_iterator sIt = std::begin(rhs); │ │ │ │ │ +91 for(; sIt != std::end(rhs); ++tIt, ++sIt) │ │ │ │ │ +92 std::copy(std::begin(*sIt), std::end(*sIt), std::begin(*tIt)); │ │ │ │ │ +93 } │ │ │ │ │ +94 }; │ │ │ │ │ +95 │ │ │ │ │ +96 } // namespace Impl │ │ │ │ │ +97 │ │ │ │ │ +98 │ │ │ │ │ +99 │ │ │ │ │ +100 template< class DenseMatrix, class RHS > │ │ │ │ │ +101 struct DenseMatrixAssigner │ │ │ │ │ +102 : public Impl::DenseMatrixAssigner< DenseMatrix, RHS > │ │ │ │ │ +103 {}; │ │ │ │ │ +104 │ │ │ │ │ +105 │ │ │ │ │ +106 namespace Impl │ │ │ │ │ +107 { │ │ │ │ │ +108 │ │ │ │ │ +109 template< class DenseMatrix, class RHS > │ │ │ │ │ +110 std::true_type hasDenseMatrixAssigner ( DenseMatrix &, const RHS &, │ │ │ │ │ +decltype( _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_,_ _R_H_S_ _>_:_:_a_p_p_l_y( std::declval< │ │ │ │ │ +DenseMatrix & >(), std::declval< const RHS & >() ) ) * = nullptr ); │ │ │ │ │ +111 │ │ │ │ │ +112 std::false_type hasDenseMatrixAssigner ( ... ); │ │ │ │ │ +113 │ │ │ │ │ +114 } // namespace Impl │ │ │ │ │ +115 │ │ │ │ │ +116 template< class DenseMatrix, class RHS > │ │ │ │ │ +117 struct HasDenseMatrixAssigner │ │ │ │ │ +118 : public decltype( Impl::hasDenseMatrixAssigner( std::declval< DenseMatrix │ │ │ │ │ +& >(), std::declval< const RHS & >() ) ) │ │ │ │ │ +119 {}; │ │ │ │ │ +120 │ │ │ │ │ +121#endif // #ifndef DOXYGEN │ │ │ │ │ +122 │ │ │ │ │ +123 │ │ │ │ │ +124 │ │ │ │ │ +_1_2_6 class _F_M_a_t_r_i_x_E_r_r_o_r : public _M_a_t_h_E_r_r_o_r {}; │ │ │ │ │ +127 │ │ │ │ │ +138 template │ │ │ │ │ +_1_3_9 class _D_e_n_s_e_M_a_t_r_i_x │ │ │ │ │ +140 { │ │ │ │ │ +141 typedef _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_M_A_T_> _T_r_a_i_t_s; │ │ │ │ │ +142 │ │ │ │ │ +143 // Curiously recurring template pattern │ │ │ │ │ +144 constexpr MAT & asImp() { return static_cast(*this); } │ │ │ │ │ +145 constexpr const MAT & asImp() const { return static_cast │ │ │ │ │ +(*this); } │ │ │ │ │ +146 │ │ │ │ │ +147 template │ │ │ │ │ +_1_4_8 friend class _D_e_n_s_e_M_a_t_r_i_x; │ │ │ │ │ +149 │ │ │ │ │ +150 public: │ │ │ │ │ +151 //===== type definitions and constants │ │ │ │ │ +152 │ │ │ │ │ +_1_5_4 typedef typename Traits::derived_type _d_e_r_i_v_e_d___t_y_p_e; │ │ │ │ │ +155 │ │ │ │ │ +_1_5_7 typedef typename Traits::value_type _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +158 │ │ │ │ │ +_1_6_0 typedef typename Traits::value_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +161 │ │ │ │ │ +_1_6_3 typedef typename Traits::value_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +164 │ │ │ │ │ +_1_6_6 typedef typename Traits::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +167 │ │ │ │ │ +_1_6_9 typedef typename Traits::row_type _r_o_w___t_y_p_e; │ │ │ │ │ +170 │ │ │ │ │ +_1_7_2 typedef typename Traits::row_reference _r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +173 │ │ │ │ │ +_1_7_5 typedef typename Traits::const_row_reference _c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +176 │ │ │ │ │ +_1_7_8 constexpr static int _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ +179 │ │ │ │ │ +180 private: │ │ │ │ │ +183 using simd_index_type = _S_i_m_d_:_:_R_e_b_i_n_d_<_s_t_d_:_:_s_i_z_e___t_,_ _v_a_l_u_e___t_y_p_e_>; │ │ │ │ │ +184 │ │ │ │ │ +185 public: │ │ │ │ │ +186 //===== access to components │ │ │ │ │ +187 │ │ │ │ │ +_1_8_9 _r_o_w___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 ) │ │ │ │ │ +190 { │ │ │ │ │ +191 return asImp().mat_access(i); │ │ │ │ │ +192 } │ │ │ │ │ +193 │ │ │ │ │ +_1_9_4 _c_o_n_s_t___r_o_w___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 │ │ │ │ │ +195 { │ │ │ │ │ +196 return asImp().mat_access(i); │ │ │ │ │ +197 } │ │ │ │ │ +198 │ │ │ │ │ +_2_0_0 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ +201 { │ │ │ │ │ +202 return _r_o_w_s(); │ │ │ │ │ +203 } │ │ │ │ │ +204 │ │ │ │ │ +205 //===== iterator interface to rows of the matrix │ │ │ │ │ +_2_0_7 typedef _D_e_n_s_e_I_t_e_r_a_t_o_r_<_D_e_n_s_e_M_a_t_r_i_x_,_r_o_w___t_y_p_e_,_r_o_w___r_e_f_e_r_e_n_c_e_> _I_t_e_r_a_t_o_r; │ │ │ │ │ +_2_0_9 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ │ +_2_1_1 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ +_2_1_3 typedef typename std::remove_reference::type::Iterator │ │ │ │ │ +_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +214 │ │ │ │ │ +_2_1_6 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ +217 { │ │ │ │ │ +218 return _I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ +219 } │ │ │ │ │ +220 │ │ │ │ │ +_2_2_2 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ +223 { │ │ │ │ │ +224 return _I_t_e_r_a_t_o_r(*this,_r_o_w_s()); │ │ │ │ │ +225 } │ │ │ │ │ +226 │ │ │ │ │ +_2_2_9 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ +230 { │ │ │ │ │ +231 return _I_t_e_r_a_t_o_r(*this,_r_o_w_s()-1); │ │ │ │ │ +232 } │ │ │ │ │ +233 │ │ │ │ │ +_2_3_6 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ +237 { │ │ │ │ │ +238 return _I_t_e_r_a_t_o_r(*this,-1); │ │ │ │ │ +239 } │ │ │ │ │ +240 │ │ │ │ │ +_2_4_2 typedef _D_e_n_s_e_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _D_e_n_s_e_M_a_t_r_i_x_,_c_o_n_s_t_ _r_o_w___t_y_p_e_,_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e_> │ │ │ │ │ +_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +_2_4_4 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; │ │ │ │ │ +_2_4_6 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; │ │ │ │ │ +_2_4_8 typedef typename std::remove_reference::type:: │ │ │ │ │ +ConstIterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +249 │ │ │ │ │ +_2_5_1 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ +252 { │ │ │ │ │ +253 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ +254 } │ │ │ │ │ +255 │ │ │ │ │ +_2_5_7 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ +258 { │ │ │ │ │ +259 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,_r_o_w_s()); │ │ │ │ │ +260 } │ │ │ │ │ +261 │ │ │ │ │ +_2_6_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () const │ │ │ │ │ +265 { │ │ │ │ │ +266 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,_r_o_w_s()-1); │ │ │ │ │ +267 } │ │ │ │ │ +268 │ │ │ │ │ +_2_7_1 _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 │ │ │ │ │ +272 { │ │ │ │ │ +273 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,-1); │ │ │ │ │ +274 } │ │ │ │ │ +275 │ │ │ │ │ +276 //===== assignment │ │ │ │ │ +277 │ │ │ │ │ +278 template< class RHS, class = std::enable_if_t< HasDenseMatrixAssigner< MAT, │ │ │ │ │ +RHS >::value > > │ │ │ │ │ +_2_7_9 _d_e_r_i_v_e_d___t_y_p_e &_o_p_e_r_a_t_o_r_=_ ( const RHS &rhs ) │ │ │ │ │ +280 { │ │ │ │ │ +281 _D_e_n_s_e_M_a_t_r_i_x_A_s_s_i_g_n_e_r_<_ _M_A_T_,_ _R_H_S_ _>_:_:_a_p_p_l_y( asImp(), rhs ); │ │ │ │ │ +282 return asImp(); │ │ │ │ │ +283 } │ │ │ │ │ +284 │ │ │ │ │ +285 //===== vector space arithmetic │ │ │ │ │ +286 │ │ │ │ │ +288 template │ │ │ │ │ +_2_8_9 _d_e_r_i_v_e_d___t_y_p_e &_o_p_e_r_a_t_o_r_+_=_ (const _D_e_n_s_e_M_a_t_r_i_x_<_O_t_h_e_r_>& x) │ │ │ │ │ +290 { │ │ │ │ │ +291 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_r_o_w_s() == x._r_o_w_s()); │ │ │ │ │ +292 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +293 (*this)[i] += x[i]; │ │ │ │ │ +294 return asImp(); │ │ │ │ │ +295 } │ │ │ │ │ +296 │ │ │ │ │ +_2_9_8 _d_e_r_i_v_e_d___t_y_p_e _o_p_e_r_a_t_o_r_-_ () const │ │ │ │ │ +299 { │ │ │ │ │ +300 MAT result; │ │ │ │ │ +301 using idx_type = typename decltype(result)_:_:_s_i_z_e___t_y_p_e; │ │ │ │ │ +302 │ │ │ │ │ +303 for (idx_type i = 0; i < _r_o_w_s(); ++i) │ │ │ │ │ +304 for (idx_type j = 0; j < _c_o_l_s(); ++j) │ │ │ │ │ +305 result[i][j] = - asImp()[i][j]; │ │ │ │ │ +306 │ │ │ │ │ +307 return result; │ │ │ │ │ +308 } │ │ │ │ │ +309 │ │ │ │ │ +311 template │ │ │ │ │ +_3_1_2 _d_e_r_i_v_e_d___t_y_p_e &_o_p_e_r_a_t_o_r_-_=_ (const _D_e_n_s_e_M_a_t_r_i_x_<_O_t_h_e_r_>& x) │ │ │ │ │ +313 { │ │ │ │ │ +314 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_r_o_w_s() == x._r_o_w_s()); │ │ │ │ │ +315 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +316 (*this)[i] -= x[i]; │ │ │ │ │ +317 return asImp(); │ │ │ │ │ +318 } │ │ │ │ │ +319 │ │ │ │ │ +_3_2_1 _d_e_r_i_v_e_d___t_y_p_e &_o_p_e_r_a_t_o_r_*_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +322 { │ │ │ │ │ +323 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +324 (*this)[i] *= k; │ │ │ │ │ +325 return asImp(); │ │ │ │ │ +326 } │ │ │ │ │ +327 │ │ │ │ │ +_3_2_9 _d_e_r_i_v_e_d___t_y_p_e &_o_p_e_r_a_t_o_r_/_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +330 { │ │ │ │ │ +331 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +332 (*this)[i] /= k; │ │ │ │ │ +333 return asImp(); │ │ │ │ │ +334 } │ │ │ │ │ +335 │ │ │ │ │ +337 template │ │ │ │ │ +_3_3_8 _d_e_r_i_v_e_d___t_y_p_e &_a_x_p_y (const _f_i_e_l_d___t_y_p_e &a, const _D_e_n_s_e_M_a_t_r_i_x_<_O_t_h_e_r_> &x ) │ │ │ │ │ +339 { │ │ │ │ │ +340 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_r_o_w_s() == x._r_o_w_s()); │ │ │ │ │ +341 for( _s_i_z_e___t_y_p_e i = 0; i < _r_o_w_s(); ++i ) │ │ │ │ │ +342 (*this)[ i ].axpy( a, x[ i ] ); │ │ │ │ │ +343 return asImp(); │ │ │ │ │ +344 } │ │ │ │ │ +345 │ │ │ │ │ +347 template │ │ │ │ │ +_3_4_8 bool _o_p_e_r_a_t_o_r_=_=_ (const _D_e_n_s_e_M_a_t_r_i_x_<_O_t_h_e_r_>& x) const │ │ │ │ │ +349 { │ │ │ │ │ +350 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_r_o_w_s() == x._r_o_w_s()); │ │ │ │ │ +351 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +352 if ((*this)[i]!=x[i]) │ │ │ │ │ +353 return false; │ │ │ │ │ +354 return true; │ │ │ │ │ +355 } │ │ │ │ │ +357 template │ │ │ │ │ +_3_5_8 bool _o_p_e_r_a_t_o_r_!_=_ (const _D_e_n_s_e_M_a_t_r_i_x_<_O_t_h_e_r_>& x) const │ │ │ │ │ +359 { │ │ │ │ │ +360 return !_o_p_e_r_a_t_o_r_=_=(x); │ │ │ │ │ +361 } │ │ │ │ │ +362 │ │ │ │ │ +363 │ │ │ │ │ +364 //===== linear maps │ │ │ │ │ +365 │ │ │ │ │ +367 template │ │ │ │ │ +_3_6_8 void _m_v (const X& x, Y& y) const │ │ │ │ │ +369 { │ │ │ │ │ +370 auto&& xx = Impl::asVector(x); │ │ │ │ │ +371 auto&& yy = Impl::asVector(y); │ │ │ │ │ +372 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S((void*)(&x) != (void*)(&y)); │ │ │ │ │ +373 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _M()); │ │ │ │ │ +374 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _N()); │ │ │ │ │ +375 │ │ │ │ │ +376 using y_field_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +377 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); ++i) │ │ │ │ │ +378 { │ │ │ │ │ +379 yy[i] = y_field_type(0); │ │ │ │ │ +380 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +381 yy[i] += (*this)[i][j] * xx[j]; │ │ │ │ │ +382 } │ │ │ │ │ +383 } │ │ │ │ │ +384 │ │ │ │ │ +386 template< class X, class Y > │ │ │ │ │ +_3_8_7 void _m_t_v ( const X &x, Y &y ) const │ │ │ │ │ +388 { │ │ │ │ │ +389 auto&& xx = Impl::asVector(x); │ │ │ │ │ +390 auto&& yy = Impl::asVector(y); │ │ │ │ │ +391 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S((void*)(&x) != (void*)(&y)); │ │ │ │ │ +392 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _N()); │ │ │ │ │ +393 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _M()); │ │ │ │ │ +394 │ │ │ │ │ +395 using y_field_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +396 for(_s_i_z_e___t_y_p_e i = 0; i < _c_o_l_s(); ++i) │ │ │ │ │ +397 { │ │ │ │ │ +398 yy[i] = y_field_type(0); │ │ │ │ │ +399 for(_s_i_z_e___t_y_p_e j = 0; j < _r_o_w_s(); ++j) │ │ │ │ │ +400 yy[i] += (*this)[j][i] * xx[j]; │ │ │ │ │ +401 } │ │ │ │ │ +402 } │ │ │ │ │ +403 │ │ │ │ │ +405 template │ │ │ │ │ +_4_0_6 void _u_m_v (const X& x, Y& y) const │ │ │ │ │ +407 { │ │ │ │ │ +408 auto&& xx = Impl::asVector(x); │ │ │ │ │ +409 auto&& yy = Impl::asVector(y); │ │ │ │ │ +410 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _M()); │ │ │ │ │ +411 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _N()); │ │ │ │ │ +412 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); ++i) │ │ │ │ │ +413 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +414 yy[i] += (*this)[i][j] * xx[j]; │ │ │ │ │ +415 } │ │ │ │ │ +416 │ │ │ │ │ +418 template │ │ │ │ │ +_4_1_9 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ +420 { │ │ │ │ │ +421 auto&& xx = Impl::asVector(x); │ │ │ │ │ +422 auto&& yy = Impl::asVector(y); │ │ │ │ │ +423 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _N()); │ │ │ │ │ +424 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _M()); │ │ │ │ │ +425 for(_s_i_z_e___t_y_p_e i = 0; i<_r_o_w_s(); ++i) │ │ │ │ │ +426 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +427 yy[j] += (*this)[i][j]*xx[i]; │ │ │ │ │ +428 } │ │ │ │ │ +429 │ │ │ │ │ +431 template │ │ │ │ │ +_4_3_2 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ +433 { │ │ │ │ │ +434 auto&& xx = Impl::asVector(x); │ │ │ │ │ +435 auto&& yy = Impl::asVector(y); │ │ │ │ │ +436 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _N()); │ │ │ │ │ +437 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _M()); │ │ │ │ │ +438 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +439 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +440 yy[j] += _c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x((*this)[i][j])*xx[i]; │ │ │ │ │ +441 } │ │ │ │ │ +442 │ │ │ │ │ +444 template │ │ │ │ │ +_4_4_5 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ +446 { │ │ │ │ │ +447 auto&& xx = Impl::asVector(x); │ │ │ │ │ +448 auto&& yy = Impl::asVector(y); │ │ │ │ │ +449 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _M()); │ │ │ │ │ +450 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _N()); │ │ │ │ │ +451 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +452 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +453 yy[i] -= (*this)[i][j] * xx[j]; │ │ │ │ │ +454 } │ │ │ │ │ +455 │ │ │ │ │ +457 template │ │ │ │ │ +_4_5_8 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ +459 { │ │ │ │ │ +460 auto&& xx = Impl::asVector(x); │ │ │ │ │ +461 auto&& yy = Impl::asVector(y); │ │ │ │ │ +462 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _N()); │ │ │ │ │ +463 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _M()); │ │ │ │ │ +464 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +465 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +466 yy[j] -= (*this)[i][j]*xx[i]; │ │ │ │ │ +467 } │ │ │ │ │ +468 │ │ │ │ │ +470 template │ │ │ │ │ +_4_7_1 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ +472 { │ │ │ │ │ +473 auto&& xx = Impl::asVector(x); │ │ │ │ │ +474 auto&& yy = Impl::asVector(y); │ │ │ │ │ +475 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _N()); │ │ │ │ │ +476 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _M()); │ │ │ │ │ +477 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +478 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +479 yy[j] -= _c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x((*this)[i][j])*xx[i]; │ │ │ │ │ +480 } │ │ │ │ │ +481 │ │ │ │ │ +483 template │ │ │ │ │ +_4_8_4 void _u_s_m_v (const typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e & alpha, │ │ │ │ │ +485 const X& x, Y& y) const │ │ │ │ │ +486 { │ │ │ │ │ +487 auto&& xx = Impl::asVector(x); │ │ │ │ │ +488 auto&& yy = Impl::asVector(y); │ │ │ │ │ +489 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _M()); │ │ │ │ │ +490 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _N()); │ │ │ │ │ +491 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +492 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +493 yy[i] += alpha * (*this)[i][j] * xx[j]; │ │ │ │ │ +494 } │ │ │ │ │ +495 │ │ │ │ │ +497 template │ │ │ │ │ +_4_9_8 void _u_s_m_t_v (const typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e & alpha, │ │ │ │ │ +499 const X& x, Y& y) const │ │ │ │ │ +500 { │ │ │ │ │ +501 auto&& xx = Impl::asVector(x); │ │ │ │ │ +502 auto&& yy = Impl::asVector(y); │ │ │ │ │ +503 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _N()); │ │ │ │ │ +504 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _M()); │ │ │ │ │ +505 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +506 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +507 yy[j] += alpha*(*this)[i][j]*xx[i]; │ │ │ │ │ +508 } │ │ │ │ │ +509 │ │ │ │ │ +511 template │ │ │ │ │ +_5_1_2 void _u_s_m_h_v (const typename _F_i_e_l_d_T_r_a_i_t_s_<_Y_>_:_:_f_i_e_l_d___t_y_p_e & alpha, │ │ │ │ │ +513 const X& x, Y& y) const │ │ │ │ │ +514 { │ │ │ │ │ +515 auto&& xx = Impl::asVector(x); │ │ │ │ │ +516 auto&& yy = Impl::asVector(y); │ │ │ │ │ +517 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(xx.N() == _N()); │ │ │ │ │ +518 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(yy.N() == _M()); │ │ │ │ │ +519 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +520 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) │ │ │ │ │ +521 yy[j] += │ │ │ │ │ +522 alpha*_c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x((*this)[i][j])*xx[i]; │ │ │ │ │ +523 } │ │ │ │ │ +524 │ │ │ │ │ +525 //===== norms │ │ │ │ │ +526 │ │ │ │ │ +_5_2_8 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ │ +529 { │ │ │ │ │ +530 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e sum=(0.0); │ │ │ │ │ +531 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); ++i) sum += (*this)[i].two_norm2(); │ │ │ │ │ +532 return fvmeta::sqrt(sum); │ │ │ │ │ +533 } │ │ │ │ │ +534 │ │ │ │ │ +_5_3_6 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ +537 { │ │ │ │ │ +538 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e sum=(0.0); │ │ │ │ │ +539 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); ++i) sum += (*this)[i].two_norm2(); │ │ │ │ │ +540 return sum; │ │ │ │ │ +541 } │ │ │ │ │ +542 │ │ │ │ │ +544 template ::value, int>::type = 0> │ │ │ │ │ +_5_4_6 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +547 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +548 using std::max; │ │ │ │ │ +549 │ │ │ │ │ +550 real_type norm = 0; │ │ │ │ │ +551 for (auto const &x : *this) { │ │ │ │ │ +552 real_type const a = x.one_norm(); │ │ │ │ │ +553 norm = max(a, norm); │ │ │ │ │ +554 } │ │ │ │ │ +555 return norm; │ │ │ │ │ +556 } │ │ │ │ │ +557 │ │ │ │ │ +559 template ::value, int>::type = 0> │ │ │ │ │ +_5_6_1 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +562 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +563 using std::max; │ │ │ │ │ +564 │ │ │ │ │ +565 real_type norm = 0; │ │ │ │ │ +566 for (auto const &x : *this) { │ │ │ │ │ +567 real_type const a = x.one_norm_real(); │ │ │ │ │ +568 norm = max(a, norm); │ │ │ │ │ +569 } │ │ │ │ │ +570 return norm; │ │ │ │ │ +571 } │ │ │ │ │ +572 │ │ │ │ │ +574 template ::value, int>::type = 0> │ │ │ │ │ +_5_7_6 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +577 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +578 using std::max; │ │ │ │ │ +579 │ │ │ │ │ +580 real_type norm = 0; │ │ │ │ │ +581 real_type isNaN = 1; │ │ │ │ │ +582 for (auto const &x : *this) { │ │ │ │ │ +583 real_type const a = x.one_norm(); │ │ │ │ │ +584 norm = max(a, norm); │ │ │ │ │ +585 isNaN += a; │ │ │ │ │ +586 } │ │ │ │ │ +587 return norm * (isNaN / isNaN); │ │ │ │ │ +588 } │ │ │ │ │ +589 │ │ │ │ │ +591 template ::value, int>::type = 0> │ │ │ │ │ +_5_9_3 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +594 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +595 using std::max; │ │ │ │ │ +596 │ │ │ │ │ +597 real_type norm = 0; │ │ │ │ │ +598 real_type isNaN = 1; │ │ │ │ │ +599 for (auto const &x : *this) { │ │ │ │ │ +600 real_type const a = x.one_norm_real(); │ │ │ │ │ +601 norm = max(a, norm); │ │ │ │ │ +602 isNaN += a; │ │ │ │ │ +603 } │ │ │ │ │ +604 return norm * (isNaN / isNaN); │ │ │ │ │ +605 } │ │ │ │ │ +606 │ │ │ │ │ +607 //===== solve │ │ │ │ │ +608 │ │ │ │ │ +613 template │ │ │ │ │ +_6_1_4 void _s_o_l_v_e (V1& x, const V2& b, bool doPivoting = true) const; │ │ │ │ │ +615 │ │ │ │ │ +_6_2_0 void _i_n_v_e_r_t(bool doPivoting = true); │ │ │ │ │ +621 │ │ │ │ │ +_6_2_3 _f_i_e_l_d___t_y_p_e _d_e_t_e_r_m_i_n_a_n_t (bool doPivoting = true) const; │ │ │ │ │ +624 │ │ │ │ │ +626 template │ │ │ │ │ +_6_2_7 MAT& _l_e_f_t_m_u_l_t_i_p_l_y (const _D_e_n_s_e_M_a_t_r_i_x_<_M_2_>& _M) │ │ │ │ │ +628 { │ │ │ │ │ +629 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_M.rows() == _M.cols()); │ │ │ │ │ +630 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_M.rows() == _r_o_w_s()); │ │ │ │ │ +631 _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_<_M_A_T_> C(asImp()); │ │ │ │ │ +632 │ │ │ │ │ +633 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +634 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) { │ │ │ │ │ +635 (*this)[i][j] = 0; │ │ │ │ │ +636 for (_s_i_z_e___t_y_p_e k=0; k<_r_o_w_s(); k++) │ │ │ │ │ +637 (*this)[i][j] += _M[i][k]*C[k][j]; │ │ │ │ │ +638 } │ │ │ │ │ +639 │ │ │ │ │ +640 return asImp(); │ │ │ │ │ +641 } │ │ │ │ │ +642 │ │ │ │ │ +644 template │ │ │ │ │ +_6_4_5 MAT& _r_i_g_h_t_m_u_l_t_i_p_l_y (const _D_e_n_s_e_M_a_t_r_i_x_<_M_2_>& _M) │ │ │ │ │ +646 { │ │ │ │ │ +647 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_M.rows() == _M.cols()); │ │ │ │ │ +648 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(_M.cols() == _c_o_l_s()); │ │ │ │ │ +649 _A_u_t_o_n_o_m_o_u_s_V_a_l_u_e_<_M_A_T_> C(asImp()); │ │ │ │ │ +650 │ │ │ │ │ +651 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) │ │ │ │ │ +652 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s(); j++) { │ │ │ │ │ +653 (*this)[i][j] = 0; │ │ │ │ │ +654 for (_s_i_z_e___t_y_p_e k=0; k<_c_o_l_s(); k++) │ │ │ │ │ +655 (*this)[i][j] += C[i][k]*_M[k][j]; │ │ │ │ │ +656 } │ │ │ │ │ +657 return asImp(); │ │ │ │ │ +658 } │ │ │ │ │ +659 │ │ │ │ │ +660#if 0 │ │ │ │ │ +662 template │ │ │ │ │ +663 _D_e_n_s_e_M_a_t_r_i_x_<_K_,_l_,_c_o_l_s_> leftmultiplyany (const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_l_,_r_o_w_s_>& _M) │ │ │ │ │ +const │ │ │ │ │ +664 { │ │ │ │ │ +665 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_l_,_c_o_l_s_> C; │ │ │ │ │ +666 │ │ │ │ │ +667 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +679 FieldMatrix rightmultiplyany (const FieldMatrix& _M) │ │ │ │ │ +const │ │ │ │ │ +680 { │ │ │ │ │ +681 FieldMatrix C; │ │ │ │ │ +682 │ │ │ │ │ +683 for (_s_i_z_e___t_y_p_e i=0; i<_r_o_w_s(); i++) { │ │ │ │ │ +684 for (_s_i_z_e___t_y_p_e j=0; j= 0 && i < _r_o_w_s()); │ │ │ │ │ +726 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(j >= 0 && j < _c_o_l_s()); │ │ │ │ │ +727 return true; │ │ │ │ │ +728 } │ │ │ │ │ +729 │ │ │ │ │ +730 protected: │ │ │ │ │ +731 │ │ │ │ │ +732#ifndef DOXYGEN │ │ │ │ │ +733 struct ElimPivot │ │ │ │ │ +734 { │ │ │ │ │ +735 ElimPivot(std::vector & pivot); │ │ │ │ │ +736 │ │ │ │ │ +737 void _s_w_a_p(std::size_t i, simd_index_type j); │ │ │ │ │ +738 │ │ │ │ │ +739 template │ │ │ │ │ +740 void operator()(const T&, int, int) │ │ │ │ │ +741 {} │ │ │ │ │ +742 │ │ │ │ │ +743 std::vector & pivot_; │ │ │ │ │ +744 }; │ │ │ │ │ +745 │ │ │ │ │ +746 template │ │ │ │ │ +747 struct Elim │ │ │ │ │ +748 { │ │ │ │ │ +749 Elim(V& rhs); │ │ │ │ │ +750 │ │ │ │ │ +751 void _s_w_a_p(std::size_t i, simd_index_type j); │ │ │ │ │ +752 │ │ │ │ │ +753 void operator()(const typename V::field_type& factor, int k, int i); │ │ │ │ │ +754 │ │ │ │ │ +755 V* rhs_; │ │ │ │ │ +756 }; │ │ │ │ │ +757 │ │ │ │ │ +758 struct ElimDet │ │ │ │ │ +759 { │ │ │ │ │ +760 ElimDet(field_type& sign) : sign_(_s_i_g_n) │ │ │ │ │ +761 { sign_ = 1; } │ │ │ │ │ +762 │ │ │ │ │ +763 void _s_w_a_p(std::size_t i, simd_index_type j) │ │ │ │ │ +764 { │ │ │ │ │ +765 sign_ *= │ │ │ │ │ +766 Simd::cond(simd_index_type(i) == j, field_type(1), field_type(-1)); │ │ │ │ │ +767 } │ │ │ │ │ +768 │ │ │ │ │ +769 void operator()(const field_type&, int, int) │ │ │ │ │ +770 {} │ │ │ │ │ +771 │ │ │ │ │ +772 field_type& sign_; │ │ │ │ │ +773 }; │ │ │ │ │ +774#endif // DOXYGEN │ │ │ │ │ +775 │ │ │ │ │ +777 │ │ │ │ │ +815 template │ │ │ │ │ +_8_1_6 static void _l_u_D_e_c_o_m_p_o_s_i_t_i_o_n(_D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>& A, Func func, │ │ │ │ │ +817 Mask &nonsingularLanes, bool throwEarly, bool doPivoting); │ │ │ │ │ +818 }; │ │ │ │ │ +819 │ │ │ │ │ +820#ifndef DOXYGEN │ │ │ │ │ +821 template │ │ │ │ │ +822 _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_:_E_l_i_m_P_i_v_o_t_:_:_E_l_i_m_P_i_v_o_t(std::vector & │ │ │ │ │ +pivot) │ │ │ │ │ +823 : pivot_(pivot) │ │ │ │ │ +824 { │ │ │ │ │ +825 typedef typename std::vector::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +826 for(_s_i_z_e___t_y_p_e i=0; i < pivot_.size(); ++i) pivot_[i]=i; │ │ │ │ │ +827 } │ │ │ │ │ +828 │ │ │ │ │ +829 template │ │ │ │ │ +830 void DenseMatrix::ElimPivot::swap(std::size_t i, simd_index_type j) │ │ │ │ │ +831 { │ │ │ │ │ +832 pivot_[i] = │ │ │ │ │ +833 _S_i_m_d_:_:_c_o_n_d(Simd::Scalar(i) == j, pivot_[i], j); │ │ │ │ │ +834 } │ │ │ │ │ +835 │ │ │ │ │ +836 template │ │ │ │ │ +837 template │ │ │ │ │ +838 DenseMatrix::Elim::Elim(V& rhs) │ │ │ │ │ +839 : rhs_(&rhs) │ │ │ │ │ +840 {} │ │ │ │ │ +841 │ │ │ │ │ +842 template │ │ │ │ │ +843 template │ │ │ │ │ +844 void DenseMatrix::Elim::swap(std::size_t i, simd_index_type j) │ │ │ │ │ +845 { │ │ │ │ │ +846 using std::swap; │ │ │ │ │ +847 │ │ │ │ │ +848 // see the comment in luDecomposition() │ │ │ │ │ +849 for(std::size_t l = 0; l < _S_i_m_d_:_:_l_a_n_e_s(j); ++l) │ │ │ │ │ +850 _s_w_a_p(_S_i_m_d_:_:_l_a_n_e(l, (*rhs_)[ i ]), │ │ │ │ │ +851 _S_i_m_d_:_:_l_a_n_e(l, (*rhs_)[_S_i_m_d_:_:_l_a_n_e(l, j)])); │ │ │ │ │ +852 } │ │ │ │ │ +853 │ │ │ │ │ +854 template │ │ │ │ │ +855 template │ │ │ │ │ +856 void DenseMatrix:: │ │ │ │ │ +857 Elim::operator()(const typename V::field_type& factor, int k, int i) │ │ │ │ │ +858 { │ │ │ │ │ +859 (*rhs_)[k] -= factor*(*rhs_)[i]; │ │ │ │ │ +860 } │ │ │ │ │ +861 │ │ │ │ │ +862 template │ │ │ │ │ +863 template │ │ │ │ │ +864 inline void _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_: │ │ │ │ │ +865_ _l_u_D_e_c_o_m_p_o_s_i_t_i_o_n(DenseMatrix& A, Func func, Mask &nonsingularLanes, │ │ │ │ │ +866 bool throwEarly, bool doPivoting) │ │ │ │ │ +867 { │ │ │ │ │ +868 using std::max; │ │ │ │ │ +869 using std::swap; │ │ │ │ │ +870 │ │ │ │ │ +871 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e real_type; │ │ │ │ │ +872 │ │ │ │ │ +873 // LU decomposition of A in A │ │ │ │ │ +874 for (size_type i=0; i pivmax; │ │ │ │ │ +886 pivmax = _S_i_m_d_:_:_c_o_n_d(mask, abs, pivmax); │ │ │ │ │ +887 imax = _S_i_m_d_:_:_c_o_n_d(mask, simd_index_type(k), imax); │ │ │ │ │ +888 } │ │ │ │ │ +889 // swap rows │ │ │ │ │ +890 for (size_type j=0; j │ │ │ │ │ +933 template │ │ │ │ │ +934 inline void _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_:_s_o_l_v_e(V1& x, const V2& b, bool doPivoting) │ │ │ │ │ +const │ │ │ │ │ +935 { │ │ │ │ │ +936 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +937 // never mind those ifs, because they get optimized away │ │ │ │ │ +938 if (rows()!=cols()) │ │ │ │ │ +939 _D_U_N_E___T_H_R_O_W(FMatrixError, "Can't solve for a " << rows() << "x" << cols() << │ │ │ │ │ +" matrix!"); │ │ │ │ │ +940 │ │ │ │ │ +941 if (rows()==1) { │ │ │ │ │ +942 │ │ │ │ │ +943#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +944 if (_S_i_m_d_:_:_a_n_y_T_r_u_e(fvmeta::absreal((*this)[0][0]) │ │ │ │ │ +945 < _F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_<_>_:_:_a_b_s_o_l_u_t_e___l_i_m_i_t())) │ │ │ │ │ +946 _D_U_N_E___T_H_R_O_W(FMatrixError,"matrix is singular"); │ │ │ │ │ +947#endif │ │ │ │ │ +948 x[0] = b[0]/(*this)[0][0]; │ │ │ │ │ +949 │ │ │ │ │ +950 } │ │ │ │ │ +951 else if (rows()==2) { │ │ │ │ │ +952 │ │ │ │ │ +953 field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1] │ │ │ │ │ +[0]; │ │ │ │ │ +954#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +955 if (_S_i_m_d_:_:_a_n_y_T_r_u_e(fvmeta::absreal(detinv) │ │ │ │ │ +956 < _F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_<_>_:_:_a_b_s_o_l_u_t_e___l_i_m_i_t())) │ │ │ │ │ +957 _D_U_N_E___T_H_R_O_W(FMatrixError,"matrix is singular"); │ │ │ │ │ +958#endif │ │ │ │ │ +959 detinv = real_type(1.0)/detinv; │ │ │ │ │ +960 │ │ │ │ │ +961 x[0] = detinv*((*this)[1][1]*b[0]-(*this)[0][1]*b[1]); │ │ │ │ │ +962 x[1] = detinv*((*this)[0][0]*b[1]-(*this)[1][0]*b[0]); │ │ │ │ │ +963 │ │ │ │ │ +964 } │ │ │ │ │ +965 else if (rows()==3) { │ │ │ │ │ +966 │ │ │ │ │ +967 field_type d = determinant(doPivoting); │ │ │ │ │ +968#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +969 if (_S_i_m_d_:_:_a_n_y_T_r_u_e(fvmeta::absreal(d) │ │ │ │ │ +970 < _F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_<_>_:_:_a_b_s_o_l_u_t_e___l_i_m_i_t())) │ │ │ │ │ +971 _D_U_N_E___T_H_R_O_W(FMatrixError,"matrix is singular"); │ │ │ │ │ +972#endif │ │ │ │ │ +973 │ │ │ │ │ +974 x[0] = (b[0]*(*this)[1][1]*(*this)[2][2] - b[0]*(*this)[2][1]*(*this)[1][2] │ │ │ │ │ +975 - b[1] *(*this)[0][1]*(*this)[2][2] + b[1]*(*this)[2][1]*(*this)[0][2] │ │ │ │ │ +976 + b[2] *(*this)[0][1]*(*this)[1][2] - b[2]*(*this)[1][1]*(*this)[0][2]) / │ │ │ │ │ +d; │ │ │ │ │ +977 │ │ │ │ │ +978 x[1] = ((*this)[0][0]*b[1]*(*this)[2][2] - (*this)[0][0]*b[2]*(*this)[1][2] │ │ │ │ │ +979 - (*this)[1][0] *b[0]*(*this)[2][2] + (*this)[1][0]*b[2]*(*this)[0][2] │ │ │ │ │ +980 + (*this)[2][0] *b[0]*(*this)[1][2] - (*this)[2][0]*b[1]*(*this)[0][2]) / │ │ │ │ │ +d; │ │ │ │ │ +981 │ │ │ │ │ +982 x[2] = ((*this)[0][0]*(*this)[1][1]*b[2] - (*this)[0][0]*(*this)[2][1]*b[1] │ │ │ │ │ +983 - (*this)[1][0] *(*this)[0][1]*b[2] + (*this)[1][0]*(*this)[2][1]*b[0] │ │ │ │ │ +984 + (*this)[2][0] *(*this)[0][1]*b[1] - (*this)[2][0]*(*this)[1][1]*b[0]) / │ │ │ │ │ +d; │ │ │ │ │ +985 │ │ │ │ │ +986 } │ │ │ │ │ +987 else { │ │ │ │ │ +988 │ │ │ │ │ +989 V1& rhs = x; // use x to store rhs │ │ │ │ │ +990 rhs = b; // copy data │ │ │ │ │ +991 Elim elim(rhs); │ │ │ │ │ +992 AutonomousValue A(asImp()); │ │ │ │ │ +993 Simd::Mask::real_type> │ │ │ │ │ +994 nonsingularLanes(true); │ │ │ │ │ +995 │ │ │ │ │ +996 AutonomousValue::luDecomposition(A, elim, nonsingularLanes, true, │ │ │ │ │ +doPivoting); │ │ │ │ │ +997 │ │ │ │ │ +998 // backsolve │ │ │ │ │ +999 for(int i=rows()-1; i>=0; i--) { │ │ │ │ │ +1000 for (size_type j=i+1; j │ │ │ │ │ +1008 inline void _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_:_i_n_v_e_r_t(bool doPivoting) │ │ │ │ │ +1009 { │ │ │ │ │ +1010 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_M_A_T_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +1011 using std::swap; │ │ │ │ │ +1012 │ │ │ │ │ +1013 // never mind those ifs, because they get optimized away │ │ │ │ │ +1014 if (rows()!=cols()) │ │ │ │ │ +1015 _D_U_N_E___T_H_R_O_W(FMatrixError, "Can't invert a " << rows() << "x" << cols() << " │ │ │ │ │ +matrix!"); │ │ │ │ │ +1016 │ │ │ │ │ +1017 if (rows()==1) { │ │ │ │ │ +1018 │ │ │ │ │ +1019#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +1020 if (_S_i_m_d_:_:_a_n_y_T_r_u_e(fvmeta::absreal((*this)[0][0]) │ │ │ │ │ +1021 < _F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_<_>_:_:_a_b_s_o_l_u_t_e___l_i_m_i_t())) │ │ │ │ │ +1022 _D_U_N_E___T_H_R_O_W(FMatrixError,"matrix is singular"); │ │ │ │ │ +1023#endif │ │ │ │ │ +1024 (*this)[0][0] = real_type( 1 ) / (*this)[0][0]; │ │ │ │ │ +1025 │ │ │ │ │ +1026 } │ │ │ │ │ +1027 else if (rows()==2) { │ │ │ │ │ +1028 │ │ │ │ │ +1029 field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1] │ │ │ │ │ +[0]; │ │ │ │ │ +1030#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +1031 if (_S_i_m_d_:_:_a_n_y_T_r_u_e(fvmeta::absreal(detinv) │ │ │ │ │ +1032 < _F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_<_>_:_:_a_b_s_o_l_u_t_e___l_i_m_i_t())) │ │ │ │ │ +1033 _D_U_N_E___T_H_R_O_W(FMatrixError,"matrix is singular"); │ │ │ │ │ +1034#endif │ │ │ │ │ +1035 detinv = real_type( 1 ) / detinv; │ │ │ │ │ +1036 │ │ │ │ │ +1037 field_type temp=(*this)[0][0]; │ │ │ │ │ +1038 (*this)[0][0] = (*this)[1][1]*detinv; │ │ │ │ │ +1039 (*this)[0][1] = -(*this)[0][1]*detinv; │ │ │ │ │ +1040 (*this)[1][0] = -(*this)[1][0]*detinv; │ │ │ │ │ +1041 (*this)[1][1] = temp*detinv; │ │ │ │ │ +1042 │ │ │ │ │ +1043 } │ │ │ │ │ +1044 else if (rows()==3) │ │ │ │ │ +1045 { │ │ │ │ │ +1046 using K = field_type; │ │ │ │ │ +1047 // code generated by maple │ │ │ │ │ +1048 K t4 = (*this)[0][0] * (*this)[1][1]; │ │ │ │ │ +1049 K t6 = (*this)[0][0] * (*this)[1][2]; │ │ │ │ │ +1050 K t8 = (*this)[0][1] * (*this)[1][0]; │ │ │ │ │ +1051 K t10 = (*this)[0][2] * (*this)[1][0]; │ │ │ │ │ +1052 K t12 = (*this)[0][1] * (*this)[2][0]; │ │ │ │ │ +1053 K t14 = (*this)[0][2] * (*this)[2][0]; │ │ │ │ │ +1054 │ │ │ │ │ +1055 K det = (t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+ │ │ │ │ │ +1056 t10*(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]); │ │ │ │ │ +1057 K t17 = K(1.0)/det; │ │ │ │ │ +1058 │ │ │ │ │ +1059 K matrix01 = (*this)[0][1]; │ │ │ │ │ +1060 K matrix00 = (*this)[0][0]; │ │ │ │ │ +1061 K matrix10 = (*this)[1][0]; │ │ │ │ │ +1062 K matrix11 = (*this)[1][1]; │ │ │ │ │ +1063 │ │ │ │ │ +1064 (*this)[0][0] = ((*this)[1][1] * (*this)[2][2] - (*this)[1][2] * (*this) │ │ │ │ │ +[2][1])*t17; │ │ │ │ │ +1065 (*this)[0][1] = -((*this)[0][1] * (*this)[2][2] - (*this)[0][2] * (*this) │ │ │ │ │ +[2][1])*t17; │ │ │ │ │ +1066 (*this)[0][2] = (matrix01 * (*this)[1][2] - (*this)[0][2] * (*this)[1] │ │ │ │ │ +[1])*t17; │ │ │ │ │ +1067 (*this)[1][0] = -((*this)[1][0] * (*this)[2][2] - (*this)[1][2] * (*this) │ │ │ │ │ +[2][0])*t17; │ │ │ │ │ +1068 (*this)[1][1] = (matrix00 * (*this)[2][2] - t14) * t17; │ │ │ │ │ +1069 (*this)[1][2] = -(t6-t10) * t17; │ │ │ │ │ +1070 (*this)[2][0] = (matrix10 * (*this)[2][1] - matrix11 * (*this)[2][0]) * │ │ │ │ │ +t17; │ │ │ │ │ +1071 (*this)[2][1] = -(matrix00 * (*this)[2][1] - t12) * t17; │ │ │ │ │ +1072 (*this)[2][2] = (t4-t8) * t17; │ │ │ │ │ +1073 } │ │ │ │ │ +1074 else { │ │ │ │ │ +1075 using std::swap; │ │ │ │ │ +1076 │ │ │ │ │ +1077 AutonomousValue A(asImp()); │ │ │ │ │ +1078 std::vector pivot(rows()); │ │ │ │ │ +1079 Simd::Mask::real_type> │ │ │ │ │ +1080 nonsingularLanes(true); │ │ │ │ │ +1081 AutonomousValue::luDecomposition(A, ElimPivot(pivot), │ │ │ │ │ +nonsingularLanes, true, doPivoting); │ │ │ │ │ +1082 auto& L=A; │ │ │ │ │ +1083 auto& U=A; │ │ │ │ │ +1084 │ │ │ │ │ +1085 // initialize inverse │ │ │ │ │ +1086 *this=field_type(); │ │ │ │ │ +1087 │ │ │ │ │ +1088 for(size_type i=0; i0;) { │ │ │ │ │ +1099 --i; │ │ │ │ │ +1100 for (size_type k=0; k0; ) { │ │ │ │ │ +1108 --i; │ │ │ │ │ +1109 for(std::size_t l = 0; l < _S_i_m_d_:_:_l_a_n_e_s((*this)[0][0]); ++l) │ │ │ │ │ +1110 { │ │ │ │ │ +1111 std::size_t pi = _S_i_m_d_:_:_l_a_n_e(l, pivot[i]); │ │ │ │ │ +1112 if(i!=pi) │ │ │ │ │ +1113 for(size_type j=0; j │ │ │ │ │ +1123 inline typename _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +1124 _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_:_d_e_t_e_r_m_i_n_a_n_t(bool doPivoting) const │ │ │ │ │ +1125 { │ │ │ │ │ +1126 // never mind those ifs, because they get optimized away │ │ │ │ │ +1127 if (rows()!=cols()) │ │ │ │ │ +1128 _D_U_N_E___T_H_R_O_W(FMatrixError, "There is no determinant for a " << rows() << "x" │ │ │ │ │ +<< cols() << " matrix!"); │ │ │ │ │ +1129 │ │ │ │ │ +1130 if (rows()==1) │ │ │ │ │ +1131 return (*this)[0][0]; │ │ │ │ │ +1132 │ │ │ │ │ +1133 if (rows()==2) │ │ │ │ │ +1134 return (*this)[0][0]*(*this)[1][1] - (*this)[0][1]*(*this)[1][0]; │ │ │ │ │ +1135 │ │ │ │ │ +1136 if (rows()==3) { │ │ │ │ │ +1137 // code generated by maple │ │ │ │ │ +1138 field_type t4 = (*this)[0][0] * (*this)[1][1]; │ │ │ │ │ +1139 field_type t6 = (*this)[0][0] * (*this)[1][2]; │ │ │ │ │ +1140 field_type t8 = (*this)[0][1] * (*this)[1][0]; │ │ │ │ │ +1141 field_type t10 = (*this)[0][2] * (*this)[1][0]; │ │ │ │ │ +1142 field_type t12 = (*this)[0][1] * (*this)[2][0]; │ │ │ │ │ +1143 field_type t14 = (*this)[0][2] * (*this)[2][0]; │ │ │ │ │ +1144 │ │ │ │ │ +1145 return (t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+ │ │ │ │ │ +1146 t10*(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]); │ │ │ │ │ +1147 │ │ │ │ │ +1148 } │ │ │ │ │ +1149 │ │ │ │ │ +1150 AutonomousValue A(asImp()); │ │ │ │ │ +1151 field_type det; │ │ │ │ │ +1152 Simd::Mask::real_type> │ │ │ │ │ +1153 nonsingularLanes(true); │ │ │ │ │ +1154 │ │ │ │ │ +1155 AutonomousValue::luDecomposition(A, ElimDet(det), nonsingularLanes, │ │ │ │ │ +false, doPivoting); │ │ │ │ │ +1156 det = _S_i_m_d_:_:_c_o_n_d(nonsingularLanes, det, field_type(0)); │ │ │ │ │ +1157 │ │ │ │ │ +1158 for (size_type i = 0; i < rows(); ++i) │ │ │ │ │ +1159 det *= A[i][i]; │ │ │ │ │ +1160 return det; │ │ │ │ │ +1161 } │ │ │ │ │ +1162 │ │ │ │ │ +1163#endif // DOXYGEN │ │ │ │ │ +1164 │ │ │ │ │ +_1_1_6_5 namespace DenseMatrixHelp { │ │ │ │ │ +1166 │ │ │ │ │ +1168 template │ │ │ │ │ +_1_1_6_9 static inline void _m_u_l_t_A_s_s_i_g_n(const _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_> &matrix, const │ │ │ │ │ +_D_e_n_s_e_V_e_c_t_o_r_<_V_1_> & x, _D_e_n_s_e_V_e_c_t_o_r_<_V_2_> & ret) │ │ │ │ │ +1170 { │ │ │ │ │ +1171 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(x._s_i_z_e() == matrix._c_o_l_s()); │ │ │ │ │ +1172 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(ret._s_i_z_e() == matrix._r_o_w_s()); │ │ │ │ │ +1173 typedef typename _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ +1174 │ │ │ │ │ +1175 for(size_type i=0; i │ │ │ │ │ +1188 static inline void multAssignTransposed( const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_> │ │ │ │ │ +&matrix, const _F_i_e_l_d_V_e_c_t_o_r_<_K_,_r_o_w_s_> & x, _F_i_e_l_d_V_e_c_t_o_r_<_K_,_c_o_l_s_> & ret) │ │ │ │ │ +1189 { │ │ │ │ │ +1190 typedef typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_r_o_w_s_,_c_o_l_s_>_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ +1191 │ │ │ │ │ +1192 for(size_type i=0; i │ │ │ │ │ +1202 static inline FieldVector mult(const FieldMatrix │ │ │ │ │ +&matrix, const FieldVector & x) │ │ │ │ │ +1203 { │ │ │ │ │ +1204 FieldVector ret; │ │ │ │ │ +1205 _m_u_l_t_A_s_s_i_g_n(matrix,x,ret); │ │ │ │ │ +1206 return ret; │ │ │ │ │ +1207 } │ │ │ │ │ +1208 │ │ │ │ │ +1210 template │ │ │ │ │ +1211 static inline FieldVector multTransposed(const │ │ │ │ │ +FieldMatrix &matrix, const FieldVector & x) │ │ │ │ │ +1212 { │ │ │ │ │ +1213 FieldVector ret; │ │ │ │ │ +1214 multAssignTransposed( matrix, x, ret ); │ │ │ │ │ +1215 return ret; │ │ │ │ │ +1216 } │ │ │ │ │ +1217#endif │ │ │ │ │ +1218 │ │ │ │ │ +1219 } // end namespace DenseMatrixHelp │ │ │ │ │ +1220 │ │ │ │ │ +1222 template │ │ │ │ │ +_1_2_2_3 std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>& a) │ │ │ │ │ +1224 { │ │ │ │ │ +1225 for (typename _D_e_n_s_e_M_a_t_r_i_x_<_M_A_T_>_:_:_s_i_z_e___t_y_p_e i=0; i::type AutonomousValue │ │ │ │ │ +Type free of internal references that T can be converted to. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:558 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ +_D_U_N_E___T_H_R_O_W │ │ │ │ │ +#define DUNE_THROW(E, m) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_n_y_T_r_u_e │ │ │ │ │ +bool anyTrue(const Mask &mask) │ │ │ │ │ +Whether any entry is true │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:429 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_c_o_n_d │ │ │ │ │ +V cond(M &&mask, const V &ifTrue, const V &ifFalse) │ │ │ │ │ +Like the ?: operator. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:386 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_a_l_l_T_r_u_e │ │ │ │ │ +bool allTrue(const Mask &mask) │ │ │ │ │ +Whether all entries are true │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:439 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_R_e_b_i_n_d │ │ │ │ │ +typename Overloads::RebindType< std::decay_t< S >, std::decay_t< V > >::type │ │ │ │ │ +Rebind │ │ │ │ │ +Construct SIMD type with different scalar type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:253 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e_s │ │ │ │ │ +constexpr std::size_t lanes() │ │ │ │ │ +Number of lanes in a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:305 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_l_a_n_e │ │ │ │ │ +decltype(auto) lane(std::size_t l, V &&v) │ │ │ │ │ +Extract an element of a SIMD type. │ │ │ │ │ +DDeeffiinniittiioonn simd/interface.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_S_i_m_d_:_:_O_v_e_r_l_o_a_d_s_:_:_m_a_s_k │ │ │ │ │ +Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) │ │ │ │ │ +implements Simd::mask() │ │ │ │ │ +DDeeffiinniittiioonn defaults.hh:153 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_M_i_n │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:18 │ │ │ │ │ -_D_u_n_e_:_:_M_i_n_:_:_r_e_s_u_l_t___t_y_p_e │ │ │ │ │ -Type result_type │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_M_i_n_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -Type operator()(const Type &t1, const Type &t2) const │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_M_i_n_:_:_f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ -Type first_argument_type │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_M_i_n_:_:_s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ -Type second_argument_type │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:21 │ │ │ │ │ -_D_u_n_e_:_:_M_a_x │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:34 │ │ │ │ │ -_D_u_n_e_:_:_M_a_x_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -Type operator()(const Type &t1, const Type &t2) const │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_M_a_x_:_:_r_e_s_u_l_t___t_y_p_e │ │ │ │ │ -Type result_type │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:39 │ │ │ │ │ -_D_u_n_e_:_:_M_a_x_:_:_f_i_r_s_t___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ -Type first_argument_type │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:35 │ │ │ │ │ -_D_u_n_e_:_:_M_a_x_:_:_s_e_c_o_n_d___a_r_g_u_m_e_n_t___t_y_p_e │ │ │ │ │ -Type second_argument_type │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_s_w_a_p │ │ │ │ │ +void swap(T &v1, T &v2, bool mask) │ │ │ │ │ +DDeeffiinniittiioonn simd.hh:472 │ │ │ │ │ +_D_u_n_e_:_:_s_i_g_n │ │ │ │ │ +int sign(const T &val) │ │ │ │ │ +Return the sign of the value. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_j_u_g_a_t_e_C_o_m_p_l_e_x │ │ │ │ │ +K conjugateComplex(const K &x) │ │ │ │ │ +compute conjugate complex of x │ │ │ │ │ +DDeeffiinniittiioonn math.hh:164 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_H_e_l_p_:_:_m_u_l_t_A_s_s_i_g_n │ │ │ │ │ +static void multAssign(const DenseMatrix< MAT > &matrix, const DenseVector< V1 │ │ │ │ │ +> &x, DenseVector< V2 > &ret) │ │ │ │ │ +calculates ret = matrix * x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:1169 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x │ │ │ │ │ +A dense n x m matrix. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_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 densematrix.hh:244 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +derived_type operator-() const │ │ │ │ │ +Matrix negation. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:298 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ │ +void solve(V1 &x, const V2 &b, bool doPivoting=true) const │ │ │ │ │ +Solve system A x = b. │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ +void mv(const X &x, Y &y) const │ │ │ │ │ +y = A x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:368 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +Traits::value_type field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:160 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_a_x_p_y │ │ │ │ │ +derived_type & axpy(const field_type &a, const DenseMatrix< Other > &x) │ │ │ │ │ +vector space axpy operation (*this += a x) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:338 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +ConstIterator beforeEnd() const │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:264 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +derived_type & operator=(const RHS &rhs) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:279 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ +void mmtv(const X &x, Y &y) const │ │ │ │ │ +y -= A^T x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:458 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ +FieldTraits< vt >::real_type infinity_norm_real() const │ │ │ │ │ +simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +std::remove_reference< const_row_reference >::type::ConstIterator │ │ │ │ │ +ConstColIterator │ │ │ │ │ +rename the iterators for easier access │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:248 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +ConstIterator beforeBegin() const │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_i_n_v_e_r_t │ │ │ │ │ +void invert(bool doPivoting=true) │ │ │ │ │ +Compute inverse. │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_l_u_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ +static void luDecomposition(DenseMatrix< MAT > &A, Func func, Mask │ │ │ │ │ +&nonsingularLanes, bool throwEarly, bool doPivoting) │ │ │ │ │ +do an LU-Decomposition on matrix A │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +Traits::value_type block_type │ │ │ │ │ +export the type representing the components │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:163 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ +void mtv(const X &x, Y &y) const │ │ │ │ │ +y = A^T x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:387 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_c_o_l_s │ │ │ │ │ +constexpr size_type cols() const │ │ │ │ │ +number of columns │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:715 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +size method (number of rows) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:200 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_M │ │ │ │ │ +constexpr size_type M() const │ │ │ │ │ +number of columns │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:703 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_r_i_g_h_t_m_u_l_t_i_p_l_y │ │ │ │ │ +MAT & rightmultiply(const DenseMatrix< M2 > &M) │ │ │ │ │ +Multiplies M from the right to this matrix. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:645 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +Iterator end() │ │ │ │ │ +end iterator │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:222 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +Iterator beforeBegin() │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:236 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ +derived_type & operator/=(const field_type &k) │ │ │ │ │ +vector space division by scalar │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:329 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ +derived_type & operator*=(const field_type &k) │ │ │ │ │ +vector space multiplication with scalar │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:321 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +Iterator beforeEnd() │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +Traits::value_type value_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ +void usmv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) │ │ │ │ │ +const │ │ │ │ │ +y += alpha A x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:484 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ +void usmhv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y │ │ │ │ │ +&y) const │ │ │ │ │ +y += alpha A^H x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:512 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ +void mmv(const X &x, Y &y) const │ │ │ │ │ +y -= A x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:445 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_r_o_w_s │ │ │ │ │ +constexpr size_type rows() const │ │ │ │ │ +number of rows │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:709 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_l_e_f_t_m_u_l_t_i_p_l_y │ │ │ │ │ +MAT & leftmultiply(const DenseMatrix< M2 > &M) │ │ │ │ │ +Multiplies M from the left to this matrix. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:627 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ +void usmtv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y │ │ │ │ │ +&y) const │ │ │ │ │ +y += alpha A^T x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:498 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ +derived_type & operator-=(const DenseMatrix< Other > &x) │ │ │ │ │ +vector space subtraction │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:312 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const DenseMatrix< Other > &x) const │ │ │ │ │ +Binary matrix incomparison. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:358 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ +void mmhv(const X &x, Y &y) const │ │ │ │ │ +y -= A^H x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:471 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +Traits::derived_type derived_type │ │ │ │ │ +type of derived matrix class │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:154 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +row_reference operator[](size_type i) │ │ │ │ │ +random access │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_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 densematrix.hh:723 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_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 densematrix.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ +static constexpr int blocklevel │ │ │ │ │ +The number of block levels we contain. This is the leaf, that is, 1. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ +FieldTraits< value_type >::real_type frobenius_norm() const │ │ │ │ │ +frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:528 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ +void umv(const X &x, Y &y) const │ │ │ │ │ +y += A x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:406 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +DenseIterator< const DenseMatrix, const row_type, const_row_reference > │ │ │ │ │ +ConstIterator │ │ │ │ │ +Iterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:242 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ +FieldTraits< vt >::real_type infinity_norm() const │ │ │ │ │ +infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:546 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ +Traits::row_type row_type │ │ │ │ │ +The type used to represent a row (must fulfill the Dune::DenseVector interface) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:169 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_N │ │ │ │ │ +constexpr size_type N() const │ │ │ │ │ +number of rows │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:697 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Traits::size_type size_type │ │ │ │ │ +The type used for the index access and size operation. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_c_o_n_s_t___r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +Traits::const_row_reference const_row_reference │ │ │ │ │ +The type used to represent a reference to a constant row (usually const │ │ │ │ │ +row_type &) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ +FieldTraits< value_type >::real_type frobenius_norm2() const │ │ │ │ │ +square of frobenius norm, need for block recursion │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:536 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +std::remove_reference< row_reference >::type::Iterator ColIterator │ │ │ │ │ +rename the iterators for easier access │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:213 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_r_o_w___r_e_f_e_r_e_n_c_e │ │ │ │ │ +Traits::row_reference row_reference │ │ │ │ │ +The type used to represent a reference to a row (usually row_type &) │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:172 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const DenseMatrix< Other > &x) const │ │ │ │ │ +Binary matrix comparison. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:348 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +Iterator iterator │ │ │ │ │ +typedef for stl compliant access │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_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 densematrix.hh:246 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +DenseIterator< DenseMatrix, row_type, row_reference > Iterator │ │ │ │ │ +Iterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:207 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ +void umtv(const X &x, Y &y) const │ │ │ │ │ +y += A^T x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:419 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ +ConstIterator begin() const │ │ │ │ │ +begin iterator │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:251 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_d_e_t_e_r_m_i_n_a_n_t │ │ │ │ │ +field_type determinant(bool doPivoting=true) const │ │ │ │ │ +calculates the determinant of this matrix │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ +Iterator begin() │ │ │ │ │ +begin iterator │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ +void umhv(const X &x, Y &y) const │ │ │ │ │ +y += A^H x │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:432 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ +derived_type & operator+=(const DenseMatrix< Other > &x) │ │ │ │ │ +vector space addition │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:289 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +ConstIterator end() const │ │ │ │ │ +end iterator │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:257 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_e_n_s_e_M_a_t_r_i_x_<_ _M_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +const FieldTraits< typenameDenseMatVecTraits< M >::value_type >::real_type │ │ │ │ │ +real_type │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_e_n_s_e_M_a_t_r_i_x_<_ _M_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +const FieldTraits< typenameDenseMatVecTraits< M >::value_type >::field_type │ │ │ │ │ +field_type │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +A dense n x m matrix. │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:117 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Base::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn fmatrix.hh:127 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ +vector space out of a tensor product of fields. │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_A_s_s_i_g_n_e_r │ │ │ │ │ +you have to specialize this structure for any type that should be assignable to │ │ │ │ │ +a DenseMatrix │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ │ +Error thrown if operations of a FieldMatrix fail. │ │ │ │ │ +DDeeffiinniittiioonn densematrix.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r │ │ │ │ │ +Interface for a class of dense vectors over a given field. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +size method │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:336 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Generic iterator class for dense vector and matrix implementations. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_h_E_r_r_o_r │ │ │ │ │ +Default exception class for mathematical errors. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:241 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +T field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +T real_type │ │ │ │ │ +export the type representing the real type of the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn matvectraits.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_P_r_e_c_i_s_i_o_n_:_:_a_b_s_o_l_u_t_e___l_i_m_i_t │ │ │ │ │ +static ctype absolute_limit() │ │ │ │ │ +return threshold to declare matrix singular │ │ │ │ │ +DDeeffiinniittiioonn precision.hh:28 │ │ │ │ │ +_s_i_m_d_._h_h │ │ │ │ │ +Include file for users of the SIMD abstraction layer. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00197.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: poolallocator.hh File Reference │ │ │ │ +dune-common: ios_state.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,85 +71,40 @@ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
    │ │ │ │ -
    poolallocator.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ +
    ios_state.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    An stl-compliant pool allocator. │ │ │ │ +

    Utility class for storing and resetting stream attributes. │ │ │ │ More...

    │ │ │ │ -
    #include <numeric>
    │ │ │ │ -#include <typeinfo>
    │ │ │ │ -#include <iostream>
    │ │ │ │ -#include <cassert>
    │ │ │ │ -#include <new>
    │ │ │ │ +
    #include <ios>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::Pool< T, s >
     A memory pool of objects. More...
     
    class  Dune::PoolAllocator< T, s >
     An allocator managing a pool of objects for reuse. More...
     
    struct  Dune::PoolAllocator< T, s >::rebind< U >
     Rebind the allocator to another type. More...
     
    class  Dune::PoolAllocator< void, s >
     
    struct  Dune::PoolAllocator< void, s >::rebind< U >
    class  Dune::ios_base_all_saver
     Utility class for storing and resetting stream attributes. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  std
     STL namespace.
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

    │ │ │ │ -Functions

    template<typename T1 , std::size_t t1, typename T2 , std::size_t t2>
    bool Dune::operator== (const PoolAllocator< T1, t1 > &, const PoolAllocator< T2, t2 > &)
     
    template<typename T1 , std::size_t t1, typename T2 , std::size_t t2>
    bool Dune::operator!= (const PoolAllocator< T1, t1 > &, const PoolAllocator< T2, t2 > &)
     
    template<typename T , std::size_t t1, std::size_t t2>
    bool Dune::operator== (const PoolAllocator< T, t1 > &p1, const PoolAllocator< T, t2 > &p2)
     
    template<typename T , std::size_t t1, std::size_t t2>
    bool Dune::operator!= (const PoolAllocator< T, t1 > &p1, const PoolAllocator< T, t2 > &p2)
     
    template<typename T , std::size_t t1, std::size_t t2>
    bool Dune::operator== (const PoolAllocator< void, t1 > &, const PoolAllocator< T, t2 > &)
     
    template<typename T , std::size_t t1, std::size_t t2>
    bool Dune::operator!= (const PoolAllocator< void, t1 > &, const PoolAllocator< T, t2 > &)
     
    template<std::size_t t1, std::size_t t2>
    bool Dune::operator== (const PoolAllocator< void, t1 > &p1, const PoolAllocator< void, t2 > &p2)
     
    template<std::size_t t1, std::size_t t2>
    bool Dune::operator!= (const PoolAllocator< void, t1 > &p1, const PoolAllocator< void, t2 > &p2)
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    An stl-compliant pool allocator.

    │ │ │ │ -

    This file implements the classes Pool and PoolAllocator providing memory allocation for objects in chunks.

    Author
    Markus Blatt
    │ │ │ │ +

    Utility class for storing and resetting stream attributes.

    │ │ │ │ +
    Author
    Markus Blatt
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,77 +1,26 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_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 │ │ │ │ │ -poolallocator.hh File Reference │ │ │ │ │ -An stl-compliant pool allocator. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +ios_state.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n │ │ │ │ │ +Utility class for storing and resetting stream attributes. _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_:_:_P_o_o_l_<_ _T_,_ _s_ _> │ │ │ │ │ -  A memory pool of objects. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _T_,_ _s_ _> │ │ │ │ │ -  An allocator managing a pool of objects for reuse. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _T_,_ _s_ _>_:_:_r_e_b_i_n_d_<_ _U_ _> │ │ │ │ │ -  Rebind the allocator to another type. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _v_o_i_d_,_ _s_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _v_o_i_d_,_ _s_ _>_:_:_r_e_b_i_n_d_<_ _U_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_i_o_s___b_a_s_e___a_l_l___s_a_v_e_r │ │ │ │ │ +  Utility class for storing and resetting stream attributes. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _s_t_d │ │ │ │ │ -  STL namespace. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< T1, t1 > &, const _P_o_o_l_A_l_l_o_c_a_t_o_r< │ │ │ │ │ - T2, t2 > &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< T1, t1 > &, const _P_o_o_l_A_l_l_o_c_a_t_o_r< │ │ │ │ │ - T2, t2 > &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< T, t1 > &p1, const _P_o_o_l_A_l_l_o_c_a_t_o_r< │ │ │ │ │ - T, t2 > &p2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< T, t1 > &p1, const _P_o_o_l_A_l_l_o_c_a_t_o_r< │ │ │ │ │ - T, t2 > &p2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< void, t1 > &, const _P_o_o_l_A_l_l_o_c_a_t_o_r< │ │ │ │ │ - T, t2 > &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< void, t1 > &, const _P_o_o_l_A_l_l_o_c_a_t_o_r< │ │ │ │ │ - T, t2 > &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< void, t1 > &p1, const │ │ │ │ │ - _P_o_o_l_A_l_l_o_c_a_t_o_r< void, t2 > &p2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _P_o_o_l_A_l_l_o_c_a_t_o_r< void, t1 > &p1, const │ │ │ │ │ - _P_o_o_l_A_l_l_o_c_a_t_o_r< void, t2 > &p2) │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -An stl-compliant pool allocator. │ │ │ │ │ -This file implements the classes Pool and PoolAllocator providing memory │ │ │ │ │ -allocation for objects in chunks. │ │ │ │ │ +Utility class for storing and resetting stream attributes. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00197_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: poolallocator.hh Source File │ │ │ │ +dune-common: ios_state.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,519 +74,55 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    poolallocator.hh
    │ │ │ │ +
    ios_state.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_POOLALLOCATOR_HH
    │ │ │ │ -
    6#define DUNE_COMMON_POOLALLOCATOR_HH
    │ │ │ │ +
    5#ifndef DUNE_COMMON_IOS_STATE_HH
    │ │ │ │ +
    6#define DUNE_COMMON_IOS_STATE_HH
    │ │ │ │
    7
    │ │ │ │ -
    12#include <numeric>
    │ │ │ │ -
    13#include <typeinfo>
    │ │ │ │ -
    14#include <iostream>
    │ │ │ │ -
    15#include <cassert>
    │ │ │ │ -
    16#include <new>
    │ │ │ │ -
    17
    │ │ │ │ -
    18#ifndef DOXYGEN
    │ │ │ │ -
    19// forward declarations.
    │ │ │ │ -
    20// we need to know the test function to declare it friend
    │ │ │ │ -
    21template<std::size_t size, typename T>
    │ │ │ │ -
    22struct testPoolMain;
    │ │ │ │ -
    23#endif
    │ │ │ │ -
    24
    │ │ │ │ -
    25namespace Dune
    │ │ │ │ -
    26{
    │ │ │ │ -
    27
    │ │ │ │ -
    28 template<typename T, std::size_t s>
    │ │ │ │ -
    29 class Pool;
    │ │ │ │ -
    30
    │ │ │ │ -
    31 template<typename T, std::size_t s>
    │ │ │ │ -
    32 class PoolAllocator;
    │ │ │ │ -
    33
    │ │ │ │ -
    34}
    │ │ │ │ -
    35
    │ │ │ │ -
    36namespace std
    │ │ │ │ -
    37{
    │ │ │ │ -
    38 /*
    │ │ │ │ -
    39 template<class T, std::size_t S>
    │ │ │ │ -
    40 inline ostream& operator<<(ostream& os, Dune::Pool<T,S>& pool)
    │ │ │ │ -
    41 {
    │ │ │ │ -
    42 os<<"pool="<<&pool<<" allocated_="<<pool.allocated_;
    │ │ │ │ -
    43 return os;
    │ │ │ │ -
    44 }
    │ │ │ │ -
    45
    │ │ │ │ -
    46 template<class T, std::size_t S>
    │ │ │ │ -
    47 inline ostream& operator<<(ostream& os, Dune::PoolAllocator<T,S>& pool)
    │ │ │ │ -
    48 {
    │ │ │ │ -
    49 os<<pool.memoryPool_<<std::endl;
    │ │ │ │ -
    50 return os;
    │ │ │ │ -
    51 }
    │ │ │ │ -
    52 */
    │ │ │ │ -
    53}
    │ │ │ │ +
    8#include <ios>
    │ │ │ │ +
    9
    │ │ │ │ +
    10namespace Dune {
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    34 {
    │ │ │ │ +
    35 public:
    │ │ │ │ +
    37 typedef std::ios_base state_type;
    │ │ │ │ +
    38
    │ │ │ │ + │ │ │ │ +
    49
    │ │ │ │ + │ │ │ │
    54
    │ │ │ │ -
    55
    │ │ │ │ -
    56namespace Dune
    │ │ │ │ -
    57{
    │ │ │ │ -
    88 template<class T, std::size_t s>
    │ │ │ │ -
    │ │ │ │ -
    89 class Pool
    │ │ │ │ -
    90 {
    │ │ │ │ -
    91 // make the test function friend
    │ │ │ │ -
    92 friend struct ::testPoolMain<s,T>;
    │ │ │ │ -
    93
    │ │ │ │ -
    94 //friend std::ostream& std::operator<<<>(std::ostream&,Pool<T,s>&);
    │ │ │ │ -
    95 template< class, std::size_t > friend class PoolAllocator;
    │ │ │ │ -
    96
    │ │ │ │ -
    97 private:
    │ │ │ │ -
    98
    │ │ │ │ -
    100 struct Reference
    │ │ │ │ -
    101 {
    │ │ │ │ -
    102 Reference *next_;
    │ │ │ │ -
    103 };
    │ │ │ │ -
    104
    │ │ │ │ -
    105 public:
    │ │ │ │ -
    106
    │ │ │ │ -
    108 typedef T MemberType;
    │ │ │ │ -
    109
    │ │ │ │ -
    113 constexpr static int unionSize = (sizeof(MemberType) < sizeof(Reference)) ?
    │ │ │ │ -
    114 sizeof(Reference) : sizeof(MemberType);
    │ │ │ │ -
    115
    │ │ │ │ -
    120 constexpr static int size = (sizeof(MemberType) <= s && sizeof(Reference) <= s) ?
    │ │ │ │ -
    121 s : unionSize;
    │ │ │ │ -
    122
    │ │ │ │ -
    127 constexpr static int alignment = std::lcm(alignof(MemberType), alignof(Reference));
    │ │ │ │ -
    128
    │ │ │ │ -
    135 constexpr static int alignedSize = (unionSize % alignment == 0) ?
    │ │ │ │ -
    136 unionSize :
    │ │ │ │ -
    137 ((unionSize / alignment + 1) * alignment);
    │ │ │ │ -
    138
    │ │ │ │ -
    144 constexpr static int chunkSize = (size % alignment == 0) ?
    │ │ │ │ -
    145 size : ((size / alignment + 1)* alignment);
    │ │ │ │ -
    146
    │ │ │ │ -
    150 constexpr static int elements = (chunkSize / alignedSize);
    │ │ │ │ -
    151
    │ │ │ │ -
    152 private:
    │ │ │ │ -
    154 struct Chunk
    │ │ │ │ -
    155 {
    │ │ │ │ -
    156
    │ │ │ │ -
    157 //friend int testPool<s,T>();
    │ │ │ │ -
    158
    │ │ │ │ -
    160 alignas(alignment) char chunk_[chunkSize];
    │ │ │ │ -
    161
    │ │ │ │ -
    163 Chunk *next_;
    │ │ │ │ -
    164 };
    │ │ │ │ -
    165
    │ │ │ │ -
    166 public:
    │ │ │ │ -
    │ │ │ │ -
    168 inline Pool();
    │ │ │ │ -
    │ │ │ │ -
    170 inline ~Pool();
    │ │ │ │ -
    │ │ │ │ -
    175 inline void* allocate();
    │ │ │ │ -
    │ │ │ │ -
    180 inline void free(void* o);
    │ │ │ │ -
    181
    │ │ │ │ -
    │ │ │ │ -
    185 inline void print(std::ostream& os);
    │ │ │ │ -
    186
    │ │ │ │ -
    187 private:
    │ │ │ │ -
    188
    │ │ │ │ -
    189 // Prevent Copying!
    │ │ │ │ -
    190 Pool(const Pool<MemberType,s>&);
    │ │ │ │ -
    191
    │ │ │ │ -
    192 void operator=(const Pool<MemberType,s>& pool) const;
    │ │ │ │ -
    194 inline void grow();
    │ │ │ │ -
    196 Reference *head_;
    │ │ │ │ -
    198 Chunk *chunks_;
    │ │ │ │ -
    199 /* @brief The number of currently allocated elements. */
    │ │ │ │ -
    200 //size_t allocated_;
    │ │ │ │ -
    201
    │ │ │ │ -
    202 };
    │ │ │ │ -
    203
    │ │ │ │ -
    221 template<class T, std::size_t s>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    223 {
    │ │ │ │ -
    224 //friend std::ostream& std::operator<<<>(std::ostream&,PoolAllocator<T,s>&);
    │ │ │ │ -
    225
    │ │ │ │ -
    226 public:
    │ │ │ │ -
    230 typedef T value_type;
    │ │ │ │ -
    231
    │ │ │ │ -
    236 constexpr static int size = s * sizeof(value_type);
    │ │ │ │ -
    237
    │ │ │ │ -
    241 typedef T* pointer;
    │ │ │ │ -
    242
    │ │ │ │ -
    246 typedef const T* const_pointer;
    │ │ │ │ -
    247
    │ │ │ │ -
    251 typedef T& reference;
    │ │ │ │ -
    252
    │ │ │ │ -
    256 typedef const T& const_reference;
    │ │ │ │ -
    257
    │ │ │ │ -
    261 typedef std::size_t size_type;
    │ │ │ │ -
    262
    │ │ │ │ -
    266 typedef std::ptrdiff_t difference_type;
    │ │ │ │ -
    267
    │ │ │ │ -
    271 inline PoolAllocator();
    │ │ │ │ -
    272
    │ │ │ │ -
    276 template<typename U, std::size_t u>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    278 {
    │ │ │ │ -
    279 // we allow copying but never copy the pool
    │ │ │ │ -
    280 // to have a clear ownership of allocated pointers.
    │ │ │ │ -
    281 }
    │ │ │ │ -
    │ │ │ │ -
    282
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    285 {
    │ │ │ │ -
    286 // we allow copying but never copy the pool
    │ │ │ │ -
    287 // to have a clear ownership of allocated pointers.
    │ │ │ │ -
    288 // For this behaviour we have to implement
    │ │ │ │ -
    289 // the copy constructor, because the default
    │ │ │ │ -
    290 // one would copy the pool and deallocation
    │ │ │ │ -
    291 // of it would break.
    │ │ │ │ -
    292 }
    │ │ │ │ -
    │ │ │ │ -
    299 inline pointer allocate(std::size_t n, const_pointer hint=0);
    │ │ │ │ -
    300
    │ │ │ │ -
    308 inline void deallocate(pointer p, std::size_t n);
    │ │ │ │ -
    309
    │ │ │ │ -
    315 inline void construct(pointer p, const_reference value);
    │ │ │ │ -
    316
    │ │ │ │ -
    321 inline void destroy(pointer p);
    │ │ │ │ -
    322
    │ │ │ │ -
    326 inline pointer address(reference x) const { return &x; }
    │ │ │ │ -
    327
    │ │ │ │ -
    328
    │ │ │ │ -
    332 inline const_pointer address(const_reference x) const { return &x; }
    │ │ │ │ -
    333
    │ │ │ │ -
    337 inline int max_size() const noexcept { return 1; }
    │ │ │ │ -
    338
    │ │ │ │ -
    342 template<class U>
    │ │ │ │ -
    │ │ │ │ -
    343 struct rebind
    │ │ │ │ -
    344 {
    │ │ │ │ - │ │ │ │ -
    346 };
    │ │ │ │ -
    │ │ │ │ -
    347
    │ │ │ │ - │ │ │ │ -
    350
    │ │ │ │ -
    351 private:
    │ │ │ │ -
    355 PoolType memoryPool_;
    │ │ │ │ -
    356 };
    │ │ │ │ -
    │ │ │ │ -
    357
    │ │ │ │ -
    358 // specialization for void
    │ │ │ │ -
    359 template <std::size_t s>
    │ │ │ │ -
    │ │ │ │ -
    360 class PoolAllocator<void,s>
    │ │ │ │ -
    361 {
    │ │ │ │ -
    362 public:
    │ │ │ │ -
    363 typedef void* pointer;
    │ │ │ │ -
    364 typedef const void* const_pointer;
    │ │ │ │ -
    365 // reference to void members are impossible.
    │ │ │ │ -
    366 typedef void value_type;
    │ │ │ │ -
    │ │ │ │ -
    367 template <class U> struct rebind
    │ │ │ │ -
    368 {
    │ │ │ │ - │ │ │ │ -
    370 };
    │ │ │ │ -
    │ │ │ │ -
    371 };
    │ │ │ │ -
    │ │ │ │ -
    372
    │ │ │ │ -
    373
    │ │ │ │ -
    374 template<typename T1, std::size_t t1, typename T2, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    376 {
    │ │ │ │ -
    377 return false;
    │ │ │ │ -
    378 }
    │ │ │ │ -
    │ │ │ │ -
    379
    │ │ │ │ -
    380
    │ │ │ │ -
    381 template<typename T1, std::size_t t1, typename T2, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    383 {
    │ │ │ │ -
    384 return true;
    │ │ │ │ -
    385 }
    │ │ │ │ -
    │ │ │ │ -
    386
    │ │ │ │ -
    387 template<typename T, std::size_t t1, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    389 {
    │ │ │ │ -
    390 return &p1==&p2;
    │ │ │ │ -
    391 }
    │ │ │ │ -
    │ │ │ │ -
    392
    │ │ │ │ -
    393
    │ │ │ │ -
    394 template<typename T, std::size_t t1, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    396 {
    │ │ │ │ -
    397 return &p1 != &p2;
    │ │ │ │ -
    398 }
    │ │ │ │ -
    │ │ │ │ -
    399
    │ │ │ │ -
    400 template<typename T, std::size_t t1, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    402 {
    │ │ │ │ -
    403 return false;
    │ │ │ │ -
    404 }
    │ │ │ │ -
    │ │ │ │ -
    405
    │ │ │ │ -
    406
    │ │ │ │ -
    407 template<typename T, std::size_t t1, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    409 {
    │ │ │ │ -
    410 return true;
    │ │ │ │ -
    411 }
    │ │ │ │ -
    │ │ │ │ -
    412
    │ │ │ │ -
    413 template<std::size_t t1, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    415 {
    │ │ │ │ -
    416 return &p1==&p2;
    │ │ │ │ -
    417 }
    │ │ │ │ -
    │ │ │ │ -
    418
    │ │ │ │ -
    419 template<std::size_t t1, std::size_t t2>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    421 {
    │ │ │ │ -
    422 return &p1!=&p2;
    │ │ │ │ -
    423 }
    │ │ │ │ -
    │ │ │ │ -
    424
    │ │ │ │ -
    425 template<class T, std::size_t S>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    427 : head_(0), chunks_(0) //, allocated_(0)
    │ │ │ │ -
    428 {
    │ │ │ │ -
    429 static_assert(sizeof(T)<=unionSize, "Library Error: type T is too big");
    │ │ │ │ -
    430 static_assert(sizeof(Reference)<=unionSize, "Library Error: type of reference is too big");
    │ │ │ │ -
    431 static_assert(unionSize<=alignedSize, "Library Error: alignedSize too small");
    │ │ │ │ -
    432 static_assert(sizeof(T)<=chunkSize, "Library Error: chunkSize must be able to hold at least one value");
    │ │ │ │ -
    433 static_assert(sizeof(Reference)<=chunkSize, "Library Error: chunkSize must be able to hold at least one reference");
    │ │ │ │ -
    434 static_assert(chunkSize % alignment == 0, "Library Error: compiler cannot calculate!");
    │ │ │ │ -
    435 static_assert(elements>=1, "Library Error: we need to hold at least one element!");
    │ │ │ │ -
    436 static_assert(elements*alignedSize<=chunkSize, "Library Error: aligned elements must fit into chuck!");
    │ │ │ │ -
    437 }
    │ │ │ │ -
    │ │ │ │ -
    438
    │ │ │ │ -
    439 template<class T, std::size_t S>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    441 {
    │ │ │ │ -
    442 /*
    │ │ │ │ -
    443 if(allocated_!=0)
    │ │ │ │ -
    444 std::cerr<<"There are still "<<allocated_<<" allocated elements by the Pool<"<<typeid(T).name()<<","<<S<<"> "
    │ │ │ │ -
    445 <<static_cast<void*>(this)<<"! This is a memory leak and might result in segfaults"
    │ │ │ │ -
    446 <<std::endl;
    │ │ │ │ -
    447 */
    │ │ │ │ -
    448 // delete the allocated chunks.
    │ │ │ │ -
    449 Chunk *current=chunks_;
    │ │ │ │ -
    450
    │ │ │ │ -
    451 while(current!=0)
    │ │ │ │ -
    452 {
    │ │ │ │ -
    453 Chunk *tmp = current;
    │ │ │ │ -
    454 current = current->next_;
    │ │ │ │ -
    455 delete tmp;
    │ │ │ │ -
    456 }
    │ │ │ │ -
    457 }
    │ │ │ │ -
    │ │ │ │ -
    458
    │ │ │ │ -
    459 template<class T, std::size_t S>
    │ │ │ │ -
    │ │ │ │ -
    460 inline void Pool<T,S>::print(std::ostream& os)
    │ │ │ │ -
    461 {
    │ │ │ │ -
    462 Chunk* current=chunks_;
    │ │ │ │ -
    463 while(current) {
    │ │ │ │ -
    464 os<<current<<" ";
    │ │ │ │ -
    465 current=current->next_;
    │ │ │ │ -
    466 }
    │ │ │ │ -
    467 os<<current<<" ";
    │ │ │ │ -
    468 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    469
    │ │ │ │ -
    470 template<class T, std::size_t S>
    │ │ │ │ -
    471 inline void Pool<T,S>::grow()
    │ │ │ │ -
    472 {
    │ │ │ │ -
    473 Chunk *newChunk = new Chunk;
    │ │ │ │ -
    474 newChunk->next_ = chunks_;
    │ │ │ │ -
    475 chunks_ = newChunk;
    │ │ │ │ -
    476
    │ │ │ │ -
    477 char* start = chunks_->chunk_;
    │ │ │ │ -
    478 char* last = &start[elements*alignedSize];
    │ │ │ │ -
    479 Reference* ref = new (start) (Reference);
    │ │ │ │ -
    480
    │ │ │ │ -
    481 // grow is only called if head==0,
    │ │ │ │ -
    482 assert(!head_);
    │ │ │ │ -
    483
    │ │ │ │ -
    484 head_ = ref;
    │ │ │ │ -
    485
    │ │ │ │ -
    486 for(char* element=start+alignedSize; element<last; element=element+alignedSize) {
    │ │ │ │ -
    487 Reference* next = new (element) (Reference);
    │ │ │ │ -
    488 ref->next_ = next;
    │ │ │ │ -
    489 ref = next;
    │ │ │ │ -
    490 }
    │ │ │ │ -
    491 ref->next_=0;
    │ │ │ │ -
    492 }
    │ │ │ │ -
    493
    │ │ │ │ -
    494 template<class T, std::size_t S>
    │ │ │ │ -
    │ │ │ │ -
    495 inline void Pool<T,S>::free(void* b)
    │ │ │ │ -
    496 {
    │ │ │ │ -
    497 if(b) {
    │ │ │ │ -
    498#ifndef NDEBUG
    │ │ │ │ -
    499 Chunk* current=chunks_;
    │ │ │ │ -
    500 while(current) {
    │ │ │ │ -
    501 if(static_cast<void*>(current->chunk_)<=b &&
    │ │ │ │ -
    502 static_cast<void*>(current->chunk_+chunkSize)>b)
    │ │ │ │ -
    503 break;
    │ │ │ │ -
    504 current=current->next_;
    │ │ │ │ -
    505 }
    │ │ │ │ -
    506 if(!current)
    │ │ │ │ -
    507 throw std::bad_alloc();
    │ │ │ │ -
    508#endif
    │ │ │ │ -
    509 Reference* freed = static_cast<Reference*>(b);
    │ │ │ │ -
    510 freed->next_ = head_;
    │ │ │ │ -
    511 head_ = freed;
    │ │ │ │ -
    512 //--allocated_;
    │ │ │ │ -
    513 }
    │ │ │ │ -
    514 else
    │ │ │ │ -
    515 {
    │ │ │ │ -
    516 std::cerr<< "Tried to free null pointer! "<<b<<std::endl;
    │ │ │ │ -
    517 throw std::bad_alloc();
    │ │ │ │ -
    518 }
    │ │ │ │ -
    519 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    520
    │ │ │ │ -
    521 template<class T, std::size_t S>
    │ │ │ │ -
    │ │ │ │ -
    522 inline void* Pool<T,S>::allocate()
    │ │ │ │ -
    523 {
    │ │ │ │ -
    524 if(!head_)
    │ │ │ │ -
    525 grow();
    │ │ │ │ -
    526
    │ │ │ │ -
    527 Reference* p = head_;
    │ │ │ │ -
    528 head_ = p->next_;
    │ │ │ │ -
    529 //++allocated_;
    │ │ │ │ -
    530 return p;
    │ │ │ │ -
    531 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    532
    │ │ │ │ -
    533 template<class T, std::size_t s>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    535 { }
    │ │ │ │ -
    │ │ │ │ -
    536
    │ │ │ │ -
    537 template<class T, std::size_t s>
    │ │ │ │ -
    538 inline typename PoolAllocator<T,s>::pointer
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    540 {
    │ │ │ │ -
    541 if(n==1)
    │ │ │ │ -
    542 return static_cast<T*>(memoryPool_.allocate());
    │ │ │ │ -
    543 else
    │ │ │ │ -
    544 throw std::bad_alloc();
    │ │ │ │ -
    545 }
    │ │ │ │ -
    │ │ │ │ -
    546
    │ │ │ │ -
    547 template<class T, std::size_t s>
    │ │ │ │ -
    │ │ │ │ -
    548 inline void PoolAllocator<T,s>::deallocate(pointer p, std::size_t n)
    │ │ │ │ -
    549 {
    │ │ │ │ -
    550 for(size_t i=0; i<n; i++)
    │ │ │ │ -
    551 memoryPool_.free(p++);
    │ │ │ │ -
    552 }
    │ │ │ │ -
    │ │ │ │ -
    553
    │ │ │ │ -
    554 template<class T, std::size_t s>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    556 {
    │ │ │ │ -
    557 ::new (static_cast<void*>(p))T(value);
    │ │ │ │ -
    558 }
    │ │ │ │ -
    │ │ │ │ -
    559
    │ │ │ │ -
    560 template<class T, std::size_t s>
    │ │ │ │ -
    561 inline void PoolAllocator<T,s>::destroy(pointer p)
    │ │ │ │ -
    562 {
    │ │ │ │ -
    563 p->~T();
    │ │ │ │ -
    564 }
    │ │ │ │ -
    565
    │ │ │ │ -
    567}
    │ │ │ │ -
    568#endif
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    void construct(pointer p, const_reference value)
    Construct an object.
    Definition poolallocator.hh:555
    │ │ │ │ -
    void free(void *o)
    Free an object.
    Definition poolallocator.hh:495
    │ │ │ │ -
    ~Pool()
    Destructor.
    Definition poolallocator.hh:440
    │ │ │ │ -
    void * allocate()
    Get a new or recycled object.
    Definition poolallocator.hh:522
    │ │ │ │ -
    void print(std::ostream &os)
    Print elements in pool for debugging.
    Definition poolallocator.hh:460
    │ │ │ │ -
    pointer allocate(std::size_t n, const_pointer hint=0)
    Allocates objects.
    Definition poolallocator.hh:539
    │ │ │ │ -
    Pool()
    Constructor.
    Definition poolallocator.hh:426
    │ │ │ │ -
    void deallocate(pointer p, std::size_t n)
    Free objects.
    Definition poolallocator.hh:548
    │ │ │ │ -
    void destroy(pointer p)
    Destroy an object without freeing memory.
    Definition poolallocator.hh:561
    │ │ │ │ -
    PoolAllocator()
    Constructor.
    Definition poolallocator.hh:534
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition iteratorfacades.hh:237
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition iteratorfacades.hh:259
    │ │ │ │ -
    STL namespace.
    │ │ │ │ +
    61 void restore();
    │ │ │ │ +
    62
    │ │ │ │ +
    63 private:
    │ │ │ │ +
    65 state_type& ios;
    │ │ │ │ +
    67 state_type::fmtflags oldflags;
    │ │ │ │ +
    69 std::streamsize oldprec;
    │ │ │ │ +
    71 std::streamsize oldwidth;
    │ │ │ │ +
    72 };
    │ │ │ │ +
    │ │ │ │ +
    73
    │ │ │ │ +
    75}
    │ │ │ │ +
    76
    │ │ │ │ +
    77#endif // DUNE_COMMON_IOS_STATE_HH
    │ │ │ │ +
    ~ios_base_all_saver()
    Destructor that restores the flags stored by the constructor.
    Definition ios_state.cc:24
    │ │ │ │ +
    void restore()
    Restore flags now.
    Definition ios_state.cc:29
    │ │ │ │ +
    std::ios_base state_type
    Export type of object we save the state for.
    Definition ios_state.hh:37
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Get the 'const' version of a reference to a mutable object.
    Definition genericiterator.hh:87
    │ │ │ │ -
    A memory pool of objects.
    Definition poolallocator.hh:90
    │ │ │ │ -
    static constexpr int alignment
    The alignment that suits both the MemberType and the Reference (i.e. their least common multiple).
    Definition poolallocator.hh:127
    │ │ │ │ -
    static constexpr int alignedSize
    The aligned size of the type.
    Definition poolallocator.hh:135
    │ │ │ │ -
    static constexpr int chunkSize
    The size of each chunk memory chunk.
    Definition poolallocator.hh:144
    │ │ │ │ -
    static constexpr int size
    Size requirement. At least one object has to stored.
    Definition poolallocator.hh:120
    │ │ │ │ -
    static constexpr int unionSize
    The size of a union of Reference and MemberType.
    Definition poolallocator.hh:113
    │ │ │ │ -
    T MemberType
    The type of object we allocate memory for.
    Definition poolallocator.hh:108
    │ │ │ │ -
    static constexpr int elements
    The number of element each chunk can hold.
    Definition poolallocator.hh:150
    │ │ │ │ -
    An allocator managing a pool of objects for reuse.
    Definition poolallocator.hh:223
    │ │ │ │ -
    Pool< T, size > PoolType
    The type of the memory pool we use.
    Definition poolallocator.hh:349
    │ │ │ │ -
    const_pointer address(const_reference x) const
    Convert a reference to a pointer.
    Definition poolallocator.hh:332
    │ │ │ │ -
    const T & const_reference
    The constant reference type.
    Definition poolallocator.hh:256
    │ │ │ │ -
    std::size_t size_type
    The size type.
    Definition poolallocator.hh:261
    │ │ │ │ -
    T value_type
    Type of the values we construct and allocate.
    Definition poolallocator.hh:230
    │ │ │ │ -
    T & reference
    The reference type.
    Definition poolallocator.hh:251
    │ │ │ │ -
    PoolAllocator(const PoolAllocator &)
    Copy constructor that does not copy the memory pool.
    Definition poolallocator.hh:284
    │ │ │ │ -
    const T * const_pointer
    The constant pointer type.
    Definition poolallocator.hh:246
    │ │ │ │ -
    pointer address(reference x) const
    Convert a reference to a pointer.
    Definition poolallocator.hh:326
    │ │ │ │ -
    T * pointer
    The pointer type.
    Definition poolallocator.hh:241
    │ │ │ │ -
    PoolAllocator(const PoolAllocator< U, u > &)
    Copy Constructor that does not copy the memory pool.
    Definition poolallocator.hh:277
    │ │ │ │ -
    std::ptrdiff_t difference_type
    The difference_type.
    Definition poolallocator.hh:266
    │ │ │ │ -
    int max_size() const noexcept
    Not correctly implemented, yet!
    Definition poolallocator.hh:337
    │ │ │ │ -
    static constexpr int size
    The number of objects to fit into one memory chunk allocated.
    Definition poolallocator.hh:236
    │ │ │ │ -
    Rebind the allocator to another type.
    Definition poolallocator.hh:344
    │ │ │ │ -
    PoolAllocator< U, s > other
    Definition poolallocator.hh:345
    │ │ │ │ -
    void value_type
    Definition poolallocator.hh:366
    │ │ │ │ -
    void * pointer
    Definition poolallocator.hh:363
    │ │ │ │ -
    const void * const_pointer
    Definition poolallocator.hh:364
    │ │ │ │ -
    PoolAllocator< U, s > other
    Definition poolallocator.hh:369
    │ │ │ │ +
    Utility class for storing and resetting stream attributes.
    Definition ios_state.hh:34
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,597 +1,60 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -poolallocator.hh │ │ │ │ │ +ios_state.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_POOLALLOCATOR_HH │ │ │ │ │ -6#define DUNE_COMMON_POOLALLOCATOR_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_IOS_STATE_HH │ │ │ │ │ +6#define DUNE_COMMON_IOS_STATE_HH │ │ │ │ │ 7 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17 │ │ │ │ │ -18#ifndef DOXYGEN │ │ │ │ │ -19// forward declarations. │ │ │ │ │ -20// we need to know the test function to declare it friend │ │ │ │ │ -21template │ │ │ │ │ -22struct testPoolMain; │ │ │ │ │ -23#endif │ │ │ │ │ -24 │ │ │ │ │ -25namespace _D_u_n_e │ │ │ │ │ -26{ │ │ │ │ │ -27 │ │ │ │ │ -28 template │ │ │ │ │ -29 class Pool; │ │ │ │ │ -30 │ │ │ │ │ -31 template │ │ │ │ │ -32 class PoolAllocator; │ │ │ │ │ -33 │ │ │ │ │ -34} │ │ │ │ │ -35 │ │ │ │ │ -36namespace _s_t_d │ │ │ │ │ -37{ │ │ │ │ │ -38 /* │ │ │ │ │ -39 template │ │ │ │ │ -40 inline ostream& operator<<(ostream& os, Dune::Pool& pool) │ │ │ │ │ -41 { │ │ │ │ │ -42 os<<"pool="<<&pool<<" allocated_="< │ │ │ │ │ -47 inline ostream& operator<<(ostream& os, Dune::PoolAllocator& pool) │ │ │ │ │ -48 { │ │ │ │ │ -49 os< │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e { │ │ │ │ │ +_3_3 class _i_o_s___b_a_s_e___a_l_l___s_a_v_e_r │ │ │ │ │ +34 { │ │ │ │ │ +35 public: │ │ │ │ │ +_3_7 typedef std::ios_base _s_t_a_t_e___t_y_p_e; │ │ │ │ │ +38 │ │ │ │ │ +48 _i_o_s___b_a_s_e___a_l_l___s_a_v_e_r(_s_t_a_t_e___t_y_p_e& ios_); │ │ │ │ │ +49 │ │ │ │ │ +53 _~_i_o_s___b_a_s_e___a_l_l___s_a_v_e_r(); │ │ │ │ │ 54 │ │ │ │ │ -55 │ │ │ │ │ -56namespace _D_u_n_e │ │ │ │ │ -57{ │ │ │ │ │ -88 template │ │ │ │ │ -_8_9 class _P_o_o_l │ │ │ │ │ -90 { │ │ │ │ │ -91 // make the test function friend │ │ │ │ │ -92 friend struct ::testPoolMain; │ │ │ │ │ -93 │ │ │ │ │ -94 //friend std::ostream& std::operator<<<>(std::ostream&,Pool&); │ │ │ │ │ -_9_5 template< class, std::size_t > friend class _P_o_o_l_A_l_l_o_c_a_t_o_r; │ │ │ │ │ -96 │ │ │ │ │ -97 private: │ │ │ │ │ -98 │ │ │ │ │ -100 struct Reference │ │ │ │ │ -101 { │ │ │ │ │ -102 Reference *next_; │ │ │ │ │ -103 }; │ │ │ │ │ -104 │ │ │ │ │ -105 public: │ │ │ │ │ -106 │ │ │ │ │ -_1_0_8 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ -109 │ │ │ │ │ -_1_1_3 constexpr static int _u_n_i_o_n_S_i_z_e = (sizeof(_M_e_m_b_e_r_T_y_p_e) < sizeof(Reference)) ? │ │ │ │ │ -114 sizeof(Reference) : sizeof(_M_e_m_b_e_r_T_y_p_e); │ │ │ │ │ -115 │ │ │ │ │ -_1_2_0 constexpr static int _s_i_z_e = (sizeof(_M_e_m_b_e_r_T_y_p_e) <= s && sizeof(Reference) │ │ │ │ │ -<= s) ? │ │ │ │ │ -121 s : _u_n_i_o_n_S_i_z_e; │ │ │ │ │ -122 │ │ │ │ │ -_1_2_7 constexpr static int _a_l_i_g_n_m_e_n_t = std::lcm(alignof(_M_e_m_b_e_r_T_y_p_e), alignof │ │ │ │ │ -(Reference)); │ │ │ │ │ -128 │ │ │ │ │ -_1_3_5 constexpr static int _a_l_i_g_n_e_d_S_i_z_e = (_u_n_i_o_n_S_i_z_e % _a_l_i_g_n_m_e_n_t == 0) ? │ │ │ │ │ -136 _u_n_i_o_n_S_i_z_e : │ │ │ │ │ -137 ((_u_n_i_o_n_S_i_z_e / _a_l_i_g_n_m_e_n_t + 1) * _a_l_i_g_n_m_e_n_t); │ │ │ │ │ -138 │ │ │ │ │ -_1_4_4 constexpr static int _c_h_u_n_k_S_i_z_e = (_s_i_z_e % _a_l_i_g_n_m_e_n_t == 0) ? │ │ │ │ │ -145 _s_i_z_e : ((_s_i_z_e / _a_l_i_g_n_m_e_n_t + 1)* _a_l_i_g_n_m_e_n_t); │ │ │ │ │ -146 │ │ │ │ │ -_1_5_0 constexpr static int _e_l_e_m_e_n_t_s = (_c_h_u_n_k_S_i_z_e / _a_l_i_g_n_e_d_S_i_z_e); │ │ │ │ │ -151 │ │ │ │ │ -152 private: │ │ │ │ │ -154 struct Chunk │ │ │ │ │ -155 { │ │ │ │ │ -156 │ │ │ │ │ -157 //friend int testPool(); │ │ │ │ │ -158 │ │ │ │ │ -160 alignas(_a_l_i_g_n_m_e_n_t) char chunk_[_c_h_u_n_k_S_i_z_e]; │ │ │ │ │ -161 │ │ │ │ │ -163 Chunk *next_; │ │ │ │ │ -164 }; │ │ │ │ │ -165 │ │ │ │ │ -166 public: │ │ │ │ │ -_1_6_8 inline _P_o_o_l(); │ │ │ │ │ -_1_7_0 inline _~_P_o_o_l(); │ │ │ │ │ -_1_7_5 inline void* _a_l_l_o_c_a_t_e(); │ │ │ │ │ -_1_8_0 inline void _f_r_e_e(void* o); │ │ │ │ │ -181 │ │ │ │ │ -_1_8_5 inline void _p_r_i_n_t(std::ostream& os); │ │ │ │ │ -186 │ │ │ │ │ -187 private: │ │ │ │ │ -188 │ │ │ │ │ -189 // Prevent Copying! │ │ │ │ │ -190 _P_o_o_l(const _P_o_o_l_<_M_e_m_b_e_r_T_y_p_e_,_s_>&); │ │ │ │ │ -191 │ │ │ │ │ -192 void operator=(const _P_o_o_l_<_M_e_m_b_e_r_T_y_p_e_,_s_>& pool) const; │ │ │ │ │ -194 inline void grow(); │ │ │ │ │ -196 Reference *head_; │ │ │ │ │ -198 Chunk *chunks_; │ │ │ │ │ -199 /* @brief The number of currently allocated elements. */ │ │ │ │ │ -200 //size_t allocated_; │ │ │ │ │ -201 │ │ │ │ │ -202 }; │ │ │ │ │ -203 │ │ │ │ │ -221 template │ │ │ │ │ -_2_2_2 class _P_o_o_l_A_l_l_o_c_a_t_o_r │ │ │ │ │ -223 { │ │ │ │ │ -224 //friend std::ostream& std::operator<<<>(std:: │ │ │ │ │ -ostream&,PoolAllocator&); │ │ │ │ │ -225 │ │ │ │ │ -226 public: │ │ │ │ │ -_2_3_0 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -231 │ │ │ │ │ -_2_3_6 constexpr static int _s_i_z_e = s * sizeof(_v_a_l_u_e___t_y_p_e); │ │ │ │ │ -237 │ │ │ │ │ -_2_4_1 typedef T* _p_o_i_n_t_e_r; │ │ │ │ │ -242 │ │ │ │ │ -_2_4_6 typedef const T* _c_o_n_s_t___p_o_i_n_t_e_r; │ │ │ │ │ -247 │ │ │ │ │ -_2_5_1 typedef T& _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -252 │ │ │ │ │ -_2_5_6 typedef const T& _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -257 │ │ │ │ │ -_2_6_1 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -262 │ │ │ │ │ -_2_6_6 typedef std::ptrdiff_t _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ -267 │ │ │ │ │ -271 inline _P_o_o_l_A_l_l_o_c_a_t_o_r(); │ │ │ │ │ -272 │ │ │ │ │ -276 template │ │ │ │ │ -_2_7_7 inline _P_o_o_l_A_l_l_o_c_a_t_o_r(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_U_,_u_>&) │ │ │ │ │ -278 { │ │ │ │ │ -279 // we allow copying but never copy the pool │ │ │ │ │ -280 // to have a clear ownership of allocated pointers. │ │ │ │ │ -281 } │ │ │ │ │ -282 │ │ │ │ │ -_2_8_4 _P_o_o_l_A_l_l_o_c_a_t_o_r(const _P_o_o_l_A_l_l_o_c_a_t_o_r&) │ │ │ │ │ -285 { │ │ │ │ │ -286 // we allow copying but never copy the pool │ │ │ │ │ -287 // to have a clear ownership of allocated pointers. │ │ │ │ │ -288 // For this behaviour we have to implement │ │ │ │ │ -289 // the copy constructor, because the default │ │ │ │ │ -290 // one would copy the pool and deallocation │ │ │ │ │ -291 // of it would break. │ │ │ │ │ -292 } │ │ │ │ │ -299 inline _p_o_i_n_t_e_r _a_l_l_o_c_a_t_e(std::size_t n, _c_o_n_s_t___p_o_i_n_t_e_r hint=0); │ │ │ │ │ -300 │ │ │ │ │ -308 inline void _d_e_a_l_l_o_c_a_t_e(_p_o_i_n_t_e_r p, std::size_t n); │ │ │ │ │ -309 │ │ │ │ │ -315 inline void _c_o_n_s_t_r_u_c_t(_p_o_i_n_t_e_r p, _c_o_n_s_t___r_e_f_e_r_e_n_c_e value); │ │ │ │ │ -316 │ │ │ │ │ -321 inline void _d_e_s_t_r_o_y(_p_o_i_n_t_e_r p); │ │ │ │ │ -322 │ │ │ │ │ -_3_2_6 inline _p_o_i_n_t_e_r _a_d_d_r_e_s_s(_r_e_f_e_r_e_n_c_e x) const { return &x; } │ │ │ │ │ -327 │ │ │ │ │ -328 │ │ │ │ │ -_3_3_2 inline _c_o_n_s_t___p_o_i_n_t_e_r _a_d_d_r_e_s_s(_c_o_n_s_t___r_e_f_e_r_e_n_c_e x) const { return &x; } │ │ │ │ │ -333 │ │ │ │ │ -_3_3_7 inline int _m_a_x___s_i_z_e() const noexcept { return 1; } │ │ │ │ │ -338 │ │ │ │ │ -342 template │ │ │ │ │ -_3_4_3 struct _r_e_b_i_n_d │ │ │ │ │ -344 { │ │ │ │ │ -_3_4_5 typedef _P_o_o_l_A_l_l_o_c_a_t_o_r_<_U_,_s_> _o_t_h_e_r; │ │ │ │ │ -346 }; │ │ │ │ │ -347 │ │ │ │ │ -_3_4_9 typedef _P_o_o_l_<_T_,_s_i_z_e_> _P_o_o_l_T_y_p_e; │ │ │ │ │ -350 │ │ │ │ │ -351 private: │ │ │ │ │ -355 _P_o_o_l_T_y_p_e memoryPool_; │ │ │ │ │ -356 }; │ │ │ │ │ -357 │ │ │ │ │ -358 // specialization for void │ │ │ │ │ -359 template │ │ │ │ │ -_3_6_0 class _P_o_o_l_A_l_l_o_c_a_t_o_r │ │ │ │ │ -361 { │ │ │ │ │ -362 public: │ │ │ │ │ -_3_6_3 typedef void* _p_o_i_n_t_e_r; │ │ │ │ │ -_3_6_4 typedef const void* _c_o_n_s_t___p_o_i_n_t_e_r; │ │ │ │ │ -365 // reference to void members are impossible. │ │ │ │ │ -_3_6_6 typedef void _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_3_6_7 template struct rebind │ │ │ │ │ -368 { │ │ │ │ │ -_3_6_9 typedef _P_o_o_l_A_l_l_o_c_a_t_o_r_<_U_,_s_> _o_t_h_e_r; │ │ │ │ │ -370 }; │ │ │ │ │ -371 }; │ │ │ │ │ -372 │ │ │ │ │ -373 │ │ │ │ │ -374 template │ │ │ │ │ -_3_7_5 bool _o_p_e_r_a_t_o_r_=_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_1_,_t_1_>&, const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_2_,_t_2_>&) │ │ │ │ │ -376 { │ │ │ │ │ -377 return false; │ │ │ │ │ -378 } │ │ │ │ │ -379 │ │ │ │ │ -380 │ │ │ │ │ -381 template │ │ │ │ │ -_3_8_2 bool _o_p_e_r_a_t_o_r_!_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_1_,_t_1_>&, const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_2_,_t_2_>&) │ │ │ │ │ -383 { │ │ │ │ │ -384 return true; │ │ │ │ │ -385 } │ │ │ │ │ -386 │ │ │ │ │ -387 template │ │ │ │ │ -_3_8_8 bool _o_p_e_r_a_t_o_r_=_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_t_1_>& p1, const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_t_2_>& │ │ │ │ │ -p2) │ │ │ │ │ -389 { │ │ │ │ │ -390 return &p1==&p2; │ │ │ │ │ -391 } │ │ │ │ │ -392 │ │ │ │ │ -393 │ │ │ │ │ -394 template │ │ │ │ │ -_3_9_5 bool _o_p_e_r_a_t_o_r_!_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_t_1_>& p1, const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_t_2_>& │ │ │ │ │ -p2) │ │ │ │ │ -396 { │ │ │ │ │ -397 return &p1 != &p2; │ │ │ │ │ -398 } │ │ │ │ │ -399 │ │ │ │ │ -400 template │ │ │ │ │ -_4_0_1 bool _o_p_e_r_a_t_o_r_=_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_v_o_i_d_,_t_1_>&, const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_t_2_>&) │ │ │ │ │ -402 { │ │ │ │ │ -403 return false; │ │ │ │ │ -404 } │ │ │ │ │ -405 │ │ │ │ │ -406 │ │ │ │ │ -407 template │ │ │ │ │ -_4_0_8 bool _o_p_e_r_a_t_o_r_!_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_v_o_i_d_,_t_1_>&, const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_t_2_>&) │ │ │ │ │ -409 { │ │ │ │ │ -410 return true; │ │ │ │ │ -411 } │ │ │ │ │ -412 │ │ │ │ │ -413 template │ │ │ │ │ -_4_1_4 bool _o_p_e_r_a_t_o_r_=_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_v_o_i_d_,_t_1_>& p1, const │ │ │ │ │ -_P_o_o_l_A_l_l_o_c_a_t_o_r_<_v_o_i_d_,_t_2_>& p2) │ │ │ │ │ -415 { │ │ │ │ │ -416 return &p1==&p2; │ │ │ │ │ -417 } │ │ │ │ │ -418 │ │ │ │ │ -419 template │ │ │ │ │ -_4_2_0 bool _o_p_e_r_a_t_o_r_!_=(const _P_o_o_l_A_l_l_o_c_a_t_o_r_<_v_o_i_d_,_t_1_>& p1, const │ │ │ │ │ -_P_o_o_l_A_l_l_o_c_a_t_o_r_<_v_o_i_d_,_t_2_>& p2) │ │ │ │ │ -421 { │ │ │ │ │ -422 return &p1!=&p2; │ │ │ │ │ -423 } │ │ │ │ │ -424 │ │ │ │ │ -425 template │ │ │ │ │ -_4_2_6 inline _P_o_o_l_<_T_,_S_>_:_:_P_o_o_l() │ │ │ │ │ -427 : head_(0), chunks_(0) //, allocated_(0) │ │ │ │ │ -428 { │ │ │ │ │ -429 static_assert(sizeof(T)<=_u_n_i_o_n_S_i_z_e, "Library Error: type T is too big"); │ │ │ │ │ -430 static_assert(sizeof(Reference)<=_u_n_i_o_n_S_i_z_e, "Library Error: type of │ │ │ │ │ -reference is too big"); │ │ │ │ │ -431 static_assert(_u_n_i_o_n_S_i_z_e<=_a_l_i_g_n_e_d_S_i_z_e, "Library Error: alignedSize too │ │ │ │ │ -small"); │ │ │ │ │ -432 static_assert(sizeof(T)<=_c_h_u_n_k_S_i_z_e, "Library Error: chunkSize must be able │ │ │ │ │ -to hold at least one value"); │ │ │ │ │ -433 static_assert(sizeof(Reference)<=_c_h_u_n_k_S_i_z_e, "Library Error: chunkSize must │ │ │ │ │ -be able to hold at least one reference"); │ │ │ │ │ -434 static_assert(_c_h_u_n_k_S_i_z_e % _a_l_i_g_n_m_e_n_t == 0, "Library Error: compiler cannot │ │ │ │ │ -calculate!"); │ │ │ │ │ -435 static_assert(_e_l_e_m_e_n_t_s>=1, "Library Error: we need to hold at least one │ │ │ │ │ -element!"); │ │ │ │ │ -436 static_assert(_e_l_e_m_e_n_t_s*_a_l_i_g_n_e_d_S_i_z_e<=_c_h_u_n_k_S_i_z_e, "Library Error: aligned │ │ │ │ │ -elements must fit into chuck!"); │ │ │ │ │ -437 } │ │ │ │ │ -438 │ │ │ │ │ -439 template │ │ │ │ │ -_4_4_0 inline _P_o_o_l_<_T_,_S_>_:_:_~_P_o_o_l() │ │ │ │ │ -441 { │ │ │ │ │ -442 /* │ │ │ │ │ -443 if(allocated_!=0) │ │ │ │ │ -444 std::cerr<<"There are still "< " │ │ │ │ │ -445 <(this)<<"! This is a memory leak and might result in │ │ │ │ │ -segfaults" │ │ │ │ │ -446 <next_; │ │ │ │ │ -455 delete tmp; │ │ │ │ │ -456 } │ │ │ │ │ -457 } │ │ │ │ │ -458 │ │ │ │ │ -459 template │ │ │ │ │ -_4_6_0 inline void _P_o_o_l_<_T_,_S_>_:_:_p_r_i_n_t(std::ostream& os) │ │ │ │ │ -461 { │ │ │ │ │ -462 Chunk* current=chunks_; │ │ │ │ │ -463 while(current) { │ │ │ │ │ -464 os<next_; │ │ │ │ │ -466 } │ │ │ │ │ -467 os< │ │ │ │ │ -471 inline void _P_o_o_l_<_T_,_S_>_:_:_g_r_o_w() │ │ │ │ │ -472 { │ │ │ │ │ -473 Chunk *newChunk = new Chunk; │ │ │ │ │ -474 newChunk->next_ = chunks_; │ │ │ │ │ -475 chunks_ = newChunk; │ │ │ │ │ -476 │ │ │ │ │ -477 char* start = chunks_->chunk_; │ │ │ │ │ -478 char* last = &start[elements*alignedSize]; │ │ │ │ │ -479 Reference* ref = new (start) (Reference); │ │ │ │ │ -480 │ │ │ │ │ -481 // grow is only called if head==0, │ │ │ │ │ -482 assert(!head_); │ │ │ │ │ -483 │ │ │ │ │ -484 head_ = ref; │ │ │ │ │ -485 │ │ │ │ │ -486 for(char* element=start+alignedSize; elementnext_ = next; │ │ │ │ │ -489 ref = next; │ │ │ │ │ -490 } │ │ │ │ │ -491 ref->next_=0; │ │ │ │ │ -492 } │ │ │ │ │ -493 │ │ │ │ │ -494 template │ │ │ │ │ -_4_9_5 inline void _P_o_o_l_<_T_,_S_>_:_:_f_r_e_e(void* b) │ │ │ │ │ -496 { │ │ │ │ │ -497 if(b) { │ │ │ │ │ -498#ifndef NDEBUG │ │ │ │ │ -499 Chunk* current=chunks_; │ │ │ │ │ -500 while(current) { │ │ │ │ │ -501 if(static_cast(current->chunk_)<=b && │ │ │ │ │ -502 static_cast(current->chunk_+chunkSize)>b) │ │ │ │ │ -503 break; │ │ │ │ │ -504 current=current->next_; │ │ │ │ │ -505 } │ │ │ │ │ -506 if(!current) │ │ │ │ │ -507 throw std::bad_alloc(); │ │ │ │ │ -508#endif │ │ │ │ │ -509 Reference* freed = static_cast(b); │ │ │ │ │ -510 freed->next_ = head_; │ │ │ │ │ -511 head_ = freed; │ │ │ │ │ -512 //--allocated_; │ │ │ │ │ -513 } │ │ │ │ │ -514 else │ │ │ │ │ -515 { │ │ │ │ │ -516 std::cerr<< "Tried to free null pointer! "< │ │ │ │ │ -_5_2_2 inline void* _P_o_o_l_<_T_,_S_>_:_:_a_l_l_o_c_a_t_e() │ │ │ │ │ -523 { │ │ │ │ │ -524 if(!head_) │ │ │ │ │ -525 grow(); │ │ │ │ │ -526 │ │ │ │ │ -527 Reference* p = head_; │ │ │ │ │ -528 head_ = p->next_; │ │ │ │ │ -529 //++allocated_; │ │ │ │ │ -530 return p; │ │ │ │ │ -531 } │ │ │ │ │ -532 │ │ │ │ │ -533 template │ │ │ │ │ -_5_3_4 inline _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_s_>_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r() │ │ │ │ │ -535 { } │ │ │ │ │ -536 │ │ │ │ │ -537 template │ │ │ │ │ -538 inline typename _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_s_>_:_:_p_o_i_n_t_e_r │ │ │ │ │ -_5_3_9 _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_s_>_:_:_a_l_l_o_c_a_t_e(std::size_t n, _c_o_n_s_t___p_o_i_n_t_e_r) │ │ │ │ │ -540 { │ │ │ │ │ -541 if(n==1) │ │ │ │ │ -542 return static_cast(memoryPool_.allocate()); │ │ │ │ │ -543 else │ │ │ │ │ -544 throw std::bad_alloc(); │ │ │ │ │ -545 } │ │ │ │ │ -546 │ │ │ │ │ -547 template │ │ │ │ │ -_5_4_8 inline void _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_s_>_:_:_d_e_a_l_l_o_c_a_t_e(_p_o_i_n_t_e_r p, std::size_t n) │ │ │ │ │ -549 { │ │ │ │ │ -550 for(size_t i=0; i │ │ │ │ │ -_5_5_5 inline void _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_s_>_:_:_c_o_n_s_t_r_u_c_t(_p_o_i_n_t_e_r p, _c_o_n_s_t___r_e_f_e_r_e_n_c_e value) │ │ │ │ │ -556 { │ │ │ │ │ -557 ::new (static_cast(p))T(value); │ │ │ │ │ -558 } │ │ │ │ │ -559 │ │ │ │ │ -560 template │ │ │ │ │ -_5_6_1 inline void _P_o_o_l_A_l_l_o_c_a_t_o_r_<_T_,_s_>_:_:_d_e_s_t_r_o_y(pointer p) │ │ │ │ │ -562 { │ │ │ │ │ -563 p->~T(); │ │ │ │ │ -564 } │ │ │ │ │ -565 │ │ │ │ │ -567} │ │ │ │ │ -568#endif │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -void construct(pointer p, const_reference value) │ │ │ │ │ -Construct an object. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:555 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_f_r_e_e │ │ │ │ │ -void free(void *o) │ │ │ │ │ -Free an object. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:495 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_~_P_o_o_l │ │ │ │ │ -~Pool() │ │ │ │ │ -Destructor. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:440 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ -void * allocate() │ │ │ │ │ -Get a new or recycled object. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:522 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_p_r_i_n_t │ │ │ │ │ -void print(std::ostream &os) │ │ │ │ │ -Print elements in pool for debugging. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:460 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ -pointer allocate(std::size_t n, const_pointer hint=0) │ │ │ │ │ -Allocates objects. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:539 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_P_o_o_l │ │ │ │ │ -Pool() │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:426 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_d_e_a_l_l_o_c_a_t_e │ │ │ │ │ -void deallocate(pointer p, std::size_t n) │ │ │ │ │ -Free objects. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:548 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_d_e_s_t_r_o_y │ │ │ │ │ -void destroy(pointer p) │ │ │ │ │ -Destroy an object without freeing memory. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:561 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r │ │ │ │ │ -PoolAllocator() │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:534 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for equality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for inequality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +61 void _r_e_s_t_o_r_e(); │ │ │ │ │ +62 │ │ │ │ │ +63 private: │ │ │ │ │ +65 _s_t_a_t_e___t_y_p_e& ios; │ │ │ │ │ +67 state_type::fmtflags oldflags; │ │ │ │ │ +69 std::streamsize oldprec; │ │ │ │ │ +71 std::streamsize oldwidth; │ │ │ │ │ +72 }; │ │ │ │ │ +73 │ │ │ │ │ +75} │ │ │ │ │ +76 │ │ │ │ │ +77#endif // DUNE_COMMON_IOS_STATE_HH │ │ │ │ │ +_D_u_n_e_:_:_i_o_s___b_a_s_e___a_l_l___s_a_v_e_r_:_:_~_i_o_s___b_a_s_e___a_l_l___s_a_v_e_r │ │ │ │ │ +~ios_base_all_saver() │ │ │ │ │ +Destructor that restores the flags stored by the constructor. │ │ │ │ │ +DDeeffiinniittiioonn ios_state.cc:24 │ │ │ │ │ +_D_u_n_e_:_:_i_o_s___b_a_s_e___a_l_l___s_a_v_e_r_:_:_r_e_s_t_o_r_e │ │ │ │ │ +void restore() │ │ │ │ │ +Restore flags now. │ │ │ │ │ +DDeeffiinniittiioonn ios_state.cc:29 │ │ │ │ │ +_D_u_n_e_:_:_i_o_s___b_a_s_e___a_l_l___s_a_v_e_r_:_:_s_t_a_t_e___t_y_p_e │ │ │ │ │ +std::ios_base state_type │ │ │ │ │ +Export type of object we save the state for. │ │ │ │ │ +DDeeffiinniittiioonn ios_state.hh:37 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -Get the 'const' version of a reference to a mutable object. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l │ │ │ │ │ -A memory pool of objects. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_a_l_i_g_n_m_e_n_t │ │ │ │ │ -static constexpr int alignment │ │ │ │ │ -The alignment that suits both the MemberType and the Reference (i.e. their │ │ │ │ │ -least common multiple). │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:127 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_a_l_i_g_n_e_d_S_i_z_e │ │ │ │ │ -static constexpr int alignedSize │ │ │ │ │ -The aligned size of the type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:135 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_c_h_u_n_k_S_i_z_e │ │ │ │ │ -static constexpr int chunkSize │ │ │ │ │ -The size of each chunk memory chunk. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:144 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_s_i_z_e │ │ │ │ │ -static constexpr int size │ │ │ │ │ -Size requirement. At least one object has to stored. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_u_n_i_o_n_S_i_z_e │ │ │ │ │ -static constexpr int unionSize │ │ │ │ │ -The size of a union of Reference and MemberType. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:113 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ -T MemberType │ │ │ │ │ -The type of object we allocate memory for. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:108 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_:_:_e_l_e_m_e_n_t_s │ │ │ │ │ -static constexpr int elements │ │ │ │ │ -The number of element each chunk can hold. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r │ │ │ │ │ -An allocator managing a pool of objects for reuse. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:223 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_P_o_o_l_T_y_p_e │ │ │ │ │ -Pool< T, size > PoolType │ │ │ │ │ -The type of the memory pool we use. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:349 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_a_d_d_r_e_s_s │ │ │ │ │ -const_pointer address(const_reference x) const │ │ │ │ │ -Convert a reference to a pointer. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:332 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -const T & const_reference │ │ │ │ │ -The constant reference type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:256 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -The size type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -T value_type │ │ │ │ │ -Type of the values we construct and allocate. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -T & reference │ │ │ │ │ -The reference type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:251 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r │ │ │ │ │ -PoolAllocator(const PoolAllocator &) │ │ │ │ │ -Copy constructor that does not copy the memory pool. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:284 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ -const T * const_pointer │ │ │ │ │ -The constant pointer type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:246 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_a_d_d_r_e_s_s │ │ │ │ │ -pointer address(reference x) const │ │ │ │ │ -Convert a reference to a pointer. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:326 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ │ -T * pointer │ │ │ │ │ -The pointer type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:241 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r │ │ │ │ │ -PoolAllocator(const PoolAllocator< U, u > &) │ │ │ │ │ -Copy Constructor that does not copy the memory pool. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:277 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -std::ptrdiff_t difference_type │ │ │ │ │ -The difference_type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:266 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_m_a_x___s_i_z_e │ │ │ │ │ -int max_size() const noexcept │ │ │ │ │ -Not correctly implemented, yet! │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:337 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_s_i_z_e │ │ │ │ │ -static constexpr int size │ │ │ │ │ -The number of objects to fit into one memory chunk allocated. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:236 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d │ │ │ │ │ -Rebind the allocator to another type. │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:344 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d_:_:_o_t_h_e_r │ │ │ │ │ -PoolAllocator< U, s > other │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:345 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _v_o_i_d_,_ _s_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -void value_type │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:366 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _v_o_i_d_,_ _s_ _>_:_:_p_o_i_n_t_e_r │ │ │ │ │ -void * pointer │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:363 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _v_o_i_d_,_ _s_ _>_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ -const void * const_pointer │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:364 │ │ │ │ │ -_D_u_n_e_:_:_P_o_o_l_A_l_l_o_c_a_t_o_r_<_ _v_o_i_d_,_ _s_ _>_:_:_r_e_b_i_n_d_:_:_o_t_h_e_r │ │ │ │ │ -PoolAllocator< U, s > other │ │ │ │ │ -DDeeffiinniittiioonn poolallocator.hh:369 │ │ │ │ │ +_D_u_n_e_:_:_i_o_s___b_a_s_e___a_l_l___s_a_v_e_r │ │ │ │ │ +Utility class for storing and resetting stream attributes. │ │ │ │ │ +DDeeffiinniittiioonn ios_state.hh:34 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00200.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpicommunication.hh File Reference │ │ │ │ +dune-common: overloadset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,114 +65,47 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ Functions
    │ │ │ │ -
    mpicommunication.hh File Reference
    │ │ │ │ +
    overloadset.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Implements an utility class that provides MPI's collective communication methods. │ │ │ │ -More...

    │ │ │ │ -
    #include <algorithm>
    │ │ │ │ -#include <functional>
    │ │ │ │ -#include <memory>
    │ │ │ │ -#include <mpi.h>
    │ │ │ │ -#include <dune/common/binaryfunctions.hh>
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -#include <dune/common/parallel/communication.hh>
    │ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
    │ │ │ │ -#include <dune/common/parallel/mpifuture.hh>
    │ │ │ │ -#include <dune/common/parallel/mpidata.hh>
    │ │ │ │ +
    #include <utility>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    class  Dune::Generic_MPI_Op< Type, BinaryFunction, Enable >
     
    class  Dune::Communication< MPI_Comm >
     Specialization of Communication for MPI. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

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

    │ │ │ │ -Macros

    #define ComposeMPIOp(func, op)
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

     Dune::ComposeMPIOp (std::plus, MPI_SUM)
     
     Dune::ComposeMPIOp (std::multiplies, MPI_PROD)
     
     Dune::ComposeMPIOp (Min, MPI_MIN)
     
     Dune::ComposeMPIOp (Max, MPI_MAX)
     
    template<class... F>
    auto Dune::overload (F &&... f)
     Create an overload set.
     
    template<class... F>
    auto Dune::orderedOverload (F &&... f)
     Create an ordered overload set.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Implements an utility class that provides MPI's collective communication methods.

    │ │ │ │ -

    Macro Definition Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ ComposeMPIOp

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    #define ComposeMPIOp( func,
     op 
    )
    │ │ │ │ -
    │ │ │ │ -Value:
    template<class T, class S> \
    │ │ │ │ -
    class Generic_MPI_Op<T, func<S>, std::enable_if_t<MPITraits<S>::is_intrinsic> >{ \
    │ │ │ │ -
    public: \
    │ │ │ │ -
    static MPI_Op get(){ \
    │ │ │ │ -
    return op; \
    │ │ │ │ -
    } \
    │ │ │ │ -
    private: \
    │ │ │ │ -
    Generic_MPI_Op () {} \
    │ │ │ │ -
    Generic_MPI_Op (const Generic_MPI_Op & ) {} \
    │ │ │ │ -
    }
    │ │ │ │ -
    STL namespace.
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,69 +1,27 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_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 │ │ │ │ │ -mpicommunication.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Implements an utility class that provides MPI's collective communication │ │ │ │ │ -methods. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_f_u_t_u_r_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +overloadset.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_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_:_:_G_e_n_e_r_i_c___M_P_I___O_p_<_ _T_y_p_e_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_,_ _E_n_a_b_l_e_ _> │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _> │ │ │ │ │ -  Specialization of _C_o_m_m_u_n_i_c_a_t_i_o_n for MPI. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _C_o_m_p_o_s_e_M_P_I_O_p(func, op) │ │ │ │ │ -  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (std::plus, MPI_SUM) │ │ │ │ │ -  │ │ │ │ │ -  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (std::multiplies, MPI_PROD) │ │ │ │ │ -  │ │ │ │ │ -  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (_M_i_n, MPI_MIN) │ │ │ │ │ -  │ │ │ │ │ -  _D_u_n_e_:_:_C_o_m_p_o_s_e_M_P_I_O_p (_M_a_x, MPI_MAX) │ │ │ │ │ +template │ │ │ │ │ +auto  _D_u_n_e_:_:_o_v_e_r_l_o_a_d (F &&... f) │ │ │ │ │ +  Create an overload set. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +auto  _D_u_n_e_:_:_o_r_d_e_r_e_d_O_v_e_r_l_o_a_d (F &&... f) │ │ │ │ │ +  Create an ordered overload set. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implements an utility class that provides MPI's collective communication │ │ │ │ │ -methods. │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? CCoommppoosseeMMPPIIOOpp ********** │ │ │ │ │ -#define ComposeMPIOp (   func, │ │ │ │ │ -   op  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -template \ │ │ │ │ │ -class Generic_MPI_Op, _s_t_d::enable_if_t::is_intrinsic> > │ │ │ │ │ -{ \ │ │ │ │ │ -public: \ │ │ │ │ │ -static MPI_Op get(){ \ │ │ │ │ │ -return op; \ │ │ │ │ │ -} \ │ │ │ │ │ -private: \ │ │ │ │ │ -Generic_MPI_Op () {} \ │ │ │ │ │ -Generic_MPI_Op (const Generic_MPI_Op & ) {} \ │ │ │ │ │ -} │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00200_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpicommunication.hh Source File │ │ │ │ +dune-common: overloadset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,579 +70,143 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    mpicommunication.hh
    │ │ │ │ +
    overloadset.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH
    │ │ │ │ -
    6#define DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH
    │ │ │ │ +
    5#ifndef DUNE_COMMON_OVERLOADSET_HH
    │ │ │ │ +
    6#define DUNE_COMMON_OVERLOADSET_HH
    │ │ │ │
    7
    │ │ │ │ -
    16#if HAVE_MPI
    │ │ │ │ -
    17
    │ │ │ │ -
    18#include <algorithm>
    │ │ │ │ -
    19#include <functional>
    │ │ │ │ -
    20#include <memory>
    │ │ │ │ -
    21
    │ │ │ │ -
    22#include <mpi.h>
    │ │ │ │ -
    23
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    30
    │ │ │ │ -
    31namespace Dune
    │ │ │ │ -
    32{
    │ │ │ │ +
    8#include <utility>
    │ │ │ │ +
    9#include <type_traits>
    │ │ │ │ + │ │ │ │ +
    11
    │ │ │ │ +
    12namespace Dune {
    │ │ │ │ +
    13
    │ │ │ │ +
    14namespace Impl {
    │ │ │ │ +
    15
    │ │ │ │ +
    16 template<typename... F>
    │ │ │ │ +
    17 class OverloadSet
    │ │ │ │ +
    18 : public F...
    │ │ │ │ +
    19 {
    │ │ │ │ +
    20
    │ │ │ │ +
    21 public:
    │ │ │ │ +
    22
    │ │ │ │ +
    23 template<typename... FF>
    │ │ │ │ +
    24 OverloadSet(FF&&... ff)
    │ │ │ │ +
    25 : F(std::forward<FF>(ff))...
    │ │ │ │ +
    26 {}
    │ │ │ │ +
    27
    │ │ │ │ +
    28 using F::operator()...;
    │ │ │ │ +
    29
    │ │ │ │ +
    30 };
    │ │ │ │ +
    31
    │ │ │ │ +
    32} // end namespace Impl
    │ │ │ │
    33
    │ │ │ │ -
    34 //=======================================================
    │ │ │ │ -
    35 // use singleton pattern and template specialization to
    │ │ │ │ -
    36 // generate MPI operations
    │ │ │ │ -
    37 //=======================================================
    │ │ │ │ -
    38
    │ │ │ │ -
    39 template<typename Type, typename BinaryFunction, typename Enable=void>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    41 {
    │ │ │ │ -
    42
    │ │ │ │ -
    43 public:
    │ │ │ │ -
    │ │ │ │ -
    44 static MPI_Op get ()
    │ │ │ │ -
    45 {
    │ │ │ │ -
    46 if (!op)
    │ │ │ │ -
    47 {
    │ │ │ │ -
    48 op = std::make_unique<MPI_Op>();
    │ │ │ │ -
    49 // The following line leaks an MPI operation object, because the corresponding
    │ │ │ │ -
    50 //`MPI_Op_free` is never called. It is never called because there is no easy
    │ │ │ │ -
    51 // way to call it at the right moment: right before the call to MPI_Finalize.
    │ │ │ │ -
    52 // See https://gitlab.dune-project.org/core/dune-istl/issues/80
    │ │ │ │ -
    53 MPI_Op_create((void (*)(void*, void*, int*, MPI_Datatype*))&operation,true,op.get());
    │ │ │ │ -
    54 }
    │ │ │ │ -
    55 return *op;
    │ │ │ │ -
    56 }
    │ │ │ │ -
    │ │ │ │ -
    57 private:
    │ │ │ │ -
    58 static void operation (Type *in, Type *inout, int *len, MPI_Datatype*)
    │ │ │ │ -
    59 {
    │ │ │ │ -
    60 BinaryFunction func;
    │ │ │ │ -
    61
    │ │ │ │ -
    62 for (int i=0; i< *len; ++i, ++in, ++inout) {
    │ │ │ │ -
    63 Type temp;
    │ │ │ │ -
    64 temp = func(*in, *inout);
    │ │ │ │ -
    65 *inout = temp;
    │ │ │ │ -
    66 }
    │ │ │ │ -
    67 }
    │ │ │ │ -
    68 Generic_MPI_Op () {}
    │ │ │ │ -
    69 Generic_MPI_Op (const Generic_MPI_Op& ) {}
    │ │ │ │ -
    70 static std::unique_ptr<MPI_Op> op;
    │ │ │ │ -
    71 };
    │ │ │ │ -
    │ │ │ │ -
    72
    │ │ │ │ -
    73
    │ │ │ │ -
    74 template<typename Type, typename BinaryFunction, typename Enable>
    │ │ │ │ -
    75 std::unique_ptr<MPI_Op> Generic_MPI_Op<Type,BinaryFunction, Enable>::op;
    │ │ │ │ -
    76
    │ │ │ │ -
    │ │ │ │ -
    77#define ComposeMPIOp(func,op) \
    │ │ │ │ -
    78 template<class T, class S> \
    │ │ │ │ -
    79 class Generic_MPI_Op<T, func<S>, std::enable_if_t<MPITraits<S>::is_intrinsic> >{ \
    │ │ │ │ -
    80 public: \
    │ │ │ │ -
    81 static MPI_Op get(){ \
    │ │ │ │ -
    82 return op; \
    │ │ │ │ -
    83 } \
    │ │ │ │ -
    84 private: \
    │ │ │ │ -
    85 Generic_MPI_Op () {} \
    │ │ │ │ -
    86 Generic_MPI_Op (const Generic_MPI_Op & ) {} \
    │ │ │ │ -
    87 }
    │ │ │ │ -
    │ │ │ │ -
    88
    │ │ │ │ +
    34
    │ │ │ │ +
    35
    │ │ │ │ +
    60template<class... F>
    │ │ │ │ +
    │ │ │ │ +
    61auto overload(F&&... f)
    │ │ │ │ +
    62{
    │ │ │ │ +
    63 return Impl::OverloadSet<std::decay_t<F>...>(std::forward<F>(f)...);
    │ │ │ │ +
    64}
    │ │ │ │ +
    │ │ │ │ +
    65
    │ │ │ │ +
    66
    │ │ │ │ +
    67
    │ │ │ │ +
    68namespace Impl {
    │ │ │ │ +
    69
    │ │ │ │ +
    70 template<class F0, class... F>
    │ │ │ │ +
    71 class OrderedOverloadSet: public OrderedOverloadSet<F...>, F0
    │ │ │ │ +
    72 {
    │ │ │ │ +
    73 using Base = OrderedOverloadSet<F...>;
    │ │ │ │ +
    74 public:
    │ │ │ │ +
    75
    │ │ │ │ +
    76 template<class FF0, class... FF>
    │ │ │ │ +
    77 OrderedOverloadSet(FF0&& f0, FF&&... ff) :
    │ │ │ │ +
    78 Base(std::forward<FF>(ff)...),
    │ │ │ │ +
    79 F0(std::forward<FF0>(f0))
    │ │ │ │ +
    80 {}
    │ │ │ │ +
    81
    │ │ │ │ +
    82 // Forward to operator() of F0 if it can be called with the given arguments.
    │ │ │ │ +
    83 template<class... Args,
    │ │ │ │ +
    84 std::enable_if_t<IsCallable<F0(Args&&...)>::value, int> = 0>
    │ │ │ │ +
    85 decltype(auto) operator()(Args&&... args)
    │ │ │ │ +
    86 {
    │ │ │ │ +
    87 return F0::operator()(std::forward<Args>(args)...);
    │ │ │ │ +
    88 }
    │ │ │ │
    89
    │ │ │ │ -
    90 ComposeMPIOp(std::plus, MPI_SUM);
    │ │ │ │ -
    91 ComposeMPIOp(std::multiplies, MPI_PROD);
    │ │ │ │ -
    92 ComposeMPIOp(Min, MPI_MIN);
    │ │ │ │ -
    93 ComposeMPIOp(Max, MPI_MAX);
    │ │ │ │ -
    94
    │ │ │ │ -
    95#undef ComposeMPIOp
    │ │ │ │ -
    96
    │ │ │ │ -
    97
    │ │ │ │ -
    98 //=======================================================
    │ │ │ │ -
    99 // use singleton pattern and template specialization to
    │ │ │ │ -
    100 // generate MPI operations
    │ │ │ │ -
    101 //=======================================================
    │ │ │ │ -
    102
    │ │ │ │ -
    106 template<>
    │ │ │ │ -
    │ │ │ │ -
    107 class Communication<MPI_Comm>
    │ │ │ │ -
    108 {
    │ │ │ │ -
    109 public:
    │ │ │ │ -
    │ │ │ │ -
    111 Communication (const MPI_Comm& c = MPI_COMM_WORLD)
    │ │ │ │ -
    112 : communicator(c)
    │ │ │ │ -
    113 {
    │ │ │ │ -
    114 if(communicator!=MPI_COMM_NULL) {
    │ │ │ │ -
    115 int initialized = 0;
    │ │ │ │ -
    116 MPI_Initialized(&initialized);
    │ │ │ │ -
    117 if (!initialized)
    │ │ │ │ -
    118 DUNE_THROW(ParallelError,"You must call MPIHelper::instance(argc,argv) in your main() function before using the MPI Communication!");
    │ │ │ │ -
    119 MPI_Comm_rank(communicator,&me);
    │ │ │ │ -
    120 MPI_Comm_size(communicator,&procs);
    │ │ │ │ -
    121 }else{
    │ │ │ │ -
    122 procs=0;
    │ │ │ │ -
    123 me=-1;
    │ │ │ │ -
    124 }
    │ │ │ │ -
    125 }
    │ │ │ │ -
    │ │ │ │ +
    90 // Forward to operator() of base class if F0 cannot be called with the given
    │ │ │ │ +
    91 // arguments. In this case the base class will successively try operator()
    │ │ │ │ +
    92 // of all F... .
    │ │ │ │ +
    93 template<class... Args,
    │ │ │ │ +
    94 std::enable_if_t<not IsCallable<F0(Args&&...)>::value, int> = 0>
    │ │ │ │ +
    95 decltype(auto) operator()(Args&&... args)
    │ │ │ │ +
    96 {
    │ │ │ │ +
    97 return Base::operator()(std::forward<Args>(args)...);
    │ │ │ │ +
    98 }
    │ │ │ │ +
    99
    │ │ │ │ +
    100 };
    │ │ │ │ +
    101
    │ │ │ │ +
    102 template<class F0>
    │ │ │ │ +
    103 class OrderedOverloadSet<F0>: public F0
    │ │ │ │ +
    104 {
    │ │ │ │ +
    105 public:
    │ │ │ │ +
    106
    │ │ │ │ +
    107 template<class FF0>
    │ │ │ │ +
    108 OrderedOverloadSet(FF0&& f0) :
    │ │ │ │ +
    109 F0(std::forward<FF0>(f0))
    │ │ │ │ +
    110 {}
    │ │ │ │ +
    111
    │ │ │ │ +
    112 // Forward to operator() of F0. If it cannot be called with
    │ │ │ │ +
    113 // the given arguments a static assertion will fail.
    │ │ │ │ +
    114 template<class... Args>
    │ │ │ │ +
    115 decltype(auto) operator()(Args&&... args)
    │ │ │ │ +
    116 {
    │ │ │ │ +
    117 static_assert(IsCallable<F0(Args&&...)>::value,
    │ │ │ │ +
    118 "No matching overload found in OrderedOverloadSet");
    │ │ │ │ +
    119 return F0::operator()(std::forward<Args>(args)...);
    │ │ │ │ +
    120 }
    │ │ │ │ +
    121 };
    │ │ │ │ +
    122
    │ │ │ │ +
    123} // end namespace Impl
    │ │ │ │ +
    124
    │ │ │ │ +
    125
    │ │ │ │
    126
    │ │ │ │ -
    │ │ │ │ -
    128 int rank () const
    │ │ │ │ -
    129 {
    │ │ │ │ -
    130 return me;
    │ │ │ │ -
    131 }
    │ │ │ │ -
    │ │ │ │ -
    132
    │ │ │ │ -
    │ │ │ │ -
    134 int size () const
    │ │ │ │ -
    135 {
    │ │ │ │ -
    136 return procs;
    │ │ │ │ -
    137 }
    │ │ │ │ -
    │ │ │ │ -
    138
    │ │ │ │ -
    140 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    141 int send(const T& data, int dest_rank, int tag) const
    │ │ │ │ -
    142 {
    │ │ │ │ -
    143 auto mpi_data = getMPIData(data);
    │ │ │ │ -
    144 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
    │ │ │ │ -
    145 dest_rank, tag, communicator);
    │ │ │ │ -
    146 }
    │ │ │ │ -
    │ │ │ │ -
    147
    │ │ │ │ -
    149 template<class T>
    │ │ │ │ +
    149template<class... F>
    │ │ │ │
    │ │ │ │ -
    150 MPIFuture<const T> isend(const T&& data, int dest_rank, int tag) const
    │ │ │ │ -
    151 {
    │ │ │ │ -
    152 MPIFuture<const T> future(std::forward<const T>(data));
    │ │ │ │ -
    153 auto mpidata = future.get_mpidata();
    │ │ │ │ -
    154 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(),
    │ │ │ │ -
    155 dest_rank, tag, communicator, &future.req_);
    │ │ │ │ -
    156 return future;
    │ │ │ │ -
    157 }
    │ │ │ │ -
    │ │ │ │ +
    150auto orderedOverload(F&&... f)
    │ │ │ │ +
    151{
    │ │ │ │ +
    152 return Impl::OrderedOverloadSet<std::decay_t<F>...>(std::forward<F>(f)...);
    │ │ │ │ +
    153}
    │ │ │ │ +
    │ │ │ │ +
    154
    │ │ │ │ +
    155
    │ │ │ │ +
    156
    │ │ │ │ +
    157} // end namespace Dune
    │ │ │ │
    158
    │ │ │ │ -
    160 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    161 T recv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
    │ │ │ │ -
    162 {
    │ │ │ │ -
    163 T lvalue_data(std::forward<T>(data));
    │ │ │ │ -
    164 auto mpi_data = getMPIData(lvalue_data);
    │ │ │ │ -
    165 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
    │ │ │ │ -
    166 source_rank, tag, communicator, status);
    │ │ │ │ -
    167 return lvalue_data;
    │ │ │ │ -
    168 }
    │ │ │ │ -
    │ │ │ │ -
    169
    │ │ │ │ -
    171 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    172 MPIFuture<T> irecv(T&& data, int source_rank, int tag) const
    │ │ │ │ -
    173 {
    │ │ │ │ -
    174 MPIFuture<T> future(std::forward<T>(data));
    │ │ │ │ -
    175 auto mpidata = future.get_mpidata();
    │ │ │ │ -
    176 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(),
    │ │ │ │ -
    177 source_rank, tag, communicator, &future.req_);
    │ │ │ │ -
    178 return future;
    │ │ │ │ -
    179 }
    │ │ │ │ -
    │ │ │ │ -
    180
    │ │ │ │ -
    181 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    182 T rrecv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
    │ │ │ │ -
    183 {
    │ │ │ │ -
    184 MPI_Status _status;
    │ │ │ │ -
    185 MPI_Message _message;
    │ │ │ │ -
    186 T lvalue_data(std::forward<T>(data));
    │ │ │ │ -
    187 auto mpi_data = getMPIData(lvalue_data);
    │ │ │ │ -
    188 static_assert(!mpi_data.static_size, "rrecv work only for non-static-sized types.");
    │ │ │ │ -
    189 if(status == MPI_STATUS_IGNORE)
    │ │ │ │ -
    190 status = &_status;
    │ │ │ │ -
    191 MPI_Mprobe(source_rank, tag, communicator, &_message, status);
    │ │ │ │ -
    192 int size;
    │ │ │ │ -
    193 MPI_Get_count(status, mpi_data.type(), &size);
    │ │ │ │ -
    194 mpi_data.resize(size);
    │ │ │ │ -
    195 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message, status);
    │ │ │ │ -
    196 return lvalue_data;
    │ │ │ │ -
    197 }
    │ │ │ │ -
    │ │ │ │ -
    198
    │ │ │ │ -
    200 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    201 T sum (const T& in) const
    │ │ │ │ -
    202 {
    │ │ │ │ -
    203 T out;
    │ │ │ │ -
    204 allreduce<std::plus<T> >(&in,&out,1);
    │ │ │ │ -
    205 return out;
    │ │ │ │ -
    206 }
    │ │ │ │ -
    │ │ │ │ -
    207
    │ │ │ │ -
    209 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    210 int sum (T* inout, int len) const
    │ │ │ │ -
    211 {
    │ │ │ │ -
    212 return allreduce<std::plus<T> >(inout,len);
    │ │ │ │ -
    213 }
    │ │ │ │ -
    │ │ │ │ -
    214
    │ │ │ │ -
    216 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    217 T prod (const T& in) const
    │ │ │ │ -
    218 {
    │ │ │ │ -
    219 T out;
    │ │ │ │ -
    220 allreduce<std::multiplies<T> >(&in,&out,1);
    │ │ │ │ -
    221 return out;
    │ │ │ │ -
    222 }
    │ │ │ │ -
    │ │ │ │ -
    223
    │ │ │ │ -
    225 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    226 int prod (T* inout, int len) const
    │ │ │ │ -
    227 {
    │ │ │ │ -
    228 return allreduce<std::multiplies<T> >(inout,len);
    │ │ │ │ -
    229 }
    │ │ │ │ -
    │ │ │ │ -
    230
    │ │ │ │ -
    232 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    233 T min (const T& in) const
    │ │ │ │ -
    234 {
    │ │ │ │ -
    235 T out;
    │ │ │ │ -
    236 allreduce<Min<T> >(&in,&out,1);
    │ │ │ │ -
    237 return out;
    │ │ │ │ -
    238 }
    │ │ │ │ -
    │ │ │ │ -
    239
    │ │ │ │ -
    241 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    242 int min (T* inout, int len) const
    │ │ │ │ -
    243 {
    │ │ │ │ -
    244 return allreduce<Min<T> >(inout,len);
    │ │ │ │ -
    245 }
    │ │ │ │ -
    │ │ │ │ -
    246
    │ │ │ │ -
    247
    │ │ │ │ -
    249 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    250 T max (const T& in) const
    │ │ │ │ -
    251 {
    │ │ │ │ -
    252 T out;
    │ │ │ │ -
    253 allreduce<Max<T> >(&in,&out,1);
    │ │ │ │ -
    254 return out;
    │ │ │ │ -
    255 }
    │ │ │ │ -
    │ │ │ │ -
    256
    │ │ │ │ -
    258 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    259 int max (T* inout, int len) const
    │ │ │ │ -
    260 {
    │ │ │ │ -
    261 return allreduce<Max<T> >(inout,len);
    │ │ │ │ -
    262 }
    │ │ │ │ -
    │ │ │ │ -
    263
    │ │ │ │ -
    │ │ │ │ -
    265 int barrier () const
    │ │ │ │ -
    266 {
    │ │ │ │ -
    267 return MPI_Barrier(communicator);
    │ │ │ │ -
    268 }
    │ │ │ │ -
    │ │ │ │ -
    269
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    272 {
    │ │ │ │ -
    273 MPIFuture<void> future(true); // make a valid MPIFuture<void>
    │ │ │ │ -
    274 MPI_Ibarrier(communicator, &future.req_);
    │ │ │ │ -
    275 return future;
    │ │ │ │ -
    276 }
    │ │ │ │ -
    │ │ │ │ -
    277
    │ │ │ │ -
    278
    │ │ │ │ -
    280 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    281 int broadcast (T* inout, int len, int root) const
    │ │ │ │ -
    282 {
    │ │ │ │ -
    283 return MPI_Bcast(inout,len,MPITraits<T>::getType(),root,communicator);
    │ │ │ │ -
    284 }
    │ │ │ │ -
    │ │ │ │ -
    285
    │ │ │ │ -
    287 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    288 MPIFuture<T> ibroadcast(T&& data, int root) const{
    │ │ │ │ -
    289 MPIFuture<T> future(std::forward<T>(data));
    │ │ │ │ -
    290 auto mpidata = future.get_mpidata();
    │ │ │ │ -
    291 MPI_Ibcast(mpidata.ptr(),
    │ │ │ │ -
    292 mpidata.size(),
    │ │ │ │ -
    293 mpidata.type(),
    │ │ │ │ -
    294 root,
    │ │ │ │ -
    295 communicator,
    │ │ │ │ -
    296 &future.req_);
    │ │ │ │ -
    297 return future;
    │ │ │ │ -
    298 }
    │ │ │ │ -
    │ │ │ │ -
    299
    │ │ │ │ -
    302 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    303 int gather (const T* in, T* out, int len, int root) const
    │ │ │ │ -
    304 {
    │ │ │ │ -
    305 return MPI_Gather(const_cast<T*>(in),len,MPITraits<T>::getType(),
    │ │ │ │ -
    306 out,len,MPITraits<T>::getType(),
    │ │ │ │ -
    307 root,communicator);
    │ │ │ │ -
    308 }
    │ │ │ │ -
    │ │ │ │ -
    309
    │ │ │ │ -
    311 template<class TIN, class TOUT = std::vector<TIN>>
    │ │ │ │ -
    │ │ │ │ -
    312 MPIFuture<TOUT, TIN> igather(TIN&& data_in, TOUT&& data_out, int root) const{
    │ │ │ │ -
    313 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    │ │ │ │ -
    314 auto mpidata_in = future.get_send_mpidata();
    │ │ │ │ -
    315 auto mpidata_out = future.get_mpidata();
    │ │ │ │ -
    316 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size());
    │ │ │ │ -
    317 int outlen = (me==root) * mpidata_in.size();
    │ │ │ │ -
    318 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
    │ │ │ │ -
    319 mpidata_out.ptr(), outlen, mpidata_out.type(),
    │ │ │ │ -
    320 root, communicator, &future.req_);
    │ │ │ │ -
    321 return future;
    │ │ │ │ -
    322 }
    │ │ │ │ -
    │ │ │ │ -
    323
    │ │ │ │ -
    325 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    326 int gatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ, int root) const
    │ │ │ │ -
    327 {
    │ │ │ │ -
    328 return MPI_Gatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
    │ │ │ │ -
    329 out,recvDataLen,displ,MPITraits<T>::getType(),
    │ │ │ │ -
    330 root,communicator);
    │ │ │ │ -
    331 }
    │ │ │ │ -
    │ │ │ │ -
    332
    │ │ │ │ -
    335 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    336 int scatter (const T* sendData, T* recvData, int len, int root) const
    │ │ │ │ -
    337 {
    │ │ │ │ -
    338 return MPI_Scatter(const_cast<T*>(sendData),len,MPITraits<T>::getType(),
    │ │ │ │ -
    339 recvData,len,MPITraits<T>::getType(),
    │ │ │ │ -
    340 root,communicator);
    │ │ │ │ -
    341 }
    │ │ │ │ -
    │ │ │ │ -
    342
    │ │ │ │ -
    344 template<class TIN, class TOUT = TIN>
    │ │ │ │ -
    │ │ │ │ -
    345 MPIFuture<TOUT, TIN> iscatter(TIN&& data_in, TOUT&& data_out, int root) const
    │ │ │ │ -
    346 {
    │ │ │ │ -
    347 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    │ │ │ │ -
    348 auto mpidata_in = future.get_send_mpidata();
    │ │ │ │ -
    349 auto mpidata_out = future.get_mpidata();
    │ │ │ │ -
    350 int inlen = (me==root) * mpidata_in.size()/procs;
    │ │ │ │ -
    351 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(),
    │ │ │ │ -
    352 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(),
    │ │ │ │ -
    353 root, communicator, &future.req_);
    │ │ │ │ -
    354 return future;
    │ │ │ │ -
    355 }
    │ │ │ │ -
    │ │ │ │ -
    356
    │ │ │ │ -
    358 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    359 int scatterv (const T* sendData, int* sendDataLen, int* displ, T* recvData, int recvDataLen, int root) const
    │ │ │ │ -
    360 {
    │ │ │ │ -
    361 return MPI_Scatterv(const_cast<T*>(sendData),sendDataLen,displ,MPITraits<T>::getType(),
    │ │ │ │ -
    362 recvData,recvDataLen,MPITraits<T>::getType(),
    │ │ │ │ -
    363 root,communicator);
    │ │ │ │ -
    364 }
    │ │ │ │ -
    │ │ │ │ -
    365
    │ │ │ │ -
    366
    │ │ │ │ -
    │ │ │ │ -
    367 operator MPI_Comm () const
    │ │ │ │ -
    368 {
    │ │ │ │ -
    369 return communicator;
    │ │ │ │ -
    370 }
    │ │ │ │ -
    │ │ │ │ -
    371
    │ │ │ │ -
    373 template<typename T, typename T1>
    │ │ │ │ -
    │ │ │ │ -
    374 int allgather(const T* sbuf, int count, T1* rbuf) const
    │ │ │ │ -
    375 {
    │ │ │ │ -
    376 return MPI_Allgather(const_cast<T*>(sbuf), count, MPITraits<T>::getType(),
    │ │ │ │ -
    377 rbuf, count, MPITraits<T1>::getType(),
    │ │ │ │ -
    378 communicator);
    │ │ │ │ -
    379 }
    │ │ │ │ -
    │ │ │ │ -
    380
    │ │ │ │ -
    382 template<class TIN, class TOUT = TIN>
    │ │ │ │ -
    │ │ │ │ -
    383 MPIFuture<TOUT, TIN> iallgather(TIN&& data_in, TOUT&& data_out) const
    │ │ │ │ -
    384 {
    │ │ │ │ -
    385 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    │ │ │ │ -
    386 auto mpidata_in = future.get_send_mpidata();
    │ │ │ │ -
    387 auto mpidata_out = future.get_mpidata();
    │ │ │ │ -
    388 assert(mpidata_in.size()*procs <= mpidata_out.size());
    │ │ │ │ -
    389 int outlen = mpidata_in.size();
    │ │ │ │ -
    390 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
    │ │ │ │ -
    391 mpidata_out.ptr(), outlen, mpidata_out.type(),
    │ │ │ │ -
    392 communicator, &future.req_);
    │ │ │ │ -
    393 return future;
    │ │ │ │ -
    394 }
    │ │ │ │ -
    │ │ │ │ -
    395
    │ │ │ │ -
    397 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    398 int allgatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ) const
    │ │ │ │ -
    399 {
    │ │ │ │ -
    400 return MPI_Allgatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
    │ │ │ │ -
    401 out,recvDataLen,displ,MPITraits<T>::getType(),
    │ │ │ │ -
    402 communicator);
    │ │ │ │ -
    403 }
    │ │ │ │ -
    │ │ │ │ -
    404
    │ │ │ │ -
    406 template<typename BinaryFunction, typename Type>
    │ │ │ │ -
    │ │ │ │ -
    407 int allreduce(Type* inout, int len) const
    │ │ │ │ -
    408 {
    │ │ │ │ -
    409 Type* out = new Type[len];
    │ │ │ │ -
    410 int ret = allreduce<BinaryFunction>(inout,out,len);
    │ │ │ │ -
    411 std::copy(out, out+len, inout);
    │ │ │ │ -
    412 delete[] out;
    │ │ │ │ -
    413 return ret;
    │ │ │ │ -
    414 }
    │ │ │ │ -
    │ │ │ │ -
    415
    │ │ │ │ -
    416 template<typename BinaryFunction, typename Type>
    │ │ │ │ -
    │ │ │ │ -
    417 Type allreduce(Type&& in) const{
    │ │ │ │ -
    418 Type lvalue_data = std::forward<Type>(in);
    │ │ │ │ -
    419 auto data = getMPIData(lvalue_data);
    │ │ │ │ -
    420 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(),
    │ │ │ │ - │ │ │ │ -
    422 communicator);
    │ │ │ │ -
    423 return lvalue_data;
    │ │ │ │ -
    424 }
    │ │ │ │ -
    │ │ │ │ -
    425
    │ │ │ │ -
    427 template<class BinaryFunction, class TIN, class TOUT = TIN>
    │ │ │ │ -
    │ │ │ │ -
    428 MPIFuture<TOUT, TIN> iallreduce(TIN&& data_in, TOUT&& data_out) const {
    │ │ │ │ -
    429 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    │ │ │ │ -
    430 auto mpidata_in = future.get_send_mpidata();
    │ │ │ │ -
    431 auto mpidata_out = future.get_mpidata();
    │ │ │ │ -
    432 assert(mpidata_out.size() == mpidata_in.size());
    │ │ │ │ -
    433 assert(mpidata_out.type() == mpidata_in.type());
    │ │ │ │ -
    434 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(),
    │ │ │ │ -
    435 mpidata_out.size(), mpidata_out.type(),
    │ │ │ │ - │ │ │ │ -
    437 communicator, &future.req_);
    │ │ │ │ -
    438 return future;
    │ │ │ │ -
    439 }
    │ │ │ │ -
    │ │ │ │ -
    440
    │ │ │ │ -
    442 template<class BinaryFunction, class T>
    │ │ │ │ -
    │ │ │ │ -
    443 MPIFuture<T> iallreduce(T&& data) const{
    │ │ │ │ -
    444 MPIFuture<T> future(std::forward<T>(data));
    │ │ │ │ -
    445 auto mpidata = future.get_mpidata();
    │ │ │ │ -
    446 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(),
    │ │ │ │ -
    447 mpidata.size(), mpidata.type(),
    │ │ │ │ - │ │ │ │ -
    449 communicator, &future.req_);
    │ │ │ │ -
    450 return future;
    │ │ │ │ -
    451 }
    │ │ │ │ -
    │ │ │ │ -
    452
    │ │ │ │ -
    454 template<typename BinaryFunction, typename Type>
    │ │ │ │ -
    │ │ │ │ -
    455 int allreduce(const Type* in, Type* out, int len) const
    │ │ │ │ -
    456 {
    │ │ │ │ -
    457 return MPI_Allreduce(const_cast<Type*>(in), out, len, MPITraits<Type>::getType(),
    │ │ │ │ - │ │ │ │ -
    459 }
    │ │ │ │ -
    │ │ │ │ -
    460
    │ │ │ │ -
    461 private:
    │ │ │ │ -
    462 MPI_Comm communicator;
    │ │ │ │ -
    463 int me;
    │ │ │ │ -
    464 int procs;
    │ │ │ │ -
    465 };
    │ │ │ │ -
    │ │ │ │ -
    466} // namespace dune
    │ │ │ │ -
    467
    │ │ │ │ -
    468#endif // HAVE_MPI
    │ │ │ │ -
    469
    │ │ │ │ -
    470#endif
    │ │ │ │ -
    helper classes to provide unique types for standard functions
    │ │ │ │ -
    #define ComposeMPIOp(func, op)
    Definition mpicommunication.hh:77
    │ │ │ │ -
    Traits classes for mapping types onto MPI_Datatype.
    │ │ │ │ - │ │ │ │ -
    Implements an utility class that provides collective communication methods for sequential programs.
    │ │ │ │ -
    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
    │ │ │ │ -
    A few common exception classes.
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ +
    159#endif // DUNE_COMMON_OVERLOADSET_HH
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    auto orderedOverload(F &&... f)
    Create an ordered overload set.
    Definition overloadset.hh:150
    │ │ │ │ +
    auto overload(F &&... f)
    Create an overload set.
    Definition overloadset.hh:61
    │ │ │ │ +
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    auto getMPIData(T &t)
    Definition mpidata.hh:43
    │ │ │ │ -
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition mpitraits.hh:41
    │ │ │ │ -
    Definition binaryfunctions.hh:18
    │ │ │ │ -
    Definition binaryfunctions.hh:34
    │ │ │ │ -
    Default exception if an error in the parallel communication of the program occurred.
    Definition exceptions.hh:287
    │ │ │ │ -
    Collective communication interface and sequential default implementation.
    Definition communication.hh:100
    │ │ │ │ -
    int size() const
    Number of processes in set, is greater than 0.
    Definition communication.hh:126
    │ │ │ │ -
    Definition mpicommunication.hh:41
    │ │ │ │ -
    static MPI_Op get()
    Definition mpicommunication.hh:44
    │ │ │ │ -
    int max(T *inout, int len) const
    Compute the maximum of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:259
    │ │ │ │ -
    int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ) const
    Gathers data of variable length from all tasks and distribute it to all.
    Definition mpicommunication.hh:398
    │ │ │ │ -
    T max(const T &in) const
    Compute the maximum of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:250
    │ │ │ │ -
    MPIFuture< T > ibroadcast(T &&data, int root) const
    Distribute an array from the process with rank root to all other processes nonblocking.
    Definition mpicommunication.hh:288
    │ │ │ │ -
    MPIFuture< void > ibarrier() const
    Nonblocking barrier.
    Definition mpicommunication.hh:271
    │ │ │ │ -
    MPIFuture< const T > isend(const T &&data, int dest_rank, int tag) const
    Sends the data to the dest_rank nonblocking.
    Definition mpicommunication.hh:150
    │ │ │ │ -
    T recv(T &&data, int source_rank, int tag, MPI_Status *status=MPI_STATUS_IGNORE) const
    Receives the data from the source_rank.
    Definition mpicommunication.hh:161
    │ │ │ │ -
    int barrier() const
    Wait until all processes have arrived at this point in the program.
    Definition mpicommunication.hh:265
    │ │ │ │ -
    int rank() const
    Return rank, is between 0 and size()-1.
    Definition mpicommunication.hh:128
    │ │ │ │ -
    int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int recvDataLen, int root) const
    Scatter arrays of variable length from a root to all other tasks.
    Definition mpicommunication.hh:359
    │ │ │ │ -
    MPIFuture< TOUT, TIN > iallgather(TIN &&data_in, TOUT &&data_out) const
    Gathers data from all tasks and distribute it to all nonblocking.
    Definition mpicommunication.hh:383
    │ │ │ │ -
    Type allreduce(Type &&in) const
    Definition mpicommunication.hh:417
    │ │ │ │ -
    int sum(T *inout, int len) const
    Compute the sum of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:210
    │ │ │ │ -
    int broadcast(T *inout, int len, int root) const
    Distribute an array from the process with rank root to all other processes.
    Definition mpicommunication.hh:281
    │ │ │ │ -
    MPIFuture< T > iallreduce(T &&data) const
    Compute something over all processes nonblocking.
    Definition mpicommunication.hh:443
    │ │ │ │ -
    T sum(const T &in) const
    Compute the sum of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:201
    │ │ │ │ -
    int allreduce(const Type *in, Type *out, int len) const
    Definition mpicommunication.hh:455
    │ │ │ │ -
    MPIFuture< TOUT, TIN > iallreduce(TIN &&data_in, TOUT &&data_out) const
    Compute something over all processes nonblocking.
    Definition mpicommunication.hh:428
    │ │ │ │ -
    int size() const
    Number of processes in set, is greater than 0.
    Definition mpicommunication.hh:134
    │ │ │ │ -
    int gather(const T *in, T *out, int len, int root) const
    Gather arrays on root task.
    Definition mpicommunication.hh:303
    │ │ │ │ -
    int allreduce(Type *inout, int len) const
    Compute something over all processes for each component of an array and return the result in every pr...
    Definition mpicommunication.hh:407
    │ │ │ │ -
    T rrecv(T &&data, int source_rank, int tag, MPI_Status *status=MPI_STATUS_IGNORE) const
    Definition mpicommunication.hh:182
    │ │ │ │ -
    int scatter(const T *sendData, T *recvData, int len, int root) const
    Scatter array from a root to all other task.
    Definition mpicommunication.hh:336
    │ │ │ │ -
    MPIFuture< T > irecv(T &&data, int source_rank, int tag) const
    Receives the data from the source_rank nonblocking.
    Definition mpicommunication.hh:172
    │ │ │ │ -
    int prod(T *inout, int len) const
    Compute the product of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:226
    │ │ │ │ -
    MPIFuture< TOUT, TIN > igather(TIN &&data_in, TOUT &&data_out, int root) const
    Gather arrays on root task nonblocking.
    Definition mpicommunication.hh:312
    │ │ │ │ -
    T min(const T &in) const
    Compute the minimum of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:233
    │ │ │ │ -
    Communication(const MPI_Comm &c=MPI_COMM_WORLD)
    Instantiation using a MPI communicator.
    Definition mpicommunication.hh:111
    │ │ │ │ -
    MPIFuture< TOUT, TIN > iscatter(TIN &&data_in, TOUT &&data_out, int root) const
    Scatter array from a root to all other task nonblocking.
    Definition mpicommunication.hh:345
    │ │ │ │ -
    int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, int root) const
    Gather arrays of variable size on root task.
    Definition mpicommunication.hh:326
    │ │ │ │ -
    int min(T *inout, int len) const
    Compute the minimum of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:242
    │ │ │ │ -
    int allgather(const T *sbuf, int count, T1 *rbuf) const
    Gathers data from all tasks and distribute it to all.
    Definition mpicommunication.hh:374
    │ │ │ │ -
    int send(const T &data, int dest_rank, int tag) const
    Sends the data to the dest_rank.
    Definition mpicommunication.hh:141
    │ │ │ │ -
    T prod(const T &in) const
    Compute the product of the argument over all processes and return the result in every process....
    Definition mpicommunication.hh:217
    │ │ │ │ -
    Provides a future-like object for MPI communication. It contains the object that will be received and...
    Definition mpifuture.hh:85
    │ │ │ │ -
    auto get_send_mpidata()
    Definition mpifuture.hh:169
    │ │ │ │ -
    auto get_mpidata()
    Definition mpifuture.hh:165
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,664 +1,139 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpicommunication.hh │ │ │ │ │ +overloadset.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_OVERLOADSET_HH │ │ │ │ │ +6#define DUNE_COMMON_OVERLOADSET_HH │ │ │ │ │ 7 │ │ │ │ │ -16#if HAVE_MPI │ │ │ │ │ -17 │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20#include │ │ │ │ │ -21 │ │ │ │ │ -22#include │ │ │ │ │ -23 │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ -25#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -26#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -27#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ -28#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_f_u_t_u_r_e_._h_h> │ │ │ │ │ -29#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ -30 │ │ │ │ │ -31namespace _D_u_n_e │ │ │ │ │ -32{ │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +11 │ │ │ │ │ +12namespace _D_u_n_e { │ │ │ │ │ +13 │ │ │ │ │ +14namespace Impl { │ │ │ │ │ +15 │ │ │ │ │ +16 template │ │ │ │ │ +17 class OverloadSet │ │ │ │ │ +18 : public F... │ │ │ │ │ +19 { │ │ │ │ │ +20 │ │ │ │ │ +21 public: │ │ │ │ │ +22 │ │ │ │ │ +23 template │ │ │ │ │ +24 OverloadSet(FF&&... ff) │ │ │ │ │ +25 : F(_s_t_d::forward(ff))... │ │ │ │ │ +26 {} │ │ │ │ │ +27 │ │ │ │ │ +28 using F::operator()...; │ │ │ │ │ +29 │ │ │ │ │ +30 }; │ │ │ │ │ +31 │ │ │ │ │ +32} // end namespace Impl │ │ │ │ │ 33 │ │ │ │ │ -34 //======================================================= │ │ │ │ │ -35 // use singleton pattern and template specialization to │ │ │ │ │ -36 // generate MPI operations │ │ │ │ │ -37 //======================================================= │ │ │ │ │ -38 │ │ │ │ │ -39 template │ │ │ │ │ -_4_0 class _G_e_n_e_r_i_c___M_P_I___O_p │ │ │ │ │ -41 { │ │ │ │ │ -42 │ │ │ │ │ -43 public: │ │ │ │ │ -_4_4 static MPI_Op _g_e_t () │ │ │ │ │ -45 { │ │ │ │ │ -46 if (!op) │ │ │ │ │ -47 { │ │ │ │ │ -48 op = std::make_unique(); │ │ │ │ │ -49 // The following line leaks an MPI operation object, because the │ │ │ │ │ -corresponding │ │ │ │ │ -50 //`MPI_Op_free` is never called. It is never called because there is no easy │ │ │ │ │ -51 // way to call it at the right moment: right before the call to │ │ │ │ │ -MPI_Finalize. │ │ │ │ │ -52 // See https://gitlab.dune-project.org/core/dune-istl/issues/80 │ │ │ │ │ -53 MPI_Op_create((void (*)(void*, void*, int*, │ │ │ │ │ -MPI_Datatype*))&operation,true,op.get()); │ │ │ │ │ -54 } │ │ │ │ │ -55 return *op; │ │ │ │ │ -56 } │ │ │ │ │ -57 private: │ │ │ │ │ -58 static void operation (Type *in, Type *inout, int *len, MPI_Datatype*) │ │ │ │ │ -59 { │ │ │ │ │ -60 BinaryFunction func; │ │ │ │ │ -61 │ │ │ │ │ -62 for (int i=0; i< *len; ++i, ++in, ++inout) { │ │ │ │ │ -63 Type temp; │ │ │ │ │ -64 temp = func(*in, *inout); │ │ │ │ │ -65 *inout = temp; │ │ │ │ │ -66 } │ │ │ │ │ -67 } │ │ │ │ │ -68 Generic_MPI_Op () {} │ │ │ │ │ -69 Generic_MPI_Op (const Generic_MPI_Op& ) {} │ │ │ │ │ -70 static std::unique_ptr op; │ │ │ │ │ -71 }; │ │ │ │ │ -72 │ │ │ │ │ -73 │ │ │ │ │ -74 template │ │ │ │ │ -75 std::unique_ptr Generic_MPI_Op::op; │ │ │ │ │ -76 │ │ │ │ │ -_7_7#define ComposeMPIOp(func,op) \ │ │ │ │ │ -78 template \ │ │ │ │ │ -79 class Generic_MPI_Op, std::enable_if_t:: │ │ │ │ │ -is_intrinsic> >{ \ │ │ │ │ │ -80 public: \ │ │ │ │ │ -81 static MPI_Op get(){ \ │ │ │ │ │ -82 return op; \ │ │ │ │ │ -83 } \ │ │ │ │ │ -84 private: \ │ │ │ │ │ -85 Generic_MPI_Op () {} \ │ │ │ │ │ -86 Generic_MPI_Op (const Generic_MPI_Op & ) {} \ │ │ │ │ │ -87 } │ │ │ │ │ -88 │ │ │ │ │ +34 │ │ │ │ │ +35 │ │ │ │ │ +60template │ │ │ │ │ +_6_1auto _o_v_e_r_l_o_a_d(F&&... f) │ │ │ │ │ +62{ │ │ │ │ │ +63 return Impl::OverloadSet...>(std::forward(f)...); │ │ │ │ │ +64} │ │ │ │ │ +65 │ │ │ │ │ +66 │ │ │ │ │ +67 │ │ │ │ │ +68namespace Impl { │ │ │ │ │ +69 │ │ │ │ │ +70 template │ │ │ │ │ +71 class OrderedOverloadSet: public OrderedOverloadSet, F0 │ │ │ │ │ +72 { │ │ │ │ │ +73 using Base = OrderedOverloadSet; │ │ │ │ │ +74 public: │ │ │ │ │ +75 │ │ │ │ │ +76 template │ │ │ │ │ +77 OrderedOverloadSet(FF0&& f0, FF&&... ff) : │ │ │ │ │ +78 Base(_s_t_d::forward(ff)...), │ │ │ │ │ +79 F0(_s_t_d::forward(f0)) │ │ │ │ │ +80 {} │ │ │ │ │ +81 │ │ │ │ │ +82 // Forward to operator() of F0 if it can be called with the given arguments. │ │ │ │ │ +83 template::value, int> = 0> │ │ │ │ │ +85 decltype(auto) operator()(Args&&... args) │ │ │ │ │ +86 { │ │ │ │ │ +87 return F0::operator()(std::forward(args)...); │ │ │ │ │ +88 } │ │ │ │ │ 89 │ │ │ │ │ -_9_0 _C_o_m_p_o_s_e_M_P_I_O_p(std::plus, MPI_SUM); │ │ │ │ │ -_9_1 _C_o_m_p_o_s_e_M_P_I_O_p(std::multiplies, MPI_PROD); │ │ │ │ │ -_9_2 _C_o_m_p_o_s_e_M_P_I_O_p(_M_i_n, MPI_MIN); │ │ │ │ │ -_9_3 _C_o_m_p_o_s_e_M_P_I_O_p(_M_a_x, MPI_MAX); │ │ │ │ │ -94 │ │ │ │ │ -95#undef ComposeMPIOp │ │ │ │ │ -96 │ │ │ │ │ -97 │ │ │ │ │ -98 //======================================================= │ │ │ │ │ -99 // use singleton pattern and template specialization to │ │ │ │ │ -100 // generate MPI operations │ │ │ │ │ -101 //======================================================= │ │ │ │ │ -102 │ │ │ │ │ -106 template<> │ │ │ │ │ -_1_0_7 class _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -108 { │ │ │ │ │ -109 public: │ │ │ │ │ -_1_1_1 _C_o_m_m_u_n_i_c_a_t_i_o_n (const MPI_Comm& c = MPI_COMM_WORLD) │ │ │ │ │ -112 : communicator(c) │ │ │ │ │ -113 { │ │ │ │ │ -114 if(communicator!=MPI_COMM_NULL) { │ │ │ │ │ -115 int initialized = 0; │ │ │ │ │ -116 MPI_Initialized(&initialized); │ │ │ │ │ -117 if (!initialized) │ │ │ │ │ -118 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r,"You must call MPIHelper::instance(argc,argv) in │ │ │ │ │ -your main() function before using the MPI Communication!"); │ │ │ │ │ -119 MPI_Comm_rank(communicator,&me); │ │ │ │ │ -120 MPI_Comm_size(communicator,&procs); │ │ │ │ │ -121 }else{ │ │ │ │ │ -122 procs=0; │ │ │ │ │ -123 me=-1; │ │ │ │ │ -124 } │ │ │ │ │ -125 } │ │ │ │ │ +90 // Forward to operator() of base class if F0 cannot be called with the given │ │ │ │ │ +91 // arguments. In this case the base class will successively try operator() │ │ │ │ │ +92 // of all F... . │ │ │ │ │ +93 template::value, int> = 0> │ │ │ │ │ +95 decltype(auto) operator()(Args&&... args) │ │ │ │ │ +96 { │ │ │ │ │ +97 return Base::operator()(std::forward(args)...); │ │ │ │ │ +98 } │ │ │ │ │ +99 │ │ │ │ │ +100 }; │ │ │ │ │ +101 │ │ │ │ │ +102 template │ │ │ │ │ +103 class OrderedOverloadSet: public F0 │ │ │ │ │ +104 { │ │ │ │ │ +105 public: │ │ │ │ │ +106 │ │ │ │ │ +107 template │ │ │ │ │ +108 OrderedOverloadSet(FF0&& f0) : │ │ │ │ │ +109 F0(_s_t_d::forward(f0)) │ │ │ │ │ +110 {} │ │ │ │ │ +111 │ │ │ │ │ +112 // Forward to operator() of F0. If it cannot be called with │ │ │ │ │ +113 // the given arguments a static assertion will fail. │ │ │ │ │ +114 template │ │ │ │ │ +115 decltype(auto) operator()(Args&&... args) │ │ │ │ │ +116 { │ │ │ │ │ +117 static_assert(IsCallable::value, │ │ │ │ │ +118 "No matching overload found in OrderedOverloadSet"); │ │ │ │ │ +119 return F0::operator()(std::forward(args)...); │ │ │ │ │ +120 } │ │ │ │ │ +121 }; │ │ │ │ │ +122 │ │ │ │ │ +123} // end namespace Impl │ │ │ │ │ +124 │ │ │ │ │ +125 │ │ │ │ │ 126 │ │ │ │ │ -_1_2_8 int _r_a_n_k () const │ │ │ │ │ -129 { │ │ │ │ │ -130 return me; │ │ │ │ │ -131 } │ │ │ │ │ -132 │ │ │ │ │ -_1_3_4 int _s_i_z_e () const │ │ │ │ │ -135 { │ │ │ │ │ -136 return procs; │ │ │ │ │ -137 } │ │ │ │ │ -138 │ │ │ │ │ -140 template │ │ │ │ │ -_1_4_1 int _s_e_n_d(const T& data, int dest_rank, int tag) const │ │ │ │ │ -142 { │ │ │ │ │ -143 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -144 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), │ │ │ │ │ -145 dest_rank, tag, communicator); │ │ │ │ │ -146 } │ │ │ │ │ -147 │ │ │ │ │ -149 template │ │ │ │ │ -_1_5_0 _M_P_I_F_u_t_u_r_e_<_c_o_n_s_t_ _T_> _i_s_e_n_d(const T&& data, int dest_rank, int tag) const │ │ │ │ │ -151 { │ │ │ │ │ -152 _M_P_I_F_u_t_u_r_e_<_c_o_n_s_t_ _T_> future(std::forward(data)); │ │ │ │ │ -153 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -154 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(), │ │ │ │ │ -155 dest_rank, tag, communicator, &future.req_); │ │ │ │ │ -156 return future; │ │ │ │ │ -157 } │ │ │ │ │ +149template │ │ │ │ │ +_1_5_0auto _o_r_d_e_r_e_d_O_v_e_r_l_o_a_d(F&&... f) │ │ │ │ │ +151{ │ │ │ │ │ +152 return Impl::OrderedOverloadSet...>(std::forward(f)...); │ │ │ │ │ +153} │ │ │ │ │ +154 │ │ │ │ │ +155 │ │ │ │ │ +156 │ │ │ │ │ +157} // end namespace Dune │ │ │ │ │ 158 │ │ │ │ │ -160 template │ │ │ │ │ -_1_6_1 T _r_e_c_v(T&& data, int source_rank, int tag, MPI_Status* status = │ │ │ │ │ -MPI_STATUS_IGNORE) const │ │ │ │ │ -162 { │ │ │ │ │ -163 T lvalue_data(std::forward(data)); │ │ │ │ │ -164 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ -165 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), │ │ │ │ │ -166 source_rank, tag, communicator, status); │ │ │ │ │ -167 return lvalue_data; │ │ │ │ │ -168 } │ │ │ │ │ -169 │ │ │ │ │ -171 template │ │ │ │ │ -_1_7_2 _M_P_I_F_u_t_u_r_e_<_T_> _i_r_e_c_v(T&& data, int source_rank, int tag) const │ │ │ │ │ -173 { │ │ │ │ │ -174 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ -175 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -176 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(), │ │ │ │ │ -177 source_rank, tag, communicator, &future.req_); │ │ │ │ │ -178 return future; │ │ │ │ │ -179 } │ │ │ │ │ -180 │ │ │ │ │ -181 template │ │ │ │ │ -_1_8_2 T _r_r_e_c_v(T&& data, int source_rank, int tag, MPI_Status* status = │ │ │ │ │ -MPI_STATUS_IGNORE) const │ │ │ │ │ -183 { │ │ │ │ │ -184 MPI_Status _status; │ │ │ │ │ -185 MPI_Message _message; │ │ │ │ │ -186 T lvalue_data(std::forward(data)); │ │ │ │ │ -187 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ -188 static_assert(!mpi_data.static_size, "rrecv work only for non-static-sized │ │ │ │ │ -types."); │ │ │ │ │ -189 if(status == MPI_STATUS_IGNORE) │ │ │ │ │ -190 status = &_status; │ │ │ │ │ -191 MPI_Mprobe(source_rank, tag, communicator, &_message, status); │ │ │ │ │ -192 int _s_i_z_e; │ │ │ │ │ -193 MPI_Get_count(status, mpi_data.type(), &_s_i_z_e); │ │ │ │ │ -194 mpi_data.resize(_s_i_z_e); │ │ │ │ │ -195 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message, │ │ │ │ │ -status); │ │ │ │ │ -196 return lvalue_data; │ │ │ │ │ -197 } │ │ │ │ │ -198 │ │ │ │ │ -200 template │ │ │ │ │ -_2_0_1 T _s_u_m (const T& in) const │ │ │ │ │ -202 { │ │ │ │ │ -203 T out; │ │ │ │ │ -204 allreduce >(&in,&out,1); │ │ │ │ │ -205 return out; │ │ │ │ │ -206 } │ │ │ │ │ -207 │ │ │ │ │ -209 template │ │ │ │ │ -_2_1_0 int _s_u_m (T* inout, int len) const │ │ │ │ │ -211 { │ │ │ │ │ -212 return allreduce >(inout,len); │ │ │ │ │ -213 } │ │ │ │ │ -214 │ │ │ │ │ -216 template │ │ │ │ │ -_2_1_7 T _p_r_o_d (const T& in) const │ │ │ │ │ -218 { │ │ │ │ │ -219 T out; │ │ │ │ │ -220 allreduce >(&in,&out,1); │ │ │ │ │ -221 return out; │ │ │ │ │ -222 } │ │ │ │ │ -223 │ │ │ │ │ -225 template │ │ │ │ │ -_2_2_6 int _p_r_o_d (T* inout, int len) const │ │ │ │ │ -227 { │ │ │ │ │ -228 return allreduce >(inout,len); │ │ │ │ │ -229 } │ │ │ │ │ -230 │ │ │ │ │ -232 template │ │ │ │ │ -_2_3_3 T _m_i_n (const T& in) const │ │ │ │ │ -234 { │ │ │ │ │ -235 T out; │ │ │ │ │ -236 allreduce >(&in,&out,1); │ │ │ │ │ -237 return out; │ │ │ │ │ -238 } │ │ │ │ │ -239 │ │ │ │ │ -241 template │ │ │ │ │ -_2_4_2 int _m_i_n (T* inout, int len) const │ │ │ │ │ -243 { │ │ │ │ │ -244 return allreduce >(inout,len); │ │ │ │ │ -245 } │ │ │ │ │ -246 │ │ │ │ │ -247 │ │ │ │ │ -249 template │ │ │ │ │ -_2_5_0 T _m_a_x (const T& in) const │ │ │ │ │ -251 { │ │ │ │ │ -252 T out; │ │ │ │ │ -253 allreduce >(&in,&out,1); │ │ │ │ │ -254 return out; │ │ │ │ │ -255 } │ │ │ │ │ -256 │ │ │ │ │ -258 template │ │ │ │ │ -_2_5_9 int _m_a_x (T* inout, int len) const │ │ │ │ │ -260 { │ │ │ │ │ -261 return allreduce >(inout,len); │ │ │ │ │ -262 } │ │ │ │ │ -263 │ │ │ │ │ -_2_6_5 int _b_a_r_r_i_e_r () const │ │ │ │ │ -266 { │ │ │ │ │ -267 return MPI_Barrier(communicator); │ │ │ │ │ -268 } │ │ │ │ │ -269 │ │ │ │ │ -_2_7_1 _M_P_I_F_u_t_u_r_e_<_v_o_i_d_> _i_b_a_r_r_i_e_r () const │ │ │ │ │ -272 { │ │ │ │ │ -273 _M_P_I_F_u_t_u_r_e_<_v_o_i_d_> future(true); // make a valid MPIFuture │ │ │ │ │ -274 MPI_Ibarrier(communicator, &future.req_); │ │ │ │ │ -275 return future; │ │ │ │ │ -276 } │ │ │ │ │ -277 │ │ │ │ │ -278 │ │ │ │ │ -280 template │ │ │ │ │ -_2_8_1 int _b_r_o_a_d_c_a_s_t (T* inout, int len, int root) const │ │ │ │ │ -282 { │ │ │ │ │ -283 return MPI_Bcast(inout,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(),root,communicator); │ │ │ │ │ -284 } │ │ │ │ │ -285 │ │ │ │ │ -287 template │ │ │ │ │ -_2_8_8 _M_P_I_F_u_t_u_r_e_<_T_> _i_b_r_o_a_d_c_a_s_t(T&& data, int root) const{ │ │ │ │ │ -289 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ -290 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -291 MPI_Ibcast(mpidata.ptr(), │ │ │ │ │ -292 mpidata.size(), │ │ │ │ │ -293 mpidata.type(), │ │ │ │ │ -294 root, │ │ │ │ │ -295 communicator, │ │ │ │ │ -296 &future.req_); │ │ │ │ │ -297 return future; │ │ │ │ │ -298 } │ │ │ │ │ -299 │ │ │ │ │ -302 template │ │ │ │ │ -_3_0_3 int _g_a_t_h_e_r (const T* in, T* out, int len, int root) const │ │ │ │ │ -304 { │ │ │ │ │ -305 return MPI_Gather(const_cast(in),len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -306 out,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -307 root,communicator); │ │ │ │ │ -308 } │ │ │ │ │ -309 │ │ │ │ │ -311 template> │ │ │ │ │ -_3_1_2 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out, int root) │ │ │ │ │ -const{ │ │ │ │ │ -313 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ -(data_in)); │ │ │ │ │ -314 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -315 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -316 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size()); │ │ │ │ │ -317 int outlen = (me==root) * mpidata_in.size(); │ │ │ │ │ -318 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(), │ │ │ │ │ -319 mpidata_out.ptr(), outlen, mpidata_out.type(), │ │ │ │ │ -320 root, communicator, &future.req_); │ │ │ │ │ -321 return future; │ │ │ │ │ -322 } │ │ │ │ │ -323 │ │ │ │ │ -325 template │ │ │ │ │ -_3_2_6 int _g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, int* recvDataLen, int* │ │ │ │ │ -displ, int root) const │ │ │ │ │ -327 { │ │ │ │ │ -328 return MPI_Gatherv(const_cast(in),sendDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -329 out,recvDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -330 root,communicator); │ │ │ │ │ -331 } │ │ │ │ │ -332 │ │ │ │ │ -335 template │ │ │ │ │ -_3_3_6 int _s_c_a_t_t_e_r (const T* sendData, T* recvData, int len, int root) const │ │ │ │ │ -337 { │ │ │ │ │ -338 return MPI_Scatter(const_cast(sendData),len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -339 recvData,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -340 root,communicator); │ │ │ │ │ -341 } │ │ │ │ │ -342 │ │ │ │ │ -344 template │ │ │ │ │ -_3_4_5 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_s_c_a_t_t_e_r(TIN&& data_in, TOUT&& data_out, int root) │ │ │ │ │ -const │ │ │ │ │ -346 { │ │ │ │ │ -347 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ -(data_in)); │ │ │ │ │ -348 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -349 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -350 int inlen = (me==root) * mpidata_in.size()/procs; │ │ │ │ │ -351 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(), │ │ │ │ │ -352 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(), │ │ │ │ │ -353 root, communicator, &future.req_); │ │ │ │ │ -354 return future; │ │ │ │ │ -355 } │ │ │ │ │ -356 │ │ │ │ │ -358 template │ │ │ │ │ -_3_5_9 int _s_c_a_t_t_e_r_v (const T* sendData, int* sendDataLen, int* displ, T* recvData, │ │ │ │ │ -int recvDataLen, int root) const │ │ │ │ │ -360 { │ │ │ │ │ -361 return MPI_Scatterv(const_cast │ │ │ │ │ -(sendData),sendDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -362 recvData,recvDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -363 root,communicator); │ │ │ │ │ -364 } │ │ │ │ │ -365 │ │ │ │ │ -366 │ │ │ │ │ -_3_6_7 operator MPI_Comm () const │ │ │ │ │ -368 { │ │ │ │ │ -369 return communicator; │ │ │ │ │ -370 } │ │ │ │ │ -371 │ │ │ │ │ -373 template │ │ │ │ │ -_3_7_4 int _a_l_l_g_a_t_h_e_r(const T* sbuf, int count, T1* rbuf) const │ │ │ │ │ -375 { │ │ │ │ │ -376 return MPI_Allgather(const_cast(sbuf), count, _M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -377 rbuf, count, _M_P_I_T_r_a_i_t_s_<_T_1_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -378 communicator); │ │ │ │ │ -379 } │ │ │ │ │ -380 │ │ │ │ │ -382 template │ │ │ │ │ -_3_8_3 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_a_l_l_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out) const │ │ │ │ │ -384 { │ │ │ │ │ -385 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ -(data_in)); │ │ │ │ │ -386 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -387 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -388 assert(mpidata_in.size()*procs <= mpidata_out.size()); │ │ │ │ │ -389 int outlen = mpidata_in.size(); │ │ │ │ │ -390 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(), │ │ │ │ │ -391 mpidata_out.ptr(), outlen, mpidata_out.type(), │ │ │ │ │ -392 communicator, &future.req_); │ │ │ │ │ -393 return future; │ │ │ │ │ -394 } │ │ │ │ │ -395 │ │ │ │ │ -397 template │ │ │ │ │ -_3_9_8 int _a_l_l_g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, int* recvDataLen, │ │ │ │ │ -int* displ) const │ │ │ │ │ -399 { │ │ │ │ │ -400 return MPI_Allgatherv(const_cast(in),sendDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e │ │ │ │ │ -(), │ │ │ │ │ -401 out,recvDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -402 communicator); │ │ │ │ │ -403 } │ │ │ │ │ -404 │ │ │ │ │ -406 template │ │ │ │ │ -_4_0_7 int _a_l_l_r_e_d_u_c_e(Type* inout, int len) const │ │ │ │ │ -408 { │ │ │ │ │ -409 Type* out = new Type[len]; │ │ │ │ │ -410 int ret = allreduce(inout,out,len); │ │ │ │ │ -411 std::copy(out, out+len, inout); │ │ │ │ │ -412 delete[] out; │ │ │ │ │ -413 return ret; │ │ │ │ │ -414 } │ │ │ │ │ -415 │ │ │ │ │ -416 template │ │ │ │ │ -_4_1_7 Type _a_l_l_r_e_d_u_c_e(Type&& in) const{ │ │ │ │ │ -418 Type lvalue_data = std::forward(in); │ │ │ │ │ -419 auto data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ -420 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(), │ │ │ │ │ -421 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_y_p_e_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()), │ │ │ │ │ -422 communicator); │ │ │ │ │ -423 return lvalue_data; │ │ │ │ │ -424 } │ │ │ │ │ -425 │ │ │ │ │ -427 template │ │ │ │ │ -_4_2_8 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> _i_a_l_l_r_e_d_u_c_e(TIN&& data_in, TOUT&& data_out) const { │ │ │ │ │ -429 _M_P_I_F_u_t_u_r_e_<_T_O_U_T_,_ _T_I_N_> future(std::forward(data_out), std::forward │ │ │ │ │ -(data_in)); │ │ │ │ │ -430 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -431 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -432 assert(mpidata_out.size() == mpidata_in.size()); │ │ │ │ │ -433 assert(mpidata_out.type() == mpidata_in.type()); │ │ │ │ │ -434 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(), │ │ │ │ │ -435 mpidata_out.size(), mpidata_out.type(), │ │ │ │ │ -436 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_I_N_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()), │ │ │ │ │ -437 communicator, &future.req_); │ │ │ │ │ -438 return future; │ │ │ │ │ -439 } │ │ │ │ │ -440 │ │ │ │ │ -442 template │ │ │ │ │ -_4_4_3 _M_P_I_F_u_t_u_r_e_<_T_> _i_a_l_l_r_e_d_u_c_e(T&& data) const{ │ │ │ │ │ -444 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ -445 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -446 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(), │ │ │ │ │ -447 mpidata.size(), mpidata.type(), │ │ │ │ │ -448 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()), │ │ │ │ │ -449 communicator, &future.req_); │ │ │ │ │ -450 return future; │ │ │ │ │ -451 } │ │ │ │ │ -452 │ │ │ │ │ -454 template │ │ │ │ │ -_4_5_5 int _a_l_l_r_e_d_u_c_e(const Type* in, Type* out, int len) const │ │ │ │ │ -456 { │ │ │ │ │ -457 return MPI_Allreduce(const_cast(in), out, len, _M_P_I_T_r_a_i_t_s_<_T_y_p_e_>_:_: │ │ │ │ │ -_g_e_t_T_y_p_e(), │ │ │ │ │ -458 (_G_e_n_e_r_i_c___M_P_I___O_p_<_T_y_p_e_,_ _B_i_n_a_r_y_F_u_n_c_t_i_o_n_>_:_:_g_e_t()),communicator); │ │ │ │ │ -459 } │ │ │ │ │ -460 │ │ │ │ │ -461 private: │ │ │ │ │ -462 MPI_Comm communicator; │ │ │ │ │ -463 int me; │ │ │ │ │ -464 int procs; │ │ │ │ │ -465 }; │ │ │ │ │ -466} // namespace dune │ │ │ │ │ -467 │ │ │ │ │ -468#endif // HAVE_MPI │ │ │ │ │ -469 │ │ │ │ │ -470#endif │ │ │ │ │ -_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h │ │ │ │ │ -helper classes to provide unique types for standard functions │ │ │ │ │ -_C_o_m_p_o_s_e_M_P_I_O_p │ │ │ │ │ -#define ComposeMPIOp(func, op) │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:77 │ │ │ │ │ -_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ -_m_p_i_f_u_t_u_r_e_._h_h │ │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ -Implements an utility class that provides collective communication methods for │ │ │ │ │ -sequential programs. │ │ │ │ │ -_m_p_i_d_a_t_a_._h_h │ │ │ │ │ -Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ -MPI calls. │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +159#endif // DUNE_COMMON_OVERLOADSET_HH │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_u_n_e_:_:_o_r_d_e_r_e_d_O_v_e_r_l_o_a_d │ │ │ │ │ +auto orderedOverload(F &&... f) │ │ │ │ │ +Create an ordered overload set. │ │ │ │ │ +DDeeffiinniittiioonn overloadset.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_o_v_e_r_l_o_a_d │ │ │ │ │ +auto overload(F &&... f) │ │ │ │ │ +Create an overload set. │ │ │ │ │ +DDeeffiinniittiioonn overloadset.hh:61 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ -auto getMPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s │ │ │ │ │ -A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ -DDeeffiinniittiioonn mpitraits.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_M_i_n │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:18 │ │ │ │ │ -_D_u_n_e_:_:_M_a_x │ │ │ │ │ -DDeeffiinniittiioonn binaryfunctions.hh:34 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_E_r_r_o_r │ │ │ │ │ -Default exception if an error in the parallel communication of the program │ │ │ │ │ -occurred. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:287 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Collective communication interface and sequential default implementation. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -Number of processes in set, is greater than 0. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c___M_P_I___O_p │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c___M_P_I___O_p_:_:_g_e_t │ │ │ │ │ -static MPI_Op get() │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_a_x │ │ │ │ │ -int max(T *inout, int len) const │ │ │ │ │ -Compute the maximum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_g_a_t_h_e_r_v │ │ │ │ │ -int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int │ │ │ │ │ -*displ) const │ │ │ │ │ -Gathers data of variable length from all tasks and distribute it to all. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:398 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_a_x │ │ │ │ │ -T max(const T &in) const │ │ │ │ │ -Compute the maximum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:250 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_b_r_o_a_d_c_a_s_t │ │ │ │ │ -MPIFuture< T > ibroadcast(T &&data, int root) const │ │ │ │ │ -Distribute an array from the process with rank root to all other processes │ │ │ │ │ -nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:288 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_b_a_r_r_i_e_r │ │ │ │ │ -MPIFuture< void > ibarrier() const │ │ │ │ │ -Nonblocking barrier. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_s_e_n_d │ │ │ │ │ -MPIFuture< const T > isend(const T &&data, int dest_rank, int tag) const │ │ │ │ │ -Sends the data to the dest_rank nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_r_e_c_v │ │ │ │ │ -T recv(T &&data, int source_rank, int tag, MPI_Status │ │ │ │ │ -*status=MPI_STATUS_IGNORE) const │ │ │ │ │ -Receives the data from the source_rank. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:161 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_b_a_r_r_i_e_r │ │ │ │ │ -int barrier() const │ │ │ │ │ -Wait until all processes have arrived at this point in the program. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_r_a_n_k │ │ │ │ │ -int rank() const │ │ │ │ │ -Return rank, is between 0 and size()-1. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:128 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_c_a_t_t_e_r_v │ │ │ │ │ -int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int │ │ │ │ │ -recvDataLen, int root) const │ │ │ │ │ -Scatter arrays of variable length from a root to all other tasks. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:359 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_a_l_l_g_a_t_h_e_r │ │ │ │ │ -MPIFuture< TOUT, TIN > iallgather(TIN &&data_in, TOUT &&data_out) const │ │ │ │ │ -Gathers data from all tasks and distribute it to all nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:383 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ -Type allreduce(Type &&in) const │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:417 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_u_m │ │ │ │ │ -int sum(T *inout, int len) const │ │ │ │ │ -Compute the sum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:210 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_b_r_o_a_d_c_a_s_t │ │ │ │ │ -int broadcast(T *inout, int len, int root) const │ │ │ │ │ -Distribute an array from the process with rank root to all other processes. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:281 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ -MPIFuture< T > iallreduce(T &&data) const │ │ │ │ │ -Compute something over all processes nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:443 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_u_m │ │ │ │ │ -T sum(const T &in) const │ │ │ │ │ -Compute the sum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:201 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ -int allreduce(const Type *in, Type *out, int len) const │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:455 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ -MPIFuture< TOUT, TIN > iallreduce(TIN &&data_in, TOUT &&data_out) const │ │ │ │ │ -Compute something over all processes nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:428 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -Number of processes in set, is greater than 0. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:134 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_g_a_t_h_e_r │ │ │ │ │ -int gather(const T *in, T *out, int len, int root) const │ │ │ │ │ -Gather arrays on root task. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:303 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ -int allreduce(Type *inout, int len) const │ │ │ │ │ -Compute something over all processes for each component of an array and return │ │ │ │ │ -the result in every pr... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:407 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_r_r_e_c_v │ │ │ │ │ -T rrecv(T &&data, int source_rank, int tag, MPI_Status │ │ │ │ │ -*status=MPI_STATUS_IGNORE) const │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_c_a_t_t_e_r │ │ │ │ │ -int scatter(const T *sendData, T *recvData, int len, int root) const │ │ │ │ │ -Scatter array from a root to all other task. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:336 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_r_e_c_v │ │ │ │ │ -MPIFuture< T > irecv(T &&data, int source_rank, int tag) const │ │ │ │ │ -Receives the data from the source_rank nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:172 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_p_r_o_d │ │ │ │ │ -int prod(T *inout, int len) const │ │ │ │ │ -Compute the product of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:226 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_g_a_t_h_e_r │ │ │ │ │ -MPIFuture< TOUT, TIN > igather(TIN &&data_in, TOUT &&data_out, int root) const │ │ │ │ │ -Gather arrays on root task nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:312 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_i_n │ │ │ │ │ -T min(const T &in) const │ │ │ │ │ -Compute the minimum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:233 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Communication(const MPI_Comm &c=MPI_COMM_WORLD) │ │ │ │ │ -Instantiation using a MPI communicator. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:111 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_i_s_c_a_t_t_e_r │ │ │ │ │ -MPIFuture< TOUT, TIN > iscatter(TIN &&data_in, TOUT &&data_out, int root) const │ │ │ │ │ -Scatter array from a root to all other task nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:345 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_g_a_t_h_e_r_v │ │ │ │ │ -int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, │ │ │ │ │ -int root) const │ │ │ │ │ -Gather arrays of variable size on root task. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:326 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_m_i_n │ │ │ │ │ -int min(T *inout, int len) const │ │ │ │ │ -Compute the minimum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:242 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_a_l_l_g_a_t_h_e_r │ │ │ │ │ -int allgather(const T *sbuf, int count, T1 *rbuf) const │ │ │ │ │ -Gathers data from all tasks and distribute it to all. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:374 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_s_e_n_d │ │ │ │ │ -int send(const T &data, int dest_rank, int tag) const │ │ │ │ │ -Sends the data to the dest_rank. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _M_P_I___C_o_m_m_ _>_:_:_p_r_o_d │ │ │ │ │ -T prod(const T &in) const │ │ │ │ │ -Compute the product of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:217 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ -Provides a future-like object for MPI communication. It contains the object │ │ │ │ │ -that will be received and... │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___s_e_n_d___m_p_i_d_a_t_a │ │ │ │ │ -auto get_send_mpidata() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:169 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___m_p_i_d_a_t_a │ │ │ │ │ -auto get_mpidata() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:165 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00203.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpitraits.hh File Reference │ │ │ │ +dune-common: gmpfield.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,51 +65,60 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces
    │ │ │ │ -
    mpitraits.hh File Reference
    │ │ │ │ +
    gmpfield.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Traits classes for mapping types onto MPI_Datatype. │ │ │ │ +

    Wrapper for the GNU multiprecision (GMP) library. │ │ │ │ More...

    │ │ │ │ -
    #include <cstddef>
    │ │ │ │ -#include <cstdint>
    │ │ │ │ +
    #include <iostream>
    │ │ │ │ +#include <string>
    │ │ │ │ #include <type_traits>
    │ │ │ │ -#include <utility>
    │ │ │ │ -#include <complex>
    │ │ │ │ -#include <mpi.h>
    │ │ │ │ +#include <gmpxx.h>
    │ │ │ │ +#include <dune/common/promotiontraits.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::MPITraits< T >
     A traits class describing the mapping of types onto MPI_Datatypes. More...
    class  Dune::GMPField< precision >
     Number class for high precision floating point number using the GMP library mpf_class implementation. More...
     
    struct  Dune::IsNumber< GMPField< precision > >
     
    struct  Dune::PromotionTraits< GMPField< precision1 >, GMPField< precision2 > >
     
    struct  Dune::PromotionTraits< GMPField< precision >, GMPField< precision > >
     
    struct  Dune::PromotionTraits< GMPField< precision >, T >
     
    struct  Dune::PromotionTraits< T, GMPField< precision > >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Traits classes for mapping types onto MPI_Datatype.

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

    Wrapper for the GNU multiprecision (GMP) library.

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,33 +1,40 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -mpitraits.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Traits classes for mapping types onto MPI_Datatype. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +gmpfield.hh File Reference │ │ │ │ │ +Wrapper for the GNU multiprecision (GMP) library. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ -  A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _> │ │ │ │ │ +  Number class for high precision floating point number using the GMP │ │ │ │ │ + library mpf_class implementation. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_N_u_m_b_e_r_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_1_ _>_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_2_ _> │ │ │ │ │ + _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _T_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +Wrapper for the GNU multiprecision (GMP) library. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00203_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpitraits.hh Source File │ │ │ │ +dune-common: gmpfield.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,218 +70,145 @@ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    mpitraits.hh
    │ │ │ │ +
    gmpfield.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_MPITRAITS_HH
    │ │ │ │ -
    6#define DUNE_MPITRAITS_HH
    │ │ │ │ +
    5#ifndef DUNE_GMPFIELD_HH
    │ │ │ │ +
    6#define DUNE_GMPFIELD_HH
    │ │ │ │
    7
    │ │ │ │ -
    18#if HAVE_MPI
    │ │ │ │ +
    12#include <iostream>
    │ │ │ │ +
    13#include <string>
    │ │ │ │ +
    14#include <type_traits>
    │ │ │ │ +
    15
    │ │ │ │ +
    16#if HAVE_GMP || DOXYGEN
    │ │ │ │ +
    17
    │ │ │ │ +
    18#include <gmpxx.h>
    │ │ │ │
    19
    │ │ │ │ -
    20#include <cstddef>
    │ │ │ │ -
    21#include <cstdint>
    │ │ │ │ -
    22#include <type_traits>
    │ │ │ │ -
    23#include <utility>
    │ │ │ │ -
    24#include <complex>
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    22
    │ │ │ │ +
    23namespace Dune
    │ │ │ │ +
    24{
    │ │ │ │
    25
    │ │ │ │ -
    26#include <mpi.h>
    │ │ │ │ -
    27
    │ │ │ │ -
    28namespace Dune
    │ │ │ │ -
    29{
    │ │ │ │ -
    39 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    40 struct MPITraits
    │ │ │ │ -
    41 {
    │ │ │ │ -
    42 private:
    │ │ │ │ -
    43 MPITraits(){}
    │ │ │ │ -
    44 MPITraits(const MPITraits&){}
    │ │ │ │ -
    45 static MPI_Datatype datatype;
    │ │ │ │ -
    46 static MPI_Datatype vectortype;
    │ │ │ │ -
    47 public:
    │ │ │ │ -
    │ │ │ │ -
    48 static inline MPI_Datatype getType()
    │ │ │ │ -
    49 {
    │ │ │ │ -
    50 if(datatype==MPI_DATATYPE_NULL) {
    │ │ │ │ -
    51 MPI_Type_contiguous(sizeof(T),MPI_BYTE,&datatype);
    │ │ │ │ -
    52 MPI_Type_commit(&datatype);
    │ │ │ │ -
    53 }
    │ │ │ │ -
    54 return datatype;
    │ │ │ │ -
    55 }
    │ │ │ │ -
    │ │ │ │ -
    56 static constexpr bool is_intrinsic = false;
    │ │ │ │ -
    57 };
    │ │ │ │ -
    │ │ │ │ -
    58 template<class T>
    │ │ │ │ -
    59 MPI_Datatype MPITraits<T>::datatype = MPI_DATATYPE_NULL;
    │ │ │ │ -
    60
    │ │ │ │ -
    61#ifndef DOXYGEN
    │ │ │ │ -
    62
    │ │ │ │ -
    63 // A Macro for defining traits for the primitive data types
    │ │ │ │ -
    64#define ComposeMPITraits(p,m) \
    │ │ │ │ -
    65 template<> \
    │ │ │ │ -
    66 struct MPITraits<p>{ \
    │ │ │ │ -
    67 static inline MPI_Datatype getType(){ \
    │ │ │ │ -
    68 return m; \
    │ │ │ │ -
    69 } \
    │ │ │ │ -
    70 static constexpr bool is_intrinsic = true; \
    │ │ │ │ -
    71 }
    │ │ │ │ -
    72
    │ │ │ │ -
    73 ComposeMPITraits(char, MPI_CHAR);
    │ │ │ │ -
    74 ComposeMPITraits(unsigned char,MPI_UNSIGNED_CHAR);
    │ │ │ │ -
    75 ComposeMPITraits(short,MPI_SHORT);
    │ │ │ │ -
    76 ComposeMPITraits(unsigned short,MPI_UNSIGNED_SHORT);
    │ │ │ │ -
    77 ComposeMPITraits(int,MPI_INT);
    │ │ │ │ -
    78 ComposeMPITraits(unsigned int,MPI_UNSIGNED);
    │ │ │ │ -
    79 ComposeMPITraits(long,MPI_LONG);
    │ │ │ │ -
    80 ComposeMPITraits(unsigned long,MPI_UNSIGNED_LONG);
    │ │ │ │ -
    81 ComposeMPITraits(float,MPI_FLOAT);
    │ │ │ │ -
    82 ComposeMPITraits(double,MPI_DOUBLE);
    │ │ │ │ -
    83 ComposeMPITraits(long double,MPI_LONG_DOUBLE);
    │ │ │ │ -
    84 ComposeMPITraits(std::complex<double>, MPI_CXX_DOUBLE_COMPLEX);
    │ │ │ │ -
    85 ComposeMPITraits(std::complex<long double>, MPI_CXX_LONG_DOUBLE_COMPLEX);
    │ │ │ │ -
    86 ComposeMPITraits(std::complex<float>, MPI_CXX_FLOAT_COMPLEX);
    │ │ │ │ -
    87
    │ │ │ │ -
    88
    │ │ │ │ -
    89#undef ComposeMPITraits
    │ │ │ │ +
    30 template< unsigned int precision >
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    32 : public mpf_class
    │ │ │ │ +
    33 {
    │ │ │ │ +
    34 typedef mpf_class Base;
    │ │ │ │ +
    35
    │ │ │ │ +
    36 public:
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    39 : Base(0,precision)
    │ │ │ │ +
    40 {}
    │ │ │ │ +
    │ │ │ │ +
    41
    │ │ │ │ +
    │ │ │ │ +
    45 GMPField ( const char* str )
    │ │ │ │ +
    46 : Base(str,precision)
    │ │ │ │ +
    47 {}
    │ │ │ │ +
    │ │ │ │ +
    48
    │ │ │ │ +
    │ │ │ │ +
    52 GMPField ( const std::string& str )
    │ │ │ │ +
    53 : Base(str,precision)
    │ │ │ │ +
    54 {}
    │ │ │ │ +
    │ │ │ │ +
    55
    │ │ │ │ +
    58 template< class T,
    │ │ │ │ +
    59 typename EnableIf = typename std::enable_if<
    │ │ │ │ +
    60 std::is_convertible<T, mpf_class>::value>::type
    │ │ │ │ +
    61 >
    │ │ │ │ +
    │ │ │ │ +
    62 GMPField ( const T &v )
    │ │ │ │ +
    63 : Base( v,precision )
    │ │ │ │ +
    64 {}
    │ │ │ │ +
    │ │ │ │ +
    65
    │ │ │ │ +
    66 // type conversion operators
    │ │ │ │ +
    │ │ │ │ +
    67 operator double () const
    │ │ │ │ +
    68 {
    │ │ │ │ +
    69 return this->get_d();
    │ │ │ │ +
    70 }
    │ │ │ │ +
    │ │ │ │ +
    71
    │ │ │ │ +
    72 };
    │ │ │ │ +
    │ │ │ │ +
    73
    │ │ │ │ +
    74 template <unsigned int precision>
    │ │ │ │ +
    │ │ │ │ +
    75 struct IsNumber<GMPField<precision>>
    │ │ │ │ +
    76 : public std::integral_constant<bool, true> {
    │ │ │ │ +
    77 };
    │ │ │ │ +
    │ │ │ │ +
    78
    │ │ │ │ +
    79 template< unsigned int precision1, unsigned int precision2 >
    │ │ │ │ +
    │ │ │ │ +
    80 struct PromotionTraits<GMPField<precision1>, GMPField<precision2>>
    │ │ │ │ +
    81 {
    │ │ │ │ +
    82 typedef GMPField<(precision1 > precision2 ? precision1 : precision2)> PromotedType;
    │ │ │ │ +
    83 };
    │ │ │ │ +
    │ │ │ │ +
    84
    │ │ │ │ +
    85 template< unsigned int precision >
    │ │ │ │ +
    │ │ │ │ +
    86 struct PromotionTraits<GMPField<precision>,GMPField<precision>>
    │ │ │ │ +
    87 {
    │ │ │ │ + │ │ │ │ +
    89 };
    │ │ │ │ +
    │ │ │ │
    90
    │ │ │ │ -
    91 template<class K, int n> class FieldVector;
    │ │ │ │ -
    92
    │ │ │ │ -
    93 template<class K, int n>
    │ │ │ │ -
    94 struct MPITraits<FieldVector<K,n> >
    │ │ │ │ -
    95 {
    │ │ │ │ -
    96 static MPI_Datatype datatype;
    │ │ │ │ -
    97 static MPI_Datatype vectortype;
    │ │ │ │ -
    98
    │ │ │ │ -
    99 static inline MPI_Datatype getType()
    │ │ │ │ -
    100 {
    │ │ │ │ -
    101 if(datatype==MPI_DATATYPE_NULL) {
    │ │ │ │ -
    102 MPI_Type_contiguous(n, MPITraits<K>::getType(), &vectortype);
    │ │ │ │ -
    103 MPI_Type_commit(&vectortype);
    │ │ │ │ -
    104 FieldVector<K,n> fvector;
    │ │ │ │ -
    105 MPI_Aint base;
    │ │ │ │ -
    106 MPI_Aint displ;
    │ │ │ │ -
    107 MPI_Get_address(&fvector, &base);
    │ │ │ │ -
    108 MPI_Get_address(&(fvector[0]), &displ);
    │ │ │ │ -
    109 displ -= base;
    │ │ │ │ -
    110 int length[1]={1};
    │ │ │ │ -
    111
    │ │ │ │ -
    112 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
    │ │ │ │ -
    113 MPI_Type_commit(&datatype);
    │ │ │ │ -
    114 }
    │ │ │ │ -
    115 return datatype;
    │ │ │ │ -
    116 }
    │ │ │ │ -
    117
    │ │ │ │ -
    118 };
    │ │ │ │ -
    119
    │ │ │ │ -
    120 template<class K, int n>
    │ │ │ │ -
    121 MPI_Datatype MPITraits<FieldVector<K,n> >::datatype = MPI_DATATYPE_NULL;
    │ │ │ │ -
    122 template<class K, int n>
    │ │ │ │ -
    123 MPI_Datatype MPITraits<FieldVector<K,n> >::vectortype = {MPI_DATATYPE_NULL};
    │ │ │ │ -
    124
    │ │ │ │ -
    125
    │ │ │ │ -
    126 template<int k>
    │ │ │ │ -
    127 class bigunsignedint;
    │ │ │ │ -
    128
    │ │ │ │ -
    129 template<int k>
    │ │ │ │ -
    130 struct MPITraits<bigunsignedint<k> >
    │ │ │ │ -
    131 {
    │ │ │ │ -
    132 static MPI_Datatype datatype;
    │ │ │ │ -
    133 static MPI_Datatype vectortype;
    │ │ │ │ -
    134
    │ │ │ │ -
    135 static inline MPI_Datatype getType()
    │ │ │ │ -
    136 {
    │ │ │ │ -
    137 if(datatype==MPI_DATATYPE_NULL) {
    │ │ │ │ - │ │ │ │ -
    139 &vectortype);
    │ │ │ │ -
    140 //MPI_Type_commit(&vectortype);
    │ │ │ │ -
    141 bigunsignedint<k> data;
    │ │ │ │ -
    142 MPI_Aint base;
    │ │ │ │ -
    143 MPI_Aint displ;
    │ │ │ │ -
    144 MPI_Get_address(&data, &base);
    │ │ │ │ -
    145 MPI_Get_address(&(data.digit), &displ);
    │ │ │ │ -
    146 displ -= base;
    │ │ │ │ -
    147 int length[1]={1};
    │ │ │ │ -
    148 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
    │ │ │ │ -
    149 MPI_Type_commit(&datatype);
    │ │ │ │ -
    150 }
    │ │ │ │ -
    151 return datatype;
    │ │ │ │ -
    152 }
    │ │ │ │ -
    153 };
    │ │ │ │ -
    154}
    │ │ │ │ -
    155
    │ │ │ │ -
    156namespace Dune
    │ │ │ │ -
    157{
    │ │ │ │ -
    158 template<int k>
    │ │ │ │ -
    159 MPI_Datatype MPITraits<bigunsignedint<k> >::datatype = MPI_DATATYPE_NULL;
    │ │ │ │ -
    160 template<int k>
    │ │ │ │ -
    161 MPI_Datatype MPITraits<bigunsignedint<k> >::vectortype = MPI_DATATYPE_NULL;
    │ │ │ │ -
    162
    │ │ │ │ -
    163 template<typename T1, typename T2>
    │ │ │ │ -
    164 struct MPITraits<std::pair<T1,T2 > >
    │ │ │ │ -
    165 {
    │ │ │ │ -
    166 public:
    │ │ │ │ -
    167 inline static MPI_Datatype getType();
    │ │ │ │ -
    168 private:
    │ │ │ │ -
    169 static MPI_Datatype type;
    │ │ │ │ -
    170 };
    │ │ │ │ -
    171 template<typename T1, typename T2>
    │ │ │ │ -
    172 MPI_Datatype MPITraits<std::pair<T1,T2> >::getType()
    │ │ │ │ -
    173 {
    │ │ │ │ -
    174 if(type==MPI_DATATYPE_NULL) {
    │ │ │ │ -
    175 int length[2] = {1, 1};
    │ │ │ │ -
    176 MPI_Aint disp[2];
    │ │ │ │ -
    177 MPI_Datatype types[2] = {MPITraits<T1>::getType(),
    │ │ │ │ - │ │ │ │ -
    179
    │ │ │ │ -
    180 using Pair = std::pair<T1, T2>;
    │ │ │ │ -
    181 static_assert(std::is_standard_layout<Pair>::value, "offsetof() is only defined for standard layout types");
    │ │ │ │ -
    182 disp[0] = offsetof(Pair, first);
    │ │ │ │ -
    183 disp[1] = offsetof(Pair, second);
    │ │ │ │ -
    184
    │ │ │ │ -
    185 MPI_Datatype tmp;
    │ │ │ │ -
    186 MPI_Type_create_struct(2, length, disp, types, &tmp);
    │ │ │ │ -
    187
    │ │ │ │ -
    188 MPI_Type_create_resized(tmp, 0, sizeof(Pair), &type);
    │ │ │ │ -
    189 MPI_Type_commit(&type);
    │ │ │ │ -
    190
    │ │ │ │ -
    191 MPI_Type_free(&tmp);
    │ │ │ │ -
    192 }
    │ │ │ │ -
    193 return type;
    │ │ │ │ -
    194 }
    │ │ │ │ -
    195
    │ │ │ │ -
    196 template<typename T1, typename T2>
    │ │ │ │ -
    197 MPI_Datatype MPITraits<std::pair<T1,T2> >::type=MPI_DATATYPE_NULL;
    │ │ │ │ -
    198
    │ │ │ │ -
    199#endif // !DOXYGEN
    │ │ │ │ -
    200
    │ │ │ │ -
    201} // namespace Dune
    │ │ │ │ -
    202
    │ │ │ │ -
    203#endif // HAVE_MPI
    │ │ │ │ -
    204
    │ │ │ │ -
    207#endif
    │ │ │ │ -
    STL namespace.
    │ │ │ │ +
    91 template< unsigned int precision, class T >
    │ │ │ │ +
    │ │ │ │ +
    92 struct PromotionTraits<GMPField<precision>, T>
    │ │ │ │ +
    93 {
    │ │ │ │ + │ │ │ │ +
    95 };
    │ │ │ │ +
    │ │ │ │ +
    96
    │ │ │ │ +
    97 template< class T, unsigned int precision >
    │ │ │ │ +
    │ │ │ │ +
    98 struct PromotionTraits<T, GMPField<precision>>
    │ │ │ │ +
    99 {
    │ │ │ │ + │ │ │ │ +
    101 };
    │ │ │ │ +
    │ │ │ │ +
    102}
    │ │ │ │ +
    103
    │ │ │ │ +
    104#endif // HAVE_GMP
    │ │ │ │ +
    105
    │ │ │ │ +
    106#endif // #ifndef DUNE_GMPFIELD_HH
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    Compute type of the result of an arithmetic operation involving two different number types.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition mpitraits.hh:41
    │ │ │ │ -
    static MPI_Datatype getType()
    Definition mpitraits.hh:48
    │ │ │ │ -
    static constexpr bool is_intrinsic
    Definition mpitraits.hh:56
    │ │ │ │ -
    static constexpr int n
    Definition bigunsignedint.hh:78
    │ │ │ │ -
    vector space out of a tensor product of fields.
    Definition fvector.hh:95
    │ │ │ │ +
    Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
    Definition typetraits.hh:194
    │ │ │ │ +
    Number class for high precision floating point number using the GMP library mpf_class implementation.
    Definition gmpfield.hh:33
    │ │ │ │ +
    GMPField(const T &v)
    initialize from a compatible scalar type
    Definition gmpfield.hh:62
    │ │ │ │ +
    GMPField()
    Definition gmpfield.hh:38
    │ │ │ │ +
    GMPField(const std::string &str)
    initialize from a string
    Definition gmpfield.hh:52
    │ │ │ │ +
    GMPField(const char *str)
    initialize from a string
    Definition gmpfield.hh:45
    │ │ │ │ +
    GMPField< precision > PromotedType
    Definition gmpfield.hh:88
    │ │ │ │ +
    GMPField< precision > PromotedType
    Definition gmpfield.hh:94
    │ │ │ │ +
    GMPField< precision > PromotedType
    Definition gmpfield.hh:100
    │ │ │ │ +
    Compute type of the result of an arithmetic operation involving two different number types.
    Definition promotiontraits.hh:27
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,221 +1,146 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpitraits.hh │ │ │ │ │ +gmpfield.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_MPITRAITS_HH │ │ │ │ │ -6#define DUNE_MPITRAITS_HH │ │ │ │ │ +5#ifndef DUNE_GMPFIELD_HH │ │ │ │ │ +6#define DUNE_GMPFIELD_HH │ │ │ │ │ 7 │ │ │ │ │ -18#if HAVE_MPI │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#if HAVE_GMP || DOXYGEN │ │ │ │ │ +17 │ │ │ │ │ +18#include │ │ │ │ │ 19 │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22#include │ │ │ │ │ -23#include │ │ │ │ │ -24#include │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +22 │ │ │ │ │ +23namespace _D_u_n_e │ │ │ │ │ +24{ │ │ │ │ │ 25 │ │ │ │ │ -26#include │ │ │ │ │ -27 │ │ │ │ │ -28namespace _D_u_n_e │ │ │ │ │ -29{ │ │ │ │ │ -39 template │ │ │ │ │ -_4_0 struct _M_P_I_T_r_a_i_t_s │ │ │ │ │ -41 { │ │ │ │ │ -42 private: │ │ │ │ │ -43 _M_P_I_T_r_a_i_t_s(){} │ │ │ │ │ -44 _M_P_I_T_r_a_i_t_s(const _M_P_I_T_r_a_i_t_s&){} │ │ │ │ │ -45 static MPI_Datatype datatype; │ │ │ │ │ -46 static MPI_Datatype vectortype; │ │ │ │ │ -47 public: │ │ │ │ │ -_4_8 static inline MPI_Datatype _g_e_t_T_y_p_e() │ │ │ │ │ -49 { │ │ │ │ │ -50 if(datatype==MPI_DATATYPE_NULL) { │ │ │ │ │ -51 MPI_Type_contiguous(sizeof(T),MPI_BYTE,&datatype); │ │ │ │ │ -52 MPI_Type_commit(&datatype); │ │ │ │ │ -53 } │ │ │ │ │ -54 return datatype; │ │ │ │ │ -55 } │ │ │ │ │ -_5_6 static constexpr bool _i_s___i_n_t_r_i_n_s_i_c = false; │ │ │ │ │ -57 }; │ │ │ │ │ -58 template │ │ │ │ │ -59 MPI_Datatype _M_P_I_T_r_a_i_t_s_<_T_>_:_:_d_a_t_a_t_y_p_e = MPI_DATATYPE_NULL; │ │ │ │ │ -60 │ │ │ │ │ -61#ifndef DOXYGEN │ │ │ │ │ -62 │ │ │ │ │ -63 // A Macro for defining traits for the primitive data types │ │ │ │ │ -64#define ComposeMPITraits(p,m) \ │ │ │ │ │ -65 template<> \ │ │ │ │ │ -66 struct MPITraits

    { \ │ │ │ │ │ -67 static inline MPI_Datatype getType(){ \ │ │ │ │ │ -68 return m; \ │ │ │ │ │ -69 } \ │ │ │ │ │ -70 static constexpr bool is_intrinsic = true; \ │ │ │ │ │ -71 } │ │ │ │ │ -72 │ │ │ │ │ -73 ComposeMPITraits(char, MPI_CHAR); │ │ │ │ │ -74 ComposeMPITraits(unsigned char,MPI_UNSIGNED_CHAR); │ │ │ │ │ -75 ComposeMPITraits(short,MPI_SHORT); │ │ │ │ │ -76 ComposeMPITraits(unsigned short,MPI_UNSIGNED_SHORT); │ │ │ │ │ -77 ComposeMPITraits(int,MPI_INT); │ │ │ │ │ -78 ComposeMPITraits(unsigned int,MPI_UNSIGNED); │ │ │ │ │ -79 ComposeMPITraits(long,MPI_LONG); │ │ │ │ │ -80 ComposeMPITraits(unsigned long,MPI_UNSIGNED_LONG); │ │ │ │ │ -81 ComposeMPITraits(float,MPI_FLOAT); │ │ │ │ │ -82 ComposeMPITraits(double,MPI_DOUBLE); │ │ │ │ │ -83 ComposeMPITraits(long double,MPI_LONG_DOUBLE); │ │ │ │ │ -84 ComposeMPITraits(std::complex, MPI_CXX_DOUBLE_COMPLEX); │ │ │ │ │ -85 ComposeMPITraits(std::complex, MPI_CXX_LONG_DOUBLE_COMPLEX); │ │ │ │ │ -86 ComposeMPITraits(std::complex, MPI_CXX_FLOAT_COMPLEX); │ │ │ │ │ -87 │ │ │ │ │ -88 │ │ │ │ │ -89#undef ComposeMPITraits │ │ │ │ │ +30 template< unsigned int precision > │ │ │ │ │ +_3_1 class _G_M_P_F_i_e_l_d │ │ │ │ │ +32 : public mpf_class │ │ │ │ │ +33 { │ │ │ │ │ +34 typedef mpf_class Base; │ │ │ │ │ +35 │ │ │ │ │ +36 public: │ │ │ │ │ +_3_8 _G_M_P_F_i_e_l_d () │ │ │ │ │ +39 : Base(0,precision) │ │ │ │ │ +40 {} │ │ │ │ │ +41 │ │ │ │ │ +_4_5 _G_M_P_F_i_e_l_d ( const char* str ) │ │ │ │ │ +46 : Base(str,precision) │ │ │ │ │ +47 {} │ │ │ │ │ +48 │ │ │ │ │ +_5_2 _G_M_P_F_i_e_l_d ( const std::string& str ) │ │ │ │ │ +53 : Base(str,precision) │ │ │ │ │ +54 {} │ │ │ │ │ +55 │ │ │ │ │ +58 template< class T, │ │ │ │ │ +59 typename EnableIf = typename std::enable_if< │ │ │ │ │ +60 std::is_convertible::value>::type │ │ │ │ │ +61 > │ │ │ │ │ +_6_2 _G_M_P_F_i_e_l_d ( const T &v ) │ │ │ │ │ +63 : Base( v,precision ) │ │ │ │ │ +64 {} │ │ │ │ │ +65 │ │ │ │ │ +66 // type conversion operators │ │ │ │ │ +_6_7 operator double () const │ │ │ │ │ +68 { │ │ │ │ │ +69 return this->get_d(); │ │ │ │ │ +70 } │ │ │ │ │ +71 │ │ │ │ │ +72 }; │ │ │ │ │ +73 │ │ │ │ │ +74 template │ │ │ │ │ +_7_5 struct _I_s_N_u_m_b_e_r<_G_M_P_F_i_e_l_d> │ │ │ │ │ +76 : public std::integral_constant { │ │ │ │ │ +77 }; │ │ │ │ │ +78 │ │ │ │ │ +79 template< unsigned int precision1, unsigned int precision2 > │ │ │ │ │ +_8_0 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s<_G_M_P_F_i_e_l_d, _G_M_P_F_i_e_l_d> │ │ │ │ │ +81 { │ │ │ │ │ +_8_2 typedef _G_M_P_F_i_e_l_d<(precision1 > precision2 ? precision1 : precision2)> │ │ │ │ │ +_P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +83 }; │ │ │ │ │ +84 │ │ │ │ │ +85 template< unsigned int precision > │ │ │ │ │ +_8_6 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s<_G_M_P_F_i_e_l_d,_G_M_P_F_i_e_l_d> │ │ │ │ │ +87 { │ │ │ │ │ +_8_8 typedef _G_M_P_F_i_e_l_d_<_p_r_e_c_i_s_i_o_n_> _P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +89 }; │ │ │ │ │ 90 │ │ │ │ │ -91 template class _F_i_e_l_d_V_e_c_t_o_r; │ │ │ │ │ -92 │ │ │ │ │ -93 template │ │ │ │ │ -94 struct _M_P_I_T_r_a_i_t_s<_F_i_e_l_d_V_e_c_t_o_r > │ │ │ │ │ -95 { │ │ │ │ │ -96 static MPI_Datatype datatype; │ │ │ │ │ -97 static MPI_Datatype vectortype; │ │ │ │ │ -98 │ │ │ │ │ -99 static inline MPI_Datatype _g_e_t_T_y_p_e() │ │ │ │ │ -100 { │ │ │ │ │ -101 if(datatype==MPI_DATATYPE_NULL) { │ │ │ │ │ -102 MPI_Type_contiguous(n, _M_P_I_T_r_a_i_t_s_<_K_>_:_:_g_e_t_T_y_p_e(), &vectortype); │ │ │ │ │ -103 MPI_Type_commit(&vectortype); │ │ │ │ │ -104 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_n_> fvector; │ │ │ │ │ -105 MPI_Aint base; │ │ │ │ │ -106 MPI_Aint displ; │ │ │ │ │ -107 MPI_Get_address(&fvector, &base); │ │ │ │ │ -108 MPI_Get_address(&(fvector[0]), &displ); │ │ │ │ │ -109 displ -= base; │ │ │ │ │ -110 int length[1]={1}; │ │ │ │ │ -111 │ │ │ │ │ -112 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype); │ │ │ │ │ -113 MPI_Type_commit(&datatype); │ │ │ │ │ -114 } │ │ │ │ │ -115 return datatype; │ │ │ │ │ -116 } │ │ │ │ │ -117 │ │ │ │ │ -118 }; │ │ │ │ │ -119 │ │ │ │ │ -120 template │ │ │ │ │ -121 MPI_Datatype MPITraits >::datatype = MPI_DATATYPE_NULL; │ │ │ │ │ -122 template │ │ │ │ │ -123 MPI_Datatype MPITraits >::vectortype = │ │ │ │ │ -{MPI_DATATYPE_NULL}; │ │ │ │ │ -124 │ │ │ │ │ -125 │ │ │ │ │ -126 template │ │ │ │ │ -127 class bigunsignedint; │ │ │ │ │ -128 │ │ │ │ │ -129 template │ │ │ │ │ -130 struct MPITraits > │ │ │ │ │ -131 { │ │ │ │ │ -132 static MPI_Datatype datatype; │ │ │ │ │ -133 static MPI_Datatype vectortype; │ │ │ │ │ -134 │ │ │ │ │ -135 static inline MPI_Datatype _g_e_t_T_y_p_e() │ │ │ │ │ -136 { │ │ │ │ │ -137 if(datatype==MPI_DATATYPE_NULL) { │ │ │ │ │ -138 MPI_Type_contiguous(_b_i_g_u_n_s_i_g_n_e_d_i_n_t_<_k_>_:_:_n, _M_P_I_T_r_a_i_t_s_<_s_t_d_:_:_u_i_n_t_1_6___t_>_:_:_g_e_t_T_y_p_e │ │ │ │ │ -(), │ │ │ │ │ -139 &vectortype); │ │ │ │ │ -140 //MPI_Type_commit(&vectortype); │ │ │ │ │ -141 bigunsignedint data; │ │ │ │ │ -142 MPI_Aint base; │ │ │ │ │ -143 MPI_Aint displ; │ │ │ │ │ -144 MPI_Get_address(&data, &base); │ │ │ │ │ -145 MPI_Get_address(&(data.digit), &displ); │ │ │ │ │ -146 displ -= base; │ │ │ │ │ -147 int length[1]={1}; │ │ │ │ │ -148 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype); │ │ │ │ │ -149 MPI_Type_commit(&datatype); │ │ │ │ │ -150 } │ │ │ │ │ -151 return datatype; │ │ │ │ │ -152 } │ │ │ │ │ -153 }; │ │ │ │ │ -154} │ │ │ │ │ -155 │ │ │ │ │ -156namespace _D_u_n_e │ │ │ │ │ -157{ │ │ │ │ │ -158 template │ │ │ │ │ -159 MPI_Datatype MPITraits >::datatype = MPI_DATATYPE_NULL; │ │ │ │ │ -160 template │ │ │ │ │ -161 MPI_Datatype MPITraits >::vectortype = MPI_DATATYPE_NULL; │ │ │ │ │ -162 │ │ │ │ │ -163 template │ │ │ │ │ -164 struct MPITraits<_s_t_d::pair > │ │ │ │ │ -165 { │ │ │ │ │ -166 public: │ │ │ │ │ -167 inline static MPI_Datatype _g_e_t_T_y_p_e(); │ │ │ │ │ -168 private: │ │ │ │ │ -169 static MPI_Datatype type; │ │ │ │ │ -170 }; │ │ │ │ │ -171 template │ │ │ │ │ -172 MPI_Datatype MPITraits >::getType() │ │ │ │ │ -173 { │ │ │ │ │ -174 if(type==MPI_DATATYPE_NULL) { │ │ │ │ │ -175 int length[2] = {1, 1}; │ │ │ │ │ -176 MPI_Aint disp[2]; │ │ │ │ │ -177 MPI_Datatype types[2] = {_M_P_I_T_r_a_i_t_s_<_T_1_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -178 _M_P_I_T_r_a_i_t_s_<_T_2_>_:_:_g_e_t_T_y_p_e()}; │ │ │ │ │ -179 │ │ │ │ │ -180 using Pair = std::pair; │ │ │ │ │ -181 static_assert(std::is_standard_layout::value, "offsetof() is only │ │ │ │ │ -defined for standard layout types"); │ │ │ │ │ -182 disp[0] = offsetof(Pair, first); │ │ │ │ │ -183 disp[1] = offsetof(Pair, second); │ │ │ │ │ -184 │ │ │ │ │ -185 MPI_Datatype tmp; │ │ │ │ │ -186 MPI_Type_create_struct(2, length, disp, types, &tmp); │ │ │ │ │ -187 │ │ │ │ │ -188 MPI_Type_create_resized(tmp, 0, sizeof(Pair), &type); │ │ │ │ │ -189 MPI_Type_commit(&type); │ │ │ │ │ -190 │ │ │ │ │ -191 MPI_Type_free(&tmp); │ │ │ │ │ -192 } │ │ │ │ │ -193 return type; │ │ │ │ │ -194 } │ │ │ │ │ -195 │ │ │ │ │ -196 template │ │ │ │ │ -197 MPI_Datatype MPITraits >::type=MPI_DATATYPE_NULL; │ │ │ │ │ -198 │ │ │ │ │ -199#endif // !DOXYGEN │ │ │ │ │ -200 │ │ │ │ │ -201} // namespace Dune │ │ │ │ │ -202 │ │ │ │ │ -203#endif // HAVE_MPI │ │ │ │ │ -204 │ │ │ │ │ -207#endif │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +91 template< unsigned int precision, class T > │ │ │ │ │ +_9_2 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s<_G_M_P_F_i_e_l_d, T> │ │ │ │ │ +93 { │ │ │ │ │ +_9_4 typedef _G_M_P_F_i_e_l_d_<_p_r_e_c_i_s_i_o_n_> _P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +95 }; │ │ │ │ │ +96 │ │ │ │ │ +97 template< class T, unsigned int precision > │ │ │ │ │ +_9_8 struct _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s> │ │ │ │ │ +99 { │ │ │ │ │ +_1_0_0 typedef _G_M_P_F_i_e_l_d_<_p_r_e_c_i_s_i_o_n_> _P_r_o_m_o_t_e_d_T_y_p_e; │ │ │ │ │ +101 }; │ │ │ │ │ +102} │ │ │ │ │ +103 │ │ │ │ │ +104#endif // HAVE_GMP │ │ │ │ │ +105 │ │ │ │ │ +106#endif // #ifndef DUNE_GMPFIELD_HH │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h │ │ │ │ │ +Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ +number types. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s │ │ │ │ │ -A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ -DDeeffiinniittiioonn mpitraits.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_:_:_g_e_t_T_y_p_e │ │ │ │ │ -static MPI_Datatype getType() │ │ │ │ │ -DDeeffiinniittiioonn mpitraits.hh:48 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_:_:_i_s___i_n_t_r_i_n_s_i_c │ │ │ │ │ -static constexpr bool is_intrinsic │ │ │ │ │ -DDeeffiinniittiioonn mpitraits.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_b_i_g_u_n_s_i_g_n_e_d_i_n_t_:_:_n │ │ │ │ │ -static constexpr int n │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -vector space out of a tensor product of fields. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_I_s_N_u_m_b_e_r │ │ │ │ │ +Whether this type acts as a scalar in the context of (hierarchically blocked) │ │ │ │ │ +containers. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ +Number class for high precision floating point number using the GMP library │ │ │ │ │ +mpf_class implementation. │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ +GMPField(const T &v) │ │ │ │ │ +initialize from a compatible scalar type │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:62 │ │ │ │ │ +_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ +GMPField() │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ +GMPField(const std::string &str) │ │ │ │ │ +initialize from a string │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_G_M_P_F_i_e_l_d_:_:_G_M_P_F_i_e_l_d │ │ │ │ │ +GMPField(const char *str) │ │ │ │ │ +initialize from a string │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _>_:_: │ │ │ │ │ +_P_r_o_m_o_t_e_d_T_y_p_e │ │ │ │ │ +GMPField< precision > PromotedType │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_,_ _T_ _>_:_:_P_r_o_m_o_t_e_d_T_y_p_e │ │ │ │ │ +GMPField< precision > PromotedType │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_ _T_,_ _G_M_P_F_i_e_l_d_<_ _p_r_e_c_i_s_i_o_n_ _>_ _>_:_:_P_r_o_m_o_t_e_d_T_y_p_e │ │ │ │ │ +GMPField< precision > PromotedType │ │ │ │ │ +DDeeffiinniittiioonn gmpfield.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s │ │ │ │ │ +Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ +number types. │ │ │ │ │ +DDeeffiinniittiioonn promotiontraits.hh:27 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00206.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpiguard.hh File Reference │ │ │ │ +dune-common: parametertreeparser.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,52 +65,32 @@ │ │ │ │

    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    │ │ │ │ -Classes | │ │ │ │ -Namespaces
    │ │ │ │ -
    mpiguard.hh File Reference
    │ │ │ │ +
    parametertreeparser.cc File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Implements a MPIGuard which detects an error on a remote process. │ │ │ │ -More...

    │ │ │ │ -
    #include "mpihelper.hh"
    │ │ │ │ -#include "communication.hh"
    │ │ │ │ -#include "mpicommunication.hh"
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -
    │ │ │ │ -

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    class  Dune::MPIGuardError
     This exception is thrown if the MPIGuard detects an error on a remote process. More...
     
    class  Dune::MPIGuard
     detects a thrown exception and communicates to all other processes More...
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Namespaces

    namespace  Dune
     Dune namespace.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Implements a MPIGuard which detects an error on a remote process.

    │ │ │ │ -
    Author
    Christian Engwer
    │ │ │ │ +
    #include "parametertreeparser.hh"
    │ │ │ │ +#include <cstdlib>
    │ │ │ │ +#include <iostream>
    │ │ │ │ +#include <ostream>
    │ │ │ │ +#include <string>
    │ │ │ │ +#include <sstream>
    │ │ │ │ +#include <fstream>
    │ │ │ │ +#include <set>
    │ │ │ │ +#include <map>
    │ │ │ │ +#include <algorithm>
    │ │ │ │ +#include <dune/common/exceptions.hh>
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,20 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -mpiguard.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Implements a MPIGuard which detects an error on a remote process. _M_o_r_e_._._. │ │ │ │ │ -#include "_m_p_i_h_e_l_p_e_r_._h_h" │ │ │ │ │ -#include "_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h" │ │ │ │ │ -#include "_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h" │ │ │ │ │ +parametertreeparser.cc File Reference │ │ │ │ │ +#include "_p_a_r_a_m_e_t_e_r_t_r_e_e_p_a_r_s_e_r_._h_h" │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_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_:_:_M_P_I_G_u_a_r_d_E_r_r_o_r │ │ │ │ │ -  This exception is thrown if the _M_P_I_G_u_a_r_d detects an error on a remote │ │ │ │ │ - process. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_M_P_I_G_u_a_r_d │ │ │ │ │ -  detects a thrown exception and communicates to all other processes │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implements a MPIGuard which detects an error on a remote process. │ │ │ │ │ - Author │ │ │ │ │ - Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00209.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpifuture.hh File Reference │ │ │ │ +dune-common: densevector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,51 +65,60 @@ │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces
    │ │ │ │ -
    mpifuture.hh File Reference
    │ │ │ │ +
    densevector.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include <optional>
    │ │ │ │ -#include <dune/common/parallel/communication.hh>
    │ │ │ │ -#include <dune/common/parallel/future.hh>
    │ │ │ │ -#include <dune/common/parallel/mpidata.hh>
    │ │ │ │ + │ │ │ │ +

    Implements the dense vector interface, with an exchangeable storage class. │ │ │ │ +More...

    │ │ │ │ +
    #include <algorithm>
    │ │ │ │ +#include <limits>
    │ │ │ │ +#include <type_traits>
    │ │ │ │ +#include "genericiterator.hh"
    │ │ │ │ +#include "ftraits.hh"
    │ │ │ │ +#include "matvectraits.hh"
    │ │ │ │ +#include "promotiontraits.hh"
    │ │ │ │ +#include "dotproduct.hh"
    │ │ │ │ +#include "boundschecking.hh"
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::impl::Buffer< T >
     
    struct  Dune::impl::Buffer< T & >
    struct  Dune::FieldTraits< DenseVector< V > >
     
    struct  Dune::impl::Buffer< void >
    class  Dune::DenseIterator< C, T, R >
     Generic iterator class for dense vector and matrix implementations. More...
     
    class  Dune::MPIFuture< R, S >
     Provides a future-like object for MPI communication. It contains the object that will be received and might contain also a sending object, which must be hold (keep alive) until the communication has been completed. More...
    class  Dune::DenseVector< V >
     Interface for a class of dense vectors over a given field. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::impl
    namespace  Dune::fvmeta
     
    │ │ │ │ -
    │ │ │ │ +

    Detailed Description

    │ │ │ │ +

    Implements the dense vector interface, with an exchangeable storage class.

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,41 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -mpifuture.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ +densevector.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _D_e_n_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y │ │ │ │ │ +Implements the dense vector interface, with an exchangeable storage class. │ │ │ │ │ +_M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h" │ │ │ │ │ +#include "_f_t_r_a_i_t_s_._h_h" │ │ │ │ │ +#include "_m_a_t_v_e_c_t_r_a_i_t_s_._h_h" │ │ │ │ │ +#include "_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h" │ │ │ │ │ +#include "_d_o_t_p_r_o_d_u_c_t_._h_h" │ │ │ │ │ +#include "_b_o_u_n_d_s_c_h_e_c_k_i_n_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_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_e_n_s_e_V_e_c_t_o_r_<_ _V_ _>_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_<_ _C_,_ _T_,_ _R_ _> │ │ │ │ │ +  Generic iterator class for dense vector and matrix implementations. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_<_ _R_,_ _S_ _> │ │ │ │ │ - Provides a future-like object for MPI communication. It contains the │ │ │ │ │ -  object that will be received and might contain also a sending object, │ │ │ │ │ - which must be hold (keep alive) until the communication has been │ │ │ │ │ - completed. _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_<_ _V_ _> │ │ │ │ │ +  _I_n_t_e_r_f_a_c_e for a class of dense vectors over a given field. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_i_m_p_l │ │ │ │ │ +namespace   _D_u_n_e_:_:_f_v_m_e_t_a │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Implements the dense vector interface, with an exchangeable storage class. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00209_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpifuture.hh Source File │ │ │ │ +dune-common: densevector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,290 +70,834 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    mpifuture.hh
    │ │ │ │ +
    densevector.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_PARALLEL_MPIFUTURE_HH
    │ │ │ │ -
    6#define DUNE_COMMON_PARALLEL_MPIFUTURE_HH
    │ │ │ │ +
    5#ifndef DUNE_DENSEVECTOR_HH
    │ │ │ │ +
    6#define DUNE_DENSEVECTOR_HH
    │ │ │ │
    7
    │ │ │ │ -
    8#include <optional>
    │ │ │ │ -
    9
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    13
    │ │ │ │ -
    14#if HAVE_MPI
    │ │ │ │ -
    15namespace Dune{
    │ │ │ │ -
    16
    │ │ │ │ -
    │ │ │ │ -
    17 namespace impl{
    │ │ │ │ -
    18 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    19 struct Buffer{
    │ │ │ │ -
    │ │ │ │ -
    20 Buffer(bool valid){
    │ │ │ │ -
    21 if(valid)
    │ │ │ │ -
    22 value = std::make_unique<T>();
    │ │ │ │ -
    23 }
    │ │ │ │ -
    │ │ │ │ -
    24 template<class V>
    │ │ │ │ -
    │ │ │ │ -
    25 Buffer(V&& t)
    │ │ │ │ -
    26 : value(std::make_unique<T>(std::forward<V>(t)))
    │ │ │ │ -
    27 {}
    │ │ │ │ -
    │ │ │ │ -
    28 std::unique_ptr<T> value;
    │ │ │ │ -
    │ │ │ │ -
    29 T get(){
    │ │ │ │ -
    30 T tmp = std::move(*value);
    │ │ │ │ -
    31 value.reset();
    │ │ │ │ -
    32 return tmp;
    │ │ │ │ -
    33 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    34 operator bool () const {
    │ │ │ │ -
    35 return (bool)value;
    │ │ │ │ -
    36 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    37 T& operator *() const{
    │ │ │ │ -
    38 return *value;
    │ │ │ │ -
    39 }
    │ │ │ │ -
    │ │ │ │ -
    40 };
    │ │ │ │ -
    │ │ │ │ -
    41
    │ │ │ │ -
    42 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    43 struct Buffer<T&>{
    │ │ │ │ -
    │ │ │ │ -
    44 Buffer(bool valid = false)
    │ │ │ │ -
    45 {
    │ │ │ │ -
    46 if(valid)
    │ │ │ │ -
    47 value = T();
    │ │ │ │ -
    48 }
    │ │ │ │ -
    │ │ │ │ -
    49 template<class V>
    │ │ │ │ -
    │ │ │ │ -
    50 Buffer(V&& t)
    │ │ │ │ -
    51 : value(std::forward<V>(t))
    │ │ │ │ -
    52 {}
    │ │ │ │ -
    │ │ │ │ -
    53 std::optional<std::reference_wrapper<T>> value;
    │ │ │ │ -
    │ │ │ │ -
    54 T& get(){
    │ │ │ │ -
    55 T& tmp = *value;
    │ │ │ │ -
    56 value.reset();
    │ │ │ │ -
    57 return tmp;
    │ │ │ │ -
    58 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    59 operator bool () const{
    │ │ │ │ -
    60 return (bool)value;
    │ │ │ │ -
    61 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    62 T& operator *() const{
    │ │ │ │ -
    63 return *value;
    │ │ │ │ -
    64 }
    │ │ │ │ -
    │ │ │ │ -
    65 };
    │ │ │ │ -
    │ │ │ │ -
    66
    │ │ │ │ -
    67 template<>
    │ │ │ │ -
    │ │ │ │ -
    68 struct Buffer<void>{
    │ │ │ │ -
    69 bool valid_;
    │ │ │ │ -
    │ │ │ │ -
    70 Buffer(bool valid = false)
    │ │ │ │ -
    71 : valid_(valid)
    │ │ │ │ -
    72 {}
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    73 operator bool () const{
    │ │ │ │ -
    74 return valid_;
    │ │ │ │ -
    75 }
    │ │ │ │ -
    │ │ │ │ -
    76 void get(){}
    │ │ │ │ -
    77 };
    │ │ │ │ -
    │ │ │ │ -
    78 }
    │ │ │ │ -
    │ │ │ │ -
    79
    │ │ │ │ -
    84 template<class R, class S = void>
    │ │ │ │ -
    │ │ │ │ -
    85 class MPIFuture{
    │ │ │ │ -
    86 mutable MPI_Request req_;
    │ │ │ │ -
    87 mutable MPI_Status status_;
    │ │ │ │ -
    88 impl::Buffer<R> data_;
    │ │ │ │ -
    89 impl::Buffer<S> send_data_;
    │ │ │ │ -
    90 friend class Communication<MPI_Comm>;
    │ │ │ │ -
    91 public:
    │ │ │ │ -
    │ │ │ │ -
    92 MPIFuture(bool valid = false)
    │ │ │ │ -
    93 : req_(MPI_REQUEST_NULL)
    │ │ │ │ -
    94 , data_(valid)
    │ │ │ │ -
    95 {}
    │ │ │ │ -
    │ │ │ │ -
    96
    │ │ │ │ -
    97 // Hide this constructor if R or S is void
    │ │ │ │ -
    98 template<class V = R, class U = S>
    │ │ │ │ -
    │ │ │ │ -
    99 MPIFuture(V&& recv_data, U&& send_data, typename std::enable_if_t<!std::is_void<V>::value && !std::is_void<U>::value>* = 0) :
    │ │ │ │ -
    100 req_(MPI_REQUEST_NULL)
    │ │ │ │ -
    101 , data_(std::forward<R>(recv_data))
    │ │ │ │ -
    102 , send_data_(std::forward<S>(send_data))
    │ │ │ │ -
    103 {}
    │ │ │ │ -
    │ │ │ │ -
    104
    │ │ │ │ -
    105 // hide this constructor if R is void
    │ │ │ │ -
    106 template<class V = R>
    │ │ │ │ -
    │ │ │ │ -
    107 MPIFuture(V&& recv_data, typename std::enable_if_t<!std::is_void<V>::value>* = 0)
    │ │ │ │ -
    108 : req_(MPI_REQUEST_NULL)
    │ │ │ │ -
    109 , data_(std::forward<V>(recv_data))
    │ │ │ │ -
    110 {}
    │ │ │ │ -
    │ │ │ │ +
    8#include <algorithm>
    │ │ │ │ +
    9#include <limits>
    │ │ │ │ +
    10#include <type_traits>
    │ │ │ │ +
    11
    │ │ │ │ +
    12#include "genericiterator.hh"
    │ │ │ │ +
    13#include "ftraits.hh"
    │ │ │ │ +
    14#include "matvectraits.hh"
    │ │ │ │ +
    15#include "promotiontraits.hh"
    │ │ │ │ +
    16#include "dotproduct.hh"
    │ │ │ │ +
    17#include "boundschecking.hh"
    │ │ │ │ +
    18
    │ │ │ │ +
    19namespace Dune {
    │ │ │ │ +
    20
    │ │ │ │ +
    21 // forward declaration of template
    │ │ │ │ +
    22 template<typename V> class DenseVector;
    │ │ │ │ +
    23
    │ │ │ │ +
    24 template<typename V>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    26 {
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    29 };
    │ │ │ │ +
    │ │ │ │ +
    30
    │ │ │ │ +
    │ │ │ │ +
    40 namespace fvmeta
    │ │ │ │ +
    41 {
    │ │ │ │ +
    46 template<class K>
    │ │ │ │ +
    47 inline typename FieldTraits<K>::real_type absreal (const K& k)
    │ │ │ │ +
    48 {
    │ │ │ │ +
    49 using std::abs;
    │ │ │ │ +
    50 return abs(k);
    │ │ │ │ +
    51 }
    │ │ │ │ +
    52
    │ │ │ │ +
    57 template<class K>
    │ │ │ │ +
    58 inline typename FieldTraits<K>::real_type absreal (const std::complex<K>& c)
    │ │ │ │ +
    59 {
    │ │ │ │ +
    60 using std::abs;
    │ │ │ │ +
    61 return abs(c.real()) + abs(c.imag());
    │ │ │ │ +
    62 }
    │ │ │ │ +
    63
    │ │ │ │ +
    68 template<class K>
    │ │ │ │ +
    69 inline typename FieldTraits<K>::real_type abs2 (const K& k)
    │ │ │ │ +
    70 {
    │ │ │ │ +
    71 return k*k;
    │ │ │ │ +
    72 }
    │ │ │ │ +
    73
    │ │ │ │ +
    78 template<class K>
    │ │ │ │ +
    79 inline typename FieldTraits<K>::real_type abs2 (const std::complex<K>& c)
    │ │ │ │ +
    80 {
    │ │ │ │ +
    81 return c.real()*c.real() + c.imag()*c.imag();
    │ │ │ │ +
    82 }
    │ │ │ │ +
    83
    │ │ │ │ +
    88 template<class K, bool isInteger = std::numeric_limits<K>::is_integer>
    │ │ │ │ +
    89 struct Sqrt
    │ │ │ │ +
    90 {
    │ │ │ │ +
    91 static inline typename FieldTraits<K>::real_type sqrt (const K& k)
    │ │ │ │ +
    92 {
    │ │ │ │ +
    93 using std::sqrt;
    │ │ │ │ +
    94 return sqrt(k);
    │ │ │ │ +
    95 }
    │ │ │ │ +
    96 };
    │ │ │ │ +
    97
    │ │ │ │ +
    102 template<class K>
    │ │ │ │ +
    103 struct Sqrt<K, true>
    │ │ │ │ +
    104 {
    │ │ │ │ +
    105 static inline typename FieldTraits<K>::real_type sqrt (const K& k)
    │ │ │ │ +
    106 {
    │ │ │ │ +
    107 using std::sqrt;
    │ │ │ │ +
    108 return typename FieldTraits<K>::real_type(sqrt(double(k)));
    │ │ │ │ +
    109 }
    │ │ │ │ +
    110 };
    │ │ │ │
    111
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    113 if(req_ != MPI_REQUEST_NULL){
    │ │ │ │ -
    114 try{ // might fail when it is a collective communication
    │ │ │ │ -
    115 MPI_Cancel(&req_);
    │ │ │ │ -
    116 MPI_Request_free(&req_);
    │ │ │ │ -
    117 }catch(...){
    │ │ │ │ -
    118 }
    │ │ │ │ -
    119 }
    │ │ │ │ +
    116 template<class K>
    │ │ │ │ +
    117 inline typename FieldTraits<K>::real_type sqrt (const K& k)
    │ │ │ │ +
    118 {
    │ │ │ │ +
    119 return Sqrt<K>::sqrt(k);
    │ │ │ │
    120 }
    │ │ │ │ -
    │ │ │ │
    121
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    123 : req_(MPI_REQUEST_NULL)
    │ │ │ │ -
    124 , data_(std::move(f.data_))
    │ │ │ │ -
    125 , send_data_(std::move(f.send_data_))
    │ │ │ │ -
    126 {
    │ │ │ │ -
    127 std::swap(req_, f.req_);
    │ │ │ │ -
    128 std::swap(status_, f.status_);
    │ │ │ │ -
    129 }
    │ │ │ │ -
    │ │ │ │ -
    130
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    132 std::swap(req_, f.req_);
    │ │ │ │ -
    133 std::swap(status_, f.status_);
    │ │ │ │ -
    134 std::swap(data_, f.data_);
    │ │ │ │ -
    135 std::swap(send_data_, f.send_data_);
    │ │ │ │ -
    136 return *this;
    │ │ │ │ -
    137 }
    │ │ │ │ +
    122 }
    │ │ │ │
    │ │ │ │ +
    123
    │ │ │ │ +
    128 template<class C, class T, class R =T&>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    130 public Dune::RandomAccessIteratorFacade<DenseIterator<C,T,R>,T, R, std::ptrdiff_t>
    │ │ │ │ +
    131 {
    │ │ │ │ +
    132 friend class DenseIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type >;
    │ │ │ │ +
    133 friend class DenseIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type >;
    │ │ │ │ +
    134
    │ │ │ │ +
    135 typedef DenseIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type > MutableIterator;
    │ │ │ │ +
    136 typedef DenseIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type > ConstIterator;
    │ │ │ │ +
    137 public:
    │ │ │ │
    138
    │ │ │ │ -
    │ │ │ │ -
    139 bool valid() const{
    │ │ │ │ -
    140 return (bool)data_;
    │ │ │ │ -
    141 }
    │ │ │ │ -
    │ │ │ │ -
    142
    │ │ │ │ -
    │ │ │ │ -
    143 void wait(){
    │ │ │ │ -
    144 if(!valid())
    │ │ │ │ -
    145 DUNE_THROW(InvalidFutureException, "The MPIFuture is not valid!");
    │ │ │ │ -
    146 MPI_Wait(&req_, &status_);
    │ │ │ │ -
    147 }
    │ │ │ │ -
    │ │ │ │ +
    142 typedef std::ptrdiff_t DifferenceType;
    │ │ │ │ +
    143
    │ │ │ │ +
    147 typedef typename C::size_type SizeType;
    │ │ │ │
    148
    │ │ │ │ -
    │ │ │ │ -
    149 bool ready() const{
    │ │ │ │ -
    150 int flag = -1;
    │ │ │ │ -
    151 MPI_Test(&req_, &flag, &status_);
    │ │ │ │ -
    152 return flag;
    │ │ │ │ -
    153 }
    │ │ │ │ -
    │ │ │ │ -
    154
    │ │ │ │ -
    │ │ │ │ -
    155 R get() {
    │ │ │ │ -
    156 wait();
    │ │ │ │ -
    157 return data_.get();
    │ │ │ │ -
    158 }
    │ │ │ │ -
    │ │ │ │ -
    159
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    161 wait();
    │ │ │ │ -
    162 return send_data_.get();
    │ │ │ │ -
    163 }
    │ │ │ │ -
    │ │ │ │ -
    164
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    166 return getMPIData(*data_);
    │ │ │ │ -
    167 }
    │ │ │ │ -
    │ │ │ │ -
    168
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    170 return getMPIData(*send_data_);
    │ │ │ │ -
    171 }
    │ │ │ │ -
    │ │ │ │ -
    172 };
    │ │ │ │ -
    │ │ │ │ -
    173
    │ │ │ │ -
    174}
    │ │ │ │ -
    175#endif
    │ │ │ │ -
    176#endif
    │ │ │ │ -
    Implements an utility class that provides collective communication methods for sequential programs.
    │ │ │ │ -
    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
    │ │ │ │ - │ │ │ │ -
    bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition bigunsignedint.hh:549
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ +
    149 // Constructors needed by the base iterators.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    151 : container_(0), position_()
    │ │ │ │ +
    152 {}
    │ │ │ │ +
    │ │ │ │ +
    153
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    155 : container_(&cont), position_(pos)
    │ │ │ │ +
    156 {}
    │ │ │ │ +
    │ │ │ │ +
    157
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    159 : container_(other.container_), position_(other.position_)
    │ │ │ │ +
    160 {}
    │ │ │ │ +
    │ │ │ │ +
    161
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    163 : container_(other.container_), position_(other.position_)
    │ │ │ │ +
    164 {}
    │ │ │ │ +
    │ │ │ │ +
    165
    │ │ │ │ +
    166 // Methods needed by the forward iterator
    │ │ │ │ +
    │ │ │ │ +
    167 bool equals(const MutableIterator &other) const
    │ │ │ │ +
    168 {
    │ │ │ │ +
    169 return position_ == other.position_ && container_ == other.container_;
    │ │ │ │ +
    170 }
    │ │ │ │ +
    │ │ │ │ +
    171
    │ │ │ │ +
    172
    │ │ │ │ +
    │ │ │ │ +
    173 bool equals(const ConstIterator & other) const
    │ │ │ │ +
    174 {
    │ │ │ │ +
    175 return position_ == other.position_ && container_ == other.container_;
    │ │ │ │ +
    176 }
    │ │ │ │ +
    │ │ │ │ +
    177
    │ │ │ │ +
    │ │ │ │ +
    178 R dereference() const {
    │ │ │ │ +
    179 return container_->operator[](position_);
    │ │ │ │ +
    180 }
    │ │ │ │ +
    │ │ │ │ +
    181
    │ │ │ │ +
    │ │ │ │ +
    182 void increment(){
    │ │ │ │ +
    183 ++position_;
    │ │ │ │ +
    184 }
    │ │ │ │ +
    │ │ │ │ +
    185
    │ │ │ │ +
    186 // Additional function needed by BidirectionalIterator
    │ │ │ │ +
    │ │ │ │ +
    187 void decrement(){
    │ │ │ │ +
    188 --position_;
    │ │ │ │ +
    189 }
    │ │ │ │ +
    │ │ │ │ +
    190
    │ │ │ │ +
    191 // Additional function needed by RandomAccessIterator
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    193 return container_->operator[](position_+i);
    │ │ │ │ +
    194 }
    │ │ │ │ +
    │ │ │ │ +
    195
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    197 position_=position_+n;
    │ │ │ │ +
    198 }
    │ │ │ │ +
    │ │ │ │ +
    199
    │ │ │ │ +
    │ │ │ │ +
    200 DifferenceType distanceTo(DenseIterator<const typename std::remove_const<C>::type,const typename std::remove_const<T>::type> other) const
    │ │ │ │ +
    201 {
    │ │ │ │ +
    202 assert(other.container_==container_);
    │ │ │ │ +
    203 return static_cast< DifferenceType >( other.position_ ) - static_cast< DifferenceType >( position_ );
    │ │ │ │ +
    204 }
    │ │ │ │ +
    │ │ │ │ +
    205
    │ │ │ │ +
    │ │ │ │ +
    206 DifferenceType distanceTo(DenseIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type> other) const
    │ │ │ │ +
    207 {
    │ │ │ │ +
    208 assert(other.container_==container_);
    │ │ │ │ +
    209 return static_cast< DifferenceType >( other.position_ ) - static_cast< DifferenceType >( position_ );
    │ │ │ │ +
    210 }
    │ │ │ │ +
    │ │ │ │ +
    211
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    214 {
    │ │ │ │ +
    215 return this->position_;
    │ │ │ │ +
    216 }
    │ │ │ │ +
    │ │ │ │ +
    217
    │ │ │ │ +
    218 private:
    │ │ │ │ +
    219 C *container_;
    │ │ │ │ +
    220 SizeType position_;
    │ │ │ │ +
    221 };
    │ │ │ │ +
    │ │ │ │ +
    222
    │ │ │ │ +
    227 template<typename V>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    229 {
    │ │ │ │ + │ │ │ │ +
    231 // typedef typename Traits::value_type K;
    │ │ │ │ +
    232
    │ │ │ │ +
    233 // Curiously recurring template pattern
    │ │ │ │ +
    234 V & asImp() { return static_cast<V&>(*this); }
    │ │ │ │ +
    235 const V & asImp() const { return static_cast<const V&>(*this); }
    │ │ │ │ +
    236
    │ │ │ │ +
    237 protected:
    │ │ │ │ +
    238 // construction allowed to derived classes only
    │ │ │ │ +
    239 constexpr DenseVector() = default;
    │ │ │ │ +
    240 // copying only allowed by derived classes
    │ │ │ │ +
    241 DenseVector(const DenseVector&) = default;
    │ │ │ │ +
    242
    │ │ │ │ +
    243 public:
    │ │ │ │ +
    244 //===== type definitions and constants
    │ │ │ │ +
    245
    │ │ │ │ +
    247 typedef typename Traits::derived_type derived_type;
    │ │ │ │ +
    248
    │ │ │ │ +
    250 typedef typename Traits::value_type value_type;
    │ │ │ │ +
    251
    │ │ │ │ + │ │ │ │ +
    254
    │ │ │ │ +
    256 typedef typename Traits::value_type block_type;
    │ │ │ │ +
    257
    │ │ │ │ +
    259 typedef typename Traits::size_type size_type;
    │ │ │ │ +
    260
    │ │ │ │ +
    262 constexpr static int blocklevel = 1;
    │ │ │ │ +
    263
    │ │ │ │ +
    264 //===== assignment from scalar
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    267 {
    │ │ │ │ +
    268 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    269 asImp()[i] = k;
    │ │ │ │ +
    270 return asImp();
    │ │ │ │ +
    271 }
    │ │ │ │ +
    │ │ │ │ +
    272
    │ │ │ │ +
    273 //===== assignment from other DenseVectors
    │ │ │ │ +
    274 protected:
    │ │ │ │ + │ │ │ │ +
    277
    │ │ │ │ +
    278 public:
    │ │ │ │ +
    279
    │ │ │ │ +
    281 template <typename W,
    │ │ │ │ +
    282 std::enable_if_t<
    │ │ │ │ +
    283 std::is_assignable<value_type&, typename DenseVector<W>::value_type>::value, int> = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    285 {
    │ │ │ │ +
    286 assert(other.size() == size());
    │ │ │ │ +
    287 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    288 asImp()[i] = other[i];
    │ │ │ │ +
    289 return asImp();
    │ │ │ │ +
    290 }
    │ │ │ │ +
    │ │ │ │ +
    291
    │ │ │ │ +
    292 //===== access to components
    │ │ │ │ +
    293
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    296 {
    │ │ │ │ +
    297 return asImp()[i];
    │ │ │ │ +
    298 }
    │ │ │ │ +
    │ │ │ │ +
    299
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    301 {
    │ │ │ │ +
    302 return asImp()[i];
    │ │ │ │ +
    303 }
    │ │ │ │ +
    │ │ │ │ +
    304
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    307 {
    │ │ │ │ +
    308 return asImp()[0];
    │ │ │ │ +
    309 }
    │ │ │ │ +
    │ │ │ │ +
    310
    │ │ │ │ +
    │ │ │ │ +
    312 const value_type& front() const
    │ │ │ │ +
    313 {
    │ │ │ │ +
    314 return asImp()[0];
    │ │ │ │ +
    315 }
    │ │ │ │ +
    │ │ │ │ +
    316
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    319 {
    │ │ │ │ +
    320 return asImp()[size()-1];
    │ │ │ │ +
    321 }
    │ │ │ │ +
    │ │ │ │ +
    322
    │ │ │ │ +
    │ │ │ │ +
    324 const value_type& back() const
    │ │ │ │ +
    325 {
    │ │ │ │ +
    326 return asImp()[size()-1];
    │ │ │ │ +
    327 }
    │ │ │ │ +
    │ │ │ │ +
    328
    │ │ │ │ +
    │ │ │ │ +
    330 bool empty() const
    │ │ │ │ +
    331 {
    │ │ │ │ +
    332 return size() == 0;
    │ │ │ │ +
    333 }
    │ │ │ │ +
    │ │ │ │ +
    334
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    337 {
    │ │ │ │ +
    338 return asImp().size();
    │ │ │ │ +
    339 }
    │ │ │ │ +
    │ │ │ │ +
    340
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    345
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    348 {
    │ │ │ │ +
    349 return Iterator(*this,0);
    │ │ │ │ +
    350 }
    │ │ │ │ +
    │ │ │ │ +
    351
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    354 {
    │ │ │ │ +
    355 return Iterator(*this,size());
    │ │ │ │ +
    356 }
    │ │ │ │ +
    │ │ │ │ +
    357
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    361 {
    │ │ │ │ +
    362 return Iterator(*this,size()-1);
    │ │ │ │ +
    363 }
    │ │ │ │ +
    │ │ │ │ +
    364
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    368 {
    │ │ │ │ +
    369 return Iterator(*this,-1);
    │ │ │ │ +
    370 }
    │ │ │ │ +
    │ │ │ │ +
    371
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    374 {
    │ │ │ │ +
    375 return Iterator(*this,std::min(i,size()));
    │ │ │ │ +
    376 }
    │ │ │ │ +
    │ │ │ │ +
    377
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    382
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    385 {
    │ │ │ │ +
    386 return ConstIterator(*this,0);
    │ │ │ │ +
    387 }
    │ │ │ │ +
    │ │ │ │ +
    388
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    391 {
    │ │ │ │ +
    392 return ConstIterator(*this,size());
    │ │ │ │ +
    393 }
    │ │ │ │ +
    │ │ │ │ +
    394
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    398 {
    │ │ │ │ +
    399 return ConstIterator(*this,size()-1);
    │ │ │ │ +
    400 }
    │ │ │ │ +
    │ │ │ │ +
    401
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    405 {
    │ │ │ │ +
    406 return ConstIterator(*this,-1);
    │ │ │ │ +
    407 }
    │ │ │ │ +
    │ │ │ │ +
    408
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    411 {
    │ │ │ │ +
    412 return ConstIterator(*this,std::min(i,size()));
    │ │ │ │ +
    413 }
    │ │ │ │ +
    │ │ │ │ +
    414
    │ │ │ │ +
    415 //===== vector space arithmetic
    │ │ │ │ +
    416
    │ │ │ │ +
    418 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    420 {
    │ │ │ │ +
    421 DUNE_ASSERT_BOUNDS(x.size() == size());
    │ │ │ │ +
    422 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    423 (*this)[i] += x[i];
    │ │ │ │ +
    424 return asImp();
    │ │ │ │ +
    425 }
    │ │ │ │ +
    │ │ │ │ +
    426
    │ │ │ │ +
    428 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    430 {
    │ │ │ │ +
    431 DUNE_ASSERT_BOUNDS(x.size() == size());
    │ │ │ │ +
    432 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    433 (*this)[i] -= x[i];
    │ │ │ │ +
    434 return asImp();
    │ │ │ │ +
    435 }
    │ │ │ │ +
    │ │ │ │ +
    436
    │ │ │ │ +
    438 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    440 {
    │ │ │ │ +
    441 derived_type z = asImp();
    │ │ │ │ +
    442 return (z+=b);
    │ │ │ │ +
    443 }
    │ │ │ │ +
    │ │ │ │ +
    444
    │ │ │ │ +
    446 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    448 {
    │ │ │ │ +
    449 derived_type z = asImp();
    │ │ │ │ +
    450 return (z-=b);
    │ │ │ │ +
    451 }
    │ │ │ │ +
    │ │ │ │ +
    452
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    455 {
    │ │ │ │ +
    456 V result;
    │ │ │ │ +
    457 using idx_type = typename decltype(result)::size_type;
    │ │ │ │ +
    458
    │ │ │ │ +
    459 for (idx_type i = 0; i < size(); ++i)
    │ │ │ │ +
    460 result[i] = -asImp()[i];
    │ │ │ │ +
    461
    │ │ │ │ +
    462 return result;
    │ │ │ │ +
    463 }
    │ │ │ │ +
    │ │ │ │ +
    464
    │ │ │ │ +
    466
    │ │ │ │ +
    474 template <typename ValueType>
    │ │ │ │ +
    475 typename std::enable_if<
    │ │ │ │ +
    476 std::is_convertible<ValueType, value_type>::value,
    │ │ │ │ + │ │ │ │ +
    478 >::type&
    │ │ │ │ +
    │ │ │ │ +
    479 operator+= (const ValueType& kk)
    │ │ │ │ +
    480 {
    │ │ │ │ +
    481 const value_type& k = kk;
    │ │ │ │ +
    482 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    483 (*this)[i] += k;
    │ │ │ │ +
    484 return asImp();
    │ │ │ │ +
    485 }
    │ │ │ │ +
    │ │ │ │ +
    486
    │ │ │ │ +
    488
    │ │ │ │ +
    496 template <typename ValueType>
    │ │ │ │ +
    497 typename std::enable_if<
    │ │ │ │ +
    498 std::is_convertible<ValueType, value_type>::value,
    │ │ │ │ + │ │ │ │ +
    500 >::type&
    │ │ │ │ +
    │ │ │ │ +
    501 operator-= (const ValueType& kk)
    │ │ │ │ +
    502 {
    │ │ │ │ +
    503 const value_type& k = kk;
    │ │ │ │ +
    504 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    505 (*this)[i] -= k;
    │ │ │ │ +
    506 return asImp();
    │ │ │ │ +
    507 }
    │ │ │ │ +
    │ │ │ │ +
    508
    │ │ │ │ +
    510
    │ │ │ │ +
    518 template <typename FieldType>
    │ │ │ │ +
    519 typename std::enable_if<
    │ │ │ │ +
    520 std::is_convertible<FieldType, field_type>::value,
    │ │ │ │ + │ │ │ │ +
    522 >::type&
    │ │ │ │ +
    │ │ │ │ +
    523 operator*= (const FieldType& kk)
    │ │ │ │ +
    524 {
    │ │ │ │ +
    525 const field_type& k = kk;
    │ │ │ │ +
    526 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    527 (*this)[i] *= k;
    │ │ │ │ +
    528 return asImp();
    │ │ │ │ +
    529 }
    │ │ │ │ +
    │ │ │ │ +
    530
    │ │ │ │ +
    532
    │ │ │ │ +
    540 template <typename FieldType>
    │ │ │ │ +
    541 typename std::enable_if<
    │ │ │ │ +
    542 std::is_convertible<FieldType, field_type>::value,
    │ │ │ │ + │ │ │ │ +
    544 >::type&
    │ │ │ │ +
    │ │ │ │ +
    545 operator/= (const FieldType& kk)
    │ │ │ │ +
    546 {
    │ │ │ │ +
    547 const field_type& k = kk;
    │ │ │ │ +
    548 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    549 (*this)[i] /= k;
    │ │ │ │ +
    550 return asImp();
    │ │ │ │ +
    551 }
    │ │ │ │ +
    │ │ │ │ +
    552
    │ │ │ │ +
    554 template <class Other>
    │ │ │ │ +
    │ │ │ │ +
    555 bool operator== (const DenseVector<Other>& x) const
    │ │ │ │ +
    556 {
    │ │ │ │ +
    557 DUNE_ASSERT_BOUNDS(x.size() == size());
    │ │ │ │ +
    558 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    559 if ((*this)[i]!=x[i])
    │ │ │ │ +
    560 return false;
    │ │ │ │ +
    561
    │ │ │ │ +
    562 return true;
    │ │ │ │ +
    563 }
    │ │ │ │ +
    │ │ │ │ +
    564
    │ │ │ │ +
    566 template <class Other>
    │ │ │ │ +
    │ │ │ │ +
    567 bool operator!= (const DenseVector<Other>& x) const
    │ │ │ │ +
    568 {
    │ │ │ │ +
    569 return !operator==(x);
    │ │ │ │ +
    570 }
    │ │ │ │ +
    │ │ │ │ +
    571
    │ │ │ │ +
    572
    │ │ │ │ +
    574 template <class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    576 {
    │ │ │ │ +
    577 DUNE_ASSERT_BOUNDS(x.size() == size());
    │ │ │ │ +
    578 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    579 (*this)[i] += a*x[i];
    │ │ │ │ +
    580 return asImp();
    │ │ │ │ +
    581 }
    │ │ │ │ +
    │ │ │ │ +
    582
    │ │ │ │ +
    590 template<class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    592 typedef typename PromotionTraits<field_type, typename DenseVector<Other>::field_type>::PromotedType PromotedType;
    │ │ │ │ +
    593 PromotedType result(0);
    │ │ │ │ +
    594 assert(x.size() == size());
    │ │ │ │ +
    595 for (size_type i=0; i<size(); i++) {
    │ │ │ │ +
    596 result += PromotedType((*this)[i]*x[i]);
    │ │ │ │ +
    597 }
    │ │ │ │ +
    598 return result;
    │ │ │ │ +
    599 }
    │ │ │ │ +
    │ │ │ │ +
    600
    │ │ │ │ +
    608 template<class Other>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    610 typedef typename PromotionTraits<field_type, typename DenseVector<Other>::field_type>::PromotedType PromotedType;
    │ │ │ │ +
    611 PromotedType result(0);
    │ │ │ │ +
    612 assert(x.size() == size());
    │ │ │ │ +
    613 for (size_type i=0; i<size(); i++) {
    │ │ │ │ +
    614 result += Dune::dot((*this)[i],x[i]);
    │ │ │ │ +
    615 }
    │ │ │ │ +
    616 return result;
    │ │ │ │ +
    617 }
    │ │ │ │ +
    │ │ │ │ +
    618
    │ │ │ │ +
    619 //===== norms
    │ │ │ │ +
    620
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    623 using std::abs;
    │ │ │ │ +
    624 typename FieldTraits<value_type>::real_type result( 0 );
    │ │ │ │ +
    625 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    626 result += abs((*this)[i]);
    │ │ │ │ +
    627 return result;
    │ │ │ │ +
    628 }
    │ │ │ │ +
    │ │ │ │ +
    629
    │ │ │ │ +
    630
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    633 {
    │ │ │ │ +
    634 typename FieldTraits<value_type>::real_type result( 0 );
    │ │ │ │ +
    635 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    636 result += fvmeta::absreal((*this)[i]);
    │ │ │ │ +
    637 return result;
    │ │ │ │ +
    638 }
    │ │ │ │ +
    │ │ │ │ +
    639
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    642 {
    │ │ │ │ +
    643 typename FieldTraits<value_type>::real_type result( 0 );
    │ │ │ │ +
    644 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    645 result += fvmeta::abs2((*this)[i]);
    │ │ │ │ +
    646 return fvmeta::sqrt(result);
    │ │ │ │ +
    647 }
    │ │ │ │ +
    │ │ │ │ +
    648
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    651 {
    │ │ │ │ +
    652 typename FieldTraits<value_type>::real_type result( 0 );
    │ │ │ │ +
    653 for (size_type i=0; i<size(); i++)
    │ │ │ │ +
    654 result += fvmeta::abs2((*this)[i]);
    │ │ │ │ +
    655 return result;
    │ │ │ │ +
    656 }
    │ │ │ │ +
    │ │ │ │ +
    657
    │ │ │ │ +
    659 template <typename vt = value_type,
    │ │ │ │ +
    660 typename std::enable_if<!HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    662 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    663 using std::abs;
    │ │ │ │ +
    664 using std::max;
    │ │ │ │ +
    665
    │ │ │ │ +
    666 real_type norm = 0;
    │ │ │ │ +
    667 for (auto const &x : *this) {
    │ │ │ │ +
    668 real_type const a = abs(x);
    │ │ │ │ +
    669 norm = max(a, norm);
    │ │ │ │ +
    670 }
    │ │ │ │ +
    671 return norm;
    │ │ │ │ +
    672 }
    │ │ │ │ +
    │ │ │ │ +
    673
    │ │ │ │ +
    675 template <typename vt = value_type,
    │ │ │ │ +
    676 typename std::enable_if<!HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    678 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    679 using std::max;
    │ │ │ │ +
    680
    │ │ │ │ +
    681 real_type norm = 0;
    │ │ │ │ +
    682 for (auto const &x : *this) {
    │ │ │ │ +
    683 real_type const a = fvmeta::absreal(x);
    │ │ │ │ +
    684 norm = max(a, norm);
    │ │ │ │ +
    685 }
    │ │ │ │ +
    686 return norm;
    │ │ │ │ +
    687 }
    │ │ │ │ +
    │ │ │ │ +
    688
    │ │ │ │ +
    690 template <typename vt = value_type,
    │ │ │ │ +
    691 typename std::enable_if<HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    693 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    694 using std::abs;
    │ │ │ │ +
    695 using std::max;
    │ │ │ │ +
    696
    │ │ │ │ +
    697 real_type norm = 0;
    │ │ │ │ +
    698 real_type isNaN = 1;
    │ │ │ │ +
    699 for (auto const &x : *this) {
    │ │ │ │ +
    700 real_type const a = abs(x);
    │ │ │ │ +
    701 norm = max(a, norm);
    │ │ │ │ +
    702 isNaN += a;
    │ │ │ │ +
    703 }
    │ │ │ │ +
    704 return norm * (isNaN / isNaN);
    │ │ │ │ +
    705 }
    │ │ │ │ +
    │ │ │ │ +
    706
    │ │ │ │ +
    708 template <typename vt = value_type,
    │ │ │ │ +
    709 typename std::enable_if<HasNaN<vt>::value, int>::type = 0>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    711 using real_type = typename FieldTraits<vt>::real_type;
    │ │ │ │ +
    712 using std::max;
    │ │ │ │ +
    713
    │ │ │ │ +
    714 real_type norm = 0;
    │ │ │ │ +
    715 real_type isNaN = 1;
    │ │ │ │ +
    716 for (auto const &x : *this) {
    │ │ │ │ +
    717 real_type const a = fvmeta::absreal(x);
    │ │ │ │ +
    718 norm = max(a, norm);
    │ │ │ │ +
    719 isNaN += a;
    │ │ │ │ +
    720 }
    │ │ │ │ +
    721 return norm * (isNaN / isNaN);
    │ │ │ │ +
    722 }
    │ │ │ │ +
    │ │ │ │ +
    723
    │ │ │ │ +
    724 //===== sizes
    │ │ │ │ +
    725
    │ │ │ │ +
    │ │ │ │ +
    727 size_type N () const
    │ │ │ │ +
    728 {
    │ │ │ │ +
    729 return size();
    │ │ │ │ +
    730 }
    │ │ │ │ +
    │ │ │ │ +
    731
    │ │ │ │ +
    │ │ │ │ +
    733 size_type dim () const
    │ │ │ │ +
    734 {
    │ │ │ │ +
    735 return size();
    │ │ │ │ +
    736 }
    │ │ │ │ +
    │ │ │ │ +
    737
    │ │ │ │ +
    738 };
    │ │ │ │ +
    │ │ │ │ +
    739
    │ │ │ │ +
    748 template<typename V>
    │ │ │ │ +
    │ │ │ │ +
    749 std::ostream& operator<< (std::ostream& s, const DenseVector<V>& v)
    │ │ │ │ +
    750 {
    │ │ │ │ +
    751 for (typename DenseVector<V>::size_type i=0; i<v.size(); i++)
    │ │ │ │ +
    752 s << ((i>0) ? " " : "") << v[i];
    │ │ │ │ +
    753 return s;
    │ │ │ │ +
    754 }
    │ │ │ │ +
    │ │ │ │ +
    755
    │ │ │ │ +
    758} // end namespace
    │ │ │ │ +
    759
    │ │ │ │ +
    760#endif // DUNE_DENSEVECTOR_HH
    │ │ │ │ +
    Type traits to determine the type of reals (when working with complex numbers)
    │ │ │ │ +
    Macro for wrapping boundary checks.
    │ │ │ │ +
    Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
    │ │ │ │ +
    Compute type of the result of an arithmetic operation involving two different number types.
    │ │ │ │ +
    Provides the functions dot(a,b) := and dotT(a,b) := .
    │ │ │ │ +
    Implements a generic iterator class for writing stl conformant iterators.
    │ │ │ │ +
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition boundschecking.hh:30
    │ │ │ │ +
    auto dot(const A &a, const B &b) -> typename std::enable_if< IsNumber< A >::value &&!IsVector< A >::value &&!std::is_same< typename FieldTraits< A >::field_type, typename FieldTraits< A >::real_type > ::value, decltype(conj(a) *b)>::type
    computes the dot product for fundamental data types according to Petsc's VectDot function: dot(a,...
    Definition dotproduct.hh:42
    │ │ │ │ +
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    auto getMPIData(T &t)
    Definition mpidata.hh:43
    │ │ │ │ -
    Collective communication interface and sequential default implementation.
    Definition communication.hh:100
    │ │ │ │ -
    This exception is thrown when ready(), wait() or get() is called on an invalid future....
    Definition future.hh:18
    │ │ │ │ -
    Definition mpifuture.hh:19
    │ │ │ │ -
    std::unique_ptr< T > value
    Definition mpifuture.hh:28
    │ │ │ │ -
    T & operator*() const
    Definition mpifuture.hh:37
    │ │ │ │ -
    Buffer(V &&t)
    Definition mpifuture.hh:25
    │ │ │ │ -
    T get()
    Definition mpifuture.hh:29
    │ │ │ │ -
    Buffer(bool valid)
    Definition mpifuture.hh:20
    │ │ │ │ -
    std::optional< std::reference_wrapper< T > > value
    Definition mpifuture.hh:53
    │ │ │ │ -
    Buffer(bool valid=false)
    Definition mpifuture.hh:44
    │ │ │ │ -
    T & get()
    Definition mpifuture.hh:54
    │ │ │ │ -
    Buffer(V &&t)
    Definition mpifuture.hh:50
    │ │ │ │ -
    bool valid_
    Definition mpifuture.hh:69
    │ │ │ │ -
    void get()
    Definition mpifuture.hh:76
    │ │ │ │ -
    Buffer(bool valid=false)
    Definition mpifuture.hh:70
    │ │ │ │ -
    Provides a future-like object for MPI communication. It contains the object that will be received and...
    Definition mpifuture.hh:85
    │ │ │ │ -
    MPIFuture(V &&recv_data, typename std::enable_if_t<!std::is_void< V >::value > *=0)
    Definition mpifuture.hh:107
    │ │ │ │ -
    bool ready() const
    Definition mpifuture.hh:149
    │ │ │ │ -
    bool valid() const
    Definition mpifuture.hh:139
    │ │ │ │ -
    ~MPIFuture()
    Definition mpifuture.hh:112
    │ │ │ │ -
    MPIFuture(bool valid=false)
    Definition mpifuture.hh:92
    │ │ │ │ -
    MPIFuture & operator=(MPIFuture &&f)
    Definition mpifuture.hh:131
    │ │ │ │ -
    auto get_send_mpidata()
    Definition mpifuture.hh:169
    │ │ │ │ -
    void wait()
    Definition mpifuture.hh:143
    │ │ │ │ -
    auto get_mpidata()
    Definition mpifuture.hh:165
    │ │ │ │ -
    R get()
    Definition mpifuture.hh:155
    │ │ │ │ -
    MPIFuture(V &&recv_data, U &&send_data, typename std::enable_if_t<!std::is_void< V >::value &&!std::is_void< U >::value > *=0)
    Definition mpifuture.hh:99
    │ │ │ │ -
    S get_send_data()
    Definition mpifuture.hh:160
    │ │ │ │ -
    MPIFuture(MPIFuture &&f)
    Definition mpifuture.hh:122
    │ │ │ │ +
    Interface for a class of dense vectors over a given field.
    Definition densevector.hh:229
    │ │ │ │ +
    Traits::value_type value_type
    export the type representing the field
    Definition densevector.hh:250
    │ │ │ │ +
    FieldTraits< value_type >::real_type two_norm2() const
    square of two norm (sum over squared values of entries), need for block recursion
    Definition densevector.hh:650
    │ │ │ │ +
    ConstIterator const_iterator
    typedef for stl compliant access
    Definition densevector.hh:381
    │ │ │ │ +
    Iterator iterator
    typedef for stl compliant access
    Definition densevector.hh:344
    │ │ │ │ +
    ConstIterator find(size_type i) const
    return iterator to given element or end()
    Definition densevector.hh:410
    │ │ │ │ +
    ConstIterator end() const
    end ConstIterator
    Definition densevector.hh:390
    │ │ │ │ +
    value_type & front()
    return reference to first element
    Definition densevector.hh:306
    │ │ │ │ +
    FieldTraits< value_type >::real_type two_norm() const
    two norm sqrt(sum over squared values of entries)
    Definition densevector.hh:641
    │ │ │ │ +
    ConstIterator beforeBegin() const
    Definition densevector.hh:404
    │ │ │ │ +
    bool operator==(const DenseVector< Other > &x) const
    Binary vector comparison.
    Definition densevector.hh:555
    │ │ │ │ +
    Iterator begin()
    begin iterator
    Definition densevector.hh:347
    │ │ │ │ +
    Iterator beforeBegin()
    Definition densevector.hh:367
    │ │ │ │ +
    DenseIterator< const DenseVector, const value_type > ConstIterator
    ConstIterator class for sequential access.
    Definition densevector.hh:379
    │ │ │ │ +
    Traits::derived_type derived_type
    type of derived vector class
    Definition densevector.hh:247
    │ │ │ │ +
    const value_type & front() const
    return reference to first element
    Definition densevector.hh:312
    │ │ │ │ +
    derived_type operator+(const DenseVector< Other > &b) const
    Binary vector addition.
    Definition densevector.hh:439
    │ │ │ │ +
    size_type size() const
    size method
    Definition densevector.hh:336
    │ │ │ │ +
    size_type dim() const
    dimension of the vector space
    Definition densevector.hh:733
    │ │ │ │ +
    FieldTraits< vt >::real_type infinity_norm() const
    infinity norm (maximum of absolute values of entries)
    Definition densevector.hh:661
    │ │ │ │ +
    ConstIterator beforeEnd() const
    Definition densevector.hh:397
    │ │ │ │ +
    derived_type & axpy(const field_type &a, const DenseVector< Other > &x)
    vector space axpy operation ( *this += a x )
    Definition densevector.hh:575
    │ │ │ │ +
    derived_type & operator=(const value_type &k)
    Assignment operator for scalar.
    Definition densevector.hh:266
    │ │ │ │ +
    static constexpr int blocklevel
    The number of block levels we contain. This is the leaf, that is, 1.
    Definition densevector.hh:262
    │ │ │ │ +
    Iterator end()
    end iterator
    Definition densevector.hh:353
    │ │ │ │ +
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition densevector.hh:259
    │ │ │ │ +
    DenseIterator< DenseVector, value_type > Iterator
    Iterator class for sequential access.
    Definition densevector.hh:342
    │ │ │ │ +
    derived_type & operator-=(const DenseVector< Other > &x)
    vector space subtraction
    Definition densevector.hh:429
    │ │ │ │ +
    DenseVector(const DenseVector &)=default
    │ │ │ │ +
    Iterator beforeEnd()
    Definition densevector.hh:360
    │ │ │ │ +
    derived_type & operator+=(const DenseVector< Other > &x)
    vector space addition
    Definition densevector.hh:419
    │ │ │ │ +
    std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator*=(const FieldType &kk)
    vector space multiplication with scalar
    Definition densevector.hh:523
    │ │ │ │ +
    bool operator!=(const DenseVector< Other > &x) const
    Binary vector incomparison.
    Definition densevector.hh:567
    │ │ │ │ +
    const value_type & back() const
    return reference to last element
    Definition densevector.hh:324
    │ │ │ │ +
    ConstIterator begin() const
    begin ConstIterator
    Definition densevector.hh:384
    │ │ │ │ +
    PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType operator*(const DenseVector< Other > &x) const
    indefinite vector dot product which corresponds to Petsc's VecTDot
    Definition densevector.hh:591
    │ │ │ │ +
    constexpr DenseVector()=default
    │ │ │ │ +
    FieldTraits< vt >::real_type infinity_norm_real() const
    simplified infinity norm (uses Manhattan norm for complex values)
    Definition densevector.hh:677
    │ │ │ │ +
    DenseVector & operator=(const DenseVector &)=default
    Assignment operator for other DenseVector of same type.
    │ │ │ │ +
    Traits::value_type block_type
    export the type representing the components
    Definition densevector.hh:256
    │ │ │ │ +
    value_type & operator[](size_type i)
    random access
    Definition densevector.hh:295
    │ │ │ │ +
    FieldTraits< value_type >::field_type field_type
    export the type representing the field
    Definition densevector.hh:253
    │ │ │ │ +
    value_type & back()
    return reference to last element
    Definition densevector.hh:318
    │ │ │ │ +
    derived_type operator-() const
    Vector negation.
    Definition densevector.hh:454
    │ │ │ │ +
    std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator/=(const FieldType &kk)
    vector space division by scalar
    Definition densevector.hh:545
    │ │ │ │ +
    FieldTraits< value_type >::real_type one_norm_real() const
    simplified one norm (uses Manhattan norm for complex values)
    Definition densevector.hh:632
    │ │ │ │ +
    PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType dot(const DenseVector< Other > &x) const
    vector dot product which corresponds to Petsc's VecDot
    Definition densevector.hh:609
    │ │ │ │ +
    Iterator find(size_type i)
    return iterator to given element or end()
    Definition densevector.hh:373
    │ │ │ │ +
    FieldTraits< value_type >::real_type one_norm() const
    one norm (sum over absolute values of entries)
    Definition densevector.hh:622
    │ │ │ │ +
    size_type N() const
    number of blocks in the vector (are of size 1 here)
    Definition densevector.hh:727
    │ │ │ │ +
    bool empty() const
    checks whether the container is empty
    Definition densevector.hh:330
    │ │ │ │ +
    FieldTraits< typenameDenseMatVecTraits< V >::value_type >::real_type real_type
    Definition densevector.hh:28
    │ │ │ │ +
    FieldTraits< typenameDenseMatVecTraits< V >::value_type >::field_type field_type
    Definition densevector.hh:27
    │ │ │ │ +
    Generic iterator class for dense vector and matrix implementations.
    Definition densevector.hh:131
    │ │ │ │ +
    void increment()
    Definition densevector.hh:182
    │ │ │ │ +
    SizeType index() const
    return index
    Definition densevector.hh:213
    │ │ │ │ +
    bool equals(const MutableIterator &other) const
    Definition densevector.hh:167
    │ │ │ │ +
    DenseIterator(const MutableIterator &other)
    Definition densevector.hh:158
    │ │ │ │ +
    bool equals(const ConstIterator &other) const
    Definition densevector.hh:173
    │ │ │ │ +
    R elementAt(DifferenceType i) const
    Definition densevector.hh:192
    │ │ │ │ +
    DifferenceType distanceTo(DenseIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T >::type > other) const
    Definition densevector.hh:200
    │ │ │ │ +
    void decrement()
    Definition densevector.hh:187
    │ │ │ │ +
    DenseIterator(const ConstIterator &other)
    Definition densevector.hh:162
    │ │ │ │ +
    DifferenceType distanceTo(DenseIterator< typename std::remove_const< C >::type, typename std::remove_const< T >::type > other) const
    Definition densevector.hh:206
    │ │ │ │ +
    DenseIterator(C &cont, SizeType pos)
    Definition densevector.hh:154
    │ │ │ │ +
    std::ptrdiff_t DifferenceType
    The type of the difference between two positions.
    Definition densevector.hh:142
    │ │ │ │ +
    R dereference() const
    Definition densevector.hh:178
    │ │ │ │ +
    void advance(DifferenceType n)
    Definition densevector.hh:196
    │ │ │ │ +
    C::size_type SizeType
    The type to index the underlying container.
    Definition densevector.hh:147
    │ │ │ │ +
    Definition ftraits.hh:26
    │ │ │ │ +
    T field_type
    export the type representing the field
    Definition ftraits.hh:28
    │ │ │ │ +
    T real_type
    export the type representing the real type of the field
    Definition ftraits.hh:30
    │ │ │ │ +
    get the 'mutable' version of a reference to a const object
    Definition genericiterator.hh:116
    │ │ │ │ +
    Base class for stl conformant forward iterators.
    Definition iteratorfacades.hh:434
    │ │ │ │ +
    Definition matvectraits.hh:31
    │ │ │ │ +
    Compute type of the result of an arithmetic operation involving two different number types.
    Definition promotiontraits.hh:27
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,297 +1,944 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpifuture.hh │ │ │ │ │ +densevector.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_PARALLEL_MPIFUTURE_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_MPIFUTURE_HH │ │ │ │ │ +5#ifndef DUNE_DENSEVECTOR_HH │ │ │ │ │ +6#define DUNE_DENSEVECTOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -11#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_e_._h_h> │ │ │ │ │ -12#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ -13 │ │ │ │ │ -14#if HAVE_MPI │ │ │ │ │ -15namespace _D_u_n_e{ │ │ │ │ │ -16 │ │ │ │ │ -_1_7 namespace impl{ │ │ │ │ │ -18 template │ │ │ │ │ -_1_9 struct _B_u_f_f_e_r{ │ │ │ │ │ -_2_0 _B_u_f_f_e_r(bool valid){ │ │ │ │ │ -21 if(valid) │ │ │ │ │ -22 _v_a_l_u_e = std::make_unique(); │ │ │ │ │ -23 } │ │ │ │ │ -24 template │ │ │ │ │ -_2_5 _B_u_f_f_e_r(V&& t) │ │ │ │ │ -26 : _v_a_l_u_e(_s_t_d::make_unique(_s_t_d::forward(t))) │ │ │ │ │ -27 {} │ │ │ │ │ -_2_8 std::unique_ptr _v_a_l_u_e; │ │ │ │ │ -_2_9 T _g_e_t(){ │ │ │ │ │ -30 T tmp = std::move(*_v_a_l_u_e); │ │ │ │ │ -31 _v_a_l_u_e.reset(); │ │ │ │ │ -32 return tmp; │ │ │ │ │ -33 } │ │ │ │ │ -_3_4 operator bool () const { │ │ │ │ │ -35 return (bool)_v_a_l_u_e; │ │ │ │ │ -36 } │ │ │ │ │ -_3_7 T& _o_p_e_r_a_t_o_r_ _*() const{ │ │ │ │ │ -38 return *_v_a_l_u_e; │ │ │ │ │ -39 } │ │ │ │ │ -40 }; │ │ │ │ │ -41 │ │ │ │ │ -42 template │ │ │ │ │ -_4_3 struct _B_u_f_f_e_r{ │ │ │ │ │ -_4_4 _B_u_f_f_e_r(bool valid = false) │ │ │ │ │ -45 { │ │ │ │ │ -46 if(valid) │ │ │ │ │ -47 value = T(); │ │ │ │ │ -48 } │ │ │ │ │ -49 template │ │ │ │ │ -_5_0 _B_u_f_f_e_r(V&& t) │ │ │ │ │ -51 : value(_s_t_d::forward(t)) │ │ │ │ │ -52 {} │ │ │ │ │ -_5_3 std::optional> _v_a_l_u_e; │ │ │ │ │ -_5_4 T& _g_e_t(){ │ │ │ │ │ -55 T& tmp = *value; │ │ │ │ │ -56 value.reset(); │ │ │ │ │ -57 return tmp; │ │ │ │ │ -58 } │ │ │ │ │ -_5_9 operator bool () const{ │ │ │ │ │ -60 return (bool)value; │ │ │ │ │ -61 } │ │ │ │ │ -_6_2 T& _o_p_e_r_a_t_o_r_ _*() const{ │ │ │ │ │ -63 return *value; │ │ │ │ │ -64 } │ │ │ │ │ -65 }; │ │ │ │ │ -66 │ │ │ │ │ -67 template<> │ │ │ │ │ -_6_8 struct _B_u_f_f_e_r{ │ │ │ │ │ -_6_9 bool _v_a_l_i_d__; │ │ │ │ │ -_7_0 _B_u_f_f_e_r(bool valid = false) │ │ │ │ │ -71 : valid_(valid) │ │ │ │ │ -72 {} │ │ │ │ │ -_7_3 operator bool () const{ │ │ │ │ │ -74 return valid_; │ │ │ │ │ -75 } │ │ │ │ │ -_7_6 void _g_e_t(){} │ │ │ │ │ -77 }; │ │ │ │ │ -78 } │ │ │ │ │ -79 │ │ │ │ │ -84 template │ │ │ │ │ -_8_5 class _M_P_I_F_u_t_u_r_e{ │ │ │ │ │ -86 mutable MPI_Request req_; │ │ │ │ │ -87 mutable MPI_Status status_; │ │ │ │ │ -88 _i_m_p_l_:_:_B_u_f_f_e_r_<_R_> data_; │ │ │ │ │ -_8_9 _i_m_p_l_:_:_B_u_f_f_e_r_<_S_> send_data_; │ │ │ │ │ -90 friend class _C_o_m_m_u_n_i_c_a_t_i_o_n; │ │ │ │ │ -91 public: │ │ │ │ │ -_9_2 _M_P_I_F_u_t_u_r_e(bool _v_a_l_i_d = false) │ │ │ │ │ -93 : req_(MPI_REQUEST_NULL) │ │ │ │ │ -94 , data_(_v_a_l_i_d) │ │ │ │ │ -95 {} │ │ │ │ │ -96 │ │ │ │ │ -97 // Hide this constructor if R or S is void │ │ │ │ │ -98 template │ │ │ │ │ -_9_9 _M_P_I_F_u_t_u_r_e(V&& recv_data, U&& send_data, typename std::enable_if_t::value && !std::is_void::value>* = 0) : │ │ │ │ │ -100 req_(MPI_REQUEST_NULL) │ │ │ │ │ -101 , data_(_s_t_d::forward(recv_data)) │ │ │ │ │ -102 , send_data_(_s_t_d::forward(send_data)) │ │ │ │ │ -103 {} │ │ │ │ │ -104 │ │ │ │ │ -105 // hide this constructor if R is void │ │ │ │ │ -106 template │ │ │ │ │ -_1_0_7 _M_P_I_F_u_t_u_r_e(V&& recv_data, typename std::enable_if_t:: │ │ │ │ │ -value>* = 0) │ │ │ │ │ -108 : req_(MPI_REQUEST_NULL) │ │ │ │ │ -109 , data_(_s_t_d::forward(recv_data)) │ │ │ │ │ -110 {} │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12#include "_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h" │ │ │ │ │ +13#include "_f_t_r_a_i_t_s_._h_h" │ │ │ │ │ +14#include "_m_a_t_v_e_c_t_r_a_i_t_s_._h_h" │ │ │ │ │ +15#include "_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h" │ │ │ │ │ +16#include "_d_o_t_p_r_o_d_u_c_t_._h_h" │ │ │ │ │ +17#include "_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h" │ │ │ │ │ +18 │ │ │ │ │ +19namespace _D_u_n_e { │ │ │ │ │ +20 │ │ │ │ │ +21 // forward declaration of template │ │ │ │ │ +22 template class DenseVector; │ │ │ │ │ +23 │ │ │ │ │ +24 template │ │ │ │ │ +_2_5 struct _F_i_e_l_d_T_r_a_i_t_s< _D_e_n_s_e_V_e_c_t_o_r > │ │ │ │ │ +26 { │ │ │ │ │ +_2_7 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_ _t_y_p_e_n_a_m_e_ _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_V_>_:_:_v_a_l_u_e___t_y_p_e >_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_8 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_ _t_y_p_e_n_a_m_e_ _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_V_>_:_:_v_a_l_u_e___t_y_p_e >_:_: │ │ │ │ │ +_r_e_a_l___t_y_p_e _r_e_a_l___t_y_p_e; │ │ │ │ │ +29 }; │ │ │ │ │ +30 │ │ │ │ │ +_4_0 namespace fvmeta │ │ │ │ │ +41 { │ │ │ │ │ +46 template │ │ │ │ │ +47 inline typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e absreal (const K& k) │ │ │ │ │ +48 { │ │ │ │ │ +49 using std::abs; │ │ │ │ │ +50 return abs(k); │ │ │ │ │ +51 } │ │ │ │ │ +52 │ │ │ │ │ +57 template │ │ │ │ │ +58 inline typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e absreal (const std::complex& c) │ │ │ │ │ +59 { │ │ │ │ │ +60 using std::abs; │ │ │ │ │ +61 return abs(c.real()) + abs(c.imag()); │ │ │ │ │ +62 } │ │ │ │ │ +63 │ │ │ │ │ +68 template │ │ │ │ │ +69 inline typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e abs2 (const K& k) │ │ │ │ │ +70 { │ │ │ │ │ +71 return k*k; │ │ │ │ │ +72 } │ │ │ │ │ +73 │ │ │ │ │ +78 template │ │ │ │ │ +79 inline typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e abs2 (const std::complex& c) │ │ │ │ │ +80 { │ │ │ │ │ +81 return c.real()*c.real() + c.imag()*c.imag(); │ │ │ │ │ +82 } │ │ │ │ │ +83 │ │ │ │ │ +88 template::is_integer> │ │ │ │ │ +89 struct Sqrt │ │ │ │ │ +90 { │ │ │ │ │ +91 static inline typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e sqrt (const K& k) │ │ │ │ │ +92 { │ │ │ │ │ +93 using std::sqrt; │ │ │ │ │ +94 return sqrt(k); │ │ │ │ │ +95 } │ │ │ │ │ +96 }; │ │ │ │ │ +97 │ │ │ │ │ +102 template │ │ │ │ │ +103 struct Sqrt │ │ │ │ │ +104 { │ │ │ │ │ +_1_0_5 static inline typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e sqrt (const K& k) │ │ │ │ │ +106 { │ │ │ │ │ +107 using std::sqrt; │ │ │ │ │ +108 return typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e(sqrt(double(k))); │ │ │ │ │ +109 } │ │ │ │ │ +110 }; │ │ │ │ │ 111 │ │ │ │ │ -_1_1_2 _~_M_P_I_F_u_t_u_r_e() { │ │ │ │ │ -113 if(req_ != MPI_REQUEST_NULL){ │ │ │ │ │ -114 try{ // might fail when it is a collective communication │ │ │ │ │ -115 MPI_Cancel(&req_); │ │ │ │ │ -116 MPI_Request_free(&req_); │ │ │ │ │ -117 }catch(...){ │ │ │ │ │ -118 } │ │ │ │ │ -119 } │ │ │ │ │ +116 template │ │ │ │ │ +117 inline typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e sqrt (const K& k) │ │ │ │ │ +118 { │ │ │ │ │ +119 return Sqrt::sqrt(k); │ │ │ │ │ 120 } │ │ │ │ │ 121 │ │ │ │ │ -_1_2_2 _M_P_I_F_u_t_u_r_e(_M_P_I_F_u_t_u_r_e&& f) │ │ │ │ │ -123 : req_(MPI_REQUEST_NULL) │ │ │ │ │ -124 , data_(_s_t_d::move(f.data_)) │ │ │ │ │ -125 , send_data_(_s_t_d::move(f.send_data_)) │ │ │ │ │ -126 { │ │ │ │ │ -127 std::swap(req_, f.req_); │ │ │ │ │ -128 std::swap(status_, f.status_); │ │ │ │ │ -129 } │ │ │ │ │ -130 │ │ │ │ │ -_1_3_1 _M_P_I_F_u_t_u_r_e& _o_p_e_r_a_t_o_r_=(_M_P_I_F_u_t_u_r_e&& f){ │ │ │ │ │ -132 std::swap(req_, f.req_); │ │ │ │ │ -133 std::swap(status_, f.status_); │ │ │ │ │ -134 std::swap(data_, f.data_); │ │ │ │ │ -135 std::swap(send_data_, f.send_data_); │ │ │ │ │ -136 return *this; │ │ │ │ │ -137 } │ │ │ │ │ +122 } │ │ │ │ │ +123 │ │ │ │ │ +128 template │ │ │ │ │ +_1_2_9 class _D_e_n_s_e_I_t_e_r_a_t_o_r : │ │ │ │ │ +130 public _D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e,T, R, std:: │ │ │ │ │ +ptrdiff_t> │ │ │ │ │ +131 { │ │ │ │ │ +132 friend class _D_e_n_s_e_I_t_e_r_a_t_o_r::type, typename │ │ │ │ │ +std::remove_const::type, typename _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e::type >; │ │ │ │ │ +133 friend class _D_e_n_s_e_I_t_e_r_a_t_o_r::type, const │ │ │ │ │ +typename std::remove_const::type, typename const_reference::type >; │ │ │ │ │ +134 │ │ │ │ │ +135 typedef _D_e_n_s_e_I_t_e_r_a_t_o_r::type, typename std:: │ │ │ │ │ +remove_const::type, typename mutable_reference::type > _M_u_t_a_b_l_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +136 typedef _D_e_n_s_e_I_t_e_r_a_t_o_r::type, const │ │ │ │ │ +typename std::remove_const::type, typename const_reference::type > │ │ │ │ │ +_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +137 public: │ │ │ │ │ 138 │ │ │ │ │ -_1_3_9 bool _v_a_l_i_d() const{ │ │ │ │ │ -140 return (bool)data_; │ │ │ │ │ -141 } │ │ │ │ │ -142 │ │ │ │ │ -_1_4_3 void _w_a_i_t(){ │ │ │ │ │ -144 if(!_v_a_l_i_d()) │ │ │ │ │ -145 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The MPIFuture is not valid!"); │ │ │ │ │ -146 MPI_Wait(&req_, &status_); │ │ │ │ │ -147 } │ │ │ │ │ +_1_4_2 typedef std::ptrdiff_t _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ +143 │ │ │ │ │ +_1_4_7 typedef typename C::size_type _S_i_z_e_T_y_p_e; │ │ │ │ │ 148 │ │ │ │ │ -_1_4_9 bool _r_e_a_d_y() const{ │ │ │ │ │ -150 int flag = -1; │ │ │ │ │ -151 MPI_Test(&req_, &flag, &status_); │ │ │ │ │ -152 return flag; │ │ │ │ │ -153 } │ │ │ │ │ -154 │ │ │ │ │ -_1_5_5 R _g_e_t() { │ │ │ │ │ -156 _w_a_i_t(); │ │ │ │ │ -157 return data_.get(); │ │ │ │ │ -158 } │ │ │ │ │ -159 │ │ │ │ │ -_1_6_0 S _g_e_t___s_e_n_d___d_a_t_a(){ │ │ │ │ │ -161 _w_a_i_t(); │ │ │ │ │ -162 return send_data_._g_e_t(); │ │ │ │ │ -163 } │ │ │ │ │ -164 │ │ │ │ │ -_1_6_5 auto _g_e_t___m_p_i_d_a_t_a(){ │ │ │ │ │ -166 return _g_e_t_M_P_I_D_a_t_a(*data_); │ │ │ │ │ -167 } │ │ │ │ │ -168 │ │ │ │ │ -_1_6_9 auto _g_e_t___s_e_n_d___m_p_i_d_a_t_a(){ │ │ │ │ │ -170 return _g_e_t_M_P_I_D_a_t_a(*send_data_); │ │ │ │ │ -171 } │ │ │ │ │ -172 }; │ │ │ │ │ -173 │ │ │ │ │ -174} │ │ │ │ │ -175#endif │ │ │ │ │ -176#endif │ │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ -Implements an utility class that provides collective communication methods for │ │ │ │ │ -sequential programs. │ │ │ │ │ -_m_p_i_d_a_t_a_._h_h │ │ │ │ │ -Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ -MPI calls. │ │ │ │ │ -_f_u_t_u_r_e_._h_h │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:549 │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +149 // Constructors needed by the base iterators. │ │ │ │ │ +_1_5_0 _D_e_n_s_e_I_t_e_r_a_t_o_r() │ │ │ │ │ +151 : container_(0), position_() │ │ │ │ │ +152 {} │ │ │ │ │ +153 │ │ │ │ │ +_1_5_4 _D_e_n_s_e_I_t_e_r_a_t_o_r(C& cont, _S_i_z_e_T_y_p_e pos) │ │ │ │ │ +155 : container_(&cont), position_(pos) │ │ │ │ │ +156 {} │ │ │ │ │ +157 │ │ │ │ │ +_1_5_8 _D_e_n_s_e_I_t_e_r_a_t_o_r(const _M_u_t_a_b_l_e_I_t_e_r_a_t_o_r & other) │ │ │ │ │ +159 : container_(other.container_), position_(other.position_) │ │ │ │ │ +160 {} │ │ │ │ │ +161 │ │ │ │ │ +_1_6_2 _D_e_n_s_e_I_t_e_r_a_t_o_r(const _C_o_n_s_t_I_t_e_r_a_t_o_r & other) │ │ │ │ │ +163 : container_(other.container_), position_(other.position_) │ │ │ │ │ +164 {} │ │ │ │ │ +165 │ │ │ │ │ +166 // Methods needed by the forward iterator │ │ │ │ │ +_1_6_7 bool _e_q_u_a_l_s(const _M_u_t_a_b_l_e_I_t_e_r_a_t_o_r &other) const │ │ │ │ │ +168 { │ │ │ │ │ +169 return position_ == other.position_ && container_ == other.container_; │ │ │ │ │ +170 } │ │ │ │ │ +171 │ │ │ │ │ +172 │ │ │ │ │ +_1_7_3 bool _e_q_u_a_l_s(const _C_o_n_s_t_I_t_e_r_a_t_o_r & other) const │ │ │ │ │ +174 { │ │ │ │ │ +175 return position_ == other.position_ && container_ == other.container_; │ │ │ │ │ +176 } │ │ │ │ │ +177 │ │ │ │ │ +_1_7_8 R _d_e_r_e_f_e_r_e_n_c_e() const { │ │ │ │ │ +179 return container_->operator[](position_); │ │ │ │ │ +180 } │ │ │ │ │ +181 │ │ │ │ │ +_1_8_2 void _i_n_c_r_e_m_e_n_t(){ │ │ │ │ │ +183 ++position_; │ │ │ │ │ +184 } │ │ │ │ │ +185 │ │ │ │ │ +186 // Additional function needed by BidirectionalIterator │ │ │ │ │ +_1_8_7 void _d_e_c_r_e_m_e_n_t(){ │ │ │ │ │ +188 --position_; │ │ │ │ │ +189 } │ │ │ │ │ +190 │ │ │ │ │ +191 // Additional function needed by RandomAccessIterator │ │ │ │ │ +_1_9_2 R _e_l_e_m_e_n_t_A_t(_D_i_f_f_e_r_e_n_c_e_T_y_p_e i) const { │ │ │ │ │ +193 return container_->operator[](position_+i); │ │ │ │ │ +194 } │ │ │ │ │ +195 │ │ │ │ │ +_1_9_6 void _a_d_v_a_n_c_e(_D_i_f_f_e_r_e_n_c_e_T_y_p_e n){ │ │ │ │ │ +197 position_=position_+n; │ │ │ │ │ +198 } │ │ │ │ │ +199 │ │ │ │ │ +_2_0_0 _D_i_f_f_e_r_e_n_c_e_T_y_p_e _d_i_s_t_a_n_c_e_T_o(_D_e_n_s_e_I_t_e_r_a_t_o_r::type,const typename std::remove_const::type> other) const │ │ │ │ │ +201 { │ │ │ │ │ +202 assert(other.container_==container_); │ │ │ │ │ +203 return static_cast< _D_i_f_f_e_r_e_n_c_e_T_y_p_e >( other.position_ ) - static_cast< │ │ │ │ │ +_D_i_f_f_e_r_e_n_c_e_T_y_p_e >( position_ ); │ │ │ │ │ +204 } │ │ │ │ │ +205 │ │ │ │ │ +_2_0_6 _D_i_f_f_e_r_e_n_c_e_T_y_p_e _d_i_s_t_a_n_c_e_T_o(_D_e_n_s_e_I_t_e_r_a_t_o_r:: │ │ │ │ │ +type, typename std::remove_const::type> other) const │ │ │ │ │ +207 { │ │ │ │ │ +208 assert(other.container_==container_); │ │ │ │ │ +209 return static_cast< _D_i_f_f_e_r_e_n_c_e_T_y_p_e >( other.position_ ) - static_cast< │ │ │ │ │ +_D_i_f_f_e_r_e_n_c_e_T_y_p_e >( position_ ); │ │ │ │ │ +210 } │ │ │ │ │ +211 │ │ │ │ │ +_2_1_3 _S_i_z_e_T_y_p_e _i_n_d_e_x () const │ │ │ │ │ +214 { │ │ │ │ │ +215 return this->position_; │ │ │ │ │ +216 } │ │ │ │ │ +217 │ │ │ │ │ +218 private: │ │ │ │ │ +219 C *container_; │ │ │ │ │ +220 _S_i_z_e_T_y_p_e position_; │ │ │ │ │ +221 }; │ │ │ │ │ +222 │ │ │ │ │ +227 template │ │ │ │ │ +_2_2_8 class _D_e_n_s_e_V_e_c_t_o_r │ │ │ │ │ +229 { │ │ │ │ │ +230 typedef _D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_V_> _T_r_a_i_t_s; │ │ │ │ │ +231 // typedef typename Traits::value_type K; │ │ │ │ │ +232 │ │ │ │ │ +233 // Curiously recurring template pattern │ │ │ │ │ +234 V & asImp() { return static_cast(*this); } │ │ │ │ │ +235 const V & asImp() const { return static_cast(*this); } │ │ │ │ │ +236 │ │ │ │ │ +237 protected: │ │ │ │ │ +238 // construction allowed to derived classes only │ │ │ │ │ +_2_3_9 constexpr _D_e_n_s_e_V_e_c_t_o_r() = default; │ │ │ │ │ +240 // copying only allowed by derived classes │ │ │ │ │ +_2_4_1 _D_e_n_s_e_V_e_c_t_o_r(const _D_e_n_s_e_V_e_c_t_o_r&) = default; │ │ │ │ │ +242 │ │ │ │ │ +243 public: │ │ │ │ │ +244 //===== type definitions and constants │ │ │ │ │ +245 │ │ │ │ │ +_2_4_7 typedef typename Traits::derived_type _d_e_r_i_v_e_d___t_y_p_e; │ │ │ │ │ +248 │ │ │ │ │ +_2_5_0 typedef typename Traits::value_type _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +251 │ │ │ │ │ +_2_5_3 typedef typename _F_i_e_l_d_T_r_a_i_t_s_<_ _v_a_l_u_e___t_y_p_e_ _>_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +254 │ │ │ │ │ +_2_5_6 typedef typename Traits::value_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +257 │ │ │ │ │ +_2_5_9 typedef typename Traits::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +260 │ │ │ │ │ +_2_6_2 constexpr static int _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ +263 │ │ │ │ │ +264 //===== assignment from scalar │ │ │ │ │ +_2_6_6 inline _d_e_r_i_v_e_d___t_y_p_e& _o_p_e_r_a_t_o_r_=_ (const _v_a_l_u_e___t_y_p_e& k) │ │ │ │ │ +267 { │ │ │ │ │ +268 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +269 asImp()[i] = k; │ │ │ │ │ +270 return asImp(); │ │ │ │ │ +271 } │ │ │ │ │ +272 │ │ │ │ │ +273 //===== assignment from other DenseVectors │ │ │ │ │ +274 protected: │ │ │ │ │ +_2_7_6 _D_e_n_s_e_V_e_c_t_o_r& _o_p_e_r_a_t_o_r_=(const _D_e_n_s_e_V_e_c_t_o_r&) = default; │ │ │ │ │ +277 │ │ │ │ │ +278 public: │ │ │ │ │ +279 │ │ │ │ │ +281 template ::value_type>:: │ │ │ │ │ +value, int> = 0> │ │ │ │ │ +_2_8_4 _d_e_r_i_v_e_d___t_y_p_e& _o_p_e_r_a_t_o_r_=_ (const _D_e_n_s_e_V_e_c_t_o_r_<_W_>& other) │ │ │ │ │ +285 { │ │ │ │ │ +286 assert(other._s_i_z_e() == _s_i_z_e()); │ │ │ │ │ +287 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +288 asImp()[i] = other[i]; │ │ │ │ │ +289 return asImp(); │ │ │ │ │ +290 } │ │ │ │ │ +291 │ │ │ │ │ +292 //===== access to components │ │ │ │ │ +293 │ │ │ │ │ +_2_9_5 _v_a_l_u_e___t_y_p_e & _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) │ │ │ │ │ +296 { │ │ │ │ │ +297 return asImp()[i]; │ │ │ │ │ +298 } │ │ │ │ │ +299 │ │ │ │ │ +_3_0_0 const _v_a_l_u_e___t_y_p_e & _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +301 { │ │ │ │ │ +302 return asImp()[i]; │ │ │ │ │ +303 } │ │ │ │ │ +304 │ │ │ │ │ +_3_0_6 _v_a_l_u_e___t_y_p_e& _f_r_o_n_t() │ │ │ │ │ +307 { │ │ │ │ │ +308 return asImp()[0]; │ │ │ │ │ +309 } │ │ │ │ │ +310 │ │ │ │ │ +_3_1_2 const _v_a_l_u_e___t_y_p_e& _f_r_o_n_t() const │ │ │ │ │ +313 { │ │ │ │ │ +314 return asImp()[0]; │ │ │ │ │ +315 } │ │ │ │ │ +316 │ │ │ │ │ +_3_1_8 _v_a_l_u_e___t_y_p_e& _b_a_c_k() │ │ │ │ │ +319 { │ │ │ │ │ +320 return asImp()[_s_i_z_e()-1]; │ │ │ │ │ +321 } │ │ │ │ │ +322 │ │ │ │ │ +_3_2_4 const _v_a_l_u_e___t_y_p_e& _b_a_c_k() const │ │ │ │ │ +325 { │ │ │ │ │ +326 return asImp()[_s_i_z_e()-1]; │ │ │ │ │ +327 } │ │ │ │ │ +328 │ │ │ │ │ +_3_3_0 bool _e_m_p_t_y() const │ │ │ │ │ +331 { │ │ │ │ │ +332 return _s_i_z_e() == 0; │ │ │ │ │ +333 } │ │ │ │ │ +334 │ │ │ │ │ +_3_3_6 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ +337 { │ │ │ │ │ +338 return asImp().size(); │ │ │ │ │ +339 } │ │ │ │ │ +340 │ │ │ │ │ +_3_4_2 typedef _D_e_n_s_e_I_t_e_r_a_t_o_r_<_D_e_n_s_e_V_e_c_t_o_r_,_v_a_l_u_e___t_y_p_e_> _I_t_e_r_a_t_o_r; │ │ │ │ │ +_3_4_4 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ │ +345 │ │ │ │ │ +_3_4_7 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ +348 { │ │ │ │ │ +349 return _I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ +350 } │ │ │ │ │ +351 │ │ │ │ │ +_3_5_3 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ +354 { │ │ │ │ │ +355 return _I_t_e_r_a_t_o_r(*this,_s_i_z_e()); │ │ │ │ │ +356 } │ │ │ │ │ +357 │ │ │ │ │ +_3_6_0 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ +361 { │ │ │ │ │ +362 return _I_t_e_r_a_t_o_r(*this,_s_i_z_e()-1); │ │ │ │ │ +363 } │ │ │ │ │ +364 │ │ │ │ │ +_3_6_7 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ +368 { │ │ │ │ │ +369 return _I_t_e_r_a_t_o_r(*this,-1); │ │ │ │ │ +370 } │ │ │ │ │ +371 │ │ │ │ │ +_3_7_3 _I_t_e_r_a_t_o_r _f_i_n_d (_s_i_z_e___t_y_p_e i) │ │ │ │ │ +374 { │ │ │ │ │ +375 return _I_t_e_r_a_t_o_r(*this,std::min(i,_s_i_z_e())); │ │ │ │ │ +376 } │ │ │ │ │ +377 │ │ │ │ │ +_3_7_9 typedef _D_e_n_s_e_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _D_e_n_s_e_V_e_c_t_o_r_,_c_o_n_s_t_ _v_a_l_u_e___t_y_p_e_> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +_3_8_1 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; │ │ │ │ │ +382 │ │ │ │ │ +_3_8_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ +385 { │ │ │ │ │ +386 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ +387 } │ │ │ │ │ +388 │ │ │ │ │ +_3_9_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ +391 { │ │ │ │ │ +392 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,_s_i_z_e()); │ │ │ │ │ +393 } │ │ │ │ │ +394 │ │ │ │ │ +_3_9_7 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () const │ │ │ │ │ +398 { │ │ │ │ │ +399 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,_s_i_z_e()-1); │ │ │ │ │ +400 } │ │ │ │ │ +401 │ │ │ │ │ +_4_0_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 │ │ │ │ │ +405 { │ │ │ │ │ +406 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,-1); │ │ │ │ │ +407 } │ │ │ │ │ +408 │ │ │ │ │ +_4_1_0 _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 │ │ │ │ │ +411 { │ │ │ │ │ +412 return _C_o_n_s_t_I_t_e_r_a_t_o_r(*this,std::min(i,_s_i_z_e())); │ │ │ │ │ +413 } │ │ │ │ │ +414 │ │ │ │ │ +415 //===== vector space arithmetic │ │ │ │ │ +416 │ │ │ │ │ +418 template │ │ │ │ │ +_4_1_9 _d_e_r_i_v_e_d___t_y_p_e& _o_p_e_r_a_t_o_r_+_=_ (const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& x) │ │ │ │ │ +420 { │ │ │ │ │ +421 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(x._s_i_z_e() == _s_i_z_e()); │ │ │ │ │ +422 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +423 (*this)[i] += x[i]; │ │ │ │ │ +424 return asImp(); │ │ │ │ │ +425 } │ │ │ │ │ +426 │ │ │ │ │ +428 template │ │ │ │ │ +_4_2_9 _d_e_r_i_v_e_d___t_y_p_e& _o_p_e_r_a_t_o_r_-_=_ (const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& x) │ │ │ │ │ +430 { │ │ │ │ │ +431 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(x._s_i_z_e() == _s_i_z_e()); │ │ │ │ │ +432 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +433 (*this)[i] -= x[i]; │ │ │ │ │ +434 return asImp(); │ │ │ │ │ +435 } │ │ │ │ │ +436 │ │ │ │ │ +438 template │ │ │ │ │ +_4_3_9 _d_e_r_i_v_e_d___t_y_p_e _o_p_e_r_a_t_o_r_+_ (const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& b) const │ │ │ │ │ +440 { │ │ │ │ │ +441 _d_e_r_i_v_e_d___t_y_p_e z = asImp(); │ │ │ │ │ +442 return (z+=b); │ │ │ │ │ +443 } │ │ │ │ │ +444 │ │ │ │ │ +446 template │ │ │ │ │ +_4_4_7 _d_e_r_i_v_e_d___t_y_p_e _o_p_e_r_a_t_o_r_-_ (const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& b) const │ │ │ │ │ +448 { │ │ │ │ │ +449 _d_e_r_i_v_e_d___t_y_p_e z = asImp(); │ │ │ │ │ +450 return (z-=b); │ │ │ │ │ +451 } │ │ │ │ │ +452 │ │ │ │ │ +_4_5_4 _d_e_r_i_v_e_d___t_y_p_e _o_p_e_r_a_t_o_r_-_ () const │ │ │ │ │ +455 { │ │ │ │ │ +456 V result; │ │ │ │ │ +457 using idx_type = typename decltype(result)_:_:_s_i_z_e___t_y_p_e; │ │ │ │ │ +458 │ │ │ │ │ +459 for (idx_type i = 0; i < _s_i_z_e(); ++i) │ │ │ │ │ +460 result[i] = -asImp()[i]; │ │ │ │ │ +461 │ │ │ │ │ +462 return result; │ │ │ │ │ +463 } │ │ │ │ │ +464 │ │ │ │ │ +466 │ │ │ │ │ +474 template │ │ │ │ │ +475 typename std::enable_if< │ │ │ │ │ +476 std::is_convertible::value, │ │ │ │ │ +477 _d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +478 >::type& │ │ │ │ │ +_4_7_9 _o_p_e_r_a_t_o_r_+_=_ (const ValueType& kk) │ │ │ │ │ +480 { │ │ │ │ │ +481 const _v_a_l_u_e___t_y_p_e& k = kk; │ │ │ │ │ +482 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +483 (*this)[i] += k; │ │ │ │ │ +484 return asImp(); │ │ │ │ │ +485 } │ │ │ │ │ +486 │ │ │ │ │ +488 │ │ │ │ │ +496 template │ │ │ │ │ +497 typename std::enable_if< │ │ │ │ │ +498 std::is_convertible::value, │ │ │ │ │ +499 _d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +500 >::type& │ │ │ │ │ +_5_0_1 _o_p_e_r_a_t_o_r_-_=_ (const ValueType& kk) │ │ │ │ │ +502 { │ │ │ │ │ +503 const _v_a_l_u_e___t_y_p_e& k = kk; │ │ │ │ │ +504 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +505 (*this)[i] -= k; │ │ │ │ │ +506 return asImp(); │ │ │ │ │ +507 } │ │ │ │ │ +508 │ │ │ │ │ +510 │ │ │ │ │ +518 template │ │ │ │ │ +519 typename std::enable_if< │ │ │ │ │ +520 std::is_convertible::value, │ │ │ │ │ +521 _d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +522 >::type& │ │ │ │ │ +_5_2_3 _o_p_e_r_a_t_o_r_*_=_ (const FieldType& kk) │ │ │ │ │ +524 { │ │ │ │ │ +525 const _f_i_e_l_d___t_y_p_e& k = kk; │ │ │ │ │ +526 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +527 (*this)[i] *= k; │ │ │ │ │ +528 return asImp(); │ │ │ │ │ +529 } │ │ │ │ │ +530 │ │ │ │ │ +532 │ │ │ │ │ +540 template │ │ │ │ │ +541 typename std::enable_if< │ │ │ │ │ +542 std::is_convertible::value, │ │ │ │ │ +543 _d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +544 >::type& │ │ │ │ │ +_5_4_5 _o_p_e_r_a_t_o_r_/_=_ (const FieldType& kk) │ │ │ │ │ +546 { │ │ │ │ │ +547 const _f_i_e_l_d___t_y_p_e& k = kk; │ │ │ │ │ +548 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +549 (*this)[i] /= k; │ │ │ │ │ +550 return asImp(); │ │ │ │ │ +551 } │ │ │ │ │ +552 │ │ │ │ │ +554 template │ │ │ │ │ +_5_5_5 bool _o_p_e_r_a_t_o_r_=_=_ (const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& x) const │ │ │ │ │ +556 { │ │ │ │ │ +557 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(x._s_i_z_e() == _s_i_z_e()); │ │ │ │ │ +558 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +559 if ((*this)[i]!=x[i]) │ │ │ │ │ +560 return false; │ │ │ │ │ +561 │ │ │ │ │ +562 return true; │ │ │ │ │ +563 } │ │ │ │ │ +564 │ │ │ │ │ +566 template │ │ │ │ │ +_5_6_7 bool _o_p_e_r_a_t_o_r_!_=_ (const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& x) const │ │ │ │ │ +568 { │ │ │ │ │ +569 return !_o_p_e_r_a_t_o_r_=_=(x); │ │ │ │ │ +570 } │ │ │ │ │ +571 │ │ │ │ │ +572 │ │ │ │ │ +574 template │ │ │ │ │ +_5_7_5 _d_e_r_i_v_e_d___t_y_p_e& _a_x_p_y (const _f_i_e_l_d___t_y_p_e& a, const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& x) │ │ │ │ │ +576 { │ │ │ │ │ +577 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(x._s_i_z_e() == _s_i_z_e()); │ │ │ │ │ +578 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +579 (*this)[i] += a*x[i]; │ │ │ │ │ +580 return asImp(); │ │ │ │ │ +581 } │ │ │ │ │ +582 │ │ │ │ │ +590 template │ │ │ │ │ +_5_9_1 typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_f_i_e_l_d___t_y_p_e_,_t_y_p_e_n_a_m_e_ _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e>::PromotedType _o_p_e_r_a_t_o_r_*_ (const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& x) const { │ │ │ │ │ +592 typedef typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_f_i_e_l_d___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e>::PromotedType PromotedType; │ │ │ │ │ +593 PromotedType result(0); │ │ │ │ │ +594 assert(x._s_i_z_e() == _s_i_z_e()); │ │ │ │ │ +595 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) { │ │ │ │ │ +596 result += PromotedType((*this)[i]*x[i]); │ │ │ │ │ +597 } │ │ │ │ │ +598 return result; │ │ │ │ │ +599 } │ │ │ │ │ +600 │ │ │ │ │ +608 template │ │ │ │ │ +_6_0_9 typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_f_i_e_l_d___t_y_p_e_,_t_y_p_e_n_a_m_e_ _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e>::PromotedType _d_o_t(const _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>& x) const { │ │ │ │ │ +610 typedef typename _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_f_i_e_l_d___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _D_e_n_s_e_V_e_c_t_o_r_<_O_t_h_e_r_>_:_: │ │ │ │ │ +_f_i_e_l_d___t_y_p_e>::PromotedType PromotedType; │ │ │ │ │ +611 PromotedType result(0); │ │ │ │ │ +612 assert(x._s_i_z_e() == _s_i_z_e()); │ │ │ │ │ +613 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) { │ │ │ │ │ +614 result += _D_u_n_e_:_:_d_o_t((*this)[i],x[i]); │ │ │ │ │ +615 } │ │ │ │ │ +616 return result; │ │ │ │ │ +617 } │ │ │ │ │ +618 │ │ │ │ │ +619 //===== norms │ │ │ │ │ +620 │ │ │ │ │ +_6_2_2 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e _o_n_e___n_o_r_m() const { │ │ │ │ │ +623 using std::abs; │ │ │ │ │ +624 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e result( 0 ); │ │ │ │ │ +625 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +626 result += abs((*this)[i]); │ │ │ │ │ +627 return result; │ │ │ │ │ +628 } │ │ │ │ │ +629 │ │ │ │ │ +630 │ │ │ │ │ +_6_3_2 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e _o_n_e___n_o_r_m___r_e_a_l () const │ │ │ │ │ +633 { │ │ │ │ │ +634 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e result( 0 ); │ │ │ │ │ +635 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +636 result += fvmeta::absreal((*this)[i]); │ │ │ │ │ +637 return result; │ │ │ │ │ +638 } │ │ │ │ │ +639 │ │ │ │ │ +_6_4_1 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e _t_w_o___n_o_r_m () const │ │ │ │ │ +642 { │ │ │ │ │ +643 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e result( 0 ); │ │ │ │ │ +644 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +645 result += fvmeta::abs2((*this)[i]); │ │ │ │ │ +646 return fvmeta::sqrt(result); │ │ │ │ │ +647 } │ │ │ │ │ +648 │ │ │ │ │ +_6_5_0 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e _t_w_o___n_o_r_m_2 () const │ │ │ │ │ +651 { │ │ │ │ │ +652 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_a_l_u_e___t_y_p_e_>_:_:_r_e_a_l___t_y_p_e result( 0 ); │ │ │ │ │ +653 for (_s_i_z_e___t_y_p_e i=0; i<_s_i_z_e(); i++) │ │ │ │ │ +654 result += fvmeta::abs2((*this)[i]); │ │ │ │ │ +655 return result; │ │ │ │ │ +656 } │ │ │ │ │ +657 │ │ │ │ │ +659 template ::value, int>::type = 0> │ │ │ │ │ +_6_6_1 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +662 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +663 using std::abs; │ │ │ │ │ +664 using std::max; │ │ │ │ │ +665 │ │ │ │ │ +666 real_type norm = 0; │ │ │ │ │ +667 for (auto const &x : *this) { │ │ │ │ │ +668 real_type const a = abs(x); │ │ │ │ │ +669 norm = max(a, norm); │ │ │ │ │ +670 } │ │ │ │ │ +671 return norm; │ │ │ │ │ +672 } │ │ │ │ │ +673 │ │ │ │ │ +675 template ::value, int>::type = 0> │ │ │ │ │ +_6_7_7 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +678 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +679 using std::max; │ │ │ │ │ +680 │ │ │ │ │ +681 real_type norm = 0; │ │ │ │ │ +682 for (auto const &x : *this) { │ │ │ │ │ +683 real_type const a = fvmeta::absreal(x); │ │ │ │ │ +684 norm = max(a, norm); │ │ │ │ │ +685 } │ │ │ │ │ +686 return norm; │ │ │ │ │ +687 } │ │ │ │ │ +688 │ │ │ │ │ +690 template ::value, int>::type = 0> │ │ │ │ │ +_6_9_2 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +693 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +694 using std::abs; │ │ │ │ │ +695 using std::max; │ │ │ │ │ +696 │ │ │ │ │ +697 real_type norm = 0; │ │ │ │ │ +698 real_type isNaN = 1; │ │ │ │ │ +699 for (auto const &x : *this) { │ │ │ │ │ +700 real_type const a = abs(x); │ │ │ │ │ +701 norm = max(a, norm); │ │ │ │ │ +702 isNaN += a; │ │ │ │ │ +703 } │ │ │ │ │ +704 return norm * (isNaN / isNaN); │ │ │ │ │ +705 } │ │ │ │ │ +706 │ │ │ │ │ +708 template ::value, int>::type = 0> │ │ │ │ │ +_7_1_0 typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +711 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_v_t_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +712 using std::max; │ │ │ │ │ +713 │ │ │ │ │ +714 real_type norm = 0; │ │ │ │ │ +715 real_type isNaN = 1; │ │ │ │ │ +716 for (auto const &x : *this) { │ │ │ │ │ +717 real_type const a = fvmeta::absreal(x); │ │ │ │ │ +718 norm = max(a, norm); │ │ │ │ │ +719 isNaN += a; │ │ │ │ │ +720 } │ │ │ │ │ +721 return norm * (isNaN / isNaN); │ │ │ │ │ +722 } │ │ │ │ │ +723 │ │ │ │ │ +724 //===== sizes │ │ │ │ │ +725 │ │ │ │ │ +_7_2_7 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ +728 { │ │ │ │ │ +729 return _s_i_z_e(); │ │ │ │ │ +730 } │ │ │ │ │ +731 │ │ │ │ │ +_7_3_3 _s_i_z_e___t_y_p_e _d_i_m () const │ │ │ │ │ +734 { │ │ │ │ │ +735 return _s_i_z_e(); │ │ │ │ │ +736 } │ │ │ │ │ +737 │ │ │ │ │ +738 }; │ │ │ │ │ +739 │ │ │ │ │ +748 template │ │ │ │ │ +_7_4_9 std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const _D_e_n_s_e_V_e_c_t_o_r_<_V_>& v) │ │ │ │ │ +750 { │ │ │ │ │ +751 for (typename _D_e_n_s_e_V_e_c_t_o_r_<_V_>_:_:_s_i_z_e___t_y_p_e i=0; i0) ? " " : "") << v[i]; │ │ │ │ │ +753 return s; │ │ │ │ │ +754 } │ │ │ │ │ +755 │ │ │ │ │ +758} // end namespace │ │ │ │ │ +759 │ │ │ │ │ +760#endif // DUNE_DENSEVECTOR_HH │ │ │ │ │ +_f_t_r_a_i_t_s_._h_h │ │ │ │ │ +Type traits to determine the type of reals (when working with complex numbers) │ │ │ │ │ +_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ +Macro for wrapping boundary checks. │ │ │ │ │ +_m_a_t_v_e_c_t_r_a_i_t_s_._h_h │ │ │ │ │ +Documentation of the traits classes you need to write for each implementation │ │ │ │ │ +of DenseVector or Dense... │ │ │ │ │ +_p_r_o_m_o_t_i_o_n_t_r_a_i_t_s_._h_h │ │ │ │ │ +Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ +number types. │ │ │ │ │ +_d_o_t_p_r_o_d_u_c_t_._h_h │ │ │ │ │ +Provides the functions dot(a,b) := and dotT(a,b) := . │ │ │ │ │ +_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h │ │ │ │ │ +Implements a generic iterator class for writing stl conformant iterators. │ │ │ │ │ +_D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S │ │ │ │ │ +#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ +If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do │ │ │ │ │ +nothing. │ │ │ │ │ +DDeeffiinniittiioonn boundschecking.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_d_o_t │ │ │ │ │ +auto dot(const A &a, const B &b) -> typename std::enable_if< IsNumber< A >:: │ │ │ │ │ +value &&!IsVector< A >::value &&!std::is_same< typename FieldTraits< A >:: │ │ │ │ │ +field_type, typename FieldTraits< A >::real_type > ::value, decltype(conj(a) │ │ │ │ │ +*b)>::type │ │ │ │ │ +computes the dot product for fundamental data types according to Petsc's │ │ │ │ │ +VectDot function: dot(a,... │ │ │ │ │ +DDeeffiinniittiioonn dotproduct.hh:42 │ │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ +DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ -auto getMPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Collective communication interface and sequential default implementation. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ -This exception is thrown when ready(), wait() or get() is called on an invalid │ │ │ │ │ -future.... │ │ │ │ │ -DDeeffiinniittiioonn future.hh:18 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_v_a_l_u_e │ │ │ │ │ -std::unique_ptr< T > value │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -T & operator*() const │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_B_u_f_f_e_r │ │ │ │ │ -Buffer(V &&t) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_g_e_t │ │ │ │ │ -T get() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_B_u_f_f_e_r │ │ │ │ │ -Buffer(bool valid) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:20 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_v_a_l_u_e │ │ │ │ │ -std::optional< std::reference_wrapper< T > > value │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_B_u_f_f_e_r │ │ │ │ │ -Buffer(bool valid=false) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_g_e_t │ │ │ │ │ -T & get() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_B_u_f_f_e_r │ │ │ │ │ -Buffer(V &&t) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _>_:_:_v_a_l_i_d__ │ │ │ │ │ -bool valid_ │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _>_:_:_g_e_t │ │ │ │ │ -void get() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _v_o_i_d_ _>_:_:_B_u_f_f_e_r │ │ │ │ │ -Buffer(bool valid=false) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ -Provides a future-like object for MPI communication. It contains the object │ │ │ │ │ -that will be received and... │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ -MPIFuture(V &&recv_data, typename std::enable_if_t::value > │ │ │ │ │ -*=0) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:107 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ -bool ready() const │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_v_a_l_i_d │ │ │ │ │ -bool valid() const │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:139 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_~_M_P_I_F_u_t_u_r_e │ │ │ │ │ -~MPIFuture() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ -MPIFuture(bool valid=false) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -MPIFuture & operator=(MPIFuture &&f) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:131 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___s_e_n_d___m_p_i_d_a_t_a │ │ │ │ │ -auto get_send_mpidata() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:169 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_w_a_i_t │ │ │ │ │ -void wait() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___m_p_i_d_a_t_a │ │ │ │ │ -auto get_mpidata() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:165 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ -R get() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ -MPIFuture(V &&recv_data, U &&send_data, typename std::enable_if_t::value &&!std::is_void< U >::value > *=0) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:99 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t___s_e_n_d___d_a_t_a │ │ │ │ │ -S get_send_data() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:160 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_M_P_I_F_u_t_u_r_e │ │ │ │ │ -MPIFuture(MPIFuture &&f) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:122 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r │ │ │ │ │ +Interface for a class of dense vectors over a given field. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +Traits::value_type value_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_t_w_o___n_o_r_m_2 │ │ │ │ │ +FieldTraits< value_type >::real_type two_norm2() const │ │ │ │ │ +square of two norm (sum over squared values of entries), need for block │ │ │ │ │ +recursion │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:650 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator const_iterator │ │ │ │ │ +typedef for stl compliant access │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:381 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +Iterator iterator │ │ │ │ │ +typedef for stl compliant access │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:344 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_f_i_n_d │ │ │ │ │ +ConstIterator find(size_type i) const │ │ │ │ │ +return iterator to given element or end() │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:410 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ +ConstIterator end() const │ │ │ │ │ +end ConstIterator │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:390 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_f_r_o_n_t │ │ │ │ │ +value_type & front() │ │ │ │ │ +return reference to first element │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:306 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_t_w_o___n_o_r_m │ │ │ │ │ +FieldTraits< value_type >::real_type two_norm() const │ │ │ │ │ +two norm sqrt(sum over squared values of entries) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:641 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +ConstIterator beforeBegin() const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:404 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const DenseVector< Other > &x) const │ │ │ │ │ +Binary vector comparison. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:555 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +Iterator begin() │ │ │ │ │ +begin iterator │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +Iterator beforeBegin() │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:367 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +DenseIterator< const DenseVector, const value_type > ConstIterator │ │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:379 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +Traits::derived_type derived_type │ │ │ │ │ +type of derived vector class │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:247 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_f_r_o_n_t │ │ │ │ │ +const value_type & front() const │ │ │ │ │ +return reference to first element │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:312 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ +derived_type operator+(const DenseVector< Other > &b) const │ │ │ │ │ +Binary vector addition. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:439 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +size method │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:336 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_d_i_m │ │ │ │ │ +size_type dim() const │ │ │ │ │ +dimension of the vector space │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:733 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ +FieldTraits< vt >::real_type infinity_norm() const │ │ │ │ │ +infinity norm (maximum of absolute values of entries) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:661 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +ConstIterator beforeEnd() const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:397 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_a_x_p_y │ │ │ │ │ +derived_type & axpy(const field_type &a, const DenseVector< Other > &x) │ │ │ │ │ +vector space axpy operation ( *this += a x ) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:575 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +derived_type & operator=(const value_type &k) │ │ │ │ │ +Assignment operator for scalar. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:266 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ +static constexpr int blocklevel │ │ │ │ │ +The number of block levels we contain. This is the leaf, that is, 1. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:262 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ +Iterator end() │ │ │ │ │ +end iterator │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:353 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Traits::size_type size_type │ │ │ │ │ +The type used for the index access and size operation. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +DenseIterator< DenseVector, value_type > Iterator │ │ │ │ │ +Iterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:342 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ +derived_type & operator-=(const DenseVector< Other > &x) │ │ │ │ │ +vector space subtraction │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:429 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_D_e_n_s_e_V_e_c_t_o_r │ │ │ │ │ +DenseVector(const DenseVector &)=default │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +Iterator beforeEnd() │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:360 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ +derived_type & operator+=(const DenseVector< Other > &x) │ │ │ │ │ +vector space addition │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:419 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ +std::enable_if< std::is_convertible< FieldType, field_type >::value, │ │ │ │ │ +derived_type >::type & operator*=(const FieldType &kk) │ │ │ │ │ +vector space multiplication with scalar │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:523 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const DenseVector< Other > &x) const │ │ │ │ │ +Binary vector incomparison. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:567 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_a_c_k │ │ │ │ │ +const value_type & back() const │ │ │ │ │ +return reference to last element │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +ConstIterator begin() const │ │ │ │ │ +begin ConstIterator │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:384 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +PromotionTraits< field_type, typenameDenseVector< Other >::field_type >:: │ │ │ │ │ +PromotedType operator*(const DenseVector< Other > &x) const │ │ │ │ │ +indefinite vector dot product which corresponds to Petsc's VecTDot │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:591 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_D_e_n_s_e_V_e_c_t_o_r │ │ │ │ │ +constexpr DenseVector()=default │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ +FieldTraits< vt >::real_type infinity_norm_real() const │ │ │ │ │ +simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:677 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +DenseVector & operator=(const DenseVector &)=default │ │ │ │ │ +Assignment operator for other DenseVector of same type. │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +Traits::value_type block_type │ │ │ │ │ +export the type representing the components │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:256 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +value_type & operator[](size_type i) │ │ │ │ │ +random access │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:295 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< value_type >::field_type field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:253 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_b_a_c_k │ │ │ │ │ +value_type & back() │ │ │ │ │ +return reference to last element │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:318 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +derived_type operator-() const │ │ │ │ │ +Vector negation. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:454 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ +std::enable_if< std::is_convertible< FieldType, field_type >::value, │ │ │ │ │ +derived_type >::type & operator/=(const FieldType &kk) │ │ │ │ │ +vector space division by scalar │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:545 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_n_e___n_o_r_m___r_e_a_l │ │ │ │ │ +FieldTraits< value_type >::real_type one_norm_real() const │ │ │ │ │ +simplified one norm (uses Manhattan norm for complex values) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:632 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_d_o_t │ │ │ │ │ +PromotionTraits< field_type, typenameDenseVector< Other >::field_type >:: │ │ │ │ │ +PromotedType dot(const DenseVector< Other > &x) const │ │ │ │ │ +vector dot product which corresponds to Petsc's VecDot │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:609 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_f_i_n_d │ │ │ │ │ +Iterator find(size_type i) │ │ │ │ │ +return iterator to given element or end() │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:373 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_o_n_e___n_o_r_m │ │ │ │ │ +FieldTraits< value_type >::real_type one_norm() const │ │ │ │ │ +one norm (sum over absolute values of entries) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:622 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_N │ │ │ │ │ +size_type N() const │ │ │ │ │ +number of blocks in the vector (are of size 1 here) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:727 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_V_e_c_t_o_r_:_:_e_m_p_t_y │ │ │ │ │ +bool empty() const │ │ │ │ │ +checks whether the container is empty │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:330 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_e_n_s_e_V_e_c_t_o_r_<_ _V_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< typenameDenseMatVecTraits< V >::value_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_e_n_s_e_V_e_c_t_o_r_<_ _V_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< typenameDenseMatVecTraits< V >::value_type >::field_type │ │ │ │ │ +field_type │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Generic iterator class for dense vector and matrix implementations. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ +SizeType index() const │ │ │ │ │ +return index │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:213 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const MutableIterator &other) const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r │ │ │ │ │ +DenseIterator(const MutableIterator &other) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:158 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const ConstIterator &other) const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:173 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ +R elementAt(DifferenceType i) const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:192 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +DifferenceType distanceTo(DenseIterator< const typename std::remove_const< C │ │ │ │ │ +>::type, const typename std::remove_const< T >::type > other) const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:200 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ +void decrement() │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:187 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r │ │ │ │ │ +DenseIterator(const ConstIterator &other) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:162 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +DifferenceType distanceTo(DenseIterator< typename std::remove_const< C >::type, │ │ │ │ │ +typename std::remove_const< T >::type > other) const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r │ │ │ │ │ +DenseIterator(C &cont, SizeType pos) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:154 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_D_i_f_f_e_r_e_n_c_e_T_y_p_e │ │ │ │ │ +std::ptrdiff_t DifferenceType │ │ │ │ │ +The type of the difference between two positions. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +R dereference() const │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ +void advance(DifferenceType n) │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:196 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_I_t_e_r_a_t_o_r_:_:_S_i_z_e_T_y_p_e │ │ │ │ │ +C::size_type SizeType │ │ │ │ │ +The type to index the underlying container. │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:147 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +T field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +T real_type │ │ │ │ │ +export the type representing the real type of the field │ │ │ │ │ +DDeeffiinniittiioonn ftraits.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e │ │ │ │ │ +get the 'mutable' version of a reference to a const object │ │ │ │ │ +DDeeffiinniittiioonn genericiterator.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ +Base class for stl conformant forward iterators. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:434 │ │ │ │ │ +_D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn matvectraits.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_m_o_t_i_o_n_T_r_a_i_t_s │ │ │ │ │ +Compute type of the result of an arithmetic operation involving two different │ │ │ │ │ +number types. │ │ │ │ │ +DDeeffiinniittiioonn promotiontraits.hh:27 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00212.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: collectivecommunication.hh File Reference │ │ │ │ +dune-common: boundschecking.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,24 +65,38 @@ │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    collectivecommunication.hh File Reference
    │ │ │ │ +
    │ │ │ │ +Macros
    │ │ │ │ +
    boundschecking.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    #include <dune/common/parallel/communication.hh>
    │ │ │ │ + │ │ │ │ +

    Macro for wrapping boundary checks. │ │ │ │ +More...

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

    Go to the source code of this file.

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

    │ │ │ │ +Macros

    #define DUNE_ASSERT_BOUNDS(cond)
     If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
     
    │ │ │ │ +

    Detailed Description

    │ │ │ │ +

    Macro for wrapping boundary checks.

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,12 +1,20 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -collectivecommunication.hh File Reference │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ +_M_a_c_r_o_s │ │ │ │ │ +boundschecking.hh File Reference │ │ │ │ │ +Macro for wrapping boundary checks. _M_o_r_e_._._. │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_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_. │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(cond) │ │ │ │ │ +  If DUNE_CHECK_BOUNDS is defined: check if condition ccoonndd holds; │ │ │ │ │ + otherwise, do nothing. │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Macro for wrapping boundary checks. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00212_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: collectivecommunication.hh Source File │ │ │ │ +dune-common: boundschecking.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,27 +70,48 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    collectivecommunication.hh
    │ │ │ │ +
    boundschecking.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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// Will be removed after the 2.7 release
    │ │ │ │ -
    4#warning "Deprecated header, use #include <dune/common/parallel/communication.hh> instead!"
    │ │ │ │ - │ │ │ │ -
    Implements an utility class that provides collective communication methods for sequential programs.
    │ │ │ │ +
    3#ifndef DUNE_BOUNDSCHECKING_HH
    │ │ │ │ +
    4#define DUNE_BOUNDSCHECKING_HH
    │ │ │ │ +
    5
    │ │ │ │ + │ │ │ │ +
    7
    │ │ │ │ +
    19#ifndef DUNE_ASSERT_BOUNDS
    │ │ │ │ +
    20#if defined(DUNE_CHECK_BOUNDS) || defined(DOXYGEN)
    │ │ │ │ +
    21
    │ │ │ │ +
    │ │ │ │ +
    30#define DUNE_ASSERT_BOUNDS(cond) \
    │ │ │ │ +
    31 do { \
    │ │ │ │ +
    32 if (!(cond)) \
    │ │ │ │ +
    33 DUNE_THROW(Dune::RangeError, "Index out of bounds."); \
    │ │ │ │ +
    34 } while (false)
    │ │ │ │ +
    │ │ │ │ +
    35
    │ │ │ │ +
    36#else
    │ │ │ │ +
    37#define DUNE_ASSERT_BOUNDS(cond)
    │ │ │ │ +
    38#endif
    │ │ │ │ +
    39#endif
    │ │ │ │ +
    40
    │ │ │ │ +
    41/* @} */
    │ │ │ │ +
    42
    │ │ │ │ +
    43#endif // DUNE_BOUNDSCHECKING_HH
    │ │ │ │ +
    A few common exception classes.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,21 +1,37 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -collectivecommunication.hh │ │ │ │ │ +boundschecking.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-FileCopyrightInfo: 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// Will be removed after the 2.7 release │ │ │ │ │ -4#warning "Deprecated header, use #include instead!" │ │ │ │ │ -5#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ -Implements an utility class that provides collective communication methods for │ │ │ │ │ -sequential programs. │ │ │ │ │ +3#ifndef DUNE_BOUNDSCHECKING_HH │ │ │ │ │ +4#define DUNE_BOUNDSCHECKING_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +7 │ │ │ │ │ +19#ifndef DUNE_ASSERT_BOUNDS │ │ │ │ │ +20#if defined(DUNE_CHECK_BOUNDS) || defined(DOXYGEN) │ │ │ │ │ +21 │ │ │ │ │ +_3_0#define DUNE_ASSERT_BOUNDS(cond) \ │ │ │ │ │ +31 do { \ │ │ │ │ │ +32 if (!(cond)) \ │ │ │ │ │ +33 DUNE_THROW(Dune::RangeError, "Index out of bounds."); \ │ │ │ │ │ +34 } while (false) │ │ │ │ │ +35 │ │ │ │ │ +36#else │ │ │ │ │ +37#define DUNE_ASSERT_BOUNDS(cond) │ │ │ │ │ +38#endif │ │ │ │ │ +39#endif │ │ │ │ │ +40 │ │ │ │ │ +41/* @} */ │ │ │ │ │ +42 │ │ │ │ │ +43#endif // DUNE_BOUNDSCHECKING_HH │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00215.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: indicessyncer.hh File Reference │ │ │ │ +dune-common: make_array.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,86 +65,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
    │ │ │ │ - │ │ │ │ +
    make_array.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Class for adding missing indices of a distributed index set in a local communication. │ │ │ │ -More...

    │ │ │ │ -
    #include "indexset.hh"
    │ │ │ │ -#include "remoteindices.hh"
    │ │ │ │ -#include <dune/common/stdstreams.hh>
    │ │ │ │ -#include <dune/common/sllist.hh>
    │ │ │ │ -#include <cassert>
    │ │ │ │ -#include <cmath>
    │ │ │ │ -#include <limits>
    │ │ │ │ -#include <algorithm>
    │ │ │ │ -#include <functional>
    │ │ │ │ -#include <map>
    │ │ │ │ -#include <tuple>
    │ │ │ │ +
    #include <array>
    │ │ │ │ +#include <type_traits>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    class  Dune::IndicesSyncer< T >
     Class for recomputing missing indices of a distributed index set. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Std
     Namespace for features backported from new C++ standards.
     
    │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Functions

    template<typename TG , typename TA >
    bool Dune::operator< (const IndexPair< TG, ParallelLocalIndex< TA > > &i1, const std::pair< TG, TA > &i2)
     
    template<typename TG , typename TA >
    bool Dune::operator< (const std::pair< TG, TA > &i1, const IndexPair< TG, ParallelLocalIndex< TA > > &i2)
     
    template<typename TG , typename TA >
    bool Dune::operator== (const IndexPair< TG, ParallelLocalIndex< TA > > &i1, const std::pair< TG, TA > &i2)
     
    template<typename TG , typename TA >
    bool Dune::operator!= (const IndexPair< TG, ParallelLocalIndex< TA > > &i1, const std::pair< TG, TA > &i2)
     
    template<typename TG , typename TA >
    bool Dune::operator== (const std::pair< TG, TA > &i2, const IndexPair< TG, ParallelLocalIndex< TA > > &i1)
     
    template<typename TG , typename TA >
    bool Dune::operator!= (const std::pair< TG, TA > &i2, const IndexPair< TG, ParallelLocalIndex< TA > > &i1)
     
    template<typename T , typename A , typename A1 >
    void Dune::storeGlobalIndicesOfRemoteIndices (std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, const RemoteIndices< T, A1 > &remoteIndices)
     Stores the corresponding global indices of the remote index information.
     
    template<typename T , typename A , typename A1 >
    void Dune::repairLocalIndexPointers (std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, RemoteIndices< T, A1 > &remoteIndices, const T &indexSet)
     Repair the pointers to the local indices in the remote indices.
     
    template<typename... Args>
    std::array< typename std::common_type< Args... >::type, sizeof...(Args)> Dune::Std::make_array (const Args &... args)
     Create and initialize an array.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Class for adding missing indices of a distributed index set in a local communication.

    │ │ │ │ -
    Author
    Markus Blatt
    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,77 +1,27 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_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 │ │ │ │ │ -indicessyncer.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ -Class for adding missing indices of a distributed index set in a local │ │ │ │ │ -communication. _M_o_r_e_._._. │ │ │ │ │ -#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ -#include "_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h" │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_l_l_i_s_t_._h_h> │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +make_array.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_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_<_ _T_ _> │ │ │ │ │ -  Class for recomputing missing indices of a distributed index set. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const _I_n_d_e_x_P_a_i_r< TG, _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1, │ │ │ │ │ - const std::pair< TG, TA > &i2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const std::pair< TG, TA > &i1, const _I_n_d_e_x_P_a_i_r< TG, │ │ │ │ │ - _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _I_n_d_e_x_P_a_i_r< TG, _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1, │ │ │ │ │ - const std::pair< TG, TA > &i2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _I_n_d_e_x_P_a_i_r< TG, _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1, │ │ │ │ │ - const std::pair< TG, TA > &i2) │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │   │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const std::pair< TG, TA > &i2, const _I_n_d_e_x_P_a_i_r< TG, │ │ │ │ │ - _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const std::pair< TG, TA > &i2, const _I_n_d_e_x_P_a_i_r< TG, │ │ │ │ │ - _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< TA > > &i1) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_s_t_o_r_e_G_l_o_b_a_l_I_n_d_i_c_e_s_O_f_R_e_m_o_t_e_I_n_d_i_c_e_s (std::map< int, _S_L_L_i_s_t< std:: │ │ │ │ │ - pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > │ │ │ │ │ - &globalMap, const _R_e_m_o_t_e_I_n_d_i_c_e_s< T, A1 > &remoteIndices) │ │ │ │ │ -  Stores the corresponding global indices of the remote index information. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s (std::map< int, _S_L_L_i_s_t< std::pair< │ │ │ │ │ - typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > │ │ │ │ │ - &globalMap, _R_e_m_o_t_e_I_n_d_i_c_e_s< T, A1 > &remoteIndices, const T &indexSet) │ │ │ │ │ -  Repair the pointers to the local indices in the remote indices. │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::array< typename std::common_type< _D_u_n_e_:_:_S_t_d_:_:_m_a_k_e___a_r_r_a_y (const Args &... │ │ │ │ │ + Args... >::type, sizeof...(Args)>  args) │ │ │ │ │ +  Create and initialize an array. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Class for adding missing indices of a distributed index set in a local │ │ │ │ │ -communication. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00215_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: indicessyncer.hh Source File │ │ │ │ +dune-common: make_array.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1051 +70,64 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    indicessyncer.hh
    │ │ │ │ +
    make_array.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_INDICESSYNCER_HH
    │ │ │ │ -
    6#define DUNE_INDICESSYNCER_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include "indexset.hh"
    │ │ │ │ -
    9#include "remoteindices.hh"
    │ │ │ │ - │ │ │ │ -
    11#include <dune/common/sllist.hh>
    │ │ │ │ -
    12#include <cassert>
    │ │ │ │ -
    13#include <cmath>
    │ │ │ │ -
    14#include <limits>
    │ │ │ │ -
    15#include <algorithm>
    │ │ │ │ -
    16#include <functional>
    │ │ │ │ -
    17#include <map>
    │ │ │ │ -
    18#include <tuple>
    │ │ │ │ -
    19
    │ │ │ │ -
    20#if HAVE_MPI
    │ │ │ │ -
    21namespace Dune
    │ │ │ │ -
    22{
    │ │ │ │ -
    39 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    41 {
    │ │ │ │ -
    42 public:
    │ │ │ │ -
    43
    │ │ │ │ - │ │ │ │ -
    46
    │ │ │ │ - │ │ │ │ -
    49
    │ │ │ │ - │ │ │ │ -
    52
    │ │ │ │ -
    54 typedef typename ParallelIndexSet::LocalIndex::Attribute Attribute;
    │ │ │ │ -
    55
    │ │ │ │ - │ │ │ │ -
    60
    │ │ │ │ - │ │ │ │ -
    71 RemoteIndices& remoteIndices);
    │ │ │ │ -
    72
    │ │ │ │ -
    82 void sync();
    │ │ │ │ -
    83
    │ │ │ │ -
    94 template<typename T1>
    │ │ │ │ -
    95 void sync(T1& numberer);
    │ │ │ │ -
    96
    │ │ │ │ -
    97 private:
    │ │ │ │ -
    98
    │ │ │ │ -
    100 ParallelIndexSet& indexSet_;
    │ │ │ │ -
    101
    │ │ │ │ -
    103 RemoteIndices& remoteIndices_;
    │ │ │ │ -
    104
    │ │ │ │ -
    106 char** sendBuffers_;
    │ │ │ │ -
    107
    │ │ │ │ -
    109 char* receiveBuffer_;
    │ │ │ │ -
    110
    │ │ │ │ -
    112 std::size_t* sendBufferSizes_;
    │ │ │ │ -
    113
    │ │ │ │ -
    115 int receiveBufferSize_; // int because of MPI
    │ │ │ │ -
    116
    │ │ │ │ -
    120 struct MessageInformation
    │ │ │ │ -
    121 {
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    123 : publish(), pairs()
    │ │ │ │ -
    124 {}
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    131 int pairs;
    │ │ │ │ -
    132 };
    │ │ │ │ -
    133
    │ │ │ │ -
    137 class DefaultNumberer
    │ │ │ │ -
    138 {
    │ │ │ │ -
    139 public:
    │ │ │ │ -
    145 std::size_t operator()([[maybe_unused]] const GlobalIndex& global)
    │ │ │ │ -
    146 {
    │ │ │ │ -
    147 return std::numeric_limits<size_t>::max();
    │ │ │ │ -
    148 }
    │ │ │ │ -
    149 };
    │ │ │ │ -
    150
    │ │ │ │ -
    152 MPI_Datatype datatype_;
    │ │ │ │ -
    153
    │ │ │ │ -
    155 int rank_;
    │ │ │ │ -
    156
    │ │ │ │ -
    161 typedef SLList<std::pair<GlobalIndex,Attribute>, typename RemoteIndices::Allocator> GlobalIndexList;
    │ │ │ │ -
    162
    │ │ │ │ -
    164 typedef typename GlobalIndexList::ModifyIterator GlobalIndexModifier;
    │ │ │ │ -
    165
    │ │ │ │ - │ │ │ │ -
    170 GlobalIndexIterator;
    │ │ │ │ -
    171
    │ │ │ │ -
    173 typedef std::map<int, GlobalIndexList> GlobalIndicesMap;
    │ │ │ │ -
    174
    │ │ │ │ -
    183 GlobalIndicesMap globalMap_;
    │ │ │ │ -
    184
    │ │ │ │ - │ │ │ │ -
    189
    │ │ │ │ -
    193 typedef typename BoolList::iterator BoolIterator;
    │ │ │ │ -
    194
    │ │ │ │ -
    196 typedef typename BoolList::ModifyIterator BoolListModifier;
    │ │ │ │ -
    197
    │ │ │ │ -
    199 typedef std::map<int,BoolList> BoolMap;
    │ │ │ │ -
    200
    │ │ │ │ -
    205 BoolMap oldMap_;
    │ │ │ │ -
    206
    │ │ │ │ -
    208 std::map<int,MessageInformation> infoSend_;
    │ │ │ │ -
    209
    │ │ │ │ -
    211 typedef typename RemoteIndices::RemoteIndexList RemoteIndexList;
    │ │ │ │ -
    212
    │ │ │ │ -
    214 typedef typename RemoteIndexList::ModifyIterator RemoteIndexModifier;
    │ │ │ │ -
    215
    │ │ │ │ - │ │ │ │ -
    218
    │ │ │ │ -
    220 typedef typename RemoteIndexList::iterator RemoteIndexIterator;
    │ │ │ │ -
    221
    │ │ │ │ -
    223 typedef typename RemoteIndexList::const_iterator ConstRemoteIndexIterator;
    │ │ │ │ -
    224
    │ │ │ │ -
    226 typedef std::tuple<RemoteIndexModifier,GlobalIndexModifier,BoolListModifier,
    │ │ │ │ -
    227 const ConstRemoteIndexIterator> IteratorTuple;
    │ │ │ │ -
    228
    │ │ │ │ -
    236 class Iterators
    │ │ │ │ -
    237 {
    │ │ │ │ -
    238 friend class IndicesSyncer<T>;
    │ │ │ │ -
    239 public:
    │ │ │ │ -
    249 Iterators(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,
    │ │ │ │ -
    250 BoolList& booleans);
    │ │ │ │ -
    251
    │ │ │ │ -
    255 Iterators();
    │ │ │ │ -
    256
    │ │ │ │ - │ │ │ │ -
    261
    │ │ │ │ -
    267 void insert(const RemoteIndex& index,
    │ │ │ │ -
    268 const std::pair<GlobalIndex,Attribute>& global);
    │ │ │ │ -
    269
    │ │ │ │ -
    274 RemoteIndex& remoteIndex() const;
    │ │ │ │ -
    275
    │ │ │ │ -
    280 std::pair<GlobalIndex,Attribute>& globalIndexPair() const;
    │ │ │ │ -
    281
    │ │ │ │ - │ │ │ │ -
    283
    │ │ │ │ -
    289 bool isOld() const;
    │ │ │ │ -
    290
    │ │ │ │ -
    300 void reset(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,
    │ │ │ │ -
    301 BoolList& booleans);
    │ │ │ │ -
    302
    │ │ │ │ -
    308 bool isNotAtEnd() const;
    │ │ │ │ -
    309
    │ │ │ │ -
    315 bool isAtEnd() const;
    │ │ │ │ -
    316
    │ │ │ │ -
    317 private:
    │ │ │ │ -
    327 IteratorTuple iterators_;
    │ │ │ │ -
    328 };
    │ │ │ │ -
    329
    │ │ │ │ -
    331 typedef std::map<int,Iterators> IteratorsMap;
    │ │ │ │ -
    332
    │ │ │ │ -
    344 IteratorsMap iteratorsMap_;
    │ │ │ │ -
    345
    │ │ │ │ -
    347 void calculateMessageSizes();
    │ │ │ │ -
    348
    │ │ │ │ -
    356 void packAndSend(int destination, char* buffer, std::size_t bufferSize, MPI_Request& req);
    │ │ │ │ -
    357
    │ │ │ │ -
    362 template<typename T1>
    │ │ │ │ -
    363 void recvAndUnpack(T1& numberer);
    │ │ │ │ -
    364
    │ │ │ │ -
    368 void registerMessageDatatype();
    │ │ │ │ -
    369
    │ │ │ │ -
    373 void insertIntoRemoteIndexList(int process,
    │ │ │ │ -
    374 const std::pair<GlobalIndex,Attribute>& global,
    │ │ │ │ -
    375 char attribute);
    │ │ │ │ -
    376
    │ │ │ │ -
    380 void resetIteratorsMap();
    │ │ │ │ -
    381
    │ │ │ │ -
    386 bool checkReset();
    │ │ │ │ -
    387
    │ │ │ │ -
    396 bool checkReset(const Iterators& iterators, RemoteIndexList& rlist, GlobalIndexList& gList,
    │ │ │ │ -
    397 BoolList& bList);
    │ │ │ │ -
    398 };
    │ │ │ │ -
    │ │ │ │ -
    399
    │ │ │ │ -
    400 template<typename TG, typename TA>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    402 const std::pair<TG,TA>& i2)
    │ │ │ │ -
    403 {
    │ │ │ │ -
    404 return i1.global() < i2.first ||
    │ │ │ │ -
    405 (i1.global() == i2.first && i1.local().attribute()<i2.second);
    │ │ │ │ -
    406 }
    │ │ │ │ -
    │ │ │ │ -
    407
    │ │ │ │ -
    408 template<typename TG, typename TA>
    │ │ │ │ -
    │ │ │ │ -
    409 bool operator<(const std::pair<TG,TA>& i1,
    │ │ │ │ -
    410 const IndexPair<TG,ParallelLocalIndex<TA> >& i2)
    │ │ │ │ -
    411 {
    │ │ │ │ -
    412 return i1.first < i2.global() ||
    │ │ │ │ -
    413 (i1.first == i2.global() && i1.second<i2.local().attribute());
    │ │ │ │ -
    414 }
    │ │ │ │ -
    │ │ │ │ -
    415
    │ │ │ │ -
    416 template<typename TG, typename TA>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    418 const std::pair<TG,TA>& i2)
    │ │ │ │ -
    419 {
    │ │ │ │ -
    420 return (i1.global() == i2.first && i1.local().attribute()==i2.second);
    │ │ │ │ -
    421 }
    │ │ │ │ -
    │ │ │ │ -
    422
    │ │ │ │ -
    423 template<typename TG, typename TA>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    425 const std::pair<TG,TA>& i2)
    │ │ │ │ -
    426 {
    │ │ │ │ -
    427 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);
    │ │ │ │ -
    428 }
    │ │ │ │ -
    │ │ │ │ -
    429
    │ │ │ │ -
    430 template<typename TG, typename TA>
    │ │ │ │ -
    │ │ │ │ -
    431 bool operator==(const std::pair<TG,TA>& i2,
    │ │ │ │ -
    432 const IndexPair<TG,ParallelLocalIndex<TA> >& i1)
    │ │ │ │ -
    433 {
    │ │ │ │ -
    434 return (i1.global() == i2.first && i1.local().attribute()==i2.second);
    │ │ │ │ -
    435 }
    │ │ │ │ -
    │ │ │ │ -
    436
    │ │ │ │ -
    437 template<typename TG, typename TA>
    │ │ │ │ -
    │ │ │ │ -
    438 bool operator!=(const std::pair<TG,TA>& i2,
    │ │ │ │ -
    439 const IndexPair<TG,ParallelLocalIndex<TA> >& i1)
    │ │ │ │ -
    440 {
    │ │ │ │ -
    441 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);
    │ │ │ │ -
    442 }
    │ │ │ │ -
    │ │ │ │ -
    443
    │ │ │ │ -
    460 template<typename T, typename A, typename A1>
    │ │ │ │ -
    │ │ │ │ -
    461 void storeGlobalIndicesOfRemoteIndices(std::map<int,SLList<std::pair<typename T::GlobalIndex, typename T::LocalIndex::Attribute>,A> >& globalMap,
    │ │ │ │ -
    462 const RemoteIndices<T,A1>& remoteIndices)
    │ │ │ │ -
    463 {
    │ │ │ │ -
    464 for(auto remote = remoteIndices.begin(), end =remoteIndices.end(); remote != end; ++remote) {
    │ │ │ │ -
    465 typedef typename RemoteIndices<T,A1>::RemoteIndexList RemoteIndexList;
    │ │ │ │ - │ │ │ │ -
    467 GlobalIndexList& global = globalMap[remote->first];
    │ │ │ │ -
    468 RemoteIndexList& rList = *(remote->second.first);
    │ │ │ │ -
    469
    │ │ │ │ -
    470 for(auto index = rList.begin(), riEnd = rList.end();
    │ │ │ │ -
    471 index != riEnd; ++index) {
    │ │ │ │ -
    472 global.push_back(std::make_pair(index->localIndexPair().global(),
    │ │ │ │ -
    473 index->localIndexPair().local().attribute()));
    │ │ │ │ -
    474 }
    │ │ │ │ -
    475 }
    │ │ │ │ -
    476 }
    │ │ │ │ -
    │ │ │ │ -
    477
    │ │ │ │ -
    486 template<typename T, typename A, typename A1>
    │ │ │ │ -
    │ │ │ │ -
    487 inline void repairLocalIndexPointers(std::map<int,
    │ │ │ │ -
    488 SLList<std::pair<typename T::GlobalIndex,
    │ │ │ │ -
    489 typename T::LocalIndex::Attribute>,A> >& globalMap,
    │ │ │ │ -
    490 RemoteIndices<T,A1>& remoteIndices,
    │ │ │ │ -
    491 const T& indexSet)
    │ │ │ │ -
    492 {
    │ │ │ │ -
    493 assert(globalMap.size()==static_cast<std::size_t>(remoteIndices.neighbours()));
    │ │ │ │ -
    494 // Repair pointers to index set in remote indices.
    │ │ │ │ -
    495 auto global = globalMap.begin();
    │ │ │ │ -
    496 auto end = remoteIndices.remoteIndices_.end();
    │ │ │ │ -
    497
    │ │ │ │ -
    498 for(auto remote = remoteIndices.remoteIndices_.begin(); remote != end; ++remote, ++global) {
    │ │ │ │ -
    499 assert(remote->first==global->first);
    │ │ │ │ -
    500 assert(remote->second.first->size() == global->second.size());
    │ │ │ │ -
    501
    │ │ │ │ -
    502 auto riEnd = remote->second.first->end();
    │ │ │ │ -
    503 auto rIndex = remote->second.first->begin();
    │ │ │ │ -
    504 auto gIndex = global->second.begin();
    │ │ │ │ -
    505 auto index = indexSet.begin();
    │ │ │ │ -
    506
    │ │ │ │ -
    507 assert(rIndex==riEnd || gIndex != global->second.end());
    │ │ │ │ -
    508 while(rIndex != riEnd) {
    │ │ │ │ -
    509 // Search for the index in the set.
    │ │ │ │ -
    510 assert(gIndex != global->second.end());
    │ │ │ │ -
    511
    │ │ │ │ -
    512 while(!(index->global() == gIndex->first
    │ │ │ │ -
    513 && index->local().attribute() == gIndex->second)) {
    │ │ │ │ -
    514 ++index;
    │ │ │ │ -
    515 // this is only needed for ALU, where there may exist
    │ │ │ │ -
    516 // more entries with the same global index in the remote index set
    │ │ │ │ -
    517 // than in the index set
    │ │ │ │ -
    518 if (index->global() > gIndex->first) {
    │ │ │ │ -
    519 index=indexSet.begin();
    │ │ │ │ -
    520 }
    │ │ │ │ -
    521 }
    │ │ │ │ -
    522
    │ │ │ │ -
    523 assert(index != indexSet.end() && *index == *gIndex);
    │ │ │ │ -
    524
    │ │ │ │ -
    525 rIndex->localIndex_ = &(*index);
    │ │ │ │ -
    526 ++index;
    │ │ │ │ -
    527 ++rIndex;
    │ │ │ │ -
    528 ++gIndex;
    │ │ │ │ -
    529 }
    │ │ │ │ -
    530 }
    │ │ │ │ -
    531 remoteIndices.sourceSeqNo_ = remoteIndices.source_->seqNo();
    │ │ │ │ -
    532 remoteIndices.destSeqNo_ = remoteIndices.target_->seqNo();
    │ │ │ │ -
    533 }
    │ │ │ │ -
    │ │ │ │ -
    534
    │ │ │ │ -
    535 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    537 RemoteIndices& remoteIndices)
    │ │ │ │ -
    538 : indexSet_(indexSet), remoteIndices_(remoteIndices)
    │ │ │ │ -
    539 {
    │ │ │ │ -
    540 // index sets must match.
    │ │ │ │ -
    541 assert(remoteIndices.source_ == remoteIndices.target_);
    │ │ │ │ -
    542 assert(remoteIndices.source_ == &indexSet);
    │ │ │ │ -
    543 MPI_Comm_rank(remoteIndices_.communicator(), &rank_);
    │ │ │ │ -
    544 }
    │ │ │ │ -
    │ │ │ │ -
    545
    │ │ │ │ -
    546 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    548 GlobalIndexList& globalIndices,
    │ │ │ │ -
    549 BoolList& booleans)
    │ │ │ │ -
    550 : iterators_(remoteIndices.beginModify(), globalIndices.beginModify(),
    │ │ │ │ -
    551 booleans.beginModify(), remoteIndices.end())
    │ │ │ │ -
    552 { }
    │ │ │ │ -
    │ │ │ │ -
    553
    │ │ │ │ -
    554 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    556 : iterators_()
    │ │ │ │ -
    557 {}
    │ │ │ │ -
    │ │ │ │ -
    558
    │ │ │ │ -
    559 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    561 {
    │ │ │ │ -
    562 ++(std::get<0>(iterators_));
    │ │ │ │ -
    563 ++(std::get<1>(iterators_));
    │ │ │ │ -
    564 ++(std::get<2>(iterators_));
    │ │ │ │ -
    565 return *this;
    │ │ │ │ -
    566 }
    │ │ │ │ -
    │ │ │ │ -
    567
    │ │ │ │ -
    568 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    570 const std::pair<GlobalIndex,Attribute>& global)
    │ │ │ │ -
    571 {
    │ │ │ │ -
    572 std::get<0>(iterators_).insert(index);
    │ │ │ │ -
    573 std::get<1>(iterators_).insert(global);
    │ │ │ │ -
    574 std::get<2>(iterators_).insert(false);
    │ │ │ │ -
    575 }
    │ │ │ │ -
    │ │ │ │ -
    576
    │ │ │ │ -
    577 template<typename T>
    │ │ │ │ -
    578 inline typename IndicesSyncer<T>::RemoteIndex&
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    580 {
    │ │ │ │ -
    581 return *(std::get<0>(iterators_));
    │ │ │ │ -
    582 }
    │ │ │ │ -
    │ │ │ │ -
    583
    │ │ │ │ -
    584 template<typename T>
    │ │ │ │ -
    585 inline std::pair<typename IndicesSyncer<T>::GlobalIndex,typename IndicesSyncer<T>::Attribute>&
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    587 {
    │ │ │ │ -
    588 return *(std::get<1>(iterators_));
    │ │ │ │ -
    589 }
    │ │ │ │ -
    │ │ │ │ -
    590
    │ │ │ │ -
    591 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    593 {
    │ │ │ │ -
    594 return *(std::get<2>(iterators_));
    │ │ │ │ -
    595 }
    │ │ │ │ -
    │ │ │ │ -
    596
    │ │ │ │ -
    597 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    599 GlobalIndexList& globalIndices,
    │ │ │ │ -
    600 BoolList& booleans)
    │ │ │ │ -
    601 {
    │ │ │ │ -
    602 std::get<0>(iterators_) = remoteIndices.beginModify();
    │ │ │ │ -
    603 std::get<1>(iterators_) = globalIndices.beginModify();
    │ │ │ │ -
    604 std::get<2>(iterators_) = booleans.beginModify();
    │ │ │ │ -
    605 }
    │ │ │ │ -
    │ │ │ │ -
    606
    │ │ │ │ -
    607 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    609 {
    │ │ │ │ -
    610 return std::get<0>(iterators_) != std::get<3>(iterators_);
    │ │ │ │ -
    611 }
    │ │ │ │ -
    │ │ │ │ -
    612
    │ │ │ │ -
    613 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    615 {
    │ │ │ │ -
    616 return std::get<0>(iterators_) == std::get<3>(iterators_);
    │ │ │ │ -
    617 }
    │ │ │ │ -
    │ │ │ │ -
    618
    │ │ │ │ -
    619 template<typename T>
    │ │ │ │ - │ │ │ │ -
    621 {
    │ │ │ │ -
    622 MPI_Datatype type[2] = {MPI_INT, MPI_INT};
    │ │ │ │ -
    623 int blocklength[2] = {1,1};
    │ │ │ │ -
    624 MPI_Aint displacement[2];
    │ │ │ │ -
    625 MPI_Aint base;
    │ │ │ │ -
    626
    │ │ │ │ -
    627 // Compute displacement
    │ │ │ │ -
    628 MessageInformation message;
    │ │ │ │ -
    629
    │ │ │ │ -
    630 MPI_Get_address( &(message.publish), displacement);
    │ │ │ │ -
    631 MPI_Get_address( &(message.pairs), displacement+1);
    │ │ │ │ -
    632
    │ │ │ │ -
    633 // Make the displacement relative
    │ │ │ │ -
    634 MPI_Get_address(&message, &base);
    │ │ │ │ -
    635 displacement[0] -= base;
    │ │ │ │ -
    636 displacement[1] -= base;
    │ │ │ │ -
    637
    │ │ │ │ -
    638 MPI_Type_create_struct( 2, blocklength, displacement, type, &datatype_);
    │ │ │ │ -
    639 MPI_Type_commit(&datatype_);
    │ │ │ │ -
    640 }
    │ │ │ │ -
    641
    │ │ │ │ -
    642 template<typename T>
    │ │ │ │ -
    643 void IndicesSyncer<T>::calculateMessageSizes()
    │ │ │ │ -
    644 {
    │ │ │ │ -
    645 auto iEnd = indexSet_.end();
    │ │ │ │ -
    646 auto collIter = remoteIndices_.template iterator<true>();
    │ │ │ │ -
    647
    │ │ │ │ -
    648 for(auto index = indexSet_.begin(); index != iEnd; ++index) {
    │ │ │ │ -
    649 collIter.advance(index->global(), index->local().attribute());
    │ │ │ │ -
    650 if(collIter.empty())
    │ │ │ │ -
    651 break;
    │ │ │ │ -
    652 int knownRemote=0;
    │ │ │ │ -
    653 auto end = collIter.end();
    │ │ │ │ -
    654
    │ │ │ │ -
    655 // Count the remote indices we know.
    │ │ │ │ -
    656 for(auto valid = collIter.begin(); valid != end; ++valid) {
    │ │ │ │ -
    657 ++knownRemote;
    │ │ │ │ -
    658 }
    │ │ │ │ -
    659
    │ │ │ │ -
    660 if(knownRemote>0) {
    │ │ │ │ -
    661 Dune::dverb<<rank_<<": publishing "<<knownRemote<<" for index "<<index->global()<< " for processes ";
    │ │ │ │ -
    662
    │ │ │ │ -
    663 // Update MessageInformation
    │ │ │ │ -
    664 for(auto valid = collIter.begin(); valid != end; ++valid) {
    │ │ │ │ -
    665 ++(infoSend_[valid.process()].publish);
    │ │ │ │ -
    666 (infoSend_[valid.process()].pairs) += knownRemote;
    │ │ │ │ -
    667 Dune::dverb<<valid.process()<<" ";
    │ │ │ │ -
    668 Dune::dverb<<"(publish="<<infoSend_[valid.process()].publish<<", pairs="<<infoSend_[valid.process()].pairs
    │ │ │ │ -
    669 <<") ";
    │ │ │ │ -
    670 }
    │ │ │ │ -
    671 Dune::dverb<<std::endl;
    │ │ │ │ -
    672 }
    │ │ │ │ -
    673 }
    │ │ │ │ -
    674
    │ │ │ │ -
    675 const auto end = infoSend_.end();
    │ │ │ │ -
    676
    │ │ │ │ -
    677 // Now determine the buffersizes needed for each neighbour using MPI_Pack_size
    │ │ │ │ -
    678 MessageInformation dummy;
    │ │ │ │ -
    679
    │ │ │ │ -
    680 auto messageIter= infoSend_.begin();
    │ │ │ │ -
    681 const auto rend = remoteIndices_.end();
    │ │ │ │ -
    682 int neighbour=0;
    │ │ │ │ -
    683
    │ │ │ │ -
    684 for(auto remote = remoteIndices_.begin(); remote != rend; ++remote, ++neighbour) {
    │ │ │ │ -
    685 MessageInformation* message;
    │ │ │ │ -
    686 MessageInformation recv;
    │ │ │ │ -
    687
    │ │ │ │ -
    688 if(messageIter != end && messageIter->first==remote->first) {
    │ │ │ │ -
    689 // We want to send message information to that process
    │ │ │ │ -
    690 message = const_cast<MessageInformation*>(&(messageIter->second));
    │ │ │ │ -
    691 ++messageIter;
    │ │ │ │ -
    692 }else
    │ │ │ │ -
    693 // We do not want to send information but the other process might.
    │ │ │ │ -
    694 message = &dummy;
    │ │ │ │ -
    695
    │ │ │ │ -
    696 sendBufferSizes_[neighbour]=0;
    │ │ │ │ -
    697 int tsize;
    │ │ │ │ -
    698 // The number of indices published
    │ │ │ │ -
    699 MPI_Pack_size(1, MPI_INT,remoteIndices_.communicator(), &tsize);
    │ │ │ │ -
    700 sendBufferSizes_[neighbour] += tsize;
    │ │ │ │ -
    701
    │ │ │ │ -
    702 for(int i=0; i < message->publish; ++i) {
    │ │ │ │ -
    703 // The global index
    │ │ │ │ -
    704 MPI_Pack_size(1, MPITraits<GlobalIndex>::getType(), remoteIndices_.communicator(), &tsize);
    │ │ │ │ -
    705 sendBufferSizes_[neighbour] += tsize;
    │ │ │ │ -
    706 // The attribute in the local index
    │ │ │ │ -
    707 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);
    │ │ │ │ -
    708 sendBufferSizes_[neighbour] += tsize;
    │ │ │ │ -
    709 // The number of corresponding remote indices
    │ │ │ │ -
    710 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);
    │ │ │ │ -
    711 sendBufferSizes_[neighbour] += tsize;
    │ │ │ │ -
    712 }
    │ │ │ │ -
    713 for(int i=0; i < message->pairs; ++i) {
    │ │ │ │ -
    714 // The process of the remote index
    │ │ │ │ -
    715 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);
    │ │ │ │ -
    716 sendBufferSizes_[neighbour] += tsize;
    │ │ │ │ -
    717 // The attribute of the remote index
    │ │ │ │ -
    718 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);
    │ │ │ │ -
    719 sendBufferSizes_[neighbour] += tsize;
    │ │ │ │ -
    720 }
    │ │ │ │ -
    721
    │ │ │ │ -
    722 Dune::dverb<<rank_<<": Buffer (neighbour="<<remote->first<<") size is "<< sendBufferSizes_[neighbour]<<" for publish="<<message->publish<<" pairs="<<message->pairs<<std::endl;
    │ │ │ │ -
    723 }
    │ │ │ │ -
    724
    │ │ │ │ -
    725 }
    │ │ │ │ -
    726
    │ │ │ │ -
    727 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    729 {
    │ │ │ │ -
    730 DefaultNumberer numberer;
    │ │ │ │ -
    731 sync(numberer);
    │ │ │ │ -
    732 }
    │ │ │ │ -
    │ │ │ │ -
    733
    │ │ │ │ -
    734 template<typename T>
    │ │ │ │ -
    735 template<typename T1>
    │ │ │ │ -
    │ │ │ │ -
    736 void IndicesSyncer<T>::sync(T1& numberer)
    │ │ │ │ -
    737 {
    │ │ │ │ -
    738 // The pointers to the local indices in the remote indices
    │ │ │ │ -
    739 // will become invalid due to the resorting of the index set.
    │ │ │ │ -
    740 // Therefore store the corresponding global indices.
    │ │ │ │ -
    741 // Mark all indices as not added
    │ │ │ │ -
    742 const auto end = remoteIndices_.end();
    │ │ │ │ -
    743
    │ │ │ │ -
    744 // Number of neighbours might change during the syncing.
    │ │ │ │ -
    745 // save the old neighbours
    │ │ │ │ -
    746 std::size_t noOldNeighbours = remoteIndices_.neighbours();
    │ │ │ │ -
    747 int* oldNeighbours = new int[noOldNeighbours];
    │ │ │ │ -
    748 sendBufferSizes_ = new std::size_t[noOldNeighbours];
    │ │ │ │ -
    749 std::size_t neighbourI = 0;
    │ │ │ │ -
    750
    │ │ │ │ -
    751 for(auto remote = remoteIndices_.begin(); remote != end; ++remote, ++neighbourI) {
    │ │ │ │ -
    752 oldNeighbours[neighbourI] = remote->first;
    │ │ │ │ -
    753
    │ │ │ │ -
    754 // Make sure we only have one remote index list.
    │ │ │ │ -
    755 assert(remote->second.first==remote->second.second);
    │ │ │ │ -
    756
    │ │ │ │ -
    757 RemoteIndexList& rList = *(remote->second.first);
    │ │ │ │ -
    758
    │ │ │ │ -
    759 // Store the corresponding global indices.
    │ │ │ │ -
    760 GlobalIndexList& global = globalMap_[remote->first];
    │ │ │ │ -
    761 BoolList& added = oldMap_[remote->first];
    │ │ │ │ -
    762 auto riEnd = rList.end();
    │ │ │ │ -
    763
    │ │ │ │ -
    764 for(auto index = rList.begin();
    │ │ │ │ -
    765 index != riEnd; ++index) {
    │ │ │ │ -
    766 global.push_back(std::make_pair(index->localIndexPair().global(),
    │ │ │ │ -
    767 index->localIndexPair().local().attribute()));
    │ │ │ │ -
    768 added.push_back(true);
    │ │ │ │ -
    769 }
    │ │ │ │ -
    770
    │ │ │ │ -
    771 Iterators iterators(rList, global, added);
    │ │ │ │ -
    772 iteratorsMap_.insert(std::make_pair(remote->first, iterators));
    │ │ │ │ -
    773 assert(checkReset(iteratorsMap_[remote->first], rList,global,added));
    │ │ │ │ -
    774 }
    │ │ │ │ -
    775
    │ │ │ │ -
    776 // Exchange indices with each neighbour
    │ │ │ │ -
    777 calculateMessageSizes();
    │ │ │ │ -
    778
    │ │ │ │ -
    779 // Allocate the buffers
    │ │ │ │ -
    780 receiveBufferSize_=1;
    │ │ │ │ -
    781 sendBuffers_ = new char*[noOldNeighbours];
    │ │ │ │ -
    782
    │ │ │ │ -
    783 for(std::size_t i=0; i<noOldNeighbours; ++i) {
    │ │ │ │ -
    784 sendBuffers_[i] = new char[sendBufferSizes_[i]];
    │ │ │ │ -
    785 receiveBufferSize_ = std::max(receiveBufferSize_, static_cast<int>(sendBufferSizes_[i]));
    │ │ │ │ -
    786 }
    │ │ │ │ -
    787
    │ │ │ │ -
    788 receiveBuffer_=new char[receiveBufferSize_];
    │ │ │ │ -
    789
    │ │ │ │ -
    790 indexSet_.beginResize();
    │ │ │ │ -
    791
    │ │ │ │ -
    792 Dune::dverb<<rank_<<": Neighbours: ";
    │ │ │ │ -
    793
    │ │ │ │ -
    794 for(std::size_t i = 0; i<noOldNeighbours; ++i)
    │ │ │ │ -
    795 Dune::dverb<<oldNeighbours[i]<<" ";
    │ │ │ │ -
    796
    │ │ │ │ -
    797 Dune::dverb<<std::endl;
    │ │ │ │ -
    798
    │ │ │ │ -
    799 MPI_Request* requests = new MPI_Request[noOldNeighbours];
    │ │ │ │ -
    800 MPI_Status* statuses = new MPI_Status[noOldNeighbours];
    │ │ │ │ -
    801
    │ │ │ │ -
    802 // Pack Message data and start the sends
    │ │ │ │ -
    803 for(std::size_t i = 0; i<noOldNeighbours; ++i)
    │ │ │ │ -
    804 packAndSend(oldNeighbours[i], sendBuffers_[i], sendBufferSizes_[i], requests[i]);
    │ │ │ │ -
    805
    │ │ │ │ -
    806 // Probe for incoming messages, receive and unpack them
    │ │ │ │ -
    807 for(std::size_t i = 0; i<noOldNeighbours; ++i)
    │ │ │ │ -
    808 recvAndUnpack(numberer);
    │ │ │ │ -
    809 // }else{
    │ │ │ │ -
    810 // recvAndUnpack(oldNeighbours[i], numberer);
    │ │ │ │ -
    811 // packAndSend(oldNeighbours[i]);
    │ │ │ │ -
    812 // }
    │ │ │ │ -
    813 // }
    │ │ │ │ -
    814
    │ │ │ │ -
    815 delete[] receiveBuffer_;
    │ │ │ │ -
    816
    │ │ │ │ -
    817 // Wait for the completion of the sends
    │ │ │ │ -
    818 // Wait for completion of sends
    │ │ │ │ -
    819 if(MPI_SUCCESS!=MPI_Waitall(noOldNeighbours, requests, statuses)) {
    │ │ │ │ -
    820 std::cerr<<": MPI_Error occurred while sending message"<<std::endl;
    │ │ │ │ -
    821 for(std::size_t i=0; i< noOldNeighbours; i++)
    │ │ │ │ -
    822 if(MPI_SUCCESS!=statuses[i].MPI_ERROR)
    │ │ │ │ -
    823 std::cerr<<"Destination "<<statuses[i].MPI_SOURCE<<" error code: "<<statuses[i].MPI_ERROR<<std::endl;
    │ │ │ │ -
    824 }
    │ │ │ │ -
    825
    │ │ │ │ -
    826 delete[] statuses;
    │ │ │ │ -
    827 delete[] requests;
    │ │ │ │ -
    828
    │ │ │ │ -
    829 for(std::size_t i=0; i<noOldNeighbours; ++i)
    │ │ │ │ -
    830 delete[] sendBuffers_[i];
    │ │ │ │ -
    831
    │ │ │ │ -
    832 delete[] sendBuffers_;
    │ │ │ │ -
    833 delete[] sendBufferSizes_;
    │ │ │ │ -
    834
    │ │ │ │ -
    835 // No need for the iterator tuples any more
    │ │ │ │ -
    836 iteratorsMap_.clear();
    │ │ │ │ -
    837
    │ │ │ │ -
    838 indexSet_.endResize();
    │ │ │ │ -
    839
    │ │ │ │ -
    840 delete[] oldNeighbours;
    │ │ │ │ -
    841
    │ │ │ │ -
    842 repairLocalIndexPointers(globalMap_, remoteIndices_, indexSet_);
    │ │ │ │ -
    843
    │ │ │ │ -
    844 oldMap_.clear();
    │ │ │ │ -
    845 globalMap_.clear();
    │ │ │ │ -
    846
    │ │ │ │ -
    847 // update the sequence number
    │ │ │ │ -
    848 remoteIndices_.sourceSeqNo_ = remoteIndices_.destSeqNo_ = indexSet_.seqNo();
    │ │ │ │ -
    849 }
    │ │ │ │ -
    │ │ │ │ -
    850
    │ │ │ │ -
    851 template<typename T>
    │ │ │ │ -
    852 void IndicesSyncer<T>::packAndSend(int destination, char* buffer, std::size_t bufferSize, MPI_Request& request)
    │ │ │ │ -
    853 {
    │ │ │ │ -
    854 auto iEnd = indexSet_.end();
    │ │ │ │ -
    855 int bpos = 0;
    │ │ │ │ -
    856 int published = 0;
    │ │ │ │ -
    857 int pairs = 0;
    │ │ │ │ -
    858
    │ │ │ │ -
    859 assert(checkReset());
    │ │ │ │ -
    860
    │ │ │ │ -
    861 // Pack the number of indices we publish
    │ │ │ │ -
    862 MPI_Pack(&(infoSend_[destination].publish), 1, MPI_INT, buffer, bufferSize, &bpos,
    │ │ │ │ -
    863 remoteIndices_.communicator());
    │ │ │ │ -
    864
    │ │ │ │ -
    865 for(auto index = indexSet_.begin(); index != iEnd; ++index) {
    │ │ │ │ -
    866 // Search for corresponding remote indices in all iterator tuples
    │ │ │ │ -
    867 auto iteratorsEnd = iteratorsMap_.end();
    │ │ │ │ -
    868
    │ │ │ │ -
    869 // advance all iterators to a position with global index >= index->global()
    │ │ │ │ -
    870 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators) {
    │ │ │ │ -
    871 while(iterators->second.isNotAtEnd() &&
    │ │ │ │ -
    872 iterators->second.globalIndexPair().first < index->global())
    │ │ │ │ -
    873 ++(iterators->second);
    │ │ │ │ -
    874 assert(!iterators->second.isNotAtEnd() || iterators->second.globalIndexPair().first >= index->global());
    │ │ │ │ -
    875 }
    │ │ │ │ -
    876
    │ │ │ │ -
    877 // Add all remote indices positioned at global which were already present before calling sync
    │ │ │ │ -
    878 // to the message.
    │ │ │ │ -
    879 // Count how many remote indices we will send
    │ │ │ │ -
    880 int indices = 0;
    │ │ │ │ -
    881 bool knownRemote = false; // Is the remote process supposed to know this index?
    │ │ │ │ -
    882
    │ │ │ │ -
    883 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators)
    │ │ │ │ -
    884 {
    │ │ │ │ -
    885 std::pair<GlobalIndex,Attribute> p;
    │ │ │ │ -
    886 if (iterators->second.isNotAtEnd())
    │ │ │ │ -
    887 {
    │ │ │ │ -
    888 p = iterators->second.globalIndexPair();
    │ │ │ │ -
    889 }
    │ │ │ │ -
    890
    │ │ │ │ -
    891 if(iterators->second.isNotAtEnd() && iterators->second.isOld()
    │ │ │ │ -
    892 && iterators->second.globalIndexPair().first == index->global()) {
    │ │ │ │ -
    893 indices++;
    │ │ │ │ -
    894 if(destination == iterators->first)
    │ │ │ │ -
    895 knownRemote = true;
    │ │ │ │ -
    896 }
    │ │ │ │ -
    897 }
    │ │ │ │ -
    898
    │ │ │ │ -
    899 if(!knownRemote)
    │ │ │ │ -
    900 // We do not need to send any indices
    │ │ │ │ -
    901 continue;
    │ │ │ │ -
    902
    │ │ │ │ -
    903 Dune::dverb<<rank_<<": sending "<<indices<<" for index "<<index->global()<<" to "<<destination<<std::endl;
    │ │ │ │ -
    904
    │ │ │ │ -
    905
    │ │ │ │ -
    906 // Pack the global index, the attribute and the number
    │ │ │ │ -
    907 MPI_Pack(const_cast<GlobalIndex*>(&(index->global())), 1, MPITraits<GlobalIndex>::getType(), buffer, bufferSize, &bpos,
    │ │ │ │ -
    908 remoteIndices_.communicator());
    │ │ │ │ -
    909
    │ │ │ │ -
    910 char attr = index->local().attribute();
    │ │ │ │ -
    911 MPI_Pack(&attr, 1, MPI_CHAR, buffer, bufferSize, &bpos,
    │ │ │ │ -
    912 remoteIndices_.communicator());
    │ │ │ │ -
    913
    │ │ │ │ -
    914 // Pack the number of remote indices we send.
    │ │ │ │ -
    915 MPI_Pack(&indices, 1, MPI_INT, buffer, bufferSize, &bpos,
    │ │ │ │ -
    916 remoteIndices_.communicator());
    │ │ │ │ -
    917
    │ │ │ │ -
    918 // Pack the information about the remote indices
    │ │ │ │ -
    919 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators)
    │ │ │ │ -
    920 if(iterators->second.isNotAtEnd() && iterators->second.isOld()
    │ │ │ │ -
    921 && iterators->second.globalIndexPair().first == index->global()) {
    │ │ │ │ -
    922 int process = iterators->first;
    │ │ │ │ -
    923
    │ │ │ │ -
    924 ++pairs;
    │ │ │ │ -
    925 assert(pairs <= infoSend_[destination].pairs);
    │ │ │ │ -
    926 MPI_Pack(&process, 1, MPI_INT, buffer, bufferSize, &bpos,
    │ │ │ │ -
    927 remoteIndices_.communicator());
    │ │ │ │ -
    928 char attr2 = iterators->second.remoteIndex().attribute();
    │ │ │ │ -
    929
    │ │ │ │ -
    930 MPI_Pack(&attr2, 1, MPI_CHAR, buffer, bufferSize, &bpos,
    │ │ │ │ -
    931 remoteIndices_.communicator());
    │ │ │ │ -
    932 --indices;
    │ │ │ │ -
    933 }
    │ │ │ │ -
    934 assert(indices==0);
    │ │ │ │ -
    935 ++published;
    │ │ │ │ -
    936 Dune::dvverb<<" (publish="<<published<<", pairs="<<pairs<<")"<<std::endl;
    │ │ │ │ -
    937 assert(published <= infoSend_[destination].publish);
    │ │ │ │ -
    938 }
    │ │ │ │ -
    939
    │ │ │ │ -
    940 // Make sure we send all expected entries
    │ │ │ │ -
    941 assert(published == infoSend_[destination].publish);
    │ │ │ │ -
    942 assert(pairs == infoSend_[destination].pairs);
    │ │ │ │ -
    943 resetIteratorsMap();
    │ │ │ │ -
    944
    │ │ │ │ -
    945 Dune::dverb << rank_<<": Sending message of "<<bpos<<" bytes to "<<destination<<std::endl;
    │ │ │ │ -
    946
    │ │ │ │ -
    947 MPI_Issend(buffer, bpos, MPI_PACKED, destination, 345, remoteIndices_.communicator(),&request);
    │ │ │ │ -
    948 }
    │ │ │ │ -
    949
    │ │ │ │ -
    950 template<typename T>
    │ │ │ │ -
    951 inline void IndicesSyncer<T>::insertIntoRemoteIndexList(int process,
    │ │ │ │ -
    952 const std::pair<GlobalIndex,Attribute>& globalPair,
    │ │ │ │ -
    953 char attribute)
    │ │ │ │ -
    954 {
    │ │ │ │ -
    955 Dune::dverb<<"Inserting from "<<process<<" "<<globalPair.first<<", "<<
    │ │ │ │ -
    956 globalPair.second<<" "<<attribute<<std::endl;
    │ │ │ │ -
    957
    │ │ │ │ -
    958 resetIteratorsMap();
    │ │ │ │ -
    959
    │ │ │ │ -
    960 // There might be cases where there no remote indices for that process yet
    │ │ │ │ -
    961 typename IteratorsMap::iterator found = iteratorsMap_.find(process);
    │ │ │ │ -
    962
    │ │ │ │ -
    963 if( found == iteratorsMap_.end() ) {
    │ │ │ │ -
    964 Dune::dverb<<"Discovered new neighbour "<<process<<std::endl;
    │ │ │ │ -
    965 RemoteIndexList* rlist = new RemoteIndexList();
    │ │ │ │ -
    966 remoteIndices_.remoteIndices_.insert(std::make_pair(process,std::make_pair(rlist,rlist)));
    │ │ │ │ -
    967 Iterators iterators = Iterators(*rlist, globalMap_[process], oldMap_[process]);
    │ │ │ │ -
    968 found = iteratorsMap_.insert(std::make_pair(process, iterators)).first;
    │ │ │ │ -
    969 }
    │ │ │ │ -
    970
    │ │ │ │ -
    971 Iterators& iterators = found->second;
    │ │ │ │ -
    972
    │ │ │ │ -
    973 // Search for the remote index
    │ │ │ │ -
    974 while(iterators.isNotAtEnd() && iterators.globalIndexPair() < globalPair) {
    │ │ │ │ -
    975 // Increment all iterators
    │ │ │ │ -
    976 ++iterators;
    │ │ │ │ -
    977
    │ │ │ │ -
    978 }
    │ │ │ │ -
    979
    │ │ │ │ -
    980 if(iterators.isAtEnd() || iterators.globalIndexPair() != globalPair) {
    │ │ │ │ -
    981 // The entry is not yet known
    │ │ │ │ -
    982 // Insert in the list and do not change the first iterator.
    │ │ │ │ -
    983 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);
    │ │ │ │ -
    984 return;
    │ │ │ │ -
    985 }
    │ │ │ │ -
    986
    │ │ │ │ -
    987 // Global indices match
    │ │ │ │ -
    988 bool indexIsThere=false;
    │ │ │ │ -
    989 for(Iterators tmpIterators = iterators;
    │ │ │ │ -
    990 !tmpIterators.isAtEnd() && tmpIterators.globalIndexPair() == globalPair;
    │ │ │ │ -
    991 ++tmpIterators)
    │ │ │ │ -
    992 //entry already exists with the same attribute
    │ │ │ │ -
    993 if(tmpIterators.globalIndexPair().second == attribute) {
    │ │ │ │ -
    994 indexIsThere=true;
    │ │ │ │ -
    995 break;
    │ │ │ │ -
    996 }
    │ │ │ │ -
    997
    │ │ │ │ -
    998 if(!indexIsThere)
    │ │ │ │ -
    999 // The entry is not yet known
    │ │ │ │ -
    1000 // Insert in the list and do not change the first iterator.
    │ │ │ │ -
    1001 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);
    │ │ │ │ -
    1002 }
    │ │ │ │ -
    1003
    │ │ │ │ -
    1004 template<typename T>
    │ │ │ │ -
    1005 template<typename T1>
    │ │ │ │ -
    1006 void IndicesSyncer<T>::recvAndUnpack(T1& numberer)
    │ │ │ │ -
    1007 {
    │ │ │ │ -
    1008 const ParallelIndexSet& constIndexSet = indexSet_;
    │ │ │ │ -
    1009 auto iEnd = constIndexSet.end();
    │ │ │ │ -
    1010 auto index = constIndexSet.begin();
    │ │ │ │ -
    1011 int bpos = 0;
    │ │ │ │ -
    1012 int publish;
    │ │ │ │ -
    1013
    │ │ │ │ -
    1014 assert(checkReset());
    │ │ │ │ -
    1015
    │ │ │ │ -
    1016 MPI_Status status;
    │ │ │ │ -
    1017
    │ │ │ │ -
    1018 // We have to determine the message size and source before the receive
    │ │ │ │ -
    1019 MPI_Probe(MPI_ANY_SOURCE, 345, remoteIndices_.communicator(), &status);
    │ │ │ │ -
    1020
    │ │ │ │ -
    1021 int source=status.MPI_SOURCE;
    │ │ │ │ -
    1022 int count;
    │ │ │ │ -
    1023 MPI_Get_count(&status, MPI_PACKED, &count);
    │ │ │ │ -
    1024
    │ │ │ │ -
    1025 Dune::dvverb<<rank_<<": Receiving message from "<< source<<" with "<<count<<" bytes"<<std::endl;
    │ │ │ │ -
    1026
    │ │ │ │ -
    1027 if(count>receiveBufferSize_) {
    │ │ │ │ -
    1028 receiveBufferSize_=count;
    │ │ │ │ -
    1029 delete[] receiveBuffer_;
    │ │ │ │ -
    1030 receiveBuffer_ = new char[receiveBufferSize_];
    │ │ │ │ -
    1031 }
    │ │ │ │ -
    1032
    │ │ │ │ -
    1033 MPI_Recv(receiveBuffer_, count, MPI_PACKED, source, 345, remoteIndices_.communicator(), &status);
    │ │ │ │ -
    1034
    │ │ │ │ -
    1035 // How many global entries were published?
    │ │ │ │ -
    1036 MPI_Unpack(receiveBuffer_, count, &bpos, &publish, 1, MPI_INT, remoteIndices_.communicator());
    │ │ │ │ -
    1037
    │ │ │ │ -
    1038 // Now unpack the remote indices and add them.
    │ │ │ │ -
    1039 while(publish>0) {
    │ │ │ │ -
    1040
    │ │ │ │ -
    1041 // Unpack information about the local index on the source process
    │ │ │ │ -
    1042 GlobalIndex global; // global index of the current entry
    │ │ │ │ -
    1043 char sourceAttribute; // Attribute on the source process
    │ │ │ │ -
    1044 int pairs;
    │ │ │ │ -
    1045
    │ │ │ │ -
    1046 MPI_Unpack(receiveBuffer_, count, &bpos, &global, 1, MPITraits<GlobalIndex>::getType(),
    │ │ │ │ -
    1047 remoteIndices_.communicator());
    │ │ │ │ -
    1048 MPI_Unpack(receiveBuffer_, count, &bpos, &sourceAttribute, 1, MPI_CHAR,
    │ │ │ │ -
    1049 remoteIndices_.communicator());
    │ │ │ │ -
    1050 MPI_Unpack(receiveBuffer_, count, &bpos, &pairs, 1, MPI_INT,
    │ │ │ │ -
    1051 remoteIndices_.communicator());
    │ │ │ │ -
    1052
    │ │ │ │ -
    1053 // Insert the entry on the remote process to our
    │ │ │ │ -
    1054 // remote index list
    │ │ │ │ -
    1055 SLList<std::pair<int,Attribute> > sourceAttributeList;
    │ │ │ │ -
    1056 sourceAttributeList.push_back(std::make_pair(source,Attribute(sourceAttribute)));
    │ │ │ │ -
    1057#ifndef NDEBUG
    │ │ │ │ -
    1058 bool foundSelf = false;
    │ │ │ │ -
    1059#endif
    │ │ │ │ -
    1060 Attribute myAttribute=Attribute();
    │ │ │ │ -
    1061
    │ │ │ │ -
    1062 // Unpack the remote indices
    │ │ │ │ -
    1063 for(; pairs>0; --pairs) {
    │ │ │ │ -
    1064 // Unpack the process id that knows the index
    │ │ │ │ -
    1065 int process;
    │ │ │ │ -
    1066 char attribute;
    │ │ │ │ -
    1067 MPI_Unpack(receiveBuffer_, count, &bpos, &process, 1, MPI_INT,
    │ │ │ │ -
    1068 remoteIndices_.communicator());
    │ │ │ │ -
    1069 // Unpack the attribute
    │ │ │ │ -
    1070 MPI_Unpack(receiveBuffer_, count, &bpos, &attribute, 1, MPI_CHAR,
    │ │ │ │ -
    1071 remoteIndices_.communicator());
    │ │ │ │ -
    1072
    │ │ │ │ -
    1073 if(process==rank_) {
    │ │ │ │ -
    1074#ifndef NDEBUG
    │ │ │ │ -
    1075 foundSelf=true;
    │ │ │ │ -
    1076#endif
    │ │ │ │ -
    1077 myAttribute=Attribute(attribute);
    │ │ │ │ -
    1078 // Now we know the local attribute of the global index
    │ │ │ │ -
    1079 //Only add the index if it is unknown.
    │ │ │ │ -
    1080 // Do we know that global index already?
    │ │ │ │ -
    1081 auto pos = std::lower_bound(index, iEnd, IndexPair(global));
    │ │ │ │ -
    1082
    │ │ │ │ -
    1083 if(pos == iEnd || pos->global() != global) {
    │ │ │ │ -
    1084 // no entry with this global index
    │ │ │ │ -
    1085 indexSet_.add(global,
    │ │ │ │ -
    1086 ParallelLocalIndex<Attribute>(numberer(global),
    │ │ │ │ -
    1087 myAttribute, true));
    │ │ │ │ -
    1088 Dune::dvverb << "Adding "<<global<<" "<<myAttribute<<std::endl;
    │ │ │ │ -
    1089 continue;
    │ │ │ │ -
    1090 }
    │ │ │ │ -
    1091
    │ │ │ │ -
    1092 // because of above the global indices match. Add only if the attribute is different
    │ │ │ │ -
    1093 bool indexIsThere = false;
    │ │ │ │ -
    1094 index=pos;
    │ │ │ │ -
    1095
    │ │ │ │ -
    1096 for(; pos->global()==global; ++pos)
    │ │ │ │ -
    1097 if(pos->local().attribute() == myAttribute) {
    │ │ │ │ -
    1098 Dune::dvverb<<"found "<<global<<" "<<myAttribute<<std::endl;
    │ │ │ │ -
    1099 indexIsThere = true;
    │ │ │ │ -
    1100 break;
    │ │ │ │ -
    1101 }
    │ │ │ │ -
    1102
    │ │ │ │ -
    1103 if(!indexIsThere) {
    │ │ │ │ -
    1104 indexSet_.add(global,
    │ │ │ │ -
    1105 ParallelLocalIndex<Attribute>(numberer(global),
    │ │ │ │ -
    1106 myAttribute, true));
    │ │ │ │ -
    1107 Dune::dvverb << "Adding "<<global<<" "<<myAttribute<<std::endl;
    │ │ │ │ -
    1108 }
    │ │ │ │ -
    1109
    │ │ │ │ -
    1110 }else{
    │ │ │ │ -
    1111 sourceAttributeList.push_back(std::make_pair(process,Attribute(attribute)));
    │ │ │ │ -
    1112 }
    │ │ │ │ -
    1113 }
    │ │ │ │ -
    1114 assert(foundSelf);
    │ │ │ │ -
    1115 // Insert remote indices
    │ │ │ │ -
    1116 typedef typename SLList<std::pair<int,Attribute> >::const_iterator Iter;
    │ │ │ │ -
    1117 for(Iter i=sourceAttributeList.begin(), end=sourceAttributeList.end();
    │ │ │ │ -
    1118 i!=end; ++i)
    │ │ │ │ -
    1119 insertIntoRemoteIndexList(i->first, std::make_pair(global, myAttribute),
    │ │ │ │ -
    1120 i->second);
    │ │ │ │ -
    1121 --publish;
    │ │ │ │ -
    1122 }
    │ │ │ │ -
    1123
    │ │ │ │ -
    1124 resetIteratorsMap();
    │ │ │ │ -
    1125 }
    │ │ │ │ -
    1126
    │ │ │ │ -
    1127 template<typename T>
    │ │ │ │ -
    1128 void IndicesSyncer<T>::resetIteratorsMap(){
    │ │ │ │ -
    1129
    │ │ │ │ -
    1130 // Reset iterators in all tuples.
    │ │ │ │ -
    1131 const auto remoteEnd = remoteIndices_.remoteIndices_.end();
    │ │ │ │ -
    1132 auto iterators = iteratorsMap_.begin();
    │ │ │ │ -
    1133 auto global = globalMap_.begin();
    │ │ │ │ -
    1134 auto added = oldMap_.begin();
    │ │ │ │ -
    1135
    │ │ │ │ -
    1136 for(auto remote = remoteIndices_.remoteIndices_.begin();
    │ │ │ │ -
    1137 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {
    │ │ │ │ -
    1138 iterators->second.reset(*(remote->second.first), global->second, added->second);
    │ │ │ │ -
    1139 }
    │ │ │ │ -
    1140 }
    │ │ │ │ -
    1141
    │ │ │ │ -
    1142 template<typename T>
    │ │ │ │ -
    1143 bool IndicesSyncer<T>::checkReset(const Iterators& iterators, RemoteIndexList& rList, GlobalIndexList& gList,
    │ │ │ │ -
    1144 BoolList& bList){
    │ │ │ │ -
    1145
    │ │ │ │ -
    1146 if(std::get<0>(iterators.iterators_) != rList.begin())
    │ │ │ │ -
    1147 return false;
    │ │ │ │ -
    1148 if(std::get<1>(iterators.iterators_) != gList.begin())
    │ │ │ │ -
    1149 return false;
    │ │ │ │ -
    1150 if(std::get<2>(iterators.iterators_) != bList.begin())
    │ │ │ │ -
    1151 return false;
    │ │ │ │ -
    1152 return true;
    │ │ │ │ -
    1153 }
    │ │ │ │ -
    1154
    │ │ │ │ -
    1155
    │ │ │ │ -
    1156 template<typename T>
    │ │ │ │ -
    1157 bool IndicesSyncer<T>::checkReset(){
    │ │ │ │ -
    1158
    │ │ │ │ -
    1159 // Reset iterators in all tuples.
    │ │ │ │ -
    1160 const auto remoteEnd = remoteIndices_.remoteIndices_.end();
    │ │ │ │ -
    1161 auto iterators = iteratorsMap_.begin();
    │ │ │ │ -
    1162 auto global = globalMap_.begin();
    │ │ │ │ -
    1163 auto added = oldMap_.begin();
    │ │ │ │ -
    1164 bool ret = true;
    │ │ │ │ -
    1165
    │ │ │ │ -
    1166 for(auto remote = remoteIndices_.remoteIndices_.begin();
    │ │ │ │ -
    1167 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {
    │ │ │ │ -
    1168 if(!checkReset(iterators->second, *(remote->second.first), global->second,
    │ │ │ │ -
    1169 added->second))
    │ │ │ │ -
    1170 ret=false;
    │ │ │ │ -
    1171 }
    │ │ │ │ -
    1172 return ret;
    │ │ │ │ -
    1173 }
    │ │ │ │ -
    1174}
    │ │ │ │ -
    1175
    │ │ │ │ -
    1176#endif
    │ │ │ │ -
    1177#endif
    │ │ │ │ -
    Provides a map between global and local indices.
    │ │ │ │ -
    Classes describing a distributed indexset.
    │ │ │ │ -
    Implements a singly linked list together with the necessary iterators.
    │ │ │ │ -
    Standard Dune debug streams.
    │ │ │ │ -
    void push_back(const MemberType &item)
    Add a new entry to the end of the list.
    Definition sllist.hh:643
    │ │ │ │ -
    SLListIterator< T, A > iterator
    The mutable iterator of the list.
    Definition sllist.hh:69
    │ │ │ │ -
    iterator end()
    Get an iterator pointing to the end of the list.
    Definition sllist.hh:774
    │ │ │ │ -
    ModifyIterator beginModify()
    Get an iterator capable of deleting and inserting elements.
    Definition sllist.hh:787
    │ │ │ │ -
    SLListConstIterator< RemoteIndex, Allocator > const_iterator
    The constant iterator of the list.
    Definition sllist.hh:74
    │ │ │ │ -
    SLListModifyIterator< T, A > ModifyIterator
    The type of the iterator capable of deletion and insertion.
    Definition sllist.hh:103
    │ │ │ │ -
    iterator begin()
    Get an iterator pointing to the first element in the list.
    Definition sllist.hh:762
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition iteratorfacades.hh:637
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition iteratorfacades.hh:237
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition iteratorfacades.hh:259
    │ │ │ │ -
    Iterators()
    Default constructor.
    Definition indicessyncer.hh:555
    │ │ │ │ -
    Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
    Type of the remote indices.
    Definition indicessyncer.hh:59
    │ │ │ │ -
    bool isOld() const
    Was this entry already in the remote index list before the sync process?
    Definition indicessyncer.hh:592
    │ │ │ │ -
    int publish
    The number of indices we publish for the other process.
    Definition indicessyncer.hh:126
    │ │ │ │ -
    void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, RemoteIndices< T, A1 > &remoteIndices, const T &indexSet)
    Repair the pointers to the local indices in the remote indices.
    Definition indicessyncer.hh:487
    │ │ │ │ -
    bool isAtEnd() const
    Are we at the end of the list?
    Definition indicessyncer.hh:614
    │ │ │ │ -
    ParallelIndexSet::GlobalIndex GlobalIndex
    Type of the global index used in the index set.
    Definition indicessyncer.hh:51
    │ │ │ │ -
    int pairs
    The number of pairs (attribute and process number) we publish to the neighbour process.
    Definition indicessyncer.hh:131
    │ │ │ │ -
    Attribute & attribute() const
    │ │ │ │ -
    Iterators & operator++()
    Increment all iteraors.
    Definition indicessyncer.hh:560
    │ │ │ │ -
    ParallelIndexSet::LocalIndex::Attribute Attribute
    Type of the attribute used in the index set.
    Definition indicessyncer.hh:54
    │ │ │ │ -
    std::pair< GlobalIndex, Attribute > & globalIndexPair() const
    Get the global index of the remote index at current position.
    Definition indicessyncer.hh:586
    │ │ │ │ -
    IndicesSyncer(ParallelIndexSet &indexSet, RemoteIndices &remoteIndices)
    Constructor.
    Definition indicessyncer.hh:536
    │ │ │ │ -
    void reset(RemoteIndexList &remoteIndices, GlobalIndexList &globalIndices, BoolList &booleans)
    Reset all the underlying iterators.
    Definition indicessyncer.hh:598
    │ │ │ │ -
    std::size_t operator()(const GlobalIndex &global)
    Provide the local index, always std::numeric_limits<size_t>::max()
    Definition indicessyncer.hh:145
    │ │ │ │ -
    T ParallelIndexSet
    The type of the index set.
    Definition indicessyncer.hh:45
    │ │ │ │ -
    bool isNotAtEnd() const
    Are we not at the end of the list?
    Definition indicessyncer.hh:608
    │ │ │ │ -
    TG GlobalIndex
    the type of the global index. This type has to provide at least a operator< for sorting.
    Definition indexset.hh:226
    │ │ │ │ -
    void storeGlobalIndicesOfRemoteIndices(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, const RemoteIndices< T, A1 > &remoteIndices)
    Stores the corresponding global indices of the remote index information.
    Definition indicessyncer.hh:461
    │ │ │ │ -
    void sync()
    Sync the index set.
    Definition indicessyncer.hh:728
    │ │ │ │ -
    int seqNo() const
    Get the internal sequence number.
    │ │ │ │ -
    ParallelIndexSet::IndexPair IndexPair
    The type of the index pair.
    Definition indicessyncer.hh:48
    │ │ │ │ -
    RemoteIndex & remoteIndex() const
    Get the remote index at current position.
    Definition indicessyncer.hh:579
    │ │ │ │ -
    MessageInformation()
    Definition indicessyncer.hh:122
    │ │ │ │ -
    void insert(const RemoteIndex &index, const std::pair< GlobalIndex, Attribute > &global)
    Insert a new remote index to the underlying remote index list.
    Definition indicessyncer.hh:569
    │ │ │ │ -
    DVVerbType dvverb(std::cout)
    stream for very verbose output.
    Definition stdstreams.hh:95
    │ │ │ │ -
    DVerbType dverb(std::cout)
    Singleton of verbose debug stream.
    Definition stdstreams.hh:116
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_STD_MAKE_ARRAY_HH
    │ │ │ │ +
    4#define DUNE_COMMON_STD_MAKE_ARRAY_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    6#include <array>
    │ │ │ │ +
    7#include <type_traits>
    │ │ │ │ +
    8
    │ │ │ │ +
    9#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    │ │ │ │ +
    10#include <experimental/array>
    │ │ │ │ +
    11#endif
    │ │ │ │ +
    12
    │ │ │ │ +
    13#warning make_array.hh is deprecated and will be removed after Dune 2.9. \
    │ │ │ │ +
    14 Use deduction guide of `std::array` or `std::to_array`.
    │ │ │ │ +
    15
    │ │ │ │ +
    16namespace Dune {
    │ │ │ │ +
    17namespace Std {
    │ │ │ │ +
    18
    │ │ │ │ +
    19#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    │ │ │ │ +
    20
    │ │ │ │ +
    22 using std::experimental::make_array;
    │ │ │ │ +
    23
    │ │ │ │ +
    24#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    │ │ │ │ +
    25
    │ │ │ │ +
    27
    │ │ │ │ +
    41 template <typename... Args>
    │ │ │ │ +
    42 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
    │ │ │ │ +
    │ │ │ │ +
    43 make_array(const Args&... args) {
    │ │ │ │ +
    44 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
    │ │ │ │ +
    45 result = {{args...}};
    │ │ │ │ +
    46 return result;
    │ │ │ │ +
    47 }
    │ │ │ │ +
    │ │ │ │ +
    48
    │ │ │ │ +
    49#endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    │ │ │ │ +
    50
    │ │ │ │ +
    51}
    │ │ │ │ +
    52}
    │ │ │ │ +
    53
    │ │ │ │ +
    54#endif
    │ │ │ │ +
    std::array< typename std::common_type< Args... >::type, sizeof...(Args)> make_array(const Args &... args)
    Create and initialize an array.
    Definition make_array.hh:43
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    static MPI_Datatype getType()
    Definition mpitraits.hh:48
    │ │ │ │ -
    A pair consisting of a global and local index.
    Definition indexset.hh:85
    │ │ │ │ -
    Class for recomputing missing indices of a distributed index set.
    Definition indicessyncer.hh:41
    │ │ │ │ -
    An index present on the local process with an additional attribute flag.
    Definition plocalindex.hh:49
    │ │ │ │ -
    The indices present on remote processes.
    Definition remoteindices.hh:189
    │ │ │ │ -
    MPI_Comm communicator() const
    Get the mpi communicator used.
    Definition remoteindices.hh:1696
    │ │ │ │ -
    const_iterator end() const
    Get an iterator over all remote index lists.
    Definition remoteindices.hh:1529
    │ │ │ │ -
    int neighbours() const
    Get the number of processors we share indices with.
    Definition remoteindices.hh:1446
    │ │ │ │ -
    typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > Allocator
    The type of the allocator for the remote index list.
    Definition remoteindices.hh:237
    │ │ │ │ -
    const_iterator begin() const
    Get an iterator over all remote index lists.
    Definition remoteindices.hh:1522
    │ │ │ │ -
    Information about an index residing on another processor.
    Definition remoteindices.hh:73
    │ │ │ │ -
    A mutable iterator for the SLList.
    Definition sllist.hh:271
    │ │ │ │ -
    A single linked list.
    Definition sllist.hh:44
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1204 +1,59 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -indicessyncer.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +make_array.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_INDICESSYNCER_HH │ │ │ │ │ -6#define DUNE_INDICESSYNCER_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ -9#include "_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h" │ │ │ │ │ -10#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ -11#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_l_l_i_s_t_._h_h> │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20#if HAVE_MPI │ │ │ │ │ -21namespace _D_u_n_e │ │ │ │ │ -22{ │ │ │ │ │ -39 template │ │ │ │ │ -_4_0 class _I_n_d_i_c_e_s_S_y_n_c_e_r │ │ │ │ │ -41 { │ │ │ │ │ -42 public: │ │ │ │ │ -43 │ │ │ │ │ -_4_5 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -46 │ │ │ │ │ -_4_8 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_I_n_d_e_x_P_a_i_r _I_n_d_e_x_P_a_i_r; │ │ │ │ │ -49 │ │ │ │ │ -_5_1 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -52 │ │ │ │ │ -_5_4 typedef typename ParallelIndexSet::LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ │ -55 │ │ │ │ │ -_5_9 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_<_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_> _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ -60 │ │ │ │ │ -70 _I_n_d_i_c_e_s_S_y_n_c_e_r(_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ -71 _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices); │ │ │ │ │ -72 │ │ │ │ │ -82 void _s_y_n_c(); │ │ │ │ │ -83 │ │ │ │ │ -94 template │ │ │ │ │ -95 void _s_y_n_c(T1& numberer); │ │ │ │ │ -96 │ │ │ │ │ -97 private: │ │ │ │ │ -98 │ │ │ │ │ -100 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet_; │ │ │ │ │ -101 │ │ │ │ │ -103 _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices_; │ │ │ │ │ -104 │ │ │ │ │ -106 char** sendBuffers_; │ │ │ │ │ -107 │ │ │ │ │ -109 char* receiveBuffer_; │ │ │ │ │ -110 │ │ │ │ │ -112 std::size_t* sendBufferSizes_; │ │ │ │ │ -113 │ │ │ │ │ -115 int receiveBufferSize_; // int because of MPI │ │ │ │ │ -116 │ │ │ │ │ -120 struct MessageInformation │ │ │ │ │ -121 { │ │ │ │ │ -_1_2_2 _M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n() │ │ │ │ │ -123 : _p_u_b_l_i_s_h(), _p_a_i_r_s() │ │ │ │ │ -124 {} │ │ │ │ │ -_1_2_6 int _p_u_b_l_i_s_h; │ │ │ │ │ -_1_3_1 int _p_a_i_r_s; │ │ │ │ │ -132 }; │ │ │ │ │ -133 │ │ │ │ │ -137 class DefaultNumberer │ │ │ │ │ -138 { │ │ │ │ │ -139 public: │ │ │ │ │ -_1_4_5 std::size_t _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const _G_l_o_b_a_l_I_n_d_e_x& global) │ │ │ │ │ -146 { │ │ │ │ │ -147 return std::numeric_limits::max(); │ │ │ │ │ -148 } │ │ │ │ │ -149 }; │ │ │ │ │ -150 │ │ │ │ │ -152 MPI_Datatype datatype_; │ │ │ │ │ -153 │ │ │ │ │ -155 int rank_; │ │ │ │ │ -156 │ │ │ │ │ -161 typedef _S_L_L_i_s_t_<_s_t_d_:_:_p_a_i_r_<_G_l_o_b_a_l_I_n_d_e_x_,_A_t_t_r_i_b_u_t_e_>, typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_: │ │ │ │ │ -_A_l_l_o_c_a_t_o_r> GlobalIndexList; │ │ │ │ │ -162 │ │ │ │ │ -164 typedef typename _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r GlobalIndexModifier; │ │ │ │ │ -165 │ │ │ │ │ -169 typedef typename _S_L_L_i_s_t_<_G_l_o_b_a_l_I_n_d_e_x_,_ _t_y_p_e_n_a_m_e_ _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_l_l_o_c_a_t_o_r_>_:_: │ │ │ │ │ -_i_t_e_r_a_t_o_r │ │ │ │ │ -170 GlobalIndexIterator; │ │ │ │ │ -171 │ │ │ │ │ -173 typedef std::map GlobalIndicesMap; │ │ │ │ │ -174 │ │ │ │ │ -183 GlobalIndicesMap globalMap_; │ │ │ │ │ -184 │ │ │ │ │ -188 typedef _S_L_L_i_s_t_<_b_o_o_l_,_ _t_y_p_e_n_a_m_e_ _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_l_l_o_c_a_t_o_r_> BoolList; │ │ │ │ │ -189 │ │ │ │ │ -193 typedef typename _B_o_o_l_L_i_s_t_:_:_i_t_e_r_a_t_o_r BoolIterator; │ │ │ │ │ -194 │ │ │ │ │ -196 typedef typename _B_o_o_l_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r BoolListModifier; │ │ │ │ │ -197 │ │ │ │ │ -199 typedef std::map BoolMap; │ │ │ │ │ -200 │ │ │ │ │ -205 BoolMap oldMap_; │ │ │ │ │ -206 │ │ │ │ │ -208 std::map infoSend_; │ │ │ │ │ -209 │ │ │ │ │ -211 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t RemoteIndexList; │ │ │ │ │ -212 │ │ │ │ │ -214 typedef typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r RemoteIndexModifier; │ │ │ │ │ -215 │ │ │ │ │ -217 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x_<_G_l_o_b_a_l_I_n_d_e_x_,_A_t_t_r_i_b_u_t_e_> _R_e_m_o_t_e_I_n_d_e_x; │ │ │ │ │ -218 │ │ │ │ │ -220 typedef typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_i_t_e_r_a_t_o_r RemoteIndexIterator; │ │ │ │ │ -221 │ │ │ │ │ -223 typedef typename _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r ConstRemoteIndexIterator; │ │ │ │ │ -224 │ │ │ │ │ -226 typedef std:: │ │ │ │ │ -tuple IteratorTuple; │ │ │ │ │ -228 │ │ │ │ │ -236 class Iterators │ │ │ │ │ -237 { │ │ │ │ │ -238 friend class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ -239 public: │ │ │ │ │ -249 _I_t_e_r_a_t_o_r_s(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices, │ │ │ │ │ -250 BoolList& booleans); │ │ │ │ │ -251 │ │ │ │ │ -255 _I_t_e_r_a_t_o_r_s(); │ │ │ │ │ -256 │ │ │ │ │ -260 _I_t_e_r_a_t_o_r_s& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ -261 │ │ │ │ │ -267 void _i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x& index, │ │ │ │ │ -268 const std::pair& global); │ │ │ │ │ -269 │ │ │ │ │ -274 _R_e_m_o_t_e_I_n_d_e_x& _r_e_m_o_t_e_I_n_d_e_x() const; │ │ │ │ │ -275 │ │ │ │ │ -280 std::pair& _g_l_o_b_a_l_I_n_d_e_x_P_a_i_r() const; │ │ │ │ │ -281 │ │ │ │ │ -_2_8_2 _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e() const; │ │ │ │ │ -283 │ │ │ │ │ -289 bool _i_s_O_l_d() const; │ │ │ │ │ -290 │ │ │ │ │ -300 void _r_e_s_e_t(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& remoteIndices, _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& globalIndices, │ │ │ │ │ -301 _B_o_o_l_L_i_s_t& booleans); │ │ │ │ │ -302 │ │ │ │ │ -308 bool _i_s_N_o_t_A_t_E_n_d() const; │ │ │ │ │ -309 │ │ │ │ │ -315 bool _i_s_A_t_E_n_d() const; │ │ │ │ │ -316 │ │ │ │ │ -317 private: │ │ │ │ │ -327 IteratorTuple iterators_; │ │ │ │ │ -328 }; │ │ │ │ │ -329 │ │ │ │ │ -331 typedef std::map IteratorsMap; │ │ │ │ │ -332 │ │ │ │ │ -344 IteratorsMap iteratorsMap_; │ │ │ │ │ -345 │ │ │ │ │ -347 void calculateMessageSizes(); │ │ │ │ │ -348 │ │ │ │ │ -356 void packAndSend(int destination, char* buffer, std::size_t bufferSize, │ │ │ │ │ -MPI_Request& req); │ │ │ │ │ -357 │ │ │ │ │ -362 template │ │ │ │ │ -363 void recvAndUnpack(T1& numberer); │ │ │ │ │ -364 │ │ │ │ │ -368 void registerMessageDatatype(); │ │ │ │ │ -369 │ │ │ │ │ -373 void insertIntoRemoteIndexList(int process, │ │ │ │ │ -374 const std::pair& global, │ │ │ │ │ -375 char attribute); │ │ │ │ │ -376 │ │ │ │ │ -380 void resetIteratorsMap(); │ │ │ │ │ -381 │ │ │ │ │ -386 bool checkReset(); │ │ │ │ │ -387 │ │ │ │ │ -396 bool checkReset(const Iterators& iterators, _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& rlist, │ │ │ │ │ -_G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& gList, │ │ │ │ │ -397 _B_o_o_l_L_i_s_t& bList); │ │ │ │ │ -398 }; │ │ │ │ │ -399 │ │ │ │ │ -400 template │ │ │ │ │ -_4_0_1 bool _o_p_e_r_a_t_o_r_<(const _I_n_d_e_x_P_a_i_r >& i1, │ │ │ │ │ -402 const std::pair& i2) │ │ │ │ │ -403 { │ │ │ │ │ -404 return i1.global() < i2.first || │ │ │ │ │ -405 (i1.global() == i2.first && i1.local().attribute() │ │ │ │ │ -_4_0_9 bool _o_p_e_r_a_t_o_r_<(const std::pair& i1, │ │ │ │ │ -410 const _I_n_d_e_x_P_a_i_r >& i2) │ │ │ │ │ -411 { │ │ │ │ │ -412 return i1.first < i2.global() || │ │ │ │ │ -413 (i1.first == i2.global() && i1.second │ │ │ │ │ -_4_1_7 bool _o_p_e_r_a_t_o_r_=_=(const _I_n_d_e_x_P_a_i_r >& i1, │ │ │ │ │ -418 const std::pair& i2) │ │ │ │ │ -419 { │ │ │ │ │ -420 return (i1.global() == i2.first && i1.local().attribute()==i2.second); │ │ │ │ │ -421 } │ │ │ │ │ -422 │ │ │ │ │ -423 template │ │ │ │ │ -_4_2_4 bool _o_p_e_r_a_t_o_r_!_=(const _I_n_d_e_x_P_a_i_r >& i1, │ │ │ │ │ -425 const std::pair& i2) │ │ │ │ │ -426 { │ │ │ │ │ -427 return (i1.global() != i2.first || i1.local().attribute()!=i2.second); │ │ │ │ │ -428 } │ │ │ │ │ -429 │ │ │ │ │ -430 template │ │ │ │ │ -_4_3_1 bool _o_p_e_r_a_t_o_r_=_=(const std::pair& i2, │ │ │ │ │ -432 const _I_n_d_e_x_P_a_i_r >& i1) │ │ │ │ │ -433 { │ │ │ │ │ -434 return (i1.global() == i2.first && i1.local().attribute()==i2.second); │ │ │ │ │ -435 } │ │ │ │ │ -436 │ │ │ │ │ -437 template │ │ │ │ │ -_4_3_8 bool _o_p_e_r_a_t_o_r_!_=(const std::pair& i2, │ │ │ │ │ -439 const _I_n_d_e_x_P_a_i_r >& i1) │ │ │ │ │ -440 { │ │ │ │ │ -441 return (i1.global() != i2.first || i1.local().attribute()!=i2.second); │ │ │ │ │ -442 } │ │ │ │ │ -443 │ │ │ │ │ -460 template │ │ │ │ │ -_4_6_1 void _s_t_o_r_e_G_l_o_b_a_l_I_n_d_i_c_e_s_O_f_R_e_m_o_t_e_I_n_d_i_c_e_s(std::map,A> >& │ │ │ │ │ -globalMap, │ │ │ │ │ -462 const _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>& remoteIndices) │ │ │ │ │ -463 { │ │ │ │ │ -464 for(auto remote = remoteIndices._b_e_g_i_n(), end =remoteIndices._e_n_d(); remote │ │ │ │ │ -!= end; ++remote) { │ │ │ │ │ -465 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>_:_:_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t RemoteIndexList; │ │ │ │ │ -466 typedef _S_L_L_i_s_t_<_s_t_d_:_:_p_a_i_r_<_t_y_p_e_n_a_m_e_ _T_:_:_G_l_o_b_a_l_I_n_d_e_x_,_ _t_y_p_e_n_a_m_e_ _T_:_:_L_o_c_a_l_I_n_d_e_x_:_: │ │ │ │ │ -_A_t_t_r_i_b_u_t_e_>,A> GlobalIndexList; │ │ │ │ │ -467 GlobalIndexList& global = globalMap[remote->first]; │ │ │ │ │ -468 RemoteIndexList& rList = *(remote->second.first); │ │ │ │ │ -469 │ │ │ │ │ -470 for(auto index = rList.begin(), riEnd = rList.end(); │ │ │ │ │ -471 index != riEnd; ++index) { │ │ │ │ │ -472 global._p_u_s_h___b_a_c_k(std::make_pair(index->localIndexPair().global(), │ │ │ │ │ -473 index->localIndexPair().local().attribute())); │ │ │ │ │ -474 } │ │ │ │ │ -475 } │ │ │ │ │ -476 } │ │ │ │ │ -477 │ │ │ │ │ -486 template │ │ │ │ │ -_4_8_7 inline void _r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s(std::map,A> >& globalMap, │ │ │ │ │ -490 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>& remoteIndices, │ │ │ │ │ -491 const T& indexSet) │ │ │ │ │ -492 { │ │ │ │ │ -493 assert(globalMap.size()==static_cast(remoteIndices._n_e_i_g_h_b_o_u_r_s │ │ │ │ │ -())); │ │ │ │ │ -494 // Repair pointers to index set in remote indices. │ │ │ │ │ -495 auto global = globalMap.begin(); │ │ │ │ │ -496 auto end = remoteIndices.remoteIndices_.end(); │ │ │ │ │ -497 │ │ │ │ │ -498 for(auto remote = remoteIndices.remoteIndices_.begin(); remote != end; │ │ │ │ │ -++remote, ++global) { │ │ │ │ │ -499 assert(remote->first==global->first); │ │ │ │ │ -500 assert(remote->second.first->size() == global->second.size()); │ │ │ │ │ -501 │ │ │ │ │ -502 auto riEnd = remote->second.first->end(); │ │ │ │ │ -503 auto rIndex = remote->second.first->begin(); │ │ │ │ │ -504 auto gIndex = global->second.begin(); │ │ │ │ │ -505 auto index = indexSet.begin(); │ │ │ │ │ -506 │ │ │ │ │ -507 assert(rIndex==riEnd || gIndex != global->second.end()); │ │ │ │ │ -508 while(rIndex != riEnd) { │ │ │ │ │ -509 // Search for the index in the set. │ │ │ │ │ -510 assert(gIndex != global->second.end()); │ │ │ │ │ -511 │ │ │ │ │ -512 while(!(index->global() == gIndex->first │ │ │ │ │ -513 && index->local().attribute() == gIndex->second)) { │ │ │ │ │ -514 ++index; │ │ │ │ │ -515 // this is only needed for ALU, where there may exist │ │ │ │ │ -516 // more entries with the same global index in the remote index set │ │ │ │ │ -517 // than in the index set │ │ │ │ │ -518 if (index->global() > gIndex->first) { │ │ │ │ │ -519 index=indexSet.begin(); │ │ │ │ │ -520 } │ │ │ │ │ -521 } │ │ │ │ │ -522 │ │ │ │ │ -523 assert(index != indexSet.end() && *index == *gIndex); │ │ │ │ │ -524 │ │ │ │ │ -525 rIndex->localIndex_ = &(*index); │ │ │ │ │ -526 ++index; │ │ │ │ │ -527 ++rIndex; │ │ │ │ │ -528 ++gIndex; │ │ │ │ │ -529 } │ │ │ │ │ -530 } │ │ │ │ │ -531 remoteIndices.sourceSeqNo_ = remoteIndices.source_->_s_e_q_N_o(); │ │ │ │ │ -532 remoteIndices.destSeqNo_ = remoteIndices.target_->_s_e_q_N_o(); │ │ │ │ │ -533 } │ │ │ │ │ -534 │ │ │ │ │ -535 template │ │ │ │ │ -_5_3_6 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r(_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ -537 _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices) │ │ │ │ │ -538 : indexSet_(indexSet), remoteIndices_(remoteIndices) │ │ │ │ │ -539 { │ │ │ │ │ -540 // index sets must match. │ │ │ │ │ -541 assert(remoteIndices.source_ == remoteIndices.target_); │ │ │ │ │ -542 assert(remoteIndices.source_ == &indexSet); │ │ │ │ │ -543 MPI_Comm_rank(remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &rank_); │ │ │ │ │ -544 } │ │ │ │ │ -545 │ │ │ │ │ -546 template │ │ │ │ │ -_5_4_7 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_I_t_e_r_a_t_o_r_s(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& remoteIndices, │ │ │ │ │ -548 _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& globalIndices, │ │ │ │ │ -549 _B_o_o_l_L_i_s_t& booleans) │ │ │ │ │ -550 : iterators_(remoteIndices.beginModify(), globalIndices.beginModify(), │ │ │ │ │ -551 booleans.beginModify(), remoteIndices.end()) │ │ │ │ │ -552 { } │ │ │ │ │ -553 │ │ │ │ │ -554 template │ │ │ │ │ -_5_5_5 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_I_t_e_r_a_t_o_r_s() │ │ │ │ │ -556 : iterators_() │ │ │ │ │ -557 {} │ │ │ │ │ -558 │ │ │ │ │ -559 template │ │ │ │ │ -_5_6_0 inline typename _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s& _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_: │ │ │ │ │ -_o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -561 { │ │ │ │ │ -562 ++(std::get<0>(iterators_)); │ │ │ │ │ -563 ++(std::get<1>(iterators_)); │ │ │ │ │ -564 ++(std::get<2>(iterators_)); │ │ │ │ │ -565 return *this; │ │ │ │ │ -566 } │ │ │ │ │ -567 │ │ │ │ │ -568 template │ │ │ │ │ -_5_6_9 inline void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x & index, │ │ │ │ │ -570 const std::pair& global) │ │ │ │ │ -571 { │ │ │ │ │ -572 std::get<0>(iterators_).insert(index); │ │ │ │ │ -573 std::get<1>(iterators_).insert(global); │ │ │ │ │ -574 std::get<2>(iterators_).insert(false); │ │ │ │ │ -575 } │ │ │ │ │ -576 │ │ │ │ │ -577 template │ │ │ │ │ -578 inline typename _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_R_e_m_o_t_e_I_n_d_e_x& │ │ │ │ │ -_5_7_9 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_m_o_t_e_I_n_d_e_x() const │ │ │ │ │ -580 { │ │ │ │ │ -581 return *(std::get<0>(iterators_)); │ │ │ │ │ -582 } │ │ │ │ │ -583 │ │ │ │ │ -584 template │ │ │ │ │ -585 inline std::pair::GlobalIndex,typename │ │ │ │ │ -_I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_A_t_t_r_i_b_u_t_e>& │ │ │ │ │ -_5_8_6 _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_g_l_o_b_a_l_I_n_d_e_x_P_a_i_r() const │ │ │ │ │ -587 { │ │ │ │ │ -588 return *(std::get<1>(iterators_)); │ │ │ │ │ -589 } │ │ │ │ │ -590 │ │ │ │ │ -591 template │ │ │ │ │ -_5_9_2 inline bool _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_O_l_d() const │ │ │ │ │ -593 { │ │ │ │ │ -594 return *(std::get<2>(iterators_)); │ │ │ │ │ -595 } │ │ │ │ │ -596 │ │ │ │ │ -597 template │ │ │ │ │ -_5_9_8 inline void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_s_e_t(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& │ │ │ │ │ -remoteIndices, │ │ │ │ │ -599 _G_l_o_b_a_l_I_n_d_e_x_L_i_s_t& globalIndices, │ │ │ │ │ -600 _B_o_o_l_L_i_s_t& booleans) │ │ │ │ │ -601 { │ │ │ │ │ -602 std::get<0>(iterators_) = remoteIndices._b_e_g_i_n_M_o_d_i_f_y(); │ │ │ │ │ -603 std::get<1>(iterators_) = globalIndices._b_e_g_i_n_M_o_d_i_f_y(); │ │ │ │ │ -604 std::get<2>(iterators_) = booleans._b_e_g_i_n_M_o_d_i_f_y(); │ │ │ │ │ -605 } │ │ │ │ │ -606 │ │ │ │ │ -607 template │ │ │ │ │ -_6_0_8 inline bool _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_N_o_t_A_t_E_n_d() const │ │ │ │ │ -609 { │ │ │ │ │ -610 return std::get<0>(iterators_) != std::get<3>(iterators_); │ │ │ │ │ -611 } │ │ │ │ │ -612 │ │ │ │ │ -613 template │ │ │ │ │ -_6_1_4 inline bool _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_A_t_E_n_d() const │ │ │ │ │ -615 { │ │ │ │ │ -616 return std::get<0>(iterators_) == std::get<3>(iterators_); │ │ │ │ │ -617 } │ │ │ │ │ -618 │ │ │ │ │ -619 template │ │ │ │ │ -620 void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_r_e_g_i_s_t_e_r_M_e_s_s_a_g_e_D_a_t_a_t_y_p_e() │ │ │ │ │ -621 { │ │ │ │ │ -622 MPI_Datatype type[2] = {MPI_INT, MPI_INT}; │ │ │ │ │ -623 int blocklength[2] = {1,1}; │ │ │ │ │ -624 MPI_Aint displacement[2]; │ │ │ │ │ -625 MPI_Aint base; │ │ │ │ │ -626 │ │ │ │ │ -627 // Compute displacement │ │ │ │ │ -628 MessageInformation message; │ │ │ │ │ -629 │ │ │ │ │ -630 MPI_Get_address( &(message.publish), displacement); │ │ │ │ │ -631 MPI_Get_address( &(message.pairs), displacement+1); │ │ │ │ │ -632 │ │ │ │ │ -633 // Make the displacement relative │ │ │ │ │ -634 MPI_Get_address(&message, &base); │ │ │ │ │ -635 displacement[0] -= base; │ │ │ │ │ -636 displacement[1] -= base; │ │ │ │ │ -637 │ │ │ │ │ -638 MPI_Type_create_struct( 2, blocklength, displacement, type, &datatype_); │ │ │ │ │ -639 MPI_Type_commit(&datatype_); │ │ │ │ │ -640 } │ │ │ │ │ -641 │ │ │ │ │ -642 template │ │ │ │ │ -643 void IndicesSyncer::calculateMessageSizes() │ │ │ │ │ -644 { │ │ │ │ │ -645 auto iEnd = indexSet_.end(); │ │ │ │ │ -646 auto collIter = remoteIndices_.template iterator(); │ │ │ │ │ -647 │ │ │ │ │ -648 for(auto index = indexSet_.begin(); index != iEnd; ++index) { │ │ │ │ │ -649 collIter.advance(index->global(), index->local().attribute()); │ │ │ │ │ -650 if(collIter.empty()) │ │ │ │ │ -651 break; │ │ │ │ │ -652 int knownRemote=0; │ │ │ │ │ -653 auto end = collIter.end(); │ │ │ │ │ -654 │ │ │ │ │ -655 // Count the remote indices we know. │ │ │ │ │ -656 for(auto valid = collIter.begin(); valid != end; ++valid) { │ │ │ │ │ -657 ++knownRemote; │ │ │ │ │ -658 } │ │ │ │ │ -659 │ │ │ │ │ -660 if(knownRemote>0) { │ │ │ │ │ -661 _D_u_n_e_:_:_d_v_e_r_b<global()<< " for processes "; │ │ │ │ │ -662 │ │ │ │ │ -663 // Update MessageInformation │ │ │ │ │ -664 for(auto valid = collIter.begin(); valid != end; ++valid) { │ │ │ │ │ -665 ++(infoSend_[valid.process()].publish); │ │ │ │ │ -666 (infoSend_[valid.process()].pairs) += knownRemote; │ │ │ │ │ -667 _D_u_n_e_:_:_d_v_e_r_b<first==remote->first) { │ │ │ │ │ -689 // We want to send message information to that process │ │ │ │ │ -690 message = const_cast(&(messageIter->second)); │ │ │ │ │ -691 ++messageIter; │ │ │ │ │ -692 }else │ │ │ │ │ -693 // We do not want to send information but the other process might. │ │ │ │ │ -694 message = &dummy; │ │ │ │ │ -695 │ │ │ │ │ -696 sendBufferSizes_[neighbour]=0; │ │ │ │ │ -697 int tsize; │ │ │ │ │ -698 // The number of indices published │ │ │ │ │ -699 MPI_Pack_size(1, MPI_INT,remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -700 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ -701 │ │ │ │ │ -702 for(int i=0; i < message->publish; ++i) { │ │ │ │ │ -703 // The global index │ │ │ │ │ -704 MPI_Pack_size(1, _M_P_I_T_r_a_i_t_s_<_G_l_o_b_a_l_I_n_d_e_x_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -705 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ -706 // The attribute in the local index │ │ │ │ │ -707 MPI_Pack_size(1, MPI_CHAR, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -708 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ -709 // The number of corresponding remote indices │ │ │ │ │ -710 MPI_Pack_size(1, MPI_INT, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -711 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ -712 } │ │ │ │ │ -713 for(int i=0; i < message->pairs; ++i) { │ │ │ │ │ -714 // The process of the remote index │ │ │ │ │ -715 MPI_Pack_size(1, MPI_INT, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -716 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ -717 // The attribute of the remote index │ │ │ │ │ -718 MPI_Pack_size(1, MPI_CHAR, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -719 sendBufferSizes_[neighbour] += tsize; │ │ │ │ │ -720 } │ │ │ │ │ -721 │ │ │ │ │ -722 _D_u_n_e_:_:_d_v_e_r_b< │ │ │ │ │ -852 void _I_n_d_i_c_e_s_S_y_n_c_e_r_<_T_>_:_:_p_a_c_k_A_n_d_S_e_n_d(int destination, char* buffer, std:: │ │ │ │ │ -size_t bufferSize, MPI_Request& request) │ │ │ │ │ -853 { │ │ │ │ │ -854 auto iEnd = indexSet_.end(); │ │ │ │ │ -855 int bpos = 0; │ │ │ │ │ -856 int published = 0; │ │ │ │ │ -857 int pairs = 0; │ │ │ │ │ -858 │ │ │ │ │ -859 assert(checkReset()); │ │ │ │ │ -860 │ │ │ │ │ -861 // Pack the number of indices we publish │ │ │ │ │ -862 MPI_Pack(&(infoSend_[destination].publish), 1, MPI_INT, buffer, bufferSize, │ │ │ │ │ -&bpos, │ │ │ │ │ -863 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -864 │ │ │ │ │ -865 for(auto index = indexSet_.begin(); index != iEnd; ++index) { │ │ │ │ │ -866 // Search for corresponding remote indices in all iterator tuples │ │ │ │ │ -867 auto iteratorsEnd = iteratorsMap_.end(); │ │ │ │ │ -868 │ │ │ │ │ -869 // advance all iterators to a position with global index >= index->global() │ │ │ │ │ -870 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; │ │ │ │ │ -++iterators) { │ │ │ │ │ -871 while(iterators->second.isNotAtEnd() && │ │ │ │ │ -872 iterators->second.globalIndexPair().first < index->global()) │ │ │ │ │ -873 ++(iterators->second); │ │ │ │ │ -874 assert(!iterators->second.isNotAtEnd() || iterators->second.globalIndexPair │ │ │ │ │ -().first >= index->global()); │ │ │ │ │ -875 } │ │ │ │ │ -876 │ │ │ │ │ -877 // Add all remote indices positioned at global which were already present │ │ │ │ │ -before calling sync │ │ │ │ │ -878 // to the message. │ │ │ │ │ -879 // Count how many remote indices we will send │ │ │ │ │ -880 int indices = 0; │ │ │ │ │ -881 bool knownRemote = false; // Is the remote process supposed to know this │ │ │ │ │ -index? │ │ │ │ │ -882 │ │ │ │ │ -883 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; │ │ │ │ │ -++iterators) │ │ │ │ │ -884 { │ │ │ │ │ -885 std::pair p; │ │ │ │ │ -886 if (iterators->second.isNotAtEnd()) │ │ │ │ │ -887 { │ │ │ │ │ -888 p = iterators->second.globalIndexPair(); │ │ │ │ │ -889 } │ │ │ │ │ -890 │ │ │ │ │ -891 if(iterators->second.isNotAtEnd() && iterators->second.isOld() │ │ │ │ │ -892 && iterators->second.globalIndexPair().first == index->global()) { │ │ │ │ │ -893 indices++; │ │ │ │ │ -894 if(destination == iterators->first) │ │ │ │ │ -895 knownRemote = true; │ │ │ │ │ -896 } │ │ │ │ │ -897 } │ │ │ │ │ -898 │ │ │ │ │ -899 if(!knownRemote) │ │ │ │ │ -900 // We do not need to send any indices │ │ │ │ │ -901 continue; │ │ │ │ │ -902 │ │ │ │ │ -903 _D_u_n_e_:_:_d_v_e_r_b<global │ │ │ │ │ -()<<" to "<(&(index->global())), 1, │ │ │ │ │ -_M_P_I_T_r_a_i_t_s_<_G_l_o_b_a_l_I_n_d_e_x_>_:_:_g_e_t_T_y_p_e(), buffer, bufferSize, &bpos, │ │ │ │ │ -908 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -909 │ │ │ │ │ -910 char attr = index->local().attribute(); │ │ │ │ │ -911 MPI_Pack(&attr, 1, MPI_CHAR, buffer, bufferSize, &bpos, │ │ │ │ │ -912 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -913 │ │ │ │ │ -914 // Pack the number of remote indices we send. │ │ │ │ │ -915 MPI_Pack(&indices, 1, MPI_INT, buffer, bufferSize, &bpos, │ │ │ │ │ -916 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -917 │ │ │ │ │ -918 // Pack the information about the remote indices │ │ │ │ │ -919 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; │ │ │ │ │ -++iterators) │ │ │ │ │ -920 if(iterators->second.isNotAtEnd() && iterators->second.isOld() │ │ │ │ │ -921 && iterators->second.globalIndexPair().first == index->global()) { │ │ │ │ │ -922 int process = iterators->first; │ │ │ │ │ -923 │ │ │ │ │ -924 ++pairs; │ │ │ │ │ -925 assert(pairs <= infoSend_[destination].pairs); │ │ │ │ │ -926 MPI_Pack(&process, 1, MPI_INT, buffer, bufferSize, &bpos, │ │ │ │ │ -927 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -928 char attr2 = iterators->second.remoteIndex().attribute(); │ │ │ │ │ -929 │ │ │ │ │ -930 MPI_Pack(&attr2, 1, MPI_CHAR, buffer, bufferSize, &bpos, │ │ │ │ │ -931 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -932 --indices; │ │ │ │ │ -933 } │ │ │ │ │ -934 assert(indices==0); │ │ │ │ │ -935 ++published; │ │ │ │ │ -936 _D_u_n_e_:_:_d_v_v_e_r_b<<" (publish="< │ │ │ │ │ -951 inline void IndicesSyncer::insertIntoRemoteIndexList(int process, │ │ │ │ │ -952 const std::pair& globalPair, │ │ │ │ │ -953 char attribute) │ │ │ │ │ -954 { │ │ │ │ │ -955 _D_u_n_e_:_:_d_v_e_r_b<<"Inserting from "<second; │ │ │ │ │ -972 │ │ │ │ │ -973 // Search for the remote index │ │ │ │ │ -974 while(iterators.isNotAtEnd() && iterators.globalIndexPair() < globalPair) { │ │ │ │ │ -975 // Increment all iterators │ │ │ │ │ -976 ++iterators; │ │ │ │ │ -977 │ │ │ │ │ -978 } │ │ │ │ │ -979 │ │ │ │ │ -980 if(iterators.isAtEnd() || iterators.globalIndexPair() != globalPair) { │ │ │ │ │ -981 // The entry is not yet known │ │ │ │ │ -982 // Insert in the list and do not change the first iterator. │ │ │ │ │ -983 iterators.insert(RemoteIndex(_A_t_t_r_i_b_u_t_e(attribute)),globalPair); │ │ │ │ │ -984 return; │ │ │ │ │ -985 } │ │ │ │ │ -986 │ │ │ │ │ -987 // Global indices match │ │ │ │ │ -988 bool indexIsThere=false; │ │ │ │ │ -989 for(Iterators tmpIterators = iterators; │ │ │ │ │ -990 !tmpIterators.isAtEnd() && tmpIterators.globalIndexPair() == globalPair; │ │ │ │ │ -991 ++tmpIterators) │ │ │ │ │ -992 //entry already exists with the same attribute │ │ │ │ │ -993 if(tmpIterators.globalIndexPair().second == attribute) { │ │ │ │ │ -994 indexIsThere=true; │ │ │ │ │ -995 break; │ │ │ │ │ -996 } │ │ │ │ │ -997 │ │ │ │ │ -998 if(!indexIsThere) │ │ │ │ │ -999 // The entry is not yet known │ │ │ │ │ -1000 // Insert in the list and do not change the first iterator. │ │ │ │ │ -1001 iterators.insert(RemoteIndex(_A_t_t_r_i_b_u_t_e(attribute)),globalPair); │ │ │ │ │ -1002 } │ │ │ │ │ -1003 │ │ │ │ │ -1004 template │ │ │ │ │ -1005 template │ │ │ │ │ -1006 void IndicesSyncer::recvAndUnpack(T1& numberer) │ │ │ │ │ -1007 { │ │ │ │ │ -1008 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& constIndexSet = indexSet_; │ │ │ │ │ -1009 auto iEnd = constIndexSet.end(); │ │ │ │ │ -1010 auto index = constIndexSet.begin(); │ │ │ │ │ -1011 int bpos = 0; │ │ │ │ │ -1012 int publish; │ │ │ │ │ -1013 │ │ │ │ │ -1014 assert(checkReset()); │ │ │ │ │ -1015 │ │ │ │ │ -1016 MPI_Status status; │ │ │ │ │ -1017 │ │ │ │ │ -1018 // We have to determine the message size and source before the receive │ │ │ │ │ -1019 MPI_Probe(MPI_ANY_SOURCE, 345, remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &status); │ │ │ │ │ -1020 │ │ │ │ │ -1021 int source=status.MPI_SOURCE; │ │ │ │ │ -1022 int count; │ │ │ │ │ -1023 MPI_Get_count(&status, MPI_PACKED, &count); │ │ │ │ │ -1024 │ │ │ │ │ -1025 _D_u_n_e_:_:_d_v_v_e_r_b<receiveBufferSize_) { │ │ │ │ │ -1028 receiveBufferSize_=count; │ │ │ │ │ -1029 delete[] receiveBuffer_; │ │ │ │ │ -1030 receiveBuffer_ = new char[receiveBufferSize_]; │ │ │ │ │ -1031 } │ │ │ │ │ -1032 │ │ │ │ │ -1033 MPI_Recv(receiveBuffer_, count, MPI_PACKED, source, 345, │ │ │ │ │ -remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r(), &status); │ │ │ │ │ -1034 │ │ │ │ │ -1035 // How many global entries were published? │ │ │ │ │ -1036 MPI_Unpack(receiveBuffer_, count, &bpos, &publish, 1, MPI_INT, │ │ │ │ │ -remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1037 │ │ │ │ │ -1038 // Now unpack the remote indices and add them. │ │ │ │ │ -1039 while(publish>0) { │ │ │ │ │ -1040 │ │ │ │ │ -1041 // Unpack information about the local index on the source process │ │ │ │ │ -1042 _G_l_o_b_a_l_I_n_d_e_x global; // global index of the current entry │ │ │ │ │ -1043 char sourceAttribute; // Attribute on the source process │ │ │ │ │ -1044 int pairs; │ │ │ │ │ -1045 │ │ │ │ │ -1046 MPI_Unpack(receiveBuffer_, count, &bpos, &global, 1, │ │ │ │ │ -_M_P_I_T_r_a_i_t_s_<_G_l_o_b_a_l_I_n_d_e_x_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -1047 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1048 MPI_Unpack(receiveBuffer_, count, &bpos, &sourceAttribute, 1, MPI_CHAR, │ │ │ │ │ -1049 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1050 MPI_Unpack(receiveBuffer_, count, &bpos, &pairs, 1, MPI_INT, │ │ │ │ │ -1051 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1052 │ │ │ │ │ -1053 // Insert the entry on the remote process to our │ │ │ │ │ -1054 // remote index list │ │ │ │ │ -1055 SLList > sourceAttributeList; │ │ │ │ │ -1056 sourceAttributeList.push_back(std::make_pair(source,_A_t_t_r_i_b_u_t_e │ │ │ │ │ -(sourceAttribute))); │ │ │ │ │ -1057#ifndef NDEBUG │ │ │ │ │ -1058 bool foundSelf = false; │ │ │ │ │ -1059#endif │ │ │ │ │ -1060 _A_t_t_r_i_b_u_t_e myAttribute=_A_t_t_r_i_b_u_t_e(); │ │ │ │ │ -1061 │ │ │ │ │ -1062 // Unpack the remote indices │ │ │ │ │ -1063 for(; pairs>0; --pairs) { │ │ │ │ │ -1064 // Unpack the process id that knows the index │ │ │ │ │ -1065 int process; │ │ │ │ │ -1066 char attribute; │ │ │ │ │ -1067 MPI_Unpack(receiveBuffer_, count, &bpos, &process, 1, MPI_INT, │ │ │ │ │ -1068 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1069 // Unpack the attribute │ │ │ │ │ -1070 MPI_Unpack(receiveBuffer_, count, &bpos, &attribute, 1, MPI_CHAR, │ │ │ │ │ -1071 remoteIndices_._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1072 │ │ │ │ │ -1073 if(process==rank_) { │ │ │ │ │ -1074#ifndef NDEBUG │ │ │ │ │ -1075 foundSelf=true; │ │ │ │ │ -1076#endif │ │ │ │ │ -1077 myAttribute=_A_t_t_r_i_b_u_t_e(attribute); │ │ │ │ │ -1078 // Now we know the local attribute of the global index │ │ │ │ │ -1079 //Only add the index if it is unknown. │ │ │ │ │ -1080 // Do we know that global index already? │ │ │ │ │ -1081 auto pos = std::lower_bound(index, iEnd, _I_n_d_e_x_P_a_i_r(global)); │ │ │ │ │ -1082 │ │ │ │ │ -1083 if(pos == iEnd || pos->global() != global) { │ │ │ │ │ -1084 // no entry with this global index │ │ │ │ │ -1085 indexSet_.add(global, │ │ │ │ │ -1086 ParallelLocalIndex(numberer(global), │ │ │ │ │ -1087 myAttribute, true)); │ │ │ │ │ -1088 _D_u_n_e_:_:_d_v_v_e_r_b << "Adding "<global()==global; ++pos) │ │ │ │ │ -1097 if(pos->local().attribute() == myAttribute) { │ │ │ │ │ -1098 _D_u_n_e_:_:_d_v_v_e_r_b<<"found "<(numberer(global), │ │ │ │ │ -1106 myAttribute, true)); │ │ │ │ │ -1107 _D_u_n_e_:_:_d_v_v_e_r_b << "Adding "< >::const_iterator Iter; │ │ │ │ │ -1117 for(Iter i=sourceAttributeList.begin(), end=sourceAttributeList.end(); │ │ │ │ │ -1118 i!=end; ++i) │ │ │ │ │ -1119 insertIntoRemoteIndexList(i->first, std::make_pair(global, myAttribute), │ │ │ │ │ -1120 i->second); │ │ │ │ │ -1121 --publish; │ │ │ │ │ -1122 } │ │ │ │ │ -1123 │ │ │ │ │ -1124 resetIteratorsMap(); │ │ │ │ │ -1125 } │ │ │ │ │ -1126 │ │ │ │ │ -1127 template │ │ │ │ │ -1128 void IndicesSyncer::resetIteratorsMap(){ │ │ │ │ │ -1129 │ │ │ │ │ -1130 // Reset iterators in all tuples. │ │ │ │ │ -1131 const auto remoteEnd = remoteIndices_.remoteIndices_.end(); │ │ │ │ │ -1132 auto iterators = iteratorsMap_.begin(); │ │ │ │ │ -1133 auto global = globalMap_.begin(); │ │ │ │ │ -1134 auto added = oldMap_.begin(); │ │ │ │ │ -1135 │ │ │ │ │ -1136 for(auto remote = remoteIndices_.remoteIndices_.begin(); │ │ │ │ │ -1137 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) { │ │ │ │ │ -1138 iterators->second.reset(*(remote->second.first), global->second, added- │ │ │ │ │ ->second); │ │ │ │ │ -1139 } │ │ │ │ │ -1140 } │ │ │ │ │ -1141 │ │ │ │ │ -1142 template │ │ │ │ │ -1143 bool IndicesSyncer::checkReset(const Iterators& iterators, │ │ │ │ │ -RemoteIndexList& rList, GlobalIndexList& gList, │ │ │ │ │ -1144 BoolList& bList){ │ │ │ │ │ -1145 │ │ │ │ │ -1146 if(std::get<0>(iterators.iterators_) != rList.begin()) │ │ │ │ │ -1147 return false; │ │ │ │ │ -1148 if(std::get<1>(iterators.iterators_) != gList.begin()) │ │ │ │ │ -1149 return false; │ │ │ │ │ -1150 if(std::get<2>(iterators.iterators_) != bList.begin()) │ │ │ │ │ -1151 return false; │ │ │ │ │ -1152 return true; │ │ │ │ │ -1153 } │ │ │ │ │ -1154 │ │ │ │ │ -1155 │ │ │ │ │ -1156 template │ │ │ │ │ -1157 bool IndicesSyncer::checkReset(){ │ │ │ │ │ -1158 │ │ │ │ │ -1159 // Reset iterators in all tuples. │ │ │ │ │ -1160 const auto remoteEnd = remoteIndices_.remoteIndices_.end(); │ │ │ │ │ -1161 auto iterators = iteratorsMap_.begin(); │ │ │ │ │ -1162 auto global = globalMap_.begin(); │ │ │ │ │ -1163 auto added = oldMap_.begin(); │ │ │ │ │ -1164 bool ret = true; │ │ │ │ │ -1165 │ │ │ │ │ -1166 for(auto remote = remoteIndices_.remoteIndices_.begin(); │ │ │ │ │ -1167 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) { │ │ │ │ │ -1168 if(!checkReset(iterators->second, *(remote->second.first), global->second, │ │ │ │ │ -1169 added->second)) │ │ │ │ │ -1170 ret=false; │ │ │ │ │ -1171 } │ │ │ │ │ -1172 return ret; │ │ │ │ │ -1173 } │ │ │ │ │ -1174} │ │ │ │ │ -1175 │ │ │ │ │ -1176#endif │ │ │ │ │ -1177#endif │ │ │ │ │ -_i_n_d_e_x_s_e_t_._h_h │ │ │ │ │ -Provides a map between global and local indices. │ │ │ │ │ -_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -Classes describing a distributed indexset. │ │ │ │ │ -_s_l_l_i_s_t_._h_h │ │ │ │ │ -Implements a singly linked list together with the necessary iterators. │ │ │ │ │ -_s_t_d_s_t_r_e_a_m_s_._h_h │ │ │ │ │ -Standard Dune debug streams. │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ -void push_back(const MemberType &item) │ │ │ │ │ -Add a new entry to the end of the list. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:643 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -SLListIterator< T, A > iterator │ │ │ │ │ -The mutable iterator of the list. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_:_:_e_n_d │ │ │ │ │ -iterator end() │ │ │ │ │ -Get an iterator pointing to the end of the list. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:774 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_:_:_b_e_g_i_n_M_o_d_i_f_y │ │ │ │ │ -ModifyIterator beginModify() │ │ │ │ │ -Get an iterator capable of deleting and inserting elements. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:787 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_<_ _R_e_m_o_t_e_I_n_d_e_x_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -SLListConstIterator< RemoteIndex, Allocator > const_iterator │ │ │ │ │ -The constant iterator of the list. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_:_:_M_o_d_i_f_y_I_t_e_r_a_t_o_r │ │ │ │ │ -SLListModifyIterator< T, A > ModifyIterator │ │ │ │ │ -The type of the iterator capable of deletion and insertion. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:103 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ -iterator begin() │ │ │ │ │ -Get an iterator pointing to the first element in the list. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:762 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator<(const │ │ │ │ │ -RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const │ │ │ │ │ -RandomAccessIteratorFacade< T2, V2, R2, D > &rhs) │ │ │ │ │ -Comparison operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:637 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for equality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for inequality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_I_t_e_r_a_t_o_r_s │ │ │ │ │ -Iterators() │ │ │ │ │ -Default constructor. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:555 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -Dune::RemoteIndices< ParallelIndexSet > RemoteIndices │ │ │ │ │ -Type of the remote indices. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_O_l_d │ │ │ │ │ -bool isOld() const │ │ │ │ │ -Was this entry already in the remote index list before the sync process? │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:592 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n_:_:_p_u_b_l_i_s_h │ │ │ │ │ -int publish │ │ │ │ │ -The number of indices we publish for the other process. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_r_e_p_a_i_r_L_o_c_a_l_I_n_d_e_x_P_o_i_n_t_e_r_s │ │ │ │ │ -void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T:: │ │ │ │ │ -GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, │ │ │ │ │ -RemoteIndices< T, A1 > &remoteIndices, const T &indexSet) │ │ │ │ │ -Repair the pointers to the local indices in the remote indices. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:487 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_A_t_E_n_d │ │ │ │ │ -bool isAtEnd() const │ │ │ │ │ -Are we at the end of the list? │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:614 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ │ -Type of the global index used in the index set. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n_:_:_p_a_i_r_s │ │ │ │ │ -int pairs │ │ │ │ │ -The number of pairs (attribute and process number) we publish to the neighbour │ │ │ │ │ -process. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:131 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ │ -Attribute & attribute() const │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -Iterators & operator++() │ │ │ │ │ -Increment all iteraors. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ -ParallelIndexSet::LocalIndex::Attribute Attribute │ │ │ │ │ -Type of the attribute used in the index set. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_g_l_o_b_a_l_I_n_d_e_x_P_a_i_r │ │ │ │ │ -std::pair< GlobalIndex, Attribute > & globalIndexPair() const │ │ │ │ │ -Get the global index of the remote index at current position. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:586 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r │ │ │ │ │ -IndicesSyncer(ParallelIndexSet &indexSet, RemoteIndices &remoteIndices) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:536 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_s_e_t │ │ │ │ │ -void reset(RemoteIndexList &remoteIndices, GlobalIndexList &globalIndices, │ │ │ │ │ -BoolList &booleans) │ │ │ │ │ -Reset all the underlying iterators. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:598 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_D_e_f_a_u_l_t_N_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -std::size_t operator()(const GlobalIndex &global) │ │ │ │ │ -Provide the local index, always std::numeric_limits::max() │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -T ParallelIndexSet │ │ │ │ │ -The type of the index set. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_s_N_o_t_A_t_E_n_d │ │ │ │ │ -bool isNotAtEnd() const │ │ │ │ │ -Are we not at the end of the list? │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:608 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -TG GlobalIndex │ │ │ │ │ -the type of the global index. This type has to provide at least a operator< for │ │ │ │ │ -sorting. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:226 │ │ │ │ │ -_D_u_n_e_:_:_s_t_o_r_e_G_l_o_b_a_l_I_n_d_i_c_e_s_O_f_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -void storeGlobalIndicesOfRemoteIndices(std::map< int, SLList< std::pair< │ │ │ │ │ -typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, │ │ │ │ │ -const RemoteIndices< T, A1 > &remoteIndices) │ │ │ │ │ -Stores the corresponding global indices of the remote index information. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:461 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_s_y_n_c │ │ │ │ │ -void sync() │ │ │ │ │ -Sync the index set. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:728 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_s_e_q_N_o │ │ │ │ │ -int seqNo() const │ │ │ │ │ -Get the internal sequence number. │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ -ParallelIndexSet::IndexPair IndexPair │ │ │ │ │ -The type of the index pair. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:48 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_r_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ -RemoteIndex & remoteIndex() const │ │ │ │ │ -Get the remote index at current position. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:579 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n_:_:_M_e_s_s_a_g_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -MessageInformation() │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:122 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r_:_:_I_t_e_r_a_t_o_r_s_:_:_i_n_s_e_r_t │ │ │ │ │ -void insert(const RemoteIndex &index, const std::pair< GlobalIndex, Attribute > │ │ │ │ │ -&global) │ │ │ │ │ -Insert a new remote index to the underlying remote index list. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:569 │ │ │ │ │ -_D_u_n_e_:_:_d_v_v_e_r_b │ │ │ │ │ -DVVerbType dvverb(std::cout) │ │ │ │ │ -stream for very verbose output. │ │ │ │ │ -DDeeffiinniittiioonn stdstreams.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_d_v_e_r_b │ │ │ │ │ -DVerbType dverb(std::cout) │ │ │ │ │ -Singleton of verbose debug stream. │ │ │ │ │ -DDeeffiinniittiioonn stdstreams.hh:116 │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_STD_MAKE_ARRAY_HH │ │ │ │ │ +4#define DUNE_COMMON_STD_MAKE_ARRAY_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8 │ │ │ │ │ +9#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ +10#include │ │ │ │ │ +11#endif │ │ │ │ │ +12 │ │ │ │ │ +13#warning make_array.hh is deprecated and will be removed after Dune 2.9. \ │ │ │ │ │ +14 Use deduction guide of `std::array` or `std::to_array`. │ │ │ │ │ +15 │ │ │ │ │ +16namespace _D_u_n_e { │ │ │ │ │ +17namespace Std { │ │ │ │ │ +18 │ │ │ │ │ +19#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ +20 │ │ │ │ │ +22 using std::experimental::make_array; │ │ │ │ │ +23 │ │ │ │ │ +24#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ +25 │ │ │ │ │ +27 │ │ │ │ │ +41 template │ │ │ │ │ +42 std::array::type, sizeof...(Args)> │ │ │ │ │ +_4_3 _m_a_k_e___a_r_r_a_y(const Args&... args) { │ │ │ │ │ +44 std::array::type, sizeof...(Args)> │ │ │ │ │ +45 result = {{args...}}; │ │ │ │ │ +46 return result; │ │ │ │ │ +47 } │ │ │ │ │ +48 │ │ │ │ │ +49#endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY │ │ │ │ │ +50 │ │ │ │ │ +51} │ │ │ │ │ +52} │ │ │ │ │ +53 │ │ │ │ │ +54#endif │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_a_k_e___a_r_r_a_y │ │ │ │ │ +std::array< typename std::common_type< Args... >::type, sizeof...(Args)> │ │ │ │ │ +make_array(const Args &... args) │ │ │ │ │ +Create and initialize an array. │ │ │ │ │ +DDeeffiinniittiioonn make_array.hh:43 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_:_:_g_e_t_T_y_p_e │ │ │ │ │ -static MPI_Datatype getType() │ │ │ │ │ -DDeeffiinniittiioonn mpitraits.hh:48 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ -A pair consisting of a global and local index. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_i_c_e_s_S_y_n_c_e_r │ │ │ │ │ -Class for recomputing missing indices of a distributed index set. │ │ │ │ │ -DDeeffiinniittiioonn indicessyncer.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -An index present on the local process with an additional attribute flag. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -The indices present on remote processes. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:189 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -MPI_Comm communicator() const │ │ │ │ │ -Get the mpi communicator used. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:1696 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -Get an iterator over all remote index lists. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:1529 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_n_e_i_g_h_b_o_u_r_s │ │ │ │ │ -int neighbours() const │ │ │ │ │ -Get the number of processors we share indices with. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:1446 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ -typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > │ │ │ │ │ -Allocator │ │ │ │ │ -The type of the allocator for the remote index list. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_b_e_g_i_n │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -Get an iterator over all remote index lists. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:1522 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ -Information about an index residing on another processor. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -A mutable iterator for the SLList. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_S_L_L_i_s_t │ │ │ │ │ -A single linked list. │ │ │ │ │ -DDeeffiinniittiioonn sllist.hh:44 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00218.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: variablesizecommunicator.hh File Reference │ │ │ │ +dune-common: variant.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,79 +65,36 @@ │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ Namespaces
    │ │ │ │ -
    variablesizecommunicator.hh File Reference
    │ │ │ │ +
    variant.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    A communicator that only needs to know the number of elements per index at the sender side. │ │ │ │ -More...

    │ │ │ │ -
    #include <algorithm>
    │ │ │ │ -#include <cassert>
    │ │ │ │ -#include <cstddef>
    │ │ │ │ -#include <functional>
    │ │ │ │ -#include <map>
    │ │ │ │ -#include <memory>
    │ │ │ │ -#include <utility>
    │ │ │ │ -#include <vector>
    │ │ │ │ -#include <mpi.h>
    │ │ │ │ -#include <dune/common/concept.hh>
    │ │ │ │ -#include <dune/common/parallel/interface.hh>
    │ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
    │ │ │ │ +
    #include <variant>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    struct  Dune::Concept::HasFixedSize
     
    class  Dune::VariableSizeCommunicator< Allocator >
     A buffered communicator where the amount of data sent does not have to be known a priori. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Concept
     Namespace for concepts.
    namespace  Dune::Std
     Namespace for features backported from new C++ standards.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    A communicator that only needs to know the number of elements per index at the sender side.

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

    Variable Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ fixedSize

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    std::size_t fixedSize
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    The number of data items per index if it is fixed, 0 otherwise.

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,50 +1,20 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -variablesizecommunicator.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ -A communicator that only needs to know the number of elements per index at the │ │ │ │ │ -sender side. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_o_n_c_e_p_t_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +variant.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_:_:_C_o_n_c_e_p_t_:_:_H_a_s_F_i_x_e_d_S_i_z_e │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_<_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ -  A buffered communicator where the amount of data sent does not have to │ │ │ │ │ - be known a priori. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_C_o_n_c_e_p_t │ │ │ │ │ -  Namespace for concepts. │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -A communicator that only needs to know the number of elements per index at the │ │ │ │ │ -sender side. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ -********** VVaarriiaabbllee DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? ffiixxeeddSSiizzee ********** │ │ │ │ │ -std::size_t fixedSize │ │ │ │ │ -The number of data items per index if it is fixed, 0 otherwise. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00218_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: variablesizecommunicator.hh Source File │ │ │ │ +dune-common: variant.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,914 +70,48 @@ │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    variablesizecommunicator.hh
    │ │ │ │ +
    variant.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH // Still fits the line!
    │ │ │ │ -
    6#define DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH
    │ │ │ │ +
    5#ifndef DUNE_COMMON_STD_VARIANT_HH
    │ │ │ │ +
    6#define DUNE_COMMON_STD_VARIANT_HH
    │ │ │ │
    7
    │ │ │ │ -
    8#if HAVE_MPI
    │ │ │ │ -
    9
    │ │ │ │ -
    10#include <algorithm>
    │ │ │ │ -
    11#include <cassert>
    │ │ │ │ -
    12#include <cstddef>
    │ │ │ │ -
    13#include <functional>
    │ │ │ │ -
    14#include <map>
    │ │ │ │ -
    15#include <memory>
    │ │ │ │ -
    16#include <utility>
    │ │ │ │ -
    17#include <vector>
    │ │ │ │ -
    18#include <algorithm>
    │ │ │ │ -
    19
    │ │ │ │ -
    20#include <mpi.h>
    │ │ │ │ -
    21
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
    8#warning dune/common/std/variant.hh is deprecated and will be removed after Dune 2.8.\
    │ │ │ │ +
    9 Include <variant> instead
    │ │ │ │ +
    10
    │ │ │ │ +
    11#include <variant>
    │ │ │ │ +
    12
    │ │ │ │ +
    13namespace Dune {
    │ │ │ │ +
    14namespace Std {
    │ │ │ │ +
    15 using std::variant;
    │ │ │ │ +
    16 using std::visit;
    │ │ │ │ +
    17 using std::variant_size;
    │ │ │ │ +
    18 using std::variant_size_v;
    │ │ │ │ +
    19 using std::get;
    │ │ │ │ +
    20 using std::get_if;
    │ │ │ │ +
    21 using std::holds_alternative;
    │ │ │ │ +
    22 using std::monostate;
    │ │ │ │ +
    23}
    │ │ │ │ +
    24}
    │ │ │ │
    25
    │ │ │ │ -
    38namespace Dune
    │ │ │ │ -
    39{
    │ │ │ │ -
    40
    │ │ │ │ -
    41namespace Concept {
    │ │ │ │ -
    42
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    44 template <typename H> auto require(H &&h) -> decltype(h.fixedSize());
    │ │ │ │ -
    45};
    │ │ │ │ -
    │ │ │ │ -
    46
    │ │ │ │ -
    47} // namespace Concept
    │ │ │ │ -
    48
    │ │ │ │ -
    49namespace Impl {
    │ │ │ │ -
    50
    │ │ │ │ -
    51template <typename H,
    │ │ │ │ -
    52 std::enable_if_t<models<Concept::HasFixedSize, H>(), int> = 0>
    │ │ │ │ -
    53constexpr bool callFixedSize(H &&handle) {
    │ │ │ │ -
    54 return handle.fixedSize();
    │ │ │ │ -
    55}
    │ │ │ │ -
    56
    │ │ │ │ -
    57} // namespace Impl
    │ │ │ │ -
    58
    │ │ │ │ -
    59namespace
    │ │ │ │ -
    60{
    │ │ │ │ -
    65template<class T, class Allocator=std::allocator<T> >
    │ │ │ │ -
    66class MessageBuffer
    │ │ │ │ -
    67{
    │ │ │ │ -
    68public:
    │ │ │ │ -
    73 explicit MessageBuffer(int size)
    │ │ │ │ -
    74 : buffer_(new T[size]), size_(size), position_(0)
    │ │ │ │ -
    75 {}
    │ │ │ │ -
    80 explicit MessageBuffer(const MessageBuffer& o)
    │ │ │ │ -
    81 : buffer_(new T[o.size_]), size_(o.size_), position_(o.position_)
    │ │ │ │ -
    82 {
    │ │ │ │ -
    83 }
    │ │ │ │ -
    85 ~MessageBuffer()
    │ │ │ │ -
    86 {
    │ │ │ │ -
    87 delete[] buffer_;
    │ │ │ │ -
    88 }
    │ │ │ │ -
    93 void write(const T& data)
    │ │ │ │ -
    94 {
    │ │ │ │ -
    95 buffer_[position_++]=data;
    │ │ │ │ -
    96 }
    │ │ │ │ -
    97
    │ │ │ │ -
    102 void read(T& data)
    │ │ │ │ -
    103 {
    │ │ │ │ -
    104 data=buffer_[position_++];
    │ │ │ │ -
    105 }
    │ │ │ │ -
    106
    │ │ │ │ -
    112 void reset()
    │ │ │ │ -
    113 {
    │ │ │ │ -
    114 position_=0;
    │ │ │ │ -
    115 }
    │ │ │ │ -
    116
    │ │ │ │ -
    121 bool finished()
    │ │ │ │ -
    122 {
    │ │ │ │ -
    123 return position_==size_;
    │ │ │ │ -
    124 }
    │ │ │ │ -
    125
    │ │ │ │ -
    131 bool hasSpaceForItems(int noItems)
    │ │ │ │ -
    132 {
    │ │ │ │ -
    133 return position_+noItems<=size_;
    │ │ │ │ -
    134 }
    │ │ │ │ -
    139 std::size_t size() const
    │ │ │ │ -
    140 {
    │ │ │ │ -
    141 return size_;
    │ │ │ │ -
    142 }
    │ │ │ │ -
    147 operator T*()
    │ │ │ │ -
    148 {
    │ │ │ │ -
    149 return buffer_;
    │ │ │ │ -
    150 }
    │ │ │ │ -
    151
    │ │ │ │ -
    152private:
    │ │ │ │ -
    156 T* buffer_;
    │ │ │ │ -
    160 std::size_t size_;
    │ │ │ │ -
    164 std::size_t position_;
    │ │ │ │ -
    165};
    │ │ │ │ -
    166
    │ │ │ │ -
    170class InterfaceTracker
    │ │ │ │ -
    171{
    │ │ │ │ -
    172public:
    │ │ │ │ -
    178 InterfaceTracker(int rank, InterfaceInformation info, std::size_t fixedsize=0,
    │ │ │ │ -
    179 bool allocateSizes=false)
    │ │ │ │ -
    180 : fixedSize(fixedsize),rank_(rank), index_(), interface_(info), sizes_()
    │ │ │ │ -
    181 {
    │ │ │ │ -
    182 if(allocateSizes)
    │ │ │ │ -
    183 {
    │ │ │ │ -
    184 sizes_.resize(info.size());
    │ │ │ │ -
    185 }
    │ │ │ │ -
    186 }
    │ │ │ │ -
    187
    │ │ │ │ -
    191 void moveToNextIndex()
    │ │ │ │ -
    192 {
    │ │ │ │ -
    193 index_++;
    │ │ │ │ -
    194 assert(index_<=interface_.size());
    │ │ │ │ -
    195 skipZeroIndices();
    │ │ │ │ -
    196 }
    │ │ │ │ -
    201 void increment(std::size_t i)
    │ │ │ │ -
    202 {
    │ │ │ │ -
    203 index_+=i;
    │ │ │ │ -
    204 assert(index_<=interface_.size());
    │ │ │ │ -
    205 }
    │ │ │ │ -
    210 bool finished() const
    │ │ │ │ -
    211 {
    │ │ │ │ -
    212 return index_==interface_.size();
    │ │ │ │ -
    213 }
    │ │ │ │ -
    214
    │ │ │ │ -
    215 void skipZeroIndices()
    │ │ │ │ -
    216 {
    │ │ │ │ -
    217 // skip indices with size zero!
    │ │ │ │ -
    218 while(sizes_.size() && index_!=interface_.size() &&!size())
    │ │ │ │ -
    219 ++index_;
    │ │ │ │ -
    220 }
    │ │ │ │ -
    221
    │ │ │ │ -
    226 std::size_t index() const
    │ │ │ │ -
    227 {
    │ │ │ │ -
    228 return interface_[index_];
    │ │ │ │ -
    229 }
    │ │ │ │ -
    233 std::size_t size() const
    │ │ │ │ -
    234 {
    │ │ │ │ -
    235 assert(sizes_.size());
    │ │ │ │ -
    236 return sizes_[index_];
    │ │ │ │ -
    237 }
    │ │ │ │ -
    241 std::size_t* getSizesPointer()
    │ │ │ │ -
    242 {
    │ │ │ │ -
    243 return &sizes_[0];
    │ │ │ │ -
    244 }
    │ │ │ │ -
    249 bool empty() const
    │ │ │ │ -
    250 {
    │ │ │ │ -
    251 return !interface_.size();
    │ │ │ │ -
    252 }
    │ │ │ │ -
    253
    │ │ │ │ -
    258 std::size_t indicesLeft() const
    │ │ │ │ -
    259 {
    │ │ │ │ -
    260 return interface_.size()-index_;
    │ │ │ │ -
    261 }
    │ │ │ │ -
    265 std::size_t fixedSize;
    │ │ │ │ -
    269 int rank() const
    │ │ │ │ -
    270 {
    │ │ │ │ -
    271 return rank_;
    │ │ │ │ -
    272 }
    │ │ │ │ -
    276 std::size_t offset() const
    │ │ │ │ -
    277 {
    │ │ │ │ -
    278 return index_;
    │ │ │ │ -
    279 }
    │ │ │ │ -
    280private:
    │ │ │ │ -
    282 int rank_;
    │ │ │ │ -
    284 std::size_t index_;
    │ │ │ │ -
    286 InterfaceInformation interface_;
    │ │ │ │ -
    287 std::vector<std::size_t> sizes_;
    │ │ │ │ -
    288};
    │ │ │ │ -
    289
    │ │ │ │ -
    290
    │ │ │ │ -
    291} // end unnamed namespace
    │ │ │ │ -
    292
    │ │ │ │ -
    330template<class Allocator=std::allocator<std::pair<InterfaceInformation,InterfaceInformation> > >
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    332{
    │ │ │ │ -
    333public:
    │ │ │ │ -
    338 typedef std::map<int,std::pair<InterfaceInformation,InterfaceInformation>,
    │ │ │ │ -
    339 std::less<int>,
    │ │ │ │ -
    340 typename std::allocator_traits<Allocator>::template rebind_alloc< std::pair<const int,std::pair<InterfaceInformation,InterfaceInformation> > > > InterfaceMap;
    │ │ │ │ -
    341
    │ │ │ │ -
    342#ifndef DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE
    │ │ │ │ -
    │ │ │ │ -
    349 VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap& inf)
    │ │ │ │ -
    350 : maxBufferSize_(32768), interface_(&inf)
    │ │ │ │ -
    351 {
    │ │ │ │ -
    352 MPI_Comm_dup(comm, &communicator_);
    │ │ │ │ -
    353 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    359 : maxBufferSize_(32768), interface_(&inf.interfaces())
    │ │ │ │ -
    360 {
    │ │ │ │ -
    361 MPI_Comm_dup(inf.communicator(), &communicator_);
    │ │ │ │ -
    362 }
    │ │ │ │ -
    │ │ │ │ -
    363#else
    │ │ │ │ -
    370 VariableSizeCommunicator(MPI_Comm comm, InterfaceMap& inf)
    │ │ │ │ -
    371 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE),
    │ │ │ │ -
    372 interface_(&inf)
    │ │ │ │ -
    373 {
    │ │ │ │ -
    374 MPI_Comm_dup(comm, &communicator_);
    │ │ │ │ -
    375 }
    │ │ │ │ -
    380 VariableSizeCommunicator(const Interface& inf)
    │ │ │ │ -
    381 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE),
    │ │ │ │ -
    382 interface_(&inf.interfaces())
    │ │ │ │ -
    383 {
    │ │ │ │ -
    384 MPI_Comm_dup(inf.communicator(), &communicator_);
    │ │ │ │ -
    385 }
    │ │ │ │ -
    386#endif
    │ │ │ │ -
    │ │ │ │ -
    393 VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap& inf, std::size_t max_buffer_size)
    │ │ │ │ -
    394 : maxBufferSize_(max_buffer_size), interface_(&inf)
    │ │ │ │ -
    395 {
    │ │ │ │ -
    396 MPI_Comm_dup(comm, &communicator_);
    │ │ │ │ -
    397 }
    │ │ │ │ -
    │ │ │ │ -
    398
    │ │ │ │ -
    │ │ │ │ -
    404 VariableSizeCommunicator(const Interface& inf, std::size_t max_buffer_size)
    │ │ │ │ -
    405 : maxBufferSize_(max_buffer_size), interface_(&inf.interfaces())
    │ │ │ │ -
    406 {
    │ │ │ │ -
    407 MPI_Comm_dup(inf.communicator(), &communicator_);
    │ │ │ │ -
    408 }
    │ │ │ │ -
    │ │ │ │ -
    409
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    411 {
    │ │ │ │ -
    412 MPI_Comm_free(&communicator_);
    │ │ │ │ -
    413 }
    │ │ │ │ -
    │ │ │ │ -
    414
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    420 maxBufferSize_ = other.maxBufferSize_;
    │ │ │ │ -
    421 interface_ = other.interface_;
    │ │ │ │ -
    422 MPI_Comm_dup(other.communicator_, &communicator_);
    │ │ │ │ -
    423 }
    │ │ │ │ -
    │ │ │ │ -
    424
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    430 if(this == &other) // don't do anything if objects are the same
    │ │ │ │ -
    431 return *this;
    │ │ │ │ -
    432
    │ │ │ │ -
    433 maxBufferSize_ = other.maxBufferSize_;
    │ │ │ │ -
    434 interface_ = other.interface_;
    │ │ │ │ -
    435 MPI_Comm_free(&communicator_);
    │ │ │ │ -
    436 MPI_Comm_dup(other.communicator_, &communicator_);
    │ │ │ │ -
    437
    │ │ │ │ -
    438 return *this;
    │ │ │ │ -
    439 }
    │ │ │ │ -
    │ │ │ │ -
    440
    │ │ │ │ -
    460 template<class DataHandle>
    │ │ │ │ -
    │ │ │ │ -
    461 void forward(DataHandle& handle)
    │ │ │ │ -
    462 {
    │ │ │ │ -
    463 communicate<true>(handle);
    │ │ │ │ -
    464 }
    │ │ │ │ -
    │ │ │ │ -
    465
    │ │ │ │ -
    485 template<class DataHandle>
    │ │ │ │ -
    │ │ │ │ -
    486 void backward(DataHandle& handle)
    │ │ │ │ -
    487 {
    │ │ │ │ -
    488 communicate<false>(handle);
    │ │ │ │ -
    489 }
    │ │ │ │ -
    │ │ │ │ -
    490
    │ │ │ │ -
    491private:
    │ │ │ │ -
    492 template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    493 void communicateSizes(DataHandle& handle,
    │ │ │ │ -
    494 std::vector<InterfaceTracker>& recv_trackers);
    │ │ │ │ -
    495
    │ │ │ │ -
    502 template<bool forward,class DataHandle>
    │ │ │ │ -
    503 void communicate(DataHandle& handle);
    │ │ │ │ -
    513 template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    514 void setupInterfaceTrackers(DataHandle& handle,
    │ │ │ │ -
    515 std::vector<InterfaceTracker>& send_trackers,
    │ │ │ │ -
    516 std::vector<InterfaceTracker>& recv_trackers);
    │ │ │ │ -
    524 template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    525 void communicateFixedSize(DataHandle& handle);
    │ │ │ │ -
    533 template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    534 void communicateVariableSize(DataHandle& handle);
    │ │ │ │ -
    541 std::size_t maxBufferSize_;
    │ │ │ │ -
    549 const InterfaceMap* interface_;
    │ │ │ │ -
    555 MPI_Comm communicator_;
    │ │ │ │ -
    556};
    │ │ │ │ -
    │ │ │ │ -
    557
    │ │ │ │ -
    559namespace
    │ │ │ │ -
    560{
    │ │ │ │ -
    564template<class DataHandle>
    │ │ │ │ -
    565class SizeDataHandle
    │ │ │ │ -
    566{
    │ │ │ │ -
    567public:
    │ │ │ │ -
    568 typedef std::size_t DataType;
    │ │ │ │ -
    569
    │ │ │ │ -
    570 SizeDataHandle(DataHandle& data,
    │ │ │ │ -
    571 std::vector<InterfaceTracker>& trackers)
    │ │ │ │ -
    572 : data_(data), trackers_(trackers), index_()
    │ │ │ │ -
    573 {}
    │ │ │ │ -
    574 bool fixedSize()
    │ │ │ │ -
    575 {
    │ │ │ │ -
    576 return true;
    │ │ │ │ -
    577 }
    │ │ │ │ -
    578 std::size_t size([[maybe_unused]] std::size_t i)
    │ │ │ │ -
    579 {
    │ │ │ │ -
    580 return 1;
    │ │ │ │ -
    581 }
    │ │ │ │ -
    582 template<class B>
    │ │ │ │ -
    583 void gather(B& buf, int i)
    │ │ │ │ -
    584 {
    │ │ │ │ -
    585 buf.write(data_.size(i));
    │ │ │ │ -
    586 }
    │ │ │ │ -
    587 void setReceivingIndex(std::size_t i)
    │ │ │ │ -
    588 {
    │ │ │ │ -
    589 index_=i;
    │ │ │ │ -
    590 }
    │ │ │ │ -
    591 std::size_t* getSizesPointer()
    │ │ │ │ -
    592 {
    │ │ │ │ -
    593 return trackers_[index_].getSizesPointer();
    │ │ │ │ -
    594 }
    │ │ │ │ -
    595
    │ │ │ │ -
    596private:
    │ │ │ │ -
    597 DataHandle& data_;
    │ │ │ │ -
    598 std::vector<InterfaceTracker>& trackers_;
    │ │ │ │ -
    599 int index_;
    │ │ │ │ -
    600};
    │ │ │ │ -
    601
    │ │ │ │ -
    602template<class T>
    │ │ │ │ -
    603void setReceivingIndex(T&, int)
    │ │ │ │ -
    604{}
    │ │ │ │ -
    605
    │ │ │ │ -
    606template<class T>
    │ │ │ │ -
    607void setReceivingIndex(SizeDataHandle<T>& t, int i)
    │ │ │ │ -
    608{
    │ │ │ │ -
    609 t.setReceivingIndex(i);
    │ │ │ │ -
    610}
    │ │ │ │ -
    611
    │ │ │ │ -
    612
    │ │ │ │ -
    618template<bool FORWARD>
    │ │ │ │ -
    619struct InterfaceInformationChooser
    │ │ │ │ -
    620{
    │ │ │ │ -
    624 static const InterfaceInformation&
    │ │ │ │ -
    625 getSend(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    │ │ │ │ -
    626 {
    │ │ │ │ -
    627 return info.first;
    │ │ │ │ -
    628 }
    │ │ │ │ -
    629
    │ │ │ │ -
    633 static const InterfaceInformation&
    │ │ │ │ -
    634 getReceive(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    │ │ │ │ -
    635 {
    │ │ │ │ -
    636 return info.second;
    │ │ │ │ -
    637 }
    │ │ │ │ -
    638};
    │ │ │ │ -
    639
    │ │ │ │ -
    640template<>
    │ │ │ │ -
    641struct InterfaceInformationChooser<false>
    │ │ │ │ -
    642{
    │ │ │ │ -
    643 static const InterfaceInformation&
    │ │ │ │ -
    644 getSend(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    │ │ │ │ -
    645 {
    │ │ │ │ -
    646 return info.second;
    │ │ │ │ -
    647 }
    │ │ │ │ -
    648
    │ │ │ │ -
    649 static const InterfaceInformation&
    │ │ │ │ -
    650 getReceive(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    │ │ │ │ -
    651 {
    │ │ │ │ -
    652 return info.first;
    │ │ │ │ -
    653 }
    │ │ │ │ -
    654};
    │ │ │ │ -
    655
    │ │ │ │ -
    661template<class DataHandle>
    │ │ │ │ -
    662struct PackEntries
    │ │ │ │ -
    663{
    │ │ │ │ -
    664
    │ │ │ │ -
    665 int operator()(DataHandle& handle, InterfaceTracker& tracker,
    │ │ │ │ -
    666 MessageBuffer<typename DataHandle::DataType>& buffer,
    │ │ │ │ -
    667 [[maybe_unused]] int i) const
    │ │ │ │ -
    668 {
    │ │ │ │ -
    669 return operator()(handle,tracker,buffer);
    │ │ │ │ -
    670 }
    │ │ │ │ -
    671
    │ │ │ │ -
    679 int operator()(DataHandle& handle, InterfaceTracker& tracker,
    │ │ │ │ -
    680 MessageBuffer<typename DataHandle::DataType>& buffer) const
    │ │ │ │ -
    681 {
    │ │ │ │ -
    682 if(tracker.fixedSize) // fixed size if variable is >0!
    │ │ │ │ -
    683 {
    │ │ │ │ -
    684
    │ │ │ │ -
    685 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize, tracker.indicesLeft());
    │ │ │ │ -
    686 for(std::size_t i=0; i< noIndices; ++i)
    │ │ │ │ -
    687 {
    │ │ │ │ -
    688 handle.gather(buffer, tracker.index());
    │ │ │ │ -
    689 tracker.moveToNextIndex();
    │ │ │ │ -
    690 }
    │ │ │ │ -
    691 return noIndices*tracker.fixedSize;
    │ │ │ │ -
    692 }
    │ │ │ │ -
    693 else
    │ │ │ │ -
    694 {
    │ │ │ │ -
    695 int packed=0;
    │ │ │ │ -
    696 tracker.skipZeroIndices();
    │ │ │ │ -
    697 while(!tracker.finished())
    │ │ │ │ -
    698 if(buffer.hasSpaceForItems(handle.size(tracker.index())))
    │ │ │ │ -
    699 {
    │ │ │ │ -
    700 handle.gather(buffer, tracker.index());
    │ │ │ │ -
    701 packed+=handle.size(tracker.index());
    │ │ │ │ -
    702 tracker.moveToNextIndex();
    │ │ │ │ -
    703 }
    │ │ │ │ -
    704 else
    │ │ │ │ -
    705 break;
    │ │ │ │ -
    706 return packed;
    │ │ │ │ -
    707 }
    │ │ │ │ -
    708 }
    │ │ │ │ -
    709};
    │ │ │ │ -
    710
    │ │ │ │ -
    716template<class DataHandle>
    │ │ │ │ -
    717struct UnpackEntries{
    │ │ │ │ -
    718
    │ │ │ │ -
    726 bool operator()(DataHandle& handle, InterfaceTracker& tracker,
    │ │ │ │ -
    727 MessageBuffer<typename DataHandle::DataType>& buffer,
    │ │ │ │ -
    728 int count=0)
    │ │ │ │ -
    729 {
    │ │ │ │ -
    730 if(tracker.fixedSize) // fixed size if variable is >0!
    │ │ │ │ -
    731 {
    │ │ │ │ -
    732 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize, tracker.indicesLeft());
    │ │ │ │ -
    733
    │ │ │ │ -
    734 for(std::size_t i=0; i< noIndices; ++i)
    │ │ │ │ -
    735 {
    │ │ │ │ -
    736 handle.scatter(buffer, tracker.index(), tracker.fixedSize);
    │ │ │ │ -
    737 tracker.moveToNextIndex();
    │ │ │ │ -
    738 }
    │ │ │ │ -
    739 return tracker.finished();
    │ │ │ │ -
    740 }
    │ │ │ │ -
    741 else
    │ │ │ │ -
    742 {
    │ │ │ │ -
    743 assert(count);
    │ │ │ │ -
    744 for(int unpacked=0;unpacked<count;)
    │ │ │ │ -
    745 {
    │ │ │ │ -
    746 assert(!tracker.finished());
    │ │ │ │ -
    747 assert(buffer.hasSpaceForItems(tracker.size()));
    │ │ │ │ -
    748 handle.scatter(buffer, tracker.index(), tracker.size());
    │ │ │ │ -
    749 unpacked+=tracker.size();
    │ │ │ │ -
    750 tracker.moveToNextIndex();
    │ │ │ │ -
    751 }
    │ │ │ │ -
    752 return tracker.finished();
    │ │ │ │ -
    753 }
    │ │ │ │ -
    754 }
    │ │ │ │ -
    755};
    │ │ │ │ -
    756
    │ │ │ │ -
    757
    │ │ │ │ -
    761template<class DataHandle>
    │ │ │ │ -
    762struct UnpackSizeEntries{
    │ │ │ │ -
    763
    │ │ │ │ -
    771 bool operator()(SizeDataHandle<DataHandle>& handle, InterfaceTracker& tracker,
    │ │ │ │ -
    772 MessageBuffer<typename SizeDataHandle<DataHandle>::DataType>& buffer) const
    │ │ │ │ -
    773 {
    │ │ │ │ -
    774 std::size_t noIndices=std::min(buffer.size(), tracker.indicesLeft());
    │ │ │ │ -
    775 std::copy(static_cast<std::size_t*>(buffer), static_cast<std::size_t*>(buffer)+noIndices,
    │ │ │ │ -
    776 handle.getSizesPointer()+tracker.offset());
    │ │ │ │ -
    777 tracker.increment(noIndices);
    │ │ │ │ -
    778 return noIndices;
    │ │ │ │ -
    779 }
    │ │ │ │ -
    780 bool operator()(SizeDataHandle<DataHandle>& handle, InterfaceTracker& tracker,
    │ │ │ │ -
    781 MessageBuffer<typename SizeDataHandle<DataHandle>::DataType>& buffer, int) const
    │ │ │ │ -
    782 {
    │ │ │ │ -
    783 return operator()(handle,tracker,buffer);
    │ │ │ │ -
    784 }
    │ │ │ │ -
    785};
    │ │ │ │ -
    786
    │ │ │ │ -
    794void sendFixedSize(std::vector<InterfaceTracker>& send_trackers,
    │ │ │ │ -
    795 std::vector<MPI_Request>& send_requests,
    │ │ │ │ -
    796 std::vector<InterfaceTracker>& recv_trackers,
    │ │ │ │ -
    797 std::vector<MPI_Request>& recv_requests,
    │ │ │ │ -
    798 MPI_Comm communicator)
    │ │ │ │ -
    799{
    │ │ │ │ -
    800 typedef std::vector<InterfaceTracker>::iterator TIter;
    │ │ │ │ -
    801 std::vector<MPI_Request>::iterator mIter=recv_requests.begin();
    │ │ │ │ -
    802
    │ │ │ │ -
    803 for(TIter iter=recv_trackers.begin(), end=recv_trackers.end(); iter!=end;
    │ │ │ │ -
    804 ++iter, ++mIter)
    │ │ │ │ -
    805 {
    │ │ │ │ -
    806 MPI_Irecv(&(iter->fixedSize), 1, MPITraits<std::size_t>::getType(),
    │ │ │ │ -
    807 iter->rank(), 933881, communicator, &(*mIter));
    │ │ │ │ -
    808 }
    │ │ │ │ -
    809
    │ │ │ │ -
    810 // Send our size to all neighbours using non-blocking synchronous communication.
    │ │ │ │ -
    811 std::vector<MPI_Request>::iterator mIter1=send_requests.begin();
    │ │ │ │ -
    812 for(TIter iter=send_trackers.begin(), end=send_trackers.end();
    │ │ │ │ -
    813 iter!=end;
    │ │ │ │ -
    814 ++iter, ++mIter1)
    │ │ │ │ -
    815 {
    │ │ │ │ -
    816 MPI_Issend(&(iter->fixedSize), 1, MPITraits<std::size_t>::getType(),
    │ │ │ │ -
    817 iter->rank(), 933881, communicator, &(*mIter1));
    │ │ │ │ -
    818 }
    │ │ │ │ -
    819}
    │ │ │ │ -
    820
    │ │ │ │ -
    821
    │ │ │ │ -
    826template<class DataHandle>
    │ │ │ │ -
    827struct SetupSendRequest{
    │ │ │ │ -
    828 void operator()(DataHandle& handle,
    │ │ │ │ -
    829 InterfaceTracker& tracker,
    │ │ │ │ -
    830 MessageBuffer<typename DataHandle::DataType>& buffer,
    │ │ │ │ -
    831 MPI_Request& request,
    │ │ │ │ -
    832 MPI_Comm comm) const
    │ │ │ │ -
    833 {
    │ │ │ │ -
    834 buffer.reset();
    │ │ │ │ -
    835 int size=PackEntries<DataHandle>()(handle, tracker, buffer);
    │ │ │ │ -
    836 // Skip indices of zero size.
    │ │ │ │ -
    837 while(!tracker.finished() && !handle.size(tracker.index()))
    │ │ │ │ -
    838 tracker.moveToNextIndex();
    │ │ │ │ -
    839 if(size)
    │ │ │ │ -
    840 MPI_Issend(buffer, size, MPITraits<typename DataHandle::DataType>::getType(),
    │ │ │ │ -
    841 tracker.rank(), 933399, comm, &request);
    │ │ │ │ -
    842 }
    │ │ │ │ -
    843};
    │ │ │ │ -
    844
    │ │ │ │ -
    845
    │ │ │ │ -
    850template<class DataHandle>
    │ │ │ │ -
    851struct SetupRecvRequest{
    │ │ │ │ -
    852 void operator()(DataHandle& /*handle*/,
    │ │ │ │ -
    853 InterfaceTracker& tracker,
    │ │ │ │ -
    854 MessageBuffer<typename DataHandle::DataType>& buffer,
    │ │ │ │ -
    855 MPI_Request& request,
    │ │ │ │ -
    856 MPI_Comm comm) const
    │ │ │ │ -
    857 {
    │ │ │ │ -
    858 buffer.reset();
    │ │ │ │ -
    859 if(tracker.indicesLeft())
    │ │ │ │ -
    860 MPI_Irecv(buffer, buffer.size(), MPITraits<typename DataHandle::DataType>::getType(),
    │ │ │ │ -
    861 tracker.rank(), 933399, comm, &request);
    │ │ │ │ -
    862 }
    │ │ │ │ -
    863};
    │ │ │ │ -
    864
    │ │ │ │ -
    868template<class DataHandle>
    │ │ │ │ -
    869struct NullPackUnpackFunctor
    │ │ │ │ -
    870{
    │ │ │ │ -
    871 int operator()(DataHandle&, InterfaceTracker&,
    │ │ │ │ -
    872 MessageBuffer<typename DataHandle::DataType>&, int)
    │ │ │ │ -
    873 {
    │ │ │ │ -
    874 return 0;
    │ │ │ │ -
    875 }
    │ │ │ │ -
    876 int operator()(DataHandle&, InterfaceTracker&,
    │ │ │ │ -
    877 MessageBuffer<typename DataHandle::DataType>&)
    │ │ │ │ -
    878 {
    │ │ │ │ -
    879 return 0;
    │ │ │ │ -
    880 }
    │ │ │ │ -
    881};
    │ │ │ │ -
    882
    │ │ │ │ -
    897template<class DataHandle, class BufferFunctor, class CommunicationFunctor>
    │ │ │ │ -
    898std::size_t checkAndContinue(DataHandle& handle,
    │ │ │ │ -
    899 std::vector<InterfaceTracker>& trackers,
    │ │ │ │ -
    900 std::vector<MPI_Request>& requests,
    │ │ │ │ -
    901 std::vector<MPI_Request>& requests2,
    │ │ │ │ -
    902 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    │ │ │ │ -
    903 MPI_Comm comm,
    │ │ │ │ -
    904 BufferFunctor buffer_func,
    │ │ │ │ -
    905 CommunicationFunctor comm_func,
    │ │ │ │ -
    906 bool valid=true,
    │ │ │ │ -
    907 bool getCount=false)
    │ │ │ │ -
    908{
    │ │ │ │ -
    909 std::size_t size=requests.size();
    │ │ │ │ -
    910 std::vector<MPI_Status> statuses(size);
    │ │ │ │ -
    911 int no_completed;
    │ │ │ │ -
    912 std::vector<int> indices(size, -1); // the indices for which the communication finished.
    │ │ │ │ -
    913
    │ │ │ │ -
    914 MPI_Testsome(size, &(requests[0]), &no_completed, &(indices[0]), &(statuses[0]));
    │ │ │ │ -
    915 indices.resize(no_completed);
    │ │ │ │ -
    916 for(std::vector<int>::iterator index=indices.begin(), end=indices.end();
    │ │ │ │ -
    917 index!=end; ++index)
    │ │ │ │ -
    918 {
    │ │ │ │ -
    919 InterfaceTracker& tracker=trackers[*index];
    │ │ │ │ -
    920 setReceivingIndex(handle, *index);
    │ │ │ │ -
    921 if(getCount)
    │ │ │ │ -
    922 {
    │ │ │ │ -
    923 // Get the number of entries received
    │ │ │ │ -
    924 int count;
    │ │ │ │ -
    925 MPI_Get_count(&(statuses[index-indices.begin()]),
    │ │ │ │ - │ │ │ │ -
    927 &count);
    │ │ │ │ -
    928 // Communication completed, we can reuse the buffers, e.g. unpack or repack
    │ │ │ │ -
    929 buffer_func(handle, tracker, buffers[*index], count);
    │ │ │ │ -
    930 }else
    │ │ │ │ -
    931 buffer_func(handle, tracker, buffers[*index]);
    │ │ │ │ -
    932 tracker.skipZeroIndices();
    │ │ │ │ -
    933 if(!tracker.finished()){
    │ │ │ │ -
    934 // Maybe start another communication.
    │ │ │ │ -
    935 comm_func(handle, tracker, buffers[*index], requests2[*index], comm);
    │ │ │ │ -
    936 tracker.skipZeroIndices();
    │ │ │ │ -
    937 if(valid)
    │ │ │ │ -
    938 --no_completed; // communication not finished, decrement counter for finished ones.
    │ │ │ │ -
    939 }
    │ │ │ │ -
    940 }
    │ │ │ │ -
    941 return no_completed;
    │ │ │ │ -
    942
    │ │ │ │ -
    943}
    │ │ │ │ -
    944
    │ │ │ │ -
    954template<class DataHandle>
    │ │ │ │ -
    955std::size_t receiveSizeAndSetupReceive(DataHandle& handle,
    │ │ │ │ -
    956 std::vector<InterfaceTracker>& trackers,
    │ │ │ │ -
    957 std::vector<MPI_Request>& size_requests,
    │ │ │ │ -
    958 std::vector<MPI_Request>& data_requests,
    │ │ │ │ -
    959 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    │ │ │ │ -
    960 MPI_Comm comm)
    │ │ │ │ -
    961{
    │ │ │ │ -
    962 return checkAndContinue(handle, trackers, size_requests, data_requests, buffers, comm,
    │ │ │ │ -
    963 NullPackUnpackFunctor<DataHandle>(), SetupRecvRequest<DataHandle>(), false);
    │ │ │ │ -
    964}
    │ │ │ │ -
    965
    │ │ │ │ -
    974template<class DataHandle>
    │ │ │ │ -
    975std::size_t checkSendAndContinueSending(DataHandle& handle,
    │ │ │ │ -
    976 std::vector<InterfaceTracker>& trackers,
    │ │ │ │ -
    977 std::vector<MPI_Request>& requests,
    │ │ │ │ -
    978 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    │ │ │ │ -
    979 MPI_Comm comm)
    │ │ │ │ -
    980{
    │ │ │ │ -
    981 return checkAndContinue(handle, trackers, requests, requests, buffers, comm,
    │ │ │ │ -
    982 NullPackUnpackFunctor<DataHandle>(), SetupSendRequest<DataHandle>());
    │ │ │ │ -
    983}
    │ │ │ │ -
    984
    │ │ │ │ -
    993template<class DataHandle>
    │ │ │ │ -
    994std::size_t checkReceiveAndContinueReceiving(DataHandle& handle,
    │ │ │ │ -
    995 std::vector<InterfaceTracker>& trackers,
    │ │ │ │ -
    996 std::vector<MPI_Request>& requests,
    │ │ │ │ -
    997 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    │ │ │ │ -
    998 MPI_Comm comm)
    │ │ │ │ -
    999{
    │ │ │ │ -
    1000 return checkAndContinue(handle, trackers, requests, requests, buffers, comm,
    │ │ │ │ -
    1001 UnpackEntries<DataHandle>(), SetupRecvRequest<DataHandle>(),
    │ │ │ │ -
    1002 true, !Impl::callFixedSize(handle));
    │ │ │ │ -
    1003}
    │ │ │ │ -
    1004
    │ │ │ │ -
    1005
    │ │ │ │ -
    1006bool validRecvRequests(const std::vector<MPI_Request> reqs)
    │ │ │ │ -
    1007{
    │ │ │ │ -
    1008 for(std::vector<MPI_Request>::const_iterator i=reqs.begin(), end=reqs.end();
    │ │ │ │ -
    1009 i!=end; ++i)
    │ │ │ │ -
    1010 if(*i!=MPI_REQUEST_NULL)
    │ │ │ │ -
    1011 return true;
    │ │ │ │ -
    1012 return false;
    │ │ │ │ -
    1013}
    │ │ │ │ -
    1014
    │ │ │ │ -
    1025template<class DataHandle, class Functor>
    │ │ │ │ -
    1026std::size_t setupRequests(DataHandle& handle,
    │ │ │ │ -
    1027 std::vector<InterfaceTracker>& trackers,
    │ │ │ │ -
    1028 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    │ │ │ │ -
    1029 std::vector<MPI_Request>& requests,
    │ │ │ │ -
    1030 const Functor& setupFunctor,
    │ │ │ │ -
    1031 MPI_Comm communicator)
    │ │ │ │ -
    1032{
    │ │ │ │ -
    1033 typedef typename std::vector<InterfaceTracker>::iterator TIter;
    │ │ │ │ -
    1034 typename std::vector<MessageBuffer<typename DataHandle::DataType> >::iterator
    │ │ │ │ -
    1035 biter=buffers.begin();
    │ │ │ │ -
    1036 typename std::vector<MPI_Request>::iterator riter=requests.begin();
    │ │ │ │ -
    1037 std::size_t complete=0;
    │ │ │ │ -
    1038 for(TIter titer=trackers.begin(), end=trackers.end(); titer!=end; ++titer, ++biter, ++riter)
    │ │ │ │ -
    1039 {
    │ │ │ │ -
    1040 setupFunctor(handle, *titer, *biter, *riter, communicator);
    │ │ │ │ -
    1041 complete+=titer->finished();
    │ │ │ │ -
    1042 }
    │ │ │ │ -
    1043 return complete;
    │ │ │ │ -
    1044}
    │ │ │ │ -
    1045} // end unnamed namespace
    │ │ │ │ -
    1046
    │ │ │ │ -
    1047template<class Allocator>
    │ │ │ │ -
    1048template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    1049void VariableSizeCommunicator<Allocator>::setupInterfaceTrackers(DataHandle& handle,
    │ │ │ │ -
    1050 std::vector<InterfaceTracker>& send_trackers,
    │ │ │ │ -
    1051 std::vector<InterfaceTracker>& recv_trackers)
    │ │ │ │ -
    1052{
    │ │ │ │ -
    1053 if(interface_->size()==0)
    │ │ │ │ -
    1054 return;
    │ │ │ │ -
    1055 send_trackers.reserve(interface_->size());
    │ │ │ │ -
    1056 recv_trackers.reserve(interface_->size());
    │ │ │ │ -
    1057
    │ │ │ │ -
    1058 int fixedsize=0;
    │ │ │ │ -
    1059 if(Impl::callFixedSize(handle))
    │ │ │ │ -
    1060 ++fixedsize;
    │ │ │ │ -
    1061
    │ │ │ │ -
    1062
    │ │ │ │ -
    1063 typedef typename InterfaceMap::const_iterator IIter;
    │ │ │ │ -
    1064 for(IIter inf=interface_->begin(), end=interface_->end(); inf!=end; ++inf)
    │ │ │ │ -
    1065 {
    │ │ │ │ -
    1066
    │ │ │ │ -
    1067 if(Impl::callFixedSize(handle) && InterfaceInformationChooser<FORWARD>::getSend(inf->second).size())
    │ │ │ │ -
    1068 fixedsize=handle.size(InterfaceInformationChooser<FORWARD>::getSend(inf->second)[0]);
    │ │ │ │ -
    1069 assert(!Impl::callFixedSize(handle)||fixedsize>0);
    │ │ │ │ -
    1070 send_trackers.push_back(InterfaceTracker(inf->first,
    │ │ │ │ -
    1071 InterfaceInformationChooser<FORWARD>::getSend(inf->second), fixedsize));
    │ │ │ │ -
    1072 recv_trackers.push_back(InterfaceTracker(inf->first,
    │ │ │ │ -
    1073 InterfaceInformationChooser<FORWARD>::getReceive(inf->second), fixedsize, fixedsize==0));
    │ │ │ │ -
    1074 }
    │ │ │ │ -
    1075}
    │ │ │ │ -
    1076
    │ │ │ │ -
    1077template<class Allocator>
    │ │ │ │ -
    1078template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    1079void VariableSizeCommunicator<Allocator>::communicateFixedSize(DataHandle& handle)
    │ │ │ │ -
    1080{
    │ │ │ │ -
    1081 std::vector<MPI_Request> size_send_req(interface_->size());
    │ │ │ │ -
    1082 std::vector<MPI_Request> size_recv_req(interface_->size());
    │ │ │ │ -
    1083
    │ │ │ │ -
    1084 std::vector<InterfaceTracker> send_trackers;
    │ │ │ │ -
    1085 std::vector<InterfaceTracker> recv_trackers;
    │ │ │ │ -
    1086 setupInterfaceTrackers<FORWARD>(handle,send_trackers, recv_trackers);
    │ │ │ │ -
    1087 sendFixedSize(send_trackers, size_send_req, recv_trackers, size_recv_req, communicator_);
    │ │ │ │ -
    1088
    │ │ │ │ -
    1089 std::vector<MPI_Request> data_send_req(interface_->size(), MPI_REQUEST_NULL);
    │ │ │ │ -
    1090 std::vector<MPI_Request> data_recv_req(interface_->size(), MPI_REQUEST_NULL);
    │ │ │ │ -
    1091 typedef typename DataHandle::DataType DataType;
    │ │ │ │ -
    1092 std::vector<MessageBuffer<DataType> > send_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_)),
    │ │ │ │ -
    1093 recv_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_));
    │ │ │ │ -
    1094
    │ │ │ │ -
    1095
    │ │ │ │ -
    1096 setupRequests(handle, send_trackers, send_buffers, data_send_req,
    │ │ │ │ -
    1097 SetupSendRequest<DataHandle>(), communicator_);
    │ │ │ │ -
    1098
    │ │ │ │ -
    1099 std::size_t no_size_to_recv, no_to_send, no_to_recv, old_size;
    │ │ │ │ -
    1100 no_size_to_recv = no_to_send = no_to_recv = old_size = interface_->size();
    │ │ │ │ -
    1101
    │ │ │ │ -
    1102 // Skip empty interfaces.
    │ │ │ │ -
    1103 typedef typename std::vector<InterfaceTracker>::const_iterator Iter;
    │ │ │ │ -
    1104 for(Iter i=recv_trackers.begin(), end=recv_trackers.end(); i!=end; ++i)
    │ │ │ │ -
    1105 if(i->empty())
    │ │ │ │ -
    1106 --no_to_recv;
    │ │ │ │ -
    1107 for(Iter i=send_trackers.begin(), end=send_trackers.end(); i!=end; ++i)
    │ │ │ │ -
    1108 if(i->empty())
    │ │ │ │ -
    1109 --no_to_send;
    │ │ │ │ -
    1110
    │ │ │ │ -
    1111 while(no_size_to_recv+no_to_send+no_to_recv)
    │ │ │ │ -
    1112 {
    │ │ │ │ -
    1113 // Receive the fixedsize and setup receives accordingly
    │ │ │ │ -
    1114 if(no_size_to_recv)
    │ │ │ │ -
    1115 no_size_to_recv -= receiveSizeAndSetupReceive(handle,recv_trackers, size_recv_req,
    │ │ │ │ -
    1116 data_recv_req, recv_buffers,
    │ │ │ │ -
    1117 communicator_);
    │ │ │ │ -
    1118
    │ │ │ │ -
    1119 // Check send completion and initiate other necessary sends
    │ │ │ │ -
    1120 if(no_to_send)
    │ │ │ │ -
    1121 no_to_send -= checkSendAndContinueSending(handle, send_trackers, data_send_req,
    │ │ │ │ -
    1122 send_buffers, communicator_);
    │ │ │ │ -
    1123 if(validRecvRequests(data_recv_req))
    │ │ │ │ -
    1124 // Receive data and setup new unblocking receives if necessary
    │ │ │ │ -
    1125 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers, data_recv_req,
    │ │ │ │ -
    1126 recv_buffers, communicator_);
    │ │ │ │ -
    1127 }
    │ │ │ │ -
    1128
    │ │ │ │ -
    1129 // Wait for completion of sending the size.
    │ │ │ │ -
    1130 //std::vector<MPI_Status> statuses(interface_->size(), MPI_STATUSES_IGNORE);
    │ │ │ │ -
    1131 MPI_Waitall(size_send_req.size(), &(size_send_req[0]), MPI_STATUSES_IGNORE);
    │ │ │ │ -
    1132
    │ │ │ │ -
    1133}
    │ │ │ │ -
    1134
    │ │ │ │ -
    1135template<class Allocator>
    │ │ │ │ -
    1136template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    1137void VariableSizeCommunicator<Allocator>::communicateSizes(DataHandle& handle,
    │ │ │ │ -
    1138 std::vector<InterfaceTracker>& data_recv_trackers)
    │ │ │ │ -
    1139{
    │ │ │ │ -
    1140 std::vector<InterfaceTracker> send_trackers;
    │ │ │ │ -
    1141 std::vector<InterfaceTracker> recv_trackers;
    │ │ │ │ -
    1142 std::size_t size = interface_->size();
    │ │ │ │ -
    1143 std::vector<MPI_Request> send_requests(size, MPI_REQUEST_NULL);
    │ │ │ │ -
    1144 std::vector<MPI_Request> recv_requests(size, MPI_REQUEST_NULL);
    │ │ │ │ -
    1145 std::vector<MessageBuffer<std::size_t> >
    │ │ │ │ -
    1146 send_buffers(size, MessageBuffer<std::size_t>(maxBufferSize_)),
    │ │ │ │ -
    1147 recv_buffers(size, MessageBuffer<std::size_t>(maxBufferSize_));
    │ │ │ │ -
    1148 SizeDataHandle<DataHandle> size_handle(handle,data_recv_trackers);
    │ │ │ │ -
    1149 setupInterfaceTrackers<FORWARD>(size_handle,send_trackers, recv_trackers);
    │ │ │ │ -
    1150 setupRequests(size_handle, send_trackers, send_buffers, send_requests,
    │ │ │ │ -
    1151 SetupSendRequest<SizeDataHandle<DataHandle> >(), communicator_);
    │ │ │ │ -
    1152 setupRequests(size_handle, recv_trackers, recv_buffers, recv_requests,
    │ │ │ │ -
    1153 SetupRecvRequest<SizeDataHandle<DataHandle> >(), communicator_);
    │ │ │ │ -
    1154
    │ │ │ │ -
    1155 // Count valid requests that we have to wait for.
    │ │ │ │ -
    1156 auto valid_req_func =
    │ │ │ │ -
    1157 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL; };
    │ │ │ │ -
    1158
    │ │ │ │ -
    1159 auto size_to_send = std::count_if(send_requests.begin(), send_requests.end(),
    │ │ │ │ -
    1160 valid_req_func);
    │ │ │ │ -
    1161 auto size_to_recv = std::count_if(recv_requests.begin(), recv_requests.end(),
    │ │ │ │ -
    1162 valid_req_func);
    │ │ │ │ -
    1163
    │ │ │ │ -
    1164 while(size_to_send+size_to_recv)
    │ │ │ │ -
    1165 {
    │ │ │ │ -
    1166 if(size_to_send)
    │ │ │ │ -
    1167 size_to_send -=
    │ │ │ │ -
    1168 checkSendAndContinueSending(size_handle, send_trackers, send_requests,
    │ │ │ │ -
    1169 send_buffers, communicator_);
    │ │ │ │ -
    1170 if(size_to_recv)
    │ │ │ │ -
    1171 // Could have done this using checkSendAndContinueSending
    │ │ │ │ -
    1172 // But the call below is more efficient as UnpackSizeEntries
    │ │ │ │ -
    1173 // uses std::copy.
    │ │ │ │ -
    1174 size_to_recv -=
    │ │ │ │ -
    1175 checkAndContinue(size_handle, recv_trackers, recv_requests, recv_requests,
    │ │ │ │ -
    1176 recv_buffers, communicator_, UnpackSizeEntries<DataHandle>(),
    │ │ │ │ -
    1177 SetupRecvRequest<SizeDataHandle<DataHandle> >());
    │ │ │ │ -
    1178 }
    │ │ │ │ -
    1179}
    │ │ │ │ -
    1180
    │ │ │ │ -
    1181template<class Allocator>
    │ │ │ │ -
    1182template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    1183void VariableSizeCommunicator<Allocator>::communicateVariableSize(DataHandle& handle)
    │ │ │ │ -
    1184{
    │ │ │ │ -
    1185
    │ │ │ │ -
    1186 std::vector<InterfaceTracker> send_trackers;
    │ │ │ │ -
    1187 std::vector<InterfaceTracker> recv_trackers;
    │ │ │ │ -
    1188 setupInterfaceTrackers<FORWARD>(handle, send_trackers, recv_trackers);
    │ │ │ │ -
    1189
    │ │ │ │ -
    1190 std::vector<MPI_Request> send_requests(interface_->size(), MPI_REQUEST_NULL);
    │ │ │ │ -
    1191 std::vector<MPI_Request> recv_requests(interface_->size(), MPI_REQUEST_NULL);
    │ │ │ │ -
    1192 typedef typename DataHandle::DataType DataType;
    │ │ │ │ -
    1193 std::vector<MessageBuffer<DataType> >
    │ │ │ │ -
    1194 send_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_)),
    │ │ │ │ -
    1195 recv_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_));
    │ │ │ │ -
    1196
    │ │ │ │ -
    1197 communicateSizes<FORWARD>(handle, recv_trackers);
    │ │ │ │ -
    1198 // Setup requests for sending and receiving.
    │ │ │ │ -
    1199 setupRequests(handle, send_trackers, send_buffers, send_requests,
    │ │ │ │ -
    1200 SetupSendRequest<DataHandle>(), communicator_);
    │ │ │ │ -
    1201 setupRequests(handle, recv_trackers, recv_buffers, recv_requests,
    │ │ │ │ -
    1202 SetupRecvRequest<DataHandle>(), communicator_);
    │ │ │ │ -
    1203
    │ │ │ │ -
    1204 // Determine number of valid requests.
    │ │ │ │ -
    1205 auto valid_req_func =
    │ │ │ │ -
    1206 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL;};
    │ │ │ │ -
    1207
    │ │ │ │ -
    1208 auto no_to_send = std::count_if(send_requests.begin(), send_requests.end(),
    │ │ │ │ -
    1209 valid_req_func);
    │ │ │ │ -
    1210 auto no_to_recv = std::count_if(recv_requests.begin(), recv_requests.end(),
    │ │ │ │ -
    1211 valid_req_func);
    │ │ │ │ -
    1212 while(no_to_send+no_to_recv)
    │ │ │ │ -
    1213 {
    │ │ │ │ -
    1214 // Check send completion and initiate other necessary sends
    │ │ │ │ -
    1215 if(no_to_send)
    │ │ │ │ -
    1216 no_to_send -= checkSendAndContinueSending(handle, send_trackers, send_requests,
    │ │ │ │ -
    1217 send_buffers, communicator_);
    │ │ │ │ -
    1218 if(no_to_recv)
    │ │ │ │ -
    1219 // Receive data and setup new unblocking receives if necessary
    │ │ │ │ -
    1220 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers, recv_requests,
    │ │ │ │ -
    1221 recv_buffers, communicator_);
    │ │ │ │ -
    1222 }
    │ │ │ │ -
    1223}
    │ │ │ │ -
    1224
    │ │ │ │ -
    1225template<class Allocator>
    │ │ │ │ -
    1226template<bool FORWARD, class DataHandle>
    │ │ │ │ -
    1227void VariableSizeCommunicator<Allocator>::communicate(DataHandle& handle)
    │ │ │ │ -
    1228{
    │ │ │ │ -
    1229 if( interface_->size() == 0)
    │ │ │ │ -
    1230 // Simply return as otherwise we will index an empty container
    │ │ │ │ -
    1231 // either for MPI_Wait_all or MPI_Test_some.
    │ │ │ │ -
    1232 return;
    │ │ │ │ -
    1233
    │ │ │ │ -
    1234 if(Impl::callFixedSize(handle))
    │ │ │ │ -
    1235 communicateFixedSize<FORWARD>(handle);
    │ │ │ │ -
    1236 else
    │ │ │ │ -
    1237 communicateVariableSize<FORWARD>(handle);
    │ │ │ │ -
    1238}
    │ │ │ │ -
    1239} // end namespace Dune
    │ │ │ │ -
    1240
    │ │ │ │ -
    1241#endif // HAVE_MPI
    │ │ │ │ -
    1242
    │ │ │ │ -
    1243#endif
    │ │ │ │ -
    Infrastructure for concepts.
    │ │ │ │ -
    Traits classes for mapping types onto MPI_Datatype.
    │ │ │ │ -
    std::size_t fixedSize
    The number of data items per index if it is fixed, 0 otherwise.
    Definition variablesizecommunicator.hh:265
    │ │ │ │ -
    MPI_Comm communicator() const
    Get the MPI Communicator.
    Definition parallel/interface.hh:417
    │ │ │ │ +
    26#endif
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    static MPI_Datatype getType()
    Definition mpitraits.hh:48
    │ │ │ │ -
    size_t size() const
    Get the number of entries in the interface.
    Definition parallel/interface.hh:108
    │ │ │ │ -
    Communication interface between remote and local indices.
    Definition parallel/interface.hh:209
    │ │ │ │ -
    Definition variablesizecommunicator.hh:43
    │ │ │ │ -
    auto require(H &&h) -> decltype(h.fixedSize())
    │ │ │ │ -
    A buffered communicator where the amount of data sent does not have to be known a priori.
    Definition variablesizecommunicator.hh:332
    │ │ │ │ -
    VariableSizeCommunicator(const Interface &inf, std::size_t max_buffer_size)
    Creates a communicator with a specific maximum buffer size.
    Definition variablesizecommunicator.hh:404
    │ │ │ │ -
    void backward(DataHandle &handle)
    Communicate backwards.
    Definition variablesizecommunicator.hh:486
    │ │ │ │ -
    ~VariableSizeCommunicator()
    Definition variablesizecommunicator.hh:410
    │ │ │ │ -
    VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf, std::size_t max_buffer_size)
    Creates a communicator with a specific maximum buffer size.
    Definition variablesizecommunicator.hh:393
    │ │ │ │ -
    VariableSizeCommunicator(const VariableSizeCommunicator &other)
    Copy-constructs a communicator.
    Definition variablesizecommunicator.hh:419
    │ │ │ │ -
    void forward(DataHandle &handle)
    Communicate forward.
    Definition variablesizecommunicator.hh:461
    │ │ │ │ -
    VariableSizeCommunicator & operator=(const VariableSizeCommunicator &other)
    Copy-assignes a communicator.
    Definition variablesizecommunicator.hh:429
    │ │ │ │ -
    std::map< int, std::pair< InterfaceInformation, InterfaceInformation >, std::less< int >, typename std::allocator_traits< Allocator >::template rebind_alloc< std::pair< const int, std::pair< InterfaceInformation, InterfaceInformation > > > > InterfaceMap
    The type of the map from process number to InterfaceInformation for sending and receiving to and from...
    Definition variablesizecommunicator.hh:340
    │ │ │ │ -
    VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf)
    Creates a communicator with the default maximum buffer size.
    Definition variablesizecommunicator.hh:349
    │ │ │ │ -
    VariableSizeCommunicator(const Interface &inf)
    Creates a communicator with the default maximum buffer size.
    Definition variablesizecommunicator.hh:358
    │ │ │ │ -
    Provides classes for building the communication interface between remote indices.
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,993 +1,42 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -variablesizecommunicator.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +variant.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH // Still fits the │ │ │ │ │ -line! │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_VARIANT_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_VARIANT_HH │ │ │ │ │ 7 │ │ │ │ │ -8#if HAVE_MPI │ │ │ │ │ -9 │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20#include │ │ │ │ │ -21 │ │ │ │ │ -22#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_o_n_c_e_p_t_._h_h> │ │ │ │ │ -23#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ +8#warning dune/common/std/variant.hh is deprecated and will be removed after │ │ │ │ │ +Dune 2.8.\ │ │ │ │ │ +9 Include instead │ │ │ │ │ +10 │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13namespace _D_u_n_e { │ │ │ │ │ +14namespace Std { │ │ │ │ │ +15 using std::variant; │ │ │ │ │ +16 using std::visit; │ │ │ │ │ +17 using std::variant_size; │ │ │ │ │ +18 using std::variant_size_v; │ │ │ │ │ +19 using std::get; │ │ │ │ │ +20 using std::get_if; │ │ │ │ │ +21 using std::holds_alternative; │ │ │ │ │ +22 using std::monostate; │ │ │ │ │ +23} │ │ │ │ │ +24} │ │ │ │ │ 25 │ │ │ │ │ -38namespace _D_u_n_e │ │ │ │ │ -39{ │ │ │ │ │ -40 │ │ │ │ │ -41namespace Concept { │ │ │ │ │ -42 │ │ │ │ │ -_4_3struct _H_a_s_F_i_x_e_d_S_i_z_e { │ │ │ │ │ -_4_4 template auto _r_e_q_u_i_r_e(H &&h) -> decltype(h.fixedSize()); │ │ │ │ │ -45}; │ │ │ │ │ -46 │ │ │ │ │ -47} // namespace Concept │ │ │ │ │ -48 │ │ │ │ │ -49namespace Impl { │ │ │ │ │ -50 │ │ │ │ │ -51template (), int> = 0> │ │ │ │ │ -53constexpr bool callFixedSize(H &&handle) { │ │ │ │ │ -54 return handle.fixedSize(); │ │ │ │ │ -55} │ │ │ │ │ -56 │ │ │ │ │ -57} // namespace Impl │ │ │ │ │ -58 │ │ │ │ │ -59namespace │ │ │ │ │ -60{ │ │ │ │ │ -65template > │ │ │ │ │ -66class MessageBuffer │ │ │ │ │ -67{ │ │ │ │ │ -68public: │ │ │ │ │ -73 explicit MessageBuffer(int size) │ │ │ │ │ -74 : buffer_(new T[size]), size_(size), position_(0) │ │ │ │ │ -75 {} │ │ │ │ │ -80 explicit MessageBuffer(const MessageBuffer& o) │ │ │ │ │ -81 : buffer_(new T[o.size_]), size_(o.size_), position_(o.position_) │ │ │ │ │ -82 { │ │ │ │ │ -83 } │ │ │ │ │ -85 ~MessageBuffer() │ │ │ │ │ -86 { │ │ │ │ │ -87 delete[] buffer_; │ │ │ │ │ -88 } │ │ │ │ │ -93 void write(const T& data) │ │ │ │ │ -94 { │ │ │ │ │ -95 buffer_[position_++]=data; │ │ │ │ │ -96 } │ │ │ │ │ -97 │ │ │ │ │ -102 void read(T& data) │ │ │ │ │ -103 { │ │ │ │ │ -104 data=buffer_[position_++]; │ │ │ │ │ -105 } │ │ │ │ │ -106 │ │ │ │ │ -112 void reset() │ │ │ │ │ -113 { │ │ │ │ │ -114 position_=0; │ │ │ │ │ -115 } │ │ │ │ │ -116 │ │ │ │ │ -121 bool finished() │ │ │ │ │ -122 { │ │ │ │ │ -123 return position_==size_; │ │ │ │ │ -124 } │ │ │ │ │ -125 │ │ │ │ │ -131 bool hasSpaceForItems(int noItems) │ │ │ │ │ -132 { │ │ │ │ │ -133 return position_+noItems<=size_; │ │ │ │ │ -134 } │ │ │ │ │ -139 std::size_t size() const │ │ │ │ │ -140 { │ │ │ │ │ -141 return size_; │ │ │ │ │ -142 } │ │ │ │ │ -147 operator T*() │ │ │ │ │ -148 { │ │ │ │ │ -149 return buffer_; │ │ │ │ │ -150 } │ │ │ │ │ -151 │ │ │ │ │ -152private: │ │ │ │ │ -156 T* buffer_; │ │ │ │ │ -160 std::size_t size_; │ │ │ │ │ -164 std::size_t position_; │ │ │ │ │ -165}; │ │ │ │ │ -166 │ │ │ │ │ -170class InterfaceTracker │ │ │ │ │ -171{ │ │ │ │ │ -172public: │ │ │ │ │ -178 InterfaceTracker(int rank, InterfaceInformation info, std::size_t │ │ │ │ │ -fixedsize=0, │ │ │ │ │ -179 bool allocateSizes=false) │ │ │ │ │ -180 : _f_i_x_e_d_S_i_z_e(fixedsize),rank_(rank), index_(), interface_(info), sizes_() │ │ │ │ │ -181 { │ │ │ │ │ -182 if(allocateSizes) │ │ │ │ │ -183 { │ │ │ │ │ -184 sizes_.resize(info.size()); │ │ │ │ │ -185 } │ │ │ │ │ -186 } │ │ │ │ │ -187 │ │ │ │ │ -191 void moveToNextIndex() │ │ │ │ │ -192 { │ │ │ │ │ -193 index_++; │ │ │ │ │ -194 assert(index_<=interface_.size()); │ │ │ │ │ -195 skipZeroIndices(); │ │ │ │ │ -196 } │ │ │ │ │ -201 void increment(std::size_t i) │ │ │ │ │ -202 { │ │ │ │ │ -203 index_+=i; │ │ │ │ │ -204 assert(index_<=interface_.size()); │ │ │ │ │ -205 } │ │ │ │ │ -210 bool finished() const │ │ │ │ │ -211 { │ │ │ │ │ -212 return index_==interface_.size(); │ │ │ │ │ -213 } │ │ │ │ │ -214 │ │ │ │ │ -215 void skipZeroIndices() │ │ │ │ │ -216 { │ │ │ │ │ -217 // skip indices with size zero! │ │ │ │ │ -218 while(sizes_.size() && index_!=interface_.size() &&!size()) │ │ │ │ │ -219 ++index_; │ │ │ │ │ -220 } │ │ │ │ │ -221 │ │ │ │ │ -226 std::size_t index() const │ │ │ │ │ -227 { │ │ │ │ │ -228 return interface_[index_]; │ │ │ │ │ -229 } │ │ │ │ │ -233 std::size_t size() const │ │ │ │ │ -234 { │ │ │ │ │ -235 assert(sizes_.size()); │ │ │ │ │ -236 return sizes_[index_]; │ │ │ │ │ -237 } │ │ │ │ │ -241 std::size_t* getSizesPointer() │ │ │ │ │ -242 { │ │ │ │ │ -243 return &sizes_[0]; │ │ │ │ │ -244 } │ │ │ │ │ -249 bool empty() const │ │ │ │ │ -250 { │ │ │ │ │ -251 return !interface_.size(); │ │ │ │ │ -252 } │ │ │ │ │ -253 │ │ │ │ │ -258 std::size_t indicesLeft() const │ │ │ │ │ -259 { │ │ │ │ │ -260 return interface_.size()-index_; │ │ │ │ │ -261 } │ │ │ │ │ -_2_6_5 std::size_t _f_i_x_e_d_S_i_z_e; │ │ │ │ │ -269 int rank() const │ │ │ │ │ -270 { │ │ │ │ │ -271 return rank_; │ │ │ │ │ -272 } │ │ │ │ │ -276 std::size_t offset() const │ │ │ │ │ -277 { │ │ │ │ │ -278 return index_; │ │ │ │ │ -279 } │ │ │ │ │ -280private: │ │ │ │ │ -282 int rank_; │ │ │ │ │ -284 std::size_t index_; │ │ │ │ │ -286 InterfaceInformation interface_; │ │ │ │ │ -287 std::vector sizes_; │ │ │ │ │ -288}; │ │ │ │ │ -289 │ │ │ │ │ -290 │ │ │ │ │ -291} // end unnamed namespace │ │ │ │ │ -292 │ │ │ │ │ -330template > > │ │ │ │ │ -_3_3_1class _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -332{ │ │ │ │ │ -333public: │ │ │ │ │ -338 typedef std::map, │ │ │ │ │ -339 std::less, │ │ │ │ │ -_3_4_0 typename std::allocator_traits::template rebind_alloc< std:: │ │ │ │ │ -pair > > > │ │ │ │ │ -_I_n_t_e_r_f_a_c_e_M_a_p; │ │ │ │ │ -341 │ │ │ │ │ -342#ifndef DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE │ │ │ │ │ -_3_4_9 _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r(MPI_Comm comm, const _I_n_t_e_r_f_a_c_e_M_a_p& inf) │ │ │ │ │ -350 : maxBufferSize_(32768), interface_(&inf) │ │ │ │ │ -351 { │ │ │ │ │ -352 MPI_Comm_dup(comm, &communicator_); │ │ │ │ │ -353 } │ │ │ │ │ -_3_5_8 _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r(const _I_n_t_e_r_f_a_c_e& inf) │ │ │ │ │ -359 : maxBufferSize_(32768), interface_(&inf.interfaces()) │ │ │ │ │ -360 { │ │ │ │ │ -361 MPI_Comm_dup(inf._c_o_m_m_u_n_i_c_a_t_o_r(), &communicator_); │ │ │ │ │ -362 } │ │ │ │ │ -363#else │ │ │ │ │ -370 _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r(MPI_Comm comm, _I_n_t_e_r_f_a_c_e_M_a_p& inf) │ │ │ │ │ -371 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE), │ │ │ │ │ -372 interface_(&inf) │ │ │ │ │ -373 { │ │ │ │ │ -374 MPI_Comm_dup(comm, &communicator_); │ │ │ │ │ -375 } │ │ │ │ │ -380 VariableSizeCommunicator(const Interface& inf) │ │ │ │ │ -381 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE), │ │ │ │ │ -382 interface_(&inf.interfaces()) │ │ │ │ │ -383 { │ │ │ │ │ -384 MPI_Comm_dup(inf.communicator(), &communicator_); │ │ │ │ │ -385 } │ │ │ │ │ -386#endif │ │ │ │ │ -_3_9_3 _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r(MPI_Comm comm, const _I_n_t_e_r_f_a_c_e_M_a_p& inf, std:: │ │ │ │ │ -size_t max_buffer_size) │ │ │ │ │ -394 : maxBufferSize_(max_buffer_size), interface_(&inf) │ │ │ │ │ -395 { │ │ │ │ │ -396 MPI_Comm_dup(comm, &communicator_); │ │ │ │ │ -397 } │ │ │ │ │ -398 │ │ │ │ │ -_4_0_4 _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r(const _I_n_t_e_r_f_a_c_e& inf, std::size_t max_buffer_size) │ │ │ │ │ -405 : maxBufferSize_(max_buffer_size), interface_(&inf.interfaces()) │ │ │ │ │ -406 { │ │ │ │ │ -407 MPI_Comm_dup(inf._c_o_m_m_u_n_i_c_a_t_o_r(), &communicator_); │ │ │ │ │ -408 } │ │ │ │ │ -409 │ │ │ │ │ -_4_1_0 _~_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r() │ │ │ │ │ -411 { │ │ │ │ │ -412 MPI_Comm_free(&communicator_); │ │ │ │ │ -413 } │ │ │ │ │ -414 │ │ │ │ │ -_4_1_9 _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r(const _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r& other) { │ │ │ │ │ -420 maxBufferSize_ = other.maxBufferSize_; │ │ │ │ │ -421 interface_ = other.interface_; │ │ │ │ │ -422 MPI_Comm_dup(other.communicator_, &communicator_); │ │ │ │ │ -423 } │ │ │ │ │ -424 │ │ │ │ │ -_4_2_9 _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r& _o_p_e_r_a_t_o_r_=(const _V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r& other) │ │ │ │ │ -{ │ │ │ │ │ -430 if(this == &other) // don't do anything if objects are the same │ │ │ │ │ -431 return *this; │ │ │ │ │ -432 │ │ │ │ │ -433 maxBufferSize_ = other.maxBufferSize_; │ │ │ │ │ -434 interface_ = other.interface_; │ │ │ │ │ -435 MPI_Comm_free(&communicator_); │ │ │ │ │ -436 MPI_Comm_dup(other.communicator_, &communicator_); │ │ │ │ │ -437 │ │ │ │ │ -438 return *this; │ │ │ │ │ -439 } │ │ │ │ │ -440 │ │ │ │ │ -460 template │ │ │ │ │ -_4_6_1 void _f_o_r_w_a_r_d(DataHandle& handle) │ │ │ │ │ -462 { │ │ │ │ │ -463 communicate(handle); │ │ │ │ │ -464 } │ │ │ │ │ -465 │ │ │ │ │ -485 template │ │ │ │ │ -_4_8_6 void _b_a_c_k_w_a_r_d(DataHandle& handle) │ │ │ │ │ -487 { │ │ │ │ │ -488 communicate(handle); │ │ │ │ │ -489 } │ │ │ │ │ -490 │ │ │ │ │ -491private: │ │ │ │ │ -492 template │ │ │ │ │ -493 void communicateSizes(DataHandle& handle, │ │ │ │ │ -494 std::vector& recv_trackers); │ │ │ │ │ -495 │ │ │ │ │ -502 template │ │ │ │ │ -503 void communicate(DataHandle& handle); │ │ │ │ │ -513 template │ │ │ │ │ -514 void setupInterfaceTrackers(DataHandle& handle, │ │ │ │ │ -515 std::vector& send_trackers, │ │ │ │ │ -516 std::vector& recv_trackers); │ │ │ │ │ -524 template │ │ │ │ │ -525 void communicateFixedSize(DataHandle& handle); │ │ │ │ │ -533 template │ │ │ │ │ -534 void communicateVariableSize(DataHandle& handle); │ │ │ │ │ -541 std::size_t maxBufferSize_; │ │ │ │ │ -549 const _I_n_t_e_r_f_a_c_e_M_a_p* interface_; │ │ │ │ │ -555 MPI_Comm communicator_; │ │ │ │ │ -556}; │ │ │ │ │ -557 │ │ │ │ │ -559namespace │ │ │ │ │ -560{ │ │ │ │ │ -564template │ │ │ │ │ -565class SizeDataHandle │ │ │ │ │ -566{ │ │ │ │ │ -567public: │ │ │ │ │ -568 typedef std::size_t DataType; │ │ │ │ │ -569 │ │ │ │ │ -570 SizeDataHandle(DataHandle& data, │ │ │ │ │ -571 std::vector& trackers) │ │ │ │ │ -572 : data_(data), trackers_(trackers), index_() │ │ │ │ │ -573 {} │ │ │ │ │ -574 bool _f_i_x_e_d_S_i_z_e() │ │ │ │ │ -575 { │ │ │ │ │ -576 return true; │ │ │ │ │ -577 } │ │ │ │ │ -578 std::size_t size([[maybe_unused]] std::size_t i) │ │ │ │ │ -579 { │ │ │ │ │ -580 return 1; │ │ │ │ │ -581 } │ │ │ │ │ -582 template │ │ │ │ │ -583 void gather(B& buf, int i) │ │ │ │ │ -584 { │ │ │ │ │ -585 buf.write(data_.size(i)); │ │ │ │ │ -586 } │ │ │ │ │ -587 void setReceivingIndex(std::size_t i) │ │ │ │ │ -588 { │ │ │ │ │ -589 index_=i; │ │ │ │ │ -590 } │ │ │ │ │ -591 std::size_t* getSizesPointer() │ │ │ │ │ -592 { │ │ │ │ │ -593 return trackers_[index_].getSizesPointer(); │ │ │ │ │ -594 } │ │ │ │ │ -595 │ │ │ │ │ -596private: │ │ │ │ │ -597 DataHandle& data_; │ │ │ │ │ -598 std::vector& trackers_; │ │ │ │ │ -599 int index_; │ │ │ │ │ -600}; │ │ │ │ │ -601 │ │ │ │ │ -602template │ │ │ │ │ -603void setReceivingIndex(T&, int) │ │ │ │ │ -604{} │ │ │ │ │ -605 │ │ │ │ │ -606template │ │ │ │ │ -607void setReceivingIndex(SizeDataHandle& t, int i) │ │ │ │ │ -608{ │ │ │ │ │ -609 t.setReceivingIndex(i); │ │ │ │ │ -610} │ │ │ │ │ -611 │ │ │ │ │ -612 │ │ │ │ │ -618template │ │ │ │ │ -619struct InterfaceInformationChooser │ │ │ │ │ -620{ │ │ │ │ │ -624 static const InterfaceInformation& │ │ │ │ │ -625 getSend(const std::pair& info) │ │ │ │ │ -626 { │ │ │ │ │ -627 return info.first; │ │ │ │ │ -628 } │ │ │ │ │ -629 │ │ │ │ │ -633 static const InterfaceInformation& │ │ │ │ │ -634 getReceive(const std::pair& │ │ │ │ │ -info) │ │ │ │ │ -635 { │ │ │ │ │ -636 return info.second; │ │ │ │ │ -637 } │ │ │ │ │ -638}; │ │ │ │ │ -639 │ │ │ │ │ -640template<> │ │ │ │ │ -641struct InterfaceInformationChooser │ │ │ │ │ -642{ │ │ │ │ │ -643 static const InterfaceInformation& │ │ │ │ │ -644 getSend(const std::pair& info) │ │ │ │ │ -645 { │ │ │ │ │ -646 return info.second; │ │ │ │ │ -647 } │ │ │ │ │ -648 │ │ │ │ │ -649 static const InterfaceInformation& │ │ │ │ │ -650 getReceive(const std::pair& │ │ │ │ │ -info) │ │ │ │ │ -651 { │ │ │ │ │ -652 return info.first; │ │ │ │ │ -653 } │ │ │ │ │ -654}; │ │ │ │ │ -655 │ │ │ │ │ -661template │ │ │ │ │ -662struct PackEntries │ │ │ │ │ -663{ │ │ │ │ │ -664 │ │ │ │ │ -665 int operator()(DataHandle& handle, InterfaceTracker& tracker, │ │ │ │ │ -666 MessageBuffer& buffer, │ │ │ │ │ -667 [[maybe_unused]] int i) const │ │ │ │ │ -668 { │ │ │ │ │ -669 return operator()(handle,tracker,buffer); │ │ │ │ │ -670 } │ │ │ │ │ -671 │ │ │ │ │ -679 int operator()(DataHandle& handle, InterfaceTracker& tracker, │ │ │ │ │ -680 MessageBuffer& buffer) const │ │ │ │ │ -681 { │ │ │ │ │ -682 if(tracker.fixedSize) // fixed size if variable is >0! │ │ │ │ │ -683 { │ │ │ │ │ -684 │ │ │ │ │ -685 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize, │ │ │ │ │ -tracker.indicesLeft()); │ │ │ │ │ -686 for(std::size_t i=0; i< noIndices; ++i) │ │ │ │ │ -687 { │ │ │ │ │ -688 handle.gather(buffer, tracker.index()); │ │ │ │ │ -689 tracker.moveToNextIndex(); │ │ │ │ │ -690 } │ │ │ │ │ -691 return noIndices*tracker.fixedSize; │ │ │ │ │ -692 } │ │ │ │ │ -693 else │ │ │ │ │ -694 { │ │ │ │ │ -695 int packed=0; │ │ │ │ │ -696 tracker.skipZeroIndices(); │ │ │ │ │ -697 while(!tracker.finished()) │ │ │ │ │ -698 if(buffer.hasSpaceForItems(handle.size(tracker.index()))) │ │ │ │ │ -699 { │ │ │ │ │ -700 handle.gather(buffer, tracker.index()); │ │ │ │ │ -701 packed+=handle.size(tracker.index()); │ │ │ │ │ -702 tracker.moveToNextIndex(); │ │ │ │ │ -703 } │ │ │ │ │ -704 else │ │ │ │ │ -705 break; │ │ │ │ │ -706 return packed; │ │ │ │ │ -707 } │ │ │ │ │ -708 } │ │ │ │ │ -709}; │ │ │ │ │ -710 │ │ │ │ │ -716template │ │ │ │ │ -717struct UnpackEntries{ │ │ │ │ │ -718 │ │ │ │ │ -726 bool operator()(DataHandle& handle, InterfaceTracker& tracker, │ │ │ │ │ -727 MessageBuffer& buffer, │ │ │ │ │ -728 int count=0) │ │ │ │ │ -729 { │ │ │ │ │ -730 if(tracker.fixedSize) // fixed size if variable is >0! │ │ │ │ │ -731 { │ │ │ │ │ -732 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize, │ │ │ │ │ -tracker.indicesLeft()); │ │ │ │ │ -733 │ │ │ │ │ -734 for(std::size_t i=0; i< noIndices; ++i) │ │ │ │ │ -735 { │ │ │ │ │ -736 handle.scatter(buffer, tracker.index(), tracker.fixedSize); │ │ │ │ │ -737 tracker.moveToNextIndex(); │ │ │ │ │ -738 } │ │ │ │ │ -739 return tracker.finished(); │ │ │ │ │ -740 } │ │ │ │ │ -741 else │ │ │ │ │ -742 { │ │ │ │ │ -743 assert(count); │ │ │ │ │ -744 for(int unpacked=0;unpacked │ │ │ │ │ -762struct UnpackSizeEntries{ │ │ │ │ │ -763 │ │ │ │ │ -771 bool operator()(SizeDataHandle& handle, InterfaceTracker& │ │ │ │ │ -tracker, │ │ │ │ │ -772 MessageBuffer::DataType>& buffer) const │ │ │ │ │ -773 { │ │ │ │ │ -774 std::size_t noIndices=std::min(buffer.size(), tracker.indicesLeft()); │ │ │ │ │ -775 std::copy(static_cast(buffer), static_cast │ │ │ │ │ -(buffer)+noIndices, │ │ │ │ │ -776 handle.getSizesPointer()+tracker.offset()); │ │ │ │ │ -777 tracker.increment(noIndices); │ │ │ │ │ -778 return noIndices; │ │ │ │ │ -779 } │ │ │ │ │ -780 bool operator()(SizeDataHandle& handle, InterfaceTracker& │ │ │ │ │ -tracker, │ │ │ │ │ -781 MessageBuffer::DataType>& buffer, int) │ │ │ │ │ -const │ │ │ │ │ -782 { │ │ │ │ │ -783 return operator()(handle,tracker,buffer); │ │ │ │ │ -784 } │ │ │ │ │ -785}; │ │ │ │ │ -786 │ │ │ │ │ -794void sendFixedSize(std::vector& send_trackers, │ │ │ │ │ -795 std::vector& send_requests, │ │ │ │ │ -796 std::vector& recv_trackers, │ │ │ │ │ -797 std::vector& recv_requests, │ │ │ │ │ -798 MPI_Comm communicator) │ │ │ │ │ -799{ │ │ │ │ │ -800 typedef std::vector::iterator TIter; │ │ │ │ │ -801 std::vector::iterator mIter=recv_requests.begin(); │ │ │ │ │ -802 │ │ │ │ │ -803 for(TIter iter=recv_trackers.begin(), end=recv_trackers.end(); iter!=end; │ │ │ │ │ -804 ++iter, ++mIter) │ │ │ │ │ -805 { │ │ │ │ │ -806 MPI_Irecv(&(iter->fixedSize), 1, _M_P_I_T_r_a_i_t_s_<_s_t_d_:_:_s_i_z_e___t_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -807 iter->rank(), 933881, communicator, &(*mIter)); │ │ │ │ │ -808 } │ │ │ │ │ -809 │ │ │ │ │ -810 // Send our size to all neighbours using non-blocking synchronous │ │ │ │ │ -communication. │ │ │ │ │ -811 std::vector::iterator mIter1=send_requests.begin(); │ │ │ │ │ -812 for(TIter iter=send_trackers.begin(), end=send_trackers.end(); │ │ │ │ │ -813 iter!=end; │ │ │ │ │ -814 ++iter, ++mIter1) │ │ │ │ │ -815 { │ │ │ │ │ -816 MPI_Issend(&(iter->fixedSize), 1, _M_P_I_T_r_a_i_t_s_<_s_t_d_:_:_s_i_z_e___t_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -817 iter->rank(), 933881, communicator, &(*mIter1)); │ │ │ │ │ -818 } │ │ │ │ │ -819} │ │ │ │ │ -820 │ │ │ │ │ -821 │ │ │ │ │ -826template │ │ │ │ │ -827struct SetupSendRequest{ │ │ │ │ │ -828 void operator()(DataHandle& handle, │ │ │ │ │ -829 InterfaceTracker& tracker, │ │ │ │ │ -830 MessageBuffer& buffer, │ │ │ │ │ -831 MPI_Request& request, │ │ │ │ │ -832 MPI_Comm comm) const │ │ │ │ │ -833 { │ │ │ │ │ -834 buffer.reset(); │ │ │ │ │ -835 int size=PackEntries()(handle, tracker, buffer); │ │ │ │ │ -836 // Skip indices of zero size. │ │ │ │ │ -837 while(!tracker.finished() && !handle.size(tracker.index())) │ │ │ │ │ -838 tracker.moveToNextIndex(); │ │ │ │ │ -839 if(size) │ │ │ │ │ -840 MPI_Issend(buffer, size, _M_P_I_T_r_a_i_t_s_<_t_y_p_e_n_a_m_e_ _D_a_t_a_H_a_n_d_l_e_:_:_D_a_t_a_T_y_p_e_>_:_:_g_e_t_T_y_p_e │ │ │ │ │ -(), │ │ │ │ │ -841 tracker.rank(), 933399, comm, &request); │ │ │ │ │ -842 } │ │ │ │ │ -843}; │ │ │ │ │ -844 │ │ │ │ │ -845 │ │ │ │ │ -850template │ │ │ │ │ -851struct SetupRecvRequest{ │ │ │ │ │ -852 void operator()(DataHandle& /*handle*/, │ │ │ │ │ -853 InterfaceTracker& tracker, │ │ │ │ │ -854 MessageBuffer& buffer, │ │ │ │ │ -855 MPI_Request& request, │ │ │ │ │ -856 MPI_Comm comm) const │ │ │ │ │ -857 { │ │ │ │ │ -858 buffer.reset(); │ │ │ │ │ -859 if(tracker.indicesLeft()) │ │ │ │ │ -860 MPI_Irecv(buffer, buffer.size(), _M_P_I_T_r_a_i_t_s_<_t_y_p_e_n_a_m_e_ _D_a_t_a_H_a_n_d_l_e_:_:_D_a_t_a_T_y_p_e_>_:_: │ │ │ │ │ -_g_e_t_T_y_p_e(), │ │ │ │ │ -861 tracker.rank(), 933399, comm, &request); │ │ │ │ │ -862 } │ │ │ │ │ -863}; │ │ │ │ │ -864 │ │ │ │ │ -868template │ │ │ │ │ -869struct NullPackUnpackFunctor │ │ │ │ │ -870{ │ │ │ │ │ -871 int operator()(DataHandle&, InterfaceTracker&, │ │ │ │ │ -872 MessageBuffer&, int) │ │ │ │ │ -873 { │ │ │ │ │ -874 return 0; │ │ │ │ │ -875 } │ │ │ │ │ -876 int operator()(DataHandle&, InterfaceTracker&, │ │ │ │ │ -877 MessageBuffer&) │ │ │ │ │ -878 { │ │ │ │ │ -879 return 0; │ │ │ │ │ -880 } │ │ │ │ │ -881}; │ │ │ │ │ -882 │ │ │ │ │ -897template │ │ │ │ │ -898std::size_t checkAndContinue(DataHandle& handle, │ │ │ │ │ -899 std::vector& trackers, │ │ │ │ │ -900 std::vector& requests, │ │ │ │ │ -901 std::vector& requests2, │ │ │ │ │ -902 std::vector >& buffers, │ │ │ │ │ -903 MPI_Comm comm, │ │ │ │ │ -904 BufferFunctor buffer_func, │ │ │ │ │ -905 CommunicationFunctor comm_func, │ │ │ │ │ -906 bool valid=true, │ │ │ │ │ -907 bool getCount=false) │ │ │ │ │ -908{ │ │ │ │ │ -909 std::size_t size=requests.size(); │ │ │ │ │ -910 std::vector statuses(size); │ │ │ │ │ -911 int no_completed; │ │ │ │ │ -912 std::vector indices(size, -1); // the indices for which the │ │ │ │ │ -communication finished. │ │ │ │ │ -913 │ │ │ │ │ -914 MPI_Testsome(size, &(requests[0]), &no_completed, &(indices[0]), &(statuses │ │ │ │ │ -[0])); │ │ │ │ │ -915 indices.resize(no_completed); │ │ │ │ │ -916 for(std::vector::iterator index=indices.begin(), end=indices.end(); │ │ │ │ │ -917 index!=end; ++index) │ │ │ │ │ -918 { │ │ │ │ │ -919 InterfaceTracker& tracker=trackers[*index]; │ │ │ │ │ -920 setReceivingIndex(handle, *index); │ │ │ │ │ -921 if(getCount) │ │ │ │ │ -922 { │ │ │ │ │ -923 // Get the number of entries received │ │ │ │ │ -924 int count; │ │ │ │ │ -925 MPI_Get_count(&(statuses[index-indices.begin()]), │ │ │ │ │ -926 _M_P_I_T_r_a_i_t_s_<_t_y_p_e_n_a_m_e_ _D_a_t_a_H_a_n_d_l_e_:_:_D_a_t_a_T_y_p_e_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -927 &count); │ │ │ │ │ -928 // Communication completed, we can reuse the buffers, e.g. unpack or repack │ │ │ │ │ -929 buffer_func(handle, tracker, buffers[*index], count); │ │ │ │ │ -930 }else │ │ │ │ │ -931 buffer_func(handle, tracker, buffers[*index]); │ │ │ │ │ -932 tracker.skipZeroIndices(); │ │ │ │ │ -933 if(!tracker.finished()){ │ │ │ │ │ -934 // Maybe start another communication. │ │ │ │ │ -935 comm_func(handle, tracker, buffers[*index], requests2[*index], comm); │ │ │ │ │ -936 tracker.skipZeroIndices(); │ │ │ │ │ -937 if(valid) │ │ │ │ │ -938 --no_completed; // communication not finished, decrement counter for │ │ │ │ │ -finished ones. │ │ │ │ │ -939 } │ │ │ │ │ -940 } │ │ │ │ │ -941 return no_completed; │ │ │ │ │ -942 │ │ │ │ │ -943} │ │ │ │ │ -944 │ │ │ │ │ -954template │ │ │ │ │ -955std::size_t receiveSizeAndSetupReceive(DataHandle& handle, │ │ │ │ │ -956 std::vector& trackers, │ │ │ │ │ -957 std::vector& size_requests, │ │ │ │ │ -958 std::vector& data_requests, │ │ │ │ │ -959 std::vector >& buffers, │ │ │ │ │ -960 MPI_Comm comm) │ │ │ │ │ -961{ │ │ │ │ │ -962 return checkAndContinue(handle, trackers, size_requests, data_requests, │ │ │ │ │ -buffers, comm, │ │ │ │ │ -963 NullPackUnpackFunctor(), SetupRecvRequest(), │ │ │ │ │ -false); │ │ │ │ │ -964} │ │ │ │ │ -965 │ │ │ │ │ -974template │ │ │ │ │ -975std::size_t checkSendAndContinueSending(DataHandle& handle, │ │ │ │ │ -976 std::vector& trackers, │ │ │ │ │ -977 std::vector& requests, │ │ │ │ │ -978 std::vector >& buffers, │ │ │ │ │ -979 MPI_Comm comm) │ │ │ │ │ -980{ │ │ │ │ │ -981 return checkAndContinue(handle, trackers, requests, requests, buffers, │ │ │ │ │ -comm, │ │ │ │ │ -982 NullPackUnpackFunctor(), SetupSendRequest()); │ │ │ │ │ -983} │ │ │ │ │ -984 │ │ │ │ │ -993template │ │ │ │ │ -994std::size_t checkReceiveAndContinueReceiving(DataHandle& handle, │ │ │ │ │ -995 std::vector& trackers, │ │ │ │ │ -996 std::vector& requests, │ │ │ │ │ -997 std::vector >& buffers, │ │ │ │ │ -998 MPI_Comm comm) │ │ │ │ │ -999{ │ │ │ │ │ -1000 return checkAndContinue(handle, trackers, requests, requests, buffers, │ │ │ │ │ -comm, │ │ │ │ │ -1001 UnpackEntries(), SetupRecvRequest(), │ │ │ │ │ -1002 true, !Impl::callFixedSize(handle)); │ │ │ │ │ -1003} │ │ │ │ │ -1004 │ │ │ │ │ -1005 │ │ │ │ │ -1006bool validRecvRequests(const std::vector reqs) │ │ │ │ │ -1007{ │ │ │ │ │ -1008 for(std::vector::const_iterator i=reqs.begin(), end=reqs.end │ │ │ │ │ -(); │ │ │ │ │ -1009 i!=end; ++i) │ │ │ │ │ -1010 if(*i!=MPI_REQUEST_NULL) │ │ │ │ │ -1011 return true; │ │ │ │ │ -1012 return false; │ │ │ │ │ -1013} │ │ │ │ │ -1014 │ │ │ │ │ -1025template │ │ │ │ │ -1026std::size_t setupRequests(DataHandle& handle, │ │ │ │ │ -1027 std::vector& trackers, │ │ │ │ │ -1028 std::vector >& buffers, │ │ │ │ │ -1029 std::vector& requests, │ │ │ │ │ -1030 const Functor& setupFunctor, │ │ │ │ │ -1031 MPI_Comm communicator) │ │ │ │ │ -1032{ │ │ │ │ │ -1033 typedef typename std::vector::iterator TIter; │ │ │ │ │ -1034 typename std::vector >:: │ │ │ │ │ -iterator │ │ │ │ │ -1035 biter=buffers.begin(); │ │ │ │ │ -1036 typename std::vector::iterator riter=requests.begin(); │ │ │ │ │ -1037 std::size_t complete=0; │ │ │ │ │ -1038 for(TIter titer=trackers.begin(), end=trackers.end(); titer!=end; ++titer, │ │ │ │ │ -++biter, ++riter) │ │ │ │ │ -1039 { │ │ │ │ │ -1040 setupFunctor(handle, *titer, *biter, *riter, communicator); │ │ │ │ │ -1041 complete+=titer->finished(); │ │ │ │ │ -1042 } │ │ │ │ │ -1043 return complete; │ │ │ │ │ -1044} │ │ │ │ │ -1045} // end unnamed namespace │ │ │ │ │ -1046 │ │ │ │ │ -1047template │ │ │ │ │ -1048template │ │ │ │ │ -1049void VariableSizeCommunicator::setupInterfaceTrackers │ │ │ │ │ -(DataHandle& handle, │ │ │ │ │ -1050 std::vector& send_trackers, │ │ │ │ │ -1051 std::vector& recv_trackers) │ │ │ │ │ -1052{ │ │ │ │ │ -1053 if(interface_->_s_i_z_e()==0) │ │ │ │ │ -1054 return; │ │ │ │ │ -1055 send_trackers.reserve(interface_->_s_i_z_e()); │ │ │ │ │ -1056 recv_trackers.reserve(interface_->_s_i_z_e()); │ │ │ │ │ -1057 │ │ │ │ │ -1058 int fixedsize=0; │ │ │ │ │ -1059 if(Impl::callFixedSize(handle)) │ │ │ │ │ -1060 ++fixedsize; │ │ │ │ │ -1061 │ │ │ │ │ -1062 │ │ │ │ │ -1063 typedef typename InterfaceMap::const_iterator IIter; │ │ │ │ │ -1064 for(IIter inf=interface_->begin(), end=interface_->end(); inf!=end; ++inf) │ │ │ │ │ -1065 { │ │ │ │ │ -1066 │ │ │ │ │ -1067 if(Impl::callFixedSize(handle) && InterfaceInformationChooser:: │ │ │ │ │ -getSend(inf->second).size()) │ │ │ │ │ -1068 fixedsize=handle.size(InterfaceInformationChooser::getSend(inf- │ │ │ │ │ ->second)[0]); │ │ │ │ │ -1069 assert(!Impl::callFixedSize(handle)||fixedsize>0); │ │ │ │ │ -1070 send_trackers.push_back(InterfaceTracker(inf->first, │ │ │ │ │ -1071 InterfaceInformationChooser::getSend(inf->second), fixedsize)); │ │ │ │ │ -1072 recv_trackers.push_back(InterfaceTracker(inf->first, │ │ │ │ │ -1073 InterfaceInformationChooser::getReceive(inf->second), fixedsize, │ │ │ │ │ -fixedsize==0)); │ │ │ │ │ -1074 } │ │ │ │ │ -1075} │ │ │ │ │ -1076 │ │ │ │ │ -1077template │ │ │ │ │ -1078template │ │ │ │ │ -1079void VariableSizeCommunicator::communicateFixedSize(DataHandle& │ │ │ │ │ -handle) │ │ │ │ │ -1080{ │ │ │ │ │ -1081 std::vector size_send_req(interface_->_s_i_z_e()); │ │ │ │ │ -1082 std::vector size_recv_req(interface_->_s_i_z_e()); │ │ │ │ │ -1083 │ │ │ │ │ -1084 std::vector send_trackers; │ │ │ │ │ -1085 std::vector recv_trackers; │ │ │ │ │ -1086 setupInterfaceTrackers(handle,send_trackers, recv_trackers); │ │ │ │ │ -1087 sendFixedSize(send_trackers, size_send_req, recv_trackers, size_recv_req, │ │ │ │ │ -communicator_); │ │ │ │ │ -1088 │ │ │ │ │ -1089 std::vector data_send_req(interface_->_s_i_z_e(), │ │ │ │ │ -MPI_REQUEST_NULL); │ │ │ │ │ -1090 std::vector data_recv_req(interface_->_s_i_z_e(), │ │ │ │ │ -MPI_REQUEST_NULL); │ │ │ │ │ -1091 typedef typename DataHandle::DataType DataType; │ │ │ │ │ -1092 std::vector > send_buffers(interface_->_s_i_z_e(), │ │ │ │ │ -MessageBuffer(maxBufferSize_)), │ │ │ │ │ -1093 recv_buffers(interface_->_s_i_z_e(), MessageBuffer(maxBufferSize_)); │ │ │ │ │ -1094 │ │ │ │ │ -1095 │ │ │ │ │ -1096 setupRequests(handle, send_trackers, send_buffers, data_send_req, │ │ │ │ │ -1097 SetupSendRequest(), communicator_); │ │ │ │ │ -1098 │ │ │ │ │ -1099 std::size_t no_size_to_recv, no_to_send, no_to_recv, old_size; │ │ │ │ │ -1100 no_size_to_recv = no_to_send = no_to_recv = old_size = interface_->_s_i_z_e(); │ │ │ │ │ -1101 │ │ │ │ │ -1102 // Skip empty interfaces. │ │ │ │ │ -1103 typedef typename std::vector::const_iterator Iter; │ │ │ │ │ -1104 for(Iter i=recv_trackers.begin(), end=recv_trackers.end(); i!=end; ++i) │ │ │ │ │ -1105 if(i->empty()) │ │ │ │ │ -1106 --no_to_recv; │ │ │ │ │ -1107 for(Iter i=send_trackers.begin(), end=send_trackers.end(); i!=end; ++i) │ │ │ │ │ -1108 if(i->empty()) │ │ │ │ │ -1109 --no_to_send; │ │ │ │ │ -1110 │ │ │ │ │ -1111 while(no_size_to_recv+no_to_send+no_to_recv) │ │ │ │ │ -1112 { │ │ │ │ │ -1113 // Receive the fixedsize and setup receives accordingly │ │ │ │ │ -1114 if(no_size_to_recv) │ │ │ │ │ -1115 no_size_to_recv -= receiveSizeAndSetupReceive(handle,recv_trackers, │ │ │ │ │ -size_recv_req, │ │ │ │ │ -1116 data_recv_req, recv_buffers, │ │ │ │ │ -1117 communicator_); │ │ │ │ │ -1118 │ │ │ │ │ -1119 // Check send completion and initiate other necessary sends │ │ │ │ │ -1120 if(no_to_send) │ │ │ │ │ -1121 no_to_send -= checkSendAndContinueSending(handle, send_trackers, │ │ │ │ │ -data_send_req, │ │ │ │ │ -1122 send_buffers, communicator_); │ │ │ │ │ -1123 if(validRecvRequests(data_recv_req)) │ │ │ │ │ -1124 // Receive data and setup new unblocking receives if necessary │ │ │ │ │ -1125 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers, │ │ │ │ │ -data_recv_req, │ │ │ │ │ -1126 recv_buffers, communicator_); │ │ │ │ │ -1127 } │ │ │ │ │ -1128 │ │ │ │ │ -1129 // Wait for completion of sending the size. │ │ │ │ │ -1130 //std::vector statuses(interface_->size(), │ │ │ │ │ -MPI_STATUSES_IGNORE); │ │ │ │ │ -1131 MPI_Waitall(size_send_req.size(), &(size_send_req[0]), │ │ │ │ │ -MPI_STATUSES_IGNORE); │ │ │ │ │ -1132 │ │ │ │ │ -1133} │ │ │ │ │ -1134 │ │ │ │ │ -1135template │ │ │ │ │ -1136template │ │ │ │ │ -1137void VariableSizeCommunicator::communicateSizes(DataHandle& │ │ │ │ │ -handle, │ │ │ │ │ -1138 std::vector& data_recv_trackers) │ │ │ │ │ -1139{ │ │ │ │ │ -1140 std::vector send_trackers; │ │ │ │ │ -1141 std::vector recv_trackers; │ │ │ │ │ -1142 std::size_t size = interface_->_s_i_z_e(); │ │ │ │ │ -1143 std::vector send_requests(size, MPI_REQUEST_NULL); │ │ │ │ │ -1144 std::vector recv_requests(size, MPI_REQUEST_NULL); │ │ │ │ │ -1145 std::vector > │ │ │ │ │ -1146 send_buffers(size, MessageBuffer(maxBufferSize_)), │ │ │ │ │ -1147 recv_buffers(size, MessageBuffer(maxBufferSize_)); │ │ │ │ │ -1148 SizeDataHandle size_handle(handle,data_recv_trackers); │ │ │ │ │ -1149 setupInterfaceTrackers(size_handle,send_trackers, recv_trackers); │ │ │ │ │ -1150 setupRequests(size_handle, send_trackers, send_buffers, send_requests, │ │ │ │ │ -1151 SetupSendRequest >(), communicator_); │ │ │ │ │ -1152 setupRequests(size_handle, recv_trackers, recv_buffers, recv_requests, │ │ │ │ │ -1153 SetupRecvRequest >(), communicator_); │ │ │ │ │ -1154 │ │ │ │ │ -1155 // Count valid requests that we have to wait for. │ │ │ │ │ -1156 auto valid_req_func = │ │ │ │ │ -1157 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL; }; │ │ │ │ │ -1158 │ │ │ │ │ -1159 auto size_to_send = std::count_if(send_requests.begin(), send_requests.end │ │ │ │ │ -(), │ │ │ │ │ -1160 valid_req_func); │ │ │ │ │ -1161 auto size_to_recv = std::count_if(recv_requests.begin(), recv_requests.end │ │ │ │ │ -(), │ │ │ │ │ -1162 valid_req_func); │ │ │ │ │ -1163 │ │ │ │ │ -1164 while(size_to_send+size_to_recv) │ │ │ │ │ -1165 { │ │ │ │ │ -1166 if(size_to_send) │ │ │ │ │ -1167 size_to_send -= │ │ │ │ │ -1168 checkSendAndContinueSending(size_handle, send_trackers, send_requests, │ │ │ │ │ -1169 send_buffers, communicator_); │ │ │ │ │ -1170 if(size_to_recv) │ │ │ │ │ -1171 // Could have done this using checkSendAndContinueSending │ │ │ │ │ -1172 // But the call below is more efficient as UnpackSizeEntries │ │ │ │ │ -1173 // uses std::copy. │ │ │ │ │ -1174 size_to_recv -= │ │ │ │ │ -1175 checkAndContinue(size_handle, recv_trackers, recv_requests, recv_requests, │ │ │ │ │ -1176 recv_buffers, communicator_, UnpackSizeEntries(), │ │ │ │ │ -1177 SetupRecvRequest >()); │ │ │ │ │ -1178 } │ │ │ │ │ -1179} │ │ │ │ │ -1180 │ │ │ │ │ -1181template │ │ │ │ │ -1182template │ │ │ │ │ -1183void VariableSizeCommunicator::communicateVariableSize │ │ │ │ │ -(DataHandle& handle) │ │ │ │ │ -1184{ │ │ │ │ │ -1185 │ │ │ │ │ -1186 std::vector send_trackers; │ │ │ │ │ -1187 std::vector recv_trackers; │ │ │ │ │ -1188 setupInterfaceTrackers(handle, send_trackers, recv_trackers); │ │ │ │ │ -1189 │ │ │ │ │ -1190 std::vector send_requests(interface_->_s_i_z_e(), │ │ │ │ │ -MPI_REQUEST_NULL); │ │ │ │ │ -1191 std::vector recv_requests(interface_->_s_i_z_e(), │ │ │ │ │ -MPI_REQUEST_NULL); │ │ │ │ │ -1192 typedef typename DataHandle::DataType DataType; │ │ │ │ │ -1193 std::vector > │ │ │ │ │ -1194 send_buffers(interface_->_s_i_z_e(), MessageBuffer(maxBufferSize_)), │ │ │ │ │ -1195 recv_buffers(interface_->_s_i_z_e(), MessageBuffer(maxBufferSize_)); │ │ │ │ │ -1196 │ │ │ │ │ -1197 communicateSizes(handle, recv_trackers); │ │ │ │ │ -1198 // Setup requests for sending and receiving. │ │ │ │ │ -1199 setupRequests(handle, send_trackers, send_buffers, send_requests, │ │ │ │ │ -1200 SetupSendRequest(), communicator_); │ │ │ │ │ -1201 setupRequests(handle, recv_trackers, recv_buffers, recv_requests, │ │ │ │ │ -1202 SetupRecvRequest(), communicator_); │ │ │ │ │ -1203 │ │ │ │ │ -1204 // Determine number of valid requests. │ │ │ │ │ -1205 auto valid_req_func = │ │ │ │ │ -1206 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL;}; │ │ │ │ │ -1207 │ │ │ │ │ -1208 auto no_to_send = std::count_if(send_requests.begin(), send_requests.end │ │ │ │ │ -(), │ │ │ │ │ -1209 valid_req_func); │ │ │ │ │ -1210 auto no_to_recv = std::count_if(recv_requests.begin(), recv_requests.end │ │ │ │ │ -(), │ │ │ │ │ -1211 valid_req_func); │ │ │ │ │ -1212 while(no_to_send+no_to_recv) │ │ │ │ │ -1213 { │ │ │ │ │ -1214 // Check send completion and initiate other necessary sends │ │ │ │ │ -1215 if(no_to_send) │ │ │ │ │ -1216 no_to_send -= checkSendAndContinueSending(handle, send_trackers, │ │ │ │ │ -send_requests, │ │ │ │ │ -1217 send_buffers, communicator_); │ │ │ │ │ -1218 if(no_to_recv) │ │ │ │ │ -1219 // Receive data and setup new unblocking receives if necessary │ │ │ │ │ -1220 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers, │ │ │ │ │ -recv_requests, │ │ │ │ │ -1221 recv_buffers, communicator_); │ │ │ │ │ -1222 } │ │ │ │ │ -1223} │ │ │ │ │ -1224 │ │ │ │ │ -1225template │ │ │ │ │ -1226template │ │ │ │ │ -1227void VariableSizeCommunicator::communicate(DataHandle& handle) │ │ │ │ │ -1228{ │ │ │ │ │ -1229 if( interface_->_s_i_z_e() == 0) │ │ │ │ │ -1230 // Simply return as otherwise we will index an empty container │ │ │ │ │ -1231 // either for MPI_Wait_all or MPI_Test_some. │ │ │ │ │ -1232 return; │ │ │ │ │ -1233 │ │ │ │ │ -1234 if(Impl::callFixedSize(handle)) │ │ │ │ │ -1235 communicateFixedSize(handle); │ │ │ │ │ -1236 else │ │ │ │ │ -1237 communicateVariableSize(handle); │ │ │ │ │ -1238} │ │ │ │ │ -1239} // end namespace Dune │ │ │ │ │ -1240 │ │ │ │ │ -1241#endif // HAVE_MPI │ │ │ │ │ -1242 │ │ │ │ │ -1243#endif │ │ │ │ │ -_c_o_n_c_e_p_t_._h_h │ │ │ │ │ -Infrastructure for concepts. │ │ │ │ │ -_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ -_f_i_x_e_d_S_i_z_e │ │ │ │ │ -std::size_t fixedSize │ │ │ │ │ -The number of data items per index if it is fixed, 0 otherwise. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -MPI_Comm communicator() const │ │ │ │ │ -Get the MPI Communicator. │ │ │ │ │ -DDeeffiinniittiioonn parallel/interface.hh:417 │ │ │ │ │ +26#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_:_:_g_e_t_T_y_p_e │ │ │ │ │ -static MPI_Datatype getType() │ │ │ │ │ -DDeeffiinniittiioonn mpitraits.hh:48 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e_I_n_f_o_r_m_a_t_i_o_n_:_:_s_i_z_e │ │ │ │ │ -size_t size() const │ │ │ │ │ -Get the number of entries in the interface. │ │ │ │ │ -DDeeffiinniittiioonn parallel/interface.hh:108 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e │ │ │ │ │ -Communication interface between remote and local indices. │ │ │ │ │ -DDeeffiinniittiioonn parallel/interface.hh:209 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_H_a_s_F_i_x_e_d_S_i_z_e │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_C_o_n_c_e_p_t_:_:_H_a_s_F_i_x_e_d_S_i_z_e_:_:_r_e_q_u_i_r_e │ │ │ │ │ -auto require(H &&h) -> decltype(h.fixedSize()) │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -A buffered communicator where the amount of data sent does not have to be known │ │ │ │ │ -a priori. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:332 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -VariableSizeCommunicator(const Interface &inf, std::size_t max_buffer_size) │ │ │ │ │ -Creates a communicator with a specific maximum buffer size. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:404 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d │ │ │ │ │ -void backward(DataHandle &handle) │ │ │ │ │ -Communicate backwards. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:486 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_~_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -~VariableSizeCommunicator() │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:410 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf, std::size_t │ │ │ │ │ -max_buffer_size) │ │ │ │ │ -Creates a communicator with a specific maximum buffer size. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:393 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -VariableSizeCommunicator(const VariableSizeCommunicator &other) │ │ │ │ │ -Copy-constructs a communicator. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:419 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d │ │ │ │ │ -void forward(DataHandle &handle) │ │ │ │ │ -Communicate forward. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:461 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -VariableSizeCommunicator & operator=(const VariableSizeCommunicator &other) │ │ │ │ │ -Copy-assignes a communicator. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:429 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_I_n_t_e_r_f_a_c_e_M_a_p │ │ │ │ │ -std::map< int, std::pair< InterfaceInformation, InterfaceInformation >, std:: │ │ │ │ │ -less< int >, typename std::allocator_traits< Allocator >::template │ │ │ │ │ -rebind_alloc< std::pair< const int, std::pair< InterfaceInformation, │ │ │ │ │ -InterfaceInformation > > > > InterfaceMap │ │ │ │ │ -The type of the map from process number to InterfaceInformation for sending and │ │ │ │ │ -receiving to and from... │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:340 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf) │ │ │ │ │ -Creates a communicator with the default maximum buffer size. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:349 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r_:_:_V_a_r_i_a_b_l_e_S_i_z_e_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -VariableSizeCommunicator(const Interface &inf) │ │ │ │ │ -Creates a communicator with the default maximum buffer size. │ │ │ │ │ -DDeeffiinniittiioonn variablesizecommunicator.hh:358 │ │ │ │ │ -_i_n_t_e_r_f_a_c_e_._h_h │ │ │ │ │ -Provides classes for building the communication interface between remote │ │ │ │ │ -indices. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00221.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: communication.hh File Reference │ │ │ │ +dune-common: utility.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,71 +65,36 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions
    │ │ │ │ -
    communication.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ +
    utility.hh File Reference
    │ │ │ │ │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Implements an utility class that provides collective communication methods for sequential programs. │ │ │ │ -More...

    │ │ │ │ -
    #include <iostream>
    │ │ │ │ -#include <complex>
    │ │ │ │ -#include <algorithm>
    │ │ │ │ -#include <vector>
    │ │ │ │ -#include <dune/common/binaryfunctions.hh>
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -#include <dune/common/parallel/future.hh>
    │ │ │ │ +
    #include <utility>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    struct  Dune::No_Comm
     
    class  Dune::Communication< Communicator >
     Collective communication interface and sequential default implementation. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

    │ │ │ │ Namespaces

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

    │ │ │ │ -Typedefs

    template<class T >
    using Dune::CollectiveCommunication = Communication< T >
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ -Functions

    bool Dune::operator== (const No_Comm &, const No_Comm &)
     Comparison operator for MPI compatibility.
     
    bool Dune::operator!= (const No_Comm &, const No_Comm &)
     Comparison operator for MPI compatibility.
     
    namespace  Dune::Std
     Namespace for features backported from new C++ standards.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Implements an utility class that provides collective communication methods for sequential programs.

    │ │ │ │ -

    An abstraction to the basic methods of parallel communication, following the message-passing paradigm.

    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,49 +1,20 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_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 │ │ │ │ │ -communication.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Implements an utility class that provides collective communication methods for │ │ │ │ │ -sequential programs. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_e_._h_h> │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +utility.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_:_:_N_o___C_o_m_m │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_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_ _> │ │ │ │ │ -  Collective communication interface and sequential default │ │ │ │ │ - implementation. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n = _C_o_m_m_u_n_i_c_a_t_i_o_n< T > │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _N_o___C_o_m_m &, const _N_o___C_o_m_m &) │ │ │ │ │ -  Comparison operator for MPI compatibility. │ │ │ │ │ -  │ │ │ │ │ -bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _N_o___C_o_m_m &, const _N_o___C_o_m_m &) │ │ │ │ │ -  Comparison operator for MPI compatibility. │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implements an utility class that provides collective communication methods for │ │ │ │ │ -sequential programs. │ │ │ │ │ -An abstraction to the basic methods of parallel communication, following the │ │ │ │ │ -message-passing paradigm. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00221_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: communication.hh Source File │ │ │ │ +dune-common: utility.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,417 +70,49 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    communication.hh
    │ │ │ │ +
    utility.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_PARALLEL_COMMUNICATION_HH
    │ │ │ │ -
    6#define DUNE_COMMON_PARALLEL_COMMUNICATION_HH
    │ │ │ │ -
    14#include <iostream>
    │ │ │ │ -
    15#include <complex>
    │ │ │ │ -
    16#include <algorithm>
    │ │ │ │ -
    17#include <vector>
    │ │ │ │ -
    18
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_STD_UTILITY_HH
    │ │ │ │ +
    4#define DUNE_COMMON_STD_UTILITY_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    6#include <utility>
    │ │ │ │ +
    7
    │ │ │ │ +
    8#warning dune/common/std/utility.hh is deprecated and will be removed after Dune 2.8.\
    │ │ │ │ +
    9 Include <utility> instead
    │ │ │ │ +
    10
    │ │ │ │ +
    11namespace Dune
    │ │ │ │ +
    12{
    │ │ │ │ +
    13
    │ │ │ │ +
    14 namespace Std
    │ │ │ │ +
    15 {
    │ │ │ │ +
    16
    │ │ │ │ +
    17 using std::integer_sequence;
    │ │ │ │ +
    18 using std::index_sequence;
    │ │ │ │ +
    19 using std::make_integer_sequence;
    │ │ │ │ +
    20 using std::make_index_sequence;
    │ │ │ │ +
    21 using std::index_sequence_for;
    │ │ │ │
    22
    │ │ │ │ -
    42namespace Dune
    │ │ │ │ -
    43{
    │ │ │ │ -
    44
    │ │ │ │ -
    45 /* define some type that definitely differs from MPI_Comm */
    │ │ │ │ -
    46 struct No_Comm {};
    │ │ │ │ -
    47
    │ │ │ │ -
    │ │ │ │ -
    52 inline bool operator==(const No_Comm&, const No_Comm&)
    │ │ │ │ -
    53 {
    │ │ │ │ -
    54 return true;
    │ │ │ │ -
    55 }
    │ │ │ │ -
    │ │ │ │ -
    56
    │ │ │ │ -
    │ │ │ │ -
    61 inline bool operator!=(const No_Comm&, const No_Comm&)
    │ │ │ │ -
    62 {
    │ │ │ │ -
    63 return false;
    │ │ │ │ -
    64 }
    │ │ │ │ -
    │ │ │ │ -
    65
    │ │ │ │ -
    98 template<typename Communicator>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    100 {
    │ │ │ │ -
    101 public:
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    104 {}
    │ │ │ │ -
    │ │ │ │ -
    105
    │ │ │ │ -
    │ │ │ │ -
    110 Communication (const Communicator&)
    │ │ │ │ -
    111 {}
    │ │ │ │ -
    │ │ │ │ -
    112
    │ │ │ │ -
    │ │ │ │ -
    114 int rank () const
    │ │ │ │ -
    115 {
    │ │ │ │ -
    116 return 0;
    │ │ │ │ -
    117 }
    │ │ │ │ -
    │ │ │ │ -
    118
    │ │ │ │ -
    │ │ │ │ -
    120 operator No_Comm() const
    │ │ │ │ -
    121 {
    │ │ │ │ -
    122 return {};
    │ │ │ │ -
    123 }
    │ │ │ │ -
    │ │ │ │ -
    124
    │ │ │ │ -
    │ │ │ │ -
    126 int size () const
    │ │ │ │ -
    127 {
    │ │ │ │ -
    128 return 1;
    │ │ │ │ -
    129 }
    │ │ │ │ -
    │ │ │ │ -
    130
    │ │ │ │ -
    134 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    135 int send([[maybe_unused]] const T& data,
    │ │ │ │ -
    136 [[maybe_unused]] int dest_rank,
    │ │ │ │ -
    137 [[maybe_unused]] int tag)
    │ │ │ │ -
    138 {
    │ │ │ │ -
    139 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    │ │ │ │ -
    140 }
    │ │ │ │ -
    │ │ │ │ -
    141
    │ │ │ │ -
    145 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    146 PseudoFuture<T> isend([[maybe_unused]] const T&& data,
    │ │ │ │ -
    147 [[maybe_unused]] int dest_rank,
    │ │ │ │ -
    148 [[maybe_unused]] int tag)
    │ │ │ │ -
    149 {
    │ │ │ │ -
    150 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    │ │ │ │ -
    151 }
    │ │ │ │ -
    │ │ │ │ -
    152
    │ │ │ │ -
    156 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    157 T recv([[maybe_unused]] T&& data,
    │ │ │ │ -
    158 [[maybe_unused]] int source_rank,
    │ │ │ │ -
    159 [[maybe_unused]] int tag,
    │ │ │ │ -
    160 [[maybe_unused]] void* status = 0)
    │ │ │ │ -
    161 {
    │ │ │ │ -
    162 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    │ │ │ │ -
    163 }
    │ │ │ │ -
    │ │ │ │ -
    164
    │ │ │ │ -
    168 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    169 PseudoFuture<T> irecv([[maybe_unused]] T&& data,
    │ │ │ │ -
    170 [[maybe_unused]] int source_rank,
    │ │ │ │ -
    171 [[maybe_unused]] int tag)
    │ │ │ │ -
    172 {
    │ │ │ │ -
    173 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    │ │ │ │ -
    174 }
    │ │ │ │ -
    │ │ │ │ -
    175
    │ │ │ │ -
    176 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    177 T rrecv([[maybe_unused]] T&& data,
    │ │ │ │ -
    178 [[maybe_unused]] int source_rank,
    │ │ │ │ -
    179 [[maybe_unused]] int tag,
    │ │ │ │ -
    180 [[maybe_unused]] void* status = 0) const
    │ │ │ │ -
    181 {
    │ │ │ │ -
    182 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    │ │ │ │ -
    183 }
    │ │ │ │ -
    │ │ │ │ -
    187 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    188 T sum (const T& in) const
    │ │ │ │ -
    189 {
    │ │ │ │ -
    190 return in;
    │ │ │ │ -
    191 }
    │ │ │ │ -
    │ │ │ │ -
    192
    │ │ │ │ -
    198 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    199 int sum ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    │ │ │ │ -
    200 {
    │ │ │ │ -
    201 return 0;
    │ │ │ │ -
    202 }
    │ │ │ │ -
    │ │ │ │ -
    203
    │ │ │ │ -
    207 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    208 T prod (const T& in) const
    │ │ │ │ -
    209 {
    │ │ │ │ -
    210 return in;
    │ │ │ │ -
    211 }
    │ │ │ │ -
    │ │ │ │ -
    212
    │ │ │ │ -
    218 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    219 int prod ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    │ │ │ │ -
    220 {
    │ │ │ │ -
    221 return 0;
    │ │ │ │ -
    222 }
    │ │ │ │ -
    │ │ │ │ -
    223
    │ │ │ │ -
    227 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    228 T min (const T& in) const
    │ │ │ │ -
    229 {
    │ │ │ │ -
    230 return in;
    │ │ │ │ -
    231 }
    │ │ │ │ -
    │ │ │ │ -
    232
    │ │ │ │ -
    238 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    239 int min ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    │ │ │ │ -
    240 {
    │ │ │ │ -
    241 return 0;
    │ │ │ │ -
    242 }
    │ │ │ │ -
    │ │ │ │ -
    243
    │ │ │ │ -
    247 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    248 T max (const T& in) const
    │ │ │ │ -
    249 {
    │ │ │ │ -
    250 return in;
    │ │ │ │ -
    251 }
    │ │ │ │ -
    │ │ │ │ -
    252
    │ │ │ │ -
    258 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    259 int max ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    │ │ │ │ -
    260 {
    │ │ │ │ -
    261 return 0;
    │ │ │ │ -
    262 }
    │ │ │ │ -
    │ │ │ │ -
    263
    │ │ │ │ -
    │ │ │ │ -
    267 int barrier () const
    │ │ │ │ -
    268 {
    │ │ │ │ -
    269 return 0;
    │ │ │ │ -
    270 }
    │ │ │ │ -
    │ │ │ │ -
    271
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    276 {
    │ │ │ │ -
    277 return {true}; // return a valid future
    │ │ │ │ -
    278 }
    │ │ │ │ -
    │ │ │ │ -
    279
    │ │ │ │ -
    283 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    284 int broadcast ([[maybe_unused]] T* inout,
    │ │ │ │ -
    285 [[maybe_unused]] int len,
    │ │ │ │ -
    286 [[maybe_unused]] int root) const
    │ │ │ │ -
    287 {
    │ │ │ │ -
    288 return 0;
    │ │ │ │ -
    289 }
    │ │ │ │ -
    │ │ │ │ -
    290
    │ │ │ │ -
    294 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    295 PseudoFuture<T> ibroadcast(T&& data, int root) const{
    │ │ │ │ -
    296 return {std::forward<T>(data)};
    │ │ │ │ -
    297 }
    │ │ │ │ -
    │ │ │ │ -
    298
    │ │ │ │ -
    299
    │ │ │ │ -
    312 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    313 int gather (const T* in, T* out, int len, [[maybe_unused]] int root) const // note out must have same size as in
    │ │ │ │ -
    314 {
    │ │ │ │ -
    315 for (int i=0; i<len; i++)
    │ │ │ │ -
    316 out[i] = in[i];
    │ │ │ │ -
    317 return 0;
    │ │ │ │ -
    318 }
    │ │ │ │ -
    │ │ │ │ -
    319
    │ │ │ │ -
    323 template<class TIN, class TOUT = std::vector<TIN>>
    │ │ │ │ -
    │ │ │ │ -
    324 PseudoFuture<TOUT> igather(TIN&& data_in, TOUT&& data_out, int root){
    │ │ │ │ -
    325 *(data_out.begin()) = std::forward<TIN>(data_in);
    │ │ │ │ -
    326 return {std::forward<TOUT>(data_out)};
    │ │ │ │ -
    327 }
    │ │ │ │ -
    │ │ │ │ -
    328
    │ │ │ │ -
    329
    │ │ │ │ -
    349 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    350 int gatherv (const T* in,
    │ │ │ │ -
    351 int sendDataLen,
    │ │ │ │ -
    352 T* out,
    │ │ │ │ -
    353 [[maybe_unused]] int* recvDataLen,
    │ │ │ │ -
    354 int* displ,
    │ │ │ │ -
    355 [[maybe_unused]] int root) const
    │ │ │ │ -
    356 {
    │ │ │ │ -
    357 for (int i=*displ; i<sendDataLen; i++)
    │ │ │ │ -
    358 out[i] = in[i];
    │ │ │ │ -
    359 return 0;
    │ │ │ │ -
    360 }
    │ │ │ │ -
    │ │ │ │ -
    361
    │ │ │ │ -
    375 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    376 int scatter (const T* sendData, T* recvData, int len, [[maybe_unused]] int root) const // note out must have same size as in
    │ │ │ │ -
    377 {
    │ │ │ │ -
    378 for (int i=0; i<len; i++)
    │ │ │ │ -
    379 recvData[i] = sendData[i];
    │ │ │ │ -
    380 return 0;
    │ │ │ │ -
    381 }
    │ │ │ │ -
    │ │ │ │ -
    382
    │ │ │ │ -
    386 template<class TIN, class TOUT = TIN>
    │ │ │ │ -
    │ │ │ │ -
    387 PseudoFuture<TOUT> iscatter(TIN&& data_in, TOUT&& data_out, int root){
    │ │ │ │ -
    388 data_out = *(std::forward<TIN>(data_in).begin());
    │ │ │ │ -
    389 return {std::forward<TOUT>(data_out)};
    │ │ │ │ -
    390 }
    │ │ │ │ -
    │ │ │ │ -
    391
    │ │ │ │ -
    410 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    411 int scatterv (const T* sendData,int* sendDataLen, int* displ, T* recvData,
    │ │ │ │ -
    412 [[maybe_unused]] int recvDataLen, [[maybe_unused]] int root) const
    │ │ │ │ -
    413 {
    │ │ │ │ -
    414 for (int i=*displ; i<*sendDataLen; i++)
    │ │ │ │ -
    415 recvData[i] = sendData[i];
    │ │ │ │ -
    416 return 0;
    │ │ │ │ -
    417 }
    │ │ │ │ -
    │ │ │ │ -
    418
    │ │ │ │ -
    432 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    433 int allgather(const T* sbuf, int count, T* rbuf) const
    │ │ │ │ -
    434 {
    │ │ │ │ -
    435 for(const T* end=sbuf+count; sbuf < end; ++sbuf, ++rbuf)
    │ │ │ │ -
    436 *rbuf=*sbuf;
    │ │ │ │ -
    437 return 0;
    │ │ │ │ -
    438 }
    │ │ │ │ -
    │ │ │ │ -
    439
    │ │ │ │ -
    444 template<class TIN, class TOUT = TIN>
    │ │ │ │ -
    │ │ │ │ -
    445 PseudoFuture<TOUT> iallgather(TIN&& data_in, TOUT&& data_out){
    │ │ │ │ -
    446 return {std::forward<TOUT>(data_out)};
    │ │ │ │ -
    447 }
    │ │ │ │ -
    │ │ │ │ -
    448
    │ │ │ │ -
    465 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    466 int allgatherv (const T* in, int sendDataLen, T* out, [[maybe_unused]] int* recvDataLen, int* displ) const
    │ │ │ │ -
    467 {
    │ │ │ │ -
    468 for (int i=*displ; i<sendDataLen; i++)
    │ │ │ │ -
    469 out[i] = in[i];
    │ │ │ │ -
    470 return 0;
    │ │ │ │ -
    471 }
    │ │ │ │ -
    │ │ │ │ -
    472
    │ │ │ │ -
    485 template<typename BinaryFunction, typename Type>
    │ │ │ │ -
    │ │ │ │ -
    486 int allreduce([[maybe_unused]] Type* inout, [[maybe_unused]] int len) const
    │ │ │ │ -
    487 {
    │ │ │ │ -
    488 return 0;
    │ │ │ │ -
    489 }
    │ │ │ │ -
    │ │ │ │ -
    490
    │ │ │ │ -
    495 template<class BinaryFunction, class TIN, class TOUT = TIN>
    │ │ │ │ -
    │ │ │ │ -
    496 PseudoFuture<TOUT> iallreduce(TIN&& data_in, TOUT&& data_out){
    │ │ │ │ -
    497 data_out = std::forward<TIN>(data_in);
    │ │ │ │ -
    498 return {std::forward<TOUT>(data_out)};
    │ │ │ │ -
    499 }
    │ │ │ │ -
    │ │ │ │ -
    500
    │ │ │ │ -
    505 template<class BinaryFunction, class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    507 return {std::forward<T>(data)};
    │ │ │ │ -
    508 }
    │ │ │ │ -
    │ │ │ │ -
    509
    │ │ │ │ -
    510
    │ │ │ │ -
    524 template<typename BinaryFunction, typename Type>
    │ │ │ │ -
    │ │ │ │ -
    525 int allreduce(const Type* in, Type* out, int len) const
    │ │ │ │ -
    526 {
    │ │ │ │ -
    527 std::copy(in, in+len, out);
    │ │ │ │ -
    528 return 0;
    │ │ │ │ -
    529 }
    │ │ │ │ -
    │ │ │ │ -
    530
    │ │ │ │ -
    531 };
    │ │ │ │ -
    │ │ │ │ -
    532
    │ │ │ │ -
    538 template<class T>
    │ │ │ │ - │ │ │ │ -
    540 [[deprecated("CollectiveCommunication is deprecated. Use Communication instead.")]]
    │ │ │ │ - │ │ │ │ -
    542}
    │ │ │ │ -
    543
    │ │ │ │ -
    544#endif
    │ │ │ │ -
    helper classes to provide unique types for standard functions
    │ │ │ │ - │ │ │ │ -
    A few common exception classes.
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition iteratorfacades.hh:237
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition iteratorfacades.hh:259
    │ │ │ │ +
    23 } // namespace Std
    │ │ │ │ +
    24
    │ │ │ │ +
    25} // namespace Dune
    │ │ │ │ +
    26
    │ │ │ │ +
    27#endif // #ifndef DUNE_COMMON_STD_UTILITY_HH
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Default exception if an error in the parallel communication of the program occurred.
    Definition exceptions.hh:287
    │ │ │ │ -
    Definition communication.hh:46
    │ │ │ │ -
    Collective communication interface and sequential default implementation.
    Definition communication.hh:100
    │ │ │ │ -
    PseudoFuture< TOUT > iallreduce(TIN &&data_in, TOUT &&data_out)
    Compute something over all processes nonblocking.
    Definition communication.hh:496
    │ │ │ │ -
    int send(const T &data, int dest_rank, int tag)
    Sends the data to the dest_rank.
    Definition communication.hh:135
    │ │ │ │ -
    int allreduce(const Type *in, Type *out, int len) const
    Compute something over all processes for each component of an array and return the result in every pr...
    Definition communication.hh:525
    │ │ │ │ -
    T max(const T &in) const
    Compute the maximum of the argument over all processes and return the result in every process....
    Definition communication.hh:248
    │ │ │ │ -
    int rank() const
    Return rank, is between 0 and size()-1.
    Definition communication.hh:114
    │ │ │ │ -
    T sum(const T &in) const
    Compute the sum of the argument over all processes and return the result in every process....
    Definition communication.hh:188
    │ │ │ │ -
    int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int recvDataLen, int root) const
    Scatter arrays of variable length from a root to all other tasks.
    Definition communication.hh:411
    │ │ │ │ -
    int prod(T *inout, int len) const
    Compute the product over all processes for each component of an array and return the result in every ...
    Definition communication.hh:219
    │ │ │ │ -
    T recv(T &&data, int source_rank, int tag, void *status=0)
    Receives the data from the source_rank.
    Definition communication.hh:157
    │ │ │ │ -
    PseudoFuture< T > isend(const T &&data, int dest_rank, int tag)
    Sends the data to the dest_rank nonblocking.
    Definition communication.hh:146
    │ │ │ │ -
    PseudoFuture< void > ibarrier() const
    Nonblocking barrier.
    Definition communication.hh:275
    │ │ │ │ -
    int allreduce(Type *inout, int len) const
    Compute something over all processes for each component of an array and return the result in every pr...
    Definition communication.hh:486
    │ │ │ │ -
    int size() const
    Number of processes in set, is greater than 0.
    Definition communication.hh:126
    │ │ │ │ -
    int sum(T *inout, int len) const
    Compute the sum over all processes for each component of an array and return the result in every proc...
    Definition communication.hh:199
    │ │ │ │ -
    int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ) const
    Gathers data of variable length from all tasks and distribute it to all.
    Definition communication.hh:466
    │ │ │ │ -
    T min(const T &in) const
    Compute the minimum of the argument over all processes and return the result in every process....
    Definition communication.hh:228
    │ │ │ │ -
    PseudoFuture< T > irecv(T &&data, int source_rank, int tag)
    Receives the data from the source_rank nonblocking.
    Definition communication.hh:169
    │ │ │ │ -
    int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, int root) const
    Gather arrays of variable size on root task.
    Definition communication.hh:350
    │ │ │ │ -
    PseudoFuture< T > ibroadcast(T &&data, int root) const
    Distribute an array from the process with rank root to all other processes nonblocking.
    Definition communication.hh:295
    │ │ │ │ -
    int allgather(const T *sbuf, int count, T *rbuf) const
    Gathers data from all tasks and distribute it to all.
    Definition communication.hh:433
    │ │ │ │ -
    int scatter(const T *sendData, T *recvData, int len, int root) const
    Scatter array from a root to all other task.
    Definition communication.hh:376
    │ │ │ │ -
    int gather(const T *in, T *out, int len, int root) const
    Gather arrays on root task.
    Definition communication.hh:313
    │ │ │ │ -
    PseudoFuture< T > iallreduce(T &&data)
    Compute something over all processes nonblocking and in-place.
    Definition communication.hh:506
    │ │ │ │ -
    Communication(const Communicator &)
    Constructor with a given communicator.
    Definition communication.hh:110
    │ │ │ │ -
    int max(T *inout, int len) const
    Compute the maximum over all processes for each component of an array and return the result in every ...
    Definition communication.hh:259
    │ │ │ │ -
    T prod(const T &in) const
    Compute the product of the argument over all processes and return the result in every process....
    Definition communication.hh:208
    │ │ │ │ -
    int broadcast(T *inout, int len, int root) const
    Distribute an array from the process with rank root to all other processes.
    Definition communication.hh:284
    │ │ │ │ -
    T rrecv(T &&data, int source_rank, int tag, void *status=0) const
    Definition communication.hh:177
    │ │ │ │ -
    PseudoFuture< TOUT > iscatter(TIN &&data_in, TOUT &&data_out, int root)
    Scatter array from a root to all other task nonblocking.
    Definition communication.hh:387
    │ │ │ │ -
    int min(T *inout, int len) const
    Compute the minimum over all processes for each component of an array and return the result in every ...
    Definition communication.hh:239
    │ │ │ │ -
    int barrier() const
    Wait until all processes have arrived at this point in the program.
    Definition communication.hh:267
    │ │ │ │ -
    PseudoFuture< TOUT > igather(TIN &&data_in, TOUT &&data_out, int root)
    Gather arrays on root task nonblocking.
    Definition communication.hh:324
    │ │ │ │ -
    PseudoFuture< TOUT > iallgather(TIN &&data_in, TOUT &&data_out)
    Gathers data from all tasks and distribute it to all nonblocking.
    Definition communication.hh:445
    │ │ │ │ -
    Communication()
    Construct default object.
    Definition communication.hh:103
    │ │ │ │ -
    A wrapper-class for a object which is ready immediately.
    Definition future.hh:122
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,480 +1,43 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -communication.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +utility.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_PARALLEL_COMMUNICATION_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_COMMUNICATION_HH │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18 │ │ │ │ │ -19#include <_d_u_n_e_/_c_o_m_m_o_n_/_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h> │ │ │ │ │ -20#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_f_u_t_u_r_e_._h_h> │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_STD_UTILITY_HH │ │ │ │ │ +4#define DUNE_COMMON_STD_UTILITY_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include │ │ │ │ │ +7 │ │ │ │ │ +8#warning dune/common/std/utility.hh is deprecated and will be removed after │ │ │ │ │ +Dune 2.8.\ │ │ │ │ │ +9 Include instead │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e │ │ │ │ │ +12{ │ │ │ │ │ +13 │ │ │ │ │ +14 namespace Std │ │ │ │ │ +15 { │ │ │ │ │ +16 │ │ │ │ │ +17 using std::integer_sequence; │ │ │ │ │ +18 using std::index_sequence; │ │ │ │ │ +19 using std::make_integer_sequence; │ │ │ │ │ +20 using std::make_index_sequence; │ │ │ │ │ +21 using std::index_sequence_for; │ │ │ │ │ 22 │ │ │ │ │ -42namespace _D_u_n_e │ │ │ │ │ -43{ │ │ │ │ │ -44 │ │ │ │ │ -45 /* define some type that definitely differs from MPI_Comm */ │ │ │ │ │ -_4_6 struct _N_o___C_o_m_m {}; │ │ │ │ │ -47 │ │ │ │ │ -_5_2 inline bool _o_p_e_r_a_t_o_r_=_=(const _N_o___C_o_m_m&, const _N_o___C_o_m_m&) │ │ │ │ │ -53 { │ │ │ │ │ -54 return true; │ │ │ │ │ -55 } │ │ │ │ │ -56 │ │ │ │ │ -_6_1 inline bool _o_p_e_r_a_t_o_r_!_=(const _N_o___C_o_m_m&, const _N_o___C_o_m_m&) │ │ │ │ │ -62 { │ │ │ │ │ -63 return false; │ │ │ │ │ -64 } │ │ │ │ │ -65 │ │ │ │ │ -98 template │ │ │ │ │ -_9_9 class _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -100 { │ │ │ │ │ -101 public: │ │ │ │ │ -_1_0_3 _C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ -104 {} │ │ │ │ │ -105 │ │ │ │ │ -_1_1_0 _C_o_m_m_u_n_i_c_a_t_i_o_n (const Communicator&) │ │ │ │ │ -111 {} │ │ │ │ │ -112 │ │ │ │ │ -_1_1_4 int _r_a_n_k () const │ │ │ │ │ -115 { │ │ │ │ │ -116 return 0; │ │ │ │ │ -117 } │ │ │ │ │ -118 │ │ │ │ │ -_1_2_0 operator _N_o___C_o_m_m() const │ │ │ │ │ -121 { │ │ │ │ │ -122 return {}; │ │ │ │ │ -123 } │ │ │ │ │ -124 │ │ │ │ │ -_1_2_6 int _s_i_z_e () const │ │ │ │ │ -127 { │ │ │ │ │ -128 return 1; │ │ │ │ │ -129 } │ │ │ │ │ -130 │ │ │ │ │ -134 template │ │ │ │ │ -_1_3_5 int _s_e_n_d([[maybe_unused]] const T& data, │ │ │ │ │ -136 [[maybe_unused]] int dest_rank, │ │ │ │ │ -137 [[maybe_unused]] int tag) │ │ │ │ │ -138 { │ │ │ │ │ -139 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ -programs"); │ │ │ │ │ -140 } │ │ │ │ │ -141 │ │ │ │ │ -145 template │ │ │ │ │ -_1_4_6 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_s_e_n_d([[maybe_unused]] const T&& data, │ │ │ │ │ -147 [[maybe_unused]] int dest_rank, │ │ │ │ │ -148 [[maybe_unused]] int tag) │ │ │ │ │ -149 { │ │ │ │ │ -150 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ -programs"); │ │ │ │ │ -151 } │ │ │ │ │ -152 │ │ │ │ │ -156 template │ │ │ │ │ -_1_5_7 T _r_e_c_v([[maybe_unused]] T&& data, │ │ │ │ │ -158 [[maybe_unused]] int source_rank, │ │ │ │ │ -159 [[maybe_unused]] int tag, │ │ │ │ │ -160 [[maybe_unused]] void* status = 0) │ │ │ │ │ -161 { │ │ │ │ │ -162 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ -programs"); │ │ │ │ │ -163 } │ │ │ │ │ -164 │ │ │ │ │ -168 template │ │ │ │ │ -_1_6_9 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_r_e_c_v([[maybe_unused]] T&& data, │ │ │ │ │ -170 [[maybe_unused]] int source_rank, │ │ │ │ │ -171 [[maybe_unused]] int tag) │ │ │ │ │ -172 { │ │ │ │ │ -173 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ -programs"); │ │ │ │ │ -174 } │ │ │ │ │ -175 │ │ │ │ │ -176 template │ │ │ │ │ -_1_7_7 T _r_r_e_c_v([[maybe_unused]] T&& data, │ │ │ │ │ -178 [[maybe_unused]] int source_rank, │ │ │ │ │ -179 [[maybe_unused]] int tag, │ │ │ │ │ -180 [[maybe_unused]] void* status = 0) const │ │ │ │ │ -181 { │ │ │ │ │ -182 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "This method is not supported in sequential │ │ │ │ │ -programs"); │ │ │ │ │ -183 } │ │ │ │ │ -187 template │ │ │ │ │ -_1_8_8 T _s_u_m (const T& in) const │ │ │ │ │ -189 { │ │ │ │ │ -190 return in; │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -198 template │ │ │ │ │ -_1_9_9 int _s_u_m ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ -200 { │ │ │ │ │ -201 return 0; │ │ │ │ │ -202 } │ │ │ │ │ -203 │ │ │ │ │ -207 template │ │ │ │ │ -_2_0_8 T _p_r_o_d (const T& in) const │ │ │ │ │ -209 { │ │ │ │ │ -210 return in; │ │ │ │ │ -211 } │ │ │ │ │ -212 │ │ │ │ │ -218 template │ │ │ │ │ -_2_1_9 int _p_r_o_d ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ -220 { │ │ │ │ │ -221 return 0; │ │ │ │ │ -222 } │ │ │ │ │ -223 │ │ │ │ │ -227 template │ │ │ │ │ -_2_2_8 T _m_i_n (const T& in) const │ │ │ │ │ -229 { │ │ │ │ │ -230 return in; │ │ │ │ │ -231 } │ │ │ │ │ -232 │ │ │ │ │ -238 template │ │ │ │ │ -_2_3_9 int _m_i_n ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ -240 { │ │ │ │ │ -241 return 0; │ │ │ │ │ -242 } │ │ │ │ │ -243 │ │ │ │ │ -247 template │ │ │ │ │ -_2_4_8 T _m_a_x (const T& in) const │ │ │ │ │ -249 { │ │ │ │ │ -250 return in; │ │ │ │ │ -251 } │ │ │ │ │ -252 │ │ │ │ │ -258 template │ │ │ │ │ -_2_5_9 int _m_a_x ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const │ │ │ │ │ -260 { │ │ │ │ │ -261 return 0; │ │ │ │ │ -262 } │ │ │ │ │ -263 │ │ │ │ │ -_2_6_7 int _b_a_r_r_i_e_r () const │ │ │ │ │ -268 { │ │ │ │ │ -269 return 0; │ │ │ │ │ -270 } │ │ │ │ │ -271 │ │ │ │ │ -_2_7_5 _P_s_e_u_d_o_F_u_t_u_r_e_<_v_o_i_d_> _i_b_a_r_r_i_e_r () const │ │ │ │ │ -276 { │ │ │ │ │ -277 return {true}; // return a valid future │ │ │ │ │ -278 } │ │ │ │ │ -279 │ │ │ │ │ -283 template │ │ │ │ │ -_2_8_4 int _b_r_o_a_d_c_a_s_t ([[maybe_unused]] T* inout, │ │ │ │ │ -285 [[maybe_unused]] int len, │ │ │ │ │ -286 [[maybe_unused]] int root) const │ │ │ │ │ -287 { │ │ │ │ │ -288 return 0; │ │ │ │ │ -289 } │ │ │ │ │ -290 │ │ │ │ │ -294 template │ │ │ │ │ -_2_9_5 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_b_r_o_a_d_c_a_s_t(T&& data, int root) const{ │ │ │ │ │ -296 return {std::forward(data)}; │ │ │ │ │ -297 } │ │ │ │ │ -298 │ │ │ │ │ -299 │ │ │ │ │ -312 template │ │ │ │ │ -_3_1_3 int _g_a_t_h_e_r (const T* in, T* out, int len, [[maybe_unused]] int root) const │ │ │ │ │ -// note out must have same size as in │ │ │ │ │ -314 { │ │ │ │ │ -315 for (int i=0; i> │ │ │ │ │ -_3_2_4 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out, int root){ │ │ │ │ │ -325 *(data_out.begin()) = std::forward(data_in); │ │ │ │ │ -326 return {std::forward(data_out)}; │ │ │ │ │ -327 } │ │ │ │ │ -328 │ │ │ │ │ -329 │ │ │ │ │ -349 template │ │ │ │ │ -_3_5_0 int _g_a_t_h_e_r_v (const T* in, │ │ │ │ │ -351 int sendDataLen, │ │ │ │ │ -352 T* out, │ │ │ │ │ -353 [[maybe_unused]] int* recvDataLen, │ │ │ │ │ -354 int* displ, │ │ │ │ │ -355 [[maybe_unused]] int root) const │ │ │ │ │ -356 { │ │ │ │ │ -357 for (int i=*displ; i │ │ │ │ │ -_3_7_6 int _s_c_a_t_t_e_r (const T* sendData, T* recvData, int len, [[maybe_unused]] int │ │ │ │ │ -root) const // note out must have same size as in │ │ │ │ │ -377 { │ │ │ │ │ -378 for (int i=0; i │ │ │ │ │ -_3_8_7 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_s_c_a_t_t_e_r(TIN&& data_in, TOUT&& data_out, int root){ │ │ │ │ │ -388 data_out = *(std::forward(data_in).begin()); │ │ │ │ │ -389 return {std::forward(data_out)}; │ │ │ │ │ -390 } │ │ │ │ │ -391 │ │ │ │ │ -410 template │ │ │ │ │ -_4_1_1 int _s_c_a_t_t_e_r_v (const T* sendData,int* sendDataLen, int* displ, T* recvData, │ │ │ │ │ -412 [[maybe_unused]] int recvDataLen, [[maybe_unused]] int root) const │ │ │ │ │ -413 { │ │ │ │ │ -414 for (int i=*displ; i<*sendDataLen; i++) │ │ │ │ │ -415 recvData[i] = sendData[i]; │ │ │ │ │ -416 return 0; │ │ │ │ │ -417 } │ │ │ │ │ -418 │ │ │ │ │ -432 template │ │ │ │ │ -_4_3_3 int _a_l_l_g_a_t_h_e_r(const T* sbuf, int count, T* rbuf) const │ │ │ │ │ -434 { │ │ │ │ │ -435 for(const T* end=sbuf+count; sbuf < end; ++sbuf, ++rbuf) │ │ │ │ │ -436 *rbuf=*sbuf; │ │ │ │ │ -437 return 0; │ │ │ │ │ -438 } │ │ │ │ │ -439 │ │ │ │ │ -444 template │ │ │ │ │ -_4_4_5 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_a_l_l_g_a_t_h_e_r(TIN&& data_in, TOUT&& data_out){ │ │ │ │ │ -446 return {std::forward(data_out)}; │ │ │ │ │ -447 } │ │ │ │ │ -448 │ │ │ │ │ -465 template │ │ │ │ │ -_4_6_6 int _a_l_l_g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, [[maybe_unused]] int* │ │ │ │ │ -recvDataLen, int* displ) const │ │ │ │ │ -467 { │ │ │ │ │ -468 for (int i=*displ; i │ │ │ │ │ -_4_8_6 int _a_l_l_r_e_d_u_c_e([[maybe_unused]] Type* inout, [[maybe_unused]] int len) const │ │ │ │ │ -487 { │ │ │ │ │ -488 return 0; │ │ │ │ │ -489 } │ │ │ │ │ -490 │ │ │ │ │ -495 template │ │ │ │ │ -_4_9_6 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_O_U_T_> _i_a_l_l_r_e_d_u_c_e(TIN&& data_in, TOUT&& data_out){ │ │ │ │ │ -497 data_out = std::forward(data_in); │ │ │ │ │ -498 return {std::forward(data_out)}; │ │ │ │ │ -499 } │ │ │ │ │ -500 │ │ │ │ │ -505 template │ │ │ │ │ -_5_0_6 _P_s_e_u_d_o_F_u_t_u_r_e_<_T_> _i_a_l_l_r_e_d_u_c_e(T&& data){ │ │ │ │ │ -507 return {std::forward(data)}; │ │ │ │ │ -508 } │ │ │ │ │ -509 │ │ │ │ │ -510 │ │ │ │ │ -524 template │ │ │ │ │ -_5_2_5 int _a_l_l_r_e_d_u_c_e(const Type* in, Type* out, int len) const │ │ │ │ │ -526 { │ │ │ │ │ -527 std::copy(in, in+len, out); │ │ │ │ │ -528 return 0; │ │ │ │ │ -529 } │ │ │ │ │ -530 │ │ │ │ │ -531 }; │ │ │ │ │ -532 │ │ │ │ │ -538 template │ │ │ │ │ -_5_3_9 using _C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -540 [[deprecated("CollectiveCommunication is deprecated. Use Communication │ │ │ │ │ -instead.")]] │ │ │ │ │ -541 = _C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_>; │ │ │ │ │ -542} │ │ │ │ │ -543 │ │ │ │ │ -544#endif │ │ │ │ │ -_b_i_n_a_r_y_f_u_n_c_t_i_o_n_s_._h_h │ │ │ │ │ -helper classes to provide unique types for standard functions │ │ │ │ │ -_f_u_t_u_r_e_._h_h │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for equality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for inequality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ +23 } // namespace Std │ │ │ │ │ +24 │ │ │ │ │ +25} // namespace Dune │ │ │ │ │ +26 │ │ │ │ │ +27#endif // #ifndef DUNE_COMMON_STD_UTILITY_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_E_r_r_o_r │ │ │ │ │ -Default exception if an error in the parallel communication of the program │ │ │ │ │ -occurred. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:287 │ │ │ │ │ -_D_u_n_e_:_:_N_o___C_o_m_m │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Collective communication interface and sequential default implementation. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ -PseudoFuture< TOUT > iallreduce(TIN &&data_in, TOUT &&data_out) │ │ │ │ │ -Compute something over all processes nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:496 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_e_n_d │ │ │ │ │ -int send(const T &data, int dest_rank, int tag) │ │ │ │ │ -Sends the data to the dest_rank. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:135 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ -int allreduce(const Type *in, Type *out, int len) const │ │ │ │ │ -Compute something over all processes for each component of an array and return │ │ │ │ │ -the result in every pr... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:525 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_a_x │ │ │ │ │ -T max(const T &in) const │ │ │ │ │ -Compute the maximum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:248 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_a_n_k │ │ │ │ │ -int rank() const │ │ │ │ │ -Return rank, is between 0 and size()-1. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:114 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_u_m │ │ │ │ │ -T sum(const T &in) const │ │ │ │ │ -Compute the sum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_c_a_t_t_e_r_v │ │ │ │ │ -int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int │ │ │ │ │ -recvDataLen, int root) const │ │ │ │ │ -Scatter arrays of variable length from a root to all other tasks. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:411 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_d │ │ │ │ │ -int prod(T *inout, int len) const │ │ │ │ │ -Compute the product over all processes for each component of an array and │ │ │ │ │ -return the result in every ... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:219 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_c_v │ │ │ │ │ -T recv(T &&data, int source_rank, int tag, void *status=0) │ │ │ │ │ -Receives the data from the source_rank. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:157 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_s_e_n_d │ │ │ │ │ -PseudoFuture< T > isend(const T &&data, int dest_rank, int tag) │ │ │ │ │ -Sends the data to the dest_rank nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:146 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_b_a_r_r_i_e_r │ │ │ │ │ -PseudoFuture< void > ibarrier() const │ │ │ │ │ -Nonblocking barrier. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_r_e_d_u_c_e │ │ │ │ │ -int allreduce(Type *inout, int len) const │ │ │ │ │ -Compute something over all processes for each component of an array and return │ │ │ │ │ -the result in every pr... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:486 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -Number of processes in set, is greater than 0. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_u_m │ │ │ │ │ -int sum(T *inout, int len) const │ │ │ │ │ -Compute the sum over all processes for each component of an array and return │ │ │ │ │ -the result in every proc... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:199 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_g_a_t_h_e_r_v │ │ │ │ │ -int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int │ │ │ │ │ -*displ) const │ │ │ │ │ -Gathers data of variable length from all tasks and distribute it to all. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_i_n │ │ │ │ │ -T min(const T &in) const │ │ │ │ │ -Compute the minimum of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:228 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_r_e_c_v │ │ │ │ │ -PseudoFuture< T > irecv(T &&data, int source_rank, int tag) │ │ │ │ │ -Receives the data from the source_rank nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:169 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_a_t_h_e_r_v │ │ │ │ │ -int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, │ │ │ │ │ -int root) const │ │ │ │ │ -Gather arrays of variable size on root task. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:350 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_b_r_o_a_d_c_a_s_t │ │ │ │ │ -PseudoFuture< T > ibroadcast(T &&data, int root) const │ │ │ │ │ -Distribute an array from the process with rank root to all other processes │ │ │ │ │ -nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:295 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_l_l_g_a_t_h_e_r │ │ │ │ │ -int allgather(const T *sbuf, int count, T *rbuf) const │ │ │ │ │ -Gathers data from all tasks and distribute it to all. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:433 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_s_c_a_t_t_e_r │ │ │ │ │ -int scatter(const T *sendData, T *recvData, int len, int root) const │ │ │ │ │ -Scatter array from a root to all other task. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:376 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_a_t_h_e_r │ │ │ │ │ -int gather(const T *in, T *out, int len, int root) const │ │ │ │ │ -Gather arrays on root task. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:313 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_a_l_l_r_e_d_u_c_e │ │ │ │ │ -PseudoFuture< T > iallreduce(T &&data) │ │ │ │ │ -Compute something over all processes nonblocking and in-place. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:506 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Communication(const Communicator &) │ │ │ │ │ -Constructor with a given communicator. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_a_x │ │ │ │ │ -int max(T *inout, int len) const │ │ │ │ │ -Compute the maximum over all processes for each component of an array and │ │ │ │ │ -return the result in every ... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_d │ │ │ │ │ -T prod(const T &in) const │ │ │ │ │ -Compute the product of the argument over all processes and return the result in │ │ │ │ │ -every process.... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:208 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_r_o_a_d_c_a_s_t │ │ │ │ │ -int broadcast(T *inout, int len, int root) const │ │ │ │ │ -Distribute an array from the process with rank root to all other processes. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:284 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_r_e_c_v │ │ │ │ │ -T rrecv(T &&data, int source_rank, int tag, void *status=0) const │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:177 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_s_c_a_t_t_e_r │ │ │ │ │ -PseudoFuture< TOUT > iscatter(TIN &&data_in, TOUT &&data_out, int root) │ │ │ │ │ -Scatter array from a root to all other task nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:387 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_m_i_n │ │ │ │ │ -int min(T *inout, int len) const │ │ │ │ │ -Compute the minimum over all processes for each component of an array and │ │ │ │ │ -return the result in every ... │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:239 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_a_r_r_i_e_r │ │ │ │ │ -int barrier() const │ │ │ │ │ -Wait until all processes have arrived at this point in the program. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_g_a_t_h_e_r │ │ │ │ │ -PseudoFuture< TOUT > igather(TIN &&data_in, TOUT &&data_out, int root) │ │ │ │ │ -Gather arrays on root task nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:324 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_a_l_l_g_a_t_h_e_r │ │ │ │ │ -PseudoFuture< TOUT > iallgather(TIN &&data_in, TOUT &&data_out) │ │ │ │ │ -Gathers data from all tasks and distribute it to all nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:445 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Communication() │ │ │ │ │ -Construct default object. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:103 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ -A wrapper-class for a object which is ready immediately. │ │ │ │ │ -DDeeffiinniittiioonn future.hh:122 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00224.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: plocalindex.hh File Reference │ │ │ │ +dune-common: type_traits.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,67 +65,102 @@ │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
    │ │ │ │ - │ │ │ │ +Typedefs | │ │ │ │ +Variables
    │ │ │ │ +
    type_traits.hh File Reference
    │ │ │ │ │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Provides classes for use as the local index in ParallelIndexSet for distributed computing. │ │ │ │ -More...

    │ │ │ │ -
    #include "localindex.hh"
    │ │ │ │ -#include "indexset.hh"
    │ │ │ │ -#include "mpitraits.hh"
    │ │ │ │ -#include <iostream>
    │ │ │ │ +
    #include <type_traits>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │ +#include <dune/common/typeutilities.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::ParallelLocalIndex< T >
     An index present on the local process with an additional attribute flag. More...
    struct  Dune::Std::nonesuch
     Type representing a lookup failure by std::detected_or and friends. More...
     
    struct  Dune::Std::conjunction< B >
     forms the logical conjunction of the type traits B... More...
     
    struct  Dune::LocalIndexComparator< ParallelLocalIndex< T > >
    struct  Dune::Std::disjunction< B >
     forms the logical disjunction of the type traits B... More...
     
    class  Dune::MPITraits< ParallelLocalIndex< T > >
    struct  Dune::Std::negation< B >
     forms the logical negation of the type traits B... More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Std
     Namespace for features backported from new C++ standards.
     
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ +Typedefs

    template<typename Default , template< typename... > class Op, typename... Args>
    using Dune::Std::detected_or = Impl::detector< Default, void, Op, Args... >
     Detects whether Op<Args...> is valid and makes the result available.
     
    template<template< typename... > class Op, typename... Args>
    using Dune::Std::is_detected = typename detected_or< nonesuch, Op, Args... >::value_t
     Detects whether Op<Args...> is valid.
     
    template<template< typename... > class Op, typename... Args>
    using Dune::Std::detected_t = typename detected_or< nonesuch, Op, Args... >::type
     Returns Op<Args...> if that is valid; otherwise returns nonesuch.
     
    template<typename Default , template< typename... > class Op, typename... Args>
    using Dune::Std::detected_or_t = typename detected_or< Default, Op, Args... >::type
     Returns Op<Args...> if that is valid; otherwise returns the fallback type Default.
     
    template<typename Expected , template< typename... > class Op, typename... Args>
    using Dune::Std::is_detected_exact = std::is_same< Expected, detected_t< Op, Args... > >
     Checks whether Op<Args...> is Expected without causing an error if Op<Args...> is invalid.
     
    template<typename Target , template< typename... > class Op, typename... Args>
    using Dune::Std::is_detected_convertible = std::is_convertible< Target, detected_t< Op, Args... > >
     Checks whether Op<Args...> is convertible to Target without causing an error if Op<Args...> is invalid.
     
    template<template< typename... > class Fallback, template< typename... > class TargetType, typename... Args>
    using Dune::detected_or_fallback_t = Std::detected_or_t< decltype(detail::warningIfNotDefined< Std::detected_t< Fallback, Args... > >(std::declval< const Std::detected_t< TargetType, Args... > * >())), TargetType, Args... >
     This type will be either TargetType<Args...> if it exists, or the Fallback<Args...> type.
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ -Functions

    template<class T >
    std::ostream & Dune::operator<< (std::ostream &os, const ParallelLocalIndex< T > &index)
     Print the local index to a stream.
     
    template<typename T >
    bool Dune::operator== (const ParallelLocalIndex< T > &p1, const ParallelLocalIndex< T > &p2)
     
    template<typename T >
    bool Dune::operator!= (const ParallelLocalIndex< T > &p1, const ParallelLocalIndex< T > &p2)
     

    │ │ │ │ +Variables

    template<template< typename... > class Op, typename... Args>
    constexpr bool Dune::Std::is_detected_v = is_detected<Op,Args...>::value
     Detects whether Op<Args...> is valid and makes the result available as a value.
     
    template<typename Expected , template< typename... > class Op, typename... Args>
    constexpr bool Dune::Std::is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value
     Convenient access to the result value of is_detected_exact.
     
    template<typename Target , template< typename... > class Op, typename... Args>
    constexpr bool Dune::Std::is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value
     Convenient access to the result value of is_detected_convertible.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Provides classes for use as the local index in ParallelIndexSet for distributed computing.

    │ │ │ │ -
    Author
    Markus Blatt
    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,51 +1,97 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_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 │ │ │ │ │ -plocalindex.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ -Provides classes for use as the local index in ParallelIndexSet for distributed │ │ │ │ │ -computing. _M_o_r_e_._._. │ │ │ │ │ -#include "_l_o_c_a_l_i_n_d_e_x_._h_h" │ │ │ │ │ -#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ -#include "_m_p_i_t_r_a_i_t_s_._h_h" │ │ │ │ │ -#include │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +type_traits.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_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_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_ _> │ │ │ │ │ -  An index present on the local process with an additional attribute │ │ │ │ │ - flag. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_n_o_n_e_s_u_c_h │ │ │ │ │ +  Type representing a lookup failure by std::detected_or and friends. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r_<_ _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_ _>_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_c_o_n_j_u_n_c_t_i_o_n_<_ _B_ _> │ │ │ │ │ +  forms the logical conjunction of the type traits B... _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_M_P_I_T_r_a_i_t_s_<_ _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_ _T_ _>_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_d_i_s_j_u_n_c_t_i_o_n_<_ _B_ _> │ │ │ │ │ +  forms the logical disjunction of the type traits B... _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_n_e_g_a_t_i_o_n_<_ _B_ _> │ │ │ │ │ +  forms the logical negation of the type traits B... _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T │ │ │ │ │ - > &index) │ │ │ │ │ -  Print the local index to a stream. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p1, const │ │ │ │ │ - _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p1, const │ │ │ │ │ - _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x< T > &p2) │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides classes for use as the local index in ParallelIndexSet for distributed │ │ │ │ │ -computing. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │ +  │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template class Op, typename... Args> │ │ │ │ │ +using  _D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r = Impl::detector< Default, void, Op, Args... > │ │ │ │ │ +  Detects whether Op is valid and makes the result available. │ │ │ │ │ +  │ │ │ │ │ +template class Op, typename... Args> │ │ │ │ │ +using  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d = typename _d_e_t_e_c_t_e_d___o_r< _n_o_n_e_s_u_c_h, Op, Args... >:: │ │ │ │ │ + value_t │ │ │ │ │ +  Detects whether Op is valid. │ │ │ │ │ +  │ │ │ │ │ +template class Op, typename... Args> │ │ │ │ │ +using  _D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___t = typename _d_e_t_e_c_t_e_d___o_r< _n_o_n_e_s_u_c_h, Op, Args... >:: │ │ │ │ │ + type │ │ │ │ │ +  Returns Op if that is valid; otherwise returns nonesuch. │ │ │ │ │ +  │ │ │ │ │ +template class Op, typename... Args> │ │ │ │ │ +using  _D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t = typename _d_e_t_e_c_t_e_d___o_r< Default, Op, Args... │ │ │ │ │ + >::type │ │ │ │ │ +  Returns Op if that is valid; otherwise returns the fallback │ │ │ │ │ + type Default. │ │ │ │ │ +  │ │ │ │ │ +template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +using  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t = std::is_same< Expected, _d_e_t_e_c_t_e_d___t< Op, │ │ │ │ │ + Args... > > │ │ │ │ │ +  Checks whether Op is Expected without causing an error if │ │ │ │ │ + Op is invalid. │ │ │ │ │ +  │ │ │ │ │ +template class Op, typename... Args> │ │ │ │ │ +using  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e = std::is_convertible< Target, │ │ │ │ │ + _d_e_t_e_c_t_e_d___t< Op, Args... > > │ │ │ │ │ +  Checks whether Op is convertible to Target without causing an │ │ │ │ │ + error if Op is invalid. │ │ │ │ │ +  │ │ │ │ │ +template class Fallback, template< typename... > class │ │ │ │ │ +TargetType, typename... Args> │ │ │ │ │ +using  _D_u_n_e_:_:_d_e_t_e_c_t_e_d___o_r___f_a_l_l_b_a_c_k___t = _S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t< decltype(detail:: │ │ │ │ │ + warningIfNotDefined< _S_t_d_:_:_d_e_t_e_c_t_e_d___t< Fallback, Args... > >(std:: │ │ │ │ │ + declval< const _S_t_d_:_:_d_e_t_e_c_t_e_d___t< TargetType, Args... > * >())), │ │ │ │ │ + TargetType, Args... > │ │ │ │ │ +  This type will be either TargetType if it exists, or the │ │ │ │ │ + Fallback type. │ │ │ │ │ +  │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ +template class Op, typename... Args> │ │ │ │ │ +constexpr bool  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___v = _i_s___d_e_t_e_c_t_e_d::value │ │ │ │ │ +  Detects whether Op is valid and makes the result │ │ │ │ │ + available as a value. │ │ │ │ │ +  │ │ │ │ │ +template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +constexpr bool  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t___v = │ │ │ │ │ + _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t::value │ │ │ │ │ +  Convenient access to the result value of is_detected_exact. │ │ │ │ │ +  │ │ │ │ │ +template class Op, typename... Args> │ │ │ │ │ +constexpr bool  _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e___v = │ │ │ │ │ + _i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e::value │ │ │ │ │ +  Convenient access to the result value of │ │ │ │ │ + is_detected_convertible. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00224_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: plocalindex.hh Source File │ │ │ │ +dune-common: type_traits.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,306 +70,223 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    plocalindex.hh
    │ │ │ │ +
    type_traits.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5
    │ │ │ │ -
    6#ifndef DUNE_PLOCALINDEX_HH
    │ │ │ │ -
    7#define DUNE_PLOCALINDEX_HH
    │ │ │ │ -
    8
    │ │ │ │ -
    9#include "localindex.hh"
    │ │ │ │ -
    10#include "indexset.hh"
    │ │ │ │ -
    11#include "mpitraits.hh"
    │ │ │ │ -
    12
    │ │ │ │ -
    13#include <iostream>
    │ │ │ │ -
    14
    │ │ │ │ -
    15namespace Dune
    │ │ │ │ -
    16{
    │ │ │ │ -
    17
    │ │ │ │ +
    5#ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
    │ │ │ │ +
    6#define DUNE_COMMON_STD_TYPE_TRAITS_HH
    │ │ │ │ +
    7
    │ │ │ │ +
    8#include <type_traits>
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    11
    │ │ │ │ +
    12#if __has_include(<experimental/type_traits>)
    │ │ │ │ +
    13#include <experimental/type_traits>
    │ │ │ │ +
    14#endif
    │ │ │ │ +
    15
    │ │ │ │ +
    16namespace Dune
    │ │ │ │ +
    17{
    │ │ │ │
    18
    │ │ │ │ -
    29 template<class T> class ParallelLocalIndex;
    │ │ │ │ -
    30
    │ │ │ │ -
    36 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    37 std::ostream& operator<<(std::ostream& os, const ParallelLocalIndex<T>& index)
    │ │ │ │ -
    38 {
    │ │ │ │ -
    39 os<<"{local="<<index.localIndex_<<", attr="<<T(index.attribute_)<<", public="
    │ │ │ │ -
    40 <<(index.public_ ? true : false)<<"}";
    │ │ │ │ -
    41 return os;
    │ │ │ │ -
    42 }
    │ │ │ │ -
    │ │ │ │ -
    43
    │ │ │ │ -
    47 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    49 {
    │ │ │ │ -
    50#if HAVE_MPI
    │ │ │ │ -
    51 // friend declaration needed for MPITraits
    │ │ │ │ -
    52 friend struct MPITraits<ParallelLocalIndex<T> >;
    │ │ │ │ -
    53#endif
    │ │ │ │ -
    54 friend std::ostream& operator<<<>(std::ostream& os, const ParallelLocalIndex<T>& index);
    │ │ │ │ +
    20
    │ │ │ │ +
    29namespace Std
    │ │ │ │ +
    30{
    │ │ │ │ +
    31
    │ │ │ │ +
    34 using std::bool_constant;
    │ │ │ │ +
    35
    │ │ │ │ +
    36#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
    │ │ │ │ +
    37
    │ │ │ │ +
    38 using std::experimental::nonesuch;
    │ │ │ │ +
    39 using std::experimental::detected_or;
    │ │ │ │ +
    40 using std::experimental::is_detected;
    │ │ │ │ +
    41 using std::experimental::detected_t;
    │ │ │ │ +
    42 using std::experimental::is_detected_v;
    │ │ │ │ +
    43 using std::experimental::detected_or_t;
    │ │ │ │ +
    44 using std::experimental::is_detected_exact;
    │ │ │ │ +
    45 using std::experimental::is_detected_exact_v;
    │ │ │ │ +
    46 using std::experimental::is_detected_convertible;
    │ │ │ │ +
    47 using std::experimental::is_detected_convertible_v;
    │ │ │ │ +
    48
    │ │ │ │ +
    49#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
    │ │ │ │ +
    50
    │ │ │ │ +
    51 // fallback version of std::experimental::is_detected et al., heavily scribbled
    │ │ │ │ +
    52 // from cppreference.com (but there is actually not much implementation to the thing)
    │ │ │ │ +
    53
    │ │ │ │ +
    54#ifndef DOXYGEN
    │ │ │ │
    55
    │ │ │ │ -
    56 public:
    │ │ │ │ -
    64 typedef T Attribute;
    │ │ │ │ - │ │ │ │ -
    74
    │ │ │ │ -
    83 ParallelLocalIndex(size_t localIndex, const Attribute& attribute, bool isPublic=true);
    │ │ │ │ - │ │ │ │ -
    90
    │ │ │ │ -
    91#if 0
    │ │ │ │ - │ │ │ │ -
    102#endif
    │ │ │ │ -
    103
    │ │ │ │ -
    108 inline const Attribute attribute() const;
    │ │ │ │ -
    109
    │ │ │ │ -
    114 inline void setAttribute(const Attribute& attribute);
    │ │ │ │ -
    115
    │ │ │ │ -
    120 inline size_t local() const;
    │ │ │ │ -
    121
    │ │ │ │ -
    125 inline operator size_t() const;
    │ │ │ │ -
    126
    │ │ │ │ -
    132 inline ParallelLocalIndex<Attribute>& operator=(size_t index);
    │ │ │ │ -
    133
    │ │ │ │ -
    138 inline bool isPublic() const;
    │ │ │ │ -
    139
    │ │ │ │ -
    144 inline LocalIndexState state() const;
    │ │ │ │ +
    56 namespace Impl {
    │ │ │ │ +
    57
    │ │ │ │ +
    58 // default version of detector, this gets matched on failure
    │ │ │ │ +
    59 template<typename Default, typename Void, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    60 struct detector
    │ │ │ │ +
    61 {
    │ │ │ │ +
    62 using value_t = std::false_type;
    │ │ │ │ +
    63 using type = Default;
    │ │ │ │ +
    64 };
    │ │ │ │ +
    65
    │ │ │ │ +
    66 // specialization of detector that matches if Op<Args...> can be instantiated
    │ │ │ │ +
    67 template<typename Default, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    68 struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
    │ │ │ │ +
    69 {
    │ │ │ │ +
    70 using value_t = std::true_type;
    │ │ │ │ +
    71 using type = Op<Args...>;
    │ │ │ │ +
    72 };
    │ │ │ │ +
    73
    │ │ │ │ +
    74 }
    │ │ │ │ +
    75
    │ │ │ │ +
    76#endif // DOXYGEN
    │ │ │ │ +
    77
    │ │ │ │ +
    79
    │ │ │ │ +
    │ │ │ │ +
    87 struct nonesuch
    │ │ │ │ +
    88 {
    │ │ │ │ +
    89 nonesuch() = delete;
    │ │ │ │ +
    90 ~nonesuch() = delete;
    │ │ │ │ +
    91 nonesuch(const nonesuch&) = delete;
    │ │ │ │ +
    92 void operator=(const nonesuch&) = delete;
    │ │ │ │ +
    93 };
    │ │ │ │ +
    │ │ │ │ +
    94
    │ │ │ │ +
    96
    │ │ │ │ +
    127 template<typename Default, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    128 using detected_or = Impl::detector<Default,void,Op,Args...>;
    │ │ │ │ +
    129
    │ │ │ │ +
    131
    │ │ │ │ +
    140 template<template<typename...> class Op, typename... Args>
    │ │ │ │ +
    141 using is_detected = typename detected_or<nonesuch,Op,Args...>::value_t;
    │ │ │ │ +
    142
    │ │ │ │ +
    143#ifdef __cpp_variable_templates
    │ │ │ │
    145
    │ │ │ │ -
    150 inline void setState(const LocalIndexState& state);
    │ │ │ │ -
    151
    │ │ │ │ -
    152 private:
    │ │ │ │ -
    154 size_t localIndex_;
    │ │ │ │ -
    155
    │ │ │ │ -
    157 char attribute_;
    │ │ │ │ -
    158
    │ │ │ │ -
    160 char public_;
    │ │ │ │ -
    161
    │ │ │ │ -
    168 char state_;
    │ │ │ │ -
    169
    │ │ │ │ -
    170 };
    │ │ │ │ -
    │ │ │ │ +
    154 template<template<typename...> class Op, typename... Args>
    │ │ │ │ +
    155 constexpr bool is_detected_v = is_detected<Op,Args...>::value;
    │ │ │ │ +
    156#endif // __cpp_variable_templates
    │ │ │ │ +
    157
    │ │ │ │ +
    159
    │ │ │ │ +
    169 template<template<typename...> class Op, typename... Args>
    │ │ │ │ +
    170 using detected_t = typename detected_or<nonesuch,Op,Args...>::type;
    │ │ │ │
    171
    │ │ │ │ -
    172 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    174 const ParallelLocalIndex<T>& p2)
    │ │ │ │ -
    175 {
    │ │ │ │ -
    176 if(p1.local()!=p2.local())
    │ │ │ │ -
    177 return false;
    │ │ │ │ -
    178 if(p1.attribute()!=p2.attribute())
    │ │ │ │ -
    179 return false;
    │ │ │ │ -
    180 if(p1.isPublic()!=p2.isPublic())
    │ │ │ │ -
    181 return false;
    │ │ │ │ -
    182 return true;
    │ │ │ │ -
    183 }
    │ │ │ │ -
    │ │ │ │ -
    184 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    186 const ParallelLocalIndex<T>& p2)
    │ │ │ │ -
    187 {
    │ │ │ │ -
    188 return !(p1==p2);
    │ │ │ │ -
    189 }
    │ │ │ │ -
    │ │ │ │ -
    190
    │ │ │ │ -
    191
    │ │ │ │ -
    192 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    194 {
    │ │ │ │ -
    │ │ │ │ -
    195 static bool compare(const ParallelLocalIndex<T>& t1,
    │ │ │ │ -
    196 const ParallelLocalIndex<T>& t2){
    │ │ │ │ -
    197 return t1.attribute()<t2.attribute();
    │ │ │ │ -
    198 }
    │ │ │ │ -
    │ │ │ │ -
    199 };
    │ │ │ │ -
    │ │ │ │ -
    200
    │ │ │ │ -
    201
    │ │ │ │ -
    202#if HAVE_MPI
    │ │ │ │ -
    203
    │ │ │ │ -
    205 template<typename T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    207 {
    │ │ │ │ -
    208 public:
    │ │ │ │ -
    209 static MPI_Datatype getType();
    │ │ │ │ -
    210 private:
    │ │ │ │ -
    211 static MPI_Datatype type;
    │ │ │ │ -
    212
    │ │ │ │ -
    213 };
    │ │ │ │ -
    │ │ │ │ -
    214
    │ │ │ │ -
    215#endif
    │ │ │ │ -
    216
    │ │ │ │ -
    217 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    218 ParallelLocalIndex<T>::ParallelLocalIndex(const T& attribute, bool isPublic)
    │ │ │ │ -
    219 : localIndex_(0), attribute_(static_cast<char>(attribute)),
    │ │ │ │ -
    220 public_(static_cast<char>(isPublic)), state_(static_cast<char>(VALID))
    │ │ │ │ -
    221 {}
    │ │ │ │ -
    │ │ │ │ -
    222
    │ │ │ │ -
    223
    │ │ │ │ -
    224 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    225 ParallelLocalIndex<T>::ParallelLocalIndex(size_t local, const T& attribute, bool isPublic)
    │ │ │ │ -
    226 : localIndex_(local), attribute_(static_cast<char>(attribute)),
    │ │ │ │ -
    227 public_(static_cast<char>(isPublic)), state_(static_cast<char>(VALID))
    │ │ │ │ -
    228 {}
    │ │ │ │ -
    │ │ │ │ -
    229
    │ │ │ │ -
    230 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    232 : localIndex_(0), attribute_(), public_(static_cast<char>(false)),
    │ │ │ │ -
    233 state_(static_cast<char>(VALID))
    │ │ │ │ -
    234 {}
    │ │ │ │ -
    │ │ │ │ -
    235
    │ │ │ │ -
    236 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    237 inline const T ParallelLocalIndex<T>::attribute() const
    │ │ │ │ -
    238 {
    │ │ │ │ -
    239 return T(attribute_);
    │ │ │ │ -
    240 }
    │ │ │ │ -
    │ │ │ │ -
    241
    │ │ │ │ -
    242 template<class T>
    │ │ │ │ -
    243 inline void
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    245 {
    │ │ │ │ -
    246 attribute_ = attribute;
    │ │ │ │ -
    247 }
    │ │ │ │ -
    │ │ │ │ -
    248
    │ │ │ │ -
    249 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    250 inline size_t ParallelLocalIndex<T>::local() const
    │ │ │ │ -
    251 {
    │ │ │ │ -
    252 return localIndex_;
    │ │ │ │ -
    253 }
    │ │ │ │ -
    │ │ │ │ -
    254
    │ │ │ │ -
    255 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    257 {
    │ │ │ │ -
    258 return localIndex_;
    │ │ │ │ -
    259 }
    │ │ │ │ -
    │ │ │ │ -
    260
    │ │ │ │ -
    261 template<class T>
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    264 {
    │ │ │ │ -
    265 localIndex_=index;
    │ │ │ │ -
    266 return *this;
    │ │ │ │ -
    267 }
    │ │ │ │ -
    │ │ │ │ -
    268
    │ │ │ │ -
    269 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    271 {
    │ │ │ │ -
    272 return static_cast<bool>(public_);
    │ │ │ │ -
    273 }
    │ │ │ │ -
    │ │ │ │ -
    274
    │ │ │ │ -
    275 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    277 {
    │ │ │ │ -
    278 return LocalIndexState(state_);
    │ │ │ │ -
    279 }
    │ │ │ │ -
    │ │ │ │ -
    280
    │ │ │ │ -
    281 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    283 {
    │ │ │ │ -
    284 state_=static_cast<char>(state);
    │ │ │ │ -
    285 }
    │ │ │ │ -
    │ │ │ │ -
    286
    │ │ │ │ -
    287#if HAVE_MPI
    │ │ │ │ -
    288
    │ │ │ │ -
    289 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    290 MPI_Datatype MPITraits<ParallelLocalIndex<T> >::getType()
    │ │ │ │ -
    291 {
    │ │ │ │ -
    292
    │ │ │ │ -
    293 if(type==MPI_DATATYPE_NULL) {
    │ │ │ │ -
    294 int length = 1;
    │ │ │ │ -
    295 MPI_Aint base, disp;
    │ │ │ │ -
    296 MPI_Datatype types[1] = {MPITraits<char>::getType()};
    │ │ │ │ - │ │ │ │ -
    298 MPI_Get_address(&rep, &base);
    │ │ │ │ -
    299 MPI_Get_address(&(rep.attribute_), &disp);
    │ │ │ │ -
    300 disp -= base;
    │ │ │ │ +
    172
    │ │ │ │ +
    174
    │ │ │ │ +
    184 template<typename Default, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    185 using detected_or_t = typename detected_or<Default,Op,Args...>::type;
    │ │ │ │ +
    186
    │ │ │ │ +
    188
    │ │ │ │ +
    194 template<typename Expected, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    195 using is_detected_exact = std::is_same<Expected,detected_t<Op,Args...>>;
    │ │ │ │ +
    196
    │ │ │ │ +
    197#ifdef __cpp_variable_templates
    │ │ │ │ +
    199
    │ │ │ │ +
    205 template<typename Expected, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    206 constexpr bool is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value;
    │ │ │ │ +
    207#endif // __cpp_variable_templates
    │ │ │ │ +
    208
    │ │ │ │ +
    210
    │ │ │ │ +
    216 template<typename Target, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    217 using is_detected_convertible = std::is_convertible<Target,detected_t<Op,Args...>>;
    │ │ │ │ +
    218
    │ │ │ │ +
    219#ifdef __cpp_variable_templates
    │ │ │ │ +
    221
    │ │ │ │ +
    227 template<typename Target, template<typename...> class Op, typename... Args>
    │ │ │ │ +
    228 constexpr bool is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value;
    │ │ │ │ +
    229#endif // __cpp_variable_templates
    │ │ │ │ +
    230
    │ │ │ │ +
    231#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
    │ │ │ │ +
    232
    │ │ │ │ +
    233
    │ │ │ │ +
    234
    │ │ │ │ +
    235 // conjunction
    │ │ │ │ +
    236 // -----------
    │ │ │ │ +
    237
    │ │ │ │ +
    245 template< class... B >
    │ │ │ │ +
    │ │ │ │ +
    246 struct [[deprecated("Will be removed after release 2.8. Use std::conjunction instead.")]] conjunction
    │ │ │ │ +
    247 : std::conjunction<B...>
    │ │ │ │ +
    248 {};
    │ │ │ │ +
    │ │ │ │ +
    249
    │ │ │ │ +
    250
    │ │ │ │ +
    251 // disjunction
    │ │ │ │ +
    252 // -----------
    │ │ │ │ +
    253
    │ │ │ │ +
    261 template< class... B >
    │ │ │ │ +
    │ │ │ │ +
    262 struct [[deprecated("Will be removed after release 2.8. Use std::disjunction instead.")]] disjunction
    │ │ │ │ +
    263 : std::disjunction<B...>
    │ │ │ │ +
    264 {};
    │ │ │ │ +
    │ │ │ │ +
    265
    │ │ │ │ +
    266
    │ │ │ │ +
    267 // negation
    │ │ │ │ +
    268 // --------
    │ │ │ │ +
    269
    │ │ │ │ +
    277 template<class B>
    │ │ │ │ +
    │ │ │ │ +
    278 struct [[deprecated("Will be removed after release 2.8. Use std::negation instead.")]] negation
    │ │ │ │ +
    279 : std::negation<B>
    │ │ │ │ +
    280 {};
    │ │ │ │ +
    │ │ │ │ +
    281
    │ │ │ │ +
    282} // namespace Std
    │ │ │ │ +
    283
    │ │ │ │ +
    284
    │ │ │ │ +
    285namespace detail
    │ │ │ │ +
    286{
    │ │ │ │ +
    287 template <class Type>
    │ │ │ │ +
    288 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code calling `detected_or_fallback_t` for getting the source of this warning!")]]
    │ │ │ │ +
    289 Type warningIfNotDefined(const Std::nonesuch*);
    │ │ │ │ +
    290
    │ │ │ │ +
    291 template <class Type, class T>
    │ │ │ │ +
    292 Type warningIfNotDefined(const T*);
    │ │ │ │ +
    293}
    │ │ │ │ +
    294
    │ │ │ │ +
    296template <template<typename...> class Fallback,
    │ │ │ │ +
    297 template<typename...> class TargetType, typename... Args>
    │ │ │ │ + │ │ │ │ +
    299 detail::warningIfNotDefined<Std::detected_t<Fallback, Args...> >(std::declval<const Std::detected_t<TargetType, Args...>*>())),
    │ │ │ │ +
    300 TargetType, Args...>;
    │ │ │ │
    301
    │ │ │ │ -
    302 MPI_Datatype tmp;
    │ │ │ │ -
    303 MPI_Type_create_struct(1, &length, &disp, types, &tmp);
    │ │ │ │ +
    302
    │ │ │ │ +
    303} // namespace Dune
    │ │ │ │
    304
    │ │ │ │ -
    305 MPI_Type_create_resized(tmp, 0, sizeof(ParallelLocalIndex<T>), &type);
    │ │ │ │ -
    306 MPI_Type_commit(&type);
    │ │ │ │ -
    307
    │ │ │ │ -
    308 MPI_Type_free(&tmp);
    │ │ │ │ -
    309 }
    │ │ │ │ -
    310 return type;
    │ │ │ │ -
    311 }
    │ │ │ │ -
    │ │ │ │ -
    312
    │ │ │ │ -
    313 template<typename T>
    │ │ │ │ -
    314 MPI_Datatype MPITraits<ParallelLocalIndex<T> >::type = MPI_DATATYPE_NULL;
    │ │ │ │ -
    315
    │ │ │ │ -
    316#endif
    │ │ │ │ -
    317
    │ │ │ │ -
    318
    │ │ │ │ -
    320} // namespace Dune
    │ │ │ │ -
    321
    │ │ │ │ -
    322#endif
    │ │ │ │ -
    Traits classes for mapping types onto MPI_Datatype.
    │ │ │ │ -
    Provides a map between global and local indices.
    │ │ │ │ -
    Provides classes for use as the local index in ParallelIndexSet.
    │ │ │ │ -
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition bigunsignedint.hh:278
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition iteratorfacades.hh:237
    │ │ │ │ -
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition iteratorfacades.hh:259
    │ │ │ │ -
    bool isPublic() const
    Check whether the index might also be known other processes.
    Definition plocalindex.hh:270
    │ │ │ │ -
    void setAttribute(const Attribute &attribute)
    Set the attribute of the index.
    Definition plocalindex.hh:244
    │ │ │ │ -
    size_t local() const
    get the local index.
    Definition plocalindex.hh:250
    │ │ │ │ -
    LocalIndexState
    The states available for the local indices.
    Definition localindex.hh:28
    │ │ │ │ -
    void setState(const LocalIndexState &state)
    Set the state.
    Definition plocalindex.hh:282
    │ │ │ │ -
    ParallelLocalIndex< Attribute > & operator=(size_t index)
    Assign a new local index.
    Definition plocalindex.hh:263
    │ │ │ │ -
    LocalIndexState state() const
    Get the state.
    Definition plocalindex.hh:276
    │ │ │ │ -
    ParallelLocalIndex()
    Parameterless constructor.
    Definition plocalindex.hh:231
    │ │ │ │ -
    const Attribute attribute() const
    Get the attribute of the index.
    Definition plocalindex.hh:237
    │ │ │ │ -
    @ VALID
    Definition localindex.hh:28
    │ │ │ │ +
    305#endif // #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
    │ │ │ │ +
    Utilities for type computations, constraining overloads, ...
    │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    constexpr bool is_detected_exact_v
    Convenient access to the result value of is_detected_exact.
    Definition type_traits.hh:206
    │ │ │ │ +
    constexpr bool is_detected_convertible_v
    Convenient access to the result value of is_detected_convertible.
    Definition type_traits.hh:228
    │ │ │ │ +
    typename detected_or< Default, Op, Args... >::type detected_or_t
    Returns Op<Args...> if that is valid; otherwise returns the fallback type Default.
    Definition type_traits.hh:185
    │ │ │ │ +
    std::is_same< Expected, detected_t< Op, Args... > > is_detected_exact
    Checks whether Op<Args...> is Expected without causing an error if Op<Args...> is invalid.
    Definition type_traits.hh:195
    │ │ │ │ +
    typename detected_or< nonesuch, Op, Args... >::type detected_t
    Returns Op<Args...> if that is valid; otherwise returns nonesuch.
    Definition type_traits.hh:170
    │ │ │ │ +
    typename Impl::voider< Types... >::type void_t
    Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
    Definition typetraits.hh:40
    │ │ │ │ +
    constexpr bool is_detected_v
    Detects whether Op<Args...> is valid and makes the result available as a value.
    Definition type_traits.hh:155
    │ │ │ │ +
    typename detected_or< nonesuch, Op, Args... >::value_t is_detected
    Detects whether Op<Args...> is valid.
    Definition type_traits.hh:141
    │ │ │ │ +
    Impl::detector< Default, void, Op, Args... > detected_or
    Detects whether Op<Args...> is valid and makes the result available.
    Definition type_traits.hh:128
    │ │ │ │ +
    std::is_convertible< Target, detected_t< Op, Args... > > is_detected_convertible
    Checks whether Op<Args...> is convertible to Target without causing an error if Op<Args....
    Definition type_traits.hh:217
    │ │ │ │ +
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition mpitraits.hh:41
    │ │ │ │ -
    static MPI_Datatype getType()
    Definition mpitraits.hh:48
    │ │ │ │ -
    Definition indexset.hh:615
    │ │ │ │ -
    An index present on the local process with an additional attribute flag.
    Definition plocalindex.hh:49
    │ │ │ │ -
    T Attribute
    The type of the attributes. Normally this will be an enumeration like.
    Definition plocalindex.hh:64
    │ │ │ │ -
    static bool compare(const ParallelLocalIndex< T > &t1, const ParallelLocalIndex< T > &t2)
    Definition plocalindex.hh:195
    │ │ │ │ +
    Std::detected_or_t< decltype(detail::warningIfNotDefined< Std::detected_t< Fallback, Args... > >(std::declval< const Std::detected_t< TargetType, Args... > * >())), TargetType, Args... > detected_or_fallback_t
    This type will be either TargetType<Args...> if it exists, or the Fallback<Args......
    Definition type_traits.hh:300
    │ │ │ │ +
    Type representing a lookup failure by std::detected_or and friends.
    Definition type_traits.hh:88
    │ │ │ │ + │ │ │ │ +
    nonesuch(const nonesuch &)=delete
    │ │ │ │ +
    void operator=(const nonesuch &)=delete
    │ │ │ │ + │ │ │ │ +
    forms the logical conjunction of the type traits B...
    Definition type_traits.hh:248
    │ │ │ │ +
    forms the logical disjunction of the type traits B...
    Definition type_traits.hh:264
    │ │ │ │ +
    forms the logical negation of the type traits B...
    Definition type_traits.hh:280
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,325 +1,279 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -plocalindex.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +type_traits.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5 │ │ │ │ │ -6#ifndef DUNE_PLOCALINDEX_HH │ │ │ │ │ -7#define DUNE_PLOCALINDEX_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include "_l_o_c_a_l_i_n_d_e_x_._h_h" │ │ │ │ │ -10#include "_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ -11#include "_m_p_i_t_r_a_i_t_s_._h_h" │ │ │ │ │ -12 │ │ │ │ │ -13#include │ │ │ │ │ -14 │ │ │ │ │ -15namespace _D_u_n_e │ │ │ │ │ -16{ │ │ │ │ │ -17 │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +10#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +11 │ │ │ │ │ +12#if __has_include() │ │ │ │ │ +13#include │ │ │ │ │ +14#endif │ │ │ │ │ +15 │ │ │ │ │ +16namespace _D_u_n_e │ │ │ │ │ +17{ │ │ │ │ │ 18 │ │ │ │ │ -29 template class ParallelLocalIndex; │ │ │ │ │ -30 │ │ │ │ │ -36 template │ │ │ │ │ -_3_7 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& │ │ │ │ │ -index) │ │ │ │ │ -38 { │ │ │ │ │ -39 os<<"{local="< │ │ │ │ │ -_4_8 class _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -49 { │ │ │ │ │ -50#if HAVE_MPI │ │ │ │ │ -51 // friend declaration needed for MPITraits │ │ │ │ │ -52 friend struct _M_P_I_T_r_a_i_t_s<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x >; │ │ │ │ │ -53#endif │ │ │ │ │ -54 friend std::ostream& operator<<<>(std::ostream& os, const │ │ │ │ │ -_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& index); │ │ │ │ │ +20 │ │ │ │ │ +29namespace Std │ │ │ │ │ +30{ │ │ │ │ │ +31 │ │ │ │ │ +34 using std::bool_constant; │ │ │ │ │ +35 │ │ │ │ │ +36#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +37 │ │ │ │ │ +38 using std::experimental::nonesuch; │ │ │ │ │ +39 using std::experimental::detected_or; │ │ │ │ │ +40 using std::experimental::is_detected; │ │ │ │ │ +41 using std::experimental::detected_t; │ │ │ │ │ +42 using std::experimental::is_detected_v; │ │ │ │ │ +43 using std::experimental::detected_or_t; │ │ │ │ │ +44 using std::experimental::is_detected_exact; │ │ │ │ │ +45 using std::experimental::is_detected_exact_v; │ │ │ │ │ +46 using std::experimental::is_detected_convertible; │ │ │ │ │ +47 using std::experimental::is_detected_convertible_v; │ │ │ │ │ +48 │ │ │ │ │ +49#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +50 │ │ │ │ │ +51 // fallback version of std::experimental::is_detected et al., heavily │ │ │ │ │ +scribbled │ │ │ │ │ +52 // from cppreference.com (but there is actually not much implementation to │ │ │ │ │ +the thing) │ │ │ │ │ +53 │ │ │ │ │ +54#ifndef DOXYGEN │ │ │ │ │ 55 │ │ │ │ │ -56 public: │ │ │ │ │ -_6_4 typedef T _A_t_t_r_i_b_u_t_e; │ │ │ │ │ -73 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e, bool _i_s_P_u_b_l_i_c); │ │ │ │ │ -74 │ │ │ │ │ -83 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(size_t localIndex, const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e, bool │ │ │ │ │ -_i_s_P_u_b_l_i_c=true); │ │ │ │ │ -89 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(); │ │ │ │ │ -90 │ │ │ │ │ -91#if 0 │ │ │ │ │ -101 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e, size_t _l_o_c_a_l, bool │ │ │ │ │ -_i_s_P_u_b_l_i_c); │ │ │ │ │ -102#endif │ │ │ │ │ -103 │ │ │ │ │ -108 inline const _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() const; │ │ │ │ │ -109 │ │ │ │ │ -114 inline void _s_e_t_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); │ │ │ │ │ -115 │ │ │ │ │ -120 inline size_t _l_o_c_a_l() const; │ │ │ │ │ -121 │ │ │ │ │ -125 inline operator size_t() const; │ │ │ │ │ -126 │ │ │ │ │ -132 inline _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_A_t_t_r_i_b_u_t_e_>& _o_p_e_r_a_t_o_r_=(size_t index); │ │ │ │ │ -133 │ │ │ │ │ -138 inline bool _i_s_P_u_b_l_i_c() const; │ │ │ │ │ -139 │ │ │ │ │ -144 inline _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _s_t_a_t_e() const; │ │ │ │ │ +56 namespace Impl { │ │ │ │ │ +57 │ │ │ │ │ +58 // default version of detector, this gets matched on failure │ │ │ │ │ +59 template class Op, │ │ │ │ │ +typename... Args> │ │ │ │ │ +60 struct detector │ │ │ │ │ +61 { │ │ │ │ │ +62 using value_t = std::false_type; │ │ │ │ │ +63 using type = Default; │ │ │ │ │ +64 }; │ │ │ │ │ +65 │ │ │ │ │ +66 // specialization of detector that matches if Op can be │ │ │ │ │ +instantiated │ │ │ │ │ +67 template class Op, typename... Args> │ │ │ │ │ +68 struct detector>, Op, Args...> │ │ │ │ │ +69 { │ │ │ │ │ +70 using value_t = std::true_type; │ │ │ │ │ +71 using type = Op; │ │ │ │ │ +72 }; │ │ │ │ │ +73 │ │ │ │ │ +74 } │ │ │ │ │ +75 │ │ │ │ │ +76#endif // DOXYGEN │ │ │ │ │ +77 │ │ │ │ │ +79 │ │ │ │ │ +_8_7 struct _n_o_n_e_s_u_c_h │ │ │ │ │ +88 { │ │ │ │ │ +_8_9 _n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ +_9_0 _~_n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ +_9_1 _n_o_n_e_s_u_c_h(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ +_9_2 void _o_p_e_r_a_t_o_r_=(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ +93 }; │ │ │ │ │ +94 │ │ │ │ │ +96 │ │ │ │ │ +127 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +_1_2_8 using _d_e_t_e_c_t_e_d___o_r = Impl::detector; │ │ │ │ │ +129 │ │ │ │ │ +131 │ │ │ │ │ +140 template class Op, typename... Args> │ │ │ │ │ +_1_4_1 using _i_s___d_e_t_e_c_t_e_d = typename _d_e_t_e_c_t_e_d___o_r<_n_o_n_e_s_u_c_h,Op,Args...>::value_t; │ │ │ │ │ +142 │ │ │ │ │ +143#ifdef __cpp_variable_templates │ │ │ │ │ 145 │ │ │ │ │ -150 inline void _s_e_t_S_t_a_t_e(const _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e& _s_t_a_t_e); │ │ │ │ │ -151 │ │ │ │ │ -152 private: │ │ │ │ │ -154 size_t localIndex_; │ │ │ │ │ -155 │ │ │ │ │ -157 char attribute_; │ │ │ │ │ -158 │ │ │ │ │ -160 char public_; │ │ │ │ │ -161 │ │ │ │ │ -168 char state_; │ │ │ │ │ -169 │ │ │ │ │ -170 }; │ │ │ │ │ +154 template class Op, typename... Args> │ │ │ │ │ +_1_5_5 constexpr bool _i_s___d_e_t_e_c_t_e_d___v = _i_s___d_e_t_e_c_t_e_d::value; │ │ │ │ │ +156#endif // __cpp_variable_templates │ │ │ │ │ +157 │ │ │ │ │ +159 │ │ │ │ │ +169 template class Op, typename... Args> │ │ │ │ │ +_1_7_0 using _d_e_t_e_c_t_e_d___t = typename _d_e_t_e_c_t_e_d___o_r<_n_o_n_e_s_u_c_h,Op,Args...>::type; │ │ │ │ │ 171 │ │ │ │ │ -172 template │ │ │ │ │ -_1_7_3 bool _o_p_e_r_a_t_o_r_=_=(const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p1, │ │ │ │ │ -174 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p2) │ │ │ │ │ -175 { │ │ │ │ │ -176 if(p1._l_o_c_a_l()!=p2._l_o_c_a_l()) │ │ │ │ │ -177 return false; │ │ │ │ │ -178 if(p1._a_t_t_r_i_b_u_t_e()!=p2._a_t_t_r_i_b_u_t_e()) │ │ │ │ │ -179 return false; │ │ │ │ │ -180 if(p1._i_s_P_u_b_l_i_c()!=p2._i_s_P_u_b_l_i_c()) │ │ │ │ │ -181 return false; │ │ │ │ │ -182 return true; │ │ │ │ │ -183 } │ │ │ │ │ -184 template │ │ │ │ │ -_1_8_5 bool _o_p_e_r_a_t_o_r_!_=(const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p1, │ │ │ │ │ -186 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p2) │ │ │ │ │ -187 { │ │ │ │ │ -188 return !(p1==p2); │ │ │ │ │ -189 } │ │ │ │ │ -190 │ │ │ │ │ -191 │ │ │ │ │ -192 template │ │ │ │ │ -_1_9_3 struct _L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x > │ │ │ │ │ -194 { │ │ │ │ │ -_1_9_5 static bool _c_o_m_p_a_r_e(const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& t1, │ │ │ │ │ -196 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& t2){ │ │ │ │ │ -197 return t1._a_t_t_r_i_b_u_t_e() │ │ │ │ │ -_2_0_6 class _M_P_I_T_r_a_i_t_s<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x > │ │ │ │ │ -207 { │ │ │ │ │ -208 public: │ │ │ │ │ -209 static MPI_Datatype _g_e_t_T_y_p_e(); │ │ │ │ │ -210 private: │ │ │ │ │ -211 static MPI_Datatype type; │ │ │ │ │ -212 │ │ │ │ │ -213 }; │ │ │ │ │ -214 │ │ │ │ │ -215#endif │ │ │ │ │ -216 │ │ │ │ │ -217 template │ │ │ │ │ -_2_1_8 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(const T& attribute, bool │ │ │ │ │ -isPublic) │ │ │ │ │ -219 : localIndex_(0), attribute_(static_cast(attribute)), │ │ │ │ │ -220 public_(static_cast(isPublic)), state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ -221 {} │ │ │ │ │ -222 │ │ │ │ │ -223 │ │ │ │ │ -224 template │ │ │ │ │ -_2_2_5 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(size_t local, const T& attribute, │ │ │ │ │ -bool isPublic) │ │ │ │ │ -226 : localIndex_(local), attribute_(static_cast(attribute)), │ │ │ │ │ -227 public_(static_cast(isPublic)), state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ -228 {} │ │ │ │ │ -229 │ │ │ │ │ -230 template │ │ │ │ │ -_2_3_1 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x() │ │ │ │ │ -232 : localIndex_(0), attribute_(), public_(static_cast(false)), │ │ │ │ │ -233 state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ -234 {} │ │ │ │ │ -235 │ │ │ │ │ -236 template │ │ │ │ │ -_2_3_7 inline const T _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_a_t_t_r_i_b_u_t_e() const │ │ │ │ │ -238 { │ │ │ │ │ -239 return T(attribute_); │ │ │ │ │ -240 } │ │ │ │ │ -241 │ │ │ │ │ -242 template │ │ │ │ │ -243 inline void │ │ │ │ │ -_2_4_4 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_s_e_t_A_t_t_r_i_b_u_t_e(const _A_t_t_r_i_b_u_t_e& attribute) │ │ │ │ │ -245 { │ │ │ │ │ -246 attribute_ = attribute; │ │ │ │ │ -247 } │ │ │ │ │ -248 │ │ │ │ │ -249 template │ │ │ │ │ -_2_5_0 inline size_t _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_l_o_c_a_l() const │ │ │ │ │ -251 { │ │ │ │ │ -252 return localIndex_; │ │ │ │ │ -253 } │ │ │ │ │ -254 │ │ │ │ │ -255 template │ │ │ │ │ -_2_5_6 inline _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_o_p_e_r_a_t_o_r size_t() const │ │ │ │ │ -257 { │ │ │ │ │ -258 return localIndex_; │ │ │ │ │ -259 } │ │ │ │ │ -260 │ │ │ │ │ -261 template │ │ │ │ │ -262 inline _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& │ │ │ │ │ -_2_6_3 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_o_p_e_r_a_t_o_r_=(size_t index) │ │ │ │ │ -264 { │ │ │ │ │ -265 localIndex_=index; │ │ │ │ │ -266 return *this; │ │ │ │ │ -267 } │ │ │ │ │ -268 │ │ │ │ │ -269 template │ │ │ │ │ -_2_7_0 inline bool _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_i_s_P_u_b_l_i_c() const │ │ │ │ │ -271 { │ │ │ │ │ -272 return static_cast(public_); │ │ │ │ │ -273 } │ │ │ │ │ -274 │ │ │ │ │ -275 template │ │ │ │ │ -_2_7_6 inline _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_s_t_a_t_e() const │ │ │ │ │ -277 { │ │ │ │ │ -278 return _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e(state_); │ │ │ │ │ -279 } │ │ │ │ │ -280 │ │ │ │ │ -281 template │ │ │ │ │ -_2_8_2 inline void _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>_:_:_s_e_t_S_t_a_t_e(const _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e& state) │ │ │ │ │ -283 { │ │ │ │ │ -284 state_=static_cast(state); │ │ │ │ │ -285 } │ │ │ │ │ -286 │ │ │ │ │ -287#if HAVE_MPI │ │ │ │ │ -288 │ │ │ │ │ -289 template │ │ │ │ │ -_2_9_0 MPI_Datatype _M_P_I_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_> >::getType() │ │ │ │ │ -291 { │ │ │ │ │ -292 │ │ │ │ │ -293 if(type==MPI_DATATYPE_NULL) { │ │ │ │ │ -294 int length = 1; │ │ │ │ │ -295 MPI_Aint base, disp; │ │ │ │ │ -296 MPI_Datatype types[1] = {_M_P_I_T_r_a_i_t_s_<_c_h_a_r_>_:_:_g_e_t_T_y_p_e()}; │ │ │ │ │ -297 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_> rep; │ │ │ │ │ -298 MPI_Get_address(&rep, &base); │ │ │ │ │ -299 MPI_Get_address(&(rep.attribute_), &disp); │ │ │ │ │ -300 disp -= base; │ │ │ │ │ +172 │ │ │ │ │ +174 │ │ │ │ │ +184 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +_1_8_5 using _d_e_t_e_c_t_e_d___o_r___t = typename _d_e_t_e_c_t_e_d___o_r::type; │ │ │ │ │ +186 │ │ │ │ │ +188 │ │ │ │ │ +194 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +_1_9_5 using _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t = std::is_same>; │ │ │ │ │ +196 │ │ │ │ │ +197#ifdef __cpp_variable_templates │ │ │ │ │ +199 │ │ │ │ │ +205 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +_2_0_6 constexpr bool _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t___v = │ │ │ │ │ +_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t::value; │ │ │ │ │ +207#endif // __cpp_variable_templates │ │ │ │ │ +208 │ │ │ │ │ +210 │ │ │ │ │ +216 template class Op, typename... Args> │ │ │ │ │ +_2_1_7 using _i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e = std:: │ │ │ │ │ +is_convertible>; │ │ │ │ │ +218 │ │ │ │ │ +219#ifdef __cpp_variable_templates │ │ │ │ │ +221 │ │ │ │ │ +227 template class Op, typename... Args> │ │ │ │ │ +_2_2_8 constexpr bool _i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e___v = │ │ │ │ │ +_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e::value; │ │ │ │ │ +229#endif // __cpp_variable_templates │ │ │ │ │ +230 │ │ │ │ │ +231#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +232 │ │ │ │ │ +233 │ │ │ │ │ +234 │ │ │ │ │ +235 // conjunction │ │ │ │ │ +236 // ----------- │ │ │ │ │ +237 │ │ │ │ │ +245 template< class... B > │ │ │ │ │ +_2_4_6 struct [[deprecated("Will be removed after release 2.8. Use std:: │ │ │ │ │ +conjunction instead.")]] _c_o_n_j_u_n_c_t_i_o_n │ │ │ │ │ +247 : std::conjunction │ │ │ │ │ +248 {}; │ │ │ │ │ +249 │ │ │ │ │ +250 │ │ │ │ │ +251 // disjunction │ │ │ │ │ +252 // ----------- │ │ │ │ │ +253 │ │ │ │ │ +261 template< class... B > │ │ │ │ │ +_2_6_2 struct [[deprecated("Will be removed after release 2.8. Use std:: │ │ │ │ │ +disjunction instead.")]] _d_i_s_j_u_n_c_t_i_o_n │ │ │ │ │ +263 : std::disjunction │ │ │ │ │ +264 {}; │ │ │ │ │ +265 │ │ │ │ │ +266 │ │ │ │ │ +267 // negation │ │ │ │ │ +268 // -------- │ │ │ │ │ +269 │ │ │ │ │ +277 template │ │ │ │ │ +_2_7_8 struct [[deprecated("Will be removed after release 2.8. Use std::negation │ │ │ │ │ +instead.")]] _n_e_g_a_t_i_o_n │ │ │ │ │ +279 : std::negation │ │ │ │ │ +280 {}; │ │ │ │ │ +281 │ │ │ │ │ +282} // namespace Std │ │ │ │ │ +283 │ │ │ │ │ +284 │ │ │ │ │ +285namespace detail │ │ │ │ │ +286{ │ │ │ │ │ +287 template │ │ │ │ │ +288 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code │ │ │ │ │ +calling `detected_or_fallback_t` for getting the source of this warning!")]] │ │ │ │ │ +289 Type warningIfNotDefined(const _S_t_d_:_:_n_o_n_e_s_u_c_h*); │ │ │ │ │ +290 │ │ │ │ │ +291 template │ │ │ │ │ +292 Type warningIfNotDefined(const T*); │ │ │ │ │ +293} │ │ │ │ │ +294 │ │ │ │ │ +296template class Fallback, │ │ │ │ │ +297 template class TargetType, typename... Args> │ │ │ │ │ +_2_9_8using _d_e_t_e_c_t_e_d___o_r___f_a_l_l_b_a_c_k___t = _S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t >(std:: │ │ │ │ │ +declval*>())), │ │ │ │ │ +300 TargetType, Args...>; │ │ │ │ │ 301 │ │ │ │ │ -302 MPI_Datatype tmp; │ │ │ │ │ -303 MPI_Type_create_struct(1, &length, &disp, types, &tmp); │ │ │ │ │ +302 │ │ │ │ │ +303} // namespace Dune │ │ │ │ │ 304 │ │ │ │ │ -305 MPI_Type_create_resized(tmp, 0, sizeof(_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>), &type); │ │ │ │ │ -306 MPI_Type_commit(&type); │ │ │ │ │ -307 │ │ │ │ │ -308 MPI_Type_free(&tmp); │ │ │ │ │ -309 } │ │ │ │ │ -310 return type; │ │ │ │ │ -311 } │ │ │ │ │ -312 │ │ │ │ │ -313 template │ │ │ │ │ -_3_1_4 MPI_Datatype _M_P_I_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_> >::type = MPI_DATATYPE_NULL; │ │ │ │ │ -315 │ │ │ │ │ -316#endif │ │ │ │ │ -317 │ │ │ │ │ -318 │ │ │ │ │ -320} // namespace Dune │ │ │ │ │ -321 │ │ │ │ │ -322#endif │ │ │ │ │ -_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ -_i_n_d_e_x_s_e_t_._h_h │ │ │ │ │ -Provides a map between global and local indices. │ │ │ │ │ -_l_o_c_a_l_i_n_d_e_x_._h_h │ │ │ │ │ -Provides classes for use as the local index in ParallelIndexSet. │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x) │ │ │ │ │ -DDeeffiinniittiioonn bigunsignedint.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator==(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for equality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -EnableIfInterOperable< T1, T2, bool >::type operator!=(const │ │ │ │ │ -ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, │ │ │ │ │ -V2, R2, D > &rhs) │ │ │ │ │ -Checks for inequality. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_i_s_P_u_b_l_i_c │ │ │ │ │ -bool isPublic() const │ │ │ │ │ -Check whether the index might also be known other processes. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:270 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_s_e_t_A_t_t_r_i_b_u_t_e │ │ │ │ │ -void setAttribute(const Attribute &attribute) │ │ │ │ │ -Set the attribute of the index. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:244 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_l_o_c_a_l │ │ │ │ │ -size_t local() const │ │ │ │ │ -get the local index. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:250 │ │ │ │ │ -_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x_S_t_a_t_e │ │ │ │ │ -LocalIndexState │ │ │ │ │ -The states available for the local indices. │ │ │ │ │ -DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_s_e_t_S_t_a_t_e │ │ │ │ │ -void setState(const LocalIndexState &state) │ │ │ │ │ -Set the state. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -ParallelLocalIndex< Attribute > & operator=(size_t index) │ │ │ │ │ -Assign a new local index. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_s_t_a_t_e │ │ │ │ │ -LocalIndexState state() const │ │ │ │ │ -Get the state. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -ParallelLocalIndex() │ │ │ │ │ -Parameterless constructor. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:231 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ │ -const Attribute attribute() const │ │ │ │ │ -Get the attribute of the index. │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_V_A_L_I_D │ │ │ │ │ -@ VALID │ │ │ │ │ -DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ +305#endif // #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ +_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +Utilities for type computations, constraining overloads, ... │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t___v │ │ │ │ │ +constexpr bool is_detected_exact_v │ │ │ │ │ +Convenient access to the result value of is_detected_exact. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e___v │ │ │ │ │ +constexpr bool is_detected_convertible_v │ │ │ │ │ +Convenient access to the result value of is_detected_convertible. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:228 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r___t │ │ │ │ │ +typename detected_or< Default, Op, Args... >::type detected_or_t │ │ │ │ │ +Returns Op if that is valid; otherwise returns the fallback type │ │ │ │ │ +Default. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:185 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t │ │ │ │ │ +std::is_same< Expected, detected_t< Op, Args... > > is_detected_exact │ │ │ │ │ +Checks whether Op is Expected without causing an error if Op │ │ │ │ │ +is invalid. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___t │ │ │ │ │ +typename detected_or< nonesuch, Op, Args... >::type detected_t │ │ │ │ │ +Returns Op if that is valid; otherwise returns nonesuch. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:170 │ │ │ │ │ +_D_u_n_e_:_:_v_o_i_d___t │ │ │ │ │ +typename Impl::voider< Types... >::type void_t │ │ │ │ │ +Is void for all valid input types. The workhorse for C++11 SFINAE-techniques. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___v │ │ │ │ │ +constexpr bool is_detected_v │ │ │ │ │ +Detects whether Op is valid and makes the result available as a value. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d │ │ │ │ │ +typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ +Detects whether Op is valid. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_t_e_c_t_e_d___o_r │ │ │ │ │ +Impl::detector< Default, void, Op, Args... > detected_or │ │ │ │ │ +Detects whether Op is valid and makes the result available. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:128 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e │ │ │ │ │ +std::is_convertible< Target, detected_t< Op, Args... > > │ │ │ │ │ +is_detected_convertible │ │ │ │ │ +Checks whether Op is convertible to Target without causing an error if │ │ │ │ │ +Op_ _>_:_:_c_o_m_p_a_r_e │ │ │ │ │ -static bool compare(const ParallelLocalIndex< T > &t1, const │ │ │ │ │ -ParallelLocalIndex< T > &t2) │ │ │ │ │ -DDeeffiinniittiioonn plocalindex.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_d_e_t_e_c_t_e_d___o_r___f_a_l_l_b_a_c_k___t │ │ │ │ │ +Std::detected_or_t< decltype(detail::warningIfNotDefined< Std::detected_t< │ │ │ │ │ +Fallback, Args... > >(std::declval< const Std::detected_t< TargetType, Args... │ │ │ │ │ +> * >())), TargetType, Args... > detected_or_fallback_t │ │ │ │ │ +This type will be either TargetType if it exists, or the │ │ │ │ │ +Fallback │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpipack.hh File Reference │ │ │ │ +dune-common: functional.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,51 +65,43 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces
    │ │ │ │ -
    mpipack.hh File Reference
    │ │ │ │ +
    functional.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    See MPI_Pack. │ │ │ │ -More...

    │ │ │ │ -
    #include <vector>
    │ │ │ │ -#include <mpi.h>
    │ │ │ │ -#include <dune/common/parallel/mpicommunication.hh>
    │ │ │ │ -#include <dune/common/parallel/mpidata.hh>
    │ │ │ │ +
    #include <functional>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::MPIPack
     
    struct  Dune::MPIData< P, std::enable_if_t< std::is_same< std::remove_const_t< P >, MPIPack >::value > >
    struct  Dune::Std::identity
     A function object type whose operator() returns its argument unchanged. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Std
     Namespace for features backported from new C++ standards.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    See MPI_Pack.

    │ │ │ │ -

    This Wrapper class takes care of the memory management and provides methods to pack and unpack objects. All objects that can be used for MPI communication can also be packed and unpacked to/from MPIPack.

    │ │ │ │ -
    Author
    Nils-Arne Dreier
    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,25 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ + * _s_t_d │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -mpipack.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -See MPI_Pack. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ +functional.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_:_:_M_P_I_P_a_c_k │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_< │ │ │ │ │ - _P_ _>_,_ _M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_i_d_e_n_t_i_t_y │ │ │ │ │ +  A function object type whose operator() returns its argument │ │ │ │ │ + unchanged. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -See MPI_Pack. │ │ │ │ │ -This Wrapper class takes care of the memory management and provides methods to │ │ │ │ │ -pack and unpack objects. All objects that can be used for MPI communication can │ │ │ │ │ -also be packed and unpacked to/from MPIPack. │ │ │ │ │ - Author │ │ │ │ │ - Nils-Arne Dreier │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00227_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpipack.hh Source File │ │ │ │ +dune-common: functional.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,283 +70,54 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    mpipack.hh
    │ │ │ │ +
    functional.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ +Go to the documentation of this file.
    1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ +
    2// vi: set ts=8 sw=2 et sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    20#ifndef DUNE_COMMON_PARALLEL_MPIPACK_HH
    │ │ │ │ -
    21#define DUNE_COMMON_PARALLEL_MPIPACK_HH
    │ │ │ │ -
    22
    │ │ │ │ -
    23#include <vector>
    │ │ │ │ -
    24#if HAVE_MPI
    │ │ │ │ -
    25#include <mpi.h>
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    28
    │ │ │ │ -
    29
    │ │ │ │ -
    30namespace Dune {
    │ │ │ │ -
    31
    │ │ │ │ -
    │ │ │ │ -
    32 class MPIPack {
    │ │ │ │ -
    33 std::vector<char> _buffer;
    │ │ │ │ -
    34 int _position;
    │ │ │ │ -
    35 MPI_Comm _comm;
    │ │ │ │ -
    36
    │ │ │ │ -
    37 friend struct MPIData<MPIPack>;
    │ │ │ │ -
    38 friend struct MPIData<const MPIPack>;
    │ │ │ │ -
    39 public:
    │ │ │ │ -
    │ │ │ │ -
    40 MPIPack(Communication<MPI_Comm> comm, std::size_t size = 0)
    │ │ │ │ -
    41 : _buffer(size)
    │ │ │ │ -
    42 , _position(0)
    │ │ │ │ -
    43 , _comm(comm)
    │ │ │ │ -
    44 {}
    │ │ │ │ -
    │ │ │ │ -
    45
    │ │ │ │ -
    46 // Its not valid to copy a MPIPack but you can move it
    │ │ │ │ -
    47 MPIPack(const MPIPack&) = delete;
    │ │ │ │ -
    48 MPIPack& operator = (const MPIPack& other) = delete;
    │ │ │ │ -
    49 MPIPack(MPIPack&&) = default;
    │ │ │ │ -
    50 MPIPack& operator = (MPIPack&& other) = default;
    │ │ │ │ -
    51
    │ │ │ │ -
    57 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    58 void pack(const T& data){
    │ │ │ │ -
    59 auto mpidata = getMPIData(data);
    │ │ │ │ -
    60 int size = getPackSize(mpidata.size(), _comm, mpidata.type());
    │ │ │ │ -
    61 constexpr bool has_static_size = decltype(getMPIData(std::declval<T&>()))::static_size;
    │ │ │ │ -
    62 if(!has_static_size)
    │ │ │ │ -
    63 size += getPackSize(1, _comm, MPI_INT);
    │ │ │ │ -
    64 if (_position + size > 0 && size_t(_position + size) > _buffer.size()) // resize buffer if necessary
    │ │ │ │ -
    65 _buffer.resize(_position + size);
    │ │ │ │ -
    66 if(!has_static_size){
    │ │ │ │ -
    67 int size = mpidata.size();
    │ │ │ │ -
    68 MPI_Pack(&size, 1, MPI_INT, _buffer.data(), _buffer.size(),
    │ │ │ │ -
    69 &_position, _comm);
    │ │ │ │ -
    70 }
    │ │ │ │ -
    71 MPI_Pack(mpidata.ptr(), mpidata.size(),
    │ │ │ │ -
    72 mpidata.type(), _buffer.data(), _buffer.size(),
    │ │ │ │ -
    73 &_position, _comm);
    │ │ │ │ -
    74 }
    │ │ │ │ -
    │ │ │ │ -
    75
    │ │ │ │ -
    80 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    81 auto /*void*/ unpack(T& data)
    │ │ │ │ -
    82 -> std::enable_if_t<decltype(getMPIData(data))::static_size, void>
    │ │ │ │ -
    83 {
    │ │ │ │ -
    84 auto mpidata = getMPIData(data);
    │ │ │ │ -
    85 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
    │ │ │ │ -
    86 mpidata.ptr(), mpidata.size(),
    │ │ │ │ -
    87 mpidata.type(), _comm);
    │ │ │ │ -
    88 }
    │ │ │ │ -
    │ │ │ │ -
    89
    │ │ │ │ -
    94 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    95 auto /*void*/ unpack(T& data)
    │ │ │ │ -
    96 -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void>
    │ │ │ │ -
    97 {
    │ │ │ │ -
    98 auto mpidata = getMPIData(data);
    │ │ │ │ -
    99 int size = 0;
    │ │ │ │ -
    100 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
    │ │ │ │ -
    101 &size, 1,
    │ │ │ │ -
    102 MPI_INT, _comm);
    │ │ │ │ -
    103 mpidata.resize(size);
    │ │ │ │ -
    104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
    │ │ │ │ -
    105 mpidata.ptr(), mpidata.size(),
    │ │ │ │ -
    106 mpidata.type(), _comm);
    │ │ │ │ -
    107 }
    │ │ │ │ -
    │ │ │ │ -
    108
    │ │ │ │ -
    109
    │ │ │ │ -
    111 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    112 friend MPIPack& operator << (MPIPack& p, const T& t){
    │ │ │ │ -
    113 p.pack(t);
    │ │ │ │ -
    114 return p;
    │ │ │ │ -
    115 }
    │ │ │ │ -
    │ │ │ │ -
    116
    │ │ │ │ -
    118 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    119 friend MPIPack& operator >> (MPIPack& p, T& t){
    │ │ │ │ -
    120 p.unpack(t);
    │ │ │ │ -
    121 return p;
    │ │ │ │ -
    122 }
    │ │ │ │ -
    │ │ │ │ -
    123
    │ │ │ │ -
    125 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    126 MPIPack& read(T& t){
    │ │ │ │ -
    127 unpack(t);
    │ │ │ │ -
    128 return *this;
    │ │ │ │ -
    129 }
    │ │ │ │ -
    │ │ │ │ -
    130
    │ │ │ │ -
    132 template<typename T>
    │ │ │ │ -
    │ │ │ │ -
    133 MPIPack& write(const T& t){
    │ │ │ │ -
    134 pack(t);
    │ │ │ │ -
    135 return *this;
    │ │ │ │ -
    136 }
    │ │ │ │ -
    │ │ │ │ -
    137
    │ │ │ │ -
    │ │ │ │ -
    141 void resize(size_t size){
    │ │ │ │ -
    142 _buffer.resize(size);
    │ │ │ │ -
    143 }
    │ │ │ │ -
    │ │ │ │ -
    144
    │ │ │ │ -
    │ │ │ │ -
    147 void enlarge(int s) {
    │ │ │ │ -
    148 _buffer.resize(_buffer.size() + s);
    │ │ │ │ -
    149 }
    │ │ │ │ -
    │ │ │ │ -
    150
    │ │ │ │ -
    │ │ │ │ -
    153 size_t size() const {
    │ │ │ │ -
    154 return _buffer.size();
    │ │ │ │ -
    155 }
    │ │ │ │ -
    │ │ │ │ -
    156
    │ │ │ │ -
    │ │ │ │ -
    160 void seek(int p){
    │ │ │ │ -
    161 _position = p;
    │ │ │ │ -
    162 }
    │ │ │ │ -
    │ │ │ │ -
    163
    │ │ │ │ -
    │ │ │ │ -
    167 int tell() const{
    │ │ │ │ -
    168 return _position;
    │ │ │ │ -
    169 }
    │ │ │ │ +
    5#ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
    │ │ │ │ +
    6#define DUNE_COMMON_STD_FUNCTIONAL_HH
    │ │ │ │ +
    7
    │ │ │ │ +
    8#include <functional>
    │ │ │ │ +
    9
    │ │ │ │ +
    10namespace Dune
    │ │ │ │ +
    11{
    │ │ │ │ +
    12
    │ │ │ │ +
    13 namespace Std
    │ │ │ │ +
    14 {
    │ │ │ │ +
    15
    │ │ │ │ +
    22#if DUNE_HAVE_CXX_STD_IDENTITY
    │ │ │ │ +
    23 using std::identity;
    │ │ │ │ +
    24#else //DUNE_HAVE_CXX_STD_IDENTITY
    │ │ │ │ +
    │ │ │ │ +
    25 struct identity {
    │ │ │ │ +
    26 template<class T>
    │ │ │ │ +
    27 constexpr T&& operator()(T&& t ) const noexcept {return std::forward<T>(t);}
    │ │ │ │ +
    28 };
    │ │ │ │
    │ │ │ │ -
    170
    │ │ │ │ -
    │ │ │ │ -
    173 bool eof() const{
    │ │ │ │ -
    174 return std::size_t(_position)==_buffer.size();
    │ │ │ │ -
    175 }
    │ │ │ │ -
    │ │ │ │ -
    176
    │ │ │ │ -
    │ │ │ │ -
    180 static int getPackSize(int len, const MPI_Comm& comm, const MPI_Datatype& dt){
    │ │ │ │ -
    181 int size;
    │ │ │ │ -
    182 MPI_Pack_size(len, dt, comm, &size);
    │ │ │ │ -
    183 return size;
    │ │ │ │ -
    184 }
    │ │ │ │ -
    │ │ │ │ -
    185
    │ │ │ │ -
    │ │ │ │ -
    186 friend bool operator==(const MPIPack& a, const MPIPack& b) {
    │ │ │ │ -
    187 return a._buffer == b._buffer && a._comm == b._comm;
    │ │ │ │ -
    188 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    189 friend bool operator!=(const MPIPack& a, const MPIPack& b) {
    │ │ │ │ -
    190 return !(a==b);
    │ │ │ │ -
    191 }
    │ │ │ │ -
    │ │ │ │ -
    192
    │ │ │ │ -
    193 };
    │ │ │ │ -
    │ │ │ │ -
    194
    │ │ │ │ -
    195 template<class P>
    │ │ │ │ -
    │ │ │ │ -
    196 struct MPIData<P, std::enable_if_t<std::is_same<std::remove_const_t<P>, MPIPack>::value>> {
    │ │ │ │ -
    197 protected:
    │ │ │ │ -
    198 friend auto getMPIData<P>(P& t);
    │ │ │ │ -
    │ │ │ │ -
    199 MPIData(P& t) :
    │ │ │ │ -
    200 data_(t)
    │ │ │ │ -
    201 {}
    │ │ │ │ -
    │ │ │ │ -
    202 public:
    │ │ │ │ -
    203 static constexpr bool static_size = std::is_const<P>::value;
    │ │ │ │ -
    204
    │ │ │ │ -
    │ │ │ │ -
    205 void* ptr() {
    │ │ │ │ -
    206 return (void*) data_._buffer.data();
    │ │ │ │ -
    207 }
    │ │ │ │ -
    │ │ │ │ -
    208
    │ │ │ │ -
    │ │ │ │ -
    209 int size() {
    │ │ │ │ -
    210 return data_.size();
    │ │ │ │ -
    211 }
    │ │ │ │ -
    │ │ │ │ -
    212
    │ │ │ │ -
    │ │ │ │ -
    213 MPI_Datatype type() const{
    │ │ │ │ -
    214 return MPI_PACKED;
    │ │ │ │ -
    215 }
    │ │ │ │ -
    │ │ │ │ -
    216
    │ │ │ │ -
    │ │ │ │ -
    217 void resize(int size){
    │ │ │ │ -
    218 data_.resize(size);
    │ │ │ │ -
    219 }
    │ │ │ │ -
    │ │ │ │ -
    220 protected:
    │ │ │ │ - │ │ │ │ -
    222 };
    │ │ │ │ -
    │ │ │ │ -
    223
    │ │ │ │ -
    224} // end namespace Dune
    │ │ │ │ -
    225
    │ │ │ │ -
    226#endif
    │ │ │ │ -
    227#endif
    │ │ │ │ -
    Implements an utility class that provides MPI's collective communication methods.
    │ │ │ │ -
    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
    │ │ │ │ -
    STL namespace.
    │ │ │ │ +
    29#endif
    │ │ │ │ +
    30 } // namespace Std
    │ │ │ │ +
    31
    │ │ │ │ +
    32} // namespace Dune
    │ │ │ │ +
    33
    │ │ │ │ +
    34#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    auto getMPIData(T &t)
    Definition mpidata.hh:43
    │ │ │ │ -
    Collective communication interface and sequential default implementation.
    Definition communication.hh:100
    │ │ │ │ -
    Definition mpidata.hh:50
    │ │ │ │ -
    T & data_
    Definition mpidata.hh:53
    │ │ │ │ -
    int size() const
    Definition mpidata.hh:67
    │ │ │ │ -
    static constexpr bool static_size
    Definition mpidata.hh:65
    │ │ │ │ -
    Definition mpipack.hh:32
    │ │ │ │ -
    void enlarge(int s)
    Enlarges the internal buffer.
    Definition mpipack.hh:147
    │ │ │ │ -
    friend MPIPack & operator>>(MPIPack &p, T &t)
    Unpacks data from the object.
    Definition mpipack.hh:119
    │ │ │ │ -
    friend MPIPack & operator<<(MPIPack &p, const T &t)
    Packs the data into the object. Enlarges the internal buffer if necessary.
    Definition mpipack.hh:112
    │ │ │ │ -
    friend bool operator!=(const MPIPack &a, const MPIPack &b)
    Definition mpipack.hh:189
    │ │ │ │ -
    size_t size() const
    Returns the size of the internal buffer.
    Definition mpipack.hh:153
    │ │ │ │ -
    MPIPack & operator=(const MPIPack &other)=delete
    │ │ │ │ -
    MPIPack(Communication< MPI_Comm > comm, std::size_t size=0)
    Definition mpipack.hh:40
    │ │ │ │ -
    void pack(const T &data)
    Packs the data into the object. Enlarges the internal buffer if necessary.
    Definition mpipack.hh:58
    │ │ │ │ -
    auto unpack(T &data) -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void >
    Unpacks data from the object.
    Definition mpipack.hh:95
    │ │ │ │ -
    auto unpack(T &data) -> std::enable_if_t< decltype(getMPIData(data))::static_size, void >
    Unpacks data from the object.
    Definition mpipack.hh:81
    │ │ │ │ -
    friend bool operator==(const MPIPack &a, const MPIPack &b)
    Definition mpipack.hh:186
    │ │ │ │ -
    MPIPack(const MPIPack &)=delete
    │ │ │ │ -
    void seek(int p)
    Sets the position in the buffer where the next pack/unpack operation should take place.
    Definition mpipack.hh:160
    │ │ │ │ -
    bool eof() const
    Checks whether the end of the buffer is reached.
    Definition mpipack.hh:173
    │ │ │ │ -
    void resize(size_t size)
    Resizes the internal buffer.
    Definition mpipack.hh:141
    │ │ │ │ -
    int tell() const
    Gets the position in the buffer where the next pack/unpack operation should take place.
    Definition mpipack.hh:167
    │ │ │ │ -
    MPIPack(MPIPack &&)=default
    │ │ │ │ -
    MPIPack & read(T &t)
    Unpacks data from the object.
    Definition mpipack.hh:126
    │ │ │ │ -
    static int getPackSize(int len, const MPI_Comm &comm, const MPI_Datatype &dt)
    Returns the size of the data needed to store the data in an MPIPack. See MPI_Pack_size.
    Definition mpipack.hh:180
    │ │ │ │ -
    MPIPack & write(const T &t)
    Packs the data into the object. Enlarges the internal buffer if necessary.
    Definition mpipack.hh:133
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
    A function object type whose operator() returns its argument unchanged.
    Definition functional.hh:25
    │ │ │ │ +
    constexpr T && operator()(T &&t) const noexcept
    Definition functional.hh:27
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,323 +1,49 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpipack.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +functional.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set ts=8 sw=2 et sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -20#ifndef DUNE_COMMON_PARALLEL_MPIPACK_HH │ │ │ │ │ -21#define DUNE_COMMON_PARALLEL_MPIPACK_HH │ │ │ │ │ -22 │ │ │ │ │ -23#include │ │ │ │ │ -24#if HAVE_MPI │ │ │ │ │ -25#include │ │ │ │ │ -26#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -27#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_d_a_t_a_._h_h> │ │ │ │ │ -28 │ │ │ │ │ -29 │ │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e │ │ │ │ │ +11{ │ │ │ │ │ +12 │ │ │ │ │ +13 namespace Std │ │ │ │ │ +14 { │ │ │ │ │ +15 │ │ │ │ │ +22#if DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ +23 using std::identity; │ │ │ │ │ +24#else //DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ +_2_5 struct _i_d_e_n_t_i_t_y { │ │ │ │ │ +26 template │ │ │ │ │ +_2_7 constexpr T&& _o_p_e_r_a_t_o_r_(_)(T&& t ) const noexcept {return std::forward(t);} │ │ │ │ │ +28 }; │ │ │ │ │ +29#endif │ │ │ │ │ +30 } // namespace Std │ │ │ │ │ 31 │ │ │ │ │ -_3_2 class _M_P_I_P_a_c_k { │ │ │ │ │ -33 std::vector _buffer; │ │ │ │ │ -34 int _position; │ │ │ │ │ -_3_5 MPI_Comm _comm; │ │ │ │ │ -36 │ │ │ │ │ -37 friend struct _M_P_I_D_a_t_a<_M_P_I_P_a_c_k>; │ │ │ │ │ -38 friend struct _M_P_I_D_a_t_a; │ │ │ │ │ -39 public: │ │ │ │ │ -_4_0 _M_P_I_P_a_c_k(_C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I___C_o_m_m_> comm, std::size_t _s_i_z_e = 0) │ │ │ │ │ -41 : _buffer(_s_i_z_e) │ │ │ │ │ -42 , _position(0) │ │ │ │ │ -43 , _comm(comm) │ │ │ │ │ -44 {} │ │ │ │ │ -45 │ │ │ │ │ -46 // Its not valid to copy a MPIPack but you can move it │ │ │ │ │ -_4_7 _M_P_I_P_a_c_k(const _M_P_I_P_a_c_k&) = delete; │ │ │ │ │ -_4_8 _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _=_ (const _M_P_I_P_a_c_k& other) = delete; │ │ │ │ │ -_4_9 _M_P_I_P_a_c_k(_M_P_I_P_a_c_k&&) = default; │ │ │ │ │ -_5_0 _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _=_ (_M_P_I_P_a_c_k&& other) = default; │ │ │ │ │ -51 │ │ │ │ │ -57 template │ │ │ │ │ -_5_8 void _p_a_c_k(const T& data){ │ │ │ │ │ -59 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -60 int _s_i_z_e = _g_e_t_P_a_c_k_S_i_z_e(mpidata.size(), _comm, mpidata.type()); │ │ │ │ │ -61 constexpr bool has_static_size = decltype(_g_e_t_M_P_I_D_a_t_a(std::declval())):: │ │ │ │ │ -static_size; │ │ │ │ │ -62 if(!has_static_size) │ │ │ │ │ -63 _s_i_z_e += _g_e_t_P_a_c_k_S_i_z_e(1, _comm, MPI_INT); │ │ │ │ │ -64 if (_position + _s_i_z_e > 0 && size_t(_position + _s_i_z_e) > _buffer.size()) / │ │ │ │ │ -/ resize buffer if necessary │ │ │ │ │ -65 _buffer.resize(_position + _s_i_z_e); │ │ │ │ │ -66 if(!has_static_size){ │ │ │ │ │ -67 int _s_i_z_e = mpidata.size(); │ │ │ │ │ -68 MPI_Pack(&_s_i_z_e, 1, MPI_INT, _buffer.data(), _buffer.size(), │ │ │ │ │ -69 &_position, _comm); │ │ │ │ │ -70 } │ │ │ │ │ -71 MPI_Pack(mpidata.ptr(), mpidata.size(), │ │ │ │ │ -72 mpidata.type(), _buffer.data(), _buffer.size(), │ │ │ │ │ -73 &_position, _comm); │ │ │ │ │ -74 } │ │ │ │ │ -75 │ │ │ │ │ -80 template │ │ │ │ │ -_8_1 auto /*void*/ _u_n_p_a_c_k(T& data) │ │ │ │ │ -82 -> std::enable_if_t │ │ │ │ │ -83 { │ │ │ │ │ -84 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -85 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ -86 mpidata.ptr(), mpidata.size(), │ │ │ │ │ -87 mpidata.type(), _comm); │ │ │ │ │ -88 } │ │ │ │ │ -89 │ │ │ │ │ -94 template │ │ │ │ │ -_9_5 auto /*void*/ _u_n_p_a_c_k(T& data) │ │ │ │ │ -96 -> std::enable_if_t │ │ │ │ │ -97 { │ │ │ │ │ -98 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -99 int _s_i_z_e = 0; │ │ │ │ │ -100 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ -101 &_s_i_z_e, 1, │ │ │ │ │ -102 MPI_INT, _comm); │ │ │ │ │ -103 mpidata.resize(_s_i_z_e); │ │ │ │ │ -104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ -105 mpidata.ptr(), mpidata.size(), │ │ │ │ │ -106 mpidata.type(), _comm); │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -109 │ │ │ │ │ -111 template │ │ │ │ │ -_1_1_2 friend _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _<_<_ (_M_P_I_P_a_c_k& p, const T& t){ │ │ │ │ │ -113 p._p_a_c_k(t); │ │ │ │ │ -114 return p; │ │ │ │ │ -115 } │ │ │ │ │ -116 │ │ │ │ │ -118 template │ │ │ │ │ -_1_1_9 friend _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _>_>_ (_M_P_I_P_a_c_k& p, T& t){ │ │ │ │ │ -120 p._u_n_p_a_c_k(t); │ │ │ │ │ -121 return p; │ │ │ │ │ -122 } │ │ │ │ │ -123 │ │ │ │ │ -125 template │ │ │ │ │ -_1_2_6 _M_P_I_P_a_c_k& _r_e_a_d(T& t){ │ │ │ │ │ -127 _u_n_p_a_c_k(t); │ │ │ │ │ -128 return *this; │ │ │ │ │ -129 } │ │ │ │ │ -130 │ │ │ │ │ -132 template │ │ │ │ │ -_1_3_3 _M_P_I_P_a_c_k& _w_r_i_t_e(const T& t){ │ │ │ │ │ -134 _p_a_c_k(t); │ │ │ │ │ -135 return *this; │ │ │ │ │ -136 } │ │ │ │ │ -137 │ │ │ │ │ -_1_4_1 void _r_e_s_i_z_e(size_t _s_i_z_e){ │ │ │ │ │ -142 _buffer.resize(_s_i_z_e); │ │ │ │ │ -143 } │ │ │ │ │ -144 │ │ │ │ │ -_1_4_7 void _e_n_l_a_r_g_e(int s) { │ │ │ │ │ -148 _buffer.resize(_buffer.size() + s); │ │ │ │ │ -149 } │ │ │ │ │ -150 │ │ │ │ │ -_1_5_3 size_t _s_i_z_e() const { │ │ │ │ │ -154 return _buffer.size(); │ │ │ │ │ -155 } │ │ │ │ │ -156 │ │ │ │ │ -_1_6_0 void _s_e_e_k(int p){ │ │ │ │ │ -161 _position = p; │ │ │ │ │ -162 } │ │ │ │ │ -163 │ │ │ │ │ -_1_6_7 int _t_e_l_l() const{ │ │ │ │ │ -168 return _position; │ │ │ │ │ -169 } │ │ │ │ │ -170 │ │ │ │ │ -_1_7_3 bool _e_o_f() const{ │ │ │ │ │ -174 return std::size_t(_position)==_buffer.size(); │ │ │ │ │ -175 } │ │ │ │ │ -176 │ │ │ │ │ -_1_8_0 static int _g_e_t_P_a_c_k_S_i_z_e(int len, const MPI_Comm& comm, const MPI_Datatype& │ │ │ │ │ -dt){ │ │ │ │ │ -181 int _s_i_z_e; │ │ │ │ │ -182 MPI_Pack_size(len, dt, comm, &_s_i_z_e); │ │ │ │ │ -183 return _s_i_z_e; │ │ │ │ │ -184 } │ │ │ │ │ -185 │ │ │ │ │ -_1_8_6 friend bool _o_p_e_r_a_t_o_r_=_=(const _M_P_I_P_a_c_k& a, const _M_P_I_P_a_c_k& b) { │ │ │ │ │ -187 return a._buffer == b._buffer && a._comm == b._comm; │ │ │ │ │ -188 } │ │ │ │ │ -_1_8_9 friend bool _o_p_e_r_a_t_o_r_!_=(const _M_P_I_P_a_c_k& a, const _M_P_I_P_a_c_k& b) { │ │ │ │ │ -190 return !(a==b); │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -193 }; │ │ │ │ │ -194 │ │ │ │ │ -195 template │ │ │ │ │ -_1_9_6 struct _M_P_I_D_a_t_a, │ │ │ │ │ -MPIPack>::value>> { │ │ │ │ │ -197 protected: │ │ │ │ │ -_1_9_8 friend auto getMPIData

    (P& t); │ │ │ │ │ -_1_9_9 _M_P_I_D_a_t_a(P& t) : │ │ │ │ │ -200 _d_a_t_a__(t) │ │ │ │ │ -201 {} │ │ │ │ │ -202 public: │ │ │ │ │ -_2_0_3 static constexpr bool _s_t_a_t_i_c___s_i_z_e = std::is_const

    ::value; │ │ │ │ │ -204 │ │ │ │ │ -_2_0_5 void* _p_t_r() { │ │ │ │ │ -206 return (void*) _d_a_t_a__._buffer.data(); │ │ │ │ │ -207 } │ │ │ │ │ -208 │ │ │ │ │ -_2_0_9 int _s_i_z_e() { │ │ │ │ │ -210 return _d_a_t_a__.size(); │ │ │ │ │ -211 } │ │ │ │ │ -212 │ │ │ │ │ -_2_1_3 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ -214 return MPI_PACKED; │ │ │ │ │ -215 } │ │ │ │ │ -216 │ │ │ │ │ -_2_1_7 void _r_e_s_i_z_e(int _s_i_z_e){ │ │ │ │ │ -218 _d_a_t_a__.resize(_s_i_z_e); │ │ │ │ │ -219 } │ │ │ │ │ -220 protected: │ │ │ │ │ -_2_2_1 P& _d_a_t_a__; │ │ │ │ │ -222 }; │ │ │ │ │ -223 │ │ │ │ │ -224} // end namespace Dune │ │ │ │ │ -225 │ │ │ │ │ -226#endif │ │ │ │ │ -227#endif │ │ │ │ │ -_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ -Implements an utility class that provides MPI's collective communication │ │ │ │ │ -methods. │ │ │ │ │ -_m_p_i_d_a_t_a_._h_h │ │ │ │ │ -Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ -MPI calls. │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +32} // namespace Dune │ │ │ │ │ +33 │ │ │ │ │ +34#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ -auto getMPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Collective communication interface and sequential default implementation. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_d_a_t_a__ │ │ │ │ │ -T & data_ │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_t_a_t_i_c___s_i_z_e │ │ │ │ │ -static constexpr bool static_size │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_e_n_l_a_r_g_e │ │ │ │ │ -void enlarge(int s) │ │ │ │ │ -Enlarges the internal buffer. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ │ -friend MPIPack & operator>>(MPIPack &p, T &t) │ │ │ │ │ -Unpacks data from the object. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:119 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -friend MPIPack & operator<<(MPIPack &p, const T &t) │ │ │ │ │ -Packs the data into the object. Enlarges the internal buffer if necessary. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -friend bool operator!=(const MPIPack &a, const MPIPack &b) │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:189 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_s_i_z_e │ │ │ │ │ -size_t size() const │ │ │ │ │ -Returns the size of the internal buffer. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -MPIPack & operator=(const MPIPack &other)=delete │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_M_P_I_P_a_c_k │ │ │ │ │ -MPIPack(Communication< MPI_Comm > comm, std::size_t size=0) │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_p_a_c_k │ │ │ │ │ -void pack(const T &data) │ │ │ │ │ -Packs the data into the object. Enlarges the internal buffer if necessary. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_u_n_p_a_c_k │ │ │ │ │ -auto unpack(T &data) -> std::enable_if_t │ │ │ │ │ -Unpacks data from the object. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_u_n_p_a_c_k │ │ │ │ │ -auto unpack(T &data) -> std::enable_if_t< decltype(getMPIData(data)):: │ │ │ │ │ -static_size, void > │ │ │ │ │ -Unpacks data from the object. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -friend bool operator==(const MPIPack &a, const MPIPack &b) │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:186 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_M_P_I_P_a_c_k │ │ │ │ │ -MPIPack(const MPIPack &)=delete │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_s_e_e_k │ │ │ │ │ -void seek(int p) │ │ │ │ │ -Sets the position in the buffer where the next pack/unpack operation should │ │ │ │ │ -take place. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:160 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_e_o_f │ │ │ │ │ -bool eof() const │ │ │ │ │ -Checks whether the end of the buffer is reached. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:173 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_r_e_s_i_z_e │ │ │ │ │ -void resize(size_t size) │ │ │ │ │ -Resizes the internal buffer. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_t_e_l_l │ │ │ │ │ -int tell() const │ │ │ │ │ -Gets the position in the buffer where the next pack/unpack operation should │ │ │ │ │ -take place. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:167 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_M_P_I_P_a_c_k │ │ │ │ │ -MPIPack(MPIPack &&)=default │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_r_e_a_d │ │ │ │ │ -MPIPack & read(T &t) │ │ │ │ │ -Unpacks data from the object. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_g_e_t_P_a_c_k_S_i_z_e │ │ │ │ │ -static int getPackSize(int len, const MPI_Comm &comm, const MPI_Datatype &dt) │ │ │ │ │ -Returns the size of the data needed to store the data in an MPIPack. See │ │ │ │ │ -MPI_Pack_size. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k_:_:_w_r_i_t_e │ │ │ │ │ -MPIPack & write(const T &t) │ │ │ │ │ -Packs the data into the object. Enlarges the internal buffer if necessary. │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:133 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ -_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -MPI_Datatype type() const │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:213 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ -_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_M_P_I_D_a_t_a │ │ │ │ │ -MPIData(P &t) │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:199 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ -_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_s_i_z_e │ │ │ │ │ -int size() │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:209 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ -_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_p_t_r │ │ │ │ │ -void * ptr() │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:205 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ -_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_d_a_t_a__ │ │ │ │ │ -P & data_ │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:221 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _P_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_<_ _s_t_d_:_:_r_e_m_o_v_e___c_o_n_s_t___t_<_ _P_ _>_, │ │ │ │ │ -_M_P_I_P_a_c_k_ _>_:_:_v_a_l_u_e_ _>_ _>_:_:_r_e_s_i_z_e │ │ │ │ │ -void resize(int size) │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:217 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_d_e_n_t_i_t_y │ │ │ │ │ +A function object type whose operator() returns its argument unchanged. │ │ │ │ │ +DDeeffiinniittiioonn functional.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_d_e_n_t_i_t_y_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +constexpr T && operator()(T &&t) const noexcept │ │ │ │ │ +DDeeffiinniittiioonn functional.hh:27 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00230.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpidata.hh File Reference │ │ │ │ +dune-common: apply.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,61 +65,36 @@ │ │ │ │

    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
    │ │ │ │ -
    mpidata.hh File Reference
    │ │ │ │ +Namespaces
    │ │ │ │ +
    apply.hh File Reference
    │ │ │ │ │ │ │ │
    │ │ │ │ - │ │ │ │ -

    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls. │ │ │ │ -More...

    │ │ │ │ -
    #include <vector>
    │ │ │ │ -#include <string>
    │ │ │ │ -#include <dune/common/typetraits.hh>
    │ │ │ │ -#include <dune/common/std/type_traits.hh>
    │ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
    │ │ │ │ +
    #include <tuple>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    struct  Dune::MPIData< T, Enable >
     
    struct  Dune::MPIData< void >
     
    struct  Dune::MPIData< T, std::void_t< std::tuple< decltype(std::declval< T >().data()), decltype(std::declval< T >().size()), typename std::decay_t< T >::value_type > > >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

    │ │ │ │ Namespaces

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

    │ │ │ │ -Functions

    template<class T >
    auto Dune::getMPIData (T &t)
     
    namespace  Dune::Std
     Namespace for features backported from new C++ standards.
     
    │ │ │ │ -

    Detailed Description

    │ │ │ │ -

    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.

    │ │ │ │ -

    Furthermore it can be used to resize the object if possible. This makes it possible to receive a message with variable size. See Communication::rrecv.

    │ │ │ │ -

    To 'register' a new dynamic type for MPI communication specialize MPIData or overload getMPIData.

    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,44 +1,20 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_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 │ │ │ │ │ -mpidata.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ -MPI calls. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +apply.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_:_:_M_P_I_D_a_t_a_<_ _T_,_ _E_n_a_b_l_e_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _> │ │ │ │ │ - _(_)_._d_a_t_a_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_: │ │ │ │ │ - _d_e_c_a_y___t_<_ _T_ _>_:_:_v_a_l_u_e___t_y_p_e_ _>_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -auto  _D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a (T &t) │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Interface class to translate objects to a MPI_Datatype, void* and size used for │ │ │ │ │ -MPI calls. │ │ │ │ │ -Furthermore it can be used to resize the object if possible. This makes it │ │ │ │ │ -possible to receive a message with variable size. See Communication::rrecv. │ │ │ │ │ -To 'register' a new dynamic type for MPI communication specialize MPIData or │ │ │ │ │ -overload getMPIData. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00230_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpidata.hh Source File │ │ │ │ +dune-common: apply.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,196 +70,44 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    mpidata.hh
    │ │ │ │ +
    apply.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5
    │ │ │ │ -
    6#ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH
    │ │ │ │ -
    7#define DUNE_COMMON_PARALLEL_MPIDATA_HH
    │ │ │ │ -
    8
    │ │ │ │ -
    9#include <vector>
    │ │ │ │ -
    10#include <string>
    │ │ │ │ -
    11
    │ │ │ │ -
    12#if HAVE_MPI
    │ │ │ │ -
    13
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    17
    │ │ │ │ -
    37namespace Dune{
    │ │ │ │ -
    38
    │ │ │ │ -
    39 template<class, class = void>
    │ │ │ │ -
    40 struct MPIData;
    │ │ │ │ -
    41
    │ │ │ │ -
    42 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    43 auto getMPIData(T& t){
    │ │ │ │ -
    44 return MPIData<T>(t);
    │ │ │ │ -
    45 }
    │ │ │ │ -
    │ │ │ │ -
    46
    │ │ │ │ -
    47 // Default implementation for static datatypes
    │ │ │ │ -
    48 template<class T, class Enable>
    │ │ │ │ -
    │ │ │ │ -
    49 struct MPIData
    │ │ │ │ -
    50 {
    │ │ │ │ -
    51 friend auto getMPIData<T>(T&);
    │ │ │ │ -
    52 protected:
    │ │ │ │ - │ │ │ │ -
    54
    │ │ │ │ -
    │ │ │ │ -
    55 MPIData(T& t)
    │ │ │ │ -
    56 : data_(t)
    │ │ │ │ -
    57 {}
    │ │ │ │ -
    │ │ │ │ -
    58
    │ │ │ │ -
    59 public:
    │ │ │ │ -
    │ │ │ │ -
    60 void* ptr() const {
    │ │ │ │ -
    61 return (void*)&data_;
    │ │ │ │ -
    62 }
    │ │ │ │ -
    │ │ │ │ -
    63
    │ │ │ │ -
    64 // indicates whether the datatype can be resized
    │ │ │ │ -
    65 static constexpr bool static_size = true;
    │ │ │ │ -
    66
    │ │ │ │ -
    │ │ │ │ -
    67 int size() const{
    │ │ │ │ -
    68 return 1;
    │ │ │ │ -
    69 }
    │ │ │ │ -
    │ │ │ │ -
    70
    │ │ │ │ -
    │ │ │ │ -
    71 MPI_Datatype type() const {
    │ │ │ │ -
    72 return MPITraits<std::decay_t<T>>::getType();
    │ │ │ │ -
    73 }
    │ │ │ │ -
    │ │ │ │ -
    74 };
    │ │ │ │ -
    │ │ │ │ -
    75
    │ │ │ │ -
    76 // dummy implementation for void
    │ │ │ │ -
    77 template<>
    │ │ │ │ -
    │ │ │ │ -
    78 struct MPIData<void>{
    │ │ │ │ -
    79 protected:
    │ │ │ │ - │ │ │ │ -
    81
    │ │ │ │ -
    82 public:
    │ │ │ │ -
    │ │ │ │ -
    83 void* ptr(){
    │ │ │ │ -
    84 return nullptr;
    │ │ │ │ -
    85 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    86 int size(){
    │ │ │ │ -
    87 return 0;
    │ │ │ │ -
    88 }
    │ │ │ │ -
    │ │ │ │ -
    89 void get(){}
    │ │ │ │ -
    │ │ │ │ -
    90 MPI_Datatype type() const{
    │ │ │ │ -
    91 return MPI_INT;
    │ │ │ │ -
    92 }
    │ │ │ │ -
    │ │ │ │ -
    93 };
    │ │ │ │ -
    │ │ │ │ -
    94
    │ │ │ │ -
    95 // specializations:
    │ │ │ │ -
    96 // std::vector of static sized elements or std::string
    │ │ │ │ -
    97 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    98 struct MPIData<T, std::void_t<std::tuple<decltype(std::declval<T>().data()),
    │ │ │ │ -
    99 decltype(std::declval<T>().size()),
    │ │ │ │ -
    100 typename std::decay_t<T>::value_type>>>{
    │ │ │ │ -
    101 private:
    │ │ │ │ -
    102 template<class U>
    │ │ │ │ -
    103 using hasResizeOp = decltype(std::declval<U>().resize(0));
    │ │ │ │ -
    104
    │ │ │ │ -
    105 protected:
    │ │ │ │ -
    106 friend auto getMPIData<T>(T&);
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    108 : data_(t)
    │ │ │ │ -
    109 {}
    │ │ │ │ -
    │ │ │ │ -
    110 public:
    │ │ │ │ -
    111 static constexpr bool static_size = std::is_const<T>::value || !Std::is_detected_v<hasResizeOp, T>;
    │ │ │ │ -
    │ │ │ │ -
    112 void* ptr() {
    │ │ │ │ -
    113 return (void*) data_.data();
    │ │ │ │ -
    114 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    115 int size() {
    │ │ │ │ -
    116 return data_.size();
    │ │ │ │ -
    117 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    118 MPI_Datatype type() const{
    │ │ │ │ - │ │ │ │ -
    120 }
    │ │ │ │ -
    │ │ │ │ -
    121
    │ │ │ │ -
    122 template<class S = T>
    │ │ │ │ -
    │ │ │ │ -
    123 auto /*void*/ resize(int size)
    │ │ │ │ -
    124 -> std::enable_if_t<!std::is_const<S>::value || !Std::is_detected_v<hasResizeOp, S>>
    │ │ │ │ -
    125 {
    │ │ │ │ -
    126 data_.resize(size);
    │ │ │ │ -
    127 }
    │ │ │ │ -
    │ │ │ │ -
    128
    │ │ │ │ -
    129 protected:
    │ │ │ │ - │ │ │ │ -
    131 };
    │ │ │ │ -
    │ │ │ │ -
    132
    │ │ │ │ -
    133}
    │ │ │ │ -
    134
    │ │ │ │ -
    139#endif
    │ │ │ │ -
    140#endif
    │ │ │ │ - │ │ │ │ -
    Traits for type conversions and type information.
    │ │ │ │ -
    Traits classes for mapping types onto MPI_Datatype.
    │ │ │ │ -
    typename Impl::voider< Types... >::type void_t
    Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
    Definition typetraits.hh:40
    │ │ │ │ -
    STL namespace.
    │ │ │ │ +
    5#ifndef DUNE_COMMON_STD_APPLY_HH
    │ │ │ │ +
    6#define DUNE_COMMON_STD_APPLY_HH
    │ │ │ │ +
    7
    │ │ │ │ +
    8#include <tuple>
    │ │ │ │ +
    9
    │ │ │ │ +
    10namespace Dune
    │ │ │ │ +
    11{
    │ │ │ │ +
    │ │ │ │ +
    12 namespace Std
    │ │ │ │ +
    13 {
    │ │ │ │ +
    14
    │ │ │ │ +
    17 using std::apply;
    │ │ │ │ +
    18
    │ │ │ │ +
    19 } // namespace Std
    │ │ │ │ +
    │ │ │ │ +
    20} // namespace Dune
    │ │ │ │ +
    21
    │ │ │ │ +
    22#endif // #ifndef DUNE_COMMON_STD_APPLY_HH
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    auto getMPIData(T &t)
    Definition mpidata.hh:43
    │ │ │ │ -
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition mpitraits.hh:41
    │ │ │ │ -
    Definition mpidata.hh:50
    │ │ │ │ -
    T & data_
    Definition mpidata.hh:53
    │ │ │ │ -
    MPI_Datatype type() const
    Definition mpidata.hh:71
    │ │ │ │ -
    void * ptr() const
    Definition mpidata.hh:60
    │ │ │ │ -
    int size() const
    Definition mpidata.hh:67
    │ │ │ │ -
    static constexpr bool static_size
    Definition mpidata.hh:65
    │ │ │ │ -
    MPIData(T &t)
    Definition mpidata.hh:55
    │ │ │ │ -
    void get()
    Definition mpidata.hh:89
    │ │ │ │ -
    MPIData()
    Definition mpidata.hh:80
    │ │ │ │ -
    int size()
    Definition mpidata.hh:86
    │ │ │ │ -
    void * ptr()
    Definition mpidata.hh:83
    │ │ │ │ -
    MPI_Datatype type() const
    Definition mpidata.hh:90
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    auto resize(int size) -> std::enable_if_t<!std::is_const< S >::value||!Std::is_detected_v< hasResizeOp, S > >
    Definition mpidata.hh:123
    │ │ │ │ - │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,217 +1,35 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpidata.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +apply.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5 │ │ │ │ │ -6#ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH │ │ │ │ │ -7#define DUNE_COMMON_PARALLEL_MPIDATA_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11 │ │ │ │ │ -12#if HAVE_MPI │ │ │ │ │ -13 │ │ │ │ │ -14#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_t_r_a_i_t_s_._h_h> │ │ │ │ │ -17 │ │ │ │ │ -37namespace _D_u_n_e{ │ │ │ │ │ -38 │ │ │ │ │ -39 template │ │ │ │ │ -40 struct MPIData; │ │ │ │ │ -41 │ │ │ │ │ -42 template │ │ │ │ │ -_4_3 auto _g_e_t_M_P_I_D_a_t_a(T& t){ │ │ │ │ │ -44 return _M_P_I_D_a_t_a_<_T_>(t); │ │ │ │ │ -45 } │ │ │ │ │ -46 │ │ │ │ │ -47 // Default implementation for static datatypes │ │ │ │ │ -48 template │ │ │ │ │ -_4_9 struct _M_P_I_D_a_t_a │ │ │ │ │ -50 { │ │ │ │ │ -51 friend auto getMPIData(T&); │ │ │ │ │ -52 protected: │ │ │ │ │ -_5_3 T& _d_a_t_a__; │ │ │ │ │ -54 │ │ │ │ │ -_5_5 _M_P_I_D_a_t_a(T& t) │ │ │ │ │ -56 : _d_a_t_a__(t) │ │ │ │ │ -57 {} │ │ │ │ │ -58 │ │ │ │ │ -59 public: │ │ │ │ │ -_6_0 void* _p_t_r() const { │ │ │ │ │ -61 return (void*)&_d_a_t_a__; │ │ │ │ │ -62 } │ │ │ │ │ -63 │ │ │ │ │ -64 // indicates whether the datatype can be resized │ │ │ │ │ -_6_5 static constexpr bool _s_t_a_t_i_c___s_i_z_e = true; │ │ │ │ │ -66 │ │ │ │ │ -_6_7 int _s_i_z_e() const{ │ │ │ │ │ -68 return 1; │ │ │ │ │ -69 } │ │ │ │ │ -70 │ │ │ │ │ -_7_1 MPI_Datatype _t_y_p_e() const { │ │ │ │ │ -72 return _M_P_I_T_r_a_i_t_s_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>::getType(); │ │ │ │ │ -73 } │ │ │ │ │ -74 }; │ │ │ │ │ -75 │ │ │ │ │ -76 // dummy implementation for void │ │ │ │ │ -77 template<> │ │ │ │ │ -_7_8 struct _M_P_I_D_a_t_a{ │ │ │ │ │ -79 protected: │ │ │ │ │ -_8_0 _M_P_I_D_a_t_a() {} │ │ │ │ │ -81 │ │ │ │ │ -82 public: │ │ │ │ │ -_8_3 void* _p_t_r(){ │ │ │ │ │ -84 return nullptr; │ │ │ │ │ -85 } │ │ │ │ │ -_8_6 int _s_i_z_e(){ │ │ │ │ │ -87 return 0; │ │ │ │ │ -88 } │ │ │ │ │ -_8_9 void _g_e_t(){} │ │ │ │ │ -_9_0 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ -91 return MPI_INT; │ │ │ │ │ -92 } │ │ │ │ │ -93 }; │ │ │ │ │ -94 │ │ │ │ │ -95 // specializations: │ │ │ │ │ -96 // std::vector of static sized elements or std::string │ │ │ │ │ -97 template │ │ │ │ │ -_9_8 struct _M_P_I_D_a_t_a().data()), │ │ │ │ │ -99 decltype(std::declval().size()), │ │ │ │ │ -100 typename std::decay_t::value_type>>>{ │ │ │ │ │ -101 private: │ │ │ │ │ -102 template │ │ │ │ │ -103 using hasResizeOp = decltype(std::declval().resize(0)); │ │ │ │ │ -104 │ │ │ │ │ -105 protected: │ │ │ │ │ -106 friend auto getMPIData(T&); │ │ │ │ │ -_1_0_7 _M_P_I_D_a_t_a(T& t) │ │ │ │ │ -108 : _d_a_t_a__(t) │ │ │ │ │ -109 {} │ │ │ │ │ -110 public: │ │ │ │ │ -_1_1_1 static constexpr bool _s_t_a_t_i_c___s_i_z_e = std::is_const::value || !Std:: │ │ │ │ │ -is_detected_v; │ │ │ │ │ -_1_1_2 void* _p_t_r() { │ │ │ │ │ -113 return (void*) _d_a_t_a__.data(); │ │ │ │ │ -114 } │ │ │ │ │ -_1_1_5 int _s_i_z_e() { │ │ │ │ │ -116 return _d_a_t_a__.size(); │ │ │ │ │ -117 } │ │ │ │ │ -_1_1_8 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ -119 return _M_P_I_T_r_a_i_t_s_<_t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_T_>_:_:_v_a_l_u_e___t_y_p_e>::getType(); │ │ │ │ │ -120 } │ │ │ │ │ -121 │ │ │ │ │ -122 template │ │ │ │ │ -_1_2_3 auto /*void*/ _r_e_s_i_z_e(int _s_i_z_e) │ │ │ │ │ -124 -> std::enable_if_t::value || !Std:: │ │ │ │ │ -is_detected_v> │ │ │ │ │ -125 { │ │ │ │ │ -126 _d_a_t_a__.resize(_s_i_z_e); │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -129 protected: │ │ │ │ │ -_1_3_0 T& _d_a_t_a__; │ │ │ │ │ -131 }; │ │ │ │ │ -132 │ │ │ │ │ -133} │ │ │ │ │ -134 │ │ │ │ │ -139#endif │ │ │ │ │ -140#endif │ │ │ │ │ -_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ -_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ -_D_u_n_e_:_:_v_o_i_d___t │ │ │ │ │ -typename Impl::voider< Types... >::type void_t │ │ │ │ │ -Is void for all valid input types. The workhorse for C++11 SFINAE-techniques. │ │ │ │ │ -DDeeffiinniittiioonn typetraits.hh:40 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_APPLY_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_APPLY_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e │ │ │ │ │ +11{ │ │ │ │ │ +_1_2 namespace Std │ │ │ │ │ +13 { │ │ │ │ │ +14 │ │ │ │ │ +17 using std::apply; │ │ │ │ │ +18 │ │ │ │ │ +19 } // namespace Std │ │ │ │ │ +20} // namespace Dune │ │ │ │ │ +21 │ │ │ │ │ +22#endif // #ifndef DUNE_COMMON_STD_APPLY_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ -auto getMPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_T_r_a_i_t_s │ │ │ │ │ -A traits class describing the mapping of types onto MPI_Datatypes. │ │ │ │ │ -DDeeffiinniittiioonn mpitraits.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_d_a_t_a__ │ │ │ │ │ -T & data_ │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_t_y_p_e │ │ │ │ │ -MPI_Datatype type() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_p_t_r │ │ │ │ │ -void * ptr() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_t_a_t_i_c___s_i_z_e │ │ │ │ │ -static constexpr bool static_size │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_M_P_I_D_a_t_a │ │ │ │ │ -MPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_g_e_t │ │ │ │ │ -void get() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_M_P_I_D_a_t_a │ │ │ │ │ -MPIData() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_s_i_z_e │ │ │ │ │ -int size() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_p_t_r │ │ │ │ │ -void * ptr() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:83 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_t_y_p_e │ │ │ │ │ -MPI_Datatype type() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ -_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ -_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_M_P_I_D_a_t_a │ │ │ │ │ -MPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:107 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ -_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ -_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_p_t_r │ │ │ │ │ -void * ptr() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ -_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ -_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_s_i_z_e │ │ │ │ │ -int size() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ -_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ -_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_d_a_t_a__ │ │ │ │ │ -T & data_ │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:130 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ -_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ -_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_r_e_s_i_z_e │ │ │ │ │ -auto resize(int size) -> std::enable_if_t::value||!Std:: │ │ │ │ │ -is_detected_v< hasResizeOp, S > > │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:123 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _s_t_d_:_:_t_u_p_l_e_<_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._d_a_t_a │ │ │ │ │ -_(_)_)_,_ _d_e_c_l_t_y_p_e_(_s_t_d_:_:_d_e_c_l_v_a_l_<_ _T_ _>_(_)_._s_i_z_e_(_)_)_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_d_e_c_a_y___t_<_ _T_ _>_:_: │ │ │ │ │ -_v_a_l_u_e___t_y_p_e_ _>_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -MPI_Datatype type() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:118 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00233.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: future.hh File Reference │ │ │ │ +dune-common: conditional.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,48 +65,39 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -Classes | │ │ │ │ -Namespaces
    │ │ │ │ -
    future.hh File Reference
    │ │ │ │ +Namespaces | │ │ │ │ +Functions
    │ │ │ │ +
    conditional.hh File Reference
    │ │ │ │ │ │ │ │
    │ │ │ │ -
    #include <memory>
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -
    │ │ │ │ + │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ -Classes

    class  Dune::InvalidFutureException
     This exception is thrown when ready(), wait() or get() is called on an invalid future. A future is valid until get() is called and if it is not default-constructed and it was not moved from. More...
     
    class  Dune::Future< T >
     Type-erasure for future-like objects. A future-like object is a object satisfying the interface of FutureBase. More...
     
    class  Dune::PseudoFuture< T >
     A wrapper-class for a object which is ready immediately. More...
     
    class  Dune::PseudoFuture< void >
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

    │ │ │ │ Namespaces

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

    │ │ │ │ +Functions

    template<typename T1 , typename T2 >
    const T1 Dune::cond (bool b, const T1 &v1, const T2 &v2)
     conditional evaluate
     
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,33 +1,20 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -future.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +conditional.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_:_:_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ - This exception is thrown when ready(), wait() or get() is called on an │ │ │ │ │ -  invalid future. A future is valid until get() is called and if it is │ │ │ │ │ - not default-constructed and it was not moved from. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_F_u_t_u_r_e_<_ _T_ _> │ │ │ │ │ -  Type-erasure for future-like objects. A future-like object is a object │ │ │ │ │ - satisfying the interface of FutureBase. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _T_ _> │ │ │ │ │ -  A wrapper-class for a object which is ready immediately. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _> │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +const T1  _D_u_n_e_:_:_c_o_n_d (bool b, const T1 &v1, const T2 &v2) │ │ │ │ │ +  conditional evaluate │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00233_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: future.hh Source File │ │ │ │ +dune-common: conditional.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,254 +70,42 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    future.hh
    │ │ │ │ +
    conditional.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ -Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │ -
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │ -
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │ -
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMON_PARALLEL_FUTURE_HH
    │ │ │ │ -
    6#define DUNE_COMMON_PARALLEL_FUTURE_HH
    │ │ │ │ -
    7
    │ │ │ │ -
    8#include <memory>
    │ │ │ │ - │ │ │ │ -
    10
    │ │ │ │ -
    11namespace Dune{
    │ │ │ │ -
    12
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    18 {};
    │ │ │ │ -
    │ │ │ │ -
    19
    │ │ │ │ -
    20 // forward declaration
    │ │ │ │ -
    21 template<class T>
    │ │ │ │ -
    22 class PseudoFuture;
    │ │ │ │ -
    23
    │ │ │ │ -
    27 template<class T>
    │ │ │ │ -
    │ │ │ │ -
    28 class Future{
    │ │ │ │ -
    29 // Future interface:
    │ │ │ │ -
    30 class FutureBase{
    │ │ │ │ -
    31 public:
    │ │ │ │ -
    32 virtual ~FutureBase() = default;
    │ │ │ │ -
    33 virtual void wait() = 0;
    │ │ │ │ -
    34 virtual bool ready() const = 0;
    │ │ │ │ -
    35 virtual bool valid() const = 0;
    │ │ │ │ -
    36 virtual T get() = 0;
    │ │ │ │ -
    37 };
    │ │ │ │ -
    38
    │ │ │ │ -
    39 // model class
    │ │ │ │ -
    40 template<class F>
    │ │ │ │ -
    41 class FutureModel
    │ │ │ │ -
    42 : public FutureBase
    │ │ │ │ -
    43 {
    │ │ │ │ -
    44 F _future;
    │ │ │ │ -
    45 public:
    │ │ │ │ -
    46 FutureModel(F&& f)
    │ │ │ │ -
    47 : _future(std::forward<F>(f))
    │ │ │ │ -
    48 {}
    │ │ │ │ -
    49
    │ │ │ │ -
    50 virtual void wait() override
    │ │ │ │ -
    51 {
    │ │ │ │ -
    52 _future.wait();
    │ │ │ │ -
    53 }
    │ │ │ │ -
    54
    │ │ │ │ -
    55 virtual bool ready() const override
    │ │ │ │ -
    56 {
    │ │ │ │ -
    57 return _future.ready();
    │ │ │ │ -
    58 }
    │ │ │ │ -
    59
    │ │ │ │ -
    60 virtual bool valid() const override
    │ │ │ │ -
    61 {
    │ │ │ │ -
    62 return _future.valid();
    │ │ │ │ -
    63 }
    │ │ │ │ -
    64
    │ │ │ │ -
    65 virtual T get() override{
    │ │ │ │ -
    66 return (T)_future.get();
    │ │ │ │ -
    67 }
    │ │ │ │ -
    68 };
    │ │ │ │ -
    69
    │ │ │ │ -
    70 std::unique_ptr<FutureBase> _future;
    │ │ │ │ -
    71 public:
    │ │ │ │ -
    72 template<class F>
    │ │ │ │ -
    │ │ │ │ -
    73 Future(F&& f)
    │ │ │ │ -
    74 : _future(std::make_unique<FutureModel<F>>(std::forward<F>(f)))
    │ │ │ │ -
    75 {}
    │ │ │ │ -
    │ │ │ │ -
    76
    │ │ │ │ -
    77 template<class U, std::enable_if_t<std::is_same<U,T>::value && !std::is_same<T,void>::value>>
    │ │ │ │ -
    │ │ │ │ -
    78 Future(U&& data)
    │ │ │ │ -
    79 : _future(std::make_unique<FutureModel<PseudoFuture<T>>>(PseudoFuture<T>(std::forward<U>(data))))
    │ │ │ │ -
    80 {}
    │ │ │ │ -
    │ │ │ │ -
    81
    │ │ │ │ -
    82 Future() = default;
    │ │ │ │ -
    83
    │ │ │ │ -
    │ │ │ │ -
    87 void wait(){
    │ │ │ │ -
    88 _future->wait();
    │ │ │ │ -
    89 }
    │ │ │ │ -
    │ │ │ │ -
    90
    │ │ │ │ -
    │ │ │ │ -
    95 T get() {
    │ │ │ │ -
    96 return _future->get();
    │ │ │ │ -
    97 }
    │ │ │ │ -
    │ │ │ │ -
    98
    │ │ │ │ -
    │ │ │ │ -
    103 bool ready() const {
    │ │ │ │ -
    104 return _future->ready();
    │ │ │ │ -
    105 }
    │ │ │ │ -
    │ │ │ │ -
    106
    │ │ │ │ -
    │ │ │ │ -
    112 bool valid() const {
    │ │ │ │ -
    113 if(_future)
    │ │ │ │ -
    114 return _future->valid();
    │ │ │ │ -
    115 return false;
    │ │ │ │ -
    116 }
    │ │ │ │ -
    │ │ │ │ -
    117 };
    │ │ │ │ -
    │ │ │ │ -
    118
    │ │ │ │ -
    121 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    123 bool valid_;
    │ │ │ │ -
    124 T data_;
    │ │ │ │ -
    125 public:
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    127 valid_(false)
    │ │ │ │ -
    128 {}
    │ │ │ │ -
    │ │ │ │ -
    129
    │ │ │ │ -
    130 template<class U>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    132 valid_(true),
    │ │ │ │ -
    133 data_(std::forward<U>(u))
    │ │ │ │ -
    134 {}
    │ │ │ │ -
    │ │ │ │ -
    135
    │ │ │ │ -
    │ │ │ │ -
    136 void wait() {
    │ │ │ │ -
    137 if(!valid_)
    │ │ │ │ -
    138 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    │ │ │ │ -
    139 }
    │ │ │ │ -
    │ │ │ │ -
    140
    │ │ │ │ -
    │ │ │ │ -
    141 bool ready() const {
    │ │ │ │ -
    142 if(!valid_)
    │ │ │ │ -
    143 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    │ │ │ │ -
    144 return true;
    │ │ │ │ -
    145 }
    │ │ │ │ -
    │ │ │ │ -
    146
    │ │ │ │ -
    │ │ │ │ -
    147 T get() {
    │ │ │ │ -
    148 if(!valid_)
    │ │ │ │ -
    149 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    │ │ │ │ -
    150 valid_ = false;
    │ │ │ │ -
    151 return std::forward<T>(data_);
    │ │ │ │ -
    152 }
    │ │ │ │ -
    │ │ │ │ -
    153
    │ │ │ │ -
    │ │ │ │ -
    154 bool valid() const {
    │ │ │ │ -
    155 return valid_;
    │ │ │ │ -
    156 }
    │ │ │ │ -
    │ │ │ │ -
    157 };
    │ │ │ │ -
    │ │ │ │ -
    158
    │ │ │ │ -
    159 template<>
    │ │ │ │ -
    │ │ │ │ -
    160 class PseudoFuture<void>{
    │ │ │ │ -
    161 bool valid_;
    │ │ │ │ -
    162 public:
    │ │ │ │ -
    │ │ │ │ -
    163 PseudoFuture(bool valid = false) :
    │ │ │ │ -
    164 valid_(valid)
    │ │ │ │ -
    165 {}
    │ │ │ │ -
    │ │ │ │ -
    166
    │ │ │ │ -
    │ │ │ │ -
    167 void wait(){
    │ │ │ │ -
    168 if(!valid_)
    │ │ │ │ -
    169 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    │ │ │ │ -
    170 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    171 bool ready() const{
    │ │ │ │ -
    172 if(!valid_)
    │ │ │ │ -
    173 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    │ │ │ │ -
    174 return true;
    │ │ │ │ -
    175 }
    │ │ │ │ -
    │ │ │ │ -
    176
    │ │ │ │ -
    │ │ │ │ -
    177 void get(){
    │ │ │ │ -
    178 if(!valid_)
    │ │ │ │ -
    179 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    │ │ │ │ -
    180 valid_ = false;
    │ │ │ │ -
    181 }
    │ │ │ │ -
    │ │ │ │ -
    182
    │ │ │ │ -
    │ │ │ │ -
    183 bool valid() const{
    │ │ │ │ -
    184 return valid_;
    │ │ │ │ -
    185 }
    │ │ │ │ -
    │ │ │ │ -
    186 };
    │ │ │ │ -
    │ │ │ │ -
    187}
    │ │ │ │ -
    188
    │ │ │ │ -
    189#endif
    │ │ │ │ -
    A few common exception classes.
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ -
    STL namespace.
    │ │ │ │ +Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: 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_COMMON_CONDITIONAL_HH
    │ │ │ │ +
    4#define DUNE_COMMON_CONDITIONAL_HH
    │ │ │ │ +
    5
    │ │ │ │ +
    6namespace Dune
    │ │ │ │ +
    7{
    │ │ │ │ +
    8
    │ │ │ │ +
    27 template<typename T1, typename T2>
    │ │ │ │ +
    │ │ │ │ +
    28 const T1 cond(bool b, const T1 & v1, const T2 & v2)
    │ │ │ │ +
    29 {
    │ │ │ │ +
    30 return (b ? v1 : v2);
    │ │ │ │ +
    31 }
    │ │ │ │ +
    │ │ │ │ +
    32
    │ │ │ │ +
    33} // end namespace Dune
    │ │ │ │ +
    34
    │ │ │ │ +
    35#endif // DUNE_COMMON_CONDITIONAL_HH
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
    Definition propertymap.hh:84
    │ │ │ │ -
    Default exception if a function was called while the object is not in a valid state for that function...
    Definition exceptions.hh:281
    │ │ │ │ -
    This exception is thrown when ready(), wait() or get() is called on an invalid future....
    Definition future.hh:18
    │ │ │ │ -
    A wrapper-class for a object which is ready immediately.
    Definition future.hh:122
    │ │ │ │ -
    bool ready() const
    Definition future.hh:141
    │ │ │ │ -
    T get()
    Definition future.hh:147
    │ │ │ │ -
    PseudoFuture(U &&u)
    Definition future.hh:131
    │ │ │ │ -
    PseudoFuture()
    Definition future.hh:126
    │ │ │ │ -
    void wait()
    Definition future.hh:136
    │ │ │ │ -
    bool valid() const
    Definition future.hh:154
    │ │ │ │ -
    Type-erasure for future-like objects. A future-like object is a object satisfying the interface of Fu...
    Definition future.hh:28
    │ │ │ │ -
    bool ready() const
    Definition future.hh:103
    │ │ │ │ -
    void wait()
    wait until the future is ready
    Definition future.hh:87
    │ │ │ │ -
    Future(U &&data)
    Definition future.hh:78
    │ │ │ │ -
    T get()
    Waits until the future is ready and returns the resulting value.
    Definition future.hh:95
    │ │ │ │ -
    Future()=default
    │ │ │ │ -
    bool valid() const
    Checks whether the future is valid. I.e. ‘get()’ was not called on that future and when it was not de...
    Definition future.hh:112
    │ │ │ │ -
    Future(F &&f)
    Definition future.hh:73
    │ │ │ │ -
    bool ready() const
    Definition future.hh:171
    │ │ │ │ -
    bool valid() const
    Definition future.hh:183
    │ │ │ │ -
    void get()
    Definition future.hh:177
    │ │ │ │ -
    PseudoFuture(bool valid=false)
    Definition future.hh:163
    │ │ │ │ -
    void wait()
    Definition future.hh:167
    │ │ │ │ +
    const T1 cond(bool b, const T1 &v1, const T2 &v2)
    conditional evaluate
    Definition conditional.hh:28
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,264 +1,35 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -future.hh │ │ │ │ │ +conditional.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMON_PARALLEL_FUTURE_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_FUTURE_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e{ │ │ │ │ │ -12 │ │ │ │ │ -_1_7 class _I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n : public _I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ -18 {}; │ │ │ │ │ -19 │ │ │ │ │ -20 // forward declaration │ │ │ │ │ -21 template │ │ │ │ │ -22 class _P_s_e_u_d_o_F_u_t_u_r_e; │ │ │ │ │ -23 │ │ │ │ │ -27 template │ │ │ │ │ -_2_8 class _F_u_t_u_r_e{ │ │ │ │ │ -29 // Future interface: │ │ │ │ │ -30 class FutureBase{ │ │ │ │ │ -31 public: │ │ │ │ │ -32 virtual ~FutureBase() = default; │ │ │ │ │ -33 virtual void wait() = 0; │ │ │ │ │ -34 virtual bool ready() const = 0; │ │ │ │ │ -35 virtual bool valid() const = 0; │ │ │ │ │ -36 virtual T _g_e_t() = 0; │ │ │ │ │ -37 }; │ │ │ │ │ -38 │ │ │ │ │ -39 // model class │ │ │ │ │ -40 template │ │ │ │ │ -41 class FutureModel │ │ │ │ │ -42 : public FutureBase │ │ │ │ │ -43 { │ │ │ │ │ -44 F _future; │ │ │ │ │ -45 public: │ │ │ │ │ -46 FutureModel(F&& f) │ │ │ │ │ -47 : _future(std::forward(f)) │ │ │ │ │ -48 {} │ │ │ │ │ -49 │ │ │ │ │ -50 virtual void wait() override │ │ │ │ │ -51 { │ │ │ │ │ -52 _future.wait(); │ │ │ │ │ -53 } │ │ │ │ │ -54 │ │ │ │ │ -55 virtual bool ready() const override │ │ │ │ │ -56 { │ │ │ │ │ -57 return _future.ready(); │ │ │ │ │ -58 } │ │ │ │ │ -59 │ │ │ │ │ -60 virtual bool valid() const override │ │ │ │ │ -61 { │ │ │ │ │ -62 return _future.valid(); │ │ │ │ │ -63 } │ │ │ │ │ -64 │ │ │ │ │ -65 virtual T _g_e_t() override{ │ │ │ │ │ -66 return (T)_future.get(); │ │ │ │ │ -67 } │ │ │ │ │ -68 }; │ │ │ │ │ -69 │ │ │ │ │ -70 std::unique_ptr _future; │ │ │ │ │ -71 public: │ │ │ │ │ -72 template │ │ │ │ │ -_7_3 _F_u_t_u_r_e(F&& f) │ │ │ │ │ -74 : _future(_s_t_d::make_unique>(_s_t_d::forward(f))) │ │ │ │ │ -75 {} │ │ │ │ │ -76 │ │ │ │ │ -77 template::value && !std:: │ │ │ │ │ -is_same::value>> │ │ │ │ │ -_7_8 _F_u_t_u_r_e(U&& data) │ │ │ │ │ -79 : _future(_s_t_d::make_unique>>(_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ -(_s_t_d::forward(data)))) │ │ │ │ │ -80 {} │ │ │ │ │ -81 │ │ │ │ │ -_8_2 _F_u_t_u_r_e() = default; │ │ │ │ │ -83 │ │ │ │ │ -_8_7 void _w_a_i_t(){ │ │ │ │ │ -88 _future->wait(); │ │ │ │ │ -89 } │ │ │ │ │ -90 │ │ │ │ │ -_9_5 T _g_e_t() { │ │ │ │ │ -96 return _future->get(); │ │ │ │ │ -97 } │ │ │ │ │ -98 │ │ │ │ │ -_1_0_3 bool _r_e_a_d_y() const { │ │ │ │ │ -104 return _future->ready(); │ │ │ │ │ -105 } │ │ │ │ │ -106 │ │ │ │ │ -_1_1_2 bool _v_a_l_i_d() const { │ │ │ │ │ -113 if(_future) │ │ │ │ │ -114 return _future->valid(); │ │ │ │ │ -115 return false; │ │ │ │ │ -116 } │ │ │ │ │ -117 }; │ │ │ │ │ -118 │ │ │ │ │ -121 template │ │ │ │ │ -_1_2_2 class _P_s_e_u_d_o_F_u_t_u_r_e{ │ │ │ │ │ -123 bool valid_; │ │ │ │ │ -124 T data_; │ │ │ │ │ -125 public: │ │ │ │ │ -_1_2_6 _P_s_e_u_d_o_F_u_t_u_r_e() : │ │ │ │ │ -127 valid_(false) │ │ │ │ │ -128 {} │ │ │ │ │ -129 │ │ │ │ │ -130 template │ │ │ │ │ -_1_3_1 _P_s_e_u_d_o_F_u_t_u_r_e(U&& u) : │ │ │ │ │ -132 valid_(true), │ │ │ │ │ -133 data_(_s_t_d::forward(u)) │ │ │ │ │ -134 {} │ │ │ │ │ -135 │ │ │ │ │ -_1_3_6 void _w_a_i_t() { │ │ │ │ │ -137 if(!valid_) │ │ │ │ │ -138 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ -139 } │ │ │ │ │ -140 │ │ │ │ │ -_1_4_1 bool _r_e_a_d_y() const { │ │ │ │ │ -142 if(!valid_) │ │ │ │ │ -143 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ -144 return true; │ │ │ │ │ -145 } │ │ │ │ │ -146 │ │ │ │ │ -_1_4_7 T _g_e_t() { │ │ │ │ │ -148 if(!valid_) │ │ │ │ │ -149 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ -150 valid_ = false; │ │ │ │ │ -151 return std::forward(data_); │ │ │ │ │ -152 } │ │ │ │ │ -153 │ │ │ │ │ -_1_5_4 bool _v_a_l_i_d() const { │ │ │ │ │ -155 return valid_; │ │ │ │ │ -156 } │ │ │ │ │ -157 }; │ │ │ │ │ -158 │ │ │ │ │ -159 template<> │ │ │ │ │ -_1_6_0 class _P_s_e_u_d_o_F_u_t_u_r_e{ │ │ │ │ │ -161 bool valid_; │ │ │ │ │ -162 public: │ │ │ │ │ -_1_6_3 _P_s_e_u_d_o_F_u_t_u_r_e(bool _v_a_l_i_d = false) : │ │ │ │ │ -164 valid_(_v_a_l_i_d) │ │ │ │ │ -165 {} │ │ │ │ │ -166 │ │ │ │ │ -_1_6_7 void _w_a_i_t(){ │ │ │ │ │ -168 if(!valid_) │ │ │ │ │ -169 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ -170 } │ │ │ │ │ -_1_7_1 bool _r_e_a_d_y() const{ │ │ │ │ │ -172 if(!valid_) │ │ │ │ │ -173 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ -174 return true; │ │ │ │ │ -175 } │ │ │ │ │ -176 │ │ │ │ │ -_1_7_7 void _g_e_t(){ │ │ │ │ │ -178 if(!valid_) │ │ │ │ │ -179 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n, "The PseudoFuture is not valid"); │ │ │ │ │ -180 valid_ = false; │ │ │ │ │ -181 } │ │ │ │ │ -182 │ │ │ │ │ -_1_8_3 bool _v_a_l_i_d() const{ │ │ │ │ │ -184 return valid_; │ │ │ │ │ -185 } │ │ │ │ │ -186 }; │ │ │ │ │ -187} │ │ │ │ │ -188 │ │ │ │ │ -189#endif │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_CONDITIONAL_HH │ │ │ │ │ +4#define DUNE_COMMON_CONDITIONAL_HH │ │ │ │ │ +5 │ │ │ │ │ +6namespace _D_u_n_e │ │ │ │ │ +7{ │ │ │ │ │ +8 │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 const T1 _c_o_n_d(bool b, const T1 & v1, const T2 & v2) │ │ │ │ │ +29 { │ │ │ │ │ +30 return (b ? v1 : v2); │ │ │ │ │ +31 } │ │ │ │ │ +32 │ │ │ │ │ +33} // end namespace Dune │ │ │ │ │ +34 │ │ │ │ │ +35#endif // DUNE_COMMON_CONDITIONAL_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ │ -Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const │ │ │ │ │ -Key &key) │ │ │ │ │ -DDeeffiinniittiioonn propertymap.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ -Default exception if a function was called while the object is not in a valid │ │ │ │ │ -state for that function... │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:281 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_a_l_i_d_F_u_t_u_r_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ -This exception is thrown when ready(), wait() or get() is called on an invalid │ │ │ │ │ -future.... │ │ │ │ │ -DDeeffiinniittiioonn future.hh:18 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ -A wrapper-class for a object which is ready immediately. │ │ │ │ │ -DDeeffiinniittiioonn future.hh:122 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ -bool ready() const │ │ │ │ │ -DDeeffiinniittiioonn future.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ -T get() │ │ │ │ │ -DDeeffiinniittiioonn future.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ -PseudoFuture(U &&u) │ │ │ │ │ -DDeeffiinniittiioonn future.hh:131 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ -PseudoFuture() │ │ │ │ │ -DDeeffiinniittiioonn future.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_w_a_i_t │ │ │ │ │ -void wait() │ │ │ │ │ -DDeeffiinniittiioonn future.hh:136 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_v_a_l_i_d │ │ │ │ │ -bool valid() const │ │ │ │ │ -DDeeffiinniittiioonn future.hh:154 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e │ │ │ │ │ -Type-erasure for future-like objects. A future-like object is a object │ │ │ │ │ -satisfying the interface of Fu... │ │ │ │ │ -DDeeffiinniittiioonn future.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ -bool ready() const │ │ │ │ │ -DDeeffiinniittiioonn future.hh:103 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_w_a_i_t │ │ │ │ │ -void wait() │ │ │ │ │ -wait until the future is ready │ │ │ │ │ -DDeeffiinniittiioonn future.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ -Future(U &&data) │ │ │ │ │ -DDeeffiinniittiioonn future.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ -T get() │ │ │ │ │ -Waits until the future is ready and returns the resulting value. │ │ │ │ │ -DDeeffiinniittiioonn future.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ -Future()=default │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_v_a_l_i_d │ │ │ │ │ -bool valid() const │ │ │ │ │ -Checks whether the future is valid. I.e. ‘get()’ was not called on that │ │ │ │ │ -future and when it was not de... │ │ │ │ │ -DDeeffiinniittiioonn future.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ -Future(F &&f) │ │ │ │ │ -DDeeffiinniittiioonn future.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_r_e_a_d_y │ │ │ │ │ -bool ready() const │ │ │ │ │ -DDeeffiinniittiioonn future.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_v_a_l_i_d │ │ │ │ │ -bool valid() const │ │ │ │ │ -DDeeffiinniittiioonn future.hh:183 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_g_e_t │ │ │ │ │ -void get() │ │ │ │ │ -DDeeffiinniittiioonn future.hh:177 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ -PseudoFuture(bool valid=false) │ │ │ │ │ -DDeeffiinniittiioonn future.hh:163 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_<_ _v_o_i_d_ _>_:_:_w_a_i_t │ │ │ │ │ -void wait() │ │ │ │ │ -DDeeffiinniittiioonn future.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_c_o_n_d │ │ │ │ │ +const T1 cond(bool b, const T1 &v1, const T2 &v2) │ │ │ │ │ +conditional evaluate │ │ │ │ │ +DDeeffiinniittiioonn conditional.hh:28 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00236.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: communicator.hh File Reference │ │ │ │ +dune-common: tuplevector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,73 +65,57 @@ │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ -Namespaces
    │ │ │ │ - │ │ │ │ +Namespaces | │ │ │ │ +Functions
    │ │ │ │ +
    tuplevector.hh File Reference
    │ │ │ │ │ │ │ │
    │ │ │ │ │ │ │ │ -

    Provides utility classes for syncing distributed data via MPI communication. │ │ │ │ +

    Provides the TupleVector class that augments std::tuple by operator[]. │ │ │ │ More...

    │ │ │ │ -
    #include <cassert>
    │ │ │ │ -#include <cstddef>
    │ │ │ │ -#include <iostream>
    │ │ │ │ -#include <map>
    │ │ │ │ -#include <type_traits>
    │ │ │ │ +
    #include <tuple>
    │ │ │ │ #include <utility>
    │ │ │ │ -#include <mpi.h>
    │ │ │ │ -#include <dune/common/exceptions.hh>
    │ │ │ │ -#include <dune/common/parallel/interface.hh>
    │ │ │ │ -#include <dune/common/parallel/remoteindices.hh>
    │ │ │ │ -#include <dune/common/stdstreams.hh>
    │ │ │ │ +#include <dune/common/indices.hh>
    │ │ │ │ +#include <dune/common/typetraits.hh>
    │ │ │ │ +#include <dune/common/std/type_traits.hh>
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    struct  Dune::SizeOne
     Flag for marking indexed data structures where data at each index is of the same size. More...
     
    struct  Dune::VariableSize
     Flag for marking indexed data structures where the data at each index may be a variable multiple of another type. More...
     
    struct  Dune::CommPolicy< V >
     Default policy used for communicating an indexed type. More...
     
    struct  Dune::CommPolicy< V >::CommPolicy< VariableBlockVector< FieldVector< K, n >, A > >
     
    class  Dune::CommPolicy< V >::CommunicationError
     Error thrown if there was a problem with the communication. More...
     
    struct  Dune::CommPolicy< V >::CopyGatherScatter< T >
     GatherScatter default implementation that just copies data. More...
     
    class  Dune::BufferedCommunicator
     A communicator that uses buffers to gather and scatter the data to be send or received. More...
    class  Dune::TupleVector< T >
     A class augmenting std::tuple by element access via operator[]. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

    │ │ │ │ Namespaces

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

    │ │ │ │ +Functions

    template<class... T>
    constexpr auto Dune::makeTupleVector (T &&... t)
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Provides utility classes for syncing distributed data via MPI communication.

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

    Provides the TupleVector class that augments std::tuple by operator[].

    │ │ │ │ +
    Author
    Carsten Gräser
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,59 +1,33 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -communicator.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_p_u_t_i_n_g_ _b_a_s_e_d_ _o_n_ _I_n_d_e_x_s_e_t_s │ │ │ │ │ -Provides utility classes for syncing distributed data via MPI communication. │ │ │ │ │ -_M_o_r_e_._._. │ │ │ │ │ -#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 │ │ │ │ │ +tuplevector.hh File Reference │ │ │ │ │ +Provides the TupleVector class that augments std::tuple by operator[]. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_S_i_z_e_O_n_e │ │ │ │ │ -  Flag for marking indexed data structures where data at each index is │ │ │ │ │ - of the same size. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e │ │ │ │ │ -  Flag for marking indexed data structures where the data at each index │ │ │ │ │ - may be a variable multiple of another type. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _> │ │ │ │ │ -  Default policy used for communicating an indexed type. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _>_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_< │ │ │ │ │ - _K_,_ _n_ _>_,_ _A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _>_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_E_r_r_o_r │ │ │ │ │ -  Error thrown if there was a problem with the communication. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_ _>_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _T_ _> │ │ │ │ │ -  GatherScatter default implementation that just copies data. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -  A communicator that uses buffers to gather and scatter the data to be │ │ │ │ │ - send or received. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r_<_ _T_ _> │ │ │ │ │ +  A class augmenting std::tuple by element access via operator[]. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_m_a_k_e_T_u_p_l_e_V_e_c_t_o_r (T &&... t) │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides utility classes for syncing distributed data via MPI communication. │ │ │ │ │ +Provides the TupleVector class that augments std::tuple by operator[]. │ │ │ │ │ Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ + Carsten Gräser │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00236_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: communicator.hh Source File │ │ │ │ +dune-common: tuplevector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1040 +70,124 @@ │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    communicator.hh
    │ │ │ │ +
    tuplevector.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_COMMUNICATOR
    │ │ │ │ -
    6#define DUNE_COMMUNICATOR
    │ │ │ │ +
    5#ifndef DUNE_COMMON_TUPLEVECTOR_HH
    │ │ │ │ +
    6#define DUNE_COMMON_TUPLEVECTOR_HH
    │ │ │ │
    7
    │ │ │ │ -
    8#if HAVE_MPI
    │ │ │ │ -
    9
    │ │ │ │ -
    10#include <cassert>
    │ │ │ │ -
    11#include <cstddef>
    │ │ │ │ -
    12#include <iostream>
    │ │ │ │ -
    13#include <map>
    │ │ │ │ -
    14#include <type_traits>
    │ │ │ │ -
    15#include <utility>
    │ │ │ │ +
    8#include <tuple>
    │ │ │ │ +
    9#include <utility>
    │ │ │ │ +
    10
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    14
    │ │ │ │ +
    15
    │ │ │ │
    16
    │ │ │ │ -
    17#include <mpi.h>
    │ │ │ │ -
    18
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    23
    │ │ │ │ -
    24namespace Dune
    │ │ │ │ -
    25{
    │ │ │ │ -
    │ │ │ │ -
    109 struct SizeOne
    │ │ │ │ -
    110 {};
    │ │ │ │ -
    │ │ │ │ -
    111
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    118 {};
    │ │ │ │ -
    │ │ │ │ -
    119
    │ │ │ │ -
    120
    │ │ │ │ -
    126 template<class V>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    128 {
    │ │ │ │ -
    140 typedef V Type;
    │ │ │ │ -
    141
    │ │ │ │ -
    147 typedef typename V::value_type IndexedType;
    │ │ │ │ -
    148
    │ │ │ │ - │ │ │ │ -
    154
    │ │ │ │ -
    163 static const void* getAddress(const V& v, int index);
    │ │ │ │ -
    164
    │ │ │ │ -
    170 static int getSize(const V&, int index);
    │ │ │ │ -
    171 };
    │ │ │ │ -
    172
    │ │ │ │ -
    173 template<class K, int n> class FieldVector;
    │ │ │ │ -
    174
    │ │ │ │ -
    175 template<class B, class A> class VariableBlockVector;
    │ │ │ │ -
    176
    │ │ │ │ -
    177 template<class K, class A, int n>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    179 {
    │ │ │ │ - │ │ │ │ -
    181
    │ │ │ │ -
    182 typedef typename Type::B IndexedType;
    │ │ │ │ -
    183
    │ │ │ │ - │ │ │ │ -
    185
    │ │ │ │ -
    186 static const void* getAddress(const Type& v, int i);
    │ │ │ │ -
    187
    │ │ │ │ -
    188 static int getSize(const Type& v, int i);
    │ │ │ │ -
    189 };
    │ │ │ │ -
    │ │ │ │ -
    190
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    195 {};
    │ │ │ │ -
    │ │ │ │ -
    196
    │ │ │ │ -
    200 template<class T>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    202 {
    │ │ │ │ - │ │ │ │ -
    204
    │ │ │ │ -
    205 static const IndexedType& gather(const T& vec, std::size_t i);
    │ │ │ │ -
    206
    │ │ │ │ -
    207 static void scatter(T& vec, const IndexedType& v, std::size_t i);
    │ │ │ │ -
    208
    │ │ │ │ -
    209 };
    │ │ │ │ -
    │ │ │ │ -
    210
    │ │ │ │ -
    222 template<typename T>
    │ │ │ │ -
    223 class DatatypeCommunicator : public InterfaceBuilder
    │ │ │ │ -
    224 {
    │ │ │ │ -
    225 public:
    │ │ │ │ -
    226
    │ │ │ │ -
    230 typedef T ParallelIndexSet;
    │ │ │ │ -
    231
    │ │ │ │ - │ │ │ │ -
    236
    │ │ │ │ -
    240 typedef typename RemoteIndices::GlobalIndex GlobalIndex;
    │ │ │ │ -
    241
    │ │ │ │ -
    245 typedef typename RemoteIndices::Attribute Attribute;
    │ │ │ │ -
    246
    │ │ │ │ -
    250 typedef typename RemoteIndices::LocalIndex LocalIndex;
    │ │ │ │ -
    251
    │ │ │ │ -
    255 DatatypeCommunicator();
    │ │ │ │ -
    256
    │ │ │ │ -
    260 ~DatatypeCommunicator();
    │ │ │ │ -
    261
    │ │ │ │ -
    288 template<class T1, class T2, class V>
    │ │ │ │ -
    289 void build(const RemoteIndices& remoteIndices, const T1& sourceFlags, V& sendData, const T2& destFlags, V& receiveData);
    │ │ │ │ -
    290
    │ │ │ │ -
    294 void forward();
    │ │ │ │ -
    295
    │ │ │ │ -
    299 void backward();
    │ │ │ │ -
    300
    │ │ │ │ -
    304 void free();
    │ │ │ │ -
    305 private:
    │ │ │ │ -
    309 constexpr static int commTag_ = 234;
    │ │ │ │ -
    310
    │ │ │ │ -
    314 const RemoteIndices* remoteIndices_;
    │ │ │ │ -
    315
    │ │ │ │ -
    316 typedef std::map<int,std::pair<MPI_Datatype,MPI_Datatype> >
    │ │ │ │ -
    317 MessageTypeMap;
    │ │ │ │ -
    318
    │ │ │ │ -
    322 MessageTypeMap messageTypes;
    │ │ │ │ -
    323
    │ │ │ │ -
    327 void* data_;
    │ │ │ │ -
    328
    │ │ │ │ -
    329 MPI_Request* requests_[2];
    │ │ │ │ -
    330
    │ │ │ │ -
    334 bool created_;
    │ │ │ │ -
    335
    │ │ │ │ -
    339 template<class V, bool FORWARD>
    │ │ │ │ -
    340 void createRequests(V& sendData, V& receiveData);
    │ │ │ │ -
    341
    │ │ │ │ -
    345 template<class T1, class T2, class V, bool send>
    │ │ │ │ -
    346 void createDataTypes(const T1& source, const T2& destination, V& data);
    │ │ │ │ -
    347
    │ │ │ │ -
    351 void sendRecv(MPI_Request* req);
    │ │ │ │ -
    352
    │ │ │ │ -
    356 struct IndexedTypeInformation
    │ │ │ │ -
    357 {
    │ │ │ │ -
    363 void build(int i)
    │ │ │ │ -
    364 {
    │ │ │ │ -
    365 length = new int[i];
    │ │ │ │ -
    366 displ = new MPI_Aint[i];
    │ │ │ │ -
    367 size = i;
    │ │ │ │ -
    368 }
    │ │ │ │ -
    369
    │ │ │ │ -
    373 void free()
    │ │ │ │ -
    374 {
    │ │ │ │ -
    375 delete[] length;
    │ │ │ │ -
    376 delete[] displ;
    │ │ │ │ -
    377 }
    │ │ │ │ -
    379 int* length;
    │ │ │ │ -
    381 MPI_Aint* displ;
    │ │ │ │ -
    387 int elements;
    │ │ │ │ -
    391 int size;
    │ │ │ │ -
    392 };
    │ │ │ │ -
    393
    │ │ │ │ -
    399 template<class V>
    │ │ │ │ -
    400 struct MPIDatatypeInformation
    │ │ │ │ -
    401 {
    │ │ │ │ -
    406 MPIDatatypeInformation(const V& data) : data_(data)
    │ │ │ │ -
    407 {}
    │ │ │ │ -
    408
    │ │ │ │ -
    414 void reserve(int proc, int size)
    │ │ │ │ -
    415 {
    │ │ │ │ -
    416 information_[proc].build(size);
    │ │ │ │ -
    417 }
    │ │ │ │ -
    424 void add(int proc, int local)
    │ │ │ │ -
    425 {
    │ │ │ │ -
    426 IndexedTypeInformation& info=information_[proc];
    │ │ │ │ -
    427 assert((info.elements)<info.size);
    │ │ │ │ -
    428 MPI_Get_address( const_cast<void*>(CommPolicy<V>::getAddress(data_, local)),
    │ │ │ │ -
    429 info.displ+info.elements);
    │ │ │ │ -
    430 info.length[info.elements]=CommPolicy<V>::getSize(data_, local);
    │ │ │ │ -
    431 info.elements++;
    │ │ │ │ -
    432 }
    │ │ │ │ -
    433
    │ │ │ │ -
    438 std::map<int,IndexedTypeInformation> information_;
    │ │ │ │ -
    442 const V& data_;
    │ │ │ │ -
    443
    │ │ │ │ -
    444 };
    │ │ │ │ -
    445
    │ │ │ │ -
    446 };
    │ │ │ │ -
    │ │ │ │ -
    447
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    458 {
    │ │ │ │ -
    459
    │ │ │ │ -
    460 public:
    │ │ │ │ - │ │ │ │ -
    465
    │ │ │ │ -
    472 template<class Data, class Interface>
    │ │ │ │ -
    473 typename std::enable_if<std::is_same<SizeOne,typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type
    │ │ │ │ -
    474 build(const Interface& interface);
    │ │ │ │ -
    475
    │ │ │ │ -
    483 template<class Data, class Interface>
    │ │ │ │ -
    484 void build(const Data& source, const Data& target, const Interface& interface);
    │ │ │ │ -
    485
    │ │ │ │ -
    514 template<class GatherScatter, class Data>
    │ │ │ │ -
    515 void forward(const Data& source, Data& dest);
    │ │ │ │ -
    516
    │ │ │ │ -
    545 template<class GatherScatter, class Data>
    │ │ │ │ -
    546 void backward(Data& source, const Data& dest);
    │ │ │ │ -
    547
    │ │ │ │ -
    573 template<class GatherScatter, class Data>
    │ │ │ │ -
    574 void forward(Data& data);
    │ │ │ │ -
    575
    │ │ │ │ -
    601 template<class GatherScatter, class Data>
    │ │ │ │ -
    602 void backward(Data& data);
    │ │ │ │ -
    603
    │ │ │ │ -
    607 void free();
    │ │ │ │ -
    608
    │ │ │ │ - │ │ │ │ -
    613
    │ │ │ │ -
    614 private:
    │ │ │ │ -
    615
    │ │ │ │ -
    619 typedef std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
    │ │ │ │ -
    620 InterfaceMap;
    │ │ │ │ -
    621
    │ │ │ │ -
    622
    │ │ │ │ -
    626 template<class Data, typename IndexedTypeFlag>
    │ │ │ │ -
    627 struct MessageSizeCalculator
    │ │ │ │ -
    628 {};
    │ │ │ │ -
    629
    │ │ │ │ -
    634 template<class Data>
    │ │ │ │ -
    635 struct MessageSizeCalculator<Data,SizeOne>
    │ │ │ │ -
    636 {
    │ │ │ │ -
    643 inline int operator()(const InterfaceInformation& info) const;
    │ │ │ │ -
    652 inline int operator()(const Data& data, const InterfaceInformation& info) const;
    │ │ │ │ -
    653 };
    │ │ │ │ -
    654
    │ │ │ │ -
    659 template<class Data>
    │ │ │ │ -
    660 struct MessageSizeCalculator<Data,VariableSize>
    │ │ │ │ -
    661 {
    │ │ │ │ -
    670 inline int operator()(const Data& data, const InterfaceInformation& info) const;
    │ │ │ │ -
    671 };
    │ │ │ │ -
    672
    │ │ │ │ -
    676 template<class Data, class GatherScatter, bool send, typename IndexedTypeFlag>
    │ │ │ │ -
    677 struct MessageGatherer
    │ │ │ │ -
    678 {};
    │ │ │ │ -
    679
    │ │ │ │ -
    684 template<class Data, class GatherScatter, bool send>
    │ │ │ │ -
    685 struct MessageGatherer<Data,GatherScatter,send,SizeOne>
    │ │ │ │ -
    686 {
    │ │ │ │ -
    688 typedef typename CommPolicy<Data>::IndexedType Type;
    │ │ │ │ -
    689
    │ │ │ │ -
    694 typedef GatherScatter Gatherer;
    │ │ │ │ -
    695
    │ │ │ │ -
    701 constexpr static bool forward = send;
    │ │ │ │ -
    702
    │ │ │ │ -
    710 inline void operator()(const InterfaceMap& interface, const Data& data, Type* buffer, size_t bufferSize) const;
    │ │ │ │ -
    711 };
    │ │ │ │ -
    712
    │ │ │ │ -
    717 template<class Data, class GatherScatter, bool send>
    │ │ │ │ -
    718 struct MessageGatherer<Data,GatherScatter,send,VariableSize>
    │ │ │ │ -
    719 {
    │ │ │ │ -
    721 typedef typename CommPolicy<Data>::IndexedType Type;
    │ │ │ │ -
    722
    │ │ │ │ -
    727 typedef GatherScatter Gatherer;
    │ │ │ │ -
    728
    │ │ │ │ -
    734 constexpr static bool forward = send;
    │ │ │ │ -
    735
    │ │ │ │ -
    743 inline void operator()(const InterfaceMap& interface, const Data& data, Type* buffer, size_t bufferSize) const;
    │ │ │ │ -
    744 };
    │ │ │ │ -
    745
    │ │ │ │ -
    749 template<class Data, class GatherScatter, bool send, typename IndexedTypeFlag>
    │ │ │ │ -
    750 struct MessageScatterer
    │ │ │ │ -
    751 {};
    │ │ │ │ -
    752
    │ │ │ │ -
    757 template<class Data, class GatherScatter, bool send>
    │ │ │ │ -
    758 struct MessageScatterer<Data,GatherScatter,send,SizeOne>
    │ │ │ │ -
    759 {
    │ │ │ │ -
    761 typedef typename CommPolicy<Data>::IndexedType Type;
    │ │ │ │ -
    762
    │ │ │ │ -
    767 typedef GatherScatter Scatterer;
    │ │ │ │ -
    768
    │ │ │ │ -
    774 constexpr static bool forward = send;
    │ │ │ │ -
    775
    │ │ │ │ -
    783 inline void operator()(const InterfaceMap& interface, Data& data, Type* buffer, const int& proc) const;
    │ │ │ │ -
    784 };
    │ │ │ │ -
    789 template<class Data, class GatherScatter, bool send>
    │ │ │ │ -
    790 struct MessageScatterer<Data,GatherScatter,send,VariableSize>
    │ │ │ │ -
    791 {
    │ │ │ │ -
    793 typedef typename CommPolicy<Data>::IndexedType Type;
    │ │ │ │ -
    794
    │ │ │ │ -
    799 typedef GatherScatter Scatterer;
    │ │ │ │ -
    800
    │ │ │ │ -
    806 constexpr static bool forward = send;
    │ │ │ │ -
    807
    │ │ │ │ -
    815 inline void operator()(const InterfaceMap& interface, Data& data, Type* buffer, const int& proc) const;
    │ │ │ │ -
    816 };
    │ │ │ │ -
    817
    │ │ │ │ -
    821 struct MessageInformation
    │ │ │ │ -
    822 {
    │ │ │ │ -
    824 MessageInformation()
    │ │ │ │ -
    825 : start_(0), size_(0)
    │ │ │ │ -
    826 {}
    │ │ │ │ -
    827
    │ │ │ │ -
    835 MessageInformation(size_t start, size_t size)
    │ │ │ │ -
    836 : start_(start), size_(size)
    │ │ │ │ -
    837 {}
    │ │ │ │ -
    841 size_t start_;
    │ │ │ │ -
    845 size_t size_;
    │ │ │ │ -
    846 };
    │ │ │ │ -
    847
    │ │ │ │ -
    854 typedef std::map<int,std::pair<MessageInformation,MessageInformation> >
    │ │ │ │ -
    855 InformationMap;
    │ │ │ │ -
    859 InformationMap messageInformation_;
    │ │ │ │ -
    863 char* buffers_[2];
    │ │ │ │ -
    867 size_t bufferSize_[2];
    │ │ │ │ -
    868
    │ │ │ │ -
    872 constexpr static int commTag_ = 0;
    │ │ │ │ -
    873
    │ │ │ │ -
    877 std::map<int,std::pair<InterfaceInformation,InterfaceInformation> > interfaces_;
    │ │ │ │ -
    878
    │ │ │ │ -
    879 MPI_Comm communicator_;
    │ │ │ │ -
    880
    │ │ │ │ -
    884 template<class GatherScatter, bool FORWARD, class Data>
    │ │ │ │ -
    885 void sendRecv(const Data& source, Data& target);
    │ │ │ │ -
    886
    │ │ │ │ -
    887 };
    │ │ │ │ -
    │ │ │ │ -
    888
    │ │ │ │ -
    889#ifndef DOXYGEN
    │ │ │ │ -
    890
    │ │ │ │ -
    891 template<class V>
    │ │ │ │ -
    892 inline const void* CommPolicy<V>::getAddress(const V& v, int index)
    │ │ │ │ -
    893 {
    │ │ │ │ -
    894 return &(v[index]);
    │ │ │ │ -
    895 }
    │ │ │ │ -
    896
    │ │ │ │ -
    897 template<class V>
    │ │ │ │ -
    898 inline int CommPolicy<V>::getSize([[maybe_unused]] const V& v, [[maybe_unused]] int index)
    │ │ │ │ -
    899 {
    │ │ │ │ -
    900 return 1;
    │ │ │ │ -
    901 }
    │ │ │ │ -
    902
    │ │ │ │ -
    903 template<class K, class A, int n>
    │ │ │ │ -
    904 inline const void* CommPolicy<VariableBlockVector<FieldVector<K, n>, A> >::getAddress(const Type& v, int index)
    │ │ │ │ -
    905 {
    │ │ │ │ -
    906 return &(v[index][0]);
    │ │ │ │ -
    907 }
    │ │ │ │ -
    908
    │ │ │ │ -
    909 template<class K, class A, int n>
    │ │ │ │ -
    910 inline int CommPolicy<VariableBlockVector<FieldVector<K, n>, A> >::getSize(const Type& v, int index)
    │ │ │ │ -
    911 {
    │ │ │ │ -
    912 return v[index].getsize();
    │ │ │ │ -
    913 }
    │ │ │ │ -
    914
    │ │ │ │ -
    915 template<class T>
    │ │ │ │ -
    916 inline const typename CopyGatherScatter<T>::IndexedType& CopyGatherScatter<T>::gather(const T & vec, std::size_t i)
    │ │ │ │ -
    917 {
    │ │ │ │ -
    918 return vec[i];
    │ │ │ │ -
    919 }
    │ │ │ │ -
    920
    │ │ │ │ -
    921 template<class T>
    │ │ │ │ -
    922 inline void CopyGatherScatter<T>::scatter(T& vec, const IndexedType& v, std::size_t i)
    │ │ │ │ -
    923 {
    │ │ │ │ -
    924 vec[i]=v;
    │ │ │ │ -
    925 }
    │ │ │ │ -
    926
    │ │ │ │ -
    927 template<typename T>
    │ │ │ │ -
    928 DatatypeCommunicator<T>::DatatypeCommunicator()
    │ │ │ │ -
    929 : remoteIndices_(0), created_(false)
    │ │ │ │ -
    930 {
    │ │ │ │ -
    931 requests_[0]=0;
    │ │ │ │ -
    932 requests_[1]=0;
    │ │ │ │ -
    933 }
    │ │ │ │ -
    934
    │ │ │ │ -
    935
    │ │ │ │ -
    936
    │ │ │ │ -
    937 template<typename T>
    │ │ │ │ -
    938 DatatypeCommunicator<T>::~DatatypeCommunicator()
    │ │ │ │ -
    939 {
    │ │ │ │ -
    940 free();
    │ │ │ │ -
    941 }
    │ │ │ │ -
    942
    │ │ │ │ -
    943 template<typename T>
    │ │ │ │ -
    944 template<class T1, class T2, class V>
    │ │ │ │ -
    945 inline void DatatypeCommunicator<T>::build(const RemoteIndices& remoteIndices,
    │ │ │ │ -
    946 const T1& source, V& sendData,
    │ │ │ │ -
    947 const T2& destination, V& receiveData)
    │ │ │ │ -
    948 {
    │ │ │ │ -
    949 remoteIndices_ = &remoteIndices;
    │ │ │ │ -
    950 free();
    │ │ │ │ -
    951 createDataTypes<T1,T2,V,false>(source,destination, receiveData);
    │ │ │ │ -
    952 createDataTypes<T1,T2,V,true>(source,destination, sendData);
    │ │ │ │ -
    953 createRequests<V,true>(sendData, receiveData);
    │ │ │ │ -
    954 createRequests<V,false>(receiveData, sendData);
    │ │ │ │ -
    955 created_=true;
    │ │ │ │ -
    956 }
    │ │ │ │ -
    957
    │ │ │ │ -
    958 template<typename T>
    │ │ │ │ -
    959 void DatatypeCommunicator<T>::free()
    │ │ │ │ -
    960 {
    │ │ │ │ -
    961 if(created_) {
    │ │ │ │ -
    962 delete[] requests_[0];
    │ │ │ │ -
    963 delete[] requests_[1];
    │ │ │ │ -
    964 typedef MessageTypeMap::iterator iterator;
    │ │ │ │ -
    965 typedef MessageTypeMap::const_iterator const_iterator;
    │ │ │ │ -
    966
    │ │ │ │ -
    967 const const_iterator end=messageTypes.end();
    │ │ │ │ -
    968
    │ │ │ │ -
    969 for(iterator process = messageTypes.begin(); process != end; ++process) {
    │ │ │ │ -
    970 MPI_Datatype *type = &(process->second.first);
    │ │ │ │ -
    971 int finalized=0;
    │ │ │ │ -
    972 MPI_Finalized(&finalized);
    │ │ │ │ -
    973 if(*type!=MPI_DATATYPE_NULL && !finalized)
    │ │ │ │ -
    974 MPI_Type_free(type);
    │ │ │ │ -
    975 type = &(process->second.second);
    │ │ │ │ -
    976 if(*type!=MPI_DATATYPE_NULL && !finalized)
    │ │ │ │ -
    977 MPI_Type_free(type);
    │ │ │ │ -
    978 }
    │ │ │ │ -
    979 messageTypes.clear();
    │ │ │ │ -
    980 created_=false;
    │ │ │ │ -
    981 }
    │ │ │ │ -
    982
    │ │ │ │ -
    983 }
    │ │ │ │ -
    984
    │ │ │ │ -
    985 template<typename T>
    │ │ │ │ -
    986 template<class T1, class T2, class V, bool send>
    │ │ │ │ -
    987 void DatatypeCommunicator<T>::createDataTypes(const T1& sourceFlags, const T2& destFlags, V& data)
    │ │ │ │ -
    988 {
    │ │ │ │ -
    989
    │ │ │ │ -
    990 MPIDatatypeInformation<V> dataInfo(data);
    │ │ │ │ -
    991 this->template buildInterface<RemoteIndices,T1,T2,MPIDatatypeInformation<V>,send>(*remoteIndices_,sourceFlags, destFlags, dataInfo);
    │ │ │ │ -
    992
    │ │ │ │ -
    993 typedef typename RemoteIndices::RemoteIndexMap::const_iterator const_iterator;
    │ │ │ │ -
    994 const const_iterator end=this->remoteIndices_->end();
    │ │ │ │ -
    995
    │ │ │ │ -
    996 // Allocate MPI_Datatypes and deallocate memory for the type construction.
    │ │ │ │ -
    997 for(const_iterator process=this->remoteIndices_->begin(); process != end; ++process) {
    │ │ │ │ -
    998 IndexedTypeInformation& info=dataInfo.information_[process->first];
    │ │ │ │ -
    999 // Shift the displacement
    │ │ │ │ -
    1000 MPI_Aint base;
    │ │ │ │ -
    1001 MPI_Get_address(const_cast<void *>(CommPolicy<V>::getAddress(data, 0)), &base);
    │ │ │ │ -
    1002
    │ │ │ │ -
    1003 for(int i=0; i< info.elements; i++) {
    │ │ │ │ -
    1004 info.displ[i]-=base;
    │ │ │ │ -
    1005 }
    │ │ │ │ -
    1006
    │ │ │ │ -
    1007 // Create data type
    │ │ │ │ -
    1008 MPI_Datatype* type = &( send ? messageTypes[process->first].first : messageTypes[process->first].second);
    │ │ │ │ -
    1009 MPI_Type_create_hindexed(info.elements, info.length, info.displ,
    │ │ │ │ -
    1010 MPITraits<typename CommPolicy<V>::IndexedType>::getType(), type);
    │ │ │ │ -
    1011 MPI_Type_commit(type);
    │ │ │ │ -
    1012 // Deallocate memory
    │ │ │ │ -
    1013 info.free();
    │ │ │ │ -
    1014 }
    │ │ │ │ -
    1015 }
    │ │ │ │ -
    1016
    │ │ │ │ -
    1017 template<typename T>
    │ │ │ │ -
    1018 template<class V, bool createForward>
    │ │ │ │ -
    1019 void DatatypeCommunicator<T>::createRequests(V& sendData, V& receiveData)
    │ │ │ │ -
    1020 {
    │ │ │ │ -
    1021 typedef std::map<int,std::pair<MPI_Datatype,MPI_Datatype> >::const_iterator MapIterator;
    │ │ │ │ -
    1022 int rank;
    │ │ │ │ -
    1023 static int index = createForward ? 1 : 0;
    │ │ │ │ -
    1024 int noMessages = messageTypes.size();
    │ │ │ │ -
    1025 // allocate request handles
    │ │ │ │ -
    1026 requests_[index] = new MPI_Request[2*noMessages];
    │ │ │ │ -
    1027 const MapIterator end = messageTypes.end();
    │ │ │ │ -
    1028 int request=0;
    │ │ │ │ -
    1029 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    │ │ │ │ -
    1030
    │ │ │ │ -
    1031 // Set up the requests for receiving first
    │ │ │ │ -
    1032 for(MapIterator process = messageTypes.begin(); process != end;
    │ │ │ │ -
    1033 ++process, ++request) {
    │ │ │ │ -
    1034 MPI_Datatype type = createForward ? process->second.second : process->second.first;
    │ │ │ │ -
    1035 void* address = const_cast<void*>(CommPolicy<V>::getAddress(receiveData,0));
    │ │ │ │ -
    1036 MPI_Recv_init(address, 1, type, process->first, commTag_, this->remoteIndices_->communicator(), requests_[index]+request);
    │ │ │ │ -
    1037 }
    │ │ │ │ -
    1038
    │ │ │ │ -
    1039 // And now the send requests
    │ │ │ │ -
    1040
    │ │ │ │ -
    1041 for(MapIterator process = messageTypes.begin(); process != end;
    │ │ │ │ -
    1042 ++process, ++request) {
    │ │ │ │ -
    1043 MPI_Datatype type = createForward ? process->second.first : process->second.second;
    │ │ │ │ -
    1044 void* address = const_cast<void*>(CommPolicy<V>::getAddress(sendData, 0));
    │ │ │ │ -
    1045 MPI_Ssend_init(address, 1, type, process->first, commTag_, this->remoteIndices_->communicator(), requests_[index]+request);
    │ │ │ │ -
    1046 }
    │ │ │ │ -
    1047 }
    │ │ │ │ -
    1048
    │ │ │ │ -
    1049 template<typename T>
    │ │ │ │ -
    1050 void DatatypeCommunicator<T>::forward()
    │ │ │ │ -
    1051 {
    │ │ │ │ -
    1052 sendRecv(requests_[1]);
    │ │ │ │ -
    1053 }
    │ │ │ │ -
    1054
    │ │ │ │ -
    1055 template<typename T>
    │ │ │ │ -
    1056 void DatatypeCommunicator<T>::backward()
    │ │ │ │ -
    1057 {
    │ │ │ │ -
    1058 sendRecv(requests_[0]);
    │ │ │ │ -
    1059 }
    │ │ │ │ -
    1060
    │ │ │ │ -
    1061 template<typename T>
    │ │ │ │ -
    1062 void DatatypeCommunicator<T>::sendRecv(MPI_Request* requests)
    │ │ │ │ -
    1063 {
    │ │ │ │ -
    1064 int noMessages = messageTypes.size();
    │ │ │ │ -
    1065 // Start the receive calls first
    │ │ │ │ -
    1066 MPI_Startall(noMessages, requests);
    │ │ │ │ -
    1067 // Now the send calls
    │ │ │ │ -
    1068 MPI_Startall(noMessages, requests+noMessages);
    │ │ │ │ -
    1069
    │ │ │ │ -
    1070 // Wait for completion of the communication send first then receive
    │ │ │ │ -
    1071 MPI_Status* status=new MPI_Status[2*noMessages];
    │ │ │ │ -
    1072 for(int i=0; i<2*noMessages; i++)
    │ │ │ │ -
    1073 status[i].MPI_ERROR=MPI_SUCCESS;
    │ │ │ │ -
    1074
    │ │ │ │ -
    1075 int send = MPI_Waitall(noMessages, requests+noMessages, status+noMessages);
    │ │ │ │ -
    1076 int receive = MPI_Waitall(noMessages, requests, status);
    │ │ │ │ -
    1077
    │ │ │ │ -
    1078 // Error checks
    │ │ │ │ -
    1079 int success=1, globalSuccess=0;
    │ │ │ │ -
    1080 if(send==MPI_ERR_IN_STATUS) {
    │ │ │ │ -
    1081 int rank;
    │ │ │ │ -
    1082 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank);
    │ │ │ │ -
    1083 std::cerr<<rank<<": Error in sending :"<<std::endl;
    │ │ │ │ -
    1084 // Search for the error
    │ │ │ │ -
    1085 for(int i=noMessages; i< 2*noMessages; i++)
    │ │ │ │ -
    1086 if(status[i].MPI_ERROR!=MPI_SUCCESS) {
    │ │ │ │ -
    1087 char message[300];
    │ │ │ │ -
    1088 int messageLength;
    │ │ │ │ -
    1089 MPI_Error_string(status[i].MPI_ERROR, message, &messageLength);
    │ │ │ │ -
    1090 std::cerr<<" source="<<status[i].MPI_SOURCE<<" message: ";
    │ │ │ │ -
    1091 for(int j = 0; j < messageLength; j++)
    │ │ │ │ -
    1092 std::cout << message[j];
    │ │ │ │ -
    1093 }
    │ │ │ │ -
    1094 std::cerr<<std::endl;
    │ │ │ │ -
    1095 success=0;
    │ │ │ │ -
    1096 }
    │ │ │ │ -
    1097
    │ │ │ │ -
    1098 if(receive==MPI_ERR_IN_STATUS) {
    │ │ │ │ -
    1099 int rank;
    │ │ │ │ -
    1100 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank);
    │ │ │ │ -
    1101 std::cerr<<rank<<": Error in receiving!"<<std::endl;
    │ │ │ │ -
    1102 // Search for the error
    │ │ │ │ -
    1103 for(int i=0; i< noMessages; i++)
    │ │ │ │ -
    1104 if(status[i].MPI_ERROR!=MPI_SUCCESS) {
    │ │ │ │ -
    1105 char message[300];
    │ │ │ │ -
    1106 int messageLength;
    │ │ │ │ -
    1107 MPI_Error_string(status[i].MPI_ERROR, message, &messageLength);
    │ │ │ │ -
    1108 std::cerr<<" source="<<status[i].MPI_SOURCE<<" message: ";
    │ │ │ │ -
    1109 for(int j = 0; j < messageLength; j++)
    │ │ │ │ -
    1110 std::cerr << message[j];
    │ │ │ │ -
    1111 }
    │ │ │ │ -
    1112 std::cerr<<std::endl;
    │ │ │ │ -
    1113 success=0;
    │ │ │ │ -
    1114 }
    │ │ │ │ -
    1115
    │ │ │ │ -
    1116 MPI_Allreduce(&success, &globalSuccess, 1, MPI_INT, MPI_MIN, this->remoteIndices_->communicator());
    │ │ │ │ -
    1117
    │ │ │ │ -
    1118 delete[] status;
    │ │ │ │ -
    1119
    │ │ │ │ -
    1120 if(!globalSuccess)
    │ │ │ │ -
    1121 DUNE_THROW(CommunicationError, "A communication error occurred!");
    │ │ │ │ -
    1122
    │ │ │ │ -
    1123 }
    │ │ │ │ -
    1124
    │ │ │ │ - │ │ │ │ -
    1126 {
    │ │ │ │ -
    1127 buffers_[0]=0;
    │ │ │ │ -
    1128 buffers_[1]=0;
    │ │ │ │ -
    1129 bufferSize_[0]=0;
    │ │ │ │ -
    1130 bufferSize_[1]=0;
    │ │ │ │ -
    1131 }
    │ │ │ │ -
    1132
    │ │ │ │ -
    1133 template<class Data, class Interface>
    │ │ │ │ -
    1134 typename std::enable_if<std::is_same<SizeOne, typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type
    │ │ │ │ -
    1135 BufferedCommunicator::build(const Interface& interface)
    │ │ │ │ -
    1136 {
    │ │ │ │ -
    1137 interfaces_=interface.interfaces();
    │ │ │ │ -
    1138 communicator_=interface.communicator();
    │ │ │ │ -
    1139 typedef typename std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
    │ │ │ │ -
    1140 ::const_iterator const_iterator;
    │ │ │ │ -
    1141 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
    │ │ │ │ -
    1142 const const_iterator end = interfaces_.end();
    │ │ │ │ -
    1143 int lrank;
    │ │ │ │ -
    1144 MPI_Comm_rank(communicator_, &lrank);
    │ │ │ │ -
    1145
    │ │ │ │ -
    1146 bufferSize_[0]=0;
    │ │ │ │ -
    1147 bufferSize_[1]=0;
    │ │ │ │ -
    1148
    │ │ │ │ -
    1149 for(const_iterator interfacePair = interfaces_.begin();
    │ │ │ │ -
    1150 interfacePair != end; ++interfacePair) {
    │ │ │ │ -
    1151 int noSend = MessageSizeCalculator<Data,Flag>() (interfacePair->second.first);
    │ │ │ │ -
    1152 int noRecv = MessageSizeCalculator<Data,Flag>() (interfacePair->second.second);
    │ │ │ │ -
    1153 if (noSend + noRecv > 0)
    │ │ │ │ -
    1154 messageInformation_.insert(std::make_pair(interfacePair->first,
    │ │ │ │ -
    1155 std::make_pair(MessageInformation(bufferSize_[0],
    │ │ │ │ -
    1156 noSend*sizeof(typename CommPolicy<Data>::IndexedType)),
    │ │ │ │ -
    1157 MessageInformation(bufferSize_[1],
    │ │ │ │ -
    1158 noRecv*sizeof(typename CommPolicy<Data>::IndexedType)))));
    │ │ │ │ -
    1159 bufferSize_[0] += noSend;
    │ │ │ │ -
    1160 bufferSize_[1] += noRecv;
    │ │ │ │ -
    1161 }
    │ │ │ │ -
    1162
    │ │ │ │ -
    1163 // allocate the buffers
    │ │ │ │ -
    1164 bufferSize_[0] *= sizeof(typename CommPolicy<Data>::IndexedType);
    │ │ │ │ -
    1165 bufferSize_[1] *= sizeof(typename CommPolicy<Data>::IndexedType);
    │ │ │ │ -
    1166
    │ │ │ │ -
    1167 buffers_[0] = new char[bufferSize_[0]];
    │ │ │ │ -
    1168 buffers_[1] = new char[bufferSize_[1]];
    │ │ │ │ -
    1169 }
    │ │ │ │ -
    1170
    │ │ │ │ -
    1171 template<class Data, class Interface>
    │ │ │ │ -
    1172 void BufferedCommunicator::build(const Data& source, const Data& dest, const Interface& interface)
    │ │ │ │ -
    1173 {
    │ │ │ │ -
    1174
    │ │ │ │ -
    1175 interfaces_=interface.interfaces();
    │ │ │ │ -
    1176 communicator_=interface.communicator();
    │ │ │ │ -
    1177 typedef typename std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
    │ │ │ │ -
    1178 ::const_iterator const_iterator;
    │ │ │ │ -
    1179 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
    │ │ │ │ -
    1180 const const_iterator end = interfaces_.end();
    │ │ │ │ -
    1181
    │ │ │ │ -
    1182 bufferSize_[0]=0;
    │ │ │ │ -
    1183 bufferSize_[1]=0;
    │ │ │ │ -
    1184
    │ │ │ │ -
    1185 for(const_iterator interfacePair = interfaces_.begin();
    │ │ │ │ -
    1186 interfacePair != end; ++interfacePair) {
    │ │ │ │ -
    1187 int noSend = MessageSizeCalculator<Data,Flag>() (source, interfacePair->second.first);
    │ │ │ │ -
    1188 int noRecv = MessageSizeCalculator<Data,Flag>() (dest, interfacePair->second.second);
    │ │ │ │ -
    1189 if (noSend + noRecv > 0)
    │ │ │ │ -
    1190 messageInformation_.insert(std::make_pair(interfacePair->first,
    │ │ │ │ -
    1191 std::make_pair(MessageInformation(bufferSize_[0],
    │ │ │ │ -
    1192 noSend*sizeof(typename CommPolicy<Data>::IndexedType)),
    │ │ │ │ -
    1193 MessageInformation(bufferSize_[1],
    │ │ │ │ -
    1194 noRecv*sizeof(typename CommPolicy<Data>::IndexedType)))));
    │ │ │ │ -
    1195 bufferSize_[0] += noSend;
    │ │ │ │ -
    1196 bufferSize_[1] += noRecv;
    │ │ │ │ -
    1197 }
    │ │ │ │ -
    1198
    │ │ │ │ -
    1199 bufferSize_[0] *= sizeof(typename CommPolicy<Data>::IndexedType);
    │ │ │ │ -
    1200 bufferSize_[1] *= sizeof(typename CommPolicy<Data>::IndexedType);
    │ │ │ │ -
    1201 // allocate the buffers
    │ │ │ │ -
    1202 buffers_[0] = new char[bufferSize_[0]];
    │ │ │ │ -
    1203 buffers_[1] = new char[bufferSize_[1]];
    │ │ │ │ -
    1204 }
    │ │ │ │ -
    1205
    │ │ │ │ -
    1206 inline void BufferedCommunicator::free()
    │ │ │ │ -
    1207 {
    │ │ │ │ -
    1208 messageInformation_.clear();
    │ │ │ │ -
    1209 if(buffers_[0])
    │ │ │ │ -
    1210 delete[] buffers_[0];
    │ │ │ │ -
    1211
    │ │ │ │ -
    1212 if(buffers_[1])
    │ │ │ │ -
    1213 delete[] buffers_[1];
    │ │ │ │ -
    1214 buffers_[0]=buffers_[1]=0;
    │ │ │ │ -
    1215 }
    │ │ │ │ -
    1216
    │ │ │ │ - │ │ │ │ -
    1218 {
    │ │ │ │ -
    1219 free();
    │ │ │ │ -
    1220 }
    │ │ │ │ -
    1221
    │ │ │ │ -
    1222 template<class Data>
    │ │ │ │ -
    1223 inline int BufferedCommunicator::MessageSizeCalculator<Data,SizeOne>::operator()
    │ │ │ │ -
    1224 (const InterfaceInformation& info) const
    │ │ │ │ -
    1225 {
    │ │ │ │ -
    1226 return info.size();
    │ │ │ │ -
    1227 }
    │ │ │ │ -
    1228
    │ │ │ │ -
    1229
    │ │ │ │ -
    1230 template<class Data>
    │ │ │ │ -
    1231 inline int BufferedCommunicator::MessageSizeCalculator<Data,SizeOne>::operator()
    │ │ │ │ -
    1232 (const Data&, const InterfaceInformation& info) const
    │ │ │ │ -
    1233 {
    │ │ │ │ -
    1234 return operator()(info);
    │ │ │ │ -
    1235 }
    │ │ │ │ -
    1236
    │ │ │ │ -
    1237
    │ │ │ │ -
    1238 template<class Data>
    │ │ │ │ -
    1239 inline int BufferedCommunicator::MessageSizeCalculator<Data, VariableSize>::operator()
    │ │ │ │ -
    1240 (const Data& data, const InterfaceInformation& info) const
    │ │ │ │ -
    1241 {
    │ │ │ │ -
    1242 int entries=0;
    │ │ │ │ -
    1243
    │ │ │ │ -
    1244 for(size_t i=0; i < info.size(); i++)
    │ │ │ │ -
    1245 entries += CommPolicy<Data>::getSize(data,info[i]);
    │ │ │ │ -
    1246
    │ │ │ │ -
    1247 return entries;
    │ │ │ │ -
    1248 }
    │ │ │ │ -
    1249
    │ │ │ │ -
    1250
    │ │ │ │ -
    1251 template<class Data, class GatherScatter, bool FORWARD>
    │ │ │ │ -
    1252 inline void BufferedCommunicator::MessageGatherer<Data,GatherScatter,FORWARD,VariableSize>::operator()(const InterfaceMap& interfaces,const Data& data, Type* buffer, [[maybe_unused]] size_t bufferSize) const
    │ │ │ │ -
    1253 {
    │ │ │ │ -
    1254 typedef typename InterfaceMap::const_iterator
    │ │ │ │ -
    1255 const_iterator;
    │ │ │ │ -
    1256
    │ │ │ │ -
    1257 int rank;
    │ │ │ │ -
    1258 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    │ │ │ │ -
    1259 const const_iterator end = interfaces.end();
    │ │ │ │ -
    1260 size_t index=0;
    │ │ │ │ -
    1261
    │ │ │ │ -
    1262 for(const_iterator interfacePair = interfaces.begin();
    │ │ │ │ -
    1263 interfacePair != end; ++interfacePair) {
    │ │ │ │ -
    1264 int size = forward ? interfacePair->second.first.size() :
    │ │ │ │ -
    1265 interfacePair->second.second.size();
    │ │ │ │ -
    1266
    │ │ │ │ -
    1267 for(int i=0; i < size; i++) {
    │ │ │ │ -
    1268 int local = forward ? interfacePair->second.first[i] :
    │ │ │ │ -
    1269 interfacePair->second.second[i];
    │ │ │ │ -
    1270 for(std::size_t j=0; j < CommPolicy<Data>::getSize(data, local); j++, index++) {
    │ │ │ │ -
    1271
    │ │ │ │ -
    1272#ifdef DUNE_ISTL_WITH_CHECKING
    │ │ │ │ -
    1273 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy<Data>::IndexedType));
    │ │ │ │ -
    1274#endif
    │ │ │ │ -
    1275 buffer[index]=GatherScatter::gather(data, local, j);
    │ │ │ │ -
    1276 }
    │ │ │ │ -
    1277
    │ │ │ │ -
    1278 }
    │ │ │ │ -
    1279 }
    │ │ │ │ -
    1280
    │ │ │ │ -
    1281 }
    │ │ │ │ -
    1282
    │ │ │ │ -
    1283
    │ │ │ │ -
    1284 template<class Data, class GatherScatter, bool FORWARD>
    │ │ │ │ -
    1285 inline void BufferedCommunicator::MessageGatherer<Data,GatherScatter,FORWARD,SizeOne>::operator()(
    │ │ │ │ -
    1286 const InterfaceMap& interfaces, const Data& data, Type* buffer, [[maybe_unused]] size_t bufferSize) const
    │ │ │ │ -
    1287 {
    │ │ │ │ -
    1288 typedef typename InterfaceMap::const_iterator
    │ │ │ │ -
    1289 const_iterator;
    │ │ │ │ -
    1290 const const_iterator end = interfaces.end();
    │ │ │ │ -
    1291 size_t index = 0;
    │ │ │ │ -
    1292
    │ │ │ │ -
    1293 int rank;
    │ │ │ │ -
    1294 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    │ │ │ │ -
    1295
    │ │ │ │ -
    1296 for(const_iterator interfacePair = interfaces.begin();
    │ │ │ │ -
    1297 interfacePair != end; ++interfacePair) {
    │ │ │ │ -
    1298 size_t size = FORWARD ? interfacePair->second.first.size() :
    │ │ │ │ -
    1299 interfacePair->second.second.size();
    │ │ │ │ -
    1300
    │ │ │ │ -
    1301 for(size_t i=0; i < size; i++) {
    │ │ │ │ -
    1302
    │ │ │ │ -
    1303#ifdef DUNE_ISTL_WITH_CHECKING
    │ │ │ │ -
    1304 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy<Data>::IndexedType));
    │ │ │ │ -
    1305#endif
    │ │ │ │ -
    1306
    │ │ │ │ -
    1307 buffer[index++] = GatherScatter::gather(data, FORWARD ? interfacePair->second.first[i] :
    │ │ │ │ -
    1308 interfacePair->second.second[i]);
    │ │ │ │ -
    1309 }
    │ │ │ │ -
    1310 }
    │ │ │ │ -
    1311
    │ │ │ │ -
    1312 }
    │ │ │ │ -
    1313
    │ │ │ │ -
    1314
    │ │ │ │ -
    1315 template<class Data, class GatherScatter, bool FORWARD>
    │ │ │ │ -
    1316 inline void BufferedCommunicator::MessageScatterer<Data,GatherScatter,FORWARD,VariableSize>::operator()(const InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const
    │ │ │ │ -
    1317 {
    │ │ │ │ -
    1318 typedef typename InterfaceMap::value_type::second_type::first_type Information;
    │ │ │ │ -
    1319 const typename InterfaceMap::const_iterator infoPair = interfaces.find(proc);
    │ │ │ │ -
    1320
    │ │ │ │ -
    1321 assert(infoPair!=interfaces.end());
    │ │ │ │ -
    1322
    │ │ │ │ -
    1323 const Information& info = FORWARD ? infoPair->second.second :
    │ │ │ │ -
    1324 infoPair->second.first;
    │ │ │ │ -
    1325
    │ │ │ │ -
    1326 for(size_t i=0, index=0; i < info.size(); i++) {
    │ │ │ │ -
    1327 for(size_t j=0; j < CommPolicy<Data>::getSize(data, info[i]); j++)
    │ │ │ │ -
    1328 GatherScatter::scatter(data, buffer[index++], info[i], j);
    │ │ │ │ -
    1329 }
    │ │ │ │ -
    1330 }
    │ │ │ │ -
    1331
    │ │ │ │ -
    1332
    │ │ │ │ -
    1333 template<class Data, class GatherScatter, bool FORWARD>
    │ │ │ │ -
    1334 inline void BufferedCommunicator::MessageScatterer<Data,GatherScatter,FORWARD,SizeOne>::operator()(const InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const
    │ │ │ │ -
    1335 {
    │ │ │ │ -
    1336 typedef typename InterfaceMap::value_type::second_type::first_type Information;
    │ │ │ │ -
    1337 const typename InterfaceMap::const_iterator infoPair = interfaces.find(proc);
    │ │ │ │ -
    1338
    │ │ │ │ -
    1339 assert(infoPair!=interfaces.end());
    │ │ │ │ -
    1340
    │ │ │ │ -
    1341 const Information& info = FORWARD ? infoPair->second.second :
    │ │ │ │ -
    1342 infoPair->second.first;
    │ │ │ │ -
    1343
    │ │ │ │ -
    1344 for(size_t i=0; i < info.size(); i++) {
    │ │ │ │ -
    1345 GatherScatter::scatter(data, buffer[i], info[i]);
    │ │ │ │ -
    1346 }
    │ │ │ │ -
    1347 }
    │ │ │ │ -
    1348
    │ │ │ │ -
    1349
    │ │ │ │ -
    1350 template<class GatherScatter,class Data>
    │ │ │ │ -
    1351 void BufferedCommunicator::forward(Data& data)
    │ │ │ │ -
    1352 {
    │ │ │ │ -
    1353 this->template sendRecv<GatherScatter,true>(data, data);
    │ │ │ │ -
    1354 }
    │ │ │ │ -
    1355
    │ │ │ │ -
    1356
    │ │ │ │ -
    1357 template<class GatherScatter, class Data>
    │ │ │ │ -
    1358 void BufferedCommunicator::backward(Data& data)
    │ │ │ │ -
    1359 {
    │ │ │ │ -
    1360 this->template sendRecv<GatherScatter,false>(data, data);
    │ │ │ │ -
    1361 }
    │ │ │ │ -
    1362
    │ │ │ │ -
    1363
    │ │ │ │ -
    1364 template<class GatherScatter, class Data>
    │ │ │ │ -
    1365 void BufferedCommunicator::forward(const Data& source, Data& dest)
    │ │ │ │ -
    1366 {
    │ │ │ │ -
    1367 this->template sendRecv<GatherScatter,true>(source, dest);
    │ │ │ │ -
    1368 }
    │ │ │ │ -
    1369
    │ │ │ │ -
    1370
    │ │ │ │ -
    1371 template<class GatherScatter, class Data>
    │ │ │ │ -
    1372 void BufferedCommunicator::backward(Data& source, const Data& dest)
    │ │ │ │ -
    1373 {
    │ │ │ │ -
    1374 this->template sendRecv<GatherScatter,false>(dest, source);
    │ │ │ │ -
    1375 }
    │ │ │ │ -
    1376
    │ │ │ │ -
    1377
    │ │ │ │ -
    1378 template<class GatherScatter, bool FORWARD, class Data>
    │ │ │ │ -
    1379 void BufferedCommunicator::sendRecv(const Data& source, Data& dest)
    │ │ │ │ -
    1380 {
    │ │ │ │ -
    1381 int rank, lrank;
    │ │ │ │ -
    1382
    │ │ │ │ -
    1383 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
    │ │ │ │ -
    1384 MPI_Comm_rank(MPI_COMM_WORLD,&lrank);
    │ │ │ │ -
    1385
    │ │ │ │ -
    1386 typedef typename CommPolicy<Data>::IndexedType Type;
    │ │ │ │ -
    1387 Type *sendBuffer, *recvBuffer;
    │ │ │ │ -
    1388 size_t sendBufferSize;
    │ │ │ │ -
    1389#ifndef NDEBUG
    │ │ │ │ -
    1390 size_t recvBufferSize;
    │ │ │ │ -
    1391#endif
    │ │ │ │ -
    1392
    │ │ │ │ -
    1393 if(FORWARD) {
    │ │ │ │ -
    1394 sendBuffer = reinterpret_cast<Type*>(buffers_[0]);
    │ │ │ │ -
    1395 sendBufferSize = bufferSize_[0];
    │ │ │ │ -
    1396 recvBuffer = reinterpret_cast<Type*>(buffers_[1]);
    │ │ │ │ -
    1397#ifndef NDEBUG
    │ │ │ │ -
    1398 recvBufferSize = bufferSize_[1];
    │ │ │ │ -
    1399#endif
    │ │ │ │ -
    1400 }else{
    │ │ │ │ -
    1401 sendBuffer = reinterpret_cast<Type*>(buffers_[1]);
    │ │ │ │ -
    1402 sendBufferSize = bufferSize_[1];
    │ │ │ │ -
    1403 recvBuffer = reinterpret_cast<Type*>(buffers_[0]);
    │ │ │ │ -
    1404#ifndef NDEBUG
    │ │ │ │ -
    1405 recvBufferSize = bufferSize_[0];
    │ │ │ │ -
    1406#endif
    │ │ │ │ -
    1407 }
    │ │ │ │ -
    1408 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
    │ │ │ │ -
    1409
    │ │ │ │ -
    1410 MessageGatherer<Data,GatherScatter,FORWARD,Flag>() (interfaces_, source, sendBuffer, sendBufferSize);
    │ │ │ │ -
    1411
    │ │ │ │ -
    1412 MPI_Request* sendRequests = new MPI_Request[messageInformation_.size()];
    │ │ │ │ -
    1413 MPI_Request* recvRequests = new MPI_Request[messageInformation_.size()];
    │ │ │ │ -
    1414 /* Number of recvRequests that are not MPI_REQUEST_NULL */
    │ │ │ │ -
    1415 size_t numberOfRealRecvRequests = 0;
    │ │ │ │ -
    1416
    │ │ │ │ -
    1417 // Setup receive first
    │ │ │ │ -
    1418 typedef typename InformationMap::const_iterator const_iterator;
    │ │ │ │ -
    1419
    │ │ │ │ -
    1420 const const_iterator end = messageInformation_.end();
    │ │ │ │ -
    1421 size_t i=0;
    │ │ │ │ -
    1422 int* processMap = new int[messageInformation_.size()];
    │ │ │ │ -
    1423
    │ │ │ │ -
    1424 for(const_iterator info = messageInformation_.begin(); info != end; ++info, ++i) {
    │ │ │ │ -
    1425 processMap[i]=info->first;
    │ │ │ │ -
    1426 if(FORWARD) {
    │ │ │ │ -
    1427 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
    │ │ │ │ -
    1428 Dune::dvverb<<rank<<": receiving "<<info->second.second.size_<<" from "<<info->first<<std::endl;
    │ │ │ │ -
    1429 if(info->second.second.size_) {
    │ │ │ │ -
    1430 MPI_Irecv(recvBuffer+info->second.second.start_, info->second.second.size_,
    │ │ │ │ -
    1431 MPI_BYTE, info->first, commTag_, communicator_,
    │ │ │ │ -
    1432 recvRequests+i);
    │ │ │ │ -
    1433 numberOfRealRecvRequests += 1;
    │ │ │ │ -
    1434 } else {
    │ │ │ │ -
    1435 // Nothing to receive -> set request to inactive
    │ │ │ │ -
    1436 recvRequests[i]=MPI_REQUEST_NULL;
    │ │ │ │ -
    1437 }
    │ │ │ │ -
    1438 }else{
    │ │ │ │ -
    1439 assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= recvBufferSize );
    │ │ │ │ -
    1440 Dune::dvverb<<rank<<": receiving "<<info->second.first.size_<<" to "<<info->first<<std::endl;
    │ │ │ │ -
    1441 if(info->second.first.size_) {
    │ │ │ │ -
    1442 MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_,
    │ │ │ │ -
    1443 MPI_BYTE, info->first, commTag_, communicator_,
    │ │ │ │ -
    1444 recvRequests+i);
    │ │ │ │ -
    1445 numberOfRealRecvRequests += 1;
    │ │ │ │ -
    1446 } else {
    │ │ │ │ -
    1447 // Nothing to receive -> set request to inactive
    │ │ │ │ -
    1448 recvRequests[i]=MPI_REQUEST_NULL;
    │ │ │ │ -
    1449 }
    │ │ │ │ -
    1450 }
    │ │ │ │ -
    1451 }
    │ │ │ │ -
    1452
    │ │ │ │ -
    1453 // now the send requests
    │ │ │ │ -
    1454 i=0;
    │ │ │ │ -
    1455 for(const_iterator info = messageInformation_.begin(); info != end; ++info, ++i)
    │ │ │ │ -
    1456 if(FORWARD) {
    │ │ │ │ -
    1457 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
    │ │ │ │ -
    1458 Dune::dvverb<<rank<<": sending "<<info->second.first.size_<<" to "<<info->first<<std::endl;
    │ │ │ │ -
    1459 assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= sendBufferSize );
    │ │ │ │ -
    1460 if(info->second.first.size_)
    │ │ │ │ -
    1461 MPI_Issend(sendBuffer+info->second.first.start_, info->second.first.size_,
    │ │ │ │ -
    1462 MPI_BYTE, info->first, commTag_, communicator_,
    │ │ │ │ -
    1463 sendRequests+i);
    │ │ │ │ -
    1464 else
    │ │ │ │ -
    1465 // Nothing to send -> set request to inactive
    │ │ │ │ -
    1466 sendRequests[i]=MPI_REQUEST_NULL;
    │ │ │ │ -
    1467 }else{
    │ │ │ │ -
    1468 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= sendBufferSize );
    │ │ │ │ -
    1469 Dune::dvverb<<rank<<": sending "<<info->second.second.size_<<" to "<<info->first<<std::endl;
    │ │ │ │ -
    1470 if(info->second.second.size_)
    │ │ │ │ -
    1471 MPI_Issend(sendBuffer+info->second.second.start_, info->second.second.size_,
    │ │ │ │ -
    1472 MPI_BYTE, info->first, commTag_, communicator_,
    │ │ │ │ -
    1473 sendRequests+i);
    │ │ │ │ -
    1474 else
    │ │ │ │ -
    1475 // Nothing to send -> set request to inactive
    │ │ │ │ -
    1476 sendRequests[i]=MPI_REQUEST_NULL;
    │ │ │ │ -
    1477 }
    │ │ │ │ -
    1478
    │ │ │ │ -
    1479 // Wait for completion of receive and immediately start scatter
    │ │ │ │ -
    1480 i=0;
    │ │ │ │ -
    1481 //int success = 1;
    │ │ │ │ -
    1482 int finished = MPI_UNDEFINED;
    │ │ │ │ -
    1483 MPI_Status status; //[messageInformation_.size()];
    │ │ │ │ -
    1484 //MPI_Waitall(messageInformation_.size(), recvRequests, status);
    │ │ │ │ -
    1485
    │ │ │ │ -
    1486 for(i=0; i< numberOfRealRecvRequests; i++) {
    │ │ │ │ -
    1487 status.MPI_ERROR=MPI_SUCCESS;
    │ │ │ │ -
    1488 MPI_Waitany(messageInformation_.size(), recvRequests, &finished, &status);
    │ │ │ │ -
    1489 assert(finished != MPI_UNDEFINED);
    │ │ │ │ -
    1490
    │ │ │ │ -
    1491 if(status.MPI_ERROR==MPI_SUCCESS) {
    │ │ │ │ -
    1492 int& proc = processMap[finished];
    │ │ │ │ -
    1493 typename InformationMap::const_iterator infoIter = messageInformation_.find(proc);
    │ │ │ │ -
    1494 assert(infoIter != messageInformation_.end());
    │ │ │ │ -
    1495
    │ │ │ │ -
    1496 MessageInformation info = (FORWARD) ? infoIter->second.second : infoIter->second.first;
    │ │ │ │ -
    1497 assert(info.start_+info.size_ <= recvBufferSize);
    │ │ │ │ -
    1498
    │ │ │ │ -
    1499 MessageScatterer<Data,GatherScatter,FORWARD,Flag>() (interfaces_, dest, recvBuffer+info.start_, proc);
    │ │ │ │ -
    1500 }else{
    │ │ │ │ -
    1501 std::cerr<<rank<<": MPI_Error occurred while receiving message from "<<processMap[finished]<<std::endl;
    │ │ │ │ -
    1502 //success=0;
    │ │ │ │ -
    1503 }
    │ │ │ │ -
    1504 }
    │ │ │ │ -
    1505
    │ │ │ │ -
    1506 MPI_Status recvStatus;
    │ │ │ │ -
    1507
    │ │ │ │ -
    1508 // Wait for completion of sends
    │ │ │ │ -
    1509 for(i=0; i< messageInformation_.size(); i++)
    │ │ │ │ -
    1510 if(MPI_SUCCESS!=MPI_Wait(sendRequests+i, &recvStatus)) {
    │ │ │ │ -
    1511 std::cerr<<rank<<": MPI_Error occurred while sending message to "<<processMap[finished]<<std::endl;
    │ │ │ │ -
    1512 //success=0;
    │ │ │ │ -
    1513 }
    │ │ │ │ -
    1514 /*
    │ │ │ │ -
    1515 int globalSuccess;
    │ │ │ │ -
    1516 MPI_Allreduce(&success, &globalSuccess, 1, MPI_INT, MPI_MIN, interface_->communicator());
    │ │ │ │ -
    1517
    │ │ │ │ -
    1518 if(!globalSuccess)
    │ │ │ │ -
    1519 DUNE_THROW(CommunicationError, "A communication error occurred!");
    │ │ │ │ -
    1520 */
    │ │ │ │ -
    1521 delete[] processMap;
    │ │ │ │ -
    1522 delete[] sendRequests;
    │ │ │ │ -
    1523 delete[] recvRequests;
    │ │ │ │ -
    1524
    │ │ │ │ -
    1525 }
    │ │ │ │ -
    1526
    │ │ │ │ -
    1527#endif // DOXYGEN
    │ │ │ │ -
    1528
    │ │ │ │ -
    1530}
    │ │ │ │ -
    1531
    │ │ │ │ -
    1532#endif // HAVE_MPI
    │ │ │ │ -
    1533
    │ │ │ │ -
    1534#endif
    │ │ │ │ -
    Classes describing a distributed indexset.
    │ │ │ │ -
    Standard Dune debug streams.
    │ │ │ │ -
    A few common exception classes.
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ -
    DVVerbType dvverb(std::cout)
    stream for very verbose output.
    Definition stdstreams.hh:95
    │ │ │ │ +
    23namespace Dune
    │ │ │ │ +
    24{
    │ │ │ │ +
    25
    │ │ │ │ +
    26
    │ │ │ │ +
    27
    │ │ │ │ +
    33template<class... T>
    │ │ │ │ +
    │ │ │ │ +
    34class TupleVector : public std::tuple<T...>
    │ │ │ │ +
    35{
    │ │ │ │ +
    36 using Base = std::tuple<T...>;
    │ │ │ │ +
    37
    │ │ │ │ +
    38 template<class... TT>
    │ │ │ │ +
    39 using TupleConstructorDetector = decltype(Base(std::declval<TT&&>()...));
    │ │ │ │ +
    40
    │ │ │ │ +
    41 template<class... TT>
    │ │ │ │ +
    42 using hasTupleConstructor = Dune::Std::is_detected<TupleConstructorDetector, TT...>;
    │ │ │ │ +
    43
    │ │ │ │ +
    44
    │ │ │ │ +
    45public:
    │ │ │ │ +
    46
    │ │ │ │ +
    53 template<class... TT,
    │ │ │ │ +
    54 std::enable_if_t<hasTupleConstructor<TT...>::value, int> = 0>
    │ │ │ │ +
    │ │ │ │ +
    55 constexpr TupleVector(TT&&... tt) :
    │ │ │ │ +
    56 Base(std::forward<TT>(tt)...)
    │ │ │ │ +
    57 {}
    │ │ │ │ +
    │ │ │ │ +
    58
    │ │ │ │ +
    │ │ │ │ +
    61 constexpr TupleVector()
    │ │ │ │ +
    62 {}
    │ │ │ │ +
    │ │ │ │ +
    63
    │ │ │ │ +
    66 template<std::size_t i>
    │ │ │ │ +
    │ │ │ │ +
    67 constexpr decltype(auto) operator[](const Dune::index_constant<i>&) const
    │ │ │ │ +
    68 {
    │ │ │ │ +
    69 return std::get<i>(*this);
    │ │ │ │ +
    70 }
    │ │ │ │ +
    │ │ │ │ +
    71
    │ │ │ │ +
    74 template<std::size_t i>
    │ │ │ │ +
    │ │ │ │ +
    75 decltype(auto) operator[](const Dune::index_constant<i>&)
    │ │ │ │ +
    76 {
    │ │ │ │ +
    77 return std::get<i>(*this);
    │ │ │ │ +
    78 }
    │ │ │ │ +
    │ │ │ │ +
    79
    │ │ │ │ +
    │ │ │ │ +
    81 static constexpr std::size_t size()
    │ │ │ │ +
    82 {
    │ │ │ │ +
    83 return std::tuple_size<Base>::value;
    │ │ │ │ +
    84 }
    │ │ │ │ +
    │ │ │ │ +
    85};
    │ │ │ │ +
    │ │ │ │ +
    86
    │ │ │ │ +
    87
    │ │ │ │ +
    88
    │ │ │ │ +
    89template<class... T>
    │ │ │ │ +
    │ │ │ │ +
    90constexpr auto makeTupleVector(T&&... t)
    │ │ │ │ +
    91{
    │ │ │ │ +
    92 // The std::decay_t<T> is is a slight simplification,
    │ │ │ │ +
    93 // because std::reference_wrapper needs special care.
    │ │ │ │ +
    94 return TupleVector<std::decay_t<T>...>(std::forward<T>(t)...);
    │ │ │ │ +
    95}
    │ │ │ │ +
    │ │ │ │ +
    96
    │ │ │ │ +
    97
    │ │ │ │ +
    98
    │ │ │ │ +
    99} // namespace Dune
    │ │ │ │ +
    100
    │ │ │ │ +
    101#endif // DUNE_COMMON_TUPLEVECTOR_HH
    │ │ │ │ + │ │ │ │ + │ │ │ │ +
    Traits for type conversions and type information.
    │ │ │ │ +
    std::integral_constant< std::size_t, i > index_constant
    An index constant with value i.
    Definition indices.hh:30
    │ │ │ │ +
    typename detected_or< nonesuch, Op, Args... >::value_t is_detected
    Detects whether Op<Args...> is valid.
    Definition type_traits.hh:141
    │ │ │ │ +
    STL namespace.
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Default exception class for I/O errors.
    Definition exceptions.hh:231
    │ │ │ │ -
    Flag for marking indexed data structures where data at each index is of the same size.
    Definition communicator.hh:110
    │ │ │ │ -
    Flag for marking indexed data structures where the data at each index may be a variable multiple of a...
    Definition communicator.hh:118
    │ │ │ │ -
    Default policy used for communicating an indexed type.
    Definition communicator.hh:128
    │ │ │ │ -
    V::value_type IndexedType
    The type we get at each index with operator[].
    Definition communicator.hh:147
    │ │ │ │ -
    static int getSize(const V &, int index)
    Get the number of primitive elements at that index.
    │ │ │ │ -
    SizeOne IndexedTypeFlag
    Whether the indexed type has variable size or there is always one value at each index.
    Definition communicator.hh:153
    │ │ │ │ -
    static const void * getAddress(const V &v, int index)
    Get the address of entry at an index.
    │ │ │ │ -
    V Type
    The type the policy is for.
    Definition communicator.hh:140
    │ │ │ │ -
    Definition communicator.hh:173
    │ │ │ │ -
    Definition communicator.hh:175
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    VariableBlockVector< FieldVector< K, n >, A > Type
    Definition communicator.hh:180
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    Error thrown if there was a problem with the communication.
    Definition communicator.hh:195
    │ │ │ │ -
    GatherScatter default implementation that just copies data.
    Definition communicator.hh:202
    │ │ │ │ -
    static void scatter(T &vec, const IndexedType &v, std::size_t i)
    │ │ │ │ -
    CommPolicy< T >::IndexedType IndexedType
    Definition communicator.hh:203
    │ │ │ │ -
    static const IndexedType & gather(const T &vec, std::size_t i)
    │ │ │ │ -
    A communicator that uses buffers to gather and scatter the data to be send or received.
    Definition communicator.hh:458
    │ │ │ │ -
    void backward(Data &data)
    Backward send where target and source are the same.
    │ │ │ │ -
    BufferedCommunicator()
    Constructor.
    │ │ │ │ -
    ~BufferedCommunicator()
    Destructor.
    │ │ │ │ -
    void forward(const Data &source, Data &dest)
    Send from source to target.
    │ │ │ │ -
    void free()
    Free the allocated memory (i.e. buffers and message information.
    │ │ │ │ -
    std::enable_if< std::is_same< SizeOne, typenameCommPolicy< Data >::IndexedTypeFlag >::value, void >::type build(const Interface &interface)
    Build the buffers and information for the communication process.
    │ │ │ │ -
    void backward(Data &source, const Data &dest)
    Communicate in the reverse direction, i.e. send from target to source.
    │ │ │ │ -
    void build(const Data &source, const Data &target, const Interface &interface)
    Build the buffers and information for the communication process.
    │ │ │ │ -
    void forward(Data &data)
    Forward send where target and source are the same.
    │ │ │ │ -
    Manager class for the mapping between local indices and globally unique indices.
    Definition indexset.hh:218
    │ │ │ │ -
    Base class of all classes representing a communication interface.
    Definition parallel/interface.hh:35
    │ │ │ │ -
    Information describing an interface.
    Definition parallel/interface.hh:101
    │ │ │ │ -
    Communication interface between remote and local indices.
    Definition parallel/interface.hh:209
    │ │ │ │ -
    An index present on the local process.
    Definition localindex.hh:35
    │ │ │ │ -
    The indices present on remote processes.
    Definition remoteindices.hh:189
    │ │ │ │ -
    ParallelIndexSet::GlobalIndex GlobalIndex
    The type of the global index.
    Definition remoteindices.hh:215
    │ │ │ │ -
    LocalIndex::Attribute Attribute
    The type of the attribute.
    Definition remoteindices.hh:226
    │ │ │ │ -
    ParallelIndexSet::LocalIndex LocalIndex
    The type of the local index.
    Definition remoteindices.hh:221
    │ │ │ │ -
    Provides classes for building the communication interface between remote indices.
    │ │ │ │ +
    constexpr auto makeTupleVector(T &&... t)
    Definition tuplevector.hh:90
    │ │ │ │ +
    A class augmenting std::tuple by element access via operator[].
    Definition tuplevector.hh:35
    │ │ │ │ +
    static constexpr std::size_t size()
    Number of elements of the tuple.
    Definition tuplevector.hh:81
    │ │ │ │ +
    constexpr TupleVector(TT &&... tt)
    Construct from a set of arguments.
    Definition tuplevector.hh:55
    │ │ │ │ +
    constexpr TupleVector()
    Default constructor.
    Definition tuplevector.hh:61
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1202 +1,124 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -communicator.hh │ │ │ │ │ +tuplevector.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_COMMUNICATOR │ │ │ │ │ -6#define DUNE_COMMUNICATOR │ │ │ │ │ +5#ifndef DUNE_COMMON_TUPLEVECTOR_HH │ │ │ │ │ +6#define DUNE_COMMON_TUPLEVECTOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#if HAVE_MPI │ │ │ │ │ -9 │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +12#include <_d_u_n_e_/_c_o_m_m_o_n_/_t_y_p_e_t_r_a_i_t_s_._h_h> │ │ │ │ │ +13#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_t_y_p_e___t_r_a_i_t_s_._h_h> │ │ │ │ │ +14 │ │ │ │ │ +15 │ │ │ │ │ 16 │ │ │ │ │ -17#include │ │ │ │ │ -18 │ │ │ │ │ -19#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -20#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_i_n_t_e_r_f_a_c_e_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -22#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ -23 │ │ │ │ │ -24namespace _D_u_n_e │ │ │ │ │ -25{ │ │ │ │ │ -_1_0_9 struct _S_i_z_e_O_n_e │ │ │ │ │ -110 {}; │ │ │ │ │ -111 │ │ │ │ │ -_1_1_7 struct _V_a_r_i_a_b_l_e_S_i_z_e │ │ │ │ │ -118 {}; │ │ │ │ │ -119 │ │ │ │ │ -120 │ │ │ │ │ -126 template │ │ │ │ │ -_1_2_7 struct _C_o_m_m_P_o_l_i_c_y │ │ │ │ │ -128 { │ │ │ │ │ -_1_4_0 typedef V _T_y_p_e; │ │ │ │ │ -141 │ │ │ │ │ -_1_4_7 typedef typename V::value_type _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -148 │ │ │ │ │ -_1_5_3 typedef _S_i_z_e_O_n_e _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ -154 │ │ │ │ │ -_1_6_3 static const void* _g_e_t_A_d_d_r_e_s_s(const V& v, int index); │ │ │ │ │ -164 │ │ │ │ │ -_1_7_0 static int _g_e_t_S_i_z_e(const V&, int index); │ │ │ │ │ -171 }; │ │ │ │ │ -172 │ │ │ │ │ -_1_7_3 template class _F_i_e_l_d_V_e_c_t_o_r; │ │ │ │ │ -174 │ │ │ │ │ -_1_7_5 template class _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r; │ │ │ │ │ -176 │ │ │ │ │ -177 template │ │ │ │ │ -_1_7_8 struct _C_o_m_m_P_o_l_i_c_y<_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r<_F_i_e_l_d_V_e_c_t_o_r, A> > │ │ │ │ │ -179 { │ │ │ │ │ -_1_8_0 typedef _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _n_>, A> _T_y_p_e; │ │ │ │ │ -181 │ │ │ │ │ -_1_8_2 typedef typename Type::B _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -183 │ │ │ │ │ -_1_8_4 typedef _V_a_r_i_a_b_l_e_S_i_z_e _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ -185 │ │ │ │ │ -_1_8_6 static const void* _g_e_t_A_d_d_r_e_s_s(const _T_y_p_e& v, int i); │ │ │ │ │ -187 │ │ │ │ │ -_1_8_8 static int _g_e_t_S_i_z_e(const _T_y_p_e& v, int i); │ │ │ │ │ -189 }; │ │ │ │ │ -190 │ │ │ │ │ -_1_9_4 class _C_o_m_m_u_n_i_c_a_t_i_o_n_E_r_r_o_r : public _I_O_E_r_r_o_r │ │ │ │ │ -195 {}; │ │ │ │ │ -196 │ │ │ │ │ -200 template │ │ │ │ │ -_2_0_1 struct _C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -202 { │ │ │ │ │ -_2_0_3 typedef typename _C_o_m_m_P_o_l_i_c_y_<_T_>_:_:_I_n_d_e_x_e_d_T_y_p_e _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -204 │ │ │ │ │ -_2_0_5 static const _I_n_d_e_x_e_d_T_y_p_e& _g_a_t_h_e_r(const T& vec, std::size_t i); │ │ │ │ │ -206 │ │ │ │ │ -_2_0_7 static void _s_c_a_t_t_e_r(T& vec, const _I_n_d_e_x_e_d_T_y_p_e& v, std::size_t i); │ │ │ │ │ -208 │ │ │ │ │ -209 }; │ │ │ │ │ -210 │ │ │ │ │ -222 template │ │ │ │ │ -223 class DatatypeCommunicator : public _I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r │ │ │ │ │ -224 { │ │ │ │ │ -225 public: │ │ │ │ │ -226 │ │ │ │ │ -230 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -231 │ │ │ │ │ -235 typedef _D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_<_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_> _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ -236 │ │ │ │ │ -240 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_G_l_o_b_a_l_I_n_d_e_x GlobalIndex; │ │ │ │ │ -241 │ │ │ │ │ -245 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_t_t_r_i_b_u_t_e Attribute; │ │ │ │ │ -246 │ │ │ │ │ -250 typedef typename _R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_L_o_c_a_l_I_n_d_e_x _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ -251 │ │ │ │ │ -255 DatatypeCommunicator(); │ │ │ │ │ -256 │ │ │ │ │ -260 ~DatatypeCommunicator(); │ │ │ │ │ -261 │ │ │ │ │ -288 template │ │ │ │ │ -289 void build(const _R_e_m_o_t_e_I_n_d_i_c_e_s& remoteIndices, const T1& sourceFlags, V& │ │ │ │ │ -sendData, const T2& destFlags, V& receiveData); │ │ │ │ │ -290 │ │ │ │ │ -294 void forward(); │ │ │ │ │ -295 │ │ │ │ │ -299 void backward(); │ │ │ │ │ -300 │ │ │ │ │ -304 void free(); │ │ │ │ │ -305 private: │ │ │ │ │ -309 constexpr static int commTag_ = 234; │ │ │ │ │ -310 │ │ │ │ │ -314 const _R_e_m_o_t_e_I_n_d_i_c_e_s* remoteIndices_; │ │ │ │ │ -315 │ │ │ │ │ -316 typedef std::map > │ │ │ │ │ -317 MessageTypeMap; │ │ │ │ │ -318 │ │ │ │ │ -322 MessageTypeMap messageTypes; │ │ │ │ │ -323 │ │ │ │ │ -327 void* data_; │ │ │ │ │ -328 │ │ │ │ │ -329 MPI_Request* requests_[2]; │ │ │ │ │ -330 │ │ │ │ │ -334 bool created_; │ │ │ │ │ -335 │ │ │ │ │ -339 template │ │ │ │ │ -340 void createRequests(V& sendData, V& receiveData); │ │ │ │ │ -341 │ │ │ │ │ -345 template │ │ │ │ │ -346 void createDataTypes(const T1& source, const T2& destination, V& data); │ │ │ │ │ -347 │ │ │ │ │ -351 void sendRecv(MPI_Request* req); │ │ │ │ │ -352 │ │ │ │ │ -356 struct IndexedTypeInformation │ │ │ │ │ -357 { │ │ │ │ │ -363 void build(int i) │ │ │ │ │ -364 { │ │ │ │ │ -365 length = new int[i]; │ │ │ │ │ -366 displ = new MPI_Aint[i]; │ │ │ │ │ -367 size = i; │ │ │ │ │ -368 } │ │ │ │ │ -369 │ │ │ │ │ -373 void free() │ │ │ │ │ -374 { │ │ │ │ │ -375 delete[] length; │ │ │ │ │ -376 delete[] displ; │ │ │ │ │ -377 } │ │ │ │ │ -379 int* length; │ │ │ │ │ -381 MPI_Aint* displ; │ │ │ │ │ -387 int elements; │ │ │ │ │ -391 int size; │ │ │ │ │ -392 }; │ │ │ │ │ -393 │ │ │ │ │ -399 template │ │ │ │ │ -400 struct MPIDatatypeInformation │ │ │ │ │ -401 { │ │ │ │ │ -406 MPIDatatypeInformation(const V& data) : data_(data) │ │ │ │ │ -407 {} │ │ │ │ │ -408 │ │ │ │ │ -414 void reserve(int proc, int size) │ │ │ │ │ -415 { │ │ │ │ │ -416 information_[proc].build(size); │ │ │ │ │ -417 } │ │ │ │ │ -424 void add(int proc, int local) │ │ │ │ │ -425 { │ │ │ │ │ -426 IndexedTypeInformation& info=information_[proc]; │ │ │ │ │ -427 assert((info.elements)(CommPolicy::getAddress(data_, │ │ │ │ │ -local)), │ │ │ │ │ -429 info.displ+info.elements); │ │ │ │ │ -430 info.length[info.elements]=CommPolicy::getSize(data_, local); │ │ │ │ │ -431 info.elements++; │ │ │ │ │ -432 } │ │ │ │ │ -433 │ │ │ │ │ -438 std::map information_; │ │ │ │ │ -442 const V& data_; │ │ │ │ │ -443 │ │ │ │ │ -444 }; │ │ │ │ │ -445 │ │ │ │ │ -446 }; │ │ │ │ │ -447 │ │ │ │ │ -_4_5_7 class _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -458 { │ │ │ │ │ -459 │ │ │ │ │ -460 public: │ │ │ │ │ -_4_6_4 _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ -465 │ │ │ │ │ -472 template │ │ │ │ │ -473 typename std::enable_if:: │ │ │ │ │ -IndexedTypeFlag>::value, void>::type │ │ │ │ │ -_4_7_4 _b_u_i_l_d(const _I_n_t_e_r_f_a_c_e& interface); │ │ │ │ │ -475 │ │ │ │ │ -483 template │ │ │ │ │ -_4_8_4 void _b_u_i_l_d(const Data& source, const Data& target, const _I_n_t_e_r_f_a_c_e& │ │ │ │ │ -interface); │ │ │ │ │ -485 │ │ │ │ │ -514 template │ │ │ │ │ -_5_1_5 void _f_o_r_w_a_r_d(const Data& source, Data& dest); │ │ │ │ │ -516 │ │ │ │ │ -545 template │ │ │ │ │ -_5_4_6 void _b_a_c_k_w_a_r_d(Data& source, const Data& dest); │ │ │ │ │ -547 │ │ │ │ │ -573 template │ │ │ │ │ -_5_7_4 void _f_o_r_w_a_r_d(Data& data); │ │ │ │ │ -575 │ │ │ │ │ -601 template │ │ │ │ │ -_6_0_2 void _b_a_c_k_w_a_r_d(Data& data); │ │ │ │ │ -603 │ │ │ │ │ -_6_0_7 void _f_r_e_e(); │ │ │ │ │ -608 │ │ │ │ │ -_6_1_2 _~_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ -613 │ │ │ │ │ -614 private: │ │ │ │ │ -615 │ │ │ │ │ -619 typedef std::map > │ │ │ │ │ -620 InterfaceMap; │ │ │ │ │ -621 │ │ │ │ │ -622 │ │ │ │ │ -626 template │ │ │ │ │ -627 struct MessageSizeCalculator │ │ │ │ │ -628 {}; │ │ │ │ │ -629 │ │ │ │ │ -634 template │ │ │ │ │ -635 struct MessageSizeCalculator │ │ │ │ │ -636 { │ │ │ │ │ -643 inline int operator()(const _I_n_t_e_r_f_a_c_e_I_n_f_o_r_m_a_t_i_o_n& info) const; │ │ │ │ │ -652 inline int operator()(const Data& data, const _I_n_t_e_r_f_a_c_e_I_n_f_o_r_m_a_t_i_o_n& info) │ │ │ │ │ -const; │ │ │ │ │ -653 }; │ │ │ │ │ -654 │ │ │ │ │ -659 template │ │ │ │ │ -660 struct MessageSizeCalculator │ │ │ │ │ -661 { │ │ │ │ │ -670 inline int operator()(const Data& data, const InterfaceInformation& info) │ │ │ │ │ -const; │ │ │ │ │ -671 }; │ │ │ │ │ -672 │ │ │ │ │ -676 template │ │ │ │ │ -677 struct MessageGatherer │ │ │ │ │ -678 {}; │ │ │ │ │ -679 │ │ │ │ │ -684 template │ │ │ │ │ -685 struct MessageGatherer │ │ │ │ │ -686 { │ │ │ │ │ -688 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ -689 │ │ │ │ │ -694 typedef GatherScatter Gatherer; │ │ │ │ │ -695 │ │ │ │ │ -701 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ -702 │ │ │ │ │ -710 inline void operator()(const InterfaceMap& interface, const Data& data, │ │ │ │ │ -Type* buffer, size_t bufferSize) const; │ │ │ │ │ -711 }; │ │ │ │ │ -712 │ │ │ │ │ -717 template │ │ │ │ │ -718 struct MessageGatherer │ │ │ │ │ -719 { │ │ │ │ │ -721 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ -722 │ │ │ │ │ -727 typedef GatherScatter Gatherer; │ │ │ │ │ -728 │ │ │ │ │ -734 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ -735 │ │ │ │ │ -743 inline void operator()(const InterfaceMap& interface, const Data& data, │ │ │ │ │ -Type* buffer, size_t bufferSize) const; │ │ │ │ │ -744 }; │ │ │ │ │ -745 │ │ │ │ │ -749 template │ │ │ │ │ -750 struct MessageScatterer │ │ │ │ │ -751 {}; │ │ │ │ │ -752 │ │ │ │ │ -757 template │ │ │ │ │ -758 struct MessageScatterer │ │ │ │ │ -759 { │ │ │ │ │ -761 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ -762 │ │ │ │ │ -767 typedef GatherScatter Scatterer; │ │ │ │ │ -768 │ │ │ │ │ -774 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ -775 │ │ │ │ │ -783 inline void operator()(const InterfaceMap& interface, Data& data, Type* │ │ │ │ │ -buffer, const int& proc) const; │ │ │ │ │ -784 }; │ │ │ │ │ -789 template │ │ │ │ │ -790 struct MessageScatterer │ │ │ │ │ -791 { │ │ │ │ │ -793 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ -794 │ │ │ │ │ -799 typedef GatherScatter Scatterer; │ │ │ │ │ -800 │ │ │ │ │ -806 constexpr static bool _f_o_r_w_a_r_d = send; │ │ │ │ │ -807 │ │ │ │ │ -815 inline void operator()(const InterfaceMap& interface, Data& data, Type* │ │ │ │ │ -buffer, const int& proc) const; │ │ │ │ │ -816 }; │ │ │ │ │ -817 │ │ │ │ │ -821 struct MessageInformation │ │ │ │ │ -822 { │ │ │ │ │ -824 MessageInformation() │ │ │ │ │ -825 : start_(0), size_(0) │ │ │ │ │ -826 {} │ │ │ │ │ -827 │ │ │ │ │ -835 MessageInformation(size_t start, size_t size) │ │ │ │ │ -836 : start_(start), size_(size) │ │ │ │ │ -837 {} │ │ │ │ │ -841 size_t start_; │ │ │ │ │ -845 size_t size_; │ │ │ │ │ -846 }; │ │ │ │ │ -847 │ │ │ │ │ -854 typedef std::map > │ │ │ │ │ -855 InformationMap; │ │ │ │ │ -859 InformationMap messageInformation_; │ │ │ │ │ -863 char* buffers_[2]; │ │ │ │ │ -867 size_t bufferSize_[2]; │ │ │ │ │ -868 │ │ │ │ │ -872 constexpr static int commTag_ = 0; │ │ │ │ │ -873 │ │ │ │ │ -877 std::map > │ │ │ │ │ -interfaces_; │ │ │ │ │ -878 │ │ │ │ │ -879 MPI_Comm communicator_; │ │ │ │ │ -880 │ │ │ │ │ -884 template │ │ │ │ │ -885 void sendRecv(const Data& source, Data& target); │ │ │ │ │ -886 │ │ │ │ │ -887 }; │ │ │ │ │ -888 │ │ │ │ │ -889#ifndef DOXYGEN │ │ │ │ │ -890 │ │ │ │ │ -891 template │ │ │ │ │ -892 inline const void* _C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s(const V& v, int index) │ │ │ │ │ -893 { │ │ │ │ │ -894 return &(v[index]); │ │ │ │ │ -895 } │ │ │ │ │ -896 │ │ │ │ │ -897 template │ │ │ │ │ -898 inline int _C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_S_i_z_e([[maybe_unused]] const V& v, [ │ │ │ │ │ -[maybe_unused]] int index) │ │ │ │ │ -899 { │ │ │ │ │ -900 return 1; │ │ │ │ │ -901 } │ │ │ │ │ -902 │ │ │ │ │ -903 template │ │ │ │ │ -904 inline const void* CommPolicy, A> >:: │ │ │ │ │ -getAddress(const Type& v, int index) │ │ │ │ │ -905 { │ │ │ │ │ -906 return &(v[index][0]); │ │ │ │ │ -907 } │ │ │ │ │ -908 │ │ │ │ │ -909 template │ │ │ │ │ -910 inline int CommPolicy, A> >::getSize │ │ │ │ │ -(const Type& v, int index) │ │ │ │ │ -911 { │ │ │ │ │ -912 return v[index].getsize(); │ │ │ │ │ -913 } │ │ │ │ │ -914 │ │ │ │ │ -915 template │ │ │ │ │ -916 inline const typename CopyGatherScatter::IndexedType& │ │ │ │ │ -CopyGatherScatter::gather(const T & vec, std::size_t i) │ │ │ │ │ -917 { │ │ │ │ │ -918 return vec[i]; │ │ │ │ │ -919 } │ │ │ │ │ -920 │ │ │ │ │ -921 template │ │ │ │ │ -922 inline void CopyGatherScatter::scatter(T& vec, const IndexedType& v, │ │ │ │ │ -std::size_t i) │ │ │ │ │ -923 { │ │ │ │ │ -924 vec[i]=v; │ │ │ │ │ -925 } │ │ │ │ │ -926 │ │ │ │ │ -927 template │ │ │ │ │ -928 DatatypeCommunicator::DatatypeCommunicator() │ │ │ │ │ -929 : remoteIndices_(0), created_(false) │ │ │ │ │ -930 { │ │ │ │ │ -931 requests_[0]=0; │ │ │ │ │ -932 requests_[1]=0; │ │ │ │ │ -933 } │ │ │ │ │ -934 │ │ │ │ │ -935 │ │ │ │ │ -936 │ │ │ │ │ -937 template │ │ │ │ │ -938 DatatypeCommunicator::~DatatypeCommunicator() │ │ │ │ │ -939 { │ │ │ │ │ -940 free(); │ │ │ │ │ -941 } │ │ │ │ │ -942 │ │ │ │ │ -943 template │ │ │ │ │ -944 template │ │ │ │ │ -945 inline void DatatypeCommunicator::build(const RemoteIndices& │ │ │ │ │ -remoteIndices, │ │ │ │ │ -946 const T1& source, V& sendData, │ │ │ │ │ -947 const T2& destination, V& receiveData) │ │ │ │ │ -948 { │ │ │ │ │ -949 remoteIndices_ = &remoteIndices; │ │ │ │ │ -950 free(); │ │ │ │ │ -951 createDataTypes(source,destination, receiveData); │ │ │ │ │ -952 createDataTypes(source,destination, sendData); │ │ │ │ │ -953 createRequests(sendData, receiveData); │ │ │ │ │ -954 createRequests(receiveData, sendData); │ │ │ │ │ -955 created_=true; │ │ │ │ │ -956 } │ │ │ │ │ -957 │ │ │ │ │ -958 template │ │ │ │ │ -959 void DatatypeCommunicator::free() │ │ │ │ │ -960 { │ │ │ │ │ -961 if(created_) { │ │ │ │ │ -962 delete[] requests_[0]; │ │ │ │ │ -963 delete[] requests_[1]; │ │ │ │ │ -964 typedef MessageTypeMap::iterator iterator; │ │ │ │ │ -965 typedef MessageTypeMap::const_iterator const_iterator; │ │ │ │ │ -966 │ │ │ │ │ -967 const const_iterator end=messageTypes.end(); │ │ │ │ │ -968 │ │ │ │ │ -969 for(iterator process = messageTypes.begin(); process != end; ++process) { │ │ │ │ │ -970 MPI_Datatype *type = &(process->second.first); │ │ │ │ │ -971 int finalized=0; │ │ │ │ │ -972 MPI_Finalized(&finalized); │ │ │ │ │ -973 if(*type!=MPI_DATATYPE_NULL && !finalized) │ │ │ │ │ -974 MPI_Type_free(type); │ │ │ │ │ -975 type = &(process->second.second); │ │ │ │ │ -976 if(*type!=MPI_DATATYPE_NULL && !finalized) │ │ │ │ │ -977 MPI_Type_free(type); │ │ │ │ │ -978 } │ │ │ │ │ -979 messageTypes.clear(); │ │ │ │ │ -980 created_=false; │ │ │ │ │ -981 } │ │ │ │ │ -982 │ │ │ │ │ -983 } │ │ │ │ │ -984 │ │ │ │ │ -985 template │ │ │ │ │ -986 template │ │ │ │ │ -987 void DatatypeCommunicator::createDataTypes(const T1& sourceFlags, const │ │ │ │ │ -T2& destFlags, V& data) │ │ │ │ │ -988 { │ │ │ │ │ -989 │ │ │ │ │ -990 MPIDatatypeInformation dataInfo(data); │ │ │ │ │ -991 this->template │ │ │ │ │ -buildInterface,send> │ │ │ │ │ -(*remoteIndices_,sourceFlags, destFlags, dataInfo); │ │ │ │ │ -992 │ │ │ │ │ -993 typedef typename RemoteIndices::RemoteIndexMap::const_iterator │ │ │ │ │ -const_iterator; │ │ │ │ │ -994 const const_iterator end=this->remoteIndices_->end(); │ │ │ │ │ -995 │ │ │ │ │ -996 // Allocate MPI_Datatypes and deallocate memory for the type construction. │ │ │ │ │ -997 for(const_iterator process=this->remoteIndices_->begin(); process != end; │ │ │ │ │ -++process) { │ │ │ │ │ -998 IndexedTypeInformation& info=dataInfo.information_[process->first]; │ │ │ │ │ -999 // Shift the displacement │ │ │ │ │ -1000 MPI_Aint base; │ │ │ │ │ -1001 MPI_Get_address(const_cast(_C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s(data, 0)), │ │ │ │ │ -&base); │ │ │ │ │ -1002 │ │ │ │ │ -1003 for(int i=0; i< info.elements; i++) { │ │ │ │ │ -1004 info.displ[i]-=base; │ │ │ │ │ -1005 } │ │ │ │ │ -1006 │ │ │ │ │ -1007 // Create data type │ │ │ │ │ -1008 MPI_Datatype* type = &( send ? messageTypes[process->first].first : │ │ │ │ │ -messageTypes[process->first].second); │ │ │ │ │ -1009 MPI_Type_create_hindexed(info.elements, info.length, info.displ, │ │ │ │ │ -1010 MPITraits_:_:_I_n_d_e_x_e_d_T_y_p_e>::getType(), type); │ │ │ │ │ -1011 MPI_Type_commit(type); │ │ │ │ │ -1012 // Deallocate memory │ │ │ │ │ -1013 info.free(); │ │ │ │ │ -1014 } │ │ │ │ │ -1015 } │ │ │ │ │ -1016 │ │ │ │ │ -1017 template │ │ │ │ │ -1018 template │ │ │ │ │ -1019 void DatatypeCommunicator::createRequests(V& sendData, V& receiveData) │ │ │ │ │ -1020 { │ │ │ │ │ -1021 typedef std::map >:: │ │ │ │ │ -const_iterator MapIterator; │ │ │ │ │ -1022 int rank; │ │ │ │ │ -1023 static int index = createForward ? 1 : 0; │ │ │ │ │ -1024 int noMessages = messageTypes.size(); │ │ │ │ │ -1025 // allocate request handles │ │ │ │ │ -1026 requests_[index] = new MPI_Request[2*noMessages]; │ │ │ │ │ -1027 const MapIterator end = messageTypes.end(); │ │ │ │ │ -1028 int request=0; │ │ │ │ │ -1029 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ -1030 │ │ │ │ │ -1031 // Set up the requests for receiving first │ │ │ │ │ -1032 for(MapIterator process = messageTypes.begin(); process != end; │ │ │ │ │ -1033 ++process, ++request) { │ │ │ │ │ -1034 MPI_Datatype type = createForward ? process->second.second : process- │ │ │ │ │ ->second.first; │ │ │ │ │ -1035 void* address = const_cast(_C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s │ │ │ │ │ -(receiveData,0)); │ │ │ │ │ -1036 MPI_Recv_init(address, 1, type, process->first, commTag_, this- │ │ │ │ │ ->remoteIndices_->communicator(), requests_[index]+request); │ │ │ │ │ -1037 } │ │ │ │ │ -1038 │ │ │ │ │ -1039 // And now the send requests │ │ │ │ │ -1040 │ │ │ │ │ -1041 for(MapIterator process = messageTypes.begin(); process != end; │ │ │ │ │ -1042 ++process, ++request) { │ │ │ │ │ -1043 MPI_Datatype type = createForward ? process->second.first : process- │ │ │ │ │ ->second.second; │ │ │ │ │ -1044 void* address = const_cast(_C_o_m_m_P_o_l_i_c_y_<_V_>_:_:_g_e_t_A_d_d_r_e_s_s(sendData, 0)); │ │ │ │ │ -1045 MPI_Ssend_init(address, 1, type, process->first, commTag_, this- │ │ │ │ │ ->remoteIndices_->communicator(), requests_[index]+request); │ │ │ │ │ -1046 } │ │ │ │ │ -1047 } │ │ │ │ │ -1048 │ │ │ │ │ -1049 template │ │ │ │ │ -1050 void DatatypeCommunicator::forward() │ │ │ │ │ -1051 { │ │ │ │ │ -1052 sendRecv(requests_[1]); │ │ │ │ │ -1053 } │ │ │ │ │ -1054 │ │ │ │ │ -1055 template │ │ │ │ │ -1056 void DatatypeCommunicator::backward() │ │ │ │ │ -1057 { │ │ │ │ │ -1058 sendRecv(requests_[0]); │ │ │ │ │ -1059 } │ │ │ │ │ -1060 │ │ │ │ │ -1061 template │ │ │ │ │ -1062 void DatatypeCommunicator::sendRecv(MPI_Request* requests) │ │ │ │ │ -1063 { │ │ │ │ │ -1064 int noMessages = messageTypes.size(); │ │ │ │ │ -1065 // Start the receive calls first │ │ │ │ │ -1066 MPI_Startall(noMessages, requests); │ │ │ │ │ -1067 // Now the send calls │ │ │ │ │ -1068 MPI_Startall(noMessages, requests+noMessages); │ │ │ │ │ -1069 │ │ │ │ │ -1070 // Wait for completion of the communication send first then receive │ │ │ │ │ -1071 MPI_Status* status=new MPI_Status[2*noMessages]; │ │ │ │ │ -1072 for(int i=0; i<2*noMessages; i++) │ │ │ │ │ -1073 status[i].MPI_ERROR=MPI_SUCCESS; │ │ │ │ │ -1074 │ │ │ │ │ -1075 int send = MPI_Waitall(noMessages, requests+noMessages, │ │ │ │ │ -status+noMessages); │ │ │ │ │ -1076 int receive = MPI_Waitall(noMessages, requests, status); │ │ │ │ │ -1077 │ │ │ │ │ -1078 // Error checks │ │ │ │ │ -1079 int success=1, globalSuccess=0; │ │ │ │ │ -1080 if(send==MPI_ERR_IN_STATUS) { │ │ │ │ │ -1081 int rank; │ │ │ │ │ -1082 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank); │ │ │ │ │ -1083 std::cerr<remoteIndices_->communicator(), &rank); │ │ │ │ │ -1101 std::cerr<remoteIndices_->communicator()); │ │ │ │ │ -1117 │ │ │ │ │ -1118 delete[] status; │ │ │ │ │ -1119 │ │ │ │ │ -1120 if(!globalSuccess) │ │ │ │ │ -1121 _D_U_N_E___T_H_R_O_W(CommunicationError, "A communication error occurred!"); │ │ │ │ │ -1122 │ │ │ │ │ -1123 } │ │ │ │ │ -1124 │ │ │ │ │ -1125 inline _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r() │ │ │ │ │ -1126 { │ │ │ │ │ -1127 buffers_[0]=0; │ │ │ │ │ -1128 buffers_[1]=0; │ │ │ │ │ -1129 bufferSize_[0]=0; │ │ │ │ │ -1130 bufferSize_[1]=0; │ │ │ │ │ -1131 } │ │ │ │ │ -1132 │ │ │ │ │ -1133 template │ │ │ │ │ -1134 typename std::enable_if:: │ │ │ │ │ -IndexedTypeFlag>::value, void>::type │ │ │ │ │ -1135 _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d(const Interface& interface) │ │ │ │ │ -1136 { │ │ │ │ │ -1137 interfaces_=interface.interfaces(); │ │ │ │ │ -1138 communicator_=interface.communicator(); │ │ │ │ │ -1139 typedef typename std::map > │ │ │ │ │ -1140 ::const_iterator const_iterator; │ │ │ │ │ -1141 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g Flag; │ │ │ │ │ -1142 const const_iterator end = interfaces_.end(); │ │ │ │ │ -1143 int lrank; │ │ │ │ │ -1144 MPI_Comm_rank(communicator_, &lrank); │ │ │ │ │ -1145 │ │ │ │ │ -1146 bufferSize_[0]=0; │ │ │ │ │ -1147 bufferSize_[1]=0; │ │ │ │ │ -1148 │ │ │ │ │ -1149 for(const_iterator interfacePair = interfaces_.begin(); │ │ │ │ │ -1150 interfacePair != end; ++interfacePair) { │ │ │ │ │ -1151 int noSend = MessageSizeCalculator() (interfacePair- │ │ │ │ │ ->second.first); │ │ │ │ │ -1152 int noRecv = MessageSizeCalculator() (interfacePair- │ │ │ │ │ ->second.second); │ │ │ │ │ -1153 if (noSend + noRecv > 0) │ │ │ │ │ -1154 messageInformation_.insert(std::make_pair(interfacePair->first, │ │ │ │ │ -1155 std::make_pair(MessageInformation(bufferSize_[0], │ │ │ │ │ -1156 noSend*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e)), │ │ │ │ │ -1157 MessageInformation(bufferSize_[1], │ │ │ │ │ -1158 noRecv*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e))))); │ │ │ │ │ -1159 bufferSize_[0] += noSend; │ │ │ │ │ -1160 bufferSize_[1] += noRecv; │ │ │ │ │ -1161 } │ │ │ │ │ -1162 │ │ │ │ │ -1163 // allocate the buffers │ │ │ │ │ -1164 bufferSize_[0] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ -1165 bufferSize_[1] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ -1166 │ │ │ │ │ -1167 buffers_[0] = new char[bufferSize_[0]]; │ │ │ │ │ -1168 buffers_[1] = new char[bufferSize_[1]]; │ │ │ │ │ -1169 } │ │ │ │ │ -1170 │ │ │ │ │ -1171 template │ │ │ │ │ -1172 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d(const Data& source, const Data& dest, │ │ │ │ │ -const Interface& interface) │ │ │ │ │ -1173 { │ │ │ │ │ -1174 │ │ │ │ │ -1175 interfaces_=interface.interfaces(); │ │ │ │ │ -1176 communicator_=interface.communicator(); │ │ │ │ │ -1177 typedef typename std::map > │ │ │ │ │ -1178 ::const_iterator const_iterator; │ │ │ │ │ -1179 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g Flag; │ │ │ │ │ -1180 const const_iterator end = interfaces_.end(); │ │ │ │ │ -1181 │ │ │ │ │ -1182 bufferSize_[0]=0; │ │ │ │ │ -1183 bufferSize_[1]=0; │ │ │ │ │ -1184 │ │ │ │ │ -1185 for(const_iterator interfacePair = interfaces_.begin(); │ │ │ │ │ -1186 interfacePair != end; ++interfacePair) { │ │ │ │ │ -1187 int noSend = MessageSizeCalculator() (source, interfacePair- │ │ │ │ │ ->second.first); │ │ │ │ │ -1188 int noRecv = MessageSizeCalculator() (dest, interfacePair- │ │ │ │ │ ->second.second); │ │ │ │ │ -1189 if (noSend + noRecv > 0) │ │ │ │ │ -1190 messageInformation_.insert(std::make_pair(interfacePair->first, │ │ │ │ │ -1191 std::make_pair(MessageInformation(bufferSize_[0], │ │ │ │ │ -1192 noSend*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e)), │ │ │ │ │ -1193 MessageInformation(bufferSize_[1], │ │ │ │ │ -1194 noRecv*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e))))); │ │ │ │ │ -1195 bufferSize_[0] += noSend; │ │ │ │ │ -1196 bufferSize_[1] += noRecv; │ │ │ │ │ -1197 } │ │ │ │ │ -1198 │ │ │ │ │ -1199 bufferSize_[0] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ -1200 bufferSize_[1] *= sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e); │ │ │ │ │ -1201 // allocate the buffers │ │ │ │ │ -1202 buffers_[0] = new char[bufferSize_[0]]; │ │ │ │ │ -1203 buffers_[1] = new char[bufferSize_[1]]; │ │ │ │ │ -1204 } │ │ │ │ │ -1205 │ │ │ │ │ -1206 inline void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_r_e_e() │ │ │ │ │ -1207 { │ │ │ │ │ -1208 messageInformation_.clear(); │ │ │ │ │ -1209 if(buffers_[0]) │ │ │ │ │ -1210 delete[] buffers_[0]; │ │ │ │ │ -1211 │ │ │ │ │ -1212 if(buffers_[1]) │ │ │ │ │ -1213 delete[] buffers_[1]; │ │ │ │ │ -1214 buffers_[0]=buffers_[1]=0; │ │ │ │ │ -1215 } │ │ │ │ │ -1216 │ │ │ │ │ -1217 inline _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_~_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r() │ │ │ │ │ -1218 { │ │ │ │ │ -1219 _f_r_e_e(); │ │ │ │ │ -1220 } │ │ │ │ │ -1221 │ │ │ │ │ -1222 template │ │ │ │ │ -1223 inline int BufferedCommunicator::MessageSizeCalculator:: │ │ │ │ │ -operator() │ │ │ │ │ -1224 (const InterfaceInformation& info) const │ │ │ │ │ -1225 { │ │ │ │ │ -1226 return info.size(); │ │ │ │ │ -1227 } │ │ │ │ │ -1228 │ │ │ │ │ -1229 │ │ │ │ │ -1230 template │ │ │ │ │ -1231 inline int BufferedCommunicator::MessageSizeCalculator:: │ │ │ │ │ -operator() │ │ │ │ │ -1232 (const Data&, const InterfaceInformation& info) const │ │ │ │ │ -1233 { │ │ │ │ │ -1234 return operator()(info); │ │ │ │ │ -1235 } │ │ │ │ │ -1236 │ │ │ │ │ -1237 │ │ │ │ │ -1238 template │ │ │ │ │ -1239 inline int BufferedCommunicator::MessageSizeCalculator::operator() │ │ │ │ │ -1240 (const Data& data, const InterfaceInformation& info) const │ │ │ │ │ -1241 { │ │ │ │ │ -1242 int entries=0; │ │ │ │ │ -1243 │ │ │ │ │ -1244 for(size_t i=0; i < info.size(); i++) │ │ │ │ │ -1245 entries += _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_g_e_t_S_i_z_e(data,info[i]); │ │ │ │ │ -1246 │ │ │ │ │ -1247 return entries; │ │ │ │ │ -1248 } │ │ │ │ │ -1249 │ │ │ │ │ -1250 │ │ │ │ │ -1251 template │ │ │ │ │ -1252 inline void BufferedCommunicator:: │ │ │ │ │ -MessageGatherer::operator()(const │ │ │ │ │ -InterfaceMap& interfaces,const Data& data, Type* buffer, [[maybe_unused]] │ │ │ │ │ -size_t bufferSize) const │ │ │ │ │ -1253 { │ │ │ │ │ -1254 typedef typename InterfaceMap::const_iterator │ │ │ │ │ -1255 const_iterator; │ │ │ │ │ -1256 │ │ │ │ │ -1257 int rank; │ │ │ │ │ -1258 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ -1259 const const_iterator end = interfaces.end(); │ │ │ │ │ -1260 size_t index=0; │ │ │ │ │ -1261 │ │ │ │ │ -1262 for(const_iterator interfacePair = interfaces.begin(); │ │ │ │ │ -1263 interfacePair != end; ++interfacePair) { │ │ │ │ │ -1264 int size = forward ? interfacePair->second.first.size() : │ │ │ │ │ -1265 interfacePair->second.second.size(); │ │ │ │ │ -1266 │ │ │ │ │ -1267 for(int i=0; i < size; i++) { │ │ │ │ │ -1268 int local = forward ? interfacePair->second.first[i] : │ │ │ │ │ -1269 interfacePair->second.second[i]; │ │ │ │ │ -1270 for(std::size_t j=0; j < CommPolicy::getSize(data, local); j++, │ │ │ │ │ -index++) { │ │ │ │ │ -1271 │ │ │ │ │ -1272#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1273 assert(bufferSize>=(index+1)*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e)); │ │ │ │ │ -1274#endif │ │ │ │ │ -1275 buffer[index]=GatherScatter::gather(data, local, j); │ │ │ │ │ -1276 } │ │ │ │ │ -1277 │ │ │ │ │ -1278 } │ │ │ │ │ -1279 } │ │ │ │ │ -1280 │ │ │ │ │ -1281 } │ │ │ │ │ -1282 │ │ │ │ │ -1283 │ │ │ │ │ -1284 template │ │ │ │ │ -1285 inline void BufferedCommunicator:: │ │ │ │ │ -MessageGatherer::operator()( │ │ │ │ │ -1286 const InterfaceMap& interfaces, const Data& data, Type* buffer, [ │ │ │ │ │ -[maybe_unused]] size_t bufferSize) const │ │ │ │ │ -1287 { │ │ │ │ │ -1288 typedef typename InterfaceMap::const_iterator │ │ │ │ │ -1289 const_iterator; │ │ │ │ │ -1290 const const_iterator end = interfaces.end(); │ │ │ │ │ -1291 size_t index = 0; │ │ │ │ │ -1292 │ │ │ │ │ -1293 int rank; │ │ │ │ │ -1294 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ -1295 │ │ │ │ │ -1296 for(const_iterator interfacePair = interfaces.begin(); │ │ │ │ │ -1297 interfacePair != end; ++interfacePair) { │ │ │ │ │ -1298 size_t size = FORWARD ? interfacePair->second.first.size() : │ │ │ │ │ -1299 interfacePair->second.second.size(); │ │ │ │ │ -1300 │ │ │ │ │ -1301 for(size_t i=0; i < size; i++) { │ │ │ │ │ -1302 │ │ │ │ │ -1303#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1304 assert(bufferSize>=(index+1)*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e)); │ │ │ │ │ -1305#endif │ │ │ │ │ -1306 │ │ │ │ │ -1307 buffer[index++] = GatherScatter::gather(data, FORWARD ? interfacePair- │ │ │ │ │ ->second.first[i] : │ │ │ │ │ -1308 interfacePair->second.second[i]); │ │ │ │ │ -1309 } │ │ │ │ │ -1310 } │ │ │ │ │ -1311 │ │ │ │ │ -1312 } │ │ │ │ │ -1313 │ │ │ │ │ -1314 │ │ │ │ │ -1315 template │ │ │ │ │ -1316 inline void BufferedCommunicator:: │ │ │ │ │ -MessageScatterer::operator()(const │ │ │ │ │ -InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const │ │ │ │ │ -1317 { │ │ │ │ │ -1318 typedef typename InterfaceMap::value_type::second_type::first_type │ │ │ │ │ -Information; │ │ │ │ │ -1319 const typename InterfaceMap::const_iterator infoPair = interfaces.find │ │ │ │ │ -(proc); │ │ │ │ │ -1320 │ │ │ │ │ -1321 assert(infoPair!=interfaces.end()); │ │ │ │ │ -1322 │ │ │ │ │ -1323 const Information& info = FORWARD ? infoPair->second.second : │ │ │ │ │ -1324 infoPair->second.first; │ │ │ │ │ -1325 │ │ │ │ │ -1326 for(size_t i=0, index=0; i < info.size(); i++) { │ │ │ │ │ -1327 for(size_t j=0; j < CommPolicy::getSize(data, info[i]); j++) │ │ │ │ │ -1328 GatherScatter::scatter(data, buffer[index++], info[i], j); │ │ │ │ │ -1329 } │ │ │ │ │ -1330 } │ │ │ │ │ -1331 │ │ │ │ │ -1332 │ │ │ │ │ -1333 template │ │ │ │ │ -1334 inline void BufferedCommunicator:: │ │ │ │ │ -MessageScatterer::operator()(const │ │ │ │ │ -InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const │ │ │ │ │ -1335 { │ │ │ │ │ -1336 typedef typename InterfaceMap::value_type::second_type::first_type │ │ │ │ │ -Information; │ │ │ │ │ -1337 const typename InterfaceMap::const_iterator infoPair = interfaces.find │ │ │ │ │ -(proc); │ │ │ │ │ -1338 │ │ │ │ │ -1339 assert(infoPair!=interfaces.end()); │ │ │ │ │ -1340 │ │ │ │ │ -1341 const Information& info = FORWARD ? infoPair->second.second : │ │ │ │ │ -1342 infoPair->second.first; │ │ │ │ │ -1343 │ │ │ │ │ -1344 for(size_t i=0; i < info.size(); i++) { │ │ │ │ │ -1345 GatherScatter::scatter(data, buffer[i], info[i]); │ │ │ │ │ -1346 } │ │ │ │ │ -1347 } │ │ │ │ │ -1348 │ │ │ │ │ -1349 │ │ │ │ │ -1350 template │ │ │ │ │ -1351 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d(Data& data) │ │ │ │ │ -1352 { │ │ │ │ │ -1353 this->template sendRecv(data, data); │ │ │ │ │ -1354 } │ │ │ │ │ -1355 │ │ │ │ │ -1356 │ │ │ │ │ -1357 template │ │ │ │ │ -1358 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d(Data& data) │ │ │ │ │ -1359 { │ │ │ │ │ -1360 this->template sendRecv(data, data); │ │ │ │ │ -1361 } │ │ │ │ │ -1362 │ │ │ │ │ -1363 │ │ │ │ │ -1364 template │ │ │ │ │ -1365 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d(const Data& source, Data& dest) │ │ │ │ │ -1366 { │ │ │ │ │ -1367 this->template sendRecv(source, dest); │ │ │ │ │ -1368 } │ │ │ │ │ -1369 │ │ │ │ │ -1370 │ │ │ │ │ -1371 template │ │ │ │ │ -1372 void _B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d(Data& source, const Data& dest) │ │ │ │ │ -1373 { │ │ │ │ │ -1374 this->template sendRecv(dest, source); │ │ │ │ │ -1375 } │ │ │ │ │ -1376 │ │ │ │ │ -1377 │ │ │ │ │ -1378 template │ │ │ │ │ -1379 void BufferedCommunicator::sendRecv(const Data& source, Data& dest) │ │ │ │ │ -1380 { │ │ │ │ │ -1381 int rank, lrank; │ │ │ │ │ -1382 │ │ │ │ │ -1383 MPI_Comm_rank(MPI_COMM_WORLD,&rank); │ │ │ │ │ -1384 MPI_Comm_rank(MPI_COMM_WORLD,&lrank); │ │ │ │ │ -1385 │ │ │ │ │ -1386 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e Type; │ │ │ │ │ -1387 Type *sendBuffer, *recvBuffer; │ │ │ │ │ -1388 size_t sendBufferSize; │ │ │ │ │ -1389#ifndef NDEBUG │ │ │ │ │ -1390 size_t recvBufferSize; │ │ │ │ │ -1391#endif │ │ │ │ │ -1392 │ │ │ │ │ -1393 if(FORWARD) { │ │ │ │ │ -1394 sendBuffer = reinterpret_cast(buffers_[0]); │ │ │ │ │ -1395 sendBufferSize = bufferSize_[0]; │ │ │ │ │ -1396 recvBuffer = reinterpret_cast(buffers_[1]); │ │ │ │ │ -1397#ifndef NDEBUG │ │ │ │ │ -1398 recvBufferSize = bufferSize_[1]; │ │ │ │ │ -1399#endif │ │ │ │ │ -1400 }else{ │ │ │ │ │ -1401 sendBuffer = reinterpret_cast(buffers_[1]); │ │ │ │ │ -1402 sendBufferSize = bufferSize_[1]; │ │ │ │ │ -1403 recvBuffer = reinterpret_cast(buffers_[0]); │ │ │ │ │ -1404#ifndef NDEBUG │ │ │ │ │ -1405 recvBufferSize = bufferSize_[0]; │ │ │ │ │ -1406#endif │ │ │ │ │ -1407 } │ │ │ │ │ -1408 typedef typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g Flag; │ │ │ │ │ -1409 │ │ │ │ │ -1410 MessageGatherer() (interfaces_, source, │ │ │ │ │ -sendBuffer, sendBufferSize); │ │ │ │ │ -1411 │ │ │ │ │ -1412 MPI_Request* sendRequests = new MPI_Request[messageInformation_.size()]; │ │ │ │ │ -1413 MPI_Request* recvRequests = new MPI_Request[messageInformation_.size()]; │ │ │ │ │ -1414 /* Number of recvRequests that are not MPI_REQUEST_NULL */ │ │ │ │ │ -1415 size_t numberOfRealRecvRequests = 0; │ │ │ │ │ -1416 │ │ │ │ │ -1417 // Setup receive first │ │ │ │ │ -1418 typedef typename InformationMap::const_iterator const_iterator; │ │ │ │ │ -1419 │ │ │ │ │ -1420 const const_iterator end = messageInformation_.end(); │ │ │ │ │ -1421 size_t i=0; │ │ │ │ │ -1422 int* processMap = new int[messageInformation_.size()]; │ │ │ │ │ -1423 │ │ │ │ │ -1424 for(const_iterator info = messageInformation_.begin(); info != end; │ │ │ │ │ -++info, ++i) { │ │ │ │ │ -1425 processMap[i]=info->first; │ │ │ │ │ -1426 if(FORWARD) { │ │ │ │ │ -1427 assert(info->second.second.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e)+info->second.second.size_ <= recvBufferSize ); │ │ │ │ │ -1428 _D_u_n_e_:_:_d_v_v_e_r_b<second.second.size_<<" from │ │ │ │ │ -"<first<second.second.size_) { │ │ │ │ │ -1430 MPI_Irecv(recvBuffer+info->second.second.start_, info- │ │ │ │ │ ->second.second.size_, │ │ │ │ │ -1431 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ -1432 recvRequests+i); │ │ │ │ │ -1433 numberOfRealRecvRequests += 1; │ │ │ │ │ -1434 } else { │ │ │ │ │ -1435 // Nothing to receive -> set request to inactive │ │ │ │ │ -1436 recvRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ -1437 } │ │ │ │ │ -1438 }else{ │ │ │ │ │ -1439 assert(info->second.first.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e)+info->second.first.size_ <= recvBufferSize ); │ │ │ │ │ -1440 _D_u_n_e_:_:_d_v_v_e_r_b<second.first.size_<<" to │ │ │ │ │ -"<first<second.first.size_) { │ │ │ │ │ -1442 MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_, │ │ │ │ │ -1443 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ -1444 recvRequests+i); │ │ │ │ │ -1445 numberOfRealRecvRequests += 1; │ │ │ │ │ -1446 } else { │ │ │ │ │ -1447 // Nothing to receive -> set request to inactive │ │ │ │ │ -1448 recvRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ -1449 } │ │ │ │ │ -1450 } │ │ │ │ │ -1451 } │ │ │ │ │ -1452 │ │ │ │ │ -1453 // now the send requests │ │ │ │ │ -1454 i=0; │ │ │ │ │ -1455 for(const_iterator info = messageInformation_.begin(); info != end; │ │ │ │ │ -++info, ++i) │ │ │ │ │ -1456 if(FORWARD) { │ │ │ │ │ -1457 assert(info->second.second.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e)+info->second.second.size_ <= recvBufferSize ); │ │ │ │ │ -1458 _D_u_n_e_:_:_d_v_v_e_r_b<second.first.size_<<" to "<first<second.first.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e)+info->second.first.size_ <= sendBufferSize ); │ │ │ │ │ -1460 if(info->second.first.size_) │ │ │ │ │ -1461 MPI_Issend(sendBuffer+info->second.first.start_, info->second.first.size_, │ │ │ │ │ -1462 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ -1463 sendRequests+i); │ │ │ │ │ -1464 else │ │ │ │ │ -1465 // Nothing to send -> set request to inactive │ │ │ │ │ -1466 sendRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ -1467 }else{ │ │ │ │ │ -1468 assert(info->second.second.start_*sizeof(typename _C_o_m_m_P_o_l_i_c_y_<_D_a_t_a_>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e)+info->second.second.size_ <= sendBufferSize ); │ │ │ │ │ -1469 _D_u_n_e_:_:_d_v_v_e_r_b<second.second.size_<<" to "<first<second.second.size_) │ │ │ │ │ -1471 MPI_Issend(sendBuffer+info->second.second.start_, info- │ │ │ │ │ ->second.second.size_, │ │ │ │ │ -1472 MPI_BYTE, info->first, commTag_, communicator_, │ │ │ │ │ -1473 sendRequests+i); │ │ │ │ │ -1474 else │ │ │ │ │ -1475 // Nothing to send -> set request to inactive │ │ │ │ │ -1476 sendRequests[i]=MPI_REQUEST_NULL; │ │ │ │ │ -1477 } │ │ │ │ │ -1478 │ │ │ │ │ -1479 // Wait for completion of receive and immediately start scatter │ │ │ │ │ -1480 i=0; │ │ │ │ │ -1481 //int success = 1; │ │ │ │ │ -1482 int finished = MPI_UNDEFINED; │ │ │ │ │ -1483 MPI_Status status; //[messageInformation_.size()]; │ │ │ │ │ -1484 //MPI_Waitall(messageInformation_.size(), recvRequests, status); │ │ │ │ │ -1485 │ │ │ │ │ -1486 for(i=0; i< numberOfRealRecvRequests; i++) { │ │ │ │ │ -1487 status.MPI_ERROR=MPI_SUCCESS; │ │ │ │ │ -1488 MPI_Waitany(messageInformation_.size(), recvRequests, &finished, &status); │ │ │ │ │ -1489 assert(finished != MPI_UNDEFINED); │ │ │ │ │ -1490 │ │ │ │ │ -1491 if(status.MPI_ERROR==MPI_SUCCESS) { │ │ │ │ │ -1492 int& proc = processMap[finished]; │ │ │ │ │ -1493 typename InformationMap::const_iterator infoIter = │ │ │ │ │ -messageInformation_.find(proc); │ │ │ │ │ -1494 assert(infoIter != messageInformation_.end()); │ │ │ │ │ -1495 │ │ │ │ │ -1496 MessageInformation info = (FORWARD) ? infoIter->second.second : infoIter- │ │ │ │ │ ->second.first; │ │ │ │ │ -1497 assert(info.start_+info.size_ <= recvBufferSize); │ │ │ │ │ -1498 │ │ │ │ │ -1499 MessageScatterer() (interfaces_, dest, │ │ │ │ │ -recvBuffer+info.start_, proc); │ │ │ │ │ -1500 }else{ │ │ │ │ │ -1501 std::cerr<communicator()); │ │ │ │ │ -1517 │ │ │ │ │ -1518 if(!globalSuccess) │ │ │ │ │ -1519 DUNE_THROW(CommunicationError, "A communication error occurred!"); │ │ │ │ │ -1520 */ │ │ │ │ │ -1521 delete[] processMap; │ │ │ │ │ -1522 delete[] sendRequests; │ │ │ │ │ -1523 delete[] recvRequests; │ │ │ │ │ -1524 │ │ │ │ │ -1525 } │ │ │ │ │ -1526 │ │ │ │ │ -1527#endif // DOXYGEN │ │ │ │ │ -1528 │ │ │ │ │ -1530} │ │ │ │ │ -1531 │ │ │ │ │ -1532#endif // HAVE_MPI │ │ │ │ │ -1533 │ │ │ │ │ -1534#endif │ │ │ │ │ -_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -Classes describing a distributed indexset. │ │ │ │ │ -_s_t_d_s_t_r_e_a_m_s_._h_h │ │ │ │ │ -Standard Dune debug streams. │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ -_D_u_n_e_:_:_d_v_v_e_r_b │ │ │ │ │ -DVVerbType dvverb(std::cout) │ │ │ │ │ -stream for very verbose output. │ │ │ │ │ -DDeeffiinniittiioonn stdstreams.hh:95 │ │ │ │ │ +23namespace _D_u_n_e │ │ │ │ │ +24{ │ │ │ │ │ +25 │ │ │ │ │ +26 │ │ │ │ │ +27 │ │ │ │ │ +33template │ │ │ │ │ +_3_4class _T_u_p_l_e_V_e_c_t_o_r : public std::tuple │ │ │ │ │ +35{ │ │ │ │ │ +36 using Base = std::tuple; │ │ │ │ │ +37 │ │ │ │ │ +38 template │ │ │ │ │ +39 using TupleConstructorDetector = decltype(Base(std::declval()...)); │ │ │ │ │ +40 │ │ │ │ │ +41 template │ │ │ │ │ +42 using hasTupleConstructor = _D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d; │ │ │ │ │ +43 │ │ │ │ │ +44 │ │ │ │ │ +45public: │ │ │ │ │ +46 │ │ │ │ │ +53 template::value, int> = 0> │ │ │ │ │ +_5_5 constexpr _T_u_p_l_e_V_e_c_t_o_r(TT&&... tt) : │ │ │ │ │ +56 Base(_s_t_d::forward(tt)...) │ │ │ │ │ +57 {} │ │ │ │ │ +58 │ │ │ │ │ +_6_1 constexpr _T_u_p_l_e_V_e_c_t_o_r() │ │ │ │ │ +62 {} │ │ │ │ │ +63 │ │ │ │ │ +66 template │ │ │ │ │ +_6_7 constexpr decltype(auto) operator[](const _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t_<_i_>&) const │ │ │ │ │ +68 { │ │ │ │ │ +69 return std::get(*this); │ │ │ │ │ +70 } │ │ │ │ │ +71 │ │ │ │ │ +74 template │ │ │ │ │ +_7_5 decltype(auto) operator[](const _D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t_<_i_>&) │ │ │ │ │ +76 { │ │ │ │ │ +77 return std::get(*this); │ │ │ │ │ +78 } │ │ │ │ │ +79 │ │ │ │ │ +_8_1 static constexpr std::size_t _s_i_z_e() │ │ │ │ │ +82 { │ │ │ │ │ +83 return std::tuple_size::value; │ │ │ │ │ +84 } │ │ │ │ │ +85}; │ │ │ │ │ +86 │ │ │ │ │ +87 │ │ │ │ │ +88 │ │ │ │ │ +89template │ │ │ │ │ +_9_0constexpr auto _m_a_k_e_T_u_p_l_e_V_e_c_t_o_r(T&&... t) │ │ │ │ │ +91{ │ │ │ │ │ +92 // The std::decay_t is is a slight simplification, │ │ │ │ │ +93 // because std::reference_wrapper needs special care. │ │ │ │ │ +94 return _T_u_p_l_e_V_e_c_t_o_r_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>...>(std::forward(t)...); │ │ │ │ │ +95} │ │ │ │ │ +96 │ │ │ │ │ +97 │ │ │ │ │ +98 │ │ │ │ │ +99} // namespace Dune │ │ │ │ │ +100 │ │ │ │ │ +101#endif // DUNE_COMMON_TUPLEVECTOR_HH │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_t_y_p_e___t_r_a_i_t_s_._h_h │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_u_n_e_:_:_i_n_d_e_x___c_o_n_s_t_a_n_t │ │ │ │ │ +std::integral_constant< std::size_t, i > index_constant │ │ │ │ │ +An index constant with value i. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_i_s___d_e_t_e_c_t_e_d │ │ │ │ │ +typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ +Detects whether Op is valid. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:141 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_I_O_E_r_r_o_r │ │ │ │ │ -Default exception class for I/O errors. │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:231 │ │ │ │ │ -_D_u_n_e_:_:_S_i_z_e_O_n_e │ │ │ │ │ -Flag for marking indexed data structures where data at each index is of the │ │ │ │ │ -same size. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_S_i_z_e │ │ │ │ │ -Flag for marking indexed data structures where the data at each index may be a │ │ │ │ │ -variable multiple of a... │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y │ │ │ │ │ -Default policy used for communicating an indexed type. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:128 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ -V::value_type IndexedType │ │ │ │ │ -The type we get at each index with operator[]. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_g_e_t_S_i_z_e │ │ │ │ │ -static int getSize(const V &, int index) │ │ │ │ │ -Get the number of primitive elements at that index. │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ -SizeOne IndexedTypeFlag │ │ │ │ │ -Whether the indexed type has variable size or there is always one value at each │ │ │ │ │ -index. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_g_e_t_A_d_d_r_e_s_s │ │ │ │ │ -static const void * getAddress(const V &v, int index) │ │ │ │ │ -Get the address of entry at an index. │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_T_y_p_e │ │ │ │ │ -V Type │ │ │ │ │ -The type the policy is for. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_F_i_e_l_d_V_e_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:173 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:175 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ -_g_e_t_S_i_z_e │ │ │ │ │ -static int getSize(const Type &v, int i) │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ -VariableSize IndexedTypeFlag │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:184 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ -_T_y_p_e │ │ │ │ │ -VariableBlockVector< FieldVector< K, n >, A > Type │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ -_g_e_t_A_d_d_r_e_s_s │ │ │ │ │ -static const void * getAddress(const Type &v, int i) │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_P_o_l_i_c_y_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _K_,_ _n_ _>_,_ _A_ _>_ _>_:_: │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ -Type::B IndexedType │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_E_r_r_o_r │ │ │ │ │ -Error thrown if there was a problem with the communication. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:195 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -GatherScatter default implementation that just copies data. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:202 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_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 &vec, const IndexedType &v, std::size_t i) │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ -CommPolicy< T >::IndexedType IndexedType │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:203 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ -static const IndexedType & gather(const T &vec, std::size_t i) │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -A communicator that uses buffers to gather and scatter the data to be send or │ │ │ │ │ -received. │ │ │ │ │ -DDeeffiinniittiioonn communicator.hh:458 │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d │ │ │ │ │ -void backward(Data &data) │ │ │ │ │ -Backward send where target and source are the same. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -BufferedCommunicator() │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_~_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -~BufferedCommunicator() │ │ │ │ │ -Destructor. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d │ │ │ │ │ -void forward(const Data &source, Data &dest) │ │ │ │ │ -Send from source to target. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_r_e_e │ │ │ │ │ -void free() │ │ │ │ │ -Free the allocated memory (i.e. buffers and message information. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d │ │ │ │ │ -std::enable_if< std::is_same< SizeOne, typenameCommPolicy< Data >:: │ │ │ │ │ -IndexedTypeFlag >::value, void >::type build(const Interface &interface) │ │ │ │ │ -Build the buffers and information for the communication process. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_a_c_k_w_a_r_d │ │ │ │ │ -void backward(Data &source, const Data &dest) │ │ │ │ │ -Communicate in the reverse direction, i.e. send from target to source. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_b_u_i_l_d │ │ │ │ │ -void build(const Data &source, const Data &target, const Interface &interface) │ │ │ │ │ -Build the buffers and information for the communication process. │ │ │ │ │ -_D_u_n_e_:_:_B_u_f_f_e_r_e_d_C_o_m_m_u_n_i_c_a_t_o_r_:_:_f_o_r_w_a_r_d │ │ │ │ │ -void forward(Data &data) │ │ │ │ │ -Forward send where target and source are the same. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -Manager class for the mapping between local indices and globally unique │ │ │ │ │ -indices. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:218 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r │ │ │ │ │ -Base class of all classes representing a communication interface. │ │ │ │ │ -DDeeffiinniittiioonn parallel/interface.hh:35 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -Information describing an interface. │ │ │ │ │ -DDeeffiinniittiioonn parallel/interface.hh:101 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e │ │ │ │ │ -Communication interface between remote and local indices. │ │ │ │ │ -DDeeffiinniittiioonn parallel/interface.hh:209 │ │ │ │ │ -_D_u_n_e_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -An index present on the local process. │ │ │ │ │ -DDeeffiinniittiioonn localindex.hh:35 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -The indices present on remote processes. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:189 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ │ -The type of the global index. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:215 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ │ -LocalIndex::Attribute Attribute │ │ │ │ │ -The type of the attribute. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:226 │ │ │ │ │ -_D_u_n_e_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ │ -The type of the local index. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:221 │ │ │ │ │ -_i_n_t_e_r_f_a_c_e_._h_h │ │ │ │ │ -Provides classes for building the communication interface between remote │ │ │ │ │ -indices. │ │ │ │ │ +_D_u_n_e_:_:_m_a_k_e_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ +constexpr auto makeTupleVector(T &&... t) │ │ │ │ │ +DDeeffiinniittiioonn tuplevector.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ +A class augmenting std::tuple by element access via operator[]. │ │ │ │ │ +DDeeffiinniittiioonn tuplevector.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ +static constexpr std::size_t size() │ │ │ │ │ +Number of elements of the tuple. │ │ │ │ │ +DDeeffiinniittiioonn tuplevector.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r_:_:_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ +constexpr TupleVector(TT &&... tt) │ │ │ │ │ +Construct from a set of arguments. │ │ │ │ │ +DDeeffiinniittiioonn tuplevector.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_T_u_p_l_e_V_e_c_t_o_r_:_:_T_u_p_l_e_V_e_c_t_o_r │ │ │ │ │ +constexpr TupleVector() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn tuplevector.hh:61 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00239.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpihelper.hh File Reference │ │ │ │ +dune-common: arraylist.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,72 +65,56 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ Classes | │ │ │ │ Namespaces
    │ │ │ │ -
    mpihelper.hh File Reference
    │ │ │ │ +
    arraylist.hh File Reference
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Helpers for dealing with MPI. │ │ │ │ +

    Implements a random-access container that can efficiently change size (similar to std::deque) │ │ │ │ More...

    │ │ │ │ -
    #include <cassert>
    │ │ │ │ -#include <mpi.h>
    │ │ │ │ -#include <mutex>
    │ │ │ │ -#include <dune/common/parallel/communication.hh>
    │ │ │ │ -#include <dune/common/parallel/mpicommunication.hh>
    │ │ │ │ -#include <dune/common/stdstreams.hh>
    │ │ │ │ -#include <dune/common/visibility.hh>
    │ │ │ │ +
    #include <array>
    │ │ │ │ +#include <cassert>
    │ │ │ │ +#include <memory>
    │ │ │ │ +#include <vector>
    │ │ │ │ +#include "iteratorfacades.hh"
    │ │ │ │
    │ │ │ │

    Go to the source code of this file.

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

    │ │ │ │ Classes

    class  Dune::FakeMPIHelper
     A fake mpi helper. More...
    class  Dune::ArrayList< T, N, A >
     A dynamically growing random access list. More...
     
    class  Dune::MPIHelper
     A real mpi helper. More...
    class  Dune::ArrayListIterator< T, N, A >
     A random access iterator for the Dune::ArrayList class. More...
     
    class  Dune::ConstArrayListIterator< T, N, A >
     A constant random access iterator for the Dune::ArrayList class. More...
     
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    │ │ │ │ Namespaces

    namespace  Dune
     Dune namespace.
     
    │ │ │ │

    Detailed Description

    │ │ │ │ -

    Helpers for dealing with MPI.

    │ │ │ │ -

    Basically there are two helpers available:

    │ │ │ │ -
    FakeMPIHelper
    │ │ │ │ -
    A class adhering to the interface of MPIHelper that does not need MPI at all. This can be used to create a sequential program even if MPI is used to compile it.
    │ │ │ │ -
    MPIHelper
    │ │ │ │ -
    A real MPI helper. When the singleton gets instantiated MPI_Init will be called and before the program exits MPI_Finalize will be called.
    │ │ │ │ -
    │ │ │ │ -

    Example of who to use these classes:

    │ │ │ │ -

    A program that is parallel if compiled with MPI and sequential otherwise:

    int main(int argc, char** argv){
    │ │ │ │ -
    typedef Dune::MPIHelper MPIHelper;
    │ │ │ │ -
    MPIHelper::instance(argc, argv);
    │ │ │ │ -
    typename MPIHelper::MPICommunicator world =
    │ │ │ │ -
    MPIHelper::getCommunicator();
    │ │ │ │ -
    ...
    │ │ │ │ -
    int main(int argc, char **argv)
    Definition mpi_collective_benchmark.cc:293
    │ │ │ │ -
    A real mpi helper.
    Definition mpihelper.hh:179
    │ │ │ │ -

    If one wants to have sequential program even if the code is compiled with mpi then one simply has to exchange the typedef with

    typedef Dune::MPIHelper FakeMPIHelper;
    │ │ │ │ -

    .

    │ │ │ │ -

    For checking whether we really use MPI or just fake please use MPIHelper::isFake (this is also possible at compile time!)

    │ │ │ │ +

    Implements a random-access container that can efficiently change size (similar to std::deque)

    │ │ │ │ +

    This file implements the class ArrayList which behaves like dynamically growing array together with the class ArrayListIterator which is random access iterator as needed by the stl for sorting and other algorithms.

    Author
    Markus Blatt
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,62 +1,41 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -mpihelper.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _P_a_r_a_l_l_e_l_ _C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Helpers for dealing with MPI. _M_o_r_e_._._. │ │ │ │ │ +arraylist.hh File Reference │ │ │ │ │ +Implements a random-access container that can efficiently change size (similar │ │ │ │ │ +to std::deque) _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_i_s_i_b_i_l_i_t_y_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_i_t_e_r_a_t_o_r_f_a_c_a_d_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_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r │ │ │ │ │ -  A fake mpi helper. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_<_ _T_,_ _N_,_ _A_ _> │ │ │ │ │ +  A dynamically growing random access list. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -class   _D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ -  A real mpi helper. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_ _T_,_ _N_,_ _A_ _> │ │ │ │ │ +  A random access iterator for the _D_u_n_e_:_:_A_r_r_a_y_L_i_s_t class. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_ _T_,_ _N_,_ _A_ _> │ │ │ │ │ +  A constant random access iterator for the _D_u_n_e_:_:_A_r_r_a_y_L_i_s_t class. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Helpers for dealing with MPI. │ │ │ │ │ -Basically there are two helpers available: │ │ │ │ │ - FakeMPIHelper │ │ │ │ │ - A class adhering to the interface of MPIHelper that does not need MPI at │ │ │ │ │ - all. This can be used to create a sequential program even if MPI is used │ │ │ │ │ - to compile it. │ │ │ │ │ - MPIHelper │ │ │ │ │ - A real MPI helper. When the singleton gets instantiated MPI_Init will be │ │ │ │ │ - called and before the program exits MPI_Finalize will be called. │ │ │ │ │ -Example of who to use these classes: │ │ │ │ │ -A program that is parallel if compiled with MPI and sequential otherwise: │ │ │ │ │ -int _m_a_i_n(int argc, char** argv){ │ │ │ │ │ -typedef _D_u_n_e_:_:_M_P_I_H_e_l_p_e_r MPIHelper; │ │ │ │ │ -MPIHelper::instance(argc, argv); │ │ │ │ │ -typename MPIHelper::MPICommunicator world = │ │ │ │ │ -MPIHelper::getCommunicator(); │ │ │ │ │ -... │ │ │ │ │ -_m_a_i_n │ │ │ │ │ -int main(int argc, char **argv) │ │ │ │ │ -DDeeffiinniittiioonn mpi_collective_benchmark.cc:293 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ -A real mpi helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:179 │ │ │ │ │ -If one wants to have sequential program even if the code is compiled with mpi │ │ │ │ │ -then one simply has to exchange the typedef with │ │ │ │ │ -typedef _D_u_n_e_:_:_M_P_I_H_e_l_p_e_r FakeMPIHelper; │ │ │ │ │ -. │ │ │ │ │ -For checking whether we really use MPI or just fake please use MPIHelper:: │ │ │ │ │ -isFake (this is also possible at compile time!) │ │ │ │ │ +Implements a random-access container that can efficiently change size (similar │ │ │ │ │ +to std::deque) │ │ │ │ │ +This file implements the class ArrayList which behaves like dynamically growing │ │ │ │ │ +array together with the class ArrayListIterator which is random access iterator │ │ │ │ │ +as needed by the stl for sorting and other algorithms. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00239_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpihelper.hh Source File │ │ │ │ +dune-common: arraylist.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,267 +70,627 @@ │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ -
    mpihelper.hh
    │ │ │ │ +
    arraylist.hh
    │ │ │ │
    │ │ │ │
    │ │ │ │ Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    │ │ │ │
    2// vi: set et ts=4 sw=2 sts=2:
    │ │ │ │
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    │ │ │ │
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    │ │ │ │ -
    5#ifndef DUNE_MPIHELPER
    │ │ │ │ -
    6#define DUNE_MPIHELPER
    │ │ │ │ -
    7
    │ │ │ │ -
    8#if HAVE_MPI
    │ │ │ │ -
    9#include <cassert>
    │ │ │ │ -
    10#include <mpi.h>
    │ │ │ │ -
    11#endif
    │ │ │ │ -
    12
    │ │ │ │ -
    13#include <mutex>
    │ │ │ │ +
    5
    │ │ │ │ +
    6#ifndef DUNE_COMMON_ARRAYLIST_HH
    │ │ │ │ +
    7#define DUNE_COMMON_ARRAYLIST_HH
    │ │ │ │ +
    8
    │ │ │ │ +
    9#include <array>
    │ │ │ │ +
    10#include <cassert>
    │ │ │ │ +
    11#include <memory>
    │ │ │ │ +
    12#include <vector>
    │ │ │ │ +
    13#include "iteratorfacades.hh"
    │ │ │ │
    14
    │ │ │ │ - │ │ │ │ -
    16#if HAVE_MPI
    │ │ │ │ - │ │ │ │ - │ │ │ │ -
    19#endif
    │ │ │ │ - │ │ │ │ -
    21
    │ │ │ │ -
    22namespace Dune
    │ │ │ │ -
    23{
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    74 {
    │ │ │ │ -
    75 public:
    │ │ │ │ -
    80 constexpr static bool isFake = true;
    │ │ │ │ -
    81
    │ │ │ │ - │ │ │ │ -
    86
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    94 {
    │ │ │ │ -
    95 static MPICommunicator comm;
    │ │ │ │ -
    96 return comm;
    │ │ │ │ -
    97 }
    │ │ │ │ -
    │ │ │ │ -
    98
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    106 {
    │ │ │ │ -
    107 return getCommunicator();
    │ │ │ │ -
    108 }
    │ │ │ │ -
    │ │ │ │ -
    109
    │ │ │ │ -
    110
    │ │ │ │ +
    15namespace Dune
    │ │ │ │ +
    16{
    │ │ │ │ +
    17 // forward declaration
    │ │ │ │ +
    18 template<class T, int N, class A>
    │ │ │ │ +
    19 class ArrayListIterator;
    │ │ │ │ +
    20
    │ │ │ │ +
    21 template<class T, int N, class A>
    │ │ │ │ +
    22 class ConstArrayListIterator;
    │ │ │ │ +
    23
    │ │ │ │ +
    60 template<class T, int N=100, class A=std::allocator<T> >
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    62 {
    │ │ │ │ +
    63 public:
    │ │ │ │ +
    69 typedef T MemberType;
    │ │ │ │ +
    70
    │ │ │ │ +
    74 typedef T value_type;
    │ │ │ │ +
    75
    │ │ │ │ +
    79 typedef T& reference;
    │ │ │ │ +
    80
    │ │ │ │ +
    84 typedef const T& const_reference;
    │ │ │ │ +
    85
    │ │ │ │ +
    89 typedef T* pointer;
    │ │ │ │ +
    90
    │ │ │ │ +
    94 typedef const T* const_pointer;
    │ │ │ │ +
    95
    │ │ │ │ +
    100 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    │ │ │ │ +
    101
    │ │ │ │ + │ │ │ │ +
    106
    │ │ │ │ + │ │ │ │
    111
    │ │ │ │ -
    117 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    119 {
    │ │ │ │ - │ │ │ │ -
    121 }
    │ │ │ │ -
    │ │ │ │ -
    122
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    125 {
    │ │ │ │ - │ │ │ │ -
    127 }
    │ │ │ │ -
    │ │ │ │ -
    128
    │ │ │ │ -
    │ │ │ │ -
    144 DUNE_EXPORT static FakeMPIHelper& instance([[maybe_unused]] int argc,
    │ │ │ │ -
    145 [[maybe_unused]] char** argv)
    │ │ │ │ -
    146 {
    │ │ │ │ -
    147 return instance();
    │ │ │ │ -
    148 }
    │ │ │ │ -
    │ │ │ │ -
    149
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    151 {
    │ │ │ │ -
    152 static FakeMPIHelper singleton;
    │ │ │ │ -
    153 return singleton;
    │ │ │ │ -
    154 }
    │ │ │ │ -
    │ │ │ │ -
    155
    │ │ │ │ -
    159 int rank () const { return 0; }
    │ │ │ │ -
    163 int size () const { return 1; }
    │ │ │ │ -
    164
    │ │ │ │ -
    165 private:
    │ │ │ │ -
    166 FakeMPIHelper() {}
    │ │ │ │ -
    167 FakeMPIHelper(const FakeMPIHelper&);
    │ │ │ │ -
    168 FakeMPIHelper& operator=(const FakeMPIHelper);
    │ │ │ │ -
    169 };
    │ │ │ │ -
    │ │ │ │ -
    170
    │ │ │ │ -
    171#if HAVE_MPI
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    179 {
    │ │ │ │ -
    180 public:
    │ │ │ │ -
    185 constexpr static bool isFake = false;
    │ │ │ │ -
    186
    │ │ │ │ -
    190 typedef MPI_Comm MPICommunicator;
    │ │ │ │ -
    191
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    199 {
    │ │ │ │ -
    200 return MPI_COMM_WORLD;
    │ │ │ │ -
    201 }
    │ │ │ │ -
    │ │ │ │ +
    115 typedef std::size_t size_type;
    │ │ │ │ +
    116
    │ │ │ │ +
    120 typedef std::ptrdiff_t difference_type;
    │ │ │ │ +
    121
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    127
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    134
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    140
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    146
    │ │ │ │ +
    │ │ │ │ +
    151 inline void push_back(const_reference entry);
    │ │ │ │ +
    152
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    159
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    166
    │ │ │ │ +
    │ │ │ │ +
    171 inline size_type size() const;
    │ │ │ │ +
    172
    │ │ │ │ +
    │ │ │ │ +
    180 inline void purge();
    │ │ │ │ +
    181
    │ │ │ │ +
    │ │ │ │ +
    185 inline void clear();
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    190
    │ │ │ │ +
    191 private:
    │ │ │ │ +
    192
    │ │ │ │ +
    196 using SmartPointerAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::shared_ptr< std::array<MemberType,chunkSize_> > >;
    │ │ │ │ +
    197
    │ │ │ │ +
    201 using ArrayAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::array<MemberType,chunkSize_> >;
    │ │ │ │
    202
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    210 {
    │ │ │ │ -
    211 return MPI_COMM_SELF;
    │ │ │ │ -
    212 }
    │ │ │ │ -
    │ │ │ │ -
    213
    │ │ │ │ -
    219 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    222 {
    │ │ │ │ - │ │ │ │ -
    224 }
    │ │ │ │ -
    │ │ │ │ -
    225
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    228 {
    │ │ │ │ - │ │ │ │ -
    230 }
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    246 DUNE_EXPORT static MPIHelper& instance(int& argc, char**& argv)
    │ │ │ │ -
    247 {
    │ │ │ │ -
    248 // create singleton instance
    │ │ │ │ -
    249 if (!instance_){
    │ │ │ │ -
    250 static std::mutex mutex;
    │ │ │ │ -
    251 std::lock_guard<std::mutex> guard(mutex);
    │ │ │ │ -
    252 if(!instance_)
    │ │ │ │ -
    253 instance_.reset(new MPIHelper(argc,argv));
    │ │ │ │ -
    254 }
    │ │ │ │ -
    255 return *instance_;
    │ │ │ │ -
    256 }
    │ │ │ │ -
    │ │ │ │ -
    257
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    259 {
    │ │ │ │ -
    260 if(!instance_)
    │ │ │ │ -
    261 DUNE_THROW(InvalidStateException, "MPIHelper not initialized! Call MPIHelper::instance(argc, argv) with arguments first.");
    │ │ │ │ -
    262 return *instance_;
    │ │ │ │ -
    263 }
    │ │ │ │ -
    │ │ │ │ +
    206 friend class ArrayListIterator<T,N,A>;
    │ │ │ │ +
    207 friend class ConstArrayListIterator<T,N,A>;
    │ │ │ │ +
    208
    │ │ │ │ +
    210 std::vector<std::shared_ptr<std::array<MemberType,chunkSize_> >,
    │ │ │ │ +
    211 SmartPointerAllocator> chunks_;
    │ │ │ │ +
    220 size_type capacity_;
    │ │ │ │ +
    222 size_type size_;
    │ │ │ │ +
    224 size_type start_;
    │ │ │ │ +
    233 inline reference elementAt(size_type i);
    │ │ │ │ +
    234
    │ │ │ │ +
    243 inline const_reference elementAt(size_type i) const;
    │ │ │ │ +
    244 };
    │ │ │ │ +
    245
    │ │ │ │ +
    246
    │ │ │ │ +
    250 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ +
    251 class ArrayListIterator : public RandomAccessIteratorFacade<ArrayListIterator<T,N,A>,
    │ │ │ │ +
    252 typename A::value_type,
    │ │ │ │ +
    253 typename A::value_type &,
    │ │ │ │ +
    254 typename A::difference_type>
    │ │ │ │ +
    255 {
    │ │ │ │ +
    256
    │ │ │ │ +
    257 friend class ArrayList<T,N,A>;
    │ │ │ │ +
    258 friend class ConstArrayListIterator<T,N,A>;
    │ │ │ │ +
    259 public:
    │ │ │ │ +
    263 typedef typename A::value_type MemberType;
    │ │ │ │
    264
    │ │ │ │ -
    268 int rank () const { return rank_; }
    │ │ │ │ -
    272 int size () const { return size_; }
    │ │ │ │ -
    273
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    276 {
    │ │ │ │ -
    277 int wasFinalized = -1;
    │ │ │ │ -
    278 MPI_Finalized( &wasFinalized );
    │ │ │ │ -
    279 if(!wasFinalized && initializedHere_)
    │ │ │ │ -
    280 {
    │ │ │ │ -
    281 MPI_Finalize();
    │ │ │ │ -
    282 dverb << "Called MPI_Finalize on p=" << rank_ << "!" <<std::endl;
    │ │ │ │ -
    283 }
    │ │ │ │ -
    284
    │ │ │ │ -
    285 }
    │ │ │ │ -
    │ │ │ │ -
    286
    │ │ │ │ -
    287 private:
    │ │ │ │ -
    288 int rank_;
    │ │ │ │ -
    289 int size_;
    │ │ │ │ -
    290 bool initializedHere_;
    │ │ │ │ -
    291 void prevent_warning(int){}
    │ │ │ │ -
    292 static inline std::unique_ptr<MPIHelper> instance_ = {};
    │ │ │ │ -
    293
    │ │ │ │ -
    295 MPIHelper(int& argc, char**& argv)
    │ │ │ │ -
    296 : initializedHere_(false)
    │ │ │ │ -
    297 {
    │ │ │ │ -
    298 int wasInitialized = -1;
    │ │ │ │ -
    299 MPI_Initialized( &wasInitialized );
    │ │ │ │ -
    300 if(!wasInitialized)
    │ │ │ │ -
    301 {
    │ │ │ │ -
    302 rank_ = -1;
    │ │ │ │ -
    303 size_ = -1;
    │ │ │ │ -
    304 static int is_initialized = MPI_Init(&argc, &argv);
    │ │ │ │ -
    305 prevent_warning(is_initialized);
    │ │ │ │ -
    306 initializedHere_ = true;
    │ │ │ │ -
    307 }
    │ │ │ │ -
    308
    │ │ │ │ -
    309 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
    │ │ │ │ -
    310 MPI_Comm_size(MPI_COMM_WORLD,&size_);
    │ │ │ │ -
    311
    │ │ │ │ -
    312 assert( rank_ >= 0 );
    │ │ │ │ -
    313 assert( size_ >= 1 );
    │ │ │ │ -
    314
    │ │ │ │ -
    315 dverb << "Called MPI_Init on p=" << rank_ << "!" << std::endl;
    │ │ │ │ -
    316 }
    │ │ │ │ -
    317
    │ │ │ │ -
    318 MPIHelper(const MPIHelper&);
    │ │ │ │ -
    319 MPIHelper& operator=(const MPIHelper);
    │ │ │ │ -
    320 };
    │ │ │ │ -
    │ │ │ │ -
    321#else // !HAVE_MPI
    │ │ │ │ -
    322 // We do not have MPI therefore FakeMPIHelper
    │ │ │ │ -
    323 // is the MPIHelper
    │ │ │ │ -
    328 typedef FakeMPIHelper MPIHelper;
    │ │ │ │ +
    265 typedef typename A::difference_type difference_type;
    │ │ │ │ +
    266
    │ │ │ │ +
    267 typedef typename A::size_type size_type;
    │ │ │ │ +
    268
    │ │ │ │ +
    269 using reference = typename A::value_type &;
    │ │ │ │ +
    270
    │ │ │ │ +
    271 using const_reference = typename A::value_type const&;
    │ │ │ │ +
    272
    │ │ │ │ +
    278 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    │ │ │ │ +
    279
    │ │ │ │ +
    280
    │ │ │ │ +
    286 inline bool equals(const ArrayListIterator<MemberType,N,A>& other) const;
    │ │ │ │ +
    287
    │ │ │ │ +
    293 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    │ │ │ │ +
    294
    │ │ │ │ +
    298 inline void increment();
    │ │ │ │ +
    299
    │ │ │ │ +
    303 inline void decrement();
    │ │ │ │ +
    304
    │ │ │ │ +
    309 inline reference elementAt(size_type i) const;
    │ │ │ │ +
    310
    │ │ │ │ +
    315 inline reference dereference() const;
    │ │ │ │ +
    316
    │ │ │ │ +
    328 inline void eraseToHere();
    │ │ │ │
    329
    │ │ │ │ -
    330#endif // !HAVE_MPI
    │ │ │ │ -
    331
    │ │ │ │ -
    332} // end namespace Dune
    │ │ │ │ -
    333#endif
    │ │ │ │ -
    Definition of macros controlling symbol visibility at the ABI level.
    │ │ │ │ -
    #define DUNE_EXPORT
    Export a symbol as part of the public ABI.
    Definition visibility.hh:20
    │ │ │ │ -
    Implements an utility class that provides MPI's collective communication methods.
    │ │ │ │ -
    Implements an utility class that provides collective communication methods for sequential programs.
    │ │ │ │ -
    Standard Dune debug streams.
    │ │ │ │ -
    #define DUNE_THROW(E, m)
    Definition exceptions.hh:218
    │ │ │ │ -
    DVerbType dverb(std::cout)
    Singleton of verbose debug stream.
    Definition stdstreams.hh:116
    │ │ │ │ +
    331 inline size_type position(){return position_;}
    │ │ │ │ +
    332
    │ │ │ │ +
    334 inline void advance(difference_type n);
    │ │ │ │ +
    335
    │ │ │ │ +
    337 inline difference_type distanceTo(const ArrayListIterator<T,N,A>& other) const;
    │ │ │ │ +
    338
    │ │ │ │ +
    │ │ │ │ +
    340 inline ArrayListIterator() : position_(0), list_(nullptr)
    │ │ │ │ +
    341 {}
    │ │ │ │ +
    │ │ │ │ +
    342
    │ │ │ │ +
    343 private:
    │ │ │ │ + │ │ │ │ +
    350
    │ │ │ │ +
    354 size_type position_;
    │ │ │ │ + │ │ │ │ +
    359 };
    │ │ │ │ +
    │ │ │ │ +
    360
    │ │ │ │ +
    364 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    366 : public RandomAccessIteratorFacade<ConstArrayListIterator<T,N,A>,
    │ │ │ │ +
    367 const typename A::value_type,
    │ │ │ │ +
    368 typename A::value_type const&,
    │ │ │ │ +
    369 typename A::difference_type>
    │ │ │ │ +
    370 {
    │ │ │ │ +
    371
    │ │ │ │ +
    372 friend class ArrayList<T,N,A>;
    │ │ │ │ +
    373 friend class ArrayListIterator<T,N,A>;
    │ │ │ │ +
    374
    │ │ │ │ +
    375 public:
    │ │ │ │ +
    379 typedef typename A::value_type MemberType;
    │ │ │ │ +
    380
    │ │ │ │ +
    381 typedef typename A::difference_type difference_type;
    │ │ │ │ +
    382
    │ │ │ │ +
    383 typedef typename A::size_type size_type;
    │ │ │ │ +
    384
    │ │ │ │ +
    385 using reference = typename A::value_type &;
    │ │ │ │ +
    386
    │ │ │ │ +
    387 using const_reference = typename A::value_type const&;
    │ │ │ │ +
    388
    │ │ │ │ +
    394 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    │ │ │ │ +
    395
    │ │ │ │ +
    │ │ │ │ +
    401 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    │ │ │ │ +
    402
    │ │ │ │ +
    │ │ │ │ +
    406 inline void increment();
    │ │ │ │ +
    407
    │ │ │ │ +
    │ │ │ │ +
    411 inline void decrement();
    │ │ │ │ +
    412
    │ │ │ │ +
    │ │ │ │ +
    414 inline void advance(difference_type n);
    │ │ │ │ +
    415
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    418
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    424
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    430
    │ │ │ │ +
    │ │ │ │ +
    431 inline ConstArrayListIterator() : position_(0), list_(nullptr)
    │ │ │ │ +
    432 {}
    │ │ │ │ +
    │ │ │ │ +
    433
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    435
    │ │ │ │ +
    436 private:
    │ │ │ │ +
    437
    │ │ │ │ +
    443 inline ConstArrayListIterator(const ArrayList<T,N,A>& arrayList, size_type position);
    │ │ │ │ +
    444
    │ │ │ │ +
    448 size_type position_;
    │ │ │ │ +
    452 const ArrayList<T,N,A>* list_;
    │ │ │ │ +
    453 };
    │ │ │ │ +
    454
    │ │ │ │ +
    455
    │ │ │ │ +
    456 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    458 : capacity_(0), size_(0), start_(0)
    │ │ │ │ +
    459 {
    │ │ │ │ +
    460 chunks_.reserve(100);
    │ │ │ │ +
    461 }
    │ │ │ │ +
    │ │ │ │ +
    462
    │ │ │ │ +
    463 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    465 capacity_=0;
    │ │ │ │ +
    466 size_=0;
    │ │ │ │ +
    467 start_=0;
    │ │ │ │ +
    468 chunks_.clear();
    │ │ │ │ +
    469 }
    │ │ │ │ +
    │ │ │ │ +
    470
    │ │ │ │ +
    471 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    473 {
    │ │ │ │ +
    474 return size_;
    │ │ │ │ +
    475 }
    │ │ │ │ +
    │ │ │ │ +
    476
    │ │ │ │ +
    477 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    479 {
    │ │ │ │ +
    480 size_t index=start_+size_;
    │ │ │ │ +
    481 if(index==capacity_)
    │ │ │ │ +
    482 {
    │ │ │ │ +
    483 chunks_.push_back(std::make_shared<std::array<MemberType,chunkSize_> >());
    │ │ │ │ +
    484 capacity_ += chunkSize_;
    │ │ │ │ +
    485 }
    │ │ │ │ +
    486 elementAt(index)=entry;
    │ │ │ │ +
    487 ++size_;
    │ │ │ │ +
    488 }
    │ │ │ │ +
    │ │ │ │ +
    489
    │ │ │ │ +
    490 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    492 {
    │ │ │ │ +
    493 return elementAt(start_+i);
    │ │ │ │ +
    494 }
    │ │ │ │ +
    │ │ │ │ +
    495
    │ │ │ │ +
    496
    │ │ │ │ +
    497 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    499 {
    │ │ │ │ +
    500 return elementAt(start_+i);
    │ │ │ │ +
    501 }
    │ │ │ │ +
    │ │ │ │ +
    502
    │ │ │ │ +
    503 template<class T, int N, class A>
    │ │ │ │ + │ │ │ │ +
    505 {
    │ │ │ │ +
    506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    │ │ │ │ +
    507 }
    │ │ │ │ +
    508
    │ │ │ │ +
    509
    │ │ │ │ +
    510 template<class T, int N, class A>
    │ │ │ │ +
    511 typename ArrayList<T,N,A>::const_reference ArrayList<T,N,A>::elementAt(size_type i) const
    │ │ │ │ +
    512 {
    │ │ │ │ +
    513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    │ │ │ │ +
    514 }
    │ │ │ │ +
    515
    │ │ │ │ +
    516 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    518 {
    │ │ │ │ +
    519 return ArrayListIterator<T,N,A>(*this, start_);
    │ │ │ │ +
    520 }
    │ │ │ │ +
    │ │ │ │ +
    521
    │ │ │ │ +
    522 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    524 {
    │ │ │ │ +
    525 return ConstArrayListIterator<T,N,A>(*this, start_);
    │ │ │ │ +
    526 }
    │ │ │ │ +
    │ │ │ │ +
    527
    │ │ │ │ +
    528 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    530 {
    │ │ │ │ +
    531 return ArrayListIterator<T,N,A>(*this, start_+size_);
    │ │ │ │ +
    532 }
    │ │ │ │ +
    │ │ │ │ +
    533
    │ │ │ │ +
    534 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    536 {
    │ │ │ │ +
    537 return ConstArrayListIterator<T,N,A>(*this, start_+size_);
    │ │ │ │ +
    538 }
    │ │ │ │ +
    │ │ │ │ +
    539
    │ │ │ │ +
    540 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    542 {
    │ │ │ │ +
    543 // Distance to copy to the left.
    │ │ │ │ +
    544 size_t distance = start_/chunkSize_;
    │ │ │ │ +
    545 if(distance>0) {
    │ │ │ │ +
    546 // Number of chunks with entries in it;
    │ │ │ │ +
    547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ );
    │ │ │ │ +
    548
    │ │ │ │ +
    549 // Copy chunks to the left.
    │ │ │ │ +
    550 std::copy(chunks_.begin()+distance,
    │ │ │ │ +
    551 chunks_.begin()+(distance+chunks), chunks_.begin());
    │ │ │ │ +
    552
    │ │ │ │ +
    553 // Calculate new parameters
    │ │ │ │ +
    554 start_ = start_ % chunkSize_;
    │ │ │ │ +
    555 //capacity += distance * chunkSize_;
    │ │ │ │ +
    556 }
    │ │ │ │ +
    557 }
    │ │ │ │ +
    │ │ │ │ +
    558
    │ │ │ │ +
    559 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    561 {
    │ │ │ │ +
    562 position_+=i;
    │ │ │ │ +
    563 }
    │ │ │ │ +
    │ │ │ │ +
    564
    │ │ │ │ +
    565 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    567 {
    │ │ │ │ +
    568 position_+=i;
    │ │ │ │ +
    569 }
    │ │ │ │ +
    │ │ │ │ +
    570
    │ │ │ │ +
    571
    │ │ │ │ +
    572 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    574 {
    │ │ │ │ +
    575 // Makes only sense if we reference a common list
    │ │ │ │ +
    576 assert(list_==(other.list_));
    │ │ │ │ +
    577 return position_==other.position_ ;
    │ │ │ │ +
    578 }
    │ │ │ │ +
    │ │ │ │ +
    579
    │ │ │ │ +
    580
    │ │ │ │ +
    581 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    583 {
    │ │ │ │ +
    584 // Makes only sense if we reference a common list
    │ │ │ │ +
    585 assert(list_==(other.list_));
    │ │ │ │ +
    586 return position_==other.position_ ;
    │ │ │ │ +
    587 }
    │ │ │ │ +
    │ │ │ │ +
    588
    │ │ │ │ +
    589
    │ │ │ │ +
    590 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    592 {
    │ │ │ │ +
    593 // Makes only sense if we reference a common list
    │ │ │ │ +
    594 assert(list_==(other.list_));
    │ │ │ │ +
    595 return position_==other.position_ ;
    │ │ │ │ +
    596 }
    │ │ │ │ +
    │ │ │ │ +
    597
    │ │ │ │ +
    598 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    600 {
    │ │ │ │ +
    601 ++position_;
    │ │ │ │ +
    602 }
    │ │ │ │ +
    │ │ │ │ +
    603
    │ │ │ │ +
    604 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    606 {
    │ │ │ │ +
    607 ++position_;
    │ │ │ │ +
    608 }
    │ │ │ │ +
    │ │ │ │ +
    609
    │ │ │ │ +
    610 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    612 {
    │ │ │ │ +
    613 --position_;
    │ │ │ │ +
    614 }
    │ │ │ │ +
    │ │ │ │ +
    615
    │ │ │ │ +
    616 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    618 {
    │ │ │ │ +
    619 --position_;
    │ │ │ │ +
    620 }
    │ │ │ │ +
    │ │ │ │ +
    621
    │ │ │ │ +
    622 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    624 {
    │ │ │ │ +
    625 return list_->elementAt(i+position_);
    │ │ │ │ +
    626 }
    │ │ │ │ +
    │ │ │ │ +
    627
    │ │ │ │ +
    628 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    630 {
    │ │ │ │ +
    631 return list_->elementAt(i+position_);
    │ │ │ │ +
    632 }
    │ │ │ │ +
    │ │ │ │ +
    633
    │ │ │ │ +
    634 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    636 {
    │ │ │ │ +
    637 return list_->elementAt(position_);
    │ │ │ │ +
    638 }
    │ │ │ │ +
    │ │ │ │ +
    639
    │ │ │ │ +
    640 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    642 {
    │ │ │ │ +
    643 return list_->elementAt(position_);
    │ │ │ │ +
    644 }
    │ │ │ │ +
    │ │ │ │ +
    645
    │ │ │ │ +
    646 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    648 {
    │ │ │ │ +
    649 // Makes only sense if we reference a common list
    │ │ │ │ +
    650 assert(list_==(other.list_));
    │ │ │ │ +
    651 return other.position_ - position_;
    │ │ │ │ +
    652 }
    │ │ │ │ +
    │ │ │ │ +
    653
    │ │ │ │ +
    654 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    656 {
    │ │ │ │ +
    657 // Makes only sense if we reference a common list
    │ │ │ │ +
    658 assert(list_==(other.list_));
    │ │ │ │ +
    659 return other.position_ - position_;
    │ │ │ │ +
    660 }
    │ │ │ │ +
    │ │ │ │ +
    661
    │ │ │ │ +
    662 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    664 {
    │ │ │ │ +
    665 list_->size_ -= ++position_ - list_->start_;
    │ │ │ │ +
    666 // chunk number of the new position.
    │ │ │ │ +
    667 size_t posChunkStart = position_ / chunkSize_;
    │ │ │ │ +
    668 // number of chunks to deallocate
    │ │ │ │ +
    669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_)
    │ │ │ │ +
    670 / chunkSize_;
    │ │ │ │ +
    671 list_->start_ = position_;
    │ │ │ │ +
    672
    │ │ │ │ +
    673 // Deallocate memory not needed any more.
    │ │ │ │ +
    674 for(size_t chunk=0; chunk<chunks; chunk++) {
    │ │ │ │ +
    675 --posChunkStart;
    │ │ │ │ +
    676 list_->chunks_[posChunkStart].reset();
    │ │ │ │ +
    677 }
    │ │ │ │ +
    678
    │ │ │ │ +
    679 // Capacity stays the same as the chunks before us
    │ │ │ │ +
    680 // are still there. They null pointers.
    │ │ │ │ +
    681 assert(list_->start_+list_->size_<=list_->capacity_);
    │ │ │ │ +
    682 }
    │ │ │ │ +
    │ │ │ │ +
    683
    │ │ │ │ +
    684 template<class T, int N, class A>
    │ │ │ │ + │ │ │ │ +
    686 : position_(position), list_(&arrayList)
    │ │ │ │ +
    687 {}
    │ │ │ │ +
    688
    │ │ │ │ +
    689
    │ │ │ │ +
    690 template<class T, int N, class A>
    │ │ │ │ +
    691 ConstArrayListIterator<T,N,A>::ConstArrayListIterator(const ArrayList<T,N,A>& arrayList,
    │ │ │ │ +
    692 size_type position)
    │ │ │ │ +
    693 : position_(position), list_(&arrayList)
    │ │ │ │ +
    694 {}
    │ │ │ │ +
    695
    │ │ │ │ +
    696 template<class T, int N, class A>
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    698 : position_(other.position_), list_(other.list_)
    │ │ │ │ +
    699 {}
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    700
    │ │ │ │ +
    701
    │ │ │ │ +
    703}
    │ │ │ │ +
    704#endif
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    This file implements iterator facade classes for writing stl conformant iterators.
    │ │ │ │ +
    reference operator[](size_type i)
    Get the element at specific position.
    Definition arraylist.hh:491
    │ │ │ │ +
    iterator begin()
    Get an iterator that is positioned at the first element.
    Definition arraylist.hh:517
    │ │ │ │ +
    bool equals(const ArrayListIterator< MemberType, N, A > &other) const
    Comares two iterators.
    Definition arraylist.hh:573
    │ │ │ │ +
    void increment()
    Increment the iterator.
    Definition arraylist.hh:599
    │ │ │ │ +
    size_type size() const
    Get the number of elements in the list.
    Definition arraylist.hh:472
    │ │ │ │ +
    ConstArrayListIterator(const ArrayListIterator< T, N, A > &other)
    Definition arraylist.hh:697
    │ │ │ │ +
    void purge()
    Purge the list.
    Definition arraylist.hh:541
    │ │ │ │ +
    void decrement()
    decrement the iterator.
    Definition arraylist.hh:611
    │ │ │ │ +
    void eraseToHere()
    Erase all entries before the current position and the one at the current position.
    Definition arraylist.hh:663
    │ │ │ │ +
    ArrayList()
    Constructs an Array list with one chunk.
    Definition arraylist.hh:457
    │ │ │ │ +
    const_iterator begin() const
    Get a random access iterator that is positioned at the first element.
    Definition arraylist.hh:523
    │ │ │ │ +
    void increment()
    Increment the iterator.
    Definition arraylist.hh:605
    │ │ │ │ +
    iterator end()
    Get a random access iterator positioned after the last element.
    Definition arraylist.hh:529
    │ │ │ │ +
    const_reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition arraylist.hh:629
    │ │ │ │ +
    const_reference operator[](size_type i) const
    Get the element at specific position.
    Definition arraylist.hh:498
    │ │ │ │ +
    void decrement()
    decrement the iterator.
    Definition arraylist.hh:617
    │ │ │ │ +
    void advance(difference_type n)
    Definition arraylist.hh:566
    │ │ │ │ +
    const_iterator end() const
    Get a random access iterator positioned after the last element.
    Definition arraylist.hh:535
    │ │ │ │ +
    const_reference dereference() const
    Access the element at the current position.
    Definition arraylist.hh:641
    │ │ │ │ +
    void clear()
    Delete all entries from the list.
    Definition arraylist.hh:464
    │ │ │ │ +
    reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition arraylist.hh:623
    │ │ │ │ +
    bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const
    Comares to iterators.
    Definition arraylist.hh:591
    │ │ │ │ +
    void advance(difference_type n)
    Definition arraylist.hh:560
    │ │ │ │ +
    difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other) const
    Definition arraylist.hh:655
    │ │ │ │ +
    reference dereference() const
    Access the element at the current position.
    Definition arraylist.hh:635
    │ │ │ │ +
    void push_back(const_reference entry)
    Append an entry to the list.
    Definition arraylist.hh:478
    │ │ │ │ +
    difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const
    Definition arraylist.hh:647
    │ │ │ │
    Dune namespace.
    Definition alignedallocator.hh:13
    │ │ │ │ -
    Default exception if a function was called while the object is not in a valid state for that function...
    Definition exceptions.hh:281
    │ │ │ │ -
    Definition communication.hh:46
    │ │ │ │ -
    Collective communication interface and sequential default implementation.
    Definition communication.hh:100
    │ │ │ │ -
    A fake mpi helper.
    Definition mpihelper.hh:74
    │ │ │ │ -
    static DUNE_EXPORT MPICommunicator getCommunicator()
    get the default communicator
    Definition mpihelper.hh:93
    │ │ │ │ -
    int size() const
    return rank of process, i.e. one
    Definition mpihelper.hh:163
    │ │ │ │ -
    static Communication< MPICommunicator > getCollectiveCommunication()
    Definition mpihelper.hh:118
    │ │ │ │ -
    static MPICommunicator getLocalCommunicator()
    get a local communicator
    Definition mpihelper.hh:105
    │ │ │ │ -
    No_Comm MPICommunicator
    The type of the mpi communicator.
    Definition mpihelper.hh:85
    │ │ │ │ -
    static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
    Get the singleton instance of the helper.
    Definition mpihelper.hh:144
    │ │ │ │ -
    static DUNE_EXPORT FakeMPIHelper & instance()
    Definition mpihelper.hh:150
    │ │ │ │ -
    static Communication< MPICommunicator > getCommunication()
    Definition mpihelper.hh:124
    │ │ │ │ -
    static constexpr bool isFake
    Are we fake (i.e. pretend to have MPI support but are compiled without.)
    Definition mpihelper.hh:80
    │ │ │ │ -
    int rank() const
    return rank of process, i.e. zero
    Definition mpihelper.hh:159
    │ │ │ │ -
    A real mpi helper.
    Definition mpihelper.hh:179
    │ │ │ │ -
    int size() const
    return number of processes
    Definition mpihelper.hh:272
    │ │ │ │ -
    static DUNE_EXPORT MPIHelper & instance()
    Definition mpihelper.hh:258
    │ │ │ │ -
    static constexpr bool isFake
    Are we fake (i. e. pretend to have MPI support but are compiled without.
    Definition mpihelper.hh:185
    │ │ │ │ -
    static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
    Get the singleton instance of the helper.
    Definition mpihelper.hh:246
    │ │ │ │ -
    static Communication< MPICommunicator > getCommunication()
    Definition mpihelper.hh:227
    │ │ │ │ -
    ~MPIHelper()
    calls MPI_Finalize
    Definition mpihelper.hh:275
    │ │ │ │ -
    int rank() const
    return rank of process
    Definition mpihelper.hh:268
    │ │ │ │ -
    MPI_Comm MPICommunicator
    The type of the mpi communicator.
    Definition mpihelper.hh:190
    │ │ │ │ -
    static MPICommunicator getCommunicator()
    get the default communicator
    Definition mpihelper.hh:198
    │ │ │ │ -
    static MPICommunicator getLocalCommunicator()
    get a local communicator
    Definition mpihelper.hh:209
    │ │ │ │ -
    static Communication< MPICommunicator > getCollectiveCommunication()
    Definition mpihelper.hh:221
    │ │ │ │ +
    A random access iterator for the Dune::ArrayList class.
    Definition arraylist.hh:255
    │ │ │ │ +
    size_type position()
    Definition arraylist.hh:331
    │ │ │ │ +
    A::value_type MemberType
    The member type.
    Definition arraylist.hh:263
    │ │ │ │ +
    ArrayListIterator()
    Standard constructor.
    Definition arraylist.hh:340
    │ │ │ │ +
    A::difference_type difference_type
    Definition arraylist.hh:265
    │ │ │ │ +
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition arraylist.hh:278
    │ │ │ │ +
    A::size_type size_type
    Definition arraylist.hh:267
    │ │ │ │ +
    typename A::value_type const & const_reference
    Definition arraylist.hh:271
    │ │ │ │ +
    typename A::value_type & reference
    Definition arraylist.hh:269
    │ │ │ │ +
    A constant random access iterator for the Dune::ArrayList class.
    Definition arraylist.hh:370
    │ │ │ │ +
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition arraylist.hh:394
    │ │ │ │ +
    typename A::value_type & reference
    Definition arraylist.hh:385
    │ │ │ │ +
    ConstArrayListIterator()
    Definition arraylist.hh:431
    │ │ │ │ +
    A::value_type MemberType
    The member type.
    Definition arraylist.hh:379
    │ │ │ │ +
    A::difference_type difference_type
    Definition arraylist.hh:381
    │ │ │ │ +
    typename A::value_type const & const_reference
    Definition arraylist.hh:387
    │ │ │ │ +
    A::size_type size_type
    Definition arraylist.hh:383
    │ │ │ │ +
    A dynamically growing random access list.
    Definition arraylist.hh:62
    │ │ │ │ +
    T value_type
    Value type for stl compliance.
    Definition arraylist.hh:74
    │ │ │ │ +
    static constexpr int chunkSize_
    The number of elements in one chunk of the list. This has to be at least one. The default is 100.
    Definition arraylist.hh:100
    │ │ │ │ +
    const T * const_pointer
    The type of a const pointer to the type we store.
    Definition arraylist.hh:94
    │ │ │ │ +
    ArrayListIterator< MemberType, N, A > iterator
    A random access iterator.
    Definition arraylist.hh:105
    │ │ │ │ +
    const T & const_reference
    The type of a const reference to the type we store.
    Definition arraylist.hh:84
    │ │ │ │ +
    T & reference
    The type of a reference to the type we store.
    Definition arraylist.hh:79
    │ │ │ │ +
    std::size_t size_type
    The size type.
    Definition arraylist.hh:115
    │ │ │ │ +
    T MemberType
    The member type that is stored.
    Definition arraylist.hh:69
    │ │ │ │ +
    T * pointer
    The type of a pointer to the type we store.
    Definition arraylist.hh:89
    │ │ │ │ +
    ConstArrayListIterator< MemberType, N, A > const_iterator
    A constant random access iterator.
    Definition arraylist.hh:110
    │ │ │ │ +
    std::ptrdiff_t difference_type
    The difference type.
    Definition arraylist.hh:120
    │ │ │ │ +
    Base class for stl conformant forward iterators.
    Definition iteratorfacades.hh:434
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,314 +1,698 @@ │ │ │ │ │ dune-common 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpihelper.hh │ │ │ │ │ +arraylist.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// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5#ifndef DUNE_MPIHELPER │ │ │ │ │ -6#define DUNE_MPIHELPER │ │ │ │ │ -7 │ │ │ │ │ -8#if HAVE_MPI │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#endif │ │ │ │ │ -12 │ │ │ │ │ -13#include │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_COMMON_ARRAYLIST_HH │ │ │ │ │ +7#define DUNE_COMMON_ARRAYLIST_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include "_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h" │ │ │ │ │ 14 │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -16#if HAVE_MPI │ │ │ │ │ -17#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -18#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ -19#endif │ │ │ │ │ -20#include <_d_u_n_e_/_c_o_m_m_o_n_/_v_i_s_i_b_i_l_i_t_y_._h_h> │ │ │ │ │ -21 │ │ │ │ │ -22namespace _D_u_n_e │ │ │ │ │ -23{ │ │ │ │ │ -_7_3 class _F_a_k_e_M_P_I_H_e_l_p_e_r │ │ │ │ │ -74 { │ │ │ │ │ -75 public: │ │ │ │ │ -_8_0 constexpr static bool _i_s_F_a_k_e = true; │ │ │ │ │ -81 │ │ │ │ │ -_8_5 typedef _N_o___C_o_m_m _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ -86 │ │ │ │ │ -_9_3 _D_U_N_E___E_X_P_O_R_T static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ -94 { │ │ │ │ │ -95 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r comm; │ │ │ │ │ -96 return comm; │ │ │ │ │ -97 } │ │ │ │ │ -98 │ │ │ │ │ -_1_0_5 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ -106 { │ │ │ │ │ -107 return _g_e_t_C_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ -108 } │ │ │ │ │ -109 │ │ │ │ │ -110 │ │ │ │ │ +15namespace _D_u_n_e │ │ │ │ │ +16{ │ │ │ │ │ +17 // forward declaration │ │ │ │ │ +18 template │ │ │ │ │ +19 class ArrayListIterator; │ │ │ │ │ +20 │ │ │ │ │ +21 template │ │ │ │ │ +22 class ConstArrayListIterator; │ │ │ │ │ +23 │ │ │ │ │ +60 template > │ │ │ │ │ +_6_1 class _A_r_r_a_y_L_i_s_t │ │ │ │ │ +62 { │ │ │ │ │ +63 public: │ │ │ │ │ +_6_9 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ +70 │ │ │ │ │ +_7_4 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +75 │ │ │ │ │ +_7_9 typedef T& _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +80 │ │ │ │ │ +_8_4 typedef const T& _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +85 │ │ │ │ │ +_8_9 typedef T* _p_o_i_n_t_e_r; │ │ │ │ │ +90 │ │ │ │ │ +_9_4 typedef const T* _c_o_n_s_t___p_o_i_n_t_e_r; │ │ │ │ │ +95 │ │ │ │ │ +_1_0_0 constexpr static int _c_h_u_n_k_S_i_z_e__ = (N > 0) ? N : 1; │ │ │ │ │ +101 │ │ │ │ │ +_1_0_5 typedef _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_> _i_t_e_r_a_t_o_r; │ │ │ │ │ +106 │ │ │ │ │ +_1_1_0 typedef _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_> _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ 111 │ │ │ │ │ -117 [[deprecated("getCollectionCommunication is deprecated. Use │ │ │ │ │ -getCommunication instead.")]] │ │ │ │ │ -_1_1_8 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> _g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ -119 { │ │ │ │ │ -120 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -121 } │ │ │ │ │ -122 │ │ │ │ │ -123 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> │ │ │ │ │ -_1_2_4 _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ -125 { │ │ │ │ │ -126 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -_1_4_4 _D_U_N_E___E_X_P_O_R_T static _F_a_k_e_M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e([[maybe_unused]] int argc, │ │ │ │ │ -145 [[maybe_unused]] char** argv) │ │ │ │ │ -146 { │ │ │ │ │ -147 return _i_n_s_t_a_n_c_e(); │ │ │ │ │ -148 } │ │ │ │ │ -149 │ │ │ │ │ -_1_5_0 _D_U_N_E___E_X_P_O_R_T static _F_a_k_e_M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e() │ │ │ │ │ -151 { │ │ │ │ │ -152 static _F_a_k_e_M_P_I_H_e_l_p_e_r singleton; │ │ │ │ │ -153 return singleton; │ │ │ │ │ -154 } │ │ │ │ │ -155 │ │ │ │ │ -_1_5_9 int _r_a_n_k () const { return 0; } │ │ │ │ │ -_1_6_3 int _s_i_z_e () const { return 1; } │ │ │ │ │ -164 │ │ │ │ │ -165 private: │ │ │ │ │ -166 _F_a_k_e_M_P_I_H_e_l_p_e_r() {} │ │ │ │ │ -167 FakeMPIHelper(const FakeMPIHelper&); │ │ │ │ │ -168 FakeMPIHelper& operator=(const FakeMPIHelper); │ │ │ │ │ -169 }; │ │ │ │ │ -170 │ │ │ │ │ -171#if HAVE_MPI │ │ │ │ │ -_1_7_8 class _M_P_I_H_e_l_p_e_r │ │ │ │ │ -179 { │ │ │ │ │ -180 public: │ │ │ │ │ -_1_8_5 constexpr static bool _i_s_F_a_k_e = false; │ │ │ │ │ -186 │ │ │ │ │ -_1_9_0 typedef MPI_Comm _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ -191 │ │ │ │ │ -_1_9_8 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ -199 { │ │ │ │ │ -200 return MPI_COMM_WORLD; │ │ │ │ │ -201 } │ │ │ │ │ +_1_1_5 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +116 │ │ │ │ │ +_1_2_0 typedef std::ptrdiff_t _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ +121 │ │ │ │ │ +_1_2_6 _i_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ │ +127 │ │ │ │ │ +_1_3_3 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ +134 │ │ │ │ │ +_1_3_9 _i_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ │ +140 │ │ │ │ │ +_1_4_5 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ +146 │ │ │ │ │ +_1_5_1 inline void _p_u_s_h___b_a_c_k(_c_o_n_s_t___r_e_f_e_r_e_n_c_e entry); │ │ │ │ │ +152 │ │ │ │ │ +_1_5_8 inline _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); │ │ │ │ │ +159 │ │ │ │ │ +_1_6_5 inline _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; │ │ │ │ │ +166 │ │ │ │ │ +_1_7_1 inline _s_i_z_e___t_y_p_e _s_i_z_e() const; │ │ │ │ │ +172 │ │ │ │ │ +_1_8_0 inline void _p_u_r_g_e(); │ │ │ │ │ +181 │ │ │ │ │ +_1_8_5 inline void _c_l_e_a_r(); │ │ │ │ │ +_1_8_9 _A_r_r_a_y_L_i_s_t(); │ │ │ │ │ +190 │ │ │ │ │ +191 private: │ │ │ │ │ +192 │ │ │ │ │ +196 using SmartPointerAllocator = typename std::allocator_traits::template │ │ │ │ │ +rebind_alloc< std::shared_ptr< std::array > >; │ │ │ │ │ +197 │ │ │ │ │ +201 using ArrayAllocator = typename std::allocator_traits::template │ │ │ │ │ +rebind_alloc< std::array >; │ │ │ │ │ 202 │ │ │ │ │ -_2_0_9 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r () │ │ │ │ │ -210 { │ │ │ │ │ -211 return MPI_COMM_SELF; │ │ │ │ │ -212 } │ │ │ │ │ -213 │ │ │ │ │ -219 [[deprecated("getCollectionCommunication is deprecated. Use │ │ │ │ │ -getCommunication instead.")]] │ │ │ │ │ -220 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> │ │ │ │ │ -_2_2_1 _g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ -222 { │ │ │ │ │ -223 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -224 } │ │ │ │ │ -225 │ │ │ │ │ -226 static _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_> │ │ │ │ │ -_2_2_7 _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ -228 { │ │ │ │ │ -229 return _C_o_m_m_u_n_i_c_a_t_i_o_n_<_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r_>(_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -230 } │ │ │ │ │ -_2_4_6 _D_U_N_E___E_X_P_O_R_T static _M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e(int& argc, char**& argv) │ │ │ │ │ -247 { │ │ │ │ │ -248 // create singleton instance │ │ │ │ │ -249 if (!instance_){ │ │ │ │ │ -250 static std::mutex mutex; │ │ │ │ │ -251 std::lock_guard guard(mutex); │ │ │ │ │ -252 if(!instance_) │ │ │ │ │ -253 instance_.reset(new _M_P_I_H_e_l_p_e_r(argc,argv)); │ │ │ │ │ -254 } │ │ │ │ │ -255 return *instance_; │ │ │ │ │ -256 } │ │ │ │ │ -257 │ │ │ │ │ -_2_5_8 _D_U_N_E___E_X_P_O_R_T static _M_P_I_H_e_l_p_e_r& _i_n_s_t_a_n_c_e() │ │ │ │ │ -259 { │ │ │ │ │ -260 if(!instance_) │ │ │ │ │ -261 _D_U_N_E___T_H_R_O_W(_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n, "MPIHelper not initialized! Call │ │ │ │ │ -MPIHelper::instance(argc, argv) with arguments first."); │ │ │ │ │ -262 return *instance_; │ │ │ │ │ -263 } │ │ │ │ │ +206 friend class _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +207 friend class _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +208 │ │ │ │ │ +210 std::vector >, │ │ │ │ │ +211 SmartPointerAllocator> chunks_; │ │ │ │ │ +220 _s_i_z_e___t_y_p_e capacity_; │ │ │ │ │ +222 _s_i_z_e___t_y_p_e size_; │ │ │ │ │ +224 _s_i_z_e___t_y_p_e start_; │ │ │ │ │ +233 inline _r_e_f_e_r_e_n_c_e elementAt(_s_i_z_e___t_y_p_e i); │ │ │ │ │ +234 │ │ │ │ │ +_2_4_3 inline _c_o_n_s_t___r_e_f_e_r_e_n_c_e elementAt(_s_i_z_e___t_y_p_e i) const; │ │ │ │ │ +244 }; │ │ │ │ │ +245 │ │ │ │ │ +246 │ │ │ │ │ +250 template │ │ │ │ │ +_2_5_1 class _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r : public │ │ │ │ │ +_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e, │ │ │ │ │ +252 typename A::value_type, │ │ │ │ │ +253 typename A::value_type &, │ │ │ │ │ +254 typename A::difference_type> │ │ │ │ │ +255 { │ │ │ │ │ +256 │ │ │ │ │ +257 friend class _A_r_r_a_y_L_i_s_t; │ │ │ │ │ +258 friend class _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +259 public: │ │ │ │ │ +_2_6_3 typedef typename A::value_type _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ 264 │ │ │ │ │ -_2_6_8 int _r_a_n_k () const { return rank_; } │ │ │ │ │ -_2_7_2 int _s_i_z_e () const { return size_; } │ │ │ │ │ -273 │ │ │ │ │ -_2_7_5 _~_M_P_I_H_e_l_p_e_r() │ │ │ │ │ -276 { │ │ │ │ │ -277 int wasFinalized = -1; │ │ │ │ │ -278 MPI_Finalized( &wasFinalized ); │ │ │ │ │ -279 if(!wasFinalized && initializedHere_) │ │ │ │ │ -280 { │ │ │ │ │ -281 MPI_Finalize(); │ │ │ │ │ -282 _d_v_e_r_b << "Called MPI_Finalize on p=" << rank_ << "!" < instance_ = {}; │ │ │ │ │ -293 │ │ │ │ │ -295 MPIHelper(int& argc, char**& argv) │ │ │ │ │ -296 : initializedHere_(false) │ │ │ │ │ -297 { │ │ │ │ │ -298 int wasInitialized = -1; │ │ │ │ │ -299 MPI_Initialized( &wasInitialized ); │ │ │ │ │ -300 if(!wasInitialized) │ │ │ │ │ -301 { │ │ │ │ │ -302 rank_ = -1; │ │ │ │ │ -303 size_ = -1; │ │ │ │ │ -304 static int is_initialized = MPI_Init(&argc, &argv); │ │ │ │ │ -305 prevent_warning(is_initialized); │ │ │ │ │ -306 initializedHere_ = true; │ │ │ │ │ -307 } │ │ │ │ │ -308 │ │ │ │ │ -309 MPI_Comm_rank(MPI_COMM_WORLD,&rank_); │ │ │ │ │ -310 MPI_Comm_size(MPI_COMM_WORLD,&size_); │ │ │ │ │ -311 │ │ │ │ │ -312 assert( rank_ >= 0 ); │ │ │ │ │ -313 assert( size_ >= 1 ); │ │ │ │ │ -314 │ │ │ │ │ -315 _d_v_e_r_b << "Called MPI_Init on p=" << rank_ << "!" << std::endl; │ │ │ │ │ -316 } │ │ │ │ │ -317 │ │ │ │ │ -318 MPIHelper(const MPIHelper&); │ │ │ │ │ -319 MPIHelper& operator=(const MPIHelper); │ │ │ │ │ -320 }; │ │ │ │ │ -321#else // !HAVE_MPI │ │ │ │ │ -322 // We do not have MPI therefore FakeMPIHelper │ │ │ │ │ -323 // is the MPIHelper │ │ │ │ │ -328 typedef FakeMPIHelper MPIHelper; │ │ │ │ │ +_2_6_5 typedef typename A::difference_type _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ +266 │ │ │ │ │ +_2_6_7 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +268 │ │ │ │ │ +_2_6_9 using _r_e_f_e_r_e_n_c_e = typename A::value_type &; │ │ │ │ │ +270 │ │ │ │ │ +_2_7_1 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = typename A::value_type const&; │ │ │ │ │ +272 │ │ │ │ │ +_2_7_8 constexpr static int _c_h_u_n_k_S_i_z_e__ = (N > 0) ? N : 1; │ │ │ │ │ +279 │ │ │ │ │ +280 │ │ │ │ │ +286 inline bool _e_q_u_a_l_s(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const; │ │ │ │ │ +287 │ │ │ │ │ +293 inline bool _e_q_u_a_l_s(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) │ │ │ │ │ +const; │ │ │ │ │ +294 │ │ │ │ │ +298 inline void _i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +299 │ │ │ │ │ +303 inline void _d_e_c_r_e_m_e_n_t(); │ │ │ │ │ +304 │ │ │ │ │ +309 inline _r_e_f_e_r_e_n_c_e _e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const; │ │ │ │ │ +310 │ │ │ │ │ +315 inline _r_e_f_e_r_e_n_c_e _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ │ +316 │ │ │ │ │ +328 inline void _e_r_a_s_e_T_o_H_e_r_e(); │ │ │ │ │ 329 │ │ │ │ │ -330#endif // !HAVE_MPI │ │ │ │ │ -331 │ │ │ │ │ -332} // end namespace Dune │ │ │ │ │ -333#endif │ │ │ │ │ -_v_i_s_i_b_i_l_i_t_y_._h_h │ │ │ │ │ -Definition of macros controlling symbol visibility at the ABI level. │ │ │ │ │ -_D_U_N_E___E_X_P_O_R_T │ │ │ │ │ -#define DUNE_EXPORT │ │ │ │ │ -Export a symbol as part of the public ABI. │ │ │ │ │ -DDeeffiinniittiioonn visibility.hh:20 │ │ │ │ │ -_m_p_i_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ -Implements an utility class that provides MPI's collective communication │ │ │ │ │ -methods. │ │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h │ │ │ │ │ -Implements an utility class that provides collective communication methods for │ │ │ │ │ -sequential programs. │ │ │ │ │ -_s_t_d_s_t_r_e_a_m_s_._h_h │ │ │ │ │ -Standard Dune debug streams. │ │ │ │ │ -_D_U_N_E___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ -_D_u_n_e_:_:_d_v_e_r_b │ │ │ │ │ -DVerbType dverb(std::cout) │ │ │ │ │ -Singleton of verbose debug stream. │ │ │ │ │ -DDeeffiinniittiioonn stdstreams.hh:116 │ │ │ │ │ +_3_3_1 inline _s_i_z_e___t_y_p_e _p_o_s_i_t_i_o_n(){return position_;} │ │ │ │ │ +332 │ │ │ │ │ +334 inline void _a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n); │ │ │ │ │ +335 │ │ │ │ │ +337 inline _d_i_f_f_e_r_e_n_c_e___t_y_p_e _d_i_s_t_a_n_c_e_T_o(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other) │ │ │ │ │ +const; │ │ │ │ │ +338 │ │ │ │ │ +_3_4_0 inline _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r() : position_(0), list_(nullptr) │ │ │ │ │ +341 {} │ │ │ │ │ +342 │ │ │ │ │ +343 private: │ │ │ │ │ +349 inline _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(_A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>& arrayList, _s_i_z_e___t_y_p_e _p_o_s_i_t_i_o_n); │ │ │ │ │ +350 │ │ │ │ │ +354 _s_i_z_e___t_y_p_e position_; │ │ │ │ │ +_3_5_8 _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>* list_; │ │ │ │ │ +359 }; │ │ │ │ │ +360 │ │ │ │ │ +364 template │ │ │ │ │ +_3_6_5 class _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +366 : public _R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e, │ │ │ │ │ +367 const typename A::value_type, │ │ │ │ │ +368 typename A::value_type const&, │ │ │ │ │ +369 typename A::difference_type> │ │ │ │ │ +370 { │ │ │ │ │ +371 │ │ │ │ │ +372 friend class _A_r_r_a_y_L_i_s_t; │ │ │ │ │ +373 friend class _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +374 │ │ │ │ │ +375 public: │ │ │ │ │ +_3_7_9 typedef typename A::value_type _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ +380 │ │ │ │ │ +_3_8_1 typedef typename A::difference_type _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ +382 │ │ │ │ │ +_3_8_3 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +384 │ │ │ │ │ +_3_8_5 using _r_e_f_e_r_e_n_c_e = typename A::value_type &; │ │ │ │ │ +386 │ │ │ │ │ +_3_8_7 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = typename A::value_type const&; │ │ │ │ │ +388 │ │ │ │ │ +_3_9_4 constexpr static int _c_h_u_n_k_S_i_z_e__ = (N > 0) ? N : 1; │ │ │ │ │ +395 │ │ │ │ │ +_4_0_1 inline bool _e_q_u_a_l_s(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) │ │ │ │ │ +const; │ │ │ │ │ +402 │ │ │ │ │ +_4_0_6 inline void _i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +407 │ │ │ │ │ +_4_1_1 inline void _d_e_c_r_e_m_e_n_t(); │ │ │ │ │ +412 │ │ │ │ │ +_4_1_4 inline void _a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n); │ │ │ │ │ +415 │ │ │ │ │ +_4_1_7 inline _d_i_f_f_e_r_e_n_c_e___t_y_p_e _d_i_s_t_a_n_c_e_T_o(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& │ │ │ │ │ +other) const; │ │ │ │ │ +418 │ │ │ │ │ +_4_2_3 inline _c_o_n_s_t___r_e_f_e_r_e_n_c_e _e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const; │ │ │ │ │ +424 │ │ │ │ │ +_4_2_9 inline _c_o_n_s_t___r_e_f_e_r_e_n_c_e _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ │ +430 │ │ │ │ │ +_4_3_1 inline _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r() : position_(0), list_(nullptr) │ │ │ │ │ +432 {} │ │ │ │ │ +433 │ │ │ │ │ +_4_3_4 inline _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other); │ │ │ │ │ +435 │ │ │ │ │ +436 private: │ │ │ │ │ +437 │ │ │ │ │ +443 inline _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>& arrayList, _s_i_z_e___t_y_p_e │ │ │ │ │ +position); │ │ │ │ │ +444 │ │ │ │ │ +448 _s_i_z_e___t_y_p_e position_; │ │ │ │ │ +452 const _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>* list_; │ │ │ │ │ +453 }; │ │ │ │ │ +454 │ │ │ │ │ +455 │ │ │ │ │ +456 template │ │ │ │ │ +_4_5_7 _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_A_r_r_a_y_L_i_s_t() │ │ │ │ │ +458 : capacity_(0), size_(0), start_(0) │ │ │ │ │ +459 { │ │ │ │ │ +460 chunks_.reserve(100); │ │ │ │ │ +461 } │ │ │ │ │ +462 │ │ │ │ │ +463 template │ │ │ │ │ +_4_6_4 void _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_c_l_e_a_r(){ │ │ │ │ │ +465 capacity_=0; │ │ │ │ │ +466 size_=0; │ │ │ │ │ +467 start_=0; │ │ │ │ │ +468 chunks_.clear(); │ │ │ │ │ +469 } │ │ │ │ │ +470 │ │ │ │ │ +471 template │ │ │ │ │ +_4_7_2 size_t _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_s_i_z_e() const │ │ │ │ │ +473 { │ │ │ │ │ +474 return size_; │ │ │ │ │ +475 } │ │ │ │ │ +476 │ │ │ │ │ +477 template │ │ │ │ │ +_4_7_8 void _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_p_u_s_h___b_a_c_k(_c_o_n_s_t___r_e_f_e_r_e_n_c_e entry) │ │ │ │ │ +479 { │ │ │ │ │ +480 size_t index=start_+size_; │ │ │ │ │ +481 if(index==capacity_) │ │ │ │ │ +482 { │ │ │ │ │ +483 chunks_.push_back(std::make_shared >()); │ │ │ │ │ +484 capacity_ += chunkSize_; │ │ │ │ │ +485 } │ │ │ │ │ +486 elementAt(index)=entry; │ │ │ │ │ +487 ++size_; │ │ │ │ │ +488 } │ │ │ │ │ +489 │ │ │ │ │ +490 template │ │ │ │ │ +_4_9_1 typename _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e │ │ │ │ │ +i) │ │ │ │ │ +492 { │ │ │ │ │ +493 return elementAt(start_+i); │ │ │ │ │ +494 } │ │ │ │ │ +495 │ │ │ │ │ +496 │ │ │ │ │ +497 template │ │ │ │ │ +_4_9_8 typename _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +499 { │ │ │ │ │ +500 return elementAt(start_+i); │ │ │ │ │ +501 } │ │ │ │ │ +502 │ │ │ │ │ +503 template │ │ │ │ │ +504 typename _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_e_l_e_m_e_n_t_A_t(size_type │ │ │ │ │ +i) │ │ │ │ │ +505 { │ │ │ │ │ +506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_); │ │ │ │ │ +507 } │ │ │ │ │ +508 │ │ │ │ │ +509 │ │ │ │ │ +510 template │ │ │ │ │ +511 typename ArrayList::const_reference ArrayList::elementAt │ │ │ │ │ +(size_type i) const │ │ │ │ │ +512 { │ │ │ │ │ +513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_); │ │ │ │ │ +514 } │ │ │ │ │ +515 │ │ │ │ │ +516 template │ │ │ │ │ +_5_1_7 _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_b_e_g_i_n() │ │ │ │ │ +518 { │ │ │ │ │ +519 return _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_); │ │ │ │ │ +520 } │ │ │ │ │ +521 │ │ │ │ │ +522 template │ │ │ │ │ +_5_2_3 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_b_e_g_i_n() const │ │ │ │ │ +524 { │ │ │ │ │ +525 return _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_); │ │ │ │ │ +526 } │ │ │ │ │ +527 │ │ │ │ │ +528 template │ │ │ │ │ +_5_2_9 _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_e_n_d() │ │ │ │ │ +530 { │ │ │ │ │ +531 return _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_+size_); │ │ │ │ │ +532 } │ │ │ │ │ +533 │ │ │ │ │ +534 template │ │ │ │ │ +_5_3_5 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_> _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_e_n_d() const │ │ │ │ │ +536 { │ │ │ │ │ +537 return _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>(*this, start_+size_); │ │ │ │ │ +538 } │ │ │ │ │ +539 │ │ │ │ │ +540 template │ │ │ │ │ +_5_4_1 void _A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>_:_:_p_u_r_g_e() │ │ │ │ │ +542 { │ │ │ │ │ +543 // Distance to copy to the left. │ │ │ │ │ +544 size_t distance = start_/chunkSize_; │ │ │ │ │ +545 if(distance>0) { │ │ │ │ │ +546 // Number of chunks with entries in it; │ │ │ │ │ +547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ ); │ │ │ │ │ +548 │ │ │ │ │ +549 // Copy chunks to the left. │ │ │ │ │ +550 std::copy(chunks_.begin()+distance, │ │ │ │ │ +551 chunks_.begin()+(distance+chunks), chunks_.begin()); │ │ │ │ │ +552 │ │ │ │ │ +553 // Calculate new parameters │ │ │ │ │ +554 start_ = start_ % chunkSize_; │ │ │ │ │ +555 //capacity += distance * chunkSize_; │ │ │ │ │ +556 } │ │ │ │ │ +557 } │ │ │ │ │ +558 │ │ │ │ │ +559 template │ │ │ │ │ +_5_6_0 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e i) │ │ │ │ │ +561 { │ │ │ │ │ +562 position_+=i; │ │ │ │ │ +563 } │ │ │ │ │ +564 │ │ │ │ │ +565 template │ │ │ │ │ +_5_6_6 void _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_a_d_v_a_n_c_e(_d_i_f_f_e_r_e_n_c_e___t_y_p_e i) │ │ │ │ │ +567 { │ │ │ │ │ +568 position_+=i; │ │ │ │ │ +569 } │ │ │ │ │ +570 │ │ │ │ │ +571 │ │ │ │ │ +572 template │ │ │ │ │ +_5_7_3 bool _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_q_u_a_l_s(const │ │ │ │ │ +_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const │ │ │ │ │ +574 { │ │ │ │ │ +575 // Makes only sense if we reference a common list │ │ │ │ │ +576 assert(list_==(other.list_)); │ │ │ │ │ +577 return position_==other.position_ ; │ │ │ │ │ +578 } │ │ │ │ │ +579 │ │ │ │ │ +580 │ │ │ │ │ +581 template │ │ │ │ │ +_5_8_2 bool _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_q_u_a_l_s(const │ │ │ │ │ +_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const │ │ │ │ │ +583 { │ │ │ │ │ +584 // Makes only sense if we reference a common list │ │ │ │ │ +585 assert(list_==(other.list_)); │ │ │ │ │ +586 return position_==other.position_ ; │ │ │ │ │ +587 } │ │ │ │ │ +588 │ │ │ │ │ +589 │ │ │ │ │ +590 template │ │ │ │ │ +_5_9_1 bool _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_q_u_a_l_s(const │ │ │ │ │ +_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_M_e_m_b_e_r_T_y_p_e_,_N_,_A_>& other) const │ │ │ │ │ +592 { │ │ │ │ │ +593 // Makes only sense if we reference a common list │ │ │ │ │ +594 assert(list_==(other.list_)); │ │ │ │ │ +595 return position_==other.position_ ; │ │ │ │ │ +596 } │ │ │ │ │ +597 │ │ │ │ │ +598 template │ │ │ │ │ +_5_9_9 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_i_n_c_r_e_m_e_n_t() │ │ │ │ │ +600 { │ │ │ │ │ +601 ++position_; │ │ │ │ │ +602 } │ │ │ │ │ +603 │ │ │ │ │ +604 template │ │ │ │ │ +_6_0_5 void _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_i_n_c_r_e_m_e_n_t() │ │ │ │ │ +606 { │ │ │ │ │ +607 ++position_; │ │ │ │ │ +608 } │ │ │ │ │ +609 │ │ │ │ │ +610 template │ │ │ │ │ +_6_1_1 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_e_c_r_e_m_e_n_t() │ │ │ │ │ +612 { │ │ │ │ │ +613 --position_; │ │ │ │ │ +614 } │ │ │ │ │ +615 │ │ │ │ │ +616 template │ │ │ │ │ +_6_1_7 void _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_e_c_r_e_m_e_n_t() │ │ │ │ │ +618 { │ │ │ │ │ +619 --position_; │ │ │ │ │ +620 } │ │ │ │ │ +621 │ │ │ │ │ +622 template │ │ │ │ │ +_6_2_3 typename _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_: │ │ │ │ │ +_e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +624 { │ │ │ │ │ +625 return list_->elementAt(i+position_); │ │ │ │ │ +626 } │ │ │ │ │ +627 │ │ │ │ │ +628 template │ │ │ │ │ +_6_2_9 typename _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_l_e_m_e_n_t_A_t(_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +630 { │ │ │ │ │ +631 return list_->elementAt(i+position_); │ │ │ │ │ +632 } │ │ │ │ │ +633 │ │ │ │ │ +634 template │ │ │ │ │ +_6_3_5 typename _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_r_e_f_e_r_e_n_c_e _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_: │ │ │ │ │ +_d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ +636 { │ │ │ │ │ +637 return list_->elementAt(position_); │ │ │ │ │ +638 } │ │ │ │ │ +639 │ │ │ │ │ +640 template │ │ │ │ │ +_6_4_1 typename _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ +642 { │ │ │ │ │ +643 return list_->elementAt(position_); │ │ │ │ │ +644 } │ │ │ │ │ +645 │ │ │ │ │ +646 template │ │ │ │ │ +_6_4_7 typename _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_s_t_a_n_c_e_T_o(const _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other) │ │ │ │ │ +const │ │ │ │ │ +648 { │ │ │ │ │ +649 // Makes only sense if we reference a common list │ │ │ │ │ +650 assert(list_==(other.list_)); │ │ │ │ │ +651 return other.position_ - position_; │ │ │ │ │ +652 } │ │ │ │ │ +653 │ │ │ │ │ +654 template │ │ │ │ │ +_6_5_5 typename _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_d_i_s_t_a_n_c_e_T_o(const _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& │ │ │ │ │ +other) const │ │ │ │ │ +656 { │ │ │ │ │ +657 // Makes only sense if we reference a common list │ │ │ │ │ +658 assert(list_==(other.list_)); │ │ │ │ │ +659 return other.position_ - position_; │ │ │ │ │ +660 } │ │ │ │ │ +661 │ │ │ │ │ +662 template │ │ │ │ │ +_6_6_3 void _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_e_r_a_s_e_T_o_H_e_r_e() │ │ │ │ │ +664 { │ │ │ │ │ +665 list_->size_ -= ++position_ - list_->start_; │ │ │ │ │ +666 // chunk number of the new position. │ │ │ │ │ +667 size_t posChunkStart = position_ / chunkSize_; │ │ │ │ │ +668 // number of chunks to deallocate │ │ │ │ │ +669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_) │ │ │ │ │ +670 / chunkSize_; │ │ │ │ │ +671 list_->start_ = position_; │ │ │ │ │ +672 │ │ │ │ │ +673 // Deallocate memory not needed any more. │ │ │ │ │ +674 for(size_t chunk=0; chunkchunks_[posChunkStart].reset(); │ │ │ │ │ +677 } │ │ │ │ │ +678 │ │ │ │ │ +679 // Capacity stays the same as the chunks before us │ │ │ │ │ +680 // are still there. They null pointers. │ │ │ │ │ +681 assert(list_->start_+list_->size_<=list_->capacity_); │ │ │ │ │ +682 } │ │ │ │ │ +683 │ │ │ │ │ +684 template │ │ │ │ │ +685 _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(_A_r_r_a_y_L_i_s_t_<_T_,_N_,_A_>& arrayList, │ │ │ │ │ +size_type position) │ │ │ │ │ +686 : position_(position), list_(&arrayList) │ │ │ │ │ +687 {} │ │ │ │ │ +688 │ │ │ │ │ +689 │ │ │ │ │ +690 template │ │ │ │ │ +691 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const │ │ │ │ │ +ArrayList& arrayList, │ │ │ │ │ +692 size_type position) │ │ │ │ │ +693 : position_(position), list_(&arrayList) │ │ │ │ │ +694 {} │ │ │ │ │ +695 │ │ │ │ │ +696 template │ │ │ │ │ +_6_9_7 _C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r(const │ │ │ │ │ +_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_N_,_A_>& other) │ │ │ │ │ +698 : position_(other.position_), list_(other.list_) │ │ │ │ │ +699 {} │ │ │ │ │ +700 │ │ │ │ │ +701 │ │ │ │ │ +703} │ │ │ │ │ +704#endif │ │ │ │ │ +_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h │ │ │ │ │ +This file implements iterator facade classes for writing stl conformant │ │ │ │ │ +iterators. │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +reference operator[](size_type i) │ │ │ │ │ +Get the element at specific position. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:491 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +Get an iterator that is positioned at the first element. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:517 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const ArrayListIterator< MemberType, N, A > &other) const │ │ │ │ │ +Comares two iterators. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:573 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +Increment the iterator. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:599 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +Get the number of elements in the list. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:472 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstArrayListIterator(const ArrayListIterator< T, N, A > &other) │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:697 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_p_u_r_g_e │ │ │ │ │ +void purge() │ │ │ │ │ +Purge the list. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:541 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ +void decrement() │ │ │ │ │ +decrement the iterator. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:611 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_r_a_s_e_T_o_H_e_r_e │ │ │ │ │ +void eraseToHere() │ │ │ │ │ +Erase all entries before the current position and the one at the current │ │ │ │ │ +position. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:663 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_A_r_r_a_y_L_i_s_t │ │ │ │ │ +ArrayList() │ │ │ │ │ +Constructs an Array list with one chunk. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:457 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +Get a random access iterator that is positioned at the first element. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:523 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +Increment the iterator. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:605 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +Get a random access iterator positioned after the last element. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:529 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ +const_reference elementAt(size_type i) const │ │ │ │ │ +Get the value of the list at an arbitrary position. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:629 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +const_reference operator[](size_type i) const │ │ │ │ │ +Get the element at specific position. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:498 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ +void decrement() │ │ │ │ │ +decrement the iterator. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:617 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ +void advance(difference_type n) │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:566 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +Get a random access iterator positioned after the last element. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:535 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +const_reference dereference() const │ │ │ │ │ +Access the element at the current position. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:641 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +Delete all entries from the list. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:464 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ +reference elementAt(size_type i) const │ │ │ │ │ +Get the value of the list at an arbitrary position. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:623 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const │ │ │ │ │ +Comares to iterators. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:591 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ +void advance(difference_type n) │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other) │ │ │ │ │ +const │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:655 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +reference dereference() const │ │ │ │ │ +Access the element at the current position. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:635 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ +void push_back(const_reference entry) │ │ │ │ │ +Append an entry to the list. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:478 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:647 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n │ │ │ │ │ -Default exception if a function was called while the object is not in a valid │ │ │ │ │ -state for that function... │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:281 │ │ │ │ │ -_D_u_n_e_:_:_N_o___C_o_m_m │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -Collective communication interface and sequential default implementation. │ │ │ │ │ -DDeeffiinniittiioonn communication.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r │ │ │ │ │ -A fake mpi helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -static DUNE_EXPORT MPICommunicator getCommunicator() │ │ │ │ │ -get the default communicator │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -return rank of process, i.e. one │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:163 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -static Communication< MPICommunicator > getCollectiveCommunication() │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -static MPICommunicator getLocalCommunicator() │ │ │ │ │ -get a local communicator │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:105 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -No_Comm MPICommunicator │ │ │ │ │ -The type of the mpi communicator. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ -static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv) │ │ │ │ │ -Get the singleton instance of the helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:144 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ -static DUNE_EXPORT FakeMPIHelper & instance() │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -static Communication< MPICommunicator > getCommunication() │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:124 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_i_s_F_a_k_e │ │ │ │ │ -static constexpr bool isFake │ │ │ │ │ -Are we fake (i.e. pretend to have MPI support but are compiled without.) │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_F_a_k_e_M_P_I_H_e_l_p_e_r_:_:_r_a_n_k │ │ │ │ │ -int rank() const │ │ │ │ │ -return rank of process, i.e. zero │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:159 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ -A real mpi helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:179 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -return number of processes │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ -static DUNE_EXPORT MPIHelper & instance() │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:258 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_i_s_F_a_k_e │ │ │ │ │ -static constexpr bool isFake │ │ │ │ │ -Are we fake (i. e. pretend to have MPI support but are compiled without. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:185 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_i_n_s_t_a_n_c_e │ │ │ │ │ -static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv) │ │ │ │ │ -Get the singleton instance of the helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:246 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -static Communication< MPICommunicator > getCommunication() │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:227 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_~_M_P_I_H_e_l_p_e_r │ │ │ │ │ -~MPIHelper() │ │ │ │ │ -calls MPI_Finalize │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_r_a_n_k │ │ │ │ │ -int rank() const │ │ │ │ │ -return rank of process │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:268 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -MPI_Comm MPICommunicator │ │ │ │ │ -The type of the mpi communicator. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:190 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -static MPICommunicator getCommunicator() │ │ │ │ │ -get the default communicator │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:198 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_L_o_c_a_l_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -static MPICommunicator getLocalCommunicator() │ │ │ │ │ -get a local communicator │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:209 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r_:_:_g_e_t_C_o_l_l_e_c_t_i_v_e_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -static Communication< MPICommunicator > getCollectiveCommunication() │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:221 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +A random access iterator for the Dune::ArrayList class. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:255 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_p_o_s_i_t_i_o_n │ │ │ │ │ +size_type position() │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:331 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ +A::value_type MemberType │ │ │ │ │ +The member type. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ArrayListIterator() │ │ │ │ │ +Standard constructor. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:340 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +A::difference_type difference_type │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:265 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_h_u_n_k_S_i_z_e__ │ │ │ │ │ +static constexpr int chunkSize_ │ │ │ │ │ +The number of elements in one chunk of the list. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename A::value_type const & const_reference │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename A::value_type & reference │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:269 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +A constant random access iterator for the Dune::ArrayList class. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:370 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_h_u_n_k_S_i_z_e__ │ │ │ │ │ +static constexpr int chunkSize_ │ │ │ │ │ +The number of elements in one chunk of the list. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:394 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename A::value_type & reference │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:385 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstArrayListIterator() │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:431 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ +A::value_type MemberType │ │ │ │ │ +The member type. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:379 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +A::difference_type difference_type │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:381 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename A::value_type const & const_reference │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:387 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_s_t_A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:383 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t │ │ │ │ │ +A dynamically growing random access list. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:62 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +T value_type │ │ │ │ │ +Value type for stl compliance. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_h_u_n_k_S_i_z_e__ │ │ │ │ │ +static constexpr int chunkSize_ │ │ │ │ │ +The number of elements in one chunk of the list. This has to be at least one. │ │ │ │ │ +The default is 100. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ +const T * const_pointer │ │ │ │ │ +The type of a const pointer to the type we store. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +ArrayListIterator< MemberType, N, A > iterator │ │ │ │ │ +A random access iterator. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +const T & const_reference │ │ │ │ │ +The type of a const reference to the type we store. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +T & reference │ │ │ │ │ +The type of a reference to the type we store. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:79 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::size_t size_type │ │ │ │ │ +The size type. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ +T MemberType │ │ │ │ │ +The member type that is stored. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_p_o_i_n_t_e_r │ │ │ │ │ +T * pointer │ │ │ │ │ +The type of a pointer to the type we store. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +ConstArrayListIterator< MemberType, N, A > const_iterator │ │ │ │ │ +A constant random access iterator. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_A_r_r_a_y_L_i_s_t_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +std::ptrdiff_t difference_type │ │ │ │ │ +The difference type. │ │ │ │ │ +DDeeffiinniittiioonn arraylist.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_R_a_n_d_o_m_A_c_c_e_s_s_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ +Base class for stl conformant forward iterators. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:434 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00242.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpi_collective_benchmark.cc File Reference │ │ │ │ +dune-common: visibility.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,327 +65,72 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -Functions | │ │ │ │ -Variables
    │ │ │ │ -
    mpi_collective_benchmark.cc File Reference
    │ │ │ │ +Macros
    │ │ │ │ +
    visibility.hh File Reference
    │ │ │ │ │ │ │ │
    │ │ │ │ -
    #include <config.h>
    │ │ │ │ -#include <iostream>
    │ │ │ │ -#include <iomanip>
    │ │ │ │ -#include <thread>
    │ │ │ │ -#include <dune/common/parallel/mpihelper.hh>
    │ │ │ │ -#include <dune/common/timer.hh>
    │ │ │ │ -#include <dune/common/parametertree.hh>
    │ │ │ │ -#include <dune/common/parametertreeparser.hh>
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Functions

    template<class CC >
    void communicate (CC &cc)
     
    template<class CC >
    Dune::Future< void > startCommunication (CC &cc)
     
    template<class CC >
    double runBlocking (CC &cc)
     
    template<class CC >
    double runNonblockingWait (CC &cc)
     
    std::tuple< double, double > runNonblockingSleep (decltype(Dune::MPIHelper::getCommunication())&cc, std::chrono::duration< double > wait_time)
     
    std::tuple< double, double > runNonblockingActive (decltype(Dune::MPIHelper::getCommunication())&cc, std::chrono::duration< double > wait_time)
     
    std::tuple< double, double > determineOverlap (std::function< std::tuple< double, double >(std::chrono::duration< double >)> fun)
     
    void printHeader ()
     
    void run (int s)
     
    int main (int argc, char **argv)
     
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

    │ │ │ │ -Variables

    Dune::ParameterTree options
     Benchmark for measure the possible overlap of computation and communication at MPI collective communications.
     
    std::vector< std::string > all_methods
     
    │ │ │ │ -

    Function Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ communicate()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -template<class CC >
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    void communicate (CC & cc)
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ determineOverlap()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    std::tuple< double, double > determineOverlap (std::function< std::tuple< double, double >(std::chrono::duration< double >)> fun)
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ main()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    int main (int argc,
    char ** argv 
    )
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ printHeader()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    void printHeader ()
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ run()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    void run (int s)
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ runBlocking()

    │ │ │ │ │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -template<class CC >
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    double runBlocking (CC & cc)
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ runNonblockingActive()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    std::tuple< double, double > runNonblockingActive (decltype(Dune::MPIHelper::getCommunication())& cc,
    std::chrono::duration< double > wait_time 
    )
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ runNonblockingSleep()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    std::tuple< double, double > runNonblockingSleep (decltype(Dune::MPIHelper::getCommunication())& cc,
    std::chrono::duration< double > wait_time 
    )
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -

    ◆ runNonblockingWait()

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -template<class CC >
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    double runNonblockingWait (CC & cc)
    │ │ │ │ -
    │ │ │ │ +

    Definition of macros controlling symbol visibility at the ABI level. │ │ │ │ +More...

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

    ◆ startCommunication()

    │ │ │ │ +

    Go to the source code of this file.

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

    │ │ │ │ +Macros

    #define DUNE_EXPORT   implementation_defined
     Export a symbol as part of the public ABI.
     
    #define DUNE_PRIVATE   implementation_defined
     Mark a symbol as being for internal use within the current DSO only.
     
    │ │ │ │ +

    Detailed Description

    │ │ │ │ +

    Definition of macros controlling symbol visibility at the ABI level.

    │ │ │ │ +

    Macro Definition Documentation

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_EXPORT

    │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -template<class CC >
    │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │
    Dune::Future< void > startCommunication (CC & cc)#define DUNE_EXPORT   implementation_defined
    │ │ │ │
    │ │ │ │ │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    Variable Documentation

    │ │ │ │ - │ │ │ │ -

    ◆ all_methods

    │ │ │ │ +

    Export a symbol as part of the public ABI.

    │ │ │ │ +

    Mark a class, function or static variable as visible outside the current DSO. For now, this is mostly important for templated global variables and functions that contain static variables.

    │ │ │ │ │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    std::vector<std::string> all_methods
    │ │ │ │ -
    │ │ │ │ -Initial value:
    = {"allreduce",
    │ │ │ │ -
    "barrier",
    │ │ │ │ -
    "broadcast",
    │ │ │ │ -
    "gather",
    │ │ │ │ -
    "allgather",
    │ │ │ │ -
    "scatter"}
    │ │ │ │ -
    │ │ │ │
    │ │ │ │
    │ │ │ │ - │ │ │ │ -

    ◆ options

    │ │ │ │ + │ │ │ │ +

    ◆ DUNE_PRIVATE

    │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │
    Dune::ParameterTree options#define DUNE_PRIVATE   implementation_defined
    │ │ │ │
    │ │ │ │ │ │ │ │ -

    Benchmark for measure the possible overlap of computation and communication at MPI collective communications.

    │ │ │ │ -

    This benchmark is inspired by the sandia micro benchmark: W. Lawry, C. Wilson, A. Maccabe, R. Brightwell. COMB: A Portable Benchmark Suite for Assessing MPI Overlap. In Proceedings of the IEEE International Conference on Cluster Computing (CLUSTER 2002), p. 472, 2002. http://www.cs.sandia.gov/smb/overhead.html

    │ │ │ │ -

    The following communication times are measured: Blocking: Blocking call. E.g. MPI_Allreduce Nonblocking_wait (NB_Wait): Nonblocking (e.g. MPI_Iallreduce) call directly followed by MPI_Wait. Nonblocking_sleep (NB_Sleep): Nonblocking call followed by a busy wait until the work time has passed. Then MPI_Wait. Nonblocking_active (NB_active): Nonblocking call followed by a basy wait where in every iteration MPI_Test is called until the work time has passed. The MPI_wait.

    │ │ │ │ -

    The overhead is computed as the time for the Nonblocking call plus the time for MPI_Wait. The iteration time is the time for the whole communication. The available part of the communication time(avail(%)) is computed as 1-(overhead/base_t), where base_t is the time for calling the method with wait time = 0. The overhead is determined by increasing the work time successive until it is the dominant factor in the iteration time. Then the overhead is computed as iter_t-work_t.

    │ │ │ │ -

    Usage: mpirun ./mpi_collective_benchmark [options]

    │ │ │ │ -

    options: -method: default: allreduce. possible methods: allreduce, barrier, broadcast, gather, allgather, scatter -iterations: default: 10000. Number of iterations for measure the time for one communication -allMethods: default:0. If 1 iterates over all available methods -startSize: default: n, where n is the size of MPI_COMM_WORLD. runs the benchmark for different communicator sizes, starting with startSize. After every run the size is doubled. Finally one run is made for the whole communicator. -verbose: default: 0. If 1 prints intermediate information while determining the overhead. -threshold: default: 2. The threshold when the work time is the dominant factor in the iteration time. (Similar to the threshold in the sandia benchmark) -nohdr: default: 0. Suppress output of the header.

    │ │ │ │ -

    options can be set either in the options.ini file or can be pass at the command-line (-key value).

    │ │ │ │ -

    To get a good 'available' value for the NB_sleep communication, some MPI implementation need to spawn an extra thread. With MPICH you can activate this by setting the environment variable MPI_ASYNC_PROGRESS to 1, with IntelMPI the variable is called I_MPI_ASYNC_PROGRESS. (https://software.intel.com/en-us/mpi-developer-reference-linux-asynchronous-progress-control)

    │ │ │ │ +

    Mark a symbol as being for internal use within the current DSO only.

    │ │ │ │ +

    Mark a class, function or static variable as inaccessible from outside the current DSO. Doing so will decrease the size of the symbol table, but you have to be sure that the symbol will never have to be accessed from another library or the main executable!

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