--- /srv/reproducible-results/rbuild-debian/r-b-build.Y4lzj34Z/b1/dune-common_2.10.0-5_amd64.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.Y4lzj34Z/b2/dune-common_2.10.0-5_amd64.changes ├── Files │ @@ -1,4 +1,4 @@ │ │ 76339d130adfdded262e5496d8bd50c9 521884 debug optional libdune-common-dev-dbgsym_2.10.0-5_amd64.deb │ 69f902d366e9b78a71ef0b86bef1ba17 411676 libdevel optional libdune-common-dev_2.10.0-5_amd64.deb │ - 327a1709fd5ebc77323f40954b6b80ae 3175120 doc optional libdune-common-doc_2.10.0-5_all.deb │ + 3b9d613ea45b2e339d0e0454ff53ceb0 3179472 doc optional libdune-common-doc_2.10.0-5_all.deb ├── libdune-common-doc_2.10.0-5_all.deb │ ├── file list │ │ @@ -1,3 +1,3 @@ │ │ -rw-r--r-- 0 0 0 4 2025-09-15 05:59:28.000000 debian-binary │ │ --rw-r--r-- 0 0 0 28156 2025-09-15 05:59:28.000000 control.tar.xz │ │ --rw-r--r-- 0 0 0 3146772 2025-09-15 05:59:28.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 28168 2025-09-15 05:59:28.000000 control.tar.xz │ │ +-rw-r--r-- 0 0 0 3151112 2025-09-15 05:59:28.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./control │ │ │ │ @@ -1,13 +1,13 @@ │ │ │ │ Package: libdune-common-doc │ │ │ │ Source: dune-common │ │ │ │ Version: 2.10.0-5 │ │ │ │ Architecture: all │ │ │ │ Maintainer: Debian Science Maintainers │ │ │ │ -Installed-Size: 23530 │ │ │ │ +Installed-Size: 23531 │ │ │ │ Depends: libjs-sphinxdoc (>= 8.2) │ │ │ │ Built-Using: doxygen (= 1.9.8+ds-2.1) │ │ │ │ Section: doc │ │ │ │ Priority: optional │ │ │ │ Multi-Arch: foreign │ │ │ │ Homepage: https://www.dune-project.org/ │ │ │ │ Description: toolbox for solving PDEs -- basic classes (documentation) │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ │ │ │ ├── line order │ │ │ │ │ @@ -33,18 +33,18 @@ │ │ │ │ │ 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 │ │ │ │ │ @@ -63,40 +63,41 @@ │ │ │ │ │ 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 │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00077_source.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00080.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00080_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00083.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00083_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00086.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00086_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00089.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00089_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00092.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00092_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00095.html │ │ │ │ │ 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 │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00122_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00125.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00125_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00128.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00128_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00131.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00131_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00134.html │ │ │ │ │ @@ -140,34 +141,33 @@ │ │ │ │ │ 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 │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00218_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00221.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00221_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00224.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00224_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00227.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00227_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00230.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00230_source.html │ │ │ │ │ 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 │ │ │ │ │ @@ -189,52 +189,51 @@ │ │ │ │ │ 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 │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00284_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00287.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00287_source.html │ │ │ │ │ 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/a00308_source.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 │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00329_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00332.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00332_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00335.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00335_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00338.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00338_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00341.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00341_source.html │ │ │ │ │ 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 │ │ │ │ │ @@ -263,23 +262,24 @@ │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00383.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00383_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00386.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00386_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00389.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00389_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00392.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00392_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00395.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00395_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00398.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00398_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00401.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00401_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00404.html │ │ │ │ │ +usr/share/doc/libdune-common-doc/doxygen/a00404_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00407.html │ │ │ │ │ -usr/share/doc/libdune-common-doc/doxygen/a00407_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00410.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00410_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00413.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00413_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00416.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00416_source.html │ │ │ │ │ usr/share/doc/libdune-common-doc/doxygen/a00419.html │ ├── data.tar.xz │ │ ├── data.tar │ │ │ ├── file list │ │ │ │ @@ -26,282 +26,282 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2825 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/buildsystem/html/search.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 11208 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/buildsystem/html/searchindex.js │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2498 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/changelog.Debian.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 10768 2024-10-04 18:52:15.000000 ./usr/share/doc/libdune-common-doc/changelog.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 9815 2023-01-12 15:06:30.000000 ./usr/share/doc/libdune-common-doc/copyright │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3044 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00002.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5621 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7109 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6780 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8262 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14004 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 86151 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6585 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 44036 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19994 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 180715 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9111 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 53122 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6611 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19944 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3648 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4981 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7591 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 138694 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7456 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33695 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23464 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8504 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 45745 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9140 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 173678 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3471 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10170 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8765 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 72000 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6676 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 58446 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6490 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 34021 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6031 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 51849 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11615 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 103142 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6822 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 40313 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3657 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4978 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5637 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33707 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6914 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 47730 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11466 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 291478 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13224 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 179116 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7782 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12395 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 26302 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 62033 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5246 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9924 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6383 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16095 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9164 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10468 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33173 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8193 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 41652 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4767 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14347 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16770 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 48541 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3898 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5653 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7232 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5355 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 41537 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5881 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13121 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5664 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 39917 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5662 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 50072 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5660 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 39763 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13174 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 35626 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5397 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14949 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6997 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 54427 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4899 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13459 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6381 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10393 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12424 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 91584 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6400 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 151816 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13246 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 83988 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5441 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9255 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6157 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19958 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4992 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 31443 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8730 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 61448 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17515 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 45457 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5081 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7897 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9720 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 240953 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17881 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 79928 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7773 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22676 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6186 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17740 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5324 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10218 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7344 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 18649 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5204 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 29990 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5346 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33491 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8835 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10531 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33482 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 357624 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9860 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20795 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6712 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11002 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 81299 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 145525 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13870 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20197 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 24038 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 42062 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3817 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6524 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8169 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 63827 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 39912 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14840 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4124 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3371 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 88030 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8322 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 40739 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9498 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 250587 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5124 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 29705 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21360 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 122172 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3473 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14821 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3471 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9186 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6818 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 100135 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8195 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 144459 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7720 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10467 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22052 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 46229 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6286 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21544 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13584 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 94213 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8689 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15574 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8438 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4365 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5135 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5604 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9237 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7355 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9907 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14429 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 51306 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8833 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15784 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5274 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11329 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 30299 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 192703 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14827 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23435 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5114 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9510 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7493 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 31465 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21234 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 71204 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6661 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 52850 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6924 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7918 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 127860 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17901 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 167128 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4910 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5048 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23174 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4654 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7264 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 24240 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 39035 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6855 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 112076 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4309 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17896 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4393 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7511 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7123 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23204 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12793 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 124302 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 24717 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 122775 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5766 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16720 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5059 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 23627 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13604 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 28674 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3948 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5042 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6949 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 60433 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 122588 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10990 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22882 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3371 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7706 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14994 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 142940 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5213 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15231 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5602 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9345 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11653 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 55283 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20534 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 80039 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4127 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4958 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00395.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6603 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00395_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7264 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14137 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6806 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00401.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12869 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00401_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4978 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00404.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5979 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00407.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21113 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00407_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6555 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00410.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 18101 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00410_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7194 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00413.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 151467 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00413_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3365 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00416.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10369 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00416_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3383 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00419.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 51919 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00419_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5325 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00422.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22981 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00422_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10744 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00425.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 109175 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00425_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4992 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 31443 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 24240 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 39035 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8689 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15574 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10744 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 109175 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8833 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15784 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5204 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 29990 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17515 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 45457 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5355 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 41537 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6924 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13604 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 28674 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6997 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 54427 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13174 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 35626 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5881 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13121 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12424 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 91584 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6400 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 151816 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6381 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10393 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4899 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13459 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5662 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 50072 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5397 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14949 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5660 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 39763 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5441 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9255 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5664 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 39917 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13246 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 83988 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14429 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 51306 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6855 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 112076 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4910 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10990 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22882 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5621 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7109 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5979 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21113 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 26302 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 62033 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14004 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 86151 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7493 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 31465 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8195 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 144459 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4958 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6603 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5274 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11329 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5604 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9237 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4124 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7918 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 127860 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4127 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8730 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 61448 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3371 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 88030 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 39912 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14840 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6661 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 52850 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5059 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23627 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4393 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7511 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4767 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14347 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10468 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33173 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5213 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15231 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20534 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 80039 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 30299 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 192703 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21234 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 71204 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6555 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 18101 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7123 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23204 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7264 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14137 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5766 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16720 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 60433 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 122588 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8169 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 63827 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6818 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 100135 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6157 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19958 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8322 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 40739 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4309 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17896 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12793 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 124302 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5324 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10218 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5246 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9924 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3948 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5114 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9510 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7344 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 18649 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7773 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22676 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4978 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3383 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 51919 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6383 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16095 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7782 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12395 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3365 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10369 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5124 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 29705 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3817 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6524 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13584 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 94213 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9720 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 240953 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17901 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 167128 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19994 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 180715 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8504 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 45745 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7456 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33695 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3648 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4981 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11466 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 291478 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9140 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 173678 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5637 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33707 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13224 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 179116 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9111 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 53122 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6914 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 47730 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8765 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 72000 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6031 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 51849 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6490 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 34021 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3657 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4978 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3471 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10170 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6676 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 58446 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23464 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7591 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 138694 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11615 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 103142 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6822 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 40313 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6611 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19944 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5081 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7897 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6186 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17740 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7720 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10467 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5346 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33491 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6806 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12869 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5048 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23174 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5325 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22981 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11653 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 55283 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21360 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 122172 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3898 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6712 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11002 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 81299 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 145525 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 24038 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 42062 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13870 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20197 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33482 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 357624 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9860 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20795 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7355 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9907 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8835 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10531 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9164 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6286 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21544 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9498 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 250587 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5653 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7232 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17881 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 79928 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8193 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 41652 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22052 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 46229 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16770 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 48541 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3371 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7706 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6780 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8262 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3473 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14821 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3471 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00395.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9186 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00395_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5042 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6949 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14994 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00401.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 142940 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00401_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7194 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00404.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 151467 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00404_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8438 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00407.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6585 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00410.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 44036 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00410_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 24717 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00413.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 122775 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00413_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14827 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00416.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 23435 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00416_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4654 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00419.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7264 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00419_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4365 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00422.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5135 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00422_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5602 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00425.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9345 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00425_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5173 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00428.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 49335 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00428_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7896 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00431.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5292 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00432.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 262467 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00433.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 27946 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00433.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 39664 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00434.html │ │ │ │ @@ -1185,15 +1185,15 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2402 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_be46aaae597ce098e36afa8d6ef4f49b_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 4890 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_cf308425303dd5c426fac7b7f2967d96.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1621 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_cf308425303dd5c426fac7b7f2967d96_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 49658 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e151556194dc695299293609645e9437.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 11161 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e151556194dc695299293609645e9437_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3668 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e68e8157741866f444e17edd764ebbae.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 45631 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/doxygen.css │ │ │ │ --rw-r--r-- 0 root (0) root (0) 165883 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dune-common.tag.gz │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 165936 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dune-common.tag.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7704 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/dynsections.js │ │ │ │ -rw-r--r-- 0 root (0) root (0) 56072 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/files.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1145 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_0.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1167 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_0_dark.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1153 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_1.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 403 2025-09-15 05:59:28.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_10.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 422 2025-09-15 05:59:28.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: keywords.hh File Reference │ │ │ │ +dune-common: parameterizedobject.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,36 +70,38 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Macros
│ │ │ │ -
keywords.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
parameterizedobject.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ -More...

│ │ │ │ - │ │ │ │ +
#include <functional>
│ │ │ │ +#include <map>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/typeutilities.hh>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Macros

#define DUNE_INLINE_VARIABLE
 Preprocessor macro used for marking variables inline on supported compilers.
 
#define DUNE_GENERALIZED_CONSTEXPR
 Preprocessor macro used for marking code as constexpr under the relaxed rules of C++14 if supported by the compiler.
 

│ │ │ │ +Classes

class  Dune::ParameterizedObjectFactory< TypeT(Args...), KeyT >
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Definitions of several macros that conditionally make C++ syntax available.

│ │ │ │ -

This header contains several macros that enable C++ features depending on your compiler. Most of these features are optional and provide additional functionality like making code constexpr.

│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,28 +1,23 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_M_a_c_r_o_s │ │ │ │ │ -keywords.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 │ │ │ │ │ -Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ │ -_M_o_r_e_._._. │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +parameterizedobject.hh 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> │ │ │ │ │ +#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_. │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E │ │ │ │ │ -  Preprocessor macro used for marking variables inline on supported │ │ │ │ │ - compilers. │ │ │ │ │ +CCllaasssseess │ │ │ │ │ +class   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _> │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___G_E_N_E_R_A_L_I_Z_E_D___C_O_N_S_T_E_X_P_R │ │ │ │ │ -  Preprocessor macro used for marking code as constexpr under the │ │ │ │ │ - relaxed rules of C++14 if supported by the compiler. │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ │ -This header contains several macros that enable C++ features depending on your │ │ │ │ │ -compiler. Most of these features are optional and provide additional │ │ │ │ │ -functionality like making code constexpr. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: keywords.hh Source File │ │ │ │ +dune-common: parameterizedobject.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,41 +74,178 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
keywords.hh
│ │ │ │ +
parameterizedobject.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © 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_KEYWORDS_HH
│ │ │ │ -
4#define DUNE_COMMON_KEYWORDS_HH
│ │ │ │ -
5
│ │ │ │ -
6#warning This header is deprecated and will be removed after Dune 2.10. All key words are supported by C++ 17.
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=4 sts=4:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright © 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_PARAMETERIZEDOBJECT_HH
│ │ │ │ +
6#define DUNE_COMMON_PARAMETERIZEDOBJECT_HH
│ │ │ │
7
│ │ │ │ -
20#if __cpp_inline_variables >= 201606
│ │ │ │ -
21#define DUNE_INLINE_VARIABLE inline
│ │ │ │ -
22#else
│ │ │ │ -
24
│ │ │ │ -
27#define DUNE_INLINE_VARIABLE
│ │ │ │ -
28#endif
│ │ │ │ -
29
│ │ │ │ -
30
│ │ │ │ -
31#if __cpp_constexpr >= 201304
│ │ │ │ -
32#define DUNE_GENERALIZED_CONSTEXPR constexpr
│ │ │ │ -
33#else
│ │ │ │ -
35
│ │ │ │ -
38#define DUNE_GENERALIZED_CONSTEXPR
│ │ │ │ -
39#endif
│ │ │ │ -
40
│ │ │ │ -
41
│ │ │ │ -
42#endif // DUNE_COMMON_KEYWORDS_HH
│ │ │ │ +
8#include <functional>
│ │ │ │ +
9#include <map>
│ │ │ │ +
10#include <memory>
│ │ │ │ +
11
│ │ │ │ + │ │ │ │ + │ │ │ │ +
14
│ │ │ │ +
15namespace Dune {
│ │ │ │ +
16
│ │ │ │ +
34template<typename Signature,
│ │ │ │ +
35 typename KeyT = std::string>
│ │ │ │ + │ │ │ │ +
37
│ │ │ │ +
38template<typename TypeT,
│ │ │ │ +
39 typename KeyT,
│ │ │ │ +
40 typename... Args>
│ │ │ │ +
│ │ │ │ +
41class ParameterizedObjectFactory<TypeT(Args...), KeyT>
│ │ │ │ +
42{
│ │ │ │ +
43 public:
│ │ │ │ +
44
│ │ │ │ +
46 typedef KeyT Key;
│ │ │ │ +
47
│ │ │ │ +
49 using Type = TypeT;
│ │ │ │ +
50
│ │ │ │ +
51 protected:
│ │ │ │ +
52
│ │ │ │ +
53 using Creator = std::function<Type(Args...)>;
│ │ │ │ +
54
│ │ │ │ +
55 template<class F>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
57 -> decltype( std::declval<F>()(std::declval<Args>()...), std::true_type())
│ │ │ │ +
58 {
│ │ │ │ +
59 return {};
│ │ │ │ +
60 }
│ │ │ │ +
│ │ │ │ +
61
│ │ │ │ +
62 template<class F>
│ │ │ │ +
│ │ │ │ +
63 static constexpr std::false_type has_proper_signature(Dune::PriorityTag<0>)
│ │ │ │ +
64 {
│ │ │ │ +
65 return {};
│ │ │ │ +
66 }
│ │ │ │ +
│ │ │ │ +
67
│ │ │ │ +
68 public:
│ │ │ │ +
69
│ │ │ │ +
│ │ │ │ +
77 Type create(Key const& key, Args ... args) const {
│ │ │ │ +
78 typename Registry::const_iterator i = registry_.find(key);
│ │ │ │ +
79 if (i == registry_.end()) {
│ │ │ │ + │ │ │ │ +
81 "ParametrizedObjectFactory: key ``" <<
│ │ │ │ +
82 key << "'' not registered");
│ │ │ │ +
83 }
│ │ │ │ +
84 else return i->second(args...);
│ │ │ │ +
85 }
│ │ │ │ +
│ │ │ │ +
86
│ │ │ │ +
100 template<class Impl>
│ │ │ │ +
│ │ │ │ +
101 void define(Key const& key)
│ │ │ │ +
102 {
│ │ │ │ +
103 registry_[key] = DefaultCreator<Impl>();
│ │ │ │ +
104 }
│ │ │ │ +
│ │ │ │ +
105
│ │ │ │ +
119 template<class F,
│ │ │ │ +
120 typename std::enable_if<has_proper_signature<F>(PriorityTag<42>()), int>::type = 0>
│ │ │ │ +
│ │ │ │ +
121 void define(Key const& key, F&& f)
│ │ │ │ +
122 {
│ │ │ │ +
123 registry_[key] = f;
│ │ │ │ +
124 }
│ │ │ │ +
│ │ │ │ +
125
│ │ │ │ +
140 template<class Impl,
│ │ │ │ +
141 typename std::enable_if<
│ │ │ │ +
142 std::is_convertible<Impl, Type>::value
│ │ │ │ +
143 and not std::is_convertible<Impl, Creator>::value,
│ │ │ │ +
144 int>::type = 0>
│ │ │ │ +
│ │ │ │ +
145 void define(Key const& key, Impl&& t)
│ │ │ │ +
146 {
│ │ │ │ +
147 registry_[key] = [=](Args...) { return t;};
│ │ │ │ +
148 }
│ │ │ │ +
│ │ │ │ +
149
│ │ │ │ +
│ │ │ │ +
150 bool contains(Key const& key) const
│ │ │ │ +
151 {
│ │ │ │ +
152 return registry_.count(key);
│ │ │ │ +
153 }
│ │ │ │ +
│ │ │ │ +
154
│ │ │ │ +
155 private:
│ │ │ │ +
156
│ │ │ │ +
157 template<class T>
│ │ │ │ +
158 struct Tag{};
│ │ │ │ +
159
│ │ │ │ +
160 template<class Impl>
│ │ │ │ +
161 struct DefaultCreator
│ │ │ │ +
162 {
│ │ │ │ +
163 template<class... T>
│ │ │ │ +
164 Type operator()(T&&... args) const
│ │ │ │ +
165 {
│ │ │ │ +
166 return DefaultCreator::create(Tag<Type>(), PriorityTag<42>(), std::forward<T>(args)...);
│ │ │ │ +
167 }
│ │ │ │ +
168
│ │ │ │ +
169 template<class Target, class... T>
│ │ │ │ +
170 static Type create(Tag<Target>, PriorityTag<1>, T&& ... args) {
│ │ │ │ +
171 return Impl(std::forward<T>(args)...);
│ │ │ │ +
172 }
│ │ │ │ +
173
│ │ │ │ +
174 template<class Target, class... T>
│ │ │ │ +
175 static Type create(Tag<std::unique_ptr<Target>>, PriorityTag<2>, T&& ... args) {
│ │ │ │ +
176 return std::make_unique<Impl>(std::forward<T>(args)...);
│ │ │ │ +
177 }
│ │ │ │ +
178
│ │ │ │ +
179 template<class Target, class... T>
│ │ │ │ +
180 static Type create(Tag<std::shared_ptr<Target>>, PriorityTag<3>, T&& ... args) {
│ │ │ │ +
181 return std::make_shared<Impl>(std::forward<T>(args)...);
│ │ │ │ +
182 }
│ │ │ │ +
183
│ │ │ │ +
184 };
│ │ │ │ +
185
│ │ │ │ +
186 typedef std::map<Key, Creator> Registry;
│ │ │ │ +
187 Registry registry_;
│ │ │ │ +
188};
│ │ │ │ +
│ │ │ │ +
189
│ │ │ │ +
190
│ │ │ │ +
191
│ │ │ │ +
192} // end namespace Dune
│ │ │ │ +
193
│ │ │ │ +
194#endif // DUNE_COMMON_PARAMETERIZEDOBJECT_HH
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
Utilities for type computations, constraining overloads, ...
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
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
│ │ │ │ +
A factory class for parameterized objects.
Definition parameterizedobject.hh:36
│ │ │ │ +
std::function< Type(Args...)> Creator
Definition parameterizedobject.hh:53
│ │ │ │ +
static constexpr auto has_proper_signature(Dune::PriorityTag< 1 >) -> decltype(std::declval< F >()(std::declval< Args >()...), std::true_type())
Definition parameterizedobject.hh:56
│ │ │ │ +
TypeT Type
The type of objects created by the factory.
Definition parameterizedobject.hh:49
│ │ │ │ +
void define(Key const &key, Impl &&t)
Registers a new type with a key.
Definition parameterizedobject.hh:145
│ │ │ │ +
KeyT Key
The typ of the keys.
Definition parameterizedobject.hh:46
│ │ │ │ +
Type create(Key const &key, Args ... args) const
Creates an object identified by a key from given parameters.
Definition parameterizedobject.hh:77
│ │ │ │ +
void define(Key const &key)
Registers a new type with a key.
Definition parameterizedobject.hh:101
│ │ │ │ +
void define(Key const &key, F &&f)
Registers a new creator with a key.
Definition parameterizedobject.hh:121
│ │ │ │ +
static constexpr std::false_type has_proper_signature(Dune::PriorityTag< 0 >)
Definition parameterizedobject.hh:63
│ │ │ │ +
bool contains(Key const &key) const
Definition parameterizedobject.hh:150
│ │ │ │ +
Helper class for tagging priorities.
Definition typeutilities.hh:73
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,36 +1,200 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -keywords.hh │ │ │ │ │ +parameterizedobject.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 © DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=4 sts=4: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: Copyright © 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_KEYWORDS_HH │ │ │ │ │ -4#define DUNE_COMMON_KEYWORDS_HH │ │ │ │ │ -5 │ │ │ │ │ -6#warning This header is deprecated and will be removed after Dune 2.10. All │ │ │ │ │ -key words are supported by C++ 17. │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +5#ifndef DUNE_COMMON_PARAMETERIZEDOBJECT_HH │ │ │ │ │ +6#define DUNE_COMMON_PARAMETERIZEDOBJECT_HH │ │ │ │ │ 7 │ │ │ │ │ -20#if __cpp_inline_variables >= 201606 │ │ │ │ │ -21#define DUNE_INLINE_VARIABLE inline │ │ │ │ │ -22#else │ │ │ │ │ -24 │ │ │ │ │ -_2_7#define DUNE_INLINE_VARIABLE │ │ │ │ │ -28#endif │ │ │ │ │ -29 │ │ │ │ │ -30 │ │ │ │ │ -31#if __cpp_constexpr >= 201304 │ │ │ │ │ -32#define DUNE_GENERALIZED_CONSTEXPR constexpr │ │ │ │ │ -33#else │ │ │ │ │ -35 │ │ │ │ │ -_3_8#define DUNE_GENERALIZED_CONSTEXPR │ │ │ │ │ -39#endif │ │ │ │ │ -40 │ │ │ │ │ -41 │ │ │ │ │ -42#endif // DUNE_COMMON_KEYWORDS_HH │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +13#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> │ │ │ │ │ +14 │ │ │ │ │ +15namespace _D_u_n_e { │ │ │ │ │ +16 │ │ │ │ │ +34template │ │ │ │ │ +_3_6class _P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y; │ │ │ │ │ +37 │ │ │ │ │ +38template │ │ │ │ │ +_4_1class _P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y │ │ │ │ │ +42{ │ │ │ │ │ +43 public: │ │ │ │ │ +44 │ │ │ │ │ +_4_6 typedef KeyT _K_e_y; │ │ │ │ │ +47 │ │ │ │ │ +_4_9 using _T_y_p_e = TypeT; │ │ │ │ │ +50 │ │ │ │ │ +51 protected: │ │ │ │ │ +52 │ │ │ │ │ +_5_3 using _C_r_e_a_t_o_r = std::function<_T_y_p_e(Args...)>; │ │ │ │ │ +54 │ │ │ │ │ +55 template │ │ │ │ │ +_5_6 static constexpr auto _h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e(_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_1_>) │ │ │ │ │ +57 -> decltype( std::declval()(std::declval()...), std::true_type()) │ │ │ │ │ +58 { │ │ │ │ │ +59 return {}; │ │ │ │ │ +60 } │ │ │ │ │ +61 │ │ │ │ │ +62 template │ │ │ │ │ +_6_3 static constexpr std::false_type _h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e(_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_0_>) │ │ │ │ │ +64 { │ │ │ │ │ +65 return {}; │ │ │ │ │ +66 } │ │ │ │ │ +67 │ │ │ │ │ +68 public: │ │ │ │ │ +69 │ │ │ │ │ +_7_7 _T_y_p_e _c_r_e_a_t_e(_K_e_y const& key, Args ... args) const { │ │ │ │ │ +78 typename Registry::const_iterator i = registry_.find(key); │ │ │ │ │ +79 if (i == registry_.end()) { │ │ │ │ │ +80 _D_U_N_E___T_H_R_O_W(_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, │ │ │ │ │ +81 "ParametrizedObjectFactory: key ``" << │ │ │ │ │ +82 key << "'' not registered"); │ │ │ │ │ +83 } │ │ │ │ │ +84 else return i->second(args...); │ │ │ │ │ +85 } │ │ │ │ │ +86 │ │ │ │ │ +100 template │ │ │ │ │ +_1_0_1 void _d_e_f_i_n_e(_K_e_y const& key) │ │ │ │ │ +102 { │ │ │ │ │ +103 registry_[key] = DefaultCreator(); │ │ │ │ │ +104 } │ │ │ │ │ +105 │ │ │ │ │ +119 template(_P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()), int>:: │ │ │ │ │ +type = 0> │ │ │ │ │ +_1_2_1 void _d_e_f_i_n_e(_K_e_y const& key, F&& f) │ │ │ │ │ +122 { │ │ │ │ │ +123 registry_[key] = f; │ │ │ │ │ +124 } │ │ │ │ │ +125 │ │ │ │ │ +140 template::value │ │ │ │ │ +143 and not std::is_convertible::value, │ │ │ │ │ +144 int>::type = 0> │ │ │ │ │ +_1_4_5 void _d_e_f_i_n_e(_K_e_y const& key, Impl&& t) │ │ │ │ │ +146 { │ │ │ │ │ +147 registry_[key] = [=](Args...) { return t;}; │ │ │ │ │ +148 } │ │ │ │ │ +149 │ │ │ │ │ +_1_5_0 bool _c_o_n_t_a_i_n_s(_K_e_y const& key) const │ │ │ │ │ +151 { │ │ │ │ │ +152 return registry_.count(key); │ │ │ │ │ +153 } │ │ │ │ │ +154 │ │ │ │ │ +155 private: │ │ │ │ │ +156 │ │ │ │ │ +157 template │ │ │ │ │ +158 struct Tag{}; │ │ │ │ │ +159 │ │ │ │ │ +160 template │ │ │ │ │ +161 struct DefaultCreator │ │ │ │ │ +162 { │ │ │ │ │ +163 template │ │ │ │ │ +164 Type operator()(T&&... args) const │ │ │ │ │ +165 { │ │ │ │ │ +166 return DefaultCreator::create(Tag(), PriorityTag<42>(), std:: │ │ │ │ │ +forward(args)...); │ │ │ │ │ +167 } │ │ │ │ │ +168 │ │ │ │ │ +169 template │ │ │ │ │ +170 static Type create(Tag, PriorityTag<1>, T&& ... args) { │ │ │ │ │ +171 return Impl(std::forward(args)...); │ │ │ │ │ +172 } │ │ │ │ │ +173 │ │ │ │ │ +174 template │ │ │ │ │ +175 static Type create(Tag>, PriorityTag<2>, T&& ... │ │ │ │ │ +args) { │ │ │ │ │ +176 return std::make_unique(std::forward(args)...); │ │ │ │ │ +177 } │ │ │ │ │ +178 │ │ │ │ │ +179 template │ │ │ │ │ +180 static Type create(Tag>, PriorityTag<3>, T&& ... │ │ │ │ │ +args) { │ │ │ │ │ +181 return std::make_shared(std::forward(args)...); │ │ │ │ │ +182 } │ │ │ │ │ +183 │ │ │ │ │ +184 }; │ │ │ │ │ +185 │ │ │ │ │ +186 typedef std::map Registry; │ │ │ │ │ +187 Registry registry_; │ │ │ │ │ +188}; │ │ │ │ │ +189 │ │ │ │ │ +190 │ │ │ │ │ +191 │ │ │ │ │ +192} // end namespace Dune │ │ │ │ │ +193 │ │ │ │ │ +194#endif // DUNE_COMMON_PARAMETERIZEDOBJECT_HH │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_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___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_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_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y │ │ │ │ │ +A factory class for parameterized objects. │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_C_r_e_a_t_o_r │ │ │ │ │ +std::function< Type(Args...)> Creator │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e │ │ │ │ │ +static constexpr auto has_proper_signature(Dune::PriorityTag< 1 >) -> decltype │ │ │ │ │ +(std::declval< F >()(std::declval< Args >()...), std::true_type()) │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_T_y_p_e │ │ │ │ │ +TypeT Type │ │ │ │ │ +The type of objects created by the factory. │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_d_e_f_i_n_e │ │ │ │ │ +void define(Key const &key, Impl &&t) │ │ │ │ │ +Registers a new type with a key. │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:145 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_K_e_y │ │ │ │ │ +KeyT Key │ │ │ │ │ +The typ of the keys. │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_c_r_e_a_t_e │ │ │ │ │ +Type create(Key const &key, Args ... args) const │ │ │ │ │ +Creates an object identified by a key from given parameters. │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_d_e_f_i_n_e │ │ │ │ │ +void define(Key const &key) │ │ │ │ │ +Registers a new type with a key. │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_d_e_f_i_n_e │ │ │ │ │ +void define(Key const &key, F &&f) │ │ │ │ │ +Registers a new creator with a key. │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:121 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e │ │ │ │ │ +static constexpr std::false_type has_proper_signature(Dune::PriorityTag< 0 >) │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ +bool contains(Key const &key) const │ │ │ │ │ +DDeeffiinniittiioonn parameterizedobject.hh:150 │ │ │ │ │ +_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/a00011.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: visibility.hh File Reference │ │ │ │ +dune-common: indices.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,70 +70,132 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Macros
│ │ │ │ -
visibility.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Typedefs | │ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
indices.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ - │ │ │ │ +
#include <cstddef>
│ │ │ │ +#include <stdexcept>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <utility>
│ │ │ │ +
│ │ │ │

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.
 

│ │ │ │ +Namespaces

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

│ │ │ │ +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>...
 
template<char... digits>
constexpr auto Dune::Indices::Literals::operator""_ic ()
 Literal to create an index compile-time constant.
 
template<char... digits>
constexpr auto Dune::Indices::Literals::operator""_uc ()
 Literal to create an unsigned integer compile-time constant.
 
template<char... digits>
constexpr auto Dune::Indices::Literals::operator""_sc ()
 Literal to create a signed integer compile-time constant.
 
template<class T , T value>
constexpr auto Dune::Indices::Literals::operator- (std::integral_constant< T, value >)
 Negation operator for integral constants.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

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

│ │ │ │ -

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!

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,117 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 | _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 │ │ │ │ │ _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___E_X_P_O_R_T   implementation_defined │ │ │ │ │ -  Export a symbol as part of the public ABI. │ │ │ │ │ -  │ │ │ │ │ -#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. │ │ │ │ │ -  │ │ │ │ │ -********** 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! │ │ │ │ │ +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]. │ │ │ │ │ +  │ │ │ │ │ +namespace   _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:_L_i_t_e_r_a_l_s │ │ │ │ │ +  │ │ │ │ │ +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... │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr auto  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:_L_i_t_e_r_a_l_s_:_:_o_p_e_r_a_t_o_r_"_"___i_c () │ │ │ │ │ +  Literal to create an index compile-time constant. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr auto  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:_L_i_t_e_r_a_l_s_:_:_o_p_e_r_a_t_o_r_"_"___u_c () │ │ │ │ │ +  Literal to create an unsigned integer compile-time │ │ │ │ │ + constant. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr auto  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:_L_i_t_e_r_a_l_s_:_:_o_p_e_r_a_t_o_r_"_"___s_c () │ │ │ │ │ +  Literal to create a signed integer compile-time │ │ │ │ │ + constant. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr auto  _D_u_n_e_:_:_I_n_d_i_c_e_s_:_:_L_i_t_e_r_a_l_s_:_:_o_p_e_r_a_t_o_r_- (std:: │ │ │ │ │ + integral_constant< T, value >) │ │ │ │ │ +  Negation operator for integral constants. │ │ │ │ │ +  │ │ │ │ │ +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/a00011_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: visibility.hh Source File │ │ │ │ +dune-common: indices.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,48 +74,191 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
visibility.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 © 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
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_COMMON_INDICES_HH
│ │ │ │ +
7#define DUNE_COMMON_INDICES_HH
│ │ │ │ +
8
│ │ │ │ +
9#include <cstddef>
│ │ │ │ +
10#include <stdexcept>
│ │ │ │ +
11#include <type_traits>
│ │ │ │ +
12#include <utility>
│ │ │ │
13
│ │ │ │ -
15
│ │ │ │ -
20#define DUNE_EXPORT implementation_defined
│ │ │ │ -
21
│ │ │ │ -
23
│ │ │ │ -
28#define DUNE_PRIVATE implementation_defined
│ │ │ │ -
29
│ │ │ │ -
30#else // DOXYGEN
│ │ │ │ +
14namespace Dune
│ │ │ │ +
15{
│ │ │ │ +
28 template<std::size_t i>
│ │ │ │ +
29 using index_constant = std::integral_constant<std::size_t, i>;
│ │ │ │ +
30
│ │ │ │
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
│ │ │ │ +
32
│ │ │ │ +
│ │ │ │ +
49 namespace Indices
│ │ │ │ +
50 {
│ │ │ │ +
52 inline constexpr index_constant< 0> _0 = {};
│ │ │ │ +
53
│ │ │ │ +
55 inline constexpr index_constant< 1> _1 = {};
│ │ │ │ +
56
│ │ │ │ +
58 inline constexpr index_constant< 2> _2 = {};
│ │ │ │ +
59
│ │ │ │ +
61 inline constexpr index_constant< 3> _3 = {};
│ │ │ │ +
62
│ │ │ │ +
64 inline constexpr index_constant< 4> _4 = {};
│ │ │ │ +
65
│ │ │ │ +
67 inline constexpr index_constant< 5> _5 = {};
│ │ │ │ +
68
│ │ │ │ +
70 inline constexpr index_constant< 6> _6 = {};
│ │ │ │ +
71
│ │ │ │ +
73 inline constexpr index_constant< 7> _7 = {};
│ │ │ │ +
74
│ │ │ │ +
76 inline constexpr index_constant< 8> _8 = {};
│ │ │ │ +
77
│ │ │ │ +
79 inline constexpr index_constant< 9> _9 = {};
│ │ │ │ +
80
│ │ │ │ +
82 inline constexpr index_constant<10> _10 = {};
│ │ │ │ +
83
│ │ │ │ +
85 inline constexpr index_constant<11> _11 = {};
│ │ │ │ +
86
│ │ │ │ +
88 inline constexpr index_constant<12> _12 = {};
│ │ │ │ +
89
│ │ │ │ +
91 inline constexpr index_constant<13> _13 = {};
│ │ │ │ +
92
│ │ │ │ +
94 inline constexpr index_constant<14> _14 = {};
│ │ │ │ +
95
│ │ │ │ +
97 inline constexpr index_constant<15> _15 = {};
│ │ │ │ +
98
│ │ │ │ +
100 inline constexpr index_constant<16> _16 = {};
│ │ │ │ +
101
│ │ │ │ +
103 inline constexpr index_constant<17> _17 = {};
│ │ │ │ +
104
│ │ │ │ +
106 inline constexpr index_constant<18> _18 = {};
│ │ │ │ +
107
│ │ │ │ +
109 inline constexpr index_constant<19> _19 = {};
│ │ │ │ +
110
│ │ │ │ +
111 } // namespace Indices
│ │ │ │ +
│ │ │ │ +
112
│ │ │ │ +
123 template<class F, class I, I... i>
│ │ │ │ +
│ │ │ │ +
124 decltype(auto) constexpr unpackIntegerSequence(F&& f, std::integer_sequence<I, i...> sequence)
│ │ │ │ +
125 {
│ │ │ │ +
126 return f(std::integral_constant<I, i>()...);
│ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │ +
128
│ │ │ │ +
129
│ │ │ │ +
│ │ │ │ +
130 namespace Indices { inline namespace Literals
│ │ │ │ +
131 {
│ │ │ │ +
132 namespace Impl
│ │ │ │ +
133 {
│ │ │ │ +
134 // convert a single character into an unsigned integer
│ │ │ │ +
135 constexpr unsigned char2digit (const char c)
│ │ │ │ +
136 {
│ │ │ │ +
137 if (c >= '0' && c <= '9')
│ │ │ │ +
138 return unsigned(c) - unsigned('0');
│ │ │ │ +
139 else {
│ │ │ │ +
140 throw std::invalid_argument("Character is not a digit.");
│ │ │ │ +
141 return 0u;
│ │ │ │ +
142 }
│ │ │ │ +
143 }
│ │ │ │ +
144
│ │ │ │ +
145 // convert a sequence of character digits into an unsigned integer
│ │ │ │ +
146 template <class T, char... digits>
│ │ │ │ +
147 constexpr T chars2number ()
│ │ │ │ +
148 {
│ │ │ │ +
149 const char arr[] = {digits...};
│ │ │ │ +
150 T result = 0;
│ │ │ │ +
151 T power = 1;
│ │ │ │ +
152 const T base = 10;
│ │ │ │ +
153
│ │ │ │ +
154 const int N = sizeof...(digits);
│ │ │ │ +
155 for (int i = 0; i < N; ++i) {
│ │ │ │ +
156 char c = arr[N - 1 - i];
│ │ │ │ +
157 result+= char2digit(c) * power;
│ │ │ │ +
158 power *= base;
│ │ │ │ +
159 }
│ │ │ │ +
160
│ │ │ │ +
161 return result;
│ │ │ │ +
162 }
│ │ │ │ +
163
│ │ │ │ +
164 } //namespace Impl
│ │ │ │ +
165
│ │ │ │ +
172 template <char... digits>
│ │ │ │ +
│ │ │ │ +
173 constexpr auto operator"" _ic()
│ │ │ │ +
174 {
│ │ │ │ +
175 return std::integral_constant<std::size_t, Impl::chars2number<std::size_t,digits...>()>{};
│ │ │ │ +
176 }
│ │ │ │ +
│ │ │ │ +
177
│ │ │ │ +
184 template <char... digits>
│ │ │ │ +
│ │ │ │ +
185 constexpr auto operator"" _uc()
│ │ │ │ +
186 {
│ │ │ │ +
187 return std::integral_constant<unsigned, Impl::chars2number<unsigned,digits...>()>{};
│ │ │ │ +
188 }
│ │ │ │ +
│ │ │ │ +
189
│ │ │ │ +
196 template <char... digits>
│ │ │ │ +
│ │ │ │ +
197 constexpr auto operator"" _sc()
│ │ │ │ +
198 {
│ │ │ │ +
199 return std::integral_constant<int, Impl::chars2number<int,digits...>()>{};
│ │ │ │ +
200 }
│ │ │ │ +
│ │ │ │ +
201
│ │ │ │ +
208 template <class T, T value>
│ │ │ │ +
│ │ │ │ +
209 constexpr auto operator- (std::integral_constant<T,value>)
│ │ │ │ +
210 {
│ │ │ │ +
211 return std::integral_constant<std::make_signed_t<T>, -value>{};
│ │ │ │ +
212 }
│ │ │ │ +
│ │ │ │ +
213
│ │ │ │ +
214 }} //namespace Indices::Literals
│ │ │ │ +
│ │ │ │ +
215} //namespace Dune
│ │ │ │ +
216
│ │ │ │ +
217#endif // DUNE_COMMON_INDICES_HH
│ │ │ │ +
constexpr index_constant< 16 > _16
Compile time index with value 16.
Definition indices.hh:100
│ │ │ │ +
constexpr index_constant< 15 > _15
Compile time index with value 15.
Definition indices.hh:97
│ │ │ │ +
constexpr index_constant< 8 > _8
Compile time index with value 8.
Definition indices.hh:76
│ │ │ │ +
constexpr index_constant< 7 > _7
Compile time index with value 7.
Definition indices.hh:73
│ │ │ │ +
constexpr index_constant< 0 > _0
Compile time index with value 0.
Definition indices.hh:52
│ │ │ │ +
constexpr index_constant< 9 > _9
Compile time index with value 9.
Definition indices.hh:79
│ │ │ │ +
constexpr index_constant< 14 > _14
Compile time index with value 14.
Definition indices.hh:94
│ │ │ │ +
constexpr index_constant< 1 > _1
Compile time index with value 1.
Definition indices.hh:55
│ │ │ │ +
constexpr index_constant< 3 > _3
Compile time index with value 3.
Definition indices.hh:61
│ │ │ │ +
constexpr index_constant< 12 > _12
Compile time index with value 12.
Definition indices.hh:88
│ │ │ │ +
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:124
│ │ │ │ +
constexpr auto operator-(std::integral_constant< T, value >)
Negation operator for integral constants.
Definition indices.hh:209
│ │ │ │ +
constexpr index_constant< 11 > _11
Compile time index with value 11.
Definition indices.hh:85
│ │ │ │ +
constexpr index_constant< 18 > _18
Compile time index with value 18.
Definition indices.hh:106
│ │ │ │ +
constexpr index_constant< 13 > _13
Compile time index with value 13.
Definition indices.hh:91
│ │ │ │ +
constexpr index_constant< 5 > _5
Compile time index with value 5.
Definition indices.hh:67
│ │ │ │ +
constexpr index_constant< 17 > _17
Compile time index with value 17.
Definition indices.hh:103
│ │ │ │ +
constexpr index_constant< 10 > _10
Compile time index with value 10.
Definition indices.hh:82
│ │ │ │ +
constexpr index_constant< 2 > _2
Compile time index with value 2.
Definition indices.hh:58
│ │ │ │ +
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition indices.hh:29
│ │ │ │ +
constexpr index_constant< 19 > _19
Compile time index with value 19.
Definition indices.hh:109
│ │ │ │ +
constexpr index_constant< 6 > _6
Compile time index with value 6.
Definition indices.hh:70
│ │ │ │ +
constexpr index_constant< 4 > _4
Compile time index with value 4.
Definition indices.hh:64
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
constexpr Base power(Base m, Exponent p)
Power method for integer exponents.
Definition math.hh:75
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,44 +1,249 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -visibility.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 © 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 │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_COMMON_INDICES_HH │ │ │ │ │ +7#define DUNE_COMMON_INDICES_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ 13 │ │ │ │ │ -15 │ │ │ │ │ -_2_0#define DUNE_EXPORT implementation_defined │ │ │ │ │ -21 │ │ │ │ │ -23 │ │ │ │ │ -_2_8#define DUNE_PRIVATE implementation_defined │ │ │ │ │ -29 │ │ │ │ │ -30#else // DOXYGEN │ │ │ │ │ +14namespace _D_u_n_e │ │ │ │ │ +15{ │ │ │ │ │ +28 template │ │ │ │ │ +_2_9 using _i_n_d_e_x___c_o_n_s_t_a_n_t = std::integral_constant; │ │ │ │ │ +30 │ │ │ │ │ 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 │ │ │ │ │ +32 │ │ │ │ │ +_4_9 namespace Indices │ │ │ │ │ +50 { │ │ │ │ │ +_5_2 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _0_> ___0 = {}; │ │ │ │ │ +53 │ │ │ │ │ +_5_5 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _1_> ___1 = {}; │ │ │ │ │ +56 │ │ │ │ │ +_5_8 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _2_> ___2 = {}; │ │ │ │ │ +59 │ │ │ │ │ +_6_1 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _3_> ___3 = {}; │ │ │ │ │ +62 │ │ │ │ │ +_6_4 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _4_> ___4 = {}; │ │ │ │ │ +65 │ │ │ │ │ +_6_7 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _5_> ___5 = {}; │ │ │ │ │ +68 │ │ │ │ │ +_7_0 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _6_> ___6 = {}; │ │ │ │ │ +71 │ │ │ │ │ +_7_3 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _7_> ___7 = {}; │ │ │ │ │ +74 │ │ │ │ │ +_7_6 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _8_> ___8 = {}; │ │ │ │ │ +77 │ │ │ │ │ +_7_9 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_ _9_> ___9 = {}; │ │ │ │ │ +80 │ │ │ │ │ +_8_2 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_0_> ___1_0 = {}; │ │ │ │ │ +83 │ │ │ │ │ +_8_5 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_1_> ___1_1 = {}; │ │ │ │ │ +86 │ │ │ │ │ +_8_8 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_2_> ___1_2 = {}; │ │ │ │ │ +89 │ │ │ │ │ +_9_1 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_3_> ___1_3 = {}; │ │ │ │ │ +92 │ │ │ │ │ +_9_4 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_4_> ___1_4 = {}; │ │ │ │ │ +95 │ │ │ │ │ +_9_7 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_5_> ___1_5 = {}; │ │ │ │ │ +98 │ │ │ │ │ +_1_0_0 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_6_> ___1_6 = {}; │ │ │ │ │ +101 │ │ │ │ │ +_1_0_3 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_7_> ___1_7 = {}; │ │ │ │ │ +104 │ │ │ │ │ +_1_0_6 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_8_> ___1_8 = {}; │ │ │ │ │ +107 │ │ │ │ │ +_1_0_9 inline constexpr _i_n_d_e_x___c_o_n_s_t_a_n_t_<_1_9_> ___1_9 = {}; │ │ │ │ │ +110 │ │ │ │ │ +111 } // namespace Indices │ │ │ │ │ +112 │ │ │ │ │ +123 template │ │ │ │ │ +_1_2_4 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) │ │ │ │ │ +125 { │ │ │ │ │ +126 return f(std::integral_constant()...); │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +129 │ │ │ │ │ +_1_3_0 namespace Indices { inline namespace Literals │ │ │ │ │ +131 { │ │ │ │ │ +132 namespace Impl │ │ │ │ │ +133 { │ │ │ │ │ +134 // convert a single character into an unsigned integer │ │ │ │ │ +135 constexpr unsigned char2digit (const char c) │ │ │ │ │ +136 { │ │ │ │ │ +137 if (c >= '0' && c <= '9') │ │ │ │ │ +138 return unsigned(c) - unsigned('0'); │ │ │ │ │ +139 else { │ │ │ │ │ +140 throw std::invalid_argument("Character is not a digit."); │ │ │ │ │ +141 return 0u; │ │ │ │ │ +142 } │ │ │ │ │ +143 } │ │ │ │ │ +144 │ │ │ │ │ +145 // convert a sequence of character digits into an unsigned integer │ │ │ │ │ +146 template │ │ │ │ │ +147 constexpr T chars2number () │ │ │ │ │ +148 { │ │ │ │ │ +149 const char arr[] = {digits...}; │ │ │ │ │ +150 T result = 0; │ │ │ │ │ +151 T _p_o_w_e_r = 1; │ │ │ │ │ +152 const T base = 10; │ │ │ │ │ +153 │ │ │ │ │ +154 const int N = sizeof...(digits); │ │ │ │ │ +155 for (int i = 0; i < N; ++i) { │ │ │ │ │ +156 char c = arr[N - 1 - i]; │ │ │ │ │ +157 result+= char2digit(c) * _p_o_w_e_r; │ │ │ │ │ +158 _p_o_w_e_r *= base; │ │ │ │ │ +159 } │ │ │ │ │ +160 │ │ │ │ │ +161 return result; │ │ │ │ │ +162 } │ │ │ │ │ +163 │ │ │ │ │ +164 } //namespace Impl │ │ │ │ │ +165 │ │ │ │ │ +172 template │ │ │ │ │ +_1_7_3 constexpr auto operator"" _ic() │ │ │ │ │ +174 { │ │ │ │ │ +175 return std::integral_constant()>{}; │ │ │ │ │ +176 } │ │ │ │ │ +177 │ │ │ │ │ +184 template │ │ │ │ │ +_1_8_5 constexpr auto operator"" _uc() │ │ │ │ │ +186 { │ │ │ │ │ +187 return std::integral_constant()>{}; │ │ │ │ │ +188 } │ │ │ │ │ +189 │ │ │ │ │ +196 template │ │ │ │ │ +_1_9_7 constexpr auto operator"" _sc() │ │ │ │ │ +198 { │ │ │ │ │ +199 return std::integral_constant()>{}; │ │ │ │ │ +200 } │ │ │ │ │ +201 │ │ │ │ │ +208 template │ │ │ │ │ +_2_0_9 constexpr auto _o_p_e_r_a_t_o_r_-_ (std::integral_constant) │ │ │ │ │ +210 { │ │ │ │ │ +211 return std::integral_constant, -value>{}; │ │ │ │ │ +212 } │ │ │ │ │ +213 │ │ │ │ │ +214 }} //namespace Indices::Literals │ │ │ │ │ +215} //namespace Dune │ │ │ │ │ +216 │ │ │ │ │ +217#endif // DUNE_COMMON_INDICES_HH │ │ │ │ │ +_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:100 │ │ │ │ │ +_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:97 │ │ │ │ │ +_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:76 │ │ │ │ │ +_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:73 │ │ │ │ │ +_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:52 │ │ │ │ │ +_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:79 │ │ │ │ │ +_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:94 │ │ │ │ │ +_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:55 │ │ │ │ │ +_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:61 │ │ │ │ │ +_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:88 │ │ │ │ │ +_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:124 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_i_c_e_s_:_:_L_i_t_e_r_a_l_s_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +constexpr auto operator-(std::integral_constant< T, value >) │ │ │ │ │ +Negation operator for integral constants. │ │ │ │ │ +DDeeffiinniittiioonn indices.hh:209 │ │ │ │ │ +_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:85 │ │ │ │ │ +_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:106 │ │ │ │ │ +_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:91 │ │ │ │ │ +_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:67 │ │ │ │ │ +_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:103 │ │ │ │ │ +_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:82 │ │ │ │ │ +_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:58 │ │ │ │ │ +_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:29 │ │ │ │ │ +_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:109 │ │ │ │ │ +_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:70 │ │ │ │ │ +_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:64 │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: simd.hh File Reference │ │ │ │ +dune-common: referencehelper.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,96 +70,60 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ Typedefs | │ │ │ │ -Functions
│ │ │ │ -
simd.hh File Reference
│ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
referencehelper.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Abstractions for support of dedicated SIMD data types. │ │ │ │ -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 <type_traits>
│ │ │ │ +#include <functional>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

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

│ │ │ │ -

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,79 +1,40 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +_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 │ │ │ │ │ -#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> │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_S_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. │ │ │ │ │   │ │ │ │ │ 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) │ │ │ │ │ +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 │ │ │ │ │ - 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) │ │ │ │ │ +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 │ │ │ │ │ - T &  _D_u_n_e_:_:_l_a_n_e (std::size_t l, T &v) │ │ │ │ │ -  access a lane of a simd vector (scalar version) │ │ │ │ │ + const auto &  _D_u_n_e_:_:_r_e_s_o_l_v_e_R_e_f (T &&gf)=delete │ │ │ │ │   │ │ │ │ │ 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) │ │ │ │ │ +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 │ │ │ │ │ - void  _D_u_n_e_:_:_s_w_a_p (T &v1, T &v2, bool mask) │ │ │ │ │ +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 ********** │ │ │ │ │ -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/a00014_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: simd.hh Source File │ │ │ │ +dune-common: referencehelper.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,518 +74,92 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
simd.hh
│ │ │ │ +
referencehelper.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © 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>
│ │ │ │ -
45
│ │ │ │ -
46namespace Dune
│ │ │ │ -
47{
│ │ │ │ -
48
│ │ │ │ -
49#if HAVE_VC
│ │ │ │ -
50 namespace VcImpl {
│ │ │ │ +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 © 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
│ │ │ │ +
7
│ │ │ │ +
8#include <type_traits>
│ │ │ │ +
9#include <functional>
│ │ │ │ +
10
│ │ │ │ +
11
│ │ │ │ +
12
│ │ │ │ +
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
│ │ │ │ -
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_]); }
│ │ │ │ +
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 // 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
│ │ │ │ -
Compatibility header for including <Vc/Vc>
│ │ │ │ -
Utilities for reduction like operations on ranges.
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ - │ │ │ │ - │ │ │ │ +
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
│ │ │ │ -
bool any_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:506
│ │ │ │ -
bool all_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:512
│ │ │ │ -
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:494
│ │ │ │ -
T min_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:500
│ │ │ │ -
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:128
│ │ │ │ -
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
│ │ │ │ +
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,549 +1,98 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -simd.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// SPDX-FileCopyrightInfo: Copyright © 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 © 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> │ │ │ │ │ -45 │ │ │ │ │ -46namespace _D_u_n_e │ │ │ │ │ -47{ │ │ │ │ │ -48 │ │ │ │ │ -49#if HAVE_VC │ │ │ │ │ -50 namespace VcImpl { │ │ │ │ │ +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 │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11 │ │ │ │ │ +12 │ │ │ │ │ +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 │ │ │ │ │ -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_]); } │ │ │ │ │ +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 // 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 │ │ │ │ │ -_v_c_._h_h │ │ │ │ │ -Compatibility header for including │ │ │ │ │ -_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. │ │ │ │ │ -_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 │ │ │ │ │ +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_:_:_a_n_y___t_r_u_e │ │ │ │ │ -bool any_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:506 │ │ │ │ │ -_D_u_n_e_:_:_a_l_l___t_r_u_e │ │ │ │ │ -bool all_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:512 │ │ │ │ │ -_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:494 │ │ │ │ │ -_D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ -T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ -DDeeffiinniittiioonn debugalign.hh:500 │ │ │ │ │ -_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:128 │ │ │ │ │ -_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_:_:_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: dynmatrix.hh File Reference │ │ │ │ +dune-common: fmatrixev.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,52 +70,67 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
dynmatrix.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
fmatrixev.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

Eigenvalue computations for the FieldMatrix class. │ │ │ │ More...

│ │ │ │ -
#include <cmath>
│ │ │ │ -#include <cstddef>
│ │ │ │ +
#include <algorithm>
│ │ │ │ #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 <cmath>
│ │ │ │ +#include <cassert>
│ │ │ │ +#include <dune-common-config.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <dune/common/math.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

struct  Dune::DenseMatVecTraits< DynamicMatrix< K > >
 
struct  Dune::FieldTraits< DynamicMatrix< K > >
 
class  Dune::DynamicMatrix< K >
 Construct a matrix with a dynamic size. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::FMatrixHelp
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

template<int dim, typename K >
static void Dune::FMatrixHelp::eigenValues (const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues)
 calculates the eigenvalues of a symmetric field matrix
 
template<int dim, typename K >
static void Dune::FMatrixHelp::eigenValuesVectors (const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors)
 calculates the eigenvalues and eigenvectors of a symmetric field matrix
 
template<int dim, typename K >
static void Dune::FMatrixHelp::eigenValuesLapack (const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues)
 calculates the eigenvalues of a symmetric field matrix
 
template<int dim, typename K >
static void Dune::FMatrixHelp::eigenValuesVectorsLapack (const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors)
 calculates the eigenvalues and -vectors of a symmetric field matrix
 
template<int dim, typename K , class C >
static void Dune::FMatrixHelp::eigenValuesNonSym (const FieldMatrix< K, dim, dim > &matrix, FieldVector< C, dim > &eigenValues)
 calculates the eigenvalues of a non-symmetric field matrix
 
│ │ │ │

Detailed Description

│ │ │ │ -

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

│ │ │ │ +

Eigenvalue computations for the FieldMatrix class.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +1,59 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +fmatrixev.hh File Reference │ │ │ │ │ +Eigenvalue computations for the FieldMatrix class. _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 │ │ │ │ │ +#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_/_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> │ │ │ │ │ +#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_/_f_m_a_t_r_i_x_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_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_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -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_:_:_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. │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s (const _F_i_e_l_d_M_a_t_r_i_x< K, dim, dim > │ │ │ │ │ + &matrix, _F_i_e_l_d_V_e_c_t_o_r< K, dim > &eigenValues) │ │ │ │ │ +  calculates the eigenvalues of a symmetric field matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_V_e_c_t_o_r_s (const _F_i_e_l_d_M_a_t_r_i_x< K, dim, │ │ │ │ │ + dim > &matrix, _F_i_e_l_d_V_e_c_t_o_r< K, dim > &_e_i_g_e_n_V_a_l_u_e_s, _F_i_e_l_d_M_a_t_r_i_x< K, │ │ │ │ │ + dim, dim > &eigenVectors) │ │ │ │ │ +  calculates the eigenvalues and eigenvectors of a symmetric field │ │ │ │ │ + matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_L_a_p_a_c_k (const _F_i_e_l_d_M_a_t_r_i_x< K, dim, │ │ │ │ │ + dim > &matrix, _F_i_e_l_d_V_e_c_t_o_r< K, dim > &_e_i_g_e_n_V_a_l_u_e_s) │ │ │ │ │ +  calculates the eigenvalues of a symmetric field matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_V_e_c_t_o_r_s_L_a_p_a_c_k (const _F_i_e_l_d_M_a_t_r_i_x< K, │ │ │ │ │ + dim, dim > &matrix, _F_i_e_l_d_V_e_c_t_o_r< K, dim > &_e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, dim, dim > &eigenVectors) │ │ │ │ │ +  calculates the eigenvalues and -vectors of a symmetric field │ │ │ │ │ + matrix │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_F_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 _F_i_e_l_d_M_a_t_r_i_x< K, dim, │ │ │ │ │ + dim > &matrix, _F_i_e_l_d_V_e_c_t_o_r< C, dim > &_e_i_g_e_n_V_a_l_u_e_s) │ │ │ │ │ +  calculates the eigenvalues of a non-symmetric field matrix │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements a dense matrix with dynamic numbers of rows and columns. │ │ │ │ │ +Eigenvalue computations for the FieldMatrix class. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: dynmatrix.hh Source File │ │ │ │ +dune-common: fmatrixev.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,215 +74,641 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
dynmatrix.hh
│ │ │ │ +
fmatrixev.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 © 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
│ │ │ │ +
5#ifndef DUNE_FMATRIXEIGENVALUES_HH
│ │ │ │ +
6#define DUNE_FMATRIXEIGENVALUES_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
│ │ │ │ -
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 }
│ │ │ │ -
│ │ │ │ -
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 };
│ │ │ │ -
│ │ │ │ +
12#include <algorithm>
│ │ │ │ +
13#include <iostream>
│ │ │ │ +
14#include <cmath>
│ │ │ │ +
15#include <cassert>
│ │ │ │ +
16
│ │ │ │ +
17#include <dune-common-config.hh> // HAVE_LAPACK
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
21#include <dune/common/math.hh>
│ │ │ │ +
22
│ │ │ │ +
23namespace Dune {
│ │ │ │ +
24
│ │ │ │ +
30 namespace FMatrixHelp {
│ │ │ │ +
31
│ │ │ │ +
32#if HAVE_LAPACK
│ │ │ │ +
33 // defined in fmatrixev.cc
│ │ │ │ +
34 extern void eigenValuesLapackCall(
│ │ │ │ +
35 const char* jobz, const char* uplo, const long
│ │ │ │ +
36 int* n, double* a, const long int* lda, double* w,
│ │ │ │ +
37 double* work, const long int* lwork, long int* info);
│ │ │ │ +
38
│ │ │ │ +
39 extern void eigenValuesNonsymLapackCall(
│ │ │ │ +
40 const char* jobvl, const char* jobvr, const long
│ │ │ │ +
41 int* n, double* a, const long int* lda, double* wr, double* wi, double* vl,
│ │ │ │ +
42 const long int* ldvl, double* vr, const long int* ldvr, double* work,
│ │ │ │ +
43 const long int* lwork, long int* info);
│ │ │ │ +
44
│ │ │ │ +
45 extern void eigenValuesLapackCall(
│ │ │ │ +
46 const char* jobz, const char* uplo, const long
│ │ │ │ +
47 int* n, float* a, const long int* lda, float* w,
│ │ │ │ +
48 float* work, const long int* lwork, long int* info);
│ │ │ │ +
49
│ │ │ │ +
50 extern void eigenValuesNonsymLapackCall(
│ │ │ │ +
51 const char* jobvl, const char* jobvr, const long
│ │ │ │ +
52 int* n, float* a, const long int* lda, float* wr, float* wi, float* vl,
│ │ │ │ +
53 const long int* ldvl, float* vr, const long int* ldvr, float* work,
│ │ │ │ +
54 const long int* lwork, long int* info);
│ │ │ │ +
55
│ │ │ │ +
56#endif
│ │ │ │ +
57
│ │ │ │ +
58 namespace Impl {
│ │ │ │ +
59 //internal tag to activate/disable code for eigenvector calculation at compile time
│ │ │ │ +
60 enum Jobs { OnlyEigenvalues=0, EigenvaluesEigenvectors=1 };
│ │ │ │ +
61
│ │ │ │ +
62 //internal dummy used if only eigenvalues are to be calculated
│ │ │ │ +
63 template<typename K, int dim>
│ │ │ │ +
64 using EVDummy = FieldMatrix<K, dim, dim>;
│ │ │ │ +
65
│ │ │ │ +
66 //compute the cross-product of two vectors
│ │ │ │ +
67 template<typename K>
│ │ │ │ +
68 inline FieldVector<K,3> crossProduct(const FieldVector<K,3>& vec0, const FieldVector<K,3>& vec1) {
│ │ │ │ +
69 return {vec0[1]*vec1[2] - vec0[2]*vec1[1], vec0[2]*vec1[0] - vec0[0]*vec1[2], vec0[0]*vec1[1] - vec0[1]*vec1[0]};
│ │ │ │ +
70 }
│ │ │ │ +
71
│ │ │ │ +
72 template <typename K>
│ │ │ │ +
73 static void eigenValues2dImpl(const FieldMatrix<K, 2, 2>& matrix,
│ │ │ │ +
74 FieldVector<K, 2>& eigenvalues)
│ │ │ │ +
75 {
│ │ │ │ +
76 using std::sqrt;
│ │ │ │ +
77 const K p = 0.5 * (matrix[0][0] + matrix [1][1]);
│ │ │ │ +
78 const K p2 = p - matrix[1][1];
│ │ │ │ +
79 K q = p2 * p2 + matrix[1][0] * matrix[0][1];
│ │ │ │ +
80 if( q < 0 && q > -1e-14 ) q = 0;
│ │ │ │ +
81 if (q < 0)
│ │ │ │ +
82 {
│ │ │ │ +
83 std::cout << matrix << std::endl;
│ │ │ │ +
84 // Complex eigenvalues are either caused by non-symmetric matrices or by round-off errors
│ │ │ │ +
85 DUNE_THROW(MathError, "Complex eigenvalue detected (which this implementation cannot handle).");
│ │ │ │ +
86 }
│ │ │ │ +
87
│ │ │ │ +
88 // get square root
│ │ │ │ +
89 q = sqrt(q);
│ │ │ │ +
90
│ │ │ │ +
91 // store eigenvalues in ascending order
│ │ │ │ +
92 eigenvalues[0] = p - q;
│ │ │ │ +
93 eigenvalues[1] = p + q;
│ │ │ │ +
94 }
│ │ │ │ +
95
│ │ │ │ +
96 /*
│ │ │ │ +
97 This implementation was adapted from the pseudo-code (Python?) implementation found on
│ │ │ │ +
98 http://en.wikipedia.org/wiki/Eigenvalue_algorithm (retrieved late August 2014).
│ │ │ │ +
99 Wikipedia claims to have taken it from
│ │ │ │ +
100 Smith, Oliver K. (April 1961), Eigenvalues of a symmetric 3 × 3 matrix.,
│ │ │ │ +
101 Communications of the ACM 4 (4): 168, doi:10.1145/355578.366316
│ │ │ │ +
102 */
│ │ │ │ +
103 template <typename K>
│ │ │ │ +
104 static K eigenValues3dImpl(const FieldMatrix<K, 3, 3>& matrix,
│ │ │ │ +
105 FieldVector<K, 3>& eigenvalues)
│ │ │ │ +
106 {
│ │ │ │ +
107 using std::sqrt;
│ │ │ │ +
108 using std::acos;
│ │ │ │ +
109 using real_type = typename FieldTraits<K>::real_type;
│ │ │ │ +
110 const K pi = MathematicalConstants<K>::pi();
│ │ │ │ +
111 K p1 = matrix[0][1]*matrix[0][1] + matrix[0][2]*matrix[0][2] + matrix[1][2]*matrix[1][2];
│ │ │ │ +
112
│ │ │ │ +
113 if (p1 <= std::numeric_limits<K>::epsilon()) {
│ │ │ │ +
114 // A is diagonal.
│ │ │ │ +
115 eigenvalues[0] = matrix[0][0];
│ │ │ │ +
116 eigenvalues[1] = matrix[1][1];
│ │ │ │ +
117 eigenvalues[2] = matrix[2][2];
│ │ │ │ +
118 std::sort(eigenvalues.begin(), eigenvalues.end());
│ │ │ │ +
119
│ │ │ │ +
120 return 0.0;
│ │ │ │ +
121 }
│ │ │ │ +
122 else
│ │ │ │ +
123 {
│ │ │ │ +
124 // q = trace(A)/3
│ │ │ │ +
125 K q = 0;
│ │ │ │ +
126 for (int i=0; i<3; i++)
│ │ │ │ +
127 q += matrix[i][i] / 3.0;
│ │ │ │ +
128
│ │ │ │ +
129 K p2 = (matrix[0][0] - q)*(matrix[0][0] - q) + (matrix[1][1] - q)*(matrix[1][1] - q) + (matrix[2][2] - q)*(matrix[2][2] - q) + 2.0 * p1;
│ │ │ │ +
130 K p = sqrt(p2 / 6);
│ │ │ │ +
131 // B = (1 / p) * (A - q * I); // I is the identity matrix
│ │ │ │ +
132 FieldMatrix<K,3,3> B;
│ │ │ │ +
133 for (int i=0; i<3; i++)
│ │ │ │ +
134 for (int j=0; j<3; j++)
│ │ │ │ +
135 B[i][j] = (real_type(1.0)/p) * (matrix[i][j] - q*(i==j));
│ │ │ │ +
136
│ │ │ │ +
137 K r = B.determinant() / 2.0;
│ │ │ │ +
138
│ │ │ │ +
139 /*In exact arithmetic for a symmetric matrix -1 <= r <= 1
│ │ │ │ +
140 but computation error can leave it slightly outside this range.
│ │ │ │ +
141 acos(z) function requires |z| <= 1, but will fail silently
│ │ │ │ +
142 and return NaN if the input is larger than 1 in magnitude.
│ │ │ │ +
143 Thus r is clamped to [-1,1].*/
│ │ │ │ +
144 using std::clamp;
│ │ │ │ +
145 r = clamp<K>(r, -1.0, 1.0);
│ │ │ │ +
146 K phi = acos(r) / 3.0;
│ │ │ │ +
147
│ │ │ │ +
148 // the eigenvalues satisfy eig[2] <= eig[1] <= eig[0]
│ │ │ │ +
149 eigenvalues[2] = q + 2 * p * cos(phi);
│ │ │ │ +
150 eigenvalues[0] = q + 2 * p * cos(phi + (2*pi/3));
│ │ │ │ +
151 eigenvalues[1] = 3 * q - eigenvalues[0] - eigenvalues[2]; // since trace(matrix) = eig1 + eig2 + eig3
│ │ │ │ +
152
│ │ │ │ +
153 return r;
│ │ │ │ +
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...
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
This file implements a dense vector with a dynamic size.
│ │ │ │ -
Macro for wrapping boundary checks.
│ │ │ │ -
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
│ │ │ │ +
157 //see https://www.geometrictools.com/Documentation/RobustEigenSymmetric3x3.pdf
│ │ │ │ +
158 //Robustly compute a right-handed orthonormal set {u, v, evec0}.
│ │ │ │ +
159 template<typename K>
│ │ │ │ +
160 void orthoComp(const FieldVector<K,3>& evec0, FieldVector<K,3>& u, FieldVector<K,3>& v) {
│ │ │ │ +
161 using std::abs;
│ │ │ │ +
162 if(abs(evec0[0]) > abs(evec0[1])) {
│ │ │ │ +
163 //The component of maximum absolute value is either evec0[0] or evec0[2].
│ │ │ │ +
164 FieldVector<K,2> temp = {evec0[0], evec0[2]};
│ │ │ │ +
165 auto L = 1.0 / temp.two_norm();
│ │ │ │ +
166 u = L * FieldVector<K,3>({-evec0[2], 0.0, evec0[0]});
│ │ │ │ +
167 }
│ │ │ │ +
168 else {
│ │ │ │ +
169 //The component of maximum absolute value is either evec0[1] or evec0[2].
│ │ │ │ +
170 FieldVector<K,2> temp = {evec0[1], evec0[2]};
│ │ │ │ +
171 auto L = 1.0 / temp.two_norm();
│ │ │ │ +
172 u = L * FieldVector<K,3>({0.0, evec0[2], -evec0[1]});
│ │ │ │ +
173 }
│ │ │ │ +
174 v = crossProduct(evec0, u);
│ │ │ │ +
175 }
│ │ │ │ +
176
│ │ │ │ +
177 //see https://www.geometrictools.com/Documentation/RobustEigenSymmetric3x3.pdf
│ │ │ │ +
178 template<typename K>
│ │ │ │ +
179 void eig0(const FieldMatrix<K,3,3>& matrix, K eval0, FieldVector<K,3>& evec0) {
│ │ │ │ +
180 /* Compute a unit-length eigenvector for eigenvalue[i0]. The
│ │ │ │ +
181 matrix is rank 2, so two of the rows are linearly independent.
│ │ │ │ +
182 For a robust computation of the eigenvector, select the two
│ │ │ │ +
183 rows whose cross product has largest length of all pairs of
│ │ │ │ +
184 rows. */
│ │ │ │ +
185 using Vector = FieldVector<K,3>;
│ │ │ │ +
186 Vector row0 = {matrix[0][0]-eval0, matrix[0][1], matrix[0][2]};
│ │ │ │ +
187 Vector row1 = {matrix[1][0], matrix[1][1]-eval0, matrix[1][2]};
│ │ │ │ +
188 Vector row2 = {matrix[2][0], matrix[2][1], matrix[2][2]-eval0};
│ │ │ │ +
189
│ │ │ │ +
190 Vector r0xr1 = crossProduct(row0, row1);
│ │ │ │ +
191 Vector r0xr2 = crossProduct(row0, row2);
│ │ │ │ +
192 Vector r1xr2 = crossProduct(row1, row2);
│ │ │ │ +
193 auto d0 = r0xr1.two_norm();
│ │ │ │ +
194 auto d1 = r0xr2.two_norm();
│ │ │ │ +
195 auto d2 = r1xr2.two_norm();
│ │ │ │ +
196
│ │ │ │ +
197 auto dmax = d0 ;
│ │ │ │ +
198 int imax = 0;
│ │ │ │ +
199 if(d1>dmax) {
│ │ │ │ +
200 dmax = d1;
│ │ │ │ +
201 imax = 1;
│ │ │ │ +
202 }
│ │ │ │ +
203 if(d2>dmax)
│ │ │ │ +
204 imax = 2;
│ │ │ │ +
205
│ │ │ │ +
206 if(imax == 0)
│ │ │ │ +
207 evec0 = r0xr1 / d0;
│ │ │ │ +
208 else if(imax == 1)
│ │ │ │ +
209 evec0 = r0xr2 / d1;
│ │ │ │ +
210 else
│ │ │ │ +
211 evec0 = r1xr2 / d2;
│ │ │ │ +
212 }
│ │ │ │ +
213
│ │ │ │ +
214 //see https://www.geometrictools.com/Documentation/RobustEigenSymmetric3x3.pdf
│ │ │ │ +
215 template<typename K>
│ │ │ │ +
216 void eig1(const FieldMatrix<K,3,3>& matrix, const FieldVector<K,3>& evec0, FieldVector<K,3>& evec1, K eval1) {
│ │ │ │ +
217 using Vector = FieldVector<K,3>;
│ │ │ │ +
218
│ │ │ │ +
219 //Robustly compute a right-handed orthonormal set {u, v, evec0}.
│ │ │ │ +
220 Vector u,v;
│ │ │ │ +
221 orthoComp(evec0, u, v);
│ │ │ │ +
222
│ │ │ │ +
223 /* Let e be eval1 and let E be a corresponding eigenvector which
│ │ │ │ +
224 is a solution to the linear system (A - e*I)*E = 0. The matrix
│ │ │ │ +
225 (A - e*I) is 3x3, not invertible (so infinitely many
│ │ │ │ +
226 solutions), and has rank 2 when eval1 and eval are different.
│ │ │ │ +
227 It has rank 1 when eval1 and eval2 are equal. Numerically, it
│ │ │ │ +
228 is difficult to compute robustly the rank of a matrix. Instead,
│ │ │ │ +
229 the 3x3 linear system is reduced to a 2x2 system as follows.
│ │ │ │ +
230 Define the 3x2 matrix J = [u,v] whose columns are the u and v
│ │ │ │ +
231 computed previously. Define the 2x1 vector X = J*E. The 2x2
│ │ │ │ +
232 system is 0 = M * X = (J^T * (A - e*I) * J) * X where J^T is
│ │ │ │ +
233 the transpose of J and M = J^T * (A - e*I) * J is a 2x2 matrix.
│ │ │ │ +
234 The system may be written as
│ │ │ │ +
235 +- -++- -+ +- -+
│ │ │ │ +
236 | U^T*A*U - e U^T*A*V || x0 | = e * | x0 |
│ │ │ │ +
237 | V^T*A*U V^T*A*V - e || x1 | | x1 |
│ │ │ │ +
238 +- -++ -+ +- -+
│ │ │ │ +
239 where X has row entries x0 and x1. */
│ │ │ │ +
240
│ │ │ │ +
241 Vector Au, Av;
│ │ │ │ +
242 matrix.mv(u, Au);
│ │ │ │ +
243 matrix.mv(v, Av);
│ │ │ │ +
244
│ │ │ │ +
245 auto m00 = u.dot(Au) - eval1;
│ │ │ │ +
246 auto m01 = u.dot(Av);
│ │ │ │ +
247 auto m11 = v.dot(Av) - eval1;
│ │ │ │ +
248
│ │ │ │ +
249 /* For robustness, choose the largest-length row of M to compute
│ │ │ │ +
250 the eigenvector. The 2-tuple of coefficients of U and V in the
│ │ │ │ +
251 assignments to eigenvector[1] lies on a circle, and U and V are
│ │ │ │ +
252 unit length and perpendicular, so eigenvector[1] is unit length
│ │ │ │ +
253 (within numerical tolerance). */
│ │ │ │ +
254 using std::abs, std::sqrt, std::max;
│ │ │ │ +
255 auto absM00 = abs(m00);
│ │ │ │ +
256 auto absM01 = abs(m01);
│ │ │ │ +
257 auto absM11 = abs(m11);
│ │ │ │ +
258 if(absM00 >= absM11) {
│ │ │ │ +
259 auto maxAbsComp = max(absM00, absM01);
│ │ │ │ +
260 if(maxAbsComp > 0.0) {
│ │ │ │ +
261 if(absM00 >= absM01) {
│ │ │ │ +
262 m01 /= m00;
│ │ │ │ +
263 m00 = 1.0 / sqrt(1.0 + m01*m01);
│ │ │ │ +
264 m01 *= m00;
│ │ │ │ +
265 }
│ │ │ │ +
266 else {
│ │ │ │ +
267 m00 /= m01;
│ │ │ │ +
268 m01 = 1.0 / sqrt(1.0 + m00*m00);
│ │ │ │ +
269 m00 *= m01;
│ │ │ │ +
270 }
│ │ │ │ +
271 evec1 = m01*u - m00*v;
│ │ │ │ +
272 }
│ │ │ │ +
273 else
│ │ │ │ +
274 evec1 = u;
│ │ │ │ +
275 }
│ │ │ │ +
276 else {
│ │ │ │ +
277 auto maxAbsComp = max(absM11, absM01);
│ │ │ │ +
278 if(maxAbsComp > 0.0) {
│ │ │ │ +
279 if(absM11 >= absM01) {
│ │ │ │ +
280 m01 /= m11;
│ │ │ │ +
281 m11 = 1.0 / sqrt(1.0 + m01*m01);
│ │ │ │ +
282 m01 *= m11;
│ │ │ │ +
283 }
│ │ │ │ +
284 else {
│ │ │ │ +
285 m11 /= m01;
│ │ │ │ +
286 m01 = 1.0 / sqrt(1.0 + m11*m11);
│ │ │ │ +
287 m11 *= m01;
│ │ │ │ +
288 }
│ │ │ │ +
289 evec1 = m11*u - m01*v;
│ │ │ │ +
290 }
│ │ │ │ +
291 else
│ │ │ │ +
292 evec1 = u;
│ │ │ │ +
293 }
│ │ │ │ +
294 }
│ │ │ │ +
295
│ │ │ │ +
296 // 1d specialization
│ │ │ │ +
297 template<Jobs Tag, typename K>
│ │ │ │ +
298 static void eigenValuesVectorsImpl(const FieldMatrix<K, 1, 1>& matrix,
│ │ │ │ +
299 FieldVector<K, 1>& eigenValues,
│ │ │ │ +
300 FieldMatrix<K, 1, 1>& eigenVectors)
│ │ │ │ +
301 {
│ │ │ │ +
302 eigenValues[0] = matrix[0][0];
│ │ │ │ +
303 if constexpr(Tag==EigenvaluesEigenvectors)
│ │ │ │ +
304 eigenVectors[0] = {1.0};
│ │ │ │ +
305 }
│ │ │ │ +
306
│ │ │ │ +
307
│ │ │ │ +
308 // 2d specialization
│ │ │ │ +
309 template <Jobs Tag, typename K>
│ │ │ │ +
310 static void eigenValuesVectorsImpl(const FieldMatrix<K, 2, 2>& matrix,
│ │ │ │ +
311 FieldVector<K, 2>& eigenValues,
│ │ │ │ +
312 FieldMatrix<K, 2, 2>& eigenVectors)
│ │ │ │ +
313 {
│ │ │ │ +
314 // Compute eigen values
│ │ │ │ +
315 Impl::eigenValues2dImpl(matrix, eigenValues);
│ │ │ │ +
316
│ │ │ │ +
317 // Compute eigenvectors by exploiting the Cayley–Hamilton theorem.
│ │ │ │ +
318 // If λ_1, λ_2 are the eigenvalues, then (A - λ_1I )(A - λ_2I ) = (A - λ_2I )(A - λ_1I ) = 0,
│ │ │ │ +
319 // so the columns of (A - λ_2I ) are annihilated by (A - λ_1I ) and vice versa.
│ │ │ │ +
320 // Assuming neither matrix is zero, the columns of each must include eigenvectors
│ │ │ │ +
321 // for the other eigenvalue. (If either matrix is zero, then A is a multiple of the
│ │ │ │ +
322 // identity and any non-zero vector is an eigenvector.)
│ │ │ │ +
323 // From: https://en.wikipedia.org/wiki/Eigenvalue_algorithm#2x2_matrices
│ │ │ │ +
324 if constexpr(Tag==EigenvaluesEigenvectors) {
│ │ │ │ +
325
│ │ │ │ +
326 // Special casing for multiples of the identity
│ │ │ │ +
327 FieldMatrix<K,2,2> temp = matrix;
│ │ │ │ +
328 temp[0][0] -= eigenValues[0];
│ │ │ │ +
329 temp[1][1] -= eigenValues[0];
│ │ │ │ +
330 if(temp.infinity_norm() <= 1e-14) {
│ │ │ │ +
331 eigenVectors[0] = {1.0, 0.0};
│ │ │ │ +
332 eigenVectors[1] = {0.0, 1.0};
│ │ │ │ +
333 }
│ │ │ │ +
334 else {
│ │ │ │ +
335 // The columns of A - λ_2I are eigenvectors for λ_1, or zero.
│ │ │ │ +
336 // Take the column with the larger norm to avoid zero columns.
│ │ │ │ +
337 FieldVector<K,2> ev0 = {matrix[0][0]-eigenValues[1], matrix[1][0]};
│ │ │ │ +
338 FieldVector<K,2> ev1 = {matrix[0][1], matrix[1][1]-eigenValues[1]};
│ │ │ │ +
339 eigenVectors[0] = (ev0.two_norm2() >= ev1.two_norm2()) ? ev0/ev0.two_norm() : ev1/ev1.two_norm();
│ │ │ │ +
340
│ │ │ │ +
341 // The columns of A - λ_1I are eigenvectors for λ_2, or zero.
│ │ │ │ +
342 // Take the column with the larger norm to avoid zero columns.
│ │ │ │ +
343 ev0 = {matrix[0][0]-eigenValues[0], matrix[1][0]};
│ │ │ │ +
344 ev1 = {matrix[0][1], matrix[1][1]-eigenValues[0]};
│ │ │ │ +
345 eigenVectors[1] = (ev0.two_norm2() >= ev1.two_norm2()) ? ev0/ev0.two_norm() : ev1/ev1.two_norm();
│ │ │ │ +
346 }
│ │ │ │ +
347 }
│ │ │ │ +
348 }
│ │ │ │ +
349
│ │ │ │ +
350 // 3d specialization
│ │ │ │ +
351 template <Jobs Tag, typename K>
│ │ │ │ +
352 static void eigenValuesVectorsImpl(const FieldMatrix<K, 3, 3>& matrix,
│ │ │ │ +
353 FieldVector<K, 3>& eigenValues,
│ │ │ │ +
354 FieldMatrix<K, 3, 3>& eigenVectors)
│ │ │ │ +
355 {
│ │ │ │ +
356 using Vector = FieldVector<K,3>;
│ │ │ │ +
357 using Matrix = FieldMatrix<K,3,3>;
│ │ │ │ +
358
│ │ │ │ +
359 //compute eigenvalues
│ │ │ │ +
360 /* Precondition the matrix by factoring out the maximum absolute
│ │ │ │ +
361 value of the components. This guards against floating-point
│ │ │ │ +
362 overflow when computing the eigenvalues.*/
│ │ │ │ +
363 using std::isnormal;
│ │ │ │ +
364 K maxAbsElement = (isnormal(matrix.infinity_norm())) ? matrix.infinity_norm() : K(1.0);
│ │ │ │ +
365 Matrix scaledMatrix = matrix / maxAbsElement;
│ │ │ │ +
366 K r = Impl::eigenValues3dImpl(scaledMatrix, eigenValues);
│ │ │ │ +
367
│ │ │ │ +
368 if constexpr(Tag==EigenvaluesEigenvectors) {
│ │ │ │ +
369 K offDiagNorm = Vector{scaledMatrix[0][1],scaledMatrix[0][2],scaledMatrix[1][2]}.two_norm2();
│ │ │ │ +
370 if (offDiagNorm <= std::numeric_limits<K>::epsilon())
│ │ │ │ +
371 {
│ │ │ │ +
372 eigenValues = {scaledMatrix[0][0], scaledMatrix[1][1], scaledMatrix[2][2]};
│ │ │ │ +
373 eigenVectors = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}};
│ │ │ │ +
374
│ │ │ │ +
375 // Use bubble sort to jointly sort eigenvalues and eigenvectors
│ │ │ │ +
376 // such that eigenvalues are ascending
│ │ │ │ +
377 if (eigenValues[0] > eigenValues[1])
│ │ │ │ +
378 {
│ │ │ │ +
379 std::swap(eigenValues[0], eigenValues[1]);
│ │ │ │ +
380 std::swap(eigenVectors[0], eigenVectors[1]);
│ │ │ │ +
381 }
│ │ │ │ +
382 if (eigenValues[1] > eigenValues[2])
│ │ │ │ +
383 {
│ │ │ │ +
384 std::swap(eigenValues[1], eigenValues[2]);
│ │ │ │ +
385 std::swap(eigenVectors[1], eigenVectors[2]);
│ │ │ │ +
386 }
│ │ │ │ +
387 if (eigenValues[0] > eigenValues[1])
│ │ │ │ +
388 {
│ │ │ │ +
389 std::swap(eigenValues[0], eigenValues[1]);
│ │ │ │ +
390 std::swap(eigenVectors[0], eigenVectors[1]);
│ │ │ │ +
391 }
│ │ │ │ +
392 }
│ │ │ │ +
393 else {
│ │ │ │ +
394 /*Compute the eigenvectors so that the set
│ │ │ │ +
395 [evec[0], evec[1], evec[2]] is right handed and
│ │ │ │ +
396 orthonormal. */
│ │ │ │ +
397
│ │ │ │ +
398 Matrix evec(0.0);
│ │ │ │ +
399 Vector eval(eigenValues);
│ │ │ │ +
400 if(r >= 0) {
│ │ │ │ +
401 Impl::eig0(scaledMatrix, eval[2], evec[2]);
│ │ │ │ +
402 Impl::eig1(scaledMatrix, evec[2], evec[1], eval[1]);
│ │ │ │ +
403 evec[0] = Impl::crossProduct(evec[1], evec[2]);
│ │ │ │ +
404 }
│ │ │ │ +
405 else {
│ │ │ │ +
406 Impl::eig0(scaledMatrix, eval[0], evec[0]);
│ │ │ │ +
407 Impl::eig1(scaledMatrix, evec[0], evec[1], eval[1]);
│ │ │ │ +
408 evec[2] = Impl::crossProduct(evec[0], evec[1]);
│ │ │ │ +
409 }
│ │ │ │ +
410 //sort eval/evec-pairs in ascending order
│ │ │ │ +
411 using EVPair = std::pair<K, Vector>;
│ │ │ │ +
412 std::vector<EVPair> pairs;
│ │ │ │ +
413 for(std::size_t i=0; i<=2; ++i)
│ │ │ │ +
414 pairs.push_back(EVPair(eval[i], evec[i]));
│ │ │ │ +
415 auto comp = [](EVPair x, EVPair y){ return x.first < y.first; };
│ │ │ │ +
416 std::sort(pairs.begin(), pairs.end(), comp);
│ │ │ │ +
417 for(std::size_t i=0; i<=2; ++i){
│ │ │ │ +
418 eigenValues[i] = pairs[i].first;
│ │ │ │ +
419 eigenVectors[i] = pairs[i].second;
│ │ │ │ +
420 }
│ │ │ │ +
421 }
│ │ │ │ +
422 }
│ │ │ │ +
423 //The preconditioning scaled the matrix, which scales the eigenvalues. Revert the scaling.
│ │ │ │ +
424 eigenValues *= maxAbsElement;
│ │ │ │ +
425 }
│ │ │ │ +
426
│ │ │ │ +
427 // forwarding to LAPACK with corresponding tag
│ │ │ │ +
428 template <Jobs Tag, int dim, typename K>
│ │ │ │ +
429 static void eigenValuesVectorsLapackImpl(const FieldMatrix<K, dim, dim>& matrix,
│ │ │ │ +
430 FieldVector<K, dim>& eigenValues,
│ │ │ │ +
431 FieldMatrix<K, dim, dim>& eigenVectors)
│ │ │ │ +
432 {
│ │ │ │ +
433 {
│ │ │ │ +
434#if HAVE_LAPACK
│ │ │ │ +
435 /*Lapack uses a proprietary tag to determine whether both eigenvalues and
│ │ │ │ +
436 -vectors ('v') or only eigenvalues ('n') should be calculated */
│ │ │ │ +
437 const char jobz = "nv"[Tag];
│ │ │ │ +
438
│ │ │ │ +
439 const long int N = dim ;
│ │ │ │ +
440 const char uplo = 'u'; // use upper triangular matrix
│ │ │ │ +
441
│ │ │ │ +
442 // length of matrix vector, LWORK >= max(1,3*N-1)
│ │ │ │ +
443 const long int lwork = 3*N -1 ;
│ │ │ │ +
444
│ │ │ │ +
445 constexpr bool isKLapackType = std::is_same_v<K,double> || std::is_same_v<K,float>;
│ │ │ │ +
446 using LapackNumType = std::conditional_t<isKLapackType, K, double>;
│ │ │ │ +
447
│ │ │ │ +
448 // matrix to put into dsyev
│ │ │ │ +
449 LapackNumType matrixVector[dim * dim];
│ │ │ │ +
450
│ │ │ │ +
451 // copy matrix
│ │ │ │ +
452 int row = 0;
│ │ │ │ +
453 for(int i=0; i<dim; ++i)
│ │ │ │ +
454 {
│ │ │ │ +
455 for(int j=0; j<dim; ++j, ++row)
│ │ │ │ +
456 {
│ │ │ │ +
457 matrixVector[ row ] = matrix[ i ][ j ];
│ │ │ │ +
458 }
│ │ │ │ +
459 }
│ │ │ │ +
460
│ │ │ │ +
461 // working memory
│ │ │ │ +
462 LapackNumType workSpace[lwork];
│ │ │ │ +
463
│ │ │ │ +
464 // return value information
│ │ │ │ +
465 long int info = 0;
│ │ │ │ +
466 LapackNumType* ev;
│ │ │ │ +
467 if constexpr (isKLapackType){
│ │ │ │ +
468 ev = &eigenValues[0];
│ │ │ │ +
469 }else{
│ │ │ │ +
470 ev = new LapackNumType[dim];
│ │ │ │ +
471 }
│ │ │ │ +
472
│ │ │ │ +
473 // call LAPACK routine (see fmatrixev.cc)
│ │ │ │ +
474 eigenValuesLapackCall(&jobz, &uplo, &N, &matrixVector[0], &N,
│ │ │ │ +
475 ev, &workSpace[0], &lwork, &info);
│ │ │ │ +
476
│ │ │ │ +
477 if constexpr (!isKLapackType){
│ │ │ │ +
478 for(size_t i=0;i<dim;++i)
│ │ │ │ +
479 eigenValues[i] = ev[i];
│ │ │ │ +
480 delete[] ev;
│ │ │ │ +
481 }
│ │ │ │ +
482
│ │ │ │ +
483 // restore eigenvectors matrix
│ │ │ │ +
484 if (Tag==Jobs::EigenvaluesEigenvectors){
│ │ │ │ +
485 row = 0;
│ │ │ │ +
486 for(int i=0; i<dim; ++i)
│ │ │ │ +
487 {
│ │ │ │ +
488 for(int j=0; j<dim; ++j, ++row)
│ │ │ │ +
489 {
│ │ │ │ +
490 eigenVectors[ i ][ j ] = matrixVector[ row ];
│ │ │ │ +
491 }
│ │ │ │ +
492 }
│ │ │ │ +
493 }
│ │ │ │ +
494
│ │ │ │ +
495 if( info != 0 )
│ │ │ │ +
496 {
│ │ │ │ +
497 std::cerr << "For matrix " << matrix << " eigenvalue calculation failed! " << std::endl;
│ │ │ │ +
498 DUNE_THROW(InvalidStateException,"eigenValues: Eigenvalue calculation failed!");
│ │ │ │ +
499 }
│ │ │ │ +
500#else
│ │ │ │ +
501 DUNE_THROW(NotImplemented,"LAPACK not found!");
│ │ │ │ +
502#endif
│ │ │ │ +
503 }
│ │ │ │ +
504 }
│ │ │ │ +
505
│ │ │ │ +
506 // generic specialization
│ │ │ │ +
507 template <Jobs Tag, int dim, typename K>
│ │ │ │ +
508 static void eigenValuesVectorsImpl(const FieldMatrix<K, dim, dim>& matrix,
│ │ │ │ +
509 FieldVector<K, dim>& eigenValues,
│ │ │ │ +
510 FieldMatrix<K, dim, dim>& eigenVectors)
│ │ │ │ +
511 {
│ │ │ │ +
512 eigenValuesVectorsLapackImpl<Tag>(matrix,eigenValues,eigenVectors);
│ │ │ │ +
513 }
│ │ │ │ +
514 } //namespace Impl
│ │ │ │ +
515
│ │ │ │ +
523 template <int dim, typename K>
│ │ │ │ +
│ │ │ │ +
524 static void eigenValues(const FieldMatrix<K, dim, dim>& matrix,
│ │ │ │ + │ │ │ │ +
526 {
│ │ │ │ + │ │ │ │ +
528 Impl::eigenValuesVectorsImpl<Impl::Jobs::OnlyEigenvalues>(matrix, eigenValues, dummy);
│ │ │ │ +
529 }
│ │ │ │ +
│ │ │ │ +
530
│ │ │ │ +
539 template <int dim, typename K>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
542 FieldMatrix<K, dim, dim>& eigenVectors)
│ │ │ │ +
543 {
│ │ │ │ +
544 Impl::eigenValuesVectorsImpl<Impl::Jobs::EigenvaluesEigenvectors>(matrix, eigenValues, eigenVectors);
│ │ │ │ +
545 }
│ │ │ │ +
│ │ │ │ +
546
│ │ │ │ +
554 template <int dim, typename K>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
557 {
│ │ │ │ + │ │ │ │ +
559 Impl::eigenValuesVectorsLapackImpl<Impl::Jobs::EigenvaluesEigenvectors>(matrix, eigenValues, dummy);
│ │ │ │ +
560 }
│ │ │ │ +
│ │ │ │ +
561
│ │ │ │ +
570 template <int dim, typename K>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
573 FieldMatrix<K, dim, dim>& eigenVectors)
│ │ │ │ +
574 {
│ │ │ │ +
575 Impl::eigenValuesVectorsLapackImpl<Impl::Jobs::EigenvaluesEigenvectors>(matrix, eigenValues, eigenVectors);
│ │ │ │ +
576 }
│ │ │ │ +
│ │ │ │ +
577
│ │ │ │ +
585 template <int dim, typename K, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
588 {
│ │ │ │ +
589#if HAVE_LAPACK
│ │ │ │ +
590 {
│ │ │ │ +
591 const long int N = dim ;
│ │ │ │ +
592 const char jobvl = 'n';
│ │ │ │ +
593 const char jobvr = 'n';
│ │ │ │ +
594
│ │ │ │ +
595 constexpr bool isKLapackType = std::is_same_v<K,double> || std::is_same_v<K,float>;
│ │ │ │ +
596 using LapackNumType = std::conditional_t<isKLapackType, K, double>;
│ │ │ │ +
597
│ │ │ │ +
598 // matrix to put into dgeev
│ │ │ │ +
599 LapackNumType matrixVector[dim * dim];
│ │ │ │ +
600
│ │ │ │ +
601 // copy matrix
│ │ │ │ +
602 int row = 0;
│ │ │ │ +
603 for(int i=0; i<dim; ++i)
│ │ │ │ +
604 {
│ │ │ │ +
605 for(int j=0; j<dim; ++j, ++row)
│ │ │ │ +
606 {
│ │ │ │ +
607 matrixVector[ row ] = matrix[ i ][ j ];
│ │ │ │ +
608 }
│ │ │ │ +
609 }
│ │ │ │ +
610
│ │ │ │ +
611 // working memory
│ │ │ │ +
612 LapackNumType eigenR[dim];
│ │ │ │ +
613 LapackNumType eigenI[dim];
│ │ │ │ +
614 LapackNumType work[3*dim];
│ │ │ │ +
615
│ │ │ │ +
616 // return value information
│ │ │ │ +
617 long int info = 0;
│ │ │ │ +
618 const long int lwork = 3*dim;
│ │ │ │ +
619
│ │ │ │ +
620 // call LAPACK routine (see fmatrixev_ext.cc)
│ │ │ │ +
621 eigenValuesNonsymLapackCall(&jobvl, &jobvr, &N, &matrixVector[0], &N,
│ │ │ │ +
622 &eigenR[0], &eigenI[0], nullptr, &N, nullptr, &N, &work[0],
│ │ │ │ +
623 &lwork, &info);
│ │ │ │ +
624
│ │ │ │ +
625 if( info != 0 )
│ │ │ │ +
626 {
│ │ │ │ +
627 std::cerr << "For matrix " << matrix << " eigenvalue calculation failed! " << std::endl;
│ │ │ │ +
628 DUNE_THROW(InvalidStateException,"eigenValues: Eigenvalue calculation failed!");
│ │ │ │ +
629 }
│ │ │ │ +
630 for (int i=0; i<N; ++i) {
│ │ │ │ +
631 eigenValues[i].real = eigenR[i];
│ │ │ │ +
632 eigenValues[i].imag = eigenI[i];
│ │ │ │ +
633 }
│ │ │ │ +
634 }
│ │ │ │ +
635#else
│ │ │ │ +
636 DUNE_THROW(NotImplemented,"LAPACK not found!");
│ │ │ │ +
637#endif
│ │ │ │ +
638 }
│ │ │ │ +
│ │ │ │ +
639 } // end namespace FMatrixHelp
│ │ │ │ +
640
│ │ │ │ +
643} // end namespace Dune
│ │ │ │ +
644#endif
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
Some useful basic math stuff.
│ │ │ │ +
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 ...
│ │ │ │ +
constexpr auto max
Function object that returns the greater of the given values.
Definition hybridutilities.hh:484
│ │ │ │ +
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │
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
│ │ │ │ +
static void eigenValuesNonSym(const FieldMatrix< K, dim, dim > &matrix, FieldVector< C, dim > &eigenValues)
calculates the eigenvalues of a non-symmetric field matrix
Definition fmatrixev.hh:586
│ │ │ │ +
static void eigenValues(const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues)
calculates the eigenvalues of a symmetric field matrix
Definition fmatrixev.hh:524
│ │ │ │ +
static void eigenValuesLapack(const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues)
calculates the eigenvalues of a symmetric field matrix
Definition fmatrixev.hh:555
│ │ │ │ +
static void eigenValuesVectors(const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors)
calculates the eigenvalues and eigenvectors of a symmetric field matrix
Definition fmatrixev.hh:540
│ │ │ │ +
static void eigenValuesVectorsLapack(const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors)
calculates the eigenvalues and -vectors of a symmetric field matrix
Definition fmatrixev.hh:571
│ │ │ │ +
A dense n x m matrix.
Definition fmatrix.hh:117
│ │ │ │ +
vector space out of a tensor product of fields.
Definition fvector.hh:91
│ │ │ │ +
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
│ │ │ │
T real_type
export the type representing the real type of the field
Definition ftraits.hh:30
│ │ │ │ -
Definition matvectraits.hh:31
│ │ │ │ +
static const Field pi()
Archimedes' constant.
Definition math.hh:48
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,280 +1,710 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -dynmatrix.hh │ │ │ │ │ +fmatrixev.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 © 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 │ │ │ │ │ +5#ifndef DUNE_FMATRIXEIGENVALUES_HH │ │ │ │ │ +6#define DUNE_FMATRIXEIGENVALUES_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 │ │ │ │ │ -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; │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +17#include // HAVE_LAPACK │ │ │ │ │ +18#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_m_a_t_r_i_x_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_m_a_t_h_._h_h> │ │ │ │ │ +22 │ │ │ │ │ +23namespace _D_u_n_e { │ │ │ │ │ +24 │ │ │ │ │ +30 namespace FMatrixHelp { │ │ │ │ │ +31 │ │ │ │ │ +32#if HAVE_LAPACK │ │ │ │ │ +33 // defined in fmatrixev.cc │ │ │ │ │ +34 extern void eigenValuesLapackCall( │ │ │ │ │ +35 const char* jobz, const char* uplo, const long │ │ │ │ │ +36 int* n, double* a, const long int* lda, double* w, │ │ │ │ │ +37 double* work, const long int* lwork, long int* info); │ │ │ │ │ +38 │ │ │ │ │ +39 extern void eigenValuesNonsymLapackCall( │ │ │ │ │ +40 const char* jobvl, const char* jobvr, const long │ │ │ │ │ +41 int* n, double* a, const long int* lda, double* wr, double* wi, double* vl, │ │ │ │ │ +42 const long int* ldvl, double* vr, const long int* ldvr, double* work, │ │ │ │ │ +43 const long int* lwork, long int* info); │ │ │ │ │ +44 │ │ │ │ │ +45 extern void eigenValuesLapackCall( │ │ │ │ │ +46 const char* jobz, const char* uplo, const long │ │ │ │ │ +47 int* n, float* a, const long int* lda, float* w, │ │ │ │ │ +48 float* work, const long int* lwork, long int* info); │ │ │ │ │ +49 │ │ │ │ │ +50 extern void eigenValuesNonsymLapackCall( │ │ │ │ │ +51 const char* jobvl, const char* jobvr, const long │ │ │ │ │ +52 int* n, float* a, const long int* lda, float* wr, float* wi, float* vl, │ │ │ │ │ +53 const long int* ldvl, float* vr, const long int* ldvr, float* work, │ │ │ │ │ +54 const long int* lwork, long int* info); │ │ │ │ │ +55 │ │ │ │ │ +56#endif │ │ │ │ │ +57 │ │ │ │ │ +58 namespace Impl { │ │ │ │ │ +59 //internal tag to activate/disable code for eigenvector calculation at │ │ │ │ │ +compile time │ │ │ │ │ +60 enum Jobs { OnlyEigenvalues=0, EigenvaluesEigenvectors=1 }; │ │ │ │ │ +61 │ │ │ │ │ +62 //internal dummy used if only eigenvalues are to be calculated │ │ │ │ │ +63 template │ │ │ │ │ +64 using EVDummy = FieldMatrix; │ │ │ │ │ +65 │ │ │ │ │ +66 //compute the cross-product of two vectors │ │ │ │ │ +67 template │ │ │ │ │ +68 inline FieldVector crossProduct(const FieldVector& vec0, const │ │ │ │ │ +FieldVector& vec1) { │ │ │ │ │ +69 return {vec0[1]*vec1[2] - vec0[2]*vec1[1], vec0[2]*vec1[0] - vec0[0]*vec1 │ │ │ │ │ +[2], vec0[0]*vec1[1] - vec0[1]*vec1[0]}; │ │ │ │ │ +70 } │ │ │ │ │ +71 │ │ │ │ │ +72 template │ │ │ │ │ +73 static void eigenValues2dImpl(const FieldMatrix& matrix, │ │ │ │ │ +74 FieldVector& eigenvalues) │ │ │ │ │ +75 { │ │ │ │ │ +76 using std::sqrt; │ │ │ │ │ +77 const K p = 0.5 * (matrix[0][0] + matrix [1][1]); │ │ │ │ │ +78 const K p2 = p - matrix[1][1]; │ │ │ │ │ +79 K q = p2 * p2 + matrix[1][0] * matrix[0][1]; │ │ │ │ │ +80 if( q < 0 && q > -1e-14 ) q = 0; │ │ │ │ │ +81 if (q < 0) │ │ │ │ │ +82 { │ │ │ │ │ +83 std::cout << matrix << std::endl; │ │ │ │ │ +84 // Complex eigenvalues are either caused by non-symmetric matrices or by │ │ │ │ │ +round-off errors │ │ │ │ │ +85 _D_U_N_E___T_H_R_O_W(MathError, "Complex eigenvalue detected (which this │ │ │ │ │ +implementation cannot handle)."); │ │ │ │ │ +86 } │ │ │ │ │ +87 │ │ │ │ │ +88 // get square root │ │ │ │ │ +89 q = sqrt(q); │ │ │ │ │ +90 │ │ │ │ │ +91 // store eigenvalues in ascending order │ │ │ │ │ +92 eigenvalues[0] = p - q; │ │ │ │ │ +93 eigenvalues[1] = p + q; │ │ │ │ │ +94 } │ │ │ │ │ +95 │ │ │ │ │ +96 /* │ │ │ │ │ +97 This implementation was adapted from the pseudo-code (Python?) │ │ │ │ │ +implementation found on │ │ │ │ │ +98 http://en.wikipedia.org/wiki/Eigenvalue_algorithm (retrieved late August │ │ │ │ │ +2014). │ │ │ │ │ +99 Wikipedia claims to have taken it from │ │ │ │ │ +100 Smith, Oliver K. (April 1961), Eigenvalues of a symmetric 3 × 3 matrix., │ │ │ │ │ +101 Communications of the ACM 4 (4): 168, doi:10.1145/355578.366316 │ │ │ │ │ +102 */ │ │ │ │ │ +103 template │ │ │ │ │ +104 static K eigenValues3dImpl(const FieldMatrix& matrix, │ │ │ │ │ +105 FieldVector& eigenvalues) │ │ │ │ │ +106 { │ │ │ │ │ +107 using std::sqrt; │ │ │ │ │ +108 using std::acos; │ │ │ │ │ +109 using real_type = typename _F_i_e_l_d_T_r_a_i_t_s_<_K_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ │ +110 const K pi = _M_a_t_h_e_m_a_t_i_c_a_l_C_o_n_s_t_a_n_t_s_<_K_>_:_:_p_i(); │ │ │ │ │ +111 K p1 = matrix[0][1]*matrix[0][1] + matrix[0][2]*matrix[0][2] + matrix[1] │ │ │ │ │ +[2]*matrix[1][2]; │ │ │ │ │ +112 │ │ │ │ │ +113 if (p1 <= std::numeric_limits::epsilon()) { │ │ │ │ │ +114 // A is diagonal. │ │ │ │ │ +115 eigenvalues[0] = matrix[0][0]; │ │ │ │ │ +116 eigenvalues[1] = matrix[1][1]; │ │ │ │ │ +117 eigenvalues[2] = matrix[2][2]; │ │ │ │ │ +118 std::sort(eigenvalues.begin(), eigenvalues.end()); │ │ │ │ │ +119 │ │ │ │ │ +120 return 0.0; │ │ │ │ │ 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 │ │ │ │ │ -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]; │ │ │ │ │ +122 else │ │ │ │ │ +123 { │ │ │ │ │ +124 // q = trace(A)/3 │ │ │ │ │ +125 K q = 0; │ │ │ │ │ +126 for (int i=0; i<3; i++) │ │ │ │ │ +127 q += matrix[i][i] / 3.0; │ │ │ │ │ +128 │ │ │ │ │ +129 K p2 = (matrix[0][0] - q)*(matrix[0][0] - q) + (matrix[1][1] - q)*(matrix │ │ │ │ │ +[1][1] - q) + (matrix[2][2] - q)*(matrix[2][2] - q) + 2.0 * p1; │ │ │ │ │ +130 K p = sqrt(p2 / 6); │ │ │ │ │ +131 // B = (1 / p) * (A - q * I); // I is the identity matrix │ │ │ │ │ +132 FieldMatrix B; │ │ │ │ │ +133 for (int i=0; i<3; i++) │ │ │ │ │ +134 for (int j=0; j<3; j++) │ │ │ │ │ +135 B[i][j] = (real_type(1.0)/p) * (matrix[i][j] - q*(i==j)); │ │ │ │ │ +136 │ │ │ │ │ +137 K r = B.determinant() / 2.0; │ │ │ │ │ +138 │ │ │ │ │ +139 /*In exact arithmetic for a symmetric matrix -1 <= r <= 1 │ │ │ │ │ +140 but computation error can leave it slightly outside this range. │ │ │ │ │ +141 acos(z) function requires |z| <= 1, but will fail silently │ │ │ │ │ +142 and return NaN if the input is larger than 1 in magnitude. │ │ │ │ │ +143 Thus r is clamped to [-1,1].*/ │ │ │ │ │ +144 using std::clamp; │ │ │ │ │ +145 r = clamp(r, -1.0, 1.0); │ │ │ │ │ +146 K phi = acos(r) / 3.0; │ │ │ │ │ +147 │ │ │ │ │ +148 // the eigenvalues satisfy eig[2] <= eig[1] <= eig[0] │ │ │ │ │ +149 eigenvalues[2] = q + 2 * p * cos(phi); │ │ │ │ │ +150 eigenvalues[0] = q + 2 * p * cos(phi + (2*pi/3)); │ │ │ │ │ +151 eigenvalues[1] = 3 * q - eigenvalues[0] - eigenvalues[2]; // since trace │ │ │ │ │ +(matrix) = eig1 + eig2 + eig3 │ │ │ │ │ +152 │ │ │ │ │ +153 return r; │ │ │ │ │ 154 } │ │ │ │ │ -155 }; │ │ │ │ │ +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... │ │ │ │ │ -_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. │ │ │ │ │ -_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ -Macro for wrapping boundary checks. │ │ │ │ │ +157 //see https://www.geometrictools.com/Documentation/ │ │ │ │ │ +RobustEigenSymmetric3x3.pdf │ │ │ │ │ +158 //Robustly compute a right-handed orthonormal set {u, v, evec0}. │ │ │ │ │ +159 template │ │ │ │ │ +160 void orthoComp(const FieldVector& evec0, FieldVector& u, │ │ │ │ │ +FieldVector& v) { │ │ │ │ │ +161 using std::abs; │ │ │ │ │ +162 if(abs(evec0[0]) > abs(evec0[1])) { │ │ │ │ │ +163 //The component of maximum absolute value is either evec0[0] or evec0[2]. │ │ │ │ │ +164 FieldVector temp = {evec0[0], evec0[2]}; │ │ │ │ │ +165 auto L = 1.0 / temp.two_norm(); │ │ │ │ │ +166 u = L * FieldVector({-evec0[2], 0.0, evec0[0]}); │ │ │ │ │ +167 } │ │ │ │ │ +168 else { │ │ │ │ │ +169 //The component of maximum absolute value is either evec0[1] or evec0[2]. │ │ │ │ │ +170 FieldVector temp = {evec0[1], evec0[2]}; │ │ │ │ │ +171 auto L = 1.0 / temp.two_norm(); │ │ │ │ │ +172 u = L * FieldVector({0.0, evec0[2], -evec0[1]}); │ │ │ │ │ +173 } │ │ │ │ │ +174 v = crossProduct(evec0, u); │ │ │ │ │ +175 } │ │ │ │ │ +176 │ │ │ │ │ +177 //see https://www.geometrictools.com/Documentation/ │ │ │ │ │ +RobustEigenSymmetric3x3.pdf │ │ │ │ │ +178 template │ │ │ │ │ +179 void eig0(const FieldMatrix& matrix, K eval0, FieldVector& │ │ │ │ │ +evec0) { │ │ │ │ │ +180 /* Compute a unit-length eigenvector for eigenvalue[i0]. The │ │ │ │ │ +181 matrix is rank 2, so two of the rows are linearly independent. │ │ │ │ │ +182 For a robust computation of the eigenvector, select the two │ │ │ │ │ +183 rows whose cross product has largest length of all pairs of │ │ │ │ │ +184 rows. */ │ │ │ │ │ +185 using Vector = FieldVector; │ │ │ │ │ +186 Vector row0 = {matrix[0][0]-eval0, matrix[0][1], matrix[0][2]}; │ │ │ │ │ +187 Vector row1 = {matrix[1][0], matrix[1][1]-eval0, matrix[1][2]}; │ │ │ │ │ +188 Vector row2 = {matrix[2][0], matrix[2][1], matrix[2][2]-eval0}; │ │ │ │ │ +189 │ │ │ │ │ +190 Vector r0xr1 = crossProduct(row0, row1); │ │ │ │ │ +191 Vector r0xr2 = crossProduct(row0, row2); │ │ │ │ │ +192 Vector r1xr2 = crossProduct(row1, row2); │ │ │ │ │ +193 auto d0 = r0xr1.two_norm(); │ │ │ │ │ +194 auto d1 = r0xr2.two_norm(); │ │ │ │ │ +195 auto d2 = r1xr2.two_norm(); │ │ │ │ │ +196 │ │ │ │ │ +197 auto dmax = d0 ; │ │ │ │ │ +198 int imax = 0; │ │ │ │ │ +199 if(d1>dmax) { │ │ │ │ │ +200 dmax = d1; │ │ │ │ │ +201 imax = 1; │ │ │ │ │ +202 } │ │ │ │ │ +203 if(d2>dmax) │ │ │ │ │ +204 imax = 2; │ │ │ │ │ +205 │ │ │ │ │ +206 if(imax == 0) │ │ │ │ │ +207 evec0 = r0xr1 / d0; │ │ │ │ │ +208 else if(imax == 1) │ │ │ │ │ +209 evec0 = r0xr2 / d1; │ │ │ │ │ +210 else │ │ │ │ │ +211 evec0 = r1xr2 / d2; │ │ │ │ │ +212 } │ │ │ │ │ +213 │ │ │ │ │ +214 //see https://www.geometrictools.com/Documentation/ │ │ │ │ │ +RobustEigenSymmetric3x3.pdf │ │ │ │ │ +215 template │ │ │ │ │ +216 void eig1(const FieldMatrix& matrix, const FieldVector& evec0, │ │ │ │ │ +FieldVector& evec1, K eval1) { │ │ │ │ │ +217 using Vector = FieldVector; │ │ │ │ │ +218 │ │ │ │ │ +219 //Robustly compute a right-handed orthonormal set {u, v, evec0}. │ │ │ │ │ +220 Vector u,v; │ │ │ │ │ +221 orthoComp(evec0, u, v); │ │ │ │ │ +222 │ │ │ │ │ +223 /* Let e be eval1 and let E be a corresponding eigenvector which │ │ │ │ │ +224 is a solution to the linear system (A - e*I)*E = 0. The matrix │ │ │ │ │ +225 (A - e*I) is 3x3, not invertible (so infinitely many │ │ │ │ │ +226 solutions), and has rank 2 when eval1 and eval are different. │ │ │ │ │ +227 It has rank 1 when eval1 and eval2 are equal. Numerically, it │ │ │ │ │ +228 is difficult to compute robustly the rank of a matrix. Instead, │ │ │ │ │ +229 the 3x3 linear system is reduced to a 2x2 system as follows. │ │ │ │ │ +230 Define the 3x2 matrix J = [u,v] whose columns are the u and v │ │ │ │ │ +231 computed previously. Define the 2x1 vector X = J*E. The 2x2 │ │ │ │ │ +232 system is 0 = M * X = (J^T * (A - e*I) * J) * X where J^T is │ │ │ │ │ +233 the transpose of J and M = J^T * (A - e*I) * J is a 2x2 matrix. │ │ │ │ │ +234 The system may be written as │ │ │ │ │ +235 +- -++- -+ +- -+ │ │ │ │ │ +236 | U^T*A*U - e U^T*A*V || x0 | = e * | x0 | │ │ │ │ │ +237 | V^T*A*U V^T*A*V - e || x1 | | x1 | │ │ │ │ │ +238 +- -++ -+ +- -+ │ │ │ │ │ +239 where X has row entries x0 and x1. */ │ │ │ │ │ +240 │ │ │ │ │ +241 Vector Au, Av; │ │ │ │ │ +242 matrix.mv(u, Au); │ │ │ │ │ +243 matrix.mv(v, Av); │ │ │ │ │ +244 │ │ │ │ │ +245 auto m00 = u.dot(Au) - eval1; │ │ │ │ │ +246 auto m01 = u.dot(Av); │ │ │ │ │ +247 auto m11 = v.dot(Av) - eval1; │ │ │ │ │ +248 │ │ │ │ │ +249 /* For robustness, choose the largest-length row of M to compute │ │ │ │ │ +250 the eigenvector. The 2-tuple of coefficients of U and V in the │ │ │ │ │ +251 assignments to eigenvector[1] lies on a circle, and U and V are │ │ │ │ │ +252 unit length and perpendicular, so eigenvector[1] is unit length │ │ │ │ │ +253 (within numerical tolerance). */ │ │ │ │ │ +254 using std::abs, std::sqrt, std::max; │ │ │ │ │ +255 auto absM00 = abs(m00); │ │ │ │ │ +256 auto absM01 = abs(m01); │ │ │ │ │ +257 auto absM11 = abs(m11); │ │ │ │ │ +258 if(absM00 >= absM11) { │ │ │ │ │ +259 auto maxAbsComp = _m_a_x(absM00, absM01); │ │ │ │ │ +260 if(maxAbsComp > 0.0) { │ │ │ │ │ +261 if(absM00 >= absM01) { │ │ │ │ │ +262 m01 /= m00; │ │ │ │ │ +263 m00 = 1.0 / sqrt(1.0 + m01*m01); │ │ │ │ │ +264 m01 *= m00; │ │ │ │ │ +265 } │ │ │ │ │ +266 else { │ │ │ │ │ +267 m00 /= m01; │ │ │ │ │ +268 m01 = 1.0 / sqrt(1.0 + m00*m00); │ │ │ │ │ +269 m00 *= m01; │ │ │ │ │ +270 } │ │ │ │ │ +271 evec1 = m01*u - m00*v; │ │ │ │ │ +272 } │ │ │ │ │ +273 else │ │ │ │ │ +274 evec1 = u; │ │ │ │ │ +275 } │ │ │ │ │ +276 else { │ │ │ │ │ +277 auto maxAbsComp = _m_a_x(absM11, absM01); │ │ │ │ │ +278 if(maxAbsComp > 0.0) { │ │ │ │ │ +279 if(absM11 >= absM01) { │ │ │ │ │ +280 m01 /= m11; │ │ │ │ │ +281 m11 = 1.0 / sqrt(1.0 + m01*m01); │ │ │ │ │ +282 m01 *= m11; │ │ │ │ │ +283 } │ │ │ │ │ +284 else { │ │ │ │ │ +285 m11 /= m01; │ │ │ │ │ +286 m01 = 1.0 / sqrt(1.0 + m11*m11); │ │ │ │ │ +287 m11 *= m01; │ │ │ │ │ +288 } │ │ │ │ │ +289 evec1 = m11*u - m01*v; │ │ │ │ │ +290 } │ │ │ │ │ +291 else │ │ │ │ │ +292 evec1 = u; │ │ │ │ │ +293 } │ │ │ │ │ +294 } │ │ │ │ │ +295 │ │ │ │ │ +296 // 1d specialization │ │ │ │ │ +297 template │ │ │ │ │ +298 static void eigenValuesVectorsImpl(const FieldMatrix& matrix, │ │ │ │ │ +299 FieldVector& _e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ +300 FieldMatrix& eigenVectors) │ │ │ │ │ +301 { │ │ │ │ │ +302 _e_i_g_e_n_V_a_l_u_e_s[0] = matrix[0][0]; │ │ │ │ │ +303 if constexpr(Tag==EigenvaluesEigenvectors) │ │ │ │ │ +304 eigenVectors[0] = {1.0}; │ │ │ │ │ +305 } │ │ │ │ │ +306 │ │ │ │ │ +307 │ │ │ │ │ +308 // 2d specialization │ │ │ │ │ +309 template │ │ │ │ │ +310 static void eigenValuesVectorsImpl(const FieldMatrix& matrix, │ │ │ │ │ +311 FieldVector& _e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ +312 FieldMatrix& eigenVectors) │ │ │ │ │ +313 { │ │ │ │ │ +314 // Compute eigen values │ │ │ │ │ +315 Impl::eigenValues2dImpl(matrix, _e_i_g_e_n_V_a_l_u_e_s); │ │ │ │ │ +316 │ │ │ │ │ +317 // Compute eigenvectors by exploiting the Cayley–Hamilton theorem. │ │ │ │ │ +318 // If λ_1, λ_2 are the eigenvalues, then (A - λ_1I )(A - λ_2I ) = (A - │ │ │ │ │ +λ_2I )(A - λ_1I ) = 0, │ │ │ │ │ +319 // so the columns of (A - λ_2I ) are annihilated by (A - λ_1I ) and vice │ │ │ │ │ +versa. │ │ │ │ │ +320 // Assuming neither matrix is zero, the columns of each must include │ │ │ │ │ +eigenvectors │ │ │ │ │ +321 // for the other eigenvalue. (If either matrix is zero, then A is a │ │ │ │ │ +multiple of the │ │ │ │ │ +322 // identity and any non-zero vector is an eigenvector.) │ │ │ │ │ +323 // From: https://en.wikipedia.org/wiki/Eigenvalue_algorithm#2x2_matrices │ │ │ │ │ +324 if constexpr(Tag==EigenvaluesEigenvectors) { │ │ │ │ │ +325 │ │ │ │ │ +326 // Special casing for multiples of the identity │ │ │ │ │ +327 FieldMatrix temp = matrix; │ │ │ │ │ +328 temp[0][0] -= _e_i_g_e_n_V_a_l_u_e_s[0]; │ │ │ │ │ +329 temp[1][1] -= _e_i_g_e_n_V_a_l_u_e_s[0]; │ │ │ │ │ +330 if(temp.infinity_norm() <= 1e-14) { │ │ │ │ │ +331 eigenVectors[0] = {1.0, 0.0}; │ │ │ │ │ +332 eigenVectors[1] = {0.0, 1.0}; │ │ │ │ │ +333 } │ │ │ │ │ +334 else { │ │ │ │ │ +335 // The columns of A - λ_2I are eigenvectors for λ_1, or zero. │ │ │ │ │ +336 // Take the column with the larger norm to avoid zero columns. │ │ │ │ │ +337 FieldVector ev0 = {matrix[0][0]-_e_i_g_e_n_V_a_l_u_e_s[1], matrix[1][0]}; │ │ │ │ │ +338 FieldVector ev1 = {matrix[0][1], matrix[1][1]-_e_i_g_e_n_V_a_l_u_e_s[1]}; │ │ │ │ │ +339 eigenVectors[0] = (ev0.two_norm2() >= ev1.two_norm2()) ? ev0/ev0.two_norm() │ │ │ │ │ +: ev1/ev1.two_norm(); │ │ │ │ │ +340 │ │ │ │ │ +341 // The columns of A - λ_1I are eigenvectors for λ_2, or zero. │ │ │ │ │ +342 // Take the column with the larger norm to avoid zero columns. │ │ │ │ │ +343 ev0 = {matrix[0][0]-_e_i_g_e_n_V_a_l_u_e_s[0], matrix[1][0]}; │ │ │ │ │ +344 ev1 = {matrix[0][1], matrix[1][1]-_e_i_g_e_n_V_a_l_u_e_s[0]}; │ │ │ │ │ +345 eigenVectors[1] = (ev0.two_norm2() >= ev1.two_norm2()) ? ev0/ev0.two_norm() │ │ │ │ │ +: ev1/ev1.two_norm(); │ │ │ │ │ +346 } │ │ │ │ │ +347 } │ │ │ │ │ +348 } │ │ │ │ │ +349 │ │ │ │ │ +350 // 3d specialization │ │ │ │ │ +351 template │ │ │ │ │ +352 static void eigenValuesVectorsImpl(const FieldMatrix& matrix, │ │ │ │ │ +353 FieldVector& _e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ +354 FieldMatrix& eigenVectors) │ │ │ │ │ +355 { │ │ │ │ │ +356 using Vector = FieldVector; │ │ │ │ │ +357 using Matrix = FieldMatrix; │ │ │ │ │ +358 │ │ │ │ │ +359 //compute eigenvalues │ │ │ │ │ +360 /* Precondition the matrix by factoring out the maximum absolute │ │ │ │ │ +361 value of the components. This guards against floating-point │ │ │ │ │ +362 overflow when computing the eigenvalues.*/ │ │ │ │ │ +363 using std::isnormal; │ │ │ │ │ +364 K maxAbsElement = (isnormal(matrix.infinity_norm())) ? matrix.infinity_norm │ │ │ │ │ +() : K(1.0); │ │ │ │ │ +365 Matrix scaledMatrix = matrix / maxAbsElement; │ │ │ │ │ +366 K r = Impl::eigenValues3dImpl(scaledMatrix, _e_i_g_e_n_V_a_l_u_e_s); │ │ │ │ │ +367 │ │ │ │ │ +368 if constexpr(Tag==EigenvaluesEigenvectors) { │ │ │ │ │ +369 K offDiagNorm = Vector{scaledMatrix[0][1],scaledMatrix[0][2],scaledMatrix │ │ │ │ │ +[1][2]}.two_norm2(); │ │ │ │ │ +370 if (offDiagNorm <= std::numeric_limits::epsilon()) │ │ │ │ │ +371 { │ │ │ │ │ +372 _e_i_g_e_n_V_a_l_u_e_s = {scaledMatrix[0][0], scaledMatrix[1][1], scaledMatrix[2][2]}; │ │ │ │ │ +373 eigenVectors = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}; │ │ │ │ │ +374 │ │ │ │ │ +375 // Use bubble sort to jointly sort eigenvalues and eigenvectors │ │ │ │ │ +376 // such that eigenvalues are ascending │ │ │ │ │ +377 if (_e_i_g_e_n_V_a_l_u_e_s[0] > _e_i_g_e_n_V_a_l_u_e_s[1]) │ │ │ │ │ +378 { │ │ │ │ │ +379 std::swap(_e_i_g_e_n_V_a_l_u_e_s[0], _e_i_g_e_n_V_a_l_u_e_s[1]); │ │ │ │ │ +380 std::swap(eigenVectors[0], eigenVectors[1]); │ │ │ │ │ +381 } │ │ │ │ │ +382 if (_e_i_g_e_n_V_a_l_u_e_s[1] > _e_i_g_e_n_V_a_l_u_e_s[2]) │ │ │ │ │ +383 { │ │ │ │ │ +384 std::swap(_e_i_g_e_n_V_a_l_u_e_s[1], _e_i_g_e_n_V_a_l_u_e_s[2]); │ │ │ │ │ +385 std::swap(eigenVectors[1], eigenVectors[2]); │ │ │ │ │ +386 } │ │ │ │ │ +387 if (_e_i_g_e_n_V_a_l_u_e_s[0] > _e_i_g_e_n_V_a_l_u_e_s[1]) │ │ │ │ │ +388 { │ │ │ │ │ +389 std::swap(_e_i_g_e_n_V_a_l_u_e_s[0], _e_i_g_e_n_V_a_l_u_e_s[1]); │ │ │ │ │ +390 std::swap(eigenVectors[0], eigenVectors[1]); │ │ │ │ │ +391 } │ │ │ │ │ +392 } │ │ │ │ │ +393 else { │ │ │ │ │ +394 /*Compute the eigenvectors so that the set │ │ │ │ │ +395 [evec[0], evec[1], evec[2]] is right handed and │ │ │ │ │ +396 orthonormal. */ │ │ │ │ │ +397 │ │ │ │ │ +398 Matrix evec(0.0); │ │ │ │ │ +399 Vector eval(_e_i_g_e_n_V_a_l_u_e_s); │ │ │ │ │ +400 if(r >= 0) { │ │ │ │ │ +401 Impl::eig0(scaledMatrix, eval[2], evec[2]); │ │ │ │ │ +402 Impl::eig1(scaledMatrix, evec[2], evec[1], eval[1]); │ │ │ │ │ +403 evec[0] = Impl::crossProduct(evec[1], evec[2]); │ │ │ │ │ +404 } │ │ │ │ │ +405 else { │ │ │ │ │ +406 Impl::eig0(scaledMatrix, eval[0], evec[0]); │ │ │ │ │ +407 Impl::eig1(scaledMatrix, evec[0], evec[1], eval[1]); │ │ │ │ │ +408 evec[2] = Impl::crossProduct(evec[0], evec[1]); │ │ │ │ │ +409 } │ │ │ │ │ +410 //sort eval/evec-pairs in ascending order │ │ │ │ │ +411 using EVPair = std::pair; │ │ │ │ │ +412 std::vector pairs; │ │ │ │ │ +413 for(std::size_t i=0; i<=2; ++i) │ │ │ │ │ +414 pairs.push_back(EVPair(eval[i], evec[i])); │ │ │ │ │ +415 auto comp = [](EVPair x, EVPair y){ return x.first < y.first; }; │ │ │ │ │ +416 std::sort(pairs.begin(), pairs.end(), comp); │ │ │ │ │ +417 for(std::size_t i=0; i<=2; ++i){ │ │ │ │ │ +418 _e_i_g_e_n_V_a_l_u_e_s[i] = pairs[i].first; │ │ │ │ │ +419 eigenVectors[i] = pairs[i].second; │ │ │ │ │ +420 } │ │ │ │ │ +421 } │ │ │ │ │ +422 } │ │ │ │ │ +423 //The preconditioning scaled the matrix, which scales the eigenvalues. │ │ │ │ │ +Revert the scaling. │ │ │ │ │ +424 _e_i_g_e_n_V_a_l_u_e_s *= maxAbsElement; │ │ │ │ │ +425 } │ │ │ │ │ +426 │ │ │ │ │ +427 // forwarding to LAPACK with corresponding tag │ │ │ │ │ +428 template │ │ │ │ │ +429 static void eigenValuesVectorsLapackImpl(const FieldMatrix& │ │ │ │ │ +matrix, │ │ │ │ │ +430 FieldVector& _e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ +431 FieldMatrix& eigenVectors) │ │ │ │ │ +432 { │ │ │ │ │ +433 { │ │ │ │ │ +434#if HAVE_LAPACK │ │ │ │ │ +435 /*Lapack uses a proprietary tag to determine whether both eigenvalues and │ │ │ │ │ +436 -vectors ('v') or only eigenvalues ('n') should be calculated */ │ │ │ │ │ +437 const char jobz = "nv"[Tag]; │ │ │ │ │ +438 │ │ │ │ │ +439 const long int N = dim ; │ │ │ │ │ +440 const char uplo = 'u'; // use upper triangular matrix │ │ │ │ │ +441 │ │ │ │ │ +442 // length of matrix vector, LWORK >= max(1,3*N-1) │ │ │ │ │ +443 const long int lwork = 3*N -1 ; │ │ │ │ │ +444 │ │ │ │ │ +445 constexpr bool isKLapackType = std::is_same_v || std:: │ │ │ │ │ +is_same_v; │ │ │ │ │ +446 using LapackNumType = std::conditional_t; │ │ │ │ │ +447 │ │ │ │ │ +448 // matrix to put into dsyev │ │ │ │ │ +449 LapackNumType matrixVector[dim * dim]; │ │ │ │ │ +450 │ │ │ │ │ +451 // copy matrix │ │ │ │ │ +452 int row = 0; │ │ │ │ │ +453 for(int i=0; i │ │ │ │ │ +508 static void eigenValuesVectorsImpl(const FieldMatrix& matrix, │ │ │ │ │ +509 FieldVector& _e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ +510 FieldMatrix& eigenVectors) │ │ │ │ │ +511 { │ │ │ │ │ +512 eigenValuesVectorsLapackImpl(matrix,_e_i_g_e_n_V_a_l_u_e_s,eigenVectors); │ │ │ │ │ +513 } │ │ │ │ │ +514 } //namespace Impl │ │ │ │ │ +515 │ │ │ │ │ +523 template │ │ │ │ │ +_5_2_4 static void _e_i_g_e_n_V_a_l_u_e_s(const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _d_i_m_,_ _d_i_m_>& matrix, │ │ │ │ │ +525 _F_i_e_l_d_V_e_c_t_o_r_<_K_ _,_d_i_m_>& _e_i_g_e_n_V_a_l_u_e_s) │ │ │ │ │ +526 { │ │ │ │ │ +527 _I_m_p_l_:_:_E_V_D_u_m_m_y_<_K_,_d_i_m_> dummy; │ │ │ │ │ +528 Impl::eigenValuesVectorsImpl(matrix, │ │ │ │ │ +_e_i_g_e_n_V_a_l_u_e_s, dummy); │ │ │ │ │ +529 } │ │ │ │ │ +530 │ │ │ │ │ +539 template │ │ │ │ │ +_5_4_0 static void _e_i_g_e_n_V_a_l_u_e_s_V_e_c_t_o_r_s(const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _d_i_m_,_ _d_i_m_>& matrix, │ │ │ │ │ +541 _F_i_e_l_d_V_e_c_t_o_r_<_K_ _,_d_i_m_>& _e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ +542 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _d_i_m_,_ _d_i_m_>& eigenVectors) │ │ │ │ │ +543 { │ │ │ │ │ +544 Impl::eigenValuesVectorsImpl(matrix, │ │ │ │ │ +_e_i_g_e_n_V_a_l_u_e_s, eigenVectors); │ │ │ │ │ +545 } │ │ │ │ │ +546 │ │ │ │ │ +554 template │ │ │ │ │ +_5_5_5 static void _e_i_g_e_n_V_a_l_u_e_s_L_a_p_a_c_k(const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _d_i_m_,_ _d_i_m_>& matrix, │ │ │ │ │ +556 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _d_i_m_>& _e_i_g_e_n_V_a_l_u_e_s) │ │ │ │ │ +557 { │ │ │ │ │ +558 _I_m_p_l_:_:_E_V_D_u_m_m_y_<_K_,_d_i_m_> dummy; │ │ │ │ │ +559 Impl::eigenValuesVectorsLapackImpl │ │ │ │ │ +(matrix, _e_i_g_e_n_V_a_l_u_e_s, dummy); │ │ │ │ │ +560 } │ │ │ │ │ +561 │ │ │ │ │ +570 template │ │ │ │ │ +_5_7_1 static void _e_i_g_e_n_V_a_l_u_e_s_V_e_c_t_o_r_s_L_a_p_a_c_k(const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _d_i_m_,_ _d_i_m_>& │ │ │ │ │ +matrix, │ │ │ │ │ +572 _F_i_e_l_d_V_e_c_t_o_r_<_K_,_ _d_i_m_>& _e_i_g_e_n_V_a_l_u_e_s, │ │ │ │ │ +573 _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _d_i_m_,_ _d_i_m_>& eigenVectors) │ │ │ │ │ +574 { │ │ │ │ │ +575 Impl::eigenValuesVectorsLapackImpl │ │ │ │ │ +(matrix, _e_i_g_e_n_V_a_l_u_e_s, eigenVectors); │ │ │ │ │ +576 } │ │ │ │ │ +577 │ │ │ │ │ +585 template │ │ │ │ │ +_5_8_6 static void _e_i_g_e_n_V_a_l_u_e_s_N_o_n_S_y_m(const _F_i_e_l_d_M_a_t_r_i_x_<_K_,_ _d_i_m_,_ _d_i_m_>& matrix, │ │ │ │ │ +587 _F_i_e_l_d_V_e_c_t_o_r_<_C_,_ _d_i_m_>& _e_i_g_e_n_V_a_l_u_e_s) │ │ │ │ │ +588 { │ │ │ │ │ +589#if HAVE_LAPACK │ │ │ │ │ +590 { │ │ │ │ │ +591 const long int N = dim ; │ │ │ │ │ +592 const char jobvl = 'n'; │ │ │ │ │ +593 const char jobvr = 'n'; │ │ │ │ │ +594 │ │ │ │ │ +595 constexpr bool isKLapackType = std::is_same_v || std:: │ │ │ │ │ +is_same_v; │ │ │ │ │ +596 using LapackNumType = std::conditional_t; │ │ │ │ │ +597 │ │ │ │ │ +598 // matrix to put into dgeev │ │ │ │ │ +599 LapackNumType matrixVector[dim * dim]; │ │ │ │ │ +600 │ │ │ │ │ +601 // copy matrix │ │ │ │ │ +602 int row = 0; │ │ │ │ │ +603 for(int i=0; i &matrix, │ │ │ │ │ +FieldVector< C, dim > &eigenValues) │ │ │ │ │ +calculates the eigenvalues of a non-symmetric field matrix │ │ │ │ │ +DDeeffiinniittiioonn fmatrixev.hh:586 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s │ │ │ │ │ +static void eigenValues(const FieldMatrix< K, dim, dim > &matrix, FieldVector< │ │ │ │ │ +K, dim > &eigenValues) │ │ │ │ │ +calculates the eigenvalues of a symmetric field matrix │ │ │ │ │ +DDeeffiinniittiioonn fmatrixev.hh:524 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_L_a_p_a_c_k │ │ │ │ │ +static void eigenValuesLapack(const FieldMatrix< K, dim, dim > &matrix, │ │ │ │ │ +FieldVector< K, dim > &eigenValues) │ │ │ │ │ +calculates the eigenvalues of a symmetric field matrix │ │ │ │ │ +DDeeffiinniittiioonn fmatrixev.hh:555 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_V_e_c_t_o_r_s │ │ │ │ │ +static void eigenValuesVectors(const FieldMatrix< K, dim, dim > &matrix, │ │ │ │ │ +FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors) │ │ │ │ │ +calculates the eigenvalues and eigenvectors of a symmetric field matrix │ │ │ │ │ +DDeeffiinniittiioonn fmatrixev.hh:540 │ │ │ │ │ +_D_u_n_e_:_:_F_M_a_t_r_i_x_H_e_l_p_:_:_e_i_g_e_n_V_a_l_u_e_s_V_e_c_t_o_r_s_L_a_p_a_c_k │ │ │ │ │ +static void eigenValuesVectorsLapack(const FieldMatrix< K, dim, dim > &matrix, │ │ │ │ │ +FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors) │ │ │ │ │ +calculates the eigenvalues and -vectors of a symmetric field matrix │ │ │ │ │ +DDeeffiinniittiioonn fmatrixev.hh:571 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_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 │ │ │ │ │ +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:91 │ │ │ │ │ +_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_:_:_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_:_:_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_<_ _F_i_e_l_d_ _>_:_:_p_i │ │ │ │ │ +static const Field pi() │ │ │ │ │ +Archimedes' constant. │ │ │ │ │ +DDeeffiinniittiioonn math.hh:48 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: indexset.hh File Reference │ │ │ │ +dune-common: dotproduct.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,125 +65,60 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Enumerations | │ │ │ │ Functions
│ │ │ │ - │ │ │ │ +
dotproduct.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

Provides the functions dot(a,b) := $a^H \cdot b $ and dotT(a,b) := $a^T \cdot b $. │ │ │ │ More...

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <cstdint>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <dune/common/arraylist.hh>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/parallel/localindex.hh>
│ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ +
#include "ftraits.hh"
│ │ │ │ +#include "typetraits.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::IndexPair< TG, TL >
 A pair consisting of a global and local index. More...
struct  Dune::IsVector< T, class >
 
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 >
struct  Dune::IsVector< T, std::void_t< typename T::field_type > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ 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.
 
template<class A , class B >
auto Dune::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,b) := std::conj(a)*b
 
template<class A , class B >
auto Dune::dotT (const A &a, const B &b) -> decltype(a *b)
 Computes an indefinite vector dot product for fundamental data types according to Petsc's VectTDot function: dotT(a,b) := a*b.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Provides a map between global and local indices.

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

Provides the functions dot(a,b) := $a^H \cdot b $ and dotT(a,b) := $a^T \cdot b $.

│ │ │ │ +

The provided dot products dot,dotT are used to compute (indefinite) dot products for fundamental types as well as DUNE vector types, such as DenseVector, FieldVector, ISTLVector. Note that the definition of dot(a,b) conjugates the first argument. This agrees with the behaviour of Matlab and Petsc, but not with BLAS.

Author
Jö Fahlke, Matthias Wohlmuth
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,109 +1,48 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 | _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 │ │ │ │ │ -#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 <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_l_o_c_a_l_i_n_d_e_x_._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> │ │ │ │ │ +_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 │ │ │ │ │ +dotproduct.hh File Reference │ │ │ │ │ +Provides the functions dot(a,b) := [$a^H \cdot b $]and dotT(a,b) := [$a^T \cdot │ │ │ │ │ +b $]. _M_o_r_e_._._. │ │ │ │ │ +#include "_f_t_r_a_i_t_s_._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 │ │ │ │ │ - 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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_V_e_c_t_o_r_<_ _T_,_ _c_l_a_s_s_ _> │ │ │ │ │   │ │ │ │ │ - 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_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_V_e_c_t_o_r_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _t_y_p_e_n_a_m_e_ _T_:_:_f_i_e_l_d___t_y_p_e_ _>_ _> │ │ │ │ │   │ │ │ │ │ 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. │ │ │ │ │ +template │ │ │ │ │ +auto  _D_u_n_e_:_:_d_o_t (const A &a, const B &b) -> typename std::enable_if< _I_s_N_u_m_b_e_r< │ │ │ │ │ + A >::value &&!_I_s_V_e_c_t_o_r< A >::value &&!std::is_same< typename _F_i_e_l_d_T_r_a_i_t_s< │ │ │ │ │ + A >::field_type, typename _F_i_e_l_d_T_r_a_i_t_s< 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,b) := std::conj(a)*b │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +auto  _D_u_n_e_:_:_d_o_t_T (const A &a, const B &b) -> decltype(a *b) │ │ │ │ │ +  Computes an indefinite vector dot product for fundamental data types │ │ │ │ │ + according to Petsc's VectTDot function: dotT(a,b) := a*b. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides a map between global and local indices. │ │ │ │ │ +Provides the functions dot(a,b) := [$a^H \cdot b $]and dotT(a,b) := [$a^T \cdot │ │ │ │ │ +b $]. │ │ │ │ │ +The provided dot products dot,dotT are used to compute (indefinite) dot │ │ │ │ │ +products for fundamental types as well as DUNE vector types, such as │ │ │ │ │ +DenseVector, FieldVector, ISTLVector. Note that the definition of dot(a,b) │ │ │ │ │ +conjugates the first argument. This agrees with the behaviour of Matlab and │ │ │ │ │ +Petsc, but not with BLAS. │ │ │ │ │ Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ + Jö Fahlke, Matthias Wohlmuth │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00020_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: indexset.hh Source File │ │ │ │ +dune-common: dotproduct.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,964 +70,86 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
indexset.hh
│ │ │ │ +
dotproduct.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 © 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_INDEXSET_HH
│ │ │ │ -
6#define DUNE_COMMON_PARALLEL_INDEXSET_HH
│ │ │ │ +
5#ifndef DUNE_DOTPRODUCT_HH
│ │ │ │ +
6#define DUNE_DOTPRODUCT_HH
│ │ │ │
7
│ │ │ │ -
8#include <algorithm>
│ │ │ │ -
9#include <cstdint> // for uint32_t
│ │ │ │ -
10#include <iostream>
│ │ │ │ -
11
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
16
│ │ │ │ -
17namespace Dune
│ │ │ │ -
18{
│ │ │ │ -
28 // forward declarations
│ │ │ │ -
29
│ │ │ │ -
30 template<class TG, class TL>
│ │ │ │ -
31 class IndexPair;
│ │ │ │ +
8#include "ftraits.hh"
│ │ │ │ +
9#include "typetraits.hh"
│ │ │ │ +
10
│ │ │ │ +
11namespace Dune {
│ │ │ │ +
26 template<class T, class = void>
│ │ │ │ +
27 struct IsVector : std::false_type {};
│ │ │ │ +
28
│ │ │ │ +
29 template<class T>
│ │ │ │ +
│ │ │ │ +
30 struct IsVector<T, std::void_t<typename T::field_type> >
│ │ │ │ +
31 : std::true_type {};
│ │ │ │ +
│ │ │ │
32
│ │ │ │ -
38 template<class TG, class TL>
│ │ │ │ -
39 std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair);
│ │ │ │ -
40
│ │ │ │ -
41 template<class TG, class TL>
│ │ │ │ -
42 bool operator==(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
43
│ │ │ │ -
44 template<class TG, class TL>
│ │ │ │ -
45 bool operator!=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ +
40 template<class A, class B>
│ │ │ │ +
41 auto
│ │ │ │ +
│ │ │ │ +
42 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
│ │ │ │ +
43 {
│ │ │ │ +
44 return conj(a)*b;
│ │ │ │ +
45 }
│ │ │ │ +
│ │ │ │
46
│ │ │ │ -
47 template<class TG, class TL>
│ │ │ │ -
48 bool operator<(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
49
│ │ │ │ -
50 template<class TG, class TL>
│ │ │ │ -
51 bool operator>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
52
│ │ │ │ -
53 template<class TG, class TL>
│ │ │ │ -
54 bool operator<=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
55
│ │ │ │ -
56 template<class TG, class TL>
│ │ │ │ -
57 bool operator >=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
58
│ │ │ │ -
59 template<class TG, class TL>
│ │ │ │ -
60 bool operator==(const IndexPair<TG,TL>&, const TG&);
│ │ │ │ -
61
│ │ │ │ -
62 template<class TG, class TL>
│ │ │ │ -
63 bool operator!=(const IndexPair<TG,TL>&, const TG&);
│ │ │ │ -
64
│ │ │ │ -
65 template<class TG, class TL>
│ │ │ │ -
66 bool operator<(const IndexPair<TG,TL>&, const TG&);
│ │ │ │ -
67
│ │ │ │ -
68 template<class TG, class TL>
│ │ │ │ -
69 bool operator>(const IndexPair<TG,TL>&, const TG&);
│ │ │ │ -
70
│ │ │ │ -
71 template<class TG, class TL>
│ │ │ │ -
72 bool operator<=(const IndexPair<TG,TL>&, const TG&);
│ │ │ │ -
73
│ │ │ │ -
74 template<class TG, class TL>
│ │ │ │ -
75 bool operator >=(const IndexPair<TG,TL>&, const TG&);
│ │ │ │ -
76
│ │ │ │ -
77 template<typename T>
│ │ │ │ -
78 struct MPITraits;
│ │ │ │ +
56 // fundamental type with A being a real type
│ │ │ │ +
57 template<class A, class B>
│ │ │ │ +
58 auto
│ │ │ │ +
59 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(a*b)>::type
│ │ │ │ +
60 {
│ │ │ │ +
61 return a*b;
│ │ │ │ +
62 }
│ │ │ │ +
63
│ │ │ │ +
73 template<typename A, typename B>
│ │ │ │ +
74 auto
│ │ │ │ +
75 dot(const A & a, const B & b) -> typename std::enable_if<IsVector<A>::value, decltype(a.dot(b))>::type
│ │ │ │ +
76 {
│ │ │ │ +
77 return a.dot(b);
│ │ │ │ +
78 }
│ │ │ │
79
│ │ │ │ -
83 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
85 {
│ │ │ │ -
86 friend std::ostream& operator<<<>(std::ostream&, const IndexPair<TG,TL>&);
│ │ │ │ -
87 friend bool operator==<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
88 friend bool operator!=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
89 friend bool operator< <>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
90 friend bool operator><>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
91 friend bool operator<=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
92 friend bool operator>=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
│ │ │ │ -
93 friend bool operator==<>(const IndexPair<TG,TL>&, const TG &);
│ │ │ │ -
94 friend bool operator!=<>(const IndexPair<TG,TL>&, const TG &);
│ │ │ │ -
95 friend bool operator< <>(const IndexPair<TG,TL>&, const TG &);
│ │ │ │ -
96 friend bool operator> <>(const IndexPair<TG,TL>&, const TG &);
│ │ │ │ -
97 friend bool operator<=<>(const IndexPair<TG,TL>&, const TG &);
│ │ │ │ -
98 friend bool operator>=<>(const IndexPair<TG,TL>&, const TG &);
│ │ │ │ -
99 friend struct MPITraits<IndexPair<TG,TL> >;
│ │ │ │ -
100
│ │ │ │ -
101 public:
│ │ │ │ -
107 typedef TG GlobalIndex;
│ │ │ │ -
108
│ │ │ │ -
120 typedef TL LocalIndex;
│ │ │ │ -
121
│ │ │ │ - │ │ │ │ -
129
│ │ │ │ - │ │ │ │ - │ │ │ │ -
141
│ │ │ │ -
147 inline const GlobalIndex& global() const;
│ │ │ │ -
148
│ │ │ │ -
154 inline LocalIndex& local();
│ │ │ │ -
155
│ │ │ │ -
161 inline const LocalIndex& local() const;
│ │ │ │ -
162
│ │ │ │ -
168 inline void setLocal(int index);
│ │ │ │ -
169 private:
│ │ │ │ -
171 GlobalIndex global_;
│ │ │ │ - │ │ │ │ -
174 };
│ │ │ │ -
│ │ │ │ -
175
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
181 {
│ │ │ │ - │ │ │ │ -
190 RESIZE
│ │ │ │ -
200 };
│ │ │ │ -
│ │ │ │ -
201
│ │ │ │ - │ │ │ │ -
206
│ │ │ │ -
207 // Forward declaration
│ │ │ │ -
208 template<class I> class GlobalLookupIndexSet;
│ │ │ │ -
209
│ │ │ │ -
216 template<typename TG, typename TL, int N=100>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
218 {
│ │ │ │ -
219 friend class GlobalLookupIndexSet<ParallelIndexSet<TG,TL,N> >;
│ │ │ │ -
220
│ │ │ │ -
221 public:
│ │ │ │ -
226 typedef TG GlobalIndex;
│ │ │ │ -
227
│ │ │ │ -
239 typedef TL LocalIndex;
│ │ │ │ -
240
│ │ │ │ - │ │ │ │ -
245
│ │ │ │ -
252 constexpr static int arraySize = (N>0) ? N : 1;
│ │ │ │ -
253
│ │ │ │ -
│ │ │ │ -
255 class iterator :
│ │ │ │ -
256 public ArrayList<IndexPair,N>::iterator
│ │ │ │ -
257 {
│ │ │ │ -
258 typedef typename ArrayList<IndexPair,N>::iterator
│ │ │ │ - │ │ │ │ - │ │ │ │ -
261 public:
│ │ │ │ -
│ │ │ │ -
262 iterator(ParallelIndexSet<TG,TL,N>& indexSet, const Father& father)
│ │ │ │ -
263 : Father(father), indexSet_(&indexSet)
│ │ │ │ -
264 {}
│ │ │ │ -
│ │ │ │ -
265
│ │ │ │ -
266 private:
│ │ │ │ -
276 inline void markAsDeleted() const
│ │ │ │ -
277 {
│ │ │ │ -
278#ifndef NDEBUG
│ │ │ │ -
279 if(indexSet_->state_ != RESIZE)
│ │ │ │ -
280 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
│ │ │ │ -
281 <<"while in RESIZE state!");
│ │ │ │ -
282#endif
│ │ │ │ -
283 Father::operator*().local().setState(DELETED);
│ │ │ │ -
284 }
│ │ │ │ -
285
│ │ │ │ -
287 ParallelIndexSet<TG,TL,N>* indexSet_;
│ │ │ │ -
288
│ │ │ │ -
289 };
│ │ │ │ -
│ │ │ │ -
290
│ │ │ │ -
291
│ │ │ │ -
292
│ │ │ │ -
294 typedef typename
│ │ │ │ - │ │ │ │ - │ │ │ │ -
297
│ │ │ │ - │ │ │ │ -
302
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
308 {
│ │ │ │ -
309 return state_;
│ │ │ │ -
310 }
│ │ │ │ -
│ │ │ │ -
311
│ │ │ │ - │ │ │ │ -
318
│ │ │ │ -
327 inline void add(const GlobalIndex& global);
│ │ │ │ -
328
│ │ │ │ -
337 inline void add(const GlobalIndex& global, const LocalIndex& local);
│ │ │ │ -
338
│ │ │ │ -
346 inline void markAsDeleted(const iterator& position);
│ │ │ │ -
347
│ │ │ │ -
360 void endResize();
│ │ │ │ -
361
│ │ │ │ -
372 inline IndexPair&
│ │ │ │ -
373 operator[](const GlobalIndex& global);
│ │ │ │ -
374
│ │ │ │ -
384 inline IndexPair&
│ │ │ │ -
385 at(const GlobalIndex& global);
│ │ │ │ -
386
│ │ │ │ -
396 inline bool
│ │ │ │ -
397 exists (const GlobalIndex& global) const;
│ │ │ │ -
398
│ │ │ │ -
409 inline const IndexPair&
│ │ │ │ -
410 operator[](const GlobalIndex& global) const;
│ │ │ │ -
411
│ │ │ │ -
421 inline const IndexPair&
│ │ │ │ -
422 at(const GlobalIndex& global) const;
│ │ │ │ -
423
│ │ │ │ -
428 inline iterator begin();
│ │ │ │ -
429
│ │ │ │ -
434 inline iterator end();
│ │ │ │ -
435
│ │ │ │ -
440 inline const_iterator begin() const;
│ │ │ │ -
441
│ │ │ │ -
446 inline const_iterator end() const;
│ │ │ │ -
447
│ │ │ │ -
457 inline void renumberLocal();
│ │ │ │ -
458
│ │ │ │ -
465 inline int seqNo() const;
│ │ │ │ -
466
│ │ │ │ -
471 inline size_t size() const;
│ │ │ │ -
472
│ │ │ │ -
473 private:
│ │ │ │ -
475 ArrayList<IndexPair,N> localIndices_;
│ │ │ │ -
477 ArrayList<IndexPair,N> newIndices_;
│ │ │ │ - │ │ │ │ -
481 int seqNo_;
│ │ │ │ -
483 bool deletedEntries_;
│ │ │ │ -
488 inline void merge();
│ │ │ │ -
489 };
│ │ │ │ -
│ │ │ │ -
490
│ │ │ │ -
491
│ │ │ │ -
497 template<class TG, class TL, int N>
│ │ │ │ -
498 std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet);
│ │ │ │ -
499
│ │ │ │ -
505 template<class I>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
507 {
│ │ │ │ -
508 public:
│ │ │ │ - │ │ │ │ -
513
│ │ │ │ - │ │ │ │ -
518
│ │ │ │ - │ │ │ │ -
523
│ │ │ │ - │ │ │ │ -
528
│ │ │ │ - │ │ │ │ -
530
│ │ │ │ -
537 GlobalLookupIndexSet(const ParallelIndexSet& indexset, std::size_t size);
│ │ │ │ -
538
│ │ │ │ - │ │ │ │ -
545
│ │ │ │ - │ │ │ │ -
550
│ │ │ │ -
560 inline const IndexPair&
│ │ │ │ -
561 operator[](const GlobalIndex& global) const;
│ │ │ │ -
562
│ │ │ │ -
566 inline const IndexPair*
│ │ │ │ -
567 pair(const std::size_t& local) const;
│ │ │ │ -
568
│ │ │ │ -
573 inline const_iterator begin() const;
│ │ │ │ -
574
│ │ │ │ -
579 inline const_iterator end() const;
│ │ │ │ -
580
│ │ │ │ -
587 inline int seqNo() const;
│ │ │ │ -
588
│ │ │ │ -
593 inline size_t size() const;
│ │ │ │ -
594 private:
│ │ │ │ -
598 const ParallelIndexSet& indexSet_;
│ │ │ │ -
599
│ │ │ │ -
603 std::size_t size_;
│ │ │ │ -
604
│ │ │ │ -
608 std::vector<const IndexPair*> indices_;
│ │ │ │ -
609
│ │ │ │ -
610 };
│ │ │ │ -
│ │ │ │ -
611
│ │ │ │ -
612
│ │ │ │ -
613 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
615 {
│ │ │ │ -
│ │ │ │ -
616 static bool compare([[maybe_unused]] const T& t1, [[maybe_unused]] const T& t2)
│ │ │ │ -
617 {
│ │ │ │ -
618 return false;
│ │ │ │ -
619 }
│ │ │ │ -
│ │ │ │ -
620 };
│ │ │ │ -
│ │ │ │ -
621
│ │ │ │ -
622 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
624 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
626 {
│ │ │ │ -
627 return i1.global()<i2.global() || (i1.global()==i2.global() &&
│ │ │ │ - │ │ │ │ -
629 i2.local()));
│ │ │ │ -
630 }
│ │ │ │ -
│ │ │ │ -
631 };
│ │ │ │ -
│ │ │ │ -
632
│ │ │ │ -
633
│ │ │ │ -
634
│ │ │ │ -
635 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
636 inline std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair)
│ │ │ │ -
637 {
│ │ │ │ -
638 os<<"{global="<<pair.global_<<", local="<<pair.local_<<"}";
│ │ │ │ -
639 return os;
│ │ │ │ -
640 }
│ │ │ │ -
│ │ │ │ -
641
│ │ │ │ -
642 template<class TG, class TL, int N>
│ │ │ │ -
│ │ │ │ -
643 inline std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet)
│ │ │ │ -
644 {
│ │ │ │ -
645 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iterator;
│ │ │ │ -
646 Iterator end = indexSet.end();
│ │ │ │ -
647 os<<"{";
│ │ │ │ -
648 for(Iterator index = indexSet.begin(); index != end; ++index)
│ │ │ │ -
649 os<<*index<<" ";
│ │ │ │ -
650 os<<"}";
│ │ │ │ -
651 return os;
│ │ │ │ -
652
│ │ │ │ -
653 }
│ │ │ │ -
│ │ │ │ -
654
│ │ │ │ -
655 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
656 inline bool operator==(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
│ │ │ │ -
657 {
│ │ │ │ -
658 return a.global_==b.global_;
│ │ │ │ -
659 }
│ │ │ │ -
│ │ │ │ -
660
│ │ │ │ -
661 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
662 inline bool operator!=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
│ │ │ │ -
663 {
│ │ │ │ -
664 return a.global_!=b.global_;
│ │ │ │ -
665 }
│ │ │ │ -
│ │ │ │ -
666
│ │ │ │ -
667 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
668 inline bool operator<(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
│ │ │ │ -
669 {
│ │ │ │ -
670 return a.global_<b.global_;
│ │ │ │ -
671 }
│ │ │ │ -
│ │ │ │ -
672
│ │ │ │ -
673 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
674 inline bool operator>(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
│ │ │ │ -
675 {
│ │ │ │ -
676 return a.global_>b.global_;
│ │ │ │ -
677 }
│ │ │ │ -
│ │ │ │ -
678
│ │ │ │ -
679 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
680 inline bool operator<=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
│ │ │ │ -
681 {
│ │ │ │ -
682 return a.global_<=b.global_;
│ │ │ │ -
683 }
│ │ │ │ -
│ │ │ │ -
684
│ │ │ │ -
685 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
686 inline bool operator >=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
│ │ │ │ -
687 {
│ │ │ │ -
688 return a.global_>=b.global_;
│ │ │ │ -
689 }
│ │ │ │ -
│ │ │ │ -
690
│ │ │ │ -
691 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
692 inline bool operator==(const IndexPair<TG,TL>& a, const TG& b)
│ │ │ │ -
693 {
│ │ │ │ -
694 return a.global_==b;
│ │ │ │ -
695 }
│ │ │ │ -
│ │ │ │ -
696
│ │ │ │ -
697 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
698 inline bool operator!=(const IndexPair<TG,TL>& a, const TG& b)
│ │ │ │ -
699 {
│ │ │ │ -
700 return a.global_!=b;
│ │ │ │ -
701 }
│ │ │ │ -
│ │ │ │ -
702
│ │ │ │ -
703 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
704 inline bool operator<(const IndexPair<TG,TL>& a, const TG& b)
│ │ │ │ -
705 {
│ │ │ │ -
706 return a.global_<b;
│ │ │ │ -
707 }
│ │ │ │ -
│ │ │ │ -
708
│ │ │ │ -
709 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
710 inline bool operator>(const IndexPair<TG,TL>& a, const TG& b)
│ │ │ │ -
711 {
│ │ │ │ -
712 return a.global_>b;
│ │ │ │ -
713 }
│ │ │ │ -
│ │ │ │ -
714
│ │ │ │ -
715 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
716 inline bool operator<=(const IndexPair<TG,TL>& a, const TG& b)
│ │ │ │ -
717 {
│ │ │ │ -
718 return a.global_<=b;
│ │ │ │ -
719 }
│ │ │ │ -
│ │ │ │ -
720
│ │ │ │ -
721 template<class TG, class TL>
│ │ │ │ -
│ │ │ │ -
722 inline bool operator >=(const IndexPair<TG,TL>& a, const TG& b)
│ │ │ │ -
723 {
│ │ │ │ -
724 return a.global_>=b;
│ │ │ │ -
725 }
│ │ │ │ -
│ │ │ │ -
726
│ │ │ │ -
727#ifndef DOXYGEN
│ │ │ │ -
728
│ │ │ │ -
729 template<class TG, class TL>
│ │ │ │ -
730 IndexPair<TG,TL>::IndexPair(const TG& global, const TL& local)
│ │ │ │ -
731 : global_(global), local_(local){}
│ │ │ │ -
732
│ │ │ │ -
733 template<class TG, class TL>
│ │ │ │ -
734 IndexPair<TG,TL>::IndexPair(const TG& global)
│ │ │ │ -
735 : global_(global), local_(){}
│ │ │ │ -
736
│ │ │ │ -
737 template<class TG, class TL>
│ │ │ │ - │ │ │ │ -
739 : global_(), local_(){}
│ │ │ │ -
740
│ │ │ │ -
741 template<class TG, class TL>
│ │ │ │ -
742 inline const TG& IndexPair<TG,TL>::global() const {
│ │ │ │ -
743 return global_;
│ │ │ │ -
744 }
│ │ │ │ -
745
│ │ │ │ -
746 template<class TG, class TL>
│ │ │ │ -
747 inline TL& IndexPair<TG,TL>::local() {
│ │ │ │ -
748 return local_;
│ │ │ │ -
749 }
│ │ │ │ -
750
│ │ │ │ -
751 template<class TG, class TL>
│ │ │ │ -
752 inline const TL& IndexPair<TG,TL>::local() const {
│ │ │ │ -
753 return local_;
│ │ │ │ -
754 }
│ │ │ │ -
755
│ │ │ │ -
756 template<class TG, class TL>
│ │ │ │ -
757 inline void IndexPair<TG,TL>::setLocal(int local){
│ │ │ │ -
758 local_=local;
│ │ │ │ -
759 }
│ │ │ │ -
760
│ │ │ │ -
761 template<class TG, class TL, int N>
│ │ │ │ - │ │ │ │ -
763 : state_(GROUND), seqNo_(0), deletedEntries_()
│ │ │ │ -
764 {}
│ │ │ │ -
765
│ │ │ │ -
766 template<class TG, class TL, int N>
│ │ │ │ - │ │ │ │ -
768 {
│ │ │ │ -
769
│ │ │ │ -
770 // Checks in unproductive code
│ │ │ │ -
771#ifndef NDEBUG
│ │ │ │ -
772 if(state_!=GROUND)
│ │ │ │ -
773 DUNE_THROW(InvalidIndexSetState,
│ │ │ │ -
774 "IndexSet has to be in GROUND state, when "
│ │ │ │ -
775 << "beginResize() is called!");
│ │ │ │ -
776#endif
│ │ │ │ -
777
│ │ │ │ -
778 state_ = RESIZE;
│ │ │ │ -
779 deletedEntries_ = false;
│ │ │ │ -
780 }
│ │ │ │ -
781
│ │ │ │ -
782 template<class TG, class TL, int N>
│ │ │ │ -
783 inline void ParallelIndexSet<TG,TL,N>::add(const GlobalIndex& global)
│ │ │ │ -
784 {
│ │ │ │ -
785 // Checks in unproductive code
│ │ │ │ -
786#ifndef NDEBUG
│ │ │ │ -
787 if(state_ != RESIZE)
│ │ │ │ -
788 DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
│ │ │ │ -
789 <<"while in RESIZE state!");
│ │ │ │ -
790#endif
│ │ │ │ -
791 newIndices_.push_back(IndexPair(global));
│ │ │ │ -
792 }
│ │ │ │ -
793
│ │ │ │ -
794 template<class TG, class TL, int N>
│ │ │ │ -
795 inline void ParallelIndexSet<TG,TL,N>::add(const TG& global, const TL& local)
│ │ │ │ -
796 {
│ │ │ │ -
797 // Checks in unproductive code
│ │ │ │ -
798#ifndef NDEBUG
│ │ │ │ -
799 if(state_ != RESIZE)
│ │ │ │ -
800 DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
│ │ │ │ -
801 <<"while in RESIZE state!");
│ │ │ │ -
802#endif
│ │ │ │ -
803 newIndices_.push_back(IndexPair(global,local));
│ │ │ │ -
804 }
│ │ │ │ -
805
│ │ │ │ -
806 template<class TG, class TL, int N>
│ │ │ │ -
807 inline void ParallelIndexSet<TG,TL,N>::markAsDeleted(const iterator& global)
│ │ │ │ -
808 {
│ │ │ │ -
809 // Checks in unproductive code
│ │ │ │ -
810#ifndef NDEBUG
│ │ │ │ -
811 if(state_ != RESIZE)
│ │ │ │ -
812 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
│ │ │ │ -
813 <<"while in RESIZE state!");
│ │ │ │ -
814#endif
│ │ │ │ -
815 deletedEntries_ = true;
│ │ │ │ -
816
│ │ │ │ -
817 global.markAsDeleted();
│ │ │ │ -
818 }
│ │ │ │ -
819
│ │ │ │ -
820 template<class TG, class TL, int N>
│ │ │ │ - │ │ │ │ -
822 // Checks in unproductive code
│ │ │ │ -
823#ifndef NDEBUG
│ │ │ │ -
824 if(state_ != RESIZE)
│ │ │ │ -
825 DUNE_THROW(InvalidIndexSetState, "endResize called while not "
│ │ │ │ -
826 <<"in RESIZE state!");
│ │ │ │ -
827#endif
│ │ │ │ -
828
│ │ │ │ -
829 std::sort(newIndices_.begin(), newIndices_.end(), IndexSetSortFunctor<TG,TL>());
│ │ │ │ -
830 merge();
│ │ │ │ -
831 seqNo_++;
│ │ │ │ -
832 state_ = GROUND;
│ │ │ │ -
833 }
│ │ │ │ -
834
│ │ │ │ -
835
│ │ │ │ -
836 template<class TG, class TL, int N>
│ │ │ │ -
837 inline void ParallelIndexSet<TG,TL,N>::merge(){
│ │ │ │ -
838 if(localIndices_.size()==0)
│ │ │ │ -
839 {
│ │ │ │ -
840 localIndices_=newIndices_;
│ │ │ │ -
841 newIndices_.clear();
│ │ │ │ -
842 }
│ │ │ │ -
843 else if(newIndices_.size()>0 || deletedEntries_)
│ │ │ │ -
844 {
│ │ │ │ -
845 ArrayList<IndexPair,N> tempPairs;
│ │ │ │ -
846
│ │ │ │ -
847 auto old = localIndices_.begin();
│ │ │ │ -
848 auto added = newIndices_.begin();
│ │ │ │ -
849 const auto endold = localIndices_.end();
│ │ │ │ -
850 const auto endadded = newIndices_.end();
│ │ │ │ -
851
│ │ │ │ -
852 while(old != endold && added!= endadded)
│ │ │ │ -
853 {
│ │ │ │ -
854 if(old->local().state()==DELETED) {
│ │ │ │ -
855 old.eraseToHere();
│ │ │ │ -
856 }
│ │ │ │ -
857 else
│ │ │ │ -
858 {
│ │ │ │ -
859 if(old->global() < added->global() ||
│ │ │ │ -
860 (old->global() == added->global()
│ │ │ │ -
861 && LocalIndexComparator<TL>::compare(old->local(),added->local())))
│ │ │ │ -
862 {
│ │ │ │ -
863 tempPairs.push_back(*old);
│ │ │ │ -
864 old.eraseToHere();
│ │ │ │ -
865 continue;
│ │ │ │ -
866 }else
│ │ │ │ -
867 {
│ │ │ │ -
868 tempPairs.push_back(*added);
│ │ │ │ -
869 added.eraseToHere();
│ │ │ │ -
870 }
│ │ │ │ -
871 }
│ │ │ │ -
872 }
│ │ │ │ -
873
│ │ │ │ -
874 while(old != endold)
│ │ │ │ -
875 {
│ │ │ │ -
876 if(old->local().state()!=DELETED) {
│ │ │ │ -
877 tempPairs.push_back(*old);
│ │ │ │ -
878 }
│ │ │ │ -
879 old.eraseToHere();
│ │ │ │ -
880 }
│ │ │ │ -
881
│ │ │ │ -
882 while(added!= endadded)
│ │ │ │ -
883 {
│ │ │ │ -
884 tempPairs.push_back(*added);
│ │ │ │ -
885 added.eraseToHere();
│ │ │ │ -
886 }
│ │ │ │ -
887 localIndices_ = tempPairs;
│ │ │ │ -
888 }
│ │ │ │ -
889 }
│ │ │ │ -
890
│ │ │ │ -
891
│ │ │ │ -
892 template<class TG, class TL, int N>
│ │ │ │ -
893 inline const IndexPair<TG,TL>&
│ │ │ │ -
894 ParallelIndexSet<TG,TL,N>::at(const TG& global) const
│ │ │ │ -
895 {
│ │ │ │ -
896 // perform a binary search
│ │ │ │ -
897 int low=0, high=localIndices_.size()-1, probe=-1;
│ │ │ │ -
898
│ │ │ │ -
899 while(low<high)
│ │ │ │ -
900 {
│ │ │ │ -
901 probe = (high + low) / 2;
│ │ │ │ -
902 if(global <= localIndices_[probe].global())
│ │ │ │ -
903 high = probe;
│ │ │ │ -
904 else
│ │ │ │ -
905 low = probe+1;
│ │ │ │ -
906 }
│ │ │ │ -
907
│ │ │ │ -
908 if(probe==-1)
│ │ │ │ -
909 DUNE_THROW(RangeError, "No entries!");
│ │ │ │ -
910
│ │ │ │ -
911 if( localIndices_[low].global() != global)
│ │ │ │ -
912 DUNE_THROW(RangeError, "Could not find entry of "<<global);
│ │ │ │ -
913 else
│ │ │ │ -
914 return localIndices_[low];
│ │ │ │ -
915 }
│ │ │ │ -
916
│ │ │ │ -
917 template<class TG, class TL, int N>
│ │ │ │ -
918 inline const IndexPair<TG,TL>&
│ │ │ │ -
919 ParallelIndexSet<TG,TL,N>::operator[](const TG& global) const
│ │ │ │ -
920 {
│ │ │ │ -
921 // perform a binary search
│ │ │ │ -
922 int low=0, high=localIndices_.size()-1, probe=-1;
│ │ │ │ -
923
│ │ │ │ -
924 while(low<high)
│ │ │ │ -
925 {
│ │ │ │ -
926 probe = (high + low) / 2;
│ │ │ │ -
927 if(global <= localIndices_[probe].global())
│ │ │ │ -
928 high = probe;
│ │ │ │ -
929 else
│ │ │ │ -
930 low = probe+1;
│ │ │ │ -
931 }
│ │ │ │ -
932
│ │ │ │ -
933 return localIndices_[low];
│ │ │ │ -
934 }
│ │ │ │ -
935 template<class TG, class TL, int N>
│ │ │ │ -
936 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::at(const TG& global)
│ │ │ │ -
937 {
│ │ │ │ -
938 // perform a binary search
│ │ │ │ -
939 int low=0, high=localIndices_.size()-1, probe=-1;
│ │ │ │ -
940
│ │ │ │ -
941 while(low<high)
│ │ │ │ -
942 {
│ │ │ │ -
943 probe = (high + low) / 2;
│ │ │ │ -
944 if(localIndices_[probe].global() >= global)
│ │ │ │ -
945 high = probe;
│ │ │ │ -
946 else
│ │ │ │ -
947 low = probe+1;
│ │ │ │ -
948 }
│ │ │ │ -
949
│ │ │ │ -
950 if(probe==-1)
│ │ │ │ -
951 DUNE_THROW(RangeError, "No entries!");
│ │ │ │ -
952
│ │ │ │ -
953 if( localIndices_[low].global() != global)
│ │ │ │ -
954 DUNE_THROW(RangeError, "Could not find entry of "<<global);
│ │ │ │ -
955 else
│ │ │ │ -
956 return localIndices_[low];
│ │ │ │ -
957 }
│ │ │ │ -
958
│ │ │ │ -
959 template<class TG, class TL, int N>
│ │ │ │ -
960 inline bool ParallelIndexSet<TG,TL,N>::exists (const TG& global) const
│ │ │ │ -
961 {
│ │ │ │ -
962 // perform a binary search
│ │ │ │ -
963 int low=0, high=localIndices_.size()-1, probe=-1;
│ │ │ │ -
964
│ │ │ │ -
965 while(low<high)
│ │ │ │ -
966 {
│ │ │ │ -
967 probe = (high + low) / 2;
│ │ │ │ -
968 if(localIndices_[probe].global() >= global)
│ │ │ │ -
969 high = probe;
│ │ │ │ -
970 else
│ │ │ │ -
971 low = probe+1;
│ │ │ │ -
972 }
│ │ │ │ -
973
│ │ │ │ -
974 if(probe==-1)
│ │ │ │ -
975 return false;
│ │ │ │ -
976
│ │ │ │ -
977 if( localIndices_[low].global() != global)
│ │ │ │ -
978 return false;
│ │ │ │ -
979 return true;
│ │ │ │ -
980 }
│ │ │ │ -
981
│ │ │ │ -
982 template<class TG, class TL, int N>
│ │ │ │ -
983 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::operator[](const TG& global)
│ │ │ │ -
984 {
│ │ │ │ -
985 // perform a binary search
│ │ │ │ -
986 int low=0, high=localIndices_.size()-1, probe=-1;
│ │ │ │ -
987
│ │ │ │ -
988 while(low<high)
│ │ │ │ -
989 {
│ │ │ │ -
990 probe = (high + low) / 2;
│ │ │ │ -
991 if(localIndices_[probe].global() >= global)
│ │ │ │ -
992 high = probe;
│ │ │ │ -
993 else
│ │ │ │ -
994 low = probe+1;
│ │ │ │ -
995 }
│ │ │ │ -
996
│ │ │ │ -
997 return localIndices_[low];
│ │ │ │ -
998 }
│ │ │ │ -
999 template<class TG, class TL, int N>
│ │ │ │ -
1000 inline typename ParallelIndexSet<TG,TL,N>::iterator
│ │ │ │ - │ │ │ │ -
1002 {
│ │ │ │ -
1003 return iterator(*this, localIndices_.begin());
│ │ │ │ -
1004 }
│ │ │ │ -
1005
│ │ │ │ -
1006
│ │ │ │ -
1007 template<class TG, class TL, int N>
│ │ │ │ -
1008 inline typename ParallelIndexSet<TG,TL,N>::iterator
│ │ │ │ - │ │ │ │ -
1010 {
│ │ │ │ -
1011 return iterator(*this,localIndices_.end());
│ │ │ │ -
1012 }
│ │ │ │ -
1013
│ │ │ │ -
1014 template<class TG, class TL, int N>
│ │ │ │ -
1015 inline typename ParallelIndexSet<TG,TL,N>::const_iterator
│ │ │ │ - │ │ │ │ -
1017 {
│ │ │ │ -
1018 return localIndices_.begin();
│ │ │ │ -
1019 }
│ │ │ │ -
1020
│ │ │ │ -
1021
│ │ │ │ -
1022 template<class TG, class TL, int N>
│ │ │ │ -
1023 inline typename ParallelIndexSet<TG,TL,N>::const_iterator
│ │ │ │ - │ │ │ │ -
1025 {
│ │ │ │ -
1026 return localIndices_.end();
│ │ │ │ -
1027 }
│ │ │ │ -
1028
│ │ │ │ -
1029 template<class TG, class TL, int N>
│ │ │ │ - │ │ │ │ -
1031#ifndef NDEBUG
│ │ │ │ -
1032 if(state_==RESIZE)
│ │ │ │ -
1033 DUNE_THROW(InvalidIndexSetState, "IndexSet has to be in "
│ │ │ │ -
1034 <<"GROUND state for renumberLocal()");
│ │ │ │ -
1035#endif
│ │ │ │ -
1036
│ │ │ │ -
1037 const auto end_ = end();
│ │ │ │ -
1038 uint32_t index=0;
│ │ │ │ -
1039
│ │ │ │ -
1040 for(auto pair=begin(); pair!=end_; index++, ++pair)
│ │ │ │ -
1041 pair->local()=index;
│ │ │ │ -
1042 }
│ │ │ │ -
1043
│ │ │ │ -
1044 template<class TG, class TL, int N>
│ │ │ │ -
1045 inline int ParallelIndexSet<TG,TL,N>::seqNo() const
│ │ │ │ -
1046 {
│ │ │ │ -
1047 return seqNo_;
│ │ │ │ -
1048 }
│ │ │ │ -
1049
│ │ │ │ -
1050 template<class TG, class TL, int N>
│ │ │ │ -
1051 inline size_t ParallelIndexSet<TG,TL,N>::size() const
│ │ │ │ -
1052 {
│ │ │ │ -
1053 return localIndices_.size();
│ │ │ │ -
1054 }
│ │ │ │ -
1055
│ │ │ │ -
1056 template<class I>
│ │ │ │ - │ │ │ │ -
1058 std::size_t size)
│ │ │ │ -
1059 : indexSet_(indexset), size_(size),
│ │ │ │ -
1060 indices_(size_, static_cast<const IndexPair*>(0))
│ │ │ │ -
1061 {
│ │ │ │ -
1062 const_iterator end_ = indexSet_.end();
│ │ │ │ -
1063
│ │ │ │ -
1064 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) {
│ │ │ │ -
1065 assert(pair->local()<size_);
│ │ │ │ -
1066 indices_[pair->local()] = &(*pair);
│ │ │ │ -
1067 }
│ │ │ │ -
1068 }
│ │ │ │ -
1069
│ │ │ │ -
1070 template<class I>
│ │ │ │ - │ │ │ │ -
1072 : indexSet_(indexset), size_(0)
│ │ │ │ -
1073 {
│ │ │ │ -
1074 const_iterator end_ = indexSet_.end();
│ │ │ │ -
1075 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
│ │ │ │ -
1076 size_=std::max(size_,static_cast<std::size_t>(pair->local()));
│ │ │ │ -
1077
│ │ │ │ -
1078 indices_.resize(++size_, 0);
│ │ │ │ -
1079
│ │ │ │ -
1080 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
│ │ │ │ -
1081 indices_[pair->local()] = &(*pair);
│ │ │ │ -
1082 }
│ │ │ │ -
1083
│ │ │ │ -
1084 template<class I>
│ │ │ │ - │ │ │ │ -
1086 {}
│ │ │ │ -
1087
│ │ │ │ -
1088 template<class I>
│ │ │ │ -
1089 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>*
│ │ │ │ -
1090 GlobalLookupIndexSet<I>::pair(const std::size_t& local) const
│ │ │ │ -
1091 {
│ │ │ │ -
1092 return indices_[local];
│ │ │ │ -
1093 }
│ │ │ │ -
1094
│ │ │ │ -
1095 template<class I>
│ │ │ │ -
1096 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>&
│ │ │ │ -
1097 GlobalLookupIndexSet<I>::operator[](const GlobalIndex& global) const
│ │ │ │ -
1098 {
│ │ │ │ -
1099 return indexSet_[global];
│ │ │ │ -
1100 }
│ │ │ │ -
1101
│ │ │ │ -
1102 template<class I>
│ │ │ │ -
1103 typename I::const_iterator GlobalLookupIndexSet<I>::begin() const
│ │ │ │ -
1104 {
│ │ │ │ -
1105 return indexSet_.begin();
│ │ │ │ -
1106 }
│ │ │ │ -
1107
│ │ │ │ -
1108 template<class I>
│ │ │ │ -
1109 typename I::const_iterator GlobalLookupIndexSet<I>::end() const
│ │ │ │ -
1110 {
│ │ │ │ -
1111 return indexSet_.end();
│ │ │ │ -
1112 }
│ │ │ │ -
1113
│ │ │ │ -
1114 template<class I>
│ │ │ │ -
1115 inline size_t GlobalLookupIndexSet<I>::size() const
│ │ │ │ -
1116 {
│ │ │ │ -
1117 return size_;
│ │ │ │ -
1118 }
│ │ │ │ -
1119
│ │ │ │ -
1120 template<class I>
│ │ │ │ -
1121 inline int GlobalLookupIndexSet<I>::seqNo() const
│ │ │ │ -
1122 {
│ │ │ │ -
1123 return indexSet_.seqNo();
│ │ │ │ -
1124 }
│ │ │ │ -
1125
│ │ │ │ -
1126 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
│ │ │ │ -
1127 bool operator==(const ParallelIndexSet<TG,TL,N>& idxset,
│ │ │ │ -
1128 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
│ │ │ │ -
1129 {
│ │ │ │ -
1130 if(idxset.size()!=idxset1.size())
│ │ │ │ -
1131 return false;
│ │ │ │ -
1132 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iter;
│ │ │ │ -
1133 typedef typename ParallelIndexSet<TG1,TL1,N1>::const_iterator Iter1;
│ │ │ │ -
1134 Iter iter=idxset.begin();
│ │ │ │ -
1135 for(Iter1 iter1=idxset1.begin(); iter1 != idxset1.end(); ++iter, ++iter1) {
│ │ │ │ -
1136 if(iter1->global()!=iter->global())
│ │ │ │ -
1137 return false;
│ │ │ │ -
1138 typedef typename ParallelIndexSet<TG,TL,N>::LocalIndex PI;
│ │ │ │ -
1139 const PI& pi=iter->local(), pi1=iter1->local();
│ │ │ │ -
1140
│ │ │ │ -
1141 if(pi!=pi1)
│ │ │ │ -
1142 return false;
│ │ │ │ -
1143 }
│ │ │ │ -
1144 return true;
│ │ │ │ -
1145 }
│ │ │ │ -
1146
│ │ │ │ -
1147 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
│ │ │ │ -
1148 bool operator!=(const ParallelIndexSet<TG,TL,N>& idxset,
│ │ │ │ -
1149 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
│ │ │ │ -
1150 {
│ │ │ │ -
1151 return !(idxset==idxset1);
│ │ │ │ -
1152 }
│ │ │ │ -
1153
│ │ │ │ -
1154
│ │ │ │ -
1155#endif // DOXYGEN
│ │ │ │ -
1156
│ │ │ │ -
1157}
│ │ │ │ -
1158
│ │ │ │ -
1159#endif // DUNE_COMMON_PARALLEL_INDEXSET_HH
│ │ │ │ -
Provides classes for use as the local index in ParallelIndexSet.
│ │ │ │ -
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ -
Implements a random-access container that can efficiently change size (similar to std::deque)
│ │ │ │ -
A few common exception classes.
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ -
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:638
│ │ │ │ -
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:684
│ │ │ │ -
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:661
│ │ │ │ -
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:238
│ │ │ │ -
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:706
│ │ │ │ -
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:260
│ │ │ │ -
IndexPair & operator[](const GlobalIndex &global)
Find the index pair with a specific global id.
│ │ │ │ -
static constexpr int arraySize
The size of the individual arrays in the underlying ArrayList.
Definition indexset.hh:252
│ │ │ │ -
void beginResize()
Indicate that the index set is to be resized.
│ │ │ │ -
ParallelIndexSetState
The states the index set can be in.
Definition indexset.hh:181
│ │ │ │ -
void renumberLocal()
Renumbers the local index numbers.
│ │ │ │ -
bool exists(const GlobalIndex &global) const
Find the index pair with a specific global id.
│ │ │ │ -
size_t size() const
Get the total number (public and nonpublic) indices.
│ │ │ │ -
ArrayList< IndexPair, N >::const_iterator const_iterator
The constant iterator over the pairs.
Definition indexset.hh:296
│ │ │ │ -
bool operator()(const IndexPair< TG, TL > &i1, const IndexPair< TG, TL > &i2)
Definition indexset.hh:625
│ │ │ │ -
void add(const GlobalIndex &global)
Add an new index to the set.
│ │ │ │ -
const_iterator end() const
Get an iterator over the indices positioned after the last index.
│ │ │ │ -
const LocalIndex & local() const
Get the local index.
│ │ │ │ -
const IndexPair & at(const GlobalIndex &global) const
Find the index pair with a specific global id.
│ │ │ │ -
GlobalLookupIndexSet(const ParallelIndexSet &indexset)
Constructor.
│ │ │ │ -
TL LocalIndex
the type of the local index.
Definition indexset.hh:120
│ │ │ │ -
int seqNo() const
Get the internal sequence number.
│ │ │ │ -
static bool compare(const T &t1, const T &t2)
Definition indexset.hh:616
│ │ │ │ -
iterator begin()
Get an iterator over the indices positioned at the first index.
│ │ │ │ -
Dune::IndexPair< typename I::GlobalIndex, typename I::LocalIndex > IndexPair
Definition indexset.hh:529
│ │ │ │ -
iterator end()
Get an iterator over the indices positioned after the last index.
│ │ │ │ -
ParallelIndexSet::const_iterator const_iterator
The iterator over the index pairs.
Definition indexset.hh:527
│ │ │ │ -
const_iterator begin() const
Get an iterator over the indices positioned at the first index.
│ │ │ │ -
const IndexPair & operator[](const GlobalIndex &global) const
Find the index pair with a specific global id.
│ │ │ │ -
const ParallelIndexSetState & state()
Get the state the index set is in.
Definition indexset.hh:307
│ │ │ │ -
const_iterator begin() const
Get an iterator over the indices positioned at the first index.
│ │ │ │ -
const IndexPair & operator[](const GlobalIndex &global) const
Find the index pair with a specific global id.
│ │ │ │ -
IndexPair()
Construct a new Pair.
│ │ │ │ -
I ParallelIndexSet
The type of the index set.
Definition indexset.hh:512
│ │ │ │ -
TL LocalIndex
The type of the local index, e.g. ParallelLocalIndex.
Definition indexset.hh:239
│ │ │ │ -
void markAsDeleted(const iterator &position)
Mark an index as deleted.
│ │ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition indexset.hh:517
│ │ │ │ -
IndexPair(const GlobalIndex &global, const LocalIndex &local)
Constructs a new Pair.
│ │ │ │ -
void setLocal(int index)
Set the local index.
│ │ │ │ -
const GlobalIndex & global() const
Get the global index.
│ │ │ │ -
void add(const GlobalIndex &global, const LocalIndex &local)
Add an new index to the set.
│ │ │ │ -
const_iterator end() const
Get an iterator over the indices positioned after the last index.
│ │ │ │ -
IndexPair & at(const GlobalIndex &global)
Find the index pair with a specific global id.
│ │ │ │ -
ParallelIndexSet()
Constructor.
│ │ │ │ -
void endResize()
Indicate that the resizing finishes.
│ │ │ │ -
~GlobalLookupIndexSet()
Destructor.
│ │ │ │ -
const IndexPair * pair(const std::size_t &local) const
Get the index pair corresponding to a local index.
│ │ │ │ -
LocalIndex & local()
Get the local index.
│ │ │ │ -
size_t size() const
Get the total number (public and nonpublic) indices.
│ │ │ │ -
IndexPair(const GlobalIndex &global)
Constructs a new Pair.
│ │ │ │ -
TG GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition indexset.hh:226
│ │ │ │ -
TG GlobalIndex
the type of the global index.
Definition indexset.hh:107
│ │ │ │ -
int seqNo() const
Get the internal sequence number.
│ │ │ │ -
iterator(ParallelIndexSet< TG, TL, N > &indexSet, const Father &father)
Definition indexset.hh:262
│ │ │ │ -
GlobalLookupIndexSet(const ParallelIndexSet &indexset, std::size_t size)
Constructor.
│ │ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition indexset.hh:522
│ │ │ │ -
Dune::IndexPair< GlobalIndex, LocalIndex > IndexPair
The type of the pair stored.
Definition indexset.hh:244
│ │ │ │ -
@ RESIZE
Indicates that the index set is currently being resized.
Definition indexset.hh:190
│ │ │ │ -
@ GROUND
The default mode. Indicates that the index set is ready to be used.
Definition indexset.hh:186
│ │ │ │ -
@ DELETED
Definition localindex.hh:28
│ │ │ │ +
87 template<class A, class B>
│ │ │ │ +
88 auto
│ │ │ │ +
│ │ │ │ +
89 dotT(const A & a, const B & b) -> decltype(a*b)
│ │ │ │ +
90 {
│ │ │ │ +
91 return a*b;
│ │ │ │ +
92 }
│ │ │ │ +
│ │ │ │ +
93
│ │ │ │ +
95} // end namespace DUNE
│ │ │ │ +
96
│ │ │ │ +
97#endif // DUNE_DOTPRODUCT_HH
│ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
Type traits to determine the type of reals (when working with complex numbers)
│ │ │ │ +
auto dotT(const A &a, const B &b) -> decltype(a *b)
Computes an indefinite vector dot product for fundamental data types according to Petsc's VectTDot fu...
Definition dotproduct.hh:89
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ -
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
│ │ │ │ -
A random access iterator for the Dune::ArrayList class.
Definition arraylist.hh:255
│ │ │ │ -
A constant random access iterator for the Dune::ArrayList class.
Definition arraylist.hh:368
│ │ │ │ -
A dynamically growing random access list.
Definition arraylist.hh:62
│ │ │ │ -
ConstArrayListIterator< MemberType, N, A > const_iterator
A constant random access iterator.
Definition arraylist.hh:110
│ │ │ │ -
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
│ │ │ │ -
Default exception if a function was called while the object is not in a valid state for that function...
Definition exceptions.hh:281
│ │ │ │ - │ │ │ │ -
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
│ │ │ │ -
Decorates an index set with the possibility to find a global index that is mapped to a specific local...
Definition indexset.hh:507
│ │ │ │ -
Manager class for the mapping between local indices and globally unique indices.
Definition indexset.hh:218
│ │ │ │ -
The iterator over the pairs.
Definition indexset.hh:257
│ │ │ │ -
Definition indexset.hh:615
│ │ │ │ -
Definition indexset.hh:624
│ │ │ │ +
Definition dotproduct.hh:27
│ │ │ │ +
T real_type
export the type representing the real type of the field
Definition ftraits.hh:30
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1122 +1,99 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -indexset.hh │ │ │ │ │ +dotproduct.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 © 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_INDEXSET_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_INDEXSET_HH │ │ │ │ │ +5#ifndef DUNE_DOTPRODUCT_HH │ │ │ │ │ +6#define DUNE_DOTPRODUCT_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include // for uint32_t │ │ │ │ │ -10#include │ │ │ │ │ -11 │ │ │ │ │ -12#include <_d_u_n_e_/_c_o_m_m_o_n_/_a_r_r_a_y_l_i_s_t_._h_h> │ │ │ │ │ -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#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_l_o_c_a_l_i_n_d_e_x_._h_h> │ │ │ │ │ -15#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> │ │ │ │ │ -16 │ │ │ │ │ -17namespace _D_u_n_e │ │ │ │ │ -18{ │ │ │ │ │ -28 // forward declarations │ │ │ │ │ -29 │ │ │ │ │ -30 template │ │ │ │ │ -31 class IndexPair; │ │ │ │ │ +8#include "_f_t_r_a_i_t_s_._h_h" │ │ │ │ │ +9#include "_t_y_p_e_t_r_a_i_t_s_._h_h" │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e { │ │ │ │ │ +26 template │ │ │ │ │ +_2_7 struct _I_s_V_e_c_t_o_r : std::false_type {}; │ │ │ │ │ +28 │ │ │ │ │ +29 template │ │ │ │ │ +_3_0 struct _I_s_V_e_c_t_o_r > │ │ │ │ │ +31 : std::true_type {}; │ │ │ │ │ 32 │ │ │ │ │ -38 template │ │ │ │ │ -39 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const IndexPair& pair); │ │ │ │ │ -40 │ │ │ │ │ -41 template │ │ │ │ │ -42 bool _o_p_e_r_a_t_o_r_=_=(const IndexPair&, const IndexPair&); │ │ │ │ │ -43 │ │ │ │ │ -44 template │ │ │ │ │ -45 bool _o_p_e_r_a_t_o_r_!_=(const IndexPair&, const IndexPair&); │ │ │ │ │ +40 template │ │ │ │ │ +41 auto │ │ │ │ │ +_4_2 _d_o_t(const A & a, const B & b) -> typename std::enable_if::value │ │ │ │ │ +&& !_I_s_V_e_c_t_o_r_<_A_>_:_:_v_a_l_u_e && !std::is_same:: │ │ │ │ │ +field_type,typename _F_i_e_l_d_T_r_a_i_t_s_<_A_>_:_:_r_e_a_l___t_y_p_e> ::value, decltype(conj(a)*b)>:: │ │ │ │ │ +type │ │ │ │ │ +43 { │ │ │ │ │ +44 return conj(a)*b; │ │ │ │ │ +45 } │ │ │ │ │ 46 │ │ │ │ │ -47 template │ │ │ │ │ -48 bool _o_p_e_r_a_t_o_r_<(const IndexPair&, const IndexPair&); │ │ │ │ │ -49 │ │ │ │ │ -50 template │ │ │ │ │ -51 bool _o_p_e_r_a_t_o_r_>(const IndexPair&, const IndexPair&); │ │ │ │ │ -52 │ │ │ │ │ -53 template │ │ │ │ │ -54 bool _o_p_e_r_a_t_o_r_<_=(const IndexPair&, const IndexPair&); │ │ │ │ │ -55 │ │ │ │ │ -56 template │ │ │ │ │ -57 bool _o_p_e_r_a_t_o_r_ _>_=(const IndexPair&, const IndexPair&); │ │ │ │ │ -58 │ │ │ │ │ -59 template │ │ │ │ │ -60 bool _o_p_e_r_a_t_o_r_=_=(const IndexPair&, const TG&); │ │ │ │ │ -61 │ │ │ │ │ -62 template │ │ │ │ │ -63 bool _o_p_e_r_a_t_o_r_!_=(const IndexPair&, const TG&); │ │ │ │ │ -64 │ │ │ │ │ -65 template │ │ │ │ │ -66 bool _o_p_e_r_a_t_o_r_<(const IndexPair&, const TG&); │ │ │ │ │ -67 │ │ │ │ │ -68 template │ │ │ │ │ -69 bool _o_p_e_r_a_t_o_r_>(const IndexPair&, const TG&); │ │ │ │ │ -70 │ │ │ │ │ -71 template │ │ │ │ │ -72 bool _o_p_e_r_a_t_o_r_<_=(const IndexPair&, const TG&); │ │ │ │ │ -73 │ │ │ │ │ -74 template │ │ │ │ │ -75 bool _o_p_e_r_a_t_o_r_ _>_=(const IndexPair&, const TG&); │ │ │ │ │ -76 │ │ │ │ │ -77 template │ │ │ │ │ -78 struct MPITraits; │ │ │ │ │ +56 // fundamental type with A being a real type │ │ │ │ │ +57 template │ │ │ │ │ +58 auto │ │ │ │ │ +59 _d_o_t(const A & a, const B & b) -> typename std::enable_if::value │ │ │ │ │ +&& !IsVector::value && std::is_same:: │ │ │ │ │ +field_type,typename _F_i_e_l_d_T_r_a_i_t_s_<_A_>_:_:_r_e_a_l___t_y_p_e>::value, decltype(a*b)>::type │ │ │ │ │ +60 { │ │ │ │ │ +61 return a*b; │ │ │ │ │ +62 } │ │ │ │ │ +63 │ │ │ │ │ +73 template │ │ │ │ │ +74 auto │ │ │ │ │ +75 _d_o_t(const A & a, const B & b) -> typename std::enable_if::value, │ │ │ │ │ +decltype(a.dot(b))>::type │ │ │ │ │ +76 { │ │ │ │ │ +77 return a.dot(b); │ │ │ │ │ +78 } │ │ │ │ │ 79 │ │ │ │ │ -83 template │ │ │ │ │ -_8_4 class _I_n_d_e_x_P_a_i_r │ │ │ │ │ -85 { │ │ │ │ │ -86 friend std::ostream& operator<<<>(std::ostream&, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&); │ │ │ │ │ -87 friend bool operator==<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&); │ │ │ │ │ -88 friend bool operator!=<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&); │ │ │ │ │ -89 friend bool operator< <>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&); │ │ │ │ │ -90 friend bool operator><>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&); │ │ │ │ │ -91 friend bool operator<=<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&); │ │ │ │ │ -92 friend bool operator>=<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&); │ │ │ │ │ -93 friend bool operator==<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const TG &); │ │ │ │ │ -94 friend bool operator!=<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const TG &); │ │ │ │ │ -95 friend bool operator< <>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const TG &); │ │ │ │ │ -96 friend bool operator> <>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const TG &); │ │ │ │ │ -97 friend bool operator<=<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const TG &); │ │ │ │ │ -_9_8 friend bool operator>=<>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>&, const TG &); │ │ │ │ │ -99 friend struct _M_P_I_T_r_a_i_t_s<_I_n_d_e_x_P_a_i_r >; │ │ │ │ │ -100 │ │ │ │ │ -101 public: │ │ │ │ │ -_1_0_7 typedef TG _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -108 │ │ │ │ │ -_1_2_0 typedef TL _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ -121 │ │ │ │ │ -_1_2_8 _I_n_d_e_x_P_a_i_r(const _G_l_o_b_a_l_I_n_d_e_x& _g_l_o_b_a_l, const _L_o_c_a_l_I_n_d_e_x& _l_o_c_a_l); │ │ │ │ │ -129 │ │ │ │ │ -_1_3_3 _I_n_d_e_x_P_a_i_r(); │ │ │ │ │ -_1_4_0 _I_n_d_e_x_P_a_i_r(const _G_l_o_b_a_l_I_n_d_e_x& _g_l_o_b_a_l); │ │ │ │ │ -141 │ │ │ │ │ -_1_4_7 inline const _G_l_o_b_a_l_I_n_d_e_x& _g_l_o_b_a_l() const; │ │ │ │ │ -148 │ │ │ │ │ -_1_5_4 inline _L_o_c_a_l_I_n_d_e_x& _l_o_c_a_l(); │ │ │ │ │ -155 │ │ │ │ │ -_1_6_1 inline const _L_o_c_a_l_I_n_d_e_x& _l_o_c_a_l() const; │ │ │ │ │ -162 │ │ │ │ │ -_1_6_8 inline void _s_e_t_L_o_c_a_l(int index); │ │ │ │ │ -169 private: │ │ │ │ │ -171 _G_l_o_b_a_l_I_n_d_e_x global_; │ │ │ │ │ -_1_7_3 _L_o_c_a_l_I_n_d_e_x local_; │ │ │ │ │ -174 }; │ │ │ │ │ -175 │ │ │ │ │ -_1_8_0 enum _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_S_t_a_t_e │ │ │ │ │ -181 { │ │ │ │ │ -_1_8_6 _G_R_O_U_N_D, │ │ │ │ │ -190 _R_E_S_I_Z_E │ │ │ │ │ -_2_0_0 }; │ │ │ │ │ -201 │ │ │ │ │ -_2_0_5 class _I_n_v_a_l_i_d_I_n_d_e_x_S_e_t_S_t_a_t_e : public _I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ -206 │ │ │ │ │ -207 // Forward declaration │ │ │ │ │ -208 template class _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ │ -209 │ │ │ │ │ -216 template │ │ │ │ │ -_2_1_7 class _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -218 { │ │ │ │ │ -219 friend class _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t<_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t >; │ │ │ │ │ -220 │ │ │ │ │ -221 public: │ │ │ │ │ -_2_2_6 typedef TG _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -227 │ │ │ │ │ -_2_3_9 typedef TL _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ -240 │ │ │ │ │ -_2_4_4 typedef _D_u_n_e_:_:_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_> _I_n_d_e_x_P_a_i_r; │ │ │ │ │ -245 │ │ │ │ │ -_2_5_2 constexpr static int _a_r_r_a_y_S_i_z_e = (N>0) ? N : 1; │ │ │ │ │ -253 │ │ │ │ │ -_2_5_5 class _i_t_e_r_a_t_o_r : │ │ │ │ │ -256 public _A_r_r_a_y_L_i_s_t::iterator │ │ │ │ │ -257 { │ │ │ │ │ -258 typedef typename _A_r_r_a_y_L_i_s_t_<_I_n_d_e_x_P_a_i_r_,_N_>_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -_2_5_9 _F_a_t_h_e_r; │ │ │ │ │ -260 friend class _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>; │ │ │ │ │ -261 public: │ │ │ │ │ -_2_6_2 _i_t_e_r_a_t_o_r(_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>& indexSet, const _F_a_t_h_e_r& father) │ │ │ │ │ -263 : _F_a_t_h_e_r(father), indexSet_(&indexSet) │ │ │ │ │ -264 {} │ │ │ │ │ -265 │ │ │ │ │ -266 private: │ │ │ │ │ -276 inline void markAsDeleted() const │ │ │ │ │ -277 { │ │ │ │ │ -278#ifndef NDEBUG │ │ │ │ │ -279 if(indexSet_->state_ != _R_E_S_I_Z_E) │ │ │ │ │ -280 _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, "Indices can only be removed " │ │ │ │ │ -281 <<"while in RESIZE state!"); │ │ │ │ │ -282#endif │ │ │ │ │ -283 _F_a_t_h_e_r_:_:_o_p_e_r_a_t_o_r_*().local().setState(_D_E_L_E_T_E_D); │ │ │ │ │ -284 } │ │ │ │ │ -285 │ │ │ │ │ -287 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>* indexSet_; │ │ │ │ │ -288 │ │ │ │ │ -289 }; │ │ │ │ │ -290 │ │ │ │ │ -291 │ │ │ │ │ -292 │ │ │ │ │ -294 typedef typename │ │ │ │ │ -295 _A_r_r_a_y_L_i_s_t_<_I_n_d_e_x_P_a_i_r_,_N_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -_2_9_6 _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -297 │ │ │ │ │ -_3_0_1 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t(); │ │ │ │ │ -302 │ │ │ │ │ -_3_0_7 inline const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_S_t_a_t_e& _s_t_a_t_e() │ │ │ │ │ -308 { │ │ │ │ │ -309 return state_; │ │ │ │ │ -310 } │ │ │ │ │ -311 │ │ │ │ │ -_3_1_7 void _b_e_g_i_n_R_e_s_i_z_e(); │ │ │ │ │ -318 │ │ │ │ │ -_3_2_7 inline void _a_d_d(const _G_l_o_b_a_l_I_n_d_e_x& global); │ │ │ │ │ -328 │ │ │ │ │ -_3_3_7 inline void _a_d_d(const _G_l_o_b_a_l_I_n_d_e_x& global, const _L_o_c_a_l_I_n_d_e_x& local); │ │ │ │ │ -338 │ │ │ │ │ -_3_4_6 inline void _m_a_r_k_A_s_D_e_l_e_t_e_d(const _i_t_e_r_a_t_o_r& position); │ │ │ │ │ -347 │ │ │ │ │ -_3_6_0 void _e_n_d_R_e_s_i_z_e(); │ │ │ │ │ -361 │ │ │ │ │ -372 inline _I_n_d_e_x_P_a_i_r& │ │ │ │ │ -_3_7_3 _o_p_e_r_a_t_o_r_[_](const _G_l_o_b_a_l_I_n_d_e_x& global); │ │ │ │ │ -374 │ │ │ │ │ -384 inline _I_n_d_e_x_P_a_i_r& │ │ │ │ │ -_3_8_5 _a_t(const _G_l_o_b_a_l_I_n_d_e_x& global); │ │ │ │ │ -386 │ │ │ │ │ -396 inline bool │ │ │ │ │ -_3_9_7 _e_x_i_s_t_s (const _G_l_o_b_a_l_I_n_d_e_x& global) const; │ │ │ │ │ -398 │ │ │ │ │ -409 inline const _I_n_d_e_x_P_a_i_r& │ │ │ │ │ -_4_1_0 _o_p_e_r_a_t_o_r_[_](const _G_l_o_b_a_l_I_n_d_e_x& global) const; │ │ │ │ │ -411 │ │ │ │ │ -421 inline const _I_n_d_e_x_P_a_i_r& │ │ │ │ │ -_4_2_2 _a_t(const _G_l_o_b_a_l_I_n_d_e_x& global) const; │ │ │ │ │ -423 │ │ │ │ │ -_4_2_8 inline _i_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ │ -429 │ │ │ │ │ -_4_3_4 inline _i_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ │ -435 │ │ │ │ │ -_4_4_0 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ -441 │ │ │ │ │ -_4_4_6 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ -447 │ │ │ │ │ -_4_5_7 inline void _r_e_n_u_m_b_e_r_L_o_c_a_l(); │ │ │ │ │ -458 │ │ │ │ │ -_4_6_5 inline int _s_e_q_N_o() const; │ │ │ │ │ -466 │ │ │ │ │ -_4_7_1 inline size_t _s_i_z_e() const; │ │ │ │ │ -472 │ │ │ │ │ -473 private: │ │ │ │ │ -475 _A_r_r_a_y_L_i_s_t_<_I_n_d_e_x_P_a_i_r_,_N_> localIndices_; │ │ │ │ │ -477 _A_r_r_a_y_L_i_s_t_<_I_n_d_e_x_P_a_i_r_,_N_> newIndices_; │ │ │ │ │ -479 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_S_t_a_t_e state_; │ │ │ │ │ -481 int seqNo_; │ │ │ │ │ -483 bool deletedEntries_; │ │ │ │ │ -488 inline void merge(); │ │ │ │ │ -489 }; │ │ │ │ │ -490 │ │ │ │ │ -491 │ │ │ │ │ -497 template │ │ │ │ │ -498 std::ostream& _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_<_T_G_,_T_L_,_N_>& │ │ │ │ │ -indexSet); │ │ │ │ │ -499 │ │ │ │ │ -505 template │ │ │ │ │ -_5_0_6 class _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -507 { │ │ │ │ │ -508 public: │ │ │ │ │ -_5_1_2 typedef I _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -513 │ │ │ │ │ -_5_1_7 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; │ │ │ │ │ -518 │ │ │ │ │ -_5_2_2 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; │ │ │ │ │ -523 │ │ │ │ │ -_5_2_7 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; │ │ │ │ │ -528 │ │ │ │ │ -_5_2_9 typedef _D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_<_t_y_p_e_n_a_m_e_ _I_:_:_G_l_o_b_a_l_I_n_d_e_x_,_ _t_y_p_e_n_a_m_e_ _I_:_:_L_o_c_a_l_I_n_d_e_x_> │ │ │ │ │ -_I_n_d_e_x_P_a_i_r; │ │ │ │ │ -530 │ │ │ │ │ -_5_3_7 _G_l_o_b_a_l_L_o_o_k_u_p_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, std::size_t _s_i_z_e); │ │ │ │ │ -538 │ │ │ │ │ -_5_4_4 _G_l_o_b_a_l_L_o_o_k_u_p_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); │ │ │ │ │ -545 │ │ │ │ │ -_5_4_9 _~_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t(); │ │ │ │ │ -550 │ │ │ │ │ -560 inline const _I_n_d_e_x_P_a_i_r& │ │ │ │ │ -_5_6_1 _o_p_e_r_a_t_o_r_[_](const _G_l_o_b_a_l_I_n_d_e_x& global) const; │ │ │ │ │ -562 │ │ │ │ │ -566 inline const _I_n_d_e_x_P_a_i_r* │ │ │ │ │ -_5_6_7 _p_a_i_r(const std::size_t& local) const; │ │ │ │ │ -568 │ │ │ │ │ -_5_7_3 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ -574 │ │ │ │ │ -_5_7_9 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ -580 │ │ │ │ │ -_5_8_7 inline int _s_e_q_N_o() const; │ │ │ │ │ -588 │ │ │ │ │ -_5_9_3 inline size_t _s_i_z_e() const; │ │ │ │ │ -594 private: │ │ │ │ │ -598 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet_; │ │ │ │ │ -599 │ │ │ │ │ -603 std::size_t size_; │ │ │ │ │ -604 │ │ │ │ │ -608 std::vector indices_; │ │ │ │ │ -609 │ │ │ │ │ -610 }; │ │ │ │ │ -611 │ │ │ │ │ -612 │ │ │ │ │ -613 template │ │ │ │ │ -_6_1_4 struct _L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r │ │ │ │ │ -615 { │ │ │ │ │ -_6_1_6 static bool _c_o_m_p_a_r_e([[maybe_unused]] const T& t1, [[maybe_unused]] const T& │ │ │ │ │ -t2) │ │ │ │ │ -617 { │ │ │ │ │ -618 return false; │ │ │ │ │ -619 } │ │ │ │ │ -620 }; │ │ │ │ │ -621 │ │ │ │ │ -622 template │ │ │ │ │ -_6_2_3 struct _I_n_d_e_x_S_e_t_S_o_r_t_F_u_n_c_t_o_r │ │ │ │ │ -624 { │ │ │ │ │ -_6_2_5 bool _o_p_e_r_a_t_o_r_(_)(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& i1, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& i2) │ │ │ │ │ -626 { │ │ │ │ │ -627 return i1._g_l_o_b_a_l()_:_:_c_o_m_p_a_r_e(i1._l_o_c_a_l(), │ │ │ │ │ -629 i2._l_o_c_a_l())); │ │ │ │ │ -630 } │ │ │ │ │ -631 }; │ │ │ │ │ -632 │ │ │ │ │ -633 │ │ │ │ │ -634 │ │ │ │ │ -635 template │ │ │ │ │ -_6_3_6 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& │ │ │ │ │ -pair) │ │ │ │ │ -637 { │ │ │ │ │ -638 os<<"{global="< │ │ │ │ │ -_6_4_3 inline std::ostream& _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_<_T_G_,_T_L_,_N_>& indexSet) │ │ │ │ │ -644 { │ │ │ │ │ -645 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iterator; │ │ │ │ │ -646 Iterator end = indexSet._e_n_d(); │ │ │ │ │ -647 os<<"{"; │ │ │ │ │ -648 for(Iterator index = indexSet._b_e_g_i_n(); index != end; ++index) │ │ │ │ │ -649 os<<*index<<" "; │ │ │ │ │ -650 os<<"}"; │ │ │ │ │ -651 return os; │ │ │ │ │ -652 │ │ │ │ │ -653 } │ │ │ │ │ -654 │ │ │ │ │ -655 template │ │ │ │ │ -_6_5_6 inline bool _o_p_e_r_a_t_o_r_=_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& │ │ │ │ │ -b) │ │ │ │ │ -657 { │ │ │ │ │ -658 return a.global_==b.global_; │ │ │ │ │ -659 } │ │ │ │ │ -660 │ │ │ │ │ -661 template │ │ │ │ │ -_6_6_2 inline bool _o_p_e_r_a_t_o_r_!_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& │ │ │ │ │ -b) │ │ │ │ │ -663 { │ │ │ │ │ -664 return a.global_!=b.global_; │ │ │ │ │ -665 } │ │ │ │ │ -666 │ │ │ │ │ -667 template │ │ │ │ │ -_6_6_8 inline bool _o_p_e_r_a_t_o_r_<(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& b) │ │ │ │ │ -669 { │ │ │ │ │ -670 return a.global_ │ │ │ │ │ -_6_7_4 inline bool _o_p_e_r_a_t_o_r_>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& b) │ │ │ │ │ -675 { │ │ │ │ │ -676 return a.global_>b.global_; │ │ │ │ │ -677 } │ │ │ │ │ -678 │ │ │ │ │ -679 template │ │ │ │ │ -_6_8_0 inline bool _o_p_e_r_a_t_o_r_<_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& │ │ │ │ │ -b) │ │ │ │ │ -681 { │ │ │ │ │ -682 return a.global_<=b.global_; │ │ │ │ │ -683 } │ │ │ │ │ -684 │ │ │ │ │ -685 template │ │ │ │ │ -_6_8_6 inline bool _o_p_e_r_a_t_o_r_ _>_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& │ │ │ │ │ -b) │ │ │ │ │ -687 { │ │ │ │ │ -688 return a.global_>=b.global_; │ │ │ │ │ -689 } │ │ │ │ │ -690 │ │ │ │ │ -691 template │ │ │ │ │ -_6_9_2 inline bool _o_p_e_r_a_t_o_r_=_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const TG& b) │ │ │ │ │ -693 { │ │ │ │ │ -694 return a.global_==b; │ │ │ │ │ -695 } │ │ │ │ │ -696 │ │ │ │ │ -697 template │ │ │ │ │ -_6_9_8 inline bool _o_p_e_r_a_t_o_r_!_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const TG& b) │ │ │ │ │ -699 { │ │ │ │ │ -700 return a.global_!=b; │ │ │ │ │ -701 } │ │ │ │ │ -702 │ │ │ │ │ -703 template │ │ │ │ │ -_7_0_4 inline bool _o_p_e_r_a_t_o_r_<(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const TG& b) │ │ │ │ │ -705 { │ │ │ │ │ -706 return a.global_ │ │ │ │ │ -_7_1_0 inline bool _o_p_e_r_a_t_o_r_>(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const TG& b) │ │ │ │ │ -711 { │ │ │ │ │ -712 return a.global_>b; │ │ │ │ │ -713 } │ │ │ │ │ -714 │ │ │ │ │ -715 template │ │ │ │ │ -_7_1_6 inline bool _o_p_e_r_a_t_o_r_<_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const TG& b) │ │ │ │ │ -717 { │ │ │ │ │ -718 return a.global_<=b; │ │ │ │ │ -719 } │ │ │ │ │ -720 │ │ │ │ │ -721 template │ │ │ │ │ -_7_2_2 inline bool _o_p_e_r_a_t_o_r_ _>_=(const _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>& a, const TG& b) │ │ │ │ │ -723 { │ │ │ │ │ -724 return a.global_>=b; │ │ │ │ │ -725 } │ │ │ │ │ -726 │ │ │ │ │ -727#ifndef DOXYGEN │ │ │ │ │ -728 │ │ │ │ │ -729 template │ │ │ │ │ -730 _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>_:_:_I_n_d_e_x_P_a_i_r(const TG& global, const TL& local) │ │ │ │ │ -731 : global_(global), local_(local){} │ │ │ │ │ -732 │ │ │ │ │ -733 template │ │ │ │ │ -734 _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>_:_:_I_n_d_e_x_P_a_i_r(const TG& global) │ │ │ │ │ -735 : global_(global), local_(){} │ │ │ │ │ -736 │ │ │ │ │ -737 template │ │ │ │ │ -738 _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>_:_:_I_n_d_e_x_P_a_i_r() │ │ │ │ │ -739 : global_(), local_(){} │ │ │ │ │ -740 │ │ │ │ │ -741 template │ │ │ │ │ -742 inline const TG& _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>_:_:_g_l_o_b_a_l() const { │ │ │ │ │ -743 return global_; │ │ │ │ │ -744 } │ │ │ │ │ -745 │ │ │ │ │ -746 template │ │ │ │ │ -747 inline TL& _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>_:_:_l_o_c_a_l() { │ │ │ │ │ -748 return local_; │ │ │ │ │ -749 } │ │ │ │ │ -750 │ │ │ │ │ -751 template │ │ │ │ │ -752 inline const TL& _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>_:_:_l_o_c_a_l() const { │ │ │ │ │ -753 return local_; │ │ │ │ │ -754 } │ │ │ │ │ -755 │ │ │ │ │ -756 template │ │ │ │ │ -757 inline void _I_n_d_e_x_P_a_i_r_<_T_G_,_T_L_>_:_:_s_e_t_L_o_c_a_l(int local){ │ │ │ │ │ -758 local_=local; │ │ │ │ │ -759 } │ │ │ │ │ -760 │ │ │ │ │ -761 template │ │ │ │ │ -762 _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() │ │ │ │ │ -763 : state_(_G_R_O_U_N_D), seqNo_(0), deletedEntries_() │ │ │ │ │ -764 {} │ │ │ │ │ -765 │ │ │ │ │ -766 template │ │ │ │ │ -767 void _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_b_e_g_i_n_R_e_s_i_z_e() │ │ │ │ │ -768 { │ │ │ │ │ -769 │ │ │ │ │ -770 // Checks in unproductive code │ │ │ │ │ -771#ifndef NDEBUG │ │ │ │ │ -772 if(state_!=_G_R_O_U_N_D) │ │ │ │ │ -773 _D_U_N_E___T_H_R_O_W(InvalidIndexSetState, │ │ │ │ │ -774 "IndexSet has to be in GROUND state, when " │ │ │ │ │ -775 << "beginResize() is called!"); │ │ │ │ │ -776#endif │ │ │ │ │ -777 │ │ │ │ │ -778 state_ = _R_E_S_I_Z_E; │ │ │ │ │ -779 deletedEntries_ = false; │ │ │ │ │ -780 } │ │ │ │ │ -781 │ │ │ │ │ -782 template │ │ │ │ │ -783 inline void _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_a_d_d(const GlobalIndex& global) │ │ │ │ │ -784 { │ │ │ │ │ -785 // Checks in unproductive code │ │ │ │ │ -786#ifndef NDEBUG │ │ │ │ │ -787 if(state_ != _R_E_S_I_Z_E) │ │ │ │ │ -788 _D_U_N_E___T_H_R_O_W(InvalidIndexSetState, "Indices can only be added " │ │ │ │ │ -789 <<"while in RESIZE state!"); │ │ │ │ │ -790#endif │ │ │ │ │ -791 newIndices_.push_back(IndexPair(global)); │ │ │ │ │ -792 } │ │ │ │ │ -793 │ │ │ │ │ -794 template │ │ │ │ │ -795 inline void _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_a_d_d(const TG& global, const TL& │ │ │ │ │ -local) │ │ │ │ │ -796 { │ │ │ │ │ -797 // Checks in unproductive code │ │ │ │ │ -798#ifndef NDEBUG │ │ │ │ │ -799 if(state_ != _R_E_S_I_Z_E) │ │ │ │ │ -800 _D_U_N_E___T_H_R_O_W(InvalidIndexSetState, "Indices can only be added " │ │ │ │ │ -801 <<"while in RESIZE state!"); │ │ │ │ │ -802#endif │ │ │ │ │ -803 newIndices_.push_back(IndexPair(global,local)); │ │ │ │ │ -804 } │ │ │ │ │ -805 │ │ │ │ │ -806 template │ │ │ │ │ -807 inline void _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_m_a_r_k_A_s_D_e_l_e_t_e_d(const iterator& │ │ │ │ │ -global) │ │ │ │ │ -808 { │ │ │ │ │ -809 // Checks in unproductive code │ │ │ │ │ -810#ifndef NDEBUG │ │ │ │ │ -811 if(state_ != _R_E_S_I_Z_E) │ │ │ │ │ -812 _D_U_N_E___T_H_R_O_W(InvalidIndexSetState, "Indices can only be removed " │ │ │ │ │ -813 <<"while in RESIZE state!"); │ │ │ │ │ -814#endif │ │ │ │ │ -815 deletedEntries_ = true; │ │ │ │ │ -816 │ │ │ │ │ -817 global.markAsDeleted(); │ │ │ │ │ -818 } │ │ │ │ │ -819 │ │ │ │ │ -820 template │ │ │ │ │ -821 void _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_e_n_d_R_e_s_i_z_e() { │ │ │ │ │ -822 // Checks in unproductive code │ │ │ │ │ -823#ifndef NDEBUG │ │ │ │ │ -824 if(state_ != _R_E_S_I_Z_E) │ │ │ │ │ -825 _D_U_N_E___T_H_R_O_W(InvalidIndexSetState, "endResize called while not " │ │ │ │ │ -826 <<"in RESIZE state!"); │ │ │ │ │ -827#endif │ │ │ │ │ -828 │ │ │ │ │ -829 std::sort(newIndices_.begin(), newIndices_.end(), │ │ │ │ │ -IndexSetSortFunctor()); │ │ │ │ │ -830 merge(); │ │ │ │ │ -831 seqNo_++; │ │ │ │ │ -832 state_ = _G_R_O_U_N_D; │ │ │ │ │ -833 } │ │ │ │ │ -834 │ │ │ │ │ -835 │ │ │ │ │ -836 template │ │ │ │ │ -837 inline void ParallelIndexSet::merge(){ │ │ │ │ │ -838 if(localIndices_.size()==0) │ │ │ │ │ -839 { │ │ │ │ │ -840 localIndices_=newIndices_; │ │ │ │ │ -841 newIndices_.clear(); │ │ │ │ │ -842 } │ │ │ │ │ -843 else if(newIndices_.size()>0 || deletedEntries_) │ │ │ │ │ -844 { │ │ │ │ │ -845 ArrayList tempPairs; │ │ │ │ │ -846 │ │ │ │ │ -847 auto old = localIndices_.begin(); │ │ │ │ │ -848 auto added = newIndices_.begin(); │ │ │ │ │ -849 const auto endold = localIndices_.end(); │ │ │ │ │ -850 const auto endadded = newIndices_.end(); │ │ │ │ │ -851 │ │ │ │ │ -852 while(old != endold && added!= endadded) │ │ │ │ │ -853 { │ │ │ │ │ -854 if(old->local().state()==_D_E_L_E_T_E_D) { │ │ │ │ │ -855 old.eraseToHere(); │ │ │ │ │ -856 } │ │ │ │ │ -857 else │ │ │ │ │ -858 { │ │ │ │ │ -859 if(old->global() < added->global() || │ │ │ │ │ -860 (old->global() == added->global() │ │ │ │ │ -861 && _L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r_<_T_L_>_:_:_c_o_m_p_a_r_e(old->local(),added->local()))) │ │ │ │ │ -862 { │ │ │ │ │ -863 tempPairs.push_back(*old); │ │ │ │ │ -864 old.eraseToHere(); │ │ │ │ │ -865 continue; │ │ │ │ │ -866 }else │ │ │ │ │ -867 { │ │ │ │ │ -868 tempPairs.push_back(*added); │ │ │ │ │ -869 added.eraseToHere(); │ │ │ │ │ -870 } │ │ │ │ │ -871 } │ │ │ │ │ -872 } │ │ │ │ │ -873 │ │ │ │ │ -874 while(old != endold) │ │ │ │ │ -875 { │ │ │ │ │ -876 if(old->local().state()!=_D_E_L_E_T_E_D) { │ │ │ │ │ -877 tempPairs.push_back(*old); │ │ │ │ │ -878 } │ │ │ │ │ -879 old.eraseToHere(); │ │ │ │ │ -880 } │ │ │ │ │ -881 │ │ │ │ │ -882 while(added!= endadded) │ │ │ │ │ -883 { │ │ │ │ │ -884 tempPairs.push_back(*added); │ │ │ │ │ -885 added.eraseToHere(); │ │ │ │ │ -886 } │ │ │ │ │ -887 localIndices_ = tempPairs; │ │ │ │ │ -888 } │ │ │ │ │ -889 } │ │ │ │ │ -890 │ │ │ │ │ -891 │ │ │ │ │ -892 template │ │ │ │ │ -893 inline const IndexPair& │ │ │ │ │ -894 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_a_t(const TG& global) const │ │ │ │ │ -895 { │ │ │ │ │ -896 // perform a binary search │ │ │ │ │ -897 int low=0, high=localIndices_.size()-1, probe=-1; │ │ │ │ │ -898 │ │ │ │ │ -899 while(low │ │ │ │ │ -918 inline const IndexPair& │ │ │ │ │ -919 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_o_p_e_r_a_t_o_r_[_](const TG& global) const │ │ │ │ │ -920 { │ │ │ │ │ -921 // perform a binary search │ │ │ │ │ -922 int low=0, high=localIndices_.size()-1, probe=-1; │ │ │ │ │ -923 │ │ │ │ │ -924 while(low │ │ │ │ │ -936 inline IndexPair& _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_a_t(const TG& global) │ │ │ │ │ -937 { │ │ │ │ │ -938 // perform a binary search │ │ │ │ │ -939 int low=0, high=localIndices_.size()-1, probe=-1; │ │ │ │ │ -940 │ │ │ │ │ -941 while(low= global) │ │ │ │ │ -945 high = probe; │ │ │ │ │ -946 else │ │ │ │ │ -947 low = probe+1; │ │ │ │ │ -948 } │ │ │ │ │ -949 │ │ │ │ │ -950 if(probe==-1) │ │ │ │ │ -951 _D_U_N_E___T_H_R_O_W(RangeError, "No entries!"); │ │ │ │ │ -952 │ │ │ │ │ -953 if( localIndices_[low].global() != global) │ │ │ │ │ -954 _D_U_N_E___T_H_R_O_W(RangeError, "Could not find entry of "< │ │ │ │ │ -960 inline bool _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_e_x_i_s_t_s (const TG& global) const │ │ │ │ │ -961 { │ │ │ │ │ -962 // perform a binary search │ │ │ │ │ -963 int low=0, high=localIndices_.size()-1, probe=-1; │ │ │ │ │ -964 │ │ │ │ │ -965 while(low= global) │ │ │ │ │ -969 high = probe; │ │ │ │ │ -970 else │ │ │ │ │ -971 low = probe+1; │ │ │ │ │ -972 } │ │ │ │ │ -973 │ │ │ │ │ -974 if(probe==-1) │ │ │ │ │ -975 return false; │ │ │ │ │ -976 │ │ │ │ │ -977 if( localIndices_[low].global() != global) │ │ │ │ │ -978 return false; │ │ │ │ │ -979 return true; │ │ │ │ │ -980 } │ │ │ │ │ -981 │ │ │ │ │ -982 template │ │ │ │ │ -983 inline IndexPair& _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_o_p_e_r_a_t_o_r_[_](const TG& │ │ │ │ │ -global) │ │ │ │ │ -984 { │ │ │ │ │ -985 // perform a binary search │ │ │ │ │ -986 int low=0, high=localIndices_.size()-1, probe=-1; │ │ │ │ │ -987 │ │ │ │ │ -988 while(low= global) │ │ │ │ │ -992 high = probe; │ │ │ │ │ -993 else │ │ │ │ │ -994 low = probe+1; │ │ │ │ │ -995 } │ │ │ │ │ -996 │ │ │ │ │ -997 return localIndices_[low]; │ │ │ │ │ -998 } │ │ │ │ │ -999 template │ │ │ │ │ -1000 inline typename ParallelIndexSet::iterator │ │ │ │ │ -1001 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_b_e_g_i_n() │ │ │ │ │ -1002 { │ │ │ │ │ -1003 return iterator(*this, localIndices_.begin()); │ │ │ │ │ -1004 } │ │ │ │ │ -1005 │ │ │ │ │ -1006 │ │ │ │ │ -1007 template │ │ │ │ │ -1008 inline typename ParallelIndexSet::iterator │ │ │ │ │ -1009 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_e_n_d() │ │ │ │ │ -1010 { │ │ │ │ │ -1011 return iterator(*this,localIndices_.end()); │ │ │ │ │ -1012 } │ │ │ │ │ -1013 │ │ │ │ │ -1014 template │ │ │ │ │ -1015 inline typename ParallelIndexSet::const_iterator │ │ │ │ │ -1016 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_b_e_g_i_n() const │ │ │ │ │ -1017 { │ │ │ │ │ -1018 return localIndices_.begin(); │ │ │ │ │ -1019 } │ │ │ │ │ -1020 │ │ │ │ │ -1021 │ │ │ │ │ -1022 template │ │ │ │ │ -1023 inline typename ParallelIndexSet::const_iterator │ │ │ │ │ -1024 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_e_n_d() const │ │ │ │ │ -1025 { │ │ │ │ │ -1026 return localIndices_.end(); │ │ │ │ │ -1027 } │ │ │ │ │ -1028 │ │ │ │ │ -1029 template │ │ │ │ │ -1030 void _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_r_e_n_u_m_b_e_r_L_o_c_a_l(){ │ │ │ │ │ -1031#ifndef NDEBUG │ │ │ │ │ -1032 if(state_==_R_E_S_I_Z_E) │ │ │ │ │ -1033 _D_U_N_E___T_H_R_O_W(InvalidIndexSetState, "IndexSet has to be in " │ │ │ │ │ -1034 <<"GROUND state for renumberLocal()"); │ │ │ │ │ -1035#endif │ │ │ │ │ -1036 │ │ │ │ │ -1037 const auto end_ = end(); │ │ │ │ │ -1038 uint32_t index=0; │ │ │ │ │ -1039 │ │ │ │ │ -1040 for(auto pair=begin(); pair!=end_; index++, ++pair) │ │ │ │ │ -1041 pair->local()=index; │ │ │ │ │ -1042 } │ │ │ │ │ -1043 │ │ │ │ │ -1044 template │ │ │ │ │ -1045 inline int _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_s_e_q_N_o() const │ │ │ │ │ -1046 { │ │ │ │ │ -1047 return seqNo_; │ │ │ │ │ -1048 } │ │ │ │ │ -1049 │ │ │ │ │ -1050 template │ │ │ │ │ -1051 inline size_t _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_,_T_L_,_N_>_:_:_s_i_z_e() const │ │ │ │ │ -1052 { │ │ │ │ │ -1053 return localIndices_.size(); │ │ │ │ │ -1054 } │ │ │ │ │ -1055 │ │ │ │ │ -1056 template │ │ │ │ │ -1057 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t(const I& indexset, │ │ │ │ │ -1058 std::size_t _s_i_z_e) │ │ │ │ │ -1059 : indexSet_(indexset), size_(_s_i_z_e), │ │ │ │ │ -1060 indices_(size_, static_cast(0)) │ │ │ │ │ -1061 { │ │ │ │ │ -1062 const_iterator end_ = indexSet_.end(); │ │ │ │ │ -1063 │ │ │ │ │ -1064 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) { │ │ │ │ │ -1065 assert(pair->local()local()] = &(*pair); │ │ │ │ │ -1067 } │ │ │ │ │ -1068 } │ │ │ │ │ -1069 │ │ │ │ │ -1070 template │ │ │ │ │ -1071 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t(const I& indexset) │ │ │ │ │ -1072 : indexSet_(indexset), size_(0) │ │ │ │ │ -1073 { │ │ │ │ │ -1074 const_iterator end_ = indexSet_.end(); │ │ │ │ │ -1075 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) │ │ │ │ │ -1076 size_=std::max(size_,static_cast(pair->local())); │ │ │ │ │ -1077 │ │ │ │ │ -1078 indices_.resize(++size_, 0); │ │ │ │ │ -1079 │ │ │ │ │ -1080 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) │ │ │ │ │ -1081 indices_[pair->local()] = &(*pair); │ │ │ │ │ -1082 } │ │ │ │ │ -1083 │ │ │ │ │ -1084 template │ │ │ │ │ -1085 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_~_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t() │ │ │ │ │ -1086 {} │ │ │ │ │ -1087 │ │ │ │ │ -1088 template │ │ │ │ │ -1089 inline const IndexPair* │ │ │ │ │ -1090 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_p_a_i_r(const std::size_t& local) const │ │ │ │ │ -1091 { │ │ │ │ │ -1092 return indices_[local]; │ │ │ │ │ -1093 } │ │ │ │ │ -1094 │ │ │ │ │ -1095 template │ │ │ │ │ -1096 inline const IndexPair& │ │ │ │ │ -1097 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_o_p_e_r_a_t_o_r_[_](const GlobalIndex& global) const │ │ │ │ │ -1098 { │ │ │ │ │ -1099 return indexSet_[global]; │ │ │ │ │ -1100 } │ │ │ │ │ -1101 │ │ │ │ │ -1102 template │ │ │ │ │ -1103 typename I::const_iterator _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_b_e_g_i_n() const │ │ │ │ │ -1104 { │ │ │ │ │ -1105 return indexSet_.begin(); │ │ │ │ │ -1106 } │ │ │ │ │ -1107 │ │ │ │ │ -1108 template │ │ │ │ │ -1109 typename I::const_iterator _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_e_n_d() const │ │ │ │ │ -1110 { │ │ │ │ │ -1111 return indexSet_.end(); │ │ │ │ │ -1112 } │ │ │ │ │ -1113 │ │ │ │ │ -1114 template │ │ │ │ │ -1115 inline size_t _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_s_i_z_e() const │ │ │ │ │ -1116 { │ │ │ │ │ -1117 return size_; │ │ │ │ │ -1118 } │ │ │ │ │ -1119 │ │ │ │ │ -1120 template │ │ │ │ │ -1121 inline int _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_<_I_>_:_:_s_e_q_N_o() const │ │ │ │ │ -1122 { │ │ │ │ │ -1123 return indexSet_.seqNo(); │ │ │ │ │ -1124 } │ │ │ │ │ -1125 │ │ │ │ │ -1126 template │ │ │ │ │ -1127 bool _o_p_e_r_a_t_o_r_=_=(const ParallelIndexSet& idxset, │ │ │ │ │ -1128 const ParallelIndexSet& idxset1) │ │ │ │ │ -1129 { │ │ │ │ │ -1130 if(idxset.size()!=idxset1.size()) │ │ │ │ │ -1131 return false; │ │ │ │ │ -1132 typedef typename ParallelIndexSet::const_iterator Iter; │ │ │ │ │ -1133 typedef typename _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_<_T_G_1_,_T_L_1_,_N_1_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iter1; │ │ │ │ │ -1134 Iter iter=idxset.begin(); │ │ │ │ │ -1135 for(Iter1 iter1=idxset1.begin(); iter1 != idxset1.end(); ++iter, ++iter1) │ │ │ │ │ -{ │ │ │ │ │ -1136 if(iter1->global()!=iter->global()) │ │ │ │ │ -1137 return false; │ │ │ │ │ -1138 typedef typename ParallelIndexSet::LocalIndex PI; │ │ │ │ │ -1139 const PI& pi=iter->local(), pi1=iter1->local(); │ │ │ │ │ -1140 │ │ │ │ │ -1141 if(pi!=pi1) │ │ │ │ │ -1142 return false; │ │ │ │ │ -1143 } │ │ │ │ │ -1144 return true; │ │ │ │ │ -1145 } │ │ │ │ │ -1146 │ │ │ │ │ -1147 template │ │ │ │ │ -1148 bool _o_p_e_r_a_t_o_r_!_=(const ParallelIndexSet& idxset, │ │ │ │ │ -1149 const ParallelIndexSet& idxset1) │ │ │ │ │ -1150 { │ │ │ │ │ -1151 return !(idxset==idxset1); │ │ │ │ │ -1152 } │ │ │ │ │ -1153 │ │ │ │ │ -1154 │ │ │ │ │ -1155#endif // DOXYGEN │ │ │ │ │ -1156 │ │ │ │ │ -1157} │ │ │ │ │ -1158 │ │ │ │ │ -1159#endif // DUNE_COMMON_PARALLEL_INDEXSET_HH │ │ │ │ │ -_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. │ │ │ │ │ -_a_r_r_a_y_l_i_s_t_._h_h │ │ │ │ │ -Implements a random-access container that can efficiently change size (similar │ │ │ │ │ -to std::deque) │ │ │ │ │ -_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_<_< │ │ │ │ │ -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_:_:_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:638 │ │ │ │ │ -_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:684 │ │ │ │ │ -_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:661 │ │ │ │ │ -_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:238 │ │ │ │ │ -_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:706 │ │ │ │ │ -_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:260 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -IndexPair & operator[](const GlobalIndex &global) │ │ │ │ │ -Find the index pair with a specific global id. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_a_r_r_a_y_S_i_z_e │ │ │ │ │ -static constexpr int arraySize │ │ │ │ │ -The size of the individual arrays in the underlying ArrayList. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:252 │ │ │ │ │ -_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_R_e_s_i_z_e │ │ │ │ │ -void beginResize() │ │ │ │ │ -Indicate that the index set is to be resized. │ │ │ │ │ -_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 │ │ │ │ │ -ParallelIndexSetState │ │ │ │ │ -The states the index set can be in. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:181 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_r_e_n_u_m_b_e_r_L_o_c_a_l │ │ │ │ │ -void renumberLocal() │ │ │ │ │ -Renumbers the local index numbers. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_e_x_i_s_t_s │ │ │ │ │ -bool exists(const GlobalIndex &global) const │ │ │ │ │ -Find the index pair with a specific global id. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_s_i_z_e │ │ │ │ │ -size_t size() const │ │ │ │ │ -Get the total number (public and nonpublic) indices. │ │ │ │ │ -_D_u_n_e_:_:_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 │ │ │ │ │ -ArrayList< IndexPair, N >::const_iterator const_iterator │ │ │ │ │ -The constant iterator over the pairs. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:296 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_S_e_t_S_o_r_t_F_u_n_c_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -bool operator()(const IndexPair< TG, TL > &i1, const IndexPair< TG, TL > &i2) │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:625 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_a_d_d │ │ │ │ │ -void add(const GlobalIndex &global) │ │ │ │ │ -Add an new index to the set. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -Get an iterator over the indices positioned after the last index. │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_l_o_c_a_l │ │ │ │ │ -const LocalIndex & local() const │ │ │ │ │ -Get the local index. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_a_t │ │ │ │ │ -const IndexPair & at(const GlobalIndex &global) const │ │ │ │ │ -Find the index pair with a specific global id. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -GlobalLookupIndexSet(const ParallelIndexSet &indexset) │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -TL LocalIndex │ │ │ │ │ -the type of the local index. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_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_:_:_L_o_c_a_l_I_n_d_e_x_C_o_m_p_a_r_a_t_o_r_:_:_c_o_m_p_a_r_e │ │ │ │ │ -static bool compare(const T &t1, const T &t2) │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:616 │ │ │ │ │ -_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_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ -Dune::IndexPair< typename I::GlobalIndex, typename I::LocalIndex > IndexPair │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:529 │ │ │ │ │ -_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_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -ParallelIndexSet::const_iterator const_iterator │ │ │ │ │ -The iterator over the index pairs. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:527 │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_b_e_g_i_n │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -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_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -const IndexPair & operator[](const GlobalIndex &global) const │ │ │ │ │ -Find the index pair with a specific global id. │ │ │ │ │ -_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 │ │ │ │ │ -const ParallelIndexSetState & state() │ │ │ │ │ -Get the state the index set is in. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:307 │ │ │ │ │ -_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 │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -Get an iterator over the indices positioned at the first index. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -const IndexPair & operator[](const GlobalIndex &global) const │ │ │ │ │ -Find the index pair with a specific global id. │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ -IndexPair() │ │ │ │ │ -Construct a new Pair. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -I ParallelIndexSet │ │ │ │ │ -The type of the index set. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:512 │ │ │ │ │ -_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_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_m_a_r_k_A_s_D_e_l_e_t_e_d │ │ │ │ │ -void markAsDeleted(const iterator &position) │ │ │ │ │ -Mark an index as deleted. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ │ -The type of the local index. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:517 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ -IndexPair(const GlobalIndex &global, const LocalIndex &local) │ │ │ │ │ -Constructs a new Pair. │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_s_e_t_L_o_c_a_l │ │ │ │ │ -void setLocal(int index) │ │ │ │ │ -Set the local index. │ │ │ │ │ -_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_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_a_d_d │ │ │ │ │ -void add(const GlobalIndex &global, const LocalIndex &local) │ │ │ │ │ -Add an new index to the set. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -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_:_:_a_t │ │ │ │ │ -IndexPair & at(const GlobalIndex &global) │ │ │ │ │ -Find the index pair with a specific global id. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -ParallelIndexSet() │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_e_n_d_R_e_s_i_z_e │ │ │ │ │ -void endResize() │ │ │ │ │ -Indicate that the resizing finishes. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_~_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -~GlobalLookupIndexSet() │ │ │ │ │ -Destructor. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_p_a_i_r │ │ │ │ │ -const IndexPair * pair(const std::size_t &local) const │ │ │ │ │ -Get the index pair corresponding to a local 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_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_s_i_z_e │ │ │ │ │ -size_t size() const │ │ │ │ │ -Get the total number (public and nonpublic) indices. │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_P_a_i_r_:_:_I_n_d_e_x_P_a_i_r │ │ │ │ │ -IndexPair(const GlobalIndex &global) │ │ │ │ │ -Constructs a new Pair. │ │ │ │ │ -_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_:_:_I_n_d_e_x_P_a_i_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -TG GlobalIndex │ │ │ │ │ -the type of the global index. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:107 │ │ │ │ │ -_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_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_i_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -iterator(ParallelIndexSet< TG, TL, N > &indexSet, const Father &father) │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:262 │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -GlobalLookupIndexSet(const ParallelIndexSet &indexset, std::size_t size) │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ │ -The type of the global index. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:522 │ │ │ │ │ -_D_u_n_e_:_:_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 │ │ │ │ │ -Dune::IndexPair< GlobalIndex, LocalIndex > IndexPair │ │ │ │ │ -The type of the pair stored. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:244 │ │ │ │ │ -_D_u_n_e_:_:_R_E_S_I_Z_E │ │ │ │ │ -@ RESIZE │ │ │ │ │ -Indicates that the index set is currently being resized. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:190 │ │ │ │ │ -_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_E_L_E_T_E_D │ │ │ │ │ -@ DELETED │ │ │ │ │ -DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ +87 template │ │ │ │ │ +88 auto │ │ │ │ │ +_8_9 _d_o_t_T(const A & a, const B & b) -> decltype(a*b) │ │ │ │ │ +90 { │ │ │ │ │ +91 return a*b; │ │ │ │ │ +92 } │ │ │ │ │ +93 │ │ │ │ │ +95} // end namespace DUNE │ │ │ │ │ +96 │ │ │ │ │ +97#endif // DUNE_DOTPRODUCT_HH │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_f_t_r_a_i_t_s_._h_h │ │ │ │ │ +Type traits to determine the type of reals (when working with complex numbers) │ │ │ │ │ +_D_u_n_e_:_:_d_o_t_T │ │ │ │ │ +auto dotT(const A &a, const B &b) -> decltype(a *b) │ │ │ │ │ +Computes an indefinite vector dot product for fundamental data types according │ │ │ │ │ +to Petsc's VectTDot fu... │ │ │ │ │ +DDeeffiinniittiioonn dotproduct.hh:89 │ │ │ │ │ +_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_:_:_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_:_:_s_i_z_e │ │ │ │ │ -constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std:: │ │ │ │ │ -integer_sequence< T, II... >) │ │ │ │ │ -Return the size of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn integersequence.hh:75 │ │ │ │ │ -_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_:_:_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:368 │ │ │ │ │ -_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_:_:_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_:_:_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_:_:_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_:_:_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_<_ _A_r_r_a_y_L_i_s_t_I_t_e_r_a_t_o_r_<_ _T_,_ _N_,_ _A_ _>_,_ _A_:_:_v_a_l_u_e___t_y_p_e_, │ │ │ │ │ -_A_:_:_v_a_l_u_e___t_y_p_e_ _&_,_ _A_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e_ _>_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -Reference operator*() const │ │ │ │ │ -Dereferencing operator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:501 │ │ │ │ │ -_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_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -Decorates an index set with the possibility to find a global index that is │ │ │ │ │ -mapped to a specific local... │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:507 │ │ │ │ │ -_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_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -The iterator over the pairs. │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:257 │ │ │ │ │ -_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_:_:_I_n_d_e_x_S_e_t_S_o_r_t_F_u_n_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn indexset.hh:624 │ │ │ │ │ +_D_u_n_e_:_:_I_s_V_e_c_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn dotproduct.hh:27 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: plocalindex.hh File Reference │ │ │ │ +dune-common: copyableoptional.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,68 +65,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ +
copyableoptional.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <iostream>
│ │ │ │ -#include <mpi.h>
│ │ │ │ -#include <dune/common/parallel/indexset.hh>
│ │ │ │ -#include <dune/common/parallel/localindex.hh>
│ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ +
#include <cassert>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <optional>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#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::LocalIndexComparator< ParallelLocalIndex< T > >
 
class  Dune::MPITraits< ParallelLocalIndex< T > >
class  Dune::CopyableOptional< Type >
 A copyable type wrapper that provides copy/move assignment operations for types that are only copy/move constructible. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -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,52 +1,26 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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_._._. │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +copyableoptional.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#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_/_l_o_c_a_l_i_n_d_e_x_._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 │ │ │ │ │ +#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 │ │ │ │ │ - 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_ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_<_ _T_y_p_e_ _> │ │ │ │ │ +  A copyable type wrapper that provides copy/move assignment operations │ │ │ │ │ + for types that are only copy/move constructible. _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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: plocalindex.hh Source File │ │ │ │ +dune-common: copyableoptional.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,309 +70,173 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
plocalindex.hh
│ │ │ │ +
copyableoptional.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 © 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_PLOCALINDEX_HH
│ │ │ │ -
6#define DUNE_COMMON_PARALLEL_PLOCALINDEX_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_COPYABLE_OPTIONAL_HH
│ │ │ │ +
6#define DUNE_COMMON_COPYABLE_OPTIONAL_HH
│ │ │ │
7
│ │ │ │ -
8#include <iostream>
│ │ │ │ -
9
│ │ │ │ -
10#if HAVE_MPI
│ │ │ │ -
11#include <mpi.h>
│ │ │ │ -
12#endif
│ │ │ │ +
8#include <cassert>
│ │ │ │ +
9#include <iostream>
│ │ │ │ +
10#include <memory>
│ │ │ │ +
11#include <optional>
│ │ │ │ +
12#include <type_traits>
│ │ │ │
13
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ +
15
│ │ │ │ +
16namespace Dune {
│ │ │ │
17
│ │ │ │ -
18namespace Dune
│ │ │ │ -
19{
│ │ │ │ -
20
│ │ │ │ -
21
│ │ │ │ -
32 template<class T> class ParallelLocalIndex;
│ │ │ │ -
33
│ │ │ │ -
39 template<class T>
│ │ │ │ -
│ │ │ │ -
40 std::ostream& operator<<(std::ostream& os, const ParallelLocalIndex<T>& index)
│ │ │ │ -
41 {
│ │ │ │ -
42 os<<"{local="<<index.localIndex_<<", attr="<<T(index.attribute_)<<", public="
│ │ │ │ -
43 <<(index.public_ ? true : false)<<"}";
│ │ │ │ -
44 return os;
│ │ │ │ -
45 }
│ │ │ │ -
│ │ │ │ -
46
│ │ │ │ -
50 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
52 {
│ │ │ │ -
53#if HAVE_MPI
│ │ │ │ -
54 // friend declaration needed for MPITraits
│ │ │ │ -
55 friend struct MPITraits<ParallelLocalIndex<T> >;
│ │ │ │ -
56#endif
│ │ │ │ -
57 friend std::ostream& operator<< <>(std::ostream& os, const ParallelLocalIndex<T>& index);
│ │ │ │ -
58
│ │ │ │ -
59 public:
│ │ │ │ -
67 typedef T Attribute;
│ │ │ │ - │ │ │ │ -
77
│ │ │ │ -
86 ParallelLocalIndex(size_t localIndex, const Attribute& attribute, bool isPublic=true);
│ │ │ │ - │ │ │ │ -
93
│ │ │ │ -
94#if 0
│ │ │ │ - │ │ │ │ -
105#endif
│ │ │ │ -
106
│ │ │ │ -
111 inline const Attribute attribute() const;
│ │ │ │ -
112
│ │ │ │ -
117 inline void setAttribute(const Attribute& attribute);
│ │ │ │ -
118
│ │ │ │ -
123 inline size_t local() const;
│ │ │ │ -
124
│ │ │ │ -
128 inline operator size_t() const;
│ │ │ │ -
129
│ │ │ │ -
135 inline ParallelLocalIndex<Attribute>& operator=(size_t index);
│ │ │ │ -
136
│ │ │ │ -
141 inline bool isPublic() const;
│ │ │ │ -
142
│ │ │ │ -
147 inline LocalIndexState state() const;
│ │ │ │ -
148
│ │ │ │ -
153 inline void setState(const LocalIndexState& state);
│ │ │ │ +
32template <class Type>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
34 : public std::optional<Type>
│ │ │ │ +
35{
│ │ │ │ +
36 static_assert(std::is_copy_constructible_v<Type>);
│ │ │ │ +
37 static_assert(std::is_object_v<Type>);
│ │ │ │ +
38
│ │ │ │ +
39 using Base = std::optional<Type>;
│ │ │ │ +
40
│ │ │ │ +
41public:
│ │ │ │ +
42
│ │ │ │ +
47 template <class T = Type,
│ │ │ │ +
48 std::enable_if_t<std::is_default_constructible_v<T>, int> = 0>
│ │ │ │ +
│ │ │ │ +
49 constexpr CopyableOptional ()
│ │ │ │ +
50 noexcept(std::is_nothrow_default_constructible_v<T>)
│ │ │ │ +
51 : Base{std::in_place}
│ │ │ │ +
52 {}
│ │ │ │ +
│ │ │ │ +
53
│ │ │ │ +
58 template <class T = Type,
│ │ │ │ +
59 disableCopyMove<CopyableOptional,T> = 0,
│ │ │ │ +
60 std::enable_if_t<std::is_constructible_v<Type,T&&>, int> = 0,
│ │ │ │ +
61 std::enable_if_t<std::is_convertible_v<T&&,Type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
62 constexpr CopyableOptional (T&& value)
│ │ │ │ +
63 noexcept(std::is_nothrow_constructible_v<Type,T&&>)
│ │ │ │ +
64 : Base{std::in_place, std::forward<T>(value)}
│ │ │ │ +
65 {}
│ │ │ │ +
│ │ │ │ +
66
│ │ │ │ +
71 template <class T = Type,
│ │ │ │ + │ │ │ │ +
73 std::enable_if_t<std::is_constructible_v<Type,T&&>, int> = 0,
│ │ │ │ +
74 std::enable_if_t<not std::is_convertible_v<T&&,Type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
75 explicit constexpr CopyableOptional (T&& value)
│ │ │ │ +
76 noexcept(std::is_nothrow_constructible_v<Type,T&&>)
│ │ │ │ +
77 : Base{std::in_place, std::forward<T>(value)}
│ │ │ │ +
78 {}
│ │ │ │ +
│ │ │ │ +
79
│ │ │ │ +
81 template <class... Args,
│ │ │ │ + │ │ │ │ +
83 std::enable_if_t<(sizeof...(Args) > 1), int> = 0,
│ │ │ │ +
84 std::enable_if_t<std::is_constructible_v<Type,Args&&...>, int> = 0>
│ │ │ │ +
│ │ │ │ +
85 constexpr CopyableOptional (Args&&... args)
│ │ │ │ +
86 noexcept(std::is_nothrow_constructible_v<Type,Args&&...>)
│ │ │ │ +
87 : Base{std::in_place, std::forward<Args>(args)...}
│ │ │ │ +
88 {}
│ │ │ │ +
│ │ │ │ +
89
│ │ │ │ +
91 constexpr CopyableOptional (const CopyableOptional&) = default;
│ │ │ │ +
92
│ │ │ │ +
94 constexpr CopyableOptional (CopyableOptional&&) = default;
│ │ │ │ +
95
│ │ │ │ +
97 ~CopyableOptional () = default;
│ │ │ │ +
98
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
101 noexcept(std::is_nothrow_copy_assignable_v<Type> ||
│ │ │ │ +
102 (!std::is_copy_assignable_v<Type> && std::is_nothrow_copy_constructible_v<Type>))
│ │ │ │ +
103 {
│ │ │ │ +
104 if constexpr(std::is_copy_assignable_v<Type>)
│ │ │ │ +
105 Base::operator=(that);
│ │ │ │ +
106 else {
│ │ │ │ +
107 // no self-assignment
│ │ │ │ +
108 if (this != std::addressof(that)) {
│ │ │ │ +
109 if (that)
│ │ │ │ +
110 Base::emplace(*that);
│ │ │ │ +
111 else
│ │ │ │ +
112 Base::reset();
│ │ │ │ +
113 }
│ │ │ │ +
114 }
│ │ │ │ +
115 return *this;
│ │ │ │ +
116 }
│ │ │ │ +
│ │ │ │ +
117
│ │ │ │ +
119 template <class T = Type,
│ │ │ │ +
120 std::enable_if_t<std::is_move_constructible_v<T>, int> = 0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
122 noexcept(std::is_nothrow_move_assignable_v<Type> ||
│ │ │ │ +
123 (!std::is_move_assignable_v<Type> && std::is_nothrow_move_constructible_v<Type>))
│ │ │ │ +
124 {
│ │ │ │ +
125 if constexpr(std::is_move_assignable_v<Type>)
│ │ │ │ +
126 Base::operator=(std::move(that));
│ │ │ │ +
127 else {
│ │ │ │ +
128 // no self-assignment
│ │ │ │ +
129 if (this != std::addressof(that)) {
│ │ │ │ +
130 if (that)
│ │ │ │ +
131 Base::emplace(std::move(*that));
│ │ │ │ +
132 else
│ │ │ │ +
133 Base::reset();
│ │ │ │ +
134 }
│ │ │ │ +
135 }
│ │ │ │ +
136 return *this;
│ │ │ │ +
137 }
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
140 template <class T = Type,
│ │ │ │ +
141 std::enable_if_t<not std::is_same_v<std::decay_t<T>, CopyableOptional>, int> = 0,
│ │ │ │ +
142 std::enable_if_t<(std::is_assignable_v<Type&,T> || std::is_constructible_v<Type,T>), int> = 0>
│ │ │ │ +
│ │ │ │ +
143 constexpr CopyableOptional& operator= (T&& value)
│ │ │ │ +
144 noexcept(std::is_nothrow_assignable_v<Type&,T> ||
│ │ │ │ +
145 (!std::is_assignable_v<Type&,T> && std::is_nothrow_constructible_v<Type,T>))
│ │ │ │ +
146 {
│ │ │ │ +
147 if constexpr(std::is_assignable_v<Type&,T>)
│ │ │ │ +
148 Base::operator=(std::forward<T>(value));
│ │ │ │ +
149 else
│ │ │ │ +
150 Base::emplace(std::forward<T>(value));
│ │ │ │ +
151 return *this;
│ │ │ │ +
152 }
│ │ │ │ +
│ │ │ │ +
153};
│ │ │ │ +
│ │ │ │
154
│ │ │ │ -
155 private:
│ │ │ │ -
157 size_t localIndex_;
│ │ │ │ -
158
│ │ │ │ -
160 char attribute_;
│ │ │ │ -
161
│ │ │ │ -
163 char public_;
│ │ │ │ -
164
│ │ │ │ -
171 char state_;
│ │ │ │ -
172
│ │ │ │ -
173 };
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
175 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
177 const ParallelLocalIndex<T>& p2)
│ │ │ │ -
178 {
│ │ │ │ -
179 if(p1.local()!=p2.local())
│ │ │ │ -
180 return false;
│ │ │ │ -
181 if(p1.attribute()!=p2.attribute())
│ │ │ │ -
182 return false;
│ │ │ │ -
183 if(p1.isPublic()!=p2.isPublic())
│ │ │ │ -
184 return false;
│ │ │ │ -
185 return true;
│ │ │ │ -
186 }
│ │ │ │ -
│ │ │ │ -
187 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
189 const ParallelLocalIndex<T>& p2)
│ │ │ │ -
190 {
│ │ │ │ -
191 return !(p1==p2);
│ │ │ │ -
192 }
│ │ │ │ -
│ │ │ │ -
193
│ │ │ │ -
194
│ │ │ │ -
195 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
197 {
│ │ │ │ -
│ │ │ │ -
198 static bool compare(const ParallelLocalIndex<T>& t1,
│ │ │ │ -
199 const ParallelLocalIndex<T>& t2){
│ │ │ │ -
200 return t1.attribute()<t2.attribute();
│ │ │ │ -
201 }
│ │ │ │ -
│ │ │ │ -
202 };
│ │ │ │ -
│ │ │ │ -
203
│ │ │ │ -
204
│ │ │ │ -
205#if HAVE_MPI
│ │ │ │ -
206
│ │ │ │ -
208 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
210 {
│ │ │ │ -
211 public:
│ │ │ │ -
212 static MPI_Datatype getType();
│ │ │ │ -
213 private:
│ │ │ │ -
214 static MPI_Datatype type;
│ │ │ │ -
215
│ │ │ │ -
216 };
│ │ │ │ -
│ │ │ │ -
217
│ │ │ │ -
218#endif
│ │ │ │ -
219
│ │ │ │ -
220 template<class T>
│ │ │ │ -
│ │ │ │ -
221 ParallelLocalIndex<T>::ParallelLocalIndex(const T& attribute, bool isPublic)
│ │ │ │ -
222 : localIndex_(0), attribute_(static_cast<char>(attribute)),
│ │ │ │ -
223 public_(static_cast<char>(isPublic)), state_(static_cast<char>(VALID))
│ │ │ │ -
224 {}
│ │ │ │ -
│ │ │ │ -
225
│ │ │ │ -
226
│ │ │ │ -
227 template<class T>
│ │ │ │ -
│ │ │ │ -
228 ParallelLocalIndex<T>::ParallelLocalIndex(size_t local, const T& attribute, bool isPublic)
│ │ │ │ -
229 : localIndex_(local), attribute_(static_cast<char>(attribute)),
│ │ │ │ -
230 public_(static_cast<char>(isPublic)), state_(static_cast<char>(VALID))
│ │ │ │ -
231 {}
│ │ │ │ -
│ │ │ │ -
232
│ │ │ │ -
233 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
235 : localIndex_(0), attribute_(), public_(static_cast<char>(false)),
│ │ │ │ -
236 state_(static_cast<char>(VALID))
│ │ │ │ -
237 {}
│ │ │ │ -
│ │ │ │ -
238
│ │ │ │ -
239 template<class T>
│ │ │ │ -
│ │ │ │ -
240 inline const T ParallelLocalIndex<T>::attribute() const
│ │ │ │ -
241 {
│ │ │ │ -
242 return T(attribute_);
│ │ │ │ -
243 }
│ │ │ │ -
│ │ │ │ -
244
│ │ │ │ -
245 template<class T>
│ │ │ │ -
246 inline void
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
248 {
│ │ │ │ -
249 attribute_ = attribute;
│ │ │ │ -
250 }
│ │ │ │ -
│ │ │ │ -
251
│ │ │ │ -
252 template<class T>
│ │ │ │ -
│ │ │ │ -
253 inline size_t ParallelLocalIndex<T>::local() const
│ │ │ │ -
254 {
│ │ │ │ -
255 return localIndex_;
│ │ │ │ -
256 }
│ │ │ │ -
│ │ │ │ -
257
│ │ │ │ -
258 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
260 {
│ │ │ │ -
261 return localIndex_;
│ │ │ │ -
262 }
│ │ │ │ -
│ │ │ │ -
263
│ │ │ │ -
264 template<class T>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
267 {
│ │ │ │ -
268 localIndex_=index;
│ │ │ │ -
269 return *this;
│ │ │ │ -
270 }
│ │ │ │ -
│ │ │ │ -
271
│ │ │ │ -
272 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
274 {
│ │ │ │ -
275 return static_cast<bool>(public_);
│ │ │ │ -
276 }
│ │ │ │ -
│ │ │ │ -
277
│ │ │ │ -
278 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
280 {
│ │ │ │ -
281 return LocalIndexState(state_);
│ │ │ │ -
282 }
│ │ │ │ -
│ │ │ │ -
283
│ │ │ │ -
284 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
286 {
│ │ │ │ -
287 state_=static_cast<char>(state);
│ │ │ │ -
288 }
│ │ │ │ -
│ │ │ │ -
289
│ │ │ │ -
290#if HAVE_MPI
│ │ │ │ -
291
│ │ │ │ -
292 template<typename T>
│ │ │ │ -
│ │ │ │ -
293 MPI_Datatype MPITraits<ParallelLocalIndex<T> >::getType()
│ │ │ │ -
294 {
│ │ │ │ -
295
│ │ │ │ -
296 if(type==MPI_DATATYPE_NULL) {
│ │ │ │ -
297 int length = 1;
│ │ │ │ -
298 MPI_Aint base, disp;
│ │ │ │ -
299 MPI_Datatype types[1] = {MPITraits<char>::getType()};
│ │ │ │ - │ │ │ │ -
301 MPI_Get_address(&rep, &base);
│ │ │ │ -
302 MPI_Get_address(&(rep.attribute_), &disp);
│ │ │ │ -
303 disp -= base;
│ │ │ │ -
304
│ │ │ │ -
305 MPI_Datatype tmp;
│ │ │ │ -
306 MPI_Type_create_struct(1, &length, &disp, types, &tmp);
│ │ │ │ -
307
│ │ │ │ -
308 MPI_Type_create_resized(tmp, 0, sizeof(ParallelLocalIndex<T>), &type);
│ │ │ │ -
309 MPI_Type_commit(&type);
│ │ │ │ -
310
│ │ │ │ -
311 MPI_Type_free(&tmp);
│ │ │ │ -
312 }
│ │ │ │ -
313 return type;
│ │ │ │ -
314 }
│ │ │ │ -
│ │ │ │ -
315
│ │ │ │ -
316 template<typename T>
│ │ │ │ -
317 MPI_Datatype MPITraits<ParallelLocalIndex<T> >::type = MPI_DATATYPE_NULL;
│ │ │ │ -
318
│ │ │ │ -
319#endif // HAVE_MPI
│ │ │ │ -
320
│ │ │ │ -
321
│ │ │ │ -
323} // namespace Dune
│ │ │ │ -
324
│ │ │ │ -
325#endif // DUNE_COMMON_PARALLEL_PLOCALINDEX_HH
│ │ │ │ -
Provides a map between global and local indices.
│ │ │ │ -
Provides classes for use as the local index in ParallelIndexSet.
│ │ │ │ -
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ -
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:238
│ │ │ │ -
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:260
│ │ │ │ -
bool isPublic() const
Check whether the index might also be known other processes.
Definition plocalindex.hh:273
│ │ │ │ -
void setAttribute(const Attribute &attribute)
Set the attribute of the index.
Definition plocalindex.hh:247
│ │ │ │ -
size_t local() const
get the local index.
Definition plocalindex.hh:253
│ │ │ │ -
LocalIndexState
The states available for the local indices.
Definition localindex.hh:28
│ │ │ │ -
void setState(const LocalIndexState &state)
Set the state.
Definition plocalindex.hh:285
│ │ │ │ -
ParallelLocalIndex< Attribute > & operator=(size_t index)
Assign a new local index.
Definition plocalindex.hh:266
│ │ │ │ -
LocalIndexState state() const
Get the state.
Definition plocalindex.hh:279
│ │ │ │ -
ParallelLocalIndex()
Parameterless constructor.
Definition plocalindex.hh:234
│ │ │ │ -
const Attribute attribute() const
Get the attribute of the index.
Definition plocalindex.hh:240
│ │ │ │ -
@ VALID
Definition localindex.hh:28
│ │ │ │ +
155} // end namespace Dune
│ │ │ │ +
156
│ │ │ │ +
157#endif // DUNE_COMMON_COPYABLE_OPTIONAL_HH
│ │ │ │ +
Utilities for type computations, constraining overloads, ...
│ │ │ │ +
std::enable_if_t< not Impl::disableCopyMoveHelper< This, T... >::value, int > disableCopyMove
Helper to disable constructor as copy and move constructor.
Definition typeutilities.hh:45
│ │ │ │ +
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:52
│ │ │ │ -
T Attribute
The type of the attributes. Normally this will be an enumeration like.
Definition plocalindex.hh:67
│ │ │ │ -
static bool compare(const ParallelLocalIndex< T > &t1, const ParallelLocalIndex< T > &t2)
Definition plocalindex.hh:198
│ │ │ │ +
A copyable type wrapper that provides copy/move assignment operations for types that are only copy/mo...
Definition copyableoptional.hh:35
│ │ │ │ +
constexpr CopyableOptional(CopyableOptional &&)=default
Move construct the contained value.
│ │ │ │ +
constexpr CopyableOptional(T &&value) noexcept(std::is_nothrow_constructible_v< Type, T && >)
Construct the internal data from perfect forwarding of the passed arguments. Participates in overload...
Definition copyableoptional.hh:62
│ │ │ │ +
constexpr CopyableOptional & operator=(const CopyableOptional &that) noexcept(std::is_nothrow_copy_assignable_v< Type >||(!std::is_copy_assignable_v< Type > &&std::is_nothrow_copy_constructible_v< Type >))
Copy assignment in terms of copy constructor.
Definition copyableoptional.hh:100
│ │ │ │ +
constexpr CopyableOptional() noexcept(std::is_nothrow_default_constructible_v< T >)
Implementation of a default constructor, if the Type is itself default constructible....
Definition copyableoptional.hh:49
│ │ │ │ +
constexpr CopyableOptional(const CopyableOptional &)=default
Copy construct the contained value.
│ │ │ │ +
constexpr CopyableOptional(Args &&... args) noexcept(std::is_nothrow_constructible_v< Type, Args &&... >)
Construct the internal data from perfect forwarding of the passed arguments.
Definition copyableoptional.hh:85
│ │ │ │ +
~CopyableOptional()=default
Default destructor.
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,328 +1,188 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -plocalindex.hh │ │ │ │ │ +copyableoptional.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 © 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_PLOCALINDEX_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_PLOCALINDEX_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_COPYABLE_OPTIONAL_HH │ │ │ │ │ +6#define DUNE_COMMON_COPYABLE_OPTIONAL_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10#if HAVE_MPI │ │ │ │ │ -11#include │ │ │ │ │ -12#endif │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ 13 │ │ │ │ │ -14#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> │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_r_a_l_l_e_l_/_l_o_c_a_l_i_n_d_e_x_._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> │ │ │ │ │ +14#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> │ │ │ │ │ +15 │ │ │ │ │ +16namespace _D_u_n_e { │ │ │ │ │ 17 │ │ │ │ │ -18namespace _D_u_n_e │ │ │ │ │ -19{ │ │ │ │ │ -20 │ │ │ │ │ -21 │ │ │ │ │ -32 template class ParallelLocalIndex; │ │ │ │ │ -33 │ │ │ │ │ -39 template │ │ │ │ │ -_4_0 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) │ │ │ │ │ -41 { │ │ │ │ │ -42 os<<"{local="< │ │ │ │ │ -_5_1 class _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -52 { │ │ │ │ │ -53#if HAVE_MPI │ │ │ │ │ -54 // friend declaration needed for MPITraits │ │ │ │ │ -55 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 >; │ │ │ │ │ -56#endif │ │ │ │ │ -57 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); │ │ │ │ │ -58 │ │ │ │ │ -59 public: │ │ │ │ │ -_6_7 typedef T _A_t_t_r_i_b_u_t_e; │ │ │ │ │ -76 _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); │ │ │ │ │ -77 │ │ │ │ │ -86 _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); │ │ │ │ │ -92 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x(); │ │ │ │ │ -93 │ │ │ │ │ -94#if 0 │ │ │ │ │ -104 _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); │ │ │ │ │ -105#endif │ │ │ │ │ -106 │ │ │ │ │ -111 inline const _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() const; │ │ │ │ │ -112 │ │ │ │ │ -117 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); │ │ │ │ │ -118 │ │ │ │ │ -123 inline size_t _l_o_c_a_l() const; │ │ │ │ │ -124 │ │ │ │ │ -128 inline operator size_t() const; │ │ │ │ │ -129 │ │ │ │ │ -135 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); │ │ │ │ │ -136 │ │ │ │ │ -141 inline bool _i_s_P_u_b_l_i_c() const; │ │ │ │ │ -142 │ │ │ │ │ -147 inline _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e _s_t_a_t_e() const; │ │ │ │ │ -148 │ │ │ │ │ -153 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); │ │ │ │ │ +32template │ │ │ │ │ +_3_3class _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +34 : public std::optional │ │ │ │ │ +35{ │ │ │ │ │ +36 static_assert(std::is_copy_constructible_v); │ │ │ │ │ +37 static_assert(std::is_object_v); │ │ │ │ │ +38 │ │ │ │ │ +39 using Base = std::optional; │ │ │ │ │ +40 │ │ │ │ │ +41public: │ │ │ │ │ +42 │ │ │ │ │ +47 template , int> = 0> │ │ │ │ │ +_4_9 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l () │ │ │ │ │ +50 noexcept(_s_t_d::is_nothrow_default_constructible_v) │ │ │ │ │ +51 : Base{std::in_place} │ │ │ │ │ +52 {} │ │ │ │ │ +53 │ │ │ │ │ +58 template = 0, │ │ │ │ │ +60 std::enable_if_t, int> = 0, │ │ │ │ │ +61 std::enable_if_t, int> = 0> │ │ │ │ │ +_6_2 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l (T&& value) │ │ │ │ │ +63 noexcept(std::is_nothrow_constructible_v) │ │ │ │ │ +64 : Base{_s_t_d::in_place, _s_t_d::forward(value)} │ │ │ │ │ +65 {} │ │ │ │ │ +66 │ │ │ │ │ +71 template = 0, │ │ │ │ │ +73 std::enable_if_t, int> = 0, │ │ │ │ │ +74 std::enable_if_t, int> = 0> │ │ │ │ │ +_7_5 explicit constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l (T&& value) │ │ │ │ │ +76 noexcept(std::is_nothrow_constructible_v) │ │ │ │ │ +77 : Base{_s_t_d::in_place, _s_t_d::forward(value)} │ │ │ │ │ +78 {} │ │ │ │ │ +79 │ │ │ │ │ +81 template = 0, │ │ │ │ │ +83 std::enable_if_t<(sizeof...(Args) > 1), int> = 0, │ │ │ │ │ +84 std::enable_if_t, int> = 0> │ │ │ │ │ +_8_5 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l (Args&&... args) │ │ │ │ │ +86 noexcept(std::is_nothrow_constructible_v) │ │ │ │ │ +87 : Base{_s_t_d::in_place, _s_t_d::forward(args)...} │ │ │ │ │ +88 {} │ │ │ │ │ +89 │ │ │ │ │ +_9_1 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l (const _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l&) = default; │ │ │ │ │ +92 │ │ │ │ │ +_9_4 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l (_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l&&) = default; │ │ │ │ │ +95 │ │ │ │ │ +_9_7 _~_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l () = default; │ │ │ │ │ +98 │ │ │ │ │ +_1_0_0 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l& _o_p_e_r_a_t_o_r_=_ (const _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l& that) │ │ │ │ │ +101 noexcept(std::is_nothrow_copy_assignable_v || │ │ │ │ │ +102 (!std::is_copy_assignable_v && std:: │ │ │ │ │ +is_nothrow_copy_constructible_v)) │ │ │ │ │ +103 { │ │ │ │ │ +104 if constexpr(std::is_copy_assignable_v) │ │ │ │ │ +105 Base::operator=(that); │ │ │ │ │ +106 else { │ │ │ │ │ +107 // no self-assignment │ │ │ │ │ +108 if (this != std::addressof(that)) { │ │ │ │ │ +109 if (that) │ │ │ │ │ +110 Base::emplace(*that); │ │ │ │ │ +111 else │ │ │ │ │ +112 Base::reset(); │ │ │ │ │ +113 } │ │ │ │ │ +114 } │ │ │ │ │ +115 return *this; │ │ │ │ │ +116 } │ │ │ │ │ +117 │ │ │ │ │ +119 template , int> = 0> │ │ │ │ │ +_1_2_1 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l& _o_p_e_r_a_t_o_r_=_ (_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l&& that) │ │ │ │ │ +122 noexcept(std::is_nothrow_move_assignable_v || │ │ │ │ │ +123 (!std::is_move_assignable_v && std:: │ │ │ │ │ +is_nothrow_move_constructible_v)) │ │ │ │ │ +124 { │ │ │ │ │ +125 if constexpr(std::is_move_assignable_v) │ │ │ │ │ +126 Base::operator=(std::move(that)); │ │ │ │ │ +127 else { │ │ │ │ │ +128 // no self-assignment │ │ │ │ │ +129 if (this != std::addressof(that)) { │ │ │ │ │ +130 if (that) │ │ │ │ │ +131 Base::emplace(std::move(*that)); │ │ │ │ │ +132 else │ │ │ │ │ +133 Base::reset(); │ │ │ │ │ +134 } │ │ │ │ │ +135 } │ │ │ │ │ +136 return *this; │ │ │ │ │ +137 } │ │ │ │ │ +138 │ │ │ │ │ +140 template , _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l>, │ │ │ │ │ +int> = 0, │ │ │ │ │ +142 std::enable_if_t<(std::is_assignable_v || std:: │ │ │ │ │ +is_constructible_v), int> = 0> │ │ │ │ │ +_1_4_3 constexpr _C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l& operator= (T&& value) │ │ │ │ │ +144 noexcept(std::is_nothrow_assignable_v || │ │ │ │ │ +145 (!std::is_assignable_v && std:: │ │ │ │ │ +is_nothrow_constructible_v)) │ │ │ │ │ +146 { │ │ │ │ │ +147 if constexpr(std::is_assignable_v) │ │ │ │ │ +148 Base::operator=(std::forward(value)); │ │ │ │ │ +149 else │ │ │ │ │ +150 Base::emplace(std::forward(value)); │ │ │ │ │ +151 return *this; │ │ │ │ │ +152 } │ │ │ │ │ +153}; │ │ │ │ │ 154 │ │ │ │ │ -155 private: │ │ │ │ │ -157 size_t localIndex_; │ │ │ │ │ -158 │ │ │ │ │ -160 char attribute_; │ │ │ │ │ -161 │ │ │ │ │ -163 char public_; │ │ │ │ │ -164 │ │ │ │ │ -171 char state_; │ │ │ │ │ -172 │ │ │ │ │ -173 }; │ │ │ │ │ -174 │ │ │ │ │ -175 template │ │ │ │ │ -_1_7_6 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, │ │ │ │ │ -177 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p2) │ │ │ │ │ -178 { │ │ │ │ │ -179 if(p1._l_o_c_a_l()!=p2._l_o_c_a_l()) │ │ │ │ │ -180 return false; │ │ │ │ │ -181 if(p1._a_t_t_r_i_b_u_t_e()!=p2._a_t_t_r_i_b_u_t_e()) │ │ │ │ │ -182 return false; │ │ │ │ │ -183 if(p1._i_s_P_u_b_l_i_c()!=p2._i_s_P_u_b_l_i_c()) │ │ │ │ │ -184 return false; │ │ │ │ │ -185 return true; │ │ │ │ │ -186 } │ │ │ │ │ -187 template │ │ │ │ │ -_1_8_8 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, │ │ │ │ │ -189 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& p2) │ │ │ │ │ -190 { │ │ │ │ │ -191 return !(p1==p2); │ │ │ │ │ -192 } │ │ │ │ │ -193 │ │ │ │ │ -194 │ │ │ │ │ -195 template │ │ │ │ │ -_1_9_6 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 > │ │ │ │ │ -197 { │ │ │ │ │ -_1_9_8 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, │ │ │ │ │ -199 const _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& t2){ │ │ │ │ │ -200 return t1._a_t_t_r_i_b_u_t_e() │ │ │ │ │ -_2_0_9 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 > │ │ │ │ │ -210 { │ │ │ │ │ -211 public: │ │ │ │ │ -212 static MPI_Datatype _g_e_t_T_y_p_e(); │ │ │ │ │ -213 private: │ │ │ │ │ -214 static MPI_Datatype type; │ │ │ │ │ -215 │ │ │ │ │ -216 }; │ │ │ │ │ -217 │ │ │ │ │ -218#endif │ │ │ │ │ -219 │ │ │ │ │ -220 template │ │ │ │ │ -_2_2_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(const T& attribute, bool │ │ │ │ │ -isPublic) │ │ │ │ │ -222 : localIndex_(0), attribute_(static_cast(attribute)), │ │ │ │ │ -223 public_(static_cast(isPublic)), state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ -224 {} │ │ │ │ │ -225 │ │ │ │ │ -226 │ │ │ │ │ -227 template │ │ │ │ │ -_2_2_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(size_t local, const T& attribute, │ │ │ │ │ -bool isPublic) │ │ │ │ │ -229 : localIndex_(local), attribute_(static_cast(attribute)), │ │ │ │ │ -230 public_(static_cast(isPublic)), state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ -231 {} │ │ │ │ │ -232 │ │ │ │ │ -233 template │ │ │ │ │ -_2_3_4 _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() │ │ │ │ │ -235 : localIndex_(0), attribute_(), public_(static_cast(false)), │ │ │ │ │ -236 state_(static_cast(_V_A_L_I_D)) │ │ │ │ │ -237 {} │ │ │ │ │ -238 │ │ │ │ │ -239 template │ │ │ │ │ -_2_4_0 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 │ │ │ │ │ -241 { │ │ │ │ │ -242 return T(attribute_); │ │ │ │ │ -243 } │ │ │ │ │ -244 │ │ │ │ │ -245 template │ │ │ │ │ -246 inline void │ │ │ │ │ -_2_4_7 _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) │ │ │ │ │ -248 { │ │ │ │ │ -249 attribute_ = attribute; │ │ │ │ │ -250 } │ │ │ │ │ -251 │ │ │ │ │ -252 template │ │ │ │ │ -_2_5_3 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 │ │ │ │ │ -254 { │ │ │ │ │ -255 return localIndex_; │ │ │ │ │ -256 } │ │ │ │ │ -257 │ │ │ │ │ -258 template │ │ │ │ │ -_2_5_9 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 │ │ │ │ │ -260 { │ │ │ │ │ -261 return localIndex_; │ │ │ │ │ -262 } │ │ │ │ │ -263 │ │ │ │ │ -264 template │ │ │ │ │ -265 inline _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_>& │ │ │ │ │ -_2_6_6 _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) │ │ │ │ │ -267 { │ │ │ │ │ -268 localIndex_=index; │ │ │ │ │ -269 return *this; │ │ │ │ │ -270 } │ │ │ │ │ -271 │ │ │ │ │ -272 template │ │ │ │ │ -_2_7_3 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 │ │ │ │ │ -274 { │ │ │ │ │ -275 return static_cast(public_); │ │ │ │ │ -276 } │ │ │ │ │ -277 │ │ │ │ │ -278 template │ │ │ │ │ -_2_7_9 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 │ │ │ │ │ -280 { │ │ │ │ │ -281 return _L_o_c_a_l_I_n_d_e_x_S_t_a_t_e(state_); │ │ │ │ │ -282 } │ │ │ │ │ -283 │ │ │ │ │ -284 template │ │ │ │ │ -_2_8_5 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) │ │ │ │ │ -286 { │ │ │ │ │ -287 state_=static_cast(state); │ │ │ │ │ -288 } │ │ │ │ │ -289 │ │ │ │ │ -290#if HAVE_MPI │ │ │ │ │ -291 │ │ │ │ │ -292 template │ │ │ │ │ -_2_9_3 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() │ │ │ │ │ -294 { │ │ │ │ │ -295 │ │ │ │ │ -296 if(type==MPI_DATATYPE_NULL) { │ │ │ │ │ -297 int length = 1; │ │ │ │ │ -298 MPI_Aint base, disp; │ │ │ │ │ -299 MPI_Datatype types[1] = {_M_P_I_T_r_a_i_t_s_<_c_h_a_r_>_:_:_g_e_t_T_y_p_e()}; │ │ │ │ │ -300 _P_a_r_a_l_l_e_l_L_o_c_a_l_I_n_d_e_x_<_T_> rep; │ │ │ │ │ -301 MPI_Get_address(&rep, &base); │ │ │ │ │ -302 MPI_Get_address(&(rep.attribute_), &disp); │ │ │ │ │ -303 disp -= base; │ │ │ │ │ -304 │ │ │ │ │ -305 MPI_Datatype tmp; │ │ │ │ │ -306 MPI_Type_create_struct(1, &length, &disp, types, &tmp); │ │ │ │ │ -307 │ │ │ │ │ -308 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); │ │ │ │ │ -309 MPI_Type_commit(&type); │ │ │ │ │ -310 │ │ │ │ │ -311 MPI_Type_free(&tmp); │ │ │ │ │ -312 } │ │ │ │ │ -313 return type; │ │ │ │ │ -314 } │ │ │ │ │ -315 │ │ │ │ │ -316 template │ │ │ │ │ -_3_1_7 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; │ │ │ │ │ -318 │ │ │ │ │ -319#endif // HAVE_MPI │ │ │ │ │ -320 │ │ │ │ │ -321 │ │ │ │ │ -323} // namespace Dune │ │ │ │ │ -324 │ │ │ │ │ -325#endif // DUNE_COMMON_PARALLEL_PLOCALINDEX_HH │ │ │ │ │ -_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. │ │ │ │ │ -_m_p_i_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits classes for mapping types onto MPI_Datatype. │ │ │ │ │ -_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:238 │ │ │ │ │ -_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:260 │ │ │ │ │ -_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:273 │ │ │ │ │ -_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:247 │ │ │ │ │ -_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:253 │ │ │ │ │ -_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:285 │ │ │ │ │ -_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:266 │ │ │ │ │ -_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:279 │ │ │ │ │ -_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:234 │ │ │ │ │ -_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:240 │ │ │ │ │ -_D_u_n_e_:_:_V_A_L_I_D │ │ │ │ │ -@ VALID │ │ │ │ │ -DDeeffiinniittiioonn localindex.hh:28 │ │ │ │ │ +155} // end namespace Dune │ │ │ │ │ +156 │ │ │ │ │ +157#endif // DUNE_COMMON_COPYABLE_OPTIONAL_HH │ │ │ │ │ +_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_:_:_d_i_s_a_b_l_e_C_o_p_y_M_o_v_e │ │ │ │ │ +std::enable_if_t< not Impl::disableCopyMoveHelper< This, T... >::value, int > │ │ │ │ │ +disableCopyMove │ │ │ │ │ +Helper to disable constructor as copy and move constructor. │ │ │ │ │ +DDeeffiinniittiioonn typeutilities.hh:45 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _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:52 │ │ │ │ │ -_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:67 │ │ │ │ │ -_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:198 │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +A copyable type wrapper that provides copy/move assignment operations for types │ │ │ │ │ +that are only copy/mo... │ │ │ │ │ +DDeeffiinniittiioonn copyableoptional.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +constexpr CopyableOptional(CopyableOptional &&)=default │ │ │ │ │ +Move construct the contained value. │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +constexpr CopyableOptional(T &&value) noexcept(std::is_nothrow_constructible_v< │ │ │ │ │ +Type, T && >) │ │ │ │ │ +Construct the internal data from perfect forwarding of the passed arguments. │ │ │ │ │ +Participates in overload... │ │ │ │ │ +DDeeffiinniittiioonn copyableoptional.hh:62 │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +constexpr CopyableOptional & operator=(const CopyableOptional &that) noexcept │ │ │ │ │ +(std::is_nothrow_copy_assignable_v< Type >||(!std::is_copy_assignable_v< Type > │ │ │ │ │ +&&std::is_nothrow_copy_constructible_v< Type >)) │ │ │ │ │ +Copy assignment in terms of copy constructor. │ │ │ │ │ +DDeeffiinniittiioonn copyableoptional.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +constexpr CopyableOptional() noexcept(std::is_nothrow_default_constructible_v< │ │ │ │ │ +T >) │ │ │ │ │ +Implementation of a default constructor, if the Type is itself default │ │ │ │ │ +constructible.... │ │ │ │ │ +DDeeffiinniittiioonn copyableoptional.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +constexpr CopyableOptional(const CopyableOptional &)=default │ │ │ │ │ +Copy construct the contained value. │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +constexpr CopyableOptional(Args &&... args) noexcept(std:: │ │ │ │ │ +is_nothrow_constructible_v< Type, Args &&... >) │ │ │ │ │ +Construct the internal data from perfect forwarding of the passed arguments. │ │ │ │ │ +DDeeffiinniittiioonn copyableoptional.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l_:_:_~_C_o_p_y_a_b_l_e_O_p_t_i_o_n_a_l │ │ │ │ │ +~CopyableOptional()=default │ │ │ │ │ +Default destructor. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: localindex.hh File Reference │ │ │ │ +dune-common: hash.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,55 +65,185 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Enumerations
│ │ │ │ - │ │ │ │ +Macros | │ │ │ │ +Functions
│ │ │ │ +
hash.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

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

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

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::LocalIndex
 An index present on the local process. More...
struct  Dune::hash< T >
 Functor for hashing objects of type T. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ -Enumerations

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

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

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

Detailed Description

│ │ │ │ -

Provides classes for use as the local index in ParallelIndexSet.

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

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.

│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DUNE_DEFINE_HASH

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_DEFINE_HASH( template_args,
 type 
)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

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.

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

◆ DUNE_HASH_TYPE

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

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,31 +1,129 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 | _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 │ │ │ │ │ +_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> │ │ │ │ │ _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_c_a_l_I_n_d_e_x │ │ │ │ │ -  An index present on the local process. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_h_a_s_h_<_ _T_ _> │ │ │ │ │ +  Functor for hashing objects of type T. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +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. │ │ │ │ │ +  │ │ │ │ │ +#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. │ │ │ │ │ +  │ │ │ │ │ +#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. │ │ │ │ │ +  │ │ │ │ │ +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. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides classes for use as the local index in ParallelIndexSet. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +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. │ │ │ │ │ +********** 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. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: localindex.hh Source File │ │ │ │ +dune-common: hash.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,117 +70,293 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
localindex.hh
│ │ │ │ +
hash.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 © 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_LOCALINDEX_HH
│ │ │ │ -
7#define DUNE_COMMON_PARALLEL_LOCALINDEX_HH
│ │ │ │ -
8
│ │ │ │ -
9#include <cstddef>
│ │ │ │ -
10
│ │ │ │ -
11namespace Dune
│ │ │ │ -
12{
│ │ │ │ -
13
│ │ │ │ -
14
│ │ │ │ - │ │ │ │ +
5#ifndef DUNE_COMMON_HASH_HH
│ │ │ │ +
6#define DUNE_COMMON_HASH_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <functional>
│ │ │ │ +
9
│ │ │ │ + │ │ │ │ +
11
│ │ │ │ +
24// ********************************************************************************
│ │ │ │ +
25// Doxygen documentation
│ │ │ │ +
26// ********************************************************************************
│ │ │ │ +
27
│ │ │ │ +
28#ifdef DOXYGEN
│ │ │ │
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
│ │ │ │ -
60 inline operator std::size_t() const;
│ │ │ │ -
61
│ │ │ │ -
67 inline LocalIndex& operator=(std::size_t index);
│ │ │ │ -
68
│ │ │ │ -
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
│ │ │ │ -
│ │ │ │ -
101 inline LocalIndex::operator std::size_t() const {
│ │ │ │ -
102 return localIndex_;
│ │ │ │ -
103 }
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ -
105 inline LocalIndex& LocalIndex::operator=(std::size_t index){
│ │ │ │ -
106 localIndex_ = index;
│ │ │ │ -
107 return *this;
│ │ │ │ -
108 }
│ │ │ │ -
│ │ │ │ -
109
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
111 return static_cast<LocalIndexState>(state_);
│ │ │ │ -
112 }
│ │ │ │ -
│ │ │ │ -
113
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
115 state_ = static_cast<char>(state);
│ │ │ │ -
116 }
│ │ │ │ -
│ │ │ │ -
117
│ │ │ │ -
120} // namespace Dune
│ │ │ │ +
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#endif // DUNE_COMMON_PARALLEL_LOCALINDEX_HH
│ │ │ │ -
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
│ │ │ │ +
122
│ │ │ │ +
123// ********************************************************************************
│ │ │ │ +
124// C++11 support
│ │ │ │ +
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
│ │ │ │ +
194
│ │ │ │ +
195
│ │ │ │ +
196
│ │ │ │ +
197// ********************************************************************************
│ │ │ │ +
198// Some utility functions for combining hashes of member variables.
│ │ │ │ +
199// ********************************************************************************
│ │ │ │ +
200
│ │ │ │ +
201namespace Dune {
│ │ │ │ +
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
│ │ │ │ +
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 }
│ │ │ │ +
262
│ │ │ │ +
263 };
│ │ │ │ +
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.
│ │ │ │ +
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 }
│ │ │ │ +
│ │ │ │ +
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.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
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
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,121 +1,329 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -localindex.hh │ │ │ │ │ +hash.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 © 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_LOCALINDEX_HH │ │ │ │ │ -7#define DUNE_COMMON_PARALLEL_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}; │ │ │ │ │ +5#ifndef DUNE_COMMON_HASH_HH │ │ │ │ │ +6#define DUNE_COMMON_HASH_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 │ │ │ │ │ -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 │ │ │ │ │ -60 inline operator std::size_t() const; │ │ │ │ │ -61 │ │ │ │ │ -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 │ │ │ │ │ -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_1 inline LocalIndex::operator std::size_t() const { │ │ │ │ │ -102 return localIndex_; │ │ │ │ │ -103 } │ │ │ │ │ +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_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_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 │ │ │ │ │ +_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#endif // DUNE_COMMON_PARALLEL_LOCALINDEX_HH │ │ │ │ │ -_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 │ │ │ │ │ +122 │ │ │ │ │ +123/ │ │ │ │ │ +/ │ │ │ │ │ +******************************************************************************** │ │ │ │ │ +124// C++11 support │ │ │ │ │ +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 │ │ │ │ │ +194 │ │ │ │ │ +195 │ │ │ │ │ +196 │ │ │ │ │ +197/ │ │ │ │ │ +/ │ │ │ │ │ +******************************************************************************** │ │ │ │ │ +198// Some utility functions for combining hashes of member variables. │ │ │ │ │ +199/ │ │ │ │ │ +/ │ │ │ │ │ +******************************************************************************** │ │ │ │ │ +200 │ │ │ │ │ +201namespace _D_u_n_e { │ │ │ │ │ +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 │ │ │ │ │ +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; │ │ │ │ │ +261 } │ │ │ │ │ +262 │ │ │ │ │ +263 }; │ │ │ │ │ +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. │ │ │ │ │ +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 │ │ │ │ │ +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 } │ │ │ │ │ +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); │ │ │ │ │ +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. │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_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 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: collectivecommunication.hh File Reference │ │ │ │ +dune-common: lru.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,24 +65,50 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
collectivecommunication.hh File Reference
│ │ │ │ +
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
lru.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/common/parallel/communication.hh>
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │ +

Detailed Description

│ │ │ │ +

LRU Cache Container, using an STL like interface.

│ │ │ │ +
Author
Christian Engwer
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,12 +1,29 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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> │ │ │ │ │ +_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. │ │ │ │ │ +  │ │ │ │ │ +********** 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/a00029_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: collectivecommunication.hh Source File │ │ │ │ +dune-common: lru.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,27 +70,242 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
collectivecommunication.hh
│ │ │ │ +
lru.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © 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.
│ │ │ │ +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 © 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_LRU_HH
│ │ │ │ +
6#define DUNE_COMMON_LRU_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <list>
│ │ │ │ +
9#include <utility>
│ │ │ │ +
10#include <map>
│ │ │ │ +
11#include <memory>
│ │ │ │ +
12
│ │ │ │ + │ │ │ │ +
14
│ │ │ │ +
20namespace Dune {
│ │ │ │ +
21
│ │ │ │ +
22 namespace {
│ │ │ │ +
23
│ │ │ │ +
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,21 +1,267 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -collectivecommunication.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// SPDX-FileCopyrightInfo: Copyright © 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 © 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. │ │ │ │ │ +4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +5#ifndef DUNE_COMMON_LRU_HH │ │ │ │ │ +6#define DUNE_COMMON_LRU_HH │ │ │ │ │ +7 │ │ │ │ │ +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 │ │ │ │ │ +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/a00032.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: variablesizecommunicator.hh File Reference │ │ │ │ +dune-common: debugalign.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,79 +65,50 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
variablesizecommunicator.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
debugalign.cc 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 <cstddef>
│ │ │ │ +#include <cstdlib>
│ │ │ │ #include <functional>
│ │ │ │ -#include <map>
│ │ │ │ -#include <memory>
│ │ │ │ +#include <ios>
│ │ │ │ +#include <iostream>
│ │ │ │ #include <utility>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <mpi.h>
│ │ │ │ -#include <dune/common/concept.hh>
│ │ │ │ -#include <dune/common/parallel/interface.hh>
│ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ -
│ │ │ │ -

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...
 
│ │ │ │ +#include <dune/common/debugalign.hh>
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +

│ │ │ │ Namespaces

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

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

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,34 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +_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 │ │ │ │ │ -#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> │ │ │ │ │ -_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_._._. │ │ │ │ │ -  │ │ │ │ │ +#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. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_C_o_n_c_e_p_t │ │ │ │ │ -  Namespace for concepts. │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ -********** 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/a00035.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpidata.hh File Reference │ │ │ │ +dune-common: typelist.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,62 +65,93 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ +Typedefs | │ │ │ │ Functions
│ │ │ │ -
mpidata.hh File Reference
│ │ │ │ +
typelist.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 <type_traits>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/std/type_traits.hh>
│ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ +
#include <type_traits>
│ │ │ │ +#include <tuple>
│ │ │ │ +#include <utility>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::MPIData< T, Enable >
struct  Dune::MetaType< T >
 A type that refers to another type. More...
 
struct  Dune::IsTypeList< T >
 Check if given type is a TypeList. More...
 
struct  Dune::IsTypeList< TypeList< T... > >
 Check if given type is a TypeList. More...
 
struct  Dune::IsEmptyTypeList< T >
 Check if given type is an empty TypeList. More...
 
struct  Dune::MPIData< void >
struct  Dune::TypeListSize< T >
 
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 > > >
struct  Dune::TypeListSize< TypeList< T... > >
 Get size of TypeList. More...
 
struct  Dune::TypeListElement< i, T >
 
struct  Dune::TypeListElement< i, TypeList< T... > >
 Get element of TypeList. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ +Typedefs

template<class... T>
using Dune::TypeList = std::tuple< MetaType< T >... >
 A simple type list.
 
template<std::size_t i, class T >
using Dune::TypeListEntry_t = typename TypeListElement< i, T >::type
 Shortcut for TypeListElement<i, T>::type;.
 
template<template< class... > class Target, class TL >
using Dune::UnpackTypeList_t = typename Impl::UnpackTypeList< Target, TL >::type
 Unpack Dune::TypeList.
 
template<template< class... > class Target, class... T>
using Dune::UniqueTypes_t = typename Impl::UniqueTypesHelper< Target, TypeList< T... > >::type
 Remove duplicates from a list of types.
 
template<class NonUniqueTypeList >
using Dune::UniqueTypeList_t = typename Impl::UniqueTypesHelper< TypeList, NonUniqueTypeList >::type
 Remove duplicates from a Dune::TypeList.
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<class T >
auto Dune::getMPIData (T &t)
 
template<class... T>
constexpr auto Dune::uniqueTypeList (TypeList< T... > list)
 Remove duplicates from a Dune::TypeList.
 
│ │ │ │ -

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,45 +1,70 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +_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 │ │ │ │ │ +typelist.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_/_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> │ │ │ │ │ +#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_D_a_t_a_<_ _T_,_ _E_n_a_b_l_e_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_M_e_t_a_T_y_p_e_<_ _T_ _> │ │ │ │ │ +  A type that refers to another type. _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_:_:_I_s_T_y_p_e_L_i_s_t_<_ _T_ _> │ │ │ │ │ +  Check if given type is a TypeList. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -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_ _>_ _>_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_T_y_p_e_L_i_s_t_<_ _T_y_p_e_L_i_s_t_<_ _T_._._._ _>_ _> │ │ │ │ │ +  Check if given type is a TypeList. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_E_m_p_t_y_T_y_p_e_L_i_s_t_<_ _T_ _> │ │ │ │ │ +  Check if given type is an empty TypeList. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_T_y_p_e_L_i_s_t_S_i_z_e_<_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_T_y_p_e_L_i_s_t_S_i_z_e_<_ _T_y_p_e_L_i_s_t_<_ _T_._._._ _>_ _> │ │ │ │ │ +  Get size of TypeList. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_T_y_p_e_L_i_s_t_E_l_e_m_e_n_t_<_ _i_,_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_T_y_p_e_L_i_s_t_E_l_e_m_e_n_t_<_ _i_,_ _T_y_p_e_L_i_s_t_<_ _T_._._._ _>_ _> │ │ │ │ │ +  Get element of TypeList. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_T_y_p_e_L_i_s_t = std::tuple< _M_e_t_a_T_y_p_e< T >... > │ │ │ │ │ +  A simple type list. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_T_y_p_e_L_i_s_t_E_n_t_r_y___t = typename _T_y_p_e_L_i_s_t_E_l_e_m_e_n_t< i, T >::type │ │ │ │ │ +  Shortcut for TypeListElement::type;. │ │ │ │ │ +  │ │ │ │ │ +template class Target, class TL > │ │ │ │ │ +using  _D_u_n_e_:_:_U_n_p_a_c_k_T_y_p_e_L_i_s_t___t = typename Impl::UnpackTypeList< Target, TL >:: │ │ │ │ │ + type │ │ │ │ │ +  Unpack _D_u_n_e_:_:_T_y_p_e_L_i_s_t. │ │ │ │ │ +  │ │ │ │ │ +template class Target, class... T> │ │ │ │ │ +using  _D_u_n_e_:_:_U_n_i_q_u_e_T_y_p_e_s___t = typename Impl::UniqueTypesHelper< Target, │ │ │ │ │ + _T_y_p_e_L_i_s_t< T... > >::type │ │ │ │ │ +  Remove duplicates from a list of types. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_U_n_i_q_u_e_T_y_p_e_L_i_s_t___t = typename Impl::UniqueTypesHelper< _T_y_p_e_L_i_s_t, │ │ │ │ │ + NonUniqueTypeList >::type │ │ │ │ │ +  Remove duplicates from a _D_u_n_e_:_:_T_y_p_e_L_i_s_t. │ │ │ │ │ +  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -auto  _D_u_n_e_:_:_g_e_t_M_P_I_D_a_t_a (T &t) │ │ │ │ │ +template │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_u_n_i_q_u_e_T_y_p_e_L_i_s_t (_T_y_p_e_L_i_s_t< T... > list) │ │ │ │ │ +  Remove duplicates from a _D_u_n_e_:_:_T_y_p_e_L_i_s_t. │ │ │ │ │   │ │ │ │ │ -********** 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/a00035_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpidata.hh Source File │ │ │ │ +dune-common: typelist.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,197 +70,152 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpidata.hh
│ │ │ │ +
typelist.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 © 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#if HAVE_MPI
│ │ │ │ -
10
│ │ │ │ -
11#include <vector>
│ │ │ │ -
12#include <string>
│ │ │ │ -
13#include <type_traits>
│ │ │ │ -
14
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
18
│ │ │ │ -
38namespace Dune{
│ │ │ │ -
39
│ │ │ │ -
40 template<class, class = void>
│ │ │ │ -
41 struct MPIData;
│ │ │ │ -
42
│ │ │ │ -
43 template<class T>
│ │ │ │ -
│ │ │ │ -
44 auto getMPIData(T& t){
│ │ │ │ -
45 return MPIData<T>(t);
│ │ │ │ -
46 }
│ │ │ │ -
│ │ │ │ -
47
│ │ │ │ -
48 // Default implementation for static datatypes
│ │ │ │ -
49 template<class T, class Enable>
│ │ │ │ -
│ │ │ │ -
50 struct MPIData
│ │ │ │ -
51 {
│ │ │ │ -
52 friend auto getMPIData<T>(T&);
│ │ │ │ -
53 protected:
│ │ │ │ - │ │ │ │ -
55
│ │ │ │ -
│ │ │ │ -
56 MPIData(T& t)
│ │ │ │ -
57 : data_(t)
│ │ │ │ -
58 {}
│ │ │ │ -
│ │ │ │ -
59
│ │ │ │ -
60 public:
│ │ │ │ -
│ │ │ │ -
61 void* ptr() const {
│ │ │ │ -
62 return (void*)&data_;
│ │ │ │ -
63 }
│ │ │ │ -
│ │ │ │ -
64
│ │ │ │ -
65 // indicates whether the datatype can be resized
│ │ │ │ -
66 static constexpr bool static_size = true;
│ │ │ │ -
67
│ │ │ │ -
│ │ │ │ -
68 int size() const{
│ │ │ │ -
69 return 1;
│ │ │ │ -
70 }
│ │ │ │ -
│ │ │ │ -
71
│ │ │ │ -
│ │ │ │ -
72 MPI_Datatype type() const {
│ │ │ │ -
73 return MPITraits<std::decay_t<T>>::getType();
│ │ │ │ -
74 }
│ │ │ │ -
│ │ │ │ -
75 };
│ │ │ │ -
│ │ │ │ -
76
│ │ │ │ -
77 // dummy implementation for void
│ │ │ │ -
78 template<>
│ │ │ │ -
│ │ │ │ -
79 struct MPIData<void>{
│ │ │ │ -
80 protected:
│ │ │ │ - │ │ │ │ -
82
│ │ │ │ -
83 public:
│ │ │ │ -
│ │ │ │ -
84 void* ptr(){
│ │ │ │ -
85 return nullptr;
│ │ │ │ -
86 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
87 int size(){
│ │ │ │ -
88 return 0;
│ │ │ │ -
89 }
│ │ │ │ -
│ │ │ │ -
90 void get(){}
│ │ │ │ -
│ │ │ │ -
91 MPI_Datatype type() const{
│ │ │ │ -
92 return MPI_INT;
│ │ │ │ -
93 }
│ │ │ │ -
│ │ │ │ -
94 };
│ │ │ │ -
│ │ │ │ -
95
│ │ │ │ -
96 // specializations:
│ │ │ │ -
97 // std::vector of static sized elements or std::string
│ │ │ │ -
98 template<class T>
│ │ │ │ -
│ │ │ │ -
99 struct MPIData<T, std::void_t<std::tuple<decltype(std::declval<T>().data()),
│ │ │ │ -
100 decltype(std::declval<T>().size()),
│ │ │ │ -
101 typename std::decay_t<T>::value_type>>>{
│ │ │ │ -
102 private:
│ │ │ │ -
103 template<class U>
│ │ │ │ -
104 using hasResizeOp = decltype(std::declval<U>().resize(0));
│ │ │ │ -
105
│ │ │ │ -
106 protected:
│ │ │ │ -
107 friend auto getMPIData<T>(T&);
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
109 : data_(t)
│ │ │ │ -
110 {}
│ │ │ │ -
│ │ │ │ -
111 public:
│ │ │ │ -
112 static constexpr bool static_size = std::is_const<T>::value || !Std::is_detected_v<hasResizeOp, T>;
│ │ │ │ -
│ │ │ │ -
113 void* ptr() {
│ │ │ │ -
114 return (void*) data_.data();
│ │ │ │ -
115 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
116 int size() {
│ │ │ │ -
117 return data_.size();
│ │ │ │ -
118 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
119 MPI_Datatype type() const{
│ │ │ │ - │ │ │ │ -
121 }
│ │ │ │ -
│ │ │ │ +
5#ifndef DUNE_COMMON_TYPELIST_HH
│ │ │ │ +
6#define DUNE_COMMON_TYPELIST_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <type_traits>
│ │ │ │ +
9#include <tuple>
│ │ │ │ +
10#include <utility>
│ │ │ │ +
11
│ │ │ │ +
12namespace Dune {
│ │ │ │ +
13
│ │ │ │ +
32 template<class T>
│ │ │ │ +
│ │ │ │ +
33 struct MetaType {
│ │ │ │ +
35 using type = T;
│ │ │ │ +
36 };
│ │ │ │ +
│ │ │ │ +
37
│ │ │ │ +
86 template<class... T>
│ │ │ │ +
87 using TypeList = std::tuple<MetaType<T>...>;
│ │ │ │ +
88
│ │ │ │ +
89
│ │ │ │ +
90
│ │ │ │ +
99 template<class T>
│ │ │ │ +
100 struct IsTypeList : std::false_type {};
│ │ │ │ +
101
│ │ │ │ +
107 template<class... T>
│ │ │ │ +
108 struct IsTypeList<TypeList<T...> > : std::true_type {};
│ │ │ │ +
109
│ │ │ │ +
110
│ │ │ │ +
111
│ │ │ │ +
120 template<class T>
│ │ │ │ +
121 struct IsEmptyTypeList : std::is_same<T, TypeList<> > {};
│ │ │ │
122
│ │ │ │ -
123 template<class S = T>
│ │ │ │ -
│ │ │ │ -
124 auto /*void*/ resize(int size)
│ │ │ │ -
125 -> std::enable_if_t<!std::is_const<S>::value || !Std::is_detected_v<hasResizeOp, S>>
│ │ │ │ -
126 {
│ │ │ │ -
127 data_.resize(size);
│ │ │ │ -
128 }
│ │ │ │ -
│ │ │ │ -
129
│ │ │ │ -
130 protected:
│ │ │ │ - │ │ │ │ -
132 };
│ │ │ │ -
│ │ │ │ -
133
│ │ │ │ -
134}
│ │ │ │ -
135
│ │ │ │ -
140#endif // HAVE_MPI
│ │ │ │ -
141#endif // DUNE_COMMON_PARALLEL_MPIDATA_HH
│ │ │ │ -
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.
│ │ │ │ +
123
│ │ │ │ +
124
│ │ │ │ +
125 template<class T>
│ │ │ │ +
126 struct TypeListSize {};
│ │ │ │ +
127
│ │ │ │ +
136 template<class... T>
│ │ │ │ +
137 struct TypeListSize<TypeList<T...>> : std::integral_constant<std::size_t, sizeof...(T)> {};
│ │ │ │ +
138
│ │ │ │ +
139
│ │ │ │ +
140
│ │ │ │ +
141 template<std::size_t i, class T>
│ │ │ │ + │ │ │ │ +
143
│ │ │ │ +
149 template<std::size_t i, class... T>
│ │ │ │ +
│ │ │ │ +
150 struct TypeListElement<i, TypeList<T...>>
│ │ │ │ +
151 {
│ │ │ │ +
157 using type = typename std::tuple_element<i, std::tuple<T...>>::type;
│ │ │ │ +
158
│ │ │ │ +
164 using Type = type;
│ │ │ │ +
165 };
│ │ │ │ +
│ │ │ │ +
166
│ │ │ │ +
170 template<std::size_t i, class T>
│ │ │ │ + │ │ │ │ +
172
│ │ │ │ +
173 namespace Impl {
│ │ │ │ +
174
│ │ │ │ +
175 template<template<class...> class Target, class ToDoList, class... Processed>
│ │ │ │ +
176 struct UniqueTypesHelper;
│ │ │ │ +
177
│ │ │ │ +
178 template<template<class...> class Target, class... Processed>
│ │ │ │ +
179 struct UniqueTypesHelper<Target, TypeList<>, Processed...>
│ │ │ │ +
180 {
│ │ │ │ +
181 using type = Target<Processed...>;
│ │ │ │ +
182 };
│ │ │ │ +
183
│ │ │ │ +
184 template<template<class...> class Target, class T0, class... T, class... Processed>
│ │ │ │ +
185 struct UniqueTypesHelper<Target, TypeList<T0, T...>, Processed...>
│ │ │ │ +
186 {
│ │ │ │ +
187 using type = std::conditional_t<
│ │ │ │ +
188 std::disjunction<std::is_same<T0, Processed>...>::value,
│ │ │ │ +
189 typename UniqueTypesHelper<Target, TypeList<T...>, Processed...>::type,
│ │ │ │ +
190 typename UniqueTypesHelper<Target, TypeList<T...>, T0, Processed...>::type>;
│ │ │ │ +
191 };
│ │ │ │ +
192
│ │ │ │ +
193 // Helper for unpacking Dune::TypeList
│ │ │ │ +
194 template<template<class...> class Target, class TL>
│ │ │ │ +
195 struct UnpackTypeList;
│ │ │ │ +
196
│ │ │ │ +
197 template<template<class...> class Target, class... T>
│ │ │ │ +
198 struct UnpackTypeList<Target, Dune::TypeList<T...>>
│ │ │ │ +
199 {
│ │ │ │ +
200 using type = Target<T...>;
│ │ │ │ +
201 };
│ │ │ │ +
202
│ │ │ │ +
203 } // namespace Impl
│ │ │ │ +
204
│ │ │ │ +
209 template<template<class...> class Target, class TL>
│ │ │ │ +
210 using UnpackTypeList_t = typename Impl::UnpackTypeList<Target, TL>::type;
│ │ │ │ +
211
│ │ │ │ +
219 template<template<class...> class Target, class... T>
│ │ │ │ +
220 using UniqueTypes_t = typename Impl::UniqueTypesHelper<Target, TypeList<T...>>::type;
│ │ │ │ +
221
│ │ │ │ +
227 template<class NonUniqueTypeList>
│ │ │ │ +
228 using UniqueTypeList_t = typename Impl::UniqueTypesHelper<TypeList, NonUniqueTypeList>::type;
│ │ │ │ +
229
│ │ │ │ +
235 template<class... T>
│ │ │ │ +
│ │ │ │ +
236 constexpr auto uniqueTypeList(TypeList<T...> list)
│ │ │ │ +
237 {
│ │ │ │ +
238 return typename Impl::UniqueTypesHelper<TypeList, TypeList<T...>>::type{};
│ │ │ │ +
239 }
│ │ │ │ +
│ │ │ │ +
240
│ │ │ │ +
241
│ │ │ │ +
242
│ │ │ │ +
243} // namespace Dune
│ │ │ │ +
244
│ │ │ │ +
245#endif // DUNE_COMMON_TYPELIST_HH
│ │ │ │ +
std::tuple< MetaType< T >... > TypeList
A simple type list.
Definition typelist.hh:87
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
auto getMPIData(T &t)
Definition mpidata.hh:44
│ │ │ │ -
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
│ │ │ │ -
Definition mpidata.hh:51
│ │ │ │ -
T & data_
Definition mpidata.hh:54
│ │ │ │ -
MPI_Datatype type() const
Definition mpidata.hh:72
│ │ │ │ -
void * ptr() const
Definition mpidata.hh:61
│ │ │ │ -
int size() const
Definition mpidata.hh:68
│ │ │ │ -
static constexpr bool static_size
Definition mpidata.hh:66
│ │ │ │ -
MPIData(T &t)
Definition mpidata.hh:56
│ │ │ │ -
void get()
Definition mpidata.hh:90
│ │ │ │ -
MPIData()
Definition mpidata.hh:81
│ │ │ │ -
int size()
Definition mpidata.hh:87
│ │ │ │ -
void * ptr()
Definition mpidata.hh:84
│ │ │ │ -
MPI_Datatype type() const
Definition mpidata.hh:91
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
auto resize(int size) -> std::enable_if_t<!std::is_const< S >::value||!Std::is_detected_v< hasResizeOp, S > >
Definition mpidata.hh:124
│ │ │ │ - │ │ │ │ +
typename Impl::UnpackTypeList< Target, TL >::type UnpackTypeList_t
Unpack Dune::TypeList.
Definition typelist.hh:210
│ │ │ │ +
constexpr auto uniqueTypeList(TypeList< T... > list)
Remove duplicates from a Dune::TypeList.
Definition typelist.hh:236
│ │ │ │ +
typename Impl::UniqueTypesHelper< Target, TypeList< T... > >::type UniqueTypes_t
Remove duplicates from a list of types.
Definition typelist.hh:220
│ │ │ │ +
typename Impl::UniqueTypesHelper< TypeList, NonUniqueTypeList >::type UniqueTypeList_t
Remove duplicates from a Dune::TypeList.
Definition typelist.hh:228
│ │ │ │ +
typename TypeListElement< i, T >::type TypeListEntry_t
Shortcut for TypeListElement<i, T>::type;.
Definition typelist.hh:171
│ │ │ │ +
A type that refers to another type.
Definition typelist.hh:33
│ │ │ │ +
T type
The referred-to type.
Definition typelist.hh:35
│ │ │ │ +
Check if given type is a TypeList.
Definition typelist.hh:100
│ │ │ │ +
Check if given type is an empty TypeList.
Definition typelist.hh:121
│ │ │ │ +
Definition typelist.hh:126
│ │ │ │ +
Definition typelist.hh:142
│ │ │ │ +
typename std::tuple_element< i, std::tuple< T... > >::type type
Export type of i-th element in TypeList.
Definition typelist.hh:157
│ │ │ │ +
type Type
Export type of i-th element in TypeList.
Definition typelist.hh:164
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,218 +1,181 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpidata.hh │ │ │ │ │ +typelist.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 © 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#if HAVE_MPI │ │ │ │ │ -10 │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14 │ │ │ │ │ -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#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> │ │ │ │ │ -17#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> │ │ │ │ │ -18 │ │ │ │ │ -38namespace _D_u_n_e{ │ │ │ │ │ -39 │ │ │ │ │ -40 template │ │ │ │ │ -41 struct MPIData; │ │ │ │ │ -42 │ │ │ │ │ -43 template │ │ │ │ │ -_4_4 auto _g_e_t_M_P_I_D_a_t_a(T& t){ │ │ │ │ │ -45 return _M_P_I_D_a_t_a_<_T_>(t); │ │ │ │ │ -46 } │ │ │ │ │ -47 │ │ │ │ │ -48 // Default implementation for static datatypes │ │ │ │ │ -49 template │ │ │ │ │ -_5_0 struct _M_P_I_D_a_t_a │ │ │ │ │ -51 { │ │ │ │ │ -52 friend auto getMPIData(T&); │ │ │ │ │ -53 protected: │ │ │ │ │ -_5_4 T& _d_a_t_a__; │ │ │ │ │ -55 │ │ │ │ │ -_5_6 _M_P_I_D_a_t_a(T& t) │ │ │ │ │ -57 : _d_a_t_a__(t) │ │ │ │ │ -58 {} │ │ │ │ │ -59 │ │ │ │ │ -60 public: │ │ │ │ │ -_6_1 void* _p_t_r() const { │ │ │ │ │ -62 return (void*)&_d_a_t_a__; │ │ │ │ │ -63 } │ │ │ │ │ -64 │ │ │ │ │ -65 // indicates whether the datatype can be resized │ │ │ │ │ -_6_6 static constexpr bool _s_t_a_t_i_c___s_i_z_e = true; │ │ │ │ │ -67 │ │ │ │ │ -_6_8 int _s_i_z_e() const{ │ │ │ │ │ -69 return 1; │ │ │ │ │ -70 } │ │ │ │ │ -71 │ │ │ │ │ -_7_2 MPI_Datatype _t_y_p_e() const { │ │ │ │ │ -73 return _M_P_I_T_r_a_i_t_s_<_s_t_d_:_:_d_e_c_a_y___t_<_T_>>::getType(); │ │ │ │ │ -74 } │ │ │ │ │ -75 }; │ │ │ │ │ -76 │ │ │ │ │ -77 // dummy implementation for void │ │ │ │ │ -78 template<> │ │ │ │ │ -_7_9 struct _M_P_I_D_a_t_a{ │ │ │ │ │ -80 protected: │ │ │ │ │ -_8_1 _M_P_I_D_a_t_a() {} │ │ │ │ │ -82 │ │ │ │ │ -83 public: │ │ │ │ │ -_8_4 void* _p_t_r(){ │ │ │ │ │ -85 return nullptr; │ │ │ │ │ -86 } │ │ │ │ │ -_8_7 int _s_i_z_e(){ │ │ │ │ │ -88 return 0; │ │ │ │ │ -89 } │ │ │ │ │ -_9_0 void _g_e_t(){} │ │ │ │ │ -_9_1 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ -92 return MPI_INT; │ │ │ │ │ -93 } │ │ │ │ │ -94 }; │ │ │ │ │ -95 │ │ │ │ │ -96 // specializations: │ │ │ │ │ -97 // std::vector of static sized elements or std::string │ │ │ │ │ -98 template │ │ │ │ │ -_9_9 struct _M_P_I_D_a_t_a().data()), │ │ │ │ │ -100 decltype(std::declval().size()), │ │ │ │ │ -101 typename std::decay_t::value_type>>>{ │ │ │ │ │ -102 private: │ │ │ │ │ -103 template │ │ │ │ │ -104 using hasResizeOp = decltype(std::declval().resize(0)); │ │ │ │ │ -105 │ │ │ │ │ -106 protected: │ │ │ │ │ -107 friend auto getMPIData(T&); │ │ │ │ │ -_1_0_8 _M_P_I_D_a_t_a(T& t) │ │ │ │ │ -109 : _d_a_t_a__(t) │ │ │ │ │ -110 {} │ │ │ │ │ -111 public: │ │ │ │ │ -_1_1_2 static constexpr bool _s_t_a_t_i_c___s_i_z_e = std::is_const::value || !Std:: │ │ │ │ │ -is_detected_v; │ │ │ │ │ -_1_1_3 void* _p_t_r() { │ │ │ │ │ -114 return (void*) _d_a_t_a__.data(); │ │ │ │ │ -115 } │ │ │ │ │ -_1_1_6 int _s_i_z_e() { │ │ │ │ │ -117 return _d_a_t_a__.size(); │ │ │ │ │ -118 } │ │ │ │ │ -_1_1_9 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ -120 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(); │ │ │ │ │ -121 } │ │ │ │ │ +5#ifndef DUNE_COMMON_TYPELIST_HH │ │ │ │ │ +6#define DUNE_COMMON_TYPELIST_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12namespace _D_u_n_e { │ │ │ │ │ +13 │ │ │ │ │ +32 template │ │ │ │ │ +_3_3 struct _M_e_t_a_T_y_p_e { │ │ │ │ │ +_3_5 using _t_y_p_e = T; │ │ │ │ │ +36 }; │ │ │ │ │ +37 │ │ │ │ │ +86 template │ │ │ │ │ +_8_7 using _T_y_p_e_L_i_s_t = std::tuple...>; │ │ │ │ │ +88 │ │ │ │ │ +89 │ │ │ │ │ +90 │ │ │ │ │ +99 template │ │ │ │ │ +_1_0_0 struct _I_s_T_y_p_e_L_i_s_t : std::false_type {}; │ │ │ │ │ +101 │ │ │ │ │ +107 template │ │ │ │ │ +_1_0_8 struct _I_s_T_y_p_e_L_i_s_t<_T_y_p_e_L_i_s_t > : std::true_type {}; │ │ │ │ │ +109 │ │ │ │ │ +110 │ │ │ │ │ +111 │ │ │ │ │ +120 template │ │ │ │ │ +_1_2_1 struct _I_s_E_m_p_t_y_T_y_p_e_L_i_s_t : std::is_same > {}; │ │ │ │ │ 122 │ │ │ │ │ -123 template │ │ │ │ │ -_1_2_4 auto /*void*/ _r_e_s_i_z_e(int _s_i_z_e) │ │ │ │ │ -125 -> std::enable_if_t::value || !Std:: │ │ │ │ │ -is_detected_v> │ │ │ │ │ -126 { │ │ │ │ │ -127 _d_a_t_a__.resize(_s_i_z_e); │ │ │ │ │ -128 } │ │ │ │ │ -129 │ │ │ │ │ -130 protected: │ │ │ │ │ -_1_3_1 T& _d_a_t_a__; │ │ │ │ │ -132 }; │ │ │ │ │ -133 │ │ │ │ │ -134} │ │ │ │ │ -135 │ │ │ │ │ -140#endif // HAVE_MPI │ │ │ │ │ -141#endif // DUNE_COMMON_PARALLEL_MPIDATA_HH │ │ │ │ │ -_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. │ │ │ │ │ +123 │ │ │ │ │ +124 │ │ │ │ │ +125 template │ │ │ │ │ +_1_2_6 struct _T_y_p_e_L_i_s_t_S_i_z_e {}; │ │ │ │ │ +127 │ │ │ │ │ +136 template │ │ │ │ │ +_1_3_7 struct _T_y_p_e_L_i_s_t_S_i_z_e<_T_y_p_e_L_i_s_t> : std::integral_constant {}; │ │ │ │ │ +138 │ │ │ │ │ +139 │ │ │ │ │ +140 │ │ │ │ │ +141 template │ │ │ │ │ +_1_4_2 struct _T_y_p_e_L_i_s_t_E_l_e_m_e_n_t {}; │ │ │ │ │ +143 │ │ │ │ │ +149 template │ │ │ │ │ +_1_5_0 struct _T_y_p_e_L_i_s_t_E_l_e_m_e_n_t> │ │ │ │ │ +151 { │ │ │ │ │ +_1_5_7 using _t_y_p_e = typename std::tuple_element>::type; │ │ │ │ │ +158 │ │ │ │ │ +_1_6_4 using _T_y_p_e = _t_y_p_e; │ │ │ │ │ +165 }; │ │ │ │ │ +166 │ │ │ │ │ +170 template │ │ │ │ │ +_1_7_1 using _T_y_p_e_L_i_s_t_E_n_t_r_y___t = typename _T_y_p_e_L_i_s_t_E_l_e_m_e_n_t_<_i_,_ _T_>_:_:_t_y_p_e; │ │ │ │ │ +172 │ │ │ │ │ +173 namespace Impl { │ │ │ │ │ +174 │ │ │ │ │ +175 template class Target, class ToDoList, class... │ │ │ │ │ +Processed> │ │ │ │ │ +176 struct UniqueTypesHelper; │ │ │ │ │ +177 │ │ │ │ │ +178 template class Target, class... Processed> │ │ │ │ │ +179 struct UniqueTypesHelper, Processed...> │ │ │ │ │ +180 { │ │ │ │ │ +181 using type = Target; │ │ │ │ │ +182 }; │ │ │ │ │ +183 │ │ │ │ │ +184 template class Target, class T0, class... T, class... │ │ │ │ │ +Processed> │ │ │ │ │ +185 struct UniqueTypesHelper, Processed...> │ │ │ │ │ +186 { │ │ │ │ │ +187 using type = std::conditional_t< │ │ │ │ │ +188 std::disjunction...>::value, │ │ │ │ │ +189 typename UniqueTypesHelper, Processed...>::type, │ │ │ │ │ +190 typename UniqueTypesHelper, T0, Processed...>:: │ │ │ │ │ +type>; │ │ │ │ │ +191 }; │ │ │ │ │ +192 │ │ │ │ │ +193 // Helper for unpacking Dune::TypeList │ │ │ │ │ +194 template class Target, class TL> │ │ │ │ │ +195 struct UnpackTypeList; │ │ │ │ │ +196 │ │ │ │ │ +197 template class Target, class... T> │ │ │ │ │ +198 struct UnpackTypeList> │ │ │ │ │ +199 { │ │ │ │ │ +200 using type = Target; │ │ │ │ │ +201 }; │ │ │ │ │ +202 │ │ │ │ │ +203 } // namespace Impl │ │ │ │ │ +204 │ │ │ │ │ +209 template class Target, class TL> │ │ │ │ │ +_2_1_0 using _U_n_p_a_c_k_T_y_p_e_L_i_s_t___t = typename Impl::UnpackTypeList::type; │ │ │ │ │ +211 │ │ │ │ │ +219 template class Target, class... T> │ │ │ │ │ +_2_2_0 using _U_n_i_q_u_e_T_y_p_e_s___t = typename Impl::UniqueTypesHelper>::type; │ │ │ │ │ +221 │ │ │ │ │ +227 template │ │ │ │ │ +_2_2_8 using _U_n_i_q_u_e_T_y_p_e_L_i_s_t___t = typename Impl::UniqueTypesHelper::type; │ │ │ │ │ +229 │ │ │ │ │ +235 template │ │ │ │ │ +_2_3_6 constexpr auto _u_n_i_q_u_e_T_y_p_e_L_i_s_t(_T_y_p_e_L_i_s_t_<_T_._._._> list) │ │ │ │ │ +237 { │ │ │ │ │ +238 return typename Impl::UniqueTypesHelper<_T_y_p_e_L_i_s_t, _T_y_p_e_L_i_s_t>::type{}; │ │ │ │ │ +239 } │ │ │ │ │ +240 │ │ │ │ │ +241 │ │ │ │ │ +242 │ │ │ │ │ +243} // namespace Dune │ │ │ │ │ +244 │ │ │ │ │ +245#endif // DUNE_COMMON_TYPELIST_HH │ │ │ │ │ +_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 │ │ │ │ │ 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:44 │ │ │ │ │ -_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:51 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_d_a_t_a__ │ │ │ │ │ -T & data_ │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_t_y_p_e │ │ │ │ │ -MPI_Datatype type() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_p_t_r │ │ │ │ │ -void * ptr() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:68 │ │ │ │ │ -_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:66 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_M_P_I_D_a_t_a │ │ │ │ │ -MPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_g_e_t │ │ │ │ │ -void get() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:90 │ │ │ │ │ -_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:81 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_s_i_z_e │ │ │ │ │ -int size() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_<_ _v_o_i_d_ _>_:_:_p_t_r │ │ │ │ │ -void * ptr() │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:84 │ │ │ │ │ -_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:91 │ │ │ │ │ -_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:108 │ │ │ │ │ -_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:113 │ │ │ │ │ -_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:116 │ │ │ │ │ -_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:131 │ │ │ │ │ -_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:124 │ │ │ │ │ -_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:119 │ │ │ │ │ +_D_u_n_e_:_:_U_n_p_a_c_k_T_y_p_e_L_i_s_t___t │ │ │ │ │ +typename Impl::UnpackTypeList< Target, TL >::type UnpackTypeList_t │ │ │ │ │ +Unpack Dune::TypeList. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:210 │ │ │ │ │ +_D_u_n_e_:_:_u_n_i_q_u_e_T_y_p_e_L_i_s_t │ │ │ │ │ +constexpr auto uniqueTypeList(TypeList< T... > list) │ │ │ │ │ +Remove duplicates from a Dune::TypeList. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:236 │ │ │ │ │ +_D_u_n_e_:_:_U_n_i_q_u_e_T_y_p_e_s___t │ │ │ │ │ +typename Impl::UniqueTypesHelper< Target, TypeList< T... > >::type │ │ │ │ │ +UniqueTypes_t │ │ │ │ │ +Remove duplicates from a list of types. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:220 │ │ │ │ │ +_D_u_n_e_:_:_U_n_i_q_u_e_T_y_p_e_L_i_s_t___t │ │ │ │ │ +typename Impl::UniqueTypesHelper< TypeList, NonUniqueTypeList >::type │ │ │ │ │ +UniqueTypeList_t │ │ │ │ │ +Remove duplicates from a Dune::TypeList. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:228 │ │ │ │ │ +_D_u_n_e_:_:_T_y_p_e_L_i_s_t_E_n_t_r_y___t │ │ │ │ │ +typename TypeListElement< i, T >::type TypeListEntry_t │ │ │ │ │ +Shortcut for TypeListElement::type;. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:171 │ │ │ │ │ +_D_u_n_e_:_:_M_e_t_a_T_y_p_e │ │ │ │ │ +A type that refers to another type. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_M_e_t_a_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ +T type │ │ │ │ │ +The referred-to type. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_I_s_T_y_p_e_L_i_s_t │ │ │ │ │ +Check if given type is a TypeList. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_I_s_E_m_p_t_y_T_y_p_e_L_i_s_t │ │ │ │ │ +Check if given type is an empty TypeList. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:121 │ │ │ │ │ +_D_u_n_e_:_:_T_y_p_e_L_i_s_t_S_i_z_e │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_T_y_p_e_L_i_s_t_E_l_e_m_e_n_t │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_T_y_p_e_L_i_s_t_E_l_e_m_e_n_t_<_ _i_,_ _T_y_p_e_L_i_s_t_<_ _T_._._._ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +typename std::tuple_element< i, std::tuple< T... > >::type type │ │ │ │ │ +Export type of i-th element in TypeList. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_T_y_p_e_L_i_s_t_E_l_e_m_e_n_t_<_ _i_,_ _T_y_p_e_L_i_s_t_<_ _T_._._._ _>_ _>_:_:_T_y_p_e │ │ │ │ │ +type Type │ │ │ │ │ +Export type of i-th element in TypeList. │ │ │ │ │ +DDeeffiinniittiioonn typelist.hh:164 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpi_collective_benchmark.cc File Reference │ │ │ │ +dune-common: extents.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,336 +65,57 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Functions | │ │ │ │ -Variables
│ │ │ │ -
mpi_collective_benchmark.cc File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Typedefs
│ │ │ │ +
extents.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <chrono>
│ │ │ │ -#include <functional>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <iomanip>
│ │ │ │ -#include <string>
│ │ │ │ -#include <thread>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/timer.hh>
│ │ │ │ -#include <dune/common/parametertree.hh>
│ │ │ │ -#include <dune/common/parametertreeparser.hh>
│ │ │ │ -#include <dune/common/parallel/future.hh>
│ │ │ │ -#include <dune/common/parallel/mpihelper.hh>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
#include <array>
│ │ │ │ +#include <cassert>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +#include <dune/common/std/span.hh>
│ │ │ │ +#include <dune/common/std/impl/fwd_layouts.hh>
│ │ │ │ +
│ │ │ │ +

Go to the source code of this file.

│ │ │ │ +

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

│ │ │ │ +Classes

class  Dune::Std::extents< IndexType, exts >
 Multidimensional index space with dynamic and static extents. More...
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ -Variables

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

│ │ │ │ +Namespaces

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

│ │ │ │ +Typedefs

template<class IndexType , std::size_t R>
using Dune::Std::dextents = typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std::size_t, R > >::type
 Alias of extents of given rank R and purely dynamic extents. See [mdspan.extents.dextents].
 
│ │ │ │ -

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

◆ startCommunication()

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -template<class CC >
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
Dune::Future< void > startCommunication (CC & cc)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ -

Variable Documentation

│ │ │ │ - │ │ │ │ -

◆ all_methods

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
std::vector<std::string> all_methods
│ │ │ │ -
│ │ │ │ -Initial value:
= {"allreduce",
│ │ │ │ -
"barrier",
│ │ │ │ -
"broadcast",
│ │ │ │ -
"gather",
│ │ │ │ -
"allgather",
│ │ │ │ -
"scatter"}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

◆ options

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
Dune::ParameterTree 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. 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,151 +1,37 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _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 │ │ │ │ │ -#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_/_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> │ │ │ │ │ -#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_h_e_l_p_e_r_._h_h> │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - void  _c_o_m_m_u_n_i_c_a_t_e (CC &cc) │ │ │ │ │ + * _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 │ │ │ │ │ +extents.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#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_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_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_:_:_S_t_d_:_:_e_x_t_e_n_t_s_<_ _I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_ _> │ │ │ │ │ +  Multidimensional index space with dynamic and static extents. _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_:_:_S_t_d_:_:_d_e_x_t_e_n_t_s = typename Impl::DExtentsImpl< IndexType, std:: │ │ │ │ │ + make_integer_sequence< std::size_t, R > >::type │ │ │ │ │ +  Alias of extents of given rank R and purely dynamic extents. See │ │ │ │ │ + [mdspan.extents.dextents]. │ │ │ │ │   │ │ │ │ │ -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) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - double  _r_u_n_B_l_o_c_k_i_n_g (CC &cc) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - 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/a00041.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpihelper.hh File Reference │ │ │ │ +dune-common: type_traits.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,73 +65,78 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
mpihelper.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Typedefs
│ │ │ │ +
type_traits.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <cassert>
│ │ │ │ -#include <mutex>
│ │ │ │ -#include <mpi.h>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/visibility.hh>
│ │ │ │ -#include <dune/common/parallel/communication.hh>
│ │ │ │ -#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ │ +
#include <type_traits>
│ │ │ │ +#include <dune-common-config.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/typeutilities.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...
struct  Dune::Std::nonesuch
 Type representing a lookup failure by std::detected_or and friends. 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.
 
│ │ │ │ -

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:297
│ │ │ │ -
A real mpi helper.
Definition mpihelper.hh:181
│ │ │ │ -

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,63 +1,71 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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_._._. │ │ │ │ │ -#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_/_v_i_s_i_b_i_l_i_t_y_._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_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> │ │ │ │ │ + * _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 │ │ │ │ │ +type_traits.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> │ │ │ │ │ _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_._._. │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ 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:297 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ -A real mpi helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:181 │ │ │ │ │ -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!) │ │ │ │ │ +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. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpihelper.hh Source File │ │ │ │ +dune-common: type_traits.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,261 +70,184 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpihelper.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 © 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_MPIHELPER_HH
│ │ │ │ -
6#define DUNE_COMMON_PARALLEL_MPIHELPER_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_TYPE_TRAITS_HH
│ │ │ │
7
│ │ │ │ -
8#include <cassert>
│ │ │ │ -
9#include <mutex>
│ │ │ │ -
10
│ │ │ │ -
11#if HAVE_MPI
│ │ │ │ -
12#include <mpi.h>
│ │ │ │ -
13#endif
│ │ │ │ -
14
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
8#include <type_traits>
│ │ │ │ +
9#include <dune-common-config.hh> // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ + │ │ │ │ + │ │ │ │ +
12
│ │ │ │ +
13#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ +
14#include <experimental/type_traits>
│ │ │ │ +
15#endif
│ │ │ │ +
16
│ │ │ │ +
17namespace Dune
│ │ │ │ +
18{
│ │ │ │
19
│ │ │ │ -
20#if HAVE_MPI
│ │ │ │ - │ │ │ │ -
22#endif
│ │ │ │ -
23
│ │ │ │ -
24namespace Dune
│ │ │ │ -
25{
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
76 {
│ │ │ │ -
77 public:
│ │ │ │ -
82 constexpr static bool isFake = true;
│ │ │ │ -
83
│ │ │ │ - │ │ │ │ -
88
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
96 {
│ │ │ │ -
97 static MPICommunicator comm;
│ │ │ │ -
98 return comm;
│ │ │ │ -
99 }
│ │ │ │ -
│ │ │ │ -
100
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
108 {
│ │ │ │ -
109 return getCommunicator();
│ │ │ │ -
110 }
│ │ │ │ -
│ │ │ │ -
111
│ │ │ │ -
112
│ │ │ │ -
113
│ │ │ │ -
119 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
121 {
│ │ │ │ - │ │ │ │ -
123 }
│ │ │ │ -
│ │ │ │ -
124
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
127 {
│ │ │ │ - │ │ │ │ -
129 }
│ │ │ │ -
│ │ │ │ -
130
│ │ │ │ -
│ │ │ │ -
146 DUNE_EXPORT static FakeMPIHelper& instance([[maybe_unused]] int argc,
│ │ │ │ -
147 [[maybe_unused]] char** argv)
│ │ │ │ -
148 {
│ │ │ │ -
149 return instance();
│ │ │ │ -
150 }
│ │ │ │ -
│ │ │ │ -
151
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
153 {
│ │ │ │ -
154 static FakeMPIHelper singleton;
│ │ │ │ -
155 return singleton;
│ │ │ │ -
156 }
│ │ │ │ -
│ │ │ │ -
157
│ │ │ │ -
161 int rank () const { return 0; }
│ │ │ │ -
165 int size () const { return 1; }
│ │ │ │ -
166
│ │ │ │ -
167 private:
│ │ │ │ -
168 FakeMPIHelper() {}
│ │ │ │ -
169 FakeMPIHelper(const FakeMPIHelper&);
│ │ │ │ -
170 FakeMPIHelper& operator=(const FakeMPIHelper);
│ │ │ │ -
171 };
│ │ │ │ -
│ │ │ │ -
172
│ │ │ │ -
173#if HAVE_MPI
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
181 {
│ │ │ │ -
182 public:
│ │ │ │ -
187 constexpr static bool isFake = false;
│ │ │ │ -
188
│ │ │ │ -
192 typedef MPI_Comm MPICommunicator;
│ │ │ │ -
193
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
201 {
│ │ │ │ -
202 return MPI_COMM_WORLD;
│ │ │ │ -
203 }
│ │ │ │ -
│ │ │ │ -
204
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
212 {
│ │ │ │ -
213 return MPI_COMM_SELF;
│ │ │ │ -
214 }
│ │ │ │ -
│ │ │ │ -
215
│ │ │ │ -
221 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
224 {
│ │ │ │ - │ │ │ │ -
226 }
│ │ │ │ -
│ │ │ │ -
227
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
230 {
│ │ │ │ - │ │ │ │ -
232 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
252 DUNE_EXPORT static MPIHelper& instance(int& argc, char**& argv)
│ │ │ │ -
253 {
│ │ │ │ -
254 return instance(&argc, &argv);
│ │ │ │ -
255 }
│ │ │ │ -
│ │ │ │ +
21
│ │ │ │ +
30namespace Std
│ │ │ │ +
31{
│ │ │ │ +
32
│ │ │ │ +
35 using std::bool_constant;
│ │ │ │ +
36
│ │ │ │ +
37#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ +
38
│ │ │ │ +
39 using std::experimental::nonesuch;
│ │ │ │ +
40 using std::experimental::detected_or;
│ │ │ │ +
41 using std::experimental::is_detected;
│ │ │ │ +
42 using std::experimental::detected_t;
│ │ │ │ +
43 using std::experimental::is_detected_v;
│ │ │ │ +
44 using std::experimental::detected_or_t;
│ │ │ │ +
45 using std::experimental::is_detected_exact;
│ │ │ │ +
46 using std::experimental::is_detected_exact_v;
│ │ │ │ +
47 using std::experimental::is_detected_convertible;
│ │ │ │ +
48 using std::experimental::is_detected_convertible_v;
│ │ │ │ +
49
│ │ │ │ +
50#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ +
51
│ │ │ │ +
52 // fallback version of std::experimental::is_detected et al., heavily scribbled
│ │ │ │ +
53 // from cppreference.com (but there is actually not much implementation to the thing)
│ │ │ │ +
54
│ │ │ │ +
55#ifndef DOXYGEN
│ │ │ │ +
56
│ │ │ │ +
57 namespace Impl {
│ │ │ │ +
58
│ │ │ │ +
59 // default version of detector, this gets matched on failure
│ │ │ │ +
60 template<typename Default, typename Void, template<typename...> class Op, typename... Args>
│ │ │ │ +
61 struct detector
│ │ │ │ +
62 {
│ │ │ │ +
63 using value_t = std::false_type;
│ │ │ │ +
64 using type = Default;
│ │ │ │ +
65 };
│ │ │ │ +
66
│ │ │ │ +
67 // specialization of detector that matches if Op<Args...> can be instantiated
│ │ │ │ +
68 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ +
69 struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
│ │ │ │ +
70 {
│ │ │ │ +
71 using value_t = std::true_type;
│ │ │ │ +
72 using type = Op<Args...>;
│ │ │ │ +
73 };
│ │ │ │ +
74
│ │ │ │ +
75 }
│ │ │ │ +
76
│ │ │ │ +
77#endif // DOXYGEN
│ │ │ │ +
78
│ │ │ │ +
80
│ │ │ │ +
│ │ │ │ +
88 struct nonesuch
│ │ │ │ +
89 {
│ │ │ │ +
90 nonesuch() = delete;
│ │ │ │ +
91 ~nonesuch() = delete;
│ │ │ │ +
92 nonesuch(const nonesuch&) = delete;
│ │ │ │ +
93 void operator=(const nonesuch&) = delete;
│ │ │ │ +
94 };
│ │ │ │ +
│ │ │ │ +
95
│ │ │ │ +
97
│ │ │ │ +
131 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ +
132 using detected_or = Impl::detector<Default,void,Op,Args...>;
│ │ │ │ +
133
│ │ │ │ +
135
│ │ │ │ +
144 template<template<typename...> class Op, typename... Args>
│ │ │ │ +
145 using is_detected = typename detected_or<nonesuch,Op,Args...>::value_t;
│ │ │ │ +
146
│ │ │ │ +
147#ifdef __cpp_variable_templates
│ │ │ │ +
149
│ │ │ │ +
158 template<template<typename...> class Op, typename... Args>
│ │ │ │ +
159 constexpr bool is_detected_v = is_detected<Op,Args...>::value;
│ │ │ │ +
160#endif // __cpp_variable_templates
│ │ │ │ +
161
│ │ │ │ +
163
│ │ │ │ +
173 template<template<typename...> class Op, typename... Args>
│ │ │ │ +
174 using detected_t = typename detected_or<nonesuch,Op,Args...>::type;
│ │ │ │ +
175
│ │ │ │ +
176
│ │ │ │ +
178
│ │ │ │ +
188 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ +
189 using detected_or_t = typename detected_or<Default,Op,Args...>::type;
│ │ │ │ +
190
│ │ │ │ +
192
│ │ │ │ +
198 template<typename Expected, template<typename...> class Op, typename... Args>
│ │ │ │ +
199 using is_detected_exact = std::is_same<Expected,detected_t<Op,Args...>>;
│ │ │ │ +
200
│ │ │ │ +
201#ifdef __cpp_variable_templates
│ │ │ │ +
203
│ │ │ │ +
209 template<typename Expected, template<typename...> class Op, typename... Args>
│ │ │ │ +
210 constexpr bool is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value;
│ │ │ │ +
211#endif // __cpp_variable_templates
│ │ │ │ +
212
│ │ │ │ +
214
│ │ │ │ +
220 template<typename Target, template<typename...> class Op, typename... Args>
│ │ │ │ +
221 using is_detected_convertible = std::is_convertible<Target,detected_t<Op,Args...>>;
│ │ │ │ +
222
│ │ │ │ +
223#ifdef __cpp_variable_templates
│ │ │ │ +
225
│ │ │ │ +
231 template<typename Target, template<typename...> class Op, typename... Args>
│ │ │ │ +
232 constexpr bool is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value;
│ │ │ │ +
233#endif // __cpp_variable_templates
│ │ │ │ +
234
│ │ │ │ +
235#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ +
236
│ │ │ │ +
237} // namespace Std
│ │ │ │ +
238
│ │ │ │ +
239
│ │ │ │ +
240namespace detail
│ │ │ │ +
241{
│ │ │ │ +
242 template <class Type>
│ │ │ │ +
243 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code calling `detected_or_fallback_t` for getting the source of this warning!")]]
│ │ │ │ +
244 Type warningIfNotDefined(const Std::nonesuch*);
│ │ │ │ +
245
│ │ │ │ +
246 template <class Type, class T>
│ │ │ │ +
247 Type warningIfNotDefined(const T*);
│ │ │ │ +
248}
│ │ │ │ +
249
│ │ │ │ +
251template <template<typename...> class Fallback,
│ │ │ │ +
252 template<typename...> class TargetType, typename... Args>
│ │ │ │ + │ │ │ │ +
254 detail::warningIfNotDefined<Std::detected_t<Fallback, Args...> >(std::declval<const Std::detected_t<TargetType, Args...>*>())),
│ │ │ │ +
255 TargetType, Args...>;
│ │ │ │
256
│ │ │ │ -
│ │ │ │ -
284 DUNE_EXPORT static MPIHelper& instance(int* argc = nullptr, char*** argv = nullptr)
│ │ │ │ -
285 {
│ │ │ │ -
286 assert((argc == nullptr) == (argv == nullptr));
│ │ │ │ -
287 static MPIHelper instance{argc, argv};
│ │ │ │ -
288 return instance;
│ │ │ │ -
289 }
│ │ │ │ -
│ │ │ │ -
290
│ │ │ │ -
294 int rank () const { return rank_; }
│ │ │ │ -
298 int size () const { return size_; }
│ │ │ │ -
299
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
302 {
│ │ │ │ -
303 int wasFinalized = -1;
│ │ │ │ -
304 MPI_Finalized( &wasFinalized );
│ │ │ │ -
305 if(!wasFinalized && initializedHere_)
│ │ │ │ -
306 {
│ │ │ │ -
307 MPI_Finalize();
│ │ │ │ -
308 dverb << "Called MPI_Finalize on p=" << rank_ << "!" <<std::endl;
│ │ │ │ -
309 }
│ │ │ │ -
310
│ │ │ │ -
311 }
│ │ │ │ -
│ │ │ │ -
312
│ │ │ │ -
313 private:
│ │ │ │ -
314 int rank_;
│ │ │ │ -
315 int size_;
│ │ │ │ -
316 bool initializedHere_;
│ │ │ │ -
317 void prevent_warning(int){}
│ │ │ │ -
318
│ │ │ │ -
320 MPIHelper(int* argc, char*** argv)
│ │ │ │ -
321 : initializedHere_(false)
│ │ │ │ -
322 {
│ │ │ │ -
323 int wasInitialized = -1;
│ │ │ │ -
324 MPI_Initialized( &wasInitialized );
│ │ │ │ -
325 if(!wasInitialized)
│ │ │ │ -
326 {
│ │ │ │ -
327 rank_ = -1;
│ │ │ │ -
328 size_ = -1;
│ │ │ │ -
329 static int is_initialized = MPI_Init(argc, argv);
│ │ │ │ -
330 prevent_warning(is_initialized);
│ │ │ │ -
331 initializedHere_ = true;
│ │ │ │ -
332 }
│ │ │ │ -
333
│ │ │ │ -
334 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
│ │ │ │ -
335 MPI_Comm_size(MPI_COMM_WORLD,&size_);
│ │ │ │ -
336
│ │ │ │ -
337 assert( rank_ >= 0 );
│ │ │ │ -
338 assert( size_ >= 1 );
│ │ │ │ -
339
│ │ │ │ -
340 dverb << "Called MPI_Init on p=" << rank_ << "!" << std::endl;
│ │ │ │ -
341 }
│ │ │ │ -
342
│ │ │ │ -
343 MPIHelper(const MPIHelper&);
│ │ │ │ -
344 MPIHelper& operator=(const MPIHelper);
│ │ │ │ -
345 };
│ │ │ │ -
│ │ │ │ -
346#else // !HAVE_MPI
│ │ │ │ -
347 // We do not have MPI therefore FakeMPIHelper
│ │ │ │ -
348 // is the MPIHelper
│ │ │ │ -
353 typedef FakeMPIHelper MPIHelper;
│ │ │ │ -
354
│ │ │ │ -
355#endif // !HAVE_MPI
│ │ │ │ -
356
│ │ │ │ -
357} // end namespace Dune
│ │ │ │ -
358
│ │ │ │ -
359#endif // DUNE_COMMON_PARALLEL_MPIHELPER_HH
│ │ │ │ -
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 collective communication methods for sequential programs.
│ │ │ │ -
Implements an utility class that provides MPI's collective communication methods.
│ │ │ │ -
Standard Dune debug streams.
│ │ │ │ -
A few common exception classes.
│ │ │ │ -
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition stdstreams.hh:117
│ │ │ │ +
257
│ │ │ │ +
258} // namespace Dune
│ │ │ │ +
259
│ │ │ │ +
260#endif // #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
│ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
Utilities for type computations, constraining overloads, ...
│ │ │ │ +
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:189
│ │ │ │ +
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:199
│ │ │ │ +
typename detected_or< nonesuch, Op, Args... >::type detected_t
Returns Op<Args...> if that is valid; otherwise returns nonesuch.
Definition type_traits.hh:174
│ │ │ │ +
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 detected_or< nonesuch, Op, Args... >::value_t is_detected
Detects whether Op<Args...> is valid.
Definition type_traits.hh:145
│ │ │ │ +
Impl::detector< Default, void, Op, Args... > detected_or
Detects whether Op<Args...> is valid and makes the result available.
Definition type_traits.hh:132
│ │ │ │ +
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:221
│ │ │ │ +
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Definition communication.hh:46
│ │ │ │ -
Collective communication interface and sequential default implementation.
Definition communication.hh:100
│ │ │ │ -
A fake mpi helper.
Definition mpihelper.hh:76
│ │ │ │ -
static DUNE_EXPORT MPICommunicator getCommunicator()
get the default communicator
Definition mpihelper.hh:95
│ │ │ │ -
int size() const
return rank of process, i.e. one
Definition mpihelper.hh:165
│ │ │ │ -
static Communication< MPICommunicator > getCollectiveCommunication()
Definition mpihelper.hh:120
│ │ │ │ -
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition mpihelper.hh:107
│ │ │ │ -
No_Comm MPICommunicator
The type of the mpi communicator.
Definition mpihelper.hh:87
│ │ │ │ -
static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
Get the singleton instance of the helper.
Definition mpihelper.hh:146
│ │ │ │ -
static DUNE_EXPORT FakeMPIHelper & instance()
Definition mpihelper.hh:152
│ │ │ │ -
static Communication< MPICommunicator > getCommunication()
Definition mpihelper.hh:126
│ │ │ │ -
static constexpr bool isFake
Are we fake (i.e. pretend to have MPI support but are compiled without.)
Definition mpihelper.hh:82
│ │ │ │ -
int rank() const
return rank of process, i.e. zero
Definition mpihelper.hh:161
│ │ │ │ -
A real mpi helper.
Definition mpihelper.hh:181
│ │ │ │ -
int size() const
return number of processes
Definition mpihelper.hh:298
│ │ │ │ -
static constexpr bool isFake
Are we fake (i. e. pretend to have MPI support but are compiled without.
Definition mpihelper.hh:187
│ │ │ │ -
static DUNE_EXPORT MPIHelper & instance(int *argc=nullptr, char ***argv=nullptr)
Get the singleton instance of the helper.
Definition mpihelper.hh:284
│ │ │ │ -
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition mpihelper.hh:252
│ │ │ │ -
static Communication< MPICommunicator > getCommunication()
Definition mpihelper.hh:229
│ │ │ │ -
~MPIHelper()
calls MPI_Finalize
Definition mpihelper.hh:301
│ │ │ │ -
int rank() const
return rank of process
Definition mpihelper.hh:294
│ │ │ │ -
MPI_Comm MPICommunicator
The type of the mpi communicator.
Definition mpihelper.hh:192
│ │ │ │ -
static MPICommunicator getCommunicator()
get the default communicator
Definition mpihelper.hh:200
│ │ │ │ -
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition mpihelper.hh:211
│ │ │ │ -
static Communication< MPICommunicator > getCollectiveCommunication()
Definition mpihelper.hh:223
│ │ │ │ +
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:255
│ │ │ │ +
Type representing a lookup failure by std::detected_or and friends.
Definition type_traits.hh:89
│ │ │ │ + │ │ │ │ +
nonesuch(const nonesuch &)=delete
│ │ │ │ +
void operator=(const nonesuch &)=delete
│ │ │ │ + │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,306 +1,228 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpihelper.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 © 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_MPIHELPER_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_MPIHELPER_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_TYPE_TRAITS_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11#if HAVE_MPI │ │ │ │ │ -12#include │ │ │ │ │ -13#endif │ │ │ │ │ -14 │ │ │ │ │ -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_/_v_i_s_i_b_i_l_i_t_y_._h_h> │ │ │ │ │ -17#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> │ │ │ │ │ -18#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> │ │ │ │ │ +8#include │ │ │ │ │ +9#include // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +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#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> │ │ │ │ │ +12 │ │ │ │ │ +13#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +14#include │ │ │ │ │ +15#endif │ │ │ │ │ +16 │ │ │ │ │ +17namespace _D_u_n_e │ │ │ │ │ +18{ │ │ │ │ │ 19 │ │ │ │ │ -20#if HAVE_MPI │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ -22#endif │ │ │ │ │ -23 │ │ │ │ │ -24namespace _D_u_n_e │ │ │ │ │ -25{ │ │ │ │ │ -_7_5 class _F_a_k_e_M_P_I_H_e_l_p_e_r │ │ │ │ │ -76 { │ │ │ │ │ -77 public: │ │ │ │ │ -_8_2 constexpr static bool _i_s_F_a_k_e = true; │ │ │ │ │ -83 │ │ │ │ │ -_8_7 typedef _N_o___C_o_m_m _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ -88 │ │ │ │ │ -_9_5 _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 () │ │ │ │ │ -96 { │ │ │ │ │ -97 static _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r comm; │ │ │ │ │ -98 return comm; │ │ │ │ │ -99 } │ │ │ │ │ -100 │ │ │ │ │ -_1_0_7 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 () │ │ │ │ │ -108 { │ │ │ │ │ -109 return _g_e_t_C_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ -110 } │ │ │ │ │ -111 │ │ │ │ │ -112 │ │ │ │ │ -113 │ │ │ │ │ -119 [[deprecated("getCollectionCommunication is deprecated. Use │ │ │ │ │ -getCommunication instead.")]] │ │ │ │ │ -_1_2_0 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() │ │ │ │ │ -121 { │ │ │ │ │ -122 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()); │ │ │ │ │ -123 } │ │ │ │ │ -124 │ │ │ │ │ -125 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_6 _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ -127 { │ │ │ │ │ -128 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()); │ │ │ │ │ -129 } │ │ │ │ │ -130 │ │ │ │ │ -_1_4_6 _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, │ │ │ │ │ -147 [[maybe_unused]] char** argv) │ │ │ │ │ -148 { │ │ │ │ │ -149 return _i_n_s_t_a_n_c_e(); │ │ │ │ │ -150 } │ │ │ │ │ -151 │ │ │ │ │ -_1_5_2 _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() │ │ │ │ │ -153 { │ │ │ │ │ -154 static _F_a_k_e_M_P_I_H_e_l_p_e_r singleton; │ │ │ │ │ -155 return singleton; │ │ │ │ │ -156 } │ │ │ │ │ -157 │ │ │ │ │ -_1_6_1 int _r_a_n_k () const { return 0; } │ │ │ │ │ -_1_6_5 int _s_i_z_e () const { return 1; } │ │ │ │ │ -166 │ │ │ │ │ -167 private: │ │ │ │ │ -168 _F_a_k_e_M_P_I_H_e_l_p_e_r() {} │ │ │ │ │ -169 FakeMPIHelper(const FakeMPIHelper&); │ │ │ │ │ -170 FakeMPIHelper& operator=(const FakeMPIHelper); │ │ │ │ │ -171 }; │ │ │ │ │ -172 │ │ │ │ │ -173#if HAVE_MPI │ │ │ │ │ -_1_8_0 class _M_P_I_H_e_l_p_e_r │ │ │ │ │ -181 { │ │ │ │ │ -182 public: │ │ │ │ │ -_1_8_7 constexpr static bool _i_s_F_a_k_e = false; │ │ │ │ │ -188 │ │ │ │ │ -_1_9_2 typedef MPI_Comm _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ -193 │ │ │ │ │ -_2_0_0 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 () │ │ │ │ │ -201 { │ │ │ │ │ -202 return MPI_COMM_WORLD; │ │ │ │ │ -203 } │ │ │ │ │ -204 │ │ │ │ │ -_2_1_1 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 () │ │ │ │ │ -212 { │ │ │ │ │ -213 return MPI_COMM_SELF; │ │ │ │ │ -214 } │ │ │ │ │ -215 │ │ │ │ │ -221 [[deprecated("getCollectionCommunication is deprecated. Use │ │ │ │ │ -getCommunication instead.")]] │ │ │ │ │ -222 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_3 _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() │ │ │ │ │ -224 { │ │ │ │ │ -225 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()); │ │ │ │ │ -226 } │ │ │ │ │ -227 │ │ │ │ │ -228 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_9 _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n() │ │ │ │ │ -230 { │ │ │ │ │ -231 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()); │ │ │ │ │ -232 } │ │ │ │ │ -_2_5_2 _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) │ │ │ │ │ -253 { │ │ │ │ │ -254 return _i_n_s_t_a_n_c_e(&argc, &argv); │ │ │ │ │ -255 } │ │ │ │ │ +21 │ │ │ │ │ +30namespace Std │ │ │ │ │ +31{ │ │ │ │ │ +32 │ │ │ │ │ +35 using std::bool_constant; │ │ │ │ │ +36 │ │ │ │ │ +37#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +38 │ │ │ │ │ +39 using std::experimental::nonesuch; │ │ │ │ │ +40 using std::experimental::detected_or; │ │ │ │ │ +41 using std::experimental::is_detected; │ │ │ │ │ +42 using std::experimental::detected_t; │ │ │ │ │ +43 using std::experimental::is_detected_v; │ │ │ │ │ +44 using std::experimental::detected_or_t; │ │ │ │ │ +45 using std::experimental::is_detected_exact; │ │ │ │ │ +46 using std::experimental::is_detected_exact_v; │ │ │ │ │ +47 using std::experimental::is_detected_convertible; │ │ │ │ │ +48 using std::experimental::is_detected_convertible_v; │ │ │ │ │ +49 │ │ │ │ │ +50#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +51 │ │ │ │ │ +52 // fallback version of std::experimental::is_detected et al., heavily │ │ │ │ │ +scribbled │ │ │ │ │ +53 // from cppreference.com (but there is actually not much implementation to │ │ │ │ │ +the thing) │ │ │ │ │ +54 │ │ │ │ │ +55#ifndef DOXYGEN │ │ │ │ │ +56 │ │ │ │ │ +57 namespace Impl { │ │ │ │ │ +58 │ │ │ │ │ +59 // default version of detector, this gets matched on failure │ │ │ │ │ +60 template class Op, │ │ │ │ │ +typename... Args> │ │ │ │ │ +61 struct detector │ │ │ │ │ +62 { │ │ │ │ │ +63 using value_t = std::false_type; │ │ │ │ │ +64 using type = Default; │ │ │ │ │ +65 }; │ │ │ │ │ +66 │ │ │ │ │ +67 // specialization of detector that matches if Op can be │ │ │ │ │ +instantiated │ │ │ │ │ +68 template class Op, typename... Args> │ │ │ │ │ +69 struct detector>, Op, Args...> │ │ │ │ │ +70 { │ │ │ │ │ +71 using value_t = std::true_type; │ │ │ │ │ +72 using type = Op; │ │ │ │ │ +73 }; │ │ │ │ │ +74 │ │ │ │ │ +75 } │ │ │ │ │ +76 │ │ │ │ │ +77#endif // DOXYGEN │ │ │ │ │ +78 │ │ │ │ │ +80 │ │ │ │ │ +_8_8 struct _n_o_n_e_s_u_c_h │ │ │ │ │ +89 { │ │ │ │ │ +_9_0 _n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ +_9_1 _~_n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ +_9_2 _n_o_n_e_s_u_c_h(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ +_9_3 void _o_p_e_r_a_t_o_r_=(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ +94 }; │ │ │ │ │ +95 │ │ │ │ │ +97 │ │ │ │ │ +131 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +_1_3_2 using _d_e_t_e_c_t_e_d___o_r = Impl::detector; │ │ │ │ │ +133 │ │ │ │ │ +135 │ │ │ │ │ +144 template class Op, typename... Args> │ │ │ │ │ +_1_4_5 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; │ │ │ │ │ +146 │ │ │ │ │ +147#ifdef __cpp_variable_templates │ │ │ │ │ +149 │ │ │ │ │ +158 template class Op, typename... Args> │ │ │ │ │ +159 constexpr bool is_detected_v = _i_s___d_e_t_e_c_t_e_d::value; │ │ │ │ │ +160#endif // __cpp_variable_templates │ │ │ │ │ +161 │ │ │ │ │ +163 │ │ │ │ │ +173 template class Op, typename... Args> │ │ │ │ │ +_1_7_4 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; │ │ │ │ │ +175 │ │ │ │ │ +176 │ │ │ │ │ +178 │ │ │ │ │ +188 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +_1_8_9 using _d_e_t_e_c_t_e_d___o_r___t = typename _d_e_t_e_c_t_e_d___o_r::type; │ │ │ │ │ +190 │ │ │ │ │ +192 │ │ │ │ │ +198 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +_1_9_9 using _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t = std::is_same>; │ │ │ │ │ +200 │ │ │ │ │ +201#ifdef __cpp_variable_templates │ │ │ │ │ +203 │ │ │ │ │ +209 template class Op, typename... │ │ │ │ │ +Args> │ │ │ │ │ +210 constexpr bool is_detected_exact_v = │ │ │ │ │ +_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t::value; │ │ │ │ │ +211#endif // __cpp_variable_templates │ │ │ │ │ +212 │ │ │ │ │ +214 │ │ │ │ │ +220 template class Op, typename... Args> │ │ │ │ │ +_2_2_1 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>; │ │ │ │ │ +222 │ │ │ │ │ +223#ifdef __cpp_variable_templates │ │ │ │ │ +225 │ │ │ │ │ +231 template class Op, typename... Args> │ │ │ │ │ +232 constexpr bool is_detected_convertible_v = │ │ │ │ │ +_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e::value; │ │ │ │ │ +233#endif // __cpp_variable_templates │ │ │ │ │ +234 │ │ │ │ │ +235#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ +236 │ │ │ │ │ +237} // namespace Std │ │ │ │ │ +238 │ │ │ │ │ +239 │ │ │ │ │ +240namespace detail │ │ │ │ │ +241{ │ │ │ │ │ +242 template │ │ │ │ │ +243 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code │ │ │ │ │ +calling `detected_or_fallback_t` for getting the source of this warning!")]] │ │ │ │ │ +244 Type warningIfNotDefined(const _S_t_d_:_:_n_o_n_e_s_u_c_h*); │ │ │ │ │ +245 │ │ │ │ │ +246 template │ │ │ │ │ +247 Type warningIfNotDefined(const T*); │ │ │ │ │ +248} │ │ │ │ │ +249 │ │ │ │ │ +251template class Fallback, │ │ │ │ │ +252 template class TargetType, typename... Args> │ │ │ │ │ +_2_5_3using _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*>())), │ │ │ │ │ +255 TargetType, Args...>; │ │ │ │ │ 256 │ │ │ │ │ -_2_8_4 _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 = nullptr, char*** argv = │ │ │ │ │ -nullptr) │ │ │ │ │ -285 { │ │ │ │ │ -286 assert((argc == nullptr) == (argv == nullptr)); │ │ │ │ │ -287 static _M_P_I_H_e_l_p_e_r _i_n_s_t_a_n_c_e{argc, argv}; │ │ │ │ │ -288 return _i_n_s_t_a_n_c_e; │ │ │ │ │ -289 } │ │ │ │ │ -290 │ │ │ │ │ -_2_9_4 int _r_a_n_k () const { return rank_; } │ │ │ │ │ -_2_9_8 int _s_i_z_e () const { return size_; } │ │ │ │ │ -299 │ │ │ │ │ -_3_0_1 _~_M_P_I_H_e_l_p_e_r() │ │ │ │ │ -302 { │ │ │ │ │ -303 int wasFinalized = -1; │ │ │ │ │ -304 MPI_Finalized( &wasFinalized ); │ │ │ │ │ -305 if(!wasFinalized && initializedHere_) │ │ │ │ │ -306 { │ │ │ │ │ -307 MPI_Finalize(); │ │ │ │ │ -308 _d_v_e_r_b << "Called MPI_Finalize on p=" << rank_ << "!" <= 0 ); │ │ │ │ │ -338 assert( size_ >= 1 ); │ │ │ │ │ -339 │ │ │ │ │ -340 _d_v_e_r_b << "Called MPI_Init on p=" << rank_ << "!" << std::endl; │ │ │ │ │ -341 } │ │ │ │ │ -342 │ │ │ │ │ -343 MPIHelper(const MPIHelper&); │ │ │ │ │ -344 MPIHelper& operator=(const MPIHelper); │ │ │ │ │ -345 }; │ │ │ │ │ -346#else // !HAVE_MPI │ │ │ │ │ -347 // We do not have MPI therefore FakeMPIHelper │ │ │ │ │ -348 // is the MPIHelper │ │ │ │ │ -353 typedef FakeMPIHelper MPIHelper; │ │ │ │ │ -354 │ │ │ │ │ -355#endif // !HAVE_MPI │ │ │ │ │ -356 │ │ │ │ │ -357} // end namespace Dune │ │ │ │ │ -358 │ │ │ │ │ -359#endif // DUNE_COMMON_PARALLEL_MPIHELPER_HH │ │ │ │ │ -_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 │ │ │ │ │ -_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. │ │ │ │ │ -_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_:_:_d_v_e_r_b │ │ │ │ │ -DVerbType dverb(std::cout) │ │ │ │ │ -Singleton of verbose debug stream. │ │ │ │ │ -DDeeffiinniittiioonn stdstreams.hh:117 │ │ │ │ │ +257 │ │ │ │ │ +258} // namespace Dune │ │ │ │ │ +259 │ │ │ │ │ +260#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_:_:_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:189 │ │ │ │ │ +_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:199 │ │ │ │ │ +_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:174 │ │ │ │ │ +_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 │ │ │ │ │ +typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ +Detects whether Op is valid. │ │ │ │ │ +DDeeffiinniittiioonn type_traits.hh:145 │ │ │ │ │ +_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:132 │ │ │ │ │ +_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 getCollectiveCommunication() │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:120 │ │ │ │ │ -_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:107 │ │ │ │ │ -_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:87 │ │ │ │ │ -_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:146 │ │ │ │ │ -_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:152 │ │ │ │ │ -_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:126 │ │ │ │ │ -_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:82 │ │ │ │ │ -_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:161 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ -A real mpi helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:181 │ │ │ │ │ -_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:298 │ │ │ │ │ -_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:187 │ │ │ │ │ -_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=nullptr, char │ │ │ │ │ -***argv=nullptr) │ │ │ │ │ -Get the singleton instance of the helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:284 │ │ │ │ │ -_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:252 │ │ │ │ │ -_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:229 │ │ │ │ │ -_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:301 │ │ │ │ │ -_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:294 │ │ │ │ │ -_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:192 │ │ │ │ │ -_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:200 │ │ │ │ │ -_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:211 │ │ │ │ │ -_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:223 │ │ │ │ │ +_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: communicator.hh File Reference │ │ │ │ +dune-common: memory.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,73 +65,46 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
memory.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <cassert>
│ │ │ │ -#include <cstddef>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <map>
│ │ │ │ +
#include <memory>
│ │ │ │ #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>
│ │ │ │ +#include <dune/common/typeutilities.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...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<class T >
constexpr auto Dune::Std::to_address (T &&p) noexcept
 Obtain the address represented by p without forming a reference to the object pointed to by p.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Provides utility classes for syncing distributed data via MPI communication.

│ │ │ │ -
Author
Markus Blatt
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,59 +1,28 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +memory.hh File Reference │ │ │ │ │ +#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_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_/_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_:_:_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_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides utility classes for syncing distributed data via MPI communication. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_S_t_d_:_:_t_o___a_d_d_r_e_s_s (T &&p) noexcept │ │ │ │ │ +  Obtain the address represented by p without forming a reference │ │ │ │ │ + to the object pointed to by p. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: communicator.hh Source File │ │ │ │ +dune-common: memory.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1040 +70,82 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
communicator.hh
│ │ │ │ +
memory.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 © 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_COMMUNICATOR_HH
│ │ │ │ -
6#define DUNE_COMMON_PARALLEL_COMMUNICATOR_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_MEMORY_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_MEMORY_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 <memory>
│ │ │ │ +
9#include <type_traits>
│ │ │ │ +
10
│ │ │ │ + │ │ │ │ +
12
│ │ │ │ +
13namespace Dune::Std {
│ │ │ │ +
14
│ │ │ │ +
15#if __cpp_lib_to_address >= 201711L
│ │ │ │
16
│ │ │ │ -
17#include <mpi.h>
│ │ │ │ +
17using std::to_address;
│ │ │ │
18
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
23
│ │ │ │ -
24namespace Dune
│ │ │ │ +
19#else
│ │ │ │ +
20
│ │ │ │ +
21namespace Impl {
│ │ │ │ +
22
│ │ │ │ +
23template <class T>
│ │ │ │ +
24constexpr T* toAddressImpl (T* p, Dune::PriorityTag<2>) noexcept
│ │ │ │
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#endif // DUNE_COMMON_PARALLEL_COMMUNICATOR_HH
│ │ │ │ -
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:96
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
│ │ │ │ -
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:44
│ │ │ │ -
Information describing an interface.
Definition parallel/interface.hh:110
│ │ │ │ -
Communication interface between remote and local indices.
Definition parallel/interface.hh:218
│ │ │ │ -
An index present on the local process.
Definition localindex.hh:35
│ │ │ │ -
The indices present on remote processes.
Definition remoteindices.hh:190
│ │ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition remoteindices.hh:216
│ │ │ │ -
LocalIndex::Attribute Attribute
The type of the attribute.
Definition remoteindices.hh:227
│ │ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition remoteindices.hh:222
│ │ │ │ -
Provides classes for building the communication interface between remote indices.
│ │ │ │ +
26 static_assert(!std::is_function_v<T>);
│ │ │ │ +
27 return p;
│ │ │ │ +
28}
│ │ │ │ +
29
│ │ │ │ +
30template <class T>
│ │ │ │ +
31constexpr auto toAddressImpl (const T& p, Dune::PriorityTag<1>) noexcept
│ │ │ │ +
32 -> decltype(std::pointer_traits<T>::to_address(p))
│ │ │ │ +
33{
│ │ │ │ +
34 return std::pointer_traits<T>::to_address(p);
│ │ │ │ +
35}
│ │ │ │ +
36
│ │ │ │ +
37template <class T>
│ │ │ │ +
38constexpr auto toAddressImpl (const T& p, Dune::PriorityTag<0>) noexcept
│ │ │ │ +
39{
│ │ │ │ +
40 return toAddressImpl(p.operator->(), Dune::PriorityTag<3>{});
│ │ │ │ +
41}
│ │ │ │ +
42
│ │ │ │ +
43} // end namespace Impl
│ │ │ │ +
44
│ │ │ │ +
46template <class T>
│ │ │ │ +
│ │ │ │ +
47constexpr auto to_address(T&& p) noexcept
│ │ │ │ +
48{
│ │ │ │ +
49 return Impl::toAddressImpl(std::forward<T>(p), Dune::PriorityTag<3>{});
│ │ │ │ +
50}
│ │ │ │ +
│ │ │ │ +
51
│ │ │ │ +
52#endif
│ │ │ │ +
53
│ │ │ │ +
54} // end namespace Dune::Std
│ │ │ │ +
55
│ │ │ │ +
56#endif // DUNE_COMMON_STD_MEMORY_HH
│ │ │ │ +
Utilities for type computations, constraining overloads, ...
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
constexpr auto to_address(T &&p) noexcept
Obtain the address represented by p without forming a reference to the object pointed to by p.
Definition memory.hh:47
│ │ │ │ +
Helper class for tagging priorities.
Definition typeutilities.hh:73
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1206 +1,80 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -communicator.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +memory.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 © 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_COMMUNICATOR_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_COMMUNICATOR_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_MEMORY_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_MEMORY_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_/_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +12 │ │ │ │ │ +13namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +14 │ │ │ │ │ +15#if __cpp_lib_to_address >= 201711L │ │ │ │ │ 16 │ │ │ │ │ -17#include │ │ │ │ │ +17using std::to_address; │ │ │ │ │ 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 │ │ │ │ │ +19#else │ │ │ │ │ +20 │ │ │ │ │ +21namespace Impl { │ │ │ │ │ +22 │ │ │ │ │ +23template │ │ │ │ │ +24constexpr T* toAddressImpl (T* p, _D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_2_>) noexcept │ │ │ │ │ 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 _s_i_z_e) │ │ │ │ │ -836 : start_(start), size_(_s_i_z_e) │ │ │ │ │ -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 _s_i_z_e = forward ? interfacePair->second.first.size() : │ │ │ │ │ -1265 interfacePair->second.second.size(); │ │ │ │ │ -1266 │ │ │ │ │ -1267 for(int i=0; i < _s_i_z_e; 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 _s_i_z_e = FORWARD ? interfacePair->second.first.size() : │ │ │ │ │ -1299 interfacePair->second.second.size(); │ │ │ │ │ -1300 │ │ │ │ │ -1301 for(size_t i=0; i < _s_i_z_e; 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#endif // DUNE_COMMON_PARALLEL_COMMUNICATOR_HH │ │ │ │ │ -_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:96 │ │ │ │ │ -_D_u_n_e │ │ │ │ │ -Dune namespace. │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_s_i_z_e │ │ │ │ │ -constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std:: │ │ │ │ │ -integer_sequence< T, II... >) │ │ │ │ │ -Return the size of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn integersequence.hh:75 │ │ │ │ │ -_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:44 │ │ │ │ │ -_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:110 │ │ │ │ │ -_D_u_n_e_:_:_I_n_t_e_r_f_a_c_e │ │ │ │ │ -Communication interface between remote and local indices. │ │ │ │ │ -DDeeffiinniittiioonn parallel/interface.hh:218 │ │ │ │ │ -_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:190 │ │ │ │ │ -_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:216 │ │ │ │ │ -_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:227 │ │ │ │ │ -_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:222 │ │ │ │ │ -_i_n_t_e_r_f_a_c_e_._h_h │ │ │ │ │ -Provides classes for building the communication interface between remote │ │ │ │ │ -indices. │ │ │ │ │ +26 static_assert(!std::is_function_v); │ │ │ │ │ +27 return p; │ │ │ │ │ +28} │ │ │ │ │ +29 │ │ │ │ │ +30template │ │ │ │ │ +31constexpr auto toAddressImpl (const T& p, _D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_1_>) noexcept │ │ │ │ │ +32 -> decltype(std::pointer_traits::to_address(p)) │ │ │ │ │ +33{ │ │ │ │ │ +34 return std::pointer_traits::to_address(p); │ │ │ │ │ +35} │ │ │ │ │ +36 │ │ │ │ │ +37template │ │ │ │ │ +38constexpr auto toAddressImpl (const T& p, _D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_0_>) noexcept │ │ │ │ │ +39{ │ │ │ │ │ +40 return toAddressImpl(p.operator->(), _D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_3_>{}); │ │ │ │ │ +41} │ │ │ │ │ +42 │ │ │ │ │ +43} // end namespace Impl │ │ │ │ │ +44 │ │ │ │ │ +46template │ │ │ │ │ +_4_7constexpr auto _t_o___a_d_d_r_e_s_s(T&& p) noexcept │ │ │ │ │ +48{ │ │ │ │ │ +49 return Impl::toAddressImpl(std::forward(p), _D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_3_>{}); │ │ │ │ │ +50} │ │ │ │ │ +51 │ │ │ │ │ +52#endif │ │ │ │ │ +53 │ │ │ │ │ +54} // end namespace Dune::Std │ │ │ │ │ +55 │ │ │ │ │ +56#endif // DUNE_COMMON_STD_MEMORY_HH │ │ │ │ │ +_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 │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_t_o___a_d_d_r_e_s_s │ │ │ │ │ +constexpr auto to_address(T &&p) noexcept │ │ │ │ │ +Obtain the address represented by p without forming a reference to the object │ │ │ │ │ +pointed to by p. │ │ │ │ │ +DDeeffiinniittiioonn memory.hh:47 │ │ │ │ │ +_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/a00047.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: parmetis.hh File Reference │ │ │ │ +dune-common: span.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,23 +65,84 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
parmetis.hh File Reference
│ │ │ │ +
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
span.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ +
#include <cassert>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <exception>
│ │ │ │ +#include <iterator>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <stdexcept>
│ │ │ │ +#include <string>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/std/memory.hh>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::Std::span< Element, Extent >
 A contiguous sequence of elements with static or dynamic extent. More...
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Namespaces

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

│ │ │ │ +Functions

template<class T , std::size_t N>
 Dune::Std::span (T(&)[N]) -> span< T, N >
 
template<class ElementType , class I , std::size_t Extent, std::enable_if_t< std::is_convertible_v< I, std::size_t >, int > = 0>
 Dune::Std::span (ElementType *, std::integral_constant< I, Extent >) -> span< ElementType, Extent >
 
template<class ElementType , class I , std::enable_if_t< std::is_integral_v< I >, int > = 0, std::enable_if_t< std::is_convertible_v< I, std::size_t >, int > = 0>
 Dune::Std::span (ElementType *, I) -> span< ElementType, Std::dynamic_extent >
 
template<class Iter , class Element = std::remove_reference_t<decltype(*std::declval<Iter>())>>
 Dune::Std::span (Iter, Iter) -> span< Element, Std::dynamic_extent >
 
template<class Range , class First = decltype(std::begin(std::declval<Range>())), class Last = decltype(std::end(std::declval<Range>())), class Element = std::remove_reference_t<decltype(*std::declval<First>())>>
 Dune::Std::span (Range &) -> span< Element, Std::dynamic_extent >
 
template<class T , size_t N>
 Dune::Std::span (std::array< T, N > &) -> span< T, N >
 
template<class T , size_t N>
 Dune::Std::span (const std::array< T, N > &) -> span< const T, N >
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Variables

constexpr std::size_t Dune::Std::dynamic_extent = std::numeric_limits<std::size_t>::max()
 A constant of type std::size_t that is used to differentiate std::span of static and dynamic extent.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,11 +1,70 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -parmetis.hh File Reference │ │ │ │ │ + * _s_t_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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +span.hh File Reference │ │ │ │ │ +#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> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ +CCllaasssseess │ │ │ │ │ +class   _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_<_ _E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_ _> │ │ │ │ │ +  A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ + _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. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (T(&)[N]) -> _s_p_a_n< T, N > │ │ │ │ │ +  │ │ │ │ │ +template, int > = 0> │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (ElementType *, std::integral_constant< I, Extent >) -> _s_p_a_n< │ │ │ │ │ + ElementType, Extent > │ │ │ │ │ +  │ │ │ │ │ +template, int > = 0, std::enable_if_t< std::is_convertible_v< I, std::size_t >, int > │ │ │ │ │ += 0> │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (ElementType *, I) -> _s_p_a_n< ElementType, _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t │ │ │ │ │ + > │ │ │ │ │ +  │ │ │ │ │ +template())>> │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (Iter, Iter) -> _s_p_a_n< Element, _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +())), class Last = decltype(std::end(std::declval())), class Element = │ │ │ │ │ +std::remove_reference_t())>> │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (Range &) -> _s_p_a_n< Element, _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (std::array< T, N > &) -> _s_p_a_n< T, N > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (const std::array< T, N > &) -> _s_p_a_n< const T, N > │ │ │ │ │ +  │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ +constexpr std::size_t  _D_u_n_e_:_:_S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t = std::numeric_limits::max() │ │ │ │ │ +  A constant of type std::size_t that is used to │ │ │ │ │ + differentiate std::span of static and dynamic extent. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: parmetis.hh Source File │ │ │ │ +dune-common: span.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,65 +70,464 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
parmetis.hh
│ │ │ │ +
span.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 © 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_PARMETIS_HH
│ │ │ │ -
6#define DUNE_PARMETIS_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_SPAN_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_SPAN_HH
│ │ │ │
7
│ │ │ │ -
15#if HAVE_PARMETIS
│ │ │ │ -
16
│ │ │ │ -
17#if HAVE_MPI
│ │ │ │ -
18#include <mpi.h>
│ │ │ │ -
19#endif
│ │ │ │ -
20
│ │ │ │ -
21#if HAVE_PTSCOTCH_PARMETIS
│ │ │ │ -
22extern "C" {
│ │ │ │ -
23 #include <ptscotch.h>
│ │ │ │ -
24}
│ │ │ │ -
25#endif
│ │ │ │ -
26
│ │ │ │ -
27extern "C" {
│ │ │ │ -
28 #include <parmetis.h>
│ │ │ │ -
29}
│ │ │ │ -
30
│ │ │ │ -
31namespace Dune::ParMetis {
│ │ │ │ -
32
│ │ │ │ -
33#if defined(REALTYPEWIDTH)
│ │ │ │ -
34 using real_t = ::real_t;
│ │ │ │ -
35#else
│ │ │ │ -
36 using real_t = float;
│ │ │ │ -
37#endif
│ │ │ │ +
8#include <cassert>
│ │ │ │ +
9#include <cstddef>
│ │ │ │ +
10#include <exception>
│ │ │ │ +
11#include <iterator>
│ │ │ │ +
12#include <limits>
│ │ │ │ +
13#include <stdexcept>
│ │ │ │ +
14#include <string>
│ │ │ │ +
15#include <type_traits>
│ │ │ │ +
16#if __has_include(<version>)
│ │ │ │ +
17 #include <version>
│ │ │ │ +
18#endif
│ │ │ │ +
19
│ │ │ │ + │ │ │ │ + │ │ │ │ +
22
│ │ │ │ +
23namespace Dune::Std {
│ │ │ │ +
24
│ │ │ │ +
26inline constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max();
│ │ │ │ +
27
│ │ │ │ +
28namespace Impl {
│ │ │ │ +
29
│ │ │ │ +
30template <std::size_t Extent>
│ │ │ │ +
31class SpanSize
│ │ │ │ +
32{
│ │ │ │ +
33public:
│ │ │ │ +
34 using size_type = std::size_t;
│ │ │ │ +
35
│ │ │ │ +
36public:
│ │ │ │ +
37 constexpr SpanSize () = default;
│ │ │ │
38
│ │ │ │ -
39#if defined(IDXTYPEWIDTH)
│ │ │ │ -
40 using idx_t = ::idx_t;
│ │ │ │ -
41#elif HAVE_PTSCOTCH_PARMETIS
│ │ │ │ -
42 using idx_t = SCOTCH_Num;
│ │ │ │ -
43#else
│ │ │ │ -
44 using idx_t = int;
│ │ │ │ -
45#endif
│ │ │ │ -
46
│ │ │ │ -
47} // end namespace Dune::ParMetis
│ │ │ │ -
48
│ │ │ │ -
49#endif // HAVE_PARMETIS
│ │ │ │ -
50#endif // DUNE_PARMETIS_HH
│ │ │ │ -
typename FieldTraits< Type >::real_type real_t
Convenient access to FieldTraits<Type>::real_type.
Definition typetraits.hh:301
│ │ │ │ +
39 constexpr SpanSize ([[maybe_unused]] size_type size) noexcept
│ │ │ │ +
40 {
│ │ │ │ +
41 assert(Extent == Std::dynamic_extent || Extent == size);
│ │ │ │ +
42 }
│ │ │ │ +
43
│ │ │ │ +
44 template <class Iter>
│ │ │ │ +
45 constexpr SpanSize ([[maybe_unused]] Iter first, [[maybe_unused]] Iter last) noexcept
│ │ │ │ +
46 {
│ │ │ │ +
47 assert((std::distance(first,last) == Extent));
│ │ │ │ +
48 }
│ │ │ │ +
49
│ │ │ │ +
50 constexpr size_type size () const noexcept { return Extent; }
│ │ │ │ +
51};
│ │ │ │ +
52
│ │ │ │ +
53template <>
│ │ │ │ +
54class SpanSize<Std::dynamic_extent>
│ │ │ │ +
55{
│ │ │ │ +
56public:
│ │ │ │ +
57 using size_type = std::size_t;
│ │ │ │ +
58
│ │ │ │ +
59public:
│ │ │ │ +
60 constexpr SpanSize (size_type size = 0) noexcept
│ │ │ │ +
61 : size_(size)
│ │ │ │ +
62 {}
│ │ │ │ +
63
│ │ │ │ +
64 template <class Iter>
│ │ │ │ +
65 constexpr SpanSize (Iter first, Iter last) noexcept
│ │ │ │ +
66 : size_(std::distance(first,last))
│ │ │ │ +
67 {}
│ │ │ │ +
68
│ │ │ │ +
69 constexpr size_type size () const noexcept { return size_; }
│ │ │ │ +
70
│ │ │ │ +
71private:
│ │ │ │ +
72 size_type size_;
│ │ │ │ +
73};
│ │ │ │ +
74
│ │ │ │ +
75template <class T>
│ │ │ │ +
76struct TypeIdentity { using type = T; };
│ │ │ │ +
77
│ │ │ │ +
78template <class T>
│ │ │ │ +
79using TypeIdentity_t = typename TypeIdentity<T>::type;
│ │ │ │ +
80
│ │ │ │ +
81} // end namespace Impl
│ │ │ │ +
82
│ │ │ │ +
83
│ │ │ │ +
123template <class Element, std::size_t Extent = Std::dynamic_extent>
│ │ │ │ +
│ │ │ │ +
124class span
│ │ │ │ +
125 : public Impl::SpanSize<Extent>
│ │ │ │ +
126{
│ │ │ │ +
127 using base_type = Impl::SpanSize<Extent>; // base_type implements the member variable size()
│ │ │ │ +
128
│ │ │ │ +
129 static_assert(std::is_object_v<Element> && !std::is_abstract_v<Element>);
│ │ │ │ +
130
│ │ │ │ +
131public:
│ │ │ │ +
132 using element_type = Element;
│ │ │ │ +
133 using value_type = std::remove_cv_t<element_type>;
│ │ │ │ +
134 using size_type = std::size_t;
│ │ │ │ +
135 using difference_type = std::ptrdiff_t;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
140 using reverse_iterator = std::reverse_iterator<iterator>;
│ │ │ │ +
141#if __cpp_lib_ranges_as_const >202311L
│ │ │ │ +
142 using const_iterator = std::const_iterator<iterator>;
│ │ │ │ +
143 using const_reverse_iterator = std::const_iterator<reverse_iterator>;
│ │ │ │ +
144#else
│ │ │ │ + │ │ │ │ +
146 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
│ │ │ │ +
147#endif
│ │ │ │ +
148
│ │ │ │ +
149
│ │ │ │ +
150 static constexpr size_type extent = Extent;
│ │ │ │ +
151
│ │ │ │ +
152public:
│ │ │ │ +
155
│ │ │ │ +
157 template <std::size_t e = extent,
│ │ │ │ +
158 std::enable_if_t<(e == dynamic_extent || e == 0), int> = 0>
│ │ │ │ +
│ │ │ │ +
159 constexpr span () noexcept
│ │ │ │ +
160 : base_type{}
│ │ │ │ +
161 , data_{}
│ │ │ │ +
162 {}
│ │ │ │ +
│ │ │ │ +
163
│ │ │ │ +
165 template <class Iter,
│ │ │ │ +
166 class U = std::remove_reference_t<decltype(*std::declval<Iter>())>,
│ │ │ │ +
167 std::enable_if_t<std::is_convertible_v<U(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ +
168 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
169 explicit(extent != Std::dynamic_extent)
│ │ │ │ +
170 #endif
│ │ │ │ +
│ │ │ │ +
171 constexpr span (Iter first, size_type size)
│ │ │ │ +
172 : base_type(size)
│ │ │ │ +
173 , data_(Std::to_address(first))
│ │ │ │ +
174 {}
│ │ │ │ +
│ │ │ │ +
175
│ │ │ │ +
177 template <class Iter,
│ │ │ │ +
178 class U = std::remove_reference_t<decltype(*std::declval<Iter>())>,
│ │ │ │ +
179 std::enable_if_t<std::is_convertible_v<U(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ +
180 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
181 explicit(extent != Std::dynamic_extent)
│ │ │ │ +
182 #endif
│ │ │ │ +
│ │ │ │ +
183 constexpr span (Iter first, Iter last)
│ │ │ │ +
184 : base_type(first,last)
│ │ │ │ +
185 , data_(Std::to_address(first))
│ │ │ │ +
186 {}
│ │ │ │ +
│ │ │ │ +
187
│ │ │ │ +
189 template <class Range,
│ │ │ │ +
190 decltype(std::begin(std::declval<Range>()), std::end(std::declval<Range>()), bool{}) = true,
│ │ │ │ +
191 std::enable_if_t<not std::is_array_v<Range>, int> = 0>
│ │ │ │ +
192 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
193 explicit(extent != Std::dynamic_extent)
│ │ │ │ +
194 #endif
│ │ │ │ +
│ │ │ │ +
195 constexpr span (Range& range)
│ │ │ │ +
196 : span(std::begin(range), std::end(range))
│ │ │ │ +
197 {}
│ │ │ │ +
│ │ │ │ +
198
│ │ │ │ +
200 template <std::size_t N, std::size_t e = extent,
│ │ │ │ +
201 std::enable_if_t<(e == Std::dynamic_extent || e == N), int> = 0>
│ │ │ │ +
│ │ │ │ +
202 constexpr span (Impl::TypeIdentity_t<element_type> (&data)[N]) noexcept
│ │ │ │ +
203 : base_type(N)
│ │ │ │ +
204 , data_(data)
│ │ │ │ +
205 {}
│ │ │ │ +
│ │ │ │ +
206
│ │ │ │ +
208 template <class T, size_t N, std::size_t e = extent,
│ │ │ │ +
209 std::enable_if_t<(e == Std::dynamic_extent || e == N), int> = 0,
│ │ │ │ +
210 std::enable_if_t<std::is_convertible_v<T(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ +
│ │ │ │ +
211 constexpr span (std::array<T, N>& arr) noexcept
│ │ │ │ +
212 : base_type(N)
│ │ │ │ +
213 , data_(arr.data())
│ │ │ │ +
214 {}
│ │ │ │ +
│ │ │ │ +
215
│ │ │ │ +
217 template <class T, size_t N, std::size_t e = extent,
│ │ │ │ +
218 std::enable_if_t<(e == Std::dynamic_extent || e == N), int> = 0,
│ │ │ │ +
219 std::enable_if_t<std::is_convertible_v<const T(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ +
│ │ │ │ +
220 constexpr span (const std::array<T, N>& arr) noexcept
│ │ │ │ +
221 : base_type(N)
│ │ │ │ +
222 , data_(arr.data())
│ │ │ │ +
223 {}
│ │ │ │ +
│ │ │ │ +
224
│ │ │ │ +
226 template <class E = element_type,
│ │ │ │ +
227 std::enable_if_t<std::is_const_v<E>, int> = 0>
│ │ │ │ +
228 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
229 explicit(extent != Std::dynamic_extent)
│ │ │ │ +
230 #endif
│ │ │ │ +
│ │ │ │ +
231 constexpr span (std::initializer_list<value_type> il)
│ │ │ │ +
232 : base_type(il.size())
│ │ │ │ +
233 , data_(il.begin())
│ │ │ │ +
234 {}
│ │ │ │ +
│ │ │ │ +
235
│ │ │ │ +
237 constexpr span (const span& other) noexcept = default;
│ │ │ │ +
238
│ │ │ │ +
240 template <class OtherElementType, std::size_t OtherExtent,
│ │ │ │ +
241 std::enable_if_t<(extent == Std::dynamic_extent || OtherExtent == Std::dynamic_extent || extent == OtherExtent), int> = 0,
│ │ │ │ +
242 std::enable_if_t<std::is_convertible_v<OtherElementType(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ +
243 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
244 explicit(extent != Std::dynamic_extent && OtherExtent == Std::dynamic_extent)
│ │ │ │ +
245 #endif
│ │ │ │ +
│ │ │ │ +
246 constexpr span (const span<OtherElementType, OtherExtent>& s) noexcept
│ │ │ │ +
247 : base_type(s.size())
│ │ │ │ +
248 , data_(s.data())
│ │ │ │ +
249 {}
│ │ │ │ +
│ │ │ │ +
250
│ │ │ │ +
252 constexpr span& operator= (const span& other) noexcept = default;
│ │ │ │ +
253
│ │ │ │ +
255
│ │ │ │ +
256
│ │ │ │ +
259
│ │ │ │ +
261 constexpr iterator begin () const noexcept { return data_; }
│ │ │ │ +
262
│ │ │ │ +
264 constexpr iterator end () const noexcept { return data_ + size(); }
│ │ │ │ +
265
│ │ │ │ +
267 constexpr const_iterator cbegin () const noexcept { return data_; }
│ │ │ │ +
268
│ │ │ │ +
270 constexpr const_iterator cend () const noexcept { return data_ + size(); }
│ │ │ │ +
271
│ │ │ │ +
273 constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator{end()}; }
│ │ │ │ +
274
│ │ │ │ +
276 constexpr reverse_iterator rend() const noexcept { return reverse_iterator{begin()}; }
│ │ │ │ +
277
│ │ │ │ +
279 constexpr const_reverse_iterator crbegin() const noexcept { return reverse_iterator{end()}; }
│ │ │ │ +
280
│ │ │ │ +
282 constexpr const_reverse_iterator crend() const noexcept { return reverse_iterator{begin()}; }
│ │ │ │ +
283
│ │ │ │ +
285
│ │ │ │ +
286
│ │ │ │ +
289
│ │ │ │ +
│ │ │ │ +
291 constexpr reference front () const
│ │ │ │ +
292 {
│ │ │ │ +
293 assert(not empty() && "front of empty span does not exist");
│ │ │ │ +
294 return data_[0];
│ │ │ │ +
295 }
│ │ │ │ +
│ │ │ │ +
296
│ │ │ │ +
│ │ │ │ +
298 constexpr reference back () const
│ │ │ │ +
299 {
│ │ │ │ +
300 assert(not empty() && "front of empty span does not exist");
│ │ │ │ +
301 return data_[size()-1];
│ │ │ │ +
302 }
│ │ │ │ +
│ │ │ │ +
303
│ │ │ │ +
│ │ │ │ +
305 constexpr reference at (size_type i) const
│ │ │ │ +
306 {
│ │ │ │ +
307 if (i >= size())
│ │ │ │ +
308 throw std::out_of_range("Index " + std::to_string(i) + " out of range.");
│ │ │ │ +
309 return data_[i];
│ │ │ │ +
310 }
│ │ │ │ +
│ │ │ │ +
311
│ │ │ │ +
313 constexpr reference operator[] (size_type i) const { return data_[i]; }
│ │ │ │ +
314
│ │ │ │ +
316 constexpr pointer data () const noexcept { return data_; }
│ │ │ │ +
317
│ │ │ │ +
319
│ │ │ │ +
320
│ │ │ │ +
323
│ │ │ │ +
325 template <std::size_t Count>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
327 {
│ │ │ │ +
328 static_assert(Count <= Extent);
│ │ │ │ +
329 assert(Count <= size());
│ │ │ │ +
330 return span<element_type, Count>{data(), Count};
│ │ │ │ +
331 }
│ │ │ │ +
│ │ │ │ +
332
│ │ │ │ +
334 template <std::size_t Count>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
336 {
│ │ │ │ +
337 static_assert(Count <= Extent);
│ │ │ │ +
338 assert(Count <= size());
│ │ │ │ +
339 return span<element_type, Count>{data()+ (size() - Count), Count};
│ │ │ │ +
340 }
│ │ │ │ +
│ │ │ │ +
341
│ │ │ │ +
342private:
│ │ │ │ +
343
│ │ │ │ +
344 static constexpr std::size_t subspan_extent (std::size_t O, std::size_t C) noexcept
│ │ │ │ +
345 {
│ │ │ │ +
346 return (C != Std::dynamic_extent) ? C :
│ │ │ │ +
347 (Extent != Std::dynamic_extent) ? Extent - O : Std::dynamic_extent;
│ │ │ │ +
348 }
│ │ │ │ +
349
│ │ │ │ +
350public:
│ │ │ │ +
351
│ │ │ │ +
353
│ │ │ │ +
357 template <std::size_t Offset, std::size_t Count = Std::dynamic_extent>
│ │ │ │ +
│ │ │ │ +
358 constexpr span<element_type, subspan_extent(Offset,Count)> subspan () const
│ │ │ │ +
359 {
│ │ │ │ +
360 static_assert(Offset <= Extent && (Count == Std::dynamic_extent || Count <= Extent - Offset));
│ │ │ │ +
361 assert(Offset <= size() && (Count == Std::dynamic_extent || Count <= size() - Offset));
│ │ │ │ +
362 return span<element_type, subspan_extent(Offset,Count)>{
│ │ │ │ +
363 data() + Offset, Count != Std::dynamic_extent ? Count : size() - Offset};
│ │ │ │ +
364 }
│ │ │ │ +
│ │ │ │ +
365
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
368 {
│ │ │ │ +
369 assert(count <= size());
│ │ │ │ + │ │ │ │ +
371 }
│ │ │ │ +
│ │ │ │ +
372
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
375 {
│ │ │ │ +
376 assert(count <= size());
│ │ │ │ +
377 return span<element_type, Std::dynamic_extent>{data()+ (size() - count), count};
│ │ │ │ +
378 }
│ │ │ │ +
│ │ │ │ +
379
│ │ │ │ +
381
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
386 {
│ │ │ │ +
387 assert(offset <= size() && (count == Std::dynamic_extent || count <= size() - offset));
│ │ │ │ + │ │ │ │ +
389 data() + offset, count == Std::dynamic_extent ? size() - offset : count};
│ │ │ │ +
390 }
│ │ │ │ +
│ │ │ │ +
391
│ │ │ │ +
393
│ │ │ │ +
394
│ │ │ │ +
397
│ │ │ │ +
399 using base_type::size;
│ │ │ │ +
400
│ │ │ │ +
402 constexpr size_type size_bytes () const noexcept { return size() * sizeof(element_type); }
│ │ │ │ +
403
│ │ │ │ +
405 [[nodiscard]] constexpr bool empty () const noexcept { return size() == 0; }
│ │ │ │ +
406
│ │ │ │ +
408
│ │ │ │ +
409private:
│ │ │ │ +
410 pointer data_;
│ │ │ │ +
411};
│ │ │ │ +
│ │ │ │ +
412
│ │ │ │ +
413// deduction guide
│ │ │ │ +
414// @{
│ │ │ │ +
415
│ │ │ │ +
416template <class T, std::size_t N>
│ │ │ │ +
417span (T (&)[N])
│ │ │ │ +
418 -> span<T, N>;
│ │ │ │ +
419
│ │ │ │ +
420template <class ElementType, class I, std::size_t Extent,
│ │ │ │ +
421 std::enable_if_t<std::is_convertible_v<I,std::size_t>, int> = 0>
│ │ │ │ +
422span (ElementType*, std::integral_constant<I,Extent>)
│ │ │ │ + │ │ │ │ +
424
│ │ │ │ +
425template <class ElementType, class I,
│ │ │ │ +
426 std::enable_if_t<std::is_integral_v<I>, int> = 0,
│ │ │ │ +
427 std::enable_if_t<std::is_convertible_v<I,std::size_t>, int> = 0>
│ │ │ │ +
428span (ElementType*, I)
│ │ │ │ + │ │ │ │ +
430
│ │ │ │ +
431template <class Iter,
│ │ │ │ +
432 class Element = std::remove_reference_t<decltype(*std::declval<Iter>())>>
│ │ │ │ +
433span (Iter,Iter)
│ │ │ │ + │ │ │ │ +
435
│ │ │ │ +
436template <class Range,
│ │ │ │ +
437 class First = decltype(std::begin(std::declval<Range>())),
│ │ │ │ +
438 class Last = decltype(std::end(std::declval<Range>())),
│ │ │ │ +
439 class Element = std::remove_reference_t<decltype(*std::declval<First>())>>
│ │ │ │ +
440span (Range&)
│ │ │ │ + │ │ │ │ +
442
│ │ │ │ +
443template <class T, size_t N>
│ │ │ │ +
444span (std::array<T, N>&) -> span<T, N>;
│ │ │ │ +
445
│ │ │ │ +
446template <class T, size_t N>
│ │ │ │ +
447span (const std::array<T, N>&) -> span<const T, N>;
│ │ │ │ +
448
│ │ │ │ +
449// @}
│ │ │ │ +
450
│ │ │ │ +
451} // end namespace Dune::Std
│ │ │ │ +
452
│ │ │ │ +
453#endif // DUNE_COMMON_STD_SPAN_HH
│ │ │ │ + │ │ │ │ +
A few common exception classes.
│ │ │ │ +
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:312
│ │ │ │ +
STL namespace.
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
constexpr auto to_address(T &&p) noexcept
Obtain the address represented by p without forming a reference to the object pointed to by p.
Definition memory.hh:47
│ │ │ │ +
constexpr std::size_t dynamic_extent
A constant of type std::size_t that is used to differentiate std::span of static and dynamic extent.
Definition span.hh:26
│ │ │ │ +
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │ +
std::ptrdiff_t difference_type
Definition span.hh:135
│ │ │ │ +
const element_type & const_reference
Definition span.hh:138
│ │ │ │ +
constexpr reference front() const
Access the first element.
Definition span.hh:291
│ │ │ │ +
element_type & reference
Definition span.hh:137
│ │ │ │ +
constexpr span(const span &other) noexcept=default
Copy constructor.
│ │ │ │ +
pointer iterator
Definition span.hh:139
│ │ │ │ +
static constexpr size_type extent
Definition span.hh:150
│ │ │ │ +
constexpr iterator begin() const noexcept
Returns an iterator to the beginning.
Definition span.hh:261
│ │ │ │ +
constexpr const_iterator cbegin() const noexcept
Returns an iterator to the beginning.
Definition span.hh:267
│ │ │ │ +
constexpr span(std::array< T, N > &arr) noexcept
Constructs a span that is a view over the array.
Definition span.hh:211
│ │ │ │ +
std::reverse_iterator< iterator > reverse_iterator
Definition span.hh:140
│ │ │ │ +
constexpr iterator end() const noexcept
Returns an iterator to the end.
Definition span.hh:264
│ │ │ │ +
constexpr span< element_type, Std::dynamic_extent > subspan(size_type offset, size_type count=Std::dynamic_extent) const
Obtains a subspan consisting of count elements of the sequence starting at offset.
Definition span.hh:385
│ │ │ │ +
constexpr span & operator=(const span &other) noexcept=default
Copy assignment operator.
│ │ │ │ +
std::size_t size_type
Definition span.hh:134
│ │ │ │ +
element_type * pointer
Definition span.hh:136
│ │ │ │ +
constexpr reference at(size_type i) const
Access specified element with bounds checking.
Definition span.hh:305
│ │ │ │ +
std::remove_cv_t< element_type > value_type
Definition span.hh:133
│ │ │ │ +
constexpr span< element_type, Std::dynamic_extent > first(size_type count) const
Obtains a subspan consisting of the first count elements of the sequence.
Definition span.hh:367
│ │ │ │ +
constexpr span< element_type, subspan_extent(Offset, Count)> subspan() const
Obtains a subspan consisting of Count elements of the sequence starting at Offset.
Definition span.hh:358
│ │ │ │ +
const iterator const_iterator
Definition span.hh:145
│ │ │ │ +
constexpr const_reverse_iterator crend() const noexcept
Returns a reverse iterator ending at the beginning.
Definition span.hh:282
│ │ │ │ +
constexpr reverse_iterator rend() const noexcept
Returns a reverse iterator ending at the beginning.
Definition span.hh:276
│ │ │ │ +
constexpr pointer data() const noexcept
Direct access to the underlying contiguous storage.
Definition span.hh:316
│ │ │ │ +
constexpr size_type size_bytes() const noexcept
Returns the size of the sequence in bytes.
Definition span.hh:402
│ │ │ │ +
constexpr const_reverse_iterator crbegin() const noexcept
Returns a reverse iterator starting at the end.
Definition span.hh:279
│ │ │ │ +
Element element_type
Definition span.hh:132
│ │ │ │ +
constexpr bool empty() const noexcept
Checks if the sequence is empty.
Definition span.hh:405
│ │ │ │ +
constexpr span< element_type, Count > last() const
Obtains a subspan consisting of the last Count elements of the sequence.
Definition span.hh:335
│ │ │ │ +
constexpr span(Range &range)
Constructs a span that is a view over the range [range.begin(), range.end())
Definition span.hh:195
│ │ │ │ +
constexpr reverse_iterator rbegin() const noexcept
Returns a reverse iterator starting at the end.
Definition span.hh:273
│ │ │ │ +
constexpr span< element_type, Std::dynamic_extent > last(size_type count) const
Obtains a subspan consisting of the last count elements of the sequence.
Definition span.hh:374
│ │ │ │ +
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition span.hh:146
│ │ │ │ +
constexpr const_iterator cend() const noexcept
Returns an iterator to the end.
Definition span.hh:270
│ │ │ │ +
constexpr span< element_type, Count > first() const
Obtains a subspan consisting of the first Count elements of the sequence.
Definition span.hh:326
│ │ │ │ +
constexpr reference back() const
Access the last element.
Definition span.hh:298
│ │ │ │ +
constexpr span(const std::array< T, N > &arr) noexcept
Constructs a span that is a view over the const array.
Definition span.hh:220
│ │ │ │ +
constexpr reference operator[](size_type i) const
Access specified element.
Definition span.hh:313
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,59 +1,563 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -parmetis.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +span.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 © 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_PARMETIS_HH │ │ │ │ │ -6#define DUNE_PARMETIS_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_SPAN_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_SPAN_HH │ │ │ │ │ 7 │ │ │ │ │ -15#if HAVE_PARMETIS │ │ │ │ │ -16 │ │ │ │ │ -17#if HAVE_MPI │ │ │ │ │ -18#include │ │ │ │ │ -19#endif │ │ │ │ │ -20 │ │ │ │ │ -21#if HAVE_PTSCOTCH_PARMETIS │ │ │ │ │ -22extern "C" { │ │ │ │ │ -23 #include │ │ │ │ │ -24} │ │ │ │ │ -25#endif │ │ │ │ │ -26 │ │ │ │ │ -27extern "C" { │ │ │ │ │ -28 #include │ │ │ │ │ -29} │ │ │ │ │ -30 │ │ │ │ │ -31namespace Dune::ParMetis { │ │ │ │ │ -32 │ │ │ │ │ -33#if defined(REALTYPEWIDTH) │ │ │ │ │ -34 using _r_e_a_l___t = ::real_t; │ │ │ │ │ -35#else │ │ │ │ │ -36 using _r_e_a_l___t = float; │ │ │ │ │ -37#endif │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#if __has_include() │ │ │ │ │ +17 #include │ │ │ │ │ +18#endif │ │ │ │ │ +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_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ +22 │ │ │ │ │ +23namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +24 │ │ │ │ │ +_2_6inline constexpr std::size_t _d_y_n_a_m_i_c___e_x_t_e_n_t = std::numeric_limits::max(); │ │ │ │ │ +27 │ │ │ │ │ +28namespace Impl { │ │ │ │ │ +29 │ │ │ │ │ +30template │ │ │ │ │ +31class SpanSize │ │ │ │ │ +32{ │ │ │ │ │ +33public: │ │ │ │ │ +34 using size_type = std::size_t; │ │ │ │ │ +35 │ │ │ │ │ +36public: │ │ │ │ │ +37 constexpr SpanSize () = default; │ │ │ │ │ 38 │ │ │ │ │ -39#if defined(IDXTYPEWIDTH) │ │ │ │ │ -40 using idx_t = ::idx_t; │ │ │ │ │ -41#elif HAVE_PTSCOTCH_PARMETIS │ │ │ │ │ -42 using idx_t = SCOTCH_Num; │ │ │ │ │ -43#else │ │ │ │ │ -44 using idx_t = int; │ │ │ │ │ -45#endif │ │ │ │ │ -46 │ │ │ │ │ -47} // end namespace Dune::ParMetis │ │ │ │ │ -48 │ │ │ │ │ -49#endif // HAVE_PARMETIS │ │ │ │ │ -50#endif // DUNE_PARMETIS_HH │ │ │ │ │ -_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 │ │ │ │ │ +39 constexpr SpanSize ([[maybe_unused]] size_type size) noexcept │ │ │ │ │ +40 { │ │ │ │ │ +41 assert(Extent == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || Extent == size); │ │ │ │ │ +42 } │ │ │ │ │ +43 │ │ │ │ │ +44 template │ │ │ │ │ +45 constexpr SpanSize ([[maybe_unused]] Iter first, [[maybe_unused]] Iter last) │ │ │ │ │ +noexcept │ │ │ │ │ +46 { │ │ │ │ │ +47 assert((std::distance(first,last) == Extent)); │ │ │ │ │ +48 } │ │ │ │ │ +49 │ │ │ │ │ +50 constexpr size_type size () const noexcept { return Extent; } │ │ │ │ │ +51}; │ │ │ │ │ +52 │ │ │ │ │ +53template <> │ │ │ │ │ +54class SpanSize │ │ │ │ │ +55{ │ │ │ │ │ +56public: │ │ │ │ │ +57 using size_type = std::size_t; │ │ │ │ │ +58 │ │ │ │ │ +59public: │ │ │ │ │ +60 constexpr SpanSize (size_type size = 0) noexcept │ │ │ │ │ +61 : size_(size) │ │ │ │ │ +62 {} │ │ │ │ │ +63 │ │ │ │ │ +64 template │ │ │ │ │ +65 constexpr SpanSize (Iter first, Iter last) noexcept │ │ │ │ │ +66 : size_(std::distance(first,last)) │ │ │ │ │ +67 {} │ │ │ │ │ +68 │ │ │ │ │ +69 constexpr size_type size () const noexcept { return size_; } │ │ │ │ │ +70 │ │ │ │ │ +71private: │ │ │ │ │ +72 size_type size_; │ │ │ │ │ +73}; │ │ │ │ │ +74 │ │ │ │ │ +75template │ │ │ │ │ +76struct TypeIdentity { using type = T; }; │ │ │ │ │ +77 │ │ │ │ │ +78template │ │ │ │ │ +79using TypeIdentity_t = typename TypeIdentity::type; │ │ │ │ │ +80 │ │ │ │ │ +81} // end namespace Impl │ │ │ │ │ +82 │ │ │ │ │ +83 │ │ │ │ │ +123template │ │ │ │ │ +_1_2_4class _s_p_a_n │ │ │ │ │ +125 : public Impl::SpanSize │ │ │ │ │ +126{ │ │ │ │ │ +127 using base_type = Impl::SpanSize; // base_type implements the │ │ │ │ │ +member variable size() │ │ │ │ │ +128 │ │ │ │ │ +129 static_assert(std::is_object_v && !std::is_abstract_v); │ │ │ │ │ +130 │ │ │ │ │ +131public: │ │ │ │ │ +_1_3_2 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ +_1_3_3 using _v_a_l_u_e___t_y_p_e = std::remove_cv_t; │ │ │ │ │ +_1_3_4 using _s_i_z_e___t_y_p_e = std::size_t; │ │ │ │ │ +_1_3_5 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = std::ptrdiff_t; │ │ │ │ │ +_1_3_6 using _p_o_i_n_t_e_r = _e_l_e_m_e_n_t___t_y_p_e*; │ │ │ │ │ +_1_3_7 using _r_e_f_e_r_e_n_c_e = _e_l_e_m_e_n_t___t_y_p_e&; │ │ │ │ │ +_1_3_8 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = const _e_l_e_m_e_n_t___t_y_p_e&; │ │ │ │ │ +_1_3_9 using _i_t_e_r_a_t_o_r = _p_o_i_n_t_e_r; │ │ │ │ │ +_1_4_0 using _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r = std::reverse_iterator; │ │ │ │ │ +141#if __cpp_lib_ranges_as_const >202311L │ │ │ │ │ +142 using _c_o_n_s_t___i_t_e_r_a_t_o_r = std::const_iterator; │ │ │ │ │ +143 using _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r = std::const_iterator; │ │ │ │ │ +144#else │ │ │ │ │ +_1_4_5 using _c_o_n_s_t___i_t_e_r_a_t_o_r = const _i_t_e_r_a_t_o_r; │ │ │ │ │ +_1_4_6 using _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r = std::reverse_iterator; │ │ │ │ │ +147#endif │ │ │ │ │ +148 │ │ │ │ │ +149 │ │ │ │ │ +_1_5_0 static constexpr _s_i_z_e___t_y_p_e _e_x_t_e_n_t = Extent; │ │ │ │ │ +151 │ │ │ │ │ +152public: │ │ │ │ │ +155 │ │ │ │ │ +157 template = 0> │ │ │ │ │ +_1_5_9 constexpr _s_p_a_n () noexcept │ │ │ │ │ +160 : base_type{} │ │ │ │ │ +161 , data_{} │ │ │ │ │ +162 {} │ │ │ │ │ +163 │ │ │ │ │ +165 template ())>, │ │ │ │ │ +167 std::enable_if_t, int> = │ │ │ │ │ +0> │ │ │ │ │ +168 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +169 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ +170 #endif │ │ │ │ │ +_1_7_1 constexpr _s_p_a_n (Iter _f_i_r_s_t, _s_i_z_e___t_y_p_e size) │ │ │ │ │ +172 : base_type(size) │ │ │ │ │ +173 , data_(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(_f_i_r_s_t)) │ │ │ │ │ +174 {} │ │ │ │ │ +175 │ │ │ │ │ +177 template ())>, │ │ │ │ │ +179 std::enable_if_t, int> = │ │ │ │ │ +0> │ │ │ │ │ +180 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +181 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ +182 #endif │ │ │ │ │ +_1_8_3 constexpr _s_p_a_n (Iter _f_i_r_s_t, Iter _l_a_s_t) │ │ │ │ │ +184 : base_type(_f_i_r_s_t,_l_a_s_t) │ │ │ │ │ +185 , data_(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(_f_i_r_s_t)) │ │ │ │ │ +186 {} │ │ │ │ │ +187 │ │ │ │ │ +189 template ()), std::end(std::declval │ │ │ │ │ +()), bool{}) = true, │ │ │ │ │ +191 std::enable_if_t, int> = 0> │ │ │ │ │ +192 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +193 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ +194 #endif │ │ │ │ │ +_1_9_5 constexpr _s_p_a_n (Range& _r_a_n_g_e) │ │ │ │ │ +196 : _s_p_a_n(_s_t_d::_b_e_g_i_n(_r_a_n_g_e), _s_t_d::_e_n_d(_r_a_n_g_e)) │ │ │ │ │ +197 {} │ │ │ │ │ +198 │ │ │ │ │ +200 template = 0> │ │ │ │ │ +_2_0_2 constexpr _s_p_a_n (Impl::TypeIdentity_t (&_d_a_t_a)[N]) noexcept │ │ │ │ │ +203 : base_type(N) │ │ │ │ │ +204 , data_(_d_a_t_a) │ │ │ │ │ +205 {} │ │ │ │ │ +206 │ │ │ │ │ +208 template = 0, │ │ │ │ │ +210 std::enable_if_t, int> = │ │ │ │ │ +0> │ │ │ │ │ +_2_1_1 constexpr _s_p_a_n (std::array& arr) noexcept │ │ │ │ │ +212 : base_type(N) │ │ │ │ │ +213 , data_(arr.data()) │ │ │ │ │ +214 {} │ │ │ │ │ +215 │ │ │ │ │ +217 template = 0, │ │ │ │ │ +219 std::enable_if_t, │ │ │ │ │ +int> = 0> │ │ │ │ │ +_2_2_0 constexpr _s_p_a_n (const std::array& arr) noexcept │ │ │ │ │ +221 : base_type(N) │ │ │ │ │ +222 , data_(arr.data()) │ │ │ │ │ +223 {} │ │ │ │ │ +224 │ │ │ │ │ +226 template , int> = 0> │ │ │ │ │ +228 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +229 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ +230 #endif │ │ │ │ │ +_2_3_1 constexpr _s_p_a_n (std::initializer_list il) │ │ │ │ │ +232 : base_type(il.size()) │ │ │ │ │ +233 , data_(il.begin()) │ │ │ │ │ +234 {} │ │ │ │ │ +235 │ │ │ │ │ +_2_3_7 constexpr _s_p_a_n (const _s_p_a_n& other) noexcept = default; │ │ │ │ │ +238 │ │ │ │ │ +240 template = 0, │ │ │ │ │ +242 std::enable_if_t, int> = 0> │ │ │ │ │ +243 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +244 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t && OtherExtent == _S_t_d_:_: │ │ │ │ │ +_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ +245 #endif │ │ │ │ │ +_2_4_6 constexpr _s_p_a_n (const _s_p_a_n_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_ _O_t_h_e_r_E_x_t_e_n_t_>& s) noexcept │ │ │ │ │ +247 : base_type(s.size()) │ │ │ │ │ +248 , data_(s._d_a_t_a()) │ │ │ │ │ +249 {} │ │ │ │ │ +250 │ │ │ │ │ +_2_5_2 constexpr _s_p_a_n& _o_p_e_r_a_t_o_r_=_ (const _s_p_a_n& other) noexcept = default; │ │ │ │ │ +253 │ │ │ │ │ +255 │ │ │ │ │ +256 │ │ │ │ │ +259 │ │ │ │ │ +_2_6_1 constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n () const noexcept { return data_; } │ │ │ │ │ +262 │ │ │ │ │ +_2_6_4 constexpr _i_t_e_r_a_t_o_r _e_n_d () const noexcept { return data_ + size(); } │ │ │ │ │ +265 │ │ │ │ │ +_2_6_7 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _c_b_e_g_i_n () const noexcept { return data_; } │ │ │ │ │ +268 │ │ │ │ │ +_2_7_0 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _c_e_n_d () const noexcept { return data_ + size(); } │ │ │ │ │ +271 │ │ │ │ │ +_2_7_3 constexpr _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_b_e_g_i_n() const noexcept { return │ │ │ │ │ +_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_e_n_d()}; } │ │ │ │ │ +274 │ │ │ │ │ +_2_7_6 constexpr _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_e_n_d() const noexcept { return _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r │ │ │ │ │ +{_b_e_g_i_n()}; } │ │ │ │ │ +277 │ │ │ │ │ +_2_7_9 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 { return │ │ │ │ │ +_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_e_n_d()}; } │ │ │ │ │ +280 │ │ │ │ │ +_2_8_2 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 { return │ │ │ │ │ +_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()}; } │ │ │ │ │ +283 │ │ │ │ │ +285 │ │ │ │ │ +286 │ │ │ │ │ +289 │ │ │ │ │ +_2_9_1 constexpr _r_e_f_e_r_e_n_c_e _f_r_o_n_t () const │ │ │ │ │ +292 { │ │ │ │ │ +293 assert(not _e_m_p_t_y() && "front of empty span does not exist"); │ │ │ │ │ +294 return data_[0]; │ │ │ │ │ +295 } │ │ │ │ │ +296 │ │ │ │ │ +_2_9_8 constexpr _r_e_f_e_r_e_n_c_e _b_a_c_k () const │ │ │ │ │ +299 { │ │ │ │ │ +300 assert(not _e_m_p_t_y() && "front of empty span does not exist"); │ │ │ │ │ +301 return data_[size()-1]; │ │ │ │ │ +302 } │ │ │ │ │ +303 │ │ │ │ │ +_3_0_5 constexpr _r_e_f_e_r_e_n_c_e _a_t (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +306 { │ │ │ │ │ +307 if (i >= size()) │ │ │ │ │ +308 throw std::out_of_range("Index " + std::to_string(i) + " out of range."); │ │ │ │ │ +309 return data_[i]; │ │ │ │ │ +310 } │ │ │ │ │ +311 │ │ │ │ │ +_3_1_3 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) const { return data_[i]; } │ │ │ │ │ +314 │ │ │ │ │ +_3_1_6 constexpr _p_o_i_n_t_e_r _d_a_t_a () const noexcept { return data_; } │ │ │ │ │ +317 │ │ │ │ │ +319 │ │ │ │ │ +320 │ │ │ │ │ +323 │ │ │ │ │ +325 template │ │ │ │ │ +_3_2_6 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_> _f_i_r_s_t () const │ │ │ │ │ +327 { │ │ │ │ │ +328 static_assert(Count <= Extent); │ │ │ │ │ +329 assert(Count <= size()); │ │ │ │ │ +330 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_>{_d_a_t_a(), Count}; │ │ │ │ │ +331 } │ │ │ │ │ +332 │ │ │ │ │ +334 template │ │ │ │ │ +_3_3_5 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_> _l_a_s_t () const │ │ │ │ │ +336 { │ │ │ │ │ +337 static_assert(Count <= Extent); │ │ │ │ │ +338 assert(Count <= size()); │ │ │ │ │ +339 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_>{_d_a_t_a()+ (size() - Count), Count}; │ │ │ │ │ +340 } │ │ │ │ │ +341 │ │ │ │ │ +342private: │ │ │ │ │ +343 │ │ │ │ │ +344 static constexpr std::size_t subspan_extent (std::size_t O, std::size_t C) │ │ │ │ │ +noexcept │ │ │ │ │ +345 { │ │ │ │ │ +346 return (C != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) ? C : │ │ │ │ │ +347 (Extent != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) ? Extent - O : Std::_d_y_n_a_m_i_c___e_x_t_e_n_t; │ │ │ │ │ +348 } │ │ │ │ │ +349 │ │ │ │ │ +350public: │ │ │ │ │ +351 │ │ │ │ │ +353 │ │ │ │ │ +357 template │ │ │ │ │ +_3_5_8 constexpr _s_p_a_n<_e_l_e_m_e_n_t___t_y_p_e, subspan_extent(Offset,Count)> _s_u_b_s_p_a_n () const │ │ │ │ │ +359 { │ │ │ │ │ +360 static_assert(Offset <= Extent && (Count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || Count <= │ │ │ │ │ +Extent - Offset)); │ │ │ │ │ +361 assert(Offset <= size() && (Count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || Count <= size() │ │ │ │ │ +- Offset)); │ │ │ │ │ +362 return _s_p_a_n<_e_l_e_m_e_n_t___t_y_p_e, subspan_extent(Offset,Count)>{ │ │ │ │ │ +363 _d_a_t_a() + Offset, Count != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t ? Count : size() - Offset}; │ │ │ │ │ +364 } │ │ │ │ │ +365 │ │ │ │ │ +_3_6_7 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_> _f_i_r_s_t (_s_i_z_e___t_y_p_e count) │ │ │ │ │ +const │ │ │ │ │ +368 { │ │ │ │ │ +369 assert(count <= size()); │ │ │ │ │ +370 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>{_d_a_t_a(), count}; │ │ │ │ │ +371 } │ │ │ │ │ +372 │ │ │ │ │ +_3_7_4 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_> _l_a_s_t (_s_i_z_e___t_y_p_e count) │ │ │ │ │ +const │ │ │ │ │ +375 { │ │ │ │ │ +376 assert(count <= size()); │ │ │ │ │ +377 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>{_d_a_t_a()+ (size() - count), │ │ │ │ │ +count}; │ │ │ │ │ +378 } │ │ │ │ │ +379 │ │ │ │ │ +381 │ │ │ │ │ +_3_8_5 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_> _s_u_b_s_p_a_n (_s_i_z_e___t_y_p_e │ │ │ │ │ +offset, _s_i_z_e___t_y_p_e count = _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) const │ │ │ │ │ +386 { │ │ │ │ │ +387 assert(offset <= size() && (count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || count <= size() │ │ │ │ │ +- offset)); │ │ │ │ │ +388 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>{ │ │ │ │ │ +389 _d_a_t_a() + offset, count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t ? size() - offset : count}; │ │ │ │ │ +390 } │ │ │ │ │ +391 │ │ │ │ │ +393 │ │ │ │ │ +394 │ │ │ │ │ +397 │ │ │ │ │ +399 using base_type::size; │ │ │ │ │ +400 │ │ │ │ │ +_4_0_2 constexpr _s_i_z_e___t_y_p_e _s_i_z_e___b_y_t_e_s () const noexcept { return size() * sizeof │ │ │ │ │ +(_e_l_e_m_e_n_t___t_y_p_e); } │ │ │ │ │ +403 │ │ │ │ │ +_4_0_5 [[nodiscard]] constexpr bool _e_m_p_t_y () const noexcept { return size() == 0; │ │ │ │ │ +} │ │ │ │ │ +406 │ │ │ │ │ +408 │ │ │ │ │ +409private: │ │ │ │ │ +410 _p_o_i_n_t_e_r data_; │ │ │ │ │ +411}; │ │ │ │ │ +412 │ │ │ │ │ +413// deduction guide │ │ │ │ │ +414// @{ │ │ │ │ │ +415 │ │ │ │ │ +416template │ │ │ │ │ +_4_1_7_s_p_a_n (T (&)[N]) │ │ │ │ │ +418 -> _s_p_a_n_<_T_,_ _N_>; │ │ │ │ │ +419 │ │ │ │ │ +420template , int> = 0> │ │ │ │ │ +_4_2_2_s_p_a_n (ElementType*, std::integral_constant) │ │ │ │ │ +423 -> _s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _E_x_t_e_n_t_>; │ │ │ │ │ +424 │ │ │ │ │ +425template , int> = 0, │ │ │ │ │ +427 std::enable_if_t, int> = 0> │ │ │ │ │ +_4_2_8_s_p_a_n (ElementType*, I) │ │ │ │ │ +429 -> _s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>; │ │ │ │ │ +430 │ │ │ │ │ +431template ())>> │ │ │ │ │ +_4_3_3_s_p_a_n (Iter,Iter) │ │ │ │ │ +434 -> _s_p_a_n_<_E_l_e_m_e_n_t_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>; │ │ │ │ │ +435 │ │ │ │ │ +436template ())), │ │ │ │ │ +438 class Last = decltype(std::end(std::declval())), │ │ │ │ │ +439 class Element = std::remove_reference_t())>> │ │ │ │ │ +_4_4_0_s_p_a_n (Range&) │ │ │ │ │ +441 -> _s_p_a_n_<_E_l_e_m_e_n_t_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>; │ │ │ │ │ +442 │ │ │ │ │ +443template │ │ │ │ │ +_4_4_4_s_p_a_n (std::array&) -> _s_p_a_n_<_T_,_ _N_>; │ │ │ │ │ +445 │ │ │ │ │ +446template │ │ │ │ │ +_4_4_7_s_p_a_n (const std::array&) -> _s_p_a_n_<_c_o_n_s_t_ _T_,_ _N_>; │ │ │ │ │ +448 │ │ │ │ │ +449// @} │ │ │ │ │ +450 │ │ │ │ │ +451} // end namespace Dune::Std │ │ │ │ │ +452 │ │ │ │ │ +453#endif // DUNE_COMMON_STD_SPAN_HH │ │ │ │ │ +_m_e_m_o_r_y_._h_h │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_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:312 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_t_o___a_d_d_r_e_s_s │ │ │ │ │ +constexpr auto to_address(T &&p) noexcept │ │ │ │ │ +Obtain the address represented by p without forming a reference to the object │ │ │ │ │ +pointed to by p. │ │ │ │ │ +DDeeffiinniittiioonn memory.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t │ │ │ │ │ +constexpr std::size_t dynamic_extent │ │ │ │ │ +A constant of type std::size_t that is used to differentiate std::span of │ │ │ │ │ +static and dynamic extent. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ +A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +std::ptrdiff_t difference_type │ │ │ │ │ +DDeeffiinniittiioonn span.hh:135 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +const element_type & const_reference │ │ │ │ │ +DDeeffiinniittiioonn span.hh:138 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_f_r_o_n_t │ │ │ │ │ +constexpr reference front() const │ │ │ │ │ +Access the first element. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:291 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +element_type & reference │ │ │ │ │ +DDeeffiinniittiioonn span.hh:137 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ +constexpr span(const span &other) noexcept=default │ │ │ │ │ +Copy constructor. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +pointer iterator │ │ │ │ │ +DDeeffiinniittiioonn span.hh:139 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_x_t_e_n_t │ │ │ │ │ +static constexpr size_type extent │ │ │ │ │ +DDeeffiinniittiioonn span.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_b_e_g_i_n │ │ │ │ │ +constexpr iterator begin() const noexcept │ │ │ │ │ +Returns an iterator to the beginning. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:261 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_b_e_g_i_n │ │ │ │ │ +constexpr const_iterator cbegin() const noexcept │ │ │ │ │ +Returns an iterator to the beginning. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ +constexpr span(std::array< T, N > &arr) noexcept │ │ │ │ │ +Constructs a span that is a view over the array. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r │ │ │ │ │ +std::reverse_iterator< iterator > reverse_iterator │ │ │ │ │ +DDeeffiinniittiioonn span.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_n_d │ │ │ │ │ +constexpr iterator end() const noexcept │ │ │ │ │ +Returns an iterator to the end. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:264 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_u_b_s_p_a_n │ │ │ │ │ +constexpr span< element_type, Std::dynamic_extent > subspan(size_type offset, │ │ │ │ │ +size_type count=Std::dynamic_extent) const │ │ │ │ │ +Obtains a subspan consisting of count elements of the sequence starting at │ │ │ │ │ +offset. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:385 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +constexpr span & operator=(const span &other) noexcept=default │ │ │ │ │ +Copy assignment operator. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::size_t size_type │ │ │ │ │ +DDeeffiinniittiioonn span.hh:134 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_p_o_i_n_t_e_r │ │ │ │ │ +element_type * pointer │ │ │ │ │ +DDeeffiinniittiioonn span.hh:136 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_a_t │ │ │ │ │ +constexpr reference at(size_type i) const │ │ │ │ │ +Access specified element with bounds checking. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:305 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +std::remove_cv_t< element_type > value_type │ │ │ │ │ +DDeeffiinniittiioonn span.hh:133 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_f_i_r_s_t │ │ │ │ │ +constexpr span< element_type, Std::dynamic_extent > first(size_type count) │ │ │ │ │ +const │ │ │ │ │ +Obtains a subspan consisting of the first count elements of the sequence. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:367 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_u_b_s_p_a_n │ │ │ │ │ +constexpr span< element_type, subspan_extent(Offset, Count)> subspan() const │ │ │ │ │ +Obtains a subspan consisting of Count elements of the sequence starting at │ │ │ │ │ +Offset. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:358 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +const iterator const_iterator │ │ │ │ │ +DDeeffiinniittiioonn span.hh:145 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_r_e_n_d │ │ │ │ │ +constexpr const_reverse_iterator crend() const noexcept │ │ │ │ │ +Returns a reverse iterator ending at the beginning. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_e_n_d │ │ │ │ │ +constexpr reverse_iterator rend() const noexcept │ │ │ │ │ +Returns a reverse iterator ending at the beginning. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_d_a_t_a │ │ │ │ │ +constexpr pointer data() const noexcept │ │ │ │ │ +Direct access to the underlying contiguous storage. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:316 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_i_z_e___b_y_t_e_s │ │ │ │ │ +constexpr size_type size_bytes() const noexcept │ │ │ │ │ +Returns the size of the sequence in bytes. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:402 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_r_b_e_g_i_n │ │ │ │ │ +constexpr const_reverse_iterator crbegin() const noexcept │ │ │ │ │ +Returns a reverse iterator starting at the end. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:279 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ +Element element_type │ │ │ │ │ +DDeeffiinniittiioonn span.hh:132 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_m_p_t_y │ │ │ │ │ +constexpr bool empty() const noexcept │ │ │ │ │ +Checks if the sequence is empty. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:405 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_l_a_s_t │ │ │ │ │ +constexpr span< element_type, Count > last() const │ │ │ │ │ +Obtains a subspan consisting of the last Count elements of the sequence. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:335 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ +constexpr span(Range &range) │ │ │ │ │ +Constructs a span that is a view over the range [range.begin(), range.end()) │ │ │ │ │ +DDeeffiinniittiioonn span.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_b_e_g_i_n │ │ │ │ │ +constexpr reverse_iterator rbegin() const noexcept │ │ │ │ │ +Returns a reverse iterator starting at the end. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:273 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_l_a_s_t │ │ │ │ │ +constexpr span< element_type, Std::dynamic_extent > last(size_type count) const │ │ │ │ │ +Obtains a subspan consisting of the last count elements of the sequence. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:374 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_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 │ │ │ │ │ +DDeeffiinniittiioonn span.hh:146 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_e_n_d │ │ │ │ │ +constexpr const_iterator cend() const noexcept │ │ │ │ │ +Returns an iterator to the end. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:270 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_f_i_r_s_t │ │ │ │ │ +constexpr span< element_type, Count > first() const │ │ │ │ │ +Obtains a subspan consisting of the first Count elements of the sequence. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:326 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_b_a_c_k │ │ │ │ │ +constexpr reference back() const │ │ │ │ │ +Access the last element. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:298 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ +constexpr span(const std::array< T, N > &arr) noexcept │ │ │ │ │ +Constructs a span that is a view over the const array. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:220 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +constexpr reference operator[](size_type i) const │ │ │ │ │ +Access specified element. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:313 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: communication.hh File Reference │ │ │ │ +dune-common: mdarray.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,71 +65,55 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions
│ │ │ │ -
communication.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
mdarray.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <iostream>
│ │ │ │ -#include <complex>
│ │ │ │ -#include <algorithm>
│ │ │ │ +
#include <algorithm>
│ │ │ │ +#include <array>
│ │ │ │ +#include <memory>
│ │ │ │ #include <vector>
│ │ │ │ -#include <dune/common/binaryfunctions.hh>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/parallel/future.hh>
│ │ │ │ +#include <tuple>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +#include <dune/common/rangeutilities.hh>
│ │ │ │ +#include <dune/common/std/default_accessor.hh>
│ │ │ │ +#include <dune/common/std/mdspan.hh>
│ │ │ │ +#include <dune/common/std/memory.hh>
│ │ │ │ +#include <dune/common/std/span.hh>
│ │ │ │ +#include <dune/common/std/impl/containerconstructiontraits.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...
class  Dune::Std::mdarray< Element, Extents, LayoutPolicy, Container >
 An owning multi-dimensional array analog of mdspan. 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,36 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +mdarray.hh File Reference │ │ │ │ │ #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> │ │ │ │ │ +#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_/_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_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_d_s_p_a_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_c_o_n_t_a_i_n_e_r_c_o_n_s_t_r_u_c_t_i_o_n_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_:_:_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_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_<_ _E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_P_o_l_i_c_y_,_ _C_o_n_t_a_i_n_e_r_ _> │ │ │ │ │ +  An owning multi-dimensional array analog of mdspan. _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/a00050_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: communication.hh Source File │ │ │ │ +dune-common: mdarray.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,417 +70,712 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
communication.hh
│ │ │ │ +
mdarray.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 © 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
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
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 {}
│ │ │ │ -
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_MDARRAY_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_MDARRAY_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <algorithm>
│ │ │ │ +
9#include <array>
│ │ │ │ +
10#include <memory>
│ │ │ │ +
11#include <vector>
│ │ │ │ +
12#include <tuple>
│ │ │ │ +
13#include <type_traits>
│ │ │ │ +
14#if __has_include(<version>)
│ │ │ │ +
15 #include <version>
│ │ │ │ +
16#endif
│ │ │ │ +
17
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
25
│ │ │ │ +
26namespace Dune::Std {
│ │ │ │ +
27
│ │ │ │ +
66template <class Element, class Extents, class LayoutPolicy = Std::layout_right,
│ │ │ │ +
67 class Container = std::vector<Element>>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
69{
│ │ │ │ +
70 template <class,class,class,class> friend class mdarray;
│ │ │ │ +
71
│ │ │ │ +
72 static_assert(std::is_object_v<Element>);
│ │ │ │ +
73 static_assert(!std::is_abstract_v<Element>);
│ │ │ │ +
74 static_assert(!std::is_array_v<Element>);
│ │ │ │ +
75 static_assert(std::is_same_v<Element, typename Container::value_type>);
│ │ │ │ +
76
│ │ │ │ +
77public:
│ │ │ │ +
78 using element_type = Element;
│ │ │ │ +
79 using extents_type = Extents;
│ │ │ │ +
80 using layout_type = LayoutPolicy;
│ │ │ │ +
81 using container_type = Container;
│ │ │ │ +
82
│ │ │ │ + │ │ │ │ +
84 using mapping_type = typename layout_type::template mapping<extents_type>;
│ │ │ │ +
85
│ │ │ │ +
86 using index_type = typename extents_type::index_type;
│ │ │ │ +
87 using size_type = typename extents_type::size_type;
│ │ │ │ +
88 using rank_type = typename extents_type::rank_type;
│ │ │ │ +
89
│ │ │ │ + │ │ │ │ + │ │ │ │ +
92
│ │ │ │ +
93 using pointer = decltype(Std::to_address(std::declval<container_type>().begin()));
│ │ │ │ +
94 using reference = typename container_type::reference;
│ │ │ │ +
95 using const_pointer = decltype(Std::to_address(std::declval<container_type>().cbegin()));
│ │ │ │ +
96 using const_reference = typename container_type::const_reference;
│ │ │ │ +
97
│ │ │ │ +
98 static_assert(std::is_constructible_v<mapping_type, extents_type>);
│ │ │ │ +
99
│ │ │ │ +
100private:
│ │ │ │ +
101 // helper function to construct the container
│ │ │ │ +
102 template <class C, class... Args>
│ │ │ │ +
103 static constexpr auto construct_container (Args&&... args)
│ │ │ │ +
104 -> decltype(Impl::ContainerConstructionTraits<C>::construct(std::forward<Args>(args)...))
│ │ │ │ +
105 {
│ │ │ │ +
106 return Impl::ContainerConstructionTraits<C>::construct(std::forward<Args>(args)...);
│ │ │ │ +
107 }
│ │ │ │ +
108
│ │ │ │ +
109public:
│ │ │ │
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 }
│ │ │ │ +
114 template <class E = extents_type, class C = container_type, class M = mapping_type,
│ │ │ │ +
115 std::enable_if_t<(E::rank_dynamic() != 0), int> = 0,
│ │ │ │ +
116 std::enable_if_t<std::is_default_constructible_v<C>, int> = 0,
│ │ │ │ +
117 std::enable_if_t<std::is_default_constructible_v<M>, int> = 0>
│ │ │ │ +
│ │ │ │ +
118 constexpr mdarray ()
│ │ │ │ +
119 : container_{}
│ │ │ │ +
120 , mapping_{}
│ │ │ │ +
121 {}
│ │ │ │ +
│ │ │ │ +
122
│ │ │ │ +
123
│ │ │ │ +
124 // -------------------------------------
│ │ │ │ +
125 // constructors from extents or mappings
│ │ │ │ +
126
│ │ │ │ +
127
│ │ │ │ +
129 template <class... IndexTypes,
│ │ │ │ +
130 std::enable_if_t<(... && std::is_convertible_v<IndexTypes,index_type>), int> = 0,
│ │ │ │ +
131 std::enable_if_t<std::is_constructible_v<extents_type,IndexTypes...>, int> = 0,
│ │ │ │ +
132 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type,IndexTypes>), int> = 0>
│ │ │ │ +
│ │ │ │ +
133 explicit constexpr mdarray (IndexTypes... exts)
│ │ │ │ +
134 : mdarray(extents_type(index_type(std::move(exts))...))
│ │ │ │ +
135 {}
│ │ │ │ +
│ │ │ │ +
136
│ │ │ │ +
│ │ │ │ +
138 explicit constexpr mdarray (const extents_type& e)
│ │ │ │ + │ │ │ │ +
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 }
│ │ │ │ +
143 template <class C = container_type,
│ │ │ │ +
144 decltype(construct_container<C>(std::declval<std::size_t>()), bool{}) = true>
│ │ │ │ +
│ │ │ │ +
145 explicit constexpr mdarray (const mapping_type& m)
│ │ │ │ +
146 : container_(construct_container<C>(m.required_span_size()))
│ │ │ │ +
147 , mapping_(m)
│ │ │ │ +
148 {}
│ │ │ │ +
│ │ │ │ +
149
│ │ │ │ +
150
│ │ │ │ +
151 // ---------------------------------------
│ │ │ │ +
152 // constructors with a given initial value
│ │ │ │ +
153
│ │ │ │ +
│ │ │ │ +
155 constexpr mdarray (const extents_type& e, const value_type& v)
│ │ │ │ +
156 : mdarray(mapping_type(e), v)
│ │ │ │ +
157 {}
│ │ │ │ +
│ │ │ │ +
158
│ │ │ │ +
160 template <class C = container_type,
│ │ │ │ +
161 decltype(construct_container<C>(std::declval<std::size_t>(),std::declval<const value_type&>()), bool{}) = true>
│ │ │ │ +
│ │ │ │ +
162 constexpr mdarray (const mapping_type& m, const value_type& v)
│ │ │ │ +
163 : container_(construct_container<C>(m.required_span_size(), v))
│ │ │ │ +
164 , mapping_(m)
│ │ │ │ +
165 {}
│ │ │ │ +
│ │ │ │ +
166
│ │ │ │ +
167
│ │ │ │ +
168 // -----------------------------------
│ │ │ │ +
169 // constructors with a given container
│ │ │ │ +
170
│ │ │ │ +
172 template <class E = extents_type,
│ │ │ │ +
173 std::enable_if_t<std::is_constructible_v<mapping_type,const E&>, int> = 0>
│ │ │ │ +
│ │ │ │ +
174 constexpr mdarray (const E& e, const container_type& c)
│ │ │ │ +
175 : container_(c)
│ │ │ │ +
176 , mapping_(e)
│ │ │ │ +
177 {}
│ │ │ │ +
│ │ │ │ +
178
│ │ │ │ +
180 template <class E = extents_type,
│ │ │ │ +
181 std::enable_if_t<std::is_constructible_v<mapping_type,const E&>, int> = 0>
│ │ │ │ +
│ │ │ │ +
182 constexpr mdarray (const E& e, container_type&& c)
│ │ │ │ +
183 : container_(std::move(c))
│ │ │ │ +
184 , mapping_(e)
│ │ │ │ +
185 {}
│ │ │ │
│ │ │ │ -
187 template<typename T>
│ │ │ │ +
186
│ │ │ │
│ │ │ │ -
188 T sum (const T& in) const
│ │ │ │ -
189 {
│ │ │ │ -
190 return in;
│ │ │ │ -
191 }
│ │ │ │ +
188 constexpr mdarray (const mapping_type& m, const container_type& c)
│ │ │ │ +
189 : container_(c)
│ │ │ │ +
190 , mapping_(m)
│ │ │ │ +
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 }
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
194 constexpr mdarray (const mapping_type& m, container_type&& c)
│ │ │ │ +
195 : container_(std::move(c))
│ │ │ │ +
196 , mapping_(m)
│ │ │ │ +
197 {}
│ │ │ │ +
│ │ │ │ +
198
│ │ │ │ +
199
│ │ │ │ +
200 // -----------------------
│ │ │ │ +
201 // converting constructors
│ │ │ │ +
202
│ │ │ │ +
204 template <class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer,
│ │ │ │ +
205 std::enable_if_t<std::is_constructible_v<Container,const OtherContainer&>, int> = 0,
│ │ │ │ +
206 std::enable_if_t<std::is_constructible_v<extents_type,OtherExtents>, int> = 0,
│ │ │ │ +
207 std::enable_if_t<std::is_constructible_v<mapping_type,const typename OtherLayoutPolicy::template mapping<OtherExtents>&>, int> = 0>
│ │ │ │ +
208 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
209 explicit(
│ │ │ │ +
210 !std::is_convertible_v<const typename OtherLayoutPolicy::template mapping<OtherExtents>&, mapping_type> ||
│ │ │ │ +
211 !std::is_convertible_v<const OtherContainer&, container_type>)
│ │ │ │ +
212 #endif
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
214 : container_(other.container_)
│ │ │ │ +
215 , mapping_(other.mapping_)
│ │ │ │ +
216 {}
│ │ │ │ +
│ │ │ │ +
217
│ │ │ │ +
219 template <class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class Accessor,
│ │ │ │ +
220 std::enable_if_t<std::is_constructible_v<value_type,typename Accessor::reference>, int> = 0,
│ │ │ │ +
221 std::enable_if_t<std::is_assignable_v<typename Accessor::reference, value_type>, int> = 0,
│ │ │ │ +
222 std::enable_if_t<std::is_constructible_v<mapping_type, const typename OtherLayoutPolicy::template mapping<OtherExtents>&>, int> = 0,
│ │ │ │ +
223 decltype(construct_container<container_type>(std::declval<std::size_t>()), bool{}) = true>
│ │ │ │ +
224 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
225 explicit(
│ │ │ │ +
226 !std::is_convertible_v<const typename OtherLayoutPolicy::template mapping<OtherExtents>&, mapping_type> ||
│ │ │ │ +
227 !std::is_convertible_v<typename Accessor::reference, value_type>)
│ │ │ │ +
228 #endif
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
230 : container_(construct_container<container_type>(other.size()))
│ │ │ │ +
231 , mapping_(other.mapping())
│ │ │ │ +
232 {
│ │ │ │ +
233 init_from_mdspan(other);
│ │ │ │ +
234 }
│ │ │ │ +
│ │ │ │ +
235
│ │ │ │ +
236
│ │ │ │ +
237 // ----------------------------
│ │ │ │ +
238 // constructors with allocators
│ │ │ │ +
239
│ │ │ │ +
241 template <class Alloc,
│ │ │ │ +
242 std::enable_if_t<std::is_constructible_v<container_type, std::size_t, Alloc>, int> = 0>
│ │ │ │ +
│ │ │ │ +
243 constexpr mdarray (const extents_type& e, const Alloc& a)
│ │ │ │ +
244 : mdarray(mapping_type(e), a)
│ │ │ │ +
245 {}
│ │ │ │ +
│ │ │ │ +
246
│ │ │ │ +
248 template <class Alloc,
│ │ │ │ +
249 std::enable_if_t<std::is_constructible_v<container_type, std::size_t, Alloc>, int> = 0>
│ │ │ │ +
│ │ │ │ +
250 constexpr mdarray (const mapping_type& m, const Alloc& a)
│ │ │ │ +
251 : container_(m.required_span_size(), a)
│ │ │ │ +
252 , mapping_(m)
│ │ │ │ +
253 {}
│ │ │ │ +
│ │ │ │ +
254
│ │ │ │ +
256 template <class Alloc>
│ │ │ │ +
│ │ │ │ +
257 constexpr mdarray (const extents_type& e, const value_type& v, const Alloc& a)
│ │ │ │ +
258 : mdarray(mapping_type(e), v, a)
│ │ │ │ +
259 {}
│ │ │ │ +
│ │ │ │ +
260
│ │ │ │ +
262 template <class Alloc,
│ │ │ │ +
263 std::enable_if_t<std::is_constructible_v<container_type, std::size_t, value_type, Alloc>, int> = 0>
│ │ │ │ +
│ │ │ │ +
264 constexpr mdarray (const mapping_type& m, const value_type& v, const Alloc& a)
│ │ │ │ +
265 : container_(m.required_span_size(), v, a)
│ │ │ │ +
266 , mapping_(m)
│ │ │ │ +
267 {}
│ │ │ │ +
│ │ │ │ +
268
│ │ │ │ +
270 template <class Alloc,
│ │ │ │ +
271 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ +
│ │ │ │ +
272 constexpr mdarray (const extents_type& e, const container_type& c, const Alloc& a)
│ │ │ │ +
273 : container_(c, a)
│ │ │ │ +
274 , mapping_(e)
│ │ │ │ +
275 {}
│ │ │ │ +
│ │ │ │ +
276
│ │ │ │ +
278 template <class Alloc,
│ │ │ │ +
279 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ +
│ │ │ │ +
280 constexpr mdarray (const extents_type& e, container_type&& c, const Alloc& a)
│ │ │ │ +
281 : container_(std::move(c), a)
│ │ │ │ +
282 , mapping_(e)
│ │ │ │ +
283 {}
│ │ │ │ +
│ │ │ │ +
284
│ │ │ │ +
286 template <class Alloc,
│ │ │ │ +
287 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ +
│ │ │ │ +
288 constexpr mdarray (const mapping_type& m, const container_type& c, const Alloc& a)
│ │ │ │ +
289 : container_(c, a)
│ │ │ │ +
290 , mapping_(m)
│ │ │ │ +
291 {}
│ │ │ │ +
│ │ │ │ +
292
│ │ │ │ +
294 template <class Alloc,
│ │ │ │ +
295 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ +
│ │ │ │ +
296 constexpr mdarray (const mapping_type& m, container_type&& c, const Alloc& a)
│ │ │ │ +
297 : container_(std::move(c), a)
│ │ │ │ +
298 , mapping_(m)
│ │ │ │ +
299 {}
│ │ │ │ +
│ │ │ │ +
300
│ │ │ │ +
302 template <class V, class E, class L, class C, class Alloc,
│ │ │ │ +
303 std::enable_if_t<std::is_constructible_v<container_type, C, Alloc>, int> = 0>
│ │ │ │ +
304 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
305 explicit(
│ │ │ │ +
306 !std::is_convertible_v<const typename L::template mapping<E>&, mapping_type> ||
│ │ │ │ +
307 !std::is_convertible_v<const C&, container_type>)
│ │ │ │ +
308 #endif
│ │ │ │ +
│ │ │ │ +
309 constexpr mdarray (const mdarray<V,E,L,C>& other, const Alloc& a) noexcept
│ │ │ │ +
310 : container_(other.container_, a)
│ │ │ │ +
311 , mapping_(other.mapping_)
│ │ │ │ +
312 {}
│ │ │ │ +
│ │ │ │ +
313
│ │ │ │ +
315 template <class V, class E, class L, class A, class Alloc,
│ │ │ │ +
316 class C = container_type,
│ │ │ │ +
317 class Al = typename C::allocator_type,
│ │ │ │ +
318 std::enable_if_t<std::is_constructible_v<C, std::size_t, Alloc>, int> = 0>
│ │ │ │ +
319 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
320 explicit(
│ │ │ │ +
321 !std::is_convertible_v<const typename L::template mapping<E>&, mapping_type> ||
│ │ │ │ +
322 !std::is_convertible_v<typename A::reference, value_type> ||
│ │ │ │ +
323 !std::is_convertible_v<Alloc, Al>)
│ │ │ │ +
324 #endif
│ │ │ │ +
│ │ │ │ +
325 constexpr mdarray (const mdspan<V,E,L,A>& other, const Alloc& a)
│ │ │ │ +
326 : container_(other.size(), a)
│ │ │ │ +
327 , mapping_(other.mapping_)
│ │ │ │ +
328 {
│ │ │ │ +
329 init_from_mdspan(other);
│ │ │ │ +
330 }
│ │ │ │ +
│ │ │ │ +
331
│ │ │ │ +
333
│ │ │ │ +
334private:
│ │ │ │ +
335
│ │ │ │ +
336 template <class V, class E, class L, class A, class... Indices>
│ │ │ │ +
337 void init_from_mdspan (const mdspan<V,E,L,A>& other, Indices... ii)
│ │ │ │ +
338 {
│ │ │ │ +
339 constexpr rank_type pos = sizeof...(Indices);
│ │ │ │ +
340 if constexpr(pos < rank()) {
│ │ │ │ +
341 for (typename E::index_type i = 0; i < other.extent(pos); ++i)
│ │ │ │ +
342 init_from_mdspan(other,ii...,i);
│ │ │ │ +
343 } else {
│ │ │ │ +
344 using I = std::array<typename E::index_type,E::rank()>;
│ │ │ │ +
345 container_[mapping_(index_type(ii)...)] = other[I{ii...}];
│ │ │ │ +
346 }
│ │ │ │ +
347 }
│ │ │ │ +
348
│ │ │ │ +
349public:
│ │ │ │ +
350
│ │ │ │ +
353
│ │ │ │ +
360 template <class... Indices,
│ │ │ │ +
361 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
362 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ +
│ │ │ │ +
363 constexpr reference operator() (Indices... indices)
│ │ │ │ +
364 {
│ │ │ │ +
365 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ +
366 }
│ │ │ │ +
│ │ │ │ +
367
│ │ │ │ +
372 template <class... Indices,
│ │ │ │ +
373 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
374 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ +
│ │ │ │ +
375 constexpr const_reference operator() (Indices... indices) const
│ │ │ │ +
376 {
│ │ │ │ +
377 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ +
378 }
│ │ │ │ +
│ │ │ │ +
379
│ │ │ │ +
380
│ │ │ │ +
381#if __cpp_multidimensional_subscript >= 202110L
│ │ │ │
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 }
│ │ │ │ -
│ │ │ │ +
384 template <class... Indices,
│ │ │ │ +
385 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
386 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ +
387 constexpr reference operator[] (Indices... indices)
│ │ │ │ +
388 {
│ │ │ │ +
389 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ +
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 }
│ │ │ │ -
│ │ │ │ +
393 template <class... Indices,
│ │ │ │ +
394 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
395 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ +
396 constexpr const_reference operator[] (Indices... indices) const
│ │ │ │ +
397 {
│ │ │ │ +
398 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ +
399 }
│ │ │ │ +
400
│ │ │ │ +
401#else
│ │ │ │ +
402
│ │ │ │ +
405 template <class Index, class E = extents_type,
│ │ │ │ +
406 std::enable_if_t<std::is_convertible_v<Index,index_type>, int> = 0,
│ │ │ │ +
407 std::enable_if_t<(E::rank() == 1), int> = 0>
│ │ │ │ +
│ │ │ │ +
408 constexpr reference operator[] (Index index)
│ │ │ │ +
409 {
│ │ │ │ +
410 return container_[mapping_(index_type(std::move(index)))];
│ │ │ │ +
411 }
│ │ │ │ +
│ │ │ │ +
412
│ │ │ │ +
415 template <class Index, class E = extents_type,
│ │ │ │ +
416 std::enable_if_t<std::is_convertible_v<Index,index_type>, int> = 0,
│ │ │ │ +
417 std::enable_if_t<(E::rank() == 1), int> = 0>
│ │ │ │ +
│ │ │ │ +
418 constexpr const_reference operator[] (Index index) const
│ │ │ │ +
419 {
│ │ │ │ +
420 return container_[mapping_(index_type(std::move(index)))];
│ │ │ │ +
421 }
│ │ │ │ +
│ │ │ │ +
422
│ │ │ │ +
423#endif
│ │ │ │ +
424
│ │ │ │ +
425
│ │ │ │ +
427 template <class Index,
│ │ │ │ +
428 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
429 constexpr reference operator[] (Std::span<Index,extents_type::rank()> indices)
│ │ │ │ +
430 {
│ │ │ │ +
431 return unpackIntegerSequence([&](auto... ii) -> reference {
│ │ │ │ +
432 return container_[mapping_(index_type(indices[ii])...)]; },
│ │ │ │ +
433 std::make_index_sequence<extents_type::rank()>{});
│ │ │ │ +
434 }
│ │ │ │ +
│ │ │ │ +
435
│ │ │ │ +
437 template <class Index,
│ │ │ │ +
438 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
439 constexpr const_reference operator[] (Std::span<Index,extents_type::rank()> indices) const
│ │ │ │ +
440 {
│ │ │ │ +
441 return unpackIntegerSequence([&](auto... ii) -> const_reference {
│ │ │ │ +
442 return container_[mapping_(index_type(indices[ii])...)]; },
│ │ │ │ +
443 std::make_index_sequence<extents_type::rank()>{});
│ │ │ │ +
444 }
│ │ │ │ +
│ │ │ │ +
445
│ │ │ │ +
447 template <class Index,
│ │ │ │ +
448 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
449 constexpr reference operator[] (const std::array<Index,extents_type::rank()>& indices)
│ │ │ │ +
450 {
│ │ │ │ +
451 return std::apply([&](auto... ii) -> reference {
│ │ │ │ +
452 return container_[mapping_(index_type(ii)...)]; }, indices);
│ │ │ │ +
453 }
│ │ │ │ +
│ │ │ │ +
454
│ │ │ │ +
456 template <class Index,
│ │ │ │ +
457 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
458 constexpr const_reference operator[] (const std::array<Index,extents_type::rank()>& indices) const
│ │ │ │ +
459 {
│ │ │ │ +
460 return std::apply([&](auto... ii) -> const_reference {
│ │ │ │ +
461 return container_[mapping_(index_type(ii)...)]; }, indices);
│ │ │ │ +
462 }
│ │ │ │ +
│ │ │ │ +
463
│ │ │ │ +
465
│ │ │ │ +
466
│ │ │ │ +
468 constexpr const extents_type& extents () const noexcept { return mapping_.extents(); }
│ │ │ │ +
469
│ │ │ │ +
471 constexpr const mapping_type& mapping () const noexcept { return mapping_; }
│ │ │ │
472
│ │ │ │ -
485 template<typename BinaryFunction, typename Type>
│ │ │ │ -
│ │ │ │ -
486 int allreduce([[maybe_unused]] Type* inout, [[maybe_unused]] int len) const
│ │ │ │ -
487 {
│ │ │ │ -
488 return 0;
│ │ │ │ -
489 }
│ │ │ │ -
│ │ │ │ +
474 constexpr const container_type& container () const noexcept { return container_; }
│ │ │ │ +
475
│ │ │ │ +
482 constexpr container_type&& extract_container () && noexcept { return std::move(container_); }
│ │ │ │ +
483
│ │ │ │ +
484
│ │ │ │ +
487
│ │ │ │ +
489 static constexpr rank_type rank () noexcept { return extents_type::rank(); }
│ │ │ │
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 };
│ │ │ │ -
│ │ │ │ +
492 static constexpr rank_type rank_dynamic () noexcept { return extents_type::rank_dynamic(); }
│ │ │ │ +
493
│ │ │ │ +
495 static constexpr std::size_t static_extent (rank_type r) noexcept { return extents_type::static_extent(r); }
│ │ │ │ +
496
│ │ │ │ +
498 constexpr index_type extent (rank_type r) const noexcept { return extents().extent(r); }
│ │ │ │ +
499
│ │ │ │ +
│ │ │ │ +
501 constexpr size_type size () const noexcept
│ │ │ │ +
502 {
│ │ │ │ +
503 size_type s = 1;
│ │ │ │ +
504 for (rank_type r = 0; r < rank(); ++r)
│ │ │ │ +
505 s *= extent(r);
│ │ │ │ +
506 return s;
│ │ │ │ +
507 }
│ │ │ │ +
│ │ │ │ +
508
│ │ │ │ +
510 constexpr std::size_t container_size () const { return container_.size(); }
│ │ │ │ +
511
│ │ │ │ +
513 [[nodiscard]] constexpr bool empty () const noexcept { return size() == 0; }
│ │ │ │ +
514
│ │ │ │ +
516 constexpr index_type stride (rank_type r) const { return mapping().stride(r); };
│ │ │ │ +
517
│ │ │ │ +
519
│ │ │ │ +
520
│ │ │ │ +
521 static constexpr bool is_always_unique () noexcept { return mapping_type::is_always_unique(); }
│ │ │ │ +
522 static constexpr bool is_always_exhaustive () noexcept { return mapping_type::is_always_exhaustive(); }
│ │ │ │ +
523 static constexpr bool is_always_strided () noexcept { return mapping_type::is_always_strided(); }
│ │ │ │ +
524
│ │ │ │ +
525 constexpr bool is_unique () const noexcept { return mapping_.is_unique(); }
│ │ │ │ +
526 constexpr bool is_exhaustive () const noexcept { return mapping_.is_exhaustive(); }
│ │ │ │ +
527 constexpr bool is_strided () const noexcept { return mapping_.is_strided(); }
│ │ │ │ +
528
│ │ │ │ +
529
│ │ │ │
532
│ │ │ │ -
538 template<class T>
│ │ │ │ - │ │ │ │ -
540 [[deprecated("CollectiveCommunication is deprecated. Use Communication instead.")]]
│ │ │ │ - │ │ │ │ -
542}
│ │ │ │ -
543
│ │ │ │ -
544#endif // DUNE_COMMON_PARALLEL_COMMUNICATION_HH
│ │ │ │ - │ │ │ │ -
A few common exception classes.
│ │ │ │ -
helper classes to provide unique types for standard functions
│ │ │ │ -
#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:238
│ │ │ │ -
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:260
│ │ │ │ -
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:124
│ │ │ │ +
534 constexpr pointer container_data () noexcept { return Std::to_address(container_.begin()); }
│ │ │ │ +
535
│ │ │ │ +
537 constexpr const_pointer container_data () const noexcept { return Std::to_address(container_.begin()); }
│ │ │ │ +
538
│ │ │ │ +
540
│ │ │ │ +
541
│ │ │ │ +
│ │ │ │ +
542 friend constexpr void swap (mdarray& x, mdarray& y) noexcept
│ │ │ │ +
543 {
│ │ │ │ +
544 using std::swap;
│ │ │ │ +
545 swap(x.container_, y.container_);
│ │ │ │ +
546 swap(x.mapping_, y.mapping_);
│ │ │ │ +
547 }
│ │ │ │ +
│ │ │ │ +
548
│ │ │ │ +
549
│ │ │ │ +
552
│ │ │ │ +
│ │ │ │ +
553 friend constexpr bool operator== (const mdarray& lhs, const mdarray& rhs) noexcept
│ │ │ │ +
554 {
│ │ │ │ +
555 return lhs.mapping() == rhs.mapping() && lhs.container() == rhs.container();
│ │ │ │ +
556 }
│ │ │ │ +
│ │ │ │ +
557
│ │ │ │ +
559
│ │ │ │ +
562
│ │ │ │ +
564 template <class V, class E, class L, class A,
│ │ │ │ +
565 std::enable_if_t<std::is_assignable_v<mdspan<V,E,L,A>, mdspan_type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
566 constexpr operator mdspan<V,E,L,A> ()
│ │ │ │ +
567 {
│ │ │ │ + │ │ │ │ +
569 }
│ │ │ │ +
│ │ │ │ +
570
│ │ │ │ +
572 template <class V, class E, class L, class A,
│ │ │ │ +
573 std::enable_if_t<std::is_assignable_v<mdspan<V,E,L,A>, const_mdspan_type>, int> = 0>
│ │ │ │ +
│ │ │ │ +
574 constexpr operator mdspan<V,E,L,A> () const
│ │ │ │ +
575 {
│ │ │ │ + │ │ │ │ +
577 }
│ │ │ │ +
│ │ │ │ +
578
│ │ │ │ +
580 template <class AccessorPolicy = Std::default_accessor<element_type>,
│ │ │ │ +
581 std::enable_if_t<
│ │ │ │ +
582 std::is_assignable_v<mdspan_type, mdspan<element_type,extents_type,layout_type,AccessorPolicy>>, int> = 0>
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
584 to_mdspan (const AccessorPolicy& a = AccessorPolicy{})
│ │ │ │ +
585 {
│ │ │ │ + │ │ │ │ +
587 }
│ │ │ │ +
│ │ │ │ +
588
│ │ │ │ +
590 template <class AccessorPolicy = Std::default_accessor<const element_type>,
│ │ │ │ +
591 std::enable_if_t<
│ │ │ │ +
592 std::is_assignable_v<const_mdspan_type, mdspan<const element_type,extents_type,layout_type,AccessorPolicy>>, int> = 0>
│ │ │ │ +
593 constexpr mdspan<const element_type,extents_type,layout_type,AccessorPolicy>
│ │ │ │ +
│ │ │ │ +
594 to_mdspan (const AccessorPolicy& a = AccessorPolicy{}) const
│ │ │ │ +
595 {
│ │ │ │ + │ │ │ │ +
597 }
│ │ │ │ +
│ │ │ │ +
598
│ │ │ │ +
599protected:
│ │ │ │ + │ │ │ │ +
601 [[no_unique_address]] mapping_type mapping_;
│ │ │ │ +
602};
│ │ │ │ +
│ │ │ │ +
603
│ │ │ │ +
607
│ │ │ │ +
608template <class IndexType, std::size_t... exts, class Container>
│ │ │ │ +
609mdarray (const Std::extents<IndexType, exts...>&, const Container&)
│ │ │ │ +
610 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ +
611
│ │ │ │ +
612template <class Mapping, class Container>
│ │ │ │ +
613mdarray (const Mapping&, const Container&)
│ │ │ │ + │ │ │ │ +
615
│ │ │ │ +
616template <class IndexType, std::size_t... exts, class Container>
│ │ │ │ +
617mdarray (const Std::extents<IndexType, exts...>&, Container&&)
│ │ │ │ +
618 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ +
619
│ │ │ │ +
620template <class Mapping, class Container>
│ │ │ │ +
621mdarray (const Mapping&, Container&&)
│ │ │ │ + │ │ │ │ +
623
│ │ │ │ +
624template <class Element, class Extents, class Layout, class Accessor>
│ │ │ │ + │ │ │ │ +
626 -> mdarray<std::remove_cv_t<Element>, Extents, Layout>;
│ │ │ │ +
627
│ │ │ │ +
628template <class IndexType, std::size_t... exts, class Container, class Alloc>
│ │ │ │ +
629mdarray (const Std::extents<IndexType, exts...>&, const Container&, const Alloc&)
│ │ │ │ +
630 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ +
631
│ │ │ │ +
632template <class Mapping, class Container, class Alloc>
│ │ │ │ +
633mdarray (const Mapping&, const Container&, const Alloc&)
│ │ │ │ + │ │ │ │ +
635
│ │ │ │ +
636template <class IndexType, std::size_t... exts, class Container, class Alloc>
│ │ │ │ +
637mdarray (const Std::extents<IndexType, exts...>&, Container&&, const Alloc&)
│ │ │ │ +
638 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ +
639
│ │ │ │ +
640template <class Mapping, class Container, class Alloc>
│ │ │ │ +
641mdarray (const Mapping&, Container&&, const Alloc&)
│ │ │ │ + │ │ │ │ +
643
│ │ │ │ +
644template <class Element, class Extents, class Layout, class Accessor, class Alloc>
│ │ │ │ + │ │ │ │ +
646 -> mdarray<std::remove_cv_t<Element>, Extents, Layout>;
│ │ │ │ +
647
│ │ │ │ +
649
│ │ │ │ +
653
│ │ │ │ +
654template <class Element, class Extents, class Layout, class Container>
│ │ │ │ + │ │ │ │ +
656 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::element_type,
│ │ │ │ +
657 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::extents_type,
│ │ │ │ +
658 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::layout_type,
│ │ │ │ +
659 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::accessor_type>;
│ │ │ │ +
660
│ │ │ │ +
662
│ │ │ │ +
663} // end namespace Dune::Std
│ │ │ │ +
664
│ │ │ │ +
665#endif // DUNE_COMMON_STD_MDARRAY_HH
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
Utilities for reduction like operations on ranges.
│ │ │ │ +
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:124
│ │ │ │ +
STL namespace.
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
constexpr auto to_address(T &&p) noexcept
Obtain the address represented by p without forming a reference to the object pointed to by p.
Definition memory.hh:47
│ │ │ │ +
Get the 'const' version of a reference to a mutable object.
Definition genericiterator.hh:87
│ │ │ │ +
Multidimensional index space with dynamic and static extents.
Definition extents.hh:54
│ │ │ │ +
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ +
An owning multi-dimensional array analog of mdspan.
Definition mdarray.hh:69
│ │ │ │ +
mdspan< const element_type, extents_type, layout_type > const_mdspan_type
Definition mdarray.hh:91
│ │ │ │ +
constexpr mdarray(const mapping_type &m, const container_type &c, const Alloc &a)
Construct from layout mapping, container and allocator.
Definition mdarray.hh:288
│ │ │ │ +
typename container_type::const_reference const_reference
Definition mdarray.hh:96
│ │ │ │ +
constexpr mdarray(const mapping_type &m, container_type &&c)
Construct from layout mapping and the storage container.
Definition mdarray.hh:194
│ │ │ │ +
Container container_type
Definition mdarray.hh:81
│ │ │ │ +
Extents extents_type
Definition mdarray.hh:79
│ │ │ │ +
constexpr mdarray(const E &e, const container_type &c)
Construct from extents and the storage container.
Definition mdarray.hh:174
│ │ │ │ +
static constexpr bool is_always_exhaustive() noexcept
Definition mdarray.hh:522
│ │ │ │ +
constexpr mdspan< const element_type, extents_type, layout_type, AccessorPolicy > to_mdspan(const AccessorPolicy &a=AccessorPolicy{}) const
Conversion function to mdspan.
Definition mdarray.hh:594
│ │ │ │ +
constexpr index_type stride(rank_type r) const
The stride along the specified dimension.
Definition mdarray.hh:516
│ │ │ │ +
constexpr bool is_unique() const noexcept
Definition mdarray.hh:525
│ │ │ │ +
constexpr index_type extent(rank_type r) const noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdarray.hh:498
│ │ │ │ +
constexpr mdarray(const extents_type &e, const Alloc &a)
Construct from the extents of the array and allocator.
Definition mdarray.hh:243
│ │ │ │ +
static constexpr std::size_t static_extent(rank_type r) noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdarray.hh:495
│ │ │ │ +
mapping_type mapping_
Definition mdarray.hh:601
│ │ │ │ +
constexpr mdarray(const mdspan< OtherElementType, OtherExtents, OtherLayoutPolicy, Accessor > &other)
Converting constructor from mdspan.
Definition mdarray.hh:229
│ │ │ │ +
typename layout_type::template mapping< extents_type > mapping_type
Definition mdarray.hh:84
│ │ │ │ +
constexpr const_pointer container_data() const noexcept
Direct access to the underlying const data in the container.
Definition mdarray.hh:537
│ │ │ │ +
constexpr mdarray(const extents_type &e, const value_type &v)
Construct from extents and initial value.
Definition mdarray.hh:155
│ │ │ │ +
constexpr mdarray(const mapping_type &m, const Alloc &a)
Construct from the layout mapping of the array and allocator.
Definition mdarray.hh:250
│ │ │ │ +
constexpr pointer container_data() noexcept
Direct access to the underlying data in the container.
Definition mdarray.hh:534
│ │ │ │ +
constexpr bool is_exhaustive() const noexcept
Definition mdarray.hh:526
│ │ │ │ +
decltype(Std::to_address(std::declval< container_type >().begin())) pointer
Definition mdarray.hh:93
│ │ │ │ +
constexpr reference operator[](Index index)
Access specified element at position [i0] For a rank one mdarray, the operator[i] is added to support...
Definition mdarray.hh:408
│ │ │ │ +
constexpr const extents_type & extents() const noexcept
Number of elements in all dimensions of the array,.
Definition mdarray.hh:468
│ │ │ │ +
constexpr bool is_strided() const noexcept
Definition mdarray.hh:527
│ │ │ │ +
constexpr mdarray(const mapping_type &m, const container_type &c)
Construct from layout mapping and the storage container.
Definition mdarray.hh:188
│ │ │ │ +
static constexpr bool is_always_unique() noexcept
Definition mdarray.hh:521
│ │ │ │ +
constexpr mdarray(const mapping_type &m, container_type &&c, const Alloc &a)
Construct from layout mapping, container and allocator.
Definition mdarray.hh:296
│ │ │ │ +
constexpr mdarray(const E &e, container_type &&c)
Construct from extents and the storage container.
Definition mdarray.hh:182
│ │ │ │ +
constexpr const container_type & container() const noexcept
The underlying storage container.
Definition mdarray.hh:474
│ │ │ │ +
constexpr std::size_t container_size() const
Size of the underlying container.
Definition mdarray.hh:510
│ │ │ │ +
typename extents_type::size_type size_type
Definition mdarray.hh:87
│ │ │ │ +
static constexpr rank_type rank() noexcept
Number of dimensions of the array.
Definition mdarray.hh:489
│ │ │ │ +
constexpr bool empty() const noexcept
Check whether the index space is empty.
Definition mdarray.hh:513
│ │ │ │ +
constexpr mdarray(const extents_type &e, container_type &&c, const Alloc &a)
Construct from extents, container and allocator.
Definition mdarray.hh:280
│ │ │ │ +
mdspan< element_type, extents_type, layout_type > mdspan_type
Definition mdarray.hh:90
│ │ │ │ +
constexpr size_type size() const noexcept
Size of the multi-dimensional index space.
Definition mdarray.hh:501
│ │ │ │ +
friend constexpr bool operator==(const mdarray &lhs, const mdarray &rhs) noexcept
Definition mdarray.hh:553
│ │ │ │ +
friend constexpr void swap(mdarray &x, mdarray &y) noexcept
Definition mdarray.hh:542
│ │ │ │ +
constexpr const mapping_type & mapping() const noexcept
Index mapping of a layout policy.
Definition mdarray.hh:471
│ │ │ │ +
Element element_type
Definition mdarray.hh:78
│ │ │ │ +
constexpr mdarray(const mapping_type &m, const value_type &v, const Alloc &a)
Construct from layout mapping, initial value and allocator.
Definition mdarray.hh:264
│ │ │ │ +
constexpr mdarray(const extents_type &e, const value_type &v, const Alloc &a)
Construct from extents, initial value and allocator.
Definition mdarray.hh:257
│ │ │ │ +
decltype(Std::to_address(std::declval< container_type >().cbegin())) const_pointer
Definition mdarray.hh:95
│ │ │ │ +
typename container_type::reference reference
Definition mdarray.hh:94
│ │ │ │ +
constexpr mdspan< element_type, extents_type, layout_type, AccessorPolicy > to_mdspan(const AccessorPolicy &a=AccessorPolicy{})
Conversion function to mdspan.
Definition mdarray.hh:584
│ │ │ │ +
element_type value_type
Definition mdarray.hh:83
│ │ │ │ +
LayoutPolicy layout_type
Definition mdarray.hh:80
│ │ │ │ +
constexpr container_type && extract_container() &&noexcept
Move the container out of the mdarray.
Definition mdarray.hh:482
│ │ │ │ +
constexpr mdarray(const extents_type &e, const container_type &c, const Alloc &a)
Construct from extents, container and allocator.
Definition mdarray.hh:272
│ │ │ │ +
typename extents_type::rank_type rank_type
Definition mdarray.hh:88
│ │ │ │ +
static constexpr rank_type rank_dynamic() noexcept
Number of dimension with dynamic size.
Definition mdarray.hh:492
│ │ │ │ +
constexpr reference operator()(Indices... indices)
Access element at position (i0,i1,...)
Definition mdarray.hh:363
│ │ │ │ +
constexpr mdarray(const extents_type &e)
Construct from the extents of the array.
Definition mdarray.hh:138
│ │ │ │ +
container_type container_
Definition mdarray.hh:600
│ │ │ │ +
typename extents_type::index_type index_type
Definition mdarray.hh:86
│ │ │ │ +
constexpr mdarray(IndexTypes... exts)
Construct from the dynamic extents.
Definition mdarray.hh:133
│ │ │ │ +
static constexpr bool is_always_strided() noexcept
Definition mdarray.hh:523
│ │ │ │ +
A multi-dimensional non-owning array view.
Definition mdspan.hh:64
│ │ │ │ +
constexpr index_type extent(rank_type r) const noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdspan.hh:275
│ │ │ │ +
constexpr size_type size() const noexcept
The number of elements accessible by this multi-dimensional span.
Definition mdspan.hh:278
│ │ │ │ +
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,480 +1,909 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +mdarray.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 © 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> │ │ │ │ │ -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 {} │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_MDARRAY_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_MDARRAY_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#if __has_include() │ │ │ │ │ +15 #include │ │ │ │ │ +16#endif │ │ │ │ │ +17 │ │ │ │ │ +18#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +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_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_d_s_p_a_n_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ +23#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ +24#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_c_o_n_t_a_i_n_e_r_c_o_n_s_t_r_u_c_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ +25 │ │ │ │ │ +26namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +27 │ │ │ │ │ +66template > │ │ │ │ │ +_6_8class _m_d_a_r_r_a_y │ │ │ │ │ +69{ │ │ │ │ │ +_7_0 template friend class _m_d_a_r_r_a_y; │ │ │ │ │ +71 │ │ │ │ │ +72 static_assert(std::is_object_v); │ │ │ │ │ +73 static_assert(!std::is_abstract_v); │ │ │ │ │ +74 static_assert(!std::is_array_v); │ │ │ │ │ +75 static_assert(std::is_same_v); │ │ │ │ │ +76 │ │ │ │ │ +77public: │ │ │ │ │ +_7_8 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ +_7_9 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ +_8_0 using _l_a_y_o_u_t___t_y_p_e = LayoutPolicy; │ │ │ │ │ +_8_1 using _c_o_n_t_a_i_n_e_r___t_y_p_e = Container; │ │ │ │ │ +82 │ │ │ │ │ +_8_3 using _v_a_l_u_e___t_y_p_e = _e_l_e_m_e_n_t___t_y_p_e; │ │ │ │ │ +_8_4 using _m_a_p_p_i_n_g___t_y_p_e = typename layout_type::template mapping; │ │ │ │ │ +85 │ │ │ │ │ +_8_6 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ +_8_7 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ +_8_8 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ +89 │ │ │ │ │ +_9_0 using _m_d_s_p_a_n___t_y_p_e = _m_d_s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_>; │ │ │ │ │ +_9_1 using _c_o_n_s_t___m_d_s_p_a_n___t_y_p_e = _m_d_s_p_a_n_<_c_o_n_s_t │ │ │ │ │ +_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_>; │ │ │ │ │ +92 │ │ │ │ │ +_9_3 using _p_o_i_n_t_e_r = decltype(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(std::declval │ │ │ │ │ +().begin())); │ │ │ │ │ +_9_4 using _r_e_f_e_r_e_n_c_e = typename container_type::reference; │ │ │ │ │ +_9_5 using _c_o_n_s_t___p_o_i_n_t_e_r = decltype(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(std::declval │ │ │ │ │ +().cbegin())); │ │ │ │ │ +_9_6 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = typename container_type::const_reference; │ │ │ │ │ +97 │ │ │ │ │ +98 static_assert(std::is_constructible_v); │ │ │ │ │ +99 │ │ │ │ │ +100private: │ │ │ │ │ +101 // helper function to construct the container │ │ │ │ │ +102 template │ │ │ │ │ +103 static constexpr auto construct_container (Args&&... args) │ │ │ │ │ +104 -> decltype(Impl::ContainerConstructionTraits::construct(std:: │ │ │ │ │ +forward(args)...)) │ │ │ │ │ +105 { │ │ │ │ │ +106 return Impl::ContainerConstructionTraits::construct(std::forward │ │ │ │ │ +(args)...); │ │ │ │ │ +107 } │ │ │ │ │ +108 │ │ │ │ │ +109public: │ │ │ │ │ 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 } │ │ │ │ │ +114 template = 0, │ │ │ │ │ +116 std::enable_if_t, int> = 0, │ │ │ │ │ +117 std::enable_if_t, int> = 0> │ │ │ │ │ +_1_1_8 constexpr _m_d_a_r_r_a_y () │ │ │ │ │ +119 : _c_o_n_t_a_i_n_e_r__{} │ │ │ │ │ +120 , _m_a_p_p_i_n_g__{} │ │ │ │ │ +121 {} │ │ │ │ │ +122 │ │ │ │ │ +123 │ │ │ │ │ +124 // ------------------------------------- │ │ │ │ │ +125 // constructors from extents or mappings │ │ │ │ │ +126 │ │ │ │ │ +127 │ │ │ │ │ +129 template ), │ │ │ │ │ +int> = 0, │ │ │ │ │ +131 std::enable_if_t, int> │ │ │ │ │ += 0, │ │ │ │ │ +132 std::enable_if_t<(... && std:: │ │ │ │ │ +is_nothrow_constructible_v), int> = 0> │ │ │ │ │ +_1_3_3 explicit constexpr _m_d_a_r_r_a_y (IndexTypes... exts) │ │ │ │ │ +134 : _m_d_a_r_r_a_y(_e_x_t_e_n_t_s___t_y_p_e(_i_n_d_e_x___t_y_p_e(_s_t_d::move(exts))...)) │ │ │ │ │ +135 {} │ │ │ │ │ +136 │ │ │ │ │ +_1_3_8 explicit constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e) │ │ │ │ │ +139 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e)) │ │ │ │ │ +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 } │ │ │ │ │ +143 template (std::declval()), bool{}) = │ │ │ │ │ +true> │ │ │ │ │ +_1_4_5 explicit constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m) │ │ │ │ │ +146 : _c_o_n_t_a_i_n_e_r__(construct_container(m.required_span_size())) │ │ │ │ │ +147 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ +148 {} │ │ │ │ │ +149 │ │ │ │ │ +150 │ │ │ │ │ +151 // --------------------------------------- │ │ │ │ │ +152 // constructors with a given initial value │ │ │ │ │ +153 │ │ │ │ │ +_1_5_5 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const _v_a_l_u_e___t_y_p_e& v) │ │ │ │ │ +156 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e), v) │ │ │ │ │ +157 {} │ │ │ │ │ +158 │ │ │ │ │ +160 template (std::declval(),std:: │ │ │ │ │ +declval()), bool{}) = true> │ │ │ │ │ +_1_6_2 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _v_a_l_u_e___t_y_p_e& v) │ │ │ │ │ +163 : _c_o_n_t_a_i_n_e_r__(construct_container(m.required_span_size(), v)) │ │ │ │ │ +164 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ +165 {} │ │ │ │ │ +166 │ │ │ │ │ +167 │ │ │ │ │ +168 // ----------------------------------- │ │ │ │ │ +169 // constructors with a given container │ │ │ │ │ +170 │ │ │ │ │ +172 template , int> = 0> │ │ │ │ │ +_1_7_4 constexpr _m_d_a_r_r_a_y (const E& e, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c) │ │ │ │ │ +175 : _c_o_n_t_a_i_n_e_r__(c) │ │ │ │ │ +176 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ +177 {} │ │ │ │ │ +178 │ │ │ │ │ +180 template , int> = 0> │ │ │ │ │ +_1_8_2 constexpr _m_d_a_r_r_a_y (const E& e, _c_o_n_t_a_i_n_e_r___t_y_p_e&& c) │ │ │ │ │ +183 : _c_o_n_t_a_i_n_e_r__(_s_t_d::move(c)) │ │ │ │ │ +184 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ +185 {} │ │ │ │ │ +186 │ │ │ │ │ +_1_8_8 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c) │ │ │ │ │ +189 : _c_o_n_t_a_i_n_e_r__(c) │ │ │ │ │ +190 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ +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, │ │ │ │ │ +int> = 0, │ │ │ │ │ +206 std::enable_if_t, int> = │ │ │ │ │ +0, │ │ │ │ │ +207 std::enable_if_t&>, int> = 0> │ │ │ │ │ +208 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +209 explicit( │ │ │ │ │ +210 !std::is_convertible_v&, _m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ +211 !std::is_convertible_v) │ │ │ │ │ +212 #endif │ │ │ │ │ +_2_1_3 constexpr _m_d_a_r_r_a_y (const │ │ │ │ │ +_m_d_a_r_r_a_y_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_O_t_h_e_r_E_x_t_e_n_t_s_,_O_t_h_e_r_L_a_y_o_u_t_P_o_l_i_c_y_,_O_t_h_e_r_C_o_n_t_a_i_n_e_r_>& other) │ │ │ │ │ +214 : _c_o_n_t_a_i_n_e_r__(other._c_o_n_t_a_i_n_e_r__) │ │ │ │ │ +215 , _m_a_p_p_i_n_g__(other._m_a_p_p_i_n_g__) │ │ │ │ │ +216 {} │ │ │ │ │ +217 │ │ │ │ │ +219 template , int> = 0, │ │ │ │ │ +221 std::enable_if_t, int> = 0, │ │ │ │ │ +222 std::enable_if_t&>, int> = 0, │ │ │ │ │ +223 decltype(construct_container(std::declval()), │ │ │ │ │ +bool{}) = true> │ │ │ │ │ +224 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +225 explicit( │ │ │ │ │ +226 !std::is_convertible_v&, _m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ +227 !std::is_convertible_v) │ │ │ │ │ +228 #endif │ │ │ │ │ +_2_2_9 constexpr _m_d_a_r_r_a_y (const │ │ │ │ │ +_m_d_s_p_a_n_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_O_t_h_e_r_E_x_t_e_n_t_s_,_O_t_h_e_r_L_a_y_o_u_t_P_o_l_i_c_y_,_A_c_c_e_s_s_o_r_>& other) │ │ │ │ │ +230 : _c_o_n_t_a_i_n_e_r__(construct_container<_c_o_n_t_a_i_n_e_r___t_y_p_e>(other._s_i_z_e())) │ │ │ │ │ +231 , _m_a_p_p_i_n_g__(other._m_a_p_p_i_n_g()) │ │ │ │ │ +232 { │ │ │ │ │ +233 init_from_mdspan(other); │ │ │ │ │ +234 } │ │ │ │ │ +235 │ │ │ │ │ +236 │ │ │ │ │ +237 // ---------------------------- │ │ │ │ │ +238 // constructors with allocators │ │ │ │ │ +239 │ │ │ │ │ +241 template , int> = 0> │ │ │ │ │ +_2_4_3 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const Alloc& a) │ │ │ │ │ +244 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e), a) │ │ │ │ │ +245 {} │ │ │ │ │ +246 │ │ │ │ │ +248 template , int> = 0> │ │ │ │ │ +_2_5_0 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const Alloc& a) │ │ │ │ │ +251 : _c_o_n_t_a_i_n_e_r__(m.required_span_size(), a) │ │ │ │ │ +252 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ +253 {} │ │ │ │ │ +254 │ │ │ │ │ +256 template │ │ │ │ │ +_2_5_7 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const _v_a_l_u_e___t_y_p_e& v, const Alloc& │ │ │ │ │ +a) │ │ │ │ │ +258 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e), v, a) │ │ │ │ │ +259 {} │ │ │ │ │ +260 │ │ │ │ │ +262 template , int> = 0> │ │ │ │ │ +_2_6_4 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _v_a_l_u_e___t_y_p_e& v, const Alloc& │ │ │ │ │ +a) │ │ │ │ │ +265 : _c_o_n_t_a_i_n_e_r__(m.required_span_size(), v, a) │ │ │ │ │ +266 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ +267 {} │ │ │ │ │ +268 │ │ │ │ │ +270 template , int> = 0> │ │ │ │ │ +_2_7_2 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c, const │ │ │ │ │ +Alloc& a) │ │ │ │ │ +273 : _c_o_n_t_a_i_n_e_r__(c, a) │ │ │ │ │ +274 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ +275 {} │ │ │ │ │ +276 │ │ │ │ │ +278 template , int> = 0> │ │ │ │ │ +_2_8_0 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, _c_o_n_t_a_i_n_e_r___t_y_p_e&& c, const Alloc& │ │ │ │ │ +a) │ │ │ │ │ +281 : _c_o_n_t_a_i_n_e_r__(_s_t_d::move(c), a) │ │ │ │ │ +282 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ +283 {} │ │ │ │ │ +284 │ │ │ │ │ +286 template , int> = 0> │ │ │ │ │ +_2_8_8 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c, const │ │ │ │ │ +Alloc& a) │ │ │ │ │ +289 : _c_o_n_t_a_i_n_e_r__(c, a) │ │ │ │ │ +290 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ +291 {} │ │ │ │ │ +292 │ │ │ │ │ +294 template , int> = 0> │ │ │ │ │ +_2_9_6 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, _c_o_n_t_a_i_n_e_r___t_y_p_e&& c, const Alloc& │ │ │ │ │ +a) │ │ │ │ │ +297 : _c_o_n_t_a_i_n_e_r__(_s_t_d::move(c), a) │ │ │ │ │ +298 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ +299 {} │ │ │ │ │ +300 │ │ │ │ │ +302 template , int> = │ │ │ │ │ +0> │ │ │ │ │ +304 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +305 explicit( │ │ │ │ │ +306 !std::is_convertible_v&, │ │ │ │ │ +_m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ +307 !std::is_convertible_v) │ │ │ │ │ +308 #endif │ │ │ │ │ +_3_0_9 constexpr _m_d_a_r_r_a_y (const _m_d_a_r_r_a_y_<_V_,_E_,_L_,_C_>& other, const Alloc& a) noexcept │ │ │ │ │ +310 : _c_o_n_t_a_i_n_e_r__(other._c_o_n_t_a_i_n_e_r__, a) │ │ │ │ │ +311 , _m_a_p_p_i_n_g__(other._m_a_p_p_i_n_g__) │ │ │ │ │ +312 {} │ │ │ │ │ +313 │ │ │ │ │ +315 template , int> = 0> │ │ │ │ │ +319 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +320 explicit( │ │ │ │ │ +321 !std::is_convertible_v&, │ │ │ │ │ +_m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ +322 !std::is_convertible_v || │ │ │ │ │ +323 !std::is_convertible_v) │ │ │ │ │ +324 #endif │ │ │ │ │ +_3_2_5 constexpr _m_d_a_r_r_a_y (const _m_d_s_p_a_n_<_V_,_E_,_L_,_A_>& other, const Alloc& a) │ │ │ │ │ +326 : _c_o_n_t_a_i_n_e_r__(other._s_i_z_e(), a) │ │ │ │ │ +327 , _m_a_p_p_i_n_g__(other.mapping_) │ │ │ │ │ +328 { │ │ │ │ │ +329 init_from_mdspan(other); │ │ │ │ │ +330 } │ │ │ │ │ +331 │ │ │ │ │ +333 │ │ │ │ │ +334private: │ │ │ │ │ +335 │ │ │ │ │ +336 template │ │ │ │ │ +337 void init_from_mdspan (const _m_d_s_p_a_n_<_V_,_E_,_L_,_A_>& other, Indices... ii) │ │ │ │ │ +338 { │ │ │ │ │ +339 constexpr _r_a_n_k___t_y_p_e pos = sizeof...(Indices); │ │ │ │ │ +340 if constexpr(pos < _r_a_n_k()) { │ │ │ │ │ +341 for (typename E::index_type i = 0; i < other._e_x_t_e_n_t(pos); ++i) │ │ │ │ │ +342 init_from_mdspan(other,ii...,i); │ │ │ │ │ +343 } else { │ │ │ │ │ +344 using I = std::array; │ │ │ │ │ +345 _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(ii)...)] = other[I{ii...}]; │ │ │ │ │ +346 } │ │ │ │ │ +347 } │ │ │ │ │ +348 │ │ │ │ │ +349public: │ │ │ │ │ +350 │ │ │ │ │ +353 │ │ │ │ │ +360 template = 0, │ │ │ │ │ +362 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ +0> │ │ │ │ │ +_3_6_3 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_(_)_ (Indices... indices) │ │ │ │ │ +364 { │ │ │ │ │ +365 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ +366 } │ │ │ │ │ +367 │ │ │ │ │ +372 template = 0, │ │ │ │ │ +374 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ +0> │ │ │ │ │ +_3_7_5 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_(_)_ (Indices... indices) const │ │ │ │ │ +376 { │ │ │ │ │ +377 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ +378 } │ │ │ │ │ +379 │ │ │ │ │ +380 │ │ │ │ │ +381#if __cpp_multidimensional_subscript >= 202110L │ │ │ │ │ 382 │ │ │ │ │ -386 template │ │ │ │ │ -_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)}; │ │ │ │ │ +384 template = 0, │ │ │ │ │ +386 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ +0> │ │ │ │ │ +387 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (Indices... indices) │ │ │ │ │ +388 { │ │ │ │ │ +389 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ 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 = 0, │ │ │ │ │ +395 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ +0> │ │ │ │ │ +396 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (Indices... indices) const │ │ │ │ │ +397 { │ │ │ │ │ +398 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ +399 } │ │ │ │ │ +400 │ │ │ │ │ +401#else │ │ │ │ │ +402 │ │ │ │ │ +405 template , int> = 0, │ │ │ │ │ +407 std::enable_if_t<(E::rank() == 1), int> = 0> │ │ │ │ │ +_4_0_8 constexpr _r_e_f_e_r_e_n_c_e operator[] (Index index) │ │ │ │ │ +409 { │ │ │ │ │ +410 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(index)))]; │ │ │ │ │ +411 } │ │ │ │ │ +412 │ │ │ │ │ +415 template , int> = 0, │ │ │ │ │ +417 std::enable_if_t<(E::rank() == 1), int> = 0> │ │ │ │ │ +_4_1_8 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e operator[] (Index index) const │ │ │ │ │ +419 { │ │ │ │ │ +420 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(index)))]; │ │ │ │ │ +421 } │ │ │ │ │ +422 │ │ │ │ │ +423#endif │ │ │ │ │ +424 │ │ │ │ │ +425 │ │ │ │ │ +427 template , int> = 0> │ │ │ │ │ +_4_2_9 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (_S_t_d_:_:_s_p_a_n │ │ │ │ │ +indices) │ │ │ │ │ +430 { │ │ │ │ │ +431 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ +432 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(indices[ii])...)]; }, │ │ │ │ │ +433 std::make_index_sequence{}); │ │ │ │ │ +434 } │ │ │ │ │ +435 │ │ │ │ │ +437 template , int> = 0> │ │ │ │ │ +_4_3_9 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (_S_t_d_:_:_s_p_a_n │ │ │ │ │ +indices) const │ │ │ │ │ +440 { │ │ │ │ │ +441 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... ii) -> _c_o_n_s_t___r_e_f_e_r_e_n_c_e { │ │ │ │ │ +442 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(indices[ii])...)]; }, │ │ │ │ │ +443 std::make_index_sequence{}); │ │ │ │ │ +444 } │ │ │ │ │ +445 │ │ │ │ │ +447 template , int> = 0> │ │ │ │ │ +_4_4_9 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (const std::array& indices) │ │ │ │ │ +450 { │ │ │ │ │ +451 return std::apply([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ +452 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(ii)...)]; }, indices); │ │ │ │ │ +453 } │ │ │ │ │ +454 │ │ │ │ │ +456 template , int> = 0> │ │ │ │ │ +_4_5_8 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (const std::array& indices) const │ │ │ │ │ +459 { │ │ │ │ │ +460 return std::apply([&](auto... ii) -> _c_o_n_s_t___r_e_f_e_r_e_n_c_e { │ │ │ │ │ +461 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(ii)...)]; }, indices); │ │ │ │ │ +462 } │ │ │ │ │ +463 │ │ │ │ │ +465 │ │ │ │ │ +466 │ │ │ │ │ +_4_6_8 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return │ │ │ │ │ +_m_a_p_p_i_n_g__.extents(); } │ │ │ │ │ +469 │ │ │ │ │ +_4_7_1 constexpr const _m_a_p_p_i_n_g___t_y_p_e& _m_a_p_p_i_n_g () const noexcept { return _m_a_p_p_i_n_g__; │ │ │ │ │ +} │ │ │ │ │ 472 │ │ │ │ │ -485 template │ │ │ │ │ -_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 } │ │ │ │ │ +_4_7_4 constexpr const _c_o_n_t_a_i_n_e_r___t_y_p_e& _c_o_n_t_a_i_n_e_r () const noexcept { return │ │ │ │ │ +_c_o_n_t_a_i_n_e_r__; } │ │ │ │ │ +475 │ │ │ │ │ +_4_8_2 constexpr _c_o_n_t_a_i_n_e_r___t_y_p_e&& _e_x_t_r_a_c_t___c_o_n_t_a_i_n_e_r () && noexcept { return std:: │ │ │ │ │ +move(_c_o_n_t_a_i_n_e_r__); } │ │ │ │ │ +483 │ │ │ │ │ +484 │ │ │ │ │ +487 │ │ │ │ │ +_4_8_9 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k () noexcept { return extents_type::rank(); │ │ │ │ │ +} │ │ │ │ │ 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 }; │ │ │ │ │ +_4_9_2 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k___d_y_n_a_m_i_c () noexcept { return extents_type:: │ │ │ │ │ +rank_dynamic(); } │ │ │ │ │ +493 │ │ │ │ │ +_4_9_5 static constexpr std::size_t _s_t_a_t_i_c___e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) noexcept { return │ │ │ │ │ +extents_type::static_extent(r); } │ │ │ │ │ +496 │ │ │ │ │ +_4_9_8 constexpr _i_n_d_e_x___t_y_p_e _e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) const noexcept { return _e_x_t_e_n_t_s │ │ │ │ │ +().extent(r); } │ │ │ │ │ +499 │ │ │ │ │ +_5_0_1 constexpr _s_i_z_e___t_y_p_e _s_i_z_e () const noexcept │ │ │ │ │ +502 { │ │ │ │ │ +503 _s_i_z_e___t_y_p_e s = 1; │ │ │ │ │ +504 for (_r_a_n_k___t_y_p_e r = 0; r < _r_a_n_k(); ++r) │ │ │ │ │ +505 s *= _e_x_t_e_n_t(r); │ │ │ │ │ +506 return s; │ │ │ │ │ +507 } │ │ │ │ │ +508 │ │ │ │ │ +_5_1_0 constexpr std::size_t _c_o_n_t_a_i_n_e_r___s_i_z_e () const { return _c_o_n_t_a_i_n_e_r__.size(); } │ │ │ │ │ +511 │ │ │ │ │ +_5_1_3 [[nodiscard]] constexpr bool _e_m_p_t_y () const noexcept { return _s_i_z_e() == 0; │ │ │ │ │ +} │ │ │ │ │ +514 │ │ │ │ │ +_5_1_6 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e r) const { return _m_a_p_p_i_n_g().stride │ │ │ │ │ +(r); }; │ │ │ │ │ +517 │ │ │ │ │ +519 │ │ │ │ │ +520 │ │ │ │ │ +_5_2_1 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return mapping_type:: │ │ │ │ │ +is_always_unique(); } │ │ │ │ │ +_5_2_2 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return │ │ │ │ │ +mapping_type::is_always_exhaustive(); } │ │ │ │ │ +_5_2_3 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return mapping_type:: │ │ │ │ │ +is_always_strided(); } │ │ │ │ │ +524 │ │ │ │ │ +_5_2_5 constexpr bool _i_s___u_n_i_q_u_e () const noexcept { return _m_a_p_p_i_n_g__.is_unique(); } │ │ │ │ │ +_5_2_6 constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () const noexcept { return │ │ │ │ │ +_m_a_p_p_i_n_g__.is_exhaustive(); } │ │ │ │ │ +_5_2_7 constexpr bool _i_s___s_t_r_i_d_e_d () const noexcept { return _m_a_p_p_i_n_g__.is_strided(); │ │ │ │ │ +} │ │ │ │ │ +528 │ │ │ │ │ +529 │ │ │ │ │ 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 // DUNE_COMMON_PARALLEL_COMMUNICATION_HH │ │ │ │ │ -_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. │ │ │ │ │ -_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 │ │ │ │ │ -_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:238 │ │ │ │ │ -_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:260 │ │ │ │ │ -_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:124 │ │ │ │ │ +_5_3_4 constexpr _p_o_i_n_t_e_r _c_o_n_t_a_i_n_e_r___d_a_t_a () noexcept { return _S_t_d_:_:_t_o___a_d_d_r_e_s_s │ │ │ │ │ +(_c_o_n_t_a_i_n_e_r__.begin()); } │ │ │ │ │ +535 │ │ │ │ │ +_5_3_7 constexpr _c_o_n_s_t___p_o_i_n_t_e_r _c_o_n_t_a_i_n_e_r___d_a_t_a () const noexcept { return _S_t_d_:_: │ │ │ │ │ +_t_o___a_d_d_r_e_s_s(_c_o_n_t_a_i_n_e_r__.begin()); } │ │ │ │ │ +538 │ │ │ │ │ +540 │ │ │ │ │ +541 │ │ │ │ │ +_5_4_2 friend constexpr void _s_w_a_p (_m_d_a_r_r_a_y& x, _m_d_a_r_r_a_y& y) noexcept │ │ │ │ │ +543 { │ │ │ │ │ +544 using std::swap; │ │ │ │ │ +545 _s_w_a_p(x.container_, y.container_); │ │ │ │ │ +546 _s_w_a_p(x.mapping_, y.mapping_); │ │ │ │ │ +547 } │ │ │ │ │ +548 │ │ │ │ │ +549 │ │ │ │ │ +552 │ │ │ │ │ +_5_5_3 friend constexpr bool _o_p_e_r_a_t_o_r_=_=_ (const _m_d_a_r_r_a_y& lhs, const _m_d_a_r_r_a_y& rhs) │ │ │ │ │ +noexcept │ │ │ │ │ +554 { │ │ │ │ │ +555 return lhs.mapping() == rhs.mapping() && lhs.container() == rhs.container │ │ │ │ │ +(); │ │ │ │ │ +556 } │ │ │ │ │ +557 │ │ │ │ │ +559 │ │ │ │ │ +562 │ │ │ │ │ +564 template , _m_d_s_p_a_n___t_y_p_e>, int> = │ │ │ │ │ +0> │ │ │ │ │ +_5_6_6 constexpr operator _m_d_s_p_a_n_<_V_,_E_,_L_,_A_> () │ │ │ │ │ +567 { │ │ │ │ │ +568 return _m_d_s_p_a_n___t_y_p_e(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g()); │ │ │ │ │ +569 } │ │ │ │ │ +570 │ │ │ │ │ +572 template , _c_o_n_s_t___m_d_s_p_a_n___t_y_p_e>, │ │ │ │ │ +int> = 0> │ │ │ │ │ +_5_7_4 constexpr operator _m_d_s_p_a_n_<_V_,_E_,_L_,_A_> () const │ │ │ │ │ +575 { │ │ │ │ │ +576 return _c_o_n_s_t___m_d_s_p_a_n___t_y_p_e(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g()); │ │ │ │ │ +577 } │ │ │ │ │ +578 │ │ │ │ │ +580 template , │ │ │ │ │ +581 std::enable_if_t< │ │ │ │ │ +582 std::is_assignable_v>, int> = 0> │ │ │ │ │ +583 constexpr _m_d_s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_,_A_c_c_e_s_s_o_r_P_o_l_i_c_y_> │ │ │ │ │ +_5_8_4 _t_o___m_d_s_p_a_n (const AccessorPolicy& a = AccessorPolicy{}) │ │ │ │ │ +585 { │ │ │ │ │ +586 return _m_d_s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_,_A_c_c_e_s_s_o_r_P_o_l_i_c_y_> │ │ │ │ │ +(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g(), a); │ │ │ │ │ +587 } │ │ │ │ │ +588 │ │ │ │ │ +590 template , │ │ │ │ │ +591 std::enable_if_t< │ │ │ │ │ +592 std::is_assignable_v>, int> = 0> │ │ │ │ │ +593 constexpr mdspan │ │ │ │ │ +_5_9_4 _t_o___m_d_s_p_a_n (const AccessorPolicy& a = AccessorPolicy{}) const │ │ │ │ │ +595 { │ │ │ │ │ +596 return _m_d_s_p_a_n_<_c_o_n_s_t_ _e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_,_A_c_c_e_s_s_o_r_P_o_l_i_c_y_> │ │ │ │ │ +(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g(), a); │ │ │ │ │ +597 } │ │ │ │ │ +598 │ │ │ │ │ +599protected: │ │ │ │ │ +_6_0_0 _c_o_n_t_a_i_n_e_r___t_y_p_e _c_o_n_t_a_i_n_e_r__; │ │ │ │ │ +_6_0_1 [[no_unique_address]] _m_a_p_p_i_n_g___t_y_p_e _m_a_p_p_i_n_g__; │ │ │ │ │ +602}; │ │ │ │ │ +603 │ │ │ │ │ +607 │ │ │ │ │ +608template │ │ │ │ │ +609_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, const Container&) │ │ │ │ │ +610 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ +611 │ │ │ │ │ +612template │ │ │ │ │ +613_m_d_a_r_r_a_y (const Mapping&, const Container&) │ │ │ │ │ +614 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ +_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ +615 │ │ │ │ │ +616template │ │ │ │ │ +617_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, Container&&) │ │ │ │ │ +618 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ +619 │ │ │ │ │ +620template │ │ │ │ │ +621_m_d_a_r_r_a_y (const Mapping&, Container&&) │ │ │ │ │ +622 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ +_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ +623 │ │ │ │ │ +624template │ │ │ │ │ +625_m_d_a_r_r_a_y (const _m_d_s_p_a_n_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _A_c_c_e_s_s_o_r_>&) │ │ │ │ │ +626 -> _m_d_a_r_r_a_y_<_s_t_d_:_:_r_e_m_o_v_e___c_v___t_<_E_l_e_m_e_n_t_>, Extents, Layout>; │ │ │ │ │ +627 │ │ │ │ │ +628template │ │ │ │ │ +629_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, const Container&, const │ │ │ │ │ +Alloc&) │ │ │ │ │ +630 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ +631 │ │ │ │ │ +632template │ │ │ │ │ +633_m_d_a_r_r_a_y (const Mapping&, const Container&, const Alloc&) │ │ │ │ │ +634 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ +_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ +635 │ │ │ │ │ +636template │ │ │ │ │ +637_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, Container&&, const Alloc&) │ │ │ │ │ +638 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ +639 │ │ │ │ │ +640template │ │ │ │ │ +641_m_d_a_r_r_a_y (const Mapping&, Container&&, const Alloc&) │ │ │ │ │ +642 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ +_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ +643 │ │ │ │ │ +644template │ │ │ │ │ +645_m_d_a_r_r_a_y (const _m_d_s_p_a_n_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _A_c_c_e_s_s_o_r_>&, const Alloc&) │ │ │ │ │ +646 -> _m_d_a_r_r_a_y_<_s_t_d_:_:_r_e_m_o_v_e___c_v___t_<_E_l_e_m_e_n_t_>, Extents, Layout>; │ │ │ │ │ +647 │ │ │ │ │ +649 │ │ │ │ │ +653 │ │ │ │ │ +654template │ │ │ │ │ +655_m_d_s_p_a_n (_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _C_o_n_t_a_i_n_e_r_>) -> _m_d_s_p_a_n< │ │ │ │ │ +656 typename decltype(std::declval>().to_mdspan())::element_type, │ │ │ │ │ +657 typename decltype(std::declval<_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_, │ │ │ │ │ +_C_o_n_t_a_i_n_e_r_>>()._t_o___m_d_s_p_a_n())::extents_type, │ │ │ │ │ +658 typename decltype(std::declval<_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_, │ │ │ │ │ +_C_o_n_t_a_i_n_e_r_>>()._t_o___m_d_s_p_a_n())::layout_type, │ │ │ │ │ +659 typename decltype(std::declval<_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_, │ │ │ │ │ +_C_o_n_t_a_i_n_e_r_>>()._t_o___m_d_s_p_a_n())::accessor_type>; │ │ │ │ │ +660 │ │ │ │ │ +662 │ │ │ │ │ +663} // end namespace Dune::Std │ │ │ │ │ +664 │ │ │ │ │ +665#endif // DUNE_COMMON_STD_MDARRAY_HH │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_m_e_m_o_r_y_._h_h │ │ │ │ │ +_s_p_a_n_._h_h │ │ │ │ │ +_c_o_n_t_a_i_n_e_r_c_o_n_s_t_r_u_c_t_i_o_n_t_r_a_i_t_s_._h_h │ │ │ │ │ +_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h │ │ │ │ │ +_m_d_s_p_a_n_._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. │ │ │ │ │ +_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:124 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_t_o___a_d_d_r_e_s_s │ │ │ │ │ +constexpr auto to_address(T &&p) noexcept │ │ │ │ │ +Obtain the address represented by p without forming a reference to the object │ │ │ │ │ +pointed to by p. │ │ │ │ │ +DDeeffiinniittiioonn memory.hh:47 │ │ │ │ │ +_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_:_:_S_t_d_:_:_e_x_t_e_n_t_s │ │ │ │ │ +Multidimensional index space with dynamic and static extents. │ │ │ │ │ +DDeeffiinniittiioonn extents.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ +A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ +to-left as the product o... │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y │ │ │ │ │ +An owning multi-dimensional array analog of mdspan. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_s_t___m_d_s_p_a_n___t_y_p_e │ │ │ │ │ +mdspan< const element_type, extents_type, layout_type > const_mdspan_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:91 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const mapping_type &m, const container_type &c, const Alloc │ │ │ │ │ +&a) │ │ │ │ │ +Construct from layout mapping, container and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:288 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename container_type::const_reference const_reference │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const mapping_type &m, container_type &&c) │ │ │ │ │ +Construct from layout mapping and the storage container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___t_y_p_e │ │ │ │ │ +Container container_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ +Extents extents_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:79 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const E &e, const container_type &c) │ │ │ │ │ +Construct from extents and the storage container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:174 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:522 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_t_o___m_d_s_p_a_n │ │ │ │ │ +constexpr mdspan< const element_type, extents_type, layout_type, AccessorPolicy │ │ │ │ │ +> to_mdspan(const AccessorPolicy &a=AccessorPolicy{}) const │ │ │ │ │ +Conversion function to mdspan. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:594 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_t_r_i_d_e │ │ │ │ │ +constexpr index_type stride(rank_type r) const │ │ │ │ │ +The stride along the specified dimension. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:516 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ +constexpr bool is_unique() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:525 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_e_n_t │ │ │ │ │ +constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ +Number of elements in the r'th dimension of the tensor. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:498 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const extents_type &e, const Alloc &a) │ │ │ │ │ +Construct from the extents of the array and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:243 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_t_a_t_i_c___e_x_t_e_n_t │ │ │ │ │ +static constexpr std::size_t static_extent(rank_type r) noexcept │ │ │ │ │ +Number of elements in the r'th dimension of the tensor. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:495 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_a_p_p_i_n_g__ │ │ │ │ │ +mapping_type mapping_ │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:601 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const mdspan< OtherElementType, OtherExtents, │ │ │ │ │ +OtherLayoutPolicy, Accessor > &other) │ │ │ │ │ +Converting constructor from mdspan. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_a_p_p_i_n_g___t_y_p_e │ │ │ │ │ +typename layout_type::template mapping< extents_type > mapping_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___d_a_t_a │ │ │ │ │ +constexpr const_pointer container_data() const noexcept │ │ │ │ │ +Direct access to the underlying const data in the container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:537 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const extents_type &e, const value_type &v) │ │ │ │ │ +Construct from extents and initial value. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const mapping_type &m, const Alloc &a) │ │ │ │ │ +Construct from the layout mapping of the array and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___d_a_t_a │ │ │ │ │ +constexpr pointer container_data() noexcept │ │ │ │ │ +Direct access to the underlying data in the container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:534 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +constexpr bool is_exhaustive() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:526 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_p_o_i_n_t_e_r │ │ │ │ │ +decltype(Std::to_address(std::declval< container_type >().begin())) pointer │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +constexpr reference operator[](Index index) │ │ │ │ │ +Access specified element at position [i0] For a rank one mdarray, the operator │ │ │ │ │ +[i] is added to support... │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:408 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_e_n_t_s │ │ │ │ │ +constexpr const extents_type & extents() const noexcept │ │ │ │ │ +Number of elements in all dimensions of the array,. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:468 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ +constexpr bool is_strided() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:527 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const mapping_type &m, const container_type &c) │ │ │ │ │ +Construct from layout mapping and the storage container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_always_unique() noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:521 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const mapping_type &m, container_type &&c, const Alloc &a) │ │ │ │ │ +Construct from layout mapping, container and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:296 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const E &e, container_type &&c) │ │ │ │ │ +Construct from extents and the storage container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r │ │ │ │ │ +constexpr const container_type & container() const noexcept │ │ │ │ │ +The underlying storage container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:474 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___s_i_z_e │ │ │ │ │ +constexpr std::size_t container_size() const │ │ │ │ │ +Size of the underlying container. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:510 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename extents_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_a_n_k │ │ │ │ │ +static constexpr rank_type rank() noexcept │ │ │ │ │ +Number of dimensions of the array. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:489 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_m_p_t_y │ │ │ │ │ +constexpr bool empty() const noexcept │ │ │ │ │ +Check whether the index space is empty. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:513 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const extents_type &e, container_type &&c, const Alloc &a) │ │ │ │ │ +Construct from extents, container and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:280 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_s_p_a_n___t_y_p_e │ │ │ │ │ +mdspan< element_type, extents_type, layout_type > mdspan_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_i_z_e │ │ │ │ │ +constexpr size_type size() const noexcept │ │ │ │ │ +Size of the multi-dimensional index space. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:501 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +friend constexpr bool operator==(const mdarray &lhs, const mdarray &rhs) │ │ │ │ │ +noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:553 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_w_a_p │ │ │ │ │ +friend constexpr void swap(mdarray &x, mdarray &y) noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:542 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr const mapping_type & mapping() const noexcept │ │ │ │ │ +Index mapping of a layout policy. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:471 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ +Element element_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const mapping_type &m, const value_type &v, const Alloc &a) │ │ │ │ │ +Construct from layout mapping, initial value and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:264 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const extents_type &e, const value_type &v, const Alloc &a) │ │ │ │ │ +Construct from extents, initial value and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:257 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ +decltype(Std::to_address(std::declval< container_type >().cbegin())) │ │ │ │ │ +const_pointer │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename container_type::reference reference │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_t_o___m_d_s_p_a_n │ │ │ │ │ +constexpr mdspan< element_type, extents_type, layout_type, AccessorPolicy > │ │ │ │ │ +to_mdspan(const AccessorPolicy &a=AccessorPolicy{}) │ │ │ │ │ +Conversion function to mdspan. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:584 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +element_type value_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:83 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_l_a_y_o_u_t___t_y_p_e │ │ │ │ │ +LayoutPolicy layout_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_r_a_c_t___c_o_n_t_a_i_n_e_r │ │ │ │ │ +constexpr container_type && extract_container() &&noexcept │ │ │ │ │ +Move the container out of the mdarray. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:482 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const extents_type &e, const container_type &c, const Alloc │ │ │ │ │ +&a) │ │ │ │ │ +Construct from extents, container and allocator. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:272 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ +typename extents_type::rank_type rank_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_a_n_k___d_y_n_a_m_i_c │ │ │ │ │ +static constexpr rank_type rank_dynamic() noexcept │ │ │ │ │ +Number of dimension with dynamic size. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:492 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +constexpr reference operator()(Indices... indices) │ │ │ │ │ +Access element at position (i0,i1,...) │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:363 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(const extents_type &e) │ │ │ │ │ +Construct from the extents of the array. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:138 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r__ │ │ │ │ │ +container_type container_ │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:600 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ +typename extents_type::index_type index_type │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ +constexpr mdarray(IndexTypes... exts) │ │ │ │ │ +Construct from the dynamic extents. │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:133 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_always_strided() noexcept │ │ │ │ │ +DDeeffiinniittiioonn mdarray.hh:523 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n │ │ │ │ │ +A multi-dimensional non-owning array view. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t │ │ │ │ │ +constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ +Number of elements in the r'th dimension of the tensor. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_i_z_e │ │ │ │ │ +constexpr size_type size() const noexcept │ │ │ │ │ +The number of elements accessible by this multi-dimensional span. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ +A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: selection.hh File Reference │ │ │ │ +dune-common: fwd_layouts.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,54 +65,48 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ - │ │ │ │ +
fwd_layouts.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

│ │ │ │ -
#include <cstdint>
│ │ │ │ -#include <dune/common/iteratorfacades.hh>
│ │ │ │ -#include <dune/common/parallel/indexset.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...
struct  Dune::Std::layout_left
 A layout where the leftmost extent has stride 1. More...
 
class  Dune::UncachedSelection< TS, TG, TL, N >
 An uncached selection of indices. More...
struct  Dune::Std::layout_right
 A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product of extents. More...
 
class  Dune::Selection< TS, TG, TL, N >
 A cached selection of indices. More...
struct  Dune::Std::layout_stride
 A layout mapping where the strides are user-defined. 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,35 +1,31 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ + * _i_m_p_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 │ │ │ │ │ -#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> │ │ │ │ │ -#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> │ │ │ │ │ +fwd_layouts.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_:_:_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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t │ │ │ │ │ +  A layout where the leftmost extent has stride 1. _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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ +  A layout where the rightmost extent has stride 1, and strides increase │ │ │ │ │ + right-to-left as the product of extents. _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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ +  A layout mapping where the strides are user-defined. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides classes for selecting indices based on attribute flags. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +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/a00053_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: selection.hh Source File │ │ │ │ +dune-common: fwd_layouts.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,324 +70,64 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
selection.hh
│ │ │ │ +
fwd_layouts.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 © 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_SELECTION_HH
│ │ │ │ -
6#define DUNE_COMMON_PARALLEL_SELECTION_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH
│ │ │ │
7
│ │ │ │ -
8#include <cstdint>
│ │ │ │ +
8namespace Dune::Std {
│ │ │ │
9
│ │ │ │ - │ │ │ │ - │ │ │ │ -
12
│ │ │ │ -
13namespace Dune
│ │ │ │ -
14{
│ │ │ │ -
29 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
31 {
│ │ │ │ -
32 public:
│ │ │ │ -
41 typedef TS AttributeSet;
│ │ │ │ -
42
│ │ │ │ - │ │ │ │ -
47
│ │ │ │ -
48 //typedef typename ParallelIndexSet::const_iterator ParallelIndexSetIterator;
│ │ │ │ -
49
│ │ │ │ -
50 typedef ConstArrayListIterator<IndexPair<TG,TL>, N, std::allocator<Dune::IndexPair<TG,TL> > > ParallelIndexSetIterator;
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
57 : iter_(iter), end_(end)
│ │ │ │ -
58 {
│ │ │ │ -
59 // Step to the first valid entry
│ │ │ │ -
60 while(iter_!=end_ && !AttributeSet::contains(iter_->local().attribute()))
│ │ │ │ -
61 ++iter_;
│ │ │ │ -
62 }
│ │ │ │ -
│ │ │ │ -
63
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
65 {
│ │ │ │ -
66 assert(iter_!=end_);
│ │ │ │ -
67 for(++iter_; iter_!=end_; ++iter_)
│ │ │ │ -
68 if(AttributeSet::contains(iter_->local().attribute()))
│ │ │ │ -
69 break;
│ │ │ │ -
70 }
│ │ │ │ -
│ │ │ │ -
71
│ │ │ │ -
72
│ │ │ │ -
│ │ │ │ -
73 uint32_t operator*() const
│ │ │ │ -
74 {
│ │ │ │ -
75 return iter_->local().local();
│ │ │ │ -
76 }
│ │ │ │ -
│ │ │ │ -
77
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
79 {
│ │ │ │ -
80 return iter_ == other.iter_;
│ │ │ │ -
81 }
│ │ │ │ -
│ │ │ │ -
82
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
84 {
│ │ │ │ -
85 return iter_ != other.iter_;
│ │ │ │ -
86 }
│ │ │ │ -
│ │ │ │ -
87
│ │ │ │ -
88 private:
│ │ │ │ - │ │ │ │ -
90 const ParallelIndexSetIterator end_;
│ │ │ │ -
91 };
│ │ │ │ -
│ │ │ │ -
92
│ │ │ │ -
93
│ │ │ │ -
97 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
99 {
│ │ │ │ -
100 public:
│ │ │ │ -
109 typedef TS AttributeSet;
│ │ │ │ -
110
│ │ │ │ -
114 typedef TG GlobalIndex;
│ │ │ │ -
115
│ │ │ │ -
122 typedef TL LocalIndex;
│ │ │ │ -
123
│ │ │ │ - │ │ │ │ -
128
│ │ │ │ - │ │ │ │ -
133
│ │ │ │ - │ │ │ │ -
138
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
140 : indexSet_()
│ │ │ │ -
141 {}
│ │ │ │ -
│ │ │ │ -
142
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
144 : indexSet_(&indexset)
│ │ │ │ -
145 {}
│ │ │ │ -
│ │ │ │ -
150 void setIndexSet(const ParallelIndexSet& indexset);
│ │ │ │ -
151
│ │ │ │ -
155 //const ParallelIndexSet& indexSet() const;
│ │ │ │ -
156
│ │ │ │ -
161 const_iterator begin() const;
│ │ │ │ -
162
│ │ │ │ -
167 const_iterator end() const;
│ │ │ │ -
168
│ │ │ │ -
169
│ │ │ │ -
170 private:
│ │ │ │ -
171 const ParallelIndexSet* indexSet_;
│ │ │ │ -
172
│ │ │ │ -
173 };
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
178 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
180 {
│ │ │ │ -
181 public:
│ │ │ │ -
190 typedef TS AttributeSet;
│ │ │ │ -
191
│ │ │ │ -
195 typedef TG GlobalIndex;
│ │ │ │ -
196
│ │ │ │ -
203 typedef TL LocalIndex;
│ │ │ │ -
204
│ │ │ │ - │ │ │ │ -
209
│ │ │ │ -
213 typedef uint32_t* iterator;
│ │ │ │ -
214
│ │ │ │ -
218 typedef uint32_t* const_iterator;
│ │ │ │ -
219
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
221 : selected_()
│ │ │ │ -
222 {}
│ │ │ │ -
│ │ │ │ -
223
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
225 : selected_(), size_(0), built_(false)
│ │ │ │ -
226 {
│ │ │ │ -
227 setIndexSet(indexset);
│ │ │ │ -
228 }
│ │ │ │ -
│ │ │ │ -
229
│ │ │ │ -
230 ~Selection();
│ │ │ │ -
231
│ │ │ │ -
236 void setIndexSet(const ParallelIndexSet& indexset);
│ │ │ │ -
237
│ │ │ │ -
241 void free();
│ │ │ │ -
242
│ │ │ │ -
246 //IndexSet indexSet() const;
│ │ │ │ -
247
│ │ │ │ -
252 const_iterator begin() const;
│ │ │ │ -
253
│ │ │ │ -
258 const_iterator end() const;
│ │ │ │ -
259
│ │ │ │ -
260
│ │ │ │ -
261 private:
│ │ │ │ -
262 uint32_t* selected_;
│ │ │ │ -
263 size_t size_;
│ │ │ │ -
264 bool built_;
│ │ │ │ -
265
│ │ │ │ -
266 };
│ │ │ │ -
│ │ │ │ -
267
│ │ │ │ -
268 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
270 {
│ │ │ │ -
271 if(built_)
│ │ │ │ -
272 free();
│ │ │ │ -
273
│ │ │ │ -
274 // Count the number of entries the selection has to hold
│ │ │ │ - │ │ │ │ -
276 const const_iterator end = indexset.end();
│ │ │ │ -
277 int entries = 0;
│ │ │ │ -
278
│ │ │ │ -
279 for(const_iterator index = indexset.begin(); index != end; ++index)
│ │ │ │ -
280 if(AttributeSet::contains(index->local().attribute()))
│ │ │ │ -
281 ++entries;
│ │ │ │ -
282
│ │ │ │ -
283 selected_ = new uint32_t[entries];
│ │ │ │ -
284 built_ = true;
│ │ │ │ -
285
│ │ │ │ -
286 entries = 0;
│ │ │ │ -
287 for(const_iterator index = indexset.begin(); index != end; ++index)
│ │ │ │ -
288 if(AttributeSet::contains(index->local().attribute()))
│ │ │ │ -
289 selected_[entries++]= index->local().local();
│ │ │ │ -
290
│ │ │ │ -
291 size_=entries;
│ │ │ │ -
292 built_=true;
│ │ │ │ -
293 }
│ │ │ │ -
│ │ │ │ -
294
│ │ │ │ -
295 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
297 {
│ │ │ │ -
298 return selected_;
│ │ │ │ -
299 }
│ │ │ │ -
│ │ │ │ -
300
│ │ │ │ -
301 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
303 {
│ │ │ │ -
304 return selected_+size_;
│ │ │ │ -
305 }
│ │ │ │ -
│ │ │ │ -
306
│ │ │ │ -
307 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
309 {
│ │ │ │ -
310 delete[] selected_;
│ │ │ │ -
311 size_=0;
│ │ │ │ -
312 built_=false;
│ │ │ │ -
313 }
│ │ │ │ -
│ │ │ │ -
314
│ │ │ │ -
315 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
317 {
│ │ │ │ -
318 if(built_)
│ │ │ │ -
319 free();
│ │ │ │ -
320 }
│ │ │ │ -
│ │ │ │ -
321
│ │ │ │ -
322 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
324 {
│ │ │ │ -
325 return SelectionIterator<TS,TG,TL,N>(indexSet_->begin(),
│ │ │ │ -
326 indexSet_->end());
│ │ │ │ -
327 }
│ │ │ │ -
│ │ │ │ -
328
│ │ │ │ -
329 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
331 {
│ │ │ │ -
332 return SelectionIterator<TS,TG,TL,N>(indexSet_->end(),
│ │ │ │ -
333 indexSet_->end());
│ │ │ │ -
334 }
│ │ │ │ -
│ │ │ │ -
335 template<typename TS, typename TG, typename TL, int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
337 {
│ │ │ │ -
338 indexSet_ = &indexset;
│ │ │ │ -
339 }
│ │ │ │ -
│ │ │ │ -
340
│ │ │ │ -
344}
│ │ │ │ -
345#endif // DUNE_COMMON_PARALLEL_SELECTION_HH
│ │ │ │ -
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:330
│ │ │ │ -
void setIndexSet(const ParallelIndexSet &indexset)
Set the index set of the selection.
Definition selection.hh:269
│ │ │ │ -
void setIndexSet(const ParallelIndexSet &indexset)
Set the index set of the selection.
Definition selection.hh:336
│ │ │ │ -
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:302
│ │ │ │ -
const_iterator begin() const
Get the index set we are a selection for.
Definition selection.hh:296
│ │ │ │ -
void free()
Free allocated memory.
Definition selection.hh:308
│ │ │ │ -
const_iterator begin() const
Get the index set we are a selection for.
Definition selection.hh:323
│ │ │ │ -
~Selection()
Definition selection.hh:316
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
A constant random access iterator for the Dune::ArrayList class.
Definition arraylist.hh:368
│ │ │ │ -
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:31
│ │ │ │ -
ConstArrayListIterator< IndexPair< TG, TL >, N, std::allocator< Dune::IndexPair< TG, TL > > > ParallelIndexSetIterator
Definition selection.hh:50
│ │ │ │ -
void operator++()
Definition selection.hh:64
│ │ │ │ -
uint32_t operator*() const
Definition selection.hh:73
│ │ │ │ -
TS AttributeSet
The type of the Set of attributes.
Definition selection.hh:41
│ │ │ │ -
Dune::ParallelIndexSet< TG, TL, N > ParallelIndexSet
The type of the underlying index set.
Definition selection.hh:46
│ │ │ │ -
SelectionIterator(const ParallelIndexSetIterator &iter, const ParallelIndexSetIterator &end)
Constructor.
Definition selection.hh:56
│ │ │ │ -
bool operator!=(const SelectionIterator< TS, TG, TL, N > &other) const
Definition selection.hh:83
│ │ │ │ -
bool operator==(const SelectionIterator< TS, TG, TL, N > &other) const
Definition selection.hh:78
│ │ │ │ -
An uncached selection of indices.
Definition selection.hh:99
│ │ │ │ -
UncachedSelection()
Definition selection.hh:139
│ │ │ │ -
SelectionIterator< TS, TG, TL, N > iterator
The type of the iterator of the selected indices.
Definition selection.hh:132
│ │ │ │ -
TS AttributeSet
The type of the Set of attributes.
Definition selection.hh:109
│ │ │ │ -
iterator const_iterator
The type of the iterator of the selected indices.
Definition selection.hh:137
│ │ │ │ -
TG GlobalIndex
The type of the global index of the underlying index set.
Definition selection.hh:114
│ │ │ │ -
UncachedSelection(const ParallelIndexSet &indexset)
Definition selection.hh:143
│ │ │ │ -
Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet
The type of the underlying index set.
Definition selection.hh:127
│ │ │ │ -
TL LocalIndex
The type of the local index of the underlying index set.
Definition selection.hh:122
│ │ │ │ -
A cached selection of indices.
Definition selection.hh:180
│ │ │ │ -
TG GlobalIndex
The type of the global index of the underlying index set.
Definition selection.hh:195
│ │ │ │ -
Selection(const ParallelIndexSet &indexset)
Definition selection.hh:224
│ │ │ │ -
Selection()
Definition selection.hh:220
│ │ │ │ -
TL LocalIndex
The type of the local index of the underlying index set.
Definition selection.hh:203
│ │ │ │ -
TS AttributeSet
The type of the set of attributes.
Definition selection.hh:190
│ │ │ │ -
uint32_t * iterator
The type of the iterator of the selected indices.
Definition selection.hh:213
│ │ │ │ -
uint32_t * const_iterator
The type of the iterator of the selected indices.
Definition selection.hh:218
│ │ │ │ -
Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet
The type of the underlying index set.
Definition selection.hh:208
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
17{
│ │ │ │ +
18 template <class Extents>
│ │ │ │ +
19 class mapping;
│ │ │ │ +
20};
│ │ │ │ +
│ │ │ │ +
21
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
30{
│ │ │ │ +
31 template <class Extents>
│ │ │ │ +
32 class mapping;
│ │ │ │ +
33};
│ │ │ │ +
│ │ │ │ +
34
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
40{
│ │ │ │ +
41 template <class Extents>
│ │ │ │ +
42 class mapping;
│ │ │ │ +
43};
│ │ │ │ +
│ │ │ │ +
44
│ │ │ │ +
45} // end namespace Dune::Std
│ │ │ │ +
46
│ │ │ │ +
47#endif // DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
A layout where the leftmost extent has stride 1.
Definition fwd_layouts.hh:17
│ │ │ │ +
A layout mapping where the leftmost extent has stride 1.
Definition layout_left.hh:19
│ │ │ │ +
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ +
A layout mapping where the rightmost extent has stride 1.
Definition layout_right.hh:19
│ │ │ │ +
A layout mapping where the strides are user-defined.
Definition fwd_layouts.hh:40
│ │ │ │ +
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,388 +1,65 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -selection.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ + * _i_m_p_l │ │ │ │ │ +fwd_layouts.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 © 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_SELECTION_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_SELECTION_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ +8namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ 9 │ │ │ │ │ -10#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> │ │ │ │ │ -11#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> │ │ │ │ │ -12 │ │ │ │ │ -13namespace _D_u_n_e │ │ │ │ │ -14{ │ │ │ │ │ -29 template │ │ │ │ │ -_3_0 class _S_e_l_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ -31 { │ │ │ │ │ -32 public: │ │ │ │ │ -_4_1 typedef TS _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ -42 │ │ │ │ │ -_4_6 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; │ │ │ │ │ -47 │ │ │ │ │ -48 //typedef typename ParallelIndexSet::const_iterator │ │ │ │ │ -ParallelIndexSetIterator; │ │ │ │ │ -49 │ │ │ │ │ -_5_0 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_6 _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) │ │ │ │ │ -57 : iter_(iter), end_(end) │ │ │ │ │ -58 { │ │ │ │ │ -59 // Step to the first valid entry │ │ │ │ │ -60 while(iter_!=end_ && !AttributeSet::contains(iter_->local().attribute())) │ │ │ │ │ -61 ++iter_; │ │ │ │ │ -62 } │ │ │ │ │ -63 │ │ │ │ │ -_6_4 void _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -65 { │ │ │ │ │ -66 assert(iter_!=end_); │ │ │ │ │ -67 for(++iter_; iter_!=end_; ++iter_) │ │ │ │ │ -68 if(AttributeSet::contains(iter_->local().attribute())) │ │ │ │ │ -69 break; │ │ │ │ │ -70 } │ │ │ │ │ -71 │ │ │ │ │ -72 │ │ │ │ │ -_7_3 uint32_t _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ -74 { │ │ │ │ │ -75 return iter_->local().local(); │ │ │ │ │ -76 } │ │ │ │ │ -77 │ │ │ │ │ -_7_8 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 │ │ │ │ │ -79 { │ │ │ │ │ -80 return iter_ == other.iter_; │ │ │ │ │ -81 } │ │ │ │ │ -82 │ │ │ │ │ -_8_3 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 │ │ │ │ │ -84 { │ │ │ │ │ -85 return iter_ != other.iter_; │ │ │ │ │ -86 } │ │ │ │ │ -87 │ │ │ │ │ -88 private: │ │ │ │ │ -89 _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_; │ │ │ │ │ -90 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_; │ │ │ │ │ -91 }; │ │ │ │ │ -92 │ │ │ │ │ -93 │ │ │ │ │ -97 template │ │ │ │ │ -_9_8 class _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n │ │ │ │ │ -99 { │ │ │ │ │ -100 public: │ │ │ │ │ -_1_0_9 typedef TS _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ -110 │ │ │ │ │ -_1_1_4 typedef TG _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -115 │ │ │ │ │ -_1_2_2 typedef TL _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ -123 │ │ │ │ │ -_1_2_7 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; │ │ │ │ │ -128 │ │ │ │ │ -_1_3_2 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; │ │ │ │ │ -133 │ │ │ │ │ -_1_3_7 typedef _i_t_e_r_a_t_o_r _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -138 │ │ │ │ │ -_1_3_9 _U_n_c_a_c_h_e_d_S_e_l_e_c_t_i_o_n() │ │ │ │ │ -140 : indexSet_() │ │ │ │ │ -141 {} │ │ │ │ │ -142 │ │ │ │ │ -_1_4_3 _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) │ │ │ │ │ -144 : indexSet_(&indexset) │ │ │ │ │ -145 {} │ │ │ │ │ -150 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); │ │ │ │ │ -151 │ │ │ │ │ -155 //const ParallelIndexSet& indexSet() const; │ │ │ │ │ -156 │ │ │ │ │ -161 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ -162 │ │ │ │ │ -167 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ -168 │ │ │ │ │ -169 │ │ │ │ │ -170 private: │ │ │ │ │ -171 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* indexSet_; │ │ │ │ │ -172 │ │ │ │ │ -173 }; │ │ │ │ │ -174 │ │ │ │ │ -178 template │ │ │ │ │ -_1_7_9 class _S_e_l_e_c_t_i_o_n │ │ │ │ │ -180 { │ │ │ │ │ -181 public: │ │ │ │ │ -_1_9_0 typedef TS _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ -191 │ │ │ │ │ -_1_9_5 typedef TG _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -196 │ │ │ │ │ -_2_0_3 typedef TL _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ -204 │ │ │ │ │ -_2_0_8 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; │ │ │ │ │ -209 │ │ │ │ │ -_2_1_3 typedef uint32_t* _i_t_e_r_a_t_o_r; │ │ │ │ │ -214 │ │ │ │ │ -_2_1_8 typedef uint32_t* _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -219 │ │ │ │ │ -_2_2_0 _S_e_l_e_c_t_i_o_n() │ │ │ │ │ -221 : selected_() │ │ │ │ │ -222 {} │ │ │ │ │ -223 │ │ │ │ │ -_2_2_4 _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) │ │ │ │ │ -225 : selected_(), size_(0), built_(false) │ │ │ │ │ -226 { │ │ │ │ │ -227 _s_e_t_I_n_d_e_x_S_e_t(indexset); │ │ │ │ │ -228 } │ │ │ │ │ -229 │ │ │ │ │ -230 _~_S_e_l_e_c_t_i_o_n(); │ │ │ │ │ -231 │ │ │ │ │ -236 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); │ │ │ │ │ -237 │ │ │ │ │ -241 void _f_r_e_e(); │ │ │ │ │ -242 │ │ │ │ │ -246 //IndexSet indexSet() const; │ │ │ │ │ -247 │ │ │ │ │ -252 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ -253 │ │ │ │ │ -258 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ -259 │ │ │ │ │ -260 │ │ │ │ │ -261 private: │ │ │ │ │ -262 uint32_t* selected_; │ │ │ │ │ -263 size_t size_; │ │ │ │ │ -264 bool built_; │ │ │ │ │ -265 │ │ │ │ │ -266 }; │ │ │ │ │ -267 │ │ │ │ │ -268 template │ │ │ │ │ -_2_6_9 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) │ │ │ │ │ -270 { │ │ │ │ │ -271 if(built_) │ │ │ │ │ -272 free(); │ │ │ │ │ -273 │ │ │ │ │ -274 // Count the number of entries the selection has to hold │ │ │ │ │ -275 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; │ │ │ │ │ -276 const _c_o_n_s_t___i_t_e_r_a_t_o_r end = indexset._e_n_d(); │ │ │ │ │ -277 int entries = 0; │ │ │ │ │ -278 │ │ │ │ │ -279 for(_c_o_n_s_t___i_t_e_r_a_t_o_r index = indexset._b_e_g_i_n(); index != end; ++index) │ │ │ │ │ -280 if(AttributeSet::contains(index->local().attribute())) │ │ │ │ │ -281 ++entries; │ │ │ │ │ -282 │ │ │ │ │ -283 selected_ = new uint32_t[entries]; │ │ │ │ │ -284 built_ = true; │ │ │ │ │ -285 │ │ │ │ │ -286 entries = 0; │ │ │ │ │ -287 for(_c_o_n_s_t___i_t_e_r_a_t_o_r index = indexset._b_e_g_i_n(); index != end; ++index) │ │ │ │ │ -288 if(AttributeSet::contains(index->local().attribute())) │ │ │ │ │ -289 selected_[entries++]= index->local().local(); │ │ │ │ │ -290 │ │ │ │ │ -291 size_=entries; │ │ │ │ │ -292 built_=true; │ │ │ │ │ -293 } │ │ │ │ │ -294 │ │ │ │ │ -295 template │ │ │ │ │ -_2_9_6 uint32_t* _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_b_e_g_i_n() const │ │ │ │ │ -297 { │ │ │ │ │ -298 return selected_; │ │ │ │ │ -299 } │ │ │ │ │ -300 │ │ │ │ │ -301 template │ │ │ │ │ -_3_0_2 uint32_t* _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_e_n_d() const │ │ │ │ │ -303 { │ │ │ │ │ -304 return selected_+size_; │ │ │ │ │ -305 } │ │ │ │ │ -306 │ │ │ │ │ -307 template │ │ │ │ │ -_3_0_8 inline void _S_e_l_e_c_t_i_o_n_<_T_S_,_T_G_,_T_L_,_N_>_:_:_f_r_e_e() │ │ │ │ │ -309 { │ │ │ │ │ -310 delete[] selected_; │ │ │ │ │ -311 size_=0; │ │ │ │ │ -312 built_=false; │ │ │ │ │ -313 } │ │ │ │ │ -314 │ │ │ │ │ -315 template │ │ │ │ │ -_3_1_6 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() │ │ │ │ │ -317 { │ │ │ │ │ -318 if(built_) │ │ │ │ │ -319 free(); │ │ │ │ │ -320 } │ │ │ │ │ -321 │ │ │ │ │ -322 template │ │ │ │ │ -_3_2_3 _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 │ │ │ │ │ -324 { │ │ │ │ │ -325 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(), │ │ │ │ │ -326 indexSet_->end()); │ │ │ │ │ -327 } │ │ │ │ │ -328 │ │ │ │ │ -329 template │ │ │ │ │ -_3_3_0 _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 │ │ │ │ │ -331 { │ │ │ │ │ -332 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(), │ │ │ │ │ -333 indexSet_->end()); │ │ │ │ │ -334 } │ │ │ │ │ -335 template │ │ │ │ │ -_3_3_6 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) │ │ │ │ │ -337 { │ │ │ │ │ -338 indexSet_ = &indexset; │ │ │ │ │ -339 } │ │ │ │ │ -340 │ │ │ │ │ -344} │ │ │ │ │ -345#endif // DUNE_COMMON_PARALLEL_SELECTION_HH │ │ │ │ │ -_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:330 │ │ │ │ │ -_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:269 │ │ │ │ │ -_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:336 │ │ │ │ │ -_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:302 │ │ │ │ │ -_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:296 │ │ │ │ │ -_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:308 │ │ │ │ │ -_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:323 │ │ │ │ │ -_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:316 │ │ │ │ │ -_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:368 │ │ │ │ │ -_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:31 │ │ │ │ │ -_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:50 │ │ │ │ │ -_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:64 │ │ │ │ │ -_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:73 │ │ │ │ │ -_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:41 │ │ │ │ │ -_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:46 │ │ │ │ │ -_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:56 │ │ │ │ │ -_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:83 │ │ │ │ │ -_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:78 │ │ │ │ │ -_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:99 │ │ │ │ │ -_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:139 │ │ │ │ │ -_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:132 │ │ │ │ │ -_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:109 │ │ │ │ │ -_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:137 │ │ │ │ │ -_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:114 │ │ │ │ │ -_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:143 │ │ │ │ │ -_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:127 │ │ │ │ │ -_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:122 │ │ │ │ │ -_D_u_n_e_:_:_S_e_l_e_c_t_i_o_n │ │ │ │ │ -A cached selection of indices. │ │ │ │ │ -DDeeffiinniittiioonn selection.hh:180 │ │ │ │ │ -_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:195 │ │ │ │ │ -_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:224 │ │ │ │ │ -_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:220 │ │ │ │ │ -_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:203 │ │ │ │ │ -_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:190 │ │ │ │ │ -_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:213 │ │ │ │ │ -_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:218 │ │ │ │ │ -_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:208 │ │ │ │ │ +_1_6struct _l_a_y_o_u_t___l_e_f_t │ │ │ │ │ +17{ │ │ │ │ │ +18 template │ │ │ │ │ +19 class _m_a_p_p_i_n_g; │ │ │ │ │ +20}; │ │ │ │ │ +21 │ │ │ │ │ +_2_9struct _l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ +30{ │ │ │ │ │ +31 template │ │ │ │ │ +32 class _m_a_p_p_i_n_g; │ │ │ │ │ +33}; │ │ │ │ │ +34 │ │ │ │ │ +_3_9struct _l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ +40{ │ │ │ │ │ +41 template │ │ │ │ │ +42 class _m_a_p_p_i_n_g; │ │ │ │ │ +43}; │ │ │ │ │ +44 │ │ │ │ │ +45} // end namespace Dune::Std │ │ │ │ │ +46 │ │ │ │ │ +47#endif // DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t │ │ │ │ │ +A layout where the leftmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the leftmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ +A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ +to-left as the product o... │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the rightmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ +A layout mapping where the strides are user-defined. │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the strides are user-defined. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00056.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpiguard.hh File Reference │ │ │ │ +dune-common: containerconstructiontraits.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,53 +65,38 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces
│ │ │ │ -
mpiguard.hh File Reference
│ │ │ │ +
containerconstructiontraits.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <mpi.h>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/parallel/communication.hh>
│ │ │ │ -#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ -#include <dune/common/parallel/mpihelper.hh>
│ │ │ │ +
#include <array>
│ │ │ │ +#include <cassert>
│ │ │ │ +#include <cstddef>
│ │ │ │
│ │ │ │

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,36 +1,23 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -#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_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_h_e_l_p_e_r_._h_h> │ │ │ │ │ + * _s_t_d │ │ │ │ │ + * _i_m_p_l │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +containerconstructiontraits.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_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 │ │ │ │ │ +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/a00056_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpiguard.hh Source File │ │ │ │ +dune-common: containerconstructiontraits.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,216 +70,81 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpiguard.hh
│ │ │ │ +
containerconstructiontraits.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 © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
5
│ │ │ │ -
13#ifndef DUNE_COMMON_PARALLEL_MPIGUARD_HH
│ │ │ │ -
14#define DUNE_COMMON_PARALLEL_MPIGUARD_HH
│ │ │ │ -
15
│ │ │ │ -
16#if HAVE_MPI
│ │ │ │ -
17#include <mpi.h>
│ │ │ │ -
18#endif
│ │ │ │ -
19
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
24
│ │ │ │ -
25namespace Dune
│ │ │ │ -
26{
│ │ │ │ -
27
│ │ │ │ -
28#ifndef DOXYGEN
│ │ │ │ -
29
│ │ │ │ -
30 /*
│ │ │ │ -
31 Interface class for the communication needed by MPIGuard
│ │ │ │ -
32 */
│ │ │ │ -
33 struct GuardCommunicator
│ │ │ │ -
34 {
│ │ │ │ -
35 // cleanup
│ │ │ │ -
36 virtual ~GuardCommunicator() {};
│ │ │ │ -
37 // all the communication methods we need
│ │ │ │ -
38 virtual int rank() = 0;
│ │ │ │ -
39 virtual int size() = 0;
│ │ │ │ -
40 virtual int sum(int i) = 0;
│ │ │ │ -
41 // create a new GuardCommunicator pointer
│ │ │ │ -
42 template <class C>
│ │ │ │ -
43 static GuardCommunicator * create(const Communication<C> & c);
│ │ │ │ -
44#if HAVE_MPI
│ │ │ │ -
45 inline
│ │ │ │ -
46 static GuardCommunicator * create(const MPI_Comm & c);
│ │ │ │ -
47#endif
│ │ │ │ -
48 };
│ │ │ │ -
49
│ │ │ │ -
50 namespace {
│ │ │ │ -
51 /*
│ │ │ │ -
52 templated implementation of different communication classes
│ │ │ │ -
53 */
│ │ │ │ -
54 // the default class will always fail, due to the missing implementation of "sum"
│ │ │ │ -
55 template <class Imp>
│ │ │ │ -
56 struct GenericGuardCommunicator
│ │ │ │ -
57 : public GuardCommunicator
│ │ │ │ -
58 {};
│ │ │ │ -
59 // specialization for Communication
│ │ │ │ -
60 template <class T>
│ │ │ │ -
61 struct GenericGuardCommunicator< Communication<T> >
│ │ │ │ -
62 : public GuardCommunicator
│ │ │ │ -
63 {
│ │ │ │ -
64 const Communication<T> comm;
│ │ │ │ -
65 GenericGuardCommunicator(const Communication<T> & c) :
│ │ │ │ -
66 comm(c) {}
│ │ │ │ -
67 int rank() override { return comm.rank(); };
│ │ │ │ -
68 int size() override { return comm.size(); };
│ │ │ │ -
69 int sum(int i) override { return comm.sum(i); }
│ │ │ │ -
70 };
│ │ │ │ -
71
│ │ │ │ -
72#if HAVE_MPI
│ │ │ │ -
73 // specialization for MPI_Comm
│ │ │ │ -
74 template <>
│ │ │ │ -
75 struct GenericGuardCommunicator<MPI_Comm>
│ │ │ │ -
76 : public GenericGuardCommunicator< Communication<MPI_Comm> >
│ │ │ │ -
77 {
│ │ │ │ -
78 GenericGuardCommunicator(const MPI_Comm & c) :
│ │ │ │ -
79 GenericGuardCommunicator< Communication<MPI_Comm> >(
│ │ │ │ -
80 Communication<MPI_Comm>(c)) {}
│ │ │ │ -
81 };
│ │ │ │ -
82#endif
│ │ │ │ -
83 } // anonymous namespace
│ │ │ │ -
84
│ │ │ │ -
85 template<class C>
│ │ │ │ -
86 GuardCommunicator * GuardCommunicator::create(const Communication<C> & comm)
│ │ │ │ -
87 {
│ │ │ │ -
88 return new GenericGuardCommunicator< Communication<C> >(comm);
│ │ │ │ -
89 }
│ │ │ │ -
90
│ │ │ │ -
91#if HAVE_MPI
│ │ │ │ -
92 GuardCommunicator * GuardCommunicator::create(const MPI_Comm & comm)
│ │ │ │ -
93 {
│ │ │ │ -
94 return new GenericGuardCommunicator< Communication<MPI_Comm> >(comm);
│ │ │ │ -
95 }
│ │ │ │ -
96#endif
│ │ │ │ -
97
│ │ │ │ -
98#endif
│ │ │ │ -
99
│ │ │ │ -
103 class MPIGuardError : public ParallelError {};
│ │ │ │ -
104
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
138 {
│ │ │ │ -
139 GuardCommunicator * comm_;
│ │ │ │ -
140 bool active_;
│ │ │ │ -
141
│ │ │ │ -
142 // we don't want to copy this class
│ │ │ │ -
143 MPIGuard (const MPIGuard &);
│ │ │ │ -
144
│ │ │ │ -
145 public:
│ │ │ │ -
│ │ │ │ -
150 MPIGuard (bool active=true) :
│ │ │ │ -
151 comm_(GuardCommunicator::create(
│ │ │ │ -
152 MPIHelper::getCommunication())),
│ │ │ │ -
153 active_(active)
│ │ │ │ -
154 {}
│ │ │ │ -
│ │ │ │ -
155
│ │ │ │ -
│ │ │ │ -
161 MPIGuard (MPIHelper & m, bool active=true) :
│ │ │ │ -
162 comm_(GuardCommunicator::create(
│ │ │ │ -
163 m.getCommunication())),
│ │ │ │ -
164 active_(active)
│ │ │ │ -
165 {}
│ │ │ │ -
│ │ │ │ -
166
│ │ │ │ -
177 template <class C>
│ │ │ │ -
│ │ │ │ -
178 MPIGuard (const C & comm, bool active=true) :
│ │ │ │ -
179 comm_(GuardCommunicator::create(comm)),
│ │ │ │ -
180 active_(active)
│ │ │ │ -
181 {}
│ │ │ │ -
│ │ │ │ -
182
│ │ │ │ -
183#if HAVE_MPI
│ │ │ │ -
│ │ │ │ -
184 MPIGuard (const MPI_Comm & comm, bool active=true) :
│ │ │ │ -
185 comm_(GuardCommunicator::create(comm)),
│ │ │ │ -
186 active_(active)
│ │ │ │ -
187 {}
│ │ │ │ -
│ │ │ │ -
188#endif
│ │ │ │ -
189
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
193 {
│ │ │ │ -
194 if (active_)
│ │ │ │ -
195 {
│ │ │ │ -
196 active_ = false;
│ │ │ │ -
197 finalize(false);
│ │ │ │ -
198 }
│ │ │ │ -
199 delete comm_;
│ │ │ │ -
200 }
│ │ │ │ -
│ │ │ │ -
201
│ │ │ │ -
│ │ │ │ -
206 void reactivate() {
│ │ │ │ -
207 if (active_ == true)
│ │ │ │ -
208 finalize();
│ │ │ │ -
209 active_ = true;
│ │ │ │ -
210 }
│ │ │ │ -
│ │ │ │ -
211
│ │ │ │ -
│ │ │ │ -
222 void finalize(bool success = true)
│ │ │ │ -
223 {
│ │ │ │ -
224 int result = success ? 0 : 1;
│ │ │ │ -
225 bool was_active = active_;
│ │ │ │ -
226 active_ = false;
│ │ │ │ -
227 result = comm_->sum(result);
│ │ │ │ -
228 if (result>0 && was_active)
│ │ │ │ -
229 {
│ │ │ │ -
230 DUNE_THROW(MPIGuardError, "Terminating process "
│ │ │ │ -
231 << comm_->rank() << " due to "
│ │ │ │ -
232 << result << " remote error(s)");
│ │ │ │ -
233 }
│ │ │ │ -
234 }
│ │ │ │ -
│ │ │ │ -
235 };
│ │ │ │ -
│ │ │ │ -
236
│ │ │ │ -
237}
│ │ │ │ -
238
│ │ │ │ -
239#endif // DUNE_COMMON_PARALLEL_MPIGUARD_HH
│ │ │ │ -
Helpers for dealing with MPI.
│ │ │ │ -
Implements an utility class that provides collective communication methods for sequential programs.
│ │ │ │ -
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:103
│ │ │ │ -
detects a thrown exception and communicates to all other processes
Definition mpiguard.hh:138
│ │ │ │ -
void reactivate()
reactivate the guard.
Definition mpiguard.hh:206
│ │ │ │ -
void finalize(bool success=true)
stop the guard.
Definition mpiguard.hh:222
│ │ │ │ -
~MPIGuard()
destroy the guard and check for undetected exceptions
Definition mpiguard.hh:192
│ │ │ │ -
MPIGuard(const C &comm, bool active=true)
create an MPIGuard operating on an arbitrary communicator.
Definition mpiguard.hh:178
│ │ │ │ -
MPIGuard(const MPI_Comm &comm, bool active=true)
Definition mpiguard.hh:184
│ │ │ │ -
MPIGuard(bool active=true)
create an MPIGuard operating on the Communicator of the global Dune::MPIHelper
Definition mpiguard.hh:150
│ │ │ │ -
MPIGuard(MPIHelper &m, bool active=true)
create an MPIGuard operating on the Communicator of a special Dune::MPIHelper m
Definition mpiguard.hh:161
│ │ │ │ -
A real mpi helper.
Definition mpihelper.hh:181
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <array>
│ │ │ │ +
9#include <cassert>
│ │ │ │ +
10#include <cstddef>
│ │ │ │ +
11
│ │ │ │ +
12namespace Dune::Std {
│ │ │ │ +
13namespace Impl {
│ │ │ │ +
14
│ │ │ │ +
20template <class Container>
│ │ │ │ +
21struct ContainerConstructionTraits
│ │ │ │ +
22{
│ │ │ │ +
23 using container_type = Container;
│ │ │ │ +
24 using value_type = typename container_type::value_type;
│ │ │ │ +
25
│ │ │ │ +
26 static constexpr container_type construct (std::size_t size)
│ │ │ │ +
27 {
│ │ │ │ +
28 return container_type(size);
│ │ │ │ +
29 }
│ │ │ │ +
30
│ │ │ │ +
31 static constexpr container_type construct (std::size_t size, value_type value)
│ │ │ │ +
32 {
│ │ │ │ +
33 return container_type(size, value);
│ │ │ │ +
34 }
│ │ │ │ +
35};
│ │ │ │ +
36
│ │ │ │ +
37template <class Value, std::size_t N>
│ │ │ │ +
38struct ContainerConstructionTraits<std::array<Value,N>>
│ │ │ │ +
39{
│ │ │ │ +
40 using container_type = std::array<Value,N>;
│ │ │ │ +
41 using value_type = typename container_type::value_type;
│ │ │ │ +
42
│ │ │ │ +
43 static constexpr container_type construct ([[maybe_unused]] std::size_t size)
│ │ │ │ +
44 {
│ │ │ │ +
45 assert(size <= N);
│ │ │ │ +
46 return container_type{};
│ │ │ │ +
47 }
│ │ │ │ +
48
│ │ │ │ +
49 static constexpr container_type construct ([[maybe_unused]] std::size_t size, value_type value)
│ │ │ │ +
50 {
│ │ │ │ +
51 assert(size <= N);
│ │ │ │ +
52 container_type c{};
│ │ │ │ +
53 for (auto& c_i : c)
│ │ │ │ +
54 c_i = value;
│ │ │ │ +
55 return c;
│ │ │ │ +
56 }
│ │ │ │ +
57};
│ │ │ │ +
58
│ │ │ │ +
59} // end namespace Impl
│ │ │ │ +
60} // end namespace Dune::Std
│ │ │ │ +
61
│ │ │ │ +
62#endif // DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH
│ │ │ │ +
STL namespace.
│ │ │ │ +
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,231 +1,83 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpiguard.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ + * _i_m_p_l │ │ │ │ │ +containerconstructiontraits.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 © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -5 │ │ │ │ │ -13#ifndef DUNE_COMMON_PARALLEL_MPIGUARD_HH │ │ │ │ │ -14#define DUNE_COMMON_PARALLEL_MPIGUARD_HH │ │ │ │ │ -15 │ │ │ │ │ -16#if HAVE_MPI │ │ │ │ │ -17#include │ │ │ │ │ -18#endif │ │ │ │ │ -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_/_p_a_r_a_l_l_e_l_/_c_o_m_m_u_n_i_c_a_t_i_o_n_._h_h> │ │ │ │ │ -22#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> │ │ │ │ │ -23#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> │ │ │ │ │ -24 │ │ │ │ │ -25namespace _D_u_n_e │ │ │ │ │ -26{ │ │ │ │ │ -27 │ │ │ │ │ -28#ifndef DOXYGEN │ │ │ │ │ -29 │ │ │ │ │ -30 /* │ │ │ │ │ -31 Interface class for the communication needed by MPIGuard │ │ │ │ │ -32 */ │ │ │ │ │ -33 struct GuardCommunicator │ │ │ │ │ -34 { │ │ │ │ │ -35 // cleanup │ │ │ │ │ -36 virtual ~GuardCommunicator() {}; │ │ │ │ │ -37 // all the communication methods we need │ │ │ │ │ -38 virtual int rank() = 0; │ │ │ │ │ -39 virtual int size() = 0; │ │ │ │ │ -40 virtual int sum(int i) = 0; │ │ │ │ │ -41 // create a new GuardCommunicator pointer │ │ │ │ │ -42 template │ │ │ │ │ -43 static GuardCommunicator * create(const Communication & c); │ │ │ │ │ -44#if HAVE_MPI │ │ │ │ │ -45 inline │ │ │ │ │ -46 static GuardCommunicator * create(const MPI_Comm & c); │ │ │ │ │ -47#endif │ │ │ │ │ -48 }; │ │ │ │ │ -49 │ │ │ │ │ -50 namespace { │ │ │ │ │ -51 /* │ │ │ │ │ -52 templated implementation of different communication classes │ │ │ │ │ -53 */ │ │ │ │ │ -54 // the default class will always fail, due to the missing implementation of │ │ │ │ │ -"sum" │ │ │ │ │ -55 template │ │ │ │ │ -56 struct GenericGuardCommunicator │ │ │ │ │ -57 : public GuardCommunicator │ │ │ │ │ -58 {}; │ │ │ │ │ -59 // specialization for Communication │ │ │ │ │ -60 template │ │ │ │ │ -61 struct GenericGuardCommunicator< Communication > │ │ │ │ │ -62 : public GuardCommunicator │ │ │ │ │ -63 { │ │ │ │ │ -64 const Communication comm; │ │ │ │ │ -65 GenericGuardCommunicator(const Communication & c) : │ │ │ │ │ -66 comm(c) {} │ │ │ │ │ -67 int rank() override { return comm.rank(); }; │ │ │ │ │ -68 int size() override { return comm.size(); }; │ │ │ │ │ -69 int sum(int i) override { return comm.sum(i); } │ │ │ │ │ -70 }; │ │ │ │ │ -71 │ │ │ │ │ -72#if HAVE_MPI │ │ │ │ │ -73 // specialization for MPI_Comm │ │ │ │ │ -74 template <> │ │ │ │ │ -75 struct GenericGuardCommunicator │ │ │ │ │ -76 : public GenericGuardCommunicator< Communication > │ │ │ │ │ -77 { │ │ │ │ │ -78 GenericGuardCommunicator(const MPI_Comm & c) : │ │ │ │ │ -79 GenericGuardCommunicator< Communication >( │ │ │ │ │ -80 Communication(c)) {} │ │ │ │ │ -81 }; │ │ │ │ │ -82#endif │ │ │ │ │ -83 } // anonymous namespace │ │ │ │ │ -84 │ │ │ │ │ -85 template │ │ │ │ │ -86 GuardCommunicator * GuardCommunicator::create(const Communication & comm) │ │ │ │ │ -87 { │ │ │ │ │ -88 return new GenericGuardCommunicator< Communication >(comm); │ │ │ │ │ -89 } │ │ │ │ │ -90 │ │ │ │ │ -91#if HAVE_MPI │ │ │ │ │ -92 GuardCommunicator * GuardCommunicator::create(const MPI_Comm & comm) │ │ │ │ │ -93 { │ │ │ │ │ -94 return new GenericGuardCommunicator< Communication >(comm); │ │ │ │ │ -95 } │ │ │ │ │ -96#endif │ │ │ │ │ -97 │ │ │ │ │ -98#endif │ │ │ │ │ -99 │ │ │ │ │ -_1_0_3 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 {}; │ │ │ │ │ -104 │ │ │ │ │ -_1_3_7 class _M_P_I_G_u_a_r_d │ │ │ │ │ -138 { │ │ │ │ │ -139 GuardCommunicator * comm_; │ │ │ │ │ -140 bool active_; │ │ │ │ │ -141 │ │ │ │ │ -142 // we don't want to copy this class │ │ │ │ │ -143 _M_P_I_G_u_a_r_d (const _M_P_I_G_u_a_r_d &); │ │ │ │ │ -144 │ │ │ │ │ -145 public: │ │ │ │ │ -_1_5_0 _M_P_I_G_u_a_r_d (bool active=true) : │ │ │ │ │ -151 comm_(GuardCommunicator::create( │ │ │ │ │ -152 _M_P_I_H_e_l_p_e_r::getCommunication())), │ │ │ │ │ -153 active_(active) │ │ │ │ │ -154 {} │ │ │ │ │ -155 │ │ │ │ │ -_1_6_1 _M_P_I_G_u_a_r_d (_M_P_I_H_e_l_p_e_r & m, bool active=true) : │ │ │ │ │ -162 comm_(GuardCommunicator::create( │ │ │ │ │ -163 m.getCommunication())), │ │ │ │ │ -164 active_(active) │ │ │ │ │ -165 {} │ │ │ │ │ -166 │ │ │ │ │ -177 template │ │ │ │ │ -_1_7_8 _M_P_I_G_u_a_r_d (const C & comm, bool active=true) : │ │ │ │ │ -179 comm_(GuardCommunicator::create(comm)), │ │ │ │ │ -180 active_(active) │ │ │ │ │ -181 {} │ │ │ │ │ -182 │ │ │ │ │ -183#if HAVE_MPI │ │ │ │ │ -_1_8_4 _M_P_I_G_u_a_r_d (const MPI_Comm & comm, bool active=true) : │ │ │ │ │ -185 comm_(GuardCommunicator::create(comm)), │ │ │ │ │ -186 active_(active) │ │ │ │ │ -187 {} │ │ │ │ │ -188#endif │ │ │ │ │ -189 │ │ │ │ │ -_1_9_2 _~_M_P_I_G_u_a_r_d() │ │ │ │ │ -193 { │ │ │ │ │ -194 if (active_) │ │ │ │ │ -195 { │ │ │ │ │ -196 active_ = false; │ │ │ │ │ -197 _f_i_n_a_l_i_z_e(false); │ │ │ │ │ -198 } │ │ │ │ │ -199 delete comm_; │ │ │ │ │ -200 } │ │ │ │ │ -201 │ │ │ │ │ -_2_0_6 void _r_e_a_c_t_i_v_a_t_e() { │ │ │ │ │ -207 if (active_ == true) │ │ │ │ │ -208 _f_i_n_a_l_i_z_e(); │ │ │ │ │ -209 active_ = true; │ │ │ │ │ -210 } │ │ │ │ │ -211 │ │ │ │ │ -_2_2_2 void _f_i_n_a_l_i_z_e(bool success = true) │ │ │ │ │ -223 { │ │ │ │ │ -224 int result = success ? 0 : 1; │ │ │ │ │ -225 bool was_active = active_; │ │ │ │ │ -226 active_ = false; │ │ │ │ │ -227 result = comm_->sum(result); │ │ │ │ │ -228 if (result>0 && was_active) │ │ │ │ │ -229 { │ │ │ │ │ -230 _D_U_N_E___T_H_R_O_W(_M_P_I_G_u_a_r_d_E_r_r_o_r, "Terminating process " │ │ │ │ │ -231 << comm_->rank() << " due to " │ │ │ │ │ -232 << result << " remote error(s)"); │ │ │ │ │ -233 } │ │ │ │ │ -234 } │ │ │ │ │ -235 }; │ │ │ │ │ -236 │ │ │ │ │ -237} │ │ │ │ │ -238 │ │ │ │ │ -239#endif // DUNE_COMMON_PARALLEL_MPIGUARD_HH │ │ │ │ │ -_m_p_i_h_e_l_p_e_r_._h_h │ │ │ │ │ -Helpers for dealing with MPI. │ │ │ │ │ -_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. │ │ │ │ │ -_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:103 │ │ │ │ │ -_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:138 │ │ │ │ │ -_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:206 │ │ │ │ │ -_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:222 │ │ │ │ │ -_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:192 │ │ │ │ │ -_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:178 │ │ │ │ │ -_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:184 │ │ │ │ │ -_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:150 │ │ │ │ │ -_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:161 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_H_e_l_p_e_r │ │ │ │ │ -A real mpi helper. │ │ │ │ │ -DDeeffiinniittiioonn mpihelper.hh:181 │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +13namespace Impl { │ │ │ │ │ +14 │ │ │ │ │ +20template │ │ │ │ │ +21struct ContainerConstructionTraits │ │ │ │ │ +22{ │ │ │ │ │ +23 using container_type = Container; │ │ │ │ │ +24 using value_type = typename container_type::value_type; │ │ │ │ │ +25 │ │ │ │ │ +26 static constexpr container_type construct (std::size_t _s_i_z_e) │ │ │ │ │ +27 { │ │ │ │ │ +28 return container_type(_s_i_z_e); │ │ │ │ │ +29 } │ │ │ │ │ +30 │ │ │ │ │ +31 static constexpr container_type construct (std::size_t _s_i_z_e, value_type │ │ │ │ │ +value) │ │ │ │ │ +32 { │ │ │ │ │ +33 return container_type(_s_i_z_e, value); │ │ │ │ │ +34 } │ │ │ │ │ +35}; │ │ │ │ │ +36 │ │ │ │ │ +37template │ │ │ │ │ +38struct ContainerConstructionTraits<_s_t_d::array> │ │ │ │ │ +39{ │ │ │ │ │ +40 using container_type = std::array; │ │ │ │ │ +41 using value_type = typename container_type::value_type; │ │ │ │ │ +42 │ │ │ │ │ +43 static constexpr container_type construct ([[maybe_unused]] std::size_t │ │ │ │ │ +_s_i_z_e) │ │ │ │ │ +44 { │ │ │ │ │ +45 assert(_s_i_z_e <= N); │ │ │ │ │ +46 return container_type{}; │ │ │ │ │ +47 } │ │ │ │ │ +48 │ │ │ │ │ +49 static constexpr container_type construct ([[maybe_unused]] std::size_t │ │ │ │ │ +_s_i_z_e, value_type value) │ │ │ │ │ +50 { │ │ │ │ │ +51 assert(_s_i_z_e <= N); │ │ │ │ │ +52 container_type c{}; │ │ │ │ │ +53 for (auto& c_i : c) │ │ │ │ │ +54 c_i = value; │ │ │ │ │ +55 return c; │ │ │ │ │ +56 } │ │ │ │ │ +57}; │ │ │ │ │ +58 │ │ │ │ │ +59} // end namespace Impl │ │ │ │ │ +60} // end namespace Dune::Std │ │ │ │ │ +61 │ │ │ │ │ +62#endif // DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ +_D_u_n_e_:_:_s_i_z_e │ │ │ │ │ +constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std:: │ │ │ │ │ +integer_sequence< T, II... >) │ │ │ │ │ +Return the size of the sequence. │ │ │ │ │ +DDeeffiinniittiioonn integersequence.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpipack.hh File Reference │ │ │ │ +dune-common: layout_stride.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,52 +65,46 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
mpipack.hh File Reference
│ │ │ │ +
layout_stride.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

See MPI_Pack. │ │ │ │ -More...

│ │ │ │ -
#include <type_traits>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <mpi.h>
│ │ │ │ -#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ -#include <dune/common/parallel/mpidata.hh>
│ │ │ │ +
#include <array>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +#include <dune/common/std/impl/fwd_layouts.hh>
│ │ │ │
│ │ │ │

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 > >
class  Dune::Std::layout_stride::mapping< Extents >
 A layout mapping where the strides are user-defined. 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,36 +1,27 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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_._._. │ │ │ │ │ +layout_stride.hh 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_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> │ │ │ │ │ +#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_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_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_:_:_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_ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_<_ _E_x_t_e_n_t_s_ _> │ │ │ │ │ +  A layout mapping where the strides are user-defined. _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/a00059_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpipack.hh Source File │ │ │ │ +dune-common: layout_stride.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,287 +70,256 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpipack.hh
│ │ │ │ +
layout_stride.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 © 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
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_LAYOUT_STRIDE_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_LAYOUT_STRIDE_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <array>
│ │ │ │ +
9#include <type_traits>
│ │ │ │ +
10
│ │ │ │ + │ │ │ │ + │ │ │ │ +
13
│ │ │ │ +
14namespace Dune::Std {
│ │ │ │ +
15
│ │ │ │ +
17template <class Extents>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
19{
│ │ │ │ +
20 template <class> friend class mapping;
│ │ │ │ +
21 static constexpr typename Extents::rank_type rank_ = Extents::rank();
│ │ │ │
22
│ │ │ │ -
23#if HAVE_MPI
│ │ │ │ -
24
│ │ │ │ -
25#include <type_traits>
│ │ │ │ -
26#include <vector>
│ │ │ │ -
27
│ │ │ │ -
28#include <mpi.h>
│ │ │ │ +
23public:
│ │ │ │ +
24 using extents_type = Extents;
│ │ │ │ +
25 using index_type = typename extents_type::index_type;
│ │ │ │ +
26 using size_type = typename extents_type::size_type;
│ │ │ │ +
27 using rank_type = typename extents_type::rank_type;
│ │ │ │ + │ │ │ │
29
│ │ │ │ - │ │ │ │ - │ │ │ │ +
30private:
│ │ │ │ +
31 using strides_type = std::array<index_type,rank_>;
│ │ │ │
32
│ │ │ │ -
33
│ │ │ │ -
34namespace Dune {
│ │ │ │ -
35
│ │ │ │ -
│ │ │ │ -
36 class MPIPack {
│ │ │ │ -
37 std::vector<char> _buffer;
│ │ │ │ -
38 int _position;
│ │ │ │ -
39 MPI_Comm _comm;
│ │ │ │ -
40
│ │ │ │ -
41 friend struct MPIData<MPIPack>;
│ │ │ │ -
42 friend struct MPIData<const MPIPack>;
│ │ │ │ -
43 public:
│ │ │ │ -
│ │ │ │ -
44 MPIPack(Communication<MPI_Comm> comm, std::size_t size = 0)
│ │ │ │ -
45 : _buffer(size)
│ │ │ │ -
46 , _position(0)
│ │ │ │ -
47 , _comm(comm)
│ │ │ │ -
48 {}
│ │ │ │ -
│ │ │ │ -
49
│ │ │ │ -
50 // Its not valid to copy a MPIPack but you can move it
│ │ │ │ -
51 MPIPack(const MPIPack&) = delete;
│ │ │ │ -
52 MPIPack& operator = (const MPIPack& other) = delete;
│ │ │ │ -
53 MPIPack(MPIPack&&) = default;
│ │ │ │ -
54 MPIPack& operator = (MPIPack&& other) = default;
│ │ │ │ -
55
│ │ │ │ -
61 template<class T>
│ │ │ │ -
│ │ │ │ -
62 void pack(const T& data){
│ │ │ │ -
63 auto mpidata = getMPIData(data);
│ │ │ │ -
64 int size = getPackSize(mpidata.size(), _comm, mpidata.type());
│ │ │ │ -
65 constexpr bool has_static_size = decltype(getMPIData(std::declval<T&>()))::static_size;
│ │ │ │ -
66 if(!has_static_size)
│ │ │ │ -
67 size += getPackSize(1, _comm, MPI_INT);
│ │ │ │ -
68 if (_position + size > 0 && size_t(_position + size) > _buffer.size()) // resize buffer if necessary
│ │ │ │ -
69 _buffer.resize(_position + size);
│ │ │ │ -
70 if(!has_static_size){
│ │ │ │ -
71 int size = mpidata.size();
│ │ │ │ -
72 MPI_Pack(&size, 1, MPI_INT, _buffer.data(), _buffer.size(),
│ │ │ │ -
73 &_position, _comm);
│ │ │ │ -
74 }
│ │ │ │ -
75 MPI_Pack(mpidata.ptr(), mpidata.size(),
│ │ │ │ -
76 mpidata.type(), _buffer.data(), _buffer.size(),
│ │ │ │ -
77 &_position, _comm);
│ │ │ │ -
78 }
│ │ │ │ -
│ │ │ │ -
79
│ │ │ │ -
84 template<class T>
│ │ │ │ -
│ │ │ │ -
85 auto /*void*/ unpack(T& data)
│ │ │ │ -
86 -> std::enable_if_t<decltype(getMPIData(data))::static_size, void>
│ │ │ │ -
87 {
│ │ │ │ -
88 auto mpidata = getMPIData(data);
│ │ │ │ -
89 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
│ │ │ │ -
90 mpidata.ptr(), mpidata.size(),
│ │ │ │ -
91 mpidata.type(), _comm);
│ │ │ │ -
92 }
│ │ │ │ -
│ │ │ │ -
93
│ │ │ │ -
98 template<class T>
│ │ │ │ -
│ │ │ │ -
99 auto /*void*/ unpack(T& data)
│ │ │ │ -
100 -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void>
│ │ │ │ -
101 {
│ │ │ │ -
102 auto mpidata = getMPIData(data);
│ │ │ │ -
103 int size = 0;
│ │ │ │ -
104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
│ │ │ │ -
105 &size, 1,
│ │ │ │ -
106 MPI_INT, _comm);
│ │ │ │ -
107 mpidata.resize(size);
│ │ │ │ -
108 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
│ │ │ │ -
109 mpidata.ptr(), mpidata.size(),
│ │ │ │ -
110 mpidata.type(), _comm);
│ │ │ │ -
111 }
│ │ │ │ -
│ │ │ │ -
112
│ │ │ │ -
113
│ │ │ │ -
115 template<typename T>
│ │ │ │ -
│ │ │ │ -
116 friend MPIPack& operator << (MPIPack& p, const T& t){
│ │ │ │ -
117 p.pack(t);
│ │ │ │ -
118 return p;
│ │ │ │ -
119 }
│ │ │ │ -
│ │ │ │ -
120
│ │ │ │ -
122 template<typename T>
│ │ │ │ -
│ │ │ │ -
123 friend MPIPack& operator >> (MPIPack& p, T& t){
│ │ │ │ -
124 p.unpack(t);
│ │ │ │ -
125 return p;
│ │ │ │ -
126 }
│ │ │ │ -
│ │ │ │ -
127
│ │ │ │ -
129 template<typename T>
│ │ │ │ -
│ │ │ │ -
130 MPIPack& read(T& t){
│ │ │ │ -
131 unpack(t);
│ │ │ │ -
132 return *this;
│ │ │ │ -
133 }
│ │ │ │ -
│ │ │ │ -
134
│ │ │ │ -
136 template<typename T>
│ │ │ │ -
│ │ │ │ -
137 MPIPack& write(const T& t){
│ │ │ │ -
138 pack(t);
│ │ │ │ -
139 return *this;
│ │ │ │ -
140 }
│ │ │ │ -
│ │ │ │ -
141
│ │ │ │ -
│ │ │ │ -
145 void resize(size_t size){
│ │ │ │ -
146 _buffer.resize(size);
│ │ │ │ -
147 }
│ │ │ │ -
│ │ │ │ -
148
│ │ │ │ -
│ │ │ │ -
151 void enlarge(int s) {
│ │ │ │ -
152 _buffer.resize(_buffer.size() + s);
│ │ │ │ -
153 }
│ │ │ │ -
│ │ │ │ -
154
│ │ │ │ -
│ │ │ │ -
157 size_t size() const {
│ │ │ │ -
158 return _buffer.size();
│ │ │ │ -
159 }
│ │ │ │ -
│ │ │ │ -
160
│ │ │ │ -
│ │ │ │ -
164 void seek(int p){
│ │ │ │ -
165 _position = p;
│ │ │ │ -
166 }
│ │ │ │ -
│ │ │ │ -
167
│ │ │ │ -
│ │ │ │ -
171 int tell() const{
│ │ │ │ -
172 return _position;
│ │ │ │ -
173 }
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
│ │ │ │ -
177 bool eof() const{
│ │ │ │ -
178 return std::size_t(_position)==_buffer.size();
│ │ │ │ -
179 }
│ │ │ │ -
│ │ │ │ -
180
│ │ │ │ -
│ │ │ │ -
184 static int getPackSize(int len, const MPI_Comm& comm, const MPI_Datatype& dt){
│ │ │ │ -
185 int size;
│ │ │ │ -
186 MPI_Pack_size(len, dt, comm, &size);
│ │ │ │ -
187 return size;
│ │ │ │ -
188 }
│ │ │ │ -
│ │ │ │ -
189
│ │ │ │ -
│ │ │ │ -
190 friend bool operator==(const MPIPack& a, const MPIPack& b) {
│ │ │ │ -
191 return a._buffer == b._buffer && a._comm == b._comm;
│ │ │ │ -
192 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
193 friend bool operator!=(const MPIPack& a, const MPIPack& b) {
│ │ │ │ -
194 return !(a==b);
│ │ │ │ -
195 }
│ │ │ │ -
│ │ │ │ -
196
│ │ │ │ -
197 };
│ │ │ │ -
│ │ │ │ -
198
│ │ │ │ -
199 template<class P>
│ │ │ │ -
│ │ │ │ -
200 struct MPIData<P, std::enable_if_t<std::is_same<std::remove_const_t<P>, MPIPack>::value>> {
│ │ │ │ -
201 protected:
│ │ │ │ -
202 friend auto getMPIData<P>(P& t);
│ │ │ │ -
│ │ │ │ -
203 MPIData(P& t) :
│ │ │ │ -
204 data_(t)
│ │ │ │ -
205 {}
│ │ │ │ -
│ │ │ │ -
206 public:
│ │ │ │ -
207 static constexpr bool static_size = std::is_const<P>::value;
│ │ │ │ -
208
│ │ │ │ -
│ │ │ │ -
209 void* ptr() {
│ │ │ │ -
210 return (void*) data_._buffer.data();
│ │ │ │ -
211 }
│ │ │ │ -
│ │ │ │ -
212
│ │ │ │ -
│ │ │ │ -
213 int size() {
│ │ │ │ -
214 return data_.size();
│ │ │ │ -
215 }
│ │ │ │ -
│ │ │ │ -
216
│ │ │ │ -
│ │ │ │ -
217 MPI_Datatype type() const{
│ │ │ │ -
218 return MPI_PACKED;
│ │ │ │ -
219 }
│ │ │ │ -
│ │ │ │ -
220
│ │ │ │ -
│ │ │ │ -
221 void resize(int size){
│ │ │ │ -
222 data_.resize(size);
│ │ │ │ -
223 }
│ │ │ │ -
│ │ │ │ -
224 protected:
│ │ │ │ - │ │ │ │ -
226 };
│ │ │ │ -
│ │ │ │ -
227
│ │ │ │ -
228} // end namespace Dune
│ │ │ │ -
229
│ │ │ │ -
230#endif // HAVE_MPI
│ │ │ │ -
231#endif // DUNE_COMMON_PARALLEL_MPIPACK_HH
│ │ │ │ -
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
│ │ │ │ -
auto getMPIData(T &t)
Definition mpidata.hh:44
│ │ │ │ -
Collective communication interface and sequential default implementation.
Definition communication.hh:100
│ │ │ │ -
Definition mpidata.hh:51
│ │ │ │ -
T & data_
Definition mpidata.hh:54
│ │ │ │ -
int size() const
Definition mpidata.hh:68
│ │ │ │ -
static constexpr bool static_size
Definition mpidata.hh:66
│ │ │ │ -
Definition mpipack.hh:36
│ │ │ │ -
void enlarge(int s)
Enlarges the internal buffer.
Definition mpipack.hh:151
│ │ │ │ -
friend MPIPack & operator>>(MPIPack &p, T &t)
Unpacks data from the object.
Definition mpipack.hh:123
│ │ │ │ -
friend MPIPack & operator<<(MPIPack &p, const T &t)
Packs the data into the object. Enlarges the internal buffer if necessary.
Definition mpipack.hh:116
│ │ │ │ -
friend bool operator!=(const MPIPack &a, const MPIPack &b)
Definition mpipack.hh:193
│ │ │ │ -
size_t size() const
Returns the size of the internal buffer.
Definition mpipack.hh:157
│ │ │ │ -
MPIPack & operator=(const MPIPack &other)=delete
│ │ │ │ -
MPIPack(Communication< MPI_Comm > comm, std::size_t size=0)
Definition mpipack.hh:44
│ │ │ │ -
void pack(const T &data)
Packs the data into the object. Enlarges the internal buffer if necessary.
Definition mpipack.hh:62
│ │ │ │ -
auto unpack(T &data) -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void >
Unpacks data from the object.
Definition mpipack.hh:99
│ │ │ │ -
auto unpack(T &data) -> std::enable_if_t< decltype(getMPIData(data))::static_size, void >
Unpacks data from the object.
Definition mpipack.hh:85
│ │ │ │ -
friend bool operator==(const MPIPack &a, const MPIPack &b)
Definition mpipack.hh:190
│ │ │ │ -
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:164
│ │ │ │ -
bool eof() const
Checks whether the end of the buffer is reached.
Definition mpipack.hh:177
│ │ │ │ -
void resize(size_t size)
Resizes the internal buffer.
Definition mpipack.hh:145
│ │ │ │ -
int tell() const
Gets the position in the buffer where the next pack/unpack operation should take place.
Definition mpipack.hh:171
│ │ │ │ -
MPIPack(MPIPack &&)=default
│ │ │ │ -
MPIPack & read(T &t)
Unpacks data from the object.
Definition mpipack.hh:130
│ │ │ │ -
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:184
│ │ │ │ -
MPIPack & write(const T &t)
Packs the data into the object. Enlarges the internal buffer if necessary.
Definition mpipack.hh:137
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
33public:
│ │ │ │ +
34
│ │ │ │ +
│ │ │ │ +
36 constexpr mapping () noexcept
│ │ │ │ + │ │ │ │ +
38 {}
│ │ │ │ +
│ │ │ │ +
39
│ │ │ │ +
41 constexpr mapping (const mapping&) noexcept = default;
│ │ │ │ +
42
│ │ │ │ +
44 template <class OtherIndexType,
│ │ │ │ +
45 std::enable_if_t<std::is_convertible_v<const OtherIndexType&, index_type>, int> = 0,
│ │ │ │ +
46 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const OtherIndexType&>, int> = 0>
│ │ │ │ +
│ │ │ │ +
47 constexpr mapping (const extents_type& e, const std::array<OtherIndexType,rank_>& s) noexcept
│ │ │ │ +
48 : extents_(e)
│ │ │ │ +
49 , strides_{}
│ │ │ │ +
50 {
│ │ │ │ +
51 for (rank_type r = 0; r < rank_; ++r)
│ │ │ │ +
52 strides_[r] = s[r];
│ │ │ │ +
53 }
│ │ │ │ +
│ │ │ │ +
54
│ │ │ │ +
56 template <class OtherIndexType,
│ │ │ │ +
57 std::enable_if_t<std::is_convertible_v<const OtherIndexType&, index_type>, int> = 0,
│ │ │ │ +
58 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const OtherIndexType&>, int> = 0>
│ │ │ │ +
│ │ │ │ +
59 constexpr mapping (const extents_type& e, const span<OtherIndexType,rank_>& s) noexcept
│ │ │ │ +
60 : extents_(e)
│ │ │ │ +
61 , strides_{}
│ │ │ │ +
62 {
│ │ │ │ +
63 for (rank_type r = 0; r < rank_; ++r)
│ │ │ │ +
64 strides_[r] = s[r];
│ │ │ │ +
65 }
│ │ │ │ +
│ │ │ │ +
66
│ │ │ │ +
68 template <class M,
│ │ │ │ +
69 std::enable_if_t<(M::extents_type::rank() == extents_type::rank()), int> = 0,
│ │ │ │ +
70 std::enable_if_t<(M::is_always_unique()), int> = 0,
│ │ │ │ +
71 std::enable_if_t<(M::is_always_strided()), int> = 0,
│ │ │ │ +
72 decltype(std::declval<M>().extents(), bool{}) = true,
│ │ │ │ +
73 decltype(std::declval<M>().stride(std::declval<rank_type>()), bool{}) = true>
│ │ │ │ +
│ │ │ │ +
74 constexpr mapping (const M& m) noexcept
│ │ │ │ +
75 : extents_(m.extents())
│ │ │ │ +
76 , strides_{}
│ │ │ │ +
77 {
│ │ │ │ +
78 for (rank_type r = 0; r < rank_; ++r)
│ │ │ │ +
79 strides_[r] = m.stride(r);
│ │ │ │ +
80 }
│ │ │ │ +
│ │ │ │ +
81
│ │ │ │ +
83 constexpr mapping& operator= (const mapping&) noexcept = default;
│ │ │ │ +
84
│ │ │ │ +
85 constexpr const extents_type& extents () const noexcept { return extents_; }
│ │ │ │ +
86
│ │ │ │ +
│ │ │ │ +
88 constexpr index_type required_span_size () const noexcept
│ │ │ │ +
89 {
│ │ │ │ +
90 return size(extents_,strides_);
│ │ │ │ +
91 }
│ │ │ │ +
│ │ │ │ +
92
│ │ │ │ +
94 template <class... Indices,
│ │ │ │ +
95 std::enable_if_t<(sizeof...(Indices) == rank_), int> = 0,
│ │ │ │ +
96 std::enable_if_t<(std::is_convertible_v<Indices, index_type> && ...), int> = 0,
│ │ │ │ +
97 std::enable_if_t<(std::is_nothrow_constructible_v<index_type, Indices> && ...), int> = 0>
│ │ │ │ +
│ │ │ │ +
98 constexpr index_type operator() (Indices... ii) const noexcept
│ │ │ │ +
99 {
│ │ │ │ +
100 return unpackIntegerSequence([&](auto... r) {
│ │ │ │ +
101 return ((static_cast<index_type>(ii)*strides_[r]) + ... + 0); },
│ │ │ │ +
102 std::make_index_sequence<rank_>{});
│ │ │ │ +
103 }
│ │ │ │ +
│ │ │ │ +
104
│ │ │ │ +
│ │ │ │ +
106 constexpr index_type operator() () const noexcept
│ │ │ │ +
107 {
│ │ │ │ +
108 return 0;
│ │ │ │ +
109 }
│ │ │ │ +
│ │ │ │ +
110
│ │ │ │ +
111 static constexpr bool is_always_unique () noexcept { return true; }
│ │ │ │ +
112 static constexpr bool is_always_exhaustive () noexcept { return false; }
│ │ │ │ +
113 static constexpr bool is_always_strided () noexcept { return true; }
│ │ │ │ +
114
│ │ │ │ +
115 static constexpr bool is_unique () noexcept { return true; }
│ │ │ │ +
116 static constexpr bool is_strided () noexcept { return true; }
│ │ │ │ +
117
│ │ │ │ +
│ │ │ │ +
118 constexpr bool is_exhaustive () const noexcept
│ │ │ │ +
119 {
│ │ │ │ +
120 // Actually this could be improved. A strided layout can still be exhaustive.
│ │ │ │ +
121 // This test is more complicated to implement, though. See §24.7.3.4.7.4 line (5.2)
│ │ │ │ +
122 // in the C++ standard document N4971
│ │ │ │ +
123 return extents_type::rank() == 0 || (required_span_size() > 0 && required_span_size() == extents().product());
│ │ │ │ +
124 }
│ │ │ │ +
│ │ │ │ +
125
│ │ │ │ +
│ │ │ │ +
127 constexpr const strides_type& strides () const noexcept
│ │ │ │ +
128 {
│ │ │ │ +
129 return strides_;
│ │ │ │ +
130 }
│ │ │ │ +
│ │ │ │ +
131
│ │ │ │ +
133 template <class E = extents_type,
│ │ │ │ +
134 std::enable_if_t<(E::rank() > 0), int> = 0>
│ │ │ │ +
│ │ │ │ +
135 constexpr index_type stride (rank_type i) const noexcept
│ │ │ │ +
136 {
│ │ │ │ +
137 return strides_[i];
│ │ │ │ +
138 }
│ │ │ │ +
│ │ │ │ +
139
│ │ │ │ +
140 template <class OtherMapping,
│ │ │ │ +
141 std::enable_if_t<(OtherMapping::extents_type::rank() == extents_type::rank()), int> = 0,
│ │ │ │ +
142 std::enable_if_t<(OtherMapping::is_always_strided()), int> = 0>
│ │ │ │ +
│ │ │ │ +
143 friend constexpr bool operator== (const mapping& a, const OtherMapping& b) noexcept
│ │ │ │ +
144 {
│ │ │ │ +
145 if (offset(b))
│ │ │ │ +
146 return false;
│ │ │ │ +
147 if constexpr(extents_type::rank() == 0)
│ │ │ │ +
148 return true;
│ │ │ │ +
149 return a.extents_ == b.extents_ && a.strides_ == b.strides_;
│ │ │ │ +
150 }
│ │ │ │ +
│ │ │ │ +
151
│ │ │ │ +
152private:
│ │ │ │ +
153 template <class E, class S>
│ │ │ │ +
154 static constexpr index_type size (const E& extents, const S& strides) noexcept
│ │ │ │ +
155 {
│ │ │ │ +
156 if constexpr (E::rank() == 0)
│ │ │ │ +
157 return 1;
│ │ │ │ +
158 else {
│ │ │ │ +
159 if (extents.product() == 0)
│ │ │ │ +
160 return 0;
│ │ │ │ +
161 else {
│ │ │ │ +
162 index_type result = 1;
│ │ │ │ +
163 for (rank_type r = 0; r < E::rank(); ++r)
│ │ │ │ +
164 result += (extents.extent(r)-1) * strides[r];
│ │ │ │ +
165 return result;
│ │ │ │ +
166 }
│ │ │ │ +
167 }
│ │ │ │ +
168 }
│ │ │ │ +
169
│ │ │ │ +
170 template <class M>
│ │ │ │ +
171 static constexpr size_type offset (const M& m) noexcept
│ │ │ │ +
172 {
│ │ │ │ +
173 if constexpr (M::extents_type::rank() == 0)
│ │ │ │ +
174 return m();
│ │ │ │ +
175 else {
│ │ │ │ +
176 if (m.required_span_size() == 0)
│ │ │ │ +
177 return 0;
│ │ │ │ +
178 else {
│ │ │ │ +
179 return unpackIntegerSequence([&](auto... r) {
│ │ │ │ +
180 return m((r,0)...); }, // map the index tuple (0,0...)
│ │ │ │ +
181 std::make_index_sequence<M::extents_type::rank()>{});
│ │ │ │ +
182 }
│ │ │ │ +
183 }
│ │ │ │ +
184 }
│ │ │ │ +
185
│ │ │ │ +
186private:
│ │ │ │ +
187 [[no_unique_address]] extents_type extents_;
│ │ │ │ +
188 strides_type strides_;
│ │ │ │ +
189};
│ │ │ │ +
│ │ │ │ +
190
│ │ │ │ +
191} // end namespace Dune::Std
│ │ │ │ +
192
│ │ │ │ +
193#endif // DUNE_COMMON_STD_LAYOUT_STRIDE_HH
│ │ │ │ + │ │ │ │ + │ │ │ │ +
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:124
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
Multidimensional index space with dynamic and static extents.
Definition extents.hh:54
│ │ │ │ +
constexpr index_type extent(rank_type r) const noexcept
Return the extent of dimension i
Definition extents.hh:100
│ │ │ │ +
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ +
A layout mapping where the strides are user-defined.
Definition fwd_layouts.hh:40
│ │ │ │ +
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │ +
constexpr mapping(const extents_type &e, const span< OtherIndexType, rank_ > &s) noexcept
Construct the mapping from given extents and strides.
Definition layout_stride.hh:59
│ │ │ │ +
Extents extents_type
Definition layout_stride.hh:24
│ │ │ │ +
constexpr mapping & operator=(const mapping &) noexcept=default
Copy-assignment for the mapping.
│ │ │ │ +
constexpr bool is_exhaustive() const noexcept
Definition layout_stride.hh:118
│ │ │ │ +
constexpr mapping() noexcept
The default construction initializes the strides from layout_right.
Definition layout_stride.hh:36
│ │ │ │ +
constexpr mapping(const extents_type &e, const std::array< OtherIndexType, rank_ > &s) noexcept
Construct the mapping from given extents and strides.
Definition layout_stride.hh:47
│ │ │ │ +
constexpr index_type stride(rank_type i) const noexcept
Get the single stride i
Definition layout_stride.hh:135
│ │ │ │ +
typename extents_type::index_type index_type
Definition layout_stride.hh:25
│ │ │ │ +
static constexpr bool is_always_exhaustive() noexcept
Definition layout_stride.hh:112
│ │ │ │ +
constexpr const extents_type & extents() const noexcept
Definition layout_stride.hh:85
│ │ │ │ +
static constexpr bool is_strided() noexcept
Definition layout_stride.hh:116
│ │ │ │ +
static constexpr bool is_always_strided() noexcept
Definition layout_stride.hh:113
│ │ │ │ +
constexpr index_type required_span_size() const noexcept
Return the sum 1 + (E(0)-1)*S(0) + (E(1)-1)*S(1) + ...
Definition layout_stride.hh:88
│ │ │ │ +
constexpr const strides_type & strides() const noexcept
Get the array of all strides.
Definition layout_stride.hh:127
│ │ │ │ +
constexpr mapping(const mapping &) noexcept=default
Copy constructor for the mapping.
│ │ │ │ +
typename extents_type::rank_type rank_type
Definition layout_stride.hh:27
│ │ │ │ +
static constexpr bool is_unique() noexcept
Definition layout_stride.hh:115
│ │ │ │ +
constexpr index_type operator()() const noexcept
The default offset for rank-0 tensors is 0.
Definition layout_stride.hh:106
│ │ │ │ +
typename extents_type::size_type size_type
Definition layout_stride.hh:26
│ │ │ │ +
static constexpr bool is_always_unique() noexcept
Definition layout_stride.hh:111
│ │ │ │ +
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,327 +1,308 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +layout_stride.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 © 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 │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_LAYOUT_STRIDE_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_LAYOUT_STRIDE_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_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ +13 │ │ │ │ │ +14namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +15 │ │ │ │ │ +17template │ │ │ │ │ +_1_8class _l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ +19{ │ │ │ │ │ +_2_0 template friend class _m_a_p_p_i_n_g; │ │ │ │ │ +21 static constexpr typename Extents::rank_type rank_ = Extents::rank(); │ │ │ │ │ 22 │ │ │ │ │ -23#if HAVE_MPI │ │ │ │ │ -24 │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27 │ │ │ │ │ -28#include │ │ │ │ │ +23public: │ │ │ │ │ +_2_4 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ +_2_5 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ +_2_6 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ +_2_7 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ +_2_8 using _l_a_y_o_u_t___t_y_p_e = _l_a_y_o_u_t___s_t_r_i_d_e; │ │ │ │ │ 29 │ │ │ │ │ -30#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> │ │ │ │ │ -31#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> │ │ │ │ │ +30private: │ │ │ │ │ +31 using strides_type = std::array; │ │ │ │ │ 32 │ │ │ │ │ -33 │ │ │ │ │ -34namespace _D_u_n_e { │ │ │ │ │ -35 │ │ │ │ │ -_3_6 class _M_P_I_P_a_c_k { │ │ │ │ │ -37 std::vector _buffer; │ │ │ │ │ -38 int _position; │ │ │ │ │ -_3_9 MPI_Comm _comm; │ │ │ │ │ -40 │ │ │ │ │ -41 friend struct _M_P_I_D_a_t_a<_M_P_I_P_a_c_k>; │ │ │ │ │ -42 friend struct _M_P_I_D_a_t_a; │ │ │ │ │ -43 public: │ │ │ │ │ -_4_4 _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) │ │ │ │ │ -45 : _buffer(_s_i_z_e) │ │ │ │ │ -46 , _position(0) │ │ │ │ │ -47 , _comm(comm) │ │ │ │ │ -48 {} │ │ │ │ │ -49 │ │ │ │ │ -50 // Its not valid to copy a MPIPack but you can move it │ │ │ │ │ -_5_1 _M_P_I_P_a_c_k(const _M_P_I_P_a_c_k&) = delete; │ │ │ │ │ -_5_2 _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; │ │ │ │ │ -_5_3 _M_P_I_P_a_c_k(_M_P_I_P_a_c_k&&) = default; │ │ │ │ │ -_5_4 _M_P_I_P_a_c_k& _o_p_e_r_a_t_o_r_ _=_ (_M_P_I_P_a_c_k&& other) = default; │ │ │ │ │ -55 │ │ │ │ │ -61 template │ │ │ │ │ -_6_2 void _p_a_c_k(const T& data){ │ │ │ │ │ -63 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -64 int _s_i_z_e = _g_e_t_P_a_c_k_S_i_z_e(mpidata.size(), _comm, mpidata.type()); │ │ │ │ │ -65 constexpr bool has_static_size = decltype(_g_e_t_M_P_I_D_a_t_a(std::declval())):: │ │ │ │ │ -static_size; │ │ │ │ │ -66 if(!has_static_size) │ │ │ │ │ -67 _s_i_z_e += _g_e_t_P_a_c_k_S_i_z_e(1, _comm, MPI_INT); │ │ │ │ │ -68 if (_position + _s_i_z_e > 0 && size_t(_position + _s_i_z_e) > _buffer.size()) / │ │ │ │ │ -/ resize buffer if necessary │ │ │ │ │ -69 _buffer.resize(_position + _s_i_z_e); │ │ │ │ │ -70 if(!has_static_size){ │ │ │ │ │ -71 int _s_i_z_e = mpidata.size(); │ │ │ │ │ -72 MPI_Pack(&_s_i_z_e, 1, MPI_INT, _buffer.data(), _buffer.size(), │ │ │ │ │ -73 &_position, _comm); │ │ │ │ │ -74 } │ │ │ │ │ -75 MPI_Pack(mpidata.ptr(), mpidata.size(), │ │ │ │ │ -76 mpidata.type(), _buffer.data(), _buffer.size(), │ │ │ │ │ -77 &_position, _comm); │ │ │ │ │ -78 } │ │ │ │ │ -79 │ │ │ │ │ -84 template │ │ │ │ │ -_8_5 auto /*void*/ _u_n_p_a_c_k(T& data) │ │ │ │ │ -86 -> std::enable_if_t │ │ │ │ │ -87 { │ │ │ │ │ -88 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -89 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ -90 mpidata.ptr(), mpidata.size(), │ │ │ │ │ -91 mpidata.type(), _comm); │ │ │ │ │ -92 } │ │ │ │ │ -93 │ │ │ │ │ -98 template │ │ │ │ │ -_9_9 auto /*void*/ _u_n_p_a_c_k(T& data) │ │ │ │ │ -100 -> std::enable_if_t │ │ │ │ │ -101 { │ │ │ │ │ -102 auto mpidata = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -103 int _s_i_z_e = 0; │ │ │ │ │ -104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ -105 &_s_i_z_e, 1, │ │ │ │ │ -106 MPI_INT, _comm); │ │ │ │ │ -107 mpidata.resize(_s_i_z_e); │ │ │ │ │ -108 MPI_Unpack(_buffer.data(), _buffer.size(), &_position, │ │ │ │ │ -109 mpidata.ptr(), mpidata.size(), │ │ │ │ │ -110 mpidata.type(), _comm); │ │ │ │ │ -111 } │ │ │ │ │ -112 │ │ │ │ │ -113 │ │ │ │ │ -115 template │ │ │ │ │ -_1_1_6 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){ │ │ │ │ │ -117 p._p_a_c_k(t); │ │ │ │ │ -118 return p; │ │ │ │ │ -119 } │ │ │ │ │ -120 │ │ │ │ │ -122 template │ │ │ │ │ -_1_2_3 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){ │ │ │ │ │ -124 p._u_n_p_a_c_k(t); │ │ │ │ │ -125 return p; │ │ │ │ │ -126 } │ │ │ │ │ -127 │ │ │ │ │ -129 template │ │ │ │ │ -_1_3_0 _M_P_I_P_a_c_k& _r_e_a_d(T& t){ │ │ │ │ │ -131 _u_n_p_a_c_k(t); │ │ │ │ │ -132 return *this; │ │ │ │ │ -133 } │ │ │ │ │ -134 │ │ │ │ │ -136 template │ │ │ │ │ -_1_3_7 _M_P_I_P_a_c_k& _w_r_i_t_e(const T& t){ │ │ │ │ │ -138 _p_a_c_k(t); │ │ │ │ │ -139 return *this; │ │ │ │ │ -140 } │ │ │ │ │ -141 │ │ │ │ │ -_1_4_5 void _r_e_s_i_z_e(size_t _s_i_z_e){ │ │ │ │ │ -146 _buffer.resize(_s_i_z_e); │ │ │ │ │ -147 } │ │ │ │ │ -148 │ │ │ │ │ -_1_5_1 void _e_n_l_a_r_g_e(int s) { │ │ │ │ │ -152 _buffer.resize(_buffer.size() + s); │ │ │ │ │ -153 } │ │ │ │ │ -154 │ │ │ │ │ -_1_5_7 size_t _s_i_z_e() const { │ │ │ │ │ -158 return _buffer.size(); │ │ │ │ │ -159 } │ │ │ │ │ -160 │ │ │ │ │ -_1_6_4 void _s_e_e_k(int p){ │ │ │ │ │ -165 _position = p; │ │ │ │ │ +33public: │ │ │ │ │ +34 │ │ │ │ │ +_3_6 constexpr _m_a_p_p_i_n_g () noexcept │ │ │ │ │ +37 : _m_a_p_p_i_n_g(_l_a_y_o_u_t___r_i_g_h_t::template _m_a_p_p_i_n_g<_e_x_t_e_n_t_s___t_y_p_e>{}) │ │ │ │ │ +38 {} │ │ │ │ │ +39 │ │ │ │ │ +_4_1 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ +42 │ │ │ │ │ +44 template , │ │ │ │ │ +int> = 0, │ │ │ │ │ +46 std::enable_if_t, int> = 0> │ │ │ │ │ +_4_7 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e, const std:: │ │ │ │ │ +array& s) noexcept │ │ │ │ │ +48 : extents_(e) │ │ │ │ │ +49 , strides_{} │ │ │ │ │ +50 { │ │ │ │ │ +51 for (_r_a_n_k___t_y_p_e r = 0; r < rank_; ++r) │ │ │ │ │ +52 strides_[r] = s[r]; │ │ │ │ │ +53 } │ │ │ │ │ +54 │ │ │ │ │ +56 template , │ │ │ │ │ +int> = 0, │ │ │ │ │ +58 std::enable_if_t, int> = 0> │ │ │ │ │ +_5_9 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e, const _s_p_a_n_<_O_t_h_e_r_I_n_d_e_x_T_y_p_e_,_r_a_n_k___>& │ │ │ │ │ +s) noexcept │ │ │ │ │ +60 : extents_(e) │ │ │ │ │ +61 , strides_{} │ │ │ │ │ +62 { │ │ │ │ │ +63 for (_r_a_n_k___t_y_p_e r = 0; r < rank_; ++r) │ │ │ │ │ +64 strides_[r] = s[r]; │ │ │ │ │ +65 } │ │ │ │ │ +66 │ │ │ │ │ +68 template = │ │ │ │ │ +0, │ │ │ │ │ +70 std::enable_if_t<(M::is_always_unique()), int> = 0, │ │ │ │ │ +71 std::enable_if_t<(M::is_always_strided()), int> = 0, │ │ │ │ │ +72 decltype(std::declval().extents(), bool{}) = true, │ │ │ │ │ +73 decltype(std::declval().stride(std::declval()), bool{}) = │ │ │ │ │ +true> │ │ │ │ │ +_7_4 constexpr _m_a_p_p_i_n_g (const M& m) noexcept │ │ │ │ │ +75 : extents_(m.extents()) │ │ │ │ │ +76 , strides_{} │ │ │ │ │ +77 { │ │ │ │ │ +78 for (_r_a_n_k___t_y_p_e r = 0; r < rank_; ++r) │ │ │ │ │ +79 strides_[r] = m._s_t_r_i_d_e(r); │ │ │ │ │ +80 } │ │ │ │ │ +81 │ │ │ │ │ +_8_3 constexpr _m_a_p_p_i_n_g& _o_p_e_r_a_t_o_r_=_ (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ +84 │ │ │ │ │ +_8_5 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return extents_; } │ │ │ │ │ +86 │ │ │ │ │ +_8_8 constexpr _i_n_d_e_x___t_y_p_e _r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e () const noexcept │ │ │ │ │ +89 { │ │ │ │ │ +90 return size(extents_,strides_); │ │ │ │ │ +91 } │ │ │ │ │ +92 │ │ │ │ │ +94 template = 0, │ │ │ │ │ +96 std::enable_if_t<(std::is_convertible_v && ...), int> = │ │ │ │ │ +0, │ │ │ │ │ +97 std::enable_if_t<(std::is_nothrow_constructible_v && │ │ │ │ │ +...), int> = 0> │ │ │ │ │ +_9_8 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ (Indices... ii) const noexcept │ │ │ │ │ +99 { │ │ │ │ │ +100 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... r) { │ │ │ │ │ +101 return ((static_cast<_i_n_d_e_x___t_y_p_e>(ii)*strides_[r]) + ... + 0); }, │ │ │ │ │ +102 std::make_index_sequence{}); │ │ │ │ │ +103 } │ │ │ │ │ +104 │ │ │ │ │ +_1_0_6 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ () const noexcept │ │ │ │ │ +107 { │ │ │ │ │ +108 return 0; │ │ │ │ │ +109 } │ │ │ │ │ +110 │ │ │ │ │ +_1_1_1 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ +_1_1_2 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return false; } │ │ │ │ │ +_1_1_3 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ +114 │ │ │ │ │ +_1_1_5 static constexpr bool _i_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ +_1_1_6 static constexpr bool _i_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ +117 │ │ │ │ │ +_1_1_8 constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () const noexcept │ │ │ │ │ +119 { │ │ │ │ │ +120 // Actually this could be improved. A strided layout can still be │ │ │ │ │ +exhaustive. │ │ │ │ │ +121 // This test is more complicated to implement, though. See §24.7.3.4.7.4 │ │ │ │ │ +line (5.2) │ │ │ │ │ +122 // in the C++ standard document N4971 │ │ │ │ │ +123 return extents_type::rank() == 0 || (_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e() > 0 && │ │ │ │ │ +_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e() == _e_x_t_e_n_t_s().product()); │ │ │ │ │ +124 } │ │ │ │ │ +125 │ │ │ │ │ +_1_2_7 constexpr const strides_type& _s_t_r_i_d_e_s () const noexcept │ │ │ │ │ +128 { │ │ │ │ │ +129 return strides_; │ │ │ │ │ +130 } │ │ │ │ │ +131 │ │ │ │ │ +133 template 0), int> = 0> │ │ │ │ │ +_1_3_5 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e i) const noexcept │ │ │ │ │ +136 { │ │ │ │ │ +137 return strides_[i]; │ │ │ │ │ +138 } │ │ │ │ │ +139 │ │ │ │ │ +140 template = 0, │ │ │ │ │ +142 std::enable_if_t<(OtherMapping::is_always_strided()), int> = 0> │ │ │ │ │ +_1_4_3 friend constexpr bool operator== (const _m_a_p_p_i_n_g& a, const OtherMapping& b) │ │ │ │ │ +noexcept │ │ │ │ │ +144 { │ │ │ │ │ +145 if (offset(b)) │ │ │ │ │ +146 return false; │ │ │ │ │ +147 if constexpr(extents_type::rank() == 0) │ │ │ │ │ +148 return true; │ │ │ │ │ +149 return a.extents_ == b.extents_ && a.strides_ == b.strides_; │ │ │ │ │ +150 } │ │ │ │ │ +151 │ │ │ │ │ +152private: │ │ │ │ │ +153 template │ │ │ │ │ +154 static constexpr _i_n_d_e_x___t_y_p_e size (const E& _e_x_t_e_n_t_s, const S& _s_t_r_i_d_e_s) │ │ │ │ │ +noexcept │ │ │ │ │ +155 { │ │ │ │ │ +156 if constexpr (E::rank() == 0) │ │ │ │ │ +157 return 1; │ │ │ │ │ +158 else { │ │ │ │ │ +159 if (_e_x_t_e_n_t_s.product() == 0) │ │ │ │ │ +160 return 0; │ │ │ │ │ +161 else { │ │ │ │ │ +162 _i_n_d_e_x___t_y_p_e result = 1; │ │ │ │ │ +163 for (_r_a_n_k___t_y_p_e r = 0; r < E::rank(); ++r) │ │ │ │ │ +164 result += (_e_x_t_e_n_t_s._e_x_t_e_n_t(r)-1) * _s_t_r_i_d_e_s[r]; │ │ │ │ │ +165 return result; │ │ │ │ │ 166 } │ │ │ │ │ -167 │ │ │ │ │ -_1_7_1 int _t_e_l_l() const{ │ │ │ │ │ -172 return _position; │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -_1_7_7 bool _e_o_f() const{ │ │ │ │ │ -178 return std::size_t(_position)==_buffer.size(); │ │ │ │ │ -179 } │ │ │ │ │ -180 │ │ │ │ │ -_1_8_4 static int _g_e_t_P_a_c_k_S_i_z_e(int len, const MPI_Comm& comm, const MPI_Datatype& │ │ │ │ │ -dt){ │ │ │ │ │ -185 int _s_i_z_e; │ │ │ │ │ -186 MPI_Pack_size(len, dt, comm, &_s_i_z_e); │ │ │ │ │ -187 return _s_i_z_e; │ │ │ │ │ -188 } │ │ │ │ │ -189 │ │ │ │ │ -_1_9_0 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) { │ │ │ │ │ -191 return a._buffer == b._buffer && a._comm == b._comm; │ │ │ │ │ -192 } │ │ │ │ │ -_1_9_3 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) { │ │ │ │ │ -194 return !(a==b); │ │ │ │ │ -195 } │ │ │ │ │ -196 │ │ │ │ │ -197 }; │ │ │ │ │ -198 │ │ │ │ │ -199 template │ │ │ │ │ -_2_0_0 struct _M_P_I_D_a_t_a, │ │ │ │ │ -MPIPack>::value>> { │ │ │ │ │ -201 protected: │ │ │ │ │ -_2_0_2 friend auto getMPIData

(P& t); │ │ │ │ │ -_2_0_3 _M_P_I_D_a_t_a(P& t) : │ │ │ │ │ -204 _d_a_t_a__(t) │ │ │ │ │ -205 {} │ │ │ │ │ -206 public: │ │ │ │ │ -_2_0_7 static constexpr bool _s_t_a_t_i_c___s_i_z_e = std::is_const

::value; │ │ │ │ │ -208 │ │ │ │ │ -_2_0_9 void* _p_t_r() { │ │ │ │ │ -210 return (void*) _d_a_t_a__._buffer.data(); │ │ │ │ │ -211 } │ │ │ │ │ -212 │ │ │ │ │ -_2_1_3 int _s_i_z_e() { │ │ │ │ │ -214 return _d_a_t_a__.size(); │ │ │ │ │ -215 } │ │ │ │ │ -216 │ │ │ │ │ -_2_1_7 MPI_Datatype _t_y_p_e() const{ │ │ │ │ │ -218 return MPI_PACKED; │ │ │ │ │ -219 } │ │ │ │ │ -220 │ │ │ │ │ -_2_2_1 void _r_e_s_i_z_e(int _s_i_z_e){ │ │ │ │ │ -222 _d_a_t_a__.resize(_s_i_z_e); │ │ │ │ │ -223 } │ │ │ │ │ -224 protected: │ │ │ │ │ -_2_2_5 P& _d_a_t_a__; │ │ │ │ │ -226 }; │ │ │ │ │ -227 │ │ │ │ │ -228} // end namespace Dune │ │ │ │ │ -229 │ │ │ │ │ -230#endif // HAVE_MPI │ │ │ │ │ -231#endif // DUNE_COMMON_PARALLEL_MPIPACK_HH │ │ │ │ │ -_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_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ -auto getMPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:44 │ │ │ │ │ -_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:51 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_d_a_t_a__ │ │ │ │ │ -T & data_ │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_D_a_t_a_:_:_s_i_z_e │ │ │ │ │ -int size() const │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:68 │ │ │ │ │ -_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:66 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_P_a_c_k │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:36 │ │ │ │ │ -_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:151 │ │ │ │ │ -_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:123 │ │ │ │ │ -_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:116 │ │ │ │ │ -_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:193 │ │ │ │ │ -_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:157 │ │ │ │ │ -_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:44 │ │ │ │ │ -_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:62 │ │ │ │ │ -_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:99 │ │ │ │ │ -_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:85 │ │ │ │ │ -_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:190 │ │ │ │ │ -_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:164 │ │ │ │ │ -_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:177 │ │ │ │ │ -_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:145 │ │ │ │ │ -_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:171 │ │ │ │ │ -_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:130 │ │ │ │ │ -_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:184 │ │ │ │ │ -_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:137 │ │ │ │ │ -_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:217 │ │ │ │ │ -_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:203 │ │ │ │ │ -_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: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_ _>_ _>_:_:_p_t_r │ │ │ │ │ -void * ptr() │ │ │ │ │ -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_ _>_ _>_:_:_d_a_t_a__ │ │ │ │ │ -P & data_ │ │ │ │ │ -DDeeffiinniittiioonn mpipack.hh:225 │ │ │ │ │ -_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:221 │ │ │ │ │ +167 } │ │ │ │ │ +168 } │ │ │ │ │ +169 │ │ │ │ │ +170 template │ │ │ │ │ +171 static constexpr _s_i_z_e___t_y_p_e offset (const M& m) noexcept │ │ │ │ │ +172 { │ │ │ │ │ +173 if constexpr (M::extents_type::rank() == 0) │ │ │ │ │ +174 return m(); │ │ │ │ │ +175 else { │ │ │ │ │ +176 if (m.required_span_size() == 0) │ │ │ │ │ +177 return 0; │ │ │ │ │ +178 else { │ │ │ │ │ +179 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... r) { │ │ │ │ │ +180 return m((r,0)...); }, // map the index tuple (0,0...) │ │ │ │ │ +181 std::make_index_sequence{}); │ │ │ │ │ +182 } │ │ │ │ │ +183 } │ │ │ │ │ +184 } │ │ │ │ │ +185 │ │ │ │ │ +186private: │ │ │ │ │ +187 [[no_unique_address]] _e_x_t_e_n_t_s___t_y_p_e extents_; │ │ │ │ │ +188 strides_type strides_; │ │ │ │ │ +189}; │ │ │ │ │ +190 │ │ │ │ │ +191} // end namespace Dune::Std │ │ │ │ │ +192 │ │ │ │ │ +193#endif // DUNE_COMMON_STD_LAYOUT_STRIDE_HH │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_f_w_d___l_a_y_o_u_t_s_._h_h │ │ │ │ │ +_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:124 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s │ │ │ │ │ +Multidimensional index space with dynamic and static extents. │ │ │ │ │ +DDeeffiinniittiioonn extents.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_e_x_t_e_n_t │ │ │ │ │ +constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ +Return the extent of dimension i │ │ │ │ │ +DDeeffiinniittiioonn extents.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ +A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ +to-left as the product o... │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ +A layout mapping where the strides are user-defined. │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the strides are user-defined. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping(const extents_type &e, const span< OtherIndexType, rank_ > │ │ │ │ │ +&s) noexcept │ │ │ │ │ +Construct the mapping from given extents and strides. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ +Extents extents_type │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +constexpr mapping & operator=(const mapping &) noexcept=default │ │ │ │ │ +Copy-assignment for the mapping. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +constexpr bool is_exhaustive() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:118 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping() noexcept │ │ │ │ │ +The default construction initializes the strides from layout_right. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping(const extents_type &e, const std::array< OtherIndexType, │ │ │ │ │ +rank_ > &s) noexcept │ │ │ │ │ +Construct the mapping from given extents and strides. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e │ │ │ │ │ +constexpr index_type stride(rank_type i) const noexcept │ │ │ │ │ +Get the single stride i │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:135 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ +typename extents_type::index_type index_type │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ +constexpr const extents_type & extents() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_strided() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_always_strided() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:113 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e │ │ │ │ │ +constexpr index_type required_span_size() const noexcept │ │ │ │ │ +Return the sum 1 + (E(0)-1)*S(0) + (E(1)-1)*S(1) + ... │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e_s │ │ │ │ │ +constexpr const strides_type & strides() const noexcept │ │ │ │ │ +Get the array of all strides. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:127 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping(const mapping &) noexcept=default │ │ │ │ │ +Copy constructor for the mapping. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ +typename extents_type::rank_type rank_type │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_unique() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +constexpr index_type operator()() const noexcept │ │ │ │ │ +The default offset for rank-0 tensors is 0. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:106 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename extents_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_always_unique() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:111 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ +A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpicommunication.hh File Reference │ │ │ │ +dune-common: default_accessor.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,114 +65,43 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Macros | │ │ │ │ -Functions
│ │ │ │ -
mpicommunication.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
default_accessor.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 <type_traits>
│ │ │ │
│ │ │ │

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...
class  Dune::Std::default_accessor< Element >
 A type for indexed access to elements of mdspan. 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)
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │ -

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,24 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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> │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +default_accessor.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_:_:_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_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_<_ _E_l_e_m_e_n_t_ _> │ │ │ │ │ +  A type for indexed access to elements of mdspan. _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) │ │ │ │ │ +namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │   │ │ │ │ │ -********** 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/a00062_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpicommunication.hh Source File │ │ │ │ +dune-common: default_accessor.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,588 +70,80 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpicommunication.hh
│ │ │ │ +
default_accessor.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 © 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_STD_DEFAULT_ACCESSOR_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_DEFAULT_ACCESSOR_HH
│ │ │ │
7
│ │ │ │ -
16#if HAVE_MPI
│ │ │ │ -
17
│ │ │ │ -
18#include <algorithm>
│ │ │ │ -
19#include <functional>
│ │ │ │ -
20#include <memory>
│ │ │ │ -
21
│ │ │ │ -
22#include <mpi.h>
│ │ │ │ -
23
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
8#include <type_traits>
│ │ │ │ +
9
│ │ │ │ +
│ │ │ │ +
10namespace Dune::Std {
│ │ │ │ +
11
│ │ │ │ +
22template <class Element>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
24{
│ │ │ │ +
25public:
│ │ │ │ +
26 using element_type = Element;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
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<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
│ │ │ │ -
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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
129 : Communication(MPI_COMM_SELF)
│ │ │ │ -
130 {}
│ │ │ │ -
│ │ │ │ -
131
│ │ │ │ -
│ │ │ │ -
133 int rank () const
│ │ │ │ -
134 {
│ │ │ │ -
135 return me;
│ │ │ │ -
136 }
│ │ │ │ -
│ │ │ │ -
137
│ │ │ │ -
│ │ │ │ -
139 int size () const
│ │ │ │ -
140 {
│ │ │ │ -
141 return procs;
│ │ │ │ -
142 }
│ │ │ │ -
│ │ │ │ -
143
│ │ │ │ -
145 template<class T>
│ │ │ │ -
│ │ │ │ -
146 int send(const T& data, int dest_rank, int tag) const
│ │ │ │ -
147 {
│ │ │ │ -
148 auto mpi_data = getMPIData(data);
│ │ │ │ -
149 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
│ │ │ │ -
150 dest_rank, tag, communicator);
│ │ │ │ -
151 }
│ │ │ │ -
│ │ │ │ -
152
│ │ │ │ -
154 template<class T>
│ │ │ │ -
│ │ │ │ -
155 MPIFuture<T> isend(T&& data, int dest_rank, int tag) const
│ │ │ │ -
156 {
│ │ │ │ -
157 MPIFuture<T> future(std::forward<T>(data));
│ │ │ │ -
158 auto mpidata = future.get_mpidata();
│ │ │ │ -
159 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(),
│ │ │ │ -
160 dest_rank, tag, communicator, &future.req_);
│ │ │ │ -
161 return future;
│ │ │ │ -
162 }
│ │ │ │ -
│ │ │ │ -
163
│ │ │ │ -
165 template<class T>
│ │ │ │ -
│ │ │ │ -
166 T recv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
│ │ │ │ -
167 {
│ │ │ │ -
168 T lvalue_data(std::forward<T>(data));
│ │ │ │ -
169 auto mpi_data = getMPIData(lvalue_data);
│ │ │ │ -
170 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
│ │ │ │ -
171 source_rank, tag, communicator, status);
│ │ │ │ -
172 return lvalue_data;
│ │ │ │ -
173 }
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
176 template<class T>
│ │ │ │ -
│ │ │ │ -
177 MPIFuture<T> irecv(T&& data, int source_rank, int tag) const
│ │ │ │ -
178 {
│ │ │ │ -
179 MPIFuture<T> future(std::forward<T>(data));
│ │ │ │ -
180 auto mpidata = future.get_mpidata();
│ │ │ │ -
181 if (mpidata.size() == 0)
│ │ │ │ -
182 DUNE_THROW(ParallelError, "Size if irecv data object is zero. Reserve sufficient size for the whole message");
│ │ │ │ -
183 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(),
│ │ │ │ -
184 source_rank, tag, communicator, &future.req_);
│ │ │ │ -
185 return future;
│ │ │ │ -
186 }
│ │ │ │ -
│ │ │ │ -
187
│ │ │ │ -
188 template<class T>
│ │ │ │ -
│ │ │ │ -
189 T rrecv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
│ │ │ │ -
190 {
│ │ │ │ -
191 MPI_Status _status;
│ │ │ │ -
192 MPI_Message _message;
│ │ │ │ -
193 T lvalue_data(std::forward<T>(data));
│ │ │ │ -
194 auto mpi_data = getMPIData(lvalue_data);
│ │ │ │ -
195 static_assert(!mpi_data.static_size, "rrecv work only for non-static-sized types.");
│ │ │ │ -
196 if(status == MPI_STATUS_IGNORE)
│ │ │ │ -
197 status = &_status;
│ │ │ │ -
198 MPI_Mprobe(source_rank, tag, communicator, &_message, status);
│ │ │ │ -
199 int size;
│ │ │ │ -
200 MPI_Get_count(status, mpi_data.type(), &size);
│ │ │ │ -
201 mpi_data.resize(size);
│ │ │ │ -
202 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message, status);
│ │ │ │ -
203 return lvalue_data;
│ │ │ │ -
204 }
│ │ │ │ -
│ │ │ │ -
205
│ │ │ │ -
207 template<typename T>
│ │ │ │ -
│ │ │ │ -
208 T sum (const T& in) const
│ │ │ │ -
209 {
│ │ │ │ -
210 T out;
│ │ │ │ -
211 allreduce<std::plus<T> >(&in,&out,1);
│ │ │ │ -
212 return out;
│ │ │ │ -
213 }
│ │ │ │ -
│ │ │ │ -
214
│ │ │ │ -
216 template<typename T>
│ │ │ │ -
│ │ │ │ -
217 int sum (T* inout, int len) const
│ │ │ │ -
218 {
│ │ │ │ -
219 return allreduce<std::plus<T> >(inout,len);
│ │ │ │ -
220 }
│ │ │ │ -
│ │ │ │ -
221
│ │ │ │ -
223 template<typename T>
│ │ │ │ -
│ │ │ │ -
224 T prod (const T& in) const
│ │ │ │ -
225 {
│ │ │ │ -
226 T out;
│ │ │ │ -
227 allreduce<std::multiplies<T> >(&in,&out,1);
│ │ │ │ -
228 return out;
│ │ │ │ -
229 }
│ │ │ │ -
│ │ │ │ -
230
│ │ │ │ -
232 template<typename T>
│ │ │ │ -
│ │ │ │ -
233 int prod (T* inout, int len) const
│ │ │ │ -
234 {
│ │ │ │ -
235 return allreduce<std::multiplies<T> >(inout,len);
│ │ │ │ -
236 }
│ │ │ │ -
│ │ │ │ -
237
│ │ │ │ -
239 template<typename T>
│ │ │ │ -
│ │ │ │ -
240 T min (const T& in) const
│ │ │ │ -
241 {
│ │ │ │ -
242 T out;
│ │ │ │ -
243 allreduce<Min<T> >(&in,&out,1);
│ │ │ │ -
244 return out;
│ │ │ │ -
245 }
│ │ │ │ -
│ │ │ │ -
246
│ │ │ │ -
248 template<typename T>
│ │ │ │ -
│ │ │ │ -
249 int min (T* inout, int len) const
│ │ │ │ -
250 {
│ │ │ │ -
251 return allreduce<Min<T> >(inout,len);
│ │ │ │ -
252 }
│ │ │ │ -
│ │ │ │ -
253
│ │ │ │ -
254
│ │ │ │ -
256 template<typename T>
│ │ │ │ -
│ │ │ │ -
257 T max (const T& in) const
│ │ │ │ -
258 {
│ │ │ │ -
259 T out;
│ │ │ │ -
260 allreduce<Max<T> >(&in,&out,1);
│ │ │ │ -
261 return out;
│ │ │ │ -
262 }
│ │ │ │ -
│ │ │ │ -
263
│ │ │ │ -
265 template<typename T>
│ │ │ │ -
│ │ │ │ -
266 int max (T* inout, int len) const
│ │ │ │ -
267 {
│ │ │ │ -
268 return allreduce<Max<T> >(inout,len);
│ │ │ │ -
269 }
│ │ │ │ -
│ │ │ │ -
270
│ │ │ │ -
│ │ │ │ -
272 int barrier () const
│ │ │ │ -
273 {
│ │ │ │ -
274 return MPI_Barrier(communicator);
│ │ │ │ -
275 }
│ │ │ │ -
│ │ │ │ -
276
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
279 {
│ │ │ │ -
280 MPIFuture<void> future(true); // make a valid MPIFuture<void>
│ │ │ │ -
281 MPI_Ibarrier(communicator, &future.req_);
│ │ │ │ -
282 return future;
│ │ │ │ -
283 }
│ │ │ │ -
│ │ │ │ -
284
│ │ │ │ -
285
│ │ │ │ -
287 template<typename T>
│ │ │ │ -
│ │ │ │ -
288 int broadcast (T* inout, int len, int root) const
│ │ │ │ -
289 {
│ │ │ │ -
290 return MPI_Bcast(inout,len,MPITraits<T>::getType(),root,communicator);
│ │ │ │ -
291 }
│ │ │ │ -
│ │ │ │ -
292
│ │ │ │ -
294 template<class T>
│ │ │ │ -
│ │ │ │ -
295 MPIFuture<T> ibroadcast(T&& data, int root) const{
│ │ │ │ -
296 MPIFuture<T> future(std::forward<T>(data));
│ │ │ │ -
297 auto mpidata = future.get_mpidata();
│ │ │ │ -
298 MPI_Ibcast(mpidata.ptr(),
│ │ │ │ -
299 mpidata.size(),
│ │ │ │ -
300 mpidata.type(),
│ │ │ │ -
301 root,
│ │ │ │ -
302 communicator,
│ │ │ │ -
303 &future.req_);
│ │ │ │ -
304 return future;
│ │ │ │ -
305 }
│ │ │ │ -
│ │ │ │ -
306
│ │ │ │ -
309 template<typename T>
│ │ │ │ -
│ │ │ │ -
310 int gather (const T* in, T* out, int len, int root) const
│ │ │ │ -
311 {
│ │ │ │ -
312 return MPI_Gather(const_cast<T*>(in),len,MPITraits<T>::getType(),
│ │ │ │ -
313 out,len,MPITraits<T>::getType(),
│ │ │ │ -
314 root,communicator);
│ │ │ │ -
315 }
│ │ │ │ -
│ │ │ │ -
316
│ │ │ │ -
318 template<class TIN, class TOUT = std::vector<TIN>>
│ │ │ │ -
│ │ │ │ -
319 MPIFuture<TOUT, TIN> igather(TIN&& data_in, TOUT&& data_out, int root) const{
│ │ │ │ -
320 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ -
321 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ -
322 auto mpidata_out = future.get_mpidata();
│ │ │ │ -
323 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size());
│ │ │ │ -
324 int outlen = (me==root) * mpidata_in.size();
│ │ │ │ -
325 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
│ │ │ │ -
326 mpidata_out.ptr(), outlen, mpidata_out.type(),
│ │ │ │ -
327 root, communicator, &future.req_);
│ │ │ │ -
328 return future;
│ │ │ │ -
329 }
│ │ │ │ -
│ │ │ │ -
330
│ │ │ │ -
332 template<typename T>
│ │ │ │ -
│ │ │ │ -
333 int gatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ, int root) const
│ │ │ │ -
334 {
│ │ │ │ -
335 return MPI_Gatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
│ │ │ │ -
336 out,recvDataLen,displ,MPITraits<T>::getType(),
│ │ │ │ -
337 root,communicator);
│ │ │ │ -
338 }
│ │ │ │ -
│ │ │ │ -
339
│ │ │ │ -
342 template<typename T>
│ │ │ │ -
│ │ │ │ -
343 int scatter (const T* sendData, T* recvData, int len, int root) const
│ │ │ │ -
344 {
│ │ │ │ -
345 return MPI_Scatter(const_cast<T*>(sendData),len,MPITraits<T>::getType(),
│ │ │ │ -
346 recvData,len,MPITraits<T>::getType(),
│ │ │ │ -
347 root,communicator);
│ │ │ │ -
348 }
│ │ │ │ -
│ │ │ │ -
349
│ │ │ │ -
351 template<class TIN, class TOUT = TIN>
│ │ │ │ -
│ │ │ │ -
352 MPIFuture<TOUT, TIN> iscatter(TIN&& data_in, TOUT&& data_out, int root) const
│ │ │ │ -
353 {
│ │ │ │ -
354 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ -
355 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ -
356 auto mpidata_out = future.get_mpidata();
│ │ │ │ -
357 int inlen = (me==root) * mpidata_in.size()/procs;
│ │ │ │ -
358 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(),
│ │ │ │ -
359 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(),
│ │ │ │ -
360 root, communicator, &future.req_);
│ │ │ │ -
361 return future;
│ │ │ │ -
362 }
│ │ │ │ -
│ │ │ │ -
363
│ │ │ │ -
365 template<typename T>
│ │ │ │ -
│ │ │ │ -
366 int scatterv (const T* sendData, int* sendDataLen, int* displ, T* recvData, int recvDataLen, int root) const
│ │ │ │ -
367 {
│ │ │ │ -
368 return MPI_Scatterv(const_cast<T*>(sendData),sendDataLen,displ,MPITraits<T>::getType(),
│ │ │ │ -
369 recvData,recvDataLen,MPITraits<T>::getType(),
│ │ │ │ -
370 root,communicator);
│ │ │ │ -
371 }
│ │ │ │ -
│ │ │ │ -
372
│ │ │ │ -
373
│ │ │ │ -
│ │ │ │ -
374 operator MPI_Comm () const
│ │ │ │ -
375 {
│ │ │ │ -
376 return communicator;
│ │ │ │ -
377 }
│ │ │ │ -
│ │ │ │ -
378
│ │ │ │ -
380 template<typename T, typename T1>
│ │ │ │ -
│ │ │ │ -
381 int allgather(const T* sbuf, int count, T1* rbuf) const
│ │ │ │ -
382 {
│ │ │ │ -
383 return MPI_Allgather(const_cast<T*>(sbuf), count, MPITraits<T>::getType(),
│ │ │ │ -
384 rbuf, count, MPITraits<T1>::getType(),
│ │ │ │ -
385 communicator);
│ │ │ │ -
386 }
│ │ │ │ -
│ │ │ │ -
387
│ │ │ │ -
389 template<class TIN, class TOUT = TIN>
│ │ │ │ -
│ │ │ │ -
390 MPIFuture<TOUT, TIN> iallgather(TIN&& data_in, TOUT&& data_out) const
│ │ │ │ -
391 {
│ │ │ │ -
392 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ -
393 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ -
394 auto mpidata_out = future.get_mpidata();
│ │ │ │ -
395 assert(mpidata_in.size()*procs <= mpidata_out.size());
│ │ │ │ -
396 int outlen = mpidata_in.size();
│ │ │ │ -
397 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
│ │ │ │ -
398 mpidata_out.ptr(), outlen, mpidata_out.type(),
│ │ │ │ -
399 communicator, &future.req_);
│ │ │ │ -
400 return future;
│ │ │ │ -
401 }
│ │ │ │ -
│ │ │ │ -
402
│ │ │ │ -
404 template<typename T>
│ │ │ │ -
│ │ │ │ -
405 int allgatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ) const
│ │ │ │ -
406 {
│ │ │ │ -
407 return MPI_Allgatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
│ │ │ │ -
408 out,recvDataLen,displ,MPITraits<T>::getType(),
│ │ │ │ -
409 communicator);
│ │ │ │ -
410 }
│ │ │ │ -
│ │ │ │ -
411
│ │ │ │ -
413 template<typename BinaryFunction, typename Type>
│ │ │ │ -
│ │ │ │ -
414 int allreduce(Type* inout, int len) const
│ │ │ │ -
415 {
│ │ │ │ -
416 Type* out = new Type[len];
│ │ │ │ -
417 int ret = allreduce<BinaryFunction>(inout,out,len);
│ │ │ │ -
418 std::copy(out, out+len, inout);
│ │ │ │ -
419 delete[] out;
│ │ │ │ -
420 return ret;
│ │ │ │ -
421 }
│ │ │ │ -
│ │ │ │ -
422
│ │ │ │ -
423 template<typename BinaryFunction, typename Type>
│ │ │ │ -
│ │ │ │ -
424 Type allreduce(Type&& in) const{
│ │ │ │ -
425 Type lvalue_data = std::forward<Type>(in);
│ │ │ │ -
426 auto data = getMPIData(lvalue_data);
│ │ │ │ -
427 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(),
│ │ │ │ - │ │ │ │ -
429 communicator);
│ │ │ │ -
430 return lvalue_data;
│ │ │ │ -
431 }
│ │ │ │ -
│ │ │ │ -
432
│ │ │ │ -
434 template<class BinaryFunction, class TIN, class TOUT = TIN>
│ │ │ │ -
│ │ │ │ -
435 MPIFuture<TOUT, TIN> iallreduce(TIN&& data_in, TOUT&& data_out) const {
│ │ │ │ -
436 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
│ │ │ │ -
437 auto mpidata_in = future.get_send_mpidata();
│ │ │ │ -
438 auto mpidata_out = future.get_mpidata();
│ │ │ │ -
439 assert(mpidata_out.size() == mpidata_in.size());
│ │ │ │ -
440 assert(mpidata_out.type() == mpidata_in.type());
│ │ │ │ -
441 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(),
│ │ │ │ -
442 mpidata_out.size(), mpidata_out.type(),
│ │ │ │ - │ │ │ │ -
444 communicator, &future.req_);
│ │ │ │ -
445 return future;
│ │ │ │ -
446 }
│ │ │ │ -
│ │ │ │ -
447
│ │ │ │ -
449 template<class BinaryFunction, class T>
│ │ │ │ -
│ │ │ │ -
450 MPIFuture<T> iallreduce(T&& data) const{
│ │ │ │ -
451 MPIFuture<T> future(std::forward<T>(data));
│ │ │ │ -
452 auto mpidata = future.get_mpidata();
│ │ │ │ -
453 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(),
│ │ │ │ -
454 mpidata.size(), mpidata.type(),
│ │ │ │ - │ │ │ │ -
456 communicator, &future.req_);
│ │ │ │ -
457 return future;
│ │ │ │ -
458 }
│ │ │ │ -
│ │ │ │ -
459
│ │ │ │ -
461 template<typename BinaryFunction, typename Type>
│ │ │ │ -
│ │ │ │ -
462 int allreduce(const Type* in, Type* out, int len) const
│ │ │ │ -
463 {
│ │ │ │ -
464 return MPI_Allreduce(const_cast<Type*>(in), out, len, MPITraits<Type>::getType(),
│ │ │ │ - │ │ │ │ -
466 }
│ │ │ │ -
│ │ │ │ -
467
│ │ │ │ -
468 private:
│ │ │ │ -
469 MPI_Comm communicator;
│ │ │ │ -
470 int me;
│ │ │ │ -
471 int procs;
│ │ │ │ -
472 };
│ │ │ │ -
│ │ │ │ -
473} // namespace dune
│ │ │ │ -
474
│ │ │ │ -
475#endif // HAVE_MPI
│ │ │ │ -
476
│ │ │ │ -
477#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.
│ │ │ │ -
#define ComposeMPIOp(func, op)
Definition mpicommunication.hh:77
│ │ │ │ -
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ - │ │ │ │ -
A few common exception classes.
│ │ │ │ -
helper classes to provide unique types for standard functions
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
auto getMPIData(T &t)
Definition mpidata.hh:44
│ │ │ │ -
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:266
│ │ │ │ -
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:405
│ │ │ │ -
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:257
│ │ │ │ -
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:295
│ │ │ │ -
MPIFuture< void > ibarrier() const
Nonblocking barrier.
Definition mpicommunication.hh:278
│ │ │ │ -
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:166
│ │ │ │ -
int barrier() const
Wait until all processes have arrived at this point in the program.
Definition mpicommunication.hh:272
│ │ │ │ -
int rank() const
Return rank, is between 0 and size()-1.
Definition mpicommunication.hh:133
│ │ │ │ -
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:366
│ │ │ │ -
MPIFuture< T > isend(T &&data, int dest_rank, int tag) const
Sends the data to the dest_rank nonblocking.
Definition mpicommunication.hh:155
│ │ │ │ -
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:390
│ │ │ │ -
Type allreduce(Type &&in) const
Definition mpicommunication.hh:424
│ │ │ │ -
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:217
│ │ │ │ -
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:288
│ │ │ │ -
MPIFuture< T > iallreduce(T &&data) const
Compute something over all processes nonblocking.
Definition mpicommunication.hh:450
│ │ │ │ -
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:208
│ │ │ │ -
int allreduce(const Type *in, Type *out, int len) const
Definition mpicommunication.hh:462
│ │ │ │ -
MPIFuture< TOUT, TIN > iallreduce(TIN &&data_in, TOUT &&data_out) const
Compute something over all processes nonblocking.
Definition mpicommunication.hh:435
│ │ │ │ -
int size() const
Number of processes in set, is greater than 0.
Definition mpicommunication.hh:139
│ │ │ │ -
int gather(const T *in, T *out, int len, int root) const
Gather arrays on root task.
Definition mpicommunication.hh:310
│ │ │ │ -
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:414
│ │ │ │ -
T rrecv(T &&data, int source_rank, int tag, MPI_Status *status=MPI_STATUS_IGNORE) const
Definition mpicommunication.hh:189
│ │ │ │ -
int scatter(const T *sendData, T *recvData, int len, int root) const
Scatter array from a root to all other task.
Definition mpicommunication.hh:343
│ │ │ │ -
MPIFuture< T > irecv(T &&data, int source_rank, int tag) const
Receives the data from the source_rank nonblocking.
Definition mpicommunication.hh:177
│ │ │ │ -
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:233
│ │ │ │ -
MPIFuture< TOUT, TIN > igather(TIN &&data_in, TOUT &&data_out, int root) const
Gather arrays on root task nonblocking.
Definition mpicommunication.hh:319
│ │ │ │ -
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:240
│ │ │ │ -
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:352
│ │ │ │ -
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:333
│ │ │ │ -
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:249
│ │ │ │ -
int allgather(const T *sbuf, int count, T1 *rbuf) const
Gathers data from all tasks and distribute it to all.
Definition mpicommunication.hh:381
│ │ │ │ -
int send(const T &data, int dest_rank, int tag) const
Sends the data to the dest_rank.
Definition mpicommunication.hh:146
│ │ │ │ -
Communication(const Communication< No_Comm > &)
Converting constructor for no-communication that is interpreted as MPI_COMM_SELF.
Definition mpicommunication.hh:128
│ │ │ │ -
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:224
│ │ │ │ -
Provides a future-like object for MPI communication. It contains the object that will be received and...
Definition mpifuture.hh:93
│ │ │ │ -
auto get_send_mpidata()
Definition mpifuture.hh:177
│ │ │ │ -
auto get_mpidata()
Definition mpifuture.hh:173
│ │ │ │ +
31public:
│ │ │ │ +
32 // [mdspan.accessor.default.overview]
│ │ │ │ +
34 constexpr default_accessor () noexcept = default;
│ │ │ │ +
35
│ │ │ │ +
37 template <class OtherElement,
│ │ │ │ +
38 std::enable_if_t<std::is_convertible_v<OtherElement(*)[], Element(*)[]>, int> = 0>
│ │ │ │ +
39 constexpr default_accessor (default_accessor<OtherElement>) noexcept {}
│ │ │ │ +
40
│ │ │ │ +
│ │ │ │ +
42 constexpr reference access (data_handle_type p, std::size_t i) const noexcept
│ │ │ │ +
43 {
│ │ │ │ +
44 return p[i];
│ │ │ │ +
45 }
│ │ │ │ +
│ │ │ │ +
46
│ │ │ │ +
│ │ │ │ +
48 constexpr data_handle_type offset (data_handle_type p, std::size_t i) const noexcept
│ │ │ │ +
49 {
│ │ │ │ +
50 return p + i;
│ │ │ │ +
51 }
│ │ │ │ +
│ │ │ │ +
52};
│ │ │ │ +
│ │ │ │ +
53
│ │ │ │ +
54} // end namespace Dune::Std
│ │ │ │ +
│ │ │ │ +
55
│ │ │ │ +
56#endif // DUNE_COMMON_STD_DEFAULT_ACCESSOR_HH
│ │ │ │ +
STL namespace.
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
A type for indexed access to elements of mdspan.
Definition default_accessor.hh:24
│ │ │ │ +
element_type * data_handle_type
Definition default_accessor.hh:27
│ │ │ │ +
element_type & reference
Definition default_accessor.hh:28
│ │ │ │ +
Element element_type
Definition default_accessor.hh:26
│ │ │ │ +
constexpr default_accessor() noexcept=default
Default constructor.
│ │ │ │ +
constexpr reference access(data_handle_type p, std::size_t i) const noexcept
Return a reference to the i'th element in the data range starting at p
Definition default_accessor.hh:42
│ │ │ │ +
constexpr data_handle_type offset(data_handle_type p, std::size_t i) const noexcept
Return a data handle to the i'th element in the data range starting at p
Definition default_accessor.hh:48
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,676 +1,86 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpicommunication.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +default_accessor.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 © 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_STD_DEFAULT_ACCESSOR_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_DEFAULT_ACCESSOR_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> │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +_1_0namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +11 │ │ │ │ │ +22template │ │ │ │ │ +_2_3class _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r │ │ │ │ │ +24{ │ │ │ │ │ +25public: │ │ │ │ │ +_2_6 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ +_2_7 using _d_a_t_a___h_a_n_d_l_e___t_y_p_e = _e_l_e_m_e_n_t___t_y_p_e*; │ │ │ │ │ +_2_8 using _r_e_f_e_r_e_n_c_e = _e_l_e_m_e_n_t___t_y_p_e&; │ │ │ │ │ +_2_9 using _o_f_f_s_e_t___p_o_l_i_c_y = _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r; │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ -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 _C_o_m_m_u_n_i_c_a_t_i_o_n (const _C_o_m_m_u_n_i_c_a_t_i_o_n_<_N_o___C_o_m_m_>&) │ │ │ │ │ -129 : _C_o_m_m_u_n_i_c_a_t_i_o_n(MPI_COMM_SELF) │ │ │ │ │ -130 {} │ │ │ │ │ -131 │ │ │ │ │ -_1_3_3 int _r_a_n_k () const │ │ │ │ │ -134 { │ │ │ │ │ -135 return me; │ │ │ │ │ -136 } │ │ │ │ │ -137 │ │ │ │ │ -_1_3_9 int _s_i_z_e () const │ │ │ │ │ -140 { │ │ │ │ │ -141 return procs; │ │ │ │ │ -142 } │ │ │ │ │ -143 │ │ │ │ │ -145 template │ │ │ │ │ -_1_4_6 int _s_e_n_d(const T& data, int dest_rank, int tag) const │ │ │ │ │ -147 { │ │ │ │ │ -148 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(data); │ │ │ │ │ -149 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), │ │ │ │ │ -150 dest_rank, tag, communicator); │ │ │ │ │ -151 } │ │ │ │ │ -152 │ │ │ │ │ -154 template │ │ │ │ │ -_1_5_5 _M_P_I_F_u_t_u_r_e_<_T_> _i_s_e_n_d(T&& data, int dest_rank, int tag) const │ │ │ │ │ -156 { │ │ │ │ │ -157 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ -158 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -159 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(), │ │ │ │ │ -160 dest_rank, tag, communicator, &future.req_); │ │ │ │ │ -161 return future; │ │ │ │ │ -162 } │ │ │ │ │ -163 │ │ │ │ │ -165 template │ │ │ │ │ -_1_6_6 T _r_e_c_v(T&& data, int source_rank, int tag, MPI_Status* status = │ │ │ │ │ -MPI_STATUS_IGNORE) const │ │ │ │ │ -167 { │ │ │ │ │ -168 T lvalue_data(std::forward(data)); │ │ │ │ │ -169 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ -170 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), │ │ │ │ │ -171 source_rank, tag, communicator, status); │ │ │ │ │ -172 return lvalue_data; │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -176 template │ │ │ │ │ -_1_7_7 _M_P_I_F_u_t_u_r_e_<_T_> _i_r_e_c_v(T&& data, int source_rank, int tag) const │ │ │ │ │ -178 { │ │ │ │ │ -179 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ -180 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -181 if (mpidata.size() == 0) │ │ │ │ │ -182 _D_U_N_E___T_H_R_O_W(_P_a_r_a_l_l_e_l_E_r_r_o_r, "Size if irecv data object is zero. Reserve │ │ │ │ │ -sufficient size for the whole message"); │ │ │ │ │ -183 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(), │ │ │ │ │ -184 source_rank, tag, communicator, &future.req_); │ │ │ │ │ -185 return future; │ │ │ │ │ -186 } │ │ │ │ │ -187 │ │ │ │ │ -188 template │ │ │ │ │ -_1_8_9 T _r_r_e_c_v(T&& data, int source_rank, int tag, MPI_Status* status = │ │ │ │ │ -MPI_STATUS_IGNORE) const │ │ │ │ │ -190 { │ │ │ │ │ -191 MPI_Status _status; │ │ │ │ │ -192 MPI_Message _message; │ │ │ │ │ -193 T lvalue_data(std::forward(data)); │ │ │ │ │ -194 auto mpi_data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ -195 static_assert(!mpi_data.static_size, "rrecv work only for non-static-sized │ │ │ │ │ -types."); │ │ │ │ │ -196 if(status == MPI_STATUS_IGNORE) │ │ │ │ │ -197 status = &_status; │ │ │ │ │ -198 MPI_Mprobe(source_rank, tag, communicator, &_message, status); │ │ │ │ │ -199 int _s_i_z_e; │ │ │ │ │ -200 MPI_Get_count(status, mpi_data.type(), &_s_i_z_e); │ │ │ │ │ -201 mpi_data.resize(_s_i_z_e); │ │ │ │ │ -202 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message, │ │ │ │ │ -status); │ │ │ │ │ -203 return lvalue_data; │ │ │ │ │ -204 } │ │ │ │ │ -205 │ │ │ │ │ -207 template │ │ │ │ │ -_2_0_8 T _s_u_m (const T& in) const │ │ │ │ │ -209 { │ │ │ │ │ -210 T out; │ │ │ │ │ -211 allreduce >(&in,&out,1); │ │ │ │ │ -212 return out; │ │ │ │ │ -213 } │ │ │ │ │ -214 │ │ │ │ │ -216 template │ │ │ │ │ -_2_1_7 int _s_u_m (T* inout, int len) const │ │ │ │ │ -218 { │ │ │ │ │ -219 return allreduce >(inout,len); │ │ │ │ │ -220 } │ │ │ │ │ -221 │ │ │ │ │ -223 template │ │ │ │ │ -_2_2_4 T _p_r_o_d (const T& in) const │ │ │ │ │ -225 { │ │ │ │ │ -226 T out; │ │ │ │ │ -227 allreduce >(&in,&out,1); │ │ │ │ │ -228 return out; │ │ │ │ │ -229 } │ │ │ │ │ -230 │ │ │ │ │ -232 template │ │ │ │ │ -_2_3_3 int _p_r_o_d (T* inout, int len) const │ │ │ │ │ -234 { │ │ │ │ │ -235 return allreduce >(inout,len); │ │ │ │ │ -236 } │ │ │ │ │ -237 │ │ │ │ │ -239 template │ │ │ │ │ -_2_4_0 T _m_i_n (const T& in) const │ │ │ │ │ -241 { │ │ │ │ │ -242 T out; │ │ │ │ │ -243 allreduce >(&in,&out,1); │ │ │ │ │ -244 return out; │ │ │ │ │ -245 } │ │ │ │ │ -246 │ │ │ │ │ -248 template │ │ │ │ │ -_2_4_9 int _m_i_n (T* inout, int len) const │ │ │ │ │ -250 { │ │ │ │ │ -251 return allreduce >(inout,len); │ │ │ │ │ -252 } │ │ │ │ │ -253 │ │ │ │ │ -254 │ │ │ │ │ -256 template │ │ │ │ │ -_2_5_7 T _m_a_x (const T& in) const │ │ │ │ │ -258 { │ │ │ │ │ -259 T out; │ │ │ │ │ -260 allreduce >(&in,&out,1); │ │ │ │ │ -261 return out; │ │ │ │ │ -262 } │ │ │ │ │ -263 │ │ │ │ │ -265 template │ │ │ │ │ -_2_6_6 int _m_a_x (T* inout, int len) const │ │ │ │ │ -267 { │ │ │ │ │ -268 return allreduce >(inout,len); │ │ │ │ │ -269 } │ │ │ │ │ -270 │ │ │ │ │ -_2_7_2 int _b_a_r_r_i_e_r () const │ │ │ │ │ -273 { │ │ │ │ │ -274 return MPI_Barrier(communicator); │ │ │ │ │ -275 } │ │ │ │ │ -276 │ │ │ │ │ -_2_7_8 _M_P_I_F_u_t_u_r_e_<_v_o_i_d_> _i_b_a_r_r_i_e_r () const │ │ │ │ │ -279 { │ │ │ │ │ -280 _M_P_I_F_u_t_u_r_e_<_v_o_i_d_> future(true); // make a valid MPIFuture │ │ │ │ │ -281 MPI_Ibarrier(communicator, &future.req_); │ │ │ │ │ -282 return future; │ │ │ │ │ -283 } │ │ │ │ │ -284 │ │ │ │ │ -285 │ │ │ │ │ -287 template │ │ │ │ │ -_2_8_8 int _b_r_o_a_d_c_a_s_t (T* inout, int len, int root) const │ │ │ │ │ -289 { │ │ │ │ │ -290 return MPI_Bcast(inout,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(),root,communicator); │ │ │ │ │ -291 } │ │ │ │ │ -292 │ │ │ │ │ -294 template │ │ │ │ │ -_2_9_5 _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{ │ │ │ │ │ -296 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ -297 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -298 MPI_Ibcast(mpidata.ptr(), │ │ │ │ │ -299 mpidata.size(), │ │ │ │ │ -300 mpidata.type(), │ │ │ │ │ -301 root, │ │ │ │ │ -302 communicator, │ │ │ │ │ -303 &future.req_); │ │ │ │ │ -304 return future; │ │ │ │ │ -305 } │ │ │ │ │ -306 │ │ │ │ │ -309 template │ │ │ │ │ -_3_1_0 int _g_a_t_h_e_r (const T* in, T* out, int len, int root) const │ │ │ │ │ -311 { │ │ │ │ │ -312 return MPI_Gather(const_cast(in),len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -313 out,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -314 root,communicator); │ │ │ │ │ -315 } │ │ │ │ │ -316 │ │ │ │ │ -318 template> │ │ │ │ │ -_3_1_9 _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{ │ │ │ │ │ -320 _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)); │ │ │ │ │ -321 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -322 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -323 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size()); │ │ │ │ │ -324 int outlen = (me==root) * mpidata_in.size(); │ │ │ │ │ -325 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(), │ │ │ │ │ -326 mpidata_out.ptr(), outlen, mpidata_out.type(), │ │ │ │ │ -327 root, communicator, &future.req_); │ │ │ │ │ -328 return future; │ │ │ │ │ -329 } │ │ │ │ │ -330 │ │ │ │ │ -332 template │ │ │ │ │ -_3_3_3 int _g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, int* recvDataLen, int* │ │ │ │ │ -displ, int root) const │ │ │ │ │ -334 { │ │ │ │ │ -335 return MPI_Gatherv(const_cast(in),sendDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -336 out,recvDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -337 root,communicator); │ │ │ │ │ -338 } │ │ │ │ │ -339 │ │ │ │ │ -342 template │ │ │ │ │ -_3_4_3 int _s_c_a_t_t_e_r (const T* sendData, T* recvData, int len, int root) const │ │ │ │ │ -344 { │ │ │ │ │ -345 return MPI_Scatter(const_cast(sendData),len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -346 recvData,len,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -347 root,communicator); │ │ │ │ │ -348 } │ │ │ │ │ -349 │ │ │ │ │ -351 template │ │ │ │ │ -_3_5_2 _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 │ │ │ │ │ -353 { │ │ │ │ │ -354 _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)); │ │ │ │ │ -355 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -356 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -357 int inlen = (me==root) * mpidata_in.size()/procs; │ │ │ │ │ -358 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(), │ │ │ │ │ -359 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(), │ │ │ │ │ -360 root, communicator, &future.req_); │ │ │ │ │ -361 return future; │ │ │ │ │ -362 } │ │ │ │ │ -363 │ │ │ │ │ -365 template │ │ │ │ │ -_3_6_6 int _s_c_a_t_t_e_r_v (const T* sendData, int* sendDataLen, int* displ, T* recvData, │ │ │ │ │ -int recvDataLen, int root) const │ │ │ │ │ -367 { │ │ │ │ │ -368 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(), │ │ │ │ │ -369 recvData,recvDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -370 root,communicator); │ │ │ │ │ -371 } │ │ │ │ │ -372 │ │ │ │ │ -373 │ │ │ │ │ -_3_7_4 operator MPI_Comm () const │ │ │ │ │ -375 { │ │ │ │ │ -376 return communicator; │ │ │ │ │ -377 } │ │ │ │ │ -378 │ │ │ │ │ -380 template │ │ │ │ │ -_3_8_1 int _a_l_l_g_a_t_h_e_r(const T* sbuf, int count, T1* rbuf) const │ │ │ │ │ -382 { │ │ │ │ │ -383 return MPI_Allgather(const_cast(sbuf), count, _M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -384 rbuf, count, _M_P_I_T_r_a_i_t_s_<_T_1_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -385 communicator); │ │ │ │ │ -386 } │ │ │ │ │ -387 │ │ │ │ │ -389 template │ │ │ │ │ -_3_9_0 _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 │ │ │ │ │ -391 { │ │ │ │ │ -392 _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)); │ │ │ │ │ -393 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -394 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -395 assert(mpidata_in.size()*procs <= mpidata_out.size()); │ │ │ │ │ -396 int outlen = mpidata_in.size(); │ │ │ │ │ -397 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(), │ │ │ │ │ -398 mpidata_out.ptr(), outlen, mpidata_out.type(), │ │ │ │ │ -399 communicator, &future.req_); │ │ │ │ │ -400 return future; │ │ │ │ │ -401 } │ │ │ │ │ -402 │ │ │ │ │ -404 template │ │ │ │ │ -_4_0_5 int _a_l_l_g_a_t_h_e_r_v (const T* in, int sendDataLen, T* out, int* recvDataLen, │ │ │ │ │ -int* displ) const │ │ │ │ │ -406 { │ │ │ │ │ -407 return MPI_Allgatherv(const_cast(in),sendDataLen,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e │ │ │ │ │ -(), │ │ │ │ │ -408 out,recvDataLen,displ,_M_P_I_T_r_a_i_t_s_<_T_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -409 communicator); │ │ │ │ │ -410 } │ │ │ │ │ -411 │ │ │ │ │ -413 template │ │ │ │ │ -_4_1_4 int _a_l_l_r_e_d_u_c_e(Type* inout, int len) const │ │ │ │ │ -415 { │ │ │ │ │ -416 Type* out = new Type[len]; │ │ │ │ │ -417 int ret = allreduce(inout,out,len); │ │ │ │ │ -418 std::copy(out, out+len, inout); │ │ │ │ │ -419 delete[] out; │ │ │ │ │ -420 return ret; │ │ │ │ │ -421 } │ │ │ │ │ -422 │ │ │ │ │ -423 template │ │ │ │ │ -_4_2_4 Type _a_l_l_r_e_d_u_c_e(Type&& in) const{ │ │ │ │ │ -425 Type lvalue_data = std::forward(in); │ │ │ │ │ -426 auto data = _g_e_t_M_P_I_D_a_t_a(lvalue_data); │ │ │ │ │ -427 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(), │ │ │ │ │ -428 (_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()), │ │ │ │ │ -429 communicator); │ │ │ │ │ -430 return lvalue_data; │ │ │ │ │ -431 } │ │ │ │ │ -432 │ │ │ │ │ -434 template │ │ │ │ │ -_4_3_5 _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 { │ │ │ │ │ -436 _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)); │ │ │ │ │ -437 auto mpidata_in = future._g_e_t___s_e_n_d___m_p_i_d_a_t_a(); │ │ │ │ │ -438 auto mpidata_out = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -439 assert(mpidata_out.size() == mpidata_in.size()); │ │ │ │ │ -440 assert(mpidata_out.type() == mpidata_in.type()); │ │ │ │ │ -441 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(), │ │ │ │ │ -442 mpidata_out.size(), mpidata_out.type(), │ │ │ │ │ -443 (_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()), │ │ │ │ │ -444 communicator, &future.req_); │ │ │ │ │ -445 return future; │ │ │ │ │ -446 } │ │ │ │ │ -447 │ │ │ │ │ -449 template │ │ │ │ │ -_4_5_0 _M_P_I_F_u_t_u_r_e_<_T_> _i_a_l_l_r_e_d_u_c_e(T&& data) const{ │ │ │ │ │ -451 _M_P_I_F_u_t_u_r_e_<_T_> future(std::forward(data)); │ │ │ │ │ -452 auto mpidata = future._g_e_t___m_p_i_d_a_t_a(); │ │ │ │ │ -453 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(), │ │ │ │ │ -454 mpidata.size(), mpidata.type(), │ │ │ │ │ -455 (_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()), │ │ │ │ │ -456 communicator, &future.req_); │ │ │ │ │ -457 return future; │ │ │ │ │ -458 } │ │ │ │ │ -459 │ │ │ │ │ -461 template │ │ │ │ │ -_4_6_2 int _a_l_l_r_e_d_u_c_e(const Type* in, Type* out, int len) const │ │ │ │ │ -463 { │ │ │ │ │ -464 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(), │ │ │ │ │ -465 (_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); │ │ │ │ │ -466 } │ │ │ │ │ -467 │ │ │ │ │ -468 private: │ │ │ │ │ -469 MPI_Comm communicator; │ │ │ │ │ -470 int me; │ │ │ │ │ -471 int procs; │ │ │ │ │ -472 }; │ │ │ │ │ -473} // namespace dune │ │ │ │ │ -474 │ │ │ │ │ -475#endif // HAVE_MPI │ │ │ │ │ -476 │ │ │ │ │ -477#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. │ │ │ │ │ -_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 │ │ │ │ │ -_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 │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_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 │ │ │ │ │ -_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_:_:_g_e_t_M_P_I_D_a_t_a │ │ │ │ │ -auto getMPIData(T &t) │ │ │ │ │ -DDeeffiinniittiioonn mpidata.hh:44 │ │ │ │ │ -_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:266 │ │ │ │ │ -_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:405 │ │ │ │ │ -_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:257 │ │ │ │ │ -_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:295 │ │ │ │ │ -_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:278 │ │ │ │ │ -_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:166 │ │ │ │ │ -_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:272 │ │ │ │ │ -_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:133 │ │ │ │ │ -_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:366 │ │ │ │ │ -_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< T > isend(T &&data, int dest_rank, int tag) const │ │ │ │ │ -Sends the data to the dest_rank nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:155 │ │ │ │ │ -_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:390 │ │ │ │ │ -_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:424 │ │ │ │ │ -_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:217 │ │ │ │ │ -_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: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_a_l_l_r_e_d_u_c_e │ │ │ │ │ -MPIFuture< T > iallreduce(T &&data) const │ │ │ │ │ -Compute something over all processes nonblocking. │ │ │ │ │ -DDeeffiinniittiioonn mpicommunication.hh:450 │ │ │ │ │ -_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:208 │ │ │ │ │ -_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:462 │ │ │ │ │ -_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:435 │ │ │ │ │ -_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:139 │ │ │ │ │ -_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:310 │ │ │ │ │ -_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:414 │ │ │ │ │ -_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:189 │ │ │ │ │ -_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:343 │ │ │ │ │ -_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:177 │ │ │ │ │ -_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: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_ _>_:_:_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:319 │ │ │ │ │ -_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:240 │ │ │ │ │ -_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:352 │ │ │ │ │ -_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:333 │ │ │ │ │ -_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:249 │ │ │ │ │ -_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:381 │ │ │ │ │ -_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:146 │ │ │ │ │ -_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 Communication< No_Comm > &) │ │ │ │ │ -Converting constructor for no-communication that is interpreted as │ │ │ │ │ -MPI_COMM_SELF. │ │ │ │ │ -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_ _>_:_:_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:224 │ │ │ │ │ -_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:93 │ │ │ │ │ -_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:177 │ │ │ │ │ -_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:173 │ │ │ │ │ +31public: │ │ │ │ │ +32 // [mdspan.accessor.default.overview] │ │ │ │ │ +_3_4 constexpr _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r () noexcept = default; │ │ │ │ │ +35 │ │ │ │ │ +37 template , │ │ │ │ │ +int> = 0> │ │ │ │ │ +_3_9 constexpr _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r (_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r) noexcept {} │ │ │ │ │ +40 │ │ │ │ │ +_4_2 constexpr _r_e_f_e_r_e_n_c_e _a_c_c_e_s_s (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, std::size_t i) const │ │ │ │ │ +noexcept │ │ │ │ │ +43 { │ │ │ │ │ +44 return p[i]; │ │ │ │ │ +45 } │ │ │ │ │ +46 │ │ │ │ │ +_4_8 constexpr _d_a_t_a___h_a_n_d_l_e___t_y_p_e _o_f_f_s_e_t (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, std::size_t i) const │ │ │ │ │ +noexcept │ │ │ │ │ +49 { │ │ │ │ │ +50 return p + i; │ │ │ │ │ +51 } │ │ │ │ │ +52}; │ │ │ │ │ +53 │ │ │ │ │ +54} // end namespace Dune::Std │ │ │ │ │ +55 │ │ │ │ │ +56#endif // DUNE_COMMON_STD_DEFAULT_ACCESSOR_HH │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r │ │ │ │ │ +A type for indexed access to elements of mdspan. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_d_a_t_a___h_a_n_d_l_e___t_y_p_e │ │ │ │ │ +element_type * data_handle_type │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +element_type & reference │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ +Element element_type │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r │ │ │ │ │ +constexpr default_accessor() noexcept=default │ │ │ │ │ +Default constructor. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_a_c_c_e_s_s │ │ │ │ │ +constexpr reference access(data_handle_type p, std::size_t i) const noexcept │ │ │ │ │ +Return a reference to the i'th element in the data range starting at p │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:42 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_o_f_f_s_e_t │ │ │ │ │ +constexpr data_handle_type offset(data_handle_type p, std::size_t i) const │ │ │ │ │ +noexcept │ │ │ │ │ +Return a data handle to the i'th element in the data range starting at p │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:48 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: future.hh File Reference │ │ │ │ +dune-common: layout_left.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,49 +65,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
future.hh File Reference
│ │ │ │ +
layout_left.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <memory>
│ │ │ │ +
#include <array>
│ │ │ │ #include <type_traits>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +#include <dune/common/std/impl/fwd_layouts.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 >
class  Dune::Std::layout_left::mapping< Extents >
 A layout mapping where the leftmost extent has stride 1. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,34 +1,27 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -future.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +layout_left.hh File Reference │ │ │ │ │ +#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_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_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_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 _g_e_t_(_) is called on an │ │ │ │ │ -  invalid future. A future is valid until _g_e_t_(_) 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_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_<_ _E_x_t_e_n_t_s_ _> │ │ │ │ │ +  A layout mapping where the leftmost extent has stride 1. _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. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: future.hh Source File │ │ │ │ +dune-common: layout_left.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,256 +70,197 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
future.hh
│ │ │ │ +
layout_left.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 © 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
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_LAYOUT_LEFT_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_LAYOUT_LEFT_HH
│ │ │ │
7
│ │ │ │ -
8#include <memory>
│ │ │ │ +
8#include <array>
│ │ │ │
9#include <type_traits>
│ │ │ │
10
│ │ │ │ - │ │ │ │ -
12
│ │ │ │ -
13namespace Dune{
│ │ │ │ -
14
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
20 {};
│ │ │ │ -
│ │ │ │ + │ │ │ │ + │ │ │ │ +
13
│ │ │ │ +
14namespace Dune::Std {
│ │ │ │ +
15
│ │ │ │ +
17template <class Extents>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
19{
│ │ │ │ +
20 template <class> friend class mapping;
│ │ │ │
21
│ │ │ │ -
22 // forward declaration
│ │ │ │ -
23 template<class T>
│ │ │ │ -
24 class PseudoFuture;
│ │ │ │ -
25
│ │ │ │ -
29 template<class T>
│ │ │ │ -
│ │ │ │ -
30 class Future{
│ │ │ │ -
31 // Future interface:
│ │ │ │ -
32 class FutureBase{
│ │ │ │ -
33 public:
│ │ │ │ -
34 virtual ~FutureBase() = default;
│ │ │ │ -
35 virtual void wait() = 0;
│ │ │ │ -
36 virtual bool ready() const = 0;
│ │ │ │ -
37 virtual bool valid() const = 0;
│ │ │ │ -
38 virtual T get() = 0;
│ │ │ │ -
39 };
│ │ │ │ -
40
│ │ │ │ -
41 // model class
│ │ │ │ -
42 template<class F>
│ │ │ │ -
43 class FutureModel
│ │ │ │ -
44 : public FutureBase
│ │ │ │ -
45 {
│ │ │ │ -
46 F _future;
│ │ │ │ -
47 public:
│ │ │ │ -
48 FutureModel(F&& f)
│ │ │ │ -
49 : _future(std::forward<F>(f))
│ │ │ │ -
50 {}
│ │ │ │ -
51
│ │ │ │ -
52 virtual void wait() override
│ │ │ │ -
53 {
│ │ │ │ -
54 _future.wait();
│ │ │ │ -
55 }
│ │ │ │ -
56
│ │ │ │ -
57 virtual bool ready() const override
│ │ │ │ -
58 {
│ │ │ │ -
59 return _future.ready();
│ │ │ │ -
60 }
│ │ │ │ -
61
│ │ │ │ -
62 virtual bool valid() const override
│ │ │ │ -
63 {
│ │ │ │ -
64 return _future.valid();
│ │ │ │ -
65 }
│ │ │ │ -
66
│ │ │ │ -
67 virtual T get() override{
│ │ │ │ -
68 return (T)_future.get();
│ │ │ │ -
69 }
│ │ │ │ -
70 };
│ │ │ │ -
71
│ │ │ │ -
72 std::unique_ptr<FutureBase> _future;
│ │ │ │ -
73 public:
│ │ │ │ -
74 template<class F>
│ │ │ │ -
│ │ │ │ -
75 Future(F&& f)
│ │ │ │ -
76 : _future(std::make_unique<FutureModel<F>>(std::forward<F>(f)))
│ │ │ │ -
77 {}
│ │ │ │ -
│ │ │ │ -
78
│ │ │ │ -
79 template<class U, std::enable_if_t<std::is_same<U,T>::value && !std::is_same<T,void>::value>>
│ │ │ │ -
│ │ │ │ -
80 Future(U&& data)
│ │ │ │ -
81 : _future(std::make_unique<FutureModel<PseudoFuture<T>>>(PseudoFuture<T>(std::forward<U>(data))))
│ │ │ │ -
82 {}
│ │ │ │ -
│ │ │ │ -
83
│ │ │ │ -
84 Future() = default;
│ │ │ │ -
85
│ │ │ │ -
│ │ │ │ -
89 void wait(){
│ │ │ │ -
90 _future->wait();
│ │ │ │ -
91 }
│ │ │ │ -
│ │ │ │ -
92
│ │ │ │ -
│ │ │ │ -
97 T get() {
│ │ │ │ -
98 return _future->get();
│ │ │ │ -
99 }
│ │ │ │ +
22public:
│ │ │ │ +
23 using extents_type = Extents;
│ │ │ │ +
24 using size_type = typename extents_type::size_type;
│ │ │ │ +
25 using rank_type = typename extents_type::rank_type;
│ │ │ │ +
26 using index_type = typename extents_type::index_type;
│ │ │ │ + │ │ │ │ +
28
│ │ │ │ +
30 constexpr mapping () noexcept = default;
│ │ │ │ +
31
│ │ │ │ +
33 constexpr mapping (const mapping&) noexcept = default;
│ │ │ │ +
34
│ │ │ │ +
│ │ │ │ +
36 constexpr mapping (const extents_type& e) noexcept
│ │ │ │ +
37 : extents_(e)
│ │ │ │ +
38 {}
│ │ │ │ +
│ │ │ │ +
39
│ │ │ │ +
41 template <class OtherExtents,
│ │ │ │ +
42 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ +
43 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
44 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ +
45 #endif
│ │ │ │ +
│ │ │ │ +
46 constexpr mapping (const mapping<OtherExtents>& m) noexcept
│ │ │ │ +
47 : extents_(m.extents())
│ │ │ │ +
48 {}
│ │ │ │ +
│ │ │ │ +
49
│ │ │ │ +
51 template <class OtherExtents, class E = extents_type,
│ │ │ │ +
52 std::enable_if_t<(E::rank() <= 1), int> = 0,
│ │ │ │ +
53 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ +
54 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
55 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ +
56 #endif
│ │ │ │ +
│ │ │ │ +
57 constexpr mapping (const layout_right::mapping<OtherExtents>& m) noexcept
│ │ │ │ +
58 : extents_(m.extents())
│ │ │ │ +
59 {}
│ │ │ │ +
│ │ │ │ +
60
│ │ │ │ +
62 template <class OtherExtents,
│ │ │ │ +
63 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ +
64 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
65 explicit(extents_type::rank() > 0)
│ │ │ │ +
66 #endif
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
68 : extents_(m.extents())
│ │ │ │ +
69 {
│ │ │ │ +
70#ifndef NDEBUG
│ │ │ │ +
71 if constexpr(extents_type::rank() > 0) {
│ │ │ │ +
72 index_type prod = 1;
│ │ │ │ +
73 for (rank_type r = 0; r < extents_type::rank()-1; ++r) {
│ │ │ │ +
74 assert(m.strides(r) == prod);
│ │ │ │ +
75 prod *= m.extents().extent(r);
│ │ │ │ +
76 }
│ │ │ │ +
77 assert(m.strides(extents_type::rank()-1) == prod);
│ │ │ │ +
78 }
│ │ │ │ +
79#endif
│ │ │ │ +
80 }
│ │ │ │ +
│ │ │ │ +
81
│ │ │ │ +
83 constexpr mapping& operator= (const mapping&) noexcept = default;
│ │ │ │ +
84
│ │ │ │ +
85 constexpr const extents_type& extents () const noexcept { return extents_; }
│ │ │ │ +
86 constexpr index_type required_span_size () const noexcept { return extents_.product(); }
│ │ │ │ +
87
│ │ │ │ +
89 template <class... Indices,
│ │ │ │ +
90 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
91 std::enable_if_t<(... && std::is_convertible_v<Indices, index_type>), int> = 0,
│ │ │ │ +
92 std::enable_if_t<(... && std::is_nothrow_constructible_v<Indices, index_type>), int> = 0>
│ │ │ │ +
│ │ │ │ +
93 constexpr index_type operator() (Indices... ii) const noexcept
│ │ │ │ +
94 {
│ │ │ │ +
95 const std::array indices{index_type(std::move(ii))...};
│ │ │ │ +
96 index_type value = indices.back();
│ │ │ │ +
97 for (rank_type r = 1; r < extents_type::rank(); ++r) {
│ │ │ │ +
98 const rank_type j = extents_type::rank()-r;
│ │ │ │ +
99 value = indices[j-1] + extents_.extent(j-1) * value;
│ │ │ │ +
100 }
│ │ │ │ +
101 return value;
│ │ │ │ +
102 }
│ │ │ │
│ │ │ │ -
100
│ │ │ │ +
103
│ │ │ │
│ │ │ │ -
105 bool ready() const {
│ │ │ │ -
106 return _future->ready();
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
│ │ │ │ -
114 bool valid() const {
│ │ │ │ -
115 if(_future)
│ │ │ │ -
116 return _future->valid();
│ │ │ │ -
117 return false;
│ │ │ │ -
118 }
│ │ │ │ -
│ │ │ │ -
119 };
│ │ │ │ -
│ │ │ │ -
120
│ │ │ │ -
123 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
125 bool valid_;
│ │ │ │ -
126 T data_;
│ │ │ │ -
127 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
129 valid_(false)
│ │ │ │ -
130 {}
│ │ │ │ -
│ │ │ │ -
131
│ │ │ │ -
132 template<class U>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
134 valid_(true),
│ │ │ │ -
135 data_(std::forward<U>(u))
│ │ │ │ -
136 {}
│ │ │ │ -
│ │ │ │ -
137
│ │ │ │ -
│ │ │ │ -
138 void wait() {
│ │ │ │ -
139 if(!valid_)
│ │ │ │ -
140 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ -
141 }
│ │ │ │ +
105 constexpr index_type operator() () const noexcept
│ │ │ │ +
106 {
│ │ │ │ +
107 return 0;
│ │ │ │ +
108 }
│ │ │ │ +
│ │ │ │ +
109
│ │ │ │ +
110 static constexpr bool is_always_unique () noexcept { return true; }
│ │ │ │ +
111 static constexpr bool is_always_exhaustive () noexcept { return true; }
│ │ │ │ +
112 static constexpr bool is_always_strided () noexcept { return true; }
│ │ │ │ +
113
│ │ │ │ +
114 static constexpr bool is_unique () noexcept { return true; }
│ │ │ │ +
115 static constexpr bool is_exhaustive () noexcept { return true; }
│ │ │ │ +
116 static constexpr bool is_strided () noexcept { return true; }
│ │ │ │ +
117
│ │ │ │ +
119 template <class E = extents_type,
│ │ │ │ +
120 std::enable_if_t<(E::rank() > 0), int> = 0>
│ │ │ │ +
│ │ │ │ +
121 constexpr index_type stride (rank_type i) const noexcept
│ │ │ │ +
122 {
│ │ │ │ +
123 assert(i < extents_type::rank());
│ │ │ │ +
124 index_type prod = 1;
│ │ │ │ +
125 for (rank_type r = 0; r < i; ++r)
│ │ │ │ +
126 prod *= extents().extent(r);
│ │ │ │ +
127 return prod;
│ │ │ │ +
128 }
│ │ │ │ +
│ │ │ │ +
129
│ │ │ │ +
130 template <class OtherExtents,
│ │ │ │ +
131 std::enable_if_t<(Extents::rank() == OtherExtents::rank()), int> = 0>
│ │ │ │ +
│ │ │ │ +
132 friend constexpr bool operator== (const mapping& a, const mapping<OtherExtents>& b) noexcept
│ │ │ │ +
133 {
│ │ │ │ +
134 return a.extents_ == b.extents_;
│ │ │ │ +
135 }
│ │ │ │ +
│ │ │ │ +
136
│ │ │ │ +
137private:
│ │ │ │ +
138 [[no_unique_address]] extents_type extents_;
│ │ │ │ +
139};
│ │ │ │
│ │ │ │ +
140
│ │ │ │ +
141} // end namespace Dune::Std
│ │ │ │
142
│ │ │ │ -
│ │ │ │ -
143 bool ready() const {
│ │ │ │ -
144 if(!valid_)
│ │ │ │ -
145 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ -
146 return true;
│ │ │ │ -
147 }
│ │ │ │ -
│ │ │ │ -
148
│ │ │ │ -
│ │ │ │ -
149 T get() {
│ │ │ │ -
150 if(!valid_)
│ │ │ │ -
151 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ -
152 valid_ = false;
│ │ │ │ -
153 return std::forward<T>(data_);
│ │ │ │ -
154 }
│ │ │ │ -
│ │ │ │ -
155
│ │ │ │ -
│ │ │ │ -
156 bool valid() const {
│ │ │ │ -
157 return valid_;
│ │ │ │ -
158 }
│ │ │ │ -
│ │ │ │ -
159 };
│ │ │ │ -
│ │ │ │ -
160
│ │ │ │ -
161 template<>
│ │ │ │ -
│ │ │ │ -
162 class PseudoFuture<void>{
│ │ │ │ -
163 bool valid_;
│ │ │ │ -
164 public:
│ │ │ │ -
│ │ │ │ -
165 PseudoFuture(bool valid = false) :
│ │ │ │ -
166 valid_(valid)
│ │ │ │ -
167 {}
│ │ │ │ -
│ │ │ │ -
168
│ │ │ │ -
│ │ │ │ -
169 void wait(){
│ │ │ │ -
170 if(!valid_)
│ │ │ │ -
171 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ -
172 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
173 bool ready() const{
│ │ │ │ -
174 if(!valid_)
│ │ │ │ -
175 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ -
176 return true;
│ │ │ │ -
177 }
│ │ │ │ -
│ │ │ │ -
178
│ │ │ │ -
│ │ │ │ -
179 void get(){
│ │ │ │ -
180 if(!valid_)
│ │ │ │ -
181 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
│ │ │ │ -
182 valid_ = false;
│ │ │ │ -
183 }
│ │ │ │ -
│ │ │ │ -
184
│ │ │ │ -
│ │ │ │ -
185 bool valid() const{
│ │ │ │ -
186 return valid_;
│ │ │ │ -
187 }
│ │ │ │ -
│ │ │ │ -
188 };
│ │ │ │ -
│ │ │ │ -
189}
│ │ │ │ -
190
│ │ │ │ -
191#endif // DUNE_COMMON_PARALLEL_FUTURE_HH
│ │ │ │ -
A few common exception classes.
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ -
STL namespace.
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition integersequence.hh:22
│ │ │ │ -
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:20
│ │ │ │ -
A wrapper-class for a object which is ready immediately.
Definition future.hh:124
│ │ │ │ -
bool ready() const
Definition future.hh:143
│ │ │ │ -
T get()
Definition future.hh:149
│ │ │ │ -
PseudoFuture(U &&u)
Definition future.hh:133
│ │ │ │ -
PseudoFuture()
Definition future.hh:128
│ │ │ │ -
void wait()
Definition future.hh:138
│ │ │ │ -
bool valid() const
Definition future.hh:156
│ │ │ │ -
Type-erasure for future-like objects. A future-like object is a object satisfying the interface of Fu...
Definition future.hh:30
│ │ │ │ -
bool ready() const
Definition future.hh:105
│ │ │ │ -
void wait()
wait until the future is ready
Definition future.hh:89
│ │ │ │ -
Future(U &&data)
Definition future.hh:80
│ │ │ │ -
T get()
Waits until the future is ready and returns the resulting value.
Definition future.hh:97
│ │ │ │ -
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:114
│ │ │ │ -
Future(F &&f)
Definition future.hh:75
│ │ │ │ -
bool ready() const
Definition future.hh:173
│ │ │ │ -
bool valid() const
Definition future.hh:185
│ │ │ │ -
void get()
Definition future.hh:179
│ │ │ │ -
PseudoFuture(bool valid=false)
Definition future.hh:165
│ │ │ │ -
void wait()
Definition future.hh:169
│ │ │ │ +
143#endif // DUNE_COMMON_STD_LAYOUT_LEFT_HH
│ │ │ │ + │ │ │ │ + │ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
A layout where the leftmost extent has stride 1.
Definition fwd_layouts.hh:17
│ │ │ │ +
A layout mapping where the leftmost extent has stride 1.
Definition layout_left.hh:19
│ │ │ │ +
constexpr index_type stride(rank_type i) const noexcept
The stride is the product of the extents E(0)*E(1)*...*E(i-1)
Definition layout_left.hh:121
│ │ │ │ +
typename extents_type::index_type index_type
Definition layout_left.hh:26
│ │ │ │ +
constexpr index_type required_span_size() const noexcept
Definition layout_left.hh:86
│ │ │ │ +
constexpr mapping & operator=(const mapping &) noexcept=default
Copy-assignment for the mapping.
│ │ │ │ +
Extents extents_type
Definition layout_left.hh:23
│ │ │ │ +
static constexpr bool is_always_unique() noexcept
Definition layout_left.hh:110
│ │ │ │ +
constexpr mapping() noexcept=default
The default construction is possible for default constructible extents.
│ │ │ │ +
static constexpr bool is_strided() noexcept
Definition layout_left.hh:116
│ │ │ │ +
static constexpr bool is_always_strided() noexcept
Definition layout_left.hh:112
│ │ │ │ +
constexpr index_type operator()() const noexcept
The default offset for rank-0 tensors is 0.
Definition layout_left.hh:105
│ │ │ │ +
typename extents_type::size_type size_type
Definition layout_left.hh:24
│ │ │ │ +
static constexpr bool is_unique() noexcept
Definition layout_left.hh:114
│ │ │ │ +
constexpr mapping(const layout_right::mapping< OtherExtents > &m) noexcept
Construct the mapping from a layout_right.
Definition layout_left.hh:57
│ │ │ │ +
constexpr const extents_type & extents() const noexcept
Definition layout_left.hh:85
│ │ │ │ +
static constexpr bool is_always_exhaustive() noexcept
Definition layout_left.hh:111
│ │ │ │ +
typename extents_type::rank_type rank_type
Definition layout_left.hh:25
│ │ │ │ +
static constexpr bool is_exhaustive() noexcept
Definition layout_left.hh:115
│ │ │ │ +
A layout mapping where the rightmost extent has stride 1.
Definition layout_right.hh:19
│ │ │ │ +
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │ +
constexpr const extents_type & extents() const noexcept
Definition layout_stride.hh:85
│ │ │ │ +
constexpr const strides_type & strides() const noexcept
Get the array of all strides.
Definition layout_stride.hh:127
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,267 +1,229 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -future.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +layout_left.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 © 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 │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_LAYOUT_LEFT_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_LAYOUT_LEFT_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ +8#include │ │ │ │ │ 9#include │ │ │ │ │ 10 │ │ │ │ │ -11#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -12 │ │ │ │ │ -13namespace _D_u_n_e{ │ │ │ │ │ -14 │ │ │ │ │ -_1_9 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 │ │ │ │ │ -20 {}; │ │ │ │ │ +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_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ +13 │ │ │ │ │ +14namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +15 │ │ │ │ │ +17template │ │ │ │ │ +_1_8class _l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +19{ │ │ │ │ │ +_2_0 template friend class _m_a_p_p_i_n_g; │ │ │ │ │ 21 │ │ │ │ │ -22 // forward declaration │ │ │ │ │ -23 template │ │ │ │ │ -24 class _P_s_e_u_d_o_F_u_t_u_r_e; │ │ │ │ │ -25 │ │ │ │ │ -29 template │ │ │ │ │ -_3_0 class _F_u_t_u_r_e{ │ │ │ │ │ -31 // Future interface: │ │ │ │ │ -32 class FutureBase{ │ │ │ │ │ -33 public: │ │ │ │ │ -34 virtual ~FutureBase() = default; │ │ │ │ │ -35 virtual void wait() = 0; │ │ │ │ │ -36 virtual bool ready() const = 0; │ │ │ │ │ -37 virtual bool valid() const = 0; │ │ │ │ │ -38 virtual T _g_e_t() = 0; │ │ │ │ │ -39 }; │ │ │ │ │ -40 │ │ │ │ │ -41 // model class │ │ │ │ │ -42 template │ │ │ │ │ -43 class FutureModel │ │ │ │ │ -44 : public FutureBase │ │ │ │ │ -45 { │ │ │ │ │ -46 F _future; │ │ │ │ │ -47 public: │ │ │ │ │ -48 FutureModel(F&& f) │ │ │ │ │ -49 : _future(std::forward(f)) │ │ │ │ │ -50 {} │ │ │ │ │ -51 │ │ │ │ │ -52 virtual void wait() override │ │ │ │ │ -53 { │ │ │ │ │ -54 _future.wait(); │ │ │ │ │ -55 } │ │ │ │ │ -56 │ │ │ │ │ -57 virtual bool ready() const override │ │ │ │ │ -58 { │ │ │ │ │ -59 return _future.ready(); │ │ │ │ │ -60 } │ │ │ │ │ -61 │ │ │ │ │ -62 virtual bool valid() const override │ │ │ │ │ -63 { │ │ │ │ │ -64 return _future.valid(); │ │ │ │ │ -65 } │ │ │ │ │ -66 │ │ │ │ │ -67 virtual T _g_e_t() override{ │ │ │ │ │ -68 return (T)_future.get(); │ │ │ │ │ -69 } │ │ │ │ │ -70 }; │ │ │ │ │ -71 │ │ │ │ │ -72 std::unique_ptr _future; │ │ │ │ │ -73 public: │ │ │ │ │ -74 template │ │ │ │ │ -_7_5 _F_u_t_u_r_e(F&& f) │ │ │ │ │ -76 : _future(_s_t_d::make_unique>(_s_t_d::forward(f))) │ │ │ │ │ -77 {} │ │ │ │ │ -78 │ │ │ │ │ -79 template::value && !std:: │ │ │ │ │ -is_same::value>> │ │ │ │ │ -_8_0 _F_u_t_u_r_e(U&& data) │ │ │ │ │ -81 : _future(_s_t_d::make_unique>>(_P_s_e_u_d_o_F_u_t_u_r_e │ │ │ │ │ -(_s_t_d::forward(data)))) │ │ │ │ │ -82 {} │ │ │ │ │ -83 │ │ │ │ │ -_8_4 _F_u_t_u_r_e() = default; │ │ │ │ │ -85 │ │ │ │ │ -_8_9 void _w_a_i_t(){ │ │ │ │ │ -90 _future->wait(); │ │ │ │ │ -91 } │ │ │ │ │ -92 │ │ │ │ │ -_9_7 T _g_e_t() { │ │ │ │ │ -98 return _future->get(); │ │ │ │ │ -99 } │ │ │ │ │ -100 │ │ │ │ │ -_1_0_5 bool _r_e_a_d_y() const { │ │ │ │ │ -106 return _future->ready(); │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -_1_1_4 bool _v_a_l_i_d() const { │ │ │ │ │ -115 if(_future) │ │ │ │ │ -116 return _future->valid(); │ │ │ │ │ -117 return false; │ │ │ │ │ -118 } │ │ │ │ │ -119 }; │ │ │ │ │ -120 │ │ │ │ │ -123 template │ │ │ │ │ -_1_2_4 class _P_s_e_u_d_o_F_u_t_u_r_e{ │ │ │ │ │ -125 bool valid_; │ │ │ │ │ -126 T data_; │ │ │ │ │ -127 public: │ │ │ │ │ -_1_2_8 _P_s_e_u_d_o_F_u_t_u_r_e() : │ │ │ │ │ -129 valid_(false) │ │ │ │ │ -130 {} │ │ │ │ │ -131 │ │ │ │ │ -132 template │ │ │ │ │ -_1_3_3 _P_s_e_u_d_o_F_u_t_u_r_e(U&& u) : │ │ │ │ │ -134 valid_(true), │ │ │ │ │ -135 data_(_s_t_d::forward(u)) │ │ │ │ │ -136 {} │ │ │ │ │ -137 │ │ │ │ │ -_1_3_8 void _w_a_i_t() { │ │ │ │ │ -139 if(!valid_) │ │ │ │ │ -140 _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"); │ │ │ │ │ -141 } │ │ │ │ │ +22public: │ │ │ │ │ +_2_3 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ +_2_4 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ +_2_5 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ +_2_6 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ +_2_7 using _l_a_y_o_u_t___t_y_p_e = _l_a_y_o_u_t___l_e_f_t; │ │ │ │ │ +28 │ │ │ │ │ +_3_0 constexpr _m_a_p_p_i_n_g () noexcept = default; │ │ │ │ │ +31 │ │ │ │ │ +_3_3 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ +34 │ │ │ │ │ +_3_6 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e) noexcept │ │ │ │ │ +37 : extents_(e) │ │ │ │ │ +38 {} │ │ │ │ │ +39 │ │ │ │ │ +41 template , int> = │ │ │ │ │ +0> │ │ │ │ │ +43 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +44 explicit(!std::is_convertible_v) │ │ │ │ │ +45 #endif │ │ │ │ │ +_4_6 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ +47 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ +48 {} │ │ │ │ │ +49 │ │ │ │ │ +51 template = 0, │ │ │ │ │ +53 std::enable_if_t, int> = │ │ │ │ │ +0> │ │ │ │ │ +54 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +55 explicit(!std::is_convertible_v) │ │ │ │ │ +56 #endif │ │ │ │ │ +_5_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ +58 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ +59 {} │ │ │ │ │ +60 │ │ │ │ │ +62 template , int> = │ │ │ │ │ +0> │ │ │ │ │ +64 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +65 explicit(extents_type::rank() > 0) │ │ │ │ │ +66 #endif │ │ │ │ │ +_6_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) │ │ │ │ │ +68 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ +69 { │ │ │ │ │ +70#ifndef NDEBUG │ │ │ │ │ +71 if constexpr(extents_type::rank() > 0) { │ │ │ │ │ +72 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ +73 for (_r_a_n_k___t_y_p_e r = 0; r < extents_type::rank()-1; ++r) { │ │ │ │ │ +74 assert(m._s_t_r_i_d_e_s(r) == prod); │ │ │ │ │ +75 prod *= m._e_x_t_e_n_t_s().extent(r); │ │ │ │ │ +76 } │ │ │ │ │ +77 assert(m._s_t_r_i_d_e_s(extents_type::rank()-1) == prod); │ │ │ │ │ +78 } │ │ │ │ │ +79#endif │ │ │ │ │ +80 } │ │ │ │ │ +81 │ │ │ │ │ +_8_3 constexpr _m_a_p_p_i_n_g& _o_p_e_r_a_t_o_r_=_ (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ +84 │ │ │ │ │ +_8_5 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return extents_; } │ │ │ │ │ +_8_6 constexpr _i_n_d_e_x___t_y_p_e _r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e () const noexcept { return │ │ │ │ │ +extents_.product(); } │ │ │ │ │ +87 │ │ │ │ │ +89 template = 0, │ │ │ │ │ +91 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ +0, │ │ │ │ │ +92 std::enable_if_t<(... && std::is_nothrow_constructible_v), int> = 0> │ │ │ │ │ +_9_3 constexpr _i_n_d_e_x___t_y_p_e operator() (Indices... ii) const noexcept │ │ │ │ │ +94 { │ │ │ │ │ +95 const std::array indices{_i_n_d_e_x___t_y_p_e(std::move(ii))...}; │ │ │ │ │ +96 _i_n_d_e_x___t_y_p_e value = indices.back(); │ │ │ │ │ +97 for (_r_a_n_k___t_y_p_e r = 1; r < extents_type::rank(); ++r) { │ │ │ │ │ +98 const _r_a_n_k___t_y_p_e j = extents_type::rank()-r; │ │ │ │ │ +99 value = indices[j-1] + extents_.extent(j-1) * value; │ │ │ │ │ +100 } │ │ │ │ │ +101 return value; │ │ │ │ │ +102 } │ │ │ │ │ +103 │ │ │ │ │ +_1_0_5 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ () const noexcept │ │ │ │ │ +106 { │ │ │ │ │ +107 return 0; │ │ │ │ │ +108 } │ │ │ │ │ +109 │ │ │ │ │ +_1_1_0 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ +_1_1_1 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ +_1_1_2 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ +113 │ │ │ │ │ +_1_1_4 static constexpr bool _i_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ +_1_1_5 static constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ +_1_1_6 static constexpr bool _i_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ +117 │ │ │ │ │ +119 template 0), int> = 0> │ │ │ │ │ +_1_2_1 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e i) const noexcept │ │ │ │ │ +122 { │ │ │ │ │ +123 assert(i < extents_type::rank()); │ │ │ │ │ +124 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ +125 for (_r_a_n_k___t_y_p_e r = 0; r < i; ++r) │ │ │ │ │ +126 prod *= _e_x_t_e_n_t_s().extent(r); │ │ │ │ │ +127 return prod; │ │ │ │ │ +128 } │ │ │ │ │ +129 │ │ │ │ │ +130 template = 0> │ │ │ │ │ +_1_3_2 friend constexpr bool operator== (const _m_a_p_p_i_n_g& a, const │ │ │ │ │ +_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& b) noexcept │ │ │ │ │ +133 { │ │ │ │ │ +134 return a.extents_ == b.extents_; │ │ │ │ │ +135 } │ │ │ │ │ +136 │ │ │ │ │ +137private: │ │ │ │ │ +138 [[no_unique_address]] _e_x_t_e_n_t_s___t_y_p_e extents_; │ │ │ │ │ +139}; │ │ │ │ │ +140 │ │ │ │ │ +141} // end namespace Dune::Std │ │ │ │ │ 142 │ │ │ │ │ -_1_4_3 bool _r_e_a_d_y() const { │ │ │ │ │ -144 if(!valid_) │ │ │ │ │ -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 PseudoFuture is not valid"); │ │ │ │ │ -146 return true; │ │ │ │ │ -147 } │ │ │ │ │ -148 │ │ │ │ │ -_1_4_9 T _g_e_t() { │ │ │ │ │ -150 if(!valid_) │ │ │ │ │ -151 _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"); │ │ │ │ │ -152 valid_ = false; │ │ │ │ │ -153 return std::forward(data_); │ │ │ │ │ -154 } │ │ │ │ │ -155 │ │ │ │ │ -_1_5_6 bool _v_a_l_i_d() const { │ │ │ │ │ -157 return valid_; │ │ │ │ │ -158 } │ │ │ │ │ -159 }; │ │ │ │ │ -160 │ │ │ │ │ -161 template<> │ │ │ │ │ -_1_6_2 class _P_s_e_u_d_o_F_u_t_u_r_e{ │ │ │ │ │ -163 bool valid_; │ │ │ │ │ -164 public: │ │ │ │ │ -_1_6_5 _P_s_e_u_d_o_F_u_t_u_r_e(bool _v_a_l_i_d = false) : │ │ │ │ │ -166 valid_(_v_a_l_i_d) │ │ │ │ │ -167 {} │ │ │ │ │ -168 │ │ │ │ │ -_1_6_9 void _w_a_i_t(){ │ │ │ │ │ -170 if(!valid_) │ │ │ │ │ -171 _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"); │ │ │ │ │ -172 } │ │ │ │ │ -_1_7_3 bool _r_e_a_d_y() const{ │ │ │ │ │ -174 if(!valid_) │ │ │ │ │ -175 _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"); │ │ │ │ │ -176 return true; │ │ │ │ │ -177 } │ │ │ │ │ -178 │ │ │ │ │ -_1_7_9 void _g_e_t(){ │ │ │ │ │ -180 if(!valid_) │ │ │ │ │ -181 _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"); │ │ │ │ │ -182 valid_ = false; │ │ │ │ │ -183 } │ │ │ │ │ -184 │ │ │ │ │ -_1_8_5 bool _v_a_l_i_d() const{ │ │ │ │ │ -186 return valid_; │ │ │ │ │ -187 } │ │ │ │ │ -188 }; │ │ │ │ │ -189} │ │ │ │ │ -190 │ │ │ │ │ -191#endif // DUNE_COMMON_PARALLEL_FUTURE_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 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ -_D_u_n_e │ │ │ │ │ -Dune namespace. │ │ │ │ │ -DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ │ -constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< │ │ │ │ │ -std::size_t, pos >={}) │ │ │ │ │ -Return the entry at position pos of the given sequence. │ │ │ │ │ -DDeeffiinniittiioonn integersequence.hh:22 │ │ │ │ │ -_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:20 │ │ │ │ │ -_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:124 │ │ │ │ │ -_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:143 │ │ │ │ │ -_D_u_n_e_:_:_P_s_e_u_d_o_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ -T get() │ │ │ │ │ -DDeeffiinniittiioonn future.hh:149 │ │ │ │ │ -_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:133 │ │ │ │ │ -_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:128 │ │ │ │ │ -_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:138 │ │ │ │ │ -_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:156 │ │ │ │ │ -_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:30 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ -bool ready() const │ │ │ │ │ -DDeeffiinniittiioonn future.hh:105 │ │ │ │ │ -_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:89 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ -Future(U &&data) │ │ │ │ │ -DDeeffiinniittiioonn future.hh:80 │ │ │ │ │ -_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:97 │ │ │ │ │ -_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:114 │ │ │ │ │ -_D_u_n_e_:_:_F_u_t_u_r_e_:_:_F_u_t_u_r_e │ │ │ │ │ -Future(F &&f) │ │ │ │ │ -DDeeffiinniittiioonn future.hh:75 │ │ │ │ │ -_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:173 │ │ │ │ │ -_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:185 │ │ │ │ │ -_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:179 │ │ │ │ │ -_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:165 │ │ │ │ │ -_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:169 │ │ │ │ │ +143#endif // DUNE_COMMON_STD_LAYOUT_LEFT_HH │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_f_w_d___l_a_y_o_u_t_s_._h_h │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t │ │ │ │ │ +A layout where the leftmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the leftmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e │ │ │ │ │ +constexpr index_type stride(rank_type i) const noexcept │ │ │ │ │ +The stride is the product of the extents E(0)*E(1)*...*E(i-1) │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:121 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ +typename extents_type::index_type index_type │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e │ │ │ │ │ +constexpr index_type required_span_size() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +constexpr mapping & operator=(const mapping &) noexcept=default │ │ │ │ │ +Copy-assignment for the mapping. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ +Extents extents_type │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_always_unique() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping() noexcept=default │ │ │ │ │ +The default construction is possible for default constructible extents. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_strided() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_always_strided() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +constexpr index_type operator()() const noexcept │ │ │ │ │ +The default offset for rank-0 tensors is 0. │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename extents_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_unique() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:114 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping(const layout_right::mapping< OtherExtents > &m) noexcept │ │ │ │ │ +Construct the mapping from a layout_right. │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:57 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ +constexpr const extents_type & extents() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:111 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ +typename extents_type::rank_type rank_type │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +static constexpr bool is_exhaustive() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the rightmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the strides are user-defined. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ +constexpr const extents_type & extents() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e_s │ │ │ │ │ +constexpr const strides_type & strides() const noexcept │ │ │ │ │ +Get the array of all strides. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:127 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpicollectivecommunication.hh File Reference │ │ │ │ +dune-common: functional.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,24 +65,44 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpicollectivecommunication.hh File Reference
│ │ │ │ +
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
functional.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ +
#include <functional>
│ │ │ │ +#include <dune-common-config.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...
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,12 +1,26 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _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> │ │ │ │ │ + * _s_t_d │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +functional.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ +CCllaasssseess │ │ │ │ │ +struct   _D_u_n_e_:_:_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. │ │ │ │ │ +  │ │ │ │ │ +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/a00068_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpicollectivecommunication.hh Source File │ │ │ │ +dune-common: functional.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,27 +70,56 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpicollectivecommunication.hh
│ │ │ │ +
functional.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © 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/mpicommunication.hh> instead!"
│ │ │ │ - │ │ │ │ -
Implements an utility class that provides MPI's collective communication methods.
│ │ │ │ +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 © 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
│ │ │ │ +
7
│ │ │ │ +
8#include <functional>
│ │ │ │ +
9
│ │ │ │ +
10#include <dune-common-config.hh> // DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ +
11
│ │ │ │ +
12namespace Dune
│ │ │ │ +
13{
│ │ │ │ +
14
│ │ │ │ +
15 namespace Std
│ │ │ │ +
16 {
│ │ │ │ +
17
│ │ │ │ +
24#if DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ +
25 using std::identity;
│ │ │ │ +
26#else //DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ +
│ │ │ │ +
27 struct identity {
│ │ │ │ +
28 template<class T>
│ │ │ │ +
29 constexpr T&& operator()(T&& t ) const noexcept {return std::forward<T>(t);}
│ │ │ │ +
30 };
│ │ │ │ +
│ │ │ │ +
31#endif
│ │ │ │ +
32 } // namespace Std
│ │ │ │ +
33
│ │ │ │ +
34} // namespace Dune
│ │ │ │ +
35
│ │ │ │ +
36#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
A function object type whose operator() returns its argument unchanged.
Definition functional.hh:27
│ │ │ │ +
constexpr T && operator()(T &&t) const noexcept
Definition functional.hh:29
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,21 +1,51 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpicollectivecommunication.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// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see 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 © 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_/_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. │ │ │ │ │ +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 │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10#include // DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ +11 │ │ │ │ │ +12namespace _D_u_n_e │ │ │ │ │ +13{ │ │ │ │ │ +14 │ │ │ │ │ +15 namespace Std │ │ │ │ │ +16 { │ │ │ │ │ +17 │ │ │ │ │ +24#if DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ +25 using std::identity; │ │ │ │ │ +26#else //DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ +_2_7 struct _i_d_e_n_t_i_t_y { │ │ │ │ │ +28 template │ │ │ │ │ +_2_9 constexpr T&& _o_p_e_r_a_t_o_r_(_)(T&& t ) const noexcept {return std::forward(t);} │ │ │ │ │ +30 }; │ │ │ │ │ +31#endif │ │ │ │ │ +32 } // namespace Std │ │ │ │ │ +33 │ │ │ │ │ +34} // namespace Dune │ │ │ │ │ +35 │ │ │ │ │ +36#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ +_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:27 │ │ │ │ │ +_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:29 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpitraits.hh File Reference │ │ │ │ +dune-common: layout_right.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,51 +65,46 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
mpitraits.hh File Reference
│ │ │ │ +
layout_right.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <complex>
│ │ │ │ -#include <cstddef>
│ │ │ │ -#include <cstdint>
│ │ │ │ +
#include <array>
│ │ │ │ #include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <mpi.h>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +#include <dune/common/std/impl/fwd_layouts.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::Std::layout_right::mapping< Extents >
 A layout mapping where the rightmost extent has stride 1. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ -

Traits classes for mapping types onto MPI_Datatype.

│ │ │ │ -
Author
Markus Blatt
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,33 +1,27 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ +layout_right.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ #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_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_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_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_<_ _E_x_t_e_n_t_s_ _> │ │ │ │ │ +  A layout mapping where the rightmost extent has stride 1. _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 │ │ │ │ │ +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/a00071_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mpitraits.hh Source File │ │ │ │ +dune-common: layout_right.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,218 +70,196 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpitraits.hh
│ │ │ │ +
layout_right.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 © 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_MPITRAITS_HH
│ │ │ │ -
6#define DUNE_COMMON_PARALLEL_MPITRAITS_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_STD_LAYOUT_RIGHT_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_LAYOUT_RIGHT_HH
│ │ │ │
7
│ │ │ │ -
18#if HAVE_MPI
│ │ │ │ -
19
│ │ │ │ -
20#include <complex>
│ │ │ │ -
21#include <cstddef>
│ │ │ │ -
22#include <cstdint>
│ │ │ │ -
23#include <type_traits>
│ │ │ │ -
24#include <utility>
│ │ │ │ -
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 }
│ │ │ │ +
8#include <array>
│ │ │ │ +
9#include <type_traits>
│ │ │ │ +
10
│ │ │ │ + │ │ │ │ + │ │ │ │ +
13
│ │ │ │ +
14namespace Dune::Std {
│ │ │ │ +
15
│ │ │ │ +
17template <class Extents>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
19{
│ │ │ │ +
20 template <class> friend class mapping;
│ │ │ │ +
21
│ │ │ │ +
22public:
│ │ │ │ +
23 using extents_type = Extents;
│ │ │ │ +
24 using size_type = typename extents_type::size_type;
│ │ │ │ +
25 using rank_type = typename extents_type::rank_type;
│ │ │ │ +
26 using index_type = typename extents_type::index_type;
│ │ │ │ + │ │ │ │ +
28
│ │ │ │ +
30 constexpr mapping () noexcept = default;
│ │ │ │ +
31
│ │ │ │ +
33 constexpr mapping (const mapping&) noexcept = default;
│ │ │ │ +
34
│ │ │ │ +
│ │ │ │ +
36 constexpr mapping (const extents_type& e) noexcept
│ │ │ │ +
37 : extents_(e)
│ │ │ │ +
38 {}
│ │ │ │
│ │ │ │ -
56 static constexpr bool is_intrinsic = false;
│ │ │ │ -
57 };
│ │ │ │ +
39
│ │ │ │ +
41 template <class OtherExtents,
│ │ │ │ +
42 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ +
43 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
44 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ +
45 #endif
│ │ │ │ +
│ │ │ │ +
46 constexpr mapping (const mapping<OtherExtents>& m) noexcept
│ │ │ │ +
47 : extents_(m.extents())
│ │ │ │ +
48 {}
│ │ │ │ +
│ │ │ │ +
49
│ │ │ │ +
51 template <class OtherExtents, class E = extents_type,
│ │ │ │ +
52 std::enable_if_t<(E::rank() <= 1), int> = 0,
│ │ │ │ +
53 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ +
54 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
55 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ +
56 #endif
│ │ │ │ +
│ │ │ │ +
57 constexpr mapping (const layout_left::mapping<OtherExtents>& m) noexcept
│ │ │ │ +
58 : extents_(m.extents())
│ │ │ │ +
59 {}
│ │ │ │
│ │ │ │ -
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);
│ │ │ │ +
62 template <class OtherExtents,
│ │ │ │ +
63 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ +
64 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
65 explicit(extents_type::rank() > 0)
│ │ │ │ +
66 #endif
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
68 : extents_(m.extents())
│ │ │ │ +
69 {
│ │ │ │ +
70#ifndef NDEBUG
│ │ │ │ +
71 if constexpr(extents_type::rank() > 0) {
│ │ │ │ +
72 index_type prod = 1;
│ │ │ │ +
73 for (rank_type r = extents_type::rank()-1; r > 0; --r) {
│ │ │ │ +
74 assert(m.strides(r) == prod);
│ │ │ │ +
75 prod *= m.extents().extent(r);
│ │ │ │ +
76 }
│ │ │ │ +
77 assert(m.strides(0) == prod);
│ │ │ │ +
78 }
│ │ │ │ +
79#endif
│ │ │ │ +
80 }
│ │ │ │ +
│ │ │ │ +
81
│ │ │ │ +
83 constexpr mapping& operator= (const mapping&) noexcept = default;
│ │ │ │ +
84
│ │ │ │ +
85 constexpr const extents_type& extents () const noexcept { return extents_; }
│ │ │ │ +
86 constexpr index_type required_span_size () const noexcept { return extents_.product(); }
│ │ │ │
87
│ │ │ │ -
88
│ │ │ │ -
89#undef ComposeMPITraits
│ │ │ │ -
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;
│ │ │ │ +
89 template <class... Indices,
│ │ │ │ +
90 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
91 std::enable_if_t<(std::is_convertible_v<Indices, index_type> && ...), int> = 0,
│ │ │ │ +
92 std::enable_if_t<(std::is_nothrow_constructible_v<Indices, index_type> && ...), int> = 0>
│ │ │ │ +
│ │ │ │ +
93 constexpr index_type operator() (Indices... ii) const noexcept
│ │ │ │ +
94 {
│ │ │ │ +
95 const std::array indices{index_type(std::move(ii))...};
│ │ │ │ +
96 index_type value = indices.front();
│ │ │ │ +
97 for (rank_type j = 0; j < extents_type::rank()-1; ++j) {
│ │ │ │ +
98 value = indices[j+1] + extents_.extent(j+1) * value;
│ │ │ │ +
99 }
│ │ │ │ +
100 return value;
│ │ │ │ +
101 }
│ │ │ │ +
│ │ │ │ +
102
│ │ │ │ +
│ │ │ │ +
104 constexpr index_type operator() () const noexcept
│ │ │ │ +
105 {
│ │ │ │ +
106 return 0;
│ │ │ │ +
107 }
│ │ │ │ +
│ │ │ │ +
108
│ │ │ │ +
109 static constexpr bool is_always_unique () noexcept { return true; }
│ │ │ │ +
110 static constexpr bool is_always_exhaustive () noexcept { return true; }
│ │ │ │ +
111 static constexpr bool is_always_strided () noexcept { return true; }
│ │ │ │ +
112
│ │ │ │ +
113 static constexpr bool is_unique () noexcept { return true; }
│ │ │ │ +
114 static constexpr bool is_exhaustive () noexcept { return true; }
│ │ │ │ +
115 static constexpr bool is_strided () noexcept { return true; }
│ │ │ │ +
116
│ │ │ │ +
118 template <class E = extents_type,
│ │ │ │ +
119 std::enable_if_t<(E::rank() > 0), int> = 0>
│ │ │ │ +
│ │ │ │ +
120 constexpr index_type stride (rank_type i) const noexcept
│ │ │ │ +
121 {
│ │ │ │ +
122 assert(i < extents_type::rank());
│ │ │ │ +
123 index_type prod = 1;
│ │ │ │ +
124 for (rank_type r = i+1; r < extents_type::rank(); ++r)
│ │ │ │ +
125 prod *= extents().extent(r);
│ │ │ │ +
126 return prod;
│ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │
128
│ │ │ │ -
129 template<int k>
│ │ │ │ -
130 struct MPITraits<bigunsignedint<k> >
│ │ │ │ +
129 template <class OtherExtents>
│ │ │ │ +
│ │ │ │ +
130 friend constexpr bool operator== (const mapping& a, const mapping<OtherExtents>& b) noexcept
│ │ │ │
131 {
│ │ │ │ -
132 static MPI_Datatype datatype;
│ │ │ │ -
133 static MPI_Datatype vectortype;
│ │ │ │ +
132 return a.extents_ == b.extents_;
│ │ │ │ +
133 }
│ │ │ │ +
│ │ │ │
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 // DUNE_COMMON_PARALLEL_MPITRAITS_HH
│ │ │ │ -
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
│ │ │ │ -
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:91
│ │ │ │ +
135private:
│ │ │ │ +
136 [[no_unique_address]] extents_type extents_;
│ │ │ │ +
137};
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
139} // end namespace Dune::Std
│ │ │ │ +
140
│ │ │ │ +
141#endif // DUNE_COMMON_STD_LAYOUT_RIGHT_HH
│ │ │ │ + │ │ │ │ + │ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
A layout mapping where the leftmost extent has stride 1.
Definition layout_left.hh:19
│ │ │ │ +
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ +
A layout mapping where the rightmost extent has stride 1.
Definition layout_right.hh:19
│ │ │ │ +
constexpr const extents_type & extents() const noexcept
Definition layout_right.hh:85
│ │ │ │ +
constexpr index_type operator()() const noexcept
The default offset for rank-0 tensors is 0.
Definition layout_right.hh:104
│ │ │ │ +
constexpr mapping & operator=(const mapping &) noexcept=default
Copy-assignment for the mapping.
│ │ │ │ +
constexpr index_type required_span_size() const noexcept
Definition layout_right.hh:86
│ │ │ │ +
constexpr mapping() noexcept=default
The default construction is possible for default constructible extents.
│ │ │ │ +
typename extents_type::size_type size_type
Definition layout_right.hh:24
│ │ │ │ +
Extents extents_type
Definition layout_right.hh:23
│ │ │ │ +
static constexpr bool is_always_unique() noexcept
Definition layout_right.hh:109
│ │ │ │ +
constexpr index_type stride(rank_type i) const noexcept
The stride is the product of the extents E(n)*E(n-1)*...*E(i+1)
Definition layout_right.hh:120
│ │ │ │ +
static constexpr bool is_exhaustive() noexcept
Definition layout_right.hh:114
│ │ │ │ +
constexpr mapping(const layout_left::mapping< OtherExtents > &m) noexcept
Construct the mapping from a layout_left.
Definition layout_right.hh:57
│ │ │ │ +
static constexpr bool is_strided() noexcept
Definition layout_right.hh:115
│ │ │ │ +
typename extents_type::rank_type rank_type
Definition layout_right.hh:25
│ │ │ │ +
static constexpr bool is_always_strided() noexcept
Definition layout_right.hh:111
│ │ │ │ +
static constexpr bool is_unique() noexcept
Definition layout_right.hh:113
│ │ │ │ +
friend constexpr bool operator==(const mapping &a, const mapping< OtherExtents > &b) noexcept
Definition layout_right.hh:130
│ │ │ │ +
static constexpr bool is_always_exhaustive() noexcept
Definition layout_right.hh:110
│ │ │ │ +
typename extents_type::index_type index_type
Definition layout_right.hh:26
│ │ │ │ +
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │ +
constexpr const extents_type & extents() const noexcept
Definition layout_stride.hh:85
│ │ │ │ +
constexpr const strides_type & strides() const noexcept
Get the array of all strides.
Definition layout_stride.hh:127
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,221 +1,232 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpitraits.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +layout_right.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 © 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_MPITRAITS_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_MPITRAITS_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_STD_LAYOUT_RIGHT_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_LAYOUT_RIGHT_HH │ │ │ │ │ 7 │ │ │ │ │ -18#if HAVE_MPI │ │ │ │ │ -19 │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22#include │ │ │ │ │ -23#include │ │ │ │ │ -24#include │ │ │ │ │ -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; │ │ │ │ │ +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_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ +13 │ │ │ │ │ +14namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +15 │ │ │ │ │ +17template │ │ │ │ │ +_1_8class _l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +19{ │ │ │ │ │ +_2_0 template friend class _m_a_p_p_i_n_g; │ │ │ │ │ +21 │ │ │ │ │ +22public: │ │ │ │ │ +_2_3 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ +_2_4 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ +_2_5 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ +_2_6 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ +_2_7 using _l_a_y_o_u_t___t_y_p_e = _l_a_y_o_u_t___r_i_g_h_t; │ │ │ │ │ +28 │ │ │ │ │ +_3_0 constexpr _m_a_p_p_i_n_g () noexcept = default; │ │ │ │ │ +31 │ │ │ │ │ +_3_3 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ +34 │ │ │ │ │ +_3_6 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e) noexcept │ │ │ │ │ +37 : extents_(e) │ │ │ │ │ +38 {} │ │ │ │ │ +39 │ │ │ │ │ +41 template , int> = │ │ │ │ │ +0> │ │ │ │ │ +43 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +44 explicit(!std::is_convertible_v) │ │ │ │ │ +45 #endif │ │ │ │ │ +_4_6 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ +47 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ +48 {} │ │ │ │ │ +49 │ │ │ │ │ +51 template = 0, │ │ │ │ │ +53 std::enable_if_t, int> = │ │ │ │ │ +0> │ │ │ │ │ +54 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +55 explicit(!std::is_convertible_v) │ │ │ │ │ +56 #endif │ │ │ │ │ +_5_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ +58 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ +59 {} │ │ │ │ │ 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); │ │ │ │ │ +62 template , int> = │ │ │ │ │ +0> │ │ │ │ │ +64 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +65 explicit(extents_type::rank() > 0) │ │ │ │ │ +66 #endif │ │ │ │ │ +_6_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) │ │ │ │ │ +68 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ +69 { │ │ │ │ │ +70#ifndef NDEBUG │ │ │ │ │ +71 if constexpr(extents_type::rank() > 0) { │ │ │ │ │ +72 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ +73 for (_r_a_n_k___t_y_p_e r = extents_type::rank()-1; r > 0; --r) { │ │ │ │ │ +74 assert(m._s_t_r_i_d_e_s(r) == prod); │ │ │ │ │ +75 prod *= m._e_x_t_e_n_t_s().extent(r); │ │ │ │ │ +76 } │ │ │ │ │ +77 assert(m._s_t_r_i_d_e_s(0) == prod); │ │ │ │ │ +78 } │ │ │ │ │ +79#endif │ │ │ │ │ +80 } │ │ │ │ │ +81 │ │ │ │ │ +_8_3 constexpr _m_a_p_p_i_n_g& _o_p_e_r_a_t_o_r_=_ (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ +84 │ │ │ │ │ +_8_5 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return extents_; } │ │ │ │ │ +_8_6 constexpr _i_n_d_e_x___t_y_p_e _r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e () const noexcept { return │ │ │ │ │ +extents_.product(); } │ │ │ │ │ 87 │ │ │ │ │ -88 │ │ │ │ │ -89#undef ComposeMPITraits │ │ │ │ │ -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; │ │ │ │ │ +89 template = 0, │ │ │ │ │ +91 std::enable_if_t<(std::is_convertible_v && ...), int> = │ │ │ │ │ +0, │ │ │ │ │ +92 std::enable_if_t<(std::is_nothrow_constructible_v && │ │ │ │ │ +...), int> = 0> │ │ │ │ │ +_9_3 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ (Indices... ii) const noexcept │ │ │ │ │ +94 { │ │ │ │ │ +95 const std::array indices{_i_n_d_e_x___t_y_p_e(std::move(ii))...}; │ │ │ │ │ +96 _i_n_d_e_x___t_y_p_e value = indices.front(); │ │ │ │ │ +97 for (_r_a_n_k___t_y_p_e j = 0; j < extents_type::rank()-1; ++j) { │ │ │ │ │ +98 value = indices[j+1] + extents_.extent(j+1) * value; │ │ │ │ │ +99 } │ │ │ │ │ +100 return value; │ │ │ │ │ +101 } │ │ │ │ │ +102 │ │ │ │ │ +_1_0_4 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ () const noexcept │ │ │ │ │ +105 { │ │ │ │ │ +106 return 0; │ │ │ │ │ +107 } │ │ │ │ │ +108 │ │ │ │ │ +_1_0_9 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ +_1_1_0 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ +_1_1_1 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ +112 │ │ │ │ │ +_1_1_3 static constexpr bool _i_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ +_1_1_4 static constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ +_1_1_5 static constexpr bool _i_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ +116 │ │ │ │ │ +118 template 0), int> = 0> │ │ │ │ │ +_1_2_0 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e i) const noexcept │ │ │ │ │ +121 { │ │ │ │ │ +122 assert(i < extents_type::rank()); │ │ │ │ │ +123 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ +124 for (_r_a_n_k___t_y_p_e r = i+1; r < extents_type::rank(); ++r) │ │ │ │ │ +125 prod *= _e_x_t_e_n_t_s().extent(r); │ │ │ │ │ +126 return prod; │ │ │ │ │ +127 } │ │ │ │ │ 128 │ │ │ │ │ -129 template │ │ │ │ │ -130 struct MPITraits > │ │ │ │ │ +129 template │ │ │ │ │ +_1_3_0 friend constexpr bool _o_p_e_r_a_t_o_r_=_=_ (const _m_a_p_p_i_n_g& a, const │ │ │ │ │ +_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& b) noexcept │ │ │ │ │ 131 { │ │ │ │ │ -132 static MPI_Datatype datatype; │ │ │ │ │ -133 static MPI_Datatype vectortype; │ │ │ │ │ +132 return a.extents_ == b.extents_; │ │ │ │ │ +133 } │ │ │ │ │ 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 // DUNE_COMMON_PARALLEL_MPITRAITS_HH │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ -_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:91 │ │ │ │ │ +135private: │ │ │ │ │ +136 [[no_unique_address]] _e_x_t_e_n_t_s___t_y_p_e extents_; │ │ │ │ │ +137}; │ │ │ │ │ +138 │ │ │ │ │ +139} // end namespace Dune::Std │ │ │ │ │ +140 │ │ │ │ │ +141#endif // DUNE_COMMON_STD_LAYOUT_RIGHT_HH │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_f_w_d___l_a_y_o_u_t_s_._h_h │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the leftmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn layout_left.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ +A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ +to-left as the product o... │ │ │ │ │ +DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the rightmost extent has stride 1. │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ +constexpr const extents_type & extents() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +constexpr index_type operator()() const noexcept │ │ │ │ │ +The default offset for rank-0 tensors is 0. │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +constexpr mapping & operator=(const mapping &) noexcept=default │ │ │ │ │ +Copy-assignment for the mapping. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e │ │ │ │ │ +constexpr index_type required_span_size() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping() noexcept=default │ │ │ │ │ +The default construction is possible for default constructible extents. │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename extents_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ +Extents extents_type │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_always_unique() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:109 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e │ │ │ │ │ +constexpr index_type stride(rank_type i) const noexcept │ │ │ │ │ +The stride is the product of the extents E(n)*E(n-1)*...*E(i+1) │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +static constexpr bool is_exhaustive() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:114 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr mapping(const layout_left::mapping< OtherExtents > &m) noexcept │ │ │ │ │ +Construct the mapping from a layout_left. │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:57 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_strided() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ +typename extents_type::rank_type rank_type │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_always_strided() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:111 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_unique() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:113 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +friend constexpr bool operator==(const mapping &a, const mapping< OtherExtents │ │ │ │ │ +> &b) noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:130 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ +typename extents_type::index_type index_type │ │ │ │ │ +DDeeffiinniittiioonn layout_right.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ +A layout mapping where the strides are user-defined. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ +constexpr const extents_type & extents() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e_s │ │ │ │ │ +constexpr const strides_type & strides() const noexcept │ │ │ │ │ +Get the array of all strides. │ │ │ │ │ +DDeeffiinniittiioonn layout_stride.hh:127 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpifuture.hh File Reference │ │ │ │ +dune-common: mdspan.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,56 +65,77 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
mpifuture.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
mdspan.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <functional>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <optional>
│ │ │ │ +
#include <array>
│ │ │ │ #include <type_traits>
│ │ │ │ #include <utility>
│ │ │ │ -#include <mpi.h>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/parallel/communication.hh>
│ │ │ │ -#include <dune/common/parallel/future.hh>
│ │ │ │ -#include <dune/common/parallel/mpidata.hh>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +#include <dune/common/std/default_accessor.hh>
│ │ │ │ +#include <dune/common/std/extents.hh>
│ │ │ │ +#include <dune/common/std/layout_right.hh>
│ │ │ │ +#include <dune/common/std/span.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...
class  Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >
 A multi-dimensional non-owning array view. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<class CArray , std::enable_if_t< std::is_array_v< CArray >, int > = 0, std::enable_if_t<(std::rank_v< CArray >==1), int > = 0>
 Dune::Std::mdspan (CArray &) -> mdspan< std::remove_all_extents_t< CArray >, Std::extents< std::size_t, std::extent_v< CArray, 0 > > >
 
template<class Pointer , std::enable_if_t< std::is_pointer_v< std::remove_reference_t< Pointer > >, int > = 0>
 Dune::Std::mdspan (Pointer &&) -> mdspan< std::remove_pointer_t< std::remove_reference_t< Pointer > >, Std::extents< std::size_t > >
 
template<class ElementType , class... II, std::enable_if_t<(... &&std::is_convertible_v< II, std::size_t >), int > = 0, std::enable_if_t<(sizeof...(II) > 0), int > = 0>
 Dune::Std::mdspan (ElementType *, II...) -> mdspan< ElementType, Std::dextents< std::size_t, sizeof...(II)> >
 
template<class ElementType , class SizeType , std::size_t N>
 Dune::Std::mdspan (ElementType *, Std::span< SizeType, N > &) -> mdspan< ElementType, Std::dextents< std::size_t, N > >
 
template<class ElementType , class SizeType , std::size_t N>
 Dune::Std::mdspan (ElementType *, const std::array< SizeType, N > &) -> mdspan< ElementType, Std::dextents< std::size_t, N > >
 
template<class ElementType , class IndexType , std::size_t... exts>
 Dune::Std::mdspan (ElementType *, const Std::extents< IndexType, exts... > &) -> mdspan< ElementType, Std::extents< IndexType, exts... > >
 
template<class ElementType , class Mapping , class Extents = typename Mapping::extents_type, class Layout = typename Mapping::layout_type>
 Dune::Std::mdspan (ElementType *, const Mapping &) -> mdspan< ElementType, Extents, Layout >
 
template<class Mapping , class Accessor , class DataHandle = typename Accessor::data_handle_type, class Element = typename Accessor::element_type, class Extents = typename Mapping::extents_type, class Layout = typename Mapping::layout_type>
 Dune::Std::mdspan (const DataHandle &, const Mapping &, const Accessor &) -> mdspan< Element, Extents, Layout, Accessor >
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,41 +1,72 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -#include │ │ │ │ │ + * _s_t_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 │ │ │ │ │ +mdspan.hh File Reference │ │ │ │ │ +#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_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> │ │ │ │ │ +#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_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_e_x_t_e_n_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_l_a_y_o_u_t___r_i_g_h_t_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_i_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_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_<_ _E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_P_o_l_i_c_y_,_ _A_c_c_e_s_s_o_r_P_o_l_i_c_y_ _> │ │ │ │ │ +  A multi-dimensional non-owning array view. _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_:_:_S_t_d │ │ │ │ │ +  Namespace for features backported from new C++ standards. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template, int > = 0, │ │ │ │ │ +std::enable_if_t<(std::rank_v< CArray >==1), int > = 0> │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (CArray &) -> _m_d_s_p_a_n< std::remove_all_extents_t< CArray >, │ │ │ │ │ + _S_t_d_:_:_e_x_t_e_n_t_s< std::size_t, std::extent_v< CArray, 0 > > > │ │ │ │ │ +  │ │ │ │ │ +template >, int > = 0> │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (Pointer &&) -> _m_d_s_p_a_n< std::remove_pointer_t< std:: │ │ │ │ │ + remove_reference_t< Pointer > >, _S_t_d_:_:_e_x_t_e_n_t_s< std::size_t > > │ │ │ │ │ +  │ │ │ │ │ +template), int > = 0, std::enable_if_t<(sizeof... │ │ │ │ │ +(II) > 0), int > = 0> │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, II...) -> _m_d_s_p_a_n< ElementType, _S_t_d_:_: │ │ │ │ │ + _d_e_x_t_e_n_t_s< std::size_t, sizeof...(II)> > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, _S_t_d_:_:_s_p_a_n< SizeType, N > &) -> _m_d_s_p_a_n< │ │ │ │ │ + ElementType, _S_t_d_:_:_d_e_x_t_e_n_t_s< std::size_t, N > > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, const std::array< SizeType, N > &) - │ │ │ │ │ + > _m_d_s_p_a_n< ElementType, _S_t_d_:_:_d_e_x_t_e_n_t_s< std::size_t, N > > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, const _S_t_d_:_:_e_x_t_e_n_t_s< IndexType, exts... > &) │ │ │ │ │ + -> _m_d_s_p_a_n< ElementType, _S_t_d_:_:_e_x_t_e_n_t_s< IndexType, exts... > > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, const Mapping &) -> _m_d_s_p_a_n< ElementType, │ │ │ │ │ + Extents, Layout > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (const DataHandle &, const Mapping &, const Accessor &) - │ │ │ │ │ + > _m_d_s_p_a_n< Element, Extents, Layout, Accessor > │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mpifuture.hh Source File │ │ │ │ +dune-common: mdspan.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,299 +70,395 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mpifuture.hh
│ │ │ │ +
mdspan.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 © 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_COMMON_STD_MDSPAN_HH
│ │ │ │ +
6#define DUNE_COMMON_STD_MDSPAN_HH
│ │ │ │
7
│ │ │ │ -
8#if HAVE_MPI
│ │ │ │ -
9
│ │ │ │ -
10#include <functional>
│ │ │ │ -
11#include <memory>
│ │ │ │ -
12#include <optional>
│ │ │ │ -
13#include <type_traits>
│ │ │ │ -
14#include <utility>
│ │ │ │ -
15
│ │ │ │ -
16#include <mpi.h>
│ │ │ │ -
17
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +
8#include <array>
│ │ │ │ +
9#include <type_traits>
│ │ │ │ +
10#include <utility>
│ │ │ │ +
11#if __has_include(<version>)
│ │ │ │ +
12 #include <version>
│ │ │ │ +
13#endif
│ │ │ │ +
14
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
20
│ │ │ │ +
21namespace Dune::Std {
│ │ │ │
22
│ │ │ │ -
23namespace Dune{
│ │ │ │ -
24
│ │ │ │ -
│ │ │ │ -
25 namespace impl{
│ │ │ │ -
26 template<class T>
│ │ │ │ -
│ │ │ │ -
27 struct Buffer{
│ │ │ │ -
│ │ │ │ -
28 Buffer(bool valid){
│ │ │ │ -
29 if(valid)
│ │ │ │ -
30 value = std::make_unique<T>();
│ │ │ │ -
31 }
│ │ │ │ -
│ │ │ │ -
32 template<class V>
│ │ │ │ -
│ │ │ │ -
33 Buffer(V&& t)
│ │ │ │ -
34 : value(std::make_unique<T>(std::forward<V>(t)))
│ │ │ │ -
35 {}
│ │ │ │ -
│ │ │ │ -
36 std::unique_ptr<T> value;
│ │ │ │ -
│ │ │ │ -
37 T get(){
│ │ │ │ -
38 T tmp = std::move(*value);
│ │ │ │ -
39 value.reset();
│ │ │ │ -
40 return tmp;
│ │ │ │ -
41 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
42 operator bool () const {
│ │ │ │ -
43 return (bool)value;
│ │ │ │ -
44 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
45 T& operator *() const{
│ │ │ │ -
46 return *value;
│ │ │ │ -
47 }
│ │ │ │ -
│ │ │ │ -
48 };
│ │ │ │ -
│ │ │ │ -
49
│ │ │ │ -
50 template<class T>
│ │ │ │ -
│ │ │ │ -
51 struct Buffer<T&>{
│ │ │ │ -
│ │ │ │ -
52 Buffer(bool valid = false)
│ │ │ │ -
53 {
│ │ │ │ -
54 if(valid)
│ │ │ │ -
55 value = T();
│ │ │ │ -
56 }
│ │ │ │ -
│ │ │ │ -
57 template<class V>
│ │ │ │ -
│ │ │ │ -
58 Buffer(V&& t)
│ │ │ │ -
59 : value(std::forward<V>(t))
│ │ │ │ -
60 {}
│ │ │ │ -
│ │ │ │ -
61 std::optional<std::reference_wrapper<T>> value;
│ │ │ │ -
│ │ │ │ -
62 T& get(){
│ │ │ │ -
63 T& tmp = *value;
│ │ │ │ -
64 value.reset();
│ │ │ │ -
65 return tmp;
│ │ │ │ -
66 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
67 operator bool () const{
│ │ │ │ -
68 return (bool)value;
│ │ │ │ -
69 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
70 T& operator *() const{
│ │ │ │ -
71 return *value;
│ │ │ │ -
72 }
│ │ │ │ -
│ │ │ │ -
73 };
│ │ │ │ -
│ │ │ │ -
74
│ │ │ │ -
75 template<>
│ │ │ │ -
│ │ │ │ -
76 struct Buffer<void>{
│ │ │ │ -
77 bool valid_;
│ │ │ │ -
│ │ │ │ -
78 Buffer(bool valid = false)
│ │ │ │ -
79 : valid_(valid)
│ │ │ │ -
80 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
81 operator bool () const{
│ │ │ │ -
82 return valid_;
│ │ │ │ -
83 }
│ │ │ │ -
│ │ │ │ -
84 void get(){}
│ │ │ │ -
85 };
│ │ │ │ -
│ │ │ │ -
86 }
│ │ │ │ -
│ │ │ │ -
87
│ │ │ │ -
92 template<class R, class S = void>
│ │ │ │ -
│ │ │ │ -
93 class MPIFuture{
│ │ │ │ -
94 mutable MPI_Request req_;
│ │ │ │ -
95 mutable MPI_Status status_;
│ │ │ │ -
96 impl::Buffer<R> data_;
│ │ │ │ -
97 impl::Buffer<S> send_data_;
│ │ │ │ -
98 friend class Communication<MPI_Comm>;
│ │ │ │ -
99 public:
│ │ │ │ -
│ │ │ │ -
100 MPIFuture(bool valid = false)
│ │ │ │ -
101 : req_(MPI_REQUEST_NULL)
│ │ │ │ -
102 , data_(valid)
│ │ │ │ -
103 {}
│ │ │ │ -
│ │ │ │ -
104
│ │ │ │ -
105 // Hide this constructor if R or S is void
│ │ │ │ -
106 template<class V = R, class U = S>
│ │ │ │ -
│ │ │ │ -
107 MPIFuture(V&& recv_data, U&& send_data, typename std::enable_if_t<!std::is_void<V>::value && !std::is_void<U>::value>* = 0) :
│ │ │ │ -
108 req_(MPI_REQUEST_NULL)
│ │ │ │ -
109 , data_(std::forward<R>(recv_data))
│ │ │ │ -
110 , send_data_(std::forward<S>(send_data))
│ │ │ │ -
111 {}
│ │ │ │ -
│ │ │ │ -
112
│ │ │ │ -
113 // hide this constructor if R is void
│ │ │ │ -
114 template<class V = R>
│ │ │ │ -
│ │ │ │ -
115 MPIFuture(V&& recv_data, typename std::enable_if_t<!std::is_void<V>::value>* = 0)
│ │ │ │ -
116 : req_(MPI_REQUEST_NULL)
│ │ │ │ -
117 , data_(std::forward<V>(recv_data))
│ │ │ │ -
118 {}
│ │ │ │ -
│ │ │ │ -
119
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
121 if(req_ != MPI_REQUEST_NULL){
│ │ │ │ -
122 try{ // might fail when it is a collective communication
│ │ │ │ -
123 MPI_Cancel(&req_);
│ │ │ │ -
124 MPI_Request_free(&req_);
│ │ │ │ -
125 }catch(...){
│ │ │ │ -
126 }
│ │ │ │ -
127 }
│ │ │ │ -
128 }
│ │ │ │ -
│ │ │ │ -
129
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
131 : req_(MPI_REQUEST_NULL)
│ │ │ │ -
132 , data_(std::move(f.data_))
│ │ │ │ -
133 , send_data_(std::move(f.send_data_))
│ │ │ │ -
134 {
│ │ │ │ -
135 std::swap(req_, f.req_);
│ │ │ │ -
136 std::swap(status_, f.status_);
│ │ │ │ -
137 }
│ │ │ │ -
│ │ │ │ -
138
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
140 std::swap(req_, f.req_);
│ │ │ │ -
141 std::swap(status_, f.status_);
│ │ │ │ -
142 std::swap(data_, f.data_);
│ │ │ │ -
143 std::swap(send_data_, f.send_data_);
│ │ │ │ -
144 return *this;
│ │ │ │ -
145 }
│ │ │ │ -
│ │ │ │ -
146
│ │ │ │ -
│ │ │ │ -
147 bool valid() const{
│ │ │ │ -
148 return (bool)data_;
│ │ │ │ -
149 }
│ │ │ │ -
│ │ │ │ -
150
│ │ │ │ -
│ │ │ │ -
151 void wait(){
│ │ │ │ -
152 if(!valid())
│ │ │ │ -
153 DUNE_THROW(InvalidFutureException, "The MPIFuture is not valid!");
│ │ │ │ -
154 MPI_Wait(&req_, &status_);
│ │ │ │ -
155 }
│ │ │ │ -
│ │ │ │ -
156
│ │ │ │ -
│ │ │ │ -
157 bool ready() const{
│ │ │ │ -
158 int flag = -1;
│ │ │ │ -
159 MPI_Test(&req_, &flag, &status_);
│ │ │ │ -
160 return flag;
│ │ │ │ -
161 }
│ │ │ │ -
│ │ │ │ -
162
│ │ │ │ -
│ │ │ │ -
163 R get() {
│ │ │ │ -
164 wait();
│ │ │ │ -
165 return data_.get();
│ │ │ │ -
166 }
│ │ │ │ +
61template <class Element, class Extents, class LayoutPolicy = Std::layout_right,
│ │ │ │ +
62 class AccessorPolicy = Std::default_accessor<Element>>
│ │ │ │ +
│ │ │ │ +
63class mdspan
│ │ │ │ +
64{
│ │ │ │ +
65 static_assert(std::is_object_v<Element>);
│ │ │ │ +
66 static_assert(!std::is_abstract_v<Element>);
│ │ │ │ +
67 static_assert(!std::is_array_v<Element>);
│ │ │ │ +
68 static_assert(std::is_same_v<Element, typename AccessorPolicy::element_type>);
│ │ │ │ +
69
│ │ │ │ +
70public:
│ │ │ │ +
71 using element_type = Element;
│ │ │ │ +
72 using extents_type = Extents;
│ │ │ │ +
73 using layout_type = LayoutPolicy;
│ │ │ │ +
74 using accessor_type = AccessorPolicy;
│ │ │ │ +
75
│ │ │ │ +
76 using value_type = std::remove_cv_t<Element>;
│ │ │ │ +
77 using mapping_type = typename layout_type::template mapping<extents_type>;
│ │ │ │ +
78 using index_type = typename extents_type::index_type;
│ │ │ │ +
79 using size_type = typename extents_type::size_type;
│ │ │ │ +
80 using rank_type = typename extents_type::rank_type;
│ │ │ │ +
81 using data_handle_type = typename accessor_type::data_handle_type;
│ │ │ │ +
82 using reference = typename accessor_type::reference;
│ │ │ │ +
83
│ │ │ │ +
84private:
│ │ │ │ +
85 // [mdspan.layout.reqmts]
│ │ │ │ +
86 static_assert(std::is_nothrow_move_constructible_v<mapping_type>);
│ │ │ │ +
87 static_assert(std::is_nothrow_move_assignable_v<mapping_type>);
│ │ │ │ +
88 static_assert(std::is_nothrow_swappable_v<mapping_type>);
│ │ │ │ +
89
│ │ │ │ +
90 // [mdspan.accessor.reqmts]
│ │ │ │ +
91 static_assert(std::is_nothrow_move_constructible_v<accessor_type>);
│ │ │ │ +
92 static_assert(std::is_nothrow_move_assignable_v<accessor_type>);
│ │ │ │ +
93 static_assert(std::is_nothrow_swappable_v<accessor_type>);
│ │ │ │ +
94
│ │ │ │ +
95public:
│ │ │ │ +
98
│ │ │ │ +
100 template <class E = extents_type, class D = data_handle_type, class M = mapping_type, class A = accessor_type,
│ │ │ │ +
101 std::enable_if_t<(E::rank_dynamic() > 0), int> = 0,
│ │ │ │ +
102 std::enable_if_t<std::is_default_constructible_v<D>, int> = 0,
│ │ │ │ +
103 std::enable_if_t<std::is_default_constructible_v<M>, int> = 0,
│ │ │ │ +
104 std::enable_if_t<std::is_default_constructible_v<A>, int> = 0>
│ │ │ │ +
│ │ │ │ +
105 constexpr mdspan ()
│ │ │ │ +
106 : data_handle_{}
│ │ │ │ +
107 , mapping_{}
│ │ │ │ +
108 , accessor_{}
│ │ │ │ +
109 {}
│ │ │ │ +
│ │ │ │ +
110
│ │ │ │ +
112 template <class... IndexTypes,
│ │ │ │ +
113 class E = extents_type, class M = mapping_type, class A = accessor_type,
│ │ │ │ +
114 std::enable_if_t<(sizeof...(IndexTypes) == E::rank() || sizeof...(IndexTypes) == E::rank_dynamic()), int> = 0,
│ │ │ │ +
115 std::enable_if_t<(... && std::is_convertible_v<IndexTypes, index_type>), int> = 0,
│ │ │ │ +
116 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type, IndexTypes>), int> = 0,
│ │ │ │ +
117 std::enable_if_t<std::is_constructible_v<M, E>, int> = 0,
│ │ │ │ +
118 std::enable_if_t<std::is_default_constructible_v<A>, int> = 0>
│ │ │ │ +
│ │ │ │ +
119 explicit constexpr mdspan (data_handle_type p, IndexTypes... exts)
│ │ │ │ +
120 : mdspan(std::move(p), extents_type(index_type(std::move(exts))...))
│ │ │ │ +
121 {}
│ │ │ │ +
│ │ │ │ +
122
│ │ │ │ +
124 template <class IndexType, std::size_t N,
│ │ │ │ +
125 std::enable_if_t<std::is_convertible_v<const IndexType&, index_type>, int> = 0,
│ │ │ │ +
126 std::enable_if_t<std::is_nothrow_constructible_v<index_type,const IndexType&>, int> = 0,
│ │ │ │ +
127 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type::rank()), int> = 0>
│ │ │ │ +
128 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
129 explicit(N != extents_type::rank_dynamic())
│ │ │ │ +
130 #endif
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
132 : mdspan(std::move(p), extents_type(exts))
│ │ │ │ +
133 {}
│ │ │ │ +
│ │ │ │ +
134
│ │ │ │ +
136 template <class IndexType, std::size_t N,
│ │ │ │ +
137 std::enable_if_t<std::is_convertible_v<IndexType, index_type>, int> = 0,
│ │ │ │ +
138 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type::rank()), int> = 0>
│ │ │ │ +
139 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
140 explicit(N != extents_type::rank_dynamic())
│ │ │ │ +
141 #endif
│ │ │ │ +
│ │ │ │ +
142 constexpr mdspan (data_handle_type p, const std::array<IndexType,N>& exts)
│ │ │ │ +
143 : mdspan(std::move(p), extents_type(exts))
│ │ │ │ +
144 {}
│ │ │ │ +
│ │ │ │ +
145
│ │ │ │ +
147 template <class M = mapping_type,
│ │ │ │ +
148 std::enable_if_t<std::is_constructible_v<M, const extents_type&>, int> = 0>
│ │ │ │ +
│ │ │ │ +
149 constexpr mdspan (data_handle_type p, const extents_type& e)
│ │ │ │ +
150 : mdspan(std::move(p), mapping_type(e))
│ │ │ │ +
151 {}
│ │ │ │ +
│ │ │ │ +
152
│ │ │ │ +
154 template <class A = accessor_type,
│ │ │ │ +
155 std::enable_if_t<std::is_default_constructible_v<A>, int> = 0>
│ │ │ │ +
│ │ │ │ +
156 constexpr mdspan (data_handle_type p, const mapping_type& m)
│ │ │ │ +
157 : mdspan(std::move(p), m, accessor_type{})
│ │ │ │ +
158 {}
│ │ │ │ +
│ │ │ │ +
159
│ │ │ │ +
│ │ │ │ +
161 constexpr mdspan (data_handle_type p, const mapping_type& m, const accessor_type& a)
│ │ │ │ +
162 : data_handle_(std::move(p))
│ │ │ │ +
163 , mapping_(m)
│ │ │ │ +
164 , accessor_(a)
│ │ │ │ +
165 {}
│ │ │ │
│ │ │ │ +
166
│ │ │ │
167
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
169 wait();
│ │ │ │ -
170 return send_data_.get();
│ │ │ │ -
171 }
│ │ │ │ -
│ │ │ │ -
172
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
174 return getMPIData(*data_);
│ │ │ │ -
175 }
│ │ │ │ -
│ │ │ │ -
176
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
178 return getMPIData(*send_data_);
│ │ │ │ -
179 }
│ │ │ │ -
│ │ │ │ -
180 };
│ │ │ │ -
│ │ │ │ -
181
│ │ │ │ -
182}
│ │ │ │ -
183#endif // HAVE_MPI
│ │ │ │ -
184#endif // DUNE_COMMON_PARALLEL_MPIFUTURE_HH
│ │ │ │ -
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.
│ │ │ │ - │ │ │ │ -
A few common exception classes.
│ │ │ │ -
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
Definition bigunsignedint.hh:549
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
169 template <class OtherElementType, class OtherExtends, class OtherLayoutPolicy, class OtherAccessor,
│ │ │ │ +
170 std::enable_if_t<std::is_constructible_v<mapping_type, const typename OtherElementType::template mapping<OtherExtends>&>, int> = 0,
│ │ │ │ +
171 std::enable_if_t<std::is_constructible_v<accessor_type, const OtherAccessor&>, int> = 0>
│ │ │ │ +
172 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ +
173 explicit(!std::is_convertible_v<const typename OtherElementType::template mapping<OtherExtends>&, mapping_type>
│ │ │ │ +
174 || !std::is_convertible_v<const OtherAccessor&, accessor_type>)
│ │ │ │ +
175 #endif
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
178 accessor_type(other.accessor()))
│ │ │ │ +
179 {}
│ │ │ │ +
│ │ │ │ +
180
│ │ │ │ +
182
│ │ │ │ +
183
│ │ │ │ +
186
│ │ │ │ +
191 template <class... Indices,
│ │ │ │ +
192 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
193 std::enable_if_t<(... && std::is_convertible_v<Indices, index_type>), int> = 0,
│ │ │ │ +
194 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type,Indices>), int> = 0>
│ │ │ │ +
│ │ │ │ +
195 constexpr reference operator() (Indices... indices) const
│ │ │ │ +
196 {
│ │ │ │ +
197 return accessor_.access(data_handle_, mapping_(index_type(std::move(indices))...));
│ │ │ │ +
198 }
│ │ │ │ +
│ │ │ │ +
199
│ │ │ │ +
200#if __cpp_multidimensional_subscript >= 202110L
│ │ │ │ +
201
│ │ │ │ +
203 template <class... Indices,
│ │ │ │ +
204 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ +
205 std::enable_if_t<(... && std::is_convertible_v<Indices, index_type>), int> = 0,
│ │ │ │ +
206 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type,Indices>), int> = 0>
│ │ │ │ +
207 constexpr reference operator[] (Indices... indices) const
│ │ │ │ +
208 {
│ │ │ │ +
209 return accessor_.access(data_handle_, mapping_(index_type(std::move(indices))...));
│ │ │ │ +
210 }
│ │ │ │ +
211
│ │ │ │ +
212#else // __cpp_multidimensional_subscript
│ │ │ │ +
213
│ │ │ │ +
216 template <class Index, class E = extents_type,
│ │ │ │ +
217 std::enable_if_t<std::is_convertible_v<Index,index_type>, int> = 0,
│ │ │ │ +
218 std::enable_if_t<(E::rank() == 1), int> = 0>
│ │ │ │ +
│ │ │ │ +
219 constexpr reference operator[] (Index index) const
│ │ │ │ +
220 {
│ │ │ │ +
221 return accessor_.access(data_handle_, mapping_(index_type(std::move(index))));
│ │ │ │ +
222 }
│ │ │ │ +
│ │ │ │ +
223
│ │ │ │ +
224#endif // __cpp_multidimensional_subscript
│ │ │ │ +
225
│ │ │ │ +
227 template <class Index,
│ │ │ │ +
228 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0,
│ │ │ │ +
229 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const Index&>, int> = 0>
│ │ │ │ +
│ │ │ │ +
230 constexpr reference operator[] (Std::span<Index,extents_type::rank()> indices) const
│ │ │ │ +
231 {
│ │ │ │ +
232 return unpackIntegerSequence([&](auto... ii) -> reference {
│ │ │ │ +
233 return accessor_.access(data_handle_, mapping_(index_type(indices[ii])...)); },
│ │ │ │ +
234 std::make_index_sequence<extents_type::rank()>{});
│ │ │ │ +
235 }
│ │ │ │ +
│ │ │ │ +
236
│ │ │ │ +
238 template <class Index,
│ │ │ │ +
239 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0,
│ │ │ │ +
240 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const Index&>, int> = 0>
│ │ │ │ +
│ │ │ │ +
241 constexpr reference operator[] (const std::array<Index,extents_type::rank()>& indices) const
│ │ │ │ +
242 {
│ │ │ │ +
243 return std::apply([&](auto... ii) -> reference {
│ │ │ │ +
244 return accessor_.access(data_handle_, mapping_(index_type(ii)...)); }, indices);
│ │ │ │ +
245 }
│ │ │ │ +
│ │ │ │ +
246
│ │ │ │ +
248
│ │ │ │ +
250 constexpr const extents_type& extents () const noexcept { return mapping_.extents(); }
│ │ │ │ +
251
│ │ │ │ +
253 constexpr const mapping_type& mapping () const noexcept { return mapping_; }
│ │ │ │ +
254
│ │ │ │ +
256 constexpr const accessor_type& accessor () const noexcept { return accessor_; }
│ │ │ │ +
257
│ │ │ │ +
259 constexpr const data_handle_type& data_handle () const noexcept { return data_handle_; };
│ │ │ │ +
260
│ │ │ │ +
261
│ │ │ │ +
264
│ │ │ │ +
266 static constexpr rank_type rank () noexcept { return extents_type::rank(); }
│ │ │ │ +
267
│ │ │ │ +
269 static constexpr rank_type rank_dynamic () noexcept { return extents_type::rank_dynamic(); }
│ │ │ │ +
270
│ │ │ │ +
272 static constexpr std::size_t static_extent (rank_type r) noexcept { return extents_type::static_extent(r); }
│ │ │ │ +
273
│ │ │ │ +
275 constexpr index_type extent (rank_type r) const noexcept { return extents().extent(r); }
│ │ │ │ +
276
│ │ │ │ +
│ │ │ │ +
278 constexpr size_type size () const noexcept
│ │ │ │ +
279 {
│ │ │ │ +
280 size_type s = 1;
│ │ │ │ +
281 for (rank_type r = 0; r < rank(); ++r)
│ │ │ │ +
282 s *= extent(r);
│ │ │ │ +
283 return s;
│ │ │ │ +
284 }
│ │ │ │ +
│ │ │ │ +
285
│ │ │ │ +
287 [[nodiscard]] constexpr bool empty () const noexcept { return size() == 0; }
│ │ │ │ +
288
│ │ │ │ +
290
│ │ │ │ +
291
│ │ │ │ +
293 static constexpr bool is_always_unique () { return mapping_type::is_always_unique(); }
│ │ │ │ +
294
│ │ │ │ +
296 static constexpr bool is_always_exhaustive () { return mapping_type::is_always_exhaustive(); }
│ │ │ │ +
297
│ │ │ │ +
299 static constexpr bool is_always_strided () { return mapping_type::is_always_strided(); }
│ │ │ │ +
300
│ │ │ │ +
302 constexpr bool is_unique () const { return mapping_.is_unique(); }
│ │ │ │ +
303
│ │ │ │ +
306 constexpr bool is_exhaustive () const { return mapping_.is_exhaustive(); }
│ │ │ │ +
307
│ │ │ │ +
313 constexpr bool is_strided () const { return mapping_.is_strided(); }
│ │ │ │ +
314
│ │ │ │ +
316 constexpr index_type stride (rank_type r) const { return mapping_.stride(r); }
│ │ │ │ +
317
│ │ │ │ +
318
│ │ │ │ +
│ │ │ │ +
320 friend constexpr void swap (mdspan& x, mdspan& y) noexcept
│ │ │ │ +
321 {
│ │ │ │ +
322 using std::swap;
│ │ │ │ +
323 swap(x.data_handle_, y.data_handle_);
│ │ │ │ +
324 swap(x.mapping_, y.mapping_);
│ │ │ │ +
325 swap(x.accessor_, y.accessor_);
│ │ │ │ +
326 }
│ │ │ │ +
│ │ │ │ +
327
│ │ │ │ +
328
│ │ │ │ +
329private:
│ │ │ │ +
330 data_handle_type data_handle_;
│ │ │ │ +
331 [[no_unique_address]] mapping_type mapping_;
│ │ │ │ +
332 [[no_unique_address]] accessor_type accessor_;
│ │ │ │ +
333};
│ │ │ │ +
│ │ │ │ +
334
│ │ │ │ +
335// deduction guides
│ │ │ │ +
336// @{
│ │ │ │ +
337
│ │ │ │ +
338template <class CArray,
│ │ │ │ +
339 std::enable_if_t<std::is_array_v<CArray>, int> = 0,
│ │ │ │ +
340 std::enable_if_t<(std::rank_v<CArray> == 1), int> = 0>
│ │ │ │ +
341mdspan (CArray&)
│ │ │ │ + │ │ │ │ +
343
│ │ │ │ +
344template <class Pointer,
│ │ │ │ +
345 std::enable_if_t<std::is_pointer_v<std::remove_reference_t<Pointer>>, int> = 0>
│ │ │ │ +
346mdspan (Pointer&&)
│ │ │ │ + │ │ │ │ +
348
│ │ │ │ +
349template <class ElementType, class... II,
│ │ │ │ +
350 std::enable_if_t<(... && std::is_convertible_v<II,std::size_t>), int> = 0,
│ │ │ │ +
351 std::enable_if_t<(sizeof...(II) > 0), int> = 0>
│ │ │ │ +
352mdspan (ElementType*, II...)
│ │ │ │ +
353 -> mdspan<ElementType, Std::dextents<std::size_t, sizeof...(II)>>;
│ │ │ │ +
354
│ │ │ │ +
355template <class ElementType, class SizeType, std::size_t N>
│ │ │ │ + │ │ │ │ + │ │ │ │ +
358
│ │ │ │ +
359template <class ElementType, class SizeType, std::size_t N>
│ │ │ │ +
360mdspan (ElementType*, const std::array<SizeType,N>&)
│ │ │ │ + │ │ │ │ +
362
│ │ │ │ +
363template <class ElementType, class IndexType, std::size_t... exts>
│ │ │ │ + │ │ │ │ +
365 -> mdspan<ElementType, Std::extents<IndexType,exts...>>;
│ │ │ │ +
366
│ │ │ │ +
367template <class ElementType, class Mapping,
│ │ │ │ +
368 class Extents = typename Mapping::extents_type,
│ │ │ │ +
369 class Layout = typename Mapping::layout_type>
│ │ │ │ +
370mdspan (ElementType*, const Mapping&)
│ │ │ │ + │ │ │ │ +
372
│ │ │ │ +
373template <class Mapping, class Accessor,
│ │ │ │ +
374 class DataHandle = typename Accessor::data_handle_type,
│ │ │ │ +
375 class Element = typename Accessor::element_type,
│ │ │ │ +
376 class Extents = typename Mapping::extents_type,
│ │ │ │ +
377 class Layout = typename Mapping::layout_type>
│ │ │ │ +
378mdspan (const DataHandle&, const Mapping&, const Accessor&)
│ │ │ │ + │ │ │ │ +
380
│ │ │ │ +
381// @}
│ │ │ │ +
382
│ │ │ │ +
383} // end namespace Dune::Std
│ │ │ │ +
384
│ │ │ │ +
385#endif // DUNE_COMMON_STD_MDSPAN_HH
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
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:124
│ │ │ │ +
typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std::size_t, R > >::type dextents
Alias of extents of given rank R and purely dynamic extents. See [mdspan.extents.dextents].
Definition extents.hh:259
│ │ │ │
STL namespace.
│ │ │ │ -
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
auto getMPIData(T &t)
Definition mpidata.hh:44
│ │ │ │ -
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:20
│ │ │ │ -
Definition mpifuture.hh:27
│ │ │ │ -
std::unique_ptr< T > value
Definition mpifuture.hh:36
│ │ │ │ -
T & operator*() const
Definition mpifuture.hh:45
│ │ │ │ -
Buffer(V &&t)
Definition mpifuture.hh:33
│ │ │ │ -
T get()
Definition mpifuture.hh:37
│ │ │ │ -
Buffer(bool valid)
Definition mpifuture.hh:28
│ │ │ │ -
std::optional< std::reference_wrapper< T > > value
Definition mpifuture.hh:61
│ │ │ │ -
Buffer(bool valid=false)
Definition mpifuture.hh:52
│ │ │ │ -
T & get()
Definition mpifuture.hh:62
│ │ │ │ -
Buffer(V &&t)
Definition mpifuture.hh:58
│ │ │ │ -
bool valid_
Definition mpifuture.hh:77
│ │ │ │ -
void get()
Definition mpifuture.hh:84
│ │ │ │ -
Buffer(bool valid=false)
Definition mpifuture.hh:78
│ │ │ │ -
Provides a future-like object for MPI communication. It contains the object that will be received and...
Definition mpifuture.hh:93
│ │ │ │ -
MPIFuture(V &&recv_data, typename std::enable_if_t<!std::is_void< V >::value > *=0)
Definition mpifuture.hh:115
│ │ │ │ -
bool ready() const
Definition mpifuture.hh:157
│ │ │ │ -
bool valid() const
Definition mpifuture.hh:147
│ │ │ │ -
~MPIFuture()
Definition mpifuture.hh:120
│ │ │ │ -
MPIFuture(bool valid=false)
Definition mpifuture.hh:100
│ │ │ │ -
MPIFuture & operator=(MPIFuture &&f)
Definition mpifuture.hh:139
│ │ │ │ -
auto get_send_mpidata()
Definition mpifuture.hh:177
│ │ │ │ -
void wait()
Definition mpifuture.hh:151
│ │ │ │ -
auto get_mpidata()
Definition mpifuture.hh:173
│ │ │ │ -
R get()
Definition mpifuture.hh:163
│ │ │ │ -
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:107
│ │ │ │ -
S get_send_data()
Definition mpifuture.hh:168
│ │ │ │ -
MPIFuture(MPIFuture &&f)
Definition mpifuture.hh:130
│ │ │ │ +
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
Multidimensional index space with dynamic and static extents.
Definition extents.hh:54
│ │ │ │ +
A multi-dimensional non-owning array view.
Definition mdspan.hh:64
│ │ │ │ +
typename accessor_type::reference reference
Definition mdspan.hh:82
│ │ │ │ +
Element element_type
Definition mdspan.hh:71
│ │ │ │ +
constexpr mdspan(data_handle_type p, const mapping_type &m, const accessor_type &a)
Construct from the pointer to the data of the tensor, an index mapping, and an accessor.
Definition mdspan.hh:161
│ │ │ │ +
Extents extents_type
Definition mdspan.hh:72
│ │ │ │ +
static constexpr rank_type rank_dynamic() noexcept
Number of dimensions of the tensor.
Definition mdspan.hh:269
│ │ │ │ +
static constexpr bool is_always_unique()
Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j....
Definition mdspan.hh:293
│ │ │ │ +
typename extents_type::index_type index_type
Definition mdspan.hh:78
│ │ │ │ +
LayoutPolicy layout_type
Definition mdspan.hh:73
│ │ │ │ +
constexpr bool is_strided() const
Return true only if for every rank index r of extents there exists an integer sr such that,...
Definition mdspan.hh:313
│ │ │ │ +
constexpr mdspan(data_handle_type p, const mapping_type &m)
Construct from the pointer to the data of the tensor and an index mapping.
Definition mdspan.hh:156
│ │ │ │ +
typename extents_type::rank_type rank_type
Definition mdspan.hh:80
│ │ │ │ +
constexpr mdspan(data_handle_type p, const extents_type &e)
Construct from the pointer to the data of the tensor and its extents.
Definition mdspan.hh:149
│ │ │ │ +
std::remove_cv_t< Element > value_type
Definition mdspan.hh:76
│ │ │ │ +
static constexpr bool is_always_exhaustive()
Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such ...
Definition mdspan.hh:296
│ │ │ │ +
constexpr reference operator[](Index index) const
Access specified element at position [i0] For a rank one mdspan, the operator[i] is added to support ...
Definition mdspan.hh:219
│ │ │ │ +
constexpr const extents_type & extents() const noexcept
Number of elements in all dimensions of the tensor,.
Definition mdspan.hh:250
│ │ │ │ +
constexpr index_type extent(rank_type r) const noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdspan.hh:275
│ │ │ │ +
friend constexpr void swap(mdspan &x, mdspan &y) noexcept
Overloads the std::swap algorithm for std::mdspan. Exchanges the state of x with that of y.
Definition mdspan.hh:320
│ │ │ │ +
static constexpr bool is_always_strided()
Return true only if for every rank index r of extents there exists an integer sr such that,...
Definition mdspan.hh:299
│ │ │ │ +
constexpr size_type size() const noexcept
The number of elements accessible by this multi-dimensional span.
Definition mdspan.hh:278
│ │ │ │ +
typename accessor_type::data_handle_type data_handle_type
Definition mdspan.hh:81
│ │ │ │ +
constexpr bool empty() const noexcept
Checks if the size of the index space is zero.
Definition mdspan.hh:287
│ │ │ │ +
constexpr const accessor_type & accessor() const noexcept
The accessor policy object.
Definition mdspan.hh:256
│ │ │ │ +
AccessorPolicy accessor_type
Definition mdspan.hh:74
│ │ │ │ +
constexpr bool is_exhaustive() const
Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such ...
Definition mdspan.hh:306
│ │ │ │ +
static constexpr rank_type rank() noexcept
Number of dimensions of the tensor.
Definition mdspan.hh:266
│ │ │ │ +
static constexpr std::size_t static_extent(rank_type r) noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdspan.hh:272
│ │ │ │ +
constexpr const mapping_type & mapping() const noexcept
Index mapping of a layout policy.
Definition mdspan.hh:253
│ │ │ │ +
constexpr const data_handle_type & data_handle() const noexcept
The pointer to the underlying flat sequence.
Definition mdspan.hh:259
│ │ │ │ +
constexpr index_type stride(rank_type r) const
The stride along the specified dimension.
Definition mdspan.hh:316
│ │ │ │ +
constexpr bool is_unique() const
Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j....
Definition mdspan.hh:302
│ │ │ │ +
constexpr mdspan()
Default constructor value-initializes all members.
Definition mdspan.hh:105
│ │ │ │ +
typename extents_type::size_type size_type
Definition mdspan.hh:79
│ │ │ │ +
typename layout_type::template mapping< extents_type > mapping_type
Definition mdspan.hh:77
│ │ │ │ +
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,307 +1,522 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -mpifuture.hh │ │ │ │ │ + * _s_t_d │ │ │ │ │ +mdspan.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 © 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_COMMON_STD_MDSPAN_HH │ │ │ │ │ +6#define DUNE_COMMON_STD_MDSPAN_HH │ │ │ │ │ 7 │ │ │ │ │ -8#if HAVE_MPI │ │ │ │ │ -9 │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include │ │ │ │ │ -17 │ │ │ │ │ -18#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -19#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> │ │ │ │ │ -20#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> │ │ │ │ │ -21#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> │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#if __has_include() │ │ │ │ │ +12 #include │ │ │ │ │ +13#endif │ │ │ │ │ +14 │ │ │ │ │ +15#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ +16#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ +17#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_e_x_t_e_n_t_s_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_l_a_y_o_u_t___r_i_g_h_t_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ +20 │ │ │ │ │ +21namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ 22 │ │ │ │ │ -23namespace _D_u_n_e{ │ │ │ │ │ -24 │ │ │ │ │ -_2_5 namespace impl{ │ │ │ │ │ -26 template │ │ │ │ │ -_2_7 struct _B_u_f_f_e_r{ │ │ │ │ │ -_2_8 _B_u_f_f_e_r(bool valid){ │ │ │ │ │ -29 if(valid) │ │ │ │ │ -30 _v_a_l_u_e = std::make_unique(); │ │ │ │ │ -31 } │ │ │ │ │ -32 template │ │ │ │ │ -_3_3 _B_u_f_f_e_r(V&& t) │ │ │ │ │ -34 : _v_a_l_u_e(_s_t_d::make_unique(_s_t_d::forward(t))) │ │ │ │ │ -35 {} │ │ │ │ │ -_3_6 std::unique_ptr _v_a_l_u_e; │ │ │ │ │ -_3_7 T _g_e_t(){ │ │ │ │ │ -38 T tmp = std::move(*_v_a_l_u_e); │ │ │ │ │ -39 _v_a_l_u_e.reset(); │ │ │ │ │ -40 return tmp; │ │ │ │ │ -41 } │ │ │ │ │ -_4_2 operator bool () const { │ │ │ │ │ -43 return (bool)_v_a_l_u_e; │ │ │ │ │ -44 } │ │ │ │ │ -_4_5 T& _o_p_e_r_a_t_o_r_ _*() const{ │ │ │ │ │ -46 return *_v_a_l_u_e; │ │ │ │ │ -47 } │ │ │ │ │ -48 }; │ │ │ │ │ -49 │ │ │ │ │ -50 template │ │ │ │ │ -_5_1 struct _B_u_f_f_e_r{ │ │ │ │ │ -_5_2 _B_u_f_f_e_r(bool valid = false) │ │ │ │ │ -53 { │ │ │ │ │ -54 if(valid) │ │ │ │ │ -55 value = T(); │ │ │ │ │ -56 } │ │ │ │ │ -57 template │ │ │ │ │ -_5_8 _B_u_f_f_e_r(V&& t) │ │ │ │ │ -59 : value(_s_t_d::forward(t)) │ │ │ │ │ -60 {} │ │ │ │ │ -_6_1 std::optional> _v_a_l_u_e; │ │ │ │ │ -_6_2 T& _g_e_t(){ │ │ │ │ │ -63 T& tmp = *value; │ │ │ │ │ -64 value.reset(); │ │ │ │ │ -65 return tmp; │ │ │ │ │ -66 } │ │ │ │ │ -_6_7 operator bool () const{ │ │ │ │ │ -68 return (bool)value; │ │ │ │ │ -69 } │ │ │ │ │ -_7_0 T& _o_p_e_r_a_t_o_r_ _*() const{ │ │ │ │ │ -71 return *value; │ │ │ │ │ -72 } │ │ │ │ │ -73 }; │ │ │ │ │ -74 │ │ │ │ │ -75 template<> │ │ │ │ │ -_7_6 struct _B_u_f_f_e_r{ │ │ │ │ │ -_7_7 bool _v_a_l_i_d__; │ │ │ │ │ -_7_8 _B_u_f_f_e_r(bool valid = false) │ │ │ │ │ -79 : valid_(valid) │ │ │ │ │ -80 {} │ │ │ │ │ -_8_1 operator bool () const{ │ │ │ │ │ -82 return valid_; │ │ │ │ │ -83 } │ │ │ │ │ -_8_4 void _g_e_t(){} │ │ │ │ │ -85 }; │ │ │ │ │ -86 } │ │ │ │ │ -87 │ │ │ │ │ -92 template │ │ │ │ │ -_9_3 class _M_P_I_F_u_t_u_r_e{ │ │ │ │ │ -94 mutable MPI_Request req_; │ │ │ │ │ -95 mutable MPI_Status status_; │ │ │ │ │ -96 _i_m_p_l_:_:_B_u_f_f_e_r_<_R_> data_; │ │ │ │ │ -_9_7 _i_m_p_l_:_:_B_u_f_f_e_r_<_S_> send_data_; │ │ │ │ │ -98 friend class _C_o_m_m_u_n_i_c_a_t_i_o_n; │ │ │ │ │ -99 public: │ │ │ │ │ -_1_0_0 _M_P_I_F_u_t_u_r_e(bool _v_a_l_i_d = false) │ │ │ │ │ -101 : req_(MPI_REQUEST_NULL) │ │ │ │ │ -102 , data_(_v_a_l_i_d) │ │ │ │ │ -103 {} │ │ │ │ │ -104 │ │ │ │ │ -105 // Hide this constructor if R or S is void │ │ │ │ │ -106 template │ │ │ │ │ -_1_0_7 _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) : │ │ │ │ │ -108 req_(MPI_REQUEST_NULL) │ │ │ │ │ -109 , data_(_s_t_d::forward(recv_data)) │ │ │ │ │ -110 , send_data_(_s_t_d::forward(send_data)) │ │ │ │ │ -111 {} │ │ │ │ │ -112 │ │ │ │ │ -113 // hide this constructor if R is void │ │ │ │ │ -114 template │ │ │ │ │ -_1_1_5 _M_P_I_F_u_t_u_r_e(V&& recv_data, typename std::enable_if_t:: │ │ │ │ │ -value>* = 0) │ │ │ │ │ -116 : req_(MPI_REQUEST_NULL) │ │ │ │ │ -117 , data_(_s_t_d::forward(recv_data)) │ │ │ │ │ -118 {} │ │ │ │ │ -119 │ │ │ │ │ -_1_2_0 _~_M_P_I_F_u_t_u_r_e() { │ │ │ │ │ -121 if(req_ != MPI_REQUEST_NULL){ │ │ │ │ │ -122 try{ // might fail when it is a collective communication │ │ │ │ │ -123 MPI_Cancel(&req_); │ │ │ │ │ -124 MPI_Request_free(&req_); │ │ │ │ │ -125 }catch(...){ │ │ │ │ │ -126 } │ │ │ │ │ -127 } │ │ │ │ │ -128 } │ │ │ │ │ -129 │ │ │ │ │ -_1_3_0 _M_P_I_F_u_t_u_r_e(_M_P_I_F_u_t_u_r_e&& f) │ │ │ │ │ -131 : req_(MPI_REQUEST_NULL) │ │ │ │ │ -132 , data_(_s_t_d::move(f.data_)) │ │ │ │ │ -133 , send_data_(_s_t_d::move(f.send_data_)) │ │ │ │ │ -134 { │ │ │ │ │ -135 std::swap(req_, f.req_); │ │ │ │ │ -136 std::swap(status_, f.status_); │ │ │ │ │ -137 } │ │ │ │ │ -138 │ │ │ │ │ -_1_3_9 _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){ │ │ │ │ │ -140 std::swap(req_, f.req_); │ │ │ │ │ -141 std::swap(status_, f.status_); │ │ │ │ │ -142 std::swap(data_, f.data_); │ │ │ │ │ -143 std::swap(send_data_, f.send_data_); │ │ │ │ │ -144 return *this; │ │ │ │ │ -145 } │ │ │ │ │ -146 │ │ │ │ │ -_1_4_7 bool _v_a_l_i_d() const{ │ │ │ │ │ -148 return (bool)data_; │ │ │ │ │ -149 } │ │ │ │ │ -150 │ │ │ │ │ -_1_5_1 void _w_a_i_t(){ │ │ │ │ │ -152 if(!_v_a_l_i_d()) │ │ │ │ │ -153 _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!"); │ │ │ │ │ -154 MPI_Wait(&req_, &status_); │ │ │ │ │ -155 } │ │ │ │ │ -156 │ │ │ │ │ -_1_5_7 bool _r_e_a_d_y() const{ │ │ │ │ │ -158 int flag = -1; │ │ │ │ │ -159 MPI_Test(&req_, &flag, &status_); │ │ │ │ │ -160 return flag; │ │ │ │ │ -161 } │ │ │ │ │ -162 │ │ │ │ │ -_1_6_3 R _g_e_t() { │ │ │ │ │ -164 _w_a_i_t(); │ │ │ │ │ -165 return data_.get(); │ │ │ │ │ -166 } │ │ │ │ │ +61template > │ │ │ │ │ +_6_3class _m_d_s_p_a_n │ │ │ │ │ +64{ │ │ │ │ │ +65 static_assert(std::is_object_v); │ │ │ │ │ +66 static_assert(!std::is_abstract_v); │ │ │ │ │ +67 static_assert(!std::is_array_v); │ │ │ │ │ +68 static_assert(std::is_same_v); │ │ │ │ │ +69 │ │ │ │ │ +70public: │ │ │ │ │ +_7_1 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ +_7_2 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ +_7_3 using _l_a_y_o_u_t___t_y_p_e = LayoutPolicy; │ │ │ │ │ +_7_4 using _a_c_c_e_s_s_o_r___t_y_p_e = AccessorPolicy; │ │ │ │ │ +75 │ │ │ │ │ +_7_6 using _v_a_l_u_e___t_y_p_e = std::remove_cv_t; │ │ │ │ │ +_7_7 using _m_a_p_p_i_n_g___t_y_p_e = typename layout_type::template mapping; │ │ │ │ │ +_7_8 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ +_7_9 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ +_8_0 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ +_8_1 using _d_a_t_a___h_a_n_d_l_e___t_y_p_e = typename accessor_type::data_handle_type; │ │ │ │ │ +_8_2 using _r_e_f_e_r_e_n_c_e = typename accessor_type::reference; │ │ │ │ │ +83 │ │ │ │ │ +84private: │ │ │ │ │ +85 // [mdspan.layout.reqmts] │ │ │ │ │ +86 static_assert(std::is_nothrow_move_constructible_v); │ │ │ │ │ +87 static_assert(std::is_nothrow_move_assignable_v); │ │ │ │ │ +88 static_assert(std::is_nothrow_swappable_v); │ │ │ │ │ +89 │ │ │ │ │ +90 // [mdspan.accessor.reqmts] │ │ │ │ │ +91 static_assert(std::is_nothrow_move_constructible_v); │ │ │ │ │ +92 static_assert(std::is_nothrow_move_assignable_v); │ │ │ │ │ +93 static_assert(std::is_nothrow_swappable_v); │ │ │ │ │ +94 │ │ │ │ │ +95public: │ │ │ │ │ +98 │ │ │ │ │ +100 template 0), int> = 0, │ │ │ │ │ +102 std::enable_if_t, int> = 0, │ │ │ │ │ +103 std::enable_if_t, int> = 0, │ │ │ │ │ +104 std::enable_if_t, int> = 0> │ │ │ │ │ +_1_0_5 constexpr _m_d_s_p_a_n () │ │ │ │ │ +106 : data_handle_{} │ │ │ │ │ +107 , mapping_{} │ │ │ │ │ +108 , accessor_{} │ │ │ │ │ +109 {} │ │ │ │ │ +110 │ │ │ │ │ +112 template = 0, │ │ │ │ │ +115 std::enable_if_t<(... && std::is_convertible_v), │ │ │ │ │ +int> = 0, │ │ │ │ │ +116 std::enable_if_t<(... && std::is_nothrow_constructible_v), int> = 0, │ │ │ │ │ +117 std::enable_if_t, int> = 0, │ │ │ │ │ +118 std::enable_if_t, int> = 0> │ │ │ │ │ +_1_1_9 explicit constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, IndexTypes... exts) │ │ │ │ │ +120 : _m_d_s_p_a_n(std::move(p), _e_x_t_e_n_t_s___t_y_p_e(_i_n_d_e_x___t_y_p_e(std::move(exts))...)) │ │ │ │ │ +121 {} │ │ │ │ │ +122 │ │ │ │ │ +124 template , int> │ │ │ │ │ += 0, │ │ │ │ │ +126 std::enable_if_t, int> = 0, │ │ │ │ │ +127 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type:: │ │ │ │ │ +rank()), int> = 0> │ │ │ │ │ +128 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +129 explicit(N != extents_type::rank_dynamic()) │ │ │ │ │ +130 #endif │ │ │ │ │ +_1_3_1 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, _S_t_d_:_:_s_p_a_n_<_I_n_d_e_x_T_y_p_e_,_N_> exts) │ │ │ │ │ +132 : _m_d_s_p_a_n(std::move(p), _e_x_t_e_n_t_s___t_y_p_e(exts)) │ │ │ │ │ +133 {} │ │ │ │ │ +134 │ │ │ │ │ +136 template , int> = 0, │ │ │ │ │ +138 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type:: │ │ │ │ │ +rank()), int> = 0> │ │ │ │ │ +139 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +140 explicit(N != extents_type::rank_dynamic()) │ │ │ │ │ +141 #endif │ │ │ │ │ +_1_4_2 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const std::array& exts) │ │ │ │ │ +143 : _m_d_s_p_a_n(std::move(p), _e_x_t_e_n_t_s___t_y_p_e(exts)) │ │ │ │ │ +144 {} │ │ │ │ │ +145 │ │ │ │ │ +147 template , int> = 0> │ │ │ │ │ +_1_4_9 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const _e_x_t_e_n_t_s___t_y_p_e& e) │ │ │ │ │ +150 : _m_d_s_p_a_n(_s_t_d::move(p), _m_a_p_p_i_n_g___t_y_p_e(e)) │ │ │ │ │ +151 {} │ │ │ │ │ +152 │ │ │ │ │ +154 template , int> = 0> │ │ │ │ │ +_1_5_6 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const _m_a_p_p_i_n_g___t_y_p_e& m) │ │ │ │ │ +157 : _m_d_s_p_a_n(_s_t_d::move(p), m, _a_c_c_e_s_s_o_r___t_y_p_e{}) │ │ │ │ │ +158 {} │ │ │ │ │ +159 │ │ │ │ │ +_1_6_1 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const _m_a_p_p_i_n_g___t_y_p_e& m, const │ │ │ │ │ +_a_c_c_e_s_s_o_r___t_y_p_e& a) │ │ │ │ │ +162 : data_handle_(_s_t_d::move(p)) │ │ │ │ │ +163 , mapping_(m) │ │ │ │ │ +164 , accessor_(a) │ │ │ │ │ +165 {} │ │ │ │ │ +166 │ │ │ │ │ 167 │ │ │ │ │ -_1_6_8 S _g_e_t___s_e_n_d___d_a_t_a(){ │ │ │ │ │ -169 _w_a_i_t(); │ │ │ │ │ -170 return send_data_._g_e_t(); │ │ │ │ │ -171 } │ │ │ │ │ -172 │ │ │ │ │ -_1_7_3 auto _g_e_t___m_p_i_d_a_t_a(){ │ │ │ │ │ -174 return _g_e_t_M_P_I_D_a_t_a(*data_); │ │ │ │ │ -175 } │ │ │ │ │ -176 │ │ │ │ │ -_1_7_7 auto _g_e_t___s_e_n_d___m_p_i_d_a_t_a(){ │ │ │ │ │ -178 return _g_e_t_M_P_I_D_a_t_a(*send_data_); │ │ │ │ │ -179 } │ │ │ │ │ -180 }; │ │ │ │ │ -181 │ │ │ │ │ -182} │ │ │ │ │ -183#endif // HAVE_MPI │ │ │ │ │ -184#endif // DUNE_COMMON_PARALLEL_MPIFUTURE_HH │ │ │ │ │ -_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. │ │ │ │ │ -_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_:_:_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 │ │ │ │ │ +169 template &>, int> = 0, │ │ │ │ │ +171 std::enable_if_t, int> = 0> │ │ │ │ │ +172 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ +173 explicit(!std::is_convertible_v&, _m_a_p_p_i_n_g___t_y_p_e> │ │ │ │ │ +174 || !std::is_convertible_v) │ │ │ │ │ +175 #endif │ │ │ │ │ +_1_7_6 constexpr _m_d_s_p_a_n (const │ │ │ │ │ +_m_d_s_p_a_n_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_O_t_h_e_r_E_x_t_e_n_d_s_,_O_t_h_e_r_L_a_y_o_u_t_P_o_l_i_c_y_,_O_t_h_e_r_A_c_c_e_s_s_o_r_>& other) │ │ │ │ │ +noexcept │ │ │ │ │ +177 : _m_d_s_p_a_n(_d_a_t_a___h_a_n_d_l_e___t_y_p_e(other._d_a_t_a___h_a_n_d_l_e()), _m_a_p_p_i_n_g___t_y_p_e(other._m_a_p_p_i_n_g │ │ │ │ │ +()), │ │ │ │ │ +178 _a_c_c_e_s_s_o_r___t_y_p_e(other._a_c_c_e_s_s_o_r())) │ │ │ │ │ +179 {} │ │ │ │ │ +180 │ │ │ │ │ +182 │ │ │ │ │ +183 │ │ │ │ │ +186 │ │ │ │ │ +191 template = 0, │ │ │ │ │ +193 std::enable_if_t<(... && std::is_convertible_v), int> │ │ │ │ │ += 0, │ │ │ │ │ +194 std::enable_if_t<(... && std:: │ │ │ │ │ +is_nothrow_constructible_v), int> = 0> │ │ │ │ │ +_1_9_5 constexpr _r_e_f_e_r_e_n_c_e operator() (Indices... indices) const │ │ │ │ │ +196 { │ │ │ │ │ +197 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(std::move │ │ │ │ │ +(indices))...)); │ │ │ │ │ +198 } │ │ │ │ │ +199 │ │ │ │ │ +200#if __cpp_multidimensional_subscript >= 202110L │ │ │ │ │ +201 │ │ │ │ │ +203 template = 0, │ │ │ │ │ +205 std::enable_if_t<(... && std::is_convertible_v), int> │ │ │ │ │ += 0, │ │ │ │ │ +206 std::enable_if_t<(... && std:: │ │ │ │ │ +is_nothrow_constructible_v), int> = 0> │ │ │ │ │ +207 constexpr _r_e_f_e_r_e_n_c_e operator[] (Indices... indices) const │ │ │ │ │ +208 { │ │ │ │ │ +209 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(std::move │ │ │ │ │ +(indices))...)); │ │ │ │ │ +210 } │ │ │ │ │ +211 │ │ │ │ │ +212#else // __cpp_multidimensional_subscript │ │ │ │ │ +213 │ │ │ │ │ +216 template , int> = 0, │ │ │ │ │ +218 std::enable_if_t<(E::rank() == 1), int> = 0> │ │ │ │ │ +_2_1_9 constexpr _r_e_f_e_r_e_n_c_e operator[] (Index index) const │ │ │ │ │ +220 { │ │ │ │ │ +221 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(std::move │ │ │ │ │ +(index)))); │ │ │ │ │ +222 } │ │ │ │ │ +223 │ │ │ │ │ +224#endif // __cpp_multidimensional_subscript │ │ │ │ │ +225 │ │ │ │ │ +227 template , int> = 0, │ │ │ │ │ +229 std::enable_if_t, │ │ │ │ │ +int> = 0> │ │ │ │ │ +_2_3_0 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (_S_t_d_:_:_s_p_a_n │ │ │ │ │ +indices) const │ │ │ │ │ +231 { │ │ │ │ │ +232 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ +233 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(indices │ │ │ │ │ +[ii])...)); }, │ │ │ │ │ +234 std::make_index_sequence{}); │ │ │ │ │ +235 } │ │ │ │ │ +236 │ │ │ │ │ +238 template , int> = 0, │ │ │ │ │ +240 std::enable_if_t, │ │ │ │ │ +int> = 0> │ │ │ │ │ +_2_4_1 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (const std::array& indices) const │ │ │ │ │ +242 { │ │ │ │ │ +243 return std::apply([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ +244 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(ii)...)); }, │ │ │ │ │ +indices); │ │ │ │ │ +245 } │ │ │ │ │ +246 │ │ │ │ │ +248 │ │ │ │ │ +_2_5_0 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return │ │ │ │ │ +mapping_.extents(); } │ │ │ │ │ +251 │ │ │ │ │ +_2_5_3 constexpr const _m_a_p_p_i_n_g___t_y_p_e& _m_a_p_p_i_n_g () const noexcept { return mapping_; │ │ │ │ │ +} │ │ │ │ │ +254 │ │ │ │ │ +_2_5_6 constexpr const _a_c_c_e_s_s_o_r___t_y_p_e& _a_c_c_e_s_s_o_r () const noexcept { return │ │ │ │ │ +accessor_; } │ │ │ │ │ +257 │ │ │ │ │ +_2_5_9 constexpr const _d_a_t_a___h_a_n_d_l_e___t_y_p_e& _d_a_t_a___h_a_n_d_l_e () const noexcept { return │ │ │ │ │ +data_handle_; }; │ │ │ │ │ +260 │ │ │ │ │ +261 │ │ │ │ │ +264 │ │ │ │ │ +_2_6_6 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k () noexcept { return extents_type::rank(); │ │ │ │ │ +} │ │ │ │ │ +267 │ │ │ │ │ +_2_6_9 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k___d_y_n_a_m_i_c () noexcept { return extents_type:: │ │ │ │ │ +rank_dynamic(); } │ │ │ │ │ +270 │ │ │ │ │ +_2_7_2 static constexpr std::size_t _s_t_a_t_i_c___e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) noexcept { return │ │ │ │ │ +extents_type::static_extent(r); } │ │ │ │ │ +273 │ │ │ │ │ +_2_7_5 constexpr _i_n_d_e_x___t_y_p_e _e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) const noexcept { return _e_x_t_e_n_t_s │ │ │ │ │ +().extent(r); } │ │ │ │ │ +276 │ │ │ │ │ +_2_7_8 constexpr _s_i_z_e___t_y_p_e _s_i_z_e () const noexcept │ │ │ │ │ +279 { │ │ │ │ │ +280 _s_i_z_e___t_y_p_e s = 1; │ │ │ │ │ +281 for (_r_a_n_k___t_y_p_e r = 0; r < _r_a_n_k(); ++r) │ │ │ │ │ +282 s *= _e_x_t_e_n_t(r); │ │ │ │ │ +283 return s; │ │ │ │ │ +284 } │ │ │ │ │ +285 │ │ │ │ │ +_2_8_7 [[nodiscard]] constexpr bool _e_m_p_t_y () const noexcept { return _s_i_z_e() == 0; │ │ │ │ │ +} │ │ │ │ │ +288 │ │ │ │ │ +290 │ │ │ │ │ +291 │ │ │ │ │ +_2_9_3 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () { return mapping_type:: │ │ │ │ │ +is_always_unique(); } │ │ │ │ │ +294 │ │ │ │ │ +_2_9_6 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () { return mapping_type:: │ │ │ │ │ +is_always_exhaustive(); } │ │ │ │ │ +297 │ │ │ │ │ +_2_9_9 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () { return mapping_type:: │ │ │ │ │ +is_always_strided(); } │ │ │ │ │ +300 │ │ │ │ │ +_3_0_2 constexpr bool _i_s___u_n_i_q_u_e () const { return mapping_.is_unique(); } │ │ │ │ │ +303 │ │ │ │ │ +_3_0_6 constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () const { return mapping_.is_exhaustive(); } │ │ │ │ │ +307 │ │ │ │ │ +_3_1_3 constexpr bool _i_s___s_t_r_i_d_e_d () const { return mapping_.is_strided(); } │ │ │ │ │ +314 │ │ │ │ │ +_3_1_6 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e r) const { return mapping_.stride │ │ │ │ │ +(r); } │ │ │ │ │ +317 │ │ │ │ │ +318 │ │ │ │ │ +_3_2_0 friend constexpr void _s_w_a_p (_m_d_s_p_a_n& x, _m_d_s_p_a_n& y) noexcept │ │ │ │ │ +321 { │ │ │ │ │ +322 using std::swap; │ │ │ │ │ +323 _s_w_a_p(x.data_handle_, y.data_handle_); │ │ │ │ │ +324 _s_w_a_p(x.mapping_, y.mapping_); │ │ │ │ │ +325 _s_w_a_p(x.accessor_, y.accessor_); │ │ │ │ │ +326 } │ │ │ │ │ +327 │ │ │ │ │ +328 │ │ │ │ │ +329private: │ │ │ │ │ +330 _d_a_t_a___h_a_n_d_l_e___t_y_p_e data_handle_; │ │ │ │ │ +331 [[no_unique_address]] _m_a_p_p_i_n_g___t_y_p_e mapping_; │ │ │ │ │ +332 [[no_unique_address]] _a_c_c_e_s_s_o_r___t_y_p_e accessor_; │ │ │ │ │ +333}; │ │ │ │ │ +334 │ │ │ │ │ +335// deduction guides │ │ │ │ │ +336// @{ │ │ │ │ │ +337 │ │ │ │ │ +338template , int> = 0, │ │ │ │ │ +340 std::enable_if_t<(std::rank_v == 1), int> = 0> │ │ │ │ │ +_3_4_1_m_d_s_p_a_n (CArray&) │ │ │ │ │ +342 -> _m_d_s_p_a_n_<_s_t_d_:_:_r_e_m_o_v_e___a_l_l___e_x_t_e_n_t_s___t_<_C_A_r_r_a_y_>, _S_t_d_:_:_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_, │ │ │ │ │ +_s_t_d_:_:_e_x_t_e_n_t___v_<_C_A_r_r_a_y_,_0_>>>; │ │ │ │ │ +343 │ │ │ │ │ +344template >, int> │ │ │ │ │ += 0> │ │ │ │ │ +_3_4_6_m_d_s_p_a_n (Pointer&&) │ │ │ │ │ +347 -> _m_d_s_p_a_n_<_s_t_d_:_:_r_e_m_o_v_e___p_o_i_n_t_e_r___t_<_s_t_d_:_:_r_e_m_o_v_e___r_e_f_e_r_e_n_c_e___t_<_P_o_i_n_t_e_r_>>, _S_t_d_:_: │ │ │ │ │ +_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_>>; │ │ │ │ │ +348 │ │ │ │ │ +349template ), int> = 0, │ │ │ │ │ +351 std::enable_if_t<(sizeof...(II) > 0), int> = 0> │ │ │ │ │ +_3_5_2_m_d_s_p_a_n (ElementType*, II...) │ │ │ │ │ +353 -> _m_d_s_p_a_n>; │ │ │ │ │ +354 │ │ │ │ │ +355template │ │ │ │ │ +_3_5_6_m_d_s_p_a_n (ElementType*, _S_t_d_:_:_s_p_a_n_<_S_i_z_e_T_y_p_e_,_N_>&) │ │ │ │ │ +357 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _S_t_d_:_:_d_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_,_ _N_>>; │ │ │ │ │ +358 │ │ │ │ │ +359template │ │ │ │ │ +_3_6_0_m_d_s_p_a_n (ElementType*, const std::array&) │ │ │ │ │ +361 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _S_t_d_:_:_d_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_,_ _N_>>; │ │ │ │ │ +362 │ │ │ │ │ +363template │ │ │ │ │ +_3_6_4_m_d_s_p_a_n (ElementType*, const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_e_x_t_s_._._._>&) │ │ │ │ │ +365 -> _m_d_s_p_a_n>; │ │ │ │ │ +366 │ │ │ │ │ +367template │ │ │ │ │ +_3_7_0_m_d_s_p_a_n (ElementType*, const Mapping&) │ │ │ │ │ +371 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_>; │ │ │ │ │ +372 │ │ │ │ │ +373template │ │ │ │ │ +_3_7_8_m_d_s_p_a_n (const DataHandle&, const Mapping&, const Accessor&) │ │ │ │ │ +379 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _A_c_c_e_s_s_o_r_>; │ │ │ │ │ +380 │ │ │ │ │ +381// @} │ │ │ │ │ +382 │ │ │ │ │ +383} // end namespace Dune::Std │ │ │ │ │ +384 │ │ │ │ │ +385#endif // DUNE_COMMON_STD_MDSPAN_HH │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_e_x_t_e_n_t_s_._h_h │ │ │ │ │ +_s_p_a_n_._h_h │ │ │ │ │ +_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h │ │ │ │ │ +_l_a_y_o_u_t___r_i_g_h_t_._h_h │ │ │ │ │ +_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:124 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_d_e_x_t_e_n_t_s │ │ │ │ │ +typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std:: │ │ │ │ │ +size_t, R > >::type dextents │ │ │ │ │ +Alias of extents of given rank R and purely dynamic extents. See │ │ │ │ │ +[mdspan.extents.dextents]. │ │ │ │ │ +DDeeffiinniittiioonn extents.hh:259 │ │ │ │ │ _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:44 │ │ │ │ │ -_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:20 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:27 │ │ │ │ │ -_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:36 │ │ │ │ │ -_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:45 │ │ │ │ │ -_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:33 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_:_:_g_e_t │ │ │ │ │ -T get() │ │ │ │ │ -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(bool valid) │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:28 │ │ │ │ │ -_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:61 │ │ │ │ │ -_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:52 │ │ │ │ │ -_D_u_n_e_:_:_i_m_p_l_:_:_B_u_f_f_e_r_<_ _T_ _&_ _>_:_:_g_e_t │ │ │ │ │ -T & get() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:62 │ │ │ │ │ -_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:58 │ │ │ │ │ -_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:77 │ │ │ │ │ -_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:84 │ │ │ │ │ -_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:78 │ │ │ │ │ -_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:93 │ │ │ │ │ -_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:115 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_r_e_a_d_y │ │ │ │ │ -bool ready() const │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:157 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_v_a_l_i_d │ │ │ │ │ -bool valid() const │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:147 │ │ │ │ │ -_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:120 │ │ │ │ │ -_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:100 │ │ │ │ │ -_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:139 │ │ │ │ │ -_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:177 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_w_a_i_t │ │ │ │ │ -void wait() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:151 │ │ │ │ │ -_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:173 │ │ │ │ │ -_D_u_n_e_:_:_M_P_I_F_u_t_u_r_e_:_:_g_e_t │ │ │ │ │ -R get() │ │ │ │ │ -DDeeffiinniittiioonn mpifuture.hh:163 │ │ │ │ │ -_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:107 │ │ │ │ │ -_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:168 │ │ │ │ │ -_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:130 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d │ │ │ │ │ +Namespace for features backported from new C++ standards. │ │ │ │ │ +DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s │ │ │ │ │ +Multidimensional index space with dynamic and static extents. │ │ │ │ │ +DDeeffiinniittiioonn extents.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n │ │ │ │ │ +A multi-dimensional non-owning array view. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +typename accessor_type::reference reference │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ +Element element_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ +constexpr mdspan(data_handle_type p, const mapping_type &m, const accessor_type │ │ │ │ │ +&a) │ │ │ │ │ +Construct from the pointer to the data of the tensor, an index mapping, and an │ │ │ │ │ +accessor. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:161 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ +Extents extents_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_a_n_k___d_y_n_a_m_i_c │ │ │ │ │ +static constexpr rank_type rank_dynamic() noexcept │ │ │ │ │ +Number of dimensions of the tensor. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:269 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ +static constexpr bool is_always_unique() │ │ │ │ │ +Return true only if for every i and j where (i != j || ...) => mapping(i...) != │ │ │ │ │ +mapping(j.... │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ +typename extents_type::index_type index_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_l_a_y_o_u_t___t_y_p_e │ │ │ │ │ +LayoutPolicy layout_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ +constexpr bool is_strided() const │ │ │ │ │ +Return true only if for every rank index r of extents there exists an integer │ │ │ │ │ +sr such that,... │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:313 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ +constexpr mdspan(data_handle_type p, const mapping_type &m) │ │ │ │ │ +Construct from the pointer to the data of the tensor and an index mapping. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:156 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ +typename extents_type::rank_type rank_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ +constexpr mdspan(data_handle_type p, const extents_type &e) │ │ │ │ │ +Construct from the pointer to the data of the tensor and its extents. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +std::remove_cv_t< Element > value_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +static constexpr bool is_always_exhaustive() │ │ │ │ │ +Return true only if for all k in the range [0, mapping.required_span_size() ) │ │ │ │ │ +there exists an i such ... │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:296 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +constexpr reference operator[](Index index) const │ │ │ │ │ +Access specified element at position [i0] For a rank one mdspan, the operator │ │ │ │ │ +[i] is added to support ... │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t_s │ │ │ │ │ +constexpr const extents_type & extents() const noexcept │ │ │ │ │ +Number of elements in all dimensions of the tensor,. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t │ │ │ │ │ +constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ +Number of elements in the r'th dimension of the tensor. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_w_a_p │ │ │ │ │ +friend constexpr void swap(mdspan &x, mdspan &y) noexcept │ │ │ │ │ +Overloads the std::swap algorithm for std::mdspan. Exchanges the state of x │ │ │ │ │ +with that of y. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:320 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ +static constexpr bool is_always_strided() │ │ │ │ │ +Return true only if for every rank index r of extents there exists an integer │ │ │ │ │ +sr such that,... │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:299 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_i_z_e │ │ │ │ │ +constexpr size_type size() const noexcept │ │ │ │ │ +The number of elements accessible by this multi-dimensional span. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_d_a_t_a___h_a_n_d_l_e___t_y_p_e │ │ │ │ │ +typename accessor_type::data_handle_type data_handle_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_m_p_t_y │ │ │ │ │ +constexpr bool empty() const noexcept │ │ │ │ │ +Checks if the size of the index space is zero. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:287 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_a_c_c_e_s_s_o_r │ │ │ │ │ +constexpr const accessor_type & accessor() const noexcept │ │ │ │ │ +The accessor policy object. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:256 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_a_c_c_e_s_s_o_r___t_y_p_e │ │ │ │ │ +AccessorPolicy accessor_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ +constexpr bool is_exhaustive() const │ │ │ │ │ +Return true only if for all k in the range [0, mapping.required_span_size() ) │ │ │ │ │ +there exists an i such ... │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:306 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_a_n_k │ │ │ │ │ +static constexpr rank_type rank() noexcept │ │ │ │ │ +Number of dimensions of the tensor. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:266 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_t_a_t_i_c___e_x_t_e_n_t │ │ │ │ │ +static constexpr std::size_t static_extent(rank_type r) noexcept │ │ │ │ │ +Number of elements in the r'th dimension of the tensor. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:272 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_a_p_p_i_n_g │ │ │ │ │ +constexpr const mapping_type & mapping() const noexcept │ │ │ │ │ +Index mapping of a layout policy. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:253 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_d_a_t_a___h_a_n_d_l_e │ │ │ │ │ +constexpr const data_handle_type & data_handle() const noexcept │ │ │ │ │ +The pointer to the underlying flat sequence. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_t_r_i_d_e │ │ │ │ │ +constexpr index_type stride(rank_type r) const │ │ │ │ │ +The stride along the specified dimension. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:316 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ +constexpr bool is_unique() const │ │ │ │ │ +Return true only if for every i and j where (i != j || ...) => mapping(i...) != │ │ │ │ │ +mapping(j.... │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:302 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ +constexpr mdspan() │ │ │ │ │ +Default constructor value-initializes all members. │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename extents_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:79 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_a_p_p_i_n_g___t_y_p_e │ │ │ │ │ +typename layout_type::template mapping< extents_type > mapping_type │ │ │ │ │ +DDeeffiinniittiioonn mdspan.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ +A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ +DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: remoteindices.hh File Reference │ │ │ │ +dune-common: concept.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,90 +65,95 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ - │ │ │ │ +
concept.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Classes describing a distributed indexset. │ │ │ │ +

Infrastructure for concepts. │ │ │ │ More...

│ │ │ │ -
#include <cassert>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <map>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <set>
│ │ │ │ -#include <tuple>
│ │ │ │ +
#include <type_traits>
│ │ │ │ #include <utility>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <mpi.h>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/sllist.hh>
│ │ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ │ -#include <dune/common/parallel/indexset.hh>
│ │ │ │ -#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ -#include <dune/common/parallel/plocalindex.hh>
│ │ │ │ +#include <tuple>
│ │ │ │ +#include <dune/common/typeutilities.hh>
│ │ │ │ +#include <dune/common/typelist.hh>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +#include <dune/common/std/type_traits.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::MPITraits< IndexPair< TG, ParallelLocalIndex< TA > > >
 
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...
struct  Dune::Concept::Refines< BaseConcepts >
 Base class for refined concepts. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Namespaces

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

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

Detailed Description

│ │ │ │ -

Classes describing a distributed indexset.

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

Infrastructure for concepts.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,73 +1,78 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ +concept.hh File Reference │ │ │ │ │ +Infrastructure for concepts. _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> │ │ │ │ │ -#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> │ │ │ │ │ -#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 │ │ │ │ │ +#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_/_i_n_d_i_c_e_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 │ │ │ │ │ -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_:_:_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_._._. │ │ │ │ │ -  │ │ │ │ │ -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_._._. │ │ │ │ │ -  │ │ │ │ │ -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_._._. │ │ │ │ │ -  │ │ │ │ │ -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 │ │ │ │ │ -  │ │ │ │ │ -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_._._. │ │ │ │ │ -  │ │ │ │ │ -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_._._. │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ 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. │ │ │ │ │ +  │ │ │ │ │ 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) │ │ │ │ │ +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 () │ │ │ │ │ +  │ │ │ │ │ +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 () │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Classes describing a distributed indexset. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +Infrastructure for concepts. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: remoteindices.hh Source File │ │ │ │ +dune-common: concept.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1698 +70,317 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
remoteindices.hh
│ │ │ │ +
concept.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 © 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_REMOTEINDICES_HH
│ │ │ │ -
6#define DUNE_COMMON_PARALLEL_REMOTEINDICES_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_CONCEPT_HH
│ │ │ │ +
6#define DUNE_COMMON_CONCEPT_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 <tuple>
│ │ │ │ -
17#include <utility>
│ │ │ │ -
18#include <vector>
│ │ │ │ -
19
│ │ │ │ -
20#include <mpi.h>
│ │ │ │ -
21
│ │ │ │ - │ │ │ │ -
23#include <dune/common/sllist.hh>
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
28
│ │ │ │ -
29namespace Dune {
│ │ │ │ -
41 template<typename TG, typename TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
43 {
│ │ │ │ -
44 public:
│ │ │ │ -
45 inline static MPI_Datatype getType();
│ │ │ │ -
46 private:
│ │ │ │ -
47 static MPI_Datatype type;
│ │ │ │ -
48 };
│ │ │ │ -
│ │ │ │ -
49
│ │ │ │ -
50
│ │ │ │ -
51 template<typename T, typename A>
│ │ │ │ -
52 class RemoteIndices;
│ │ │ │ -
53
│ │ │ │ -
54 template<typename T1, typename T2>
│ │ │ │ -
55 class RemoteIndex;
│ │ │ │ -
56
│ │ │ │ -
57 // forward declaration needed for friend declaration.
│ │ │ │ -
58 template<typename T>
│ │ │ │ -
59 class IndicesSyncer;
│ │ │ │ +
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
│ │ │ │ -
61 template<typename T1, typename T2>
│ │ │ │ -
62 std::ostream& operator<<(std::ostream& os, const RemoteIndex<T1,T2>& index);
│ │ │ │ -
63
│ │ │ │ -
64
│ │ │ │ -
65 template<typename T, typename A, bool mode>
│ │ │ │ - │ │ │ │ +
61namespace Impl {
│ │ │ │ +
62
│ │ │ │ +
63 // #############################################################################
│ │ │ │ +
64 // # All functions following here are implementation details
│ │ │ │ +
65 // # for the models() function below.
│ │ │ │ +
66 // #############################################################################
│ │ │ │
67
│ │ │ │ -
68
│ │ │ │ -
72 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
74 {
│ │ │ │ -
75 template<typename T>
│ │ │ │ -
76 friend class IndicesSyncer;
│ │ │ │ -
77
│ │ │ │ -
78 template<typename T, typename A, typename A1>
│ │ │ │ -
79 friend void repairLocalIndexPointers(std::map<int,SLList<std::pair<typename T::GlobalIndex, typename T::LocalIndex::Attribute>,A> >&,
│ │ │ │ - │ │ │ │ -
81 const T&);
│ │ │ │ -
82
│ │ │ │ -
83 template<typename T, typename A, bool mode>
│ │ │ │ - │ │ │ │ -
85
│ │ │ │ -
86 public:
│ │ │ │ -
91 typedef T1 GlobalIndex;
│ │ │ │ -
100 typedef T2 Attribute;
│ │ │ │ -
101
│ │ │ │ - │ │ │ │ - │ │ │ │ -
107
│ │ │ │ -
112 const Attribute attribute() const;
│ │ │ │ +
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 {}; }
│ │ │ │ +
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
│ │ │ │
113
│ │ │ │ -
119 const PairType& localIndexPair() const;
│ │ │ │ -
120
│ │ │ │ -
124 RemoteIndex();
│ │ │ │ -
125
│ │ │ │ -
126
│ │ │ │ -
132 RemoteIndex(const T2& attribute,
│ │ │ │ -
133 const PairType* local);
│ │ │ │ -
134
│ │ │ │ -
135
│ │ │ │ -
141 RemoteIndex(const T2& attribute);
│ │ │ │ -
142
│ │ │ │ -
143 bool operator==(const RemoteIndex& ri) const;
│ │ │ │ -
144
│ │ │ │ -
145 bool operator!=(const RemoteIndex& ri) const;
│ │ │ │ -
146 private:
│ │ │ │ -
148 const PairType* localIndex_;
│ │ │ │ +
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
│ │ │ │ -
151 char attribute_;
│ │ │ │ -
152 };
│ │ │ │ +
150} // namespace Dune::Concept
│ │ │ │
│ │ │ │ +
151
│ │ │ │ +
152
│ │ │ │
153
│ │ │ │ -
154 template<class T, class A>
│ │ │ │ -
155 std::ostream& operator<<(std::ostream& os, const RemoteIndices<T,A>& indices);
│ │ │ │ -
156
│ │ │ │ -
157 class InterfaceBuilder;
│ │ │ │ -
158
│ │ │ │ -
159 template<class T, class A>
│ │ │ │ -
160 class CollectiveIterator;
│ │ │ │ -
161
│ │ │ │ -
162 // forward declaration needed for friend declaration.
│ │ │ │ -
163 template<class T>
│ │ │ │ -
164 class IndicesSyncer;
│ │ │ │ -
165
│ │ │ │ -
166 // forward declaration needed for friend declaration.
│ │ │ │ -
167 template<typename T1, typename T2>
│ │ │ │ - │ │ │ │ -
169
│ │ │ │ -
170
│ │ │ │ -
187 template<class T, class A=std::allocator<RemoteIndex<typename T::GlobalIndex,
│ │ │ │ -
188 typename T::LocalIndex::Attribute> > >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
190 {
│ │ │ │ -
191 friend class InterfaceBuilder;
│ │ │ │ -
192 friend class IndicesSyncer<T>;
│ │ │ │ -
193 template<typename T1, typename A2, typename A1>
│ │ │ │ -
194 friend void repairLocalIndexPointers(std::map<int,SLList<std::pair<typename T1::GlobalIndex, typename T1::LocalIndex::Attribute>,A2> >&,
│ │ │ │ - │ │ │ │ -
196 const T1&);
│ │ │ │ +
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// #############################################################################
│ │ │ │ +
194// # The method tupleEntriesModel() does the actual check if the types in a tuple
│ │ │ │ +
195// # model a concept using the implementation details above.
│ │ │ │ +
196// #############################################################################
│ │ │ │
197
│ │ │ │ -
198 template<class G, class T1, class T2>
│ │ │ │ - │ │ │ │ -
200 friend std::ostream& operator<<<>(std::ostream&, const RemoteIndices<T>&);
│ │ │ │ -
201
│ │ │ │ -
202 public:
│ │ │ │ -
203
│ │ │ │ - │ │ │ │ -
208
│ │ │ │ - │ │ │ │ -
212
│ │ │ │ - │ │ │ │ -
217
│ │ │ │ -
218
│ │ │ │ - │ │ │ │ -
223
│ │ │ │ -
227 typedef typename LocalIndex::Attribute Attribute;
│ │ │ │ -
228
│ │ │ │ - │ │ │ │ -
233
│ │ │ │ +
198template<class C, class Tuple>
│ │ │ │ +
│ │ │ │ +
199constexpr auto tupleEntriesModel()
│ │ │ │ +
200{
│ │ │ │ +
201 return Dune::unpackIntegerSequence([&](auto... i) {
│ │ │ │ +
202 return std::conjunction<decltype(Dune::models<C, std::tuple_element_t<decltype(i)::value, Tuple>>())...>();
│ │ │ │ +
203 }, std::make_index_sequence<std::tuple_size_v<Tuple>>());
│ │ │ │ +
204}
│ │ │ │ +
│ │ │ │ +
205
│ │ │ │ +
206// #############################################################################
│ │ │ │ +
207// # The following require*() functions are just helpers that allow to
│ │ │ │ +
208// # propagate a failed check as substitution failure. This is useful
│ │ │ │ +
209// # inside of a concept definition.
│ │ │ │ +
210// #############################################################################
│ │ │ │ +
211
│ │ │ │ +
212// Helper function for use in concept definitions.
│ │ │ │ +
213// If the passed value b is not true, the concept will to be satisfied.
│ │ │ │ +
214template<bool b, typename std::enable_if<b, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
215constexpr bool requireTrue()
│ │ │ │ +
216{
│ │ │ │ +
217 return true;
│ │ │ │ +
218}
│ │ │ │ +
│ │ │ │ +
219
│ │ │ │ +
220// Helper function for use in concept definitions.
│ │ │ │ +
221template<class C, class... T, typename std::enable_if<models<C, T...>(), int>::type = 0>
│ │ │ │ +
│ │ │ │ +
222constexpr bool requireConcept()
│ │ │ │ +
223{
│ │ │ │ +
224 return true;
│ │ │ │ +
225}
│ │ │ │ +
│ │ │ │ +
226
│ │ │ │ +
227// Helper function for use in concept definitions.
│ │ │ │ +
228// This allows to avoid using decltype
│ │ │ │ +
229template<class C, class... T, typename std::enable_if<models<C, T...>(), int>::type = 0>
│ │ │ │ +
│ │ │ │ +
230constexpr bool requireConcept(T&&... /*t*/)
│ │ │ │ +
231{
│ │ │ │ +
232 return true;
│ │ │ │ +
233}
│ │ │ │ +
│ │ │ │
234
│ │ │ │ -
238 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<RemoteIndex>;
│ │ │ │ -
239
│ │ │ │ - │ │ │ │ - │ │ │ │ -
243
│ │ │ │ -
245 typedef std::map<int, std::pair<RemoteIndexList*,RemoteIndexList*> >
│ │ │ │ - │ │ │ │ -
247
│ │ │ │ -
248 typedef typename RemoteIndexMap::const_iterator const_iterator;
│ │ │ │ -
249
│ │ │ │ -
267 inline RemoteIndices(const ParallelIndexSet& source, const ParallelIndexSet& destination,
│ │ │ │ -
268 const MPI_Comm& comm, const std::vector<int>& neighbours=std::vector<int>(), bool includeSelf=false);
│ │ │ │ -
269
│ │ │ │ - │ │ │ │ -
271
│ │ │ │ -
279 void setIncludeSelf(bool includeSelf);
│ │ │ │ -
280
│ │ │ │ -
297 void setIndexSets(const ParallelIndexSet& source, const ParallelIndexSet& destination,
│ │ │ │ -
298 const MPI_Comm& comm, const std::vector<int>& neighbours=std::vector<int>());
│ │ │ │ +
235// Helper function for use in concept definitions.
│ │ │ │ +
236// This checks if the concept given as first type is modelled by all types in the tuple passed as argument
│ │ │ │ +
237template<class C, class Tuple, typename std::enable_if<tupleEntriesModel<C, Tuple>(), int>::type = 0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
239{
│ │ │ │ +
240 return true;
│ │ │ │ +
241}
│ │ │ │ +
│ │ │ │ +
242
│ │ │ │ +
243// Helper function for use in concept definitions.
│ │ │ │ +
244// If the first passed type is not convertible to the second, the concept will not be satisfied.
│ │ │ │ +
245template<class From, class To,
│ │ │ │ +
246 typename std::enable_if< std::is_convertible<From, To>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
247constexpr bool requireConvertible()
│ │ │ │ +
248{
│ │ │ │ +
249 return true;
│ │ │ │ +
250}
│ │ │ │ +
│ │ │ │ +
251
│ │ │ │ +
252// Helper function for use in concept definitions.
│ │ │ │ +
253// If passed argument is not convertible to the first passed type, the concept will not be satisfied.
│ │ │ │ +
254template<class To, class From,
│ │ │ │ +
255 typename std::enable_if< std::is_convertible<From, To>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
256constexpr bool requireConvertible(const From&)
│ │ │ │ +
257{
│ │ │ │ +
258 return true;
│ │ │ │ +
259}
│ │ │ │ +
│ │ │ │ +
260
│ │ │ │ +
261// Helper function for use in concept definitions.
│ │ │ │ +
262// This will always evaluate to true. If just allow
│ │ │ │ +
263// to turn a type into an expression. The failure happens
│ │ │ │ +
264// already during substitution for the type argument.
│ │ │ │ +
265template<typename T>
│ │ │ │ +
│ │ │ │ +
266constexpr bool requireType()
│ │ │ │ +
267{
│ │ │ │ +
268 return true;
│ │ │ │ +
269}
│ │ │ │ +
│ │ │ │ +
270
│ │ │ │ +
271// Helper function for use in concept definitions.
│ │ │ │ +
272// If first passed type is not a base class of second type, the concept will not be satisfied.
│ │ │ │ +
273template<class Base, class Derived,
│ │ │ │ +
274 typename std::enable_if< std::is_base_of<Base, Derived>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
275constexpr bool requireBaseOf()
│ │ │ │ +
276{
│ │ │ │ +
277 return true;
│ │ │ │ +
278}
│ │ │ │ +
│ │ │ │ +
279
│ │ │ │ +
280// Helper function for use in concept definitions.
│ │ │ │ +
281// If first passed type is not a base class of first arguments type, the concept will not be satisfied.
│ │ │ │ +
282template<class Base, class Derived,
│ │ │ │ +
283 typename std::enable_if< std::is_base_of<Base, Derived>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
284constexpr bool requireBaseOf(const Derived&)
│ │ │ │ +
285{
│ │ │ │ +
286 return true;
│ │ │ │ +
287}
│ │ │ │ +
│ │ │ │ +
288
│ │ │ │ +
289// Helper function for use in concept definitions.
│ │ │ │ +
290// If the passed types are not the same, the concept will not be satisfied.
│ │ │ │ +
291template<class A, class B,
│ │ │ │ +
292 typename std::enable_if< std::is_same<A, B>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
293constexpr bool requireSameType()
│ │ │ │ +
294{
│ │ │ │ +
295 return true;
│ │ │ │ +
296}
│ │ │ │ +
│ │ │ │ +
297
│ │ │ │ +
298
│ │ │ │
299
│ │ │ │ -
300 template<typename C>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
302 {
│ │ │ │ -
303 neighbourIds.clear();
│ │ │ │ -
304 neighbourIds.insert(neighbours.begin(), neighbours.end());
│ │ │ │ +
300} // namespace Dune::Concept
│ │ │ │ +
301
│ │ │ │ +
302} // namespace Dune
│ │ │ │ +
303
│ │ │ │ +
304
│ │ │ │
305
│ │ │ │ -
306 }
│ │ │ │ -
│ │ │ │ -
307
│ │ │ │ -
│ │ │ │ -
308 const std::set<int>& getNeighbours() const
│ │ │ │ -
309 {
│ │ │ │ -
310 return neighbourIds;
│ │ │ │ -
311 }
│ │ │ │ -
│ │ │ │ -
312
│ │ │ │ - │ │ │ │ -
317
│ │ │ │ -
327 template<bool ignorePublic>
│ │ │ │ -
328 void rebuild();
│ │ │ │ -
329
│ │ │ │ -
330 bool operator==(const RemoteIndices& ri) const;
│ │ │ │ -
331
│ │ │ │ -
339 inline bool isSynced() const;
│ │ │ │ -
340
│ │ │ │ -
344 inline MPI_Comm communicator() const;
│ │ │ │ -
345
│ │ │ │ -
360 template<bool mode, bool send>
│ │ │ │ - │ │ │ │ -
362
│ │ │ │ -
369 inline const_iterator find(int proc) const;
│ │ │ │ -
370
│ │ │ │ -
375 inline const_iterator begin() const;
│ │ │ │ -
376
│ │ │ │ -
381 inline const_iterator end() const;
│ │ │ │ -
382
│ │ │ │ -
386 template<bool send>
│ │ │ │ -
387 inline CollectiveIteratorT iterator() const;
│ │ │ │ -
388
│ │ │ │ -
392 inline void free();
│ │ │ │ -
393
│ │ │ │ -
398 inline int neighbours() const;
│ │ │ │ -
399
│ │ │ │ -
401 inline const ParallelIndexSet& sourceIndexSet() const;
│ │ │ │ -
402
│ │ │ │ -
404 inline const ParallelIndexSet& destinationIndexSet() const;
│ │ │ │ -
405
│ │ │ │ -
406 private:
│ │ │ │ -
408 RemoteIndices(const RemoteIndices&) = delete;
│ │ │ │ -
409
│ │ │ │ -
411 const ParallelIndexSet* source_;
│ │ │ │ -
412
│ │ │ │ -
414 const ParallelIndexSet* target_;
│ │ │ │ -
415
│ │ │ │ -
417 MPI_Comm comm_;
│ │ │ │ -
418
│ │ │ │ -
421 std::set<int> neighbourIds;
│ │ │ │ -
422
│ │ │ │ -
424 const static int commTag_=333;
│ │ │ │ -
425
│ │ │ │ -
430 int sourceSeqNo_;
│ │ │ │ -
431
│ │ │ │ -
436 int destSeqNo_;
│ │ │ │ -
437
│ │ │ │ -
441 bool publicIgnored;
│ │ │ │ -
442
│ │ │ │ -
446 bool firstBuild;
│ │ │ │ -
447
│ │ │ │ -
448 /*
│ │ │ │ -
449 * @brief If true, sending from indices of the processor to other
│ │ │ │ -
450 * indices on the same processor is enabled even if the same indexset is used
│ │ │ │ -
451 * on both the
│ │ │ │ -
452 * sending and receiving side.
│ │ │ │ -
453 */
│ │ │ │ -
454 bool includeSelf;
│ │ │ │ -
455
│ │ │ │ - │ │ │ │ -
458 PairType;
│ │ │ │ -
459
│ │ │ │ -
466 RemoteIndexMap remoteIndices_;
│ │ │ │ -
467
│ │ │ │ -
478 template<bool ignorePublic>
│ │ │ │ -
479 inline void buildRemote(bool includeSelf);
│ │ │ │ -
480
│ │ │ │ -
486 inline int noPublic(const ParallelIndexSet& indexSet);
│ │ │ │ -
487
│ │ │ │ -
499 template<bool ignorePublic>
│ │ │ │ -
500 inline void packEntries(PairType** myPairs, const ParallelIndexSet& indexSet,
│ │ │ │ -
501 char* p_out, MPI_Datatype type, int bufferSize,
│ │ │ │ -
502 int* position, int n);
│ │ │ │ -
503
│ │ │ │ -
517 inline void unpackIndices(RemoteIndexList& remote, int remoteEntries,
│ │ │ │ -
518 PairType** local, int localEntries, char* p_in,
│ │ │ │ -
519 MPI_Datatype type, int* position, int bufferSize,
│ │ │ │ -
520 bool fromOurself);
│ │ │ │ -
521
│ │ │ │ -
522 inline void unpackIndices(RemoteIndexList& send, RemoteIndexList& receive,
│ │ │ │ -
523 int remoteEntries, PairType** localSource,
│ │ │ │ -
524 int localSourceEntries, PairType** localDest,
│ │ │ │ -
525 int localDestEntries, char* p_in,
│ │ │ │ -
526 MPI_Datatype type, int* position, int bufferSize);
│ │ │ │ -
527
│ │ │ │ -
528 void unpackCreateRemote(char* p_in, PairType** sourcePairs, PairType** DestPairs,
│ │ │ │ -
529 int remoteProc, int sourcePublish, int destPublish,
│ │ │ │ -
530 int bufferSize, bool sendTwo, bool fromOurSelf=false);
│ │ │ │ -
531 };
│ │ │ │ -
│ │ │ │ -
532
│ │ │ │ -
548 template<class T, class A, bool mode>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
550 {
│ │ │ │ -
551
│ │ │ │ -
552 template<typename T1, typename A1>
│ │ │ │ -
553 friend class RemoteIndices;
│ │ │ │ -
554
│ │ │ │ -
555 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
557 {};
│ │ │ │ -
│ │ │ │ -
558
│ │ │ │ -
567 constexpr static bool MODIFYINDEXSET = mode;
│ │ │ │ -
568
│ │ │ │ - │ │ │ │ -
573
│ │ │ │ - │ │ │ │ -
578
│ │ │ │ - │ │ │ │ -
583
│ │ │ │ -
587 typedef typename LocalIndex::Attribute Attribute;
│ │ │ │ -
588
│ │ │ │ - │ │ │ │ -
593
│ │ │ │ -
597 typedef A Allocator;
│ │ │ │ -
598
│ │ │ │ - │ │ │ │ - │ │ │ │ -
602
│ │ │ │ - │ │ │ │ -
607
│ │ │ │ - │ │ │ │ -
612
│ │ │ │ -
626 void insert(const RemoteIndex& index);
│ │ │ │ -
627
│ │ │ │ -
628
│ │ │ │ -
643 void insert(const RemoteIndex& index, const GlobalIndex& global);
│ │ │ │ -
644
│ │ │ │ -
652 bool remove(const GlobalIndex& global);
│ │ │ │ -
653
│ │ │ │ - │ │ │ │ -
667
│ │ │ │ -
668
│ │ │ │ - │ │ │ │ -
670
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
676 : glist_()
│ │ │ │ -
677 {}
│ │ │ │ -
│ │ │ │ -
678
│ │ │ │ -
679 private:
│ │ │ │ -
680
│ │ │ │ - │ │ │ │ -
687 RemoteIndexList& rList);
│ │ │ │ -
688
│ │ │ │ -
689 typedef SLList<GlobalIndex,Allocator> GlobalList;
│ │ │ │ -
690 typedef typename GlobalList::ModifyIterator GlobalModifyIterator;
│ │ │ │ -
691 RemoteIndexList* rList_;
│ │ │ │ -
692 const ParallelIndexSet* indexSet_;
│ │ │ │ -
693 GlobalList glist_;
│ │ │ │ -
694 ModifyIterator iter_;
│ │ │ │ -
695 GlobalModifyIterator giter_;
│ │ │ │ -
696 ConstIterator end_;
│ │ │ │ -
697 bool first_;
│ │ │ │ -
698 GlobalIndex last_;
│ │ │ │ -
699 };
│ │ │ │ -
│ │ │ │ -
700
│ │ │ │ -
705 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
707 {
│ │ │ │ -
708
│ │ │ │ -
712 typedef T ParallelIndexSet;
│ │ │ │ -
713
│ │ │ │ -
717 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ │ -
718
│ │ │ │ -
722 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
│ │ │ │ -
723
│ │ │ │ -
727 typedef typename LocalIndex::Attribute Attribute;
│ │ │ │ -
728
│ │ │ │ - │ │ │ │ -
731
│ │ │ │ -
733 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<RemoteIndex>;
│ │ │ │ -
734
│ │ │ │ - │ │ │ │ -
737
│ │ │ │ -
739 typedef std::map<int,std::pair<typename RemoteIndexList::const_iterator,
│ │ │ │ -
740 const typename RemoteIndexList::const_iterator> >
│ │ │ │ -
741 Map;
│ │ │ │ -
742
│ │ │ │ -
743 public:
│ │ │ │ -
744
│ │ │ │ -
746 typedef std::map<int, std::pair<RemoteIndexList*,RemoteIndexList*> >
│ │ │ │ - │ │ │ │ -
748
│ │ │ │ -
754 inline CollectiveIterator(const RemoteIndexMap& map_, bool send);
│ │ │ │ -
755
│ │ │ │ -
764 inline void advance(const GlobalIndex& global);
│ │ │ │ -
765
│ │ │ │ -
775 inline void advance(const GlobalIndex& global, const Attribute& attribute);
│ │ │ │ -
776
│ │ │ │ - │ │ │ │ -
778
│ │ │ │ -
782 inline bool empty() const;
│ │ │ │ -
783
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
791 {
│ │ │ │ -
792 public:
│ │ │ │ -
793 typedef typename Map::iterator RealIterator;
│ │ │ │ -
794 typedef typename Map::iterator ConstRealIterator;
│ │ │ │ -
795
│ │ │ │ -
796
│ │ │ │ -
│ │ │ │ -
798 iterator(const RealIterator& iter, const ConstRealIterator& end, GlobalIndex& index)
│ │ │ │ -
799 : iter_(iter), end_(end), index_(index), hasAttribute(false)
│ │ │ │ -
800 {
│ │ │ │ -
801 // Move to the first valid entry
│ │ │ │ -
802 while(iter_!=end_ && iter_->second.first->localIndexPair().global()!=index_)
│ │ │ │ -
803 ++iter_;
│ │ │ │ -
804 }
│ │ │ │ -
│ │ │ │ -
805
│ │ │ │ -
│ │ │ │ -
806 iterator(const RealIterator& iter, const ConstRealIterator& end, GlobalIndex index,
│ │ │ │ -
807 Attribute attribute)
│ │ │ │ -
808 : iter_(iter), end_(end), index_(index), attribute_(attribute), hasAttribute(true)
│ │ │ │ -
809 {
│ │ │ │ -
810 // Move to the first valid entry or the end
│ │ │ │ -
811 while(iter_!=end_ && (iter_->second.first->localIndexPair().global()!=index_
│ │ │ │ -
812 || iter_->second.first->localIndexPair().local().attribute()!=attribute))
│ │ │ │ -
813 ++iter_;
│ │ │ │ -
814 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
816 iterator(const iterator& other)
│ │ │ │ -
817 : iter_(other.iter_), end_(other.end_), index_(other.index_)
│ │ │ │ -
818 { }
│ │ │ │ -
│ │ │ │ -
819
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
822 {
│ │ │ │ -
823 ++iter_;
│ │ │ │ -
824 // If entry is not valid move on
│ │ │ │ -
825 while(iter_!=end_ && (iter_->second.first->localIndexPair().global()!=index_ ||
│ │ │ │ -
826 (hasAttribute &&
│ │ │ │ -
827 iter_->second.first->localIndexPair().local().attribute()!=attribute_)))
│ │ │ │ -
828 ++iter_;
│ │ │ │ -
829 assert(iter_==end_ ||
│ │ │ │ -
830 (iter_->second.first->localIndexPair().global()==index_));
│ │ │ │ -
831 assert(iter_==end_ || !hasAttribute ||
│ │ │ │ -
832 (iter_->second.first->localIndexPair().local().attribute()==attribute_));
│ │ │ │ -
833 return *this;
│ │ │ │ -
834 }
│ │ │ │ -
│ │ │ │ -
835
│ │ │ │ -
│ │ │ │ -
837 const RemoteIndex& operator*() const
│ │ │ │ -
838 {
│ │ │ │ -
839 return *(iter_->second.first);
│ │ │ │ -
840 }
│ │ │ │ -
│ │ │ │ -
841
│ │ │ │ -
│ │ │ │ -
843 int process() const
│ │ │ │ -
844 {
│ │ │ │ -
845 return iter_->first;
│ │ │ │ -
846 }
│ │ │ │ -
│ │ │ │ -
847
│ │ │ │ -
│ │ │ │ -
849 const RemoteIndex* operator->() const
│ │ │ │ -
850 {
│ │ │ │ -
851 return iter_->second.first.operator->();
│ │ │ │ -
852 }
│ │ │ │ -
│ │ │ │ -
853
│ │ │ │ -
│ │ │ │ -
855 bool operator==(const iterator& other) const
│ │ │ │ -
856 {
│ │ │ │ -
857 return other.iter_==iter_;
│ │ │ │ -
858 }
│ │ │ │ -
│ │ │ │ -
859
│ │ │ │ -
│ │ │ │ -
861 bool operator!=(const iterator& other) const
│ │ │ │ -
862 {
│ │ │ │ -
863 return other.iter_!=iter_;
│ │ │ │ -
864 }
│ │ │ │ -
│ │ │ │ -
865
│ │ │ │ -
866 private:
│ │ │ │ -
867 iterator();
│ │ │ │ -
868
│ │ │ │ -
869 RealIterator iter_;
│ │ │ │ -
870 RealIterator end_;
│ │ │ │ -
871 GlobalIndex index_;
│ │ │ │ -
872 Attribute attribute_;
│ │ │ │ -
873 bool hasAttribute;
│ │ │ │ -
874 };
│ │ │ │ -
│ │ │ │ -
875
│ │ │ │ -
876 iterator begin();
│ │ │ │ -
877
│ │ │ │ -
878 iterator end();
│ │ │ │ -
879
│ │ │ │ -
880 private:
│ │ │ │ -
881
│ │ │ │ -
882 Map map_;
│ │ │ │ -
883 GlobalIndex index_;
│ │ │ │ -
884 Attribute attribute_;
│ │ │ │ -
885 bool noattribute;
│ │ │ │ -
886 };
│ │ │ │ -
│ │ │ │ -
887
│ │ │ │ -
888 template<typename TG, typename TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
890 {
│ │ │ │ -
891 if(type==MPI_DATATYPE_NULL) {
│ │ │ │ -
892 int length[2] = {1, 1};
│ │ │ │ -
893 MPI_Aint base;
│ │ │ │ -
894 MPI_Aint disp[2];
│ │ │ │ -
895 MPI_Datatype types[2] = {MPITraits<TG>::getType(),
│ │ │ │ - │ │ │ │ - │ │ │ │ -
898 MPI_Get_address(&rep, &base); // lower bound of the datatype
│ │ │ │ -
899 MPI_Get_address(&(rep.global_), &disp[0]);
│ │ │ │ -
900 MPI_Get_address(&(rep.local_), &disp[1]);
│ │ │ │ -
901 for (MPI_Aint& d : disp)
│ │ │ │ -
902 d -= base;
│ │ │ │ -
903
│ │ │ │ -
904 MPI_Datatype tmp;
│ │ │ │ -
905 MPI_Type_create_struct(2, length, disp, types, &tmp);
│ │ │ │ -
906
│ │ │ │ -
907 MPI_Type_create_resized(tmp, 0, sizeof(IndexPair<TG,ParallelLocalIndex<TA> >), &type);
│ │ │ │ -
908 MPI_Type_commit(&type);
│ │ │ │ -
909
│ │ │ │ -
910 MPI_Type_free(&tmp);
│ │ │ │ -
911 }
│ │ │ │ -
912 return type;
│ │ │ │ -
913 }
│ │ │ │ -
│ │ │ │ -
914
│ │ │ │ -
915 template<typename TG, typename TA>
│ │ │ │ -
916 MPI_Datatype MPITraits<IndexPair<TG,ParallelLocalIndex<TA> > >::type=MPI_DATATYPE_NULL;
│ │ │ │ -
917
│ │ │ │ -
918 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ -
919 RemoteIndex<T1,T2>::RemoteIndex(const T2& attribute, const PairType* local)
│ │ │ │ -
920 : localIndex_(local), attribute_(static_cast<std::underlying_type_t<T2>>(attribute))
│ │ │ │ -
921 {}
│ │ │ │ -
│ │ │ │ -
922
│ │ │ │ -
923 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
925 : localIndex_(0), attribute_(static_cast<std::underlying_type_t<T2>>(attribute))
│ │ │ │ -
926 {}
│ │ │ │ -
│ │ │ │ -
927
│ │ │ │ -
928 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
930 : localIndex_(0), attribute_()
│ │ │ │ -
931 {}
│ │ │ │ -
│ │ │ │ -
932 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ -
933 inline bool RemoteIndex<T1,T2>::operator==(const RemoteIndex& ri) const
│ │ │ │ -
934 {
│ │ │ │ -
935 return localIndex_==ri.localIndex_ && attribute_==ri.attribute_;
│ │ │ │ -
936 }
│ │ │ │ -
│ │ │ │ -
937
│ │ │ │ -
938 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ -
939 inline bool RemoteIndex<T1,T2>::operator!=(const RemoteIndex& ri) const
│ │ │ │ -
940 {
│ │ │ │ -
941 return localIndex_!=ri.localIndex_ || attribute_!=ri.attribute_;
│ │ │ │ -
942 }
│ │ │ │ -
│ │ │ │ -
943
│ │ │ │ -
944 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ -
945 inline const T2 RemoteIndex<T1,T2>::attribute() const
│ │ │ │ -
946 {
│ │ │ │ -
947 return T2(attribute_);
│ │ │ │ -
948 }
│ │ │ │ -
│ │ │ │ -
949
│ │ │ │ -
950 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
952 {
│ │ │ │ -
953 return *localIndex_;
│ │ │ │ -
954 }
│ │ │ │ -
│ │ │ │ -
955
│ │ │ │ -
956 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
958 const ParallelIndexSet& destination,
│ │ │ │ -
959 const MPI_Comm& comm,
│ │ │ │ -
960 const std::vector<int>& neighbours,
│ │ │ │ -
961 bool includeSelf_)
│ │ │ │ -
962 : source_(&source), target_(&destination), comm_(comm),
│ │ │ │ -
963 sourceSeqNo_(-1), destSeqNo_(-1), publicIgnored(false), firstBuild(true),
│ │ │ │ -
964 includeSelf(includeSelf_)
│ │ │ │ -
965 {
│ │ │ │ - │ │ │ │ -
967 }
│ │ │ │ -
│ │ │ │ -
968
│ │ │ │ -
969 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
971 {
│ │ │ │ -
972 includeSelf=b;
│ │ │ │ -
973 }
│ │ │ │ -
│ │ │ │ -
974
│ │ │ │ -
975 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
977 : source_(0), target_(0), sourceSeqNo_(-1),
│ │ │ │ -
978 destSeqNo_(-1), publicIgnored(false), firstBuild(true),
│ │ │ │ -
979 includeSelf(false)
│ │ │ │ -
980 {}
│ │ │ │ -
│ │ │ │ -
981
│ │ │ │ -
982 template<class T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
984 const ParallelIndexSet& destination,
│ │ │ │ -
985 const MPI_Comm& comm,
│ │ │ │ -
986 const std::vector<int>& neighbours)
│ │ │ │ -
987 {
│ │ │ │ -
988 free();
│ │ │ │ -
989 source_ = &source;
│ │ │ │ -
990 target_ = &destination;
│ │ │ │ -
991 comm_ = comm;
│ │ │ │ -
992 firstBuild = true;
│ │ │ │ -
993 setNeighbours(neighbours);
│ │ │ │ -
994 }
│ │ │ │ -
│ │ │ │ -
995
│ │ │ │ -
996 template<typename T, typename A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
999 {
│ │ │ │ -
1000 return *source_;
│ │ │ │ -
1001 }
│ │ │ │ -
│ │ │ │ -
1002
│ │ │ │ -
1003
│ │ │ │ -
1004 template<typename T, typename A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
1007 {
│ │ │ │ -
1008 return *target_;
│ │ │ │ -
1009 }
│ │ │ │ -
│ │ │ │ -
1010
│ │ │ │ -
1011
│ │ │ │ -
1012 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1014 {
│ │ │ │ -
1015 free();
│ │ │ │ -
1016 }
│ │ │ │ -
│ │ │ │ -
1017
│ │ │ │ -
1018 template<typename T, typename A>
│ │ │ │ -
1019 template<bool ignorePublic>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1021 const ParallelIndexSet& indexSet,
│ │ │ │ -
1022 char* p_out, MPI_Datatype type,
│ │ │ │ -
1023 int bufferSize,
│ │ │ │ -
1024 int *position,
│ │ │ │ -
1025 [[maybe_unused]] int n)
│ │ │ │ -
1026 {
│ │ │ │ -
1027 // fill with own indices
│ │ │ │ -
1028 const auto end = indexSet.end();
│ │ │ │ -
1029
│ │ │ │ -
1030 //Now pack the source indices
│ │ │ │ -
1031 int i=0;
│ │ │ │ -
1032 for(auto index = indexSet.begin(); index != end; ++index)
│ │ │ │ -
1033 if(ignorePublic || index->local().isPublic()) {
│ │ │ │ -
1034
│ │ │ │ -
1035 MPI_Pack(const_cast<PairType*>(&(*index)), 1,
│ │ │ │ -
1036 type,
│ │ │ │ -
1037 p_out, bufferSize, position, comm_);
│ │ │ │ -
1038 pairs[i++] = const_cast<PairType*>(&(*index));
│ │ │ │ -
1039
│ │ │ │ -
1040 }
│ │ │ │ -
1041 assert(i==n);
│ │ │ │ -
1042 }
│ │ │ │ -
│ │ │ │ -
1043
│ │ │ │ -
1044 template<typename T, typename A>
│ │ │ │ -
1045 inline int RemoteIndices<T,A>::noPublic(const ParallelIndexSet& indexSet)
│ │ │ │ -
1046 {
│ │ │ │ -
1047
│ │ │ │ -
1048 int noPublic=0;
│ │ │ │ -
1049
│ │ │ │ -
1050 const auto end=indexSet.end();
│ │ │ │ -
1051 for(auto index=indexSet.begin(); index!=end; ++index)
│ │ │ │ -
1052 if(index->local().isPublic())
│ │ │ │ -
1053 noPublic++;
│ │ │ │ -
1054
│ │ │ │ -
1055 return noPublic;
│ │ │ │ -
1056
│ │ │ │ -
1057 }
│ │ │ │ -
1058
│ │ │ │ -
1059
│ │ │ │ -
1060 template<typename T, typename A>
│ │ │ │ -
1061 inline void RemoteIndices<T,A>::unpackCreateRemote(char* p_in, PairType** sourcePairs,
│ │ │ │ -
1062 PairType** destPairs, int remoteProc,
│ │ │ │ -
1063 int sourcePublish, int destPublish,
│ │ │ │ -
1064 int bufferSize, bool sendTwo,
│ │ │ │ -
1065 bool fromOurSelf)
│ │ │ │ -
1066 {
│ │ │ │ -
1067
│ │ │ │ -
1068 // unpack the number of indices we received
│ │ │ │ -
1069 int noRemoteSource=-1, noRemoteDest=-1;
│ │ │ │ -
1070 char twoIndexSets=0;
│ │ │ │ -
1071 int position=0;
│ │ │ │ -
1072 // Did we receive two index sets?
│ │ │ │ -
1073 MPI_Unpack(p_in, bufferSize, &position, &twoIndexSets, 1, MPI_CHAR, comm_);
│ │ │ │ -
1074 // The number of source indices received
│ │ │ │ -
1075 MPI_Unpack(p_in, bufferSize, &position, &noRemoteSource, 1, MPI_INT, comm_);
│ │ │ │ -
1076 // The number of destination indices received
│ │ │ │ -
1077 MPI_Unpack(p_in, bufferSize, &position, &noRemoteDest, 1, MPI_INT, comm_);
│ │ │ │ -
1078
│ │ │ │ -
1079
│ │ │ │ -
1080 // Indices for which we receive
│ │ │ │ -
1081 RemoteIndexList* receive= new RemoteIndexList();
│ │ │ │ -
1082 // Indices for which we send
│ │ │ │ -
1083 RemoteIndexList* send=0;
│ │ │ │ -
1084
│ │ │ │ -
1085 MPI_Datatype type= MPITraits<PairType>::getType();
│ │ │ │ -
1086
│ │ │ │ -
1087 if(!twoIndexSets) {
│ │ │ │ -
1088 if(sendTwo) {
│ │ │ │ -
1089 send = new RemoteIndexList();
│ │ │ │ -
1090 // Create both remote index sets simultaneously
│ │ │ │ -
1091 unpackIndices(*send, *receive, noRemoteSource, sourcePairs, sourcePublish,
│ │ │ │ -
1092 destPairs, destPublish, p_in, type, &position, bufferSize);
│ │ │ │ -
1093 }else{
│ │ │ │ -
1094 // we only need one list
│ │ │ │ -
1095 unpackIndices(*receive, noRemoteSource, sourcePairs, sourcePublish,
│ │ │ │ -
1096 p_in, type, &position, bufferSize, fromOurSelf);
│ │ │ │ -
1097 send=receive;
│ │ │ │ -
1098 }
│ │ │ │ -
1099 }else{
│ │ │ │ -
1100
│ │ │ │ -
1101 int oldPos=position;
│ │ │ │ -
1102 // Two index sets received
│ │ │ │ -
1103 unpackIndices(*receive, noRemoteSource, destPairs, destPublish,
│ │ │ │ -
1104 p_in, type, &position, bufferSize, fromOurSelf);
│ │ │ │ -
1105 if(!sendTwo)
│ │ │ │ -
1106 //unpack source entries again as destination entries
│ │ │ │ -
1107 position=oldPos;
│ │ │ │ -
1108
│ │ │ │ -
1109 send = new RemoteIndexList();
│ │ │ │ -
1110 unpackIndices(*send, noRemoteDest, sourcePairs, sourcePublish,
│ │ │ │ -
1111 p_in, type, &position, bufferSize, fromOurSelf);
│ │ │ │ -
1112 }
│ │ │ │ -
1113
│ │ │ │ -
1114 if(receive->empty() && send->empty()) {
│ │ │ │ -
1115 if(send==receive) {
│ │ │ │ -
1116 delete send;
│ │ │ │ -
1117 }else{
│ │ │ │ -
1118 delete send;
│ │ │ │ -
1119 delete receive;
│ │ │ │ -
1120 }
│ │ │ │ -
1121 }else{
│ │ │ │ -
1122 remoteIndices_.insert(std::make_pair(remoteProc,
│ │ │ │ -
1123 std::make_pair(send,receive)));
│ │ │ │ -
1124 }
│ │ │ │ -
1125 }
│ │ │ │ -
1126
│ │ │ │ -
1127
│ │ │ │ -
1128 template<typename T, typename A>
│ │ │ │ -
1129 template<bool ignorePublic>
│ │ │ │ -
1130 inline void RemoteIndices<T,A>::buildRemote(bool includeSelf_)
│ │ │ │ -
1131 {
│ │ │ │ -
1132 // Processor configuration
│ │ │ │ -
1133 int rank, procs;
│ │ │ │ -
1134 MPI_Comm_rank(comm_, &rank);
│ │ │ │ -
1135 MPI_Comm_size(comm_, &procs);
│ │ │ │ -
1136
│ │ │ │ -
1137 // number of local indices to publish
│ │ │ │ -
1138 // The indices of the destination will be send.
│ │ │ │ -
1139 int sourcePublish, destPublish;
│ │ │ │ -
1140
│ │ │ │ -
1141 // Do we need to send two index sets?
│ │ │ │ -
1142 char sendTwo = (source_ != target_);
│ │ │ │ -
1143
│ │ │ │ -
1144 if(procs==1 && !(sendTwo || includeSelf_))
│ │ │ │ -
1145 // Nothing to communicate
│ │ │ │ -
1146 return;
│ │ │ │ -
1147
│ │ │ │ -
1148 sourcePublish = (ignorePublic) ? source_->size() : noPublic(*source_);
│ │ │ │ -
1149
│ │ │ │ -
1150 if(sendTwo)
│ │ │ │ -
1151 destPublish = (ignorePublic) ? target_->size() : noPublic(*target_);
│ │ │ │ -
1152 else
│ │ │ │ -
1153 // we only need to send one set of indices
│ │ │ │ -
1154 destPublish = 0;
│ │ │ │ -
1155
│ │ │ │ -
1156 int maxPublish, publish=sourcePublish+destPublish;
│ │ │ │ -
1157
│ │ │ │ -
1158 // Calculate maximum number of indices send
│ │ │ │ -
1159 MPI_Allreduce(&publish, &maxPublish, 1, MPI_INT, MPI_MAX, comm_);
│ │ │ │ -
1160
│ │ │ │ -
1161 // allocate buffers
│ │ │ │ -
1162 PairType** destPairs;
│ │ │ │ -
1163 PairType** sourcePairs = new PairType*[sourcePublish>0 ? sourcePublish : 1];
│ │ │ │ -
1164
│ │ │ │ -
1165 if(sendTwo)
│ │ │ │ -
1166 destPairs = new PairType*[destPublish>0 ? destPublish : 1];
│ │ │ │ -
1167 else
│ │ │ │ -
1168 destPairs=sourcePairs;
│ │ │ │ -
1169
│ │ │ │ -
1170 char** buffer = new char*[2];
│ │ │ │ -
1171 int bufferSize;
│ │ │ │ -
1172 int position=0;
│ │ │ │ -
1173 int intSize;
│ │ │ │ -
1174 int charSize;
│ │ │ │ -
1175
│ │ │ │ -
1176 // calculate buffer size
│ │ │ │ -
1177 MPI_Datatype type = MPITraits<PairType>::getType();
│ │ │ │ -
1178
│ │ │ │ -
1179 MPI_Pack_size(maxPublish, type, comm_,
│ │ │ │ -
1180 &bufferSize);
│ │ │ │ -
1181 MPI_Pack_size(1, MPI_INT, comm_,
│ │ │ │ -
1182 &intSize);
│ │ │ │ -
1183 MPI_Pack_size(1, MPI_CHAR, comm_,
│ │ │ │ -
1184 &charSize);
│ │ │ │ -
1185 // Our message will contain the following:
│ │ │ │ -
1186 // a bool whether two index sets where sent
│ │ │ │ -
1187 // the size of the source and the dest indexset,
│ │ │ │ -
1188 // then the source and destination indices
│ │ │ │ -
1189 bufferSize += 2 * intSize + charSize;
│ │ │ │ -
1190
│ │ │ │ -
1191 if(bufferSize<=0) bufferSize=1;
│ │ │ │ -
1192
│ │ │ │ -
1193 buffer[0] = new char[bufferSize];
│ │ │ │ -
1194 buffer[1] = new char[bufferSize];
│ │ │ │ -
1195
│ │ │ │ -
1196
│ │ │ │ -
1197 // pack entries into buffer[0], p_out below!
│ │ │ │ -
1198 MPI_Pack(&sendTwo, 1, MPI_CHAR, buffer[0], bufferSize, &position,
│ │ │ │ -
1199 comm_);
│ │ │ │ -
1200
│ │ │ │ -
1201 // The number of indices we send for each index set
│ │ │ │ -
1202 MPI_Pack(&sourcePublish, 1, MPI_INT, buffer[0], bufferSize, &position,
│ │ │ │ -
1203 comm_);
│ │ │ │ -
1204 MPI_Pack(&destPublish, 1, MPI_INT, buffer[0], bufferSize, &position,
│ │ │ │ -
1205 comm_);
│ │ │ │ -
1206
│ │ │ │ -
1207 // Now pack the source indices and setup the destination pairs
│ │ │ │ -
1208 packEntries<ignorePublic>(sourcePairs, *source_, buffer[0], type,
│ │ │ │ -
1209 bufferSize, &position, sourcePublish);
│ │ │ │ -
1210 // If necessary send the dest indices and setup the source pairs
│ │ │ │ -
1211 if(sendTwo)
│ │ │ │ -
1212 packEntries<ignorePublic>(destPairs, *target_, buffer[0], type,
│ │ │ │ -
1213 bufferSize, &position, destPublish);
│ │ │ │ -
1214
│ │ │ │ -
1215
│ │ │ │ -
1216 // Update remote indices for ourself
│ │ │ │ -
1217 if(sendTwo|| includeSelf_)
│ │ │ │ -
1218 unpackCreateRemote(buffer[0], sourcePairs, destPairs, rank, sourcePublish,
│ │ │ │ -
1219 destPublish, bufferSize, sendTwo, includeSelf_);
│ │ │ │ -
1220
│ │ │ │ -
1221 neighbourIds.erase(rank);
│ │ │ │ -
1222
│ │ │ │ -
1223 if(neighbourIds.size()==0)
│ │ │ │ -
1224 {
│ │ │ │ -
1225 Dune::dvverb<<rank<<": Sending messages in a ring"<<std::endl;
│ │ │ │ -
1226 // send messages in ring
│ │ │ │ -
1227 for(int proc=1; proc<procs; proc++) {
│ │ │ │ -
1228 // pointers to the current input and output buffers
│ │ │ │ -
1229 char* p_out = buffer[1-(proc%2)];
│ │ │ │ -
1230 char* p_in = buffer[proc%2];
│ │ │ │ -
1231
│ │ │ │ -
1232 MPI_Status status;
│ │ │ │ -
1233 if(rank%2==0) {
│ │ │ │ -
1234 MPI_Ssend(p_out, bufferSize, MPI_PACKED, (rank+1)%procs,
│ │ │ │ -
1235 commTag_, comm_);
│ │ │ │ -
1236 MPI_Recv(p_in, bufferSize, MPI_PACKED, (rank+procs-1)%procs,
│ │ │ │ -
1237 commTag_, comm_, &status);
│ │ │ │ -
1238 }else{
│ │ │ │ -
1239 MPI_Recv(p_in, bufferSize, MPI_PACKED, (rank+procs-1)%procs,
│ │ │ │ -
1240 commTag_, comm_, &status);
│ │ │ │ -
1241 MPI_Ssend(p_out, bufferSize, MPI_PACKED, (rank+1)%procs,
│ │ │ │ -
1242 commTag_, comm_);
│ │ │ │ -
1243 }
│ │ │ │ -
1244
│ │ │ │ -
1245
│ │ │ │ -
1246 // The process these indices are from
│ │ │ │ -
1247 int remoteProc = (rank+procs-proc)%procs;
│ │ │ │ -
1248
│ │ │ │ -
1249 unpackCreateRemote(p_in, sourcePairs, destPairs, remoteProc, sourcePublish,
│ │ │ │ -
1250 destPublish, bufferSize, sendTwo);
│ │ │ │ -
1251
│ │ │ │ -
1252 }
│ │ │ │ -
1253
│ │ │ │ -
1254 }
│ │ │ │ -
1255 else
│ │ │ │ -
1256 {
│ │ │ │ -
1257 MPI_Request* requests=new MPI_Request[neighbourIds.size()];
│ │ │ │ -
1258 MPI_Request* req=requests;
│ │ │ │ -
1259
│ │ │ │ -
1260 typedef typename std::set<int>::size_type size_type;
│ │ │ │ -
1261 size_type noNeighbours=neighbourIds.size();
│ │ │ │ -
1262
│ │ │ │ -
1263 // setup sends
│ │ │ │ -
1264 for(std::set<int>::iterator neighbour=neighbourIds.begin();
│ │ │ │ -
1265 neighbour!= neighbourIds.end(); ++neighbour) {
│ │ │ │ -
1266 // Only send the information to the neighbouring processors
│ │ │ │ -
1267 MPI_Issend(buffer[0], position , MPI_PACKED, *neighbour, commTag_, comm_, req++);
│ │ │ │ -
1268 }
│ │ │ │ -
1269
│ │ │ │ -
1270 //Test for received messages
│ │ │ │ -
1271
│ │ │ │ -
1272 for(size_type received=0; received <noNeighbours; ++received)
│ │ │ │ -
1273 {
│ │ │ │ -
1274 MPI_Status status;
│ │ │ │ -
1275 // probe for next message
│ │ │ │ -
1276 MPI_Probe(MPI_ANY_SOURCE, commTag_, comm_, &status);
│ │ │ │ -
1277 int remoteProc=status.MPI_SOURCE;
│ │ │ │ -
1278 int size;
│ │ │ │ -
1279 MPI_Get_count(&status, MPI_PACKED, &size);
│ │ │ │ -
1280 // receive message
│ │ │ │ -
1281 MPI_Recv(buffer[1], size, MPI_PACKED, remoteProc,
│ │ │ │ -
1282 commTag_, comm_, &status);
│ │ │ │ -
1283
│ │ │ │ -
1284 unpackCreateRemote(buffer[1], sourcePairs, destPairs, remoteProc, sourcePublish,
│ │ │ │ -
1285 destPublish, bufferSize, sendTwo);
│ │ │ │ -
1286 }
│ │ │ │ -
1287 // wait for completion of pending requests
│ │ │ │ -
1288 MPI_Status* statuses = new MPI_Status[neighbourIds.size()];
│ │ │ │ -
1289
│ │ │ │ -
1290 if(int(MPI_ERR_IN_STATUS)==MPI_Waitall(neighbourIds.size(), requests, statuses)) {
│ │ │ │ -
1291 for(size_type i=0; i < neighbourIds.size(); ++i)
│ │ │ │ -
1292 if(statuses[i].MPI_ERROR!=MPI_SUCCESS) {
│ │ │ │ -
1293 std::cerr<<rank<<": MPI_Error occurred while receiving message."<<std::endl;
│ │ │ │ -
1294 MPI_Abort(comm_, 999);
│ │ │ │ -
1295 }
│ │ │ │ -
1296 }
│ │ │ │ -
1297 delete[] requests;
│ │ │ │ -
1298 delete[] statuses;
│ │ │ │ -
1299 }
│ │ │ │ -
1300
│ │ │ │ -
1301
│ │ │ │ -
1302 // delete allocated memory
│ │ │ │ -
1303 if(destPairs!=sourcePairs)
│ │ │ │ -
1304 delete[] destPairs;
│ │ │ │ -
1305
│ │ │ │ -
1306 delete[] sourcePairs;
│ │ │ │ -
1307 delete[] buffer[0];
│ │ │ │ -
1308 delete[] buffer[1];
│ │ │ │ -
1309 delete[] buffer;
│ │ │ │ -
1310 }
│ │ │ │ -
1311
│ │ │ │ -
1312 template<typename T, typename A>
│ │ │ │ -
1313 inline void RemoteIndices<T,A>::unpackIndices(RemoteIndexList& remote,
│ │ │ │ -
1314 int remoteEntries,
│ │ │ │ -
1315 PairType** local,
│ │ │ │ -
1316 int localEntries,
│ │ │ │ -
1317 char* p_in,
│ │ │ │ -
1318 MPI_Datatype type,
│ │ │ │ -
1319 int* position,
│ │ │ │ -
1320 int bufferSize,
│ │ │ │ -
1321 bool fromOurSelf)
│ │ │ │ -
1322 {
│ │ │ │ -
1323 if(remoteEntries==0)
│ │ │ │ -
1324 return;
│ │ │ │ -
1325
│ │ │ │ -
1326 PairType index;
│ │ │ │ -
1327 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ -
1328 type, comm_);
│ │ │ │ -
1329 GlobalIndex oldGlobal=index.global();
│ │ │ │ -
1330 int n_in=0, localIndex=0;
│ │ │ │ -
1331
│ │ │ │ -
1332 //Check if we know the global index
│ │ │ │ -
1333 while(localIndex<localEntries) {
│ │ │ │ -
1334 if(local[localIndex]->global()==index.global()) {
│ │ │ │ -
1335 int oldLocalIndex=localIndex;
│ │ │ │ -
1336
│ │ │ │ -
1337 while(localIndex<localEntries &&
│ │ │ │ -
1338 local[localIndex]->global()==index.global()) {
│ │ │ │ -
1339 if(!fromOurSelf || index.local().attribute() !=
│ │ │ │ -
1340 local[localIndex]->local().attribute())
│ │ │ │ -
1341 // if index is from us it has to have a different attribute
│ │ │ │ -
1342 remote.push_back(RemoteIndex(index.local().attribute(),
│ │ │ │ -
1343 local[localIndex]));
│ │ │ │ -
1344 localIndex++;
│ │ │ │ -
1345 }
│ │ │ │ -
1346
│ │ │ │ -
1347 // unpack next remote index
│ │ │ │ -
1348 if((++n_in) < remoteEntries) {
│ │ │ │ -
1349 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ -
1350 type, comm_);
│ │ │ │ -
1351 if(index.global()==oldGlobal)
│ │ │ │ -
1352 // Restart comparison for the same global indices
│ │ │ │ -
1353 localIndex=oldLocalIndex;
│ │ │ │ -
1354 else
│ │ │ │ -
1355 oldGlobal=index.global();
│ │ │ │ -
1356 }else{
│ │ │ │ -
1357 // No more received indices
│ │ │ │ -
1358 break;
│ │ │ │ -
1359 }
│ │ │ │ -
1360 continue;
│ │ │ │ -
1361 }
│ │ │ │ -
1362
│ │ │ │ -
1363 if (local[localIndex]->global()<index.global()) {
│ │ │ │ -
1364 // compare with next entry in our list
│ │ │ │ -
1365 ++localIndex;
│ │ │ │ -
1366 }else{
│ │ │ │ -
1367 // We do not know the index, unpack next
│ │ │ │ -
1368 if((++n_in) < remoteEntries) {
│ │ │ │ -
1369 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ -
1370 type, comm_);
│ │ │ │ -
1371 oldGlobal=index.global();
│ │ │ │ -
1372 }else
│ │ │ │ -
1373 // No more received indices
│ │ │ │ -
1374 break;
│ │ │ │ -
1375 }
│ │ │ │ -
1376 }
│ │ │ │ -
1377
│ │ │ │ -
1378 // Unpack the other received indices without doing anything
│ │ │ │ -
1379 while(++n_in < remoteEntries)
│ │ │ │ -
1380 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ -
1381 type, comm_);
│ │ │ │ -
1382 }
│ │ │ │ -
1383
│ │ │ │ -
1384
│ │ │ │ -
1385 template<typename T, typename A>
│ │ │ │ -
1386 inline void RemoteIndices<T,A>::unpackIndices(RemoteIndexList& send,
│ │ │ │ -
1387 RemoteIndexList& receive,
│ │ │ │ -
1388 int remoteEntries,
│ │ │ │ -
1389 PairType** localSource,
│ │ │ │ -
1390 int localSourceEntries,
│ │ │ │ -
1391 PairType** localDest,
│ │ │ │ -
1392 int localDestEntries,
│ │ │ │ -
1393 char* p_in,
│ │ │ │ -
1394 MPI_Datatype type,
│ │ │ │ -
1395 int* position,
│ │ │ │ -
1396 int bufferSize)
│ │ │ │ -
1397 {
│ │ │ │ -
1398 int n_in=0, sourceIndex=0, destIndex=0;
│ │ │ │ -
1399
│ │ │ │ -
1400 //Check if we know the global index
│ │ │ │ -
1401 while(n_in<remoteEntries && (sourceIndex<localSourceEntries || destIndex<localDestEntries)) {
│ │ │ │ -
1402 // Unpack next index
│ │ │ │ -
1403 PairType index;
│ │ │ │ -
1404 MPI_Unpack(p_in, bufferSize, position, &index, 1,
│ │ │ │ -
1405 type, comm_);
│ │ │ │ -
1406 n_in++;
│ │ │ │ -
1407
│ │ │ │ -
1408 // Advance until global index in localSource and localDest are >= than the one in the unpacked index
│ │ │ │ -
1409 while(sourceIndex<localSourceEntries && localSource[sourceIndex]->global()<index.global())
│ │ │ │ -
1410 sourceIndex++;
│ │ │ │ -
1411
│ │ │ │ -
1412 while(destIndex<localDestEntries && localDest[destIndex]->global()<index.global())
│ │ │ │ -
1413 destIndex++;
│ │ │ │ -
1414
│ │ │ │ -
1415 // Add a remote index if we found the global index.
│ │ │ │ -
1416 if(sourceIndex<localSourceEntries && localSource[sourceIndex]->global()==index.global())
│ │ │ │ -
1417 send.push_back(RemoteIndex(index.local().attribute(),
│ │ │ │ -
1418 localSource[sourceIndex]));
│ │ │ │ -
1419
│ │ │ │ -
1420 if(destIndex < localDestEntries && localDest[destIndex]->global() == index.global())
│ │ │ │ -
1421 receive.push_back(RemoteIndex(index.local().attribute(),
│ │ │ │ -
1422 localDest[sourceIndex]));
│ │ │ │ -
1423 }
│ │ │ │ -
1424
│ │ │ │ -
1425 }
│ │ │ │ -
1426
│ │ │ │ -
1427 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1429 {
│ │ │ │ -
1430 auto lend = remoteIndices_.end();
│ │ │ │ -
1431 for(auto lists=remoteIndices_.begin(); lists != lend; ++lists) {
│ │ │ │ -
1432 if(lists->second.first==lists->second.second) {
│ │ │ │ -
1433 // there is only one remote index list.
│ │ │ │ -
1434 delete lists->second.first;
│ │ │ │ -
1435 }else{
│ │ │ │ -
1436 delete lists->second.first;
│ │ │ │ -
1437 delete lists->second.second;
│ │ │ │ -
1438 }
│ │ │ │ -
1439 }
│ │ │ │ -
1440 remoteIndices_.clear();
│ │ │ │ -
1441 firstBuild=true;
│ │ │ │ -
1442 }
│ │ │ │ -
│ │ │ │ -
1443
│ │ │ │ -
1444 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1446 {
│ │ │ │ -
1447 return remoteIndices_.size();
│ │ │ │ -
1448 }
│ │ │ │ -
│ │ │ │ -
1449
│ │ │ │ -
1450 template<typename T, typename A>
│ │ │ │ -
1451 template<bool ignorePublic>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1453 {
│ │ │ │ -
1454 // Test whether a rebuild is Needed.
│ │ │ │ -
1455 if(firstBuild ||
│ │ │ │ -
1456 ignorePublic!=publicIgnored || !
│ │ │ │ -
1457 isSynced()) {
│ │ │ │ -
1458 free();
│ │ │ │ -
1459
│ │ │ │ -
1460 buildRemote<ignorePublic>(includeSelf);
│ │ │ │ -
1461
│ │ │ │ -
1462 sourceSeqNo_ = source_->seqNo();
│ │ │ │ -
1463 destSeqNo_ = target_->seqNo();
│ │ │ │ -
1464 firstBuild=false;
│ │ │ │ -
1465 publicIgnored=ignorePublic;
│ │ │ │ -
1466 }
│ │ │ │ -
1467
│ │ │ │ -
1468
│ │ │ │ -
1469 }
│ │ │ │ -
│ │ │ │ -
1470
│ │ │ │ -
1471 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1473 {
│ │ │ │ -
1474 return sourceSeqNo_==source_->seqNo() && destSeqNo_ ==target_->seqNo();
│ │ │ │ -
1475 }
│ │ │ │ -
│ │ │ │ -
1476
│ │ │ │ -
1477 template<typename T, typename A>
│ │ │ │ -
1478 template<bool mode, bool send>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1480 {
│ │ │ │ -
1481
│ │ │ │ -
1482 // The user are on their own now!
│ │ │ │ -
1483 // We assume they know what they are doing and just set the
│ │ │ │ -
1484 // remote indices to synced status.
│ │ │ │ -
1485 sourceSeqNo_ = source_->seqNo();
│ │ │ │ -
1486 destSeqNo_ = target_->seqNo();
│ │ │ │ -
1487
│ │ │ │ -
1488 typename RemoteIndexMap::iterator found = remoteIndices_.find(process);
│ │ │ │ -
1489
│ │ │ │ -
1490 if(found == remoteIndices_.end())
│ │ │ │ -
1491 {
│ │ │ │ -
1492 if(source_ != target_)
│ │ │ │ -
1493 found = remoteIndices_.insert(found, std::make_pair(process,
│ │ │ │ -
1494 std::make_pair(new RemoteIndexList(),
│ │ │ │ -
1495 new RemoteIndexList())));
│ │ │ │ -
1496 else{
│ │ │ │ -
1497 RemoteIndexList* rlist = new RemoteIndexList();
│ │ │ │ -
1498 found = remoteIndices_.insert(found,
│ │ │ │ -
1499 std::make_pair(process,
│ │ │ │ -
1500 std::make_pair(rlist, rlist)));
│ │ │ │ -
1501 }
│ │ │ │ -
1502 }
│ │ │ │ -
1503
│ │ │ │ -
1504 firstBuild = false;
│ │ │ │ -
1505
│ │ │ │ -
1506 if(send)
│ │ │ │ -
1507 return RemoteIndexListModifier<T,A,mode>(*source_, *(found->second.first));
│ │ │ │ -
1508 else
│ │ │ │ -
1509 return RemoteIndexListModifier<T,A,mode>(*target_, *(found->second.second));
│ │ │ │ -
1510 }
│ │ │ │ -
│ │ │ │ -
1511
│ │ │ │ -
1512 template<typename T, typename A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
1515 {
│ │ │ │ -
1516 return remoteIndices_.find(proc);
│ │ │ │ -
1517 }
│ │ │ │ -
│ │ │ │ -
1518
│ │ │ │ -
1519 template<typename T, typename A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
1522 {
│ │ │ │ -
1523 return remoteIndices_.begin();
│ │ │ │ -
1524 }
│ │ │ │ -
│ │ │ │ -
1525
│ │ │ │ -
1526 template<typename T, typename A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
1529 {
│ │ │ │ -
1530 return remoteIndices_.end();
│ │ │ │ -
1531 }
│ │ │ │ -
│ │ │ │ -
1532
│ │ │ │ -
1533
│ │ │ │ -
1534 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1536 {
│ │ │ │ -
1537 if(neighbours()!=ri.neighbours())
│ │ │ │ -
1538 return false;
│ │ │ │ -
1539
│ │ │ │ -
1540 const auto rend = remoteIndices_.end();
│ │ │ │ -
1541
│ │ │ │ -
1542 for(auto rindex = remoteIndices_.begin(), rindex1=ri.remoteIndices_.begin(); rindex!=rend; ++rindex, ++rindex1) {
│ │ │ │ -
1543 if(rindex->first != rindex1->first)
│ │ │ │ -
1544 return false;
│ │ │ │ -
1545 if(*(rindex->second.first) != *(rindex1->second.first))
│ │ │ │ -
1546 return false;
│ │ │ │ -
1547 if(*(rindex->second.second) != *(rindex1->second.second))
│ │ │ │ -
1548 return false;
│ │ │ │ -
1549 }
│ │ │ │ -
1550 return true;
│ │ │ │ -
1551 }
│ │ │ │ -
│ │ │ │ -
1552
│ │ │ │ -
1553 template<class T, class A, bool mode>
│ │ │ │ - │ │ │ │ -
1555 RemoteIndexList& rList)
│ │ │ │ -
1556 : rList_(&rList), indexSet_(&indexSet), iter_(rList.beginModify()), end_(rList.end()), first_(true)
│ │ │ │ -
1557 {
│ │ │ │ -
1558 if(MODIFYINDEXSET) {
│ │ │ │ -
1559 assert(indexSet_);
│ │ │ │ -
1560 for(ConstIterator iter=iter_; iter != end_; ++iter)
│ │ │ │ -
1561 glist_.push_back(iter->localIndexPair().global());
│ │ │ │ -
1562 giter_ = glist_.beginModify();
│ │ │ │ -
1563 }
│ │ │ │ -
1564 }
│ │ │ │ -
1565
│ │ │ │ -
1566 template<typename T, typename A, bool mode>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1568 : rList_(other.rList_), indexSet_(other.indexSet_),
│ │ │ │ -
1569 glist_(other.glist_), iter_(other.iter_), giter_(other.giter_), end_(other.end_),
│ │ │ │ -
1570 first_(other.first_), last_(other.last_)
│ │ │ │ -
1571 {}
│ │ │ │ -
│ │ │ │ -
1572
│ │ │ │ -
1573 template<typename T, typename A, bool mode>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1575 {
│ │ │ │ -
1576 if(MODIFYINDEXSET) {
│ │ │ │ -
1577 // repair pointers to local index set.
│ │ │ │ -
1578#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1579 if(indexSet_->state()!=GROUND)
│ │ │ │ -
1580 DUNE_THROW(InvalidIndexSetState, "Index has to be in ground mode for repairing pointers to indices");
│ │ │ │ -
1581#endif
│ │ │ │ -
1582 auto giter = glist_.begin();
│ │ │ │ -
1583 auto index = indexSet_->begin();
│ │ │ │ -
1584
│ │ │ │ -
1585 for(auto iter=rList_->begin(); iter != end_; ++iter) {
│ │ │ │ -
1586 while(index->global()<*giter) {
│ │ │ │ -
1587 ++index;
│ │ │ │ -
1588#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1589 if(index == indexSet_->end())
│ │ │ │ -
1590 DUNE_THROW(InvalidPosition, "No such global index in set!");
│ │ │ │ -
1591#endif
│ │ │ │ -
1592 }
│ │ │ │ -
1593
│ │ │ │ -
1594#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1595 if(index->global() != *giter)
│ │ │ │ -
1596 DUNE_THROW(InvalidPosition, "No such global index in set!");
│ │ │ │ -
1597#endif
│ │ │ │ -
1598 iter->localIndex_ = &(*index);
│ │ │ │ -
1599 }
│ │ │ │ -
1600 }
│ │ │ │ -
1601 }
│ │ │ │ -
│ │ │ │ -
1602
│ │ │ │ -
1603 template<typename T, typename A, bool mode>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1605 {
│ │ │ │ -
1606 static_assert(!mode,"Not allowed if the mode indicates that new indices"
│ │ │ │ -
1607 "might be added to the underlying index set. Use "
│ │ │ │ -
1608 "insert(const RemoteIndex&, const GlobalIndex&) instead");
│ │ │ │ -
1609
│ │ │ │ -
1610#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1611 if(!first_ && index.localIndexPair().global()<last_)
│ │ │ │ -
1612 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
│ │ │ │ -
1613#endif
│ │ │ │ -
1614 // Move to the correct position
│ │ │ │ -
1615 while(iter_ != end_ && iter_->localIndexPair().global() < index.localIndexPair().global()) {
│ │ │ │ -
1616 ++iter_;
│ │ │ │ -
1617 }
│ │ │ │ -
1618
│ │ │ │ -
1619 // No duplicate entries allowed
│ │ │ │ -
1620 assert(iter_==end_ || iter_->localIndexPair().global() != index.localIndexPair().global());
│ │ │ │ -
1621 iter_.insert(index);
│ │ │ │ -
1622 last_ = index.localIndexPair().global();
│ │ │ │ -
1623 first_ = false;
│ │ │ │ -
1624 }
│ │ │ │ -
│ │ │ │ -
1625
│ │ │ │ -
1626 template<typename T, typename A, bool mode>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1628 {
│ │ │ │ -
1629 static_assert(mode,"Not allowed if the mode indicates that no new indices"
│ │ │ │ -
1630 "might be added to the underlying index set. Use "
│ │ │ │ -
1631 "insert(const RemoteIndex&) instead");
│ │ │ │ -
1632#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1633 if(!first_ && global<last_)
│ │ │ │ -
1634 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
│ │ │ │ -
1635#endif
│ │ │ │ -
1636 // Move to the correct position
│ │ │ │ -
1637 while(iter_ != end_ && *giter_ < global) {
│ │ │ │ -
1638 ++giter_;
│ │ │ │ -
1639 ++iter_;
│ │ │ │ -
1640 }
│ │ │ │ -
1641
│ │ │ │ -
1642 // No duplicate entries allowed
│ │ │ │ -
1643 assert(iter_->localIndexPair().global() != global);
│ │ │ │ -
1644 iter_.insert(index);
│ │ │ │ -
1645 giter_.insert(global);
│ │ │ │ -
1646
│ │ │ │ -
1647 last_ = global;
│ │ │ │ -
1648 first_ = false;
│ │ │ │ -
1649 }
│ │ │ │ -
│ │ │ │ -
1650
│ │ │ │ -
1651 template<typename T, typename A, bool mode>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1653 {
│ │ │ │ -
1654#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1655 if(!first_ && global<last_)
│ │ │ │ -
1656 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
│ │ │ │ -
1657#endif
│ │ │ │ -
1658
│ │ │ │ -
1659 bool found= false;
│ │ │ │ -
1660
│ │ │ │ -
1661 if(MODIFYINDEXSET) {
│ │ │ │ -
1662 // Move to the correct position
│ │ │ │ -
1663 while(iter_!=end_ && *giter_< global) {
│ │ │ │ -
1664 ++giter_;
│ │ │ │ -
1665 ++iter_;
│ │ │ │ -
1666 }
│ │ │ │ -
1667 if(*giter_ == global) {
│ │ │ │ -
1668 giter_.remove();
│ │ │ │ -
1669 iter_.remove();
│ │ │ │ -
1670 found=true;
│ │ │ │ -
1671 }
│ │ │ │ -
1672 }else{
│ │ │ │ -
1673 while(iter_!=end_ && iter_->localIndexPair().global() < global)
│ │ │ │ -
1674 ++iter_;
│ │ │ │ -
1675
│ │ │ │ -
1676 if(iter_->localIndexPair().global()==global) {
│ │ │ │ -
1677 iter_.remove();
│ │ │ │ -
1678 found = true;
│ │ │ │ -
1679 }
│ │ │ │ -
1680 }
│ │ │ │ -
1681
│ │ │ │ -
1682 last_ = global;
│ │ │ │ -
1683 first_ = false;
│ │ │ │ -
1684 return found;
│ │ │ │ -
1685 }
│ │ │ │ -
│ │ │ │ -
1686
│ │ │ │ -
1687 template<typename T, typename A>
│ │ │ │ -
1688 template<bool send>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1690 {
│ │ │ │ -
1691 return CollectiveIterator<T,A>(remoteIndices_, send);
│ │ │ │ -
1692 }
│ │ │ │ -
│ │ │ │ -
1693
│ │ │ │ -
1694 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1695 inline MPI_Comm RemoteIndices<T,A>::communicator() const
│ │ │ │ -
1696 {
│ │ │ │ -
1697 return comm_;
│ │ │ │ -
1698
│ │ │ │ -
1699 }
│ │ │ │ -
│ │ │ │ -
1700
│ │ │ │ -
1701 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1703 {
│ │ │ │ -
1704
│ │ │ │ -
1705 const auto end = pmap.end();
│ │ │ │ -
1706 for(auto process = pmap.begin(); process != end; ++process) {
│ │ │ │ -
1707 const RemoteIndexList* list = send ? process->second.first : process->second.second;
│ │ │ │ -
1708 using ri_iterator = typename RemoteIndexList::const_iterator;
│ │ │ │ -
1709 map_.insert(std::make_pair(process->first,
│ │ │ │ -
1710 std::pair<ri_iterator, const ri_iterator>(list->begin(), list->end())));
│ │ │ │ -
1711 }
│ │ │ │ -
1712 }
│ │ │ │ -
│ │ │ │ -
1713
│ │ │ │ -
1714 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1715 inline void CollectiveIterator<T,A>::advance(const GlobalIndex& index)
│ │ │ │ -
1716 {
│ │ │ │ -
1717 const auto end = map_.end();
│ │ │ │ -
1718
│ │ │ │ -
1719 for(auto iter = map_.begin(); iter != end;) {
│ │ │ │ -
1720 // Step the iterator until we are >= index
│ │ │ │ -
1721 typename RemoteIndexList::const_iterator current = iter->second.first;
│ │ │ │ -
1722 typename RemoteIndexList::const_iterator rend = iter->second.second;
│ │ │ │ -
1723 RemoteIndex remoteIndex;
│ │ │ │ -
1724 if(current != rend)
│ │ │ │ -
1725 remoteIndex = *current;
│ │ │ │ -
1726
│ │ │ │ -
1727 while(iter->second.first!=iter->second.second && iter->second.first->localIndexPair().global()<index)
│ │ │ │ -
1728 ++(iter->second.first);
│ │ │ │ -
1729
│ │ │ │ -
1730 // erase from the map if there are no more entries.
│ │ │ │ -
1731 if(iter->second.first == iter->second.second)
│ │ │ │ -
1732 map_.erase(iter++);
│ │ │ │ -
1733 else{
│ │ │ │ -
1734 ++iter;
│ │ │ │ -
1735 }
│ │ │ │ -
1736 }
│ │ │ │ -
1737 index_=index;
│ │ │ │ -
1738 noattribute=true;
│ │ │ │ -
1739 }
│ │ │ │ -
│ │ │ │ -
1740
│ │ │ │ -
1741 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1742 inline void CollectiveIterator<T,A>::advance(const GlobalIndex& index,
│ │ │ │ -
1743 const Attribute& attribute)
│ │ │ │ -
1744 {
│ │ │ │ -
1745 const auto end = map_.end();
│ │ │ │ -
1746
│ │ │ │ -
1747 for(auto iter = map_.begin(); iter != end;) {
│ │ │ │ -
1748 // Step the iterator until we are >= index
│ │ │ │ -
1749 typename RemoteIndexList::const_iterator current = iter->second.first;
│ │ │ │ -
1750 typename RemoteIndexList::const_iterator rend = iter->second.second;
│ │ │ │ -
1751 RemoteIndex remoteIndex;
│ │ │ │ -
1752 if(current != rend)
│ │ │ │ -
1753 remoteIndex = *current;
│ │ │ │ -
1754
│ │ │ │ -
1755 // Move to global index or bigger
│ │ │ │ -
1756 while(iter->second.first!=iter->second.second && iter->second.first->localIndexPair().global()<index)
│ │ │ │ -
1757 ++(iter->second.first);
│ │ │ │ -
1758
│ │ │ │ -
1759 // move to attribute or bigger
│ │ │ │ -
1760 while(iter->second.first!=iter->second.second
│ │ │ │ -
1761 && iter->second.first->localIndexPair().global()==index
│ │ │ │ -
1762 && iter->second.first->localIndexPair().local().attribute()<attribute)
│ │ │ │ -
1763 ++(iter->second.first);
│ │ │ │ -
1764
│ │ │ │ -
1765 // erase from the map if there are no more entries.
│ │ │ │ -
1766 if(iter->second.first == iter->second.second)
│ │ │ │ -
1767 map_.erase(iter++);
│ │ │ │ -
1768 else{
│ │ │ │ -
1769 ++iter;
│ │ │ │ -
1770 }
│ │ │ │ -
1771 }
│ │ │ │ -
1772 index_=index;
│ │ │ │ -
1773 attribute_=attribute;
│ │ │ │ -
1774 noattribute=false;
│ │ │ │ -
1775 }
│ │ │ │ -
│ │ │ │ -
1776
│ │ │ │ -
1777 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1779 {
│ │ │ │ -
1780 const auto end = map_.end();
│ │ │ │ -
1781
│ │ │ │ -
1782 for(auto iter = map_.begin(); iter != end;) {
│ │ │ │ -
1783 // Step the iterator until we are >= index
│ │ │ │ -
1784 auto current = iter->second.first;
│ │ │ │ -
1785 auto rend = iter->second.second;
│ │ │ │ -
1786
│ │ │ │ -
1787 // move all iterators pointing to the current global index to next value
│ │ │ │ -
1788 if(iter->second.first->localIndexPair().global()==index_ &&
│ │ │ │ -
1789 (noattribute || iter->second.first->localIndexPair().local().attribute() == attribute_))
│ │ │ │ -
1790 ++(iter->second.first);
│ │ │ │ -
1791
│ │ │ │ -
1792 // erase from the map if there are no more entries.
│ │ │ │ -
1793 if(iter->second.first == iter->second.second)
│ │ │ │ -
1794 map_.erase(iter++);
│ │ │ │ -
1795 else{
│ │ │ │ -
1796 ++iter;
│ │ │ │ -
1797 }
│ │ │ │ -
1798 }
│ │ │ │ -
1799 return *this;
│ │ │ │ -
1800 }
│ │ │ │ -
│ │ │ │ -
1801
│ │ │ │ -
1802 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1804 {
│ │ │ │ -
1805 return map_.empty();
│ │ │ │ -
1806 }
│ │ │ │ -
│ │ │ │ -
1807
│ │ │ │ -
1808 template<typename T, typename A>
│ │ │ │ -
1809 inline typename CollectiveIterator<T,A>::iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1811 {
│ │ │ │ -
1812 if(noattribute)
│ │ │ │ -
1813 return iterator(map_.begin(), map_.end(), index_);
│ │ │ │ -
1814 else
│ │ │ │ -
1815 return iterator(map_.begin(), map_.end(), index_,
│ │ │ │ -
1816 attribute_);
│ │ │ │ -
1817 }
│ │ │ │ -
│ │ │ │ -
1818
│ │ │ │ -
1819 template<typename T, typename A>
│ │ │ │ -
1820 inline typename CollectiveIterator<T,A>::iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1822 {
│ │ │ │ -
1823 return iterator(map_.end(), map_.end(), index_);
│ │ │ │ -
1824 }
│ │ │ │ -
│ │ │ │ -
1825
│ │ │ │ -
1826 template<typename TG, typename TA>
│ │ │ │ -
│ │ │ │ -
1827 inline std::ostream& operator<<(std::ostream& os, const RemoteIndex<TG,TA>& index)
│ │ │ │ -
1828 {
│ │ │ │ -
1829 os<<"[global="<<index.localIndexPair().global()<<", remote attribute="<<index.attribute()<<" local attribute="<<index.localIndexPair().local().attribute()<<"]";
│ │ │ │ -
1830 return os;
│ │ │ │ -
1831 }
│ │ │ │ -
│ │ │ │ -
1832
│ │ │ │ -
1833 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1834 inline std::ostream& operator<<(std::ostream& os, const RemoteIndices<T,A>& indices)
│ │ │ │ -
1835 {
│ │ │ │ -
1836 int rank;
│ │ │ │ -
1837 MPI_Comm_rank(indices.comm_, &rank);
│ │ │ │ -
1838 const auto rend = indices.remoteIndices_.end();
│ │ │ │ -
1839
│ │ │ │ -
1840 for(auto rindex = indices.remoteIndices_.begin(); rindex!=rend; ++rindex) {
│ │ │ │ -
1841 os<<rank<<": Process "<<rindex->first<<":";
│ │ │ │ -
1842
│ │ │ │ -
1843 if(!rindex->second.first->empty()) {
│ │ │ │ -
1844 os<<" send:";
│ │ │ │ -
1845
│ │ │ │ -
1846 const auto send= rindex->second.first->end();
│ │ │ │ -
1847
│ │ │ │ -
1848 for(auto index = rindex->second.first->begin();
│ │ │ │ -
1849 index != send; ++index)
│ │ │ │ -
1850 os<<*index<<" ";
│ │ │ │ -
1851 os<<std::endl;
│ │ │ │ -
1852 }
│ │ │ │ -
1853 if(!rindex->second.second->empty()) {
│ │ │ │ -
1854 os<<rank<<": Process "<<rindex->first<<": "<<"receive: ";
│ │ │ │ -
1855
│ │ │ │ -
1856 for(const auto& index : *(rindex->second.second))
│ │ │ │ -
1857 os << index << " ";
│ │ │ │ -
1858 }
│ │ │ │ -
1859 os<<std::endl<<std::flush;
│ │ │ │ -
1860 }
│ │ │ │ -
1861 return os;
│ │ │ │ -
1862 }
│ │ │ │ -
│ │ │ │ -
1864}
│ │ │ │ -
1865
│ │ │ │ -
1866#endif // HAVE_MPI
│ │ │ │ -
1867#endif // DUNE_COMMON_PARALLEL_REMOTEINDICES_HH
│ │ │ │ -
Provides a map between global and local indices.
│ │ │ │ -
Provides classes for use as the local index in ParallelIndexSet for distributed computing.
│ │ │ │ -
Traits classes for mapping types onto MPI_Datatype.
│ │ │ │ -
Standard Dune debug streams.
│ │ │ │ -
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
│ │ │ │ -
void repairLocalIndexPointers()
Repair the pointers to the local index pairs.
Definition remoteindices.hh:1574
│ │ │ │ -
const Attribute attribute() const
Get the attribute of the index on the remote process.
Definition remoteindices.hh:945
│ │ │ │ -
RemoteIndices()
Definition remoteindices.hh:976
│ │ │ │ -
CollectiveIterator & operator++()
Definition remoteindices.hh:1778
│ │ │ │ -
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:983
│ │ │ │ -
void free()
Free the index lists.
Definition remoteindices.hh:1428
│ │ │ │ -
void insert(const RemoteIndex &index)
Insert an index to the list.
Definition remoteindices.hh:1604
│ │ │ │ -
iterator end()
Definition remoteindices.hh:1821
│ │ │ │ -
void rebuild()
Rebuilds the set of remote indices.
Definition remoteindices.hh:1452
│ │ │ │ -
bool operator==(const RemoteIndex &ri) const
Definition remoteindices.hh:933
│ │ │ │ -
MPI_Comm communicator() const
Get the mpi communicator used.
Definition remoteindices.hh:1695
│ │ │ │ -
CollectiveIteratorT iterator() const
Get an iterator for collectively iterating over the remote indices of all remote processes.
Definition remoteindices.hh:1689
│ │ │ │ -
void setIncludeSelf(bool includeSelf)
Tell whether sending from indices of the processor to other indices on the same processor is enabled ...
Definition remoteindices.hh:970
│ │ │ │ -
CollectiveIterator(const RemoteIndexMap &map_, bool send)
Constructor.
Definition remoteindices.hh:1702
│ │ │ │ -
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 all remote index lists.
Definition remoteindices.hh:1528
│ │ │ │ -
bool operator==(const RemoteIndices &ri) const
Definition remoteindices.hh:1535
│ │ │ │ -
bool empty() const
Checks whether there are still iterators in the map.
Definition remoteindices.hh:1803
│ │ │ │ -
RemoteIndexListModifier< T, A, mode > getModifier(int process)
Get a modifier for a remote index list.
Definition remoteindices.hh:1479
│ │ │ │ -
void advance(const GlobalIndex &global)
Advances all underlying iterators.
Definition remoteindices.hh:1715
│ │ │ │ -
const PairType & localIndexPair() const
Get the corresponding local index pair.
Definition remoteindices.hh:951
│ │ │ │ -
const ParallelIndexSet & sourceIndexSet() const
Get the index set at the source.
Definition remoteindices.hh:998
│ │ │ │ -
~RemoteIndices()
Destructor.
Definition remoteindices.hh:1013
│ │ │ │ -
TL LocalIndex
The type of the local index, e.g. ParallelLocalIndex.
Definition indexset.hh:239
│ │ │ │ -
bool remove(const GlobalIndex &global)
Remove a remote index.
Definition remoteindices.hh:1652
│ │ │ │ -
const GlobalIndex & global() const
Get the global index.
│ │ │ │ -
RemoteIndex()
Parameterless Constructor.
Definition remoteindices.hh:929
│ │ │ │ -
int neighbours() const
Get the number of processors we share indices with.
Definition remoteindices.hh:1445
│ │ │ │ -
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
│ │ │ │ -
const ParallelIndexSet & destinationIndexSet() const
Get the index set at destination.
Definition remoteindices.hh:1006
│ │ │ │ -
const_iterator find(int proc) const
Find an iterator over the remote index lists of a specific process.
Definition remoteindices.hh:1514
│ │ │ │ -
bool isSynced() const
Checks whether the remote indices are synced with the indexsets.
Definition remoteindices.hh:1472
│ │ │ │ -
bool operator!=(const RemoteIndex &ri) const
Definition remoteindices.hh:939
│ │ │ │ -
const_iterator begin() const
Get an iterator over all remote index lists.
Definition remoteindices.hh:1521
│ │ │ │ -
iterator begin()
Definition remoteindices.hh:1810
│ │ │ │ -
@ 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:96
│ │ │ │ -
STL namespace.
│ │ │ │ +
306
│ │ │ │ +
307#endif // DUNE_COMMON_CONCEPT_HH
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
Utilities for type computations, constraining overloads, ...
│ │ │ │ +
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:124
│ │ │ │ +
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
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
│ │ │ │ -
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:45
│ │ │ │ -
Base class of all classes representing a communication interface.
Definition parallel/interface.hh:44
│ │ │ │ -
An index present on the local process with an additional attribute flag.
Definition plocalindex.hh:52
│ │ │ │ -
The indices present on remote processes.
Definition remoteindices.hh:190
│ │ │ │ -
const std::set< int > & getNeighbours() const
Definition remoteindices.hh:308
│ │ │ │ -
Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex
Type of the remote indices we manage.
Definition remoteindices.hh:232
│ │ │ │ -
friend void fillIndexSetHoles(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
│ │ │ │ -
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:216
│ │ │ │ -
T ParallelIndexSet
Type of the index set we use, e.g. ParallelLocalIndexSet.
Definition remoteindices.hh:207
│ │ │ │ -
LocalIndex::Attribute Attribute
The type of the attribute.
Definition remoteindices.hh:227
│ │ │ │ -
std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > RemoteIndexMap
The type of the map from rank to remote index list.
Definition remoteindices.hh:246
│ │ │ │ -
void setNeighbours(const C &neighbours)
Definition remoteindices.hh:301
│ │ │ │ -
Dune::SLList< RemoteIndex, Allocator > RemoteIndexList
The type of the remote index list.
Definition remoteindices.hh:242
│ │ │ │ -
CollectiveIterator< T, A > CollectiveIteratorT
The type of the collective iterator over all remote indices.
Definition remoteindices.hh:211
│ │ │ │ -
typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > Allocator
The type of the allocator for the remote index list.
Definition remoteindices.hh:238
│ │ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition remoteindices.hh:222
│ │ │ │ -
RemoteIndexMap::const_iterator const_iterator
Definition remoteindices.hh:248
│ │ │ │ -
Information about an index residing on another processor.
Definition remoteindices.hh:74
│ │ │ │ -
friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &, RemoteIndices< T, A1 > &, const T &)
│ │ │ │ -
T1 GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition remoteindices.hh:91
│ │ │ │ -
T2 Attribute
The type of the attributes. Normally this will be an enumeration like.
Definition remoteindices.hh:100
│ │ │ │ -
IndexPair< GlobalIndex, ParallelLocalIndex< Attribute > > PairType
The type of the index pair.
Definition remoteindices.hh:106
│ │ │ │ -
Modifier for adding and/or deleting remote indices from the remote index list.
Definition remoteindices.hh:550
│ │ │ │ -
Dune::SLList< RemoteIndex, Allocator > RemoteIndexList
The type of the remote index list.
Definition remoteindices.hh:601
│ │ │ │ -
A Allocator
The type of the allocator for the remote index list.
Definition remoteindices.hh:597
│ │ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition remoteindices.hh:577
│ │ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition remoteindices.hh:582
│ │ │ │ -
RemoteIndexList::const_iterator ConstIterator
The type of the remote index list iterator.
Definition remoteindices.hh:611
│ │ │ │ -
SLListModifyIterator< RemoteIndex, Allocator > ModifyIterator
The type of the modifying iterator of the remote index list.
Definition remoteindices.hh:606
│ │ │ │ -
T ParallelIndexSet
Type of the index set we use.
Definition remoteindices.hh:572
│ │ │ │ -
RemoteIndexListModifier()
Default constructor.
Definition remoteindices.hh:675
│ │ │ │ -
LocalIndex::Attribute Attribute
The type of the attribute.
Definition remoteindices.hh:587
│ │ │ │ -
Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex
Type of the remote indices we manage.
Definition remoteindices.hh:592
│ │ │ │ -
static constexpr bool MODIFYINDEXSET
If true the index set corresponding to the remote indices might get modified.
Definition remoteindices.hh:567
│ │ │ │ -
A collective iterator for moving over the remote indices for all processes collectively.
Definition remoteindices.hh:707
│ │ │ │ -
std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > RemoteIndexMap
The type of the map from rank to remote index list.
Definition remoteindices.hh:747
│ │ │ │ -
Definition remoteindices.hh:168
│ │ │ │ -
Definition remoteindices.hh:557
│ │ │ │ -
Iterator over the valid underlying iterators.
Definition remoteindices.hh:791
│ │ │ │ -
iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex &index)
Definition remoteindices.hh:798
│ │ │ │ -
iterator(const iterator &other)
Definition remoteindices.hh:816
│ │ │ │ -
const RemoteIndex & operator*() const
Definition remoteindices.hh:837
│ │ │ │ -
Map::iterator ConstRealIterator
Definition remoteindices.hh:794
│ │ │ │ -
iterator & operator++()
Definition remoteindices.hh:821
│ │ │ │ -
const RemoteIndex * operator->() const
Definition remoteindices.hh:849
│ │ │ │ -
bool operator==(const iterator &other) const
Definition remoteindices.hh:855
│ │ │ │ -
int process() const
Definition remoteindices.hh:843
│ │ │ │ -
iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex index, Attribute attribute)
Definition remoteindices.hh:806
│ │ │ │ -
bool operator!=(const iterator &other) const
Definition remoteindices.hh:861
│ │ │ │ -
Map::iterator RealIterator
Definition remoteindices.hh:793
│ │ │ │ -
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
│ │ │ │ +
constexpr bool requireConcept()
Definition concept.hh:222
│ │ │ │ +
constexpr bool requireTrue()
Definition concept.hh:215
│ │ │ │ +
constexpr bool requireSameType()
Definition concept.hh:293
│ │ │ │ +
constexpr bool requireConceptForTupleEntries()
Definition concept.hh:238
│ │ │ │ +
constexpr bool requireBaseOf()
Definition concept.hh:275
│ │ │ │ +
constexpr bool requireConvertible()
Definition concept.hh:247
│ │ │ │ +
constexpr auto tupleEntriesModel()
Definition concept.hh:199
│ │ │ │ +
constexpr bool requireType()
Definition concept.hh:266
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1930 +1,336 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _p_a_r_a_l_l_e_l │ │ │ │ │ -remoteindices.hh │ │ │ │ │ +concept.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 © 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_REMOTEINDICES_HH │ │ │ │ │ -6#define DUNE_COMMON_PARALLEL_REMOTEINDICES_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_CONCEPT_HH │ │ │ │ │ +6#define DUNE_COMMON_CONCEPT_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_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -23#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_l_l_i_s_t_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_s_t_r_e_a_m_s_._h_h> │ │ │ │ │ -25#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> │ │ │ │ │ -26#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> │ │ │ │ │ -27#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> │ │ │ │ │ -28 │ │ │ │ │ -29namespace _D_u_n_e { │ │ │ │ │ -41 template │ │ │ │ │ -_4_2 class _M_P_I_T_r_a_i_t_s<_I_n_d_e_x_P_a_i_r > > │ │ │ │ │ -43 { │ │ │ │ │ -44 public: │ │ │ │ │ -45 inline static MPI_Datatype _g_e_t_T_y_p_e(); │ │ │ │ │ -46 private: │ │ │ │ │ -47 static MPI_Datatype type; │ │ │ │ │ -48 }; │ │ │ │ │ -49 │ │ │ │ │ -50 │ │ │ │ │ -51 template │ │ │ │ │ -52 class _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ -53 │ │ │ │ │ -54 template │ │ │ │ │ -55 class _R_e_m_o_t_e_I_n_d_e_x; │ │ │ │ │ -56 │ │ │ │ │ -57 // forward declaration needed for friend declaration. │ │ │ │ │ -58 template │ │ │ │ │ -59 class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ +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_/_i_n_d_i_c_e_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 │ │ │ │ │ +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 │ │ │ │ │ -61 template │ │ │ │ │ -_6_2 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); │ │ │ │ │ -63 │ │ │ │ │ -64 │ │ │ │ │ -65 template │ │ │ │ │ -66 class _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r; │ │ │ │ │ +61namespace Impl { │ │ │ │ │ +62 │ │ │ │ │ +63 / │ │ │ │ │ +/ ############################################################################# │ │ │ │ │ +64 // # All functions following here are implementation details │ │ │ │ │ +65 // # for the models() function below. │ │ │ │ │ +66 / │ │ │ │ │ +/ ############################################################################# │ │ │ │ │ 67 │ │ │ │ │ -68 │ │ │ │ │ -72 template │ │ │ │ │ -_7_3 class _R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ -74 { │ │ │ │ │ -75 template │ │ │ │ │ -_7_6 friend class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ -77 │ │ │ │ │ -78 template │ │ │ │ │ -_7_9 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> >&, │ │ │ │ │ -80 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_1_>&, │ │ │ │ │ -81 const T&); │ │ │ │ │ -82 │ │ │ │ │ -83 template │ │ │ │ │ -_8_4 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; │ │ │ │ │ -85 │ │ │ │ │ -86 public: │ │ │ │ │ -_9_1 typedef T1 _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -_1_0_0 typedef T2 _A_t_t_r_i_b_u_t_e; │ │ │ │ │ -101 │ │ │ │ │ -105 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_6 _P_a_i_r_T_y_p_e; │ │ │ │ │ -107 │ │ │ │ │ -112 const _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() const; │ │ │ │ │ +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 {}; } │ │ │ │ │ +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 │ │ │ │ │ 113 │ │ │ │ │ -119 const _P_a_i_r_T_y_p_e& _l_o_c_a_l_I_n_d_e_x_P_a_i_r() const; │ │ │ │ │ -120 │ │ │ │ │ -124 _R_e_m_o_t_e_I_n_d_e_x(); │ │ │ │ │ -125 │ │ │ │ │ -126 │ │ │ │ │ -132 _R_e_m_o_t_e_I_n_d_e_x(const T2& _a_t_t_r_i_b_u_t_e, │ │ │ │ │ -133 const _P_a_i_r_T_y_p_e* local); │ │ │ │ │ -134 │ │ │ │ │ -135 │ │ │ │ │ -141 _R_e_m_o_t_e_I_n_d_e_x(const T2& _a_t_t_r_i_b_u_t_e); │ │ │ │ │ -142 │ │ │ │ │ -143 bool _o_p_e_r_a_t_o_r_=_=(const _R_e_m_o_t_e_I_n_d_e_x& ri) const; │ │ │ │ │ -144 │ │ │ │ │ -145 bool _o_p_e_r_a_t_o_r_!_=(const _R_e_m_o_t_e_I_n_d_e_x& ri) const; │ │ │ │ │ -146 private: │ │ │ │ │ -148 const _P_a_i_r_T_y_p_e* localIndex_; │ │ │ │ │ +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 │ │ │ │ │ -151 char attribute_; │ │ │ │ │ -152 }; │ │ │ │ │ +150} // namespace Dune::Concept │ │ │ │ │ +151 │ │ │ │ │ +152 │ │ │ │ │ 153 │ │ │ │ │ -154 template │ │ │ │ │ -155 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); │ │ │ │ │ -156 │ │ │ │ │ -157 class _I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r; │ │ │ │ │ -158 │ │ │ │ │ -159 template │ │ │ │ │ -160 class _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r; │ │ │ │ │ -161 │ │ │ │ │ -162 // forward declaration needed for friend declaration. │ │ │ │ │ -163 template │ │ │ │ │ -164 class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ -165 │ │ │ │ │ -166 // forward declaration needed for friend declaration. │ │ │ │ │ -167 template │ │ │ │ │ -_1_6_8 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; │ │ │ │ │ -169 │ │ │ │ │ -170 │ │ │ │ │ -187 template > > │ │ │ │ │ -_1_8_9 class _R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -190 { │ │ │ │ │ -_1_9_1 friend class _I_n_t_e_r_f_a_c_e_B_u_i_l_d_e_r; │ │ │ │ │ -192 friend class _I_n_d_i_c_e_s_S_y_n_c_e_r; │ │ │ │ │ -193 template │ │ │ │ │ -_1_9_4 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> >&, │ │ │ │ │ -195 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_1_,_A_1_>&, │ │ │ │ │ -196 const T1&); │ │ │ │ │ +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/ │ │ │ │ │ +/ ############################################################################# │ │ │ │ │ +194// # The method tupleEntriesModel() does the actual check if the types in a │ │ │ │ │ +tuple │ │ │ │ │ +195// # model a concept using the implementation details above. │ │ │ │ │ +196/ │ │ │ │ │ +/ ############################################################################# │ │ │ │ │ 197 │ │ │ │ │ -198 template │ │ │ │ │ -_1_9_9 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); │ │ │ │ │ -_2_0_0 friend std::ostream& operator<<<>(std::ostream&, const _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_>&); │ │ │ │ │ -201 │ │ │ │ │ -202 public: │ │ │ │ │ -203 │ │ │ │ │ -_2_0_7 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -208 │ │ │ │ │ -_2_1_1 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; │ │ │ │ │ -212 │ │ │ │ │ -_2_1_6 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; │ │ │ │ │ -217 │ │ │ │ │ -218 │ │ │ │ │ -_2_2_2 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; │ │ │ │ │ -223 │ │ │ │ │ -_2_2_7 typedef typename LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ │ -228 │ │ │ │ │ -_2_3_2 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; │ │ │ │ │ -233 │ │ │ │ │ +198template │ │ │ │ │ +_1_9_9constexpr auto _t_u_p_l_e_E_n_t_r_i_e_s_M_o_d_e_l() │ │ │ │ │ +200{ │ │ │ │ │ +201 return _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([&](auto... i) { │ │ │ │ │ +202 return std::conjunction>())...>(); │ │ │ │ │ +203 }, std::make_index_sequence>()); │ │ │ │ │ +204} │ │ │ │ │ +205 │ │ │ │ │ +206/ │ │ │ │ │ +/ ############################################################################# │ │ │ │ │ +207// # The following require*() functions are just helpers that allow to │ │ │ │ │ +208// # propagate a failed check as substitution failure. This is useful │ │ │ │ │ +209// # inside of a concept definition. │ │ │ │ │ +210/ │ │ │ │ │ +/ ############################################################################# │ │ │ │ │ +211 │ │ │ │ │ +212// Helper function for use in concept definitions. │ │ │ │ │ +213// If the passed value b is not true, the concept will to be satisfied. │ │ │ │ │ +214template::type = 0> │ │ │ │ │ +_2_1_5constexpr bool _r_e_q_u_i_r_e_T_r_u_e() │ │ │ │ │ +216{ │ │ │ │ │ +217 return true; │ │ │ │ │ +218} │ │ │ │ │ +219 │ │ │ │ │ +220// Helper function for use in concept definitions. │ │ │ │ │ +221template(), │ │ │ │ │ +int>::type = 0> │ │ │ │ │ +_2_2_2constexpr bool _r_e_q_u_i_r_e_C_o_n_c_e_p_t() │ │ │ │ │ +223{ │ │ │ │ │ +224 return true; │ │ │ │ │ +225} │ │ │ │ │ +226 │ │ │ │ │ +227// Helper function for use in concept definitions. │ │ │ │ │ +228// This allows to avoid using decltype │ │ │ │ │ +229template(), │ │ │ │ │ +int>::type = 0> │ │ │ │ │ +_2_3_0constexpr bool _r_e_q_u_i_r_e_C_o_n_c_e_p_t(T&&... /*t*/) │ │ │ │ │ +231{ │ │ │ │ │ +232 return true; │ │ │ │ │ +233} │ │ │ │ │ 234 │ │ │ │ │ -_2_3_8 using _A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ │ -rebind_alloc; │ │ │ │ │ -239 │ │ │ │ │ -241 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_2 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t; │ │ │ │ │ -243 │ │ │ │ │ -245 typedef std::map > │ │ │ │ │ -_2_4_6 _R_e_m_o_t_e_I_n_d_e_x_M_a_p; │ │ │ │ │ -247 │ │ │ │ │ -_2_4_8 typedef typename RemoteIndexMap::const_iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -249 │ │ │ │ │ -267 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, │ │ │ │ │ -268 const MPI_Comm& comm, const std::vector& _n_e_i_g_h_b_o_u_r_s=std::vector │ │ │ │ │ -(), bool includeSelf=false); │ │ │ │ │ -269 │ │ │ │ │ -270 _R_e_m_o_t_e_I_n_d_i_c_e_s(); │ │ │ │ │ -271 │ │ │ │ │ -279 void _s_e_t_I_n_c_l_u_d_e_S_e_l_f(bool includeSelf); │ │ │ │ │ -280 │ │ │ │ │ -297 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, │ │ │ │ │ -298 const MPI_Comm& comm, const std::vector& _n_e_i_g_h_b_o_u_r_s=std::vector │ │ │ │ │ -()); │ │ │ │ │ +235// Helper function for use in concept definitions. │ │ │ │ │ +236// This checks if the concept given as first type is modelled by all types │ │ │ │ │ +in the tuple passed as argument │ │ │ │ │ +237template(), int>::type = 0> │ │ │ │ │ +_2_3_8constexpr 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() │ │ │ │ │ +239{ │ │ │ │ │ +240 return true; │ │ │ │ │ +241} │ │ │ │ │ +242 │ │ │ │ │ +243// Helper function for use in concept definitions. │ │ │ │ │ +244// If the first passed type is not convertible to the second, the concept │ │ │ │ │ +will not be satisfied. │ │ │ │ │ +245template::value, int>::type = │ │ │ │ │ +0> │ │ │ │ │ +_2_4_7constexpr bool _r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e() │ │ │ │ │ +248{ │ │ │ │ │ +249 return true; │ │ │ │ │ +250} │ │ │ │ │ +251 │ │ │ │ │ +252// Helper function for use in concept definitions. │ │ │ │ │ +253// If passed argument is not convertible to the first passed type, the │ │ │ │ │ +concept will not be satisfied. │ │ │ │ │ +254template::value, int>::type = │ │ │ │ │ +0> │ │ │ │ │ +_2_5_6constexpr bool _r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e(const From&) │ │ │ │ │ +257{ │ │ │ │ │ +258 return true; │ │ │ │ │ +259} │ │ │ │ │ +260 │ │ │ │ │ +261// Helper function for use in concept definitions. │ │ │ │ │ +262// This will always evaluate to true. If just allow │ │ │ │ │ +263// to turn a type into an expression. The failure happens │ │ │ │ │ +264// already during substitution for the type argument. │ │ │ │ │ +265template │ │ │ │ │ +_2_6_6constexpr bool _r_e_q_u_i_r_e_T_y_p_e() │ │ │ │ │ +267{ │ │ │ │ │ +268 return true; │ │ │ │ │ +269} │ │ │ │ │ +270 │ │ │ │ │ +271// Helper function for use in concept definitions. │ │ │ │ │ +272// If first passed type is not a base class of second type, the concept will │ │ │ │ │ +not be satisfied. │ │ │ │ │ +273template::value, int>::type │ │ │ │ │ += 0> │ │ │ │ │ +_2_7_5constexpr bool _r_e_q_u_i_r_e_B_a_s_e_O_f() │ │ │ │ │ +276{ │ │ │ │ │ +277 return true; │ │ │ │ │ +278} │ │ │ │ │ +279 │ │ │ │ │ +280// Helper function for use in concept definitions. │ │ │ │ │ +281// If first passed type is not a base class of first arguments type, the │ │ │ │ │ +concept will not be satisfied. │ │ │ │ │ +282template::value, int>::type │ │ │ │ │ += 0> │ │ │ │ │ +_2_8_4constexpr bool _r_e_q_u_i_r_e_B_a_s_e_O_f(const Derived&) │ │ │ │ │ +285{ │ │ │ │ │ +286 return true; │ │ │ │ │ +287} │ │ │ │ │ +288 │ │ │ │ │ +289// Helper function for use in concept definitions. │ │ │ │ │ +290// If the passed types are not the same, the concept will not be satisfied. │ │ │ │ │ +291template::value, int>::type = 0> │ │ │ │ │ +_2_9_3constexpr bool _r_e_q_u_i_r_e_S_a_m_e_T_y_p_e() │ │ │ │ │ +294{ │ │ │ │ │ +295 return true; │ │ │ │ │ +296} │ │ │ │ │ +297 │ │ │ │ │ +298 │ │ │ │ │ 299 │ │ │ │ │ -300 template │ │ │ │ │ -_3_0_1 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) │ │ │ │ │ -302 { │ │ │ │ │ -303 neighbourIds.clear(); │ │ │ │ │ -304 neighbourIds.insert(_n_e_i_g_h_b_o_u_r_s.begin(), _n_e_i_g_h_b_o_u_r_s.end()); │ │ │ │ │ +300} // namespace Dune::Concept │ │ │ │ │ +301 │ │ │ │ │ +302} // namespace Dune │ │ │ │ │ +303 │ │ │ │ │ +304 │ │ │ │ │ 305 │ │ │ │ │ -306 } │ │ │ │ │ -307 │ │ │ │ │ -_3_0_8 const std::set& _g_e_t_N_e_i_g_h_b_o_u_r_s() const │ │ │ │ │ -309 { │ │ │ │ │ -310 return neighbourIds; │ │ │ │ │ -311 } │ │ │ │ │ -312 │ │ │ │ │ -316 _~_R_e_m_o_t_e_I_n_d_i_c_e_s(); │ │ │ │ │ -317 │ │ │ │ │ -327 template │ │ │ │ │ -328 void _r_e_b_u_i_l_d(); │ │ │ │ │ -329 │ │ │ │ │ -330 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; │ │ │ │ │ -331 │ │ │ │ │ -339 inline bool _i_s_S_y_n_c_e_d() const; │ │ │ │ │ -340 │ │ │ │ │ -344 inline MPI_Comm _c_o_m_m_u_n_i_c_a_t_o_r() const; │ │ │ │ │ -345 │ │ │ │ │ -360 template │ │ │ │ │ -361 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); │ │ │ │ │ -362 │ │ │ │ │ -369 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _f_i_n_d(int proc) const; │ │ │ │ │ -370 │ │ │ │ │ -375 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ -376 │ │ │ │ │ -381 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ -382 │ │ │ │ │ -386 template │ │ │ │ │ -387 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; │ │ │ │ │ -388 │ │ │ │ │ -392 inline void _f_r_e_e(); │ │ │ │ │ -393 │ │ │ │ │ -398 inline int _n_e_i_g_h_b_o_u_r_s() const; │ │ │ │ │ -399 │ │ │ │ │ -401 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; │ │ │ │ │ -402 │ │ │ │ │ -404 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; │ │ │ │ │ -405 │ │ │ │ │ -406 private: │ │ │ │ │ -408 _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; │ │ │ │ │ -409 │ │ │ │ │ -411 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* source_; │ │ │ │ │ -412 │ │ │ │ │ -414 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* target_; │ │ │ │ │ -415 │ │ │ │ │ -417 MPI_Comm comm_; │ │ │ │ │ -418 │ │ │ │ │ -421 std::set neighbourIds; │ │ │ │ │ -422 │ │ │ │ │ -424 const static int commTag_=333; │ │ │ │ │ -425 │ │ │ │ │ -430 int sourceSeqNo_; │ │ │ │ │ -431 │ │ │ │ │ -436 int destSeqNo_; │ │ │ │ │ -437 │ │ │ │ │ -441 bool publicIgnored; │ │ │ │ │ -442 │ │ │ │ │ -446 bool firstBuild; │ │ │ │ │ -447 │ │ │ │ │ -448 /* │ │ │ │ │ -449 * @brief If true, sending from indices of the processor to other │ │ │ │ │ -450 * indices on the same processor is enabled even if the same indexset is │ │ │ │ │ -used │ │ │ │ │ -451 * on both the │ │ │ │ │ -452 * sending and receiving side. │ │ │ │ │ -453 */ │ │ │ │ │ -454 bool includeSelf; │ │ │ │ │ -455 │ │ │ │ │ -457 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_> │ │ │ │ │ -458 PairType; │ │ │ │ │ -459 │ │ │ │ │ -466 _R_e_m_o_t_e_I_n_d_e_x_M_a_p remoteIndices_; │ │ │ │ │ -467 │ │ │ │ │ -478 template │ │ │ │ │ -479 inline void buildRemote(bool includeSelf); │ │ │ │ │ -480 │ │ │ │ │ -486 inline int noPublic(const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet); │ │ │ │ │ -487 │ │ │ │ │ -499 template │ │ │ │ │ -500 inline void packEntries(PairType** myPairs, const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& │ │ │ │ │ -indexSet, │ │ │ │ │ -501 char* p_out, MPI_Datatype type, int bufferSize, │ │ │ │ │ -502 int* position, int n); │ │ │ │ │ -503 │ │ │ │ │ -517 inline void unpackIndices(_R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& remote, int remoteEntries, │ │ │ │ │ -518 PairType** local, int localEntries, char* p_in, │ │ │ │ │ -519 MPI_Datatype type, int* position, int bufferSize, │ │ │ │ │ -520 bool fromOurself); │ │ │ │ │ -521 │ │ │ │ │ -522 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, │ │ │ │ │ -523 int remoteEntries, PairType** localSource, │ │ │ │ │ -524 int localSourceEntries, PairType** localDest, │ │ │ │ │ -525 int localDestEntries, char* p_in, │ │ │ │ │ -526 MPI_Datatype type, int* position, int bufferSize); │ │ │ │ │ -527 │ │ │ │ │ -528 void unpackCreateRemote(char* p_in, PairType** sourcePairs, PairType** │ │ │ │ │ -DestPairs, │ │ │ │ │ -529 int remoteProc, int sourcePublish, int destPublish, │ │ │ │ │ -530 int bufferSize, bool sendTwo, bool fromOurSelf=false); │ │ │ │ │ -531 }; │ │ │ │ │ -532 │ │ │ │ │ -548 template │ │ │ │ │ -_5_4_9 class _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r │ │ │ │ │ -550 { │ │ │ │ │ -551 │ │ │ │ │ -552 template │ │ │ │ │ -_5_5_3 friend class _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ -554 │ │ │ │ │ -555 public: │ │ │ │ │ -_5_5_6 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 │ │ │ │ │ -557 {}; │ │ │ │ │ -558 │ │ │ │ │ -_5_6_7 constexpr static bool _M_O_D_I_F_Y_I_N_D_E_X_S_E_T = mode; │ │ │ │ │ -568 │ │ │ │ │ -_5_7_2 typedef T _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -573 │ │ │ │ │ -_5_7_7 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; │ │ │ │ │ -578 │ │ │ │ │ -_5_8_2 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; │ │ │ │ │ -583 │ │ │ │ │ -_5_8_7 typedef typename LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ │ -588 │ │ │ │ │ -_5_9_2 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; │ │ │ │ │ -593 │ │ │ │ │ -_5_9_7 typedef A _A_l_l_o_c_a_t_o_r; │ │ │ │ │ -598 │ │ │ │ │ -600 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_1 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t; │ │ │ │ │ -602 │ │ │ │ │ -_6_0_6 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; │ │ │ │ │ -607 │ │ │ │ │ -_6_1_1 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; │ │ │ │ │ -612 │ │ │ │ │ -626 void _i_n_s_e_r_t(const _R_e_m_o_t_e_I_n_d_e_x& index); │ │ │ │ │ -627 │ │ │ │ │ -628 │ │ │ │ │ -643 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); │ │ │ │ │ -644 │ │ │ │ │ -652 bool _r_e_m_o_v_e(const _G_l_o_b_a_l_I_n_d_e_x& global); │ │ │ │ │ -653 │ │ │ │ │ -666 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(); │ │ │ │ │ -667 │ │ │ │ │ -668 │ │ │ │ │ -669 _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&); │ │ │ │ │ -670 │ │ │ │ │ -_6_7_5 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t_M_o_d_i_f_i_e_r() │ │ │ │ │ -676 : glist_() │ │ │ │ │ -677 {} │ │ │ │ │ -678 │ │ │ │ │ -679 private: │ │ │ │ │ -680 │ │ │ │ │ -686 _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, │ │ │ │ │ -687 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t& rList); │ │ │ │ │ -688 │ │ │ │ │ -689 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; │ │ │ │ │ -690 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; │ │ │ │ │ -691 _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t* rList_; │ │ │ │ │ -692 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t* indexSet_; │ │ │ │ │ -693 GlobalList glist_; │ │ │ │ │ -694 _M_o_d_i_f_y_I_t_e_r_a_t_o_r iter_; │ │ │ │ │ -695 GlobalModifyIterator giter_; │ │ │ │ │ -696 _C_o_n_s_t_I_t_e_r_a_t_o_r end_; │ │ │ │ │ -697 bool first_; │ │ │ │ │ -698 _G_l_o_b_a_l_I_n_d_e_x last_; │ │ │ │ │ -699 }; │ │ │ │ │ -700 │ │ │ │ │ -705 template │ │ │ │ │ -_7_0_6 class _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r │ │ │ │ │ -707 { │ │ │ │ │ -708 │ │ │ │ │ -712 typedef T ParallelIndexSet; │ │ │ │ │ -713 │ │ │ │ │ -717 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; │ │ │ │ │ -718 │ │ │ │ │ -722 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; │ │ │ │ │ -723 │ │ │ │ │ -727 typedef typename LocalIndex::Attribute Attribute; │ │ │ │ │ -728 │ │ │ │ │ -730 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; │ │ │ │ │ -731 │ │ │ │ │ -733 using Allocator = typename std::allocator_traits::template │ │ │ │ │ -rebind_alloc; │ │ │ │ │ -734 │ │ │ │ │ -736 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; │ │ │ │ │ -737 │ │ │ │ │ -739 typedef std::map > │ │ │ │ │ -741 Map; │ │ │ │ │ -742 │ │ │ │ │ -743 public: │ │ │ │ │ -744 │ │ │ │ │ -746 typedef std::map > │ │ │ │ │ -_7_4_7 _R_e_m_o_t_e_I_n_d_e_x_M_a_p; │ │ │ │ │ -748 │ │ │ │ │ -754 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); │ │ │ │ │ -755 │ │ │ │ │ -764 inline void _a_d_v_a_n_c_e(const GlobalIndex& global); │ │ │ │ │ -765 │ │ │ │ │ -775 inline void _a_d_v_a_n_c_e(const GlobalIndex& global, const Attribute& attribute); │ │ │ │ │ -776 │ │ │ │ │ -777 _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_+_+(); │ │ │ │ │ -778 │ │ │ │ │ -782 inline bool _e_m_p_t_y() const; │ │ │ │ │ -783 │ │ │ │ │ -_7_9_0 class _i_t_e_r_a_t_o_r │ │ │ │ │ -791 { │ │ │ │ │ -792 public: │ │ │ │ │ -_7_9_3 typedef typename Map::iterator _R_e_a_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -_7_9_4 typedef typename Map::iterator _C_o_n_s_t_R_e_a_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -795 │ │ │ │ │ -796 │ │ │ │ │ -_7_9_8 _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) │ │ │ │ │ -799 : iter_(iter), end_(_e_n_d), index_(index), hasAttribute(false) │ │ │ │ │ -800 { │ │ │ │ │ -801 // Move to the first valid entry │ │ │ │ │ -802 while(iter_!=end_ && iter_->second.first->localIndexPair().global │ │ │ │ │ -()!=index_) │ │ │ │ │ -803 ++iter_; │ │ │ │ │ -804 } │ │ │ │ │ -805 │ │ │ │ │ -_8_0_6 _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, │ │ │ │ │ -807 Attribute attribute) │ │ │ │ │ -808 : iter_(iter), end_(_e_n_d), index_(index), attribute_(attribute), │ │ │ │ │ -hasAttribute(true) │ │ │ │ │ -809 { │ │ │ │ │ -810 // Move to the first valid entry or the end │ │ │ │ │ -811 while(iter_!=end_ && (iter_->second.first->localIndexPair().global │ │ │ │ │ -()!=index_ │ │ │ │ │ -812 || iter_->second.first->localIndexPair().local().attribute()!=attribute)) │ │ │ │ │ -813 ++iter_; │ │ │ │ │ -814 } │ │ │ │ │ -_8_1_6 _i_t_e_r_a_t_o_r(const _i_t_e_r_a_t_o_r& other) │ │ │ │ │ -817 : iter_(other.iter_), end_(other.end_), index_(other.index_) │ │ │ │ │ -818 { } │ │ │ │ │ -819 │ │ │ │ │ -_8_2_1 _i_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -822 { │ │ │ │ │ -823 ++iter_; │ │ │ │ │ -824 // If entry is not valid move on │ │ │ │ │ -825 while(iter_!=end_ && (iter_->second.first->localIndexPair().global │ │ │ │ │ -()!=index_ || │ │ │ │ │ -826 (hasAttribute && │ │ │ │ │ -827 iter_->second.first->localIndexPair().local().attribute()!=attribute_))) │ │ │ │ │ -828 ++iter_; │ │ │ │ │ -829 assert(iter_==end_ || │ │ │ │ │ -830 (iter_->second.first->localIndexPair().global()==index_)); │ │ │ │ │ -831 assert(iter_==end_ || !hasAttribute || │ │ │ │ │ -832 (iter_->second.first->localIndexPair().local().attribute()==attribute_)); │ │ │ │ │ -833 return *this; │ │ │ │ │ -834 } │ │ │ │ │ -835 │ │ │ │ │ -_8_3_7 const _R_e_m_o_t_e_I_n_d_e_x& _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ -838 { │ │ │ │ │ -839 return *(iter_->second.first); │ │ │ │ │ -840 } │ │ │ │ │ -841 │ │ │ │ │ -_8_4_3 int _p_r_o_c_e_s_s() const │ │ │ │ │ -844 { │ │ │ │ │ -845 return iter_->first; │ │ │ │ │ -846 } │ │ │ │ │ -847 │ │ │ │ │ -_8_4_9 const _R_e_m_o_t_e_I_n_d_e_x* _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ -850 { │ │ │ │ │ -851 return iter_->second.first.operator->(); │ │ │ │ │ -852 } │ │ │ │ │ -853 │ │ │ │ │ -_8_5_5 bool _o_p_e_r_a_t_o_r_=_=(const _i_t_e_r_a_t_o_r& other) const │ │ │ │ │ -856 { │ │ │ │ │ -857 return other.iter_==iter_; │ │ │ │ │ -858 } │ │ │ │ │ -859 │ │ │ │ │ -_8_6_1 bool _o_p_e_r_a_t_o_r_!_=(const _i_t_e_r_a_t_o_r& other) const │ │ │ │ │ -862 { │ │ │ │ │ -863 return other.iter_!=iter_; │ │ │ │ │ -864 } │ │ │ │ │ -865 │ │ │ │ │ -866 private: │ │ │ │ │ -867 _i_t_e_r_a_t_o_r(); │ │ │ │ │ -868 │ │ │ │ │ -869 _R_e_a_l_I_t_e_r_a_t_o_r iter_; │ │ │ │ │ -870 _R_e_a_l_I_t_e_r_a_t_o_r end_; │ │ │ │ │ -871 GlobalIndex index_; │ │ │ │ │ -872 Attribute attribute_; │ │ │ │ │ -873 bool hasAttribute; │ │ │ │ │ -874 }; │ │ │ │ │ -875 │ │ │ │ │ -876 iterator _b_e_g_i_n(); │ │ │ │ │ -877 │ │ │ │ │ -878 iterator _e_n_d(); │ │ │ │ │ -879 │ │ │ │ │ -880 private: │ │ │ │ │ -881 │ │ │ │ │ -882 Map map_; │ │ │ │ │ -883 GlobalIndex index_; │ │ │ │ │ -884 Attribute attribute_; │ │ │ │ │ -885 bool noattribute; │ │ │ │ │ -886 }; │ │ │ │ │ -887 │ │ │ │ │ -888 template │ │ │ │ │ -_8_8_9 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() │ │ │ │ │ -890 { │ │ │ │ │ -891 if(type==MPI_DATATYPE_NULL) { │ │ │ │ │ -892 int length[2] = {1, 1}; │ │ │ │ │ -893 MPI_Aint base; │ │ │ │ │ -894 MPI_Aint disp[2]; │ │ │ │ │ -895 MPI_Datatype types[2] = {_M_P_I_T_r_a_i_t_s_<_T_G_>_:_:_g_e_t_T_y_p_e(), │ │ │ │ │ -896 _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()}; │ │ │ │ │ -897 _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; │ │ │ │ │ -898 MPI_Get_address(&rep, &base); // lower bound of the datatype │ │ │ │ │ -899 MPI_Get_address(&(rep.global_), &disp[0]); │ │ │ │ │ -900 MPI_Get_address(&(rep.local_), &disp[1]); │ │ │ │ │ -901 for (MPI_Aint& d : disp) │ │ │ │ │ -902 d -= base; │ │ │ │ │ -903 │ │ │ │ │ -904 MPI_Datatype tmp; │ │ │ │ │ -905 MPI_Type_create_struct(2, length, disp, types, &tmp); │ │ │ │ │ -906 │ │ │ │ │ -907 MPI_Type_create_resized(tmp, 0, sizeof(_I_n_d_e_x_P_a_i_r │ │ │ │ │ ->), &type); │ │ │ │ │ -908 MPI_Type_commit(&type); │ │ │ │ │ -909 │ │ │ │ │ -910 MPI_Type_free(&tmp); │ │ │ │ │ -911 } │ │ │ │ │ -912 return type; │ │ │ │ │ -913 } │ │ │ │ │ -914 │ │ │ │ │ -915 template │ │ │ │ │ -916 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; │ │ │ │ │ -917 │ │ │ │ │ -918 template │ │ │ │ │ -_9_1_9 _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) │ │ │ │ │ -920 : localIndex_(local), attribute_(static_cast<_s_t_d::underlying_type_t> │ │ │ │ │ -(attribute)) │ │ │ │ │ -921 {} │ │ │ │ │ -922 │ │ │ │ │ -923 template │ │ │ │ │ -_9_2_4 _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) │ │ │ │ │ -925 : localIndex_(0), attribute_(static_cast<_s_t_d::underlying_type_t> │ │ │ │ │ -(attribute)) │ │ │ │ │ -926 {} │ │ │ │ │ -927 │ │ │ │ │ -928 template │ │ │ │ │ -_9_2_9 _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() │ │ │ │ │ -930 : localIndex_(0), attribute_() │ │ │ │ │ -931 {} │ │ │ │ │ -932 template │ │ │ │ │ -_9_3_3 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 │ │ │ │ │ -934 { │ │ │ │ │ -935 return localIndex_==ri.localIndex_ && attribute_==ri.attribute_; │ │ │ │ │ -936 } │ │ │ │ │ -937 │ │ │ │ │ -938 template │ │ │ │ │ -_9_3_9 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 │ │ │ │ │ -940 { │ │ │ │ │ -941 return localIndex_!=ri.localIndex_ || attribute_!=ri.attribute_; │ │ │ │ │ -942 } │ │ │ │ │ -943 │ │ │ │ │ -944 template │ │ │ │ │ -_9_4_5 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 │ │ │ │ │ -946 { │ │ │ │ │ -947 return T2(attribute_); │ │ │ │ │ -948 } │ │ │ │ │ -949 │ │ │ │ │ -950 template │ │ │ │ │ -_9_5_1 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 │ │ │ │ │ -952 { │ │ │ │ │ -953 return *localIndex_; │ │ │ │ │ -954 } │ │ │ │ │ -955 │ │ │ │ │ -956 template │ │ │ │ │ -_9_5_7 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, │ │ │ │ │ -958 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& destination, │ │ │ │ │ -959 const MPI_Comm& comm, │ │ │ │ │ -960 const std::vector& neighbours, │ │ │ │ │ -961 bool includeSelf_) │ │ │ │ │ -962 : source_(&source), target_(&destination), comm_(comm), │ │ │ │ │ -963 sourceSeqNo_(-1), destSeqNo_(-1), publicIgnored(false), firstBuild(true), │ │ │ │ │ -964 includeSelf(includeSelf_) │ │ │ │ │ -965 { │ │ │ │ │ -966 _s_e_t_N_e_i_g_h_b_o_u_r_s(_n_e_i_g_h_b_o_u_r_s); │ │ │ │ │ -967 } │ │ │ │ │ -968 │ │ │ │ │ -969 template │ │ │ │ │ -_9_7_0 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) │ │ │ │ │ -971 { │ │ │ │ │ -972 includeSelf=b; │ │ │ │ │ -973 } │ │ │ │ │ -974 │ │ │ │ │ -975 template │ │ │ │ │ -_9_7_6 _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() │ │ │ │ │ -977 : source_(0), target_(0), sourceSeqNo_(-1), │ │ │ │ │ -978 destSeqNo_(-1), publicIgnored(false), firstBuild(true), │ │ │ │ │ -979 includeSelf(false) │ │ │ │ │ -980 {} │ │ │ │ │ -981 │ │ │ │ │ -982 template │ │ │ │ │ -_9_8_3 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, │ │ │ │ │ -984 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& destination, │ │ │ │ │ -985 const MPI_Comm& comm, │ │ │ │ │ -986 const std::vector& neighbours) │ │ │ │ │ -987 { │ │ │ │ │ -988 free(); │ │ │ │ │ -989 source_ = &source; │ │ │ │ │ -990 target_ = &destination; │ │ │ │ │ -991 comm_ = comm; │ │ │ │ │ -992 firstBuild = true; │ │ │ │ │ -993 setNeighbours(neighbours); │ │ │ │ │ -994 } │ │ │ │ │ -995 │ │ │ │ │ -996 template │ │ │ │ │ -997 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_8 _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 │ │ │ │ │ -999 { │ │ │ │ │ -1000 return *source_; │ │ │ │ │ -1001 } │ │ │ │ │ -1002 │ │ │ │ │ -1003 │ │ │ │ │ -1004 template │ │ │ │ │ -1005 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_6 _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 │ │ │ │ │ -1007 { │ │ │ │ │ -1008 return *target_; │ │ │ │ │ -1009 } │ │ │ │ │ -1010 │ │ │ │ │ -1011 │ │ │ │ │ -1012 template │ │ │ │ │ -_1_0_1_3 _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() │ │ │ │ │ -1014 { │ │ │ │ │ -1015 free(); │ │ │ │ │ -1016 } │ │ │ │ │ -1017 │ │ │ │ │ -1018 template │ │ │ │ │ -1019 template │ │ │ │ │ -_1_0_2_0 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, │ │ │ │ │ -1021 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& indexSet, │ │ │ │ │ -1022 char* p_out, MPI_Datatype type, │ │ │ │ │ -1023 int bufferSize, │ │ │ │ │ -1024 int *position, │ │ │ │ │ -1025 [[maybe_unused]] int n) │ │ │ │ │ -1026 { │ │ │ │ │ -1027 // fill with own indices │ │ │ │ │ -1028 const auto end = indexSet._e_n_d(); │ │ │ │ │ -1029 │ │ │ │ │ -1030 //Now pack the source indices │ │ │ │ │ -1031 int i=0; │ │ │ │ │ -1032 for(auto index = indexSet.begin(); index != end; ++index) │ │ │ │ │ -1033 if(ignorePublic || index->local().isPublic()) { │ │ │ │ │ -1034 │ │ │ │ │ -1035 MPI_Pack(const_cast<_P_a_i_r_T_y_p_e*>(&(*index)), 1, │ │ │ │ │ -1036 type, │ │ │ │ │ -1037 p_out, bufferSize, position, comm_); │ │ │ │ │ -1038 pairs[i++] = const_cast<_P_a_i_r_T_y_p_e*>(&(*index)); │ │ │ │ │ -1039 │ │ │ │ │ -1040 } │ │ │ │ │ -1041 assert(i==n); │ │ │ │ │ -1042 } │ │ │ │ │ -1043 │ │ │ │ │ -1044 template │ │ │ │ │ -1045 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) │ │ │ │ │ -1046 { │ │ │ │ │ -1047 │ │ │ │ │ -1048 int noPublic=0; │ │ │ │ │ -1049 │ │ │ │ │ -1050 const auto end=indexSet._e_n_d(); │ │ │ │ │ -1051 for(auto index=indexSet._b_e_g_i_n(); index!=end; ++index) │ │ │ │ │ -1052 if(index->local().isPublic()) │ │ │ │ │ -1053 noPublic++; │ │ │ │ │ -1054 │ │ │ │ │ -1055 return noPublic; │ │ │ │ │ -1056 │ │ │ │ │ -1057 } │ │ │ │ │ -1058 │ │ │ │ │ -1059 │ │ │ │ │ -1060 template │ │ │ │ │ -1061 inline void RemoteIndices::unpackCreateRemote(char* p_in, PairType** │ │ │ │ │ -sourcePairs, │ │ │ │ │ -1062 PairType** destPairs, int remoteProc, │ │ │ │ │ -1063 int sourcePublish, int destPublish, │ │ │ │ │ -1064 int bufferSize, bool sendTwo, │ │ │ │ │ -1065 bool fromOurSelf) │ │ │ │ │ -1066 { │ │ │ │ │ -1067 │ │ │ │ │ -1068 // unpack the number of indices we received │ │ │ │ │ -1069 int noRemoteSource=-1, noRemoteDest=-1; │ │ │ │ │ -1070 char twoIndexSets=0; │ │ │ │ │ -1071 int position=0; │ │ │ │ │ -1072 // Did we receive two index sets? │ │ │ │ │ -1073 MPI_Unpack(p_in, bufferSize, &position, &twoIndexSets, 1, MPI_CHAR, │ │ │ │ │ -comm_); │ │ │ │ │ -1074 // The number of source indices received │ │ │ │ │ -1075 MPI_Unpack(p_in, bufferSize, &position, &noRemoteSource, 1, MPI_INT, │ │ │ │ │ -comm_); │ │ │ │ │ -1076 // The number of destination indices received │ │ │ │ │ -1077 MPI_Unpack(p_in, bufferSize, &position, &noRemoteDest, 1, MPI_INT, comm_); │ │ │ │ │ -1078 │ │ │ │ │ -1079 │ │ │ │ │ -1080 // Indices for which we receive │ │ │ │ │ -1081 RemoteIndexList* receive= new RemoteIndexList(); │ │ │ │ │ -1082 // Indices for which we send │ │ │ │ │ -1083 RemoteIndexList* send=0; │ │ │ │ │ -1084 │ │ │ │ │ -1085 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(); │ │ │ │ │ -1086 │ │ │ │ │ -1087 if(!twoIndexSets) { │ │ │ │ │ -1088 if(sendTwo) { │ │ │ │ │ -1089 send = new RemoteIndexList(); │ │ │ │ │ -1090 // Create both remote index sets simultaneously │ │ │ │ │ -1091 unpackIndices(*send, *receive, noRemoteSource, sourcePairs, sourcePublish, │ │ │ │ │ -1092 destPairs, destPublish, p_in, type, &position, bufferSize); │ │ │ │ │ -1093 }else{ │ │ │ │ │ -1094 // we only need one list │ │ │ │ │ -1095 unpackIndices(*receive, noRemoteSource, sourcePairs, sourcePublish, │ │ │ │ │ -1096 p_in, type, &position, bufferSize, fromOurSelf); │ │ │ │ │ -1097 send=receive; │ │ │ │ │ -1098 } │ │ │ │ │ -1099 }else{ │ │ │ │ │ -1100 │ │ │ │ │ -1101 int oldPos=position; │ │ │ │ │ -1102 // Two index sets received │ │ │ │ │ -1103 unpackIndices(*receive, noRemoteSource, destPairs, destPublish, │ │ │ │ │ -1104 p_in, type, &position, bufferSize, fromOurSelf); │ │ │ │ │ -1105 if(!sendTwo) │ │ │ │ │ -1106 //unpack source entries again as destination entries │ │ │ │ │ -1107 position=oldPos; │ │ │ │ │ -1108 │ │ │ │ │ -1109 send = new RemoteIndexList(); │ │ │ │ │ -1110 unpackIndices(*send, noRemoteDest, sourcePairs, sourcePublish, │ │ │ │ │ -1111 p_in, type, &position, bufferSize, fromOurSelf); │ │ │ │ │ -1112 } │ │ │ │ │ -1113 │ │ │ │ │ -1114 if(receive->empty() && send->empty()) { │ │ │ │ │ -1115 if(send==receive) { │ │ │ │ │ -1116 delete send; │ │ │ │ │ -1117 }else{ │ │ │ │ │ -1118 delete send; │ │ │ │ │ -1119 delete receive; │ │ │ │ │ -1120 } │ │ │ │ │ -1121 }else{ │ │ │ │ │ -1122 remoteIndices_.insert(std::make_pair(remoteProc, │ │ │ │ │ -1123 std::make_pair(send,receive))); │ │ │ │ │ -1124 } │ │ │ │ │ -1125 } │ │ │ │ │ -1126 │ │ │ │ │ -1127 │ │ │ │ │ -1128 template │ │ │ │ │ -1129 template │ │ │ │ │ -1130 inline void RemoteIndices::buildRemote(bool includeSelf_) │ │ │ │ │ -1131 { │ │ │ │ │ -1132 // Processor configuration │ │ │ │ │ -1133 int rank, procs; │ │ │ │ │ -1134 MPI_Comm_rank(comm_, &rank); │ │ │ │ │ -1135 MPI_Comm_size(comm_, &procs); │ │ │ │ │ -1136 │ │ │ │ │ -1137 // number of local indices to publish │ │ │ │ │ -1138 // The indices of the destination will be send. │ │ │ │ │ -1139 int sourcePublish, destPublish; │ │ │ │ │ -1140 │ │ │ │ │ -1141 // Do we need to send two index sets? │ │ │ │ │ -1142 char sendTwo = (source_ != target_); │ │ │ │ │ -1143 │ │ │ │ │ -1144 if(procs==1 && !(sendTwo || includeSelf_)) │ │ │ │ │ -1145 // Nothing to communicate │ │ │ │ │ -1146 return; │ │ │ │ │ -1147 │ │ │ │ │ -1148 sourcePublish = (ignorePublic) ? source_->size() : noPublic(*source_); │ │ │ │ │ -1149 │ │ │ │ │ -1150 if(sendTwo) │ │ │ │ │ -1151 destPublish = (ignorePublic) ? target_->size() : noPublic(*target_); │ │ │ │ │ -1152 else │ │ │ │ │ -1153 // we only need to send one set of indices │ │ │ │ │ -1154 destPublish = 0; │ │ │ │ │ -1155 │ │ │ │ │ -1156 int maxPublish, publish=sourcePublish+destPublish; │ │ │ │ │ -1157 │ │ │ │ │ -1158 // Calculate maximum number of indices send │ │ │ │ │ -1159 MPI_Allreduce(&publish, &maxPublish, 1, MPI_INT, MPI_MAX, comm_); │ │ │ │ │ -1160 │ │ │ │ │ -1161 // allocate buffers │ │ │ │ │ -1162 PairType** destPairs; │ │ │ │ │ -1163 PairType** sourcePairs = new PairType*[sourcePublish>0 ? sourcePublish : │ │ │ │ │ -1]; │ │ │ │ │ -1164 │ │ │ │ │ -1165 if(sendTwo) │ │ │ │ │ -1166 destPairs = new PairType*[destPublish>0 ? destPublish : 1]; │ │ │ │ │ -1167 else │ │ │ │ │ -1168 destPairs=sourcePairs; │ │ │ │ │ -1169 │ │ │ │ │ -1170 char** buffer = new char*[2]; │ │ │ │ │ -1171 int bufferSize; │ │ │ │ │ -1172 int position=0; │ │ │ │ │ -1173 int intSize; │ │ │ │ │ -1174 int charSize; │ │ │ │ │ -1175 │ │ │ │ │ -1176 // calculate buffer size │ │ │ │ │ -1177 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(); │ │ │ │ │ -1178 │ │ │ │ │ -1179 MPI_Pack_size(maxPublish, type, comm_, │ │ │ │ │ -1180 &bufferSize); │ │ │ │ │ -1181 MPI_Pack_size(1, MPI_INT, comm_, │ │ │ │ │ -1182 &intSize); │ │ │ │ │ -1183 MPI_Pack_size(1, MPI_CHAR, comm_, │ │ │ │ │ -1184 &charSize); │ │ │ │ │ -1185 // Our message will contain the following: │ │ │ │ │ -1186 // a bool whether two index sets where sent │ │ │ │ │ -1187 // the size of the source and the dest indexset, │ │ │ │ │ -1188 // then the source and destination indices │ │ │ │ │ -1189 bufferSize += 2 * intSize + charSize; │ │ │ │ │ -1190 │ │ │ │ │ -1191 if(bufferSize<=0) bufferSize=1; │ │ │ │ │ -1192 │ │ │ │ │ -1193 buffer[0] = new char[bufferSize]; │ │ │ │ │ -1194 buffer[1] = new char[bufferSize]; │ │ │ │ │ -1195 │ │ │ │ │ -1196 │ │ │ │ │ -1197 // pack entries into buffer[0], p_out below! │ │ │ │ │ -1198 MPI_Pack(&sendTwo, 1, MPI_CHAR, buffer[0], bufferSize, &position, │ │ │ │ │ -1199 comm_); │ │ │ │ │ -1200 │ │ │ │ │ -1201 // The number of indices we send for each index set │ │ │ │ │ -1202 MPI_Pack(&sourcePublish, 1, MPI_INT, buffer[0], bufferSize, &position, │ │ │ │ │ -1203 comm_); │ │ │ │ │ -1204 MPI_Pack(&destPublish, 1, MPI_INT, buffer[0], bufferSize, &position, │ │ │ │ │ -1205 comm_); │ │ │ │ │ -1206 │ │ │ │ │ -1207 // Now pack the source indices and setup the destination pairs │ │ │ │ │ -1208 packEntries(sourcePairs, *source_, buffer[0], type, │ │ │ │ │ -1209 bufferSize, &position, sourcePublish); │ │ │ │ │ -1210 // If necessary send the dest indices and setup the source pairs │ │ │ │ │ -1211 if(sendTwo) │ │ │ │ │ -1212 packEntries(destPairs, *target_, buffer[0], type, │ │ │ │ │ -1213 bufferSize, &position, destPublish); │ │ │ │ │ -1214 │ │ │ │ │ -1215 │ │ │ │ │ -1216 // Update remote indices for ourself │ │ │ │ │ -1217 if(sendTwo|| includeSelf_) │ │ │ │ │ -1218 unpackCreateRemote(buffer[0], sourcePairs, destPairs, rank, sourcePublish, │ │ │ │ │ -1219 destPublish, bufferSize, sendTwo, includeSelf_); │ │ │ │ │ -1220 │ │ │ │ │ -1221 neighbourIds.erase(rank); │ │ │ │ │ -1222 │ │ │ │ │ -1223 if(neighbourIds.size()==0) │ │ │ │ │ -1224 { │ │ │ │ │ -1225 _D_u_n_e_:_:_d_v_v_e_r_b<::size_type size_type; │ │ │ │ │ -1261 size_type noNeighbours=neighbourIds.size(); │ │ │ │ │ -1262 │ │ │ │ │ -1263 // setup sends │ │ │ │ │ -1264 for(std::set::iterator neighbour=neighbourIds.begin(); │ │ │ │ │ -1265 neighbour!= neighbourIds.end(); ++neighbour) { │ │ │ │ │ -1266 // Only send the information to the neighbouring processors │ │ │ │ │ -1267 MPI_Issend(buffer[0], position , MPI_PACKED, *neighbour, commTag_, comm_, │ │ │ │ │ -req++); │ │ │ │ │ -1268 } │ │ │ │ │ -1269 │ │ │ │ │ -1270 //Test for received messages │ │ │ │ │ -1271 │ │ │ │ │ -1272 for(size_type received=0; received │ │ │ │ │ -1313 inline void RemoteIndices::unpackIndices(RemoteIndexList& remote, │ │ │ │ │ -1314 int remoteEntries, │ │ │ │ │ -1315 PairType** local, │ │ │ │ │ -1316 int localEntries, │ │ │ │ │ -1317 char* p_in, │ │ │ │ │ -1318 MPI_Datatype type, │ │ │ │ │ -1319 int* position, │ │ │ │ │ -1320 int bufferSize, │ │ │ │ │ -1321 bool fromOurSelf) │ │ │ │ │ -1322 { │ │ │ │ │ -1323 if(remoteEntries==0) │ │ │ │ │ -1324 return; │ │ │ │ │ -1325 │ │ │ │ │ -1326 PairType index; │ │ │ │ │ -1327 MPI_Unpack(p_in, bufferSize, position, &index, 1, │ │ │ │ │ -1328 type, comm_); │ │ │ │ │ -1329 GlobalIndex oldGlobal=index.global(); │ │ │ │ │ -1330 int n_in=0, localIndex=0; │ │ │ │ │ -1331 │ │ │ │ │ -1332 //Check if we know the global index │ │ │ │ │ -1333 while(localIndexglobal()==index.global()) { │ │ │ │ │ -1335 int oldLocalIndex=localIndex; │ │ │ │ │ -1336 │ │ │ │ │ -1337 while(localIndexglobal()==index.global()) { │ │ │ │ │ -1339 if(!fromOurSelf || index.local().attribute() != │ │ │ │ │ -1340 local[localIndex]->local().attribute()) │ │ │ │ │ -1341 // if index is from us it has to have a different attribute │ │ │ │ │ -1342 remote.push_back(RemoteIndex(index.local().attribute(), │ │ │ │ │ -1343 local[localIndex])); │ │ │ │ │ -1344 localIndex++; │ │ │ │ │ -1345 } │ │ │ │ │ -1346 │ │ │ │ │ -1347 // unpack next remote index │ │ │ │ │ -1348 if((++n_in) < remoteEntries) { │ │ │ │ │ -1349 MPI_Unpack(p_in, bufferSize, position, &index, 1, │ │ │ │ │ -1350 type, comm_); │ │ │ │ │ -1351 if(index.global()==oldGlobal) │ │ │ │ │ -1352 // Restart comparison for the same global indices │ │ │ │ │ -1353 localIndex=oldLocalIndex; │ │ │ │ │ -1354 else │ │ │ │ │ -1355 oldGlobal=index.global(); │ │ │ │ │ -1356 }else{ │ │ │ │ │ -1357 // No more received indices │ │ │ │ │ -1358 break; │ │ │ │ │ -1359 } │ │ │ │ │ -1360 continue; │ │ │ │ │ -1361 } │ │ │ │ │ -1362 │ │ │ │ │ -1363 if (local[localIndex]->global() │ │ │ │ │ -1386 inline void RemoteIndices::unpackIndices(RemoteIndexList& send, │ │ │ │ │ -1387 RemoteIndexList& receive, │ │ │ │ │ -1388 int remoteEntries, │ │ │ │ │ -1389 PairType** localSource, │ │ │ │ │ -1390 int localSourceEntries, │ │ │ │ │ -1391 PairType** localDest, │ │ │ │ │ -1392 int localDestEntries, │ │ │ │ │ -1393 char* p_in, │ │ │ │ │ -1394 MPI_Datatype type, │ │ │ │ │ -1395 int* position, │ │ │ │ │ -1396 int bufferSize) │ │ │ │ │ -1397 { │ │ │ │ │ -1398 int n_in=0, sourceIndex=0, destIndex=0; │ │ │ │ │ -1399 │ │ │ │ │ -1400 //Check if we know the global index │ │ │ │ │ -1401 while(n_in= than the │ │ │ │ │ -one in the unpacked index │ │ │ │ │ -1409 while(sourceIndexglobal │ │ │ │ │ -()global │ │ │ │ │ -()global │ │ │ │ │ -()==index.global()) │ │ │ │ │ -1417 send.push_back(RemoteIndex(index.local().attribute(), │ │ │ │ │ -1418 localSource[sourceIndex])); │ │ │ │ │ -1419 │ │ │ │ │ -1420 if(destIndex < localDestEntries && localDest[destIndex]->global() == │ │ │ │ │ -index.global()) │ │ │ │ │ -1421 receive.push_back(RemoteIndex(index.local().attribute(), │ │ │ │ │ -1422 localDest[sourceIndex])); │ │ │ │ │ -1423 } │ │ │ │ │ -1424 │ │ │ │ │ -1425 } │ │ │ │ │ -1426 │ │ │ │ │ -1427 template │ │ │ │ │ -_1_4_2_8 inline void _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_f_r_e_e() │ │ │ │ │ -1429 { │ │ │ │ │ -1430 auto lend = remoteIndices_.end(); │ │ │ │ │ -1431 for(auto lists=remoteIndices_.begin(); lists != lend; ++lists) { │ │ │ │ │ -1432 if(lists->second.first==lists->second.second) { │ │ │ │ │ -1433 // there is only one remote index list. │ │ │ │ │ -1434 delete lists->second.first; │ │ │ │ │ -1435 }else{ │ │ │ │ │ -1436 delete lists->second.first; │ │ │ │ │ -1437 delete lists->second.second; │ │ │ │ │ -1438 } │ │ │ │ │ -1439 } │ │ │ │ │ -1440 remoteIndices_.clear(); │ │ │ │ │ -1441 firstBuild=true; │ │ │ │ │ -1442 } │ │ │ │ │ -1443 │ │ │ │ │ -1444 template │ │ │ │ │ -_1_4_4_5 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 │ │ │ │ │ -1446 { │ │ │ │ │ -1447 return remoteIndices_.size(); │ │ │ │ │ -1448 } │ │ │ │ │ -1449 │ │ │ │ │ -1450 template │ │ │ │ │ -1451 template │ │ │ │ │ -_1_4_5_2 inline void _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_r_e_b_u_i_l_d() │ │ │ │ │ -1453 { │ │ │ │ │ -1454 // Test whether a rebuild is Needed. │ │ │ │ │ -1455 if(firstBuild || │ │ │ │ │ -1456 ignorePublic!=publicIgnored || ! │ │ │ │ │ -1457 isSynced()) { │ │ │ │ │ -1458 free(); │ │ │ │ │ -1459 │ │ │ │ │ -1460 buildRemote(includeSelf); │ │ │ │ │ -1461 │ │ │ │ │ -1462 sourceSeqNo_ = source_->seqNo(); │ │ │ │ │ -1463 destSeqNo_ = target_->seqNo(); │ │ │ │ │ -1464 firstBuild=false; │ │ │ │ │ -1465 publicIgnored=ignorePublic; │ │ │ │ │ -1466 } │ │ │ │ │ -1467 │ │ │ │ │ -1468 │ │ │ │ │ -1469 } │ │ │ │ │ -1470 │ │ │ │ │ -1471 template │ │ │ │ │ -_1_4_7_2 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 │ │ │ │ │ -1473 { │ │ │ │ │ -1474 return sourceSeqNo_==source_->seqNo() && destSeqNo_ ==target_->seqNo(); │ │ │ │ │ -1475 } │ │ │ │ │ -1476 │ │ │ │ │ -1477 template │ │ │ │ │ -1478 template │ │ │ │ │ -_1_4_7_9 _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) │ │ │ │ │ -1480 { │ │ │ │ │ -1481 │ │ │ │ │ -1482 // The user are on their own now! │ │ │ │ │ -1483 // We assume they know what they are doing and just set the │ │ │ │ │ -1484 // remote indices to synced status. │ │ │ │ │ -1485 sourceSeqNo_ = source_->seqNo(); │ │ │ │ │ -1486 destSeqNo_ = target_->seqNo(); │ │ │ │ │ -1487 │ │ │ │ │ -1488 typename RemoteIndexMap::iterator found = remoteIndices_.find(process); │ │ │ │ │ -1489 │ │ │ │ │ -1490 if(found == remoteIndices_.end()) │ │ │ │ │ -1491 { │ │ │ │ │ -1492 if(source_ != target_) │ │ │ │ │ -1493 found = remoteIndices_._i_n_s_e_r_t(found, std::make_pair(process, │ │ │ │ │ -1494 std::make_pair(new _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t(), │ │ │ │ │ -1495 new _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t()))); │ │ │ │ │ -1496 else{ │ │ │ │ │ -1497 _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(); │ │ │ │ │ -1498 found = remoteIndices_.insert(found, │ │ │ │ │ -1499 std::make_pair(process, │ │ │ │ │ -1500 std::make_pair(rlist, rlist))); │ │ │ │ │ -1501 } │ │ │ │ │ -1502 } │ │ │ │ │ -1503 │ │ │ │ │ -1504 firstBuild = false; │ │ │ │ │ -1505 │ │ │ │ │ -1506 if(send) │ │ │ │ │ -1507 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)); │ │ │ │ │ -1508 else │ │ │ │ │ -1509 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)); │ │ │ │ │ -1510 } │ │ │ │ │ -1511 │ │ │ │ │ -1512 template │ │ │ │ │ -1513 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_4 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_f_i_n_d(int proc) const │ │ │ │ │ -1515 { │ │ │ │ │ -1516 return remoteIndices_.find(proc); │ │ │ │ │ -1517 } │ │ │ │ │ -1518 │ │ │ │ │ -1519 template │ │ │ │ │ -1520 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_1 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_b_e_g_i_n() const │ │ │ │ │ -1522 { │ │ │ │ │ -1523 return remoteIndices_.begin(); │ │ │ │ │ -1524 } │ │ │ │ │ -1525 │ │ │ │ │ -1526 template │ │ │ │ │ -1527 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_8 _R_e_m_o_t_e_I_n_d_i_c_e_s_<_T_,_A_>_:_:_e_n_d() const │ │ │ │ │ -1529 { │ │ │ │ │ -1530 return remoteIndices_.end(); │ │ │ │ │ -1531 } │ │ │ │ │ -1532 │ │ │ │ │ -1533 │ │ │ │ │ -1534 template │ │ │ │ │ -_1_5_3_5 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 │ │ │ │ │ -1536 { │ │ │ │ │ -1537 if(neighbours()!=ri._n_e_i_g_h_b_o_u_r_s()) │ │ │ │ │ -1538 return false; │ │ │ │ │ -1539 │ │ │ │ │ -1540 const auto rend = remoteIndices_.end(); │ │ │ │ │ -1541 │ │ │ │ │ -1542 for(auto rindex = remoteIndices_.begin(), rindex1=ri.remoteIndices_.begin │ │ │ │ │ -(); rindex!=rend; ++rindex, ++rindex1) { │ │ │ │ │ -1543 if(rindex->first != rindex1->first) │ │ │ │ │ -1544 return false; │ │ │ │ │ -1545 if(*(rindex->second.first) != *(rindex1->second.first)) │ │ │ │ │ -1546 return false; │ │ │ │ │ -1547 if(*(rindex->second.second) != *(rindex1->second.second)) │ │ │ │ │ -1548 return false; │ │ │ │ │ -1549 } │ │ │ │ │ -1550 return true; │ │ │ │ │ -1551 } │ │ │ │ │ -1552 │ │ │ │ │ -1553 template │ │ │ │ │ -1554 _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, │ │ │ │ │ -1555 RemoteIndexList& rList) │ │ │ │ │ -1556 : rList_(&rList), indexSet_(&indexSet), iter_(rList.beginModify()), end_ │ │ │ │ │ -(rList.end()), first_(true) │ │ │ │ │ -1557 { │ │ │ │ │ -1558 if(MODIFYINDEXSET) { │ │ │ │ │ -1559 assert(indexSet_); │ │ │ │ │ -1560 for(ConstIterator iter=iter_; iter != end_; ++iter) │ │ │ │ │ -1561 glist_.push_back(iter->localIndexPair().global()); │ │ │ │ │ -1562 giter_ = glist_.beginModify(); │ │ │ │ │ -1563 } │ │ │ │ │ -1564 } │ │ │ │ │ -1565 │ │ │ │ │ -1566 template │ │ │ │ │ -_1_5_6_7 _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) │ │ │ │ │ -1568 : rList_(other.rList_), indexSet_(other.indexSet_), │ │ │ │ │ -1569 glist_(other.glist_), iter_(other.iter_), giter_(other.giter_), end_ │ │ │ │ │ -(other.end_), │ │ │ │ │ -1570 first_(other.first_), last_(other.last_) │ │ │ │ │ -1571 {} │ │ │ │ │ -1572 │ │ │ │ │ -1573 template │ │ │ │ │ -_1_5_7_4 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() │ │ │ │ │ -1575 { │ │ │ │ │ -1576 if(MODIFYINDEXSET) { │ │ │ │ │ -1577 // repair pointers to local index set. │ │ │ │ │ -1578#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1579 if(indexSet_->state()!=_G_R_O_U_N_D) │ │ │ │ │ -1580 _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"); │ │ │ │ │ -1581#endif │ │ │ │ │ -1582 auto giter = glist_.begin(); │ │ │ │ │ -1583 auto index = indexSet_->begin(); │ │ │ │ │ -1584 │ │ │ │ │ -1585 for(auto iter=rList_->begin(); iter != end_; ++iter) { │ │ │ │ │ -1586 while(index->global()<*giter) { │ │ │ │ │ -1587 ++index; │ │ │ │ │ -1588#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1589 if(index == indexSet_->end()) │ │ │ │ │ -1590 _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!"); │ │ │ │ │ -1591#endif │ │ │ │ │ -1592 } │ │ │ │ │ -1593 │ │ │ │ │ -1594#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1595 if(index->global() != *giter) │ │ │ │ │ -1596 _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!"); │ │ │ │ │ -1597#endif │ │ │ │ │ -1598 iter->localIndex_ = &(*index); │ │ │ │ │ -1599 } │ │ │ │ │ -1600 } │ │ │ │ │ -1601 } │ │ │ │ │ -1602 │ │ │ │ │ -1603 template │ │ │ │ │ -_1_6_0_4 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) │ │ │ │ │ -1605 { │ │ │ │ │ -1606 static_assert(!mode,"Not allowed if the mode indicates that new indices" │ │ │ │ │ -1607 "might be added to the underlying index set. Use " │ │ │ │ │ -1608 "insert(const RemoteIndex&, const GlobalIndex&) instead"); │ │ │ │ │ -1609 │ │ │ │ │ -1610#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1611 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()) { │ │ │ │ │ -1616 ++iter_; │ │ │ │ │ -1617 } │ │ │ │ │ -1618 │ │ │ │ │ -1619 // No duplicate entries allowed │ │ │ │ │ -1620 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()); │ │ │ │ │ -1621 iter_.insert(index); │ │ │ │ │ -1622 last_ = index._l_o_c_a_l_I_n_d_e_x_P_a_i_r()._g_l_o_b_a_l(); │ │ │ │ │ -1623 first_ = false; │ │ │ │ │ -1624 } │ │ │ │ │ -1625 │ │ │ │ │ -1626 template │ │ │ │ │ -_1_6_2_7 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) │ │ │ │ │ -1628 { │ │ │ │ │ -1629 static_assert(mode,"Not allowed if the mode indicates that no new indices" │ │ │ │ │ -1630 "might be added to the underlying index set. Use " │ │ │ │ │ -1631 "insert(const RemoteIndex&) instead"); │ │ │ │ │ -1632#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1633 if(!first_ && globallocalIndexPair().global() != global); │ │ │ │ │ -1644 iter_.insert(index); │ │ │ │ │ -1645 giter_.insert(global); │ │ │ │ │ -1646 │ │ │ │ │ -1647 last_ = global; │ │ │ │ │ -1648 first_ = false; │ │ │ │ │ -1649 } │ │ │ │ │ -1650 │ │ │ │ │ -1651 template │ │ │ │ │ -_1_6_5_2 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) │ │ │ │ │ -1653 { │ │ │ │ │ -1654#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1655 if(!first_ && globallocalIndexPair().global() < global) │ │ │ │ │ -1674 ++iter_; │ │ │ │ │ -1675 │ │ │ │ │ -1676 if(iter_->localIndexPair().global()==global) { │ │ │ │ │ -1677 iter_.remove(); │ │ │ │ │ -1678 found = true; │ │ │ │ │ -1679 } │ │ │ │ │ -1680 } │ │ │ │ │ -1681 │ │ │ │ │ -1682 last_ = global; │ │ │ │ │ -1683 first_ = false; │ │ │ │ │ -1684 return found; │ │ │ │ │ -1685 } │ │ │ │ │ -1686 │ │ │ │ │ -1687 template │ │ │ │ │ -1688 template │ │ │ │ │ -_1_6_8_9 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 │ │ │ │ │ -1690 { │ │ │ │ │ -1691 return _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>(remoteIndices_, send); │ │ │ │ │ -1692 } │ │ │ │ │ -1693 │ │ │ │ │ -1694 template │ │ │ │ │ -_1_6_9_5 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 │ │ │ │ │ -1696 { │ │ │ │ │ -1697 return comm_; │ │ │ │ │ -1698 │ │ │ │ │ -1699 } │ │ │ │ │ -1700 │ │ │ │ │ -1701 template │ │ │ │ │ -_1_7_0_2 _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) │ │ │ │ │ -1703 { │ │ │ │ │ -1704 │ │ │ │ │ -1705 const auto end = pmap.end(); │ │ │ │ │ -1706 for(auto process = pmap.begin(); process != end; ++process) { │ │ │ │ │ -1707 const _R_e_m_o_t_e_I_n_d_e_x_L_i_s_t* list = send ? process->second.first : process- │ │ │ │ │ ->second.second; │ │ │ │ │ -1708 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; │ │ │ │ │ -1709 map_.insert(std::make_pair(process->first, │ │ │ │ │ -1710 std::pair(list->_b_e_g_i_n(), list->_e_n_d()))); │ │ │ │ │ -1711 } │ │ │ │ │ -1712 } │ │ │ │ │ -1713 │ │ │ │ │ -1714 template │ │ │ │ │ -_1_7_1_5 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) │ │ │ │ │ -1716 { │ │ │ │ │ -1717 const auto end = map_.end(); │ │ │ │ │ -1718 │ │ │ │ │ -1719 for(auto iter = map_.begin(); iter != end;) { │ │ │ │ │ -1720 // Step the iterator until we are >= index │ │ │ │ │ -1721 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; │ │ │ │ │ -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 rend = iter->second.second; │ │ │ │ │ -1723 _R_e_m_o_t_e_I_n_d_e_x remoteIndex; │ │ │ │ │ -1724 if(current != rend) │ │ │ │ │ -1725 remoteIndex = *current; │ │ │ │ │ -1726 │ │ │ │ │ -1727 while(iter->second.first!=iter->second.second && iter->second.first- │ │ │ │ │ ->localIndexPair().global()second.first); │ │ │ │ │ -1729 │ │ │ │ │ -1730 // erase from the map if there are no more entries. │ │ │ │ │ -1731 if(iter->second.first == iter->second.second) │ │ │ │ │ -1732 map_.erase(iter++); │ │ │ │ │ -1733 else{ │ │ │ │ │ -1734 ++iter; │ │ │ │ │ -1735 } │ │ │ │ │ -1736 } │ │ │ │ │ -1737 index_=index; │ │ │ │ │ -1738 noattribute=true; │ │ │ │ │ -1739 } │ │ │ │ │ -1740 │ │ │ │ │ -1741 template │ │ │ │ │ -_1_7_4_2 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, │ │ │ │ │ -1743 const Attribute& attribute) │ │ │ │ │ -1744 { │ │ │ │ │ -1745 const auto end = map_.end(); │ │ │ │ │ -1746 │ │ │ │ │ -1747 for(auto iter = map_.begin(); iter != end;) { │ │ │ │ │ -1748 // Step the iterator until we are >= index │ │ │ │ │ -1749 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; │ │ │ │ │ -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 rend = iter->second.second; │ │ │ │ │ -1751 _R_e_m_o_t_e_I_n_d_e_x remoteIndex; │ │ │ │ │ -1752 if(current != rend) │ │ │ │ │ -1753 remoteIndex = *current; │ │ │ │ │ -1754 │ │ │ │ │ -1755 // Move to global index or bigger │ │ │ │ │ -1756 while(iter->second.first!=iter->second.second && iter->second.first- │ │ │ │ │ ->localIndexPair().global()second.first); │ │ │ │ │ -1758 │ │ │ │ │ -1759 // move to attribute or bigger │ │ │ │ │ -1760 while(iter->second.first!=iter->second.second │ │ │ │ │ -1761 && iter->second.first->localIndexPair().global()==index │ │ │ │ │ -1762 && iter->second.first->localIndexPair().local().attribute()second.first); │ │ │ │ │ -1764 │ │ │ │ │ -1765 // erase from the map if there are no more entries. │ │ │ │ │ -1766 if(iter->second.first == iter->second.second) │ │ │ │ │ -1767 map_.erase(iter++); │ │ │ │ │ -1768 else{ │ │ │ │ │ -1769 ++iter; │ │ │ │ │ -1770 } │ │ │ │ │ -1771 } │ │ │ │ │ -1772 index_=index; │ │ │ │ │ -1773 attribute_=attribute; │ │ │ │ │ -1774 noattribute=false; │ │ │ │ │ -1775 } │ │ │ │ │ -1776 │ │ │ │ │ -1777 template │ │ │ │ │ -_1_7_7_8 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_+_+() │ │ │ │ │ -1779 { │ │ │ │ │ -1780 const auto end = map_._e_n_d(); │ │ │ │ │ -1781 │ │ │ │ │ -1782 for(auto iter = map_.begin(); iter != end;) { │ │ │ │ │ -1783 // Step the iterator until we are >= index │ │ │ │ │ -1784 auto current = iter->second.first; │ │ │ │ │ -1785 auto rend = iter->second.second; │ │ │ │ │ -1786 │ │ │ │ │ -1787 // move all iterators pointing to the current global index to next value │ │ │ │ │ -1788 if(iter->second.first->localIndexPair().global()==index_ && │ │ │ │ │ -1789 (noattribute || iter->second.first->localIndexPair().local().attribute() │ │ │ │ │ -== attribute_)) │ │ │ │ │ -1790 ++(iter->second.first); │ │ │ │ │ -1791 │ │ │ │ │ -1792 // erase from the map if there are no more entries. │ │ │ │ │ -1793 if(iter->second.first == iter->second.second) │ │ │ │ │ -1794 map_.erase(iter++); │ │ │ │ │ -1795 else{ │ │ │ │ │ -1796 ++iter; │ │ │ │ │ -1797 } │ │ │ │ │ -1798 } │ │ │ │ │ -1799 return *this; │ │ │ │ │ -1800 } │ │ │ │ │ -1801 │ │ │ │ │ -1802 template │ │ │ │ │ -_1_8_0_3 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 │ │ │ │ │ -1804 { │ │ │ │ │ -1805 return map_.empty(); │ │ │ │ │ -1806 } │ │ │ │ │ -1807 │ │ │ │ │ -1808 template │ │ │ │ │ -1809 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_0 _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() │ │ │ │ │ -1811 { │ │ │ │ │ -1812 if(noattribute) │ │ │ │ │ -1813 return _i_t_e_r_a_t_o_r(map_.begin(), map_.end(), index_); │ │ │ │ │ -1814 else │ │ │ │ │ -1815 return _i_t_e_r_a_t_o_r(map_.begin(), map_.end(), index_, │ │ │ │ │ -1816 attribute_); │ │ │ │ │ -1817 } │ │ │ │ │ -1818 │ │ │ │ │ -1819 template │ │ │ │ │ -1820 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_1 _C_o_l_l_e_c_t_i_v_e_I_t_e_r_a_t_o_r_<_T_,_A_>_:_:_e_n_d() │ │ │ │ │ -1822 { │ │ │ │ │ -1823 return _i_t_e_r_a_t_o_r(map_.end(), map_.end(), index_); │ │ │ │ │ -1824 } │ │ │ │ │ -1825 │ │ │ │ │ -1826 template │ │ │ │ │ -_1_8_2_7 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) │ │ │ │ │ -1828 { │ │ │ │ │ -1829 os<<"[global="< │ │ │ │ │ -_1_8_3_4 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) │ │ │ │ │ -1835 { │ │ │ │ │ -1836 int rank; │ │ │ │ │ -1837 MPI_Comm_rank(indices.comm_, &rank); │ │ │ │ │ -1838 const auto rend = indices.remoteIndices_.end(); │ │ │ │ │ -1839 │ │ │ │ │ -1840 for(auto rindex = indices.remoteIndices_.begin(); rindex!=rend; ++rindex) │ │ │ │ │ -{ │ │ │ │ │ -1841 os<first<<":"; │ │ │ │ │ -1842 │ │ │ │ │ -1843 if(!rindex->second.first->empty()) { │ │ │ │ │ -1844 os<<" send:"; │ │ │ │ │ -1845 │ │ │ │ │ -1846 const auto send= rindex->second.first->end(); │ │ │ │ │ -1847 │ │ │ │ │ -1848 for(auto index = rindex->second.first->begin(); │ │ │ │ │ -1849 index != send; ++index) │ │ │ │ │ -1850 os<<*index<<" "; │ │ │ │ │ -1851 os<second.second->empty()) { │ │ │ │ │ -1854 os<first<<": "<<"receive: "; │ │ │ │ │ -1855 │ │ │ │ │ -1856 for(const auto& index : *(rindex->second.second)) │ │ │ │ │ -1857 os << index << " "; │ │ │ │ │ -1858 } │ │ │ │ │ -1859 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_:_:_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:1574 │ │ │ │ │ -_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:945 │ │ │ │ │ -_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:976 │ │ │ │ │ -_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:1778 │ │ │ │ │ -_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:983 │ │ │ │ │ -_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:1428 │ │ │ │ │ -_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:1604 │ │ │ │ │ -_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:1821 │ │ │ │ │ -_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:1452 │ │ │ │ │ -_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:933 │ │ │ │ │ -_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:1695 │ │ │ │ │ -_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 collectively iterating over the remote indices of all │ │ │ │ │ -remote processes. │ │ │ │ │ -DDeeffiinniittiioonn remoteindices.hh:1689 │ │ │ │ │ -_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:970 │ │ │ │ │ -_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:1702 │ │ │ │ │ -_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_:_:_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:1528 │ │ │ │ │ -_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:1535 │ │ │ │ │ -_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:1803 │ │ │ │ │ -_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:1479 │ │ │ │ │ -_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:1715 │ │ │ │ │ -_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:951 │ │ │ │ │ -_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:998 │ │ │ │ │ -_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:1013 │ │ │ │ │ -_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_:_:_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:1652 │ │ │ │ │ -_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_:_:_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:929 │ │ │ │ │ -_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:1445 │ │ │ │ │ -_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_:_:_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:1006 │ │ │ │ │ -_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:1514 │ │ │ │ │ -_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:1472 │ │ │ │ │ -_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:939 │ │ │ │ │ -_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:1521 │ │ │ │ │ -_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:1810 │ │ │ │ │ -_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:96 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +306 │ │ │ │ │ +307#endif // DUNE_COMMON_CONCEPT_HH │ │ │ │ │ +_i_n_d_i_c_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 │ │ │ │ │ +_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_:_:_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:124 │ │ │ │ │ +_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 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_s_i_z_e │ │ │ │ │ -constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std:: │ │ │ │ │ -integer_sequence< T, II... >) │ │ │ │ │ -Return the size of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn integersequence.hh:75 │ │ │ │ │ -_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:45 │ │ │ │ │ -_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:44 │ │ │ │ │ -_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:52 │ │ │ │ │ -_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:190 │ │ │ │ │ -_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:308 │ │ │ │ │ -_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:232 │ │ │ │ │ -_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_:_:_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:216 │ │ │ │ │ -_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:207 │ │ │ │ │ -_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:227 │ │ │ │ │ -_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:246 │ │ │ │ │ -_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:301 │ │ │ │ │ -_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:242 │ │ │ │ │ -_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:211 │ │ │ │ │ -_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:238 │ │ │ │ │ -_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:222 │ │ │ │ │ -_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:248 │ │ │ │ │ -_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:74 │ │ │ │ │ -_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_:_:_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:91 │ │ │ │ │ -_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:100 │ │ │ │ │ -_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:106 │ │ │ │ │ -_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:550 │ │ │ │ │ -_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:601 │ │ │ │ │ -_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:597 │ │ │ │ │ -_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:577 │ │ │ │ │ -_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:582 │ │ │ │ │ -_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:611 │ │ │ │ │ -_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:606 │ │ │ │ │ -_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:572 │ │ │ │ │ -_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:675 │ │ │ │ │ -_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:587 │ │ │ │ │ -_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:592 │ │ │ │ │ -_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:567 │ │ │ │ │ -_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:707 │ │ │ │ │ -_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:747 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_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:168 │ │ │ │ │ -_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:557 │ │ │ │ │ -_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:791 │ │ │ │ │ -_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:798 │ │ │ │ │ -_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:816 │ │ │ │ │ -_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:837 │ │ │ │ │ -_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:794 │ │ │ │ │ -_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:821 │ │ │ │ │ -_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:849 │ │ │ │ │ -_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:855 │ │ │ │ │ -_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:843 │ │ │ │ │ -_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:806 │ │ │ │ │ -_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:861 │ │ │ │ │ -_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:793 │ │ │ │ │ -_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 │ │ │ │ │ +_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:222 │ │ │ │ │ +_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:215 │ │ │ │ │ +_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:293 │ │ │ │ │ +_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:238 │ │ │ │ │ +_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:275 │ │ │ │ │ +_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:247 │ │ │ │ │ +_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() │ │ │ │ │ +DDeeffiinniittiioonn concept.hh:199 │ │ │ │ │ +_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:266 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: indicessyncer.hh File Reference │ │ │ │ +dune-common: fmatrixev.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,87 +65,50 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Macros
│ │ │ │ +
fmatrixev.cc File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <cassert>
│ │ │ │ +
#include <iostream>
│ │ │ │ #include <cmath>
│ │ │ │ -#include <functional>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <map>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include <mpi.h>
│ │ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ │ -#include <dune/common/sllist.hh>
│ │ │ │ -#include <dune/common/parallel/indexset.hh>
│ │ │ │ -#include <dune/common/parallel/remoteindices.hh>
│ │ │ │ -
│ │ │ │ -

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.
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +#include <cassert>
│ │ │ │ +#include <dune-common-config.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/fmatrixev.hh>
│ │ │ │ +

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

│ │ │ │ +Macros

#define DUNE_FMATRIXEIGENVALUES_CC
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

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

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

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DUNE_FMATRIXEIGENVALUES_CC

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_FMATRIXEIGENVALUES_CC
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,78 +1,22 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -#include │ │ │ │ │ +_M_a_c_r_o_s │ │ │ │ │ +fmatrixev.cc File Reference │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#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 <_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_/_r_e_m_o_t_e_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -_G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_I_n_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) │ │ │ │ │ -  │ │ │ │ │ -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 ********** │ │ │ │ │ -Class for adding missing indices of a distributed index set in a local │ │ │ │ │ -communication. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +#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_/_f_m_a_t_r_i_x_e_v_._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 │ │ │ │ │ +  │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__FFMMAATTRRIIXXEEIIGGEENNVVAALLUUEESS__CCCC ********** │ │ │ │ │ +#define DUNE_FMATRIXEIGENVALUES_CC │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: shared_ptr.hh File Reference │ │ │ │ +dune-common: exceptions.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,56 +72,80 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ +Macros | │ │ │ │ Functions
│ │ │ │ -
shared_ptr.hh File Reference
│ │ │ │ +
exceptions.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

A few common exception classes. │ │ │ │ More...

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

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...
class  Dune::Exception
 Base class for Dune-Exceptions. More...
 
struct  Dune::ExceptionHook
 Base class to add a hook to the Dune::Exception. More...
 
class  Dune::IOError
 Default exception class for I/O errors. More...
 
class  Dune::MathError
 Default exception class for mathematical errors. More...
 
class  Dune::RangeError
 Default exception class for range errors. More...
 
class  Dune::NotImplemented
 Default exception for dummy implementations. More...
 
class  Dune::SystemError
 Default exception class for OS errors. More...
 
class  Dune::OutOfMemoryError
 Default exception if memory allocation fails. More...
 
class  Dune::InvalidStateException
 Default exception if a function was called while the object is not in a valid state for that function. More...
 
class  Dune::ParallelError
 Default exception if an error in the parallel communication of the program occurred. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ +Macros

#define DUNE_THROW(E, m)
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ 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.
 
std::ostream & Dune::operator<< (std::ostream &stream, const Exception &e)
 
│ │ │ │

Detailed Description

│ │ │ │ -

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

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

A few common exception classes.

│ │ │ │ +

This file defines a common framework for generating exception subclasses and to throw them in a simple manner

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,40 +1,63 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -#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 | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +exceptions.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n » _E_x_c_e_p_t_i_o_n_ _h_a_n_d_l_i_n_g │ │ │ │ │ +A few common exception classes. _M_o_r_e_._._. │ │ │ │ │ +#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_:_:_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_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_E_x_c_e_p_t_i_o_n │ │ │ │ │ +  Base class for Dune-Exceptions. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_H_o_o_k │ │ │ │ │ +  Base class to add a hook to the _D_u_n_e_:_:_E_x_c_e_p_t_i_o_n. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_I_O_E_r_r_o_r │ │ │ │ │ +  Default exception class for I/O errors. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_a_t_h_E_r_r_o_r │ │ │ │ │ +  Default exception class for mathematical errors. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r │ │ │ │ │ +  Default exception class for range errors. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_N_o_t_I_m_p_l_e_m_e_n_t_e_d │ │ │ │ │ +  Default exception for dummy implementations. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_S_y_s_t_e_m_E_r_r_o_r │ │ │ │ │ +  Default exception class for OS errors. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_O_u_t_O_f_M_e_m_o_r_y_E_r_r_o_r │ │ │ │ │ +  Default exception if memory allocation fails. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _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. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _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. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___T_H_R_O_W(E, m) │ │ │ │ │ +  │ │ │ │ │ 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. │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &stream, const _E_x_c_e_p_t_i_o_n &e) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements several utilities related to std::shared_ptr. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +This file defines a common framework for generating exception subclasses and to │ │ │ │ │ +throw them in a simple manner │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: shared_ptr.hh Source File │ │ │ │ +dune-common: exceptions.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,72 +74,119 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
shared_ptr.hh
│ │ │ │ +
exceptions.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 © 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_SHARED_PTR_HH
│ │ │ │ -
7#define DUNE_SHARED_PTR_HH
│ │ │ │ +
6#ifndef DUNE_EXCEPTIONS_HH
│ │ │ │ +
7#define DUNE_EXCEPTIONS_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 }
│ │ │ │ -
│ │ │ │ +
9#include <exception>
│ │ │ │ +
10#include <string>
│ │ │ │ +
11#include <sstream>
│ │ │ │ +
12
│ │ │ │ +
13namespace Dune {
│ │ │ │ +
14
│ │ │ │ +
73 /* forward declarations */
│ │ │ │ +
74 class Exception;
│ │ │ │ +
75 struct ExceptionHook;
│ │ │ │
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.
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
95 : public std::exception
│ │ │ │ +
96 {
│ │ │ │ +
97 public:
│ │ │ │ +
98 Exception ();
│ │ │ │ +
99 void message(const std::string &msg);
│ │ │ │ +
100 const char* what() const noexcept override;
│ │ │ │ +
101 static void registerHook (ExceptionHook * hook);
│ │ │ │ +
102 static void clearHook ();
│ │ │ │ +
103 private:
│ │ │ │ +
104 std::string _message;
│ │ │ │ +
105 static ExceptionHook * _hook;
│ │ │ │ +
106 };
│ │ │ │ +
│ │ │ │ +
107
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
174 {
│ │ │ │ +
175 virtual ~ExceptionHook() {}
│ │ │ │ +
176 virtual void operator () () = 0;
│ │ │ │ +
177 };
│ │ │ │ +
│ │ │ │ +
178
│ │ │ │ +
│ │ │ │ +
179 inline std::ostream& operator<<(std::ostream &stream, const Exception &e)
│ │ │ │ +
180 {
│ │ │ │ +
181 return stream << e.what();
│ │ │ │ +
182 }
│ │ │ │ +
│ │ │ │ +
183
│ │ │ │ +
184#ifndef DOXYGEN
│ │ │ │ +
185 // the "format" the exception-type gets printed. __FILE__ and
│ │ │ │ +
186 // __LINE__ are standard C-defines, the GNU cpp-infofile claims that
│ │ │ │ +
187 // C99 defines __func__ as well. __FUNCTION__ is a GNU-extension
│ │ │ │ +
188#define THROWSPEC(E) # E << " [" << __func__ << ":" << __FILE__ << ":" << __LINE__ << "]: "
│ │ │ │ +
189#endif // DOXYGEN
│ │ │ │ +
190
│ │ │ │ +
216 // this is the magic: use the usual do { ... } while (0) trick, create
│ │ │ │ +
217 // the full message via a string stream and throw the created object
│ │ │ │ +
│ │ │ │ +
218#define DUNE_THROW(E, m) do { E th__ex; std::ostringstream th__out; \
│ │ │ │ +
219 th__out << THROWSPEC(E) << m; th__ex.message(th__out.str()); throw th__ex; \
│ │ │ │ +
220} while (0)
│ │ │ │ +
│ │ │ │ +
221
│ │ │ │ +
231 class IOError : public Exception {};
│ │ │ │ +
232
│ │ │ │ +
241 class MathError : public Exception {};
│ │ │ │ +
242
│ │ │ │ +
254 class RangeError : public Exception {};
│ │ │ │ +
255
│ │ │ │ +
263 class NotImplemented : public Exception {};
│ │ │ │ +
264
│ │ │ │ +
271 class SystemError : public Exception {};
│ │ │ │ +
272
│ │ │ │ +
276 class OutOfMemoryError : public SystemError {};
│ │ │ │ +
277
│ │ │ │ + │ │ │ │ +
282
│ │ │ │ +
287 class ParallelError : public Exception {};
│ │ │ │ +
288
│ │ │ │ +
289} // end namespace
│ │ │ │ +
290
│ │ │ │ +
291#endif
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ +
Exception()
Definition exceptions.cc:16
│ │ │ │ +
static void registerHook(ExceptionHook *hook)
add a functor which is called before a Dune::Exception is emitted (see Dune::ExceptionHook)
Definition exceptions.cc:22
│ │ │ │ +
static void clearHook()
remove all hooks
Definition exceptions.cc:27
│ │ │ │ +
void message(const std::string &msg)
store string in internal message buffer
Definition exceptions.cc:32
│ │ │ │ +
virtual void operator()()=0
│ │ │ │ +
virtual ~ExceptionHook()
Definition exceptions.hh:175
│ │ │ │ +
const char * what() const noexcept override
output internal message buffer
Definition exceptions.cc:37
│ │ │ │
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
│ │ │ │ +
Base class for Dune-Exceptions.
Definition exceptions.hh:96
│ │ │ │ +
Base class to add a hook to the Dune::Exception.
Definition exceptions.hh:174
│ │ │ │ +
Default exception class for I/O errors.
Definition exceptions.hh:231
│ │ │ │ +
Default exception class for mathematical errors.
Definition exceptions.hh:241
│ │ │ │ +
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │ +
Default exception for dummy implementations.
Definition exceptions.hh:263
│ │ │ │ +
Default exception class for OS errors.
Definition exceptions.hh:271
│ │ │ │ +
Default exception if memory allocation fails.
Definition exceptions.hh:276
│ │ │ │ +
Default exception if a function was called while the object is not in a valid state for that function...
Definition exceptions.hh:281
│ │ │ │ +
Default exception if an error in the parallel communication of the program occurred.
Definition exceptions.hh:287
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,74 +1,151 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -shared_ptr.hh │ │ │ │ │ +exceptions.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 © 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_SHARED_PTR_HH │ │ │ │ │ -7#define DUNE_SHARED_PTR_HH │ │ │ │ │ +6#ifndef DUNE_EXCEPTIONS_HH │ │ │ │ │ +7#define DUNE_EXCEPTIONS_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 } │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13namespace _D_u_n_e { │ │ │ │ │ +14 │ │ │ │ │ +73 /* forward declarations */ │ │ │ │ │ +74 class Exception; │ │ │ │ │ +75 struct ExceptionHook; │ │ │ │ │ 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 │ │ │ │ │ -_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ -Traits for type conversions and type information. │ │ │ │ │ +_9_4 class _E_x_c_e_p_t_i_o_n │ │ │ │ │ +95 : public std::exception │ │ │ │ │ +96 { │ │ │ │ │ +97 public: │ │ │ │ │ +98 _E_x_c_e_p_t_i_o_n (); │ │ │ │ │ +99 void _m_e_s_s_a_g_e(const std::string &msg); │ │ │ │ │ +100 const char* _w_h_a_t() const noexcept override; │ │ │ │ │ +101 static void _r_e_g_i_s_t_e_r_H_o_o_k (_E_x_c_e_p_t_i_o_n_H_o_o_k * hook); │ │ │ │ │ +102 static void _c_l_e_a_r_H_o_o_k (); │ │ │ │ │ +103 private: │ │ │ │ │ +104 std::string _message; │ │ │ │ │ +105 static _E_x_c_e_p_t_i_o_n_H_o_o_k * _hook; │ │ │ │ │ +106 }; │ │ │ │ │ +107 │ │ │ │ │ +_1_7_3 struct _E_x_c_e_p_t_i_o_n_H_o_o_k │ │ │ │ │ +174 { │ │ │ │ │ +_1_7_5 virtual _~_E_x_c_e_p_t_i_o_n_H_o_o_k() {} │ │ │ │ │ +_1_7_6 virtual void _o_p_e_r_a_t_o_r_ _(_)_ () = 0; │ │ │ │ │ +177 }; │ │ │ │ │ +178 │ │ │ │ │ +_1_7_9 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream &stream, const _E_x_c_e_p_t_i_o_n &e) │ │ │ │ │ +180 { │ │ │ │ │ +181 return stream << e._w_h_a_t(); │ │ │ │ │ +182 } │ │ │ │ │ +183 │ │ │ │ │ +184#ifndef DOXYGEN │ │ │ │ │ +185 // the "format" the exception-type gets printed. __FILE__ and │ │ │ │ │ +186 // __LINE__ are standard C-defines, the GNU cpp-infofile claims that │ │ │ │ │ +187 // C99 defines __func__ as well. __FUNCTION__ is a GNU-extension │ │ │ │ │ +188#define THROWSPEC(E) # E << " [" << __func__ << ":" << __FILE__ << ":" << │ │ │ │ │ +__LINE__ << "]: " │ │ │ │ │ +189#endif // DOXYGEN │ │ │ │ │ +190 │ │ │ │ │ +216 // this is the magic: use the usual do { ... } while (0) trick, create │ │ │ │ │ +217 // the full message via a string stream and throw the created object │ │ │ │ │ +_2_1_8#define DUNE_THROW(E, m) do { E th__ex; std::ostringstream th__out; \ │ │ │ │ │ +219 th__out << THROWSPEC(E) << m; th__ex.message(th__out.str()); throw th__ex; │ │ │ │ │ +\ │ │ │ │ │ +220} while (0) │ │ │ │ │ +221 │ │ │ │ │ +_2_3_1 class _I_O_E_r_r_o_r : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +232 │ │ │ │ │ +_2_4_1 class _M_a_t_h_E_r_r_o_r : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +242 │ │ │ │ │ +_2_5_4 class _R_a_n_g_e_E_r_r_o_r : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +255 │ │ │ │ │ +_2_6_3 class _N_o_t_I_m_p_l_e_m_e_n_t_e_d : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +264 │ │ │ │ │ +_2_7_1 class _S_y_s_t_e_m_E_r_r_o_r : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +272 │ │ │ │ │ +_2_7_6 class _O_u_t_O_f_M_e_m_o_r_y_E_r_r_o_r : public _S_y_s_t_e_m_E_r_r_o_r {}; │ │ │ │ │ +277 │ │ │ │ │ +_2_8_1 class _I_n_v_a_l_i_d_S_t_a_t_e_E_x_c_e_p_t_i_o_n : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +282 │ │ │ │ │ +_2_8_7 class _P_a_r_a_l_l_e_l_E_r_r_o_r : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +288 │ │ │ │ │ +289} // end namespace │ │ │ │ │ +290 │ │ │ │ │ +291#endif │ │ │ │ │ +_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_:_:_E_x_c_e_p_t_i_o_n_:_:_E_x_c_e_p_t_i_o_n │ │ │ │ │ +Exception() │ │ │ │ │ +DDeeffiinniittiioonn exceptions.cc:16 │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_:_:_r_e_g_i_s_t_e_r_H_o_o_k │ │ │ │ │ +static void registerHook(ExceptionHook *hook) │ │ │ │ │ +add a functor which is called before a Dune::Exception is emitted (see Dune:: │ │ │ │ │ +ExceptionHook) │ │ │ │ │ +DDeeffiinniittiioonn exceptions.cc:22 │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_:_:_c_l_e_a_r_H_o_o_k │ │ │ │ │ +static void clearHook() │ │ │ │ │ +remove all hooks │ │ │ │ │ +DDeeffiinniittiioonn exceptions.cc:27 │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_:_:_m_e_s_s_a_g_e │ │ │ │ │ +void message(const std::string &msg) │ │ │ │ │ +store string in internal message buffer │ │ │ │ │ +DDeeffiinniittiioonn exceptions.cc:32 │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_H_o_o_k_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +virtual void operator()()=0 │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_H_o_o_k_:_:_~_E_x_c_e_p_t_i_o_n_H_o_o_k │ │ │ │ │ +virtual ~ExceptionHook() │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_:_:_w_h_a_t │ │ │ │ │ +const char * what() const noexcept override │ │ │ │ │ +output internal message buffer │ │ │ │ │ +DDeeffiinniittiioonn exceptions.cc:37 │ │ │ │ │ _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_:_:_E_x_c_e_p_t_i_o_n │ │ │ │ │ +Base class for Dune-Exceptions. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_H_o_o_k │ │ │ │ │ +Base class to add a hook to the Dune::Exception. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:174 │ │ │ │ │ +_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_t_h_E_r_r_o_r │ │ │ │ │ +Default exception class for mathematical errors. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:241 │ │ │ │ │ +_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_:_:_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_:_:_S_y_s_t_e_m_E_r_r_o_r │ │ │ │ │ +Default exception class for OS errors. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_O_u_t_O_f_M_e_m_o_r_y_E_r_r_o_r │ │ │ │ │ +Default exception if memory allocation fails. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:276 │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: math.hh File Reference │ │ │ │ +dune-common: keywords.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,197 +70,36 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Macros | │ │ │ │ -Functions
│ │ │ │ -
math.hh File Reference
│ │ │ │ +Macros
│ │ │ │ +
keywords.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Some useful basic math stuff. │ │ │ │ +

Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ More...

│ │ │ │ -
#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::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_COMMON_MATH_ISFUNCTION(function, stdfunction)
 
#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function)
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -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)
 
#define DUNE_INLINE_VARIABLE
 Preprocessor macro used for marking variables inline on supported compilers.
 
#define DUNE_GENERALIZED_CONSTEXPR
 Preprocessor macro used for marking code as constexpr under the relaxed rules of C++14 if supported by the compiler.
 
│ │ │ │

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

Definitions of several macros that conditionally make C++ syntax available.

│ │ │ │ +

This header contains several macros that enable C++ features depending on your compiler. Most of these features are optional and provide additional functionality like making code constexpr.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,154 +1,28 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -#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> │ │ │ │ │ +_M_a_c_r_o_s │ │ │ │ │ +keywords.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 │ │ │ │ │ +Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ │ +_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_:_:_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. │ │ │ │ │ -  │ │ │ │ │ -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 │ │ │ │ │ -  │ │ │ │ │ -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___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 │ │ │ │ │ - constexpr Base  _D_u_n_e_:_:_p_o_w_e_r (Base m, Exponent p) │ │ │ │ │ -  Power 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) │ │ │ │ │ +#define  _D_U_N_E___I_N_L_I_N_E___V_A_R_I_A_B_L_E │ │ │ │ │ +  Preprocessor macro used for marking variables inline on supported │ │ │ │ │ + compilers. │ │ │ │ │ +  │ │ │ │ │ +#define  _D_U_N_E___G_E_N_E_R_A_L_I_Z_E_D___C_O_N_S_T_E_X_P_R │ │ │ │ │ +  Preprocessor macro used for marking code as constexpr under the │ │ │ │ │ + relaxed rules of C++14 if supported by the compiler. │ │ │ │ │   │ │ │ │ │ ********** 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") │ │ │ │ │ +Definitions of several macros that conditionally make C++ syntax available. │ │ │ │ │ +This header contains several macros that enable C++ features depending on your │ │ │ │ │ +compiler. Most of these features are optional and provide additional │ │ │ │ │ +functionality like making code constexpr. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: math.hh Source File │ │ │ │ +dune-common: keywords.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,373 +74,41 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
math.hh
│ │ │ │ +
keywords.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 © 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
│ │ │ │ +Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © 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_KEYWORDS_HH
│ │ │ │ +
4#define DUNE_COMMON_KEYWORDS_HH
│ │ │ │ +
5
│ │ │ │ +
6#warning This header is deprecated and will be removed after Dune 2.10. All key words are supported by C++ 17.
│ │ │ │
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
│ │ │ │ -
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
│ │ │ │ -
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, ...
│ │ │ │ -
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)
Returns whether any entry is NaN.
Definition fvector.hh:627
│ │ │ │ -
bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
Returns whether any entry is infinite.
Definition fvector.hh:615
│ │ │ │ -
auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
Returns whether all entries are finite.
Definition fvector.hh:604
│ │ │ │ -
bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, PriorityTag< 2 >, ADLTag)
Returns true if either b or c is NaN.
Definition fvector.hh:639
│ │ │ │ -
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
│ │ │ │ +
20#if __cpp_inline_variables >= 201606
│ │ │ │ +
21#define DUNE_INLINE_VARIABLE inline
│ │ │ │ +
22#else
│ │ │ │ +
24
│ │ │ │ +
27#define DUNE_INLINE_VARIABLE
│ │ │ │ +
28#endif
│ │ │ │ +
29
│ │ │ │ +
30
│ │ │ │ +
31#if __cpp_constexpr >= 201304
│ │ │ │ +
32#define DUNE_GENERALIZED_CONSTEXPR constexpr
│ │ │ │ +
33#else
│ │ │ │ +
35
│ │ │ │ +
38#define DUNE_GENERALIZED_CONSTEXPR
│ │ │ │ +
39#endif
│ │ │ │ +
40
│ │ │ │ +
41
│ │ │ │ +
42#endif // DUNE_COMMON_KEYWORDS_HH
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,385 +1,36 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -math.hh │ │ │ │ │ +keywords.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 © DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright © 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 │ │ │ │ │ +2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ +3#ifndef DUNE_COMMON_KEYWORDS_HH │ │ │ │ │ +4#define DUNE_COMMON_KEYWORDS_HH │ │ │ │ │ +5 │ │ │ │ │ +6#warning This header is deprecated and will be removed after Dune 2.10. All │ │ │ │ │ +key words are supported by C++ 17. │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ -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, ... │ │ │ │ │ -_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) │ │ │ │ │ -Returns whether any entry is NaN. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:627 │ │ │ │ │ -_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) │ │ │ │ │ -Returns whether any entry is infinite. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:615 │ │ │ │ │ -_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) │ │ │ │ │ -Returns whether all entries are finite. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:604 │ │ │ │ │ -_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) │ │ │ │ │ -Returns true if either b or c is NaN. │ │ │ │ │ -DDeeffiinniittiioonn fvector.hh:639 │ │ │ │ │ -_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 │ │ │ │ │ +20#if __cpp_inline_variables >= 201606 │ │ │ │ │ +21#define DUNE_INLINE_VARIABLE inline │ │ │ │ │ +22#else │ │ │ │ │ +24 │ │ │ │ │ +_2_7#define DUNE_INLINE_VARIABLE │ │ │ │ │ +28#endif │ │ │ │ │ +29 │ │ │ │ │ +30 │ │ │ │ │ +31#if __cpp_constexpr >= 201304 │ │ │ │ │ +32#define DUNE_GENERALIZED_CONSTEXPR constexpr │ │ │ │ │ +33#else │ │ │ │ │ +35 │ │ │ │ │ +_3_8#define DUNE_GENERALIZED_CONSTEXPR │ │ │ │ │ +39#endif │ │ │ │ │ +40 │ │ │ │ │ +41 │ │ │ │ │ +42#endif // DUNE_COMMON_KEYWORDS_HH │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: ios_state.hh File Reference │ │ │ │ +dune-common: overloadset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,41 +70,42 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
ios_state.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
overloadset.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

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

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::ios_base_all_saver
 Utility class for storing and resetting stream attributes. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

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

│ │ │ │ -

Utility class for storing and resetting stream attributes.

│ │ │ │ -
Author
Markus Blatt
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,26 +1,27 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -ios_state.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n │ │ │ │ │ -Utility class for storing and resetting stream attributes. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +_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_:_:_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. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Utility class for storing and resetting stream attributes. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +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. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: ios_state.hh Source File │ │ │ │ +dune-common: overloadset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,55 +74,139 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
ios_state.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 © 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_IOS_STATE_HH
│ │ │ │ -
6#define DUNE_COMMON_IOS_STATE_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_OVERLOADSET_HH
│ │ │ │ +
6#define DUNE_COMMON_OVERLOADSET_HH
│ │ │ │
7
│ │ │ │ -
8#include <ios>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
34 {
│ │ │ │ -
35 public:
│ │ │ │ -
37 typedef std::ios_base state_type;
│ │ │ │ -
38
│ │ │ │ - │ │ │ │ -
49
│ │ │ │ - │ │ │ │ -
54
│ │ │ │ -
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:20
│ │ │ │ -
void restore()
Restore flags now.
Definition ios_state.cc:25
│ │ │ │ -
std::ios_base state_type
Export type of object we save the state for.
Definition ios_state.hh:37
│ │ │ │ +
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
│ │ │ │ +
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 // 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
│ │ │ │ +
149template<class... F>
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ -
Utility class for storing and resetting stream attributes.
Definition ios_state.hh:34
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,60 +1,139 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -ios_state.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 © 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_IOS_STATE_HH │ │ │ │ │ -6#define DUNE_COMMON_IOS_STATE_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_OVERLOADSET_HH │ │ │ │ │ +6#define DUNE_COMMON_OVERLOADSET_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -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 │ │ │ │ │ -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:20 │ │ │ │ │ -_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:25 │ │ │ │ │ -_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 │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ +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_:_:_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/a00095.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: classname.hh File Reference │ │ │ │ +dune-common: math.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,49 +70,197 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ +Macros | │ │ │ │ Functions
│ │ │ │ -
classname.hh File Reference
│ │ │ │ +
math.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <cstdlib>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <string>
│ │ │ │ -#include <typeinfo>
│ │ │ │ +
#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::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_COMMON_MATH_ISFUNCTION(function, stdfunction)
 
#define DUNE_COMMON_MATH_ISFUNCTION_FUNCTOR(function)
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

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

│ │ │ │ -

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

│ │ │ │ -
│ │ │ │ +

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,34 +1,154 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ -#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 │ │ │ │ │ +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_:_:_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. │ │ │ │ │   │ │ │ │ │ +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 │ │ │ │ │ +  │ │ │ │ │ +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___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 │ │ │ │ │ + constexpr Base  _D_u_n_e_:_:_p_o_w_e_r (Base m, Exponent p) │ │ │ │ │ +  Power 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 │ │ │ │ │ -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. │ │ │ │ │ + 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 │ │ │ │ │ -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. │ │ │ │ │ + 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 ********** │ │ │ │ │ -A free function to provide the demangled class name of a given object or type │ │ │ │ │ -as a string. │ │ │ │ │ +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/a00095_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: classname.hh Source File │ │ │ │ +dune-common: math.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,95 +74,373 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
classname.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 © 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_CLASSNAME_HH
│ │ │ │ -
6#define DUNE_CLASSNAME_HH
│ │ │ │ +
5#ifndef DUNE_MATH_HH
│ │ │ │ +
6#define DUNE_MATH_HH
│ │ │ │
7
│ │ │ │ -
13#include <cstdlib>
│ │ │ │ -
14#include <memory>
│ │ │ │ -
15#include <string>
│ │ │ │ -
16#include <typeinfo>
│ │ │ │ -
17#include <type_traits>
│ │ │ │ +
12#include <cmath>
│ │ │ │ +
13#include <complex>
│ │ │ │ +
14#include <limits>
│ │ │ │ +
15#include <type_traits>
│ │ │ │ +
16
│ │ │ │ + │ │ │ │
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
│ │ │ │ -
24namespace Dune {
│ │ │ │ -
25
│ │ │ │ -
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 }
│ │ │ │ +
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 }
│ │ │ │
│ │ │ │ -
77} // namespace Dune
│ │ │ │ +
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#endif // DUNE_CLASSNAME_HH
│ │ │ │ +
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, ...
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
std::string className()
Provide the demangled class name of a type T as a string.
Definition classname.hh:47
│ │ │ │ +
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)
Returns whether any entry is NaN.
Definition fvector.hh:627
│ │ │ │ +
bool isInf(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
Returns whether any entry is infinite.
Definition fvector.hh:615
│ │ │ │ +
auto isFinite(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
Returns whether all entries are finite.
Definition fvector.hh:604
│ │ │ │ +
bool isUnordered(const FieldVector< K, 1 > &b, const FieldVector< K, 1 > &c, PriorityTag< 2 >, ADLTag)
Returns true if either b or c is NaN.
Definition fvector.hh:639
│ │ │ │ +
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,90 +1,385 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -classname.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 © 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_CLASSNAME_HH │ │ │ │ │ -6#define DUNE_CLASSNAME_HH │ │ │ │ │ +5#ifndef DUNE_MATH_HH │ │ │ │ │ +6#define DUNE_MATH_HH │ │ │ │ │ 7 │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ +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 │ │ │ │ │ -19#if __has_include() && !DISABLE_CXA_DEMANGLE │ │ │ │ │ -20#define HAVE_CXA_DEMANGLE 1 │ │ │ │ │ -21#include │ │ │ │ │ -22#endif // #if HAVE_CXA_DEMANGLE │ │ │ │ │ -23 │ │ │ │ │ -24namespace _D_u_n_e { │ │ │ │ │ -25 │ │ │ │ │ -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 │ │ │ │ │ +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#endif // DUNE_CLASSNAME_HH │ │ │ │ │ +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, ... │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_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_:_:_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) │ │ │ │ │ +Returns whether any entry is NaN. │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:627 │ │ │ │ │ +_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) │ │ │ │ │ +Returns whether any entry is infinite. │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:615 │ │ │ │ │ +_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) │ │ │ │ │ +Returns whether all entries are finite. │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:604 │ │ │ │ │ +_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) │ │ │ │ │ +Returns true if either b or c is NaN. │ │ │ │ │ +DDeeffiinniittiioonn fvector.hh:639 │ │ │ │ │ +_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/a00098.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: path.cc File Reference │ │ │ │ +dune-common: simd.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,59 +70,96 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ +Typedefs | │ │ │ │ Functions
│ │ │ │ -
path.cc File Reference
│ │ │ │ +
simd.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Utilities for handling filesystem paths. │ │ │ │ +

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

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <iterator>
│ │ │ │ -#include <string>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/stringutility.hh>
│ │ │ │ -#include <dune/common/path.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::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

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

│ │ │ │ -

Utilities for handling filesystem paths.

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

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.
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,46 +1,79 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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.cc 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 │ │ │ │ │ -#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_/_s_t_r_i_n_g_u_t_i_l_i_t_y_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_p_a_t_h_._h_h> │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  _D_u_n_e namespace. │ │ │ │ │ +_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_:_:_S_i_m_d_S_c_a_l_a_r_T_y_p_e_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ -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 │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ -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 │ │ │ │ │ +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_ _> │ │ │ │ │   │ │ │ │ │ - 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 │ │ │ │ │ +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_ _> │ │ │ │ │   │ │ │ │ │ -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 │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -std::string  _D_u_n_e_:_:_p_r_e_t_t_y_P_a_t_h (const std::string &p) │ │ │ │ │ -  pretty print path │ │ │ │ │ +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) │ │ │ │ │   │ │ │ │ │ -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 │ │ │ │ │ +template │ │ │ │ │ + void  _D_u_n_e_:_:_s_w_a_p (T &v1, T &v2, bool mask) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Utilities for handling filesystem paths. │ │ │ │ │ - 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 │ │ │ │ │ +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/a00101.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: enumset.hh File Reference │ │ │ │ +dune-common: mallocallocator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,69 +73,54 @@ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
enumset.hh File Reference
│ │ │ │ +
mallocallocator.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Classes for building sets out of enumeration values. │ │ │ │ +

Allocators that use malloc/free. │ │ │ │ More...

│ │ │ │ -
#include <iostream>
│ │ │ │ +
#include <exception>
│ │ │ │ +#include <cstdlib>
│ │ │ │ +#include <new>
│ │ │ │ +#include <utility>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::EmptySet< TA >
 An empty set. More...
class  Dune::MallocAllocator< T >
 Allocators implementation which simply calls malloc/free. More...
 
class  Dune::AllSet< TA >
 A set containing everything. More...
 
class  Dune::EnumItem< TA, item >
 A set consisting only of one item. More...
 
class  Dune::EnumRange< TA, from, end >
 A set representing a range including the borders. More...
 
class  Dune::NegateSet< S >
 The negation of a set. An item is contained in the set if and only if it is not contained in the negated set. More...
 
class  Dune::Combine< TI1, TI2, TA >
 A set combining two other sets. More...
struct  Dune::MallocAllocator< T >::rebind< U >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Functions

template<typename TA , int i>
std::ostream & Dune::operator<< (std::ostream &os, const EnumItem< TA, i > &)
 
template<typename TA , int from, int to>
std::ostream & Dune::operator<< (std::ostream &os, const EnumRange< TA, from, to > &)
 
template<class TI1 , class TI2 >
Combine< TI1, TI2, typename TI1::Type > Dune::combine (const TI1 &set1, const TI2 &set2)
 
template<class TI1 , class TI2 , class T >
std::ostream & Dune::operator<< (std::ostream &os, const Combine< TI1, TI2, T > &)
 
template<class T >
constexpr bool Dune::operator== (const MallocAllocator< T > &, const MallocAllocator< T > &)
 check whether allocators are equivalent
 
template<class T >
constexpr bool Dune::operator!= (const MallocAllocator< T > &, const MallocAllocator< T > &)
 check whether allocators are not equivalent
 
│ │ │ │

Detailed Description

│ │ │ │ -

Classes for building sets out of enumeration values.

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

Allocators that use malloc/free.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,58 +1,39 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -enumset.hh File Reference │ │ │ │ │ -Classes for building sets out of enumeration values. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +mallocallocator.hh File Reference │ │ │ │ │ +Allocators that use malloc/free. _M_o_r_e_._._. │ │ │ │ │ +#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_:_:_E_m_p_t_y_S_e_t_<_ _T_A_ _> │ │ │ │ │ -  An empty set. _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_ _T_ _> │ │ │ │ │ +  Allocators implementation which simply calls malloc/free. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -class   _D_u_n_e_:_:_A_l_l_S_e_t_<_ _T_A_ _> │ │ │ │ │ -  A set containing everything. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_E_n_u_m_I_t_e_m_<_ _T_A_,_ _i_t_e_m_ _> │ │ │ │ │ -  A set consisting only of one item. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_E_n_u_m_R_a_n_g_e_<_ _T_A_,_ _f_r_o_m_,_ _e_n_d_ _> │ │ │ │ │ -  A set representing a range including the borders. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_N_e_g_a_t_e_S_e_t_<_ _S_ _> │ │ │ │ │ -  The negation of a set. An item is contained in the set if and only if │ │ │ │ │ - it is not contained in the negated set. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -class   _D_u_n_e_:_:_C_o_m_b_i_n_e_<_ _T_I_1_,_ _T_I_2_,_ _T_A_ _> │ │ │ │ │ -  A set combining two other sets. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_ _T_ _>_:_:_r_e_b_i_n_d_<_ _U_ _> │ │ │ │ │   │ │ │ │ │ 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 _E_n_u_m_I_t_e_m< TA, i > &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, │ │ │ │ │ - const _E_n_u_m_R_a_n_g_e< TA, from, to > &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -_C_o_m_b_i_n_e< TI1, TI2, typename TI1::Type >  _D_u_n_e_:_:_c_o_m_b_i_n_e (const TI1 &set1, const │ │ │ │ │ - TI2 &set2) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, │ │ │ │ │ - const _C_o_m_b_i_n_e< TI1, TI2, T > &) │ │ │ │ │ +template │ │ │ │ │ +constexpr bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r< T > &, const │ │ │ │ │ + _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r< T > &) │ │ │ │ │ +  check whether allocators are equivalent │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +constexpr bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r< T > &, const │ │ │ │ │ + _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r< T > &) │ │ │ │ │ +  check whether allocators are not equivalent │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Classes for building sets out of enumeration values. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +Allocators that use malloc/free. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: enumset.hh Source File │ │ │ │ +dune-common: mallocallocator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,190 +74,162 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
enumset.hh
│ │ │ │ +
mallocallocator.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 © 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_ENUMSET_HH
│ │ │ │ -
6#define DUNE_ENUMSET_HH
│ │ │ │ +
5#ifndef DUNE_MALLOC_ALLOCATOR_HH
│ │ │ │ +
6#define DUNE_MALLOC_ALLOCATOR_HH
│ │ │ │
7
│ │ │ │ -
8#include <iostream>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune
│ │ │ │ -
11{
│ │ │ │ -
25 template<typename TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
27 {
│ │ │ │ -
28 public:
│ │ │ │ -
32 typedef TA Type;
│ │ │ │ -
36 static bool contains(const Type& attribute);
│ │ │ │ -
37 };
│ │ │ │ -
│ │ │ │ -
38
│ │ │ │ -
42 template<typename TA>
│ │ │ │ -
│ │ │ │ -
43 class AllSet
│ │ │ │ -
44 {
│ │ │ │ -
45 public:
│ │ │ │ -
49 typedef TA Type;
│ │ │ │ -
53 static bool contains(const Type& attribute);
│ │ │ │ -
54 };
│ │ │ │ -
│ │ │ │ -
55
│ │ │ │ -
59 template<typename TA, int item>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
61 {
│ │ │ │ -
62 public:
│ │ │ │ -
66 typedef TA Type;
│ │ │ │ -
67
│ │ │ │ -
72 static bool contains(const Type& attribute);
│ │ │ │ -
73 };
│ │ │ │ -
│ │ │ │ -
74
│ │ │ │ -
78 template<typename TA,int from, int end>
│ │ │ │ -
│ │ │ │ -
79 class EnumRange //: public PODSet<EnumRange<T,from,end>,T>
│ │ │ │ -
80 {
│ │ │ │ -
81 public:
│ │ │ │ -
85 typedef TA Type;
│ │ │ │ -
86 static bool contains(const Type& item);
│ │ │ │ -
87 };
│ │ │ │ -
│ │ │ │ -
88
│ │ │ │ -
94 template<typename S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
96 {
│ │ │ │ -
97 public:
│ │ │ │ -
98 typedef typename S::Type Type;
│ │ │ │ -
99
│ │ │ │ -
│ │ │ │ -
100 static bool contains(const Type& item)
│ │ │ │ -
101 {
│ │ │ │ -
102 return !S::contains(item);
│ │ │ │ -
103 }
│ │ │ │ -
│ │ │ │ -
104 };
│ │ │ │ -
│ │ │ │ -
105
│ │ │ │ -
109 template<class TI1, class TI2, typename TA=typename TI1::Type>
│ │ │ │ -
│ │ │ │ - │ │ │ │ +
8#include <exception>
│ │ │ │ +
9#include <cstdlib>
│ │ │ │ +
10#include <new>
│ │ │ │ +
11#include <utility>
│ │ │ │ +
12
│ │ │ │ +
17namespace Dune
│ │ │ │ +
18{
│ │ │ │ +
23 template <class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
25 public:
│ │ │ │ +
26 typedef std::size_t size_type;
│ │ │ │ +
27 typedef std::ptrdiff_t difference_type;
│ │ │ │ +
28 typedef T* pointer;
│ │ │ │ +
29 typedef const T* const_pointer;
│ │ │ │ +
30 typedef T& reference;
│ │ │ │ +
31 typedef const T& const_reference;
│ │ │ │ +
32 typedef T value_type;
│ │ │ │ +
│ │ │ │ +
33 template <class U> struct rebind {
│ │ │ │ + │ │ │ │ +
35 };
│ │ │ │ +
│ │ │ │ +
36
│ │ │ │ +
38 MallocAllocator() noexcept {}
│ │ │ │ +
40 template <class U>
│ │ │ │ + │ │ │ │ +
43 ~MallocAllocator() noexcept {}
│ │ │ │ +
44
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
46 {
│ │ │ │ +
47 return &x;
│ │ │ │ +
48 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
50 {
│ │ │ │ +
51 return &x;
│ │ │ │ +
52 }
│ │ │ │ +
│ │ │ │ +
53
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
56 [[maybe_unused]] const void* hint = 0)
│ │ │ │ +
57 {
│ │ │ │ +
58 if (n > this->max_size())
│ │ │ │ +
59 throw std::bad_alloc();
│ │ │ │ +
60
│ │ │ │ +
61 pointer ret = static_cast<pointer>(std::malloc(n * sizeof(T)));
│ │ │ │ +
62 if (!ret)
│ │ │ │ +
63 throw std::bad_alloc();
│ │ │ │ +
64 return ret;
│ │ │ │ +
65 }
│ │ │ │ +
│ │ │ │ +
66
│ │ │ │ +
│ │ │ │ +
68 void deallocate(pointer p, [[maybe_unused]] size_type n)
│ │ │ │ +
69 {
│ │ │ │ +
70 std::free(p);
│ │ │ │ +
71 }
│ │ │ │ +
│ │ │ │ +
72
│ │ │ │ +
│ │ │ │ +
74 size_type max_size() const noexcept
│ │ │ │ +
75 {
│ │ │ │ +
76 return size_type(-1) / sizeof(T);
│ │ │ │ +
77 }
│ │ │ │ +
│ │ │ │ +
78
│ │ │ │ +
│ │ │ │ +
80 void construct(pointer p, const T& val)
│ │ │ │ +
81 {
│ │ │ │ +
82 ::new((void*)p)T(val);
│ │ │ │ +
83 }
│ │ │ │ +
│ │ │ │ +
84
│ │ │ │ +
86 template<typename ... Args>
│ │ │ │ +
│ │ │ │ +
87 void construct(pointer p, Args&&... args)
│ │ │ │ +
88 {
│ │ │ │ +
89 ::new((void *)p)T(std::forward<Args>(args) ...);
│ │ │ │ +
90 }
│ │ │ │ +
│ │ │ │ +
91
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
94 {
│ │ │ │ +
95 p->~T();
│ │ │ │ +
96 }
│ │ │ │ +
│ │ │ │ +
97 };
│ │ │ │ +
│ │ │ │ +
98
│ │ │ │ +
100 template<class T>
│ │ │ │ +
101 constexpr bool
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
103 {
│ │ │ │ +
104 return true;
│ │ │ │ +
105 }
│ │ │ │ +
│ │ │ │ +
106
│ │ │ │ +
108 template<class T>
│ │ │ │ +
109 constexpr bool
│ │ │ │ +
│ │ │ │ + │ │ │ │
111 {
│ │ │ │ -
112 public:
│ │ │ │ -
113 static bool contains(const TA& item);
│ │ │ │ -
114 };
│ │ │ │ +
112 return false;
│ │ │ │ +
113 }
│ │ │ │
│ │ │ │ +
114}
│ │ │ │
115
│ │ │ │ -
116 template<typename TA>
│ │ │ │ -
│ │ │ │ -
117 inline bool EmptySet<TA>::contains([[maybe_unused]] const Type& attribute)
│ │ │ │ -
118 {
│ │ │ │ -
119 return false;
│ │ │ │ -
120 }
│ │ │ │ -
│ │ │ │ -
121
│ │ │ │ -
122 template<typename TA>
│ │ │ │ -
│ │ │ │ -
123 inline bool AllSet<TA>::contains([[maybe_unused]] const Type& attribute)
│ │ │ │ -
124 {
│ │ │ │ -
125 return true;
│ │ │ │ -
126 }
│ │ │ │ -
│ │ │ │ -
127
│ │ │ │ -
128 template<typename TA,int i>
│ │ │ │ -
│ │ │ │ -
129 inline bool EnumItem<TA,i>::contains(const Type& item)
│ │ │ │ -
130 {
│ │ │ │ -
131 return item==i;
│ │ │ │ -
132 }
│ │ │ │ -
│ │ │ │ -
133
│ │ │ │ -
134 template<typename TA,int i>
│ │ │ │ -
│ │ │ │ -
135 inline std::ostream& operator<<(std::ostream& os, const EnumItem<TA,i>&)
│ │ │ │ -
136 {
│ │ │ │ -
137 return os<<i;
│ │ │ │ -
138 }
│ │ │ │ -
│ │ │ │ -
139
│ │ │ │ -
140 template<typename TA, int from, int to>
│ │ │ │ -
│ │ │ │ -
141 inline bool EnumRange<TA,from,to>::contains(const Type& item)
│ │ │ │ -
142 {
│ │ │ │ -
143 return from<=item && item<=to;
│ │ │ │ -
144 }
│ │ │ │ -
│ │ │ │ -
145
│ │ │ │ -
146 template<typename TA, int from, int to>
│ │ │ │ -
│ │ │ │ -
147 inline std::ostream& operator<<(std::ostream& os, const EnumRange<TA,from,to>&)
│ │ │ │ -
148 {
│ │ │ │ -
149 return os<<"["<<from<<" - "<<to<<"]";
│ │ │ │ -
150 }
│ │ │ │ -
│ │ │ │ -
151
│ │ │ │ -
152 template<class TI1, class TI2, typename TA>
│ │ │ │ -
│ │ │ │ -
153 inline bool Combine<TI1,TI2,TA>::contains(const TA& item)
│ │ │ │ -
154 {
│ │ │ │ -
155 return TI1::contains(item) ||
│ │ │ │ -
156 TI2::contains(item);
│ │ │ │ -
157 }
│ │ │ │ -
│ │ │ │ -
158
│ │ │ │ -
159 template<class TI1, class TI2>
│ │ │ │ -
│ │ │ │ -
160 inline Combine<TI1,TI2,typename TI1::Type> combine([[maybe_unused]] const TI1& set1,
│ │ │ │ -
161 [[maybe_unused]] const TI2& set2)
│ │ │ │ -
162 {
│ │ │ │ - │ │ │ │ -
164 }
│ │ │ │ -
│ │ │ │ -
165
│ │ │ │ -
166 template<class TI1, class TI2, class T>
│ │ │ │ -
│ │ │ │ -
167 inline std::ostream& operator<<(std::ostream& os, const Combine<TI1,TI2,T>&)
│ │ │ │ -
168 {
│ │ │ │ -
169 return os << TI1()<<" "<<TI2();
│ │ │ │ -
170 }
│ │ │ │ -
│ │ │ │ -
172}
│ │ │ │ -
173
│ │ │ │ -
174#endif
│ │ │ │ -
static bool contains(const Type &attribute)
Always returns true.
Definition enumset.hh:123
│ │ │ │ -
static bool contains(const Type &item)
Definition enumset.hh:141
│ │ │ │ -
static bool contains(const TA &item)
Definition enumset.hh:153
│ │ │ │ -
static bool contains(const Type &attribute)
Always returns false.
Definition enumset.hh:117
│ │ │ │ -
static bool contains(const Type &attribute)
Tests whether an item is in the set.
Definition enumset.hh:129
│ │ │ │ -
Combine< TI1, TI2, typename TI1::Type > combine(const TI1 &set1, const TI2 &set2)
Definition enumset.hh:160
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ +
116#endif // DUNE_MALLOC_ALLOCATOR_HH
│ │ │ │ +
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:238
│ │ │ │ +
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:260
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
An empty set.
Definition enumset.hh:27
│ │ │ │ -
TA Type
The POD type the set holds.
Definition enumset.hh:32
│ │ │ │ -
A set containing everything.
Definition enumset.hh:44
│ │ │ │ -
TA Type
The POD type the set holds.
Definition enumset.hh:49
│ │ │ │ -
A set consisting only of one item.
Definition enumset.hh:61
│ │ │ │ -
TA Type
The type the set holds.
Definition enumset.hh:66
│ │ │ │ -
A set representing a range including the borders.
Definition enumset.hh:80
│ │ │ │ -
TA Type
The type the set holds.
Definition enumset.hh:85
│ │ │ │ -
The negation of a set. An item is contained in the set if and only if it is not contained in the nega...
Definition enumset.hh:96
│ │ │ │ -
S::Type Type
Definition enumset.hh:98
│ │ │ │ -
static bool contains(const Type &item)
Definition enumset.hh:100
│ │ │ │ -
A set combining two other sets.
Definition enumset.hh:111
│ │ │ │ +
Allocators implementation which simply calls malloc/free.
Definition mallocallocator.hh:24
│ │ │ │ +
~MallocAllocator() noexcept
cleanup this allocator
Definition mallocallocator.hh:43
│ │ │ │ +
T * pointer
Definition mallocallocator.hh:28
│ │ │ │ +
void construct(pointer p, const T &val)
copy-construct an object of type T (i.e. make a placement new on p)
Definition mallocallocator.hh:80
│ │ │ │ +
MallocAllocator() noexcept
create a new MallocAllocator
Definition mallocallocator.hh:38
│ │ │ │ +
MallocAllocator(const MallocAllocator< U > &) noexcept
copy construct from an other MallocAllocator, possibly for a different result type
Definition mallocallocator.hh:41
│ │ │ │ +
std::size_t size_type
Definition mallocallocator.hh:26
│ │ │ │ +
std::ptrdiff_t difference_type
Definition mallocallocator.hh:27
│ │ │ │ +
void deallocate(pointer p, size_type n)
deallocate n objects of type T at address p
Definition mallocallocator.hh:68
│ │ │ │ +
T value_type
Definition mallocallocator.hh:32
│ │ │ │ +
const_pointer address(const_reference x) const
Definition mallocallocator.hh:49
│ │ │ │ +
const T & const_reference
Definition mallocallocator.hh:31
│ │ │ │ +
void destroy(pointer p)
destroy an object of type T (i.e. call the destructor)
Definition mallocallocator.hh:93
│ │ │ │ +
pointer allocate(size_type n, const void *hint=0)
allocate n objects of type T
Definition mallocallocator.hh:55
│ │ │ │ +
pointer address(reference x) const
Definition mallocallocator.hh:45
│ │ │ │ +
void construct(pointer p, Args &&... args)
construct an object of type T from variadic parameters
Definition mallocallocator.hh:87
│ │ │ │ +
T & reference
Definition mallocallocator.hh:30
│ │ │ │ +
size_type max_size() const noexcept
max size for allocate
Definition mallocallocator.hh:74
│ │ │ │ +
const T * const_pointer
Definition mallocallocator.hh:29
│ │ │ │ +
Definition mallocallocator.hh:33
│ │ │ │ +
MallocAllocator< U > other
Definition mallocallocator.hh:34
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,204 +1,195 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -enumset.hh │ │ │ │ │ +mallocallocator.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 © 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_ENUMSET_HH │ │ │ │ │ -6#define DUNE_ENUMSET_HH │ │ │ │ │ +5#ifndef DUNE_MALLOC_ALLOCATOR_HH │ │ │ │ │ +6#define DUNE_MALLOC_ALLOCATOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10namespace _D_u_n_e │ │ │ │ │ -11{ │ │ │ │ │ -25 template │ │ │ │ │ -_2_6 class _E_m_p_t_y_S_e_t │ │ │ │ │ -27 { │ │ │ │ │ -28 public: │ │ │ │ │ -_3_2 typedef TA _T_y_p_e; │ │ │ │ │ -36 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& attribute); │ │ │ │ │ -37 }; │ │ │ │ │ -38 │ │ │ │ │ -42 template │ │ │ │ │ -_4_3 class _A_l_l_S_e_t │ │ │ │ │ -44 { │ │ │ │ │ -45 public: │ │ │ │ │ -_4_9 typedef TA _T_y_p_e; │ │ │ │ │ -53 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& attribute); │ │ │ │ │ -54 }; │ │ │ │ │ -55 │ │ │ │ │ -59 template │ │ │ │ │ -_6_0 class _E_n_u_m_I_t_e_m │ │ │ │ │ -61 { │ │ │ │ │ -62 public: │ │ │ │ │ -_6_6 typedef TA _T_y_p_e; │ │ │ │ │ -67 │ │ │ │ │ -72 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& attribute); │ │ │ │ │ -73 }; │ │ │ │ │ -74 │ │ │ │ │ -78 template │ │ │ │ │ -_7_9 class _E_n_u_m_R_a_n_g_e //: public PODSet,T> │ │ │ │ │ -80 { │ │ │ │ │ -81 public: │ │ │ │ │ -_8_5 typedef TA _T_y_p_e; │ │ │ │ │ -86 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& item); │ │ │ │ │ -87 }; │ │ │ │ │ -88 │ │ │ │ │ -94 template │ │ │ │ │ -_9_5 class _N_e_g_a_t_e_S_e_t │ │ │ │ │ -96 { │ │ │ │ │ -97 public: │ │ │ │ │ -_9_8 typedef typename S::Type _T_y_p_e; │ │ │ │ │ -99 │ │ │ │ │ -_1_0_0 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& item) │ │ │ │ │ -101 { │ │ │ │ │ -102 return !S::contains(item); │ │ │ │ │ -103 } │ │ │ │ │ -104 }; │ │ │ │ │ -105 │ │ │ │ │ -109 template │ │ │ │ │ -_1_1_0 class _C_o_m_b_i_n_e │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +17namespace _D_u_n_e │ │ │ │ │ +18{ │ │ │ │ │ +23 template │ │ │ │ │ +_2_4 class _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r { │ │ │ │ │ +25 public: │ │ │ │ │ +_2_6 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +_2_7 typedef std::ptrdiff_t _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ +_2_8 typedef T* _p_o_i_n_t_e_r; │ │ │ │ │ +_2_9 typedef const T* _c_o_n_s_t___p_o_i_n_t_e_r; │ │ │ │ │ +_3_0 typedef T& _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_3_1 typedef const T& _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_3_2 typedef T _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_3_3 template struct _r_e_b_i_n_d { │ │ │ │ │ +_3_4 typedef _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_U_> _o_t_h_e_r; │ │ │ │ │ +35 }; │ │ │ │ │ +36 │ │ │ │ │ +_3_8 _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r() noexcept {} │ │ │ │ │ +40 template │ │ │ │ │ +_4_1 _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r(const _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_U_>&) noexcept {} │ │ │ │ │ +_4_3 _~_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r() noexcept {} │ │ │ │ │ +44 │ │ │ │ │ +_4_5 _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 │ │ │ │ │ +46 { │ │ │ │ │ +47 return &x; │ │ │ │ │ +48 } │ │ │ │ │ +_4_9 _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 │ │ │ │ │ +50 { │ │ │ │ │ +51 return &x; │ │ │ │ │ +52 } │ │ │ │ │ +53 │ │ │ │ │ +_5_5 _p_o_i_n_t_e_r _a_l_l_o_c_a_t_e(_s_i_z_e___t_y_p_e n, │ │ │ │ │ +56 [[maybe_unused]] const void* hint = 0) │ │ │ │ │ +57 { │ │ │ │ │ +58 if (n > this->_m_a_x___s_i_z_e()) │ │ │ │ │ +59 throw std::bad_alloc(); │ │ │ │ │ +60 │ │ │ │ │ +61 _p_o_i_n_t_e_r ret = static_cast<_p_o_i_n_t_e_r>(std::malloc(n * sizeof(T))); │ │ │ │ │ +62 if (!ret) │ │ │ │ │ +63 throw std::bad_alloc(); │ │ │ │ │ +64 return ret; │ │ │ │ │ +65 } │ │ │ │ │ +66 │ │ │ │ │ +_6_8 void _d_e_a_l_l_o_c_a_t_e(_p_o_i_n_t_e_r p, [[maybe_unused]] _s_i_z_e___t_y_p_e n) │ │ │ │ │ +69 { │ │ │ │ │ +70 std::free(p); │ │ │ │ │ +71 } │ │ │ │ │ +72 │ │ │ │ │ +_7_4 _s_i_z_e___t_y_p_e _m_a_x___s_i_z_e() const noexcept │ │ │ │ │ +75 { │ │ │ │ │ +76 return _s_i_z_e___t_y_p_e(-1) / sizeof(T); │ │ │ │ │ +77 } │ │ │ │ │ +78 │ │ │ │ │ +_8_0 void _c_o_n_s_t_r_u_c_t(_p_o_i_n_t_e_r p, const T& val) │ │ │ │ │ +81 { │ │ │ │ │ +82 ::new((void*)p)T(val); │ │ │ │ │ +83 } │ │ │ │ │ +84 │ │ │ │ │ +86 template │ │ │ │ │ +_8_7 void _c_o_n_s_t_r_u_c_t(_p_o_i_n_t_e_r p, Args&&... args) │ │ │ │ │ +88 { │ │ │ │ │ +89 ::new((void *)p)T(std::forward(args) ...); │ │ │ │ │ +90 } │ │ │ │ │ +91 │ │ │ │ │ +_9_3 void _d_e_s_t_r_o_y(_p_o_i_n_t_e_r p) │ │ │ │ │ +94 { │ │ │ │ │ +95 p->~T(); │ │ │ │ │ +96 } │ │ │ │ │ +97 }; │ │ │ │ │ +98 │ │ │ │ │ +100 template │ │ │ │ │ +101 constexpr bool │ │ │ │ │ +_1_0_2 _o_p_e_r_a_t_o_r_=_=(const _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_> &, const _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_> &) │ │ │ │ │ +103 { │ │ │ │ │ +104 return true; │ │ │ │ │ +105 } │ │ │ │ │ +106 │ │ │ │ │ +108 template │ │ │ │ │ +109 constexpr bool │ │ │ │ │ +_1_1_0 _o_p_e_r_a_t_o_r_!_=(const _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_> &, const _M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_<_T_> &) │ │ │ │ │ 111 { │ │ │ │ │ -112 public: │ │ │ │ │ -113 static bool _c_o_n_t_a_i_n_s(const TA& item); │ │ │ │ │ -114 }; │ │ │ │ │ +112 return false; │ │ │ │ │ +113 } │ │ │ │ │ +114} │ │ │ │ │ 115 │ │ │ │ │ -116 template │ │ │ │ │ -_1_1_7 inline bool _E_m_p_t_y_S_e_t_<_T_A_>_:_:_c_o_n_t_a_i_n_s([[maybe_unused]] const _T_y_p_e& attribute) │ │ │ │ │ -118 { │ │ │ │ │ -119 return false; │ │ │ │ │ -120 } │ │ │ │ │ -121 │ │ │ │ │ -122 template │ │ │ │ │ -_1_2_3 inline bool _A_l_l_S_e_t_<_T_A_>_:_:_c_o_n_t_a_i_n_s([[maybe_unused]] const _T_y_p_e& attribute) │ │ │ │ │ -124 { │ │ │ │ │ -125 return true; │ │ │ │ │ -126 } │ │ │ │ │ -127 │ │ │ │ │ -128 template │ │ │ │ │ -_1_2_9 inline bool _E_n_u_m_I_t_e_m_<_T_A_,_i_>_:_:_c_o_n_t_a_i_n_s(const _T_y_p_e& item) │ │ │ │ │ -130 { │ │ │ │ │ -131 return item==i; │ │ │ │ │ -132 } │ │ │ │ │ -133 │ │ │ │ │ -134 template │ │ │ │ │ -_1_3_5 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_n_u_m_I_t_e_m_<_T_A_,_i_>&) │ │ │ │ │ -136 { │ │ │ │ │ -137 return os< │ │ │ │ │ -_1_4_1 inline bool _E_n_u_m_R_a_n_g_e_<_T_A_,_f_r_o_m_,_t_o_>_:_:_c_o_n_t_a_i_n_s(const _T_y_p_e& item) │ │ │ │ │ -142 { │ │ │ │ │ -143 return from<=item && item<=to; │ │ │ │ │ -144 } │ │ │ │ │ -145 │ │ │ │ │ -146 template │ │ │ │ │ -_1_4_7 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const │ │ │ │ │ -_E_n_u_m_R_a_n_g_e_<_T_A_,_f_r_o_m_,_t_o_>&) │ │ │ │ │ -148 { │ │ │ │ │ -149 return os<<"["< │ │ │ │ │ -_1_5_3 inline bool _C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_T_A_>_:_:_c_o_n_t_a_i_n_s(const TA& item) │ │ │ │ │ -154 { │ │ │ │ │ -155 return TI1::contains(item) || │ │ │ │ │ -156 TI2::contains(item); │ │ │ │ │ -157 } │ │ │ │ │ -158 │ │ │ │ │ -159 template │ │ │ │ │ -_1_6_0 inline _C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_t_y_p_e_n_a_m_e_ _T_I_1_:_:_T_y_p_e_> _c_o_m_b_i_n_e([[maybe_unused]] const │ │ │ │ │ -TI1& set1, │ │ │ │ │ -161 [[maybe_unused]] const TI2& set2) │ │ │ │ │ -162 { │ │ │ │ │ -163 return _C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_t_y_p_e_n_a_m_e_ _T_I_1_:_:_T_y_p_e_>(); │ │ │ │ │ -164 } │ │ │ │ │ -165 │ │ │ │ │ -166 template │ │ │ │ │ -_1_6_7 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const │ │ │ │ │ -_C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_T_>&) │ │ │ │ │ -168 { │ │ │ │ │ -169 return os << TI1()<<" "< combine(const TI1 &set1, const TI2 │ │ │ │ │ -&set2) │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:160 │ │ │ │ │ -_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 │ │ │ │ │ +116#endif // DUNE_MALLOC_ALLOCATOR_HH │ │ │ │ │ +_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:238 │ │ │ │ │ +_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:260 │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_E_m_p_t_y_S_e_t │ │ │ │ │ -An empty set. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_E_m_p_t_y_S_e_t_:_:_T_y_p_e │ │ │ │ │ -TA Type │ │ │ │ │ -The POD type the set holds. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_A_l_l_S_e_t │ │ │ │ │ -A set containing everything. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_A_l_l_S_e_t_:_:_T_y_p_e │ │ │ │ │ -TA Type │ │ │ │ │ -The POD type the set holds. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_E_n_u_m_I_t_e_m │ │ │ │ │ -A set consisting only of one item. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_E_n_u_m_I_t_e_m_:_:_T_y_p_e │ │ │ │ │ -TA Type │ │ │ │ │ -The type the set holds. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_E_n_u_m_R_a_n_g_e │ │ │ │ │ -A set representing a range including the borders. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_E_n_u_m_R_a_n_g_e_:_:_T_y_p_e │ │ │ │ │ -TA Type │ │ │ │ │ -The type the set holds. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_N_e_g_a_t_e_S_e_t │ │ │ │ │ -The negation of a set. An item is contained in the set if and only if it is not │ │ │ │ │ -contained in the nega... │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:96 │ │ │ │ │ -_D_u_n_e_:_:_N_e_g_a_t_e_S_e_t_:_:_T_y_p_e │ │ │ │ │ -S::Type Type │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:98 │ │ │ │ │ -_D_u_n_e_:_:_N_e_g_a_t_e_S_e_t_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ -static bool contains(const Type &item) │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_b_i_n_e │ │ │ │ │ -A set combining two other sets. │ │ │ │ │ -DDeeffiinniittiioonn enumset.hh:111 │ │ │ │ │ +_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_:_:_~_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r │ │ │ │ │ +~MallocAllocator() noexcept │ │ │ │ │ +cleanup this allocator │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:43 │ │ │ │ │ +_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_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +void construct(pointer p, const T &val) │ │ │ │ │ +copy-construct an object of type T (i.e. make a placement new on p) │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r │ │ │ │ │ +MallocAllocator() noexcept │ │ │ │ │ +create a new MallocAllocator │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r │ │ │ │ │ +MallocAllocator(const MallocAllocator< U > &) noexcept │ │ │ │ │ +copy construct from an other MallocAllocator, possibly for a different result │ │ │ │ │ +type │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:41 │ │ │ │ │ +_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_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +std::ptrdiff_t difference_type │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_d_e_a_l_l_o_c_a_t_e │ │ │ │ │ +void deallocate(pointer p, size_type n) │ │ │ │ │ +deallocate n objects of type T at address p │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:68 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +T value_type │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_a_d_d_r_e_s_s │ │ │ │ │ +const_pointer address(const_reference x) const │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_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 │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_d_e_s_t_r_o_y │ │ │ │ │ +void destroy(pointer p) │ │ │ │ │ +destroy an object of type T (i.e. call the destructor) │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_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 mallocallocator.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_a_d_d_r_e_s_s │ │ │ │ │ +pointer address(reference x) const │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +void construct(pointer p, Args &&... args) │ │ │ │ │ +construct an object of type T from variadic parameters │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +T & reference │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:30 │ │ │ │ │ +_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 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_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 │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_M_a_l_l_o_c_A_l_l_o_c_a_t_o_r_:_:_r_e_b_i_n_d_:_:_o_t_h_e_r │ │ │ │ │ +MallocAllocator< U > other │ │ │ │ │ +DDeeffiinniittiioonn mallocallocator.hh:34 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: genericiterator.hh File Reference │ │ │ │ +dune-common: bitsetvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,58 +72,58 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
genericiterator.hh File Reference
│ │ │ │ +
bitsetvector.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Implements a generic iterator class for writing stl conformant iterators. │ │ │ │ +

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

│ │ │ │ -
#include <dune/common/iteratorfacades.hh>
│ │ │ │ -#include <cassert>
│ │ │ │ +
#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

struct  Dune::const_reference< R >
 Get the 'const' version of a reference to a mutable object. More...
class  Dune::BitSetVectorConstReference< block_size, Alloc >
 A proxy class that acts as a const reference to a single bitset in a BitSetVector. More...
 
struct  Dune::const_reference< const R >
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< R & >
struct  Dune::const_reference< BitSetVectorReference< block_size, Alloc > >
 
struct  Dune::const_reference< const R & >
struct  Dune::const_reference< BitSetVectorConstReference< block_size, Alloc > >
 
struct  Dune::mutable_reference< R >
 get the 'mutable' version of a reference to a const object More...
struct  Dune::mutable_reference< BitSetVectorReference< block_size, Alloc > >
 
struct  Dune::mutable_reference< const R >
struct  Dune::mutable_reference< BitSetVectorConstReference< block_size, Alloc > >
 
struct  Dune::mutable_reference< R & >
 
struct  Dune::mutable_reference< const R & >
 
class  Dune::GenericIterator< C, T, R, D, IteratorFacade >
 Generic class for stl-conforming iterators for container classes with operator[]. More...
class  Dune::BitSetVector< block_size, Allocator >
 A dynamic array of blocks of booleans. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Implements a generic iterator class for writing stl conformant iterators.

│ │ │ │ -

Using this generic iterator writing iterators for containers that implement operator[] is only a matter of seconds.

│ │ │ │ +

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

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,46 +1,48 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -genericiterator.hh File Reference │ │ │ │ │ -Implements a generic iterator class for writing stl conformant iterators. │ │ │ │ │ +bitsetvector.hh File Reference │ │ │ │ │ +Efficient implementation of a dynamic array of static arrays of booleans. │ │ │ │ │ _M_o_r_e_._._. │ │ │ │ │ -#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> │ │ │ │ │ -#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_/_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 │ │ │ │ │ -struct   _D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _R_ _> │ │ │ │ │ -  Get the 'const' version of a reference to a mutable object. _M_o_r_e_._._. │ │ │ │ │ + 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_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _c_o_n_s_t_ _R_ _> │ │ │ │ │ + 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_<_ _R_ _&_ _> │ │ │ │ │ +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_<_ _c_o_n_s_t_ _R_ _&_ _> │ │ │ │ │ +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_<_ _R_ _> │ │ │ │ │ -  get the 'mutable' version of a reference to a const object _M_o_r_e_._._. │ │ │ │ │ +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_<_ _c_o_n_s_t_ _R_ _> │ │ │ │ │ +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 │ │ │ │ │ + _>_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _R_ _&_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _c_o_n_s_t_ _R_ _&_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_<_ _C_,_ _T_,_ _R_,_ _D_,_ _I_t_e_r_a_t_o_r_F_a_c_a_d_e_ _> │ │ │ │ │ -  Generic class for stl-conforming iterators for container classes with │ │ │ │ │ - operator[]. _M_o_r_e_._._. │ │ │ │ │ + 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 ********** │ │ │ │ │ -Implements a generic iterator class for writing stl conformant iterators. │ │ │ │ │ -Using this generic iterator writing iterators for containers that implement │ │ │ │ │ -operator[] is only a matter of seconds. │ │ │ │ │ +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/a00104_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: genericiterator.hh Source File │ │ │ │ +dune-common: bitsetvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,240 +74,759 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
genericiterator.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 © 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_GENERICITERATOR_HH
│ │ │ │ -
6#define DUNE_GENERICITERATOR_HH
│ │ │ │ +
5#ifndef DUNE_BLOCK_BITFIELD_HH
│ │ │ │ +
6#define DUNE_BLOCK_BITFIELD_HH
│ │ │ │
7
│ │ │ │ - │ │ │ │ -
9#include <cassert>
│ │ │ │ -
10
│ │ │ │ -
11namespace Dune {
│ │ │ │ -
12
│ │ │ │ -
85 template<class R>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
87 {
│ │ │ │ -
88 typedef const R type;
│ │ │ │ -
89 };
│ │ │ │ -
│ │ │ │ -
90
│ │ │ │ -
91 template<class R>
│ │ │ │ -
│ │ │ │ -
92 struct const_reference<const R>
│ │ │ │ -
93 {
│ │ │ │ -
94 typedef const R type;
│ │ │ │ -
95 };
│ │ │ │ -
│ │ │ │ -
96
│ │ │ │ -
97 template<class R>
│ │ │ │ -
│ │ │ │ -
98 struct const_reference<R&>
│ │ │ │ -
99 {
│ │ │ │ -
100 typedef const R& type;
│ │ │ │ -
101 };
│ │ │ │ -
│ │ │ │ -
102
│ │ │ │ -
103 template<class R>
│ │ │ │ -
│ │ │ │ -
104 struct const_reference<const R&>
│ │ │ │ -
105 {
│ │ │ │ -
106 typedef const R& type;
│ │ │ │ -
107 };
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
114 template<class R>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
116 {
│ │ │ │ -
117 typedef R type;
│ │ │ │ -
118 };
│ │ │ │ -
│ │ │ │ -
119
│ │ │ │ -
120 template<class R>
│ │ │ │ -
│ │ │ │ -
121 struct mutable_reference<const R>
│ │ │ │ -
122 {
│ │ │ │ -
123 typedef R type;
│ │ │ │ -
124 };
│ │ │ │ -
│ │ │ │ -
125
│ │ │ │ -
126 template<class R>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
128 {
│ │ │ │ -
129 typedef R& type;
│ │ │ │ -
130 };
│ │ │ │ -
│ │ │ │ -
131
│ │ │ │ -
132 template<class R>
│ │ │ │ -
│ │ │ │ -
133 struct mutable_reference<const R&>
│ │ │ │ -
134 {
│ │ │ │ -
135 typedef R& type;
│ │ │ │ -
136 };
│ │ │ │ -
│ │ │ │ -
137
│ │ │ │ -
149 template<class C, class T, class R=T&, class D = std::ptrdiff_t,
│ │ │ │ -
150 template<class,class,class,class> class IteratorFacade=RandomAccessIteratorFacade>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
152 public IteratorFacade<GenericIterator<C,T,R,D,IteratorFacade>,T,R,D>
│ │ │ │ -
153 {
│ │ │ │ -
154 friend class GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade>;
│ │ │ │ -
155 friend class GenericIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type, D, IteratorFacade>;
│ │ │ │ -
156
│ │ │ │ -
157 typedef GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade> MutableIterator;
│ │ │ │ -
158 typedef GenericIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type, D, IteratorFacade> ConstIterator;
│ │ │ │ -
159
│ │ │ │ -
160 public:
│ │ │ │ -
161
│ │ │ │ -
170 typedef C Container;
│ │ │ │ -
171
│ │ │ │ -
177 typedef T Value;
│ │ │ │ -
178
│ │ │ │ -
182 typedef D DifferenceType;
│ │ │ │ +
12#include <vector>
│ │ │ │ +
13#include <bitset>
│ │ │ │ +
14#include <iostream>
│ │ │ │ +
15#include <algorithm>
│ │ │ │ +
16
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
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 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 typedef std::bitset<block_size> bitset;
│ │ │ │ +
57
│ │ │ │ +
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
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
81 {
│ │ │ │ +
82 bitset b = *this;
│ │ │ │ +
83 b.flip();
│ │ │ │ +
84 return b;
│ │ │ │ +
85 }
│ │ │ │ +
│ │ │ │ +
86
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ -
187 typedef R Reference;
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
185 {
│ │ │ │ +
186 return blockBitField.getBit(block_number,i);
│ │ │ │ +
187 }
│ │ │ │ +
│ │ │ │
188
│ │ │ │ -
189 // Constructors needed by the base iterators
│ │ │ │ +
189 template<class BS>
│ │ │ │
│ │ │ │ -
190 GenericIterator() : container_(0), position_(0)
│ │ │ │ -
191 {}
│ │ │ │ -
│ │ │ │ -
192
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
201 : container_(&cont), position_(pos)
│ │ │ │ -
202 {}
│ │ │ │ -
│ │ │ │ -
203
│ │ │ │ -
│ │ │ │ -
211 GenericIterator(const MutableIterator& other) : container_(other.container_), position_(other.position_)
│ │ │ │ -
212 {}
│ │ │ │ -
│ │ │ │ -
213
│ │ │ │ -
│ │ │ │ -
223 GenericIterator(const ConstIterator& other) : container_(other.container_), position_(other.position_)
│ │ │ │ -
224 {}
│ │ │ │ -
│ │ │ │ -
225
│ │ │ │ -
226 // Methods needed by the forward iterator
│ │ │ │ -
│ │ │ │ -
227 bool equals(const MutableIterator & other) const
│ │ │ │ -
228 {
│ │ │ │ -
229 return position_ == other.position_ && container_ == other.container_;
│ │ │ │ -
230 }
│ │ │ │ -
│ │ │ │ -
231
│ │ │ │ -
│ │ │ │ -
232 bool equals(const ConstIterator & other) const
│ │ │ │ -
233 {
│ │ │ │ -
234 return position_ == other.position_ && container_ == other.container_;
│ │ │ │ -
235 }
│ │ │ │ -
│ │ │ │ -
236
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
238 return container_->operator[](position_);
│ │ │ │ -
239 }
│ │ │ │ -
│ │ │ │ -
240
│ │ │ │ -
│ │ │ │ -
241 void increment(){
│ │ │ │ -
242 ++position_;
│ │ │ │ -
243 }
│ │ │ │ -
│ │ │ │ -
244
│ │ │ │ -
245 // Additional function needed by BidirectionalIterator
│ │ │ │ -
│ │ │ │ -
246 void decrement(){
│ │ │ │ -
247 --position_;
│ │ │ │ -
248 }
│ │ │ │ -
│ │ │ │ -
249
│ │ │ │ -
250 // Additional function needed by RandomAccessIterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
252 return container_->operator[](position_+i);
│ │ │ │ -
253 }
│ │ │ │ -
│ │ │ │ -
254
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
256 position_=position_+n;
│ │ │ │ -
257 }
│ │ │ │ -
│ │ │ │ -
258
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
260 {
│ │ │ │ -
261 assert(other.container_==container_);
│ │ │ │ -
262 return other.position_ - position_;
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
266 {
│ │ │ │ -
267 assert(other.container_==container_);
│ │ │ │ -
268 return other.position_ - position_;
│ │ │ │ -
269 }
│ │ │ │ -
│ │ │ │ -
270
│ │ │ │ -
271 private:
│ │ │ │ -
272 Container *container_;
│ │ │ │ -
273 DifferenceType position_;
│ │ │ │ -
274 };
│ │ │ │ -
│ │ │ │ -
275
│ │ │ │ -
278} // end namespace Dune
│ │ │ │ -
279
│ │ │ │ -
280#endif
│ │ │ │ -
This file implements iterator facade classes for writing stl conformant iterators.
│ │ │ │ -
STL namespace.
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
323 {
│ │ │ │ +
324 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
325 getBit(i) = (test(i) ^ x.test(i));
│ │ │ │ +
326 return *this;
│ │ │ │ +
327 }
│ │ │ │ +
│ │ │ │ +
328
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
331 {
│ │ │ │ +
332 for (size_type i=0; i<block_size-n; i++)
│ │ │ │ +
333 getBit(i) = test(i+n);
│ │ │ │ +
334 return *this;
│ │ │ │ +
335 }
│ │ │ │ +
│ │ │ │ +
336
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
339 {
│ │ │ │ +
340 for (size_type i=0; i<block_size-n; i++)
│ │ │ │ +
341 getBit(i+n) = test(i);
│ │ │ │ +
342 return *this;
│ │ │ │ +
343 }
│ │ │ │ +
│ │ │ │ +
344
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
347 {
│ │ │ │ +
348 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
349 set(i);
│ │ │ │ +
350 return *this;
│ │ │ │ +
351 }
│ │ │ │ +
│ │ │ │ +
352
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
355 {
│ │ │ │ +
356 for (size_type i=0; i<block_size; i++)
│ │ │ │ +
357 flip(i);
│ │ │ │ +
358 return *this;
│ │ │ │ +
359 }
│ │ │ │ +
│ │ │ │ +
360
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
363 {
│ │ │ │ +
364 *this = false;
│ │ │ │ +
365 return *this;
│ │ │ │ +
366 }
│ │ │ │ +
│ │ │ │ +
367
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
370 {
│ │ │ │ +
371 getBit(n) = val;
│ │ │ │ +
372 return *this;
│ │ │ │ +
373 }
│ │ │ │ +
│ │ │ │ +
374
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
377 {
│ │ │ │ +
378 set(n, false);
│ │ │ │ +
379 return *this;
│ │ │ │ +
380 }
│ │ │ │ +
│ │ │ │ +
381
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
384 {
│ │ │ │ +
385 getBit(n).flip();
│ │ │ │ +
386 return *this;
│ │ │ │ +
387 }
│ │ │ │ +
│ │ │ │ +
388
│ │ │ │ + │ │ │ │ +
390 using BitSetVectorConstReference::operator[];
│ │ │ │ +
391
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
394 {
│ │ │ │ +
395 return getBit(i);
│ │ │ │ +
396 }
│ │ │ │ +
│ │ │ │ +
397
│ │ │ │ +
398 protected:
│ │ │ │ + │ │ │ │ +
400
│ │ │ │ + │ │ │ │ +
402
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
404 {
│ │ │ │ +
405 return blockBitField.getBit(this->block_number,i);
│ │ │ │ +
406 }
│ │ │ │ +
│ │ │ │ +
407 };
│ │ │ │ +
│ │ │ │ +
408
│ │ │ │ +
412 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ +
413 struct const_reference< BitSetVectorReference<block_size,Alloc> >
│ │ │ │ +
414 {
│ │ │ │ + │ │ │ │ +
416 };
│ │ │ │ +
│ │ │ │ +
417
│ │ │ │ +
418 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ +
419 struct const_reference< BitSetVectorConstReference<block_size,Alloc> >
│ │ │ │ +
420 {
│ │ │ │ + │ │ │ │ +
422 };
│ │ │ │ +
│ │ │ │ +
423
│ │ │ │ +
424 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ +
425 struct mutable_reference< BitSetVectorReference<block_size,Alloc> >
│ │ │ │ +
426 {
│ │ │ │ + │ │ │ │ +
428 };
│ │ │ │ +
│ │ │ │ +
429
│ │ │ │ +
430 template<int block_size, class Alloc>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
432 {
│ │ │ │ + │ │ │ │ +
434 };
│ │ │ │ +
│ │ │ │ +
435
│ │ │ │ +
439 template <int block_size, class Allocator=std::allocator<bool> >
│ │ │ │ +
│ │ │ │ +
440 class BitSetVector : private std::vector<bool, Allocator>
│ │ │ │ +
441 {
│ │ │ │ +
443 typedef std::vector<bool, Allocator> BlocklessBaseClass;
│ │ │ │ +
444
│ │ │ │ +
445 public:
│ │ │ │ +
448
│ │ │ │ +
450 typedef std::bitset<block_size> value_type;
│ │ │ │ +
451
│ │ │ │ + │ │ │ │ +
454
│ │ │ │ + │ │ │ │ +
457
│ │ │ │ + │ │ │ │ +
460
│ │ │ │ + │ │ │ │ +
463
│ │ │ │ +
465 typedef typename std::vector<bool, Allocator>::size_type size_type;
│ │ │ │ +
466
│ │ │ │ +
468 typedef Allocator allocator_type;
│ │ │ │ +
470
│ │ │ │ + │ │ │ │ + │ │ │ │ +
476
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
479 return iterator(*this, 0);
│ │ │ │ +
480 }
│ │ │ │ +
│ │ │ │ +
481
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
484 return const_iterator(*this, 0);
│ │ │ │ +
485 }
│ │ │ │ +
│ │ │ │ +
486
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
489 return iterator(*this, size());
│ │ │ │ +
490 }
│ │ │ │ +
│ │ │ │ +
491
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
494 return const_iterator(*this, size());
│ │ │ │ +
495 }
│ │ │ │ +
│ │ │ │ +
496
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
499 BlocklessBaseClass()
│ │ │ │ +
500 {}
│ │ │ │ +
│ │ │ │ +
501
│ │ │ │ +
│ │ │ │ +
503 BitSetVector(const BlocklessBaseClass& blocklessBitField) :
│ │ │ │ +
504 BlocklessBaseClass(blocklessBitField)
│ │ │ │ +
505 {
│ │ │ │ +
506 if (blocklessBitField.size()%block_size != 0)
│ │ │ │ +
507 DUNE_THROW(RangeError, "Vector size is not a multiple of the block size!");
│ │ │ │ +
508 }
│ │ │ │ +
│ │ │ │ +
509
│ │ │ │ +
│ │ │ │ +
513 explicit BitSetVector(int n) :
│ │ │ │ +
514 BlocklessBaseClass(n*block_size)
│ │ │ │ +
515 {}
│ │ │ │ +
│ │ │ │ +
516
│ │ │ │ +
│ │ │ │ +
518 BitSetVector(int n, bool v) :
│ │ │ │ +
519 BlocklessBaseClass(n*block_size,v)
│ │ │ │ +
520 {}
│ │ │ │ +
│ │ │ │ +
521
│ │ │ │ +
│ │ │ │ +
523 void clear()
│ │ │ │ +
524 {
│ │ │ │ +
525 BlocklessBaseClass::clear();
│ │ │ │ +
526 }
│ │ │ │ +
│ │ │ │ +
527
│ │ │ │ +
│ │ │ │ +
529 void resize(int n, bool v = bool())
│ │ │ │ +
530 {
│ │ │ │ +
531 BlocklessBaseClass::resize(n*block_size, v);
│ │ │ │ +
532 }
│ │ │ │ +
│ │ │ │ +
533
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
536 {
│ │ │ │ +
537 return BlocklessBaseClass::size()/block_size;
│ │ │ │ +
538 }
│ │ │ │ +
│ │ │ │ +
539
│ │ │ │ +
│ │ │ │ +
541 void setAll() {
│ │ │ │ +
542 this->assign(BlocklessBaseClass::size(), true);
│ │ │ │ +
543 }
│ │ │ │ +
│ │ │ │ +
544
│ │ │ │ +
│ │ │ │ +
546 void unsetAll() {
│ │ │ │ +
547 this->assign(BlocklessBaseClass::size(), false);
│ │ │ │ +
548 }
│ │ │ │ +
│ │ │ │ +
549
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
552 {
│ │ │ │ +
553 return reference(*this, i);
│ │ │ │ +
554 }
│ │ │ │ +
│ │ │ │ +
555
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
558 {
│ │ │ │ +
559 return const_reference(*this, i);
│ │ │ │ +
560 }
│ │ │ │ +
│ │ │ │ +
561
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
564 {
│ │ │ │ +
565 return reference(*this, size()-1);
│ │ │ │ +
566 }
│ │ │ │ +
│ │ │ │ +
567
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
570 {
│ │ │ │ +
571 return const_reference(*this, size()-1);
│ │ │ │ +
572 }
│ │ │ │ +
│ │ │ │ +
573
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
576 {
│ │ │ │ +
577 return std::count(BlocklessBaseClass::begin(), BlocklessBaseClass::end(), true);
│ │ │ │ +
578 }
│ │ │ │ +
│ │ │ │ +
579
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
582 {
│ │ │ │ +
583 size_type n = 0;
│ │ │ │ +
584 size_type blocks = size();
│ │ │ │ +
585 for(size_type i=0; i<blocks; ++i)
│ │ │ │ +
586 n += getBit(i,j);
│ │ │ │ +
587 return n;
│ │ │ │ +
588 }
│ │ │ │ +
│ │ │ │ +
589
│ │ │ │ +
│ │ │ │ +
591 friend std::ostream& operator<< (std::ostream& s, const BitSetVector& v)
│ │ │ │ +
592 {
│ │ │ │ +
593 for (size_t i=0; i<v.size(); i++)
│ │ │ │ +
594 s << v[i] << " ";
│ │ │ │ +
595 return s;
│ │ │ │ +
596 }
│ │ │ │ +
│ │ │ │ +
597
│ │ │ │ +
598 private:
│ │ │ │ +
599
│ │ │ │ +
601 value_type getRepr(int i) const
│ │ │ │ +
602 {
│ │ │ │ +
603 value_type bits;
│ │ │ │ +
604 for(int j=0; j<block_size; ++j)
│ │ │ │ +
605 bits.set(j, getBit(i,j));
│ │ │ │ +
606 return bits;
│ │ │ │ +
607 }
│ │ │ │ +
608
│ │ │ │ +
609 typename std::vector<bool>::reference getBit(size_type i, size_type j) {
│ │ │ │ +
610 DUNE_ASSERT_BOUNDS(j < block_size);
│ │ │ │ + │ │ │ │ +
612 return BlocklessBaseClass::operator[](i*block_size+j);
│ │ │ │ +
613 }
│ │ │ │ +
614
│ │ │ │ +
615 typename std::vector<bool>::const_reference getBit(size_type i, size_type j) const {
│ │ │ │ +
616 DUNE_ASSERT_BOUNDS(j < block_size);
│ │ │ │ + │ │ │ │ +
618 return BlocklessBaseClass::operator[](i*block_size+j);
│ │ │ │ +
619 }
│ │ │ │ +
620
│ │ │ │ +
621 friend class BitSetVectorReference<block_size,Allocator>;
│ │ │ │ +
622 friend class BitSetVectorConstReference<block_size,Allocator>;
│ │ │ │ +
623 };
│ │ │ │ +
│ │ │ │ +
624
│ │ │ │ +
625} // namespace Dune
│ │ │ │ +
626
│ │ │ │ +
627#endif
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
Implements a generic iterator class for writing stl conformant iterators.
│ │ │ │ +
Macro for wrapping boundary checks.
│ │ │ │ +
#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:441
│ │ │ │ +
const_reference operator[](int i) const
Return const reference to i-th block.
Definition bitsetvector.hh:557
│ │ │ │ +
iterator begin()
Returns a iterator pointing to the beginning of the vector.
Definition bitsetvector.hh:478
│ │ │ │ +
BitSetVectorConstReference< block_size, Allocator > * const_pointer
Const pointer to a small block of bits.
Definition bitsetvector.hh:462
│ │ │ │ +
const_iterator end() const
Returns a const_iterator pointing to the end of the vector.
Definition bitsetvector.hh:493
│ │ │ │ +
BitSetVectorReference< block_size, Allocator > reference
Reference to a small block of bits.
Definition bitsetvector.hh:453
│ │ │ │ +
size_type countmasked(int j) const
Returns the number of set bits, while each block is masked with 1<<i.
Definition bitsetvector.hh:581
│ │ │ │ +
BitSetVectorConstReference< block_size, Allocator > const_reference
Const reference to a small block of bits.
Definition bitsetvector.hh:456
│ │ │ │ +
iterator end()
Returns an iterator pointing to the end of the vector.
Definition bitsetvector.hh:488
│ │ │ │ +
size_type count() const
Returns the number of bits that are set.
Definition bitsetvector.hh:575
│ │ │ │ +
BitSetVector()
Default constructor.
Definition bitsetvector.hh:498
│ │ │ │ +
void setAll()
Sets all entries to true
Definition bitsetvector.hh:541
│ │ │ │ +
Dune::GenericIterator< const BitSetVector< block_size, Allocator >, const value_type, const_reference, std::ptrdiff_t, ForwardIteratorFacade > const_iterator
Definition bitsetvector.hh:474
│ │ │ │ +
std::bitset< block_size > value_type
Type of the values stored by the container.
Definition bitsetvector.hh:450
│ │ │ │ +
reference back()
Return reference to last block.
Definition bitsetvector.hh:563
│ │ │ │ +
BitSetVector(const BlocklessBaseClass &blocklessBitField)
Construction from an unblocked bitfield.
Definition bitsetvector.hh:503
│ │ │ │ +
friend std::ostream & operator<<(std::ostream &s, const BitSetVector &v)
Send bitfield to an output stream.
Definition bitsetvector.hh:591
│ │ │ │ +
const_reference back() const
Return const reference to last block.
Definition bitsetvector.hh:569
│ │ │ │ +
void clear()
Erases all of the elements.
Definition bitsetvector.hh:523
│ │ │ │ +
BitSetVectorReference< block_size, Allocator > * pointer
Pointer to a small block of bits.
Definition bitsetvector.hh:459
│ │ │ │ +
reference operator[](int i)
Return reference to i-th block.
Definition bitsetvector.hh:551
│ │ │ │ +
size_type size() const
Return the number of blocks.
Definition bitsetvector.hh:535
│ │ │ │ +
std::vector< bool, Allocator >::size_type size_type
size type
Definition bitsetvector.hh:465
│ │ │ │ +
BitSetVector(int n, bool v)
Constructor which initializes the field with true or false.
Definition bitsetvector.hh:518
│ │ │ │ +
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the vector.
Definition bitsetvector.hh:483
│ │ │ │ +
Dune::GenericIterator< BitSetVector< block_size, Allocator >, value_type, reference, std::ptrdiff_t, ForwardIteratorFacade > iterator
Definition bitsetvector.hh:473
│ │ │ │ +
void resize(int n, bool v=bool())
Resize field.
Definition bitsetvector.hh:529
│ │ │ │ +
Allocator allocator_type
The type of the allocator.
Definition bitsetvector.hh:468
│ │ │ │ +
BitSetVector(int n)
Definition bitsetvector.hh:513
│ │ │ │ +
void unsetAll()
Sets all entries to false
Definition bitsetvector.hh:546
│ │ │ │ +
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:393
│ │ │ │ +
BitSetVectorReference & reset(size_type n)
Clears bit n.
Definition bitsetvector.hh:376
│ │ │ │ +
BitSetVectorReference & operator<<=(size_type n)
Left shift.
Definition bitsetvector.hh:330
│ │ │ │ +
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:403
│ │ │ │ +
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:362
│ │ │ │ +
BitSetVector & blockBitField
Definition bitsetvector.hh:399
│ │ │ │ +
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:369
│ │ │ │ +
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:338
│ │ │ │ +
BitSetVectorReference & operator^=(const BitSetVectorConstReference &x)
Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference)
Definition bitsetvector.hh:322
│ │ │ │ +
BitSetVectorReference & flip(size_type n)
Flips bit n.
Definition bitsetvector.hh:383
│ │ │ │ +
BitSetVectorReference & flip()
Flips the value of every bit.
Definition bitsetvector.hh:354
│ │ │ │ +
BitSetVectorReference & set()
Sets every bit.
Definition bitsetvector.hh:346
│ │ │ │ +
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(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
│ │ │ │ +
BitSetVectorConstReference & operator=(const BitSetVectorConstReference &b)=delete
disable assignment operator
│ │ │ │ +
friend std::ostream & operator<<(std::ostream &s, const BitSetVectorConstReference &v)
Definition bitsetvector.hh:171
│ │ │ │ +
BitSetVectorConstReference< block_size, Alloc > type
Definition bitsetvector.hh:415
│ │ │ │ +
BitSetVectorConstReference< block_size, Alloc > type
Definition bitsetvector.hh:421
│ │ │ │ +
BitSetVectorReference< block_size, Alloc > type
Definition bitsetvector.hh:427
│ │ │ │ +
BitSetVectorReference< block_size, Alloc > type
Definition bitsetvector.hh:433
│ │ │ │ +
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
│ │ │ │ -
const R type
Definition genericiterator.hh:88
│ │ │ │ -
const R type
Definition genericiterator.hh:94
│ │ │ │ -
const R & type
Definition genericiterator.hh:100
│ │ │ │ -
const R & type
Definition genericiterator.hh:106
│ │ │ │
get the 'mutable' version of a reference to a const object
Definition genericiterator.hh:116
│ │ │ │ -
R type
Definition genericiterator.hh:117
│ │ │ │ -
R type
Definition genericiterator.hh:123
│ │ │ │ -
R & type
Definition genericiterator.hh:129
│ │ │ │
Generic class for stl-conforming iterators for container classes with operator[].
Definition genericiterator.hh:153
│ │ │ │ -
GenericIterator(const MutableIterator &other)
Copy constructor.
Definition genericiterator.hh:211
│ │ │ │ -
bool equals(const MutableIterator &other) const
Definition genericiterator.hh:227
│ │ │ │ -
Reference elementAt(DifferenceType i) const
Definition genericiterator.hh:251
│ │ │ │ -
void increment()
Definition genericiterator.hh:241
│ │ │ │ -
GenericIterator(const ConstIterator &other)
Copy constructor.
Definition genericiterator.hh:223
│ │ │ │ -
void advance(DifferenceType n)
Definition genericiterator.hh:255
│ │ │ │ -
GenericIterator(Container &cont, DifferenceType pos)
Constructor.
Definition genericiterator.hh:200
│ │ │ │ -
D DifferenceType
The type of the difference between two positions.
Definition genericiterator.hh:182
│ │ │ │ -
R Reference
The type of the reference to the values accessed.
Definition genericiterator.hh:187
│ │ │ │ -
DifferenceType distanceTo(const MutableIterator &other) const
Definition genericiterator.hh:259
│ │ │ │ -
C Container
The type of container we are an iterator for.
Definition genericiterator.hh:170
│ │ │ │ -
T Value
The value type of the iterator.
Definition genericiterator.hh:177
│ │ │ │ -
DifferenceType distanceTo(const ConstIterator &other) const
Definition genericiterator.hh:265
│ │ │ │ -
void decrement()
Definition genericiterator.hh:246
│ │ │ │ -
Reference dereference() const
Definition genericiterator.hh:237
│ │ │ │ -
bool equals(const ConstIterator &other) const
Definition genericiterator.hh:232
│ │ │ │ -
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:435
│ │ │ │ -
CRTP-Mixing class for stl conformant iterators of given iterator category.
Definition iteratorfacades.hh:1053
│ │ │ │ +
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:142
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,270 +1,903 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -genericiterator.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 © 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_GENERICITERATOR_HH │ │ │ │ │ -6#define DUNE_GENERICITERATOR_HH │ │ │ │ │ +5#ifndef DUNE_BLOCK_BITFIELD_HH │ │ │ │ │ +6#define DUNE_BLOCK_BITFIELD_HH │ │ │ │ │ 7 │ │ │ │ │ -8#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> │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e { │ │ │ │ │ -12 │ │ │ │ │ -85 template │ │ │ │ │ -_8_6 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -87 { │ │ │ │ │ -_8_8 typedef const R _t_y_p_e; │ │ │ │ │ -89 }; │ │ │ │ │ -90 │ │ │ │ │ -91 template │ │ │ │ │ -_9_2 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -93 { │ │ │ │ │ -_9_4 typedef const R _t_y_p_e; │ │ │ │ │ -95 }; │ │ │ │ │ -96 │ │ │ │ │ -97 template │ │ │ │ │ -_9_8 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -99 { │ │ │ │ │ -_1_0_0 typedef const R& _t_y_p_e; │ │ │ │ │ -101 }; │ │ │ │ │ -102 │ │ │ │ │ -103 template │ │ │ │ │ -_1_0_4 struct _c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -105 { │ │ │ │ │ -_1_0_6 typedef const R& _t_y_p_e; │ │ │ │ │ -107 }; │ │ │ │ │ -108 │ │ │ │ │ -114 template │ │ │ │ │ -_1_1_5 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +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 │ │ │ │ │ +_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) │ │ │ │ │ += delete; │ │ │ │ │ +53 │ │ │ │ │ +54 public: │ │ │ │ │ +55 │ │ │ │ │ +_5_6 typedef std::bitset _b_i_t_s_e_t; │ │ │ │ │ +57 │ │ │ │ │ +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 │ │ │ │ │ +_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 │ │ │ │ │ +_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_2_1 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e │ │ │ │ │ -122 { │ │ │ │ │ -_1_2_3 typedef R _t_y_p_e; │ │ │ │ │ -124 }; │ │ │ │ │ -125 │ │ │ │ │ -126 template │ │ │ │ │ -_1_2_7 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e │ │ │ │ │ -128 { │ │ │ │ │ -_1_2_9 typedef R& _t_y_p_e; │ │ │ │ │ -130 }; │ │ │ │ │ -131 │ │ │ │ │ -132 template │ │ │ │ │ -_1_3_3 struct _m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e │ │ │ │ │ -134 { │ │ │ │ │ -_1_3_5 typedef R& type; │ │ │ │ │ -136 }; │ │ │ │ │ -137 │ │ │ │ │ -149 template class │ │ │ │ │ -_I_t_e_r_a_t_o_r_F_a_c_a_d_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> │ │ │ │ │ -_1_5_1 class _G_e_n_e_r_i_c_I_t_e_r_a_t_o_r : │ │ │ │ │ -152 public _I_t_e_r_a_t_o_r_F_a_c_a_d_e,T,R,D> │ │ │ │ │ -153 { │ │ │ │ │ -154 friend class _G_e_n_e_r_i_c_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, D, │ │ │ │ │ -_I_t_e_r_a_t_o_r_F_a_c_a_d_e>; │ │ │ │ │ -155 friend class _G_e_n_e_r_i_c_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -const typename std::remove_const::type, typename const_reference::type, │ │ │ │ │ -D, IteratorFacade>; │ │ │ │ │ -156 │ │ │ │ │ -157 typedef _G_e_n_e_r_i_c_I_t_e_r_a_t_o_r::type, typename std:: │ │ │ │ │ -remove_const::type, typename mutable_reference::type, D, IteratorFacade> │ │ │ │ │ -_M_u_t_a_b_l_e_I_t_e_r_a_t_o_r; │ │ │ │ │ -158 typedef _G_e_n_e_r_i_c_I_t_e_r_a_t_o_r::type, const │ │ │ │ │ -typename std::remove_const::type, typename const_reference::type, D, │ │ │ │ │ -IteratorFacade> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -159 │ │ │ │ │ -160 public: │ │ │ │ │ -161 │ │ │ │ │ -_1_7_0 typedef C _C_o_n_t_a_i_n_e_r; │ │ │ │ │ -171 │ │ │ │ │ -_1_7_7 typedef T _V_a_l_u_e; │ │ │ │ │ -178 │ │ │ │ │ -_1_8_2 typedef D _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ +117 for(_s_i_z_e___t_y_p_e i=0; ioperator[](position_); │ │ │ │ │ -239 } │ │ │ │ │ -240 │ │ │ │ │ -_2_4_1 void _i_n_c_r_e_m_e_n_t(){ │ │ │ │ │ -242 ++position_; │ │ │ │ │ -243 } │ │ │ │ │ -244 │ │ │ │ │ -245 // Additional function needed by BidirectionalIterator │ │ │ │ │ -_2_4_6 void _d_e_c_r_e_m_e_n_t(){ │ │ │ │ │ -247 --position_; │ │ │ │ │ -248 } │ │ │ │ │ -249 │ │ │ │ │ -250 // Additional function needed by RandomAccessIterator │ │ │ │ │ -_2_5_1 _R_e_f_e_r_e_n_c_e _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 { │ │ │ │ │ -252 return container_->operator[](position_+i); │ │ │ │ │ -253 } │ │ │ │ │ -254 │ │ │ │ │ -_2_5_5 void _a_d_v_a_n_c_e(_D_i_f_f_e_r_e_n_c_e_T_y_p_e n){ │ │ │ │ │ -256 position_=position_+n; │ │ │ │ │ -257 } │ │ │ │ │ -258 │ │ │ │ │ -_2_5_9 _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 _M_u_t_a_b_l_e_I_t_e_r_a_t_o_r& other) const │ │ │ │ │ -260 { │ │ │ │ │ -261 assert(other.container_==container_); │ │ │ │ │ -262 return other.position_ - position_; │ │ │ │ │ +189 template │ │ │ │ │ +_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) │ │ │ │ │ +339 { │ │ │ │ │ +340 for (_s_i_z_e___t_y_p_e i=0; i_b_l_o_c_k___n_u_m_b_e_r,i); │ │ │ │ │ +406 } │ │ │ │ │ +407 }; │ │ │ │ │ +408 │ │ │ │ │ +412 template │ │ │ │ │ +_4_1_3 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 > │ │ │ │ │ +414 { │ │ │ │ │ +_4_1_5 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; │ │ │ │ │ +416 }; │ │ │ │ │ +417 │ │ │ │ │ +418 template │ │ │ │ │ +_4_1_9 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 > │ │ │ │ │ +420 { │ │ │ │ │ +_4_2_1 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; │ │ │ │ │ +422 }; │ │ │ │ │ +423 │ │ │ │ │ +424 template │ │ │ │ │ +_4_2_5 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 > │ │ │ │ │ +426 { │ │ │ │ │ +_4_2_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_> _t_y_p_e; │ │ │ │ │ +428 }; │ │ │ │ │ +429 │ │ │ │ │ +430 template │ │ │ │ │ +_4_3_1 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 > │ │ │ │ │ +432 { │ │ │ │ │ +_4_3_3 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; │ │ │ │ │ +434 }; │ │ │ │ │ +435 │ │ │ │ │ +439 template > │ │ │ │ │ +_4_4_0 class _B_i_t_S_e_t_V_e_c_t_o_r : private std::vector │ │ │ │ │ +441 { │ │ │ │ │ +443 typedef std::vector BlocklessBaseClass; │ │ │ │ │ +444 │ │ │ │ │ +445 public: │ │ │ │ │ +448 │ │ │ │ │ +_4_5_0 typedef std::bitset _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +451 │ │ │ │ │ +_4_5_3 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; │ │ │ │ │ +454 │ │ │ │ │ +_4_5_6 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; │ │ │ │ │ +457 │ │ │ │ │ +_4_5_9 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; │ │ │ │ │ +460 │ │ │ │ │ +_4_6_2 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; │ │ │ │ │ +463 │ │ │ │ │ +_4_6_5 typedef typename std::vector::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +466 │ │ │ │ │ +_4_6_8 typedef Allocator _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +470 │ │ │ │ │ +_4_7_3 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; │ │ │ │ │ +_4_7_4 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; │ │ │ │ │ +476 │ │ │ │ │ +_4_7_8 _i_t_e_r_a_t_o_r _b_e_g_i_n(){ │ │ │ │ │ +479 return _i_t_e_r_a_t_o_r(*this, 0); │ │ │ │ │ +480 } │ │ │ │ │ +481 │ │ │ │ │ +_4_8_3 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const { │ │ │ │ │ +484 return _c_o_n_s_t___i_t_e_r_a_t_o_r(*this, 0); │ │ │ │ │ +485 } │ │ │ │ │ +486 │ │ │ │ │ +_4_8_8 _i_t_e_r_a_t_o_r _e_n_d(){ │ │ │ │ │ +489 return _i_t_e_r_a_t_o_r(*this, _s_i_z_e()); │ │ │ │ │ +490 } │ │ │ │ │ +491 │ │ │ │ │ +_4_9_3 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const { │ │ │ │ │ +494 return _c_o_n_s_t___i_t_e_r_a_t_o_r(*this, _s_i_z_e()); │ │ │ │ │ +495 } │ │ │ │ │ +496 │ │ │ │ │ +_4_9_8 _B_i_t_S_e_t_V_e_c_t_o_r() : │ │ │ │ │ +499 BlocklessBaseClass() │ │ │ │ │ +500 {} │ │ │ │ │ +501 │ │ │ │ │ +_5_0_3 _B_i_t_S_e_t_V_e_c_t_o_r(const BlocklessBaseClass& blocklessBitField) : │ │ │ │ │ +504 BlocklessBaseClass(blocklessBitField) │ │ │ │ │ +505 { │ │ │ │ │ +506 if (blocklessBitField.size()%block_size != 0) │ │ │ │ │ +507 _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!"); │ │ │ │ │ +508 } │ │ │ │ │ +509 │ │ │ │ │ +_5_1_3 explicit _B_i_t_S_e_t_V_e_c_t_o_r(int n) : │ │ │ │ │ +514 BlocklessBaseClass(n*block_size) │ │ │ │ │ +515 {} │ │ │ │ │ +516 │ │ │ │ │ +_5_1_8 _B_i_t_S_e_t_V_e_c_t_o_r(int n, bool v) : │ │ │ │ │ +519 BlocklessBaseClass(n*block_size,v) │ │ │ │ │ +520 {} │ │ │ │ │ +521 │ │ │ │ │ +_5_2_3 void _c_l_e_a_r() │ │ │ │ │ +524 { │ │ │ │ │ +525 BlocklessBaseClass::clear(); │ │ │ │ │ +526 } │ │ │ │ │ +527 │ │ │ │ │ +_5_2_9 void _r_e_s_i_z_e(int n, bool v = bool()) │ │ │ │ │ +530 { │ │ │ │ │ +531 BlocklessBaseClass::resize(n*block_size, v); │ │ │ │ │ +532 } │ │ │ │ │ +533 │ │ │ │ │ +_5_3_5 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ +536 { │ │ │ │ │ +537 return BlocklessBaseClass::size()/block_size; │ │ │ │ │ +538 } │ │ │ │ │ +539 │ │ │ │ │ +_5_4_1 void _s_e_t_A_l_l() { │ │ │ │ │ +542 this->_a_s_s_i_g_n(BlocklessBaseClass::size(), true); │ │ │ │ │ +543 } │ │ │ │ │ +544 │ │ │ │ │ +_5_4_6 void _u_n_s_e_t_A_l_l() { │ │ │ │ │ +547 this->_a_s_s_i_g_n(BlocklessBaseClass::size(), false); │ │ │ │ │ +548 } │ │ │ │ │ +549 │ │ │ │ │ +_5_5_1 _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](int i) │ │ │ │ │ +552 { │ │ │ │ │ +553 return _r_e_f_e_r_e_n_c_e(*this, i); │ │ │ │ │ +554 } │ │ │ │ │ +555 │ │ │ │ │ +_5_5_7 _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 │ │ │ │ │ +558 { │ │ │ │ │ +559 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(*this, i); │ │ │ │ │ +560 } │ │ │ │ │ +561 │ │ │ │ │ +_5_6_3 _r_e_f_e_r_e_n_c_e _b_a_c_k() │ │ │ │ │ +564 { │ │ │ │ │ +565 return _r_e_f_e_r_e_n_c_e(*this, _s_i_z_e()-1); │ │ │ │ │ +566 } │ │ │ │ │ +567 │ │ │ │ │ +_5_6_9 _c_o_n_s_t___r_e_f_e_r_e_n_c_e _b_a_c_k() const │ │ │ │ │ +570 { │ │ │ │ │ +571 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(*this, _s_i_z_e()-1); │ │ │ │ │ +572 } │ │ │ │ │ +573 │ │ │ │ │ +_5_7_5 _s_i_z_e___t_y_p_e _c_o_u_n_t() const │ │ │ │ │ +576 { │ │ │ │ │ +577 return std::count(BlocklessBaseClass::begin(), BlocklessBaseClass::end(), │ │ │ │ │ +true); │ │ │ │ │ +578 } │ │ │ │ │ +579 │ │ │ │ │ +_5_8_1 _s_i_z_e___t_y_p_e _c_o_u_n_t_m_a_s_k_e_d(int j) const │ │ │ │ │ +582 { │ │ │ │ │ +583 _s_i_z_e___t_y_p_e n = 0; │ │ │ │ │ +584 _s_i_z_e___t_y_p_e blocks = _s_i_z_e(); │ │ │ │ │ +585 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) { │ │ │ │ │ +610 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(j < block_size); │ │ │ │ │ +611 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _s_i_z_e()); │ │ │ │ │ +612 return BlocklessBaseClass::operator[](i*block_size+j); │ │ │ │ │ +613 } │ │ │ │ │ +614 │ │ │ │ │ +_6_1_5 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 { │ │ │ │ │ +616 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(j < block_size); │ │ │ │ │ +617 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _s_i_z_e()); │ │ │ │ │ +618 return BlocklessBaseClass::operator[](i*block_size+j); │ │ │ │ │ +619 } │ │ │ │ │ +620 │ │ │ │ │ +621 friend class _B_i_t_S_e_t_V_e_c_t_o_r_R_e_f_e_r_e_n_c_e; │ │ │ │ │ +622 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; │ │ │ │ │ +623 }; │ │ │ │ │ +624 │ │ │ │ │ +625} // namespace Dune │ │ │ │ │ +626 │ │ │ │ │ +627#endif │ │ │ │ │ +_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. │ │ │ │ │ +_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h │ │ │ │ │ +Macro for wrapping boundary checks. │ │ │ │ │ +_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:441 │ │ │ │ │ +_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:557 │ │ │ │ │ +_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:478 │ │ │ │ │ +_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:462 │ │ │ │ │ +_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:493 │ │ │ │ │ +_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:453 │ │ │ │ │ +_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:456 │ │ │ │ │ +_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:488 │ │ │ │ │ +_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:575 │ │ │ │ │ +_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:498 │ │ │ │ │ +_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:541 │ │ │ │ │ +_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:474 │ │ │ │ │ +_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:450 │ │ │ │ │ +_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:563 │ │ │ │ │ +_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:503 │ │ │ │ │ +_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:591 │ │ │ │ │ +_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:569 │ │ │ │ │ +_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:523 │ │ │ │ │ +_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:459 │ │ │ │ │ +_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:551 │ │ │ │ │ +_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:535 │ │ │ │ │ +_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:465 │ │ │ │ │ +_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:518 │ │ │ │ │ +_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:483 │ │ │ │ │ +_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:473 │ │ │ │ │ +_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:529 │ │ │ │ │ +_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:468 │ │ │ │ │ +_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:513 │ │ │ │ │ +_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:546 │ │ │ │ │ +_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:393 │ │ │ │ │ +_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:376 │ │ │ │ │ +_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:330 │ │ │ │ │ +_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: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_:_:_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:362 │ │ │ │ │ +_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:399 │ │ │ │ │ +_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:369 │ │ │ │ │ +_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:338 │ │ │ │ │ +_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:322 │ │ │ │ │ +_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:383 │ │ │ │ │ +_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:354 │ │ │ │ │ +_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:346 │ │ │ │ │ +_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_:_:_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_= │ │ │ │ │ +BitSetVectorConstReference & operator=(const BitSetVectorConstReference │ │ │ │ │ +&b)=delete │ │ │ │ │ +disable 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_:_:_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:415 │ │ │ │ │ +_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:421 │ │ │ │ │ +_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:427 │ │ │ │ │ +_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:433 │ │ │ │ │ +_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_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_:_:_t_y_p_e │ │ │ │ │ -const R type │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:88 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _c_o_n_s_t_ _R_ _>_:_:_t_y_p_e │ │ │ │ │ -const R type │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _R_ _&_ _>_:_:_t_y_p_e │ │ │ │ │ -const R & type │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e_<_ _c_o_n_s_t_ _R_ _&_ _>_:_:_t_y_p_e │ │ │ │ │ -const R & type │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:106 │ │ │ │ │ _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_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_:_:_t_y_p_e │ │ │ │ │ -R type │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:117 │ │ │ │ │ -_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _c_o_n_s_t_ _R_ _>_:_:_t_y_p_e │ │ │ │ │ -R type │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:123 │ │ │ │ │ -_D_u_n_e_:_:_m_u_t_a_b_l_e___r_e_f_e_r_e_n_c_e_<_ _R_ _&_ _>_:_:_t_y_p_e │ │ │ │ │ -R & type │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:129 │ │ │ │ │ _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_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r │ │ │ │ │ -GenericIterator(const MutableIterator &other) │ │ │ │ │ -Copy constructor. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:211 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const MutableIterator &other) const │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:227 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ -Reference elementAt(DifferenceType i) const │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:251 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:241 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r │ │ │ │ │ -GenericIterator(const ConstIterator &other) │ │ │ │ │ -Copy constructor. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:223 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ -void advance(DifferenceType n) │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:255 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r │ │ │ │ │ -GenericIterator(Container &cont, DifferenceType pos) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:200 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_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 genericiterator.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -R Reference │ │ │ │ │ -The type of the reference to the values accessed. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:187 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -DifferenceType distanceTo(const MutableIterator &other) const │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ -C Container │ │ │ │ │ -The type of container we are an iterator for. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:170 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_V_a_l_u_e │ │ │ │ │ -T Value │ │ │ │ │ -The value type of the iterator. │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:177 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -DifferenceType distanceTo(const ConstIterator &other) const │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ -void decrement() │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:246 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ -Reference dereference() const │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:237 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_i_c_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const ConstIterator &other) const │ │ │ │ │ -DDeeffiinniittiioonn genericiterator.hh:232 │ │ │ │ │ -_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_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:435 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ -CRTP-Mixing class for stl conformant iterators of given iterator category. │ │ │ │ │ -DDeeffiinniittiioonn iteratorfacades.hh:1053 │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:142 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00107.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: iteratorrange.hh File Reference │ │ │ │ +dune-common: matvectraits.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,32 +72,36 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
iteratorrange.hh File Reference
│ │ │ │ +
matvectraits.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ +

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

│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::IteratorRange< Iterator >
 Simple range between a begin and an end iterator. More...
struct  Dune::DenseMatVecTraits< T >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ +

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

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,19 +1,23 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +matvectraits.hh File Reference │ │ │ │ │ +Documentation of the traits classes you need to write for each implementation │ │ │ │ │ +of DenseVector or DenseMatrix. _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_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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Documentation of the traits classes you need to write for each implementation │ │ │ │ │ +of DenseVector or DenseMatrix. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: iteratorrange.hh Source File │ │ │ │ +dune-common: matvectraits.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,84 +74,37 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
iteratorrange.hh
│ │ │ │ +
matvectraits.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 © 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_ITERATORRANGE_HH
│ │ │ │ -
6#define DUNE_COMMON_ITERATORRANGE_HH
│ │ │ │ +
5#ifndef DUNE_MATVECTRAITS_HH
│ │ │ │ +
6#define DUNE_MATVECTRAITS_HH
│ │ │ │
7
│ │ │ │ -
8namespace Dune {
│ │ │ │ -
9
│ │ │ │ -
11
│ │ │ │ -
20 template<typename Iterator>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
22 {
│ │ │ │ -
23
│ │ │ │ -
24 public:
│ │ │ │ -
25
│ │ │ │ -
27 typedef Iterator iterator;
│ │ │ │ -
28
│ │ │ │ -
30
│ │ │ │ -
33 typedef Iterator const_iterator;
│ │ │ │ +
12namespace Dune {
│ │ │ │ +
13
│ │ │ │ +
22
│ │ │ │ +
24
│ │ │ │ +
26
│ │ │ │ +
30 template<class T>
│ │ │ │ + │ │ │ │ +
32
│ │ │ │ +
33} // end namespace Dune
│ │ │ │
34
│ │ │ │ -
│ │ │ │ -
36 IteratorRange(const Iterator& begin, const Iterator& end)
│ │ │ │ -
37 : _begin(begin)
│ │ │ │ -
38 , _end(end)
│ │ │ │ -
39 {}
│ │ │ │ -
│ │ │ │ -
40
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
43 {}
│ │ │ │ -
│ │ │ │ -
44
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
47 {
│ │ │ │ -
48 return _begin;
│ │ │ │ -
49 }
│ │ │ │ -
│ │ │ │ -
50
│ │ │ │ -
│ │ │ │ -
52 iterator end() const
│ │ │ │ -
53 {
│ │ │ │ -
54 return _end;
│ │ │ │ -
55 }
│ │ │ │ -
│ │ │ │ -
56
│ │ │ │ -
57 private:
│ │ │ │ -
58
│ │ │ │ -
59 Iterator _begin;
│ │ │ │ -
60 Iterator _end;
│ │ │ │ -
61
│ │ │ │ -
62 };
│ │ │ │ -
│ │ │ │ -
63
│ │ │ │ -
64}
│ │ │ │ -
65
│ │ │ │ -
66#endif // DUNE_COMMON_ITERATORRANGE_HH
│ │ │ │ +
35#endif // DUNE_FTRAITS_HH
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Simple range between a begin and an end iterator.
Definition iteratorrange.hh:22
│ │ │ │ -
iterator begin() const
Returns an iterator pointing to the begin of the range.
Definition iteratorrange.hh:46
│ │ │ │ -
Iterator const_iterator
The iterator belonging to this range.
Definition iteratorrange.hh:33
│ │ │ │ -
iterator end() const
Returns an iterator pointing past the end of the range.
Definition iteratorrange.hh:52
│ │ │ │ -
IteratorRange()
Default constructor, relies on iterators being default-constructible.
Definition iteratorrange.hh:42
│ │ │ │ -
Iterator iterator
The iterator belonging to this range.
Definition iteratorrange.hh:27
│ │ │ │ -
IteratorRange(const Iterator &begin, const Iterator &end)
Constructs an iterator range on [begin,end).
Definition iteratorrange.hh:36
│ │ │ │ +
Definition matvectraits.hh:31
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,90 +1,34 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -iteratorrange.hh │ │ │ │ │ +matvectraits.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 © 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_ITERATORRANGE_HH │ │ │ │ │ -6#define DUNE_COMMON_ITERATORRANGE_HH │ │ │ │ │ +5#ifndef DUNE_MATVECTRAITS_HH │ │ │ │ │ +6#define DUNE_MATVECTRAITS_HH │ │ │ │ │ 7 │ │ │ │ │ -8namespace _D_u_n_e { │ │ │ │ │ -9 │ │ │ │ │ -11 │ │ │ │ │ -20 template │ │ │ │ │ -_2_1 class _I_t_e_r_a_t_o_r_R_a_n_g_e │ │ │ │ │ -22 { │ │ │ │ │ -23 │ │ │ │ │ -24 public: │ │ │ │ │ -25 │ │ │ │ │ -_2_7 typedef Iterator _i_t_e_r_a_t_o_r; │ │ │ │ │ -28 │ │ │ │ │ -30 │ │ │ │ │ -_3_3 typedef Iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +12namespace _D_u_n_e { │ │ │ │ │ +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 │ │ │ │ │ -_3_6 _I_t_e_r_a_t_o_r_R_a_n_g_e(const Iterator& _b_e_g_i_n, const Iterator& _e_n_d) │ │ │ │ │ -37 : _begin(_b_e_g_i_n) │ │ │ │ │ -38 , _end(_e_n_d) │ │ │ │ │ -39 {} │ │ │ │ │ -40 │ │ │ │ │ -_4_2 _I_t_e_r_a_t_o_r_R_a_n_g_e() │ │ │ │ │ -43 {} │ │ │ │ │ -44 │ │ │ │ │ -_4_6 _i_t_e_r_a_t_o_r _b_e_g_i_n() const │ │ │ │ │ -47 { │ │ │ │ │ -48 return _begin; │ │ │ │ │ -49 } │ │ │ │ │ -50 │ │ │ │ │ -_5_2 _i_t_e_r_a_t_o_r _e_n_d() const │ │ │ │ │ -53 { │ │ │ │ │ -54 return _end; │ │ │ │ │ -55 } │ │ │ │ │ -56 │ │ │ │ │ -57 private: │ │ │ │ │ -58 │ │ │ │ │ -59 Iterator _begin; │ │ │ │ │ -60 Iterator _end; │ │ │ │ │ -61 │ │ │ │ │ -62 }; │ │ │ │ │ -63 │ │ │ │ │ -64} │ │ │ │ │ -65 │ │ │ │ │ -66#endif // DUNE_COMMON_ITERATORRANGE_HH │ │ │ │ │ +35#endif // DUNE_FTRAITS_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ Dune namespace. │ │ │ │ │ DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e │ │ │ │ │ -Simple range between a begin and an end iterator. │ │ │ │ │ -DDeeffiinniittiioonn iteratorrange.hh:22 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e_:_:_b_e_g_i_n │ │ │ │ │ -iterator begin() const │ │ │ │ │ -Returns an iterator pointing to the begin of the range. │ │ │ │ │ -DDeeffiinniittiioonn iteratorrange.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -Iterator const_iterator │ │ │ │ │ -The iterator belonging to this range. │ │ │ │ │ -DDeeffiinniittiioonn iteratorrange.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e_:_:_e_n_d │ │ │ │ │ -iterator end() const │ │ │ │ │ -Returns an iterator pointing past the end of the range. │ │ │ │ │ -DDeeffiinniittiioonn iteratorrange.hh:52 │ │ │ │ │ -_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_R_a_n_g_e │ │ │ │ │ -IteratorRange() │ │ │ │ │ -Default constructor, relies on iterators being default-constructible. │ │ │ │ │ -DDeeffiinniittiioonn iteratorrange.hh:42 │ │ │ │ │ -_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 │ │ │ │ │ -Iterator iterator │ │ │ │ │ -The iterator belonging to this range. │ │ │ │ │ -DDeeffiinniittiioonn iteratorrange.hh:27 │ │ │ │ │ -_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_R_a_n_g_e │ │ │ │ │ -IteratorRange(const Iterator &begin, const Iterator &end) │ │ │ │ │ -Constructs an iterator range on [begin,end). │ │ │ │ │ -DDeeffiinniittiioonn iteratorrange.hh:36 │ │ │ │ │ +_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/a00110.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: float_cmp.hh File Reference │ │ │ │ +dune-common: singleton.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,100 +71,40 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Enumerations | │ │ │ │ -Functions
│ │ │ │ -
float_cmp.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
singleton.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include "float_cmp.cc"
│ │ │ │ +
#include <dune/common/visibility.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...
 
class  Dune::FloatCmpOps< T, cstyle_, rstyle_ >
 Class encapsulating a default epsilon. More...
class  Dune::Singleton< T >
 An adapter to turn a class into a singleton. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

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

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

Detailed Description

│ │ │ │ -

Various ways to compare floating-point numbers.

│ │ │ │ +

Useful wrapper for creating singletons.

│ │ │ │ +

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

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,81 +1,24 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +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 │ │ │ │ │ -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_._._. │ │ │ │ │ -  │ │ │ │ │ - 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_._._. │ │ │ │ │ +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. │ │ │ │ │   │ │ │ │ │ -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 │ │ │ │ │ - } │ │ │ │ │ -  │ │ │ │ │ -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 │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Various ways to compare floating-point numbers. │ │ │ │ │ +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/a00110_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: float_cmp.hh Source File │ │ │ │ +dune-common: singleton.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,197 +74,62 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
float_cmp.hh
│ │ │ │ +
singleton.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 © 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_SINGLETON_HH
│ │ │ │ +
6#define DUNE_SINGLETON_HH
│ │ │ │
7
│ │ │ │ -
97namespace Dune {
│ │ │ │ -
100 namespace FloatCmp {
│ │ │ │ -
101 // basic constants
│ │ │ │ -
│ │ │ │ -
104 enum CmpStyle {
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
113 };
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
127 };
│ │ │ │ -
│ │ │ │ -
128
│ │ │ │ -
129 template<class T> struct EpsilonType;
│ │ │ │ -
130
│ │ │ │ -
132
│ │ │ │ -
137 template<class T, CmpStyle style = defaultCmpStyle>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
140 static typename EpsilonType<T>::Type value();
│ │ │ │ -
141 };
│ │ │ │ -
│ │ │ │ -
142
│ │ │ │ -
143 // operations in functional style
│ │ │ │ -
144
│ │ │ │ -
147
│ │ │ │ -
149
│ │ │ │ -
156 template <class T, CmpStyle style /*= defaultCmpStyle*/>
│ │ │ │ -
157 bool eq(const T &first,
│ │ │ │ -
158 const T &second,
│ │ │ │ - │ │ │ │ -
161
│ │ │ │ -
169 template <class T, CmpStyle style /*= defaultCmpStyle*/>
│ │ │ │ -
170 bool ne(const T &first,
│ │ │ │ -
171 const T &second,
│ │ │ │ - │ │ │ │ -
174
│ │ │ │ -
185 template <class T, CmpStyle style /*= defaultCmpStyle*/>
│ │ │ │ -
186 bool gt(const T &first,
│ │ │ │ -
187 const T &second,
│ │ │ │ - │ │ │ │ -
190
│ │ │ │ -
201 template <class T, CmpStyle style /*= defaultCmpStyle*/>
│ │ │ │ -
202 bool lt(const T &first,
│ │ │ │ -
203 const T &second,
│ │ │ │ - │ │ │ │ -
206
│ │ │ │ -
217 template <class T, CmpStyle style /*= defaultCmpStyle*/>
│ │ │ │ -
218 bool ge(const T &first,
│ │ │ │ -
219 const T &second,
│ │ │ │ - │ │ │ │ -
222
│ │ │ │ -
233 template <class T, CmpStyle style /*= defaultCmpStyle*/>
│ │ │ │ -
234 bool le(const T &first,
│ │ │ │ -
235 const T &second,
│ │ │ │ - │ │ │ │ -
237
│ │ │ │ -
238 // rounding operations
│ │ │ │ -
240
│ │ │ │ -
253 template<class I, class T, CmpStyle cstyle /*= defaultCmpStyle*/, RoundingStyle rstyle /*= defaultRoundingStyle*/>
│ │ │ │ -
254 I round(const T &val, typename EpsilonType<T>::Type epsilon = DefaultEpsilon<T, cstyle>::value());
│ │ │ │ -
255 // truncation
│ │ │ │ -
257
│ │ │ │ -
270 template<class I, class T, CmpStyle cstyle /*= defaultCmpStyle*/, RoundingStyle rstyle /*= defaultRoundingStyle*/>
│ │ │ │ -
271 I trunc(const T &val, typename EpsilonType<T>::Type epsilon = DefaultEpsilon<T, cstyle>::value());
│ │ │ │ -
272
│ │ │ │ -
274 // group FloatCmp
│ │ │ │ -
275 } //namespace FloatCmp
│ │ │ │ -
276
│ │ │ │ -
277
│ │ │ │ -
278 // oo interface
│ │ │ │ -
280
│ │ │ │ -
286 template<class T, FloatCmp::CmpStyle cstyle_ = FloatCmp::defaultCmpStyle,
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
291
│ │ │ │ -
292 public:
│ │ │ │ -
293 // record template parameters
│ │ │ │ -
295 static const CmpStyle cstyle = cstyle_;
│ │ │ │ -
297 static const RoundingStyle rstyle = rstyle_;
│ │ │ │ -
299 typedef T ValueType;
│ │ │ │ -
301
│ │ │ │ - │ │ │ │ -
305
│ │ │ │ -
306 private:
│ │ │ │ -
307 EpsilonType epsilon_;
│ │ │ │ -
308
│ │ │ │ - │ │ │ │ -
310
│ │ │ │ -
311 public:
│ │ │ │ -
313
│ │ │ │ - │ │ │ │ -
317
│ │ │ │ -
319 EpsilonType epsilon() const;
│ │ │ │ -
321 void epsilon(EpsilonType epsilon__);
│ │ │ │ -
322
│ │ │ │ -
324 bool eq(const ValueType &first, const ValueType &second) const;
│ │ │ │ -
326
│ │ │ │ -
329 bool ne(const ValueType &first, const ValueType &second) const;
│ │ │ │ -
331
│ │ │ │ -
335 bool gt(const ValueType &first, const ValueType &second) const;
│ │ │ │ -
337
│ │ │ │ -
341 bool lt(const ValueType &first, const ValueType &second) const;
│ │ │ │ -
343
│ │ │ │ -
347 bool ge(const ValueType &first, const ValueType &second) const;
│ │ │ │ -
349
│ │ │ │ -
353 bool le(const ValueType &first, const ValueType &second) const;
│ │ │ │ -
354
│ │ │ │ -
356
│ │ │ │ -
365 template<class I>
│ │ │ │ -
366 I round(const ValueType &val) const;
│ │ │ │ -
367
│ │ │ │ -
369
│ │ │ │ -
378 template<class I>
│ │ │ │ -
379 I trunc(const ValueType &val) const;
│ │ │ │ -
380
│ │ │ │ -
381 };
│ │ │ │ -
│ │ │ │ -
382
│ │ │ │ -
383} //namespace Dune
│ │ │ │ -
384
│ │ │ │ -
385#include "float_cmp.cc"
│ │ │ │ -
386
│ │ │ │ -
387#endif //DUNE_COMMON_FLOAT_CMP_HH
│ │ │ │ - │ │ │ │ -
bool ne(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test for inequality using epsilon
Definition float_cmp.cc:151
│ │ │ │ -
CmpStyle
Definition float_cmp.hh:104
│ │ │ │ -
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
│ │ │ │ -
RoundingStyle
Definition float_cmp.hh:116
│ │ │ │ -
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
│ │ │ │ -
@ defaultCmpStyle
the global default compare style (relative_weak)
Definition float_cmp.hh:112
│ │ │ │ -
@ 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
│ │ │ │ -
@ defaultRoundingStyle
the global default rounding style (toward_zero)
Definition float_cmp.hh:126
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ -
T Type
The epsilon type corresponding to value type T.
Definition float_cmp.cc:25
│ │ │ │ -
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.
│ │ │ │ -
Class encapsulating a default epsilon.
Definition float_cmp.hh:288
│ │ │ │ -
bool le(const ValueType &first, const ValueType &second) const
test if first lesser or equal second
Definition float_cmp.cc:486
│ │ │ │ -
bool eq(const ValueType &first, const ValueType &second) const
test for equality using epsilon
Definition float_cmp.cc:451
│ │ │ │ -
static const CmpStyle cstyle
How comparisons are done.
Definition float_cmp.hh:295
│ │ │ │ -
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
│ │ │ │ -
static const RoundingStyle rstyle
How rounding is done.
Definition float_cmp.hh:297
│ │ │ │ -
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
│ │ │ │ +
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,298 +1,66 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -float_cmp.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// -*- 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 © 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_SINGLETON_HH │ │ │ │ │ +6#define DUNE_SINGLETON_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 │ │ │ │ │ -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()); │ │ │ │ │ -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: │ │ │ │ │ -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; │ │ │ │ │ -331 │ │ │ │ │ -335 bool _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; │ │ │ │ │ -337 │ │ │ │ │ -341 bool _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; │ │ │ │ │ -343 │ │ │ │ │ -347 bool _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; │ │ │ │ │ -349 │ │ │ │ │ -353 bool _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; │ │ │ │ │ -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 │ │ │ │ │ +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_:_:_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_:_:_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/a00113.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: parametertree.cc File Reference │ │ │ │ +dune-common: filledarray.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -69,27 +69,45 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
parametertree.cc File Reference
│ │ │ │ +
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
filledarray.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <cstdlib>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <sstream>
│ │ │ │ -#include <fstream>
│ │ │ │ -#include <set>
│ │ │ │ -#include <algorithm>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/parametertree.hh>
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#include <array>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <dune/common/indices.hh>
│ │ │ │ +
│ │ │ │ +

Go to the source code of this file.

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

│ │ │ │ +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,19 +1,27 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -parametertree.cc File Reference │ │ │ │ │ -#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> │ │ │ │ │ -#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> │ │ │ │ │ +_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 │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_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_. │ │ │ │ │ +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/a00116.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: documentation.hh File Reference │ │ │ │ +dune-common: ios_state.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,46 +70,26 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Enumerations
│ │ │ │ -
documentation.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
ios_state.cc File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Documentation related stuff. │ │ │ │ -More...

│ │ │ │ - │ │ │ │ -

Go to the source code of this file.

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

│ │ │ │ -Classes

struct  Dune::ImplementationDefined
 Dummy struct used for documentation purposes. More...
 
│ │ │ │ +
#include <dune/common/ios_state.hh>
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Enumerations

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

Detailed Description

│ │ │ │ -

Documentation related stuff.

│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,25 +1,15 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -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_._._. │ │ │ │ │ -  │ │ │ │ │ +_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. │ │ │ │ │   │ │ │ │ │ -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/a00119.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: lru.hh File Reference │ │ │ │ +dune-common: sllist.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,44 +71,59 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
lru.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
sllist.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

Implements a singly linked list together with the necessary iterators. │ │ │ │ More...

│ │ │ │ -
#include <list>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <map>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ +
#include <memory>
│ │ │ │ +#include <cassert>
│ │ │ │ +#include "iteratorfacades.hh"
│ │ │ │ +#include <ostream>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::lru< Key, Tp, Traits >
 LRU Cache Container. More...
class  Dune::SLList< T, A >
 A single linked list. More...
 
class  Dune::SLListIterator< T, A >
 A mutable iterator for the SLList. More...
 
class  Dune::SLListConstIterator< T, A >
 A constant iterator for the SLList. More...
 
class  Dune::SLListModifyIterator< T, A >
 A mutable iterator for the SLList. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<typename T , typename A >
std::ostream & Dune::operator<< (std::ostream &os, const SLList< T, A > &sllist)
 
│ │ │ │

Detailed Description

│ │ │ │ -

LRU Cache Container, using an STL like interface.

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

Implements a singly linked list together with the necessary iterators.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,29 +1,43 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +_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 │ │ │ │ │ +sllist.hh File Reference │ │ │ │ │ +_C_o_m_m_o_n │ │ │ │ │ +Implements a singly linked list together with the necessary iterators. _M_o_r_e_._._. │ │ │ │ │ #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 │ │ │ │ │ +#include "_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h" │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_l_r_u_<_ _K_e_y_,_ _T_p_,_ _T_r_a_i_t_s_ _> │ │ │ │ │ -  LRU Cache Container. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_S_L_L_i_s_t_<_ _T_,_ _A_ _> │ │ │ │ │ +  A single linked list. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_ _T_,_ _A_ _> │ │ │ │ │ +  A mutable iterator for the _S_L_L_i_s_t. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_<_ _T_,_ _A_ _> │ │ │ │ │ +  A constant iterator for the _S_L_L_i_s_t. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_ _T_,_ _A_ _> │ │ │ │ │ +  A mutable iterator for the _S_L_L_i_s_t. _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 _S_L_L_i_s_t< T, A > │ │ │ │ │ + &sllist) │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -LRU Cache Container, using an STL like interface. │ │ │ │ │ +Implements a singly linked list together with the necessary iterators. │ │ │ │ │ Author │ │ │ │ │ - Christian Engwer │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: lru.hh Source File │ │ │ │ +dune-common: sllist.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,238 +74,780 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
lru.hh
│ │ │ │ +
sllist.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 © 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_LRU_HH
│ │ │ │ -
6#define DUNE_COMMON_LRU_HH
│ │ │ │ +
5#ifndef DUNE_SLLIST_HH
│ │ │ │ +
6#define DUNE_SLLIST_HH
│ │ │ │
7
│ │ │ │ -
8#include <list>
│ │ │ │ -
9#include <utility>
│ │ │ │ -
10#include <map>
│ │ │ │ -
11#include <memory>
│ │ │ │ +
8#include <memory>
│ │ │ │ +
9#include <cassert>
│ │ │ │ +
10#include "iteratorfacades.hh"
│ │ │ │ +
11#include <ostream>
│ │ │ │
12
│ │ │ │ - │ │ │ │ -
14
│ │ │ │ -
20namespace Dune {
│ │ │ │ -
21
│ │ │ │ -
22 namespace {
│ │ │ │ -
23
│ │ │ │ -
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 }
│ │ │ │ -
│ │ │ │ +
13namespace Dune
│ │ │ │ +
14{
│ │ │ │ +
26 template<typename T, class A>
│ │ │ │ +
27 class SLListIterator;
│ │ │ │ +
28
│ │ │ │ +
29 template<typename T, class A>
│ │ │ │ +
30 class SLListConstIterator;
│ │ │ │ +
31
│ │ │ │ +
32 template<typename T, class A>
│ │ │ │ +
33 class SLListModifyIterator;
│ │ │ │ +
34
│ │ │ │ +
42 template<typename T, class A=std::allocator<T> >
│ │ │ │ +
│ │ │ │ +
43 class SLList
│ │ │ │ +
44 {
│ │ │ │ +
45 struct Element;
│ │ │ │ +
46 friend class SLListIterator<T,A>;
│ │ │ │ +
47 friend class SLListConstIterator<T,A>;
│ │ │ │ +
48
│ │ │ │ +
49 public:
│ │ │ │ +
50
│ │ │ │ +
54 typedef typename A::size_type size_type;
│ │ │ │ +
55
│ │ │ │ +
59 typedef T MemberType;
│ │ │ │ +
60
│ │ │ │ +
64 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<Element>;
│ │ │ │ +
65
│ │ │ │ + │ │ │ │ +
70
│ │ │ │ + │ │ │ │ +
75
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
80
│ │ │ │ +
84 template<typename T1, typename A1>
│ │ │ │ +
│ │ │ │ +
85 SLList(const SLList<T1,A1>& other);
│ │ │ │ +
86
│ │ │ │ +
│ │ │ │ +
90 SLList(const SLList<T,A>& other);
│ │ │ │ +
91
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
98
│ │ │ │ + │ │ │ │ +
104
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
109
│ │ │ │ +
110
│ │ │ │ +
│ │ │ │ +
115 inline void push_back(const MemberType& item);
│ │ │ │ +
116
│ │ │ │ +
│ │ │ │ +
121 inline void push_front(const MemberType& item);
│ │ │ │ +
122
│ │ │ │ +
│ │ │ │ +
126 inline void pop_front();
│ │ │ │ +
127
│ │ │ │ +
│ │ │ │ +
129 inline void clear();
│ │ │ │ +
130
│ │ │ │ +
│ │ │ │ +
138 inline iterator begin();
│ │ │ │ +
139
│ │ │ │ +
│ │ │ │ +
147 inline const_iterator begin() const;
│ │ │ │ +
148
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
157
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
166
│ │ │ │ +
│ │ │ │ +
173 inline iterator end();
│ │ │ │ +
174
│ │ │ │ +
│ │ │ │ +
181 inline const_iterator end() const;
│ │ │ │ +
182
│ │ │ │ +
│ │ │ │ +
188 inline bool empty() const;
│ │ │ │ +
189
│ │ │ │ +
│ │ │ │ +
194 inline int size() const;
│ │ │ │ +
195
│ │ │ │ +
│ │ │ │ +
196 bool operator==(const SLList& sl) const;
│ │ │ │ +
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 }
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
199 bool operator!=(const SLList& sl) const;
│ │ │ │ +
200
│ │ │ │ +
201 private:
│ │ │ │ +
203 struct Element
│ │ │ │ +
204 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
213
│ │ │ │ +
│ │ │ │ +
214 Element(const MemberType& item, Element* next_=0);
│ │ │ │ +
215
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
217
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ +
225 void deleteNext(Element* current);
│ │ │ │ +
226
│ │ │ │ +
231 void copyElements(const SLList<T,A>& other);
│ │ │ │ +
232
│ │ │ │ +
240 template<bool watchForTail>
│ │ │ │ +
241 void deleteNext(Element* current);
│ │ │ │ +
247 void insertAfter(Element* current, const T& item);
│ │ │ │ +
248
│ │ │ │ +
250 Element beforeHead_;
│ │ │ │ +
251
│ │ │ │ +
257 Element* tail_;
│ │ │ │ +
258
│ │ │ │ +
260 Allocator allocator_;
│ │ │ │ +
261
│ │ │ │ +
263 int size_;
│ │ │ │ +
264 };
│ │ │ │ +
265
│ │ │ │ +
269 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
270 class SLListIterator : public Dune::ForwardIteratorFacade<SLListIterator<T,A>, T, T&, std::size_t>
│ │ │ │ +
271 {
│ │ │ │ +
272 friend class SLListConstIterator<T,A>;
│ │ │ │ +
273 friend class SLListModifyIterator<T,A>;
│ │ │ │ +
274 friend class SLList<T,A>;
│ │ │ │ +
275
│ │ │ │ +
276 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
278 SLList<T,A>* sllist)
│ │ │ │ +
279 : current_(item), list_(sllist)
│ │ │ │ +
280 {}
│ │ │ │ +
│ │ │ │ +
281
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
283 : current_(0), list_(0)
│ │ │ │ +
284 {}
│ │ │ │ +
│ │ │ │ +
285
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
287 : current_(other.iterator_.current_), list_(other.iterator_.list_)
│ │ │ │ +
288 {}
│ │ │ │ +
│ │ │ │ +
289
│ │ │ │ +
│ │ │ │ +
294 inline T& dereference() const
│ │ │ │ +
295 {
│ │ │ │ +
296 return current_->item_;
│ │ │ │ +
297 }
│ │ │ │ +
│ │ │ │ +
298
│ │ │ │ +
│ │ │ │ +
304 inline bool equals(const SLListConstIterator<T,A>& other) const
│ │ │ │ +
305 {
│ │ │ │ +
306 return current_==other.current_;
│ │ │ │ +
307 }
│ │ │ │ +
│ │ │ │ +
308
│ │ │ │ +
│ │ │ │ +
314 inline bool equals(const SLListIterator<T,A>& other) const
│ │ │ │ +
315 {
│ │ │ │ +
316 return current_==other.current_;
│ │ │ │ +
317 }
│ │ │ │ +
│ │ │ │ +
318
│ │ │ │ +
│ │ │ │ +
324 inline bool equals(const SLListModifyIterator<T,A>& other) const
│ │ │ │ +
325 {
│ │ │ │ +
326 return current_==other.iterator_.current_;
│ │ │ │ +
327 }
│ │ │ │ +
│ │ │ │ +
328
│ │ │ │ +
│ │ │ │ +
332 inline void increment()
│ │ │ │ +
333 {
│ │ │ │ +
334 current_ = current_->next_;
│ │ │ │ +
335 }
│ │ │ │ +
│ │ │ │ +
336
│ │ │ │ +
│ │ │ │ +
342 inline void insertAfter(const T& v) const
│ │ │ │ +
343 {
│ │ │ │ +
344 assert(list_ );
│ │ │ │ +
345 list_->insertAfter(current_, v);
│ │ │ │ +
346 }
│ │ │ │ +
│ │ │ │ +
347
│ │ │ │ +
│ │ │ │ +
353 inline void deleteNext() const
│ │ │ │ +
354 {
│ │ │ │ +
355 assert(list_);
│ │ │ │ +
356 list_->deleteNext(current_);
│ │ │ │ +
357 }
│ │ │ │ +
│ │ │ │ +
358
│ │ │ │ +
359 private:
│ │ │ │ +
361 typename SLList<T,A>::Element* current_;
│ │ │ │ + │ │ │ │ +
364 };
│ │ │ │ +
│ │ │ │ +
365
│ │ │ │ +
369 template<class T, class A>
│ │ │ │ +
│ │ │ │ +
370 class SLListConstIterator : public Dune::ForwardIteratorFacade<SLListConstIterator<T,A>, const T, const T&, std::size_t>
│ │ │ │ +
371 {
│ │ │ │ +
372 friend class SLListIterator<T,A>;
│ │ │ │ +
373 friend class SLList<T,A>;
│ │ │ │ +
374
│ │ │ │ +
375 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
377 : current_(0)
│ │ │ │ +
378 {}
│ │ │ │ +
│ │ │ │ +
379
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
381 : current_(item)
│ │ │ │ +
382 {}
│ │ │ │ +
│ │ │ │ +
383
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
385 : current_(other.current_)
│ │ │ │ +
386 {}
│ │ │ │ +
│ │ │ │ +
387
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
389 : current_(other.iterator_.current_)
│ │ │ │ +
390 {}
│ │ │ │ +
│ │ │ │ +
391
│ │ │ │ +
│ │ │ │ +
396 inline const T& dereference() const
│ │ │ │ +
397 {
│ │ │ │ +
398 return current_->item_;
│ │ │ │ +
399 }
│ │ │ │ +
│ │ │ │ +
400
│ │ │ │ +
│ │ │ │ +
406 inline bool equals(const SLListConstIterator<T,A>& other) const
│ │ │ │ +
407 {
│ │ │ │ +
408 return current_==other.current_;
│ │ │ │ +
409 }
│ │ │ │ +
│ │ │ │ +
410
│ │ │ │ +
│ │ │ │ +
414 inline void increment()
│ │ │ │ +
415 {
│ │ │ │ +
416 current_ = current_->next_;
│ │ │ │ +
417 }
│ │ │ │ +
│ │ │ │ +
418
│ │ │ │ +
419 private:
│ │ │ │ +
421 typename SLList<T,A>::Element* current_;
│ │ │ │ +
422 };
│ │ │ │ +
│ │ │ │ +
423
│ │ │ │ +
427 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
428 class SLListModifyIterator : public Dune::ForwardIteratorFacade<SLListModifyIterator<T,A>, T, T&, std::size_t>
│ │ │ │ +
429 {
│ │ │ │ +
430 friend class SLListConstIterator<T,A>;
│ │ │ │ +
431 friend class SLListIterator<T,A>;
│ │ │ │ +
432 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
434 SLListIterator<T,A> _iterator)
│ │ │ │ +
435 : beforeIterator_(beforeIterator), iterator_(_iterator)
│ │ │ │ +
436 {}
│ │ │ │ +
│ │ │ │ +
437
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
439 : beforeIterator_(), iterator_()
│ │ │ │ +
440 {}
│ │ │ │ +
│ │ │ │ +
441
│ │ │ │ +
│ │ │ │ +
446 inline T& dereference() const
│ │ │ │ +
447 {
│ │ │ │ +
448 return *iterator_;
│ │ │ │ +
449 }
│ │ │ │ +
│ │ │ │ +
450
│ │ │ │ +
│ │ │ │ +
456 inline bool equals(const SLListConstIterator<T,A>& other) const
│ │ │ │ +
457 {
│ │ │ │ +
458 return iterator_== other;
│ │ │ │ +
459 }
│ │ │ │ +
│ │ │ │ +
460
│ │ │ │ +
461
│ │ │ │ +
│ │ │ │ +
467 inline bool equals(const SLListIterator<T,A>& other) const
│ │ │ │ +
468 {
│ │ │ │ +
469 return iterator_== other;
│ │ │ │ +
470 }
│ │ │ │ +
│ │ │ │ +
471
│ │ │ │ +
472
│ │ │ │ +
│ │ │ │ +
478 inline bool equals(const SLListModifyIterator<T,A>& other) const
│ │ │ │ +
479 {
│ │ │ │ +
480 return iterator_== other.iterator_;
│ │ │ │ +
481 }
│ │ │ │ +
│ │ │ │ +
482
│ │ │ │ +
│ │ │ │ +
486 inline void increment()
│ │ │ │ +
487 {
│ │ │ │ +
488 ++iterator_;
│ │ │ │ +
489 ++beforeIterator_;
│ │ │ │ +
490 }
│ │ │ │ +
│ │ │ │ +
491
│ │ │ │ +
│ │ │ │ +
505 inline void insert(const T& v)
│ │ │ │ +
506 {
│ │ │ │ +
507 beforeIterator_.insertAfter(v);
│ │ │ │ +
508 ++beforeIterator_;
│ │ │ │ +
509 }
│ │ │ │ +
│ │ │ │ +
510
│ │ │ │ +
│ │ │ │ +
518 inline void remove()
│ │ │ │ +
519 {
│ │ │ │ +
520 ++iterator_;
│ │ │ │ +
521 beforeIterator_.deleteNext();
│ │ │ │ +
522 }
│ │ │ │ +
│ │ │ │ +
523
│ │ │ │ +
524 private:
│ │ │ │ +
526 SLListIterator<T,A> beforeIterator_;
│ │ │ │ +
528 SLListIterator<T,A> iterator_;
│ │ │ │ +
529 };
│ │ │ │ +
│ │ │ │ +
530
│ │ │ │ +
531 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ +
532 std::ostream& operator<<(std::ostream& os, const SLList<T,A>& sllist)
│ │ │ │ +
533 {
│ │ │ │ +
534 typedef typename SLList<T,A>::const_iterator Iterator;
│ │ │ │ +
535 Iterator end = sllist.end();
│ │ │ │ +
536 Iterator current= sllist.begin();
│ │ │ │ +
537
│ │ │ │ +
538 os << "{ ";
│ │ │ │ +
539
│ │ │ │ +
540 if(current!=end) {
│ │ │ │ +
541 os<<*current<<" ("<<static_cast<const void*>(&(*current))<<")";
│ │ │ │ +
542 ++current;
│ │ │ │ +
543
│ │ │ │ +
544 for(; current != end; ++current)
│ │ │ │ +
545 os<<", "<<*current<<" ("<<static_cast<const void*>(&(*current))<<")";
│ │ │ │ +
546 }
│ │ │ │ +
547 os<<"} ";
│ │ │ │ +
548 return os;
│ │ │ │ +
549 }
│ │ │ │ +
│ │ │ │ +
550
│ │ │ │ +
551 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
552 SLList<T,A>::Element::Element(const MemberType& item, Element* next)
│ │ │ │ +
553 : next_(next), item_(item)
│ │ │ │ +
554 {}
│ │ │ │ +
│ │ │ │ +
555
│ │ │ │ +
556 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
558 : next_(0), item_()
│ │ │ │ +
559 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
560
│ │ │ │ +
561 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
563 {
│ │ │ │ +
564 next_=0;
│ │ │ │ +
565 }
│ │ │ │ +
│ │ │ │ +
566
│ │ │ │ +
567 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
569 : beforeHead_(), tail_(&beforeHead_), allocator_(), size_(0)
│ │ │ │ +
570 {
│ │ │ │ +
571 beforeHead_.next_=0;
│ │ │ │ +
572 assert(&beforeHead_==tail_);
│ │ │ │ +
573 assert(tail_->next_==0);
│ │ │ │ +
574 }
│ │ │ │ +
│ │ │ │ +
575
│ │ │ │ +
576 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
578 : beforeHead_(), tail_(&beforeHead_), allocator_(), size_(0)
│ │ │ │ +
579 {
│ │ │ │ +
580 copyElements(other);
│ │ │ │ +
581 }
│ │ │ │ +
│ │ │ │ +
582
│ │ │ │ +
583 template<typename T, class A>
│ │ │ │ +
584 template<typename T1, class A1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
586 : beforeHead_(), tail_(&beforeHead_), allocator_(), size_(0)
│ │ │ │ +
587 {
│ │ │ │ +
588 copyElements(other);
│ │ │ │ +
589 }
│ │ │ │ +
│ │ │ │ +
590
│ │ │ │ +
591 template<typename T, typename A>
│ │ │ │ +
592 void SLList<T,A>::copyElements(const SLList<T,A>& other)
│ │ │ │ +
593 {
│ │ │ │ +
594 assert(tail_==&beforeHead_);
│ │ │ │ +
595 assert(size_==0);
│ │ │ │ +
596 typedef typename SLList<T,A>::const_iterator Iterator;
│ │ │ │ +
597 Iterator iend = other.end();
│ │ │ │ +
598 for(Iterator element=other.begin(); element != iend; ++element)
│ │ │ │ +
599 push_back(*element);
│ │ │ │ +
600
│ │ │ │ +
601 assert(other.size()==size());
│ │ │ │ +
602 }
│ │ │ │ +
603
│ │ │ │ +
604 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
606 {
│ │ │ │ +
607 clear();
│ │ │ │ +
608 }
│ │ │ │ +
│ │ │ │ +
609
│ │ │ │ +
610 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
611 bool SLList<T,A>::operator==(const SLList& other) const
│ │ │ │ +
612 {
│ │ │ │ +
613 if(size()!=other.size())
│ │ │ │ +
614 return false;
│ │ │ │ +
615 for(const_iterator iter=begin(), oiter=other.begin();
│ │ │ │ +
616 iter != end(); ++iter, ++oiter)
│ │ │ │ +
617 if(*iter!=*oiter)
│ │ │ │ +
618 return false;
│ │ │ │ +
619 return true;
│ │ │ │ +
620 }
│ │ │ │ +
│ │ │ │ +
621
│ │ │ │ +
622 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
623 bool SLList<T,A>::operator!=(const SLList& other) const
│ │ │ │ +
624 {
│ │ │ │ +
625 if(size()==other.size()) {
│ │ │ │ +
626 for(const_iterator iter=begin(), oiter=other.begin();
│ │ │ │ +
627 iter != end(); ++iter, ++oiter)
│ │ │ │ +
628 if(*iter!=*oiter)
│ │ │ │ +
629 return true;
│ │ │ │ +
630 return false;
│ │ │ │ +
631 }else
│ │ │ │ +
632 return true;
│ │ │ │ +
633 }
│ │ │ │ +
│ │ │ │ +
634 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
636 {
│ │ │ │ +
637 clear();
│ │ │ │ +
638 copyElements(other);
│ │ │ │ +
639 return *this;
│ │ │ │ +
640 }
│ │ │ │ +
│ │ │ │ +
641
│ │ │ │ +
642 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
643 inline void SLList<T,A>::push_back(const MemberType& item)
│ │ │ │ +
644 {
│ │ │ │ +
645 assert(size_>0 || tail_==&beforeHead_);
│ │ │ │ +
646 tail_->next_ = allocator_.allocate(1);
│ │ │ │ +
647 assert(size_>0 || tail_==&beforeHead_);
│ │ │ │ +
648 tail_ = tail_->next_;
│ │ │ │ +
649 ::new (static_cast<void*>(&(tail_->item_)))T(item);
│ │ │ │ +
650 tail_->next_=0;
│ │ │ │ +
651 assert(tail_->next_==0);
│ │ │ │ +
652 ++size_;
│ │ │ │ +
653 }
│ │ │ │ +
│ │ │ │ +
654
│ │ │ │ +
655 template<typename T, class A>
│ │ │ │ +
656 inline void SLList<T,A>::insertAfter(Element* current, const T& item)
│ │ │ │ +
657 {
│ │ │ │ +
658 assert(current);
│ │ │ │ +
659
│ │ │ │ +
660#ifndef NDEBUG
│ │ │ │ +
661 bool changeTail = (current == tail_);
│ │ │ │ +
662#endif
│ │ │ │ +
663
│ │ │ │ +
664 // Save old next element
│ │ │ │ +
665 Element* tmp = current->next_;
│ │ │ │ +
666
│ │ │ │ +
667 assert(!changeTail || !tmp);
│ │ │ │ +
668
│ │ │ │ +
669 // Allocate space
│ │ │ │ +
670 current->next_ = allocator_.allocate(1);
│ │ │ │ +
671
│ │ │ │ +
672 // Use copy constructor to initialize memory
│ │ │ │ +
673 std::allocator_traits<Allocator>::construct(allocator_, current->next_, Element(item,tmp));
│ │ │ │ +
674
│ │ │ │ +
675 //::new(static_cast<void*>(&(current->next_->item_))) T(item);
│ │ │ │ +
676
│ │ │ │ +
677 if(!current->next_->next_) {
│ │ │ │ +
678 // Update tail
│ │ │ │ +
679 assert(changeTail);
│ │ │ │ +
680 tail_ = current->next_;
│ │ │ │ +
681 }
│ │ │ │ +
682 ++size_;
│ │ │ │ +
683 assert(!tail_->next_);
│ │ │ │ +
684 }
│ │ │ │ +
685
│ │ │ │ +
686 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
687 inline void SLList<T,A>::push_front(const MemberType& item)
│ │ │ │ +
688 {
│ │ │ │ +
689 if(tail_ == &beforeHead_) {
│ │ │ │ +
690 // list was empty
│ │ │ │ +
691 beforeHead_.next_ = tail_ = allocator_.allocate(1, 0);
│ │ │ │ +
692 ::new(static_cast<void*>(&beforeHead_.next_->item_))T(item);
│ │ │ │ +
693 beforeHead_.next_->next_=0;
│ │ │ │ +
694 }else{
│ │ │ │ +
695 Element* added = allocator_.allocate(1, 0);
│ │ │ │ +
696 ::new(static_cast<void*>(&added->item_))T(item);
│ │ │ │ +
697 added->next_=beforeHead_.next_;
│ │ │ │ +
698 beforeHead_.next_=added;
│ │ │ │ +
699 }
│ │ │ │ +
700 assert(tail_->next_==0);
│ │ │ │ +
701 ++size_;
│ │ │ │ +
702 }
│ │ │ │ +
│ │ │ │ +
703
│ │ │ │ +
704
│ │ │ │ +
705 template<typename T, class A>
│ │ │ │ +
706 inline void SLList<T,A>::deleteNext(Element* current)
│ │ │ │ +
707 {
│ │ │ │ +
708 this->template deleteNext<true>(current);
│ │ │ │ +
709 }
│ │ │ │ +
710
│ │ │ │ +
711 template<typename T, class A>
│ │ │ │ +
712 template<bool watchForTail>
│ │ │ │ +
713 inline void SLList<T,A>::deleteNext(Element* current)
│ │ │ │ +
714 {
│ │ │ │ +
715 assert(current->next_);
│ │ │ │ +
716 Element* next = current->next_;
│ │ │ │ +
717
│ │ │ │ +
718 if(watchForTail)
│ │ │ │ +
719 if(next == tail_) {
│ │ │ │ +
720 // deleting last element changes tail!
│ │ │ │ +
721 tail_ = current;
│ │ │ │ +
722 }
│ │ │ │ +
723
│ │ │ │ +
724 current->next_ = next->next_;
│ │ │ │ +
725 std::allocator_traits<Allocator>::destroy(allocator_, next);
│ │ │ │ +
726 allocator_.deallocate(next, 1);
│ │ │ │ +
727 --size_;
│ │ │ │ +
728 assert(!watchForTail || &beforeHead_ != tail_ || size_==0);
│ │ │ │ +
729 }
│ │ │ │ +
730
│ │ │ │ +
731 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
733 {
│ │ │ │ +
734 deleteNext(&beforeHead_);
│ │ │ │ +
735 }
│ │ │ │ +
│ │ │ │ +
736
│ │ │ │ +
737 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
738 inline void SLList<T,A>::clear()
│ │ │ │ +
739 {
│ │ │ │ +
740 while(beforeHead_.next_ ) {
│ │ │ │ +
741 this->template deleteNext<false>(&beforeHead_);
│ │ │ │ +
742 }
│ │ │ │ +
743
│ │ │ │ +
744 assert(size_==0);
│ │ │ │ +
745 // update the tail!
│ │ │ │ +
746 tail_ = &beforeHead_;
│ │ │ │ +
747 }
│ │ │ │ +
│ │ │ │ +
748
│ │ │ │ +
749 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
750 inline bool SLList<T,A>::empty() const
│ │ │ │ +
751 {
│ │ │ │ +
752 return (&beforeHead_ == tail_);
│ │ │ │ +
753 }
│ │ │ │ +
│ │ │ │ +
754
│ │ │ │ +
755 template<typename T, class A>
│ │ │ │ +
│ │ │ │ +
756 inline int SLList<T,A>::size() const
│ │ │ │ +
757 {
│ │ │ │ +
758 return size_;
│ │ │ │ +
759 }
│ │ │ │ +
│ │ │ │ +
760
│ │ │ │ +
761 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
763 {
│ │ │ │ +
764 return iterator(beforeHead_.next_, this);
│ │ │ │ +
765 }
│ │ │ │ +
│ │ │ │ +
766
│ │ │ │ +
767 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
769 {
│ │ │ │ +
770 return const_iterator(beforeHead_.next_);
│ │ │ │ +
771 }
│ │ │ │ +
│ │ │ │ +
772
│ │ │ │ +
773 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
775 {
│ │ │ │ +
776 return iterator();
│ │ │ │ +
777 }
│ │ │ │ +
│ │ │ │ +
778
│ │ │ │ +
779 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
781 {
│ │ │ │ +
782 return SLListModifyIterator<T,A>(iterator(tail_, this),iterator());
│ │ │ │ +
783 }
│ │ │ │ +
│ │ │ │ +
784
│ │ │ │ +
785
│ │ │ │ +
786 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
788 {
│ │ │ │ +
789 return SLListModifyIterator<T,A>(iterator(&beforeHead_, this),
│ │ │ │ +
790 iterator(beforeHead_.next_, this));
│ │ │ │ +
791 }
│ │ │ │ +
│ │ │ │ +
792
│ │ │ │ +
793 template<typename T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
795 {
│ │ │ │ +
796 return const_iterator();
│ │ │ │ +
797 }
│ │ │ │ +
│ │ │ │ +
798
│ │ │ │ +
800}
│ │ │ │ +
801#endif
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
This file implements iterator facade classes for writing stl conformant iterators.
│ │ │ │ +
void push_front(const MemberType &item)
Add a new entry to the beginning of the list.
Definition sllist.hh:687
│ │ │ │ +
bool equals(const SLListConstIterator< T, A > &other) const
Equality test for the iterator facade.
Definition sllist.hh:406
│ │ │ │ +
void push_back(const MemberType &item)
Add a new entry to the end of the list.
Definition sllist.hh:643
│ │ │ │ +
ModifyIterator endModify()
Get an iterator capable of deleting and inserting elements.
Definition sllist.hh:780
│ │ │ │ +
SLListModifyIterator()
Definition sllist.hh:438
│ │ │ │ +
Element()
Definition sllist.hh:557
│ │ │ │ +
T & dereference() const
Dereferencing function for the iterator facade.
Definition sllist.hh:294
│ │ │ │ +
bool operator!=(const SLList &sl) const
Definition sllist.hh:623
│ │ │ │ +
MemberType item_
The element we hold.
Definition sllist.hh:212
│ │ │ │ +
SLListConstIterator(typename SLList< T, A >::Element *item)
Definition sllist.hh:380
│ │ │ │ +
typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator
The allocator to use.
Definition sllist.hh:64
│ │ │ │ +
void insertAfter(const T &v) const
Insert an element in the underlying list after the current position.
Definition sllist.hh:342
│ │ │ │ +
SLListIterator< T, A > iterator
The mutable iterator of the list.
Definition sllist.hh:69
│ │ │ │ +
SLListConstIterator(const SLListModifyIterator< T, A > &other)
Definition sllist.hh:388
│ │ │ │ +
SLListIterator()
Definition sllist.hh:282
│ │ │ │ +
~Element()
Definition sllist.hh:562
│ │ │ │ +
bool operator==(const SLList &sl) const
Definition sllist.hh:611
│ │ │ │ +
void deleteNext() const
Delete the entry after the current position.
Definition sllist.hh:353
│ │ │ │ +
SLList(const SLList< T, A > &other)
Copy constructor.
Definition sllist.hh:577
│ │ │ │ +
bool equals(const SLListModifyIterator< T, A > &other) const
Equality test for the iterator facade.
Definition sllist.hh:324
│ │ │ │ +
T & dereference() const
Dereferencing function for the iterator facade.
Definition sllist.hh:446
│ │ │ │ +
int size() const
Get the number of elements the list contains.
Definition sllist.hh:756
│ │ │ │ +
const_iterator begin() const
Get an iterator pointing to the first element in the list.
Definition sllist.hh:768
│ │ │ │ +
iterator end()
Get an iterator pointing to the end of the list.
Definition sllist.hh:774
│ │ │ │ +
void clear()
Remove all elements from the list.
Definition sllist.hh:738
│ │ │ │ +
SLList(const SLList< T1, A1 > &other)
Copy constructor with type conversion.
Definition sllist.hh:585
│ │ │ │ +
T MemberType
The type we store.
Definition sllist.hh:59
│ │ │ │ +
bool equals(const SLListModifyIterator< T, A > &other) const
Test whether another iterator is equal.
Definition sllist.hh:478
│ │ │ │ +
ModifyIterator beginModify()
Get an iterator capable of deleting and inserting elements.
Definition sllist.hh:787
│ │ │ │ +
SLList< T, A > & operator=(const SLList< T, A > &other)
Assignment operator.
Definition sllist.hh:635
│ │ │ │ +
SLListConstIterator(const SLListIterator< T, A > &other)
Definition sllist.hh:384
│ │ │ │ +
SLListConstIterator< T, A > const_iterator
The constant iterator of the list.
Definition sllist.hh:74
│ │ │ │ +
bool empty() const
Check whether the list is empty.
Definition sllist.hh:750
│ │ │ │ +
SLListConstIterator()
Definition sllist.hh:376
│ │ │ │ +
bool equals(const SLListConstIterator< T, A > &other) const
Equality test for the iterator facade.
Definition sllist.hh:304
│ │ │ │ +
bool equals(const SLListConstIterator< T, A > &other) const
Test whether another iterator is equal.
Definition sllist.hh:456
│ │ │ │ +
SLListModifyIterator< T, A > ModifyIterator
The type of the iterator capable of deletion and insertion.
Definition sllist.hh:103
│ │ │ │ +
const_iterator end() const
Get an iterator pointing to the end of the list.
Definition sllist.hh:794
│ │ │ │ +
SLList()
Constructor.
Definition sllist.hh:568
│ │ │ │ +
void insert(const T &v)
Insert an element at the current position.
Definition sllist.hh:505
│ │ │ │ +
SLListIterator(typename SLList< T, A >::Element *item, SLList< T, A > *sllist)
Definition sllist.hh:277
│ │ │ │ +
SLListModifyIterator(SLListIterator< T, A > beforeIterator, SLListIterator< T, A > _iterator)
Definition sllist.hh:433
│ │ │ │ +
void pop_front()
Remove the first item in the list.
Definition sllist.hh:732
│ │ │ │ +
void increment()
Increment function for the iterator facade.
Definition sllist.hh:332
│ │ │ │ +
SLListIterator(const SLListModifyIterator< T, A > &other)
Definition sllist.hh:286
│ │ │ │ +
A::size_type size_type
The size type.
Definition sllist.hh:54
│ │ │ │ +
void remove()
Delete the entry at the current position.
Definition sllist.hh:518
│ │ │ │ +
const T & dereference() const
Dereferencing function for the facade.
Definition sllist.hh:396
│ │ │ │ +
Element * next_
The next element in the list.
Definition sllist.hh:208
│ │ │ │ +
void increment()
Increment function for the iterator facade.
Definition sllist.hh:486
│ │ │ │ +
void increment()
Increment function for the iterator facade.
Definition sllist.hh:414
│ │ │ │ +
~SLList()
Destructor.
Definition sllist.hh:605
│ │ │ │ +
bool equals(const SLListIterator< T, A > &other) const
Test whether another iterator is equal.
Definition sllist.hh:467
│ │ │ │ +
iterator begin()
Get an iterator pointing to the first element in the list.
Definition sllist.hh:762
│ │ │ │ +
bool equals(const SLListIterator< T, A > &other) const
Equality test for the iterator facade.
Definition sllist.hh:314
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │
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
│ │ │ │ +
constexpr std::integer_sequence< T, II..., T(IN)> push_back(std::integer_sequence< T, II... >, std::integral_constant< T, IN >={})
Append an index IN to the back of the sequence.
Definition integersequence.hh:69
│ │ │ │ +
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
│ │ │ │ +
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:142
│ │ │ │ +
A mutable iterator for the SLList.
Definition sllist.hh:271
│ │ │ │ +
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,267 +1,808 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -lru.hh │ │ │ │ │ +sllist.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 © 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_LRU_HH │ │ │ │ │ -6#define DUNE_COMMON_LRU_HH │ │ │ │ │ +5#ifndef DUNE_SLLIST_HH │ │ │ │ │ +6#define DUNE_SLLIST_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include "_i_t_e_r_a_t_o_r_f_a_c_a_d_e_s_._h_h" │ │ │ │ │ +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 │ │ │ │ │ -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 } │ │ │ │ │ +13namespace _D_u_n_e │ │ │ │ │ +14{ │ │ │ │ │ +26 template │ │ │ │ │ +27 class SLListIterator; │ │ │ │ │ +28 │ │ │ │ │ +29 template │ │ │ │ │ +30 class SLListConstIterator; │ │ │ │ │ +31 │ │ │ │ │ +32 template │ │ │ │ │ +33 class SLListModifyIterator; │ │ │ │ │ +34 │ │ │ │ │ +42 template > │ │ │ │ │ +_4_3 class _S_L_L_i_s_t │ │ │ │ │ +44 { │ │ │ │ │ +45 struct Element; │ │ │ │ │ +46 friend class _S_L_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +47 friend class _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +48 │ │ │ │ │ +49 public: │ │ │ │ │ +50 │ │ │ │ │ +_5_4 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +55 │ │ │ │ │ +_5_9 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ +60 │ │ │ │ │ +_6_4 using _A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ │ +rebind_alloc; │ │ │ │ │ +65 │ │ │ │ │ +_6_9 typedef _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> _i_t_e_r_a_t_o_r; │ │ │ │ │ +70 │ │ │ │ │ +_7_4 typedef _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +75 │ │ │ │ │ +_7_9 _S_L_L_i_s_t(); │ │ │ │ │ +80 │ │ │ │ │ +84 template │ │ │ │ │ +_8_5 _S_L_L_i_s_t(const _S_L_L_i_s_t_<_T_1_,_A_1_>& other); │ │ │ │ │ +86 │ │ │ │ │ +_9_0 _S_L_L_i_s_t(const _S_L_L_i_s_t_<_T_,_A_>& other); │ │ │ │ │ +91 │ │ │ │ │ +_9_7 _~_S_L_L_i_s_t(); │ │ │ │ │ +98 │ │ │ │ │ +_1_0_3 typedef _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_> _M_o_d_i_f_y_I_t_e_r_a_t_o_r; │ │ │ │ │ +104 │ │ │ │ │ +_1_0_8 _S_L_L_i_s_t_<_T_,_A_>& _o_p_e_r_a_t_o_r_=(const _S_L_L_i_s_t_<_T_,_A_>& other); │ │ │ │ │ +109 │ │ │ │ │ +110 │ │ │ │ │ +_1_1_5 inline void _p_u_s_h___b_a_c_k(const _M_e_m_b_e_r_T_y_p_e& item); │ │ │ │ │ +116 │ │ │ │ │ +_1_2_1 inline void _p_u_s_h___f_r_o_n_t(const _M_e_m_b_e_r_T_y_p_e& item); │ │ │ │ │ +122 │ │ │ │ │ +_1_2_6 inline void _p_o_p___f_r_o_n_t(); │ │ │ │ │ +127 │ │ │ │ │ +_1_2_9 inline void _c_l_e_a_r(); │ │ │ │ │ +130 │ │ │ │ │ +_1_3_8 inline _i_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ │ +139 │ │ │ │ │ +_1_4_7 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ +148 │ │ │ │ │ +_1_5_6 inline _M_o_d_i_f_y_I_t_e_r_a_t_o_r _b_e_g_i_n_M_o_d_i_f_y(); │ │ │ │ │ +157 │ │ │ │ │ +_1_6_5 inline _M_o_d_i_f_y_I_t_e_r_a_t_o_r _e_n_d_M_o_d_i_f_y(); │ │ │ │ │ +166 │ │ │ │ │ +_1_7_3 inline _i_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ │ +174 │ │ │ │ │ +_1_8_1 inline _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ +182 │ │ │ │ │ +_1_8_8 inline bool _e_m_p_t_y() const; │ │ │ │ │ +189 │ │ │ │ │ +_1_9_4 inline int _s_i_z_e() const; │ │ │ │ │ +195 │ │ │ │ │ +_1_9_6 bool _o_p_e_r_a_t_o_r_=_=(const _S_L_L_i_s_t& sl) const; │ │ │ │ │ +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 } │ │ │ │ │ +_1_9_9 bool _o_p_e_r_a_t_o_r_!_=(const _S_L_L_i_s_t& sl) const; │ │ │ │ │ +200 │ │ │ │ │ +201 private: │ │ │ │ │ +203 struct Element │ │ │ │ │ +204 { │ │ │ │ │ +_2_0_8 _E_l_e_m_e_n_t* _n_e_x_t__; │ │ │ │ │ +_2_1_2 _M_e_m_b_e_r_T_y_p_e _i_t_e_m__; │ │ │ │ │ +213 │ │ │ │ │ +_2_1_4 _E_l_e_m_e_n_t(const _M_e_m_b_e_r_T_y_p_e& item, _E_l_e_m_e_n_t* _n_e_x_t__=0); │ │ │ │ │ +215 │ │ │ │ │ +_2_1_6 _E_l_e_m_e_n_t(); │ │ │ │ │ +217 │ │ │ │ │ +_2_1_8 _~_E_l_e_m_e_n_t(); │ │ │ │ │ +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 │ │ │ │ │ +225 void deleteNext(Element* current); │ │ │ │ │ +226 │ │ │ │ │ +231 void copyElements(const _S_L_L_i_s_t_<_T_,_A_>& other); │ │ │ │ │ +232 │ │ │ │ │ +240 template │ │ │ │ │ +241 void deleteNext(Element* current); │ │ │ │ │ +247 void insertAfter(Element* current, const T& item); │ │ │ │ │ +248 │ │ │ │ │ +250 Element beforeHead_; │ │ │ │ │ +251 │ │ │ │ │ +257 Element* tail_; │ │ │ │ │ +258 │ │ │ │ │ +260 _A_l_l_o_c_a_t_o_r allocator_; │ │ │ │ │ +261 │ │ │ │ │ +263 int size_; │ │ │ │ │ +264 }; │ │ │ │ │ +265 │ │ │ │ │ +269 template │ │ │ │ │ +_2_7_0 class _S_L_L_i_s_t_I_t_e_r_a_t_o_r : public _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, T&, std::size_t> │ │ │ │ │ +271 { │ │ │ │ │ +272 friend class _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +273 friend class _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r; │ │ │ │ │ +274 friend class _S_L_L_i_s_t; │ │ │ │ │ +275 │ │ │ │ │ +276 public: │ │ │ │ │ +_2_7_7 inline _S_L_L_i_s_t_I_t_e_r_a_t_o_r(typename _S_L_L_i_s_t_<_T_,_A_>_:_:_E_l_e_m_e_n_t* item, │ │ │ │ │ +278 _S_L_L_i_s_t_<_T_,_A_>* sllist) │ │ │ │ │ +279 : current_(item), list_(sllist) │ │ │ │ │ +280 {} │ │ │ │ │ +281 │ │ │ │ │ +_2_8_2 inline _S_L_L_i_s_t_I_t_e_r_a_t_o_r() │ │ │ │ │ +283 : current_(0), list_(0) │ │ │ │ │ +284 {} │ │ │ │ │ +285 │ │ │ │ │ +_2_8_6 inline _S_L_L_i_s_t_I_t_e_r_a_t_o_r(const _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_>& other) │ │ │ │ │ +287 : current_(other.iterator_.current_), list_(other.iterator_.list_) │ │ │ │ │ +288 {} │ │ │ │ │ +289 │ │ │ │ │ +_2_9_4 inline T& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ +295 { │ │ │ │ │ +296 return current_->item_; │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +_3_0_4 inline bool _e_q_u_a_l_s(const _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_<_T_,_A_>& other) const │ │ │ │ │ +305 { │ │ │ │ │ +306 return current_==other.current_; │ │ │ │ │ +307 } │ │ │ │ │ +308 │ │ │ │ │ +_3_1_4 inline bool _e_q_u_a_l_s(const _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_>& other) const │ │ │ │ │ +315 { │ │ │ │ │ +316 return current_==other.current_; │ │ │ │ │ +317 } │ │ │ │ │ +318 │ │ │ │ │ +_3_2_4 inline bool _e_q_u_a_l_s(const _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_>& other) const │ │ │ │ │ +325 { │ │ │ │ │ +326 return current_==other.iterator_.current_; │ │ │ │ │ +327 } │ │ │ │ │ +328 │ │ │ │ │ +_3_3_2 inline void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ +333 { │ │ │ │ │ +334 current_ = current_->next_; │ │ │ │ │ +335 } │ │ │ │ │ +336 │ │ │ │ │ +_3_4_2 inline void _i_n_s_e_r_t_A_f_t_e_r(const T& v) const │ │ │ │ │ +343 { │ │ │ │ │ +344 assert(list_ ); │ │ │ │ │ +345 list_->insertAfter(current_, v); │ │ │ │ │ +346 } │ │ │ │ │ +347 │ │ │ │ │ +_3_5_3 inline void _d_e_l_e_t_e_N_e_x_t() const │ │ │ │ │ +354 { │ │ │ │ │ +355 assert(list_); │ │ │ │ │ +356 list_->deleteNext(current_); │ │ │ │ │ +357 } │ │ │ │ │ +358 │ │ │ │ │ +359 private: │ │ │ │ │ +361 typename _S_L_L_i_s_t_<_T_,_A_>_:_:_E_l_e_m_e_n_t* current_; │ │ │ │ │ +_3_6_3 _S_L_L_i_s_t_<_T_,_A_>* list_; │ │ │ │ │ +364 }; │ │ │ │ │ +365 │ │ │ │ │ +369 template │ │ │ │ │ +_3_7_0 class _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r : public _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, const T, const T&, std::size_t> │ │ │ │ │ +371 { │ │ │ │ │ +372 friend class _S_L_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +373 friend class _S_L_L_i_s_t; │ │ │ │ │ +374 │ │ │ │ │ +375 public: │ │ │ │ │ +_3_7_6 inline _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r() │ │ │ │ │ +377 : current_(0) │ │ │ │ │ +378 {} │ │ │ │ │ +379 │ │ │ │ │ +_3_8_0 inline _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r(typename _S_L_L_i_s_t_<_T_,_A_>_:_:_E_l_e_m_e_n_t* item) │ │ │ │ │ +381 : current_(item) │ │ │ │ │ +382 {} │ │ │ │ │ +383 │ │ │ │ │ +_3_8_4 inline _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r(const _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_>& other) │ │ │ │ │ +385 : current_(other.current_) │ │ │ │ │ +386 {} │ │ │ │ │ +387 │ │ │ │ │ +_3_8_8 inline _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r(const _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_>& other) │ │ │ │ │ +389 : current_(other.iterator_.current_) │ │ │ │ │ +390 {} │ │ │ │ │ +391 │ │ │ │ │ +_3_9_6 inline const T& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ +397 { │ │ │ │ │ +398 return current_->item_; │ │ │ │ │ +399 } │ │ │ │ │ +400 │ │ │ │ │ +_4_0_6 inline bool _e_q_u_a_l_s(const _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_<_T_,_A_>& other) const │ │ │ │ │ +407 { │ │ │ │ │ +408 return current_==other.current_; │ │ │ │ │ +409 } │ │ │ │ │ +410 │ │ │ │ │ +_4_1_4 inline void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ +415 { │ │ │ │ │ +416 current_ = current_->next_; │ │ │ │ │ +417 } │ │ │ │ │ +418 │ │ │ │ │ +419 private: │ │ │ │ │ +_4_2_1 typename _S_L_L_i_s_t_<_T_,_A_>_:_:_E_l_e_m_e_n_t* current_; │ │ │ │ │ +422 }; │ │ │ │ │ +423 │ │ │ │ │ +427 template │ │ │ │ │ +_4_2_8 class _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r : public _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, T&, std::size_t> │ │ │ │ │ +429 { │ │ │ │ │ +430 friend class _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +431 friend class _S_L_L_i_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +432 public: │ │ │ │ │ +_4_3_3 inline _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r(_S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> beforeIterator, │ │ │ │ │ +434 _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> _iterator) │ │ │ │ │ +435 : beforeIterator_(beforeIterator), iterator_(_iterator) │ │ │ │ │ +436 {} │ │ │ │ │ +437 │ │ │ │ │ +_4_3_8 inline _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r() │ │ │ │ │ +439 : beforeIterator_(), iterator_() │ │ │ │ │ +440 {} │ │ │ │ │ +441 │ │ │ │ │ +_4_4_6 inline T& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ +447 { │ │ │ │ │ +448 return *iterator_; │ │ │ │ │ +449 } │ │ │ │ │ +450 │ │ │ │ │ +_4_5_6 inline bool _e_q_u_a_l_s(const _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_<_T_,_A_>& other) const │ │ │ │ │ +457 { │ │ │ │ │ +458 return iterator_== other; │ │ │ │ │ +459 } │ │ │ │ │ +460 │ │ │ │ │ +461 │ │ │ │ │ +_4_6_7 inline bool _e_q_u_a_l_s(const _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_>& other) const │ │ │ │ │ +468 { │ │ │ │ │ +469 return iterator_== other; │ │ │ │ │ +470 } │ │ │ │ │ +471 │ │ │ │ │ +472 │ │ │ │ │ +_4_7_8 inline bool _e_q_u_a_l_s(const _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_>& other) const │ │ │ │ │ +479 { │ │ │ │ │ +480 return iterator_== other.iterator_; │ │ │ │ │ +481 } │ │ │ │ │ +482 │ │ │ │ │ +_4_8_6 inline void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ +487 { │ │ │ │ │ +488 ++iterator_; │ │ │ │ │ +489 ++beforeIterator_; │ │ │ │ │ +490 } │ │ │ │ │ +491 │ │ │ │ │ +_5_0_5 inline void _i_n_s_e_r_t(const T& v) │ │ │ │ │ +506 { │ │ │ │ │ +507 beforeIterator_.insertAfter(v); │ │ │ │ │ +508 ++beforeIterator_; │ │ │ │ │ +509 } │ │ │ │ │ +510 │ │ │ │ │ +_5_1_8 inline void _r_e_m_o_v_e() │ │ │ │ │ +519 { │ │ │ │ │ +520 ++iterator_; │ │ │ │ │ +521 beforeIterator_.deleteNext(); │ │ │ │ │ +522 } │ │ │ │ │ +523 │ │ │ │ │ +524 private: │ │ │ │ │ +526 _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> beforeIterator_; │ │ │ │ │ +528 _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> iterator_; │ │ │ │ │ +529 }; │ │ │ │ │ +530 │ │ │ │ │ +531 template │ │ │ │ │ +_5_3_2 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _S_L_L_i_s_t_<_T_,_A_>& sllist) │ │ │ │ │ +533 { │ │ │ │ │ +534 typedef typename _S_L_L_i_s_t_<_T_,_A_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iterator; │ │ │ │ │ +535 Iterator end = sllist._e_n_d(); │ │ │ │ │ +536 Iterator current= sllist._b_e_g_i_n(); │ │ │ │ │ +537 │ │ │ │ │ +538 os << "{ "; │ │ │ │ │ +539 │ │ │ │ │ +540 if(current!=end) { │ │ │ │ │ +541 os<<*current<<" ("<(&(*current))<<")"; │ │ │ │ │ +542 ++current; │ │ │ │ │ +543 │ │ │ │ │ +544 for(; current != end; ++current) │ │ │ │ │ +545 os<<", "<<*current<<" ("<(&(*current))<<")"; │ │ │ │ │ +546 } │ │ │ │ │ +547 os<<"} "; │ │ │ │ │ +548 return os; │ │ │ │ │ +549 } │ │ │ │ │ +550 │ │ │ │ │ +551 template │ │ │ │ │ +_5_5_2 _S_L_L_i_s_t_<_T_,_A_>_:_:_E_l_e_m_e_n_t_:_:_E_l_e_m_e_n_t(const _M_e_m_b_e_r_T_y_p_e& item, Element* next) │ │ │ │ │ +553 : next_(next), item_(item) │ │ │ │ │ +554 {} │ │ │ │ │ +555 │ │ │ │ │ +556 template │ │ │ │ │ +_5_5_7 _S_L_L_i_s_t_<_T_,_A_>_:_:_E_l_e_m_e_n_t_:_:_E_l_e_m_e_n_t() │ │ │ │ │ +558 : next_(0), item_() │ │ │ │ │ +559 {} │ │ │ │ │ +560 │ │ │ │ │ +561 template │ │ │ │ │ +_5_6_2 _S_L_L_i_s_t_<_T_,_A_>_:_:_E_l_e_m_e_n_t_:_:_~_E_l_e_m_e_n_t() │ │ │ │ │ +563 { │ │ │ │ │ +564 next_=0; │ │ │ │ │ +565 } │ │ │ │ │ +566 │ │ │ │ │ +567 template │ │ │ │ │ +_5_6_8 _S_L_L_i_s_t_<_T_,_A_>_:_:_S_L_L_i_s_t() │ │ │ │ │ +569 : beforeHead_(), tail_(&beforeHead_), allocator_(), size_(0) │ │ │ │ │ +570 { │ │ │ │ │ +571 beforeHead_.next_=0; │ │ │ │ │ +572 assert(&beforeHead_==tail_); │ │ │ │ │ +573 assert(tail_->next_==0); │ │ │ │ │ +574 } │ │ │ │ │ +575 │ │ │ │ │ +576 template │ │ │ │ │ +_5_7_7 _S_L_L_i_s_t_<_T_,_A_>_:_:_S_L_L_i_s_t(const _S_L_L_i_s_t_<_T_,_A_>& other) │ │ │ │ │ +578 : beforeHead_(), tail_(&beforeHead_), allocator_(), size_(0) │ │ │ │ │ +579 { │ │ │ │ │ +580 copyElements(other); │ │ │ │ │ +581 } │ │ │ │ │ +582 │ │ │ │ │ +583 template │ │ │ │ │ +584 template │ │ │ │ │ +_5_8_5 _S_L_L_i_s_t_<_T_,_A_>_:_:_S_L_L_i_s_t(const _S_L_L_i_s_t_<_T_1_,_A_1_>& other) │ │ │ │ │ +586 : beforeHead_(), tail_(&beforeHead_), allocator_(), size_(0) │ │ │ │ │ +587 { │ │ │ │ │ +588 copyElements(other); │ │ │ │ │ +589 } │ │ │ │ │ +590 │ │ │ │ │ +591 template │ │ │ │ │ +592 void _S_L_L_i_s_t_<_T_,_A_>_:_:_c_o_p_y_E_l_e_m_e_n_t_s(const _S_L_L_i_s_t_<_T_,_A_>& other) │ │ │ │ │ +593 { │ │ │ │ │ +594 assert(tail_==&beforeHead_); │ │ │ │ │ +595 assert(size_==0); │ │ │ │ │ +596 typedef typename _S_L_L_i_s_t_<_T_,_A_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iterator; │ │ │ │ │ +597 Iterator iend = other._e_n_d(); │ │ │ │ │ +598 for(Iterator element=other._b_e_g_i_n(); element != iend; ++element) │ │ │ │ │ +599 _p_u_s_h___b_a_c_k(*element); │ │ │ │ │ +600 │ │ │ │ │ +601 assert(other._s_i_z_e()==_s_i_z_e()); │ │ │ │ │ +602 } │ │ │ │ │ +603 │ │ │ │ │ +604 template │ │ │ │ │ +_6_0_5 _S_L_L_i_s_t_<_T_,_A_>_:_:_~_S_L_L_i_s_t() │ │ │ │ │ +606 { │ │ │ │ │ +607 clear(); │ │ │ │ │ +608 } │ │ │ │ │ +609 │ │ │ │ │ +610 template │ │ │ │ │ +_6_1_1 bool _S_L_L_i_s_t_<_T_,_A_>_:_:_o_p_e_r_a_t_o_r_=_=(const _S_L_L_i_s_t& other) const │ │ │ │ │ +612 { │ │ │ │ │ +613 if(_s_i_z_e()!=other._s_i_z_e()) │ │ │ │ │ +614 return false; │ │ │ │ │ +615 for(_c_o_n_s_t___i_t_e_r_a_t_o_r iter=begin(), oiter=other._b_e_g_i_n(); │ │ │ │ │ +616 iter != end(); ++iter, ++oiter) │ │ │ │ │ +617 if(*iter!=*oiter) │ │ │ │ │ +618 return false; │ │ │ │ │ +619 return true; │ │ │ │ │ +620 } │ │ │ │ │ +621 │ │ │ │ │ +622 template │ │ │ │ │ +_6_2_3 bool _S_L_L_i_s_t_<_T_,_A_>_:_:_o_p_e_r_a_t_o_r_!_=(const _S_L_L_i_s_t& other) const │ │ │ │ │ +624 { │ │ │ │ │ +625 if(_s_i_z_e()==other._s_i_z_e()) { │ │ │ │ │ +626 for(_c_o_n_s_t___i_t_e_r_a_t_o_r iter=begin(), oiter=other._b_e_g_i_n(); │ │ │ │ │ +627 iter != end(); ++iter, ++oiter) │ │ │ │ │ +628 if(*iter!=*oiter) │ │ │ │ │ +629 return true; │ │ │ │ │ +630 return false; │ │ │ │ │ +631 }else │ │ │ │ │ +632 return true; │ │ │ │ │ +633 } │ │ │ │ │ +634 template │ │ │ │ │ +_6_3_5 _S_L_L_i_s_t_<_T_,_A_>& _S_L_L_i_s_t_<_T_,_A_>_:_:_o_p_e_r_a_t_o_r_=(const _S_L_L_i_s_t_<_T_,_A_>& other) │ │ │ │ │ +636 { │ │ │ │ │ +637 clear(); │ │ │ │ │ +638 copyElements(other); │ │ │ │ │ +639 return *this; │ │ │ │ │ +640 } │ │ │ │ │ +641 │ │ │ │ │ +642 template │ │ │ │ │ +_6_4_3 inline void _S_L_L_i_s_t_<_T_,_A_>_:_:_p_u_s_h___b_a_c_k(const _M_e_m_b_e_r_T_y_p_e& item) │ │ │ │ │ +644 { │ │ │ │ │ +645 assert(size_>0 || tail_==&beforeHead_); │ │ │ │ │ +646 tail_->next_ = allocator_.allocate(1); │ │ │ │ │ +647 assert(size_>0 || tail_==&beforeHead_); │ │ │ │ │ +648 tail_ = tail_->next_; │ │ │ │ │ +649 ::new (static_cast(&(tail_->item_)))T(item); │ │ │ │ │ +650 tail_->next_=0; │ │ │ │ │ +651 assert(tail_->next_==0); │ │ │ │ │ +652 ++size_; │ │ │ │ │ +653 } │ │ │ │ │ +654 │ │ │ │ │ +655 template │ │ │ │ │ +656 inline void _S_L_L_i_s_t_<_T_,_A_>_:_:_i_n_s_e_r_t_A_f_t_e_r(Element* current, const T& item) │ │ │ │ │ +657 { │ │ │ │ │ +658 assert(current); │ │ │ │ │ +659 │ │ │ │ │ +660#ifndef NDEBUG │ │ │ │ │ +661 bool changeTail = (current == tail_); │ │ │ │ │ +662#endif │ │ │ │ │ +663 │ │ │ │ │ +664 // Save old next element │ │ │ │ │ +665 Element* tmp = current->next_; │ │ │ │ │ +666 │ │ │ │ │ +667 assert(!changeTail || !tmp); │ │ │ │ │ +668 │ │ │ │ │ +669 // Allocate space │ │ │ │ │ +670 current->next_ = allocator_.allocate(1); │ │ │ │ │ +671 │ │ │ │ │ +672 // Use copy constructor to initialize memory │ │ │ │ │ +673 std::allocator_traits::construct(allocator_, current->next_, │ │ │ │ │ +Element(item,tmp)); │ │ │ │ │ +674 │ │ │ │ │ +675 //::new(static_cast(&(current->next_->item_))) T(item); │ │ │ │ │ +676 │ │ │ │ │ +677 if(!current->next_->next_) { │ │ │ │ │ +678 // Update tail │ │ │ │ │ +679 assert(changeTail); │ │ │ │ │ +680 tail_ = current->next_; │ │ │ │ │ +681 } │ │ │ │ │ +682 ++size_; │ │ │ │ │ +683 assert(!tail_->next_); │ │ │ │ │ +684 } │ │ │ │ │ +685 │ │ │ │ │ +686 template │ │ │ │ │ +_6_8_7 inline void _S_L_L_i_s_t_<_T_,_A_>_:_:_p_u_s_h___f_r_o_n_t(const _M_e_m_b_e_r_T_y_p_e& item) │ │ │ │ │ +688 { │ │ │ │ │ +689 if(tail_ == &beforeHead_) { │ │ │ │ │ +690 // list was empty │ │ │ │ │ +691 beforeHead_.next_ = tail_ = allocator_.allocate(1, 0); │ │ │ │ │ +692 ::new(static_cast(&beforeHead_.next_->item_))T(item); │ │ │ │ │ +693 beforeHead_.next_->next_=0; │ │ │ │ │ +694 }else{ │ │ │ │ │ +695 Element* added = allocator_.allocate(1, 0); │ │ │ │ │ +696 ::new(static_cast(&added->item_))T(item); │ │ │ │ │ +697 added->next_=beforeHead_.next_; │ │ │ │ │ +698 beforeHead_.next_=added; │ │ │ │ │ +699 } │ │ │ │ │ +700 assert(tail_->next_==0); │ │ │ │ │ +701 ++size_; │ │ │ │ │ +702 } │ │ │ │ │ +703 │ │ │ │ │ +704 │ │ │ │ │ +705 template │ │ │ │ │ +706 inline void _S_L_L_i_s_t_<_T_,_A_>_:_:_d_e_l_e_t_e_N_e_x_t(Element* current) │ │ │ │ │ +707 { │ │ │ │ │ +708 this->template deleteNext(current); │ │ │ │ │ +709 } │ │ │ │ │ +710 │ │ │ │ │ +711 template │ │ │ │ │ +712 template │ │ │ │ │ +713 inline void SLList::deleteNext(Element* current) │ │ │ │ │ +714 { │ │ │ │ │ +715 assert(current->next_); │ │ │ │ │ +716 Element* next = current->next_; │ │ │ │ │ +717 │ │ │ │ │ +718 if(watchForTail) │ │ │ │ │ +719 if(next == tail_) { │ │ │ │ │ +720 // deleting last element changes tail! │ │ │ │ │ +721 tail_ = current; │ │ │ │ │ +722 } │ │ │ │ │ +723 │ │ │ │ │ +724 current->next_ = next->next_; │ │ │ │ │ +725 std::allocator_traits::destroy(allocator_, next); │ │ │ │ │ +726 allocator_.deallocate(next, 1); │ │ │ │ │ +727 --size_; │ │ │ │ │ +728 assert(!watchForTail || &beforeHead_ != tail_ || size_==0); │ │ │ │ │ +729 } │ │ │ │ │ +730 │ │ │ │ │ +731 template │ │ │ │ │ +_7_3_2 inline void _S_L_L_i_s_t_<_T_,_A_>_:_:_p_o_p___f_r_o_n_t() │ │ │ │ │ +733 { │ │ │ │ │ +734 deleteNext(&beforeHead_); │ │ │ │ │ +735 } │ │ │ │ │ +736 │ │ │ │ │ +737 template │ │ │ │ │ +_7_3_8 inline void _S_L_L_i_s_t_<_T_,_A_>_:_:_c_l_e_a_r() │ │ │ │ │ +739 { │ │ │ │ │ +740 while(beforeHead_.next_ ) { │ │ │ │ │ +741 this->template deleteNext(&beforeHead_); │ │ │ │ │ +742 } │ │ │ │ │ +743 │ │ │ │ │ +744 assert(size_==0); │ │ │ │ │ +745 // update the tail! │ │ │ │ │ +746 tail_ = &beforeHead_; │ │ │ │ │ +747 } │ │ │ │ │ +748 │ │ │ │ │ +749 template │ │ │ │ │ +_7_5_0 inline bool _S_L_L_i_s_t_<_T_,_A_>_:_:_e_m_p_t_y() const │ │ │ │ │ +751 { │ │ │ │ │ +752 return (&beforeHead_ == tail_); │ │ │ │ │ +753 } │ │ │ │ │ +754 │ │ │ │ │ +755 template │ │ │ │ │ +_7_5_6 inline int _S_L_L_i_s_t_<_T_,_A_>_:_:_s_i_z_e() const │ │ │ │ │ +757 { │ │ │ │ │ +758 return size_; │ │ │ │ │ +759 } │ │ │ │ │ +760 │ │ │ │ │ +761 template │ │ │ │ │ +_7_6_2 inline _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> _S_L_L_i_s_t_<_T_,_A_>_:_:_b_e_g_i_n() │ │ │ │ │ +763 { │ │ │ │ │ +764 return _i_t_e_r_a_t_o_r(beforeHead_.next_, this); │ │ │ │ │ +765 } │ │ │ │ │ +766 │ │ │ │ │ +767 template │ │ │ │ │ +_7_6_8 inline _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> _S_L_L_i_s_t_<_T_,_A_>_:_:_b_e_g_i_n() const │ │ │ │ │ +769 { │ │ │ │ │ +770 return _c_o_n_s_t___i_t_e_r_a_t_o_r(beforeHead_.next_); │ │ │ │ │ +771 } │ │ │ │ │ +772 │ │ │ │ │ +773 template │ │ │ │ │ +_7_7_4 inline _S_L_L_i_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> _S_L_L_i_s_t_<_T_,_A_>_:_:_e_n_d() │ │ │ │ │ +775 { │ │ │ │ │ +776 return _i_t_e_r_a_t_o_r(); │ │ │ │ │ +777 } │ │ │ │ │ +778 │ │ │ │ │ +779 template │ │ │ │ │ +_7_8_0 inline _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_> _S_L_L_i_s_t_<_T_,_A_>_:_:_e_n_d_M_o_d_i_f_y() │ │ │ │ │ +781 { │ │ │ │ │ +782 return _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_>(_i_t_e_r_a_t_o_r(tail_, this),_i_t_e_r_a_t_o_r()); │ │ │ │ │ +783 } │ │ │ │ │ +784 │ │ │ │ │ +785 │ │ │ │ │ +786 template │ │ │ │ │ +_7_8_7 inline _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_> _S_L_L_i_s_t_<_T_,_A_>_:_:_b_e_g_i_n_M_o_d_i_f_y() │ │ │ │ │ +788 { │ │ │ │ │ +789 return _S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_<_T_,_A_>(_i_t_e_r_a_t_o_r(&beforeHead_, this), │ │ │ │ │ +790 _i_t_e_r_a_t_o_r(beforeHead_.next_, this)); │ │ │ │ │ +791 } │ │ │ │ │ +792 │ │ │ │ │ +793 template │ │ │ │ │ +_7_9_4 inline _S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_<_T_,_A_> _S_L_L_i_s_t_<_T_,_A_>_:_:_e_n_d() const │ │ │ │ │ +795 { │ │ │ │ │ +796 return _c_o_n_s_t___i_t_e_r_a_t_o_r(); │ │ │ │ │ +797 } │ │ │ │ │ +798 │ │ │ │ │ +800} │ │ │ │ │ +801#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_:_:_S_L_L_i_s_t_:_:_p_u_s_h___f_r_o_n_t │ │ │ │ │ +void push_front(const MemberType &item) │ │ │ │ │ +Add a new entry to the beginning of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:687 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const SLListConstIterator< T, A > &other) const │ │ │ │ │ +Equality test for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:406 │ │ │ │ │ +_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_:_:_e_n_d_M_o_d_i_f_y │ │ │ │ │ +ModifyIterator endModify() │ │ │ │ │ +Get an iterator capable of deleting and inserting elements. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:780 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListModifyIterator() │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:438 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_E_l_e_m_e_n_t_:_:_E_l_e_m_e_n_t │ │ │ │ │ +Element() │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:557 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +T & dereference() const │ │ │ │ │ +Dereferencing function for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:294 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const SLList &sl) const │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:623 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_E_l_e_m_e_n_t_:_:_i_t_e_m__ │ │ │ │ │ +MemberType item_ │ │ │ │ │ +The element we hold. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:212 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListConstIterator(typename SLList< T, A >::Element *item) │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:380 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator │ │ │ │ │ +The allocator to use. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_i_n_s_e_r_t_A_f_t_e_r │ │ │ │ │ +void insertAfter(const T &v) const │ │ │ │ │ +Insert an element in the underlying list after the current position. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:342 │ │ │ │ │ +_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_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListConstIterator(const SLListModifyIterator< T, A > &other) │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:388 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListIterator() │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_E_l_e_m_e_n_t_:_:_~_E_l_e_m_e_n_t │ │ │ │ │ +~Element() │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:562 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const SLList &sl) const │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:611 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_d_e_l_e_t_e_N_e_x_t │ │ │ │ │ +void deleteNext() const │ │ │ │ │ +Delete the entry after the current position. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:353 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_S_L_L_i_s_t │ │ │ │ │ +SLList(const SLList< T, A > &other) │ │ │ │ │ +Copy constructor. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:577 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const SLListModifyIterator< T, A > &other) const │ │ │ │ │ +Equality test for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +T & dereference() const │ │ │ │ │ +Dereferencing function for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:446 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_s_i_z_e │ │ │ │ │ +int size() const │ │ │ │ │ +Get the number of elements the list contains. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:756 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +Get an iterator pointing to the first element in the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:768 │ │ │ │ │ +_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_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +Remove all elements from the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:738 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_S_L_L_i_s_t │ │ │ │ │ +SLList(const SLList< T1, A1 > &other) │ │ │ │ │ +Copy constructor with type conversion. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:585 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ +T MemberType │ │ │ │ │ +The type we store. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const SLListModifyIterator< T, A > &other) const │ │ │ │ │ +Test whether another iterator is equal. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:478 │ │ │ │ │ +_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_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +SLList< T, A > & operator=(const SLList< T, A > &other) │ │ │ │ │ +Assignment operator. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:635 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListConstIterator(const SLListIterator< T, A > &other) │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:384 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +SLListConstIterator< T, A > const_iterator │ │ │ │ │ +The constant iterator of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_e_m_p_t_y │ │ │ │ │ +bool empty() const │ │ │ │ │ +Check whether the list is empty. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:750 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListConstIterator() │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:376 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const SLListConstIterator< T, A > &other) const │ │ │ │ │ +Equality test for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:304 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const SLListConstIterator< T, A > &other) const │ │ │ │ │ +Test whether another iterator is equal. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:456 │ │ │ │ │ +_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_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +Get an iterator pointing to the end of the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:794 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_S_L_L_i_s_t │ │ │ │ │ +SLList() │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:568 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_i_n_s_e_r_t │ │ │ │ │ +void insert(const T &v) │ │ │ │ │ +Insert an element at the current position. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:505 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListIterator(typename SLList< T, A >::Element *item, SLList< T, A > *sllist) │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:277 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListModifyIterator(SLListIterator< T, A > beforeIterator, SLListIterator< T, │ │ │ │ │ +A > _iterator) │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:433 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_p_o_p___f_r_o_n_t │ │ │ │ │ +void pop_front() │ │ │ │ │ +Remove the first item in the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:732 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +Increment function for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:332 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +SLListIterator(const SLListModifyIterator< T, A > &other) │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:286 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The size type. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_r_e_m_o_v_e │ │ │ │ │ +void remove() │ │ │ │ │ +Delete the entry at the current position. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:518 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +const T & dereference() const │ │ │ │ │ +Dereferencing function for the facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:396 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_E_l_e_m_e_n_t_:_:_n_e_x_t__ │ │ │ │ │ +Element * next_ │ │ │ │ │ +The next element in the list. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:208 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +Increment function for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:486 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +Increment function for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:414 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_:_:_~_S_L_L_i_s_t │ │ │ │ │ +~SLList() │ │ │ │ │ +Destructor. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:605 │ │ │ │ │ +_D_u_n_e_:_:_S_L_L_i_s_t_M_o_d_i_f_y_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const SLListIterator< T, A > &other) const │ │ │ │ │ +Test whether another iterator is equal. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:467 │ │ │ │ │ +_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_:_:_S_L_L_i_s_t_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const SLListIterator< T, A > &other) const │ │ │ │ │ +Equality test for the iterator facade. │ │ │ │ │ +DDeeffiinniittiioonn sllist.hh:314 │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ +_D_u_n_e_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ +constexpr std::integer_sequence< T, II..., T(IN)> push_back(std:: │ │ │ │ │ +integer_sequence< T, II... >, std::integral_constant< T, IN >={}) │ │ │ │ │ +Append an index IN to the back of the sequence. │ │ │ │ │ +DDeeffiinniittiioonn integersequence.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_s_i_z_e │ │ │ │ │ +constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std:: │ │ │ │ │ +integer_sequence< T, II... >) │ │ │ │ │ +Return the size of the sequence. │ │ │ │ │ +DDeeffiinniittiioonn integersequence.hh:75 │ │ │ │ │ +_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:142 │ │ │ │ │ +_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_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/a00122.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: memory.hh File Reference │ │ │ │ +dune-common: exceptions.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,45 +65,30 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
memory.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
exceptions.cc File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <memory>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/typeutilities.hh>
│ │ │ │ -
│ │ │ │ -

Go to the source code of this file.

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

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<class T >
constexpr auto Dune::Std::to_address (T &&p) noexcept
 Obtain the address represented by p without forming a reference to the object pointed to by p.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,28 +1,15 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -memory.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> │ │ │ │ │ -_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 │ │ │ │ │ +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> │ │ │ │ │ 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 │ │ │ │ │ -constexpr auto  _D_u_n_e_:_:_S_t_d_:_:_t_o___a_d_d_r_e_s_s (T &&p) noexcept │ │ │ │ │ -  Obtain the address represented by p without forming a reference │ │ │ │ │ - to the object pointed to by p. │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: layout_right.hh File Reference │ │ │ │ +dune-common: debugstream.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,46 +65,69 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
layout_right.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Typedefs
│ │ │ │ +
debugstream.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/std/impl/fwd_layouts.hh>
│ │ │ │ + │ │ │ │ +

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

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

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Std::layout_right::mapping< Extents >
 A layout mapping where the rightmost extent has stride 1. More...
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.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Typedefs

typedef unsigned int Dune::DebugLevel
 Type for debug levels.
 
│ │ │ │ -
│ │ │ │ +

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,27 +1,47 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -layout_right.hh File Reference │ │ │ │ │ -#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_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s │ │ │ │ │ +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> │ │ │ │ │ _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_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_<_ _E_x_t_e_n_t_s_ _> │ │ │ │ │ -  A layout mapping where the rightmost extent has stride 1. _M_o_r_e_._._. │ │ │ │ │ +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. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +typedef unsigned int  _D_u_n_e_:_:_D_e_b_u_g_L_e_v_e_l │ │ │ │ │ +  Type for debug levels. │ │ │ │ │   │ │ │ │ │ +********** 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/a00125_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: layout_right.hh Source File │ │ │ │ +dune-common: debugstream.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,196 +70,337 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
layout_right.hh
│ │ │ │ +
debugstream.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 © 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_LAYOUT_RIGHT_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_LAYOUT_RIGHT_HH
│ │ │ │ -
7
│ │ │ │ -
8#include <array>
│ │ │ │ -
9#include <type_traits>
│ │ │ │ -
10
│ │ │ │ - │ │ │ │ - │ │ │ │ -
13
│ │ │ │ -
14namespace Dune::Std {
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_DEBUGSTREAM_HH
│ │ │ │ +
7#define DUNE_DEBUGSTREAM_HH
│ │ │ │ +
8
│ │ │ │ +
13#include <iostream>
│ │ │ │ +
14#include <stack>
│ │ │ │
15
│ │ │ │ -
17template <class Extents>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
19{
│ │ │ │ -
20 template <class> friend class mapping;
│ │ │ │ -
21
│ │ │ │ -
22public:
│ │ │ │ -
23 using extents_type = Extents;
│ │ │ │ -
24 using size_type = typename extents_type::size_type;
│ │ │ │ -
25 using rank_type = typename extents_type::rank_type;
│ │ │ │ -
26 using index_type = typename extents_type::index_type;
│ │ │ │ - │ │ │ │ -
28
│ │ │ │ -
30 constexpr mapping () noexcept = default;
│ │ │ │ -
31
│ │ │ │ -
33 constexpr mapping (const mapping&) noexcept = default;
│ │ │ │ -
34
│ │ │ │ -
│ │ │ │ -
36 constexpr mapping (const extents_type& e) noexcept
│ │ │ │ -
37 : extents_(e)
│ │ │ │ -
38 {}
│ │ │ │ -
│ │ │ │ -
39
│ │ │ │ -
41 template <class OtherExtents,
│ │ │ │ -
42 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ -
43 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
44 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ -
45 #endif
│ │ │ │ -
│ │ │ │ -
46 constexpr mapping (const mapping<OtherExtents>& m) noexcept
│ │ │ │ -
47 : extents_(m.extents())
│ │ │ │ -
48 {}
│ │ │ │ -
│ │ │ │ -
49
│ │ │ │ -
51 template <class OtherExtents, class E = extents_type,
│ │ │ │ -
52 std::enable_if_t<(E::rank() <= 1), int> = 0,
│ │ │ │ -
53 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ -
54 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
55 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ -
56 #endif
│ │ │ │ -
│ │ │ │ -
57 constexpr mapping (const layout_left::mapping<OtherExtents>& m) noexcept
│ │ │ │ -
58 : extents_(m.extents())
│ │ │ │ -
59 {}
│ │ │ │ -
│ │ │ │ -
60
│ │ │ │ -
62 template <class OtherExtents,
│ │ │ │ -
63 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ -
64 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
65 explicit(extents_type::rank() > 0)
│ │ │ │ -
66 #endif
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
68 : extents_(m.extents())
│ │ │ │ -
69 {
│ │ │ │ -
70#ifndef NDEBUG
│ │ │ │ -
71 if constexpr(extents_type::rank() > 0) {
│ │ │ │ -
72 index_type prod = 1;
│ │ │ │ -
73 for (rank_type r = extents_type::rank()-1; r > 0; --r) {
│ │ │ │ -
74 assert(m.strides(r) == prod);
│ │ │ │ -
75 prod *= m.extents().extent(r);
│ │ │ │ -
76 }
│ │ │ │ -
77 assert(m.strides(0) == prod);
│ │ │ │ -
78 }
│ │ │ │ -
79#endif
│ │ │ │ -
80 }
│ │ │ │ -
│ │ │ │ -
81
│ │ │ │ -
83 constexpr mapping& operator= (const mapping&) noexcept = default;
│ │ │ │ -
84
│ │ │ │ -
85 constexpr const extents_type& extents () const noexcept { return extents_; }
│ │ │ │ -
86 constexpr index_type required_span_size () const noexcept { return extents_.product(); }
│ │ │ │ -
87
│ │ │ │ -
89 template <class... Indices,
│ │ │ │ -
90 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
91 std::enable_if_t<(std::is_convertible_v<Indices, index_type> && ...), int> = 0,
│ │ │ │ -
92 std::enable_if_t<(std::is_nothrow_constructible_v<Indices, index_type> && ...), int> = 0>
│ │ │ │ -
│ │ │ │ -
93 constexpr index_type operator() (Indices... ii) const noexcept
│ │ │ │ -
94 {
│ │ │ │ -
95 const std::array indices{index_type(std::move(ii))...};
│ │ │ │ -
96 index_type value = indices.front();
│ │ │ │ -
97 for (rank_type j = 0; j < extents_type::rank()-1; ++j) {
│ │ │ │ -
98 value = indices[j+1] + extents_.extent(j+1) * value;
│ │ │ │ -
99 }
│ │ │ │ -
100 return value;
│ │ │ │ -
101 }
│ │ │ │ -
│ │ │ │ -
102
│ │ │ │ -
│ │ │ │ -
104 constexpr index_type operator() () const noexcept
│ │ │ │ -
105 {
│ │ │ │ -
106 return 0;
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
109 static constexpr bool is_always_unique () noexcept { return true; }
│ │ │ │ -
110 static constexpr bool is_always_exhaustive () noexcept { return true; }
│ │ │ │ -
111 static constexpr bool is_always_strided () noexcept { return true; }
│ │ │ │ -
112
│ │ │ │ -
113 static constexpr bool is_unique () noexcept { return true; }
│ │ │ │ -
114 static constexpr bool is_exhaustive () noexcept { return true; }
│ │ │ │ -
115 static constexpr bool is_strided () noexcept { return true; }
│ │ │ │ -
116
│ │ │ │ -
118 template <class E = extents_type,
│ │ │ │ -
119 std::enable_if_t<(E::rank() > 0), int> = 0>
│ │ │ │ -
│ │ │ │ -
120 constexpr index_type stride (rank_type i) const noexcept
│ │ │ │ -
121 {
│ │ │ │ -
122 assert(i < extents_type::rank());
│ │ │ │ -
123 index_type prod = 1;
│ │ │ │ -
124 for (rank_type r = i+1; r < extents_type::rank(); ++r)
│ │ │ │ -
125 prod *= extents().extent(r);
│ │ │ │ -
126 return prod;
│ │ │ │ -
127 }
│ │ │ │ -
│ │ │ │ -
128
│ │ │ │ -
129 template <class OtherExtents>
│ │ │ │ + │ │ │ │ +
17
│ │ │ │ +
18namespace Dune {
│ │ │ │ +
19
│ │ │ │ +
118 typedef unsigned int DebugLevel;
│ │ │ │ +
119
│ │ │ │ +
129 template <DebugLevel current, DebugLevel threshold>
│ │ │ │
│ │ │ │ -
130 friend constexpr bool operator== (const mapping& a, const mapping<OtherExtents>& b) noexcept
│ │ │ │ -
131 {
│ │ │ │ -
132 return a.extents_ == b.extents_;
│ │ │ │ -
133 }
│ │ │ │ + │ │ │ │ +
131 constexpr static bool value = (current >= threshold);
│ │ │ │ +
132 };
│ │ │ │
│ │ │ │ +
133
│ │ │ │
134
│ │ │ │ -
135private:
│ │ │ │ -
136 [[no_unique_address]] extents_type extents_;
│ │ │ │ -
137};
│ │ │ │ -
│ │ │ │ -
138
│ │ │ │ -
139} // end namespace Dune::Std
│ │ │ │ -
140
│ │ │ │ -
141#endif // DUNE_COMMON_STD_LAYOUT_RIGHT_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
A layout mapping where the leftmost extent has stride 1.
Definition layout_left.hh:19
│ │ │ │ -
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ -
A layout mapping where the rightmost extent has stride 1.
Definition layout_right.hh:19
│ │ │ │ -
constexpr const extents_type & extents() const noexcept
Definition layout_right.hh:85
│ │ │ │ -
constexpr index_type operator()() const noexcept
The default offset for rank-0 tensors is 0.
Definition layout_right.hh:104
│ │ │ │ -
constexpr mapping & operator=(const mapping &) noexcept=default
Copy-assignment for the mapping.
│ │ │ │ -
constexpr index_type required_span_size() const noexcept
Definition layout_right.hh:86
│ │ │ │ -
constexpr mapping() noexcept=default
The default construction is possible for default constructible extents.
│ │ │ │ -
typename extents_type::size_type size_type
Definition layout_right.hh:24
│ │ │ │ -
Extents extents_type
Definition layout_right.hh:23
│ │ │ │ -
static constexpr bool is_always_unique() noexcept
Definition layout_right.hh:109
│ │ │ │ -
constexpr index_type stride(rank_type i) const noexcept
The stride is the product of the extents E(n)*E(n-1)*...*E(i+1)
Definition layout_right.hh:120
│ │ │ │ -
static constexpr bool is_exhaustive() noexcept
Definition layout_right.hh:114
│ │ │ │ -
constexpr mapping(const layout_left::mapping< OtherExtents > &m) noexcept
Construct the mapping from a layout_left.
Definition layout_right.hh:57
│ │ │ │ -
static constexpr bool is_strided() noexcept
Definition layout_right.hh:115
│ │ │ │ -
typename extents_type::rank_type rank_type
Definition layout_right.hh:25
│ │ │ │ -
static constexpr bool is_always_strided() noexcept
Definition layout_right.hh:111
│ │ │ │ -
static constexpr bool is_unique() noexcept
Definition layout_right.hh:113
│ │ │ │ -
friend constexpr bool operator==(const mapping &a, const mapping< OtherExtents > &b) noexcept
Definition layout_right.hh:130
│ │ │ │ -
static constexpr bool is_always_exhaustive() noexcept
Definition layout_right.hh:110
│ │ │ │ -
typename extents_type::index_type index_type
Definition layout_right.hh:26
│ │ │ │ -
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │ -
constexpr const extents_type & extents() const noexcept
Definition layout_stride.hh:85
│ │ │ │ -
constexpr const strides_type & strides() const noexcept
Get the array of all strides.
Definition layout_stride.hh:127
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,232 +1,375 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -layout_right.hh │ │ │ │ │ +debugstream.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 © 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_LAYOUT_RIGHT_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_LAYOUT_RIGHT_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_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ -13 │ │ │ │ │ -14namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_DEBUGSTREAM_HH │ │ │ │ │ +7#define DUNE_DEBUGSTREAM_HH │ │ │ │ │ +8 │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ 15 │ │ │ │ │ -17template │ │ │ │ │ -_1_8class _l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -19{ │ │ │ │ │ -_2_0 template friend class _m_a_p_p_i_n_g; │ │ │ │ │ -21 │ │ │ │ │ -22public: │ │ │ │ │ -_2_3 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ -_2_4 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ -_2_5 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ -_2_6 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ -_2_7 using _l_a_y_o_u_t___t_y_p_e = _l_a_y_o_u_t___r_i_g_h_t; │ │ │ │ │ -28 │ │ │ │ │ -_3_0 constexpr _m_a_p_p_i_n_g () noexcept = default; │ │ │ │ │ -31 │ │ │ │ │ -_3_3 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ -34 │ │ │ │ │ -_3_6 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e) noexcept │ │ │ │ │ -37 : extents_(e) │ │ │ │ │ -38 {} │ │ │ │ │ -39 │ │ │ │ │ -41 template , int> = │ │ │ │ │ -0> │ │ │ │ │ -43 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -44 explicit(!std::is_convertible_v) │ │ │ │ │ -45 #endif │ │ │ │ │ -_4_6 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ -47 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ -48 {} │ │ │ │ │ -49 │ │ │ │ │ -51 template = 0, │ │ │ │ │ -53 std::enable_if_t, int> = │ │ │ │ │ -0> │ │ │ │ │ -54 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -55 explicit(!std::is_convertible_v) │ │ │ │ │ -56 #endif │ │ │ │ │ -_5_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ -58 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ -59 {} │ │ │ │ │ -60 │ │ │ │ │ -62 template , int> = │ │ │ │ │ -0> │ │ │ │ │ -64 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -65 explicit(extents_type::rank() > 0) │ │ │ │ │ -66 #endif │ │ │ │ │ -_6_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) │ │ │ │ │ -68 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ -69 { │ │ │ │ │ -70#ifndef NDEBUG │ │ │ │ │ -71 if constexpr(extents_type::rank() > 0) { │ │ │ │ │ -72 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ -73 for (_r_a_n_k___t_y_p_e r = extents_type::rank()-1; r > 0; --r) { │ │ │ │ │ -74 assert(m._s_t_r_i_d_e_s(r) == prod); │ │ │ │ │ -75 prod *= m._e_x_t_e_n_t_s().extent(r); │ │ │ │ │ -76 } │ │ │ │ │ -77 assert(m._s_t_r_i_d_e_s(0) == prod); │ │ │ │ │ -78 } │ │ │ │ │ -79#endif │ │ │ │ │ -80 } │ │ │ │ │ -81 │ │ │ │ │ -_8_3 constexpr _m_a_p_p_i_n_g& _o_p_e_r_a_t_o_r_=_ (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ -84 │ │ │ │ │ -_8_5 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return extents_; } │ │ │ │ │ -_8_6 constexpr _i_n_d_e_x___t_y_p_e _r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e () const noexcept { return │ │ │ │ │ -extents_.product(); } │ │ │ │ │ -87 │ │ │ │ │ -89 template = 0, │ │ │ │ │ -91 std::enable_if_t<(std::is_convertible_v && ...), int> = │ │ │ │ │ -0, │ │ │ │ │ -92 std::enable_if_t<(std::is_nothrow_constructible_v && │ │ │ │ │ -...), int> = 0> │ │ │ │ │ -_9_3 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ (Indices... ii) const noexcept │ │ │ │ │ -94 { │ │ │ │ │ -95 const std::array indices{_i_n_d_e_x___t_y_p_e(std::move(ii))...}; │ │ │ │ │ -96 _i_n_d_e_x___t_y_p_e value = indices.front(); │ │ │ │ │ -97 for (_r_a_n_k___t_y_p_e j = 0; j < extents_type::rank()-1; ++j) { │ │ │ │ │ -98 value = indices[j+1] + extents_.extent(j+1) * value; │ │ │ │ │ -99 } │ │ │ │ │ -100 return value; │ │ │ │ │ -101 } │ │ │ │ │ -102 │ │ │ │ │ -_1_0_4 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ () const noexcept │ │ │ │ │ -105 { │ │ │ │ │ -106 return 0; │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -_1_0_9 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ -_1_1_0 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ -_1_1_1 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ -112 │ │ │ │ │ -_1_1_3 static constexpr bool _i_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ -_1_1_4 static constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ -_1_1_5 static constexpr bool _i_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ -116 │ │ │ │ │ -118 template 0), int> = 0> │ │ │ │ │ -_1_2_0 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e i) const noexcept │ │ │ │ │ -121 { │ │ │ │ │ -122 assert(i < extents_type::rank()); │ │ │ │ │ -123 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ -124 for (_r_a_n_k___t_y_p_e r = i+1; r < extents_type::rank(); ++r) │ │ │ │ │ -125 prod *= _e_x_t_e_n_t_s().extent(r); │ │ │ │ │ -126 return prod; │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -129 template │ │ │ │ │ -_1_3_0 friend constexpr bool _o_p_e_r_a_t_o_r_=_=_ (const _m_a_p_p_i_n_g& a, const │ │ │ │ │ -_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& b) noexcept │ │ │ │ │ -131 { │ │ │ │ │ -132 return a.extents_ == b.extents_; │ │ │ │ │ -133 } │ │ │ │ │ +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 { │ │ │ │ │ +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 │ │ │ │ │ -135private: │ │ │ │ │ -136 [[no_unique_address]] _e_x_t_e_n_t_s___t_y_p_e extents_; │ │ │ │ │ -137}; │ │ │ │ │ -138 │ │ │ │ │ -139} // end namespace Dune::Std │ │ │ │ │ -140 │ │ │ │ │ -141#endif // DUNE_COMMON_STD_LAYOUT_RIGHT_HH │ │ │ │ │ -_f_w_d___l_a_y_o_u_t_s_._h_h │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the leftmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ -A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ -to-left as the product o... │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the rightmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr const extents_type & extents() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -constexpr index_type operator()() const noexcept │ │ │ │ │ -The default offset for rank-0 tensors is 0. │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -constexpr mapping & operator=(const mapping &) noexcept=default │ │ │ │ │ -Copy-assignment for the mapping. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e │ │ │ │ │ -constexpr index_type required_span_size() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping() noexcept=default │ │ │ │ │ -The default construction is possible for default constructible extents. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -typename extents_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:24 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ -Extents extents_type │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_always_unique() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:109 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e │ │ │ │ │ -constexpr index_type stride(rank_type i) const noexcept │ │ │ │ │ -The stride is the product of the extents E(n)*E(n-1)*...*E(i+1) │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -static constexpr bool is_exhaustive() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:114 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping(const layout_left::mapping< OtherExtents > &m) noexcept │ │ │ │ │ -Construct the mapping from a layout_left. │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_strided() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ -typename extents_type::rank_type rank_type │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_always_strided() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:111 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_unique() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:113 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -friend constexpr bool operator==(const mapping &a, const mapping< OtherExtents │ │ │ │ │ -> &b) noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:130 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ -typename extents_type::index_type index_type │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the strides are user-defined. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr const extents_type & extents() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e_s │ │ │ │ │ -constexpr const strides_type & strides() const noexcept │ │ │ │ │ -Get the array of all strides. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:127 │ │ │ │ │ +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 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: layout_stride.hh File Reference │ │ │ │ +dune-common: quadmath.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,46 +65,23 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
layout_stride.hh File Reference
│ │ │ │ +
quadmath.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/std/impl/fwd_layouts.hh>
│ │ │ │ -
│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::Std::layout_stride::mapping< Extents >
 A layout mapping where the strides are user-defined. More...
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,27 +1,10 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -layout_stride.hh File Reference │ │ │ │ │ -#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_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ +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_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_<_ _E_x_t_e_n_t_s_ _> │ │ │ │ │ -  A layout mapping where the strides are user-defined. _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. │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: layout_stride.hh Source File │ │ │ │ +dune-common: quadmath.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,256 +70,494 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
layout_stride.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 © 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_LAYOUT_STRIDE_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_LAYOUT_STRIDE_HH
│ │ │ │ +
5#ifndef DUNE_QUADMATH_HH
│ │ │ │ +
6#define DUNE_QUADMATH_HH
│ │ │ │
7
│ │ │ │ -
8#include <array>
│ │ │ │ -
9#include <type_traits>
│ │ │ │ +
8#if HAVE_QUADMATH
│ │ │ │ +
9#include <quadmath.h>
│ │ │ │
10
│ │ │ │ - │ │ │ │ - │ │ │ │ -
13
│ │ │ │ -
14namespace Dune::Std {
│ │ │ │ -
15
│ │ │ │ -
17template <class Extents>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
19{
│ │ │ │ -
20 template <class> friend class mapping;
│ │ │ │ -
21 static constexpr typename Extents::rank_type rank_ = Extents::rank();
│ │ │ │ +
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
│ │ │ │ -
23public:
│ │ │ │ -
24 using extents_type = Extents;
│ │ │ │ -
25 using index_type = typename extents_type::index_type;
│ │ │ │ -
26 using size_type = typename extents_type::size_type;
│ │ │ │ -
27 using rank_type = typename extents_type::rank_type;
│ │ │ │ - │ │ │ │ +
23namespace Dune
│ │ │ │ +
24{
│ │ │ │ +
25 namespace Impl
│ │ │ │ +
26 {
│ │ │ │ +
27 // forward declaration
│ │ │ │ +
28 class Float128;
│ │ │ │
29
│ │ │ │ -
30private:
│ │ │ │ -
31 using strides_type = std::array<index_type,rank_>;
│ │ │ │ -
32
│ │ │ │ -
33public:
│ │ │ │ -
34
│ │ │ │ -
│ │ │ │ -
36 constexpr mapping () noexcept
│ │ │ │ - │ │ │ │ -
38 {}
│ │ │ │ -
│ │ │ │ +
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 constexpr mapping (const mapping&) noexcept = default;
│ │ │ │ -
42
│ │ │ │ -
44 template <class OtherIndexType,
│ │ │ │ -
45 std::enable_if_t<std::is_convertible_v<const OtherIndexType&, index_type>, int> = 0,
│ │ │ │ -
46 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const OtherIndexType&>, int> = 0>
│ │ │ │ -
│ │ │ │ -
47 constexpr mapping (const extents_type& e, const std::array<OtherIndexType,rank_>& s) noexcept
│ │ │ │ -
48 : extents_(e)
│ │ │ │ -
49 , strides_{}
│ │ │ │ -
50 {
│ │ │ │ -
51 for (rank_type r = 0; r < rank_; ++r)
│ │ │ │ -
52 strides_[r] = s[r];
│ │ │ │ -
53 }
│ │ │ │ -
│ │ │ │ -
54
│ │ │ │ -
56 template <class OtherIndexType,
│ │ │ │ -
57 std::enable_if_t<std::is_convertible_v<const OtherIndexType&, index_type>, int> = 0,
│ │ │ │ -
58 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const OtherIndexType&>, int> = 0>
│ │ │ │ -
│ │ │ │ -
59 constexpr mapping (const extents_type& e, const span<OtherIndexType,rank_>& s) noexcept
│ │ │ │ -
60 : extents_(e)
│ │ │ │ -
61 , strides_{}
│ │ │ │ -
62 {
│ │ │ │ -
63 for (rank_type r = 0; r < rank_; ++r)
│ │ │ │ -
64 strides_[r] = s[r];
│ │ │ │ -
65 }
│ │ │ │ -
│ │ │ │ -
66
│ │ │ │ -
68 template <class M,
│ │ │ │ -
69 std::enable_if_t<(M::extents_type::rank() == extents_type::rank()), int> = 0,
│ │ │ │ -
70 std::enable_if_t<(M::is_always_unique()), int> = 0,
│ │ │ │ -
71 std::enable_if_t<(M::is_always_strided()), int> = 0,
│ │ │ │ -
72 decltype(std::declval<M>().extents(), bool{}) = true,
│ │ │ │ -
73 decltype(std::declval<M>().stride(std::declval<rank_type>()), bool{}) = true>
│ │ │ │ -
│ │ │ │ -
74 constexpr mapping (const M& m) noexcept
│ │ │ │ -
75 : extents_(m.extents())
│ │ │ │ -
76 , strides_{}
│ │ │ │ -
77 {
│ │ │ │ -
78 for (rank_type r = 0; r < rank_; ++r)
│ │ │ │ -
79 strides_[r] = m.stride(r);
│ │ │ │ -
80 }
│ │ │ │ -
│ │ │ │ -
81
│ │ │ │ -
83 constexpr mapping& operator= (const mapping&) noexcept = default;
│ │ │ │ -
84
│ │ │ │ -
85 constexpr const extents_type& extents () const noexcept { return extents_; }
│ │ │ │ -
86
│ │ │ │ -
│ │ │ │ -
88 constexpr index_type required_span_size () const noexcept
│ │ │ │ -
89 {
│ │ │ │ -
90 return size(extents_,strides_);
│ │ │ │ -
91 }
│ │ │ │ -
│ │ │ │ -
92
│ │ │ │ -
94 template <class... Indices,
│ │ │ │ -
95 std::enable_if_t<(sizeof...(Indices) == rank_), int> = 0,
│ │ │ │ -
96 std::enable_if_t<(std::is_convertible_v<Indices, index_type> && ...), int> = 0,
│ │ │ │ -
97 std::enable_if_t<(std::is_nothrow_constructible_v<index_type, Indices> && ...), int> = 0>
│ │ │ │ -
│ │ │ │ -
98 constexpr index_type operator() (Indices... ii) const noexcept
│ │ │ │ -
99 {
│ │ │ │ -
100 return unpackIntegerSequence([&](auto... r) {
│ │ │ │ -
101 return ((static_cast<index_type>(ii)*strides_[r]) + ... + 0); },
│ │ │ │ -
102 std::make_index_sequence<rank_>{});
│ │ │ │ -
103 }
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ -
106 constexpr index_type operator() () const noexcept
│ │ │ │ -
107 {
│ │ │ │ -
108 return 0;
│ │ │ │ -
109 }
│ │ │ │ -
│ │ │ │ -
110
│ │ │ │ -
111 static constexpr bool is_always_unique () noexcept { return true; }
│ │ │ │ -
112 static constexpr bool is_always_exhaustive () noexcept { return false; }
│ │ │ │ -
113 static constexpr bool is_always_strided () noexcept { return true; }
│ │ │ │ -
114
│ │ │ │ -
115 static constexpr bool is_unique () noexcept { return true; }
│ │ │ │ -
116 static constexpr bool is_strided () noexcept { return true; }
│ │ │ │ +
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 constexpr bool is_exhaustive () const noexcept
│ │ │ │ -
119 {
│ │ │ │ -
120 // Actually this could be improved. A strided layout can still be exhaustive.
│ │ │ │ -
121 // This test is more complicated to implement, though. See §24.7.3.4.7.4 line (5.2)
│ │ │ │ -
122 // in the C++ standard document N4971
│ │ │ │ -
123 return extents_type::rank() == 0 || (required_span_size() > 0 && required_span_size() == extents().product());
│ │ │ │ -
124 }
│ │ │ │ -
│ │ │ │ +
118 DUNE_ASSIGN_OP(+=);
│ │ │ │ +
119 DUNE_ASSIGN_OP(-=);
│ │ │ │ +
120
│ │ │ │ +
121 DUNE_ASSIGN_OP(*=);
│ │ │ │ +
122 DUNE_ASSIGN_OP(/=);
│ │ │ │ +
123
│ │ │ │ +
124#undef DUNE_ASSIGN_OP
│ │ │ │
125
│ │ │ │ -
│ │ │ │ -
127 constexpr const strides_type& strides () const noexcept
│ │ │ │ -
128 {
│ │ │ │ -
129 return strides_;
│ │ │ │ -
130 }
│ │ │ │ -
│ │ │ │ -
131
│ │ │ │ -
133 template <class E = extents_type,
│ │ │ │ -
134 std::enable_if_t<(E::rank() > 0), int> = 0>
│ │ │ │ -
│ │ │ │ -
135 constexpr index_type stride (rank_type i) const noexcept
│ │ │ │ -
136 {
│ │ │ │ -
137 return strides_[i];
│ │ │ │ -
138 }
│ │ │ │ -
│ │ │ │ -
139
│ │ │ │ -
140 template <class OtherMapping,
│ │ │ │ -
141 std::enable_if_t<(OtherMapping::extents_type::rank() == extents_type::rank()), int> = 0,
│ │ │ │ -
142 std::enable_if_t<(OtherMapping::is_always_strided()), int> = 0>
│ │ │ │ -
│ │ │ │ -
143 friend constexpr bool operator== (const mapping& a, const OtherMapping& b) noexcept
│ │ │ │ -
144 {
│ │ │ │ -
145 if (offset(b))
│ │ │ │ -
146 return false;
│ │ │ │ -
147 if constexpr(extents_type::rank() == 0)
│ │ │ │ -
148 return true;
│ │ │ │ -
149 return a.extents_ == b.extents_ && a.strides_ == b.strides_;
│ │ │ │ -
150 }
│ │ │ │ -
│ │ │ │ -
151
│ │ │ │ -
152private:
│ │ │ │ -
153 template <class E, class S>
│ │ │ │ -
154 static constexpr index_type size (const E& extents, const S& strides) noexcept
│ │ │ │ -
155 {
│ │ │ │ -
156 if constexpr (E::rank() == 0)
│ │ │ │ -
157 return 1;
│ │ │ │ -
158 else {
│ │ │ │ -
159 if (extents.product() == 0)
│ │ │ │ -
160 return 0;
│ │ │ │ -
161 else {
│ │ │ │ -
162 index_type result = 1;
│ │ │ │ -
163 for (rank_type r = 0; r < E::rank(); ++r)
│ │ │ │ -
164 result += (extents.extent(r)-1) * strides[r];
│ │ │ │ -
165 return result;
│ │ │ │ -
166 }
│ │ │ │ -
167 }
│ │ │ │ -
168 }
│ │ │ │ +
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 template <class M>
│ │ │ │ -
171 static constexpr size_type offset (const M& m) noexcept
│ │ │ │ -
172 {
│ │ │ │ -
173 if constexpr (M::extents_type::rank() == 0)
│ │ │ │ -
174 return m();
│ │ │ │ -
175 else {
│ │ │ │ -
176 if (m.required_span_size() == 0)
│ │ │ │ -
177 return 0;
│ │ │ │ -
178 else {
│ │ │ │ -
179 return unpackIntegerSequence([&](auto... r) {
│ │ │ │ -
180 return m((r,0)...); }, // map the index tuple (0,0...)
│ │ │ │ -
181 std::make_index_sequence<M::extents_type::rank()>{});
│ │ │ │ -
182 }
│ │ │ │ -
183 }
│ │ │ │ -
184 }
│ │ │ │ -
185
│ │ │ │ -
186private:
│ │ │ │ -
187 [[no_unique_address]] extents_type extents_;
│ │ │ │ -
188 strides_type strides_;
│ │ │ │ -
189};
│ │ │ │ -
│ │ │ │ -
190
│ │ │ │ -
191} // end namespace Dune::Std
│ │ │ │ -
192
│ │ │ │ -
193#endif // DUNE_COMMON_STD_LAYOUT_STRIDE_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ -
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:124
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
Multidimensional index space with dynamic and static extents.
Definition extents.hh:54
│ │ │ │ -
constexpr index_type extent(rank_type r) const noexcept
Return the extent of dimension i
Definition extents.hh:100
│ │ │ │ -
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ -
A layout mapping where the strides are user-defined.
Definition fwd_layouts.hh:40
│ │ │ │ -
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │ -
constexpr mapping(const extents_type &e, const span< OtherIndexType, rank_ > &s) noexcept
Construct the mapping from given extents and strides.
Definition layout_stride.hh:59
│ │ │ │ -
Extents extents_type
Definition layout_stride.hh:24
│ │ │ │ -
constexpr mapping & operator=(const mapping &) noexcept=default
Copy-assignment for the mapping.
│ │ │ │ -
constexpr bool is_exhaustive() const noexcept
Definition layout_stride.hh:118
│ │ │ │ -
constexpr mapping() noexcept
The default construction initializes the strides from layout_right.
Definition layout_stride.hh:36
│ │ │ │ -
constexpr mapping(const extents_type &e, const std::array< OtherIndexType, rank_ > &s) noexcept
Construct the mapping from given extents and strides.
Definition layout_stride.hh:47
│ │ │ │ -
constexpr index_type stride(rank_type i) const noexcept
Get the single stride i
Definition layout_stride.hh:135
│ │ │ │ -
typename extents_type::index_type index_type
Definition layout_stride.hh:25
│ │ │ │ -
static constexpr bool is_always_exhaustive() noexcept
Definition layout_stride.hh:112
│ │ │ │ -
constexpr const extents_type & extents() const noexcept
Definition layout_stride.hh:85
│ │ │ │ -
static constexpr bool is_strided() noexcept
Definition layout_stride.hh:116
│ │ │ │ -
static constexpr bool is_always_strided() noexcept
Definition layout_stride.hh:113
│ │ │ │ -
constexpr index_type required_span_size() const noexcept
Return the sum 1 + (E(0)-1)*S(0) + (E(1)-1)*S(1) + ...
Definition layout_stride.hh:88
│ │ │ │ -
constexpr const strides_type & strides() const noexcept
Get the array of all strides.
Definition layout_stride.hh:127
│ │ │ │ -
constexpr mapping(const mapping &) noexcept=default
Copy constructor for the mapping.
│ │ │ │ -
typename extents_type::rank_type rank_type
Definition layout_stride.hh:27
│ │ │ │ -
static constexpr bool is_unique() noexcept
Definition layout_stride.hh:115
│ │ │ │ -
constexpr index_type operator()() const noexcept
The default offset for rank-0 tensors is 0.
Definition layout_stride.hh:106
│ │ │ │ -
typename extents_type::size_type size_type
Definition layout_stride.hh:26
│ │ │ │ -
static constexpr bool is_always_unique() noexcept
Definition layout_stride.hh:111
│ │ │ │ -
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │ +
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
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
#define DUNE_BINARY_OP(OP)
Definition debugalign.hh:261
│ │ │ │ +
#define DUNE_UNARY_FUNC(name)
│ │ │ │ +
#define DUNE_ASSIGN_OP(OP)
Definition debugalign.hh:220
│ │ │ │ +
Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
Read a std::tuple.
Definition streamoperators.hh:43
│ │ │ │ +
constexpr auto max
Function object that returns the greater of the given values.
Definition hybridutilities.hh:484
│ │ │ │ +
constexpr auto min
Function object that returns the smaller of the given values.
Definition hybridutilities.hh:506
│ │ │ │ +
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:494
│ │ │ │ +
T min_value(const AlignedNumber< T, align > &val)
Definition debugalign.hh:500
│ │ │ │ +
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,308 +1,527 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -layout_stride.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 © 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_LAYOUT_STRIDE_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_LAYOUT_STRIDE_HH │ │ │ │ │ +5#ifndef DUNE_QUADMATH_HH │ │ │ │ │ +6#define DUNE_QUADMATH_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ +8#if HAVE_QUADMATH │ │ │ │ │ +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_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ -13 │ │ │ │ │ -14namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ -15 │ │ │ │ │ -17template │ │ │ │ │ -_1_8class _l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ -19{ │ │ │ │ │ -_2_0 template friend class _m_a_p_p_i_n_g; │ │ │ │ │ -21 static constexpr typename Extents::rank_type rank_ = Extents::rank(); │ │ │ │ │ +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 │ │ │ │ │ -23public: │ │ │ │ │ -_2_4 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ -_2_5 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ -_2_6 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ -_2_7 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ -_2_8 using _l_a_y_o_u_t___t_y_p_e = _l_a_y_o_u_t___s_t_r_i_d_e; │ │ │ │ │ +23namespace _D_u_n_e │ │ │ │ │ +24{ │ │ │ │ │ +25 namespace Impl │ │ │ │ │ +26 { │ │ │ │ │ +27 // forward declaration │ │ │ │ │ +28 class Float128; │ │ │ │ │ 29 │ │ │ │ │ -30private: │ │ │ │ │ -31 using strides_type = std::array; │ │ │ │ │ -32 │ │ │ │ │ -33public: │ │ │ │ │ -34 │ │ │ │ │ -_3_6 constexpr _m_a_p_p_i_n_g () noexcept │ │ │ │ │ -37 : _m_a_p_p_i_n_g(_l_a_y_o_u_t___r_i_g_h_t::template _m_a_p_p_i_n_g<_e_x_t_e_n_t_s___t_y_p_e>{}) │ │ │ │ │ -38 {} │ │ │ │ │ +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 │ │ │ │ │ -_4_1 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ -42 │ │ │ │ │ -44 template , │ │ │ │ │ -int> = 0, │ │ │ │ │ -46 std::enable_if_t, int> = 0> │ │ │ │ │ -_4_7 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e, const std:: │ │ │ │ │ -array& s) noexcept │ │ │ │ │ -48 : extents_(e) │ │ │ │ │ -49 , strides_{} │ │ │ │ │ -50 { │ │ │ │ │ -51 for (_r_a_n_k___t_y_p_e r = 0; r < rank_; ++r) │ │ │ │ │ -52 strides_[r] = s[r]; │ │ │ │ │ -53 } │ │ │ │ │ -54 │ │ │ │ │ -56 template , │ │ │ │ │ -int> = 0, │ │ │ │ │ -58 std::enable_if_t, int> = 0> │ │ │ │ │ -_5_9 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e, const _s_p_a_n_<_O_t_h_e_r_I_n_d_e_x_T_y_p_e_,_r_a_n_k___>& │ │ │ │ │ -s) noexcept │ │ │ │ │ -60 : extents_(e) │ │ │ │ │ -61 , strides_{} │ │ │ │ │ -62 { │ │ │ │ │ -63 for (_r_a_n_k___t_y_p_e r = 0; r < rank_; ++r) │ │ │ │ │ -64 strides_[r] = s[r]; │ │ │ │ │ -65 } │ │ │ │ │ -66 │ │ │ │ │ -68 template = │ │ │ │ │ -0, │ │ │ │ │ -70 std::enable_if_t<(M::is_always_unique()), int> = 0, │ │ │ │ │ -71 std::enable_if_t<(M::is_always_strided()), int> = 0, │ │ │ │ │ -72 decltype(std::declval().extents(), bool{}) = true, │ │ │ │ │ -73 decltype(std::declval().stride(std::declval()), bool{}) = │ │ │ │ │ -true> │ │ │ │ │ -_7_4 constexpr _m_a_p_p_i_n_g (const M& m) noexcept │ │ │ │ │ -75 : extents_(m.extents()) │ │ │ │ │ -76 , strides_{} │ │ │ │ │ -77 { │ │ │ │ │ -78 for (_r_a_n_k___t_y_p_e r = 0; r < rank_; ++r) │ │ │ │ │ -79 strides_[r] = m._s_t_r_i_d_e(r); │ │ │ │ │ -80 } │ │ │ │ │ -81 │ │ │ │ │ -_8_3 constexpr _m_a_p_p_i_n_g& _o_p_e_r_a_t_o_r_=_ (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ -84 │ │ │ │ │ -_8_5 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return extents_; } │ │ │ │ │ -86 │ │ │ │ │ -_8_8 constexpr _i_n_d_e_x___t_y_p_e _r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e () const noexcept │ │ │ │ │ -89 { │ │ │ │ │ -90 return size(extents_,strides_); │ │ │ │ │ -91 } │ │ │ │ │ -92 │ │ │ │ │ -94 template = 0, │ │ │ │ │ -96 std::enable_if_t<(std::is_convertible_v && ...), int> = │ │ │ │ │ -0, │ │ │ │ │ -97 std::enable_if_t<(std::is_nothrow_constructible_v && │ │ │ │ │ -...), int> = 0> │ │ │ │ │ -_9_8 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ (Indices... ii) const noexcept │ │ │ │ │ -99 { │ │ │ │ │ -100 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... r) { │ │ │ │ │ -101 return ((static_cast<_i_n_d_e_x___t_y_p_e>(ii)*strides_[r]) + ... + 0); }, │ │ │ │ │ -102 std::make_index_sequence{}); │ │ │ │ │ -103 } │ │ │ │ │ +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 │ │ │ │ │ -_1_0_6 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ () const noexcept │ │ │ │ │ -107 { │ │ │ │ │ -108 return 0; │ │ │ │ │ -109 } │ │ │ │ │ -110 │ │ │ │ │ -_1_1_1 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ -_1_1_2 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return false; } │ │ │ │ │ -_1_1_3 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ -114 │ │ │ │ │ -_1_1_5 static constexpr bool _i_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ -_1_1_6 static constexpr bool _i_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ +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 │ │ │ │ │ -_1_1_8 constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () const noexcept │ │ │ │ │ -119 { │ │ │ │ │ -120 // Actually this could be improved. A strided layout can still be │ │ │ │ │ -exhaustive. │ │ │ │ │ -121 // This test is more complicated to implement, though. See §24.7.3.4.7.4 │ │ │ │ │ -line (5.2) │ │ │ │ │ -122 // in the C++ standard document N4971 │ │ │ │ │ -123 return extents_type::rank() == 0 || (_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e() > 0 && │ │ │ │ │ -_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e() == _e_x_t_e_n_t_s().product()); │ │ │ │ │ -124 } │ │ │ │ │ +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 │ │ │ │ │ -_1_2_7 constexpr const strides_type& _s_t_r_i_d_e_s () const noexcept │ │ │ │ │ -128 { │ │ │ │ │ -129 return strides_; │ │ │ │ │ -130 } │ │ │ │ │ -131 │ │ │ │ │ -133 template 0), int> = 0> │ │ │ │ │ -_1_3_5 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e i) const noexcept │ │ │ │ │ -136 { │ │ │ │ │ -137 return strides_[i]; │ │ │ │ │ -138 } │ │ │ │ │ -139 │ │ │ │ │ -140 template = 0, │ │ │ │ │ -142 std::enable_if_t<(OtherMapping::is_always_strided()), int> = 0> │ │ │ │ │ -_1_4_3 friend constexpr bool operator== (const _m_a_p_p_i_n_g& a, const OtherMapping& b) │ │ │ │ │ -noexcept │ │ │ │ │ -144 { │ │ │ │ │ -145 if (offset(b)) │ │ │ │ │ -146 return false; │ │ │ │ │ -147 if constexpr(extents_type::rank() == 0) │ │ │ │ │ -148 return true; │ │ │ │ │ -149 return a.extents_ == b.extents_ && a.strides_ == b.strides_; │ │ │ │ │ -150 } │ │ │ │ │ -151 │ │ │ │ │ -152private: │ │ │ │ │ -153 template │ │ │ │ │ -154 static constexpr _i_n_d_e_x___t_y_p_e size (const E& _e_x_t_e_n_t_s, const S& _s_t_r_i_d_e_s) │ │ │ │ │ -noexcept │ │ │ │ │ -155 { │ │ │ │ │ -156 if constexpr (E::rank() == 0) │ │ │ │ │ -157 return 1; │ │ │ │ │ -158 else { │ │ │ │ │ -159 if (_e_x_t_e_n_t_s.product() == 0) │ │ │ │ │ -160 return 0; │ │ │ │ │ -161 else { │ │ │ │ │ -162 _i_n_d_e_x___t_y_p_e result = 1; │ │ │ │ │ -163 for (_r_a_n_k___t_y_p_e r = 0; r < E::rank(); ++r) │ │ │ │ │ -164 result += (_e_x_t_e_n_t_s._e_x_t_e_n_t(r)-1) * _s_t_r_i_d_e_s[r]; │ │ │ │ │ -165 return result; │ │ │ │ │ -166 } │ │ │ │ │ -167 } │ │ │ │ │ -168 } │ │ │ │ │ +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 template │ │ │ │ │ -171 static constexpr _s_i_z_e___t_y_p_e offset (const M& m) noexcept │ │ │ │ │ -172 { │ │ │ │ │ -173 if constexpr (M::extents_type::rank() == 0) │ │ │ │ │ -174 return m(); │ │ │ │ │ -175 else { │ │ │ │ │ -176 if (m.required_span_size() == 0) │ │ │ │ │ -177 return 0; │ │ │ │ │ -178 else { │ │ │ │ │ -179 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... r) { │ │ │ │ │ -180 return m((r,0)...); }, // map the index tuple (0,0...) │ │ │ │ │ -181 std::make_index_sequence{}); │ │ │ │ │ -182 } │ │ │ │ │ -183 } │ │ │ │ │ -184 } │ │ │ │ │ -185 │ │ │ │ │ -186private: │ │ │ │ │ -187 [[no_unique_address]] _e_x_t_e_n_t_s___t_y_p_e extents_; │ │ │ │ │ -188 strides_type strides_; │ │ │ │ │ -189}; │ │ │ │ │ -190 │ │ │ │ │ -191} // end namespace Dune::Std │ │ │ │ │ -192 │ │ │ │ │ -193#endif // DUNE_COMMON_STD_LAYOUT_STRIDE_HH │ │ │ │ │ -_f_w_d___l_a_y_o_u_t_s_._h_h │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_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:124 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s │ │ │ │ │ -Multidimensional index space with dynamic and static extents. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_e_x_t_e_n_t │ │ │ │ │ -constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ -Return the extent of dimension i │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ -A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ -to-left as the product o... │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ -A layout mapping where the strides are user-defined. │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the strides are user-defined. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping(const extents_type &e, const span< OtherIndexType, rank_ > │ │ │ │ │ -&s) noexcept │ │ │ │ │ -Construct the mapping from given extents and strides. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ -Extents extents_type │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:24 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -constexpr mapping & operator=(const mapping &) noexcept=default │ │ │ │ │ -Copy-assignment for the mapping. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -constexpr bool is_exhaustive() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping() noexcept │ │ │ │ │ -The default construction initializes the strides from layout_right. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping(const extents_type &e, const std::array< OtherIndexType, │ │ │ │ │ -rank_ > &s) noexcept │ │ │ │ │ -Construct the mapping from given extents and strides. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e │ │ │ │ │ -constexpr index_type stride(rank_type i) const noexcept │ │ │ │ │ -Get the single stride i │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:135 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ -typename extents_type::index_type index_type │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr const extents_type & extents() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_strided() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_always_strided() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:113 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e │ │ │ │ │ -constexpr index_type required_span_size() const noexcept │ │ │ │ │ -Return the sum 1 + (E(0)-1)*S(0) + (E(1)-1)*S(1) + ... │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:88 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e_s │ │ │ │ │ -constexpr const strides_type & strides() const noexcept │ │ │ │ │ -Get the array of all strides. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:127 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping(const mapping &) noexcept=default │ │ │ │ │ -Copy constructor for the mapping. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ -typename extents_type::rank_type rank_type │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_unique() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -constexpr index_type operator()() const noexcept │ │ │ │ │ -The default offset for rank-0 tensors is 0. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -typename extents_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_always_unique() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:111 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ -A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ +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 │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_t_y_p_e_t_r_a_i_t_s_._h_h │ │ │ │ │ +Traits for type conversions and type information. │ │ │ │ │ +_D_U_N_E___B_I_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_BINARY_OP(OP) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:261 │ │ │ │ │ +_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:220 │ │ │ │ │ +_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_:_:_H_y_b_r_i_d_:_:_m_a_x │ │ │ │ │ +constexpr auto max │ │ │ │ │ +Function object that returns the greater of the given values. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:484 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_m_i_n │ │ │ │ │ +constexpr auto min │ │ │ │ │ +Function object that returns the smaller of the given values. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:506 │ │ │ │ │ +_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:494 │ │ │ │ │ +_D_u_n_e_:_:_m_i_n___v_a_l_u_e │ │ │ │ │ +T min_value(const AlignedNumber< T, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:500 │ │ │ │ │ +_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/a00131.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: layout_left.hh File Reference │ │ │ │ +dune-common: version.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,46 +65,680 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
layout_left.hh File Reference
│ │ │ │ +Macros
│ │ │ │ +
version.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/std/impl/fwd_layouts.hh>
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#include <dune-common-config.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::Std::layout_left::mapping< Extents >
 A layout mapping where the leftmost extent has stride 1. More...
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Namespaces

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

│ │ │ │ +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_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_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:30
│ │ │ │ +
│ │ │ │ +

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

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.

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,27 +1,306 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -layout_left.hh File Reference │ │ │ │ │ -#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_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ +_M_a_c_r_o_s │ │ │ │ │ +version.hh File Reference │ │ │ │ │ +Various macros to work with Dune module version numbers. _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_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_<_ _E_x_t_e_n_t_s_ _> │ │ │ │ │ -  A layout mapping where the leftmost extent has stride 1. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -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. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_S_t_d │ │ │ │ │ -  Namespace for features backported from new C++ standards. │ │ │ │ │ +#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___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___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:30 │ │ │ │ │ +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:46 │ │ │ │ │ +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. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: layout_left.hh Source File │ │ │ │ +dune-common: version.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,197 +70,103 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
layout_left.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 © 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_LAYOUT_LEFT_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_LAYOUT_LEFT_HH
│ │ │ │ +
5#ifndef DUNE_VERSION_HH
│ │ │ │ +
6#define DUNE_VERSION_HH
│ │ │ │
7
│ │ │ │ -
8#include <array>
│ │ │ │ -
9#include <type_traits>
│ │ │ │ -
10
│ │ │ │ - │ │ │ │ - │ │ │ │ -
13
│ │ │ │ -
14namespace Dune::Std {
│ │ │ │ -
15
│ │ │ │ -
17template <class Extents>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
19{
│ │ │ │ -
20 template <class> friend class mapping;
│ │ │ │ -
21
│ │ │ │ -
22public:
│ │ │ │ -
23 using extents_type = Extents;
│ │ │ │ -
24 using size_type = typename extents_type::size_type;
│ │ │ │ -
25 using rank_type = typename extents_type::rank_type;
│ │ │ │ -
26 using index_type = typename extents_type::index_type;
│ │ │ │ - │ │ │ │ -
28
│ │ │ │ -
30 constexpr mapping () noexcept = default;
│ │ │ │ +
8#include <dune-common-config.hh> // DUNE_[MODULE]_VERSION_[TYPE]
│ │ │ │ +
9
│ │ │ │ +
30#define DUNE_VERSION_JOIN(module,type) module ## _VERSION_ ## type
│ │ │ │
31
│ │ │ │ -
33 constexpr mapping (const mapping&) noexcept = default;
│ │ │ │ -
34
│ │ │ │ -
│ │ │ │ -
36 constexpr mapping (const extents_type& e) noexcept
│ │ │ │ -
37 : extents_(e)
│ │ │ │ -
38 {}
│ │ │ │ -
│ │ │ │ -
39
│ │ │ │ -
41 template <class OtherExtents,
│ │ │ │ -
42 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ -
43 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
44 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ -
45 #endif
│ │ │ │ -
│ │ │ │ -
46 constexpr mapping (const mapping<OtherExtents>& m) noexcept
│ │ │ │ -
47 : extents_(m.extents())
│ │ │ │ -
48 {}
│ │ │ │ +
│ │ │ │ +
46#define DUNE_VERSION_EQUAL(module,major,minor) \
│ │ │ │ +
47 ((DUNE_VERSION_JOIN(module,MAJOR) == major) && \
│ │ │ │ +
48 (DUNE_VERSION_JOIN(module,MINOR) == minor))
│ │ │ │
│ │ │ │
49
│ │ │ │ -
51 template <class OtherExtents, class E = extents_type,
│ │ │ │ -
52 std::enable_if_t<(E::rank() <= 1), int> = 0,
│ │ │ │ -
53 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ -
54 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
55 explicit(!std::is_convertible_v<OtherExtents, extents_type>)
│ │ │ │ -
56 #endif
│ │ │ │ -
│ │ │ │ -
57 constexpr mapping (const layout_right::mapping<OtherExtents>& m) noexcept
│ │ │ │ -
58 : extents_(m.extents())
│ │ │ │ -
59 {}
│ │ │ │ -
│ │ │ │ -
60
│ │ │ │ -
62 template <class OtherExtents,
│ │ │ │ -
63 std::enable_if_t<std::is_constructible_v<extents_type, OtherExtents>, int> = 0>
│ │ │ │ -
64 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
65 explicit(extents_type::rank() > 0)
│ │ │ │ -
66 #endif
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
68 : extents_(m.extents())
│ │ │ │ -
69 {
│ │ │ │ -
70#ifndef NDEBUG
│ │ │ │ -
71 if constexpr(extents_type::rank() > 0) {
│ │ │ │ -
72 index_type prod = 1;
│ │ │ │ -
73 for (rank_type r = 0; r < extents_type::rank()-1; ++r) {
│ │ │ │ -
74 assert(m.strides(r) == prod);
│ │ │ │ -
75 prod *= m.extents().extent(r);
│ │ │ │ -
76 }
│ │ │ │ -
77 assert(m.strides(extents_type::rank()-1) == prod);
│ │ │ │ -
78 }
│ │ │ │ -
79#endif
│ │ │ │ -
80 }
│ │ │ │ -
│ │ │ │ -
81
│ │ │ │ -
83 constexpr mapping& operator= (const mapping&) noexcept = default;
│ │ │ │ -
84
│ │ │ │ -
85 constexpr const extents_type& extents () const noexcept { return extents_; }
│ │ │ │ -
86 constexpr index_type required_span_size () const noexcept { return extents_.product(); }
│ │ │ │ -
87
│ │ │ │ -
89 template <class... Indices,
│ │ │ │ -
90 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
91 std::enable_if_t<(... && std::is_convertible_v<Indices, index_type>), int> = 0,
│ │ │ │ -
92 std::enable_if_t<(... && std::is_nothrow_constructible_v<Indices, index_type>), int> = 0>
│ │ │ │ -
│ │ │ │ -
93 constexpr index_type operator() (Indices... ii) const noexcept
│ │ │ │ -
94 {
│ │ │ │ -
95 const std::array indices{index_type(std::move(ii))...};
│ │ │ │ -
96 index_type value = indices.back();
│ │ │ │ -
97 for (rank_type r = 1; r < extents_type::rank(); ++r) {
│ │ │ │ -
98 const rank_type j = extents_type::rank()-r;
│ │ │ │ -
99 value = indices[j-1] + extents_.extent(j-1) * value;
│ │ │ │ -
100 }
│ │ │ │ -
101 return value;
│ │ │ │ -
102 }
│ │ │ │ -
│ │ │ │ -
103
│ │ │ │ -
│ │ │ │ -
105 constexpr index_type operator() () const noexcept
│ │ │ │ -
106 {
│ │ │ │ -
107 return 0;
│ │ │ │ -
108 }
│ │ │ │ -
│ │ │ │ -
109
│ │ │ │ -
110 static constexpr bool is_always_unique () noexcept { return true; }
│ │ │ │ -
111 static constexpr bool is_always_exhaustive () noexcept { return true; }
│ │ │ │ -
112 static constexpr bool is_always_strided () noexcept { return true; }
│ │ │ │ -
113
│ │ │ │ -
114 static constexpr bool is_unique () noexcept { return true; }
│ │ │ │ -
115 static constexpr bool is_exhaustive () noexcept { return true; }
│ │ │ │ -
116 static constexpr bool is_strided () noexcept { return true; }
│ │ │ │ -
117
│ │ │ │ -
119 template <class E = extents_type,
│ │ │ │ -
120 std::enable_if_t<(E::rank() > 0), int> = 0>
│ │ │ │ -
│ │ │ │ -
121 constexpr index_type stride (rank_type i) const noexcept
│ │ │ │ -
122 {
│ │ │ │ -
123 assert(i < extents_type::rank());
│ │ │ │ -
124 index_type prod = 1;
│ │ │ │ -
125 for (rank_type r = 0; r < i; ++r)
│ │ │ │ -
126 prod *= extents().extent(r);
│ │ │ │ -
127 return prod;
│ │ │ │ -
128 }
│ │ │ │ -
│ │ │ │ -
129
│ │ │ │ -
130 template <class OtherExtents,
│ │ │ │ -
131 std::enable_if_t<(Extents::rank() == OtherExtents::rank()), int> = 0>
│ │ │ │ -
│ │ │ │ -
132 friend constexpr bool operator== (const mapping& a, const mapping<OtherExtents>& b) noexcept
│ │ │ │ -
133 {
│ │ │ │ -
134 return a.extents_ == b.extents_;
│ │ │ │ -
135 }
│ │ │ │ -
│ │ │ │ -
136
│ │ │ │ -
137private:
│ │ │ │ -
138 [[no_unique_address]] extents_type extents_;
│ │ │ │ -
139};
│ │ │ │ -
│ │ │ │ -
140
│ │ │ │ -
141} // end namespace Dune::Std
│ │ │ │ -
142
│ │ │ │ -
143#endif // DUNE_COMMON_STD_LAYOUT_LEFT_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
A layout where the leftmost extent has stride 1.
Definition fwd_layouts.hh:17
│ │ │ │ -
A layout mapping where the leftmost extent has stride 1.
Definition layout_left.hh:19
│ │ │ │ -
constexpr index_type stride(rank_type i) const noexcept
The stride is the product of the extents E(0)*E(1)*...*E(i-1)
Definition layout_left.hh:121
│ │ │ │ -
typename extents_type::index_type index_type
Definition layout_left.hh:26
│ │ │ │ -
constexpr index_type required_span_size() const noexcept
Definition layout_left.hh:86
│ │ │ │ -
constexpr mapping & operator=(const mapping &) noexcept=default
Copy-assignment for the mapping.
│ │ │ │ -
Extents extents_type
Definition layout_left.hh:23
│ │ │ │ -
static constexpr bool is_always_unique() noexcept
Definition layout_left.hh:110
│ │ │ │ -
constexpr mapping() noexcept=default
The default construction is possible for default constructible extents.
│ │ │ │ -
static constexpr bool is_strided() noexcept
Definition layout_left.hh:116
│ │ │ │ -
static constexpr bool is_always_strided() noexcept
Definition layout_left.hh:112
│ │ │ │ -
constexpr index_type operator()() const noexcept
The default offset for rank-0 tensors is 0.
Definition layout_left.hh:105
│ │ │ │ -
typename extents_type::size_type size_type
Definition layout_left.hh:24
│ │ │ │ -
static constexpr bool is_unique() noexcept
Definition layout_left.hh:114
│ │ │ │ -
constexpr mapping(const layout_right::mapping< OtherExtents > &m) noexcept
Construct the mapping from a layout_right.
Definition layout_left.hh:57
│ │ │ │ -
constexpr const extents_type & extents() const noexcept
Definition layout_left.hh:85
│ │ │ │ -
static constexpr bool is_always_exhaustive() noexcept
Definition layout_left.hh:111
│ │ │ │ -
typename extents_type::rank_type rank_type
Definition layout_left.hh:25
│ │ │ │ -
static constexpr bool is_exhaustive() noexcept
Definition layout_left.hh:115
│ │ │ │ -
A layout mapping where the rightmost extent has stride 1.
Definition layout_right.hh:19
│ │ │ │ -
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │ -
constexpr const extents_type & extents() const noexcept
Definition layout_stride.hh:85
│ │ │ │ -
constexpr const strides_type & strides() const noexcept
Get the array of all strides.
Definition layout_stride.hh:127
│ │ │ │ +
│ │ │ │ +
64#define DUNE_VERSION_EQUAL_REV(module,major,minor,revision) \
│ │ │ │ +
65 ( DUNE_VERSION_EQUAL(module,major,minor) && \
│ │ │ │ +
66 (DUNE_VERSION_JOIN(module,REVISION) == revision))
│ │ │ │ +
│ │ │ │ +
67
│ │ │ │ +
│ │ │ │ +
82#define DUNE_VERSION_GTE(module,major,minor) \
│ │ │ │ +
83 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
84 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) >= minor)))
│ │ │ │ +
│ │ │ │ +
85
│ │ │ │ +
│ │ │ │ +
100#define DUNE_VERSION_LT(module,major,minor) \
│ │ │ │ +
101 ! DUNE_VERSION_GTE(module,major,minor)
│ │ │ │ +
│ │ │ │ +
102
│ │ │ │ +
│ │ │ │ +
117#define DUNE_VERSION_GT(module,major,minor) \
│ │ │ │ +
118 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
119 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)))
│ │ │ │ +
│ │ │ │ +
120
│ │ │ │ +
│ │ │ │ +
135#define DUNE_VERSION_LTE(module,major,minor) \
│ │ │ │ +
136 ! DUNE_VERSION_GT(module,major,minor)
│ │ │ │ +
│ │ │ │ +
137
│ │ │ │ +
│ │ │ │ +
152#define DUNE_VERSION_GTE_REV(module,major,minor,revision) \
│ │ │ │ +
153 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
154 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ +
155 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ +
156 && (DUNE_VERSION_JOIN(module,REVISION) >= revision)))
│ │ │ │ +
│ │ │ │ +
157
│ │ │ │ +
│ │ │ │ +
172#define DUNE_VERSION_LT_REV(module,major,minor,revision) \
│ │ │ │ +
173 ! DUNE_VERSION_GTE_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ +
174
│ │ │ │ +
│ │ │ │ +
189#define DUNE_VERSION_GT_REV(module,major,minor,revision) \
│ │ │ │ +
190 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \
│ │ │ │ +
191 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) > minor)) \
│ │ │ │ +
192 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN(module,MINOR) == minor) \
│ │ │ │ +
193 && (DUNE_VERSION_JOIN(module,REVISION) > revision)))
│ │ │ │ +
│ │ │ │ +
194
│ │ │ │ +
│ │ │ │ +
209#define DUNE_VERSION_LTE_REV(module,major,minor,revision) \
│ │ │ │ +
210 ! DUNE_VERSION_GT_REV(module,major,minor,revision)
│ │ │ │ +
│ │ │ │ +
211
│ │ │ │ +
│ │ │ │ +
226#define DUNE_VERSION_ID(major,minor,revision) \
│ │ │ │ +
227 ((unsigned int)((major << 24) + (minor << 16) + revision))
│ │ │ │ +
│ │ │ │ +
228
│ │ │ │ +
│ │ │ │ +
243#define DUNE_MODULE_VERSION_ID(module) \
│ │ │ │ +
244 DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) )
│ │ │ │ +
│ │ │ │ +
245
│ │ │ │ +
246#endif
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,229 +1,76 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -layout_left.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 © 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_LAYOUT_LEFT_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_LAYOUT_LEFT_HH │ │ │ │ │ +5#ifndef DUNE_VERSION_HH │ │ │ │ │ +6#define DUNE_VERSION_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_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ -13 │ │ │ │ │ -14namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ -15 │ │ │ │ │ -17template │ │ │ │ │ -_1_8class _l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -19{ │ │ │ │ │ -_2_0 template friend class _m_a_p_p_i_n_g; │ │ │ │ │ -21 │ │ │ │ │ -22public: │ │ │ │ │ -_2_3 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ -_2_4 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ -_2_5 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ -_2_6 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ -_2_7 using _l_a_y_o_u_t___t_y_p_e = _l_a_y_o_u_t___l_e_f_t; │ │ │ │ │ -28 │ │ │ │ │ -_3_0 constexpr _m_a_p_p_i_n_g () noexcept = default; │ │ │ │ │ +8#include // DUNE_[MODULE]_VERSION_[TYPE] │ │ │ │ │ +9 │ │ │ │ │ +_3_0#define DUNE_VERSION_JOIN(module,type) module ## _VERSION_ ## type │ │ │ │ │ 31 │ │ │ │ │ -_3_3 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ -34 │ │ │ │ │ -_3_6 constexpr _m_a_p_p_i_n_g (const _e_x_t_e_n_t_s___t_y_p_e& e) noexcept │ │ │ │ │ -37 : extents_(e) │ │ │ │ │ -38 {} │ │ │ │ │ -39 │ │ │ │ │ -41 template , int> = │ │ │ │ │ -0> │ │ │ │ │ -43 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -44 explicit(!std::is_convertible_v) │ │ │ │ │ -45 #endif │ │ │ │ │ -_4_6 constexpr _m_a_p_p_i_n_g (const _m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ -47 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ -48 {} │ │ │ │ │ +_4_6#define DUNE_VERSION_EQUAL(module,major,minor) \ │ │ │ │ │ +47 ((DUNE_VERSION_JOIN(module,MAJOR) == major) && \ │ │ │ │ │ +48 (DUNE_VERSION_JOIN(module,MINOR) == minor)) │ │ │ │ │ 49 │ │ │ │ │ -51 template = 0, │ │ │ │ │ -53 std::enable_if_t, int> = │ │ │ │ │ -0> │ │ │ │ │ -54 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -55 explicit(!std::is_convertible_v) │ │ │ │ │ -56 #endif │ │ │ │ │ -_5_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) noexcept │ │ │ │ │ -58 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ -59 {} │ │ │ │ │ -60 │ │ │ │ │ -62 template , int> = │ │ │ │ │ -0> │ │ │ │ │ -64 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -65 explicit(extents_type::rank() > 0) │ │ │ │ │ -66 #endif │ │ │ │ │ -_6_7 constexpr _m_a_p_p_i_n_g (const _l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& m) │ │ │ │ │ -68 : extents_(m._e_x_t_e_n_t_s()) │ │ │ │ │ -69 { │ │ │ │ │ -70#ifndef NDEBUG │ │ │ │ │ -71 if constexpr(extents_type::rank() > 0) { │ │ │ │ │ -72 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ -73 for (_r_a_n_k___t_y_p_e r = 0; r < extents_type::rank()-1; ++r) { │ │ │ │ │ -74 assert(m._s_t_r_i_d_e_s(r) == prod); │ │ │ │ │ -75 prod *= m._e_x_t_e_n_t_s().extent(r); │ │ │ │ │ -76 } │ │ │ │ │ -77 assert(m._s_t_r_i_d_e_s(extents_type::rank()-1) == prod); │ │ │ │ │ -78 } │ │ │ │ │ -79#endif │ │ │ │ │ -80 } │ │ │ │ │ -81 │ │ │ │ │ -_8_3 constexpr _m_a_p_p_i_n_g& _o_p_e_r_a_t_o_r_=_ (const _m_a_p_p_i_n_g&) noexcept = default; │ │ │ │ │ -84 │ │ │ │ │ -_8_5 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return extents_; } │ │ │ │ │ -_8_6 constexpr _i_n_d_e_x___t_y_p_e _r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e () const noexcept { return │ │ │ │ │ -extents_.product(); } │ │ │ │ │ -87 │ │ │ │ │ -89 template = 0, │ │ │ │ │ -91 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ -0, │ │ │ │ │ -92 std::enable_if_t<(... && std::is_nothrow_constructible_v), int> = 0> │ │ │ │ │ -_9_3 constexpr _i_n_d_e_x___t_y_p_e operator() (Indices... ii) const noexcept │ │ │ │ │ -94 { │ │ │ │ │ -95 const std::array indices{_i_n_d_e_x___t_y_p_e(std::move(ii))...}; │ │ │ │ │ -96 _i_n_d_e_x___t_y_p_e value = indices.back(); │ │ │ │ │ -97 for (_r_a_n_k___t_y_p_e r = 1; r < extents_type::rank(); ++r) { │ │ │ │ │ -98 const _r_a_n_k___t_y_p_e j = extents_type::rank()-r; │ │ │ │ │ -99 value = indices[j-1] + extents_.extent(j-1) * value; │ │ │ │ │ -100 } │ │ │ │ │ -101 return value; │ │ │ │ │ -102 } │ │ │ │ │ -103 │ │ │ │ │ -_1_0_5 constexpr _i_n_d_e_x___t_y_p_e _o_p_e_r_a_t_o_r_(_)_ () const noexcept │ │ │ │ │ -106 { │ │ │ │ │ -107 return 0; │ │ │ │ │ -108 } │ │ │ │ │ -109 │ │ │ │ │ -_1_1_0 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ -_1_1_1 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ -_1_1_2 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ -113 │ │ │ │ │ -_1_1_4 static constexpr bool _i_s___u_n_i_q_u_e () noexcept { return true; } │ │ │ │ │ -_1_1_5 static constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () noexcept { return true; } │ │ │ │ │ -_1_1_6 static constexpr bool _i_s___s_t_r_i_d_e_d () noexcept { return true; } │ │ │ │ │ -117 │ │ │ │ │ -119 template 0), int> = 0> │ │ │ │ │ -_1_2_1 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e i) const noexcept │ │ │ │ │ -122 { │ │ │ │ │ -123 assert(i < extents_type::rank()); │ │ │ │ │ -124 _i_n_d_e_x___t_y_p_e prod = 1; │ │ │ │ │ -125 for (_r_a_n_k___t_y_p_e r = 0; r < i; ++r) │ │ │ │ │ -126 prod *= _e_x_t_e_n_t_s().extent(r); │ │ │ │ │ -127 return prod; │ │ │ │ │ -128 } │ │ │ │ │ -129 │ │ │ │ │ -130 template = 0> │ │ │ │ │ -_1_3_2 friend constexpr bool operator== (const _m_a_p_p_i_n_g& a, const │ │ │ │ │ -_m_a_p_p_i_n_g_<_O_t_h_e_r_E_x_t_e_n_t_s_>& b) noexcept │ │ │ │ │ -133 { │ │ │ │ │ -134 return a.extents_ == b.extents_; │ │ │ │ │ -135 } │ │ │ │ │ -136 │ │ │ │ │ -137private: │ │ │ │ │ -138 [[no_unique_address]] _e_x_t_e_n_t_s___t_y_p_e extents_; │ │ │ │ │ -139}; │ │ │ │ │ -140 │ │ │ │ │ -141} // end namespace Dune::Std │ │ │ │ │ -142 │ │ │ │ │ -143#endif // DUNE_COMMON_STD_LAYOUT_LEFT_HH │ │ │ │ │ -_f_w_d___l_a_y_o_u_t_s_._h_h │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t │ │ │ │ │ -A layout where the leftmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the leftmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e │ │ │ │ │ -constexpr index_type stride(rank_type i) const noexcept │ │ │ │ │ -The stride is the product of the extents E(0)*E(1)*...*E(i-1) │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:121 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ -typename extents_type::index_type index_type │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_r_e_q_u_i_r_e_d___s_p_a_n___s_i_z_e │ │ │ │ │ -constexpr index_type required_span_size() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -constexpr mapping & operator=(const mapping &) noexcept=default │ │ │ │ │ -Copy-assignment for the mapping. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ -Extents extents_type │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_always_unique() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping() noexcept=default │ │ │ │ │ -The default construction is possible for default constructible extents. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_strided() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_always_strided() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -constexpr index_type operator()() const noexcept │ │ │ │ │ -The default offset for rank-0 tensors is 0. │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:105 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -typename extents_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:24 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_unique() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:114 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr mapping(const layout_right::mapping< OtherExtents > &m) noexcept │ │ │ │ │ -Construct the mapping from a layout_right. │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr const extents_type & extents() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:111 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ -typename extents_type::rank_type rank_type │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -static constexpr bool is_exhaustive() noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the rightmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the strides are user-defined. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr const extents_type & extents() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g_:_:_s_t_r_i_d_e_s │ │ │ │ │ -constexpr const strides_type & strides() const noexcept │ │ │ │ │ -Get the array of all strides. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:127 │ │ │ │ │ +_6_4#define DUNE_VERSION_EQUAL_REV(module,major,minor,revision) \ │ │ │ │ │ +65 ( DUNE_VERSION_EQUAL(module,major,minor) && \ │ │ │ │ │ +66 (DUNE_VERSION_JOIN(module,REVISION) == revision)) │ │ │ │ │ +67 │ │ │ │ │ +_8_2#define DUNE_VERSION_GTE(module,major,minor) \ │ │ │ │ │ +83 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +84 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) >= minor))) │ │ │ │ │ +85 │ │ │ │ │ +_1_0_0#define DUNE_VERSION_LT(module,major,minor) \ │ │ │ │ │ +101 ! DUNE_VERSION_GTE(module,major,minor) │ │ │ │ │ +102 │ │ │ │ │ +_1_1_7#define DUNE_VERSION_GT(module,major,minor) \ │ │ │ │ │ +118 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +119 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) > minor))) │ │ │ │ │ +120 │ │ │ │ │ +_1_3_5#define DUNE_VERSION_LTE(module,major,minor) \ │ │ │ │ │ +136 ! DUNE_VERSION_GT(module,major,minor) │ │ │ │ │ +137 │ │ │ │ │ +_1_5_2#define DUNE_VERSION_GTE_REV(module,major,minor,revision) \ │ │ │ │ │ +153 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +154 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) > minor)) \ │ │ │ │ │ +155 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) == minor) \ │ │ │ │ │ +156 && (DUNE_VERSION_JOIN(module,REVISION) >= revision))) │ │ │ │ │ +157 │ │ │ │ │ +_1_7_2#define DUNE_VERSION_LT_REV(module,major,minor,revision) \ │ │ │ │ │ +173 ! DUNE_VERSION_GTE_REV(module,major,minor,revision) │ │ │ │ │ +174 │ │ │ │ │ +_1_8_9#define DUNE_VERSION_GT_REV(module,major,minor,revision) \ │ │ │ │ │ +190 ((DUNE_VERSION_JOIN(module,MAJOR) > major) \ │ │ │ │ │ +191 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) > minor)) \ │ │ │ │ │ +192 || ((DUNE_VERSION_JOIN(module,MAJOR) == major) && (DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR) == minor) \ │ │ │ │ │ +193 && (DUNE_VERSION_JOIN(module,REVISION) > revision))) │ │ │ │ │ +194 │ │ │ │ │ +_2_0_9#define DUNE_VERSION_LTE_REV(module,major,minor,revision) \ │ │ │ │ │ +210 ! DUNE_VERSION_GT_REV(module,major,minor,revision) │ │ │ │ │ +211 │ │ │ │ │ +_2_2_6#define DUNE_VERSION_ID(major,minor,revision) \ │ │ │ │ │ +227 ((unsigned int)((major << 24) + (minor << 16) + revision)) │ │ │ │ │ +228 │ │ │ │ │ +_2_4_3#define DUNE_MODULE_VERSION_ID(module) \ │ │ │ │ │ +244 DUNE_VERSION_ID( DUNE_VERSION_JOIN(module,MAJOR), DUNE_VERSION_JOIN │ │ │ │ │ +(module,MINOR), DUNE_VERSION_JOIN(module,REVISION) ) │ │ │ │ │ +245 │ │ │ │ │ +246#endif │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: type_traits.hh File Reference │ │ │ │ +dune-common: dynvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,78 +65,61 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs
│ │ │ │ -
type_traits.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
dynvector.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <type_traits>
│ │ │ │ -#include <dune-common-config.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/typeutilities.hh>
│ │ │ │ + │ │ │ │ +

This file implements a dense vector with a dynamic size. │ │ │ │ +More...

│ │ │ │ +
#include <cmath>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <cstdlib>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <cstring>
│ │ │ │ +#include <initializer_list>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <utility>
│ │ │ │ +#include "boundschecking.hh"
│ │ │ │ +#include "exceptions.hh"
│ │ │ │ +#include "genericiterator.hh"
│ │ │ │ +#include <vector>
│ │ │ │ +#include "densevector.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::DenseMatVecTraits< DynamicVector< K, Allocator > >
 
struct  Dune::FieldTraits< DynamicVector< K, Allocator > >
 
class  Dune::DynamicVector< K, Allocator >
 Construct a vector with a dynamic size. 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.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

This file implements a dense vector with a dynamic size.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,71 +1,40 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -type_traits.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> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +dynvector.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 vector with a dynamic size. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h" │ │ │ │ │ +#include "_e_x_c_e_p_t_i_o_n_s_._h_h" │ │ │ │ │ +#include "_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h" │ │ │ │ │ +#include │ │ │ │ │ +#include "_d_e_n_s_e_v_e_c_t_o_r_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_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_:_:_D_e_n_s_e_M_a_t_V_e_c_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ +  Construct a vector with a dynamic size. _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. │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +This file implements a dense vector with a dynamic size. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: type_traits.hh Source File │ │ │ │ +dune-common: dynvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,184 +70,275 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
type_traits.hh
│ │ │ │ +
dynvector.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 © 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_DYNVECTOR_HH
│ │ │ │ +
6#define DUNE_DYNVECTOR_HH
│ │ │ │
7
│ │ │ │ -
8#include <type_traits>
│ │ │ │ -
9#include <dune-common-config.hh> // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ - │ │ │ │ - │ │ │ │ -
12
│ │ │ │ -
13#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ -
14#include <experimental/type_traits>
│ │ │ │ -
15#endif
│ │ │ │ +
8#include <cmath>
│ │ │ │ +
9#include <cstddef>
│ │ │ │ +
10#include <cstdlib>
│ │ │ │ +
11#include <complex>
│ │ │ │ +
12#include <cstring>
│ │ │ │ +
13#include <initializer_list>
│ │ │ │ +
14#include <limits>
│ │ │ │ +
15#include <utility>
│ │ │ │
16
│ │ │ │ -
17namespace Dune
│ │ │ │ -
18{
│ │ │ │ -
19
│ │ │ │ -
21
│ │ │ │ -
30namespace Std
│ │ │ │ -
31{
│ │ │ │ -
32
│ │ │ │ -
35 using std::bool_constant;
│ │ │ │ -
36
│ │ │ │ -
37#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ -
38
│ │ │ │ -
39 using std::experimental::nonesuch;
│ │ │ │ -
40 using std::experimental::detected_or;
│ │ │ │ -
41 using std::experimental::is_detected;
│ │ │ │ -
42 using std::experimental::detected_t;
│ │ │ │ -
43 using std::experimental::is_detected_v;
│ │ │ │ -
44 using std::experimental::detected_or_t;
│ │ │ │ -
45 using std::experimental::is_detected_exact;
│ │ │ │ -
46 using std::experimental::is_detected_exact_v;
│ │ │ │ -
47 using std::experimental::is_detected_convertible;
│ │ │ │ -
48 using std::experimental::is_detected_convertible_v;
│ │ │ │ -
49
│ │ │ │ -
50#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ -
51
│ │ │ │ -
52 // fallback version of std::experimental::is_detected et al., heavily scribbled
│ │ │ │ -
53 // from cppreference.com (but there is actually not much implementation to the thing)
│ │ │ │ -
54
│ │ │ │ -
55#ifndef DOXYGEN
│ │ │ │ -
56
│ │ │ │ -
57 namespace Impl {
│ │ │ │ -
58
│ │ │ │ -
59 // default version of detector, this gets matched on failure
│ │ │ │ -
60 template<typename Default, typename Void, template<typename...> class Op, typename... Args>
│ │ │ │ -
61 struct detector
│ │ │ │ -
62 {
│ │ │ │ -
63 using value_t = std::false_type;
│ │ │ │ -
64 using type = Default;
│ │ │ │ -
65 };
│ │ │ │ +
17#include "boundschecking.hh"
│ │ │ │ +
18#include "exceptions.hh"
│ │ │ │ +
19#include "genericiterator.hh"
│ │ │ │ +
20
│ │ │ │ +
21#include <vector>
│ │ │ │ +
22#include "densevector.hh"
│ │ │ │ +
23
│ │ │ │ +
24namespace Dune {
│ │ │ │ +
25
│ │ │ │ +
34 template< class K, class Allocator > class DynamicVector;
│ │ │ │ +
35 template< class K, class Allocator >
│ │ │ │ +
│ │ │ │ +
36 struct DenseMatVecTraits< DynamicVector< K, Allocator > >
│ │ │ │ +
37 {
│ │ │ │ + │ │ │ │ +
39 typedef std::vector< K, Allocator > container_type;
│ │ │ │ +
40 typedef K value_type;
│ │ │ │ +
41 typedef typename container_type::size_type size_type;
│ │ │ │ +
42 };
│ │ │ │ +
│ │ │ │ +
43
│ │ │ │ +
44 template< class K, class Allocator >
│ │ │ │ +
│ │ │ │ +
45 struct FieldTraits< DynamicVector< K, Allocator > >
│ │ │ │ +
46 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
49 };
│ │ │ │ +
│ │ │ │ +
50
│ │ │ │ +
57 template< class K, class Allocator = std::allocator< K > >
│ │ │ │ +
│ │ │ │ +
58 class DynamicVector : public DenseVector< DynamicVector< K, Allocator > >
│ │ │ │ +
59 {
│ │ │ │ +
60 std::vector< K, Allocator > _data;
│ │ │ │ +
61
│ │ │ │ + │ │ │ │ +
63 public:
│ │ │ │ +
64 typedef typename Base::size_type size_type;
│ │ │ │ +
65 typedef typename Base::value_type value_type;
│ │ │ │
66
│ │ │ │ -
67 // specialization of detector that matches if Op<Args...> can be instantiated
│ │ │ │ -
68 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ -
69 struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
│ │ │ │ -
70 {
│ │ │ │ -
71 using value_t = std::true_type;
│ │ │ │ -
72 using type = Op<Args...>;
│ │ │ │ -
73 };
│ │ │ │ -
74
│ │ │ │ -
75 }
│ │ │ │ -
76
│ │ │ │ -
77#endif // DOXYGEN
│ │ │ │ -
78
│ │ │ │ -
80
│ │ │ │ -
│ │ │ │ -
88 struct nonesuch
│ │ │ │ -
89 {
│ │ │ │ -
90 nonesuch() = delete;
│ │ │ │ -
91 ~nonesuch() = delete;
│ │ │ │ -
92 nonesuch(const nonesuch&) = delete;
│ │ │ │ -
93 void operator=(const nonesuch&) = delete;
│ │ │ │ -
94 };
│ │ │ │ -
│ │ │ │ -
95
│ │ │ │ -
97
│ │ │ │ -
131 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ -
132 using detected_or = Impl::detector<Default,void,Op,Args...>;
│ │ │ │ -
133
│ │ │ │ -
135
│ │ │ │ -
144 template<template<typename...> class Op, typename... Args>
│ │ │ │ -
145 using is_detected = typename detected_or<nonesuch,Op,Args...>::value_t;
│ │ │ │ -
146
│ │ │ │ -
147#ifdef __cpp_variable_templates
│ │ │ │ +
67 typedef std::vector< K, Allocator > container_type;
│ │ │ │ +
68
│ │ │ │ +
69 typedef Allocator allocator_type;
│ │ │ │ +
70
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
73 _data( a )
│ │ │ │ +
74 {}
│ │ │ │ +
│ │ │ │ +
75
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
77 _data( n, value_type(), a )
│ │ │ │ +
78 {}
│ │ │ │ +
│ │ │ │ +
79
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
82 _data( n, c, a )
│ │ │ │ +
83 {}
│ │ │ │ +
│ │ │ │ +
84
│ │ │ │ +
│ │ │ │ +
86 DynamicVector (std::initializer_list<K> const &l) :
│ │ │ │ +
87 _data(l)
│ │ │ │ +
88 {}
│ │ │ │ +
│ │ │ │ +
89
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
92 Base(), _data(x._data)
│ │ │ │ +
93 {}
│ │ │ │ +
│ │ │ │ +
94
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
97 _data(std::move(x._data))
│ │ │ │ +
98 {}
│ │ │ │ +
│ │ │ │ +
99
│ │ │ │ +
100 template< class T >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
102 _data(x.begin(), x.end(), x.get_allocator())
│ │ │ │ +
103 {}
│ │ │ │ +
│ │ │ │ +
104
│ │ │ │ +
106 template< class X >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
108 _data(a)
│ │ │ │ +
109 {
│ │ │ │ +
110 const size_type n = x.size();
│ │ │ │ +
111 _data.reserve(n);
│ │ │ │ +
112 for( size_type i =0; i<n ;++i)
│ │ │ │ +
113 _data.push_back( x[ i ] );
│ │ │ │ +
114 }
│ │ │ │ +
│ │ │ │ +
115
│ │ │ │ +
116 using Base::operator=;
│ │ │ │ +
117
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
120 {
│ │ │ │ +
121 _data = other._data;
│ │ │ │ +
122 return *this;
│ │ │ │ +
123 }
│ │ │ │ +
│ │ │ │ +
124
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
127 {
│ │ │ │ +
128 _data = std::move(other._data);
│ │ │ │ +
129 return *this;
│ │ │ │ +
130 }
│ │ │ │ +
│ │ │ │ +
131
│ │ │ │ +
132 //==== forward some methods of std::vector
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
138 {
│ │ │ │ +
139 return _data.capacity();
│ │ │ │ +
140 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
142 {
│ │ │ │ +
143 _data.resize(n,c);
│ │ │ │ +
144 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
146 {
│ │ │ │ +
147 _data.reserve(n);
│ │ │ │ +
148 }
│ │ │ │ +
│ │ │ │
149
│ │ │ │ -
158 template<template<typename...> class Op, typename... Args>
│ │ │ │ -
159 constexpr bool is_detected_v = is_detected<Op,Args...>::value;
│ │ │ │ -
160#endif // __cpp_variable_templates
│ │ │ │ -
161
│ │ │ │ -
163
│ │ │ │ -
173 template<template<typename...> class Op, typename... Args>
│ │ │ │ -
174 using detected_t = typename detected_or<nonesuch,Op,Args...>::type;
│ │ │ │ -
175
│ │ │ │ +
150 //==== make this thing a vector
│ │ │ │ +
151 size_type size() const { return _data.size(); }
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
154 return _data[i];
│ │ │ │ +
155 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
156 const K & operator[](size_type i) const {
│ │ │ │ + │ │ │ │ +
158 return _data[i];
│ │ │ │ +
159 }
│ │ │ │ +
│ │ │ │ +
160
│ │ │ │ +
│ │ │ │ +
162 K* data() noexcept
│ │ │ │ +
163 {
│ │ │ │ +
164 return _data.data();
│ │ │ │ +
165 }
│ │ │ │ +
│ │ │ │ +
166
│ │ │ │ +
│ │ │ │ +
168 const K* data() const noexcept
│ │ │ │ +
169 {
│ │ │ │ +
170 return _data.data();
│ │ │ │ +
171 }
│ │ │ │ +
│ │ │ │ +
172
│ │ │ │ +
173 const container_type &container () const { return _data; }
│ │ │ │ +
174 container_type &container () { return _data; }
│ │ │ │ +
175 };
│ │ │ │ +
│ │ │ │
176
│ │ │ │ -
178
│ │ │ │ -
188 template<typename Default, template<typename...> class Op, typename... Args>
│ │ │ │ -
189 using detected_or_t = typename detected_or<Default,Op,Args...>::type;
│ │ │ │ -
190
│ │ │ │ -
192
│ │ │ │ -
198 template<typename Expected, template<typename...> class Op, typename... Args>
│ │ │ │ -
199 using is_detected_exact = std::is_same<Expected,detected_t<Op,Args...>>;
│ │ │ │ -
200
│ │ │ │ -
201#ifdef __cpp_variable_templates
│ │ │ │ +
188 template< class K, class Allocator >
│ │ │ │ +
│ │ │ │ +
189 inline std::istream &operator>> ( std::istream &in,
│ │ │ │ + │ │ │ │ +
191 {
│ │ │ │ + │ │ │ │ +
193 for( typename DynamicVector< K, Allocator >::size_type i = 0; i < w.size(); ++i )
│ │ │ │ +
194 in >> w[ i ];
│ │ │ │ +
195 if(in)
│ │ │ │ +
196 v = std::move(w);
│ │ │ │ +
197 return in;
│ │ │ │ +
198 }
│ │ │ │ +
│ │ │ │ +
199
│ │ │ │ +
202} // end namespace
│ │ │ │
203
│ │ │ │ -
209 template<typename Expected, template<typename...> class Op, typename... Args>
│ │ │ │ -
210 constexpr bool is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value;
│ │ │ │ -
211#endif // __cpp_variable_templates
│ │ │ │ -
212
│ │ │ │ -
214
│ │ │ │ -
220 template<typename Target, template<typename...> class Op, typename... Args>
│ │ │ │ -
221 using is_detected_convertible = std::is_convertible<Target,detected_t<Op,Args...>>;
│ │ │ │ -
222
│ │ │ │ -
223#ifdef __cpp_variable_templates
│ │ │ │ -
225
│ │ │ │ -
231 template<typename Target, template<typename...> class Op, typename... Args>
│ │ │ │ -
232 constexpr bool is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value;
│ │ │ │ -
233#endif // __cpp_variable_templates
│ │ │ │ -
234
│ │ │ │ -
235#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED
│ │ │ │ -
236
│ │ │ │ -
237} // namespace Std
│ │ │ │ -
238
│ │ │ │ -
239
│ │ │ │ -
240namespace detail
│ │ │ │ -
241{
│ │ │ │ -
242 template <class Type>
│ │ │ │ -
243 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code calling `detected_or_fallback_t` for getting the source of this warning!")]]
│ │ │ │ -
244 Type warningIfNotDefined(const Std::nonesuch*);
│ │ │ │ -
245
│ │ │ │ -
246 template <class Type, class T>
│ │ │ │ -
247 Type warningIfNotDefined(const T*);
│ │ │ │ -
248}
│ │ │ │ -
249
│ │ │ │ -
251template <template<typename...> class Fallback,
│ │ │ │ -
252 template<typename...> class TargetType, typename... Args>
│ │ │ │ - │ │ │ │ -
254 detail::warningIfNotDefined<Std::detected_t<Fallback, Args...> >(std::declval<const Std::detected_t<TargetType, Args...>*>())),
│ │ │ │ -
255 TargetType, Args...>;
│ │ │ │ -
256
│ │ │ │ -
257
│ │ │ │ -
258} // namespace Dune
│ │ │ │ -
259
│ │ │ │ -
260#endif // #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Utilities for type computations, constraining overloads, ...
│ │ │ │ -
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:189
│ │ │ │ -
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:199
│ │ │ │ -
typename detected_or< nonesuch, Op, Args... >::type detected_t
Returns Op<Args...> if that is valid; otherwise returns nonesuch.
Definition type_traits.hh:174
│ │ │ │ -
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 detected_or< nonesuch, Op, Args... >::value_t is_detected
Detects whether Op<Args...> is valid.
Definition type_traits.hh:145
│ │ │ │ -
Impl::detector< Default, void, Op, Args... > detected_or
Detects whether Op<Args...> is valid and makes the result available.
Definition type_traits.hh:132
│ │ │ │ -
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:221
│ │ │ │ +
204#endif
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
Implements a generic iterator class for writing stl conformant iterators.
│ │ │ │ +
Implements the dense vector interface, with an exchangeable storage class.
│ │ │ │ +
Macro for wrapping boundary checks.
│ │ │ │ +
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
│ │ │ │
STL namespace.
│ │ │ │
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:255
│ │ │ │ -
Type representing a lookup failure by std::detected_or and friends.
Definition type_traits.hh:89
│ │ │ │ - │ │ │ │ -
nonesuch(const nonesuch &)=delete
│ │ │ │ -
void operator=(const nonesuch &)=delete
│ │ │ │ - │ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ +
DynamicVector(const DynamicVector &x)
Constructor making vector with identical coordinates.
Definition dynvector.hh:91
│ │ │ │ +
Base::size_type size_type
Definition dynvector.hh:64
│ │ │ │ +
std::vector< K, Allocator > container_type
Definition dynvector.hh:67
│ │ │ │ +
size_type size() const
Definition dynvector.hh:151
│ │ │ │ +
K & operator[](size_type i)
Definition dynvector.hh:152
│ │ │ │ +
container_type & container()
Definition dynvector.hh:174
│ │ │ │ +
Base::value_type value_type
Definition dynvector.hh:65
│ │ │ │ +
const K * data() const noexcept
return pointer to underlying array
Definition dynvector.hh:168
│ │ │ │ +
Allocator allocator_type
Definition dynvector.hh:69
│ │ │ │ +
DynamicVector(const allocator_type &a=allocator_type())
Constructor making uninitialized vector.
Definition dynvector.hh:72
│ │ │ │ +
DynamicVector(DynamicVector &&x)
Move constructor.
Definition dynvector.hh:96
│ │ │ │ +
K * data() noexcept
return pointer to underlying array
Definition dynvector.hh:162
│ │ │ │ +
DynamicVector & operator=(DynamicVector &&other)
Move assignment operator.
Definition dynvector.hh:126
│ │ │ │ +
DynamicVector & operator=(const DynamicVector &other)
Copy assignment operator.
Definition dynvector.hh:119
│ │ │ │ +
size_type capacity() const
Number of elements for which memory has been allocated.
Definition dynvector.hh:137
│ │ │ │ +
const container_type & container() const
Definition dynvector.hh:173
│ │ │ │ +
DynamicVector(size_type n, const allocator_type &a=allocator_type())
Definition dynvector.hh:76
│ │ │ │ +
DynamicVector(std::initializer_list< K > const &l)
Construct from a std::initializer_list.
Definition dynvector.hh:86
│ │ │ │ +
DynamicVector(const DynamicVector< T, Allocator > &x)
Definition dynvector.hh:101
│ │ │ │ +
const K & operator[](size_type i) const
Definition dynvector.hh:156
│ │ │ │ +
void reserve(size_type n)
Definition dynvector.hh:145
│ │ │ │ +
DynamicVector(size_type n, value_type c, const allocator_type &a=allocator_type())
Constructor making vector with identical coordinates.
Definition dynvector.hh:81
│ │ │ │ +
DynamicVector(const DenseVector< X > &x, const allocator_type &a=allocator_type())
Copy constructor from another DenseVector.
Definition dynvector.hh:107
│ │ │ │ + │ │ │ │ +
DynamicVector< K, Allocator > derived_type
Definition dynvector.hh:38
│ │ │ │ +
std::vector< K, Allocator > container_type
Definition dynvector.hh:39
│ │ │ │ +
container_type::size_type size_type
Definition dynvector.hh:41
│ │ │ │ +
FieldTraits< K >::real_type real_type
Definition dynvector.hh:48
│ │ │ │ +
FieldTraits< K >::field_type field_type
Definition dynvector.hh:47
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,228 +1,341 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -type_traits.hh │ │ │ │ │ +dynvector.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 © 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_DYNVECTOR_HH │ │ │ │ │ +6#define DUNE_DYNVECTOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -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#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> │ │ │ │ │ -12 │ │ │ │ │ -13#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -14#include │ │ │ │ │ -15#endif │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ 16 │ │ │ │ │ -17namespace _D_u_n_e │ │ │ │ │ -18{ │ │ │ │ │ -19 │ │ │ │ │ -21 │ │ │ │ │ -30namespace Std │ │ │ │ │ -31{ │ │ │ │ │ -32 │ │ │ │ │ -35 using std::bool_constant; │ │ │ │ │ -36 │ │ │ │ │ -37#if DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -38 │ │ │ │ │ -39 using std::experimental::nonesuch; │ │ │ │ │ -40 using std::experimental::detected_or; │ │ │ │ │ -41 using std::experimental::is_detected; │ │ │ │ │ -42 using std::experimental::detected_t; │ │ │ │ │ -43 using std::experimental::is_detected_v; │ │ │ │ │ -44 using std::experimental::detected_or_t; │ │ │ │ │ -45 using std::experimental::is_detected_exact; │ │ │ │ │ -46 using std::experimental::is_detected_exact_v; │ │ │ │ │ -47 using std::experimental::is_detected_convertible; │ │ │ │ │ -48 using std::experimental::is_detected_convertible_v; │ │ │ │ │ -49 │ │ │ │ │ -50#else // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -51 │ │ │ │ │ -52 // fallback version of std::experimental::is_detected et al., heavily │ │ │ │ │ -scribbled │ │ │ │ │ -53 // from cppreference.com (but there is actually not much implementation to │ │ │ │ │ -the thing) │ │ │ │ │ -54 │ │ │ │ │ -55#ifndef DOXYGEN │ │ │ │ │ -56 │ │ │ │ │ -57 namespace Impl { │ │ │ │ │ -58 │ │ │ │ │ -59 // default version of detector, this gets matched on failure │ │ │ │ │ -60 template class Op, │ │ │ │ │ -typename... Args> │ │ │ │ │ -61 struct detector │ │ │ │ │ -62 { │ │ │ │ │ -63 using value_t = std::false_type; │ │ │ │ │ -64 using type = Default; │ │ │ │ │ -65 }; │ │ │ │ │ +17#include "_b_o_u_n_d_s_c_h_e_c_k_i_n_g_._h_h" │ │ │ │ │ +18#include "_e_x_c_e_p_t_i_o_n_s_._h_h" │ │ │ │ │ +19#include "_g_e_n_e_r_i_c_i_t_e_r_a_t_o_r_._h_h" │ │ │ │ │ +20 │ │ │ │ │ +21#include │ │ │ │ │ +22#include "_d_e_n_s_e_v_e_c_t_o_r_._h_h" │ │ │ │ │ +23 │ │ │ │ │ +24namespace _D_u_n_e { │ │ │ │ │ +25 │ │ │ │ │ +34 template< class K, class Allocator > class DynamicVector; │ │ │ │ │ +35 template< class K, class Allocator > │ │ │ │ │ +_3_6 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_V_e_c_t_o_r< K, Allocator > > │ │ │ │ │ +37 { │ │ │ │ │ +_3_8 typedef _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _> _d_e_r_i_v_e_d___t_y_p_e; │ │ │ │ │ +_3_9 typedef std::vector< K, Allocator > _c_o_n_t_a_i_n_e_r___t_y_p_e; │ │ │ │ │ +_4_0 typedef K _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_4_1 typedef typename container_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +42 }; │ │ │ │ │ +43 │ │ │ │ │ +44 template< class K, class Allocator > │ │ │ │ │ +_4_5 struct _F_i_e_l_d_T_r_a_i_t_s< _D_y_n_a_m_i_c_V_e_c_t_o_r< K, Allocator > > │ │ │ │ │ +46 { │ │ │ │ │ +_4_7 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; │ │ │ │ │ +_4_8 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; │ │ │ │ │ +49 }; │ │ │ │ │ +50 │ │ │ │ │ +57 template< class K, class Allocator = std::allocator< K > > │ │ │ │ │ +_5_8 class _D_y_n_a_m_i_c_V_e_c_t_o_r : public _D_e_n_s_e_V_e_c_t_o_r< DynamicVector< K, Allocator > > │ │ │ │ │ +59 { │ │ │ │ │ +60 std::vector< K, Allocator > _data; │ │ │ │ │ +61 │ │ │ │ │ +62 typedef _D_e_n_s_e_V_e_c_t_o_r_<_ _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _> > _B_a_s_e; │ │ │ │ │ +63 public: │ │ │ │ │ +_6_4 typedef typename _B_a_s_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +_6_5 typedef typename _B_a_s_e_:_:_v_a_l_u_e___t_y_p_e _v_a_l_u_e___t_y_p_e; │ │ │ │ │ 66 │ │ │ │ │ -67 // specialization of detector that matches if Op can be │ │ │ │ │ -instantiated │ │ │ │ │ -68 template class Op, typename... Args> │ │ │ │ │ -69 struct detector>, Op, Args...> │ │ │ │ │ -70 { │ │ │ │ │ -71 using value_t = std::true_type; │ │ │ │ │ -72 using type = Op; │ │ │ │ │ -73 }; │ │ │ │ │ -74 │ │ │ │ │ -75 } │ │ │ │ │ -76 │ │ │ │ │ -77#endif // DOXYGEN │ │ │ │ │ -78 │ │ │ │ │ -80 │ │ │ │ │ -_8_8 struct _n_o_n_e_s_u_c_h │ │ │ │ │ -89 { │ │ │ │ │ -_9_0 _n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ -_9_1 _~_n_o_n_e_s_u_c_h() = delete; │ │ │ │ │ -_9_2 _n_o_n_e_s_u_c_h(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ -_9_3 void _o_p_e_r_a_t_o_r_=(const _n_o_n_e_s_u_c_h&) = delete; │ │ │ │ │ -94 }; │ │ │ │ │ -95 │ │ │ │ │ -97 │ │ │ │ │ -131 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -_1_3_2 using _d_e_t_e_c_t_e_d___o_r = Impl::detector; │ │ │ │ │ -133 │ │ │ │ │ -135 │ │ │ │ │ -144 template class Op, typename... Args> │ │ │ │ │ -_1_4_5 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; │ │ │ │ │ -146 │ │ │ │ │ -147#ifdef __cpp_variable_templates │ │ │ │ │ +_6_7 typedef std::vector< K, Allocator > _c_o_n_t_a_i_n_e_r___t_y_p_e; │ │ │ │ │ +68 │ │ │ │ │ +_6_9 typedef Allocator _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +70 │ │ │ │ │ +_7_2 explicit _D_y_n_a_m_i_c_V_e_c_t_o_r(const _a_l_l_o_c_a_t_o_r___t_y_p_e &a = _a_l_l_o_c_a_t_o_r___t_y_p_e() ) : │ │ │ │ │ +73 _data( a ) │ │ │ │ │ +74 {} │ │ │ │ │ +75 │ │ │ │ │ +_7_6 explicit _D_y_n_a_m_i_c_V_e_c_t_o_r(_s_i_z_e___t_y_p_e n, const _a_l_l_o_c_a_t_o_r___t_y_p_e &a = _a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +() ) : │ │ │ │ │ +77 _data( n, _v_a_l_u_e___t_y_p_e(), a ) │ │ │ │ │ +78 {} │ │ │ │ │ +79 │ │ │ │ │ +_8_1 _D_y_n_a_m_i_c_V_e_c_t_o_r( _s_i_z_e___t_y_p_e n, _v_a_l_u_e___t_y_p_e c, const _a_l_l_o_c_a_t_o_r___t_y_p_e &a = │ │ │ │ │ +_a_l_l_o_c_a_t_o_r___t_y_p_e() ) : │ │ │ │ │ +82 _data( n, c, a ) │ │ │ │ │ +83 {} │ │ │ │ │ +84 │ │ │ │ │ +_8_6 _D_y_n_a_m_i_c_V_e_c_t_o_r (std::initializer_list const &l) : │ │ │ │ │ +87 _data(l) │ │ │ │ │ +88 {} │ │ │ │ │ +89 │ │ │ │ │ +_9_1 _D_y_n_a_m_i_c_V_e_c_t_o_r(const _D_y_n_a_m_i_c_V_e_c_t_o_r & x) : │ │ │ │ │ +92 _B_a_s_e(), _data(x._data) │ │ │ │ │ +93 {} │ │ │ │ │ +94 │ │ │ │ │ +_9_6 _D_y_n_a_m_i_c_V_e_c_t_o_r(_D_y_n_a_m_i_c_V_e_c_t_o_r && x) : │ │ │ │ │ +97 _data(_s_t_d::move(x._data)) │ │ │ │ │ +98 {} │ │ │ │ │ +99 │ │ │ │ │ +100 template< class T > │ │ │ │ │ +_1_0_1 _D_y_n_a_m_i_c_V_e_c_t_o_r(const _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _T_,_ _A_l_l_o_c_a_t_o_r_ _> & x) : │ │ │ │ │ +102 _data(x._b_e_g_i_n(), x._e_n_d(), x.get_allocator()) │ │ │ │ │ +103 {} │ │ │ │ │ +104 │ │ │ │ │ +106 template< class X > │ │ │ │ │ +_1_0_7 _D_y_n_a_m_i_c_V_e_c_t_o_r(const _D_e_n_s_e_V_e_c_t_o_r_<_ _X_ _> & x, const _a_l_l_o_c_a_t_o_r___t_y_p_e &a = │ │ │ │ │ +_a_l_l_o_c_a_t_o_r___t_y_p_e() ) : │ │ │ │ │ +108 _data(a) │ │ │ │ │ +109 { │ │ │ │ │ +110 const _s_i_z_e___t_y_p_e n = x._s_i_z_e(); │ │ │ │ │ +111 _data.reserve(n); │ │ │ │ │ +112 for( _s_i_z_e___t_y_p_e i =0; i class Op, typename... Args> │ │ │ │ │ -159 constexpr bool is_detected_v = _i_s___d_e_t_e_c_t_e_d::value; │ │ │ │ │ -160#endif // __cpp_variable_templates │ │ │ │ │ -161 │ │ │ │ │ -163 │ │ │ │ │ -173 template class Op, typename... Args> │ │ │ │ │ -_1_7_4 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; │ │ │ │ │ -175 │ │ │ │ │ +150 //==== make this thing a vector │ │ │ │ │ +_1_5_1 _s_i_z_e___t_y_p_e _s_i_z_e() const { return _data.size(); } │ │ │ │ │ +_1_5_2 K & _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e i) { │ │ │ │ │ +153 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _s_i_z_e()); │ │ │ │ │ +154 return _data[i]; │ │ │ │ │ +155 } │ │ │ │ │ +_1_5_6 const K & _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e i) const { │ │ │ │ │ +157 _D_U_N_E___A_S_S_E_R_T___B_O_U_N_D_S(i < _s_i_z_e()); │ │ │ │ │ +158 return _data[i]; │ │ │ │ │ +159 } │ │ │ │ │ +160 │ │ │ │ │ +_1_6_2 K* _d_a_t_a() noexcept │ │ │ │ │ +163 { │ │ │ │ │ +164 return _data.data(); │ │ │ │ │ +165 } │ │ │ │ │ +166 │ │ │ │ │ +_1_6_8 const K* _d_a_t_a() const noexcept │ │ │ │ │ +169 { │ │ │ │ │ +170 return _data.data(); │ │ │ │ │ +171 } │ │ │ │ │ +172 │ │ │ │ │ +_1_7_3 const _c_o_n_t_a_i_n_e_r___t_y_p_e &_c_o_n_t_a_i_n_e_r () const { return _data; } │ │ │ │ │ +_1_7_4 _c_o_n_t_a_i_n_e_r___t_y_p_e &_c_o_n_t_a_i_n_e_r () { return _data; } │ │ │ │ │ +175 }; │ │ │ │ │ 176 │ │ │ │ │ -178 │ │ │ │ │ -188 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -_1_8_9 using _d_e_t_e_c_t_e_d___o_r___t = typename _d_e_t_e_c_t_e_d___o_r::type; │ │ │ │ │ -190 │ │ │ │ │ -192 │ │ │ │ │ -198 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -_1_9_9 using _i_s___d_e_t_e_c_t_e_d___e_x_a_c_t = std::is_same>; │ │ │ │ │ -200 │ │ │ │ │ -201#ifdef __cpp_variable_templates │ │ │ │ │ +188 template< class K, class Allocator > │ │ │ │ │ +_1_8_9 inline std::istream &_o_p_e_r_a_t_o_r_>_>_ ( std::istream &in, │ │ │ │ │ +190 _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _> &v ) │ │ │ │ │ +191 { │ │ │ │ │ +192 _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _> w(v); │ │ │ │ │ +193 for( typename _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_s_i_z_e___t_y_p_e i = 0; i < w._s_i_z_e(); │ │ │ │ │ +++i ) │ │ │ │ │ +194 in >> w[ i ]; │ │ │ │ │ +195 if(in) │ │ │ │ │ +196 v = std::move(w); │ │ │ │ │ +197 return in; │ │ │ │ │ +198 } │ │ │ │ │ +199 │ │ │ │ │ +202} // end namespace │ │ │ │ │ 203 │ │ │ │ │ -209 template class Op, typename... │ │ │ │ │ -Args> │ │ │ │ │ -210 constexpr bool is_detected_exact_v = │ │ │ │ │ -_i_s___d_e_t_e_c_t_e_d___e_x_a_c_t::value; │ │ │ │ │ -211#endif // __cpp_variable_templates │ │ │ │ │ -212 │ │ │ │ │ -214 │ │ │ │ │ -220 template class Op, typename... Args> │ │ │ │ │ -_2_2_1 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>; │ │ │ │ │ -222 │ │ │ │ │ -223#ifdef __cpp_variable_templates │ │ │ │ │ -225 │ │ │ │ │ -231 template class Op, typename... Args> │ │ │ │ │ -232 constexpr bool is_detected_convertible_v = │ │ │ │ │ -_i_s___d_e_t_e_c_t_e_d___c_o_n_v_e_r_t_i_b_l_e::value; │ │ │ │ │ -233#endif // __cpp_variable_templates │ │ │ │ │ -234 │ │ │ │ │ -235#endif // DUNE_HAVE_CXX_EXPERIMENTAL_IS_DETECTED │ │ │ │ │ -236 │ │ │ │ │ -237} // namespace Std │ │ │ │ │ -238 │ │ │ │ │ -239 │ │ │ │ │ -240namespace detail │ │ │ │ │ -241{ │ │ │ │ │ -242 template │ │ │ │ │ -243 [[deprecated("Type extraction of `TargetType` has failed. Inspect the code │ │ │ │ │ -calling `detected_or_fallback_t` for getting the source of this warning!")]] │ │ │ │ │ -244 Type warningIfNotDefined(const _S_t_d_:_:_n_o_n_e_s_u_c_h*); │ │ │ │ │ -245 │ │ │ │ │ -246 template │ │ │ │ │ -247 Type warningIfNotDefined(const T*); │ │ │ │ │ -248} │ │ │ │ │ -249 │ │ │ │ │ -251template class Fallback, │ │ │ │ │ -252 template class TargetType, typename... Args> │ │ │ │ │ -_2_5_3using _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*>())), │ │ │ │ │ -255 TargetType, Args...>; │ │ │ │ │ -256 │ │ │ │ │ -257 │ │ │ │ │ -258} // namespace Dune │ │ │ │ │ -259 │ │ │ │ │ -260#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_:_:_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:189 │ │ │ │ │ -_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:199 │ │ │ │ │ -_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:174 │ │ │ │ │ -_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 │ │ │ │ │ -typename detected_or< nonesuch, Op, Args... >::value_t is_detected │ │ │ │ │ -Detects whether Op is valid. │ │ │ │ │ -DDeeffiinniittiioonn type_traits.hh:145 │ │ │ │ │ -_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:132 │ │ │ │ │ -_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_> │ │ │ │ │ +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 │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ _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 container_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +K & operator[](size_type i) │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:152 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_c_o_n_t_a_i_n_e_r │ │ │ │ │ +container_type & container() │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:174 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +Base::value_type value_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_d_a_t_a │ │ │ │ │ +const K * data() const noexcept │ │ │ │ │ +return pointer to underlying array │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:168 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +Allocator allocator_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +DynamicVector(const allocator_type &a=allocator_type()) │ │ │ │ │ +Constructor making uninitialized vector. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +DynamicVector(DynamicVector &&x) │ │ │ │ │ +Move constructor. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_d_a_t_a │ │ │ │ │ +K * data() noexcept │ │ │ │ │ +return pointer to underlying array │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:162 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +DynamicVector & operator=(DynamicVector &&other) │ │ │ │ │ +Move assignment operator. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +DynamicVector & operator=(const DynamicVector &other) │ │ │ │ │ +Copy assignment operator. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:119 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_c_a_p_a_c_i_t_y │ │ │ │ │ +size_type capacity() const │ │ │ │ │ +Number of elements for which memory has been allocated. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:137 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_c_o_n_t_a_i_n_e_r │ │ │ │ │ +const container_type & container() const │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:173 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +DynamicVector(size_type n, const allocator_type &a=allocator_type()) │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +DynamicVector(std::initializer_list< K > const &l) │ │ │ │ │ +Construct from a std::initializer_list. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +DynamicVector(const DynamicVector< T, Allocator > &x) │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +const K & operator[](size_type i) const │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:156 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_r_e_s_e_r_v_e │ │ │ │ │ +void reserve(size_type n) │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:145 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +DynamicVector(size_type n, value_type c, const allocator_type &a=allocator_type │ │ │ │ │ +()) │ │ │ │ │ +Constructor making vector with identical coordinates. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r_:_:_D_y_n_a_m_i_c_V_e_c_t_o_r │ │ │ │ │ +DynamicVector(const DenseVector< X > &x, const allocator_type &a=allocator_type │ │ │ │ │ +()) │ │ │ │ │ +Copy constructor from another DenseVector. │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:107 │ │ │ │ │ +_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_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _>_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +K value_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.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_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _>_:_:_d_e_r_i_v_e_d___t_y_p_e │ │ │ │ │ +DynamicVector< K, Allocator > derived_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.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_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _>_:_:_c_o_n_t_a_i_n_e_r___t_y_p_e │ │ │ │ │ +std::vector< K, Allocator > container_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:39 │ │ │ │ │ +_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_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +container_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< K >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_y_n_a_m_i_c_V_e_c_t_o_r_<_ _K_,_ _A_l_l_o_c_a_t_o_r_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< K >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn dynvector.hh:47 │ │ │ │ │ +_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/a00137.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: default_accessor.hh File Reference │ │ │ │ +dune-common: indexediterator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,42 +65,40 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
default_accessor.hh File Reference
│ │ │ │ +
indexediterator.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <type_traits>
│ │ │ │ +
#include <iterator>
│ │ │ │ +#include <type_traits>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Std::default_accessor< Element >
 A type for indexed access to elements of mdspan. More...
class  Dune::IndexedIterator< Iter >
 An iterator mixin that adds an index() method returning an enumeration index for the traversal. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,24 +1,22 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -default_accessor.hh File Reference │ │ │ │ │ +indexediterator.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_<_ _E_l_e_m_e_n_t_ _> │ │ │ │ │ -  A type for indexed access to elements of mdspan. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r_<_ _I_t_e_r_ _> │ │ │ │ │ +  An iterator mixin that adds an _i_n_d_e_x_(_) method returning an enumeration │ │ │ │ │ + index for the traversal. _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. │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: default_accessor.hh Source File │ │ │ │ +dune-common: indexediterator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,80 +70,147 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
default_accessor.hh
│ │ │ │ +
indexediterator.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 © 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_DEFAULT_ACCESSOR_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_DEFAULT_ACCESSOR_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_INDEXEDITERATOR_HH
│ │ │ │ +
6#define DUNE_COMMON_INDEXEDITERATOR_HH
│ │ │ │
7
│ │ │ │ -
8#include <type_traits>
│ │ │ │ -
9
│ │ │ │ -
│ │ │ │ -
10namespace Dune::Std {
│ │ │ │ -
11
│ │ │ │ -
22template <class Element>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
24{
│ │ │ │ -
25public:
│ │ │ │ -
26 using element_type = Element;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
30
│ │ │ │ -
31public:
│ │ │ │ -
32 // [mdspan.accessor.default.overview]
│ │ │ │ -
34 constexpr default_accessor () noexcept = default;
│ │ │ │ -
35
│ │ │ │ -
37 template <class OtherElement,
│ │ │ │ -
38 std::enable_if_t<std::is_convertible_v<OtherElement(*)[], Element(*)[]>, int> = 0>
│ │ │ │ -
39 constexpr default_accessor (default_accessor<OtherElement>) noexcept {}
│ │ │ │ -
40
│ │ │ │ -
│ │ │ │ -
42 constexpr reference access (data_handle_type p, std::size_t i) const noexcept
│ │ │ │ -
43 {
│ │ │ │ -
44 return p[i];
│ │ │ │ -
45 }
│ │ │ │ -
│ │ │ │ -
46
│ │ │ │ -
│ │ │ │ -
48 constexpr data_handle_type offset (data_handle_type p, std::size_t i) const noexcept
│ │ │ │ -
49 {
│ │ │ │ -
50 return p + i;
│ │ │ │ -
51 }
│ │ │ │ -
│ │ │ │ -
52};
│ │ │ │ -
│ │ │ │ -
53
│ │ │ │ -
54} // end namespace Dune::Std
│ │ │ │ -
│ │ │ │ -
55
│ │ │ │ -
56#endif // DUNE_COMMON_STD_DEFAULT_ACCESSOR_HH
│ │ │ │ +
8#include <iterator>
│ │ │ │ +
9#include <type_traits>
│ │ │ │ +
10
│ │ │ │ +
11namespace Dune
│ │ │ │ +
12{
│ │ │ │ +
26 template <class Iter>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
28 : public Iter
│ │ │ │ +
29 {
│ │ │ │ +
30 using Traits = std::iterator_traits<Iter>;
│ │ │ │ +
31 static_assert(std::is_copy_constructible_v<Iter>);
│ │ │ │ +
32 static_assert(std::is_base_of_v<std::forward_iterator_tag, typename Traits::iterator_category>);
│ │ │ │ +
33
│ │ │ │ +
34 public:
│ │ │ │ +
36 using size_type = typename Traits::difference_type;
│ │ │ │ +
37
│ │ │ │ +
39 template <class I = Iter,
│ │ │ │ +
40 std::enable_if_t<std::is_default_constructible_v<I>, bool> = true>
│ │ │ │ +
│ │ │ │ +
41 constexpr IndexedIterator ()
│ │ │ │ +
42 noexcept(std::is_nothrow_default_constructible_v<Iter>)
│ │ │ │ +
43 {}
│ │ │ │ +
│ │ │ │ +
44
│ │ │ │ +
│ │ │ │ +
47 constexpr IndexedIterator (Iter it, size_type index = 0)
│ │ │ │ +
48 noexcept(std::is_nothrow_copy_constructible_v<Iter>)
│ │ │ │ +
49 : Iter(it)
│ │ │ │ +
50 , index_(index)
│ │ │ │ +
51 {}
│ │ │ │ +
│ │ │ │ +
52
│ │ │ │ +
│ │ │ │ +
54 [[nodiscard]] constexpr size_type index () const noexcept
│ │ │ │ +
55 {
│ │ │ │ +
56 return index_;
│ │ │ │ +
57 }
│ │ │ │ +
│ │ │ │ +
58
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
61 {
│ │ │ │ +
62 Iter::operator++();
│ │ │ │ +
63 ++index_;
│ │ │ │ +
64 return *this;
│ │ │ │ +
65 }
│ │ │ │ +
│ │ │ │ +
66
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
69 {
│ │ │ │ +
70 IndexedIterator tmp(*this);
│ │ │ │ +
71 this->operator++();
│ │ │ │ +
72 return tmp;
│ │ │ │ +
73 }
│ │ │ │ +
│ │ │ │ +
74
│ │ │ │ +
76 template <class I = Iter,
│ │ │ │ +
77 decltype(--std::declval<I&>(), bool{}) = true>
│ │ │ │ +
│ │ │ │ +
78 constexpr IndexedIterator& operator-- ()
│ │ │ │ +
79 {
│ │ │ │ +
80 Iter::operator--();
│ │ │ │ +
81 --index_;
│ │ │ │ +
82 return *this;
│ │ │ │ +
83 }
│ │ │ │ +
│ │ │ │ +
84
│ │ │ │ +
86 template <class I = Iter,
│ │ │ │ +
87 decltype(std::declval<I&>()--, bool{}) = true>
│ │ │ │ +
│ │ │ │ +
88 constexpr IndexedIterator operator-- (int)
│ │ │ │ +
89 {
│ │ │ │ +
90 IndexedIterator tmp(*this);
│ │ │ │ +
91 this->operator--();
│ │ │ │ +
92 return tmp;
│ │ │ │ +
93 }
│ │ │ │ +
│ │ │ │ +
94
│ │ │ │ +
96 template <class I = Iter,
│ │ │ │ +
97 decltype(std::declval<I&>()+=1, bool{}) = true>
│ │ │ │ +
│ │ │ │ +
98 constexpr IndexedIterator& operator+= (typename Iter::difference_type n)
│ │ │ │ +
99 {
│ │ │ │ +
100 Iter::operator+=(n);
│ │ │ │ +
101 index_ += n;
│ │ │ │ +
102 return *this;
│ │ │ │ +
103 }
│ │ │ │ +
│ │ │ │ +
104
│ │ │ │ +
106 template <class I = Iter,
│ │ │ │ +
107 decltype(std::declval<I&>()-=1, bool{}) = true>
│ │ │ │ +
│ │ │ │ +
108 constexpr IndexedIterator& operator-= (typename Iter::difference_type n)
│ │ │ │ +
109 {
│ │ │ │ +
110 Iter::operator-=(n);
│ │ │ │ +
111 index_ -= n;
│ │ │ │ +
112 return *this;
│ │ │ │ +
113 }
│ │ │ │ +
│ │ │ │ +
114
│ │ │ │ +
115 private:
│ │ │ │ +
116 size_type index_ = 0;
│ │ │ │ +
117 };
│ │ │ │ +
│ │ │ │ +
118
│ │ │ │ +
119} // end namespace Dune
│ │ │ │ +
120
│ │ │ │ +
121#endif // DUNE_COMMON_INDEXEDITERATOR_HH
│ │ │ │
STL namespace.
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
A type for indexed access to elements of mdspan.
Definition default_accessor.hh:24
│ │ │ │ -
element_type * data_handle_type
Definition default_accessor.hh:27
│ │ │ │ -
element_type & reference
Definition default_accessor.hh:28
│ │ │ │ -
Element element_type
Definition default_accessor.hh:26
│ │ │ │ -
constexpr default_accessor() noexcept=default
Default constructor.
│ │ │ │ -
constexpr reference access(data_handle_type p, std::size_t i) const noexcept
Return a reference to the i'th element in the data range starting at p
Definition default_accessor.hh:42
│ │ │ │ -
constexpr data_handle_type offset(data_handle_type p, std::size_t i) const noexcept
Return a data handle to the i'th element in the data range starting at p
Definition default_accessor.hh:48
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
An iterator mixin that adds an index() method returning an enumeration index for the traversal.
Definition indexediterator.hh:29
│ │ │ │ +
constexpr IndexedIterator & operator++()
Increment the iterator and the index.
Definition indexediterator.hh:60
│ │ │ │ +
constexpr IndexedIterator & operator--()
Decrement the iterator and the index.
Definition indexediterator.hh:78
│ │ │ │ +
constexpr size_type index() const noexcept
Return the enumeration index.
Definition indexediterator.hh:54
│ │ │ │ +
constexpr IndexedIterator() noexcept(std::is_nothrow_default_constructible_v< Iter >)
Default constructor default-constructs the Iter base type and the index by 0.
Definition indexediterator.hh:41
│ │ │ │ +
constexpr IndexedIterator(Iter it, size_type index=0) noexcept(std::is_nothrow_copy_constructible_v< Iter >)
Definition indexediterator.hh:47
│ │ │ │ +
typename Traits::difference_type size_type
Type used for storing the traversal index.
Definition indexediterator.hh:36
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,86 +1,143 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -default_accessor.hh │ │ │ │ │ +indexediterator.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 © 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_DEFAULT_ACCESSOR_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_DEFAULT_ACCESSOR_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_INDEXEDITERATOR_HH │ │ │ │ │ +6#define DUNE_COMMON_INDEXEDITERATOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -_1_0namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ -11 │ │ │ │ │ -22template │ │ │ │ │ -_2_3class _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r │ │ │ │ │ -24{ │ │ │ │ │ -25public: │ │ │ │ │ -_2_6 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ -_2_7 using _d_a_t_a___h_a_n_d_l_e___t_y_p_e = _e_l_e_m_e_n_t___t_y_p_e*; │ │ │ │ │ -_2_8 using _r_e_f_e_r_e_n_c_e = _e_l_e_m_e_n_t___t_y_p_e&; │ │ │ │ │ -_2_9 using _o_f_f_s_e_t___p_o_l_i_c_y = _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r; │ │ │ │ │ -30 │ │ │ │ │ -31public: │ │ │ │ │ -32 // [mdspan.accessor.default.overview] │ │ │ │ │ -_3_4 constexpr _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r () noexcept = default; │ │ │ │ │ -35 │ │ │ │ │ -37 template , │ │ │ │ │ -int> = 0> │ │ │ │ │ -_3_9 constexpr _d_e_f_a_u_l_t___a_c_c_e_s_s_o_r (_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r) noexcept {} │ │ │ │ │ -40 │ │ │ │ │ -_4_2 constexpr _r_e_f_e_r_e_n_c_e _a_c_c_e_s_s (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, std::size_t i) const │ │ │ │ │ -noexcept │ │ │ │ │ -43 { │ │ │ │ │ -44 return p[i]; │ │ │ │ │ -45 } │ │ │ │ │ -46 │ │ │ │ │ -_4_8 constexpr _d_a_t_a___h_a_n_d_l_e___t_y_p_e _o_f_f_s_e_t (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, std::size_t i) const │ │ │ │ │ -noexcept │ │ │ │ │ -49 { │ │ │ │ │ -50 return p + i; │ │ │ │ │ -51 } │ │ │ │ │ -52}; │ │ │ │ │ -53 │ │ │ │ │ -54} // end namespace Dune::Std │ │ │ │ │ -55 │ │ │ │ │ -56#endif // DUNE_COMMON_STD_DEFAULT_ACCESSOR_HH │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e │ │ │ │ │ +12{ │ │ │ │ │ +26 template │ │ │ │ │ +_2_7 class _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r │ │ │ │ │ +28 : public Iter │ │ │ │ │ +29 { │ │ │ │ │ +30 using Traits = std::iterator_traits; │ │ │ │ │ +31 static_assert(std::is_copy_constructible_v); │ │ │ │ │ +32 static_assert(std::is_base_of_v); │ │ │ │ │ +33 │ │ │ │ │ +34 public: │ │ │ │ │ +_3_6 using _s_i_z_e___t_y_p_e = typename Traits::difference_type; │ │ │ │ │ +37 │ │ │ │ │ +39 template , bool> = true> │ │ │ │ │ +_4_1 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r () │ │ │ │ │ +42 noexcept(_s_t_d::is_nothrow_default_constructible_v) │ │ │ │ │ +43 {} │ │ │ │ │ +44 │ │ │ │ │ +_4_7 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r (Iter it, _s_i_z_e___t_y_p_e _i_n_d_e_x = 0) │ │ │ │ │ +48 noexcept(_s_t_d::is_nothrow_copy_constructible_v) │ │ │ │ │ +49 : Iter(it) │ │ │ │ │ +50 , index_(_i_n_d_e_x) │ │ │ │ │ +51 {} │ │ │ │ │ +52 │ │ │ │ │ +_5_4 [[nodiscard]] constexpr _s_i_z_e___t_y_p_e _i_n_d_e_x () const noexcept │ │ │ │ │ +55 { │ │ │ │ │ +56 return index_; │ │ │ │ │ +57 } │ │ │ │ │ +58 │ │ │ │ │ +_6_0 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+_ () │ │ │ │ │ +61 { │ │ │ │ │ +62 Iter::operator++(); │ │ │ │ │ +63 ++index_; │ │ │ │ │ +64 return *this; │ │ │ │ │ +65 } │ │ │ │ │ +66 │ │ │ │ │ +_6_8 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_+_+_ (int) │ │ │ │ │ +69 { │ │ │ │ │ +70 _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r tmp(*this); │ │ │ │ │ +71 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +72 return tmp; │ │ │ │ │ +73 } │ │ │ │ │ +74 │ │ │ │ │ +76 template (), bool{}) = true> │ │ │ │ │ +_7_8 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r& operator-- () │ │ │ │ │ +79 { │ │ │ │ │ +80 Iter::operator--(); │ │ │ │ │ +81 --index_; │ │ │ │ │ +82 return *this; │ │ │ │ │ +83 } │ │ │ │ │ +84 │ │ │ │ │ +86 template ()--, bool{}) = true> │ │ │ │ │ +_8_8 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r operator-- (int) │ │ │ │ │ +89 { │ │ │ │ │ +90 _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r tmp(*this); │ │ │ │ │ +91 this->_o_p_e_r_a_t_o_r_-_-(); │ │ │ │ │ +92 return tmp; │ │ │ │ │ +93 } │ │ │ │ │ +94 │ │ │ │ │ +96 template ()+=1, bool{}) = true> │ │ │ │ │ +_9_8 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r& operator+= (typename Iter::difference_type n) │ │ │ │ │ +99 { │ │ │ │ │ +100 Iter::operator+=(n); │ │ │ │ │ +101 index_ += n; │ │ │ │ │ +102 return *this; │ │ │ │ │ +103 } │ │ │ │ │ +104 │ │ │ │ │ +106 template ()-=1, bool{}) = true> │ │ │ │ │ +_1_0_8 constexpr _I_n_d_e_x_e_d_I_t_e_r_a_t_o_r& operator-= (typename Iter::difference_type n) │ │ │ │ │ +109 { │ │ │ │ │ +110 Iter::operator-=(n); │ │ │ │ │ +111 index_ -= n; │ │ │ │ │ +112 return *this; │ │ │ │ │ +113 } │ │ │ │ │ +114 │ │ │ │ │ +115 private: │ │ │ │ │ +116 _s_i_z_e___t_y_p_e index_ = 0; │ │ │ │ │ +117 }; │ │ │ │ │ +118 │ │ │ │ │ +119} // end namespace Dune │ │ │ │ │ +120 │ │ │ │ │ +121#endif // DUNE_COMMON_INDEXEDITERATOR_HH │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r │ │ │ │ │ -A type for indexed access to elements of mdspan. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:24 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_d_a_t_a___h_a_n_d_l_e___t_y_p_e │ │ │ │ │ -element_type * data_handle_type │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -element_type & reference │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ -Element element_type │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r │ │ │ │ │ -constexpr default_accessor() noexcept=default │ │ │ │ │ -Default constructor. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_a_c_c_e_s_s │ │ │ │ │ -constexpr reference access(data_handle_type p, std::size_t i) const noexcept │ │ │ │ │ -Return a reference to the i'th element in the data range starting at p │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:42 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_:_:_o_f_f_s_e_t │ │ │ │ │ -constexpr data_handle_type offset(data_handle_type p, std::size_t i) const │ │ │ │ │ -noexcept │ │ │ │ │ -Return a data handle to the i'th element in the data range starting at p │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:48 │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r │ │ │ │ │ +An iterator mixin that adds an index() method returning an enumeration index │ │ │ │ │ +for the traversal. │ │ │ │ │ +DDeeffiinniittiioonn indexediterator.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +constexpr IndexedIterator & operator++() │ │ │ │ │ +Increment the iterator and the index. │ │ │ │ │ +DDeeffiinniittiioonn indexediterator.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ +constexpr IndexedIterator & operator--() │ │ │ │ │ +Decrement the iterator and the index. │ │ │ │ │ +DDeeffiinniittiioonn indexediterator.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ +constexpr size_type index() const noexcept │ │ │ │ │ +Return the enumeration index. │ │ │ │ │ +DDeeffiinniittiioonn indexediterator.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r │ │ │ │ │ +constexpr IndexedIterator() noexcept(std::is_nothrow_default_constructible_v< │ │ │ │ │ +Iter >) │ │ │ │ │ +Default constructor default-constructs the Iter base type and the index by 0. │ │ │ │ │ +DDeeffiinniittiioonn indexediterator.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r │ │ │ │ │ +constexpr IndexedIterator(Iter it, size_type index=0) noexcept(std:: │ │ │ │ │ +is_nothrow_copy_constructible_v< Iter >) │ │ │ │ │ +DDeeffiinniittiioonn indexediterator.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_e_d_I_t_e_r_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename Traits::difference_type size_type │ │ │ │ │ +Type used for storing the traversal index. │ │ │ │ │ +DDeeffiinniittiioonn indexediterator.hh:36 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: extents.hh File Reference │ │ │ │ +dune-common: assertandreturn.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,56 +65,32 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs
│ │ │ │ -
extents.hh File Reference
│ │ │ │ +Macros
│ │ │ │ +
assertandreturn.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <cassert>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/std/span.hh>
│ │ │ │ -#include <dune/common/std/impl/fwd_layouts.hh>
│ │ │ │ +
#include <cassert>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::Std::extents< IndexType, exts >
 Multidimensional index space with dynamic and static extents. More...
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Namespaces

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

│ │ │ │ -Typedefs

template<class IndexType , std::size_t R>
using Dune::Std::dextents = typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std::size_t, R > >::type
 Alias of extents of given rank R and purely dynamic extents. See [mdspan.extents.dextents].
 

│ │ │ │ +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.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +1,17 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -extents.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +_M_a_c_r_o_s │ │ │ │ │ +assertandreturn.hh File Reference │ │ │ │ │ #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_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_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_:_:_S_t_d_:_:_e_x_t_e_n_t_s_<_ _I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_ _> │ │ │ │ │ -  Multidimensional index space with dynamic and static extents. _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_:_:_S_t_d_:_:_d_e_x_t_e_n_t_s = typename Impl::DExtentsImpl< IndexType, std:: │ │ │ │ │ - make_integer_sequence< std::size_t, R > >::type │ │ │ │ │ -  Alias of extents of given rank R and purely dynamic extents. See │ │ │ │ │ - [mdspan.extents.dextents]. │ │ │ │ │ +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. │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: extents.hh Source File │ │ │ │ +dune-common: assertandreturn.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,289 +70,46 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
extents.hh
│ │ │ │ +
assertandreturn.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 © 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_EXTENTS_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_EXTENTS_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_ASSERTANDRETURN_HH
│ │ │ │ +
6#define DUNE_COMMON_ASSERTANDRETURN_HH
│ │ │ │
7
│ │ │ │ -
8#include <array>
│ │ │ │ -
9#include <cassert>
│ │ │ │ -
10#include <limits>
│ │ │ │ -
11#include <type_traits>
│ │ │ │ -
12#if __has_include(<version>)
│ │ │ │ -
13 #include <version>
│ │ │ │ -
14#endif
│ │ │ │ +
8#ifndef DUNE_DISABLE_DEPRECATION_WARNING_ASSERT_AND_RETURN
│ │ │ │ +
9#warning "The file assertandreturn.hh is deprecated. Since c++14 constexpr functions allow more \
│ │ │ │ +
10than a single return statement and thus this utility is useless. Will be removed after \
│ │ │ │ +
11Dune 2.10 release."
│ │ │ │ +
12#endif // DUNE_DISABLE_DEPRECATION_WARNING_ASSERT_AND_RETURN
│ │ │ │ +
13
│ │ │ │ +
14#include <cassert>
│ │ │ │
15
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
19
│ │ │ │ -
20namespace Dune::Std {
│ │ │ │ -
21namespace Impl {
│ │ │ │ -
22
│ │ │ │ -
23template <class IndexType, std::size_t n>
│ │ │ │ -
24struct DynamicExtentsArray
│ │ │ │ -
25{
│ │ │ │ -
26 using type = std::array<IndexType,n>;
│ │ │ │ -
27};
│ │ │ │ -
28
│ │ │ │ -
29template <class IndexType>
│ │ │ │ -
30struct DynamicExtentsArray<IndexType,0>
│ │ │ │ -
31{
│ │ │ │ -
32 // empty type with minimal array-like interface
│ │ │ │ -
33 struct type {
│ │ │ │ -
34 IndexType operator[](std::size_t /*i*/) const { return 0; }
│ │ │ │ -
35 };
│ │ │ │ -
36};
│ │ │ │ -
37
│ │ │ │ -
38} // end namespace Impl
│ │ │ │ -
39
│ │ │ │ -
40
│ │ │ │ -
52template <class IndexType, std::size_t... exts>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
54{
│ │ │ │ -
55 static_assert(std::is_integral_v<IndexType>);
│ │ │ │ -
56
│ │ │ │ -
57private:
│ │ │ │ -
58 static constexpr std::size_t rank_ = sizeof...(exts);
│ │ │ │ -
59 static constexpr std::size_t rank_dynamic_ = ((exts == Std::dynamic_extent) + ... + 0);
│ │ │ │ -
60
│ │ │ │ -
61 // this type is used internally to extract the static extents by index
│ │ │ │ -
62 using array_type = std::array<std::size_t,rank_>;
│ │ │ │ -
63
│ │ │ │ -
64 // store at position i how many extents in {exts[0],...,exts[i]} are dynamic_extent
│ │ │ │ -
65 static constexpr std::array<std::size_t,rank_+1> make_dynamic_index()
│ │ │ │ -
66 {
│ │ │ │ -
67 std::array<std::size_t,rank_+1> di{{}};
│ │ │ │ -
68 for (std::size_t i = 0; i < rank_; ++i)
│ │ │ │ -
69 di[i+1] = di[i] + (array_type{exts...}[i] == Std::dynamic_extent);
│ │ │ │ -
70 return di;
│ │ │ │ -
71 }
│ │ │ │ -
72
│ │ │ │ -
73 // An index mapping computed by `make_dynamic_index()` to get the position of a dynamic
│ │ │ │ -
74 // extent in {exts...} within the array dynamic_extents.
│ │ │ │ -
75 static constexpr std::array<std::size_t,rank_+1> dynamic_index_{make_dynamic_index()};
│ │ │ │ -
76
│ │ │ │ -
77public:
│ │ │ │ -
78 using rank_type = std::size_t;
│ │ │ │ -
79 using index_type = IndexType;
│ │ │ │ -
80 using size_type = std::make_unsigned_t<index_type>;
│ │ │ │ -
81
│ │ │ │ -
85
│ │ │ │ -
87 static constexpr rank_type rank () noexcept { return rank_; }
│ │ │ │ -
88
│ │ │ │ -
90 static constexpr rank_type rank_dynamic () noexcept { return rank_dynamic_; }
│ │ │ │ -
91
│ │ │ │ -
│ │ │ │ -
93 static constexpr std::size_t static_extent (rank_type r) noexcept
│ │ │ │ -
94 {
│ │ │ │ -
95 assert(rank() > 0 && r < rank());
│ │ │ │ -
96 return array_type{exts...}[r];
│ │ │ │ -
97 }
│ │ │ │ -
│ │ │ │ -
98
│ │ │ │ -
│ │ │ │ -
100 constexpr index_type extent (rank_type r) const noexcept
│ │ │ │ -
101 {
│ │ │ │ -
102 assert(rank() > 0 && r < rank());
│ │ │ │ -
103 if (std::size_t e = static_extent(r); e != Std::dynamic_extent)
│ │ │ │ -
104 return index_type(e);
│ │ │ │ -
105 else
│ │ │ │ -
106 return dynamic_extents_[dynamic_index_[r]];
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
110
│ │ │ │ -
111public:
│ │ │ │ -
114
│ │ │ │ -
116 constexpr extents () noexcept = default;
│ │ │ │ -
117
│ │ │ │ -
120 template <class... IndexTypes,
│ │ │ │ -
121 std::enable_if_t<(... && std::is_convertible_v<IndexTypes,index_type>), int> = 0,
│ │ │ │ -
122 std::enable_if_t<(sizeof...(IndexTypes) == rank() || sizeof...(IndexTypes) == rank_dynamic()), int> = 0,
│ │ │ │ -
123 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type, IndexTypes>), int> = 0>
│ │ │ │ -
│ │ │ │ -
124 constexpr explicit extents (IndexTypes... e) noexcept
│ │ │ │ -
125 {
│ │ │ │ -
126 init_dynamic_extents<sizeof...(e)>(std::array<index_type,sizeof...(e)>{index_type(e)...});
│ │ │ │ -
127 }
│ │ │ │ -
│ │ │ │ -
128
│ │ │ │ -
131 template <class I, std::size_t N,
│ │ │ │ -
132 std::enable_if_t<std::is_convertible_v<I, index_type>, int> = 0,
│ │ │ │ -
133 std::enable_if_t<(N == rank() || N == rank_dynamic()), int> = 0>
│ │ │ │ -
134 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
135 explicit(N != rank_dynamic())
│ │ │ │ -
136 #endif
│ │ │ │ -
│ │ │ │ -
137 constexpr extents (const std::array<I,N>& e) noexcept
│ │ │ │ -
138 {
│ │ │ │ -
139 init_dynamic_extents<N>(e);
│ │ │ │ -
140 }
│ │ │ │ -
│ │ │ │ -
141
│ │ │ │ -
144 template <class I, std::size_t N,
│ │ │ │ -
145 std::enable_if_t<std::is_convertible_v<I, index_type>, int> = 0,
│ │ │ │ -
146 std::enable_if_t<(N == rank() || N == rank_dynamic()), int> = 0,
│ │ │ │ -
147 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const I&>, int> = 0>
│ │ │ │ -
148 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
149 explicit(N != rank_dynamic())
│ │ │ │ -
150 #endif
│ │ │ │ -
│ │ │ │ -
151 constexpr extents (Std::span<I,N> e) noexcept
│ │ │ │ -
152 {
│ │ │ │ -
153 init_dynamic_extents<N>(e);
│ │ │ │ -
154 }
│ │ │ │ -
│ │ │ │ -
155
│ │ │ │ -
156 template <class I, std::size_t... e,
│ │ │ │ -
157 std::enable_if_t<(sizeof...(e) == rank()), int> = 0,
│ │ │ │ -
158 std::enable_if_t<((e == Std::dynamic_extent || exts == Std::dynamic_extent || e == exts) &&...), int> = 0>
│ │ │ │ -
159 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
160 explicit(
│ │ │ │ -
161 (( (exts != Std::dynamic_extent) && (e == Std::dynamic_extent)) || ... ) ||
│ │ │ │ -
162 (std::numeric_limits<index_type>::max() < std::numeric_limits<I>::max()))
│ │ │ │ -
163 #endif
│ │ │ │ -
│ │ │ │ -
164 constexpr extents (const extents<I,e...>& other) noexcept
│ │ │ │ -
165 {
│ │ │ │ -
166 init_dynamic_extents<sizeof...(e)>(as_array(other));
│ │ │ │ -
167 }
│ │ │ │ -
│ │ │ │ -
168
│ │ │ │ -
170
│ │ │ │ -
171
│ │ │ │ -
173 template <class OtherIndexType, std::size_t... otherExts>
│ │ │ │ -
│ │ │ │ -
174 friend constexpr bool operator== (const extents& a, const extents<OtherIndexType, otherExts...>& b) noexcept
│ │ │ │ -
175 {
│ │ │ │ -
176 if (a.rank() != b.rank())
│ │ │ │ -
177 return false;
│ │ │ │ -
178 using I = std::common_type_t<index_type, OtherIndexType>;
│ │ │ │ -
179 for (rank_type i = 0; i < rank(); ++i)
│ │ │ │ -
180 if (I(a.extent(i)) != I(b.extent(i)))
│ │ │ │ -
181 return false;
│ │ │ │ -
182 return true;
│ │ │ │ -
183 }
│ │ │ │ -
│ │ │ │ -
184
│ │ │ │ -
185private:
│ │ │ │ -
186#ifndef DOXYGEN
│ │ │ │ -
187 // The product of all extents
│ │ │ │ -
188 constexpr size_type product () const noexcept
│ │ │ │ -
189 {
│ │ │ │ -
190 size_type prod = 1;
│ │ │ │ -
191 for (rank_type i = 0; i < rank(); ++i)
│ │ │ │ -
192 prod *= extent(i);
│ │ │ │ -
193 return prod;
│ │ │ │ -
194 }
│ │ │ │ -
195
│ │ │ │ -
196 // A representation of all extents as an array
│ │ │ │ -
197 template <class OtherIndexType, std::size_t... otherExts>
│ │ │ │ -
198 static constexpr std::array<index_type,sizeof...(otherExts)>
│ │ │ │ -
199 as_array (const Std::extents<OtherIndexType,otherExts...>& e) noexcept
│ │ │ │ -
200 {
│ │ │ │ -
201 return unpackIntegerSequence([&](auto... ii) {
│ │ │ │ -
202 return std::array<index_type,sizeof...(otherExts)>{index_type(e.extent(ii))...}; },
│ │ │ │ -
203 std::make_index_sequence<sizeof...(otherExts)>{});
│ │ │ │ -
204 }
│ │ │ │ -
205
│ │ │ │ -
206 // Copy only the dynamic extents from the container `e` into the `dynamic_extents_` storage
│ │ │ │ -
207 template <std::size_t N, class Container>
│ │ │ │ -
208 constexpr void init_dynamic_extents (const Container& e) noexcept
│ │ │ │ -
209 {
│ │ │ │ -
210 if constexpr(rank_dynamic() > 0) {
│ │ │ │ -
211 if constexpr(N == rank_dynamic()) {
│ │ │ │ -
212 assert(e.size() == rank_dynamic());
│ │ │ │ -
213 for (rank_type i = 0; i < rank_dynamic(); ++i)
│ │ │ │ -
214 dynamic_extents_[i] = e[i];
│ │ │ │ -
215 } else {
│ │ │ │ -
216 assert(e.size() == rank());
│ │ │ │ -
217 for (rank_type i = 0, j = 0; i < rank(); ++i) {
│ │ │ │ - │ │ │ │ -
219 dynamic_extents_[j++] = e[i];
│ │ │ │ -
220 }
│ │ │ │ -
221 }
│ │ │ │ -
222 }
│ │ │ │ -
223 }
│ │ │ │ -
224#endif // DOXYGEN
│ │ │ │ -
225
│ │ │ │ -
226private:
│ │ │ │ -
227 using dynamic_extents_type = typename Impl::DynamicExtentsArray<index_type,rank_dynamic()>::type;
│ │ │ │ -
228 [[no_unique_address]] dynamic_extents_type dynamic_extents_;
│ │ │ │ -
229
│ │ │ │ -
230 template <class, std::size_t...> friend class extents;
│ │ │ │ -
231 friend struct layout_left;
│ │ │ │ -
232 friend struct layout_right;
│ │ │ │ -
233 friend struct layout_stride;
│ │ │ │ -
234};
│ │ │ │ -
│ │ │ │ -
235
│ │ │ │ -
236
│ │ │ │ -
237namespace Impl {
│ │ │ │ -
238
│ │ │ │ -
239template <class IndexType, class Seq>
│ │ │ │ -
240struct DExtentsImpl;
│ │ │ │ -
241
│ │ │ │ -
242template <class IndexType, std::size_t... I>
│ │ │ │ -
243struct DExtentsImpl<IndexType, std::integer_sequence<std::size_t,I...>>
│ │ │ │ -
244{
│ │ │ │ -
245 template <std::size_t>
│ │ │ │ -
246 using dynamic = std::integral_constant<std::size_t,Std::dynamic_extent>;
│ │ │ │ - │ │ │ │ -
248};
│ │ │ │ -
249
│ │ │ │ -
250} // end namespace Impl
│ │ │ │ -
251
│ │ │ │ -
252
│ │ │ │ -
258template <class IndexType, std::size_t R>
│ │ │ │ -
259using dextents = typename Impl::DExtentsImpl<IndexType, std::make_integer_sequence<std::size_t,R>>::type;
│ │ │ │ -
260
│ │ │ │ -
261} // end namespace Dune::Std
│ │ │ │ -
262
│ │ │ │ -
263#endif // DUNE_COMMON_STD_EXTENTS_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
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:124
│ │ │ │ -
typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std::size_t, R > >::type dextents
Alias of extents of given rank R and purely dynamic extents. See [mdspan.extents.dextents].
Definition extents.hh:259
│ │ │ │ -
STL namespace.
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
constexpr std::size_t dynamic_extent
A constant of type std::size_t that is used to differentiate std::span of static and dynamic extent.
Definition span.hh:26
│ │ │ │ -
Multidimensional index space with dynamic and static extents.
Definition extents.hh:54
│ │ │ │ -
static constexpr rank_type rank_dynamic() noexcept
The number of dimensions with dynamic extent.
Definition extents.hh:90
│ │ │ │ -
constexpr extents(const extents< I, e... > &other) noexcept
Definition extents.hh:164
│ │ │ │ -
std::size_t rank_type
Definition extents.hh:78
│ │ │ │ -
constexpr extents() noexcept=default
The default constructor requires that all exts are not Std::dynamic_extent.
│ │ │ │ -
static constexpr rank_type rank() noexcept
The total number of dimensions.
Definition extents.hh:87
│ │ │ │ -
friend struct layout_stride
Definition extents.hh:233
│ │ │ │ -
friend struct layout_left
Definition extents.hh:231
│ │ │ │ -
friend struct layout_right
Definition extents.hh:232
│ │ │ │ -
friend constexpr bool operator==(const extents &a, const extents< OtherIndexType, otherExts... > &b) noexcept
Compare two extents by their rank and all individual extents.
Definition extents.hh:174
│ │ │ │ -
std::make_unsigned_t< index_type > size_type
Definition extents.hh:80
│ │ │ │ -
static constexpr std::size_t static_extent(rank_type r) noexcept
Return the static extent of dimension r or Std::dynamic_extent
Definition extents.hh:93
│ │ │ │ -
friend class extents
Definition extents.hh:230
│ │ │ │ -
constexpr index_type extent(rank_type r) const noexcept
Return the extent of dimension i
Definition extents.hh:100
│ │ │ │ -
IndexType index_type
Definition extents.hh:79
│ │ │ │ -
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │ +
17
│ │ │ │ +
26#ifdef NDEBUG
│ │ │ │ +
27 #define DUNE_ASSERT_AND_RETURN(C,X) X
│ │ │ │ +
28#else
│ │ │ │ +
29 #define DUNE_ASSERT_AND_RETURN(C,X) (!(C) ? throw [&](){assert(!#C);return 0;}() : 0), X
│ │ │ │ +
30#endif
│ │ │ │ +
31
│ │ │ │ +
32
│ │ │ │ +
33
│ │ │ │ +
34#endif // DUNE_COMMON_ASSERTANDRETURN_HH
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,334 +1,39 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -extents.hh │ │ │ │ │ +assertandreturn.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 © 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_EXTENTS_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_EXTENTS_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_ASSERTANDRETURN_HH │ │ │ │ │ +6#define DUNE_COMMON_ASSERTANDRETURN_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#if __has_include() │ │ │ │ │ -13 #include │ │ │ │ │ -14#endif │ │ │ │ │ +8#ifndef DUNE_DISABLE_DEPRECATION_WARNING_ASSERT_AND_RETURN │ │ │ │ │ +9#warning "The file assertandreturn.hh is deprecated. Since c++14 constexpr │ │ │ │ │ +functions allow more \ │ │ │ │ │ +10than a single return statement and thus this utility is useless. Will be │ │ │ │ │ +removed after \ │ │ │ │ │ +11Dune 2.10 release." │ │ │ │ │ +12#endif // DUNE_DISABLE_DEPRECATION_WARNING_ASSERT_AND_RETURN │ │ │ │ │ +13 │ │ │ │ │ +14#include │ │ │ │ │ 15 │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -17#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ -18#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_f_w_d___l_a_y_o_u_t_s_._h_h> │ │ │ │ │ -19 │ │ │ │ │ -20namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ -21namespace Impl { │ │ │ │ │ -22 │ │ │ │ │ -23template │ │ │ │ │ -24struct DynamicExtentsArray │ │ │ │ │ -25{ │ │ │ │ │ -26 using type = std::array; │ │ │ │ │ -27}; │ │ │ │ │ -28 │ │ │ │ │ -29template │ │ │ │ │ -30struct DynamicExtentsArray │ │ │ │ │ -31{ │ │ │ │ │ -32 // empty type with minimal array-like interface │ │ │ │ │ -33 struct type { │ │ │ │ │ -34 IndexType operator[](std::size_t /*i*/) const { return 0; } │ │ │ │ │ -35 }; │ │ │ │ │ -36}; │ │ │ │ │ -37 │ │ │ │ │ -38} // end namespace Impl │ │ │ │ │ -39 │ │ │ │ │ -40 │ │ │ │ │ -52template │ │ │ │ │ -_5_3class _e_x_t_e_n_t_s │ │ │ │ │ -54{ │ │ │ │ │ -55 static_assert(std::is_integral_v); │ │ │ │ │ -56 │ │ │ │ │ -57private: │ │ │ │ │ -58 static constexpr std::size_t rank_ = sizeof...(exts); │ │ │ │ │ -59 static constexpr std::size_t rank_dynamic_ = ((exts == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -+ ... + 0); │ │ │ │ │ -60 │ │ │ │ │ -61 // this type is used internally to extract the static extents by index │ │ │ │ │ -62 using array_type = std::array; │ │ │ │ │ -63 │ │ │ │ │ -64 // store at position i how many extents in {exts[0],...,exts[i]} are │ │ │ │ │ -dynamic_extent │ │ │ │ │ -65 static constexpr std::array make_dynamic_index() │ │ │ │ │ -66 { │ │ │ │ │ -67 std::array di{{}}; │ │ │ │ │ -68 for (std::size_t i = 0; i < rank_; ++i) │ │ │ │ │ -69 di[i+1] = di[i] + (array_type{exts...}[i] == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t); │ │ │ │ │ -70 return di; │ │ │ │ │ -71 } │ │ │ │ │ -72 │ │ │ │ │ -73 // An index mapping computed by `make_dynamic_index()` to get the position │ │ │ │ │ -of a dynamic │ │ │ │ │ -74 // extent in {exts...} within the array dynamic_extents. │ │ │ │ │ -75 static constexpr std::array dynamic_index_ │ │ │ │ │ -{make_dynamic_index()}; │ │ │ │ │ -76 │ │ │ │ │ -77public: │ │ │ │ │ -_7_8 using _r_a_n_k___t_y_p_e = std::size_t; │ │ │ │ │ -_7_9 using _i_n_d_e_x___t_y_p_e = IndexType; │ │ │ │ │ -_8_0 using _s_i_z_e___t_y_p_e = std::make_unsigned_t; │ │ │ │ │ -81 │ │ │ │ │ -85 │ │ │ │ │ -_8_7 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k () noexcept { return rank_; } │ │ │ │ │ -88 │ │ │ │ │ -_9_0 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k___d_y_n_a_m_i_c () noexcept { return rank_dynamic_; │ │ │ │ │ -} │ │ │ │ │ -91 │ │ │ │ │ -_9_3 static constexpr std::size_t _s_t_a_t_i_c___e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) noexcept │ │ │ │ │ -94 { │ │ │ │ │ -95 assert(_r_a_n_k() > 0 && r < _r_a_n_k()); │ │ │ │ │ -96 return array_type{exts...}[r]; │ │ │ │ │ -97 } │ │ │ │ │ -98 │ │ │ │ │ -_1_0_0 constexpr _i_n_d_e_x___t_y_p_e _e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) const noexcept │ │ │ │ │ -101 { │ │ │ │ │ -102 assert(_r_a_n_k() > 0 && r < _r_a_n_k()); │ │ │ │ │ -103 if (std::size_t e = _s_t_a_t_i_c___e_x_t_e_n_t(r); e != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -104 return _i_n_d_e_x___t_y_p_e(e); │ │ │ │ │ -105 else │ │ │ │ │ -106 return dynamic_extents_[dynamic_index_[r]]; │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -110 │ │ │ │ │ -111public: │ │ │ │ │ -114 │ │ │ │ │ -_1_1_6 constexpr _e_x_t_e_n_t_s () noexcept = default; │ │ │ │ │ -117 │ │ │ │ │ -120 template ), │ │ │ │ │ -int> = 0, │ │ │ │ │ -122 _s_t_d::enable_if_t<(sizeof...(IndexTypes) == _r_a_n_k() || sizeof...(IndexTypes) │ │ │ │ │ -== _r_a_n_k___d_y_n_a_m_i_c()), int> = 0, │ │ │ │ │ -123 _s_t_d::enable_if_t<(... && _s_t_d::is_nothrow_constructible_v<_i_n_d_e_x___t_y_p_e, │ │ │ │ │ -IndexTypes>), int> = 0> │ │ │ │ │ -_1_2_4 constexpr explicit _e_x_t_e_n_t_s (IndexTypes... e) noexcept │ │ │ │ │ -125 { │ │ │ │ │ -126 init_dynamic_extents(std::array<_i_n_d_e_x___t_y_p_e,sizeof...(e)> │ │ │ │ │ -{_i_n_d_e_x___t_y_p_e(e)...}); │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -131 template , int> = 0, │ │ │ │ │ -133 std::enable_if_t<(N == _r_a_n_k() || N == _r_a_n_k___d_y_n_a_m_i_c()), int> = 0> │ │ │ │ │ -134 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -135 explicit(N != _r_a_n_k___d_y_n_a_m_i_c()) │ │ │ │ │ -136 #endif │ │ │ │ │ -_1_3_7 constexpr _e_x_t_e_n_t_s (const std::array& e) noexcept │ │ │ │ │ -138 { │ │ │ │ │ -139 init_dynamic_extents(e); │ │ │ │ │ -140 } │ │ │ │ │ -141 │ │ │ │ │ -144 template , int> = 0, │ │ │ │ │ -146 std::enable_if_t<(N == _r_a_n_k() || N == _r_a_n_k___d_y_n_a_m_i_c()), int> = 0, │ │ │ │ │ -147 std::enable_if_t, │ │ │ │ │ -int> = 0> │ │ │ │ │ -148 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -149 explicit(N != _r_a_n_k___d_y_n_a_m_i_c()) │ │ │ │ │ -150 #endif │ │ │ │ │ -_1_5_1 constexpr _e_x_t_e_n_t_s (_S_t_d_:_:_s_p_a_n_<_I_,_N_> e) noexcept │ │ │ │ │ -152 { │ │ │ │ │ -153 init_dynamic_extents(e); │ │ │ │ │ -154 } │ │ │ │ │ -155 │ │ │ │ │ -156 template = 0, │ │ │ │ │ -158 std::enable_if_t<((e == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || exts == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t │ │ │ │ │ -|| e == exts) &&...), int> = 0> │ │ │ │ │ -159 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -160 explicit( │ │ │ │ │ -161 (( (exts != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) && (e == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t)) || ... ) || │ │ │ │ │ -162 (std::numeric_limits::max() < std::numeric_limits::max())) │ │ │ │ │ -163 #endif │ │ │ │ │ -_1_6_4 constexpr _e_x_t_e_n_t_s (const _e_x_t_e_n_t_s_<_I_,_e_._._._>& other) noexcept │ │ │ │ │ -165 { │ │ │ │ │ -166 init_dynamic_extents(as_array(other)); │ │ │ │ │ -167 } │ │ │ │ │ -168 │ │ │ │ │ -170 │ │ │ │ │ -171 │ │ │ │ │ -173 template │ │ │ │ │ -_1_7_4 friend constexpr bool _o_p_e_r_a_t_o_r_=_=_ (const _e_x_t_e_n_t_s& a, const │ │ │ │ │ -_e_x_t_e_n_t_s_<_O_t_h_e_r_I_n_d_e_x_T_y_p_e_,_ _o_t_h_e_r_E_x_t_s_._._._>& b) noexcept │ │ │ │ │ -175 { │ │ │ │ │ -176 if (a.rank() != b.rank()) │ │ │ │ │ -177 return false; │ │ │ │ │ -178 using I = std::common_type_t; │ │ │ │ │ -179 for (_r_a_n_k___t_y_p_e i = 0; i < _r_a_n_k(); ++i) │ │ │ │ │ -180 if (I(a.extent(i)) != I(b.extent(i))) │ │ │ │ │ -181 return false; │ │ │ │ │ -182 return true; │ │ │ │ │ -183 } │ │ │ │ │ -184 │ │ │ │ │ -185private: │ │ │ │ │ -186#ifndef DOXYGEN │ │ │ │ │ -187 // The product of all extents │ │ │ │ │ -188 constexpr _s_i_z_e___t_y_p_e product () const noexcept │ │ │ │ │ -189 { │ │ │ │ │ -190 _s_i_z_e___t_y_p_e prod = 1; │ │ │ │ │ -191 for (_r_a_n_k___t_y_p_e i = 0; i < _r_a_n_k(); ++i) │ │ │ │ │ -192 prod *= _e_x_t_e_n_t(i); │ │ │ │ │ -193 return prod; │ │ │ │ │ -194 } │ │ │ │ │ -195 │ │ │ │ │ -196 // A representation of all extents as an array │ │ │ │ │ -197 template │ │ │ │ │ -198 static constexpr std::array<_i_n_d_e_x___t_y_p_e,sizeof...(otherExts)> │ │ │ │ │ -199 as_array (const _S_t_d_:_:_e_x_t_e_n_t_s_<_O_t_h_e_r_I_n_d_e_x_T_y_p_e_,_o_t_h_e_r_E_x_t_s_._._._>& e) noexcept │ │ │ │ │ -200 { │ │ │ │ │ -201 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... ii) { │ │ │ │ │ -202 return std::array<_i_n_d_e_x___t_y_p_e,sizeof...(otherExts)>{_i_n_d_e_x___t_y_p_e(e._e_x_t_e_n_t │ │ │ │ │ -(ii))...}; }, │ │ │ │ │ -203 std::make_index_sequence{}); │ │ │ │ │ -204 } │ │ │ │ │ -205 │ │ │ │ │ -206 // Copy only the dynamic extents from the container `e` into the │ │ │ │ │ -`dynamic_extents_` storage │ │ │ │ │ -207 template │ │ │ │ │ -208 constexpr void init_dynamic_extents (const Container& e) noexcept │ │ │ │ │ -209 { │ │ │ │ │ -210 if constexpr(_r_a_n_k___d_y_n_a_m_i_c() > 0) { │ │ │ │ │ -211 if constexpr(N == _r_a_n_k___d_y_n_a_m_i_c()) { │ │ │ │ │ -212 assert(e.size() == _r_a_n_k___d_y_n_a_m_i_c()); │ │ │ │ │ -213 for (_r_a_n_k___t_y_p_e i = 0; i < _r_a_n_k___d_y_n_a_m_i_c(); ++i) │ │ │ │ │ -214 dynamic_extents_[i] = e[i]; │ │ │ │ │ -215 } else { │ │ │ │ │ -216 assert(e.size() == _r_a_n_k()); │ │ │ │ │ -217 for (_r_a_n_k___t_y_p_e i = 0, j = 0; i < _r_a_n_k(); ++i) { │ │ │ │ │ -218 if (_s_t_a_t_i_c___e_x_t_e_n_t(i) == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -219 dynamic_extents_[j++] = e[i]; │ │ │ │ │ -220 } │ │ │ │ │ -221 } │ │ │ │ │ -222 } │ │ │ │ │ -223 } │ │ │ │ │ -224#endif // DOXYGEN │ │ │ │ │ -225 │ │ │ │ │ -226private: │ │ │ │ │ -227 using dynamic_extents_type = typename Impl:: │ │ │ │ │ -DynamicExtentsArray<_i_n_d_e_x___t_y_p_e,_r_a_n_k___d_y_n_a_m_i_c()>::type; │ │ │ │ │ -228 [[no_unique_address]] dynamic_extents_type dynamic_extents_; │ │ │ │ │ -229 │ │ │ │ │ -_2_3_0 template friend class _e_x_t_e_n_t_s; │ │ │ │ │ -_2_3_1 friend struct _l_a_y_o_u_t___l_e_f_t; │ │ │ │ │ -_2_3_2 friend struct _l_a_y_o_u_t___r_i_g_h_t; │ │ │ │ │ -_2_3_3 friend struct _l_a_y_o_u_t___s_t_r_i_d_e; │ │ │ │ │ -234}; │ │ │ │ │ -235 │ │ │ │ │ -236 │ │ │ │ │ -237namespace Impl { │ │ │ │ │ -238 │ │ │ │ │ -239template │ │ │ │ │ -240struct DExtentsImpl; │ │ │ │ │ -241 │ │ │ │ │ -242template │ │ │ │ │ -243struct DExtentsImpl> │ │ │ │ │ -244{ │ │ │ │ │ -245 template │ │ │ │ │ -246 using dynamic = std::integral_constant; │ │ │ │ │ -247 using type = _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _d_y_n_a_m_i_c_<_I_>_:_:_v_a_l_u_e...>; │ │ │ │ │ -248}; │ │ │ │ │ -249 │ │ │ │ │ -250} // end namespace Impl │ │ │ │ │ -251 │ │ │ │ │ -252 │ │ │ │ │ -258template │ │ │ │ │ -_2_5_9using _d_e_x_t_e_n_t_s = typename Impl::DExtentsImpl>::type; │ │ │ │ │ -260 │ │ │ │ │ -261} // end namespace Dune::Std │ │ │ │ │ -262 │ │ │ │ │ -263#endif // DUNE_COMMON_STD_EXTENTS_HH │ │ │ │ │ -_f_w_d___l_a_y_o_u_t_s_._h_h │ │ │ │ │ -_s_p_a_n_._h_h │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_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:124 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_x_t_e_n_t_s │ │ │ │ │ -typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std:: │ │ │ │ │ -size_t, R > >::type dextents │ │ │ │ │ -Alias of extents of given rank R and purely dynamic extents. See │ │ │ │ │ -[mdspan.extents.dextents]. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:259 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t │ │ │ │ │ -constexpr std::size_t dynamic_extent │ │ │ │ │ -A constant of type std::size_t that is used to differentiate std::span of │ │ │ │ │ -static and dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s │ │ │ │ │ -Multidimensional index space with dynamic and static extents. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_r_a_n_k___d_y_n_a_m_i_c │ │ │ │ │ -static constexpr rank_type rank_dynamic() noexcept │ │ │ │ │ -The number of dimensions with dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr extents(const extents< I, e... > &other) noexcept │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:164 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ -std::size_t rank_type │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr extents() noexcept=default │ │ │ │ │ -The default constructor requires that all exts are not Std::dynamic_extent. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_r_a_n_k │ │ │ │ │ -static constexpr rank_type rank() noexcept │ │ │ │ │ -The total number of dimensions. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ -friend struct layout_stride │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:233 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_l_a_y_o_u_t___l_e_f_t │ │ │ │ │ -friend struct layout_left │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:231 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ -friend struct layout_right │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:232 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -friend constexpr bool operator==(const extents &a, const extents< │ │ │ │ │ -OtherIndexType, otherExts... > &b) noexcept │ │ │ │ │ -Compare two extents by their rank and all individual extents. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:174 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::make_unsigned_t< index_type > size_type │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_s_t_a_t_i_c___e_x_t_e_n_t │ │ │ │ │ -static constexpr std::size_t static_extent(rank_type r) noexcept │ │ │ │ │ -Return the static extent of dimension r or Std::dynamic_extent │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_e_x_t_e_n_t_s │ │ │ │ │ -friend class extents │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_e_x_t_e_n_t │ │ │ │ │ -constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ -Return the extent of dimension i │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ -IndexType index_type │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:79 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ -A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ +17 │ │ │ │ │ +26#ifdef NDEBUG │ │ │ │ │ +27 #define DUNE_ASSERT_AND_RETURN(C,X) X │ │ │ │ │ +28#else │ │ │ │ │ +_2_9 #define DUNE_ASSERT_AND_RETURN(C,X) (!(C) ? throw [&](){assert(!#C);return │ │ │ │ │ +0;}() : 0), X │ │ │ │ │ +30#endif │ │ │ │ │ +31 │ │ │ │ │ +32 │ │ │ │ │ +33 │ │ │ │ │ +34#endif // DUNE_COMMON_ASSERTANDRETURN_HH │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: containerconstructiontraits.hh File Reference │ │ │ │ +dune-common: iteratorrange.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,37 +65,38 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces
│ │ │ │ -
containerconstructiontraits.hh File Reference
│ │ │ │ +
iteratorrange.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <cassert>
│ │ │ │ -#include <cstddef>
│ │ │ │ -
│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::IteratorRange< Iterator >
 Simple range between a begin and an end iterator. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,23 +1,19 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ - * _i_m_p_l │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -containerconstructiontraits.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_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_._._. │ │ │ │ │ +  │ │ │ │ │ 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/a00143_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: containerconstructiontraits.hh Source File │ │ │ │ +dune-common: iteratorrange.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,81 +70,88 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
containerconstructiontraits.hh
│ │ │ │ +
iteratorrange.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 © 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_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_ITERATORRANGE_HH
│ │ │ │ +
6#define DUNE_COMMON_ITERATORRANGE_HH
│ │ │ │
7
│ │ │ │ -
8#include <array>
│ │ │ │ -
9#include <cassert>
│ │ │ │ -
10#include <cstddef>
│ │ │ │ +
8namespace Dune {
│ │ │ │ +
9
│ │ │ │
11
│ │ │ │ -
12namespace Dune::Std {
│ │ │ │ -
13namespace Impl {
│ │ │ │ -
14
│ │ │ │ -
20template <class Container>
│ │ │ │ -
21struct ContainerConstructionTraits
│ │ │ │ -
22{
│ │ │ │ -
23 using container_type = Container;
│ │ │ │ -
24 using value_type = typename container_type::value_type;
│ │ │ │ +
20 template<typename Iterator>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
22 {
│ │ │ │ +
23
│ │ │ │ +
24 public:
│ │ │ │
25
│ │ │ │ -
26 static constexpr container_type construct (std::size_t size)
│ │ │ │ -
27 {
│ │ │ │ -
28 return container_type(size);
│ │ │ │ -
29 }
│ │ │ │ +
27 typedef Iterator iterator;
│ │ │ │ +
28
│ │ │ │
30
│ │ │ │ -
31 static constexpr container_type construct (std::size_t size, value_type value)
│ │ │ │ -
32 {
│ │ │ │ -
33 return container_type(size, value);
│ │ │ │ -
34 }
│ │ │ │ -
35};
│ │ │ │ -
36
│ │ │ │ -
37template <class Value, std::size_t N>
│ │ │ │ -
38struct ContainerConstructionTraits<std::array<Value,N>>
│ │ │ │ -
39{
│ │ │ │ -
40 using container_type = std::array<Value,N>;
│ │ │ │ -
41 using value_type = typename container_type::value_type;
│ │ │ │ -
42
│ │ │ │ -
43 static constexpr container_type construct ([[maybe_unused]] std::size_t size)
│ │ │ │ -
44 {
│ │ │ │ -
45 assert(size <= N);
│ │ │ │ -
46 return container_type{};
│ │ │ │ -
47 }
│ │ │ │ -
48
│ │ │ │ -
49 static constexpr container_type construct ([[maybe_unused]] std::size_t size, value_type value)
│ │ │ │ -
50 {
│ │ │ │ -
51 assert(size <= N);
│ │ │ │ -
52 container_type c{};
│ │ │ │ -
53 for (auto& c_i : c)
│ │ │ │ -
54 c_i = value;
│ │ │ │ -
55 return c;
│ │ │ │ -
56 }
│ │ │ │ -
57};
│ │ │ │ +
33 typedef Iterator const_iterator;
│ │ │ │ +
34
│ │ │ │ +
│ │ │ │ +
36 IteratorRange(const Iterator& begin, const Iterator& end)
│ │ │ │ +
37 : _begin(begin)
│ │ │ │ +
38 , _end(end)
│ │ │ │ +
39 {}
│ │ │ │ +
│ │ │ │ +
40
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
43 {}
│ │ │ │ +
│ │ │ │ +
44
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
47 {
│ │ │ │ +
48 return _begin;
│ │ │ │ +
49 }
│ │ │ │ +
│ │ │ │ +
50
│ │ │ │ +
│ │ │ │ +
52 iterator end() const
│ │ │ │ +
53 {
│ │ │ │ +
54 return _end;
│ │ │ │ +
55 }
│ │ │ │ +
│ │ │ │ +
56
│ │ │ │ +
57 private:
│ │ │ │
58
│ │ │ │ -
59} // end namespace Impl
│ │ │ │ -
60} // end namespace Dune::Std
│ │ │ │ +
59 Iterator _begin;
│ │ │ │ +
60 Iterator _end;
│ │ │ │
61
│ │ │ │ -
62#endif // DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH
│ │ │ │ -
STL namespace.
│ │ │ │ -
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ +
62 };
│ │ │ │ +
│ │ │ │ +
63
│ │ │ │ +
64}
│ │ │ │ +
65
│ │ │ │ +
66#endif // DUNE_COMMON_ITERATORRANGE_HH
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
Simple range between a begin and an end iterator.
Definition iteratorrange.hh:22
│ │ │ │ +
iterator begin() const
Returns an iterator pointing to the begin of the range.
Definition iteratorrange.hh:46
│ │ │ │ +
Iterator const_iterator
The iterator belonging to this range.
Definition iteratorrange.hh:33
│ │ │ │ +
iterator end() const
Returns an iterator pointing past the end of the range.
Definition iteratorrange.hh:52
│ │ │ │ +
IteratorRange()
Default constructor, relies on iterators being default-constructible.
Definition iteratorrange.hh:42
│ │ │ │ +
Iterator iterator
The iterator belonging to this range.
Definition iteratorrange.hh:27
│ │ │ │ +
IteratorRange(const Iterator &begin, const Iterator &end)
Constructs an iterator range on [begin,end).
Definition iteratorrange.hh:36
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,83 +1,90 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ - * _i_m_p_l │ │ │ │ │ -containerconstructiontraits.hh │ │ │ │ │ +iteratorrange.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 © 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_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_ITERATORRANGE_HH │ │ │ │ │ +6#define DUNE_COMMON_ITERATORRANGE_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ +8namespace _D_u_n_e { │ │ │ │ │ +9 │ │ │ │ │ 11 │ │ │ │ │ -12namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ -13namespace Impl { │ │ │ │ │ -14 │ │ │ │ │ -20template │ │ │ │ │ -21struct ContainerConstructionTraits │ │ │ │ │ -22{ │ │ │ │ │ -23 using container_type = Container; │ │ │ │ │ -24 using value_type = typename container_type::value_type; │ │ │ │ │ +20 template │ │ │ │ │ +_2_1 class _I_t_e_r_a_t_o_r_R_a_n_g_e │ │ │ │ │ +22 { │ │ │ │ │ +23 │ │ │ │ │ +24 public: │ │ │ │ │ 25 │ │ │ │ │ -26 static constexpr container_type construct (std::size_t _s_i_z_e) │ │ │ │ │ -27 { │ │ │ │ │ -28 return container_type(_s_i_z_e); │ │ │ │ │ -29 } │ │ │ │ │ +_2_7 typedef Iterator _i_t_e_r_a_t_o_r; │ │ │ │ │ +28 │ │ │ │ │ 30 │ │ │ │ │ -31 static constexpr container_type construct (std::size_t _s_i_z_e, value_type │ │ │ │ │ -value) │ │ │ │ │ -32 { │ │ │ │ │ -33 return container_type(_s_i_z_e, value); │ │ │ │ │ -34 } │ │ │ │ │ -35}; │ │ │ │ │ -36 │ │ │ │ │ -37template │ │ │ │ │ -38struct ContainerConstructionTraits<_s_t_d::array> │ │ │ │ │ -39{ │ │ │ │ │ -40 using container_type = std::array; │ │ │ │ │ -41 using value_type = typename container_type::value_type; │ │ │ │ │ -42 │ │ │ │ │ -43 static constexpr container_type construct ([[maybe_unused]] std::size_t │ │ │ │ │ -_s_i_z_e) │ │ │ │ │ -44 { │ │ │ │ │ -45 assert(_s_i_z_e <= N); │ │ │ │ │ -46 return container_type{}; │ │ │ │ │ -47 } │ │ │ │ │ -48 │ │ │ │ │ -49 static constexpr container_type construct ([[maybe_unused]] std::size_t │ │ │ │ │ -_s_i_z_e, value_type value) │ │ │ │ │ -50 { │ │ │ │ │ -51 assert(_s_i_z_e <= N); │ │ │ │ │ -52 container_type c{}; │ │ │ │ │ -53 for (auto& c_i : c) │ │ │ │ │ -54 c_i = value; │ │ │ │ │ -55 return c; │ │ │ │ │ -56 } │ │ │ │ │ -57}; │ │ │ │ │ +_3_3 typedef Iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +34 │ │ │ │ │ +_3_6 _I_t_e_r_a_t_o_r_R_a_n_g_e(const Iterator& _b_e_g_i_n, const Iterator& _e_n_d) │ │ │ │ │ +37 : _begin(_b_e_g_i_n) │ │ │ │ │ +38 , _end(_e_n_d) │ │ │ │ │ +39 {} │ │ │ │ │ +40 │ │ │ │ │ +_4_2 _I_t_e_r_a_t_o_r_R_a_n_g_e() │ │ │ │ │ +43 {} │ │ │ │ │ +44 │ │ │ │ │ +_4_6 _i_t_e_r_a_t_o_r _b_e_g_i_n() const │ │ │ │ │ +47 { │ │ │ │ │ +48 return _begin; │ │ │ │ │ +49 } │ │ │ │ │ +50 │ │ │ │ │ +_5_2 _i_t_e_r_a_t_o_r _e_n_d() const │ │ │ │ │ +53 { │ │ │ │ │ +54 return _end; │ │ │ │ │ +55 } │ │ │ │ │ +56 │ │ │ │ │ +57 private: │ │ │ │ │ 58 │ │ │ │ │ -59} // end namespace Impl │ │ │ │ │ -60} // end namespace Dune::Std │ │ │ │ │ +59 Iterator _begin; │ │ │ │ │ +60 Iterator _end; │ │ │ │ │ 61 │ │ │ │ │ -62#endif // DUNE_COMMON_STD_IMPL_CONTAINER_CONSTRUCTION_TRAITS_HH │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ -_D_u_n_e_:_:_s_i_z_e │ │ │ │ │ -constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std:: │ │ │ │ │ -integer_sequence< T, II... >) │ │ │ │ │ -Return the size of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn integersequence.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ +62 }; │ │ │ │ │ +63 │ │ │ │ │ +64} │ │ │ │ │ +65 │ │ │ │ │ +66#endif // DUNE_COMMON_ITERATORRANGE_HH │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e │ │ │ │ │ +Simple range between a begin and an end iterator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorrange.hh:22 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() const │ │ │ │ │ +Returns an iterator pointing to the begin of the range. │ │ │ │ │ +DDeeffiinniittiioonn iteratorrange.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +Iterator const_iterator │ │ │ │ │ +The iterator belonging to this range. │ │ │ │ │ +DDeeffiinniittiioonn iteratorrange.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_R_a_n_g_e_:_:_e_n_d │ │ │ │ │ +iterator end() const │ │ │ │ │ +Returns an iterator pointing past the end of the range. │ │ │ │ │ +DDeeffiinniittiioonn iteratorrange.hh:52 │ │ │ │ │ +_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_R_a_n_g_e │ │ │ │ │ +IteratorRange() │ │ │ │ │ +Default constructor, relies on iterators being default-constructible. │ │ │ │ │ +DDeeffiinniittiioonn iteratorrange.hh:42 │ │ │ │ │ +_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 │ │ │ │ │ +Iterator iterator │ │ │ │ │ +The iterator belonging to this range. │ │ │ │ │ +DDeeffiinniittiioonn iteratorrange.hh:27 │ │ │ │ │ +_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_R_a_n_g_e │ │ │ │ │ +IteratorRange(const Iterator &begin, const Iterator &end) │ │ │ │ │ +Constructs an iterator range on [begin,end). │ │ │ │ │ +DDeeffiinniittiioonn iteratorrange.hh:36 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: fwd_layouts.hh File Reference │ │ │ │ +dune-common: enumset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,48 +65,77 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
fwd_layouts.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
enumset.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ +

Classes for building sets out of enumeration values. │ │ │ │ +More...

│ │ │ │ +
#include <iostream>
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Std::layout_left
 A layout where the leftmost extent has stride 1. More...
class  Dune::EmptySet< TA >
 An empty set. More...
 
class  Dune::AllSet< TA >
 A set containing everything. More...
 
class  Dune::EnumItem< TA, item >
 A set consisting only of one item. More...
 
struct  Dune::Std::layout_right
 A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product of extents. More...
class  Dune::EnumRange< TA, from, end >
 A set representing a range including the borders. More...
 
struct  Dune::Std::layout_stride
 A layout mapping where the strides are user-defined. More...
class  Dune::NegateSet< S >
 The negation of a set. An item is contained in the set if and only if it is not contained in the negated set. More...
 
class  Dune::Combine< TI1, TI2, TA >
 A set combining two other sets. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<typename TA , int i>
std::ostream & Dune::operator<< (std::ostream &os, const EnumItem< TA, i > &)
 
template<typename TA , int from, int to>
std::ostream & Dune::operator<< (std::ostream &os, const EnumRange< TA, from, to > &)
 
template<class TI1 , class TI2 >
Combine< TI1, TI2, typename TI1::Type > Dune::combine (const TI1 &set1, const TI2 &set2)
 
template<class TI1 , class TI2 , class T >
std::ostream & Dune::operator<< (std::ostream &os, const Combine< TI1, TI2, T > &)
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Classes for building sets out of enumeration values.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,31 +1,58 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ - * _i_m_p_l │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -fwd_layouts.hh File Reference │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +enumset.hh File Reference │ │ │ │ │ +Classes for building sets out of enumeration values. _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_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t │ │ │ │ │ -  A layout where the leftmost extent has stride 1. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_E_m_p_t_y_S_e_t_<_ _T_A_ _> │ │ │ │ │ +  An empty set. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ -  A layout where the rightmost extent has stride 1, and strides increase │ │ │ │ │ - right-to-left as the product of extents. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_A_l_l_S_e_t_<_ _T_A_ _> │ │ │ │ │ +  A set containing everything. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ -  A layout mapping where the strides are user-defined. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_E_n_u_m_I_t_e_m_<_ _T_A_,_ _i_t_e_m_ _> │ │ │ │ │ +  A set consisting only of one item. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_E_n_u_m_R_a_n_g_e_<_ _T_A_,_ _f_r_o_m_,_ _e_n_d_ _> │ │ │ │ │ +  A set representing a range including the borders. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_N_e_g_a_t_e_S_e_t_<_ _S_ _> │ │ │ │ │ +  The negation of a set. An item is contained in the set if and only if │ │ │ │ │ + it is not contained in the negated set. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_C_o_m_b_i_n_e_<_ _T_I_1_,_ _T_I_2_,_ _T_A_ _> │ │ │ │ │ +  A set combining two other sets. _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. │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ + std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, │ │ │ │ │ + const _E_n_u_m_I_t_e_m< TA, i > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, │ │ │ │ │ + const _E_n_u_m_R_a_n_g_e< TA, from, to > &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +_C_o_m_b_i_n_e< TI1, TI2, typename TI1::Type >  _D_u_n_e_:_:_c_o_m_b_i_n_e (const TI1 &set1, const │ │ │ │ │ + TI2 &set2) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, │ │ │ │ │ + const _C_o_m_b_i_n_e< TI1, TI2, T > &) │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Classes for building sets out of enumeration values. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: fwd_layouts.hh Source File │ │ │ │ +dune-common: enumset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,64 +70,194 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
fwd_layouts.hh
│ │ │ │ +
enumset.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 © 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_IMPL_FWD_LAYOUTS_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH
│ │ │ │ +
5#ifndef DUNE_ENUMSET_HH
│ │ │ │ +
6#define DUNE_ENUMSET_HH
│ │ │ │
7
│ │ │ │ -
8namespace Dune::Std {
│ │ │ │ +
8#include <iostream>
│ │ │ │
9
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
17{
│ │ │ │ -
18 template <class Extents>
│ │ │ │ -
19 class mapping;
│ │ │ │ -
20};
│ │ │ │ -
│ │ │ │ -
21
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
30{
│ │ │ │ -
31 template <class Extents>
│ │ │ │ -
32 class mapping;
│ │ │ │ -
33};
│ │ │ │ -
│ │ │ │ -
34
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
40{
│ │ │ │ -
41 template <class Extents>
│ │ │ │ -
42 class mapping;
│ │ │ │ -
43};
│ │ │ │ -
│ │ │ │ -
44
│ │ │ │ -
45} // end namespace Dune::Std
│ │ │ │ -
46
│ │ │ │ -
47#endif // DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
A layout where the leftmost extent has stride 1.
Definition fwd_layouts.hh:17
│ │ │ │ -
A layout mapping where the leftmost extent has stride 1.
Definition layout_left.hh:19
│ │ │ │ -
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ -
A layout mapping where the rightmost extent has stride 1.
Definition layout_right.hh:19
│ │ │ │ -
A layout mapping where the strides are user-defined.
Definition fwd_layouts.hh:40
│ │ │ │ -
A layout mapping where the strides are user-defined.
Definition layout_stride.hh:19
│ │ │ │ +
10namespace Dune
│ │ │ │ +
11{
│ │ │ │ +
25 template<typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
27 {
│ │ │ │ +
28 public:
│ │ │ │ +
32 typedef TA Type;
│ │ │ │ +
36 static bool contains(const Type& attribute);
│ │ │ │ +
37 };
│ │ │ │ +
│ │ │ │ +
38
│ │ │ │ +
42 template<typename TA>
│ │ │ │ +
│ │ │ │ +
43 class AllSet
│ │ │ │ +
44 {
│ │ │ │ +
45 public:
│ │ │ │ +
49 typedef TA Type;
│ │ │ │ +
53 static bool contains(const Type& attribute);
│ │ │ │ +
54 };
│ │ │ │ +
│ │ │ │ +
55
│ │ │ │ +
59 template<typename TA, int item>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
61 {
│ │ │ │ +
62 public:
│ │ │ │ +
66 typedef TA Type;
│ │ │ │ +
67
│ │ │ │ +
72 static bool contains(const Type& attribute);
│ │ │ │ +
73 };
│ │ │ │ +
│ │ │ │ +
74
│ │ │ │ +
78 template<typename TA,int from, int end>
│ │ │ │ +
│ │ │ │ +
79 class EnumRange //: public PODSet<EnumRange<T,from,end>,T>
│ │ │ │ +
80 {
│ │ │ │ +
81 public:
│ │ │ │ +
85 typedef TA Type;
│ │ │ │ +
86 static bool contains(const Type& item);
│ │ │ │ +
87 };
│ │ │ │ +
│ │ │ │ +
88
│ │ │ │ +
94 template<typename S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
96 {
│ │ │ │ +
97 public:
│ │ │ │ +
98 typedef typename S::Type Type;
│ │ │ │ +
99
│ │ │ │ +
│ │ │ │ +
100 static bool contains(const Type& item)
│ │ │ │ +
101 {
│ │ │ │ +
102 return !S::contains(item);
│ │ │ │ +
103 }
│ │ │ │ +
│ │ │ │ +
104 };
│ │ │ │ +
│ │ │ │ +
105
│ │ │ │ +
109 template<class TI1, class TI2, typename TA=typename TI1::Type>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
111 {
│ │ │ │ +
112 public:
│ │ │ │ +
113 static bool contains(const TA& item);
│ │ │ │ +
114 };
│ │ │ │ +
│ │ │ │ +
115
│ │ │ │ +
116 template<typename TA>
│ │ │ │ +
│ │ │ │ +
117 inline bool EmptySet<TA>::contains([[maybe_unused]] const Type& attribute)
│ │ │ │ +
118 {
│ │ │ │ +
119 return false;
│ │ │ │ +
120 }
│ │ │ │ +
│ │ │ │ +
121
│ │ │ │ +
122 template<typename TA>
│ │ │ │ +
│ │ │ │ +
123 inline bool AllSet<TA>::contains([[maybe_unused]] const Type& attribute)
│ │ │ │ +
124 {
│ │ │ │ +
125 return true;
│ │ │ │ +
126 }
│ │ │ │ +
│ │ │ │ +
127
│ │ │ │ +
128 template<typename TA,int i>
│ │ │ │ +
│ │ │ │ +
129 inline bool EnumItem<TA,i>::contains(const Type& item)
│ │ │ │ +
130 {
│ │ │ │ +
131 return item==i;
│ │ │ │ +
132 }
│ │ │ │ +
│ │ │ │ +
133
│ │ │ │ +
134 template<typename TA,int i>
│ │ │ │ +
│ │ │ │ +
135 inline std::ostream& operator<<(std::ostream& os, const EnumItem<TA,i>&)
│ │ │ │ +
136 {
│ │ │ │ +
137 return os<<i;
│ │ │ │ +
138 }
│ │ │ │ +
│ │ │ │ +
139
│ │ │ │ +
140 template<typename TA, int from, int to>
│ │ │ │ +
│ │ │ │ +
141 inline bool EnumRange<TA,from,to>::contains(const Type& item)
│ │ │ │ +
142 {
│ │ │ │ +
143 return from<=item && item<=to;
│ │ │ │ +
144 }
│ │ │ │ +
│ │ │ │ +
145
│ │ │ │ +
146 template<typename TA, int from, int to>
│ │ │ │ +
│ │ │ │ +
147 inline std::ostream& operator<<(std::ostream& os, const EnumRange<TA,from,to>&)
│ │ │ │ +
148 {
│ │ │ │ +
149 return os<<"["<<from<<" - "<<to<<"]";
│ │ │ │ +
150 }
│ │ │ │ +
│ │ │ │ +
151
│ │ │ │ +
152 template<class TI1, class TI2, typename TA>
│ │ │ │ +
│ │ │ │ +
153 inline bool Combine<TI1,TI2,TA>::contains(const TA& item)
│ │ │ │ +
154 {
│ │ │ │ +
155 return TI1::contains(item) ||
│ │ │ │ +
156 TI2::contains(item);
│ │ │ │ +
157 }
│ │ │ │ +
│ │ │ │ +
158
│ │ │ │ +
159 template<class TI1, class TI2>
│ │ │ │ +
│ │ │ │ +
160 inline Combine<TI1,TI2,typename TI1::Type> combine([[maybe_unused]] const TI1& set1,
│ │ │ │ +
161 [[maybe_unused]] const TI2& set2)
│ │ │ │ +
162 {
│ │ │ │ + │ │ │ │ +
164 }
│ │ │ │ +
│ │ │ │ +
165
│ │ │ │ +
166 template<class TI1, class TI2, class T>
│ │ │ │ +
│ │ │ │ +
167 inline std::ostream& operator<<(std::ostream& os, const Combine<TI1,TI2,T>&)
│ │ │ │ +
168 {
│ │ │ │ +
169 return os << TI1()<<" "<<TI2();
│ │ │ │ +
170 }
│ │ │ │ +
│ │ │ │ +
172}
│ │ │ │ +
173
│ │ │ │ +
174#endif
│ │ │ │ +
static bool contains(const Type &attribute)
Always returns true.
Definition enumset.hh:123
│ │ │ │ +
static bool contains(const Type &item)
Definition enumset.hh:141
│ │ │ │ +
static bool contains(const TA &item)
Definition enumset.hh:153
│ │ │ │ +
static bool contains(const Type &attribute)
Always returns false.
Definition enumset.hh:117
│ │ │ │ +
static bool contains(const Type &attribute)
Tests whether an item is in the set.
Definition enumset.hh:129
│ │ │ │ +
Combine< TI1, TI2, typename TI1::Type > combine(const TI1 &set1, const TI2 &set2)
Definition enumset.hh:160
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
An empty set.
Definition enumset.hh:27
│ │ │ │ +
TA Type
The POD type the set holds.
Definition enumset.hh:32
│ │ │ │ +
A set containing everything.
Definition enumset.hh:44
│ │ │ │ +
TA Type
The POD type the set holds.
Definition enumset.hh:49
│ │ │ │ +
A set consisting only of one item.
Definition enumset.hh:61
│ │ │ │ +
TA Type
The type the set holds.
Definition enumset.hh:66
│ │ │ │ +
A set representing a range including the borders.
Definition enumset.hh:80
│ │ │ │ +
TA Type
The type the set holds.
Definition enumset.hh:85
│ │ │ │ +
The negation of a set. An item is contained in the set if and only if it is not contained in the nega...
Definition enumset.hh:96
│ │ │ │ +
S::Type Type
Definition enumset.hh:98
│ │ │ │ +
static bool contains(const Type &item)
Definition enumset.hh:100
│ │ │ │ +
A set combining two other sets.
Definition enumset.hh:111
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,65 +1,204 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ - * _i_m_p_l │ │ │ │ │ -fwd_layouts.hh │ │ │ │ │ +enumset.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 © 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_IMPL_FWD_LAYOUTS_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH │ │ │ │ │ +5#ifndef DUNE_ENUMSET_HH │ │ │ │ │ +6#define DUNE_ENUMSET_HH │ │ │ │ │ 7 │ │ │ │ │ -8namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +8#include │ │ │ │ │ 9 │ │ │ │ │ -_1_6struct _l_a_y_o_u_t___l_e_f_t │ │ │ │ │ -17{ │ │ │ │ │ -18 template │ │ │ │ │ -19 class _m_a_p_p_i_n_g; │ │ │ │ │ -20}; │ │ │ │ │ -21 │ │ │ │ │ -_2_9struct _l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ -30{ │ │ │ │ │ -31 template │ │ │ │ │ -32 class _m_a_p_p_i_n_g; │ │ │ │ │ -33}; │ │ │ │ │ -34 │ │ │ │ │ -_3_9struct _l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ -40{ │ │ │ │ │ -41 template │ │ │ │ │ -42 class _m_a_p_p_i_n_g; │ │ │ │ │ -43}; │ │ │ │ │ -44 │ │ │ │ │ -45} // end namespace Dune::Std │ │ │ │ │ -46 │ │ │ │ │ -47#endif // DUNE_COMMON_STD_IMPL_FWD_LAYOUTS_HH │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t │ │ │ │ │ -A layout where the leftmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___l_e_f_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the leftmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn layout_left.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ -A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ -to-left as the product o... │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the rightmost extent has stride 1. │ │ │ │ │ -DDeeffiinniittiioonn layout_right.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e │ │ │ │ │ -A layout mapping where the strides are user-defined. │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___s_t_r_i_d_e_:_:_m_a_p_p_i_n_g │ │ │ │ │ -A layout mapping where the strides are user-defined. │ │ │ │ │ -DDeeffiinniittiioonn layout_stride.hh:19 │ │ │ │ │ +10namespace _D_u_n_e │ │ │ │ │ +11{ │ │ │ │ │ +25 template │ │ │ │ │ +_2_6 class _E_m_p_t_y_S_e_t │ │ │ │ │ +27 { │ │ │ │ │ +28 public: │ │ │ │ │ +_3_2 typedef TA _T_y_p_e; │ │ │ │ │ +36 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& attribute); │ │ │ │ │ +37 }; │ │ │ │ │ +38 │ │ │ │ │ +42 template │ │ │ │ │ +_4_3 class _A_l_l_S_e_t │ │ │ │ │ +44 { │ │ │ │ │ +45 public: │ │ │ │ │ +_4_9 typedef TA _T_y_p_e; │ │ │ │ │ +53 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& attribute); │ │ │ │ │ +54 }; │ │ │ │ │ +55 │ │ │ │ │ +59 template │ │ │ │ │ +_6_0 class _E_n_u_m_I_t_e_m │ │ │ │ │ +61 { │ │ │ │ │ +62 public: │ │ │ │ │ +_6_6 typedef TA _T_y_p_e; │ │ │ │ │ +67 │ │ │ │ │ +72 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& attribute); │ │ │ │ │ +73 }; │ │ │ │ │ +74 │ │ │ │ │ +78 template │ │ │ │ │ +_7_9 class _E_n_u_m_R_a_n_g_e //: public PODSet,T> │ │ │ │ │ +80 { │ │ │ │ │ +81 public: │ │ │ │ │ +_8_5 typedef TA _T_y_p_e; │ │ │ │ │ +86 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& item); │ │ │ │ │ +87 }; │ │ │ │ │ +88 │ │ │ │ │ +94 template │ │ │ │ │ +_9_5 class _N_e_g_a_t_e_S_e_t │ │ │ │ │ +96 { │ │ │ │ │ +97 public: │ │ │ │ │ +_9_8 typedef typename S::Type _T_y_p_e; │ │ │ │ │ +99 │ │ │ │ │ +_1_0_0 static bool _c_o_n_t_a_i_n_s(const _T_y_p_e& item) │ │ │ │ │ +101 { │ │ │ │ │ +102 return !S::contains(item); │ │ │ │ │ +103 } │ │ │ │ │ +104 }; │ │ │ │ │ +105 │ │ │ │ │ +109 template │ │ │ │ │ +_1_1_0 class _C_o_m_b_i_n_e │ │ │ │ │ +111 { │ │ │ │ │ +112 public: │ │ │ │ │ +113 static bool _c_o_n_t_a_i_n_s(const TA& item); │ │ │ │ │ +114 }; │ │ │ │ │ +115 │ │ │ │ │ +116 template │ │ │ │ │ +_1_1_7 inline bool _E_m_p_t_y_S_e_t_<_T_A_>_:_:_c_o_n_t_a_i_n_s([[maybe_unused]] const _T_y_p_e& attribute) │ │ │ │ │ +118 { │ │ │ │ │ +119 return false; │ │ │ │ │ +120 } │ │ │ │ │ +121 │ │ │ │ │ +122 template │ │ │ │ │ +_1_2_3 inline bool _A_l_l_S_e_t_<_T_A_>_:_:_c_o_n_t_a_i_n_s([[maybe_unused]] const _T_y_p_e& attribute) │ │ │ │ │ +124 { │ │ │ │ │ +125 return true; │ │ │ │ │ +126 } │ │ │ │ │ +127 │ │ │ │ │ +128 template │ │ │ │ │ +_1_2_9 inline bool _E_n_u_m_I_t_e_m_<_T_A_,_i_>_:_:_c_o_n_t_a_i_n_s(const _T_y_p_e& item) │ │ │ │ │ +130 { │ │ │ │ │ +131 return item==i; │ │ │ │ │ +132 } │ │ │ │ │ +133 │ │ │ │ │ +134 template │ │ │ │ │ +_1_3_5 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_n_u_m_I_t_e_m_<_T_A_,_i_>&) │ │ │ │ │ +136 { │ │ │ │ │ +137 return os< │ │ │ │ │ +_1_4_1 inline bool _E_n_u_m_R_a_n_g_e_<_T_A_,_f_r_o_m_,_t_o_>_:_:_c_o_n_t_a_i_n_s(const _T_y_p_e& item) │ │ │ │ │ +142 { │ │ │ │ │ +143 return from<=item && item<=to; │ │ │ │ │ +144 } │ │ │ │ │ +145 │ │ │ │ │ +146 template │ │ │ │ │ +_1_4_7 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const │ │ │ │ │ +_E_n_u_m_R_a_n_g_e_<_T_A_,_f_r_o_m_,_t_o_>&) │ │ │ │ │ +148 { │ │ │ │ │ +149 return os<<"["< │ │ │ │ │ +_1_5_3 inline bool _C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_T_A_>_:_:_c_o_n_t_a_i_n_s(const TA& item) │ │ │ │ │ +154 { │ │ │ │ │ +155 return TI1::contains(item) || │ │ │ │ │ +156 TI2::contains(item); │ │ │ │ │ +157 } │ │ │ │ │ +158 │ │ │ │ │ +159 template │ │ │ │ │ +_1_6_0 inline _C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_t_y_p_e_n_a_m_e_ _T_I_1_:_:_T_y_p_e_> _c_o_m_b_i_n_e([[maybe_unused]] const │ │ │ │ │ +TI1& set1, │ │ │ │ │ +161 [[maybe_unused]] const TI2& set2) │ │ │ │ │ +162 { │ │ │ │ │ +163 return _C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_t_y_p_e_n_a_m_e_ _T_I_1_:_:_T_y_p_e_>(); │ │ │ │ │ +164 } │ │ │ │ │ +165 │ │ │ │ │ +166 template │ │ │ │ │ +_1_6_7 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const │ │ │ │ │ +_C_o_m_b_i_n_e_<_T_I_1_,_T_I_2_,_T_>&) │ │ │ │ │ +168 { │ │ │ │ │ +169 return os << TI1()<<" "< combine(const TI1 &set1, const TI2 │ │ │ │ │ +&set2) │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:160 │ │ │ │ │ +_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_:_:_E_m_p_t_y_S_e_t │ │ │ │ │ +An empty set. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_E_m_p_t_y_S_e_t_:_:_T_y_p_e │ │ │ │ │ +TA Type │ │ │ │ │ +The POD type the set holds. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_A_l_l_S_e_t │ │ │ │ │ +A set containing everything. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_A_l_l_S_e_t_:_:_T_y_p_e │ │ │ │ │ +TA Type │ │ │ │ │ +The POD type the set holds. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_E_n_u_m_I_t_e_m │ │ │ │ │ +A set consisting only of one item. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_E_n_u_m_I_t_e_m_:_:_T_y_p_e │ │ │ │ │ +TA Type │ │ │ │ │ +The type the set holds. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_E_n_u_m_R_a_n_g_e │ │ │ │ │ +A set representing a range including the borders. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_E_n_u_m_R_a_n_g_e_:_:_T_y_p_e │ │ │ │ │ +TA Type │ │ │ │ │ +The type the set holds. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_N_e_g_a_t_e_S_e_t │ │ │ │ │ +The negation of a set. An item is contained in the set if and only if it is not │ │ │ │ │ +contained in the nega... │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_N_e_g_a_t_e_S_e_t_:_:_T_y_p_e │ │ │ │ │ +S::Type Type │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:98 │ │ │ │ │ +_D_u_n_e_:_:_N_e_g_a_t_e_S_e_t_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ +static bool contains(const Type &item) │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_b_i_n_e │ │ │ │ │ +A set combining two other sets. │ │ │ │ │ +DDeeffiinniittiioonn enumset.hh:111 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: span.hh File Reference │ │ │ │ +dune-common: binaryfunctions.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,84 +65,46 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions | │ │ │ │ -Variables
│ │ │ │ -
span.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
binaryfunctions.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <cassert>
│ │ │ │ -#include <cstddef>
│ │ │ │ -#include <exception>
│ │ │ │ -#include <iterator>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <stdexcept>
│ │ │ │ -#include <string>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/std/memory.hh>
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#include <algorithm>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Std::span< Element, Extent >
 A contiguous sequence of elements with static or dynamic extent. More...
struct  Dune::Min< Type >
 
struct  Dune::Max< Type >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<class T , std::size_t N>
 Dune::Std::span (T(&)[N]) -> span< T, N >
 
template<class ElementType , class I , std::size_t Extent, std::enable_if_t< std::is_convertible_v< I, std::size_t >, int > = 0>
 Dune::Std::span (ElementType *, std::integral_constant< I, Extent >) -> span< ElementType, Extent >
 
template<class ElementType , class I , std::enable_if_t< std::is_integral_v< I >, int > = 0, std::enable_if_t< std::is_convertible_v< I, std::size_t >, int > = 0>
 Dune::Std::span (ElementType *, I) -> span< ElementType, Std::dynamic_extent >
 
template<class Iter , class Element = std::remove_reference_t<decltype(*std::declval<Iter>())>>
 Dune::Std::span (Iter, Iter) -> span< Element, Std::dynamic_extent >
 
template<class Range , class First = decltype(std::begin(std::declval<Range>())), class Last = decltype(std::end(std::declval<Range>())), class Element = std::remove_reference_t<decltype(*std::declval<First>())>>
 Dune::Std::span (Range &) -> span< Element, Std::dynamic_extent >
 
template<class T , size_t N>
 Dune::Std::span (std::array< T, N > &) -> span< T, N >
 
template<class T , size_t N>
 Dune::Std::span (const std::array< T, N > &) -> span< const T, N >
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Variables

constexpr std::size_t Dune::Std::dynamic_extent = std::numeric_limits<std::size_t>::max()
 A constant of type std::size_t that is used to differentiate std::span of static and dynamic extent.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

helper classes to provide unique types for standard functions

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,70 +1,24 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 | _F_u_n_c_t_i_o_n_s | _V_a_r_i_a_b_l_e_s │ │ │ │ │ -span.hh File Reference │ │ │ │ │ -#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> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ +_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 │ │ │ │ │ -class   _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_<_ _E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_ _> │ │ │ │ │ -  A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_M_i_n_<_ _T_y_p_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_x_<_ _T_y_p_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. │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (T(&)[N]) -> _s_p_a_n< T, N > │ │ │ │ │ -  │ │ │ │ │ -template, int > = 0> │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (ElementType *, std::integral_constant< I, Extent >) -> _s_p_a_n< │ │ │ │ │ - ElementType, Extent > │ │ │ │ │ -  │ │ │ │ │ -template, int > = 0, std::enable_if_t< std::is_convertible_v< I, std::size_t >, int > │ │ │ │ │ -= 0> │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (ElementType *, I) -> _s_p_a_n< ElementType, _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t │ │ │ │ │ - > │ │ │ │ │ -  │ │ │ │ │ -template())>> │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (Iter, Iter) -> _s_p_a_n< Element, _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -())), class Last = decltype(std::end(std::declval())), class Element = │ │ │ │ │ -std::remove_reference_t())>> │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (Range &) -> _s_p_a_n< Element, _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (std::array< T, N > &) -> _s_p_a_n< T, N > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_s_p_a_n (const std::array< T, N > &) -> _s_p_a_n< const T, N > │ │ │ │ │ -  │ │ │ │ │ -VVaarriiaabblleess │ │ │ │ │ -constexpr std::size_t  _D_u_n_e_:_:_S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t = std::numeric_limits::max() │ │ │ │ │ -  A constant of type std::size_t that is used to │ │ │ │ │ - differentiate std::span of static and dynamic extent. │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +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/a00149_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: span.hh Source File │ │ │ │ +dune-common: binaryfunctions.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,464 +70,85 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
span.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 © 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_SPAN_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_SPAN_HH
│ │ │ │ +
5#ifndef DUNE_BINARYFUNCTIONS_HH
│ │ │ │ +
6#define DUNE_BINARYFUNCTIONS_HH
│ │ │ │
7
│ │ │ │ -
8#include <cassert>
│ │ │ │ -
9#include <cstddef>
│ │ │ │ -
10#include <exception>
│ │ │ │ -
11#include <iterator>
│ │ │ │ -
12#include <limits>
│ │ │ │ -
13#include <stdexcept>
│ │ │ │ -
14#include <string>
│ │ │ │ -
15#include <type_traits>
│ │ │ │ -
16#if __has_include(<version>)
│ │ │ │ -
17 #include <version>
│ │ │ │ -
18#endif
│ │ │ │ -
19
│ │ │ │ - │ │ │ │ - │ │ │ │ +
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
│ │ │ │ -
23namespace Dune::Std {
│ │ │ │ +
23 using result_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │
24
│ │ │ │ -
26inline constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max();
│ │ │ │ -
27
│ │ │ │ -
28namespace Impl {
│ │ │ │ -
29
│ │ │ │ -
30template <std::size_t Extent>
│ │ │ │ -
31class SpanSize
│ │ │ │ -
32{
│ │ │ │ -
33public:
│ │ │ │ -
34 using size_type = std::size_t;
│ │ │ │ -
35
│ │ │ │ -
36public:
│ │ │ │ -
37 constexpr SpanSize () = default;
│ │ │ │ +
│ │ │ │ +
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;
│ │ │ │ +
36
│ │ │ │ +
37 using second_argument_type [[deprecated("This type alias is deprecated following similar deprecations in C++17")]] = Type;
│ │ │ │
38
│ │ │ │ -
39 constexpr SpanSize ([[maybe_unused]] size_type size) noexcept
│ │ │ │ -
40 {
│ │ │ │ -
41 assert(Extent == Std::dynamic_extent || Extent == size);
│ │ │ │ -
42 }
│ │ │ │ -
43
│ │ │ │ -
44 template <class Iter>
│ │ │ │ -
45 constexpr SpanSize ([[maybe_unused]] Iter first, [[maybe_unused]] Iter last) noexcept
│ │ │ │ -
46 {
│ │ │ │ -
47 assert((std::distance(first,last) == Extent));
│ │ │ │ -
48 }
│ │ │ │ -
49
│ │ │ │ -
50 constexpr size_type size () const noexcept { return Extent; }
│ │ │ │ -
51};
│ │ │ │ -
52
│ │ │ │ -
53template <>
│ │ │ │ -
54class SpanSize<Std::dynamic_extent>
│ │ │ │ -
55{
│ │ │ │ -
56public:
│ │ │ │ -
57 using size_type = std::size_t;
│ │ │ │ -
58
│ │ │ │ -
59public:
│ │ │ │ -
60 constexpr SpanSize (size_type size = 0) noexcept
│ │ │ │ -
61 : size_(size)
│ │ │ │ -
62 {}
│ │ │ │ -
63
│ │ │ │ -
64 template <class Iter>
│ │ │ │ -
65 constexpr SpanSize (Iter first, Iter last) noexcept
│ │ │ │ -
66 : size_(std::distance(first,last))
│ │ │ │ -
67 {}
│ │ │ │ -
68
│ │ │ │ -
69 constexpr size_type size () const noexcept { return size_; }
│ │ │ │ -
70
│ │ │ │ -
71private:
│ │ │ │ -
72 size_type size_;
│ │ │ │ -
73};
│ │ │ │ -
74
│ │ │ │ -
75template <class T>
│ │ │ │ -
76struct TypeIdentity { using type = T; };
│ │ │ │ -
77
│ │ │ │ -
78template <class T>
│ │ │ │ -
79using TypeIdentity_t = typename TypeIdentity<T>::type;
│ │ │ │ -
80
│ │ │ │ -
81} // end namespace Impl
│ │ │ │ -
82
│ │ │ │ -
83
│ │ │ │ -
123template <class Element, std::size_t Extent = Std::dynamic_extent>
│ │ │ │ -
│ │ │ │ -
124class span
│ │ │ │ -
125 : public Impl::SpanSize<Extent>
│ │ │ │ -
126{
│ │ │ │ -
127 using base_type = Impl::SpanSize<Extent>; // base_type implements the member variable size()
│ │ │ │ -
128
│ │ │ │ -
129 static_assert(std::is_object_v<Element> && !std::is_abstract_v<Element>);
│ │ │ │ -
130
│ │ │ │ -
131public:
│ │ │ │ -
132 using element_type = Element;
│ │ │ │ -
133 using value_type = std::remove_cv_t<element_type>;
│ │ │ │ -
134 using size_type = std::size_t;
│ │ │ │ -
135 using difference_type = std::ptrdiff_t;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
140 using reverse_iterator = std::reverse_iterator<iterator>;
│ │ │ │ -
141#if __cpp_lib_ranges_as_const >202311L
│ │ │ │ -
142 using const_iterator = std::const_iterator<iterator>;
│ │ │ │ -
143 using const_reverse_iterator = std::const_iterator<reverse_iterator>;
│ │ │ │ -
144#else
│ │ │ │ - │ │ │ │ -
146 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
│ │ │ │ -
147#endif
│ │ │ │ -
148
│ │ │ │ -
149
│ │ │ │ -
150 static constexpr size_type extent = Extent;
│ │ │ │ -
151
│ │ │ │ -
152public:
│ │ │ │ -
155
│ │ │ │ -
157 template <std::size_t e = extent,
│ │ │ │ -
158 std::enable_if_t<(e == dynamic_extent || e == 0), int> = 0>
│ │ │ │ -
│ │ │ │ -
159 constexpr span () noexcept
│ │ │ │ -
160 : base_type{}
│ │ │ │ -
161 , data_{}
│ │ │ │ -
162 {}
│ │ │ │ -
│ │ │ │ -
163
│ │ │ │ -
165 template <class Iter,
│ │ │ │ -
166 class U = std::remove_reference_t<decltype(*std::declval<Iter>())>,
│ │ │ │ -
167 std::enable_if_t<std::is_convertible_v<U(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ -
168 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
169 explicit(extent != Std::dynamic_extent)
│ │ │ │ -
170 #endif
│ │ │ │ -
│ │ │ │ -
171 constexpr span (Iter first, size_type size)
│ │ │ │ -
172 : base_type(size)
│ │ │ │ -
173 , data_(Std::to_address(first))
│ │ │ │ -
174 {}
│ │ │ │ -
│ │ │ │ -
175
│ │ │ │ -
177 template <class Iter,
│ │ │ │ -
178 class U = std::remove_reference_t<decltype(*std::declval<Iter>())>,
│ │ │ │ -
179 std::enable_if_t<std::is_convertible_v<U(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ -
180 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
181 explicit(extent != Std::dynamic_extent)
│ │ │ │ -
182 #endif
│ │ │ │ -
│ │ │ │ -
183 constexpr span (Iter first, Iter last)
│ │ │ │ -
184 : base_type(first,last)
│ │ │ │ -
185 , data_(Std::to_address(first))
│ │ │ │ -
186 {}
│ │ │ │ -
│ │ │ │ -
187
│ │ │ │ -
189 template <class Range,
│ │ │ │ -
190 decltype(std::begin(std::declval<Range>()), std::end(std::declval<Range>()), bool{}) = true,
│ │ │ │ -
191 std::enable_if_t<not std::is_array_v<Range>, int> = 0>
│ │ │ │ -
192 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
193 explicit(extent != Std::dynamic_extent)
│ │ │ │ -
194 #endif
│ │ │ │ -
│ │ │ │ -
195 constexpr span (Range& range)
│ │ │ │ -
196 : span(std::begin(range), std::end(range))
│ │ │ │ -
197 {}
│ │ │ │ -
│ │ │ │ -
198
│ │ │ │ -
200 template <std::size_t N, std::size_t e = extent,
│ │ │ │ -
201 std::enable_if_t<(e == Std::dynamic_extent || e == N), int> = 0>
│ │ │ │ -
│ │ │ │ -
202 constexpr span (Impl::TypeIdentity_t<element_type> (&data)[N]) noexcept
│ │ │ │ -
203 : base_type(N)
│ │ │ │ -
204 , data_(data)
│ │ │ │ -
205 {}
│ │ │ │ -
│ │ │ │ -
206
│ │ │ │ -
208 template <class T, size_t N, std::size_t e = extent,
│ │ │ │ -
209 std::enable_if_t<(e == Std::dynamic_extent || e == N), int> = 0,
│ │ │ │ -
210 std::enable_if_t<std::is_convertible_v<T(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ -
│ │ │ │ -
211 constexpr span (std::array<T, N>& arr) noexcept
│ │ │ │ -
212 : base_type(N)
│ │ │ │ -
213 , data_(arr.data())
│ │ │ │ -
214 {}
│ │ │ │ -
│ │ │ │ -
215
│ │ │ │ -
217 template <class T, size_t N, std::size_t e = extent,
│ │ │ │ -
218 std::enable_if_t<(e == Std::dynamic_extent || e == N), int> = 0,
│ │ │ │ -
219 std::enable_if_t<std::is_convertible_v<const T(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ -
│ │ │ │ -
220 constexpr span (const std::array<T, N>& arr) noexcept
│ │ │ │ -
221 : base_type(N)
│ │ │ │ -
222 , data_(arr.data())
│ │ │ │ -
223 {}
│ │ │ │ -
│ │ │ │ -
224
│ │ │ │ -
226 template <class E = element_type,
│ │ │ │ -
227 std::enable_if_t<std::is_const_v<E>, int> = 0>
│ │ │ │ -
228 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
229 explicit(extent != Std::dynamic_extent)
│ │ │ │ -
230 #endif
│ │ │ │ -
│ │ │ │ -
231 constexpr span (std::initializer_list<value_type> il)
│ │ │ │ -
232 : base_type(il.size())
│ │ │ │ -
233 , data_(il.begin())
│ │ │ │ -
234 {}
│ │ │ │ -
│ │ │ │ -
235
│ │ │ │ -
237 constexpr span (const span& other) noexcept = default;
│ │ │ │ -
238
│ │ │ │ -
240 template <class OtherElementType, std::size_t OtherExtent,
│ │ │ │ -
241 std::enable_if_t<(extent == Std::dynamic_extent || OtherExtent == Std::dynamic_extent || extent == OtherExtent), int> = 0,
│ │ │ │ -
242 std::enable_if_t<std::is_convertible_v<OtherElementType(*)[], element_type(*)[]>, int> = 0>
│ │ │ │ -
243 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
244 explicit(extent != Std::dynamic_extent && OtherExtent == Std::dynamic_extent)
│ │ │ │ -
245 #endif
│ │ │ │ -
│ │ │ │ -
246 constexpr span (const span<OtherElementType, OtherExtent>& s) noexcept
│ │ │ │ -
247 : base_type(s.size())
│ │ │ │ -
248 , data_(s.data())
│ │ │ │ -
249 {}
│ │ │ │ -
│ │ │ │ -
250
│ │ │ │ -
252 constexpr span& operator= (const span& other) noexcept = default;
│ │ │ │ -
253
│ │ │ │ -
255
│ │ │ │ -
256
│ │ │ │ -
259
│ │ │ │ -
261 constexpr iterator begin () const noexcept { return data_; }
│ │ │ │ -
262
│ │ │ │ -
264 constexpr iterator end () const noexcept { return data_ + size(); }
│ │ │ │ -
265
│ │ │ │ -
267 constexpr const_iterator cbegin () const noexcept { return data_; }
│ │ │ │ -
268
│ │ │ │ -
270 constexpr const_iterator cend () const noexcept { return data_ + size(); }
│ │ │ │ -
271
│ │ │ │ -
273 constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator{end()}; }
│ │ │ │ -
274
│ │ │ │ -
276 constexpr reverse_iterator rend() const noexcept { return reverse_iterator{begin()}; }
│ │ │ │ -
277
│ │ │ │ -
279 constexpr const_reverse_iterator crbegin() const noexcept { return reverse_iterator{end()}; }
│ │ │ │ -
280
│ │ │ │ -
282 constexpr const_reverse_iterator crend() const noexcept { return reverse_iterator{begin()}; }
│ │ │ │ -
283
│ │ │ │ -
285
│ │ │ │ -
286
│ │ │ │ -
289
│ │ │ │ -
│ │ │ │ -
291 constexpr reference front () const
│ │ │ │ -
292 {
│ │ │ │ -
293 assert(not empty() && "front of empty span does not exist");
│ │ │ │ -
294 return data_[0];
│ │ │ │ -
295 }
│ │ │ │ -
│ │ │ │ -
296
│ │ │ │ -
│ │ │ │ -
298 constexpr reference back () const
│ │ │ │ -
299 {
│ │ │ │ -
300 assert(not empty() && "front of empty span does not exist");
│ │ │ │ -
301 return data_[size()-1];
│ │ │ │ -
302 }
│ │ │ │ -
│ │ │ │ -
303
│ │ │ │ -
│ │ │ │ -
305 constexpr reference at (size_type i) const
│ │ │ │ -
306 {
│ │ │ │ -
307 if (i >= size())
│ │ │ │ -
308 throw std::out_of_range("Index " + std::to_string(i) + " out of range.");
│ │ │ │ -
309 return data_[i];
│ │ │ │ -
310 }
│ │ │ │ -
│ │ │ │ -
311
│ │ │ │ -
313 constexpr reference operator[] (size_type i) const { return data_[i]; }
│ │ │ │ -
314
│ │ │ │ -
316 constexpr pointer data () const noexcept { return data_; }
│ │ │ │ -
317
│ │ │ │ -
319
│ │ │ │ -
320
│ │ │ │ -
323
│ │ │ │ -
325 template <std::size_t Count>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
327 {
│ │ │ │ -
328 static_assert(Count <= Extent);
│ │ │ │ -
329 assert(Count <= size());
│ │ │ │ -
330 return span<element_type, Count>{data(), Count};
│ │ │ │ -
331 }
│ │ │ │ -
│ │ │ │ -
332
│ │ │ │ -
334 template <std::size_t Count>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
336 {
│ │ │ │ -
337 static_assert(Count <= Extent);
│ │ │ │ -
338 assert(Count <= size());
│ │ │ │ -
339 return span<element_type, Count>{data()+ (size() - Count), Count};
│ │ │ │ -
340 }
│ │ │ │ -
│ │ │ │ -
341
│ │ │ │ -
342private:
│ │ │ │ -
343
│ │ │ │ -
344 static constexpr std::size_t subspan_extent (std::size_t O, std::size_t C) noexcept
│ │ │ │ -
345 {
│ │ │ │ -
346 return (C != Std::dynamic_extent) ? C :
│ │ │ │ -
347 (Extent != Std::dynamic_extent) ? Extent - O : Std::dynamic_extent;
│ │ │ │ -
348 }
│ │ │ │ -
349
│ │ │ │ -
350public:
│ │ │ │ -
351
│ │ │ │ -
353
│ │ │ │ -
357 template <std::size_t Offset, std::size_t Count = Std::dynamic_extent>
│ │ │ │ -
│ │ │ │ -
358 constexpr span<element_type, subspan_extent(Offset,Count)> subspan () const
│ │ │ │ -
359 {
│ │ │ │ -
360 static_assert(Offset <= Extent && (Count == Std::dynamic_extent || Count <= Extent - Offset));
│ │ │ │ -
361 assert(Offset <= size() && (Count == Std::dynamic_extent || Count <= size() - Offset));
│ │ │ │ -
362 return span<element_type, subspan_extent(Offset,Count)>{
│ │ │ │ -
363 data() + Offset, Count != Std::dynamic_extent ? Count : size() - Offset};
│ │ │ │ -
364 }
│ │ │ │ -
│ │ │ │ -
365
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
368 {
│ │ │ │ -
369 assert(count <= size());
│ │ │ │ - │ │ │ │ -
371 }
│ │ │ │ -
│ │ │ │ -
372
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
375 {
│ │ │ │ -
376 assert(count <= size());
│ │ │ │ -
377 return span<element_type, Std::dynamic_extent>{data()+ (size() - count), count};
│ │ │ │ -
378 }
│ │ │ │ -
│ │ │ │ -
379
│ │ │ │ -
381
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
386 {
│ │ │ │ -
387 assert(offset <= size() && (count == Std::dynamic_extent || count <= size() - offset));
│ │ │ │ - │ │ │ │ -
389 data() + offset, count == Std::dynamic_extent ? size() - offset : count};
│ │ │ │ -
390 }
│ │ │ │ -
│ │ │ │ -
391
│ │ │ │ -
393
│ │ │ │ -
394
│ │ │ │ -
397
│ │ │ │ -
399 using base_type::size;
│ │ │ │ -
400
│ │ │ │ -
402 constexpr size_type size_bytes () const noexcept { return size() * sizeof(element_type); }
│ │ │ │ -
403
│ │ │ │ -
405 [[nodiscard]] constexpr bool empty () const noexcept { return size() == 0; }
│ │ │ │ -
406
│ │ │ │ -
408
│ │ │ │ -
409private:
│ │ │ │ -
410 pointer data_;
│ │ │ │ -
411};
│ │ │ │ -
│ │ │ │ -
412
│ │ │ │ -
413// deduction guide
│ │ │ │ -
414// @{
│ │ │ │ -
415
│ │ │ │ -
416template <class T, std::size_t N>
│ │ │ │ -
417span (T (&)[N])
│ │ │ │ -
418 -> span<T, N>;
│ │ │ │ -
419
│ │ │ │ -
420template <class ElementType, class I, std::size_t Extent,
│ │ │ │ -
421 std::enable_if_t<std::is_convertible_v<I,std::size_t>, int> = 0>
│ │ │ │ -
422span (ElementType*, std::integral_constant<I,Extent>)
│ │ │ │ - │ │ │ │ -
424
│ │ │ │ -
425template <class ElementType, class I,
│ │ │ │ -
426 std::enable_if_t<std::is_integral_v<I>, int> = 0,
│ │ │ │ -
427 std::enable_if_t<std::is_convertible_v<I,std::size_t>, int> = 0>
│ │ │ │ -
428span (ElementType*, I)
│ │ │ │ - │ │ │ │ -
430
│ │ │ │ -
431template <class Iter,
│ │ │ │ -
432 class Element = std::remove_reference_t<decltype(*std::declval<Iter>())>>
│ │ │ │ -
433span (Iter,Iter)
│ │ │ │ - │ │ │ │ -
435
│ │ │ │ -
436template <class Range,
│ │ │ │ -
437 class First = decltype(std::begin(std::declval<Range>())),
│ │ │ │ -
438 class Last = decltype(std::end(std::declval<Range>())),
│ │ │ │ -
439 class Element = std::remove_reference_t<decltype(*std::declval<First>())>>
│ │ │ │ -
440span (Range&)
│ │ │ │ - │ │ │ │ -
442
│ │ │ │ -
443template <class T, size_t N>
│ │ │ │ -
444span (std::array<T, N>&) -> span<T, N>;
│ │ │ │ -
445
│ │ │ │ -
446template <class T, size_t N>
│ │ │ │ -
447span (const std::array<T, N>&) -> span<const T, N>;
│ │ │ │ -
448
│ │ │ │ -
449// @}
│ │ │ │ -
450
│ │ │ │ -
451} // end namespace Dune::Std
│ │ │ │ -
452
│ │ │ │ -
453#endif // DUNE_COMMON_STD_SPAN_HH
│ │ │ │ - │ │ │ │ -
A few common exception classes.
│ │ │ │ -
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:312
│ │ │ │ -
STL namespace.
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
constexpr auto to_address(T &&p) noexcept
Obtain the address represented by p without forming a reference to the object pointed to by p.
Definition memory.hh:47
│ │ │ │ -
constexpr std::size_t dynamic_extent
A constant of type std::size_t that is used to differentiate std::span of static and dynamic extent.
Definition span.hh:26
│ │ │ │ -
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │ -
std::ptrdiff_t difference_type
Definition span.hh:135
│ │ │ │ -
const element_type & const_reference
Definition span.hh:138
│ │ │ │ -
constexpr reference front() const
Access the first element.
Definition span.hh:291
│ │ │ │ -
element_type & reference
Definition span.hh:137
│ │ │ │ -
constexpr span(const span &other) noexcept=default
Copy constructor.
│ │ │ │ -
pointer iterator
Definition span.hh:139
│ │ │ │ -
static constexpr size_type extent
Definition span.hh:150
│ │ │ │ -
constexpr iterator begin() const noexcept
Returns an iterator to the beginning.
Definition span.hh:261
│ │ │ │ -
constexpr const_iterator cbegin() const noexcept
Returns an iterator to the beginning.
Definition span.hh:267
│ │ │ │ -
constexpr span(std::array< T, N > &arr) noexcept
Constructs a span that is a view over the array.
Definition span.hh:211
│ │ │ │ -
std::reverse_iterator< iterator > reverse_iterator
Definition span.hh:140
│ │ │ │ -
constexpr iterator end() const noexcept
Returns an iterator to the end.
Definition span.hh:264
│ │ │ │ -
constexpr span< element_type, Std::dynamic_extent > subspan(size_type offset, size_type count=Std::dynamic_extent) const
Obtains a subspan consisting of count elements of the sequence starting at offset.
Definition span.hh:385
│ │ │ │ -
constexpr span & operator=(const span &other) noexcept=default
Copy assignment operator.
│ │ │ │ -
std::size_t size_type
Definition span.hh:134
│ │ │ │ -
element_type * pointer
Definition span.hh:136
│ │ │ │ -
constexpr reference at(size_type i) const
Access specified element with bounds checking.
Definition span.hh:305
│ │ │ │ -
std::remove_cv_t< element_type > value_type
Definition span.hh:133
│ │ │ │ -
constexpr span< element_type, Std::dynamic_extent > first(size_type count) const
Obtains a subspan consisting of the first count elements of the sequence.
Definition span.hh:367
│ │ │ │ -
constexpr span< element_type, subspan_extent(Offset, Count)> subspan() const
Obtains a subspan consisting of Count elements of the sequence starting at Offset.
Definition span.hh:358
│ │ │ │ -
const iterator const_iterator
Definition span.hh:145
│ │ │ │ -
constexpr const_reverse_iterator crend() const noexcept
Returns a reverse iterator ending at the beginning.
Definition span.hh:282
│ │ │ │ -
constexpr reverse_iterator rend() const noexcept
Returns a reverse iterator ending at the beginning.
Definition span.hh:276
│ │ │ │ -
constexpr pointer data() const noexcept
Direct access to the underlying contiguous storage.
Definition span.hh:316
│ │ │ │ -
constexpr size_type size_bytes() const noexcept
Returns the size of the sequence in bytes.
Definition span.hh:402
│ │ │ │ -
constexpr const_reverse_iterator crbegin() const noexcept
Returns a reverse iterator starting at the end.
Definition span.hh:279
│ │ │ │ -
Element element_type
Definition span.hh:132
│ │ │ │ -
constexpr bool empty() const noexcept
Checks if the sequence is empty.
Definition span.hh:405
│ │ │ │ -
constexpr span< element_type, Count > last() const
Obtains a subspan consisting of the last Count elements of the sequence.
Definition span.hh:335
│ │ │ │ -
constexpr span(Range &range)
Constructs a span that is a view over the range [range.begin(), range.end())
Definition span.hh:195
│ │ │ │ -
constexpr reverse_iterator rbegin() const noexcept
Returns a reverse iterator starting at the end.
Definition span.hh:273
│ │ │ │ -
constexpr span< element_type, Std::dynamic_extent > last(size_type count) const
Obtains a subspan consisting of the last count elements of the sequence.
Definition span.hh:374
│ │ │ │ -
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition span.hh:146
│ │ │ │ -
constexpr const_iterator cend() const noexcept
Returns an iterator to the end.
Definition span.hh:270
│ │ │ │ -
constexpr span< element_type, Count > first() const
Obtains a subspan consisting of the first Count elements of the sequence.
Definition span.hh:326
│ │ │ │ -
constexpr reference back() const
Access the last element.
Definition span.hh:298
│ │ │ │ -
constexpr span(const std::array< T, N > &arr) noexcept
Constructs a span that is a view over the const array.
Definition span.hh:220
│ │ │ │ -
constexpr reference operator[](size_type i) const
Access specified element.
Definition span.hh:313
│ │ │ │ +
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
│ │ │ │ +
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,563 +1,93 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -span.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 © 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_SPAN_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_SPAN_HH │ │ │ │ │ +5#ifndef DUNE_BINARYFUNCTIONS_HH │ │ │ │ │ +6#define DUNE_BINARYFUNCTIONS_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#if __has_include() │ │ │ │ │ -17 #include │ │ │ │ │ -18#endif │ │ │ │ │ -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_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ +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 │ │ │ │ │ -23namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ +_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_6inline constexpr std::size_t _d_y_n_a_m_i_c___e_x_t_e_n_t = std::numeric_limits::max(); │ │ │ │ │ -27 │ │ │ │ │ -28namespace Impl { │ │ │ │ │ -29 │ │ │ │ │ -30template │ │ │ │ │ -31class SpanSize │ │ │ │ │ -32{ │ │ │ │ │ -33public: │ │ │ │ │ -34 using size_type = std::size_t; │ │ │ │ │ -35 │ │ │ │ │ -36public: │ │ │ │ │ -37 constexpr SpanSize () = default; │ │ │ │ │ +_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; │ │ │ │ │ +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 │ │ │ │ │ -39 constexpr SpanSize ([[maybe_unused]] size_type size) noexcept │ │ │ │ │ -40 { │ │ │ │ │ -41 assert(Extent == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || Extent == size); │ │ │ │ │ -42 } │ │ │ │ │ -43 │ │ │ │ │ -44 template │ │ │ │ │ -45 constexpr SpanSize ([[maybe_unused]] Iter first, [[maybe_unused]] Iter last) │ │ │ │ │ -noexcept │ │ │ │ │ -46 { │ │ │ │ │ -47 assert((std::distance(first,last) == Extent)); │ │ │ │ │ -48 } │ │ │ │ │ -49 │ │ │ │ │ -50 constexpr size_type size () const noexcept { return Extent; } │ │ │ │ │ -51}; │ │ │ │ │ -52 │ │ │ │ │ -53template <> │ │ │ │ │ -54class SpanSize │ │ │ │ │ -55{ │ │ │ │ │ -56public: │ │ │ │ │ -57 using size_type = std::size_t; │ │ │ │ │ -58 │ │ │ │ │ -59public: │ │ │ │ │ -60 constexpr SpanSize (size_type size = 0) noexcept │ │ │ │ │ -61 : size_(size) │ │ │ │ │ -62 {} │ │ │ │ │ -63 │ │ │ │ │ -64 template │ │ │ │ │ -65 constexpr SpanSize (Iter first, Iter last) noexcept │ │ │ │ │ -66 : size_(std::distance(first,last)) │ │ │ │ │ -67 {} │ │ │ │ │ -68 │ │ │ │ │ -69 constexpr size_type size () const noexcept { return size_; } │ │ │ │ │ -70 │ │ │ │ │ -71private: │ │ │ │ │ -72 size_type size_; │ │ │ │ │ -73}; │ │ │ │ │ -74 │ │ │ │ │ -75template │ │ │ │ │ -76struct TypeIdentity { using type = T; }; │ │ │ │ │ -77 │ │ │ │ │ -78template │ │ │ │ │ -79using TypeIdentity_t = typename TypeIdentity::type; │ │ │ │ │ -80 │ │ │ │ │ -81} // end namespace Impl │ │ │ │ │ -82 │ │ │ │ │ -83 │ │ │ │ │ -123template │ │ │ │ │ -_1_2_4class _s_p_a_n │ │ │ │ │ -125 : public Impl::SpanSize │ │ │ │ │ -126{ │ │ │ │ │ -127 using base_type = Impl::SpanSize; // base_type implements the │ │ │ │ │ -member variable size() │ │ │ │ │ -128 │ │ │ │ │ -129 static_assert(std::is_object_v && !std::is_abstract_v); │ │ │ │ │ -130 │ │ │ │ │ -131public: │ │ │ │ │ -_1_3_2 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ -_1_3_3 using _v_a_l_u_e___t_y_p_e = std::remove_cv_t; │ │ │ │ │ -_1_3_4 using _s_i_z_e___t_y_p_e = std::size_t; │ │ │ │ │ -_1_3_5 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = std::ptrdiff_t; │ │ │ │ │ -_1_3_6 using _p_o_i_n_t_e_r = _e_l_e_m_e_n_t___t_y_p_e*; │ │ │ │ │ -_1_3_7 using _r_e_f_e_r_e_n_c_e = _e_l_e_m_e_n_t___t_y_p_e&; │ │ │ │ │ -_1_3_8 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = const _e_l_e_m_e_n_t___t_y_p_e&; │ │ │ │ │ -_1_3_9 using _i_t_e_r_a_t_o_r = _p_o_i_n_t_e_r; │ │ │ │ │ -_1_4_0 using _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r = std::reverse_iterator; │ │ │ │ │ -141#if __cpp_lib_ranges_as_const >202311L │ │ │ │ │ -142 using _c_o_n_s_t___i_t_e_r_a_t_o_r = std::const_iterator; │ │ │ │ │ -143 using _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r = std::const_iterator; │ │ │ │ │ -144#else │ │ │ │ │ -_1_4_5 using _c_o_n_s_t___i_t_e_r_a_t_o_r = const _i_t_e_r_a_t_o_r; │ │ │ │ │ -_1_4_6 using _c_o_n_s_t___r_e_v_e_r_s_e___i_t_e_r_a_t_o_r = std::reverse_iterator; │ │ │ │ │ -147#endif │ │ │ │ │ -148 │ │ │ │ │ -149 │ │ │ │ │ -_1_5_0 static constexpr _s_i_z_e___t_y_p_e _e_x_t_e_n_t = Extent; │ │ │ │ │ -151 │ │ │ │ │ -152public: │ │ │ │ │ -155 │ │ │ │ │ -157 template = 0> │ │ │ │ │ -_1_5_9 constexpr _s_p_a_n () noexcept │ │ │ │ │ -160 : base_type{} │ │ │ │ │ -161 , data_{} │ │ │ │ │ -162 {} │ │ │ │ │ -163 │ │ │ │ │ -165 template ())>, │ │ │ │ │ -167 std::enable_if_t, int> = │ │ │ │ │ -0> │ │ │ │ │ -168 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -169 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -170 #endif │ │ │ │ │ -_1_7_1 constexpr _s_p_a_n (Iter _f_i_r_s_t, _s_i_z_e___t_y_p_e size) │ │ │ │ │ -172 : base_type(size) │ │ │ │ │ -173 , data_(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(_f_i_r_s_t)) │ │ │ │ │ -174 {} │ │ │ │ │ -175 │ │ │ │ │ -177 template ())>, │ │ │ │ │ -179 std::enable_if_t, int> = │ │ │ │ │ -0> │ │ │ │ │ -180 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -181 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -182 #endif │ │ │ │ │ -_1_8_3 constexpr _s_p_a_n (Iter _f_i_r_s_t, Iter _l_a_s_t) │ │ │ │ │ -184 : base_type(_f_i_r_s_t,_l_a_s_t) │ │ │ │ │ -185 , data_(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(_f_i_r_s_t)) │ │ │ │ │ -186 {} │ │ │ │ │ -187 │ │ │ │ │ -189 template ()), std::end(std::declval │ │ │ │ │ -()), bool{}) = true, │ │ │ │ │ -191 std::enable_if_t, int> = 0> │ │ │ │ │ -192 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -193 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -194 #endif │ │ │ │ │ -_1_9_5 constexpr _s_p_a_n (Range& _r_a_n_g_e) │ │ │ │ │ -196 : _s_p_a_n(_s_t_d::_b_e_g_i_n(_r_a_n_g_e), _s_t_d::_e_n_d(_r_a_n_g_e)) │ │ │ │ │ -197 {} │ │ │ │ │ -198 │ │ │ │ │ -200 template = 0> │ │ │ │ │ -_2_0_2 constexpr _s_p_a_n (Impl::TypeIdentity_t (&_d_a_t_a)[N]) noexcept │ │ │ │ │ -203 : base_type(N) │ │ │ │ │ -204 , data_(_d_a_t_a) │ │ │ │ │ -205 {} │ │ │ │ │ -206 │ │ │ │ │ -208 template = 0, │ │ │ │ │ -210 std::enable_if_t, int> = │ │ │ │ │ -0> │ │ │ │ │ -_2_1_1 constexpr _s_p_a_n (std::array& arr) noexcept │ │ │ │ │ -212 : base_type(N) │ │ │ │ │ -213 , data_(arr.data()) │ │ │ │ │ -214 {} │ │ │ │ │ -215 │ │ │ │ │ -217 template = 0, │ │ │ │ │ -219 std::enable_if_t, │ │ │ │ │ -int> = 0> │ │ │ │ │ -_2_2_0 constexpr _s_p_a_n (const std::array& arr) noexcept │ │ │ │ │ -221 : base_type(N) │ │ │ │ │ -222 , data_(arr.data()) │ │ │ │ │ -223 {} │ │ │ │ │ -224 │ │ │ │ │ -226 template , int> = 0> │ │ │ │ │ -228 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -229 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -230 #endif │ │ │ │ │ -_2_3_1 constexpr _s_p_a_n (std::initializer_list il) │ │ │ │ │ -232 : base_type(il.size()) │ │ │ │ │ -233 , data_(il.begin()) │ │ │ │ │ -234 {} │ │ │ │ │ -235 │ │ │ │ │ -_2_3_7 constexpr _s_p_a_n (const _s_p_a_n& other) noexcept = default; │ │ │ │ │ -238 │ │ │ │ │ -240 template = 0, │ │ │ │ │ -242 std::enable_if_t, int> = 0> │ │ │ │ │ -243 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -244 explicit(_e_x_t_e_n_t != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t && OtherExtent == _S_t_d_:_: │ │ │ │ │ -_d_y_n_a_m_i_c___e_x_t_e_n_t) │ │ │ │ │ -245 #endif │ │ │ │ │ -_2_4_6 constexpr _s_p_a_n (const _s_p_a_n_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_ _O_t_h_e_r_E_x_t_e_n_t_>& s) noexcept │ │ │ │ │ -247 : base_type(s.size()) │ │ │ │ │ -248 , data_(s._d_a_t_a()) │ │ │ │ │ -249 {} │ │ │ │ │ -250 │ │ │ │ │ -_2_5_2 constexpr _s_p_a_n& _o_p_e_r_a_t_o_r_=_ (const _s_p_a_n& other) noexcept = default; │ │ │ │ │ -253 │ │ │ │ │ -255 │ │ │ │ │ -256 │ │ │ │ │ -259 │ │ │ │ │ -_2_6_1 constexpr _i_t_e_r_a_t_o_r _b_e_g_i_n () const noexcept { return data_; } │ │ │ │ │ -262 │ │ │ │ │ -_2_6_4 constexpr _i_t_e_r_a_t_o_r _e_n_d () const noexcept { return data_ + size(); } │ │ │ │ │ -265 │ │ │ │ │ -_2_6_7 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _c_b_e_g_i_n () const noexcept { return data_; } │ │ │ │ │ -268 │ │ │ │ │ -_2_7_0 constexpr _c_o_n_s_t___i_t_e_r_a_t_o_r _c_e_n_d () const noexcept { return data_ + size(); } │ │ │ │ │ -271 │ │ │ │ │ -_2_7_3 constexpr _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_b_e_g_i_n() const noexcept { return │ │ │ │ │ -_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_e_n_d()}; } │ │ │ │ │ -274 │ │ │ │ │ -_2_7_6 constexpr _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r _r_e_n_d() const noexcept { return _r_e_v_e_r_s_e___i_t_e_r_a_t_o_r │ │ │ │ │ -{_b_e_g_i_n()}; } │ │ │ │ │ -277 │ │ │ │ │ -_2_7_9 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 { return │ │ │ │ │ -_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_e_n_d()}; } │ │ │ │ │ -280 │ │ │ │ │ -_2_8_2 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 { return │ │ │ │ │ -_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r{_b_e_g_i_n()}; } │ │ │ │ │ -283 │ │ │ │ │ -285 │ │ │ │ │ -286 │ │ │ │ │ -289 │ │ │ │ │ -_2_9_1 constexpr _r_e_f_e_r_e_n_c_e _f_r_o_n_t () const │ │ │ │ │ -292 { │ │ │ │ │ -293 assert(not _e_m_p_t_y() && "front of empty span does not exist"); │ │ │ │ │ -294 return data_[0]; │ │ │ │ │ -295 } │ │ │ │ │ -296 │ │ │ │ │ -_2_9_8 constexpr _r_e_f_e_r_e_n_c_e _b_a_c_k () const │ │ │ │ │ -299 { │ │ │ │ │ -300 assert(not _e_m_p_t_y() && "front of empty span does not exist"); │ │ │ │ │ -301 return data_[size()-1]; │ │ │ │ │ -302 } │ │ │ │ │ -303 │ │ │ │ │ -_3_0_5 constexpr _r_e_f_e_r_e_n_c_e _a_t (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -306 { │ │ │ │ │ -307 if (i >= size()) │ │ │ │ │ -308 throw std::out_of_range("Index " + std::to_string(i) + " out of range."); │ │ │ │ │ -309 return data_[i]; │ │ │ │ │ -310 } │ │ │ │ │ -311 │ │ │ │ │ -_3_1_3 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) const { return data_[i]; } │ │ │ │ │ -314 │ │ │ │ │ -_3_1_6 constexpr _p_o_i_n_t_e_r _d_a_t_a () const noexcept { return data_; } │ │ │ │ │ -317 │ │ │ │ │ -319 │ │ │ │ │ -320 │ │ │ │ │ -323 │ │ │ │ │ -325 template │ │ │ │ │ -_3_2_6 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_> _f_i_r_s_t () const │ │ │ │ │ -327 { │ │ │ │ │ -328 static_assert(Count <= Extent); │ │ │ │ │ -329 assert(Count <= size()); │ │ │ │ │ -330 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_>{_d_a_t_a(), Count}; │ │ │ │ │ -331 } │ │ │ │ │ -332 │ │ │ │ │ -334 template │ │ │ │ │ -_3_3_5 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_> _l_a_s_t () const │ │ │ │ │ -336 { │ │ │ │ │ -337 static_assert(Count <= Extent); │ │ │ │ │ -338 assert(Count <= size()); │ │ │ │ │ -339 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _C_o_u_n_t_>{_d_a_t_a()+ (size() - Count), Count}; │ │ │ │ │ -340 } │ │ │ │ │ -341 │ │ │ │ │ -342private: │ │ │ │ │ -343 │ │ │ │ │ -344 static constexpr std::size_t subspan_extent (std::size_t O, std::size_t C) │ │ │ │ │ -noexcept │ │ │ │ │ -345 { │ │ │ │ │ -346 return (C != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) ? C : │ │ │ │ │ -347 (Extent != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) ? Extent - O : Std::_d_y_n_a_m_i_c___e_x_t_e_n_t; │ │ │ │ │ -348 } │ │ │ │ │ -349 │ │ │ │ │ -350public: │ │ │ │ │ -351 │ │ │ │ │ -353 │ │ │ │ │ -357 template │ │ │ │ │ -_3_5_8 constexpr _s_p_a_n<_e_l_e_m_e_n_t___t_y_p_e, subspan_extent(Offset,Count)> _s_u_b_s_p_a_n () const │ │ │ │ │ -359 { │ │ │ │ │ -360 static_assert(Offset <= Extent && (Count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || Count <= │ │ │ │ │ -Extent - Offset)); │ │ │ │ │ -361 assert(Offset <= size() && (Count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || Count <= size() │ │ │ │ │ -- Offset)); │ │ │ │ │ -362 return _s_p_a_n<_e_l_e_m_e_n_t___t_y_p_e, subspan_extent(Offset,Count)>{ │ │ │ │ │ -363 _d_a_t_a() + Offset, Count != _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t ? Count : size() - Offset}; │ │ │ │ │ -364 } │ │ │ │ │ -365 │ │ │ │ │ -_3_6_7 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_> _f_i_r_s_t (_s_i_z_e___t_y_p_e count) │ │ │ │ │ -const │ │ │ │ │ -368 { │ │ │ │ │ -369 assert(count <= size()); │ │ │ │ │ -370 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>{_d_a_t_a(), count}; │ │ │ │ │ -371 } │ │ │ │ │ -372 │ │ │ │ │ -_3_7_4 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_> _l_a_s_t (_s_i_z_e___t_y_p_e count) │ │ │ │ │ -const │ │ │ │ │ -375 { │ │ │ │ │ -376 assert(count <= size()); │ │ │ │ │ -377 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>{_d_a_t_a()+ (size() - count), │ │ │ │ │ -count}; │ │ │ │ │ -378 } │ │ │ │ │ -379 │ │ │ │ │ -381 │ │ │ │ │ -_3_8_5 constexpr _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_> _s_u_b_s_p_a_n (_s_i_z_e___t_y_p_e │ │ │ │ │ -offset, _s_i_z_e___t_y_p_e count = _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t) const │ │ │ │ │ -386 { │ │ │ │ │ -387 assert(offset <= size() && (count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t || count <= size() │ │ │ │ │ -- offset)); │ │ │ │ │ -388 return _s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>{ │ │ │ │ │ -389 _d_a_t_a() + offset, count == _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t ? size() - offset : count}; │ │ │ │ │ -390 } │ │ │ │ │ -391 │ │ │ │ │ -393 │ │ │ │ │ -394 │ │ │ │ │ -397 │ │ │ │ │ -399 using base_type::size; │ │ │ │ │ -400 │ │ │ │ │ -_4_0_2 constexpr _s_i_z_e___t_y_p_e _s_i_z_e___b_y_t_e_s () const noexcept { return size() * sizeof │ │ │ │ │ -(_e_l_e_m_e_n_t___t_y_p_e); } │ │ │ │ │ -403 │ │ │ │ │ -_4_0_5 [[nodiscard]] constexpr bool _e_m_p_t_y () const noexcept { return size() == 0; │ │ │ │ │ -} │ │ │ │ │ -406 │ │ │ │ │ -408 │ │ │ │ │ -409private: │ │ │ │ │ -410 _p_o_i_n_t_e_r data_; │ │ │ │ │ -411}; │ │ │ │ │ -412 │ │ │ │ │ -413// deduction guide │ │ │ │ │ -414// @{ │ │ │ │ │ -415 │ │ │ │ │ -416template │ │ │ │ │ -_4_1_7_s_p_a_n (T (&)[N]) │ │ │ │ │ -418 -> _s_p_a_n_<_T_,_ _N_>; │ │ │ │ │ -419 │ │ │ │ │ -420template , int> = 0> │ │ │ │ │ -_4_2_2_s_p_a_n (ElementType*, std::integral_constant) │ │ │ │ │ -423 -> _s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _E_x_t_e_n_t_>; │ │ │ │ │ -424 │ │ │ │ │ -425template , int> = 0, │ │ │ │ │ -427 std::enable_if_t, int> = 0> │ │ │ │ │ -_4_2_8_s_p_a_n (ElementType*, I) │ │ │ │ │ -429 -> _s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>; │ │ │ │ │ -430 │ │ │ │ │ -431template ())>> │ │ │ │ │ -_4_3_3_s_p_a_n (Iter,Iter) │ │ │ │ │ -434 -> _s_p_a_n_<_E_l_e_m_e_n_t_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>; │ │ │ │ │ -435 │ │ │ │ │ -436template ())), │ │ │ │ │ -438 class Last = decltype(std::end(std::declval())), │ │ │ │ │ -439 class Element = std::remove_reference_t())>> │ │ │ │ │ -_4_4_0_s_p_a_n (Range&) │ │ │ │ │ -441 -> _s_p_a_n_<_E_l_e_m_e_n_t_,_ _S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t_>; │ │ │ │ │ -442 │ │ │ │ │ -443template │ │ │ │ │ -_4_4_4_s_p_a_n (std::array&) -> _s_p_a_n_<_T_,_ _N_>; │ │ │ │ │ -445 │ │ │ │ │ -446template │ │ │ │ │ -_4_4_7_s_p_a_n (const std::array&) -> _s_p_a_n_<_c_o_n_s_t_ _T_,_ _N_>; │ │ │ │ │ -448 │ │ │ │ │ -449// @} │ │ │ │ │ -450 │ │ │ │ │ -451} // end namespace Dune::Std │ │ │ │ │ -452 │ │ │ │ │ -453#endif // DUNE_COMMON_STD_SPAN_HH │ │ │ │ │ -_m_e_m_o_r_y_._h_h │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_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:312 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_t_o___a_d_d_r_e_s_s │ │ │ │ │ -constexpr auto to_address(T &&p) noexcept │ │ │ │ │ -Obtain the address represented by p without forming a reference to the object │ │ │ │ │ -pointed to by p. │ │ │ │ │ -DDeeffiinniittiioonn memory.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_y_n_a_m_i_c___e_x_t_e_n_t │ │ │ │ │ -constexpr std::size_t dynamic_extent │ │ │ │ │ -A constant of type std::size_t that is used to differentiate std::span of │ │ │ │ │ -static and dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ -A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ -std::ptrdiff_t difference_type │ │ │ │ │ -DDeeffiinniittiioonn span.hh:135 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -const element_type & const_reference │ │ │ │ │ -DDeeffiinniittiioonn span.hh:138 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_f_r_o_n_t │ │ │ │ │ -constexpr reference front() const │ │ │ │ │ -Access the first element. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:291 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -element_type & reference │ │ │ │ │ -DDeeffiinniittiioonn span.hh:137 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ -constexpr span(const span &other) noexcept=default │ │ │ │ │ -Copy constructor. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -pointer iterator │ │ │ │ │ -DDeeffiinniittiioonn span.hh:139 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_x_t_e_n_t │ │ │ │ │ -static constexpr size_type extent │ │ │ │ │ -DDeeffiinniittiioonn span.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_b_e_g_i_n │ │ │ │ │ -constexpr iterator begin() const noexcept │ │ │ │ │ -Returns an iterator to the beginning. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_b_e_g_i_n │ │ │ │ │ -constexpr const_iterator cbegin() const noexcept │ │ │ │ │ -Returns an iterator to the beginning. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ -constexpr span(std::array< T, N > &arr) noexcept │ │ │ │ │ -Constructs a span that is a view over the array. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:211 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_e_v_e_r_s_e___i_t_e_r_a_t_o_r │ │ │ │ │ -std::reverse_iterator< iterator > reverse_iterator │ │ │ │ │ -DDeeffiinniittiioonn span.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_n_d │ │ │ │ │ -constexpr iterator end() const noexcept │ │ │ │ │ -Returns an iterator to the end. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:264 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_u_b_s_p_a_n │ │ │ │ │ -constexpr span< element_type, Std::dynamic_extent > subspan(size_type offset, │ │ │ │ │ -size_type count=Std::dynamic_extent) const │ │ │ │ │ -Obtains a subspan consisting of count elements of the sequence starting at │ │ │ │ │ -offset. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:385 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -constexpr span & operator=(const span &other) noexcept=default │ │ │ │ │ -Copy assignment operator. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -DDeeffiinniittiioonn span.hh:134 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_p_o_i_n_t_e_r │ │ │ │ │ -element_type * pointer │ │ │ │ │ -DDeeffiinniittiioonn span.hh:136 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_a_t │ │ │ │ │ -constexpr reference at(size_type i) const │ │ │ │ │ -Access specified element with bounds checking. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:305 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -std::remove_cv_t< element_type > value_type │ │ │ │ │ -DDeeffiinniittiioonn span.hh:133 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_f_i_r_s_t │ │ │ │ │ -constexpr span< element_type, Std::dynamic_extent > first(size_type count) │ │ │ │ │ -const │ │ │ │ │ -Obtains a subspan consisting of the first count elements of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:367 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_u_b_s_p_a_n │ │ │ │ │ -constexpr span< element_type, subspan_extent(Offset, Count)> subspan() const │ │ │ │ │ -Obtains a subspan consisting of Count elements of the sequence starting at │ │ │ │ │ -Offset. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:358 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -const iterator const_iterator │ │ │ │ │ -DDeeffiinniittiioonn span.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_r_e_n_d │ │ │ │ │ -constexpr const_reverse_iterator crend() const noexcept │ │ │ │ │ -Returns a reverse iterator ending at the beginning. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_e_n_d │ │ │ │ │ -constexpr reverse_iterator rend() const noexcept │ │ │ │ │ -Returns a reverse iterator ending at the beginning. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_d_a_t_a │ │ │ │ │ -constexpr pointer data() const noexcept │ │ │ │ │ -Direct access to the underlying contiguous storage. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:316 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_i_z_e___b_y_t_e_s │ │ │ │ │ -constexpr size_type size_bytes() const noexcept │ │ │ │ │ -Returns the size of the sequence in bytes. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:402 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_r_b_e_g_i_n │ │ │ │ │ -constexpr const_reverse_iterator crbegin() const noexcept │ │ │ │ │ -Returns a reverse iterator starting at the end. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:279 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ -Element element_type │ │ │ │ │ -DDeeffiinniittiioonn span.hh:132 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_e_m_p_t_y │ │ │ │ │ -constexpr bool empty() const noexcept │ │ │ │ │ -Checks if the sequence is empty. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:405 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_l_a_s_t │ │ │ │ │ -constexpr span< element_type, Count > last() const │ │ │ │ │ -Obtains a subspan consisting of the last Count elements of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:335 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ -constexpr span(Range &range) │ │ │ │ │ -Constructs a span that is a view over the range [range.begin(), range.end()) │ │ │ │ │ -DDeeffiinniittiioonn span.hh:195 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_r_b_e_g_i_n │ │ │ │ │ -constexpr reverse_iterator rbegin() const noexcept │ │ │ │ │ -Returns a reverse iterator starting at the end. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:273 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_l_a_s_t │ │ │ │ │ -constexpr span< element_type, Std::dynamic_extent > last(size_type count) const │ │ │ │ │ -Obtains a subspan consisting of the last count elements of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:374 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_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 │ │ │ │ │ -DDeeffiinniittiioonn span.hh:146 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_c_e_n_d │ │ │ │ │ -constexpr const_iterator cend() const noexcept │ │ │ │ │ -Returns an iterator to the end. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:270 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_f_i_r_s_t │ │ │ │ │ -constexpr span< element_type, Count > first() const │ │ │ │ │ -Obtains a subspan consisting of the first Count elements of the sequence. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:326 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_b_a_c_k │ │ │ │ │ -constexpr reference back() const │ │ │ │ │ -Access the last element. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:298 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_s_p_a_n │ │ │ │ │ -constexpr span(const std::array< T, N > &arr) noexcept │ │ │ │ │ -Constructs a span that is a view over the const array. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:220 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -constexpr reference operator[](size_type i) const │ │ │ │ │ -Access specified element. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:313 │ │ │ │ │ +_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_:_:_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/a00152.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mdarray.hh File Reference │ │ │ │ +dune-common: hybridutilities.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,54 +65,122 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
mdarray.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
hybridutilities.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <array>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ │ -#include <dune/common/std/default_accessor.hh>
│ │ │ │ -#include <dune/common/std/mdspan.hh>
│ │ │ │ -#include <dune/common/std/memory.hh>
│ │ │ │ -#include <dune/common/std/span.hh>
│ │ │ │ -#include <dune/common/std/impl/containerconstructiontraits.hh>
│ │ │ │ +
#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/rangeutilities.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Std::mdarray< Element, Extents, LayoutPolicy, Container >
 An owning multi-dimensional array analog of mdspan. More...
class  Dune::Hybrid::HybridFunctor< Functor >
 Adapter of a hybrid functor that maintains results hybrid. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 Dune namespace.
 
namespace  Dune::Std
 Namespace for features backported from new C++ standards.
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 Functor >
constexpr HybridFunctor< Functor > Dune::Hybrid::hybridFunctor (const Functor &)
 Returns an HybridFunctor adaptor.
 
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.
 
template<class T , class Value , class Branches >
constexpr void Dune::Hybrid::switchCases (IntegralRange< T > range, const Value &value, Branches &&branches)
 Switch statement.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Variables

constexpr auto Dune::Hybrid::max = hybridFunctor(Impl::Max{})
 Function object that returns the greater of the given values.
 
constexpr auto Dune::Hybrid::min = hybridFunctor(Impl::Min{})
 Function object that returns the smaller of the given values.
 
constexpr auto Dune::Hybrid::plus = hybridFunctor(std::plus<>{})
 Function object for performing addition.
 
constexpr auto Dune::Hybrid::minus = hybridFunctor(std::minus<>{})
 Function object for performing subtraction.
 
constexpr auto Dune::Hybrid::equal_to = hybridFunctor(std::equal_to<>{})
 Function object for performing equality comparison.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,36 +1,113 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -mdarray.hh File Reference │ │ │ │ │ -#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 | _V_a_r_i_a_b_l_e_s │ │ │ │ │ +hybridutilities.hh File Reference │ │ │ │ │ #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 <_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_/_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_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_d_s_p_a_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_c_o_n_t_a_i_n_e_r_c_o_n_s_t_r_u_c_t_i_o_n_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_:_:_S_t_d_:_:_m_d_a_r_r_a_y_<_ _E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_P_o_l_i_c_y_,_ _C_o_n_t_a_i_n_e_r_ _> │ │ │ │ │ -  An owning multi-dimensional array analog of mdspan. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_H_y_b_r_i_d_:_:_H_y_b_r_i_d_F_u_n_c_t_o_r_<_ _F_u_n_c_t_o_r_ _> │ │ │ │ │ +  Adapter of a hybrid functor that maintains results hybrid. _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. │ │ │ │ │ +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 _H_y_b_r_i_d_F_u_n_c_t_o_r< Functor >  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_h_y_b_r_i_d_F_u_n_c_t_o_r (const Functor │ │ │ │ │ + &) │ │ │ │ │ +  Returns an _H_y_b_r_i_d_F_u_n_c_t_o_r adaptor. │ │ │ │ │ +  │ │ │ │ │ +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. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr void  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_s_w_i_t_c_h_C_a_s_e_s (_I_n_t_e_g_r_a_l_R_a_n_g_e< T │ │ │ │ │ + > _r_a_n_g_e, const Value &value, Branches │ │ │ │ │ + &&branches) │ │ │ │ │ +  Switch statement. │ │ │ │ │ +  │ │ │ │ │ +VVaarriiaabblleess │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_m_a_x = _h_y_b_r_i_d_F_u_n_c_t_o_r(Impl::Max{}) │ │ │ │ │ +  Function object that returns the greater of the given values. │ │ │ │ │ +  │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_m_i_n = _h_y_b_r_i_d_F_u_n_c_t_o_r(Impl::Min{}) │ │ │ │ │ +  Function object that returns the smaller of the given values. │ │ │ │ │ +  │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_p_l_u_s = _h_y_b_r_i_d_F_u_n_c_t_o_r(std::plus<>{}) │ │ │ │ │ +  Function object for performing addition. │ │ │ │ │ +  │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_m_i_n_u_s = _h_y_b_r_i_d_F_u_n_c_t_o_r(std::minus<>{}) │ │ │ │ │ +  Function object for performing subtraction. │ │ │ │ │ +  │ │ │ │ │ +constexpr auto  _D_u_n_e_:_:_H_y_b_r_i_d_:_:_e_q_u_a_l___t_o = _h_y_b_r_i_d_F_u_n_c_t_o_r(std::equal_to<>{}) │ │ │ │ │ +  Function object for performing equality comparison. │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mdarray.hh Source File │ │ │ │ +dune-common: hybridutilities.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,712 +70,466 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mdarray.hh
│ │ │ │ +
hybridutilities.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 © 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_MDARRAY_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_MDARRAY_HH
│ │ │ │ +
5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH
│ │ │ │ +
6#define DUNE_COMMON_HYBRIDUTILITIES_HH
│ │ │ │
7
│ │ │ │ -
8#include <algorithm>
│ │ │ │ -
9#include <array>
│ │ │ │ -
10#include <memory>
│ │ │ │ -
11#include <vector>
│ │ │ │ -
12#include <tuple>
│ │ │ │ -
13#include <type_traits>
│ │ │ │ -
14#if __has_include(<version>)
│ │ │ │ -
15 #include <version>
│ │ │ │ -
16#endif
│ │ │ │ +
8#include <tuple>
│ │ │ │ +
9#include <utility>
│ │ │ │ +
10
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
16
│ │ │ │
17
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
25
│ │ │ │ -
26namespace Dune::Std {
│ │ │ │ -
27
│ │ │ │ -
66template <class Element, class Extents, class LayoutPolicy = Std::layout_right,
│ │ │ │ -
67 class Container = std::vector<Element>>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
69{
│ │ │ │ -
70 template <class,class,class,class> friend class mdarray;
│ │ │ │ -
71
│ │ │ │ -
72 static_assert(std::is_object_v<Element>);
│ │ │ │ -
73 static_assert(!std::is_abstract_v<Element>);
│ │ │ │ -
74 static_assert(!std::is_array_v<Element>);
│ │ │ │ -
75 static_assert(std::is_same_v<Element, typename Container::value_type>);
│ │ │ │ -
76
│ │ │ │ -
77public:
│ │ │ │ -
78 using element_type = Element;
│ │ │ │ -
79 using extents_type = Extents;
│ │ │ │ -
80 using layout_type = LayoutPolicy;
│ │ │ │ -
81 using container_type = Container;
│ │ │ │ -
82
│ │ │ │ - │ │ │ │ -
84 using mapping_type = typename layout_type::template mapping<extents_type>;
│ │ │ │ -
85
│ │ │ │ -
86 using index_type = typename extents_type::index_type;
│ │ │ │ -
87 using size_type = typename extents_type::size_type;
│ │ │ │ -
88 using rank_type = typename extents_type::rank_type;
│ │ │ │ -
89
│ │ │ │ - │ │ │ │ - │ │ │ │ -
92
│ │ │ │ -
93 using pointer = decltype(Std::to_address(std::declval<container_type>().begin()));
│ │ │ │ -
94 using reference = typename container_type::reference;
│ │ │ │ -
95 using const_pointer = decltype(Std::to_address(std::declval<container_type>().cbegin()));
│ │ │ │ -
96 using const_reference = typename container_type::const_reference;
│ │ │ │ -
97
│ │ │ │ -
98 static_assert(std::is_constructible_v<mapping_type, extents_type>);
│ │ │ │ -
99
│ │ │ │ -
100private:
│ │ │ │ -
101 // helper function to construct the container
│ │ │ │ -
102 template <class C, class... Args>
│ │ │ │ -
103 static constexpr auto construct_container (Args&&... args)
│ │ │ │ -
104 -> decltype(Impl::ContainerConstructionTraits<C>::construct(std::forward<Args>(args)...))
│ │ │ │ -
105 {
│ │ │ │ -
106 return Impl::ContainerConstructionTraits<C>::construct(std::forward<Args>(args)...);
│ │ │ │ -
107 }
│ │ │ │ -
108
│ │ │ │ -
109public:
│ │ │ │ -
112
│ │ │ │ -
114 template <class E = extents_type, class C = container_type, class M = mapping_type,
│ │ │ │ -
115 std::enable_if_t<(E::rank_dynamic() != 0), int> = 0,
│ │ │ │ -
116 std::enable_if_t<std::is_default_constructible_v<C>, int> = 0,
│ │ │ │ -
117 std::enable_if_t<std::is_default_constructible_v<M>, int> = 0>
│ │ │ │ -
│ │ │ │ -
118 constexpr mdarray ()
│ │ │ │ -
119 : container_{}
│ │ │ │ -
120 , mapping_{}
│ │ │ │ -
121 {}
│ │ │ │ -
│ │ │ │ -
122
│ │ │ │ -
123
│ │ │ │ -
124 // -------------------------------------
│ │ │ │ -
125 // constructors from extents or mappings
│ │ │ │ -
126
│ │ │ │ -
127
│ │ │ │ -
129 template <class... IndexTypes,
│ │ │ │ -
130 std::enable_if_t<(... && std::is_convertible_v<IndexTypes,index_type>), int> = 0,
│ │ │ │ -
131 std::enable_if_t<std::is_constructible_v<extents_type,IndexTypes...>, int> = 0,
│ │ │ │ -
132 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type,IndexTypes>), int> = 0>
│ │ │ │ -
│ │ │ │ -
133 explicit constexpr mdarray (IndexTypes... exts)
│ │ │ │ -
134 : mdarray(extents_type(index_type(std::move(exts))...))
│ │ │ │ -
135 {}
│ │ │ │ -
│ │ │ │ -
136
│ │ │ │ -
│ │ │ │ -
138 explicit constexpr mdarray (const extents_type& e)
│ │ │ │ - │ │ │ │ -
140 {}
│ │ │ │ -
│ │ │ │ -
141
│ │ │ │ -
143 template <class C = container_type,
│ │ │ │ -
144 decltype(construct_container<C>(std::declval<std::size_t>()), bool{}) = true>
│ │ │ │ -
│ │ │ │ -
145 explicit constexpr mdarray (const mapping_type& m)
│ │ │ │ -
146 : container_(construct_container<C>(m.required_span_size()))
│ │ │ │ -
147 , mapping_(m)
│ │ │ │ -
148 {}
│ │ │ │ -
│ │ │ │ +
18
│ │ │ │ +
19namespace Dune {
│ │ │ │ +
│ │ │ │ +
20namespace Hybrid {
│ │ │ │ +
21
│ │ │ │ +
22namespace Impl {
│ │ │ │ +
23
│ │ │ │ +
24 // Try if std::tuple_size is implemented for class
│ │ │ │ +
25 template<class T>
│ │ │ │ +
26 constexpr auto size(const T&, const PriorityTag<2>&)
│ │ │ │ +
27 -> decltype(std::integral_constant<std::size_t,std::tuple_size<T>::value>())
│ │ │ │ +
28 {
│ │ │ │ +
29 return {};
│ │ │ │ +
30 }
│ │ │ │ +
31
│ │ │ │ +
32 // Try if there's a static constexpr size() method
│ │ │ │ +
33 template<class T>
│ │ │ │ +
34 constexpr auto size(const T&, const PriorityTag<1>&)
│ │ │ │ +
35 -> decltype(std::integral_constant<std::size_t,T::size()>())
│ │ │ │ +
36 {
│ │ │ │ +
37 return {};
│ │ │ │ +
38 }
│ │ │ │ +
39
│ │ │ │ +
40 // As a last resort try if there's a non-static size()
│ │ │ │ +
41 template<class T>
│ │ │ │ +
42 constexpr auto size(const T& t, const PriorityTag<0>&)
│ │ │ │ +
43 {
│ │ │ │ +
44 return t.size();
│ │ │ │ +
45 }
│ │ │ │ +
46
│ │ │ │ +
47} // namespace Impl
│ │ │ │ +
48
│ │ │ │ +
49
│ │ │ │ +
50
│ │ │ │ +
72template<class T>
│ │ │ │ +
│ │ │ │ +
73constexpr auto size(const T& t)
│ │ │ │ +
74{
│ │ │ │ +
75 return Impl::size(t, PriorityTag<42>());
│ │ │ │ +
76}
│ │ │ │ +
│ │ │ │ +
77
│ │ │ │ +
78
│ │ │ │ +
79
│ │ │ │ +
80namespace Impl {
│ │ │ │ +
81
│ │ │ │ +
82 template<class Container, class Index,
│ │ │ │ +
83 std::enable_if_t<IsTuple<std::decay_t<Container>>::value, int> = 0>
│ │ │ │ +
84 constexpr decltype(auto) elementAt(Container&& c, Index&&, PriorityTag<2>)
│ │ │ │ +
85 {
│ │ │ │ +
86 return std::get<std::decay_t<Index>::value>(c);
│ │ │ │ +
87 }
│ │ │ │ +
88
│ │ │ │ +
89 template<class T, T... t, class Index>
│ │ │ │ +
90 constexpr decltype(auto) elementAt(std::integer_sequence<T, t...> c, Index, PriorityTag<1>)
│ │ │ │ +
91 {
│ │ │ │ +
92 return Dune::integerSequenceEntry(c, std::integral_constant<std::size_t, Index::value>());
│ │ │ │ +
93 }
│ │ │ │ +
94
│ │ │ │ +
95 template<class Container, class Index>
│ │ │ │ +
96 constexpr decltype(auto) elementAt(Container&& c, Index&& i, PriorityTag<0>)
│ │ │ │ +
97 {
│ │ │ │ +
98 return c[i];
│ │ │ │ +
99 }
│ │ │ │ +
100
│ │ │ │ +
101} // namespace Impl
│ │ │ │ +
102
│ │ │ │ +
103
│ │ │ │ +
104
│ │ │ │ +
125template<class Container, class Index>
│ │ │ │ +
│ │ │ │ +
126constexpr decltype(auto) elementAt(Container&& c, Index&& i)
│ │ │ │ +
127{
│ │ │ │ +
128 return Impl::elementAt(std::forward<Container>(c), std::forward<Index>(i), PriorityTag<42>());
│ │ │ │ +
129}
│ │ │ │ +
│ │ │ │ +
130
│ │ │ │ +
131
│ │ │ │ +
132
│ │ │ │ +
133namespace Impl {
│ │ │ │ +
134
│ │ │ │ +
135 template<class Begin, class End,
│ │ │ │ +
136 std::enable_if_t<IsIntegralConstant<Begin>::value and IsIntegralConstant<End>::value, int> = 0>
│ │ │ │ +
137 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/, const PriorityTag<1>&)
│ │ │ │ +
138 {
│ │ │ │ +
139 static_assert(Begin::value <= End::value, "You cannot create an integralRange where end<begin");
│ │ │ │ + │ │ │ │ +
141 }
│ │ │ │ +
142
│ │ │ │ +
143 template<class Begin, class End>
│ │ │ │ +
144 constexpr auto integralRange(const Begin& begin, const End& end, const PriorityTag<0>&)
│ │ │ │ +
145 {
│ │ │ │ +
146 assert(begin<=end && "You cannot create an integralRange where end<begin");
│ │ │ │ +
147 return Dune::IntegralRange<End>(begin, end);
│ │ │ │ +
148 }
│ │ │ │
149
│ │ │ │ -
150
│ │ │ │ -
151 // ---------------------------------------
│ │ │ │ -
152 // constructors with a given initial value
│ │ │ │ +
150} // namespace Impl
│ │ │ │ +
151
│ │ │ │ +
152
│ │ │ │
153
│ │ │ │ -
│ │ │ │ -
155 constexpr mdarray (const extents_type& e, const value_type& v)
│ │ │ │ -
156 : mdarray(mapping_type(e), v)
│ │ │ │ -
157 {}
│ │ │ │ -
│ │ │ │ -
158
│ │ │ │ -
160 template <class C = container_type,
│ │ │ │ -
161 decltype(construct_container<C>(std::declval<std::size_t>(),std::declval<const value_type&>()), bool{}) = true>
│ │ │ │ -
│ │ │ │ -
162 constexpr mdarray (const mapping_type& m, const value_type& v)
│ │ │ │ -
163 : container_(construct_container<C>(m.required_span_size(), v))
│ │ │ │ -
164 , mapping_(m)
│ │ │ │ -
165 {}
│ │ │ │ -
│ │ │ │ -
166
│ │ │ │ -
167
│ │ │ │ -
168 // -----------------------------------
│ │ │ │ -
169 // constructors with a given container
│ │ │ │ -
170
│ │ │ │ -
172 template <class E = extents_type,
│ │ │ │ -
173 std::enable_if_t<std::is_constructible_v<mapping_type,const E&>, int> = 0>
│ │ │ │ -
│ │ │ │ -
174 constexpr mdarray (const E& e, const container_type& c)
│ │ │ │ -
175 : container_(c)
│ │ │ │ -
176 , mapping_(e)
│ │ │ │ -
177 {}
│ │ │ │ -
│ │ │ │ -
178
│ │ │ │ -
180 template <class E = extents_type,
│ │ │ │ -
181 std::enable_if_t<std::is_constructible_v<mapping_type,const E&>, int> = 0>
│ │ │ │ -
│ │ │ │ -
182 constexpr mdarray (const E& e, container_type&& c)
│ │ │ │ -
183 : container_(std::move(c))
│ │ │ │ -
184 , mapping_(e)
│ │ │ │ -
185 {}
│ │ │ │ -
│ │ │ │ -
186
│ │ │ │ -
│ │ │ │ -
188 constexpr mdarray (const mapping_type& m, const container_type& c)
│ │ │ │ -
189 : container_(c)
│ │ │ │ -
190 , mapping_(m)
│ │ │ │ -
191 {}
│ │ │ │ -
│ │ │ │ -
192
│ │ │ │ -
│ │ │ │ -
194 constexpr mdarray (const mapping_type& m, container_type&& c)
│ │ │ │ -
195 : container_(std::move(c))
│ │ │ │ -
196 , mapping_(m)
│ │ │ │ -
197 {}
│ │ │ │ -
│ │ │ │ -
198
│ │ │ │ +
171template<class Begin, class End>
│ │ │ │ +
│ │ │ │ +
172constexpr auto integralRange(const Begin& begin, const End& end)
│ │ │ │ +
173{
│ │ │ │ +
174 return Impl::integralRange(begin, end, PriorityTag<42>());
│ │ │ │ +
175}
│ │ │ │ +
│ │ │ │ +
176
│ │ │ │ +
190template<class End>
│ │ │ │ +
│ │ │ │ +
191constexpr auto integralRange(const End& end)
│ │ │ │ +
192{
│ │ │ │ +
193 return Impl::integralRange(Dune::Indices::_0, end, PriorityTag<42>());
│ │ │ │ +
194}
│ │ │ │ +
│ │ │ │ +
195
│ │ │ │ +
196
│ │ │ │ +
197
│ │ │ │ +
198namespace Impl {
│ │ │ │
199
│ │ │ │ -
200 // -----------------------
│ │ │ │ -
201 // converting constructors
│ │ │ │ -
202
│ │ │ │ -
204 template <class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer,
│ │ │ │ -
205 std::enable_if_t<std::is_constructible_v<Container,const OtherContainer&>, int> = 0,
│ │ │ │ -
206 std::enable_if_t<std::is_constructible_v<extents_type,OtherExtents>, int> = 0,
│ │ │ │ -
207 std::enable_if_t<std::is_constructible_v<mapping_type,const typename OtherLayoutPolicy::template mapping<OtherExtents>&>, int> = 0>
│ │ │ │ -
208 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
209 explicit(
│ │ │ │ -
210 !std::is_convertible_v<const typename OtherLayoutPolicy::template mapping<OtherExtents>&, mapping_type> ||
│ │ │ │ -
211 !std::is_convertible_v<const OtherContainer&, container_type>)
│ │ │ │ -
212 #endif
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
214 : container_(other.container_)
│ │ │ │ -
215 , mapping_(other.mapping_)
│ │ │ │ -
216 {}
│ │ │ │ -
│ │ │ │ -
217
│ │ │ │ -
219 template <class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class Accessor,
│ │ │ │ -
220 std::enable_if_t<std::is_constructible_v<value_type,typename Accessor::reference>, int> = 0,
│ │ │ │ -
221 std::enable_if_t<std::is_assignable_v<typename Accessor::reference, value_type>, int> = 0,
│ │ │ │ -
222 std::enable_if_t<std::is_constructible_v<mapping_type, const typename OtherLayoutPolicy::template mapping<OtherExtents>&>, int> = 0,
│ │ │ │ -
223 decltype(construct_container<container_type>(std::declval<std::size_t>()), bool{}) = true>
│ │ │ │ -
224 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
225 explicit(
│ │ │ │ -
226 !std::is_convertible_v<const typename OtherLayoutPolicy::template mapping<OtherExtents>&, mapping_type> ||
│ │ │ │ -
227 !std::is_convertible_v<typename Accessor::reference, value_type>)
│ │ │ │ -
228 #endif
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
230 : container_(construct_container<container_type>(other.size()))
│ │ │ │ -
231 , mapping_(other.mapping())
│ │ │ │ -
232 {
│ │ │ │ -
233 init_from_mdspan(other);
│ │ │ │ -
234 }
│ │ │ │ -
│ │ │ │ +
200 template<class T>
│ │ │ │ +
201 constexpr void evaluateFoldExpression(std::initializer_list<T>&&)
│ │ │ │ +
202 {}
│ │ │ │ +
203
│ │ │ │ +
204 template<class Range, class F, class Index, Index... i>
│ │ │ │ +
205 constexpr void forEachIndex(Range&& range, F&& f, std::integer_sequence<Index, i...>)
│ │ │ │ +
206 {
│ │ │ │ +
207 evaluateFoldExpression<int>({(f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)...});
│ │ │ │ +
208 }
│ │ │ │ +
209
│ │ │ │ +
210 template<class F, class Index, Index... i>
│ │ │ │ +
211 constexpr void forEach(std::integer_sequence<Index, i...> /*range*/, F&& f, PriorityTag<2>)
│ │ │ │ +
212 {
│ │ │ │ +
213 evaluateFoldExpression<int>({(f(std::integral_constant<Index,i>()), 0)...});
│ │ │ │ +
214 }
│ │ │ │ +
215
│ │ │ │ +
216
│ │ │ │ +
217 template<class Range, class F,
│ │ │ │ +
218 std::enable_if_t<IsIntegralConstant<decltype(Hybrid::size(std::declval<Range>()))>::value, int> = 0>
│ │ │ │ +
219 constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)
│ │ │ │ +
220 {
│ │ │ │ +
221 auto size = Hybrid::size(range);
│ │ │ │ +
222 auto indices = std::make_index_sequence<size>();
│ │ │ │ +
223 (forEachIndex)(std::forward<Range>(range), std::forward<F>(f), indices);
│ │ │ │ +
224 }
│ │ │ │ +
225
│ │ │ │ +
226 template<class Range, class F>
│ │ │ │ +
227 constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)
│ │ │ │ +
228 {
│ │ │ │ +
229 for(auto&& e : range)
│ │ │ │ +
230 f(e);
│ │ │ │ +
231 }
│ │ │ │ +
232
│ │ │ │ +
233} // namespace Impl
│ │ │ │ +
234
│ │ │ │
235
│ │ │ │
236
│ │ │ │ -
237 // ----------------------------
│ │ │ │ -
238 // constructors with allocators
│ │ │ │ -
239
│ │ │ │ -
241 template <class Alloc,
│ │ │ │ -
242 std::enable_if_t<std::is_constructible_v<container_type, std::size_t, Alloc>, int> = 0>
│ │ │ │ -
│ │ │ │ -
243 constexpr mdarray (const extents_type& e, const Alloc& a)
│ │ │ │ -
244 : mdarray(mapping_type(e), a)
│ │ │ │ -
245 {}
│ │ │ │ -
│ │ │ │ -
246
│ │ │ │ -
248 template <class Alloc,
│ │ │ │ -
249 std::enable_if_t<std::is_constructible_v<container_type, std::size_t, Alloc>, int> = 0>
│ │ │ │ -
│ │ │ │ -
250 constexpr mdarray (const mapping_type& m, const Alloc& a)
│ │ │ │ -
251 : container_(m.required_span_size(), a)
│ │ │ │ -
252 , mapping_(m)
│ │ │ │ -
253 {}
│ │ │ │ -
│ │ │ │ -
254
│ │ │ │ -
256 template <class Alloc>
│ │ │ │ -
│ │ │ │ -
257 constexpr mdarray (const extents_type& e, const value_type& v, const Alloc& a)
│ │ │ │ -
258 : mdarray(mapping_type(e), v, a)
│ │ │ │ -
259 {}
│ │ │ │ +
255template<class Range, class F>
│ │ │ │ +
│ │ │ │ +
256constexpr void forEach(Range&& range, F&& f)
│ │ │ │ +
257{
│ │ │ │ +
258 Impl::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>());
│ │ │ │ +
259}
│ │ │ │
│ │ │ │
260
│ │ │ │ -
262 template <class Alloc,
│ │ │ │ -
263 std::enable_if_t<std::is_constructible_v<container_type, std::size_t, value_type, Alloc>, int> = 0>
│ │ │ │ -
│ │ │ │ -
264 constexpr mdarray (const mapping_type& m, const value_type& v, const Alloc& a)
│ │ │ │ -
265 : container_(m.required_span_size(), v, a)
│ │ │ │ -
266 , mapping_(m)
│ │ │ │ -
267 {}
│ │ │ │ -
│ │ │ │ -
268
│ │ │ │ -
270 template <class Alloc,
│ │ │ │ -
271 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ -
│ │ │ │ -
272 constexpr mdarray (const extents_type& e, const container_type& c, const Alloc& a)
│ │ │ │ -
273 : container_(c, a)
│ │ │ │ -
274 , mapping_(e)
│ │ │ │ -
275 {}
│ │ │ │ -
│ │ │ │ -
276
│ │ │ │ -
278 template <class Alloc,
│ │ │ │ -
279 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ -
│ │ │ │ -
280 constexpr mdarray (const extents_type& e, container_type&& c, const Alloc& a)
│ │ │ │ -
281 : container_(std::move(c), a)
│ │ │ │ -
282 , mapping_(e)
│ │ │ │ -
283 {}
│ │ │ │ -
│ │ │ │ -
284
│ │ │ │ -
286 template <class Alloc,
│ │ │ │ -
287 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ -
│ │ │ │ -
288 constexpr mdarray (const mapping_type& m, const container_type& c, const Alloc& a)
│ │ │ │ -
289 : container_(c, a)
│ │ │ │ -
290 , mapping_(m)
│ │ │ │ -
291 {}
│ │ │ │ -
│ │ │ │ -
292
│ │ │ │ -
294 template <class Alloc,
│ │ │ │ -
295 std::enable_if_t<std::is_constructible_v<container_type, container_type, Alloc>, int> = 0>
│ │ │ │ -
│ │ │ │ -
296 constexpr mdarray (const mapping_type& m, container_type&& c, const Alloc& a)
│ │ │ │ -
297 : container_(std::move(c), a)
│ │ │ │ -
298 , mapping_(m)
│ │ │ │ -
299 {}
│ │ │ │ -
│ │ │ │ -
300
│ │ │ │ -
302 template <class V, class E, class L, class C, class Alloc,
│ │ │ │ -
303 std::enable_if_t<std::is_constructible_v<container_type, C, Alloc>, int> = 0>
│ │ │ │ -
304 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
305 explicit(
│ │ │ │ -
306 !std::is_convertible_v<const typename L::template mapping<E>&, mapping_type> ||
│ │ │ │ -
307 !std::is_convertible_v<const C&, container_type>)
│ │ │ │ -
308 #endif
│ │ │ │ -
│ │ │ │ -
309 constexpr mdarray (const mdarray<V,E,L,C>& other, const Alloc& a) noexcept
│ │ │ │ -
310 : container_(other.container_, a)
│ │ │ │ -
311 , mapping_(other.mapping_)
│ │ │ │ -
312 {}
│ │ │ │ -
│ │ │ │ -
313
│ │ │ │ -
315 template <class V, class E, class L, class A, class Alloc,
│ │ │ │ -
316 class C = container_type,
│ │ │ │ -
317 class Al = typename C::allocator_type,
│ │ │ │ -
318 std::enable_if_t<std::is_constructible_v<C, std::size_t, Alloc>, int> = 0>
│ │ │ │ -
319 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
320 explicit(
│ │ │ │ -
321 !std::is_convertible_v<const typename L::template mapping<E>&, mapping_type> ||
│ │ │ │ -
322 !std::is_convertible_v<typename A::reference, value_type> ||
│ │ │ │ -
323 !std::is_convertible_v<Alloc, Al>)
│ │ │ │ -
324 #endif
│ │ │ │ -
│ │ │ │ -
325 constexpr mdarray (const mdspan<V,E,L,A>& other, const Alloc& a)
│ │ │ │ -
326 : container_(other.size(), a)
│ │ │ │ -
327 , mapping_(other.mapping_)
│ │ │ │ -
328 {
│ │ │ │ -
329 init_from_mdspan(other);
│ │ │ │ -
330 }
│ │ │ │ -
│ │ │ │ -
331
│ │ │ │ -
333
│ │ │ │ -
334private:
│ │ │ │ -
335
│ │ │ │ -
336 template <class V, class E, class L, class A, class... Indices>
│ │ │ │ -
337 void init_from_mdspan (const mdspan<V,E,L,A>& other, Indices... ii)
│ │ │ │ -
338 {
│ │ │ │ -
339 constexpr rank_type pos = sizeof...(Indices);
│ │ │ │ -
340 if constexpr(pos < rank()) {
│ │ │ │ -
341 for (typename E::index_type i = 0; i < other.extent(pos); ++i)
│ │ │ │ -
342 init_from_mdspan(other,ii...,i);
│ │ │ │ -
343 } else {
│ │ │ │ -
344 using I = std::array<typename E::index_type,E::rank()>;
│ │ │ │ -
345 container_[mapping_(index_type(ii)...)] = other[I{ii...}];
│ │ │ │ -
346 }
│ │ │ │ -
347 }
│ │ │ │ -
348
│ │ │ │ -
349public:
│ │ │ │ -
350
│ │ │ │ -
353
│ │ │ │ -
360 template <class... Indices,
│ │ │ │ -
361 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
362 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ -
│ │ │ │ -
363 constexpr reference operator() (Indices... indices)
│ │ │ │ -
364 {
│ │ │ │ -
365 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ -
366 }
│ │ │ │ -
│ │ │ │ -
367
│ │ │ │ -
372 template <class... Indices,
│ │ │ │ -
373 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
374 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ -
│ │ │ │ -
375 constexpr const_reference operator() (Indices... indices) const
│ │ │ │ -
376 {
│ │ │ │ -
377 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ -
378 }
│ │ │ │ -
│ │ │ │ -
379
│ │ │ │ -
380
│ │ │ │ -
381#if __cpp_multidimensional_subscript >= 202110L
│ │ │ │ -
382
│ │ │ │ -
384 template <class... Indices,
│ │ │ │ -
385 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
386 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ -
387 constexpr reference operator[] (Indices... indices)
│ │ │ │ -
388 {
│ │ │ │ -
389 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ -
390 }
│ │ │ │ -
391
│ │ │ │ -
393 template <class... Indices,
│ │ │ │ -
394 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
395 std::enable_if_t<(... && std::is_convertible_v<Indices,index_type>), int> = 0>
│ │ │ │ -
396 constexpr const_reference operator[] (Indices... indices) const
│ │ │ │ -
397 {
│ │ │ │ -
398 return container_[mapping_(index_type(std::move(indices))...)];
│ │ │ │ -
399 }
│ │ │ │ -
400
│ │ │ │ -
401#else
│ │ │ │ -
402
│ │ │ │ -
405 template <class Index, class E = extents_type,
│ │ │ │ -
406 std::enable_if_t<std::is_convertible_v<Index,index_type>, int> = 0,
│ │ │ │ -
407 std::enable_if_t<(E::rank() == 1), int> = 0>
│ │ │ │ -
│ │ │ │ -
408 constexpr reference operator[] (Index index)
│ │ │ │ -
409 {
│ │ │ │ -
410 return container_[mapping_(index_type(std::move(index)))];
│ │ │ │ -
411 }
│ │ │ │ -
│ │ │ │ -
412
│ │ │ │ -
415 template <class Index, class E = extents_type,
│ │ │ │ -
416 std::enable_if_t<std::is_convertible_v<Index,index_type>, int> = 0,
│ │ │ │ -
417 std::enable_if_t<(E::rank() == 1), int> = 0>
│ │ │ │ -
│ │ │ │ -
418 constexpr const_reference operator[] (Index index) const
│ │ │ │ -
419 {
│ │ │ │ -
420 return container_[mapping_(index_type(std::move(index)))];
│ │ │ │ -
421 }
│ │ │ │ +
261
│ │ │ │ +
262
│ │ │ │ +
278template<class Range, class T, class F>
│ │ │ │ +
│ │ │ │ +
279constexpr T accumulate(Range&& range, T value, F&& f)
│ │ │ │ +
280{
│ │ │ │ +
281 forEach(std::forward<Range>(range), [&](auto&& entry) {
│ │ │ │ +
282 value = f(value, entry);
│ │ │ │ +
283 });
│ │ │ │ +
284 return value;
│ │ │ │ +
285}
│ │ │ │ +
│ │ │ │ +
286
│ │ │ │ +
287
│ │ │ │ +
288
│ │ │ │ +
289namespace Impl {
│ │ │ │ +
290
│ │ │ │ +
291 struct Id {
│ │ │ │ +
292 template<class T>
│ │ │ │ +
293 constexpr T operator()(T&& x) const {
│ │ │ │ +
294 return std::forward<T>(x);
│ │ │ │ +
295 }
│ │ │ │ +
296 };
│ │ │ │ +
297
│ │ │ │ +
298 template<class IfFunc, class ElseFunc>
│ │ │ │ +
299 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc, ElseFunc&& /*elseFunc*/)
│ │ │ │ +
300 {
│ │ │ │ +
301 return ifFunc(Id{});
│ │ │ │ +
302 }
│ │ │ │ +
303
│ │ │ │ +
304 template<class IfFunc, class ElseFunc>
│ │ │ │ +
305 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/, ElseFunc&& elseFunc)
│ │ │ │ +
306 {
│ │ │ │ +
307 return elseFunc(Id{});
│ │ │ │ +
308 }
│ │ │ │ +
309
│ │ │ │ +
310 template<class IfFunc, class ElseFunc>
│ │ │ │ +
311 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
│ │ │ │ +
312 {
│ │ │ │ +
313 if (condition)
│ │ │ │ +
314 return ifFunc(Id{});
│ │ │ │ +
315 else
│ │ │ │ +
316 return elseFunc(Id{});
│ │ │ │ +
317 }
│ │ │ │ +
318
│ │ │ │ +
319} // namespace Impl
│ │ │ │ +
320
│ │ │ │ +
321
│ │ │ │ +
322
│ │ │ │ +
343template<class Condition, class IfFunc, class ElseFunc>
│ │ │ │ +
│ │ │ │ +
344decltype(auto) ifElse(const Condition& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
│ │ │ │ +
345{
│ │ │ │ +
346 return Impl::ifElse(condition, std::forward<IfFunc>(ifFunc), std::forward<ElseFunc>(elseFunc));
│ │ │ │ +
347}
│ │ │ │
│ │ │ │ +
348
│ │ │ │ +
356template<class Condition, class IfFunc>
│ │ │ │ +
│ │ │ │ +
357void ifElse(const Condition& condition, IfFunc&& ifFunc)
│ │ │ │ +
358{
│ │ │ │ +
359 ifElse(condition, std::forward<IfFunc>(ifFunc), [](auto&&) {});
│ │ │ │ +
360}
│ │ │ │ +
│ │ │ │ +
361
│ │ │ │ +
362
│ │ │ │ +
363
│ │ │ │ +
364namespace Impl {
│ │ │ │ +
365
│ │ │ │ +
366 struct Max {
│ │ │ │ +
367 template<class... Args>
│ │ │ │ +
368 constexpr decltype(auto) operator()(Args&&... args) const
│ │ │ │ +
369 {
│ │ │ │ +
370 using T = std::common_type_t<Args...>;
│ │ │ │ +
371 return std::max({T(args)...});
│ │ │ │ +
372 }
│ │ │ │ +
373 };
│ │ │ │ +
374
│ │ │ │ +
375 struct Min {
│ │ │ │ +
376 template<class... Args>
│ │ │ │ +
377 constexpr decltype(auto) operator()(Args&&... args) const
│ │ │ │ +
378 {
│ │ │ │ +
379 using T = std::common_type_t<Args...>;
│ │ │ │ +
380 return std::min({T(args)...});
│ │ │ │ +
381 }
│ │ │ │ +
382 };
│ │ │ │ +
383
│ │ │ │ +
384} // namespace Impl
│ │ │ │ +
385
│ │ │ │ +
386
│ │ │ │ +
417template<class Functor>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
419
│ │ │ │ +
420 static_assert(std::is_default_constructible_v<Functor>,
│ │ │ │ +
421 "Operator in integral expressions shall be constexpr default constructible");
│ │ │ │
422
│ │ │ │ -
423#endif
│ │ │ │ +
423 inline static constexpr Functor _functor = Functor{};
│ │ │ │
424
│ │ │ │ -
425
│ │ │ │ -
427 template <class Index,
│ │ │ │ -
428 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ -
│ │ │ │ -
429 constexpr reference operator[] (Std::span<Index,extents_type::rank()> indices)
│ │ │ │ -
430 {
│ │ │ │ -
431 return unpackIntegerSequence([&](auto... ii) -> reference {
│ │ │ │ -
432 return container_[mapping_(index_type(indices[ii])...)]; },
│ │ │ │ -
433 std::make_index_sequence<extents_type::rank()>{});
│ │ │ │ -
434 }
│ │ │ │ -
│ │ │ │ -
435
│ │ │ │ -
437 template <class Index,
│ │ │ │ -
438 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ -
│ │ │ │ -
439 constexpr const_reference operator[] (Std::span<Index,extents_type::rank()> indices) const
│ │ │ │ -
440 {
│ │ │ │ -
441 return unpackIntegerSequence([&](auto... ii) -> const_reference {
│ │ │ │ -
442 return container_[mapping_(index_type(indices[ii])...)]; },
│ │ │ │ -
443 std::make_index_sequence<extents_type::rank()>{});
│ │ │ │ -
444 }
│ │ │ │ -
│ │ │ │ -
445
│ │ │ │ -
447 template <class Index,
│ │ │ │ -
448 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ -
│ │ │ │ -
449 constexpr reference operator[] (const std::array<Index,extents_type::rank()>& indices)
│ │ │ │ -
450 {
│ │ │ │ -
451 return std::apply([&](auto... ii) -> reference {
│ │ │ │ -
452 return container_[mapping_(index_type(ii)...)]; }, indices);
│ │ │ │ -
453 }
│ │ │ │ -
│ │ │ │ -
454
│ │ │ │ -
456 template <class Index,
│ │ │ │ -
457 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0>
│ │ │ │ -
│ │ │ │ -
458 constexpr const_reference operator[] (const std::array<Index,extents_type::rank()>& indices) const
│ │ │ │ -
459 {
│ │ │ │ -
460 return std::apply([&](auto... ii) -> const_reference {
│ │ │ │ -
461 return container_[mapping_(index_type(ii)...)]; }, indices);
│ │ │ │ -
462 }
│ │ │ │ +
425public:
│ │ │ │ +
426
│ │ │ │ +
436 template<class... Args>
│ │ │ │ +
│ │ │ │ +
437 constexpr decltype(auto) operator()(const Args&... args) const
│ │ │ │ +
438 {
│ │ │ │ +
439 if constexpr (std::conjunction_v<IsCompileTimeConstant<Args>...>)
│ │ │ │ +
440 {
│ │ │ │ +
441 constexpr auto result = _functor(Args::value...);
│ │ │ │ +
442 // apply functor on integral constant arguments and return an integral constant of the result
│ │ │ │ +
443 // this is guaranteed to be evaluated at compile-time
│ │ │ │ +
444 return std::integral_constant<std::remove_cv_t<decltype(result)>,result>{};
│ │ │ │ +
445 } else {
│ │ │ │ +
446 // apply functor directly on arguments and return the result of the functor
│ │ │ │ +
447 // (integral constants are likely to be casted to underlying type)
│ │ │ │ +
448 // this not is guaranteed to be evaluated at compile-time although is possible if expression is constexpr
│ │ │ │ +
449 return _functor(args...);
│ │ │ │ +
450 }
│ │ │ │ +
451 }
│ │ │ │ +
│ │ │ │ +
452};
│ │ │ │ +
│ │ │ │ +
453
│ │ │ │ +
458template<class Functor>
│ │ │ │ +
│ │ │ │ +
459constexpr HybridFunctor<Functor> hybridFunctor(const Functor&)
│ │ │ │ +
460{
│ │ │ │ +
461 return {};
│ │ │ │ +
462}
│ │ │ │
│ │ │ │
463
│ │ │ │ -
465
│ │ │ │ -
466
│ │ │ │ -
468 constexpr const extents_type& extents () const noexcept { return mapping_.extents(); }
│ │ │ │ -
469
│ │ │ │ -
471 constexpr const mapping_type& mapping () const noexcept { return mapping_; }
│ │ │ │ -
472
│ │ │ │ -
474 constexpr const container_type& container () const noexcept { return container_; }
│ │ │ │ -
475
│ │ │ │ -
482 constexpr container_type&& extract_container () && noexcept { return std::move(container_); }
│ │ │ │ -
483
│ │ │ │ -
484
│ │ │ │ -
487
│ │ │ │ -
489 static constexpr rank_type rank () noexcept { return extents_type::rank(); }
│ │ │ │ -
490
│ │ │ │ -
492 static constexpr rank_type rank_dynamic () noexcept { return extents_type::rank_dynamic(); }
│ │ │ │ -
493
│ │ │ │ -
495 static constexpr std::size_t static_extent (rank_type r) noexcept { return extents_type::static_extent(r); }
│ │ │ │ -
496
│ │ │ │ -
498 constexpr index_type extent (rank_type r) const noexcept { return extents().extent(r); }
│ │ │ │ -
499
│ │ │ │ -
│ │ │ │ -
501 constexpr size_type size () const noexcept
│ │ │ │ -
502 {
│ │ │ │ -
503 size_type s = 1;
│ │ │ │ -
504 for (rank_type r = 0; r < rank(); ++r)
│ │ │ │ -
505 s *= extent(r);
│ │ │ │ -
506 return s;
│ │ │ │ -
507 }
│ │ │ │ -
│ │ │ │ -
508
│ │ │ │ -
510 constexpr std::size_t container_size () const { return container_.size(); }
│ │ │ │ -
511
│ │ │ │ -
513 [[nodiscard]] constexpr bool empty () const noexcept { return size() == 0; }
│ │ │ │ -
514
│ │ │ │ -
516 constexpr index_type stride (rank_type r) const { return mapping().stride(r); };
│ │ │ │ -
517
│ │ │ │ -
519
│ │ │ │ -
520
│ │ │ │ -
521 static constexpr bool is_always_unique () noexcept { return mapping_type::is_always_unique(); }
│ │ │ │ -
522 static constexpr bool is_always_exhaustive () noexcept { return mapping_type::is_always_exhaustive(); }
│ │ │ │ -
523 static constexpr bool is_always_strided () noexcept { return mapping_type::is_always_strided(); }
│ │ │ │ -
524
│ │ │ │ -
525 constexpr bool is_unique () const noexcept { return mapping_.is_unique(); }
│ │ │ │ -
526 constexpr bool is_exhaustive () const noexcept { return mapping_.is_exhaustive(); }
│ │ │ │ -
527 constexpr bool is_strided () const noexcept { return mapping_.is_strided(); }
│ │ │ │ -
528
│ │ │ │ +
484inline constexpr auto max = hybridFunctor(Impl::Max{});
│ │ │ │ +
485
│ │ │ │ +
506inline constexpr auto min = hybridFunctor(Impl::Min{});
│ │ │ │ +
507
│ │ │ │ +
528inline constexpr auto plus = hybridFunctor(std::plus<>{});
│ │ │ │
529
│ │ │ │ -
532
│ │ │ │ -
534 constexpr pointer container_data () noexcept { return Std::to_address(container_.begin()); }
│ │ │ │ -
535
│ │ │ │ -
537 constexpr const_pointer container_data () const noexcept { return Std::to_address(container_.begin()); }
│ │ │ │ -
538
│ │ │ │ -
540
│ │ │ │ -
541
│ │ │ │ -
│ │ │ │ -
542 friend constexpr void swap (mdarray& x, mdarray& y) noexcept
│ │ │ │ -
543 {
│ │ │ │ -
544 using std::swap;
│ │ │ │ -
545 swap(x.container_, y.container_);
│ │ │ │ -
546 swap(x.mapping_, y.mapping_);
│ │ │ │ -
547 }
│ │ │ │ -
│ │ │ │ -
548
│ │ │ │ -
549
│ │ │ │ -
552
│ │ │ │ -
│ │ │ │ -
553 friend constexpr bool operator== (const mdarray& lhs, const mdarray& rhs) noexcept
│ │ │ │ -
554 {
│ │ │ │ -
555 return lhs.mapping() == rhs.mapping() && lhs.container() == rhs.container();
│ │ │ │ -
556 }
│ │ │ │ -
│ │ │ │ -
557
│ │ │ │ -
559
│ │ │ │ -
562
│ │ │ │ -
564 template <class V, class E, class L, class A,
│ │ │ │ -
565 std::enable_if_t<std::is_assignable_v<mdspan<V,E,L,A>, mdspan_type>, int> = 0>
│ │ │ │ -
│ │ │ │ -
566 constexpr operator mdspan<V,E,L,A> ()
│ │ │ │ -
567 {
│ │ │ │ - │ │ │ │ -
569 }
│ │ │ │ -
│ │ │ │ -
570
│ │ │ │ -
572 template <class V, class E, class L, class A,
│ │ │ │ -
573 std::enable_if_t<std::is_assignable_v<mdspan<V,E,L,A>, const_mdspan_type>, int> = 0>
│ │ │ │ -
│ │ │ │ -
574 constexpr operator mdspan<V,E,L,A> () const
│ │ │ │ -
575 {
│ │ │ │ - │ │ │ │ -
577 }
│ │ │ │ -
│ │ │ │ -
578
│ │ │ │ -
580 template <class AccessorPolicy = Std::default_accessor<element_type>,
│ │ │ │ -
581 std::enable_if_t<
│ │ │ │ -
582 std::is_assignable_v<mdspan_type, mdspan<element_type,extents_type,layout_type,AccessorPolicy>>, int> = 0>
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
584 to_mdspan (const AccessorPolicy& a = AccessorPolicy{})
│ │ │ │ -
585 {
│ │ │ │ - │ │ │ │ -
587 }
│ │ │ │ -
│ │ │ │ -
588
│ │ │ │ -
590 template <class AccessorPolicy = Std::default_accessor<const element_type>,
│ │ │ │ -
591 std::enable_if_t<
│ │ │ │ -
592 std::is_assignable_v<const_mdspan_type, mdspan<const element_type,extents_type,layout_type,AccessorPolicy>>, int> = 0>
│ │ │ │ -
593 constexpr mdspan<const element_type,extents_type,layout_type,AccessorPolicy>
│ │ │ │ -
│ │ │ │ -
594 to_mdspan (const AccessorPolicy& a = AccessorPolicy{}) const
│ │ │ │ -
595 {
│ │ │ │ - │ │ │ │ -
597 }
│ │ │ │ -
│ │ │ │ -
598
│ │ │ │ -
599protected:
│ │ │ │ - │ │ │ │ -
601 [[no_unique_address]] mapping_type mapping_;
│ │ │ │ -
602};
│ │ │ │ -
│ │ │ │ -
603
│ │ │ │ -
607
│ │ │ │ -
608template <class IndexType, std::size_t... exts, class Container>
│ │ │ │ -
609mdarray (const Std::extents<IndexType, exts...>&, const Container&)
│ │ │ │ -
610 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ -
611
│ │ │ │ -
612template <class Mapping, class Container>
│ │ │ │ -
613mdarray (const Mapping&, const Container&)
│ │ │ │ - │ │ │ │ -
615
│ │ │ │ -
616template <class IndexType, std::size_t... exts, class Container>
│ │ │ │ -
617mdarray (const Std::extents<IndexType, exts...>&, Container&&)
│ │ │ │ -
618 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ -
619
│ │ │ │ -
620template <class Mapping, class Container>
│ │ │ │ -
621mdarray (const Mapping&, Container&&)
│ │ │ │ - │ │ │ │ -
623
│ │ │ │ -
624template <class Element, class Extents, class Layout, class Accessor>
│ │ │ │ - │ │ │ │ -
626 -> mdarray<std::remove_cv_t<Element>, Extents, Layout>;
│ │ │ │ -
627
│ │ │ │ -
628template <class IndexType, std::size_t... exts, class Container, class Alloc>
│ │ │ │ -
629mdarray (const Std::extents<IndexType, exts...>&, const Container&, const Alloc&)
│ │ │ │ -
630 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ -
631
│ │ │ │ -
632template <class Mapping, class Container, class Alloc>
│ │ │ │ -
633mdarray (const Mapping&, const Container&, const Alloc&)
│ │ │ │ - │ │ │ │ -
635
│ │ │ │ -
636template <class IndexType, std::size_t... exts, class Container, class Alloc>
│ │ │ │ -
637mdarray (const Std::extents<IndexType, exts...>&, Container&&, const Alloc&)
│ │ │ │ -
638 -> mdarray<typename Container::value_type, Std::extents<IndexType, exts...>, layout_right, Container>;
│ │ │ │ -
639
│ │ │ │ -
640template <class Mapping, class Container, class Alloc>
│ │ │ │ -
641mdarray (const Mapping&, Container&&, const Alloc&)
│ │ │ │ - │ │ │ │ +
550inline constexpr auto minus = hybridFunctor(std::minus<>{});
│ │ │ │ +
551
│ │ │ │ +
572inline constexpr auto equal_to = hybridFunctor(std::equal_to<>{});
│ │ │ │ +
573
│ │ │ │ +
574
│ │ │ │ +
586template<class T1, class T2>
│ │ │ │ +
│ │ │ │ +
587[[deprecated("Use Hybrid::equal_to instead!")]] constexpr auto equals(T1&& t1, T2&& t2){
│ │ │ │ +
588 return equal_to(std::forward<T1>(t1), std::forward<T2>(t2));
│ │ │ │ +
589}
│ │ │ │ +
│ │ │ │ +
590
│ │ │ │ +
591
│ │ │ │ +
592namespace Impl {
│ │ │ │ +
593
│ │ │ │ +
594 // This overload is selected if the passed value is already a compile time constant.
│ │ │ │ +
595 template<class Result, class T, T t0, T... tt, class ValueType, ValueType value, class Branches, class ElseBranch>
│ │ │ │ +
596 constexpr Result switchCases(std::integer_sequence<T, t0, tt...>, const std::integral_constant<ValueType, value>& /*value*/, Branches&& branches, ElseBranch&& elseBranch)
│ │ │ │ +
597 {
│ │ │ │ +
598 // In case we pass a value known at compile time, we no longer have to do
│ │ │ │ +
599 // a dynamic to static dispatch via recursion. The only thing that's left
│ │ │ │ +
600 // is to check if the value is contained in the passed range.
│ │ │ │ +
601 // If this is true, we have to pass it to the branches callback
│ │ │ │ +
602 // as an appropriate integral_constant type. Otherwise we have to
│ │ │ │ +
603 // execute the else callback.
│ │ │ │ +
604 if constexpr (((t0 == value) || ... || (tt == value)))
│ │ │ │ +
605 return branches(std::integral_constant<T, value>{});
│ │ │ │ +
606 else
│ │ │ │ +
607 return elseBranch();
│ │ │ │ +
608 }
│ │ │ │ +
609
│ │ │ │ +
610 // This overload is selected if the passed value is dynamic.
│ │ │ │ +
611 template<class Result, class T, class Value, class Branches, class ElseBranch>
│ │ │ │ +
612 constexpr Result switchCases(std::integer_sequence<T>, const Value& /*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch)
│ │ │ │ +
613 {
│ │ │ │ +
614 return elseBranch();
│ │ │ │ +
615 }
│ │ │ │ +
616
│ │ │ │ +
617 template<class Result, class T, T t0, T... tt, class Value, class Branches, class ElseBranch>
│ │ │ │ +
618 constexpr Result switchCases(std::integer_sequence<T, t0, tt...>, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
│ │ │ │ +
619 {
│ │ │ │ +
620 if (t0 == value)
│ │ │ │ +
621 return branches(std::integral_constant<T, t0>());
│ │ │ │ +
622 else
│ │ │ │ +
623 return Impl::switchCases<Result>(std::integer_sequence<T, tt...>(), value, branches, elseBranch);
│ │ │ │ +
624 }
│ │ │ │ +
625
│ │ │ │ +
626 // This overload is selected if the range of cases is an IntegralRange
│ │ │ │ +
627 template <class Result, class T, class Value, class Branches, class ElseBranch>
│ │ │ │ +
628 constexpr Result switchCases(IntegralRange<T> range, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
│ │ │ │ +
629 {
│ │ │ │ +
630 return range.contains(value) ? branches(T(value)) : elseBranch();
│ │ │ │ +
631 }
│ │ │ │ +
632
│ │ │ │ +
633 // This overload is selected if the range of cases is a StaticIntegralRange
│ │ │ │ +
634 template <class Result, class T, T to, T from, class Value, class Branches, class ElseBranch>
│ │ │ │ +
635 constexpr Result switchCases(StaticIntegralRange<T, to, from> range, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
│ │ │ │ +
636 {
│ │ │ │ +
637 using seq = typename decltype(range)::integer_sequence;
│ │ │ │ +
638 return Impl::switchCases<Result>(seq{}, value, branches, elseBranch);
│ │ │ │ +
639 }
│ │ │ │ +
640
│ │ │ │ +
641} // namespace Impl
│ │ │ │ +
642
│ │ │ │
643
│ │ │ │ -
644template <class Element, class Extents, class Layout, class Accessor, class Alloc>
│ │ │ │ - │ │ │ │ -
646 -> mdarray<std::remove_cv_t<Element>, Extents, Layout>;
│ │ │ │ -
647
│ │ │ │ -
649
│ │ │ │ -
653
│ │ │ │ -
654template <class Element, class Extents, class Layout, class Container>
│ │ │ │ - │ │ │ │ -
656 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::element_type,
│ │ │ │ -
657 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::extents_type,
│ │ │ │ -
658 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::layout_type,
│ │ │ │ -
659 typename decltype(std::declval<mdarray<Element, Extents, Layout, Container>>().to_mdspan())::accessor_type>;
│ │ │ │ -
660
│ │ │ │ -
662
│ │ │ │ -
663} // end namespace Dune::Std
│ │ │ │ -
664
│ │ │ │ -
665#endif // DUNE_COMMON_STD_MDARRAY_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
Utilities for reduction like operations on ranges.
│ │ │ │ - │ │ │ │ -
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:124
│ │ │ │ -
STL namespace.
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
constexpr auto to_address(T &&p) noexcept
Obtain the address represented by p without forming a reference to the object pointed to by p.
Definition memory.hh:47
│ │ │ │ -
Get the 'const' version of a reference to a mutable object.
Definition genericiterator.hh:87
│ │ │ │ -
Multidimensional index space with dynamic and static extents.
Definition extents.hh:54
│ │ │ │ -
A layout where the rightmost extent has stride 1, and strides increase right-to-left as the product o...
Definition fwd_layouts.hh:30
│ │ │ │ -
An owning multi-dimensional array analog of mdspan.
Definition mdarray.hh:69
│ │ │ │ -
mdspan< const element_type, extents_type, layout_type > const_mdspan_type
Definition mdarray.hh:91
│ │ │ │ -
constexpr mdarray(const mapping_type &m, const container_type &c, const Alloc &a)
Construct from layout mapping, container and allocator.
Definition mdarray.hh:288
│ │ │ │ -
typename container_type::const_reference const_reference
Definition mdarray.hh:96
│ │ │ │ -
constexpr mdarray(const mapping_type &m, container_type &&c)
Construct from layout mapping and the storage container.
Definition mdarray.hh:194
│ │ │ │ -
Container container_type
Definition mdarray.hh:81
│ │ │ │ -
Extents extents_type
Definition mdarray.hh:79
│ │ │ │ -
constexpr mdarray(const E &e, const container_type &c)
Construct from extents and the storage container.
Definition mdarray.hh:174
│ │ │ │ -
static constexpr bool is_always_exhaustive() noexcept
Definition mdarray.hh:522
│ │ │ │ -
constexpr mdspan< const element_type, extents_type, layout_type, AccessorPolicy > to_mdspan(const AccessorPolicy &a=AccessorPolicy{}) const
Conversion function to mdspan.
Definition mdarray.hh:594
│ │ │ │ -
constexpr index_type stride(rank_type r) const
The stride along the specified dimension.
Definition mdarray.hh:516
│ │ │ │ -
constexpr bool is_unique() const noexcept
Definition mdarray.hh:525
│ │ │ │ -
constexpr index_type extent(rank_type r) const noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdarray.hh:498
│ │ │ │ -
constexpr mdarray(const extents_type &e, const Alloc &a)
Construct from the extents of the array and allocator.
Definition mdarray.hh:243
│ │ │ │ -
static constexpr std::size_t static_extent(rank_type r) noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdarray.hh:495
│ │ │ │ -
mapping_type mapping_
Definition mdarray.hh:601
│ │ │ │ -
constexpr mdarray(const mdspan< OtherElementType, OtherExtents, OtherLayoutPolicy, Accessor > &other)
Converting constructor from mdspan.
Definition mdarray.hh:229
│ │ │ │ -
typename layout_type::template mapping< extents_type > mapping_type
Definition mdarray.hh:84
│ │ │ │ -
constexpr const_pointer container_data() const noexcept
Direct access to the underlying const data in the container.
Definition mdarray.hh:537
│ │ │ │ -
constexpr mdarray(const extents_type &e, const value_type &v)
Construct from extents and initial value.
Definition mdarray.hh:155
│ │ │ │ -
constexpr mdarray(const mapping_type &m, const Alloc &a)
Construct from the layout mapping of the array and allocator.
Definition mdarray.hh:250
│ │ │ │ -
constexpr pointer container_data() noexcept
Direct access to the underlying data in the container.
Definition mdarray.hh:534
│ │ │ │ -
constexpr bool is_exhaustive() const noexcept
Definition mdarray.hh:526
│ │ │ │ -
decltype(Std::to_address(std::declval< container_type >().begin())) pointer
Definition mdarray.hh:93
│ │ │ │ -
constexpr reference operator[](Index index)
Access specified element at position [i0] For a rank one mdarray, the operator[i] is added to support...
Definition mdarray.hh:408
│ │ │ │ -
constexpr const extents_type & extents() const noexcept
Number of elements in all dimensions of the array,.
Definition mdarray.hh:468
│ │ │ │ -
constexpr bool is_strided() const noexcept
Definition mdarray.hh:527
│ │ │ │ -
constexpr mdarray(const mapping_type &m, const container_type &c)
Construct from layout mapping and the storage container.
Definition mdarray.hh:188
│ │ │ │ -
static constexpr bool is_always_unique() noexcept
Definition mdarray.hh:521
│ │ │ │ -
constexpr mdarray(const mapping_type &m, container_type &&c, const Alloc &a)
Construct from layout mapping, container and allocator.
Definition mdarray.hh:296
│ │ │ │ -
constexpr mdarray(const E &e, container_type &&c)
Construct from extents and the storage container.
Definition mdarray.hh:182
│ │ │ │ -
constexpr const container_type & container() const noexcept
The underlying storage container.
Definition mdarray.hh:474
│ │ │ │ -
constexpr std::size_t container_size() const
Size of the underlying container.
Definition mdarray.hh:510
│ │ │ │ -
typename extents_type::size_type size_type
Definition mdarray.hh:87
│ │ │ │ -
static constexpr rank_type rank() noexcept
Number of dimensions of the array.
Definition mdarray.hh:489
│ │ │ │ -
constexpr bool empty() const noexcept
Check whether the index space is empty.
Definition mdarray.hh:513
│ │ │ │ -
constexpr mdarray(const extents_type &e, container_type &&c, const Alloc &a)
Construct from extents, container and allocator.
Definition mdarray.hh:280
│ │ │ │ -
mdspan< element_type, extents_type, layout_type > mdspan_type
Definition mdarray.hh:90
│ │ │ │ -
constexpr size_type size() const noexcept
Size of the multi-dimensional index space.
Definition mdarray.hh:501
│ │ │ │ -
friend constexpr bool operator==(const mdarray &lhs, const mdarray &rhs) noexcept
Definition mdarray.hh:553
│ │ │ │ -
friend constexpr void swap(mdarray &x, mdarray &y) noexcept
Definition mdarray.hh:542
│ │ │ │ -
constexpr const mapping_type & mapping() const noexcept
Index mapping of a layout policy.
Definition mdarray.hh:471
│ │ │ │ -
Element element_type
Definition mdarray.hh:78
│ │ │ │ -
constexpr mdarray(const mapping_type &m, const value_type &v, const Alloc &a)
Construct from layout mapping, initial value and allocator.
Definition mdarray.hh:264
│ │ │ │ -
constexpr mdarray(const extents_type &e, const value_type &v, const Alloc &a)
Construct from extents, initial value and allocator.
Definition mdarray.hh:257
│ │ │ │ -
decltype(Std::to_address(std::declval< container_type >().cbegin())) const_pointer
Definition mdarray.hh:95
│ │ │ │ -
typename container_type::reference reference
Definition mdarray.hh:94
│ │ │ │ -
constexpr mdspan< element_type, extents_type, layout_type, AccessorPolicy > to_mdspan(const AccessorPolicy &a=AccessorPolicy{})
Conversion function to mdspan.
Definition mdarray.hh:584
│ │ │ │ -
element_type value_type
Definition mdarray.hh:83
│ │ │ │ -
LayoutPolicy layout_type
Definition mdarray.hh:80
│ │ │ │ -
constexpr container_type && extract_container() &&noexcept
Move the container out of the mdarray.
Definition mdarray.hh:482
│ │ │ │ -
constexpr mdarray(const extents_type &e, const container_type &c, const Alloc &a)
Construct from extents, container and allocator.
Definition mdarray.hh:272
│ │ │ │ -
typename extents_type::rank_type rank_type
Definition mdarray.hh:88
│ │ │ │ -
static constexpr rank_type rank_dynamic() noexcept
Number of dimension with dynamic size.
Definition mdarray.hh:492
│ │ │ │ -
constexpr reference operator()(Indices... indices)
Access element at position (i0,i1,...)
Definition mdarray.hh:363
│ │ │ │ -
constexpr mdarray(const extents_type &e)
Construct from the extents of the array.
Definition mdarray.hh:138
│ │ │ │ -
container_type container_
Definition mdarray.hh:600
│ │ │ │ -
typename extents_type::index_type index_type
Definition mdarray.hh:86
│ │ │ │ -
constexpr mdarray(IndexTypes... exts)
Construct from the dynamic extents.
Definition mdarray.hh:133
│ │ │ │ -
static constexpr bool is_always_strided() noexcept
Definition mdarray.hh:523
│ │ │ │ -
A multi-dimensional non-owning array view.
Definition mdspan.hh:64
│ │ │ │ -
constexpr index_type extent(rank_type r) const noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdspan.hh:275
│ │ │ │ -
constexpr size_type size() const noexcept
The number of elements accessible by this multi-dimensional span.
Definition mdspan.hh:278
│ │ │ │ -
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │ +
644
│ │ │ │ +
672template<class Cases, class Value, class Branches, class ElseBranch>
│ │ │ │ +
│ │ │ │ +
673constexpr decltype(auto) switchCases(const Cases& cases, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
│ │ │ │ +
674{
│ │ │ │ +
675 return Impl::switchCases<decltype(elseBranch())>(cases, value, std::forward<Branches>(branches), std::forward<ElseBranch>(elseBranch));
│ │ │ │ +
676}
│ │ │ │ +
│ │ │ │ +
677
│ │ │ │ +
697template<class Cases, class Value, class Branches>
│ │ │ │ +
│ │ │ │ +
698constexpr void switchCases(const Cases& cases, const Value& value, Branches&& branches)
│ │ │ │ +
699{
│ │ │ │ +
700 Impl::switchCases<void>(cases, value, std::forward<Branches>(branches),
│ │ │ │ +
701 []{ assert(false && "value not found in range"); });
│ │ │ │ +
702}
│ │ │ │ +
│ │ │ │ +
703
│ │ │ │ +
722template <class T, class Value, class Branches>
│ │ │ │ +
│ │ │ │ +
723constexpr void switchCases(IntegralRange<T> range, const Value& value, Branches&& branches)
│ │ │ │ +
724{
│ │ │ │ +
725 assert(range.contains(value) && "value not found in range");
│ │ │ │ +
726 branches(T(value));
│ │ │ │ +
727}
│ │ │ │ +
│ │ │ │ +
728
│ │ │ │ +
729} // namespace Hybrid
│ │ │ │ +
│ │ │ │ +
730} // namespace Dune
│ │ │ │ +
731
│ │ │ │ +
732
│ │ │ │ +
733#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 type computations, constraining overloads, ...
│ │ │ │ +
Utilities for reduction like operations on ranges.
│ │ │ │ +
constexpr index_constant< 0 > _0
Compile time index with value 0.
Definition indices.hh:52
│ │ │ │ +
static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
Definition rangeutilities.hh:312
│ │ │ │ +
constexpr auto size(const T &t)
Size query.
Definition hybridutilities.hh:73
│ │ │ │ +
constexpr auto minus
Function object for performing subtraction.
Definition hybridutilities.hh:550
│ │ │ │ +
constexpr auto equals(T1 &&t1, T2 &&t2)
Equality comparison.
Definition hybridutilities.hh:587
│ │ │ │ +
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition hybridutilities.hh:256
│ │ │ │ +
constexpr auto equal_to
Function object for performing equality comparison.
Definition hybridutilities.hh:572
│ │ │ │ +
constexpr decltype(auto) switchCases(const Cases &cases, const Value &value, Branches &&branches, ElseBranch &&elseBranch)
Switch statement.
Definition hybridutilities.hh:673
│ │ │ │ +
constexpr auto max
Function object that returns the greater of the given values.
Definition hybridutilities.hh:484
│ │ │ │ +
constexpr auto plus
Function object for performing addition.
Definition hybridutilities.hh:528
│ │ │ │ +
constexpr auto min
Function object that returns the smaller of the given values.
Definition hybridutilities.hh:506
│ │ │ │ +
decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
A conditional expression.
Definition hybridutilities.hh:344
│ │ │ │ +
constexpr auto integralRange(const Begin &begin, const End &end)
Create an integral range.
Definition hybridutilities.hh:172
│ │ │ │ +
constexpr decltype(auto) elementAt(Container &&c, Index &&i)
Get element at given position from container.
Definition hybridutilities.hh:126
│ │ │ │ +
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition hybridutilities.hh:279
│ │ │ │ +
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:492
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
constexpr HybridFunctor< Functor > hybridFunctor(const Functor &)
Returns an HybridFunctor adaptor.
Definition hybridutilities.hh:459
│ │ │ │ +
Definition binaryfunctions.hh:34
│ │ │ │ +
Adapter of a hybrid functor that maintains results hybrid.
Definition hybridutilities.hh:418
│ │ │ │ +
dynamic integer range for use in range-based for loops
Definition rangeutilities.hh:177
│ │ │ │ +
static integer range for use in range-based for loops
Definition rangeutilities.hh:230
│ │ │ │ +
Check if T is an std::integral_constant<I, i>
Definition typetraits.hh:384
│ │ │ │ +
Helper class for tagging priorities.
Definition typeutilities.hh:73
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,909 +1,535 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -mdarray.hh │ │ │ │ │ +hybridutilities.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 © 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_MDARRAY_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_MDARRAY_HH │ │ │ │ │ +5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH │ │ │ │ │ +6#define DUNE_COMMON_HYBRIDUTILITIES_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#if __has_include() │ │ │ │ │ -15 #include │ │ │ │ │ -16#endif │ │ │ │ │ +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_/_r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h> │ │ │ │ │ +16 │ │ │ │ │ 17 │ │ │ │ │ -18#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -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_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_d_s_p_a_n_._h_h> │ │ │ │ │ -22#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_m_e_m_o_r_y_._h_h> │ │ │ │ │ -23#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_i_m_p_l_/_c_o_n_t_a_i_n_e_r_c_o_n_s_t_r_u_c_t_i_o_n_t_r_a_i_t_s_._h_h> │ │ │ │ │ -25 │ │ │ │ │ -26namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ -27 │ │ │ │ │ -66template > │ │ │ │ │ -_6_8class _m_d_a_r_r_a_y │ │ │ │ │ -69{ │ │ │ │ │ -_7_0 template friend class _m_d_a_r_r_a_y; │ │ │ │ │ -71 │ │ │ │ │ -72 static_assert(std::is_object_v); │ │ │ │ │ -73 static_assert(!std::is_abstract_v); │ │ │ │ │ -74 static_assert(!std::is_array_v); │ │ │ │ │ -75 static_assert(std::is_same_v); │ │ │ │ │ -76 │ │ │ │ │ -77public: │ │ │ │ │ -_7_8 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ -_7_9 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ -_8_0 using _l_a_y_o_u_t___t_y_p_e = LayoutPolicy; │ │ │ │ │ -_8_1 using _c_o_n_t_a_i_n_e_r___t_y_p_e = Container; │ │ │ │ │ -82 │ │ │ │ │ -_8_3 using _v_a_l_u_e___t_y_p_e = _e_l_e_m_e_n_t___t_y_p_e; │ │ │ │ │ -_8_4 using _m_a_p_p_i_n_g___t_y_p_e = typename layout_type::template mapping; │ │ │ │ │ -85 │ │ │ │ │ -_8_6 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ -_8_7 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ -_8_8 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ -89 │ │ │ │ │ -_9_0 using _m_d_s_p_a_n___t_y_p_e = _m_d_s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_>; │ │ │ │ │ -_9_1 using _c_o_n_s_t___m_d_s_p_a_n___t_y_p_e = _m_d_s_p_a_n_<_c_o_n_s_t │ │ │ │ │ -_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_>; │ │ │ │ │ -92 │ │ │ │ │ -_9_3 using _p_o_i_n_t_e_r = decltype(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(std::declval │ │ │ │ │ -().begin())); │ │ │ │ │ -_9_4 using _r_e_f_e_r_e_n_c_e = typename container_type::reference; │ │ │ │ │ -_9_5 using _c_o_n_s_t___p_o_i_n_t_e_r = decltype(_S_t_d_:_:_t_o___a_d_d_r_e_s_s(std::declval │ │ │ │ │ -().cbegin())); │ │ │ │ │ -_9_6 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = typename container_type::const_reference; │ │ │ │ │ -97 │ │ │ │ │ -98 static_assert(std::is_constructible_v); │ │ │ │ │ -99 │ │ │ │ │ -100private: │ │ │ │ │ -101 // helper function to construct the container │ │ │ │ │ -102 template │ │ │ │ │ -103 static constexpr auto construct_container (Args&&... args) │ │ │ │ │ -104 -> decltype(Impl::ContainerConstructionTraits::construct(std:: │ │ │ │ │ -forward(args)...)) │ │ │ │ │ -105 { │ │ │ │ │ -106 return Impl::ContainerConstructionTraits::construct(std::forward │ │ │ │ │ -(args)...); │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -109public: │ │ │ │ │ -112 │ │ │ │ │ -114 template = 0, │ │ │ │ │ -116 std::enable_if_t, int> = 0, │ │ │ │ │ -117 std::enable_if_t, int> = 0> │ │ │ │ │ -_1_1_8 constexpr _m_d_a_r_r_a_y () │ │ │ │ │ -119 : _c_o_n_t_a_i_n_e_r__{} │ │ │ │ │ -120 , _m_a_p_p_i_n_g__{} │ │ │ │ │ -121 {} │ │ │ │ │ -122 │ │ │ │ │ -123 │ │ │ │ │ -124 // ------------------------------------- │ │ │ │ │ -125 // constructors from extents or mappings │ │ │ │ │ -126 │ │ │ │ │ -127 │ │ │ │ │ -129 template ), │ │ │ │ │ -int> = 0, │ │ │ │ │ -131 std::enable_if_t, int> │ │ │ │ │ -= 0, │ │ │ │ │ -132 std::enable_if_t<(... && std:: │ │ │ │ │ -is_nothrow_constructible_v), int> = 0> │ │ │ │ │ -_1_3_3 explicit constexpr _m_d_a_r_r_a_y (IndexTypes... exts) │ │ │ │ │ -134 : _m_d_a_r_r_a_y(_e_x_t_e_n_t_s___t_y_p_e(_i_n_d_e_x___t_y_p_e(_s_t_d::move(exts))...)) │ │ │ │ │ -135 {} │ │ │ │ │ -136 │ │ │ │ │ -_1_3_8 explicit constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e) │ │ │ │ │ -139 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e)) │ │ │ │ │ -140 {} │ │ │ │ │ -141 │ │ │ │ │ -143 template (std::declval()), bool{}) = │ │ │ │ │ -true> │ │ │ │ │ -_1_4_5 explicit constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m) │ │ │ │ │ -146 : _c_o_n_t_a_i_n_e_r__(construct_container(m.required_span_size())) │ │ │ │ │ -147 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -148 {} │ │ │ │ │ +18 │ │ │ │ │ +19namespace _D_u_n_e { │ │ │ │ │ +_2_0namespace Hybrid { │ │ │ │ │ +21 │ │ │ │ │ +22namespace Impl { │ │ │ │ │ +23 │ │ │ │ │ +24 // Try if std::tuple_size is implemented for class │ │ │ │ │ +25 template │ │ │ │ │ +26 constexpr auto size(const T&, const _P_r_i_o_r_i_t_y_T_a_g_<_2_>&) │ │ │ │ │ +27 -> decltype(std::integral_constant::value>()) │ │ │ │ │ +28 { │ │ │ │ │ +29 return {}; │ │ │ │ │ +30 } │ │ │ │ │ +31 │ │ │ │ │ +32 // Try if there's a static constexpr size() method │ │ │ │ │ +33 template │ │ │ │ │ +34 constexpr auto size(const T&, const _P_r_i_o_r_i_t_y_T_a_g_<_1_>&) │ │ │ │ │ +35 -> decltype(std::integral_constant()) │ │ │ │ │ +36 { │ │ │ │ │ +37 return {}; │ │ │ │ │ +38 } │ │ │ │ │ +39 │ │ │ │ │ +40 // As a last resort try if there's a non-static size() │ │ │ │ │ +41 template │ │ │ │ │ +42 constexpr auto size(const T& t, const _P_r_i_o_r_i_t_y_T_a_g_<_0_>&) │ │ │ │ │ +43 { │ │ │ │ │ +44 return t.size(); │ │ │ │ │ +45 } │ │ │ │ │ +46 │ │ │ │ │ +47} // namespace Impl │ │ │ │ │ +48 │ │ │ │ │ +49 │ │ │ │ │ +50 │ │ │ │ │ +72template │ │ │ │ │ +_7_3constexpr auto _s_i_z_e(const T& t) │ │ │ │ │ +74{ │ │ │ │ │ +75 return Impl::size(t, _P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ +76} │ │ │ │ │ +77 │ │ │ │ │ +78 │ │ │ │ │ +79 │ │ │ │ │ +80namespace Impl { │ │ │ │ │ +81 │ │ │ │ │ +82 template>::value, int> = 0> │ │ │ │ │ +84 constexpr decltype(auto) elementAt(Container&& c, Index&&, _P_r_i_o_r_i_t_y_T_a_g_<_2_>) │ │ │ │ │ +85 { │ │ │ │ │ +86 return std::get::value>(c); │ │ │ │ │ +87 } │ │ │ │ │ +88 │ │ │ │ │ +89 template │ │ │ │ │ +90 constexpr decltype(auto) elementAt(std::integer_sequence c, Index, │ │ │ │ │ +PriorityTag<1>) │ │ │ │ │ +91 { │ │ │ │ │ +92 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()); │ │ │ │ │ +93 } │ │ │ │ │ +94 │ │ │ │ │ +95 template │ │ │ │ │ +96 constexpr decltype(auto) elementAt(Container&& c, Index&& i, PriorityTag<0>) │ │ │ │ │ +97 { │ │ │ │ │ +98 return c[i]; │ │ │ │ │ +99 } │ │ │ │ │ +100 │ │ │ │ │ +101} // namespace Impl │ │ │ │ │ +102 │ │ │ │ │ +103 │ │ │ │ │ +104 │ │ │ │ │ +125template │ │ │ │ │ +_1_2_6constexpr decltype(auto) _e_l_e_m_e_n_t_A_t(Container&& c, Index&& i) │ │ │ │ │ +127{ │ │ │ │ │ +128 return Impl::elementAt(std::forward(c), std::forward(i), │ │ │ │ │ +_P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ +129} │ │ │ │ │ +130 │ │ │ │ │ +131 │ │ │ │ │ +132 │ │ │ │ │ +133namespace Impl { │ │ │ │ │ +134 │ │ │ │ │ +135 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> │ │ │ │ │ +137 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/, │ │ │ │ │ +const _P_r_i_o_r_i_t_y_T_a_g_<_1_>&) │ │ │ │ │ +138 { │ │ │ │ │ +139 static_assert(Begin::value <= End::value, "You cannot create an │ │ │ │ │ +integralRange where end(); │ │ │ │ │ +141 } │ │ │ │ │ +142 │ │ │ │ │ +143 template │ │ │ │ │ +144 constexpr auto integralRange(const Begin& begin, const End& end, const │ │ │ │ │ +PriorityTag<0>&) │ │ │ │ │ +145 { │ │ │ │ │ +146 assert(begin<=end && "You cannot create an integralRange where end(begin, end); │ │ │ │ │ +148 } │ │ │ │ │ 149 │ │ │ │ │ -150 │ │ │ │ │ -151 // --------------------------------------- │ │ │ │ │ -152 // constructors with a given initial value │ │ │ │ │ +150} // namespace Impl │ │ │ │ │ +151 │ │ │ │ │ +152 │ │ │ │ │ 153 │ │ │ │ │ -_1_5_5 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const _v_a_l_u_e___t_y_p_e& v) │ │ │ │ │ -156 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e), v) │ │ │ │ │ -157 {} │ │ │ │ │ -158 │ │ │ │ │ -160 template (std::declval(),std:: │ │ │ │ │ -declval()), bool{}) = true> │ │ │ │ │ -_1_6_2 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _v_a_l_u_e___t_y_p_e& v) │ │ │ │ │ -163 : _c_o_n_t_a_i_n_e_r__(construct_container(m.required_span_size(), v)) │ │ │ │ │ -164 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -165 {} │ │ │ │ │ -166 │ │ │ │ │ -167 │ │ │ │ │ -168 // ----------------------------------- │ │ │ │ │ -169 // constructors with a given container │ │ │ │ │ -170 │ │ │ │ │ -172 template , int> = 0> │ │ │ │ │ -_1_7_4 constexpr _m_d_a_r_r_a_y (const E& e, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c) │ │ │ │ │ -175 : _c_o_n_t_a_i_n_e_r__(c) │ │ │ │ │ -176 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ -177 {} │ │ │ │ │ -178 │ │ │ │ │ -180 template , int> = 0> │ │ │ │ │ -_1_8_2 constexpr _m_d_a_r_r_a_y (const E& e, _c_o_n_t_a_i_n_e_r___t_y_p_e&& c) │ │ │ │ │ -183 : _c_o_n_t_a_i_n_e_r__(_s_t_d::move(c)) │ │ │ │ │ -184 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ -185 {} │ │ │ │ │ -186 │ │ │ │ │ -_1_8_8 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c) │ │ │ │ │ -189 : _c_o_n_t_a_i_n_e_r__(c) │ │ │ │ │ -190 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -191 {} │ │ │ │ │ -192 │ │ │ │ │ -_1_9_4 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, _c_o_n_t_a_i_n_e_r___t_y_p_e&& c) │ │ │ │ │ -195 : _c_o_n_t_a_i_n_e_r__(_s_t_d::move(c)) │ │ │ │ │ -196 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -197 {} │ │ │ │ │ -198 │ │ │ │ │ +171template │ │ │ │ │ +_1_7_2constexpr auto _i_n_t_e_g_r_a_l_R_a_n_g_e(const Begin& begin, const End& end) │ │ │ │ │ +173{ │ │ │ │ │ +174 return Impl::integralRange(begin, end, _P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()); │ │ │ │ │ +175} │ │ │ │ │ +176 │ │ │ │ │ +190template │ │ │ │ │ +_1_9_1constexpr auto _i_n_t_e_g_r_a_l_R_a_n_g_e(const End& end) │ │ │ │ │ +192{ │ │ │ │ │ +193 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_>()); │ │ │ │ │ +194} │ │ │ │ │ +195 │ │ │ │ │ +196 │ │ │ │ │ +197 │ │ │ │ │ +198namespace Impl { │ │ │ │ │ 199 │ │ │ │ │ -200 // ----------------------- │ │ │ │ │ -201 // converting constructors │ │ │ │ │ -202 │ │ │ │ │ -204 template , │ │ │ │ │ -int> = 0, │ │ │ │ │ -206 std::enable_if_t, int> = │ │ │ │ │ -0, │ │ │ │ │ -207 std::enable_if_t&>, int> = 0> │ │ │ │ │ -208 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -209 explicit( │ │ │ │ │ -210 !std::is_convertible_v&, _m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ -211 !std::is_convertible_v) │ │ │ │ │ -212 #endif │ │ │ │ │ -_2_1_3 constexpr _m_d_a_r_r_a_y (const │ │ │ │ │ -_m_d_a_r_r_a_y_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_O_t_h_e_r_E_x_t_e_n_t_s_,_O_t_h_e_r_L_a_y_o_u_t_P_o_l_i_c_y_,_O_t_h_e_r_C_o_n_t_a_i_n_e_r_>& other) │ │ │ │ │ -214 : _c_o_n_t_a_i_n_e_r__(other._c_o_n_t_a_i_n_e_r__) │ │ │ │ │ -215 , _m_a_p_p_i_n_g__(other._m_a_p_p_i_n_g__) │ │ │ │ │ -216 {} │ │ │ │ │ -217 │ │ │ │ │ -219 template , int> = 0, │ │ │ │ │ -221 std::enable_if_t, int> = 0, │ │ │ │ │ -222 std::enable_if_t&>, int> = 0, │ │ │ │ │ -223 decltype(construct_container(std::declval()), │ │ │ │ │ -bool{}) = true> │ │ │ │ │ -224 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -225 explicit( │ │ │ │ │ -226 !std::is_convertible_v&, _m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ -227 !std::is_convertible_v) │ │ │ │ │ -228 #endif │ │ │ │ │ -_2_2_9 constexpr _m_d_a_r_r_a_y (const │ │ │ │ │ -_m_d_s_p_a_n_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_O_t_h_e_r_E_x_t_e_n_t_s_,_O_t_h_e_r_L_a_y_o_u_t_P_o_l_i_c_y_,_A_c_c_e_s_s_o_r_>& other) │ │ │ │ │ -230 : _c_o_n_t_a_i_n_e_r__(construct_container<_c_o_n_t_a_i_n_e_r___t_y_p_e>(other._s_i_z_e())) │ │ │ │ │ -231 , _m_a_p_p_i_n_g__(other._m_a_p_p_i_n_g()) │ │ │ │ │ -232 { │ │ │ │ │ -233 init_from_mdspan(other); │ │ │ │ │ -234 } │ │ │ │ │ +200 template │ │ │ │ │ +201 constexpr void evaluateFoldExpression(std::initializer_list&&) │ │ │ │ │ +202 {} │ │ │ │ │ +203 │ │ │ │ │ +204 template │ │ │ │ │ +205 constexpr void forEachIndex(Range&& _r_a_n_g_e, F&& f, std:: │ │ │ │ │ +integer_sequence) │ │ │ │ │ +206 { │ │ │ │ │ +207 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)...}); │ │ │ │ │ +208 } │ │ │ │ │ +209 │ │ │ │ │ +210 template │ │ │ │ │ +211 constexpr void forEach(std::integer_sequence /*range*/, F&& f, │ │ │ │ │ +PriorityTag<2>) │ │ │ │ │ +212 { │ │ │ │ │ +213 evaluateFoldExpression({(f(std::integral_constant()), │ │ │ │ │ +0)...}); │ │ │ │ │ +214 } │ │ │ │ │ +215 │ │ │ │ │ +216 │ │ │ │ │ +217 template()))>::value, int> = 0> │ │ │ │ │ +219 constexpr void forEach(Range&& _r_a_n_g_e, F&& f, PriorityTag<1>) │ │ │ │ │ +220 { │ │ │ │ │ +221 auto size = _H_y_b_r_i_d_:_:_s_i_z_e(_r_a_n_g_e); │ │ │ │ │ +222 auto indices = std::make_index_sequence(); │ │ │ │ │ +223 (forEachIndex)(std::forward(_r_a_n_g_e), std::forward(f), indices); │ │ │ │ │ +224 } │ │ │ │ │ +225 │ │ │ │ │ +226 template │ │ │ │ │ +227 constexpr void forEach(Range&& _r_a_n_g_e, F&& f, PriorityTag<0>) │ │ │ │ │ +228 { │ │ │ │ │ +229 for(auto&& e : _r_a_n_g_e) │ │ │ │ │ +230 f(e); │ │ │ │ │ +231 } │ │ │ │ │ +232 │ │ │ │ │ +233} // namespace Impl │ │ │ │ │ +234 │ │ │ │ │ 235 │ │ │ │ │ 236 │ │ │ │ │ -237 // ---------------------------- │ │ │ │ │ -238 // constructors with allocators │ │ │ │ │ -239 │ │ │ │ │ -241 template , int> = 0> │ │ │ │ │ -_2_4_3 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const Alloc& a) │ │ │ │ │ -244 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e), a) │ │ │ │ │ -245 {} │ │ │ │ │ -246 │ │ │ │ │ -248 template , int> = 0> │ │ │ │ │ -_2_5_0 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const Alloc& a) │ │ │ │ │ -251 : _c_o_n_t_a_i_n_e_r__(m.required_span_size(), a) │ │ │ │ │ -252 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -253 {} │ │ │ │ │ -254 │ │ │ │ │ -256 template │ │ │ │ │ -_2_5_7 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const _v_a_l_u_e___t_y_p_e& v, const Alloc& │ │ │ │ │ -a) │ │ │ │ │ -258 : _m_d_a_r_r_a_y(_m_a_p_p_i_n_g___t_y_p_e(e), v, a) │ │ │ │ │ -259 {} │ │ │ │ │ +255template │ │ │ │ │ +_2_5_6constexpr void _f_o_r_E_a_c_h(Range&& _r_a_n_g_e, F&& f) │ │ │ │ │ +257{ │ │ │ │ │ +258 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_>()); │ │ │ │ │ +259} │ │ │ │ │ 260 │ │ │ │ │ -262 template , int> = 0> │ │ │ │ │ -_2_6_4 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _v_a_l_u_e___t_y_p_e& v, const Alloc& │ │ │ │ │ -a) │ │ │ │ │ -265 : _c_o_n_t_a_i_n_e_r__(m.required_span_size(), v, a) │ │ │ │ │ -266 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -267 {} │ │ │ │ │ -268 │ │ │ │ │ -270 template , int> = 0> │ │ │ │ │ -_2_7_2 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c, const │ │ │ │ │ -Alloc& a) │ │ │ │ │ -273 : _c_o_n_t_a_i_n_e_r__(c, a) │ │ │ │ │ -274 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ -275 {} │ │ │ │ │ -276 │ │ │ │ │ -278 template , int> = 0> │ │ │ │ │ -_2_8_0 constexpr _m_d_a_r_r_a_y (const _e_x_t_e_n_t_s___t_y_p_e& e, _c_o_n_t_a_i_n_e_r___t_y_p_e&& c, const Alloc& │ │ │ │ │ -a) │ │ │ │ │ -281 : _c_o_n_t_a_i_n_e_r__(_s_t_d::move(c), a) │ │ │ │ │ -282 , _m_a_p_p_i_n_g__(e) │ │ │ │ │ -283 {} │ │ │ │ │ -284 │ │ │ │ │ -286 template , int> = 0> │ │ │ │ │ -_2_8_8 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, const _c_o_n_t_a_i_n_e_r___t_y_p_e& c, const │ │ │ │ │ -Alloc& a) │ │ │ │ │ -289 : _c_o_n_t_a_i_n_e_r__(c, a) │ │ │ │ │ -290 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -291 {} │ │ │ │ │ -292 │ │ │ │ │ -294 template , int> = 0> │ │ │ │ │ -_2_9_6 constexpr _m_d_a_r_r_a_y (const _m_a_p_p_i_n_g___t_y_p_e& m, _c_o_n_t_a_i_n_e_r___t_y_p_e&& c, const Alloc& │ │ │ │ │ -a) │ │ │ │ │ -297 : _c_o_n_t_a_i_n_e_r__(_s_t_d::move(c), a) │ │ │ │ │ -298 , _m_a_p_p_i_n_g__(m) │ │ │ │ │ -299 {} │ │ │ │ │ -300 │ │ │ │ │ -302 template , int> = │ │ │ │ │ -0> │ │ │ │ │ -304 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -305 explicit( │ │ │ │ │ -306 !std::is_convertible_v&, │ │ │ │ │ -_m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ -307 !std::is_convertible_v) │ │ │ │ │ -308 #endif │ │ │ │ │ -_3_0_9 constexpr _m_d_a_r_r_a_y (const _m_d_a_r_r_a_y_<_V_,_E_,_L_,_C_>& other, const Alloc& a) noexcept │ │ │ │ │ -310 : _c_o_n_t_a_i_n_e_r__(other._c_o_n_t_a_i_n_e_r__, a) │ │ │ │ │ -311 , _m_a_p_p_i_n_g__(other._m_a_p_p_i_n_g__) │ │ │ │ │ -312 {} │ │ │ │ │ -313 │ │ │ │ │ -315 template , int> = 0> │ │ │ │ │ -319 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -320 explicit( │ │ │ │ │ -321 !std::is_convertible_v&, │ │ │ │ │ -_m_a_p_p_i_n_g___t_y_p_e> || │ │ │ │ │ -322 !std::is_convertible_v || │ │ │ │ │ -323 !std::is_convertible_v) │ │ │ │ │ -324 #endif │ │ │ │ │ -_3_2_5 constexpr _m_d_a_r_r_a_y (const _m_d_s_p_a_n_<_V_,_E_,_L_,_A_>& other, const Alloc& a) │ │ │ │ │ -326 : _c_o_n_t_a_i_n_e_r__(other._s_i_z_e(), a) │ │ │ │ │ -327 , _m_a_p_p_i_n_g__(other.mapping_) │ │ │ │ │ -328 { │ │ │ │ │ -329 init_from_mdspan(other); │ │ │ │ │ -330 } │ │ │ │ │ -331 │ │ │ │ │ -333 │ │ │ │ │ -334private: │ │ │ │ │ -335 │ │ │ │ │ -336 template │ │ │ │ │ -337 void init_from_mdspan (const _m_d_s_p_a_n_<_V_,_E_,_L_,_A_>& other, Indices... ii) │ │ │ │ │ -338 { │ │ │ │ │ -339 constexpr _r_a_n_k___t_y_p_e pos = sizeof...(Indices); │ │ │ │ │ -340 if constexpr(pos < _r_a_n_k()) { │ │ │ │ │ -341 for (typename E::index_type i = 0; i < other._e_x_t_e_n_t(pos); ++i) │ │ │ │ │ -342 init_from_mdspan(other,ii...,i); │ │ │ │ │ -343 } else { │ │ │ │ │ -344 using I = std::array; │ │ │ │ │ -345 _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(ii)...)] = other[I{ii...}]; │ │ │ │ │ -346 } │ │ │ │ │ -347 } │ │ │ │ │ +261 │ │ │ │ │ +262 │ │ │ │ │ +278template │ │ │ │ │ +_2_7_9constexpr T _a_c_c_u_m_u_l_a_t_e(Range&& _r_a_n_g_e, T value, F&& f) │ │ │ │ │ +280{ │ │ │ │ │ +281 _f_o_r_E_a_c_h(std::forward(_r_a_n_g_e), [&](auto&& entry) { │ │ │ │ │ +282 value = f(value, entry); │ │ │ │ │ +283 }); │ │ │ │ │ +284 return value; │ │ │ │ │ +285} │ │ │ │ │ +286 │ │ │ │ │ +287 │ │ │ │ │ +288 │ │ │ │ │ +289namespace Impl { │ │ │ │ │ +290 │ │ │ │ │ +291 struct Id { │ │ │ │ │ +292 template │ │ │ │ │ +293 constexpr T operator()(T&& x) const { │ │ │ │ │ +294 return std::forward(x); │ │ │ │ │ +295 } │ │ │ │ │ +296 }; │ │ │ │ │ +297 │ │ │ │ │ +298 template │ │ │ │ │ +299 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc, ElseFunc&& │ │ │ │ │ +/*elseFunc*/) │ │ │ │ │ +300 { │ │ │ │ │ +301 return ifFunc(Id{}); │ │ │ │ │ +302 } │ │ │ │ │ +303 │ │ │ │ │ +304 template │ │ │ │ │ +305 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/, │ │ │ │ │ +ElseFunc&& elseFunc) │ │ │ │ │ +306 { │ │ │ │ │ +307 return elseFunc(Id{}); │ │ │ │ │ +308 } │ │ │ │ │ +309 │ │ │ │ │ +310 template │ │ │ │ │ +311 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&& │ │ │ │ │ +elseFunc) │ │ │ │ │ +312 { │ │ │ │ │ +313 if (condition) │ │ │ │ │ +314 return ifFunc(Id{}); │ │ │ │ │ +315 else │ │ │ │ │ +316 return elseFunc(Id{}); │ │ │ │ │ +317 } │ │ │ │ │ +318 │ │ │ │ │ +319} // namespace Impl │ │ │ │ │ +320 │ │ │ │ │ +321 │ │ │ │ │ +322 │ │ │ │ │ +343template │ │ │ │ │ +_3_4_4decltype(auto) _i_f_E_l_s_e(const Condition& condition, IfFunc&& ifFunc, │ │ │ │ │ +ElseFunc&& elseFunc) │ │ │ │ │ +345{ │ │ │ │ │ +346 return Impl::ifElse(condition, std::forward(ifFunc), std:: │ │ │ │ │ +forward(elseFunc)); │ │ │ │ │ +347} │ │ │ │ │ 348 │ │ │ │ │ -349public: │ │ │ │ │ -350 │ │ │ │ │ -353 │ │ │ │ │ -360 template = 0, │ │ │ │ │ -362 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ -0> │ │ │ │ │ -_3_6_3 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_(_)_ (Indices... indices) │ │ │ │ │ -364 { │ │ │ │ │ -365 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ -366 } │ │ │ │ │ -367 │ │ │ │ │ -372 template = 0, │ │ │ │ │ -374 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ -0> │ │ │ │ │ -_3_7_5 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_(_)_ (Indices... indices) const │ │ │ │ │ -376 { │ │ │ │ │ -377 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ -378 } │ │ │ │ │ -379 │ │ │ │ │ -380 │ │ │ │ │ -381#if __cpp_multidimensional_subscript >= 202110L │ │ │ │ │ -382 │ │ │ │ │ -384 template = 0, │ │ │ │ │ -386 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ -0> │ │ │ │ │ -387 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (Indices... indices) │ │ │ │ │ -388 { │ │ │ │ │ -389 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ -390 } │ │ │ │ │ -391 │ │ │ │ │ -393 template = 0, │ │ │ │ │ -395 std::enable_if_t<(... && std::is_convertible_v), int> = │ │ │ │ │ -0> │ │ │ │ │ -396 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (Indices... indices) const │ │ │ │ │ -397 { │ │ │ │ │ -398 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(indices))...)]; │ │ │ │ │ -399 } │ │ │ │ │ -400 │ │ │ │ │ -401#else │ │ │ │ │ -402 │ │ │ │ │ -405 template , int> = 0, │ │ │ │ │ -407 std::enable_if_t<(E::rank() == 1), int> = 0> │ │ │ │ │ -_4_0_8 constexpr _r_e_f_e_r_e_n_c_e operator[] (Index index) │ │ │ │ │ -409 { │ │ │ │ │ -410 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(index)))]; │ │ │ │ │ -411 } │ │ │ │ │ -412 │ │ │ │ │ -415 template , int> = 0, │ │ │ │ │ -417 std::enable_if_t<(E::rank() == 1), int> = 0> │ │ │ │ │ -_4_1_8 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e operator[] (Index index) const │ │ │ │ │ -419 { │ │ │ │ │ -420 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(std::move(index)))]; │ │ │ │ │ -421 } │ │ │ │ │ +356template │ │ │ │ │ +_3_5_7void _i_f_E_l_s_e(const Condition& condition, IfFunc&& ifFunc) │ │ │ │ │ +358{ │ │ │ │ │ +359 _i_f_E_l_s_e(condition, std::forward(ifFunc), [](auto&&) {}); │ │ │ │ │ +360} │ │ │ │ │ +361 │ │ │ │ │ +362 │ │ │ │ │ +363 │ │ │ │ │ +364namespace Impl { │ │ │ │ │ +365 │ │ │ │ │ +366 struct _M_a_x { │ │ │ │ │ +367 template │ │ │ │ │ +368 constexpr decltype(auto) operator()(Args&&... args) const │ │ │ │ │ +369 { │ │ │ │ │ +370 using T = std::common_type_t; │ │ │ │ │ +371 return std::max({T(args)...}); │ │ │ │ │ +372 } │ │ │ │ │ +373 }; │ │ │ │ │ +374 │ │ │ │ │ +375 struct Min { │ │ │ │ │ +376 template │ │ │ │ │ +377 constexpr decltype(auto) operator()(Args&&... args) const │ │ │ │ │ +378 { │ │ │ │ │ +379 using T = std::common_type_t; │ │ │ │ │ +380 return std::min({T(args)...}); │ │ │ │ │ +381 } │ │ │ │ │ +382 }; │ │ │ │ │ +383 │ │ │ │ │ +384} // namespace Impl │ │ │ │ │ +385 │ │ │ │ │ +386 │ │ │ │ │ +417template │ │ │ │ │ +_4_1_8class _H_y_b_r_i_d_F_u_n_c_t_o_r { │ │ │ │ │ +419 │ │ │ │ │ +420 static_assert(std::is_default_constructible_v, │ │ │ │ │ +421 "Operator in integral expressions shall be constexpr default │ │ │ │ │ +constructible"); │ │ │ │ │ 422 │ │ │ │ │ -423#endif │ │ │ │ │ +423 inline static constexpr Functor _functor = Functor{}; │ │ │ │ │ 424 │ │ │ │ │ -425 │ │ │ │ │ -427 template , int> = 0> │ │ │ │ │ -_4_2_9 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (_S_t_d_:_:_s_p_a_n │ │ │ │ │ -indices) │ │ │ │ │ -430 { │ │ │ │ │ -431 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ -432 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(indices[ii])...)]; }, │ │ │ │ │ -433 std::make_index_sequence{}); │ │ │ │ │ -434 } │ │ │ │ │ -435 │ │ │ │ │ -437 template , int> = 0> │ │ │ │ │ -_4_3_9 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (_S_t_d_:_:_s_p_a_n │ │ │ │ │ -indices) const │ │ │ │ │ +425public: │ │ │ │ │ +426 │ │ │ │ │ +436 template │ │ │ │ │ +_4_3_7 constexpr decltype(auto) operator()(const Args&... args) const │ │ │ │ │ +438 { │ │ │ │ │ +439 if constexpr (std::conjunction_v...>) │ │ │ │ │ 440 { │ │ │ │ │ -441 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... ii) -> _c_o_n_s_t___r_e_f_e_r_e_n_c_e { │ │ │ │ │ -442 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(indices[ii])...)]; }, │ │ │ │ │ -443 std::make_index_sequence{}); │ │ │ │ │ -444 } │ │ │ │ │ -445 │ │ │ │ │ -447 template , int> = 0> │ │ │ │ │ -_4_4_9 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (const std::array& indices) │ │ │ │ │ -450 { │ │ │ │ │ -451 return std::apply([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ -452 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(ii)...)]; }, indices); │ │ │ │ │ -453 } │ │ │ │ │ -454 │ │ │ │ │ -456 template , int> = 0> │ │ │ │ │ -_4_5_8 constexpr _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (const std::array& indices) const │ │ │ │ │ -459 { │ │ │ │ │ -460 return std::apply([&](auto... ii) -> _c_o_n_s_t___r_e_f_e_r_e_n_c_e { │ │ │ │ │ -461 return _c_o_n_t_a_i_n_e_r__[_m_a_p_p_i_n_g__(_i_n_d_e_x___t_y_p_e(ii)...)]; }, indices); │ │ │ │ │ -462 } │ │ │ │ │ +441 constexpr auto result = _functor(Args::value...); │ │ │ │ │ +442 // apply functor on integral constant arguments and return an integral │ │ │ │ │ +constant of the result │ │ │ │ │ +443 // this is guaranteed to be evaluated at compile-time │ │ │ │ │ +444 return std::integral_constant,result>{}; │ │ │ │ │ +445 } else { │ │ │ │ │ +446 // apply functor directly on arguments and return the result of the functor │ │ │ │ │ +447 // (integral constants are likely to be casted to underlying type) │ │ │ │ │ +448 // this not is guaranteed to be evaluated at compile-time although is │ │ │ │ │ +possible if expression is constexpr │ │ │ │ │ +449 return _functor(args...); │ │ │ │ │ +450 } │ │ │ │ │ +451 } │ │ │ │ │ +452}; │ │ │ │ │ +453 │ │ │ │ │ +458template │ │ │ │ │ +_4_5_9constexpr _H_y_b_r_i_d_F_u_n_c_t_o_r_<_F_u_n_c_t_o_r_> _h_y_b_r_i_d_F_u_n_c_t_o_r(const Functor&) │ │ │ │ │ +460{ │ │ │ │ │ +461 return {}; │ │ │ │ │ +462} │ │ │ │ │ 463 │ │ │ │ │ -465 │ │ │ │ │ -466 │ │ │ │ │ -_4_6_8 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return │ │ │ │ │ -_m_a_p_p_i_n_g__.extents(); } │ │ │ │ │ -469 │ │ │ │ │ -_4_7_1 constexpr const _m_a_p_p_i_n_g___t_y_p_e& _m_a_p_p_i_n_g () const noexcept { return _m_a_p_p_i_n_g__; │ │ │ │ │ -} │ │ │ │ │ -472 │ │ │ │ │ -_4_7_4 constexpr const _c_o_n_t_a_i_n_e_r___t_y_p_e& _c_o_n_t_a_i_n_e_r () const noexcept { return │ │ │ │ │ -_c_o_n_t_a_i_n_e_r__; } │ │ │ │ │ -475 │ │ │ │ │ -_4_8_2 constexpr _c_o_n_t_a_i_n_e_r___t_y_p_e&& _e_x_t_r_a_c_t___c_o_n_t_a_i_n_e_r () && noexcept { return std:: │ │ │ │ │ -move(_c_o_n_t_a_i_n_e_r__); } │ │ │ │ │ -483 │ │ │ │ │ -484 │ │ │ │ │ -487 │ │ │ │ │ -_4_8_9 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k () noexcept { return extents_type::rank(); │ │ │ │ │ -} │ │ │ │ │ -490 │ │ │ │ │ -_4_9_2 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k___d_y_n_a_m_i_c () noexcept { return extents_type:: │ │ │ │ │ -rank_dynamic(); } │ │ │ │ │ -493 │ │ │ │ │ -_4_9_5 static constexpr std::size_t _s_t_a_t_i_c___e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) noexcept { return │ │ │ │ │ -extents_type::static_extent(r); } │ │ │ │ │ -496 │ │ │ │ │ -_4_9_8 constexpr _i_n_d_e_x___t_y_p_e _e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) const noexcept { return _e_x_t_e_n_t_s │ │ │ │ │ -().extent(r); } │ │ │ │ │ -499 │ │ │ │ │ -_5_0_1 constexpr _s_i_z_e___t_y_p_e _s_i_z_e () const noexcept │ │ │ │ │ -502 { │ │ │ │ │ -503 _s_i_z_e___t_y_p_e s = 1; │ │ │ │ │ -504 for (_r_a_n_k___t_y_p_e r = 0; r < _r_a_n_k(); ++r) │ │ │ │ │ -505 s *= _e_x_t_e_n_t(r); │ │ │ │ │ -506 return s; │ │ │ │ │ -507 } │ │ │ │ │ -508 │ │ │ │ │ -_5_1_0 constexpr std::size_t _c_o_n_t_a_i_n_e_r___s_i_z_e () const { return _c_o_n_t_a_i_n_e_r__.size(); } │ │ │ │ │ -511 │ │ │ │ │ -_5_1_3 [[nodiscard]] constexpr bool _e_m_p_t_y () const noexcept { return _s_i_z_e() == 0; │ │ │ │ │ -} │ │ │ │ │ -514 │ │ │ │ │ -_5_1_6 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e r) const { return _m_a_p_p_i_n_g().stride │ │ │ │ │ -(r); }; │ │ │ │ │ -517 │ │ │ │ │ -519 │ │ │ │ │ -520 │ │ │ │ │ -_5_2_1 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () noexcept { return mapping_type:: │ │ │ │ │ -is_always_unique(); } │ │ │ │ │ -_5_2_2 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () noexcept { return │ │ │ │ │ -mapping_type::is_always_exhaustive(); } │ │ │ │ │ -_5_2_3 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () noexcept { return mapping_type:: │ │ │ │ │ -is_always_strided(); } │ │ │ │ │ -524 │ │ │ │ │ -_5_2_5 constexpr bool _i_s___u_n_i_q_u_e () const noexcept { return _m_a_p_p_i_n_g__.is_unique(); } │ │ │ │ │ -_5_2_6 constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () const noexcept { return │ │ │ │ │ -_m_a_p_p_i_n_g__.is_exhaustive(); } │ │ │ │ │ -_5_2_7 constexpr bool _i_s___s_t_r_i_d_e_d () const noexcept { return _m_a_p_p_i_n_g__.is_strided(); │ │ │ │ │ -} │ │ │ │ │ -528 │ │ │ │ │ +_4_8_4inline constexpr auto _m_a_x = _h_y_b_r_i_d_F_u_n_c_t_o_r(Impl::Max{}); │ │ │ │ │ +485 │ │ │ │ │ +_5_0_6inline constexpr auto _m_i_n = _h_y_b_r_i_d_F_u_n_c_t_o_r(Impl::Min{}); │ │ │ │ │ +507 │ │ │ │ │ +_5_2_8inline constexpr auto _p_l_u_s = _h_y_b_r_i_d_F_u_n_c_t_o_r(std::plus<>{}); │ │ │ │ │ 529 │ │ │ │ │ -532 │ │ │ │ │ -_5_3_4 constexpr _p_o_i_n_t_e_r _c_o_n_t_a_i_n_e_r___d_a_t_a () noexcept { return _S_t_d_:_:_t_o___a_d_d_r_e_s_s │ │ │ │ │ -(_c_o_n_t_a_i_n_e_r__.begin()); } │ │ │ │ │ -535 │ │ │ │ │ -_5_3_7 constexpr _c_o_n_s_t___p_o_i_n_t_e_r _c_o_n_t_a_i_n_e_r___d_a_t_a () const noexcept { return _S_t_d_:_: │ │ │ │ │ -_t_o___a_d_d_r_e_s_s(_c_o_n_t_a_i_n_e_r__.begin()); } │ │ │ │ │ -538 │ │ │ │ │ -540 │ │ │ │ │ -541 │ │ │ │ │ -_5_4_2 friend constexpr void _s_w_a_p (_m_d_a_r_r_a_y& x, _m_d_a_r_r_a_y& y) noexcept │ │ │ │ │ -543 { │ │ │ │ │ -544 using std::swap; │ │ │ │ │ -545 _s_w_a_p(x.container_, y.container_); │ │ │ │ │ -546 _s_w_a_p(x.mapping_, y.mapping_); │ │ │ │ │ -547 } │ │ │ │ │ -548 │ │ │ │ │ -549 │ │ │ │ │ -552 │ │ │ │ │ -_5_5_3 friend constexpr bool _o_p_e_r_a_t_o_r_=_=_ (const _m_d_a_r_r_a_y& lhs, const _m_d_a_r_r_a_y& rhs) │ │ │ │ │ -noexcept │ │ │ │ │ -554 { │ │ │ │ │ -555 return lhs.mapping() == rhs.mapping() && lhs.container() == rhs.container │ │ │ │ │ -(); │ │ │ │ │ -556 } │ │ │ │ │ -557 │ │ │ │ │ -559 │ │ │ │ │ -562 │ │ │ │ │ -564 template , _m_d_s_p_a_n___t_y_p_e>, int> = │ │ │ │ │ -0> │ │ │ │ │ -_5_6_6 constexpr operator _m_d_s_p_a_n_<_V_,_E_,_L_,_A_> () │ │ │ │ │ -567 { │ │ │ │ │ -568 return _m_d_s_p_a_n___t_y_p_e(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g()); │ │ │ │ │ -569 } │ │ │ │ │ -570 │ │ │ │ │ -572 template , _c_o_n_s_t___m_d_s_p_a_n___t_y_p_e>, │ │ │ │ │ -int> = 0> │ │ │ │ │ -_5_7_4 constexpr operator _m_d_s_p_a_n_<_V_,_E_,_L_,_A_> () const │ │ │ │ │ -575 { │ │ │ │ │ -576 return _c_o_n_s_t___m_d_s_p_a_n___t_y_p_e(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g()); │ │ │ │ │ -577 } │ │ │ │ │ -578 │ │ │ │ │ -580 template , │ │ │ │ │ -581 std::enable_if_t< │ │ │ │ │ -582 std::is_assignable_v>, int> = 0> │ │ │ │ │ -583 constexpr _m_d_s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_,_A_c_c_e_s_s_o_r_P_o_l_i_c_y_> │ │ │ │ │ -_5_8_4 _t_o___m_d_s_p_a_n (const AccessorPolicy& a = AccessorPolicy{}) │ │ │ │ │ -585 { │ │ │ │ │ -586 return _m_d_s_p_a_n_<_e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_,_A_c_c_e_s_s_o_r_P_o_l_i_c_y_> │ │ │ │ │ -(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g(), a); │ │ │ │ │ -587 } │ │ │ │ │ -588 │ │ │ │ │ -590 template , │ │ │ │ │ -591 std::enable_if_t< │ │ │ │ │ -592 std::is_assignable_v>, int> = 0> │ │ │ │ │ -593 constexpr mdspan │ │ │ │ │ -_5_9_4 _t_o___m_d_s_p_a_n (const AccessorPolicy& a = AccessorPolicy{}) const │ │ │ │ │ -595 { │ │ │ │ │ -596 return _m_d_s_p_a_n_<_c_o_n_s_t_ _e_l_e_m_e_n_t___t_y_p_e_,_e_x_t_e_n_t_s___t_y_p_e_,_l_a_y_o_u_t___t_y_p_e_,_A_c_c_e_s_s_o_r_P_o_l_i_c_y_> │ │ │ │ │ -(_c_o_n_t_a_i_n_e_r___d_a_t_a(), _m_a_p_p_i_n_g(), a); │ │ │ │ │ -597 } │ │ │ │ │ -598 │ │ │ │ │ -599protected: │ │ │ │ │ -_6_0_0 _c_o_n_t_a_i_n_e_r___t_y_p_e _c_o_n_t_a_i_n_e_r__; │ │ │ │ │ -_6_0_1 [[no_unique_address]] _m_a_p_p_i_n_g___t_y_p_e _m_a_p_p_i_n_g__; │ │ │ │ │ -602}; │ │ │ │ │ -603 │ │ │ │ │ -607 │ │ │ │ │ -608template │ │ │ │ │ -609_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, const Container&) │ │ │ │ │ -610 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ -611 │ │ │ │ │ -612template │ │ │ │ │ -613_m_d_a_r_r_a_y (const Mapping&, const Container&) │ │ │ │ │ -614 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ -_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ -615 │ │ │ │ │ -616template │ │ │ │ │ -617_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, Container&&) │ │ │ │ │ -618 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ -619 │ │ │ │ │ -620template │ │ │ │ │ -621_m_d_a_r_r_a_y (const Mapping&, Container&&) │ │ │ │ │ -622 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ -_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ -623 │ │ │ │ │ -624template │ │ │ │ │ -625_m_d_a_r_r_a_y (const _m_d_s_p_a_n_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _A_c_c_e_s_s_o_r_>&) │ │ │ │ │ -626 -> _m_d_a_r_r_a_y_<_s_t_d_:_:_r_e_m_o_v_e___c_v___t_<_E_l_e_m_e_n_t_>, Extents, Layout>; │ │ │ │ │ -627 │ │ │ │ │ -628template │ │ │ │ │ -629_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, const Container&, const │ │ │ │ │ -Alloc&) │ │ │ │ │ -630 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ -631 │ │ │ │ │ -632template │ │ │ │ │ -633_m_d_a_r_r_a_y (const Mapping&, const Container&, const Alloc&) │ │ │ │ │ -634 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ -_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ -635 │ │ │ │ │ -636template │ │ │ │ │ -637_m_d_a_r_r_a_y (const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_ _e_x_t_s_._._._>&, Container&&, const Alloc&) │ │ │ │ │ -638 -> _m_d_a_r_r_a_y, _l_a_y_o_u_t___r_i_g_h_t, Container>; │ │ │ │ │ -639 │ │ │ │ │ -640template │ │ │ │ │ -641_m_d_a_r_r_a_y (const Mapping&, Container&&, const Alloc&) │ │ │ │ │ -642 -> _m_d_a_r_r_a_y_<_t_y_p_e_n_a_m_e_ _C_o_n_t_a_i_n_e_r_:_:_v_a_l_u_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_e_x_t_e_n_t_s___t_y_p_e_, │ │ │ │ │ -_t_y_p_e_n_a_m_e_ _M_a_p_p_i_n_g_:_:_l_a_y_o_u_t___t_y_p_e_,_ _C_o_n_t_a_i_n_e_r_>; │ │ │ │ │ +_5_5_0inline constexpr auto _m_i_n_u_s = _h_y_b_r_i_d_F_u_n_c_t_o_r(std::minus<>{}); │ │ │ │ │ +551 │ │ │ │ │ +_5_7_2inline constexpr auto _e_q_u_a_l___t_o = _h_y_b_r_i_d_F_u_n_c_t_o_r(std::equal_to<>{}); │ │ │ │ │ +573 │ │ │ │ │ +574 │ │ │ │ │ +586template │ │ │ │ │ +_5_8_7[[deprecated("Use Hybrid::equal_to instead!")]] constexpr auto _e_q_u_a_l_s(T1&& │ │ │ │ │ +t1, T2&& t2){ │ │ │ │ │ +588 return _e_q_u_a_l___t_o(std::forward(t1), std::forward(t2)); │ │ │ │ │ +589} │ │ │ │ │ +590 │ │ │ │ │ +591 │ │ │ │ │ +592namespace Impl { │ │ │ │ │ +593 │ │ │ │ │ +594 // This overload is selected if the passed value is already a compile time │ │ │ │ │ +constant. │ │ │ │ │ +595 template │ │ │ │ │ +596 constexpr Result switchCases(std::integer_sequence, const │ │ │ │ │ +std::integral_constant& /*value*/, Branches&& branches, │ │ │ │ │ +ElseBranch&& elseBranch) │ │ │ │ │ +597 { │ │ │ │ │ +598 // In case we pass a value known at compile time, we no longer have to do │ │ │ │ │ +599 // a dynamic to static dispatch via recursion. The only thing that's left │ │ │ │ │ +600 // is to check if the value is contained in the passed range. │ │ │ │ │ +601 // If this is true, we have to pass it to the branches callback │ │ │ │ │ +602 // as an appropriate integral_constant type. Otherwise we have to │ │ │ │ │ +603 // execute the else callback. │ │ │ │ │ +604 if constexpr (((t0 == value) || ... || (tt == value))) │ │ │ │ │ +605 return branches(std::integral_constant{}); │ │ │ │ │ +606 else │ │ │ │ │ +607 return elseBranch(); │ │ │ │ │ +608 } │ │ │ │ │ +609 │ │ │ │ │ +610 // This overload is selected if the passed value is dynamic. │ │ │ │ │ +611 template │ │ │ │ │ +612 constexpr Result switchCases(std::integer_sequence, const Value& / │ │ │ │ │ +*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch) │ │ │ │ │ +613 { │ │ │ │ │ +614 return elseBranch(); │ │ │ │ │ +615 } │ │ │ │ │ +616 │ │ │ │ │ +617 template │ │ │ │ │ +618 constexpr Result switchCases(std::integer_sequence, const │ │ │ │ │ +Value& value, Branches&& branches, ElseBranch&& elseBranch) │ │ │ │ │ +619 { │ │ │ │ │ +620 if (t0 == value) │ │ │ │ │ +621 return branches(std::integral_constant()); │ │ │ │ │ +622 else │ │ │ │ │ +623 return Impl::switchCases(std::integer_sequence(), value, │ │ │ │ │ +branches, elseBranch); │ │ │ │ │ +624 } │ │ │ │ │ +625 │ │ │ │ │ +626 // This overload is selected if the range of cases is an IntegralRange │ │ │ │ │ +627 template │ │ │ │ │ +628 constexpr Result switchCases(IntegralRange _r_a_n_g_e, const Value& value, │ │ │ │ │ +Branches&& branches, ElseBranch&& elseBranch) │ │ │ │ │ +629 { │ │ │ │ │ +630 return _r_a_n_g_e.contains(value) ? branches(T(value)) : elseBranch(); │ │ │ │ │ +631 } │ │ │ │ │ +632 │ │ │ │ │ +633 // This overload is selected if the range of cases is a StaticIntegralRange │ │ │ │ │ +634 template │ │ │ │ │ +635 constexpr Result switchCases(StaticIntegralRange _r_a_n_g_e, const │ │ │ │ │ +Value& value, Branches&& branches, ElseBranch&& elseBranch) │ │ │ │ │ +636 { │ │ │ │ │ +637 using seq = typename decltype(_r_a_n_g_e)::integer_sequence; │ │ │ │ │ +638 return Impl::switchCases(seq{}, value, branches, elseBranch); │ │ │ │ │ +639 } │ │ │ │ │ +640 │ │ │ │ │ +641} // namespace Impl │ │ │ │ │ +642 │ │ │ │ │ 643 │ │ │ │ │ -644template │ │ │ │ │ -645_m_d_a_r_r_a_y (const _m_d_s_p_a_n_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _A_c_c_e_s_s_o_r_>&, const Alloc&) │ │ │ │ │ -646 -> _m_d_a_r_r_a_y_<_s_t_d_:_:_r_e_m_o_v_e___c_v___t_<_E_l_e_m_e_n_t_>, Extents, Layout>; │ │ │ │ │ -647 │ │ │ │ │ -649 │ │ │ │ │ -653 │ │ │ │ │ -654template │ │ │ │ │ -655_m_d_s_p_a_n (_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _C_o_n_t_a_i_n_e_r_>) -> _m_d_s_p_a_n< │ │ │ │ │ -656 typename decltype(std::declval>().to_mdspan())::element_type, │ │ │ │ │ -657 typename decltype(std::declval<_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_, │ │ │ │ │ -_C_o_n_t_a_i_n_e_r_>>()._t_o___m_d_s_p_a_n())::extents_type, │ │ │ │ │ -658 typename decltype(std::declval<_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_, │ │ │ │ │ -_C_o_n_t_a_i_n_e_r_>>()._t_o___m_d_s_p_a_n())::layout_type, │ │ │ │ │ -659 typename decltype(std::declval<_m_d_a_r_r_a_y_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_, │ │ │ │ │ -_C_o_n_t_a_i_n_e_r_>>()._t_o___m_d_s_p_a_n())::accessor_type>; │ │ │ │ │ -660 │ │ │ │ │ -662 │ │ │ │ │ -663} // end namespace Dune::Std │ │ │ │ │ -664 │ │ │ │ │ -665#endif // DUNE_COMMON_STD_MDARRAY_HH │ │ │ │ │ -_m_e_m_o_r_y_._h_h │ │ │ │ │ -_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h │ │ │ │ │ -_c_o_n_t_a_i_n_e_r_c_o_n_s_t_r_u_c_t_i_o_n_t_r_a_i_t_s_._h_h │ │ │ │ │ -_s_p_a_n_._h_h │ │ │ │ │ -_m_d_s_p_a_n_._h_h │ │ │ │ │ +644 │ │ │ │ │ +672template │ │ │ │ │ +_6_7_3constexpr decltype(auto) _s_w_i_t_c_h_C_a_s_e_s(const Cases& cases, const Value& value, │ │ │ │ │ +Branches&& branches, ElseBranch&& elseBranch) │ │ │ │ │ +674{ │ │ │ │ │ +675 return Impl::switchCases(cases, value, std:: │ │ │ │ │ +forward(branches), std::forward(elseBranch)); │ │ │ │ │ +676} │ │ │ │ │ +677 │ │ │ │ │ +697template │ │ │ │ │ +_6_9_8constexpr void _s_w_i_t_c_h_C_a_s_e_s(const Cases& cases, const Value& value, │ │ │ │ │ +Branches&& branches) │ │ │ │ │ +699{ │ │ │ │ │ +700 Impl::switchCases(cases, value, std::forward(branches), │ │ │ │ │ +701 []{ assert(false && "value not found in range"); }); │ │ │ │ │ +702} │ │ │ │ │ +703 │ │ │ │ │ +722template │ │ │ │ │ +_7_2_3constexpr void _s_w_i_t_c_h_C_a_s_e_s(_I_n_t_e_g_r_a_l_R_a_n_g_e_<_T_> _r_a_n_g_e, const Value& value, │ │ │ │ │ +Branches&& branches) │ │ │ │ │ +724{ │ │ │ │ │ +725 assert(_r_a_n_g_e.contains(value) && "value not found in range"); │ │ │ │ │ +726 branches(T(value)); │ │ │ │ │ +727} │ │ │ │ │ +728 │ │ │ │ │ +729} // namespace Hybrid │ │ │ │ │ +730} // namespace Dune │ │ │ │ │ +731 │ │ │ │ │ +732 │ │ │ │ │ +733#endif // #ifndef DUNE_COMMON_HYBRIDUTILITIES_HH │ │ │ │ │ +_i_n_d_i_c_e_s_._h_h │ │ │ │ │ +_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. │ │ │ │ │ +_t_y_p_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ +Utilities for type computations, constraining overloads, ... │ │ │ │ │ _r_a_n_g_e_u_t_i_l_i_t_i_e_s_._h_h │ │ │ │ │ Utilities for reduction like operations on ranges. │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_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:124 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_t_o___a_d_d_r_e_s_s │ │ │ │ │ -constexpr auto to_address(T &&p) noexcept │ │ │ │ │ -Obtain the address represented by p without forming a reference to the object │ │ │ │ │ -pointed to by p. │ │ │ │ │ -DDeeffiinniittiioonn memory.hh:47 │ │ │ │ │ -_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_:_:_S_t_d_:_:_e_x_t_e_n_t_s │ │ │ │ │ -Multidimensional index space with dynamic and static extents. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_l_a_y_o_u_t___r_i_g_h_t │ │ │ │ │ -A layout where the rightmost extent has stride 1, and strides increase right- │ │ │ │ │ -to-left as the product o... │ │ │ │ │ -DDeeffiinniittiioonn fwd_layouts.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y │ │ │ │ │ -An owning multi-dimensional array analog of mdspan. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_s_t___m_d_s_p_a_n___t_y_p_e │ │ │ │ │ -mdspan< const element_type, extents_type, layout_type > const_mdspan_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const mapping_type &m, const container_type &c, const Alloc │ │ │ │ │ -&a) │ │ │ │ │ -Construct from layout mapping, container and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:288 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -typename container_type::const_reference const_reference │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:96 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const mapping_type &m, container_type &&c) │ │ │ │ │ -Construct from layout mapping and the storage container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___t_y_p_e │ │ │ │ │ -Container container_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ -Extents extents_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:79 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const E &e, const container_type &c) │ │ │ │ │ -Construct from extents and the storage container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:174 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -static constexpr bool is_always_exhaustive() noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:522 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_t_o___m_d_s_p_a_n │ │ │ │ │ -constexpr mdspan< const element_type, extents_type, layout_type, AccessorPolicy │ │ │ │ │ -> to_mdspan(const AccessorPolicy &a=AccessorPolicy{}) const │ │ │ │ │ -Conversion function to mdspan. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:594 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_t_r_i_d_e │ │ │ │ │ -constexpr index_type stride(rank_type r) const │ │ │ │ │ -The stride along the specified dimension. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:516 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ -constexpr bool is_unique() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:525 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_e_n_t │ │ │ │ │ -constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ -Number of elements in the r'th dimension of the tensor. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:498 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const extents_type &e, const Alloc &a) │ │ │ │ │ -Construct from the extents of the array and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:243 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_t_a_t_i_c___e_x_t_e_n_t │ │ │ │ │ -static constexpr std::size_t static_extent(rank_type r) noexcept │ │ │ │ │ -Number of elements in the r'th dimension of the tensor. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:495 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_a_p_p_i_n_g__ │ │ │ │ │ -mapping_type mapping_ │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:601 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const mdspan< OtherElementType, OtherExtents, │ │ │ │ │ -OtherLayoutPolicy, Accessor > &other) │ │ │ │ │ -Converting constructor from mdspan. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:229 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_a_p_p_i_n_g___t_y_p_e │ │ │ │ │ -typename layout_type::template mapping< extents_type > mapping_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___d_a_t_a │ │ │ │ │ -constexpr const_pointer container_data() const noexcept │ │ │ │ │ -Direct access to the underlying const data in the container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:537 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const extents_type &e, const value_type &v) │ │ │ │ │ -Construct from extents and initial value. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const mapping_type &m, const Alloc &a) │ │ │ │ │ -Construct from the layout mapping of the array and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:250 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___d_a_t_a │ │ │ │ │ -constexpr pointer container_data() noexcept │ │ │ │ │ -Direct access to the underlying data in the container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:534 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -constexpr bool is_exhaustive() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:526 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_p_o_i_n_t_e_r │ │ │ │ │ -decltype(Std::to_address(std::declval< container_type >().begin())) pointer │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -constexpr reference operator[](Index index) │ │ │ │ │ -Access specified element at position [i0] For a rank one mdarray, the operator │ │ │ │ │ -[i] is added to support... │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:408 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr const extents_type & extents() const noexcept │ │ │ │ │ -Number of elements in all dimensions of the array,. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:468 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ -constexpr bool is_strided() const noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:527 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const mapping_type &m, const container_type &c) │ │ │ │ │ -Construct from layout mapping and the storage container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_always_unique() noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:521 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const mapping_type &m, container_type &&c, const Alloc &a) │ │ │ │ │ -Construct from layout mapping, container and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:296 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const E &e, container_type &&c) │ │ │ │ │ -Construct from extents and the storage container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r │ │ │ │ │ -constexpr const container_type & container() const noexcept │ │ │ │ │ -The underlying storage container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:474 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r___s_i_z_e │ │ │ │ │ -constexpr std::size_t container_size() const │ │ │ │ │ -Size of the underlying container. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:510 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -typename extents_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_a_n_k │ │ │ │ │ -static constexpr rank_type rank() noexcept │ │ │ │ │ -Number of dimensions of the array. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:489 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_m_p_t_y │ │ │ │ │ -constexpr bool empty() const noexcept │ │ │ │ │ -Check whether the index space is empty. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:513 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const extents_type &e, container_type &&c, const Alloc &a) │ │ │ │ │ -Construct from extents, container and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:280 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_s_p_a_n___t_y_p_e │ │ │ │ │ -mdspan< element_type, extents_type, layout_type > mdspan_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_i_z_e │ │ │ │ │ -constexpr size_type size() const noexcept │ │ │ │ │ -Size of the multi-dimensional index space. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:501 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -friend constexpr bool operator==(const mdarray &lhs, const mdarray &rhs) │ │ │ │ │ -noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:553 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_s_w_a_p │ │ │ │ │ -friend constexpr void swap(mdarray &x, mdarray &y) noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:542 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr const mapping_type & mapping() const noexcept │ │ │ │ │ -Index mapping of a layout policy. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:471 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ -Element element_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const mapping_type &m, const value_type &v, const Alloc &a) │ │ │ │ │ -Construct from layout mapping, initial value and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:264 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const extents_type &e, const value_type &v, const Alloc &a) │ │ │ │ │ -Construct from extents, initial value and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:257 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_s_t___p_o_i_n_t_e_r │ │ │ │ │ -decltype(Std::to_address(std::declval< container_type >().cbegin())) │ │ │ │ │ -const_pointer │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -typename container_type::reference reference │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_t_o___m_d_s_p_a_n │ │ │ │ │ -constexpr mdspan< element_type, extents_type, layout_type, AccessorPolicy > │ │ │ │ │ -to_mdspan(const AccessorPolicy &a=AccessorPolicy{}) │ │ │ │ │ -Conversion function to mdspan. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:584 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -element_type value_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:83 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_l_a_y_o_u_t___t_y_p_e │ │ │ │ │ -LayoutPolicy layout_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_e_x_t_r_a_c_t___c_o_n_t_a_i_n_e_r │ │ │ │ │ -constexpr container_type && extract_container() &&noexcept │ │ │ │ │ -Move the container out of the mdarray. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:482 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const extents_type &e, const container_type &c, const Alloc │ │ │ │ │ -&a) │ │ │ │ │ -Construct from extents, container and allocator. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ -typename extents_type::rank_type rank_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:88 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_r_a_n_k___d_y_n_a_m_i_c │ │ │ │ │ -static constexpr rank_type rank_dynamic() noexcept │ │ │ │ │ -Number of dimension with dynamic size. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:492 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -constexpr reference operator()(Indices... indices) │ │ │ │ │ -Access element at position (i0,i1,...) │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:363 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(const extents_type &e) │ │ │ │ │ -Construct from the extents of the array. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:138 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_c_o_n_t_a_i_n_e_r__ │ │ │ │ │ -container_type container_ │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:600 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ -typename extents_type::index_type index_type │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_m_d_a_r_r_a_y │ │ │ │ │ -constexpr mdarray(IndexTypes... exts) │ │ │ │ │ -Construct from the dynamic extents. │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:133 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_a_r_r_a_y_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_always_strided() noexcept │ │ │ │ │ -DDeeffiinniittiioonn mdarray.hh:523 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n │ │ │ │ │ -A multi-dimensional non-owning array view. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t │ │ │ │ │ -constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ -Number of elements in the r'th dimension of the tensor. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_i_z_e │ │ │ │ │ -constexpr size_type size() const noexcept │ │ │ │ │ -The number of elements accessible by this multi-dimensional span. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ -A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ +_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:52 │ │ │ │ │ +_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:312 │ │ │ │ │ +_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:73 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_m_i_n_u_s │ │ │ │ │ +constexpr auto minus │ │ │ │ │ +Function object for performing subtraction. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:550 │ │ │ │ │ +_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:587 │ │ │ │ │ +_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:256 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_e_q_u_a_l___t_o │ │ │ │ │ +constexpr auto equal_to │ │ │ │ │ +Function object for performing equality comparison. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:572 │ │ │ │ │ +_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:673 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_m_a_x │ │ │ │ │ +constexpr auto max │ │ │ │ │ +Function object that returns the greater of the given values. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:484 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_p_l_u_s │ │ │ │ │ +constexpr auto plus │ │ │ │ │ +Function object for performing addition. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:528 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_m_i_n │ │ │ │ │ +constexpr auto min │ │ │ │ │ +Function object that returns the smaller of the given values. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:506 │ │ │ │ │ +_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:344 │ │ │ │ │ +_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:172 │ │ │ │ │ +_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:126 │ │ │ │ │ +_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:279 │ │ │ │ │ +_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:492 │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_h_y_b_r_i_d_F_u_n_c_t_o_r │ │ │ │ │ +constexpr HybridFunctor< Functor > hybridFunctor(const Functor &) │ │ │ │ │ +Returns an HybridFunctor adaptor. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:459 │ │ │ │ │ +_D_u_n_e_:_:_M_a_x │ │ │ │ │ +DDeeffiinniittiioonn binaryfunctions.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_H_y_b_r_i_d_:_:_H_y_b_r_i_d_F_u_n_c_t_o_r │ │ │ │ │ +Adapter of a hybrid functor that maintains results hybrid. │ │ │ │ │ +DDeeffiinniittiioonn hybridutilities.hh:418 │ │ │ │ │ +_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:177 │ │ │ │ │ +_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:230 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: mdspan.hh File Reference │ │ │ │ +dune-common: iteratorfacades.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,78 +65,144 @@ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
mdspan.hh File Reference
│ │ │ │ +
iteratorfacades.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#include <iterator>
│ │ │ │ #include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/std/default_accessor.hh>
│ │ │ │ -#include <dune/common/std/extents.hh>
│ │ │ │ -#include <dune/common/std/layout_right.hh>
│ │ │ │ -#include <dune/common/std/span.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/concept.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >
 A multi-dimensional non-owning array view. More...
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...
 
class  Dune::ProxyArrowResult< ProxyType >
 Helper to mimic a pointer for proxy objects. More...
 
struct  Dune::IteratorFacadeAccess
 This class encapsulates access of IteratorFacade. More...
 
class  Dune::IteratorFacade< It, C, V, R, P, D >
 CRTP-Mixing class for stl conformant iterators of given iterator category. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Functions

template<class CArray , std::enable_if_t< std::is_array_v< CArray >, int > = 0, std::enable_if_t<(std::rank_v< CArray >==1), int > = 0>
 Dune::Std::mdspan (CArray &) -> mdspan< std::remove_all_extents_t< CArray >, Std::extents< std::size_t, std::extent_v< CArray, 0 > > >
 
template<class Pointer , std::enable_if_t< std::is_pointer_v< std::remove_reference_t< Pointer > >, int > = 0>
 Dune::Std::mdspan (Pointer &&) -> mdspan< std::remove_pointer_t< std::remove_reference_t< Pointer > >, Std::extents< std::size_t > >
 
template<class ElementType , class... II, std::enable_if_t<(... &&std::is_convertible_v< II, std::size_t >), int > = 0, std::enable_if_t<(sizeof...(II) > 0), int > = 0>
 Dune::Std::mdspan (ElementType *, II...) -> mdspan< ElementType, Std::dextents< std::size_t, sizeof...(II)> >
 
template<class ElementType , class SizeType , std::size_t N>
 Dune::Std::mdspan (ElementType *, Std::span< SizeType, N > &) -> mdspan< ElementType, Std::dextents< std::size_t, N > >
 
template<class ElementType , class SizeType , std::size_t N>
 Dune::Std::mdspan (ElementType *, const std::array< SizeType, N > &) -> mdspan< ElementType, Std::dextents< std::size_t, N > >
 
template<class ElementType , class IndexType , std::size_t... exts>
 Dune::Std::mdspan (ElementType *, const Std::extents< IndexType, exts... > &) -> mdspan< ElementType, Std::extents< IndexType, exts... > >
 
template<class ElementType , class Mapping , class Extents = typename Mapping::extents_type, class Layout = typename Mapping::layout_type>
 Dune::Std::mdspan (ElementType *, const Mapping &) -> mdspan< ElementType, Extents, Layout >
 
template<class Mapping , class Accessor , class DataHandle = typename Accessor::data_handle_type, class Element = typename Accessor::element_type, class Extents = typename Mapping::extents_type, class Layout = typename Mapping::layout_type>
 Dune::Std::mdspan (const DataHandle &, const Mapping &, const Accessor &) -> mdspan< Element, Extents, Layout, Accessor >
 
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 T1 , class T2 , class C , class V1 , class V2 , class R1 , class R2 , class P1 , class P2 , class D1 , class D2 >
constexpr auto Dune::operator== (const IteratorFacade< T1, C, V1, R1, P1, D1 > &it1, const IteratorFacade< T2, C, V2, R2, P2, D2 > &it2)
 Equality comparison for IteratorFacade.
 
template<class T1 , class T2 , class C , class V1 , class V2 , class R1 , class R2 , class P1 , class P2 , class D1 , class D2 , std::enable_if_t< Dune::models< Impl::Concepts::IterEqualsOp, T1, T2 >(), int > = 0>
constexpr bool Dune::operator!= (const IteratorFacade< T1, C, V1, R1, P1, D1 > &it1, const IteratorFacade< T2, C, V2, R2, P2, D2 > &it2)
 Inequality comparison for IteratorFacade.
 
template<class T1 , class T2 , class C , class V1 , class V2 , class R1 , class R2 , class P1 , class P2 , class D >
constexpr auto Dune::operator- (const IteratorFacade< T1, C, V1, R1, P1, D > &it1, const IteratorFacade< T2, C, V2, R2, P2, D > &it2)
 Difference for two IteratorFacade objects.
 
template<class T1 , class T2 , class C , class V1 , class V2 , class R1 , class R2 , class P1 , class P2 , class D1 , class D2 , std::enable_if_t< Dune::models< Impl::Concepts::IterDistanceOp< D1 >, T1, T2 >(), int > = 0>
constexpr bool Dune::operator< (const IteratorFacade< T1, C, V1, R1, P1, D1 > &it1, const IteratorFacade< T2, C, V2, R2, P2, D2 > &it2)
 Comparison for IteratorFacade.
 
template<class T1 , class T2 , class C , class V1 , class V2 , class R1 , class R2 , class P1 , class P2 , class D1 , class D2 , std::enable_if_t< Dune::models< Impl::Concepts::IterDistanceOp< D1 >, T1, T2 >(), int > = 0>
constexpr bool Dune::operator<= (const IteratorFacade< T1, C, V1, R1, P1, D1 > &it1, const IteratorFacade< T2, C, V2, R2, P2, D2 > &it2)
 Comparison for IteratorFacade.
 
template<class T1 , class T2 , class C , class V1 , class V2 , class R1 , class R2 , class P1 , class P2 , class D1 , class D2 , std::enable_if_t< Dune::models< Impl::Concepts::IterDistanceOp< D1 >, T1, T2 >(), int > = 0>
constexpr bool Dune::operator> (const IteratorFacade< T1, C, V1, R1, P1, D1 > &it1, const IteratorFacade< T2, C, V2, R2, P2, D2 > &it2)
 Comparison for IteratorFacade.
 
template<class T1 , class T2 , class C , class V1 , class V2 , class R1 , class R2 , class P1 , class P2 , class D1 , class D2 , std::enable_if_t< Dune::models< Impl::Concepts::IterDistanceOp< D1 >, T1, T2 >(), int > = 0>
constexpr bool Dune::operator>= (const IteratorFacade< T1, C, V1, R1, P1, D1 > &it1, const IteratorFacade< T2, C, V2, R2, P2, D2 > &it2)
 Comparison for IteratorFacade.
 
│ │ │ │ -
│ │ │ │ +

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,72 +1,219 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -mdspan.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +iteratorfacades.hh File Reference │ │ │ │ │ +This file implements iterator facade classes for writing stl conformant │ │ │ │ │ +iterators. _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_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_e_x_t_e_n_t_s_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_l_a_y_o_u_t___r_i_g_h_t_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._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_/_c_o_n_c_e_p_t_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_<_ _E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_P_o_l_i_c_y_,_ _A_c_c_e_s_s_o_r_P_o_l_i_c_y_ _> │ │ │ │ │ -  A multi-dimensional non-owning array view. _M_o_r_e_._._. │ │ │ │ │ + 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_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t_<_ _P_r_o_x_y_T_y_p_e_ _> │ │ │ │ │ +  Helper to mimic a pointer for proxy objects. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_A_c_c_e_s_s │ │ │ │ │ +  This class encapsulates access of _I_t_e_r_a_t_o_r_F_a_c_a_d_e. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_ _I_t_,_ _C_,_ _V_,_ _R_,_ _P_,_ _D_ _> │ │ │ │ │ +  CRTP-Mixing class for stl conformant iterators of given iterator │ │ │ │ │ + category. _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. │ │ │ │ │ -  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template, int > = 0, │ │ │ │ │ -std::enable_if_t<(std::rank_v< CArray >==1), int > = 0> │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (CArray &) -> _m_d_s_p_a_n< std::remove_all_extents_t< CArray >, │ │ │ │ │ - _S_t_d_:_:_e_x_t_e_n_t_s< std::size_t, std::extent_v< CArray, 0 > > > │ │ │ │ │ -  │ │ │ │ │ -template >, int > = 0> │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (Pointer &&) -> _m_d_s_p_a_n< std::remove_pointer_t< std:: │ │ │ │ │ - remove_reference_t< Pointer > >, _S_t_d_:_:_e_x_t_e_n_t_s< std::size_t > > │ │ │ │ │ -  │ │ │ │ │ -template), int > = 0, std::enable_if_t<(sizeof... │ │ │ │ │ -(II) > 0), int > = 0> │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, II...) -> _m_d_s_p_a_n< ElementType, _S_t_d_:_: │ │ │ │ │ - _d_e_x_t_e_n_t_s< std::size_t, sizeof...(II)> > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, _S_t_d_:_:_s_p_a_n< SizeType, N > &) -> _m_d_s_p_a_n< │ │ │ │ │ - ElementType, _S_t_d_:_:_d_e_x_t_e_n_t_s< std::size_t, N > > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, const std::array< SizeType, N > &) - │ │ │ │ │ - > _m_d_s_p_a_n< ElementType, _S_t_d_:_:_d_e_x_t_e_n_t_s< std::size_t, N > > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, const _S_t_d_:_:_e_x_t_e_n_t_s< IndexType, exts... > &) │ │ │ │ │ - -> _m_d_s_p_a_n< ElementType, _S_t_d_:_:_e_x_t_e_n_t_s< IndexType, exts... > > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (ElementType *, const Mapping &) -> _m_d_s_p_a_n< ElementType, │ │ │ │ │ - Extents, Layout > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -  _D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n (const DataHandle &, const Mapping &, const Accessor &) - │ │ │ │ │ - > _m_d_s_p_a_n< Element, Extents, Layout, Accessor > │ │ │ │ │ -  │ │ │ │ │ +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. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr auto  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_=_= (const _I_t_e_r_a_t_o_r_F_a_c_a_d_e< │ │ │ │ │ + T1, C, V1, R1, P1, D1 > &it1, const │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, C, V2, R2, P2, D2 > │ │ │ │ │ + &it2) │ │ │ │ │ +  Equality comparison for _I_t_e_r_a_t_o_r_F_a_c_a_d_e. │ │ │ │ │ +  │ │ │ │ │ +template(), int > = 0> │ │ │ │ │ + constexpr bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_!_= (const _I_t_e_r_a_t_o_r_F_a_c_a_d_e< │ │ │ │ │ + T1, C, V1, R1, P1, D1 > &it1, const │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, C, V2, R2, P2, D2 > │ │ │ │ │ + &it2) │ │ │ │ │ +  Inequality comparison for │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + constexpr auto  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_- (const _I_t_e_r_a_t_o_r_F_a_c_a_d_e< │ │ │ │ │ + T1, C, V1, R1, P1, D > &it1, const │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, C, V2, R2, P2, D > │ │ │ │ │ + &it2) │ │ │ │ │ +  Difference for two _I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ + objects. │ │ │ │ │ +  │ │ │ │ │ +template, T1, T2 >(), int > = 0> │ │ │ │ │ + constexpr bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_< (const _I_t_e_r_a_t_o_r_F_a_c_a_d_e< │ │ │ │ │ + T1, C, V1, R1, P1, D1 > &it1, const │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, C, V2, R2, P2, D2 > │ │ │ │ │ + &it2) │ │ │ │ │ +  Comparison for _I_t_e_r_a_t_o_r_F_a_c_a_d_e. │ │ │ │ │ +  │ │ │ │ │ +template, T1, T2 >(), int > = 0> │ │ │ │ │ + constexpr bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_= (const _I_t_e_r_a_t_o_r_F_a_c_a_d_e< │ │ │ │ │ + T1, C, V1, R1, P1, D1 > &it1, const │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, C, V2, R2, P2, D2 > │ │ │ │ │ + &it2) │ │ │ │ │ +  Comparison for _I_t_e_r_a_t_o_r_F_a_c_a_d_e. │ │ │ │ │ +  │ │ │ │ │ +template, T1, T2 >(), int > = 0> │ │ │ │ │ + constexpr bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_> (const _I_t_e_r_a_t_o_r_F_a_c_a_d_e< │ │ │ │ │ + T1, C, V1, R1, P1, D1 > &it1, const │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, C, V2, R2, P2, D2 > │ │ │ │ │ + &it2) │ │ │ │ │ +  Comparison for _I_t_e_r_a_t_o_r_F_a_c_a_d_e. │ │ │ │ │ +  │ │ │ │ │ +template, T1, T2 >(), int > = 0> │ │ │ │ │ + constexpr bool  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_>_= (const _I_t_e_r_a_t_o_r_F_a_c_a_d_e< │ │ │ │ │ + T1, C, V1, R1, P1, D1 > &it1, const │ │ │ │ │ + _I_t_e_r_a_t_o_r_F_a_c_a_d_e< T2, C, V2, R2, P2, D2 > │ │ │ │ │ + &it2) │ │ │ │ │ +  Comparison for _I_t_e_r_a_t_o_r_F_a_c_a_d_e. │ │ │ │ │ +  │ │ │ │ │ +********** 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. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-common-doc/doxygen/a00155_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: mdspan.hh Source File │ │ │ │ +dune-common: iteratorfacades.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,395 +70,987 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
mdspan.hh
│ │ │ │ +
iteratorfacades.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 © 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_MDSPAN_HH
│ │ │ │ -
6#define DUNE_COMMON_STD_MDSPAN_HH
│ │ │ │ +
5#ifndef DUNE_ITERATORFACADES_HH
│ │ │ │ +
6#define DUNE_ITERATORFACADES_HH
│ │ │ │
7
│ │ │ │ -
8#include <array>
│ │ │ │ +
8#include <iterator>
│ │ │ │
9#include <type_traits>
│ │ │ │ -
10#include <utility>
│ │ │ │ -
11#if __has_include(<version>)
│ │ │ │ -
12 #include <version>
│ │ │ │ -
13#endif
│ │ │ │ -
14
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
20
│ │ │ │ -
21namespace Dune::Std {
│ │ │ │ -
22
│ │ │ │ -
61template <class Element, class Extents, class LayoutPolicy = Std::layout_right,
│ │ │ │ -
62 class AccessorPolicy = Std::default_accessor<Element>>
│ │ │ │ -
│ │ │ │ -
63class mdspan
│ │ │ │ -
64{
│ │ │ │ -
65 static_assert(std::is_object_v<Element>);
│ │ │ │ -
66 static_assert(!std::is_abstract_v<Element>);
│ │ │ │ -
67 static_assert(!std::is_array_v<Element>);
│ │ │ │ -
68 static_assert(std::is_same_v<Element, typename AccessorPolicy::element_type>);
│ │ │ │ -
69
│ │ │ │ -
70public:
│ │ │ │ -
71 using element_type = Element;
│ │ │ │ -
72 using extents_type = Extents;
│ │ │ │ -
73 using layout_type = LayoutPolicy;
│ │ │ │ -
74 using accessor_type = AccessorPolicy;
│ │ │ │ -
75
│ │ │ │ -
76 using value_type = std::remove_cv_t<Element>;
│ │ │ │ -
77 using mapping_type = typename layout_type::template mapping<extents_type>;
│ │ │ │ -
78 using index_type = typename extents_type::index_type;
│ │ │ │ -
79 using size_type = typename extents_type::size_type;
│ │ │ │ -
80 using rank_type = typename extents_type::rank_type;
│ │ │ │ -
81 using data_handle_type = typename accessor_type::data_handle_type;
│ │ │ │ -
82 using reference = typename accessor_type::reference;
│ │ │ │ -
83
│ │ │ │ -
84private:
│ │ │ │ -
85 // [mdspan.layout.reqmts]
│ │ │ │ -
86 static_assert(std::is_nothrow_move_constructible_v<mapping_type>);
│ │ │ │ -
87 static_assert(std::is_nothrow_move_assignable_v<mapping_type>);
│ │ │ │ -
88 static_assert(std::is_nothrow_swappable_v<mapping_type>);
│ │ │ │ -
89
│ │ │ │ -
90 // [mdspan.accessor.reqmts]
│ │ │ │ -
91 static_assert(std::is_nothrow_move_constructible_v<accessor_type>);
│ │ │ │ -
92 static_assert(std::is_nothrow_move_assignable_v<accessor_type>);
│ │ │ │ -
93 static_assert(std::is_nothrow_swappable_v<accessor_type>);
│ │ │ │ -
94
│ │ │ │ -
95public:
│ │ │ │ -
98
│ │ │ │ -
100 template <class E = extents_type, class D = data_handle_type, class M = mapping_type, class A = accessor_type,
│ │ │ │ -
101 std::enable_if_t<(E::rank_dynamic() > 0), int> = 0,
│ │ │ │ -
102 std::enable_if_t<std::is_default_constructible_v<D>, int> = 0,
│ │ │ │ -
103 std::enable_if_t<std::is_default_constructible_v<M>, int> = 0,
│ │ │ │ -
104 std::enable_if_t<std::is_default_constructible_v<A>, int> = 0>
│ │ │ │ -
│ │ │ │ -
105 constexpr mdspan ()
│ │ │ │ -
106 : data_handle_{}
│ │ │ │ -
107 , mapping_{}
│ │ │ │ -
108 , accessor_{}
│ │ │ │ -
109 {}
│ │ │ │ -
│ │ │ │ -
110
│ │ │ │ -
112 template <class... IndexTypes,
│ │ │ │ -
113 class E = extents_type, class M = mapping_type, class A = accessor_type,
│ │ │ │ -
114 std::enable_if_t<(sizeof...(IndexTypes) == E::rank() || sizeof...(IndexTypes) == E::rank_dynamic()), int> = 0,
│ │ │ │ -
115 std::enable_if_t<(... && std::is_convertible_v<IndexTypes, index_type>), int> = 0,
│ │ │ │ -
116 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type, IndexTypes>), int> = 0,
│ │ │ │ -
117 std::enable_if_t<std::is_constructible_v<M, E>, int> = 0,
│ │ │ │ -
118 std::enable_if_t<std::is_default_constructible_v<A>, int> = 0>
│ │ │ │ -
│ │ │ │ -
119 explicit constexpr mdspan (data_handle_type p, IndexTypes... exts)
│ │ │ │ -
120 : mdspan(std::move(p), extents_type(index_type(std::move(exts))...))
│ │ │ │ -
121 {}
│ │ │ │ -
│ │ │ │ -
122
│ │ │ │ -
124 template <class IndexType, std::size_t N,
│ │ │ │ -
125 std::enable_if_t<std::is_convertible_v<const IndexType&, index_type>, int> = 0,
│ │ │ │ -
126 std::enable_if_t<std::is_nothrow_constructible_v<index_type,const IndexType&>, int> = 0,
│ │ │ │ -
127 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type::rank()), int> = 0>
│ │ │ │ -
128 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
129 explicit(N != extents_type::rank_dynamic())
│ │ │ │ -
130 #endif
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
132 : mdspan(std::move(p), extents_type(exts))
│ │ │ │ -
133 {}
│ │ │ │ -
│ │ │ │ -
134
│ │ │ │ -
136 template <class IndexType, std::size_t N,
│ │ │ │ -
137 std::enable_if_t<std::is_convertible_v<IndexType, index_type>, int> = 0,
│ │ │ │ -
138 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type::rank()), int> = 0>
│ │ │ │ -
139 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
140 explicit(N != extents_type::rank_dynamic())
│ │ │ │ -
141 #endif
│ │ │ │ -
│ │ │ │ -
142 constexpr mdspan (data_handle_type p, const std::array<IndexType,N>& exts)
│ │ │ │ -
143 : mdspan(std::move(p), extents_type(exts))
│ │ │ │ -
144 {}
│ │ │ │ -
│ │ │ │ -
145
│ │ │ │ -
147 template <class M = mapping_type,
│ │ │ │ -
148 std::enable_if_t<std::is_constructible_v<M, const extents_type&>, int> = 0>
│ │ │ │ -
│ │ │ │ -
149 constexpr mdspan (data_handle_type p, const extents_type& e)
│ │ │ │ -
150 : mdspan(std::move(p), mapping_type(e))
│ │ │ │ -
151 {}
│ │ │ │ -
│ │ │ │ -
152
│ │ │ │ -
154 template <class A = accessor_type,
│ │ │ │ -
155 std::enable_if_t<std::is_default_constructible_v<A>, int> = 0>
│ │ │ │ -
│ │ │ │ -
156 constexpr mdspan (data_handle_type p, const mapping_type& m)
│ │ │ │ -
157 : mdspan(std::move(p), m, accessor_type{})
│ │ │ │ -
158 {}
│ │ │ │ -
│ │ │ │ -
159
│ │ │ │ -
│ │ │ │ -
161 constexpr mdspan (data_handle_type p, const mapping_type& m, const accessor_type& a)
│ │ │ │ -
162 : data_handle_(std::move(p))
│ │ │ │ -
163 , mapping_(m)
│ │ │ │ -
164 , accessor_(a)
│ │ │ │ -
165 {}
│ │ │ │ -
│ │ │ │ -
166
│ │ │ │ -
167
│ │ │ │ -
169 template <class OtherElementType, class OtherExtends, class OtherLayoutPolicy, class OtherAccessor,
│ │ │ │ -
170 std::enable_if_t<std::is_constructible_v<mapping_type, const typename OtherElementType::template mapping<OtherExtends>&>, int> = 0,
│ │ │ │ -
171 std::enable_if_t<std::is_constructible_v<accessor_type, const OtherAccessor&>, int> = 0>
│ │ │ │ -
172 #if __cpp_conditional_explicit >= 201806L
│ │ │ │ -
173 explicit(!std::is_convertible_v<const typename OtherElementType::template mapping<OtherExtends>&, mapping_type>
│ │ │ │ -
174 || !std::is_convertible_v<const OtherAccessor&, accessor_type>)
│ │ │ │ -
175 #endif
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
178 accessor_type(other.accessor()))
│ │ │ │ -
179 {}
│ │ │ │ -
│ │ │ │ -
180
│ │ │ │ +
10
│ │ │ │ + │ │ │ │ + │ │ │ │ +
13
│ │ │ │ +
14namespace Dune
│ │ │ │ +
15{
│ │ │ │ +
140 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
142 {
│ │ │ │ +
143
│ │ │ │ +
144 public:
│ │ │ │ +
145 /* type aliases required by C++ for iterators */
│ │ │ │ +
146 using iterator_category = std::forward_iterator_tag;
│ │ │ │ +
147 using value_type = typename std::remove_const<V>::type;
│ │ │ │ + │ │ │ │ +
149 using pointer = V*;
│ │ │ │ +
150 using reference = R;
│ │ │ │ +
151
│ │ │ │ +
176 typedef T DerivedType;
│ │ │ │ +
177
│ │ │ │ +
181 typedef V Value;
│ │ │ │
182
│ │ │ │ -
183
│ │ │ │ -
186
│ │ │ │ -
191 template <class... Indices,
│ │ │ │ -
192 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
193 std::enable_if_t<(... && std::is_convertible_v<Indices, index_type>), int> = 0,
│ │ │ │ -
194 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type,Indices>), int> = 0>
│ │ │ │ -
│ │ │ │ -
195 constexpr reference operator() (Indices... indices) const
│ │ │ │ -
196 {
│ │ │ │ -
197 return accessor_.access(data_handle_, mapping_(index_type(std::move(indices))...));
│ │ │ │ -
198 }
│ │ │ │ -
│ │ │ │ -
199
│ │ │ │ -
200#if __cpp_multidimensional_subscript >= 202110L
│ │ │ │ -
201
│ │ │ │ -
203 template <class... Indices,
│ │ │ │ -
204 std::enable_if_t<(sizeof...(Indices) == extents_type::rank()), int> = 0,
│ │ │ │ -
205 std::enable_if_t<(... && std::is_convertible_v<Indices, index_type>), int> = 0,
│ │ │ │ -
206 std::enable_if_t<(... && std::is_nothrow_constructible_v<index_type,Indices>), int> = 0>
│ │ │ │ -
207 constexpr reference operator[] (Indices... indices) const
│ │ │ │ -
208 {
│ │ │ │ -
209 return accessor_.access(data_handle_, mapping_(index_type(std::move(indices))...));
│ │ │ │ -
210 }
│ │ │ │ -
211
│ │ │ │ -
212#else // __cpp_multidimensional_subscript
│ │ │ │ -
213
│ │ │ │ -
216 template <class Index, class E = extents_type,
│ │ │ │ -
217 std::enable_if_t<std::is_convertible_v<Index,index_type>, int> = 0,
│ │ │ │ -
218 std::enable_if_t<(E::rank() == 1), int> = 0>
│ │ │ │ -
│ │ │ │ -
219 constexpr reference operator[] (Index index) const
│ │ │ │ -
220 {
│ │ │ │ -
221 return accessor_.access(data_handle_, mapping_(index_type(std::move(index))));
│ │ │ │ -
222 }
│ │ │ │ -
│ │ │ │ -
223
│ │ │ │ -
224#endif // __cpp_multidimensional_subscript
│ │ │ │ -
225
│ │ │ │ -
227 template <class Index,
│ │ │ │ -
228 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0,
│ │ │ │ -
229 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const Index&>, int> = 0>
│ │ │ │ -
│ │ │ │ -
230 constexpr reference operator[] (Std::span<Index,extents_type::rank()> indices) const
│ │ │ │ -
231 {
│ │ │ │ -
232 return unpackIntegerSequence([&](auto... ii) -> reference {
│ │ │ │ -
233 return accessor_.access(data_handle_, mapping_(index_type(indices[ii])...)); },
│ │ │ │ -
234 std::make_index_sequence<extents_type::rank()>{});
│ │ │ │ -
235 }
│ │ │ │ -
│ │ │ │ -
236
│ │ │ │ -
238 template <class Index,
│ │ │ │ -
239 std::enable_if_t<std::is_convertible_v<const Index&, index_type>, int> = 0,
│ │ │ │ -
240 std::enable_if_t<std::is_nothrow_constructible_v<index_type, const Index&>, int> = 0>
│ │ │ │ -
│ │ │ │ -
241 constexpr reference operator[] (const std::array<Index,extents_type::rank()>& indices) const
│ │ │ │ -
242 {
│ │ │ │ -
243 return std::apply([&](auto... ii) -> reference {
│ │ │ │ -
244 return accessor_.access(data_handle_, mapping_(index_type(ii)...)); }, indices);
│ │ │ │ +
186 typedef V* Pointer;
│ │ │ │ +
187
│ │ │ │ +
191 typedef D DifferenceType;
│ │ │ │ +
192
│ │ │ │ +
196 typedef R Reference;
│ │ │ │ +
197
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
200 {
│ │ │ │ +
201 return static_cast<DerivedType const*>(this)->dereference();
│ │ │ │ +
202 }
│ │ │ │ +
│ │ │ │ +
203
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
205 {
│ │ │ │ +
206 return &(static_cast<const DerivedType *>(this)->dereference());
│ │ │ │ +
207 }
│ │ │ │ +
│ │ │ │ +
208
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
211 {
│ │ │ │ +
212 static_cast<DerivedType *>(this)->increment();
│ │ │ │ +
213 return *static_cast<DerivedType *>(this);
│ │ │ │ +
214 }
│ │ │ │ +
│ │ │ │ +
215
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
218 {
│ │ │ │ +
219 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ +
220 this->operator++();
│ │ │ │ +
221 return tmp;
│ │ │ │ +
222 }
│ │ │ │ +
│ │ │ │ +
223 };
│ │ │ │ +
│ │ │ │ +
224
│ │ │ │ +
235 template<class T1, class V1, class R1, class D,
│ │ │ │ +
236 class T2, class V2, class R2>
│ │ │ │ +
237 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
240 {
│ │ │ │ +
241 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
242 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ +
243 else
│ │ │ │ +
244 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │
245 }
│ │ │ │
│ │ │ │
246
│ │ │ │ -
248
│ │ │ │ -
250 constexpr const extents_type& extents () const noexcept { return mapping_.extents(); }
│ │ │ │ -
251
│ │ │ │ -
253 constexpr const mapping_type& mapping () const noexcept { return mapping_; }
│ │ │ │ -
254
│ │ │ │ -
256 constexpr const accessor_type& accessor () const noexcept { return accessor_; }
│ │ │ │ -
257
│ │ │ │ -
259 constexpr const data_handle_type& data_handle () const noexcept { return data_handle_; };
│ │ │ │ -
260
│ │ │ │ -
261
│ │ │ │ -
264
│ │ │ │ -
266 static constexpr rank_type rank () noexcept { return extents_type::rank(); }
│ │ │ │ -
267
│ │ │ │ -
269 static constexpr rank_type rank_dynamic () noexcept { return extents_type::rank_dynamic(); }
│ │ │ │ -
270
│ │ │ │ -
272 static constexpr std::size_t static_extent (rank_type r) noexcept { return extents_type::static_extent(r); }
│ │ │ │ -
273
│ │ │ │ -
275 constexpr index_type extent (rank_type r) const noexcept { return extents().extent(r); }
│ │ │ │ +
257 template<class T1, class V1, class R1, class D,
│ │ │ │ +
258 class T2, class V2, class R2>
│ │ │ │ +
259 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
262 {
│ │ │ │ +
263 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
264 return !static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ +
265 else
│ │ │ │ +
266 return !static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ +
267 }
│ │ │ │ +
│ │ │ │ +
268
│ │ │ │ +
273 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
275 {
│ │ │ │
276
│ │ │ │ -
│ │ │ │ -
278 constexpr size_type size () const noexcept
│ │ │ │ -
279 {
│ │ │ │ -
280 size_type s = 1;
│ │ │ │ -
281 for (rank_type r = 0; r < rank(); ++r)
│ │ │ │ -
282 s *= extent(r);
│ │ │ │ -
283 return s;
│ │ │ │ -
284 }
│ │ │ │ -
│ │ │ │ -
285
│ │ │ │ -
287 [[nodiscard]] constexpr bool empty () const noexcept { return size() == 0; }
│ │ │ │ -
288
│ │ │ │ -
290
│ │ │ │ -
291
│ │ │ │ -
293 static constexpr bool is_always_unique () { return mapping_type::is_always_unique(); }
│ │ │ │ -
294
│ │ │ │ -
296 static constexpr bool is_always_exhaustive () { return mapping_type::is_always_exhaustive(); }
│ │ │ │ -
297
│ │ │ │ -
299 static constexpr bool is_always_strided () { return mapping_type::is_always_strided(); }
│ │ │ │ -
300
│ │ │ │ -
302 constexpr bool is_unique () const { return mapping_.is_unique(); }
│ │ │ │ -
303
│ │ │ │ -
306 constexpr bool is_exhaustive () const { return mapping_.is_exhaustive(); }
│ │ │ │ -
307
│ │ │ │ -
313 constexpr bool is_strided () const { return mapping_.is_strided(); }
│ │ │ │ -
314
│ │ │ │ -
316 constexpr index_type stride (rank_type r) const { return mapping_.stride(r); }
│ │ │ │ -
317
│ │ │ │ -
318
│ │ │ │ -
│ │ │ │ -
320 friend constexpr void swap (mdspan& x, mdspan& y) noexcept
│ │ │ │ -
321 {
│ │ │ │ -
322 using std::swap;
│ │ │ │ -
323 swap(x.data_handle_, y.data_handle_);
│ │ │ │ -
324 swap(x.mapping_, y.mapping_);
│ │ │ │ -
325 swap(x.accessor_, y.accessor_);
│ │ │ │ -
326 }
│ │ │ │ -
│ │ │ │ -
327
│ │ │ │ -
328
│ │ │ │ -
329private:
│ │ │ │ -
330 data_handle_type data_handle_;
│ │ │ │ -
331 [[no_unique_address]] mapping_type mapping_;
│ │ │ │ -
332 [[no_unique_address]] accessor_type accessor_;
│ │ │ │ -
333};
│ │ │ │ -
│ │ │ │ -
334
│ │ │ │ -
335// deduction guides
│ │ │ │ -
336// @{
│ │ │ │ +
277 public:
│ │ │ │ +
278 /* type aliases required by C++ for iterators */
│ │ │ │ +
279 using iterator_category = std::bidirectional_iterator_tag;
│ │ │ │ +
280 using value_type = typename std::remove_const<V>::type;
│ │ │ │ + │ │ │ │ +
282 using pointer = V*;
│ │ │ │ +
283 using reference = R;
│ │ │ │ +
284
│ │ │ │ +
310 typedef T DerivedType;
│ │ │ │ +
311
│ │ │ │ +
315 typedef V Value;
│ │ │ │ +
316
│ │ │ │ +
320 typedef V* Pointer;
│ │ │ │ +
321
│ │ │ │ +
325 typedef D DifferenceType;
│ │ │ │ +
326
│ │ │ │ +
330 typedef R Reference;
│ │ │ │ +
331
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
334 {
│ │ │ │ +
335 return static_cast<DerivedType const*>(this)->dereference();
│ │ │ │ +
336 }
│ │ │ │ +
│ │ │ │
337
│ │ │ │ -
338template <class CArray,
│ │ │ │ -
339 std::enable_if_t<std::is_array_v<CArray>, int> = 0,
│ │ │ │ -
340 std::enable_if_t<(std::rank_v<CArray> == 1), int> = 0>
│ │ │ │ -
341mdspan (CArray&)
│ │ │ │ - │ │ │ │ -
343
│ │ │ │ -
344template <class Pointer,
│ │ │ │ -
345 std::enable_if_t<std::is_pointer_v<std::remove_reference_t<Pointer>>, int> = 0>
│ │ │ │ -
346mdspan (Pointer&&)
│ │ │ │ - │ │ │ │ -
348
│ │ │ │ -
349template <class ElementType, class... II,
│ │ │ │ -
350 std::enable_if_t<(... && std::is_convertible_v<II,std::size_t>), int> = 0,
│ │ │ │ -
351 std::enable_if_t<(sizeof...(II) > 0), int> = 0>
│ │ │ │ -
352mdspan (ElementType*, II...)
│ │ │ │ -
353 -> mdspan<ElementType, Std::dextents<std::size_t, sizeof...(II)>>;
│ │ │ │ -
354
│ │ │ │ -
355template <class ElementType, class SizeType, std::size_t N>
│ │ │ │ - │ │ │ │ - │ │ │ │ +
│ │ │ │ + │ │ │ │ +
339 {
│ │ │ │ +
340 return &(static_cast<const DerivedType *>(this)->dereference());
│ │ │ │ +
341 }
│ │ │ │ +
│ │ │ │ +
342
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
345 {
│ │ │ │ +
346 static_cast<DerivedType *>(this)->increment();
│ │ │ │ +
347 return *static_cast<DerivedType *>(this);
│ │ │ │ +
348 }
│ │ │ │ +
│ │ │ │ +
349
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
352 {
│ │ │ │ +
353 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ +
354 this->operator++();
│ │ │ │ +
355 return tmp;
│ │ │ │ +
356 }
│ │ │ │ +
│ │ │ │ +
357
│ │ │ │
358
│ │ │ │ -
359template <class ElementType, class SizeType, std::size_t N>
│ │ │ │ -
360mdspan (ElementType*, const std::array<SizeType,N>&)
│ │ │ │ - │ │ │ │ -
362
│ │ │ │ -
363template <class ElementType, class IndexType, std::size_t... exts>
│ │ │ │ - │ │ │ │ -
365 -> mdspan<ElementType, Std::extents<IndexType,exts...>>;
│ │ │ │ -
366
│ │ │ │ -
367template <class ElementType, class Mapping,
│ │ │ │ -
368 class Extents = typename Mapping::extents_type,
│ │ │ │ -
369 class Layout = typename Mapping::layout_type>
│ │ │ │ -
370mdspan (ElementType*, const Mapping&)
│ │ │ │ - │ │ │ │ -
372
│ │ │ │ -
373template <class Mapping, class Accessor,
│ │ │ │ -
374 class DataHandle = typename Accessor::data_handle_type,
│ │ │ │ -
375 class Element = typename Accessor::element_type,
│ │ │ │ -
376 class Extents = typename Mapping::extents_type,
│ │ │ │ -
377 class Layout = typename Mapping::layout_type>
│ │ │ │ -
378mdspan (const DataHandle&, const Mapping&, const Accessor&)
│ │ │ │ - │ │ │ │ -
380
│ │ │ │ -
381// @}
│ │ │ │ -
382
│ │ │ │ -
383} // end namespace Dune::Std
│ │ │ │ -
384
│ │ │ │ -
385#endif // DUNE_COMMON_STD_MDSPAN_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
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:124
│ │ │ │ -
typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std::size_t, R > >::type dextents
Alias of extents of given rank R and purely dynamic extents. See [mdspan.extents.dextents].
Definition extents.hh:259
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
361 {
│ │ │ │ +
362 static_cast<DerivedType *>(this)->decrement();
│ │ │ │ +
363 return *static_cast<DerivedType *>(this);
│ │ │ │ +
364 }
│ │ │ │ +
│ │ │ │ +
365
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
368 {
│ │ │ │ +
369 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ +
370 this->operator--();
│ │ │ │ +
371 return tmp;
│ │ │ │ +
372 }
│ │ │ │ +
│ │ │ │ +
373 };
│ │ │ │ +
│ │ │ │ +
374
│ │ │ │ +
382 template<class T1, class V1, class R1, class D,
│ │ │ │ +
383 class T2, class V2, class R2>
│ │ │ │ +
384 inline typename std::enable_if<std::is_convertible<T2,T1>::value,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
387 {
│ │ │ │ +
388 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ +
389 }
│ │ │ │ +
│ │ │ │ +
390
│ │ │ │ +
399 template<class T1, class V1, class R1, class D,
│ │ │ │ +
400 class T2, class V2, class R2>
│ │ │ │ +
401 inline
│ │ │ │ +
402 typename std::enable_if<std::is_convertible<T1,T2>::value && !std::is_convertible<T2,T1>::value,
│ │ │ │ +
403 bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
406 {
│ │ │ │ +
407 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ +
408 }
│ │ │ │ +
│ │ │ │ +
409
│ │ │ │ +
420 template<class T1, class V1, class R1, class D,
│ │ │ │ +
421 class T2, class V2, class R2>
│ │ │ │ +
422 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
425 {
│ │ │ │ +
426 return !(lhs == rhs);
│ │ │ │ +
427 }
│ │ │ │ +
│ │ │ │ +
428
│ │ │ │ +
433 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
435 {
│ │ │ │ +
436
│ │ │ │ +
437 public:
│ │ │ │ +
438 /* type aliases required by C++ for iterators */
│ │ │ │ +
439 using iterator_category = std::random_access_iterator_tag;
│ │ │ │ +
440 using value_type = typename std::remove_const<V>::type;
│ │ │ │ + │ │ │ │ +
442 using pointer = V*;
│ │ │ │ +
443 using reference = R;
│ │ │ │ +
444
│ │ │ │ +
478 typedef T DerivedType;
│ │ │ │ +
479
│ │ │ │ +
483 typedef V Value;
│ │ │ │ +
484
│ │ │ │ +
488 typedef V* Pointer;
│ │ │ │ +
489
│ │ │ │ +
493 typedef D DifferenceType;
│ │ │ │ +
494
│ │ │ │ +
498 typedef R Reference;
│ │ │ │ +
499
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
502 {
│ │ │ │ +
503 return static_cast<DerivedType const*>(this)->dereference();
│ │ │ │ +
504 }
│ │ │ │ +
│ │ │ │ +
505
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
507 {
│ │ │ │ +
508 return &(static_cast<const DerivedType *>(this)->dereference());
│ │ │ │ +
509 }
│ │ │ │ +
│ │ │ │ +
510
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
517 {
│ │ │ │ +
518 return static_cast<const DerivedType *>(this)->elementAt(n);
│ │ │ │ +
519 }
│ │ │ │ +
│ │ │ │ +
520
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
523 {
│ │ │ │ +
524 static_cast<DerivedType *>(this)->increment();
│ │ │ │ +
525 return *static_cast<DerivedType *>(this);
│ │ │ │ +
526 }
│ │ │ │ +
│ │ │ │ +
527
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
530 {
│ │ │ │ +
531 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ +
532 this->operator++();
│ │ │ │ +
533 return tmp;
│ │ │ │ +
534 }
│ │ │ │ +
│ │ │ │ +
535
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
537 {
│ │ │ │ +
538 static_cast<DerivedType *>(this)->advance(n);
│ │ │ │ +
539 return *static_cast<DerivedType *>(this);
│ │ │ │ +
540 }
│ │ │ │ +
│ │ │ │ +
541
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
543 {
│ │ │ │ +
544 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ +
545 tmp.advance(n);
│ │ │ │ +
546 return tmp;
│ │ │ │ +
547 }
│ │ │ │ +
│ │ │ │ +
548
│ │ │ │ +
549
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
552 {
│ │ │ │ +
553 static_cast<DerivedType *>(this)->decrement();
│ │ │ │ +
554 return *static_cast<DerivedType *>(this);
│ │ │ │ +
555 }
│ │ │ │ +
│ │ │ │ +
556
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
559 {
│ │ │ │ +
560 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ +
561 this->operator--();
│ │ │ │ +
562 return tmp;
│ │ │ │ +
563 }
│ │ │ │ +
│ │ │ │ +
564
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
566 {
│ │ │ │ +
567 static_cast<DerivedType *>(this)->advance(-n);
│ │ │ │ +
568 return *static_cast<DerivedType *>(this);
│ │ │ │ +
569 }
│ │ │ │ +
│ │ │ │ +
570
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
572 {
│ │ │ │ +
573 DerivedType tmp(static_cast<DerivedType const&>(*this));
│ │ │ │ +
574 tmp.advance(-n);
│ │ │ │ +
575 return tmp;
│ │ │ │ +
576 }
│ │ │ │ +
│ │ │ │ +
577
│ │ │ │ +
578
│ │ │ │ +
579 };
│ │ │ │ +
│ │ │ │ +
580
│ │ │ │ +
591 template<class T1, class V1, class R1, class D,
│ │ │ │ +
592 class T2, class V2, class R2>
│ │ │ │ +
593 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
596 {
│ │ │ │ +
597 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
598 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ +
599 else
│ │ │ │ +
600 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ +
601 }
│ │ │ │ +
│ │ │ │ +
602
│ │ │ │ +
613 template<class T1, class V1, class R1, class D,
│ │ │ │ +
614 class T2, class V2, class R2>
│ │ │ │ +
615 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
618 {
│ │ │ │ +
619 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
620 return !static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
│ │ │ │ +
621 else
│ │ │ │ +
622 return !static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
│ │ │ │ +
623 }
│ │ │ │ +
│ │ │ │ +
624
│ │ │ │ +
635 template<class T1, class V1, class R1, class D,
│ │ │ │ +
636 class T2, class V2, class R2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
640 {
│ │ │ │ +
641 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
642 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))>0;
│ │ │ │ +
643 else
│ │ │ │ +
644 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))<0;
│ │ │ │ +
645 }
│ │ │ │ +
│ │ │ │ +
646
│ │ │ │ +
647
│ │ │ │ +
658 template<class T1, class V1, class R1, class D,
│ │ │ │ +
659 class T2, class V2, class R2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
663 {
│ │ │ │ +
664 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
665 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))>=0;
│ │ │ │ +
666 else
│ │ │ │ +
667 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))<=0;
│ │ │ │ +
668 }
│ │ │ │ +
│ │ │ │ +
669
│ │ │ │ +
670
│ │ │ │ +
681 template<class T1, class V1, class R1, class D,
│ │ │ │ +
682 class T2, class V2, class R2>
│ │ │ │ +
683 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
686 {
│ │ │ │ +
687 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
688 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))<0;
│ │ │ │ +
689 else
│ │ │ │ +
690 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))>0;
│ │ │ │ +
691 }
│ │ │ │ +
│ │ │ │ +
692
│ │ │ │ +
703 template<class T1, class V1, class R1, class D,
│ │ │ │ +
704 class T2, class V2, class R2>
│ │ │ │ +
705 inline typename EnableIfInterOperable<T1,T2,bool>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
708 {
│ │ │ │ +
709 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
710 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))<=0;
│ │ │ │ +
711 else
│ │ │ │ +
712 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))>=0;
│ │ │ │ +
713 }
│ │ │ │ +
│ │ │ │ +
714
│ │ │ │ +
725 template<class T1, class V1, class R1, class D,
│ │ │ │ +
726 class T2, class V2, class R2>
│ │ │ │ +
727 inline typename EnableIfInterOperable<T1,T2,D>::type
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
730 {
│ │ │ │ +
731 if(std::is_convertible<T2,T1>::value)
│ │ │ │ +
732 return -static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs));
│ │ │ │ +
733 else
│ │ │ │ +
734 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs));
│ │ │ │ +
735 }
│ │ │ │ +
│ │ │ │ +
736
│ │ │ │ +
737
│ │ │ │ +
748 template<class ProxyType>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
750 {
│ │ │ │ +
751 public:
│ │ │ │ +
│ │ │ │ +
752 constexpr ProxyArrowResult(ProxyType&& p)
│ │ │ │ +
753 noexcept(std::is_nothrow_constructible_v<ProxyType, ProxyType&&>)
│ │ │ │ +
754 : p_(std::move(p))
│ │ │ │ +
755 {}
│ │ │ │ +
│ │ │ │ +
756
│ │ │ │ +
│ │ │ │ +
757 constexpr ProxyArrowResult(const ProxyType& p)
│ │ │ │ +
758 noexcept(std::is_nothrow_constructible_v<ProxyType, const ProxyType&>)
│ │ │ │ +
759 : p_(p)
│ │ │ │ +
760 {}
│ │ │ │ +
│ │ │ │ +
761
│ │ │ │ +
│ │ │ │ +
762 constexpr const ProxyType* operator->() const noexcept
│ │ │ │ +
763 {
│ │ │ │ +
764 return &p_;
│ │ │ │ +
765 }
│ │ │ │ +
│ │ │ │ +
766
│ │ │ │ +
│ │ │ │ +
767 constexpr ProxyType* operator->() noexcept
│ │ │ │ +
768 {
│ │ │ │ +
769 return &p_;
│ │ │ │ +
770 }
│ │ │ │ +
│ │ │ │ +
771
│ │ │ │ +
772 private:
│ │ │ │ +
773 ProxyType p_;
│ │ │ │ +
774 };
│ │ │ │ +
│ │ │ │ +
775
│ │ │ │ +
776
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
786 {
│ │ │ │ +
787
│ │ │ │ +
789 template<class It>
│ │ │ │ +
790 static constexpr auto baseIterator(It&& it) noexcept
│ │ │ │ +
791 -> decltype(it.baseIterator())
│ │ │ │ +
792 {
│ │ │ │ +
793 return it.baseIterator();
│ │ │ │ +
794 }
│ │ │ │ +
795
│ │ │ │ +
797 template<class It>
│ │ │ │ +
798 static constexpr auto derived(It&& it) noexcept
│ │ │ │ +
799 -> decltype(it.derived())
│ │ │ │ +
800 {
│ │ │ │ +
801 return it.derived();
│ │ │ │ +
802 }
│ │ │ │ +
803
│ │ │ │ +
804 };
│ │ │ │ +
│ │ │ │ +
805
│ │ │ │ +
806
│ │ │ │ +
807
│ │ │ │ +
808 namespace Impl::Concepts {
│ │ │ │ +
809
│ │ │ │ +
810 using namespace Dune::Concept;
│ │ │ │ +
811
│ │ │ │ +
812 template<class R>
│ │ │ │ +
813 struct BaseIterDereferenceOp
│ │ │ │ +
814 {
│ │ │ │ +
815 template<class It>
│ │ │ │ +
816 auto require(const It& it) -> decltype(
│ │ │ │ +
817 *(IteratorFacadeAccess::baseIterator(it)),
│ │ │ │ +
818 requireConvertible<decltype(*(IteratorFacadeAccess::baseIterator(it))), R>()
│ │ │ │ +
819 );
│ │ │ │ +
820 };
│ │ │ │ +
821
│ │ │ │ +
822 struct IterEqualsOp
│ │ │ │ +
823 {
│ │ │ │ +
824 template<class It1, class It2>
│ │ │ │ +
825 auto require(const It1& it1, const It2& it2) -> decltype(
│ │ │ │ +
826 requireConvertible<bool>(it1 == it2)
│ │ │ │ +
827 );
│ │ │ │ +
828 };
│ │ │ │ +
829
│ │ │ │ +
830 struct BaseIterEqualsOp
│ │ │ │ +
831 {
│ │ │ │ +
832 template<class It1, class It2>
│ │ │ │ +
833 auto require(const It1& it1, const It2& it2) -> decltype(
│ │ │ │ +
834 Dune::Concept::requireConvertible<bool>(IteratorFacadeAccess::baseIterator(it1) == IteratorFacadeAccess::baseIterator(it2))
│ │ │ │ +
835 );
│ │ │ │ +
836 };
│ │ │ │ +
837
│ │ │ │ +
838 struct BaseIterIncrementOp
│ │ │ │ +
839 {
│ │ │ │ +
840 template<class It>
│ │ │ │ +
841 auto require(It it) -> decltype(
│ │ │ │ +
842 ++(IteratorFacadeAccess::baseIterator(it))
│ │ │ │ +
843 );
│ │ │ │ +
844 };
│ │ │ │ +
845
│ │ │ │ +
846 struct BaseIterDecrementOp
│ │ │ │ +
847 {
│ │ │ │ +
848 template<class It>
│ │ │ │ +
849 auto require(It it) -> decltype(
│ │ │ │ +
850 --(IteratorFacadeAccess::baseIterator(it))
│ │ │ │ +
851 );
│ │ │ │ +
852 };
│ │ │ │ +
853
│ │ │ │ +
854 template<class D>
│ │ │ │ +
855 struct IterAdvanceOp
│ │ │ │ +
856 {
│ │ │ │ +
857 template<class It>
│ │ │ │ +
858 auto require(It it) -> decltype(
│ │ │ │ +
859 it += std::declval<D>()
│ │ │ │ +
860 );
│ │ │ │ +
861 };
│ │ │ │ +
862
│ │ │ │ +
863 template<class D>
│ │ │ │ +
864 struct BaseIterAdvanceOp
│ │ │ │ +
865 {
│ │ │ │ +
866 template<class It>
│ │ │ │ +
867 auto require(It it) -> decltype(
│ │ │ │ +
868 IteratorFacadeAccess::baseIterator(it) += std::declval<D>()
│ │ │ │ +
869 );
│ │ │ │ +
870 };
│ │ │ │ +
871
│ │ │ │ +
872 template<class D>
│ │ │ │ +
873 struct IterDistanceOp
│ │ │ │ +
874 {
│ │ │ │ +
875 template<class It1, class It2>
│ │ │ │ +
876 auto require(const It1& it1, const It2& it2) -> decltype(
│ │ │ │ +
877 Dune::Concept::requireConvertible<D>(it1 - it2)
│ │ │ │ +
878 );
│ │ │ │ +
879 };
│ │ │ │ +
880
│ │ │ │ +
881 template<class D>
│ │ │ │ +
882 struct BaseIterDistanceOp
│ │ │ │ +
883 {
│ │ │ │ +
884 template<class It1, class It2>
│ │ │ │ +
885 auto require(const It1& it1, const It2& it2) -> decltype(
│ │ │ │ +
886 Dune::Concept::requireConvertible<D>(IteratorFacadeAccess::baseIterator(it1) - IteratorFacadeAccess::baseIterator(it2))
│ │ │ │ +
887 );
│ │ │ │ +
888 };
│ │ │ │ +
889
│ │ │ │ +
890 } // namespace Impl::Concept
│ │ │ │ +
891
│ │ │ │ +
892
│ │ │ │ +
893
│ │ │ │ +
1051 template<class It, class C, class V, class R = V&, class P = V*, class D = std::ptrdiff_t>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1053 {
│ │ │ │ +
1054 static constexpr bool isBidirectional = std::is_convertible_v<C, std::bidirectional_iterator_tag>;
│ │ │ │ +
1055 static constexpr bool isRandomAccess = std::is_convertible_v<C, std::random_access_iterator_tag>;
│ │ │ │ +
1056
│ │ │ │ +
1057 // We make IteratorFacadeAccess a friend to allow forwarding of the derived()
│ │ │ │ +
1058 // methods to the free operators instead of havin to do raw casts there.
│ │ │ │ +
1059 // This allows to encapsulate all casts within IteratorFacade itself.
│ │ │ │ +
1060 friend IteratorFacadeAccess;
│ │ │ │ +
1061
│ │ │ │ +
1062 protected:
│ │ │ │ +
1063
│ │ │ │ + │ │ │ │ +
1066
│ │ │ │ +
│ │ │ │ +
1068 constexpr const DerivedIterator& derived() const
│ │ │ │ +
1069 {
│ │ │ │ +
1070 return static_cast<const DerivedIterator&>(*this);
│ │ │ │ +
1071 }
│ │ │ │ +
│ │ │ │ +
1072
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1075 {
│ │ │ │ +
1076 return static_cast<DerivedIterator&>(*this);
│ │ │ │ +
1077 }
│ │ │ │ +
│ │ │ │ +
1078
│ │ │ │ +
1079 public:
│ │ │ │ +
1080
│ │ │ │ +
1081 // Standard types of of C++ iterators
│ │ │ │ + │ │ │ │ +
1083 using value_type = typename std::remove_const<V>::type;
│ │ │ │ +
1084 using reference = R;
│ │ │ │ +
1085 using pointer = P;
│ │ │ │ + │ │ │ │ +
1087
│ │ │ │ +
1088 // Corresponding Dune typedefs
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
1093
│ │ │ │ +
1094 // Only defined to do static assertions.
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1096 {
│ │ │ │ +
1097 static_assert(std::is_signed_v<difference_type>,
│ │ │ │ +
1098 "Type used as difference_type must be signed");
│ │ │ │ +
1099 const DerivedIterator& constDerived = derived();
│ │ │ │ +
1100 static_assert(std::is_convertible_v<decltype(*constDerived), reference>,
│ │ │ │ +
1101 "Derived class does not implement `*it` or `*(it.baseIterator())` for const `it` required by IteratorFacade<..., std::forward_iterator_tag, ...>.");
│ │ │ │ +
1102 static_assert(std::is_convertible_v<decltype(++derived()), DerivedIterator&>,
│ │ │ │ +
1103 "Derived class does not implement `++it`, `++(it.baseIterator())`, or `it+=1` for mutable `it` required by IteratorFacade<..., std::forward_iterator_tag, ...>.");
│ │ │ │ +
1104 static_assert(std::is_convertible_v<decltype(constDerived==constDerived), bool>,
│ │ │ │ +
1105 "Derived class does not implement `it1==it2` or `it1.baseIterator()==it2.baseIterator()` for const `it1` and `it2` required by IteratorFacade<..., std::forward_iterator_tag, ...>.");
│ │ │ │ +
1106 if constexpr (isBidirectional)
│ │ │ │ +
1107 static_assert(std::is_convertible_v<decltype(--derived()), DerivedIterator&>,
│ │ │ │ +
1108 "Derived class does not implement `--it`, `--(it.baseIterator())`, or `it-=1` for mutable `it` required by IteratorFacade<..., std::bidirectional_iterator_tag, ...>.");
│ │ │ │ +
1109 if constexpr (isRandomAccess)
│ │ │ │ +
1110 {
│ │ │ │ +
1111 static_assert(std::is_convertible_v<decltype(derived()+=std::declval<difference_type>()), DerivedIterator&>,
│ │ │ │ +
1112 "Derived class does not implement `it+=` or `it.baseIterator()+=` for mutable `it` required by IteratorFacade<..., std::random_access_iterator_tag, ...>.");
│ │ │ │ +
1113 static_assert(std::is_convertible_v<decltype(constDerived-constDerived), difference_type>,
│ │ │ │ +
1114 "Derived class does not implement `it1-it2` or `it1.baseIterator()-it2.baseIterator()` for const `it1` and `it2` required by IteratorFacade<..., std::random_access_iterator_tag, ...>.");
│ │ │ │ +
1115 }
│ │ │ │ +
1116 }
│ │ │ │ +
│ │ │ │ +
1117
│ │ │ │ +
│ │ │ │ +
1119 constexpr decltype(auto) operator*() const
│ │ │ │ +
1120 {
│ │ │ │ +
1121 if constexpr (Dune::models<Impl::Concepts::BaseIterDereferenceOp<reference>, DerivedIterator>())
│ │ │ │ +
1122 return *(IteratorFacadeAccess::baseIterator(derived()));
│ │ │ │ +
1123 else
│ │ │ │ +
1124 static_assert(AlwaysFalse<It>::value,
│ │ │ │ +
1125 "Derived class does not implement `*it` or `*(it.baseIterator())` for const `it` required by IteratorFacade<..., std::forward_iterator_tag, ...>.");
│ │ │ │ +
1126 }
│ │ │ │ +
│ │ │ │ +
1127
│ │ │ │ +
│ │ │ │ +
1129 constexpr pointer operator->() const
│ │ │ │ +
1130 {
│ │ │ │ +
1131 if constexpr (std::is_pointer_v<pointer>)
│ │ │ │ +
1132 return std::addressof(*derived());
│ │ │ │ +
1133 else
│ │ │ │ +
1134 return pointer(*derived());
│ │ │ │ +
1135 }
│ │ │ │ +
│ │ │ │ +
1136
│ │ │ │ +
│ │ │ │ +
1138 constexpr decltype(auto) operator++()
│ │ │ │ +
1139 {
│ │ │ │ +
1140 if constexpr (Dune::models<Impl::Concepts::BaseIterIncrementOp, DerivedIterator>())
│ │ │ │ +
1141 {
│ │ │ │ +
1142 ++(IteratorFacadeAccess::baseIterator(derived()));
│ │ │ │ +
1143 return derived();
│ │ │ │ +
1144 }
│ │ │ │ +
1145 else if constexpr (Dune::models<Impl::Concepts::IterAdvanceOp<difference_type>, DerivedIterator>())
│ │ │ │ +
1146 {
│ │ │ │ +
1147 derived() += 1;
│ │ │ │ +
1148 return derived();
│ │ │ │ +
1149 }
│ │ │ │ +
1150 else
│ │ │ │ +
1151 static_assert(AlwaysFalse<It>::value,
│ │ │ │ +
1152 "Derived class does not implement `++it`, `++(it.baseIterator())`, or `it+=1` for mutable `it` required by IteratorFacade<..., std::forward_iterator_tag, ...>.");
│ │ │ │ +
1153 }
│ │ │ │ +
│ │ │ │ +
1154
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1157 {
│ │ │ │ +
1158 DerivedIterator tmp(derived());
│ │ │ │ +
1159 this->operator++();
│ │ │ │ +
1160 return tmp;
│ │ │ │ +
1161 }
│ │ │ │ +
│ │ │ │ +
1162
│ │ │ │ +
1168 template<bool dummy=true, std::enable_if_t<isBidirectional and dummy, int> =0>
│ │ │ │ +
│ │ │ │ +
1169 constexpr decltype(auto) operator--()
│ │ │ │ +
1170 {
│ │ │ │ +
1171 if constexpr (Dune::models<Impl::Concepts::BaseIterDecrementOp, DerivedIterator>())
│ │ │ │ +
1172 {
│ │ │ │ +
1173 --(IteratorFacadeAccess::baseIterator(derived()));
│ │ │ │ +
1174 return derived();
│ │ │ │ +
1175 }
│ │ │ │ +
1176 else if constexpr (Dune::models<Impl::Concepts::IterAdvanceOp<difference_type>, DerivedIterator>())
│ │ │ │ +
1177 {
│ │ │ │ +
1178 derived() -= 1;
│ │ │ │ +
1179 return derived();
│ │ │ │ +
1180 }
│ │ │ │ +
1181 else
│ │ │ │ +
1182 static_assert(AlwaysFalse<It>::value,
│ │ │ │ +
1183 "Derived class does not implement `--it`, `--(it.baseIterator())`, or `it-=1` for mutable `it` required by IteratorFacade<..., std::bidirectional_iterator_tag, ...>.");
│ │ │ │ +
1184 }
│ │ │ │ +
│ │ │ │ +
1185
│ │ │ │ +
1191 template<bool dummy=true, std::enable_if_t<isBidirectional and dummy, int> =0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1193 {
│ │ │ │ +
1194 DerivedIterator tmp(derived());
│ │ │ │ +
1195 this->operator--();
│ │ │ │ +
1196 return tmp;
│ │ │ │ +
1197 }
│ │ │ │ +
│ │ │ │ +
1198
│ │ │ │ +
1206 template<bool dummy=true, std::enable_if_t<isRandomAccess and dummy, int> =0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1208 {
│ │ │ │ +
1209 return *(derived()+n);
│ │ │ │ +
1210 }
│ │ │ │ +
│ │ │ │ +
1211
│ │ │ │ +
1217 template<bool dummy=true, std::enable_if_t<isRandomAccess and dummy, int> =0>
│ │ │ │ +
│ │ │ │ +
1218 constexpr decltype(auto) operator+=(difference_type n)
│ │ │ │ +
1219 {
│ │ │ │ +
1220 if constexpr (Dune::models<Impl::Concepts::BaseIterAdvanceOp<difference_type>, DerivedIterator>())
│ │ │ │ +
1221 {
│ │ │ │ +
1222 IteratorFacadeAccess::baseIterator(derived()) += n;
│ │ │ │ +
1223 return derived();
│ │ │ │ +
1224 }
│ │ │ │ +
1225 else
│ │ │ │ +
1226 static_assert(AlwaysFalse<It>::value,
│ │ │ │ +
1227 "Derived class does not implement `it+=` or `it.baseIterator()+=` for mutable `it` required by IteratorFacade<..., std::random_access_iterator_tag, ...>.");
│ │ │ │ +
1228 }
│ │ │ │ +
│ │ │ │ +
1229
│ │ │ │ +
1235 template<bool dummy=true, std::enable_if_t<isRandomAccess and dummy, int> =0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1237 {
│ │ │ │ +
1238 DerivedIterator tmp(derived());
│ │ │ │ +
1239 tmp += n;
│ │ │ │ +
1240 return tmp;
│ │ │ │ +
1241 }
│ │ │ │ +
│ │ │ │ +
1242
│ │ │ │ +
1248 template<bool dummy=true, std::enable_if_t<isRandomAccess and dummy, int> =0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1250 {
│ │ │ │ +
1251 derived() += (-n);
│ │ │ │ +
1252 return derived();
│ │ │ │ +
1253 }
│ │ │ │ +
│ │ │ │ +
1254
│ │ │ │ +
1260 template<bool dummy=true, std::enable_if_t<isRandomAccess and dummy, int> =0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1262 {
│ │ │ │ +
1263 DerivedIterator tmp(derived());
│ │ │ │ +
1264 tmp -= n;
│ │ │ │ +
1265 return tmp;
│ │ │ │ +
1266 }
│ │ │ │ +
│ │ │ │ +
1267
│ │ │ │ +
1268 };
│ │ │ │ +
│ │ │ │ +
1269
│ │ │ │ +
1270
│ │ │ │ +
1271
│ │ │ │ +
1282 template<class T1, class T2, class C, class V1, class V2, class R1, class R2, class P1, class P2, class D1, class D2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1284 {
│ │ │ │ +
1285 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1);
│ │ │ │ +
1286 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2);
│ │ │ │ +
1287 if constexpr (Dune::models<Impl::Concepts::BaseIterEqualsOp, T1, T2>())
│ │ │ │ +
1288 return IteratorFacadeAccess::baseIterator(derivedIt1) == IteratorFacadeAccess::baseIterator(derivedIt2);
│ │ │ │ +
1289 else
│ │ │ │ +
1290 static_assert(AlwaysFalse<T1>::value,
│ │ │ │ +
1291 "Derived class does not implement `it1==it2` or `it1.baseIterator()==it2.baseIterator()` for const `it1` and `it2` required by IteratorFacade<..., std::forward_iterator_tag, ...>.");
│ │ │ │ +
1292 }
│ │ │ │ +
│ │ │ │ +
1293
│ │ │ │ +
1301 template<class T1, class T2, class C, class V1, class V2, class R1, class R2, class P1, class P2, class D1, class D2,
│ │ │ │ +
1302 std::enable_if_t< Dune::models<Impl::Concepts::IterEqualsOp,T1, T2>() , int> =0>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1304 {
│ │ │ │ +
1305 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1);
│ │ │ │ +
1306 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2);
│ │ │ │ +
1307 return not(derivedIt1 == derivedIt2);
│ │ │ │ +
1308 }
│ │ │ │ +
│ │ │ │ +
1309
│ │ │ │ +
1320 template<class T1, class T2, class C, class V1, class V2, class R1, class R2, class P1, class P2, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1322 {
│ │ │ │ +
1323 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1);
│ │ │ │ +
1324 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2);
│ │ │ │ +
1325 if constexpr (Dune::models<Impl::Concepts::BaseIterDistanceOp<D>,T1, T2>())
│ │ │ │ +
1326 return D(IteratorFacadeAccess::baseIterator(derivedIt1) - IteratorFacadeAccess::baseIterator(derivedIt2));
│ │ │ │ +
1327 else
│ │ │ │ +
1328 static_assert(AlwaysFalse<T1>::value,
│ │ │ │ +
1329 "Derived class does not implement `it1-it2` or `it1.baseIterator()-it2.baseIterator()` for const `it1` and `it2` required by IteratorFacade<..., std::random_access_iterator_tag, ...>.");
│ │ │ │ +
1330 }
│ │ │ │ +
│ │ │ │ +
1331
│ │ │ │ +
1339 template<class T1, class T2, class C, class V1, class V2, class R1, class R2, class P1, class P2, class D1, class D2,
│ │ │ │ +
1340 std::enable_if_t< Dune::models<Impl::Concepts::IterDistanceOp<D1>,T1, T2>() , int> =0>
│ │ │ │ +
│ │ │ │ +
1341 constexpr bool operator<(const IteratorFacade<T1,C,V1,R1,P1,D1>& it1, const IteratorFacade<T2,C,V2,R2,P2,D2>& it2)
│ │ │ │ +
1342 {
│ │ │ │ +
1343 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1);
│ │ │ │ +
1344 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2);
│ │ │ │ +
1345 return (derivedIt1 - derivedIt2) < D1(0);
│ │ │ │ +
1346 }
│ │ │ │ +
│ │ │ │ +
1347
│ │ │ │ +
1355 template<class T1, class T2, class C, class V1, class V2, class R1, class R2, class P1, class P2, class D1, class D2,
│ │ │ │ +
1356 std::enable_if_t< Dune::models<Impl::Concepts::IterDistanceOp<D1>,T1, T2>() , int> =0>
│ │ │ │ +
│ │ │ │ +
1357 constexpr bool operator<=(const IteratorFacade<T1,C,V1,R1,P1,D1>& it1, const IteratorFacade<T2,C,V2,R2,P2,D2>& it2)
│ │ │ │ +
1358 {
│ │ │ │ +
1359 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1);
│ │ │ │ +
1360 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2);
│ │ │ │ +
1361 return (derivedIt1 - derivedIt2) <= D1(0);
│ │ │ │ +
1362 }
│ │ │ │ +
│ │ │ │ +
1363
│ │ │ │ +
1371 template<class T1, class T2, class C, class V1, class V2, class R1, class R2, class P1, class P2, class D1, class D2,
│ │ │ │ +
1372 std::enable_if_t< Dune::models<Impl::Concepts::IterDistanceOp<D1>,T1, T2>() , int> =0>
│ │ │ │ +
│ │ │ │ +
1373 constexpr bool operator>(const IteratorFacade<T1,C,V1,R1,P1,D1>& it1, const IteratorFacade<T2,C,V2,R2,P2,D2>& it2)
│ │ │ │ +
1374 {
│ │ │ │ +
1375 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1);
│ │ │ │ +
1376 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2);
│ │ │ │ +
1377 return (derivedIt1 - derivedIt2) > D1(0);
│ │ │ │ +
1378 }
│ │ │ │ +
│ │ │ │ +
1379
│ │ │ │ +
1387 template<class T1, class T2, class C, class V1, class V2, class R1, class R2, class P1, class P2, class D1, class D2,
│ │ │ │ +
1388 std::enable_if_t< Dune::models<Impl::Concepts::IterDistanceOp<D1>,T1, T2>() , int> =0>
│ │ │ │ +
│ │ │ │ +
1389 constexpr bool operator>=(const IteratorFacade<T1,C,V1,R1,P1,D1>& it1, const IteratorFacade<T2,C,V2,R2,P2,D2>& it2)
│ │ │ │ +
1390 {
│ │ │ │ +
1391 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1);
│ │ │ │ +
1392 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2);
│ │ │ │ +
1393 return (derivedIt1 - derivedIt2) >= D1(0);
│ │ │ │ +
1394 }
│ │ │ │ +
│ │ │ │ +
1395
│ │ │ │ +
1396
│ │ │ │ +
1397
│ │ │ │ +
1399}
│ │ │ │ +
1400#endif
│ │ │ │ +
Infrastructure for concepts.
│ │ │ │ +
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:638
│ │ │ │ +
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:684
│ │ │ │ +
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:661
│ │ │ │ +
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:238
│ │ │ │ +
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:706
│ │ │ │ +
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:260
│ │ │ │
STL namespace.
│ │ │ │ -
Namespace for features backported from new C++ standards.
Definition default_accessor.hh:10
│ │ │ │ -
Multidimensional index space with dynamic and static extents.
Definition extents.hh:54
│ │ │ │ -
A multi-dimensional non-owning array view.
Definition mdspan.hh:64
│ │ │ │ -
typename accessor_type::reference reference
Definition mdspan.hh:82
│ │ │ │ -
Element element_type
Definition mdspan.hh:71
│ │ │ │ -
constexpr mdspan(data_handle_type p, const mapping_type &m, const accessor_type &a)
Construct from the pointer to the data of the tensor, an index mapping, and an accessor.
Definition mdspan.hh:161
│ │ │ │ -
Extents extents_type
Definition mdspan.hh:72
│ │ │ │ -
static constexpr rank_type rank_dynamic() noexcept
Number of dimensions of the tensor.
Definition mdspan.hh:269
│ │ │ │ -
static constexpr bool is_always_unique()
Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j....
Definition mdspan.hh:293
│ │ │ │ -
typename extents_type::index_type index_type
Definition mdspan.hh:78
│ │ │ │ -
LayoutPolicy layout_type
Definition mdspan.hh:73
│ │ │ │ -
constexpr bool is_strided() const
Return true only if for every rank index r of extents there exists an integer sr such that,...
Definition mdspan.hh:313
│ │ │ │ -
constexpr mdspan(data_handle_type p, const mapping_type &m)
Construct from the pointer to the data of the tensor and an index mapping.
Definition mdspan.hh:156
│ │ │ │ -
typename extents_type::rank_type rank_type
Definition mdspan.hh:80
│ │ │ │ -
constexpr mdspan(data_handle_type p, const extents_type &e)
Construct from the pointer to the data of the tensor and its extents.
Definition mdspan.hh:149
│ │ │ │ -
std::remove_cv_t< Element > value_type
Definition mdspan.hh:76
│ │ │ │ -
static constexpr bool is_always_exhaustive()
Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such ...
Definition mdspan.hh:296
│ │ │ │ -
constexpr reference operator[](Index index) const
Access specified element at position [i0] For a rank one mdspan, the operator[i] is added to support ...
Definition mdspan.hh:219
│ │ │ │ -
constexpr const extents_type & extents() const noexcept
Number of elements in all dimensions of the tensor,.
Definition mdspan.hh:250
│ │ │ │ -
constexpr index_type extent(rank_type r) const noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdspan.hh:275
│ │ │ │ -
friend constexpr void swap(mdspan &x, mdspan &y) noexcept
Overloads the std::swap algorithm for std::mdspan. Exchanges the state of x with that of y.
Definition mdspan.hh:320
│ │ │ │ -
static constexpr bool is_always_strided()
Return true only if for every rank index r of extents there exists an integer sr such that,...
Definition mdspan.hh:299
│ │ │ │ -
constexpr size_type size() const noexcept
The number of elements accessible by this multi-dimensional span.
Definition mdspan.hh:278
│ │ │ │ -
typename accessor_type::data_handle_type data_handle_type
Definition mdspan.hh:81
│ │ │ │ -
constexpr bool empty() const noexcept
Checks if the size of the index space is zero.
Definition mdspan.hh:287
│ │ │ │ -
constexpr const accessor_type & accessor() const noexcept
The accessor policy object.
Definition mdspan.hh:256
│ │ │ │ -
AccessorPolicy accessor_type
Definition mdspan.hh:74
│ │ │ │ -
constexpr bool is_exhaustive() const
Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such ...
Definition mdspan.hh:306
│ │ │ │ -
static constexpr rank_type rank() noexcept
Number of dimensions of the tensor.
Definition mdspan.hh:266
│ │ │ │ -
static constexpr std::size_t static_extent(rank_type r) noexcept
Number of elements in the r'th dimension of the tensor.
Definition mdspan.hh:272
│ │ │ │ -
constexpr const mapping_type & mapping() const noexcept
Index mapping of a layout policy.
Definition mdspan.hh:253
│ │ │ │ -
constexpr const data_handle_type & data_handle() const noexcept
The pointer to the underlying flat sequence.
Definition mdspan.hh:259
│ │ │ │ -
constexpr index_type stride(rank_type r) const
The stride along the specified dimension.
Definition mdspan.hh:316
│ │ │ │ -
constexpr bool is_unique() const
Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j....
Definition mdspan.hh:302
│ │ │ │ -
constexpr mdspan()
Default constructor value-initializes all members.
Definition mdspan.hh:105
│ │ │ │ -
typename extents_type::size_type size_type
Definition mdspan.hh:79
│ │ │ │ -
typename layout_type::template mapping< extents_type > mapping_type
Definition mdspan.hh:77
│ │ │ │ -
A contiguous sequence of elements with static or dynamic extent.
Definition span.hh:126
│ │ │ │ +
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ +
Namespace for concepts.
Definition concept.hh:34
│ │ │ │ +
constexpr bool requireConvertible()
Definition concept.hh:247
│ │ │ │ +
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:142
│ │ │ │ +
std::forward_iterator_tag iterator_category
Definition iteratorfacades.hh:146
│ │ │ │ +
V * pointer
Definition iteratorfacades.hh:149
│ │ │ │ +
DerivedType & operator++()
Preincrement operator.
Definition iteratorfacades.hh:210
│ │ │ │ +
D DifferenceType
The type of the difference between two positions.
Definition iteratorfacades.hh:191
│ │ │ │ +
R Reference
The type of the reference to the values accessed.
Definition iteratorfacades.hh:196
│ │ │ │ +
Pointer operator->() const
Definition iteratorfacades.hh:204
│ │ │ │ +
T DerivedType
The type of derived iterator.
Definition iteratorfacades.hh:176
│ │ │ │ +
V Value
The type of value accessed through the iterator.
Definition iteratorfacades.hh:181
│ │ │ │ +
typename std::remove_const< V >::type value_type
Definition iteratorfacades.hh:147
│ │ │ │ +
DerivedType operator++(int)
Postincrement operator.
Definition iteratorfacades.hh:217
│ │ │ │ +
V * Pointer
The pointer to the Value.
Definition iteratorfacades.hh:186
│ │ │ │ +
D difference_type
Definition iteratorfacades.hh:148
│ │ │ │ +
Reference operator*() const
Dereferencing operator.
Definition iteratorfacades.hh:199
│ │ │ │ +
R reference
Definition iteratorfacades.hh:150
│ │ │ │ +
Facade class for stl conformant bidirectional iterators.
Definition iteratorfacades.hh:275
│ │ │ │ +
V * pointer
Definition iteratorfacades.hh:282
│ │ │ │ +
typename std::remove_const< V >::type value_type
Definition iteratorfacades.hh:280
│ │ │ │ +
Reference operator*() const
Dereferencing operator.
Definition iteratorfacades.hh:333
│ │ │ │ +
D difference_type
Definition iteratorfacades.hh:281
│ │ │ │ +
T DerivedType
The type of derived iterator.
Definition iteratorfacades.hh:310
│ │ │ │ +
DerivedType & operator--()
Preincrement operator.
Definition iteratorfacades.hh:360
│ │ │ │ +
Pointer operator->() const
Definition iteratorfacades.hh:338
│ │ │ │ +
DerivedType & operator++()
Preincrement operator.
Definition iteratorfacades.hh:344
│ │ │ │ +
V * Pointer
The pointer to the Value.
Definition iteratorfacades.hh:320
│ │ │ │ +
R Reference
The type of the reference to the values accessed.
Definition iteratorfacades.hh:330
│ │ │ │ +
DerivedType operator++(int)
Postincrement operator.
Definition iteratorfacades.hh:351
│ │ │ │ +
std::bidirectional_iterator_tag iterator_category
Definition iteratorfacades.hh:279
│ │ │ │ +
D DifferenceType
The type of the difference between two positions.
Definition iteratorfacades.hh:325
│ │ │ │ +
DerivedType operator--(int)
Postincrement operator.
Definition iteratorfacades.hh:367
│ │ │ │ +
R reference
Definition iteratorfacades.hh:283
│ │ │ │ +
V Value
The type of value accessed through the iterator.
Definition iteratorfacades.hh:315
│ │ │ │ +
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:435
│ │ │ │ +
typename std::remove_const< V >::type value_type
Definition iteratorfacades.hh:440
│ │ │ │ +
D difference_type
Definition iteratorfacades.hh:441
│ │ │ │ +
DerivedType operator--(int)
Postdecrement operator.
Definition iteratorfacades.hh:558
│ │ │ │ +
V * pointer
Definition iteratorfacades.hh:442
│ │ │ │ +
std::random_access_iterator_tag iterator_category
Definition iteratorfacades.hh:439
│ │ │ │ +
Reference operator*() const
Dereferencing operator.
Definition iteratorfacades.hh:501
│ │ │ │ +
DerivedType & operator++()
Preincrement operator.
Definition iteratorfacades.hh:522
│ │ │ │ +
R reference
Definition iteratorfacades.hh:443
│ │ │ │ +
Pointer operator->() const
Definition iteratorfacades.hh:506
│ │ │ │ +
D DifferenceType
The type of the difference between two positions.
Definition iteratorfacades.hh:493
│ │ │ │ +
DerivedType & operator--()
Predecrement operator.
Definition iteratorfacades.hh:551
│ │ │ │ +
DerivedType & operator-=(DifferenceType n)
Definition iteratorfacades.hh:565
│ │ │ │ +
DerivedType operator+(DifferenceType n) const
Definition iteratorfacades.hh:542
│ │ │ │ +
Reference operator[](DifferenceType n) const
Get the element n positions from the current one.
Definition iteratorfacades.hh:516
│ │ │ │ +
T DerivedType
The type of derived iterator.
Definition iteratorfacades.hh:478
│ │ │ │ +
V * Pointer
The pointer to the Value.
Definition iteratorfacades.hh:488
│ │ │ │ +
DerivedType operator-(DifferenceType n) const
Definition iteratorfacades.hh:571
│ │ │ │ +
DerivedType operator++(int)
Postincrement operator.
Definition iteratorfacades.hh:529
│ │ │ │ +
V Value
The type of value accessed through the iterator.
Definition iteratorfacades.hh:483
│ │ │ │ +
DerivedType & operator+=(DifferenceType n)
Definition iteratorfacades.hh:536
│ │ │ │ +
R Reference
The type of the reference to the values accessed.
Definition iteratorfacades.hh:498
│ │ │ │ +
Helper to mimic a pointer for proxy objects.
Definition iteratorfacades.hh:750
│ │ │ │ +
constexpr ProxyArrowResult(const ProxyType &p) noexcept(std::is_nothrow_constructible_v< ProxyType, const ProxyType & >)
Definition iteratorfacades.hh:757
│ │ │ │ +
constexpr ProxyType * operator->() noexcept
Definition iteratorfacades.hh:767
│ │ │ │ +
constexpr const ProxyType * operator->() const noexcept
Definition iteratorfacades.hh:762
│ │ │ │ +
constexpr ProxyArrowResult(ProxyType &&p) noexcept(std::is_nothrow_constructible_v< ProxyType, ProxyType && >)
Definition iteratorfacades.hh:752
│ │ │ │ +
This class encapsulates access of IteratorFacade.
Definition iteratorfacades.hh:786
│ │ │ │ +
CRTP-Mixing class for stl conformant iterators of given iterator category.
Definition iteratorfacades.hh:1053
│ │ │ │ +
constexpr DerivedIterator operator--(int)
Postdecrement operator.
Definition iteratorfacades.hh:1192
│ │ │ │ +
D difference_type
Definition iteratorfacades.hh:1086
│ │ │ │ +
C iterator_category
Definition iteratorfacades.hh:1082
│ │ │ │ +
IteratorFacade()
Definition iteratorfacades.hh:1095
│ │ │ │ +
constexpr pointer operator->() const
Arrow access to members of referenced value.
Definition iteratorfacades.hh:1129
│ │ │ │ +
pointer Pointer
Definition iteratorfacades.hh:1091
│ │ │ │ +
reference Reference
Definition iteratorfacades.hh:1090
│ │ │ │ +
constexpr DerivedIterator operator+(difference_type n) const
Create iterator incremented by given value.
Definition iteratorfacades.hh:1236
│ │ │ │ +
constexpr DerivedIterator operator++(int)
Postincrement operator.
Definition iteratorfacades.hh:1156
│ │ │ │ +
constexpr DerivedIterator & derived()
Cast of *this to DerivedIterator type.
Definition iteratorfacades.hh:1074
│ │ │ │ +
It DerivedIterator
The derived iterator type.
Definition iteratorfacades.hh:1065
│ │ │ │ +
constexpr DerivedIterator & operator-=(difference_type n)
Decrement iterator by given value.
Definition iteratorfacades.hh:1249
│ │ │ │ +
constexpr decltype(auto) operator--()
Predecrement operator.
Definition iteratorfacades.hh:1169
│ │ │ │ +
R reference
Definition iteratorfacades.hh:1084
│ │ │ │ +
constexpr reference operator[](difference_type n) const
Dereference element with given offset form this iterator.
Definition iteratorfacades.hh:1207
│ │ │ │ +
constexpr const DerivedIterator & derived() const
Cast of *this to const DerivedIterator type.
Definition iteratorfacades.hh:1068
│ │ │ │ +
P pointer
Definition iteratorfacades.hh:1085
│ │ │ │ +
typename std::remove_const< V >::type value_type
Definition iteratorfacades.hh:1083
│ │ │ │ +
value_type Value
Definition iteratorfacades.hh:1089
│ │ │ │ +
constexpr decltype(auto) operator++()
Preincrement operator.
Definition iteratorfacades.hh:1138
│ │ │ │ +
difference_type DifferenceType
Definition iteratorfacades.hh:1092
│ │ │ │ +
constexpr DerivedIterator operator-(difference_type n) const
Create iterator decremented by given value.
Definition iteratorfacades.hh:1261
│ │ │ │ +
Enable typedef if two types are interoperable.
Definition typetraits.hh:81
│ │ │ │ +
template which always yields a false value
Definition typetraits.hh:124
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,522 +1,1183 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -mdspan.hh │ │ │ │ │ +iteratorfacades.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 © 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_MDSPAN_HH │ │ │ │ │ -6#define DUNE_COMMON_STD_MDSPAN_HH │ │ │ │ │ +5#ifndef DUNE_ITERATORFACADES_HH │ │ │ │ │ +6#define DUNE_ITERATORFACADES_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ +8#include │ │ │ │ │ 9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#if __has_include() │ │ │ │ │ -12 #include │ │ │ │ │ -13#endif │ │ │ │ │ -14 │ │ │ │ │ -15#include <_d_u_n_e_/_c_o_m_m_o_n_/_i_n_d_i_c_e_s_._h_h> │ │ │ │ │ -16#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h> │ │ │ │ │ -17#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_e_x_t_e_n_t_s_._h_h> │ │ │ │ │ -18#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_l_a_y_o_u_t___r_i_g_h_t_._h_h> │ │ │ │ │ -19#include <_d_u_n_e_/_c_o_m_m_o_n_/_s_t_d_/_s_p_a_n_._h_h> │ │ │ │ │ -20 │ │ │ │ │ -21namespace _D_u_n_e_:_:_S_t_d { │ │ │ │ │ -22 │ │ │ │ │ -61template > │ │ │ │ │ -_6_3class _m_d_s_p_a_n │ │ │ │ │ -64{ │ │ │ │ │ -65 static_assert(std::is_object_v); │ │ │ │ │ -66 static_assert(!std::is_abstract_v); │ │ │ │ │ -67 static_assert(!std::is_array_v); │ │ │ │ │ -68 static_assert(std::is_same_v); │ │ │ │ │ -69 │ │ │ │ │ -70public: │ │ │ │ │ -_7_1 using _e_l_e_m_e_n_t___t_y_p_e = Element; │ │ │ │ │ -_7_2 using _e_x_t_e_n_t_s___t_y_p_e = Extents; │ │ │ │ │ -_7_3 using _l_a_y_o_u_t___t_y_p_e = LayoutPolicy; │ │ │ │ │ -_7_4 using _a_c_c_e_s_s_o_r___t_y_p_e = AccessorPolicy; │ │ │ │ │ -75 │ │ │ │ │ -_7_6 using _v_a_l_u_e___t_y_p_e = std::remove_cv_t; │ │ │ │ │ -_7_7 using _m_a_p_p_i_n_g___t_y_p_e = typename layout_type::template mapping; │ │ │ │ │ -_7_8 using _i_n_d_e_x___t_y_p_e = typename extents_type::index_type; │ │ │ │ │ -_7_9 using _s_i_z_e___t_y_p_e = typename extents_type::size_type; │ │ │ │ │ -_8_0 using _r_a_n_k___t_y_p_e = typename extents_type::rank_type; │ │ │ │ │ -_8_1 using _d_a_t_a___h_a_n_d_l_e___t_y_p_e = typename accessor_type::data_handle_type; │ │ │ │ │ -_8_2 using _r_e_f_e_r_e_n_c_e = typename accessor_type::reference; │ │ │ │ │ -83 │ │ │ │ │ -84private: │ │ │ │ │ -85 // [mdspan.layout.reqmts] │ │ │ │ │ -86 static_assert(std::is_nothrow_move_constructible_v); │ │ │ │ │ -87 static_assert(std::is_nothrow_move_assignable_v); │ │ │ │ │ -88 static_assert(std::is_nothrow_swappable_v); │ │ │ │ │ -89 │ │ │ │ │ -90 // [mdspan.accessor.reqmts] │ │ │ │ │ -91 static_assert(std::is_nothrow_move_constructible_v); │ │ │ │ │ -92 static_assert(std::is_nothrow_move_assignable_v); │ │ │ │ │ -93 static_assert(std::is_nothrow_swappable_v); │ │ │ │ │ -94 │ │ │ │ │ -95public: │ │ │ │ │ -98 │ │ │ │ │ -100 template 0), int> = 0, │ │ │ │ │ -102 std::enable_if_t, int> = 0, │ │ │ │ │ -103 std::enable_if_t, int> = 0, │ │ │ │ │ -104 std::enable_if_t, int> = 0> │ │ │ │ │ -_1_0_5 constexpr _m_d_s_p_a_n () │ │ │ │ │ -106 : data_handle_{} │ │ │ │ │ -107 , mapping_{} │ │ │ │ │ -108 , accessor_{} │ │ │ │ │ -109 {} │ │ │ │ │ -110 │ │ │ │ │ -112 template = 0, │ │ │ │ │ -115 std::enable_if_t<(... && std::is_convertible_v), │ │ │ │ │ -int> = 0, │ │ │ │ │ -116 std::enable_if_t<(... && std::is_nothrow_constructible_v), int> = 0, │ │ │ │ │ -117 std::enable_if_t, int> = 0, │ │ │ │ │ -118 std::enable_if_t, int> = 0> │ │ │ │ │ -_1_1_9 explicit constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, IndexTypes... exts) │ │ │ │ │ -120 : _m_d_s_p_a_n(std::move(p), _e_x_t_e_n_t_s___t_y_p_e(_i_n_d_e_x___t_y_p_e(std::move(exts))...)) │ │ │ │ │ -121 {} │ │ │ │ │ -122 │ │ │ │ │ -124 template , int> │ │ │ │ │ -= 0, │ │ │ │ │ -126 std::enable_if_t, int> = 0, │ │ │ │ │ -127 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type:: │ │ │ │ │ -rank()), int> = 0> │ │ │ │ │ -128 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -129 explicit(N != extents_type::rank_dynamic()) │ │ │ │ │ -130 #endif │ │ │ │ │ -_1_3_1 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, _S_t_d_:_:_s_p_a_n_<_I_n_d_e_x_T_y_p_e_,_N_> exts) │ │ │ │ │ -132 : _m_d_s_p_a_n(std::move(p), _e_x_t_e_n_t_s___t_y_p_e(exts)) │ │ │ │ │ -133 {} │ │ │ │ │ -134 │ │ │ │ │ -136 template , int> = 0, │ │ │ │ │ -138 std::enable_if_t<(N == extents_type::rank_dynamic() || N == extents_type:: │ │ │ │ │ -rank()), int> = 0> │ │ │ │ │ -139 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -140 explicit(N != extents_type::rank_dynamic()) │ │ │ │ │ -141 #endif │ │ │ │ │ -_1_4_2 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const std::array& exts) │ │ │ │ │ -143 : _m_d_s_p_a_n(std::move(p), _e_x_t_e_n_t_s___t_y_p_e(exts)) │ │ │ │ │ -144 {} │ │ │ │ │ -145 │ │ │ │ │ -147 template , int> = 0> │ │ │ │ │ -_1_4_9 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const _e_x_t_e_n_t_s___t_y_p_e& e) │ │ │ │ │ -150 : _m_d_s_p_a_n(_s_t_d::move(p), _m_a_p_p_i_n_g___t_y_p_e(e)) │ │ │ │ │ -151 {} │ │ │ │ │ -152 │ │ │ │ │ -154 template , int> = 0> │ │ │ │ │ -_1_5_6 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const _m_a_p_p_i_n_g___t_y_p_e& m) │ │ │ │ │ -157 : _m_d_s_p_a_n(_s_t_d::move(p), m, _a_c_c_e_s_s_o_r___t_y_p_e{}) │ │ │ │ │ -158 {} │ │ │ │ │ -159 │ │ │ │ │ -_1_6_1 constexpr _m_d_s_p_a_n (_d_a_t_a___h_a_n_d_l_e___t_y_p_e p, const _m_a_p_p_i_n_g___t_y_p_e& m, const │ │ │ │ │ -_a_c_c_e_s_s_o_r___t_y_p_e& a) │ │ │ │ │ -162 : data_handle_(_s_t_d::move(p)) │ │ │ │ │ -163 , mapping_(m) │ │ │ │ │ -164 , accessor_(a) │ │ │ │ │ -165 {} │ │ │ │ │ -166 │ │ │ │ │ -167 │ │ │ │ │ -169 template &>, int> = 0, │ │ │ │ │ -171 std::enable_if_t, int> = 0> │ │ │ │ │ -172 #if __cpp_conditional_explicit >= 201806L │ │ │ │ │ -173 explicit(!std::is_convertible_v&, _m_a_p_p_i_n_g___t_y_p_e> │ │ │ │ │ -174 || !std::is_convertible_v) │ │ │ │ │ -175 #endif │ │ │ │ │ -_1_7_6 constexpr _m_d_s_p_a_n (const │ │ │ │ │ -_m_d_s_p_a_n_<_O_t_h_e_r_E_l_e_m_e_n_t_T_y_p_e_,_O_t_h_e_r_E_x_t_e_n_d_s_,_O_t_h_e_r_L_a_y_o_u_t_P_o_l_i_c_y_,_O_t_h_e_r_A_c_c_e_s_s_o_r_>& other) │ │ │ │ │ -noexcept │ │ │ │ │ -177 : _m_d_s_p_a_n(_d_a_t_a___h_a_n_d_l_e___t_y_p_e(other._d_a_t_a___h_a_n_d_l_e()), _m_a_p_p_i_n_g___t_y_p_e(other._m_a_p_p_i_n_g │ │ │ │ │ -()), │ │ │ │ │ -178 _a_c_c_e_s_s_o_r___t_y_p_e(other._a_c_c_e_s_s_o_r())) │ │ │ │ │ -179 {} │ │ │ │ │ -180 │ │ │ │ │ +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_/_c_o_n_c_e_p_t_._h_h> │ │ │ │ │ +13 │ │ │ │ │ +14namespace _D_u_n_e │ │ │ │ │ +15{ │ │ │ │ │ +140 template │ │ │ │ │ +_1_4_1 class _F_o_r_w_a_r_d_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ +142 { │ │ │ │ │ +143 │ │ │ │ │ +144 public: │ │ │ │ │ +145 /* type aliases required by C++ for iterators */ │ │ │ │ │ +_1_4_6 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::forward_iterator_tag; │ │ │ │ │ +_1_4_7 using _v_a_l_u_e___t_y_p_e = typename std::remove_const::type; │ │ │ │ │ +_1_4_8 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = D; │ │ │ │ │ +_1_4_9 using _p_o_i_n_t_e_r = V*; │ │ │ │ │ +_1_5_0 using _r_e_f_e_r_e_n_c_e = R; │ │ │ │ │ +151 │ │ │ │ │ +_1_7_6 typedef T _D_e_r_i_v_e_d_T_y_p_e; │ │ │ │ │ +177 │ │ │ │ │ +_1_8_1 typedef V _V_a_l_u_e; │ │ │ │ │ 182 │ │ │ │ │ -183 │ │ │ │ │ -186 │ │ │ │ │ -191 template = 0, │ │ │ │ │ -193 std::enable_if_t<(... && std::is_convertible_v), int> │ │ │ │ │ -= 0, │ │ │ │ │ -194 std::enable_if_t<(... && std:: │ │ │ │ │ -is_nothrow_constructible_v), int> = 0> │ │ │ │ │ -_1_9_5 constexpr _r_e_f_e_r_e_n_c_e operator() (Indices... indices) const │ │ │ │ │ -196 { │ │ │ │ │ -197 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(std::move │ │ │ │ │ -(indices))...)); │ │ │ │ │ -198 } │ │ │ │ │ -199 │ │ │ │ │ -200#if __cpp_multidimensional_subscript >= 202110L │ │ │ │ │ -201 │ │ │ │ │ -203 template = 0, │ │ │ │ │ -205 std::enable_if_t<(... && std::is_convertible_v), int> │ │ │ │ │ -= 0, │ │ │ │ │ -206 std::enable_if_t<(... && std:: │ │ │ │ │ -is_nothrow_constructible_v), int> = 0> │ │ │ │ │ -207 constexpr _r_e_f_e_r_e_n_c_e operator[] (Indices... indices) const │ │ │ │ │ -208 { │ │ │ │ │ -209 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(std::move │ │ │ │ │ -(indices))...)); │ │ │ │ │ -210 } │ │ │ │ │ -211 │ │ │ │ │ -212#else // __cpp_multidimensional_subscript │ │ │ │ │ -213 │ │ │ │ │ -216 template , int> = 0, │ │ │ │ │ -218 std::enable_if_t<(E::rank() == 1), int> = 0> │ │ │ │ │ -_2_1_9 constexpr _r_e_f_e_r_e_n_c_e operator[] (Index index) const │ │ │ │ │ -220 { │ │ │ │ │ -221 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(std::move │ │ │ │ │ -(index)))); │ │ │ │ │ +_1_8_6 typedef V* _P_o_i_n_t_e_r; │ │ │ │ │ +187 │ │ │ │ │ +_1_9_1 typedef D _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ +192 │ │ │ │ │ +_1_9_6 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ +197 │ │ │ │ │ +_1_9_9 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ +200 { │ │ │ │ │ +201 return static_cast<_D_e_r_i_v_e_d_T_y_p_e const*>(this)->dereference(); │ │ │ │ │ +202 } │ │ │ │ │ +203 │ │ │ │ │ +_2_0_4 _P_o_i_n_t_e_r _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ +205 { │ │ │ │ │ +206 return &(static_cast(this)->dereference()); │ │ │ │ │ +207 } │ │ │ │ │ +208 │ │ │ │ │ +_2_1_0 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +211 { │ │ │ │ │ +212 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->increment(); │ │ │ │ │ +213 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ +214 } │ │ │ │ │ +215 │ │ │ │ │ +_2_1_7 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_+_+(int) │ │ │ │ │ +218 { │ │ │ │ │ +219 _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)); │ │ │ │ │ +220 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +221 return tmp; │ │ │ │ │ 222 } │ │ │ │ │ -223 │ │ │ │ │ -224#endif // __cpp_multidimensional_subscript │ │ │ │ │ -225 │ │ │ │ │ -227 template , int> = 0, │ │ │ │ │ -229 std::enable_if_t, │ │ │ │ │ -int> = 0> │ │ │ │ │ -_2_3_0 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (_S_t_d_:_:_s_p_a_n │ │ │ │ │ -indices) const │ │ │ │ │ -231 { │ │ │ │ │ -232 return _u_n_p_a_c_k_I_n_t_e_g_e_r_S_e_q_u_e_n_c_e([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ -233 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(indices │ │ │ │ │ -[ii])...)); }, │ │ │ │ │ -234 std::make_index_sequence{}); │ │ │ │ │ -235 } │ │ │ │ │ -236 │ │ │ │ │ -238 template , int> = 0, │ │ │ │ │ -240 std::enable_if_t, │ │ │ │ │ -int> = 0> │ │ │ │ │ -_2_4_1 constexpr _r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_]_ (const std::array& indices) const │ │ │ │ │ -242 { │ │ │ │ │ -243 return std::apply([&](auto... ii) -> _r_e_f_e_r_e_n_c_e { │ │ │ │ │ -244 return accessor_.access(data_handle_, mapping_(_i_n_d_e_x___t_y_p_e(ii)...)); }, │ │ │ │ │ -indices); │ │ │ │ │ +223 }; │ │ │ │ │ +224 │ │ │ │ │ +235 template │ │ │ │ │ +237 inline typename EnableIfInterOperable::type │ │ │ │ │ +_2_3_8 _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, │ │ │ │ │ +239 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) │ │ │ │ │ +240 { │ │ │ │ │ +241 if(std::is_convertible::value) │ │ │ │ │ +242 return static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ +243 else │ │ │ │ │ +244 return static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ 245 } │ │ │ │ │ 246 │ │ │ │ │ -248 │ │ │ │ │ -_2_5_0 constexpr const _e_x_t_e_n_t_s___t_y_p_e& _e_x_t_e_n_t_s () const noexcept { return │ │ │ │ │ -mapping_.extents(); } │ │ │ │ │ -251 │ │ │ │ │ -_2_5_3 constexpr const _m_a_p_p_i_n_g___t_y_p_e& _m_a_p_p_i_n_g () const noexcept { return mapping_; │ │ │ │ │ -} │ │ │ │ │ -254 │ │ │ │ │ -_2_5_6 constexpr const _a_c_c_e_s_s_o_r___t_y_p_e& _a_c_c_e_s_s_o_r () const noexcept { return │ │ │ │ │ -accessor_; } │ │ │ │ │ -257 │ │ │ │ │ -_2_5_9 constexpr const _d_a_t_a___h_a_n_d_l_e___t_y_p_e& _d_a_t_a___h_a_n_d_l_e () const noexcept { return │ │ │ │ │ -data_handle_; }; │ │ │ │ │ -260 │ │ │ │ │ -261 │ │ │ │ │ -264 │ │ │ │ │ -_2_6_6 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k () noexcept { return extents_type::rank(); │ │ │ │ │ -} │ │ │ │ │ -267 │ │ │ │ │ -_2_6_9 static constexpr _r_a_n_k___t_y_p_e _r_a_n_k___d_y_n_a_m_i_c () noexcept { return extents_type:: │ │ │ │ │ -rank_dynamic(); } │ │ │ │ │ -270 │ │ │ │ │ -_2_7_2 static constexpr std::size_t _s_t_a_t_i_c___e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) noexcept { return │ │ │ │ │ -extents_type::static_extent(r); } │ │ │ │ │ -273 │ │ │ │ │ -_2_7_5 constexpr _i_n_d_e_x___t_y_p_e _e_x_t_e_n_t (_r_a_n_k___t_y_p_e r) const noexcept { return _e_x_t_e_n_t_s │ │ │ │ │ -().extent(r); } │ │ │ │ │ +257 template │ │ │ │ │ +259 inline typename EnableIfInterOperable::type │ │ │ │ │ +_2_6_0 _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, │ │ │ │ │ +261 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) │ │ │ │ │ +262 { │ │ │ │ │ +263 if(std::is_convertible::value) │ │ │ │ │ +264 return !static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ +265 else │ │ │ │ │ +266 return !static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ +267 } │ │ │ │ │ +268 │ │ │ │ │ +273 template │ │ │ │ │ +_2_7_4 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 │ │ │ │ │ +275 { │ │ │ │ │ 276 │ │ │ │ │ -_2_7_8 constexpr _s_i_z_e___t_y_p_e _s_i_z_e () const noexcept │ │ │ │ │ -279 { │ │ │ │ │ -280 _s_i_z_e___t_y_p_e s = 1; │ │ │ │ │ -281 for (_r_a_n_k___t_y_p_e r = 0; r < _r_a_n_k(); ++r) │ │ │ │ │ -282 s *= _e_x_t_e_n_t(r); │ │ │ │ │ -283 return s; │ │ │ │ │ -284 } │ │ │ │ │ -285 │ │ │ │ │ -_2_8_7 [[nodiscard]] constexpr bool _e_m_p_t_y () const noexcept { return _s_i_z_e() == 0; │ │ │ │ │ -} │ │ │ │ │ -288 │ │ │ │ │ -290 │ │ │ │ │ -291 │ │ │ │ │ -_2_9_3 static constexpr bool _i_s___a_l_w_a_y_s___u_n_i_q_u_e () { return mapping_type:: │ │ │ │ │ -is_always_unique(); } │ │ │ │ │ -294 │ │ │ │ │ -_2_9_6 static constexpr bool _i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e () { return mapping_type:: │ │ │ │ │ -is_always_exhaustive(); } │ │ │ │ │ -297 │ │ │ │ │ -_2_9_9 static constexpr bool _i_s___a_l_w_a_y_s___s_t_r_i_d_e_d () { return mapping_type:: │ │ │ │ │ -is_always_strided(); } │ │ │ │ │ -300 │ │ │ │ │ -_3_0_2 constexpr bool _i_s___u_n_i_q_u_e () const { return mapping_.is_unique(); } │ │ │ │ │ -303 │ │ │ │ │ -_3_0_6 constexpr bool _i_s___e_x_h_a_u_s_t_i_v_e () const { return mapping_.is_exhaustive(); } │ │ │ │ │ -307 │ │ │ │ │ -_3_1_3 constexpr bool _i_s___s_t_r_i_d_e_d () const { return mapping_.is_strided(); } │ │ │ │ │ -314 │ │ │ │ │ -_3_1_6 constexpr _i_n_d_e_x___t_y_p_e _s_t_r_i_d_e (_r_a_n_k___t_y_p_e r) const { return mapping_.stride │ │ │ │ │ -(r); } │ │ │ │ │ -317 │ │ │ │ │ -318 │ │ │ │ │ -_3_2_0 friend constexpr void _s_w_a_p (_m_d_s_p_a_n& x, _m_d_s_p_a_n& y) noexcept │ │ │ │ │ -321 { │ │ │ │ │ -322 using std::swap; │ │ │ │ │ -323 _s_w_a_p(x.data_handle_, y.data_handle_); │ │ │ │ │ -324 _s_w_a_p(x.mapping_, y.mapping_); │ │ │ │ │ -325 _s_w_a_p(x.accessor_, y.accessor_); │ │ │ │ │ -326 } │ │ │ │ │ -327 │ │ │ │ │ -328 │ │ │ │ │ -329private: │ │ │ │ │ -330 _d_a_t_a___h_a_n_d_l_e___t_y_p_e data_handle_; │ │ │ │ │ -331 [[no_unique_address]] _m_a_p_p_i_n_g___t_y_p_e mapping_; │ │ │ │ │ -332 [[no_unique_address]] _a_c_c_e_s_s_o_r___t_y_p_e accessor_; │ │ │ │ │ -333}; │ │ │ │ │ -334 │ │ │ │ │ -335// deduction guides │ │ │ │ │ -336// @{ │ │ │ │ │ +277 public: │ │ │ │ │ +278 /* type aliases required by C++ for iterators */ │ │ │ │ │ +_2_7_9 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::bidirectional_iterator_tag; │ │ │ │ │ +_2_8_0 using _v_a_l_u_e___t_y_p_e = typename std::remove_const::type; │ │ │ │ │ +_2_8_1 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = D; │ │ │ │ │ +_2_8_2 using _p_o_i_n_t_e_r = V*; │ │ │ │ │ +_2_8_3 using _r_e_f_e_r_e_n_c_e = R; │ │ │ │ │ +284 │ │ │ │ │ +_3_1_0 typedef T _D_e_r_i_v_e_d_T_y_p_e; │ │ │ │ │ +311 │ │ │ │ │ +_3_1_5 typedef V _V_a_l_u_e; │ │ │ │ │ +316 │ │ │ │ │ +_3_2_0 typedef V* _P_o_i_n_t_e_r; │ │ │ │ │ +321 │ │ │ │ │ +_3_2_5 typedef D _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ +326 │ │ │ │ │ +_3_3_0 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ +331 │ │ │ │ │ +_3_3_3 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ +334 { │ │ │ │ │ +335 return static_cast<_D_e_r_i_v_e_d_T_y_p_e const*>(this)->dereference(); │ │ │ │ │ +336 } │ │ │ │ │ 337 │ │ │ │ │ -338template , int> = 0, │ │ │ │ │ -340 std::enable_if_t<(std::rank_v == 1), int> = 0> │ │ │ │ │ -_3_4_1_m_d_s_p_a_n (CArray&) │ │ │ │ │ -342 -> _m_d_s_p_a_n_<_s_t_d_:_:_r_e_m_o_v_e___a_l_l___e_x_t_e_n_t_s___t_<_C_A_r_r_a_y_>, _S_t_d_:_:_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_, │ │ │ │ │ -_s_t_d_:_:_e_x_t_e_n_t___v_<_C_A_r_r_a_y_,_0_>>>; │ │ │ │ │ -343 │ │ │ │ │ -344template >, int> │ │ │ │ │ -= 0> │ │ │ │ │ -_3_4_6_m_d_s_p_a_n (Pointer&&) │ │ │ │ │ -347 -> _m_d_s_p_a_n_<_s_t_d_:_:_r_e_m_o_v_e___p_o_i_n_t_e_r___t_<_s_t_d_:_:_r_e_m_o_v_e___r_e_f_e_r_e_n_c_e___t_<_P_o_i_n_t_e_r_>>, _S_t_d_:_: │ │ │ │ │ -_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_>>; │ │ │ │ │ -348 │ │ │ │ │ -349template ), int> = 0, │ │ │ │ │ -351 std::enable_if_t<(sizeof...(II) > 0), int> = 0> │ │ │ │ │ -_3_5_2_m_d_s_p_a_n (ElementType*, II...) │ │ │ │ │ -353 -> _m_d_s_p_a_n>; │ │ │ │ │ -354 │ │ │ │ │ -355template │ │ │ │ │ -_3_5_6_m_d_s_p_a_n (ElementType*, _S_t_d_:_:_s_p_a_n_<_S_i_z_e_T_y_p_e_,_N_>&) │ │ │ │ │ -357 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _S_t_d_:_:_d_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_,_ _N_>>; │ │ │ │ │ +_3_3_8 _P_o_i_n_t_e_r _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ +339 { │ │ │ │ │ +340 return &(static_cast(this)->dereference()); │ │ │ │ │ +341 } │ │ │ │ │ +342 │ │ │ │ │ +_3_4_4 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +345 { │ │ │ │ │ +346 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->increment(); │ │ │ │ │ +347 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ +348 } │ │ │ │ │ +349 │ │ │ │ │ +_3_5_1 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_+_+(int) │ │ │ │ │ +352 { │ │ │ │ │ +353 _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)); │ │ │ │ │ +354 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +355 return tmp; │ │ │ │ │ +356 } │ │ │ │ │ +357 │ │ │ │ │ 358 │ │ │ │ │ -359template │ │ │ │ │ -_3_6_0_m_d_s_p_a_n (ElementType*, const std::array&) │ │ │ │ │ -361 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _S_t_d_:_:_d_e_x_t_e_n_t_s_<_s_t_d_:_:_s_i_z_e___t_,_ _N_>>; │ │ │ │ │ -362 │ │ │ │ │ -363template │ │ │ │ │ -_3_6_4_m_d_s_p_a_n (ElementType*, const _S_t_d_:_:_e_x_t_e_n_t_s_<_I_n_d_e_x_T_y_p_e_,_e_x_t_s_._._._>&) │ │ │ │ │ -365 -> _m_d_s_p_a_n>; │ │ │ │ │ -366 │ │ │ │ │ -367template │ │ │ │ │ -_3_7_0_m_d_s_p_a_n (ElementType*, const Mapping&) │ │ │ │ │ -371 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_T_y_p_e_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_>; │ │ │ │ │ -372 │ │ │ │ │ -373template │ │ │ │ │ -_3_7_8_m_d_s_p_a_n (const DataHandle&, const Mapping&, const Accessor&) │ │ │ │ │ -379 -> _m_d_s_p_a_n_<_E_l_e_m_e_n_t_,_ _E_x_t_e_n_t_s_,_ _L_a_y_o_u_t_,_ _A_c_c_e_s_s_o_r_>; │ │ │ │ │ -380 │ │ │ │ │ -381// @} │ │ │ │ │ -382 │ │ │ │ │ -383} // end namespace Dune::Std │ │ │ │ │ -384 │ │ │ │ │ -385#endif // DUNE_COMMON_STD_MDSPAN_HH │ │ │ │ │ -_l_a_y_o_u_t___r_i_g_h_t_._h_h │ │ │ │ │ -_d_e_f_a_u_l_t___a_c_c_e_s_s_o_r_._h_h │ │ │ │ │ -_e_x_t_e_n_t_s_._h_h │ │ │ │ │ -_s_p_a_n_._h_h │ │ │ │ │ -_i_n_d_i_c_e_s_._h_h │ │ │ │ │ -_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:124 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_d_e_x_t_e_n_t_s │ │ │ │ │ -typename Impl::DExtentsImpl< IndexType, std::make_integer_sequence< std:: │ │ │ │ │ -size_t, R > >::type dextents │ │ │ │ │ -Alias of extents of given rank R and purely dynamic extents. See │ │ │ │ │ -[mdspan.extents.dextents]. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:259 │ │ │ │ │ +_3_6_0 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ +361 { │ │ │ │ │ +362 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->decrement(); │ │ │ │ │ +363 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ +364 } │ │ │ │ │ +365 │ │ │ │ │ +_3_6_7 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_-_-(int) │ │ │ │ │ +368 { │ │ │ │ │ +369 _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)); │ │ │ │ │ +370 this->_o_p_e_r_a_t_o_r_-_-(); │ │ │ │ │ +371 return tmp; │ │ │ │ │ +372 } │ │ │ │ │ +373 }; │ │ │ │ │ +374 │ │ │ │ │ +382 template │ │ │ │ │ +384 inline typename std::enable_if::value,bool>:: │ │ │ │ │ +type │ │ │ │ │ +_3_8_5 _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, │ │ │ │ │ +386 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) │ │ │ │ │ +387 { │ │ │ │ │ +388 return static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ +389 } │ │ │ │ │ +390 │ │ │ │ │ +399 template │ │ │ │ │ +401 inline │ │ │ │ │ +402 typename std::enable_if::value && !std:: │ │ │ │ │ +is_convertible::value, │ │ │ │ │ +403 bool>::type │ │ │ │ │ +_4_0_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, │ │ │ │ │ +405 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) │ │ │ │ │ +406 { │ │ │ │ │ +407 return static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ +408 } │ │ │ │ │ +409 │ │ │ │ │ +420 template │ │ │ │ │ +422 inline typename EnableIfInterOperable::type │ │ │ │ │ +_4_2_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, │ │ │ │ │ +424 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) │ │ │ │ │ +425 { │ │ │ │ │ +426 return !(lhs == rhs); │ │ │ │ │ +427 } │ │ │ │ │ +428 │ │ │ │ │ +433 template │ │ │ │ │ +_4_3_4 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 │ │ │ │ │ +435 { │ │ │ │ │ +436 │ │ │ │ │ +437 public: │ │ │ │ │ +438 /* type aliases required by C++ for iterators */ │ │ │ │ │ +_4_3_9 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::random_access_iterator_tag; │ │ │ │ │ +_4_4_0 using _v_a_l_u_e___t_y_p_e = typename std::remove_const::type; │ │ │ │ │ +_4_4_1 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = D; │ │ │ │ │ +_4_4_2 using _p_o_i_n_t_e_r = V*; │ │ │ │ │ +_4_4_3 using _r_e_f_e_r_e_n_c_e = R; │ │ │ │ │ +444 │ │ │ │ │ +_4_7_8 typedef T _D_e_r_i_v_e_d_T_y_p_e; │ │ │ │ │ +479 │ │ │ │ │ +_4_8_3 typedef V _V_a_l_u_e; │ │ │ │ │ +484 │ │ │ │ │ +_4_8_8 typedef V* _P_o_i_n_t_e_r; │ │ │ │ │ +489 │ │ │ │ │ +_4_9_3 typedef D _D_i_f_f_e_r_e_n_c_e_T_y_p_e; │ │ │ │ │ +494 │ │ │ │ │ +_4_9_8 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ +499 │ │ │ │ │ +_5_0_1 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_*() const │ │ │ │ │ +502 { │ │ │ │ │ +503 return static_cast<_D_e_r_i_v_e_d_T_y_p_e const*>(this)->dereference(); │ │ │ │ │ +504 } │ │ │ │ │ +505 │ │ │ │ │ +_5_0_6 _P_o_i_n_t_e_r _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ +507 { │ │ │ │ │ +508 return &(static_cast(this)->dereference()); │ │ │ │ │ +509 } │ │ │ │ │ +510 │ │ │ │ │ +_5_1_6 _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 │ │ │ │ │ +517 { │ │ │ │ │ +518 return static_cast(this)->elementAt(n); │ │ │ │ │ +519 } │ │ │ │ │ +520 │ │ │ │ │ +_5_2_2 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +523 { │ │ │ │ │ +524 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->increment(); │ │ │ │ │ +525 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ +526 } │ │ │ │ │ +527 │ │ │ │ │ +_5_2_9 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_+_+(int) │ │ │ │ │ +530 { │ │ │ │ │ +531 _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)); │ │ │ │ │ +532 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +533 return tmp; │ │ │ │ │ +534 } │ │ │ │ │ +535 │ │ │ │ │ +_5_3_6 _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) │ │ │ │ │ +537 { │ │ │ │ │ +538 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->advance(n); │ │ │ │ │ +539 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ +540 } │ │ │ │ │ +541 │ │ │ │ │ +_5_4_2 _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 │ │ │ │ │ +543 { │ │ │ │ │ +544 _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)); │ │ │ │ │ +545 tmp.advance(n); │ │ │ │ │ +546 return tmp; │ │ │ │ │ +547 } │ │ │ │ │ +548 │ │ │ │ │ +549 │ │ │ │ │ +_5_5_1 _D_e_r_i_v_e_d_T_y_p_e& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ +552 { │ │ │ │ │ +553 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->decrement(); │ │ │ │ │ +554 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ +555 } │ │ │ │ │ +556 │ │ │ │ │ +_5_5_8 _D_e_r_i_v_e_d_T_y_p_e _o_p_e_r_a_t_o_r_-_-(int) │ │ │ │ │ +559 { │ │ │ │ │ +560 _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)); │ │ │ │ │ +561 this->_o_p_e_r_a_t_o_r_-_-(); │ │ │ │ │ +562 return tmp; │ │ │ │ │ +563 } │ │ │ │ │ +564 │ │ │ │ │ +_5_6_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) │ │ │ │ │ +566 { │ │ │ │ │ +567 static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this)->advance(-n); │ │ │ │ │ +568 return *static_cast<_D_e_r_i_v_e_d_T_y_p_e *>(this); │ │ │ │ │ +569 } │ │ │ │ │ +570 │ │ │ │ │ +_5_7_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 │ │ │ │ │ +572 { │ │ │ │ │ +573 _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)); │ │ │ │ │ +574 tmp.advance(-n); │ │ │ │ │ +575 return tmp; │ │ │ │ │ +576 } │ │ │ │ │ +577 │ │ │ │ │ +578 │ │ │ │ │ +579 }; │ │ │ │ │ +580 │ │ │ │ │ +591 template │ │ │ │ │ +593 inline typename EnableIfInterOperable::type │ │ │ │ │ +_5_9_4 _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, │ │ │ │ │ +595 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) │ │ │ │ │ +596 { │ │ │ │ │ +597 if(std::is_convertible::value) │ │ │ │ │ +598 return static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ +599 else │ │ │ │ │ +600 return static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ +601 } │ │ │ │ │ +602 │ │ │ │ │ +613 template │ │ │ │ │ +615 inline typename EnableIfInterOperable::type │ │ │ │ │ +_6_1_6 _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, │ │ │ │ │ +617 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) │ │ │ │ │ +618 { │ │ │ │ │ +619 if(std::is_convertible::value) │ │ │ │ │ +620 return !static_cast(lhs).equals(static_cast(rhs)); │ │ │ │ │ +621 else │ │ │ │ │ +622 return !static_cast(rhs).equals(static_cast(lhs)); │ │ │ │ │ +623 } │ │ │ │ │ +624 │ │ │ │ │ +635 template │ │ │ │ │ +_6_3_7 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 │ │ │ │ │ +638 _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, │ │ │ │ │ +639 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) │ │ │ │ │ +640 { │ │ │ │ │ +641 if(std::is_convertible::value) │ │ │ │ │ +642 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ +(rhs))>0; │ │ │ │ │ +643 else │ │ │ │ │ +644 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ +(lhs))<0; │ │ │ │ │ +645 } │ │ │ │ │ +646 │ │ │ │ │ +647 │ │ │ │ │ +658 template │ │ │ │ │ +_6_6_0 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 │ │ │ │ │ +661 _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, │ │ │ │ │ +662 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) │ │ │ │ │ +663 { │ │ │ │ │ +664 if(std::is_convertible::value) │ │ │ │ │ +665 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ +(rhs))>=0; │ │ │ │ │ +666 else │ │ │ │ │ +667 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ +(lhs))<=0; │ │ │ │ │ +668 } │ │ │ │ │ +669 │ │ │ │ │ +670 │ │ │ │ │ +681 template │ │ │ │ │ +683 inline typename EnableIfInterOperable::type │ │ │ │ │ +_6_8_4 _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, │ │ │ │ │ +685 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) │ │ │ │ │ +686 { │ │ │ │ │ +687 if(std::is_convertible::value) │ │ │ │ │ +688 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ +(rhs))<0; │ │ │ │ │ +689 else │ │ │ │ │ +690 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ +(lhs))>0; │ │ │ │ │ +691 } │ │ │ │ │ +692 │ │ │ │ │ +703 template │ │ │ │ │ +705 inline typename EnableIfInterOperable::type │ │ │ │ │ +_7_0_6 _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, │ │ │ │ │ +707 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) │ │ │ │ │ +708 { │ │ │ │ │ +709 if(std::is_convertible::value) │ │ │ │ │ +710 return static_cast(lhs).distanceTo(static_cast │ │ │ │ │ +(rhs))<=0; │ │ │ │ │ +711 else │ │ │ │ │ +712 return static_cast(rhs).distanceTo(static_cast │ │ │ │ │ +(lhs))>=0; │ │ │ │ │ +713 } │ │ │ │ │ +714 │ │ │ │ │ +725 template │ │ │ │ │ +727 inline typename EnableIfInterOperable::type │ │ │ │ │ +_7_2_8 _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, │ │ │ │ │ +729 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) │ │ │ │ │ +730 { │ │ │ │ │ +731 if(std::is_convertible::value) │ │ │ │ │ +732 return -static_cast(lhs).distanceTo(static_cast │ │ │ │ │ +(rhs)); │ │ │ │ │ +733 else │ │ │ │ │ +734 return static_cast(rhs).distanceTo(static_cast(lhs)); │ │ │ │ │ +735 } │ │ │ │ │ +736 │ │ │ │ │ +737 │ │ │ │ │ +748 template │ │ │ │ │ +_7_4_9 class _P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t │ │ │ │ │ +750 { │ │ │ │ │ +751 public: │ │ │ │ │ +_7_5_2 constexpr _P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t(ProxyType&& p) │ │ │ │ │ +753 noexcept(std::is_nothrow_constructible_v) │ │ │ │ │ +754 : p_(_s_t_d::move(p)) │ │ │ │ │ +755 {} │ │ │ │ │ +756 │ │ │ │ │ +_7_5_7 constexpr _P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t(const ProxyType& p) │ │ │ │ │ +758 noexcept(std::is_nothrow_constructible_v) │ │ │ │ │ +759 : p_(p) │ │ │ │ │ +760 {} │ │ │ │ │ +761 │ │ │ │ │ +_7_6_2 constexpr const ProxyType* _o_p_e_r_a_t_o_r_-_>() const noexcept │ │ │ │ │ +763 { │ │ │ │ │ +764 return &p_; │ │ │ │ │ +765 } │ │ │ │ │ +766 │ │ │ │ │ +_7_6_7 constexpr ProxyType* _o_p_e_r_a_t_o_r_-_>() noexcept │ │ │ │ │ +768 { │ │ │ │ │ +769 return &p_; │ │ │ │ │ +770 } │ │ │ │ │ +771 │ │ │ │ │ +772 private: │ │ │ │ │ +773 ProxyType p_; │ │ │ │ │ +774 }; │ │ │ │ │ +775 │ │ │ │ │ +776 │ │ │ │ │ +_7_8_5 struct _I_t_e_r_a_t_o_r_F_a_c_a_d_e_A_c_c_e_s_s │ │ │ │ │ +786 { │ │ │ │ │ +787 │ │ │ │ │ +789 template │ │ │ │ │ +790 static constexpr auto baseIterator(It&& it) noexcept │ │ │ │ │ +791 -> decltype(it.baseIterator()) │ │ │ │ │ +792 { │ │ │ │ │ +793 return it.baseIterator(); │ │ │ │ │ +794 } │ │ │ │ │ +795 │ │ │ │ │ +797 template │ │ │ │ │ +798 static constexpr auto derived(It&& it) noexcept │ │ │ │ │ +799 -> decltype(it.derived()) │ │ │ │ │ +800 { │ │ │ │ │ +801 return it.derived(); │ │ │ │ │ +802 } │ │ │ │ │ +803 │ │ │ │ │ +804 }; │ │ │ │ │ +805 │ │ │ │ │ +806 │ │ │ │ │ +807 │ │ │ │ │ +808 namespace Impl::Concepts { │ │ │ │ │ +809 │ │ │ │ │ +810 using namespace _D_u_n_e_:_:_C_o_n_c_e_p_t; │ │ │ │ │ +811 │ │ │ │ │ +812 template │ │ │ │ │ +813 struct BaseIterDereferenceOp │ │ │ │ │ +814 { │ │ │ │ │ +815 template │ │ │ │ │ +816 auto require(const It& it) -> decltype( │ │ │ │ │ +817 *(IteratorFacadeAccess::baseIterator(it)), │ │ │ │ │ +818 _r_e_q_u_i_r_e_C_o_n_v_e_r_t_i_b_l_e │ │ │ │ │ +() │ │ │ │ │ +819 ); │ │ │ │ │ +820 }; │ │ │ │ │ +821 │ │ │ │ │ +822 struct IterEqualsOp │ │ │ │ │ +823 { │ │ │ │ │ +824 template │ │ │ │ │ +825 auto require(const It1& it1, const It2& it2) -> decltype( │ │ │ │ │ +826 requireConvertible(it1 == it2) │ │ │ │ │ +827 ); │ │ │ │ │ +828 }; │ │ │ │ │ +829 │ │ │ │ │ +830 struct BaseIterEqualsOp │ │ │ │ │ +831 { │ │ │ │ │ +832 template │ │ │ │ │ +833 auto require(const It1& it1, const It2& it2) -> decltype( │ │ │ │ │ +834 Dune::Concept::requireConvertible(IteratorFacadeAccess::baseIterator │ │ │ │ │ +(it1) == IteratorFacadeAccess::baseIterator(it2)) │ │ │ │ │ +835 ); │ │ │ │ │ +836 }; │ │ │ │ │ +837 │ │ │ │ │ +838 struct BaseIterIncrementOp │ │ │ │ │ +839 { │ │ │ │ │ +840 template │ │ │ │ │ +841 auto require(It it) -> decltype( │ │ │ │ │ +842 ++(IteratorFacadeAccess::baseIterator(it)) │ │ │ │ │ +843 ); │ │ │ │ │ +844 }; │ │ │ │ │ +845 │ │ │ │ │ +846 struct BaseIterDecrementOp │ │ │ │ │ +847 { │ │ │ │ │ +848 template │ │ │ │ │ +849 auto require(It it) -> decltype( │ │ │ │ │ +850 --(IteratorFacadeAccess::baseIterator(it)) │ │ │ │ │ +851 ); │ │ │ │ │ +852 }; │ │ │ │ │ +853 │ │ │ │ │ +854 template │ │ │ │ │ +855 struct IterAdvanceOp │ │ │ │ │ +856 { │ │ │ │ │ +857 template │ │ │ │ │ +858 auto require(It it) -> decltype( │ │ │ │ │ +859 it += std::declval() │ │ │ │ │ +860 ); │ │ │ │ │ +861 }; │ │ │ │ │ +862 │ │ │ │ │ +863 template │ │ │ │ │ +864 struct BaseIterAdvanceOp │ │ │ │ │ +865 { │ │ │ │ │ +866 template │ │ │ │ │ +867 auto require(It it) -> decltype( │ │ │ │ │ +868 IteratorFacadeAccess::baseIterator(it) += std::declval() │ │ │ │ │ +869 ); │ │ │ │ │ +870 }; │ │ │ │ │ +871 │ │ │ │ │ +872 template │ │ │ │ │ +873 struct IterDistanceOp │ │ │ │ │ +874 { │ │ │ │ │ +875 template │ │ │ │ │ +876 auto require(const It1& it1, const It2& it2) -> decltype( │ │ │ │ │ +877 Dune::Concept::requireConvertible(it1 - it2) │ │ │ │ │ +878 ); │ │ │ │ │ +879 }; │ │ │ │ │ +880 │ │ │ │ │ +881 template │ │ │ │ │ +882 struct BaseIterDistanceOp │ │ │ │ │ +883 { │ │ │ │ │ +884 template │ │ │ │ │ +885 auto require(const It1& it1, const It2& it2) -> decltype( │ │ │ │ │ +886 Dune::Concept::requireConvertible(IteratorFacadeAccess::baseIterator │ │ │ │ │ +(it1) - IteratorFacadeAccess::baseIterator(it2)) │ │ │ │ │ +887 ); │ │ │ │ │ +888 }; │ │ │ │ │ +889 │ │ │ │ │ +890 } // namespace Impl::Concept │ │ │ │ │ +891 │ │ │ │ │ +892 │ │ │ │ │ +893 │ │ │ │ │ +1051 template │ │ │ │ │ +_1_0_5_2 class _I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ +1053 { │ │ │ │ │ +1054 static constexpr bool isBidirectional = std::is_convertible_v; │ │ │ │ │ +1055 static constexpr bool isRandomAccess = std::is_convertible_v; │ │ │ │ │ +1056 │ │ │ │ │ +1057 // We make IteratorFacadeAccess a friend to allow forwarding of the │ │ │ │ │ +derived() │ │ │ │ │ +1058 // methods to the free operators instead of havin to do raw casts there. │ │ │ │ │ +1059 // This allows to encapsulate all casts within IteratorFacade itself. │ │ │ │ │ +1060 friend _I_t_e_r_a_t_o_r_F_a_c_a_d_e_A_c_c_e_s_s; │ │ │ │ │ +1061 │ │ │ │ │ +1062 protected: │ │ │ │ │ +1063 │ │ │ │ │ +_1_0_6_5 using _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r = It; │ │ │ │ │ +1066 │ │ │ │ │ +_1_0_6_8 constexpr const _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r& _d_e_r_i_v_e_d() const │ │ │ │ │ +1069 { │ │ │ │ │ +1070 return static_cast(*this); │ │ │ │ │ +1071 } │ │ │ │ │ +1072 │ │ │ │ │ +_1_0_7_4 constexpr _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r& _d_e_r_i_v_e_d() │ │ │ │ │ +1075 { │ │ │ │ │ +1076 return static_cast<_D_e_r_i_v_e_d_I_t_e_r_a_t_o_r&>(*this); │ │ │ │ │ +1077 } │ │ │ │ │ +1078 │ │ │ │ │ +1079 public: │ │ │ │ │ +1080 │ │ │ │ │ +1081 // Standard types of of C++ iterators │ │ │ │ │ +_1_0_8_2 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = C; │ │ │ │ │ +_1_0_8_3 using _v_a_l_u_e___t_y_p_e = typename std::remove_const::type; │ │ │ │ │ +_1_0_8_4 using _r_e_f_e_r_e_n_c_e = R; │ │ │ │ │ +_1_0_8_5 using _p_o_i_n_t_e_r = P; │ │ │ │ │ +_1_0_8_6 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = D; │ │ │ │ │ +1087 │ │ │ │ │ +1088 // Corresponding Dune typedefs │ │ │ │ │ +_1_0_8_9 using _V_a_l_u_e = _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_1_0_9_0 using _R_e_f_e_r_e_n_c_e = _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_1_0_9_1 using _P_o_i_n_t_e_r = _p_o_i_n_t_e_r; │ │ │ │ │ +_1_0_9_2 using _D_i_f_f_e_r_e_n_c_e_T_y_p_e = _d_i_f_f_e_r_e_n_c_e___t_y_p_e; │ │ │ │ │ +1093 │ │ │ │ │ +1094 // Only defined to do static assertions. │ │ │ │ │ +_1_0_9_5 _I_t_e_r_a_t_o_r_F_a_c_a_d_e() │ │ │ │ │ +1096 { │ │ │ │ │ +1097 static_assert(std::is_signed_v, │ │ │ │ │ +1098 "Type used as difference_type must be signed"); │ │ │ │ │ +1099 const _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r& constDerived = _d_e_r_i_v_e_d(); │ │ │ │ │ +1100 static_assert(std::is_convertible_v, │ │ │ │ │ +1101 "Derived class does not implement `*it` or `*(it.baseIterator())` for │ │ │ │ │ +const `it` required by IteratorFacade<..., std::forward_iterator_tag, ...>."); │ │ │ │ │ +1102 static_assert(std::is_convertible_v, │ │ │ │ │ +1103 "Derived class does not implement `++it`, `++(it.baseIterator())`, or │ │ │ │ │ +`it+=1` for mutable `it` required by IteratorFacade<..., std:: │ │ │ │ │ +forward_iterator_tag, ...>."); │ │ │ │ │ +1104 static_assert(std::is_convertible_v, │ │ │ │ │ +1105 "Derived class does not implement `it1==it2` or `it1.baseIterator │ │ │ │ │ +()==it2.baseIterator()` for const `it1` and `it2` required by │ │ │ │ │ +IteratorFacade<..., std::forward_iterator_tag, ...>."); │ │ │ │ │ +1106 if constexpr (isBidirectional) │ │ │ │ │ +1107 static_assert(std::is_convertible_v, │ │ │ │ │ +1108 "Derived class does not implement `--it`, `--(it.baseIterator())`, or `it- │ │ │ │ │ +=1` for mutable `it` required by IteratorFacade<..., std:: │ │ │ │ │ +bidirectional_iterator_tag, ...>."); │ │ │ │ │ +1109 if constexpr (isRandomAccess) │ │ │ │ │ +1110 { │ │ │ │ │ +1111 static_assert(std::is_convertible_v()), _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r&>, │ │ │ │ │ +1112 "Derived class does not implement `it+=` or `it.baseIterator()+=` for │ │ │ │ │ +mutable `it` required by IteratorFacade<..., std::random_access_iterator_tag, │ │ │ │ │ +...>."); │ │ │ │ │ +1113 static_assert(std::is_convertible_v, │ │ │ │ │ +1114 "Derived class does not implement `it1-it2` or `it1.baseIterator()- │ │ │ │ │ +it2.baseIterator()` for const `it1` and `it2` required by IteratorFacade<..., │ │ │ │ │ +std::random_access_iterator_tag, ...>."); │ │ │ │ │ +1115 } │ │ │ │ │ +1116 } │ │ │ │ │ +1117 │ │ │ │ │ +_1_1_1_9 constexpr decltype(auto) operator*() const │ │ │ │ │ +1120 { │ │ │ │ │ +1121 if constexpr (Dune::models, _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r>()) │ │ │ │ │ +1122 return *(IteratorFacadeAccess::baseIterator(_d_e_r_i_v_e_d())); │ │ │ │ │ +1123 else │ │ │ │ │ +1124 static_assert(_A_l_w_a_y_s_F_a_l_s_e_<_I_t_>_:_:_v_a_l_u_e, │ │ │ │ │ +1125 "Derived class does not implement `*it` or `*(it.baseIterator())` for │ │ │ │ │ +const `it` required by IteratorFacade<..., std::forward_iterator_tag, ...>."); │ │ │ │ │ +1126 } │ │ │ │ │ +1127 │ │ │ │ │ +_1_1_2_9 constexpr _p_o_i_n_t_e_r _o_p_e_r_a_t_o_r_-_>() const │ │ │ │ │ +1130 { │ │ │ │ │ +1131 if constexpr (std::is_pointer_v) │ │ │ │ │ +1132 return std::addressof(*_d_e_r_i_v_e_d()); │ │ │ │ │ +1133 else │ │ │ │ │ +1134 return _p_o_i_n_t_e_r(*_d_e_r_i_v_e_d()); │ │ │ │ │ +1135 } │ │ │ │ │ +1136 │ │ │ │ │ +_1_1_3_8 constexpr decltype(auto) operator++() │ │ │ │ │ +1139 { │ │ │ │ │ +1140 if constexpr (Dune::models()) │ │ │ │ │ +1141 { │ │ │ │ │ +1142 ++(IteratorFacadeAccess::baseIterator(_d_e_r_i_v_e_d())); │ │ │ │ │ +1143 return _d_e_r_i_v_e_d(); │ │ │ │ │ +1144 } │ │ │ │ │ +1145 else if constexpr (Dune::models, _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r>()) │ │ │ │ │ +1146 { │ │ │ │ │ +1147 _d_e_r_i_v_e_d() += 1; │ │ │ │ │ +1148 return _d_e_r_i_v_e_d(); │ │ │ │ │ +1149 } │ │ │ │ │ +1150 else │ │ │ │ │ +1151 static_assert(_A_l_w_a_y_s_F_a_l_s_e_<_I_t_>_:_:_v_a_l_u_e, │ │ │ │ │ +1152 "Derived class does not implement `++it`, `++(it.baseIterator())`, or │ │ │ │ │ +`it+=1` for mutable `it` required by IteratorFacade<..., std:: │ │ │ │ │ +forward_iterator_tag, ...>."); │ │ │ │ │ +1153 } │ │ │ │ │ +1154 │ │ │ │ │ +_1_1_5_6 constexpr _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_+_+(int) │ │ │ │ │ +1157 { │ │ │ │ │ +1158 _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r tmp(_d_e_r_i_v_e_d()); │ │ │ │ │ +1159 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +1160 return tmp; │ │ │ │ │ +1161 } │ │ │ │ │ +1162 │ │ │ │ │ +1168 template │ │ │ │ │ +=0> │ │ │ │ │ +_1_1_6_9 constexpr decltype(auto) operator--() │ │ │ │ │ +1170 { │ │ │ │ │ +1171 if constexpr (Dune::models()) │ │ │ │ │ +1172 { │ │ │ │ │ +1173 --(IteratorFacadeAccess::baseIterator(_d_e_r_i_v_e_d())); │ │ │ │ │ +1174 return _d_e_r_i_v_e_d(); │ │ │ │ │ +1175 } │ │ │ │ │ +1176 else if constexpr (Dune::models, _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r>()) │ │ │ │ │ +1177 { │ │ │ │ │ +1178 _d_e_r_i_v_e_d() -= 1; │ │ │ │ │ +1179 return _d_e_r_i_v_e_d(); │ │ │ │ │ +1180 } │ │ │ │ │ +1181 else │ │ │ │ │ +1182 static_assert(_A_l_w_a_y_s_F_a_l_s_e_<_I_t_>_:_:_v_a_l_u_e, │ │ │ │ │ +1183 "Derived class does not implement `--it`, `--(it.baseIterator())`, or `it- │ │ │ │ │ +=1` for mutable `it` required by IteratorFacade<..., std:: │ │ │ │ │ +bidirectional_iterator_tag, ...>."); │ │ │ │ │ +1184 } │ │ │ │ │ +1185 │ │ │ │ │ +1191 template │ │ │ │ │ +=0> │ │ │ │ │ +_1_1_9_2 constexpr _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_-_-(int) │ │ │ │ │ +1193 { │ │ │ │ │ +1194 _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r tmp(_d_e_r_i_v_e_d()); │ │ │ │ │ +1195 this->_o_p_e_r_a_t_o_r_-_-(); │ │ │ │ │ +1196 return tmp; │ │ │ │ │ +1197 } │ │ │ │ │ +1198 │ │ │ │ │ +1206 template │ │ │ │ │ +=0> │ │ │ │ │ +_1_2_0_7 constexpr _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 │ │ │ │ │ +1208 { │ │ │ │ │ +1209 return *(_d_e_r_i_v_e_d()+n); │ │ │ │ │ +1210 } │ │ │ │ │ +1211 │ │ │ │ │ +1217 template │ │ │ │ │ +=0> │ │ │ │ │ +_1_2_1_8 constexpr decltype(auto) operator+=(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n) │ │ │ │ │ +1219 { │ │ │ │ │ +1220 if constexpr (Dune::models, _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r>()) │ │ │ │ │ +1221 { │ │ │ │ │ +1222 IteratorFacadeAccess::baseIterator(_d_e_r_i_v_e_d()) += n; │ │ │ │ │ +1223 return _d_e_r_i_v_e_d(); │ │ │ │ │ +1224 } │ │ │ │ │ +1225 else │ │ │ │ │ +1226 static_assert(_A_l_w_a_y_s_F_a_l_s_e_<_I_t_>_:_:_v_a_l_u_e, │ │ │ │ │ +1227 "Derived class does not implement `it+=` or `it.baseIterator()+=` for │ │ │ │ │ +mutable `it` required by IteratorFacade<..., std::random_access_iterator_tag, │ │ │ │ │ +...>."); │ │ │ │ │ +1228 } │ │ │ │ │ +1229 │ │ │ │ │ +1235 template │ │ │ │ │ +=0> │ │ │ │ │ +_1_2_3_6 constexpr _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_+(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n) const │ │ │ │ │ +1237 { │ │ │ │ │ +1238 _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r tmp(_d_e_r_i_v_e_d()); │ │ │ │ │ +1239 tmp += n; │ │ │ │ │ +1240 return tmp; │ │ │ │ │ +1241 } │ │ │ │ │ +1242 │ │ │ │ │ +1248 template │ │ │ │ │ +=0> │ │ │ │ │ +_1_2_4_9 constexpr _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_-_=(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n) │ │ │ │ │ +1250 { │ │ │ │ │ +1251 _d_e_r_i_v_e_d() += (-n); │ │ │ │ │ +1252 return _d_e_r_i_v_e_d(); │ │ │ │ │ +1253 } │ │ │ │ │ +1254 │ │ │ │ │ +1260 template │ │ │ │ │ +=0> │ │ │ │ │ +_1_2_6_1 constexpr _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_-(_d_i_f_f_e_r_e_n_c_e___t_y_p_e n) const │ │ │ │ │ +1262 { │ │ │ │ │ +1263 _D_e_r_i_v_e_d_I_t_e_r_a_t_o_r tmp(_d_e_r_i_v_e_d()); │ │ │ │ │ +1264 tmp -= n; │ │ │ │ │ +1265 return tmp; │ │ │ │ │ +1266 } │ │ │ │ │ +1267 │ │ │ │ │ +1268 }; │ │ │ │ │ +1269 │ │ │ │ │ +1270 │ │ │ │ │ +1271 │ │ │ │ │ +1282 template │ │ │ │ │ +_1_2_8_3 constexpr auto _o_p_e_r_a_t_o_r_=_=(const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_C_,_V_1_,_R_1_,_P_1_,_D_1_>& it1, │ │ │ │ │ +const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_C_,_V_2_,_R_2_,_P_2_,_D_2_>& it2) │ │ │ │ │ +1284 { │ │ │ │ │ +1285 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1); │ │ │ │ │ +1286 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2); │ │ │ │ │ +1287 if constexpr (Dune::models()) │ │ │ │ │ +1288 return IteratorFacadeAccess::baseIterator(derivedIt1) == │ │ │ │ │ +IteratorFacadeAccess::baseIterator(derivedIt2); │ │ │ │ │ +1289 else │ │ │ │ │ +1290 static_assert(_A_l_w_a_y_s_F_a_l_s_e_<_T_1_>_:_:_v_a_l_u_e, │ │ │ │ │ +1291 "Derived class does not implement `it1==it2` or `it1.baseIterator │ │ │ │ │ +()==it2.baseIterator()` for const `it1` and `it2` required by │ │ │ │ │ +IteratorFacade<..., std::forward_iterator_tag, ...>."); │ │ │ │ │ +1292 } │ │ │ │ │ +1293 │ │ │ │ │ +1301 template() , │ │ │ │ │ +int> =0> │ │ │ │ │ +_1_3_0_3 constexpr bool _o_p_e_r_a_t_o_r_!_=(const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_C_,_V_1_,_R_1_,_P_1_,_D_1_>& it1, │ │ │ │ │ +const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_C_,_V_2_,_R_2_,_P_2_,_D_2_>& it2) │ │ │ │ │ +1304 { │ │ │ │ │ +1305 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1); │ │ │ │ │ +1306 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2); │ │ │ │ │ +1307 return not(derivedIt1 == derivedIt2); │ │ │ │ │ +1308 } │ │ │ │ │ +1309 │ │ │ │ │ +1320 template │ │ │ │ │ +_1_3_2_1 constexpr auto _o_p_e_r_a_t_o_r_-(const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_C_,_V_1_,_R_1_,_P_1_,_D_>& it1, const │ │ │ │ │ +_I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_C_,_V_2_,_R_2_,_P_2_,_D_>& it2) │ │ │ │ │ +1322 { │ │ │ │ │ +1323 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1); │ │ │ │ │ +1324 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2); │ │ │ │ │ +1325 if constexpr (Dune::models,T1, T2> │ │ │ │ │ +()) │ │ │ │ │ +1326 return D(IteratorFacadeAccess::baseIterator(derivedIt1) - │ │ │ │ │ +IteratorFacadeAccess::baseIterator(derivedIt2)); │ │ │ │ │ +1327 else │ │ │ │ │ +1328 static_assert(_A_l_w_a_y_s_F_a_l_s_e_<_T_1_>_:_:_v_a_l_u_e, │ │ │ │ │ +1329 "Derived class does not implement `it1-it2` or `it1.baseIterator()- │ │ │ │ │ +it2.baseIterator()` for const `it1` and `it2` required by IteratorFacade<..., │ │ │ │ │ +std::random_access_iterator_tag, ...>."); │ │ │ │ │ +1330 } │ │ │ │ │ +1331 │ │ │ │ │ +1339 template,T1, T2> │ │ │ │ │ +() , int> =0> │ │ │ │ │ +_1_3_4_1 constexpr bool operator<(const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_C_,_V_1_,_R_1_,_P_1_,_D_1_>& it1, │ │ │ │ │ +const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_C_,_V_2_,_R_2_,_P_2_,_D_2_>& it2) │ │ │ │ │ +1342 { │ │ │ │ │ +1343 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1); │ │ │ │ │ +1344 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2); │ │ │ │ │ +1345 return (derivedIt1 - derivedIt2) < D1(0); │ │ │ │ │ +1346 } │ │ │ │ │ +1347 │ │ │ │ │ +1355 template,T1, T2> │ │ │ │ │ +() , int> =0> │ │ │ │ │ +_1_3_5_7 constexpr bool operator<=(const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_C_,_V_1_,_R_1_,_P_1_,_D_1_>& it1, │ │ │ │ │ +const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_C_,_V_2_,_R_2_,_P_2_,_D_2_>& it2) │ │ │ │ │ +1358 { │ │ │ │ │ +1359 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1); │ │ │ │ │ +1360 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2); │ │ │ │ │ +1361 return (derivedIt1 - derivedIt2) <= D1(0); │ │ │ │ │ +1362 } │ │ │ │ │ +1363 │ │ │ │ │ +1371 template,T1, T2> │ │ │ │ │ +() , int> =0> │ │ │ │ │ +_1_3_7_3 constexpr bool operator>(const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_C_,_V_1_,_R_1_,_P_1_,_D_1_>& it1, │ │ │ │ │ +const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_C_,_V_2_,_R_2_,_P_2_,_D_2_>& it2) │ │ │ │ │ +1374 { │ │ │ │ │ +1375 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1); │ │ │ │ │ +1376 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2); │ │ │ │ │ +1377 return (derivedIt1 - derivedIt2) > D1(0); │ │ │ │ │ +1378 } │ │ │ │ │ +1379 │ │ │ │ │ +1387 template,T1, T2> │ │ │ │ │ +() , int> =0> │ │ │ │ │ +_1_3_8_9 constexpr bool operator>=(const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_1_,_C_,_V_1_,_R_1_,_P_1_,_D_1_>& it1, │ │ │ │ │ +const _I_t_e_r_a_t_o_r_F_a_c_a_d_e_<_T_2_,_C_,_V_2_,_R_2_,_P_2_,_D_2_>& it2) │ │ │ │ │ +1390 { │ │ │ │ │ +1391 const T1& derivedIt1 = IteratorFacadeAccess::derived(it1); │ │ │ │ │ +1392 const T2& derivedIt2 = IteratorFacadeAccess::derived(it2); │ │ │ │ │ +1393 return (derivedIt1 - derivedIt2) >= D1(0); │ │ │ │ │ +1394 } │ │ │ │ │ +1395 │ │ │ │ │ +1396 │ │ │ │ │ +1397 │ │ │ │ │ +1399} │ │ │ │ │ +1400#endif │ │ │ │ │ +_c_o_n_c_e_p_t_._h_h │ │ │ │ │ +Infrastructure for concepts. │ │ │ │ │ +_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:638 │ │ │ │ │ +_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:684 │ │ │ │ │ +_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:661 │ │ │ │ │ +_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:238 │ │ │ │ │ +_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:706 │ │ │ │ │ +_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:260 │ │ │ │ │ _s_t_d │ │ │ │ │ STL namespace. │ │ │ │ │ -_D_u_n_e_:_:_S_t_d │ │ │ │ │ -Namespace for features backported from new C++ standards. │ │ │ │ │ -DDeeffiinniittiioonn default_accessor.hh:10 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_e_x_t_e_n_t_s │ │ │ │ │ -Multidimensional index space with dynamic and static extents. │ │ │ │ │ -DDeeffiinniittiioonn extents.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n │ │ │ │ │ -A multi-dimensional non-owning array view. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -typename accessor_type::reference reference │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_l_e_m_e_n_t___t_y_p_e │ │ │ │ │ -Element element_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ -constexpr mdspan(data_handle_type p, const mapping_type &m, const accessor_type │ │ │ │ │ -&a) │ │ │ │ │ -Construct from the pointer to the data of the tensor, an index mapping, and an │ │ │ │ │ -accessor. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:161 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t_s___t_y_p_e │ │ │ │ │ -Extents extents_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_a_n_k___d_y_n_a_m_i_c │ │ │ │ │ -static constexpr rank_type rank_dynamic() noexcept │ │ │ │ │ -Number of dimensions of the tensor. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:269 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___a_l_w_a_y_s___u_n_i_q_u_e │ │ │ │ │ -static constexpr bool is_always_unique() │ │ │ │ │ -Return true only if for every i and j where (i != j || ...) => mapping(i...) != │ │ │ │ │ -mapping(j.... │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_n_d_e_x___t_y_p_e │ │ │ │ │ -typename extents_type::index_type index_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_l_a_y_o_u_t___t_y_p_e │ │ │ │ │ -LayoutPolicy layout_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___s_t_r_i_d_e_d │ │ │ │ │ -constexpr bool is_strided() const │ │ │ │ │ -Return true only if for every rank index r of extents there exists an integer │ │ │ │ │ -sr such that,... │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:313 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ -constexpr mdspan(data_handle_type p, const mapping_type &m) │ │ │ │ │ -Construct from the pointer to the data of the tensor and an index mapping. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:156 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_a_n_k___t_y_p_e │ │ │ │ │ -typename extents_type::rank_type rank_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ -constexpr mdspan(data_handle_type p, const extents_type &e) │ │ │ │ │ -Construct from the pointer to the data of the tensor and its extents. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -std::remove_cv_t< Element > value_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___a_l_w_a_y_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -static constexpr bool is_always_exhaustive() │ │ │ │ │ -Return true only if for all k in the range [0, mapping.required_span_size() ) │ │ │ │ │ -there exists an i such ... │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:296 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -constexpr reference operator[](Index index) const │ │ │ │ │ -Access specified element at position [i0] For a rank one mdspan, the operator │ │ │ │ │ -[i] is added to support ... │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:219 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t_s │ │ │ │ │ -constexpr const extents_type & extents() const noexcept │ │ │ │ │ -Number of elements in all dimensions of the tensor,. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:250 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_x_t_e_n_t │ │ │ │ │ -constexpr index_type extent(rank_type r) const noexcept │ │ │ │ │ -Number of elements in the r'th dimension of the tensor. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_w_a_p │ │ │ │ │ -friend constexpr void swap(mdspan &x, mdspan &y) noexcept │ │ │ │ │ -Overloads the std::swap algorithm for std::mdspan. Exchanges the state of x │ │ │ │ │ -with that of y. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:320 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___a_l_w_a_y_s___s_t_r_i_d_e_d │ │ │ │ │ -static constexpr bool is_always_strided() │ │ │ │ │ -Return true only if for every rank index r of extents there exists an integer │ │ │ │ │ -sr such that,... │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_i_z_e │ │ │ │ │ -constexpr size_type size() const noexcept │ │ │ │ │ -The number of elements accessible by this multi-dimensional span. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_d_a_t_a___h_a_n_d_l_e___t_y_p_e │ │ │ │ │ -typename accessor_type::data_handle_type data_handle_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_e_m_p_t_y │ │ │ │ │ -constexpr bool empty() const noexcept │ │ │ │ │ -Checks if the size of the index space is zero. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:287 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_a_c_c_e_s_s_o_r │ │ │ │ │ -constexpr const accessor_type & accessor() const noexcept │ │ │ │ │ -The accessor policy object. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:256 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_a_c_c_e_s_s_o_r___t_y_p_e │ │ │ │ │ -AccessorPolicy accessor_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___e_x_h_a_u_s_t_i_v_e │ │ │ │ │ -constexpr bool is_exhaustive() const │ │ │ │ │ -Return true only if for all k in the range [0, mapping.required_span_size() ) │ │ │ │ │ -there exists an i such ... │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:306 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_r_a_n_k │ │ │ │ │ -static constexpr rank_type rank() noexcept │ │ │ │ │ -Number of dimensions of the tensor. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:266 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_t_a_t_i_c___e_x_t_e_n_t │ │ │ │ │ -static constexpr std::size_t static_extent(rank_type r) noexcept │ │ │ │ │ -Number of elements in the r'th dimension of the tensor. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_a_p_p_i_n_g │ │ │ │ │ -constexpr const mapping_type & mapping() const noexcept │ │ │ │ │ -Index mapping of a layout policy. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:253 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_d_a_t_a___h_a_n_d_l_e │ │ │ │ │ -constexpr const data_handle_type & data_handle() const noexcept │ │ │ │ │ -The pointer to the underlying flat sequence. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_t_r_i_d_e │ │ │ │ │ -constexpr index_type stride(rank_type r) const │ │ │ │ │ -The stride along the specified dimension. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:316 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_i_s___u_n_i_q_u_e │ │ │ │ │ -constexpr bool is_unique() const │ │ │ │ │ -Return true only if for every i and j where (i != j || ...) => mapping(i...) != │ │ │ │ │ -mapping(j.... │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:302 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_d_s_p_a_n │ │ │ │ │ -constexpr mdspan() │ │ │ │ │ -Default constructor value-initializes all members. │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:105 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -typename extents_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:79 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_m_d_s_p_a_n_:_:_m_a_p_p_i_n_g___t_y_p_e │ │ │ │ │ -typename layout_type::template mapping< extents_type > mapping_type │ │ │ │ │ -DDeeffiinniittiioonn mdspan.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_S_t_d_:_:_s_p_a_n │ │ │ │ │ -A contiguous sequence of elements with static or dynamic extent. │ │ │ │ │ -DDeeffiinniittiioonn span.hh:126 │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +Dune namespace. │ │ │ │ │ +DDeeffiinniittiioonn alignedallocator.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_C_o_n_c_e_p_t │ │ │ │ │ +Namespace for concepts. │ │ │ │ │ +DDeeffiinniittiioonn concept.hh:34 │ │ │ │ │ +_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:247 │ │ │ │ │ +_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:142 │ │ │ │ │ +_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: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_:_:_p_o_i_n_t_e_r │ │ │ │ │ +V * pointer │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:149 │ │ │ │ │ +_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:210 │ │ │ │ │ +_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:191 │ │ │ │ │ +_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:196 │ │ │ │ │ +_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:204 │ │ │ │ │ +_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:176 │ │ │ │ │ +_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:181 │ │ │ │ │ +_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: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_+_+ │ │ │ │ │ +DerivedType operator++(int) │ │ │ │ │ +Postincrement operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:217 │ │ │ │ │ +_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:186 │ │ │ │ │ +_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: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_* │ │ │ │ │ +Reference operator*() const │ │ │ │ │ +Dereferencing operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:199 │ │ │ │ │ +_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:150 │ │ │ │ │ +_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:275 │ │ │ │ │ +_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: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___t_y_p_e │ │ │ │ │ +typename std::remove_const< V >::type value_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_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +Reference operator*() const │ │ │ │ │ +Dereferencing operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:333 │ │ │ │ │ +_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: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_:_:_D_e_r_i_v_e_d_T_y_p_e │ │ │ │ │ +T DerivedType │ │ │ │ │ +The type of derived iterator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:310 │ │ │ │ │ +_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:360 │ │ │ │ │ +_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:338 │ │ │ │ │ +_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:344 │ │ │ │ │ +_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:320 │ │ │ │ │ +_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:330 │ │ │ │ │ +_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:351 │ │ │ │ │ +_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: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_:_:_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:325 │ │ │ │ │ +_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:367 │ │ │ │ │ +_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:283 │ │ │ │ │ +_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:315 │ │ │ │ │ +_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:435 │ │ │ │ │ +_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: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_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ │ +D difference_type │ │ │ │ │ +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_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ +DerivedType operator--(int) │ │ │ │ │ +Postdecrement operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:558 │ │ │ │ │ +_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: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_:_:_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: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_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +Reference operator*() const │ │ │ │ │ +Dereferencing operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:501 │ │ │ │ │ +_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:522 │ │ │ │ │ +_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:443 │ │ │ │ │ +_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:506 │ │ │ │ │ +_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:493 │ │ │ │ │ +_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:551 │ │ │ │ │ +_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:565 │ │ │ │ │ +_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:542 │ │ │ │ │ +_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:516 │ │ │ │ │ +_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:478 │ │ │ │ │ +_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:488 │ │ │ │ │ +_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:571 │ │ │ │ │ +_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:529 │ │ │ │ │ +_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:483 │ │ │ │ │ +_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:536 │ │ │ │ │ +_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:498 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t │ │ │ │ │ +Helper to mimic a pointer for proxy objects. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:750 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t │ │ │ │ │ +constexpr ProxyArrowResult(const ProxyType &p) noexcept(std:: │ │ │ │ │ +is_nothrow_constructible_v< ProxyType, const ProxyType & >) │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:757 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ +constexpr ProxyType * operator->() noexcept │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:767 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ +constexpr const ProxyType * operator->() const noexcept │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:762 │ │ │ │ │ +_D_u_n_e_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t_:_:_P_r_o_x_y_A_r_r_o_w_R_e_s_u_l_t │ │ │ │ │ +constexpr ProxyArrowResult(ProxyType &&p) noexcept(std:: │ │ │ │ │ +is_nothrow_constructible_v< ProxyType, ProxyType && >) │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:752 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_A_c_c_e_s_s │ │ │ │ │ +This class encapsulates access of IteratorFacade. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:786 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ +CRTP-Mixing class for stl conformant iterators of given iterator category. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1053 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ +constexpr DerivedIterator operator--(int) │ │ │ │ │ +Postdecrement operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1192 │ │ │ │ │ +_D_u_n_e_:_:_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:1086 │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ +C iterator_category │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1082 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e │ │ │ │ │ +IteratorFacade() │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1095 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ +constexpr pointer operator->() const │ │ │ │ │ +Arrow access to members of referenced value. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1129 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_P_o_i_n_t_e_r │ │ │ │ │ +pointer Pointer │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1091 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ +reference Reference │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1090 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+ │ │ │ │ │ +constexpr DerivedIterator operator+(difference_type n) const │ │ │ │ │ +Create iterator incremented by given value. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1236 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +constexpr DerivedIterator operator++(int) │ │ │ │ │ +Postincrement operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1156 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_d_e_r_i_v_e_d │ │ │ │ │ +constexpr DerivedIterator & derived() │ │ │ │ │ +Cast of *this to DerivedIterator type. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1074 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_D_e_r_i_v_e_d_I_t_e_r_a_t_o_r │ │ │ │ │ +It DerivedIterator │ │ │ │ │ +The derived iterator type. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1065 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ +constexpr DerivedIterator & operator-=(difference_type n) │ │ │ │ │ +Decrement iterator by given value. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1249 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ +constexpr decltype(auto) operator--() │ │ │ │ │ +Predecrement operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1169 │ │ │ │ │ +_D_u_n_e_:_:_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:1084 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +constexpr reference operator[](difference_type n) const │ │ │ │ │ +Dereference element with given offset form this iterator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1207 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_d_e_r_i_v_e_d │ │ │ │ │ +constexpr const DerivedIterator & derived() const │ │ │ │ │ +Cast of *this to const DerivedIterator type. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1068 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_p_o_i_n_t_e_r │ │ │ │ │ +P pointer │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1085 │ │ │ │ │ +_D_u_n_e_:_:_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:1083 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_V_a_l_u_e │ │ │ │ │ +value_type Value │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1089 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +constexpr decltype(auto) operator++() │ │ │ │ │ +Preincrement operator. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1138 │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ +difference_type DifferenceType │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1092 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_F_a_c_a_d_e_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +constexpr DerivedIterator operator-(difference_type n) const │ │ │ │ │ +Create iterator decremented by given value. │ │ │ │ │ +DDeeffiinniittiioonn iteratorfacades.hh:1261 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: functional.hh File Reference │ │ │ │ +dune-common: typetraits.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,44 +65,144 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
functional.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Typedefs | │ │ │ │ +Functions
│ │ │ │ +
typetraits.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <functional>
│ │ │ │ -#include <dune-common-config.hh>
│ │ │ │ + │ │ │ │ +

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

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

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Std::identity
 A function object type whose operator() returns its argument unchanged. More...
struct  Dune::Empty
 Just an empty class. More...
 
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::IsCompileTimeConstant< T >
 Check if T is an integral constant or any type derived from std::integral_constant. 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...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +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
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,26 +1,125 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -functional.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +typetraits.hh File Reference │ │ │ │ │ +Traits for type conversions and type information. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_d_:_:_i_d_e_n_t_i_t_y │ │ │ │ │ -  A function object type whose operator() returns its argument │ │ │ │ │ - unchanged. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_E_m_p_t_y │ │ │ │ │ +  Just an empty class. _M_o_r_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_:_:_I_s_C_o_m_p_i_l_e_T_i_m_e_C_o_n_s_t_a_n_t_<_ _T_ _> │ │ │ │ │ +  Check if T is an integral constant or any type derived from 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_._._. │ │ │ │ │   │ │ │ │ │ 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_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: functional.hh Source File │ │ │ │ +dune-common: typetraits.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,56 +70,443 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
functional.hh
│ │ │ │ +
typetraits.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 © 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_TYPETRAITS_HH
│ │ │ │ +
6#define DUNE_TYPETRAITS_HH
│ │ │ │
7
│ │ │ │ -
8#include <functional>
│ │ │ │ -
9
│ │ │ │ -
10#include <dune-common-config.hh> // DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ -
11
│ │ │ │ -
12namespace Dune
│ │ │ │ -
13{
│ │ │ │ -
14
│ │ │ │ -
15 namespace Std
│ │ │ │ -
16 {
│ │ │ │ -
17
│ │ │ │ -
24#if DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ -
25 using std::identity;
│ │ │ │ -
26#else //DUNE_HAVE_CXX_STD_IDENTITY
│ │ │ │ -
│ │ │ │ -
27 struct identity {
│ │ │ │ -
28 template<class T>
│ │ │ │ -
29 constexpr T&& operator()(T&& t ) const noexcept {return std::forward<T>(t);}
│ │ │ │ -
30 };
│ │ │ │ -
│ │ │ │ -
31#endif
│ │ │ │ -
32 } // namespace Std
│ │ │ │ -
33
│ │ │ │ -
34} // namespace Dune
│ │ │ │ -
35
│ │ │ │ -
36#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
│ │ │ │ +
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
│ │ │ │ +
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#ifndef DOXYGEN
│ │ │ │ +
388
│ │ │ │ +
389 namespace Impl {
│ │ │ │ +
390
│ │ │ │ + │ │ │ │ +
392 {
│ │ │ │ +
393 template <class T, T value>
│ │ │ │ +
394 static std::true_type check(std::integral_constant<T,value>);
│ │ │ │ +
395 static std::false_type check(...);
│ │ │ │ +
396 };
│ │ │ │ +
397
│ │ │ │ +
398 } // namespace Impl
│ │ │ │ +
399
│ │ │ │ +
400#endif // DOXYGEN
│ │ │ │ +
401
│ │ │ │ +
408 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
410 : public decltype(Impl::IsCompileTimeConstant::check(std::declval<T>()))
│ │ │ │ +
411 {};
│ │ │ │ +
│ │ │ │ +
412
│ │ │ │ +
413
│ │ │ │ +
414
│ │ │ │ +
430 template<typename... T>
│ │ │ │ +
│ │ │ │ +
431 struct
│ │ │ │ +
432 [[deprecated("This class is deprecated and will be removed after Dune 2.10. Use sizeof...(T) instead.")]]
│ │ │ │ +
433 SizeOf
│ │ │ │ +
434 : public std::integral_constant<std::size_t,sizeof...(T)>
│ │ │ │ +
435 {};
│ │ │ │ +
│ │ │ │ +
436
│ │ │ │ +
437
│ │ │ │ +
438#ifndef DOXYGEN
│ │ │ │ +
439
│ │ │ │ +
440 namespace Impl {
│ │ │ │ +
441
│ │ │ │ +
442 template<class T, T...>
│ │ │ │ +
443 struct IntegerSequenceHelper;
│ │ │ │ +
444
│ │ │ │ +
445 // Helper struct to compute the i-th entry of a std::integer_sequence
│ │ │ │ +
446 //
│ │ │ │ +
447 // This could also be implemented using std::get<index>(std::make_tuple(t...)).
│ │ │ │ +
448 // However, the gcc-6 implementation of std::make_tuple increases the instantiation
│ │ │ │ +
449 // depth by 15 levels for each argument, such that the maximal instantiation depth
│ │ │ │ +
450 // is easily hit, especially with clang where it is set to 256.
│ │ │ │ +
451 template<class T, T head, T... tail>
│ │ │ │ +
452 struct IntegerSequenceHelper<T, head, tail...>
│ │ │ │ +
453 {
│ │ │ │ +
454
│ │ │ │ +
455 // get first entry
│ │ │ │ +
456 static constexpr auto get(std::integral_constant<std::size_t, 0>)
│ │ │ │ +
457 {
│ │ │ │ +
458 return std::integral_constant<T, head>();
│ │ │ │ +
459 }
│ │ │ │ +
460
│ │ │ │ +
461 // call get with first entry cut off and decremented index
│ │ │ │ +
462 template<std::size_t index,
│ │ │ │ +
463 std::enable_if_t<(index > 0) and (index < sizeof...(tail)+1), int> = 0>
│ │ │ │ +
464 static constexpr auto get(std::integral_constant<std::size_t, index>)
│ │ │ │ +
465 {
│ │ │ │ +
466 return IntegerSequenceHelper<T, tail...>::get(std::integral_constant<std::size_t, index-1>());
│ │ │ │ +
467 }
│ │ │ │ +
468
│ │ │ │ +
469 // use static assertion if index exceeds size
│ │ │ │ +
470 template<std::size_t index,
│ │ │ │ +
471 std::enable_if_t<(index >= sizeof...(tail)+1), int> = 0>
│ │ │ │ +
472 static constexpr auto get(std::integral_constant<std::size_t, index>)
│ │ │ │ +
473 {
│ │ │ │ +
474 static_assert(index < sizeof...(tail)+1, "index used in IntegerSequenceEntry exceed size");
│ │ │ │ +
475 }
│ │ │ │ +
476 };
│ │ │ │ +
477
│ │ │ │ +
478 } // end namespace Impl
│ │ │ │ +
479
│ │ │ │ +
480#endif // DOXYGEN
│ │ │ │ +
481
│ │ │ │ +
482
│ │ │ │ +
491 template<class T, T... t, std::size_t index>
│ │ │ │ +
│ │ │ │ +
492 constexpr auto integerSequenceEntry(std::integer_sequence<T, t...> /*seq*/, std::integral_constant<std::size_t, index> i)
│ │ │ │ +
493 {
│ │ │ │ +
494 static_assert(index < sizeof...(t), "index used in IntegerSequenceEntry exceed size");
│ │ │ │ +
495 return Impl::IntegerSequenceHelper<T, t...>::get(i);
│ │ │ │ +
496 }
│ │ │ │ +
│ │ │ │ +
497
│ │ │ │ +
498
│ │ │ │ +
505 template<class IntegerSequence, std::size_t index>
│ │ │ │ + │ │ │ │ +
507
│ │ │ │ +
508#ifndef DOXYGEN
│ │ │ │ +
509
│ │ │ │ +
510 template<class T, T... t, std::size_t i>
│ │ │ │ +
511 struct IntegerSequenceEntry<std::integer_sequence<T, t...>, i>
│ │ │ │ +
512 : public decltype(Impl::IntegerSequenceHelper<T, t...>::get(std::integral_constant<std::size_t, i>()))
│ │ │ │ +
513 {};
│ │ │ │ +
514
│ │ │ │ +
515#endif // DOXYGEN
│ │ │ │ +
516
│ │ │ │ +
530 template<class T>
│ │ │ │ +
531 struct AutonomousValueType { using type = T; };
│ │ │ │ +
532
│ │ │ │ +
534 template<class T>
│ │ │ │ + │ │ │ │ +
536
│ │ │ │ +
538 template<class T>
│ │ │ │ + │ │ │ │ +
540
│ │ │ │ +
542 template<class T>
│ │ │ │ + │ │ │ │ +
544
│ │ │ │ +
546 template<class T>
│ │ │ │ +
547 struct AutonomousValueType<volatile T> : AutonomousValueType<T> {};
│ │ │ │ +
548
│ │ │ │ +
550 template<>
│ │ │ │ +
│ │ │ │ +
551 struct AutonomousValueType<std::vector<bool>::reference>
│ │ │ │ +
552 {
│ │ │ │ +
553 using type = bool;
│ │ │ │ +
554 };
│ │ │ │ +
│ │ │ │ +
555
│ │ │ │ +
557 template<class T>
│ │ │ │ +
558 struct AutonomousValueType<volatile const T> : AutonomousValueType<T> {};
│ │ │ │ +
559
│ │ │ │ +
587 template<class T>
│ │ │ │ + │ │ │ │ +
589
│ │ │ │ +
671 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
673 {
│ │ │ │ +
674 return v;
│ │ │ │ +
675 }
│ │ │ │ +
│ │ │ │ +
676
│ │ │ │ +
678}
│ │ │ │ +
679#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:492
│ │ │ │ +
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:672
│ │ │ │ +
typename AutonomousValueType< T >::type AutonomousValue
Type free of internal references that T can be converted to.
Definition typetraits.hh:588
│ │ │ │ +
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.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
A function object type whose operator() returns its argument unchanged.
Definition functional.hh:27
│ │ │ │ -
constexpr T && operator()(T &&t) const noexcept
Definition functional.hh:29
│ │ │ │ +
constexpr std::integer_sequence< T, II... > tail(std::integer_sequence< T, I0, II... >)
For a sequence [head,tail...) return the tail sequence.
Definition integersequence.hh:58
│ │ │ │ +
constexpr std::integral_constant< T, I0 > head(std::integer_sequence< T, I0, II... >)
For a sequence [head,tail...) return the single head element.
Definition integersequence.hh:53
│ │ │ │ +
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition integersequence.hh:22
│ │ │ │ +
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
│ │ │ │ +
Check if T is an integral constant or any type derived from std::integral_constant.
Definition typetraits.hh:411
│ │ │ │ +
Compute size of variadic type list.
Definition typetraits.hh:435
│ │ │ │ +
Get entry of std::integer_sequence.
Definition typetraits.hh:506
│ │ │ │ +
Type free of internal references that T can be converted to.
Definition typetraits.hh:531
│ │ │ │ +
T type
Definition typetraits.hh:531
│ │ │ │ + │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,51 +1,501 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ - * _s_t_d │ │ │ │ │ -functional.hh │ │ │ │ │ +typetraits.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 © 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_TYPETRAITS_HH │ │ │ │ │ +6#define DUNE_TYPETRAITS_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10#include // DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ -11 │ │ │ │ │ -12namespace _D_u_n_e │ │ │ │ │ -13{ │ │ │ │ │ -14 │ │ │ │ │ -15 namespace Std │ │ │ │ │ -16 { │ │ │ │ │ -17 │ │ │ │ │ -24#if DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ -25 using std::identity; │ │ │ │ │ -26#else //DUNE_HAVE_CXX_STD_IDENTITY │ │ │ │ │ -_2_7 struct _i_d_e_n_t_i_t_y { │ │ │ │ │ -28 template │ │ │ │ │ -_2_9 constexpr T&& _o_p_e_r_a_t_o_r_(_)(T&& t ) const noexcept {return std::forward(t);} │ │ │ │ │ -30 }; │ │ │ │ │ -31#endif │ │ │ │ │ -32 } // namespace Std │ │ │ │ │ -33 │ │ │ │ │ -34} // namespace Dune │ │ │ │ │ -35 │ │ │ │ │ -36#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH │ │ │ │ │ +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 │ │ │ │ │ +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#ifndef DOXYGEN │ │ │ │ │ +388 │ │ │ │ │ +389 namespace Impl { │ │ │ │ │ +390 │ │ │ │ │ +391 struct _I_s_C_o_m_p_i_l_e_T_i_m_e_C_o_n_s_t_a_n_t │ │ │ │ │ +392 { │ │ │ │ │ +393 template │ │ │ │ │ +394 static std::true_type check(std::integral_constant); │ │ │ │ │ +395 static std::false_type check(...); │ │ │ │ │ +396 }; │ │ │ │ │ +397 │ │ │ │ │ +398 } // namespace Impl │ │ │ │ │ +399 │ │ │ │ │ +400#endif // DOXYGEN │ │ │ │ │ +401 │ │ │ │ │ +408 template │ │ │ │ │ +_4_0_9 struct _I_s_C_o_m_p_i_l_e_T_i_m_e_C_o_n_s_t_a_n_t │ │ │ │ │ +410 : public decltype(Impl::IsCompileTimeConstant::check(std::declval())) │ │ │ │ │ +411 {}; │ │ │ │ │ +412 │ │ │ │ │ +413 │ │ │ │ │ +414 │ │ │ │ │ +430 template │ │ │ │ │ +_4_3_1 struct │ │ │ │ │ +432 [[deprecated("This class is deprecated and will be removed after Dune 2.10. │ │ │ │ │ +Use sizeof...(T) instead.")]] │ │ │ │ │ +433 _S_i_z_e_O_f │ │ │ │ │ +434 : public std::integral_constant │ │ │ │ │ +435 {}; │ │ │ │ │ +436 │ │ │ │ │ +437 │ │ │ │ │ +438#ifndef DOXYGEN │ │ │ │ │ +439 │ │ │ │ │ +440 namespace Impl { │ │ │ │ │ +441 │ │ │ │ │ +442 template │ │ │ │ │ +443 struct IntegerSequenceHelper; │ │ │ │ │ +444 │ │ │ │ │ +445 // Helper struct to compute the i-th entry of a std::integer_sequence │ │ │ │ │ +446 // │ │ │ │ │ +447 // This could also be implemented using std::get(std::make_tuple │ │ │ │ │ +(t...)). │ │ │ │ │ +448 // However, the gcc-6 implementation of std::make_tuple increases the │ │ │ │ │ +instantiation │ │ │ │ │ +449 // depth by 15 levels for each argument, such that the maximal │ │ │ │ │ +instantiation depth │ │ │ │ │ +450 // is easily hit, especially with clang where it is set to 256. │ │ │ │ │ +451 template │ │ │ │ │ +452 struct IntegerSequenceHelper │ │ │ │ │ +453 { │ │ │ │ │ +454 │ │ │ │ │ +455 // get first entry │ │ │ │ │ +456 static constexpr auto _g_e_t(std::integral_constant) │ │ │ │ │ +457 { │ │ │ │ │ +458 return std::integral_constant(); │ │ │ │ │ +459 } │ │ │ │ │ +460 │ │ │ │ │ +461 // call get with first entry cut off and decremented index │ │ │ │ │ +462 template 0) and (index < sizeof...(tail)+1), int> = 0> │ │ │ │ │ +464 static constexpr auto get(std::integral_constant) │ │ │ │ │ +465 { │ │ │ │ │ +466 return IntegerSequenceHelper::get(std::integral_constant()); │ │ │ │ │ +467 } │ │ │ │ │ +468 │ │ │ │ │ +469 // use static assertion if index exceeds size │ │ │ │ │ +470 template= sizeof...(tail)+1), int> = 0> │ │ │ │ │ +472 static constexpr auto _g_e_t(std::integral_constant) │ │ │ │ │ +473 { │ │ │ │ │ +474 static_assert(index < sizeof...(tail)+1, "index used in │ │ │ │ │ +IntegerSequenceEntry exceed size"); │ │ │ │ │ +475 } │ │ │ │ │ +476 }; │ │ │ │ │ +477 │ │ │ │ │ +478 } // end namespace Impl │ │ │ │ │ +479 │ │ │ │ │ +480#endif // DOXYGEN │ │ │ │ │ +481 │ │ │ │ │ +482 │ │ │ │ │ +491 template │ │ │ │ │ +_4_9_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) │ │ │ │ │ +493 { │ │ │ │ │ +494 static_assert(index < sizeof...(t), "index used in IntegerSequenceEntry │ │ │ │ │ +exceed size"); │ │ │ │ │ +495 return Impl::IntegerSequenceHelper::get(i); │ │ │ │ │ +496 } │ │ │ │ │ +497 │ │ │ │ │ +498 │ │ │ │ │ +505 template │ │ │ │ │ +_5_0_6 struct _I_n_t_e_g_e_r_S_e_q_u_e_n_c_e_E_n_t_r_y; │ │ │ │ │ +507 │ │ │ │ │ +508#ifndef DOXYGEN │ │ │ │ │ +509 │ │ │ │ │ +510 template │ │ │ │ │ +511 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> │ │ │ │ │ +512 : public decltype(Impl::IntegerSequenceHelper::get(std:: │ │ │ │ │ +integral_constant())) │ │ │ │ │ +513 {}; │ │ │ │ │ +514 │ │ │ │ │ +515#endif // DOXYGEN │ │ │ │ │ +516 │ │ │ │ │ +530 template │ │ │ │ │ +_5_3_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; }; │ │ │ │ │ +532 │ │ │ │ │ +534 template │ │ │ │ │ +_5_3_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_> {}; │ │ │ │ │ +536 │ │ │ │ │ +538 template │ │ │ │ │ +_5_3_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_> {}; │ │ │ │ │ +540 │ │ │ │ │ +542 template │ │ │ │ │ +_5_4_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 {}; │ │ │ │ │ +544 │ │ │ │ │ +546 template │ │ │ │ │ +_5_4_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 {}; │ │ │ │ │ +548 │ │ │ │ │ +550 template<> │ │ │ │ │ +_5_5_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> │ │ │ │ │ +552 { │ │ │ │ │ +_5_5_3 using _t_y_p_e = bool; │ │ │ │ │ +554 }; │ │ │ │ │ +555 │ │ │ │ │ +557 template │ │ │ │ │ +_5_5_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 {}; │ │ │ │ │ +559 │ │ │ │ │ +587 template │ │ │ │ │ +_5_8_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; │ │ │ │ │ +589 │ │ │ │ │ +671 template │ │ │ │ │ +_6_7_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) │ │ │ │ │ +673 { │ │ │ │ │ +674 return v; │ │ │ │ │ +675 } │ │ │ │ │ +676 │ │ │ │ │ +678} │ │ │ │ │ +679#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:492 │ │ │ │ │ +_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:672 │ │ │ │ │ +_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:588 │ │ │ │ │ +_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. │ │ │ │ │ _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:27 │ │ │ │ │ -_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:29 │ │ │ │ │ +_D_u_n_e_:_:_t_a_i_l │ │ │ │ │ +constexpr std::integer_sequence< T, II... > tail(std::integer_sequence< T, I0, │ │ │ │ │ +II... >) │ │ │ │ │ +For a sequence [head,tail...) return the tail sequence. │ │ │ │ │ +DDeeffiinniittiioonn integersequence.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_h_e_a_d │ │ │ │ │ +constexpr std::integral_constant< T, I0 > head(std::integer_sequence< T, I0, │ │ │ │ │ +II... >) │ │ │ │ │ +For a sequence [head,tail...) return the single head element. │ │ │ │ │ +DDeeffiinniittiioonn integersequence.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ │ +constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< │ │ │ │ │ +std::size_t, pos >={}) │ │ │ │ │ +Return the entry at position pos of the given sequence. │ │ │ │ │ +DDeeffiinniittiioonn integersequence.hh:22 │ │ │ │ │ +_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_:_:_I_s_C_o_m_p_i_l_e_T_i_m_e_C_o_n_s_t_a_n_t │ │ │ │ │ +Check if T is an integral constant or any type derived from std:: │ │ │ │ │ +integral_constant. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:411 │ │ │ │ │ +_D_u_n_e_:_:_S_i_z_e_O_f │ │ │ │ │ +Compute size of variadic type list. │ │ │ │ │ +DDeeffiinniittiioonn typetraits.hh:435 │ │ │ │ │ +_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:506 │ │ │ │ │ +_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:531 │ │ │ │ │ +_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:531 │ │ │ │ │ +_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:553 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: indent.hh File Reference │ │ │ │ +dune-common: parametertreeparser.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,48 +71,49 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
indent.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
parametertreeparser.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

Various parser methods to get data into a ParameterTree object. │ │ │ │ More...

│ │ │ │ -
#include <ostream>
│ │ │ │ +
#include <istream>
│ │ │ │ #include <string>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <dune/common/parametertree.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Indent
 Utility class for handling nested indentation in output. More...
class  Dune::ParameterTreeParserError
 report parser error while reading ParameterTree More...
 
class  Dune::HelpRequest
 exception thrown if the user wants to see help string More...
 
class  Dune::ParameterTreeParser
 Parsers to set up a ParameterTree from various input sources. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

std::ostream & Dune::operator<< (std::ostream &s, const Indent &indent)
 write indentation to a stream
 
│ │ │ │

Detailed Description

│ │ │ │ -

Utility class for handling nested indentation in output.

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

Various parser methods to get data into a ParameterTree object.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,31 +1,33 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +parametertreeparser.hh File Reference │ │ │ │ │ +Various parser methods to get data into a ParameterTree object. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ +#include │ │ │ │ │ +#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_/_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_:_:_I_n_d_e_n_t │ │ │ │ │ -  Utility class for handling nested indentation in output. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r_E_r_r_o_r │ │ │ │ │ +  report parser error while reading _P_a_r_a_m_e_t_e_r_T_r_e_e _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_H_e_l_p_R_e_q_u_e_s_t │ │ │ │ │ +  exception thrown if the user wants to see help string _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +class   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r │ │ │ │ │ +  Parsers to set up a _P_a_r_a_m_e_t_e_r_T_r_e_e from various input sources. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ 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 │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Utility class for handling nested indentation in output. │ │ │ │ │ - Author │ │ │ │ │ - Jö Fahlke │ │ │ │ │ +Various parser methods to get data into a ParameterTree object. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: indent.hh Source File │ │ │ │ +dune-common: parametertreeparser.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,107 +74,92 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
indent.hh
│ │ │ │ +
parametertreeparser.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 © 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
│ │ │ │ +
5#ifndef DUNE_PARAMETER_PARSER_HH
│ │ │ │ +
6#define DUNE_PARAMETER_PARSER_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 { }
│ │ │ │ -
│ │ │ │ +
12#include <istream>
│ │ │ │ +
13#include <string>
│ │ │ │ +
14#include <vector>
│ │ │ │ +
15
│ │ │ │ + │ │ │ │ + │ │ │ │ +
18
│ │ │ │ +
19namespace Dune {
│ │ │ │ +
20
│ │ │ │ + │ │ │ │ +
28 class HelpRequest : public Exception {};
│ │ │ │ +
29
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
35 {
│ │ │ │ +
36
│ │ │ │ +
37 static std::string ltrim(const std::string& s);
│ │ │ │ +
38 static std::string rtrim(const std::string& s);
│ │ │ │ +
39
│ │ │ │ +
40 public:
│ │ │ │ +
41
│ │ │ │
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; }
│ │ │ │ +
96 static void readINITree(std::istream& in, ParameterTree& pt,
│ │ │ │ +
97 bool overwrite);
│ │ │ │
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
│ │ │ │ -
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
│ │ │ │ +
105 static Dune::ParameterTree readINITree(std::istream& in);
│ │ │ │ +
106
│ │ │ │ +
107
│ │ │ │ +
120 static void readINITree(std::istream& in, ParameterTree& pt,
│ │ │ │ +
121 const std::string srcname = "stream",
│ │ │ │ +
122 bool overwrite = true);
│ │ │ │ +
123
│ │ │ │ +
124
│ │ │ │ +
135 static void readINITree(std::string file, ParameterTree& pt, bool overwrite = true);
│ │ │ │ +
136
│ │ │ │ +
143 static Dune::ParameterTree readINITree(const std::string& file);
│ │ │ │ +
144
│ │ │ │ +
146
│ │ │ │ +
158 static void readOptions(int argc, char* argv [], ParameterTree& pt);
│ │ │ │ +
159
│ │ │ │ +
177 static void readNamedOptions(int argc, char* argv[],
│ │ │ │ +
178 ParameterTree& pt,
│ │ │ │ +
179 std::vector<std::string> keywords,
│ │ │ │ +
180 unsigned int required = std::numeric_limits<unsigned int>::max(),
│ │ │ │ +
181 bool allow_more = true,
│ │ │ │ +
182 bool overwrite = true,
│ │ │ │ +
183 std::vector<std::string> help = std::vector<std::string>());
│ │ │ │ +
184
│ │ │ │ +
185 private:
│ │ │ │ +
186 static std::string generateHelpString(std::string progname, std::vector<std::string> keywords, unsigned int required, std::vector<std::string> help);
│ │ │ │ +
187 };
│ │ │ │ +
│ │ │ │ +
188
│ │ │ │ +
189} // end namespace Dune
│ │ │ │ +
190
│ │ │ │ +
191#endif // DUNE_PARAMETER_PARSER_HH
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
A hierarchical structure of string parameters.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
Utility class for handling nested indentation in output.
Definition indent.hh:53
│ │ │ │ +
Base class for Dune-Exceptions.
Definition exceptions.hh:96
│ │ │ │ +
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │ +
Hierarchical structure of string parameters.
Definition parametertree.hh:37
│ │ │ │ +
report parser error while reading ParameterTree
Definition parametertreeparser.hh:22
│ │ │ │ +
exception thrown if the user wants to see help string
Definition parametertreeparser.hh:28
│ │ │ │ +
Parsers to set up a ParameterTree from various input sources.
Definition parametertreeparser.hh:35
│ │ │ │ +
static void readOptions(int argc, char *argv[], ParameterTree &pt)
parse command line options and build hierarchical ParameterTree structure
Definition parametertreeparser.cc:155
│ │ │ │ +
static void readINITree(std::istream &in, ParameterTree &pt, bool overwrite)
parse C++ stream
Definition parametertreeparser.cc:70
│ │ │ │ +
static void readNamedOptions(int argc, char *argv[], ParameterTree &pt, std::vector< std::string > keywords, unsigned int required=std::numeric_limits< unsigned int >::max(), bool allow_more=true, bool overwrite=true, std::vector< std::string > help=std::vector< std::string >())
read [named] command line options and build hierarchical ParameterTree structure
Definition parametertreeparser.cc:171
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,119 +1,116 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -indent.hh │ │ │ │ │ +parametertreeparser.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 © 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 │ │ │ │ │ +5#ifndef DUNE_PARAMETER_PARSER_HH │ │ │ │ │ +6#define DUNE_PARAMETER_PARSER_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 { } │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#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> │ │ │ │ │ +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 │ │ │ │ │ +19namespace _D_u_n_e { │ │ │ │ │ +20 │ │ │ │ │ +_2_2 class _P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r_E_r_r_o_r : public _R_a_n_g_e_E_r_r_o_r {}; │ │ │ │ │ +_2_8 class _H_e_l_p_R_e_q_u_e_s_t : public _E_x_c_e_p_t_i_o_n {}; │ │ │ │ │ +29 │ │ │ │ │ +_3_4 class _P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r │ │ │ │ │ +35 { │ │ │ │ │ +36 │ │ │ │ │ +37 static std::string ltrim(const std::string& s); │ │ │ │ │ +38 static std::string rtrim(const std::string& s); │ │ │ │ │ +39 │ │ │ │ │ +40 public: │ │ │ │ │ +41 │ │ │ │ │ 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; } │ │ │ │ │ +96 static void _r_e_a_d_I_N_I_T_r_e_e(std::istream& in, _P_a_r_a_m_e_t_e_r_T_r_e_e& pt, │ │ │ │ │ +97 bool overwrite); │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ +105 static _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e _r_e_a_d_I_N_I_T_r_e_e(std::istream& in); │ │ │ │ │ +106 │ │ │ │ │ +107 │ │ │ │ │ +120 static void _r_e_a_d_I_N_I_T_r_e_e(std::istream& in, _P_a_r_a_m_e_t_e_r_T_r_e_e& pt, │ │ │ │ │ +121 const std::string srcname = "stream", │ │ │ │ │ +122 bool overwrite = true); │ │ │ │ │ +123 │ │ │ │ │ +124 │ │ │ │ │ +135 static void _r_e_a_d_I_N_I_T_r_e_e(std::string file, _P_a_r_a_m_e_t_e_r_T_r_e_e& pt, bool overwrite │ │ │ │ │ += true); │ │ │ │ │ +136 │ │ │ │ │ +143 static _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e _r_e_a_d_I_N_I_T_r_e_e(const std::string& file); │ │ │ │ │ +144 │ │ │ │ │ +146 │ │ │ │ │ +158 static void _r_e_a_d_O_p_t_i_o_n_s(int argc, char* argv [], _P_a_r_a_m_e_t_e_r_T_r_e_e& pt); │ │ │ │ │ +159 │ │ │ │ │ +177 static void _r_e_a_d_N_a_m_e_d_O_p_t_i_o_n_s(int argc, char* argv[], │ │ │ │ │ +178 _P_a_r_a_m_e_t_e_r_T_r_e_e& pt, │ │ │ │ │ +179 std::vector keywords, │ │ │ │ │ +180 unsigned int required = std::numeric_limits::max(), │ │ │ │ │ +181 bool allow_more = true, │ │ │ │ │ +182 bool overwrite = true, │ │ │ │ │ +183 std::vector help = std::vector()); │ │ │ │ │ +184 │ │ │ │ │ +185 private: │ │ │ │ │ +186 static std::string generateHelpString(std::string progname, std:: │ │ │ │ │ +vector keywords, unsigned int required, std::vector │ │ │ │ │ +help); │ │ │ │ │ +187 }; │ │ │ │ │ +188 │ │ │ │ │ +189} // end namespace Dune │ │ │ │ │ +190 │ │ │ │ │ +191#endif // DUNE_PARAMETER_PARSER_HH │ │ │ │ │ +_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ +A few common exception classes. │ │ │ │ │ +_p_a_r_a_m_e_t_e_r_t_r_e_e_._h_h │ │ │ │ │ +A hierarchical structure of string parameters. │ │ │ │ │ _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_:_:_E_x_c_e_p_t_i_o_n │ │ │ │ │ +Base class for Dune-Exceptions. │ │ │ │ │ +DDeeffiinniittiioonn exceptions.hh:96 │ │ │ │ │ +_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_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e │ │ │ │ │ +Hierarchical structure of string parameters. │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r_E_r_r_o_r │ │ │ │ │ +report parser error while reading ParameterTree │ │ │ │ │ +DDeeffiinniittiioonn parametertreeparser.hh:22 │ │ │ │ │ +_D_u_n_e_:_:_H_e_l_p_R_e_q_u_e_s_t │ │ │ │ │ +exception thrown if the user wants to see help string │ │ │ │ │ +DDeeffiinniittiioonn parametertreeparser.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r │ │ │ │ │ +Parsers to set up a ParameterTree from various input sources. │ │ │ │ │ +DDeeffiinniittiioonn parametertreeparser.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r_:_:_r_e_a_d_O_p_t_i_o_n_s │ │ │ │ │ +static void readOptions(int argc, char *argv[], ParameterTree &pt) │ │ │ │ │ +parse command line options and build hierarchical ParameterTree structure │ │ │ │ │ +DDeeffiinniittiioonn parametertreeparser.cc:155 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r_:_:_r_e_a_d_I_N_I_T_r_e_e │ │ │ │ │ +static void readINITree(std::istream &in, ParameterTree &pt, bool overwrite) │ │ │ │ │ +parse C++ stream │ │ │ │ │ +DDeeffiinniittiioonn parametertreeparser.cc:70 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_P_a_r_s_e_r_:_:_r_e_a_d_N_a_m_e_d_O_p_t_i_o_n_s │ │ │ │ │ +static void readNamedOptions(int argc, char *argv[], ParameterTree &pt, std:: │ │ │ │ │ +vector< std::string > keywords, unsigned int required=std::numeric_limits< │ │ │ │ │ +unsigned int >::max(), bool allow_more=true, bool overwrite=true, std::vector< │ │ │ │ │ +std::string > help=std::vector< std::string >()) │ │ │ │ │ +read [named] command line options and build hierarchical ParameterTree │ │ │ │ │ +structure │ │ │ │ │ +DDeeffiinniittiioonn parametertreeparser.cc:171 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: parameterizedobject.hh File Reference │ │ │ │ +dune-common: gmpfield.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,36 +72,53 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
parameterizedobject.hh File Reference
│ │ │ │ +
gmpfield.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <functional>
│ │ │ │ -#include <map>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/typeutilities.hh>
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#include <iostream>
│ │ │ │ +#include <string>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <gmpxx.h>
│ │ │ │ +#include <dune/common/promotiontraits.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::ParameterizedObjectFactory< TypeT(Args...), KeyT >
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

│ │ │ │ +

Wrapper for the GNU multiprecision (GMP) library.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,23 +1,40 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -parameterizedobject.hh 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> │ │ │ │ │ -#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> │ │ │ │ │ +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> │ │ │ │ │ _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_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _> │ │ │ │ │ + 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 ********** │ │ │ │ │ +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/a00164_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: parameterizedobject.hh Source File │ │ │ │ +dune-common: gmpfield.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,178 +74,141 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
parameterizedobject.hh
│ │ │ │ +
gmpfield.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
│ │ │ │ -
2// vi: set et ts=4 sw=4 sts=4:
│ │ │ │ +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 © 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_PARAMETERIZEDOBJECT_HH
│ │ │ │ -
6#define DUNE_COMMON_PARAMETERIZEDOBJECT_HH
│ │ │ │ +
5#ifndef DUNE_GMPFIELD_HH
│ │ │ │ +
6#define DUNE_GMPFIELD_HH
│ │ │ │
7
│ │ │ │ -
8#include <functional>
│ │ │ │ -
9#include <map>
│ │ │ │ -
10#include <memory>
│ │ │ │ -
11
│ │ │ │ - │ │ │ │ - │ │ │ │ -
14
│ │ │ │ -
15namespace Dune {
│ │ │ │ -
16
│ │ │ │ -
34template<typename Signature,
│ │ │ │ -
35 typename KeyT = std::string>
│ │ │ │ - │ │ │ │ -
37
│ │ │ │ -
38template<typename TypeT,
│ │ │ │ -
39 typename KeyT,
│ │ │ │ -
40 typename... Args>
│ │ │ │ -
│ │ │ │ -
41class ParameterizedObjectFactory<TypeT(Args...), KeyT>
│ │ │ │ -
42{
│ │ │ │ -
43 public:
│ │ │ │ -
44
│ │ │ │ -
46 typedef KeyT Key;
│ │ │ │ -
47
│ │ │ │ -
49 using Type = TypeT;
│ │ │ │ -
50
│ │ │ │ -
51 protected:
│ │ │ │ -
52
│ │ │ │ -
53 using Creator = std::function<Type(Args...)>;
│ │ │ │ -
54
│ │ │ │ -
55 template<class F>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
57 -> decltype( std::declval<F>()(std::declval<Args>()...), std::true_type())
│ │ │ │ -
58 {
│ │ │ │ -
59 return {};
│ │ │ │ -
60 }
│ │ │ │ -
│ │ │ │ -
61
│ │ │ │ -
62 template<class F>
│ │ │ │ -
│ │ │ │ -
63 static constexpr std::false_type has_proper_signature(Dune::PriorityTag<0>)
│ │ │ │ -
64 {
│ │ │ │ -
65 return {};
│ │ │ │ -
66 }
│ │ │ │ -
│ │ │ │ -
67
│ │ │ │ -
68 public:
│ │ │ │ -
69
│ │ │ │ -
│ │ │ │ -
77 Type create(Key const& key, Args ... args) const {
│ │ │ │ -
78 typename Registry::const_iterator i = registry_.find(key);
│ │ │ │ -
79 if (i == registry_.end()) {
│ │ │ │ - │ │ │ │ -
81 "ParametrizedObjectFactory: key ``" <<
│ │ │ │ -
82 key << "'' not registered");
│ │ │ │ -
83 }
│ │ │ │ -
84 else return i->second(args...);
│ │ │ │ -
85 }
│ │ │ │ -
│ │ │ │ -
86
│ │ │ │ -
100 template<class Impl>
│ │ │ │ -
│ │ │ │ -
101 void define(Key const& key)
│ │ │ │ -
102 {
│ │ │ │ -
103 registry_[key] = DefaultCreator<Impl>();
│ │ │ │ -
104 }
│ │ │ │ -
│ │ │ │ +
12#include <iostream>
│ │ │ │ +
13#include <string>
│ │ │ │ +
14#include <type_traits>
│ │ │ │ +
15
│ │ │ │ +
16#if HAVE_GMP || DOXYGEN
│ │ │ │ +
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 };
│ │ │ │ +
│ │ │ │ +
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 };
│ │ │ │ +
│ │ │ │ +
96
│ │ │ │ +
97 template< class T, unsigned int precision >
│ │ │ │ +
│ │ │ │ +
98 struct PromotionTraits<T, GMPField<precision>>
│ │ │ │ +
99 {
│ │ │ │ + │ │ │ │ +
101 };
│ │ │ │ +
│ │ │ │ +
102}
│ │ │ │ +
103
│ │ │ │ +
104#endif // HAVE_GMP
│ │ │ │
105
│ │ │ │ -
119 template<class F,
│ │ │ │ -
120 typename std::enable_if<has_proper_signature<F>(PriorityTag<42>()), int>::type = 0>
│ │ │ │ -
│ │ │ │ -
121 void define(Key const& key, F&& f)
│ │ │ │ -
122 {
│ │ │ │ -
123 registry_[key] = f;
│ │ │ │ -
124 }
│ │ │ │ -
│ │ │ │ -
125
│ │ │ │ -
140 template<class Impl,
│ │ │ │ -
141 typename std::enable_if<
│ │ │ │ -
142 std::is_convertible<Impl, Type>::value
│ │ │ │ -
143 and not std::is_convertible<Impl, Creator>::value,
│ │ │ │ -
144 int>::type = 0>
│ │ │ │ -
│ │ │ │ -
145 void define(Key const& key, Impl&& t)
│ │ │ │ -
146 {
│ │ │ │ -
147 registry_[key] = [=](Args...) { return t;};
│ │ │ │ -
148 }
│ │ │ │ -
│ │ │ │ -
149
│ │ │ │ -
│ │ │ │ -
150 bool contains(Key const& key) const
│ │ │ │ -
151 {
│ │ │ │ -
152 return registry_.count(key);
│ │ │ │ -
153 }
│ │ │ │ -
│ │ │ │ -
154
│ │ │ │ -
155 private:
│ │ │ │ -
156
│ │ │ │ -
157 template<class T>
│ │ │ │ -
158 struct Tag{};
│ │ │ │ -
159
│ │ │ │ -
160 template<class Impl>
│ │ │ │ -
161 struct DefaultCreator
│ │ │ │ -
162 {
│ │ │ │ -
163 template<class... T>
│ │ │ │ -
164 Type operator()(T&&... args) const
│ │ │ │ -
165 {
│ │ │ │ -
166 return DefaultCreator::create(Tag<Type>(), PriorityTag<42>(), std::forward<T>(args)...);
│ │ │ │ -
167 }
│ │ │ │ -
168
│ │ │ │ -
169 template<class Target, class... T>
│ │ │ │ -
170 static Type create(Tag<Target>, PriorityTag<1>, T&& ... args) {
│ │ │ │ -
171 return Impl(std::forward<T>(args)...);
│ │ │ │ -
172 }
│ │ │ │ -
173
│ │ │ │ -
174 template<class Target, class... T>
│ │ │ │ -
175 static Type create(Tag<std::unique_ptr<Target>>, PriorityTag<2>, T&& ... args) {
│ │ │ │ -
176 return std::make_unique<Impl>(std::forward<T>(args)...);
│ │ │ │ -
177 }
│ │ │ │ -
178
│ │ │ │ -
179 template<class Target, class... T>
│ │ │ │ -
180 static Type create(Tag<std::shared_ptr<Target>>, PriorityTag<3>, T&& ... args) {
│ │ │ │ -
181 return std::make_shared<Impl>(std::forward<T>(args)...);
│ │ │ │ -
182 }
│ │ │ │ -
183
│ │ │ │ -
184 };
│ │ │ │ -
185
│ │ │ │ -
186 typedef std::map<Key, Creator> Registry;
│ │ │ │ -
187 Registry registry_;
│ │ │ │ -
188};
│ │ │ │ -
│ │ │ │ -
189
│ │ │ │ -
190
│ │ │ │ -
191
│ │ │ │ -
192} // end namespace Dune
│ │ │ │ -
193
│ │ │ │ -
194#endif // DUNE_COMMON_PARAMETERIZEDOBJECT_HH
│ │ │ │ -
A few common exception classes.
│ │ │ │ -
Utilities for type computations, constraining overloads, ...
│ │ │ │ -
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
│ │ │ │ +
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
│ │ │ │ -
Default exception if a function was called while the object is not in a valid state for that function...
Definition exceptions.hh:281
│ │ │ │ -
A factory class for parameterized objects.
Definition parameterizedobject.hh:36
│ │ │ │ -
std::function< Type(Args...)> Creator
Definition parameterizedobject.hh:53
│ │ │ │ -
static constexpr auto has_proper_signature(Dune::PriorityTag< 1 >) -> decltype(std::declval< F >()(std::declval< Args >()...), std::true_type())
Definition parameterizedobject.hh:56
│ │ │ │ -
TypeT Type
The type of objects created by the factory.
Definition parameterizedobject.hh:49
│ │ │ │ -
void define(Key const &key, Impl &&t)
Registers a new type with a key.
Definition parameterizedobject.hh:145
│ │ │ │ -
KeyT Key
The typ of the keys.
Definition parameterizedobject.hh:46
│ │ │ │ -
Type create(Key const &key, Args ... args) const
Creates an object identified by a key from given parameters.
Definition parameterizedobject.hh:77
│ │ │ │ -
void define(Key const &key)
Registers a new type with a key.
Definition parameterizedobject.hh:101
│ │ │ │ -
void define(Key const &key, F &&f)
Registers a new creator with a key.
Definition parameterizedobject.hh:121
│ │ │ │ -
static constexpr std::false_type has_proper_signature(Dune::PriorityTag< 0 >)
Definition parameterizedobject.hh:63
│ │ │ │ -
bool contains(Key const &key) const
Definition parameterizedobject.hh:150
│ │ │ │ -
Helper class for tagging priorities.
Definition typeutilities.hh:73
│ │ │ │ +
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,200 +1,146 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -parameterizedobject.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: 4 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=4 sts=4: │ │ │ │ │ +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 © 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_PARAMETERIZEDOBJECT_HH │ │ │ │ │ -6#define DUNE_COMMON_PARAMETERIZEDOBJECT_HH │ │ │ │ │ +5#ifndef DUNE_GMPFIELD_HH │ │ │ │ │ +6#define DUNE_GMPFIELD_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11 │ │ │ │ │ -12#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ -13#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> │ │ │ │ │ -14 │ │ │ │ │ -15namespace _D_u_n_e { │ │ │ │ │ -16 │ │ │ │ │ -34template │ │ │ │ │ -_3_6class _P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y; │ │ │ │ │ -37 │ │ │ │ │ -38template │ │ │ │ │ -_4_1class _P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y │ │ │ │ │ -42{ │ │ │ │ │ -43 public: │ │ │ │ │ -44 │ │ │ │ │ -_4_6 typedef KeyT _K_e_y; │ │ │ │ │ -47 │ │ │ │ │ -_4_9 using _T_y_p_e = TypeT; │ │ │ │ │ -50 │ │ │ │ │ -51 protected: │ │ │ │ │ -52 │ │ │ │ │ -_5_3 using _C_r_e_a_t_o_r = std::function<_T_y_p_e(Args...)>; │ │ │ │ │ -54 │ │ │ │ │ -55 template │ │ │ │ │ -_5_6 static constexpr auto _h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e(_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_1_>) │ │ │ │ │ -57 -> decltype( std::declval()(std::declval()...), std::true_type()) │ │ │ │ │ -58 { │ │ │ │ │ -59 return {}; │ │ │ │ │ -60 } │ │ │ │ │ -61 │ │ │ │ │ -62 template │ │ │ │ │ -_6_3 static constexpr std::false_type _h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e(_D_u_n_e_:_:_P_r_i_o_r_i_t_y_T_a_g_<_0_>) │ │ │ │ │ -64 { │ │ │ │ │ -65 return {}; │ │ │ │ │ -66 } │ │ │ │ │ -67 │ │ │ │ │ -68 public: │ │ │ │ │ -69 │ │ │ │ │ -_7_7 _T_y_p_e _c_r_e_a_t_e(_K_e_y const& key, Args ... args) const { │ │ │ │ │ -78 typename Registry::const_iterator i = registry_.find(key); │ │ │ │ │ -79 if (i == registry_.end()) { │ │ │ │ │ -80 _D_U_N_E___T_H_R_O_W(_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, │ │ │ │ │ -81 "ParametrizedObjectFactory: key ``" << │ │ │ │ │ -82 key << "'' not registered"); │ │ │ │ │ -83 } │ │ │ │ │ -84 else return i->second(args...); │ │ │ │ │ -85 } │ │ │ │ │ -86 │ │ │ │ │ -100 template │ │ │ │ │ -_1_0_1 void _d_e_f_i_n_e(_K_e_y const& key) │ │ │ │ │ -102 { │ │ │ │ │ -103 registry_[key] = DefaultCreator(); │ │ │ │ │ -104 } │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#if HAVE_GMP || DOXYGEN │ │ │ │ │ +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 }; │ │ │ │ │ +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 }; │ │ │ │ │ +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 │ │ │ │ │ -119 template(_P_r_i_o_r_i_t_y_T_a_g_<_4_2_>()), int>:: │ │ │ │ │ -type = 0> │ │ │ │ │ -_1_2_1 void _d_e_f_i_n_e(_K_e_y const& key, F&& f) │ │ │ │ │ -122 { │ │ │ │ │ -123 registry_[key] = f; │ │ │ │ │ -124 } │ │ │ │ │ -125 │ │ │ │ │ -140 template::value │ │ │ │ │ -143 and not std::is_convertible::value, │ │ │ │ │ -144 int>::type = 0> │ │ │ │ │ -_1_4_5 void _d_e_f_i_n_e(_K_e_y const& key, Impl&& t) │ │ │ │ │ -146 { │ │ │ │ │ -147 registry_[key] = [=](Args...) { return t;}; │ │ │ │ │ -148 } │ │ │ │ │ -149 │ │ │ │ │ -_1_5_0 bool _c_o_n_t_a_i_n_s(_K_e_y const& key) const │ │ │ │ │ -151 { │ │ │ │ │ -152 return registry_.count(key); │ │ │ │ │ -153 } │ │ │ │ │ -154 │ │ │ │ │ -155 private: │ │ │ │ │ -156 │ │ │ │ │ -157 template │ │ │ │ │ -158 struct Tag{}; │ │ │ │ │ -159 │ │ │ │ │ -160 template │ │ │ │ │ -161 struct DefaultCreator │ │ │ │ │ -162 { │ │ │ │ │ -163 template │ │ │ │ │ -164 Type operator()(T&&... args) const │ │ │ │ │ -165 { │ │ │ │ │ -166 return DefaultCreator::create(Tag(), PriorityTag<42>(), std:: │ │ │ │ │ -forward(args)...); │ │ │ │ │ -167 } │ │ │ │ │ -168 │ │ │ │ │ -169 template │ │ │ │ │ -170 static Type create(Tag, PriorityTag<1>, T&& ... args) { │ │ │ │ │ -171 return Impl(std::forward(args)...); │ │ │ │ │ -172 } │ │ │ │ │ -173 │ │ │ │ │ -174 template │ │ │ │ │ -175 static Type create(Tag>, PriorityTag<2>, T&& ... │ │ │ │ │ -args) { │ │ │ │ │ -176 return std::make_unique(std::forward(args)...); │ │ │ │ │ -177 } │ │ │ │ │ -178 │ │ │ │ │ -179 template │ │ │ │ │ -180 static Type create(Tag>, PriorityTag<3>, T&& ... │ │ │ │ │ -args) { │ │ │ │ │ -181 return std::make_shared(std::forward(args)...); │ │ │ │ │ -182 } │ │ │ │ │ -183 │ │ │ │ │ -184 }; │ │ │ │ │ -185 │ │ │ │ │ -186 typedef std::map Registry; │ │ │ │ │ -187 Registry registry_; │ │ │ │ │ -188}; │ │ │ │ │ -189 │ │ │ │ │ -190 │ │ │ │ │ -191 │ │ │ │ │ -192} // end namespace Dune │ │ │ │ │ -193 │ │ │ │ │ -194#endif // DUNE_COMMON_PARAMETERIZEDOBJECT_HH │ │ │ │ │ -_e_x_c_e_p_t_i_o_n_s_._h_h │ │ │ │ │ -A few common exception classes. │ │ │ │ │ -_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___T_H_R_O_W │ │ │ │ │ -#define DUNE_THROW(E, m) │ │ │ │ │ -DDeeffiinniittiioonn exceptions.hh:218 │ │ │ │ │ +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_:_:_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_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y │ │ │ │ │ -A factory class for parameterized objects. │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_C_r_e_a_t_o_r │ │ │ │ │ -std::function< Type(Args...)> Creator │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e │ │ │ │ │ -static constexpr auto has_proper_signature(Dune::PriorityTag< 1 >) -> decltype │ │ │ │ │ -(std::declval< F >()(std::declval< Args >()...), std::true_type()) │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_T_y_p_e │ │ │ │ │ -TypeT Type │ │ │ │ │ -The type of objects created by the factory. │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_d_e_f_i_n_e │ │ │ │ │ -void define(Key const &key, Impl &&t) │ │ │ │ │ -Registers a new type with a key. │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_K_e_y │ │ │ │ │ -KeyT Key │ │ │ │ │ -The typ of the keys. │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_c_r_e_a_t_e │ │ │ │ │ -Type create(Key const &key, Args ... args) const │ │ │ │ │ -Creates an object identified by a key from given parameters. │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_d_e_f_i_n_e │ │ │ │ │ -void define(Key const &key) │ │ │ │ │ -Registers a new type with a key. │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:101 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_d_e_f_i_n_e │ │ │ │ │ -void define(Key const &key, F &&f) │ │ │ │ │ -Registers a new creator with a key. │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:121 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_h_a_s___p_r_o_p_e_r___s_i_g_n_a_t_u_r_e │ │ │ │ │ -static constexpr std::false_type has_proper_signature(Dune::PriorityTag< 0 >) │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_i_z_e_d_O_b_j_e_c_t_F_a_c_t_o_r_y_<_ _T_y_p_e_T_(_A_r_g_s_._._._)_,_ _K_e_y_T_ _>_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ -bool contains(Key const &key) const │ │ │ │ │ -DDeeffiinniittiioonn parameterizedobject.hh:150 │ │ │ │ │ -_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_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/a00167.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: debugstream.hh File Reference │ │ │ │ +dune-common: streamoperators.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,64 +70,52 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Typedefs
│ │ │ │ -
debugstream.hh File Reference
│ │ │ │ +Functions
│ │ │ │ +
streamoperators.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Defines several output streams for messages of different importance. │ │ │ │ +

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

│ │ │ │ -
#include <iostream>
│ │ │ │ -#include <stack>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ +
#include <array>
│ │ │ │ +#include <tuple>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ │
│ │ │ │

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.
 

│ │ │ │ +Functions

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

│ │ │ │ -

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

│ │ │ │ +

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

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,47 +1,35 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 | _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_:_:_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. │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +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 ********** │ │ │ │ │ -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 │ │ │ │ │ +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/a00167_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: debugstream.hh Source File │ │ │ │ +dune-common: streamoperators.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,333 +74,83 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
debugstream.hh
│ │ │ │ +
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 © 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_STREAMOPERATORS_HH
│ │ │ │ +
7#define DUNE_STREAMOPERATORS_HH
│ │ │ │
8
│ │ │ │ -
13#include <iostream>
│ │ │ │ -
14#include <stack>
│ │ │ │ -
15
│ │ │ │ - │ │ │ │ -
17
│ │ │ │ -
18namespace Dune {
│ │ │ │ -
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
│ │ │ │ +
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
│ │ │ │ +
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:256
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,375 +1,81 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -debugstream.hh │ │ │ │ │ +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 © 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_STREAMOPERATORS_HH │ │ │ │ │ +7#define DUNE_STREAMOPERATORS_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 { │ │ │ │ │ -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 │ │ │ │ │ +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 │ │ │ │ │ +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:256 │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: hash.hh File Reference │ │ │ │ +dune-common: proxymemberaccess.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,180 +70,42 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ Functions
│ │ │ │ -
hash.hh File Reference
│ │ │ │ +
proxymemberaccess.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

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

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

Go to the source code of this file.

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

│ │ │ │ -Classes

struct  Dune::hash< T >
 Functor for hashing objects of type T. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

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

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

│ │ │ │ -

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.

│ │ │ │ -

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ DUNE_DEFINE_HASH

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_DEFINE_HASH( template_args,
 type 
)
│ │ │ │ -
│ │ │ │ - │ │ │ │ -

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.

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

◆ DUNE_HASH_TYPE

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

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

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

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,129 +1,28 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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> │ │ │ │ │ +_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 │ │ │ │ │ _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_._._. │ │ │ │ │ -  │ │ │ │ │ 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. │ │ │ │ │ -  │ │ │ │ │ -#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. │ │ │ │ │ -  │ │ │ │ │ -#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. │ │ │ │ │ -  │ │ │ │ │ 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. │ │ │ │ │ +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 ********** │ │ │ │ │ -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. │ │ │ │ │ -********** 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. │ │ │ │ │ +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/a00170_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: hash.hh Source File │ │ │ │ +dune-common: proxymemberaccess.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,289 +74,107 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
hash.hh
│ │ │ │ +
proxymemberaccess.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 © 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_COMMON_PROXYMEMBERACCESS_HH
│ │ │ │ +
6#define DUNE_COMMON_PROXYMEMBERACCESS_HH
│ │ │ │
7
│ │ │ │ -
8#include <functional>
│ │ │ │ -
9
│ │ │ │ - │ │ │ │ -
11
│ │ │ │ -
24// ********************************************************************************
│ │ │ │ -
25// Doxygen documentation
│ │ │ │ -
26// ********************************************************************************
│ │ │ │ -
27
│ │ │ │ -
28#ifdef DOXYGEN
│ │ │ │ -
29
│ │ │ │ -
30namespace Dune {
│ │ │ │ +
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 {}
│ │ │ │
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 }
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ +
44
│ │ │ │ +
45
│ │ │ │ +
46#ifdef DOXYGEN
│ │ │ │
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(...)
│ │ │ │ +
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#else // DOXYGEN - hide all the ugly implementation
│ │ │ │ +
119#endif // DOXYGEN
│ │ │ │
120
│ │ │ │ -
121
│ │ │ │ +
121} // namespace Dune
│ │ │ │
122
│ │ │ │ -
123// ********************************************************************************
│ │ │ │ -
124// C++11 support
│ │ │ │ -
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
│ │ │ │ -
194
│ │ │ │ -
195
│ │ │ │ -
196
│ │ │ │ -
197// ********************************************************************************
│ │ │ │ -
198// Some utility functions for combining hashes of member variables.
│ │ │ │ -
199// ********************************************************************************
│ │ │ │ -
200
│ │ │ │ -
201namespace Dune {
│ │ │ │ -
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
│ │ │ │ -
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 }
│ │ │ │ -
262
│ │ │ │ -
263 };
│ │ │ │ -
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.
│ │ │ │ -
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 }
│ │ │ │ -
│ │ │ │ -
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.
│ │ │ │ +
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).
│ │ │ │ +
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 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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,329 +1,110 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -hash.hh │ │ │ │ │ +proxymemberaccess.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 © 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_COMMON_PROXYMEMBERACCESS_HH │ │ │ │ │ +6#define DUNE_COMMON_PROXYMEMBERACCESS_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 { │ │ │ │ │ +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 {} │ │ │ │ │ 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 } │ │ │ │ │ +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 │ │ │ │ │ +44 │ │ │ │ │ +45 │ │ │ │ │ +46#ifdef DOXYGEN │ │ │ │ │ 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(...) │ │ │ │ │ +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#else // DOXYGEN - hide all the ugly implementation │ │ │ │ │ +119#endif // DOXYGEN │ │ │ │ │ 120 │ │ │ │ │ -121 │ │ │ │ │ +121} // namespace Dune │ │ │ │ │ 122 │ │ │ │ │ -123/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -124// C++11 support │ │ │ │ │ -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 │ │ │ │ │ -194 │ │ │ │ │ -195 │ │ │ │ │ -196 │ │ │ │ │ -197/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -198// Some utility functions for combining hashes of member variables. │ │ │ │ │ -199/ │ │ │ │ │ -/ │ │ │ │ │ -******************************************************************************** │ │ │ │ │ -200 │ │ │ │ │ -201namespace _D_u_n_e { │ │ │ │ │ -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 │ │ │ │ │ -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; │ │ │ │ │ -261 } │ │ │ │ │ -262 │ │ │ │ │ -263 }; │ │ │ │ │ -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. │ │ │ │ │ -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 │ │ │ │ │ -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 } │ │ │ │ │ -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); │ │ │ │ │ -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. │ │ │ │ │ +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). │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: interfaces.hh File Reference │ │ │ │ +dune-common: debugalign.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,39 +71,379 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
interfaces.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Macros | │ │ │ │ +Typedefs | │ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ +
debugalign.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ - │ │ │ │ +
#include <algorithm>
│ │ │ │ +#include <cassert>
│ │ │ │ +#include <cmath>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <cstdint>
│ │ │ │ +#include <cstdlib>
│ │ │ │ +#include <functional>
│ │ │ │ +#include <istream>
│ │ │ │ +#include <ostream>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#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

struct  Dune::Cloneable
 An interface class for cloneable objects. More...
struct  Dune::AlignedBase< align, Impl >
 CRTP base mixin class to check alignment. More...
 
struct  Dune::IsNumber< AlignedNumberImpl::AlignedNumber< T, align > >
 
class  Dune::AlignedNumberImpl::AlignedNumber< T, align >
 aligned wrappers for arithmetic types More...
 
struct  Dune::Simd::Overloads::ScalarType< AlignedNumber< T, align > >
 
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

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

static constexpr auto Dune::debugAlignment = 2*alignof(std::max_align_t)
 an alignment large enough to trigger alignment errors
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Provides interfaces for detection of specific behavior.

│ │ │ │ -
Author
Robert Kloefkorn
│ │ │ │ -
│ │ │ │ +

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,24 +1,388 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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_._._. │ │ │ │ │ +_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 <_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 │ │ │ │ │ -struct   _D_u_n_e_:_:_C_l_o_n_e_a_b_l_e │ │ │ │ │ -  An interface class for cloneable objects. _M_o_r_e_._._. │ │ │ │ │ +struct   _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_._._. │ │ │ │ │ +  │ │ │ │ │ +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_:_:_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_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +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. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides interfaces for detection of specific behavior. │ │ │ │ │ - Author │ │ │ │ │ - Robert Kloefkorn │ │ │ │ │ +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 │ │ │ │ │ + _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 │ │ │ │ │ +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/a00173_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: interfaces.hh Source File │ │ │ │ +dune-common: debugalign.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,42 +74,657 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
interfaces.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 © 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_DEBUGALIGN_HH
│ │ │ │ +
6#define DUNE_DEBUGALIGN_HH
│ │ │ │
7
│ │ │ │ -
13namespace Dune {
│ │ │ │ -
14
│ │ │ │ -
│ │ │ │ -
16 struct Cloneable {
│ │ │ │ -
17
│ │ │ │ -
23 virtual Cloneable* clone() const = 0;
│ │ │ │ -
24
│ │ │ │ -
26 virtual ~Cloneable() = default;
│ │ │ │ -
27
│ │ │ │ -
28 };
│ │ │ │ -
│ │ │ │ -
29
│ │ │ │ -
30} // end namespace Dune
│ │ │ │ -
31#endif
│ │ │ │ +
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
│ │ │ │ +
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 void* aligned_p = (void*)p;
│ │ │ │ +
59 std::size_t space = align*2;
│ │ │ │ +
60 return p == std::align(align, align, aligned_p, space);
│ │ │ │ +
61 }
│ │ │ │ +
│ │ │ │ +
62
│ │ │ │ +
64 template<std::size_t align, class Impl>
│ │ │ │ +
│ │ │ │ +
65 struct alignas(align) AlignedBase
│ │ │ │ +
66 {
│ │ │ │ +
│ │ │ │ +
75 static void* operator new(std::size_t count, void* ptr) {
│ │ │ │ +
76 if(!isAligned(ptr, align))
│ │ │ │ +
77 violatedAlignment(className<Impl>().c_str(), align, ptr);
│ │ │ │ +
78 return ::operator new(count*sizeof(Impl), ptr);
│ │ │ │ +
79 }
│ │ │ │ +
│ │ │ │ +
80
│ │ │ │ +
│ │ │ │ +
89 static void* operator new[](std::size_t count, void* ptr) {
│ │ │ │ +
90 if(!isAligned(ptr, align))
│ │ │ │ +
91 violatedAlignment(className<Impl>().c_str(), align, ptr);
│ │ │ │ +
92 return ::operator new[](count*sizeof(Impl), ptr);
│ │ │ │ +
93 }
│ │ │ │ +
│ │ │ │ +
94 };
│ │ │ │ +
│ │ │ │ +
95
│ │ │ │ +
97 static constexpr auto debugAlignment = 2*alignof(std::max_align_t);
│ │ │ │ +
98
│ │ │ │ +
│ │ │ │ +
99 namespace AlignedNumberImpl {
│ │ │ │ +
100
│ │ │ │ +
101 template<class T, std::size_t align = debugAlignment>
│ │ │ │ +
102 class AlignedNumber;
│ │ │ │ +
103
│ │ │ │ +
104 } // namespace AlignedNumberImpl
│ │ │ │ +
│ │ │ │ +
105
│ │ │ │ + │ │ │ │ +
107
│ │ │ │ +
108 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
109 struct IsNumber<AlignedNumberImpl::AlignedNumber<T,align>>
│ │ │ │ +
110 : public std::true_type {};
│ │ │ │ +
│ │ │ │ +
111
│ │ │ │ +
113 template<std::size_t align = debugAlignment, class T>
│ │ │ │ +
114 AlignedNumber<T, align> aligned(T value) { return { std::move(value) }; }
│ │ │ │ +
115
│ │ │ │ +
116 // The purpose of this namespace is to move the `<cmath>` function overloads
│ │ │ │ +
117 // out of namespace `Dune`. This avoids problems where people called
│ │ │ │ +
118 // e.g. `sqrt(1.0)` inside the `Dune` namespace, without first doing `using
│ │ │ │ +
119 // std::sqrt;`. Without any `Dune::sqrt()`, such a use will find
│ │ │ │ +
120 // `::sqrt()`, but with `Dune::sqrt()` it will find only `Dune::sqrt()`,
│ │ │ │ +
121 // which does not have an overload for `double`.
│ │ │ │ +
122 namespace AlignedNumberImpl {
│ │ │ │ +
123
│ │ │ │ +
125 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
127 : public AlignedBase<align, AlignedNumber<T, align> >
│ │ │ │ +
128 {
│ │ │ │ +
129 T value_;
│ │ │ │ +
130
│ │ │ │ +
131 public:
│ │ │ │ +
132 AlignedNumber() = default;
│ │ │ │ +
133 AlignedNumber(T value) : value_(std::move(value)) {}
│ │ │ │ +
134 template<class U, std::size_t uAlign,
│ │ │ │ +
135 class = std::enable_if_t<(align >= uAlign) &&
│ │ │ │ +
136 std::is_convertible<U, T>::value> >
│ │ │ │ +
137 AlignedNumber(const AlignedNumber<U, uAlign> &o) : value_(U(o)) {}
│ │ │ │ +
138
│ │ │ │ +
139 // accessors
│ │ │ │ +
140 template<class U,
│ │ │ │ +
141 class = std::enable_if_t<std::is_convertible<T, U>::value> >
│ │ │ │ +
142 explicit operator U() const { return value_; }
│ │ │ │ +
143
│ │ │ │ +
144 const T &value() const { return value_; }
│ │ │ │ +
145 T &value() { return value_; }
│ │ │ │ +
146
│ │ │ │ +
147 // I/O
│ │ │ │ +
148 template<class charT, class Traits>
│ │ │ │ +
149 friend std::basic_istream<charT, Traits>&
│ │ │ │ +
│ │ │ │ +
150 operator>>(std::basic_istream<charT, Traits>& str, AlignedNumber &u)
│ │ │ │ +
151 {
│ │ │ │ +
152 return str >> u.value_;
│ │ │ │ +
153 }
│ │ │ │ +
│ │ │ │ +
154
│ │ │ │ +
155 template<class charT, class Traits>
│ │ │ │ +
│ │ │ │ +
156 friend std::basic_ostream<charT, Traits>&
│ │ │ │ +
157 operator<<(std::basic_ostream<charT, Traits>& str,
│ │ │ │ +
158 const AlignedNumber &u)
│ │ │ │ +
159 {
│ │ │ │ +
160 return str << u.value_;
│ │ │ │ +
161 }
│ │ │ │ +
│ │ │ │ +
162
│ │ │ │ +
163 // The trick with `template<class U = T, class = std::void_t<expr(U)> >` is
│ │ │ │ +
164 // needed because at least g++-4.9 seems to evaluates a default argument
│ │ │ │ +
165 // in `template<class = std::void_t<expr(T))> >` as soon as possible and will
│ │ │ │ +
166 // error out if `expr(T)` is invalid. E.g. for `expr(T)` =
│ │ │ │ +
167 // `decltype(--std::declval<T&>())`, instantiating `AlignedNumber<bool>`
│ │ │ │ +
168 // will result in an unrecoverable error (`--` cannot be applied to a
│ │ │ │ +
169 // `bool`).
│ │ │ │ +
170
│ │ │ │ +
171 // Increment, decrement
│ │ │ │ +
172 template<class U = T, class = std::void_t<decltype(++std::declval<U&>())> >
│ │ │ │ +
173 AlignedNumber &operator++() { ++value_; return *this; }
│ │ │ │ +
174
│ │ │ │ +
175 template<class U = T, class = std::void_t<decltype(--std::declval<U&>())> >
│ │ │ │ +
176 AlignedNumber &operator--() { --value_; return *this; }
│ │ │ │ +
177
│ │ │ │ +
178 template<class U = T, class = std::void_t<decltype(std::declval<U&>()++)> >
│ │ │ │ +
179 decltype(auto) operator++(int) { return aligned<align>(value_++); }
│ │ │ │ +
180
│ │ │ │ +
181 template<class U = T, class = std::void_t<decltype(std::declval<U&>()--)> >
│ │ │ │ +
182 decltype(auto) operator--(int) { return aligned<align>(value_--); }
│ │ │ │ +
183
│ │ │ │ +
184 // unary operators
│ │ │ │ +
185 template<class U = T,
│ │ │ │ +
186 class = std::void_t<decltype(+std::declval<const U&>())> >
│ │ │ │ +
187 decltype(auto) operator+() const { return aligned<align>(+value_); }
│ │ │ │ +
188
│ │ │ │ +
189 template<class U = T,
│ │ │ │ +
190 class = std::void_t<decltype(-std::declval<const U&>())> >
│ │ │ │ +
191 decltype(auto) operator-() const { return aligned<align>(-value_); }
│ │ │ │ +
192
│ │ │ │ +
193 /*
│ │ │ │ +
194 * silence warnings from GCC about using `~` on a bool
│ │ │ │ +
195 * (when instantiated for T=bool)
│ │ │ │ +
196 */
│ │ │ │ +
197#if __GNUC__ >= 7
│ │ │ │ +
198# pragma GCC diagnostic push
│ │ │ │ +
199# pragma GCC diagnostic ignored "-Wbool-operation"
│ │ │ │ +
200#endif
│ │ │ │ +
201#ifdef __clang__
│ │ │ │ +
202# pragma clang diagnostic push
│ │ │ │ +
203# pragma clang diagnostic ignored "-Wbool-operation"
│ │ │ │ +
204#endif
│ │ │ │ +
205 template<class U = T,
│ │ │ │ +
206 class = std::void_t<decltype(~std::declval<const U&>())> >
│ │ │ │ +
207 decltype(auto) operator~() const { return aligned<align>(~value_); }
│ │ │ │ +
208#if __GNUC__ >= 7
│ │ │ │ +
209# pragma GCC diagnostic pop
│ │ │ │ +
210#endif
│ │ │ │ +
211#ifdef __clang__
│ │ │ │ +
212# pragma clang diagnostic pop
│ │ │ │ +
213#endif
│ │ │ │ +
214
│ │ │ │ +
215 template<class U = T,
│ │ │ │ +
216 class = std::void_t<decltype(!std::declval<const U&>())> >
│ │ │ │ +
217 decltype(auto) operator!() const { return aligned<align>(!value_); }
│ │ │ │ +
218
│ │ │ │ +
219 // assignment operators
│ │ │ │ +
│ │ │ │ +
220#define DUNE_ASSIGN_OP(OP) \
│ │ │ │ +
221 template<class U, std::size_t uAlign, \
│ │ │ │ +
222 class = std::enable_if_t< \
│ │ │ │ +
223 ( uAlign <= align && \
│ │ │ │ +
224 sizeof(std::declval<T&>() OP std::declval<U>()) ) \
│ │ │ │ +
225 > > \
│ │ │ │ +
226 AlignedNumber &operator OP(const AlignedNumber<U, uAlign> &u) \
│ │ │ │ +
227 { \
│ │ │ │ +
228 value_ OP U(u); \
│ │ │ │ +
229 return *this; \
│ │ │ │ +
230 } \
│ │ │ │ +
231 \
│ │ │ │ +
232 template<class U, \
│ │ │ │ +
233 class = std::void_t<decltype(std::declval<T&>() OP \
│ │ │ │ +
234 std::declval<U>())> > \
│ │ │ │ +
235 AlignedNumber &operator OP(const U &u) \
│ │ │ │ +
236 { \
│ │ │ │ +
237 value_ OP u; \
│ │ │ │ +
238 return *this; \
│ │ │ │ +
239 } \
│ │ │ │ +
240 \
│ │ │ │ +
241 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ +
│ │ │ │ +
242
│ │ │ │ + │ │ │ │ + │ │ │ │ +
245
│ │ │ │ + │ │ │ │ +
247 DUNE_ASSIGN_OP(/=);
│ │ │ │ +
248 DUNE_ASSIGN_OP(%=);
│ │ │ │ +
249
│ │ │ │ + │ │ │ │ +
251 DUNE_ASSIGN_OP(&=);
│ │ │ │ +
252 DUNE_ASSIGN_OP(|=);
│ │ │ │ +
253
│ │ │ │ + │ │ │ │ + │ │ │ │ +
256
│ │ │ │ +
257#undef DUNE_ASSIGN_OP
│ │ │ │ +
258 };
│ │ │ │ +
│ │ │ │ +
259
│ │ │ │ +
260 // binary operators
│ │ │ │ +
│ │ │ │ +
261#define DUNE_BINARY_OP(OP) \
│ │ │ │ +
262 template<class T, std::size_t tAlign, class U, std::size_t uAlign, \
│ │ │ │ +
263 class = std::void_t<decltype(std::declval<T>() \
│ │ │ │ +
264 OP std::declval<U>())> > \
│ │ │ │ +
265 decltype(auto) \
│ │ │ │ +
266 operator OP(const AlignedNumber<T, tAlign> &t, \
│ │ │ │ +
267 const AlignedNumber<U, uAlign> &u) \
│ │ │ │ +
268 { \
│ │ │ │ +
269 /* can't use std::max(); not constexpr */ \
│ │ │ │ +
270 return aligned<(tAlign > uAlign ? tAlign : uAlign)>(T(t) OP U(u)); \
│ │ │ │ +
271 } \
│ │ │ │ +
272 \
│ │ │ │ +
273 template<class T, class U, std::size_t uAlign, \
│ │ │ │ +
274 class = std::void_t<decltype(std::declval<T>() \
│ │ │ │ +
275 OP std::declval<U>())> > \
│ │ │ │ +
276 decltype(auto) \
│ │ │ │ +
277 operator OP(const T &t, const AlignedNumber<U, uAlign> &u) \
│ │ │ │ +
278 { \
│ │ │ │ +
279 return aligned<uAlign>(t OP U(u)); \
│ │ │ │ +
280 } \
│ │ │ │ +
281 \
│ │ │ │ +
282 template<class T, std::size_t tAlign, class U, \
│ │ │ │ +
283 class = std::void_t<decltype(std::declval<T>() \
│ │ │ │ +
284 OP std::declval<U>())> > \
│ │ │ │ +
285 decltype(auto) \
│ │ │ │ +
286 operator OP(const AlignedNumber<T, tAlign> &t, const U &u) \
│ │ │ │ +
287 { \
│ │ │ │ +
288 return aligned<tAlign>(T(t) OP u); \
│ │ │ │ +
289 } \
│ │ │ │ +
290 \
│ │ │ │ +
291 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ +
│ │ │ │ +
292
│ │ │ │ + │ │ │ │ + │ │ │ │ +
295
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
299
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
303
│ │ │ │ + │ │ │ │ + │ │ │ │ +
306
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
313
│ │ │ │ + │ │ │ │ +
315 DUNE_BINARY_OP(||);
│ │ │ │ +
316
│ │ │ │ +
317#undef DUNE_BINARY_OP
│ │ │ │ +
318
│ │ │ │ +
320 //
│ │ │ │ +
321 // Overloads for the functions provided by the standard library
│ │ │ │ +
322 //
│ │ │ │ +
323#define DUNE_UNARY_FUNC(name) \
│ │ │ │ +
324 template<class T, std::size_t align> \
│ │ │ │ +
325 decltype(auto) name(const AlignedNumber<T, align> &u) \
│ │ │ │ +
326 { \
│ │ │ │ +
327 using std::name; \
│ │ │ │ +
328 return aligned<align>(name(T(u))); \
│ │ │ │ +
329 } \
│ │ │ │ +
330 static_assert(true, "Require semicolon to unconfuse editors")
│ │ │ │ +
331
│ │ │ │ +
332 //
│ │ │ │ +
333 // <cmath> functions
│ │ │ │ +
334 //
│ │ │ │ +
335
│ │ │ │ +
336 // note: only unary functions are provided at the moment. Getting all the
│ │ │ │ +
337 // overloads right for functions with more than one argument is tricky.
│ │ │ │ +
338 // All <cmath> functions appear in the list below in the order they are
│ │ │ │ +
339 // listed in in the standard, but the unimplemented ones are commented
│ │ │ │ +
340 // out.
│ │ │ │ +
341
│ │ │ │ +
342 // note: abs is provided by both <cstdlib> (for integer) and <cmath> (for
│ │ │ │ +
343 // floating point). This overload works for both.
│ │ │ │ +
344 DUNE_UNARY_FUNC(abs);
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
350 // atan2
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
354 // copysign
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
363 // fdim
│ │ │ │ + │ │ │ │ +
365 // fma
│ │ │ │ +
366 // fmax
│ │ │ │ +
367 // fmin
│ │ │ │ +
368 // fmod
│ │ │ │ +
369 // frexp
│ │ │ │ +
370 // hypos
│ │ │ │ + │ │ │ │ +
372 // ldexp
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
383 // modf
│ │ │ │ +
384 DUNE_UNARY_FUNC(nearbyint);
│ │ │ │ +
385 // nextafter
│ │ │ │ +
386 // nexttoward
│ │ │ │ +
387 // pow
│ │ │ │ +
388 // remainder
│ │ │ │ +
389 // remquo
│ │ │ │ + │ │ │ │ + │ │ │ │ +
392 // scalbln
│ │ │ │ +
393 // scalbn
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
401
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
407
│ │ │ │ +
408 // isgreater
│ │ │ │ +
409 // isgreaterequal
│ │ │ │ +
410 // isless
│ │ │ │ +
411 // islessequal
│ │ │ │ +
412 // islessgreater
│ │ │ │ +
413 // isunordered
│ │ │ │ +
414
│ │ │ │ +
415 //
│ │ │ │ +
416 // <complex> functions
│ │ │ │ +
417 //
│ │ │ │ +
418
│ │ │ │ +
419 // not all functions are implemented, and unlike for <cmath>, no
│ │ │ │ +
420 // comprehensive list is provided
│ │ │ │ + │ │ │ │ +
422
│ │ │ │ +
423#undef DUNE_UNARY_FUNC
│ │ │ │ +
424
│ │ │ │ +
425 // We need to overload min() and max() since they require types to be
│ │ │ │ +
426 // LessThanComparable, which requires `a<b` to be "convertible to bool".
│ │ │ │ +
427 // That wording seems to be a leftover from C++03, and today is probably
│ │ │ │ +
428 // equivalent to "implicitly convertible". There is also issue 2114
│ │ │ │ +
429 // <https://cplusplus.github.io/LWG/issue2114> in the standard (still open
│ │ │ │ +
430 // as of 2018-07-06), which strives to require both "implicitly" and
│ │ │ │ +
431 // "contextually" convertible -- plus a few other things.
│ │ │ │ +
432 //
│ │ │ │ +
433 // We do not want our debug type to automatically decay to the underlying
│ │ │ │ +
434 // type, so we do not want to make the conversion non-explicit. So the
│ │ │ │ +
435 // only option left is to overload min() and max().
│ │ │ │ +
436
│ │ │ │ +
437 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
438 auto max(const AlignedNumber<T, align> &a,
│ │ │ │ + │ │ │ │ +
440 {
│ │ │ │ +
441 using std::max;
│ │ │ │ +
442 return aligned<align>(max(T(a), T(b)));
│ │ │ │ +
443 }
│ │ │ │ +
│ │ │ │ +
444
│ │ │ │ +
445 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
446 auto max(const T &a, const AlignedNumber<T, align> &b)
│ │ │ │ +
447 {
│ │ │ │ +
448 using std::max;
│ │ │ │ +
449 return aligned<align>(max(a, T(b)));
│ │ │ │ +
450 }
│ │ │ │ +
│ │ │ │ +
451
│ │ │ │ +
452 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
453 auto max(const AlignedNumber<T, align> &a, const T &b)
│ │ │ │ +
454 {
│ │ │ │ +
455 using std::max;
│ │ │ │ +
456 return aligned<align>(max(T(a), b));
│ │ │ │ +
457 }
│ │ │ │ +
│ │ │ │ +
458
│ │ │ │ +
459 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
460 auto min(const AlignedNumber<T, align> &a,
│ │ │ │ + │ │ │ │ +
462 {
│ │ │ │ +
463 using std::min;
│ │ │ │ +
464 return aligned<align>(min(T(a), T(b)));
│ │ │ │ +
465 }
│ │ │ │ +
│ │ │ │ +
466
│ │ │ │ +
467 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
468 auto min(const T &a, const AlignedNumber<T, align> &b)
│ │ │ │ +
469 {
│ │ │ │ +
470 using std::min;
│ │ │ │ +
471 return aligned<align>(min(a, T(b)));
│ │ │ │ +
472 }
│ │ │ │ +
│ │ │ │ +
473
│ │ │ │ +
474 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
475 auto min(const AlignedNumber<T, align> &a, const T &b)
│ │ │ │ +
476 {
│ │ │ │ +
477 using std::min;
│ │ │ │ +
478 return aligned<align>(min(T(a), b));
│ │ │ │ +
479 }
│ │ │ │ +
│ │ │ │ +
480
│ │ │ │ +
481 } // namespace AlignedNumberImpl
│ │ │ │ +
482
│ │ │ │ +
483 // SIMD-like functions from "conditional.hh"
│ │ │ │ +
484 template<class T, std::size_t align>
│ │ │ │ +
485 AlignedNumber<T, align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
488 {
│ │ │ │ +
489 return b ? v1 : v2;
│ │ │ │ +
490 }
│ │ │ │ +
│ │ │ │ +
491
│ │ │ │ +
492 // SIMD-like functions from "rangeutilities.hh"
│ │ │ │ +
493 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
495 {
│ │ │ │ +
496 return T(val);
│ │ │ │ +
497 }
│ │ │ │ +
│ │ │ │ +
498
│ │ │ │ +
499 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
501 {
│ │ │ │ +
502 return T(val);
│ │ │ │ +
503 }
│ │ │ │ +
│ │ │ │ +
504
│ │ │ │ +
505 template<std::size_t align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
507 {
│ │ │ │ +
508 return bool(val);
│ │ │ │ +
509 }
│ │ │ │ +
│ │ │ │ +
510
│ │ │ │ +
511 template<std::size_t align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
513 {
│ │ │ │ +
514 return bool(val);
│ │ │ │ +
515 }
│ │ │ │ +
│ │ │ │ +
516
│ │ │ │ +
517 // SIMD-like functionality from "simd/interface.hh"
│ │ │ │ +
│ │ │ │ +
518 namespace Simd {
│ │ │ │ +
│ │ │ │ +
519 namespace Overloads {
│ │ │ │ +
520
│ │ │ │ +
521 template<class T, std::size_t align>
│ │ │ │ + │ │ │ │ +
523
│ │ │ │ +
524 template<class U, class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
525 struct RebindType<U, AlignedNumber<T, align> > {
│ │ │ │ + │ │ │ │ +
527 };
│ │ │ │ +
│ │ │ │ +
528
│ │ │ │ +
529 template<class T, std::size_t align>
│ │ │ │ +
530 struct LaneCount<AlignedNumber<T, align> > : index_constant<1> {};
│ │ │ │ +
531
│ │ │ │ +
532 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
534 {
│ │ │ │ +
535 assert(l == 0);
│ │ │ │ +
536 return v.value();
│ │ │ │ +
537 }
│ │ │ │ +
│ │ │ │ +
538
│ │ │ │ +
539 template<class T, std::size_t align>
│ │ │ │ +
│ │ │ │ +
540 T lane(ADLTag<5>, std::size_t l, const AlignedNumber<T, align> &v)
│ │ │ │ +
541 {
│ │ │ │ +
542 assert(l == 0);
│ │ │ │ +
543 return v.value();
│ │ │ │ +
544 }
│ │ │ │ +
│ │ │ │ +
545
│ │ │ │ +
546 template<class T, std::size_t align>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
549 const AlignedNumber<T, align> &ifTrue,
│ │ │ │ +
550 const AlignedNumber<T, align> &ifFalse)
│ │ │ │ +
551 {
│ │ │ │ +
552 return mask ? ifTrue : ifFalse;
│ │ │ │ +
553 }
│ │ │ │ +
│ │ │ │ +
554
│ │ │ │ +
555 template<std::size_t align>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
557 {
│ │ │ │ +
558 return bool(mask);
│ │ │ │ +
559 }
│ │ │ │ +
│ │ │ │ +
560
│ │ │ │ +
561 } // namespace Overloads
│ │ │ │ +
│ │ │ │ +
562
│ │ │ │ +
563 } // namespace Simd
│ │ │ │ +
│ │ │ │ +
564
│ │ │ │ +
565} // namespace Dune
│ │ │ │ +
566
│ │ │ │ +
567#endif // DUNE_DEBUGALIGN_HH
│ │ │ │ + │ │ │ │ +
Traits for type conversions and type information.
│ │ │ │ +
#define DUNE_BINARY_OP(OP)
Definition debugalign.hh:261
│ │ │ │ +
#define DUNE_UNARY_FUNC(name)
│ │ │ │ +
#define DUNE_ASSIGN_OP(OP)
Definition debugalign.hh:220
│ │ │ │ +
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.
│ │ │ │ +
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition indices.hh:29
│ │ │ │ +
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
│ │ │ │ -
An interface class for cloneable objects.
Definition interfaces.hh:16
│ │ │ │ -
virtual ~Cloneable()=default
Destructor.
│ │ │ │ -
virtual Cloneable * clone() const =0
Clones the object clone needs to be redefined by an implementation class, with the return type covari...
│ │ │ │ +
void violatedAlignment(const char *className, std::size_t expectedAlignment, const void *address)
called when an alignment violation is detected
Definition debugalign.cc:36
│ │ │ │ +
bool any_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:506
│ │ │ │ +
bool all_true(const AlignedNumber< bool, align > &val)
Definition debugalign.hh:512
│ │ │ │ +
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:97
│ │ │ │ +
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:114
│ │ │ │ +
ViolatedAlignmentHandler & violatedAlignmentHandler()
access the handler called by violatedAlignment()
Definition debugalign.cc:30
│ │ │ │ +
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:494
│ │ │ │ +
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:500
│ │ │ │ +
bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
Definition debugalign.hh:556
│ │ │ │ +
T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
Definition debugalign.hh:533
│ │ │ │ +
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
│ │ │ │ +
aligned wrappers for arithmetic types
Definition debugalign.hh:128
│ │ │ │ + │ │ │ │ + │ │ │ │ +
decltype(auto) operator+() const
Definition debugalign.hh:187
│ │ │ │ + │ │ │ │ +
decltype(auto) operator--(int)
Definition debugalign.hh:182
│ │ │ │ +
DUNE_ASSIGN_OP * DUNE_ASSIGN_OP(/=);DUNE_ASSIGN_OP(%=
│ │ │ │ +
decltype(auto) operator++(int)
Definition debugalign.hh:179
│ │ │ │ +
decltype(auto) operator!() const
Definition debugalign.hh:217
│ │ │ │ +
T & value()
Definition debugalign.hh:145
│ │ │ │ +
const T & value() const
Definition debugalign.hh:144
│ │ │ │ +
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:150
│ │ │ │ + │ │ │ │ + │ │ │ │ +
decltype(auto) operator~() const
Definition debugalign.hh:207
│ │ │ │ +
AlignedNumber(T value)
Definition debugalign.hh:133
│ │ │ │ +
AlignedNumber(const AlignedNumber< U, uAlign > &o)
Definition debugalign.hh:137
│ │ │ │ +
decltype(auto) operator-() const
Definition debugalign.hh:191
│ │ │ │ + │ │ │ │ +
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,43 +1,701 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -interfaces.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 © 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_DEBUGALIGN_HH │ │ │ │ │ +6#define DUNE_DEBUGALIGN_HH │ │ │ │ │ 7 │ │ │ │ │ -13namespace _D_u_n_e { │ │ │ │ │ -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; │ │ │ │ │ -24 │ │ │ │ │ -_2_6 virtual _~_C_l_o_n_e_a_b_l_e() = default; │ │ │ │ │ -27 │ │ │ │ │ -28 }; │ │ │ │ │ -29 │ │ │ │ │ -30} // end namespace Dune │ │ │ │ │ -31#endif │ │ │ │ │ +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 │ │ │ │ │ +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 void* aligned_p = (void*)p; │ │ │ │ │ +59 std::size_t space = align*2; │ │ │ │ │ +60 return p == std::align(align, align, aligned_p, space); │ │ │ │ │ +61 } │ │ │ │ │ +62 │ │ │ │ │ +64 template │ │ │ │ │ +_6_5 struct alignas(align) _A_l_i_g_n_e_d_B_a_s_e │ │ │ │ │ +66 { │ │ │ │ │ +_7_5 static void* operator new(std::size_t count, void* ptr) { │ │ │ │ │ +76 if(!_i_s_A_l_i_g_n_e_d(ptr, align)) │ │ │ │ │ +77 _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t(className().c_str(), align, ptr); │ │ │ │ │ +78 return ::operator new(count*sizeof(Impl), ptr); │ │ │ │ │ +79 } │ │ │ │ │ +80 │ │ │ │ │ +_8_9 static void* operator new[](std::size_t count, void* ptr) { │ │ │ │ │ +90 if(!_i_s_A_l_i_g_n_e_d(ptr, align)) │ │ │ │ │ +91 _v_i_o_l_a_t_e_d_A_l_i_g_n_m_e_n_t(className().c_str(), align, ptr); │ │ │ │ │ +92 return ::operator new[](count*sizeof(Impl), ptr); │ │ │ │ │ +93 } │ │ │ │ │ +94 }; │ │ │ │ │ +95 │ │ │ │ │ +_9_7 static constexpr auto _d_e_b_u_g_A_l_i_g_n_m_e_n_t = 2*alignof(std::max_align_t); │ │ │ │ │ +98 │ │ │ │ │ +_9_9 namespace AlignedNumberImpl { │ │ │ │ │ +100 │ │ │ │ │ +101 template │ │ │ │ │ +102 class _A_l_i_g_n_e_d_N_u_m_b_e_r; │ │ │ │ │ +103 │ │ │ │ │ +104 } // namespace AlignedNumberImpl │ │ │ │ │ +105 │ │ │ │ │ +106 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; │ │ │ │ │ +107 │ │ │ │ │ +108 template │ │ │ │ │ +_1_0_9 struct _I_s_N_u_m_b_e_r> │ │ │ │ │ +110 : public std::true_type {}; │ │ │ │ │ +111 │ │ │ │ │ +113 template │ │ │ │ │ +_1_1_4 _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) }; } │ │ │ │ │ +115 │ │ │ │ │ +116 // The purpose of this namespace is to move the `` function │ │ │ │ │ +overloads │ │ │ │ │ +117 // out of namespace `Dune`. This avoids problems where people called │ │ │ │ │ +118 // e.g. `sqrt(1.0)` inside the `Dune` namespace, without first doing `using │ │ │ │ │ +119 // std::sqrt;`. Without any `Dune::sqrt()`, such a use will find │ │ │ │ │ +120 // `::sqrt()`, but with `Dune::sqrt()` it will find only `Dune::sqrt()`, │ │ │ │ │ +121 // which does not have an overload for `double`. │ │ │ │ │ +122 namespace AlignedNumberImpl { │ │ │ │ │ +123 │ │ │ │ │ +125 template │ │ │ │ │ +_1_2_6 class _A_l_i_g_n_e_d_N_u_m_b_e_r │ │ │ │ │ +127 : public _A_l_i_g_n_e_d_B_a_s_e > │ │ │ │ │ +128 { │ │ │ │ │ +129 T value_; │ │ │ │ │ +130 │ │ │ │ │ +131 public: │ │ │ │ │ +_1_3_2 _A_l_i_g_n_e_d_N_u_m_b_e_r() = default; │ │ │ │ │ +_1_3_3 _A_l_i_g_n_e_d_N_u_m_b_e_r(T value) : value_(_s_t_d::move(value)) {} │ │ │ │ │ +134 template= uAlign) && │ │ │ │ │ +136 std::is_convertible::value> > │ │ │ │ │ +_1_3_7 _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)) {} │ │ │ │ │ +138 │ │ │ │ │ +139 // accessors │ │ │ │ │ +140 template::value> > │ │ │ │ │ +_1_4_2 explicit operator U() const { return value_; } │ │ │ │ │ +143 │ │ │ │ │ +_1_4_4 const T &_v_a_l_u_e() const { return value_; } │ │ │ │ │ +_1_4_5 T &_v_a_l_u_e() { return value_; } │ │ │ │ │ +146 │ │ │ │ │ +147 // I/O │ │ │ │ │ +148 template │ │ │ │ │ +149 friend std::basic_istream& │ │ │ │ │ +_1_5_0 _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) │ │ │ │ │ +151 { │ │ │ │ │ +152 return str >> u.value_; │ │ │ │ │ +153 } │ │ │ │ │ +154 │ │ │ │ │ +155 template │ │ │ │ │ +_1_5_6 friend std::basic_ostream& │ │ │ │ │ +157 _o_p_e_r_a_t_o_r_<_<(std::basic_ostream& str, │ │ │ │ │ +158 const _A_l_i_g_n_e_d_N_u_m_b_e_r &u) │ │ │ │ │ +159 { │ │ │ │ │ +160 return str << u.value_; │ │ │ │ │ +161 } │ │ │ │ │ +162 │ │ │ │ │ +163 // The trick with `template >` is │ │ │ │ │ +164 // needed because at least g++-4.9 seems to evaluates a default argument │ │ │ │ │ +165 // in `template >` as soon as possible and │ │ │ │ │ +will │ │ │ │ │ +166 // error out if `expr(T)` is invalid. E.g. for `expr(T)` = │ │ │ │ │ +167 // `decltype(--std::declval())`, instantiating `AlignedNumber` │ │ │ │ │ +168 // will result in an unrecoverable error (`--` cannot be applied to a │ │ │ │ │ +169 // `bool`). │ │ │ │ │ +170 │ │ │ │ │ +171 // Increment, decrement │ │ │ │ │ +172 template())> > │ │ │ │ │ +_1_7_3 _A_l_i_g_n_e_d_N_u_m_b_e_r &operator++() { ++value_; return *this; } │ │ │ │ │ +174 │ │ │ │ │ +175 template())> > │ │ │ │ │ +_1_7_6 _A_l_i_g_n_e_d_N_u_m_b_e_r &operator--() { --value_; return *this; } │ │ │ │ │ +177 │ │ │ │ │ +178 template()++)> > │ │ │ │ │ +_1_7_9 decltype(auto) _o_p_e_r_a_t_o_r_+_+(int) { return aligned(value_++); } │ │ │ │ │ +180 │ │ │ │ │ +181 template()--)> > │ │ │ │ │ +_1_8_2 decltype(auto) _o_p_e_r_a_t_o_r_-_-(int) { return aligned(value_--); } │ │ │ │ │ +183 │ │ │ │ │ +184 // unary operators │ │ │ │ │ +185 template())> > │ │ │ │ │ +_1_8_7 decltype(auto) _o_p_e_r_a_t_o_r_+() const { return aligned(+value_); } │ │ │ │ │ +188 │ │ │ │ │ +189 template())> > │ │ │ │ │ +_1_9_1 decltype(auto) _o_p_e_r_a_t_o_r_-() const { return aligned(-value_); } │ │ │ │ │ +192 │ │ │ │ │ +193 /* │ │ │ │ │ +194 * silence warnings from GCC about using `~` on a bool │ │ │ │ │ +195 * (when instantiated for T=bool) │ │ │ │ │ +196 */ │ │ │ │ │ +197#if __GNUC__ >= 7 │ │ │ │ │ +198# pragma GCC diagnostic push │ │ │ │ │ +199# pragma GCC diagnostic ignored "-Wbool-operation" │ │ │ │ │ +200#endif │ │ │ │ │ +201#ifdef __clang__ │ │ │ │ │ +202# pragma clang diagnostic push │ │ │ │ │ +203# pragma clang diagnostic ignored "-Wbool-operation" │ │ │ │ │ +204#endif │ │ │ │ │ +205 template())> > │ │ │ │ │ +_2_0_7 decltype(auto) _o_p_e_r_a_t_o_r_~() const { return aligned(~value_); } │ │ │ │ │ +208#if __GNUC__ >= 7 │ │ │ │ │ +209# pragma GCC diagnostic pop │ │ │ │ │ +210#endif │ │ │ │ │ +211#ifdef __clang__ │ │ │ │ │ +212# pragma clang diagnostic pop │ │ │ │ │ +213#endif │ │ │ │ │ +214 │ │ │ │ │ +215 template())> > │ │ │ │ │ +_2_1_7 decltype(auto) _o_p_e_r_a_t_o_r_!() const { return aligned(!value_); } │ │ │ │ │ +218 │ │ │ │ │ +219 // assignment operators │ │ │ │ │ +_2_2_0#define DUNE_ASSIGN_OP(OP) \ │ │ │ │ │ +221 template() OP std::declval()) ) \ │ │ │ │ │ +225 > > \ │ │ │ │ │ +226 AlignedNumber &operator OP(const AlignedNumber &u) \ │ │ │ │ │ +227 { \ │ │ │ │ │ +228 value_ OP U(u); \ │ │ │ │ │ +229 return *this; \ │ │ │ │ │ +230 } \ │ │ │ │ │ +231 \ │ │ │ │ │ +232 template() OP \ │ │ │ │ │ +234 std::declval())> > \ │ │ │ │ │ +235 AlignedNumber &operator OP(const U &u) \ │ │ │ │ │ +236 { \ │ │ │ │ │ +237 value_ OP u; \ │ │ │ │ │ +238 return *this; \ │ │ │ │ │ +239 } \ │ │ │ │ │ +240 \ │ │ │ │ │ +241 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +242 │ │ │ │ │ +_2_4_3 _D_U_N_E___A_S_S_I_G_N___O_P(+=); │ │ │ │ │ +_2_4_4 _D_U_N_E___A_S_S_I_G_N___O_P(-=); │ │ │ │ │ +245 │ │ │ │ │ +_2_4_6 _D_U_N_E___A_S_S_I_G_N___O_P(*=); │ │ │ │ │ +247 _D_U_N_E___A_S_S_I_G_N___O_P(/=); │ │ │ │ │ +248 _D_U_N_E___A_S_S_I_G_N___O_P(%=); │ │ │ │ │ +249 │ │ │ │ │ +_2_5_0 _D_U_N_E___A_S_S_I_G_N___O_P(^=); │ │ │ │ │ +251 _D_U_N_E___A_S_S_I_G_N___O_P(&=); │ │ │ │ │ +252 _D_U_N_E___A_S_S_I_G_N___O_P(|=); │ │ │ │ │ +253 │ │ │ │ │ +_2_5_4 _D_U_N_E___A_S_S_I_G_N___O_P(<<=); │ │ │ │ │ +_2_5_5 _D_U_N_E___A_S_S_I_G_N___O_P(>>=); │ │ │ │ │ +256 │ │ │ │ │ +257#undef DUNE_ASSIGN_OP │ │ │ │ │ +258 }; │ │ │ │ │ +259 │ │ │ │ │ +260 // binary operators │ │ │ │ │ +_2_6_1#define DUNE_BINARY_OP(OP) \ │ │ │ │ │ +262 template() \ │ │ │ │ │ +264 OP std::declval())> > \ │ │ │ │ │ +265 decltype(auto) \ │ │ │ │ │ +266 operator OP(const AlignedNumber &t, \ │ │ │ │ │ +267 const AlignedNumber &u) \ │ │ │ │ │ +268 { \ │ │ │ │ │ +269 /* can't use std::max(); not constexpr */ \ │ │ │ │ │ +270 return aligned<(tAlign > uAlign ? tAlign : uAlign)>(T(t) OP U(u)); \ │ │ │ │ │ +271 } \ │ │ │ │ │ +272 \ │ │ │ │ │ +273 template() \ │ │ │ │ │ +275 OP std::declval())> > \ │ │ │ │ │ +276 decltype(auto) \ │ │ │ │ │ +277 operator OP(const T &t, const AlignedNumber &u) \ │ │ │ │ │ +278 { \ │ │ │ │ │ +279 return aligned(t OP U(u)); \ │ │ │ │ │ +280 } \ │ │ │ │ │ +281 \ │ │ │ │ │ +282 template() \ │ │ │ │ │ +284 OP std::declval())> > \ │ │ │ │ │ +285 decltype(auto) \ │ │ │ │ │ +286 operator OP(const AlignedNumber &t, const U &u) \ │ │ │ │ │ +287 { \ │ │ │ │ │ +288 return aligned(T(t) OP u); \ │ │ │ │ │ +289 } \ │ │ │ │ │ +290 \ │ │ │ │ │ +291 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +292 │ │ │ │ │ +_2_9_3 _D_U_N_E___B_I_N_A_R_Y___O_P(+); │ │ │ │ │ +_2_9_4 _D_U_N_E___B_I_N_A_R_Y___O_P(-); │ │ │ │ │ +295 │ │ │ │ │ +_2_9_6 _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(/); │ │ │ │ │ +298 _D_U_N_E___B_I_N_A_R_Y___O_P(%); │ │ │ │ │ +299 │ │ │ │ │ +_3_0_0 _D_U_N_E___B_I_N_A_R_Y___O_P(^); │ │ │ │ │ +301 _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 │ │ │ │ │ +_3_0_4 _D_U_N_E___B_I_N_A_R_Y___O_P(<<); │ │ │ │ │ +_3_0_5 _D_U_N_E___B_I_N_A_R_Y___O_P(>>); │ │ │ │ │ +306 │ │ │ │ │ +_3_0_7 _D_U_N_E___B_I_N_A_R_Y___O_P(==); │ │ │ │ │ +_3_0_8 _D_U_N_E___B_I_N_A_R_Y___O_P(!=); │ │ │ │ │ +309 _D_U_N_E___B_I_N_A_R_Y___O_P(<); │ │ │ │ │ +310 _D_U_N_E___B_I_N_A_R_Y___O_P(>); │ │ │ │ │ +_3_1_1 _D_U_N_E___B_I_N_A_R_Y___O_P(<=); │ │ │ │ │ +_3_1_2 _D_U_N_E___B_I_N_A_R_Y___O_P(>=); │ │ │ │ │ +313 │ │ │ │ │ +_3_1_4 _D_U_N_E___B_I_N_A_R_Y___O_P(&&); │ │ │ │ │ +315 _D_U_N_E___B_I_N_A_R_Y___O_P(||); │ │ │ │ │ +316 │ │ │ │ │ +317#undef DUNE_BINARY_OP │ │ │ │ │ +318 │ │ │ │ │ +320 // │ │ │ │ │ +321 // Overloads for the functions provided by the standard library │ │ │ │ │ +322 // │ │ │ │ │ +323#define DUNE_UNARY_FUNC(name) \ │ │ │ │ │ +324 template \ │ │ │ │ │ +325 decltype(auto) name(const AlignedNumber &u) \ │ │ │ │ │ +326 { \ │ │ │ │ │ +327 using std::name; \ │ │ │ │ │ +328 return aligned(name(T(u))); \ │ │ │ │ │ +329 } \ │ │ │ │ │ +330 static_assert(true, "Require semicolon to unconfuse editors") │ │ │ │ │ +331 │ │ │ │ │ +332 // │ │ │ │ │ +333 // functions │ │ │ │ │ +334 // │ │ │ │ │ +335 │ │ │ │ │ +336 // note: only unary functions are provided at the moment. Getting all the │ │ │ │ │ +337 // overloads right for functions with more than one argument is tricky. │ │ │ │ │ +338 // All functions appear in the list below in the order they are │ │ │ │ │ +339 // listed in in the standard, but the unimplemented ones are commented │ │ │ │ │ +340 // out. │ │ │ │ │ +341 │ │ │ │ │ +342 // note: abs is provided by both (for integer) and (for │ │ │ │ │ +343 // floating point). This overload works for both. │ │ │ │ │ +344 _D_U_N_E___U_N_A_R_Y___F_U_N_C(abs); │ │ │ │ │ +_3_4_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acos); │ │ │ │ │ +_3_4_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(acosh); │ │ │ │ │ +_3_4_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asin); │ │ │ │ │ +_3_4_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(asinh); │ │ │ │ │ +_3_4_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atan); │ │ │ │ │ +350 // atan2 │ │ │ │ │ +_3_5_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(atanh); │ │ │ │ │ +_3_5_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cbrt); │ │ │ │ │ +_3_5_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(ceil); │ │ │ │ │ +354 // copysign │ │ │ │ │ +_3_5_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cos); │ │ │ │ │ +_3_5_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(cosh); │ │ │ │ │ +_3_5_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erf); │ │ │ │ │ +_3_5_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(erfc); │ │ │ │ │ +_3_5_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(exp); │ │ │ │ │ +_3_6_0 _D_U_N_E___U_N_A_R_Y___F_U_N_C(exp2); │ │ │ │ │ +_3_6_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(expm1); │ │ │ │ │ +_3_6_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(fabs); │ │ │ │ │ +363 // fdim │ │ │ │ │ +_3_6_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(floor); │ │ │ │ │ +365 // fma │ │ │ │ │ +366 // fmax │ │ │ │ │ +367 // fmin │ │ │ │ │ +368 // fmod │ │ │ │ │ +369 // frexp │ │ │ │ │ +370 // hypos │ │ │ │ │ +_3_7_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(ilogb); │ │ │ │ │ +372 // ldexp │ │ │ │ │ +_3_7_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lgamma); │ │ │ │ │ +_3_7_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(llrint); │ │ │ │ │ +_3_7_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(llround); │ │ │ │ │ +_3_7_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log); │ │ │ │ │ +_3_7_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log10); │ │ │ │ │ +_3_7_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log1p); │ │ │ │ │ +_3_7_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(log2); │ │ │ │ │ +_3_8_0 _D_U_N_E___U_N_A_R_Y___F_U_N_C(logb); │ │ │ │ │ +_3_8_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lrint); │ │ │ │ │ +_3_8_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(lround); │ │ │ │ │ +383 // modf │ │ │ │ │ +_3_8_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(nearbyint); │ │ │ │ │ +385 // nextafter │ │ │ │ │ +386 // nexttoward │ │ │ │ │ +387 // pow │ │ │ │ │ +388 // remainder │ │ │ │ │ +389 // remquo │ │ │ │ │ +_3_9_0 _D_U_N_E___U_N_A_R_Y___F_U_N_C(rint); │ │ │ │ │ +_3_9_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(round); │ │ │ │ │ +392 // scalbln │ │ │ │ │ +393 // scalbn │ │ │ │ │ +_3_9_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sin); │ │ │ │ │ +_3_9_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sinh); │ │ │ │ │ +_3_9_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(sqrt); │ │ │ │ │ +_3_9_7 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tan); │ │ │ │ │ +_3_9_8 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tanh); │ │ │ │ │ +_3_9_9 _D_U_N_E___U_N_A_R_Y___F_U_N_C(tgamma); │ │ │ │ │ +_4_0_0 _D_U_N_E___U_N_A_R_Y___F_U_N_C(trunc); │ │ │ │ │ +401 │ │ │ │ │ +_4_0_2 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isfinite); │ │ │ │ │ +_4_0_3 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isinf); │ │ │ │ │ +_4_0_4 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isnan); │ │ │ │ │ +_4_0_5 _D_U_N_E___U_N_A_R_Y___F_U_N_C(isnormal); │ │ │ │ │ +_4_0_6 _D_U_N_E___U_N_A_R_Y___F_U_N_C(signbit); │ │ │ │ │ +407 │ │ │ │ │ +408 // isgreater │ │ │ │ │ +409 // isgreaterequal │ │ │ │ │ +410 // isless │ │ │ │ │ +411 // islessequal │ │ │ │ │ +412 // islessgreater │ │ │ │ │ +413 // isunordered │ │ │ │ │ +414 │ │ │ │ │ +415 // │ │ │ │ │ +416 // functions │ │ │ │ │ +417 // │ │ │ │ │ +418 │ │ │ │ │ +419 // not all functions are implemented, and unlike for , no │ │ │ │ │ +420 // comprehensive list is provided │ │ │ │ │ +_4_2_1 _D_U_N_E___U_N_A_R_Y___F_U_N_C(real); │ │ │ │ │ +422 │ │ │ │ │ +423#undef DUNE_UNARY_FUNC │ │ │ │ │ +424 │ │ │ │ │ +425 // We need to overload min() and max() since they require types to be │ │ │ │ │ +426 // LessThanComparable, which requires `a in the standard (still open │ │ │ │ │ +430 // as of 2018-07-06), which strives to require both "implicitly" and │ │ │ │ │ +431 // "contextually" convertible -- plus a few other things. │ │ │ │ │ +432 // │ │ │ │ │ +433 // We do not want our debug type to automatically decay to the underlying │ │ │ │ │ +434 // type, so we do not want to make the conversion non-explicit. So the │ │ │ │ │ +435 // only option left is to overload min() and max(). │ │ │ │ │ +436 │ │ │ │ │ +437 template │ │ │ │ │ +_4_3_8 auto max(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, │ │ │ │ │ +439 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +440 { │ │ │ │ │ +441 using std::max; │ │ │ │ │ +442 return aligned(max(T(a), T(b))); │ │ │ │ │ +443 } │ │ │ │ │ +444 │ │ │ │ │ +445 template │ │ │ │ │ +_4_4_6 auto max(const T &a, const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +447 { │ │ │ │ │ +448 using std::max; │ │ │ │ │ +449 return aligned(max(a, T(b))); │ │ │ │ │ +450 } │ │ │ │ │ +451 │ │ │ │ │ +452 template │ │ │ │ │ +_4_5_3 auto max(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, const T &b) │ │ │ │ │ +454 { │ │ │ │ │ +455 using std::max; │ │ │ │ │ +456 return aligned(max(T(a), b)); │ │ │ │ │ +457 } │ │ │ │ │ +458 │ │ │ │ │ +459 template │ │ │ │ │ +_4_6_0 auto min(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, │ │ │ │ │ +461 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +462 { │ │ │ │ │ +463 using std::min; │ │ │ │ │ +464 return aligned(min(T(a), T(b))); │ │ │ │ │ +465 } │ │ │ │ │ +466 │ │ │ │ │ +467 template │ │ │ │ │ +_4_6_8 auto min(const T &a, const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &b) │ │ │ │ │ +469 { │ │ │ │ │ +470 using std::min; │ │ │ │ │ +471 return aligned(min(a, T(b))); │ │ │ │ │ +472 } │ │ │ │ │ +473 │ │ │ │ │ +474 template │ │ │ │ │ +_4_7_5 auto min(const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &a, const T &b) │ │ │ │ │ +476 { │ │ │ │ │ +477 using std::min; │ │ │ │ │ +478 return aligned(min(T(a), b)); │ │ │ │ │ +479 } │ │ │ │ │ +480 │ │ │ │ │ +481 } // namespace AlignedNumberImpl │ │ │ │ │ +482 │ │ │ │ │ +483 // SIMD-like functions from "conditional.hh" │ │ │ │ │ +484 template │ │ │ │ │ +485 AlignedNumber │ │ │ │ │ +_4_8_6 _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, │ │ │ │ │ +487 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) │ │ │ │ │ +488 { │ │ │ │ │ +489 return b ? v1 : v2; │ │ │ │ │ +490 } │ │ │ │ │ +491 │ │ │ │ │ +492 // SIMD-like functions from "rangeutilities.hh" │ │ │ │ │ +493 template │ │ │ │ │ +_4_9_4 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) │ │ │ │ │ +495 { │ │ │ │ │ +496 return T(val); │ │ │ │ │ +497 } │ │ │ │ │ +498 │ │ │ │ │ +499 template │ │ │ │ │ +_5_0_0 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) │ │ │ │ │ +501 { │ │ │ │ │ +502 return T(val); │ │ │ │ │ +503 } │ │ │ │ │ +504 │ │ │ │ │ +505 template │ │ │ │ │ +_5_0_6 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) │ │ │ │ │ +507 { │ │ │ │ │ +508 return bool(val); │ │ │ │ │ +509 } │ │ │ │ │ +510 │ │ │ │ │ +511 template │ │ │ │ │ +_5_1_2 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) │ │ │ │ │ +513 { │ │ │ │ │ +514 return bool(val); │ │ │ │ │ +515 } │ │ │ │ │ +516 │ │ │ │ │ +517 // SIMD-like functionality from "simd/interface.hh" │ │ │ │ │ +_5_1_8 namespace Simd { │ │ │ │ │ +_5_1_9 namespace Overloads { │ │ │ │ │ +520 │ │ │ │ │ +521 template │ │ │ │ │ +_5_2_2 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; }; │ │ │ │ │ +523 │ │ │ │ │ +524 template │ │ │ │ │ +_5_2_5 struct _R_e_b_i_n_d_T_y_p_e > { │ │ │ │ │ +_5_2_6 using _t_y_p_e = _A_l_i_g_n_e_d_N_u_m_b_e_r_<_U_,_ _a_l_i_g_n_>; │ │ │ │ │ +527 }; │ │ │ │ │ +528 │ │ │ │ │ +529 template │ │ │ │ │ +_5_3_0 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> {}; │ │ │ │ │ +531 │ │ │ │ │ +532 template │ │ │ │ │ +_5_3_3 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) │ │ │ │ │ +534 { │ │ │ │ │ +535 assert(l == 0); │ │ │ │ │ +536 return v._v_a_l_u_e(); │ │ │ │ │ +537 } │ │ │ │ │ +538 │ │ │ │ │ +539 template │ │ │ │ │ +_5_4_0 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) │ │ │ │ │ +541 { │ │ │ │ │ +542 assert(l == 0); │ │ │ │ │ +543 return v._v_a_l_u_e(); │ │ │ │ │ +544 } │ │ │ │ │ +545 │ │ │ │ │ +546 template │ │ │ │ │ +547 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> & │ │ │ │ │ +_5_4_8 _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, │ │ │ │ │ +549 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &ifTrue, │ │ │ │ │ +550 const _A_l_i_g_n_e_d_N_u_m_b_e_r_<_T_,_ _a_l_i_g_n_> &ifFalse) │ │ │ │ │ +551 { │ │ │ │ │ +552 return _m_a_s_k ? ifTrue : ifFalse; │ │ │ │ │ +553 } │ │ │ │ │ +554 │ │ │ │ │ +555 template │ │ │ │ │ +_5_5_6 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) │ │ │ │ │ +557 { │ │ │ │ │ +558 return bool(_m_a_s_k); │ │ │ │ │ +559 } │ │ │ │ │ +560 │ │ │ │ │ +561 } // namespace Overloads │ │ │ │ │ +562 │ │ │ │ │ +563 } // namespace Simd │ │ │ │ │ +564 │ │ │ │ │ +565} // namespace Dune │ │ │ │ │ +566 │ │ │ │ │ +567#endif // DUNE_DEBUGALIGN_HH │ │ │ │ │ +_i_n_d_i_c_e_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___B_I_N_A_R_Y___O_P │ │ │ │ │ +#define DUNE_BINARY_OP(OP) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:261 │ │ │ │ │ +_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:220 │ │ │ │ │ +_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. │ │ │ │ │ +_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:29 │ │ │ │ │ +_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_:_:_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()=default │ │ │ │ │ -Destructor. │ │ │ │ │ -_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_:_:_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:36 │ │ │ │ │ +_D_u_n_e_:_:_a_n_y___t_r_u_e │ │ │ │ │ +bool any_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:506 │ │ │ │ │ +_D_u_n_e_:_:_a_l_l___t_r_u_e │ │ │ │ │ +bool all_true(const AlignedNumber< bool, align > &val) │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:512 │ │ │ │ │ +_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:97 │ │ │ │ │ +_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:114 │ │ │ │ │ +_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:30 │ │ │ │ │ +_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:494 │ │ │ │ │ +_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:500 │ │ │ │ │ +_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:556 │ │ │ │ │ +_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:533 │ │ │ │ │ +_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_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:128 │ │ │ │ │ +_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:187 │ │ │ │ │ +_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:182 │ │ │ │ │ +_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:179 │ │ │ │ │ +_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:217 │ │ │ │ │ +_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:145 │ │ │ │ │ +_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:144 │ │ │ │ │ +_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:150 │ │ │ │ │ +_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:207 │ │ │ │ │ +_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:133 │ │ │ │ │ +_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: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_:_:_o_p_e_r_a_t_o_r_- │ │ │ │ │ +decltype(auto) operator-() const │ │ │ │ │ +DDeeffiinniittiioonn debugalign.hh:191 │ │ │ │ │ +_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:522 │ │ │ │ │ +_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/a00176.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-common: densematrix.hh File Reference │ │ │ │ +dune-common: parametertree.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,72 +71,69 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
densematrix.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
parametertree.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

A hierarchical structure of string parameters. │ │ │ │ More...

│ │ │ │ -
#include <cmath>
│ │ │ │ +
#include <array>
│ │ │ │ #include <cstddef>
│ │ │ │ #include <iostream>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ +#include <istream>
│ │ │ │ +#include <iterator>
│ │ │ │ +#include <locale>
│ │ │ │ +#include <map>
│ │ │ │ +#include <ostream>
│ │ │ │ +#include <sstream>
│ │ │ │ +#include <string>
│ │ │ │ +#include <typeinfo>
│ │ │ │ #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>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <bitset>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/classname.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::FieldTraits< DenseMatrix< M > >
class  Dune::ParameterTree
 Hierarchical structure of string parameters. More...
 
class  Dune::FMatrixError
 Error thrown if operations of a FieldMatrix fail. More...
struct  Dune::ParameterTree::Parser< std::basic_string< char, traits, Allocator > >
 
class  Dune::DenseMatrix< MAT >
 A dense n x m matrix. More...
struct  Dune::ParameterTree::Parser< bool >
 
struct  Dune::ParameterTree::Parser< bool >::ToLower
 
struct  Dune::ParameterTree::Parser< FieldVector< T, n > >
 
struct  Dune::ParameterTree::Parser< std::array< T, n > >
 
struct  Dune::ParameterTree::Parser< std::bitset< n > >
 
struct  Dune::ParameterTree::Parser< std::vector< T, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -

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

│ │ │ │ -

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

│ │ │ │ +

A hierarchical structure of string parameters.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,57 +1,54 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +parametertree.hh File Reference │ │ │ │ │ +A hierarchical structure of string parameters. _M_o_r_e_._._. │ │ │ │ │ +#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_/_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 │ │ │ │ │ +#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_/_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> │ │ │ │ │ +#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_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_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _D_e_n_s_e_M_a_t_r_i_x_<_ _M_ _>_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e │ │ │ │ │ +  Hierarchical structure of string parameters. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_b_a_s_i_c___s_t_r_i_n_g_<_ _c_h_a_r_,_ _t_r_a_i_t_s_, │ │ │ │ │ + _A_l_l_o_c_a_t_o_r_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _b_o_o_l_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _b_o_o_l_ _>_:_:_T_o_L_o_w_e_r │ │ │ │ │   │ │ │ │ │ - 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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _n_ _>_ _> │ │ │ │ │   │ │ │ │ │ - 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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_a_r_r_a_y_<_ _T_,_ _n_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_b_i_t_s_e_t_<_ _n_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _T_,_ _A_ _>_ _> │ │ │ │ │   │ │ │ │ │ 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 ********** │ │ │ │ │ -Implements a matrix constructed from a given type representing a field and a │ │ │ │ │ -compile-time given number of rows and columns. │ │ │ │ │ +A hierarchical structure of string parameters. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: densematrix.hh Source File │ │ │ │ +dune-common: parametertree.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,1304 +74,348 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
densematrix.hh
│ │ │ │ +
parametertree.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 © 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_DENSEMATRIX_HH
│ │ │ │ -
6#define DUNE_DENSEMATRIX_HH
│ │ │ │ +
5#ifndef DUNE_PARAMETERTREE_HH
│ │ │ │ +
6#define DUNE_PARAMETERTREE_HH
│ │ │ │
7
│ │ │ │ -
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
│ │ │ │ -
25namespace Dune
│ │ │ │ -
26{
│ │ │ │ -
27
│ │ │ │ -
28 template<typename M> class DenseMatrix;
│ │ │ │ -
29
│ │ │ │ -
30 template<typename M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
32 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
35 };
│ │ │ │ -
│ │ │ │ -
36
│ │ │ │ -
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
│ │ │ │ +
12#include <array>
│ │ │ │ +
13#include <cstddef>
│ │ │ │ +
14#include <iostream>
│ │ │ │ +
15#include <istream>
│ │ │ │ +
16#include <iterator>
│ │ │ │ +
17#include <locale>
│ │ │ │ +
18#include <map>
│ │ │ │ +
19#include <ostream>
│ │ │ │ +
20#include <sstream>
│ │ │ │ +
21#include <string>
│ │ │ │ +
22#include <typeinfo>
│ │ │ │ +
23#include <vector>
│ │ │ │ +
24#include <algorithm>
│ │ │ │ +
25#include <bitset>
│ │ │ │ +
26
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
30
│ │ │ │ +
31namespace Dune {
│ │ │ │ +
32
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
37 {
│ │ │ │ +
38 // class providing a single static parse() function, used by the
│ │ │ │ +
39 // generic get() method
│ │ │ │ +
40 template<typename T>
│ │ │ │ +
41 struct Parser;
│ │ │ │ +
42
│ │ │ │ +
43 struct EmptyTag {};
│ │ │ │ +
44 ParameterTree(EmptyTag);
│ │ │ │ +
45
│ │ │ │ +
46 public:
│ │ │ │ +
47
│ │ │ │ +
50 typedef std::vector<std::string> KeyVector;
│ │ │ │ +
51
│ │ │ │ + │ │ │ │ +
55
│ │ │ │ +
56
│ │ │ │ +
64 bool hasKey(const std::string& key) const;
│ │ │ │ +
65
│ │ │ │ +
66
│ │ │ │ +
74 bool hasSub(const std::string& sub) const;
│ │ │ │ +
75
│ │ │ │ +
76
│ │ │ │ +
85 std::string& operator[] (const std::string& key);
│ │ │ │ +
86
│ │ │ │ +
87
│ │ │ │ +
97 const std::string& operator[] (const std::string& key) const;
│ │ │ │
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 {};
│ │ │ │ +
107 void report(std::ostream& stream = std::cout,
│ │ │ │ +
108 const std::string& prefix = "") const;
│ │ │ │ +
109
│ │ │ │ +
110
│ │ │ │ +
116 ParameterTree& sub(const std::string& sub);
│ │ │ │ +
117
│ │ │ │ +
118
│ │ │ │ +
125 const ParameterTree& sub(const std::string& sub, bool fail_if_missing = false) const;
│ │ │ │ +
126
│ │ │ │
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;
│ │ │ │ +
136 std::string get(const std::string& key, const std::string& defaultValue) const;
│ │ │ │ +
137
│ │ │ │ +
148 std::string get(const std::string& key, const char* defaultValue) const;
│ │ │ │
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;
│ │ │ │ +
150
│ │ │ │ +
160 template<typename T>
│ │ │ │ +
│ │ │ │ +
161 T get(const std::string& key, const T& defaultValue) const {
│ │ │ │ +
162 if(hasKey(key))
│ │ │ │ +
163 return get<T>(key);
│ │ │ │ +
164 else
│ │ │ │ +
165 return defaultValue;
│ │ │ │ +
166 }
│ │ │ │ +
│ │ │ │
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;
│ │ │ │ +
176 template <class T>
│ │ │ │ +
│ │ │ │ +
177 T get(const std::string& key) const {
│ │ │ │ +
178 if(not hasKey(key))
│ │ │ │ +
179 DUNE_THROW(Dune::RangeError, "Key '" << key
│ │ │ │ +
180 << "' not found in ParameterTree (prefix " + prefix_ + ")");
│ │ │ │ +
181 try {
│ │ │ │ +
182 return Parser<T>::parse((*this)[key]);
│ │ │ │ +
183 }
│ │ │ │ +
184 catch(const RangeError& e) {
│ │ │ │ +
185 // rethrow the error and add more information
│ │ │ │ +
186 DUNE_THROW(RangeError, "Cannot parse value \"" << (*this)[key]
│ │ │ │ +
187 << "\" for key \"" << prefix_ << "." << key << "\""
│ │ │ │ +
188 << e.what());
│ │ │ │ +
189 }
│ │ │ │ +
190 }
│ │ │ │ +
│ │ │ │ +
191
│ │ │ │ +
199 const KeyVector& getValueKeys() const;
│ │ │ │ +
200
│ │ │ │ +
201
│ │ │ │ +
209 const KeyVector& getSubKeys() const;
│ │ │ │ +
210
│ │ │ │ +
211 protected:
│ │ │ │ +
212
│ │ │ │ +
213 static const ParameterTree empty_;
│ │ │ │
214
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
217 {
│ │ │ │ -
218 return Iterator(*this,0);
│ │ │ │ -
219 }
│ │ │ │ -
│ │ │ │ -
220
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
223 {
│ │ │ │ -
224 return Iterator(*this,rows());
│ │ │ │ -
225 }
│ │ │ │ -
│ │ │ │ +
215 std::string prefix_;
│ │ │ │ +
216
│ │ │ │ + │ │ │ │ + │ │ │ │ +
219
│ │ │ │ +
220 std::map<std::string, std::string> values_;
│ │ │ │ +
221 std::map<std::string, ParameterTree> subs_;
│ │ │ │ +
222
│ │ │ │ +
223 static std::string ltrim(const std::string& s);
│ │ │ │ +
224 static std::string rtrim(const std::string& s);
│ │ │ │ +
225 static std::vector<std::string> split(const std::string & s);
│ │ │ │
226
│ │ │ │ +
227 // parse into a fixed-size range of iterators
│ │ │ │ +
228 template<class Iterator>
│ │ │ │
│ │ │ │ - │ │ │ │ -
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 > >
│ │ │ │ +
229 static void parseRange(const std::string &str,
│ │ │ │ +
230 Iterator it, const Iterator &end)
│ │ │ │ +
231 {
│ │ │ │ +
232 typedef typename std::iterator_traits<Iterator>::value_type Value;
│ │ │ │ +
233 std::istringstream s(str);
│ │ │ │ +
234 // make sure we are in locale "C"
│ │ │ │ +
235 s.imbue(std::locale::classic());
│ │ │ │ +
236 std::size_t n = 0;
│ │ │ │ +
237 for(; it != end; ++it, ++n) {
│ │ │ │ +
238 s >> *it;
│ │ │ │ +
239 if(!s)
│ │ │ │ +
240 DUNE_THROW(RangeError, "as a range of items of type "
│ │ │ │ +
241 << className<Value>()
│ │ │ │ +
242 << " (" << n << " items were extracted successfully)");
│ │ │ │ +
243 }
│ │ │ │ +
244 Value dummy;
│ │ │ │ +
245 s >> dummy;
│ │ │ │ +
246 // now extraction should have failed, and eof should be set
│ │ │ │ +
247 if(not s.fail() or not s.eof())
│ │ │ │ +
248 DUNE_THROW(RangeError, "as a range of "
│ │ │ │ +
249 << n << " items of type "
│ │ │ │ +
250 << className<Value>() << " (more items than the range can hold)");
│ │ │ │ +
251 }
│ │ │ │ +
│ │ │ │ +
252 };
│ │ │ │ +
│ │ │ │ +
253
│ │ │ │ +
254 template<typename T>
│ │ │ │ +
255 struct ParameterTree::Parser {
│ │ │ │ +
256 static T parse(const std::string& str) {
│ │ │ │ +
257 T val;
│ │ │ │ +
258 std::istringstream s(str);
│ │ │ │ +
259 // make sure we are in locale "C"
│ │ │ │ +
260 s.imbue(std::locale::classic());
│ │ │ │ +
261 s >> val;
│ │ │ │ +
262 if(!s)
│ │ │ │ +
263 DUNE_THROW(RangeError, " as a " << className<T>());
│ │ │ │ +
264 char dummy;
│ │ │ │ +
265 s >> dummy;
│ │ │ │ +
266 // now extraction should have failed, and eof should be set
│ │ │ │ +
267 if ((! s.fail()) || (! s.eof()))
│ │ │ │ +
268 DUNE_THROW(RangeError, " as a " << className<T>());
│ │ │ │ +
269 return val;
│ │ │ │ +
270 }
│ │ │ │ +
271 };
│ │ │ │ +
272
│ │ │ │ +
273 // "How do I convert a string into a wstring in C++?" "Why, that very simple
│ │ │ │ +
274 // son. You just need a these hundred lines of code."
│ │ │ │ +
275 // Instead I'm going to restrict myself to string with charT=char here.
│ │ │ │ +
276 template<typename traits, typename Allocator>
│ │ │ │ +
│ │ │ │ +
277 struct ParameterTree::Parser<std::basic_string<char, traits, Allocator> > {
│ │ │ │ +
278 static std::basic_string<char, traits, Allocator>
│ │ │ │
│ │ │ │ -
279 derived_type &operator= ( const RHS &rhs )
│ │ │ │ -
280 {
│ │ │ │ - │ │ │ │ -
282 return asImp();
│ │ │ │ +
279 parse(const std::string& str) {
│ │ │ │ +
280 std::string trimmed = ltrim(rtrim(str));
│ │ │ │ +
281 return std::basic_string<char, traits, Allocator>(trimmed.begin(),
│ │ │ │ +
282 trimmed.end());
│ │ │ │
283 }
│ │ │ │
│ │ │ │ -
284
│ │ │ │ -
285 //===== vector space arithmetic
│ │ │ │ -
286
│ │ │ │ -
288 template <class Other>
│ │ │ │ +
284 };
│ │ │ │ +
│ │ │ │ +
285
│ │ │ │ +
286 template<>
│ │ │ │ +
│ │ │ │ +
287 struct ParameterTree::Parser< bool > {
│ │ │ │ +
│ │ │ │ +
288 struct ToLower {
│ │ │ │
│ │ │ │ - │ │ │ │ -
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];
│ │ │ │ +
289 char operator()(char c)
│ │ │ │ +
290 {
│ │ │ │ +
291 return std::tolower(c, std::locale::classic());
│ │ │ │ +
292 }
│ │ │ │ +
│ │ │ │ +
293 };
│ │ │ │ +
│ │ │ │ +
294
│ │ │ │ +
295 static bool
│ │ │ │ +
│ │ │ │ +
296 parse(const std::string& str) {
│ │ │ │ +
297 std::string ret = str;
│ │ │ │ +
298
│ │ │ │ +
299 std::transform(ret.begin(), ret.end(), ret.begin(), ToLower());
│ │ │ │ +
300
│ │ │ │ +
301 if (ret == "yes" || ret == "true")
│ │ │ │ +
302 return true;
│ │ │ │ +
303
│ │ │ │ +
304 if (ret == "no" || ret == "false")
│ │ │ │ +
305 return false;
│ │ │ │
306
│ │ │ │ -
307 return result;
│ │ │ │ +
307 return (Parser<int>::parse(ret) != 0);
│ │ │ │
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();
│ │ │ │ +
309 };
│ │ │ │ +
│ │ │ │ +
310
│ │ │ │ +
311 template<typename T, int n>
│ │ │ │ +
│ │ │ │ +
312 struct ParameterTree::Parser<FieldVector<T, n> > {
│ │ │ │ +
313 static FieldVector<T, n>
│ │ │ │ +
│ │ │ │ +
314 parse(const std::string& str) {
│ │ │ │ + │ │ │ │ +
316 parseRange(str, val.begin(), val.end());
│ │ │ │ +
317 return val;
│ │ │ │
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();
│ │ │ │ +
319 };
│ │ │ │ +
│ │ │ │ +
320
│ │ │ │ +
321 template<typename T, std::size_t n>
│ │ │ │ +
│ │ │ │ +
322 struct ParameterTree::Parser<std::array<T, n> > {
│ │ │ │ +
323 static std::array<T, n>
│ │ │ │ +
│ │ │ │ +
324 parse(const std::string& str) {
│ │ │ │ +
325 std::array<T, n> val;
│ │ │ │ +
326 parseRange(str, val.begin(), val.end());
│ │ │ │ +
327 return val;
│ │ │ │ +
328 }
│ │ │ │ +
│ │ │ │ +
329 };
│ │ │ │ +
│ │ │ │ +
330
│ │ │ │ +
331 template<std::size_t n>
│ │ │ │ +
│ │ │ │ +
332 struct ParameterTree::Parser<std::bitset<n> > {
│ │ │ │ +
333 static std::bitset<n>
│ │ │ │ +
│ │ │ │ +
334 parse(const std::string& str) {
│ │ │ │ +
335 std::bitset<n> val;
│ │ │ │ +
336 std::vector<std::string> sub = split(str);
│ │ │ │ +
337 if (sub.size() != n)
│ │ │ │ +
338 DUNE_THROW(RangeError, "as a bitset<" << n << "> "
│ │ │ │ +
339 << "because of unmatching size " << sub.size());
│ │ │ │ +
340 for (std::size_t i=0; i<n; ++i) {
│ │ │ │ +
341 val[i] = ParameterTree::Parser<bool>::parse(sub[i]);
│ │ │ │ +
342 }
│ │ │ │ +
343 return val;
│ │ │ │
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 }
│ │ │ │ +
345 };
│ │ │ │ +
│ │ │ │ +
346
│ │ │ │ +
347 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ +
348 struct ParameterTree::Parser<std::vector<T, A> > {
│ │ │ │ +
349 static std::vector<T, A>
│ │ │ │ +
│ │ │ │ +
350 parse(const std::string& str) {
│ │ │ │ +
351 std::vector<std::string> sub = split(str);
│ │ │ │ +
352 std::vector<T, A> vec;
│ │ │ │ +
353 for (unsigned int i=0; i<sub.size(); ++i) {
│ │ │ │ +
354 T val = ParameterTree::Parser<T>::parse(sub[i]);
│ │ │ │ +
355 vec.push_back(val);
│ │ │ │ +
356 }
│ │ │ │ +
357 return vec;
│ │ │ │ +
358 }
│ │ │ │ +
│ │ │ │ +
359 };
│ │ │ │
│ │ │ │ +
360
│ │ │ │ +
361} // end namespace Dune
│ │ │ │
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
│ │ │ │ -
Some useful basic math stuff.
│ │ │ │ -
A free function to provide the demangled class name of a given object or type as a string.
│ │ │ │ -
Various precision settings for calculations with FieldMatrix and FieldVector.
│ │ │ │ -
Implements a scalar vector view wrapper around an existing scalar.
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ -
Macro for wrapping boundary checks.
│ │ │ │ -
Implements a vector constructed from a given type representing a field and a compile-time given 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
│ │ │ │ -
typename AutonomousValueType< T >::type AutonomousValue
Type free of internal references that T can be converted to.
Definition typetraits.hh:588
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
│ │ │ │ +
363#endif // DUNE_PARAMETERTREE_HH
│ │ │ │ +
A few common exception classes.
│ │ │ │ +
Implements a vector constructed from a given type representing a field and a compile-time given size.
│ │ │ │ +
A free function to provide the demangled class name of a given object or type as a string.
│ │ │ │ +
const char * what() const noexcept override
output internal message buffer
Definition exceptions.cc:37
│ │ │ │
#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
│ │ │ │ -
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:91
│ │ │ │ -
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.
│ │ │ │ +
Iterator begin()
begin iterator
Definition densevector.hh:347
│ │ │ │ +
Iterator end()
end iterator
Definition densevector.hh:353
│ │ │ │ +
Default exception class for range errors.
Definition exceptions.hh:254
│ │ │ │ +
Hierarchical structure of string parameters.
Definition parametertree.hh:37
│ │ │ │ +
KeyVector valueKeys_
Definition parametertree.hh:217
│ │ │ │ +
std::map< std::string, ParameterTree > subs_
Definition parametertree.hh:221
│ │ │ │ +
static const ParameterTree empty_
Definition parametertree.hh:213
│ │ │ │ +
static std::string rtrim(const std::string &s)
Definition parametertree.cc:213
│ │ │ │ +
std::string get(const std::string &key, const std::string &defaultValue) const
get value as string
Definition parametertree.cc:188
│ │ │ │ +
static std::string ltrim(const std::string &s)
Definition parametertree.cc:204
│ │ │ │ +
void report(std::ostream &stream=std::cout, const std::string &prefix="") const
print distinct substructure to stream
Definition parametertree.cc:32
│ │ │ │ +
std::vector< std::string > KeyVector
storage for key lists
Definition parametertree.hh:50
│ │ │ │ +
static void parseRange(const std::string &str, Iterator it, const Iterator &end)
Definition parametertree.hh:229
│ │ │ │ +
ParameterTree()
Create new empty ParameterTree.
Definition parametertree.cc:20
│ │ │ │ +
std::string & operator[](const std::string &key)
get value reference for key
Definition parametertree.cc:153
│ │ │ │ +
KeyVector subKeys_
Definition parametertree.hh:218
│ │ │ │ +
ParameterTree & sub(const std::string &sub)
get substructure by name
Definition parametertree.cc:106
│ │ │ │ +
bool hasKey(const std::string &key) const
test for key
Definition parametertree.cc:51
│ │ │ │ +
const KeyVector & getSubKeys() const
get substructure keys
Definition parametertree.cc:243
│ │ │ │ +
T get(const std::string &key) const
Get value.
Definition parametertree.hh:177
│ │ │ │ +
bool hasSub(const std::string &sub) const
test for substructure
Definition parametertree.cc:79
│ │ │ │ +
std::map< std::string, std::string > values_
Definition parametertree.hh:220
│ │ │ │ +
T get(const std::string &key, const T &defaultValue) const
get value converted to a certain type
Definition parametertree.hh:161
│ │ │ │ +
std::string prefix_
Definition parametertree.hh:215
│ │ │ │ +
static std::vector< std::string > split(const std::string &s)
Definition parametertree.cc:222
│ │ │ │ +
const KeyVector & getValueKeys() const
get value keys
Definition parametertree.cc:238
│ │ │ │ +
static std::basic_string< char, traits, Allocator > parse(const std::string &str)
Definition parametertree.hh:279
│ │ │ │ +
static bool parse(const std::string &str)
Definition parametertree.hh:296
│ │ │ │ +
char operator()(char c)
Definition parametertree.hh:289
│ │ │ │ +
static FieldVector< T, n > parse(const std::string &str)
Definition parametertree.hh:314
│ │ │ │ +
static std::array< T, n > parse(const std::string &str)
Definition parametertree.hh:324
│ │ │ │ +
static std::bitset< n > parse(const std::string &str)
Definition parametertree.hh:334
│ │ │ │ +
static std::vector< T, A > parse(const std::string &str)
Definition parametertree.hh:350
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1521 +1,407 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -densematrix.hh │ │ │ │ │ +parametertree.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 © 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_DENSEMATRIX_HH │ │ │ │ │ -6#define DUNE_DENSEMATRIX_HH │ │ │ │ │ +5#ifndef DUNE_PARAMETERTREE_HH │ │ │ │ │ +6#define DUNE_PARAMETERTREE_HH │ │ │ │ │ 7 │ │ │ │ │ -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 │ │ │ │ │ -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 │ │ │ │ │ -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 │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22#include │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26 │ │ │ │ │ +27#include <_d_u_n_e_/_c_o_m_m_o_n_/_e_x_c_e_p_t_i_o_n_s_._h_h> │ │ │ │ │ +28#include <_d_u_n_e_/_c_o_m_m_o_n_/_f_v_e_c_t_o_r_._h_h> │ │ │ │ │ +29#include <_d_u_n_e_/_c_o_m_m_o_n_/_c_l_a_s_s_n_a_m_e_._h_h> │ │ │ │ │ +30 │ │ │ │ │ +31namespace _D_u_n_e { │ │ │ │ │ +32 │ │ │ │ │ +_3_6 class _P_a_r_a_m_e_t_e_r_T_r_e_e │ │ │ │ │ +37 { │ │ │ │ │ +38 // class providing a single static parse() function, used by the │ │ │ │ │ +39 // generic get() method │ │ │ │ │ +40 template │ │ │ │ │ +41 struct Parser; │ │ │ │ │ +42 │ │ │ │ │ +43 struct EmptyTag {}; │ │ │ │ │ +44 _P_a_r_a_m_e_t_e_r_T_r_e_e(EmptyTag); │ │ │ │ │ +45 │ │ │ │ │ +46 public: │ │ │ │ │ +47 │ │ │ │ │ +_5_0 typedef std::vector _K_e_y_V_e_c_t_o_r; │ │ │ │ │ +51 │ │ │ │ │ +54 _P_a_r_a_m_e_t_e_r_T_r_e_e(); │ │ │ │ │ +55 │ │ │ │ │ +56 │ │ │ │ │ +64 bool _h_a_s_K_e_y(const std::string& key) const; │ │ │ │ │ +65 │ │ │ │ │ +66 │ │ │ │ │ +74 bool _h_a_s_S_u_b(const std::string& _s_u_b) const; │ │ │ │ │ +75 │ │ │ │ │ +76 │ │ │ │ │ +85 std::string& _o_p_e_r_a_t_o_r_[_]_ (const std::string& key); │ │ │ │ │ +86 │ │ │ │ │ +87 │ │ │ │ │ +97 const std::string& _o_p_e_r_a_t_o_r_[_]_ (const std::string& key) const; │ │ │ │ │ 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 {}; │ │ │ │ │ +107 void _r_e_p_o_r_t(std::ostream& stream = std::cout, │ │ │ │ │ +108 const std::string& prefix = "") const; │ │ │ │ │ +109 │ │ │ │ │ +110 │ │ │ │ │ +116 _P_a_r_a_m_e_t_e_r_T_r_e_e& _s_u_b(const std::string& _s_u_b); │ │ │ │ │ +117 │ │ │ │ │ +118 │ │ │ │ │ +125 const _P_a_r_a_m_e_t_e_r_T_r_e_e& _s_u_b(const std::string& _s_u_b, bool fail_if_missing = │ │ │ │ │ +false) const; │ │ │ │ │ +126 │ │ │ │ │ 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; │ │ │ │ │ +136 std::string _g_e_t(const std::string& key, const std::string& defaultValue) │ │ │ │ │ +const; │ │ │ │ │ +137 │ │ │ │ │ +148 std::string _g_e_t(const std::string& key, const char* defaultValue) const; │ │ │ │ │ 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; │ │ │ │ │ +150 │ │ │ │ │ +160 template │ │ │ │ │ +_1_6_1 T _g_e_t(const std::string& key, const T& defaultValue) const { │ │ │ │ │ +162 if(_h_a_s_K_e_y(key)) │ │ │ │ │ +163 return get(key); │ │ │ │ │ +164 else │ │ │ │ │ +165 return defaultValue; │ │ │ │ │ +166 } │ │ │ │ │ 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; │ │ │ │ │ +176 template │ │ │ │ │ +_1_7_7 T _g_e_t(const std::string& key) const { │ │ │ │ │ +178 if(not _h_a_s_K_e_y(key)) │ │ │ │ │ +179 _D_U_N_E___T_H_R_O_W(_D_u_n_e_:_:_R_a_n_g_e_E_r_r_o_r, "Key '" << key │ │ │ │ │ +180 << "' not found in ParameterTree (prefix " + _p_r_e_f_i_x__ + ")"); │ │ │ │ │ +181 try { │ │ │ │ │ +182 return Parser::parse((*this)[key]); │ │ │ │ │ +183 } │ │ │ │ │ +184 catch(const _R_a_n_g_e_E_r_r_o_r& e) { │ │ │ │ │ +185 // rethrow the error and add more information │ │ │ │ │ +186 _D_U_N_E___T_H_R_O_W(_R_a_n_g_e_E_r_r_o_r, "Cannot parse value \"" << (*this)[key] │ │ │ │ │ +187 << "\" for key \"" << _p_r_e_f_i_x__ << "." << key << "\"" │ │ │ │ │ +188 << e._w_h_a_t()); │ │ │ │ │ +189 } │ │ │ │ │ +190 } │ │ │ │ │ +191 │ │ │ │ │ +199 const _K_e_y_V_e_c_t_o_r& _g_e_t_V_a_l_u_e_K_e_y_s() const; │ │ │ │ │ +200 │ │ │ │ │ +201 │ │ │ │ │ +209 const _K_e_y_V_e_c_t_o_r& _g_e_t_S_u_b_K_e_y_s() const; │ │ │ │ │ +210 │ │ │ │ │ +211 protected: │ │ │ │ │ +212 │ │ │ │ │ +_2_1_3 static const _P_a_r_a_m_e_t_e_r_T_r_e_e _e_m_p_t_y__; │ │ │ │ │ 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 } │ │ │ │ │ +_2_1_5 std::string _p_r_e_f_i_x__; │ │ │ │ │ +216 │ │ │ │ │ +_2_1_7 _K_e_y_V_e_c_t_o_r _v_a_l_u_e_K_e_y_s__; │ │ │ │ │ +_2_1_8 _K_e_y_V_e_c_t_o_r _s_u_b_K_e_y_s__; │ │ │ │ │ +219 │ │ │ │ │ +_2_2_0 std::map _v_a_l_u_e_s__; │ │ │ │ │ +_2_2_1 std::map _s_u_b_s__; │ │ │ │ │ +222 │ │ │ │ │ +223 static std::string _l_t_r_i_m(const std::string& s); │ │ │ │ │ +224 static std::string _r_t_r_i_m(const std::string& s); │ │ │ │ │ +225 static std::vector _s_p_l_i_t(const std::string & s); │ │ │ │ │ 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(); │ │ │ │ │ +227 // parse into a fixed-size range of iterators │ │ │ │ │ +228 template │ │ │ │ │ +_2_2_9 static void _p_a_r_s_e_R_a_n_g_e(const std::string &str, │ │ │ │ │ +230 Iterator it, const Iterator &end) │ │ │ │ │ +231 { │ │ │ │ │ +232 typedef typename std::iterator_traits::value_type Value; │ │ │ │ │ +233 std::istringstream s(str); │ │ │ │ │ +234 // make sure we are in locale "C" │ │ │ │ │ +235 s.imbue(std::locale::classic()); │ │ │ │ │ +236 std::size_t n = 0; │ │ │ │ │ +237 for(; it != end; ++it, ++n) { │ │ │ │ │ +238 s >> *it; │ │ │ │ │ +239 if(!s) │ │ │ │ │ +240 _D_U_N_E___T_H_R_O_W(_R_a_n_g_e_E_r_r_o_r, "as a range of items of type " │ │ │ │ │ +241 << className() │ │ │ │ │ +242 << " (" << n << " items were extracted successfully)"); │ │ │ │ │ +243 } │ │ │ │ │ +244 Value dummy; │ │ │ │ │ +245 s >> dummy; │ │ │ │ │ +246 // now extraction should have failed, and eof should be set │ │ │ │ │ +247 if(not s.fail() or not s.eof()) │ │ │ │ │ +248 _D_U_N_E___T_H_R_O_W(_R_a_n_g_e_E_r_r_o_r, "as a range of " │ │ │ │ │ +249 << n << " items of type " │ │ │ │ │ +250 << className() << " (more items than the range can hold)"); │ │ │ │ │ +251 } │ │ │ │ │ +252 }; │ │ │ │ │ +253 │ │ │ │ │ +254 template │ │ │ │ │ +255 struct ParameterTree::Parser { │ │ │ │ │ +256 static T parse(const std::string& str) { │ │ │ │ │ +257 T val; │ │ │ │ │ +258 std::istringstream s(str); │ │ │ │ │ +259 // make sure we are in locale "C" │ │ │ │ │ +260 s.imbue(std::locale::classic()); │ │ │ │ │ +261 s >> val; │ │ │ │ │ +262 if(!s) │ │ │ │ │ +263 _D_U_N_E___T_H_R_O_W(RangeError, " as a " << className()); │ │ │ │ │ +264 char dummy; │ │ │ │ │ +265 s >> dummy; │ │ │ │ │ +266 // now extraction should have failed, and eof should be set │ │ │ │ │ +267 if ((! s.fail()) || (! s.eof())) │ │ │ │ │ +268 _D_U_N_E___T_H_R_O_W(RangeError, " as a " << className()); │ │ │ │ │ +269 return val; │ │ │ │ │ +270 } │ │ │ │ │ +271 }; │ │ │ │ │ +272 │ │ │ │ │ +273 // "How do I convert a string into a wstring in C++?" "Why, that very │ │ │ │ │ +simple │ │ │ │ │ +274 // son. You just need a these hundred lines of code." │ │ │ │ │ +275 // Instead I'm going to restrict myself to string with charT=char here. │ │ │ │ │ +276 template │ │ │ │ │ +_2_7_7 struct ParameterTree::Parser<_s_t_d::basic_string > { │ │ │ │ │ +278 static std::basic_string │ │ │ │ │ +_2_7_9 _p_a_r_s_e(const std::string& str) { │ │ │ │ │ +280 std::string trimmed = _l_t_r_i_m(_r_t_r_i_m(str)); │ │ │ │ │ +281 return std::basic_string(trimmed.begin(), │ │ │ │ │ +282 trimmed.end()); │ │ │ │ │ 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) │ │ │ │ │ +284 }; │ │ │ │ │ +285 │ │ │ │ │ +286 template<> │ │ │ │ │ +_2_8_7 struct ParameterTree::Parser< bool > { │ │ │ │ │ +_2_8_8 struct ToLower { │ │ │ │ │ +_2_8_9 char _o_p_e_r_a_t_o_r_(_)(char c) │ │ │ │ │ 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]; │ │ │ │ │ +291 return std::tolower(c, std::locale::classic()); │ │ │ │ │ +292 } │ │ │ │ │ +293 }; │ │ │ │ │ +294 │ │ │ │ │ +295 static bool │ │ │ │ │ +_2_9_6 _p_a_r_s_e(const std::string& str) { │ │ │ │ │ +297 std::string ret = str; │ │ │ │ │ +298 │ │ │ │ │ +299 std::transform(ret.begin(), ret.end(), ret.begin(), ToLower()); │ │ │ │ │ +300 │ │ │ │ │ +301 if (ret == "yes" || ret == "true") │ │ │ │ │ +302 return true; │ │ │ │ │ +303 │ │ │ │ │ +304 if (ret == "no" || ret == "false") │ │ │ │ │ +305 return false; │ │ │ │ │ 306 │ │ │ │ │ -307 return result; │ │ │ │ │ +307 return (Parser::parse(ret) != 0); │ │ │ │ │ 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(); │ │ │ │ │ +309 }; │ │ │ │ │ +310 │ │ │ │ │ +311 template │ │ │ │ │ +_3_1_2 struct ParameterTree::Parser<_F_i_e_l_d_V_e_c_t_o_r > { │ │ │ │ │ +313 static _F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _n_> │ │ │ │ │ +_3_1_4 _p_a_r_s_e(const std::string& str) { │ │ │ │ │ +315 _F_i_e_l_d_V_e_c_t_o_r_<_T_,_ _n_> val; │ │ │ │ │ +316 _p_a_r_s_e_R_a_n_g_e(str, val._b_e_g_i_n(), val._e_n_d()); │ │ │ │ │ +317 return val; │ │ │ │ │ 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(); │ │ │ │ │ +319 }; │ │ │ │ │ +320 │ │ │ │ │ +321 template │ │ │ │ │ +_3_2_2 struct ParameterTree::Parser<_s_t_d::array > { │ │ │ │ │ +323 static std::array │ │ │ │ │ +_3_2_4 _p_a_r_s_e(const std::string& str) { │ │ │ │ │ +325 std::array val; │ │ │ │ │ +326 _p_a_r_s_e_R_a_n_g_e(str, val.begin(), val.end()); │ │ │ │ │ +327 return val; │ │ │ │ │ +328 } │ │ │ │ │ +329 }; │ │ │ │ │ +330 │ │ │ │ │ +331 template │ │ │ │ │ +_3_3_2 struct ParameterTree::Parser<_s_t_d::bitset > { │ │ │ │ │ +333 static std::bitset │ │ │ │ │ +_3_3_4 _p_a_r_s_e(const std::string& str) { │ │ │ │ │ +335 std::bitset val; │ │ │ │ │ +336 std::vector _s_u_b = _s_p_l_i_t(str); │ │ │ │ │ +337 if (_s_u_b.size() != n) │ │ │ │ │ +338 _D_U_N_E___T_H_R_O_W(_R_a_n_g_e_E_r_r_o_r, "as a bitset<" << n << "> " │ │ │ │ │ +339 << "because of unmatching size " << _s_u_b.size()); │ │ │ │ │ +340 for (std::size_t i=0; i::parse(_s_u_b[i]); │ │ │ │ │ +342 } │ │ │ │ │ +343 return val; │ │ │ │ │ 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 } │ │ │ │ │ +345 }; │ │ │ │ │ +346 │ │ │ │ │ +347 template │ │ │ │ │ +_3_4_8 struct ParameterTree::Parser<_s_t_d::vector > { │ │ │ │ │ +349 static std::vector │ │ │ │ │ +_3_5_0 _p_a_r_s_e(const std::string& str) { │ │ │ │ │ +351 std::vector _s_u_b = _s_p_l_i_t(str); │ │ │ │ │ +352 std::vector vec; │ │ │ │ │ +353 for (unsigned int i=0; i<_s_u_b.size(); ++i) { │ │ │ │ │ +354 T val = ParameterTree::Parser::parse(_s_u_b[i]); │ │ │ │ │ +355 vec.push_back(val); │ │ │ │ │ +356 } │ │ │ │ │ +357 return vec; │ │ │ │ │ +358 } │ │ │ │ │ +359 }; │ │ │ │ │ +360 │ │ │ │ │ +361} // end namespace Dune │ │ │ │ │ 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:588 │ │ │ │ │ -_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 │ │ │ │ │ +_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. │ │ │ │ │ +_D_u_n_e_:_:_E_x_c_e_p_t_i_o_n_:_:_w_h_a_t │ │ │ │ │ +const char * what() const noexcept override │ │ │ │ │ +output internal message buffer │ │ │ │ │ +DDeeffiinniittiioonn exceptions.cc:37 │ │ │ │ │ _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_:_:_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:91 │ │ │ │ │ -_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. │ │ │ │ │ +_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_:_:_e_n_d │ │ │ │ │ +Iterator end() │ │ │ │ │ +end iterator │ │ │ │ │ +DDeeffiinniittiioonn densevector.hh:353 │ │ │ │ │ +_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_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e │ │ │ │ │ +Hierarchical structure of string parameters. │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_v_a_l_u_e_K_e_y_s__ │ │ │ │ │ +KeyVector valueKeys_ │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:217 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_s_u_b_s__ │ │ │ │ │ +std::map< std::string, ParameterTree > subs_ │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:221 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_e_m_p_t_y__ │ │ │ │ │ +static const ParameterTree empty_ │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:213 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_r_t_r_i_m │ │ │ │ │ +static std::string rtrim(const std::string &s) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:213 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_g_e_t │ │ │ │ │ +std::string get(const std::string &key, const std::string &defaultValue) const │ │ │ │ │ +get value as string │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:188 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_l_t_r_i_m │ │ │ │ │ +static std::string ltrim(const std::string &s) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:204 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_r_e_p_o_r_t │ │ │ │ │ +void report(std::ostream &stream=std::cout, const std::string &prefix="") const │ │ │ │ │ +print distinct substructure to stream │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:32 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_K_e_y_V_e_c_t_o_r │ │ │ │ │ +std::vector< std::string > KeyVector │ │ │ │ │ +storage for key lists │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_p_a_r_s_e_R_a_n_g_e │ │ │ │ │ +static void parseRange(const std::string &str, Iterator it, const Iterator │ │ │ │ │ +&end) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e │ │ │ │ │ +ParameterTree() │ │ │ │ │ +Create new empty ParameterTree. │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:20 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +std::string & operator[](const std::string &key) │ │ │ │ │ +get value reference for key │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:153 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_s_u_b_K_e_y_s__ │ │ │ │ │ +KeyVector subKeys_ │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_s_u_b │ │ │ │ │ +ParameterTree & sub(const std::string &sub) │ │ │ │ │ +get substructure by name │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:106 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_h_a_s_K_e_y │ │ │ │ │ +bool hasKey(const std::string &key) const │ │ │ │ │ +test for key │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:51 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_g_e_t_S_u_b_K_e_y_s │ │ │ │ │ +const KeyVector & getSubKeys() const │ │ │ │ │ +get substructure keys │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:243 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_g_e_t │ │ │ │ │ +T get(const std::string &key) const │ │ │ │ │ +Get value. │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:177 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_h_a_s_S_u_b │ │ │ │ │ +bool hasSub(const std::string &sub) const │ │ │ │ │ +test for substructure │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:79 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_v_a_l_u_e_s__ │ │ │ │ │ +std::map< std::string, std::string > values_ │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:220 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_g_e_t │ │ │ │ │ +T get(const std::string &key, const T &defaultValue) const │ │ │ │ │ +get value converted to a certain type │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:161 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_p_r_e_f_i_x__ │ │ │ │ │ +std::string prefix_ │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:215 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_s_p_l_i_t │ │ │ │ │ +static std::vector< std::string > split(const std::string &s) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:222 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_g_e_t_V_a_l_u_e_K_e_y_s │ │ │ │ │ +const KeyVector & getValueKeys() const │ │ │ │ │ +get value keys │ │ │ │ │ +DDeeffiinniittiioonn parametertree.cc:238 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_b_a_s_i_c___s_t_r_i_n_g_<_ _c_h_a_r_,_ _t_r_a_i_t_s_,_ _A_l_l_o_c_a_t_o_r_ _>_ _>_:_: │ │ │ │ │ +_p_a_r_s_e │ │ │ │ │ +static std::basic_string< char, traits, Allocator > parse(const std::string │ │ │ │ │ +&str) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:279 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _b_o_o_l_ _>_:_:_p_a_r_s_e │ │ │ │ │ +static bool parse(const std::string &str) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:296 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _b_o_o_l_ _>_:_:_T_o_L_o_w_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +char operator()(char c) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:289 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _n_ _>_ _>_:_:_p_a_r_s_e │ │ │ │ │ +static FieldVector< T, n > parse(const std::string &str) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:314 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_a_r_r_a_y_<_ _T_,_ _n_ _>_ _>_:_:_p_a_r_s_e │ │ │ │ │ +static std::array< T, n > parse(const std::string &str) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_b_i_t_s_e_t_<_ _n_ _>_ _>_:_:_p_a_r_s_e │ │ │ │ │ +static std::bitset< n > parse(const std::string &str) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:334 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_m_e_t_e_r_T_r_e_e_:_:_P_a_r_s_e_r_<_ _s_t_d_:_:_v_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_p_a_r_s_e │ │ │ │ │ +static std::vector< T, A > parse(const std::string &str) │ │ │ │ │ +DDeeffiinniittiioonn parametertree.hh:350 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: tupleutility.hh File Reference │ │ │ │ +dune-common: reservedvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,116 +72,70 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
│ │ │ │ -
tupleutility.hh File Reference
│ │ │ │ +Macros
│ │ │ │ +
reservedvector.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Contains utility classes which can be used with std::tuple. │ │ │ │ +

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

│ │ │ │ -
#include <cstddef>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <dune/common/hybridutilities.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ +
#include <algorithm>
│ │ │ │ +#include <array>
│ │ │ │ +#include <cassert>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <iterator>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <initializer_list>
│ │ │ │ +#include <dune/common/hash.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::TupleAccessTraits< T >
 
struct  Dune::TupleAccessTraits< T * >
 
struct  Dune::TupleAccessTraits< T & >
 
struct  Dune::NullPointerInitialiser< std::tuple< Args... > >
 
struct  Dune::ForEachType< TE, std::tuple< Args... > >
 
class  Dune::TransformTupleFunctor< TE, Args >
 
struct  Dune::TransformTupleFunctor< TE, Args >::TypeEvaluator< T >
 
struct  Dune::AddRefTypeEvaluator< T >
 TypeEvaluator to turn a type T into a reference to T More...
 
struct  Dune::AddPtrTypeEvaluator< T >
 TypeEvaluator to turn a type T into a pointer to T More...
 
struct  Dune::AddPtrTypeEvaluator< T & >
 
struct  Dune::AtType< N, Tuple >
 Type for reverse element access. More...
 
struct  Dune::At< N >
 Reverse element access. More...
 
struct  Dune::PointerPairDeletor< Tuple >
 Deletes all objects pointed to in a std::tuple of pointers. More...
 
class  Dune::FirstPredicateIndex< Tuple, Predicate, start, size >
 Finding the index of a certain type in a std::tuple. More...
 
struct  Dune::IsType< T >
 Generator for predicates accepting one particular type. More...
 
struct  Dune::IsType< T >::Predicate< U >
 The actual predicate. More...
 
struct  Dune::FirstTypeIndex< Tuple, T, start >
 Find the first occurrence of a type in a std::tuple. More...
 
struct  Dune::PushBackTuple< typename std::tuple< Args... >, T >
 
struct  Dune::PushFrontTuple< typename std::tuple< Args... >, T >
 
struct  Dune::ReduceTuple< F, Tuple, Seed, N >
 Apply reduce with meta binary function to template. More...
 
struct  Dune::ReduceTuple< F, Tuple, Seed, 0 >
 Apply reduce with meta binary function to template. More...
 
struct  Dune::JoinTuples< Head, Tail >
 Join two std::tuple's. More...
 
struct  Dune::FlattenTuple< Tuple >
 Flatten a std::tuple of std::tuple's. More...
class  Dune::ReservedVector< T, n >
 A Vector class with statically reserved memory. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<class F , class ArgTuple , class I , I... i>
decltype(auto) Dune::applyPartial (F &&f, ArgTuple &&args, std::integer_sequence< I, i... >)
 Apply function with arguments from a given tuple.
 
template<class Tuple , class Functor >
auto Dune::genericTransformTuple (Tuple &&t, Functor &&f) -> decltype(genericTransformTupleBackend(t, f))
 
template<template< class > class TE, class... Args>
TransformTupleFunctor< TE, Args... > Dune::makeTransformTupleFunctor (Args &&... args)
 
template<template< class > class TypeEvaluator, class Tuple , class... Args>
auto Dune::transformTuple (Tuple &&orig, Args &&... args) -> decltype(genericTransformTuple(orig, makeTransformTupleFunctor< TypeEvaluator >(args...)))
 

│ │ │ │ +Macros

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

Detailed Description

│ │ │ │ -

Contains utility classes which can be used with std::tuple.

│ │ │ │ -
│ │ │ │ +

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

│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ CHECKSIZE

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define CHECKSIZE( X)   {}
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,108 +1,37 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ 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 │ │ │ │ │ -tupleutility.hh File Reference │ │ │ │ │ -_C_o_m_m_o_n » _U_t_i_l_i_t_i_e_s » _T_u_p_l_e_ _U_t_i_l_i_t_i_e_s │ │ │ │ │ -Contains utility classes which can be used with std::tuple. _M_o_r_e_._._. │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ │ +reservedvector.hh File Reference │ │ │ │ │ +An stl-compliant random-access container which stores everything on the stack. │ │ │ │ │ +_M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#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> │ │ │ │ │ -#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 <_d_u_n_e_/_c_o_m_m_o_n_/_h_a_s_h_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_T_u_p_l_e_A_c_c_e_s_s_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_T_u_p_l_e_A_c_c_e_s_s_T_r_a_i_t_s_<_ _T_ _*_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_T_u_p_l_e_A_c_c_e_s_s_T_r_a_i_t_s_<_ _T_ _&_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_N_u_l_l_P_o_i_n_t_e_r_I_n_i_t_i_a_l_i_s_e_r_<_ _s_t_d_:_:_t_u_p_l_e_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_o_r_E_a_c_h_T_y_p_e_<_ _T_E_,_ _s_t_d_:_:_t_u_p_l_e_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_T_u_p_l_e_F_u_n_c_t_o_r_<_ _T_E_,_ _A_r_g_s_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_T_r_a_n_s_f_o_r_m_T_u_p_l_e_F_u_n_c_t_o_r_<_ _T_E_,_ _A_r_g_s_ _>_:_:_T_y_p_e_E_v_a_l_u_a_t_o_r_<_ _T_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_R_e_f_T_y_p_e_E_v_a_l_u_a_t_o_r_<_ _T_ _> │ │ │ │ │ -  TypeEvaluator to turn a type T into a reference to T _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_P_t_r_T_y_p_e_E_v_a_l_u_a_t_o_r_<_ _T_ _> │ │ │ │ │ -  TypeEvaluator to turn a type T into a pointer to T _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_P_t_r_T_y_p_e_E_v_a_l_u_a_t_o_r_<_ _T_ _&_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_t_T_y_p_e_<_ _N_,_ _T_u_p_l_e_ _> │ │ │ │ │ -  Type for reverse element access. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_t_<_ _N_ _> │ │ │ │ │ -  Reverse element access. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_P_o_i_n_t_e_r_P_a_i_r_D_e_l_e_t_o_r_<_ _T_u_p_l_e_ _> │ │ │ │ │ -  Deletes all objects pointed to in a std::tuple of pointers. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_F_i_r_s_t_P_r_e_d_i_c_a_t_e_I_n_d_e_x_<_ _T_u_p_l_e_,_ _P_r_e_d_i_c_a_t_e_,_ _s_t_a_r_t_,_ _s_i_z_e_ _> │ │ │ │ │ -  Finding the index of a certain type in a std::tuple. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_T_y_p_e_<_ _T_ _> │ │ │ │ │ -  Generator for predicates accepting one particular type. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_s_T_y_p_e_<_ _T_ _>_:_:_P_r_e_d_i_c_a_t_e_<_ _U_ _> │ │ │ │ │ -  The actual predicate. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_r_s_t_T_y_p_e_I_n_d_e_x_<_ _T_u_p_l_e_,_ _T_,_ _s_t_a_r_t_ _> │ │ │ │ │ -  Find the first occurrence of a type in a std::tuple. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_P_u_s_h_B_a_c_k_T_u_p_l_e_<_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_t_u_p_l_e_<_ _A_r_g_s_._._._ _>_,_ _T_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_P_u_s_h_F_r_o_n_t_T_u_p_l_e_<_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_t_u_p_l_e_<_ _A_r_g_s_._._._ _>_,_ _T_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_R_e_d_u_c_e_T_u_p_l_e_<_ _F_,_ _T_u_p_l_e_,_ _S_e_e_d_,_ _N_ _> │ │ │ │ │ -  Apply reduce with meta binary function to template. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_R_e_d_u_c_e_T_u_p_l_e_<_ _F_,_ _T_u_p_l_e_,_ _S_e_e_d_,_ _0_ _> │ │ │ │ │ -  Apply reduce with meta binary function to template. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_J_o_i_n_T_u_p_l_e_s_<_ _H_e_a_d_,_ _T_a_i_l_ _> │ │ │ │ │ -  Join two std::tuple's. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_l_a_t_t_e_n_T_u_p_l_e_<_ _T_u_p_l_e_ _> │ │ │ │ │ -  Flatten a std::tuple of std::tuple's. _M_o_r_e_._._. │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   _D_u_n_e namespace. │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - decltype(auto)  _D_u_n_e_:_:_a_p_p_l_y_P_a_r_t_i_a_l (F &&f, ArgTuple │ │ │ │ │ - &&args, std::integer_sequence< I, i... >) │ │ │ │ │ -  Apply function with arguments from a │ │ │ │ │ - given tuple. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - auto  _D_u_n_e_:_:_g_e_n_e_r_i_c_T_r_a_n_s_f_o_r_m_T_u_p_l_e (Tuple &&t, │ │ │ │ │ - Functor &&f) -> decltype │ │ │ │ │ - (genericTransformTupleBackend(t, f)) │ │ │ │ │ -  │ │ │ │ │ -template class TE, class... Args> │ │ │ │ │ -_T_r_a_n_s_f_o_r_m_T_u_p_l_e_F_u_n_c_t_o_r< TE, Args... >  _D_u_n_e_:_:_m_a_k_e_T_r_a_n_s_f_o_r_m_T_u_p_l_e_F_u_n_c_t_o_r (Args │ │ │ │ │ - &&... args) │ │ │ │ │ -  │ │ │ │ │ -template class TypeEvaluator, class Tuple , class... Args> │ │ │ │ │ - auto  _D_u_n_e_:_:_t_r_a_n_s_f_o_r_m_T_u_p_l_e (Tuple &&orig, Args │ │ │ │ │ - &&... args) -> decltype │ │ │ │ │ - (_g_e_n_e_r_i_c_T_r_a_n_s_f_o_r_m_T_u_p_l_e(orig, │ │ │ │ │ - _m_a_k_e_T_r_a_n_s_f_o_r_m_T_u_p_l_e_F_u_n_c_t_o_r< TypeEvaluator │ │ │ │ │ - >(args...))) │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _C_H_E_C_K_S_I_Z_E(X)   {} │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Contains utility classes which can be used with std::tuple. │ │ │ │ │ +An stl-compliant random-access container which stores everything on the stack. │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? CCHHEECCKKSSIIZZEE ********** │ │ │ │ │ +#define CHECKSIZE (   X )    {} │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: tupleutility.hh Source File │ │ │ │ +dune-common: reservedvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,448 +74,528 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
tupleutility.hh
│ │ │ │ +
reservedvector.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 © 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_TUPLE_UTILITY_HH
│ │ │ │ -
7#define DUNE_TUPLE_UTILITY_HH
│ │ │ │ -
8
│ │ │ │ -
9#include <cstddef>
│ │ │ │ -
10#include <tuple>
│ │ │ │ -
11#include <type_traits>
│ │ │ │ -
12#include <utility>
│ │ │ │ -
13
│ │ │ │ - │ │ │ │ - │ │ │ │ -
16
│ │ │ │ -
17namespace Dune {
│ │ │ │ -
18
│ │ │ │ -
41 template<class F, class ArgTuple, class I, I... i>
│ │ │ │ -
│ │ │ │ -
42 decltype(auto) applyPartial(F&& f, ArgTuple&& args, std::integer_sequence<I, i...> /*indices*/)
│ │ │ │ -
43 {
│ │ │ │ -
44 return f(std::get<i>(args)...);
│ │ │ │ -
45 }
│ │ │ │ -
│ │ │ │ -
46
│ │ │ │ -
47 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
49 {
│ │ │ │ -
50 typedef typename std::add_const<T>::type& ConstType;
│ │ │ │ -
51 typedef T& NonConstType;
│ │ │ │ -
52 typedef const typename std::remove_const<T>::type& ParameterType;
│ │ │ │ -
53 };
│ │ │ │ -
│ │ │ │ -
54
│ │ │ │ -
55 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
57 {
│ │ │ │ -
58 typedef typename std::add_const<T>::type* ConstType;
│ │ │ │ -
59 typedef T* NonConstType;
│ │ │ │ -
60 typedef T* ParameterType;
│ │ │ │ -
61 };
│ │ │ │ -
│ │ │ │ -
62
│ │ │ │ -
63 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
65 {
│ │ │ │ -
66 typedef T& ConstType;
│ │ │ │ -
67 typedef T& NonConstType;
│ │ │ │ -
68 typedef T& ParameterType;
│ │ │ │ -
69 };
│ │ │ │ -
│ │ │ │ -
70
│ │ │ │ -
78 template<class T>
│ │ │ │ - │ │ │ │ -
80
│ │ │ │ -
81 template<class... Args>
│ │ │ │ -
│ │ │ │ -
82 struct NullPointerInitialiser<std::tuple<Args...> >
│ │ │ │ -
83 {
│ │ │ │ -
84 typedef std::tuple<Args...> ResultType;
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
86 {
│ │ │ │ -
87 return ResultType(static_cast<Args>(nullptr)...);
│ │ │ │ -
88 }
│ │ │ │ -
│ │ │ │ -
89 };
│ │ │ │ -
│ │ │ │ -
90
│ │ │ │ -
115 template<template <class> class TE, class T>
│ │ │ │ - │ │ │ │ -
117
│ │ │ │ -
118 template<template <class> class TE, class... Args>
│ │ │ │ -
│ │ │ │ -
119 struct ForEachType<TE, std::tuple<Args...> >
│ │ │ │ -
120 {
│ │ │ │ -
121 typedef std::tuple<typename TE<Args>::Type...> Type;
│ │ │ │ -
122 };
│ │ │ │ -
│ │ │ │ -
123
│ │ │ │ -
124#ifndef DOXYGEN
│ │ │ │ -
125 template<class Tuple, class Functor, std::size_t... I>
│ │ │ │ -
126 inline auto genericTransformTupleBackendImpl(Tuple& t, Functor& f, const std::index_sequence<I...>& )
│ │ │ │ -
127 -> std::tuple<decltype(f(std::get<I>(t)))...>
│ │ │ │ -
128 {
│ │ │ │ -
129 return std::tuple<decltype(f(std::get<I>(t)))...>(f(std::get<I>(t))...);
│ │ │ │ -
130 }
│ │ │ │ -
131
│ │ │ │ -
132 template<class... Args, class Functor>
│ │ │ │ -
133 auto genericTransformTupleBackend(std::tuple<Args...>& t, Functor& f) ->
│ │ │ │ -
134 decltype(genericTransformTupleBackendImpl(t, f,std::index_sequence_for<Args...>{}))
│ │ │ │ -
135 {
│ │ │ │ -
136 return genericTransformTupleBackendImpl(t, f,std::index_sequence_for<Args...>{});
│ │ │ │ -
137 }
│ │ │ │ -
138
│ │ │ │ -
139 template<class... Args, class Functor>
│ │ │ │ -
140 auto genericTransformTupleBackend(const std::tuple<Args...>& t, Functor& f) ->
│ │ │ │ -
141 decltype(genericTransformTupleBackendImpl(t, f, std::index_sequence_for<Args...>{}))
│ │ │ │ -
142 {
│ │ │ │ -
143 return genericTransformTupleBackendImpl(t, f, std::index_sequence_for<Args...>{});
│ │ │ │ -
144 }
│ │ │ │ -
145#endif
│ │ │ │ -
146
│ │ │ │ -
185 template<class Tuple, class Functor>
│ │ │ │ -
│ │ │ │ -
186 auto genericTransformTuple(Tuple&& t, Functor&& f) ->
│ │ │ │ -
187 decltype(genericTransformTupleBackend(t, f))
│ │ │ │ -
188 {
│ │ │ │ -
189 return genericTransformTupleBackend(t, f);
│ │ │ │ -
190 }
│ │ │ │ -
│ │ │ │ -
191
│ │ │ │ -
224 template<template<class> class TE, class... Args>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
226 {
│ │ │ │ -
227 mutable std::tuple<Args&...> tup;
│ │ │ │ -
228
│ │ │ │ -
229 template<class T, std::size_t... I>
│ │ │ │ -
230 inline auto apply(T&& t, const std::index_sequence<I...>& ) ->
│ │ │ │ -
231 decltype(TE<T>::apply(t,std::get<I>(tup)...)) const
│ │ │ │ -
232 {
│ │ │ │ -
233 return TE<T>::apply(t,std::get<I>(tup)...);
│ │ │ │ -
234 }
│ │ │ │ -
235
│ │ │ │ -
236 public:
│ │ │ │ -
237 template<class T>
│ │ │ │ -
│ │ │ │ -
238 struct TypeEvaluator : public TE<T>
│ │ │ │ -
239 {};
│ │ │ │ -
│ │ │ │ -
240
│ │ │ │ -
│ │ │ │ -
241 TransformTupleFunctor(Args&&... args)
│ │ │ │ -
242 : tup(args...)
│ │ │ │ -
243 { }
│ │ │ │ -
│ │ │ │ -
244
│ │ │ │ -
245 template<class T>
│ │ │ │ -
│ │ │ │ -
246 inline auto operator()(T&& t) ->
│ │ │ │ -
247 decltype(this->apply(t,std::index_sequence_for<Args...>{})) const
│ │ │ │ -
248 {
│ │ │ │ -
249 return apply(t,std::index_sequence_for<Args...>{});
│ │ │ │ -
250 }
│ │ │ │ -
│ │ │ │ -
251 };
│ │ │ │ -
│ │ │ │ -
252
│ │ │ │ -
253 template<template<class> class TE, class... Args>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
255 {
│ │ │ │ -
256 return TransformTupleFunctor<TE, Args...>(args...);
│ │ │ │ -
257 }
│ │ │ │ -
│ │ │ │ -
258
│ │ │ │ -
291 template<template<class> class TypeEvaluator, class Tuple, class... Args>
│ │ │ │ -
│ │ │ │ -
292 auto transformTuple(Tuple&& orig, Args&&... args) ->
│ │ │ │ -
293 decltype(genericTransformTuple(orig, makeTransformTupleFunctor<TypeEvaluator>(args...)))
│ │ │ │ -
294 {
│ │ │ │ -
295 return genericTransformTuple(orig, makeTransformTupleFunctor<TypeEvaluator>(args...));
│ │ │ │ -
296 }
│ │ │ │ -
│ │ │ │ -
297
│ │ │ │ -
299
│ │ │ │ -
303 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
305 {
│ │ │ │ -
306 typedef T& Type;
│ │ │ │ -
│ │ │ │ -
307 static Type apply(T& t)
│ │ │ │ -
308 {
│ │ │ │ -
309 return t;
│ │ │ │ -
310 }
│ │ │ │ -
│ │ │ │ -
311 };
│ │ │ │ -
│ │ │ │ -
312
│ │ │ │ -
314
│ │ │ │ -
318 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
320 {
│ │ │ │ -
321 typedef typename std::remove_reference<T>::type* Type;
│ │ │ │ -
│ │ │ │ -
322 static Type apply(T& t)
│ │ │ │ -
323 {
│ │ │ │ -
324 return &t;
│ │ │ │ -
325 }
│ │ │ │ -
│ │ │ │ -
326 };
│ │ │ │ +
5#ifndef DUNE_COMMON_RESERVEDVECTOR_HH
│ │ │ │ +
6#define DUNE_COMMON_RESERVEDVECTOR_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
│ │ │ │ -
328 // Specialization, in case the type is already a reference
│ │ │ │ -
329 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
331 {
│ │ │ │ -
332 typedef typename std::remove_reference<T>::type* Type;
│ │ │ │ -
│ │ │ │ -
333 static Type apply(T& t)
│ │ │ │ -
334 {
│ │ │ │ -
335 return &t;
│ │ │ │ -
336 }
│ │ │ │ -
│ │ │ │ -
337 };
│ │ │ │ -
│ │ │ │ -
338
│ │ │ │ -
344 template<int N, class Tuple>
│ │ │ │ -
│ │ │ │ -
345 struct AtType
│ │ │ │ -
346 {
│ │ │ │ -
347 typedef typename std::tuple_element<std::tuple_size<Tuple>::value - N - 1, Tuple>::type Type;
│ │ │ │ -
348 };
│ │ │ │ -
│ │ │ │ -
349
│ │ │ │ -
357 template<int N>
│ │ │ │ -
│ │ │ │ -
358 struct At
│ │ │ │ -
359 {
│ │ │ │ -
360 template<typename Tuple>
│ │ │ │ -
361 static typename TupleAccessTraits<typename AtType<N, Tuple>::Type>::NonConstType
│ │ │ │ -
│ │ │ │ -
362 get(Tuple& t)
│ │ │ │ -
363 {
│ │ │ │ -
364 return std::get<std::tuple_size<Tuple>::value - N - 1>(t);
│ │ │ │ -
365 }
│ │ │ │ -
│ │ │ │ -
366
│ │ │ │ -
367 template<typename Tuple>
│ │ │ │ -
368 static typename TupleAccessTraits<typename AtType<N, Tuple>::Type>::ConstType
│ │ │ │ -
│ │ │ │ -
369 get(const Tuple& t)
│ │ │ │ -
370 {
│ │ │ │ -
371 return std::get<std::tuple_size<Tuple>::value - N - 1>(t);
│ │ │ │ -
372 }
│ │ │ │ -
│ │ │ │ -
373 };
│ │ │ │ -
│ │ │ │ -
374
│ │ │ │ -
378 template<class Tuple>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
380 {
│ │ │ │ -
381 template<typename... Ts>
│ │ │ │ -
│ │ │ │ -
382 static void apply(std::tuple<Ts...>& t)
│ │ │ │ -
383 {
│ │ │ │ -
384 Hybrid::forEach(t,[&](auto&& ti){delete ti; ti=nullptr;});
│ │ │ │ -
385 }
│ │ │ │ -
│ │ │ │ -
386 };
│ │ │ │ -
│ │ │ │ -
387
│ │ │ │ -
411 template<class Tuple, template<class> class Predicate, std::size_t start = 0,
│ │ │ │ -
412 std::size_t size = std::tuple_size<Tuple>::value>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
414 public std::conditional<Predicate<typename std::tuple_element<start,
│ │ │ │ -
415 Tuple>::type>::value,
│ │ │ │ -
416 std::integral_constant<std::size_t, start>,
│ │ │ │ -
417 FirstPredicateIndex<Tuple, Predicate, start+1> >::type
│ │ │ │ -
418 {
│ │ │ │ -
419 static_assert(std::tuple_size<Tuple>::value == size, "The \"size\" "
│ │ │ │ -
420 "template parameter of FirstPredicateIndex is an "
│ │ │ │ -
421 "implementation detail and should never be set "
│ │ │ │ -
422 "explicitly!");
│ │ │ │ -
423 };
│ │ │ │ -
│ │ │ │ -
424
│ │ │ │ -
425#ifndef DOXYGEN
│ │ │ │ -
426 template<class Tuple, template<class> class Predicate, std::size_t size>
│ │ │ │ -
427 class FirstPredicateIndex<Tuple, Predicate, size, size>
│ │ │ │ -
428 {
│ │ │ │ -
429 static_assert(AlwaysFalse<Tuple>::value, "None of the std::tuple element "
│ │ │ │ -
430 "types matches the predicate!");
│ │ │ │ -
431 };
│ │ │ │ -
432#endif // !DOXYGEN
│ │ │ │ -
433
│ │ │ │ -
443 template<class T>
│ │ │ │ -
│ │ │ │ -
444 struct IsType
│ │ │ │ -
445 {
│ │ │ │ -
447 template<class U>
│ │ │ │ -
448 struct Predicate : public std::is_same<T, U> {};
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ -
464 template<class Tuple, class T, std::size_t start = 0>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
466 public FirstPredicateIndex<Tuple, IsType<T>::template Predicate, start>
│ │ │ │ -
467 { };
│ │ │ │ -
│ │ │ │ -
468
│ │ │ │ -
475 template<class Tuple, class T>
│ │ │ │ - │ │ │ │ -
477
│ │ │ │ -
478 template<class... Args, class T>
│ │ │ │ -
│ │ │ │ -
479 struct PushBackTuple<typename std::tuple<Args...>, T>
│ │ │ │ -
480 {
│ │ │ │ -
481 typedef typename std::tuple<Args..., T> type;
│ │ │ │ -
482 };
│ │ │ │ -
│ │ │ │ -
483
│ │ │ │ -
490 template<class Tuple, class T>
│ │ │ │ - │ │ │ │ -
492
│ │ │ │ -
493 template<class... Args, class T>
│ │ │ │ -
│ │ │ │ -
494 struct PushFrontTuple<typename std::tuple<Args...>, T>
│ │ │ │ -
495 {
│ │ │ │ -
496 typedef typename std::tuple<T, Args...> type;
│ │ │ │ -
497 };
│ │ │ │ -
│ │ │ │ -
498
│ │ │ │ -
511 template<
│ │ │ │ -
512 template <class, class> class F,
│ │ │ │ -
513 class Tuple,
│ │ │ │ -
514 class Seed=std::tuple<>,
│ │ │ │ -
515 int N=std::tuple_size<Tuple>::value>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
517 {
│ │ │ │ -
518 typedef typename ReduceTuple<F, Tuple, Seed, N-1>::type Accumulated;
│ │ │ │ -
519 typedef typename std::tuple_element<N-1, Tuple>::type Value;
│ │ │ │ -
520
│ │ │ │ -
522 typedef typename F<Accumulated, Value>::type type;
│ │ │ │ -
523 };
│ │ │ │ -
│ │ │ │ -
524
│ │ │ │ -
535 template<
│ │ │ │ -
536 template <class, class> class F,
│ │ │ │ -
537 class Tuple,
│ │ │ │ -
538 class Seed>
│ │ │ │ -
│ │ │ │ -
539 struct ReduceTuple<F, Tuple, Seed, 0>
│ │ │ │ -
540 {
│ │ │ │ -
542 typedef Seed type;
│ │ │ │ -
543 };
│ │ │ │ -
│ │ │ │ -
544
│ │ │ │ -
554 template<class Head, class Tail>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
556 {
│ │ │ │ - │ │ │ │ -
559 };
│ │ │ │ -
│ │ │ │ -
560
│ │ │ │ -
569 template<class Tuple>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
571 {
│ │ │ │ - │ │ │ │ -
574 };
│ │ │ │ -
│ │ │ │ -
575
│ │ │ │ -
577}
│ │ │ │ -
578
│ │ │ │ -
579#endif
│ │ │ │ -
Traits for type conversions and type information.
│ │ │ │ - │ │ │ │ -
std::add_const< T >::type & ConstType
Definition tupleutility.hh:50
│ │ │ │ -
static void apply(std::tuple< Ts... > &t)
Definition tupleutility.hh:382
│ │ │ │ -
T * ParameterType
Definition tupleutility.hh:60
│ │ │ │ -
auto transformTuple(Tuple &&orig, Args &&... args) -> decltype(genericTransformTuple(orig, makeTransformTupleFunctor< TypeEvaluator >(args...)))
Definition tupleutility.hh:292
│ │ │ │ -
T & ConstType
Definition tupleutility.hh:66
│ │ │ │ -
ReduceTuple< F, Tuple, Seed, N-1 >::type Accumulated
Definition tupleutility.hh:518
│ │ │ │ -
T * NonConstType
Definition tupleutility.hh:59
│ │ │ │ -
Seed type
Result of the reduce operation.
Definition tupleutility.hh:542
│ │ │ │ -
std::remove_reference< T >::type * Type
Definition tupleutility.hh:321
│ │ │ │ -
static Type apply(T &t)
Definition tupleutility.hh:307
│ │ │ │ -
static ResultType apply()
Definition tupleutility.hh:85
│ │ │ │ -
std::tuple< Args... > ResultType
Definition tupleutility.hh:84
│ │ │ │ -
std::remove_reference< T >::type * Type
Definition tupleutility.hh:332
│ │ │ │ -
TransformTupleFunctor(Args &&... args)
Definition tupleutility.hh:241
│ │ │ │ -
std::tuple_element< std::tuple_size< Tuple >::value-N-1, Tuple >::type Type
Definition tupleutility.hh:347
│ │ │ │ -
static Type apply(T &t)
Definition tupleutility.hh:333
│ │ │ │ -
auto operator()(T &&t) -> decltype(this->apply(t, std::index_sequence_for< Args... >{})) const
Definition tupleutility.hh:246
│ │ │ │ -
T & NonConstType
Definition tupleutility.hh:67
│ │ │ │ -
T & NonConstType
Definition tupleutility.hh:51
│ │ │ │ -
static TupleAccessTraits< typenameAtType< N, Tuple >::Type >::ConstType get(const Tuple &t)
Definition tupleutility.hh:369
│ │ │ │ -
T & Type
Definition tupleutility.hh:306
│ │ │ │ -
static TupleAccessTraits< typenameAtType< N, Tuple >::Type >::NonConstType get(Tuple &t)
Definition tupleutility.hh:362
│ │ │ │ -
std::tuple< Args..., T > type
Definition tupleutility.hh:481
│ │ │ │ -
std::tuple_element< N-1, Tuple >::type Value
Definition tupleutility.hh:519
│ │ │ │ -
std::tuple< T, Args... > type
Definition tupleutility.hh:496
│ │ │ │ -
ReduceTuple< JoinTuples, Tuple >::type type
Result of the flatten operation.
Definition tupleutility.hh:573
│ │ │ │ -
static Type apply(T &t)
Definition tupleutility.hh:322
│ │ │ │ -
F< Accumulated, Value >::type type
Result of the reduce operation.
Definition tupleutility.hh:522
│ │ │ │ -
ReduceTuple< PushBackTuple, Tail, Head >::type type
Result of the join operation.
Definition tupleutility.hh:558
│ │ │ │ -
std::tuple< typename TE< Args >::Type... > Type
Definition tupleutility.hh:121
│ │ │ │ -
auto genericTransformTuple(Tuple &&t, Functor &&f) -> decltype(genericTransformTupleBackend(t, f))
Definition tupleutility.hh:186
│ │ │ │ -
decltype(auto) applyPartial(F &&f, ArgTuple &&args, std::integer_sequence< I, i... >)
Apply function with arguments from a given tuple.
Definition tupleutility.hh:42
│ │ │ │ -
T & ParameterType
Definition tupleutility.hh:68
│ │ │ │ -
const std::remove_const< T >::type & ParameterType
Definition tupleutility.hh:52
│ │ │ │ -
std::add_const< T >::type * ConstType
Definition tupleutility.hh:58
│ │ │ │ -
TransformTupleFunctor< TE, Args... > makeTransformTupleFunctor(Args &&... args)
Definition tupleutility.hh:254
│ │ │ │ -
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition hybridutilities.hh:256
│ │ │ │ +
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
│ │ │ │
STL namespace.
│ │ │ │
Dune namespace.
Definition alignedallocator.hh:13
│ │ │ │ -
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
│ │ │ │ -
Definition tupleutility.hh:49
│ │ │ │ -
A helper template that initializes a std::tuple consisting of pointers to nullptr.
Definition tupleutility.hh:79
│ │ │ │ -
Helper template to clone the type definition of a std::tuple with the storage types replaced by a use...
Definition tupleutility.hh:116
│ │ │ │ -
Definition tupleutility.hh:226
│ │ │ │ -
Definition tupleutility.hh:239
│ │ │ │ -
TypeEvaluator to turn a type T into a reference to T
Definition tupleutility.hh:305
│ │ │ │ -
TypeEvaluator to turn a type T into a pointer to T
Definition tupleutility.hh:320
│ │ │ │ -
Type for reverse element access.
Definition tupleutility.hh:346
│ │ │ │ -
Reverse element access.
Definition tupleutility.hh:359
│ │ │ │ -
Deletes all objects pointed to in a std::tuple of pointers.
Definition tupleutility.hh:380
│ │ │ │ -
Finding the index of a certain type in a std::tuple.
Definition tupleutility.hh:418
│ │ │ │ -
Generator for predicates accepting one particular type.
Definition tupleutility.hh:445
│ │ │ │ -
The actual predicate.
Definition tupleutility.hh:448
│ │ │ │ -
Find the first occurrence of a type in a std::tuple.
Definition tupleutility.hh:467
│ │ │ │ -
Helper template to append a type to a std::tuple.
Definition tupleutility.hh:476
│ │ │ │ -
Helper template to prepend a type to a std::tuple.
Definition tupleutility.hh:491
│ │ │ │ -
Apply reduce with meta binary function to template.
Definition tupleutility.hh:517
│ │ │ │ -
Join two std::tuple's.
Definition tupleutility.hh:556
│ │ │ │ -
Flatten a std::tuple of std::tuple's.
Definition tupleutility.hh:571
│ │ │ │ -
template which always yields a false value
Definition typetraits.hh:124
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,520 +1,633 @@ │ │ │ │ │ dune-common 2.10 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -tupleutility.hh │ │ │ │ │ +reservedvector.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 © 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_TUPLE_UTILITY_HH │ │ │ │ │ -7#define DUNE_TUPLE_UTILITY_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14#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> │ │ │ │ │ -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 │ │ │ │ │ -41 template │ │ │ │ │ -_4_2 decltype(auto) _a_p_p_l_y_P_a_r_t_i_a_l(F&& f, ArgTuple&& args, std::integer_sequence /*indices*/) │ │ │ │ │ -43 { │ │ │ │ │ -44 return f(std::get(args)...); │ │ │ │ │ -45 } │ │ │ │ │ -46 │ │ │ │ │ -47 template │ │ │ │ │ -_4_8 struct _T_u_p_l_e_A_c_c_e_s_s_T_r_a_i_t_s │ │ │ │ │ -49 { │ │ │ │ │ -_5_0 typedef typename std::add_const::type& _C_o_n_s_t_T_y_p_e; │ │ │ │ │ -_5_1 typedef T& _N_o_n_C_o_n_s_t_T_y_p_e; │ │ │ │ │ -_5_2 typedef const typename std::remove_const::type& _P_a_r_a_m_e_t_e_r_T_y_p_e; │ │ │ │ │ -53 }; │ │ │ │ │ -54 │ │ │ │ │ -55 template │ │ │ │ │ -_5_6 struct _T_u_p_l_e_A_c_c_e_s_s_T_r_a_i_t_s │ │ │ │ │ -57 { │ │ │ │ │ -_5_8 typedef typename std::add_const::type* _C_o_n_s_t_T_y_p_e; │ │ │ │ │ -_5_9 typedef T* _N_o_n_C_o_n_s_t_T_y_p_e; │ │ │ │ │ -_6_0 typedef T* _P_a_r_a_m_e_t_e_r_T_y_p_e; │ │ │ │ │ -61 }; │ │ │ │ │ -62 │ │ │ │ │ -63 template │ │ │ │ │ -_6_4 struct _T_u_p_l_e_A_c_c_e_s_s_T_r_a_i_t_s │ │ │ │ │ -65 { │ │ │ │ │ -_6_6 typedef T& _C_o_n_s_t_T_y_p_e; │ │ │ │ │ -_6_7 typedef T& _N_o_n_C_o_n_s_t_T_y_p_e; │ │ │ │ │ -_6_8 typedef T& _P_a_r_a_m_e_t_e_r_T_y_p_e; │ │ │ │ │ -69 }; │ │ │ │ │ -70 │ │ │ │ │ -78 template │ │ │ │ │ -_7_9 struct _N_u_l_l_P_o_i_n_t_e_r_I_n_i_t_i_a_l_i_s_e_r; │ │ │ │ │ -80 │ │ │ │ │ -81 template │ │ │ │ │ -_8_2 struct _N_u_l_l_P_o_i_n_t_e_r_I_n_i_t_i_a_l_i_s_e_r<_s_t_d::tuple > │ │ │ │ │ -83 { │ │ │ │ │ -_8_4 typedef std::tuple _R_e_s_u_l_t_T_y_p_e; │ │ │ │ │ -_8_5 static _R_e_s_u_l_t_T_y_p_e _a_p_p_l_y() │ │ │ │ │ -86 { │ │ │ │ │ -87 return _R_e_s_u_l_t_T_y_p_e(static_cast(nullptr)...); │ │ │ │ │ -88 } │ │ │ │ │ -89 }; │ │ │ │ │ -90 │ │ │ │ │ -115 template