{"diffoscope-json-version": 1, "source1": "/srv/reproducible-results/rbuild-debian/r-b-build.riXwDqo9/b1/dune-common_2.9.0-2_i386.changes", "source2": "/srv/reproducible-results/rbuild-debian/r-b-build.riXwDqo9/b2/dune-common_2.9.0-2_i386.changes", "unified_diff": null, "details": [{"source1": "Files", "source2": "Files", "unified_diff": "@@ -1,4 +1,4 @@\n \n dd57c400d34b1d05ff15abb12e63c8c8 495992 debug optional libdune-common-dev-dbgsym_2.9.0-2_i386.deb\n 72b4842c4b38ae5f291999ab63c9ee44 379756 libdevel optional libdune-common-dev_2.9.0-2_i386.deb\n- bfc8ee48676a156a80c4a50cd354fe1c 2757380 doc optional libdune-common-doc_2.9.0-2_all.deb\n+ 2a35b9de168c3afcbfe5bfe2d76ad706 2758908 doc optional libdune-common-doc_2.9.0-2_all.deb\n"}, {"source1": "libdune-common-doc_2.9.0-2_all.deb", "source2": "libdune-common-doc_2.9.0-2_all.deb", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,3 +1,3 @@\n -rw-r--r-- 0 0 0 4 2023-01-12 15:39:41.000000 debian-binary\n--rw-r--r-- 0 0 0 26448 2023-01-12 15:39:41.000000 control.tar.xz\n--rw-r--r-- 0 0 0 2730740 2023-01-12 15:39:41.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 26520 2023-01-12 15:39:41.000000 control.tar.xz\n+-rw-r--r-- 0 0 0 2732196 2023-01-12 15:39:41.000000 data.tar.xz\n"}, {"source1": "control.tar.xz", "source2": "control.tar.xz", "unified_diff": null, "details": [{"source1": "control.tar", "source2": "control.tar", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "comments": ["Files differ"], "unified_diff": null}, {"source1": "line order", "source2": "line order", "unified_diff": "@@ -32,17 +32,16 @@\n usr/share/doc/libdune-common-doc/doxygen/a00020_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00023.html\n usr/share/doc/libdune-common-doc/doxygen/a00023_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00026.html\n usr/share/doc/libdune-common-doc/doxygen/a00026_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00029.html\n usr/share/doc/libdune-common-doc/doxygen/a00029_source.html\n-usr/share/doc/libdune-common-doc/doxygen/a00032.html\n-usr/share/doc/libdune-common-doc/doxygen/a00032_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00035.html\n+usr/share/doc/libdune-common-doc/doxygen/a00035_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00038.html\n usr/share/doc/libdune-common-doc/doxygen/a00038_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00041.html\n usr/share/doc/libdune-common-doc/doxygen/a00041_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00044.html\n usr/share/doc/libdune-common-doc/doxygen/a00044_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00047.html\n@@ -50,68 +49,66 @@\n usr/share/doc/libdune-common-doc/doxygen/a00050.html\n usr/share/doc/libdune-common-doc/doxygen/a00050_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00053.html\n usr/share/doc/libdune-common-doc/doxygen/a00053_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00056.html\n usr/share/doc/libdune-common-doc/doxygen/a00056_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00059.html\n+usr/share/doc/libdune-common-doc/doxygen/a00059_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00062.html\n usr/share/doc/libdune-common-doc/doxygen/a00062_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00065.html\n usr/share/doc/libdune-common-doc/doxygen/a00065_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00068.html\n usr/share/doc/libdune-common-doc/doxygen/a00068_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00071.html\n usr/share/doc/libdune-common-doc/doxygen/a00071_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00074.html\n usr/share/doc/libdune-common-doc/doxygen/a00074_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00077.html\n-usr/share/doc/libdune-common-doc/doxygen/a00077_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00080.html\n usr/share/doc/libdune-common-doc/doxygen/a00080_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00083.html\n usr/share/doc/libdune-common-doc/doxygen/a00083_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00086.html\n usr/share/doc/libdune-common-doc/doxygen/a00086_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00089.html\n usr/share/doc/libdune-common-doc/doxygen/a00089_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00092.html\n usr/share/doc/libdune-common-doc/doxygen/a00092_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00095.html\n usr/share/doc/libdune-common-doc/doxygen/a00095_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00098.html\n-usr/share/doc/libdune-common-doc/doxygen/a00098_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00101.html\n usr/share/doc/libdune-common-doc/doxygen/a00101_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00104.html\n usr/share/doc/libdune-common-doc/doxygen/a00104_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00107.html\n usr/share/doc/libdune-common-doc/doxygen/a00107_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00110.html\n usr/share/doc/libdune-common-doc/doxygen/a00110_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00113.html\n-usr/share/doc/libdune-common-doc/doxygen/a00113_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00116.html\n usr/share/doc/libdune-common-doc/doxygen/a00116_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00119.html\n usr/share/doc/libdune-common-doc/doxygen/a00119_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00122.html\n usr/share/doc/libdune-common-doc/doxygen/a00122_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00125.html\n-usr/share/doc/libdune-common-doc/doxygen/a00125_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00128.html\n+usr/share/doc/libdune-common-doc/doxygen/a00128_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00131.html\n usr/share/doc/libdune-common-doc/doxygen/a00131_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00134.html\n+usr/share/doc/libdune-common-doc/doxygen/a00134_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00137.html\n usr/share/doc/libdune-common-doc/doxygen/a00137_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00140.html\n usr/share/doc/libdune-common-doc/doxygen/a00140_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00143.html\n-usr/share/doc/libdune-common-doc/doxygen/a00143_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00146.html\n usr/share/doc/libdune-common-doc/doxygen/a00146_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00149.html\n usr/share/doc/libdune-common-doc/doxygen/a00149_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00152.html\n usr/share/doc/libdune-common-doc/doxygen/a00152_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00155.html\n@@ -137,15 +134,14 @@\n usr/share/doc/libdune-common-doc/doxygen/a00185.html\n usr/share/doc/libdune-common-doc/doxygen/a00185_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00188.html\n usr/share/doc/libdune-common-doc/doxygen/a00188_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00191.html\n usr/share/doc/libdune-common-doc/doxygen/a00191_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00194.html\n-usr/share/doc/libdune-common-doc/doxygen/a00194_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00197.html\n usr/share/doc/libdune-common-doc/doxygen/a00197_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00200.html\n usr/share/doc/libdune-common-doc/doxygen/a00200_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00203.html\n usr/share/doc/libdune-common-doc/doxygen/a00203_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00206.html\n@@ -155,15 +151,14 @@\n usr/share/doc/libdune-common-doc/doxygen/a00212.html\n usr/share/doc/libdune-common-doc/doxygen/a00212_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00215.html\n usr/share/doc/libdune-common-doc/doxygen/a00215_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00218.html\n usr/share/doc/libdune-common-doc/doxygen/a00218_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00221.html\n-usr/share/doc/libdune-common-doc/doxygen/a00221_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00224.html\n usr/share/doc/libdune-common-doc/doxygen/a00224_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00227.html\n usr/share/doc/libdune-common-doc/doxygen/a00227_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00230.html\n usr/share/doc/libdune-common-doc/doxygen/a00230_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00233.html\n@@ -171,27 +166,29 @@\n usr/share/doc/libdune-common-doc/doxygen/a00236.html\n usr/share/doc/libdune-common-doc/doxygen/a00236_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00239.html\n usr/share/doc/libdune-common-doc/doxygen/a00239_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00242.html\n usr/share/doc/libdune-common-doc/doxygen/a00242_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00245.html\n-usr/share/doc/libdune-common-doc/doxygen/a00245_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00248.html\n usr/share/doc/libdune-common-doc/doxygen/a00248_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00251.html\n usr/share/doc/libdune-common-doc/doxygen/a00251_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00254.html\n usr/share/doc/libdune-common-doc/doxygen/a00254_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00257.html\n+usr/share/doc/libdune-common-doc/doxygen/a00257_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00260.html\n usr/share/doc/libdune-common-doc/doxygen/a00263.html\n usr/share/doc/libdune-common-doc/doxygen/a00263_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00266.html\n usr/share/doc/libdune-common-doc/doxygen/a00266_source.html\n+usr/share/doc/libdune-common-doc/doxygen/a00269.html\n+usr/share/doc/libdune-common-doc/doxygen/a00269_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00272.html\n usr/share/doc/libdune-common-doc/doxygen/a00272_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00275.html\n usr/share/doc/libdune-common-doc/doxygen/a00275_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00278.html\n usr/share/doc/libdune-common-doc/doxygen/a00278_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00281.html\n@@ -199,34 +196,37 @@\n usr/share/doc/libdune-common-doc/doxygen/a00284.html\n usr/share/doc/libdune-common-doc/doxygen/a00284_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00287.html\n usr/share/doc/libdune-common-doc/doxygen/a00287_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00290.html\n usr/share/doc/libdune-common-doc/doxygen/a00290_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00293.html\n+usr/share/doc/libdune-common-doc/doxygen/a00293_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00296.html\n+usr/share/doc/libdune-common-doc/doxygen/a00296_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00299.html\n usr/share/doc/libdune-common-doc/doxygen/a00302.html\n usr/share/doc/libdune-common-doc/doxygen/a00302_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00305.html\n+usr/share/doc/libdune-common-doc/doxygen/a00305_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00308.html\n usr/share/doc/libdune-common-doc/doxygen/a00308_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00311.html\n usr/share/doc/libdune-common-doc/doxygen/a00311_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00314.html\n+usr/share/doc/libdune-common-doc/doxygen/a00314_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00317.html\n usr/share/doc/libdune-common-doc/doxygen/a00317_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00320.html\n usr/share/doc/libdune-common-doc/doxygen/a00320_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00323.html\n usr/share/doc/libdune-common-doc/doxygen/a00323_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00326.html\n usr/share/doc/libdune-common-doc/doxygen/a00326_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00329.html\n-usr/share/doc/libdune-common-doc/doxygen/a00329_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00332.html\n usr/share/doc/libdune-common-doc/doxygen/a00332_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00335.html\n usr/share/doc/libdune-common-doc/doxygen/a00335_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00338.html\n usr/share/doc/libdune-common-doc/doxygen/a00338_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00341.html\n@@ -240,15 +240,14 @@\n usr/share/doc/libdune-common-doc/doxygen/a00353.html\n usr/share/doc/libdune-common-doc/doxygen/a00353_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00356.html\n usr/share/doc/libdune-common-doc/doxygen/a00356_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00359.html\n usr/share/doc/libdune-common-doc/doxygen/a00359_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00362.html\n-usr/share/doc/libdune-common-doc/doxygen/a00362_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00365.html\n usr/share/doc/libdune-common-doc/doxygen/a00365_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00368.html\n usr/share/doc/libdune-common-doc/doxygen/a00368_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00371.html\n usr/share/doc/libdune-common-doc/doxygen/a00371_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00374.html\n@@ -258,14 +257,15 @@\n usr/share/doc/libdune-common-doc/doxygen/a00380.html\n usr/share/doc/libdune-common-doc/doxygen/a00380_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00383.html\n usr/share/doc/libdune-common-doc/doxygen/a00383_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00386.html\n usr/share/doc/libdune-common-doc/doxygen/a00386_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00389.html\n+usr/share/doc/libdune-common-doc/doxygen/a00389_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00392.html\n usr/share/doc/libdune-common-doc/doxygen/a00392_source.html\n usr/share/doc/libdune-common-doc/doxygen/a00395.html\n usr/share/doc/libdune-common-doc/doxygen/a00396.html\n usr/share/doc/libdune-common-doc/doxygen/a00397.html\n usr/share/doc/libdune-common-doc/doxygen/a00397.png\n usr/share/doc/libdune-common-doc/doxygen/a00398.html\n"}]}]}]}, {"source1": "data.tar.xz", "source2": "data.tar.xz", "unified_diff": null, "details": [{"source1": "data.tar", "source2": "data.tar", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -26,258 +26,258 @@\n -rw-r--r-- 0 root (0) root (0) 2944 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/buildsystem/html/search.html\n -rw-r--r-- 0 root (0) root (0) 10569 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/buildsystem/html/searchindex.js\n -rw-r--r-- 0 root (0) root (0) 1683 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/changelog.Debian.gz\n -rw-r--r-- 0 root (0) root (0) 7231 2022-10-20 18:41:15.000000 ./usr/share/doc/libdune-common-doc/changelog.gz\n -rw-r--r-- 0 root (0) root (0) 9815 2023-01-12 15:06:30.000000 ./usr/share/doc/libdune-common-doc/copyright\n drwxr-xr-x 0 root (0) root (0) 0 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/\n -rw-r--r-- 0 root (0) root (0) 2875 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00002.html\n--rw-r--r-- 0 root (0) root (0) 3650 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008.html\n--rw-r--r-- 0 root (0) root (0) 6145 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html\n--rw-r--r-- 0 root (0) root (0) 3202 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011.html\n--rw-r--r-- 0 root (0) root (0) 88611 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html\n--rw-r--r-- 0 root (0) root (0) 4809 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014.html\n--rw-r--r-- 0 root (0) root (0) 30708 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html\n--rw-r--r-- 0 root (0) root (0) 5093 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017.html\n--rw-r--r-- 0 root (0) root (0) 10799 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html\n--rw-r--r-- 0 root (0) root (0) 4584 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020.html\n--rw-r--r-- 0 root (0) root (0) 13590 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020_source.html\n--rw-r--r-- 0 root (0) root (0) 5990 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023.html\n--rw-r--r-- 0 root (0) root (0) 6401 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html\n--rw-r--r-- 0 root (0) root (0) 6253 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026.html\n--rw-r--r-- 0 root (0) root (0) 15564 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html\n--rw-r--r-- 0 root (0) root (0) 8809 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029.html\n--rw-r--r-- 0 root (0) root (0) 10158 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html\n--rw-r--r-- 0 root (0) root (0) 4776 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032.html\n--rw-r--r-- 0 root (0) root (0) 6226 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00032_source.html\n--rw-r--r-- 0 root (0) root (0) 3944 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035.html\n--rw-r--r-- 0 root (0) root (0) 17498 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038.html\n--rw-r--r-- 0 root (0) root (0) 44697 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038_source.html\n--rw-r--r-- 0 root (0) root (0) 8012 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041.html\n--rw-r--r-- 0 root (0) root (0) 39175 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html\n--rw-r--r-- 0 root (0) root (0) 9970 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044.html\n--rw-r--r-- 0 root (0) root (0) 31576 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html\n--rw-r--r-- 0 root (0) root (0) 5848 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047.html\n--rw-r--r-- 0 root (0) root (0) 20583 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html\n--rw-r--r-- 0 root (0) root (0) 13484 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050.html\n--rw-r--r-- 0 root (0) root (0) 22858 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html\n--rw-r--r-- 0 root (0) root (0) 9428 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053.html\n--rw-r--r-- 0 root (0) root (0) 242767 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053_source.html\n--rw-r--r-- 0 root (0) root (0) 4942 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056.html\n--rw-r--r-- 0 root (0) root (0) 29332 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056_source.html\n--rw-r--r-- 0 root (0) root (0) 21197 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059.html\n--rw-r--r-- 0 root (0) root (0) 6674 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062.html\n--rw-r--r-- 0 root (0) root (0) 107074 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html\n--rw-r--r-- 0 root (0) root (0) 14232 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065.html\n--rw-r--r-- 0 root (0) root (0) 65414 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html\n--rw-r--r-- 0 root (0) root (0) 5164 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068.html\n--rw-r--r-- 0 root (0) root (0) 33610 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html\n--rw-r--r-- 0 root (0) root (0) 8190 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071.html\n--rw-r--r-- 0 root (0) root (0) 15083 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html\n--rw-r--r-- 0 root (0) root (0) 11314 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074.html\n--rw-r--r-- 0 root (0) root (0) 53376 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html\n--rw-r--r-- 0 root (0) root (0) 5964 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077.html\n--rw-r--r-- 0 root (0) root (0) 19049 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077_source.html\n--rw-r--r-- 0 root (0) root (0) 4512 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080.html\n--rw-r--r-- 0 root (0) root (0) 6996 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html\n--rw-r--r-- 0 root (0) root (0) 6004 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083.html\n--rw-r--r-- 0 root (0) root (0) 16983 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html\n--rw-r--r-- 0 root (0) root (0) 5301 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086.html\n--rw-r--r-- 0 root (0) root (0) 7858 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html\n--rw-r--r-- 0 root (0) root (0) 6666 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089.html\n--rw-r--r-- 0 root (0) root (0) 7883 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html\n--rw-r--r-- 0 root (0) root (0) 7240 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092.html\n--rw-r--r-- 0 root (0) root (0) 18045 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html\n--rw-r--r-- 0 root (0) root (0) 6044 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095.html\n--rw-r--r-- 0 root (0) root (0) 8357 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html\n--rw-r--r-- 0 root (0) root (0) 7678 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098.html\n--rw-r--r-- 0 root (0) root (0) 11713 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098_source.html\n--rw-r--r-- 0 root (0) root (0) 4998 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101.html\n--rw-r--r-- 0 root (0) root (0) 8995 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html\n--rw-r--r-- 0 root (0) root (0) 7471 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104.html\n--rw-r--r-- 0 root (0) root (0) 9668 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html\n--rw-r--r-- 0 root (0) root (0) 4474 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107.html\n--rw-r--r-- 0 root (0) root (0) 6339 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html\n--rw-r--r-- 0 root (0) root (0) 5605 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110.html\n--rw-r--r-- 0 root (0) root (0) 9719 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110_source.html\n--rw-r--r-- 0 root (0) root (0) 16848 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113.html\n--rw-r--r-- 0 root (0) root (0) 42375 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113_source.html\n--rw-r--r-- 0 root (0) root (0) 4480 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116.html\n--rw-r--r-- 0 root (0) root (0) 7691 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html\n--rw-r--r-- 0 root (0) root (0) 4480 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119.html\n--rw-r--r-- 0 root (0) root (0) 7248 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html\n--rw-r--r-- 0 root (0) root (0) 5186 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122.html\n--rw-r--r-- 0 root (0) root (0) 8487 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html\n--rw-r--r-- 0 root (0) root (0) 6998 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125.html\n--rw-r--r-- 0 root (0) root (0) 148981 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125_source.html\n--rw-r--r-- 0 root (0) root (0) 3729 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128.html\n--rw-r--r-- 0 root (0) root (0) 17418 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131.html\n--rw-r--r-- 0 root (0) root (0) 76033 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html\n--rw-r--r-- 0 root (0) root (0) 4754 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134.html\n--rw-r--r-- 0 root (0) root (0) 4899 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137.html\n--rw-r--r-- 0 root (0) root (0) 7547 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137_source.html\n--rw-r--r-- 0 root (0) root (0) 3214 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140.html\n--rw-r--r-- 0 root (0) root (0) 51504 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140_source.html\n--rw-r--r-- 0 root (0) root (0) 10688 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143.html\n--rw-r--r-- 0 root (0) root (0) 22213 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143_source.html\n--rw-r--r-- 0 root (0) root (0) 13788 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146.html\n--rw-r--r-- 0 root (0) root (0) 86891 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146_source.html\n--rw-r--r-- 0 root (0) root (0) 8569 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149.html\n--rw-r--r-- 0 root (0) root (0) 15045 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149_source.html\n--rw-r--r-- 0 root (0) root (0) 5485 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152.html\n--rw-r--r-- 0 root (0) root (0) 10357 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152_source.html\n--rw-r--r-- 0 root (0) root (0) 5094 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155.html\n--rw-r--r-- 0 root (0) root (0) 21556 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155_source.html\n--rw-r--r-- 0 root (0) root (0) 6650 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158.html\n--rw-r--r-- 0 root (0) root (0) 12338 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158_source.html\n--rw-r--r-- 0 root (0) root (0) 4250 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161.html\n--rw-r--r-- 0 root (0) root (0) 6054 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161_source.html\n--rw-r--r-- 0 root (0) root (0) 16962 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164.html\n--rw-r--r-- 0 root (0) root (0) 166161 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164_source.html\n--rw-r--r-- 0 root (0) root (0) 5610 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167.html\n--rw-r--r-- 0 root (0) root (0) 16342 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167_source.html\n--rw-r--r-- 0 root (0) root (0) 7215 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170.html\n--rw-r--r-- 0 root (0) root (0) 30184 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170_source.html\n--rw-r--r-- 0 root (0) root (0) 4885 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173.html\n--rw-r--r-- 0 root (0) root (0) 6495 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173_source.html\n--rw-r--r-- 0 root (0) root (0) 8506 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176.html\n--rw-r--r-- 0 root (0) root (0) 25816 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176_source.html\n--rw-r--r-- 0 root (0) root (0) 8243 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179.html\n--rw-r--r-- 0 root (0) root (0) 40020 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179_source.html\n--rw-r--r-- 0 root (0) root (0) 18479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182.html\n--rw-r--r-- 0 root (0) root (0) 101876 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182_source.html\n--rw-r--r-- 0 root (0) root (0) 12461 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185.html\n--rw-r--r-- 0 root (0) root (0) 91639 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185_source.html\n--rw-r--r-- 0 root (0) root (0) 6941 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188.html\n--rw-r--r-- 0 root (0) root (0) 21983 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188_source.html\n--rw-r--r-- 0 root (0) root (0) 6403 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191.html\n--rw-r--r-- 0 root (0) root (0) 42750 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191_source.html\n--rw-r--r-- 0 root (0) root (0) 9316 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194.html\n--rw-r--r-- 0 root (0) root (0) 242326 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194_source.html\n--rw-r--r-- 0 root (0) root (0) 13285 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197.html\n--rw-r--r-- 0 root (0) root (0) 28077 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197_source.html\n--rw-r--r-- 0 root (0) root (0) 7196 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200.html\n--rw-r--r-- 0 root (0) root (0) 9379 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200_source.html\n--rw-r--r-- 0 root (0) root (0) 8013 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203.html\n--rw-r--r-- 0 root (0) root (0) 143638 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203_source.html\n--rw-r--r-- 0 root (0) root (0) 11254 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206.html\n--rw-r--r-- 0 root (0) root (0) 114010 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206_source.html\n--rw-r--r-- 0 root (0) root (0) 6373 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209.html\n--rw-r--r-- 0 root (0) root (0) 18116 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209_source.html\n--rw-r--r-- 0 root (0) root (0) 6156 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212.html\n--rw-r--r-- 0 root (0) root (0) 18508 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212_source.html\n--rw-r--r-- 0 root (0) root (0) 5142 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215.html\n--rw-r--r-- 0 root (0) root (0) 9611 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215_source.html\n--rw-r--r-- 0 root (0) root (0) 9892 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218.html\n--rw-r--r-- 0 root (0) root (0) 109105 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218_source.html\n--rw-r--r-- 0 root (0) root (0) 45376 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221.html\n--rw-r--r-- 0 root (0) root (0) 14273 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221_source.html\n--rw-r--r-- 0 root (0) root (0) 4126 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224.html\n--rw-r--r-- 0 root (0) root (0) 18020 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224_source.html\n--rw-r--r-- 0 root (0) root (0) 5064 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227.html\n--rw-r--r-- 0 root (0) root (0) 9917 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227_source.html\n--rw-r--r-- 0 root (0) root (0) 5431 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230.html\n--rw-r--r-- 0 root (0) root (0) 6938 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230_source.html\n--rw-r--r-- 0 root (0) root (0) 20174 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233.html\n--rw-r--r-- 0 root (0) root (0) 130337 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233_source.html\n--rw-r--r-- 0 root (0) root (0) 6479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236.html\n--rw-r--r-- 0 root (0) root (0) 51046 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236_source.html\n--rw-r--r-- 0 root (0) root (0) 19755 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239.html\n--rw-r--r-- 0 root (0) root (0) 29417 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239_source.html\n--rw-r--r-- 0 root (0) root (0) 6595 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242.html\n--rw-r--r-- 0 root (0) root (0) 96963 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242_source.html\n--rw-r--r-- 0 root (0) root (0) 5031 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245.html\n--rw-r--r-- 0 root (0) root (0) 15647 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245_source.html\n--rw-r--r-- 0 root (0) root (0) 5420 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248.html\n--rw-r--r-- 0 root (0) root (0) 8892 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248_source.html\n--rw-r--r-- 0 root (0) root (0) 5947 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251.html\n--rw-r--r-- 0 root (0) root (0) 20957 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251_source.html\n--rw-r--r-- 0 root (0) root (0) 55958 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254.html\n--rw-r--r-- 0 root (0) root (0) 127006 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254_source.html\n--rw-r--r-- 0 root (0) root (0) 9138 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257.html\n--rw-r--r-- 0 root (0) root (0) 3479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260.html\n--rw-r--r-- 0 root (0) root (0) 73012 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263.html\n--rw-r--r-- 0 root (0) root (0) 145326 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263_source.html\n--rw-r--r-- 0 root (0) root (0) 22309 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266.html\n--rw-r--r-- 0 root (0) root (0) 41730 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266_source.html\n--rw-r--r-- 0 root (0) root (0) 6504 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272.html\n--rw-r--r-- 0 root (0) root (0) 10628 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272_source.html\n--rw-r--r-- 0 root (0) root (0) 13240 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275.html\n--rw-r--r-- 0 root (0) root (0) 19678 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275_source.html\n--rw-r--r-- 0 root (0) root (0) 9514 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278.html\n--rw-r--r-- 0 root (0) root (0) 18624 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278_source.html\n--rw-r--r-- 0 root (0) root (0) 31969 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281.html\n--rw-r--r-- 0 root (0) root (0) 351570 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281_source.html\n--rw-r--r-- 0 root (0) root (0) 7657 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284.html\n--rw-r--r-- 0 root (0) root (0) 119846 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284_source.html\n--rw-r--r-- 0 root (0) root (0) 13833 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287.html\n--rw-r--r-- 0 root (0) root (0) 145936 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287_source.html\n--rw-r--r-- 0 root (0) root (0) 24902 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290.html\n--rw-r--r-- 0 root (0) root (0) 62033 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290_source.html\n--rw-r--r-- 0 root (0) root (0) 6651 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293.html\n--rw-r--r-- 0 root (0) root (0) 7934 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296.html\n--rw-r--r-- 0 root (0) root (0) 4537 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299.html\n--rw-r--r-- 0 root (0) root (0) 5173 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302.html\n--rw-r--r-- 0 root (0) root (0) 40029 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302_source.html\n--rw-r--r-- 0 root (0) root (0) 3941 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305.html\n--rw-r--r-- 0 root (0) root (0) 7987 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308.html\n--rw-r--r-- 0 root (0) root (0) 61732 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308_source.html\n--rw-r--r-- 0 root (0) root (0) 5455 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311.html\n--rw-r--r-- 0 root (0) root (0) 33081 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311_source.html\n--rw-r--r-- 0 root (0) root (0) 22487 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314.html\n--rw-r--r-- 0 root (0) root (0) 18448 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317.html\n--rw-r--r-- 0 root (0) root (0) 177953 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317_source.html\n--rw-r--r-- 0 root (0) root (0) 8958 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320.html\n--rw-r--r-- 0 root (0) root (0) 171994 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320_source.html\n--rw-r--r-- 0 root (0) root (0) 11001 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323.html\n--rw-r--r-- 0 root (0) root (0) 285442 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323_source.html\n--rw-r--r-- 0 root (0) root (0) 3479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326.html\n--rw-r--r-- 0 root (0) root (0) 4602 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326_source.html\n--rw-r--r-- 0 root (0) root (0) 12174 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329.html\n--rw-r--r-- 0 root (0) root (0) 170838 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329_source.html\n--rw-r--r-- 0 root (0) root (0) 3488 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332.html\n--rw-r--r-- 0 root (0) root (0) 4599 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332_source.html\n--rw-r--r-- 0 root (0) root (0) 8593 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335.html\n--rw-r--r-- 0 root (0) root (0) 50688 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335_source.html\n--rw-r--r-- 0 root (0) root (0) 6433 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338.html\n--rw-r--r-- 0 root (0) root (0) 56061 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338_source.html\n--rw-r--r-- 0 root (0) root (0) 8529 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341.html\n--rw-r--r-- 0 root (0) root (0) 68849 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341_source.html\n--rw-r--r-- 0 root (0) root (0) 8223 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344.html\n--rw-r--r-- 0 root (0) root (0) 45084 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344_source.html\n--rw-r--r-- 0 root (0) root (0) 6387 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347.html\n--rw-r--r-- 0 root (0) root (0) 44463 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347_source.html\n--rw-r--r-- 0 root (0) root (0) 6463 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350.html\n--rw-r--r-- 0 root (0) root (0) 38085 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350_source.html\n--rw-r--r-- 0 root (0) root (0) 7187 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353.html\n--rw-r--r-- 0 root (0) root (0) 31844 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353_source.html\n--rw-r--r-- 0 root (0) root (0) 6387 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356.html\n--rw-r--r-- 0 root (0) root (0) 18874 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356_source.html\n--rw-r--r-- 0 root (0) root (0) 7395 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359.html\n--rw-r--r-- 0 root (0) root (0) 135895 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359_source.html\n--rw-r--r-- 0 root (0) root (0) 11262 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362.html\n--rw-r--r-- 0 root (0) root (0) 97989 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362_source.html\n--rw-r--r-- 0 root (0) root (0) 6215 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365.html\n--rw-r--r-- 0 root (0) root (0) 32452 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365_source.html\n--rw-r--r-- 0 root (0) root (0) 5802 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368.html\n--rw-r--r-- 0 root (0) root (0) 49130 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368_source.html\n--rw-r--r-- 0 root (0) root (0) 4866 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371.html\n--rw-r--r-- 0 root (0) root (0) 22263 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371_source.html\n--rw-r--r-- 0 root (0) root (0) 15379 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374.html\n--rw-r--r-- 0 root (0) root (0) 48457 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374_source.html\n--rw-r--r-- 0 root (0) root (0) 8575 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377.html\n--rw-r--r-- 0 root (0) root (0) 60148 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377_source.html\n--rw-r--r-- 0 root (0) root (0) 4155 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380.html\n--rw-r--r-- 0 root (0) root (0) 4756 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380_source.html\n--rw-r--r-- 0 root (0) root (0) 7160 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383.html\n--rw-r--r-- 0 root (0) root (0) 13976 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383_source.html\n--rw-r--r-- 0 root (0) root (0) 20498 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386.html\n--rw-r--r-- 0 root (0) root (0) 65100 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386_source.html\n--rw-r--r-- 0 root (0) root (0) 3779 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389.html\n--rw-r--r-- 0 root (0) root (0) 13669 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392.html\n--rw-r--r-- 0 root (0) root (0) 53424 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392_source.html\n+-rw-r--r-- 0 root (0) root (0) 8012 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008.html\n+-rw-r--r-- 0 root (0) root (0) 39175 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html\n+-rw-r--r-- 0 root (0) root (0) 18479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011.html\n+-rw-r--r-- 0 root (0) root (0) 101876 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html\n+-rw-r--r-- 0 root (0) root (0) 20498 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014.html\n+-rw-r--r-- 0 root (0) root (0) 65100 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html\n+-rw-r--r-- 0 root (0) root (0) 5610 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017.html\n+-rw-r--r-- 0 root (0) root (0) 16342 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html\n+-rw-r--r-- 0 root (0) root (0) 8013 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020.html\n+-rw-r--r-- 0 root (0) root (0) 143638 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00020_source.html\n+-rw-r--r-- 0 root (0) root (0) 14232 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023.html\n+-rw-r--r-- 0 root (0) root (0) 65414 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html\n+-rw-r--r-- 0 root (0) root (0) 8569 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026.html\n+-rw-r--r-- 0 root (0) root (0) 15045 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html\n+-rw-r--r-- 0 root (0) root (0) 8958 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029.html\n+-rw-r--r-- 0 root (0) root (0) 171994 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html\n+-rw-r--r-- 0 root (0) root (0) 8593 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035.html\n+-rw-r--r-- 0 root (0) root (0) 50688 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00035_source.html\n+-rw-r--r-- 0 root (0) root (0) 11001 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038.html\n+-rw-r--r-- 0 root (0) root (0) 285442 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00038_source.html\n+-rw-r--r-- 0 root (0) root (0) 8223 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041.html\n+-rw-r--r-- 0 root (0) root (0) 45084 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html\n+-rw-r--r-- 0 root (0) root (0) 3488 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044.html\n+-rw-r--r-- 0 root (0) root (0) 4599 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html\n+-rw-r--r-- 0 root (0) root (0) 5802 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047.html\n+-rw-r--r-- 0 root (0) root (0) 49130 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html\n+-rw-r--r-- 0 root (0) root (0) 6463 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050.html\n+-rw-r--r-- 0 root (0) root (0) 38085 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html\n+-rw-r--r-- 0 root (0) root (0) 3479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053.html\n+-rw-r--r-- 0 root (0) root (0) 4602 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00053_source.html\n+-rw-r--r-- 0 root (0) root (0) 7395 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056.html\n+-rw-r--r-- 0 root (0) root (0) 135895 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00056_source.html\n+-rw-r--r-- 0 root (0) root (0) 6215 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059.html\n+-rw-r--r-- 0 root (0) root (0) 32452 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00059_source.html\n+-rw-r--r-- 0 root (0) root (0) 6433 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062.html\n+-rw-r--r-- 0 root (0) root (0) 56061 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html\n+-rw-r--r-- 0 root (0) root (0) 18448 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065.html\n+-rw-r--r-- 0 root (0) root (0) 177953 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html\n+-rw-r--r-- 0 root (0) root (0) 6387 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068.html\n+-rw-r--r-- 0 root (0) root (0) 44463 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html\n+-rw-r--r-- 0 root (0) root (0) 8529 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071.html\n+-rw-r--r-- 0 root (0) root (0) 68849 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html\n+-rw-r--r-- 0 root (0) root (0) 5455 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074.html\n+-rw-r--r-- 0 root (0) root (0) 33081 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html\n+-rw-r--r-- 0 root (0) root (0) 22487 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00077.html\n+-rw-r--r-- 0 root (0) root (0) 7187 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080.html\n+-rw-r--r-- 0 root (0) root (0) 31844 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html\n+-rw-r--r-- 0 root (0) root (0) 11262 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083.html\n+-rw-r--r-- 0 root (0) root (0) 97989 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html\n+-rw-r--r-- 0 root (0) root (0) 6387 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086.html\n+-rw-r--r-- 0 root (0) root (0) 18874 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html\n+-rw-r--r-- 0 root (0) root (0) 12174 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089.html\n+-rw-r--r-- 0 root (0) root (0) 170838 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html\n+-rw-r--r-- 0 root (0) root (0) 5094 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092.html\n+-rw-r--r-- 0 root (0) root (0) 21556 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html\n+-rw-r--r-- 0 root (0) root (0) 8575 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095.html\n+-rw-r--r-- 0 root (0) root (0) 60148 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html\n+-rw-r--r-- 0 root (0) root (0) 3941 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00098.html\n+-rw-r--r-- 0 root (0) root (0) 13669 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101.html\n+-rw-r--r-- 0 root (0) root (0) 53424 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html\n+-rw-r--r-- 0 root (0) root (0) 6403 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104.html\n+-rw-r--r-- 0 root (0) root (0) 42750 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html\n+-rw-r--r-- 0 root (0) root (0) 6998 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107.html\n+-rw-r--r-- 0 root (0) root (0) 148981 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html\n+-rw-r--r-- 0 root (0) root (0) 6479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110.html\n+-rw-r--r-- 0 root (0) root (0) 51046 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00110_source.html\n+-rw-r--r-- 0 root (0) root (0) 3944 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00113.html\n+-rw-r--r-- 0 root (0) root (0) 6674 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116.html\n+-rw-r--r-- 0 root (0) root (0) 107074 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html\n+-rw-r--r-- 0 root (0) root (0) 6373 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119.html\n+-rw-r--r-- 0 root (0) root (0) 18116 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html\n+-rw-r--r-- 0 root (0) root (0) 7678 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122.html\n+-rw-r--r-- 0 root (0) root (0) 11713 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html\n+-rw-r--r-- 0 root (0) root (0) 3779 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00125.html\n+-rw-r--r-- 0 root (0) root (0) 7240 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128.html\n+-rw-r--r-- 0 root (0) root (0) 18045 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00128_source.html\n+-rw-r--r-- 0 root (0) root (0) 9970 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131.html\n+-rw-r--r-- 0 root (0) root (0) 31576 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html\n+-rw-r--r-- 0 root (0) root (0) 7160 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134.html\n+-rw-r--r-- 0 root (0) root (0) 13976 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00134_source.html\n+-rw-r--r-- 0 root (0) root (0) 4998 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137.html\n+-rw-r--r-- 0 root (0) root (0) 8995 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00137_source.html\n+-rw-r--r-- 0 root (0) root (0) 5964 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140.html\n+-rw-r--r-- 0 root (0) root (0) 19049 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00140_source.html\n+-rw-r--r-- 0 root (0) root (0) 7934 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00143.html\n+-rw-r--r-- 0 root (0) root (0) 20174 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146.html\n+-rw-r--r-- 0 root (0) root (0) 130337 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00146_source.html\n+-rw-r--r-- 0 root (0) root (0) 3650 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149.html\n+-rw-r--r-- 0 root (0) root (0) 6145 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00149_source.html\n+-rw-r--r-- 0 root (0) root (0) 5848 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152.html\n+-rw-r--r-- 0 root (0) root (0) 20583 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00152_source.html\n+-rw-r--r-- 0 root (0) root (0) 4942 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155.html\n+-rw-r--r-- 0 root (0) root (0) 29332 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00155_source.html\n+-rw-r--r-- 0 root (0) root (0) 8809 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158.html\n+-rw-r--r-- 0 root (0) root (0) 10158 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00158_source.html\n+-rw-r--r-- 0 root (0) root (0) 8506 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161.html\n+-rw-r--r-- 0 root (0) root (0) 25816 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00161_source.html\n+-rw-r--r-- 0 root (0) root (0) 5431 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164.html\n+-rw-r--r-- 0 root (0) root (0) 6938 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00164_source.html\n+-rw-r--r-- 0 root (0) root (0) 4250 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167.html\n+-rw-r--r-- 0 root (0) root (0) 6054 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00167_source.html\n+-rw-r--r-- 0 root (0) root (0) 7987 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170.html\n+-rw-r--r-- 0 root (0) root (0) 61732 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00170_source.html\n+-rw-r--r-- 0 root (0) root (0) 4512 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173.html\n+-rw-r--r-- 0 root (0) root (0) 6996 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00173_source.html\n+-rw-r--r-- 0 root (0) root (0) 5064 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176.html\n+-rw-r--r-- 0 root (0) root (0) 9917 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00176_source.html\n+-rw-r--r-- 0 root (0) root (0) 12461 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179.html\n+-rw-r--r-- 0 root (0) root (0) 91639 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00179_source.html\n+-rw-r--r-- 0 root (0) root (0) 24902 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182.html\n+-rw-r--r-- 0 root (0) root (0) 62033 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00182_source.html\n+-rw-r--r-- 0 root (0) root (0) 17498 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185.html\n+-rw-r--r-- 0 root (0) root (0) 44697 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00185_source.html\n+-rw-r--r-- 0 root (0) root (0) 7215 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188.html\n+-rw-r--r-- 0 root (0) root (0) 30184 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00188_source.html\n+-rw-r--r-- 0 root (0) root (0) 6156 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191.html\n+-rw-r--r-- 0 root (0) root (0) 18508 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00191_source.html\n+-rw-r--r-- 0 root (0) root (0) 3729 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00194.html\n+-rw-r--r-- 0 root (0) root (0) 6044 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197.html\n+-rw-r--r-- 0 root (0) root (0) 8357 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00197_source.html\n+-rw-r--r-- 0 root (0) root (0) 17418 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200.html\n+-rw-r--r-- 0 root (0) root (0) 76033 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00200_source.html\n+-rw-r--r-- 0 root (0) root (0) 5093 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203.html\n+-rw-r--r-- 0 root (0) root (0) 10799 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00203_source.html\n+-rw-r--r-- 0 root (0) root (0) 13833 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206.html\n+-rw-r--r-- 0 root (0) root (0) 145936 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00206_source.html\n+-rw-r--r-- 0 root (0) root (0) 5420 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209.html\n+-rw-r--r-- 0 root (0) root (0) 8892 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00209_source.html\n+-rw-r--r-- 0 root (0) root (0) 5301 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212.html\n+-rw-r--r-- 0 root (0) root (0) 7858 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00212_source.html\n+-rw-r--r-- 0 root (0) root (0) 9892 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215.html\n+-rw-r--r-- 0 root (0) root (0) 109105 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00215_source.html\n+-rw-r--r-- 0 root (0) root (0) 5485 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218.html\n+-rw-r--r-- 0 root (0) root (0) 10357 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00218_source.html\n+-rw-r--r-- 0 root (0) root (0) 9138 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00221.html\n+-rw-r--r-- 0 root (0) root (0) 15379 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224.html\n+-rw-r--r-- 0 root (0) root (0) 48457 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00224_source.html\n+-rw-r--r-- 0 root (0) root (0) 5173 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227.html\n+-rw-r--r-- 0 root (0) root (0) 40029 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00227_source.html\n+-rw-r--r-- 0 root (0) root (0) 7471 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230.html\n+-rw-r--r-- 0 root (0) root (0) 9668 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00230_source.html\n+-rw-r--r-- 0 root (0) root (0) 8190 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233.html\n+-rw-r--r-- 0 root (0) root (0) 15083 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00233_source.html\n+-rw-r--r-- 0 root (0) root (0) 4126 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236.html\n+-rw-r--r-- 0 root (0) root (0) 18020 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00236_source.html\n+-rw-r--r-- 0 root (0) root (0) 7196 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239.html\n+-rw-r--r-- 0 root (0) root (0) 9379 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00239_source.html\n+-rw-r--r-- 0 root (0) root (0) 13285 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242.html\n+-rw-r--r-- 0 root (0) root (0) 28077 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00242_source.html\n+-rw-r--r-- 0 root (0) root (0) 4537 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00245.html\n+-rw-r--r-- 0 root (0) root (0) 4809 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248.html\n+-rw-r--r-- 0 root (0) root (0) 30708 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00248_source.html\n+-rw-r--r-- 0 root (0) root (0) 19755 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251.html\n+-rw-r--r-- 0 root (0) root (0) 29417 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00251_source.html\n+-rw-r--r-- 0 root (0) root (0) 5031 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254.html\n+-rw-r--r-- 0 root (0) root (0) 15647 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00254_source.html\n+-rw-r--r-- 0 root (0) root (0) 6650 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257.html\n+-rw-r--r-- 0 root (0) root (0) 12338 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00257_source.html\n+-rw-r--r-- 0 root (0) root (0) 21197 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00260.html\n+-rw-r--r-- 0 root (0) root (0) 8243 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263.html\n+-rw-r--r-- 0 root (0) root (0) 40020 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00263_source.html\n+-rw-r--r-- 0 root (0) root (0) 3214 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266.html\n+-rw-r--r-- 0 root (0) root (0) 51504 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00266_source.html\n+-rw-r--r-- 0 root (0) root (0) 6941 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269.html\n+-rw-r--r-- 0 root (0) root (0) 21983 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00269_source.html\n+-rw-r--r-- 0 root (0) root (0) 4899 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272.html\n+-rw-r--r-- 0 root (0) root (0) 7547 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00272_source.html\n+-rw-r--r-- 0 root (0) root (0) 4480 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275.html\n+-rw-r--r-- 0 root (0) root (0) 7248 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00275_source.html\n+-rw-r--r-- 0 root (0) root (0) 4474 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278.html\n+-rw-r--r-- 0 root (0) root (0) 6339 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00278_source.html\n+-rw-r--r-- 0 root (0) root (0) 5186 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281.html\n+-rw-r--r-- 0 root (0) root (0) 8487 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00281_source.html\n+-rw-r--r-- 0 root (0) root (0) 5605 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284.html\n+-rw-r--r-- 0 root (0) root (0) 9719 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00284_source.html\n+-rw-r--r-- 0 root (0) root (0) 16848 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287.html\n+-rw-r--r-- 0 root (0) root (0) 42375 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00287_source.html\n+-rw-r--r-- 0 root (0) root (0) 4480 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290.html\n+-rw-r--r-- 0 root (0) root (0) 7691 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00290_source.html\n+-rw-r--r-- 0 root (0) root (0) 9316 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293.html\n+-rw-r--r-- 0 root (0) root (0) 242326 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00293_source.html\n+-rw-r--r-- 0 root (0) root (0) 13788 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296.html\n+-rw-r--r-- 0 root (0) root (0) 86891 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00296_source.html\n+-rw-r--r-- 0 root (0) root (0) 6651 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00299.html\n+-rw-r--r-- 0 root (0) root (0) 11254 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302.html\n+-rw-r--r-- 0 root (0) root (0) 114010 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00302_source.html\n+-rw-r--r-- 0 root (0) root (0) 4885 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305.html\n+-rw-r--r-- 0 root (0) root (0) 6495 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00305_source.html\n+-rw-r--r-- 0 root (0) root (0) 11314 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308.html\n+-rw-r--r-- 0 root (0) root (0) 53376 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00308_source.html\n+-rw-r--r-- 0 root (0) root (0) 16962 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311.html\n+-rw-r--r-- 0 root (0) root (0) 166161 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00311_source.html\n+-rw-r--r-- 0 root (0) root (0) 6595 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314.html\n+-rw-r--r-- 0 root (0) root (0) 96963 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00314_source.html\n+-rw-r--r-- 0 root (0) root (0) 55958 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317.html\n+-rw-r--r-- 0 root (0) root (0) 127006 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00317_source.html\n+-rw-r--r-- 0 root (0) root (0) 5990 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320.html\n+-rw-r--r-- 0 root (0) root (0) 6401 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00320_source.html\n+-rw-r--r-- 0 root (0) root (0) 6253 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323.html\n+-rw-r--r-- 0 root (0) root (0) 15564 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00323_source.html\n+-rw-r--r-- 0 root (0) root (0) 7657 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326.html\n+-rw-r--r-- 0 root (0) root (0) 119846 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00326_source.html\n+-rw-r--r-- 0 root (0) root (0) 4754 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00329.html\n+-rw-r--r-- 0 root (0) root (0) 13484 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332.html\n+-rw-r--r-- 0 root (0) root (0) 22858 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00332_source.html\n+-rw-r--r-- 0 root (0) root (0) 4155 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335.html\n+-rw-r--r-- 0 root (0) root (0) 4756 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00335_source.html\n+-rw-r--r-- 0 root (0) root (0) 4866 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338.html\n+-rw-r--r-- 0 root (0) root (0) 22263 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00338_source.html\n+-rw-r--r-- 0 root (0) root (0) 10688 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341.html\n+-rw-r--r-- 0 root (0) root (0) 22213 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00341_source.html\n+-rw-r--r-- 0 root (0) root (0) 5142 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344.html\n+-rw-r--r-- 0 root (0) root (0) 9611 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00344_source.html\n+-rw-r--r-- 0 root (0) root (0) 5164 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347.html\n+-rw-r--r-- 0 root (0) root (0) 33610 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00347_source.html\n+-rw-r--r-- 0 root (0) root (0) 9428 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350.html\n+-rw-r--r-- 0 root (0) root (0) 242767 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00350_source.html\n+-rw-r--r-- 0 root (0) root (0) 13240 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353.html\n+-rw-r--r-- 0 root (0) root (0) 19678 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00353_source.html\n+-rw-r--r-- 0 root (0) root (0) 73012 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356.html\n+-rw-r--r-- 0 root (0) root (0) 145326 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00356_source.html\n+-rw-r--r-- 0 root (0) root (0) 22309 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359.html\n+-rw-r--r-- 0 root (0) root (0) 41730 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00359_source.html\n+-rw-r--r-- 0 root (0) root (0) 3479 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00362.html\n+-rw-r--r-- 0 root (0) root (0) 6504 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365.html\n+-rw-r--r-- 0 root (0) root (0) 10628 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00365_source.html\n+-rw-r--r-- 0 root (0) root (0) 9514 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368.html\n+-rw-r--r-- 0 root (0) root (0) 18624 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00368_source.html\n+-rw-r--r-- 0 root (0) root (0) 31969 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371.html\n+-rw-r--r-- 0 root (0) root (0) 351570 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00371_source.html\n+-rw-r--r-- 0 root (0) root (0) 5947 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374.html\n+-rw-r--r-- 0 root (0) root (0) 20957 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00374_source.html\n+-rw-r--r-- 0 root (0) root (0) 6666 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377.html\n+-rw-r--r-- 0 root (0) root (0) 7883 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00377_source.html\n+-rw-r--r-- 0 root (0) root (0) 45376 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380.html\n+-rw-r--r-- 0 root (0) root (0) 14273 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00380_source.html\n+-rw-r--r-- 0 root (0) root (0) 4584 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383.html\n+-rw-r--r-- 0 root (0) root (0) 13590 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00383_source.html\n+-rw-r--r-- 0 root (0) root (0) 3202 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386.html\n+-rw-r--r-- 0 root (0) root (0) 88611 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00386_source.html\n+-rw-r--r-- 0 root (0) root (0) 4776 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389.html\n+-rw-r--r-- 0 root (0) root (0) 6226 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00389_source.html\n+-rw-r--r-- 0 root (0) root (0) 6004 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392.html\n+-rw-r--r-- 0 root (0) root (0) 16983 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00392_source.html\n -rw-r--r-- 0 root (0) root (0) 7728 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00395.html\n -rw-r--r-- 0 root (0) root (0) 5564 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00396.html\n -rw-r--r-- 0 root (0) root (0) 260283 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00397.html\n -rw-r--r-- 0 root (0) root (0) 32579 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00397.png\n -rw-r--r-- 0 root (0) root (0) 39061 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398.html\n -rw-r--r-- 0 root (0) root (0) 2362 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00398.png\n -rw-r--r-- 0 root (0) root (0) 9062 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a00399.html\n@@ -1096,20 +1096,20 @@\n -rw-r--r-- 0 root (0) root (0) 3542 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a03177.html\n -rw-r--r-- 0 root (0) root (0) 6558 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a03180.html\n -rw-r--r-- 0 root (0) root (0) 3532 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a03181.html\n -rw-r--r-- 0 root (0) root (0) 5570 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a03184.html\n -rw-r--r-- 0 root (0) root (0) 3047 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04434.html\n -rw-r--r-- 0 root (0) root (0) 2873 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04436.html\n -rw-r--r-- 0 root (0) root (0) 2873 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04439.html\n--rw-r--r-- 0 root (0) root (0) 3940 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04442.html\n--rw-r--r-- 0 root (0) root (0) 5176 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04442_source.html\n--rw-r--r-- 0 root (0) root (0) 7534 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04445.html\n--rw-r--r-- 0 root (0) root (0) 76640 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04445_source.html\n--rw-r--r-- 0 root (0) root (0) 22634 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04448.html\n--rw-r--r-- 0 root (0) root (0) 42519 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04448_source.html\n+-rw-r--r-- 0 root (0) root (0) 7534 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04442.html\n+-rw-r--r-- 0 root (0) root (0) 76640 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04442_source.html\n+-rw-r--r-- 0 root (0) root (0) 22634 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04445.html\n+-rw-r--r-- 0 root (0) root (0) 42519 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04445_source.html\n+-rw-r--r-- 0 root (0) root (0) 3940 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04448.html\n+-rw-r--r-- 0 root (0) root (0) 5176 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04448_source.html\n -rw-r--r-- 0 root (0) root (0) 45823 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04451.html\n -rw-r--r-- 0 root (0) root (0) 132755 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/a04451_source.html\n -rw-r--r-- 0 root (0) root (0) 123868 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/annotated.html\n -rw-r--r-- 0 root (0) root (0) 676 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/bc_s.png\n -rw-r--r-- 0 root (0) root (0) 147 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/bdwn.png\n -rw-r--r-- 0 root (0) root (0) 48324 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/classes.html\n -rw-r--r-- 0 root (0) root (0) 132 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/closed.png\n@@ -1130,15 +1130,15 @@\n -rw-r--r-- 0 root (0) root (0) 4380 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_be46aaae597ce098e36afa8d6ef4f49b.html\n -rw-r--r-- 0 root (0) root (0) 2519 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_be46aaae597ce098e36afa8d6ef4f49b_dep.png\n -rw-r--r-- 0 root (0) root (0) 45880 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e151556194dc695299293609645e9437.html\n -rw-r--r-- 0 root (0) root (0) 9370 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e151556194dc695299293609645e9437_dep.png\n -rw-r--r-- 0 root (0) root (0) 3476 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dir_e68e8157741866f444e17edd764ebbae.html\n -rw-r--r-- 0 root (0) root (0) 746 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/doc.png\n -rw-r--r-- 0 root (0) root (0) 33676 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/doxygen.css\n--rw-r--r-- 0 root (0) root (0) 167986 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dune-common.tag.gz\n+-rw-r--r-- 0 root (0) root (0) 168139 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dune-common.tag.gz\n -rw-r--r-- 0 root (0) root (0) 4452 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/dynsections.js\n -rw-r--r-- 0 root (0) root (0) 50913 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/files.html\n -rw-r--r-- 0 root (0) root (0) 616 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/folderclosed.png\n -rw-r--r-- 0 root (0) root (0) 597 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/folderopen.png\n -rw-r--r-- 0 root (0) root (0) 2987 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_0.png\n -rw-r--r-- 0 root (0) root (0) 2993 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_1.png\n -rw-r--r-- 0 root (0) root (0) 2582 2023-01-12 15:39:41.000000 ./usr/share/doc/libdune-common-doc/doxygen/form_10.png\n"}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00008.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00008.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: vc.hh File Reference\n+dune-common: genericiterator.hh File Reference\n \n \n \n \n \n \n \n@@ -62,25 +62,61 @@\n \n
\n \n
\n \n
\n-
vc.hh File Reference
\n+
\n+Classes |\n+Namespaces
\n+
genericiterator.hh File Reference
\n
\n
\n \n-

Compatibility header for including <Vc/Vc> \n+

Implements a generic iterator class for writing stl conformant iterators. \n More...

\n-\n+
#include <dune/common/iteratorfacades.hh>
\n+#include <cassert>
\n+
\n

Go to the source code of this file.

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

\n+Classes

struct  Dune::const_reference< R >
 Get the 'const' version of a reference to a mutable object. More...
 
struct  Dune::const_reference< const R >
 
struct  Dune::const_reference< R & >
 
struct  Dune::const_reference< const R & >
 
struct  Dune::mutable_reference< R >
 get the 'mutable' version of a reference to a const object More...
 
struct  Dune::mutable_reference< const R >
 
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...
 
\n+\n+\n+\n+\n+

\n+Namespaces

namespace  Dune
 Dune namespace.
 
\n

Detailed Description

\n-

Compatibility header for including <Vc/Vc>

\n-

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

\n+

Implements a generic iterator class for writing stl conformant iterators.

\n+

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

\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,17 +4,48 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-vc.hh File Reference\n-Compatibility header for including More...\n+Classes | Namespaces\n+genericiterator.hh File Reference\n+Implements a generic iterator class for writing stl conformant iterators.\n+More...\n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::const_reference<_R_>\n+\u00a0 Get the 'const' version of a reference to a mutable object. More...\n+\u00a0\n+struct \u00a0Dune::const_reference<_const_R_>\n+\u00a0\n+struct \u00a0Dune::const_reference<_R_&_>\n+\u00a0\n+struct \u00a0Dune::const_reference<_const_R_&_>\n+\u00a0\n+struct \u00a0Dune::mutable_reference<_R_>\n+\u00a0 get the 'mutable' version of a reference to a const object More...\n+\u00a0\n+struct \u00a0Dune::mutable_reference<_const_R_>\n+\u00a0\n+struct \u00a0Dune::mutable_reference<_R_&_>\n+\u00a0\n+struct \u00a0Dune::mutable_reference<_const_R_&_>\n+\u00a0\n+ class \u00a0Dune::GenericIterator<_C,_T,_R,_D,_IteratorFacade_>\n+\u00a0 Generic class for stl-conforming iterators for container classes with\n+ operator[]. More...\n+\u00a0\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n+\u00a0\n ***** Detailed Description *****\n-Compatibility header for including \n-Certain versions (1.3.2) of Vc (https://github.com/VcDevel/Vc) have a problem\n-with certain compiler versions (g++ 7.2.0) in c++17 mode, see #88.\n+Implements a generic iterator class for writing stl conformant iterators.\n+Using this generic iterator writing iterators for containers that implement\n+operator[] is only a matter of seconds.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00008_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: vc.hh Source File\n+dune-common: genericiterator.hh Source File\n \n \n \n \n \n \n \n@@ -62,38 +62,195 @@\n \n
\n \n
\n
\n
\n-
vc.hh
\n+
genericiterator.hh
\n
\n
\n-Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
\n-
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
\n-
3#ifndef DUNE_COMMON_VC_HH
\n-
4#define DUNE_COMMON_VC_HH
\n-
5
\n-
15#if HAVE_VC
\n-
16
\n-
17// include Vc's macro definitions
\n-
18#include <Vc/global.h>
\n-
19
\n-
20// undefine the macro that signals C++17 support, if set
\n-
21#ifdef Vc_CXX17
\n-
22#undef Vc_CXX17
\n-
23#endif
\n-
24
\n-
25// include the rest of Vc
\n-
26#include <Vc/Vc>
\n-
27
\n-
28#endif // HAVE_VC
\n-
29
\n-
30#endif // DUNE_COMMON_VC_HH
\n+Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
\n+
2// vi: set et ts=4 sw=2 sts=2:
\n+
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
\n+
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
\n+
5#ifndef DUNE_GENERICITERATOR_HH
\n+
6#define DUNE_GENERICITERATOR_HH
\n+
7
\n+\n+
9#include <cassert>
\n+
10
\n+
11namespace Dune {
\n+
12
\n+
85 template<class R>
\n+\n+
87 {
\n+
88 typedef const R type;
\n+
89 };
\n+
90
\n+
91 template<class R>
\n+
92 struct const_reference<const R>
\n+
93 {
\n+
94 typedef const R type;
\n+
95 };
\n+
96
\n+
97 template<class R>
\n+
98 struct const_reference<R&>
\n+
99 {
\n+
100 typedef const R& type;
\n+
101 };
\n+
102
\n+
103 template<class R>
\n+
104 struct const_reference<const R&>
\n+
105 {
\n+
106 typedef const R& type;
\n+
107 };
\n+
108
\n+
114 template<class R>
\n+\n+
116 {
\n+
117 typedef R type;
\n+
118 };
\n+
119
\n+
120 template<class R>
\n+
121 struct mutable_reference<const R>
\n+
122 {
\n+
123 typedef R type;
\n+
124 };
\n+
125
\n+
126 template<class R>
\n+\n+
128 {
\n+
129 typedef R& type;
\n+
130 };
\n+
131
\n+
132 template<class R>
\n+
133 struct mutable_reference<const R&>
\n+
134 {
\n+
135 typedef R& type;
\n+
136 };
\n+
137
\n+
149 template<class C, class T, class R=T&, class D = std::ptrdiff_t,
\n+
150 template<class,class,class,class> class IteratorFacade=RandomAccessIteratorFacade>
\n+\n+
152 public IteratorFacade<GenericIterator<C,T,R,D,IteratorFacade>,T,R,D>
\n+
153 {
\n+
154 friend class GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade>;
\n+
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>;
\n+
156
\n+
157 typedef GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade> MutableIterator;
\n+
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;
\n+
159
\n+
160 public:
\n+
161
\n+
170 typedef C Container;
\n+
171
\n+
177 typedef T Value;
\n+
178
\n+
182 typedef D DifferenceType;
\n+
183
\n+
187 typedef R Reference;
\n+
188
\n+
189 // Constructors needed by the base iterators
\n+
190 GenericIterator() : container_(0), position_(0)
\n+
191 {}
\n+
192
\n+\n+
201 : container_(&cont), position_(pos)
\n+
202 {}
\n+
203
\n+
211 GenericIterator(const MutableIterator& other) : container_(other.container_), position_(other.position_)
\n+
212 {}
\n+
213
\n+
223 GenericIterator(const ConstIterator& other) : container_(other.container_), position_(other.position_)
\n+
224 {}
\n+
225
\n+
226 // Methods needed by the forward iterator
\n+
227 bool equals(const MutableIterator & other) const
\n+
228 {
\n+
229 return position_ == other.position_ && container_ == other.container_;
\n+
230 }
\n+
231
\n+
232 bool equals(const ConstIterator & other) const
\n+
233 {
\n+
234 return position_ == other.position_ && container_ == other.container_;
\n+
235 }
\n+
236
\n+\n+
238 return container_->operator[](position_);
\n+
239 }
\n+
240
\n+
241 void increment(){
\n+
242 ++position_;
\n+
243 }
\n+
244
\n+
245 // Additional function needed by BidirectionalIterator
\n+
246 void decrement(){
\n+
247 --position_;
\n+
248 }
\n+
249
\n+
250 // Additional function needed by RandomAccessIterator
\n+\n+
252 return container_->operator[](position_+i);
\n+
253 }
\n+
254
\n+\n+
256 position_=position_+n;
\n+
257 }
\n+
258
\n+\n+
260 {
\n+
261 assert(other.container_==container_);
\n+
262 return other.position_ - position_;
\n+
263 }
\n+
264
\n+\n+
266 {
\n+
267 assert(other.container_==container_);
\n+
268 return other.position_ - position_;
\n+
269 }
\n+
270
\n+
271 private:
\n+
272 Container *container_;
\n+
273 DifferenceType position_;
\n+
274 };
\n+
275
\n+
278} // end namespace Dune
\n+
279
\n+
280#endif
\n+
This file implements iterator facade classes for writing stl conformant iterators.
\n+
STL namespace.
\n+
Dune namespace.
Definition: alignedallocator.hh:13
\n+
Get the 'const' version of a reference to a mutable object.
Definition: genericiterator.hh:87
\n+
const R type
Definition: genericiterator.hh:88
\n+
const R type
Definition: genericiterator.hh:94
\n+
const R & type
Definition: genericiterator.hh:100
\n+
const R & type
Definition: genericiterator.hh:106
\n+
get the 'mutable' version of a reference to a const object
Definition: genericiterator.hh:116
\n+
R type
Definition: genericiterator.hh:117
\n+
R type
Definition: genericiterator.hh:123
\n+
R & type
Definition: genericiterator.hh:129
\n+
Generic class for stl-conforming iterators for container classes with operator[].
Definition: genericiterator.hh:153
\n+
GenericIterator(const MutableIterator &other)
Copy constructor.
Definition: genericiterator.hh:211
\n+
bool equals(const MutableIterator &other) const
Definition: genericiterator.hh:227
\n+
Reference elementAt(DifferenceType i) const
Definition: genericiterator.hh:251
\n+
void increment()
Definition: genericiterator.hh:241
\n+
GenericIterator(const ConstIterator &other)
Copy constructor.
Definition: genericiterator.hh:223
\n+
void advance(DifferenceType n)
Definition: genericiterator.hh:255
\n+
GenericIterator(Container &cont, DifferenceType pos)
Constructor.
Definition: genericiterator.hh:200
\n+
D DifferenceType
The type of the difference between two positions.
Definition: genericiterator.hh:182
\n+
R Reference
The type of the reference to the values accessed.
Definition: genericiterator.hh:187
\n+
DifferenceType distanceTo(const MutableIterator &other) const
Definition: genericiterator.hh:259
\n+
C Container
The type of container we are an iterator for.
Definition: genericiterator.hh:170
\n+
T Value
The value type of the iterator.
Definition: genericiterator.hh:177
\n+
DifferenceType distanceTo(const ConstIterator &other) const
Definition: genericiterator.hh:265
\n+
void decrement()
Definition: genericiterator.hh:246
\n+
Reference dereference() const
Definition: genericiterator.hh:237
\n+
bool equals(const ConstIterator &other) const
Definition: genericiterator.hh:232
\n+
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:434
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,34 +4,269 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-vc.hh\n+genericiterator.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n+ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n+ 2// vi: set et ts=4 sw=2 sts=2:\n+ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 3#ifndef DUNE_COMMON_VC_HH\n- 4#define DUNE_COMMON_VC_HH\n- 5\n- 15#if HAVE_VC\n- 16\n- 17// include Vc's macro definitions\n- 18#include \n- 19\n- 20// undefine the macro that signals C++17 support, if set\n- 21#ifdef Vc_CXX17\n- 22#undef Vc_CXX17\n- 23#endif\n- 24\n- 25// include the rest of Vc\n- 26#include \n- 27\n- 28#endif // HAVE_VC\n- 29\n- 30#endif // DUNE_COMMON_VC_HH\n+ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n+ 5#ifndef DUNE_GENERICITERATOR_HH\n+ 6#define DUNE_GENERICITERATOR_HH\n+ 7\n+ 8#include \n+ 9#include \n+ 10\n+ 11namespace Dune {\n+ 12\n+ 85 template\n+86 struct const_reference\n+ 87 {\n+88 typedef const R type;\n+ 89 };\n+ 90\n+ 91 template\n+92 struct const_reference\n+ 93 {\n+94 typedef const R type;\n+ 95 };\n+ 96\n+ 97 template\n+98 struct const_reference\n+ 99 {\n+100 typedef const R& type;\n+ 101 };\n+ 102\n+ 103 template\n+104 struct const_reference\n+ 105 {\n+106 typedef const R& type;\n+ 107 };\n+ 108\n+ 114 template\n+115 struct mutable_reference\n+ 116 {\n+117 typedef R type;\n+ 118 };\n+ 119\n+ 120 template\n+121 struct mutable_reference\n+ 122 {\n+123 typedef R type;\n+ 124 };\n+ 125\n+ 126 template\n+127 struct mutable_reference\n+ 128 {\n+129 typedef R& type;\n+ 130 };\n+ 131\n+ 132 template\n+133 struct mutable_reference\n+ 134 {\n+135 typedef R& type;\n+ 136 };\n+ 137\n+ 149 template class\n+IteratorFacade=RandomAccessIteratorFacade>\n+151 class GenericIterator :\n+ 152 public IteratorFacade,T,R,D>\n+ 153 {\n+ 154 friend class GenericIterator::type, typename\n+std::remove_const::type, typename mutable_reference::type, D,\n+IteratorFacade>;\n+ 155 friend class GenericIterator::type,\n+const typename std::remove_const::type, typename const_reference::type,\n+D, IteratorFacade>;\n+ 156\n+ 157 typedef GenericIterator::type, typename\n+std::remove_const::type, typename mutable_reference::type, D,\n+IteratorFacade> MutableIterator;\n+ 158 typedef GenericIterator::type, const\n+typename std::remove_const::type, typename const_reference::type, D,\n+IteratorFacade> ConstIterator;\n+ 159\n+ 160 public:\n+ 161\n+170 typedef C Container;\n+ 171\n+177 typedef T Value;\n+ 178\n+182 typedef D DifferenceType;\n+ 183\n+187 typedef R Reference;\n+ 188\n+ 189 // Constructors needed by the base iterators\n+190 GenericIterator() : container_(0), position_(0)\n+ 191 {}\n+ 192\n+200 GenericIterator(Container& cont, DifferenceType pos)\n+ 201 : container_(&cont), position_(pos)\n+ 202 {}\n+ 203\n+211 GenericIterator(const MutableIterator& other) : container_\n+(other.container_), position_(other.position_)\n+ 212 {}\n+ 213\n+223 GenericIterator(const ConstIterator& other) : container_(other.container_),\n+position_(other.position_)\n+ 224 {}\n+ 225\n+ 226 // Methods needed by the forward iterator\n+227 bool equals(const MutableIterator & other) const\n+ 228 {\n+ 229 return position_ == other.position_ && container_ == other.container_;\n+ 230 }\n+ 231\n+232 bool equals(const ConstIterator & other) const\n+ 233 {\n+ 234 return position_ == other.position_ && container_ == other.container_;\n+ 235 }\n+ 236\n+237 Reference dereference() const {\n+ 238 return container_->operator[](position_);\n+ 239 }\n+ 240\n+241 void increment(){\n+ 242 ++position_;\n+ 243 }\n+ 244\n+ 245 // Additional function needed by BidirectionalIterator\n+246 void decrement(){\n+ 247 --position_;\n+ 248 }\n+ 249\n+ 250 // Additional function needed by RandomAccessIterator\n+251 Reference elementAt(DifferenceType i) const {\n+ 252 return container_->operator[](position_+i);\n+ 253 }\n+ 254\n+255 void advance(DifferenceType n){\n+ 256 position_=position_+n;\n+ 257 }\n+ 258\n+259 DifferenceType distanceTo(const MutableIterator& other) const\n+ 260 {\n+ 261 assert(other.container_==container_);\n+ 262 return other.position_ - position_;\n+ 263 }\n+ 264\n+265 DifferenceType distanceTo(const ConstIterator& other) const\n+ 266 {\n+ 267 assert(other.container_==container_);\n+ 268 return other.position_ - position_;\n+ 269 }\n+ 270\n+ 271 private:\n+ 272 Container *container_;\n+ 273 DifferenceType position_;\n+ 274 };\n+ 275\n+ 278} // end namespace Dune\n+ 279\n+ 280#endif\n+iteratorfacades.hh\n+This file implements iterator facade classes for writing stl conformant\n+iterators.\n+std\n+STL namespace.\n+Dune\n+Dune namespace.\n+Definition: alignedallocator.hh:13\n+Dune::const_reference\n+Get the 'const' version of a reference to a mutable object.\n+Definition: genericiterator.hh:87\n+Dune::const_reference::type\n+const R type\n+Definition: genericiterator.hh:88\n+Dune::const_reference<_const_R_>::type\n+const R type\n+Definition: genericiterator.hh:94\n+Dune::const_reference<_R_&_>::type\n+const R & type\n+Definition: genericiterator.hh:100\n+Dune::const_reference<_const_R_&_>::type\n+const R & type\n+Definition: genericiterator.hh:106\n+Dune::mutable_reference\n+get the 'mutable' version of a reference to a const object\n+Definition: genericiterator.hh:116\n+Dune::mutable_reference::type\n+R type\n+Definition: genericiterator.hh:117\n+Dune::mutable_reference<_const_R_>::type\n+R type\n+Definition: genericiterator.hh:123\n+Dune::mutable_reference<_R_&_>::type\n+R & type\n+Definition: genericiterator.hh:129\n+Dune::GenericIterator\n+Generic class for stl-conforming iterators for container classes with operator\n+[].\n+Definition: genericiterator.hh:153\n+Dune::GenericIterator::GenericIterator\n+GenericIterator(const MutableIterator &other)\n+Copy constructor.\n+Definition: genericiterator.hh:211\n+Dune::GenericIterator::equals\n+bool equals(const MutableIterator &other) const\n+Definition: genericiterator.hh:227\n+Dune::GenericIterator::elementAt\n+Reference elementAt(DifferenceType i) const\n+Definition: genericiterator.hh:251\n+Dune::GenericIterator::increment\n+void increment()\n+Definition: genericiterator.hh:241\n+Dune::GenericIterator::GenericIterator\n+GenericIterator(const ConstIterator &other)\n+Copy constructor.\n+Definition: genericiterator.hh:223\n+Dune::GenericIterator::advance\n+void advance(DifferenceType n)\n+Definition: genericiterator.hh:255\n+Dune::GenericIterator::GenericIterator\n+GenericIterator(Container &cont, DifferenceType pos)\n+Constructor.\n+Definition: genericiterator.hh:200\n+Dune::GenericIterator::DifferenceType\n+D DifferenceType\n+The type of the difference between two positions.\n+Definition: genericiterator.hh:182\n+Dune::GenericIterator::Reference\n+R Reference\n+The type of the reference to the values accessed.\n+Definition: genericiterator.hh:187\n+Dune::GenericIterator::distanceTo\n+DifferenceType distanceTo(const MutableIterator &other) const\n+Definition: genericiterator.hh:259\n+Dune::GenericIterator::Container\n+C Container\n+The type of container we are an iterator for.\n+Definition: genericiterator.hh:170\n+Dune::GenericIterator::Value\n+T Value\n+The value type of the iterator.\n+Definition: genericiterator.hh:177\n+Dune::GenericIterator::distanceTo\n+DifferenceType distanceTo(const ConstIterator &other) const\n+Definition: genericiterator.hh:265\n+Dune::GenericIterator::decrement\n+void decrement()\n+Definition: genericiterator.hh:246\n+Dune::GenericIterator::dereference\n+Reference dereference() const\n+Definition: genericiterator.hh:237\n+Dune::GenericIterator::equals\n+bool equals(const ConstIterator &other) const\n+Definition: genericiterator.hh:232\n+Dune::RandomAccessIteratorFacade\n+Base class for stl conformant forward iterators.\n+Definition: iteratorfacades.hh:434\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00011.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00011.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: quadmath.hh File Reference\n+dune-common: iteratorfacades.hh File Reference\n \n \n \n \n \n \n \n@@ -62,19 +62,102 @@\n \n
\n \n
\n
\n
\n-
quadmath.hh File Reference
\n+
\n+Classes |\n+Namespaces |\n+Functions
\n+
iteratorfacades.hh File Reference
\n
\n
\n \n+

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

\n+
#include <iterator>
\n+#include <type_traits>
\n+#include "typetraits.hh"
\n+
\n

Go to the source code of this file.

\n-
\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

\n+Classes

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

\n+Namespaces

namespace  Dune
 Dune namespace.
 
\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

\n+Functions

template<class T1 , class V1 , class R1 , class D , class T2 , class V2 , class R2 >
EnableIfInterOperable< T1, T2, bool >::type Dune::operator== (const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
 Checks for equality. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
\n+

Detailed Description

\n+

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

\n+

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.

\n+
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,12 +4,141 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-quadmath.hh File Reference\n+Classes | Namespaces | Functions\n+iteratorfacades.hh File Reference\n+This file implements iterator facade classes for writing stl conformant\n+iterators. More...\n+#include \n+#include \n+#include \"typetraits.hh\"\n Go_to_the_source_code_of_this_file.\n+ Classes\n+class \u00a0Dune::ForwardIteratorFacade<_T,_V,_R,_D_>\n+\u00a0 Base class for stl conformant forward iterators. More...\n+\u00a0\n+class \u00a0Dune::BidirectionalIteratorFacade<_T,_V,_R,_D_>\n+\u00a0 Facade class for stl conformant bidirectional iterators. More...\n+\u00a0\n+class \u00a0Dune::RandomAccessIteratorFacade<_T,_V,_R,_D_>\n+\u00a0 Base class for stl conformant forward iterators. More...\n+\u00a0\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n+\u00a0\n+ Functions\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator== (const\n+ ForwardIteratorFacade< T1,\n+ V1, R1, D > &lhs, const\n+ ForwardIteratorFacade< T2,\n+ V2, R2, D > &rhs)\n+\u00a0 Checks for equality. More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator!= (const\n+ ForwardIteratorFacade< T1,\n+ V1, R1, D > &lhs, const\n+ ForwardIteratorFacade< T2,\n+ V2, R2, D > &rhs)\n+\u00a0 Checks for inequality.\n+ More...\n+\u00a0\n+template\n+ std::enable_if< std::is_convertible< T2, T1 >::value, Dune::operator== (const\n+ bool >::type\u00a0BidirectionalIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ BidirectionalIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Checks for equality. More...\n+\u00a0\n+template\n+ std::enable_if< std::is_convertible< T1, T2 >::value Dune::operator== (const\n+ &&!std::is_convertible< T2, T1 >::value, bool >::type\u00a0BidirectionalIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ BidirectionalIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Checks for equality. More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator!= (const\n+ BidirectionalIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ BidirectionalIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Checks for inequality.\n+ More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator== (const\n+ RandomAccessIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ RandomAccessIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Checks for equality. More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator!= (const\n+ RandomAccessIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ RandomAccessIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Checks for inequality.\n+ More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator< (const\n+ RandomAccessIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ RandomAccessIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Comparison operator. More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator<= (const\n+ RandomAccessIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ RandomAccessIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Comparison operator. More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator> (const\n+ RandomAccessIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ RandomAccessIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Comparison operator. More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, bool >::type\u00a0Dune::operator>= (const\n+ RandomAccessIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ RandomAccessIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+\u00a0 Comparison operator. More...\n+\u00a0\n+template\n+ EnableIfInterOperable< T1, T2, D >::type\u00a0Dune::operator- (const\n+ RandomAccessIteratorFacade<\n+ T1, V1, R1, D > &lhs, const\n+ RandomAccessIteratorFacade<\n+ T2, V2, R2, D > &rhs)\n+ Calculates the difference\n+\u00a0 between two pointers.\n+ More...\n+\u00a0\n+***** Detailed Description *****\n+This file implements iterator facade classes for writing stl conformant\n+iterators.\n+With using these facades writing iterators for arbitrary containers becomes\n+much less cumbersome as only few functions have to be implemented. All other\n+functions needed by the stl are provided by the facades using the Barton-\n+Nackman trick (also known as curiously recurring template pattern.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00011_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: quadmath.hh Source File\n+dune-common: iteratorfacades.hh Source File\n \n \n \n \n \n \n \n@@ -62,492 +62,435 @@\n \n
\n \n
\n \n
\n-
quadmath.hh
\n+
iteratorfacades.hh
\n
\n
\n Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
\n
2// vi: set et ts=4 sw=2 sts=2:
\n
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
\n
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
\n-
5#ifndef DUNE_QUADMATH_HH
\n-
6#define DUNE_QUADMATH_HH
\n+
5#ifndef DUNE_ITERATORFACADES_HH
\n+
6#define DUNE_ITERATORFACADES_HH
\n
7
\n-
8#if HAVE_QUADMATH
\n-
9#include <quadmath.h>
\n+
8#include <iterator>
\n+
9#include <type_traits>
\n
10
\n-
11#include <cmath>
\n-
12#include <cstddef>
\n-
13#include <cstdint>
\n-
14#include <cstdlib> // abs
\n-
15#include <istream>
\n-
16#include <ostream>
\n-
17#include <type_traits>
\n-
18#include <utility>
\n-
19
\n-\n-\n-
22
\n-
23namespace Dune
\n-
24{
\n-
25 namespace Impl
\n-
26 {
\n-
27 // forward declaration
\n-
28 class Float128;
\n-
29
\n-
30 } // end namespace Impl
\n-
31
\n-
32 using Impl::Float128;
\n-
33
\n-
34 // The purpose of this namespace is to move the `<cmath>` function overloads
\n-
35 // out of namespace `Dune`, see AlignedNumber in debugalign.hh.
\n-
36 namespace Impl
\n-
37 {
\n-
38 using float128_t = __float128;
\n-
39
\n-
41 class Float128
\n-
42 {
\n-
43 float128_t value_ = 0.0q;
\n-
44
\n-
45 public:
\n-
46 constexpr Float128() = default;
\n-
47 constexpr Float128(const float128_t& value) noexcept
\n-
48 : value_(value)
\n-
49 {}
\n-
50
\n-
51 // constructor from any floating-point or integer type
\n-
52 template <class T,
\n-
53 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
\n-
54 constexpr Float128(const T& value) noexcept
\n-
55 : value_(value)
\n-
56 {}
\n-
57
\n-
58 // constructor from pointer to null-terminated byte string
\n-
59 explicit Float128(const char* str) noexcept
\n-
60 : value_(strtoflt128(str, NULL))
\n-
61 {}
\n-
62
\n-
63 // accessors
\n-
64 constexpr operator float128_t() const noexcept { return value_; }
\n-
65
\n-
66 constexpr float128_t const& value() const noexcept { return value_; }
\n-
67 constexpr float128_t& value() noexcept { return value_; }
\n-
68
\n-
69 // I/O
\n-
70 template<class CharT, class Traits>
\n-
71 friend std::basic_istream<CharT, Traits>&
\n-
72 operator>>(std::basic_istream<CharT, Traits>& in, Float128& x)
\n-
73 {
\n-
74 std::string buf;
\n-
75 buf.reserve(128);
\n-
76 in >> buf;
\n-
77 x.value() = strtoflt128(buf.c_str(), NULL);
\n-
78 return in;
\n-
79 }
\n-
80
\n-
81 template<class CharT, class Traits>
\n-
82 friend std::basic_ostream<CharT, Traits>&
\n-
83 operator<<(std::basic_ostream<CharT, Traits>& out, const Float128& x)
\n-
84 {
\n-
85 const std::size_t bufSize = 128;
\n-
86 CharT buf[128];
\n-
87
\n-
88 std::string format = "%." + std::to_string(out.precision()) + "Q" +
\n-
89 ((out.flags() | std::ios_base::scientific) ? "e" : "f");
\n-
90 const int numChars = quadmath_snprintf(buf, bufSize, format.c_str(), x.value());
\n-
91 if (std::size_t(numChars) >= bufSize) {
\n-
92 DUNE_THROW(Dune::RangeError, "Failed to print Float128 value: buffer overflow");
\n-
93 }
\n-
94 out << buf;
\n-
95 return out;
\n-
96 }
\n-
97
\n-
98 // Increment, decrement
\n-
99 constexpr Float128& operator++() noexcept { ++value_; return *this; }
\n-
100 constexpr Float128& operator--() noexcept { --value_; return *this; }
\n-
101
\n-
102 constexpr Float128 operator++(int) noexcept { Float128 tmp{*this}; ++value_; return tmp; }
\n-
103 constexpr Float128 operator--(int) noexcept { Float128 tmp{*this}; --value_; return tmp; }
\n-
104
\n-
105 // unary operators
\n-
106 constexpr Float128 operator+() const noexcept { return Float128{+value_}; }
\n-
107 constexpr Float128 operator-() const noexcept { return Float128{-value_}; }
\n-
108
\n-
109 // assignment operators
\n-
110#define DUNE_ASSIGN_OP(OP) \\
\n-
111 constexpr Float128& operator OP(const Float128& u) noexcept \\
\n-
112 { \\
\n-
113 value_ OP float128_t(u); \\
\n-
114 return *this; \\
\n-
115 } \\
\n-
116 static_assert(true, "Require semicolon to unconfuse editors")
\n-
117
\n-
118 DUNE_ASSIGN_OP(+=);
\n-
119 DUNE_ASSIGN_OP(-=);
\n-
120
\n-
121 DUNE_ASSIGN_OP(*=);
\n-
122 DUNE_ASSIGN_OP(/=);
\n-
123
\n-
124#undef DUNE_ASSIGN_OP
\n-
125
\n-
126 }; // end class Float128
\n-
127
\n-
128 // binary operators:
\n-
129 // For symmetry provide overloads with arithmetic types
\n-
130 // in the first or second argument.
\n-
131#define DUNE_BINARY_OP(OP) \\
\n-
132 constexpr Float128 operator OP(const Float128& t, \\
\n-
133 const Float128& u) noexcept \\
\n-
134 { \\
\n-
135 return Float128{float128_t(t) OP float128_t(u)}; \\
\n-
136 } \\
\n-
137 constexpr Float128 operator OP(const float128_t& t, \\
\n-
138 const Float128& u) noexcept \\
\n-
139 { \\
\n-
140 return Float128{t OP float128_t(u)}; \\
\n-
141 } \\
\n-
142 constexpr Float128 operator OP(const Float128& t, \\
\n-
143 const float128_t& u) noexcept \\
\n-
144 { \\
\n-
145 return Float128{float128_t(t) OP u}; \\
\n-
146 } \\
\n-
147 template <class T, \\
\n-
148 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \\
\n-
149 constexpr Float128 operator OP(const T& t, \\
\n-
150 const Float128& u) noexcept \\
\n-
151 { \\
\n-
152 return Float128{float128_t(t) OP float128_t(u)}; \\
\n-
153 } \\
\n-
154 template <class U, \\
\n-
155 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \\
\n-
156 constexpr Float128 operator OP(const Float128& t, \\
\n-
157 const U& u) noexcept \\
\n-
158 { \\
\n-
159 return Float128{float128_t(t) OP float128_t(u)}; \\
\n-
160 } \\
\n-
161 static_assert(true, "Require semicolon to unconfuse editors")
\n-
162
\n-\n-\n-\n-\n-
167
\n-
168#undef DUNE_BINARY_OP
\n-
169
\n-
170 // logical operators:
\n-
171 // For symmetry provide overloads with arithmetic types
\n-
172 // in the first or second argument.
\n-
173#define DUNE_BINARY_BOOL_OP(OP) \\
\n-
174 constexpr bool operator OP(const Float128& t, \\
\n-
175 const Float128& u) noexcept \\
\n-
176 { \\
\n-
177 return float128_t(t) OP float128_t(u); \\
\n-
178 } \\
\n-
179 template <class T, \\
\n-
180 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \\
\n-
181 constexpr bool operator OP(const T& t, \\
\n-
182 const Float128& u) noexcept \\
\n-
183 { \\
\n-
184 return float128_t(t) OP float128_t(u); \\
\n-
185 } \\
\n-
186 template <class U, \\
\n-
187 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \\
\n-
188 constexpr bool operator OP(const Float128& t, \\
\n-
189 const U& u) noexcept \\
\n-
190 { \\
\n-
191 return float128_t(t) OP float128_t(u); \\
\n-
192 } \\
\n-
193 static_assert(true, "Require semicolon to unconfuse editors")
\n-
194
\n-
195 DUNE_BINARY_BOOL_OP(==);
\n-
196 DUNE_BINARY_BOOL_OP(!=);
\n-
197 DUNE_BINARY_BOOL_OP(<);
\n-
198 DUNE_BINARY_BOOL_OP(>);
\n-
199 DUNE_BINARY_BOOL_OP(<=);
\n-
200 DUNE_BINARY_BOOL_OP(>=);
\n-
201
\n-
202#undef DUNE_BINARY_BOOL_OP
\n-
203
\n-
204 // Overloads for the cmath functions
\n-
205
\n-
206 // function with name `name` redirects to quadmath function `func`
\n-
207#define DUNE_UNARY_FUNC(name,func) \\
\n-
208 inline Float128 name(const Float128& u) noexcept \\
\n-
209 { \\
\n-
210 return Float128{func (float128_t(u))}; \\
\n-
211 } \\
\n-
212 static_assert(true, "Require semicolon to unconfuse editors")
\n-
213
\n-
214 // like DUNE_UNARY_FUNC but with custom return type
\n-
215#define DUNE_CUSTOM_UNARY_FUNC(type,name,func) \\
\n-
216 inline type name(const Float128& u) noexcept \\
\n-
217 { \\
\n-
218 return (type)(func (float128_t(u))); \\
\n-
219 } \\
\n-
220 static_assert(true, "Require semicolon to unconfuse editors")
\n-
221
\n-
222 // redirects to quadmath function with two arguments
\n-
223#define DUNE_BINARY_FUNC(name,func) \\
\n-
224 inline Float128 name(const Float128& t, \\
\n-
225 const Float128& u) noexcept \\
\n-
226 { \\
\n-
227 return Float128{func (float128_t(t), float128_t(u))}; \\
\n-
228 } \\
\n-
229 static_assert(true, "Require semicolon to unconfuse editors")
\n-
230
\n-
231 DUNE_UNARY_FUNC(abs, fabsq);
\n-
232 DUNE_UNARY_FUNC(acos, acosq);
\n-
233 DUNE_UNARY_FUNC(acosh, acoshq);
\n-
234 DUNE_UNARY_FUNC(asin, asinq);
\n-
235 DUNE_UNARY_FUNC(asinh, asinhq);
\n-
236 DUNE_UNARY_FUNC(atan, atanq);
\n-
237 DUNE_UNARY_FUNC(atanh, atanhq);
\n-
238 DUNE_UNARY_FUNC(cbrt, cbrtq);
\n-
239 DUNE_UNARY_FUNC(ceil, ceilq);
\n-
240 DUNE_UNARY_FUNC(cos, cosq);
\n-
241 DUNE_UNARY_FUNC(cosh, coshq);
\n-
242 DUNE_UNARY_FUNC(erf, erfq);
\n-
243 DUNE_UNARY_FUNC(erfc, erfcq);
\n-
244 DUNE_UNARY_FUNC(exp, expq);
\n-
245 DUNE_UNARY_FUNC(expm1, expm1q);
\n-
246 DUNE_UNARY_FUNC(fabs, fabsq);
\n-
247 DUNE_UNARY_FUNC(floor, floorq);
\n-
248 DUNE_CUSTOM_UNARY_FUNC(int, ilogb, ilogbq);
\n-
249 DUNE_UNARY_FUNC(lgamma, lgammaq);
\n-
250 DUNE_CUSTOM_UNARY_FUNC(long long int, llrint, llrintq);
\n-
251 DUNE_CUSTOM_UNARY_FUNC(long long int, llround, llroundq);
\n-
252 DUNE_UNARY_FUNC(log, logq);
\n-
253 DUNE_UNARY_FUNC(log10, log10q);
\n-
254 DUNE_UNARY_FUNC(log1p, log1pq);
\n-
255 DUNE_UNARY_FUNC(log2, log2q);
\n-
256 // DUNE_UNARY_FUNC(logb, logbq); // not available in gcc5
\n-
257 DUNE_CUSTOM_UNARY_FUNC(long int, lrint, lrintq);
\n-
258 DUNE_CUSTOM_UNARY_FUNC(long int, lround, lroundq);
\n-
259 DUNE_UNARY_FUNC(nearbyint, nearbyintq);
\n-
260 DUNE_BINARY_FUNC(nextafter, nextafterq);
\n-
261 DUNE_BINARY_FUNC(pow, powq); // overload for integer argument see below
\n-
262 DUNE_UNARY_FUNC(rint, rintq);
\n-
263 DUNE_UNARY_FUNC(round, roundq);
\n-
264 DUNE_UNARY_FUNC(sin, sinq);
\n-
265 DUNE_UNARY_FUNC(sinh, sinhq);
\n-
266 DUNE_UNARY_FUNC(sqrt, sqrtq);
\n-
267 DUNE_UNARY_FUNC(tan, tanq);
\n-
268 DUNE_UNARY_FUNC(tanh, tanhq);
\n-
269 DUNE_UNARY_FUNC(tgamma, tgammaq);
\n-
270 DUNE_UNARY_FUNC(trunc, truncq);
\n-
271
\n-
272 DUNE_CUSTOM_UNARY_FUNC(bool, isfinite, finiteq);
\n-
273 DUNE_CUSTOM_UNARY_FUNC(bool, isinf, isinfq);
\n-
274 DUNE_CUSTOM_UNARY_FUNC(bool, isnan, isnanq);
\n-
275 DUNE_CUSTOM_UNARY_FUNC(bool, signbit, signbitq);
\n-
276
\n-
277#undef DUNE_UNARY_FUNC
\n-
278#undef DUNE_CUSTOM_UNARY_FUNC
\n-
279#undef DUNE_BINARY_FUNC
\n-
280
\n-
281 // like DUNE_BINARY_FUNC but provide overloads with arithmetic
\n-
282 // types in the first or second argument.
\n-
283#define DUNE_BINARY_ARITHMETIC_FUNC(name,func) \\
\n-
284 inline Float128 name(const Float128& t, \\
\n-
285 const Float128& u) noexcept \\
\n-
286 { \\
\n-
287 return Float128{func (float128_t(t), float128_t(u))}; \\
\n-
288 } \\
\n-
289 template <class T, \\
\n-
290 std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> \\
\n-
291 inline Float128 name(const T& t, \\
\n-
292 const Float128& u) noexcept \\
\n-
293 { \\
\n-
294 return Float128{func (float128_t(t), float128_t(u))}; \\
\n-
295 } \\
\n-
296 template <class U, \\
\n-
297 std::enable_if_t<std::is_arithmetic<U>::value, int> = 0> \\
\n-
298 inline Float128 name(const Float128& t, \\
\n-
299 const U& u) noexcept \\
\n-
300 { \\
\n-
301 return Float128{func (float128_t(t), float128_t(u))}; \\
\n-
302 } \\
\n-
303 static_assert(true, "Require semicolon to unconfuse editors")
\n-
304
\n-
305 DUNE_BINARY_ARITHMETIC_FUNC(atan2,atan2q);
\n-
306 DUNE_BINARY_ARITHMETIC_FUNC(copysign,copysignq);
\n-
307 DUNE_BINARY_ARITHMETIC_FUNC(fdim,fdimq);
\n-
308 DUNE_BINARY_ARITHMETIC_FUNC(fmax,fmaxq);
\n-
309 DUNE_BINARY_ARITHMETIC_FUNC(fmin,fminq);
\n-
310 DUNE_BINARY_ARITHMETIC_FUNC(fmod,fmodq);
\n-
311 DUNE_BINARY_ARITHMETIC_FUNC(hypot,hypotq);
\n-
312 DUNE_BINARY_ARITHMETIC_FUNC(remainder,remainderq);
\n-
313
\n-
314#undef DUNE_BINARY_ARITHMETIC_FUNC
\n+
11#include "typetraits.hh"
\n+
12
\n+
13namespace Dune
\n+
14{
\n+
139 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
\n+\n+
141 {
\n+
142
\n+
143 public:
\n+
144 /* type aliases required by C++ for iterators */
\n+
145 using iterator_category = std::forward_iterator_tag;
\n+
146 using value_type = typename std::remove_const<V>::type;
\n+\n+
148 using pointer = V*;
\n+
149 using reference = R;
\n+
150
\n+
175 typedef T DerivedType;
\n+
176
\n+
180 typedef V Value;
\n+
181
\n+
185 typedef V* Pointer;
\n+
186
\n+
190 typedef D DifferenceType;
\n+
191
\n+
195 typedef R Reference;
\n+
196
\n+\n+
199 {
\n+
200 return static_cast<DerivedType const*>(this)->dereference();
\n+
201 }
\n+
202
\n+\n+
204 {
\n+
205 return &(static_cast<const DerivedType *>(this)->dereference());
\n+
206 }
\n+
207
\n+\n+
210 {
\n+
211 static_cast<DerivedType *>(this)->increment();
\n+
212 return *static_cast<DerivedType *>(this);
\n+
213 }
\n+
214
\n+\n+
217 {
\n+
218 DerivedType tmp(static_cast<DerivedType const&>(*this));
\n+
219 this->operator++();
\n+
220 return tmp;
\n+
221 }
\n+
222 };
\n+
223
\n+
234 template<class T1, class V1, class R1, class D,
\n+
235 class T2, class V2, class R2>
\n+
236 inline typename EnableIfInterOperable<T1,T2,bool>::type
\n+\n+\n+
239 {
\n+
240 if(std::is_convertible<T2,T1>::value)
\n+
241 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
\n+
242 else
\n+
243 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
\n+
244 }
\n+
245
\n+
256 template<class T1, class V1, class R1, class D,
\n+
257 class T2, class V2, class R2>
\n+
258 inline typename EnableIfInterOperable<T1,T2,bool>::type
\n+\n+\n+
261 {
\n+
262 if(std::is_convertible<T2,T1>::value)
\n+
263 return !static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
\n+
264 else
\n+
265 return !static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
\n+
266 }
\n+
267
\n+
272 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
\n+\n+
274 {
\n+
275
\n+
276 public:
\n+
277 /* type aliases required by C++ for iterators */
\n+
278 using iterator_category = std::bidirectional_iterator_tag;
\n+
279 using value_type = typename std::remove_const<V>::type;
\n+\n+
281 using pointer = V*;
\n+
282 using reference = R;
\n+
283
\n+
309 typedef T DerivedType;
\n+
310
\n+
314 typedef V Value;
\n
315
\n-
316 // some more cmath functions with special signature
\n-
317
\n-
318 inline Float128 fma(const Float128& t, const Float128& u, const Float128& v)
\n-
319 {
\n-
320 return Float128{fmaq(float128_t(t),float128_t(u),float128_t(v))};
\n-
321 }
\n-
322
\n-
323 inline Float128 frexp(const Float128& u, int* p)
\n-
324 {
\n-
325 return Float128{frexpq(float128_t(u), p)};
\n-
326 }
\n-
327
\n-
328 inline Float128 ldexp(const Float128& u, int p)
\n-
329 {
\n-
330 return Float128{ldexpq(float128_t(u), p)};
\n-
331 }
\n-
332
\n-
333 inline Float128 remquo(const Float128& t, const Float128& u, int* quo)
\n-
334 {
\n-
335 return Float128{remquoq(float128_t(t), float128_t(u), quo)};
\n-
336 }
\n-
337
\n-
338 inline Float128 scalbln(const Float128& u, long int e)
\n-
339 {
\n-
340 return Float128{scalblnq(float128_t(u), e)};
\n-
341 }
\n-
342
\n-
343 inline Float128 scalbn(const Float128& u, int e)
\n+
319 typedef V* Pointer;
\n+
320
\n+
324 typedef D DifferenceType;
\n+
325
\n+
329 typedef R Reference;
\n+
330
\n+\n+
333 {
\n+
334 return static_cast<DerivedType const*>(this)->dereference();
\n+
335 }
\n+
336
\n+\n+
338 {
\n+
339 return &(static_cast<const DerivedType *>(this)->dereference());
\n+
340 }
\n+
341
\n+\n
344 {
\n-
345 return Float128{scalbnq(float128_t(u), e)};
\n-
346 }
\n-
347
\n-
349 // NOTE: This is much faster than a pow(x, Float128(p)) call
\n-
350 // NOTE: This is a modified version of boost::math::cstdfloat::detail::pown
\n-
351 // (adapted to the type Float128) that is part of the Boost 1.65 Math toolkit 2.8.0
\n-
352 // and is implemented by Christopher Kormanyos, John Maddock, and Paul A. Bristow,
\n-
353 // distributed under the Boost Software License, Version 1.0
\n-
354 // (See http://www.boost.org/LICENSE_1_0.txt)
\n-
355 template <class Int,
\n-
356 std::enable_if_t<std::is_integral<Int>::value, int> = 0>
\n-
357 inline Float128 pow(const Float128& x, const Int p)
\n-
358 {
\n-
359 static const Float128 max_value = FLT128_MAX;
\n-
360 static const Float128 min_value = FLT128_MIN;
\n-
361 static const Float128 inf_value = float128_t{1} / float128_t{0};
\n-
362
\n-
363 const bool isneg = (x < 0);
\n-
364 const bool isnan = (x != x);
\n-
365 const bool isinf = (isneg ? bool(-x > max_value) : bool(+x > max_value));
\n-
366
\n-
367 if (isnan) { return x; }
\n-
368 if (isinf) { return Float128{nanq("")}; }
\n-
369
\n-
370 const Float128 abs_x = (isneg ? -x : x);
\n-
371 if (p < Int(0)) {
\n-
372 if (abs_x < min_value)
\n-
373 return (isneg ? -inf_value : +inf_value);
\n-
374 else
\n-
375 return Float128(1) / pow(x, Int(-p));
\n-
376 }
\n-
377
\n-
378 if (p == Int(0)) { return Float128(1); }
\n-
379 if (p == Int(1)) { return x; }
\n-
380 if (abs_x > max_value)
\n-
381 return (isneg ? -inf_value : +inf_value);
\n-
382
\n-
383 if (p == Int(2)) { return (x * x); }
\n-
384 if (p == Int(3)) { return ((x * x) * x); }
\n-
385 if (p == Int(4)) { const Float128 x2 = (x * x); return (x2 * x2); }
\n-
386
\n-
387 Float128 result = ((p % Int(2)) != Int(0)) ? x : Float128(1);
\n-
388 Float128 xn = x; // binary powers of x
\n+
345 static_cast<DerivedType *>(this)->increment();
\n+
346 return *static_cast<DerivedType *>(this);
\n+
347 }
\n+
348
\n+\n+
351 {
\n+
352 DerivedType tmp(static_cast<DerivedType const&>(*this));
\n+
353 this->operator++();
\n+
354 return tmp;
\n+
355 }
\n+
356
\n+
357
\n+\n+
360 {
\n+
361 static_cast<DerivedType *>(this)->decrement();
\n+
362 return *static_cast<DerivedType *>(this);
\n+
363 }
\n+
364
\n+\n+
367 {
\n+
368 DerivedType tmp(static_cast<DerivedType const&>(*this));
\n+
369 this->operator--();
\n+
370 return tmp;
\n+
371 }
\n+
372 };
\n+
373
\n+
381 template<class T1, class V1, class R1, class D,
\n+
382 class T2, class V2, class R2>
\n+
383 inline typename std::enable_if<std::is_convertible<T2,T1>::value,bool>::type
\n+\n+\n+
386 {
\n+
387 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
\n+
388 }
\n
389
\n-
390 Int p2 = p;
\n-
391 while (Int(p2 /= 2) != Int(0)) {
\n-
392 xn *= xn; // Square xn for each binary power
\n-
393
\n-
394 const bool has_binary_power = (Int(p2 % Int(2)) != Int(0));
\n-
395 if (has_binary_power)
\n-
396 result *= xn;
\n-
397 }
\n-
398
\n-
399 return result;
\n-
400 }
\n-
401
\n-
402
\n-
403 } // end namespace Impl
\n-
404
\n-
405 template <>
\n-
406 struct IsNumber<Impl::Float128>
\n-
407 : public std::true_type {};
\n+
398 template<class T1, class V1, class R1, class D,
\n+
399 class T2, class V2, class R2>
\n+
400 inline
\n+
401 typename std::enable_if<std::is_convertible<T1,T2>::value && !std::is_convertible<T2,T1>::value,
\n+
402 bool>::type
\n+\n+\n+
405 {
\n+
406 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
\n+
407 }
\n
408
\n-
409} // end namespace Dune
\n-
410
\n-
411namespace std
\n-
412{
\n-
413#ifndef NO_STD_NUMERIC_LIMITS_SPECIALIZATION
\n-
414 template <>
\n-
415 class numeric_limits<Dune::Impl::Float128>
\n-
416 {
\n-
417 using Float128 = Dune::Impl::Float128;
\n-
418 using float128_t = Dune::Impl::float128_t;
\n-
419
\n-
420 public:
\n-
421 static constexpr bool is_specialized = true;
\n-
422 static constexpr Float128 min() noexcept { return FLT128_MIN; }
\n-
423 static constexpr Float128 max() noexcept { return FLT128_MAX; }
\n-
424 static constexpr Float128 lowest() noexcept { return -FLT128_MAX; }
\n-
425 static constexpr int digits = FLT128_MANT_DIG;
\n-
426 static constexpr int digits10 = 34;
\n-
427 static constexpr int max_digits10 = 36;
\n-
428 static constexpr bool is_signed = true;
\n-
429 static constexpr bool is_integer = false;
\n-
430 static constexpr bool is_exact = false;
\n-
431 static constexpr int radix = 2;
\n-
432 static constexpr Float128 epsilon() noexcept { return FLT128_EPSILON; }
\n-
433 static constexpr Float128 round_error() noexcept { return float128_t{0.5}; }
\n-
434 static constexpr int min_exponent = FLT128_MIN_EXP;
\n-
435 static constexpr int min_exponent10 = FLT128_MIN_10_EXP;
\n-
436 static constexpr int max_exponent = FLT128_MAX_EXP;
\n-
437 static constexpr int max_exponent10 = FLT128_MAX_10_EXP;
\n-
438 static constexpr bool has_infinity = true;
\n-
439 static constexpr bool has_quiet_NaN = true;
\n-
440 static constexpr bool has_signaling_NaN = false;
\n-
441 static constexpr float_denorm_style has_denorm = denorm_present;
\n-
442 static constexpr bool has_denorm_loss = false;
\n-
443 static constexpr Float128 infinity() noexcept { return float128_t{1}/float128_t{0}; }
\n-
444 static Float128 quiet_NaN() noexcept { return nanq(""); }
\n-
445 static constexpr Float128 signaling_NaN() noexcept { return float128_t{}; }
\n-
446 static constexpr Float128 denorm_min() noexcept { return FLT128_DENORM_MIN; }
\n-
447 static constexpr bool is_iec559 = true;
\n-
448 static constexpr bool is_bounded = false;
\n-
449 static constexpr bool is_modulo = false;
\n-
450 static constexpr bool traps = false;
\n-
451 static constexpr bool tinyness_before = false;
\n-
452 static constexpr float_round_style round_style = round_to_nearest;
\n-
453 };
\n-
454#endif
\n-
455} // end namespace std
\n-
456
\n-
457#endif // HAVE_QUADMATH
\n-
458#endif // DUNE_QUADMATH_HH
\n-
A few common exception classes.
\n-
#define DUNE_BINARY_OP(OP)
Definition: debugalign.hh:248
\n-
#define DUNE_UNARY_FUNC(name)
\n-
#define DUNE_ASSIGN_OP(OP)
Definition: debugalign.hh:207
\n-
Traits for type conversions and type information.
\n-
Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
Read a std::tuple.
Definition: streamoperators.hh:43
\n-
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition: bigunsignedint.hh:278
\n+
419 template<class T1, class V1, class R1, class D,
\n+
420 class T2, class V2, class R2>
\n+
421 inline typename EnableIfInterOperable<T1,T2,bool>::type
\n+\n+\n+
424 {
\n+
425 return !(lhs == rhs);
\n+
426 }
\n+
427
\n+
432 template<class T, class V, class R = V&, class D = std::ptrdiff_t>
\n+\n+
434 {
\n+
435
\n+
436 public:
\n+
437 /* type aliases required by C++ for iterators */
\n+
438 using iterator_category = std::random_access_iterator_tag;
\n+
439 using value_type = typename std::remove_const<V>::type;
\n+\n+
441 using pointer = V*;
\n+
442 using reference = R;
\n+
443
\n+
477 typedef T DerivedType;
\n+
478
\n+
482 typedef V Value;
\n+
483
\n+
487 typedef V* Pointer;
\n+
488
\n+
492 typedef D DifferenceType;
\n+
493
\n+
497 typedef R Reference;
\n+
498
\n+\n+
501 {
\n+
502 return static_cast<DerivedType const*>(this)->dereference();
\n+
503 }
\n+
504
\n+\n+
506 {
\n+
507 return &(static_cast<const DerivedType *>(this)->dereference());
\n+
508 }
\n+
509
\n+\n+
516 {
\n+
517 return static_cast<const DerivedType *>(this)->elementAt(n);
\n+
518 }
\n+
519
\n+\n+
522 {
\n+
523 static_cast<DerivedType *>(this)->increment();
\n+
524 return *static_cast<DerivedType *>(this);
\n+
525 }
\n+
526
\n+\n+
529 {
\n+
530 DerivedType tmp(static_cast<DerivedType const&>(*this));
\n+
531 this->operator++();
\n+
532 return tmp;
\n+
533 }
\n+
534
\n+\n+
536 {
\n+
537 static_cast<DerivedType *>(this)->advance(n);
\n+
538 return *static_cast<DerivedType *>(this);
\n+
539 }
\n+
540
\n+\n+
542 {
\n+
543 DerivedType tmp(static_cast<DerivedType const&>(*this));
\n+
544 tmp.advance(n);
\n+
545 return tmp;
\n+
546 }
\n+
547
\n+
548
\n+\n+
551 {
\n+
552 static_cast<DerivedType *>(this)->decrement();
\n+
553 return *static_cast<DerivedType *>(this);
\n+
554 }
\n+
555
\n+\n+
558 {
\n+
559 DerivedType tmp(static_cast<DerivedType const&>(*this));
\n+
560 this->operator--();
\n+
561 return tmp;
\n+
562 }
\n+
563
\n+\n+
565 {
\n+
566 static_cast<DerivedType *>(this)->advance(-n);
\n+
567 return *static_cast<DerivedType *>(this);
\n+
568 }
\n+
569
\n+\n+
571 {
\n+
572 DerivedType tmp(static_cast<DerivedType const&>(*this));
\n+
573 tmp.advance(-n);
\n+
574 return tmp;
\n+
575 }
\n+
576
\n+
577
\n+
578 };
\n+
579
\n+
590 template<class T1, class V1, class R1, class D,
\n+
591 class T2, class V2, class R2>
\n+
592 inline typename EnableIfInterOperable<T1,T2,bool>::type
\n+\n+\n+
595 {
\n+
596 if(std::is_convertible<T2,T1>::value)
\n+
597 return static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
\n+
598 else
\n+
599 return static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
\n+
600 }
\n+
601
\n+
612 template<class T1, class V1, class R1, class D,
\n+
613 class T2, class V2, class R2>
\n+
614 inline typename EnableIfInterOperable<T1,T2,bool>::type
\n+\n+\n+
617 {
\n+
618 if(std::is_convertible<T2,T1>::value)
\n+
619 return !static_cast<const T1&>(lhs).equals(static_cast<const T2&>(rhs));
\n+
620 else
\n+
621 return !static_cast<const T2&>(rhs).equals(static_cast<const T1&>(lhs));
\n+
622 }
\n+
623
\n+
634 template<class T1, class V1, class R1, class D,
\n+
635 class T2, class V2, class R2>
\n+\n+\n+\n+
639 {
\n+
640 if(std::is_convertible<T2,T1>::value)
\n+
641 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))>0;
\n+
642 else
\n+
643 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))<0;
\n+
644 }
\n+
645
\n+
646
\n+
657 template<class T1, class V1, class R1, class D,
\n+
658 class T2, class V2, class R2>
\n+\n+\n+\n+
662 {
\n+
663 if(std::is_convertible<T2,T1>::value)
\n+
664 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))>=0;
\n+
665 else
\n+
666 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))<=0;
\n+
667 }
\n+
668
\n+
669
\n+
680 template<class T1, class V1, class R1, class D,
\n+
681 class T2, class V2, class R2>
\n+
682 inline typename EnableIfInterOperable<T1,T2,bool>::type
\n+\n+\n+
685 {
\n+
686 if(std::is_convertible<T2,T1>::value)
\n+
687 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))<0;
\n+
688 else
\n+
689 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))>0;
\n+
690 }
\n+
691
\n+
702 template<class T1, class V1, class R1, class D,
\n+
703 class T2, class V2, class R2>
\n+
704 inline typename EnableIfInterOperable<T1,T2,bool>::type
\n+\n+\n+
707 {
\n+
708 if(std::is_convertible<T2,T1>::value)
\n+
709 return static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs))<=0;
\n+
710 else
\n+
711 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs))>=0;
\n+
712 }
\n+
713
\n+
724 template<class T1, class V1, class R1, class D,
\n+
725 class T2, class V2, class R2>
\n+
726 inline typename EnableIfInterOperable<T1,T2,D>::type
\n+\n+\n+
729 {
\n+
730 if(std::is_convertible<T2,T1>::value)
\n+
731 return -static_cast<const T1&>(lhs).distanceTo(static_cast<const T2&>(rhs));
\n+
732 else
\n+
733 return static_cast<const T2&>(rhs).distanceTo(static_cast<const T1&>(lhs));
\n+
734 }
\n+
735
\n+
737}
\n+
738#endif
\n+
Traits for type conversions and type information.
\n
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:542
\n-
bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)
Definition: bigunsignedint.hh:535
\n-
I round(const T &val, typename EpsilonType< T >::Type epsilon)
round using epsilon
Definition: float_cmp.cc:311
\n-
I trunc(const T &val, typename EpsilonType< T >::Type epsilon)
truncate using epsilon
Definition: float_cmp.cc:407
\n-
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
\n-
STL namespace.
\n+
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:637
\n+
EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:683
\n+
EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:660
\n+
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:237
\n+
EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:705
\n+
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:259
\n
Dune namespace.
Definition: alignedallocator.hh:13
\n-
T max_value(const AlignedNumber< T, align > &val)
Definition: debugalign.hh:481
\n-
T min_value(const AlignedNumber< T, align > &val)
Definition: debugalign.hh:487
\n-
auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
Definition: debugalign.hh:447
\n-
auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
Definition: debugalign.hh:425
\n-
Default exception class for range errors.
Definition: exceptions.hh:254
\n+
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:141
\n+
std::forward_iterator_tag iterator_category
Definition: iteratorfacades.hh:145
\n+
V * pointer
Definition: iteratorfacades.hh:148
\n+
DerivedType & operator++()
Preincrement operator.
Definition: iteratorfacades.hh:209
\n+
D DifferenceType
The type of the difference between two positions.
Definition: iteratorfacades.hh:190
\n+
R Reference
The type of the reference to the values accessed.
Definition: iteratorfacades.hh:195
\n+
Pointer operator->() const
Definition: iteratorfacades.hh:203
\n+
T DerivedType
The type of derived iterator.
Definition: iteratorfacades.hh:175
\n+
V Value
The type of value accessed through the iterator.
Definition: iteratorfacades.hh:180
\n+
typename std::remove_const< V >::type value_type
Definition: iteratorfacades.hh:146
\n+
DerivedType operator++(int)
Postincrement operator.
Definition: iteratorfacades.hh:216
\n+
V * Pointer
The pointer to the Value.
Definition: iteratorfacades.hh:185
\n+
D difference_type
Definition: iteratorfacades.hh:147
\n+
Reference operator*() const
Dereferencing operator.
Definition: iteratorfacades.hh:198
\n+
R reference
Definition: iteratorfacades.hh:149
\n+
Facade class for stl conformant bidirectional iterators.
Definition: iteratorfacades.hh:274
\n+
V * pointer
Definition: iteratorfacades.hh:281
\n+
typename std::remove_const< V >::type value_type
Definition: iteratorfacades.hh:279
\n+
Reference operator*() const
Dereferencing operator.
Definition: iteratorfacades.hh:332
\n+
D difference_type
Definition: iteratorfacades.hh:280
\n+
T DerivedType
The type of derived iterator.
Definition: iteratorfacades.hh:309
\n+
DerivedType & operator--()
Preincrement operator.
Definition: iteratorfacades.hh:359
\n+
Pointer operator->() const
Definition: iteratorfacades.hh:337
\n+
DerivedType & operator++()
Preincrement operator.
Definition: iteratorfacades.hh:343
\n+
V * Pointer
The pointer to the Value.
Definition: iteratorfacades.hh:319
\n+
R Reference
The type of the reference to the values accessed.
Definition: iteratorfacades.hh:329
\n+
DerivedType operator++(int)
Postincrement operator.
Definition: iteratorfacades.hh:350
\n+
std::bidirectional_iterator_tag iterator_category
Definition: iteratorfacades.hh:278
\n+
D DifferenceType
The type of the difference between two positions.
Definition: iteratorfacades.hh:324
\n+
DerivedType operator--(int)
Postincrement operator.
Definition: iteratorfacades.hh:366
\n+
R reference
Definition: iteratorfacades.hh:282
\n+
V Value
The type of value accessed through the iterator.
Definition: iteratorfacades.hh:314
\n+
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:434
\n+
typename std::remove_const< V >::type value_type
Definition: iteratorfacades.hh:439
\n+
D difference_type
Definition: iteratorfacades.hh:440
\n+
DerivedType operator--(int)
Postdecrement operator.
Definition: iteratorfacades.hh:557
\n+
V * pointer
Definition: iteratorfacades.hh:441
\n+
std::random_access_iterator_tag iterator_category
Definition: iteratorfacades.hh:438
\n+
Reference operator*() const
Dereferencing operator.
Definition: iteratorfacades.hh:500
\n+
DerivedType & operator++()
Preincrement operator.
Definition: iteratorfacades.hh:521
\n+
R reference
Definition: iteratorfacades.hh:442
\n+
Pointer operator->() const
Definition: iteratorfacades.hh:505
\n+
D DifferenceType
The type of the difference between two positions.
Definition: iteratorfacades.hh:492
\n+
DerivedType & operator--()
Predecrement operator.
Definition: iteratorfacades.hh:550
\n+
DerivedType & operator-=(DifferenceType n)
Definition: iteratorfacades.hh:564
\n+
DerivedType operator+(DifferenceType n) const
Definition: iteratorfacades.hh:541
\n+
Reference operator[](DifferenceType n) const
Get the element n positions from the current one.
Definition: iteratorfacades.hh:515
\n+
T DerivedType
The type of derived iterator.
Definition: iteratorfacades.hh:477
\n+
V * Pointer
The pointer to the Value.
Definition: iteratorfacades.hh:487
\n+
DerivedType operator-(DifferenceType n) const
Definition: iteratorfacades.hh:570
\n+
DerivedType operator++(int)
Postincrement operator.
Definition: iteratorfacades.hh:528
\n+
V Value
The type of value accessed through the iterator.
Definition: iteratorfacades.hh:482
\n+
DerivedType & operator+=(DifferenceType n)
Definition: iteratorfacades.hh:535
\n+
R Reference
The type of the reference to the values accessed.
Definition: iteratorfacades.hh:497
\n+
Enable typedef if two types are interoperable.
Definition: typetraits.hh:81
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,542 +4,617 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-quadmath.hh\n+iteratorfacades.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_QUADMATH_HH\n- 6#define DUNE_QUADMATH_HH\n+ 5#ifndef DUNE_ITERATORFACADES_HH\n+ 6#define DUNE_ITERATORFACADES_HH\n 7\n- 8#if HAVE_QUADMATH\n- 9#include \n+ 8#include \n+ 9#include \n 10\n- 11#include \n- 12#include \n- 13#include \n- 14#include // abs\n- 15#include \n- 16#include \n- 17#include \n- 18#include \n- 19\n- 20#include \n- 21#include \n- 22\n- 23namespace Dune\n- 24{\n- 25 namespace Impl\n- 26 {\n- 27 // forward declaration\n- 28 class Float128;\n- 29\n- 30 } // end namespace Impl\n- 31\n- 32 using Impl::Float128;\n- 33\n- 34 // The purpose of this namespace is to move the `` function\n-overloads\n- 35 // out of namespace `Dune`, see AlignedNumber in debugalign.hh.\n- 36 namespace Impl\n- 37 {\n- 38 using float128_t = __float128;\n- 39\n- 41 class Float128\n- 42 {\n- 43 float128_t value_ = 0.0q;\n- 44\n- 45 public:\n- 46 constexpr Float128() = default;\n- 47 constexpr Float128(const float128_t& value) noexcept\n- 48 : value_(value)\n- 49 {}\n- 50\n- 51 // constructor from any floating-point or integer type\n- 52 template ::value, int> = 0>\n- 54 constexpr Float128(const T& value) noexcept\n- 55 : value_(value)\n- 56 {}\n- 57\n- 58 // constructor from pointer to null-terminated byte string\n- 59 explicit Float128(const char* str) noexcept\n- 60 : value_(strtoflt128(str, NULL))\n- 61 {}\n- 62\n- 63 // accessors\n- 64 constexpr operator float128_t() const noexcept { return value_; }\n- 65\n- 66 constexpr float128_t const& value() const noexcept { return value_; }\n- 67 constexpr float128_t& value() noexcept { return value_; }\n- 68\n- 69 // I/O\n- 70 template\n- 71 friend std::basic_istream&\n- 72 operator>>(std::basic_istream& in, Float128& x)\n- 73 {\n- 74 std::string buf;\n- 75 buf.reserve(128);\n- 76 in >> buf;\n- 77 x.value() = strtoflt128(buf.c_str(), NULL);\n- 78 return in;\n- 79 }\n- 80\n- 81 template\n- 82 friend std::basic_ostream&\n- 83 operator<<(std::basic_ostream& out, const Float128& x)\n- 84 {\n- 85 const std::size_t bufSize = 128;\n- 86 CharT buf[128];\n- 87\n- 88 std::string format = \"%.\" + std::to_string(out.precision()) + \"Q\" +\n- 89 ((out.flags() | std::ios_base::scientific) ? \"e\" : \"f\");\n- 90 const int numChars = quadmath_snprintf(buf, bufSize, format.c_str(),\n-x.value());\n- 91 if (std::size_t(numChars) >= bufSize) {\n- 92 DUNE_THROW(Dune::RangeError, \"Failed to print Float128 value: buffer\n-overflow\");\n- 93 }\n- 94 out << buf;\n- 95 return out;\n- 96 }\n- 97\n- 98 // Increment, decrement\n- 99 constexpr Float128& operator++() noexcept { ++value_; return *this; }\n- 100 constexpr Float128& operator--() noexcept { --value_; return *this; }\n- 101\n- 102 constexpr Float128 operator++(int) noexcept { Float128 tmp{*this};\n-++value_; return tmp; }\n- 103 constexpr Float128 operator--(int) noexcept { Float128 tmp{*this}; --\n-value_; return tmp; }\n- 104\n- 105 // unary operators\n- 106 constexpr Float128 operator+() const noexcept { return Float128{+value_};\n-}\n- 107 constexpr Float128 operator-() const noexcept { return Float128{-value_};\n-}\n- 108\n- 109 // assignment operators\n- 110#define DUNE_ASSIGN_OP(OP) \\\n- 111 constexpr Float128& operator OP(const Float128& u) noexcept \\\n- 112 { \\\n- 113 value_ OP float128_t(u); \\\n- 114 return *this; \\\n- 115 } \\\n- 116 static_assert(true, \"Require semicolon to unconfuse editors\")\n- 117\n- 118 DUNE_ASSIGN_OP(+=);\n- 119 DUNE_ASSIGN_OP(-=);\n- 120\n- 121 DUNE_ASSIGN_OP(*=);\n- 122 DUNE_ASSIGN_OP(/=);\n- 123\n- 124#undef DUNE_ASSIGN_OP\n- 125\n- 126 }; // end class Float128\n- 127\n- 128 // binary operators:\n- 129 // For symmetry provide overloads with arithmetic types\n- 130 // in the first or second argument.\n- 131#define DUNE_BINARY_OP(OP) \\\n- 132 constexpr Float128 operator OP(const Float128& t, \\\n- 133 const Float128& u) noexcept \\\n- 134 { \\\n- 135 return Float128{float128_t(t) OP float128_t(u)}; \\\n- 136 } \\\n- 137 constexpr Float128 operator OP(const float128_t& t, \\\n- 138 const Float128& u) noexcept \\\n- 139 { \\\n- 140 return Float128{t OP float128_t(u)}; \\\n- 141 } \\\n- 142 constexpr Float128 operator OP(const Float128& t, \\\n- 143 const float128_t& u) noexcept \\\n- 144 { \\\n- 145 return Float128{float128_t(t) OP u}; \\\n- 146 } \\\n- 147 template ::value, int> = 0> \\\n- 149 constexpr Float128 operator OP(const T& t, \\\n- 150 const Float128& u) noexcept \\\n- 151 { \\\n- 152 return Float128{float128_t(t) OP float128_t(u)}; \\\n- 153 } \\\n- 154 template ::value, int> = 0> \\\n- 156 constexpr Float128 operator OP(const Float128& t, \\\n- 157 const U& u) noexcept \\\n- 158 { \\\n- 159 return Float128{float128_t(t) OP float128_t(u)}; \\\n- 160 } \\\n- 161 static_assert(true, \"Require semicolon to unconfuse editors\")\n- 162\n- 163 DUNE_BINARY_OP(+);\n- 164 DUNE_BINARY_OP(-);\n- 165 DUNE_BINARY_OP(*);\n- 166 DUNE_BINARY_OP(/);\n- 167\n- 168#undef DUNE_BINARY_OP\n- 169\n- 170 // logical operators:\n- 171 // For symmetry provide overloads with arithmetic types\n- 172 // in the first or second argument.\n- 173#define DUNE_BINARY_BOOL_OP(OP) \\\n- 174 constexpr bool operator OP(const Float128& t, \\\n- 175 const Float128& u) noexcept \\\n- 176 { \\\n- 177 return float128_t(t) OP float128_t(u); \\\n- 178 } \\\n- 179 template ::value, int> = 0> \\\n- 181 constexpr bool operator OP(const T& t, \\\n- 182 const Float128& u) noexcept \\\n- 183 { \\\n- 184 return float128_t(t) OP float128_t(u); \\\n- 185 } \\\n- 186 template ::value, int> = 0> \\\n- 188 constexpr bool operator OP(const Float128& t, \\\n- 189 const U& u) noexcept \\\n- 190 { \\\n- 191 return float128_t(t) OP float128_t(u); \\\n- 192 } \\\n- 193 static_assert(true, \"Require semicolon to unconfuse editors\")\n- 194\n- 195 DUNE_BINARY_BOOL_OP(==);\n- 196 DUNE_BINARY_BOOL_OP(!=);\n- 197 DUNE_BINARY_BOOL_OP(<);\n- 198 DUNE_BINARY_BOOL_OP(>);\n- 199 DUNE_BINARY_BOOL_OP(<=);\n- 200 DUNE_BINARY_BOOL_OP(>=);\n- 201\n- 202#undef DUNE_BINARY_BOOL_OP\n- 203\n- 204 // Overloads for the cmath functions\n- 205\n- 206 // function with name `name` redirects to quadmath function `func`\n- 207#define DUNE_UNARY_FUNC(name,func) \\\n- 208 inline Float128 name(const Float128& u) noexcept \\\n- 209 { \\\n- 210 return Float128{func (float128_t(u))}; \\\n- 211 } \\\n- 212 static_assert(true, \"Require semicolon to unconfuse editors\")\n- 213\n- 214 // like DUNE_UNARY_FUNC but with custom return type\n- 215#define DUNE_CUSTOM_UNARY_FUNC(type,name,func) \\\n- 216 inline type name(const Float128& u) noexcept \\\n- 217 { \\\n- 218 return (type)(func (float128_t(u))); \\\n- 219 } \\\n- 220 static_assert(true, \"Require semicolon to unconfuse editors\")\n- 221\n- 222 // redirects to quadmath function with two arguments\n- 223#define DUNE_BINARY_FUNC(name,func) \\\n- 224 inline Float128 name(const Float128& t, \\\n- 225 const Float128& u) noexcept \\\n- 226 { \\\n- 227 return Float128{func (float128_t(t), float128_t(u))}; \\\n- 228 } \\\n- 229 static_assert(true, \"Require semicolon to unconfuse editors\")\n- 230\n- 231 DUNE_UNARY_FUNC(abs, fabsq);\n- 232 DUNE_UNARY_FUNC(acos, acosq);\n- 233 DUNE_UNARY_FUNC(acosh, acoshq);\n- 234 DUNE_UNARY_FUNC(asin, asinq);\n- 235 DUNE_UNARY_FUNC(asinh, asinhq);\n- 236 DUNE_UNARY_FUNC(atan, atanq);\n- 237 DUNE_UNARY_FUNC(atanh, atanhq);\n- 238 DUNE_UNARY_FUNC(cbrt, cbrtq);\n- 239 DUNE_UNARY_FUNC(ceil, ceilq);\n- 240 DUNE_UNARY_FUNC(cos, cosq);\n- 241 DUNE_UNARY_FUNC(cosh, coshq);\n- 242 DUNE_UNARY_FUNC(erf, erfq);\n- 243 DUNE_UNARY_FUNC(erfc, erfcq);\n- 244 DUNE_UNARY_FUNC(exp, expq);\n- 245 DUNE_UNARY_FUNC(expm1, expm1q);\n- 246 DUNE_UNARY_FUNC(fabs, fabsq);\n- 247 DUNE_UNARY_FUNC(floor, floorq);\n- 248 DUNE_CUSTOM_UNARY_FUNC(int, ilogb, ilogbq);\n- 249 DUNE_UNARY_FUNC(lgamma, lgammaq);\n- 250 DUNE_CUSTOM_UNARY_FUNC(long long int, llrint, llrintq);\n- 251 DUNE_CUSTOM_UNARY_FUNC(long long int, llround, llroundq);\n- 252 DUNE_UNARY_FUNC(log, logq);\n- 253 DUNE_UNARY_FUNC(log10, log10q);\n- 254 DUNE_UNARY_FUNC(log1p, log1pq);\n- 255 DUNE_UNARY_FUNC(log2, log2q);\n- 256 // DUNE_UNARY_FUNC(logb, logbq); // not available in gcc5\n- 257 DUNE_CUSTOM_UNARY_FUNC(long int, lrint, lrintq);\n- 258 DUNE_CUSTOM_UNARY_FUNC(long int, lround, lroundq);\n- 259 DUNE_UNARY_FUNC(nearbyint, nearbyintq);\n- 260 DUNE_BINARY_FUNC(nextafter, nextafterq);\n- 261 DUNE_BINARY_FUNC(pow, powq); // overload for integer argument see below\n- 262 DUNE_UNARY_FUNC(rint, rintq);\n- 263 DUNE_UNARY_FUNC(round, roundq);\n- 264 DUNE_UNARY_FUNC(sin, sinq);\n- 265 DUNE_UNARY_FUNC(sinh, sinhq);\n- 266 DUNE_UNARY_FUNC(sqrt, sqrtq);\n- 267 DUNE_UNARY_FUNC(tan, tanq);\n- 268 DUNE_UNARY_FUNC(tanh, tanhq);\n- 269 DUNE_UNARY_FUNC(tgamma, tgammaq);\n- 270 DUNE_UNARY_FUNC(trunc, truncq);\n- 271\n- 272 DUNE_CUSTOM_UNARY_FUNC(bool, isfinite, finiteq);\n- 273 DUNE_CUSTOM_UNARY_FUNC(bool, isinf, isinfq);\n- 274 DUNE_CUSTOM_UNARY_FUNC(bool, isnan, isnanq);\n- 275 DUNE_CUSTOM_UNARY_FUNC(bool, signbit, signbitq);\n- 276\n- 277#undef DUNE_UNARY_FUNC\n- 278#undef DUNE_CUSTOM_UNARY_FUNC\n- 279#undef DUNE_BINARY_FUNC\n- 280\n- 281 // like DUNE_BINARY_FUNC but provide overloads with arithmetic\n- 282 // types in the first or second argument.\n- 283#define DUNE_BINARY_ARITHMETIC_FUNC(name,func) \\\n- 284 inline Float128 name(const Float128& t, \\\n- 285 const Float128& u) noexcept \\\n- 286 { \\\n- 287 return Float128{func (float128_t(t), float128_t(u))}; \\\n- 288 } \\\n- 289 template ::value, int> = 0> \\\n- 291 inline Float128 name(const T& t, \\\n- 292 const Float128& u) noexcept \\\n- 293 { \\\n- 294 return Float128{func (float128_t(t), float128_t(u))}; \\\n- 295 } \\\n- 296 template ::value, int> = 0> \\\n- 298 inline Float128 name(const Float128& t, \\\n- 299 const U& u) noexcept \\\n- 300 { \\\n- 301 return Float128{func (float128_t(t), float128_t(u))}; \\\n- 302 } \\\n- 303 static_assert(true, \"Require semicolon to unconfuse editors\")\n- 304\n- 305 DUNE_BINARY_ARITHMETIC_FUNC(atan2,atan2q);\n- 306 DUNE_BINARY_ARITHMETIC_FUNC(copysign,copysignq);\n- 307 DUNE_BINARY_ARITHMETIC_FUNC(fdim,fdimq);\n- 308 DUNE_BINARY_ARITHMETIC_FUNC(fmax,fmaxq);\n- 309 DUNE_BINARY_ARITHMETIC_FUNC(fmin,fminq);\n- 310 DUNE_BINARY_ARITHMETIC_FUNC(fmod,fmodq);\n- 311 DUNE_BINARY_ARITHMETIC_FUNC(hypot,hypotq);\n- 312 DUNE_BINARY_ARITHMETIC_FUNC(remainder,remainderq);\n- 313\n- 314#undef DUNE_BINARY_ARITHMETIC_FUNC\n+ 11#include \"typetraits.hh\"\n+ 12\n+ 13namespace Dune\n+ 14{\n+ 139 template\n+140 class ForwardIteratorFacade\n+ 141 {\n+ 142\n+ 143 public:\n+ 144 /* type aliases required by C++ for iterators */\n+145 using iterator_category = std::forward_iterator_tag;\n+146 using value_type = typename std::remove_const::type;\n+147 using difference_type = D;\n+148 using pointer = V*;\n+149 using reference = R;\n+ 150\n+175 typedef T DerivedType;\n+ 176\n+180 typedef V Value;\n+ 181\n+185 typedef V* Pointer;\n+ 186\n+190 typedef D DifferenceType;\n+ 191\n+195 typedef R Reference;\n+ 196\n+198 Reference operator*() const\n+ 199 {\n+ 200 return static_cast(this)->dereference();\n+ 201 }\n+ 202\n+203 Pointer operator->() const\n+ 204 {\n+ 205 return &(static_cast(this)->dereference());\n+ 206 }\n+ 207\n+209 DerivedType& operator++()\n+ 210 {\n+ 211 static_cast(this)->increment();\n+ 212 return *static_cast(this);\n+ 213 }\n+ 214\n+216 DerivedType operator++(int)\n+ 217 {\n+ 218 DerivedType tmp(static_cast(*this));\n+ 219 this->operator++();\n+ 220 return tmp;\n+ 221 }\n+ 222 };\n+ 223\n+ 234 template\n+ 236 inline typename EnableIfInterOperable::type\n+237 operator==(const ForwardIteratorFacade& lhs,\n+ 238 const ForwardIteratorFacade& rhs)\n+ 239 {\n+ 240 if(std::is_convertible::value)\n+ 241 return static_cast(lhs).equals(static_cast(rhs));\n+ 242 else\n+ 243 return static_cast(rhs).equals(static_cast(lhs));\n+ 244 }\n+ 245\n+ 256 template\n+ 258 inline typename EnableIfInterOperable::type\n+259 operator!=(const ForwardIteratorFacade& lhs,\n+ 260 const ForwardIteratorFacade& rhs)\n+ 261 {\n+ 262 if(std::is_convertible::value)\n+ 263 return !static_cast(lhs).equals(static_cast(rhs));\n+ 264 else\n+ 265 return !static_cast(rhs).equals(static_cast(lhs));\n+ 266 }\n+ 267\n+ 272 template\n+273 class BidirectionalIteratorFacade\n+ 274 {\n+ 275\n+ 276 public:\n+ 277 /* type aliases required by C++ for iterators */\n+278 using iterator_category = std::bidirectional_iterator_tag;\n+279 using value_type = typename std::remove_const::type;\n+280 using difference_type = D;\n+281 using pointer = V*;\n+282 using reference = R;\n+ 283\n+309 typedef T DerivedType;\n+ 310\n+314 typedef V Value;\n 315\n- 316 // some more cmath functions with special signature\n- 317\n- 318 inline Float128 fma(const Float128& t, const Float128& u, const Float128&\n-v)\n- 319 {\n- 320 return Float128{fmaq(float128_t(t),float128_t(u),float128_t(v))};\n- 321 }\n- 322\n- 323 inline Float128 frexp(const Float128& u, int* p)\n- 324 {\n- 325 return Float128{frexpq(float128_t(u), p)};\n- 326 }\n- 327\n- 328 inline Float128 ldexp(const Float128& u, int p)\n- 329 {\n- 330 return Float128{ldexpq(float128_t(u), p)};\n- 331 }\n- 332\n- 333 inline Float128 remquo(const Float128& t, const Float128& u, int* quo)\n- 334 {\n- 335 return Float128{remquoq(float128_t(t), float128_t(u), quo)};\n- 336 }\n- 337\n- 338 inline Float128 scalbln(const Float128& u, long int e)\n- 339 {\n- 340 return Float128{scalblnq(float128_t(u), e)};\n- 341 }\n- 342\n- 343 inline Float128 scalbn(const Float128& u, int e)\n+319 typedef V* Pointer;\n+ 320\n+324 typedef D DifferenceType;\n+ 325\n+329 typedef R Reference;\n+ 330\n+332 Reference operator*() const\n+ 333 {\n+ 334 return static_cast(this)->dereference();\n+ 335 }\n+ 336\n+337 Pointer operator->() const\n+ 338 {\n+ 339 return &(static_cast(this)->dereference());\n+ 340 }\n+ 341\n+343 DerivedType& operator++()\n 344 {\n- 345 return Float128{scalbnq(float128_t(u), e)};\n- 346 }\n- 347\n- 349 // NOTE: This is much faster than a pow(x, Float128(p)) call\n- 350 // NOTE: This is a modified version of boost::math::cstdfloat::detail::\n-pown\n- 351 // (adapted to the type Float128) that is part of the Boost 1.65 Math\n-toolkit 2.8.0\n- 352 // and is implemented by Christopher Kormanyos, John Maddock, and Paul A.\n-Bristow,\n- 353 // distributed under the Boost Software License, Version 1.0\n- 354 // (See http://www.boost.org/LICENSE_1_0.txt)\n- 355 template ::value, int> = 0>\n- 357 inline Float128 pow(const Float128& x, const Int p)\n- 358 {\n- 359 static const Float128 max_value = FLT128_MAX;\n- 360 static const Float128 min_value = FLT128_MIN;\n- 361 static const Float128 inf_value = float128_t{1} / float128_t{0};\n- 362\n- 363 const bool isneg = (x < 0);\n- 364 const bool isnan = (x != x);\n- 365 const bool isinf = (isneg ? bool(-x > max_value) : bool(+x > max_value));\n- 366\n- 367 if (isnan) { return x; }\n- 368 if (isinf) { return Float128{nanq(\"\")}; }\n- 369\n- 370 const Float128 abs_x = (isneg ? -x : x);\n- 371 if (p < Int(0)) {\n- 372 if (abs_x < min_value)\n- 373 return (isneg ? -inf_value : +inf_value);\n- 374 else\n- 375 return Float128(1) / pow(x, Int(-p));\n- 376 }\n- 377\n- 378 if (p == Int(0)) { return Float128(1); }\n- 379 if (p == Int(1)) { return x; }\n- 380 if (abs_x > max_value)\n- 381 return (isneg ? -inf_value : +inf_value);\n- 382\n- 383 if (p == Int(2)) { return (x * x); }\n- 384 if (p == Int(3)) { return ((x * x) * x); }\n- 385 if (p == Int(4)) { const Float128 x2 = (x * x); return (x2 * x2); }\n- 386\n- 387 Float128 result = ((p % Int(2)) != Int(0)) ? x : Float128(1);\n- 388 Float128 xn = x; // binary powers of x\n+ 345 static_cast(this)->increment();\n+ 346 return *static_cast(this);\n+ 347 }\n+ 348\n+350 DerivedType operator++(int)\n+ 351 {\n+ 352 DerivedType tmp(static_cast(*this));\n+ 353 this->operator++();\n+ 354 return tmp;\n+ 355 }\n+ 356\n+ 357\n+359 DerivedType& operator--()\n+ 360 {\n+ 361 static_cast(this)->decrement();\n+ 362 return *static_cast(this);\n+ 363 }\n+ 364\n+366 DerivedType operator--(int)\n+ 367 {\n+ 368 DerivedType tmp(static_cast(*this));\n+ 369 this->operator--();\n+ 370 return tmp;\n+ 371 }\n+ 372 };\n+ 373\n+ 381 template\n+ 383 inline typename std::enable_if::value,bool>::\n+type\n+384 operator==(const BidirectionalIteratorFacade& lhs,\n+ 385 const BidirectionalIteratorFacade& rhs)\n+ 386 {\n+ 387 return static_cast(lhs).equals(static_cast(rhs));\n+ 388 }\n 389\n- 390 Int p2 = p;\n- 391 while (Int(p2 /= 2) != Int(0)) {\n- 392 xn *= xn; // Square xn for each binary power\n- 393\n- 394 const bool has_binary_power = (Int(p2 % Int(2)) != Int(0));\n- 395 if (has_binary_power)\n- 396 result *= xn;\n- 397 }\n- 398\n- 399 return result;\n- 400 }\n- 401\n- 402\n- 403 } // end namespace Impl\n- 404\n- 405 template <>\n- 406 struct IsNumber\n- 407 : public std::true_type {};\n+ 398 template\n+ 400 inline\n+ 401 typename std::enable_if::value && !std::\n+is_convertible::value,\n+ 402 bool>::type\n+403 operator==(const BidirectionalIteratorFacade& lhs,\n+ 404 const BidirectionalIteratorFacade& rhs)\n+ 405 {\n+ 406 return static_cast(rhs).equals(static_cast(lhs));\n+ 407 }\n 408\n- 409} // end namespace Dune\n- 410\n- 411namespace std\n- 412{\n- 413#ifndef NO_STD_NUMERIC_LIMITS_SPECIALIZATION\n- 414 template <>\n- 415 class numeric_limits\n- 416 {\n- 417 using Float128 = Dune::Impl::Float128;\n- 418 using float128_t = Dune::Impl::float128_t;\n- 419\n- 420 public:\n- 421 static constexpr bool is_specialized = true;\n- 422 static constexpr Float128 min() noexcept { return FLT128_MIN; }\n- 423 static constexpr Float128 max() noexcept { return FLT128_MAX; }\n- 424 static constexpr Float128 lowest() noexcept { return -FLT128_MAX; }\n- 425 static constexpr int digits = FLT128_MANT_DIG;\n- 426 static constexpr int digits10 = 34;\n- 427 static constexpr int max_digits10 = 36;\n- 428 static constexpr bool is_signed = true;\n- 429 static constexpr bool is_integer = false;\n- 430 static constexpr bool is_exact = false;\n- 431 static constexpr int radix = 2;\n- 432 static constexpr Float128 epsilon() noexcept { return FLT128_EPSILON; }\n- 433 static constexpr Float128 round_error() noexcept { return float128_t{0.5};\n-}\n- 434 static constexpr int min_exponent = FLT128_MIN_EXP;\n- 435 static constexpr int min_exponent10 = FLT128_MIN_10_EXP;\n- 436 static constexpr int max_exponent = FLT128_MAX_EXP;\n- 437 static constexpr int max_exponent10 = FLT128_MAX_10_EXP;\n- 438 static constexpr bool has_infinity = true;\n- 439 static constexpr bool has_quiet_NaN = true;\n- 440 static constexpr bool has_signaling_NaN = false;\n- 441 static constexpr float_denorm_style has_denorm = denorm_present;\n- 442 static constexpr bool has_denorm_loss = false;\n- 443 static constexpr Float128 infinity() noexcept { return float128_t{1}/\n-float128_t{0}; }\n- 444 static Float128 quiet_NaN() noexcept { return nanq(\"\"); }\n- 445 static constexpr Float128 signaling_NaN() noexcept { return float128_t{};\n-}\n- 446 static constexpr Float128 denorm_min() noexcept { return\n-FLT128_DENORM_MIN; }\n- 447 static constexpr bool is_iec559 = true;\n- 448 static constexpr bool is_bounded = false;\n- 449 static constexpr bool is_modulo = false;\n- 450 static constexpr bool traps = false;\n- 451 static constexpr bool tinyness_before = false;\n- 452 static constexpr float_round_style round_style = round_to_nearest;\n- 453 };\n- 454#endif\n- 455} // end namespace std\n- 456\n- 457#endif // HAVE_QUADMATH\n- 458#endif // DUNE_QUADMATH_HH\n-exceptions.hh\n-A few common exception classes.\n-DUNE_BINARY_OP\n-#define DUNE_BINARY_OP(OP)\n-Definition: debugalign.hh:248\n-DUNE_UNARY_FUNC\n-#define DUNE_UNARY_FUNC(name)\n-DUNE_ASSIGN_OP\n-#define DUNE_ASSIGN_OP(OP)\n-Definition: debugalign.hh:207\n+ 419 template\n+ 421 inline typename EnableIfInterOperable::type\n+422 operator!=(const BidirectionalIteratorFacade& lhs,\n+ 423 const BidirectionalIteratorFacade& rhs)\n+ 424 {\n+ 425 return !(lhs == rhs);\n+ 426 }\n+ 427\n+ 432 template\n+433 class RandomAccessIteratorFacade\n+ 434 {\n+ 435\n+ 436 public:\n+ 437 /* type aliases required by C++ for iterators */\n+438 using iterator_category = std::random_access_iterator_tag;\n+439 using value_type = typename std::remove_const::type;\n+440 using difference_type = D;\n+441 using pointer = V*;\n+442 using reference = R;\n+ 443\n+477 typedef T DerivedType;\n+ 478\n+482 typedef V Value;\n+ 483\n+487 typedef V* Pointer;\n+ 488\n+492 typedef D DifferenceType;\n+ 493\n+497 typedef R Reference;\n+ 498\n+500 Reference operator*() const\n+ 501 {\n+ 502 return static_cast(this)->dereference();\n+ 503 }\n+ 504\n+505 Pointer operator->() const\n+ 506 {\n+ 507 return &(static_cast(this)->dereference());\n+ 508 }\n+ 509\n+515 Reference operator[](DifferenceType n) const\n+ 516 {\n+ 517 return static_cast(this)->elementAt(n);\n+ 518 }\n+ 519\n+521 DerivedType& operator++()\n+ 522 {\n+ 523 static_cast(this)->increment();\n+ 524 return *static_cast(this);\n+ 525 }\n+ 526\n+528 DerivedType operator++(int)\n+ 529 {\n+ 530 DerivedType tmp(static_cast(*this));\n+ 531 this->operator++();\n+ 532 return tmp;\n+ 533 }\n+ 534\n+535 DerivedType& operator+=(DifferenceType n)\n+ 536 {\n+ 537 static_cast(this)->advance(n);\n+ 538 return *static_cast(this);\n+ 539 }\n+ 540\n+541 DerivedType operator+(DifferenceType n) const\n+ 542 {\n+ 543 DerivedType tmp(static_cast(*this));\n+ 544 tmp.advance(n);\n+ 545 return tmp;\n+ 546 }\n+ 547\n+ 548\n+550 DerivedType& operator--()\n+ 551 {\n+ 552 static_cast(this)->decrement();\n+ 553 return *static_cast(this);\n+ 554 }\n+ 555\n+557 DerivedType operator--(int)\n+ 558 {\n+ 559 DerivedType tmp(static_cast(*this));\n+ 560 this->operator--();\n+ 561 return tmp;\n+ 562 }\n+ 563\n+564 DerivedType& operator-=(DifferenceType n)\n+ 565 {\n+ 566 static_cast(this)->advance(-n);\n+ 567 return *static_cast(this);\n+ 568 }\n+ 569\n+570 DerivedType operator-(DifferenceType n) const\n+ 571 {\n+ 572 DerivedType tmp(static_cast(*this));\n+ 573 tmp.advance(-n);\n+ 574 return tmp;\n+ 575 }\n+ 576\n+ 577\n+ 578 };\n+ 579\n+ 590 template\n+ 592 inline typename EnableIfInterOperable::type\n+593 operator==(const RandomAccessIteratorFacade& lhs,\n+ 594 const RandomAccessIteratorFacade& rhs)\n+ 595 {\n+ 596 if(std::is_convertible::value)\n+ 597 return static_cast(lhs).equals(static_cast(rhs));\n+ 598 else\n+ 599 return static_cast(rhs).equals(static_cast(lhs));\n+ 600 }\n+ 601\n+ 612 template\n+ 614 inline typename EnableIfInterOperable::type\n+615 operator!=(const RandomAccessIteratorFacade& lhs,\n+ 616 const RandomAccessIteratorFacade& rhs)\n+ 617 {\n+ 618 if(std::is_convertible::value)\n+ 619 return !static_cast(lhs).equals(static_cast(rhs));\n+ 620 else\n+ 621 return !static_cast(rhs).equals(static_cast(lhs));\n+ 622 }\n+ 623\n+ 634 template\n+636 inline typename EnableIfInterOperable::type\n+ 637 operator<(const RandomAccessIteratorFacade& lhs,\n+ 638 const RandomAccessIteratorFacade& rhs)\n+ 639 {\n+ 640 if(std::is_convertible::value)\n+ 641 return static_cast(lhs).distanceTo(static_cast\n+(rhs))>0;\n+ 642 else\n+ 643 return static_cast(rhs).distanceTo(static_cast\n+(lhs))<0;\n+ 644 }\n+ 645\n+ 646\n+ 657 template\n+659 inline typename EnableIfInterOperable::type\n+ 660 operator<=(const RandomAccessIteratorFacade& lhs,\n+ 661 const RandomAccessIteratorFacade& rhs)\n+ 662 {\n+ 663 if(std::is_convertible::value)\n+ 664 return static_cast(lhs).distanceTo(static_cast\n+(rhs))>=0;\n+ 665 else\n+ 666 return static_cast(rhs).distanceTo(static_cast\n+(lhs))<=0;\n+ 667 }\n+ 668\n+ 669\n+ 680 template\n+ 682 inline typename EnableIfInterOperable::type\n+683 operator>(const RandomAccessIteratorFacade& lhs,\n+ 684 const RandomAccessIteratorFacade& rhs)\n+ 685 {\n+ 686 if(std::is_convertible::value)\n+ 687 return static_cast(lhs).distanceTo(static_cast\n+(rhs))<0;\n+ 688 else\n+ 689 return static_cast(rhs).distanceTo(static_cast\n+(lhs))>0;\n+ 690 }\n+ 691\n+ 702 template\n+ 704 inline typename EnableIfInterOperable::type\n+705 operator>=(const RandomAccessIteratorFacade& lhs,\n+ 706 const RandomAccessIteratorFacade& rhs)\n+ 707 {\n+ 708 if(std::is_convertible::value)\n+ 709 return static_cast(lhs).distanceTo(static_cast\n+(rhs))<=0;\n+ 710 else\n+ 711 return static_cast(rhs).distanceTo(static_cast\n+(lhs))>=0;\n+ 712 }\n+ 713\n+ 724 template\n+ 726 inline typename EnableIfInterOperable::type\n+727 operator-(const RandomAccessIteratorFacade& lhs,\n+ 728 const RandomAccessIteratorFacade& rhs)\n+ 729 {\n+ 730 if(std::is_convertible::value)\n+ 731 return -static_cast(lhs).distanceTo(static_cast\n+(rhs));\n+ 732 else\n+ 733 return static_cast(rhs).distanceTo(static_cast\n+(lhs));\n+ 734 }\n+ 735\n+ 737}\n+ 738#endif\n typetraits.hh\n Traits for type conversions and type information.\n-Dune::operator>>\n-Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)\n-Read a std::tuple.\n-Definition: streamoperators.hh:43\n-Dune::operator<<\n-std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)\n-Definition: bigunsignedint.hh:278\n Dune::operator-\n bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)\n Definition: bigunsignedint.hh:542\n-Dune::operator+\n-bigunsignedint< k > operator+(const bigunsignedint< k > &x, std::uintmax_t y)\n-Definition: bigunsignedint.hh:535\n-Dune::FloatCmp::round\n-I round(const T &val, typename EpsilonType< T >::Type epsilon)\n-round using epsilon\n-Definition: float_cmp.cc:311\n-Dune::FloatCmp::trunc\n-I trunc(const T &val, typename EpsilonType< T >::Type epsilon)\n-truncate using epsilon\n-Definition: float_cmp.cc:407\n-DUNE_THROW\n-#define DUNE_THROW(E, m)\n-Definition: exceptions.hh:218\n-std\n-STL namespace.\n+Dune::operator<\n+EnableIfInterOperable< T1, T2, bool >::type operator<(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:637\n+Dune::operator>\n+EnableIfInterOperable< T1, T2, bool >::type operator>(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:683\n+Dune::operator<=\n+EnableIfInterOperable< T1, T2, bool >::type operator<=(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:660\n+Dune::operator==\n+EnableIfInterOperable< T1, T2, bool >::type operator==(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for equality.\n+Definition: iteratorfacades.hh:237\n+Dune::operator>=\n+EnableIfInterOperable< T1, T2, bool >::type operator>=(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:705\n+Dune::operator!=\n+EnableIfInterOperable< T1, T2, bool >::type operator!=(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for inequality.\n+Definition: iteratorfacades.hh:259\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::max_value\n-T max_value(const AlignedNumber< T, align > &val)\n-Definition: debugalign.hh:481\n-Dune::min_value\n-T min_value(const AlignedNumber< T, align > &val)\n-Definition: debugalign.hh:487\n-Dune::AlignedNumberImpl::min\n-auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n-&b)\n-Definition: debugalign.hh:447\n-Dune::AlignedNumberImpl::max\n-auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n-&b)\n-Definition: debugalign.hh:425\n-Dune::RangeError\n-Default exception class for range errors.\n-Definition: exceptions.hh:254\n+Dune::ForwardIteratorFacade\n+Base class for stl conformant forward iterators.\n+Definition: iteratorfacades.hh:141\n+Dune::ForwardIteratorFacade::iterator_category\n+std::forward_iterator_tag iterator_category\n+Definition: iteratorfacades.hh:145\n+Dune::ForwardIteratorFacade::pointer\n+V * pointer\n+Definition: iteratorfacades.hh:148\n+Dune::ForwardIteratorFacade::operator++\n+DerivedType & operator++()\n+Preincrement operator.\n+Definition: iteratorfacades.hh:209\n+Dune::ForwardIteratorFacade::DifferenceType\n+D DifferenceType\n+The type of the difference between two positions.\n+Definition: iteratorfacades.hh:190\n+Dune::ForwardIteratorFacade::Reference\n+R Reference\n+The type of the reference to the values accessed.\n+Definition: iteratorfacades.hh:195\n+Dune::ForwardIteratorFacade::operator->\n+Pointer operator->() const\n+Definition: iteratorfacades.hh:203\n+Dune::ForwardIteratorFacade::DerivedType\n+T DerivedType\n+The type of derived iterator.\n+Definition: iteratorfacades.hh:175\n+Dune::ForwardIteratorFacade::Value\n+V Value\n+The type of value accessed through the iterator.\n+Definition: iteratorfacades.hh:180\n+Dune::ForwardIteratorFacade::value_type\n+typename std::remove_const< V >::type value_type\n+Definition: iteratorfacades.hh:146\n+Dune::ForwardIteratorFacade::operator++\n+DerivedType operator++(int)\n+Postincrement operator.\n+Definition: iteratorfacades.hh:216\n+Dune::ForwardIteratorFacade::Pointer\n+V * Pointer\n+The pointer to the Value.\n+Definition: iteratorfacades.hh:185\n+Dune::ForwardIteratorFacade::difference_type\n+D difference_type\n+Definition: iteratorfacades.hh:147\n+Dune::ForwardIteratorFacade::operator*\n+Reference operator*() const\n+Dereferencing operator.\n+Definition: iteratorfacades.hh:198\n+Dune::ForwardIteratorFacade::reference\n+R reference\n+Definition: iteratorfacades.hh:149\n+Dune::BidirectionalIteratorFacade\n+Facade class for stl conformant bidirectional iterators.\n+Definition: iteratorfacades.hh:274\n+Dune::BidirectionalIteratorFacade::pointer\n+V * pointer\n+Definition: iteratorfacades.hh:281\n+Dune::BidirectionalIteratorFacade::value_type\n+typename std::remove_const< V >::type value_type\n+Definition: iteratorfacades.hh:279\n+Dune::BidirectionalIteratorFacade::operator*\n+Reference operator*() const\n+Dereferencing operator.\n+Definition: iteratorfacades.hh:332\n+Dune::BidirectionalIteratorFacade::difference_type\n+D difference_type\n+Definition: iteratorfacades.hh:280\n+Dune::BidirectionalIteratorFacade::DerivedType\n+T DerivedType\n+The type of derived iterator.\n+Definition: iteratorfacades.hh:309\n+Dune::BidirectionalIteratorFacade::operator--\n+DerivedType & operator--()\n+Preincrement operator.\n+Definition: iteratorfacades.hh:359\n+Dune::BidirectionalIteratorFacade::operator->\n+Pointer operator->() const\n+Definition: iteratorfacades.hh:337\n+Dune::BidirectionalIteratorFacade::operator++\n+DerivedType & operator++()\n+Preincrement operator.\n+Definition: iteratorfacades.hh:343\n+Dune::BidirectionalIteratorFacade::Pointer\n+V * Pointer\n+The pointer to the Value.\n+Definition: iteratorfacades.hh:319\n+Dune::BidirectionalIteratorFacade::Reference\n+R Reference\n+The type of the reference to the values accessed.\n+Definition: iteratorfacades.hh:329\n+Dune::BidirectionalIteratorFacade::operator++\n+DerivedType operator++(int)\n+Postincrement operator.\n+Definition: iteratorfacades.hh:350\n+Dune::BidirectionalIteratorFacade::iterator_category\n+std::bidirectional_iterator_tag iterator_category\n+Definition: iteratorfacades.hh:278\n+Dune::BidirectionalIteratorFacade::DifferenceType\n+D DifferenceType\n+The type of the difference between two positions.\n+Definition: iteratorfacades.hh:324\n+Dune::BidirectionalIteratorFacade::operator--\n+DerivedType operator--(int)\n+Postincrement operator.\n+Definition: iteratorfacades.hh:366\n+Dune::BidirectionalIteratorFacade::reference\n+R reference\n+Definition: iteratorfacades.hh:282\n+Dune::BidirectionalIteratorFacade::Value\n+V Value\n+The type of value accessed through the iterator.\n+Definition: iteratorfacades.hh:314\n+Dune::RandomAccessIteratorFacade\n+Base class for stl conformant forward iterators.\n+Definition: iteratorfacades.hh:434\n+Dune::RandomAccessIteratorFacade::value_type\n+typename std::remove_const< V >::type value_type\n+Definition: iteratorfacades.hh:439\n+Dune::RandomAccessIteratorFacade::difference_type\n+D difference_type\n+Definition: iteratorfacades.hh:440\n+Dune::RandomAccessIteratorFacade::operator--\n+DerivedType operator--(int)\n+Postdecrement operator.\n+Definition: iteratorfacades.hh:557\n+Dune::RandomAccessIteratorFacade::pointer\n+V * pointer\n+Definition: iteratorfacades.hh:441\n+Dune::RandomAccessIteratorFacade::iterator_category\n+std::random_access_iterator_tag iterator_category\n+Definition: iteratorfacades.hh:438\n+Dune::RandomAccessIteratorFacade::operator*\n+Reference operator*() const\n+Dereferencing operator.\n+Definition: iteratorfacades.hh:500\n+Dune::RandomAccessIteratorFacade::operator++\n+DerivedType & operator++()\n+Preincrement operator.\n+Definition: iteratorfacades.hh:521\n+Dune::RandomAccessIteratorFacade::reference\n+R reference\n+Definition: iteratorfacades.hh:442\n+Dune::RandomAccessIteratorFacade::operator->\n+Pointer operator->() const\n+Definition: iteratorfacades.hh:505\n+Dune::RandomAccessIteratorFacade::DifferenceType\n+D DifferenceType\n+The type of the difference between two positions.\n+Definition: iteratorfacades.hh:492\n+Dune::RandomAccessIteratorFacade::operator--\n+DerivedType & operator--()\n+Predecrement operator.\n+Definition: iteratorfacades.hh:550\n+Dune::RandomAccessIteratorFacade::operator-=\n+DerivedType & operator-=(DifferenceType n)\n+Definition: iteratorfacades.hh:564\n+Dune::RandomAccessIteratorFacade::operator+\n+DerivedType operator+(DifferenceType n) const\n+Definition: iteratorfacades.hh:541\n+Dune::RandomAccessIteratorFacade::operator[]\n+Reference operator[](DifferenceType n) const\n+Get the element n positions from the current one.\n+Definition: iteratorfacades.hh:515\n+Dune::RandomAccessIteratorFacade::DerivedType\n+T DerivedType\n+The type of derived iterator.\n+Definition: iteratorfacades.hh:477\n+Dune::RandomAccessIteratorFacade::Pointer\n+V * Pointer\n+The pointer to the Value.\n+Definition: iteratorfacades.hh:487\n+Dune::RandomAccessIteratorFacade::operator-\n+DerivedType operator-(DifferenceType n) const\n+Definition: iteratorfacades.hh:570\n+Dune::RandomAccessIteratorFacade::operator++\n+DerivedType operator++(int)\n+Postincrement operator.\n+Definition: iteratorfacades.hh:528\n+Dune::RandomAccessIteratorFacade::Value\n+V Value\n+The type of value accessed through the iterator.\n+Definition: iteratorfacades.hh:482\n+Dune::RandomAccessIteratorFacade::operator+=\n+DerivedType & operator+=(DifferenceType n)\n+Definition: iteratorfacades.hh:535\n+Dune::RandomAccessIteratorFacade::Reference\n+R Reference\n+The type of the reference to the values accessed.\n+Definition: iteratorfacades.hh:497\n+Dune::EnableIfInterOperable\n+Enable typedef if two types are interoperable.\n+Definition: typetraits.hh:81\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00014.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00014.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: parameterizedobject.hh File Reference\n+dune-common: typetraits.hh File Reference\n \n \n \n \n \n \n \n@@ -64,37 +64,135 @@\n \n \n \n
\n \n-
parameterizedobject.hh File Reference
\n+Namespaces |\n+Typedefs |\n+Functions
\n+
typetraits.hh File Reference
\n \n
\n-
#include <functional>
\n-#include <map>
\n-#include <memory>
\n-#include <dune/common/exceptions.hh>
\n-#include <dune/common/typeutilities.hh>
\n+\n+

Traits for type conversions and type information. \n+More...

\n+
#include <complex>
\n+#include <type_traits>
\n+#include <utility>
\n+#include <vector>
\n
\n

Go to the source code of this file.

\n \n \n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n

\n Classes

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

\n Namespaces

namespace  Dune
 Dune namespace.
 
\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

\n+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. More...
 
template<class Type >
using Dune::field_t = typename FieldTraits< Type >::field_type
 Convenient access to FieldTraits<Type>::field_type. More...
 
template<class Type >
using Dune::real_t = typename FieldTraits< Type >::real_type
 Convenient access to FieldTraits<Type>::real_type. More...
 
template<class T >
using Dune::AutonomousValue = typename AutonomousValueType< T >::type
 Type free of internal references that T can be converted to. More...
 
\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

\n+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. More...
 
template<class T >
constexpr AutonomousValue< T > Dune::autoCopy (T &&v)
 Autonomous copy of an expression's value for use in auto type deduction. More...
 
\n-
\n+

Detailed Description

\n+

Traits for type conversions and type information.

\n+
Author
Markus Blatt, Christian Engwer
\n+
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,25 +4,123 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces\n-parameterizedobject.hh File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n+Classes | Namespaces | Typedefs | Functions\n+typetraits.hh File Reference\n+Traits for type conversions and type information. More...\n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>\n+struct \u00a0Dune::Empty\n+\u00a0 Just an empty class. More...\n+\u00a0\n+struct \u00a0Dune::IsInteroperable<_T1,_T2_>\n+\u00a0 Checks whether two types are interoperable. More...\n+\u00a0\n+struct \u00a0Dune::EnableIfInterOperable<_T1,_T2,_Type_>\n+\u00a0 Enable typedef if two types are interoperable. More...\n+\u00a0\n+struct \u00a0Dune::AlwaysFalse<_T_>\n+\u00a0 template which always yields a false value More...\n+\u00a0\n+struct \u00a0Dune::AlwaysTrue<_T_>\n+\u00a0 template which always yields a true value More...\n+\u00a0\n+struct \u00a0Dune::IsCallable<_F(Args...),_R_>\n+\u00a0 Check if a type is callable with ()-operator and given arguments.\n+ More...\n+\u00a0\n+struct \u00a0Dune::IsNumber<_T_>\n+\u00a0 Whether this type acts as a scalar in the context of (hierarchically\n+ blocked) containers. More...\n+\u00a0\n+struct \u00a0Dune::HasNaN<_T_>\n+\u00a0 Whether this type has a value of NaN. More...\n+\u00a0\n+struct \u00a0Dune::IsIndexable<_T,_I_>\n+\u00a0 Type trait to determine whether an instance of T has an operator[](I),\n+ i.e. whether it can be indexed with an index of type I. More...\n+\u00a0\n+struct \u00a0Dune::IsIterable<_T,_typename_>\n+\u00a0 typetrait to check that a class has begin() and end() members More...\n+\u00a0\n+struct \u00a0Dune::IsTuple<_T_>\n+\u00a0 Check if T is a std::tuple<...> More...\n+\u00a0\n+struct \u00a0Dune::IsTupleOrDerived<_T_>\n+\u00a0 Check if T derived from a std::tuple<...> More...\n+\u00a0\n+struct \u00a0Dune::IsIntegralConstant<_T_>\n+\u00a0 Check if T is an std::integral_constant More...\n+\u00a0\n+struct \u00a0Dune::SizeOf<_T_>\n+\u00a0 Compute size of variadic type list. More...\n+\u00a0\n+struct \u00a0Dune::AutonomousValueType<_T_>\n+\u00a0 Type free of internal references that T can be converted to. More...\n+\u00a0\n+struct \u00a0Dune::AutonomousValueType<_T_&_>\n+\u00a0 Specialization to remove lvalue references. More...\n+\u00a0\n+struct \u00a0Dune::AutonomousValueType<_T_&&_>\n+\u00a0 Specialization to remove rvalue references. More...\n+\u00a0\n+struct \u00a0Dune::AutonomousValueType<_const_T_>\n+\u00a0 Specialization to remove const qualifiers. More...\n+\u00a0\n+struct \u00a0Dune::AutonomousValueType<_volatile_T_>\n+\u00a0 Specialization to remove volatile qualifiers. More...\n+\u00a0\n+struct \u00a0Dune::AutonomousValueType<_std::vector<_bool_>::reference_>\n+\u00a0 Specialization for the proxies of vector More...\n+\u00a0\n+struct \u00a0Dune::AutonomousValueType<_volatile_const_T_>\n+\u00a0 Specialization to remove both const and volatile qualifiers. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+ Typedefs\n+template\n+using\u00a0Dune::void_t = typename Impl::voider< Types... >::type\n+\u00a0 Is void for all valid input types. The workhorse for C++11 SFINAE-\n+ techniques. More...\n+\u00a0\n+template\n+using\u00a0Dune::field_t = typename FieldTraits< Type >::field_type\n+\u00a0 Convenient access to FieldTraits::field_type. More...\n+\u00a0\n+template\n+using\u00a0Dune::real_t = typename FieldTraits< Type >::real_type\n+\u00a0 Convenient access to FieldTraits::real_type. More...\n+\u00a0\n+template\n+using\u00a0Dune::AutonomousValue = typename AutonomousValueType< T >::type\n+\u00a0 Type free of internal references that T can be converted to. More...\n+\u00a0\n+ Functions\n+template\n+ constexpr auto\u00a0Dune::integerSequenceEntry (std::\n+ integer_sequence< T, t... >, std::\n+ integral_constant< std::size_t, index > i)\n+\u00a0 Get entry of std::integer_sequence. More...\n+\u00a0\n+template\n+constexpr AutonomousValue< T >\u00a0Dune::autoCopy (T &&v)\n+\u00a0 Autonomous copy of an expression's value for\n+ use in auto type deduction. More...\n+\u00a0\n+***** Detailed Description *****\n+Traits for type conversions and type information.\n+ Author\n+ Markus Blatt, Christian Engwer\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00014_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: parameterizedobject.hh Source File\n+dune-common: typetraits.hh Source File\n \n \n \n \n \n \n \n@@ -62,163 +62,383 @@\n \n
\n \n
\n \n
\n-
parameterizedobject.hh
\n+
typetraits.hh
\n
\n
\n-Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
\n-
2// vi: set et ts=4 sw=4 sts=4:
\n+Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
\n+
2// vi: set et ts=4 sw=2 sts=2:
\n
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
\n
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
\n-
5#ifndef DUNE_COMMON_PARAMETERIZEDOBJECT_HH
\n-
6#define DUNE_COMMON_PARAMETERIZEDOBJECT_HH
\n+
5#ifndef DUNE_TYPETRAITS_HH
\n+
6#define DUNE_TYPETRAITS_HH
\n
7
\n-
8#include <functional>
\n-
9#include <map>
\n-
10#include <memory>
\n-
11
\n-\n-\n-
14
\n-
15namespace Dune {
\n-
16
\n-
34template<typename Signature,
\n-
35 typename KeyT = std::string>
\n-\n-
37
\n-
38template<typename TypeT,
\n-
39 typename KeyT,
\n-
40 typename... Args>
\n-
41class ParameterizedObjectFactory<TypeT(Args...), KeyT>
\n-
42{
\n-
43 public:
\n-
44
\n-
46 typedef KeyT Key;
\n-
47
\n-
49 using Type = TypeT;
\n-
50
\n-
51 protected:
\n-
52
\n-
53 using Creator = std::function<Type(Args...)>;
\n-
54
\n-
55 template<class F>
\n-\n-
57 -> decltype( std::declval<F>()(std::declval<Args>()...), std::true_type())
\n-
58 {
\n-
59 return {};
\n-
60 }
\n-
61
\n-
62 template<class F>
\n-
63 static constexpr std::false_type has_proper_signature(Dune::PriorityTag<0>)
\n-
64 {
\n-
65 return {};
\n-
66 }
\n-
67
\n-
68 public:
\n-
69
\n-
77 Type create(Key const& key, Args ... args) const {
\n-
78 typename Registry::const_iterator i = registry_.find(key);
\n-
79 if (i == registry_.end()) {
\n-\n-
81 "ParametrizedObjectFactory: key ``" <<
\n-
82 key << "'' not registered");
\n-
83 }
\n-
84 else return i->second(args...);
\n-
85 }
\n-
86
\n-
100 template<class Impl>
\n-
101 void define(Key const& key)
\n-
102 {
\n-
103 registry_[key] = DefaultCreator<Impl>();
\n-
104 }
\n-
105
\n-
119 template<class F,
\n-
120 typename std::enable_if<has_proper_signature<F>(PriorityTag<42>()), int>::type = 0>
\n-
121 void define(Key const& key, F&& f)
\n-
122 {
\n-
123 registry_[key] = f;
\n-
124 }
\n+
8#include <complex>
\n+
9#include <type_traits>
\n+
10#include <utility>
\n+
11#include <vector>
\n+
12
\n+
13namespace Dune
\n+
14{
\n+
15
\n+
16 namespace Impl
\n+
17 {
\n+
19
\n+
23 template <class...>
\n+
24 struct voider
\n+
25 {
\n+
26 using type = void;
\n+
27 };
\n+
28 }
\n+
29
\n+
31
\n+
39 template <class... Types>
\n+
40 using void_t = typename Impl::voider<Types...>::type;
\n+
41
\n+
55 struct Empty {};
\n+
56
\n+
63 template<class T1, class T2>
\n+\n+
65 {
\n+
70 constexpr static bool value = std::is_convertible<T1,T2>::value || std::is_convertible<T2,T1>::value;
\n+
71 };
\n+
72
\n+
78 template<class T1, class T2, class Type>
\n+\n+
80 : public std::enable_if<IsInteroperable<T1,T2>::value, Type>
\n+
81 {};
\n+
82
\n+
100
\n+
116
\n+
123 template<typename T>
\n+
124 struct AlwaysFalse : public std::false_type {};
\n
125
\n-
140 template<class Impl,
\n-
141 typename std::enable_if<
\n-
142 std::is_convertible<Impl, Type>::value
\n-
143 and not std::is_convertible<Impl, Creator>::value,
\n-
144 int>::type = 0>
\n-
145 void define(Key const& key, Impl&& t)
\n-
146 {
\n-
147 registry_[key] = [=](Args...) { return t;};
\n-
148 }
\n-
149
\n-
150 bool contains(Key const& key) const
\n-
151 {
\n-
152 return registry_.count(key);
\n-
153 }
\n-
154
\n-
155 private:
\n-
156
\n-
157 template<class T>
\n-
158 struct Tag{};
\n-
159
\n-
160 template<class Impl>
\n-
161 struct DefaultCreator
\n-
162 {
\n-
163 template<class... T>
\n-
164 Type operator()(T&&... args) const
\n-
165 {
\n-
166 return DefaultCreator::create(Tag<Type>(), PriorityTag<42>(), std::forward<T>(args)...);
\n-
167 }
\n-
168
\n-
169 template<class Target, class... T>
\n-
170 static Type create(Tag<Target>, PriorityTag<1>, T&& ... args) {
\n-
171 return Impl(std::forward<T>(args)...);
\n-
172 }
\n-
173
\n-
174 template<class Target, class... T>
\n-
175 static Type create(Tag<std::unique_ptr<Target>>, PriorityTag<2>, T&& ... args) {
\n-
176 return std::make_unique<Impl>(std::forward<T>(args)...);
\n-
177 }
\n-
178
\n-
179 template<class Target, class... T>
\n-
180 static Type create(Tag<std::shared_ptr<Target>>, PriorityTag<3>, T&& ... args) {
\n-
181 return std::make_shared<Impl>(std::forward<T>(args)...);
\n-
182 }
\n-
183
\n-
184 };
\n-
185
\n-
186 typedef std::map<Key, Creator> Registry;
\n-
187 Registry registry_;
\n-
188};
\n-
189
\n-
190
\n-
191
\n-
192} // end namespace Dune
\n-
193
\n-
194#endif // DUNE_COMMON_PARAMETERIZEDOBJECT_HH
\n-
A few common exception classes.
\n-
Utilities for type computations, constraining overloads, ...
\n-
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
\n+
133 template<typename T>
\n+
134 struct AlwaysTrue : public std::true_type {};
\n+
135
\n+
161 template<typename D, typename R = void>
\n+\n+
163
\n+
168 template<typename R, typename F, typename... Args>
\n+
169 struct IsCallable<F(Args...), R>
\n+
170 : public std::bool_constant<
\n+
171 std::is_invocable_r_v<R, F, Args...>
\n+
172 && !std::is_member_pointer_v<std::decay_t<F>>
\n+
173 > {};
\n+
174
\n+
177
\n+
192 template <typename T>
\n+
193 struct IsNumber
\n+
194 : public std::integral_constant<bool, std::is_arithmetic<T>::value> {
\n+
195 };
\n+
196
\n+
197#ifndef DOXYGEN
\n+
198
\n+
199 template <typename T>
\n+
200 struct IsNumber<std::complex<T>>
\n+
201 : public std::integral_constant<bool, IsNumber<T>::value> {
\n+
202 };
\n+
203
\n+
204#endif // DOXYGEN
\n+
205
\n+
207
\n+
210 template <typename T>
\n+
211 struct HasNaN
\n+
212 : public std::integral_constant<bool, std::is_floating_point<T>::value> {
\n+
213 };
\n+
214
\n+
215#ifndef DOXYGEN
\n+
216
\n+
217 template <typename T>
\n+
218 struct HasNaN<std::complex<T>>
\n+
219 : public std::integral_constant<bool, std::is_floating_point<T>::value> {
\n+
220 };
\n+
221
\n+
222#endif // DOXYGEN
\n+
223
\n+
224#ifndef DOXYGEN
\n+
225
\n+
226 namespace Impl {
\n+
227
\n+
228 template<typename T, typename I, typename = int>
\n+
229 struct IsIndexable
\n+
230 : public std::false_type
\n+
231 {};
\n+
232
\n+
233 template<typename T, typename I>
\n+
234 struct IsIndexable<T,I,typename std::enable_if<(sizeof(std::declval<T>()[std::declval<I>()]) > 0),int>::type>
\n+
235 : public std::true_type
\n+
236 {};
\n+
237
\n+
238 }
\n+
239
\n+
240#endif // DOXYGEN
\n+
241
\n+
243
\n+
247 template<typename T, typename I = std::size_t>
\n+\n+
249 : public Impl::IsIndexable<T,I>
\n+
250 {};
\n+
251
\n+
252#ifndef DOXYGEN
\n+
253
\n+
254 namespace Impl {
\n+
255 // This function does nothing.
\n+
256 // By passing expressions to this function one can avoid
\n+
257 // "value computed is not used" warnings that may show up
\n+
258 // in a comma expression.
\n+
259 template<class...T>
\n+
260 void ignore(T&&... /*t*/)
\n+
261 {}
\n+
262 }
\n+
263
\n+
264#endif // DOXYGEN
\n+
265
\n+
269 // default version, gets picked if SFINAE fails
\n+
270 template<typename T, typename = void>
\n+\n+
272 : public std::false_type
\n+
273 {};
\n+
274
\n+
275#ifndef DOXYGEN
\n+
276 // version for types with begin() and end()
\n+
277 template<typename T>
\n+
278 struct IsIterable<T, decltype(Impl::ignore(
\n+
279 std::declval<T>().begin(),
\n+
280 std::declval<T>().end(),
\n+
281 std::declval<T>().begin() != std::declval<T>().end(),
\n+
282 decltype(std::declval<T>().begin()){std::declval<T>().end()},
\n+
283 ++(std::declval<std::add_lvalue_reference_t<decltype(std::declval<T>().begin())>>()),
\n+
284 *(std::declval<T>().begin())
\n+
285 ))>
\n+
286 : public std::true_type
\n+
287 {};
\n+
288#endif
\n+
289
\n+
290#ifndef DOXYGEN
\n+
291 // this is just a forward declaration
\n+
292 template <class> struct FieldTraits;
\n+
293#endif
\n+
294
\n+
296 template <class Type>
\n+\n+
298
\n+
300 template <class Type>
\n+\n+
302
\n+
303
\n+
304#ifndef DOXYGEN
\n+
305
\n+
306 // Implementation of IsTuple
\n+
307 namespace Impl {
\n+
308
\n+
309 template<class T>
\n+
310 struct IsTuple : public std::false_type
\n+
311 {};
\n+
312
\n+
313 template<class... T>
\n+
314 struct IsTuple<std::tuple<T...>> : public std::true_type
\n+
315 {};
\n+
316
\n+
317 } // namespace Impl
\n+
318
\n+
319#endif // DOXYGEN
\n+
320
\n+
326 template<class T>
\n+
327 struct IsTuple :
\n+
328 public Impl::IsTuple<T>
\n+
329 {};
\n+
330
\n+
331
\n+
332#ifndef DOXYGEN
\n+
333
\n+
334 // Implementation of IsTupleOrDerived
\n+
335 namespace Impl {
\n+
336
\n+
337 template<class... T, class Dummy>
\n+
338 std::true_type isTupleOrDerived(const std::tuple<T...>*, Dummy)
\n+
339 { return {}; }
\n+
340
\n+
341 template<class Dummy>
\n+
342 std::false_type isTupleOrDerived(const void*, Dummy)
\n+
343 { return {}; }
\n+
344
\n+
345 } // namespace Impl
\n+
346
\n+
347#endif // DOXYGEN
\n+
348
\n+
354 template<class T>
\n+\n+
356 public decltype(Impl::isTupleOrDerived(std::declval<T*>(), true))
\n+
357 {};
\n+
358
\n+
359
\n+
360#ifndef DOXYGEN
\n+
361
\n+
362 // Implementation of is IsIntegralConstant
\n+
363 namespace Impl {
\n+
364
\n+
365 template<class T>
\n+
366 struct IsIntegralConstant : public std::false_type
\n+
367 {};
\n+
368
\n+
369 template<class T, T t>
\n+
370 struct IsIntegralConstant<std::integral_constant<T, t>> : public std::true_type
\n+
371 {};
\n+
372
\n+
373 } // namespace Impl
\n+
374
\n+
375#endif // DOXYGEN
\n+
376
\n+
382 template<class T>
\n+
383 struct IsIntegralConstant : public Impl::IsIntegralConstant<std::decay_t<T>>
\n+
384 {};
\n+
385
\n+
386
\n+
387
\n+
401 template<typename... T>
\n+
402 struct SizeOf
\n+
403 : public std::integral_constant<std::size_t,sizeof...(T)>
\n+
404 {};
\n+
405
\n+
406
\n+
407#ifndef DOXYGEN
\n+
408
\n+
409 namespace Impl {
\n+
410
\n+
411 template<class T, T...>
\n+
412 struct IntegerSequenceHelper;
\n+
413
\n+
414 // Helper struct to compute the i-th entry of a std::integer_sequence
\n+
415 //
\n+
416 // This could also be implemented using std::get<index>(std::make_tuple(t...)).
\n+
417 // However, the gcc-6 implementation of std::make_tuple increases the instantiation
\n+
418 // depth by 15 levels for each argument, such that the maximal instantiation depth
\n+
419 // is easily hit, especially with clang where it is set to 256.
\n+
420 template<class T, T head, T... tail>
\n+
421 struct IntegerSequenceHelper<T, head, tail...>
\n+
422 {
\n+
423
\n+
424 // get first entry
\n+
425 static constexpr auto get(std::integral_constant<std::size_t, 0>)
\n+
426 {
\n+
427 return std::integral_constant<T, head>();
\n+
428 }
\n+
429
\n+
430 // call get with first entry cut off and decremented index
\n+
431 template<std::size_t index,
\n+
432 std::enable_if_t<(index > 0) and (index < sizeof...(tail)+1), int> = 0>
\n+
433 static constexpr auto get(std::integral_constant<std::size_t, index>)
\n+
434 {
\n+
435 return IntegerSequenceHelper<T, tail...>::get(std::integral_constant<std::size_t, index-1>());
\n+
436 }
\n+
437
\n+
438 // use static assertion if index exceeds size
\n+
439 template<std::size_t index,
\n+
440 std::enable_if_t<(index >= sizeof...(tail)+1), int> = 0>
\n+
441 static constexpr auto get(std::integral_constant<std::size_t, index>)
\n+
442 {
\n+
443 static_assert(index < sizeof...(tail)+1, "index used in IntegerSequenceEntry exceed size");
\n+
444 }
\n+
445 };
\n+
446
\n+
447 } // end namespace Impl
\n+
448
\n+
449#endif // DOXYGEN
\n+
450
\n+
451
\n+
461 template<class T, T... t, std::size_t index>
\n+
462 constexpr auto integerSequenceEntry(std::integer_sequence<T, t...> /*seq*/, std::integral_constant<std::size_t, index> i)
\n+
463 {
\n+
464 static_assert(index < sizeof...(t), "index used in IntegerSequenceEntry exceed size");
\n+\n+
466 }
\n+
467
\n+
468
\n+
475 template<class IntegerSequence, std::size_t index>
\n+\n+
477
\n+
478#ifndef DOXYGEN
\n+
479
\n+
480 template<class T, T... t, std::size_t i>
\n+
481 struct IntegerSequenceEntry<std::integer_sequence<T, t...>, i>
\n+
482 : public decltype(Impl::IntegerSequenceHelper<T, t...>::get(std::integral_constant<std::size_t, i>()))
\n+
483 {};
\n+
484
\n+
485#endif // DOXYGEN
\n+
486
\n+
500 template<class T>
\n+
501 struct AutonomousValueType { using type = T; };
\n+
502
\n+
504 template<class T>
\n+\n+
506
\n+
508 template<class T>
\n+\n+
510
\n+
512 template<class T>
\n+\n+
514
\n+
516 template<class T>
\n+
517 struct AutonomousValueType<volatile T> : AutonomousValueType<T> {};
\n+
518
\n+
520 template<>
\n+
521 struct AutonomousValueType<std::vector<bool>::reference>
\n+
522 {
\n+
523 using type = bool;
\n+
524 };
\n+
525
\n+
527 template<class T>
\n+
528 struct AutonomousValueType<volatile const T> : AutonomousValueType<T> {};
\n+
529
\n+
557 template<class T>
\n+\n+
559
\n+
641 template<class T>
\n+\n+
643 {
\n+
644 return v;
\n+
645 }
\n+
646
\n+
648}
\n+
649#endif
\n+
constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::integral_constant< std::size_t, index > i)
Get entry of std::integer_sequence.
Definition: typetraits.hh:462
\n+
typename FieldTraits< Type >::real_type real_t
Convenient access to FieldTraits<Type>::real_type.
Definition: typetraits.hh:301
\n+
constexpr AutonomousValue< T > autoCopy(T &&v)
Autonomous copy of an expression's value for use in auto type deduction.
Definition: typetraits.hh:642
\n+
typename AutonomousValueType< T >::type AutonomousValue
Type free of internal references that T can be converted to.
Definition: typetraits.hh:558
\n+
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
\n+
typename FieldTraits< Type >::field_type field_t
Convenient access to FieldTraits<Type>::field_type.
Definition: typetraits.hh:297
\n+
STL namespace.
\n
Dune namespace.
Definition: alignedallocator.hh:13
\n-
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:281
\n-
A factory class for parameterized objects.
Definition: parameterizedobject.hh:36
\n-
std::function< Type(Args...)> Creator
Definition: parameterizedobject.hh:53
\n-
static constexpr auto has_proper_signature(Dune::PriorityTag< 1 >) -> decltype(std::declval< F >()(std::declval< Args >()...), std::true_type())
Definition: parameterizedobject.hh:56
\n-
TypeT Type
The type of objects created by the factory.
Definition: parameterizedobject.hh:49
\n-
void define(Key const &key, Impl &&t)
Registers a new type with a key.
Definition: parameterizedobject.hh:145
\n-
KeyT Key
The typ of the keys.
Definition: parameterizedobject.hh:46
\n-
Type create(Key const &key, Args ... args) const
Creates an object identified by a key from given parameters.
Definition: parameterizedobject.hh:77
\n-
void define(Key const &key)
Registers a new type with a key.
Definition: parameterizedobject.hh:101
\n-
void define(Key const &key, F &&f)
Registers a new creator with a key.
Definition: parameterizedobject.hh:121
\n-
static constexpr std::false_type has_proper_signature(Dune::PriorityTag< 0 >)
Definition: parameterizedobject.hh:63
\n-
bool contains(Key const &key) const
Definition: parameterizedobject.hh:150
\n-
Helper class for tagging priorities.
Definition: typeutilities.hh:73
\n-
Helper class for tagging priorities.
Definition: typeutilities.hh:87
\n+
Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
Definition: propertymap.hh:84
\n+
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition: typetraits.hh:194
\n+
T field_type
export the type representing the field
Definition: ftraits.hh:28
\n+
T real_type
export the type representing the real type of the field
Definition: ftraits.hh:30
\n+
Just an empty class.
Definition: typetraits.hh:55
\n+
Checks whether two types are interoperable.
Definition: typetraits.hh:65
\n+
static constexpr bool value
True if either a conversion from T1 to T2 or vice versa exists.
Definition: typetraits.hh:70
\n+
Enable typedef if two types are interoperable.
Definition: typetraits.hh:81
\n+
template which always yields a false value
Definition: typetraits.hh:124
\n+
template which always yields a true value
Definition: typetraits.hh:134
\n+
Check if a type is callable with ()-operator and given arguments.
Definition: typetraits.hh:162
\n+
Whether this type has a value of NaN.
Definition: typetraits.hh:212
\n+
Type trait to determine whether an instance of T has an operator[](I), i.e. whether it can be indexed...
Definition: typetraits.hh:250
\n+
typetrait to check that a class has begin() and end() members
Definition: typetraits.hh:273
\n+
Check if T is a std::tuple<...>
Definition: typetraits.hh:329
\n+
Check if T derived from a std::tuple<...>
Definition: typetraits.hh:357
\n+
Check if T is an std::integral_constant<I, i>
Definition: typetraits.hh:384
\n+
Compute size of variadic type list.
Definition: typetraits.hh:404
\n+
Get entry of std::integer_sequence.
Definition: typetraits.hh:476
\n+
Type free of internal references that T can be converted to.
Definition: typetraits.hh:501
\n+
T type
Definition: typetraits.hh:501
\n+\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,205 +4,464 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-parameterizedobject.hh\n+typetraits.hh\n Go_to_the_documentation_of_this_file.\n- 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-\n- 2// vi: set et ts=4 sw=4 sts=4:\n+ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n+ 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_PARAMETERIZEDOBJECT_HH\n- 6#define DUNE_COMMON_PARAMETERIZEDOBJECT_HH\n+ 5#ifndef DUNE_TYPETRAITS_HH\n+ 6#define DUNE_TYPETRAITS_HH\n 7\n- 8#include \n- 9#include \n- 10#include \n- 11\n- 12#include \n- 13#include \n- 14\n- 15namespace Dune {\n- 16\n- 34template\n-36class ParameterizedObjectFactory;\n- 37\n- 38template\n-41class ParameterizedObjectFactory\n- 42{\n- 43 public:\n- 44\n-46 typedef KeyT Key;\n- 47\n-49 using Type = TypeT;\n- 50\n- 51 protected:\n- 52\n-53 using Creator = std::function;\n- 54\n- 55 template\n-56 static constexpr auto has_proper_signature(Dune::PriorityTag<1>)\n- 57 -> decltype( std::declval()(std::declval()...), std::true_type())\n- 58 {\n- 59 return {};\n- 60 }\n- 61\n- 62 template\n-63 static constexpr std::false_type has_proper_signature(Dune::PriorityTag<0>)\n- 64 {\n- 65 return {};\n- 66 }\n- 67\n- 68 public:\n- 69\n-77 Type create(Key const& key, Args ... args) const {\n- 78 typename Registry::const_iterator i = registry_.find(key);\n- 79 if (i == registry_.end()) {\n- 80 DUNE_THROW(Dune::InvalidStateException,\n- 81 \"ParametrizedObjectFactory: key ``\" <<\n- 82 key << \"'' not registered\");\n- 83 }\n- 84 else return i->second(args...);\n- 85 }\n- 86\n- 100 template\n-101 void define(Key const& key)\n- 102 {\n- 103 registry_[key] = DefaultCreator();\n- 104 }\n- 105\n- 119 template(PriorityTag<42>()), int>::\n-type = 0>\n-121 void define(Key const& key, F&& f)\n- 122 {\n- 123 registry_[key] = f;\n- 124 }\n+ 8#include \n+ 9#include \n+ 10#include \n+ 11#include \n+ 12\n+ 13namespace Dune\n+ 14{\n+ 15\n+ 16 namespace Impl\n+ 17 {\n+ 19\n+ 23 template \n+ 24 struct voider\n+ 25 {\n+ 26 using type = void;\n+ 27 };\n+ 28 }\n+ 29\n+ 31\n+ 39 template \n+40 using void_t = typename Impl::voider::type;\n+ 41\n+55 struct Empty {};\n+ 56\n+ 63 template\n+64 struct IsInteroperable\n+ 65 {\n+70 constexpr static bool value = std::is_convertible::value || std::\n+is_convertible::value;\n+ 71 };\n+ 72\n+ 78 template\n+79 struct EnableIfInterOperable\n+ 80 : public std::enable_if::value, Type>\n+ 81 {};\n+ 82\n+ 100\n+ 116\n+ 123 template\n+124 struct AlwaysFalse : public std::false_type {};\n 125\n- 140 template::value\n- 143 and not std::is_convertible::value,\n- 144 int>::type = 0>\n-145 void define(Key const& key, Impl&& t)\n- 146 {\n- 147 registry_[key] = [=](Args...) { return t;};\n- 148 }\n- 149\n-150 bool contains(Key const& key) const\n- 151 {\n- 152 return registry_.count(key);\n- 153 }\n- 154\n- 155 private:\n- 156\n- 157 template\n- 158 struct Tag{};\n- 159\n- 160 template\n- 161 struct DefaultCreator\n- 162 {\n- 163 template\n- 164 Type operator()(T&&... args) const\n- 165 {\n- 166 return DefaultCreator::create(Tag(), PriorityTag<42>(), std::\n-forward(args)...);\n- 167 }\n- 168\n- 169 template\n- 170 static Type create(Tag, PriorityTag<1>, T&& ... args) {\n- 171 return Impl(std::forward(args)...);\n- 172 }\n- 173\n- 174 template\n- 175 static Type create(Tag>, PriorityTag<2>, T&& ...\n-args) {\n- 176 return std::make_unique(std::forward(args)...);\n- 177 }\n- 178\n- 179 template\n- 180 static Type create(Tag>, PriorityTag<3>, T&& ...\n-args) {\n- 181 return std::make_shared(std::forward(args)...);\n- 182 }\n- 183\n- 184 };\n- 185\n- 186 typedef std::map Registry;\n- 187 Registry registry_;\n- 188};\n- 189\n- 190\n- 191\n- 192} // end namespace Dune\n- 193\n- 194#endif // DUNE_COMMON_PARAMETERIZEDOBJECT_HH\n-exceptions.hh\n-A few common exception classes.\n-typeutilities.hh\n-Utilities for type computations, constraining overloads, ...\n-DUNE_THROW\n-#define DUNE_THROW(E, m)\n-Definition: exceptions.hh:218\n+ 133 template\n+134 struct AlwaysTrue : public std::true_type {};\n+ 135\n+ 161 template\n+162 struct IsCallable;\n+ 163\n+ 168 template\n+169 struct IsCallable\n+ 170 : public std::bool_constant<\n+ 171 std::is_invocable_r_v\n+ 172 && !std::is_member_pointer_v>\n+ 173 > {};\n+ 174\n+ 177\n+ 192 template \n+193 struct IsNumber\n+ 194 : public std::integral_constant::value> {\n+ 195 };\n+ 196\n+ 197#ifndef DOXYGEN\n+ 198\n+ 199 template \n+ 200 struct IsNumber>\n+ 201 : public std::integral_constant::value> {\n+ 202 };\n+ 203\n+ 204#endif // DOXYGEN\n+ 205\n+ 207\n+ 210 template \n+211 struct HasNaN\n+ 212 : public std::integral_constant::value> {\n+ 213 };\n+ 214\n+ 215#ifndef DOXYGEN\n+ 216\n+ 217 template \n+ 218 struct HasNaN>\n+ 219 : public std::integral_constant::value> {\n+ 220 };\n+ 221\n+ 222#endif // DOXYGEN\n+ 223\n+ 224#ifndef DOXYGEN\n+ 225\n+ 226 namespace Impl {\n+ 227\n+ 228 template\n+ 229 struct IsIndexable\n+ 230 : public std::false_type\n+ 231 {};\n+ 232\n+ 233 template\n+ 234 struct IsIndexable()\n+[std::declval()]) > 0),int>::type>\n+ 235 : public std::true_type\n+ 236 {};\n+ 237\n+ 238 }\n+ 239\n+ 240#endif // DOXYGEN\n+ 241\n+ 243\n+ 247 template\n+248 struct IsIndexable\n+ 249 : public Impl::IsIndexable\n+ 250 {};\n+ 251\n+ 252#ifndef DOXYGEN\n+ 253\n+ 254 namespace Impl {\n+ 255 // This function does nothing.\n+ 256 // By passing expressions to this function one can avoid\n+ 257 // \"value computed is not used\" warnings that may show up\n+ 258 // in a comma expression.\n+ 259 template\n+ 260 void ignore(T&&... /*t*/)\n+ 261 {}\n+ 262 }\n+ 263\n+ 264#endif // DOXYGEN\n+ 265\n+ 269 // default version, gets picked if SFINAE fails\n+ 270 template\n+271 struct IsIterable\n+ 272 : public std::false_type\n+ 273 {};\n+ 274\n+ 275#ifndef DOXYGEN\n+ 276 // version for types with begin() and end()\n+ 277 template\n+ 278 struct IsIterable().begin(),\n+ 280 std::declval().end(),\n+ 281 std::declval().begin() != std::declval().end(),\n+ 282 decltype(std::declval().begin()){std::declval().end()},\n+ 283 ++(std::declval\n+().begin())>>()),\n+ 284 *(std::declval().begin())\n+ 285 ))>\n+ 286 : public std::true_type\n+ 287 {};\n+ 288#endif\n+ 289\n+ 290#ifndef DOXYGEN\n+ 291 // this is just a forward declaration\n+ 292 template struct FieldTraits;\n+ 293#endif\n+ 294\n+ 296 template \n+297 using field_t = typename FieldTraits::field_type;\n+ 298\n+ 300 template \n+301 using real_t = typename FieldTraits::real_type;\n+ 302\n+ 303\n+ 304#ifndef DOXYGEN\n+ 305\n+ 306 // Implementation of IsTuple\n+ 307 namespace Impl {\n+ 308\n+ 309 template\n+ 310 struct IsTuple : public std::false_type\n+ 311 {};\n+ 312\n+ 313 template\n+ 314 struct IsTuple> : public std::true_type\n+ 315 {};\n+ 316\n+ 317 } // namespace Impl\n+ 318\n+ 319#endif // DOXYGEN\n+ 320\n+ 326 template\n+327 struct IsTuple :\n+ 328 public Impl::IsTuple\n+ 329 {};\n+ 330\n+ 331\n+ 332#ifndef DOXYGEN\n+ 333\n+ 334 // Implementation of IsTupleOrDerived\n+ 335 namespace Impl {\n+ 336\n+ 337 template\n+ 338 std::true_type isTupleOrDerived(const std::tuple*, Dummy)\n+ 339 { return {}; }\n+ 340\n+ 341 template\n+ 342 std::false_type isTupleOrDerived(const void*, Dummy)\n+ 343 { return {}; }\n+ 344\n+ 345 } // namespace Impl\n+ 346\n+ 347#endif // DOXYGEN\n+ 348\n+ 354 template\n+355 struct IsTupleOrDerived :\n+ 356 public decltype(Impl::isTupleOrDerived(std::declval(), true))\n+ 357 {};\n+ 358\n+ 359\n+ 360#ifndef DOXYGEN\n+ 361\n+ 362 // Implementation of is IsIntegralConstant\n+ 363 namespace Impl {\n+ 364\n+ 365 template\n+ 366 struct IsIntegralConstant : public std::false_type\n+ 367 {};\n+ 368\n+ 369 template\n+ 370 struct IsIntegralConstant> : public std::\n+true_type\n+ 371 {};\n+ 372\n+ 373 } // namespace Impl\n+ 374\n+ 375#endif // DOXYGEN\n+ 376\n+ 382 template\n+383 struct IsIntegralConstant : public Impl::IsIntegralConstant>\n+ 384 {};\n+ 385\n+ 386\n+ 387\n+ 401 template\n+402 struct SizeOf\n+ 403 : public std::integral_constant\n+ 404 {};\n+ 405\n+ 406\n+ 407#ifndef DOXYGEN\n+ 408\n+ 409 namespace Impl {\n+ 410\n+ 411 template\n+ 412 struct IntegerSequenceHelper;\n+ 413\n+ 414 // Helper struct to compute the i-th entry of a std::integer_sequence\n+ 415 //\n+ 416 // This could also be implemented using std::get(std::make_tuple\n+(t...)).\n+ 417 // However, the gcc-6 implementation of std::make_tuple increases the\n+instantiation\n+ 418 // depth by 15 levels for each argument, such that the maximal\n+instantiation depth\n+ 419 // is easily hit, especially with clang where it is set to 256.\n+ 420 template\n+ 421 struct IntegerSequenceHelper\n+ 422 {\n+ 423\n+ 424 // get first entry\n+ 425 static constexpr auto get(std::integral_constant)\n+ 426 {\n+ 427 return std::integral_constant();\n+ 428 }\n+ 429\n+ 430 // call get with first entry cut off and decremented index\n+ 431 template 0) and (index < sizeof...(tail)+1), int> = 0>\n+ 433 static constexpr auto get(std::integral_constant)\n+ 434 {\n+ 435 return IntegerSequenceHelper::get(std::integral_constant());\n+ 436 }\n+ 437\n+ 438 // use static assertion if index exceeds size\n+ 439 template= sizeof...(tail)+1), int> = 0>\n+ 441 static constexpr auto get(std::integral_constant)\n+ 442 {\n+ 443 static_assert(index < sizeof...(tail)+1, \"index used in\n+IntegerSequenceEntry exceed size\");\n+ 444 }\n+ 445 };\n+ 446\n+ 447 } // end namespace Impl\n+ 448\n+ 449#endif // DOXYGEN\n+ 450\n+ 451\n+ 461 template\n+462 constexpr auto integerSequenceEntry(std::integer_sequence /*seq*/,\n+std::integral_constant i)\n+ 463 {\n+ 464 static_assert(index < sizeof...(t), \"index used in IntegerSequenceEntry\n+exceed size\");\n+ 465 return Impl::IntegerSequenceHelper::get(i);\n+ 466 }\n+ 467\n+ 468\n+ 475 template\n+476 struct IntegerSequenceEntry;\n+ 477\n+ 478#ifndef DOXYGEN\n+ 479\n+ 480 template\n+ 481 struct IntegerSequenceEntry, i>\n+ 482 : public decltype(Impl::IntegerSequenceHelper::get(std::\n+integral_constant()))\n+ 483 {};\n+ 484\n+ 485#endif // DOXYGEN\n+ 486\n+ 500 template\n+501 struct AutonomousValueType { using type = T; };\n+ 502\n+ 504 template\n+505 struct AutonomousValueType : AutonomousValueType {};\n+ 506\n+ 508 template\n+509 struct AutonomousValueType : AutonomousValueType {};\n+ 510\n+ 512 template\n+513 struct AutonomousValueType : AutonomousValueType {};\n+ 514\n+ 516 template\n+517 struct AutonomousValueType : AutonomousValueType {};\n+ 518\n+ 520 template<>\n+521 struct AutonomousValueType::reference>\n+ 522 {\n+523 using type = bool;\n+ 524 };\n+ 525\n+ 527 template\n+528 struct AutonomousValueType : AutonomousValueType {};\n+ 529\n+ 557 template\n+558 using AutonomousValue = typename AutonomousValueType::type;\n+ 559\n+ 641 template\n+642 constexpr AutonomousValue autoCopy(T &&v)\n+ 643 {\n+ 644 return v;\n+ 645 }\n+ 646\n+ 648}\n+ 649#endif\n+Dune::integerSequenceEntry\n+constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::\n+integral_constant< std::size_t, index > i)\n+Get entry of std::integer_sequence.\n+Definition: typetraits.hh:462\n+Dune::real_t\n+typename FieldTraits< Type >::real_type real_t\n+Convenient access to FieldTraits::real_type.\n+Definition: typetraits.hh:301\n+Dune::autoCopy\n+constexpr AutonomousValue< T > autoCopy(T &&v)\n+Autonomous copy of an expression's value for use in auto type deduction.\n+Definition: typetraits.hh:642\n+Dune::AutonomousValue\n+typename AutonomousValueType< T >::type AutonomousValue\n+Type free of internal references that T can be converted to.\n+Definition: typetraits.hh:558\n+Dune::void_t\n+typename Impl::voider< Types... >::type void_t\n+Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.\n+Definition: typetraits.hh:40\n+Dune::field_t\n+typename FieldTraits< Type >::field_type field_t\n+Convenient access to FieldTraits::field_type.\n+Definition: typetraits.hh:297\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::InvalidStateException\n-Default exception if a function was called while the object is not in a valid\n-state for that function...\n-Definition: exceptions.hh:281\n-Dune::ParameterizedObjectFactory\n-A factory class for parameterized objects.\n-Definition: parameterizedobject.hh:36\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::Creator\n-std::function< Type(Args...)> Creator\n-Definition: parameterizedobject.hh:53\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::has_proper_signature\n-static constexpr auto has_proper_signature(Dune::PriorityTag< 1 >) -> decltype\n-(std::declval< F >()(std::declval< Args >()...), std::true_type())\n-Definition: parameterizedobject.hh:56\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::Type\n-TypeT Type\n-The type of objects created by the factory.\n-Definition: parameterizedobject.hh:49\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::define\n-void define(Key const &key, Impl &&t)\n-Registers a new type with a key.\n-Definition: parameterizedobject.hh:145\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::Key\n-KeyT Key\n-The typ of the keys.\n-Definition: parameterizedobject.hh:46\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::create\n-Type create(Key const &key, Args ... args) const\n-Creates an object identified by a key from given parameters.\n-Definition: parameterizedobject.hh:77\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::define\n-void define(Key const &key)\n-Registers a new type with a key.\n-Definition: parameterizedobject.hh:101\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::define\n-void define(Key const &key, F &&f)\n-Registers a new creator with a key.\n-Definition: parameterizedobject.hh:121\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::has_proper_signature\n-static constexpr std::false_type has_proper_signature(Dune::PriorityTag< 0 >)\n-Definition: parameterizedobject.hh:63\n-Dune::ParameterizedObjectFactory<_TypeT(Args...),_KeyT_>::contains\n-bool contains(Key const &key) const\n-Definition: parameterizedobject.hh:150\n-Dune::PriorityTag\n-Helper class for tagging priorities.\n-Definition: typeutilities.hh:73\n-Dune::PriorityTag<_0_>\n-Helper class for tagging priorities.\n-Definition: typeutilities.hh:87\n+Dune::get\n+Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const\n+Key &key)\n+Definition: propertymap.hh:84\n+Dune::IsNumber\n+Whether this type acts as a scalar in the context of (hierarchically blocked)\n+containers.\n+Definition: typetraits.hh:194\n+Dune::FieldTraits::field_type\n+T field_type\n+export the type representing the field\n+Definition: ftraits.hh:28\n+Dune::FieldTraits::real_type\n+T real_type\n+export the type representing the real type of the field\n+Definition: ftraits.hh:30\n+Dune::Empty\n+Just an empty class.\n+Definition: typetraits.hh:55\n+Dune::IsInteroperable\n+Checks whether two types are interoperable.\n+Definition: typetraits.hh:65\n+Dune::IsInteroperable::value\n+static constexpr bool value\n+True if either a conversion from T1 to T2 or vice versa exists.\n+Definition: typetraits.hh:70\n+Dune::EnableIfInterOperable\n+Enable typedef if two types are interoperable.\n+Definition: typetraits.hh:81\n+Dune::AlwaysFalse\n+template which always yields a false value\n+Definition: typetraits.hh:124\n+Dune::AlwaysTrue\n+template which always yields a true value\n+Definition: typetraits.hh:134\n+Dune::IsCallable\n+Check if a type is callable with ()-operator and given arguments.\n+Definition: typetraits.hh:162\n+Dune::HasNaN\n+Whether this type has a value of NaN.\n+Definition: typetraits.hh:212\n+Dune::IsIndexable\n+Type trait to determine whether an instance of T has an operator[](I), i.e.\n+whether it can be indexed...\n+Definition: typetraits.hh:250\n+Dune::IsIterable\n+typetrait to check that a class has begin() and end() members\n+Definition: typetraits.hh:273\n+Dune::IsTuple\n+Check if T is a std::tuple<...>\n+Definition: typetraits.hh:329\n+Dune::IsTupleOrDerived\n+Check if T derived from a std::tuple<...>\n+Definition: typetraits.hh:357\n+Dune::IsIntegralConstant\n+Check if T is an std::integral_constant\n+Definition: typetraits.hh:384\n+Dune::SizeOf\n+Compute size of variadic type list.\n+Definition: typetraits.hh:404\n+Dune::IntegerSequenceEntry\n+Get entry of std::integer_sequence.\n+Definition: typetraits.hh:476\n+Dune::AutonomousValueType\n+Type free of internal references that T can be converted to.\n+Definition: typetraits.hh:501\n+Dune::AutonomousValueType::type\n+T type\n+Definition: typetraits.hh:501\n+Dune::AutonomousValueType<_std::vector<_bool_>::reference_>::type\n+bool type\n+Definition: typetraits.hh:523\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00017.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00017.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: singleton.hh File Reference\n+dune-common: proxymemberaccess.hh File Reference\n \n \n \n \n \n \n \n@@ -63,41 +63,42 @@\n
\n \n
\n
\n
\n \n-
singleton.hh File Reference
\n+Namespaces |\n+Functions
\n+
proxymemberaccess.hh File Reference
\n \n
\n \n-

Useful wrapper for creating singletons. \n+

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

\n-
#include <dune/common/visibility.hh>
\n+
#include <type_traits>
\n+#include <utility>
\n
\n

Go to the source code of this file.

\n \n-\n-\n-\n-\n-

\n-Classes

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

\n Namespaces

namespace  Dune
 Dune namespace.
 
\n+\n+\n+\n+\n+\n

\n+Functions

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

Detailed Description

\n-

Useful wrapper for creating singletons.

\n-

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

\n+

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

\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,26 +4,30 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces\n-singleton.hh File Reference\n-Useful wrapper for creating singletons. More...\n-#include \n+Namespaces | Functions\n+proxymemberaccess.hh File Reference\n+Common \u00bb Utilities \u00bb C++_utilities_and_backports\n+infrastructure for supporting operator->() on both references and proxies\n+More...\n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Classes\n-class \u00a0Dune::Singleton<_T_>\n-\u00a0 An adapter to turn a class into a singleton. More...\n-\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+ Functions\n+template\n+pointer_or_proxy_holder\u00a0Dune::handle_proxy_member_access (T &&t)\n+\u00a0 Transparent support for providing member access to\n+ both lvalues and rvalues (temporary proxies). More...\n+\u00a0\n ***** Detailed Description *****\n-Useful wrapper for creating singletons.\n-Inspired by the article CodeGuru:_A_Leak-Free_Singleton_class\n+infrastructure for supporting operator->() on both references and proxies\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00017_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: singleton.hh Source File\n+dune-common: proxymemberaccess.hh Source File\n \n \n \n \n \n \n \n@@ -62,58 +62,107 @@\n \n
\n \n
\n
\n
\n-
singleton.hh
\n+
proxymemberaccess.hh
\n
\n
\n Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
\n
2// vi: set et ts=4 sw=2 sts=2:
\n
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
\n
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
\n-
5#ifndef DUNE_SINGLETON_HH
\n-
6#define DUNE_SINGLETON_HH
\n+
5#ifndef DUNE_COMMON_PROXYMEMBERACCESS_HH
\n+
6#define DUNE_COMMON_PROXYMEMBERACCESS_HH
\n
7
\n-\n-
9
\n-
17namespace Dune
\n-
18{
\n-
54 template<class T>
\n-\n-
56 {
\n-
57 protected:
\n-
58 /* @brief Protected constructor. */
\n-
59 Singleton() = default;
\n-
60
\n-
61 public:
\n-
62
\n-
63 Singleton(const Singleton&) = delete;
\n-
64 void operator=(const Singleton&) = delete;
\n-
65
\n-\n-
71 {
\n-
72 static T instance_;
\n-
73 return instance_;
\n-
74 }
\n-
75 };
\n-
76
\n-
77} // namespace Dune
\n-
78
\n-
79#endif
\n-
Definition of macros controlling symbol visibility at the ABI level.
\n-
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition: visibility.hh:20
\n+
14#include <type_traits>
\n+
15#include <utility>
\n+
16
\n+
17namespace Dune {
\n+
18
\n+
19 namespace Impl {
\n+
20
\n+
21 // helper struct to store a temporary / proxy
\n+
22 // for the duration of the member access
\n+
23 template<typename T>
\n+
24 struct member_access_proxy_holder
\n+
25 {
\n+
26
\n+
27 // only support moving the temporary into the holder object
\n+
28 member_access_proxy_holder(T&& t)
\n+
29 : _t(std::move(t))
\n+
30 {}
\n+
31
\n+
32 // The object is fundamentally a temporary, i.e. an rvalue,
\n+
33 //
\n+
34 const T* operator->() const
\n+
35 {
\n+
36 return &_t;
\n+
37 }
\n+
38
\n+
39 T _t;
\n+
40
\n+
41 };
\n+
42
\n+
43 } // end Impl namespace
\n+
44
\n+
45
\n+
46#ifdef DOXYGEN
\n+
47
\n+
49
\n+
79 template<typename T>
\n+
80 pointer_or_proxy_holder
\n+\n+
82
\n+
83#else // DOXYGEN
\n+
84
\n+
85
\n+
86 // This version matches lvalues (the C++ type deduction rules state that
\n+
87 // the T&& signature deduces to a reference iff the argument is an lvalue).
\n+
88 // As the argument is an lvalue, we do not have to worry about its lifetime
\n+
89 // and can just return its address.
\n+
90 template<typename T>
\n+
91 inline typename std::enable_if<
\n+
92 std::is_lvalue_reference<T>::value,
\n+
93 typename std::add_pointer<
\n+
94 typename std::remove_reference<
\n+
95 T
\n+
96 >::type
\n+
97 >::type
\n+
98 >::type
\n+\n+
100 {
\n+
101 return &target;
\n+
102 }
\n+
103
\n+
104 // This version matches rvalues (the C++ type deduction rules state that
\n+
105 // the T&& signature deduces to a non-reference iff the argument is an rvalue).
\n+
106 // In this case, we have to capture the rvalue in a new object to make sure it
\n+
107 // is kept alive for the duration of the member access. For this purpose, we move
\n+
108 // it into a member_access_proxy_holder instance.
\n+
109 template<typename T>
\n+
110 inline typename std::enable_if<
\n+
111 !std::is_lvalue_reference<T>::value,
\n+
112 Impl::member_access_proxy_holder<T>
\n+
113 >::type
\n+\n+
115 {
\n+
116 return {std::forward<T>(target)};
\n+
117 }
\n+
118
\n+
119#endif // DOXYGEN
\n+
120
\n+
121} // namespace Dune
\n+
122
\n+
123#endif // DUNE_COMMON_PROXYMEMBERACCESS_HH
\n+
pointer_or_proxy_holder handle_proxy_member_access(T &&t)
Transparent support for providing member access to both lvalues and rvalues (temporary proxies).
\n+
STL namespace.
\n
Dune namespace.
Definition: alignedallocator.hh:13
\n-
An adapter to turn a class into a singleton.
Definition: singleton.hh:56
\n-
Singleton()=default
\n-
Singleton(const Singleton &)=delete
\n-
void operator=(const Singleton &)=delete
\n-
static DUNE_EXPORT T & instance()
Get the instance of the singleton.
Definition: singleton.hh:70
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,68 +4,112 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-singleton.hh\n+proxymemberaccess.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_SINGLETON_HH\n- 6#define DUNE_SINGLETON_HH\n+ 5#ifndef DUNE_COMMON_PROXYMEMBERACCESS_HH\n+ 6#define DUNE_COMMON_PROXYMEMBERACCESS_HH\n 7\n- 8#include \n- 9\n- 17namespace Dune\n- 18{\n- 54 template\n-55 class Singleton\n- 56 {\n- 57 protected:\n- 58 /* @brief Protected constructor. */\n-59 Singleton() = default;\n- 60\n- 61 public:\n- 62\n-63 Singleton(const Singleton&) = delete;\n-64 void operator=(const Singleton&) = delete;\n- 65\n-70 DUNE_EXPORT static T& instance()\n- 71 {\n- 72 static T instance_;\n- 73 return instance_;\n- 74 }\n- 75 };\n- 76\n- 77} // namespace Dune\n- 78\n- 79#endif\n-visibility.hh\n-Definition of macros controlling symbol visibility at the ABI level.\n-DUNE_EXPORT\n-#define DUNE_EXPORT\n-Export a symbol as part of the public ABI.\n-Definition: visibility.hh:20\n+ 14#include \n+ 15#include \n+ 16\n+ 17namespace Dune {\n+ 18\n+ 19 namespace Impl {\n+ 20\n+ 21 // helper struct to store a temporary / proxy\n+ 22 // for the duration of the member access\n+ 23 template\n+ 24 struct member_access_proxy_holder\n+ 25 {\n+ 26\n+ 27 // only support moving the temporary into the holder object\n+ 28 member_access_proxy_holder(T&& t)\n+ 29 : _t(std::move(t))\n+ 30 {}\n+ 31\n+ 32 // The object is fundamentally a temporary, i.e. an rvalue,\n+ 33 //\n+ 34 const T* operator->() const\n+ 35 {\n+ 36 return &_t;\n+ 37 }\n+ 38\n+ 39 T _t;\n+ 40\n+ 41 };\n+ 42\n+ 43 } // end Impl namespace\n+ 44\n+ 45\n+ 46#ifdef DOXYGEN\n+ 47\n+ 49\n+ 79 template\n+ 80 pointer_or_proxy_holder\n+81 handle_proxy_member_access(T&& t);\n+ 82\n+ 83#else // DOXYGEN\n+ 84\n+ 85\n+ 86 // This version matches lvalues (the C++ type deduction rules state that\n+ 87 // the T&& signature deduces to a reference iff the argument is an lvalue).\n+ 88 // As the argument is an lvalue, we do not have to worry about its lifetime\n+ 89 // and can just return its address.\n+ 90 template\n+ 91 inline typename std::enable_if<\n+ 92 std::is_lvalue_reference::value,\n+ 93 typename std::add_pointer<\n+ 94 typename std::remove_reference<\n+ 95 T\n+ 96 >::type\n+ 97 >::type\n+ 98 >::type\n+ 99 handle_proxy_member_access(T&& target)\n+ 100 {\n+ 101 return ⌖\n+ 102 }\n+ 103\n+ 104 // This version matches rvalues (the C++ type deduction rules state that\n+ 105 // the T&& signature deduces to a non-reference iff the argument is an\n+rvalue).\n+ 106 // In this case, we have to capture the rvalue in a new object to make\n+sure it\n+ 107 // is kept alive for the duration of the member access. For this purpose,\n+we move\n+ 108 // it into a member_access_proxy_holder instance.\n+ 109 template\n+ 110 inline typename std::enable_if<\n+ 111 !std::is_lvalue_reference::value,\n+ 112 Impl::member_access_proxy_holder\n+ 113 >::type\n+ 114 handle_proxy_member_access(T&& target)\n+ 115 {\n+ 116 return {std::forward(target)};\n+ 117 }\n+ 118\n+ 119#endif // DOXYGEN\n+ 120\n+ 121} // namespace Dune\n+ 122\n+ 123#endif // DUNE_COMMON_PROXYMEMBERACCESS_HH\n+Dune::handle_proxy_member_access\n+pointer_or_proxy_holder handle_proxy_member_access(T &&t)\n+Transparent support for providing member access to both lvalues and rvalues\n+(temporary proxies).\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::Singleton\n-An adapter to turn a class into a singleton.\n-Definition: singleton.hh:56\n-Dune::Singleton::Singleton\n-Singleton()=default\n-Dune::Singleton::Singleton\n-Singleton(const Singleton &)=delete\n-Dune::Singleton::operator=\n-void operator=(const Singleton &)=delete\n-Dune::Singleton::instance\n-static DUNE_EXPORT T & instance()\n-Get the instance of the singleton.\n-Definition: singleton.hh:70\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00020.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00020.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: iteratorrange.hh File Reference\n+dune-common: bitsetvector.hh File Reference\n \n \n \n \n \n \n \n@@ -65,32 +65,58 @@\n
  • dune
  • common
  • \n
    \n \n
    \n \n-
    iteratorrange.hh File Reference
    \n+
    bitsetvector.hh File Reference
    \n
    \n
    \n \n+

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

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

    Go to the source code of this file.

    \n \n \n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n

    \n Classes

    class  Dune::IteratorRange< Iterator >
     Simple range between a begin and an end iterator. More...
    class  Dune::BitSetVectorConstReference< block_size, Alloc >
     A proxy class that acts as a const reference to a single bitset in a BitSetVector. More...
     
    class  Dune::BitSetVectorReference< block_size, Alloc >
     A proxy class that acts as a mutable reference to a single bitset in a BitSetVector. More...
     
    struct  Dune::const_reference< BitSetVectorReference< block_size, Alloc > >
     
    struct  Dune::const_reference< BitSetVectorConstReference< block_size, Alloc > >
     
    struct  Dune::mutable_reference< BitSetVectorReference< block_size, Alloc > >
     
    struct  Dune::mutable_reference< BitSetVectorConstReference< block_size, Alloc > >
     
    class  Dune::BitSetVector< block_size, Allocator >
     A dynamic array of blocks of booleans. More...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-
    \n+

    Detailed Description

    \n+

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

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,20 +5,49 @@\n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n Classes | Namespaces\n-iteratorrange.hh File Reference\n+bitsetvector.hh File Reference\n+Efficient implementation of a dynamic array of static arrays of booleans.\n+More...\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::IteratorRange<_Iterator_>\n-\u00a0 Simple range between a begin and an end iterator. More...\n+ class \u00a0Dune::BitSetVectorConstReference<_block_size,_Alloc_>\n+\u00a0 A proxy class that acts as a const reference to a single bitset in a\n+ BitSetVector. More...\n+\u00a0\n+ class \u00a0Dune::BitSetVectorReference<_block_size,_Alloc_>\n+\u00a0 A proxy class that acts as a mutable reference to a single bitset in a\n+ BitSetVector. More...\n+\u00a0\n+struct \u00a0Dune::const_reference<_BitSetVectorReference<_block_size,_Alloc_>_>\n+\u00a0\n+struct \u00a0Dune::const_reference<_BitSetVectorConstReference<_block_size,_Alloc_>\n+ >\n+\u00a0\n+struct \u00a0Dune::mutable_reference<_BitSetVectorReference<_block_size,_Alloc_>_>\n+\u00a0\n+struct \u00a0Dune::mutable_reference<_BitSetVectorConstReference<_block_size,_Alloc\n+ >_>\n+\u00a0\n+ class \u00a0Dune::BitSetVector<_block_size,_Allocator_>\n+\u00a0 A dynamic array of blocks of booleans. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+***** Detailed Description *****\n+Efficient implementation of a dynamic array of static arrays of booleans.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00020_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00020_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: iteratorrange.hh Source File\n+dune-common: bitsetvector.hh Source File\n \n \n \n \n \n \n \n@@ -62,74 +62,653 @@\n \n
    \n \n
    \n \n
    \n-
    iteratorrange.hh
    \n+
    bitsetvector.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_ITERATORRANGE_HH
    \n-
    6#define DUNE_COMMON_ITERATORRANGE_HH
    \n+
    5#ifndef DUNE_BLOCK_BITFIELD_HH
    \n+
    6#define DUNE_BLOCK_BITFIELD_HH
    \n
    7
    \n-
    8namespace Dune {
    \n-
    9
    \n-
    11
    \n-
    20 template<typename Iterator>
    \n-\n-
    22 {
    \n-
    23
    \n-
    24 public:
    \n+
    12#include <vector>
    \n+
    13#include <bitset>
    \n+
    14#include <iostream>
    \n+
    15#include <algorithm>
    \n+
    16
    \n+\n+\n+\n+
    20
    \n+
    21namespace Dune {
    \n+
    22
    \n+
    23 template <int block_size, class Alloc> class BitSetVector;
    \n+
    24 template <int block_size, class Alloc> class BitSetVectorReference;
    \n
    25
    \n-
    27 typedef Iterator iterator;
    \n-
    28
    \n-
    30
    \n-
    33 typedef Iterator const_iterator;
    \n-
    34
    \n-
    36 IteratorRange(const Iterator& begin, const Iterator& end)
    \n-
    37 : _begin(begin)
    \n-
    38 , _end(end)
    \n-
    39 {}
    \n+
    36 template <int block_size, class Alloc>
    \n+\n+
    38 {
    \n+
    39 protected:
    \n
    40
    \n-\n-
    43 {}
    \n-
    44
    \n-\n-
    47 {
    \n-
    48 return _begin;
    \n+\n+
    42 friend class Dune::BitSetVector<block_size, Alloc>;
    \n+
    43
    \n+
    44 BitSetVectorConstReference(const BitSetVector& blockBitField_, int block_number_) :
    \n+
    45 blockBitField(blockBitField_),
    \n+
    46 block_number(block_number_)
    \n+
    47 {
    \n+
    48 DUNE_ASSERT_BOUNDS(blockBitField_.size() > static_cast<size_t>(block_number_));
    \n
    49 }
    \n
    50
    \n-
    52 iterator end() const
    \n-
    53 {
    \n-
    54 return _end;
    \n-
    55 }
    \n-
    56
    \n-
    57 private:
    \n-
    58
    \n-
    59 Iterator _begin;
    \n-
    60 Iterator _end;
    \n-
    61
    \n-
    62 };
    \n-
    63
    \n-
    64}
    \n-
    65
    \n-
    66#endif // DUNE_COMMON_ITERATORRANGE_HH
    \n+\n+
    53
    \n+
    54 public:
    \n+
    55
    \n+
    56 typedef std::bitset<block_size> bitset;
    \n+
    57
    \n+
    58 // bitset interface typedefs
    \n+
    59 typedef typename std::vector<bool, Alloc>::const_reference reference;
    \n+
    60 typedef typename std::vector<bool, Alloc>::const_reference const_reference;
    \n+
    61 typedef size_t size_type;
    \n+
    62
    \n+\n+
    65 {
    \n+
    66 bitset b = *this;
    \n+
    67 b <<= n;
    \n+
    68 return b;
    \n+
    69 }
    \n+
    70
    \n+\n+
    73 {
    \n+
    74 bitset b = *this;
    \n+
    75 b >>= n;
    \n+
    76 return b;
    \n+
    77 }
    \n+
    78
    \n+\n+
    81 {
    \n+
    82 bitset b = *this;
    \n+
    83 b.flip();
    \n+
    84 return b;
    \n+
    85 }
    \n+
    86
    \n+\n+
    89 {
    \n+
    90 return block_size;
    \n+
    91 }
    \n+
    92
    \n+\n+
    95 {
    \n+
    96 size_type n = 0;
    \n+
    97 for(size_type i=0; i<block_size; ++i)
    \n+
    98 n += getBit(i);
    \n+
    99 return n;
    \n+
    100 }
    \n+
    101
    \n+
    103 bool any() const
    \n+
    104 {
    \n+
    105 return count();
    \n+
    106 }
    \n+
    107
    \n+
    109 bool none() const
    \n+
    110 {
    \n+
    111 return ! any();
    \n+
    112 }
    \n+
    113
    \n+
    115 bool all() const
    \n+
    116 {
    \n+
    117 for(size_type i=0; i<block_size; ++i)
    \n+
    118 if(not test(i))
    \n+
    119 return false;
    \n+
    120 return true;
    \n+
    121 }
    \n+
    122
    \n+
    124 bool test(size_type n) const
    \n+
    125 {
    \n+
    126 return getBit(n);
    \n+
    127 }
    \n+
    128
    \n+\n+
    131 {
    \n+
    132 return getBit(i);
    \n+
    133 }
    \n+
    134
    \n+
    136 operator bitset() const
    \n+
    137 {
    \n+
    138 return blockBitField.getRepr(block_number);
    \n+
    139 }
    \n+
    140
    \n+
    142 bool operator== (const bitset& bs) const
    \n+
    143 {
    \n+
    144 return equals(bs);
    \n+
    145 }
    \n+
    146
    \n+\n+
    149 {
    \n+
    150 return equals(bs);
    \n+
    151 }
    \n+
    152
    \n+
    154 bool operator!= (const bitset& bs) const
    \n+
    155 {
    \n+
    156 return ! equals(bs);
    \n+
    157 }
    \n+
    158
    \n+\n+
    161 {
    \n+
    162 return ! equals(bs);
    \n+
    163 }
    \n+
    164
    \n+
    171 friend std::ostream& operator<< (std::ostream& s, const BitSetVectorConstReference& v)
    \n+
    172 {
    \n+
    173 s << "(";
    \n+
    174 for(int i=0; i<block_size; ++i)
    \n+
    175 s << v[i];
    \n+
    176 s << ")";
    \n+
    177 return s;
    \n+
    178 }
    \n+
    179
    \n+
    180 protected:
    \n+\n+\n+
    183
    \n+\n+
    185 {
    \n+
    186 return blockBitField.getBit(block_number,i);
    \n+
    187 }
    \n+
    188
    \n+
    189 template<class BS>
    \n+
    190 bool equals(const BS & bs) const
    \n+
    191 {
    \n+
    192 bool eq = true;
    \n+
    193 for(int i=0; i<block_size; ++i)
    \n+
    194 eq &= (getBit(i) == bs[i]);
    \n+
    195 return eq;
    \n+
    196 }
    \n+
    197
    \n+
    198 private:
    \n+
    203 void operator & () = delete;
    \n+
    204
    \n+
    205 friend class BitSetVectorReference<block_size, Alloc>;
    \n+
    206 };
    \n+
    207
    \n+
    220 template <int block_size, class Alloc>
    \n+
    221 class BitSetVectorReference : public BitSetVectorConstReference<block_size,Alloc>
    \n+
    222 {
    \n+
    223 protected:
    \n+
    224
    \n+\n+
    226 friend class Dune::BitSetVector<block_size, Alloc>;
    \n+
    227
    \n+\n+
    229
    \n+
    230 BitSetVectorReference(BitSetVector& blockBitField_, int block_number_) :
    \n+
    231 BitSetVectorConstReference(blockBitField_, block_number_),
    \n+
    232 blockBitField(blockBitField_)
    \n+
    233 {}
    \n+
    234
    \n+
    235 public:
    \n+
    236 typedef std::bitset<block_size> bitset;
    \n+
    237
    \n+
    241 typedef typename std::vector<bool, Alloc>::reference reference;
    \n+
    243 typedef typename std::vector<bool, Alloc>::const_reference const_reference;
    \n+
    245
    \n+
    247 typedef size_t size_type;
    \n+
    248
    \n+\n+
    251 {
    \n+
    252 for(int i=0; i<block_size; ++i)
    \n+
    253 getBit(i) = b;
    \n+
    254 return (*this);
    \n+
    255 }
    \n+
    256
    \n+\n+
    259 {
    \n+
    260 for(int i=0; i<block_size; ++i)
    \n+
    261 getBit(i) = b.test(i);
    \n+
    262 return (*this);
    \n+
    263 }
    \n+
    264
    \n+\n+
    267 {
    \n+
    268 for(int i=0; i<block_size; ++i)
    \n+
    269 getBit(i) = b.test(i);
    \n+
    270 return (*this);
    \n+
    271 }
    \n+
    272
    \n+\n+
    275 {
    \n+
    276 for(int i=0; i<block_size; ++i)
    \n+
    277 getBit(i) = b.test(i);
    \n+
    278 return (*this);
    \n+
    279 }
    \n+
    280
    \n+\n+
    283 {
    \n+
    284 for (size_type i=0; i<block_size; i++)
    \n+
    285 getBit(i) = (test(i) & x.test(i));
    \n+
    286 return *this;
    \n+
    287 }
    \n+
    288
    \n+\n+
    291 {
    \n+
    292 for (size_type i=0; i<block_size; i++)
    \n+
    293 getBit(i) = (test(i) & x.test(i));
    \n+
    294 return *this;
    \n+
    295 }
    \n+
    296
    \n+\n+
    299 {
    \n+
    300 for (size_type i=0; i<block_size; i++)
    \n+
    301 getBit(i) = (test(i) | x.test(i));
    \n+
    302 return *this;
    \n+
    303 }
    \n+
    304
    \n+\n+
    307 {
    \n+
    308 for (size_type i=0; i<block_size; i++)
    \n+
    309 getBit(i) = (test(i) | x.test(i));
    \n+
    310 return *this;
    \n+
    311 }
    \n+
    312
    \n+\n+
    315 {
    \n+
    316 for (size_type i=0; i<block_size; i++)
    \n+
    317 getBit(i) = (test(i) ^ x.test(i));
    \n+
    318 return *this;
    \n+
    319 }
    \n+
    320
    \n+
    321 private:
    \n+
    322
    \n+
    323 // For some reason, the following variant of operator^= triggers an ICE or a hanging
    \n+
    324 // compiler on Debian 9 with GCC 6.3 and full optimizations enabled (-O3).
    \n+
    325 // The only way to reliably avoid the issue is by making sure that the compiler does not
    \n+
    326 // see the XOR in the context of the function, so here is a little helper that will normally
    \n+
    327 // be inlined, but not on the broken compiler. This incurs a substantial overhead (a function
    \n+
    328 // call), but until someone else has a better idea, it's the only way to make it work reliably.
    \n+
    329
    \n+
    330 static bool xor_helper(bool a, bool b)
    \n+
    331#if defined(__GNUC__) && ! defined(__clang__) && __GNUC__ == 6 && __GNUC_MINOR__ == 3 && __cplusplus \\
    \n+
    332 == 201402L
    \n+
    333 __attribute__((noinline))
    \n+
    334#endif
    \n+
    335 ;
    \n+
    336
    \n+
    337 public:
    \n+
    338
    \n+\n+
    341 {
    \n+
    342 // This uses the helper from above to hoist the actual XOR computation out of the function for
    \n+
    343 // the buggy version of GCC.
    \n+
    344 for (size_type i=0; i<block_size; i++)
    \n+
    345 getBit(i) = xor_helper(test(i),x.test(i));
    \n+
    346 return *this;
    \n+
    347 }
    \n+
    348
    \n+\n+
    351 {
    \n+
    352 for (size_type i=0; i<block_size-n; i++)
    \n+
    353 getBit(i) = test(i+n);
    \n+
    354 return *this;
    \n+
    355 }
    \n+
    356
    \n+\n+
    359 {
    \n+
    360 for (size_type i=0; i<block_size-n; i++)
    \n+
    361 getBit(i+n) = test(i);
    \n+
    362 return *this;
    \n+
    363 }
    \n+
    364
    \n+\n+
    367 {
    \n+
    368 for (size_type i=0; i<block_size; i++)
    \n+
    369 set(i);
    \n+
    370 return *this;
    \n+
    371 }
    \n+
    372
    \n+\n+
    375 {
    \n+
    376 for (size_type i=0; i<block_size; i++)
    \n+
    377 flip(i);
    \n+
    378 return *this;
    \n+
    379 }
    \n+
    380
    \n+\n+
    383 {
    \n+
    384 *this = false;
    \n+
    385 return *this;
    \n+
    386 }
    \n+
    387
    \n+\n+
    390 {
    \n+
    391 getBit(n) = val;
    \n+
    392 return *this;
    \n+
    393 }
    \n+
    394
    \n+\n+
    397 {
    \n+
    398 set(n, false);
    \n+
    399 return *this;
    \n+
    400 }
    \n+
    401
    \n+\n+
    404 {
    \n+
    405 getBit(n).flip();
    \n+
    406 return *this;
    \n+
    407 }
    \n+
    408
    \n+\n+
    410 using BitSetVectorConstReference::operator[];
    \n+
    411
    \n+\n+
    414 {
    \n+
    415 return getBit(i);
    \n+
    416 }
    \n+
    417
    \n+
    418 protected:
    \n+\n+
    420
    \n+\n+
    422
    \n+\n+
    424 {
    \n+
    425 return blockBitField.getBit(this->block_number,i);
    \n+
    426 }
    \n+
    427 };
    \n+
    428
    \n+
    429 // implementation of helper - I put it into the template to avoid having
    \n+
    430 // to compile it in a dedicated compilation unit
    \n+
    431 template<int block_size, class Alloc>
    \n+
    432 bool BitSetVectorReference<block_size,Alloc>::xor_helper(bool a, bool b)
    \n+
    433 {
    \n+
    434 return a ^ b;
    \n+
    435 }
    \n+
    436
    \n+
    440 template<int block_size, class Alloc>
    \n+
    441 struct const_reference< BitSetVectorReference<block_size,Alloc> >
    \n+
    442 {
    \n+\n+
    444 };
    \n+
    445
    \n+
    446 template<int block_size, class Alloc>
    \n+
    447 struct const_reference< BitSetVectorConstReference<block_size,Alloc> >
    \n+
    448 {
    \n+\n+
    450 };
    \n+
    451
    \n+
    452 template<int block_size, class Alloc>
    \n+
    453 struct mutable_reference< BitSetVectorReference<block_size,Alloc> >
    \n+
    454 {
    \n+\n+
    456 };
    \n+
    457
    \n+
    458 template<int block_size, class Alloc>
    \n+\n+
    460 {
    \n+\n+
    462 };
    \n+
    463
    \n+
    467 template <int block_size, class Allocator=std::allocator<bool> >
    \n+
    468 class BitSetVector : private std::vector<bool, Allocator>
    \n+
    469 {
    \n+
    471 typedef std::vector<bool, Allocator> BlocklessBaseClass;
    \n+
    472
    \n+
    473 public:
    \n+
    476
    \n+
    478 typedef std::bitset<block_size> value_type;
    \n+
    479
    \n+\n+
    482
    \n+\n+
    485
    \n+\n+
    488
    \n+\n+
    491
    \n+
    493 typedef typename std::vector<bool, Allocator>::size_type size_type;
    \n+
    494
    \n+
    496 typedef Allocator allocator_type;
    \n+
    498
    \n+\n+\n+
    504
    \n+\n+
    507 return iterator(*this, 0);
    \n+
    508 }
    \n+
    509
    \n+\n+
    512 return const_iterator(*this, 0);
    \n+
    513 }
    \n+
    514
    \n+\n+
    517 return iterator(*this, size());
    \n+
    518 }
    \n+
    519
    \n+\n+
    522 return const_iterator(*this, size());
    \n+
    523 }
    \n+
    524
    \n+\n+
    527 BlocklessBaseClass()
    \n+
    528 {}
    \n+
    529
    \n+
    531 BitSetVector(const BlocklessBaseClass& blocklessBitField) :
    \n+
    532 BlocklessBaseClass(blocklessBitField)
    \n+
    533 {
    \n+
    534 if (blocklessBitField.size()%block_size != 0)
    \n+
    535 DUNE_THROW(RangeError, "Vector size is not a multiple of the block size!");
    \n+
    536 }
    \n+
    537
    \n+
    541 explicit BitSetVector(int n) :
    \n+
    542 BlocklessBaseClass(n*block_size)
    \n+
    543 {}
    \n+
    544
    \n+
    546 BitSetVector(int n, bool v) :
    \n+
    547 BlocklessBaseClass(n*block_size,v)
    \n+
    548 {}
    \n+
    549
    \n+
    551 void clear()
    \n+
    552 {
    \n+
    553 BlocklessBaseClass::clear();
    \n+
    554 }
    \n+
    555
    \n+
    557 void resize(int n, bool v = bool())
    \n+
    558 {
    \n+
    559 BlocklessBaseClass::resize(n*block_size, v);
    \n+
    560 }
    \n+
    561
    \n+\n+
    564 {
    \n+
    565 return BlocklessBaseClass::size()/block_size;
    \n+
    566 }
    \n+
    567
    \n+
    569 void setAll() {
    \n+
    570 this->assign(BlocklessBaseClass::size(), true);
    \n+
    571 }
    \n+
    572
    \n+
    574 void unsetAll() {
    \n+
    575 this->assign(BlocklessBaseClass::size(), false);
    \n+
    576 }
    \n+
    577
    \n+\n+
    580 {
    \n+
    581 return reference(*this, i);
    \n+
    582 }
    \n+
    583
    \n+\n+
    586 {
    \n+
    587 return const_reference(*this, i);
    \n+
    588 }
    \n+
    589
    \n+\n+
    592 {
    \n+
    593 return reference(*this, size()-1);
    \n+
    594 }
    \n+
    595
    \n+\n+
    598 {
    \n+
    599 return const_reference(*this, size()-1);
    \n+
    600 }
    \n+
    601
    \n+\n+
    604 {
    \n+
    605 return std::count(BlocklessBaseClass::begin(), BlocklessBaseClass::end(), true);
    \n+
    606 }
    \n+
    607
    \n+\n+
    610 {
    \n+
    611 size_type n = 0;
    \n+
    612 size_type blocks = size();
    \n+
    613 for(size_type i=0; i<blocks; ++i)
    \n+
    614 n += getBit(i,j);
    \n+
    615 return n;
    \n+
    616 }
    \n+
    617
    \n+
    619 friend std::ostream& operator<< (std::ostream& s, const BitSetVector& v)
    \n+
    620 {
    \n+
    621 for (size_t i=0; i<v.size(); i++)
    \n+
    622 s << v[i] << " ";
    \n+
    623 return s;
    \n+
    624 }
    \n+
    625
    \n+
    626 private:
    \n+
    627
    \n+
    629 value_type getRepr(int i) const
    \n+
    630 {
    \n+
    631 value_type bits;
    \n+
    632 for(int j=0; j<block_size; ++j)
    \n+
    633 bits.set(j, getBit(i,j));
    \n+
    634 return bits;
    \n+
    635 }
    \n+
    636
    \n+
    637 typename std::vector<bool>::reference getBit(size_type i, size_type j) {
    \n+
    638 DUNE_ASSERT_BOUNDS(j < block_size);
    \n+\n+
    640 return BlocklessBaseClass::operator[](i*block_size+j);
    \n+
    641 }
    \n+
    642
    \n+
    643 typename std::vector<bool>::const_reference getBit(size_type i, size_type j) const {
    \n+
    644 DUNE_ASSERT_BOUNDS(j < block_size);
    \n+\n+
    646 return BlocklessBaseClass::operator[](i*block_size+j);
    \n+
    647 }
    \n+
    648
    \n+
    649 friend class BitSetVectorReference<block_size,Allocator>;
    \n+
    650 friend class BitSetVectorConstReference<block_size,Allocator>;
    \n+
    651 };
    \n+
    652
    \n+
    653} // namespace Dune
    \n+
    654
    \n+
    655#endif
    \n+
    Implements a generic iterator class for writing stl conformant iterators.
    \n+
    Macro for wrapping boundary checks.
    \n+
    A few common exception classes.
    \n+
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition: boundschecking.hh:30
    \n+
    bool eq(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
    test for equality using epsilon
    Definition: float_cmp.cc:144
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    Simple range between a begin and an end iterator.
    Definition: iteratorrange.hh:22
    \n-
    iterator begin() const
    Returns an iterator pointing to the begin of the range.
    Definition: iteratorrange.hh:46
    \n-
    Iterator const_iterator
    The iterator belonging to this range.
    Definition: iteratorrange.hh:33
    \n-
    iterator end() const
    Returns an iterator pointing past the end of the range.
    Definition: iteratorrange.hh:52
    \n-
    IteratorRange()
    Default constructor, relies on iterators being default-constructible.
    Definition: iteratorrange.hh:42
    \n-
    Iterator iterator
    The iterator belonging to this range.
    Definition: iteratorrange.hh:27
    \n-
    IteratorRange(const Iterator &begin, const Iterator &end)
    Constructs an iterator range on [begin,end).
    Definition: iteratorrange.hh:36
    \n+
    void assign(T &dst, const T &src, bool mask)
    masked Simd assignment (scalar version)
    Definition: simd.hh:447
    \n+
    A dynamic array of blocks of booleans.
    Definition: bitsetvector.hh:469
    \n+
    const_reference operator[](int i) const
    Return const reference to i-th block.
    Definition: bitsetvector.hh:585
    \n+
    iterator begin()
    Returns a iterator pointing to the beginning of the vector.
    Definition: bitsetvector.hh:506
    \n+
    BitSetVectorConstReference< block_size, Allocator > * const_pointer
    Const pointer to a small block of bits.
    Definition: bitsetvector.hh:490
    \n+
    const_iterator end() const
    Returns a const_iterator pointing to the end of the vector.
    Definition: bitsetvector.hh:521
    \n+
    BitSetVectorReference< block_size, Allocator > reference
    Reference to a small block of bits.
    Definition: bitsetvector.hh:481
    \n+
    size_type countmasked(int j) const
    Returns the number of set bits, while each block is masked with 1<<i.
    Definition: bitsetvector.hh:609
    \n+
    BitSetVectorConstReference< block_size, Allocator > const_reference
    Const reference to a small block of bits.
    Definition: bitsetvector.hh:484
    \n+
    iterator end()
    Returns an iterator pointing to the end of the vector.
    Definition: bitsetvector.hh:516
    \n+
    size_type count() const
    Returns the number of bits that are set.
    Definition: bitsetvector.hh:603
    \n+
    BitSetVector()
    Default constructor.
    Definition: bitsetvector.hh:526
    \n+
    void setAll()
    Sets all entries to true
    Definition: bitsetvector.hh:569
    \n+
    Dune::GenericIterator< const BitSetVector< block_size, Allocator >, const value_type, const_reference, std::ptrdiff_t, ForwardIteratorFacade > const_iterator
    Definition: bitsetvector.hh:502
    \n+
    std::bitset< block_size > value_type
    Type of the values stored by the container.
    Definition: bitsetvector.hh:478
    \n+
    reference back()
    Return reference to last block.
    Definition: bitsetvector.hh:591
    \n+
    BitSetVector(const BlocklessBaseClass &blocklessBitField)
    Construction from an unblocked bitfield.
    Definition: bitsetvector.hh:531
    \n+
    friend std::ostream & operator<<(std::ostream &s, const BitSetVector &v)
    Send bitfield to an output stream.
    Definition: bitsetvector.hh:619
    \n+
    const_reference back() const
    Return const reference to last block.
    Definition: bitsetvector.hh:597
    \n+
    void clear()
    Erases all of the elements.
    Definition: bitsetvector.hh:551
    \n+
    BitSetVectorReference< block_size, Allocator > * pointer
    Pointer to a small block of bits.
    Definition: bitsetvector.hh:487
    \n+
    reference operator[](int i)
    Return reference to i-th block.
    Definition: bitsetvector.hh:579
    \n+
    size_type size() const
    Return the number of blocks.
    Definition: bitsetvector.hh:563
    \n+
    std::vector< bool, Allocator >::size_type size_type
    size type
    Definition: bitsetvector.hh:493
    \n+
    BitSetVector(int n, bool v)
    Constructor which initializes the field with true or false.
    Definition: bitsetvector.hh:546
    \n+
    const_iterator begin() const
    Returns a const_iterator pointing to the beginning of the vector.
    Definition: bitsetvector.hh:511
    \n+
    Dune::GenericIterator< BitSetVector< block_size, Allocator >, value_type, reference, std::ptrdiff_t, ForwardIteratorFacade > iterator
    Definition: bitsetvector.hh:501
    \n+
    void resize(int n, bool v=bool())
    Resize field.
    Definition: bitsetvector.hh:557
    \n+
    Allocator allocator_type
    The type of the allocator.
    Definition: bitsetvector.hh:496
    \n+
    BitSetVector(int n)
    Definition: bitsetvector.hh:541
    \n+
    void unsetAll()
    Sets all entries to false
    Definition: bitsetvector.hh:574
    \n+
    A proxy class that acts as a mutable reference to a single bitset in a BitSetVector.
    Definition: bitsetvector.hh:222
    \n+
    bool test(size_type n) const
    Returns true if bit n is set.
    Definition: bitsetvector.hh:124
    \n+
    BitSetVectorReference & operator=(const BitSetVectorConstReference &b)
    Assignment from BitSetVectorConstReference.
    Definition: bitsetvector.hh:266
    \n+
    reference operator[](size_type i)
    Return reference to the i-th bit.
    Definition: bitsetvector.hh:413
    \n+
    BitSetVectorReference & reset(size_type n)
    Clears bit n.
    Definition: bitsetvector.hh:396
    \n+
    BitSetVectorReference & operator<<=(size_type n)
    Left shift.
    Definition: bitsetvector.hh:350
    \n+
    Dune::BitSetVector< block_size, Alloc > BitSetVector
    Definition: bitsetvector.hh:225
    \n+
    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
    \n+
    BitSetVectorReference & operator=(const BitSetVectorReference &b)
    Assignment from BitSetVectorReference.
    Definition: bitsetvector.hh:274
    \n+
    reference getBit(size_type i)
    Definition: bitsetvector.hh:423
    \n+
    BitSetVectorReference & operator&=(const BitSetVectorConstReference &x)
    Bitwise and (for BitSetVectorConstReference and BitSetVectorReference)
    Definition: bitsetvector.hh:290
    \n+
    BitSetVectorReference(BitSetVector &blockBitField_, int block_number_)
    Definition: bitsetvector.hh:230
    \n+
    size_t size_type
    size_type typedef (an unsigned integral type)
    Definition: bitsetvector.hh:247
    \n+
    BitSetVectorReference & operator=(const bitset &b)
    Assignment from bitset.
    Definition: bitsetvector.hh:258
    \n+
    Dune::BitSetVectorConstReference< block_size, Alloc > BitSetVectorConstReference
    Definition: bitsetvector.hh:228
    \n+
    BitSetVectorReference & reset()
    Clears every bit.
    Definition: bitsetvector.hh:382
    \n+
    BitSetVector & blockBitField
    Definition: bitsetvector.hh:419
    \n+
    BitSetVectorReference & operator|=(const BitSetVectorConstReference &x)
    Bitwise inclusive or (for BitSetVectorConstReference and BitSetVectorReference)
    Definition: bitsetvector.hh:306
    \n+
    BitSetVectorReference & set(size_type n, int val=1)
    Sets bit n if val is nonzero, and clears bit n if val is zero.
    Definition: bitsetvector.hh:389
    \n+
    std::bitset< block_size > bitset
    Definition: bitsetvector.hh:236
    \n+
    BitSetVectorReference & operator^=(const bitset &x)
    Bitwise exclusive or (for bitset).
    Definition: bitsetvector.hh:314
    \n+
    std::vector< bool, Alloc >::reference reference
    Definition: bitsetvector.hh:241
    \n+
    BitSetVectorReference & operator|=(const bitset &x)
    Bitwise inclusive or (for bitset)
    Definition: bitsetvector.hh:298
    \n+
    BitSetVectorReference & operator>>=(size_type n)
    Right shift.
    Definition: bitsetvector.hh:358
    \n+
    BitSetVectorReference & operator^=(const BitSetVectorConstReference &x)
    Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference)
    Definition: bitsetvector.hh:340
    \n+
    BitSetVectorReference & flip(size_type n)
    Flips bit n.
    Definition: bitsetvector.hh:403
    \n+
    BitSetVectorReference & flip()
    Flips the value of every bit.
    Definition: bitsetvector.hh:374
    \n+
    BitSetVectorReference & set()
    Sets every bit.
    Definition: bitsetvector.hh:366
    \n+
    BitSetVectorReference & operator&=(const bitset &x)
    Bitwise and (for bitset).
    Definition: bitsetvector.hh:282
    \n+
    BitSetVectorReference & operator=(bool b)
    Assignment from bool, sets each bit in the bitset to b.
    Definition: bitsetvector.hh:250
    \n+
    A proxy class that acts as a const reference to a single bitset in a BitSetVector.
    Definition: bitsetvector.hh:38
    \n+
    bool operator==(const bitset &bs) const
    Equality of reference and std::bitset.
    Definition: bitsetvector.hh:142
    \n+
    bool test(size_type n) const
    Returns true if bit n is set.
    Definition: bitsetvector.hh:124
    \n+
    const_reference operator[](size_type i) const
    Return reference to the i-th bit.
    Definition: bitsetvector.hh:130
    \n+
    bitset operator<<(size_type n) const
    Returns a copy of *this shifted left by n bits.
    Definition: bitsetvector.hh:64
    \n+
    BitSetVectorConstReference & operator=(const BitSetVectorConstReference &b)
    hide assignment operator
    \n+
    BitSetVectorConstReference(const BitSetVector &blockBitField_, int block_number_)
    Definition: bitsetvector.hh:44
    \n+
    const BitSetVector & blockBitField
    Definition: bitsetvector.hh:181
    \n+
    bitset operator>>(size_type n) const
    Returns a copy of *this shifted right by n bits.
    Definition: bitsetvector.hh:72
    \n+
    const_reference getBit(size_type i) const
    Definition: bitsetvector.hh:184
    \n+
    bool operator!=(const bitset &bs) const
    Inequality of reference and std::bitset.
    Definition: bitsetvector.hh:154
    \n+
    bool equals(const BS &bs) const
    Definition: bitsetvector.hh:190
    \n+
    Dune::BitSetVector< block_size, Alloc > BitSetVector
    Definition: bitsetvector.hh:41
    \n+
    std::bitset< block_size > bitset
    Definition: bitsetvector.hh:56
    \n+
    bool all() const
    Returns true if all bits are set.
    Definition: bitsetvector.hh:115
    \n+
    size_t size_type
    Definition: bitsetvector.hh:61
    \n+
    bitset operator~() const
    Returns a copy of *this with all of its bits flipped.
    Definition: bitsetvector.hh:80
    \n+
    std::vector< bool, Alloc >::const_reference reference
    Definition: bitsetvector.hh:59
    \n+
    size_type size() const
    Returns block_size.
    Definition: bitsetvector.hh:88
    \n+
    size_type count() const
    Returns the number of bits that are set.
    Definition: bitsetvector.hh:94
    \n+
    bool none() const
    Returns true if no bits are set.
    Definition: bitsetvector.hh:109
    \n+
    bool any() const
    Returns true if any bits are set.
    Definition: bitsetvector.hh:103
    \n+
    int block_number
    Definition: bitsetvector.hh:182
    \n+
    std::vector< bool, Alloc >::const_reference const_reference
    Definition: bitsetvector.hh:60
    \n+
    BitSetVectorConstReference< block_size, Alloc > type
    Definition: bitsetvector.hh:443
    \n+
    BitSetVectorConstReference< block_size, Alloc > type
    Definition: bitsetvector.hh:449
    \n+
    BitSetVectorReference< block_size, Alloc > type
    Definition: bitsetvector.hh:455
    \n+
    BitSetVectorReference< block_size, Alloc > type
    Definition: bitsetvector.hh:461
    \n+
    Default exception class for range errors.
    Definition: exceptions.hh:254
    \n+
    Get the 'const' version of a reference to a mutable object.
    Definition: genericiterator.hh:87
    \n+
    get the 'mutable' version of a reference to a const object
    Definition: genericiterator.hh:116
    \n+
    Generic class for stl-conforming iterators for container classes with operator[].
    Definition: genericiterator.hh:153
    \n+
    Base class for stl conformant forward iterators.
    Definition: iteratorfacades.hh:141
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,92 +4,940 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-iteratorrange.hh\n+bitsetvector.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_ITERATORRANGE_HH\n- 6#define DUNE_COMMON_ITERATORRANGE_HH\n+ 5#ifndef DUNE_BLOCK_BITFIELD_HH\n+ 6#define DUNE_BLOCK_BITFIELD_HH\n 7\n- 8namespace Dune {\n- 9\n- 11\n- 20 template\n-21 class IteratorRange\n- 22 {\n- 23\n- 24 public:\n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16\n+ 17#include \n+ 18#include \n+ 19#include \n+ 20\n+ 21namespace Dune {\n+ 22\n+ 23 template class BitSetVector;\n+ 24 template class BitSetVectorReference;\n 25\n-27 typedef Iterator iterator;\n- 28\n- 30\n-33 typedef Iterator const_iterator;\n- 34\n-36 IteratorRange(const Iterator& begin, const Iterator& end)\n- 37 : _begin(begin)\n- 38 , _end(end)\n- 39 {}\n+ 36 template \n+37 class BitSetVectorConstReference\n+ 38 {\n+ 39 protected:\n 40\n-42 IteratorRange()\n- 43 {}\n- 44\n-46 iterator begin() const\n+41 typedef Dune::BitSetVector BitSetVector;\n+ 42 friend class Dune::BitSetVector;\n+ 43\n+44 BitSetVectorConstReference(const BitSetVector& blockBitField_, int\n+block_number_) :\n+ 45 blockBitField(blockBitField_),\n+ 46 block_number(block_number_)\n 47 {\n- 48 return _begin;\n+ 48 DUNE_ASSERT_BOUNDS(blockBitField_.size() > static_cast\n+(block_number_));\n 49 }\n 50\n-52 iterator end() const\n- 53 {\n- 54 return _end;\n- 55 }\n- 56\n- 57 private:\n- 58\n- 59 Iterator _begin;\n- 60 Iterator _end;\n- 61\n- 62 };\n- 63\n- 64}\n- 65\n- 66#endif // DUNE_COMMON_ITERATORRANGE_HH\n+52 BitSetVectorConstReference& operator=(const BitSetVectorConstReference & b);\n+ 53\n+ 54 public:\n+ 55\n+56 typedef std::bitset bitset;\n+ 57\n+ 58 // bitset interface typedefs\n+59 typedef typename std::vector::const_reference reference;\n+60 typedef typename std::vector::const_reference const_reference;\n+61 typedef size_t size_type;\n+ 62\n+64 bitset operator<<(size_type n) const\n+ 65 {\n+ 66 bitset b = *this;\n+ 67 b <<= n;\n+ 68 return b;\n+ 69 }\n+ 70\n+72 bitset operator>>(size_type n) const\n+ 73 {\n+ 74 bitset b = *this;\n+ 75 b >>= n;\n+ 76 return b;\n+ 77 }\n+ 78\n+80 bitset operator~() const\n+ 81 {\n+ 82 bitset b = *this;\n+ 83 b.flip();\n+ 84 return b;\n+ 85 }\n+ 86\n+88 size_type size() const\n+ 89 {\n+ 90 return block_size;\n+ 91 }\n+ 92\n+94 size_type count() const\n+ 95 {\n+ 96 size_type n = 0;\n+ 97 for(size_type i=0; i\n+190 bool equals(const BS & bs) const\n+ 191 {\n+ 192 bool eq = true;\n+ 193 for(int i=0; i;\n+ 206 };\n+ 207\n+ 220 template \n+221 class BitSetVectorReference : public\n+BitSetVectorConstReference\n+ 222 {\n+ 223 protected:\n+ 224\n+225 typedef Dune::BitSetVector BitSetVector;\n+ 226 friend class Dune::BitSetVector;\n+ 227\n+228 typedef Dune::BitSetVectorConstReference\n+BitSetVectorConstReference;\n+ 229\n+230 BitSetVectorReference(BitSetVector& blockBitField_, int block_number_) :\n+ 231 BitSetVectorConstReference(blockBitField_, block_number_),\n+ 232 blockBitField(blockBitField_)\n+ 233 {}\n+ 234\n+ 235 public:\n+236 typedef std::bitset bitset;\n+ 237\n+241 typedef typename std::vector::reference reference;\n+243 typedef typename std::vector::const_reference const_reference;\n+ 245\n+247 typedef size_t size_type;\n+ 248\n+250 BitSetVectorReference& operator=(bool b)\n+ 251 {\n+ 252 for(int i=0; i>=(size_type n)\n+ 359 {\n+ 360 for (size_type i=0; iblock_number,i);\n+ 426 }\n+ 427 };\n+ 428\n+ 429 // implementation of helper - I put it into the template to avoid having\n+ 430 // to compile it in a dedicated compilation unit\n+ 431 template\n+ 432 bool BitSetVectorReference::xor_helper(bool a, bool b)\n+ 433 {\n+ 434 return a ^ b;\n+ 435 }\n+ 436\n+ 440 template\n+441 struct const_reference< BitSetVectorReference >\n+ 442 {\n+443 typedef BitSetVectorConstReference type;\n+ 444 };\n+ 445\n+ 446 template\n+447 struct const_reference< BitSetVectorConstReference >\n+ 448 {\n+449 typedef BitSetVectorConstReference type;\n+ 450 };\n+ 451\n+ 452 template\n+453 struct mutable_reference< BitSetVectorReference >\n+ 454 {\n+455 typedef BitSetVectorReference type;\n+ 456 };\n+ 457\n+ 458 template\n+459 struct mutable_reference< BitSetVectorConstReference >\n+ 460 {\n+461 typedef BitSetVectorReference type;\n+ 462 };\n+ 463\n+ 467 template >\n+468 class BitSetVector : private std::vector\n+ 469 {\n+ 471 typedef std::vector BlocklessBaseClass;\n+ 472\n+ 473 public:\n+ 476\n+478 typedef std::bitset value_type;\n+ 479\n+481 typedef BitSetVectorReference reference;\n+ 482\n+484 typedef BitSetVectorConstReference const_reference;\n+ 485\n+487 typedef BitSetVectorReference* pointer;\n+ 488\n+490 typedef BitSetVectorConstReference* const_pointer;\n+ 491\n+493 typedef typename std::vector::size_type size_type;\n+ 494\n+496 typedef Allocator allocator_type;\n+ 498\n+501 typedef Dune::GenericIterator,\n+value_type, reference, std::ptrdiff_t, ForwardIteratorFacade> iterator;\n+502 typedef Dune::GenericIterator,\n+const value_type, const_reference, std::ptrdiff_t, ForwardIteratorFacade>\n+const_iterator;\n+ 504\n+506 iterator begin(){\n+ 507 return iterator(*this, 0);\n+ 508 }\n+ 509\n+511 const_iterator begin() const {\n+ 512 return const_iterator(*this, 0);\n+ 513 }\n+ 514\n+516 iterator end(){\n+ 517 return iterator(*this, size());\n+ 518 }\n+ 519\n+521 const_iterator end() const {\n+ 522 return const_iterator(*this, size());\n+ 523 }\n+ 524\n+526 BitSetVector() :\n+ 527 BlocklessBaseClass()\n+ 528 {}\n+ 529\n+531 BitSetVector(const BlocklessBaseClass& blocklessBitField) :\n+ 532 BlocklessBaseClass(blocklessBitField)\n+ 533 {\n+ 534 if (blocklessBitField.size()%block_size != 0)\n+ 535 DUNE_THROW(RangeError, \"Vector size is not a multiple of the block\n+size!\");\n+ 536 }\n+ 537\n+541 explicit BitSetVector(int n) :\n+ 542 BlocklessBaseClass(n*block_size)\n+ 543 {}\n+ 544\n+546 BitSetVector(int n, bool v) :\n+ 547 BlocklessBaseClass(n*block_size,v)\n+ 548 {}\n+ 549\n+551 void clear()\n+ 552 {\n+ 553 BlocklessBaseClass::clear();\n+ 554 }\n+ 555\n+557 void resize(int n, bool v = bool())\n+ 558 {\n+ 559 BlocklessBaseClass::resize(n*block_size, v);\n+ 560 }\n+ 561\n+563 size_type size() const\n+ 564 {\n+ 565 return BlocklessBaseClass::size()/block_size;\n+ 566 }\n+ 567\n+569 void setAll() {\n+ 570 this->assign(BlocklessBaseClass::size(), true);\n+ 571 }\n+ 572\n+574 void unsetAll() {\n+ 575 this->assign(BlocklessBaseClass::size(), false);\n+ 576 }\n+ 577\n+579 reference operator[](int i)\n+ 580 {\n+ 581 return reference(*this, i);\n+ 582 }\n+ 583\n+585 const_reference operator[](int i) const\n+ 586 {\n+ 587 return const_reference(*this, i);\n+ 588 }\n+ 589\n+591 reference back()\n+ 592 {\n+ 593 return reference(*this, size()-1);\n+ 594 }\n+ 595\n+597 const_reference back() const\n+ 598 {\n+ 599 return const_reference(*this, size()-1);\n+ 600 }\n+ 601\n+603 size_type count() const\n+ 604 {\n+ 605 return std::count(BlocklessBaseClass::begin(), BlocklessBaseClass::end(),\n+true);\n+ 606 }\n+ 607\n+609 size_type countmasked(int j) const\n+ 610 {\n+ 611 size_type n = 0;\n+ 612 size_type blocks = size();\n+ 613 for(size_type i=0; i::reference getBit(size_type i, size_type j) {\n+ 638 DUNE_ASSERT_BOUNDS(j < block_size);\n+ 639 DUNE_ASSERT_BOUNDS(i < size());\n+ 640 return BlocklessBaseClass::operator[](i*block_size+j);\n+ 641 }\n+ 642\n+643 typename std::vector::const_reference getBit(size_type i, size_type\n+j) const {\n+ 644 DUNE_ASSERT_BOUNDS(j < block_size);\n+ 645 DUNE_ASSERT_BOUNDS(i < size());\n+ 646 return BlocklessBaseClass::operator[](i*block_size+j);\n+ 647 }\n+ 648\n+ 649 friend class BitSetVectorReference;\n+ 650 friend class BitSetVectorConstReference;\n+ 651 };\n+ 652\n+ 653} // namespace Dune\n+ 654\n+ 655#endif\n+genericiterator.hh\n+Implements a generic iterator class for writing stl conformant iterators.\n+boundschecking.hh\n+Macro for wrapping boundary checks.\n+exceptions.hh\n+A few common exception classes.\n+DUNE_ASSERT_BOUNDS\n+#define DUNE_ASSERT_BOUNDS(cond)\n+If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do\n+nothing.\n+Definition: boundschecking.hh:30\n+Dune::FloatCmp::eq\n+bool eq(const T &first, const T &second, typename EpsilonType< T >::Type\n+epsilon)\n+test for equality using epsilon\n+Definition: float_cmp.cc:144\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::IteratorRange\n-Simple range between a begin and an end iterator.\n-Definition: iteratorrange.hh:22\n-Dune::IteratorRange::begin\n-iterator begin() const\n-Returns an iterator pointing to the begin of the range.\n-Definition: iteratorrange.hh:46\n-Dune::IteratorRange::const_iterator\n-Iterator const_iterator\n-The iterator belonging to this range.\n-Definition: iteratorrange.hh:33\n-Dune::IteratorRange::end\n-iterator end() const\n-Returns an iterator pointing past the end of the range.\n-Definition: iteratorrange.hh:52\n-Dune::IteratorRange::IteratorRange\n-IteratorRange()\n-Default constructor, relies on iterators being default-constructible.\n-Definition: iteratorrange.hh:42\n-Dune::IteratorRange::iterator\n-Iterator iterator\n-The iterator belonging to this range.\n-Definition: iteratorrange.hh:27\n-Dune::IteratorRange::IteratorRange\n-IteratorRange(const Iterator &begin, const Iterator &end)\n-Constructs an iterator range on [begin,end).\n-Definition: iteratorrange.hh:36\n+Dune::assign\n+void assign(T &dst, const T &src, bool mask)\n+masked Simd assignment (scalar version)\n+Definition: simd.hh:447\n+Dune::BitSetVector\n+A dynamic array of blocks of booleans.\n+Definition: bitsetvector.hh:469\n+Dune::BitSetVector::operator[]\n+const_reference operator[](int i) const\n+Return const reference to i-th block.\n+Definition: bitsetvector.hh:585\n+Dune::BitSetVector::begin\n+iterator begin()\n+Returns a iterator pointing to the beginning of the vector.\n+Definition: bitsetvector.hh:506\n+Dune::BitSetVector::const_pointer\n+BitSetVectorConstReference< block_size, Allocator > * const_pointer\n+Const pointer to a small block of bits.\n+Definition: bitsetvector.hh:490\n+Dune::BitSetVector::end\n+const_iterator end() const\n+Returns a const_iterator pointing to the end of the vector.\n+Definition: bitsetvector.hh:521\n+Dune::BitSetVector::reference\n+BitSetVectorReference< block_size, Allocator > reference\n+Reference to a small block of bits.\n+Definition: bitsetvector.hh:481\n+Dune::BitSetVector::countmasked\n+size_type countmasked(int j) const\n+Returns the number of set bits, while each block is masked with 1< const_reference\n+Const reference to a small block of bits.\n+Definition: bitsetvector.hh:484\n+Dune::BitSetVector::end\n+iterator end()\n+Returns an iterator pointing to the end of the vector.\n+Definition: bitsetvector.hh:516\n+Dune::BitSetVector::count\n+size_type count() const\n+Returns the number of bits that are set.\n+Definition: bitsetvector.hh:603\n+Dune::BitSetVector::BitSetVector\n+BitSetVector()\n+Default constructor.\n+Definition: bitsetvector.hh:526\n+Dune::BitSetVector::setAll\n+void setAll()\n+Sets all entries to true\n+Definition: bitsetvector.hh:569\n+Dune::BitSetVector::const_iterator\n+Dune::GenericIterator< const BitSetVector< block_size, Allocator >, const\n+value_type, const_reference, std::ptrdiff_t, ForwardIteratorFacade >\n+const_iterator\n+Definition: bitsetvector.hh:502\n+Dune::BitSetVector::value_type\n+std::bitset< block_size > value_type\n+Type of the values stored by the container.\n+Definition: bitsetvector.hh:478\n+Dune::BitSetVector::back\n+reference back()\n+Return reference to last block.\n+Definition: bitsetvector.hh:591\n+Dune::BitSetVector::BitSetVector\n+BitSetVector(const BlocklessBaseClass &blocklessBitField)\n+Construction from an unblocked bitfield.\n+Definition: bitsetvector.hh:531\n+Dune::BitSetVector::operator<<\n+friend std::ostream & operator<<(std::ostream &s, const BitSetVector &v)\n+Send bitfield to an output stream.\n+Definition: bitsetvector.hh:619\n+Dune::BitSetVector::back\n+const_reference back() const\n+Return const reference to last block.\n+Definition: bitsetvector.hh:597\n+Dune::BitSetVector::clear\n+void clear()\n+Erases all of the elements.\n+Definition: bitsetvector.hh:551\n+Dune::BitSetVector::pointer\n+BitSetVectorReference< block_size, Allocator > * pointer\n+Pointer to a small block of bits.\n+Definition: bitsetvector.hh:487\n+Dune::BitSetVector::operator[]\n+reference operator[](int i)\n+Return reference to i-th block.\n+Definition: bitsetvector.hh:579\n+Dune::BitSetVector::size\n+size_type size() const\n+Return the number of blocks.\n+Definition: bitsetvector.hh:563\n+Dune::BitSetVector::size_type\n+std::vector< bool, Allocator >::size_type size_type\n+size type\n+Definition: bitsetvector.hh:493\n+Dune::BitSetVector::BitSetVector\n+BitSetVector(int n, bool v)\n+Constructor which initializes the field with true or false.\n+Definition: bitsetvector.hh:546\n+Dune::BitSetVector::begin\n+const_iterator begin() const\n+Returns a const_iterator pointing to the beginning of the vector.\n+Definition: bitsetvector.hh:511\n+Dune::BitSetVector::iterator\n+Dune::GenericIterator< BitSetVector< block_size, Allocator >, value_type,\n+reference, std::ptrdiff_t, ForwardIteratorFacade > iterator\n+Definition: bitsetvector.hh:501\n+Dune::BitSetVector::resize\n+void resize(int n, bool v=bool())\n+Resize field.\n+Definition: bitsetvector.hh:557\n+Dune::BitSetVector::allocator_type\n+Allocator allocator_type\n+The type of the allocator.\n+Definition: bitsetvector.hh:496\n+Dune::BitSetVector::BitSetVector\n+BitSetVector(int n)\n+Definition: bitsetvector.hh:541\n+Dune::BitSetVector::unsetAll\n+void unsetAll()\n+Sets all entries to false\n+Definition: bitsetvector.hh:574\n+Dune::BitSetVectorReference\n+A proxy class that acts as a mutable reference to a single bitset in a\n+BitSetVector.\n+Definition: bitsetvector.hh:222\n+Dune::BitSetVectorReference::test\n+bool test(size_type n) const\n+Returns true if bit n is set.\n+Definition: bitsetvector.hh:124\n+Dune::BitSetVectorReference::operator=\n+BitSetVectorReference & operator=(const BitSetVectorConstReference &b)\n+Assignment from BitSetVectorConstReference.\n+Definition: bitsetvector.hh:266\n+Dune::BitSetVectorReference::operator[]\n+reference operator[](size_type i)\n+Return reference to the i-th bit.\n+Definition: bitsetvector.hh:413\n+Dune::BitSetVectorReference::reset\n+BitSetVectorReference & reset(size_type n)\n+Clears bit n.\n+Definition: bitsetvector.hh:396\n+Dune::BitSetVectorReference::operator<<=\n+BitSetVectorReference & operator<<=(size_type n)\n+Left shift.\n+Definition: bitsetvector.hh:350\n+Dune::BitSetVectorReference::BitSetVector\n+Dune::BitSetVector< block_size, Alloc > BitSetVector\n+Definition: bitsetvector.hh:225\n+Dune::BitSetVectorReference::const_reference\n+std::vector< bool, Alloc >::const_reference const_reference\n+A proxy class that acts as a const reference to a single bit.\n+Definition: bitsetvector.hh:243\n+Dune::BitSetVectorReference::operator=\n+BitSetVectorReference & operator=(const BitSetVectorReference &b)\n+Assignment from BitSetVectorReference.\n+Definition: bitsetvector.hh:274\n+Dune::BitSetVectorReference::getBit\n+reference getBit(size_type i)\n+Definition: bitsetvector.hh:423\n+Dune::BitSetVectorReference::operator&=\n+BitSetVectorReference & operator&=(const BitSetVectorConstReference &x)\n+Bitwise and (for BitSetVectorConstReference and BitSetVectorReference)\n+Definition: bitsetvector.hh:290\n+Dune::BitSetVectorReference::BitSetVectorReference\n+BitSetVectorReference(BitSetVector &blockBitField_, int block_number_)\n+Definition: bitsetvector.hh:230\n+Dune::BitSetVectorReference::size_type\n+size_t size_type\n+size_type typedef (an unsigned integral type)\n+Definition: bitsetvector.hh:247\n+Dune::BitSetVectorReference::operator=\n+BitSetVectorReference & operator=(const bitset &b)\n+Assignment from bitset.\n+Definition: bitsetvector.hh:258\n+Dune::BitSetVectorReference::BitSetVectorConstReference\n+Dune::BitSetVectorConstReference< block_size, Alloc >\n+BitSetVectorConstReference\n+Definition: bitsetvector.hh:228\n+Dune::BitSetVectorReference::reset\n+BitSetVectorReference & reset()\n+Clears every bit.\n+Definition: bitsetvector.hh:382\n+Dune::BitSetVectorReference::blockBitField\n+BitSetVector & blockBitField\n+Definition: bitsetvector.hh:419\n+Dune::BitSetVectorReference::operator|=\n+BitSetVectorReference & operator|=(const BitSetVectorConstReference &x)\n+Bitwise inclusive or (for BitSetVectorConstReference and BitSetVectorReference)\n+Definition: bitsetvector.hh:306\n+Dune::BitSetVectorReference::set\n+BitSetVectorReference & set(size_type n, int val=1)\n+Sets bit n if val is nonzero, and clears bit n if val is zero.\n+Definition: bitsetvector.hh:389\n+Dune::BitSetVectorReference::bitset\n+std::bitset< block_size > bitset\n+Definition: bitsetvector.hh:236\n+Dune::BitSetVectorReference::operator^=\n+BitSetVectorReference & operator^=(const bitset &x)\n+Bitwise exclusive or (for bitset).\n+Definition: bitsetvector.hh:314\n+Dune::BitSetVectorReference::reference\n+std::vector< bool, Alloc >::reference reference\n+Definition: bitsetvector.hh:241\n+Dune::BitSetVectorReference::operator|=\n+BitSetVectorReference & operator|=(const bitset &x)\n+Bitwise inclusive or (for bitset)\n+Definition: bitsetvector.hh:298\n+Dune::BitSetVectorReference::operator>>=\n+BitSetVectorReference & operator>>=(size_type n)\n+Right shift.\n+Definition: bitsetvector.hh:358\n+Dune::BitSetVectorReference::operator^=\n+BitSetVectorReference & operator^=(const BitSetVectorConstReference &x)\n+Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference)\n+Definition: bitsetvector.hh:340\n+Dune::BitSetVectorReference::flip\n+BitSetVectorReference & flip(size_type n)\n+Flips bit n.\n+Definition: bitsetvector.hh:403\n+Dune::BitSetVectorReference::flip\n+BitSetVectorReference & flip()\n+Flips the value of every bit.\n+Definition: bitsetvector.hh:374\n+Dune::BitSetVectorReference::set\n+BitSetVectorReference & set()\n+Sets every bit.\n+Definition: bitsetvector.hh:366\n+Dune::BitSetVectorReference::operator&=\n+BitSetVectorReference & operator&=(const bitset &x)\n+Bitwise and (for bitset).\n+Definition: bitsetvector.hh:282\n+Dune::BitSetVectorReference::operator=\n+BitSetVectorReference & operator=(bool b)\n+Assignment from bool, sets each bit in the bitset to b.\n+Definition: bitsetvector.hh:250\n+Dune::BitSetVectorConstReference\n+A proxy class that acts as a const reference to a single bitset in a\n+BitSetVector.\n+Definition: bitsetvector.hh:38\n+Dune::BitSetVectorConstReference::operator==\n+bool operator==(const bitset &bs) const\n+Equality of reference and std::bitset.\n+Definition: bitsetvector.hh:142\n+Dune::BitSetVectorConstReference::test\n+bool test(size_type n) const\n+Returns true if bit n is set.\n+Definition: bitsetvector.hh:124\n+Dune::BitSetVectorConstReference::operator[]\n+const_reference operator[](size_type i) const\n+Return reference to the i-th bit.\n+Definition: bitsetvector.hh:130\n+Dune::BitSetVectorConstReference::operator<<\n+bitset operator<<(size_type n) const\n+Returns a copy of *this shifted left by n bits.\n+Definition: bitsetvector.hh:64\n+Dune::BitSetVectorConstReference::operator=\n+BitSetVectorConstReference & operator=(const BitSetVectorConstReference &b)\n+hide assignment operator\n+Dune::BitSetVectorConstReference::BitSetVectorConstReference\n+BitSetVectorConstReference(const BitSetVector &blockBitField_, int\n+block_number_)\n+Definition: bitsetvector.hh:44\n+Dune::BitSetVectorConstReference::blockBitField\n+const BitSetVector & blockBitField\n+Definition: bitsetvector.hh:181\n+Dune::BitSetVectorConstReference::operator>>\n+bitset operator>>(size_type n) const\n+Returns a copy of *this shifted right by n bits.\n+Definition: bitsetvector.hh:72\n+Dune::BitSetVectorConstReference::getBit\n+const_reference getBit(size_type i) const\n+Definition: bitsetvector.hh:184\n+Dune::BitSetVectorConstReference::operator!=\n+bool operator!=(const bitset &bs) const\n+Inequality of reference and std::bitset.\n+Definition: bitsetvector.hh:154\n+Dune::BitSetVectorConstReference::equals\n+bool equals(const BS &bs) const\n+Definition: bitsetvector.hh:190\n+Dune::BitSetVectorConstReference::BitSetVector\n+Dune::BitSetVector< block_size, Alloc > BitSetVector\n+Definition: bitsetvector.hh:41\n+Dune::BitSetVectorConstReference::bitset\n+std::bitset< block_size > bitset\n+Definition: bitsetvector.hh:56\n+Dune::BitSetVectorConstReference::all\n+bool all() const\n+Returns true if all bits are set.\n+Definition: bitsetvector.hh:115\n+Dune::BitSetVectorConstReference::size_type\n+size_t size_type\n+Definition: bitsetvector.hh:61\n+Dune::BitSetVectorConstReference::operator~\n+bitset operator~() const\n+Returns a copy of *this with all of its bits flipped.\n+Definition: bitsetvector.hh:80\n+Dune::BitSetVectorConstReference::reference\n+std::vector< bool, Alloc >::const_reference reference\n+Definition: bitsetvector.hh:59\n+Dune::BitSetVectorConstReference::size\n+size_type size() const\n+Returns block_size.\n+Definition: bitsetvector.hh:88\n+Dune::BitSetVectorConstReference::count\n+size_type count() const\n+Returns the number of bits that are set.\n+Definition: bitsetvector.hh:94\n+Dune::BitSetVectorConstReference::none\n+bool none() const\n+Returns true if no bits are set.\n+Definition: bitsetvector.hh:109\n+Dune::BitSetVectorConstReference::any\n+bool any() const\n+Returns true if any bits are set.\n+Definition: bitsetvector.hh:103\n+Dune::BitSetVectorConstReference::block_number\n+int block_number\n+Definition: bitsetvector.hh:182\n+Dune::BitSetVectorConstReference::const_reference\n+std::vector< bool, Alloc >::const_reference const_reference\n+Definition: bitsetvector.hh:60\n+Dune::const_reference<_BitSetVectorReference<_block_size,_Alloc_>_>::type\n+BitSetVectorConstReference< block_size, Alloc > type\n+Definition: bitsetvector.hh:443\n+Dune::const_reference<_BitSetVectorConstReference<_block_size,_Alloc_>_>::type\n+BitSetVectorConstReference< block_size, Alloc > type\n+Definition: bitsetvector.hh:449\n+Dune::mutable_reference<_BitSetVectorReference<_block_size,_Alloc_>_>::type\n+BitSetVectorReference< block_size, Alloc > type\n+Definition: bitsetvector.hh:455\n+Dune::mutable_reference<_BitSetVectorConstReference<_block_size,_Alloc_>_>::\n+type\n+BitSetVectorReference< block_size, Alloc > type\n+Definition: bitsetvector.hh:461\n+Dune::RangeError\n+Default exception class for range errors.\n+Definition: exceptions.hh:254\n+Dune::const_reference\n+Get the 'const' version of a reference to a mutable object.\n+Definition: genericiterator.hh:87\n+Dune::mutable_reference\n+get the 'mutable' version of a reference to a const object\n+Definition: genericiterator.hh:116\n+Dune::GenericIterator\n+Generic class for stl-conforming iterators for container classes with operator\n+[].\n+Definition: genericiterator.hh:153\n+Dune::ForwardIteratorFacade\n+Base class for stl conformant forward iterators.\n+Definition: iteratorfacades.hh:141\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00023.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00023.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: keywords.hh File Reference\n+dune-common: hybridutilities.hh File Reference\n \n \n \n \n \n \n \n@@ -63,63 +63,85 @@\n
    \n \n
    \n \n
    \n
    \n-Macros
    \n-
    keywords.hh File Reference
    \n+Namespaces |\n+Functions
    \n+
    hybridutilities.hh File Reference
    \n \n
    \n-\n-

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

    \n-\n+
    #include <tuple>
    \n+#include <utility>
    \n+#include <dune/common/typetraits.hh>
    \n+#include <dune/common/typeutilities.hh>
    \n+#include <dune/common/fvector.hh>
    \n+#include <dune/common/indices.hh>
    \n+#include <dune/common/assertandreturn.hh>
    \n+#include <dune/common/rangeutilities.hh>
    \n+
    \n

    Go to the source code of this file.

    \n \n-\n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+

    \n-Macros

    #define DUNE_INLINE_VARIABLE   inline
     
    #define DUNE_GENERALIZED_CONSTEXPR   constexpr
     

    \n+Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Hybrid
     
    \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n+Functions

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

    Detailed Description

    \n-

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

    \n-

    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.

    \n-

    Macro Definition Documentation

    \n-\n-

    ◆ DUNE_GENERALIZED_CONSTEXPR

    \n-\n-
    \n-
    \n- \n- \n- \n- \n-
    #define DUNE_GENERALIZED_CONSTEXPR   constexpr
    \n-
    \n-\n-
    \n-
    \n-\n-

    ◆ DUNE_INLINE_VARIABLE

    \n-\n-
    \n-
    \n- \n- \n- \n- \n-
    #define DUNE_INLINE_VARIABLE   inline
    \n-
    \n-\n-
    \n-
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,31 +4,79 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Macros\n-keywords.hh File Reference\n-Common \u00bb Utilities \u00bb C++_utilities_and_backports\n-Definitions of several macros that conditionally make C++ syntax available.\n-More...\n+Namespaces | Functions\n+hybridutilities.hh File Reference\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Macros\n-#define\u00a0DUNE_INLINE_VARIABLE\u00a0\u00a0\u00a0inline\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n \u00a0\n-#define\u00a0DUNE_GENERALIZED_CONSTEXPR\u00a0\u00a0\u00a0constexpr\n+namespace \u00a0Dune::Hybrid\n+\u00a0\n+ Functions\n+template\n+ constexpr auto\u00a0Dune::Hybrid::size (const T &t)\n+\u00a0 Size query. More...\n+\u00a0\n+template\n+constexpr decltype(auto)\u00a0Dune::Hybrid::elementAt (Container &&c, Index &&i)\n+\u00a0 Get element at given position from container. More...\n+\u00a0\n+template\n+ constexpr auto\u00a0Dune::Hybrid::integralRange (const Begin &begin,\n+ const End &end)\n+\u00a0 Create an integral range. More...\n+\u00a0\n+template\n+ constexpr auto\u00a0Dune::Hybrid::integralRange (const End &end)\n+\u00a0 Create an integral range starting from 0. More...\n+\u00a0\n+template\n+ constexpr void\u00a0Dune::Hybrid::forEach (Range &&range, F &&f)\n+\u00a0 Range based for loop. More...\n+\u00a0\n+template\n+ constexpr T\u00a0Dune::Hybrid::accumulate (Range &&range, T value, F\n+ &&f)\n+\u00a0 Accumulate values. More...\n+\u00a0\n+template\n+ decltype(auto)\u00a0Dune::Hybrid::ifElse (const Condition &condition,\n+ IfFunc &&ifFunc, ElseFunc &&elseFunc)\n+\u00a0 A conditional expression. More...\n+\u00a0\n+template\n+ void\u00a0Dune::Hybrid::ifElse (const Condition &condition,\n+ IfFunc &&ifFunc)\n+\u00a0 A conditional expression. More...\n+\u00a0\n+template\n+ constexpr auto\u00a0Dune::Hybrid::equals (T1 &&t1, T2 &&t2)\n+\u00a0 Equality comparison. More...\n+\u00a0\n+template\n+constexpr decltype(auto)\u00a0Dune::Hybrid::switchCases (const Cases &cases, const\n+ Value &value, Branches &&branches, ElseBranch\n+ &&elseBranch)\n+\u00a0 Switch statement. More...\n+\u00a0\n+template\n+ constexpr void\u00a0Dune::Hybrid::switchCases (const Cases &cases, const\n+ Value &value, Branches &&branches)\n+\u00a0 Switch statement. More...\n \u00a0\n-***** Detailed Description *****\n-Definitions of several macros that conditionally make C++ syntax available.\n-This header contains several macros that enable C++ features depending on your\n-compiler. Most of these features are optional and provide additional\n-functionality like making code constexpr.\n-***** Macro Definition Documentation *****\n-***** \u25c6\u00a0DUNE_GENERALIZED_CONSTEXPR *****\n-#define DUNE_GENERALIZED_CONSTEXPR\u00a0\u00a0\u00a0constexpr\n-***** \u25c6\u00a0DUNE_INLINE_VARIABLE *****\n-#define DUNE_INLINE_VARIABLE\u00a0\u00a0\u00a0inline\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00023_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: keywords.hh Source File\n+dune-common: hybridutilities.hh Source File\n \n \n \n \n \n \n \n@@ -62,39 +62,354 @@\n \n
    \n \n
    \n \n
    \n-
    keywords.hh
    \n+
    hybridutilities.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n-
    2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    3#ifndef DUNE_COMMON_KEYWORDS_HH
    \n-
    4#define DUNE_COMMON_KEYWORDS_HH
    \n-
    5
    \n-
    18#if __cpp_inline_variables >= 201606
    \n-
    19#define DUNE_INLINE_VARIABLE inline
    \n-
    20#else
    \n+Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n+
    2// vi: set et ts=4 sw=2 sts=2:
    \n+
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n+
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n+
    5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH
    \n+
    6#define DUNE_COMMON_HYBRIDUTILITIES_HH
    \n+
    7
    \n+
    8#include <tuple>
    \n+
    9#include <utility>
    \n+
    10
    \n+\n+\n+\n+\n+\n+\n+
    17
    \n+
    18
    \n+
    19
    \n+
    20namespace Dune {
    \n+
    21namespace Hybrid {
    \n
    22
    \n-
    25#define DUNE_INLINE_VARIABLE
    \n-
    26#endif
    \n-
    27
    \n-
    28
    \n-
    29#if __cpp_constexpr >= 201304
    \n-
    30#define DUNE_GENERALIZED_CONSTEXPR constexpr
    \n-
    31#else
    \n-
    33
    \n-
    36#define DUNE_GENERALIZED_CONSTEXPR
    \n-
    37#endif
    \n-
    38
    \n-
    39
    \n-
    40#endif // DUNE_COMMON_KEYWORDS_HH
    \n+
    23namespace Impl {
    \n+
    24
    \n+
    25 // Try if tuple_size is implemented for class
    \n+
    26 template<class T, int i>
    \n+
    27 constexpr auto size(const Dune::FieldVector<T, i>&, const PriorityTag<5>&)
    \n+
    28 -> decltype(std::integral_constant<std::size_t,i>())
    \n+
    29 {
    \n+
    30 return {};
    \n+
    31 }
    \n+
    32
    \n+
    33 // Try if tuple_size is implemented for class
    \n+
    34 template<class T>
    \n+
    35 constexpr auto size(const T&, const PriorityTag<3>&)
    \n+
    36 -> decltype(std::integral_constant<std::size_t,std::tuple_size<T>::value>())
    \n+
    37 {
    \n+
    38 return {};
    \n+
    39 }
    \n+
    40
    \n+
    41 // Try if there's a static constexpr size()
    \n+
    42 template<class T>
    \n+
    43 constexpr auto size(const T&, const PriorityTag<1>&)
    \n+
    44 -> decltype(std::integral_constant<std::size_t,T::size()>())
    \n+
    45 {
    \n+
    46 return {};
    \n+
    47 }
    \n+
    48
    \n+
    49 // As a last resort try if there's a static constexpr size()
    \n+
    50 template<class T>
    \n+
    51 constexpr auto size(const T& t, const PriorityTag<0>&)
    \n+
    52 {
    \n+
    53 return t.size();
    \n+
    54 }
    \n+
    55
    \n+
    56} // namespace Impl
    \n+
    57
    \n+
    58
    \n+
    59
    \n+
    81template<class T>
    \n+
    82constexpr auto size(const T& t)
    \n+
    83{
    \n+
    84 return Impl::size(t, PriorityTag<42>());
    \n+
    85}
    \n+
    86
    \n+
    87
    \n+
    88
    \n+
    89namespace Impl {
    \n+
    90
    \n+
    91 template<class Container, class Index,
    \n+
    92 std::enable_if_t<IsTuple<std::decay_t<Container>>::value, int> = 0>
    \n+
    93 constexpr decltype(auto) elementAt(Container&& c, Index&&, PriorityTag<2>)
    \n+
    94 {
    \n+
    95 return std::get<std::decay_t<Index>::value>(c);
    \n+
    96 }
    \n+
    97
    \n+
    98 template<class T, T... t, class Index>
    \n+
    99 constexpr decltype(auto) elementAt(std::integer_sequence<T, t...> c, Index, PriorityTag<1>)
    \n+
    100 {
    \n+
    101 return Dune::integerSequenceEntry(c, std::integral_constant<std::size_t, Index::value>());
    \n+
    102 }
    \n+
    103
    \n+
    104 template<class Container, class Index>
    \n+
    105 constexpr decltype(auto) elementAt(Container&& c, Index&& i, PriorityTag<0>)
    \n+
    106 {
    \n+
    107 return c[i];
    \n+
    108 }
    \n+
    109
    \n+
    110} // namespace Impl
    \n+
    111
    \n+
    112
    \n+
    113
    \n+
    134template<class Container, class Index>
    \n+
    135constexpr decltype(auto) elementAt(Container&& c, Index&& i)
    \n+
    136{
    \n+
    137 return Impl::elementAt(std::forward<Container>(c), std::forward<Index>(i), PriorityTag<42>());
    \n+
    138}
    \n+
    139
    \n+
    140
    \n+
    141
    \n+
    142namespace Impl {
    \n+
    143
    \n+
    144 template<class Begin, class End,
    \n+
    145 std::enable_if_t<IsIntegralConstant<Begin>::value and IsIntegralConstant<End>::value, int> = 0>
    \n+
    146 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/, const PriorityTag<1>&)
    \n+
    147 {
    \n+
    148 static_assert(Begin::value <= End::value, "You cannot create an integralRange where end<begin");
    \n+\n+
    150 }
    \n+
    151
    \n+
    152 // This should be constexpr but gcc-4.9 does not support
    \n+
    153 // the relaxed constexpr requirements. Hence for being
    \n+
    154 // constexpr the function body can only contain a return
    \n+
    155 // statement and no assertion before this.
    \n+
    156 template<class Begin, class End>
    \n+
    157 constexpr auto integralRange(const Begin& begin, const End& end, const PriorityTag<0>&)
    \n+
    158 {
    \n+
    159 return DUNE_ASSERT_AND_RETURN(begin<=end, Dune::IntegralRange<End>(begin, end));
    \n+
    160 }
    \n+
    161
    \n+
    162} // namespace Impl
    \n+
    163
    \n+
    164
    \n+
    165
    \n+
    183template<class Begin, class End>
    \n+
    184constexpr auto integralRange(const Begin& begin, const End& end)
    \n+
    185{
    \n+
    186 return Impl::integralRange(begin, end, PriorityTag<42>());
    \n+
    187}
    \n+
    188
    \n+
    202template<class End>
    \n+
    203constexpr auto integralRange(const End& end)
    \n+
    204{
    \n+\n+
    206}
    \n+
    207
    \n+
    208
    \n+
    209
    \n+
    210namespace Impl {
    \n+
    211
    \n+
    212 template<class T>
    \n+
    213 constexpr void evaluateFoldExpression(std::initializer_list<T>&&)
    \n+
    214 {}
    \n+
    215
    \n+
    216 template<class Range, class F, class Index, Index... i>
    \n+
    217 constexpr void forEachIndex(Range&& range, F&& f, std::integer_sequence<Index, i...>)
    \n+
    218 {
    \n+
    219 evaluateFoldExpression<int>({(f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)...});
    \n+
    220 }
    \n+
    221
    \n+
    222 template<class F, class Index, Index... i>
    \n+
    223 constexpr void forEach(std::integer_sequence<Index, i...> /*range*/, F&& f, PriorityTag<2>)
    \n+
    224 {
    \n+
    225 evaluateFoldExpression<int>({(f(std::integral_constant<Index,i>()), 0)...});
    \n+
    226 }
    \n+
    227
    \n+
    228
    \n+
    229 template<class Range, class F,
    \n+
    230 std::enable_if_t<IsIntegralConstant<decltype(Hybrid::size(std::declval<Range>()))>::value, int> = 0>
    \n+
    231 constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)
    \n+
    232 {
    \n+
    233 auto size = Hybrid::size(range);
    \n+
    234 auto indices = std::make_index_sequence<size>();
    \n+
    235 (forEachIndex)(std::forward<Range>(range), std::forward<F>(f), indices);
    \n+
    236 }
    \n+
    237
    \n+
    238 template<class Range, class F>
    \n+
    239 constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)
    \n+
    240 {
    \n+
    241 for(auto&& e : range)
    \n+
    242 f(e);
    \n+
    243 }
    \n+
    244
    \n+
    245} // namespace Impl
    \n+
    246
    \n+
    247
    \n+
    248
    \n+
    267template<class Range, class F>
    \n+
    268constexpr void forEach(Range&& range, F&& f)
    \n+
    269{
    \n+
    270 Impl::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>());
    \n+
    271}
    \n+
    272
    \n+
    273
    \n+
    274
    \n+
    290template<class Range, class T, class F>
    \n+
    291constexpr T accumulate(Range&& range, T value, F&& f)
    \n+
    292{
    \n+
    293 forEach(std::forward<Range>(range), [&](auto&& entry) {
    \n+
    294 value = f(value, entry);
    \n+
    295 });
    \n+
    296 return value;
    \n+
    297}
    \n+
    298
    \n+
    299
    \n+
    300
    \n+
    301namespace Impl {
    \n+
    302
    \n+
    303 struct Id {
    \n+
    304 template<class T>
    \n+
    305 constexpr T operator()(T&& x) const {
    \n+
    306 return std::forward<T>(x);
    \n+
    307 }
    \n+
    308 };
    \n+
    309
    \n+
    310 template<class IfFunc, class ElseFunc>
    \n+
    311 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc, ElseFunc&& /*elseFunc*/)
    \n+
    312 {
    \n+
    313 return ifFunc(Id{});
    \n+
    314 }
    \n+
    315
    \n+
    316 template<class IfFunc, class ElseFunc>
    \n+
    317 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/, ElseFunc&& elseFunc)
    \n+
    318 {
    \n+
    319 return elseFunc(Id{});
    \n+
    320 }
    \n+
    321
    \n+
    322 template<class IfFunc, class ElseFunc>
    \n+
    323 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
    \n+
    324 {
    \n+
    325 if (condition)
    \n+
    326 return ifFunc(Id{});
    \n+
    327 else
    \n+
    328 return elseFunc(Id{});
    \n+
    329 }
    \n+
    330
    \n+
    331} // namespace Impl
    \n+
    332
    \n+
    333
    \n+
    334
    \n+
    355template<class Condition, class IfFunc, class ElseFunc>
    \n+
    356decltype(auto) ifElse(const Condition& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
    \n+
    357{
    \n+
    358 return Impl::ifElse(condition, std::forward<IfFunc>(ifFunc), std::forward<ElseFunc>(elseFunc));
    \n+
    359}
    \n+
    360
    \n+
    368template<class Condition, class IfFunc>
    \n+
    369void ifElse(const Condition& condition, IfFunc&& ifFunc)
    \n+
    370{
    \n+
    371 ifElse(condition, std::forward<IfFunc>(ifFunc), [](auto&&) {});
    \n+
    372}
    \n+
    373
    \n+
    374
    \n+
    375
    \n+
    376namespace Impl {
    \n+
    377
    \n+
    378 template<class T1, class T2>
    \n+
    379 constexpr auto equals(const T1& /*t1*/, const T2& /*t2*/, PriorityTag<1>) -> decltype(T1::value, T2::value, std::integral_constant<bool,T1::value == T2::value>())
    \n+
    380 { return {}; }
    \n+
    381
    \n+
    382 template<class T1, class T2>
    \n+
    383 constexpr auto equals(const T1& t1, const T2& t2, PriorityTag<0>)
    \n+
    384 {
    \n+
    385 return t1==t2;
    \n+
    386 }
    \n+
    387
    \n+
    388} // namespace Impl
    \n+
    389
    \n+
    390
    \n+
    391
    \n+
    401template<class T1, class T2>
    \n+
    402constexpr auto equals(T1&& t1, T2&& t2)
    \n+
    403{
    \n+
    404 return Impl::equals(std::forward<T1>(t1), std::forward<T2>(t2), PriorityTag<1>());
    \n+
    405}
    \n+
    406
    \n+
    407
    \n+
    408
    \n+
    409namespace Impl {
    \n+
    410
    \n+
    411 template<class Result, class T, class Value, class Branches, class ElseBranch>
    \n+
    412 constexpr Result switchCases(std::integer_sequence<T>, const Value& /*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch)
    \n+
    413 {
    \n+
    414 return elseBranch();
    \n+
    415 }
    \n+
    416
    \n+
    417 template<class Result, class T, T t0, T... tt, class Value, class Branches, class ElseBranch>
    \n+
    418 constexpr Result switchCases(std::integer_sequence<T, t0, tt...>, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
    \n+
    419 {
    \n+
    420 return ifElse(
    \n+
    421 Hybrid::equals(std::integral_constant<T, t0>(), value),
    \n+
    422 [&](auto id) -> decltype(auto) {
    \n+
    423 return id(branches)(std::integral_constant<T, t0>());
    \n+
    424 }, [&](auto id) -> decltype(auto) {
    \n+
    425 return Impl::switchCases<Result>(id(std::integer_sequence<T, tt...>()), value, branches, elseBranch);
    \n+
    426 });
    \n+
    427 }
    \n+
    428
    \n+
    429} // namespace Impl
    \n+
    430
    \n+
    431
    \n+
    432
    \n+
    460template<class Cases, class Value, class Branches, class ElseBranch>
    \n+
    461constexpr decltype(auto) switchCases(const Cases& cases, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
    \n+
    462{
    \n+
    463 return Impl::switchCases<decltype(elseBranch())>(cases, value, std::forward<Branches>(branches), std::forward<ElseBranch>(elseBranch));
    \n+
    464}
    \n+
    465
    \n+
    486template<class Cases, class Value, class Branches>
    \n+
    487constexpr void switchCases(const Cases& cases, const Value& value, Branches&& branches)
    \n+
    488{
    \n+
    489 Impl::switchCases<void>(cases, value, std::forward<Branches>(branches), []() {});
    \n+
    490}
    \n+
    491
    \n+
    492
    \n+
    493} // namespace Hybrid
    \n+
    494} // namespace Dune
    \n+
    495
    \n+
    496
    \n+
    497#endif // #ifndef DUNE_COMMON_HYBRIDUTILITIES_HH
    \n+
    Traits for type conversions and type information.
    \n+
    Utilities for reduction like operations on ranges.
    \n+\n+\n+
    Utilities for type computations, constraining overloads, ...
    \n+
    Implements a vector constructed from a given type representing a field and a compile-time given size.
    \n+
    constexpr index_constant< 0 > _0
    Compile time index with value 0.
    Definition: indices.hh:53
    \n+
    static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
    Definition: rangeutilities.hh:300
    \n+
    void ifElse(const Condition &condition, IfFunc &&ifFunc)
    A conditional expression.
    Definition: hybridutilities.hh:369
    \n+
    constexpr auto size(const T &t)
    Size query.
    Definition: hybridutilities.hh:82
    \n+
    constexpr auto integralRange(const End &end)
    Create an integral range starting from 0.
    Definition: hybridutilities.hh:203
    \n+
    constexpr auto equals(T1 &&t1, T2 &&t2)
    Equality comparison.
    Definition: hybridutilities.hh:402
    \n+
    constexpr void forEach(Range &&range, F &&f)
    Range based for loop.
    Definition: hybridutilities.hh:268
    \n+
    constexpr decltype(auto) switchCases(const Cases &cases, const Value &value, Branches &&branches, ElseBranch &&elseBranch)
    Switch statement.
    Definition: hybridutilities.hh:461
    \n+
    decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
    A conditional expression.
    Definition: hybridutilities.hh:356
    \n+
    constexpr auto integralRange(const Begin &begin, const End &end)
    Create an integral range.
    Definition: hybridutilities.hh:184
    \n+
    constexpr decltype(auto) elementAt(Container &&c, Index &&i)
    Get element at given position from container.
    Definition: hybridutilities.hh:135
    \n+
    constexpr T accumulate(Range &&range, T value, F &&f)
    Accumulate values.
    Definition: hybridutilities.hh:291
    \n+
    constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::integral_constant< std::size_t, index > i)
    Get entry of std::integer_sequence.
    Definition: typetraits.hh:462
    \n+
    #define DUNE_ASSERT_AND_RETURN(C, X)
    Asserts a condition and return on success in constexpr context.
    Definition: assertandreturn.hh:22
    \n+
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    vector space out of a tensor product of fields.
    Definition: fvector.hh:95
    \n+
    dynamic integer range for use in range-based for loops
    Definition: rangeutilities.hh:175
    \n+
    static integer range for use in range-based for loops
    Definition: rangeutilities.hh:225
    \n+
    Check if T is an std::integral_constant<I, i>
    Definition: typetraits.hh:384
    \n+
    Helper class for tagging priorities.
    Definition: typeutilities.hh:73
    \n+
    Helper class for tagging priorities.
    Definition: typeutilities.hh:87
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,35 +4,447 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-keywords.hh\n+hybridutilities.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n+ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n+ 2// vi: set et ts=4 sw=2 sts=2:\n+ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 3#ifndef DUNE_COMMON_KEYWORDS_HH\n- 4#define DUNE_COMMON_KEYWORDS_HH\n- 5\n- 18#if __cpp_inline_variables >= 201606\n-19#define DUNE_INLINE_VARIABLE inline\n- 20#else\n+ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n+ 5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH\n+ 6#define DUNE_COMMON_HYBRIDUTILITIES_HH\n+ 7\n+ 8#include \n+ 9#include \n+ 10\n+ 11#include \n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16#include \n+ 17\n+ 18\n+ 19\n+ 20namespace Dune {\n+21namespace Hybrid {\n 22\n- 25#define DUNE_INLINE_VARIABLE\n- 26#endif\n- 27\n- 28\n- 29#if __cpp_constexpr >= 201304\n-30#define DUNE_GENERALIZED_CONSTEXPR constexpr\n- 31#else\n- 33\n- 36#define DUNE_GENERALIZED_CONSTEXPR\n- 37#endif\n- 38\n- 39\n- 40#endif // DUNE_COMMON_KEYWORDS_HH\n+ 23namespace Impl {\n+ 24\n+ 25 // Try if tuple_size is implemented for class\n+ 26 template\n+ 27 constexpr auto size(const Dune::FieldVector&, const PriorityTag<5>&)\n+ 28 -> decltype(std::integral_constant())\n+ 29 {\n+ 30 return {};\n+ 31 }\n+ 32\n+ 33 // Try if tuple_size is implemented for class\n+ 34 template\n+ 35 constexpr auto size(const T&, const PriorityTag<3>&)\n+ 36 -> decltype(std::integral_constant::value>\n+())\n+ 37 {\n+ 38 return {};\n+ 39 }\n+ 40\n+ 41 // Try if there's a static constexpr size()\n+ 42 template\n+ 43 constexpr auto size(const T&, const PriorityTag<1>&)\n+ 44 -> decltype(std::integral_constant())\n+ 45 {\n+ 46 return {};\n+ 47 }\n+ 48\n+ 49 // As a last resort try if there's a static constexpr size()\n+ 50 template\n+ 51 constexpr auto size(const T& t, const PriorityTag<0>&)\n+ 52 {\n+ 53 return t.size();\n+ 54 }\n+ 55\n+ 56} // namespace Impl\n+ 57\n+ 58\n+ 59\n+ 81template\n+82constexpr auto size(const T& t)\n+ 83{\n+ 84 return Impl::size(t, PriorityTag<42>());\n+ 85}\n+ 86\n+ 87\n+ 88\n+ 89namespace Impl {\n+ 90\n+ 91 template>::value, int> = 0>\n+ 93 constexpr decltype(auto) elementAt(Container&& c, Index&&, PriorityTag<2>)\n+ 94 {\n+ 95 return std::get::value>(c);\n+ 96 }\n+ 97\n+ 98 template\n+ 99 constexpr decltype(auto) elementAt(std::integer_sequence c, Index,\n+PriorityTag<1>)\n+ 100 {\n+ 101 return Dune::integerSequenceEntry(c, std::integral_constant());\n+ 102 }\n+ 103\n+ 104 template\n+ 105 constexpr decltype(auto) elementAt(Container&& c, Index&& i,\n+PriorityTag<0>)\n+ 106 {\n+ 107 return c[i];\n+ 108 }\n+ 109\n+ 110} // namespace Impl\n+ 111\n+ 112\n+ 113\n+ 134template\n+135constexpr decltype(auto) elementAt(Container&& c, Index&& i)\n+ 136{\n+ 137 return Impl::elementAt(std::forward(c), std::forward(i),\n+PriorityTag<42>());\n+ 138}\n+ 139\n+ 140\n+ 141\n+ 142namespace Impl {\n+ 143\n+ 144 template::value and\n+IsIntegralConstant::value, int> = 0>\n+ 146 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/,\n+const PriorityTag<1>&)\n+ 147 {\n+ 148 static_assert(Begin::value <= End::value, \"You cannot create an\n+integralRange where end();\n+ 150 }\n+ 151\n+ 152 // This should be constexpr but gcc-4.9 does not support\n+ 153 // the relaxed constexpr requirements. Hence for being\n+ 154 // constexpr the function body can only contain a return\n+ 155 // statement and no assertion before this.\n+ 156 template\n+ 157 constexpr auto integralRange(const Begin& begin, const End& end, const\n+PriorityTag<0>&)\n+ 158 {\n+ 159 return DUNE_ASSERT_AND_RETURN(begin<=end, Dune::IntegralRange(begin,\n+end));\n+ 160 }\n+ 161\n+ 162} // namespace Impl\n+ 163\n+ 164\n+ 165\n+ 183template\n+184constexpr auto integralRange(const Begin& begin, const End& end)\n+ 185{\n+ 186 return Impl::integralRange(begin, end, PriorityTag<42>());\n+ 187}\n+ 188\n+ 202template\n+203constexpr auto integralRange(const End& end)\n+ 204{\n+ 205 return Impl::integralRange(Dune::Indices::_0, end, PriorityTag<42>());\n+ 206}\n+ 207\n+ 208\n+ 209\n+ 210namespace Impl {\n+ 211\n+ 212 template\n+ 213 constexpr void evaluateFoldExpression(std::initializer_list&&)\n+ 214 {}\n+ 215\n+ 216 template\n+ 217 constexpr void forEachIndex(Range&& range, F&& f, std::\n+integer_sequence)\n+ 218 {\n+ 219 evaluateFoldExpression({(f(Hybrid::elementAt(range, std::\n+integral_constant())), 0)...});\n+ 220 }\n+ 221\n+ 222 template\n+ 223 constexpr void forEach(std::integer_sequence /*range*/, F&&\n+f, PriorityTag<2>)\n+ 224 {\n+ 225 evaluateFoldExpression({(f(std::integral_constant()),\n+0)...});\n+ 226 }\n+ 227\n+ 228\n+ 229 template()))>::value, int> = 0>\n+ 231 constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)\n+ 232 {\n+ 233 auto size = Hybrid::size(range);\n+ 234 auto indices = std::make_index_sequence();\n+ 235 (forEachIndex)(std::forward(range), std::forward(f), indices);\n+ 236 }\n+ 237\n+ 238 template\n+ 239 constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)\n+ 240 {\n+ 241 for(auto&& e : range)\n+ 242 f(e);\n+ 243 }\n+ 244\n+ 245} // namespace Impl\n+ 246\n+ 247\n+ 248\n+ 267template\n+268constexpr void forEach(Range&& range, F&& f)\n+ 269{\n+ 270 Impl::forEach(std::forward(range), std::forward(f),\n+PriorityTag<42>());\n+ 271}\n+ 272\n+ 273\n+ 274\n+ 290template\n+291constexpr T accumulate(Range&& range, T value, F&& f)\n+ 292{\n+ 293 forEach(std::forward(range), [&](auto&& entry) {\n+ 294 value = f(value, entry);\n+ 295 });\n+ 296 return value;\n+ 297}\n+ 298\n+ 299\n+ 300\n+ 301namespace Impl {\n+ 302\n+ 303 struct Id {\n+ 304 template\n+ 305 constexpr T operator()(T&& x) const {\n+ 306 return std::forward(x);\n+ 307 }\n+ 308 };\n+ 309\n+ 310 template\n+ 311 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc,\n+ElseFunc&& /*elseFunc*/)\n+ 312 {\n+ 313 return ifFunc(Id{});\n+ 314 }\n+ 315\n+ 316 template\n+ 317 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/,\n+ElseFunc&& elseFunc)\n+ 318 {\n+ 319 return elseFunc(Id{});\n+ 320 }\n+ 321\n+ 322 template\n+ 323 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&&\n+elseFunc)\n+ 324 {\n+ 325 if (condition)\n+ 326 return ifFunc(Id{});\n+ 327 else\n+ 328 return elseFunc(Id{});\n+ 329 }\n+ 330\n+ 331} // namespace Impl\n+ 332\n+ 333\n+ 334\n+ 355template\n+356decltype(auto) ifElse(const Condition& condition, IfFunc&& ifFunc,\n+ElseFunc&& elseFunc)\n+ 357{\n+ 358 return Impl::ifElse(condition, std::forward(ifFunc), std::\n+forward(elseFunc));\n+ 359}\n+ 360\n+ 368template\n+369void ifElse(const Condition& condition, IfFunc&& ifFunc)\n+ 370{\n+ 371 ifElse(condition, std::forward(ifFunc), [](auto&&) {});\n+ 372}\n+ 373\n+ 374\n+ 375\n+ 376namespace Impl {\n+ 377\n+ 378 template\n+ 379 constexpr auto equals(const T1& /*t1*/, const T2& /*t2*/, PriorityTag<1>)\n+-> decltype(T1::value, T2::value, std::integral_constant())\n+ 380 { return {}; }\n+ 381\n+ 382 template\n+ 383 constexpr auto equals(const T1& t1, const T2& t2, PriorityTag<0>)\n+ 384 {\n+ 385 return t1==t2;\n+ 386 }\n+ 387\n+ 388} // namespace Impl\n+ 389\n+ 390\n+ 391\n+ 401template\n+402constexpr auto equals(T1&& t1, T2&& t2)\n+ 403{\n+ 404 return Impl::equals(std::forward(t1), std::forward(t2),\n+PriorityTag<1>());\n+ 405}\n+ 406\n+ 407\n+ 408\n+ 409namespace Impl {\n+ 410\n+ 411 template\n+ 412 constexpr Result switchCases(std::integer_sequence, const Value& /\n+*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch)\n+ 413 {\n+ 414 return elseBranch();\n+ 415 }\n+ 416\n+ 417 template\n+ 418 constexpr Result switchCases(std::integer_sequence, const\n+Value& value, Branches&& branches, ElseBranch&& elseBranch)\n+ 419 {\n+ 420 return ifElse(\n+ 421 Hybrid::equals(std::integral_constant(), value),\n+ 422 [&](auto id) -> decltype(auto) {\n+ 423 return id(branches)(std::integral_constant());\n+ 424 }, [&](auto id) -> decltype(auto) {\n+ 425 return Impl::switchCases(id(std::integer_sequence()),\n+value, branches, elseBranch);\n+ 426 });\n+ 427 }\n+ 428\n+ 429} // namespace Impl\n+ 430\n+ 431\n+ 432\n+ 460template\n+461constexpr decltype(auto) switchCases(const Cases& cases, const Value& value,\n+Branches&& branches, ElseBranch&& elseBranch)\n+ 462{\n+ 463 return Impl::switchCases(cases, value, std::\n+forward(branches), std::forward(elseBranch));\n+ 464}\n+ 465\n+ 486template\n+487constexpr void switchCases(const Cases& cases, const Value& value,\n+Branches&& branches)\n+ 488{\n+ 489 Impl::switchCases(cases, value, std::forward(branches), []\n+() {});\n+ 490}\n+ 491\n+ 492\n+ 493} // namespace Hybrid\n+ 494} // namespace Dune\n+ 495\n+ 496\n+ 497#endif // #ifndef DUNE_COMMON_HYBRIDUTILITIES_HH\n+typetraits.hh\n+Traits for type conversions and type information.\n+rangeutilities.hh\n+Utilities for reduction like operations on ranges.\n+assertandreturn.hh\n+indices.hh\n+typeutilities.hh\n+Utilities for type computations, constraining overloads, ...\n+fvector.hh\n+Implements a vector constructed from a given type representing a field and a\n+compile-time given size.\n+Dune::Indices::_0\n+constexpr index_constant< 0 > _0\n+Compile time index with value 0.\n+Definition: indices.hh:53\n+Dune::range\n+static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from\n+>, std::integral_constant< T, to >) noexcept\n+Definition: rangeutilities.hh:300\n+Dune::Hybrid::ifElse\n+void ifElse(const Condition &condition, IfFunc &&ifFunc)\n+A conditional expression.\n+Definition: hybridutilities.hh:369\n+Dune::Hybrid::size\n+constexpr auto size(const T &t)\n+Size query.\n+Definition: hybridutilities.hh:82\n+Dune::Hybrid::integralRange\n+constexpr auto integralRange(const End &end)\n+Create an integral range starting from 0.\n+Definition: hybridutilities.hh:203\n+Dune::Hybrid::equals\n+constexpr auto equals(T1 &&t1, T2 &&t2)\n+Equality comparison.\n+Definition: hybridutilities.hh:402\n+Dune::Hybrid::forEach\n+constexpr void forEach(Range &&range, F &&f)\n+Range based for loop.\n+Definition: hybridutilities.hh:268\n+Dune::Hybrid::switchCases\n+constexpr decltype(auto) switchCases(const Cases &cases, const Value &value,\n+Branches &&branches, ElseBranch &&elseBranch)\n+Switch statement.\n+Definition: hybridutilities.hh:461\n+Dune::Hybrid::ifElse\n+decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc\n+&&elseFunc)\n+A conditional expression.\n+Definition: hybridutilities.hh:356\n+Dune::Hybrid::integralRange\n+constexpr auto integralRange(const Begin &begin, const End &end)\n+Create an integral range.\n+Definition: hybridutilities.hh:184\n+Dune::Hybrid::elementAt\n+constexpr decltype(auto) elementAt(Container &&c, Index &&i)\n+Get element at given position from container.\n+Definition: hybridutilities.hh:135\n+Dune::Hybrid::accumulate\n+constexpr T accumulate(Range &&range, T value, F &&f)\n+Accumulate values.\n+Definition: hybridutilities.hh:291\n+Dune::integerSequenceEntry\n+constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::\n+integral_constant< std::size_t, index > i)\n+Get entry of std::integer_sequence.\n+Definition: typetraits.hh:462\n+DUNE_ASSERT_AND_RETURN\n+#define DUNE_ASSERT_AND_RETURN(C, X)\n+Asserts a condition and return on success in constexpr context.\n+Definition: assertandreturn.hh:22\n+Dune\n+Dune namespace.\n+Definition: alignedallocator.hh:13\n+Dune::FieldVector\n+vector space out of a tensor product of fields.\n+Definition: fvector.hh:95\n+Dune::IntegralRange\n+dynamic integer range for use in range-based for loops\n+Definition: rangeutilities.hh:175\n+Dune::StaticIntegralRange\n+static integer range for use in range-based for loops\n+Definition: rangeutilities.hh:225\n+Dune::IsIntegralConstant\n+Check if T is an std::integral_constant\n+Definition: typetraits.hh:384\n+Dune::PriorityTag\n+Helper class for tagging priorities.\n+Definition: typeutilities.hh:73\n+Dune::PriorityTag<_0_>\n+Helper class for tagging priorities.\n+Definition: typeutilities.hh:87\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00026.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00026.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: classname.hh File Reference\n+dune-common: referencehelper.hh File Reference\n \n \n \n \n \n \n \n@@ -64,48 +64,59 @@\n \n
    \n \n
    \n \n-
    classname.hh File Reference
    \n+Typedefs |\n+Functions |\n+Variables
    \n+
    referencehelper.hh File Reference
    \n \n
    \n-\n-

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

    \n-
    #include <cstdlib>
    \n-#include <memory>
    \n-#include <string>
    \n-#include <typeinfo>
    \n-#include <type_traits>
    \n+
    #include <type_traits>
    \n+#include <functional>
    \n
    \n

    Go to the source code of this file.

    \n \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+\n+\n+\n+\n+\n+

    \n+Typedefs

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

    \n Functions

    template<class T >
    std::string Dune::className ()
     Provide the demangled class name of a type T as a string. More...
     
    template<class T >
    std::string Dune::className (T &&v)
     Provide the demangled class name of a given object as a string. More...
     
    template<class T >
    constexpr T & Dune::resolveRef (T &gf) noexcept
     Helper function to resolve std::reference_wrapper. More...
     
    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. More...
     
    \n+\n+\n+\n+\n+\n

    \n+Variables

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

    Detailed Description

    \n-

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

    \n-
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,37 +4,43 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Functions\n-classname.hh File Reference\n-A free function to provide the demangled class name of a given object or type\n-as a string. More...\n-#include \n-#include \n-#include \n-#include \n+Namespaces | Typedefs | Functions | Variables\n+referencehelper.hh File Reference\n #include \n+#include \n Go_to_the_source_code_of_this_file.\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+ Typedefs\n+template\n+using\u00a0Dune::ResolveRef_t = std::remove_reference_t< decltype(Dune::resolveRef\n+ (std::declval< T & >()))>\n+\u00a0 Type trait to resolve std::reference_wrapper. More...\n+\u00a0\n Functions\n template\n-std::string\u00a0Dune::className ()\n-\u00a0 Provide the demangled class name of a type T as a string. More...\n+constexpr T &\u00a0Dune::resolveRef (T &gf) noexcept\n+\u00a0 Helper function to resolve std::reference_wrapper. More...\n+\u00a0\n+template\n+ const auto &\u00a0Dune::resolveRef (T &&gf)=delete\n \u00a0\n template\n-std::string\u00a0Dune::className (T &&v)\n-\u00a0 Provide the demangled class name of a given object as a string.\n- More...\n-\u00a0\n-***** Detailed Description *****\n-A free function to provide the demangled class name of a given object or type\n-as a string.\n+constexpr T &\u00a0Dune::resolveRef (std::reference_wrapper< T > gf) noexcept\n+\u00a0 Helper function to resolve std::reference_wrapper. More...\n+\u00a0\n+ Variables\n+template\n+constexpr bool\u00a0Dune::IsReferenceWrapper_v = Impl::IsReferenceWrapper::value\n+\u00a0 Helper to detect if given type is a std::reference_wrapper.\n+ More...\n+\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00026_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: classname.hh Source File\n+dune-common: referencehelper.hh Source File\n \n \n \n \n \n \n \n@@ -62,91 +62,88 @@\n \n
    \n \n
    \n \n
    \n-
    classname.hh
    \n+
    referencehelper.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_CLASSNAME_HH
    \n-
    6#define DUNE_CLASSNAME_HH
    \n+
    5#ifndef DUNE_COMMON_REFERENCE_HELPER_HH
    \n+
    6#define DUNE_COMMON_REFERENCE_HELPER_HH
    \n
    7
    \n-
    13#include <cstdlib>
    \n-
    14#include <memory>
    \n-
    15#include <string>
    \n-
    16#include <typeinfo>
    \n-
    17#include <type_traits>
    \n-
    18
    \n-
    19#if __has_include(<cxxabi.h>) && !DISABLE_CXA_DEMANGLE
    \n-
    20#define HAVE_CXA_DEMANGLE 1
    \n-
    21#include <cxxabi.h>
    \n-
    22#endif // #if HAVE_CXA_DEMANGLE
    \n-
    23
    \n-
    24namespace Dune {
    \n+
    8#include <type_traits>
    \n+
    9#include <functional>
    \n+
    10
    \n+
    11
    \n+
    12
    \n+
    13namespace Dune {
    \n+
    14
    \n+
    15namespace Impl {
    \n+
    16
    \n+
    17 template<class T>
    \n+
    18 class IsReferenceWrapper : public std::false_type {};
    \n+
    19
    \n+
    20 template<class T>
    \n+
    21 class IsReferenceWrapper<std::reference_wrapper<T>> : public std::true_type {};
    \n+
    22
    \n+
    23 template<class T>
    \n+
    24 class IsReferenceWrapper<const std::reference_wrapper<T>> : public std::true_type {};
    \n
    25
    \n-
    26 namespace Impl {
    \n+
    26} // namespace Dune::Impl
    \n
    27
    \n-
    28 inline std::string demangle(std::string name)
    \n-
    29 {
    \n-
    30#if HAVE_CXA_DEMANGLE
    \n-
    31 int status;
    \n-
    32 std::unique_ptr<char, void(*)(void*)>
    \n-
    33 demangled(abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status),
    \n-
    34 std::free);
    \n-
    35 if( demangled )
    \n-
    36 name = demangled.get();
    \n-
    37#endif // #if HAVE_CXA_DEMANGLE
    \n-
    38 return name;
    \n-
    39 }
    \n-
    40 }
    \n-
    41
    \n-
    43 /*
    \n-
    44 * \\ingroup CxxUtilities
    \n-
    45 */
    \n-
    46 template <class T>
    \n-
    47 std::string className ()
    \n-
    48 {
    \n-
    49 typedef typename std::remove_reference<T>::type TR;
    \n-
    50 std::string className = Impl::demangle( typeid( TR ).name() );
    \n-
    51 if (std::is_const<TR>::value)
    \n-
    52 className += " const";
    \n-
    53 if (std::is_volatile<TR>::value)
    \n-
    54 className += " volatile";
    \n-
    55 if (std::is_lvalue_reference<T>::value)
    \n-
    56 className += "&";
    \n-
    57 else if (std::is_rvalue_reference<T>::value)
    \n-
    58 className += "&&";
    \n-
    59 return className;
    \n-
    60 }
    \n+
    28
    \n+
    34template<class T>
    \n+
    35constexpr bool IsReferenceWrapper_v = Impl::IsReferenceWrapper<T>::value;
    \n+
    36
    \n+
    37
    \n+
    46template<class T>
    \n+
    47constexpr T& resolveRef(T& gf) noexcept
    \n+
    48{
    \n+
    49 return gf;
    \n+
    50}
    \n+
    51
    \n+
    52
    \n+
    53// There's no overload for non std::reference_wrapper r-values,
    \n+
    54// because this may lead to undefined behavior whenever the
    \n+
    55// return value is stored.
    \n+
    56// Notice that deleting the overload is not necessary, but
    \n+
    57// helps to document that it is missing on purpose. It also
    \n+
    58// leads to nicer error messages.
    \n+
    59template<class T>
    \n+
    60const auto& resolveRef(T&& gf) = delete;
    \n
    61
    \n-
    63 /*
    \n-
    64 * \\ingroup CxxUtilities
    \n-
    65 */
    \n-
    66 template <class T>
    \n-
    67 std::string className ( T&& v)
    \n-
    68 {
    \n-
    69 typedef typename std::remove_reference<T>::type TR;
    \n-
    70 std::string className = Impl::demangle( typeid(v).name() );
    \n-
    71 if (std::is_const<TR>::value)
    \n-
    72 className += " const";
    \n-
    73 if (std::is_volatile<TR>::value)
    \n-
    74 className += " volatile";
    \n-
    75 return className;
    \n-
    76 }
    \n-
    77} // namespace Dune
    \n-
    78
    \n-
    79#endif // DUNE_CLASSNAME_HH
    \n+
    62
    \n+
    81template<class T>
    \n+
    82constexpr T& resolveRef(std::reference_wrapper<T> gf) noexcept
    \n+
    83{
    \n+
    84 return gf.get();
    \n+
    85}
    \n+
    86
    \n+
    87
    \n+
    88
    \n+
    99template<class T>
    \n+
    100using ResolveRef_t = std::remove_reference_t<decltype(Dune::resolveRef(std::declval<T&>()))>;
    \n+
    101
    \n+
    102
    \n+
    103} // namespace Dune
    \n+
    104
    \n+
    105
    \n+
    106
    \n+
    107#endif // DUNE_COMMON_REFERENCE_HELPER_HH
    \n+
    constexpr bool IsReferenceWrapper_v
    Helper to detect if given type is a std::reference_wrapper.
    Definition: referencehelper.hh:35
    \n+
    constexpr T & resolveRef(T &gf) noexcept
    Helper function to resolve std::reference_wrapper.
    Definition: referencehelper.hh:47
    \n+
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    std::string className()
    Provide the demangled class name of a type T as a string.
    Definition: classname.hh:47
    \n+
    std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))> ResolveRef_t
    Type trait to resolve std::reference_wrapper.
    Definition: referencehelper.hh:100
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,92 +4,100 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-classname.hh\n+referencehelper.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_CLASSNAME_HH\n- 6#define DUNE_CLASSNAME_HH\n+ 5#ifndef DUNE_COMMON_REFERENCE_HELPER_HH\n+ 6#define DUNE_COMMON_REFERENCE_HELPER_HH\n 7\n- 13#include \n- 14#include \n- 15#include \n- 16#include \n- 17#include \n- 18\n- 19#if __has_include() && !DISABLE_CXA_DEMANGLE\n- 20#define HAVE_CXA_DEMANGLE 1\n- 21#include \n- 22#endif // #if HAVE_CXA_DEMANGLE\n- 23\n- 24namespace Dune {\n+ 8#include \n+ 9#include \n+ 10\n+ 11\n+ 12\n+ 13namespace Dune {\n+ 14\n+ 15namespace Impl {\n+ 16\n+ 17 template\n+ 18 class IsReferenceWrapper : public std::false_type {};\n+ 19\n+ 20 template\n+ 21 class IsReferenceWrapper> : public std::true_type\n+{};\n+ 22\n+ 23 template\n+ 24 class IsReferenceWrapper> : public std::\n+true_type {};\n 25\n- 26 namespace Impl {\n+ 26} // namespace Dune::Impl\n 27\n- 28 inline std::string demangle(std::string name)\n- 29 {\n- 30#if HAVE_CXA_DEMANGLE\n- 31 int status;\n- 32 std::unique_ptr\n- 33 demangled(abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status),\n- 34 std::free);\n- 35 if( demangled )\n- 36 name = demangled.get();\n- 37#endif // #if HAVE_CXA_DEMANGLE\n- 38 return name;\n- 39 }\n- 40 }\n- 41\n- 43 /*\n- 44 * \\ingroup CxxUtilities\n- 45 */\n- 46 template \n-47 std::string className ()\n- 48 {\n- 49 typedef typename std::remove_reference::type TR;\n- 50 std::string className = Impl::demangle( typeid( TR ).name() );\n- 51 if (std::is_const::value)\n- 52 className += \" const\";\n- 53 if (std::is_volatile::value)\n- 54 className += \" volatile\";\n- 55 if (std::is_lvalue_reference::value)\n- 56 className += \"&\";\n- 57 else if (std::is_rvalue_reference::value)\n- 58 className += \"&&\";\n- 59 return className;\n- 60 }\n+ 28\n+ 34template\n+35constexpr bool IsReferenceWrapper_v = Impl::IsReferenceWrapper::value;\n+ 36\n+ 37\n+ 46template\n+47constexpr T& resolveRef(T& gf) noexcept\n+ 48{\n+ 49 return gf;\n+ 50}\n+ 51\n+ 52\n+ 53// There's no overload for non std::reference_wrapper r-values,\n+ 54// because this may lead to undefined behavior whenever the\n+ 55// return value is stored.\n+ 56// Notice that deleting the overload is not necessary, but\n+ 57// helps to document that it is missing on purpose. It also\n+ 58// leads to nicer error messages.\n+ 59template\n+60const auto& resolveRef(T&& gf) = delete;\n 61\n- 63 /*\n- 64 * \\ingroup CxxUtilities\n- 65 */\n- 66 template \n-67 std::string className ( T&& v)\n- 68 {\n- 69 typedef typename std::remove_reference::type TR;\n- 70 std::string className = Impl::demangle( typeid(v).name() );\n- 71 if (std::is_const::value)\n- 72 className += \" const\";\n- 73 if (std::is_volatile::value)\n- 74 className += \" volatile\";\n- 75 return className;\n- 76 }\n- 77} // namespace Dune\n- 78\n- 79#endif // DUNE_CLASSNAME_HH\n+ 62\n+ 81template\n+82constexpr T& resolveRef(std::reference_wrapper gf) noexcept\n+ 83{\n+ 84 return gf.get();\n+ 85}\n+ 86\n+ 87\n+ 88\n+ 99template\n+100using ResolveRef_t = std::remove_reference_t()))>;\n+ 101\n+ 102\n+ 103} // namespace Dune\n+ 104\n+ 105\n+ 106\n+ 107#endif // DUNE_COMMON_REFERENCE_HELPER_HH\n+Dune::IsReferenceWrapper_v\n+constexpr bool IsReferenceWrapper_v\n+Helper to detect if given type is a std::reference_wrapper.\n+Definition: referencehelper.hh:35\n+Dune::resolveRef\n+constexpr T & resolveRef(T &gf) noexcept\n+Helper function to resolve std::reference_wrapper.\n+Definition: referencehelper.hh:47\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::className\n-std::string className()\n-Provide the demangled class name of a type T as a string.\n-Definition: classname.hh:47\n+Dune::ResolveRef_t\n+std::remove_reference_t< decltype(Dune::resolveRef(std::declval< T & >()))>\n+ResolveRef_t\n+Type trait to resolve std::reference_wrapper.\n+Definition: referencehelper.hh:100\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00029.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00029.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: path.hh File Reference\n+dune-common: communicator.hh File Reference\n \n \n \n \n \n \n \n@@ -58,61 +58,73 @@\n \n \n \n \n \n
    \n \n-
    path.hh File Reference
    \n+Classes |\n+Namespaces
    \n+ \n \n
    \n \n-

    Utilities for handling filesystem paths. \n+

    Provides utility classes for syncing distributed data via MPI communication. \n More...

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

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+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...
     
    \n \n \n \n \n-

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n

    \n-Functions

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

    Detailed Description

    \n-

    Utilities for handling filesystem paths.

    \n-
    Author
    J\u00f6 Fahlke jorri.nosp@m.t@jo.nosp@m.rrit..nosp@m.de
    \n+

    Provides utility classes for syncing distributed data via MPI communication.

    \n+
    Author
    Markus Blatt
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "encoding", "source2": "encoding", "unified_diff": "@@ -1 +1 @@\n-utf-8\n+us-ascii\n"}, {"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,45 +4,61 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Functions\n-path.hh File Reference\n-Common \u00bb Utilities \u00bb Filesystem_Paths\n-Utilities for handling filesystem paths. More...\n-#include \n+ * parallel\n+Classes | Namespaces\n+communicator.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+Provides utility classes for syncing distributed data via MPI communication.\n+More...\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::SizeOne\n+\u00a0 Flag for marking indexed data structures where data at each index is\n+ of the same size. More...\n+\u00a0\n+struct \u00a0Dune::VariableSize\n+\u00a0 Flag for marking indexed data structures where the data at each index\n+ may be a variable multiple of another type. More...\n+\u00a0\n+struct \u00a0Dune::CommPolicy<_V_>\n+\u00a0 Default policy used for communicating an indexed type. More...\n+\u00a0\n+struct \u00a0Dune::CommPolicy<_V_>::CommPolicy<_VariableBlockVector<_FieldVector<\n+ K,_n_>,_A_>_>\n+\u00a0\n+ class \u00a0Dune::CommPolicy<_V_>::CommunicationError\n+\u00a0 Error thrown if there was a problem with the communication. More...\n+\u00a0\n+struct \u00a0Dune::CommPolicy<_V_>::CopyGatherScatter<_T_>\n+\u00a0 GatherScatter default implementation that just copies data. More...\n+\u00a0\n+ class \u00a0Dune::BufferedCommunicator\n+\u00a0 A communicator that uses buffers to gather and scatter the data to be\n+ send or received. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n- Functions\n-std::string\u00a0Dune::concatPaths (const std::string &base, const std::string &p)\n-\u00a0 concatenate two paths More...\n-\u00a0\n-std::string\u00a0Dune::processPath (const std::string &p)\n-\u00a0 sanitize a path for further processing More...\n-\u00a0\n- bool\u00a0Dune::pathIndicatesDirectory (const std::string &p)\n-\u00a0 check whether the given path indicates that it is a directory\n- More...\n-\u00a0\n-std::string\u00a0Dune::prettyPath (const std::string &p, bool isDirectory)\n-\u00a0 pretty print path More...\n-\u00a0\n-std::string\u00a0Dune::prettyPath (const std::string &p)\n-\u00a0 pretty print path More...\n-\u00a0\n-std::string\u00a0Dune::relativePath (const std::string &newbase, const std::string\n- &p)\n-\u00a0 compute a relative path between two paths More...\n-\u00a0\n ***** Detailed Description *****\n-Utilities for handling filesystem paths.\n+Provides utility classes for syncing distributed data via MPI communication.\n Author\n- J\u00f6 Fahlke jorri.nosp@m.t@jo.nosp@m.rrit..nosp@m.de\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00029_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: path.hh Source File\n+dune-common: communicator.hh Source File\n \n \n \n \n \n \n \n@@ -58,58 +58,1026 @@\n \n
    \n \n \n
    \n
    \n-
    path.hh
    \n+
    communicator.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_PATH_HH
    \n-
    6#define DUNE_COMMON_PATH_HH
    \n+
    5#ifndef DUNE_COMMUNICATOR
    \n+
    6#define DUNE_COMMUNICATOR
    \n
    7
    \n-
    8#include <string>
    \n+
    8#if HAVE_MPI
    \n
    9
    \n-
    10namespace Dune {
    \n+
    10#include <cassert>
    \n+
    11#include <cstddef>
    \n+
    12#include <iostream>
    \n+
    13#include <map>
    \n+
    14#include <type_traits>
    \n+
    15#include <utility>
    \n+
    16
    \n+
    17#include <mpi.h>
    \n+
    18
    \n+\n+\n+\n+\n
    23
    \n-
    51 std::string concatPaths(const std::string& base, const std::string& p);
    \n-
    52
    \n-
    54
    \n-
    98 std::string processPath(const std::string& p);
    \n-
    99
    \n-
    101
    \n-
    109 bool pathIndicatesDirectory(const std::string& p);
    \n-
    110
    \n-
    112
    \n-
    151 std::string prettyPath(const std::string& p, bool isDirectory);
    \n-
    152
    \n+
    24namespace Dune
    \n+
    25{
    \n+
    109 struct SizeOne
    \n+
    110 {};
    \n+
    111
    \n+\n+
    118 {};
    \n+
    119
    \n+
    120
    \n+
    126 template<class V>
    \n+\n+
    128 {
    \n+
    140 typedef V Type;
    \n+
    141
    \n+
    147 typedef typename V::value_type IndexedType;
    \n+
    148
    \n+\n
    154
    \n-
    160 std::string prettyPath(const std::string& p);
    \n-
    161
    \n-
    163
    \n-
    179 std::string relativePath(const std::string& newbase, const std::string& p);
    \n-
    180
    \n-
    182}
    \n+
    163 static const void* getAddress(const V& v, int index);
    \n+
    164
    \n+
    170 static int getSize(const V&, int index);
    \n+
    171 };
    \n+
    172
    \n+
    173 template<class K, int n> class FieldVector;
    \n+
    174
    \n+
    175 template<class B, class A> class VariableBlockVector;
    \n+
    176
    \n+
    177 template<class K, class A, int n>
    \n+\n+
    179 {
    \n+\n+
    181
    \n+
    182 typedef typename Type::B IndexedType;
    \n
    183
    \n-
    184#endif // DUNE_COMMON_PATH_HH
    \n-
    std::string processPath(const std::string &p)
    sanitize a path for further processing
    Definition: path.cc:41
    \n-
    bool pathIndicatesDirectory(const std::string &p)
    check whether the given path indicates that it is a directory
    Definition: path.cc:115
    \n-
    std::string prettyPath(const std::string &p, bool isDirectory)
    pretty print path
    Definition: path.cc:126
    \n-
    std::string relativePath(const std::string &newbase, const std::string &p)
    compute a relative path between two paths
    Definition: path.cc:153
    \n-
    std::string concatPaths(const std::string &base, const std::string &p)
    concatenate two paths
    Definition: path.cc:32
    \n+\n+
    185
    \n+
    186 static const void* getAddress(const Type& v, int i);
    \n+
    187
    \n+
    188 static int getSize(const Type& v, int i);
    \n+
    189 };
    \n+
    190
    \n+\n+
    195 {};
    \n+
    196
    \n+
    200 template<class T>
    \n+\n+
    202 {
    \n+\n+
    204
    \n+
    205 static const IndexedType& gather(const T& vec, std::size_t i);
    \n+
    206
    \n+
    207 static void scatter(T& vec, const IndexedType& v, std::size_t i);
    \n+
    208
    \n+
    209 };
    \n+
    210
    \n+
    222 template<typename T>
    \n+
    223 class DatatypeCommunicator : public InterfaceBuilder
    \n+
    224 {
    \n+
    225 public:
    \n+
    226
    \n+
    230 typedef T ParallelIndexSet;
    \n+
    231
    \n+\n+
    236
    \n+
    240 typedef typename RemoteIndices::GlobalIndex GlobalIndex;
    \n+
    241
    \n+
    245 typedef typename RemoteIndices::Attribute Attribute;
    \n+
    246
    \n+
    250 typedef typename RemoteIndices::LocalIndex LocalIndex;
    \n+
    251
    \n+
    255 DatatypeCommunicator();
    \n+
    256
    \n+
    260 ~DatatypeCommunicator();
    \n+
    261
    \n+
    288 template<class T1, class T2, class V>
    \n+
    289 void build(const RemoteIndices& remoteIndices, const T1& sourceFlags, V& sendData, const T2& destFlags, V& receiveData);
    \n+
    290
    \n+
    294 void forward();
    \n+
    295
    \n+
    299 void backward();
    \n+
    300
    \n+
    304 void free();
    \n+
    305 private:
    \n+
    309 constexpr static int commTag_ = 234;
    \n+
    310
    \n+
    314 const RemoteIndices* remoteIndices_;
    \n+
    315
    \n+
    316 typedef std::map<int,std::pair<MPI_Datatype,MPI_Datatype> >
    \n+
    317 MessageTypeMap;
    \n+
    318
    \n+
    322 MessageTypeMap messageTypes;
    \n+
    323
    \n+
    327 void* data_;
    \n+
    328
    \n+
    329 MPI_Request* requests_[2];
    \n+
    330
    \n+
    334 bool created_;
    \n+
    335
    \n+
    339 template<class V, bool FORWARD>
    \n+
    340 void createRequests(V& sendData, V& receiveData);
    \n+
    341
    \n+
    345 template<class T1, class T2, class V, bool send>
    \n+
    346 void createDataTypes(const T1& source, const T2& destination, V& data);
    \n+
    347
    \n+
    351 void sendRecv(MPI_Request* req);
    \n+
    352
    \n+
    356 struct IndexedTypeInformation
    \n+
    357 {
    \n+
    363 void build(int i)
    \n+
    364 {
    \n+
    365 length = new int[i];
    \n+
    366 displ = new MPI_Aint[i];
    \n+
    367 size = i;
    \n+
    368 }
    \n+
    369
    \n+
    373 void free()
    \n+
    374 {
    \n+
    375 delete[] length;
    \n+
    376 delete[] displ;
    \n+
    377 }
    \n+
    379 int* length;
    \n+
    381 MPI_Aint* displ;
    \n+
    387 int elements;
    \n+
    391 int size;
    \n+
    392 };
    \n+
    393
    \n+
    399 template<class V>
    \n+
    400 struct MPIDatatypeInformation
    \n+
    401 {
    \n+
    406 MPIDatatypeInformation(const V& data) : data_(data)
    \n+
    407 {}
    \n+
    408
    \n+
    414 void reserve(int proc, int size)
    \n+
    415 {
    \n+
    416 information_[proc].build(size);
    \n+
    417 }
    \n+
    424 void add(int proc, int local)
    \n+
    425 {
    \n+
    426 IndexedTypeInformation& info=information_[proc];
    \n+
    427 assert((info.elements)<info.size);
    \n+
    428 MPI_Get_address( const_cast<void*>(CommPolicy<V>::getAddress(data_, local)),
    \n+
    429 info.displ+info.elements);
    \n+
    430 info.length[info.elements]=CommPolicy<V>::getSize(data_, local);
    \n+
    431 info.elements++;
    \n+
    432 }
    \n+
    433
    \n+
    438 std::map<int,IndexedTypeInformation> information_;
    \n+
    442 const V& data_;
    \n+
    443
    \n+
    444 };
    \n+
    445
    \n+
    446 };
    \n+
    447
    \n+\n+
    458 {
    \n+
    459
    \n+
    460 public:
    \n+\n+
    465
    \n+
    472 template<class Data, class Interface>
    \n+
    473 typename std::enable_if<std::is_same<SizeOne,typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type
    \n+
    474 build(const Interface& interface);
    \n+
    475
    \n+
    483 template<class Data, class Interface>
    \n+
    484 void build(const Data& source, const Data& target, const Interface& interface);
    \n+
    485
    \n+
    514 template<class GatherScatter, class Data>
    \n+
    515 void forward(const Data& source, Data& dest);
    \n+
    516
    \n+
    545 template<class GatherScatter, class Data>
    \n+
    546 void backward(Data& source, const Data& dest);
    \n+
    547
    \n+
    573 template<class GatherScatter, class Data>
    \n+
    574 void forward(Data& data);
    \n+
    575
    \n+
    601 template<class GatherScatter, class Data>
    \n+
    602 void backward(Data& data);
    \n+
    603
    \n+
    607 void free();
    \n+
    608
    \n+\n+
    613
    \n+
    614 private:
    \n+
    615
    \n+
    619 typedef std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
    \n+
    620 InterfaceMap;
    \n+
    621
    \n+
    622
    \n+
    626 template<class Data, typename IndexedTypeFlag>
    \n+
    627 struct MessageSizeCalculator
    \n+
    628 {};
    \n+
    629
    \n+
    634 template<class Data>
    \n+
    635 struct MessageSizeCalculator<Data,SizeOne>
    \n+
    636 {
    \n+
    643 inline int operator()(const InterfaceInformation& info) const;
    \n+
    652 inline int operator()(const Data& data, const InterfaceInformation& info) const;
    \n+
    653 };
    \n+
    654
    \n+
    659 template<class Data>
    \n+
    660 struct MessageSizeCalculator<Data,VariableSize>
    \n+
    661 {
    \n+
    670 inline int operator()(const Data& data, const InterfaceInformation& info) const;
    \n+
    671 };
    \n+
    672
    \n+
    676 template<class Data, class GatherScatter, bool send, typename IndexedTypeFlag>
    \n+
    677 struct MessageGatherer
    \n+
    678 {};
    \n+
    679
    \n+
    684 template<class Data, class GatherScatter, bool send>
    \n+
    685 struct MessageGatherer<Data,GatherScatter,send,SizeOne>
    \n+
    686 {
    \n+
    688 typedef typename CommPolicy<Data>::IndexedType Type;
    \n+
    689
    \n+
    694 typedef GatherScatter Gatherer;
    \n+
    695
    \n+
    701 constexpr static bool forward = send;
    \n+
    702
    \n+
    710 inline void operator()(const InterfaceMap& interface, const Data& data, Type* buffer, size_t bufferSize) const;
    \n+
    711 };
    \n+
    712
    \n+
    717 template<class Data, class GatherScatter, bool send>
    \n+
    718 struct MessageGatherer<Data,GatherScatter,send,VariableSize>
    \n+
    719 {
    \n+
    721 typedef typename CommPolicy<Data>::IndexedType Type;
    \n+
    722
    \n+
    727 typedef GatherScatter Gatherer;
    \n+
    728
    \n+
    734 constexpr static bool forward = send;
    \n+
    735
    \n+
    743 inline void operator()(const InterfaceMap& interface, const Data& data, Type* buffer, size_t bufferSize) const;
    \n+
    744 };
    \n+
    745
    \n+
    749 template<class Data, class GatherScatter, bool send, typename IndexedTypeFlag>
    \n+
    750 struct MessageScatterer
    \n+
    751 {};
    \n+
    752
    \n+
    757 template<class Data, class GatherScatter, bool send>
    \n+
    758 struct MessageScatterer<Data,GatherScatter,send,SizeOne>
    \n+
    759 {
    \n+
    761 typedef typename CommPolicy<Data>::IndexedType Type;
    \n+
    762
    \n+
    767 typedef GatherScatter Scatterer;
    \n+
    768
    \n+
    774 constexpr static bool forward = send;
    \n+
    775
    \n+
    783 inline void operator()(const InterfaceMap& interface, Data& data, Type* buffer, const int& proc) const;
    \n+
    784 };
    \n+
    789 template<class Data, class GatherScatter, bool send>
    \n+
    790 struct MessageScatterer<Data,GatherScatter,send,VariableSize>
    \n+
    791 {
    \n+
    793 typedef typename CommPolicy<Data>::IndexedType Type;
    \n+
    794
    \n+
    799 typedef GatherScatter Scatterer;
    \n+
    800
    \n+
    806 constexpr static bool forward = send;
    \n+
    807
    \n+
    815 inline void operator()(const InterfaceMap& interface, Data& data, Type* buffer, const int& proc) const;
    \n+
    816 };
    \n+
    817
    \n+
    821 struct MessageInformation
    \n+
    822 {
    \n+
    824 MessageInformation()
    \n+
    825 : start_(0), size_(0)
    \n+
    826 {}
    \n+
    827
    \n+
    835 MessageInformation(size_t start, size_t size)
    \n+
    836 : start_(start), size_(size)
    \n+
    837 {}
    \n+
    841 size_t start_;
    \n+
    845 size_t size_;
    \n+
    846 };
    \n+
    847
    \n+
    854 typedef std::map<int,std::pair<MessageInformation,MessageInformation> >
    \n+
    855 InformationMap;
    \n+
    859 InformationMap messageInformation_;
    \n+
    863 char* buffers_[2];
    \n+
    867 size_t bufferSize_[2];
    \n+
    868
    \n+
    872 constexpr static int commTag_ = 0;
    \n+
    873
    \n+
    877 std::map<int,std::pair<InterfaceInformation,InterfaceInformation> > interfaces_;
    \n+
    878
    \n+
    879 MPI_Comm communicator_;
    \n+
    880
    \n+
    884 template<class GatherScatter, bool FORWARD, class Data>
    \n+
    885 void sendRecv(const Data& source, Data& target);
    \n+
    886
    \n+
    887 };
    \n+
    888
    \n+
    889#ifndef DOXYGEN
    \n+
    890
    \n+
    891 template<class V>
    \n+
    892 inline const void* CommPolicy<V>::getAddress(const V& v, int index)
    \n+
    893 {
    \n+
    894 return &(v[index]);
    \n+
    895 }
    \n+
    896
    \n+
    897 template<class V>
    \n+
    898 inline int CommPolicy<V>::getSize([[maybe_unused]] const V& v, [[maybe_unused]] int index)
    \n+
    899 {
    \n+
    900 return 1;
    \n+
    901 }
    \n+
    902
    \n+
    903 template<class K, class A, int n>
    \n+
    904 inline const void* CommPolicy<VariableBlockVector<FieldVector<K, n>, A> >::getAddress(const Type& v, int index)
    \n+
    905 {
    \n+
    906 return &(v[index][0]);
    \n+
    907 }
    \n+
    908
    \n+
    909 template<class K, class A, int n>
    \n+
    910 inline int CommPolicy<VariableBlockVector<FieldVector<K, n>, A> >::getSize(const Type& v, int index)
    \n+
    911 {
    \n+
    912 return v[index].getsize();
    \n+
    913 }
    \n+
    914
    \n+
    915 template<class T>
    \n+
    916 inline const typename CopyGatherScatter<T>::IndexedType& CopyGatherScatter<T>::gather(const T & vec, std::size_t i)
    \n+
    917 {
    \n+
    918 return vec[i];
    \n+
    919 }
    \n+
    920
    \n+
    921 template<class T>
    \n+
    922 inline void CopyGatherScatter<T>::scatter(T& vec, const IndexedType& v, std::size_t i)
    \n+
    923 {
    \n+
    924 vec[i]=v;
    \n+
    925 }
    \n+
    926
    \n+
    927 template<typename T>
    \n+
    928 DatatypeCommunicator<T>::DatatypeCommunicator()
    \n+
    929 : remoteIndices_(0), created_(false)
    \n+
    930 {
    \n+
    931 requests_[0]=0;
    \n+
    932 requests_[1]=0;
    \n+
    933 }
    \n+
    934
    \n+
    935
    \n+
    936
    \n+
    937 template<typename T>
    \n+
    938 DatatypeCommunicator<T>::~DatatypeCommunicator()
    \n+
    939 {
    \n+
    940 free();
    \n+
    941 }
    \n+
    942
    \n+
    943 template<typename T>
    \n+
    944 template<class T1, class T2, class V>
    \n+
    945 inline void DatatypeCommunicator<T>::build(const RemoteIndices& remoteIndices,
    \n+
    946 const T1& source, V& sendData,
    \n+
    947 const T2& destination, V& receiveData)
    \n+
    948 {
    \n+
    949 remoteIndices_ = &remoteIndices;
    \n+
    950 free();
    \n+
    951 createDataTypes<T1,T2,V,false>(source,destination, receiveData);
    \n+
    952 createDataTypes<T1,T2,V,true>(source,destination, sendData);
    \n+
    953 createRequests<V,true>(sendData, receiveData);
    \n+
    954 createRequests<V,false>(receiveData, sendData);
    \n+
    955 created_=true;
    \n+
    956 }
    \n+
    957
    \n+
    958 template<typename T>
    \n+
    959 void DatatypeCommunicator<T>::free()
    \n+
    960 {
    \n+
    961 if(created_) {
    \n+
    962 delete[] requests_[0];
    \n+
    963 delete[] requests_[1];
    \n+
    964 typedef MessageTypeMap::iterator iterator;
    \n+
    965 typedef MessageTypeMap::const_iterator const_iterator;
    \n+
    966
    \n+
    967 const const_iterator end=messageTypes.end();
    \n+
    968
    \n+
    969 for(iterator process = messageTypes.begin(); process != end; ++process) {
    \n+
    970 MPI_Datatype *type = &(process->second.first);
    \n+
    971 int finalized=0;
    \n+
    972 MPI_Finalized(&finalized);
    \n+
    973 if(*type!=MPI_DATATYPE_NULL && !finalized)
    \n+
    974 MPI_Type_free(type);
    \n+
    975 type = &(process->second.second);
    \n+
    976 if(*type!=MPI_DATATYPE_NULL && !finalized)
    \n+
    977 MPI_Type_free(type);
    \n+
    978 }
    \n+
    979 messageTypes.clear();
    \n+
    980 created_=false;
    \n+
    981 }
    \n+
    982
    \n+
    983 }
    \n+
    984
    \n+
    985 template<typename T>
    \n+
    986 template<class T1, class T2, class V, bool send>
    \n+
    987 void DatatypeCommunicator<T>::createDataTypes(const T1& sourceFlags, const T2& destFlags, V& data)
    \n+
    988 {
    \n+
    989
    \n+
    990 MPIDatatypeInformation<V> dataInfo(data);
    \n+
    991 this->template buildInterface<RemoteIndices,T1,T2,MPIDatatypeInformation<V>,send>(*remoteIndices_,sourceFlags, destFlags, dataInfo);
    \n+
    992
    \n+
    993 typedef typename RemoteIndices::RemoteIndexMap::const_iterator const_iterator;
    \n+
    994 const const_iterator end=this->remoteIndices_->end();
    \n+
    995
    \n+
    996 // Allocate MPI_Datatypes and deallocate memory for the type construction.
    \n+
    997 for(const_iterator process=this->remoteIndices_->begin(); process != end; ++process) {
    \n+
    998 IndexedTypeInformation& info=dataInfo.information_[process->first];
    \n+
    999 // Shift the displacement
    \n+
    1000 MPI_Aint base;
    \n+
    1001 MPI_Get_address(const_cast<void *>(CommPolicy<V>::getAddress(data, 0)), &base);
    \n+
    1002
    \n+
    1003 for(int i=0; i< info.elements; i++) {
    \n+
    1004 info.displ[i]-=base;
    \n+
    1005 }
    \n+
    1006
    \n+
    1007 // Create data type
    \n+
    1008 MPI_Datatype* type = &( send ? messageTypes[process->first].first : messageTypes[process->first].second);
    \n+
    1009 MPI_Type_create_hindexed(info.elements, info.length, info.displ,
    \n+
    1010 MPITraits<typename CommPolicy<V>::IndexedType>::getType(), type);
    \n+
    1011 MPI_Type_commit(type);
    \n+
    1012 // Deallocate memory
    \n+
    1013 info.free();
    \n+
    1014 }
    \n+
    1015 }
    \n+
    1016
    \n+
    1017 template<typename T>
    \n+
    1018 template<class V, bool createForward>
    \n+
    1019 void DatatypeCommunicator<T>::createRequests(V& sendData, V& receiveData)
    \n+
    1020 {
    \n+
    1021 typedef std::map<int,std::pair<MPI_Datatype,MPI_Datatype> >::const_iterator MapIterator;
    \n+
    1022 int rank;
    \n+
    1023 static int index = createForward ? 1 : 0;
    \n+
    1024 int noMessages = messageTypes.size();
    \n+
    1025 // allocate request handles
    \n+
    1026 requests_[index] = new MPI_Request[2*noMessages];
    \n+
    1027 const MapIterator end = messageTypes.end();
    \n+
    1028 int request=0;
    \n+
    1029 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    \n+
    1030
    \n+
    1031 // Set up the requests for receiving first
    \n+
    1032 for(MapIterator process = messageTypes.begin(); process != end;
    \n+
    1033 ++process, ++request) {
    \n+
    1034 MPI_Datatype type = createForward ? process->second.second : process->second.first;
    \n+
    1035 void* address = const_cast<void*>(CommPolicy<V>::getAddress(receiveData,0));
    \n+
    1036 MPI_Recv_init(address, 1, type, process->first, commTag_, this->remoteIndices_->communicator(), requests_[index]+request);
    \n+
    1037 }
    \n+
    1038
    \n+
    1039 // And now the send requests
    \n+
    1040
    \n+
    1041 for(MapIterator process = messageTypes.begin(); process != end;
    \n+
    1042 ++process, ++request) {
    \n+
    1043 MPI_Datatype type = createForward ? process->second.first : process->second.second;
    \n+
    1044 void* address = const_cast<void*>(CommPolicy<V>::getAddress(sendData, 0));
    \n+
    1045 MPI_Ssend_init(address, 1, type, process->first, commTag_, this->remoteIndices_->communicator(), requests_[index]+request);
    \n+
    1046 }
    \n+
    1047 }
    \n+
    1048
    \n+
    1049 template<typename T>
    \n+
    1050 void DatatypeCommunicator<T>::forward()
    \n+
    1051 {
    \n+
    1052 sendRecv(requests_[1]);
    \n+
    1053 }
    \n+
    1054
    \n+
    1055 template<typename T>
    \n+
    1056 void DatatypeCommunicator<T>::backward()
    \n+
    1057 {
    \n+
    1058 sendRecv(requests_[0]);
    \n+
    1059 }
    \n+
    1060
    \n+
    1061 template<typename T>
    \n+
    1062 void DatatypeCommunicator<T>::sendRecv(MPI_Request* requests)
    \n+
    1063 {
    \n+
    1064 int noMessages = messageTypes.size();
    \n+
    1065 // Start the receive calls first
    \n+
    1066 MPI_Startall(noMessages, requests);
    \n+
    1067 // Now the send calls
    \n+
    1068 MPI_Startall(noMessages, requests+noMessages);
    \n+
    1069
    \n+
    1070 // Wait for completion of the communication send first then receive
    \n+
    1071 MPI_Status* status=new MPI_Status[2*noMessages];
    \n+
    1072 for(int i=0; i<2*noMessages; i++)
    \n+
    1073 status[i].MPI_ERROR=MPI_SUCCESS;
    \n+
    1074
    \n+
    1075 int send = MPI_Waitall(noMessages, requests+noMessages, status+noMessages);
    \n+
    1076 int receive = MPI_Waitall(noMessages, requests, status);
    \n+
    1077
    \n+
    1078 // Error checks
    \n+
    1079 int success=1, globalSuccess=0;
    \n+
    1080 if(send==MPI_ERR_IN_STATUS) {
    \n+
    1081 int rank;
    \n+
    1082 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank);
    \n+
    1083 std::cerr<<rank<<": Error in sending :"<<std::endl;
    \n+
    1084 // Search for the error
    \n+
    1085 for(int i=noMessages; i< 2*noMessages; i++)
    \n+
    1086 if(status[i].MPI_ERROR!=MPI_SUCCESS) {
    \n+
    1087 char message[300];
    \n+
    1088 int messageLength;
    \n+
    1089 MPI_Error_string(status[i].MPI_ERROR, message, &messageLength);
    \n+
    1090 std::cerr<<" source="<<status[i].MPI_SOURCE<<" message: ";
    \n+
    1091 for(int j = 0; j < messageLength; j++)
    \n+
    1092 std::cout << message[j];
    \n+
    1093 }
    \n+
    1094 std::cerr<<std::endl;
    \n+
    1095 success=0;
    \n+
    1096 }
    \n+
    1097
    \n+
    1098 if(receive==MPI_ERR_IN_STATUS) {
    \n+
    1099 int rank;
    \n+
    1100 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank);
    \n+
    1101 std::cerr<<rank<<": Error in receiving!"<<std::endl;
    \n+
    1102 // Search for the error
    \n+
    1103 for(int i=0; i< noMessages; i++)
    \n+
    1104 if(status[i].MPI_ERROR!=MPI_SUCCESS) {
    \n+
    1105 char message[300];
    \n+
    1106 int messageLength;
    \n+
    1107 MPI_Error_string(status[i].MPI_ERROR, message, &messageLength);
    \n+
    1108 std::cerr<<" source="<<status[i].MPI_SOURCE<<" message: ";
    \n+
    1109 for(int j = 0; j < messageLength; j++)
    \n+
    1110 std::cerr << message[j];
    \n+
    1111 }
    \n+
    1112 std::cerr<<std::endl;
    \n+
    1113 success=0;
    \n+
    1114 }
    \n+
    1115
    \n+
    1116 MPI_Allreduce(&success, &globalSuccess, 1, MPI_INT, MPI_MIN, this->remoteIndices_->communicator());
    \n+
    1117
    \n+
    1118 delete[] status;
    \n+
    1119
    \n+
    1120 if(!globalSuccess)
    \n+
    1121 DUNE_THROW(CommunicationError, "A communication error occurred!");
    \n+
    1122
    \n+
    1123 }
    \n+
    1124
    \n+\n+
    1126 {
    \n+
    1127 buffers_[0]=0;
    \n+
    1128 buffers_[1]=0;
    \n+
    1129 bufferSize_[0]=0;
    \n+
    1130 bufferSize_[1]=0;
    \n+
    1131 }
    \n+
    1132
    \n+
    1133 template<class Data, class Interface>
    \n+
    1134 typename std::enable_if<std::is_same<SizeOne, typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type
    \n+
    1135 BufferedCommunicator::build(const Interface& interface)
    \n+
    1136 {
    \n+
    1137 interfaces_=interface.interfaces();
    \n+
    1138 communicator_=interface.communicator();
    \n+
    1139 typedef typename std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
    \n+
    1140 ::const_iterator const_iterator;
    \n+
    1141 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
    \n+
    1142 const const_iterator end = interfaces_.end();
    \n+
    1143 int lrank;
    \n+
    1144 MPI_Comm_rank(communicator_, &lrank);
    \n+
    1145
    \n+
    1146 bufferSize_[0]=0;
    \n+
    1147 bufferSize_[1]=0;
    \n+
    1148
    \n+
    1149 for(const_iterator interfacePair = interfaces_.begin();
    \n+
    1150 interfacePair != end; ++interfacePair) {
    \n+
    1151 int noSend = MessageSizeCalculator<Data,Flag>() (interfacePair->second.first);
    \n+
    1152 int noRecv = MessageSizeCalculator<Data,Flag>() (interfacePair->second.second);
    \n+
    1153 if (noSend + noRecv > 0)
    \n+
    1154 messageInformation_.insert(std::make_pair(interfacePair->first,
    \n+
    1155 std::make_pair(MessageInformation(bufferSize_[0],
    \n+
    1156 noSend*sizeof(typename CommPolicy<Data>::IndexedType)),
    \n+
    1157 MessageInformation(bufferSize_[1],
    \n+
    1158 noRecv*sizeof(typename CommPolicy<Data>::IndexedType)))));
    \n+
    1159 bufferSize_[0] += noSend;
    \n+
    1160 bufferSize_[1] += noRecv;
    \n+
    1161 }
    \n+
    1162
    \n+
    1163 // allocate the buffers
    \n+
    1164 bufferSize_[0] *= sizeof(typename CommPolicy<Data>::IndexedType);
    \n+
    1165 bufferSize_[1] *= sizeof(typename CommPolicy<Data>::IndexedType);
    \n+
    1166
    \n+
    1167 buffers_[0] = new char[bufferSize_[0]];
    \n+
    1168 buffers_[1] = new char[bufferSize_[1]];
    \n+
    1169 }
    \n+
    1170
    \n+
    1171 template<class Data, class Interface>
    \n+
    1172 void BufferedCommunicator::build(const Data& source, const Data& dest, const Interface& interface)
    \n+
    1173 {
    \n+
    1174
    \n+
    1175 interfaces_=interface.interfaces();
    \n+
    1176 communicator_=interface.communicator();
    \n+
    1177 typedef typename std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
    \n+
    1178 ::const_iterator const_iterator;
    \n+
    1179 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
    \n+
    1180 const const_iterator end = interfaces_.end();
    \n+
    1181
    \n+
    1182 bufferSize_[0]=0;
    \n+
    1183 bufferSize_[1]=0;
    \n+
    1184
    \n+
    1185 for(const_iterator interfacePair = interfaces_.begin();
    \n+
    1186 interfacePair != end; ++interfacePair) {
    \n+
    1187 int noSend = MessageSizeCalculator<Data,Flag>() (source, interfacePair->second.first);
    \n+
    1188 int noRecv = MessageSizeCalculator<Data,Flag>() (dest, interfacePair->second.second);
    \n+
    1189 if (noSend + noRecv > 0)
    \n+
    1190 messageInformation_.insert(std::make_pair(interfacePair->first,
    \n+
    1191 std::make_pair(MessageInformation(bufferSize_[0],
    \n+
    1192 noSend*sizeof(typename CommPolicy<Data>::IndexedType)),
    \n+
    1193 MessageInformation(bufferSize_[1],
    \n+
    1194 noRecv*sizeof(typename CommPolicy<Data>::IndexedType)))));
    \n+
    1195 bufferSize_[0] += noSend;
    \n+
    1196 bufferSize_[1] += noRecv;
    \n+
    1197 }
    \n+
    1198
    \n+
    1199 bufferSize_[0] *= sizeof(typename CommPolicy<Data>::IndexedType);
    \n+
    1200 bufferSize_[1] *= sizeof(typename CommPolicy<Data>::IndexedType);
    \n+
    1201 // allocate the buffers
    \n+
    1202 buffers_[0] = new char[bufferSize_[0]];
    \n+
    1203 buffers_[1] = new char[bufferSize_[1]];
    \n+
    1204 }
    \n+
    1205
    \n+
    1206 inline void BufferedCommunicator::free()
    \n+
    1207 {
    \n+
    1208 messageInformation_.clear();
    \n+
    1209 if(buffers_[0])
    \n+
    1210 delete[] buffers_[0];
    \n+
    1211
    \n+
    1212 if(buffers_[1])
    \n+
    1213 delete[] buffers_[1];
    \n+
    1214 buffers_[0]=buffers_[1]=0;
    \n+
    1215 }
    \n+
    1216
    \n+\n+
    1218 {
    \n+
    1219 free();
    \n+
    1220 }
    \n+
    1221
    \n+
    1222 template<class Data>
    \n+
    1223 inline int BufferedCommunicator::MessageSizeCalculator<Data,SizeOne>::operator()
    \n+
    1224 (const InterfaceInformation& info) const
    \n+
    1225 {
    \n+
    1226 return info.size();
    \n+
    1227 }
    \n+
    1228
    \n+
    1229
    \n+
    1230 template<class Data>
    \n+
    1231 inline int BufferedCommunicator::MessageSizeCalculator<Data,SizeOne>::operator()
    \n+
    1232 (const Data&, const InterfaceInformation& info) const
    \n+
    1233 {
    \n+
    1234 return operator()(info);
    \n+
    1235 }
    \n+
    1236
    \n+
    1237
    \n+
    1238 template<class Data>
    \n+
    1239 inline int BufferedCommunicator::MessageSizeCalculator<Data, VariableSize>::operator()
    \n+
    1240 (const Data& data, const InterfaceInformation& info) const
    \n+
    1241 {
    \n+
    1242 int entries=0;
    \n+
    1243
    \n+
    1244 for(size_t i=0; i < info.size(); i++)
    \n+
    1245 entries += CommPolicy<Data>::getSize(data,info[i]);
    \n+
    1246
    \n+
    1247 return entries;
    \n+
    1248 }
    \n+
    1249
    \n+
    1250
    \n+
    1251 template<class Data, class GatherScatter, bool FORWARD>
    \n+
    1252 inline void BufferedCommunicator::MessageGatherer<Data,GatherScatter,FORWARD,VariableSize>::operator()(const InterfaceMap& interfaces,const Data& data, Type* buffer, [[maybe_unused]] size_t bufferSize) const
    \n+
    1253 {
    \n+
    1254 typedef typename InterfaceMap::const_iterator
    \n+
    1255 const_iterator;
    \n+
    1256
    \n+
    1257 int rank;
    \n+
    1258 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    \n+
    1259 const const_iterator end = interfaces.end();
    \n+
    1260 size_t index=0;
    \n+
    1261
    \n+
    1262 for(const_iterator interfacePair = interfaces.begin();
    \n+
    1263 interfacePair != end; ++interfacePair) {
    \n+
    1264 int size = forward ? interfacePair->second.first.size() :
    \n+
    1265 interfacePair->second.second.size();
    \n+
    1266
    \n+
    1267 for(int i=0; i < size; i++) {
    \n+
    1268 int local = forward ? interfacePair->second.first[i] :
    \n+
    1269 interfacePair->second.second[i];
    \n+
    1270 for(std::size_t j=0; j < CommPolicy<Data>::getSize(data, local); j++, index++) {
    \n+
    1271
    \n+
    1272#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1273 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy<Data>::IndexedType));
    \n+
    1274#endif
    \n+
    1275 buffer[index]=GatherScatter::gather(data, local, j);
    \n+
    1276 }
    \n+
    1277
    \n+
    1278 }
    \n+
    1279 }
    \n+
    1280
    \n+
    1281 }
    \n+
    1282
    \n+
    1283
    \n+
    1284 template<class Data, class GatherScatter, bool FORWARD>
    \n+
    1285 inline void BufferedCommunicator::MessageGatherer<Data,GatherScatter,FORWARD,SizeOne>::operator()(
    \n+
    1286 const InterfaceMap& interfaces, const Data& data, Type* buffer, [[maybe_unused]] size_t bufferSize) const
    \n+
    1287 {
    \n+
    1288 typedef typename InterfaceMap::const_iterator
    \n+
    1289 const_iterator;
    \n+
    1290 const const_iterator end = interfaces.end();
    \n+
    1291 size_t index = 0;
    \n+
    1292
    \n+
    1293 int rank;
    \n+
    1294 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    \n+
    1295
    \n+
    1296 for(const_iterator interfacePair = interfaces.begin();
    \n+
    1297 interfacePair != end; ++interfacePair) {
    \n+
    1298 size_t size = FORWARD ? interfacePair->second.first.size() :
    \n+
    1299 interfacePair->second.second.size();
    \n+
    1300
    \n+
    1301 for(size_t i=0; i < size; i++) {
    \n+
    1302
    \n+
    1303#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1304 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy<Data>::IndexedType));
    \n+
    1305#endif
    \n+
    1306
    \n+
    1307 buffer[index++] = GatherScatter::gather(data, FORWARD ? interfacePair->second.first[i] :
    \n+
    1308 interfacePair->second.second[i]);
    \n+
    1309 }
    \n+
    1310 }
    \n+
    1311
    \n+
    1312 }
    \n+
    1313
    \n+
    1314
    \n+
    1315 template<class Data, class GatherScatter, bool FORWARD>
    \n+
    1316 inline void BufferedCommunicator::MessageScatterer<Data,GatherScatter,FORWARD,VariableSize>::operator()(const InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const
    \n+
    1317 {
    \n+
    1318 typedef typename InterfaceMap::value_type::second_type::first_type Information;
    \n+
    1319 const typename InterfaceMap::const_iterator infoPair = interfaces.find(proc);
    \n+
    1320
    \n+
    1321 assert(infoPair!=interfaces.end());
    \n+
    1322
    \n+
    1323 const Information& info = FORWARD ? infoPair->second.second :
    \n+
    1324 infoPair->second.first;
    \n+
    1325
    \n+
    1326 for(size_t i=0, index=0; i < info.size(); i++) {
    \n+
    1327 for(size_t j=0; j < CommPolicy<Data>::getSize(data, info[i]); j++)
    \n+
    1328 GatherScatter::scatter(data, buffer[index++], info[i], j);
    \n+
    1329 }
    \n+
    1330 }
    \n+
    1331
    \n+
    1332
    \n+
    1333 template<class Data, class GatherScatter, bool FORWARD>
    \n+
    1334 inline void BufferedCommunicator::MessageScatterer<Data,GatherScatter,FORWARD,SizeOne>::operator()(const InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const
    \n+
    1335 {
    \n+
    1336 typedef typename InterfaceMap::value_type::second_type::first_type Information;
    \n+
    1337 const typename InterfaceMap::const_iterator infoPair = interfaces.find(proc);
    \n+
    1338
    \n+
    1339 assert(infoPair!=interfaces.end());
    \n+
    1340
    \n+
    1341 const Information& info = FORWARD ? infoPair->second.second :
    \n+
    1342 infoPair->second.first;
    \n+
    1343
    \n+
    1344 for(size_t i=0; i < info.size(); i++) {
    \n+
    1345 GatherScatter::scatter(data, buffer[i], info[i]);
    \n+
    1346 }
    \n+
    1347 }
    \n+
    1348
    \n+
    1349
    \n+
    1350 template<class GatherScatter,class Data>
    \n+
    1351 void BufferedCommunicator::forward(Data& data)
    \n+
    1352 {
    \n+
    1353 this->template sendRecv<GatherScatter,true>(data, data);
    \n+
    1354 }
    \n+
    1355
    \n+
    1356
    \n+
    1357 template<class GatherScatter, class Data>
    \n+
    1358 void BufferedCommunicator::backward(Data& data)
    \n+
    1359 {
    \n+
    1360 this->template sendRecv<GatherScatter,false>(data, data);
    \n+
    1361 }
    \n+
    1362
    \n+
    1363
    \n+
    1364 template<class GatherScatter, class Data>
    \n+
    1365 void BufferedCommunicator::forward(const Data& source, Data& dest)
    \n+
    1366 {
    \n+
    1367 this->template sendRecv<GatherScatter,true>(source, dest);
    \n+
    1368 }
    \n+
    1369
    \n+
    1370
    \n+
    1371 template<class GatherScatter, class Data>
    \n+
    1372 void BufferedCommunicator::backward(Data& source, const Data& dest)
    \n+
    1373 {
    \n+
    1374 this->template sendRecv<GatherScatter,false>(dest, source);
    \n+
    1375 }
    \n+
    1376
    \n+
    1377
    \n+
    1378 template<class GatherScatter, bool FORWARD, class Data>
    \n+
    1379 void BufferedCommunicator::sendRecv(const Data& source, Data& dest)
    \n+
    1380 {
    \n+
    1381 int rank, lrank;
    \n+
    1382
    \n+
    1383 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
    \n+
    1384 MPI_Comm_rank(MPI_COMM_WORLD,&lrank);
    \n+
    1385
    \n+
    1386 typedef typename CommPolicy<Data>::IndexedType Type;
    \n+
    1387 Type *sendBuffer, *recvBuffer;
    \n+
    1388 size_t sendBufferSize;
    \n+
    1389#ifndef NDEBUG
    \n+
    1390 size_t recvBufferSize;
    \n+
    1391#endif
    \n+
    1392
    \n+
    1393 if(FORWARD) {
    \n+
    1394 sendBuffer = reinterpret_cast<Type*>(buffers_[0]);
    \n+
    1395 sendBufferSize = bufferSize_[0];
    \n+
    1396 recvBuffer = reinterpret_cast<Type*>(buffers_[1]);
    \n+
    1397#ifndef NDEBUG
    \n+
    1398 recvBufferSize = bufferSize_[1];
    \n+
    1399#endif
    \n+
    1400 }else{
    \n+
    1401 sendBuffer = reinterpret_cast<Type*>(buffers_[1]);
    \n+
    1402 sendBufferSize = bufferSize_[1];
    \n+
    1403 recvBuffer = reinterpret_cast<Type*>(buffers_[0]);
    \n+
    1404#ifndef NDEBUG
    \n+
    1405 recvBufferSize = bufferSize_[0];
    \n+
    1406#endif
    \n+
    1407 }
    \n+
    1408 typedef typename CommPolicy<Data>::IndexedTypeFlag Flag;
    \n+
    1409
    \n+
    1410 MessageGatherer<Data,GatherScatter,FORWARD,Flag>() (interfaces_, source, sendBuffer, sendBufferSize);
    \n+
    1411
    \n+
    1412 MPI_Request* sendRequests = new MPI_Request[messageInformation_.size()];
    \n+
    1413 MPI_Request* recvRequests = new MPI_Request[messageInformation_.size()];
    \n+
    1414 /* Number of recvRequests that are not MPI_REQUEST_NULL */
    \n+
    1415 size_t numberOfRealRecvRequests = 0;
    \n+
    1416
    \n+
    1417 // Setup receive first
    \n+
    1418 typedef typename InformationMap::const_iterator const_iterator;
    \n+
    1419
    \n+
    1420 const const_iterator end = messageInformation_.end();
    \n+
    1421 size_t i=0;
    \n+
    1422 int* processMap = new int[messageInformation_.size()];
    \n+
    1423
    \n+
    1424 for(const_iterator info = messageInformation_.begin(); info != end; ++info, ++i) {
    \n+
    1425 processMap[i]=info->first;
    \n+
    1426 if(FORWARD) {
    \n+
    1427 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
    \n+
    1428 Dune::dvverb<<rank<<": receiving "<<info->second.second.size_<<" from "<<info->first<<std::endl;
    \n+
    1429 if(info->second.second.size_) {
    \n+
    1430 MPI_Irecv(recvBuffer+info->second.second.start_, info->second.second.size_,
    \n+
    1431 MPI_BYTE, info->first, commTag_, communicator_,
    \n+
    1432 recvRequests+i);
    \n+
    1433 numberOfRealRecvRequests += 1;
    \n+
    1434 } else {
    \n+
    1435 // Nothing to receive -> set request to inactive
    \n+
    1436 recvRequests[i]=MPI_REQUEST_NULL;
    \n+
    1437 }
    \n+
    1438 }else{
    \n+
    1439 assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= recvBufferSize );
    \n+
    1440 Dune::dvverb<<rank<<": receiving "<<info->second.first.size_<<" to "<<info->first<<std::endl;
    \n+
    1441 if(info->second.first.size_) {
    \n+
    1442 MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_,
    \n+
    1443 MPI_BYTE, info->first, commTag_, communicator_,
    \n+
    1444 recvRequests+i);
    \n+
    1445 numberOfRealRecvRequests += 1;
    \n+
    1446 } else {
    \n+
    1447 // Nothing to receive -> set request to inactive
    \n+
    1448 recvRequests[i]=MPI_REQUEST_NULL;
    \n+
    1449 }
    \n+
    1450 }
    \n+
    1451 }
    \n+
    1452
    \n+
    1453 // now the send requests
    \n+
    1454 i=0;
    \n+
    1455 for(const_iterator info = messageInformation_.begin(); info != end; ++info, ++i)
    \n+
    1456 if(FORWARD) {
    \n+
    1457 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
    \n+
    1458 Dune::dvverb<<rank<<": sending "<<info->second.first.size_<<" to "<<info->first<<std::endl;
    \n+
    1459 assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= sendBufferSize );
    \n+
    1460 if(info->second.first.size_)
    \n+
    1461 MPI_Issend(sendBuffer+info->second.first.start_, info->second.first.size_,
    \n+
    1462 MPI_BYTE, info->first, commTag_, communicator_,
    \n+
    1463 sendRequests+i);
    \n+
    1464 else
    \n+
    1465 // Nothing to send -> set request to inactive
    \n+
    1466 sendRequests[i]=MPI_REQUEST_NULL;
    \n+
    1467 }else{
    \n+
    1468 assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= sendBufferSize );
    \n+
    1469 Dune::dvverb<<rank<<": sending "<<info->second.second.size_<<" to "<<info->first<<std::endl;
    \n+
    1470 if(info->second.second.size_)
    \n+
    1471 MPI_Issend(sendBuffer+info->second.second.start_, info->second.second.size_,
    \n+
    1472 MPI_BYTE, info->first, commTag_, communicator_,
    \n+
    1473 sendRequests+i);
    \n+
    1474 else
    \n+
    1475 // Nothing to send -> set request to inactive
    \n+
    1476 sendRequests[i]=MPI_REQUEST_NULL;
    \n+
    1477 }
    \n+
    1478
    \n+
    1479 // Wait for completion of receive and immediately start scatter
    \n+
    1480 i=0;
    \n+
    1481 //int success = 1;
    \n+
    1482 int finished = MPI_UNDEFINED;
    \n+
    1483 MPI_Status status; //[messageInformation_.size()];
    \n+
    1484 //MPI_Waitall(messageInformation_.size(), recvRequests, status);
    \n+
    1485
    \n+
    1486 for(i=0; i< numberOfRealRecvRequests; i++) {
    \n+
    1487 status.MPI_ERROR=MPI_SUCCESS;
    \n+
    1488 MPI_Waitany(messageInformation_.size(), recvRequests, &finished, &status);
    \n+
    1489 assert(finished != MPI_UNDEFINED);
    \n+
    1490
    \n+
    1491 if(status.MPI_ERROR==MPI_SUCCESS) {
    \n+
    1492 int& proc = processMap[finished];
    \n+
    1493 typename InformationMap::const_iterator infoIter = messageInformation_.find(proc);
    \n+
    1494 assert(infoIter != messageInformation_.end());
    \n+
    1495
    \n+
    1496 MessageInformation info = (FORWARD) ? infoIter->second.second : infoIter->second.first;
    \n+
    1497 assert(info.start_+info.size_ <= recvBufferSize);
    \n+
    1498
    \n+
    1499 MessageScatterer<Data,GatherScatter,FORWARD,Flag>() (interfaces_, dest, recvBuffer+info.start_, proc);
    \n+
    1500 }else{
    \n+
    1501 std::cerr<<rank<<": MPI_Error occurred while receiving message from "<<processMap[finished]<<std::endl;
    \n+
    1502 //success=0;
    \n+
    1503 }
    \n+
    1504 }
    \n+
    1505
    \n+
    1506 MPI_Status recvStatus;
    \n+
    1507
    \n+
    1508 // Wait for completion of sends
    \n+
    1509 for(i=0; i< messageInformation_.size(); i++)
    \n+
    1510 if(MPI_SUCCESS!=MPI_Wait(sendRequests+i, &recvStatus)) {
    \n+
    1511 std::cerr<<rank<<": MPI_Error occurred while sending message to "<<processMap[finished]<<std::endl;
    \n+
    1512 //success=0;
    \n+
    1513 }
    \n+
    1514 /*
    \n+
    1515 int globalSuccess;
    \n+
    1516 MPI_Allreduce(&success, &globalSuccess, 1, MPI_INT, MPI_MIN, interface_->communicator());
    \n+
    1517
    \n+
    1518 if(!globalSuccess)
    \n+
    1519 DUNE_THROW(CommunicationError, "A communication error occurred!");
    \n+
    1520 */
    \n+
    1521 delete[] processMap;
    \n+
    1522 delete[] sendRequests;
    \n+
    1523 delete[] recvRequests;
    \n+
    1524
    \n+
    1525 }
    \n+
    1526
    \n+
    1527#endif // DOXYGEN
    \n+
    1528
    \n+
    1530}
    \n+
    1531
    \n+
    1532#endif // HAVE_MPI
    \n+
    1533
    \n+
    1534#endif
    \n+
    Classes describing a distributed indexset.
    \n+
    Standard Dune debug streams.
    \n+
    A few common exception classes.
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    DVVerbType dvverb(std::cout)
    stream for very verbose output.
    Definition: stdstreams.hh:95
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    Default exception class for I/O errors.
    Definition: exceptions.hh:231
    \n+
    Flag for marking indexed data structures where data at each index is of the same size.
    Definition: communicator.hh:110
    \n+
    Flag for marking indexed data structures where the data at each index may be a variable multiple of a...
    Definition: communicator.hh:118
    \n+
    Default policy used for communicating an indexed type.
    Definition: communicator.hh:128
    \n+
    V::value_type IndexedType
    The type we get at each index with operator[].
    Definition: communicator.hh:147
    \n+
    static int getSize(const V &, int index)
    Get the number of primitive elements at that index.
    \n+
    SizeOne IndexedTypeFlag
    Whether the indexed type has variable size or there is always one value at each index.
    Definition: communicator.hh:153
    \n+
    static const void * getAddress(const V &v, int index)
    Get the address of entry at an index.
    \n+
    V Type
    The type the policy is for.
    Definition: communicator.hh:140
    \n+
    Definition: communicator.hh:173
    \n+
    Definition: communicator.hh:175
    \n+\n+\n+
    VariableBlockVector< FieldVector< K, n >, A > Type
    Definition: communicator.hh:180
    \n+\n+\n+
    Error thrown if there was a problem with the communication.
    Definition: communicator.hh:195
    \n+
    GatherScatter default implementation that just copies data.
    Definition: communicator.hh:202
    \n+
    static void scatter(T &vec, const IndexedType &v, std::size_t i)
    \n+
    CommPolicy< T >::IndexedType IndexedType
    Definition: communicator.hh:203
    \n+
    static const IndexedType & gather(const T &vec, std::size_t i)
    \n+
    A communicator that uses buffers to gather and scatter the data to be send or received.
    Definition: communicator.hh:458
    \n+
    void backward(Data &data)
    Backward send where target and source are the same.
    \n+
    BufferedCommunicator()
    Constructor.
    \n+
    ~BufferedCommunicator()
    Destructor.
    \n+
    void forward(const Data &source, Data &dest)
    Send from source to target.
    \n+
    void free()
    Free the allocated memory (i.e. buffers and message information.
    \n+
    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.
    \n+
    void backward(Data &source, const Data &dest)
    Communicate in the reverse direction, i.e. send from target to source.
    \n+
    void build(const Data &source, const Data &target, const Interface &interface)
    Build the buffers and information for the communication process.
    \n+
    void forward(Data &data)
    Forward send where target and source are the same.
    \n+
    Manager class for the mapping between local indices and globally unique indices.
    Definition: indexset.hh:218
    \n+
    Base class of all classes representing a communication interface.
    Definition: parallel/interface.hh:35
    \n+
    Information describing an interface.
    Definition: parallel/interface.hh:101
    \n+
    Communication interface between remote and local indices.
    Definition: parallel/interface.hh:209
    \n+
    An index present on the local process.
    Definition: localindex.hh:35
    \n+
    The indices present on remote processes.
    Definition: remoteindices.hh:189
    \n+
    ParallelIndexSet::GlobalIndex GlobalIndex
    The type of the global index.
    Definition: remoteindices.hh:215
    \n+
    LocalIndex::Attribute Attribute
    The type of the attribute.
    Definition: remoteindices.hh:226
    \n+
    ParallelIndexSet::LocalIndex LocalIndex
    The type of the local index.
    Definition: remoteindices.hh:221
    \n+
    Provides classes for building the communication interface between remote indices.
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,68 +4,1208 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-path.hh\n+ * parallel\n+communicator.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_PATH_HH\n- 6#define DUNE_COMMON_PATH_HH\n+ 5#ifndef DUNE_COMMUNICATOR\n+ 6#define DUNE_COMMUNICATOR\n 7\n- 8#include \n+ 8#if HAVE_MPI\n 9\n- 10namespace Dune {\n+ 10#include \n+ 11#include \n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16\n+ 17#include \n+ 18\n+ 19#include \n+ 20#include \n+ 21#include \n+ 22#include \n 23\n- 51 std::string concatPaths(const std::string& base, const std::string& p);\n- 52\n- 54\n- 98 std::string processPath(const std::string& p);\n- 99\n- 101\n- 109 bool pathIndicatesDirectory(const std::string& p);\n- 110\n- 112\n- 151 std::string prettyPath(const std::string& p, bool isDirectory);\n- 152\n+ 24namespace Dune\n+ 25{\n+109 struct SizeOne\n+ 110 {};\n+ 111\n+117 struct VariableSize\n+ 118 {};\n+ 119\n+ 120\n+ 126 template\n+127 struct CommPolicy\n+ 128 {\n+140 typedef V Type;\n+ 141\n+147 typedef typename V::value_type IndexedType;\n+ 148\n+153 typedef SizeOne IndexedTypeFlag;\n 154\n- 160 std::string prettyPath(const std::string& p);\n- 161\n- 163\n- 179 std::string relativePath(const std::string& newbase, const std::string&\n-p);\n- 180\n- 182}\n+163 static const void* getAddress(const V& v, int index);\n+ 164\n+170 static int getSize(const V&, int index);\n+ 171 };\n+ 172\n+173 template class FieldVector;\n+ 174\n+175 template class VariableBlockVector;\n+ 176\n+ 177 template\n+178 struct CommPolicy, A> >\n+ 179 {\n+180 typedef VariableBlockVector, A> Type;\n+ 181\n+182 typedef typename Type::B IndexedType;\n 183\n- 184#endif // DUNE_COMMON_PATH_HH\n-Dune::processPath\n-std::string processPath(const std::string &p)\n-sanitize a path for further processing\n-Definition: path.cc:41\n-Dune::pathIndicatesDirectory\n-bool pathIndicatesDirectory(const std::string &p)\n-check whether the given path indicates that it is a directory\n-Definition: path.cc:115\n-Dune::prettyPath\n-std::string prettyPath(const std::string &p, bool isDirectory)\n-pretty print path\n-Definition: path.cc:126\n-Dune::relativePath\n-std::string relativePath(const std::string &newbase, const std::string &p)\n-compute a relative path between two paths\n-Definition: path.cc:153\n-Dune::concatPaths\n-std::string concatPaths(const std::string &base, const std::string &p)\n-concatenate two paths\n-Definition: path.cc:32\n+184 typedef VariableSize IndexedTypeFlag;\n+ 185\n+186 static const void* getAddress(const Type& v, int i);\n+ 187\n+188 static int getSize(const Type& v, int i);\n+ 189 };\n+ 190\n+194 class CommunicationError : public IOError\n+ 195 {};\n+ 196\n+ 200 template\n+201 struct CopyGatherScatter\n+ 202 {\n+203 typedef typename CommPolicy::IndexedType IndexedType;\n+ 204\n+205 static const IndexedType& gather(const T& vec, std::size_t i);\n+ 206\n+207 static void scatter(T& vec, const IndexedType& v, std::size_t i);\n+ 208\n+ 209 };\n+ 210\n+ 222 template\n+ 223 class DatatypeCommunicator : public InterfaceBuilder\n+ 224 {\n+ 225 public:\n+ 226\n+ 230 typedef T ParallelIndexSet;\n+ 231\n+ 235 typedef Dune::RemoteIndices RemoteIndices;\n+ 236\n+ 240 typedef typename RemoteIndices::GlobalIndex GlobalIndex;\n+ 241\n+ 245 typedef typename RemoteIndices::Attribute Attribute;\n+ 246\n+ 250 typedef typename RemoteIndices::LocalIndex LocalIndex;\n+ 251\n+ 255 DatatypeCommunicator();\n+ 256\n+ 260 ~DatatypeCommunicator();\n+ 261\n+ 288 template\n+ 289 void build(const RemoteIndices& remoteIndices, const T1& sourceFlags, V&\n+sendData, const T2& destFlags, V& receiveData);\n+ 290\n+ 294 void forward();\n+ 295\n+ 299 void backward();\n+ 300\n+ 304 void free();\n+ 305 private:\n+ 309 constexpr static int commTag_ = 234;\n+ 310\n+ 314 const RemoteIndices* remoteIndices_;\n+ 315\n+ 316 typedef std::map >\n+ 317 MessageTypeMap;\n+ 318\n+ 322 MessageTypeMap messageTypes;\n+ 323\n+ 327 void* data_;\n+ 328\n+ 329 MPI_Request* requests_[2];\n+ 330\n+ 334 bool created_;\n+ 335\n+ 339 template\n+ 340 void createRequests(V& sendData, V& receiveData);\n+ 341\n+ 345 template\n+ 346 void createDataTypes(const T1& source, const T2& destination, V& data);\n+ 347\n+ 351 void sendRecv(MPI_Request* req);\n+ 352\n+ 356 struct IndexedTypeInformation\n+ 357 {\n+ 363 void build(int i)\n+ 364 {\n+ 365 length = new int[i];\n+ 366 displ = new MPI_Aint[i];\n+ 367 size = i;\n+ 368 }\n+ 369\n+ 373 void free()\n+ 374 {\n+ 375 delete[] length;\n+ 376 delete[] displ;\n+ 377 }\n+ 379 int* length;\n+ 381 MPI_Aint* displ;\n+ 387 int elements;\n+ 391 int size;\n+ 392 };\n+ 393\n+ 399 template\n+ 400 struct MPIDatatypeInformation\n+ 401 {\n+ 406 MPIDatatypeInformation(const V& data) : data_(data)\n+ 407 {}\n+ 408\n+ 414 void reserve(int proc, int size)\n+ 415 {\n+ 416 information_[proc].build(size);\n+ 417 }\n+ 424 void add(int proc, int local)\n+ 425 {\n+ 426 IndexedTypeInformation& info=information_[proc];\n+ 427 assert((info.elements)(CommPolicy::getAddress(data_,\n+local)),\n+ 429 info.displ+info.elements);\n+ 430 info.length[info.elements]=CommPolicy::getSize(data_, local);\n+ 431 info.elements++;\n+ 432 }\n+ 433\n+ 438 std::map information_;\n+ 442 const V& data_;\n+ 443\n+ 444 };\n+ 445\n+ 446 };\n+ 447\n+457 class BufferedCommunicator\n+ 458 {\n+ 459\n+ 460 public:\n+464 BufferedCommunicator();\n+ 465\n+ 472 template\n+ 473 typename std::enable_if::\n+IndexedTypeFlag>::value, void>::type\n+474 build(const Interface& interface);\n+ 475\n+ 483 template\n+484 void build(const Data& source, const Data& target, const Interface&\n+interface);\n+ 485\n+ 514 template\n+515 void forward(const Data& source, Data& dest);\n+ 516\n+ 545 template\n+546 void backward(Data& source, const Data& dest);\n+ 547\n+ 573 template\n+574 void forward(Data& data);\n+ 575\n+ 601 template\n+602 void backward(Data& data);\n+ 603\n+607 void free();\n+ 608\n+612 ~BufferedCommunicator();\n+ 613\n+ 614 private:\n+ 615\n+ 619 typedef std::map\n+>\n+ 620 InterfaceMap;\n+ 621\n+ 622\n+ 626 template\n+ 627 struct MessageSizeCalculator\n+ 628 {};\n+ 629\n+ 634 template\n+ 635 struct MessageSizeCalculator\n+ 636 {\n+ 643 inline int operator()(const InterfaceInformation& info) const;\n+ 652 inline int operator()(const Data& data, const InterfaceInformation& info)\n+const;\n+ 653 };\n+ 654\n+ 659 template\n+ 660 struct MessageSizeCalculator\n+ 661 {\n+ 670 inline int operator()(const Data& data, const InterfaceInformation& info)\n+const;\n+ 671 };\n+ 672\n+ 676 template\n+ 677 struct MessageGatherer\n+ 678 {};\n+ 679\n+ 684 template\n+ 685 struct MessageGatherer\n+ 686 {\n+ 688 typedef typename CommPolicy::IndexedType Type;\n+ 689\n+ 694 typedef GatherScatter Gatherer;\n+ 695\n+ 701 constexpr static bool forward = send;\n+ 702\n+ 710 inline void operator()(const InterfaceMap& interface, const Data& data,\n+Type* buffer, size_t bufferSize) const;\n+ 711 };\n+ 712\n+ 717 template\n+ 718 struct MessageGatherer\n+ 719 {\n+ 721 typedef typename CommPolicy::IndexedType Type;\n+ 722\n+ 727 typedef GatherScatter Gatherer;\n+ 728\n+ 734 constexpr static bool forward = send;\n+ 735\n+ 743 inline void operator()(const InterfaceMap& interface, const Data& data,\n+Type* buffer, size_t bufferSize) const;\n+ 744 };\n+ 745\n+ 749 template\n+ 750 struct MessageScatterer\n+ 751 {};\n+ 752\n+ 757 template\n+ 758 struct MessageScatterer\n+ 759 {\n+ 761 typedef typename CommPolicy::IndexedType Type;\n+ 762\n+ 767 typedef GatherScatter Scatterer;\n+ 768\n+ 774 constexpr static bool forward = send;\n+ 775\n+ 783 inline void operator()(const InterfaceMap& interface, Data& data, Type*\n+buffer, const int& proc) const;\n+ 784 };\n+ 789 template\n+ 790 struct MessageScatterer\n+ 791 {\n+ 793 typedef typename CommPolicy::IndexedType Type;\n+ 794\n+ 799 typedef GatherScatter Scatterer;\n+ 800\n+ 806 constexpr static bool forward = send;\n+ 807\n+ 815 inline void operator()(const InterfaceMap& interface, Data& data, Type*\n+buffer, const int& proc) const;\n+ 816 };\n+ 817\n+ 821 struct MessageInformation\n+ 822 {\n+ 824 MessageInformation()\n+ 825 : start_(0), size_(0)\n+ 826 {}\n+ 827\n+ 835 MessageInformation(size_t start, size_t size)\n+ 836 : start_(start), size_(size)\n+ 837 {}\n+ 841 size_t start_;\n+ 845 size_t size_;\n+ 846 };\n+ 847\n+ 854 typedef std::map >\n+ 855 InformationMap;\n+ 859 InformationMap messageInformation_;\n+ 863 char* buffers_[2];\n+ 867 size_t bufferSize_[2];\n+ 868\n+ 872 constexpr static int commTag_ = 0;\n+ 873\n+ 877 std::map >\n+interfaces_;\n+ 878\n+ 879 MPI_Comm communicator_;\n+ 880\n+ 884 template\n+ 885 void sendRecv(const Data& source, Data& target);\n+ 886\n+ 887 };\n+ 888\n+ 889#ifndef DOXYGEN\n+ 890\n+ 891 template\n+ 892 inline const void* CommPolicy::getAddress(const V& v, int index)\n+ 893 {\n+ 894 return &(v[index]);\n+ 895 }\n+ 896\n+ 897 template\n+ 898 inline int CommPolicy::getSize([[maybe_unused]] const V& v, [\n+[maybe_unused]] int index)\n+ 899 {\n+ 900 return 1;\n+ 901 }\n+ 902\n+ 903 template\n+ 904 inline const void* CommPolicy, A>\n+>::getAddress(const Type& v, int index)\n+ 905 {\n+ 906 return &(v[index][0]);\n+ 907 }\n+ 908\n+ 909 template\n+ 910 inline int CommPolicy, A> >::getSize\n+(const Type& v, int index)\n+ 911 {\n+ 912 return v[index].getsize();\n+ 913 }\n+ 914\n+ 915 template\n+ 916 inline const typename CopyGatherScatter::IndexedType&\n+CopyGatherScatter::gather(const T & vec, std::size_t i)\n+ 917 {\n+ 918 return vec[i];\n+ 919 }\n+ 920\n+ 921 template\n+ 922 inline void CopyGatherScatter::scatter(T& vec, const IndexedType& v,\n+std::size_t i)\n+ 923 {\n+ 924 vec[i]=v;\n+ 925 }\n+ 926\n+ 927 template\n+ 928 DatatypeCommunicator::DatatypeCommunicator()\n+ 929 : remoteIndices_(0), created_(false)\n+ 930 {\n+ 931 requests_[0]=0;\n+ 932 requests_[1]=0;\n+ 933 }\n+ 934\n+ 935\n+ 936\n+ 937 template\n+ 938 DatatypeCommunicator::~DatatypeCommunicator()\n+ 939 {\n+ 940 free();\n+ 941 }\n+ 942\n+ 943 template\n+ 944 template\n+ 945 inline void DatatypeCommunicator::build(const RemoteIndices&\n+remoteIndices,\n+ 946 const T1& source, V& sendData,\n+ 947 const T2& destination, V& receiveData)\n+ 948 {\n+ 949 remoteIndices_ = &remoteIndices;\n+ 950 free();\n+ 951 createDataTypes(source,destination, receiveData);\n+ 952 createDataTypes(source,destination, sendData);\n+ 953 createRequests(sendData, receiveData);\n+ 954 createRequests(receiveData, sendData);\n+ 955 created_=true;\n+ 956 }\n+ 957\n+ 958 template\n+ 959 void DatatypeCommunicator::free()\n+ 960 {\n+ 961 if(created_) {\n+ 962 delete[] requests_[0];\n+ 963 delete[] requests_[1];\n+ 964 typedef MessageTypeMap::iterator iterator;\n+ 965 typedef MessageTypeMap::const_iterator const_iterator;\n+ 966\n+ 967 const const_iterator end=messageTypes.end();\n+ 968\n+ 969 for(iterator process = messageTypes.begin(); process != end; ++process) {\n+ 970 MPI_Datatype *type = &(process->second.first);\n+ 971 int finalized=0;\n+ 972 MPI_Finalized(&finalized);\n+ 973 if(*type!=MPI_DATATYPE_NULL && !finalized)\n+ 974 MPI_Type_free(type);\n+ 975 type = &(process->second.second);\n+ 976 if(*type!=MPI_DATATYPE_NULL && !finalized)\n+ 977 MPI_Type_free(type);\n+ 978 }\n+ 979 messageTypes.clear();\n+ 980 created_=false;\n+ 981 }\n+ 982\n+ 983 }\n+ 984\n+ 985 template\n+ 986 template\n+ 987 void DatatypeCommunicator::createDataTypes(const T1& sourceFlags, const\n+T2& destFlags, V& data)\n+ 988 {\n+ 989\n+ 990 MPIDatatypeInformation dataInfo(data);\n+ 991 this->template\n+buildInterface,send>\n+(*remoteIndices_,sourceFlags, destFlags, dataInfo);\n+ 992\n+ 993 typedef typename RemoteIndices::RemoteIndexMap::const_iterator\n+const_iterator;\n+ 994 const const_iterator end=this->remoteIndices_->end();\n+ 995\n+ 996 // Allocate MPI_Datatypes and deallocate memory for the type construction.\n+ 997 for(const_iterator process=this->remoteIndices_->begin(); process != end;\n+++process) {\n+ 998 IndexedTypeInformation& info=dataInfo.information_[process->first];\n+ 999 // Shift the displacement\n+ 1000 MPI_Aint base;\n+ 1001 MPI_Get_address(const_cast(CommPolicy::getAddress(data, 0)),\n+&base);\n+ 1002\n+ 1003 for(int i=0; i< info.elements; i++) {\n+ 1004 info.displ[i]-=base;\n+ 1005 }\n+ 1006\n+ 1007 // Create data type\n+ 1008 MPI_Datatype* type = &( send ? messageTypes[process->first].first :\n+messageTypes[process->first].second);\n+ 1009 MPI_Type_create_hindexed(info.elements, info.length, info.displ,\n+ 1010 MPITraits::IndexedType>::getType(), type);\n+ 1011 MPI_Type_commit(type);\n+ 1012 // Deallocate memory\n+ 1013 info.free();\n+ 1014 }\n+ 1015 }\n+ 1016\n+ 1017 template\n+ 1018 template\n+ 1019 void DatatypeCommunicator::createRequests(V& sendData, V& receiveData)\n+ 1020 {\n+ 1021 typedef std::map >::\n+const_iterator MapIterator;\n+ 1022 int rank;\n+ 1023 static int index = createForward ? 1 : 0;\n+ 1024 int noMessages = messageTypes.size();\n+ 1025 // allocate request handles\n+ 1026 requests_[index] = new MPI_Request[2*noMessages];\n+ 1027 const MapIterator end = messageTypes.end();\n+ 1028 int request=0;\n+ 1029 MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n+ 1030\n+ 1031 // Set up the requests for receiving first\n+ 1032 for(MapIterator process = messageTypes.begin(); process != end;\n+ 1033 ++process, ++request) {\n+ 1034 MPI_Datatype type = createForward ? process->second.second : process-\n+>second.first;\n+ 1035 void* address = const_cast(CommPolicy::getAddress\n+(receiveData,0));\n+ 1036 MPI_Recv_init(address, 1, type, process->first, commTag_, this-\n+>remoteIndices_->communicator(), requests_[index]+request);\n+ 1037 }\n+ 1038\n+ 1039 // And now the send requests\n+ 1040\n+ 1041 for(MapIterator process = messageTypes.begin(); process != end;\n+ 1042 ++process, ++request) {\n+ 1043 MPI_Datatype type = createForward ? process->second.first : process-\n+>second.second;\n+ 1044 void* address = const_cast(CommPolicy::getAddress(sendData,\n+0));\n+ 1045 MPI_Ssend_init(address, 1, type, process->first, commTag_, this-\n+>remoteIndices_->communicator(), requests_[index]+request);\n+ 1046 }\n+ 1047 }\n+ 1048\n+ 1049 template\n+ 1050 void DatatypeCommunicator::forward()\n+ 1051 {\n+ 1052 sendRecv(requests_[1]);\n+ 1053 }\n+ 1054\n+ 1055 template\n+ 1056 void DatatypeCommunicator::backward()\n+ 1057 {\n+ 1058 sendRecv(requests_[0]);\n+ 1059 }\n+ 1060\n+ 1061 template\n+ 1062 void DatatypeCommunicator::sendRecv(MPI_Request* requests)\n+ 1063 {\n+ 1064 int noMessages = messageTypes.size();\n+ 1065 // Start the receive calls first\n+ 1066 MPI_Startall(noMessages, requests);\n+ 1067 // Now the send calls\n+ 1068 MPI_Startall(noMessages, requests+noMessages);\n+ 1069\n+ 1070 // Wait for completion of the communication send first then receive\n+ 1071 MPI_Status* status=new MPI_Status[2*noMessages];\n+ 1072 for(int i=0; i<2*noMessages; i++)\n+ 1073 status[i].MPI_ERROR=MPI_SUCCESS;\n+ 1074\n+ 1075 int send = MPI_Waitall(noMessages, requests+noMessages,\n+status+noMessages);\n+ 1076 int receive = MPI_Waitall(noMessages, requests, status);\n+ 1077\n+ 1078 // Error checks\n+ 1079 int success=1, globalSuccess=0;\n+ 1080 if(send==MPI_ERR_IN_STATUS) {\n+ 1081 int rank;\n+ 1082 MPI_Comm_rank(this->remoteIndices_->communicator(), &rank);\n+ 1083 std::cerr<remoteIndices_->communicator(), &rank);\n+ 1101 std::cerr<remoteIndices_->communicator());\n+ 1117\n+ 1118 delete[] status;\n+ 1119\n+ 1120 if(!globalSuccess)\n+ 1121 DUNE_THROW(CommunicationError, \"A communication error occurred!\");\n+ 1122\n+ 1123 }\n+ 1124\n+ 1125 inline BufferedCommunicator::BufferedCommunicator()\n+ 1126 {\n+ 1127 buffers_[0]=0;\n+ 1128 buffers_[1]=0;\n+ 1129 bufferSize_[0]=0;\n+ 1130 bufferSize_[1]=0;\n+ 1131 }\n+ 1132\n+ 1133 template\n+ 1134 typename std::enable_if::\n+IndexedTypeFlag>::value, void>::type\n+ 1135 BufferedCommunicator::build(const Interface& interface)\n+ 1136 {\n+ 1137 interfaces_=interface.interfaces();\n+ 1138 communicator_=interface.communicator();\n+ 1139 typedef typename std::map >\n+ 1140 ::const_iterator const_iterator;\n+ 1141 typedef typename CommPolicy::IndexedTypeFlag Flag;\n+ 1142 const const_iterator end = interfaces_.end();\n+ 1143 int lrank;\n+ 1144 MPI_Comm_rank(communicator_, &lrank);\n+ 1145\n+ 1146 bufferSize_[0]=0;\n+ 1147 bufferSize_[1]=0;\n+ 1148\n+ 1149 for(const_iterator interfacePair = interfaces_.begin();\n+ 1150 interfacePair != end; ++interfacePair) {\n+ 1151 int noSend = MessageSizeCalculator() (interfacePair-\n+>second.first);\n+ 1152 int noRecv = MessageSizeCalculator() (interfacePair-\n+>second.second);\n+ 1153 if (noSend + noRecv > 0)\n+ 1154 messageInformation_.insert(std::make_pair(interfacePair->first,\n+ 1155 std::make_pair(MessageInformation(bufferSize_[0],\n+ 1156 noSend*sizeof(typename CommPolicy::IndexedType)),\n+ 1157 MessageInformation(bufferSize_[1],\n+ 1158 noRecv*sizeof(typename CommPolicy::IndexedType)))));\n+ 1159 bufferSize_[0] += noSend;\n+ 1160 bufferSize_[1] += noRecv;\n+ 1161 }\n+ 1162\n+ 1163 // allocate the buffers\n+ 1164 bufferSize_[0] *= sizeof(typename CommPolicy::IndexedType);\n+ 1165 bufferSize_[1] *= sizeof(typename CommPolicy::IndexedType);\n+ 1166\n+ 1167 buffers_[0] = new char[bufferSize_[0]];\n+ 1168 buffers_[1] = new char[bufferSize_[1]];\n+ 1169 }\n+ 1170\n+ 1171 template\n+ 1172 void BufferedCommunicator::build(const Data& source, const Data& dest,\n+const Interface& interface)\n+ 1173 {\n+ 1174\n+ 1175 interfaces_=interface.interfaces();\n+ 1176 communicator_=interface.communicator();\n+ 1177 typedef typename std::map >\n+ 1178 ::const_iterator const_iterator;\n+ 1179 typedef typename CommPolicy::IndexedTypeFlag Flag;\n+ 1180 const const_iterator end = interfaces_.end();\n+ 1181\n+ 1182 bufferSize_[0]=0;\n+ 1183 bufferSize_[1]=0;\n+ 1184\n+ 1185 for(const_iterator interfacePair = interfaces_.begin();\n+ 1186 interfacePair != end; ++interfacePair) {\n+ 1187 int noSend = MessageSizeCalculator() (source, interfacePair-\n+>second.first);\n+ 1188 int noRecv = MessageSizeCalculator() (dest, interfacePair-\n+>second.second);\n+ 1189 if (noSend + noRecv > 0)\n+ 1190 messageInformation_.insert(std::make_pair(interfacePair->first,\n+ 1191 std::make_pair(MessageInformation(bufferSize_[0],\n+ 1192 noSend*sizeof(typename CommPolicy::IndexedType)),\n+ 1193 MessageInformation(bufferSize_[1],\n+ 1194 noRecv*sizeof(typename CommPolicy::IndexedType)))));\n+ 1195 bufferSize_[0] += noSend;\n+ 1196 bufferSize_[1] += noRecv;\n+ 1197 }\n+ 1198\n+ 1199 bufferSize_[0] *= sizeof(typename CommPolicy::IndexedType);\n+ 1200 bufferSize_[1] *= sizeof(typename CommPolicy::IndexedType);\n+ 1201 // allocate the buffers\n+ 1202 buffers_[0] = new char[bufferSize_[0]];\n+ 1203 buffers_[1] = new char[bufferSize_[1]];\n+ 1204 }\n+ 1205\n+ 1206 inline void BufferedCommunicator::free()\n+ 1207 {\n+ 1208 messageInformation_.clear();\n+ 1209 if(buffers_[0])\n+ 1210 delete[] buffers_[0];\n+ 1211\n+ 1212 if(buffers_[1])\n+ 1213 delete[] buffers_[1];\n+ 1214 buffers_[0]=buffers_[1]=0;\n+ 1215 }\n+ 1216\n+ 1217 inline BufferedCommunicator::~BufferedCommunicator()\n+ 1218 {\n+ 1219 free();\n+ 1220 }\n+ 1221\n+ 1222 template\n+ 1223 inline int BufferedCommunicator::MessageSizeCalculator::\n+operator()\n+ 1224 (const InterfaceInformation& info) const\n+ 1225 {\n+ 1226 return info.size();\n+ 1227 }\n+ 1228\n+ 1229\n+ 1230 template\n+ 1231 inline int BufferedCommunicator::MessageSizeCalculator::\n+operator()\n+ 1232 (const Data&, const InterfaceInformation& info) const\n+ 1233 {\n+ 1234 return operator()(info);\n+ 1235 }\n+ 1236\n+ 1237\n+ 1238 template\n+ 1239 inline int BufferedCommunicator::MessageSizeCalculator::operator()\n+ 1240 (const Data& data, const InterfaceInformation& info) const\n+ 1241 {\n+ 1242 int entries=0;\n+ 1243\n+ 1244 for(size_t i=0; i < info.size(); i++)\n+ 1245 entries += CommPolicy::getSize(data,info[i]);\n+ 1246\n+ 1247 return entries;\n+ 1248 }\n+ 1249\n+ 1250\n+ 1251 template\n+ 1252 inline void BufferedCommunicator::\n+MessageGatherer::operator()(const\n+InterfaceMap& interfaces,const Data& data, Type* buffer, [[maybe_unused]]\n+size_t bufferSize) const\n+ 1253 {\n+ 1254 typedef typename InterfaceMap::const_iterator\n+ 1255 const_iterator;\n+ 1256\n+ 1257 int rank;\n+ 1258 MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n+ 1259 const const_iterator end = interfaces.end();\n+ 1260 size_t index=0;\n+ 1261\n+ 1262 for(const_iterator interfacePair = interfaces.begin();\n+ 1263 interfacePair != end; ++interfacePair) {\n+ 1264 int size = forward ? interfacePair->second.first.size() :\n+ 1265 interfacePair->second.second.size();\n+ 1266\n+ 1267 for(int i=0; i < size; i++) {\n+ 1268 int local = forward ? interfacePair->second.first[i] :\n+ 1269 interfacePair->second.second[i];\n+ 1270 for(std::size_t j=0; j < CommPolicy::getSize(data, local); j++,\n+index++) {\n+ 1271\n+ 1272#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1273 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy::\n+IndexedType));\n+ 1274#endif\n+ 1275 buffer[index]=GatherScatter::gather(data, local, j);\n+ 1276 }\n+ 1277\n+ 1278 }\n+ 1279 }\n+ 1280\n+ 1281 }\n+ 1282\n+ 1283\n+ 1284 template\n+ 1285 inline void BufferedCommunicator::\n+MessageGatherer::operator()(\n+ 1286 const InterfaceMap& interfaces, const Data& data, Type* buffer, [\n+[maybe_unused]] size_t bufferSize) const\n+ 1287 {\n+ 1288 typedef typename InterfaceMap::const_iterator\n+ 1289 const_iterator;\n+ 1290 const const_iterator end = interfaces.end();\n+ 1291 size_t index = 0;\n+ 1292\n+ 1293 int rank;\n+ 1294 MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n+ 1295\n+ 1296 for(const_iterator interfacePair = interfaces.begin();\n+ 1297 interfacePair != end; ++interfacePair) {\n+ 1298 size_t size = FORWARD ? interfacePair->second.first.size() :\n+ 1299 interfacePair->second.second.size();\n+ 1300\n+ 1301 for(size_t i=0; i < size; i++) {\n+ 1302\n+ 1303#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1304 assert(bufferSize>=(index+1)*sizeof(typename CommPolicy::\n+IndexedType));\n+ 1305#endif\n+ 1306\n+ 1307 buffer[index++] = GatherScatter::gather(data, FORWARD ? interfacePair-\n+>second.first[i] :\n+ 1308 interfacePair->second.second[i]);\n+ 1309 }\n+ 1310 }\n+ 1311\n+ 1312 }\n+ 1313\n+ 1314\n+ 1315 template\n+ 1316 inline void BufferedCommunicator::\n+MessageScatterer::operator()(const\n+InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const\n+ 1317 {\n+ 1318 typedef typename InterfaceMap::value_type::second_type::first_type\n+Information;\n+ 1319 const typename InterfaceMap::const_iterator infoPair = interfaces.find\n+(proc);\n+ 1320\n+ 1321 assert(infoPair!=interfaces.end());\n+ 1322\n+ 1323 const Information& info = FORWARD ? infoPair->second.second :\n+ 1324 infoPair->second.first;\n+ 1325\n+ 1326 for(size_t i=0, index=0; i < info.size(); i++) {\n+ 1327 for(size_t j=0; j < CommPolicy::getSize(data, info[i]); j++)\n+ 1328 GatherScatter::scatter(data, buffer[index++], info[i], j);\n+ 1329 }\n+ 1330 }\n+ 1331\n+ 1332\n+ 1333 template\n+ 1334 inline void BufferedCommunicator::\n+MessageScatterer::operator()(const\n+InterfaceMap& interfaces, Data& data, Type* buffer, const int& proc) const\n+ 1335 {\n+ 1336 typedef typename InterfaceMap::value_type::second_type::first_type\n+Information;\n+ 1337 const typename InterfaceMap::const_iterator infoPair = interfaces.find\n+(proc);\n+ 1338\n+ 1339 assert(infoPair!=interfaces.end());\n+ 1340\n+ 1341 const Information& info = FORWARD ? infoPair->second.second :\n+ 1342 infoPair->second.first;\n+ 1343\n+ 1344 for(size_t i=0; i < info.size(); i++) {\n+ 1345 GatherScatter::scatter(data, buffer[i], info[i]);\n+ 1346 }\n+ 1347 }\n+ 1348\n+ 1349\n+ 1350 template\n+ 1351 void BufferedCommunicator::forward(Data& data)\n+ 1352 {\n+ 1353 this->template sendRecv(data, data);\n+ 1354 }\n+ 1355\n+ 1356\n+ 1357 template\n+ 1358 void BufferedCommunicator::backward(Data& data)\n+ 1359 {\n+ 1360 this->template sendRecv(data, data);\n+ 1361 }\n+ 1362\n+ 1363\n+ 1364 template\n+ 1365 void BufferedCommunicator::forward(const Data& source, Data& dest)\n+ 1366 {\n+ 1367 this->template sendRecv(source, dest);\n+ 1368 }\n+ 1369\n+ 1370\n+ 1371 template\n+ 1372 void BufferedCommunicator::backward(Data& source, const Data& dest)\n+ 1373 {\n+ 1374 this->template sendRecv(dest, source);\n+ 1375 }\n+ 1376\n+ 1377\n+ 1378 template\n+ 1379 void BufferedCommunicator::sendRecv(const Data& source, Data& dest)\n+ 1380 {\n+ 1381 int rank, lrank;\n+ 1382\n+ 1383 MPI_Comm_rank(MPI_COMM_WORLD,&rank);\n+ 1384 MPI_Comm_rank(MPI_COMM_WORLD,&lrank);\n+ 1385\n+ 1386 typedef typename CommPolicy::IndexedType Type;\n+ 1387 Type *sendBuffer, *recvBuffer;\n+ 1388 size_t sendBufferSize;\n+ 1389#ifndef NDEBUG\n+ 1390 size_t recvBufferSize;\n+ 1391#endif\n+ 1392\n+ 1393 if(FORWARD) {\n+ 1394 sendBuffer = reinterpret_cast(buffers_[0]);\n+ 1395 sendBufferSize = bufferSize_[0];\n+ 1396 recvBuffer = reinterpret_cast(buffers_[1]);\n+ 1397#ifndef NDEBUG\n+ 1398 recvBufferSize = bufferSize_[1];\n+ 1399#endif\n+ 1400 }else{\n+ 1401 sendBuffer = reinterpret_cast(buffers_[1]);\n+ 1402 sendBufferSize = bufferSize_[1];\n+ 1403 recvBuffer = reinterpret_cast(buffers_[0]);\n+ 1404#ifndef NDEBUG\n+ 1405 recvBufferSize = bufferSize_[0];\n+ 1406#endif\n+ 1407 }\n+ 1408 typedef typename CommPolicy::IndexedTypeFlag Flag;\n+ 1409\n+ 1410 MessageGatherer() (interfaces_, source,\n+sendBuffer, sendBufferSize);\n+ 1411\n+ 1412 MPI_Request* sendRequests = new MPI_Request[messageInformation_.size()];\n+ 1413 MPI_Request* recvRequests = new MPI_Request[messageInformation_.size()];\n+ 1414 /* Number of recvRequests that are not MPI_REQUEST_NULL */\n+ 1415 size_t numberOfRealRecvRequests = 0;\n+ 1416\n+ 1417 // Setup receive first\n+ 1418 typedef typename InformationMap::const_iterator const_iterator;\n+ 1419\n+ 1420 const const_iterator end = messageInformation_.end();\n+ 1421 size_t i=0;\n+ 1422 int* processMap = new int[messageInformation_.size()];\n+ 1423\n+ 1424 for(const_iterator info = messageInformation_.begin(); info != end;\n+++info, ++i) {\n+ 1425 processMap[i]=info->first;\n+ 1426 if(FORWARD) {\n+ 1427 assert(info->second.second.start_*sizeof(typename CommPolicy::\n+IndexedType)+info->second.second.size_ <= recvBufferSize );\n+ 1428 Dune::dvverb<second.second.size_<<\" from\n+\"<first<second.second.size_) {\n+ 1430 MPI_Irecv(recvBuffer+info->second.second.start_, info-\n+>second.second.size_,\n+ 1431 MPI_BYTE, info->first, commTag_, communicator_,\n+ 1432 recvRequests+i);\n+ 1433 numberOfRealRecvRequests += 1;\n+ 1434 } else {\n+ 1435 // Nothing to receive -> set request to inactive\n+ 1436 recvRequests[i]=MPI_REQUEST_NULL;\n+ 1437 }\n+ 1438 }else{\n+ 1439 assert(info->second.first.start_*sizeof(typename CommPolicy::\n+IndexedType)+info->second.first.size_ <= recvBufferSize );\n+ 1440 Dune::dvverb<second.first.size_<<\" to\n+\"<first<second.first.size_) {\n+ 1442 MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_,\n+ 1443 MPI_BYTE, info->first, commTag_, communicator_,\n+ 1444 recvRequests+i);\n+ 1445 numberOfRealRecvRequests += 1;\n+ 1446 } else {\n+ 1447 // Nothing to receive -> set request to inactive\n+ 1448 recvRequests[i]=MPI_REQUEST_NULL;\n+ 1449 }\n+ 1450 }\n+ 1451 }\n+ 1452\n+ 1453 // now the send requests\n+ 1454 i=0;\n+ 1455 for(const_iterator info = messageInformation_.begin(); info != end;\n+++info, ++i)\n+ 1456 if(FORWARD) {\n+ 1457 assert(info->second.second.start_*sizeof(typename CommPolicy::\n+IndexedType)+info->second.second.size_ <= recvBufferSize );\n+ 1458 Dune::dvverb<second.first.size_<<\" to \"<first<second.first.start_*sizeof(typename CommPolicy::\n+IndexedType)+info->second.first.size_ <= sendBufferSize );\n+ 1460 if(info->second.first.size_)\n+ 1461 MPI_Issend(sendBuffer+info->second.first.start_, info-\n+>second.first.size_,\n+ 1462 MPI_BYTE, info->first, commTag_, communicator_,\n+ 1463 sendRequests+i);\n+ 1464 else\n+ 1465 // Nothing to send -> set request to inactive\n+ 1466 sendRequests[i]=MPI_REQUEST_NULL;\n+ 1467 }else{\n+ 1468 assert(info->second.second.start_*sizeof(typename CommPolicy::\n+IndexedType)+info->second.second.size_ <= sendBufferSize );\n+ 1469 Dune::dvverb<second.second.size_<<\" to\n+\"<first<second.second.size_)\n+ 1471 MPI_Issend(sendBuffer+info->second.second.start_, info-\n+>second.second.size_,\n+ 1472 MPI_BYTE, info->first, commTag_, communicator_,\n+ 1473 sendRequests+i);\n+ 1474 else\n+ 1475 // Nothing to send -> set request to inactive\n+ 1476 sendRequests[i]=MPI_REQUEST_NULL;\n+ 1477 }\n+ 1478\n+ 1479 // Wait for completion of receive and immediately start scatter\n+ 1480 i=0;\n+ 1481 //int success = 1;\n+ 1482 int finished = MPI_UNDEFINED;\n+ 1483 MPI_Status status; //[messageInformation_.size()];\n+ 1484 //MPI_Waitall(messageInformation_.size(), recvRequests, status);\n+ 1485\n+ 1486 for(i=0; i< numberOfRealRecvRequests; i++) {\n+ 1487 status.MPI_ERROR=MPI_SUCCESS;\n+ 1488 MPI_Waitany(messageInformation_.size(), recvRequests, &finished,\n+&status);\n+ 1489 assert(finished != MPI_UNDEFINED);\n+ 1490\n+ 1491 if(status.MPI_ERROR==MPI_SUCCESS) {\n+ 1492 int& proc = processMap[finished];\n+ 1493 typename InformationMap::const_iterator infoIter =\n+messageInformation_.find(proc);\n+ 1494 assert(infoIter != messageInformation_.end());\n+ 1495\n+ 1496 MessageInformation info = (FORWARD) ? infoIter->second.second : infoIter-\n+>second.first;\n+ 1497 assert(info.start_+info.size_ <= recvBufferSize);\n+ 1498\n+ 1499 MessageScatterer() (interfaces_, dest,\n+recvBuffer+info.start_, proc);\n+ 1500 }else{\n+ 1501 std::cerr<communicator());\n+ 1517\n+ 1518 if(!globalSuccess)\n+ 1519 DUNE_THROW(CommunicationError, \"A communication error occurred!\");\n+ 1520 */\n+ 1521 delete[] processMap;\n+ 1522 delete[] sendRequests;\n+ 1523 delete[] recvRequests;\n+ 1524\n+ 1525 }\n+ 1526\n+ 1527#endif // DOXYGEN\n+ 1528\n+ 1530}\n+ 1531\n+ 1532#endif // HAVE_MPI\n+ 1533\n+ 1534#endif\n+remoteindices.hh\n+Classes describing a distributed indexset.\n+stdstreams.hh\n+Standard Dune debug streams.\n+exceptions.hh\n+A few common exception classes.\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+Dune::dvverb\n+DVVerbType dvverb(std::cout)\n+stream for very verbose output.\n+Definition: stdstreams.hh:95\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n+Dune::IOError\n+Default exception class for I/O errors.\n+Definition: exceptions.hh:231\n+Dune::SizeOne\n+Flag for marking indexed data structures where data at each index is of the\n+same size.\n+Definition: communicator.hh:110\n+Dune::VariableSize\n+Flag for marking indexed data structures where the data at each index may be a\n+variable multiple of a...\n+Definition: communicator.hh:118\n+Dune::CommPolicy\n+Default policy used for communicating an indexed type.\n+Definition: communicator.hh:128\n+Dune::CommPolicy::IndexedType\n+V::value_type IndexedType\n+The type we get at each index with operator[].\n+Definition: communicator.hh:147\n+Dune::CommPolicy::getSize\n+static int getSize(const V &, int index)\n+Get the number of primitive elements at that index.\n+Dune::CommPolicy::IndexedTypeFlag\n+SizeOne IndexedTypeFlag\n+Whether the indexed type has variable size or there is always one value at each\n+index.\n+Definition: communicator.hh:153\n+Dune::CommPolicy::getAddress\n+static const void * getAddress(const V &v, int index)\n+Get the address of entry at an index.\n+Dune::CommPolicy::Type\n+V Type\n+The type the policy is for.\n+Definition: communicator.hh:140\n+Dune::CommPolicy::FieldVector\n+Definition: communicator.hh:173\n+Dune::CommPolicy::VariableBlockVector\n+Definition: communicator.hh:175\n+Dune::CommPolicy::CommPolicy<_VariableBlockVector<_FieldVector<_K,_n_>,_A_>_>::\n+getSize\n+static int getSize(const Type &v, int i)\n+Dune::CommPolicy::CommPolicy<_VariableBlockVector<_FieldVector<_K,_n_>,_A_>_>::\n+IndexedTypeFlag\n+VariableSize IndexedTypeFlag\n+Definition: communicator.hh:184\n+Dune::CommPolicy::CommPolicy<_VariableBlockVector<_FieldVector<_K,_n_>,_A_>_>::\n+Type\n+VariableBlockVector< FieldVector< K, n >, A > Type\n+Definition: communicator.hh:180\n+Dune::CommPolicy::CommPolicy<_VariableBlockVector<_FieldVector<_K,_n_>,_A_>_>::\n+getAddress\n+static const void * getAddress(const Type &v, int i)\n+Dune::CommPolicy::CommPolicy<_VariableBlockVector<_FieldVector<_K,_n_>,_A_>_>::\n+IndexedType\n+Type::B IndexedType\n+Definition: communicator.hh:182\n+Dune::CommPolicy::CommunicationError\n+Error thrown if there was a problem with the communication.\n+Definition: communicator.hh:195\n+Dune::CommPolicy::CopyGatherScatter\n+GatherScatter default implementation that just copies data.\n+Definition: communicator.hh:202\n+Dune::CommPolicy::CopyGatherScatter::scatter\n+static void scatter(T &vec, const IndexedType &v, std::size_t i)\n+Dune::CommPolicy::CopyGatherScatter::IndexedType\n+CommPolicy< T >::IndexedType IndexedType\n+Definition: communicator.hh:203\n+Dune::CommPolicy::CopyGatherScatter::gather\n+static const IndexedType & gather(const T &vec, std::size_t i)\n+Dune::BufferedCommunicator\n+A communicator that uses buffers to gather and scatter the data to be send or\n+received.\n+Definition: communicator.hh:458\n+Dune::BufferedCommunicator::backward\n+void backward(Data &data)\n+Backward send where target and source are the same.\n+Dune::BufferedCommunicator::BufferedCommunicator\n+BufferedCommunicator()\n+Constructor.\n+Dune::BufferedCommunicator::~BufferedCommunicator\n+~BufferedCommunicator()\n+Destructor.\n+Dune::BufferedCommunicator::forward\n+void forward(const Data &source, Data &dest)\n+Send from source to target.\n+Dune::BufferedCommunicator::free\n+void free()\n+Free the allocated memory (i.e. buffers and message information.\n+Dune::BufferedCommunicator::build\n+std::enable_if< std::is_same< SizeOne, typenameCommPolicy< Data >::\n+IndexedTypeFlag >::value, void >::type build(const Interface &interface)\n+Build the buffers and information for the communication process.\n+Dune::BufferedCommunicator::backward\n+void backward(Data &source, const Data &dest)\n+Communicate in the reverse direction, i.e. send from target to source.\n+Dune::BufferedCommunicator::build\n+void build(const Data &source, const Data &target, const Interface &interface)\n+Build the buffers and information for the communication process.\n+Dune::BufferedCommunicator::forward\n+void forward(Data &data)\n+Forward send where target and source are the same.\n+Dune::ParallelIndexSet\n+Manager class for the mapping between local indices and globally unique\n+indices.\n+Definition: indexset.hh:218\n+Dune::InterfaceBuilder\n+Base class of all classes representing a communication interface.\n+Definition: parallel/interface.hh:35\n+Dune::InterfaceInformation\n+Information describing an interface.\n+Definition: parallel/interface.hh:101\n+Dune::Interface\n+Communication interface between remote and local indices.\n+Definition: parallel/interface.hh:209\n+Dune::LocalIndex\n+An index present on the local process.\n+Definition: localindex.hh:35\n+Dune::RemoteIndices\n+The indices present on remote processes.\n+Definition: remoteindices.hh:189\n+Dune::RemoteIndices::GlobalIndex\n+ParallelIndexSet::GlobalIndex GlobalIndex\n+The type of the global index.\n+Definition: remoteindices.hh:215\n+Dune::RemoteIndices::Attribute\n+LocalIndex::Attribute Attribute\n+The type of the attribute.\n+Definition: remoteindices.hh:226\n+Dune::RemoteIndices::LocalIndex\n+ParallelIndexSet::LocalIndex LocalIndex\n+The type of the local index.\n+Definition: remoteindices.hh:221\n+interface.hh\n+Provides classes for building the communication interface between remote\n+indices.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00035.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00035.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: exceptions.cc File Reference\n+dune-common: plocalindex.hh File Reference\n \n \n \n \n \n \n \n@@ -58,31 +58,67 @@\n \n \n \n \n \n
    \n \n-
    exceptions.cc File Reference
    \n+Classes |\n+Namespaces |\n+Functions
    \n+ \n \n
    \n-\n+\n+

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

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

    Go to the source code of this file.

    \n+
    \n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+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 > >
     
    \n \n \n \n \n+

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n+Functions

    template<class T >
    std::ostream & Dune::operator<< (std::ostream &os, const ParallelLocalIndex< T > &index)
     Print the local index to a stream. More...
     
    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)
     
    \n-
    \n+

    Detailed Description

    \n+

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

    \n+
    Author
    Markus Blatt
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,17 +4,53 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces\n-exceptions.cc File Reference\n-#include \n+ * parallel\n+Classes | Namespaces | Functions\n+plocalindex.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+Provides classes for use as the local index in ParallelIndexSet for distributed\n+computing. More...\n+#include \"localindex.hh\"\n+#include \"indexset.hh\"\n+#include \"mpitraits.hh\"\n+#include \n+Go_to_the_source_code_of_this_file.\n+ Classes\n+ class \u00a0Dune::ParallelLocalIndex<_T_>\n+\u00a0 An index present on the local process with an additional attribute\n+ flag. More...\n+\u00a0\n+struct \u00a0Dune::LocalIndexComparator<_ParallelLocalIndex<_T_>_>\n+\u00a0\n+ class \u00a0Dune::MPITraits<_ParallelLocalIndex<_T_>_>\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+ Functions\n+template\n+std::ostream &\u00a0Dune::operator<< (std::ostream &os, const ParallelLocalIndex< T\n+ > &index)\n+\u00a0 Print the local index to a stream. More...\n+\u00a0\n+template\n+ bool\u00a0Dune::operator== (const ParallelLocalIndex< T > &p1, const\n+ ParallelLocalIndex< T > &p2)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator!= (const ParallelLocalIndex< T > &p1, const\n+ ParallelLocalIndex< T > &p2)\n+\u00a0\n+***** Detailed Description *****\n+Provides classes for use as the local index in ParallelIndexSet for distributed\n+computing.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00038.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00038.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: hash.hh File Reference\n+dune-common: remoteindices.hh File Reference\n \n \n \n \n \n \n \n@@ -58,185 +58,89 @@\n \n \n \n \n \n
    \n \n-
    hash.hh File Reference
    \n+ \n
    \n
    \n \n-

    Support for calculating hash values of objects. \n+

    Classes describing a distributed indexset. \n More...

    \n-
    #include <functional>
    \n-#include <dune/common/typetraits.hh>
    \n+
    #include <cassert>
    \n+#include <iostream>
    \n+#include <ostream>
    \n+#include <map>
    \n+#include <memory>
    \n+#include <set>
    \n+#include <utility>
    \n+#include <vector>
    \n+#include <mpi.h>
    \n+#include <dune/common/exceptions.hh>
    \n+#include <dune/common/parallel/indexset.hh>
    \n+#include <dune/common/parallel/mpitraits.hh>
    \n+#include <dune/common/parallel/plocalindex.hh>
    \n+#include <dune/common/sllist.hh>
    \n+#include <dune/common/stdstreams.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n

    \n Classes

    struct  Dune::hash< T >
     Functor for hashing objects of type T. More...
    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...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-Macros

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

    \n 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. More...
     
    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. More...
     
    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. More...
     
    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)
     
    \n

    Detailed Description

    \n-

    Support for calculating hash values of objects.

    \n-

    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.

    \n-

    Macro Definition Documentation

    \n-\n-

    ◆ DUNE_DEFINE_HASH

    \n-\n-
    \n-
    \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
    #define DUNE_DEFINE_HASH( template_args,
     type 
    )
    \n-
    \n-\n-

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

    \n-

    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.

    \n-

    Consider the following type:

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

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

    \n-
    namespace ns {
    \n-
    template<typename A, int i>
    \n-
    class Foo
    \n-
    {
    \n-
    ...
    \n-
    // The keyword "friend" turns this into a global function that is a friend of Foo.
    \n-
    inline friend std::size_t hash_value(const Foo& arg)
    \n-
    {
    \n-
    return ...;
    \n-
    }
    \n-
    };
    \n-
    }
    \n-
    \n-
    // Define hash struct specialization
    \n-\n-
    #define DUNE_DEFINE_HASH(template_args, type)
    Defines the required struct specialization to make type hashable via Dune::hash.
    Definition: hash.hh:100
    \n-
    #define DUNE_HASH_TYPE(...)
    Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.
    Definition: hash.hh:117
    \n-
    #define DUNE_HASH_TEMPLATE_ARGS(...)
    Wrapper macro for the template arguments in DUNE_DEFINE_HASH.
    Definition: hash.hh:109
    \n-
    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!
    \n-
    Parameters
    \n- \n- \n- \n-
    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.
    \n-
    \n-
    \n-\n-
    \n-
    \n-\n-

    ◆ DUNE_HASH_TEMPLATE_ARGS

    \n-\n-
    \n-
    \n- \n- \n- \n- \n- \n- \n- \n- \n-
    #define DUNE_HASH_TEMPLATE_ARGS( ...)
    \n-
    \n-\n-

    Wrapper macro for the template arguments in DUNE_DEFINE_HASH.

    \n-

    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.

    \n-\n-
    \n-
    \n-\n-

    ◆ DUNE_HASH_TYPE

    \n-\n-
    \n-
    \n- \n- \n- \n- \n- \n- \n- \n- \n-
    #define DUNE_HASH_TYPE( ...)
    \n-
    \n-\n-

    Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.

    \n-

    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.

    \n-\n-
    \n-
    \n-
    \n+

    Classes describing a distributed indexset.

    \n+
    Author
    Markus Blatt
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,131 +4,74 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces | Macros | Functions\n-hash.hh File Reference\n-Support for calculating hash values of objects. More...\n-#include \n-#include \n+ * parallel\n+Classes | Namespaces | Functions\n+remoteindices.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+Classes describing a distributed indexset. More...\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::hash<_T_>\n-\u00a0 Functor for hashing objects of type T. More...\n+class \u00a0Dune::MPITraits<_IndexPair<_TG,_ParallelLocalIndex<_TA_>_>_>\n \u00a0\n- Namespaces\n-namespace \u00a0Dune\n-\u00a0 Dune namespace.\n+class \u00a0Dune::RemoteIndex<_T1,_T2_>\n+\u00a0 Information about an index residing on another processor. More...\n+\u00a0\n+class \u00a0Dune::RemoteIndices<_T,_A_>\n+\u00a0 The indices present on remote processes. More...\n+\u00a0\n+class \u00a0Dune::RemoteIndexListModifier<_T,_A,_mode_>\n+\u00a0 Modifier for adding and/or deleting remote indices from the remote\n+ index list. More...\n \u00a0\n- Macros\n-#define\u00a0DUNE_DEFINE_HASH(template_args, type)\n-\u00a0 Defines the required struct specialization to make type hashable via\n- Dune::hash. More...\n+class \u00a0Dune::RemoteIndexListModifier<_T,_A,_mode_>::InvalidPosition\n \u00a0\n-#define\u00a0DUNE_HASH_TEMPLATE_ARGS(...)\n-\u00a0 Wrapper macro for the template arguments in DUNE_DEFINE_HASH. More...\n+class \u00a0Dune::CollectiveIterator<_T,_A_>\n+\u00a0 A collective iterator for moving over the remote indices for all\n+ processes collectively. More...\n \u00a0\n-#define\u00a0DUNE_HASH_TYPE(...)\n-\u00a0 Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH. More...\n+class \u00a0Dune::CollectiveIterator<_T,_A_>::iterator\n+\u00a0 Iterator over the valid underlying iterators. More...\n+\u00a0\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n \u00a0\n Functions\n-template\n- void\u00a0Dune::hash_combine (std::size_t &seed, const T &arg)\n-\u00a0 Calculates the hash value of arg and combines it in-place with\n- seed. More...\n-\u00a0\n-template\n-std::size_t\u00a0Dune::hash_range (It first, It last)\n-\u00a0 Hashes all elements in the range [first,last) and returns the\n- combined hash. More...\n-\u00a0\n-template\n- void\u00a0Dune::hash_range (std::size_t &seed, It first, It last)\n-\u00a0 Hashes all elements in the range [first,last) and combines the\n- hashes in-place with seed. More...\n+template\n+std::ostream &\u00a0Dune::operator<< (std::ostream &os, const RemoteIndex< T1, T2 >\n+ &index)\n+\u00a0\n+template\n+std::ostream &\u00a0Dune::operator<< (std::ostream &os, const RemoteIndices< T, A >\n+ &indices)\n+\u00a0\n+template\n+std::ostream &\u00a0Dune::operator<< (std::ostream &os, const RemoteIndex< TG, TA >\n+ &index)\n \u00a0\n ***** Detailed Description *****\n-Support for calculating hash values of objects.\n-This file provides the functor Dune::hash to calculate hash values and some\n-infrastructure to simplify extending Dune::hash for user-defined types,\n-independent of the actual underlying implementation.\n-***** Macro Definition Documentation *****\n-***** \u25c6\u00a0DUNE_DEFINE_HASH *****\n-#define DUNE_DEFINE_HASH ( \u00a0template_args,\n- \u00a0type\u00a0\n- )\n-Defines the required struct specialization to make type hashable via Dune::\n-hash.\n-In order to calculate the hash, operator() of the generated specialization will\n-return the result of an unqualified call to the global function hash_value\n-(const type&). As the call is not qualified, the function will be found using\n-argument-dependent lookup, allowing implementors to conveniently place it\n-inside the class body.\n-Consider the following type:\n-namespace ns {\n-template\n-class Foo\n-{\n-...\n-};\n-}\n-In order to add support for Dune::hash, you need to extend the definition like\n-this:\n-namespace ns {\n-template\n-class Foo\n-{\n-...\n-// The keyword \"friend\" turns this into a global function that is a friend of\n-Foo.\n-inline friend std::size_t hash_value(const Foo& arg)\n-{\n-return ...;\n-}\n-};\n-}\n-// Define hash struct specialization\n-DUNE_DEFINE_HASH(DUNE_HASH_TEMPLATE_ARGS(typename A, int i),DUNE_HASH_TYPE\n-(Foo))\n-DUNE_DEFINE_HASH\n-#define DUNE_DEFINE_HASH(template_args, type)\n-Defines the required struct specialization to make type hashable via Dune::\n-hash.\n-Definition: hash.hh:100\n-DUNE_HASH_TYPE\n-#define DUNE_HASH_TYPE(...)\n-Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.\n-Definition: hash.hh:117\n-DUNE_HASH_TEMPLATE_ARGS\n-#define DUNE_HASH_TEMPLATE_ARGS(...)\n-Wrapper macro for the template arguments in DUNE_DEFINE_HASH.\n-Definition: hash.hh:109\n- Warning\n- As the specialization has to be placed in the original namespace of the\n- hash struct (e.g. std), this macro must be called from the global\n- namespace!\n- Parameters\n- The template arguments required by the hash struct\n- specialization, wrapped in a call to\n- template_args DUNE_HASH_TEMPLATE_ARGS. If this is a complete\n- specialization, call DUNE_HASH_TEMPLATE_ARGS without\n- arguments.\n- type The exact type of the specialization, wrapped in a call to\n- DUNE_HASH_TYPE.\n-***** \u25c6\u00a0DUNE_HASH_TEMPLATE_ARGS *****\n-#define DUNE_HASH_TEMPLATE_ARGS ( \u00a0... )\n-Wrapper macro for the template arguments in DUNE_DEFINE_HASH.\n-This macro should always be used as a wrapper for the template arguments when\n-calling DUNE_DEFINE_HASH. It works around some preprocessor limitations when\n-the template arguments contain commas or the list is completely empty.\n-***** \u25c6\u00a0DUNE_HASH_TYPE *****\n-#define DUNE_HASH_TYPE ( \u00a0... )\n-Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.\n-This macro should always be used as a wrapper for the type of the\n-specialization when calling DUNE_DEFINE_HASH. It works around some preprocessor\n-limitations when the type contains commas.\n+Classes describing a distributed indexset.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00038_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00038_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: hash.hh Source File\n+dune-common: remoteindices.hh Source File\n \n \n \n \n \n \n \n@@ -58,283 +58,1577 @@\n \n \n \n \n \n
    \n-
    hash.hh
    \n+
    remoteindices.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_HASH_HH
    \n-
    6#define DUNE_COMMON_HASH_HH
    \n+
    5#ifndef DUNE_REMOTEINDICES_HH
    \n+
    6#define DUNE_REMOTEINDICES_HH
    \n
    7
    \n-
    8#include <functional>
    \n+
    8#if HAVE_MPI
    \n
    9
    \n-\n-
    11
    \n-
    24// ********************************************************************************
    \n-
    25// Doxygen documentation
    \n-
    26// ********************************************************************************
    \n+
    10#include <cassert>
    \n+
    11#include <iostream>
    \n+
    12#include <ostream>
    \n+
    13#include <map>
    \n+
    14#include <memory>
    \n+
    15#include <set>
    \n+
    16#include <utility>
    \n+
    17#include <vector>
    \n+
    18
    \n+
    19#include <mpi.h>
    \n+
    20
    \n+\n+\n+\n+\n+
    25#include <dune/common/sllist.hh>
    \n+\n
    27
    \n-
    28#ifdef DOXYGEN
    \n-
    29
    \n-
    30namespace Dune {
    \n-
    31
    \n-
    33
    \n-
    38 template<typename T>
    \n-
    39 struct hash
    \n-
    40 {
    \n-
    41
    \n-
    43 std::size_t operator()(const T& t) const
    \n-
    44 {
    \n-
    45 return hash(t);
    \n-
    46 }
    \n-
    47
    \n-
    48 };
    \n+
    28namespace Dune {
    \n+
    40 template<typename TG, typename TA>
    \n+\n+
    42 {
    \n+
    43 public:
    \n+
    44 inline static MPI_Datatype getType();
    \n+
    45 private:
    \n+
    46 static MPI_Datatype type;
    \n+
    47 };
    \n+
    48
    \n
    49
    \n-
    50}
    \n-
    51
    \n-
    53
    \n-
    100#define DUNE_DEFINE_HASH(template_args,type)
    \n-
    101
    \n-
    102
    \n-
    104
    \n-
    109#define DUNE_HASH_TEMPLATE_ARGS(...)
    \n-
    110
    \n+
    50 template<typename T, typename A>
    \n+
    51 class RemoteIndices;
    \n+
    52
    \n+
    53 template<typename T1, typename T2>
    \n+
    54 class RemoteIndex;
    \n+
    55
    \n+
    56 // forward declaration needed for friend declaration.
    \n+
    57 template<typename T>
    \n+
    58 class IndicesSyncer;
    \n+
    59
    \n+
    60 template<typename T1, typename T2>
    \n+
    61 std::ostream& operator<<(std::ostream& os, const RemoteIndex<T1,T2>& index);
    \n+
    62
    \n+
    63
    \n+
    64 template<typename T, typename A, bool mode>
    \n+\n+
    66
    \n+
    67
    \n+
    71 template<typename T1, typename T2>
    \n+\n+
    73 {
    \n+
    74 template<typename T>
    \n+
    75 friend class IndicesSyncer;
    \n+
    76
    \n+
    77 template<typename T, typename A, typename A1>
    \n+
    78 friend void repairLocalIndexPointers(std::map<int,SLList<std::pair<typename T::GlobalIndex, typename T::LocalIndex::Attribute>,A> >&,
    \n+\n+
    80 const T&);
    \n+
    81
    \n+
    82 template<typename T, typename A, bool mode>
    \n+\n+
    84
    \n+
    85 public:
    \n+
    90 typedef T1 GlobalIndex;
    \n+
    99 typedef T2 Attribute;
    \n+
    100
    \n+\n+\n+
    106
    \n+
    111 const Attribute attribute() const;
    \n
    112
    \n-
    117#define DUNE_HASH_TYPE(...)
    \n-
    118
    \n-
    119#else // DOXYGEN - hide all the ugly implementation
    \n-
    120
    \n-
    121
    \n-
    122
    \n-
    123// ********************************************************************************
    \n-
    124// C++11 support
    \n-
    125// ********************************************************************************
    \n-
    126
    \n-
    127// import std::hash into Dune namespace
    \n-
    128namespace Dune {
    \n-
    129
    \n-
    130 using std::hash;
    \n-
    131
    \n-
    132}
    \n+
    118 const PairType& localIndexPair() const;
    \n+
    119
    \n+
    123 RemoteIndex();
    \n+
    124
    \n+
    125
    \n+
    131 RemoteIndex(const T2& attribute,
    \n+
    132 const PairType* local);
    \n
    133
    \n-
    134// Macro for defining a std::hash specialization for type.
    \n-
    135// This should not be called directly. Call DUNE_DEFINE_HASH
    \n-
    136// instead.
    \n-
    137#define DUNE_DEFINE_STD_HASH(template_args,type) \\
    \n-
    138 namespace std { \\
    \n-
    139 \\
    \n-
    140 template<template_args> \\
    \n-
    141 struct hash<type> \\
    \n-
    142 { \\
    \n-
    143 \\
    \n-
    144 typedef type argument_type; \\
    \n-
    145 typedef std::size_t result_type; \\
    \n-
    146 \\
    \n-
    147 std::size_t operator()(const type& arg) const \\
    \n-
    148 { \\
    \n-
    149 return hash_value(arg); \\
    \n-
    150 } \\
    \n-
    151 }; \\
    \n-
    152 \\
    \n-
    153 template<template_args> \\
    \n-
    154 struct hash<const type> \\
    \n-
    155 { \\
    \n-
    156 \\
    \n-
    157 typedef type argument_type; \\
    \n-
    158 typedef std::size_t result_type; \\
    \n-
    159 \\
    \n-
    160 std::size_t operator()(const type& arg) const \\
    \n-
    161 { \\
    \n-
    162 return hash_value(arg); \\
    \n-
    163 } \\
    \n-
    164 }; \\
    \n-
    165 \\
    \n-
    166 } \\
    \n-
    167
    \n-
    168// Wrapper macro for template arguments.
    \n-
    169// This is required because the template arguments can contain commas,
    \n-
    170// which will create a macro argument list of unknown length. That in itself
    \n-
    171// would not be a problem, but DUNE_DEFINE_HASH has to be called with two argument
    \n-
    172// lists of unknown length. So this macro wraps its arguments with parentheses,
    \n-
    173// turning it into a single argument. The result is used as the parameter list of
    \n-
    174// an expansion macro in the calls to the implementation-specific macros
    \n-
    175// for C++11 and TR1. Noto that technically, this trick is only legal for C++11,
    \n-
    176// but pretty much every compiler supports variadic macros in C++03 mode, as they
    \n-
    177// are part of C99.
    \n-
    178#define DUNE_HASH_TEMPLATE_ARGS(...) (__VA_ARGS__)
    \n-
    179
    \n-
    180// Wrapper macro for type to be hashed.
    \n-
    181// See above for rationale.
    \n-
    182#define DUNE_HASH_TYPE(...) (__VA_ARGS__)
    \n-
    183
    \n-
    184// Expansion macro for the parenthesized argument lists created by
    \n-
    185// DUNE_HASH_TEMPLATE_ARGS and DUNE_HASH_TYPE.
    \n-
    186#define DUNE_HASH_EXPAND_VA_ARGS(...) __VA_ARGS__
    \n-
    187
    \n-
    188// Define specializations for all discovered hash implementations.
    \n-
    189#define DUNE_DEFINE_HASH(template_args,type) \\
    \n-
    190 DUNE_DEFINE_STD_HASH(DUNE_HASH_EXPAND_VA_ARGS template_args, DUNE_HASH_EXPAND_VA_ARGS type) \\
    \n-
    191
    \n-
    192
    \n-
    193#endif // DOXYGEN
    \n-
    194
    \n-
    195
    \n+
    134
    \n+
    140 RemoteIndex(const T2& attribute);
    \n+
    141
    \n+
    142 bool operator==(const RemoteIndex& ri) const;
    \n+
    143
    \n+
    144 bool operator!=(const RemoteIndex& ri) const;
    \n+
    145 private:
    \n+
    147 const PairType* localIndex_;
    \n+
    148
    \n+
    150 char attribute_;
    \n+
    151 };
    \n+
    152
    \n+
    153 template<class T, class A>
    \n+
    154 std::ostream& operator<<(std::ostream& os, const RemoteIndices<T,A>& indices);
    \n+
    155
    \n+
    156 class InterfaceBuilder;
    \n+
    157
    \n+
    158 template<class T, class A>
    \n+
    159 class CollectiveIterator;
    \n+
    160
    \n+
    161 // forward declaration needed for friend declaration.
    \n+
    162 template<class T>
    \n+
    163 class IndicesSyncer;
    \n+
    164
    \n+
    165 // forward declaration needed for friend declaration.
    \n+
    166 template<typename T1, typename T2>
    \n+\n+
    168
    \n+
    169
    \n+
    186 template<class T, class A=std::allocator<RemoteIndex<typename T::GlobalIndex,
    \n+
    187 typename T::LocalIndex::Attribute> > >
    \n+\n+
    189 {
    \n+
    190 friend class InterfaceBuilder;
    \n+
    191 friend class IndicesSyncer<T>;
    \n+
    192 template<typename T1, typename A2, typename A1>
    \n+
    193 friend void repairLocalIndexPointers(std::map<int,SLList<std::pair<typename T1::GlobalIndex, typename T1::LocalIndex::Attribute>,A2> >&,
    \n+\n+
    195 const T1&);
    \n
    196
    \n-
    197// ********************************************************************************
    \n-
    198// Some utility functions for combining hashes of member variables.
    \n-
    199// ********************************************************************************
    \n+
    197 template<class G, class T1, class T2>
    \n+\n+
    199 friend std::ostream& operator<<<>(std::ostream&, const RemoteIndices<T>&);
    \n
    200
    \n-
    201namespace Dune {
    \n+
    201 public:
    \n
    202
    \n-
    203 // The following functions are an implementation of the proposed hash extensions for
    \n-
    204 // the C++ standard by Peter Dimov
    \n-
    205 // (cf. http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf, issue 6.18).
    \n-
    206 // They are also contained in the boost::functional::hash library by Daniel James, but
    \n-
    207 // that implementation uses boost::hash internally, while we want to use Dune::hash. They
    \n-
    208 // are also considered for inclusion in TR2 (then based on std::hash, of course).
    \n-
    209
    \n-
    210#ifndef DOXYGEN
    \n+\n+
    207
    \n+\n
    211
    \n-
    212 // helper struct for providing different hash combining algorithms dependent on
    \n-
    213 // the size of size_t.
    \n-
    214 // hash_combiner has to be specialized for the size (in bytes) of std::size_t.
    \n-
    215 // Specialized versions should provide a method
    \n-
    216 //
    \n-
    217 // template <typename typeof_size_t, typename T>
    \n-
    218 // void operator()(typeof_size_t& seed, const T& arg) const;
    \n-
    219 //
    \n-
    220 // that will be called by the interface function hash_combine() described further below.
    \n-
    221 // The redundant template parameter typeof_size_t is needed to avoid warnings for the
    \n-
    222 // unused 64-bit specialization on 32-bit systems.
    \n-
    223 //
    \n-
    224 // There is no default implementation!
    \n-
    225 template<int sizeof_size_t>
    \n-
    226 struct hash_combiner;
    \n+\n+
    216
    \n+
    217
    \n+\n+
    222
    \n+
    226 typedef typename LocalIndex::Attribute Attribute;
    \n
    227
    \n-
    228
    \n-
    229 // hash combining for 64-bit platforms.
    \n-
    230 template<>
    \n-
    231 struct hash_combiner<8>
    \n-
    232 {
    \n+\n+
    232
    \n
    233
    \n-
    234 template<typename typeof_size_t, typename T>
    \n-
    235 void operator()(typeof_size_t& seed, const T& arg) const
    \n-
    236 {
    \n-
    237 static_assert(sizeof(typeof_size_t)==8, "hash_combiner::operator() instantiated with nonmatching type and size");
    \n+
    237 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<RemoteIndex>;
    \n
    238
    \n-
    239 // The following algorithm for combining two 64-bit hash values is inspired by a similar
    \n-
    240 // function in CityHash (http://cityhash.googlecode.com/svn-history/r2/trunk/src/city.h),
    \n-
    241 // which is in turn based on ideas from the MurmurHash library. The basic idea is easy to
    \n-
    242 // grasp, though: New information is XORed into the existing hash multiple times at different
    \n-
    243 // places (using shift operations), and the resulting pattern is spread over the complete
    \n-
    244 // range of available bits via multiplication with a "magic" constant. The constants used
    \n-
    245 // below (47 and 0x9ddfea08eb382d69ULL) are taken from the CityHash implementation.
    \n-
    246 //
    \n-
    247 // We opted not to use the mixing algorithm proposed in the C++ working group defect list at
    \n-
    248 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf, p. 57f. because it
    \n-
    249 // has very bad hash distribution properties if you apply it to lists of very small numbers,
    \n-
    250 // an application that is frequent in PDELab's ordering framework.
    \n-
    251
    \n-
    252 Dune::hash<T> hasher;
    \n-
    253 const typeof_size_t kMul = 0x9ddfea08eb382d69ULL;
    \n-
    254 typeof_size_t h = hasher(arg);
    \n-
    255 typeof_size_t a = (seed ^ h) * kMul;
    \n-
    256 a ^= (a >> 47);
    \n-
    257 typeof_size_t b = (h ^ a) * kMul;
    \n-
    258 b ^= (b >> 47);
    \n-
    259 b *= kMul;
    \n-
    260 seed = b;
    \n-
    261 }
    \n-
    262
    \n-
    263 };
    \n-
    264
    \n-
    265
    \n-
    266 // hash combining for 32-bit platforms.
    \n-
    267 template<>
    \n-
    268 struct hash_combiner<4>
    \n-
    269 {
    \n+\n+\n+
    242
    \n+
    244 typedef std::map<int, std::pair<RemoteIndexList*,RemoteIndexList*> >
    \n+\n+
    246
    \n+
    247 typedef typename RemoteIndexMap::const_iterator const_iterator;
    \n+
    248
    \n+
    266 inline RemoteIndices(const ParallelIndexSet& source, const ParallelIndexSet& destination,
    \n+
    267 const MPI_Comm& comm, const std::vector<int>& neighbours=std::vector<int>(), bool includeSelf=false);
    \n+
    268
    \n+\n
    270
    \n-
    271 template<typename typeof_size_t, typename T>
    \n-
    272 void operator()(typeof_size_t& seed, const T& arg) const
    \n-
    273 {
    \n-
    274 static_assert(sizeof(typeof_size_t)==4, "hash_combiner::operator() instantiated with nonmatching type and size");
    \n-
    275
    \n-
    276 // The default algorithm above requires a 64-bit std::size_t. The following algorithm is a
    \n-
    277 // 32-bit compatible fallback, again inspired by CityHash and MurmurHash
    \n-
    278 // (http://cityhash.googlecode.com/svn-history/r2/trunk/src/city.cc).
    \n-
    279 // It uses 32-bit constants and relies on rotation instead of multiplication to spread the
    \n-
    280 // mixed bits as that is apparently more efficient on IA-32. The constants used below are again
    \n-
    281 // taken from CityHash, in particular from the file referenced above.
    \n-
    282
    \n-
    283 Dune::hash<T> hasher;
    \n-
    284 const typeof_size_t c1 = 0xcc9e2d51;
    \n-
    285 const typeof_size_t c2 = 0x1b873593;
    \n-
    286 const typeof_size_t c3 = 0xe6546b64;
    \n-
    287 typeof_size_t h = hasher(arg);
    \n-
    288 typeof_size_t a = seed * c1;
    \n-
    289 a = (a >> 17) | (a << (32 - 17));
    \n-
    290 a *= c2;
    \n-
    291 h ^= a;
    \n-
    292 h = (h >> 19) | (h << (32 - 19));
    \n-
    293 seed = h * 5 + c3;
    \n-
    294 }
    \n-
    295
    \n-
    296 };
    \n-
    297
    \n-
    298#endif // DOXYGEN
    \n-
    299
    \n-
    301
    \n-
    306 template<typename T>
    \n-
    307 inline void hash_combine(std::size_t& seed, const T& arg)
    \n-
    308 {
    \n-
    309 hash_combiner<sizeof(std::size_t)>()(seed,arg);
    \n-
    310 }
    \n+
    278 void setIncludeSelf(bool includeSelf);
    \n+
    279
    \n+
    296 void setIndexSets(const ParallelIndexSet& source, const ParallelIndexSet& destination,
    \n+
    297 const MPI_Comm& comm, const std::vector<int>& neighbours=std::vector<int>());
    \n+
    298
    \n+
    299 template<typename C>
    \n+\n+
    301 {
    \n+
    302 neighbourIds.clear();
    \n+
    303 neighbourIds.insert(neighbours.begin(), neighbours.end());
    \n+
    304
    \n+
    305 }
    \n+
    306
    \n+
    307 const std::set<int>& getNeighbours() const
    \n+
    308 {
    \n+
    309 return neighbourIds;
    \n+
    310 }
    \n
    311
    \n-
    313
    \n-
    321 template<typename It>
    \n-
    322 inline std::size_t hash_range(It first, It last)
    \n-
    323 {
    \n-
    324 std::size_t seed = 0;
    \n-
    325 for (; first != last; ++first)
    \n-
    326 {
    \n-
    327 hash_combine(seed,*first);
    \n-
    328 }
    \n-
    329 return seed;
    \n-
    330 }
    \n-
    331
    \n-
    333
    \n-
    340 template<typename It>
    \n-
    341 inline void hash_range(std::size_t& seed, It first, It last)
    \n-
    342 {
    \n-
    343 for (; first != last; ++first)
    \n-
    344 {
    \n-
    345 hash_combine(seed,*first);
    \n-
    346 }
    \n-
    347 }
    \n-
    348
    \n-
    349} // end namespace Dune
    \n-
    350
    \n-
    351#endif // DUNE_COMMON_HASH_HH
    \n-
    Traits for type conversions and type information.
    \n+\n+
    316
    \n+
    326 template<bool ignorePublic>
    \n+
    327 void rebuild();
    \n+
    328
    \n+
    329 bool operator==(const RemoteIndices& ri) const;
    \n+
    330
    \n+
    338 inline bool isSynced() const;
    \n+
    339
    \n+
    343 inline MPI_Comm communicator() const;
    \n+
    344
    \n+
    359 template<bool mode, bool send>
    \n+\n+
    361
    \n+
    368 inline const_iterator find(int proc) const;
    \n+
    369
    \n+
    374 inline const_iterator begin() const;
    \n+
    375
    \n+
    380 inline const_iterator end() const;
    \n+
    381
    \n+
    385 template<bool send>
    \n+
    386 inline CollectiveIteratorT iterator() const;
    \n+
    387
    \n+
    391 inline void free();
    \n+
    392
    \n+
    397 inline int neighbours() const;
    \n+
    398
    \n+
    400 inline const ParallelIndexSet& sourceIndexSet() const;
    \n+
    401
    \n+
    403 inline const ParallelIndexSet& destinationIndexSet() const;
    \n+
    404
    \n+
    405 private:
    \n+
    407 RemoteIndices(const RemoteIndices&) = delete;
    \n+
    408
    \n+
    410 const ParallelIndexSet* source_;
    \n+
    411
    \n+
    413 const ParallelIndexSet* target_;
    \n+
    414
    \n+
    416 MPI_Comm comm_;
    \n+
    417
    \n+
    420 std::set<int> neighbourIds;
    \n+
    421
    \n+
    423 const static int commTag_=333;
    \n+
    424
    \n+
    429 int sourceSeqNo_;
    \n+
    430
    \n+
    435 int destSeqNo_;
    \n+
    436
    \n+
    440 bool publicIgnored;
    \n+
    441
    \n+
    445 bool firstBuild;
    \n+
    446
    \n+
    447 /*
    \n+
    448 * @brief If true, sending from indices of the processor to other
    \n+
    449 * indices on the same processor is enabled even if the same indexset is used
    \n+
    450 * on both the
    \n+
    451 * sending and receiving side.
    \n+
    452 */
    \n+
    453 bool includeSelf;
    \n+
    454
    \n+\n+
    457 PairType;
    \n+
    458
    \n+
    465 RemoteIndexMap remoteIndices_;
    \n+
    466
    \n+
    477 template<bool ignorePublic>
    \n+
    478 inline void buildRemote(bool includeSelf);
    \n+
    479
    \n+
    485 inline int noPublic(const ParallelIndexSet& indexSet);
    \n+
    486
    \n+
    498 template<bool ignorePublic>
    \n+
    499 inline void packEntries(PairType** myPairs, const ParallelIndexSet& indexSet,
    \n+
    500 char* p_out, MPI_Datatype type, int bufferSize,
    \n+
    501 int* position, int n);
    \n+
    502
    \n+
    516 inline void unpackIndices(RemoteIndexList& remote, int remoteEntries,
    \n+
    517 PairType** local, int localEntries, char* p_in,
    \n+
    518 MPI_Datatype type, int* position, int bufferSize,
    \n+
    519 bool fromOurself);
    \n+
    520
    \n+
    521 inline void unpackIndices(RemoteIndexList& send, RemoteIndexList& receive,
    \n+
    522 int remoteEntries, PairType** localSource,
    \n+
    523 int localSourceEntries, PairType** localDest,
    \n+
    524 int localDestEntries, char* p_in,
    \n+
    525 MPI_Datatype type, int* position, int bufferSize);
    \n+
    526
    \n+
    527 void unpackCreateRemote(char* p_in, PairType** sourcePairs, PairType** DestPairs,
    \n+
    528 int remoteProc, int sourcePublish, int destPublish,
    \n+
    529 int bufferSize, bool sendTwo, bool fromOurSelf=false);
    \n+
    530 };
    \n+
    531
    \n+
    549 template<class T, class A, bool mode>
    \n+\n+
    551 {
    \n+
    552
    \n+
    553 template<typename T1, typename A1>
    \n+
    554 friend class RemoteIndices;
    \n+
    555
    \n+
    556 public:
    \n+\n+
    558 {};
    \n+
    559
    \n+
    568 constexpr static bool MODIFYINDEXSET = mode;
    \n+
    569
    \n+\n+
    574
    \n+\n+
    579
    \n+\n+
    584
    \n+
    588 typedef typename LocalIndex::Attribute Attribute;
    \n+
    589
    \n+\n+
    594
    \n+
    598 typedef A Allocator;
    \n+
    599
    \n+\n+\n+
    603
    \n+\n+
    608
    \n+\n+
    613
    \n+
    627 void insert(const RemoteIndex& index);
    \n+
    628
    \n+
    629
    \n+
    644 void insert(const RemoteIndex& index, const GlobalIndex& global);
    \n+
    645
    \n+
    653 bool remove(const GlobalIndex& global);
    \n+
    654
    \n+\n+
    668
    \n+
    669
    \n+\n+
    671
    \n+\n+
    677 : glist_()
    \n+
    678 {}
    \n+
    679
    \n+
    680 private:
    \n+
    681
    \n+\n+
    688 RemoteIndexList& rList);
    \n+
    689
    \n+
    690 typedef SLList<GlobalIndex,Allocator> GlobalList;
    \n+
    691 typedef typename GlobalList::ModifyIterator GlobalModifyIterator;
    \n+
    692 RemoteIndexList* rList_;
    \n+
    693 const ParallelIndexSet* indexSet_;
    \n+
    694 GlobalList glist_;
    \n+
    695 ModifyIterator iter_;
    \n+
    696 GlobalModifyIterator giter_;
    \n+
    697 ConstIterator end_;
    \n+
    698 bool first_;
    \n+
    699 GlobalIndex last_;
    \n+
    700 };
    \n+
    701
    \n+
    706 template<class T, class A>
    \n+\n+
    708 {
    \n+
    709
    \n+
    713 typedef T ParallelIndexSet;
    \n+
    714
    \n+
    718 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
    \n+
    719
    \n+
    723 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
    \n+
    724
    \n+
    728 typedef typename LocalIndex::Attribute Attribute;
    \n+
    729
    \n+\n+
    732
    \n+
    734 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<RemoteIndex>;
    \n+
    735
    \n+\n+
    738
    \n+
    740 typedef std::map<int,std::pair<typename RemoteIndexList::const_iterator,
    \n+
    741 const typename RemoteIndexList::const_iterator> >
    \n+
    742 Map;
    \n+
    743
    \n+
    744 public:
    \n+
    745
    \n+
    747 typedef std::map<int, std::pair<RemoteIndexList*,RemoteIndexList*> >
    \n+\n+
    749
    \n+
    755 inline CollectiveIterator(const RemoteIndexMap& map_, bool send);
    \n+
    756
    \n+
    765 inline void advance(const GlobalIndex& global);
    \n+
    766
    \n+
    776 inline void advance(const GlobalIndex& global, const Attribute& attribute);
    \n+
    777
    \n+\n+
    779
    \n+
    783 inline bool empty() const;
    \n+
    784
    \n+\n+
    792 {
    \n+
    793 public:
    \n+
    794 typedef typename Map::iterator RealIterator;
    \n+
    795 typedef typename Map::iterator ConstRealIterator;
    \n+
    796
    \n+
    797
    \n+
    799 iterator(const RealIterator& iter, const ConstRealIterator& end, GlobalIndex& index)
    \n+
    800 : iter_(iter), end_(end), index_(index), hasAttribute(false)
    \n+
    801 {
    \n+
    802 // Move to the first valid entry
    \n+
    803 while(iter_!=end_ && iter_->second.first->localIndexPair().global()!=index_)
    \n+
    804 ++iter_;
    \n+
    805 }
    \n+
    806
    \n+
    807 iterator(const RealIterator& iter, const ConstRealIterator& end, GlobalIndex index,
    \n+
    808 Attribute attribute)
    \n+
    809 : iter_(iter), end_(end), index_(index), attribute_(attribute), hasAttribute(true)
    \n+
    810 {
    \n+
    811 // Move to the first valid entry or the end
    \n+
    812 while(iter_!=end_ && (iter_->second.first->localIndexPair().global()!=index_
    \n+
    813 || iter_->second.first->localIndexPair().local().attribute()!=attribute))
    \n+
    814 ++iter_;
    \n+
    815 }
    \n+
    817 iterator(const iterator& other)
    \n+
    818 : iter_(other.iter_), end_(other.end_), index_(other.index_)
    \n+
    819 { }
    \n+
    820
    \n+\n+
    823 {
    \n+
    824 ++iter_;
    \n+
    825 // If entry is not valid move on
    \n+
    826 while(iter_!=end_ && (iter_->second.first->localIndexPair().global()!=index_ ||
    \n+
    827 (hasAttribute &&
    \n+
    828 iter_->second.first->localIndexPair().local().attribute()!=attribute_)))
    \n+
    829 ++iter_;
    \n+
    830 assert(iter_==end_ ||
    \n+
    831 (iter_->second.first->localIndexPair().global()==index_));
    \n+
    832 assert(iter_==end_ || !hasAttribute ||
    \n+
    833 (iter_->second.first->localIndexPair().local().attribute()==attribute_));
    \n+
    834 return *this;
    \n+
    835 }
    \n+
    836
    \n+
    838 const RemoteIndex& operator*() const
    \n+
    839 {
    \n+
    840 return *(iter_->second.first);
    \n+
    841 }
    \n+
    842
    \n+
    844 int process() const
    \n+
    845 {
    \n+
    846 return iter_->first;
    \n+
    847 }
    \n+
    848
    \n+
    850 const RemoteIndex* operator->() const
    \n+
    851 {
    \n+
    852 return iter_->second.first.operator->();
    \n+
    853 }
    \n+
    854
    \n+
    856 bool operator==(const iterator& other) const
    \n+
    857 {
    \n+
    858 return other.iter_==iter_;
    \n+
    859 }
    \n+
    860
    \n+
    862 bool operator!=(const iterator& other) const
    \n+
    863 {
    \n+
    864 return other.iter_!=iter_;
    \n+
    865 }
    \n+
    866
    \n+
    867 private:
    \n+
    868 iterator();
    \n+
    869
    \n+
    870 RealIterator iter_;
    \n+
    871 RealIterator end_;
    \n+
    872 GlobalIndex index_;
    \n+
    873 Attribute attribute_;
    \n+
    874 bool hasAttribute;
    \n+
    875 };
    \n+
    876
    \n+
    877 iterator begin();
    \n+
    878
    \n+
    879 iterator end();
    \n+
    880
    \n+
    881 private:
    \n+
    882
    \n+
    883 Map map_;
    \n+
    884 GlobalIndex index_;
    \n+
    885 Attribute attribute_;
    \n+
    886 bool noattribute;
    \n+
    887 };
    \n+
    888
    \n+
    889 template<typename TG, typename TA>
    \n+\n+
    891 {
    \n+
    892 if(type==MPI_DATATYPE_NULL) {
    \n+
    893 int length[2] = {1, 1};
    \n+
    894 MPI_Aint base;
    \n+
    895 MPI_Aint disp[2];
    \n+
    896 MPI_Datatype types[2] = {MPITraits<TG>::getType(),
    \n+\n+\n+
    899 MPI_Get_address(&rep, &base); // lower bound of the datatype
    \n+
    900 MPI_Get_address(&(rep.global_), &disp[0]);
    \n+
    901 MPI_Get_address(&(rep.local_), &disp[1]);
    \n+
    902 for (MPI_Aint& d : disp)
    \n+
    903 d -= base;
    \n+
    904
    \n+
    905 MPI_Datatype tmp;
    \n+
    906 MPI_Type_create_struct(2, length, disp, types, &tmp);
    \n+
    907
    \n+
    908 MPI_Type_create_resized(tmp, 0, sizeof(IndexPair<TG,ParallelLocalIndex<TA> >), &type);
    \n+
    909 MPI_Type_commit(&type);
    \n+
    910
    \n+
    911 MPI_Type_free(&tmp);
    \n+
    912 }
    \n+
    913 return type;
    \n+
    914 }
    \n+
    915
    \n+
    916 template<typename TG, typename TA>
    \n+
    917 MPI_Datatype MPITraits<IndexPair<TG,ParallelLocalIndex<TA> > >::type=MPI_DATATYPE_NULL;
    \n+
    918
    \n+
    919 template<typename T1, typename T2>
    \n+
    920 RemoteIndex<T1,T2>::RemoteIndex(const T2& attribute, const PairType* local)
    \n+
    921 : localIndex_(local), attribute_(static_cast<std::underlying_type_t<T2>>(attribute))
    \n+
    922 {}
    \n+
    923
    \n+
    924 template<typename T1, typename T2>
    \n+\n+
    926 : localIndex_(0), attribute_(static_cast<std::underlying_type_t<T2>>(attribute))
    \n+
    927 {}
    \n+
    928
    \n+
    929 template<typename T1, typename T2>
    \n+\n+
    931 : localIndex_(0), attribute_()
    \n+
    932 {}
    \n+
    933 template<typename T1, typename T2>
    \n+
    934 inline bool RemoteIndex<T1,T2>::operator==(const RemoteIndex& ri) const
    \n+
    935 {
    \n+
    936 return localIndex_==ri.localIndex_ && attribute_==ri.attribute;
    \n+
    937 }
    \n+
    938
    \n+
    939 template<typename T1, typename T2>
    \n+
    940 inline bool RemoteIndex<T1,T2>::operator!=(const RemoteIndex& ri) const
    \n+
    941 {
    \n+
    942 return localIndex_!=ri.localIndex_ || attribute_!=ri.attribute_;
    \n+
    943 }
    \n+
    944
    \n+
    945 template<typename T1, typename T2>
    \n+
    946 inline const T2 RemoteIndex<T1,T2>::attribute() const
    \n+
    947 {
    \n+
    948 return T2(attribute_);
    \n+
    949 }
    \n+
    950
    \n+
    951 template<typename T1, typename T2>
    \n+\n+
    953 {
    \n+
    954 return *localIndex_;
    \n+
    955 }
    \n+
    956
    \n+
    957 template<typename T, typename A>
    \n+\n+
    959 const ParallelIndexSet& destination,
    \n+
    960 const MPI_Comm& comm,
    \n+
    961 const std::vector<int>& neighbours,
    \n+
    962 bool includeSelf_)
    \n+
    963 : source_(&source), target_(&destination), comm_(comm),
    \n+
    964 sourceSeqNo_(-1), destSeqNo_(-1), publicIgnored(false), firstBuild(true),
    \n+
    965 includeSelf(includeSelf_)
    \n+
    966 {
    \n+\n+
    968 }
    \n+
    969
    \n+
    970 template<typename T, typename A>
    \n+\n+
    972 {
    \n+
    973 includeSelf=b;
    \n+
    974 }
    \n+
    975
    \n+
    976 template<typename T, typename A>
    \n+\n+
    978 : source_(0), target_(0), sourceSeqNo_(-1),
    \n+
    979 destSeqNo_(-1), publicIgnored(false), firstBuild(true),
    \n+
    980 includeSelf(false)
    \n+
    981 {}
    \n+
    982
    \n+
    983 template<class T, typename A>
    \n+\n+
    985 const ParallelIndexSet& destination,
    \n+
    986 const MPI_Comm& comm,
    \n+
    987 const std::vector<int>& neighbours)
    \n+
    988 {
    \n+
    989 free();
    \n+
    990 source_ = &source;
    \n+
    991 target_ = &destination;
    \n+
    992 comm_ = comm;
    \n+
    993 firstBuild = true;
    \n+
    994 setNeighbours(neighbours);
    \n+
    995 }
    \n+
    996
    \n+
    997 template<typename T, typename A>
    \n+\n+\n+
    1000 {
    \n+
    1001 return *source_;
    \n+
    1002 }
    \n+
    1003
    \n+
    1004
    \n+
    1005 template<typename T, typename A>
    \n+\n+\n+
    1008 {
    \n+
    1009 return *target_;
    \n+
    1010 }
    \n+
    1011
    \n+
    1012
    \n+
    1013 template<typename T, typename A>
    \n+\n+
    1015 {
    \n+
    1016 free();
    \n+
    1017 }
    \n+
    1018
    \n+
    1019 template<typename T, typename A>
    \n+
    1020 template<bool ignorePublic>
    \n+\n+
    1022 const ParallelIndexSet& indexSet,
    \n+
    1023 char* p_out, MPI_Datatype type,
    \n+
    1024 int bufferSize,
    \n+
    1025 int *position,
    \n+
    1026 [[maybe_unused]] int n)
    \n+
    1027 {
    \n+
    1028 // fill with own indices
    \n+
    1029 const auto end = indexSet.end();
    \n+
    1030
    \n+
    1031 //Now pack the source indices
    \n+
    1032 int i=0;
    \n+
    1033 for(auto index = indexSet.begin(); index != end; ++index)
    \n+
    1034 if(ignorePublic || index->local().isPublic()) {
    \n+
    1035
    \n+
    1036 MPI_Pack(const_cast<PairType*>(&(*index)), 1,
    \n+
    1037 type,
    \n+
    1038 p_out, bufferSize, position, comm_);
    \n+
    1039 pairs[i++] = const_cast<PairType*>(&(*index));
    \n+
    1040
    \n+
    1041 }
    \n+
    1042 assert(i==n);
    \n+
    1043 }
    \n+
    1044
    \n+
    1045 template<typename T, typename A>
    \n+
    1046 inline int RemoteIndices<T,A>::noPublic(const ParallelIndexSet& indexSet)
    \n+
    1047 {
    \n+
    1048
    \n+
    1049 int noPublic=0;
    \n+
    1050
    \n+
    1051 const auto end=indexSet.end();
    \n+
    1052 for(auto index=indexSet.begin(); index!=end; ++index)
    \n+
    1053 if(index->local().isPublic())
    \n+
    1054 noPublic++;
    \n+
    1055
    \n+
    1056 return noPublic;
    \n+
    1057
    \n+
    1058 }
    \n+
    1059
    \n+
    1060
    \n+
    1061 template<typename T, typename A>
    \n+
    1062 inline void RemoteIndices<T,A>::unpackCreateRemote(char* p_in, PairType** sourcePairs,
    \n+
    1063 PairType** destPairs, int remoteProc,
    \n+
    1064 int sourcePublish, int destPublish,
    \n+
    1065 int bufferSize, bool sendTwo,
    \n+
    1066 bool fromOurSelf)
    \n+
    1067 {
    \n+
    1068
    \n+
    1069 // unpack the number of indices we received
    \n+
    1070 int noRemoteSource=-1, noRemoteDest=-1;
    \n+
    1071 char twoIndexSets=0;
    \n+
    1072 int position=0;
    \n+
    1073 // Did we receive two index sets?
    \n+
    1074 MPI_Unpack(p_in, bufferSize, &position, &twoIndexSets, 1, MPI_CHAR, comm_);
    \n+
    1075 // The number of source indices received
    \n+
    1076 MPI_Unpack(p_in, bufferSize, &position, &noRemoteSource, 1, MPI_INT, comm_);
    \n+
    1077 // The number of destination indices received
    \n+
    1078 MPI_Unpack(p_in, bufferSize, &position, &noRemoteDest, 1, MPI_INT, comm_);
    \n+
    1079
    \n+
    1080
    \n+
    1081 // Indices for which we receive
    \n+
    1082 RemoteIndexList* receive= new RemoteIndexList();
    \n+
    1083 // Indices for which we send
    \n+
    1084 RemoteIndexList* send=0;
    \n+
    1085
    \n+
    1086 MPI_Datatype type= MPITraits<PairType>::getType();
    \n+
    1087
    \n+
    1088 if(!twoIndexSets) {
    \n+
    1089 if(sendTwo) {
    \n+
    1090 send = new RemoteIndexList();
    \n+
    1091 // Create both remote index sets simultaneously
    \n+
    1092 unpackIndices(*send, *receive, noRemoteSource, sourcePairs, sourcePublish,
    \n+
    1093 destPairs, destPublish, p_in, type, &position, bufferSize);
    \n+
    1094 }else{
    \n+
    1095 // we only need one list
    \n+
    1096 unpackIndices(*receive, noRemoteSource, sourcePairs, sourcePublish,
    \n+
    1097 p_in, type, &position, bufferSize, fromOurSelf);
    \n+
    1098 send=receive;
    \n+
    1099 }
    \n+
    1100 }else{
    \n+
    1101
    \n+
    1102 int oldPos=position;
    \n+
    1103 // Two index sets received
    \n+
    1104 unpackIndices(*receive, noRemoteSource, destPairs, destPublish,
    \n+
    1105 p_in, type, &position, bufferSize, fromOurSelf);
    \n+
    1106 if(!sendTwo)
    \n+
    1107 //unpack source entries again as destination entries
    \n+
    1108 position=oldPos;
    \n+
    1109
    \n+
    1110 send = new RemoteIndexList();
    \n+
    1111 unpackIndices(*send, noRemoteDest, sourcePairs, sourcePublish,
    \n+
    1112 p_in, type, &position, bufferSize, fromOurSelf);
    \n+
    1113 }
    \n+
    1114
    \n+
    1115 if(receive->empty() && send->empty()) {
    \n+
    1116 if(send==receive) {
    \n+
    1117 delete send;
    \n+
    1118 }else{
    \n+
    1119 delete send;
    \n+
    1120 delete receive;
    \n+
    1121 }
    \n+
    1122 }else{
    \n+
    1123 remoteIndices_.insert(std::make_pair(remoteProc,
    \n+
    1124 std::make_pair(send,receive)));
    \n+
    1125 }
    \n+
    1126 }
    \n+
    1127
    \n+
    1128
    \n+
    1129 template<typename T, typename A>
    \n+
    1130 template<bool ignorePublic>
    \n+
    1131 inline void RemoteIndices<T,A>::buildRemote(bool includeSelf_)
    \n+
    1132 {
    \n+
    1133 // Processor configuration
    \n+
    1134 int rank, procs;
    \n+
    1135 MPI_Comm_rank(comm_, &rank);
    \n+
    1136 MPI_Comm_size(comm_, &procs);
    \n+
    1137
    \n+
    1138 // number of local indices to publish
    \n+
    1139 // The indices of the destination will be send.
    \n+
    1140 int sourcePublish, destPublish;
    \n+
    1141
    \n+
    1142 // Do we need to send two index sets?
    \n+
    1143 char sendTwo = (source_ != target_);
    \n+
    1144
    \n+
    1145 if(procs==1 && !(sendTwo || includeSelf_))
    \n+
    1146 // Nothing to communicate
    \n+
    1147 return;
    \n+
    1148
    \n+
    1149 sourcePublish = (ignorePublic) ? source_->size() : noPublic(*source_);
    \n+
    1150
    \n+
    1151 if(sendTwo)
    \n+
    1152 destPublish = (ignorePublic) ? target_->size() : noPublic(*target_);
    \n+
    1153 else
    \n+
    1154 // we only need to send one set of indices
    \n+
    1155 destPublish = 0;
    \n+
    1156
    \n+
    1157 int maxPublish, publish=sourcePublish+destPublish;
    \n+
    1158
    \n+
    1159 // Calculate maximum number of indices send
    \n+
    1160 MPI_Allreduce(&publish, &maxPublish, 1, MPI_INT, MPI_MAX, comm_);
    \n+
    1161
    \n+
    1162 // allocate buffers
    \n+
    1163 PairType** destPairs;
    \n+
    1164 PairType** sourcePairs = new PairType*[sourcePublish>0 ? sourcePublish : 1];
    \n+
    1165
    \n+
    1166 if(sendTwo)
    \n+
    1167 destPairs = new PairType*[destPublish>0 ? destPublish : 1];
    \n+
    1168 else
    \n+
    1169 destPairs=sourcePairs;
    \n+
    1170
    \n+
    1171 char** buffer = new char*[2];
    \n+
    1172 int bufferSize;
    \n+
    1173 int position=0;
    \n+
    1174 int intSize;
    \n+
    1175 int charSize;
    \n+
    1176
    \n+
    1177 // calculate buffer size
    \n+
    1178 MPI_Datatype type = MPITraits<PairType>::getType();
    \n+
    1179
    \n+
    1180 MPI_Pack_size(maxPublish, type, comm_,
    \n+
    1181 &bufferSize);
    \n+
    1182 MPI_Pack_size(1, MPI_INT, comm_,
    \n+
    1183 &intSize);
    \n+
    1184 MPI_Pack_size(1, MPI_CHAR, comm_,
    \n+
    1185 &charSize);
    \n+
    1186 // Our message will contain the following:
    \n+
    1187 // a bool whether two index sets where sent
    \n+
    1188 // the size of the source and the dest indexset,
    \n+
    1189 // then the source and destination indices
    \n+
    1190 bufferSize += 2 * intSize + charSize;
    \n+
    1191
    \n+
    1192 if(bufferSize<=0) bufferSize=1;
    \n+
    1193
    \n+
    1194 buffer[0] = new char[bufferSize];
    \n+
    1195 buffer[1] = new char[bufferSize];
    \n+
    1196
    \n+
    1197
    \n+
    1198 // pack entries into buffer[0], p_out below!
    \n+
    1199 MPI_Pack(&sendTwo, 1, MPI_CHAR, buffer[0], bufferSize, &position,
    \n+
    1200 comm_);
    \n+
    1201
    \n+
    1202 // The number of indices we send for each index set
    \n+
    1203 MPI_Pack(&sourcePublish, 1, MPI_INT, buffer[0], bufferSize, &position,
    \n+
    1204 comm_);
    \n+
    1205 MPI_Pack(&destPublish, 1, MPI_INT, buffer[0], bufferSize, &position,
    \n+
    1206 comm_);
    \n+
    1207
    \n+
    1208 // Now pack the source indices and setup the destination pairs
    \n+
    1209 packEntries<ignorePublic>(sourcePairs, *source_, buffer[0], type,
    \n+
    1210 bufferSize, &position, sourcePublish);
    \n+
    1211 // If necessary send the dest indices and setup the source pairs
    \n+
    1212 if(sendTwo)
    \n+
    1213 packEntries<ignorePublic>(destPairs, *target_, buffer[0], type,
    \n+
    1214 bufferSize, &position, destPublish);
    \n+
    1215
    \n+
    1216
    \n+
    1217 // Update remote indices for ourself
    \n+
    1218 if(sendTwo|| includeSelf_)
    \n+
    1219 unpackCreateRemote(buffer[0], sourcePairs, destPairs, rank, sourcePublish,
    \n+
    1220 destPublish, bufferSize, sendTwo, includeSelf_);
    \n+
    1221
    \n+
    1222 neighbourIds.erase(rank);
    \n+
    1223
    \n+
    1224 if(neighbourIds.size()==0)
    \n+
    1225 {
    \n+
    1226 Dune::dvverb<<rank<<": Sending messages in a ring"<<std::endl;
    \n+
    1227 // send messages in ring
    \n+
    1228 for(int proc=1; proc<procs; proc++) {
    \n+
    1229 // pointers to the current input and output buffers
    \n+
    1230 char* p_out = buffer[1-(proc%2)];
    \n+
    1231 char* p_in = buffer[proc%2];
    \n+
    1232
    \n+
    1233 MPI_Status status;
    \n+
    1234 if(rank%2==0) {
    \n+
    1235 MPI_Ssend(p_out, bufferSize, MPI_PACKED, (rank+1)%procs,
    \n+
    1236 commTag_, comm_);
    \n+
    1237 MPI_Recv(p_in, bufferSize, MPI_PACKED, (rank+procs-1)%procs,
    \n+
    1238 commTag_, comm_, &status);
    \n+
    1239 }else{
    \n+
    1240 MPI_Recv(p_in, bufferSize, MPI_PACKED, (rank+procs-1)%procs,
    \n+
    1241 commTag_, comm_, &status);
    \n+
    1242 MPI_Ssend(p_out, bufferSize, MPI_PACKED, (rank+1)%procs,
    \n+
    1243 commTag_, comm_);
    \n+
    1244 }
    \n+
    1245
    \n+
    1246
    \n+
    1247 // The process these indices are from
    \n+
    1248 int remoteProc = (rank+procs-proc)%procs;
    \n+
    1249
    \n+
    1250 unpackCreateRemote(p_in, sourcePairs, destPairs, remoteProc, sourcePublish,
    \n+
    1251 destPublish, bufferSize, sendTwo);
    \n+
    1252
    \n+
    1253 }
    \n+
    1254
    \n+
    1255 }
    \n+
    1256 else
    \n+
    1257 {
    \n+
    1258 MPI_Request* requests=new MPI_Request[neighbourIds.size()];
    \n+
    1259 MPI_Request* req=requests;
    \n+
    1260
    \n+
    1261 typedef typename std::set<int>::size_type size_type;
    \n+
    1262 size_type noNeighbours=neighbourIds.size();
    \n+
    1263
    \n+
    1264 // setup sends
    \n+
    1265 for(std::set<int>::iterator neighbour=neighbourIds.begin();
    \n+
    1266 neighbour!= neighbourIds.end(); ++neighbour) {
    \n+
    1267 // Only send the information to the neighbouring processors
    \n+
    1268 MPI_Issend(buffer[0], position , MPI_PACKED, *neighbour, commTag_, comm_, req++);
    \n+
    1269 }
    \n+
    1270
    \n+
    1271 //Test for received messages
    \n+
    1272
    \n+
    1273 for(size_type received=0; received <noNeighbours; ++received)
    \n+
    1274 {
    \n+
    1275 MPI_Status status;
    \n+
    1276 // probe for next message
    \n+
    1277 MPI_Probe(MPI_ANY_SOURCE, commTag_, comm_, &status);
    \n+
    1278 int remoteProc=status.MPI_SOURCE;
    \n+
    1279 int size;
    \n+
    1280 MPI_Get_count(&status, MPI_PACKED, &size);
    \n+
    1281 // receive message
    \n+
    1282 MPI_Recv(buffer[1], size, MPI_PACKED, remoteProc,
    \n+
    1283 commTag_, comm_, &status);
    \n+
    1284
    \n+
    1285 unpackCreateRemote(buffer[1], sourcePairs, destPairs, remoteProc, sourcePublish,
    \n+
    1286 destPublish, bufferSize, sendTwo);
    \n+
    1287 }
    \n+
    1288 // wait for completion of pending requests
    \n+
    1289 MPI_Status* statuses = new MPI_Status[neighbourIds.size()];
    \n+
    1290
    \n+
    1291 if(MPI_ERR_IN_STATUS==MPI_Waitall(neighbourIds.size(), requests, statuses)) {
    \n+
    1292 for(size_type i=0; i < neighbourIds.size(); ++i)
    \n+
    1293 if(statuses[i].MPI_ERROR!=MPI_SUCCESS) {
    \n+
    1294 std::cerr<<rank<<": MPI_Error occurred while receiving message."<<std::endl;
    \n+
    1295 MPI_Abort(comm_, 999);
    \n+
    1296 }
    \n+
    1297 }
    \n+
    1298 delete[] requests;
    \n+
    1299 delete[] statuses;
    \n+
    1300 }
    \n+
    1301
    \n+
    1302
    \n+
    1303 // delete allocated memory
    \n+
    1304 if(destPairs!=sourcePairs)
    \n+
    1305 delete[] destPairs;
    \n+
    1306
    \n+
    1307 delete[] sourcePairs;
    \n+
    1308 delete[] buffer[0];
    \n+
    1309 delete[] buffer[1];
    \n+
    1310 delete[] buffer;
    \n+
    1311 }
    \n+
    1312
    \n+
    1313 template<typename T, typename A>
    \n+
    1314 inline void RemoteIndices<T,A>::unpackIndices(RemoteIndexList& remote,
    \n+
    1315 int remoteEntries,
    \n+
    1316 PairType** local,
    \n+
    1317 int localEntries,
    \n+
    1318 char* p_in,
    \n+
    1319 MPI_Datatype type,
    \n+
    1320 int* position,
    \n+
    1321 int bufferSize,
    \n+
    1322 bool fromOurSelf)
    \n+
    1323 {
    \n+
    1324 if(remoteEntries==0)
    \n+
    1325 return;
    \n+
    1326
    \n+
    1327 PairType index;
    \n+
    1328 MPI_Unpack(p_in, bufferSize, position, &index, 1,
    \n+
    1329 type, comm_);
    \n+
    1330 GlobalIndex oldGlobal=index.global();
    \n+
    1331 int n_in=0, localIndex=0;
    \n+
    1332
    \n+
    1333 //Check if we know the global index
    \n+
    1334 while(localIndex<localEntries) {
    \n+
    1335 if(local[localIndex]->global()==index.global()) {
    \n+
    1336 int oldLocalIndex=localIndex;
    \n+
    1337
    \n+
    1338 while(localIndex<localEntries &&
    \n+
    1339 local[localIndex]->global()==index.global()) {
    \n+
    1340 if(!fromOurSelf || index.local().attribute() !=
    \n+
    1341 local[localIndex]->local().attribute())
    \n+
    1342 // if index is from us it has to have a different attribute
    \n+
    1343 remote.push_back(RemoteIndex(index.local().attribute(),
    \n+
    1344 local[localIndex]));
    \n+
    1345 localIndex++;
    \n+
    1346 }
    \n+
    1347
    \n+
    1348 // unpack next remote index
    \n+
    1349 if((++n_in) < remoteEntries) {
    \n+
    1350 MPI_Unpack(p_in, bufferSize, position, &index, 1,
    \n+
    1351 type, comm_);
    \n+
    1352 if(index.global()==oldGlobal)
    \n+
    1353 // Restart comparison for the same global indices
    \n+
    1354 localIndex=oldLocalIndex;
    \n+
    1355 else
    \n+
    1356 oldGlobal=index.global();
    \n+
    1357 }else{
    \n+
    1358 // No more received indices
    \n+
    1359 break;
    \n+
    1360 }
    \n+
    1361 continue;
    \n+
    1362 }
    \n+
    1363
    \n+
    1364 if (local[localIndex]->global()<index.global()) {
    \n+
    1365 // compare with next entry in our list
    \n+
    1366 ++localIndex;
    \n+
    1367 }else{
    \n+
    1368 // We do not know the index, unpack next
    \n+
    1369 if((++n_in) < remoteEntries) {
    \n+
    1370 MPI_Unpack(p_in, bufferSize, position, &index, 1,
    \n+
    1371 type, comm_);
    \n+
    1372 oldGlobal=index.global();
    \n+
    1373 }else
    \n+
    1374 // No more received indices
    \n+
    1375 break;
    \n+
    1376 }
    \n+
    1377 }
    \n+
    1378
    \n+
    1379 // Unpack the other received indices without doing anything
    \n+
    1380 while(++n_in < remoteEntries)
    \n+
    1381 MPI_Unpack(p_in, bufferSize, position, &index, 1,
    \n+
    1382 type, comm_);
    \n+
    1383 }
    \n+
    1384
    \n+
    1385
    \n+
    1386 template<typename T, typename A>
    \n+
    1387 inline void RemoteIndices<T,A>::unpackIndices(RemoteIndexList& send,
    \n+
    1388 RemoteIndexList& receive,
    \n+
    1389 int remoteEntries,
    \n+
    1390 PairType** localSource,
    \n+
    1391 int localSourceEntries,
    \n+
    1392 PairType** localDest,
    \n+
    1393 int localDestEntries,
    \n+
    1394 char* p_in,
    \n+
    1395 MPI_Datatype type,
    \n+
    1396 int* position,
    \n+
    1397 int bufferSize)
    \n+
    1398 {
    \n+
    1399 int n_in=0, sourceIndex=0, destIndex=0;
    \n+
    1400
    \n+
    1401 //Check if we know the global index
    \n+
    1402 while(n_in<remoteEntries && (sourceIndex<localSourceEntries || destIndex<localDestEntries)) {
    \n+
    1403 // Unpack next index
    \n+
    1404 PairType index;
    \n+
    1405 MPI_Unpack(p_in, bufferSize, position, &index, 1,
    \n+
    1406 type, comm_);
    \n+
    1407 n_in++;
    \n+
    1408
    \n+
    1409 // Advance until global index in localSource and localDest are >= than the one in the unpacked index
    \n+
    1410 while(sourceIndex<localSourceEntries && localSource[sourceIndex]->global()<index.global())
    \n+
    1411 sourceIndex++;
    \n+
    1412
    \n+
    1413 while(destIndex<localDestEntries && localDest[destIndex]->global()<index.global())
    \n+
    1414 destIndex++;
    \n+
    1415
    \n+
    1416 // Add a remote index if we found the global index.
    \n+
    1417 if(sourceIndex<localSourceEntries && localSource[sourceIndex]->global()==index.global())
    \n+
    1418 send.push_back(RemoteIndex(index.local().attribute(),
    \n+
    1419 localSource[sourceIndex]));
    \n+
    1420
    \n+
    1421 if(destIndex < localDestEntries && localDest[destIndex]->global() == index.global())
    \n+
    1422 receive.push_back(RemoteIndex(index.local().attribute(),
    \n+
    1423 localDest[sourceIndex]));
    \n+
    1424 }
    \n+
    1425
    \n+
    1426 }
    \n+
    1427
    \n+
    1428 template<typename T, typename A>
    \n+\n+
    1430 {
    \n+
    1431 auto lend = remoteIndices_.end();
    \n+
    1432 for(auto lists=remoteIndices_.begin(); lists != lend; ++lists) {
    \n+
    1433 if(lists->second.first==lists->second.second) {
    \n+
    1434 // there is only one remote index list.
    \n+
    1435 delete lists->second.first;
    \n+
    1436 }else{
    \n+
    1437 delete lists->second.first;
    \n+
    1438 delete lists->second.second;
    \n+
    1439 }
    \n+
    1440 }
    \n+
    1441 remoteIndices_.clear();
    \n+
    1442 firstBuild=true;
    \n+
    1443 }
    \n+
    1444
    \n+
    1445 template<typename T, typename A>
    \n+\n+
    1447 {
    \n+
    1448 return remoteIndices_.size();
    \n+
    1449 }
    \n+
    1450
    \n+
    1451 template<typename T, typename A>
    \n+
    1452 template<bool ignorePublic>
    \n+\n+
    1454 {
    \n+
    1455 // Test whether a rebuild is Needed.
    \n+
    1456 if(firstBuild ||
    \n+
    1457 ignorePublic!=publicIgnored || !
    \n+
    1458 isSynced()) {
    \n+
    1459 free();
    \n+
    1460
    \n+
    1461 buildRemote<ignorePublic>(includeSelf);
    \n+
    1462
    \n+
    1463 sourceSeqNo_ = source_->seqNo();
    \n+
    1464 destSeqNo_ = target_->seqNo();
    \n+
    1465 firstBuild=false;
    \n+
    1466 publicIgnored=ignorePublic;
    \n+
    1467 }
    \n+
    1468
    \n+
    1469
    \n+
    1470 }
    \n+
    1471
    \n+
    1472 template<typename T, typename A>
    \n+\n+
    1474 {
    \n+
    1475 return sourceSeqNo_==source_->seqNo() && destSeqNo_ ==target_->seqNo();
    \n+
    1476 }
    \n+
    1477
    \n+
    1478 template<typename T, typename A>
    \n+
    1479 template<bool mode, bool send>
    \n+\n+
    1481 {
    \n+
    1482
    \n+
    1483 // The user are on their own now!
    \n+
    1484 // We assume they know what they are doing and just set the
    \n+
    1485 // remote indices to synced status.
    \n+
    1486 sourceSeqNo_ = source_->seqNo();
    \n+
    1487 destSeqNo_ = target_->seqNo();
    \n+
    1488
    \n+
    1489 typename RemoteIndexMap::iterator found = remoteIndices_.find(process);
    \n+
    1490
    \n+
    1491 if(found == remoteIndices_.end())
    \n+
    1492 {
    \n+
    1493 if(source_ != target_)
    \n+
    1494 found = remoteIndices_.insert(found, std::make_pair(process,
    \n+
    1495 std::make_pair(new RemoteIndexList(),
    \n+
    1496 new RemoteIndexList())));
    \n+
    1497 else{
    \n+
    1498 RemoteIndexList* rlist = new RemoteIndexList();
    \n+
    1499 found = remoteIndices_.insert(found,
    \n+
    1500 std::make_pair(process,
    \n+
    1501 std::make_pair(rlist, rlist)));
    \n+
    1502 }
    \n+
    1503 }
    \n+
    1504
    \n+
    1505 firstBuild = false;
    \n+
    1506
    \n+
    1507 if(send)
    \n+
    1508 return RemoteIndexListModifier<T,A,mode>(*source_, *(found->second.first));
    \n+
    1509 else
    \n+
    1510 return RemoteIndexListModifier<T,A,mode>(*target_, *(found->second.second));
    \n+
    1511 }
    \n+
    1512
    \n+
    1513 template<typename T, typename A>
    \n+\n+\n+
    1516 {
    \n+
    1517 return remoteIndices_.find(proc);
    \n+
    1518 }
    \n+
    1519
    \n+
    1520 template<typename T, typename A>
    \n+\n+\n+
    1523 {
    \n+
    1524 return remoteIndices_.begin();
    \n+
    1525 }
    \n+
    1526
    \n+
    1527 template<typename T, typename A>
    \n+\n+\n+
    1530 {
    \n+
    1531 return remoteIndices_.end();
    \n+
    1532 }
    \n+
    1533
    \n+
    1534
    \n+
    1535 template<typename T, typename A>
    \n+\n+
    1537 {
    \n+
    1538 if(neighbours()!=ri.neighbours())
    \n+
    1539 return false;
    \n+
    1540
    \n+
    1541 const auto rend = remoteIndices_.end();
    \n+
    1542
    \n+
    1543 for(auto rindex = remoteIndices_.begin(), rindex1=ri.remoteIndices_.begin(); rindex!=rend; ++rindex, ++rindex1) {
    \n+
    1544 if(rindex->first != rindex1->first)
    \n+
    1545 return false;
    \n+
    1546 if(*(rindex->second.first) != *(rindex1->second.first))
    \n+
    1547 return false;
    \n+
    1548 if(*(rindex->second.second) != *(rindex1->second.second))
    \n+
    1549 return false;
    \n+
    1550 }
    \n+
    1551 return true;
    \n+
    1552 }
    \n+
    1553
    \n+
    1554 template<class T, class A, bool mode>
    \n+\n+
    1556 RemoteIndexList& rList)
    \n+
    1557 : rList_(&rList), indexSet_(&indexSet), iter_(rList.beginModify()), end_(rList.end()), first_(true)
    \n+
    1558 {
    \n+
    1559 if(MODIFYINDEXSET) {
    \n+
    1560 assert(indexSet_);
    \n+
    1561 for(ConstIterator iter=iter_; iter != end_; ++iter)
    \n+
    1562 glist_.push_back(iter->localIndexPair().global());
    \n+
    1563 giter_ = glist_.beginModify();
    \n+
    1564 }
    \n+
    1565 }
    \n+
    1566
    \n+
    1567 template<typename T, typename A, bool mode>
    \n+\n+
    1569 : rList_(other.rList_), indexSet_(other.indexSet_),
    \n+
    1570 glist_(other.glist_), iter_(other.iter_), giter_(other.giter_), end_(other.end_),
    \n+
    1571 first_(other.first_), last_(other.last_)
    \n+
    1572 {}
    \n+
    1573
    \n+
    1574 template<typename T, typename A, bool mode>
    \n+\n+
    1576 {
    \n+
    1577 if(MODIFYINDEXSET) {
    \n+
    1578 // repair pointers to local index set.
    \n+
    1579#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1580 if(indexSet_->state()!=GROUND)
    \n+
    1581 DUNE_THROW(InvalidIndexSetState, "Index has to be in ground mode for repairing pointers to indices");
    \n+
    1582#endif
    \n+
    1583 auto giter = glist_.begin();
    \n+
    1584 auto index = indexSet_->begin();
    \n+
    1585
    \n+
    1586 for(auto iter=rList_->begin(); iter != end_; ++iter) {
    \n+
    1587 while(index->global()<*giter) {
    \n+
    1588 ++index;
    \n+
    1589#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1590 if(index == indexSet_->end())
    \n+
    1591 DUNE_THROW(InvalidPosition, "No such global index in set!");
    \n+
    1592#endif
    \n+
    1593 }
    \n+
    1594
    \n+
    1595#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1596 if(index->global() != *giter)
    \n+
    1597 DUNE_THROW(InvalidPosition, "No such global index in set!");
    \n+
    1598#endif
    \n+
    1599 iter->localIndex_ = &(*index);
    \n+
    1600 }
    \n+
    1601 }
    \n+
    1602 }
    \n+
    1603
    \n+
    1604 template<typename T, typename A, bool mode>
    \n+\n+
    1606 {
    \n+
    1607 static_assert(!mode,"Not allowed if the mode indicates that new indices"
    \n+
    1608 "might be added to the underlying index set. Use "
    \n+
    1609 "insert(const RemoteIndex&, const GlobalIndex&) instead");
    \n+
    1610
    \n+
    1611#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1612 if(!first_ && index.localIndexPair().global()<last_)
    \n+
    1613 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
    \n+
    1614#endif
    \n+
    1615 // Move to the correct position
    \n+
    1616 while(iter_ != end_ && iter_->localIndexPair().global() < index.localIndexPair().global()) {
    \n+
    1617 ++iter_;
    \n+
    1618 }
    \n+
    1619
    \n+
    1620 // No duplicate entries allowed
    \n+
    1621 assert(iter_==end_ || iter_->localIndexPair().global() != index.localIndexPair().global());
    \n+
    1622 iter_.insert(index);
    \n+
    1623 last_ = index.localIndexPair().global();
    \n+
    1624 first_ = false;
    \n+
    1625 }
    \n+
    1626
    \n+
    1627 template<typename T, typename A, bool mode>
    \n+\n+
    1629 {
    \n+
    1630 static_assert(mode,"Not allowed if the mode indicates that no new indices"
    \n+
    1631 "might be added to the underlying index set. Use "
    \n+
    1632 "insert(const RemoteIndex&) instead");
    \n+
    1633#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1634 if(!first_ && global<last_)
    \n+
    1635 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
    \n+
    1636#endif
    \n+
    1637 // Move to the correct position
    \n+
    1638 while(iter_ != end_ && *giter_ < global) {
    \n+
    1639 ++giter_;
    \n+
    1640 ++iter_;
    \n+
    1641 }
    \n+
    1642
    \n+
    1643 // No duplicate entries allowed
    \n+
    1644 assert(iter_->localIndexPair().global() != global);
    \n+
    1645 iter_.insert(index);
    \n+
    1646 giter_.insert(global);
    \n+
    1647
    \n+
    1648 last_ = global;
    \n+
    1649 first_ = false;
    \n+
    1650 }
    \n+
    1651
    \n+
    1652 template<typename T, typename A, bool mode>
    \n+\n+
    1654 {
    \n+
    1655#ifdef DUNE_ISTL_WITH_CHECKING
    \n+
    1656 if(!first_ && global<last_)
    \n+
    1657 DUNE_THROW(InvalidPosition, "Modification of remote indices have to occur with ascending global index.");
    \n+
    1658#endif
    \n+
    1659
    \n+
    1660 bool found= false;
    \n+
    1661
    \n+
    1662 if(MODIFYINDEXSET) {
    \n+
    1663 // Move to the correct position
    \n+
    1664 while(iter_!=end_ && *giter_< global) {
    \n+
    1665 ++giter_;
    \n+
    1666 ++iter_;
    \n+
    1667 }
    \n+
    1668 if(*giter_ == global) {
    \n+
    1669 giter_.remove();
    \n+
    1670 iter_.remove();
    \n+
    1671 found=true;
    \n+
    1672 }
    \n+
    1673 }else{
    \n+
    1674 while(iter_!=end_ && iter_->localIndexPair().global() < global)
    \n+
    1675 ++iter_;
    \n+
    1676
    \n+
    1677 if(iter_->localIndexPair().global()==global) {
    \n+
    1678 iter_.remove();
    \n+
    1679 found = true;
    \n+
    1680 }
    \n+
    1681 }
    \n+
    1682
    \n+
    1683 last_ = global;
    \n+
    1684 first_ = false;
    \n+
    1685 return found;
    \n+
    1686 }
    \n+
    1687
    \n+
    1688 template<typename T, typename A>
    \n+
    1689 template<bool send>
    \n+\n+
    1691 {
    \n+
    1692 return CollectiveIterator<T,A>(remoteIndices_, send);
    \n+
    1693 }
    \n+
    1694
    \n+
    1695 template<typename T, typename A>
    \n+
    1696 inline MPI_Comm RemoteIndices<T,A>::communicator() const
    \n+
    1697 {
    \n+
    1698 return comm_;
    \n+
    1699
    \n+
    1700 }
    \n+
    1701
    \n+
    1702 template<typename T, typename A>
    \n+\n+
    1704 {
    \n+
    1705
    \n+
    1706 const auto end = pmap.end();
    \n+
    1707 for(auto process = pmap.begin(); process != end; ++process) {
    \n+
    1708 const RemoteIndexList* list = send ? process->second.first : process->second.second;
    \n+
    1709 using ri_iterator = typename RemoteIndexList::const_iterator;
    \n+
    1710 map_.insert(std::make_pair(process->first,
    \n+
    1711 std::pair<ri_iterator, const ri_iterator>(list->begin(), list->end())));
    \n+
    1712 }
    \n+
    1713 }
    \n+
    1714
    \n+
    1715 template<typename T, typename A>
    \n+
    1716 inline void CollectiveIterator<T,A>::advance(const GlobalIndex& index)
    \n+
    1717 {
    \n+
    1718 const auto end = map_.end();
    \n+
    1719
    \n+
    1720 for(auto iter = map_.begin(); iter != end;) {
    \n+
    1721 // Step the iterator until we are >= index
    \n+
    1722 typename RemoteIndexList::const_iterator current = iter->second.first;
    \n+
    1723 typename RemoteIndexList::const_iterator rend = iter->second.second;
    \n+
    1724 RemoteIndex remoteIndex;
    \n+
    1725 if(current != rend)
    \n+
    1726 remoteIndex = *current;
    \n+
    1727
    \n+
    1728 while(iter->second.first!=iter->second.second && iter->second.first->localIndexPair().global()<index)
    \n+
    1729 ++(iter->second.first);
    \n+
    1730
    \n+
    1731 // erase from the map if there are no more entries.
    \n+
    1732 if(iter->second.first == iter->second.second)
    \n+
    1733 map_.erase(iter++);
    \n+
    1734 else{
    \n+
    1735 ++iter;
    \n+
    1736 }
    \n+
    1737 }
    \n+
    1738 index_=index;
    \n+
    1739 noattribute=true;
    \n+
    1740 }
    \n+
    1741
    \n+
    1742 template<typename T, typename A>
    \n+
    1743 inline void CollectiveIterator<T,A>::advance(const GlobalIndex& index,
    \n+
    1744 const Attribute& attribute)
    \n+
    1745 {
    \n+
    1746 const auto end = map_.end();
    \n+
    1747
    \n+
    1748 for(auto iter = map_.begin(); iter != end;) {
    \n+
    1749 // Step the iterator until we are >= index
    \n+
    1750 typename RemoteIndexList::const_iterator current = iter->second.first;
    \n+
    1751 typename RemoteIndexList::const_iterator rend = iter->second.second;
    \n+
    1752 RemoteIndex remoteIndex;
    \n+
    1753 if(current != rend)
    \n+
    1754 remoteIndex = *current;
    \n+
    1755
    \n+
    1756 // Move to global index or bigger
    \n+
    1757 while(iter->second.first!=iter->second.second && iter->second.first->localIndexPair().global()<index)
    \n+
    1758 ++(iter->second.first);
    \n+
    1759
    \n+
    1760 // move to attribute or bigger
    \n+
    1761 while(iter->second.first!=iter->second.second
    \n+
    1762 && iter->second.first->localIndexPair().global()==index
    \n+
    1763 && iter->second.first->localIndexPair().local().attribute()<attribute)
    \n+
    1764 ++(iter->second.first);
    \n+
    1765
    \n+
    1766 // erase from the map if there are no more entries.
    \n+
    1767 if(iter->second.first == iter->second.second)
    \n+
    1768 map_.erase(iter++);
    \n+
    1769 else{
    \n+
    1770 ++iter;
    \n+
    1771 }
    \n+
    1772 }
    \n+
    1773 index_=index;
    \n+
    1774 attribute_=attribute;
    \n+
    1775 noattribute=false;
    \n+
    1776 }
    \n+
    1777
    \n+
    1778 template<typename T, typename A>
    \n+\n+
    1780 {
    \n+
    1781 const auto end = map_.end();
    \n+
    1782
    \n+
    1783 for(auto iter = map_.begin(); iter != end;) {
    \n+
    1784 // Step the iterator until we are >= index
    \n+
    1785 auto current = iter->second.first;
    \n+
    1786 auto rend = iter->second.second;
    \n+
    1787
    \n+
    1788 // move all iterators pointing to the current global index to next value
    \n+
    1789 if(iter->second.first->localIndexPair().global()==index_ &&
    \n+
    1790 (noattribute || iter->second.first->localIndexPair().local().attribute() == attribute_))
    \n+
    1791 ++(iter->second.first);
    \n+
    1792
    \n+
    1793 // erase from the map if there are no more entries.
    \n+
    1794 if(iter->second.first == iter->second.second)
    \n+
    1795 map_.erase(iter++);
    \n+
    1796 else{
    \n+
    1797 ++iter;
    \n+
    1798 }
    \n+
    1799 }
    \n+
    1800 return *this;
    \n+
    1801 }
    \n+
    1802
    \n+
    1803 template<typename T, typename A>
    \n+\n+
    1805 {
    \n+
    1806 return map_.empty();
    \n+
    1807 }
    \n+
    1808
    \n+
    1809 template<typename T, typename A>
    \n+
    1810 inline typename CollectiveIterator<T,A>::iterator
    \n+\n+
    1812 {
    \n+
    1813 if(noattribute)
    \n+
    1814 return iterator(map_.begin(), map_.end(), index_);
    \n+
    1815 else
    \n+
    1816 return iterator(map_.begin(), map_.end(), index_,
    \n+
    1817 attribute_);
    \n+
    1818 }
    \n+
    1819
    \n+
    1820 template<typename T, typename A>
    \n+
    1821 inline typename CollectiveIterator<T,A>::iterator
    \n+\n+
    1823 {
    \n+
    1824 return iterator(map_.end(), map_.end(), index_);
    \n+
    1825 }
    \n+
    1826
    \n+
    1827 template<typename TG, typename TA>
    \n+
    1828 inline std::ostream& operator<<(std::ostream& os, const RemoteIndex<TG,TA>& index)
    \n+
    1829 {
    \n+
    1830 os<<"[global="<<index.localIndexPair().global()<<", remote attribute="<<index.attribute()<<" local attribute="<<index.localIndexPair().local().attribute()<<"]";
    \n+
    1831 return os;
    \n+
    1832 }
    \n+
    1833
    \n+
    1834 template<typename T, typename A>
    \n+
    1835 inline std::ostream& operator<<(std::ostream& os, const RemoteIndices<T,A>& indices)
    \n+
    1836 {
    \n+
    1837 int rank;
    \n+
    1838 MPI_Comm_rank(indices.comm_, &rank);
    \n+
    1839 const auto rend = indices.remoteIndices_.end();
    \n+
    1840
    \n+
    1841 for(auto rindex = indices.remoteIndices_.begin(); rindex!=rend; ++rindex) {
    \n+
    1842 os<<rank<<": Process "<<rindex->first<<":";
    \n+
    1843
    \n+
    1844 if(!rindex->second.first->empty()) {
    \n+
    1845 os<<" send:";
    \n+
    1846
    \n+
    1847 const auto send= rindex->second.first->end();
    \n+
    1848
    \n+
    1849 for(auto index = rindex->second.first->begin();
    \n+
    1850 index != send; ++index)
    \n+
    1851 os<<*index<<" ";
    \n+
    1852 os<<std::endl;
    \n+
    1853 }
    \n+
    1854 if(!rindex->second.second->empty()) {
    \n+
    1855 os<<rank<<": Process "<<rindex->first<<": "<<"receive: ";
    \n+
    1856
    \n+
    1857 for(const auto& index : *(rindex->second.second))
    \n+
    1858 os << index << " ";
    \n+
    1859 }
    \n+
    1860 os<<std::endl<<std::flush;
    \n+
    1861 }
    \n+
    1862 return os;
    \n+
    1863 }
    \n+
    1865}
    \n+
    1866
    \n+
    1867#endif // HAVE_MPI
    \n+
    1868
    \n+
    1869#endif
    \n+
    Provides classes for use as the local index in ParallelIndexSet for distributed computing.
    \n+
    Provides a map between global and local indices.
    \n+
    Traits classes for mapping types onto MPI_Datatype.
    \n+
    Implements a singly linked list together with the necessary iterators.
    \n+
    Standard Dune debug streams.
    \n+
    A few common exception classes.
    \n+
    iterator end()
    Get an iterator pointing to the end of the list.
    Definition: sllist.hh:774
    \n+
    SLListConstIterator< RemoteIndex, Allocator > const_iterator
    The constant iterator of the list.
    Definition: sllist.hh:74
    \n+
    SLListModifyIterator< GlobalIndex, Allocator > ModifyIterator
    The type of the iterator capable of deletion and insertion.
    Definition: sllist.hh:103
    \n+
    iterator begin()
    Get an iterator pointing to the first element in the list.
    Definition: sllist.hh:762
    \n+
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition: bigunsignedint.hh:278
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    iterator begin()
    Get an iterator over the indices positioned at the first index.
    \n+
    iterator end()
    Get an iterator over the indices positioned after the last index.
    \n+
    TL LocalIndex
    The type of the local index, e.g. ParallelLocalIndex.
    Definition: indexset.hh:239
    \n+
    const GlobalIndex & global() const
    Get the global index.
    \n+
    LocalIndex & local()
    Get the local index.
    \n+
    TG GlobalIndex
    the type of the global index. This type has to provide at least a operator< for sorting.
    Definition: indexset.hh:226
    \n+
    @ GROUND
    The default mode. Indicates that the index set is ready to be used.
    Definition: indexset.hh:186
    \n+
    DVVerbType dvverb(std::cout)
    stream for very verbose output.
    Definition: stdstreams.hh:95
    \n+
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    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
    \n-
    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
    \n-
    Functor for hashing objects of type T.
    Definition: hash.hh:40
    \n-
    std::size_t operator()(const T &t) const
    Calculates the hash of t.
    Definition: hash.hh:43
    \n+
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition: mpitraits.hh:41
    \n+
    static MPI_Datatype getType()
    Definition: mpitraits.hh:48
    \n+
    Default exception class for range errors.
    Definition: exceptions.hh:254
    \n+
    A pair consisting of a global and local index.
    Definition: indexset.hh:85
    \n+
    Exception indicating that the index set is not in the expected state.
    Definition: indexset.hh:205
    \n+
    Manager class for the mapping between local indices and globally unique indices.
    Definition: indexset.hh:218
    \n+
    Class for recomputing missing indices of a distributed index set.
    Definition: indicessyncer.hh:41
    \n+
    Base class of all classes representing a communication interface.
    Definition: parallel/interface.hh:35
    \n+
    An index present on the local process with an additional attribute flag.
    Definition: plocalindex.hh:49
    \n+
    The indices present on remote processes.
    Definition: remoteindices.hh:189
    \n+
    const std::set< int > & getNeighbours() const
    Definition: remoteindices.hh:307
    \n+
    Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex
    Type of the remote indices we manage.
    Definition: remoteindices.hh:231
    \n+
    RemoteIndices()
    Definition: remoteindices.hh:977
    \n+
    friend void fillIndexSetHoles(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
    \n+
    void setIndexSets(const ParallelIndexSet &source, const ParallelIndexSet &destination, const MPI_Comm &comm, const std::vector< int > &neighbours=std::vector< int >())
    Set the index sets and communicator we work with.
    Definition: remoteindices.hh:984
    \n+
    void free()
    Free the index lists.
    Definition: remoteindices.hh:1429
    \n+
    friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T1::GlobalIndex, typename T1::LocalIndex::Attribute >, A2 > > &, RemoteIndices< T1, A1 > &, const T1 &)
    \n+
    ParallelIndexSet::GlobalIndex GlobalIndex
    The type of the global index.
    Definition: remoteindices.hh:215
    \n+
    void rebuild()
    Rebuilds the set of remote indices.
    Definition: remoteindices.hh:1453
    \n+
    T ParallelIndexSet
    Type of the index set we use, e.g. ParallelLocalIndexSet.
    Definition: remoteindices.hh:206
    \n+
    MPI_Comm communicator() const
    Get the mpi communicator used.
    Definition: remoteindices.hh:1696
    \n+
    LocalIndex::Attribute Attribute
    The type of the attribute.
    Definition: remoteindices.hh:226
    \n+
    CollectiveIteratorT iterator() const
    Get an iterator for colletively iterating over the remote indices of all remote processes.
    Definition: remoteindices.hh:1690
    \n+
    void setIncludeSelf(bool includeSelf)
    Tell whether sending from indices of the processor to other indices on the same processor is enabled ...
    Definition: remoteindices.hh:971
    \n+
    const_iterator end() const
    Get an iterator over all remote index lists.
    Definition: remoteindices.hh:1529
    \n+
    bool operator==(const RemoteIndices &ri) const
    Definition: remoteindices.hh:1536
    \n+
    std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > RemoteIndexMap
    The type of the map from rank to remote index list.
    Definition: remoteindices.hh:245
    \n+
    void setNeighbours(const C &neighbours)
    Definition: remoteindices.hh:300
    \n+
    RemoteIndexListModifier< T, A, mode > getModifier(int process)
    Get a modifier for a remote index list.
    Definition: remoteindices.hh:1480
    \n+
    const ParallelIndexSet & sourceIndexSet() const
    Get the index set at the source.
    Definition: remoteindices.hh:999
    \n+
    ~RemoteIndices()
    Destructor.
    Definition: remoteindices.hh:1014
    \n+
    Dune::SLList< RemoteIndex, Allocator > RemoteIndexList
    The type of the remote index list.
    Definition: remoteindices.hh:241
    \n+
    int neighbours() const
    Get the number of processors we share indices with.
    Definition: remoteindices.hh:1446
    \n+
    CollectiveIterator< T, A > CollectiveIteratorT
    The type of the collective iterator over all remote indices.
    Definition: remoteindices.hh:210
    \n+
    const ParallelIndexSet & destinationIndexSet() const
    Get the index set at destination.
    Definition: remoteindices.hh:1007
    \n+
    typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > Allocator
    The type of the allocator for the remote index list.
    Definition: remoteindices.hh:237
    \n+
    const_iterator find(int proc) const
    Find an iterator over the remote index lists of a specific process.
    Definition: remoteindices.hh:1515
    \n+
    bool isSynced() const
    Checks whether the remote indices are synced with the indexsets.
    Definition: remoteindices.hh:1473
    \n+
    const_iterator begin() const
    Get an iterator over all remote index lists.
    Definition: remoteindices.hh:1522
    \n+
    ParallelIndexSet::LocalIndex LocalIndex
    The type of the local index.
    Definition: remoteindices.hh:221
    \n+
    RemoteIndexMap::const_iterator const_iterator
    Definition: remoteindices.hh:247
    \n+
    Information about an index residing on another processor.
    Definition: remoteindices.hh:73
    \n+
    const Attribute attribute() const
    Get the attribute of the index on the remote process.
    Definition: remoteindices.hh:946
    \n+
    friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &, RemoteIndices< T, A1 > &, const T &)
    \n+
    bool operator==(const RemoteIndex &ri) const
    Definition: remoteindices.hh:934
    \n+
    T1 GlobalIndex
    the type of the global index. This type has to provide at least a operator< for sorting.
    Definition: remoteindices.hh:90
    \n+
    T2 Attribute
    The type of the attributes. Normally this will be an enumeration like.
    Definition: remoteindices.hh:99
    \n+
    IndexPair< GlobalIndex, ParallelLocalIndex< Attribute > > PairType
    The type of the index pair.
    Definition: remoteindices.hh:105
    \n+
    const PairType & localIndexPair() const
    Get the corresponding local index pair.
    Definition: remoteindices.hh:952
    \n+
    RemoteIndex()
    Parameterless Constructor.
    Definition: remoteindices.hh:930
    \n+
    bool operator!=(const RemoteIndex &ri) const
    Definition: remoteindices.hh:940
    \n+
    Modifier for adding and/or deleting remote indices from the remote index list.
    Definition: remoteindices.hh:551
    \n+
    void repairLocalIndexPointers()
    Repair the pointers to the local index pairs.
    Definition: remoteindices.hh:1575
    \n+
    Dune::SLList< RemoteIndex, Allocator > RemoteIndexList
    The type of the remote index list.
    Definition: remoteindices.hh:602
    \n+
    A Allocator
    The type of the allocator for the remote index list.
    Definition: remoteindices.hh:598
    \n+
    void insert(const RemoteIndex &index)
    Insert an index to the list.
    Definition: remoteindices.hh:1605
    \n+
    ParallelIndexSet::GlobalIndex GlobalIndex
    The type of the global index.
    Definition: remoteindices.hh:578
    \n+
    ParallelIndexSet::LocalIndex LocalIndex
    The type of the local index.
    Definition: remoteindices.hh:583
    \n+
    RemoteIndexList::const_iterator ConstIterator
    The type of the remote index list iterator.
    Definition: remoteindices.hh:612
    \n+
    SLListModifyIterator< RemoteIndex, Allocator > ModifyIterator
    The type of the modifying iterator of the remote index list.
    Definition: remoteindices.hh:607
    \n+
    bool remove(const GlobalIndex &global)
    Remove a remote index.
    Definition: remoteindices.hh:1653
    \n+
    T ParallelIndexSet
    Type of the index set we use.
    Definition: remoteindices.hh:573
    \n+
    RemoteIndexListModifier()
    Default constructor.
    Definition: remoteindices.hh:676
    \n+
    LocalIndex::Attribute Attribute
    The type of the attribute.
    Definition: remoteindices.hh:588
    \n+
    Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex
    Type of the remote indices we manage.
    Definition: remoteindices.hh:593
    \n+
    static constexpr bool MODIFYINDEXSET
    If true the index set corresponding to the remote indices might get modified.
    Definition: remoteindices.hh:568
    \n+
    A collective iterator for moving over the remote indices for all processes collectively.
    Definition: remoteindices.hh:708
    \n+
    CollectiveIterator & operator++()
    Definition: remoteindices.hh:1779
    \n+
    iterator end()
    Definition: remoteindices.hh:1822
    \n+
    CollectiveIterator(const RemoteIndexMap &map_, bool send)
    Constructor.
    Definition: remoteindices.hh:1703
    \n+
    bool empty() const
    Checks whether there are still iterators in the map.
    Definition: remoteindices.hh:1804
    \n+
    void advance(const GlobalIndex &global)
    Advances all underlying iterators.
    Definition: remoteindices.hh:1716
    \n+
    std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > > RemoteIndexMap
    The type of the map from rank to remote index list.
    Definition: remoteindices.hh:748
    \n+
    iterator begin()
    Definition: remoteindices.hh:1811
    \n+
    Definition: remoteindices.hh:167
    \n+
    Definition: remoteindices.hh:558
    \n+
    Iterator over the valid underlying iterators.
    Definition: remoteindices.hh:792
    \n+
    iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex &index)
    Definition: remoteindices.hh:799
    \n+
    iterator(const iterator &other)
    Definition: remoteindices.hh:817
    \n+
    const RemoteIndex & operator*() const
    Definition: remoteindices.hh:838
    \n+
    Map::iterator ConstRealIterator
    Definition: remoteindices.hh:795
    \n+
    iterator & operator++()
    Definition: remoteindices.hh:822
    \n+
    const RemoteIndex * operator->() const
    Definition: remoteindices.hh:850
    \n+
    bool operator==(const iterator &other) const
    Definition: remoteindices.hh:856
    \n+
    int process() const
    Definition: remoteindices.hh:844
    \n+
    iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex index, Attribute attribute)
    Definition: remoteindices.hh:807
    \n+
    bool operator!=(const iterator &other) const
    Definition: remoteindices.hh:862
    \n+
    Map::iterator RealIterator
    Definition: remoteindices.hh:794
    \n+
    A constant iterator for the SLList.
    Definition: sllist.hh:371
    \n+\n+
    A single linked list.
    Definition: sllist.hh:44
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,332 +4,1930 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-hash.hh\n+ * parallel\n+remoteindices.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_HASH_HH\n- 6#define DUNE_COMMON_HASH_HH\n+ 5#ifndef DUNE_REMOTEINDICES_HH\n+ 6#define DUNE_REMOTEINDICES_HH\n 7\n- 8#include \n+ 8#if HAVE_MPI\n 9\n- 10#include \n- 11\n- 24/\n-/\n-********************************************************************************\n- 25// Doxygen documentation\n- 26/\n-/\n-********************************************************************************\n+ 10#include \n+ 11#include \n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16#include \n+ 17#include \n+ 18\n+ 19#include \n+ 20\n+ 21#include \n+ 22#include \n+ 23#include \n+ 24#include \n+ 25#include \n+ 26#include \n 27\n- 28#ifdef DOXYGEN\n- 29\n- 30namespace Dune {\n- 31\n- 33\n- 38 template\n-39 struct hash\n- 40 {\n- 41\n-43 std::size_t operator()(const T& t) const\n- 44 {\n- 45 return hash(t);\n- 46 }\n- 47\n- 48 };\n+ 28namespace Dune {\n+ 40 template\n+41 class MPITraits > >\n+ 42 {\n+ 43 public:\n+ 44 inline static MPI_Datatype getType();\n+ 45 private:\n+ 46 static MPI_Datatype type;\n+ 47 };\n+ 48\n 49\n- 50}\n- 51\n- 53\n-100#define DUNE_DEFINE_HASH(template_args,type)\n- 101\n- 102\n- 104\n-109#define DUNE_HASH_TEMPLATE_ARGS(...)\n- 110\n+ 50 template\n+ 51 class RemoteIndices;\n+ 52\n+ 53 template\n+ 54 class RemoteIndex;\n+ 55\n+ 56 // forward declaration needed for friend declaration.\n+ 57 template\n+ 58 class IndicesSyncer;\n+ 59\n+ 60 template\n+61 std::ostream& operator<<(std::ostream& os, const RemoteIndex& index);\n+ 62\n+ 63\n+ 64 template\n+ 65 class RemoteIndexListModifier;\n+ 66\n+ 67\n+ 71 template\n+72 class RemoteIndex\n+ 73 {\n+ 74 template\n+75 friend class IndicesSyncer;\n+ 76\n+ 77 template\n+78 friend void repairLocalIndexPointers(std::map,A> >&,\n+ 79 RemoteIndices&,\n+ 80 const T&);\n+ 81\n+ 82 template\n+83 friend class RemoteIndexListModifier;\n+ 84\n+ 85 public:\n+90 typedef T1 GlobalIndex;\n+99 typedef T2 Attribute;\n+ 100\n+ 104 typedef IndexPair >\n+105 PairType;\n+ 106\n+ 111 const Attribute attribute() const;\n 112\n-117#define DUNE_HASH_TYPE(...)\n- 118\n- 119#else // DOXYGEN - hide all the ugly implementation\n- 120\n- 121\n- 122\n- 123/\n-/\n-********************************************************************************\n- 124// C++11 support\n- 125/\n-/\n-********************************************************************************\n- 126\n- 127// import std::hash into Dune namespace\n- 128namespace Dune {\n- 129\n- 130 using std::hash;\n- 131\n- 132}\n+ 118 const PairType& localIndexPair() const;\n+ 119\n+ 123 RemoteIndex();\n+ 124\n+ 125\n+ 131 RemoteIndex(const T2& attribute,\n+ 132 const PairType* local);\n 133\n- 134// Macro for defining a std::hash specialization for type.\n- 135// This should not be called directly. Call DUNE_DEFINE_HASH\n- 136// instead.\n- 137#define DUNE_DEFINE_STD_HASH(template_args,type) \\\n- 138 namespace std { \\\n- 139 \\\n- 140 template \\\n- 141 struct hash \\\n- 142 { \\\n- 143 \\\n- 144 typedef type argument_type; \\\n- 145 typedef std::size_t result_type; \\\n- 146 \\\n- 147 std::size_t operator()(const type& arg) const \\\n- 148 { \\\n- 149 return hash_value(arg); \\\n- 150 } \\\n- 151 }; \\\n- 152 \\\n- 153 template \\\n- 154 struct hash \\\n- 155 { \\\n- 156 \\\n- 157 typedef type argument_type; \\\n- 158 typedef std::size_t result_type; \\\n- 159 \\\n- 160 std::size_t operator()(const type& arg) const \\\n- 161 { \\\n- 162 return hash_value(arg); \\\n- 163 } \\\n- 164 }; \\\n- 165 \\\n- 166 } \\\n- 167\n- 168// Wrapper macro for template arguments.\n- 169// This is required because the template arguments can contain commas,\n- 170// which will create a macro argument list of unknown length. That in\n-itself\n- 171// would not be a problem, but DUNE_DEFINE_HASH has to be called with two\n-argument\n- 172// lists of unknown length. So this macro wraps its arguments with\n-parentheses,\n- 173// turning it into a single argument. The result is used as the parameter\n-list of\n- 174// an expansion macro in the calls to the implementation-specific macros\n- 175// for C++11 and TR1. Noto that technically, this trick is only legal for\n-C++11,\n- 176// but pretty much every compiler supports variadic macros in C++03 mode,\n-as they\n- 177// are part of C99.\n- 178#define DUNE_HASH_TEMPLATE_ARGS(...) (__VA_ARGS__)\n- 179\n- 180// Wrapper macro for type to be hashed.\n- 181// See above for rationale.\n- 182#define DUNE_HASH_TYPE(...) (__VA_ARGS__)\n- 183\n- 184// Expansion macro for the parenthesized argument lists created by\n- 185// DUNE_HASH_TEMPLATE_ARGS and DUNE_HASH_TYPE.\n- 186#define DUNE_HASH_EXPAND_VA_ARGS(...) __VA_ARGS__\n- 187\n- 188// Define specializations for all discovered hash implementations.\n- 189#define DUNE_DEFINE_HASH(template_args,type) \\\n- 190 DUNE_DEFINE_STD_HASH(DUNE_HASH_EXPAND_VA_ARGS template_args,\n-DUNE_HASH_EXPAND_VA_ARGS type) \\\n- 191\n- 192\n- 193#endif // DOXYGEN\n- 194\n- 195\n+ 134\n+ 140 RemoteIndex(const T2& attribute);\n+ 141\n+ 142 bool operator==(const RemoteIndex& ri) const;\n+ 143\n+ 144 bool operator!=(const RemoteIndex& ri) const;\n+ 145 private:\n+ 147 const PairType* localIndex_;\n+ 148\n+ 150 char attribute_;\n+ 151 };\n+ 152\n+ 153 template\n+ 154 std::ostream& operator<<(std::ostream& os, const RemoteIndices&\n+indices);\n+ 155\n+ 156 class InterfaceBuilder;\n+ 157\n+ 158 template\n+ 159 class CollectiveIterator;\n+ 160\n+ 161 // forward declaration needed for friend declaration.\n+ 162 template\n+ 163 class IndicesSyncer;\n+ 164\n+ 165 // forward declaration needed for friend declaration.\n+ 166 template\n+167 class OwnerOverlapCopyCommunication;\n+ 168\n+ 169\n+ 186 template > >\n+188 class RemoteIndices\n+ 189 {\n+190 friend class InterfaceBuilder;\n+ 191 friend class IndicesSyncer;\n+ 192 template\n+193 friend void repairLocalIndexPointers(std::map,A2> >&,\n+ 194 RemoteIndices&,\n+ 195 const T1&);\n 196\n- 197/\n-/\n-********************************************************************************\n- 198// Some utility functions for combining hashes of member variables.\n- 199/\n-/\n-********************************************************************************\n+ 197 template\n+198 friend void fillIndexSetHoles(const G& graph, Dune::\n+OwnerOverlapCopyCommunication& oocomm);\n+199 friend std::ostream& operator<<<>(std::ostream&, const RemoteIndices&);\n 200\n- 201namespace Dune {\n+ 201 public:\n 202\n- 203 // The following functions are an implementation of the proposed hash\n-extensions for\n- 204 // the C++ standard by Peter Dimov\n- 205 // (cf. http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf,\n-issue 6.18).\n- 206 // They are also contained in the boost::functional::hash library by\n-Daniel James, but\n- 207 // that implementation uses boost::hash internally, while we want to use\n-Dune::hash. They\n- 208 // are also considered for inclusion in TR2 (then based on std::hash, of\n-course).\n- 209\n- 210#ifndef DOXYGEN\n+206 typedef T ParallelIndexSet;\n+ 207\n+210 typedef CollectiveIterator CollectiveIteratorT;\n 211\n- 212 // helper struct for providing different hash combining algorithms\n-dependent on\n- 213 // the size of size_t.\n- 214 // hash_combiner has to be specialized for the size (in bytes) of std::\n-size_t.\n- 215 // Specialized versions should provide a method\n- 216 //\n- 217 // template \n- 218 // void operator()(typeof_size_t& seed, const T& arg) const;\n- 219 //\n- 220 // that will be called by the interface function hash_combine() described\n-further below.\n- 221 // The redundant template parameter typeof_size_t is needed to avoid\n-warnings for the\n- 222 // unused 64-bit specialization on 32-bit systems.\n- 223 //\n- 224 // There is no default implementation!\n- 225 template\n- 226 struct hash_combiner;\n+215 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;\n+ 216\n+ 217\n+221 typedef typename ParallelIndexSet::LocalIndex LocalIndex;\n+ 222\n+226 typedef typename LocalIndex::Attribute Attribute;\n 227\n- 228\n- 229 // hash combining for 64-bit platforms.\n- 230 template<>\n- 231 struct hash_combiner<8>\n- 232 {\n+231 typedef Dune::RemoteIndex RemoteIndex;\n+ 232\n 233\n- 234 template\n- 235 void operator()(typeof_size_t& seed, const T& arg) const\n- 236 {\n- 237 static_assert(sizeof(typeof_size_t)==8, \"hash_combiner::operator()\n-instantiated with nonmatching type and size\");\n+237 using Allocator = typename std::allocator_traits::template\n+rebind_alloc;\n 238\n- 239 // The following algorithm for combining two 64-bit hash values is\n-inspired by a similar\n- 240 // function in CityHash (http://cityhash.googlecode.com/svn-history/r2/\n-trunk/src/city.h),\n- 241 // which is in turn based on ideas from the MurmurHash library. The basic\n-idea is easy to\n- 242 // grasp, though: New information is XORed into the existing hash multiple\n-times at different\n- 243 // places (using shift operations), and the resulting pattern is spread\n-over the complete\n- 244 // range of available bits via multiplication with a \"magic\" constant. The\n-constants used\n- 245 // below (47 and 0x9ddfea08eb382d69ULL) are taken from the CityHash\n-implementation.\n- 246 //\n- 247 // We opted not to use the mixing algorithm proposed in the C++ working\n-group defect list at\n- 248 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf, p.\n-57f. because it\n- 249 // has very bad hash distribution properties if you apply it to lists of\n-very small numbers,\n- 250 // an application that is frequent in PDELab's ordering framework.\n- 251\n- 252 Dune::hash hasher;\n- 253 const typeof_size_t kMul = 0x9ddfea08eb382d69ULL;\n- 254 typeof_size_t h = hasher(arg);\n- 255 typeof_size_t a = (seed ^ h) * kMul;\n- 256 a ^= (a >> 47);\n- 257 typeof_size_t b = (h ^ a) * kMul;\n- 258 b ^= (b >> 47);\n- 259 b *= kMul;\n- 260 seed = b;\n- 261 }\n- 262\n- 263 };\n- 264\n- 265\n- 266 // hash combining for 32-bit platforms.\n- 267 template<>\n- 268 struct hash_combiner<4>\n- 269 {\n+ 240 typedef Dune::SLList\n+241 RemoteIndexList;\n+ 242\n+ 244 typedef std::map >\n+245 RemoteIndexMap;\n+ 246\n+247 typedef typename RemoteIndexMap::const_iterator const_iterator;\n+ 248\n+ 266 inline RemoteIndices(const ParallelIndexSet& source, const\n+ParallelIndexSet& destination,\n+ 267 const MPI_Comm& comm, const std::vector& neighbours=std::vector\n+(), bool includeSelf=false);\n+ 268\n+ 269 RemoteIndices();\n 270\n- 271 template\n- 272 void operator()(typeof_size_t& seed, const T& arg) const\n- 273 {\n- 274 static_assert(sizeof(typeof_size_t)==4, \"hash_combiner::operator()\n-instantiated with nonmatching type and size\");\n- 275\n- 276 // The default algorithm above requires a 64-bit std::size_t. The\n-following algorithm is a\n- 277 // 32-bit compatible fallback, again inspired by CityHash and MurmurHash\n- 278 // (http://cityhash.googlecode.com/svn-history/r2/trunk/src/city.cc).\n- 279 // It uses 32-bit constants and relies on rotation instead of\n-multiplication to spread the\n- 280 // mixed bits as that is apparently more efficient on IA-32. The constants\n-used below are again\n- 281 // taken from CityHash, in particular from the file referenced above.\n- 282\n- 283 Dune::hash hasher;\n- 284 const typeof_size_t c1 = 0xcc9e2d51;\n- 285 const typeof_size_t c2 = 0x1b873593;\n- 286 const typeof_size_t c3 = 0xe6546b64;\n- 287 typeof_size_t h = hasher(arg);\n- 288 typeof_size_t a = seed * c1;\n- 289 a = (a >> 17) | (a << (32 - 17));\n- 290 a *= c2;\n- 291 h ^= a;\n- 292 h = (h >> 19) | (h << (32 - 19));\n- 293 seed = h * 5 + c3;\n- 294 }\n- 295\n- 296 };\n- 297\n- 298#endif // DOXYGEN\n- 299\n- 301\n- 306 template\n-307 inline void hash_combine(std::size_t& seed, const T& arg)\n+ 278 void setIncludeSelf(bool includeSelf);\n+ 279\n+ 296 void setIndexSets(const ParallelIndexSet& source, const ParallelIndexSet&\n+destination,\n+ 297 const MPI_Comm& comm, const std::vector& neighbours=std::vector\n+());\n+ 298\n+ 299 template\n+300 void setNeighbours(const C& neighbours)\n+ 301 {\n+ 302 neighbourIds.clear();\n+ 303 neighbourIds.insert(neighbours.begin(), neighbours.end());\n+ 304\n+ 305 }\n+ 306\n+307 const std::set& getNeighbours() const\n 308 {\n- 309 hash_combiner()(seed,arg);\n+ 309 return neighbourIds;\n 310 }\n 311\n- 313\n- 321 template\n-322 inline std::size_t hash_range(It first, It last)\n- 323 {\n- 324 std::size_t seed = 0;\n- 325 for (; first != last; ++first)\n- 326 {\n- 327 hash_combine(seed,*first);\n- 328 }\n- 329 return seed;\n- 330 }\n- 331\n- 333\n- 340 template\n-341 inline void hash_range(std::size_t& seed, It first, It last)\n- 342 {\n- 343 for (; first != last; ++first)\n- 344 {\n- 345 hash_combine(seed,*first);\n- 346 }\n- 347 }\n- 348\n- 349} // end namespace Dune\n- 350\n- 351#endif // DUNE_COMMON_HASH_HH\n-typetraits.hh\n-Traits for type conversions and type information.\n+ 315 ~RemoteIndices();\n+ 316\n+ 326 template\n+ 327 void rebuild();\n+ 328\n+ 329 bool operator==(const RemoteIndices& ri) const;\n+ 330\n+ 338 inline bool isSynced() const;\n+ 339\n+ 343 inline MPI_Comm communicator() const;\n+ 344\n+ 359 template\n+ 360 inline RemoteIndexListModifier getModifier(int process);\n+ 361\n+ 368 inline const_iterator find(int proc) const;\n+ 369\n+ 374 inline const_iterator begin() const;\n+ 375\n+ 380 inline const_iterator end() const;\n+ 381\n+ 385 template\n+ 386 inline CollectiveIteratorT iterator() const;\n+ 387\n+ 391 inline void free();\n+ 392\n+ 397 inline int neighbours() const;\n+ 398\n+ 400 inline const ParallelIndexSet& sourceIndexSet() const;\n+ 401\n+ 403 inline const ParallelIndexSet& destinationIndexSet() const;\n+ 404\n+ 405 private:\n+ 407 RemoteIndices(const RemoteIndices&) = delete;\n+ 408\n+ 410 const ParallelIndexSet* source_;\n+ 411\n+ 413 const ParallelIndexSet* target_;\n+ 414\n+ 416 MPI_Comm comm_;\n+ 417\n+ 420 std::set neighbourIds;\n+ 421\n+ 423 const static int commTag_=333;\n+ 424\n+ 429 int sourceSeqNo_;\n+ 430\n+ 435 int destSeqNo_;\n+ 436\n+ 440 bool publicIgnored;\n+ 441\n+ 445 bool firstBuild;\n+ 446\n+ 447 /*\n+ 448 * @brief If true, sending from indices of the processor to other\n+ 449 * indices on the same processor is enabled even if the same indexset is\n+used\n+ 450 * on both the\n+ 451 * sending and receiving side.\n+ 452 */\n+ 453 bool includeSelf;\n+ 454\n+ 456 typedef IndexPair\n+ 457 PairType;\n+ 458\n+ 465 RemoteIndexMap remoteIndices_;\n+ 466\n+ 477 template\n+ 478 inline void buildRemote(bool includeSelf);\n+ 479\n+ 485 inline int noPublic(const ParallelIndexSet& indexSet);\n+ 486\n+ 498 template\n+ 499 inline void packEntries(PairType** myPairs, const ParallelIndexSet&\n+indexSet,\n+ 500 char* p_out, MPI_Datatype type, int bufferSize,\n+ 501 int* position, int n);\n+ 502\n+ 516 inline void unpackIndices(RemoteIndexList& remote, int remoteEntries,\n+ 517 PairType** local, int localEntries, char* p_in,\n+ 518 MPI_Datatype type, int* position, int bufferSize,\n+ 519 bool fromOurself);\n+ 520\n+ 521 inline void unpackIndices(RemoteIndexList& send, RemoteIndexList& receive,\n+ 522 int remoteEntries, PairType** localSource,\n+ 523 int localSourceEntries, PairType** localDest,\n+ 524 int localDestEntries, char* p_in,\n+ 525 MPI_Datatype type, int* position, int bufferSize);\n+ 526\n+ 527 void unpackCreateRemote(char* p_in, PairType** sourcePairs, PairType**\n+DestPairs,\n+ 528 int remoteProc, int sourcePublish, int destPublish,\n+ 529 int bufferSize, bool sendTwo, bool fromOurSelf=false);\n+ 530 };\n+ 531\n+ 549 template\n+550 class RemoteIndexListModifier\n+ 551 {\n+ 552\n+ 553 template\n+554 friend class RemoteIndices;\n+ 555\n+ 556 public:\n+557 class InvalidPosition : public RangeError\n+ 558 {};\n+ 559\n+568 constexpr static bool MODIFYINDEXSET = mode;\n+ 569\n+573 typedef T ParallelIndexSet;\n+ 574\n+578 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;\n+ 579\n+583 typedef typename ParallelIndexSet::LocalIndex LocalIndex;\n+ 584\n+588 typedef typename LocalIndex::Attribute Attribute;\n+ 589\n+593 typedef Dune::RemoteIndex RemoteIndex;\n+ 594\n+598 typedef A Allocator;\n+ 599\n+ 601 typedef Dune::SLList\n+602 RemoteIndexList;\n+ 603\n+607 typedef SLListModifyIterator ModifyIterator;\n+ 608\n+612 typedef typename RemoteIndexList::const_iterator ConstIterator;\n+ 613\n+ 627 void insert(const RemoteIndex& index);\n+ 628\n+ 629\n+ 644 void insert(const RemoteIndex& index, const GlobalIndex& global);\n+ 645\n+ 653 bool remove(const GlobalIndex& global);\n+ 654\n+ 667 void repairLocalIndexPointers();\n+ 668\n+ 669\n+ 670 RemoteIndexListModifier(const RemoteIndexListModifier&);\n+ 671\n+676 RemoteIndexListModifier()\n+ 677 : glist_()\n+ 678 {}\n+ 679\n+ 680 private:\n+ 681\n+ 687 RemoteIndexListModifier(const ParallelIndexSet& indexSet,\n+ 688 RemoteIndexList& rList);\n+ 689\n+ 690 typedef SLList GlobalList;\n+ 691 typedef typename GlobalList::ModifyIterator GlobalModifyIterator;\n+ 692 RemoteIndexList* rList_;\n+ 693 const ParallelIndexSet* indexSet_;\n+ 694 GlobalList glist_;\n+ 695 ModifyIterator iter_;\n+ 696 GlobalModifyIterator giter_;\n+ 697 ConstIterator end_;\n+ 698 bool first_;\n+ 699 GlobalIndex last_;\n+ 700 };\n+ 701\n+ 706 template\n+707 class CollectiveIterator\n+ 708 {\n+ 709\n+ 713 typedef T ParallelIndexSet;\n+ 714\n+ 718 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;\n+ 719\n+ 723 typedef typename ParallelIndexSet::LocalIndex LocalIndex;\n+ 724\n+ 728 typedef typename LocalIndex::Attribute Attribute;\n+ 729\n+ 731 typedef Dune::RemoteIndex RemoteIndex;\n+ 732\n+ 734 using Allocator = typename std::allocator_traits::template\n+rebind_alloc;\n+ 735\n+ 737 typedef Dune::SLList RemoteIndexList;\n+ 738\n+ 740 typedef std::map >\n+ 742 Map;\n+ 743\n+ 744 public:\n+ 745\n+ 747 typedef std::map >\n+748 RemoteIndexMap;\n+ 749\n+ 755 inline CollectiveIterator(const RemoteIndexMap& map_, bool send);\n+ 756\n+ 765 inline void advance(const GlobalIndex& global);\n+ 766\n+ 776 inline void advance(const GlobalIndex& global, const Attribute&\n+attribute);\n+ 777\n+ 778 CollectiveIterator& operator++();\n+ 779\n+ 783 inline bool empty() const;\n+ 784\n+791 class iterator\n+ 792 {\n+ 793 public:\n+794 typedef typename Map::iterator RealIterator;\n+795 typedef typename Map::iterator ConstRealIterator;\n+ 796\n+ 797\n+799 iterator(const RealIterator& iter, const ConstRealIterator& end,\n+GlobalIndex& index)\n+ 800 : iter_(iter), end_(end), index_(index), hasAttribute(false)\n+ 801 {\n+ 802 // Move to the first valid entry\n+ 803 while(iter_!=end_ && iter_->second.first->localIndexPair().global\n+()!=index_)\n+ 804 ++iter_;\n+ 805 }\n+ 806\n+807 iterator(const RealIterator& iter, const ConstRealIterator& end,\n+GlobalIndex index,\n+ 808 Attribute attribute)\n+ 809 : iter_(iter), end_(end), index_(index), attribute_(attribute),\n+hasAttribute(true)\n+ 810 {\n+ 811 // Move to the first valid entry or the end\n+ 812 while(iter_!=end_ && (iter_->second.first->localIndexPair().global\n+()!=index_\n+ 813 || iter_->second.first->localIndexPair().local().attribute()!=attribute))\n+ 814 ++iter_;\n+ 815 }\n+817 iterator(const iterator& other)\n+ 818 : iter_(other.iter_), end_(other.end_), index_(other.index_)\n+ 819 { }\n+ 820\n+822 iterator& operator++()\n+ 823 {\n+ 824 ++iter_;\n+ 825 // If entry is not valid move on\n+ 826 while(iter_!=end_ && (iter_->second.first->localIndexPair().global\n+()!=index_ ||\n+ 827 (hasAttribute &&\n+ 828 iter_->second.first->localIndexPair().local().attribute()!=attribute_)))\n+ 829 ++iter_;\n+ 830 assert(iter_==end_ ||\n+ 831 (iter_->second.first->localIndexPair().global()==index_));\n+ 832 assert(iter_==end_ || !hasAttribute ||\n+ 833 (iter_->second.first->localIndexPair().local().attribute()==attribute_));\n+ 834 return *this;\n+ 835 }\n+ 836\n+838 const RemoteIndex& operator*() const\n+ 839 {\n+ 840 return *(iter_->second.first);\n+ 841 }\n+ 842\n+844 int process() const\n+ 845 {\n+ 846 return iter_->first;\n+ 847 }\n+ 848\n+850 const RemoteIndex* operator->() const\n+ 851 {\n+ 852 return iter_->second.first.operator->();\n+ 853 }\n+ 854\n+856 bool operator==(const iterator& other) const\n+ 857 {\n+ 858 return other.iter_==iter_;\n+ 859 }\n+ 860\n+862 bool operator!=(const iterator& other) const\n+ 863 {\n+ 864 return other.iter_!=iter_;\n+ 865 }\n+ 866\n+ 867 private:\n+ 868 iterator();\n+ 869\n+ 870 RealIterator iter_;\n+ 871 RealIterator end_;\n+ 872 GlobalIndex index_;\n+ 873 Attribute attribute_;\n+ 874 bool hasAttribute;\n+ 875 };\n+ 876\n+ 877 iterator begin();\n+ 878\n+ 879 iterator end();\n+ 880\n+ 881 private:\n+ 882\n+ 883 Map map_;\n+ 884 GlobalIndex index_;\n+ 885 Attribute attribute_;\n+ 886 bool noattribute;\n+ 887 };\n+ 888\n+ 889 template\n+890 MPI_Datatype MPITraits > >::getType()\n+ 891 {\n+ 892 if(type==MPI_DATATYPE_NULL) {\n+ 893 int length[2] = {1, 1};\n+ 894 MPI_Aint base;\n+ 895 MPI_Aint disp[2];\n+ 896 MPI_Datatype types[2] = {MPITraits::getType(),\n+ 897 MPITraits >::getType()};\n+ 898 IndexPair > rep;\n+ 899 MPI_Get_address(&rep, &base); // lower bound of the datatype\n+ 900 MPI_Get_address(&(rep.global_), &disp[0]);\n+ 901 MPI_Get_address(&(rep.local_), &disp[1]);\n+ 902 for (MPI_Aint& d : disp)\n+ 903 d -= base;\n+ 904\n+ 905 MPI_Datatype tmp;\n+ 906 MPI_Type_create_struct(2, length, disp, types, &tmp);\n+ 907\n+ 908 MPI_Type_create_resized(tmp, 0, sizeof(IndexPair\n+>), &type);\n+ 909 MPI_Type_commit(&type);\n+ 910\n+ 911 MPI_Type_free(&tmp);\n+ 912 }\n+ 913 return type;\n+ 914 }\n+ 915\n+ 916 template\n+ 917 MPI_Datatype MPITraits > >::\n+type=MPI_DATATYPE_NULL;\n+ 918\n+ 919 template\n+920 RemoteIndex::RemoteIndex(const T2& attribute, const PairType* local)\n+ 921 : localIndex_(local), attribute_(static_cast>\n+(attribute))\n+ 922 {}\n+ 923\n+ 924 template\n+925 RemoteIndex::RemoteIndex(const T2& attribute)\n+ 926 : localIndex_(0), attribute_(static_cast>\n+(attribute))\n+ 927 {}\n+ 928\n+ 929 template\n+930 RemoteIndex::RemoteIndex()\n+ 931 : localIndex_(0), attribute_()\n+ 932 {}\n+ 933 template\n+934 inline bool RemoteIndex::operator==(const RemoteIndex& ri) const\n+ 935 {\n+ 936 return localIndex_==ri.localIndex_ && attribute_==ri.attribute;\n+ 937 }\n+ 938\n+ 939 template\n+940 inline bool RemoteIndex::operator!=(const RemoteIndex& ri) const\n+ 941 {\n+ 942 return localIndex_!=ri.localIndex_ || attribute_!=ri.attribute_;\n+ 943 }\n+ 944\n+ 945 template\n+946 inline const T2 RemoteIndex::attribute() const\n+ 947 {\n+ 948 return T2(attribute_);\n+ 949 }\n+ 950\n+ 951 template\n+952 inline const IndexPair >& RemoteIndex::\n+localIndexPair() const\n+ 953 {\n+ 954 return *localIndex_;\n+ 955 }\n+ 956\n+ 957 template\n+958 inline RemoteIndices::RemoteIndices(const ParallelIndexSet& source,\n+ 959 const ParallelIndexSet& destination,\n+ 960 const MPI_Comm& comm,\n+ 961 const std::vector& neighbours,\n+ 962 bool includeSelf_)\n+ 963 : source_(&source), target_(&destination), comm_(comm),\n+ 964 sourceSeqNo_(-1), destSeqNo_(-1), publicIgnored(false), firstBuild(true),\n+ 965 includeSelf(includeSelf_)\n+ 966 {\n+ 967 setNeighbours(neighbours);\n+ 968 }\n+ 969\n+ 970 template\n+971 void RemoteIndices::setIncludeSelf(bool b)\n+ 972 {\n+ 973 includeSelf=b;\n+ 974 }\n+ 975\n+ 976 template\n+977 RemoteIndices::RemoteIndices()\n+ 978 : source_(0), target_(0), sourceSeqNo_(-1),\n+ 979 destSeqNo_(-1), publicIgnored(false), firstBuild(true),\n+ 980 includeSelf(false)\n+ 981 {}\n+ 982\n+ 983 template\n+984 void RemoteIndices::setIndexSets(const ParallelIndexSet& source,\n+ 985 const ParallelIndexSet& destination,\n+ 986 const MPI_Comm& comm,\n+ 987 const std::vector& neighbours)\n+ 988 {\n+ 989 free();\n+ 990 source_ = &source;\n+ 991 target_ = &destination;\n+ 992 comm_ = comm;\n+ 993 firstBuild = true;\n+ 994 setNeighbours(neighbours);\n+ 995 }\n+ 996\n+ 997 template\n+ 998 const typename RemoteIndices::ParallelIndexSet&\n+999 RemoteIndices::sourceIndexSet() const\n+ 1000 {\n+ 1001 return *source_;\n+ 1002 }\n+ 1003\n+ 1004\n+ 1005 template\n+ 1006 const typename RemoteIndices::ParallelIndexSet&\n+1007 RemoteIndices::destinationIndexSet() const\n+ 1008 {\n+ 1009 return *target_;\n+ 1010 }\n+ 1011\n+ 1012\n+ 1013 template\n+1014 RemoteIndices::~RemoteIndices()\n+ 1015 {\n+ 1016 free();\n+ 1017 }\n+ 1018\n+ 1019 template\n+ 1020 template\n+1021 inline void RemoteIndices::packEntries\n+(IndexPair** pairs,\n+ 1022 const ParallelIndexSet& indexSet,\n+ 1023 char* p_out, MPI_Datatype type,\n+ 1024 int bufferSize,\n+ 1025 int *position,\n+ 1026 [[maybe_unused]] int n)\n+ 1027 {\n+ 1028 // fill with own indices\n+ 1029 const auto end = indexSet.end();\n+ 1030\n+ 1031 //Now pack the source indices\n+ 1032 int i=0;\n+ 1033 for(auto index = indexSet.begin(); index != end; ++index)\n+ 1034 if(ignorePublic || index->local().isPublic()) {\n+ 1035\n+ 1036 MPI_Pack(const_cast(&(*index)), 1,\n+ 1037 type,\n+ 1038 p_out, bufferSize, position, comm_);\n+ 1039 pairs[i++] = const_cast(&(*index));\n+ 1040\n+ 1041 }\n+ 1042 assert(i==n);\n+ 1043 }\n+ 1044\n+ 1045 template\n+ 1046 inline int RemoteIndices::noPublic(const ParallelIndexSet& indexSet)\n+ 1047 {\n+ 1048\n+ 1049 int noPublic=0;\n+ 1050\n+ 1051 const auto end=indexSet.end();\n+ 1052 for(auto index=indexSet.begin(); index!=end; ++index)\n+ 1053 if(index->local().isPublic())\n+ 1054 noPublic++;\n+ 1055\n+ 1056 return noPublic;\n+ 1057\n+ 1058 }\n+ 1059\n+ 1060\n+ 1061 template\n+ 1062 inline void RemoteIndices::unpackCreateRemote(char* p_in, PairType**\n+sourcePairs,\n+ 1063 PairType** destPairs, int remoteProc,\n+ 1064 int sourcePublish, int destPublish,\n+ 1065 int bufferSize, bool sendTwo,\n+ 1066 bool fromOurSelf)\n+ 1067 {\n+ 1068\n+ 1069 // unpack the number of indices we received\n+ 1070 int noRemoteSource=-1, noRemoteDest=-1;\n+ 1071 char twoIndexSets=0;\n+ 1072 int position=0;\n+ 1073 // Did we receive two index sets?\n+ 1074 MPI_Unpack(p_in, bufferSize, &position, &twoIndexSets, 1, MPI_CHAR,\n+comm_);\n+ 1075 // The number of source indices received\n+ 1076 MPI_Unpack(p_in, bufferSize, &position, &noRemoteSource, 1, MPI_INT,\n+comm_);\n+ 1077 // The number of destination indices received\n+ 1078 MPI_Unpack(p_in, bufferSize, &position, &noRemoteDest, 1, MPI_INT,\n+comm_);\n+ 1079\n+ 1080\n+ 1081 // Indices for which we receive\n+ 1082 RemoteIndexList* receive= new RemoteIndexList();\n+ 1083 // Indices for which we send\n+ 1084 RemoteIndexList* send=0;\n+ 1085\n+ 1086 MPI_Datatype type= MPITraits::getType();\n+ 1087\n+ 1088 if(!twoIndexSets) {\n+ 1089 if(sendTwo) {\n+ 1090 send = new RemoteIndexList();\n+ 1091 // Create both remote index sets simultaneously\n+ 1092 unpackIndices(*send, *receive, noRemoteSource, sourcePairs,\n+sourcePublish,\n+ 1093 destPairs, destPublish, p_in, type, &position, bufferSize);\n+ 1094 }else{\n+ 1095 // we only need one list\n+ 1096 unpackIndices(*receive, noRemoteSource, sourcePairs, sourcePublish,\n+ 1097 p_in, type, &position, bufferSize, fromOurSelf);\n+ 1098 send=receive;\n+ 1099 }\n+ 1100 }else{\n+ 1101\n+ 1102 int oldPos=position;\n+ 1103 // Two index sets received\n+ 1104 unpackIndices(*receive, noRemoteSource, destPairs, destPublish,\n+ 1105 p_in, type, &position, bufferSize, fromOurSelf);\n+ 1106 if(!sendTwo)\n+ 1107 //unpack source entries again as destination entries\n+ 1108 position=oldPos;\n+ 1109\n+ 1110 send = new RemoteIndexList();\n+ 1111 unpackIndices(*send, noRemoteDest, sourcePairs, sourcePublish,\n+ 1112 p_in, type, &position, bufferSize, fromOurSelf);\n+ 1113 }\n+ 1114\n+ 1115 if(receive->empty() && send->empty()) {\n+ 1116 if(send==receive) {\n+ 1117 delete send;\n+ 1118 }else{\n+ 1119 delete send;\n+ 1120 delete receive;\n+ 1121 }\n+ 1122 }else{\n+ 1123 remoteIndices_.insert(std::make_pair(remoteProc,\n+ 1124 std::make_pair(send,receive)));\n+ 1125 }\n+ 1126 }\n+ 1127\n+ 1128\n+ 1129 template\n+ 1130 template\n+ 1131 inline void RemoteIndices::buildRemote(bool includeSelf_)\n+ 1132 {\n+ 1133 // Processor configuration\n+ 1134 int rank, procs;\n+ 1135 MPI_Comm_rank(comm_, &rank);\n+ 1136 MPI_Comm_size(comm_, &procs);\n+ 1137\n+ 1138 // number of local indices to publish\n+ 1139 // The indices of the destination will be send.\n+ 1140 int sourcePublish, destPublish;\n+ 1141\n+ 1142 // Do we need to send two index sets?\n+ 1143 char sendTwo = (source_ != target_);\n+ 1144\n+ 1145 if(procs==1 && !(sendTwo || includeSelf_))\n+ 1146 // Nothing to communicate\n+ 1147 return;\n+ 1148\n+ 1149 sourcePublish = (ignorePublic) ? source_->size() : noPublic(*source_);\n+ 1150\n+ 1151 if(sendTwo)\n+ 1152 destPublish = (ignorePublic) ? target_->size() : noPublic(*target_);\n+ 1153 else\n+ 1154 // we only need to send one set of indices\n+ 1155 destPublish = 0;\n+ 1156\n+ 1157 int maxPublish, publish=sourcePublish+destPublish;\n+ 1158\n+ 1159 // Calculate maximum number of indices send\n+ 1160 MPI_Allreduce(&publish, &maxPublish, 1, MPI_INT, MPI_MAX, comm_);\n+ 1161\n+ 1162 // allocate buffers\n+ 1163 PairType** destPairs;\n+ 1164 PairType** sourcePairs = new PairType*[sourcePublish>0 ? sourcePublish :\n+1];\n+ 1165\n+ 1166 if(sendTwo)\n+ 1167 destPairs = new PairType*[destPublish>0 ? destPublish : 1];\n+ 1168 else\n+ 1169 destPairs=sourcePairs;\n+ 1170\n+ 1171 char** buffer = new char*[2];\n+ 1172 int bufferSize;\n+ 1173 int position=0;\n+ 1174 int intSize;\n+ 1175 int charSize;\n+ 1176\n+ 1177 // calculate buffer size\n+ 1178 MPI_Datatype type = MPITraits::getType();\n+ 1179\n+ 1180 MPI_Pack_size(maxPublish, type, comm_,\n+ 1181 &bufferSize);\n+ 1182 MPI_Pack_size(1, MPI_INT, comm_,\n+ 1183 &intSize);\n+ 1184 MPI_Pack_size(1, MPI_CHAR, comm_,\n+ 1185 &charSize);\n+ 1186 // Our message will contain the following:\n+ 1187 // a bool whether two index sets where sent\n+ 1188 // the size of the source and the dest indexset,\n+ 1189 // then the source and destination indices\n+ 1190 bufferSize += 2 * intSize + charSize;\n+ 1191\n+ 1192 if(bufferSize<=0) bufferSize=1;\n+ 1193\n+ 1194 buffer[0] = new char[bufferSize];\n+ 1195 buffer[1] = new char[bufferSize];\n+ 1196\n+ 1197\n+ 1198 // pack entries into buffer[0], p_out below!\n+ 1199 MPI_Pack(&sendTwo, 1, MPI_CHAR, buffer[0], bufferSize, &position,\n+ 1200 comm_);\n+ 1201\n+ 1202 // The number of indices we send for each index set\n+ 1203 MPI_Pack(&sourcePublish, 1, MPI_INT, buffer[0], bufferSize, &position,\n+ 1204 comm_);\n+ 1205 MPI_Pack(&destPublish, 1, MPI_INT, buffer[0], bufferSize, &position,\n+ 1206 comm_);\n+ 1207\n+ 1208 // Now pack the source indices and setup the destination pairs\n+ 1209 packEntries(sourcePairs, *source_, buffer[0], type,\n+ 1210 bufferSize, &position, sourcePublish);\n+ 1211 // If necessary send the dest indices and setup the source pairs\n+ 1212 if(sendTwo)\n+ 1213 packEntries(destPairs, *target_, buffer[0], type,\n+ 1214 bufferSize, &position, destPublish);\n+ 1215\n+ 1216\n+ 1217 // Update remote indices for ourself\n+ 1218 if(sendTwo|| includeSelf_)\n+ 1219 unpackCreateRemote(buffer[0], sourcePairs, destPairs, rank,\n+sourcePublish,\n+ 1220 destPublish, bufferSize, sendTwo, includeSelf_);\n+ 1221\n+ 1222 neighbourIds.erase(rank);\n+ 1223\n+ 1224 if(neighbourIds.size()==0)\n+ 1225 {\n+ 1226 Dune::dvverb<::size_type size_type;\n+ 1262 size_type noNeighbours=neighbourIds.size();\n+ 1263\n+ 1264 // setup sends\n+ 1265 for(std::set::iterator neighbour=neighbourIds.begin();\n+ 1266 neighbour!= neighbourIds.end(); ++neighbour) {\n+ 1267 // Only send the information to the neighbouring processors\n+ 1268 MPI_Issend(buffer[0], position , MPI_PACKED, *neighbour, commTag_, comm_,\n+req++);\n+ 1269 }\n+ 1270\n+ 1271 //Test for received messages\n+ 1272\n+ 1273 for(size_type received=0; received \n+ 1314 inline void RemoteIndices::unpackIndices(RemoteIndexList& remote,\n+ 1315 int remoteEntries,\n+ 1316 PairType** local,\n+ 1317 int localEntries,\n+ 1318 char* p_in,\n+ 1319 MPI_Datatype type,\n+ 1320 int* position,\n+ 1321 int bufferSize,\n+ 1322 bool fromOurSelf)\n+ 1323 {\n+ 1324 if(remoteEntries==0)\n+ 1325 return;\n+ 1326\n+ 1327 PairType index;\n+ 1328 MPI_Unpack(p_in, bufferSize, position, &index, 1,\n+ 1329 type, comm_);\n+ 1330 GlobalIndex oldGlobal=index.global();\n+ 1331 int n_in=0, localIndex=0;\n+ 1332\n+ 1333 //Check if we know the global index\n+ 1334 while(localIndexglobal()==index.global()) {\n+ 1336 int oldLocalIndex=localIndex;\n+ 1337\n+ 1338 while(localIndexglobal()==index.global()) {\n+ 1340 if(!fromOurSelf || index.local().attribute() !=\n+ 1341 local[localIndex]->local().attribute())\n+ 1342 // if index is from us it has to have a different attribute\n+ 1343 remote.push_back(RemoteIndex(index.local().attribute(),\n+ 1344 local[localIndex]));\n+ 1345 localIndex++;\n+ 1346 }\n+ 1347\n+ 1348 // unpack next remote index\n+ 1349 if((++n_in) < remoteEntries) {\n+ 1350 MPI_Unpack(p_in, bufferSize, position, &index, 1,\n+ 1351 type, comm_);\n+ 1352 if(index.global()==oldGlobal)\n+ 1353 // Restart comparison for the same global indices\n+ 1354 localIndex=oldLocalIndex;\n+ 1355 else\n+ 1356 oldGlobal=index.global();\n+ 1357 }else{\n+ 1358 // No more received indices\n+ 1359 break;\n+ 1360 }\n+ 1361 continue;\n+ 1362 }\n+ 1363\n+ 1364 if (local[localIndex]->global()\n+ 1387 inline void RemoteIndices::unpackIndices(RemoteIndexList& send,\n+ 1388 RemoteIndexList& receive,\n+ 1389 int remoteEntries,\n+ 1390 PairType** localSource,\n+ 1391 int localSourceEntries,\n+ 1392 PairType** localDest,\n+ 1393 int localDestEntries,\n+ 1394 char* p_in,\n+ 1395 MPI_Datatype type,\n+ 1396 int* position,\n+ 1397 int bufferSize)\n+ 1398 {\n+ 1399 int n_in=0, sourceIndex=0, destIndex=0;\n+ 1400\n+ 1401 //Check if we know the global index\n+ 1402 while(n_in= than\n+the one in the unpacked index\n+ 1410 while(sourceIndexglobal\n+()global\n+()global\n+()==index.global())\n+ 1418 send.push_back(RemoteIndex(index.local().attribute(),\n+ 1419 localSource[sourceIndex]));\n+ 1420\n+ 1421 if(destIndex < localDestEntries && localDest[destIndex]->global() ==\n+index.global())\n+ 1422 receive.push_back(RemoteIndex(index.local().attribute(),\n+ 1423 localDest[sourceIndex]));\n+ 1424 }\n+ 1425\n+ 1426 }\n+ 1427\n+ 1428 template\n+1429 inline void RemoteIndices::free()\n+ 1430 {\n+ 1431 auto lend = remoteIndices_.end();\n+ 1432 for(auto lists=remoteIndices_.begin(); lists != lend; ++lists) {\n+ 1433 if(lists->second.first==lists->second.second) {\n+ 1434 // there is only one remote index list.\n+ 1435 delete lists->second.first;\n+ 1436 }else{\n+ 1437 delete lists->second.first;\n+ 1438 delete lists->second.second;\n+ 1439 }\n+ 1440 }\n+ 1441 remoteIndices_.clear();\n+ 1442 firstBuild=true;\n+ 1443 }\n+ 1444\n+ 1445 template\n+1446 inline int RemoteIndices::neighbours() const\n+ 1447 {\n+ 1448 return remoteIndices_.size();\n+ 1449 }\n+ 1450\n+ 1451 template\n+ 1452 template\n+1453 inline void RemoteIndices::rebuild()\n+ 1454 {\n+ 1455 // Test whether a rebuild is Needed.\n+ 1456 if(firstBuild ||\n+ 1457 ignorePublic!=publicIgnored || !\n+ 1458 isSynced()) {\n+ 1459 free();\n+ 1460\n+ 1461 buildRemote(includeSelf);\n+ 1462\n+ 1463 sourceSeqNo_ = source_->seqNo();\n+ 1464 destSeqNo_ = target_->seqNo();\n+ 1465 firstBuild=false;\n+ 1466 publicIgnored=ignorePublic;\n+ 1467 }\n+ 1468\n+ 1469\n+ 1470 }\n+ 1471\n+ 1472 template\n+1473 inline bool RemoteIndices::isSynced() const\n+ 1474 {\n+ 1475 return sourceSeqNo_==source_->seqNo() && destSeqNo_ ==target_->seqNo();\n+ 1476 }\n+ 1477\n+ 1478 template\n+ 1479 template\n+1480 RemoteIndexListModifier RemoteIndices::getModifier(int\n+process)\n+ 1481 {\n+ 1482\n+ 1483 // The user are on their own now!\n+ 1484 // We assume they know what they are doing and just set the\n+ 1485 // remote indices to synced status.\n+ 1486 sourceSeqNo_ = source_->seqNo();\n+ 1487 destSeqNo_ = target_->seqNo();\n+ 1488\n+ 1489 typename RemoteIndexMap::iterator found = remoteIndices_.find(process);\n+ 1490\n+ 1491 if(found == remoteIndices_.end())\n+ 1492 {\n+ 1493 if(source_ != target_)\n+ 1494 found = remoteIndices_.insert(found, std::make_pair(process,\n+ 1495 std::make_pair(new RemoteIndexList(),\n+ 1496 new RemoteIndexList())));\n+ 1497 else{\n+ 1498 RemoteIndexList* rlist = new RemoteIndexList();\n+ 1499 found = remoteIndices_.insert(found,\n+ 1500 std::make_pair(process,\n+ 1501 std::make_pair(rlist, rlist)));\n+ 1502 }\n+ 1503 }\n+ 1504\n+ 1505 firstBuild = false;\n+ 1506\n+ 1507 if(send)\n+ 1508 return RemoteIndexListModifier(*source_, *(found-\n+>second.first));\n+ 1509 else\n+ 1510 return RemoteIndexListModifier(*target_, *(found-\n+>second.second));\n+ 1511 }\n+ 1512\n+ 1513 template\n+ 1514 inline typename RemoteIndices::const_iterator\n+1515 RemoteIndices::find(int proc) const\n+ 1516 {\n+ 1517 return remoteIndices_.find(proc);\n+ 1518 }\n+ 1519\n+ 1520 template\n+ 1521 inline typename RemoteIndices::const_iterator\n+1522 RemoteIndices::begin() const\n+ 1523 {\n+ 1524 return remoteIndices_.begin();\n+ 1525 }\n+ 1526\n+ 1527 template\n+ 1528 inline typename RemoteIndices::const_iterator\n+1529 RemoteIndices::end() const\n+ 1530 {\n+ 1531 return remoteIndices_.end();\n+ 1532 }\n+ 1533\n+ 1534\n+ 1535 template\n+1536 bool RemoteIndices::operator==(const RemoteIndices& ri) const\n+ 1537 {\n+ 1538 if(neighbours()!=ri.neighbours())\n+ 1539 return false;\n+ 1540\n+ 1541 const auto rend = remoteIndices_.end();\n+ 1542\n+ 1543 for(auto rindex = remoteIndices_.begin(), rindex1=ri.remoteIndices_.begin\n+(); rindex!=rend; ++rindex, ++rindex1) {\n+ 1544 if(rindex->first != rindex1->first)\n+ 1545 return false;\n+ 1546 if(*(rindex->second.first) != *(rindex1->second.first))\n+ 1547 return false;\n+ 1548 if(*(rindex->second.second) != *(rindex1->second.second))\n+ 1549 return false;\n+ 1550 }\n+ 1551 return true;\n+ 1552 }\n+ 1553\n+ 1554 template\n+ 1555 RemoteIndexListModifier::RemoteIndexListModifier(const\n+ParallelIndexSet& indexSet,\n+ 1556 RemoteIndexList& rList)\n+ 1557 : rList_(&rList), indexSet_(&indexSet), iter_(rList.beginModify()), end_\n+(rList.end()), first_(true)\n+ 1558 {\n+ 1559 if(MODIFYINDEXSET) {\n+ 1560 assert(indexSet_);\n+ 1561 for(ConstIterator iter=iter_; iter != end_; ++iter)\n+ 1562 glist_.push_back(iter->localIndexPair().global());\n+ 1563 giter_ = glist_.beginModify();\n+ 1564 }\n+ 1565 }\n+ 1566\n+ 1567 template\n+1568 RemoteIndexListModifier::RemoteIndexListModifier(const\n+RemoteIndexListModifier& other)\n+ 1569 : rList_(other.rList_), indexSet_(other.indexSet_),\n+ 1570 glist_(other.glist_), iter_(other.iter_), giter_(other.giter_), end_\n+(other.end_),\n+ 1571 first_(other.first_), last_(other.last_)\n+ 1572 {}\n+ 1573\n+ 1574 template\n+1575 inline void RemoteIndexListModifier::repairLocalIndexPointers()\n+ 1576 {\n+ 1577 if(MODIFYINDEXSET) {\n+ 1578 // repair pointers to local index set.\n+ 1579#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1580 if(indexSet_->state()!=GROUND)\n+ 1581 DUNE_THROW(InvalidIndexSetState, \"Index has to be in ground mode for\n+repairing pointers to indices\");\n+ 1582#endif\n+ 1583 auto giter = glist_.begin();\n+ 1584 auto index = indexSet_->begin();\n+ 1585\n+ 1586 for(auto iter=rList_->begin(); iter != end_; ++iter) {\n+ 1587 while(index->global()<*giter) {\n+ 1588 ++index;\n+ 1589#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1590 if(index == indexSet_->end())\n+ 1591 DUNE_THROW(InvalidPosition, \"No such global index in set!\");\n+ 1592#endif\n+ 1593 }\n+ 1594\n+ 1595#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1596 if(index->global() != *giter)\n+ 1597 DUNE_THROW(InvalidPosition, \"No such global index in set!\");\n+ 1598#endif\n+ 1599 iter->localIndex_ = &(*index);\n+ 1600 }\n+ 1601 }\n+ 1602 }\n+ 1603\n+ 1604 template\n+1605 inline void RemoteIndexListModifier::insert(const RemoteIndex&\n+index)\n+ 1606 {\n+ 1607 static_assert(!mode,\"Not allowed if the mode indicates that new indices\"\n+ 1608 \"might be added to the underlying index set. Use \"\n+ 1609 \"insert(const RemoteIndex&, const GlobalIndex&) instead\");\n+ 1610\n+ 1611#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1612 if(!first_ && index.localIndexPair().global()localIndexPair().global() <\n+index.localIndexPair().global()) {\n+ 1617 ++iter_;\n+ 1618 }\n+ 1619\n+ 1620 // No duplicate entries allowed\n+ 1621 assert(iter_==end_ || iter_->localIndexPair().global() !=\n+index.localIndexPair().global());\n+ 1622 iter_.insert(index);\n+ 1623 last_ = index.localIndexPair().global();\n+ 1624 first_ = false;\n+ 1625 }\n+ 1626\n+ 1627 template\n+1628 inline void RemoteIndexListModifier::insert(const RemoteIndex&\n+index, const GlobalIndex& global)\n+ 1629 {\n+ 1630 static_assert(mode,\"Not allowed if the mode indicates that no new\n+indices\"\n+ 1631 \"might be added to the underlying index set. Use \"\n+ 1632 \"insert(const RemoteIndex&) instead\");\n+ 1633#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1634 if(!first_ && globallocalIndexPair().global() != global);\n+ 1645 iter_.insert(index);\n+ 1646 giter_.insert(global);\n+ 1647\n+ 1648 last_ = global;\n+ 1649 first_ = false;\n+ 1650 }\n+ 1651\n+ 1652 template\n+1653 bool RemoteIndexListModifier::remove(const GlobalIndex& global)\n+ 1654 {\n+ 1655#ifdef DUNE_ISTL_WITH_CHECKING\n+ 1656 if(!first_ && globallocalIndexPair().global() < global)\n+ 1675 ++iter_;\n+ 1676\n+ 1677 if(iter_->localIndexPair().global()==global) {\n+ 1678 iter_.remove();\n+ 1679 found = true;\n+ 1680 }\n+ 1681 }\n+ 1682\n+ 1683 last_ = global;\n+ 1684 first_ = false;\n+ 1685 return found;\n+ 1686 }\n+ 1687\n+ 1688 template\n+ 1689 template\n+1690 inline typename RemoteIndices::CollectiveIteratorT\n+RemoteIndices::iterator() const\n+ 1691 {\n+ 1692 return CollectiveIterator(remoteIndices_, send);\n+ 1693 }\n+ 1694\n+ 1695 template\n+1696 inline MPI_Comm RemoteIndices::communicator() const\n+ 1697 {\n+ 1698 return comm_;\n+ 1699\n+ 1700 }\n+ 1701\n+ 1702 template\n+1703 CollectiveIterator::CollectiveIterator(const RemoteIndexMap& pmap,\n+bool send)\n+ 1704 {\n+ 1705\n+ 1706 const auto end = pmap.end();\n+ 1707 for(auto process = pmap.begin(); process != end; ++process) {\n+ 1708 const RemoteIndexList* list = send ? process->second.first : process-\n+>second.second;\n+ 1709 using ri_iterator = typename RemoteIndexList::const_iterator;\n+ 1710 map_.insert(std::make_pair(process->first,\n+ 1711 std::pair(list->begin(), list->end())));\n+ 1712 }\n+ 1713 }\n+ 1714\n+ 1715 template\n+1716 inline void CollectiveIterator::advance(const GlobalIndex& index)\n+ 1717 {\n+ 1718 const auto end = map_.end();\n+ 1719\n+ 1720 for(auto iter = map_.begin(); iter != end;) {\n+ 1721 // Step the iterator until we are >= index\n+ 1722 typename RemoteIndexList::const_iterator current = iter->second.first;\n+ 1723 typename RemoteIndexList::const_iterator rend = iter->second.second;\n+ 1724 RemoteIndex remoteIndex;\n+ 1725 if(current != rend)\n+ 1726 remoteIndex = *current;\n+ 1727\n+ 1728 while(iter->second.first!=iter->second.second && iter->second.first-\n+>localIndexPair().global()second.first);\n+ 1730\n+ 1731 // erase from the map if there are no more entries.\n+ 1732 if(iter->second.first == iter->second.second)\n+ 1733 map_.erase(iter++);\n+ 1734 else{\n+ 1735 ++iter;\n+ 1736 }\n+ 1737 }\n+ 1738 index_=index;\n+ 1739 noattribute=true;\n+ 1740 }\n+ 1741\n+ 1742 template\n+1743 inline void CollectiveIterator::advance(const GlobalIndex& index,\n+ 1744 const Attribute& attribute)\n+ 1745 {\n+ 1746 const auto end = map_.end();\n+ 1747\n+ 1748 for(auto iter = map_.begin(); iter != end;) {\n+ 1749 // Step the iterator until we are >= index\n+ 1750 typename RemoteIndexList::const_iterator current = iter->second.first;\n+ 1751 typename RemoteIndexList::const_iterator rend = iter->second.second;\n+ 1752 RemoteIndex remoteIndex;\n+ 1753 if(current != rend)\n+ 1754 remoteIndex = *current;\n+ 1755\n+ 1756 // Move to global index or bigger\n+ 1757 while(iter->second.first!=iter->second.second && iter->second.first-\n+>localIndexPair().global()second.first);\n+ 1759\n+ 1760 // move to attribute or bigger\n+ 1761 while(iter->second.first!=iter->second.second\n+ 1762 && iter->second.first->localIndexPair().global()==index\n+ 1763 && iter->second.first->localIndexPair().local().attribute()second.first);\n+ 1765\n+ 1766 // erase from the map if there are no more entries.\n+ 1767 if(iter->second.first == iter->second.second)\n+ 1768 map_.erase(iter++);\n+ 1769 else{\n+ 1770 ++iter;\n+ 1771 }\n+ 1772 }\n+ 1773 index_=index;\n+ 1774 attribute_=attribute;\n+ 1775 noattribute=false;\n+ 1776 }\n+ 1777\n+ 1778 template\n+1779 inline CollectiveIterator& CollectiveIterator::operator++()\n+ 1780 {\n+ 1781 const auto end = map_.end();\n+ 1782\n+ 1783 for(auto iter = map_.begin(); iter != end;) {\n+ 1784 // Step the iterator until we are >= index\n+ 1785 auto current = iter->second.first;\n+ 1786 auto rend = iter->second.second;\n+ 1787\n+ 1788 // move all iterators pointing to the current global index to next value\n+ 1789 if(iter->second.first->localIndexPair().global()==index_ &&\n+ 1790 (noattribute || iter->second.first->localIndexPair().local().attribute()\n+== attribute_))\n+ 1791 ++(iter->second.first);\n+ 1792\n+ 1793 // erase from the map if there are no more entries.\n+ 1794 if(iter->second.first == iter->second.second)\n+ 1795 map_.erase(iter++);\n+ 1796 else{\n+ 1797 ++iter;\n+ 1798 }\n+ 1799 }\n+ 1800 return *this;\n+ 1801 }\n+ 1802\n+ 1803 template\n+1804 inline bool CollectiveIterator::empty() const\n+ 1805 {\n+ 1806 return map_.empty();\n+ 1807 }\n+ 1808\n+ 1809 template\n+ 1810 inline typename CollectiveIterator::iterator\n+1811 CollectiveIterator::begin()\n+ 1812 {\n+ 1813 if(noattribute)\n+ 1814 return iterator(map_.begin(), map_.end(), index_);\n+ 1815 else\n+ 1816 return iterator(map_.begin(), map_.end(), index_,\n+ 1817 attribute_);\n+ 1818 }\n+ 1819\n+ 1820 template\n+ 1821 inline typename CollectiveIterator::iterator\n+1822 CollectiveIterator::end()\n+ 1823 {\n+ 1824 return iterator(map_.end(), map_.end(), index_);\n+ 1825 }\n+ 1826\n+ 1827 template\n+1828 inline std::ostream& operator<<(std::ostream& os, const\n+RemoteIndex& index)\n+ 1829 {\n+ 1830 os<<\"[global=\"<\n+1835 inline std::ostream& operator<<(std::ostream& os, const\n+RemoteIndices& indices)\n+ 1836 {\n+ 1837 int rank;\n+ 1838 MPI_Comm_rank(indices.comm_, &rank);\n+ 1839 const auto rend = indices.remoteIndices_.end();\n+ 1840\n+ 1841 for(auto rindex = indices.remoteIndices_.begin(); rindex!=rend; ++rindex)\n+{\n+ 1842 os<first<<\":\";\n+ 1843\n+ 1844 if(!rindex->second.first->empty()) {\n+ 1845 os<<\" send:\";\n+ 1846\n+ 1847 const auto send= rindex->second.first->end();\n+ 1848\n+ 1849 for(auto index = rindex->second.first->begin();\n+ 1850 index != send; ++index)\n+ 1851 os<<*index<<\" \";\n+ 1852 os<second.second->empty()) {\n+ 1855 os<first<<\": \"<<\"receive: \";\n+ 1856\n+ 1857 for(const auto& index : *(rindex->second.second))\n+ 1858 os << index << \" \";\n+ 1859 }\n+ 1860 os<::const_iterator\n+SLListConstIterator< RemoteIndex, Allocator > const_iterator\n+The constant iterator of the list.\n+Definition: sllist.hh:74\n+Dune::SLList<_GlobalIndex,_Allocator_>::ModifyIterator\n+SLListModifyIterator< GlobalIndex, Allocator > ModifyIterator\n+The type of the iterator capable of deletion and insertion.\n+Definition: sllist.hh:103\n+Dune::SLList::begin\n+iterator begin()\n+Get an iterator pointing to the first element in the list.\n+Definition: sllist.hh:762\n+Dune::operator<<\n+std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)\n+Definition: bigunsignedint.hh:278\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+Dune::ParallelIndexSet::begin\n+iterator begin()\n+Get an iterator over the indices positioned at the first index.\n+Dune::ParallelIndexSet::end\n+iterator end()\n+Get an iterator over the indices positioned after the last index.\n+Dune::ParallelIndexSet::LocalIndex\n+TL LocalIndex\n+The type of the local index, e.g. ParallelLocalIndex.\n+Definition: indexset.hh:239\n+Dune::IndexPair::global\n+const GlobalIndex & global() const\n+Get the global index.\n+Dune::IndexPair::local\n+LocalIndex & local()\n+Get the local index.\n+Dune::ParallelIndexSet::GlobalIndex\n+TG GlobalIndex\n+the type of the global index. This type has to provide at least a operator< for\n+sorting.\n+Definition: indexset.hh:226\n+Dune::GROUND\n+@ GROUND\n+The default mode. Indicates that the index set is ready to be used.\n+Definition: indexset.hh:186\n+Dune::dvverb\n+DVVerbType dvverb(std::cout)\n+stream for very verbose output.\n+Definition: stdstreams.hh:95\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::hash_range\n-std::size_t hash_range(It first, It last)\n-Hashes all elements in the range [first,last) and returns the combined hash.\n-Definition: hash.hh:322\n-Dune::hash_combine\n-void hash_combine(std::size_t &seed, const T &arg)\n-Calculates the hash value of arg and combines it in-place with seed.\n-Definition: hash.hh:307\n-Dune::hash\n-Functor for hashing objects of type T.\n-Definition: hash.hh:40\n-Dune::hash::operator()\n-std::size_t operator()(const T &t) const\n-Calculates the hash of t.\n-Definition: hash.hh:43\n+Dune::MPITraits\n+A traits class describing the mapping of types onto MPI_Datatypes.\n+Definition: mpitraits.hh:41\n+Dune::MPITraits::getType\n+static MPI_Datatype getType()\n+Definition: mpitraits.hh:48\n+Dune::RangeError\n+Default exception class for range errors.\n+Definition: exceptions.hh:254\n+Dune::IndexPair\n+A pair consisting of a global and local index.\n+Definition: indexset.hh:85\n+Dune::InvalidIndexSetState\n+Exception indicating that the index set is not in the expected state.\n+Definition: indexset.hh:205\n+Dune::ParallelIndexSet\n+Manager class for the mapping between local indices and globally unique\n+indices.\n+Definition: indexset.hh:218\n+Dune::IndicesSyncer\n+Class for recomputing missing indices of a distributed index set.\n+Definition: indicessyncer.hh:41\n+Dune::InterfaceBuilder\n+Base class of all classes representing a communication interface.\n+Definition: parallel/interface.hh:35\n+Dune::ParallelLocalIndex\n+An index present on the local process with an additional attribute flag.\n+Definition: plocalindex.hh:49\n+Dune::RemoteIndices\n+The indices present on remote processes.\n+Definition: remoteindices.hh:189\n+Dune::RemoteIndices::getNeighbours\n+const std::set< int > & getNeighbours() const\n+Definition: remoteindices.hh:307\n+Dune::RemoteIndices::RemoteIndex\n+Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex\n+Type of the remote indices we manage.\n+Definition: remoteindices.hh:231\n+Dune::RemoteIndices::RemoteIndices\n+RemoteIndices()\n+Definition: remoteindices.hh:977\n+Dune::RemoteIndices::fillIndexSetHoles\n+friend void fillIndexSetHoles(const G &graph, Dune::\n+OwnerOverlapCopyCommunication< T1, T2 > &oocomm)\n+Dune::RemoteIndices::setIndexSets\n+void setIndexSets(const ParallelIndexSet &source, const ParallelIndexSet\n+&destination, const MPI_Comm &comm, const std::vector< int > &neighbours=std::\n+vector< int >())\n+Set the index sets and communicator we work with.\n+Definition: remoteindices.hh:984\n+Dune::RemoteIndices::free\n+void free()\n+Free the index lists.\n+Definition: remoteindices.hh:1429\n+Dune::RemoteIndices::repairLocalIndexPointers\n+friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename\n+T1::GlobalIndex, typename T1::LocalIndex::Attribute >, A2 > > &, RemoteIndices<\n+T1, A1 > &, const T1 &)\n+Dune::RemoteIndices::GlobalIndex\n+ParallelIndexSet::GlobalIndex GlobalIndex\n+The type of the global index.\n+Definition: remoteindices.hh:215\n+Dune::RemoteIndices::rebuild\n+void rebuild()\n+Rebuilds the set of remote indices.\n+Definition: remoteindices.hh:1453\n+Dune::RemoteIndices::ParallelIndexSet\n+T ParallelIndexSet\n+Type of the index set we use, e.g. ParallelLocalIndexSet.\n+Definition: remoteindices.hh:206\n+Dune::RemoteIndices::communicator\n+MPI_Comm communicator() const\n+Get the mpi communicator used.\n+Definition: remoteindices.hh:1696\n+Dune::RemoteIndices::Attribute\n+LocalIndex::Attribute Attribute\n+The type of the attribute.\n+Definition: remoteindices.hh:226\n+Dune::RemoteIndices::iterator\n+CollectiveIteratorT iterator() const\n+Get an iterator for colletively iterating over the remote indices of all remote\n+processes.\n+Definition: remoteindices.hh:1690\n+Dune::RemoteIndices::setIncludeSelf\n+void setIncludeSelf(bool includeSelf)\n+Tell whether sending from indices of the processor to other indices on the same\n+processor is enabled ...\n+Definition: remoteindices.hh:971\n+Dune::RemoteIndices::end\n+const_iterator end() const\n+Get an iterator over all remote index lists.\n+Definition: remoteindices.hh:1529\n+Dune::RemoteIndices::operator==\n+bool operator==(const RemoteIndices &ri) const\n+Definition: remoteindices.hh:1536\n+Dune::RemoteIndices::RemoteIndexMap\n+std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > >\n+RemoteIndexMap\n+The type of the map from rank to remote index list.\n+Definition: remoteindices.hh:245\n+Dune::RemoteIndices::setNeighbours\n+void setNeighbours(const C &neighbours)\n+Definition: remoteindices.hh:300\n+Dune::RemoteIndices::getModifier\n+RemoteIndexListModifier< T, A, mode > getModifier(int process)\n+Get a modifier for a remote index list.\n+Definition: remoteindices.hh:1480\n+Dune::RemoteIndices::sourceIndexSet\n+const ParallelIndexSet & sourceIndexSet() const\n+Get the index set at the source.\n+Definition: remoteindices.hh:999\n+Dune::RemoteIndices::~RemoteIndices\n+~RemoteIndices()\n+Destructor.\n+Definition: remoteindices.hh:1014\n+Dune::RemoteIndices::RemoteIndexList\n+Dune::SLList< RemoteIndex, Allocator > RemoteIndexList\n+The type of the remote index list.\n+Definition: remoteindices.hh:241\n+Dune::RemoteIndices::neighbours\n+int neighbours() const\n+Get the number of processors we share indices with.\n+Definition: remoteindices.hh:1446\n+Dune::RemoteIndices::CollectiveIteratorT\n+CollectiveIterator< T, A > CollectiveIteratorT\n+The type of the collective iterator over all remote indices.\n+Definition: remoteindices.hh:210\n+Dune::RemoteIndices::destinationIndexSet\n+const ParallelIndexSet & destinationIndexSet() const\n+Get the index set at destination.\n+Definition: remoteindices.hh:1007\n+Dune::RemoteIndices::Allocator\n+typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex >\n+Allocator\n+The type of the allocator for the remote index list.\n+Definition: remoteindices.hh:237\n+Dune::RemoteIndices::find\n+const_iterator find(int proc) const\n+Find an iterator over the remote index lists of a specific process.\n+Definition: remoteindices.hh:1515\n+Dune::RemoteIndices::isSynced\n+bool isSynced() const\n+Checks whether the remote indices are synced with the indexsets.\n+Definition: remoteindices.hh:1473\n+Dune::RemoteIndices::begin\n+const_iterator begin() const\n+Get an iterator over all remote index lists.\n+Definition: remoteindices.hh:1522\n+Dune::RemoteIndices::LocalIndex\n+ParallelIndexSet::LocalIndex LocalIndex\n+The type of the local index.\n+Definition: remoteindices.hh:221\n+Dune::RemoteIndices::const_iterator\n+RemoteIndexMap::const_iterator const_iterator\n+Definition: remoteindices.hh:247\n+Dune::RemoteIndex\n+Information about an index residing on another processor.\n+Definition: remoteindices.hh:73\n+Dune::RemoteIndex::attribute\n+const Attribute attribute() const\n+Get the attribute of the index on the remote process.\n+Definition: remoteindices.hh:946\n+Dune::RemoteIndex::repairLocalIndexPointers\n+friend void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename\n+T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &, RemoteIndices< T,\n+A1 > &, const T &)\n+Dune::RemoteIndex::operator==\n+bool operator==(const RemoteIndex &ri) const\n+Definition: remoteindices.hh:934\n+Dune::RemoteIndex::GlobalIndex\n+T1 GlobalIndex\n+the type of the global index. This type has to provide at least a operator< for\n+sorting.\n+Definition: remoteindices.hh:90\n+Dune::RemoteIndex::Attribute\n+T2 Attribute\n+The type of the attributes. Normally this will be an enumeration like.\n+Definition: remoteindices.hh:99\n+Dune::RemoteIndex::PairType\n+IndexPair< GlobalIndex, ParallelLocalIndex< Attribute > > PairType\n+The type of the index pair.\n+Definition: remoteindices.hh:105\n+Dune::RemoteIndex::localIndexPair\n+const PairType & localIndexPair() const\n+Get the corresponding local index pair.\n+Definition: remoteindices.hh:952\n+Dune::RemoteIndex::RemoteIndex\n+RemoteIndex()\n+Parameterless Constructor.\n+Definition: remoteindices.hh:930\n+Dune::RemoteIndex::operator!=\n+bool operator!=(const RemoteIndex &ri) const\n+Definition: remoteindices.hh:940\n+Dune::RemoteIndexListModifier\n+Modifier for adding and/or deleting remote indices from the remote index list.\n+Definition: remoteindices.hh:551\n+Dune::RemoteIndexListModifier::repairLocalIndexPointers\n+void repairLocalIndexPointers()\n+Repair the pointers to the local index pairs.\n+Definition: remoteindices.hh:1575\n+Dune::RemoteIndexListModifier::RemoteIndexList\n+Dune::SLList< RemoteIndex, Allocator > RemoteIndexList\n+The type of the remote index list.\n+Definition: remoteindices.hh:602\n+Dune::RemoteIndexListModifier::Allocator\n+A Allocator\n+The type of the allocator for the remote index list.\n+Definition: remoteindices.hh:598\n+Dune::RemoteIndexListModifier::insert\n+void insert(const RemoteIndex &index)\n+Insert an index to the list.\n+Definition: remoteindices.hh:1605\n+Dune::RemoteIndexListModifier::GlobalIndex\n+ParallelIndexSet::GlobalIndex GlobalIndex\n+The type of the global index.\n+Definition: remoteindices.hh:578\n+Dune::RemoteIndexListModifier::LocalIndex\n+ParallelIndexSet::LocalIndex LocalIndex\n+The type of the local index.\n+Definition: remoteindices.hh:583\n+Dune::RemoteIndexListModifier::ConstIterator\n+RemoteIndexList::const_iterator ConstIterator\n+The type of the remote index list iterator.\n+Definition: remoteindices.hh:612\n+Dune::RemoteIndexListModifier::ModifyIterator\n+SLListModifyIterator< RemoteIndex, Allocator > ModifyIterator\n+The type of the modifying iterator of the remote index list.\n+Definition: remoteindices.hh:607\n+Dune::RemoteIndexListModifier::remove\n+bool remove(const GlobalIndex &global)\n+Remove a remote index.\n+Definition: remoteindices.hh:1653\n+Dune::RemoteIndexListModifier::ParallelIndexSet\n+T ParallelIndexSet\n+Type of the index set we use.\n+Definition: remoteindices.hh:573\n+Dune::RemoteIndexListModifier::RemoteIndexListModifier\n+RemoteIndexListModifier()\n+Default constructor.\n+Definition: remoteindices.hh:676\n+Dune::RemoteIndexListModifier::Attribute\n+LocalIndex::Attribute Attribute\n+The type of the attribute.\n+Definition: remoteindices.hh:588\n+Dune::RemoteIndexListModifier::RemoteIndex\n+Dune::RemoteIndex< GlobalIndex, Attribute > RemoteIndex\n+Type of the remote indices we manage.\n+Definition: remoteindices.hh:593\n+Dune::RemoteIndexListModifier::MODIFYINDEXSET\n+static constexpr bool MODIFYINDEXSET\n+If true the index set corresponding to the remote indices might get modified.\n+Definition: remoteindices.hh:568\n+Dune::CollectiveIterator\n+A collective iterator for moving over the remote indices for all processes\n+collectively.\n+Definition: remoteindices.hh:708\n+Dune::CollectiveIterator::operator++\n+CollectiveIterator & operator++()\n+Definition: remoteindices.hh:1779\n+Dune::CollectiveIterator::end\n+iterator end()\n+Definition: remoteindices.hh:1822\n+Dune::CollectiveIterator::CollectiveIterator\n+CollectiveIterator(const RemoteIndexMap &map_, bool send)\n+Constructor.\n+Definition: remoteindices.hh:1703\n+Dune::CollectiveIterator::empty\n+bool empty() const\n+Checks whether there are still iterators in the map.\n+Definition: remoteindices.hh:1804\n+Dune::CollectiveIterator::advance\n+void advance(const GlobalIndex &global)\n+Advances all underlying iterators.\n+Definition: remoteindices.hh:1716\n+Dune::CollectiveIterator::RemoteIndexMap\n+std::map< int, std::pair< RemoteIndexList *, RemoteIndexList * > >\n+RemoteIndexMap\n+The type of the map from rank to remote index list.\n+Definition: remoteindices.hh:748\n+Dune::CollectiveIterator::begin\n+iterator begin()\n+Definition: remoteindices.hh:1811\n+Dune::OwnerOverlapCopyCommunication\n+Definition: remoteindices.hh:167\n+Dune::RemoteIndexListModifier::InvalidPosition\n+Definition: remoteindices.hh:558\n+Dune::CollectiveIterator::iterator\n+Iterator over the valid underlying iterators.\n+Definition: remoteindices.hh:792\n+Dune::CollectiveIterator::iterator::iterator\n+iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex\n+&index)\n+Definition: remoteindices.hh:799\n+Dune::CollectiveIterator::iterator::iterator\n+iterator(const iterator &other)\n+Definition: remoteindices.hh:817\n+Dune::CollectiveIterator::iterator::operator*\n+const RemoteIndex & operator*() const\n+Definition: remoteindices.hh:838\n+Dune::CollectiveIterator::iterator::ConstRealIterator\n+Map::iterator ConstRealIterator\n+Definition: remoteindices.hh:795\n+Dune::CollectiveIterator::iterator::operator++\n+iterator & operator++()\n+Definition: remoteindices.hh:822\n+Dune::CollectiveIterator::iterator::operator->\n+const RemoteIndex * operator->() const\n+Definition: remoteindices.hh:850\n+Dune::CollectiveIterator::iterator::operator==\n+bool operator==(const iterator &other) const\n+Definition: remoteindices.hh:856\n+Dune::CollectiveIterator::iterator::process\n+int process() const\n+Definition: remoteindices.hh:844\n+Dune::CollectiveIterator::iterator::iterator\n+iterator(const RealIterator &iter, const ConstRealIterator &end, GlobalIndex\n+index, Attribute attribute)\n+Definition: remoteindices.hh:807\n+Dune::CollectiveIterator::iterator::operator!=\n+bool operator!=(const iterator &other) const\n+Definition: remoteindices.hh:862\n+Dune::CollectiveIterator::iterator::RealIterator\n+Map::iterator RealIterator\n+Definition: remoteindices.hh:794\n+Dune::SLListConstIterator\n+A constant iterator for the SLList.\n+Definition: sllist.hh:371\n+Dune::SLListModifyIterator<_RemoteIndex,_Allocator_>\n+Dune::SLList\n+A single linked list.\n+Definition: sllist.hh:44\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00041.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00041.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: genericiterator.hh File Reference\n+dune-common: mpihelper.hh File Reference\n \n \n \n \n \n \n \n@@ -58,65 +58,72 @@\n \n \n \n \n \n
    \n \n-
    genericiterator.hh File Reference
    \n+
    mpihelper.hh File Reference
    \n
    \n
    \n \n-

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

    Helpers for dealing with MPI. \n More...

    \n-
    #include <dune/common/iteratorfacades.hh>
    \n-#include <cassert>
    \n+
    #include <cassert>
    \n+#include <mpi.h>
    \n+#include <mutex>
    \n+#include <dune/common/parallel/communication.hh>
    \n+#include <dune/common/parallel/mpicommunication.hh>
    \n+#include <dune/common/stdstreams.hh>
    \n+#include <dune/common/visibility.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n-\n+\n+\n \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n \n

    \n Classes

    struct  Dune::const_reference< R >
     Get the 'const' version of a reference to a mutable object. More...
    class  Dune::FakeMPIHelper
     A fake mpi helper. More...
     
    struct  Dune::const_reference< const R >
     
    struct  Dune::const_reference< R & >
     
    struct  Dune::const_reference< const R & >
     
    struct  Dune::mutable_reference< R >
     get the 'mutable' version of a reference to a const object More...
     
    struct  Dune::mutable_reference< const R >
     
    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::MPIHelper
     A real mpi helper. More...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n

    Detailed Description

    \n-

    Implements a generic iterator class for writing stl conformant iterators.

    \n-

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

    \n+

    Helpers for dealing with MPI.

    \n+

    Basically there are two helpers available:

    \n+
    FakeMPIHelper
    \n+
    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.
    \n+
    MPIHelper
    \n+
    A real MPI helper. When the singleton gets instantiated MPI_Init will be called and before the program exits MPI_Finalize will be called.
    \n+
    \n+

    Example of who to use these classes:

    \n+

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

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

    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;
    \n+

    .

    \n+

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

    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,48 +4,64 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n+ * parallel\n Classes | Namespaces\n-genericiterator.hh File Reference\n-Implements a generic iterator class for writing stl conformant iterators.\n-More...\n-#include \n+mpihelper.hh File Reference\n+Common \u00bb Parallel_Communication\n+Helpers for dealing with MPI. More...\n #include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::const_reference<_R_>\n-\u00a0 Get the 'const' version of a reference to a mutable object. More...\n+class \u00a0Dune::FakeMPIHelper\n+\u00a0 A fake mpi helper. More...\n \u00a0\n-struct \u00a0Dune::const_reference<_const_R_>\n-\u00a0\n-struct \u00a0Dune::const_reference<_R_&_>\n-\u00a0\n-struct \u00a0Dune::const_reference<_const_R_&_>\n-\u00a0\n-struct \u00a0Dune::mutable_reference<_R_>\n-\u00a0 get the 'mutable' version of a reference to a const object More...\n-\u00a0\n-struct \u00a0Dune::mutable_reference<_const_R_>\n-\u00a0\n-struct \u00a0Dune::mutable_reference<_R_&_>\n-\u00a0\n-struct \u00a0Dune::mutable_reference<_const_R_&_>\n-\u00a0\n- class \u00a0Dune::GenericIterator<_C,_T,_R,_D,_IteratorFacade_>\n-\u00a0 Generic class for stl-conforming iterators for container classes with\n- operator[]. More...\n+class \u00a0Dune::MPIHelper\n+\u00a0 A real mpi helper. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n ***** Detailed Description *****\n-Implements a generic iterator class for writing stl conformant iterators.\n-Using this generic iterator writing iterators for containers that implement\n-operator[] is only a matter of seconds.\n+Helpers for dealing with MPI.\n+Basically there are two helpers available:\n+ FakeMPIHelper\n+ A class adhering to the interface of MPIHelper that does not need MPI at\n+ all. This can be used to create a sequential program even if MPI is used\n+ to compile it.\n+ MPIHelper\n+ A real MPI helper. When the singleton gets instantiated MPI_Init will be\n+ called and before the program exits MPI_Finalize will be called.\n+Example of who to use these classes:\n+A program that is parallel if compiled with MPI and sequential otherwise:\n+int main(int argc, char** argv){\n+typedef Dune::MPIHelper MPIHelper;\n+MPIHelper::instance(argc, argv);\n+typename MPIHelper::MPICommunicator world =\n+MPIHelper::getCommunicator();\n+...\n+main\n+int main(int argc, char **argv)\n+Definition: mpi_collective_benchmark.cc:293\n+Dune::MPIHelper\n+A real mpi helper.\n+Definition: mpihelper.hh:179\n+If one wants to have sequential program even if the code is compiled with mpi\n+then one simply has to exchange the typedef with\n+typedef Dune::MPIHelper FakeMPIHelper;\n+.\n+For checking whether we really use MPI or just fake please use MPIHelper::\n+isFake (this is also possible at compile time!)\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00041_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: genericiterator.hh Source File\n+dune-common: mpihelper.hh Source File\n \n \n \n \n \n \n \n@@ -58,199 +58,237 @@\n \n
    \n \n \n
    \n
    \n-
    genericiterator.hh
    \n+
    mpihelper.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_GENERICITERATOR_HH
    \n-
    6#define DUNE_GENERICITERATOR_HH
    \n+
    5#ifndef DUNE_MPIHELPER
    \n+
    6#define DUNE_MPIHELPER
    \n
    7
    \n-\n+
    8#if HAVE_MPI
    \n
    9#include <cassert>
    \n-
    10
    \n-
    11namespace Dune {
    \n+
    10#include <mpi.h>
    \n+
    11#endif
    \n
    12
    \n-
    85 template<class R>
    \n-\n-
    87 {
    \n-
    88 typedef const R type;
    \n-
    89 };
    \n-
    90
    \n-
    91 template<class R>
    \n-
    92 struct const_reference<const R>
    \n-
    93 {
    \n-
    94 typedef const R type;
    \n-
    95 };
    \n-
    96
    \n-
    97 template<class R>
    \n-
    98 struct const_reference<R&>
    \n-
    99 {
    \n-
    100 typedef const R& type;
    \n-
    101 };
    \n-
    102
    \n-
    103 template<class R>
    \n-
    104 struct const_reference<const R&>
    \n-
    105 {
    \n-
    106 typedef const R& type;
    \n-
    107 };
    \n-
    108
    \n-
    114 template<class R>
    \n-\n-
    116 {
    \n-
    117 typedef R type;
    \n-
    118 };
    \n-
    119
    \n-
    120 template<class R>
    \n-
    121 struct mutable_reference<const R>
    \n-
    122 {
    \n-
    123 typedef R type;
    \n-
    124 };
    \n-
    125
    \n-
    126 template<class R>
    \n-\n-
    128 {
    \n-
    129 typedef R& type;
    \n-
    130 };
    \n-
    131
    \n-
    132 template<class R>
    \n-
    133 struct mutable_reference<const R&>
    \n-
    134 {
    \n-
    135 typedef R& type;
    \n-
    136 };
    \n-
    137
    \n-
    149 template<class C, class T, class R=T&, class D = std::ptrdiff_t,
    \n-
    150 template<class,class,class,class> class IteratorFacade=RandomAccessIteratorFacade>
    \n-\n-
    152 public IteratorFacade<GenericIterator<C,T,R,D,IteratorFacade>,T,R,D>
    \n-
    153 {
    \n-
    154 friend class GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade>;
    \n-
    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>;
    \n-
    156
    \n-
    157 typedef GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade> MutableIterator;
    \n-
    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;
    \n-
    159
    \n-
    160 public:
    \n-
    161
    \n-
    170 typedef C Container;
    \n-
    171
    \n-
    177 typedef T Value;
    \n-
    178
    \n-
    182 typedef D DifferenceType;
    \n-
    183
    \n-
    187 typedef R Reference;
    \n-
    188
    \n-
    189 // Constructors needed by the base iterators
    \n-
    190 GenericIterator() : container_(0), position_(0)
    \n-
    191 {}
    \n-
    192
    \n-\n-
    201 : container_(&cont), position_(pos)
    \n-
    202 {}
    \n-
    203
    \n-
    211 GenericIterator(const MutableIterator& other) : container_(other.container_), position_(other.position_)
    \n-
    212 {}
    \n+
    13#include <mutex>
    \n+
    14
    \n+\n+
    16#if HAVE_MPI
    \n+\n+\n+
    19#endif
    \n+\n+
    21
    \n+
    22namespace Dune
    \n+
    23{
    \n+\n+
    74 {
    \n+
    75 public:
    \n+
    80 constexpr static bool isFake = true;
    \n+
    81
    \n+\n+
    86
    \n+\n+
    94 {
    \n+
    95 static MPICommunicator comm;
    \n+
    96 return comm;
    \n+
    97 }
    \n+
    98
    \n+\n+
    106 {
    \n+
    107 return getCommunicator();
    \n+
    108 }
    \n+
    109
    \n+
    110
    \n+
    111
    \n+
    117 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
    \n+\n+
    119 {
    \n+\n+
    121 }
    \n+
    122
    \n+\n+\n+
    125 {
    \n+\n+
    127 }
    \n+
    128
    \n+
    144 DUNE_EXPORT static FakeMPIHelper& instance([[maybe_unused]] int argc,
    \n+
    145 [[maybe_unused]] char** argv)
    \n+
    146 {
    \n+
    147 return instance();
    \n+
    148 }
    \n+
    149
    \n+\n+
    151 {
    \n+
    152 static FakeMPIHelper singleton;
    \n+
    153 return singleton;
    \n+
    154 }
    \n+
    155
    \n+
    159 int rank () const { return 0; }
    \n+
    163 int size () const { return 1; }
    \n+
    164
    \n+
    165 private:
    \n+
    166 FakeMPIHelper() {}
    \n+
    167 FakeMPIHelper(const FakeMPIHelper&);
    \n+
    168 FakeMPIHelper& operator=(const FakeMPIHelper);
    \n+
    169 };
    \n+
    170
    \n+
    171#if HAVE_MPI
    \n+\n+
    179 {
    \n+
    180 public:
    \n+
    185 constexpr static bool isFake = false;
    \n+
    186
    \n+
    190 typedef MPI_Comm MPICommunicator;
    \n+
    191
    \n+\n+
    199 {
    \n+
    200 return MPI_COMM_WORLD;
    \n+
    201 }
    \n+
    202
    \n+\n+
    210 {
    \n+
    211 return MPI_COMM_SELF;
    \n+
    212 }
    \n
    213
    \n-
    223 GenericIterator(const ConstIterator& other) : container_(other.container_), position_(other.position_)
    \n-
    224 {}
    \n+
    219 [[deprecated("getCollectionCommunication is deprecated. Use getCommunication instead.")]]
    \n+\n+\n+
    222 {
    \n+\n+
    224 }
    \n
    225
    \n-
    226 // Methods needed by the forward iterator
    \n-
    227 bool equals(const MutableIterator & other) const
    \n-
    228 {
    \n-
    229 return position_ == other.position_ && container_ == other.container_;
    \n+\n+\n+
    228 {
    \n+\n
    230 }
    \n-
    231
    \n-
    232 bool equals(const ConstIterator & other) const
    \n-
    233 {
    \n-
    234 return position_ == other.position_ && container_ == other.container_;
    \n-
    235 }
    \n-
    236
    \n-\n-
    238 return container_->operator[](position_);
    \n-
    239 }
    \n-
    240
    \n-
    241 void increment(){
    \n-
    242 ++position_;
    \n-
    243 }
    \n-
    244
    \n-
    245 // Additional function needed by BidirectionalIterator
    \n-
    246 void decrement(){
    \n-
    247 --position_;
    \n-
    248 }
    \n-
    249
    \n-
    250 // Additional function needed by RandomAccessIterator
    \n-\n-
    252 return container_->operator[](position_+i);
    \n-
    253 }
    \n-
    254
    \n-\n-
    256 position_=position_+n;
    \n-
    257 }
    \n-
    258
    \n-\n-
    260 {
    \n-
    261 assert(other.container_==container_);
    \n-
    262 return other.position_ - position_;
    \n+
    246 DUNE_EXPORT static MPIHelper& instance(int& argc, char**& argv)
    \n+
    247 {
    \n+
    248 // create singleton instance
    \n+
    249 if (!instance_){
    \n+
    250 static std::mutex mutex;
    \n+
    251 std::lock_guard<std::mutex> guard(mutex);
    \n+
    252 if(!instance_)
    \n+
    253 instance_.reset(new MPIHelper(argc,argv));
    \n+
    254 }
    \n+
    255 return *instance_;
    \n+
    256 }
    \n+
    257
    \n+\n+
    259 {
    \n+
    260 if(!instance_)
    \n+
    261 DUNE_THROW(InvalidStateException, "MPIHelper not initialized! Call MPIHelper::instance(argc, argv) with arguments first.");
    \n+
    262 return *instance_;
    \n
    263 }
    \n
    264
    \n-\n-
    266 {
    \n-
    267 assert(other.container_==container_);
    \n-
    268 return other.position_ - position_;
    \n-
    269 }
    \n-
    270
    \n-
    271 private:
    \n-
    272 Container *container_;
    \n-
    273 DifferenceType position_;
    \n-
    274 };
    \n-
    275
    \n-
    278} // end namespace Dune
    \n-
    279
    \n-
    280#endif
    \n-
    This file implements iterator facade classes for writing stl conformant iterators.
    \n-
    STL namespace.
    \n+
    268 int rank () const { return rank_; }
    \n+
    272 int size () const { return size_; }
    \n+
    273
    \n+\n+
    276 {
    \n+
    277 int wasFinalized = -1;
    \n+
    278 MPI_Finalized( &wasFinalized );
    \n+
    279 if(!wasFinalized && initializedHere_)
    \n+
    280 {
    \n+
    281 MPI_Finalize();
    \n+
    282 dverb << "Called MPI_Finalize on p=" << rank_ << "!" <<std::endl;
    \n+
    283 }
    \n+
    284
    \n+
    285 }
    \n+
    286
    \n+
    287 private:
    \n+
    288 int rank_;
    \n+
    289 int size_;
    \n+
    290 bool initializedHere_;
    \n+
    291 void prevent_warning(int){}
    \n+
    292 static inline std::unique_ptr<MPIHelper> instance_ = {};
    \n+
    293
    \n+
    295 MPIHelper(int& argc, char**& argv)
    \n+
    296 : initializedHere_(false)
    \n+
    297 {
    \n+
    298 int wasInitialized = -1;
    \n+
    299 MPI_Initialized( &wasInitialized );
    \n+
    300 if(!wasInitialized)
    \n+
    301 {
    \n+
    302 rank_ = -1;
    \n+
    303 size_ = -1;
    \n+
    304 static int is_initialized = MPI_Init(&argc, &argv);
    \n+
    305 prevent_warning(is_initialized);
    \n+
    306 initializedHere_ = true;
    \n+
    307 }
    \n+
    308
    \n+
    309 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
    \n+
    310 MPI_Comm_size(MPI_COMM_WORLD,&size_);
    \n+
    311
    \n+
    312 assert( rank_ >= 0 );
    \n+
    313 assert( size_ >= 1 );
    \n+
    314
    \n+
    315 dverb << "Called MPI_Init on p=" << rank_ << "!" << std::endl;
    \n+
    316 }
    \n+
    317
    \n+
    318 MPIHelper(const MPIHelper&);
    \n+
    319 MPIHelper& operator=(const MPIHelper);
    \n+
    320 };
    \n+
    321#else // !HAVE_MPI
    \n+
    322 // We do not have MPI therefore FakeMPIHelper
    \n+
    323 // is the MPIHelper
    \n+
    328 typedef FakeMPIHelper MPIHelper;
    \n+
    329
    \n+
    330#endif // !HAVE_MPI
    \n+
    331
    \n+
    332} // end namespace Dune
    \n+
    333#endif
    \n+
    Implements an utility class that provides collective communication methods for sequential programs.
    \n+
    Implements an utility class that provides MPI's collective communication methods.
    \n+
    Standard Dune debug streams.
    \n+
    Definition of macros controlling symbol visibility at the ABI level.
    \n+
    #define DUNE_EXPORT
    Export a symbol as part of the public ABI.
    Definition: visibility.hh:20
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    DVerbType dverb(std::cout)
    Singleton of verbose debug stream.
    Definition: stdstreams.hh:116
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    Get the 'const' version of a reference to a mutable object.
    Definition: genericiterator.hh:87
    \n-
    const R type
    Definition: genericiterator.hh:88
    \n-
    const R type
    Definition: genericiterator.hh:94
    \n-
    const R & type
    Definition: genericiterator.hh:100
    \n-
    const R & type
    Definition: genericiterator.hh:106
    \n-
    get the 'mutable' version of a reference to a const object
    Definition: genericiterator.hh:116
    \n-
    R type
    Definition: genericiterator.hh:117
    \n-
    R type
    Definition: genericiterator.hh:123
    \n-
    R & type
    Definition: genericiterator.hh:129
    \n-
    Generic class for stl-conforming iterators for container classes with operator[].
    Definition: genericiterator.hh:153
    \n-
    GenericIterator(const MutableIterator &other)
    Copy constructor.
    Definition: genericiterator.hh:211
    \n-
    bool equals(const MutableIterator &other) const
    Definition: genericiterator.hh:227
    \n-
    Reference elementAt(DifferenceType i) const
    Definition: genericiterator.hh:251
    \n-
    void increment()
    Definition: genericiterator.hh:241
    \n-
    GenericIterator(const ConstIterator &other)
    Copy constructor.
    Definition: genericiterator.hh:223
    \n-
    void advance(DifferenceType n)
    Definition: genericiterator.hh:255
    \n-
    GenericIterator(Container &cont, DifferenceType pos)
    Constructor.
    Definition: genericiterator.hh:200
    \n-
    D DifferenceType
    The type of the difference between two positions.
    Definition: genericiterator.hh:182
    \n-
    R Reference
    The type of the reference to the values accessed.
    Definition: genericiterator.hh:187
    \n-
    DifferenceType distanceTo(const MutableIterator &other) const
    Definition: genericiterator.hh:259
    \n-
    C Container
    The type of container we are an iterator for.
    Definition: genericiterator.hh:170
    \n-
    T Value
    The value type of the iterator.
    Definition: genericiterator.hh:177
    \n-
    DifferenceType distanceTo(const ConstIterator &other) const
    Definition: genericiterator.hh:265
    \n-
    void decrement()
    Definition: genericiterator.hh:246
    \n-
    Reference dereference() const
    Definition: genericiterator.hh:237
    \n-
    bool equals(const ConstIterator &other) const
    Definition: genericiterator.hh:232
    \n-
    Base class for stl conformant forward iterators.
    Definition: iteratorfacades.hh:434
    \n+
    Default exception if a function was called while the object is not in a valid state for that function...
    Definition: exceptions.hh:281
    \n+
    Definition: communication.hh:46
    \n+
    Collective communication interface and sequential default implementation.
    Definition: communication.hh:100
    \n+
    A fake mpi helper.
    Definition: mpihelper.hh:74
    \n+
    static DUNE_EXPORT MPICommunicator getCommunicator()
    get the default communicator
    Definition: mpihelper.hh:93
    \n+
    int size() const
    return rank of process, i.e. one
    Definition: mpihelper.hh:163
    \n+
    static Communication< MPICommunicator > getCollectiveCommunication()
    Definition: mpihelper.hh:118
    \n+
    static MPICommunicator getLocalCommunicator()
    get a local communicator
    Definition: mpihelper.hh:105
    \n+
    No_Comm MPICommunicator
    The type of the mpi communicator.
    Definition: mpihelper.hh:85
    \n+
    static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
    Get the singleton instance of the helper.
    Definition: mpihelper.hh:144
    \n+
    static DUNE_EXPORT FakeMPIHelper & instance()
    Definition: mpihelper.hh:150
    \n+
    static Communication< MPICommunicator > getCommunication()
    Definition: mpihelper.hh:124
    \n+
    static constexpr bool isFake
    Are we fake (i.e. pretend to have MPI support but are compiled without.)
    Definition: mpihelper.hh:80
    \n+
    int rank() const
    return rank of process, i.e. zero
    Definition: mpihelper.hh:159
    \n+
    A real mpi helper.
    Definition: mpihelper.hh:179
    \n+
    int size() const
    return number of processes
    Definition: mpihelper.hh:272
    \n+
    static DUNE_EXPORT MPIHelper & instance()
    Definition: mpihelper.hh:258
    \n+
    static constexpr bool isFake
    Are we fake (i. e. pretend to have MPI support but are compiled without.
    Definition: mpihelper.hh:185
    \n+
    static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
    Get the singleton instance of the helper.
    Definition: mpihelper.hh:246
    \n+
    static Communication< MPICommunicator > getCommunication()
    Definition: mpihelper.hh:227
    \n+
    ~MPIHelper()
    calls MPI_Finalize
    Definition: mpihelper.hh:275
    \n+
    int rank() const
    return rank of process
    Definition: mpihelper.hh:268
    \n+
    MPI_Comm MPICommunicator
    The type of the mpi communicator.
    Definition: mpihelper.hh:190
    \n+
    static MPICommunicator getCommunicator()
    get the default communicator
    Definition: mpihelper.hh:198
    \n+
    static MPICommunicator getLocalCommunicator()
    get a local communicator
    Definition: mpihelper.hh:209
    \n+
    static Communication< MPICommunicator > getCollectiveCommunication()
    Definition: mpihelper.hh:221
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,269 +4,316 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-genericiterator.hh\n+ * parallel\n+mpihelper.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_GENERICITERATOR_HH\n- 6#define DUNE_GENERICITERATOR_HH\n+ 5#ifndef DUNE_MPIHELPER\n+ 6#define DUNE_MPIHELPER\n 7\n- 8#include \n+ 8#if HAVE_MPI\n 9#include \n- 10\n- 11namespace Dune {\n+ 10#include \n+ 11#endif\n 12\n- 85 template\n-86 struct const_reference\n- 87 {\n-88 typedef const R type;\n- 89 };\n- 90\n- 91 template\n-92 struct const_reference\n- 93 {\n-94 typedef const R type;\n- 95 };\n- 96\n- 97 template\n-98 struct const_reference\n- 99 {\n-100 typedef const R& type;\n- 101 };\n- 102\n- 103 template\n-104 struct const_reference\n- 105 {\n-106 typedef const R& type;\n- 107 };\n- 108\n- 114 template\n-115 struct mutable_reference\n- 116 {\n-117 typedef R type;\n- 118 };\n- 119\n- 120 template\n-121 struct mutable_reference\n- 122 {\n-123 typedef R type;\n- 124 };\n- 125\n- 126 template\n-127 struct mutable_reference\n- 128 {\n-129 typedef R& type;\n- 130 };\n- 131\n- 132 template\n-133 struct mutable_reference\n- 134 {\n-135 typedef R& type;\n- 136 };\n- 137\n- 149 template class\n-IteratorFacade=RandomAccessIteratorFacade>\n-151 class GenericIterator :\n- 152 public IteratorFacade,T,R,D>\n- 153 {\n- 154 friend class GenericIterator::type, typename\n-std::remove_const::type, typename mutable_reference::type, D,\n-IteratorFacade>;\n- 155 friend class GenericIterator::type,\n-const typename std::remove_const::type, typename const_reference::type,\n-D, IteratorFacade>;\n- 156\n- 157 typedef GenericIterator::type, typename\n-std::remove_const::type, typename mutable_reference::type, D,\n-IteratorFacade> MutableIterator;\n- 158 typedef GenericIterator::type, const\n-typename std::remove_const::type, typename const_reference::type, D,\n-IteratorFacade> ConstIterator;\n- 159\n- 160 public:\n- 161\n-170 typedef C Container;\n- 171\n-177 typedef T Value;\n- 178\n-182 typedef D DifferenceType;\n- 183\n-187 typedef R Reference;\n- 188\n- 189 // Constructors needed by the base iterators\n-190 GenericIterator() : container_(0), position_(0)\n- 191 {}\n- 192\n-200 GenericIterator(Container& cont, DifferenceType pos)\n- 201 : container_(&cont), position_(pos)\n- 202 {}\n- 203\n-211 GenericIterator(const MutableIterator& other) : container_\n-(other.container_), position_(other.position_)\n- 212 {}\n+ 13#include \n+ 14\n+ 15#include \n+ 16#if HAVE_MPI\n+ 17#include \n+ 18#include \n+ 19#endif\n+ 20#include \n+ 21\n+ 22namespace Dune\n+ 23{\n+73 class FakeMPIHelper\n+ 74 {\n+ 75 public:\n+80 constexpr static bool isFake = true;\n+ 81\n+85 typedef No_Comm MPICommunicator;\n+ 86\n+93 DUNE_EXPORT static MPICommunicator getCommunicator ()\n+ 94 {\n+ 95 static MPICommunicator comm;\n+ 96 return comm;\n+ 97 }\n+ 98\n+105 static MPICommunicator getLocalCommunicator ()\n+ 106 {\n+ 107 return getCommunicator();\n+ 108 }\n+ 109\n+ 110\n+ 111\n+ 117 [[deprecated(\"getCollectionCommunication is deprecated. Use\n+getCommunication instead.\")]]\n+118 static Communication getCollectiveCommunication()\n+ 119 {\n+ 120 return Communication(getCommunicator());\n+ 121 }\n+ 122\n+ 123 static Communication\n+124 getCommunication()\n+ 125 {\n+ 126 return Communication(getCommunicator());\n+ 127 }\n+ 128\n+144 DUNE_EXPORT static FakeMPIHelper& instance([[maybe_unused]] int argc,\n+ 145 [[maybe_unused]] char** argv)\n+ 146 {\n+ 147 return instance();\n+ 148 }\n+ 149\n+150 DUNE_EXPORT static FakeMPIHelper& instance()\n+ 151 {\n+ 152 static FakeMPIHelper singleton;\n+ 153 return singleton;\n+ 154 }\n+ 155\n+159 int rank () const { return 0; }\n+163 int size () const { return 1; }\n+ 164\n+ 165 private:\n+ 166 FakeMPIHelper() {}\n+ 167 FakeMPIHelper(const FakeMPIHelper&);\n+ 168 FakeMPIHelper& operator=(const FakeMPIHelper);\n+ 169 };\n+ 170\n+ 171#if HAVE_MPI\n+178 class MPIHelper\n+ 179 {\n+ 180 public:\n+185 constexpr static bool isFake = false;\n+ 186\n+190 typedef MPI_Comm MPICommunicator;\n+ 191\n+198 static MPICommunicator getCommunicator ()\n+ 199 {\n+ 200 return MPI_COMM_WORLD;\n+ 201 }\n+ 202\n+209 static MPICommunicator getLocalCommunicator ()\n+ 210 {\n+ 211 return MPI_COMM_SELF;\n+ 212 }\n 213\n-223 GenericIterator(const ConstIterator& other) : container_(other.container_),\n-position_(other.position_)\n- 224 {}\n+ 219 [[deprecated(\"getCollectionCommunication is deprecated. Use\n+getCommunication instead.\")]]\n+ 220 static Communication\n+221 getCollectiveCommunication()\n+ 222 {\n+ 223 return Communication(getCommunicator());\n+ 224 }\n 225\n- 226 // Methods needed by the forward iterator\n-227 bool equals(const MutableIterator & other) const\n+ 226 static Communication\n+227 getCommunication()\n 228 {\n- 229 return position_ == other.position_ && container_ == other.container_;\n+ 229 return Communication(getCommunicator());\n 230 }\n- 231\n-232 bool equals(const ConstIterator & other) const\n- 233 {\n- 234 return position_ == other.position_ && container_ == other.container_;\n- 235 }\n- 236\n-237 Reference dereference() const {\n- 238 return container_->operator[](position_);\n- 239 }\n- 240\n-241 void increment(){\n- 242 ++position_;\n- 243 }\n- 244\n- 245 // Additional function needed by BidirectionalIterator\n-246 void decrement(){\n- 247 --position_;\n- 248 }\n- 249\n- 250 // Additional function needed by RandomAccessIterator\n-251 Reference elementAt(DifferenceType i) const {\n- 252 return container_->operator[](position_+i);\n- 253 }\n- 254\n-255 void advance(DifferenceType n){\n- 256 position_=position_+n;\n- 257 }\n- 258\n-259 DifferenceType distanceTo(const MutableIterator& other) const\n- 260 {\n- 261 assert(other.container_==container_);\n- 262 return other.position_ - position_;\n+246 DUNE_EXPORT static MPIHelper& instance(int& argc, char**& argv)\n+ 247 {\n+ 248 // create singleton instance\n+ 249 if (!instance_){\n+ 250 static std::mutex mutex;\n+ 251 std::lock_guard guard(mutex);\n+ 252 if(!instance_)\n+ 253 instance_.reset(new MPIHelper(argc,argv));\n+ 254 }\n+ 255 return *instance_;\n+ 256 }\n+ 257\n+258 DUNE_EXPORT static MPIHelper& instance()\n+ 259 {\n+ 260 if(!instance_)\n+ 261 DUNE_THROW(InvalidStateException, \"MPIHelper not initialized! Call\n+MPIHelper::instance(argc, argv) with arguments first.\");\n+ 262 return *instance_;\n 263 }\n 264\n-265 DifferenceType distanceTo(const ConstIterator& other) const\n- 266 {\n- 267 assert(other.container_==container_);\n- 268 return other.position_ - position_;\n- 269 }\n- 270\n- 271 private:\n- 272 Container *container_;\n- 273 DifferenceType position_;\n- 274 };\n- 275\n- 278} // end namespace Dune\n- 279\n- 280#endif\n-iteratorfacades.hh\n-This file implements iterator facade classes for writing stl conformant\n-iterators.\n-std\n-STL namespace.\n+268 int rank () const { return rank_; }\n+272 int size () const { return size_; }\n+ 273\n+275 ~MPIHelper()\n+ 276 {\n+ 277 int wasFinalized = -1;\n+ 278 MPI_Finalized( &wasFinalized );\n+ 279 if(!wasFinalized && initializedHere_)\n+ 280 {\n+ 281 MPI_Finalize();\n+ 282 dverb << \"Called MPI_Finalize on p=\" << rank_ << \"!\" < instance_ = {};\n+ 293\n+ 295 MPIHelper(int& argc, char**& argv)\n+ 296 : initializedHere_(false)\n+ 297 {\n+ 298 int wasInitialized = -1;\n+ 299 MPI_Initialized( &wasInitialized );\n+ 300 if(!wasInitialized)\n+ 301 {\n+ 302 rank_ = -1;\n+ 303 size_ = -1;\n+ 304 static int is_initialized = MPI_Init(&argc, &argv);\n+ 305 prevent_warning(is_initialized);\n+ 306 initializedHere_ = true;\n+ 307 }\n+ 308\n+ 309 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);\n+ 310 MPI_Comm_size(MPI_COMM_WORLD,&size_);\n+ 311\n+ 312 assert( rank_ >= 0 );\n+ 313 assert( size_ >= 1 );\n+ 314\n+ 315 dverb << \"Called MPI_Init on p=\" << rank_ << \"!\" << std::endl;\n+ 316 }\n+ 317\n+ 318 MPIHelper(const MPIHelper&);\n+ 319 MPIHelper& operator=(const MPIHelper);\n+ 320 };\n+ 321#else // !HAVE_MPI\n+ 322 // We do not have MPI therefore FakeMPIHelper\n+ 323 // is the MPIHelper\n+ 328 typedef FakeMPIHelper MPIHelper;\n+ 329\n+ 330#endif // !HAVE_MPI\n+ 331\n+ 332} // end namespace Dune\n+ 333#endif\n+communication.hh\n+Implements an utility class that provides collective communication methods for\n+sequential programs.\n+mpicommunication.hh\n+Implements an utility class that provides MPI's collective communication\n+methods.\n+stdstreams.hh\n+Standard Dune debug streams.\n+visibility.hh\n+Definition of macros controlling symbol visibility at the ABI level.\n+DUNE_EXPORT\n+#define DUNE_EXPORT\n+Export a symbol as part of the public ABI.\n+Definition: visibility.hh:20\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+Dune::dverb\n+DVerbType dverb(std::cout)\n+Singleton of verbose debug stream.\n+Definition: stdstreams.hh:116\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::const_reference\n-Get the 'const' version of a reference to a mutable object.\n-Definition: genericiterator.hh:87\n-Dune::const_reference::type\n-const R type\n-Definition: genericiterator.hh:88\n-Dune::const_reference<_const_R_>::type\n-const R type\n-Definition: genericiterator.hh:94\n-Dune::const_reference<_R_&_>::type\n-const R & type\n-Definition: genericiterator.hh:100\n-Dune::const_reference<_const_R_&_>::type\n-const R & type\n-Definition: genericiterator.hh:106\n-Dune::mutable_reference\n-get the 'mutable' version of a reference to a const object\n-Definition: genericiterator.hh:116\n-Dune::mutable_reference::type\n-R type\n-Definition: genericiterator.hh:117\n-Dune::mutable_reference<_const_R_>::type\n-R type\n-Definition: genericiterator.hh:123\n-Dune::mutable_reference<_R_&_>::type\n-R & type\n-Definition: genericiterator.hh:129\n-Dune::GenericIterator\n-Generic class for stl-conforming iterators for container classes with operator\n-[].\n-Definition: genericiterator.hh:153\n-Dune::GenericIterator::GenericIterator\n-GenericIterator(const MutableIterator &other)\n-Copy constructor.\n-Definition: genericiterator.hh:211\n-Dune::GenericIterator::equals\n-bool equals(const MutableIterator &other) const\n-Definition: genericiterator.hh:227\n-Dune::GenericIterator::elementAt\n-Reference elementAt(DifferenceType i) const\n-Definition: genericiterator.hh:251\n-Dune::GenericIterator::increment\n-void increment()\n-Definition: genericiterator.hh:241\n-Dune::GenericIterator::GenericIterator\n-GenericIterator(const ConstIterator &other)\n-Copy constructor.\n-Definition: genericiterator.hh:223\n-Dune::GenericIterator::advance\n-void advance(DifferenceType n)\n-Definition: genericiterator.hh:255\n-Dune::GenericIterator::GenericIterator\n-GenericIterator(Container &cont, DifferenceType pos)\n-Constructor.\n-Definition: genericiterator.hh:200\n-Dune::GenericIterator::DifferenceType\n-D DifferenceType\n-The type of the difference between two positions.\n-Definition: genericiterator.hh:182\n-Dune::GenericIterator::Reference\n-R Reference\n-The type of the reference to the values accessed.\n-Definition: genericiterator.hh:187\n-Dune::GenericIterator::distanceTo\n-DifferenceType distanceTo(const MutableIterator &other) const\n-Definition: genericiterator.hh:259\n-Dune::GenericIterator::Container\n-C Container\n-The type of container we are an iterator for.\n-Definition: genericiterator.hh:170\n-Dune::GenericIterator::Value\n-T Value\n-The value type of the iterator.\n-Definition: genericiterator.hh:177\n-Dune::GenericIterator::distanceTo\n-DifferenceType distanceTo(const ConstIterator &other) const\n-Definition: genericiterator.hh:265\n-Dune::GenericIterator::decrement\n-void decrement()\n-Definition: genericiterator.hh:246\n-Dune::GenericIterator::dereference\n-Reference dereference() const\n-Definition: genericiterator.hh:237\n-Dune::GenericIterator::equals\n-bool equals(const ConstIterator &other) const\n-Definition: genericiterator.hh:232\n-Dune::RandomAccessIteratorFacade\n-Base class for stl conformant forward iterators.\n-Definition: iteratorfacades.hh:434\n+Dune::InvalidStateException\n+Default exception if a function was called while the object is not in a valid\n+state for that function...\n+Definition: exceptions.hh:281\n+Dune::No_Comm\n+Definition: communication.hh:46\n+Dune::Communication\n+Collective communication interface and sequential default implementation.\n+Definition: communication.hh:100\n+Dune::FakeMPIHelper\n+A fake mpi helper.\n+Definition: mpihelper.hh:74\n+Dune::FakeMPIHelper::getCommunicator\n+static DUNE_EXPORT MPICommunicator getCommunicator()\n+get the default communicator\n+Definition: mpihelper.hh:93\n+Dune::FakeMPIHelper::size\n+int size() const\n+return rank of process, i.e. one\n+Definition: mpihelper.hh:163\n+Dune::FakeMPIHelper::getCollectiveCommunication\n+static Communication< MPICommunicator > getCollectiveCommunication()\n+Definition: mpihelper.hh:118\n+Dune::FakeMPIHelper::getLocalCommunicator\n+static MPICommunicator getLocalCommunicator()\n+get a local communicator\n+Definition: mpihelper.hh:105\n+Dune::FakeMPIHelper::MPICommunicator\n+No_Comm MPICommunicator\n+The type of the mpi communicator.\n+Definition: mpihelper.hh:85\n+Dune::FakeMPIHelper::instance\n+static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)\n+Get the singleton instance of the helper.\n+Definition: mpihelper.hh:144\n+Dune::FakeMPIHelper::instance\n+static DUNE_EXPORT FakeMPIHelper & instance()\n+Definition: mpihelper.hh:150\n+Dune::FakeMPIHelper::getCommunication\n+static Communication< MPICommunicator > getCommunication()\n+Definition: mpihelper.hh:124\n+Dune::FakeMPIHelper::isFake\n+static constexpr bool isFake\n+Are we fake (i.e. pretend to have MPI support but are compiled without.)\n+Definition: mpihelper.hh:80\n+Dune::FakeMPIHelper::rank\n+int rank() const\n+return rank of process, i.e. zero\n+Definition: mpihelper.hh:159\n+Dune::MPIHelper\n+A real mpi helper.\n+Definition: mpihelper.hh:179\n+Dune::MPIHelper::size\n+int size() const\n+return number of processes\n+Definition: mpihelper.hh:272\n+Dune::MPIHelper::instance\n+static DUNE_EXPORT MPIHelper & instance()\n+Definition: mpihelper.hh:258\n+Dune::MPIHelper::isFake\n+static constexpr bool isFake\n+Are we fake (i. e. pretend to have MPI support but are compiled without.\n+Definition: mpihelper.hh:185\n+Dune::MPIHelper::instance\n+static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)\n+Get the singleton instance of the helper.\n+Definition: mpihelper.hh:246\n+Dune::MPIHelper::getCommunication\n+static Communication< MPICommunicator > getCommunication()\n+Definition: mpihelper.hh:227\n+Dune::MPIHelper::~MPIHelper\n+~MPIHelper()\n+calls MPI_Finalize\n+Definition: mpihelper.hh:275\n+Dune::MPIHelper::rank\n+int rank() const\n+return rank of process\n+Definition: mpihelper.hh:268\n+Dune::MPIHelper::MPICommunicator\n+MPI_Comm MPICommunicator\n+The type of the mpi communicator.\n+Definition: mpihelper.hh:190\n+Dune::MPIHelper::getCommunicator\n+static MPICommunicator getCommunicator()\n+get the default communicator\n+Definition: mpihelper.hh:198\n+Dune::MPIHelper::getLocalCommunicator\n+static MPICommunicator getLocalCommunicator()\n+get a local communicator\n+Definition: mpihelper.hh:209\n+Dune::MPIHelper::getCollectiveCommunication\n+static Communication< MPICommunicator > getCollectiveCommunication()\n+Definition: mpihelper.hh:221\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00044.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00044.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: enumset.hh File Reference\n+dune-common: mpicollectivecommunication.hh File Reference\n \n \n \n \n \n \n \n@@ -58,77 +58,24 @@\n \n \n \n \n \n
    \n- \n-
    enumset.hh File Reference
    \n+
    mpicollectivecommunication.hh File Reference
    \n
    \n
    \n-\n-

    Classes for building sets out of enumeration values. \n-More...

    \n-
    #include <iostream>
    \n+\n

    Go to the source code of this file.

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-Classes

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

    \n-Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-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 > &)
     
    \n-

    Detailed Description

    \n-

    Classes for building sets out of enumeration values.

    \n-
    Author
    Markus Blatt
    \n-
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,60 +4,14 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces | Functions\n-enumset.hh File Reference\n-Classes for building sets out of enumeration values. More...\n-#include \n+ * parallel\n+mpicollectivecommunication.hh File Reference\n+#include \n Go_to_the_source_code_of_this_file.\n- Classes\n-class \u00a0Dune::EmptySet<_TA_>\n-\u00a0 An empty set. More...\n-\u00a0\n-class \u00a0Dune::AllSet<_TA_>\n-\u00a0 A set containing everything. More...\n-\u00a0\n-class \u00a0Dune::EnumItem<_TA,_item_>\n-\u00a0 A set consisting only of one item. More...\n-\u00a0\n-class \u00a0Dune::EnumRange<_TA,_from,_end_>\n-\u00a0 A set representing a range including the borders. More...\n-\u00a0\n-class \u00a0Dune::NegateSet<_S_>\n-\u00a0 The negation of a set. An item is contained in the set if and only if\n- it is not contained in the negated set. More...\n-\u00a0\n-class \u00a0Dune::Combine<_TI1,_TI2,_TA_>\n-\u00a0 A set combining two other sets. More...\n-\u00a0\n- Namespaces\n-namespace \u00a0Dune\n-\u00a0 Dune namespace.\n-\u00a0\n- Functions\n-template\n- std::ostream &\u00a0Dune::operator<< (std::ostream &os,\n- const EnumItem< TA, i > &)\n-\u00a0\n-template\n- std::ostream &\u00a0Dune::operator<< (std::ostream &os,\n- const EnumRange< TA, from, to > &)\n-\u00a0\n-template\n-Combine< TI1, TI2, typename TI1::Type >\u00a0Dune::combine (const TI1 &set1, const\n- TI2 &set2)\n-\u00a0\n-template\n- std::ostream &\u00a0Dune::operator<< (std::ostream &os,\n- const Combine< TI1, TI2, T > &)\n-\u00a0\n-***** Detailed Description *****\n-Classes for building sets out of enumeration values.\n- Author\n- Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00044_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: enumset.hh Source File\n+dune-common: mpicollectivecommunication.hh Source File\n \n \n \n \n \n \n \n@@ -58,162 +58,27 @@\n \n \n \n \n \n
    \n-
    enumset.hh
    \n+
    mpicollectivecommunication.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n-
    2// vi: set et ts=4 sw=2 sts=2:
    \n-
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n-
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_ENUMSET_HH
    \n-
    6#define DUNE_ENUMSET_HH
    \n-
    7
    \n-
    8#include <iostream>
    \n-
    9
    \n-
    10namespace Dune
    \n-
    11{
    \n-
    25 template<typename TA>
    \n-\n-
    27 {
    \n-
    28 public:
    \n-
    32 typedef TA Type;
    \n-
    36 static bool contains(const Type& attribute);
    \n-
    37 };
    \n-
    38
    \n-
    42 template<typename TA>
    \n-
    43 class AllSet
    \n-
    44 {
    \n-
    45 public:
    \n-
    49 typedef TA Type;
    \n-
    53 static bool contains(const Type& attribute);
    \n-
    54 };
    \n-
    55
    \n-
    59 template<typename TA, int item>
    \n-\n-
    61 {
    \n-
    62 public:
    \n-
    66 typedef TA Type;
    \n-
    67
    \n-
    72 static bool contains(const Type& attribute);
    \n-
    73 };
    \n-
    74
    \n-
    78 template<typename TA,int from, int end>
    \n-
    79 class EnumRange //: public PODSet<EnumRange<T,from,end>,T>
    \n-
    80 {
    \n-
    81 public:
    \n-
    85 typedef TA Type;
    \n-
    86 static bool contains(const Type& item);
    \n-
    87 };
    \n-
    88
    \n-
    94 template<typename S>
    \n-\n-
    96 {
    \n-
    97 public:
    \n-
    98 typedef typename S::Type Type;
    \n-
    99
    \n-
    100 static bool contains(const Type& item)
    \n-
    101 {
    \n-
    102 return !S::contains(item);
    \n-
    103 }
    \n-
    104 };
    \n-
    105
    \n-
    109 template<class TI1, class TI2, typename TA=typename TI1::Type>
    \n-\n-
    111 {
    \n-
    112 public:
    \n-
    113 static bool contains(const TA& item);
    \n-
    114 };
    \n-
    115
    \n-
    116 template<typename TA>
    \n-
    117 inline bool EmptySet<TA>::contains([[maybe_unused]] const Type& attribute)
    \n-
    118 {
    \n-
    119 return false;
    \n-
    120 }
    \n-
    121
    \n-
    122 template<typename TA>
    \n-
    123 inline bool AllSet<TA>::contains([[maybe_unused]] const Type& attribute)
    \n-
    124 {
    \n-
    125 return true;
    \n-
    126 }
    \n-
    127
    \n-
    128 template<typename TA,int i>
    \n-
    129 inline bool EnumItem<TA,i>::contains(const Type& item)
    \n-
    130 {
    \n-
    131 return item==i;
    \n-
    132 }
    \n-
    133
    \n-
    134 template<typename TA,int i>
    \n-
    135 inline std::ostream& operator<<(std::ostream& os, const EnumItem<TA,i>&)
    \n-
    136 {
    \n-
    137 return os<<i;
    \n-
    138 }
    \n-
    139
    \n-
    140 template<typename TA, int from, int to>
    \n-
    141 inline bool EnumRange<TA,from,to>::contains(const Type& item)
    \n-
    142 {
    \n-
    143 return from<=item && item<=to;
    \n-
    144 }
    \n-
    145
    \n-
    146 template<typename TA, int from, int to>
    \n-
    147 inline std::ostream& operator<<(std::ostream& os, const EnumRange<TA,from,to>&)
    \n-
    148 {
    \n-
    149 return os<<"["<<from<<" - "<<to<<"]";
    \n-
    150 }
    \n-
    151
    \n-
    152 template<class TI1, class TI2, typename TA>
    \n-
    153 inline bool Combine<TI1,TI2,TA>::contains(const TA& item)
    \n-
    154 {
    \n-
    155 return TI1::contains(item) ||
    \n-
    156 TI2::contains(item);
    \n-
    157 }
    \n-
    158
    \n-
    159 template<class TI1, class TI2>
    \n-
    160 inline Combine<TI1,TI2,typename TI1::Type> combine([[maybe_unused]] const TI1& set1,
    \n-
    161 [[maybe_unused]] const TI2& set2)
    \n-
    162 {
    \n-\n-
    164 }
    \n-
    165
    \n-
    166 template<class TI1, class TI2, class T>
    \n-
    167 inline std::ostream& operator<<(std::ostream& os, const Combine<TI1,TI2,T>&)
    \n-
    168 {
    \n-
    169 return os << TI1()<<" "<<TI2();
    \n-
    170 }
    \n-
    172}
    \n-
    173
    \n-
    174#endif
    \n-
    static bool contains(const Type &attribute)
    Always returns true.
    Definition: enumset.hh:123
    \n-
    static bool contains(const Type &item)
    Definition: enumset.hh:141
    \n-
    static bool contains(const TA &item)
    Definition: enumset.hh:153
    \n-
    static bool contains(const Type &attribute)
    Always returns false.
    Definition: enumset.hh:117
    \n-
    static bool contains(const Type &attribute)
    Tests whether an item is in the set.
    Definition: enumset.hh:129
    \n-
    Combine< TI1, TI2, typename TI1::Type > combine(const TI1 &set1, const TI2 &set2)
    Definition: enumset.hh:160
    \n-
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition: bigunsignedint.hh:278
    \n-
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    An empty set.
    Definition: enumset.hh:27
    \n-
    TA Type
    The POD type the set holds.
    Definition: enumset.hh:32
    \n-
    A set containing everything.
    Definition: enumset.hh:44
    \n-
    TA Type
    The POD type the set holds.
    Definition: enumset.hh:49
    \n-
    A set consisting only of one item.
    Definition: enumset.hh:61
    \n-
    TA Type
    The type the set holds.
    Definition: enumset.hh:66
    \n-
    A set representing a range including the borders.
    Definition: enumset.hh:80
    \n-
    TA Type
    The type the set holds.
    Definition: enumset.hh:85
    \n-
    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
    \n-
    S::Type Type
    Definition: enumset.hh:98
    \n-
    static bool contains(const Type &item)
    Definition: enumset.hh:100
    \n-
    A set combining two other sets.
    Definition: enumset.hh:111
    \n+Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n+
    2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n+
    3// Will be removed after the 2.7 release
    \n+
    4#warning "Deprecated header, use #include <dune/common/parallel/mpicommunication.hh> instead!"
    \n+\n+
    Implements an utility class that provides MPI's collective communication methods.
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,206 +4,23 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-enumset.hh\n+ * parallel\n+mpicollectivecommunication.hh\n Go_to_the_documentation_of_this_file.\n- 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n- 2// vi: set et ts=4 sw=2 sts=2:\n- 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n+ 1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n- 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_ENUMSET_HH\n- 6#define DUNE_ENUMSET_HH\n- 7\n- 8#include \n- 9\n- 10namespace Dune\n- 11{\n- 25 template\n-26 class EmptySet\n- 27 {\n- 28 public:\n-32 typedef TA Type;\n- 36 static bool contains(const Type& attribute);\n- 37 };\n- 38\n- 42 template\n-43 class AllSet\n- 44 {\n- 45 public:\n-49 typedef TA Type;\n- 53 static bool contains(const Type& attribute);\n- 54 };\n- 55\n- 59 template\n-60 class EnumItem\n- 61 {\n- 62 public:\n-66 typedef TA Type;\n- 67\n- 72 static bool contains(const Type& attribute);\n- 73 };\n- 74\n- 78 template\n-79 class EnumRange //: public PODSet,T>\n- 80 {\n- 81 public:\n-85 typedef TA Type;\n- 86 static bool contains(const Type& item);\n- 87 };\n- 88\n- 94 template\n-95 class NegateSet\n- 96 {\n- 97 public:\n-98 typedef typename S::Type Type;\n- 99\n-100 static bool contains(const Type& item)\n- 101 {\n- 102 return !S::contains(item);\n- 103 }\n- 104 };\n- 105\n- 109 template\n-110 class Combine\n- 111 {\n- 112 public:\n- 113 static bool contains(const TA& item);\n- 114 };\n- 115\n- 116 template\n-117 inline bool EmptySet::contains([[maybe_unused]] const Type& attribute)\n- 118 {\n- 119 return false;\n- 120 }\n- 121\n- 122 template\n-123 inline bool AllSet::contains([[maybe_unused]] const Type& attribute)\n- 124 {\n- 125 return true;\n- 126 }\n- 127\n- 128 template\n-129 inline bool EnumItem::contains(const Type& item)\n- 130 {\n- 131 return item==i;\n- 132 }\n- 133\n- 134 template\n-135 inline std::ostream& operator<<(std::ostream& os, const EnumItem&)\n- 136 {\n- 137 return os<\n-141 inline bool EnumRange::contains(const Type& item)\n- 142 {\n- 143 return from<=item && item<=to;\n- 144 }\n- 145\n- 146 template\n-147 inline std::ostream& operator<<(std::ostream& os, const\n-EnumRange&)\n- 148 {\n- 149 return os<<\"[\"<\n-153 inline bool Combine::contains(const TA& item)\n- 154 {\n- 155 return TI1::contains(item) ||\n- 156 TI2::contains(item);\n- 157 }\n- 158\n- 159 template\n-160 inline Combine combine([[maybe_unused]] const\n-TI1& set1,\n- 161 [[maybe_unused]] const TI2& set2)\n- 162 {\n- 163 return Combine();\n- 164 }\n- 165\n- 166 template\n-167 inline std::ostream& operator<<(std::ostream& os, const\n-Combine&)\n- 168 {\n- 169 return os << TI1()<<\" \"< combine(const TI1 &set1, const TI2\n-&set2)\n-Definition: enumset.hh:160\n-Dune::operator<<\n-std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)\n-Definition: bigunsignedint.hh:278\n-Dune\n-Dune namespace.\n-Definition: alignedallocator.hh:13\n-Dune::EmptySet\n-An empty set.\n-Definition: enumset.hh:27\n-Dune::EmptySet::Type\n-TA Type\n-The POD type the set holds.\n-Definition: enumset.hh:32\n-Dune::AllSet\n-A set containing everything.\n-Definition: enumset.hh:44\n-Dune::AllSet::Type\n-TA Type\n-The POD type the set holds.\n-Definition: enumset.hh:49\n-Dune::EnumItem\n-A set consisting only of one item.\n-Definition: enumset.hh:61\n-Dune::EnumItem::Type\n-TA Type\n-The type the set holds.\n-Definition: enumset.hh:66\n-Dune::EnumRange\n-A set representing a range including the borders.\n-Definition: enumset.hh:80\n-Dune::EnumRange::Type\n-TA Type\n-The type the set holds.\n-Definition: enumset.hh:85\n-Dune::NegateSet\n-The negation of a set. An item is contained in the set if and only if it is not\n-contained in the nega...\n-Definition: enumset.hh:96\n-Dune::NegateSet::Type\n-S::Type Type\n-Definition: enumset.hh:98\n-Dune::NegateSet::contains\n-static bool contains(const Type &item)\n-Definition: enumset.hh:100\n-Dune::Combine\n-A set combining two other sets.\n-Definition: enumset.hh:111\n+ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n+ 3// Will be removed after the 2.7 release\n+ 4#warning \"Deprecated header, use #include instead!\"\n+ 5#include \n+mpicommunication.hh\n+Implements an utility class that provides MPI's collective communication\n+methods.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00047.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00047.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: overloadset.hh File Reference\n+dune-common: mpipack.hh File Reference\n \n \n \n \n \n \n \n@@ -58,47 +58,51 @@\n \n
    \n \n \n \n
    \n \n-
    overloadset.hh File Reference
    \n+Classes |\n+Namespaces
    \n+
    mpipack.hh File Reference
    \n \n
    \n-
    #include <utility>
    \n-#include <type_traits>
    \n-#include <dune/common/typetraits.hh>
    \n+\n+

    See MPI_Pack. \n+More...

    \n+
    #include <vector>
    \n+#include <mpi.h>
    \n+#include <dune/common/parallel/mpicommunication.hh>
    \n+#include <dune/common/parallel/mpidata.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+

    \n+Classes

    class  Dune::MPIPack
     
    struct  Dune::MPIData< P, std::enable_if_t< std::is_same< std::remove_const_t< P >, MPIPack >::value > >
     
    \n \n \n \n \n-

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n

    \n-Functions

    template<class... F>
    auto Dune::overload (F &&... f)
     Create an overload set. More...
     
    template<class... F>
    auto Dune::orderedOverload (F &&... f)
     Create an ordered overload set. More...
     
    \n-
    \n+

    Detailed Description

    \n+

    See MPI_Pack.

    \n+

    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.

    \n+
    Author
    Nils-Arne Dreier
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,29 +4,37 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Functions\n-overloadset.hh File Reference\n-#include \n-#include \n-#include \n+ * parallel\n+Classes | Namespaces\n+mpipack.hh File Reference\n+Common \u00bb Parallel_Communication\n+See MPI_Pack. More...\n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+ class \u00a0Dune::MPIPack\n+\u00a0\n+struct \u00a0Dune::MPIData<_P,_std::enable_if_t<_std::is_same<_std::remove_const_t<\n+ P_>,_MPIPack_>::value_>_>\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n- Functions\n-template\n-auto\u00a0Dune::overload (F &&... f)\n-\u00a0 Create an overload set. More...\n-\u00a0\n-template\n-auto\u00a0Dune::orderedOverload (F &&... f)\n-\u00a0 Create an ordered overload set. More...\n-\u00a0\n+***** Detailed Description *****\n+See MPI_Pack.\n+This Wrapper class takes care of the memory management and provides methods to\n+pack and unpack objects. All objects that can be used for MPI communication can\n+also be packed and unpacked to/from MPIPack.\n+ Author\n+ Nils-Arne Dreier\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00047_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: overloadset.hh Source File\n+dune-common: mpipack.hh Source File\n \n \n \n \n \n \n \n@@ -58,139 +58,235 @@\n \n \n \n \n \n
    \n-
    overloadset.hh
    \n+
    mpipack.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_OVERLOADSET_HH
    \n-
    6#define DUNE_COMMON_OVERLOADSET_HH
    \n-
    7
    \n-
    8#include <utility>
    \n-
    9#include <type_traits>
    \n-\n-
    11
    \n-
    12namespace Dune {
    \n-
    13
    \n-
    14namespace Impl {
    \n-
    15
    \n-
    16 template<typename... F>
    \n-
    17 class OverloadSet
    \n-
    18 : public F...
    \n-
    19 {
    \n-
    20
    \n-
    21 public:
    \n+
    20#ifndef DUNE_COMMON_PARALLEL_MPIPACK_HH
    \n+
    21#define DUNE_COMMON_PARALLEL_MPIPACK_HH
    \n
    22
    \n-
    23 template<typename... FF>
    \n-
    24 OverloadSet(FF&&... ff)
    \n-
    25 : F(std::forward<FF>(ff))...
    \n-
    26 {}
    \n-
    27
    \n-
    28 using F::operator()...;
    \n+
    23#include <vector>
    \n+
    24#if HAVE_MPI
    \n+
    25#include <mpi.h>
    \n+\n+\n+
    28
    \n
    29
    \n-
    30 };
    \n+
    30namespace Dune {
    \n
    31
    \n-
    32} // end namespace Impl
    \n-
    33
    \n-
    34
    \n-
    35
    \n-
    60template<class... F>
    \n-
    61auto overload(F&&... f)
    \n-
    62{
    \n-
    63 return Impl::OverloadSet<std::decay_t<F>...>(std::forward<F>(f)...);
    \n-
    64}
    \n-
    65
    \n-
    66
    \n-
    67
    \n-
    68namespace Impl {
    \n-
    69
    \n-
    70 template<class F0, class... F>
    \n-
    71 class OrderedOverloadSet: public OrderedOverloadSet<F...>, F0
    \n-
    72 {
    \n-
    73 using Base = OrderedOverloadSet<F...>;
    \n-
    74 public:
    \n+
    32 class MPIPack {
    \n+
    33 std::vector<char> _buffer;
    \n+
    34 int _position;
    \n+
    35 MPI_Comm _comm;
    \n+
    36
    \n+
    37 friend struct MPIData<MPIPack>;
    \n+
    38 friend struct MPIData<const MPIPack>;
    \n+
    39 public:
    \n+
    40 MPIPack(Communication<MPI_Comm> comm, std::size_t size = 0)
    \n+
    41 : _buffer(size)
    \n+
    42 , _position(0)
    \n+
    43 , _comm(comm)
    \n+
    44 {}
    \n+
    45
    \n+
    46 // Its not valid to copy a MPIPack but you can move it
    \n+
    47 MPIPack(const MPIPack&) = delete;
    \n+
    48 MPIPack& operator = (const MPIPack& other) = delete;
    \n+
    49 MPIPack(MPIPack&&) = default;
    \n+
    50 MPIPack& operator = (MPIPack&& other) = default;
    \n+
    51
    \n+
    57 template<class T>
    \n+
    58 void pack(const T& data){
    \n+
    59 auto mpidata = getMPIData(data);
    \n+
    60 int size = getPackSize(mpidata.size(), _comm, mpidata.type());
    \n+
    61 constexpr bool has_static_size = decltype(getMPIData(std::declval<T&>()))::static_size;
    \n+
    62 if(!has_static_size)
    \n+
    63 size += getPackSize(1, _comm, MPI_INT);
    \n+
    64 if (_position + size > 0 && size_t(_position + size) > _buffer.size()) // resize buffer if necessary
    \n+
    65 _buffer.resize(_position + size);
    \n+
    66 if(!has_static_size){
    \n+
    67 int size = mpidata.size();
    \n+
    68 MPI_Pack(&size, 1, MPI_INT, _buffer.data(), _buffer.size(),
    \n+
    69 &_position, _comm);
    \n+
    70 }
    \n+
    71 MPI_Pack(mpidata.ptr(), mpidata.size(),
    \n+
    72 mpidata.type(), _buffer.data(), _buffer.size(),
    \n+
    73 &_position, _comm);
    \n+
    74 }
    \n
    75
    \n-
    76 template<class FF0, class... FF>
    \n-
    77 OrderedOverloadSet(FF0&& f0, FF&&... ff) :
    \n-
    78 Base(std::forward<FF>(ff)...),
    \n-
    79 F0(std::forward<FF0>(f0))
    \n-
    80 {}
    \n-
    81
    \n-
    82 // Forward to operator() of F0 if it can be called with the given arguments.
    \n-
    83 template<class... Args,
    \n-
    84 std::enable_if_t<IsCallable<F0(Args&&...)>::value, int> = 0>
    \n-
    85 decltype(auto) operator()(Args&&... args)
    \n-
    86 {
    \n-
    87 return F0::operator()(std::forward<Args>(args)...);
    \n+
    80 template<class T>
    \n+
    81 auto /*void*/ unpack(T& data)
    \n+
    82 -> std::enable_if_t<decltype(getMPIData(data))::static_size, void>
    \n+
    83 {
    \n+
    84 auto mpidata = getMPIData(data);
    \n+
    85 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
    \n+
    86 mpidata.ptr(), mpidata.size(),
    \n+
    87 mpidata.type(), _comm);
    \n
    88 }
    \n
    89
    \n-
    90 // Forward to operator() of base class if F0 cannot be called with the given
    \n-
    91 // arguments. In this case the base class will successively try operator()
    \n-
    92 // of all F... .
    \n-
    93 template<class... Args,
    \n-
    94 std::enable_if_t<not IsCallable<F0(Args&&...)>::value, int> = 0>
    \n-
    95 decltype(auto) operator()(Args&&... args)
    \n-
    96 {
    \n-
    97 return Base::operator()(std::forward<Args>(args)...);
    \n-
    98 }
    \n-
    99
    \n-
    100 };
    \n-
    101
    \n-
    102 template<class F0>
    \n-
    103 class OrderedOverloadSet<F0>: public F0
    \n-
    104 {
    \n-
    105 public:
    \n-
    106
    \n-
    107 template<class FF0>
    \n-
    108 OrderedOverloadSet(FF0&& f0) :
    \n-
    109 F0(std::forward<FF0>(f0))
    \n-
    110 {}
    \n-
    111
    \n-
    112 // Forward to operator() of F0. If it cannot be called with
    \n-
    113 // the given arguments a static assertion will fail.
    \n-
    114 template<class... Args>
    \n-
    115 decltype(auto) operator()(Args&&... args)
    \n-
    116 {
    \n-
    117 static_assert(IsCallable<F0(Args&&...)>::value,
    \n-
    118 "No matching overload found in OrderedOverloadSet");
    \n-
    119 return F0::operator()(std::forward<Args>(args)...);
    \n-
    120 }
    \n-
    121 };
    \n-
    122
    \n-
    123} // end namespace Impl
    \n-
    124
    \n-
    125
    \n-
    126
    \n-
    149template<class... F>
    \n-
    150auto orderedOverload(F&&... f)
    \n-
    151{
    \n-
    152 return Impl::OrderedOverloadSet<std::decay_t<F>...>(std::forward<F>(f)...);
    \n-
    153}
    \n-
    154
    \n-
    155
    \n+
    94 template<class T>
    \n+
    95 auto /*void*/ unpack(T& data)
    \n+
    96 -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void>
    \n+
    97 {
    \n+
    98 auto mpidata = getMPIData(data);
    \n+
    99 int size = 0;
    \n+
    100 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
    \n+
    101 &size, 1,
    \n+
    102 MPI_INT, _comm);
    \n+
    103 mpidata.resize(size);
    \n+
    104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,
    \n+
    105 mpidata.ptr(), mpidata.size(),
    \n+
    106 mpidata.type(), _comm);
    \n+
    107 }
    \n+
    108
    \n+
    109
    \n+
    111 template<typename T>
    \n+
    112 friend MPIPack& operator << (MPIPack& p, const T& t){
    \n+
    113 p.pack(t);
    \n+
    114 return p;
    \n+
    115 }
    \n+
    116
    \n+
    118 template<typename T>
    \n+
    119 friend MPIPack& operator >> (MPIPack& p, T& t){
    \n+
    120 p.unpack(t);
    \n+
    121 return p;
    \n+
    122 }
    \n+
    123
    \n+
    125 template<typename T>
    \n+
    126 MPIPack& read(T& t){
    \n+
    127 unpack(t);
    \n+
    128 return *this;
    \n+
    129 }
    \n+
    130
    \n+
    132 template<typename T>
    \n+
    133 MPIPack& write(const T& t){
    \n+
    134 pack(t);
    \n+
    135 return *this;
    \n+
    136 }
    \n+
    137
    \n+
    141 void resize(size_t size){
    \n+
    142 _buffer.resize(size);
    \n+
    143 }
    \n+
    144
    \n+
    147 void enlarge(int s) {
    \n+
    148 _buffer.resize(_buffer.size() + s);
    \n+
    149 }
    \n+
    150
    \n+
    153 size_t size() const {
    \n+
    154 return _buffer.size();
    \n+
    155 }
    \n
    156
    \n-
    157} // end namespace Dune
    \n-
    158
    \n-
    159#endif // DUNE_COMMON_OVERLOADSET_HH
    \n-
    Traits for type conversions and type information.
    \n-
    auto orderedOverload(F &&... f)
    Create an ordered overload set.
    Definition: overloadset.hh:150
    \n-
    auto overload(F &&... f)
    Create an overload set.
    Definition: overloadset.hh:61
    \n+
    160 void seek(int p){
    \n+
    161 _position = p;
    \n+
    162 }
    \n+
    163
    \n+
    167 int tell() const{
    \n+
    168 return _position;
    \n+
    169 }
    \n+
    170
    \n+
    173 bool eof() const{
    \n+
    174 return std::size_t(_position)==_buffer.size();
    \n+
    175 }
    \n+
    176
    \n+
    180 static int getPackSize(int len, const MPI_Comm& comm, const MPI_Datatype& dt){
    \n+
    181 int size;
    \n+
    182 MPI_Pack_size(len, dt, comm, &size);
    \n+
    183 return size;
    \n+
    184 }
    \n+
    185
    \n+
    186 friend bool operator==(const MPIPack& a, const MPIPack& b) {
    \n+
    187 return a._buffer == b._buffer && a._comm == b._comm;
    \n+
    188 }
    \n+
    189 friend bool operator!=(const MPIPack& a, const MPIPack& b) {
    \n+
    190 return !(a==b);
    \n+
    191 }
    \n+
    192
    \n+
    193 };
    \n+
    194
    \n+
    195 template<class P>
    \n+
    196 struct MPIData<P, std::enable_if_t<std::is_same<std::remove_const_t<P>, MPIPack>::value>> {
    \n+
    197 protected:
    \n+
    198 friend auto getMPIData<P>(P& t);
    \n+
    199 MPIData(P& t) :
    \n+
    200 data_(t)
    \n+
    201 {}
    \n+
    202 public:
    \n+
    203 static constexpr bool static_size = std::is_const<P>::value;
    \n+
    204
    \n+
    205 void* ptr() {
    \n+
    206 return (void*) data_._buffer.data();
    \n+
    207 }
    \n+
    208
    \n+
    209 int size() {
    \n+
    210 return data_.size();
    \n+
    211 }
    \n+
    212
    \n+
    213 MPI_Datatype type() const{
    \n+
    214 return MPI_PACKED;
    \n+
    215 }
    \n+
    216
    \n+
    217 void resize(int size){
    \n+
    218 data_.resize(size);
    \n+
    219 }
    \n+
    220 protected:
    \n+\n+
    222 };
    \n+
    223
    \n+
    224} // end namespace Dune
    \n+
    225
    \n+
    226#endif
    \n+
    227#endif
    \n+
    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
    \n+
    Implements an utility class that provides MPI's collective communication methods.
    \n
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    auto getMPIData(T &t)
    Definition: mpidata.hh:43
    \n+
    Specialization of Communication for MPI.
    Definition: mpicommunication.hh:108
    \n+
    Definition: mpidata.hh:50
    \n+
    T & data_
    Definition: mpidata.hh:53
    \n+
    int size() const
    Definition: mpidata.hh:67
    \n+
    static constexpr bool static_size
    Definition: mpidata.hh:65
    \n+
    Definition: mpipack.hh:32
    \n+
    void enlarge(int s)
    Enlarges the internal buffer.
    Definition: mpipack.hh:147
    \n+
    friend MPIPack & operator>>(MPIPack &p, T &t)
    Unpacks data from the object.
    Definition: mpipack.hh:119
    \n+
    friend MPIPack & operator<<(MPIPack &p, const T &t)
    Packs the data into the object. Enlarges the internal buffer if necessary.
    Definition: mpipack.hh:112
    \n+
    friend bool operator!=(const MPIPack &a, const MPIPack &b)
    Definition: mpipack.hh:189
    \n+
    size_t size() const
    Returns the size of the internal buffer.
    Definition: mpipack.hh:153
    \n+
    MPIPack & operator=(const MPIPack &other)=delete
    \n+
    MPIPack(Communication< MPI_Comm > comm, std::size_t size=0)
    Definition: mpipack.hh:40
    \n+
    void pack(const T &data)
    Packs the data into the object. Enlarges the internal buffer if necessary.
    Definition: mpipack.hh:58
    \n+
    auto unpack(T &data) -> std::enable_if_t<!decltype(getMPIData(data))::static_size, void >
    Unpacks data from the object.
    Definition: mpipack.hh:95
    \n+
    auto unpack(T &data) -> std::enable_if_t< decltype(getMPIData(data))::static_size, void >
    Unpacks data from the object.
    Definition: mpipack.hh:81
    \n+
    friend bool operator==(const MPIPack &a, const MPIPack &b)
    Definition: mpipack.hh:186
    \n+
    MPIPack(const MPIPack &)=delete
    \n+
    void seek(int p)
    Sets the position in the buffer where the next pack/unpack operation should take place.
    Definition: mpipack.hh:160
    \n+
    bool eof() const
    Checks whether the end of the buffer is reached.
    Definition: mpipack.hh:173
    \n+
    void resize(size_t size)
    Resizes the internal buffer.
    Definition: mpipack.hh:141
    \n+
    int tell() const
    Gets the position in the buffer where the next pack/unpack operation should take place.
    Definition: mpipack.hh:167
    \n+
    MPIPack(MPIPack &&)=default
    \n+
    MPIPack & read(T &t)
    Unpacks data from the object.
    Definition: mpipack.hh:126
    \n+
    static int getPackSize(int len, const MPI_Comm &comm, const MPI_Datatype &dt)
    Returns the size of the data needed to store the data in an MPIPack. See MPI_Pack_size.
    Definition: mpipack.hh:180
    \n+
    MPIPack & write(const T &t)
    Packs the data into the object. Enlarges the internal buffer if necessary.
    Definition: mpipack.hh:133
    \n+\n+\n+\n+\n+\n+\n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,144 +4,325 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-overloadset.hh\n+ * parallel\n+mpipack.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_OVERLOADSET_HH\n- 6#define DUNE_COMMON_OVERLOADSET_HH\n- 7\n- 8#include \n- 9#include \n- 10#include \n- 11\n- 12namespace Dune {\n- 13\n- 14namespace Impl {\n- 15\n- 16 template\n- 17 class OverloadSet\n- 18 : public F...\n- 19 {\n- 20\n- 21 public:\n+ 20#ifndef DUNE_COMMON_PARALLEL_MPIPACK_HH\n+ 21#define DUNE_COMMON_PARALLEL_MPIPACK_HH\n 22\n- 23 template\n- 24 OverloadSet(FF&&... ff)\n- 25 : F(std::forward(ff))...\n- 26 {}\n- 27\n- 28 using F::operator()...;\n+ 23#include \n+ 24#if HAVE_MPI\n+ 25#include \n+ 26#include \n+ 27#include \n+ 28\n 29\n- 30 };\n+ 30namespace Dune {\n 31\n- 32} // end namespace Impl\n- 33\n- 34\n- 35\n- 60template\n-61auto overload(F&&... f)\n- 62{\n- 63 return Impl::OverloadSet...>(std::forward(f)...);\n- 64}\n- 65\n- 66\n- 67\n- 68namespace Impl {\n- 69\n- 70 template\n- 71 class OrderedOverloadSet: public OrderedOverloadSet, F0\n- 72 {\n- 73 using Base = OrderedOverloadSet;\n- 74 public:\n+32 class MPIPack {\n+ 33 std::vector _buffer;\n+ 34 int _position;\n+35 MPI_Comm _comm;\n+ 36\n+ 37 friend struct MPIData;\n+ 38 friend struct MPIData;\n+ 39 public:\n+40 MPIPack(Communication comm, std::size_t size = 0)\n+ 41 : _buffer(size)\n+ 42 , _position(0)\n+ 43 , _comm(comm)\n+ 44 {}\n+ 45\n+ 46 // Its not valid to copy a MPIPack but you can move it\n+47 MPIPack(const MPIPack&) = delete;\n+48 MPIPack& operator_=(const MPIPack& other) = delete;\n+49 MPIPack(MPIPack&&) = default;\n+50 MPIPack& operator_=(MPIPack&& other) = default;\n+ 51\n+ 57 template\n+58 void pack(const T& data){\n+ 59 auto mpidata = getMPIData(data);\n+ 60 int size = getPackSize(mpidata.size(), _comm, mpidata.type());\n+ 61 constexpr bool has_static_size = decltype(getMPIData(std::declval()))::\n+static_size;\n+ 62 if(!has_static_size)\n+ 63 size += getPackSize(1, _comm, MPI_INT);\n+ 64 if (_position + size > 0 && size_t(_position + size) > _buffer.size()) /\n+/ resize buffer if necessary\n+ 65 _buffer.resize(_position + size);\n+ 66 if(!has_static_size){\n+ 67 int size = mpidata.size();\n+ 68 MPI_Pack(&size, 1, MPI_INT, _buffer.data(), _buffer.size(),\n+ 69 &_position, _comm);\n+ 70 }\n+ 71 MPI_Pack(mpidata.ptr(), mpidata.size(),\n+ 72 mpidata.type(), _buffer.data(), _buffer.size(),\n+ 73 &_position, _comm);\n+ 74 }\n 75\n- 76 template\n- 77 OrderedOverloadSet(FF0&& f0, FF&&... ff) :\n- 78 Base(std::forward(ff)...),\n- 79 F0(std::forward(f0))\n- 80 {}\n- 81\n- 82 // Forward to operator() of F0 if it can be called with the given\n-arguments.\n- 83 template::value, int> = 0>\n- 85 decltype(auto) operator()(Args&&... args)\n- 86 {\n- 87 return F0::operator()(std::forward(args)...);\n+ 80 template\n+81 auto /*void*/ unpack(T& data)\n+ 82 -> std::enable_if_t\n+ 83 {\n+ 84 auto mpidata = getMPIData(data);\n+ 85 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,\n+ 86 mpidata.ptr(), mpidata.size(),\n+ 87 mpidata.type(), _comm);\n 88 }\n 89\n- 90 // Forward to operator() of base class if F0 cannot be called with the\n-given\n- 91 // arguments. In this case the base class will successively try operator()\n- 92 // of all F... .\n- 93 template::value, int> = 0>\n- 95 decltype(auto) operator()(Args&&... args)\n- 96 {\n- 97 return Base::operator()(std::forward(args)...);\n- 98 }\n- 99\n- 100 };\n- 101\n- 102 template\n- 103 class OrderedOverloadSet: public F0\n- 104 {\n- 105 public:\n- 106\n- 107 template\n- 108 OrderedOverloadSet(FF0&& f0) :\n- 109 F0(std::forward(f0))\n- 110 {}\n- 111\n- 112 // Forward to operator() of F0. If it cannot be called with\n- 113 // the given arguments a static assertion will fail.\n- 114 template\n- 115 decltype(auto) operator()(Args&&... args)\n- 116 {\n- 117 static_assert(IsCallable::value,\n- 118 \"No matching overload found in OrderedOverloadSet\");\n- 119 return F0::operator()(std::forward(args)...);\n- 120 }\n- 121 };\n- 122\n- 123} // end namespace Impl\n- 124\n- 125\n- 126\n- 149template\n-150auto orderedOverload(F&&... f)\n- 151{\n- 152 return Impl::OrderedOverloadSet...>(std::forward\n-(f)...);\n- 153}\n- 154\n- 155\n+ 94 template\n+95 auto /*void*/ unpack(T& data)\n+ 96 -> std::enable_if_t\n+ 97 {\n+ 98 auto mpidata = getMPIData(data);\n+ 99 int size = 0;\n+ 100 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,\n+ 101 &size, 1,\n+ 102 MPI_INT, _comm);\n+ 103 mpidata.resize(size);\n+ 104 MPI_Unpack(_buffer.data(), _buffer.size(), &_position,\n+ 105 mpidata.ptr(), mpidata.size(),\n+ 106 mpidata.type(), _comm);\n+ 107 }\n+ 108\n+ 109\n+ 111 template\n+112 friend MPIPack& operator_<<(MPIPack& p, const T& t){\n+ 113 p.pack(t);\n+ 114 return p;\n+ 115 }\n+ 116\n+ 118 template\n+119 friend MPIPack& operator_>>(MPIPack& p, T& t){\n+ 120 p.unpack(t);\n+ 121 return p;\n+ 122 }\n+ 123\n+ 125 template\n+126 MPIPack& read(T& t){\n+ 127 unpack(t);\n+ 128 return *this;\n+ 129 }\n+ 130\n+ 132 template\n+133 MPIPack& write(const T& t){\n+ 134 pack(t);\n+ 135 return *this;\n+ 136 }\n+ 137\n+141 void resize(size_t size){\n+ 142 _buffer.resize(size);\n+ 143 }\n+ 144\n+147 void enlarge(int s) {\n+ 148 _buffer.resize(_buffer.size() + s);\n+ 149 }\n+ 150\n+153 size_t size() const {\n+ 154 return _buffer.size();\n+ 155 }\n 156\n- 157} // end namespace Dune\n- 158\n- 159#endif // DUNE_COMMON_OVERLOADSET_HH\n-typetraits.hh\n-Traits for type conversions and type information.\n-Dune::orderedOverload\n-auto orderedOverload(F &&... f)\n-Create an ordered overload set.\n-Definition: overloadset.hh:150\n-Dune::overload\n-auto overload(F &&... f)\n-Create an overload set.\n-Definition: overloadset.hh:61\n+160 void seek(int p){\n+ 161 _position = p;\n+ 162 }\n+ 163\n+167 int tell() const{\n+ 168 return _position;\n+ 169 }\n+ 170\n+173 bool eof() const{\n+ 174 return std::size_t(_position)==_buffer.size();\n+ 175 }\n+ 176\n+180 static int getPackSize(int len, const MPI_Comm& comm, const MPI_Datatype&\n+dt){\n+ 181 int size;\n+ 182 MPI_Pack_size(len, dt, comm, &size);\n+ 183 return size;\n+ 184 }\n+ 185\n+186 friend bool operator==(const MPIPack& a, const MPIPack& b) {\n+ 187 return a._buffer == b._buffer && a._comm == b._comm;\n+ 188 }\n+189 friend bool operator!=(const MPIPack& a, const MPIPack& b) {\n+ 190 return !(a==b);\n+ 191 }\n+ 192\n+ 193 };\n+ 194\n+ 195 template\n+196 struct MPIData,\n+MPIPack>::value>> {\n+ 197 protected:\n+198 friend auto getMPIData

    (P& t);\n+199 MPIData(P& t) :\n+ 200 data_(t)\n+ 201 {}\n+ 202 public:\n+203 static constexpr bool static_size = std::is_const

    ::value;\n+ 204\n+205 void* ptr() {\n+ 206 return (void*) data_._buffer.data();\n+ 207 }\n+ 208\n+209 int size() {\n+ 210 return data_.size();\n+ 211 }\n+ 212\n+213 MPI_Datatype type() const{\n+ 214 return MPI_PACKED;\n+ 215 }\n+ 216\n+217 void resize(int size){\n+ 218 data_.resize(size);\n+ 219 }\n+ 220 protected:\n+221 P& data_;\n+ 222 };\n+ 223\n+ 224} // end namespace Dune\n+ 225\n+ 226#endif\n+ 227#endif\n+mpidata.hh\n+Interface class to translate objects to a MPI_Datatype, void* and size used for\n+MPI calls.\n+mpicommunication.hh\n+Implements an utility class that provides MPI's collective communication\n+methods.\n std\n STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n+Dune::getMPIData\n+auto getMPIData(T &t)\n+Definition: mpidata.hh:43\n+Dune::Communication<_MPI_Comm_>\n+Specialization of Communication for MPI.\n+Definition: mpicommunication.hh:108\n+Dune::MPIData\n+Definition: mpidata.hh:50\n+Dune::MPIData::data_\n+T & data_\n+Definition: mpidata.hh:53\n+Dune::MPIData::size\n+int size() const\n+Definition: mpidata.hh:67\n+Dune::MPIData::static_size\n+static constexpr bool static_size\n+Definition: mpidata.hh:65\n+Dune::MPIPack\n+Definition: mpipack.hh:32\n+Dune::MPIPack::enlarge\n+void enlarge(int s)\n+Enlarges the internal buffer.\n+Definition: mpipack.hh:147\n+Dune::MPIPack::operator>>\n+friend MPIPack & operator>>(MPIPack &p, T &t)\n+Unpacks data from the object.\n+Definition: mpipack.hh:119\n+Dune::MPIPack::operator<<\n+friend MPIPack & operator<<(MPIPack &p, const T &t)\n+Packs the data into the object. Enlarges the internal buffer if necessary.\n+Definition: mpipack.hh:112\n+Dune::MPIPack::operator!=\n+friend bool operator!=(const MPIPack &a, const MPIPack &b)\n+Definition: mpipack.hh:189\n+Dune::MPIPack::size\n+size_t size() const\n+Returns the size of the internal buffer.\n+Definition: mpipack.hh:153\n+Dune::MPIPack::operator=\n+MPIPack & operator=(const MPIPack &other)=delete\n+Dune::MPIPack::MPIPack\n+MPIPack(Communication< MPI_Comm > comm, std::size_t size=0)\n+Definition: mpipack.hh:40\n+Dune::MPIPack::pack\n+void pack(const T &data)\n+Packs the data into the object. Enlarges the internal buffer if necessary.\n+Definition: mpipack.hh:58\n+Dune::MPIPack::unpack\n+auto unpack(T &data) -> std::enable_if_t\n+Unpacks data from the object.\n+Definition: mpipack.hh:95\n+Dune::MPIPack::unpack\n+auto unpack(T &data) -> std::enable_if_t< decltype(getMPIData(data))::\n+static_size, void >\n+Unpacks data from the object.\n+Definition: mpipack.hh:81\n+Dune::MPIPack::operator==\n+friend bool operator==(const MPIPack &a, const MPIPack &b)\n+Definition: mpipack.hh:186\n+Dune::MPIPack::MPIPack\n+MPIPack(const MPIPack &)=delete\n+Dune::MPIPack::seek\n+void seek(int p)\n+Sets the position in the buffer where the next pack/unpack operation should\n+take place.\n+Definition: mpipack.hh:160\n+Dune::MPIPack::eof\n+bool eof() const\n+Checks whether the end of the buffer is reached.\n+Definition: mpipack.hh:173\n+Dune::MPIPack::resize\n+void resize(size_t size)\n+Resizes the internal buffer.\n+Definition: mpipack.hh:141\n+Dune::MPIPack::tell\n+int tell() const\n+Gets the position in the buffer where the next pack/unpack operation should\n+take place.\n+Definition: mpipack.hh:167\n+Dune::MPIPack::MPIPack\n+MPIPack(MPIPack &&)=default\n+Dune::MPIPack::read\n+MPIPack & read(T &t)\n+Unpacks data from the object.\n+Definition: mpipack.hh:126\n+Dune::MPIPack::getPackSize\n+static int getPackSize(int len, const MPI_Comm &comm, const MPI_Datatype &dt)\n+Returns the size of the data needed to store the data in an MPIPack. See\n+MPI_Pack_size.\n+Definition: mpipack.hh:180\n+Dune::MPIPack::write\n+MPIPack & write(const T &t)\n+Packs the data into the object. Enlarges the internal buffer if necessary.\n+Definition: mpipack.hh:133\n+Dune::MPIData<_P,_std::enable_if_t<_std::is_same<_std::remove_const_t<_P_>,\n+MPIPack_>::value_>_>::type\n+MPI_Datatype type() const\n+Definition: mpipack.hh:213\n+Dune::MPIData<_P,_std::enable_if_t<_std::is_same<_std::remove_const_t<_P_>,\n+MPIPack_>::value_>_>::MPIData\n+MPIData(P &t)\n+Definition: mpipack.hh:199\n+Dune::MPIData<_P,_std::enable_if_t<_std::is_same<_std::remove_const_t<_P_>,\n+MPIPack_>::value_>_>::size\n+int size()\n+Definition: mpipack.hh:209\n+Dune::MPIData<_P,_std::enable_if_t<_std::is_same<_std::remove_const_t<_P_>,\n+MPIPack_>::value_>_>::ptr\n+void * ptr()\n+Definition: mpipack.hh:205\n+Dune::MPIData<_P,_std::enable_if_t<_std::is_same<_std::remove_const_t<_P_>,\n+MPIPack_>::value_>_>::data_\n+P & data_\n+Definition: mpipack.hh:221\n+Dune::MPIData<_P,_std::enable_if_t<_std::is_same<_std::remove_const_t<_P_>,\n+MPIPack_>::value_>_>::resize\n+void resize(int size)\n+Definition: mpipack.hh:217\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00050.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00050.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: stdstreams.hh File Reference\n+dune-common: future.hh File Reference\n \n \n \n \n \n \n \n@@ -58,89 +58,49 @@\n \n \n \n

    \n \n
    \n \n-
    stdstreams.hh File Reference
    \n+Classes |\n+Namespaces
    \n+
    future.hh File Reference
    \n \n
    \n-\n-

    Standard Dune debug streams. \n-More...

    \n-
    #include "debugstream.hh"
    \n+
    #include <memory>
    \n+#include <dune/common/exceptions.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+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 >
     
    \n \n \n \n \n-

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-

    \n-Macros

    #define DUNE_MINIMAL_DEBUG_LEVEL   4
     The default minimum debug level. More...
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-Typedefs

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

    \n-Variables

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

    Detailed Description

    \n-

    Standard Dune debug streams.

    \n-

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

    \n-
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,78 +4,35 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Macros | Typedefs | Variables\n-stdstreams.hh File Reference\n-Standard Dune debug streams. More...\n-#include \"debugstream.hh\"\n+ * parallel\n+Classes | Namespaces\n+future.hh File Reference\n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Namespaces\n-namespace \u00a0Dune\n-\u00a0 Dune namespace.\n-\u00a0\n- Macros\n-#define\u00a0DUNE_MINIMAL_DEBUG_LEVEL\u00a0\u00a0\u00a04\n-\u00a0 The default minimum debug level. More...\n-\u00a0\n- Typedefs\n- typedef DebugStream<\n- VERY_VERBOSE_DEBUG_LEVEL,\n- MINIMAL_DEBUG_LEVEL >\u00a0Dune::DVVerbType\n-\u00a0 Type of very verbose debug stream.\n- More...\n-\u00a0\n- typedef DebugStream<\n-VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL\n- >\u00a0Dune::DVerbType\n-\u00a0 Type of more verbose debug stream.\n- More...\n-\u00a0\n- typedef DebugStream< INFO_DEBUG_LEVEL,\n- MINIMAL_DEBUG_LEVEL >\u00a0Dune::DInfoType\n-\u00a0 Type of debug stream with info level.\n- More...\n-\u00a0\n- typedef DebugStream< WARN_DEBUG_LEVEL,\n- MINIMAL_DEBUG_LEVEL >\u00a0Dune::DWarnType\n-\u00a0 Type of debug stream with warn level.\n- More...\n+ Classes\n+class \u00a0Dune::InvalidFutureException\n+ This exception is thrown when ready(), wait() or get() is called on an\n+\u00a0 invalid future. A future is valid until get() is called and if it is\n+ not default-constructed and it was not moved from. More...\n+\u00a0\n+class \u00a0Dune::Future<_T_>\n+\u00a0 Type-erasure for future-like objects. A future-like object is a object\n+ satisfying the interface of FutureBase. More...\n \u00a0\n- typedef DebugStream< GRAVE_DEBUG_LEVEL,\n- MINIMAL_DEBUG_LEVEL >\u00a0Dune::DGraveType\n-\u00a0 Type of debug stream for fatal errors.\n- More...\n+class \u00a0Dune::PseudoFuture<_T_>\n+\u00a0 A wrapper-class for a object which is ready immediately. More...\n \u00a0\n- typedef DebugStream< 1 >\u00a0Dune::DErrType\n-\u00a0 The type of the stream used for error\n- messages. More...\n+class \u00a0Dune::PseudoFuture<_void_>\n \u00a0\n- Variables\n-static const DebugLevel\u00a0Dune::MINIMAL_DEBUG_LEVEL = DUNE_MINIMAL_DEBUG_LEVEL\n-\u00a0\n-static const DebugLevel\u00a0Dune::VERY_VERBOSE_DEBUG_LEVEL = 1\n-\u00a0 The level of the very verbose debug stream. More...\n-\u00a0\n-static const DebugLevel\u00a0Dune::VERBOSE_DEBUG_LEVEL = 2\n-\u00a0 The level of the verbose debug stream. More...\n-\u00a0\n-static const DebugLevel\u00a0Dune::INFO_DEBUG_LEVEL = 3\n-\u00a0 The level of the informative debug stream. More...\n-\u00a0\n-static const DebugLevel\u00a0Dune::WARN_DEBUG_LEVEL = 4\n-\u00a0 The level of the debug stream for warnings. More...\n-\u00a0\n-static const DebugLevel\u00a0Dune::GRAVE_DEBUG_LEVEL = 5\n-\u00a0 The level of the debug stream for fatal errors.\n- More...\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n \u00a0\n-***** Detailed Description *****\n-Standard Dune debug streams.\n-The standard debug streams are compiled into libdune to exist globally. This\n-file declares the stream types and the global debug level.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00050_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: stdstreams.hh Source File\n+dune-common: future.hh Source File\n \n \n \n \n \n \n \n@@ -58,98 +58,211 @@\n \n \n \n \n \n
    \n-
    stdstreams.hh
    \n+
    future.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5
    \n-
    15#ifndef DUNE_COMMON_STDSTREAMS_HH
    \n-
    16#define DUNE_COMMON_STDSTREAMS_HH
    \n-
    17
    \n-
    18#include "debugstream.hh"
    \n+
    5#ifndef DUNE_COMMON_PARALLEL_FUTURE_HH
    \n+
    6#define DUNE_COMMON_PARALLEL_FUTURE_HH
    \n+
    7
    \n+
    8#include <memory>
    \n+\n+
    10
    \n+
    11namespace Dune{
    \n+
    12
    \n+\n+
    18 {};
    \n
    19
    \n-
    20namespace Dune {
    \n-
    21
    \n-
    66#ifndef DUNE_MINIMAL_DEBUG_LEVEL
    \n-
    67#define DUNE_MINIMAL_DEBUG_LEVEL 4
    \n-
    68#endif
    \n-\n-
    70
    \n-\n+
    20 // forward declaration
    \n+
    21 template<class T>
    \n+
    22 class PseudoFuture;
    \n+
    23
    \n+
    27 template<class T>
    \n+
    28 class Future{
    \n+
    29 // Future interface:
    \n+
    30 class FutureBase{
    \n+
    31 public:
    \n+
    32 virtual ~FutureBase() = default;
    \n+
    33 virtual void wait() = 0;
    \n+
    34 virtual bool ready() const = 0;
    \n+
    35 virtual bool valid() const = 0;
    \n+
    36 virtual T get() = 0;
    \n+
    37 };
    \n+
    38
    \n+
    39 // model class
    \n+
    40 template<class F>
    \n+
    41 class FutureModel
    \n+
    42 : public FutureBase
    \n+
    43 {
    \n+
    44 F _future;
    \n+
    45 public:
    \n+
    46 FutureModel(F&& f)
    \n+
    47 : _future(std::forward<F>(f))
    \n+
    48 {}
    \n+
    49
    \n+
    50 virtual void wait() override
    \n+
    51 {
    \n+
    52 _future.wait();
    \n+
    53 }
    \n+
    54
    \n+
    55 virtual bool ready() const override
    \n+
    56 {
    \n+
    57 return _future.ready();
    \n+
    58 }
    \n+
    59
    \n+
    60 virtual bool valid() const override
    \n+
    61 {
    \n+
    62 return _future.valid();
    \n+
    63 }
    \n+
    64
    \n+
    65 virtual T get() override{
    \n+
    66 return (T)_future.get();
    \n+
    67 }
    \n+
    68 };
    \n+
    69
    \n+
    70 std::unique_ptr<FutureBase> _future;
    \n+
    71 public:
    \n+
    72 template<class F>
    \n+
    73 Future(F&& f)
    \n+
    74 : _future(std::make_unique<FutureModel<F>>(std::forward<F>(f)))
    \n+
    75 {}
    \n
    76
    \n-\n-
    82
    \n-\n-
    96
    \n-\n-
    102
    \n-\n-
    108
    \n-\n-
    117
    \n-
    122 static const DebugLevel INFO_DEBUG_LEVEL = 3;
    \n-
    123
    \n-\n+
    77 template<class U, std::enable_if_t<std::is_same<U,T>::value && !std::is_same<T,void>::value>>
    \n+
    78 Future(U&& data)
    \n+
    79 : _future(std::make_unique<FutureModel<PseudoFuture<T>>>(PseudoFuture<T>(std::forward<U>(data))))
    \n+
    80 {}
    \n+
    81
    \n+
    82 Future() = default;
    \n+
    83
    \n+
    87 void wait(){
    \n+
    88 _future->wait();
    \n+
    89 }
    \n+
    90
    \n+
    95 T get() {
    \n+
    96 return _future->get();
    \n+
    97 }
    \n+
    98
    \n+
    103 bool ready() const {
    \n+
    104 return _future->ready();
    \n+
    105 }
    \n+
    106
    \n+
    112 bool valid() const {
    \n+
    113 if(_future)
    \n+
    114 return _future->valid();
    \n+
    115 return false;
    \n+
    116 }
    \n+
    117 };
    \n+
    118
    \n+
    121 template<class T>
    \n+\n+
    123 bool valid_;
    \n+
    124 T data_;
    \n+
    125 public:
    \n+\n+
    127 valid_(false)
    \n+
    128 {}
    \n
    129
    \n-\n-
    141
    \n-
    146 static const DebugLevel WARN_DEBUG_LEVEL = 4;
    \n-
    147
    \n-\n+
    130 template<class U>
    \n+\n+
    132 valid_(true),
    \n+
    133 data_(std::forward<U>(u))
    \n+
    134 {}
    \n+
    135
    \n+
    136 void wait() {
    \n+
    137 if(!valid_)
    \n+
    138 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    \n+
    139 }
    \n+
    140
    \n+
    141 bool ready() const {
    \n+
    142 if(!valid_)
    \n+
    143 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    \n+
    144 return true;
    \n+
    145 }
    \n+
    146
    \n+
    147 T get() {
    \n+
    148 if(!valid_)
    \n+
    149 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    \n+
    150 valid_ = false;
    \n+
    151 return std::forward<T>(data_);
    \n+
    152 }
    \n
    153
    \n-\n-
    162
    \n-\n-
    168
    \n-\n-
    171
    \n-\n-
    180
    \n-\n-
    183
    \n-\n-
    196
    \n-
    198}
    \n-
    199
    \n-
    200#endif
    \n-
    Defines several output streams for messages of different importance.
    \n-
    unsigned int DebugLevel
    Type for debug levels.
    Definition: debugstream.hh:118
    \n-
    DebugStream< VERY_VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVVerbType
    Type of very verbose debug stream.
    Definition: stdstreams.hh:81
    \n-
    DebugStream< WARN_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DWarnType
    Type of debug stream with warn level.
    Definition: stdstreams.hh:152
    \n-
    DVVerbType dvverb(std::cout)
    stream for very verbose output.
    Definition: stdstreams.hh:95
    \n-
    static const DebugLevel MINIMAL_DEBUG_LEVEL
    Definition: stdstreams.hh:69
    \n-
    #define DUNE_MINIMAL_DEBUG_LEVEL
    The default minimum debug level.
    Definition: stdstreams.hh:67
    \n-
    static const DebugLevel VERY_VERBOSE_DEBUG_LEVEL
    The level of the very verbose debug stream.
    Definition: stdstreams.hh:75
    \n-
    DWarnType dwarn(std::cerr)
    Stream for warnings indicating problems.
    Definition: stdstreams.hh:161
    \n-
    static const DebugLevel GRAVE_DEBUG_LEVEL
    The level of the debug stream for fatal errors.
    Definition: stdstreams.hh:167
    \n-
    DebugStream< VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVerbType
    Type of more verbose debug stream.
    Definition: stdstreams.hh:107
    \n-
    DebugStream< GRAVE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DGraveType
    Type of debug stream for fatal errors.
    Definition: stdstreams.hh:170
    \n-
    DGraveType dgrave(std::cerr)
    Stream for warnings indicating fatal errors.
    Definition: stdstreams.hh:179
    \n-
    DebugStream< 1 > DErrType
    The type of the stream used for error messages.
    Definition: stdstreams.hh:182
    \n-
    static const DebugLevel INFO_DEBUG_LEVEL
    The level of the informative debug stream.
    Definition: stdstreams.hh:122
    \n-
    DebugStream< INFO_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DInfoType
    Type of debug stream with info level.
    Definition: stdstreams.hh:128
    \n-
    DInfoType dinfo(std::cout)
    Stream for informative output.
    Definition: stdstreams.hh:140
    \n-
    DVerbType dverb(std::cout)
    Singleton of verbose debug stream.
    Definition: stdstreams.hh:116
    \n-
    static const DebugLevel VERBOSE_DEBUG_LEVEL
    The level of the verbose debug stream.
    Definition: stdstreams.hh:101
    \n-
    DErrType derr(std::cerr)
    Stream for error messages.
    Definition: stdstreams.hh:195
    \n-
    static const DebugLevel WARN_DEBUG_LEVEL
    The level of the debug stream for warnings.
    Definition: stdstreams.hh:146
    \n+
    154 bool valid() const {
    \n+
    155 return valid_;
    \n+
    156 }
    \n+
    157 };
    \n+
    158
    \n+
    159 template<>
    \n+
    160 class PseudoFuture<void>{
    \n+
    161 bool valid_;
    \n+
    162 public:
    \n+
    163 PseudoFuture(bool valid = false) :
    \n+
    164 valid_(valid)
    \n+
    165 {}
    \n+
    166
    \n+
    167 void wait(){
    \n+
    168 if(!valid_)
    \n+
    169 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    \n+
    170 }
    \n+
    171 bool ready() const{
    \n+
    172 if(!valid_)
    \n+
    173 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    \n+
    174 return true;
    \n+
    175 }
    \n+
    176
    \n+
    177 void get(){
    \n+
    178 if(!valid_)
    \n+
    179 DUNE_THROW(InvalidFutureException, "The PseudoFuture is not valid");
    \n+
    180 valid_ = false;
    \n+
    181 }
    \n+
    182
    \n+
    183 bool valid() const{
    \n+
    184 return valid_;
    \n+
    185 }
    \n+
    186 };
    \n+
    187}
    \n+
    188
    \n+
    189#endif
    \n+
    A few common exception classes.
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    Generic class to implement debug output streams.
    Definition: debugstream.hh:192
    \n+
    Default exception if a function was called while the object is not in a valid state for that function...
    Definition: exceptions.hh:281
    \n+
    This exception is thrown when ready(), wait() or get() is called on an invalid future....
    Definition: future.hh:18
    \n+
    A wrapper-class for a object which is ready immediately.
    Definition: future.hh:122
    \n+
    bool ready() const
    Definition: future.hh:141
    \n+
    T get()
    Definition: future.hh:147
    \n+
    PseudoFuture(U &&u)
    Definition: future.hh:131
    \n+
    PseudoFuture()
    Definition: future.hh:126
    \n+
    void wait()
    Definition: future.hh:136
    \n+
    bool valid() const
    Definition: future.hh:154
    \n+
    Type-erasure for future-like objects. A future-like object is a object satisfying the interface of Fu...
    Definition: future.hh:28
    \n+
    bool ready() const
    Definition: future.hh:103
    \n+
    void wait()
    wait until the future is ready
    Definition: future.hh:87
    \n+
    Future(U &&data)
    Definition: future.hh:78
    \n+
    T get()
    Waits until the future is ready and returns the resulting value.
    Definition: future.hh:95
    \n+
    Future()=default
    \n+
    bool valid() const
    Checks whether the future is valid. I.e. \u2018get()\u2019 was not called on that future and when it was not de...
    Definition: future.hh:112
    \n+
    Future(F &&f)
    Definition: future.hh:73
    \n+
    bool ready() const
    Definition: future.hh:171
    \n+
    bool valid() const
    Definition: future.hh:183
    \n+
    void get()
    Definition: future.hh:177
    \n+
    PseudoFuture(bool valid=false)
    Definition: future.hh:163
    \n+
    void wait()
    Definition: future.hh:167
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "encoding", "source2": "encoding", "unified_diff": "@@ -1 +1 @@\n-us-ascii\n+utf-8\n"}, {"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,155 +4,262 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-stdstreams.hh\n+ * parallel\n+future.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5\n- 15#ifndef DUNE_COMMON_STDSTREAMS_HH\n- 16#define DUNE_COMMON_STDSTREAMS_HH\n- 17\n- 18#include \"debugstream.hh\"\n+ 5#ifndef DUNE_COMMON_PARALLEL_FUTURE_HH\n+ 6#define DUNE_COMMON_PARALLEL_FUTURE_HH\n+ 7\n+ 8#include \n+ 9#include \n+ 10\n+ 11namespace Dune{\n+ 12\n+17 class InvalidFutureException : public InvalidStateException\n+ 18 {};\n 19\n- 20namespace Dune {\n- 21\n- 66#ifndef DUNE_MINIMAL_DEBUG_LEVEL\n-67#define DUNE_MINIMAL_DEBUG_LEVEL 4\n- 68#endif\n-69 static const DebugLevel MINIMAL_DEBUG_LEVEL = DUNE_MINIMAL_DEBUG_LEVEL;\n- 70\n-75 static const DebugLevel VERY_VERBOSE_DEBUG_LEVEL = 1;\n+ 20 // forward declaration\n+ 21 template\n+ 22 class PseudoFuture;\n+ 23\n+ 27 template\n+28 class Future{\n+ 29 // Future interface:\n+ 30 class FutureBase{\n+ 31 public:\n+ 32 virtual ~FutureBase() = default;\n+ 33 virtual void wait() = 0;\n+ 34 virtual bool ready() const = 0;\n+ 35 virtual bool valid() const = 0;\n+ 36 virtual T get() = 0;\n+ 37 };\n+ 38\n+ 39 // model class\n+ 40 template\n+ 41 class FutureModel\n+ 42 : public FutureBase\n+ 43 {\n+ 44 F _future;\n+ 45 public:\n+ 46 FutureModel(F&& f)\n+ 47 : _future(std::forward(f))\n+ 48 {}\n+ 49\n+ 50 virtual void wait() override\n+ 51 {\n+ 52 _future.wait();\n+ 53 }\n+ 54\n+ 55 virtual bool ready() const override\n+ 56 {\n+ 57 return _future.ready();\n+ 58 }\n+ 59\n+ 60 virtual bool valid() const override\n+ 61 {\n+ 62 return _future.valid();\n+ 63 }\n+ 64\n+ 65 virtual T get() override{\n+ 66 return (T)_future.get();\n+ 67 }\n+ 68 };\n+ 69\n+ 70 std::unique_ptr _future;\n+ 71 public:\n+ 72 template\n+73 Future(F&& f)\n+ 74 : _future(std::make_unique>(std::forward(f)))\n+ 75 {}\n 76\n-81 typedef DebugStream\n-DVVerbType;\n- 82\n-95 extern DVVerbType dvverb;\n- 96\n-101 static const DebugLevel VERBOSE_DEBUG_LEVEL = 2;\n- 102\n-107 typedef DebugStream DVerbType;\n- 108\n-116 extern DVerbType dverb;\n- 117\n-122 static const DebugLevel INFO_DEBUG_LEVEL = 3;\n- 123\n-128 typedef DebugStream DInfoType;\n+ 77 template::value && !std::\n+is_same::value>>\n+78 Future(U&& data)\n+ 79 : _future(std::make_unique>>(PseudoFuture\n+(std::forward(data))))\n+ 80 {}\n+ 81\n+82 Future() = default;\n+ 83\n+87 void wait(){\n+ 88 _future->wait();\n+ 89 }\n+ 90\n+95 T get() {\n+ 96 return _future->get();\n+ 97 }\n+ 98\n+103 bool ready() const {\n+ 104 return _future->ready();\n+ 105 }\n+ 106\n+112 bool valid() const {\n+ 113 if(_future)\n+ 114 return _future->valid();\n+ 115 return false;\n+ 116 }\n+ 117 };\n+ 118\n+ 121 template\n+122 class PseudoFuture{\n+ 123 bool valid_;\n+ 124 T data_;\n+ 125 public:\n+126 PseudoFuture() :\n+ 127 valid_(false)\n+ 128 {}\n 129\n-140 extern DInfoType dinfo;\n- 141\n-146 static const DebugLevel WARN_DEBUG_LEVEL = 4;\n- 147\n-152 typedef DebugStream DWarnType;\n+ 130 template\n+131 PseudoFuture(U&& u) :\n+ 132 valid_(true),\n+ 133 data_(std::forward(u))\n+ 134 {}\n+ 135\n+136 void wait() {\n+ 137 if(!valid_)\n+ 138 DUNE_THROW(InvalidFutureException, \"The PseudoFuture is not valid\");\n+ 139 }\n+ 140\n+141 bool ready() const {\n+ 142 if(!valid_)\n+ 143 DUNE_THROW(InvalidFutureException, \"The PseudoFuture is not valid\");\n+ 144 return true;\n+ 145 }\n+ 146\n+147 T get() {\n+ 148 if(!valid_)\n+ 149 DUNE_THROW(InvalidFutureException, \"The PseudoFuture is not valid\");\n+ 150 valid_ = false;\n+ 151 return std::forward(data_);\n+ 152 }\n 153\n-161 extern DWarnType dwarn;\n- 162\n-167 static const DebugLevel GRAVE_DEBUG_LEVEL = 5;\n- 168\n-170 typedef DebugStream DGraveType;\n- 171\n-179 extern DGraveType dgrave;\n- 180\n-182 typedef DebugStream<1> DErrType;\n- 183\n-195 extern DErrType derr;\n- 196\n- 198}\n- 199\n- 200#endif\n-debugstream.hh\n-Defines several output streams for messages of different importance.\n-Dune::DebugLevel\n-unsigned int DebugLevel\n-Type for debug levels.\n-Definition: debugstream.hh:118\n-Dune::DVVerbType\n-DebugStream< VERY_VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVVerbType\n-Type of very verbose debug stream.\n-Definition: stdstreams.hh:81\n-Dune::DWarnType\n-DebugStream< WARN_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DWarnType\n-Type of debug stream with warn level.\n-Definition: stdstreams.hh:152\n-Dune::dvverb\n-DVVerbType dvverb(std::cout)\n-stream for very verbose output.\n-Definition: stdstreams.hh:95\n-Dune::MINIMAL_DEBUG_LEVEL\n-static const DebugLevel MINIMAL_DEBUG_LEVEL\n-Definition: stdstreams.hh:69\n-DUNE_MINIMAL_DEBUG_LEVEL\n-#define DUNE_MINIMAL_DEBUG_LEVEL\n-The default minimum debug level.\n-Definition: stdstreams.hh:67\n-Dune::VERY_VERBOSE_DEBUG_LEVEL\n-static const DebugLevel VERY_VERBOSE_DEBUG_LEVEL\n-The level of the very verbose debug stream.\n-Definition: stdstreams.hh:75\n-Dune::dwarn\n-DWarnType dwarn(std::cerr)\n-Stream for warnings indicating problems.\n-Definition: stdstreams.hh:161\n-Dune::GRAVE_DEBUG_LEVEL\n-static const DebugLevel GRAVE_DEBUG_LEVEL\n-The level of the debug stream for fatal errors.\n-Definition: stdstreams.hh:167\n-Dune::DVerbType\n-DebugStream< VERBOSE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DVerbType\n-Type of more verbose debug stream.\n-Definition: stdstreams.hh:107\n-Dune::DGraveType\n-DebugStream< GRAVE_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DGraveType\n-Type of debug stream for fatal errors.\n-Definition: stdstreams.hh:170\n-Dune::dgrave\n-DGraveType dgrave(std::cerr)\n-Stream for warnings indicating fatal errors.\n-Definition: stdstreams.hh:179\n-Dune::DErrType\n-DebugStream< 1 > DErrType\n-The type of the stream used for error messages.\n-Definition: stdstreams.hh:182\n-Dune::INFO_DEBUG_LEVEL\n-static const DebugLevel INFO_DEBUG_LEVEL\n-The level of the informative debug stream.\n-Definition: stdstreams.hh:122\n-Dune::DInfoType\n-DebugStream< INFO_DEBUG_LEVEL, MINIMAL_DEBUG_LEVEL > DInfoType\n-Type of debug stream with info level.\n-Definition: stdstreams.hh:128\n-Dune::dinfo\n-DInfoType dinfo(std::cout)\n-Stream for informative output.\n-Definition: stdstreams.hh:140\n-Dune::dverb\n-DVerbType dverb(std::cout)\n-Singleton of verbose debug stream.\n-Definition: stdstreams.hh:116\n-Dune::VERBOSE_DEBUG_LEVEL\n-static const DebugLevel VERBOSE_DEBUG_LEVEL\n-The level of the verbose debug stream.\n-Definition: stdstreams.hh:101\n-Dune::derr\n-DErrType derr(std::cerr)\n-Stream for error messages.\n-Definition: stdstreams.hh:195\n-Dune::WARN_DEBUG_LEVEL\n-static const DebugLevel WARN_DEBUG_LEVEL\n-The level of the debug stream for warnings.\n-Definition: stdstreams.hh:146\n+154 bool valid() const {\n+ 155 return valid_;\n+ 156 }\n+ 157 };\n+ 158\n+ 159 template<>\n+160 class PseudoFuture{\n+ 161 bool valid_;\n+ 162 public:\n+163 PseudoFuture(bool valid = false) :\n+ 164 valid_(valid)\n+ 165 {}\n+ 166\n+167 void wait(){\n+ 168 if(!valid_)\n+ 169 DUNE_THROW(InvalidFutureException, \"The PseudoFuture is not valid\");\n+ 170 }\n+171 bool ready() const{\n+ 172 if(!valid_)\n+ 173 DUNE_THROW(InvalidFutureException, \"The PseudoFuture is not valid\");\n+ 174 return true;\n+ 175 }\n+ 176\n+177 void get(){\n+ 178 if(!valid_)\n+ 179 DUNE_THROW(InvalidFutureException, \"The PseudoFuture is not valid\");\n+ 180 valid_ = false;\n+ 181 }\n+ 182\n+183 bool valid() const{\n+ 184 return valid_;\n+ 185 }\n+ 186 };\n+ 187}\n+ 188\n+ 189#endif\n+exceptions.hh\n+A few common exception classes.\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::DebugStream\n-Generic class to implement debug output streams.\n-Definition: debugstream.hh:192\n+Dune::InvalidStateException\n+Default exception if a function was called while the object is not in a valid\n+state for that function...\n+Definition: exceptions.hh:281\n+Dune::InvalidFutureException\n+This exception is thrown when ready(), wait() or get() is called on an invalid\n+future....\n+Definition: future.hh:18\n+Dune::PseudoFuture\n+A wrapper-class for a object which is ready immediately.\n+Definition: future.hh:122\n+Dune::PseudoFuture::ready\n+bool ready() const\n+Definition: future.hh:141\n+Dune::PseudoFuture::get\n+T get()\n+Definition: future.hh:147\n+Dune::PseudoFuture::PseudoFuture\n+PseudoFuture(U &&u)\n+Definition: future.hh:131\n+Dune::PseudoFuture::PseudoFuture\n+PseudoFuture()\n+Definition: future.hh:126\n+Dune::PseudoFuture::wait\n+void wait()\n+Definition: future.hh:136\n+Dune::PseudoFuture::valid\n+bool valid() const\n+Definition: future.hh:154\n+Dune::Future\n+Type-erasure for future-like objects. A future-like object is a object\n+satisfying the interface of Fu...\n+Definition: future.hh:28\n+Dune::Future::ready\n+bool ready() const\n+Definition: future.hh:103\n+Dune::Future::wait\n+void wait()\n+wait until the future is ready\n+Definition: future.hh:87\n+Dune::Future::Future\n+Future(U &&data)\n+Definition: future.hh:78\n+Dune::Future::get\n+T get()\n+Waits until the future is ready and returns the resulting value.\n+Definition: future.hh:95\n+Dune::Future::Future\n+Future()=default\n+Dune::Future::valid\n+bool valid() const\n+Checks whether the future is valid. I.e. \u2018get()\u2019 was not called on that future\n+and when it was not de...\n+Definition: future.hh:112\n+Dune::Future::Future\n+Future(F &&f)\n+Definition: future.hh:73\n+Dune::PseudoFuture<_void_>::ready\n+bool ready() const\n+Definition: future.hh:171\n+Dune::PseudoFuture<_void_>::valid\n+bool valid() const\n+Definition: future.hh:183\n+Dune::PseudoFuture<_void_>::get\n+void get()\n+Definition: future.hh:177\n+Dune::PseudoFuture<_void_>::PseudoFuture\n+PseudoFuture(bool valid=false)\n+Definition: future.hh:163\n+Dune::PseudoFuture<_void_>::wait\n+void wait()\n+Definition: future.hh:167\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00053.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00053.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: densematrix.hh File Reference\n+dune-common: collectivecommunication.hh File Reference\n \n \n \n \n \n \n \n@@ -58,78 +58,24 @@\n \n \n \n \n \n
    \n- \n-
    densematrix.hh File Reference
    \n+
    collectivecommunication.hh File Reference
    \n
    \n
    \n-\n-

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

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

    Go to the source code of this file.

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-Classes

    struct  Dune::FieldTraits< DenseMatrix< M > >
     
    class  Dune::FMatrixError
     Error thrown if operations of a FieldMatrix fail. More...
     
    class  Dune::DenseMatrix< MAT >
     A dense n x m matrix. More...
     
    \n-\n-\n-\n-\n-\n-\n-

    \n-Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::DenseMatrixHelp
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-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 More...
     
    template<typename MAT >
    std::ostream & Dune::operator<< (std::ostream &s, const DenseMatrix< MAT > &a)
     Sends the matrix to an output stream. More...
     
    \n-

    Detailed Description

    \n-

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

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

    Implements a scalar vector view wrapper around an existing scalar. \n+

    A communicator that only needs to know the number of elements per index at the sender side. \n More...

    \n-
    #include <cstddef>
    \n-#include <type_traits>
    \n-#include <istream>
    \n-#include <dune/common/densevector.hh>
    \n-#include <dune/common/fvector.hh>
    \n-#include <dune/common/typetraits.hh>
    \n-#include <dune/common/matvectraits.hh>
    \n+
    #include <algorithm>
    \n+#include <cassert>
    \n+#include <cstddef>
    \n+#include <functional>
    \n+#include <map>
    \n+#include <memory>
    \n+#include <utility>
    \n+#include <vector>
    \n+#include <mpi.h>
    \n+#include <dune/common/concept.hh>
    \n+#include <dune/common/parallel/interface.hh>
    \n+#include <dune/common/parallel/mpitraits.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+

    \n+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...
     
    \n \n \n \n \n+\n+\n+\n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Concept
     Namespace for concepts.
     
    \n

    Detailed Description

    \n-

    Implements a scalar vector view wrapper around an existing scalar.

    \n-
    \n+

    A communicator that only needs to know the number of elements per index at the sender side.

    \n+
    Author
    Markus Blatt
    \n+

    Variable Documentation

    \n+\n+

    ◆ fixedSize

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+
    std::size_t fixedSize
    \n+
    \n+\n+

    The number of data items per index if it is fixed, 0 otherwise.

    \n+\n+
    \n+
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,28 +4,52 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces\n-scalarvectorview.hh File Reference\n-Common \u00bb Dense_Matrix_and_Vector_Template_Library\n-Implements a scalar vector view wrapper around an existing scalar. More...\n+ * parallel\n+Classes | Namespaces\n+variablesizecommunicator.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+A communicator that only needs to know the number of elements per index at the\n+sender side. More...\n+#include \n+#include \n #include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::Concept::HasFixedSize\n+\u00a0\n+ class \u00a0Dune::VariableSizeCommunicator<_Allocator_>\n+\u00a0 A buffered communicator where the amount of data sent does not have to\n+ be known a priori. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+namespace \u00a0Dune::Concept\n+\u00a0 Namespace for concepts.\n+\u00a0\n ***** Detailed Description *****\n-Implements a scalar vector view wrapper around an existing scalar.\n+A communicator that only needs to know the number of elements per index at the\n+sender side.\n+ Author\n+ Markus Blatt\n+***** Variable Documentation *****\n+***** \u25c6\u00a0fixedSize *****\n+std::size_t fixedSize\n+The number of data items per index if it is fixed, 0 otherwise.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00056_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00056_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: scalarvectorview.hh Source File\n+dune-common: variablesizecommunicator.hh Source File\n \n \n \n \n \n \n \n@@ -58,198 +58,893 @@\n \n \n \n \n \n
    \n-
    scalarvectorview.hh
    \n+
    variablesizecommunicator.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_SCALARVECTORVIEW_HH
    \n-
    6#define DUNE_COMMON_SCALARVECTORVIEW_HH
    \n+
    5#ifndef DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH // Still fits the line!
    \n+
    6#define DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH
    \n
    7
    \n-
    8#include <cstddef>
    \n-
    9#include <type_traits>
    \n-
    10#include <istream>
    \n-
    11
    \n-\n-\n-\n-\n-
    16
    \n-
    17namespace Dune {
    \n-
    18
    \n-
    19namespace Impl {
    \n-
    20
    \n-
    35 template<class K>
    \n-
    36 class ScalarVectorView :
    \n-
    37 public DenseVector<ScalarVectorView<K>>
    \n-
    38 {
    \n-
    39 K* dataP_;
    \n-
    40 using Base = DenseVector<ScalarVectorView<K>>;
    \n-
    41
    \n-
    42 template <class>
    \n-
    43 friend class ScalarVectorView;
    \n-
    44 public:
    \n-
    45
    \n-
    47 constexpr static int dimension = 1;
    \n+
    8#if HAVE_MPI
    \n+
    9
    \n+
    10#include <algorithm>
    \n+
    11#include <cassert>
    \n+
    12#include <cstddef>
    \n+
    13#include <functional>
    \n+
    14#include <map>
    \n+
    15#include <memory>
    \n+
    16#include <utility>
    \n+
    17#include <vector>
    \n+
    18#include <algorithm>
    \n+
    19
    \n+
    20#include <mpi.h>
    \n+
    21
    \n+\n+\n+\n+
    25
    \n+
    38namespace Dune
    \n+
    39{
    \n+
    40
    \n+
    41namespace Concept {
    \n+
    42
    \n+\n+
    44 template <typename H> auto require(H &&h) -> decltype(h.fixedSize());
    \n+
    45};
    \n+
    46
    \n+
    47} // namespace Concept
    \n
    48
    \n-
    50 using size_type = typename Base::size_type;
    \n-
    51
    \n-
    53 using reference = std::decay_t<K>&;
    \n-
    54
    \n-
    56 using const_reference = const K&;
    \n-
    57
    \n-
    58 //===== construction
    \n-
    59
    \n-
    61 constexpr ScalarVectorView ()
    \n-
    62 : dataP_(nullptr)
    \n-
    63 {}
    \n-
    64
    \n-
    66 ScalarVectorView (K* p) :
    \n-
    67 dataP_(p)
    \n-
    68 {}
    \n-
    69
    \n-
    71 ScalarVectorView (const ScalarVectorView &other) :
    \n-
    72 Base(),
    \n-
    73 dataP_(other.dataP_)
    \n-
    74 {}
    \n-
    75
    \n-
    77 ScalarVectorView (ScalarVectorView &&other) :
    \n-
    78 Base(),
    \n-
    79 dataP_( other.dataP_ )
    \n-
    80 {}
    \n-
    81
    \n-
    83 ScalarVectorView& operator= (const ScalarVectorView& other)
    \n-
    84 {
    \n-
    85 assert(dataP_);
    \n-
    86 assert(other.dataP_);
    \n-
    87 *dataP_ = *(other.dataP_);
    \n-
    88 return *this;
    \n-
    89 }
    \n-
    90
    \n-
    91 template<class KK>
    \n-
    92 ScalarVectorView& operator= (const ScalarVectorView<KK>& other)
    \n-
    93 {
    \n-
    94 assert(dataP_);
    \n-
    95 assert(other.dataP_);
    \n-
    96 *dataP_ = *(other.dataP_);
    \n-
    97 return *this;
    \n-
    98 }
    \n-
    99
    \n-
    101 template<typename T,
    \n-
    102 std::enable_if_t<std::is_convertible<T, K>::value, int> = 0>
    \n-
    103 inline ScalarVectorView& operator= (const T& k)
    \n-
    104 {
    \n-
    105 *dataP_ = k;
    \n-
    106 return *this;
    \n-
    107 }
    \n-
    108
    \n-
    110 static constexpr size_type size ()
    \n-
    111 {
    \n-
    112 return 1;
    \n-
    113 }
    \n-
    114
    \n-
    116 K& operator[] ([[maybe_unused]] size_type i)
    \n-
    117 {
    \n-
    118 DUNE_ASSERT_BOUNDS(i == 0);
    \n-
    119 return *dataP_;
    \n-
    120 }
    \n-
    121
    \n-
    123 const K& operator[] ([[maybe_unused]] size_type i) const
    \n-
    124 {
    \n-
    125 DUNE_ASSERT_BOUNDS(i == 0);
    \n-
    126 return *dataP_;
    \n-
    127 }
    \n-
    128 }; // class ScalarVectorView
    \n-
    129
    \n-
    130} // namespace Impl
    \n-
    131
    \n-
    132
    \n-
    133 template< class K>
    \n-
    134 struct DenseMatVecTraits< Impl::ScalarVectorView<K> >
    \n-
    135 {
    \n-
    136 using derived_type = Impl::ScalarVectorView<K>;
    \n-
    137 using value_type = std::remove_const_t<K>;
    \n-
    138 using size_type = std::size_t;
    \n-
    139 };
    \n-
    140
    \n-
    141 template< class K >
    \n-
    142 struct FieldTraits< Impl::ScalarVectorView<K> > : public FieldTraits<std::remove_const_t<K>> {};
    \n-
    143
    \n-
    144 template<class K>
    \n-
    145 struct AutonomousValueType<Impl::ScalarVectorView<K>>
    \n-
    146 {
    \n-
    147 using type = FieldVector<std::remove_const_t<K>,1>;
    \n-
    148 };
    \n-
    149
    \n-
    150namespace Impl {
    \n+
    49namespace Impl {
    \n+
    50
    \n+
    51template <typename H,
    \n+
    52 std::enable_if_t<models<Concept::HasFixedSize, H>(), int> = 0>
    \n+
    53constexpr bool callFixedSize(H &&handle) {
    \n+
    54 return handle.fixedSize();
    \n+
    55}
    \n+
    56
    \n+
    57} // namespace Impl
    \n+
    58
    \n+
    59namespace
    \n+
    60{
    \n+
    65template<class T, class Allocator=std::allocator<T> >
    \n+
    66class MessageBuffer
    \n+
    67{
    \n+
    68public:
    \n+
    73 explicit MessageBuffer(int size)
    \n+
    74 : buffer_(new T[size]), size_(size), position_(0)
    \n+
    75 {}
    \n+
    80 explicit MessageBuffer(const MessageBuffer& o)
    \n+
    81 : buffer_(new T[o.size_]), size_(o.size_), position_(o.position_)
    \n+
    82 {
    \n+
    83 }
    \n+
    85 ~MessageBuffer()
    \n+
    86 {
    \n+
    87 delete[] buffer_;
    \n+
    88 }
    \n+
    93 void write(const T& data)
    \n+
    94 {
    \n+
    95 buffer_[position_++]=data;
    \n+
    96 }
    \n+
    97
    \n+
    102 void read(T& data)
    \n+
    103 {
    \n+
    104 data=buffer_[position_++];
    \n+
    105 }
    \n+
    106
    \n+
    112 void reset()
    \n+
    113 {
    \n+
    114 position_=0;
    \n+
    115 }
    \n+
    116
    \n+
    121 bool finished()
    \n+
    122 {
    \n+
    123 return position_==size_;
    \n+
    124 }
    \n+
    125
    \n+
    131 bool hasSpaceForItems(int noItems)
    \n+
    132 {
    \n+
    133 return position_+noItems<=size_;
    \n+
    134 }
    \n+
    139 std::size_t size() const
    \n+
    140 {
    \n+
    141 return size_;
    \n+
    142 }
    \n+
    147 operator T*()
    \n+
    148 {
    \n+
    149 return buffer_;
    \n+
    150 }
    \n
    151
    \n-
    163 template<class K>
    \n-
    164 inline std::istream &operator>> ( std::istream &in, ScalarVectorView<K> &v )
    \n-
    165 {
    \n-
    166 K w;
    \n-
    167 if(in >> w)
    \n-
    168 v = w;
    \n-
    169 return in;
    \n-
    170 }
    \n-
    171
    \n-
    172
    \n-
    174 template<class T,
    \n-
    175 std::enable_if_t<IsNumber<T>::value, int> = 0>
    \n-
    176 auto asVector(T& t)
    \n-
    177 {
    \n-
    178 return ScalarVectorView<T>{&t};
    \n-
    179 }
    \n-
    180
    \n-
    182 template<class T,
    \n-
    183 std::enable_if_t<IsNumber<T>::value, int> = 0>
    \n-
    184 auto asVector(const T& t)
    \n-
    185 {
    \n-
    186 return ScalarVectorView<const T>{&t};
    \n-
    187 }
    \n-
    188
    \n-
    190 template<class T,
    \n-
    191 std::enable_if_t<not IsNumber<T>::value, int> = 0>
    \n-
    192 T& asVector(T& t)
    \n-
    193 {
    \n-
    194 return t;
    \n-
    195 }
    \n-
    196
    \n-
    198 template<class T,
    \n-
    199 std::enable_if_t<not IsNumber<T>::value, int> = 0>
    \n-
    200 const T& asVector(const T& t)
    \n-
    201 {
    \n-
    202 return t;
    \n-
    203 }
    \n-
    204
    \n-
    205} // end namespace Impl
    \n-
    206
    \n-
    207} // end namespace Dune
    \n-
    208
    \n-
    209#endif // DUNE_COMMON_SCALARVECTORVIEW_HH
    \n-
    Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
    \n-
    Implements the dense vector interface, with an exchangeable storage class.
    \n-
    Implements a vector constructed from a given type representing a field and a compile-time given size.
    \n-
    Traits for type conversions and type information.
    \n-
    Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
    Read a std::tuple.
    Definition: streamoperators.hh:43
    \n-
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition: boundschecking.hh:30
    \n+
    152private:
    \n+
    156 T* buffer_;
    \n+
    160 std::size_t size_;
    \n+
    164 std::size_t position_;
    \n+
    165};
    \n+
    166
    \n+
    170class InterfaceTracker
    \n+
    171{
    \n+
    172public:
    \n+
    178 InterfaceTracker(int rank, InterfaceInformation info, std::size_t fixedsize=0,
    \n+
    179 bool allocateSizes=false)
    \n+
    180 : fixedSize(fixedsize),rank_(rank), index_(), interface_(info), sizes_()
    \n+
    181 {
    \n+
    182 if(allocateSizes)
    \n+
    183 {
    \n+
    184 sizes_.resize(info.size());
    \n+
    185 }
    \n+
    186 }
    \n+
    187
    \n+
    191 void moveToNextIndex()
    \n+
    192 {
    \n+
    193 index_++;
    \n+
    194 assert(index_<=interface_.size());
    \n+
    195 skipZeroIndices();
    \n+
    196 }
    \n+
    201 void increment(std::size_t i)
    \n+
    202 {
    \n+
    203 index_+=i;
    \n+
    204 assert(index_<=interface_.size());
    \n+
    205 }
    \n+
    210 bool finished() const
    \n+
    211 {
    \n+
    212 return index_==interface_.size();
    \n+
    213 }
    \n+
    214
    \n+
    215 void skipZeroIndices()
    \n+
    216 {
    \n+
    217 // skip indices with size zero!
    \n+
    218 while(sizes_.size() && index_!=interface_.size() &&!size())
    \n+
    219 ++index_;
    \n+
    220 }
    \n+
    221
    \n+
    226 std::size_t index() const
    \n+
    227 {
    \n+
    228 return interface_[index_];
    \n+
    229 }
    \n+
    233 std::size_t size() const
    \n+
    234 {
    \n+
    235 assert(sizes_.size());
    \n+
    236 return sizes_[index_];
    \n+
    237 }
    \n+
    241 std::size_t* getSizesPointer()
    \n+
    242 {
    \n+
    243 return &sizes_[0];
    \n+
    244 }
    \n+
    249 bool empty() const
    \n+
    250 {
    \n+
    251 return !interface_.size();
    \n+
    252 }
    \n+
    253
    \n+
    258 std::size_t indicesLeft() const
    \n+
    259 {
    \n+
    260 return interface_.size()-index_;
    \n+
    261 }
    \n+
    265 std::size_t fixedSize;
    \n+
    269 int rank() const
    \n+
    270 {
    \n+
    271 return rank_;
    \n+
    272 }
    \n+
    276 std::size_t offset() const
    \n+
    277 {
    \n+
    278 return index_;
    \n+
    279 }
    \n+
    280private:
    \n+
    282 int rank_;
    \n+
    284 std::size_t index_;
    \n+
    286 InterfaceInformation interface_;
    \n+
    287 std::vector<std::size_t> sizes_;
    \n+
    288};
    \n+
    289
    \n+
    290
    \n+
    291} // end unnamed namespace
    \n+
    292
    \n+
    330template<class Allocator=std::allocator<std::pair<InterfaceInformation,InterfaceInformation> > >
    \n+\n+
    332{
    \n+
    333public:
    \n+
    338 typedef std::map<int,std::pair<InterfaceInformation,InterfaceInformation>,
    \n+
    339 std::less<int>,
    \n+
    340 typename std::allocator_traits<Allocator>::template rebind_alloc< std::pair<const int,std::pair<InterfaceInformation,InterfaceInformation> > > > InterfaceMap;
    \n+
    341
    \n+
    342#ifndef DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE
    \n+
    349 VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap& inf)
    \n+
    350 : maxBufferSize_(32768), interface_(&inf)
    \n+
    351 {
    \n+
    352 MPI_Comm_dup(comm, &communicator_);
    \n+
    353 }
    \n+\n+
    359 : maxBufferSize_(32768), interface_(&inf.interfaces())
    \n+
    360 {
    \n+
    361 MPI_Comm_dup(inf.communicator(), &communicator_);
    \n+
    362 }
    \n+
    363#else
    \n+
    370 VariableSizeCommunicator(MPI_Comm comm, InterfaceMap& inf)
    \n+
    371 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE),
    \n+
    372 interface_(&inf)
    \n+
    373 {
    \n+
    374 MPI_Comm_dup(comm, &communicator_);
    \n+
    375 }
    \n+
    380 VariableSizeCommunicator(const Interface& inf)
    \n+
    381 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE),
    \n+
    382 interface_(&inf.interfaces())
    \n+
    383 {
    \n+
    384 MPI_Comm_dup(inf.communicator(), &communicator_);
    \n+
    385 }
    \n+
    386#endif
    \n+
    393 VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap& inf, std::size_t max_buffer_size)
    \n+
    394 : maxBufferSize_(max_buffer_size), interface_(&inf)
    \n+
    395 {
    \n+
    396 MPI_Comm_dup(comm, &communicator_);
    \n+
    397 }
    \n+
    398
    \n+
    404 VariableSizeCommunicator(const Interface& inf, std::size_t max_buffer_size)
    \n+
    405 : maxBufferSize_(max_buffer_size), interface_(&inf.interfaces())
    \n+
    406 {
    \n+
    407 MPI_Comm_dup(inf.communicator(), &communicator_);
    \n+
    408 }
    \n+
    409
    \n+\n+
    411 {
    \n+
    412 MPI_Comm_free(&communicator_);
    \n+
    413 }
    \n+
    414
    \n+\n+
    420 maxBufferSize_ = other.maxBufferSize_;
    \n+
    421 interface_ = other.interface_;
    \n+
    422 MPI_Comm_dup(other.communicator_, &communicator_);
    \n+
    423 }
    \n+
    424
    \n+\n+
    430 if(this == &other) // don't do anything if objects are the same
    \n+
    431 return *this;
    \n+
    432
    \n+
    433 maxBufferSize_ = other.maxBufferSize_;
    \n+
    434 interface_ = other.interface_;
    \n+
    435 MPI_Comm_free(&communicator_);
    \n+
    436 MPI_Comm_dup(other.communicator_, &communicator_);
    \n+
    437
    \n+
    438 return *this;
    \n+
    439 }
    \n+
    440
    \n+
    460 template<class DataHandle>
    \n+
    461 void forward(DataHandle& handle)
    \n+
    462 {
    \n+
    463 communicate<true>(handle);
    \n+
    464 }
    \n+
    465
    \n+
    485 template<class DataHandle>
    \n+
    486 void backward(DataHandle& handle)
    \n+
    487 {
    \n+
    488 communicate<false>(handle);
    \n+
    489 }
    \n+
    490
    \n+
    491private:
    \n+
    492 template<bool FORWARD, class DataHandle>
    \n+
    493 void communicateSizes(DataHandle& handle,
    \n+
    494 std::vector<InterfaceTracker>& recv_trackers);
    \n+
    495
    \n+
    502 template<bool forward,class DataHandle>
    \n+
    503 void communicate(DataHandle& handle);
    \n+
    513 template<bool FORWARD, class DataHandle>
    \n+
    514 void setupInterfaceTrackers(DataHandle& handle,
    \n+
    515 std::vector<InterfaceTracker>& send_trackers,
    \n+
    516 std::vector<InterfaceTracker>& recv_trackers);
    \n+
    524 template<bool FORWARD, class DataHandle>
    \n+
    525 void communicateFixedSize(DataHandle& handle);
    \n+
    533 template<bool FORWARD, class DataHandle>
    \n+
    534 void communicateVariableSize(DataHandle& handle);
    \n+
    541 std::size_t maxBufferSize_;
    \n+
    549 const InterfaceMap* interface_;
    \n+
    555 MPI_Comm communicator_;
    \n+
    556};
    \n+
    557
    \n+
    559namespace
    \n+
    560{
    \n+
    564template<class DataHandle>
    \n+
    565class SizeDataHandle
    \n+
    566{
    \n+
    567public:
    \n+
    568 typedef std::size_t DataType;
    \n+
    569
    \n+
    570 SizeDataHandle(DataHandle& data,
    \n+
    571 std::vector<InterfaceTracker>& trackers)
    \n+
    572 : data_(data), trackers_(trackers), index_()
    \n+
    573 {}
    \n+
    574 bool fixedSize()
    \n+
    575 {
    \n+
    576 return true;
    \n+
    577 }
    \n+
    578 std::size_t size([[maybe_unused]] std::size_t i)
    \n+
    579 {
    \n+
    580 return 1;
    \n+
    581 }
    \n+
    582 template<class B>
    \n+
    583 void gather(B& buf, int i)
    \n+
    584 {
    \n+
    585 buf.write(data_.size(i));
    \n+
    586 }
    \n+
    587 void setReceivingIndex(std::size_t i)
    \n+
    588 {
    \n+
    589 index_=i;
    \n+
    590 }
    \n+
    591 std::size_t* getSizesPointer()
    \n+
    592 {
    \n+
    593 return trackers_[index_].getSizesPointer();
    \n+
    594 }
    \n+
    595
    \n+
    596private:
    \n+
    597 DataHandle& data_;
    \n+
    598 std::vector<InterfaceTracker>& trackers_;
    \n+
    599 int index_;
    \n+
    600};
    \n+
    601
    \n+
    602template<class T>
    \n+
    603void setReceivingIndex(T&, int)
    \n+
    604{}
    \n+
    605
    \n+
    606template<class T>
    \n+
    607void setReceivingIndex(SizeDataHandle<T>& t, int i)
    \n+
    608{
    \n+
    609 t.setReceivingIndex(i);
    \n+
    610}
    \n+
    611
    \n+
    612
    \n+
    618template<bool FORWARD>
    \n+
    619struct InterfaceInformationChooser
    \n+
    620{
    \n+
    624 static const InterfaceInformation&
    \n+
    625 getSend(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    \n+
    626 {
    \n+
    627 return info.first;
    \n+
    628 }
    \n+
    629
    \n+
    633 static const InterfaceInformation&
    \n+
    634 getReceive(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    \n+
    635 {
    \n+
    636 return info.second;
    \n+
    637 }
    \n+
    638};
    \n+
    639
    \n+
    640template<>
    \n+
    641struct InterfaceInformationChooser<false>
    \n+
    642{
    \n+
    643 static const InterfaceInformation&
    \n+
    644 getSend(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    \n+
    645 {
    \n+
    646 return info.second;
    \n+
    647 }
    \n+
    648
    \n+
    649 static const InterfaceInformation&
    \n+
    650 getReceive(const std::pair<InterfaceInformation,InterfaceInformation>& info)
    \n+
    651 {
    \n+
    652 return info.first;
    \n+
    653 }
    \n+
    654};
    \n+
    655
    \n+
    661template<class DataHandle>
    \n+
    662struct PackEntries
    \n+
    663{
    \n+
    664
    \n+
    665 int operator()(DataHandle& handle, InterfaceTracker& tracker,
    \n+
    666 MessageBuffer<typename DataHandle::DataType>& buffer,
    \n+
    667 [[maybe_unused]] int i) const
    \n+
    668 {
    \n+
    669 return operator()(handle,tracker,buffer);
    \n+
    670 }
    \n+
    671
    \n+
    679 int operator()(DataHandle& handle, InterfaceTracker& tracker,
    \n+
    680 MessageBuffer<typename DataHandle::DataType>& buffer) const
    \n+
    681 {
    \n+
    682 if(tracker.fixedSize) // fixed size if variable is >0!
    \n+
    683 {
    \n+
    684
    \n+
    685 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize, tracker.indicesLeft());
    \n+
    686 for(std::size_t i=0; i< noIndices; ++i)
    \n+
    687 {
    \n+
    688 handle.gather(buffer, tracker.index());
    \n+
    689 tracker.moveToNextIndex();
    \n+
    690 }
    \n+
    691 return noIndices*tracker.fixedSize;
    \n+
    692 }
    \n+
    693 else
    \n+
    694 {
    \n+
    695 int packed=0;
    \n+
    696 tracker.skipZeroIndices();
    \n+
    697 while(!tracker.finished())
    \n+
    698 if(buffer.hasSpaceForItems(handle.size(tracker.index())))
    \n+
    699 {
    \n+
    700 handle.gather(buffer, tracker.index());
    \n+
    701 packed+=handle.size(tracker.index());
    \n+
    702 tracker.moveToNextIndex();
    \n+
    703 }
    \n+
    704 else
    \n+
    705 break;
    \n+
    706 return packed;
    \n+
    707 }
    \n+
    708 }
    \n+
    709};
    \n+
    710
    \n+
    716template<class DataHandle>
    \n+
    717struct UnpackEntries{
    \n+
    718
    \n+
    726 bool operator()(DataHandle& handle, InterfaceTracker& tracker,
    \n+
    727 MessageBuffer<typename DataHandle::DataType>& buffer,
    \n+
    728 int count=0)
    \n+
    729 {
    \n+
    730 if(tracker.fixedSize) // fixed size if variable is >0!
    \n+
    731 {
    \n+
    732 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize, tracker.indicesLeft());
    \n+
    733
    \n+
    734 for(std::size_t i=0; i< noIndices; ++i)
    \n+
    735 {
    \n+
    736 handle.scatter(buffer, tracker.index(), tracker.fixedSize);
    \n+
    737 tracker.moveToNextIndex();
    \n+
    738 }
    \n+
    739 return tracker.finished();
    \n+
    740 }
    \n+
    741 else
    \n+
    742 {
    \n+
    743 assert(count);
    \n+
    744 for(int unpacked=0;unpacked<count;)
    \n+
    745 {
    \n+
    746 assert(!tracker.finished());
    \n+
    747 assert(buffer.hasSpaceForItems(tracker.size()));
    \n+
    748 handle.scatter(buffer, tracker.index(), tracker.size());
    \n+
    749 unpacked+=tracker.size();
    \n+
    750 tracker.moveToNextIndex();
    \n+
    751 }
    \n+
    752 return tracker.finished();
    \n+
    753 }
    \n+
    754 }
    \n+
    755};
    \n+
    756
    \n+
    757
    \n+
    761template<class DataHandle>
    \n+
    762struct UnpackSizeEntries{
    \n+
    763
    \n+
    771 bool operator()(SizeDataHandle<DataHandle>& handle, InterfaceTracker& tracker,
    \n+
    772 MessageBuffer<typename SizeDataHandle<DataHandle>::DataType>& buffer) const
    \n+
    773 {
    \n+
    774 std::size_t noIndices=std::min(buffer.size(), tracker.indicesLeft());
    \n+
    775 std::copy(static_cast<std::size_t*>(buffer), static_cast<std::size_t*>(buffer)+noIndices,
    \n+
    776 handle.getSizesPointer()+tracker.offset());
    \n+
    777 tracker.increment(noIndices);
    \n+
    778 return noIndices;
    \n+
    779 }
    \n+
    780 bool operator()(SizeDataHandle<DataHandle>& handle, InterfaceTracker& tracker,
    \n+
    781 MessageBuffer<typename SizeDataHandle<DataHandle>::DataType>& buffer, int) const
    \n+
    782 {
    \n+
    783 return operator()(handle,tracker,buffer);
    \n+
    784 }
    \n+
    785};
    \n+
    786
    \n+
    794void sendFixedSize(std::vector<InterfaceTracker>& send_trackers,
    \n+
    795 std::vector<MPI_Request>& send_requests,
    \n+
    796 std::vector<InterfaceTracker>& recv_trackers,
    \n+
    797 std::vector<MPI_Request>& recv_requests,
    \n+
    798 MPI_Comm communicator)
    \n+
    799{
    \n+
    800 typedef std::vector<InterfaceTracker>::iterator TIter;
    \n+
    801 std::vector<MPI_Request>::iterator mIter=recv_requests.begin();
    \n+
    802
    \n+
    803 for(TIter iter=recv_trackers.begin(), end=recv_trackers.end(); iter!=end;
    \n+
    804 ++iter, ++mIter)
    \n+
    805 {
    \n+
    806 MPI_Irecv(&(iter->fixedSize), 1, MPITraits<std::size_t>::getType(),
    \n+
    807 iter->rank(), 933881, communicator, &(*mIter));
    \n+
    808 }
    \n+
    809
    \n+
    810 // Send our size to all neighbours using non-blocking synchronous communication.
    \n+
    811 std::vector<MPI_Request>::iterator mIter1=send_requests.begin();
    \n+
    812 for(TIter iter=send_trackers.begin(), end=send_trackers.end();
    \n+
    813 iter!=end;
    \n+
    814 ++iter, ++mIter1)
    \n+
    815 {
    \n+
    816 MPI_Issend(&(iter->fixedSize), 1, MPITraits<std::size_t>::getType(),
    \n+
    817 iter->rank(), 933881, communicator, &(*mIter1));
    \n+
    818 }
    \n+
    819}
    \n+
    820
    \n+
    821
    \n+
    826template<class DataHandle>
    \n+
    827struct SetupSendRequest{
    \n+
    828 void operator()(DataHandle& handle,
    \n+
    829 InterfaceTracker& tracker,
    \n+
    830 MessageBuffer<typename DataHandle::DataType>& buffer,
    \n+
    831 MPI_Request& request,
    \n+
    832 MPI_Comm comm) const
    \n+
    833 {
    \n+
    834 buffer.reset();
    \n+
    835 int size=PackEntries<DataHandle>()(handle, tracker, buffer);
    \n+
    836 // Skip indices of zero size.
    \n+
    837 while(!tracker.finished() && !handle.size(tracker.index()))
    \n+
    838 tracker.moveToNextIndex();
    \n+
    839 if(size)
    \n+
    840 MPI_Issend(buffer, size, MPITraits<typename DataHandle::DataType>::getType(),
    \n+
    841 tracker.rank(), 933399, comm, &request);
    \n+
    842 }
    \n+
    843};
    \n+
    844
    \n+
    845
    \n+
    850template<class DataHandle>
    \n+
    851struct SetupRecvRequest{
    \n+
    852 void operator()(DataHandle& /*handle*/,
    \n+
    853 InterfaceTracker& tracker,
    \n+
    854 MessageBuffer<typename DataHandle::DataType>& buffer,
    \n+
    855 MPI_Request& request,
    \n+
    856 MPI_Comm comm) const
    \n+
    857 {
    \n+
    858 buffer.reset();
    \n+
    859 if(tracker.indicesLeft())
    \n+
    860 MPI_Irecv(buffer, buffer.size(), MPITraits<typename DataHandle::DataType>::getType(),
    \n+
    861 tracker.rank(), 933399, comm, &request);
    \n+
    862 }
    \n+
    863};
    \n+
    864
    \n+
    868template<class DataHandle>
    \n+
    869struct NullPackUnpackFunctor
    \n+
    870{
    \n+
    871 int operator()(DataHandle&, InterfaceTracker&,
    \n+
    872 MessageBuffer<typename DataHandle::DataType>&, int)
    \n+
    873 {
    \n+
    874 return 0;
    \n+
    875 }
    \n+
    876 int operator()(DataHandle&, InterfaceTracker&,
    \n+
    877 MessageBuffer<typename DataHandle::DataType>&)
    \n+
    878 {
    \n+
    879 return 0;
    \n+
    880 }
    \n+
    881};
    \n+
    882
    \n+
    897template<class DataHandle, class BufferFunctor, class CommunicationFunctor>
    \n+
    898std::size_t checkAndContinue(DataHandle& handle,
    \n+
    899 std::vector<InterfaceTracker>& trackers,
    \n+
    900 std::vector<MPI_Request>& requests,
    \n+
    901 std::vector<MPI_Request>& requests2,
    \n+
    902 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    \n+
    903 MPI_Comm comm,
    \n+
    904 BufferFunctor buffer_func,
    \n+
    905 CommunicationFunctor comm_func,
    \n+
    906 bool valid=true,
    \n+
    907 bool getCount=false)
    \n+
    908{
    \n+
    909 std::size_t size=requests.size();
    \n+
    910 std::vector<MPI_Status> statuses(size);
    \n+
    911 int no_completed;
    \n+
    912 std::vector<int> indices(size, -1); // the indices for which the communication finished.
    \n+
    913
    \n+
    914 MPI_Testsome(size, &(requests[0]), &no_completed, &(indices[0]), &(statuses[0]));
    \n+
    915 indices.resize(no_completed);
    \n+
    916 for(std::vector<int>::iterator index=indices.begin(), end=indices.end();
    \n+
    917 index!=end; ++index)
    \n+
    918 {
    \n+
    919 InterfaceTracker& tracker=trackers[*index];
    \n+
    920 setReceivingIndex(handle, *index);
    \n+
    921 if(getCount)
    \n+
    922 {
    \n+
    923 // Get the number of entries received
    \n+
    924 int count;
    \n+
    925 MPI_Get_count(&(statuses[index-indices.begin()]),
    \n+\n+
    927 &count);
    \n+
    928 // Communication completed, we can reuse the buffers, e.g. unpack or repack
    \n+
    929 buffer_func(handle, tracker, buffers[*index], count);
    \n+
    930 }else
    \n+
    931 buffer_func(handle, tracker, buffers[*index]);
    \n+
    932 tracker.skipZeroIndices();
    \n+
    933 if(!tracker.finished()){
    \n+
    934 // Maybe start another communication.
    \n+
    935 comm_func(handle, tracker, buffers[*index], requests2[*index], comm);
    \n+
    936 tracker.skipZeroIndices();
    \n+
    937 if(valid)
    \n+
    938 --no_completed; // communication not finished, decrement counter for finished ones.
    \n+
    939 }
    \n+
    940 }
    \n+
    941 return no_completed;
    \n+
    942
    \n+
    943}
    \n+
    944
    \n+
    954template<class DataHandle>
    \n+
    955std::size_t receiveSizeAndSetupReceive(DataHandle& handle,
    \n+
    956 std::vector<InterfaceTracker>& trackers,
    \n+
    957 std::vector<MPI_Request>& size_requests,
    \n+
    958 std::vector<MPI_Request>& data_requests,
    \n+
    959 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    \n+
    960 MPI_Comm comm)
    \n+
    961{
    \n+
    962 return checkAndContinue(handle, trackers, size_requests, data_requests, buffers, comm,
    \n+
    963 NullPackUnpackFunctor<DataHandle>(), SetupRecvRequest<DataHandle>(), false);
    \n+
    964}
    \n+
    965
    \n+
    974template<class DataHandle>
    \n+
    975std::size_t checkSendAndContinueSending(DataHandle& handle,
    \n+
    976 std::vector<InterfaceTracker>& trackers,
    \n+
    977 std::vector<MPI_Request>& requests,
    \n+
    978 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    \n+
    979 MPI_Comm comm)
    \n+
    980{
    \n+
    981 return checkAndContinue(handle, trackers, requests, requests, buffers, comm,
    \n+
    982 NullPackUnpackFunctor<DataHandle>(), SetupSendRequest<DataHandle>());
    \n+
    983}
    \n+
    984
    \n+
    993template<class DataHandle>
    \n+
    994std::size_t checkReceiveAndContinueReceiving(DataHandle& handle,
    \n+
    995 std::vector<InterfaceTracker>& trackers,
    \n+
    996 std::vector<MPI_Request>& requests,
    \n+
    997 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    \n+
    998 MPI_Comm comm)
    \n+
    999{
    \n+
    1000 return checkAndContinue(handle, trackers, requests, requests, buffers, comm,
    \n+
    1001 UnpackEntries<DataHandle>(), SetupRecvRequest<DataHandle>(),
    \n+
    1002 true, !Impl::callFixedSize(handle));
    \n+
    1003}
    \n+
    1004
    \n+
    1005
    \n+
    1006bool validRecvRequests(const std::vector<MPI_Request> reqs)
    \n+
    1007{
    \n+
    1008 for(std::vector<MPI_Request>::const_iterator i=reqs.begin(), end=reqs.end();
    \n+
    1009 i!=end; ++i)
    \n+
    1010 if(*i!=MPI_REQUEST_NULL)
    \n+
    1011 return true;
    \n+
    1012 return false;
    \n+
    1013}
    \n+
    1014
    \n+
    1025template<class DataHandle, class Functor>
    \n+
    1026std::size_t setupRequests(DataHandle& handle,
    \n+
    1027 std::vector<InterfaceTracker>& trackers,
    \n+
    1028 std::vector<MessageBuffer<typename DataHandle::DataType> >& buffers,
    \n+
    1029 std::vector<MPI_Request>& requests,
    \n+
    1030 const Functor& setupFunctor,
    \n+
    1031 MPI_Comm communicator)
    \n+
    1032{
    \n+
    1033 typedef typename std::vector<InterfaceTracker>::iterator TIter;
    \n+
    1034 typename std::vector<MessageBuffer<typename DataHandle::DataType> >::iterator
    \n+
    1035 biter=buffers.begin();
    \n+
    1036 typename std::vector<MPI_Request>::iterator riter=requests.begin();
    \n+
    1037 std::size_t complete=0;
    \n+
    1038 for(TIter titer=trackers.begin(), end=trackers.end(); titer!=end; ++titer, ++biter, ++riter)
    \n+
    1039 {
    \n+
    1040 setupFunctor(handle, *titer, *biter, *riter, communicator);
    \n+
    1041 complete+=titer->finished();
    \n+
    1042 }
    \n+
    1043 return complete;
    \n+
    1044}
    \n+
    1045} // end unnamed namespace
    \n+
    1046
    \n+
    1047template<class Allocator>
    \n+
    1048template<bool FORWARD, class DataHandle>
    \n+
    1049void VariableSizeCommunicator<Allocator>::setupInterfaceTrackers(DataHandle& handle,
    \n+
    1050 std::vector<InterfaceTracker>& send_trackers,
    \n+
    1051 std::vector<InterfaceTracker>& recv_trackers)
    \n+
    1052{
    \n+
    1053 if(interface_->size()==0)
    \n+
    1054 return;
    \n+
    1055 send_trackers.reserve(interface_->size());
    \n+
    1056 recv_trackers.reserve(interface_->size());
    \n+
    1057
    \n+
    1058 int fixedsize=0;
    \n+
    1059 if(Impl::callFixedSize(handle))
    \n+
    1060 ++fixedsize;
    \n+
    1061
    \n+
    1062
    \n+
    1063 typedef typename InterfaceMap::const_iterator IIter;
    \n+
    1064 for(IIter inf=interface_->begin(), end=interface_->end(); inf!=end; ++inf)
    \n+
    1065 {
    \n+
    1066
    \n+
    1067 if(Impl::callFixedSize(handle) && InterfaceInformationChooser<FORWARD>::getSend(inf->second).size())
    \n+
    1068 fixedsize=handle.size(InterfaceInformationChooser<FORWARD>::getSend(inf->second)[0]);
    \n+
    1069 assert(!Impl::callFixedSize(handle)||fixedsize>0);
    \n+
    1070 send_trackers.push_back(InterfaceTracker(inf->first,
    \n+
    1071 InterfaceInformationChooser<FORWARD>::getSend(inf->second), fixedsize));
    \n+
    1072 recv_trackers.push_back(InterfaceTracker(inf->first,
    \n+
    1073 InterfaceInformationChooser<FORWARD>::getReceive(inf->second), fixedsize, fixedsize==0));
    \n+
    1074 }
    \n+
    1075}
    \n+
    1076
    \n+
    1077template<class Allocator>
    \n+
    1078template<bool FORWARD, class DataHandle>
    \n+
    1079void VariableSizeCommunicator<Allocator>::communicateFixedSize(DataHandle& handle)
    \n+
    1080{
    \n+
    1081 std::vector<MPI_Request> size_send_req(interface_->size());
    \n+
    1082 std::vector<MPI_Request> size_recv_req(interface_->size());
    \n+
    1083
    \n+
    1084 std::vector<InterfaceTracker> send_trackers;
    \n+
    1085 std::vector<InterfaceTracker> recv_trackers;
    \n+
    1086 setupInterfaceTrackers<FORWARD>(handle,send_trackers, recv_trackers);
    \n+
    1087 sendFixedSize(send_trackers, size_send_req, recv_trackers, size_recv_req, communicator_);
    \n+
    1088
    \n+
    1089 std::vector<MPI_Request> data_send_req(interface_->size(), MPI_REQUEST_NULL);
    \n+
    1090 std::vector<MPI_Request> data_recv_req(interface_->size(), MPI_REQUEST_NULL);
    \n+
    1091 typedef typename DataHandle::DataType DataType;
    \n+
    1092 std::vector<MessageBuffer<DataType> > send_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_)),
    \n+
    1093 recv_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_));
    \n+
    1094
    \n+
    1095
    \n+
    1096 setupRequests(handle, send_trackers, send_buffers, data_send_req,
    \n+
    1097 SetupSendRequest<DataHandle>(), communicator_);
    \n+
    1098
    \n+
    1099 std::size_t no_size_to_recv, no_to_send, no_to_recv, old_size;
    \n+
    1100 no_size_to_recv = no_to_send = no_to_recv = old_size = interface_->size();
    \n+
    1101
    \n+
    1102 // Skip empty interfaces.
    \n+
    1103 typedef typename std::vector<InterfaceTracker>::const_iterator Iter;
    \n+
    1104 for(Iter i=recv_trackers.begin(), end=recv_trackers.end(); i!=end; ++i)
    \n+
    1105 if(i->empty())
    \n+
    1106 --no_to_recv;
    \n+
    1107 for(Iter i=send_trackers.begin(), end=send_trackers.end(); i!=end; ++i)
    \n+
    1108 if(i->empty())
    \n+
    1109 --no_to_send;
    \n+
    1110
    \n+
    1111 while(no_size_to_recv+no_to_send+no_to_recv)
    \n+
    1112 {
    \n+
    1113 // Receive the fixedsize and setup receives accordingly
    \n+
    1114 if(no_size_to_recv)
    \n+
    1115 no_size_to_recv -= receiveSizeAndSetupReceive(handle,recv_trackers, size_recv_req,
    \n+
    1116 data_recv_req, recv_buffers,
    \n+
    1117 communicator_);
    \n+
    1118
    \n+
    1119 // Check send completion and initiate other necessary sends
    \n+
    1120 if(no_to_send)
    \n+
    1121 no_to_send -= checkSendAndContinueSending(handle, send_trackers, data_send_req,
    \n+
    1122 send_buffers, communicator_);
    \n+
    1123 if(validRecvRequests(data_recv_req))
    \n+
    1124 // Receive data and setup new unblocking receives if necessary
    \n+
    1125 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers, data_recv_req,
    \n+
    1126 recv_buffers, communicator_);
    \n+
    1127 }
    \n+
    1128
    \n+
    1129 // Wait for completion of sending the size.
    \n+
    1130 //std::vector<MPI_Status> statuses(interface_->size(), MPI_STATUSES_IGNORE);
    \n+
    1131 MPI_Waitall(size_send_req.size(), &(size_send_req[0]), MPI_STATUSES_IGNORE);
    \n+
    1132
    \n+
    1133}
    \n+
    1134
    \n+
    1135template<class Allocator>
    \n+
    1136template<bool FORWARD, class DataHandle>
    \n+
    1137void VariableSizeCommunicator<Allocator>::communicateSizes(DataHandle& handle,
    \n+
    1138 std::vector<InterfaceTracker>& data_recv_trackers)
    \n+
    1139{
    \n+
    1140 std::vector<InterfaceTracker> send_trackers;
    \n+
    1141 std::vector<InterfaceTracker> recv_trackers;
    \n+
    1142 std::size_t size = interface_->size();
    \n+
    1143 std::vector<MPI_Request> send_requests(size, MPI_REQUEST_NULL);
    \n+
    1144 std::vector<MPI_Request> recv_requests(size, MPI_REQUEST_NULL);
    \n+
    1145 std::vector<MessageBuffer<std::size_t> >
    \n+
    1146 send_buffers(size, MessageBuffer<std::size_t>(maxBufferSize_)),
    \n+
    1147 recv_buffers(size, MessageBuffer<std::size_t>(maxBufferSize_));
    \n+
    1148 SizeDataHandle<DataHandle> size_handle(handle,data_recv_trackers);
    \n+
    1149 setupInterfaceTrackers<FORWARD>(size_handle,send_trackers, recv_trackers);
    \n+
    1150 setupRequests(size_handle, send_trackers, send_buffers, send_requests,
    \n+
    1151 SetupSendRequest<SizeDataHandle<DataHandle> >(), communicator_);
    \n+
    1152 setupRequests(size_handle, recv_trackers, recv_buffers, recv_requests,
    \n+
    1153 SetupRecvRequest<SizeDataHandle<DataHandle> >(), communicator_);
    \n+
    1154
    \n+
    1155 // Count valid requests that we have to wait for.
    \n+
    1156 auto valid_req_func =
    \n+
    1157 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL; };
    \n+
    1158
    \n+
    1159 auto size_to_send = std::count_if(send_requests.begin(), send_requests.end(),
    \n+
    1160 valid_req_func);
    \n+
    1161 auto size_to_recv = std::count_if(recv_requests.begin(), recv_requests.end(),
    \n+
    1162 valid_req_func);
    \n+
    1163
    \n+
    1164 while(size_to_send+size_to_recv)
    \n+
    1165 {
    \n+
    1166 if(size_to_send)
    \n+
    1167 size_to_send -=
    \n+
    1168 checkSendAndContinueSending(size_handle, send_trackers, send_requests,
    \n+
    1169 send_buffers, communicator_);
    \n+
    1170 if(size_to_recv)
    \n+
    1171 // Could have done this using checkSendAndContinueSending
    \n+
    1172 // But the call below is more efficient as UnpackSizeEntries
    \n+
    1173 // uses std::copy.
    \n+
    1174 size_to_recv -=
    \n+
    1175 checkAndContinue(size_handle, recv_trackers, recv_requests, recv_requests,
    \n+
    1176 recv_buffers, communicator_, UnpackSizeEntries<DataHandle>(),
    \n+
    1177 SetupRecvRequest<SizeDataHandle<DataHandle> >());
    \n+
    1178 }
    \n+
    1179}
    \n+
    1180
    \n+
    1181template<class Allocator>
    \n+
    1182template<bool FORWARD, class DataHandle>
    \n+
    1183void VariableSizeCommunicator<Allocator>::communicateVariableSize(DataHandle& handle)
    \n+
    1184{
    \n+
    1185
    \n+
    1186 std::vector<InterfaceTracker> send_trackers;
    \n+
    1187 std::vector<InterfaceTracker> recv_trackers;
    \n+
    1188 setupInterfaceTrackers<FORWARD>(handle, send_trackers, recv_trackers);
    \n+
    1189
    \n+
    1190 std::vector<MPI_Request> send_requests(interface_->size(), MPI_REQUEST_NULL);
    \n+
    1191 std::vector<MPI_Request> recv_requests(interface_->size(), MPI_REQUEST_NULL);
    \n+
    1192 typedef typename DataHandle::DataType DataType;
    \n+
    1193 std::vector<MessageBuffer<DataType> >
    \n+
    1194 send_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_)),
    \n+
    1195 recv_buffers(interface_->size(), MessageBuffer<DataType>(maxBufferSize_));
    \n+
    1196
    \n+
    1197 communicateSizes<FORWARD>(handle, recv_trackers);
    \n+
    1198 // Setup requests for sending and receiving.
    \n+
    1199 setupRequests(handle, send_trackers, send_buffers, send_requests,
    \n+
    1200 SetupSendRequest<DataHandle>(), communicator_);
    \n+
    1201 setupRequests(handle, recv_trackers, recv_buffers, recv_requests,
    \n+
    1202 SetupRecvRequest<DataHandle>(), communicator_);
    \n+
    1203
    \n+
    1204 // Determine number of valid requests.
    \n+
    1205 auto valid_req_func =
    \n+
    1206 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL;};
    \n+
    1207
    \n+
    1208 auto no_to_send = std::count_if(send_requests.begin(), send_requests.end(),
    \n+
    1209 valid_req_func);
    \n+
    1210 auto no_to_recv = std::count_if(recv_requests.begin(), recv_requests.end(),
    \n+
    1211 valid_req_func);
    \n+
    1212 while(no_to_send+no_to_recv)
    \n+
    1213 {
    \n+
    1214 // Check send completion and initiate other necessary sends
    \n+
    1215 if(no_to_send)
    \n+
    1216 no_to_send -= checkSendAndContinueSending(handle, send_trackers, send_requests,
    \n+
    1217 send_buffers, communicator_);
    \n+
    1218 if(no_to_recv)
    \n+
    1219 // Receive data and setup new unblocking receives if necessary
    \n+
    1220 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers, recv_requests,
    \n+
    1221 recv_buffers, communicator_);
    \n+
    1222 }
    \n+
    1223}
    \n+
    1224
    \n+
    1225template<class Allocator>
    \n+
    1226template<bool FORWARD, class DataHandle>
    \n+
    1227void VariableSizeCommunicator<Allocator>::communicate(DataHandle& handle)
    \n+
    1228{
    \n+
    1229 if( interface_->size() == 0)
    \n+
    1230 // Simply return as otherwise we will index an empty container
    \n+
    1231 // either for MPI_Wait_all or MPI_Test_some.
    \n+
    1232 return;
    \n+
    1233
    \n+
    1234 if(Impl::callFixedSize(handle))
    \n+
    1235 communicateFixedSize<FORWARD>(handle);
    \n+
    1236 else
    \n+
    1237 communicateVariableSize<FORWARD>(handle);
    \n+
    1238}
    \n+
    1239} // end namespace Dune
    \n+
    1240
    \n+
    1241#endif // HAVE_MPI
    \n+
    1242
    \n+
    1243#endif
    \n+
    std::size_t fixedSize
    The number of data items per index if it is fixed, 0 otherwise.
    Definition: variablesizecommunicator.hh:265
    \n+
    Traits classes for mapping types onto MPI_Datatype.
    \n+
    Infrastructure for concepts.
    \n+
    MPI_Comm communicator() const
    Get the MPI Communicator.
    Definition: parallel/interface.hh:417
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    size_type size() const
    size method
    Definition: densevector.hh:336
    \n-
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition: densevector.hh:259
    \n-
    T type
    Definition: typetraits.hh:501
    \n+
    auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition: debugalign.hh:447
    \n+
    static MPI_Datatype getType()
    Definition: mpitraits.hh:48
    \n+
    size_t size() const
    Get the number of entries in the interface.
    Definition: parallel/interface.hh:108
    \n+
    Communication interface between remote and local indices.
    Definition: parallel/interface.hh:209
    \n+
    Definition: variablesizecommunicator.hh:43
    \n+
    auto require(H &&h) -> decltype(h.fixedSize())
    \n+
    A buffered communicator where the amount of data sent does not have to be known a priori.
    Definition: variablesizecommunicator.hh:332
    \n+
    VariableSizeCommunicator(const Interface &inf, std::size_t max_buffer_size)
    Creates a communicator with a specific maximum buffer size.
    Definition: variablesizecommunicator.hh:404
    \n+
    void backward(DataHandle &handle)
    Communicate backwards.
    Definition: variablesizecommunicator.hh:486
    \n+
    ~VariableSizeCommunicator()
    Definition: variablesizecommunicator.hh:410
    \n+
    VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf, std::size_t max_buffer_size)
    Creates a communicator with a specific maximum buffer size.
    Definition: variablesizecommunicator.hh:393
    \n+
    VariableSizeCommunicator(const VariableSizeCommunicator &other)
    Copy-constructs a communicator.
    Definition: variablesizecommunicator.hh:419
    \n+
    void forward(DataHandle &handle)
    Communicate forward.
    Definition: variablesizecommunicator.hh:461
    \n+
    VariableSizeCommunicator & operator=(const VariableSizeCommunicator &other)
    Copy-assignes a communicator.
    Definition: variablesizecommunicator.hh:429
    \n+
    std::map< int, std::pair< InterfaceInformation, InterfaceInformation >, std::less< int >, typename std::allocator_traits< Allocator >::template rebind_alloc< std::pair< const int, std::pair< InterfaceInformation, InterfaceInformation > > > > InterfaceMap
    The type of the map from process number to InterfaceInformation for sending and receiving to and from...
    Definition: variablesizecommunicator.hh:340
    \n+
    VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf)
    Creates a communicator with the default maximum buffer size.
    Definition: variablesizecommunicator.hh:349
    \n+
    VariableSizeCommunicator(const Interface &inf)
    Creates a communicator with the default maximum buffer size.
    Definition: variablesizecommunicator.hh:358
    \n+
    Provides classes for building the communication interface between remote indices.
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,215 +4,1008 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-scalarvectorview.hh\n+ * parallel\n+variablesizecommunicator.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_SCALARVECTORVIEW_HH\n- 6#define DUNE_COMMON_SCALARVECTORVIEW_HH\n+ 5#ifndef DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH // Still fits the\n+line!\n+ 6#define DUNE_COMMON_PARALLEL_VARIABLESIZECOMMUNICATOR_HH\n 7\n- 8#include \n- 9#include \n- 10#include \n- 11\n- 12#include \n- 13#include \n- 14#include \n- 15#include \n- 16\n- 17namespace Dune {\n- 18\n- 19namespace Impl {\n- 20\n- 35 template\n- 36 class ScalarVectorView :\n- 37 public DenseVector>\n- 38 {\n- 39 K* dataP_;\n- 40 using Base = DenseVector>;\n- 41\n- 42 template \n- 43 friend class ScalarVectorView;\n- 44 public:\n- 45\n- 47 constexpr static int dimension = 1;\n+ 8#if HAVE_MPI\n+ 9\n+ 10#include \n+ 11#include \n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16#include \n+ 17#include \n+ 18#include \n+ 19\n+ 20#include \n+ 21\n+ 22#include \n+ 23#include \n+ 24#include \n+ 25\n+ 38namespace Dune\n+ 39{\n+ 40\n+ 41namespace Concept {\n+ 42\n+43struct HasFixedSize {\n+44 template auto require(H &&h) -> decltype(h.fixedSize());\n+ 45};\n+ 46\n+ 47} // namespace Concept\n 48\n- 50 using size_type = typename Base::size_type;\n- 51\n- 53 using reference = std::decay_t&;\n- 54\n- 56 using const_reference = const K&;\n- 57\n- 58 //===== construction\n- 59\n- 61 constexpr ScalarVectorView ()\n- 62 : dataP_(nullptr)\n- 63 {}\n- 64\n- 66 ScalarVectorView (K* p) :\n- 67 dataP_(p)\n- 68 {}\n- 69\n- 71 ScalarVectorView (const ScalarVectorView &other) :\n- 72 Base(),\n- 73 dataP_(other.dataP_)\n- 74 {}\n- 75\n- 77 ScalarVectorView (ScalarVectorView &&other) :\n- 78 Base(),\n- 79 dataP_( other.dataP_ )\n- 80 {}\n- 81\n- 83 ScalarVectorView& operator= (const ScalarVectorView& other)\n- 84 {\n- 85 assert(dataP_);\n- 86 assert(other.dataP_);\n- 87 *dataP_ = *(other.dataP_);\n- 88 return *this;\n- 89 }\n- 90\n- 91 template\n- 92 ScalarVectorView& operator= (const ScalarVectorView& other)\n- 93 {\n- 94 assert(dataP_);\n- 95 assert(other.dataP_);\n- 96 *dataP_ = *(other.dataP_);\n- 97 return *this;\n- 98 }\n- 99\n- 101 template::value, int> = 0>\n- 103 inline ScalarVectorView& operator= (const T& k)\n- 104 {\n- 105 *dataP_ = k;\n- 106 return *this;\n- 107 }\n- 108\n- 110 static constexpr size_type size ()\n- 111 {\n- 112 return 1;\n- 113 }\n- 114\n- 116 K& operator[] ([[maybe_unused]] size_type i)\n- 117 {\n- 118 DUNE_ASSERT_BOUNDS(i == 0);\n- 119 return *dataP_;\n- 120 }\n- 121\n- 123 const K& operator[] ([[maybe_unused]] size_type i) const\n- 124 {\n- 125 DUNE_ASSERT_BOUNDS(i == 0);\n- 126 return *dataP_;\n- 127 }\n- 128 }; // class ScalarVectorView\n- 129\n- 130} // namespace Impl\n- 131\n- 132\n- 133 template< class K>\n- 134 struct DenseMatVecTraits< Impl::ScalarVectorView >\n- 135 {\n- 136 using derived_type = Impl::ScalarVectorView;\n- 137 using value_type = std::remove_const_t;\n- 138 using size_type = std::size_t;\n- 139 };\n- 140\n- 141 template< class K >\n- 142 struct FieldTraits< Impl::ScalarVectorView > : public FieldTraits> {};\n- 143\n- 144 template\n- 145 struct AutonomousValueType>\n- 146 {\n- 147 using type = FieldVector,1>;\n- 148 };\n- 149\n- 150namespace Impl {\n+ 49namespace Impl {\n+ 50\n+ 51template (), int> = 0>\n+ 53constexpr bool callFixedSize(H &&handle) {\n+ 54 return handle.fixedSize();\n+ 55}\n+ 56\n+ 57} // namespace Impl\n+ 58\n+ 59namespace\n+ 60{\n+ 65template >\n+ 66class MessageBuffer\n+ 67{\n+ 68public:\n+ 73 explicit MessageBuffer(int size)\n+ 74 : buffer_(new T[size]), size_(size), position_(0)\n+ 75 {}\n+ 80 explicit MessageBuffer(const MessageBuffer& o)\n+ 81 : buffer_(new T[o.size_]), size_(o.size_), position_(o.position_)\n+ 82 {\n+ 83 }\n+ 85 ~MessageBuffer()\n+ 86 {\n+ 87 delete[] buffer_;\n+ 88 }\n+ 93 void write(const T& data)\n+ 94 {\n+ 95 buffer_[position_++]=data;\n+ 96 }\n+ 97\n+ 102 void read(T& data)\n+ 103 {\n+ 104 data=buffer_[position_++];\n+ 105 }\n+ 106\n+ 112 void reset()\n+ 113 {\n+ 114 position_=0;\n+ 115 }\n+ 116\n+ 121 bool finished()\n+ 122 {\n+ 123 return position_==size_;\n+ 124 }\n+ 125\n+ 131 bool hasSpaceForItems(int noItems)\n+ 132 {\n+ 133 return position_+noItems<=size_;\n+ 134 }\n+ 139 std::size_t size() const\n+ 140 {\n+ 141 return size_;\n+ 142 }\n+ 147 operator T*()\n+ 148 {\n+ 149 return buffer_;\n+ 150 }\n 151\n- 163 template\n- 164 inline std::istream &operator>>( std::istream &in, ScalarVectorView &v\n-)\n- 165 {\n- 166 K w;\n- 167 if(in >> w)\n- 168 v = w;\n- 169 return in;\n- 170 }\n- 171\n- 172\n- 174 template::value, int> = 0>\n- 176 auto asVector(T& t)\n- 177 {\n- 178 return ScalarVectorView{&t};\n- 179 }\n- 180\n- 182 template::value, int> = 0>\n- 184 auto asVector(const T& t)\n- 185 {\n- 186 return ScalarVectorView{&t};\n- 187 }\n- 188\n- 190 template::value, int> = 0>\n- 192 T& asVector(T& t)\n- 193 {\n- 194 return t;\n- 195 }\n- 196\n- 198 template::value, int> = 0>\n- 200 const T& asVector(const T& t)\n- 201 {\n- 202 return t;\n- 203 }\n- 204\n- 205} // end namespace Impl\n- 206\n- 207} // end namespace Dune\n- 208\n- 209#endif // DUNE_COMMON_SCALARVECTORVIEW_HH\n-matvectraits.hh\n-Documentation of the traits classes you need to write for each implementation\n-of DenseVector or Dense...\n-densevector.hh\n-Implements the dense vector interface, with an exchangeable storage class.\n-fvector.hh\n-Implements a vector constructed from a given type representing a field and a\n-compile-time given size.\n-typetraits.hh\n-Traits for type conversions and type information.\n-Dune::operator>>\n-Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)\n-Read a std::tuple.\n-Definition: streamoperators.hh:43\n-DUNE_ASSERT_BOUNDS\n-#define DUNE_ASSERT_BOUNDS(cond)\n-If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do\n-nothing.\n-Definition: boundschecking.hh:30\n+ 152private:\n+ 156 T* buffer_;\n+ 160 std::size_t size_;\n+ 164 std::size_t position_;\n+ 165};\n+ 166\n+ 170class InterfaceTracker\n+ 171{\n+ 172public:\n+ 178 InterfaceTracker(int rank, InterfaceInformation info, std::size_t\n+fixedsize=0,\n+ 179 bool allocateSizes=false)\n+ 180 : fixedSize(fixedsize),rank_(rank), index_(), interface_(info), sizes_()\n+ 181 {\n+ 182 if(allocateSizes)\n+ 183 {\n+ 184 sizes_.resize(info.size());\n+ 185 }\n+ 186 }\n+ 187\n+ 191 void moveToNextIndex()\n+ 192 {\n+ 193 index_++;\n+ 194 assert(index_<=interface_.size());\n+ 195 skipZeroIndices();\n+ 196 }\n+ 201 void increment(std::size_t i)\n+ 202 {\n+ 203 index_+=i;\n+ 204 assert(index_<=interface_.size());\n+ 205 }\n+ 210 bool finished() const\n+ 211 {\n+ 212 return index_==interface_.size();\n+ 213 }\n+ 214\n+ 215 void skipZeroIndices()\n+ 216 {\n+ 217 // skip indices with size zero!\n+ 218 while(sizes_.size() && index_!=interface_.size() &&!size())\n+ 219 ++index_;\n+ 220 }\n+ 221\n+ 226 std::size_t index() const\n+ 227 {\n+ 228 return interface_[index_];\n+ 229 }\n+ 233 std::size_t size() const\n+ 234 {\n+ 235 assert(sizes_.size());\n+ 236 return sizes_[index_];\n+ 237 }\n+ 241 std::size_t* getSizesPointer()\n+ 242 {\n+ 243 return &sizes_[0];\n+ 244 }\n+ 249 bool empty() const\n+ 250 {\n+ 251 return !interface_.size();\n+ 252 }\n+ 253\n+ 258 std::size_t indicesLeft() const\n+ 259 {\n+ 260 return interface_.size()-index_;\n+ 261 }\n+265 std::size_t fixedSize;\n+ 269 int rank() const\n+ 270 {\n+ 271 return rank_;\n+ 272 }\n+ 276 std::size_t offset() const\n+ 277 {\n+ 278 return index_;\n+ 279 }\n+ 280private:\n+ 282 int rank_;\n+ 284 std::size_t index_;\n+ 286 InterfaceInformation interface_;\n+ 287 std::vector sizes_;\n+ 288};\n+ 289\n+ 290\n+ 291} // end unnamed namespace\n+ 292\n+ 330template > >\n+331class VariableSizeCommunicator\n+ 332{\n+ 333public:\n+ 338 typedef std::map,\n+ 339 std::less,\n+340 typename std::allocator_traits::template rebind_alloc< std::\n+pair > > >\n+InterfaceMap;\n+ 341\n+ 342#ifndef DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE\n+349 VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap& inf)\n+ 350 : maxBufferSize_(32768), interface_(&inf)\n+ 351 {\n+ 352 MPI_Comm_dup(comm, &communicator_);\n+ 353 }\n+358 VariableSizeCommunicator(const Interface& inf)\n+ 359 : maxBufferSize_(32768), interface_(&inf.interfaces())\n+ 360 {\n+ 361 MPI_Comm_dup(inf.communicator(), &communicator_);\n+ 362 }\n+ 363#else\n+ 370 VariableSizeCommunicator(MPI_Comm comm, InterfaceMap& inf)\n+ 371 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE),\n+ 372 interface_(&inf)\n+ 373 {\n+ 374 MPI_Comm_dup(comm, &communicator_);\n+ 375 }\n+ 380 VariableSizeCommunicator(const Interface& inf)\n+ 381 : maxBufferSize_(DUNE_PARALLEL_MAX_COMMUNICATION_BUFFER_SIZE),\n+ 382 interface_(&inf.interfaces())\n+ 383 {\n+ 384 MPI_Comm_dup(inf.communicator(), &communicator_);\n+ 385 }\n+ 386#endif\n+393 VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap& inf, std::\n+size_t max_buffer_size)\n+ 394 : maxBufferSize_(max_buffer_size), interface_(&inf)\n+ 395 {\n+ 396 MPI_Comm_dup(comm, &communicator_);\n+ 397 }\n+ 398\n+404 VariableSizeCommunicator(const Interface& inf, std::size_t max_buffer_size)\n+ 405 : maxBufferSize_(max_buffer_size), interface_(&inf.interfaces())\n+ 406 {\n+ 407 MPI_Comm_dup(inf.communicator(), &communicator_);\n+ 408 }\n+ 409\n+410 ~VariableSizeCommunicator()\n+ 411 {\n+ 412 MPI_Comm_free(&communicator_);\n+ 413 }\n+ 414\n+419 VariableSizeCommunicator(const VariableSizeCommunicator& other) {\n+ 420 maxBufferSize_ = other.maxBufferSize_;\n+ 421 interface_ = other.interface_;\n+ 422 MPI_Comm_dup(other.communicator_, &communicator_);\n+ 423 }\n+ 424\n+429 VariableSizeCommunicator& operator=(const VariableSizeCommunicator& other)\n+{\n+ 430 if(this == &other) // don't do anything if objects are the same\n+ 431 return *this;\n+ 432\n+ 433 maxBufferSize_ = other.maxBufferSize_;\n+ 434 interface_ = other.interface_;\n+ 435 MPI_Comm_free(&communicator_);\n+ 436 MPI_Comm_dup(other.communicator_, &communicator_);\n+ 437\n+ 438 return *this;\n+ 439 }\n+ 440\n+ 460 template\n+461 void forward(DataHandle& handle)\n+ 462 {\n+ 463 communicate(handle);\n+ 464 }\n+ 465\n+ 485 template\n+486 void backward(DataHandle& handle)\n+ 487 {\n+ 488 communicate(handle);\n+ 489 }\n+ 490\n+ 491private:\n+ 492 template\n+ 493 void communicateSizes(DataHandle& handle,\n+ 494 std::vector& recv_trackers);\n+ 495\n+ 502 template\n+ 503 void communicate(DataHandle& handle);\n+ 513 template\n+ 514 void setupInterfaceTrackers(DataHandle& handle,\n+ 515 std::vector& send_trackers,\n+ 516 std::vector& recv_trackers);\n+ 524 template\n+ 525 void communicateFixedSize(DataHandle& handle);\n+ 533 template\n+ 534 void communicateVariableSize(DataHandle& handle);\n+ 541 std::size_t maxBufferSize_;\n+ 549 const InterfaceMap* interface_;\n+ 555 MPI_Comm communicator_;\n+ 556};\n+ 557\n+ 559namespace\n+ 560{\n+ 564template\n+ 565class SizeDataHandle\n+ 566{\n+ 567public:\n+ 568 typedef std::size_t DataType;\n+ 569\n+ 570 SizeDataHandle(DataHandle& data,\n+ 571 std::vector& trackers)\n+ 572 : data_(data), trackers_(trackers), index_()\n+ 573 {}\n+ 574 bool fixedSize()\n+ 575 {\n+ 576 return true;\n+ 577 }\n+ 578 std::size_t size([[maybe_unused]] std::size_t i)\n+ 579 {\n+ 580 return 1;\n+ 581 }\n+ 582 template\n+ 583 void gather(B& buf, int i)\n+ 584 {\n+ 585 buf.write(data_.size(i));\n+ 586 }\n+ 587 void setReceivingIndex(std::size_t i)\n+ 588 {\n+ 589 index_=i;\n+ 590 }\n+ 591 std::size_t* getSizesPointer()\n+ 592 {\n+ 593 return trackers_[index_].getSizesPointer();\n+ 594 }\n+ 595\n+ 596private:\n+ 597 DataHandle& data_;\n+ 598 std::vector& trackers_;\n+ 599 int index_;\n+ 600};\n+ 601\n+ 602template\n+ 603void setReceivingIndex(T&, int)\n+ 604{}\n+ 605\n+ 606template\n+ 607void setReceivingIndex(SizeDataHandle& t, int i)\n+ 608{\n+ 609 t.setReceivingIndex(i);\n+ 610}\n+ 611\n+ 612\n+ 618template\n+ 619struct InterfaceInformationChooser\n+ 620{\n+ 624 static const InterfaceInformation&\n+ 625 getSend(const std::pair& info)\n+ 626 {\n+ 627 return info.first;\n+ 628 }\n+ 629\n+ 633 static const InterfaceInformation&\n+ 634 getReceive(const std::pair&\n+info)\n+ 635 {\n+ 636 return info.second;\n+ 637 }\n+ 638};\n+ 639\n+ 640template<>\n+ 641struct InterfaceInformationChooser\n+ 642{\n+ 643 static const InterfaceInformation&\n+ 644 getSend(const std::pair& info)\n+ 645 {\n+ 646 return info.second;\n+ 647 }\n+ 648\n+ 649 static const InterfaceInformation&\n+ 650 getReceive(const std::pair&\n+info)\n+ 651 {\n+ 652 return info.first;\n+ 653 }\n+ 654};\n+ 655\n+ 661template\n+ 662struct PackEntries\n+ 663{\n+ 664\n+ 665 int operator()(DataHandle& handle, InterfaceTracker& tracker,\n+ 666 MessageBuffer& buffer,\n+ 667 [[maybe_unused]] int i) const\n+ 668 {\n+ 669 return operator()(handle,tracker,buffer);\n+ 670 }\n+ 671\n+ 679 int operator()(DataHandle& handle, InterfaceTracker& tracker,\n+ 680 MessageBuffer& buffer) const\n+ 681 {\n+ 682 if(tracker.fixedSize) // fixed size if variable is >0!\n+ 683 {\n+ 684\n+ 685 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize,\n+tracker.indicesLeft());\n+ 686 for(std::size_t i=0; i< noIndices; ++i)\n+ 687 {\n+ 688 handle.gather(buffer, tracker.index());\n+ 689 tracker.moveToNextIndex();\n+ 690 }\n+ 691 return noIndices*tracker.fixedSize;\n+ 692 }\n+ 693 else\n+ 694 {\n+ 695 int packed=0;\n+ 696 tracker.skipZeroIndices();\n+ 697 while(!tracker.finished())\n+ 698 if(buffer.hasSpaceForItems(handle.size(tracker.index())))\n+ 699 {\n+ 700 handle.gather(buffer, tracker.index());\n+ 701 packed+=handle.size(tracker.index());\n+ 702 tracker.moveToNextIndex();\n+ 703 }\n+ 704 else\n+ 705 break;\n+ 706 return packed;\n+ 707 }\n+ 708 }\n+ 709};\n+ 710\n+ 716template\n+ 717struct UnpackEntries{\n+ 718\n+ 726 bool operator()(DataHandle& handle, InterfaceTracker& tracker,\n+ 727 MessageBuffer& buffer,\n+ 728 int count=0)\n+ 729 {\n+ 730 if(tracker.fixedSize) // fixed size if variable is >0!\n+ 731 {\n+ 732 std::size_t noIndices=std::min(buffer.size()/tracker.fixedSize,\n+tracker.indicesLeft());\n+ 733\n+ 734 for(std::size_t i=0; i< noIndices; ++i)\n+ 735 {\n+ 736 handle.scatter(buffer, tracker.index(), tracker.fixedSize);\n+ 737 tracker.moveToNextIndex();\n+ 738 }\n+ 739 return tracker.finished();\n+ 740 }\n+ 741 else\n+ 742 {\n+ 743 assert(count);\n+ 744 for(int unpacked=0;unpacked\n+ 762struct UnpackSizeEntries{\n+ 763\n+ 771 bool operator()(SizeDataHandle& handle, InterfaceTracker&\n+tracker,\n+ 772 MessageBuffer::DataType>& buffer)\n+const\n+ 773 {\n+ 774 std::size_t noIndices=std::min(buffer.size(), tracker.indicesLeft());\n+ 775 std::copy(static_cast(buffer), static_cast\n+(buffer)+noIndices,\n+ 776 handle.getSizesPointer()+tracker.offset());\n+ 777 tracker.increment(noIndices);\n+ 778 return noIndices;\n+ 779 }\n+ 780 bool operator()(SizeDataHandle& handle, InterfaceTracker&\n+tracker,\n+ 781 MessageBuffer::DataType>& buffer, int)\n+const\n+ 782 {\n+ 783 return operator()(handle,tracker,buffer);\n+ 784 }\n+ 785};\n+ 786\n+ 794void sendFixedSize(std::vector& send_trackers,\n+ 795 std::vector& send_requests,\n+ 796 std::vector& recv_trackers,\n+ 797 std::vector& recv_requests,\n+ 798 MPI_Comm communicator)\n+ 799{\n+ 800 typedef std::vector::iterator TIter;\n+ 801 std::vector::iterator mIter=recv_requests.begin();\n+ 802\n+ 803 for(TIter iter=recv_trackers.begin(), end=recv_trackers.end(); iter!=end;\n+ 804 ++iter, ++mIter)\n+ 805 {\n+ 806 MPI_Irecv(&(iter->fixedSize), 1, MPITraits::getType(),\n+ 807 iter->rank(), 933881, communicator, &(*mIter));\n+ 808 }\n+ 809\n+ 810 // Send our size to all neighbours using non-blocking synchronous\n+communication.\n+ 811 std::vector::iterator mIter1=send_requests.begin();\n+ 812 for(TIter iter=send_trackers.begin(), end=send_trackers.end();\n+ 813 iter!=end;\n+ 814 ++iter, ++mIter1)\n+ 815 {\n+ 816 MPI_Issend(&(iter->fixedSize), 1, MPITraits::getType(),\n+ 817 iter->rank(), 933881, communicator, &(*mIter1));\n+ 818 }\n+ 819}\n+ 820\n+ 821\n+ 826template\n+ 827struct SetupSendRequest{\n+ 828 void operator()(DataHandle& handle,\n+ 829 InterfaceTracker& tracker,\n+ 830 MessageBuffer& buffer,\n+ 831 MPI_Request& request,\n+ 832 MPI_Comm comm) const\n+ 833 {\n+ 834 buffer.reset();\n+ 835 int size=PackEntries()(handle, tracker, buffer);\n+ 836 // Skip indices of zero size.\n+ 837 while(!tracker.finished() && !handle.size(tracker.index()))\n+ 838 tracker.moveToNextIndex();\n+ 839 if(size)\n+ 840 MPI_Issend(buffer, size, MPITraits::getType\n+(),\n+ 841 tracker.rank(), 933399, comm, &request);\n+ 842 }\n+ 843};\n+ 844\n+ 845\n+ 850template\n+ 851struct SetupRecvRequest{\n+ 852 void operator()(DataHandle& /*handle*/,\n+ 853 InterfaceTracker& tracker,\n+ 854 MessageBuffer& buffer,\n+ 855 MPI_Request& request,\n+ 856 MPI_Comm comm) const\n+ 857 {\n+ 858 buffer.reset();\n+ 859 if(tracker.indicesLeft())\n+ 860 MPI_Irecv(buffer, buffer.size(), MPITraits::getType(),\n+ 861 tracker.rank(), 933399, comm, &request);\n+ 862 }\n+ 863};\n+ 864\n+ 868template\n+ 869struct NullPackUnpackFunctor\n+ 870{\n+ 871 int operator()(DataHandle&, InterfaceTracker&,\n+ 872 MessageBuffer&, int)\n+ 873 {\n+ 874 return 0;\n+ 875 }\n+ 876 int operator()(DataHandle&, InterfaceTracker&,\n+ 877 MessageBuffer&)\n+ 878 {\n+ 879 return 0;\n+ 880 }\n+ 881};\n+ 882\n+ 897template\n+ 898std::size_t checkAndContinue(DataHandle& handle,\n+ 899 std::vector& trackers,\n+ 900 std::vector& requests,\n+ 901 std::vector& requests2,\n+ 902 std::vector >& buffers,\n+ 903 MPI_Comm comm,\n+ 904 BufferFunctor buffer_func,\n+ 905 CommunicationFunctor comm_func,\n+ 906 bool valid=true,\n+ 907 bool getCount=false)\n+ 908{\n+ 909 std::size_t size=requests.size();\n+ 910 std::vector statuses(size);\n+ 911 int no_completed;\n+ 912 std::vector indices(size, -1); // the indices for which the\n+communication finished.\n+ 913\n+ 914 MPI_Testsome(size, &(requests[0]), &no_completed, &(indices[0]), &\n+(statuses[0]));\n+ 915 indices.resize(no_completed);\n+ 916 for(std::vector::iterator index=indices.begin(), end=indices.end();\n+ 917 index!=end; ++index)\n+ 918 {\n+ 919 InterfaceTracker& tracker=trackers[*index];\n+ 920 setReceivingIndex(handle, *index);\n+ 921 if(getCount)\n+ 922 {\n+ 923 // Get the number of entries received\n+ 924 int count;\n+ 925 MPI_Get_count(&(statuses[index-indices.begin()]),\n+ 926 MPITraits::getType(),\n+ 927 &count);\n+ 928 // Communication completed, we can reuse the buffers, e.g. unpack or\n+repack\n+ 929 buffer_func(handle, tracker, buffers[*index], count);\n+ 930 }else\n+ 931 buffer_func(handle, tracker, buffers[*index]);\n+ 932 tracker.skipZeroIndices();\n+ 933 if(!tracker.finished()){\n+ 934 // Maybe start another communication.\n+ 935 comm_func(handle, tracker, buffers[*index], requests2[*index], comm);\n+ 936 tracker.skipZeroIndices();\n+ 937 if(valid)\n+ 938 --no_completed; // communication not finished, decrement counter for\n+finished ones.\n+ 939 }\n+ 940 }\n+ 941 return no_completed;\n+ 942\n+ 943}\n+ 944\n+ 954template\n+ 955std::size_t receiveSizeAndSetupReceive(DataHandle& handle,\n+ 956 std::vector& trackers,\n+ 957 std::vector& size_requests,\n+ 958 std::vector& data_requests,\n+ 959 std::vector >& buffers,\n+ 960 MPI_Comm comm)\n+ 961{\n+ 962 return checkAndContinue(handle, trackers, size_requests, data_requests,\n+buffers, comm,\n+ 963 NullPackUnpackFunctor(), SetupRecvRequest(),\n+false);\n+ 964}\n+ 965\n+ 974template\n+ 975std::size_t checkSendAndContinueSending(DataHandle& handle,\n+ 976 std::vector& trackers,\n+ 977 std::vector& requests,\n+ 978 std::vector >& buffers,\n+ 979 MPI_Comm comm)\n+ 980{\n+ 981 return checkAndContinue(handle, trackers, requests, requests, buffers,\n+comm,\n+ 982 NullPackUnpackFunctor(), SetupSendRequest());\n+ 983}\n+ 984\n+ 993template\n+ 994std::size_t checkReceiveAndContinueReceiving(DataHandle& handle,\n+ 995 std::vector& trackers,\n+ 996 std::vector& requests,\n+ 997 std::vector >& buffers,\n+ 998 MPI_Comm comm)\n+ 999{\n+ 1000 return checkAndContinue(handle, trackers, requests, requests, buffers,\n+comm,\n+ 1001 UnpackEntries(), SetupRecvRequest(),\n+ 1002 true, !Impl::callFixedSize(handle));\n+ 1003}\n+ 1004\n+ 1005\n+ 1006bool validRecvRequests(const std::vector reqs)\n+ 1007{\n+ 1008 for(std::vector::const_iterator i=reqs.begin(), end=reqs.end\n+();\n+ 1009 i!=end; ++i)\n+ 1010 if(*i!=MPI_REQUEST_NULL)\n+ 1011 return true;\n+ 1012 return false;\n+ 1013}\n+ 1014\n+ 1025template\n+ 1026std::size_t setupRequests(DataHandle& handle,\n+ 1027 std::vector& trackers,\n+ 1028 std::vector >& buffers,\n+ 1029 std::vector& requests,\n+ 1030 const Functor& setupFunctor,\n+ 1031 MPI_Comm communicator)\n+ 1032{\n+ 1033 typedef typename std::vector::iterator TIter;\n+ 1034 typename std::vector >::\n+iterator\n+ 1035 biter=buffers.begin();\n+ 1036 typename std::vector::iterator riter=requests.begin();\n+ 1037 std::size_t complete=0;\n+ 1038 for(TIter titer=trackers.begin(), end=trackers.end(); titer!=end;\n+++titer, ++biter, ++riter)\n+ 1039 {\n+ 1040 setupFunctor(handle, *titer, *biter, *riter, communicator);\n+ 1041 complete+=titer->finished();\n+ 1042 }\n+ 1043 return complete;\n+ 1044}\n+ 1045} // end unnamed namespace\n+ 1046\n+ 1047template\n+ 1048template\n+ 1049void VariableSizeCommunicator::setupInterfaceTrackers\n+(DataHandle& handle,\n+ 1050 std::vector& send_trackers,\n+ 1051 std::vector& recv_trackers)\n+ 1052{\n+ 1053 if(interface_->size()==0)\n+ 1054 return;\n+ 1055 send_trackers.reserve(interface_->size());\n+ 1056 recv_trackers.reserve(interface_->size());\n+ 1057\n+ 1058 int fixedsize=0;\n+ 1059 if(Impl::callFixedSize(handle))\n+ 1060 ++fixedsize;\n+ 1061\n+ 1062\n+ 1063 typedef typename InterfaceMap::const_iterator IIter;\n+ 1064 for(IIter inf=interface_->begin(), end=interface_->end(); inf!=end;\n+++inf)\n+ 1065 {\n+ 1066\n+ 1067 if(Impl::callFixedSize(handle) && InterfaceInformationChooser::\n+getSend(inf->second).size())\n+ 1068 fixedsize=handle.size(InterfaceInformationChooser::getSend(inf-\n+>second)[0]);\n+ 1069 assert(!Impl::callFixedSize(handle)||fixedsize>0);\n+ 1070 send_trackers.push_back(InterfaceTracker(inf->first,\n+ 1071 InterfaceInformationChooser::getSend(inf->second), fixedsize));\n+ 1072 recv_trackers.push_back(InterfaceTracker(inf->first,\n+ 1073 InterfaceInformationChooser::getReceive(inf->second), fixedsize,\n+fixedsize==0));\n+ 1074 }\n+ 1075}\n+ 1076\n+ 1077template\n+ 1078template\n+ 1079void VariableSizeCommunicator::communicateFixedSize(DataHandle&\n+handle)\n+ 1080{\n+ 1081 std::vector size_send_req(interface_->size());\n+ 1082 std::vector size_recv_req(interface_->size());\n+ 1083\n+ 1084 std::vector send_trackers;\n+ 1085 std::vector recv_trackers;\n+ 1086 setupInterfaceTrackers(handle,send_trackers, recv_trackers);\n+ 1087 sendFixedSize(send_trackers, size_send_req, recv_trackers, size_recv_req,\n+communicator_);\n+ 1088\n+ 1089 std::vector data_send_req(interface_->size(),\n+MPI_REQUEST_NULL);\n+ 1090 std::vector data_recv_req(interface_->size(),\n+MPI_REQUEST_NULL);\n+ 1091 typedef typename DataHandle::DataType DataType;\n+ 1092 std::vector > send_buffers(interface_->size(),\n+MessageBuffer(maxBufferSize_)),\n+ 1093 recv_buffers(interface_->size(), MessageBuffer\n+(maxBufferSize_));\n+ 1094\n+ 1095\n+ 1096 setupRequests(handle, send_trackers, send_buffers, data_send_req,\n+ 1097 SetupSendRequest(), communicator_);\n+ 1098\n+ 1099 std::size_t no_size_to_recv, no_to_send, no_to_recv, old_size;\n+ 1100 no_size_to_recv = no_to_send = no_to_recv = old_size = interface_->size\n+();\n+ 1101\n+ 1102 // Skip empty interfaces.\n+ 1103 typedef typename std::vector::const_iterator Iter;\n+ 1104 for(Iter i=recv_trackers.begin(), end=recv_trackers.end(); i!=end; ++i)\n+ 1105 if(i->empty())\n+ 1106 --no_to_recv;\n+ 1107 for(Iter i=send_trackers.begin(), end=send_trackers.end(); i!=end; ++i)\n+ 1108 if(i->empty())\n+ 1109 --no_to_send;\n+ 1110\n+ 1111 while(no_size_to_recv+no_to_send+no_to_recv)\n+ 1112 {\n+ 1113 // Receive the fixedsize and setup receives accordingly\n+ 1114 if(no_size_to_recv)\n+ 1115 no_size_to_recv -= receiveSizeAndSetupReceive(handle,recv_trackers,\n+size_recv_req,\n+ 1116 data_recv_req, recv_buffers,\n+ 1117 communicator_);\n+ 1118\n+ 1119 // Check send completion and initiate other necessary sends\n+ 1120 if(no_to_send)\n+ 1121 no_to_send -= checkSendAndContinueSending(handle, send_trackers,\n+data_send_req,\n+ 1122 send_buffers, communicator_);\n+ 1123 if(validRecvRequests(data_recv_req))\n+ 1124 // Receive data and setup new unblocking receives if necessary\n+ 1125 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers,\n+data_recv_req,\n+ 1126 recv_buffers, communicator_);\n+ 1127 }\n+ 1128\n+ 1129 // Wait for completion of sending the size.\n+ 1130 //std::vector statuses(interface_->size(),\n+MPI_STATUSES_IGNORE);\n+ 1131 MPI_Waitall(size_send_req.size(), &(size_send_req[0]),\n+MPI_STATUSES_IGNORE);\n+ 1132\n+ 1133}\n+ 1134\n+ 1135template\n+ 1136template\n+ 1137void VariableSizeCommunicator::communicateSizes(DataHandle&\n+handle,\n+ 1138 std::vector& data_recv_trackers)\n+ 1139{\n+ 1140 std::vector send_trackers;\n+ 1141 std::vector recv_trackers;\n+ 1142 std::size_t size = interface_->size();\n+ 1143 std::vector send_requests(size, MPI_REQUEST_NULL);\n+ 1144 std::vector recv_requests(size, MPI_REQUEST_NULL);\n+ 1145 std::vector >\n+ 1146 send_buffers(size, MessageBuffer(maxBufferSize_)),\n+ 1147 recv_buffers(size, MessageBuffer(maxBufferSize_));\n+ 1148 SizeDataHandle size_handle(handle,data_recv_trackers);\n+ 1149 setupInterfaceTrackers(size_handle,send_trackers,\n+recv_trackers);\n+ 1150 setupRequests(size_handle, send_trackers, send_buffers, send_requests,\n+ 1151 SetupSendRequest >(), communicator_);\n+ 1152 setupRequests(size_handle, recv_trackers, recv_buffers, recv_requests,\n+ 1153 SetupRecvRequest >(), communicator_);\n+ 1154\n+ 1155 // Count valid requests that we have to wait for.\n+ 1156 auto valid_req_func =\n+ 1157 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL; };\n+ 1158\n+ 1159 auto size_to_send = std::count_if(send_requests.begin(),\n+send_requests.end(),\n+ 1160 valid_req_func);\n+ 1161 auto size_to_recv = std::count_if(recv_requests.begin(),\n+recv_requests.end(),\n+ 1162 valid_req_func);\n+ 1163\n+ 1164 while(size_to_send+size_to_recv)\n+ 1165 {\n+ 1166 if(size_to_send)\n+ 1167 size_to_send -=\n+ 1168 checkSendAndContinueSending(size_handle, send_trackers, send_requests,\n+ 1169 send_buffers, communicator_);\n+ 1170 if(size_to_recv)\n+ 1171 // Could have done this using checkSendAndContinueSending\n+ 1172 // But the call below is more efficient as UnpackSizeEntries\n+ 1173 // uses std::copy.\n+ 1174 size_to_recv -=\n+ 1175 checkAndContinue(size_handle, recv_trackers, recv_requests,\n+recv_requests,\n+ 1176 recv_buffers, communicator_, UnpackSizeEntries(),\n+ 1177 SetupRecvRequest >());\n+ 1178 }\n+ 1179}\n+ 1180\n+ 1181template\n+ 1182template\n+ 1183void VariableSizeCommunicator::communicateVariableSize\n+(DataHandle& handle)\n+ 1184{\n+ 1185\n+ 1186 std::vector send_trackers;\n+ 1187 std::vector recv_trackers;\n+ 1188 setupInterfaceTrackers(handle, send_trackers, recv_trackers);\n+ 1189\n+ 1190 std::vector send_requests(interface_->size(),\n+MPI_REQUEST_NULL);\n+ 1191 std::vector recv_requests(interface_->size(),\n+MPI_REQUEST_NULL);\n+ 1192 typedef typename DataHandle::DataType DataType;\n+ 1193 std::vector >\n+ 1194 send_buffers(interface_->size(), MessageBuffer\n+(maxBufferSize_)),\n+ 1195 recv_buffers(interface_->size(), MessageBuffer\n+(maxBufferSize_));\n+ 1196\n+ 1197 communicateSizes(handle, recv_trackers);\n+ 1198 // Setup requests for sending and receiving.\n+ 1199 setupRequests(handle, send_trackers, send_buffers, send_requests,\n+ 1200 SetupSendRequest(), communicator_);\n+ 1201 setupRequests(handle, recv_trackers, recv_buffers, recv_requests,\n+ 1202 SetupRecvRequest(), communicator_);\n+ 1203\n+ 1204 // Determine number of valid requests.\n+ 1205 auto valid_req_func =\n+ 1206 [](const MPI_Request& req) { return req != MPI_REQUEST_NULL;};\n+ 1207\n+ 1208 auto no_to_send = std::count_if(send_requests.begin(), send_requests.end\n+(),\n+ 1209 valid_req_func);\n+ 1210 auto no_to_recv = std::count_if(recv_requests.begin(), recv_requests.end\n+(),\n+ 1211 valid_req_func);\n+ 1212 while(no_to_send+no_to_recv)\n+ 1213 {\n+ 1214 // Check send completion and initiate other necessary sends\n+ 1215 if(no_to_send)\n+ 1216 no_to_send -= checkSendAndContinueSending(handle, send_trackers,\n+send_requests,\n+ 1217 send_buffers, communicator_);\n+ 1218 if(no_to_recv)\n+ 1219 // Receive data and setup new unblocking receives if necessary\n+ 1220 no_to_recv -= checkReceiveAndContinueReceiving(handle, recv_trackers,\n+recv_requests,\n+ 1221 recv_buffers, communicator_);\n+ 1222 }\n+ 1223}\n+ 1224\n+ 1225template\n+ 1226template\n+ 1227void VariableSizeCommunicator::communicate(DataHandle& handle)\n+ 1228{\n+ 1229 if( interface_->size() == 0)\n+ 1230 // Simply return as otherwise we will index an empty container\n+ 1231 // either for MPI_Wait_all or MPI_Test_some.\n+ 1232 return;\n+ 1233\n+ 1234 if(Impl::callFixedSize(handle))\n+ 1235 communicateFixedSize(handle);\n+ 1236 else\n+ 1237 communicateVariableSize(handle);\n+ 1238}\n+ 1239} // end namespace Dune\n+ 1240\n+ 1241#endif // HAVE_MPI\n+ 1242\n+ 1243#endif\n+fixedSize\n+std::size_t fixedSize\n+The number of data items per index if it is fixed, 0 otherwise.\n+Definition: variablesizecommunicator.hh:265\n+mpitraits.hh\n+Traits classes for mapping types onto MPI_Datatype.\n+concept.hh\n+Infrastructure for concepts.\n+Dune::Interface::communicator\n+MPI_Comm communicator() const\n+Get the MPI Communicator.\n+Definition: parallel/interface.hh:417\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::DenseVector<_ScalarVectorView<_K_>_>::size\n-size_type size() const\n-size method\n-Definition: densevector.hh:336\n-Dune::DenseVector<_ScalarVectorView<_K_>_>::size_type\n-Traits::size_type size_type\n-The type used for the index access and size operation.\n-Definition: densevector.hh:259\n-Dune::AutonomousValueType::type\n-T type\n-Definition: typetraits.hh:501\n+Dune::AlignedNumberImpl::min\n+auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n+&b)\n+Definition: debugalign.hh:447\n+Dune::MPITraits::getType\n+static MPI_Datatype getType()\n+Definition: mpitraits.hh:48\n+Dune::InterfaceInformation::size\n+size_t size() const\n+Get the number of entries in the interface.\n+Definition: parallel/interface.hh:108\n+Dune::Interface\n+Communication interface between remote and local indices.\n+Definition: parallel/interface.hh:209\n+Dune::Concept::HasFixedSize\n+Definition: variablesizecommunicator.hh:43\n+Dune::Concept::HasFixedSize::require\n+auto require(H &&h) -> decltype(h.fixedSize())\n+Dune::VariableSizeCommunicator\n+A buffered communicator where the amount of data sent does not have to be known\n+a priori.\n+Definition: variablesizecommunicator.hh:332\n+Dune::VariableSizeCommunicator::VariableSizeCommunicator\n+VariableSizeCommunicator(const Interface &inf, std::size_t max_buffer_size)\n+Creates a communicator with a specific maximum buffer size.\n+Definition: variablesizecommunicator.hh:404\n+Dune::VariableSizeCommunicator::backward\n+void backward(DataHandle &handle)\n+Communicate backwards.\n+Definition: variablesizecommunicator.hh:486\n+Dune::VariableSizeCommunicator::~VariableSizeCommunicator\n+~VariableSizeCommunicator()\n+Definition: variablesizecommunicator.hh:410\n+Dune::VariableSizeCommunicator::VariableSizeCommunicator\n+VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf, std::size_t\n+max_buffer_size)\n+Creates a communicator with a specific maximum buffer size.\n+Definition: variablesizecommunicator.hh:393\n+Dune::VariableSizeCommunicator::VariableSizeCommunicator\n+VariableSizeCommunicator(const VariableSizeCommunicator &other)\n+Copy-constructs a communicator.\n+Definition: variablesizecommunicator.hh:419\n+Dune::VariableSizeCommunicator::forward\n+void forward(DataHandle &handle)\n+Communicate forward.\n+Definition: variablesizecommunicator.hh:461\n+Dune::VariableSizeCommunicator::operator=\n+VariableSizeCommunicator & operator=(const VariableSizeCommunicator &other)\n+Copy-assignes a communicator.\n+Definition: variablesizecommunicator.hh:429\n+Dune::VariableSizeCommunicator::InterfaceMap\n+std::map< int, std::pair< InterfaceInformation, InterfaceInformation >, std::\n+less< int >, typename std::allocator_traits< Allocator >::template\n+rebind_alloc< std::pair< const int, std::pair< InterfaceInformation,\n+InterfaceInformation > > > > InterfaceMap\n+The type of the map from process number to InterfaceInformation for sending and\n+receiving to and from...\n+Definition: variablesizecommunicator.hh:340\n+Dune::VariableSizeCommunicator::VariableSizeCommunicator\n+VariableSizeCommunicator(MPI_Comm comm, const InterfaceMap &inf)\n+Creates a communicator with the default maximum buffer size.\n+Definition: variablesizecommunicator.hh:349\n+Dune::VariableSizeCommunicator::VariableSizeCommunicator\n+VariableSizeCommunicator(const Interface &inf)\n+Creates a communicator with the default maximum buffer size.\n+Definition: variablesizecommunicator.hh:358\n+interface.hh\n+Provides classes for building the communication interface between remote\n+indices.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00059.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00059.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: float_cmp.cc File Reference\n+dune-common: mpiguard.hh File Reference\n \n \n \n \n \n \n \n@@ -58,123 +58,52 @@\n \n \n \n \n \n
    \n \n-
    float_cmp.cc File Reference
    \n+Namespaces
    \n+
    mpiguard.hh File Reference
    \n \n
    \n-
    #include "float_cmp.hh"
    \n-#include <vector>
    \n-#include <limits>
    \n-#include <algorithm>
    \n-#include <cstdlib>
    \n-#include <dune/common/fvector.hh>
    \n-
    \n+\n+

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

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

    Go to the source code of this file.

    \n+
    \n \n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n \n-\n-\n-\n-\n-\n+\n+\n \n

    \n Classes

    struct  Dune::FloatCmp::EpsilonType< T >
     Mapping of value type to epsilon type. More...
     
    struct  Dune::FloatCmp::EpsilonType< std::vector< T, A > >
     Specialization of EpsilonType for std::vector. More...
     
    struct  Dune::FloatCmp::EpsilonType< FieldVector< T, n > >
     Specialization of EpsilonType for Dune::FieldVector. More...
    class  Dune::MPIGuardError
     This exception is thrown if the MPIGuard detects an error on a remote process. More...
     
    struct  Dune::FloatCmp::DefaultEpsilon< T, relativeWeak >
     
    struct  Dune::FloatCmp::DefaultEpsilon< T, relativeStrong >
     
    struct  Dune::FloatCmp::DefaultEpsilon< T, absolute >
    class  Dune::MPIGuard
     detects a thrown exception and communicates to all other processes More...
     
    \n \n \n \n \n-\n-\n-

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::FloatCmp
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n

    \n-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 More...
     
    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 More...
     
    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 More...
     
    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 More...
     
    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 More...
     
    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 More...
     
    template<class T >
    bool Dune::FloatCmp::eq (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::ne (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::gt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::lt (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::ge (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class T >
    bool Dune::FloatCmp::le (const T &first, const T &second, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class I , class T , CmpStyle cstyle, RoundingStyle rstyle>
    Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     round using epsilon More...
     
    template<class I , class T , CmpStyle cstyle>
    Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     
    template<class I , class T >
    Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    template<class I , class T , CmpStyle cstyle, RoundingStyle rstyle>
    Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     truncate using epsilon More...
     
    template<class I , class T , CmpStyle cstyle>
    Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, cstyle >::value())
     
    template<class I , class T >
    Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())
     
    \n-
    \n+

    Detailed Description

    \n+

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

    \n+
    Author
    Christian Engwer
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,127 +4,37 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces | Functions\n-float_cmp.cc File Reference\n-#include \"float_cmp.hh\"\n-#include \n-#include \n-#include \n-#include \n-#include \n+ * parallel\n+Classes | Namespaces\n+mpiguard.hh File Reference\n+Common \u00bb Parallel_Communication\n+Implements a MPIGuard which detects an error on a remote process. More...\n+#include \"mpihelper.hh\"\n+#include \"communication.hh\"\n+#include \"mpicommunication.hh\"\n+#include \n+Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::FloatCmp::EpsilonType<_T_>\n-\u00a0 Mapping of value type to epsilon type. More...\n-\u00a0\n-struct \u00a0Dune::FloatCmp::EpsilonType<_std::vector<_T,_A_>_>\n-\u00a0 Specialization of EpsilonType for std::vector. More...\n-\u00a0\n-struct \u00a0Dune::FloatCmp::EpsilonType<_FieldVector<_T,_n_>_>\n-\u00a0 Specialization of EpsilonType for Dune::FieldVector. More...\n-\u00a0\n-struct \u00a0Dune::FloatCmp::DefaultEpsilon<_T,_relativeWeak_>\n-\u00a0\n-struct \u00a0Dune::FloatCmp::DefaultEpsilon<_T,_relativeStrong_>\n-\u00a0\n-struct \u00a0Dune::FloatCmp::DefaultEpsilon<_T,_absolute_>\n+class \u00a0Dune::MPIGuardError\n+\u00a0 This exception is thrown if the MPIGuard detects an error on a remote\n+ process. More...\n+\u00a0\n+class \u00a0Dune::MPIGuard\n+\u00a0 detects a thrown exception and communicates to all other processes\n+ More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::FloatCmp\n-\u00a0\n- Functions\n-template\n-bool\u00a0Dune::FloatCmp::eq (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())\n-\u00a0 test for equality using epsilon More...\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::ne (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())\n-\u00a0 test for inequality using epsilon More...\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::gt (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())\n-\u00a0 test if first greater than second More...\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::lt (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())\n-\u00a0 test if first lesser than second More...\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::ge (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())\n-\u00a0 test if first greater or equal second More...\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::le (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, style >::value())\n-\u00a0 test if first lesser or equal second More...\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::eq (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::\n- value())\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::ne (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::\n- value())\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::gt (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::\n- value())\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::lt (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::\n- value())\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::ge (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::\n- value())\n-\u00a0\n-template\n-bool\u00a0Dune::FloatCmp::le (const T &first, const T &second, typename\n- EpsilonType< T >::Type epsilon=DefaultEpsilon< T, defaultCmpStyle >::\n- value())\n-\u00a0\n-template\n- I\u00a0Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type\n- epsilon=DefaultEpsilon< T, cstyle >::value())\n-\u00a0 round using epsilon More...\n-\u00a0\n-template\n- I\u00a0Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type\n- epsilon=DefaultEpsilon< T, cstyle >::value())\n-\u00a0\n-template\n- I\u00a0Dune::FloatCmp::round (const T &val, typename EpsilonType< T >::Type\n- epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())\n-\u00a0\n-template\n- I\u00a0Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type\n- epsilon=DefaultEpsilon< T, cstyle >::value())\n-\u00a0 truncate using epsilon More...\n-\u00a0\n-template\n- I\u00a0Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type\n- epsilon=DefaultEpsilon< T, cstyle >::value())\n-\u00a0\n-template\n- I\u00a0Dune::FloatCmp::trunc (const T &val, typename EpsilonType< T >::Type\n- epsilon=DefaultEpsilon< T, defaultCmpStyle >::value())\n-\u00a0\n+***** Detailed Description *****\n+Implements a MPIGuard which detects an error on a remote process.\n+ Author\n+ Christian Engwer\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00062.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00062.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: arraylist.hh File Reference\n+dune-common: selection.hh File Reference\n \n \n \n \n \n \n \n@@ -58,56 +58,53 @@\n \n \n \n \n \n
    \n \n-
    arraylist.hh File Reference
    \n+ \n
    \n
    \n \n-

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

    Provides classes for selecting indices based on attribute flags. \n More...

    \n-
    #include <array>
    \n-#include <cassert>
    \n-#include <memory>
    \n-#include <vector>
    \n-#include "iteratorfacades.hh"
    \n+
    #include "indexset.hh"
    \n+#include <dune/common/iteratorfacades.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n-\n+\n+\n \n-\n-\n+\n+\n \n-\n-\n+\n+\n \n

    \n Classes

    class  Dune::ArrayList< T, N, A >
     A dynamically growing random access list. More...
    class  Dune::SelectionIterator< TS, TG, TL, N >
     A const iterator over an uncached selection. More...
     
    class  Dune::ArrayListIterator< T, N, A >
     A random access iterator for the Dune::ArrayList class. More...
    class  Dune::UncachedSelection< TS, TG, TL, N >
     An uncached selection of indices. More...
     
    class  Dune::ConstArrayListIterator< T, N, A >
     A constant random access iterator for the Dune::ArrayList class. More...
    class  Dune::Selection< TS, TG, TL, N >
     A cached selection of indices. More...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n

    Detailed Description

    \n-

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

    \n-

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

    Author
    Markus Blatt
    \n+

    Provides classes for selecting indices based on attribute flags.

    \n+
    Author
    Markus Blatt
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,43 +4,36 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n+ * parallel\n Classes | Namespaces\n-arraylist.hh File Reference\n-Implements a random-access container that can efficiently change size (similar\n-to std::deque) More...\n-#include \n-#include \n-#include \n-#include \n-#include \"iteratorfacades.hh\"\n+selection.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+Provides classes for selecting indices based on attribute flags. More...\n+#include \"indexset.hh\"\n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::ArrayList<_T,_N,_A_>\n-\u00a0 A dynamically growing random access list. More...\n+class \u00a0Dune::SelectionIterator<_TS,_TG,_TL,_N_>\n+\u00a0 A const iterator over an uncached selection. More...\n \u00a0\n-class \u00a0Dune::ArrayListIterator<_T,_N,_A_>\n-\u00a0 A random access iterator for the Dune::ArrayList class. More...\n+class \u00a0Dune::UncachedSelection<_TS,_TG,_TL,_N_>\n+\u00a0 An uncached selection of indices. More...\n \u00a0\n-class \u00a0Dune::ConstArrayListIterator<_T,_N,_A_>\n-\u00a0 A constant random access iterator for the Dune::ArrayList class.\n- More...\n+class \u00a0Dune::Selection<_TS,_TG,_TL,_N_>\n+\u00a0 A cached selection of indices. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n ***** Detailed Description *****\n-Implements a random-access container that can efficiently change size (similar\n-to std::deque)\n-This file implements the class ArrayList which behaves like dynamically growing\n-array together with the class ArrayListIterator which is random access iterator\n-as needed by the stl for sorting and other algorithms.\n+Provides classes for selecting indices based on attribute flags.\n Author\n Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00062_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: arraylist.hh Source File\n+dune-common: selection.hh Source File\n \n \n \n \n \n \n \n@@ -58,523 +58,282 @@\n \n
    \n \n \n
    \n
    \n-
    arraylist.hh
    \n+
    selection.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5
    \n-
    6#ifndef DUNE_COMMON_ARRAYLIST_HH
    \n-
    7#define DUNE_COMMON_ARRAYLIST_HH
    \n-
    8
    \n-
    9#include <array>
    \n-
    10#include <cassert>
    \n-
    11#include <memory>
    \n-
    12#include <vector>
    \n-
    13#include "iteratorfacades.hh"
    \n-
    14
    \n-
    15namespace Dune
    \n-
    16{
    \n-
    17 // forward declaration
    \n-
    18 template<class T, int N, class A>
    \n-
    19 class ArrayListIterator;
    \n-
    20
    \n-
    21 template<class T, int N, class A>
    \n-
    22 class ConstArrayListIterator;
    \n-
    23
    \n-
    60 template<class T, int N=100, class A=std::allocator<T> >
    \n-\n-
    62 {
    \n-
    63 public:
    \n-
    69 typedef T MemberType;
    \n+
    5#ifndef DUNE_SELECTION_HH
    \n+
    6#define DUNE_SELECTION_HH
    \n+
    7
    \n+
    8#include "indexset.hh"
    \n+\n+
    10
    \n+
    11namespace Dune
    \n+
    12{
    \n+
    27 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    29 {
    \n+
    30 public:
    \n+
    39 typedef TS AttributeSet;
    \n+
    40
    \n+\n+
    45
    \n+
    46 //typedef typename ParallelIndexSet::const_iterator ParallelIndexSetIterator;
    \n+
    47
    \n+
    48 typedef ConstArrayListIterator<IndexPair<TG,TL>, N, std::allocator<Dune::IndexPair<TG,TL> > > ParallelIndexSetIterator;
    \n+\n+
    55 : iter_(iter), end_(end)
    \n+
    56 {
    \n+
    57 // Step to the first valid entry
    \n+
    58 while(iter_!=end_ && !AttributeSet::contains(iter_->local().attribute()))
    \n+
    59 ++iter_;
    \n+
    60 }
    \n+
    61
    \n+\n+
    63 {
    \n+
    64 assert(iter_!=end_);
    \n+
    65 for(++iter_; iter_!=end_; ++iter_)
    \n+
    66 if(AttributeSet::contains(iter_->local().attribute()))
    \n+
    67 break;
    \n+
    68 }
    \n+
    69
    \n
    70
    \n-
    74 typedef T value_type;
    \n+
    71 uint32_t operator*() const
    \n+
    72 {
    \n+
    73 return iter_->local().local();
    \n+
    74 }
    \n
    75
    \n-
    79 typedef T& reference;
    \n+\n+
    77 {
    \n+
    78 return iter_ == other.iter_;
    \n+
    79 }
    \n
    80
    \n-
    84 typedef const T& const_reference;
    \n+\n+
    82 {
    \n+
    83 return iter_ != other.iter_;
    \n+
    84 }
    \n
    85
    \n-
    89 typedef T* pointer;
    \n+
    86 private:
    \n+\n+
    88 const ParallelIndexSetIterator end_;
    \n+
    89 };
    \n
    90
    \n-
    94 typedef const T* const_pointer;
    \n-
    95
    \n-
    100 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    \n-
    101
    \n-\n-
    106
    \n-\n-
    111
    \n-
    115 typedef std::size_t size_type;
    \n-
    116
    \n-
    120 typedef std::ptrdiff_t difference_type;
    \n+
    91
    \n+
    95 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    97 {
    \n+
    98 public:
    \n+
    107 typedef TS AttributeSet;
    \n+
    108
    \n+
    112 typedef TG GlobalIndex;
    \n+
    113
    \n+
    120 typedef TL LocalIndex;
    \n
    121
    \n-\n-
    127
    \n-\n-
    134
    \n-\n+\n+
    126
    \n+\n+
    131
    \n+\n+
    136
    \n+\n+
    138 : indexSet_()
    \n+
    139 {}
    \n
    140
    \n-\n-
    146
    \n-
    151 inline void push_back(const_reference entry);
    \n-
    152
    \n-\n-
    159
    \n-\n+\n+
    142 : indexSet_(&indexset)
    \n+
    143 {}
    \n+
    148 void setIndexSet(const ParallelIndexSet& indexset);
    \n+
    149
    \n+
    153 //const ParallelIndexSet& indexSet() const;
    \n+
    154
    \n+
    159 const_iterator begin() const;
    \n+
    160
    \n+
    165 const_iterator end() const;
    \n
    166
    \n-
    171 inline size_type size() const;
    \n+
    167
    \n+
    168 private:
    \n+
    169 const ParallelIndexSet* indexSet_;
    \n+
    170
    \n+
    171 };
    \n
    172
    \n-
    180 inline void purge();
    \n-
    181
    \n-
    185 inline void clear();
    \n-\n-
    190
    \n-
    191 private:
    \n-
    192
    \n-
    196 using SmartPointerAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::shared_ptr< std::array<MemberType,chunkSize_> > >;
    \n-
    197
    \n-
    201 using ArrayAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::array<MemberType,chunkSize_> >;
    \n+
    176 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    178 {
    \n+
    179 public:
    \n+
    188 typedef TS AttributeSet;
    \n+
    189
    \n+
    193 typedef TG GlobalIndex;
    \n+
    194
    \n+
    201 typedef TL LocalIndex;
    \n
    202
    \n-
    206 friend class ArrayListIterator<T,N,A>;
    \n-
    207 friend class ConstArrayListIterator<T,N,A>;
    \n-
    208
    \n-
    210 std::vector<std::shared_ptr<std::array<MemberType,chunkSize_> >,
    \n-
    211 SmartPointerAllocator> chunks_;
    \n-
    220 size_type capacity_;
    \n-
    222 size_type size_;
    \n-
    224 size_type start_;
    \n-
    233 inline reference elementAt(size_type i);
    \n-
    234
    \n-
    243 inline const_reference elementAt(size_type i) const;
    \n-
    244 };
    \n+\n+
    207
    \n+
    211 typedef uint32_t* iterator;
    \n+
    212
    \n+
    216 typedef uint32_t* const_iterator;
    \n+
    217
    \n+\n+
    219 : selected_()
    \n+
    220 {}
    \n+
    221
    \n+\n+
    223 : selected_(), size_(0), built_(false)
    \n+
    224 {
    \n+
    225 setIndexSet(indexset);
    \n+
    226 }
    \n+
    227
    \n+
    228 ~Selection();
    \n+
    229
    \n+
    234 void setIndexSet(const ParallelIndexSet& indexset);
    \n+
    235
    \n+
    239 void free();
    \n+
    240
    \n+
    244 //IndexSet indexSet() const;
    \n
    245
    \n-
    246
    \n-
    250 template<class T, int N, class A>
    \n-
    251 class ArrayListIterator : public RandomAccessIteratorFacade<ArrayListIterator<T,N,A>,
    \n-
    252 typename A::value_type,
    \n-
    253 typename A::value_type &,
    \n-
    254 typename A::difference_type>
    \n-
    255 {
    \n-
    256
    \n-
    257 friend class ArrayList<T,N,A>;
    \n-
    258 friend class ConstArrayListIterator<T,N,A>;
    \n-
    259 public:
    \n-
    263 typedef typename A::value_type MemberType;
    \n-
    264
    \n-
    265 typedef typename A::difference_type difference_type;
    \n-
    266
    \n-
    267 typedef typename A::size_type size_type;
    \n-
    268
    \n-
    269 using reference = typename A::value_type &;
    \n-
    270
    \n-
    271 using const_reference = typename A::value_type const&;
    \n-
    272
    \n-
    278 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    \n-
    279
    \n+
    250 const_iterator begin() const;
    \n+
    251
    \n+
    256 const_iterator end() const;
    \n+
    257
    \n+
    258
    \n+
    259 private:
    \n+
    260 uint32_t* selected_;
    \n+
    261 size_t size_;
    \n+
    262 bool built_;
    \n+
    263
    \n+
    264 };
    \n+
    265
    \n+
    266 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    268 {
    \n+
    269 if(built_)
    \n+
    270 free();
    \n+
    271
    \n+
    272 // Count the number of entries the selection has to hold
    \n+\n+
    274 const const_iterator end = indexset.end();
    \n+
    275 int entries = 0;
    \n+
    276
    \n+
    277 for(const_iterator index = indexset.begin(); index != end; ++index)
    \n+
    278 if(AttributeSet::contains(index->local().attribute()))
    \n+
    279 ++entries;
    \n
    280
    \n-
    286 inline bool equals(const ArrayListIterator<MemberType,N,A>& other) const;
    \n-
    287
    \n-
    293 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    \n-
    294
    \n-
    298 inline void increment();
    \n-
    299
    \n-
    303 inline void decrement();
    \n+
    281 selected_ = new uint32_t[entries];
    \n+
    282 built_ = true;
    \n+
    283
    \n+
    284 entries = 0;
    \n+
    285 for(const_iterator index = indexset.begin(); index != end; ++index)
    \n+
    286 if(AttributeSet::contains(index->local().attribute()))
    \n+
    287 selected_[entries++]= index->local().local();
    \n+
    288
    \n+
    289 size_=entries;
    \n+
    290 built_=true;
    \n+
    291 }
    \n+
    292
    \n+
    293 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    295 {
    \n+
    296 return selected_;
    \n+
    297 }
    \n+
    298
    \n+
    299 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    301 {
    \n+
    302 return selected_+size_;
    \n+
    303 }
    \n
    304
    \n-
    309 inline reference elementAt(size_type i) const;
    \n-
    310
    \n-
    315 inline reference dereference() const;
    \n-
    316
    \n-
    328 inline void eraseToHere();
    \n-
    329
    \n-
    331 inline size_type position(){return position_;}
    \n-
    332
    \n-
    334 inline void advance(difference_type n);
    \n-
    335
    \n-
    337 inline difference_type distanceTo(const ArrayListIterator<T,N,A>& other) const;
    \n+
    305 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    307 {
    \n+
    308 delete[] selected_;
    \n+
    309 size_=0;
    \n+
    310 built_=false;
    \n+
    311 }
    \n+
    312
    \n+
    313 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    315 {
    \n+
    316 if(built_)
    \n+
    317 free();
    \n+
    318 }
    \n+
    319
    \n+
    320 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    322 {
    \n+
    323 return SelectionIterator<TS,TG,TL,N>(indexSet_->begin(),
    \n+
    324 indexSet_->end());
    \n+
    325 }
    \n+
    326
    \n+
    327 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    329 {
    \n+
    330 return SelectionIterator<TS,TG,TL,N>(indexSet_->end(),
    \n+
    331 indexSet_->end());
    \n+
    332 }
    \n+
    333 template<typename TS, typename TG, typename TL, int N>
    \n+\n+
    335 {
    \n+
    336 indexSet_ = &indexset;
    \n+
    337 }
    \n
    338
    \n-
    340 inline ArrayListIterator() : position_(0), list_(nullptr)
    \n-
    341 {}
    \n-
    342
    \n-
    343 private:
    \n-\n-
    350
    \n-
    354 size_type position_;
    \n-\n-
    359 };
    \n-
    360
    \n-
    364 template<class T, int N, class A>
    \n-\n-
    366 : public RandomAccessIteratorFacade<ConstArrayListIterator<T,N,A>,
    \n-
    367 const typename A::value_type,
    \n-
    368 typename A::value_type const&,
    \n-
    369 typename A::difference_type>
    \n-
    370 {
    \n-
    371
    \n-
    372 friend class ArrayList<T,N,A>;
    \n-
    373 friend class ArrayListIterator<T,N,A>;
    \n-
    374
    \n-
    375 public:
    \n-
    379 typedef typename A::value_type MemberType;
    \n-
    380
    \n-
    381 typedef typename A::difference_type difference_type;
    \n-
    382
    \n-
    383 typedef typename A::size_type size_type;
    \n-
    384
    \n-
    385 using reference = typename A::value_type &;
    \n-
    386
    \n-
    387 using const_reference = typename A::value_type const&;
    \n-
    388
    \n-
    394 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    \n-
    395
    \n-
    401 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    \n-
    402
    \n-
    406 inline void increment();
    \n-
    407
    \n-
    411 inline void decrement();
    \n-
    412
    \n-
    414 inline void advance(difference_type n);
    \n-
    415
    \n-\n-
    418
    \n-\n-
    424
    \n-\n-
    430
    \n-
    431 inline ConstArrayListIterator() : position_(0), list_(nullptr)
    \n-
    432 {}
    \n-
    433
    \n-\n-
    435
    \n-
    436 private:
    \n-
    437
    \n-
    443 inline ConstArrayListIterator(const ArrayList<T,N,A>& arrayList, size_type position);
    \n-
    444
    \n-
    448 size_type position_;
    \n-
    452 const ArrayList<T,N,A>* list_;
    \n-
    453 };
    \n-
    454
    \n-
    455
    \n-
    456 template<class T, int N, class A>
    \n-\n-
    458 : capacity_(0), size_(0), start_(0)
    \n-
    459 {
    \n-
    460 chunks_.reserve(100);
    \n-
    461 }
    \n-
    462
    \n-
    463 template<class T, int N, class A>
    \n-\n-
    465 capacity_=0;
    \n-
    466 size_=0;
    \n-
    467 start_=0;
    \n-
    468 chunks_.clear();
    \n-
    469 }
    \n-
    470
    \n-
    471 template<class T, int N, class A>
    \n-\n-
    473 {
    \n-
    474 return size_;
    \n-
    475 }
    \n-
    476
    \n-
    477 template<class T, int N, class A>
    \n-\n-
    479 {
    \n-
    480 size_t index=start_+size_;
    \n-
    481 if(index==capacity_)
    \n-
    482 {
    \n-
    483 chunks_.push_back(std::make_shared<std::array<MemberType,chunkSize_> >());
    \n-
    484 capacity_ += chunkSize_;
    \n-
    485 }
    \n-
    486 elementAt(index)=entry;
    \n-
    487 ++size_;
    \n-
    488 }
    \n-
    489
    \n-
    490 template<class T, int N, class A>
    \n-\n-
    492 {
    \n-
    493 return elementAt(start_+i);
    \n-
    494 }
    \n-
    495
    \n-
    496
    \n-
    497 template<class T, int N, class A>
    \n-\n-
    499 {
    \n-
    500 return elementAt(start_+i);
    \n-
    501 }
    \n-
    502
    \n-
    503 template<class T, int N, class A>
    \n-\n-
    505 {
    \n-
    506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    \n-
    507 }
    \n-
    508
    \n-
    509
    \n-
    510 template<class T, int N, class A>
    \n-
    511 typename ArrayList<T,N,A>::const_reference ArrayList<T,N,A>::elementAt(size_type i) const
    \n-
    512 {
    \n-
    513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    \n-
    514 }
    \n-
    515
    \n-
    516 template<class T, int N, class A>
    \n-\n-
    518 {
    \n-
    519 return ArrayListIterator<T,N,A>(*this, start_);
    \n-
    520 }
    \n-
    521
    \n-
    522 template<class T, int N, class A>
    \n-\n-
    524 {
    \n-
    525 return ConstArrayListIterator<T,N,A>(*this, start_);
    \n-
    526 }
    \n-
    527
    \n-
    528 template<class T, int N, class A>
    \n-\n-
    530 {
    \n-
    531 return ArrayListIterator<T,N,A>(*this, start_+size_);
    \n-
    532 }
    \n-
    533
    \n-
    534 template<class T, int N, class A>
    \n-\n-
    536 {
    \n-
    537 return ConstArrayListIterator<T,N,A>(*this, start_+size_);
    \n-
    538 }
    \n-
    539
    \n-
    540 template<class T, int N, class A>
    \n-\n-
    542 {
    \n-
    543 // Distance to copy to the left.
    \n-
    544 size_t distance = start_/chunkSize_;
    \n-
    545 if(distance>0) {
    \n-
    546 // Number of chunks with entries in it;
    \n-
    547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ );
    \n-
    548
    \n-
    549 // Copy chunks to the left.
    \n-
    550 std::copy(chunks_.begin()+distance,
    \n-
    551 chunks_.begin()+(distance+chunks), chunks_.begin());
    \n-
    552
    \n-
    553 // Calculate new parameters
    \n-
    554 start_ = start_ % chunkSize_;
    \n-
    555 //capacity += distance * chunkSize_;
    \n-
    556 }
    \n-
    557 }
    \n-
    558
    \n-
    559 template<class T, int N, class A>
    \n-\n-
    561 {
    \n-
    562 position_+=i;
    \n-
    563 }
    \n-
    564
    \n-
    565 template<class T, int N, class A>
    \n-\n-
    567 {
    \n-
    568 position_+=i;
    \n-
    569 }
    \n-
    570
    \n-
    571
    \n-
    572 template<class T, int N, class A>
    \n-\n-
    574 {
    \n-
    575 // Makes only sense if we reference a common list
    \n-
    576 assert(list_==(other.list_));
    \n-
    577 return position_==other.position_ ;
    \n-
    578 }
    \n-
    579
    \n-
    580
    \n-
    581 template<class T, int N, class A>
    \n-\n-
    583 {
    \n-
    584 // Makes only sense if we reference a common list
    \n-
    585 assert(list_==(other.list_));
    \n-
    586 return position_==other.position_ ;
    \n-
    587 }
    \n-
    588
    \n-
    589
    \n-
    590 template<class T, int N, class A>
    \n-\n-
    592 {
    \n-
    593 // Makes only sense if we reference a common list
    \n-
    594 assert(list_==(other.list_));
    \n-
    595 return position_==other.position_ ;
    \n-
    596 }
    \n-
    597
    \n-
    598 template<class T, int N, class A>
    \n-\n-
    600 {
    \n-
    601 ++position_;
    \n-
    602 }
    \n-
    603
    \n-
    604 template<class T, int N, class A>
    \n-\n-
    606 {
    \n-
    607 ++position_;
    \n-
    608 }
    \n-
    609
    \n-
    610 template<class T, int N, class A>
    \n-\n-
    612 {
    \n-
    613 --position_;
    \n-
    614 }
    \n-
    615
    \n-
    616 template<class T, int N, class A>
    \n-\n-
    618 {
    \n-
    619 --position_;
    \n-
    620 }
    \n-
    621
    \n-
    622 template<class T, int N, class A>
    \n-\n-
    624 {
    \n-
    625 return list_->elementAt(i+position_);
    \n-
    626 }
    \n-
    627
    \n-
    628 template<class T, int N, class A>
    \n-\n-
    630 {
    \n-
    631 return list_->elementAt(i+position_);
    \n-
    632 }
    \n-
    633
    \n-
    634 template<class T, int N, class A>
    \n-\n-
    636 {
    \n-
    637 return list_->elementAt(position_);
    \n-
    638 }
    \n-
    639
    \n-
    640 template<class T, int N, class A>
    \n-\n-
    642 {
    \n-
    643 return list_->elementAt(position_);
    \n-
    644 }
    \n-
    645
    \n-
    646 template<class T, int N, class A>
    \n-\n-
    648 {
    \n-
    649 // Makes only sense if we reference a common list
    \n-
    650 assert(list_==(other.list_));
    \n-
    651 return other.position_ - position_;
    \n-
    652 }
    \n-
    653
    \n-
    654 template<class T, int N, class A>
    \n-\n-
    656 {
    \n-
    657 // Makes only sense if we reference a common list
    \n-
    658 assert(list_==(other.list_));
    \n-
    659 return other.position_ - position_;
    \n-
    660 }
    \n-
    661
    \n-
    662 template<class T, int N, class A>
    \n-\n-
    664 {
    \n-
    665 list_->size_ -= ++position_ - list_->start_;
    \n-
    666 // chunk number of the new position.
    \n-
    667 size_t posChunkStart = position_ / chunkSize_;
    \n-
    668 // number of chunks to deallocate
    \n-
    669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_)
    \n-
    670 / chunkSize_;
    \n-
    671 list_->start_ = position_;
    \n-
    672
    \n-
    673 // Deallocate memory not needed any more.
    \n-
    674 for(size_t chunk=0; chunk<chunks; chunk++) {
    \n-
    675 --posChunkStart;
    \n-
    676 list_->chunks_[posChunkStart].reset();
    \n-
    677 }
    \n-
    678
    \n-
    679 // Capacity stays the same as the chunks before us
    \n-
    680 // are still there. They null pointers.
    \n-
    681 assert(list_->start_+list_->size_<=list_->capacity_);
    \n-
    682 }
    \n-
    683
    \n-
    684 template<class T, int N, class A>
    \n-\n-
    686 : position_(position), list_(&arrayList)
    \n-
    687 {}
    \n-
    688
    \n-
    689
    \n-
    690 template<class T, int N, class A>
    \n-
    691 ConstArrayListIterator<T,N,A>::ConstArrayListIterator(const ArrayList<T,N,A>& arrayList,
    \n-
    692 size_type position)
    \n-
    693 : position_(position), list_(&arrayList)
    \n-
    694 {}
    \n-
    695
    \n-
    696 template<class T, int N, class A>
    \n-\n-
    698 : position_(other.position_), list_(other.list_)
    \n-
    699 {}
    \n-
    700
    \n-
    701
    \n-
    703}
    \n-
    704#endif
    \n-
    This file implements iterator facade classes for writing stl conformant iterators.
    \n-
    reference operator[](size_type i)
    Get the element at specific position.
    Definition: arraylist.hh:491
    \n-
    iterator begin()
    Get an iterator that is positioned at the first element.
    Definition: arraylist.hh:517
    \n-
    bool equals(const ArrayListIterator< MemberType, N, A > &other) const
    Comares two iterators.
    Definition: arraylist.hh:573
    \n-
    void increment()
    Increment the iterator.
    Definition: arraylist.hh:599
    \n-
    size_type size() const
    Get the number of elements in the list.
    Definition: arraylist.hh:472
    \n-
    ConstArrayListIterator(const ArrayListIterator< T, N, A > &other)
    Definition: arraylist.hh:697
    \n-
    void purge()
    Purge the list.
    Definition: arraylist.hh:541
    \n-
    void decrement()
    decrement the iterator.
    Definition: arraylist.hh:611
    \n-
    void eraseToHere()
    Erase all entries before the current position and the one at the current position.
    Definition: arraylist.hh:663
    \n-
    ArrayList()
    Constructs an Array list with one chunk.
    Definition: arraylist.hh:457
    \n-
    const_iterator begin() const
    Get a random access iterator that is positioned at the first element.
    Definition: arraylist.hh:523
    \n-
    void increment()
    Increment the iterator.
    Definition: arraylist.hh:605
    \n-
    iterator end()
    Get a random access iterator positioned after the last element.
    Definition: arraylist.hh:529
    \n-
    const_reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition: arraylist.hh:629
    \n-
    const_reference operator[](size_type i) const
    Get the element at specific position.
    Definition: arraylist.hh:498
    \n-
    void decrement()
    decrement the iterator.
    Definition: arraylist.hh:617
    \n-
    void advance(difference_type n)
    Definition: arraylist.hh:566
    \n-
    const_iterator end() const
    Get a random access iterator positioned after the last element.
    Definition: arraylist.hh:535
    \n-
    const_reference dereference() const
    Access the element at the current position.
    Definition: arraylist.hh:641
    \n-
    void clear()
    Delete all entries from the list.
    Definition: arraylist.hh:464
    \n-
    reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition: arraylist.hh:623
    \n-
    bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const
    Comares to iterators.
    Definition: arraylist.hh:591
    \n-
    void advance(difference_type n)
    Definition: arraylist.hh:560
    \n-
    difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other) const
    Definition: arraylist.hh:655
    \n-
    reference dereference() const
    Access the element at the current position.
    Definition: arraylist.hh:635
    \n-
    void push_back(const_reference entry)
    Append an entry to the list.
    Definition: arraylist.hh:478
    \n-
    difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const
    Definition: arraylist.hh:647
    \n+
    342}
    \n+
    343#endif
    \n+
    This file implements iterator facade classes for writing stl conformant iterators.
    \n+
    Provides a map between global and local indices.
    \n+
    const_iterator end() const
    Get an iterator over the selected indices.
    Definition: selection.hh:328
    \n+
    void setIndexSet(const ParallelIndexSet &indexset)
    Set the index set of the selection.
    Definition: selection.hh:267
    \n+
    void setIndexSet(const ParallelIndexSet &indexset)
    Set the index set of the selection.
    Definition: selection.hh:334
    \n+
    iterator begin()
    Get an iterator over the indices positioned at the first index.
    \n+
    iterator end()
    Get an iterator over the indices positioned after the last index.
    \n+
    const_iterator end() const
    Get an iterator over the selected indices.
    Definition: selection.hh:300
    \n+
    const_iterator begin() const
    Get the index set we are a selection for.
    Definition: selection.hh:294
    \n+
    void free()
    Free allocated memory.
    Definition: selection.hh:306
    \n+
    const_iterator begin() const
    Get the index set we are a selection for.
    Definition: selection.hh:321
    \n+
    ~Selection()
    Definition: selection.hh:314
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    A random access iterator for the Dune::ArrayList class.
    Definition: arraylist.hh:255
    \n-
    size_type position()
    Definition: arraylist.hh:331
    \n-
    A::value_type MemberType
    The member type.
    Definition: arraylist.hh:263
    \n-
    ArrayListIterator()
    Standard constructor.
    Definition: arraylist.hh:340
    \n-
    A::difference_type difference_type
    Definition: arraylist.hh:265
    \n-
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition: arraylist.hh:278
    \n-
    A::size_type size_type
    Definition: arraylist.hh:267
    \n-
    typename A::value_type const & const_reference
    Definition: arraylist.hh:271
    \n-
    typename A::value_type & reference
    Definition: arraylist.hh:269
    \n
    A constant random access iterator for the Dune::ArrayList class.
    Definition: arraylist.hh:370
    \n-
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition: arraylist.hh:394
    \n-
    typename A::value_type & reference
    Definition: arraylist.hh:385
    \n-
    ConstArrayListIterator()
    Definition: arraylist.hh:431
    \n-
    A::value_type MemberType
    The member type.
    Definition: arraylist.hh:379
    \n-
    A::difference_type difference_type
    Definition: arraylist.hh:381
    \n-
    typename A::value_type const & const_reference
    Definition: arraylist.hh:387
    \n-
    A::size_type size_type
    Definition: arraylist.hh:383
    \n-
    A dynamically growing random access list.
    Definition: arraylist.hh:62
    \n-
    T value_type
    Value type for stl compliance.
    Definition: arraylist.hh:74
    \n-
    static constexpr int chunkSize_
    The number of elements in one chunk of the list. This has to be at least one. The default is 100.
    Definition: arraylist.hh:100
    \n-
    const T * const_pointer
    The type of a const pointer to the type we store.
    Definition: arraylist.hh:94
    \n-
    ArrayListIterator< MemberType, N, A > iterator
    A random access iterator.
    Definition: arraylist.hh:105
    \n-
    const T & const_reference
    The type of a const reference to the type we store.
    Definition: arraylist.hh:84
    \n-
    T & reference
    The type of a reference to the type we store.
    Definition: arraylist.hh:79
    \n-
    std::size_t size_type
    The size type.
    Definition: arraylist.hh:115
    \n-
    T MemberType
    The member type that is stored.
    Definition: arraylist.hh:69
    \n-
    T * pointer
    The type of a pointer to the type we store.
    Definition: arraylist.hh:89
    \n-
    ConstArrayListIterator< MemberType, N, A > const_iterator
    A constant random access iterator.
    Definition: arraylist.hh:110
    \n-
    std::ptrdiff_t difference_type
    The difference type.
    Definition: arraylist.hh:120
    \n-
    Base class for stl conformant forward iterators.
    Definition: iteratorfacades.hh:434
    \n+\n+
    A const iterator over an uncached selection.
    Definition: selection.hh:29
    \n+
    ConstArrayListIterator< IndexPair< TG, TL >, N, std::allocator< Dune::IndexPair< TG, TL > > > ParallelIndexSetIterator
    Definition: selection.hh:48
    \n+
    void operator++()
    Definition: selection.hh:62
    \n+
    uint32_t operator*() const
    Definition: selection.hh:71
    \n+
    TS AttributeSet
    The type of the Set of attributes.
    Definition: selection.hh:39
    \n+
    Dune::ParallelIndexSet< TG, TL, N > ParallelIndexSet
    The type of the underlying index set.
    Definition: selection.hh:44
    \n+
    SelectionIterator(const ParallelIndexSetIterator &iter, const ParallelIndexSetIterator &end)
    Constructor.
    Definition: selection.hh:54
    \n+
    bool operator!=(const SelectionIterator< TS, TG, TL, N > &other) const
    Definition: selection.hh:81
    \n+
    bool operator==(const SelectionIterator< TS, TG, TL, N > &other) const
    Definition: selection.hh:76
    \n+
    An uncached selection of indices.
    Definition: selection.hh:97
    \n+
    UncachedSelection()
    Definition: selection.hh:137
    \n+
    SelectionIterator< TS, TG, TL, N > iterator
    The type of the iterator of the selected indices.
    Definition: selection.hh:130
    \n+
    TS AttributeSet
    The type of the Set of attributes.
    Definition: selection.hh:107
    \n+
    iterator const_iterator
    The type of the iterator of the selected indices.
    Definition: selection.hh:135
    \n+
    TG GlobalIndex
    The type of the global index of the underlying index set.
    Definition: selection.hh:112
    \n+
    UncachedSelection(const ParallelIndexSet &indexset)
    Definition: selection.hh:141
    \n+
    Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet
    The type of the underlying index set.
    Definition: selection.hh:125
    \n+
    TL LocalIndex
    The type of the local index of the underlying index set.
    Definition: selection.hh:120
    \n+
    A cached selection of indices.
    Definition: selection.hh:178
    \n+
    TG GlobalIndex
    The type of the global index of the underlying index set.
    Definition: selection.hh:193
    \n+
    Selection(const ParallelIndexSet &indexset)
    Definition: selection.hh:222
    \n+
    Selection()
    Definition: selection.hh:218
    \n+
    TL LocalIndex
    The type of the local index of the underlying index set.
    Definition: selection.hh:201
    \n+
    TS AttributeSet
    The type of the set of attributes.
    Definition: selection.hh:188
    \n+
    uint32_t * iterator
    The type of the iterator of the selected indices.
    Definition: selection.hh:211
    \n+
    uint32_t * const_iterator
    The type of the iterator of the selected indices.
    Definition: selection.hh:216
    \n+
    Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet
    The type of the underlying index set.
    Definition: selection.hh:206
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,700 +4,385 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-arraylist.hh\n+ * parallel\n+selection.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5\n- 6#ifndef DUNE_COMMON_ARRAYLIST_HH\n- 7#define DUNE_COMMON_ARRAYLIST_HH\n- 8\n- 9#include \n- 10#include \n- 11#include \n- 12#include \n- 13#include \"iteratorfacades.hh\"\n- 14\n- 15namespace Dune\n- 16{\n- 17 // forward declaration\n- 18 template\n- 19 class ArrayListIterator;\n- 20\n- 21 template\n- 22 class ConstArrayListIterator;\n- 23\n- 60 template >\n-61 class ArrayList\n- 62 {\n- 63 public:\n-69 typedef T MemberType;\n+ 5#ifndef DUNE_SELECTION_HH\n+ 6#define DUNE_SELECTION_HH\n+ 7\n+ 8#include \"indexset.hh\"\n+ 9#include \n+ 10\n+ 11namespace Dune\n+ 12{\n+ 27 template\n+28 class SelectionIterator\n+ 29 {\n+ 30 public:\n+39 typedef TS AttributeSet;\n+ 40\n+44 typedef Dune::ParallelIndexSet ParallelIndexSet;\n+ 45\n+ 46 //typedef typename ParallelIndexSet::const_iterator\n+ParallelIndexSetIterator;\n+ 47\n+48 typedef ConstArrayListIterator, N, std::allocator > > ParallelIndexSetIterator;\n+54 SelectionIterator(const ParallelIndexSetIterator& iter, const\n+ParallelIndexSetIterator& end)\n+ 55 : iter_(iter), end_(end)\n+ 56 {\n+ 57 // Step to the first valid entry\n+ 58 while(iter_!=end_ && !AttributeSet::contains(iter_->local().attribute()))\n+ 59 ++iter_;\n+ 60 }\n+ 61\n+62 void operator++()\n+ 63 {\n+ 64 assert(iter_!=end_);\n+ 65 for(++iter_; iter_!=end_; ++iter_)\n+ 66 if(AttributeSet::contains(iter_->local().attribute()))\n+ 67 break;\n+ 68 }\n+ 69\n 70\n-74 typedef T value_type;\n+71 uint32_t operator*() const\n+ 72 {\n+ 73 return iter_->local().local();\n+ 74 }\n 75\n-79 typedef T& reference;\n+76 bool operator==(const SelectionIterator& other) const\n+ 77 {\n+ 78 return iter_ == other.iter_;\n+ 79 }\n 80\n-84 typedef const T& const_reference;\n+81 bool operator!=(const SelectionIterator& other) const\n+ 82 {\n+ 83 return iter_ != other.iter_;\n+ 84 }\n 85\n-89 typedef T* pointer;\n+ 86 private:\n+ 87 ParallelIndexSetIterator iter_;\n+ 88 const ParallelIndexSetIterator end_;\n+ 89 };\n 90\n-94 typedef const T* const_pointer;\n- 95\n-100 constexpr static int chunkSize_ = (N > 0) ? N : 1;\n- 101\n-105 typedef ArrayListIterator iterator;\n- 106\n-110 typedef ConstArrayListIterator const_iterator;\n- 111\n-115 typedef std::size_t size_type;\n- 116\n-120 typedef std::ptrdiff_t difference_type;\n+ 91\n+ 95 template\n+96 class UncachedSelection\n+ 97 {\n+ 98 public:\n+107 typedef TS AttributeSet;\n+ 108\n+112 typedef TG GlobalIndex;\n+ 113\n+120 typedef TL LocalIndex;\n 121\n-126 iterator begin();\n- 127\n-133 const_iterator begin() const;\n- 134\n-139 iterator end();\n+125 typedef Dune::ParallelIndexSet ParallelIndexSet;\n+ 126\n+130 typedef SelectionIterator iterator;\n+ 131\n+135 typedef iterator const_iterator;\n+ 136\n+137 UncachedSelection()\n+ 138 : indexSet_()\n+ 139 {}\n 140\n-145 const_iterator end() const;\n- 146\n-151 inline void push_back(const_reference entry);\n- 152\n-158 inline reference operator[](size_type i);\n- 159\n-165 inline const_reference operator[](size_type i) const;\n+141 UncachedSelection(const ParallelIndexSet& indexset)\n+ 142 : indexSet_(&indexset)\n+ 143 {}\n+ 148 void setIndexSet(const ParallelIndexSet& indexset);\n+ 149\n+ 153 //const ParallelIndexSet& indexSet() const;\n+ 154\n+ 159 const_iterator begin() const;\n+ 160\n+ 165 const_iterator end() const;\n 166\n-171 inline size_type size() const;\n+ 167\n+ 168 private:\n+ 169 const ParallelIndexSet* indexSet_;\n+ 170\n+ 171 };\n 172\n-180 inline void purge();\n- 181\n-185 inline void clear();\n-189 ArrayList();\n- 190\n- 191 private:\n- 192\n- 196 using SmartPointerAllocator = typename std::allocator_traits::template\n-rebind_alloc< std::shared_ptr< std::array > >;\n- 197\n- 201 using ArrayAllocator = typename std::allocator_traits::template\n-rebind_alloc< std::array >;\n+ 176 template\n+177 class Selection\n+ 178 {\n+ 179 public:\n+188 typedef TS AttributeSet;\n+ 189\n+193 typedef TG GlobalIndex;\n+ 194\n+201 typedef TL LocalIndex;\n 202\n- 206 friend class ArrayListIterator;\n- 207 friend class ConstArrayListIterator;\n- 208\n- 210 std::vector >,\n- 211 SmartPointerAllocator> chunks_;\n- 220 size_type capacity_;\n- 222 size_type size_;\n- 224 size_type start_;\n- 233 inline reference elementAt(size_type i);\n- 234\n-243 inline const_reference elementAt(size_type i) const;\n- 244 };\n+206 typedef Dune::ParallelIndexSet ParallelIndexSet;\n+ 207\n+211 typedef uint32_t* iterator;\n+ 212\n+216 typedef uint32_t* const_iterator;\n+ 217\n+218 Selection()\n+ 219 : selected_()\n+ 220 {}\n+ 221\n+222 Selection(const ParallelIndexSet& indexset)\n+ 223 : selected_(), size_(0), built_(false)\n+ 224 {\n+ 225 setIndexSet(indexset);\n+ 226 }\n+ 227\n+ 228 ~Selection();\n+ 229\n+ 234 void setIndexSet(const ParallelIndexSet& indexset);\n+ 235\n+ 239 void free();\n+ 240\n+ 244 //IndexSet indexSet() const;\n 245\n- 246\n- 250 template\n-251 class ArrayListIterator : public\n-RandomAccessIteratorFacade,\n- 252 typename A::value_type,\n- 253 typename A::value_type &,\n- 254 typename A::difference_type>\n- 255 {\n- 256\n- 257 friend class ArrayList;\n- 258 friend class ConstArrayListIterator;\n- 259 public:\n-263 typedef typename A::value_type MemberType;\n- 264\n-265 typedef typename A::difference_type difference_type;\n- 266\n-267 typedef typename A::size_type size_type;\n- 268\n-269 using reference = typename A::value_type &;\n- 270\n-271 using const_reference = typename A::value_type const&;\n- 272\n-278 constexpr static int chunkSize_ = (N > 0) ? N : 1;\n- 279\n+ 250 const_iterator begin() const;\n+ 251\n+ 256 const_iterator end() const;\n+ 257\n+ 258\n+ 259 private:\n+ 260 uint32_t* selected_;\n+ 261 size_t size_;\n+ 262 bool built_;\n+ 263\n+ 264 };\n+ 265\n+ 266 template\n+267 inline void Selection::setIndexSet(const ParallelIndexSet&\n+indexset)\n+ 268 {\n+ 269 if(built_)\n+ 270 free();\n+ 271\n+ 272 // Count the number of entries the selection has to hold\n+ 273 typedef typename ParallelIndexSet::const_iterator const_iterator;\n+ 274 const const_iterator end = indexset.end();\n+ 275 int entries = 0;\n+ 276\n+ 277 for(const_iterator index = indexset.begin(); index != end; ++index)\n+ 278 if(AttributeSet::contains(index->local().attribute()))\n+ 279 ++entries;\n 280\n- 286 inline bool equals(const ArrayListIterator& other) const;\n- 287\n- 293 inline bool equals(const ConstArrayListIterator& other)\n-const;\n- 294\n- 298 inline void increment();\n- 299\n- 303 inline void decrement();\n+ 281 selected_ = new uint32_t[entries];\n+ 282 built_ = true;\n+ 283\n+ 284 entries = 0;\n+ 285 for(const_iterator index = indexset.begin(); index != end; ++index)\n+ 286 if(AttributeSet::contains(index->local().attribute()))\n+ 287 selected_[entries++]= index->local().local();\n+ 288\n+ 289 size_=entries;\n+ 290 built_=true;\n+ 291 }\n+ 292\n+ 293 template\n+294 uint32_t* Selection::begin() const\n+ 295 {\n+ 296 return selected_;\n+ 297 }\n+ 298\n+ 299 template\n+300 uint32_t* Selection::end() const\n+ 301 {\n+ 302 return selected_+size_;\n+ 303 }\n 304\n- 309 inline reference elementAt(size_type i) const;\n- 310\n- 315 inline reference dereference() const;\n- 316\n- 328 inline void eraseToHere();\n- 329\n-331 inline size_type position(){return position_;}\n- 332\n- 334 inline void advance(difference_type n);\n- 335\n- 337 inline difference_type distanceTo(const ArrayListIterator& other)\n-const;\n+ 305 template\n+306 inline void Selection::free()\n+ 307 {\n+ 308 delete[] selected_;\n+ 309 size_=0;\n+ 310 built_=false;\n+ 311 }\n+ 312\n+ 313 template\n+314 inline Selection::~Selection()\n+ 315 {\n+ 316 if(built_)\n+ 317 free();\n+ 318 }\n+ 319\n+ 320 template\n+321 SelectionIterator UncachedSelection::begin() const\n+ 322 {\n+ 323 return SelectionIterator(indexSet_->begin(),\n+ 324 indexSet_->end());\n+ 325 }\n+ 326\n+ 327 template\n+328 SelectionIterator UncachedSelection::end() const\n+ 329 {\n+ 330 return SelectionIterator(indexSet_->end(),\n+ 331 indexSet_->end());\n+ 332 }\n+ 333 template\n+334 void UncachedSelection::setIndexSet(const ParallelIndexSet&\n+indexset)\n+ 335 {\n+ 336 indexSet_ = &indexset;\n+ 337 }\n 338\n-340 inline ArrayListIterator() : position_(0), list_(nullptr)\n- 341 {}\n- 342\n- 343 private:\n- 349 inline ArrayListIterator(ArrayList& arrayList, size_type position);\n- 350\n- 354 size_type position_;\n-358 ArrayList* list_;\n- 359 };\n- 360\n- 364 template\n-365 class ConstArrayListIterator\n- 366 : public RandomAccessIteratorFacade,\n- 367 const typename A::value_type,\n- 368 typename A::value_type const&,\n- 369 typename A::difference_type>\n- 370 {\n- 371\n- 372 friend class ArrayList;\n- 373 friend class ArrayListIterator;\n- 374\n- 375 public:\n-379 typedef typename A::value_type MemberType;\n- 380\n-381 typedef typename A::difference_type difference_type;\n- 382\n-383 typedef typename A::size_type size_type;\n- 384\n-385 using reference = typename A::value_type &;\n- 386\n-387 using const_reference = typename A::value_type const&;\n- 388\n-394 constexpr static int chunkSize_ = (N > 0) ? N : 1;\n- 395\n-401 inline bool equals(const ConstArrayListIterator& other)\n-const;\n- 402\n-406 inline void increment();\n- 407\n-411 inline void decrement();\n- 412\n-414 inline void advance(difference_type n);\n- 415\n-417 inline difference_type distanceTo(const ConstArrayListIterator&\n-other) const;\n- 418\n-423 inline const_reference elementAt(size_type i) const;\n- 424\n-429 inline const_reference dereference() const;\n- 430\n-431 inline ConstArrayListIterator() : position_(0), list_(nullptr)\n- 432 {}\n- 433\n-434 inline ConstArrayListIterator(const ArrayListIterator& other);\n- 435\n- 436 private:\n- 437\n- 443 inline ConstArrayListIterator(const ArrayList& arrayList, size_type\n-position);\n- 444\n- 448 size_type position_;\n- 452 const ArrayList* list_;\n- 453 };\n- 454\n- 455\n- 456 template\n-457 ArrayList::ArrayList()\n- 458 : capacity_(0), size_(0), start_(0)\n- 459 {\n- 460 chunks_.reserve(100);\n- 461 }\n- 462\n- 463 template\n-464 void ArrayList::clear(){\n- 465 capacity_=0;\n- 466 size_=0;\n- 467 start_=0;\n- 468 chunks_.clear();\n- 469 }\n- 470\n- 471 template\n-472 size_t ArrayList::size() const\n- 473 {\n- 474 return size_;\n- 475 }\n- 476\n- 477 template\n-478 void ArrayList::push_back(const_reference entry)\n- 479 {\n- 480 size_t index=start_+size_;\n- 481 if(index==capacity_)\n- 482 {\n- 483 chunks_.push_back(std::make_shared >());\n- 484 capacity_ += chunkSize_;\n- 485 }\n- 486 elementAt(index)=entry;\n- 487 ++size_;\n- 488 }\n- 489\n- 490 template\n-491 typename ArrayList::reference ArrayList::operator[](size_type\n-i)\n- 492 {\n- 493 return elementAt(start_+i);\n- 494 }\n- 495\n- 496\n- 497 template\n-498 typename ArrayList::const_reference ArrayList::operator[]\n-(size_type i) const\n- 499 {\n- 500 return elementAt(start_+i);\n- 501 }\n- 502\n- 503 template\n- 504 typename ArrayList::reference ArrayList::elementAt(size_type\n-i)\n- 505 {\n- 506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);\n- 507 }\n- 508\n- 509\n- 510 template\n- 511 typename ArrayList::const_reference ArrayList::elementAt\n-(size_type i) const\n- 512 {\n- 513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);\n- 514 }\n- 515\n- 516 template\n-517 ArrayListIterator ArrayList::begin()\n- 518 {\n- 519 return ArrayListIterator(*this, start_);\n- 520 }\n- 521\n- 522 template\n-523 ConstArrayListIterator ArrayList::begin() const\n- 524 {\n- 525 return ConstArrayListIterator(*this, start_);\n- 526 }\n- 527\n- 528 template\n-529 ArrayListIterator ArrayList::end()\n- 530 {\n- 531 return ArrayListIterator(*this, start_+size_);\n- 532 }\n- 533\n- 534 template\n-535 ConstArrayListIterator ArrayList::end() const\n- 536 {\n- 537 return ConstArrayListIterator(*this, start_+size_);\n- 538 }\n- 539\n- 540 template\n-541 void ArrayList::purge()\n- 542 {\n- 543 // Distance to copy to the left.\n- 544 size_t distance = start_/chunkSize_;\n- 545 if(distance>0) {\n- 546 // Number of chunks with entries in it;\n- 547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ );\n- 548\n- 549 // Copy chunks to the left.\n- 550 std::copy(chunks_.begin()+distance,\n- 551 chunks_.begin()+(distance+chunks), chunks_.begin());\n- 552\n- 553 // Calculate new parameters\n- 554 start_ = start_ % chunkSize_;\n- 555 //capacity += distance * chunkSize_;\n- 556 }\n- 557 }\n- 558\n- 559 template\n-560 void ArrayListIterator::advance(difference_type i)\n- 561 {\n- 562 position_+=i;\n- 563 }\n- 564\n- 565 template\n-566 void ConstArrayListIterator::advance(difference_type i)\n- 567 {\n- 568 position_+=i;\n- 569 }\n- 570\n- 571\n- 572 template\n-573 bool ArrayListIterator::equals(const\n-ArrayListIterator& other) const\n- 574 {\n- 575 // Makes only sense if we reference a common list\n- 576 assert(list_==(other.list_));\n- 577 return position_==other.position_ ;\n- 578 }\n- 579\n- 580\n- 581 template\n-582 bool ArrayListIterator::equals(const\n-ConstArrayListIterator& other) const\n- 583 {\n- 584 // Makes only sense if we reference a common list\n- 585 assert(list_==(other.list_));\n- 586 return position_==other.position_ ;\n- 587 }\n- 588\n- 589\n- 590 template\n-591 bool ConstArrayListIterator::equals(const\n-ConstArrayListIterator& other) const\n- 592 {\n- 593 // Makes only sense if we reference a common list\n- 594 assert(list_==(other.list_));\n- 595 return position_==other.position_ ;\n- 596 }\n- 597\n- 598 template\n-599 void ArrayListIterator::increment()\n- 600 {\n- 601 ++position_;\n- 602 }\n- 603\n- 604 template\n-605 void ConstArrayListIterator::increment()\n- 606 {\n- 607 ++position_;\n- 608 }\n- 609\n- 610 template\n-611 void ArrayListIterator::decrement()\n- 612 {\n- 613 --position_;\n- 614 }\n- 615\n- 616 template\n-617 void ConstArrayListIterator::decrement()\n- 618 {\n- 619 --position_;\n- 620 }\n- 621\n- 622 template\n-623 typename ArrayListIterator::reference ArrayListIterator::\n-elementAt(size_type i) const\n- 624 {\n- 625 return list_->elementAt(i+position_);\n- 626 }\n- 627\n- 628 template\n-629 typename ConstArrayListIterator::const_reference\n-ConstArrayListIterator::elementAt(size_type i) const\n- 630 {\n- 631 return list_->elementAt(i+position_);\n- 632 }\n- 633\n- 634 template\n-635 typename ArrayListIterator::reference ArrayListIterator::\n-dereference() const\n- 636 {\n- 637 return list_->elementAt(position_);\n- 638 }\n- 639\n- 640 template\n-641 typename ConstArrayListIterator::const_reference\n-ConstArrayListIterator::dereference() const\n- 642 {\n- 643 return list_->elementAt(position_);\n- 644 }\n- 645\n- 646 template\n-647 typename ArrayListIterator::difference_type\n-ArrayListIterator::distanceTo(const ArrayListIterator& other)\n-const\n- 648 {\n- 649 // Makes only sense if we reference a common list\n- 650 assert(list_==(other.list_));\n- 651 return other.position_ - position_;\n- 652 }\n- 653\n- 654 template\n-655 typename ConstArrayListIterator::difference_type\n-ConstArrayListIterator::distanceTo(const ConstArrayListIterator&\n-other) const\n- 656 {\n- 657 // Makes only sense if we reference a common list\n- 658 assert(list_==(other.list_));\n- 659 return other.position_ - position_;\n- 660 }\n- 661\n- 662 template\n-663 void ArrayListIterator::eraseToHere()\n- 664 {\n- 665 list_->size_ -= ++position_ - list_->start_;\n- 666 // chunk number of the new position.\n- 667 size_t posChunkStart = position_ / chunkSize_;\n- 668 // number of chunks to deallocate\n- 669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_)\n- 670 / chunkSize_;\n- 671 list_->start_ = position_;\n- 672\n- 673 // Deallocate memory not needed any more.\n- 674 for(size_t chunk=0; chunkchunks_[posChunkStart].reset();\n- 677 }\n- 678\n- 679 // Capacity stays the same as the chunks before us\n- 680 // are still there. They null pointers.\n- 681 assert(list_->start_+list_->size_<=list_->capacity_);\n- 682 }\n- 683\n- 684 template\n- 685 ArrayListIterator::ArrayListIterator(ArrayList& arrayList,\n-size_type position)\n- 686 : position_(position), list_(&arrayList)\n- 687 {}\n- 688\n- 689\n- 690 template\n- 691 ConstArrayListIterator::ConstArrayListIterator(const\n-ArrayList& arrayList,\n- 692 size_type position)\n- 693 : position_(position), list_(&arrayList)\n- 694 {}\n- 695\n- 696 template\n-697 ConstArrayListIterator::ConstArrayListIterator(const\n-ArrayListIterator& other)\n- 698 : position_(other.position_), list_(other.list_)\n- 699 {}\n- 700\n- 701\n- 703}\n- 704#endif\n+ 342}\n+ 343#endif\n iteratorfacades.hh\n This file implements iterator facade classes for writing stl conformant\n iterators.\n-Dune::ArrayList::operator[]\n-reference operator[](size_type i)\n-Get the element at specific position.\n-Definition: arraylist.hh:491\n-Dune::ArrayList::begin\n+indexset.hh\n+Provides a map between global and local indices.\n+Dune::UncachedSelection::end\n+const_iterator end() const\n+Get an iterator over the selected indices.\n+Definition: selection.hh:328\n+Dune::Selection::setIndexSet\n+void setIndexSet(const ParallelIndexSet &indexset)\n+Set the index set of the selection.\n+Definition: selection.hh:267\n+Dune::UncachedSelection::setIndexSet\n+void setIndexSet(const ParallelIndexSet &indexset)\n+Set the index set of the selection.\n+Definition: selection.hh:334\n+Dune::ParallelIndexSet::begin\n iterator begin()\n-Get an iterator that is positioned at the first element.\n-Definition: arraylist.hh:517\n-Dune::ArrayListIterator::equals\n-bool equals(const ArrayListIterator< MemberType, N, A > &other) const\n-Comares two iterators.\n-Definition: arraylist.hh:573\n-Dune::ArrayListIterator::increment\n-void increment()\n-Increment the iterator.\n-Definition: arraylist.hh:599\n-Dune::ArrayList::size\n-size_type size() const\n-Get the number of elements in the list.\n-Definition: arraylist.hh:472\n-Dune::ConstArrayListIterator::ConstArrayListIterator\n-ConstArrayListIterator(const ArrayListIterator< T, N, A > &other)\n-Definition: arraylist.hh:697\n-Dune::ArrayList::purge\n-void purge()\n-Purge the list.\n-Definition: arraylist.hh:541\n-Dune::ArrayListIterator::decrement\n-void decrement()\n-decrement the iterator.\n-Definition: arraylist.hh:611\n-Dune::ArrayListIterator::eraseToHere\n-void eraseToHere()\n-Erase all entries before the current position and the one at the current\n-position.\n-Definition: arraylist.hh:663\n-Dune::ArrayList::ArrayList\n-ArrayList()\n-Constructs an Array list with one chunk.\n-Definition: arraylist.hh:457\n-Dune::ArrayList::begin\n-const_iterator begin() const\n-Get a random access iterator that is positioned at the first element.\n-Definition: arraylist.hh:523\n-Dune::ConstArrayListIterator::increment\n-void increment()\n-Increment the iterator.\n-Definition: arraylist.hh:605\n-Dune::ArrayList::end\n+Get an iterator over the indices positioned at the first index.\n+Dune::ParallelIndexSet::end\n iterator end()\n-Get a random access iterator positioned after the last element.\n-Definition: arraylist.hh:529\n-Dune::ConstArrayListIterator::elementAt\n-const_reference elementAt(size_type i) const\n-Get the value of the list at an arbitrary position.\n-Definition: arraylist.hh:629\n-Dune::ArrayList::operator[]\n-const_reference operator[](size_type i) const\n-Get the element at specific position.\n-Definition: arraylist.hh:498\n-Dune::ConstArrayListIterator::decrement\n-void decrement()\n-decrement the iterator.\n-Definition: arraylist.hh:617\n-Dune::ConstArrayListIterator::advance\n-void advance(difference_type n)\n-Definition: arraylist.hh:566\n-Dune::ArrayList::end\n+Get an iterator over the indices positioned after the last index.\n+Dune::Selection::end\n const_iterator end() const\n-Get a random access iterator positioned after the last element.\n-Definition: arraylist.hh:535\n-Dune::ConstArrayListIterator::dereference\n-const_reference dereference() const\n-Access the element at the current position.\n-Definition: arraylist.hh:641\n-Dune::ArrayList::clear\n-void clear()\n-Delete all entries from the list.\n-Definition: arraylist.hh:464\n-Dune::ArrayListIterator::elementAt\n-reference elementAt(size_type i) const\n-Get the value of the list at an arbitrary position.\n-Definition: arraylist.hh:623\n-Dune::ConstArrayListIterator::equals\n-bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const\n-Comares to iterators.\n-Definition: arraylist.hh:591\n-Dune::ArrayListIterator::advance\n-void advance(difference_type n)\n-Definition: arraylist.hh:560\n-Dune::ConstArrayListIterator::distanceTo\n-difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other)\n-const\n-Definition: arraylist.hh:655\n-Dune::ArrayListIterator::dereference\n-reference dereference() const\n-Access the element at the current position.\n-Definition: arraylist.hh:635\n-Dune::ArrayList::push_back\n-void push_back(const_reference entry)\n-Append an entry to the list.\n-Definition: arraylist.hh:478\n-Dune::ArrayListIterator::distanceTo\n-difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const\n-Definition: arraylist.hh:647\n+Get an iterator over the selected indices.\n+Definition: selection.hh:300\n+Dune::Selection::begin\n+const_iterator begin() const\n+Get the index set we are a selection for.\n+Definition: selection.hh:294\n+Dune::Selection::free\n+void free()\n+Free allocated memory.\n+Definition: selection.hh:306\n+Dune::UncachedSelection::begin\n+const_iterator begin() const\n+Get the index set we are a selection for.\n+Definition: selection.hh:321\n+Dune::Selection::~Selection\n+~Selection()\n+Definition: selection.hh:314\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::ArrayListIterator\n-A random access iterator for the Dune::ArrayList class.\n-Definition: arraylist.hh:255\n-Dune::ArrayListIterator::position\n-size_type position()\n-Definition: arraylist.hh:331\n-Dune::ArrayListIterator::MemberType\n-A::value_type MemberType\n-The member type.\n-Definition: arraylist.hh:263\n-Dune::ArrayListIterator::ArrayListIterator\n-ArrayListIterator()\n-Standard constructor.\n-Definition: arraylist.hh:340\n-Dune::ArrayListIterator::difference_type\n-A::difference_type difference_type\n-Definition: arraylist.hh:265\n-Dune::ArrayListIterator::chunkSize_\n-static constexpr int chunkSize_\n-The number of elements in one chunk of the list.\n-Definition: arraylist.hh:278\n-Dune::ArrayListIterator::size_type\n-A::size_type size_type\n-Definition: arraylist.hh:267\n-Dune::ArrayListIterator::const_reference\n-typename A::value_type const & const_reference\n-Definition: arraylist.hh:271\n-Dune::ArrayListIterator::reference\n-typename A::value_type & reference\n-Definition: arraylist.hh:269\n Dune::ConstArrayListIterator\n A constant random access iterator for the Dune::ArrayList class.\n Definition: arraylist.hh:370\n-Dune::ConstArrayListIterator::chunkSize_\n-static constexpr int chunkSize_\n-The number of elements in one chunk of the list.\n-Definition: arraylist.hh:394\n-Dune::ConstArrayListIterator::reference\n-typename A::value_type & reference\n-Definition: arraylist.hh:385\n-Dune::ConstArrayListIterator::ConstArrayListIterator\n-ConstArrayListIterator()\n-Definition: arraylist.hh:431\n-Dune::ConstArrayListIterator::MemberType\n-A::value_type MemberType\n-The member type.\n-Definition: arraylist.hh:379\n-Dune::ConstArrayListIterator::difference_type\n-A::difference_type difference_type\n-Definition: arraylist.hh:381\n-Dune::ConstArrayListIterator::const_reference\n-typename A::value_type const & const_reference\n-Definition: arraylist.hh:387\n-Dune::ConstArrayListIterator::size_type\n-A::size_type size_type\n-Definition: arraylist.hh:383\n-Dune::ArrayList\n-A dynamically growing random access list.\n-Definition: arraylist.hh:62\n-Dune::ArrayList::value_type\n-T value_type\n-Value type for stl compliance.\n-Definition: arraylist.hh:74\n-Dune::ArrayList::chunkSize_\n-static constexpr int chunkSize_\n-The number of elements in one chunk of the list. This has to be at least one.\n-The default is 100.\n-Definition: arraylist.hh:100\n-Dune::ArrayList::const_pointer\n-const T * const_pointer\n-The type of a const pointer to the type we store.\n-Definition: arraylist.hh:94\n-Dune::ArrayList::iterator\n-ArrayListIterator< MemberType, N, A > iterator\n-A random access iterator.\n-Definition: arraylist.hh:105\n-Dune::ArrayList::const_reference\n-const T & const_reference\n-The type of a const reference to the type we store.\n-Definition: arraylist.hh:84\n-Dune::ArrayList::reference\n-T & reference\n-The type of a reference to the type we store.\n-Definition: arraylist.hh:79\n-Dune::ArrayList::size_type\n-std::size_t size_type\n-The size type.\n-Definition: arraylist.hh:115\n-Dune::ArrayList::MemberType\n-T MemberType\n-The member type that is stored.\n-Definition: arraylist.hh:69\n-Dune::ArrayList::pointer\n-T * pointer\n-The type of a pointer to the type we store.\n-Definition: arraylist.hh:89\n-Dune::ArrayList::const_iterator\n-ConstArrayListIterator< MemberType, N, A > const_iterator\n-A constant random access iterator.\n-Definition: arraylist.hh:110\n-Dune::ArrayList::difference_type\n-std::ptrdiff_t difference_type\n-The difference type.\n-Definition: arraylist.hh:120\n-Dune::RandomAccessIteratorFacade\n-Base class for stl conformant forward iterators.\n-Definition: iteratorfacades.hh:434\n+Dune::ParallelIndexSet<_TG,_TL,_N_>\n+Dune::SelectionIterator\n+A const iterator over an uncached selection.\n+Definition: selection.hh:29\n+Dune::SelectionIterator::ParallelIndexSetIterator\n+ConstArrayListIterator< IndexPair< TG, TL >, N, std::allocator< Dune::\n+IndexPair< TG, TL > > > ParallelIndexSetIterator\n+Definition: selection.hh:48\n+Dune::SelectionIterator::operator++\n+void operator++()\n+Definition: selection.hh:62\n+Dune::SelectionIterator::operator*\n+uint32_t operator*() const\n+Definition: selection.hh:71\n+Dune::SelectionIterator::AttributeSet\n+TS AttributeSet\n+The type of the Set of attributes.\n+Definition: selection.hh:39\n+Dune::SelectionIterator::ParallelIndexSet\n+Dune::ParallelIndexSet< TG, TL, N > ParallelIndexSet\n+The type of the underlying index set.\n+Definition: selection.hh:44\n+Dune::SelectionIterator::SelectionIterator\n+SelectionIterator(const ParallelIndexSetIterator &iter, const\n+ParallelIndexSetIterator &end)\n+Constructor.\n+Definition: selection.hh:54\n+Dune::SelectionIterator::operator!=\n+bool operator!=(const SelectionIterator< TS, TG, TL, N > &other) const\n+Definition: selection.hh:81\n+Dune::SelectionIterator::operator==\n+bool operator==(const SelectionIterator< TS, TG, TL, N > &other) const\n+Definition: selection.hh:76\n+Dune::UncachedSelection\n+An uncached selection of indices.\n+Definition: selection.hh:97\n+Dune::UncachedSelection::UncachedSelection\n+UncachedSelection()\n+Definition: selection.hh:137\n+Dune::UncachedSelection::iterator\n+SelectionIterator< TS, TG, TL, N > iterator\n+The type of the iterator of the selected indices.\n+Definition: selection.hh:130\n+Dune::UncachedSelection::AttributeSet\n+TS AttributeSet\n+The type of the Set of attributes.\n+Definition: selection.hh:107\n+Dune::UncachedSelection::const_iterator\n+iterator const_iterator\n+The type of the iterator of the selected indices.\n+Definition: selection.hh:135\n+Dune::UncachedSelection::GlobalIndex\n+TG GlobalIndex\n+The type of the global index of the underlying index set.\n+Definition: selection.hh:112\n+Dune::UncachedSelection::UncachedSelection\n+UncachedSelection(const ParallelIndexSet &indexset)\n+Definition: selection.hh:141\n+Dune::UncachedSelection::ParallelIndexSet\n+Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet\n+The type of the underlying index set.\n+Definition: selection.hh:125\n+Dune::UncachedSelection::LocalIndex\n+TL LocalIndex\n+The type of the local index of the underlying index set.\n+Definition: selection.hh:120\n+Dune::Selection\n+A cached selection of indices.\n+Definition: selection.hh:178\n+Dune::Selection::GlobalIndex\n+TG GlobalIndex\n+The type of the global index of the underlying index set.\n+Definition: selection.hh:193\n+Dune::Selection::Selection\n+Selection(const ParallelIndexSet &indexset)\n+Definition: selection.hh:222\n+Dune::Selection::Selection\n+Selection()\n+Definition: selection.hh:218\n+Dune::Selection::LocalIndex\n+TL LocalIndex\n+The type of the local index of the underlying index set.\n+Definition: selection.hh:201\n+Dune::Selection::AttributeSet\n+TS AttributeSet\n+The type of the set of attributes.\n+Definition: selection.hh:188\n+Dune::Selection::iterator\n+uint32_t * iterator\n+The type of the iterator of the selected indices.\n+Definition: selection.hh:211\n+Dune::Selection::const_iterator\n+uint32_t * const_iterator\n+The type of the iterator of the selected indices.\n+Definition: selection.hh:216\n+Dune::Selection::ParallelIndexSet\n+Dune::ParallelIndexSet< GlobalIndex, LocalIndex, N > ParallelIndexSet\n+The type of the underlying index set.\n+Definition: selection.hh:206\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00065.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00065.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: hybridutilities.hh File Reference\n+dune-common: indexset.hh File Reference\n \n \n \n \n \n \n \n@@ -58,90 +58,124 @@\n \n \n \n \n \n
    \n \n-
    hybridutilities.hh File Reference
    \n+ \n
    \n
    \n-
    #include <tuple>
    \n-#include <utility>
    \n-#include <dune/common/typetraits.hh>
    \n-#include <dune/common/typeutilities.hh>
    \n-#include <dune/common/fvector.hh>
    \n-#include <dune/common/indices.hh>
    \n-#include <dune/common/assertandreturn.hh>
    \n-#include <dune/common/rangeutilities.hh>
    \n+\n+

    Provides a map between global and local indices. \n+More...

    \n+
    #include <algorithm>
    \n+#include <dune/common/arraylist.hh>
    \n+#include <dune/common/exceptions.hh>
    \n+#include <iostream>
    \n+#include "localindex.hh"
    \n+#include <stdint.h>
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+Classes

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

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Hybrid
     
    \n+\n+\n+\n+\n

    \n+Enumerations

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

    \n Functions

    template<class T >
    constexpr auto Dune::Hybrid::size (const T &t)
     Size query. More...
     
    template<class Container , class Index >
    constexpr decltype(auto) Dune::Hybrid::elementAt (Container &&c, Index &&i)
     Get element at given position from container. More...
     
    template<class Begin , class End >
    constexpr auto Dune::Hybrid::integralRange (const Begin &begin, const End &end)
     Create an integral range. More...
     
    template<class End >
    constexpr auto Dune::Hybrid::integralRange (const End &end)
     Create an integral range starting from 0. More...
     
    template<class Range , class F >
    constexpr void Dune::Hybrid::forEach (Range &&range, F &&f)
     Range based for loop. More...
     
    template<class Range , class T , class F >
    constexpr T Dune::Hybrid::accumulate (Range &&range, T value, F &&f)
     Accumulate values. More...
     
    template<class Condition , class IfFunc , class ElseFunc >
    decltype(auto) Dune::Hybrid::ifElse (const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
     A conditional expression. More...
     
    template<class Condition , class IfFunc >
    void Dune::Hybrid::ifElse (const Condition &condition, IfFunc &&ifFunc)
     A conditional expression. More...
     
    template<class T1 , class T2 >
    constexpr auto Dune::Hybrid::equals (T1 &&t1, T2 &&t2)
     Equality comparison. More...
     
    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. More...
     
    template<class Cases , class Value , class Branches >
    constexpr void Dune::Hybrid::switchCases (const Cases &cases, const Value &value, Branches &&branches)
     Switch statement. More...
     
    template<class TG , class TL >
    std::ostream & Dune::operator<< (std::ostream &os, const IndexPair< TG, TL > &pair)
     Print an index pair. More...
     
    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. More...
     
    \n-
    \n+

    Detailed Description

    \n+

    Provides a map between global and local indices.

    \n+
    Author
    Markus Blatt
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,79 +4,110 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Functions\n-hybridutilities.hh File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+ * parallel\n+Classes | Namespaces | Enumerations | Functions\n+indexset.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+Provides a map between global and local indices. More...\n+#include \n+#include \n+#include \n+#include \n+#include \"localindex.hh\"\n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+ class \u00a0Dune::IndexPair<_TG,_TL_>\n+\u00a0 A pair consisting of a global and local index. More...\n+\u00a0\n+ class \u00a0Dune::InvalidIndexSetState\n+\u00a0 Exception indicating that the index set is not in the expected state.\n+ More...\n+\u00a0\n+ class \u00a0Dune::ParallelIndexSet<_TG,_TL,_N_>\n+\u00a0 Manager class for the mapping between local indices and globally\n+ unique indices. More...\n+\u00a0\n+ class \u00a0Dune::ParallelIndexSet<_TG,_TL,_N_>::iterator\n+\u00a0 The iterator over the pairs. More...\n+\u00a0\n+ class \u00a0Dune::GlobalLookupIndexSet<_I_>\n+\u00a0 Decorates an index set with the possibility to find a global index\n+ that is mapped to a specific local. More...\n+\u00a0\n+struct \u00a0Dune::LocalIndexComparator<_T_>\n+\u00a0\n+struct \u00a0Dune::IndexSetSortFunctor<_TG,_TL_>\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::Hybrid\n+ Enumerations\n+enum \u00a0Dune::ParallelIndexSetState { Dune::GROUND , Dune::RESIZE }\n+\u00a0 The states the index set can be in. More...\n \u00a0\n Functions\n-template\n- constexpr auto\u00a0Dune::Hybrid::size (const T &t)\n-\u00a0 Size query. More...\n-\u00a0\n-template\n-constexpr decltype(auto)\u00a0Dune::Hybrid::elementAt (Container &&c, Index &&i)\n-\u00a0 Get element at given position from container. More...\n-\u00a0\n-template\n- constexpr auto\u00a0Dune::Hybrid::integralRange (const Begin &begin,\n- const End &end)\n-\u00a0 Create an integral range. More...\n-\u00a0\n-template\n- constexpr auto\u00a0Dune::Hybrid::integralRange (const End &end)\n-\u00a0 Create an integral range starting from 0. More...\n-\u00a0\n-template\n- constexpr void\u00a0Dune::Hybrid::forEach (Range &&range, F &&f)\n-\u00a0 Range based for loop. More...\n-\u00a0\n-template\n- constexpr T\u00a0Dune::Hybrid::accumulate (Range &&range, T value, F\n- &&f)\n-\u00a0 Accumulate values. More...\n-\u00a0\n-template\n- decltype(auto)\u00a0Dune::Hybrid::ifElse (const Condition &condition,\n- IfFunc &&ifFunc, ElseFunc &&elseFunc)\n-\u00a0 A conditional expression. More...\n-\u00a0\n-template\n- void\u00a0Dune::Hybrid::ifElse (const Condition &condition,\n- IfFunc &&ifFunc)\n-\u00a0 A conditional expression. More...\n-\u00a0\n-template\n- constexpr auto\u00a0Dune::Hybrid::equals (T1 &&t1, T2 &&t2)\n-\u00a0 Equality comparison. More...\n-\u00a0\n-template\n-constexpr decltype(auto)\u00a0Dune::Hybrid::switchCases (const Cases &cases, const\n- Value &value, Branches &&branches, ElseBranch\n- &&elseBranch)\n-\u00a0 Switch statement. More...\n-\u00a0\n-template\n- constexpr void\u00a0Dune::Hybrid::switchCases (const Cases &cases, const\n- Value &value, Branches &&branches)\n-\u00a0 Switch statement. More...\n-\u00a0\n+template\n+std::ostream &\u00a0Dune::operator<< (std::ostream &os, const IndexPair< TG, TL >\n+ &pair)\n+\u00a0 Print an index pair. More...\n+\u00a0\n+template\n+ bool\u00a0Dune::operator== (const IndexPair< TG, TL > &, const IndexPair<\n+ TG, TL > &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator!= (const IndexPair< TG, TL > &, const IndexPair<\n+ TG, TL > &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator< (const IndexPair< TG, TL > &, const IndexPair<\n+ TG, TL > &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator> (const IndexPair< TG, TL > &, const IndexPair<\n+ TG, TL > &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator<= (const IndexPair< TG, TL > &, const IndexPair<\n+ TG, TL > &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator>= (const IndexPair< TG, TL > &, const IndexPair<\n+ TG, TL > &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator== (const IndexPair< TG, TL > &, const TG &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator!= (const IndexPair< TG, TL > &, const TG &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator< (const IndexPair< TG, TL > &, const TG &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator> (const IndexPair< TG, TL > &, const TG &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator<= (const IndexPair< TG, TL > &, const TG &)\n+\u00a0\n+template\n+ bool\u00a0Dune::operator>= (const IndexPair< TG, TL > &, const TG &)\n+\u00a0\n+template\n+std::ostream &\u00a0Dune::operator<< (std::ostream &os, const ParallelIndexSet< TG,\n+ TL, N > &indexSet)\n+\u00a0 Print an index set. More...\n+\u00a0\n+***** Detailed Description *****\n+Provides a map between global and local indices.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00065_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: hybridutilities.hh Source File\n+dune-common: indexset.hh Source File\n \n \n \n \n \n \n \n@@ -58,358 +58,912 @@\n \n \n \n \n \n
    \n-
    hybridutilities.hh
    \n+
    indexset.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH
    \n-
    6#define DUNE_COMMON_HYBRIDUTILITIES_HH
    \n+
    5#ifndef DUNE_INDEXSET_HH
    \n+
    6#define DUNE_INDEXSET_HH
    \n
    7
    \n-
    8#include <tuple>
    \n-
    9#include <utility>
    \n-
    10
    \n-\n-\n-\n-\n-\n-\n-
    17
    \n-
    18
    \n-
    19
    \n-
    20namespace Dune {
    \n-
    21namespace Hybrid {
    \n-
    22
    \n-
    23namespace Impl {
    \n-
    24
    \n-
    25 // Try if tuple_size is implemented for class
    \n-
    26 template<class T, int i>
    \n-
    27 constexpr auto size(const Dune::FieldVector<T, i>&, const PriorityTag<5>&)
    \n-
    28 -> decltype(std::integral_constant<std::size_t,i>())
    \n-
    29 {
    \n-
    30 return {};
    \n-
    31 }
    \n+
    8#include <algorithm>
    \n+\n+\n+
    11#include <iostream>
    \n+
    12
    \n+
    13#include "localindex.hh"
    \n+
    14
    \n+
    15#include <stdint.h> // for uint32_t
    \n+
    16
    \n+
    17namespace Dune
    \n+
    18{
    \n+
    28 // forward declarations
    \n+
    29
    \n+
    30 template<class TG, class TL>
    \n+
    31 class IndexPair;
    \n
    32
    \n-
    33 // Try if tuple_size is implemented for class
    \n-
    34 template<class T>
    \n-
    35 constexpr auto size(const T&, const PriorityTag<3>&)
    \n-
    36 -> decltype(std::integral_constant<std::size_t,std::tuple_size<T>::value>())
    \n-
    37 {
    \n-
    38 return {};
    \n-
    39 }
    \n+
    38 template<class TG, class TL>
    \n+
    39 std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair);
    \n
    40
    \n-
    41 // Try if there's a static constexpr size()
    \n-
    42 template<class T>
    \n-
    43 constexpr auto size(const T&, const PriorityTag<1>&)
    \n-
    44 -> decltype(std::integral_constant<std::size_t,T::size()>())
    \n-
    45 {
    \n-
    46 return {};
    \n-
    47 }
    \n-
    48
    \n-
    49 // As a last resort try if there's a static constexpr size()
    \n-
    50 template<class T>
    \n-
    51 constexpr auto size(const T& t, const PriorityTag<0>&)
    \n-
    52 {
    \n-
    53 return t.size();
    \n-
    54 }
    \n+
    41 template<class TG, class TL>
    \n+
    42 bool operator==(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    43
    \n+
    44 template<class TG, class TL>
    \n+
    45 bool operator!=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    46
    \n+
    47 template<class TG, class TL>
    \n+
    48 bool operator<(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    49
    \n+
    50 template<class TG, class TL>
    \n+
    51 bool operator>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    52
    \n+
    53 template<class TG, class TL>
    \n+
    54 bool operator<=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n
    55
    \n-
    56} // namespace Impl
    \n-
    57
    \n+
    56 template<class TG, class TL>
    \n+
    57 bool operator >=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n
    58
    \n-
    59
    \n-
    81template<class T>
    \n-
    82constexpr auto size(const T& t)
    \n-
    83{
    \n-
    84 return Impl::size(t, PriorityTag<42>());
    \n-
    85}
    \n-
    86
    \n-
    87
    \n-
    88
    \n-
    89namespace Impl {
    \n-
    90
    \n-
    91 template<class Container, class Index,
    \n-
    92 std::enable_if_t<IsTuple<std::decay_t<Container>>::value, int> = 0>
    \n-
    93 constexpr decltype(auto) elementAt(Container&& c, Index&&, PriorityTag<2>)
    \n-
    94 {
    \n-
    95 return std::get<std::decay_t<Index>::value>(c);
    \n-
    96 }
    \n-
    97
    \n-
    98 template<class T, T... t, class Index>
    \n-
    99 constexpr decltype(auto) elementAt(std::integer_sequence<T, t...> c, Index, PriorityTag<1>)
    \n-
    100 {
    \n-
    101 return Dune::integerSequenceEntry(c, std::integral_constant<std::size_t, Index::value>());
    \n-
    102 }
    \n-
    103
    \n-
    104 template<class Container, class Index>
    \n-
    105 constexpr decltype(auto) elementAt(Container&& c, Index&& i, PriorityTag<0>)
    \n-
    106 {
    \n-
    107 return c[i];
    \n-
    108 }
    \n-
    109
    \n-
    110} // namespace Impl
    \n-
    111
    \n-
    112
    \n-
    113
    \n-
    134template<class Container, class Index>
    \n-
    135constexpr decltype(auto) elementAt(Container&& c, Index&& i)
    \n-
    136{
    \n-
    137 return Impl::elementAt(std::forward<Container>(c), std::forward<Index>(i), PriorityTag<42>());
    \n-
    138}
    \n-
    139
    \n-
    140
    \n+
    59 template<class TG, class TL>
    \n+
    60 bool operator==(const IndexPair<TG,TL>&, const TG&);
    \n+
    61
    \n+
    62 template<class TG, class TL>
    \n+
    63 bool operator!=(const IndexPair<TG,TL>&, const TG&);
    \n+
    64
    \n+
    65 template<class TG, class TL>
    \n+
    66 bool operator<(const IndexPair<TG,TL>&, const TG&);
    \n+
    67
    \n+
    68 template<class TG, class TL>
    \n+
    69 bool operator>(const IndexPair<TG,TL>&, const TG&);
    \n+
    70
    \n+
    71 template<class TG, class TL>
    \n+
    72 bool operator<=(const IndexPair<TG,TL>&, const TG&);
    \n+
    73
    \n+
    74 template<class TG, class TL>
    \n+
    75 bool operator >=(const IndexPair<TG,TL>&, const TG&);
    \n+
    76
    \n+
    77 template<typename T>
    \n+
    78 struct MPITraits;
    \n+
    79
    \n+
    83 template<class TG, class TL>
    \n+\n+
    85 {
    \n+
    86 friend std::ostream& operator<<<>(std::ostream&, const IndexPair<TG,TL>&);
    \n+
    87 friend bool operator==<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    88 friend bool operator!=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    89 friend bool operator< <>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    90 friend bool operator><>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    91 friend bool operator<=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    92 friend bool operator>=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
    \n+
    93 friend bool operator==<>(const IndexPair<TG,TL>&, const TG &);
    \n+
    94 friend bool operator!=<>(const IndexPair<TG,TL>&, const TG &);
    \n+
    95 friend bool operator< <>(const IndexPair<TG,TL>&, const TG &);
    \n+
    96 friend bool operator> <>(const IndexPair<TG,TL>&, const TG &);
    \n+
    97 friend bool operator<=<>(const IndexPair<TG,TL>&, const TG &);
    \n+
    98 friend bool operator>=<>(const IndexPair<TG,TL>&, const TG &);
    \n+
    99 friend struct MPITraits<IndexPair<TG,TL> >;
    \n+
    100
    \n+
    101 public:
    \n+
    107 typedef TG GlobalIndex;
    \n+
    108
    \n+
    120 typedef TL LocalIndex;
    \n+
    121
    \n+\n+
    129
    \n+\n+\n
    141
    \n-
    142namespace Impl {
    \n-
    143
    \n-
    144 template<class Begin, class End,
    \n-
    145 std::enable_if_t<IsIntegralConstant<Begin>::value and IsIntegralConstant<End>::value, int> = 0>
    \n-
    146 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/, const PriorityTag<1>&)
    \n-
    147 {
    \n-
    148 static_assert(Begin::value <= End::value, "You cannot create an integralRange where end<begin");
    \n-\n-
    150 }
    \n-
    151
    \n-
    152 // This should be constexpr but gcc-4.9 does not support
    \n-
    153 // the relaxed constexpr requirements. Hence for being
    \n-
    154 // constexpr the function body can only contain a return
    \n-
    155 // statement and no assertion before this.
    \n-
    156 template<class Begin, class End>
    \n-
    157 constexpr auto integralRange(const Begin& begin, const End& end, const PriorityTag<0>&)
    \n-
    158 {
    \n-
    159 return DUNE_ASSERT_AND_RETURN(begin<=end, Dune::IntegralRange<End>(begin, end));
    \n-
    160 }
    \n-
    161
    \n-
    162} // namespace Impl
    \n-
    163
    \n-
    164
    \n-
    165
    \n-
    183template<class Begin, class End>
    \n-
    184constexpr auto integralRange(const Begin& begin, const End& end)
    \n-
    185{
    \n-
    186 return Impl::integralRange(begin, end, PriorityTag<42>());
    \n-
    187}
    \n-
    188
    \n-
    202template<class End>
    \n-
    203constexpr auto integralRange(const End& end)
    \n-
    204{
    \n-\n-
    206}
    \n-
    207
    \n-
    208
    \n+
    147 inline const GlobalIndex& global() const;
    \n+
    148
    \n+
    154 inline LocalIndex& local();
    \n+
    155
    \n+
    161 inline const LocalIndex& local() const;
    \n+
    162
    \n+
    168 inline void setLocal(int index);
    \n+
    169 private:
    \n+
    171 GlobalIndex global_;
    \n+\n+
    174 };
    \n+
    175
    \n+\n+
    181 {
    \n+\n+
    190 RESIZE
    \n+
    200 };
    \n+
    201
    \n+\n+
    206
    \n+
    207 // Forward declaration
    \n+
    208 template<class I> class GlobalLookupIndexSet;
    \n
    209
    \n-
    210namespace Impl {
    \n-
    211
    \n-
    212 template<class T>
    \n-
    213 constexpr void evaluateFoldExpression(std::initializer_list<T>&&)
    \n-
    214 {}
    \n-
    215
    \n-
    216 template<class Range, class F, class Index, Index... i>
    \n-
    217 constexpr void forEachIndex(Range&& range, F&& f, std::integer_sequence<Index, i...>)
    \n+
    216 template<typename TG, typename TL, int N=100>
    \n+\n
    218 {
    \n-
    219 evaluateFoldExpression<int>({(f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)...});
    \n-
    220 }
    \n-
    221
    \n-
    222 template<class F, class Index, Index... i>
    \n-
    223 constexpr void forEach(std::integer_sequence<Index, i...> /*range*/, F&& f, PriorityTag<2>)
    \n-
    224 {
    \n-
    225 evaluateFoldExpression<int>({(f(std::integral_constant<Index,i>()), 0)...});
    \n-
    226 }
    \n+
    219 friend class GlobalLookupIndexSet<ParallelIndexSet<TG,TL,N> >;
    \n+
    220
    \n+
    221 public:
    \n+
    226 typedef TG GlobalIndex;
    \n
    227
    \n-
    228
    \n-
    229 template<class Range, class F,
    \n-
    230 std::enable_if_t<IsIntegralConstant<decltype(Hybrid::size(std::declval<Range>()))>::value, int> = 0>
    \n-
    231 constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)
    \n-
    232 {
    \n-
    233 auto size = Hybrid::size(range);
    \n-
    234 auto indices = std::make_index_sequence<size>();
    \n-
    235 (forEachIndex)(std::forward<Range>(range), std::forward<F>(f), indices);
    \n-
    236 }
    \n-
    237
    \n-
    238 template<class Range, class F>
    \n-
    239 constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)
    \n-
    240 {
    \n-
    241 for(auto&& e : range)
    \n-
    242 f(e);
    \n-
    243 }
    \n-
    244
    \n-
    245} // namespace Impl
    \n-
    246
    \n-
    247
    \n-
    248
    \n-
    267template<class Range, class F>
    \n-
    268constexpr void forEach(Range&& range, F&& f)
    \n-
    269{
    \n-
    270 Impl::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>());
    \n-
    271}
    \n-
    272
    \n-
    273
    \n-
    274
    \n-
    290template<class Range, class T, class F>
    \n-
    291constexpr T accumulate(Range&& range, T value, F&& f)
    \n-
    292{
    \n-
    293 forEach(std::forward<Range>(range), [&](auto&& entry) {
    \n-
    294 value = f(value, entry);
    \n-
    295 });
    \n-
    296 return value;
    \n-
    297}
    \n-
    298
    \n-
    299
    \n-
    300
    \n-
    301namespace Impl {
    \n+
    239 typedef TL LocalIndex;
    \n+
    240
    \n+\n+
    245
    \n+
    252 constexpr static int arraySize = (N>0) ? N : 1;
    \n+
    253
    \n+
    255 class iterator :
    \n+
    256 public ArrayList<IndexPair,N>::iterator
    \n+
    257 {
    \n+
    258 typedef typename ArrayList<IndexPair,N>::iterator
    \n+\n+\n+
    261 public:
    \n+
    262 iterator(ParallelIndexSet<TG,TL,N>& indexSet, const Father& father)
    \n+
    263 : Father(father), indexSet_(&indexSet)
    \n+
    264 {}
    \n+
    265
    \n+
    266 private:
    \n+
    276 inline void markAsDeleted() const
    \n+
    277 {
    \n+
    278#ifndef NDEBUG
    \n+
    279 if(indexSet_->state_ != RESIZE)
    \n+
    280 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
    \n+
    281 <<"while in RESIZE state!");
    \n+
    282#endif
    \n+
    283 Father::operator*().local().setState(DELETED);
    \n+
    284 }
    \n+
    285
    \n+
    287 ParallelIndexSet<TG,TL,N>* indexSet_;
    \n+
    288
    \n+
    289 };
    \n+
    290
    \n+
    291
    \n+
    292
    \n+
    294 typedef typename
    \n+\n+\n+
    297
    \n+\n
    302
    \n-
    303 struct Id {
    \n-
    304 template<class T>
    \n-
    305 constexpr T operator()(T&& x) const {
    \n-
    306 return std::forward<T>(x);
    \n-
    307 }
    \n-
    308 };
    \n-
    309
    \n-
    310 template<class IfFunc, class ElseFunc>
    \n-
    311 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc, ElseFunc&& /*elseFunc*/)
    \n-
    312 {
    \n-
    313 return ifFunc(Id{});
    \n-
    314 }
    \n-
    315
    \n-
    316 template<class IfFunc, class ElseFunc>
    \n-
    317 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/, ElseFunc&& elseFunc)
    \n-
    318 {
    \n-
    319 return elseFunc(Id{});
    \n-
    320 }
    \n-
    321
    \n-
    322 template<class IfFunc, class ElseFunc>
    \n-
    323 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
    \n-
    324 {
    \n-
    325 if (condition)
    \n-
    326 return ifFunc(Id{});
    \n-
    327 else
    \n-
    328 return elseFunc(Id{});
    \n-
    329 }
    \n-
    330
    \n-
    331} // namespace Impl
    \n-
    332
    \n-
    333
    \n-
    334
    \n-
    355template<class Condition, class IfFunc, class ElseFunc>
    \n-
    356decltype(auto) ifElse(const Condition& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
    \n-
    357{
    \n-
    358 return Impl::ifElse(condition, std::forward<IfFunc>(ifFunc), std::forward<ElseFunc>(elseFunc));
    \n-
    359}
    \n-
    360
    \n-
    368template<class Condition, class IfFunc>
    \n-
    369void ifElse(const Condition& condition, IfFunc&& ifFunc)
    \n-
    370{
    \n-
    371 ifElse(condition, std::forward<IfFunc>(ifFunc), [](auto&&) {});
    \n-
    372}
    \n-
    373
    \n+\n+
    308 {
    \n+
    309 return state_;
    \n+
    310 }
    \n+
    311
    \n+\n+
    318
    \n+
    327 inline void add(const GlobalIndex& global);
    \n+
    328
    \n+
    337 inline void add(const GlobalIndex& global, const LocalIndex& local);
    \n+
    338
    \n+
    346 inline void markAsDeleted(const iterator& position);
    \n+
    347
    \n+
    360 void endResize();
    \n+
    361
    \n+
    372 inline IndexPair&
    \n+
    373 operator[](const GlobalIndex& global);
    \n
    374
    \n-
    375
    \n-
    376namespace Impl {
    \n-
    377
    \n-
    378 template<class T1, class T2>
    \n-
    379 constexpr auto equals(const T1& /*t1*/, const T2& /*t2*/, PriorityTag<1>) -> decltype(T1::value, T2::value, std::integral_constant<bool,T1::value == T2::value>())
    \n-
    380 { return {}; }
    \n-
    381
    \n-
    382 template<class T1, class T2>
    \n-
    383 constexpr auto equals(const T1& t1, const T2& t2, PriorityTag<0>)
    \n-
    384 {
    \n-
    385 return t1==t2;
    \n-
    386 }
    \n-
    387
    \n-
    388} // namespace Impl
    \n-
    389
    \n-
    390
    \n-
    391
    \n-
    401template<class T1, class T2>
    \n-
    402constexpr auto equals(T1&& t1, T2&& t2)
    \n-
    403{
    \n-
    404 return Impl::equals(std::forward<T1>(t1), std::forward<T2>(t2), PriorityTag<1>());
    \n-
    405}
    \n-
    406
    \n-
    407
    \n-
    408
    \n-
    409namespace Impl {
    \n-
    410
    \n-
    411 template<class Result, class T, class Value, class Branches, class ElseBranch>
    \n-
    412 constexpr Result switchCases(std::integer_sequence<T>, const Value& /*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch)
    \n-
    413 {
    \n-
    414 return elseBranch();
    \n-
    415 }
    \n-
    416
    \n-
    417 template<class Result, class T, T t0, T... tt, class Value, class Branches, class ElseBranch>
    \n-
    418 constexpr Result switchCases(std::integer_sequence<T, t0, tt...>, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
    \n-
    419 {
    \n-
    420 return ifElse(
    \n-
    421 Hybrid::equals(std::integral_constant<T, t0>(), value),
    \n-
    422 [&](auto id) -> decltype(auto) {
    \n-
    423 return id(branches)(std::integral_constant<T, t0>());
    \n-
    424 }, [&](auto id) -> decltype(auto) {
    \n-
    425 return Impl::switchCases<Result>(id(std::integer_sequence<T, tt...>()), value, branches, elseBranch);
    \n-
    426 });
    \n-
    427 }
    \n-
    428
    \n-
    429} // namespace Impl
    \n-
    430
    \n-
    431
    \n-
    432
    \n-
    460template<class Cases, class Value, class Branches, class ElseBranch>
    \n-
    461constexpr decltype(auto) switchCases(const Cases& cases, const Value& value, Branches&& branches, ElseBranch&& elseBranch)
    \n-
    462{
    \n-
    463 return Impl::switchCases<decltype(elseBranch())>(cases, value, std::forward<Branches>(branches), std::forward<ElseBranch>(elseBranch));
    \n-
    464}
    \n-
    465
    \n-
    486template<class Cases, class Value, class Branches>
    \n-
    487constexpr void switchCases(const Cases& cases, const Value& value, Branches&& branches)
    \n-
    488{
    \n-
    489 Impl::switchCases<void>(cases, value, std::forward<Branches>(branches), []() {});
    \n-
    490}
    \n+
    384 inline IndexPair&
    \n+
    385 at(const GlobalIndex& global);
    \n+
    386
    \n+
    396 inline bool
    \n+
    397 exists (const GlobalIndex& global) const;
    \n+
    398
    \n+
    409 inline const IndexPair&
    \n+
    410 operator[](const GlobalIndex& global) const;
    \n+
    411
    \n+
    421 inline const IndexPair&
    \n+
    422 at(const GlobalIndex& global) const;
    \n+
    423
    \n+
    428 inline iterator begin();
    \n+
    429
    \n+
    434 inline iterator end();
    \n+
    435
    \n+
    440 inline const_iterator begin() const;
    \n+
    441
    \n+
    446 inline const_iterator end() const;
    \n+
    447
    \n+
    457 inline void renumberLocal();
    \n+
    458
    \n+
    465 inline int seqNo() const;
    \n+
    466
    \n+
    471 inline size_t size() const;
    \n+
    472
    \n+
    473 private:
    \n+
    475 ArrayList<IndexPair,N> localIndices_;
    \n+
    477 ArrayList<IndexPair,N> newIndices_;
    \n+\n+
    481 int seqNo_;
    \n+
    483 bool deletedEntries_;
    \n+
    488 inline void merge();
    \n+
    489 };
    \n+
    490
    \n
    491
    \n-
    492
    \n-
    493} // namespace Hybrid
    \n-
    494} // namespace Dune
    \n-
    495
    \n-
    496
    \n-
    497#endif // #ifndef DUNE_COMMON_HYBRIDUTILITIES_HH
    \n-
    Utilities for type computations, constraining overloads, ...
    \n-\n-
    Implements a vector constructed from a given type representing a field and a compile-time given size.
    \n-
    Utilities for reduction like operations on ranges.
    \n-\n-
    Traits for type conversions and type information.
    \n-
    constexpr index_constant< 0 > _0
    Compile time index with value 0.
    Definition: indices.hh:53
    \n-
    static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
    Definition: rangeutilities.hh:300
    \n-
    void ifElse(const Condition &condition, IfFunc &&ifFunc)
    A conditional expression.
    Definition: hybridutilities.hh:369
    \n-
    constexpr auto size(const T &t)
    Size query.
    Definition: hybridutilities.hh:82
    \n-
    constexpr auto integralRange(const End &end)
    Create an integral range starting from 0.
    Definition: hybridutilities.hh:203
    \n-
    constexpr auto equals(T1 &&t1, T2 &&t2)
    Equality comparison.
    Definition: hybridutilities.hh:402
    \n-
    constexpr void forEach(Range &&range, F &&f)
    Range based for loop.
    Definition: hybridutilities.hh:268
    \n-
    constexpr decltype(auto) switchCases(const Cases &cases, const Value &value, Branches &&branches, ElseBranch &&elseBranch)
    Switch statement.
    Definition: hybridutilities.hh:461
    \n-
    decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
    A conditional expression.
    Definition: hybridutilities.hh:356
    \n-
    constexpr auto integralRange(const Begin &begin, const End &end)
    Create an integral range.
    Definition: hybridutilities.hh:184
    \n-
    constexpr decltype(auto) elementAt(Container &&c, Index &&i)
    Get element at given position from container.
    Definition: hybridutilities.hh:135
    \n-
    constexpr T accumulate(Range &&range, T value, F &&f)
    Accumulate values.
    Definition: hybridutilities.hh:291
    \n-
    constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::integral_constant< std::size_t, index > i)
    Get entry of std::integer_sequence.
    Definition: typetraits.hh:462
    \n-
    #define DUNE_ASSERT_AND_RETURN(C, X)
    Asserts a condition and return on success in constexpr context.
    Definition: assertandreturn.hh:22
    \n+
    497 template<class TG, class TL, int N>
    \n+
    498 std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet);
    \n+
    499
    \n+
    505 template<class I>
    \n+\n+
    507 {
    \n+
    508 public:
    \n+\n+
    513
    \n+\n+
    518
    \n+\n+
    523
    \n+\n+
    528
    \n+\n+
    530
    \n+
    537 GlobalLookupIndexSet(const ParallelIndexSet& indexset, std::size_t size);
    \n+
    538
    \n+\n+
    545
    \n+\n+
    550
    \n+
    560 inline const IndexPair&
    \n+
    561 operator[](const GlobalIndex& global) const;
    \n+
    562
    \n+
    566 inline const IndexPair*
    \n+
    567 pair(const std::size_t& local) const;
    \n+
    568
    \n+
    573 inline const_iterator begin() const;
    \n+
    574
    \n+
    579 inline const_iterator end() const;
    \n+
    580
    \n+
    587 inline int seqNo() const;
    \n+
    588
    \n+
    593 inline size_t size() const;
    \n+
    594 private:
    \n+
    598 const ParallelIndexSet& indexSet_;
    \n+
    599
    \n+
    603 std::size_t size_;
    \n+
    604
    \n+
    608 std::vector<const IndexPair*> indices_;
    \n+
    609
    \n+
    610 };
    \n+
    611
    \n+
    612
    \n+
    613 template<typename T>
    \n+\n+
    615 {
    \n+
    616 static bool compare([[maybe_unused]] const T& t1, [[maybe_unused]] const T& t2)
    \n+
    617 {
    \n+
    618 return false;
    \n+
    619 }
    \n+
    620 };
    \n+
    621
    \n+
    622 template<class TG, class TL>
    \n+\n+
    624 {
    \n+\n+
    626 {
    \n+
    627 return i1.global()<i2.global() || (i1.global()==i2.global() &&
    \n+\n+
    629 i2.local()));
    \n+
    630 }
    \n+
    631 };
    \n+
    632
    \n+
    633
    \n+
    634
    \n+
    635 template<class TG, class TL>
    \n+
    636 inline std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair)
    \n+
    637 {
    \n+
    638 os<<"{global="<<pair.global_<<", local="<<pair.local_<<"}";
    \n+
    639 return os;
    \n+
    640 }
    \n+
    641
    \n+
    642 template<class TG, class TL, int N>
    \n+
    643 inline std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet)
    \n+
    644 {
    \n+
    645 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iterator;
    \n+
    646 Iterator end = indexSet.end();
    \n+
    647 os<<"{";
    \n+
    648 for(Iterator index = indexSet.begin(); index != end; ++index)
    \n+
    649 os<<*index<<" ";
    \n+
    650 os<<"}";
    \n+
    651 return os;
    \n+
    652
    \n+
    653 }
    \n+
    654
    \n+
    655 template<class TG, class TL>
    \n+
    656 inline bool operator==(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
    \n+
    657 {
    \n+
    658 return a.global_==b.global_;
    \n+
    659 }
    \n+
    660
    \n+
    661 template<class TG, class TL>
    \n+
    662 inline bool operator!=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
    \n+
    663 {
    \n+
    664 return a.global_!=b.global_;
    \n+
    665 }
    \n+
    666
    \n+
    667 template<class TG, class TL>
    \n+
    668 inline bool operator<(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
    \n+
    669 {
    \n+
    670 return a.global_<b.global_;
    \n+
    671 }
    \n+
    672
    \n+
    673 template<class TG, class TL>
    \n+
    674 inline bool operator>(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
    \n+
    675 {
    \n+
    676 return a.global_>b.global_;
    \n+
    677 }
    \n+
    678
    \n+
    679 template<class TG, class TL>
    \n+
    680 inline bool operator<=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
    \n+
    681 {
    \n+
    682 return a.global_<=b.global_;
    \n+
    683 }
    \n+
    684
    \n+
    685 template<class TG, class TL>
    \n+
    686 inline bool operator >=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
    \n+
    687 {
    \n+
    688 return a.global_>=b.global_;
    \n+
    689 }
    \n+
    690
    \n+
    691 template<class TG, class TL>
    \n+
    692 inline bool operator==(const IndexPair<TG,TL>& a, const TG& b)
    \n+
    693 {
    \n+
    694 return a.global_==b;
    \n+
    695 }
    \n+
    696
    \n+
    697 template<class TG, class TL>
    \n+
    698 inline bool operator!=(const IndexPair<TG,TL>& a, const TG& b)
    \n+
    699 {
    \n+
    700 return a.global_!=b;
    \n+
    701 }
    \n+
    702
    \n+
    703 template<class TG, class TL>
    \n+
    704 inline bool operator<(const IndexPair<TG,TL>& a, const TG& b)
    \n+
    705 {
    \n+
    706 return a.global_<b;
    \n+
    707 }
    \n+
    708
    \n+
    709 template<class TG, class TL>
    \n+
    710 inline bool operator>(const IndexPair<TG,TL>& a, const TG& b)
    \n+
    711 {
    \n+
    712 return a.global_>b;
    \n+
    713 }
    \n+
    714
    \n+
    715 template<class TG, class TL>
    \n+
    716 inline bool operator<=(const IndexPair<TG,TL>& a, const TG& b)
    \n+
    717 {
    \n+
    718 return a.global_<=b;
    \n+
    719 }
    \n+
    720
    \n+
    721 template<class TG, class TL>
    \n+
    722 inline bool operator >=(const IndexPair<TG,TL>& a, const TG& b)
    \n+
    723 {
    \n+
    724 return a.global_>=b;
    \n+
    725 }
    \n+
    726
    \n+
    727#ifndef DOXYGEN
    \n+
    728
    \n+
    729 template<class TG, class TL>
    \n+
    730 IndexPair<TG,TL>::IndexPair(const TG& global, const TL& local)
    \n+
    731 : global_(global), local_(local){}
    \n+
    732
    \n+
    733 template<class TG, class TL>
    \n+
    734 IndexPair<TG,TL>::IndexPair(const TG& global)
    \n+
    735 : global_(global), local_(){}
    \n+
    736
    \n+
    737 template<class TG, class TL>
    \n+\n+
    739 : global_(), local_(){}
    \n+
    740
    \n+
    741 template<class TG, class TL>
    \n+
    742 inline const TG& IndexPair<TG,TL>::global() const {
    \n+
    743 return global_;
    \n+
    744 }
    \n+
    745
    \n+
    746 template<class TG, class TL>
    \n+
    747 inline TL& IndexPair<TG,TL>::local() {
    \n+
    748 return local_;
    \n+
    749 }
    \n+
    750
    \n+
    751 template<class TG, class TL>
    \n+
    752 inline const TL& IndexPair<TG,TL>::local() const {
    \n+
    753 return local_;
    \n+
    754 }
    \n+
    755
    \n+
    756 template<class TG, class TL>
    \n+
    757 inline void IndexPair<TG,TL>::setLocal(int local){
    \n+
    758 local_=local;
    \n+
    759 }
    \n+
    760
    \n+
    761 template<class TG, class TL, int N>
    \n+\n+
    763 : state_(GROUND), seqNo_(0), deletedEntries_()
    \n+
    764 {}
    \n+
    765
    \n+
    766 template<class TG, class TL, int N>
    \n+\n+
    768 {
    \n+
    769
    \n+
    770 // Checks in unproductive code
    \n+
    771#ifndef NDEBUG
    \n+
    772 if(state_!=GROUND)
    \n+
    773 DUNE_THROW(InvalidIndexSetState,
    \n+
    774 "IndexSet has to be in GROUND state, when "
    \n+
    775 << "beginResize() is called!");
    \n+
    776#endif
    \n+
    777
    \n+
    778 state_ = RESIZE;
    \n+
    779 deletedEntries_ = false;
    \n+
    780 }
    \n+
    781
    \n+
    782 template<class TG, class TL, int N>
    \n+
    783 inline void ParallelIndexSet<TG,TL,N>::add(const GlobalIndex& global)
    \n+
    784 {
    \n+
    785 // Checks in unproductive code
    \n+
    786#ifndef NDEBUG
    \n+
    787 if(state_ != RESIZE)
    \n+
    788 DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
    \n+
    789 <<"while in RESIZE state!");
    \n+
    790#endif
    \n+
    791 newIndices_.push_back(IndexPair(global));
    \n+
    792 }
    \n+
    793
    \n+
    794 template<class TG, class TL, int N>
    \n+
    795 inline void ParallelIndexSet<TG,TL,N>::add(const TG& global, const TL& local)
    \n+
    796 {
    \n+
    797 // Checks in unproductive code
    \n+
    798#ifndef NDEBUG
    \n+
    799 if(state_ != RESIZE)
    \n+
    800 DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
    \n+
    801 <<"while in RESIZE state!");
    \n+
    802#endif
    \n+
    803 newIndices_.push_back(IndexPair(global,local));
    \n+
    804 }
    \n+
    805
    \n+
    806 template<class TG, class TL, int N>
    \n+
    807 inline void ParallelIndexSet<TG,TL,N>::markAsDeleted(const iterator& global)
    \n+
    808 {
    \n+
    809 // Checks in unproductive code
    \n+
    810#ifndef NDEBUG
    \n+
    811 if(state_ != RESIZE)
    \n+
    812 DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
    \n+
    813 <<"while in RESIZE state!");
    \n+
    814#endif
    \n+
    815 deletedEntries_ = true;
    \n+
    816
    \n+
    817 global.markAsDeleted();
    \n+
    818 }
    \n+
    819
    \n+
    820 template<class TG, class TL, int N>
    \n+\n+
    822 // Checks in unproductive code
    \n+
    823#ifndef NDEBUG
    \n+
    824 if(state_ != RESIZE)
    \n+
    825 DUNE_THROW(InvalidIndexSetState, "endResize called while not "
    \n+
    826 <<"in RESIZE state!");
    \n+
    827#endif
    \n+
    828
    \n+
    829 std::sort(newIndices_.begin(), newIndices_.end(), IndexSetSortFunctor<TG,TL>());
    \n+
    830 merge();
    \n+
    831 seqNo_++;
    \n+
    832 state_ = GROUND;
    \n+
    833 }
    \n+
    834
    \n+
    835
    \n+
    836 template<class TG, class TL, int N>
    \n+
    837 inline void ParallelIndexSet<TG,TL,N>::merge(){
    \n+
    838 if(localIndices_.size()==0)
    \n+
    839 {
    \n+
    840 localIndices_=newIndices_;
    \n+
    841 newIndices_.clear();
    \n+
    842 }
    \n+
    843 else if(newIndices_.size()>0 || deletedEntries_)
    \n+
    844 {
    \n+
    845 ArrayList<IndexPair,N> tempPairs;
    \n+
    846
    \n+
    847 auto old = localIndices_.begin();
    \n+
    848 auto added = newIndices_.begin();
    \n+
    849 const auto endold = localIndices_.end();
    \n+
    850 const auto endadded = newIndices_.end();
    \n+
    851
    \n+
    852 while(old != endold && added!= endadded)
    \n+
    853 {
    \n+
    854 if(old->local().state()==DELETED) {
    \n+
    855 old.eraseToHere();
    \n+
    856 }
    \n+
    857 else
    \n+
    858 {
    \n+
    859 if(old->global() < added->global() ||
    \n+
    860 (old->global() == added->global()
    \n+
    861 && LocalIndexComparator<TL>::compare(old->local(),added->local())))
    \n+
    862 {
    \n+
    863 tempPairs.push_back(*old);
    \n+
    864 old.eraseToHere();
    \n+
    865 continue;
    \n+
    866 }else
    \n+
    867 {
    \n+
    868 tempPairs.push_back(*added);
    \n+
    869 added.eraseToHere();
    \n+
    870 }
    \n+
    871 }
    \n+
    872 }
    \n+
    873
    \n+
    874 while(old != endold)
    \n+
    875 {
    \n+
    876 if(old->local().state()!=DELETED) {
    \n+
    877 tempPairs.push_back(*old);
    \n+
    878 }
    \n+
    879 old.eraseToHere();
    \n+
    880 }
    \n+
    881
    \n+
    882 while(added!= endadded)
    \n+
    883 {
    \n+
    884 tempPairs.push_back(*added);
    \n+
    885 added.eraseToHere();
    \n+
    886 }
    \n+
    887 localIndices_ = tempPairs;
    \n+
    888 }
    \n+
    889 }
    \n+
    890
    \n+
    891
    \n+
    892 template<class TG, class TL, int N>
    \n+
    893 inline const IndexPair<TG,TL>&
    \n+
    894 ParallelIndexSet<TG,TL,N>::at(const TG& global) const
    \n+
    895 {
    \n+
    896 // perform a binary search
    \n+
    897 int low=0, high=localIndices_.size()-1, probe=-1;
    \n+
    898
    \n+
    899 while(low<high)
    \n+
    900 {
    \n+
    901 probe = (high + low) / 2;
    \n+
    902 if(global <= localIndices_[probe].global())
    \n+
    903 high = probe;
    \n+
    904 else
    \n+
    905 low = probe+1;
    \n+
    906 }
    \n+
    907
    \n+
    908 if(probe==-1)
    \n+
    909 DUNE_THROW(RangeError, "No entries!");
    \n+
    910
    \n+
    911 if( localIndices_[low].global() != global)
    \n+
    912 DUNE_THROW(RangeError, "Could not find entry of "<<global);
    \n+
    913 else
    \n+
    914 return localIndices_[low];
    \n+
    915 }
    \n+
    916
    \n+
    917 template<class TG, class TL, int N>
    \n+
    918 inline const IndexPair<TG,TL>&
    \n+
    919 ParallelIndexSet<TG,TL,N>::operator[](const TG& global) const
    \n+
    920 {
    \n+
    921 // perform a binary search
    \n+
    922 int low=0, high=localIndices_.size()-1, probe=-1;
    \n+
    923
    \n+
    924 while(low<high)
    \n+
    925 {
    \n+
    926 probe = (high + low) / 2;
    \n+
    927 if(global <= localIndices_[probe].global())
    \n+
    928 high = probe;
    \n+
    929 else
    \n+
    930 low = probe+1;
    \n+
    931 }
    \n+
    932
    \n+
    933 return localIndices_[low];
    \n+
    934 }
    \n+
    935 template<class TG, class TL, int N>
    \n+
    936 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::at(const TG& global)
    \n+
    937 {
    \n+
    938 // perform a binary search
    \n+
    939 int low=0, high=localIndices_.size()-1, probe=-1;
    \n+
    940
    \n+
    941 while(low<high)
    \n+
    942 {
    \n+
    943 probe = (high + low) / 2;
    \n+
    944 if(localIndices_[probe].global() >= global)
    \n+
    945 high = probe;
    \n+
    946 else
    \n+
    947 low = probe+1;
    \n+
    948 }
    \n+
    949
    \n+
    950 if(probe==-1)
    \n+
    951 DUNE_THROW(RangeError, "No entries!");
    \n+
    952
    \n+
    953 if( localIndices_[low].global() != global)
    \n+
    954 DUNE_THROW(RangeError, "Could not find entry of "<<global);
    \n+
    955 else
    \n+
    956 return localIndices_[low];
    \n+
    957 }
    \n+
    958
    \n+
    959 template<class TG, class TL, int N>
    \n+
    960 inline bool ParallelIndexSet<TG,TL,N>::exists (const TG& global) const
    \n+
    961 {
    \n+
    962 // perform a binary search
    \n+
    963 int low=0, high=localIndices_.size()-1, probe=-1;
    \n+
    964
    \n+
    965 while(low<high)
    \n+
    966 {
    \n+
    967 probe = (high + low) / 2;
    \n+
    968 if(localIndices_[probe].global() >= global)
    \n+
    969 high = probe;
    \n+
    970 else
    \n+
    971 low = probe+1;
    \n+
    972 }
    \n+
    973
    \n+
    974 if(probe==-1)
    \n+
    975 return false;
    \n+
    976
    \n+
    977 if( localIndices_[low].global() != global)
    \n+
    978 return false;
    \n+
    979 return true;
    \n+
    980 }
    \n+
    981
    \n+
    982 template<class TG, class TL, int N>
    \n+
    983 inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::operator[](const TG& global)
    \n+
    984 {
    \n+
    985 // perform a binary search
    \n+
    986 int low=0, high=localIndices_.size()-1, probe=-1;
    \n+
    987
    \n+
    988 while(low<high)
    \n+
    989 {
    \n+
    990 probe = (high + low) / 2;
    \n+
    991 if(localIndices_[probe].global() >= global)
    \n+
    992 high = probe;
    \n+
    993 else
    \n+
    994 low = probe+1;
    \n+
    995 }
    \n+
    996
    \n+
    997 return localIndices_[low];
    \n+
    998 }
    \n+
    999 template<class TG, class TL, int N>
    \n+
    1000 inline typename ParallelIndexSet<TG,TL,N>::iterator
    \n+\n+
    1002 {
    \n+
    1003 return iterator(*this, localIndices_.begin());
    \n+
    1004 }
    \n+
    1005
    \n+
    1006
    \n+
    1007 template<class TG, class TL, int N>
    \n+
    1008 inline typename ParallelIndexSet<TG,TL,N>::iterator
    \n+\n+
    1010 {
    \n+
    1011 return iterator(*this,localIndices_.end());
    \n+
    1012 }
    \n+
    1013
    \n+
    1014 template<class TG, class TL, int N>
    \n+\n+\n+
    1017 {
    \n+
    1018 return localIndices_.begin();
    \n+
    1019 }
    \n+
    1020
    \n+
    1021
    \n+
    1022 template<class TG, class TL, int N>
    \n+\n+\n+
    1025 {
    \n+
    1026 return localIndices_.end();
    \n+
    1027 }
    \n+
    1028
    \n+
    1029 template<class TG, class TL, int N>
    \n+\n+
    1031#ifndef NDEBUG
    \n+
    1032 if(state_==RESIZE)
    \n+
    1033 DUNE_THROW(InvalidIndexSetState, "IndexSet has to be in "
    \n+
    1034 <<"GROUND state for renumberLocal()");
    \n+
    1035#endif
    \n+
    1036
    \n+
    1037 const auto end_ = end();
    \n+
    1038 uint32_t index=0;
    \n+
    1039
    \n+
    1040 for(auto pair=begin(); pair!=end_; index++, ++pair)
    \n+
    1041 pair->local()=index;
    \n+
    1042 }
    \n+
    1043
    \n+
    1044 template<class TG, class TL, int N>
    \n+
    1045 inline int ParallelIndexSet<TG,TL,N>::seqNo() const
    \n+
    1046 {
    \n+
    1047 return seqNo_;
    \n+
    1048 }
    \n+
    1049
    \n+
    1050 template<class TG, class TL, int N>
    \n+
    1051 inline size_t ParallelIndexSet<TG,TL,N>::size() const
    \n+
    1052 {
    \n+
    1053 return localIndices_.size();
    \n+
    1054 }
    \n+
    1055
    \n+
    1056 template<class I>
    \n+
    1057 GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset,
    \n+
    1058 std::size_t size)
    \n+
    1059 : indexSet_(indexset), size_(size),
    \n+
    1060 indices_(size_, static_cast<const IndexPair*>(0))
    \n+
    1061 {
    \n+
    1062 const_iterator end_ = indexSet_.end();
    \n+
    1063
    \n+
    1064 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) {
    \n+
    1065 assert(pair->local()<size_);
    \n+
    1066 indices_[pair->local()] = &(*pair);
    \n+
    1067 }
    \n+
    1068 }
    \n+
    1069
    \n+
    1070 template<class I>
    \n+\n+
    1072 : indexSet_(indexset), size_(0)
    \n+
    1073 {
    \n+
    1074 const_iterator end_ = indexSet_.end();
    \n+
    1075 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
    \n+
    1076 size_=std::max(size_,static_cast<std::size_t>(pair->local()));
    \n+
    1077
    \n+
    1078 indices_.resize(++size_, 0);
    \n+
    1079
    \n+
    1080 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
    \n+
    1081 indices_[pair->local()] = &(*pair);
    \n+
    1082 }
    \n+
    1083
    \n+
    1084 template<class I>
    \n+\n+
    1086 {}
    \n+
    1087
    \n+
    1088 template<class I>
    \n+
    1089 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>*
    \n+
    1090 GlobalLookupIndexSet<I>::pair(const std::size_t& local) const
    \n+
    1091 {
    \n+
    1092 return indices_[local];
    \n+
    1093 }
    \n+
    1094
    \n+
    1095 template<class I>
    \n+
    1096 inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>&
    \n+
    1097 GlobalLookupIndexSet<I>::operator[](const GlobalIndex& global) const
    \n+
    1098 {
    \n+
    1099 return indexSet_[global];
    \n+
    1100 }
    \n+
    1101
    \n+
    1102 template<class I>
    \n+
    1103 typename I::const_iterator GlobalLookupIndexSet<I>::begin() const
    \n+
    1104 {
    \n+
    1105 return indexSet_.begin();
    \n+
    1106 }
    \n+
    1107
    \n+
    1108 template<class I>
    \n+
    1109 typename I::const_iterator GlobalLookupIndexSet<I>::end() const
    \n+
    1110 {
    \n+
    1111 return indexSet_.end();
    \n+
    1112 }
    \n+
    1113
    \n+
    1114 template<class I>
    \n+
    1115 inline size_t GlobalLookupIndexSet<I>::size() const
    \n+
    1116 {
    \n+
    1117 return size_;
    \n+
    1118 }
    \n+
    1119
    \n+
    1120 template<class I>
    \n+
    1121 inline int GlobalLookupIndexSet<I>::seqNo() const
    \n+
    1122 {
    \n+
    1123 return indexSet_.seqNo();
    \n+
    1124 }
    \n+
    1125
    \n+
    1126 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
    \n+
    1127 bool operator==(const ParallelIndexSet<TG,TL,N>& idxset,
    \n+
    1128 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
    \n+
    1129 {
    \n+
    1130 if(idxset.size()!=idxset1.size())
    \n+
    1131 return false;
    \n+
    1132 typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iter;
    \n+
    1133 typedef typename ParallelIndexSet<TG1,TL1,N1>::const_iterator Iter1;
    \n+
    1134 Iter iter=idxset.begin();
    \n+
    1135 for(Iter1 iter1=idxset1.begin(); iter1 != idxset1.end(); ++iter, ++iter1) {
    \n+
    1136 if(iter1->global()!=iter->global())
    \n+
    1137 return false;
    \n+
    1138 typedef typename ParallelIndexSet<TG,TL,N>::LocalIndex PI;
    \n+
    1139 const PI& pi=iter->local(), pi1=iter1->local();
    \n+
    1140
    \n+
    1141 if(pi!=pi1)
    \n+
    1142 return false;
    \n+
    1143 }
    \n+
    1144 return true;
    \n+
    1145 }
    \n+
    1146
    \n+
    1147 template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
    \n+
    1148 bool operator!=(const ParallelIndexSet<TG,TL,N>& idxset,
    \n+
    1149 const ParallelIndexSet<TG1,TL1,N1>& idxset1)
    \n+
    1150 {
    \n+
    1151 return !(idxset==idxset1);
    \n+
    1152 }
    \n+
    1153
    \n+
    1154
    \n+
    1155#endif // DOXYGEN
    \n+
    1156
    \n+
    1157}
    \n+
    1158#endif
    \n+
    Provides classes for use as the local index in ParallelIndexSet.
    \n+
    Implements a random-access container that can efficiently change size (similar to std::deque)
    \n+
    A few common exception classes.
    \n+
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition: bigunsignedint.hh:278
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition: iteratorfacades.hh:637
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition: iteratorfacades.hh:683
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition: iteratorfacades.hh:660
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition: iteratorfacades.hh:237
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition: iteratorfacades.hh:705
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition: iteratorfacades.hh:259
    \n+
    IndexPair & operator[](const GlobalIndex &global)
    Find the index pair with a specific global id.
    \n+
    static constexpr int arraySize
    The size of the individual arrays in the underlying ArrayList.
    Definition: indexset.hh:252
    \n+
    void beginResize()
    Indicate that the index set is to be resized.
    \n+
    ParallelIndexSetState
    The states the index set can be in.
    Definition: indexset.hh:181
    \n+
    void renumberLocal()
    Renumbers the local index numbers.
    \n+
    bool exists(const GlobalIndex &global) const
    Find the index pair with a specific global id.
    \n+
    size_t size() const
    Get the total number (public and nonpublic) indices.
    \n+
    ArrayList< IndexPair, N >::const_iterator const_iterator
    The constant iterator over the pairs.
    Definition: indexset.hh:296
    \n+
    bool operator()(const IndexPair< TG, TL > &i1, const IndexPair< TG, TL > &i2)
    Definition: indexset.hh:625
    \n+
    void add(const GlobalIndex &global)
    Add an new index to the set.
    \n+
    const_iterator end() const
    Get an iterator over the indices positioned after the last index.
    \n+
    const LocalIndex & local() const
    Get the local index.
    \n+
    const IndexPair & at(const GlobalIndex &global) const
    Find the index pair with a specific global id.
    \n+
    GlobalLookupIndexSet(const ParallelIndexSet &indexset)
    Constructor.
    \n+
    TL LocalIndex
    the type of the local index.
    Definition: indexset.hh:120
    \n+
    int seqNo() const
    Get the internal sequence number.
    \n+
    static bool compare(const T &t1, const T &t2)
    Definition: indexset.hh:616
    \n+
    iterator begin()
    Get an iterator over the indices positioned at the first index.
    \n+
    Dune::IndexPair< typename I::GlobalIndex, typename I::LocalIndex > IndexPair
    Definition: indexset.hh:529
    \n+
    iterator end()
    Get an iterator over the indices positioned after the last index.
    \n+
    ParallelIndexSet::const_iterator const_iterator
    The iterator over the index pairs.
    Definition: indexset.hh:527
    \n+
    const_iterator begin() const
    Get an iterator over the indices positioned at the first index.
    \n+
    const IndexPair & operator[](const GlobalIndex &global) const
    Find the index pair with a specific global id.
    \n+
    const ParallelIndexSetState & state()
    Get the state the index set is in.
    Definition: indexset.hh:307
    \n+
    const_iterator begin() const
    Get an iterator over the indices positioned at the first index.
    \n+
    const IndexPair & operator[](const GlobalIndex &global) const
    Find the index pair with a specific global id.
    \n+
    IndexPair()
    Construct a new Pair.
    \n+
    I ParallelIndexSet
    The type of the index set.
    Definition: indexset.hh:512
    \n+
    TL LocalIndex
    The type of the local index, e.g. ParallelLocalIndex.
    Definition: indexset.hh:239
    \n+
    void markAsDeleted(const iterator &position)
    Mark an index as deleted.
    \n+
    ParallelIndexSet::LocalIndex LocalIndex
    The type of the local index.
    Definition: indexset.hh:517
    \n+
    IndexPair(const GlobalIndex &global, const LocalIndex &local)
    Constructs a new Pair.
    \n+
    void setLocal(int index)
    Set the local index.
    \n+
    const GlobalIndex & global() const
    Get the global index.
    \n+
    void add(const GlobalIndex &global, const LocalIndex &local)
    Add an new index to the set.
    \n+
    const_iterator end() const
    Get an iterator over the indices positioned after the last index.
    \n+
    IndexPair & at(const GlobalIndex &global)
    Find the index pair with a specific global id.
    \n+
    ParallelIndexSet()
    Constructor.
    \n+
    void endResize()
    Indicate that the resizing finishes.
    \n+
    ~GlobalLookupIndexSet()
    Destructor.
    \n+
    const IndexPair * pair(const std::size_t &local) const
    Get the index pair corresponding to a local index.
    \n+
    LocalIndex & local()
    Get the local index.
    \n+
    size_t size() const
    Get the total number (public and nonpublic) indices.
    \n+
    IndexPair(const GlobalIndex &global)
    Constructs a new Pair.
    \n+
    TG GlobalIndex
    the type of the global index. This type has to provide at least a operator< for sorting.
    Definition: indexset.hh:226
    \n+
    TG GlobalIndex
    the type of the global index.
    Definition: indexset.hh:107
    \n+
    int seqNo() const
    Get the internal sequence number.
    \n+
    iterator(ParallelIndexSet< TG, TL, N > &indexSet, const Father &father)
    Definition: indexset.hh:262
    \n+
    GlobalLookupIndexSet(const ParallelIndexSet &indexset, std::size_t size)
    Constructor.
    \n+
    ParallelIndexSet::GlobalIndex GlobalIndex
    The type of the global index.
    Definition: indexset.hh:522
    \n+
    Dune::IndexPair< GlobalIndex, LocalIndex > IndexPair
    The type of the pair stored.
    Definition: indexset.hh:244
    \n+
    @ RESIZE
    Indicates that the index set is currently being resized.
    Definition: indexset.hh:190
    \n+
    @ GROUND
    The default mode. Indicates that the index set is ready to be used.
    Definition: indexset.hh:186
    \n+
    @ DELETED
    Definition: localindex.hh:28
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    vector space out of a tensor product of fields.
    Definition: fvector.hh:95
    \n-
    dynamic integer range for use in range-based for loops
    Definition: rangeutilities.hh:175
    \n-
    static integer range for use in range-based for loops
    Definition: rangeutilities.hh:225
    \n-
    Check if T is an std::integral_constant<I, i>
    Definition: typetraits.hh:384
    \n-
    Helper class for tagging priorities.
    Definition: typeutilities.hh:73
    \n-
    Helper class for tagging priorities.
    Definition: typeutilities.hh:87
    \n+
    auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition: debugalign.hh:425
    \n+
    A random access iterator for the Dune::ArrayList class.
    Definition: arraylist.hh:255
    \n+
    A constant random access iterator for the Dune::ArrayList class.
    Definition: arraylist.hh:370
    \n+
    A dynamically growing random access list.
    Definition: arraylist.hh:62
    \n+
    ConstArrayListIterator< MemberType, N, A > const_iterator
    A constant random access iterator.
    Definition: arraylist.hh:110
    \n+
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition: mpitraits.hh:41
    \n+
    Default exception if a function was called while the object is not in a valid state for that function...
    Definition: exceptions.hh:281
    \n+\n+
    A pair consisting of a global and local index.
    Definition: indexset.hh:85
    \n+
    Exception indicating that the index set is not in the expected state.
    Definition: indexset.hh:205
    \n+
    Decorates an index set with the possibility to find a global index that is mapped to a specific local...
    Definition: indexset.hh:507
    \n+
    Manager class for the mapping between local indices and globally unique indices.
    Definition: indexset.hh:218
    \n+
    The iterator over the pairs.
    Definition: indexset.hh:257
    \n+
    Definition: indexset.hh:615
    \n+
    Definition: indexset.hh:624
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,447 +4,1120 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-hybridutilities.hh\n+ * parallel\n+indexset.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_HYBRIDUTILITIES_HH\n- 6#define DUNE_COMMON_HYBRIDUTILITIES_HH\n+ 5#ifndef DUNE_INDEXSET_HH\n+ 6#define DUNE_INDEXSET_HH\n 7\n- 8#include \n- 9#include \n- 10\n- 11#include \n- 12#include \n- 13#include \n- 14#include \n- 15#include \n- 16#include \n- 17\n- 18\n- 19\n- 20namespace Dune {\n-21namespace Hybrid {\n- 22\n- 23namespace Impl {\n- 24\n- 25 // Try if tuple_size is implemented for class\n- 26 template\n- 27 constexpr auto size(const Dune::FieldVector&, const PriorityTag<5>&)\n- 28 -> decltype(std::integral_constant())\n- 29 {\n- 30 return {};\n- 31 }\n+ 8#include \n+ 9#include \n+ 10#include \n+ 11#include \n+ 12\n+ 13#include \"localindex.hh\"\n+ 14\n+ 15#include // for uint32_t\n+ 16\n+ 17namespace Dune\n+ 18{\n+ 28 // forward declarations\n+ 29\n+ 30 template\n+ 31 class IndexPair;\n 32\n- 33 // Try if tuple_size is implemented for class\n- 34 template\n- 35 constexpr auto size(const T&, const PriorityTag<3>&)\n- 36 -> decltype(std::integral_constant::value>\n-())\n- 37 {\n- 38 return {};\n- 39 }\n+ 38 template\n+ 39 std::ostream& operator<<(std::ostream& os, const IndexPair& pair);\n 40\n- 41 // Try if there's a static constexpr size()\n- 42 template\n- 43 constexpr auto size(const T&, const PriorityTag<1>&)\n- 44 -> decltype(std::integral_constant())\n- 45 {\n- 46 return {};\n- 47 }\n- 48\n- 49 // As a last resort try if there's a static constexpr size()\n- 50 template\n- 51 constexpr auto size(const T& t, const PriorityTag<0>&)\n- 52 {\n- 53 return t.size();\n- 54 }\n+ 41 template\n+ 42 bool operator==(const IndexPair&, const IndexPair&);\n+ 43\n+ 44 template\n+ 45 bool operator!=(const IndexPair&, const IndexPair&);\n+ 46\n+ 47 template\n+ 48 bool operator<(const IndexPair&, const IndexPair&);\n+ 49\n+ 50 template\n+ 51 bool operator>(const IndexPair&, const IndexPair&);\n+ 52\n+ 53 template\n+ 54 bool operator<=(const IndexPair&, const IndexPair&);\n 55\n- 56} // namespace Impl\n- 57\n+ 56 template\n+ 57 bool operator_>=(const IndexPair&, const IndexPair&);\n 58\n- 59\n- 81template\n-82constexpr auto size(const T& t)\n- 83{\n- 84 return Impl::size(t, PriorityTag<42>());\n- 85}\n- 86\n- 87\n- 88\n- 89namespace Impl {\n- 90\n- 91 template>::value, int> = 0>\n- 93 constexpr decltype(auto) elementAt(Container&& c, Index&&, PriorityTag<2>)\n- 94 {\n- 95 return std::get::value>(c);\n- 96 }\n- 97\n- 98 template\n- 99 constexpr decltype(auto) elementAt(std::integer_sequence c, Index,\n-PriorityTag<1>)\n- 100 {\n- 101 return Dune::integerSequenceEntry(c, std::integral_constant());\n- 102 }\n- 103\n- 104 template\n- 105 constexpr decltype(auto) elementAt(Container&& c, Index&& i,\n-PriorityTag<0>)\n- 106 {\n- 107 return c[i];\n- 108 }\n- 109\n- 110} // namespace Impl\n- 111\n- 112\n- 113\n- 134template\n-135constexpr decltype(auto) elementAt(Container&& c, Index&& i)\n- 136{\n- 137 return Impl::elementAt(std::forward(c), std::forward(i),\n-PriorityTag<42>());\n- 138}\n- 139\n- 140\n+ 59 template\n+ 60 bool operator==(const IndexPair&, const TG&);\n+ 61\n+ 62 template\n+ 63 bool operator!=(const IndexPair&, const TG&);\n+ 64\n+ 65 template\n+ 66 bool operator<(const IndexPair&, const TG&);\n+ 67\n+ 68 template\n+ 69 bool operator>(const IndexPair&, const TG&);\n+ 70\n+ 71 template\n+ 72 bool operator<=(const IndexPair&, const TG&);\n+ 73\n+ 74 template\n+ 75 bool operator_>=(const IndexPair&, const TG&);\n+ 76\n+ 77 template\n+ 78 struct MPITraits;\n+ 79\n+ 83 template\n+84 class IndexPair\n+ 85 {\n+ 86 friend std::ostream& operator<<<>(std::ostream&, const IndexPair&);\n+ 87 friend bool operator==<>(const IndexPair&, const IndexPair&);\n+ 88 friend bool operator!=<>(const IndexPair&, const IndexPair&);\n+ 89 friend bool operator< <>(const IndexPair&, const IndexPair&);\n+ 90 friend bool operator><>(const IndexPair&, const IndexPair&);\n+ 91 friend bool operator<=<>(const IndexPair&, const IndexPair&);\n+ 92 friend bool operator>=<>(const IndexPair&, const IndexPair&);\n+ 93 friend bool operator==<>(const IndexPair&, const TG &);\n+ 94 friend bool operator!=<>(const IndexPair&, const TG &);\n+ 95 friend bool operator< <>(const IndexPair&, const TG &);\n+ 96 friend bool operator> <>(const IndexPair&, const TG &);\n+ 97 friend bool operator<=<>(const IndexPair&, const TG &);\n+98 friend bool operator>=<>(const IndexPair&, const TG &);\n+ 99 friend struct MPITraits >;\n+ 100\n+ 101 public:\n+107 typedef TG GlobalIndex;\n+ 108\n+120 typedef TL LocalIndex;\n+ 121\n+128 IndexPair(const GlobalIndex& global, const LocalIndex& local);\n+ 129\n+133 IndexPair();\n+140 IndexPair(const GlobalIndex& global);\n 141\n- 142namespace Impl {\n- 143\n- 144 template::value and\n-IsIntegralConstant::value, int> = 0>\n- 146 constexpr auto integralRange(const Begin& /*begin*/, const End& /*end*/,\n-const PriorityTag<1>&)\n- 147 {\n- 148 static_assert(Begin::value <= End::value, \"You cannot create an\n-integralRange where end();\n- 150 }\n- 151\n- 152 // This should be constexpr but gcc-4.9 does not support\n- 153 // the relaxed constexpr requirements. Hence for being\n- 154 // constexpr the function body can only contain a return\n- 155 // statement and no assertion before this.\n- 156 template\n- 157 constexpr auto integralRange(const Begin& begin, const End& end, const\n-PriorityTag<0>&)\n- 158 {\n- 159 return DUNE_ASSERT_AND_RETURN(begin<=end, Dune::IntegralRange(begin,\n-end));\n- 160 }\n- 161\n- 162} // namespace Impl\n- 163\n- 164\n- 165\n- 183template\n-184constexpr auto integralRange(const Begin& begin, const End& end)\n- 185{\n- 186 return Impl::integralRange(begin, end, PriorityTag<42>());\n- 187}\n- 188\n- 202template\n-203constexpr auto integralRange(const End& end)\n- 204{\n- 205 return Impl::integralRange(Dune::Indices::_0, end, PriorityTag<42>());\n- 206}\n- 207\n- 208\n+147 inline const GlobalIndex& global() const;\n+ 148\n+154 inline LocalIndex& local();\n+ 155\n+161 inline const LocalIndex& local() const;\n+ 162\n+168 inline void setLocal(int index);\n+ 169 private:\n+ 171 GlobalIndex global_;\n+173 LocalIndex local_;\n+ 174 };\n+ 175\n+180 enum ParallelIndexSetState\n+ 181 {\n+186 GROUND,\n+ 190 RESIZE\n+200 };\n+ 201\n+205 class InvalidIndexSetState : public InvalidStateException {};\n+ 206\n+ 207 // Forward declaration\n+ 208 template class GlobalLookupIndexSet;\n 209\n- 210namespace Impl {\n- 211\n- 212 template\n- 213 constexpr void evaluateFoldExpression(std::initializer_list&&)\n- 214 {}\n- 215\n- 216 template\n- 217 constexpr void forEachIndex(Range&& range, F&& f, std::\n-integer_sequence)\n+ 216 template\n+217 class ParallelIndexSet\n 218 {\n- 219 evaluateFoldExpression({(f(Hybrid::elementAt(range, std::\n-integral_constant())), 0)...});\n- 220 }\n- 221\n- 222 template\n- 223 constexpr void forEach(std::integer_sequence /*range*/, F&&\n-f, PriorityTag<2>)\n- 224 {\n- 225 evaluateFoldExpression({(f(std::integral_constant()),\n-0)...});\n- 226 }\n+ 219 friend class GlobalLookupIndexSet >;\n+ 220\n+ 221 public:\n+226 typedef TG GlobalIndex;\n 227\n- 228\n- 229 template()))>::value, int> = 0>\n- 231 constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)\n- 232 {\n- 233 auto size = Hybrid::size(range);\n- 234 auto indices = std::make_index_sequence();\n- 235 (forEachIndex)(std::forward(range), std::forward(f), indices);\n- 236 }\n- 237\n- 238 template\n- 239 constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)\n- 240 {\n- 241 for(auto&& e : range)\n- 242 f(e);\n- 243 }\n- 244\n- 245} // namespace Impl\n- 246\n- 247\n- 248\n- 267template\n-268constexpr void forEach(Range&& range, F&& f)\n- 269{\n- 270 Impl::forEach(std::forward(range), std::forward(f),\n-PriorityTag<42>());\n- 271}\n- 272\n- 273\n- 274\n- 290template\n-291constexpr T accumulate(Range&& range, T value, F&& f)\n- 292{\n- 293 forEach(std::forward(range), [&](auto&& entry) {\n- 294 value = f(value, entry);\n- 295 });\n- 296 return value;\n- 297}\n- 298\n- 299\n- 300\n- 301namespace Impl {\n+239 typedef TL LocalIndex;\n+ 240\n+244 typedef Dune::IndexPair IndexPair;\n+ 245\n+252 constexpr static int arraySize = (N>0) ? N : 1;\n+ 253\n+255 class iterator :\n+ 256 public ArrayList::iterator\n+ 257 {\n+ 258 typedef typename ArrayList::iterator\n+259 Father;\n+ 260 friend class ParallelIndexSet;\n+ 261 public:\n+262 iterator(ParallelIndexSet& indexSet, const Father& father)\n+ 263 : Father(father), indexSet_(&indexSet)\n+ 264 {}\n+ 265\n+ 266 private:\n+ 276 inline void markAsDeleted() const\n+ 277 {\n+ 278#ifndef NDEBUG\n+ 279 if(indexSet_->state_ != RESIZE)\n+ 280 DUNE_THROW(InvalidIndexSetState, \"Indices can only be removed \"\n+ 281 <<\"while in RESIZE state!\");\n+ 282#endif\n+ 283 Father::operator*().local().setState(DELETED);\n+ 284 }\n+ 285\n+ 287 ParallelIndexSet* indexSet_;\n+ 288\n+ 289 };\n+ 290\n+ 291\n+ 292\n+ 294 typedef typename\n+ 295 ArrayList::const_iterator\n+296 const_iterator;\n+ 297\n+301 ParallelIndexSet();\n 302\n- 303 struct Id {\n- 304 template\n- 305 constexpr T operator()(T&& x) const {\n- 306 return std::forward(x);\n- 307 }\n- 308 };\n- 309\n- 310 template\n- 311 constexpr decltype(auto) ifElse(std::true_type, IfFunc&& ifFunc,\n-ElseFunc&& /*elseFunc*/)\n- 312 {\n- 313 return ifFunc(Id{});\n- 314 }\n- 315\n- 316 template\n- 317 constexpr decltype(auto) ifElse(std::false_type, IfFunc&& /*ifFunc*/,\n-ElseFunc&& elseFunc)\n- 318 {\n- 319 return elseFunc(Id{});\n- 320 }\n- 321\n- 322 template\n- 323 decltype(auto) ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&&\n-elseFunc)\n- 324 {\n- 325 if (condition)\n- 326 return ifFunc(Id{});\n- 327 else\n- 328 return elseFunc(Id{});\n- 329 }\n- 330\n- 331} // namespace Impl\n- 332\n- 333\n- 334\n- 355template\n-356decltype(auto) ifElse(const Condition& condition, IfFunc&& ifFunc,\n-ElseFunc&& elseFunc)\n- 357{\n- 358 return Impl::ifElse(condition, std::forward(ifFunc), std::\n-forward(elseFunc));\n- 359}\n- 360\n- 368template\n-369void ifElse(const Condition& condition, IfFunc&& ifFunc)\n- 370{\n- 371 ifElse(condition, std::forward(ifFunc), [](auto&&) {});\n- 372}\n- 373\n+307 inline const ParallelIndexSetState& state()\n+ 308 {\n+ 309 return state_;\n+ 310 }\n+ 311\n+317 void beginResize();\n+ 318\n+327 inline void add(const GlobalIndex& global);\n+ 328\n+337 inline void add(const GlobalIndex& global, const LocalIndex& local);\n+ 338\n+346 inline void markAsDeleted(const iterator& position);\n+ 347\n+360 void endResize();\n+ 361\n+ 372 inline IndexPair&\n+373 operator[](const GlobalIndex& global);\n 374\n- 375\n- 376namespace Impl {\n- 377\n- 378 template\n- 379 constexpr auto equals(const T1& /*t1*/, const T2& /*t2*/, PriorityTag<1>)\n--> decltype(T1::value, T2::value, std::integral_constant())\n- 380 { return {}; }\n- 381\n- 382 template\n- 383 constexpr auto equals(const T1& t1, const T2& t2, PriorityTag<0>)\n- 384 {\n- 385 return t1==t2;\n- 386 }\n- 387\n- 388} // namespace Impl\n- 389\n- 390\n- 391\n- 401template\n-402constexpr auto equals(T1&& t1, T2&& t2)\n- 403{\n- 404 return Impl::equals(std::forward(t1), std::forward(t2),\n-PriorityTag<1>());\n- 405}\n- 406\n- 407\n- 408\n- 409namespace Impl {\n- 410\n- 411 template\n- 412 constexpr Result switchCases(std::integer_sequence, const Value& /\n-*value*/, Branches&& /*branches*/, ElseBranch&& elseBranch)\n- 413 {\n- 414 return elseBranch();\n- 415 }\n- 416\n- 417 template\n- 418 constexpr Result switchCases(std::integer_sequence, const\n-Value& value, Branches&& branches, ElseBranch&& elseBranch)\n- 419 {\n- 420 return ifElse(\n- 421 Hybrid::equals(std::integral_constant(), value),\n- 422 [&](auto id) -> decltype(auto) {\n- 423 return id(branches)(std::integral_constant());\n- 424 }, [&](auto id) -> decltype(auto) {\n- 425 return Impl::switchCases(id(std::integer_sequence()),\n-value, branches, elseBranch);\n- 426 });\n- 427 }\n- 428\n- 429} // namespace Impl\n- 430\n- 431\n- 432\n- 460template\n-461constexpr decltype(auto) switchCases(const Cases& cases, const Value& value,\n-Branches&& branches, ElseBranch&& elseBranch)\n- 462{\n- 463 return Impl::switchCases(cases, value, std::\n-forward(branches), std::forward(elseBranch));\n- 464}\n- 465\n- 486template\n-487constexpr void switchCases(const Cases& cases, const Value& value,\n-Branches&& branches)\n- 488{\n- 489 Impl::switchCases(cases, value, std::forward(branches), []\n-() {});\n- 490}\n+ 384 inline IndexPair&\n+385 at(const GlobalIndex& global);\n+ 386\n+ 396 inline bool\n+397 exists (const GlobalIndex& global) const;\n+ 398\n+ 409 inline const IndexPair&\n+410 operator[](const GlobalIndex& global) const;\n+ 411\n+ 421 inline const IndexPair&\n+422 at(const GlobalIndex& global) const;\n+ 423\n+428 inline iterator begin();\n+ 429\n+434 inline iterator end();\n+ 435\n+440 inline const_iterator begin() const;\n+ 441\n+446 inline const_iterator end() const;\n+ 447\n+457 inline void renumberLocal();\n+ 458\n+465 inline int seqNo() const;\n+ 466\n+471 inline size_t size() const;\n+ 472\n+ 473 private:\n+ 475 ArrayList localIndices_;\n+ 477 ArrayList newIndices_;\n+ 479 ParallelIndexSetState state_;\n+ 481 int seqNo_;\n+ 483 bool deletedEntries_;\n+ 488 inline void merge();\n+ 489 };\n+ 490\n 491\n- 492\n- 493} // namespace Hybrid\n- 494} // namespace Dune\n- 495\n- 496\n- 497#endif // #ifndef DUNE_COMMON_HYBRIDUTILITIES_HH\n-typeutilities.hh\n-Utilities for type computations, constraining overloads, ...\n-assertandreturn.hh\n-fvector.hh\n-Implements a vector constructed from a given type representing a field and a\n-compile-time given size.\n-rangeutilities.hh\n-Utilities for reduction like operations on ranges.\n-indices.hh\n-typetraits.hh\n-Traits for type conversions and type information.\n-Dune::Indices::_0\n-constexpr index_constant< 0 > _0\n-Compile time index with value 0.\n-Definition: indices.hh:53\n-Dune::range\n-static StaticIntegralRange< T, to, from > range(std::integral_constant< T, from\n->, std::integral_constant< T, to >) noexcept\n-Definition: rangeutilities.hh:300\n-Dune::Hybrid::ifElse\n-void ifElse(const Condition &condition, IfFunc &&ifFunc)\n-A conditional expression.\n-Definition: hybridutilities.hh:369\n-Dune::Hybrid::size\n-constexpr auto size(const T &t)\n-Size query.\n-Definition: hybridutilities.hh:82\n-Dune::Hybrid::integralRange\n-constexpr auto integralRange(const End &end)\n-Create an integral range starting from 0.\n-Definition: hybridutilities.hh:203\n-Dune::Hybrid::equals\n-constexpr auto equals(T1 &&t1, T2 &&t2)\n-Equality comparison.\n-Definition: hybridutilities.hh:402\n-Dune::Hybrid::forEach\n-constexpr void forEach(Range &&range, F &&f)\n-Range based for loop.\n-Definition: hybridutilities.hh:268\n-Dune::Hybrid::switchCases\n-constexpr decltype(auto) switchCases(const Cases &cases, const Value &value,\n-Branches &&branches, ElseBranch &&elseBranch)\n-Switch statement.\n-Definition: hybridutilities.hh:461\n-Dune::Hybrid::ifElse\n-decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc\n-&&elseFunc)\n-A conditional expression.\n-Definition: hybridutilities.hh:356\n-Dune::Hybrid::integralRange\n-constexpr auto integralRange(const Begin &begin, const End &end)\n-Create an integral range.\n-Definition: hybridutilities.hh:184\n-Dune::Hybrid::elementAt\n-constexpr decltype(auto) elementAt(Container &&c, Index &&i)\n-Get element at given position from container.\n-Definition: hybridutilities.hh:135\n-Dune::Hybrid::accumulate\n-constexpr T accumulate(Range &&range, T value, F &&f)\n-Accumulate values.\n-Definition: hybridutilities.hh:291\n-Dune::integerSequenceEntry\n-constexpr auto integerSequenceEntry(std::integer_sequence< T, t... >, std::\n-integral_constant< std::size_t, index > i)\n-Get entry of std::integer_sequence.\n-Definition: typetraits.hh:462\n-DUNE_ASSERT_AND_RETURN\n-#define DUNE_ASSERT_AND_RETURN(C, X)\n-Asserts a condition and return on success in constexpr context.\n-Definition: assertandreturn.hh:22\n+ 497 template\n+ 498 std::ostream& operator<<(std::ostream& os, const\n+ParallelIndexSet& indexSet);\n+ 499\n+ 505 template\n+506 class GlobalLookupIndexSet\n+ 507 {\n+ 508 public:\n+512 typedef I ParallelIndexSet;\n+ 513\n+517 typedef typename ParallelIndexSet::LocalIndex LocalIndex;\n+ 518\n+522 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;\n+ 523\n+527 typedef typename ParallelIndexSet::const_iterator const_iterator;\n+ 528\n+529 typedef Dune::IndexPair\n+IndexPair;\n+ 530\n+537 GlobalLookupIndexSet(const ParallelIndexSet& indexset, std::size_t size);\n+ 538\n+544 GlobalLookupIndexSet(const ParallelIndexSet& indexset);\n+ 545\n+549 ~GlobalLookupIndexSet();\n+ 550\n+ 560 inline const IndexPair&\n+561 operator[](const GlobalIndex& global) const;\n+ 562\n+ 566 inline const IndexPair*\n+567 pair(const std::size_t& local) const;\n+ 568\n+573 inline const_iterator begin() const;\n+ 574\n+579 inline const_iterator end() const;\n+ 580\n+587 inline int seqNo() const;\n+ 588\n+593 inline size_t size() const;\n+ 594 private:\n+ 598 const ParallelIndexSet& indexSet_;\n+ 599\n+ 603 std::size_t size_;\n+ 604\n+ 608 std::vector indices_;\n+ 609\n+ 610 };\n+ 611\n+ 612\n+ 613 template\n+614 struct LocalIndexComparator\n+ 615 {\n+616 static bool compare([[maybe_unused]] const T& t1, [[maybe_unused]] const T&\n+t2)\n+ 617 {\n+ 618 return false;\n+ 619 }\n+ 620 };\n+ 621\n+ 622 template\n+623 struct IndexSetSortFunctor\n+ 624 {\n+625 bool operator()(const IndexPair& i1, const IndexPair& i2)\n+ 626 {\n+ 627 return i1.global()::compare(i1.local(),\n+ 629 i2.local()));\n+ 630 }\n+ 631 };\n+ 632\n+ 633\n+ 634\n+ 635 template\n+636 inline std::ostream& operator<<(std::ostream& os, const IndexPair&\n+pair)\n+ 637 {\n+ 638 os<<\"{global=\"<\n+643 inline std::ostream& operator<<(std::ostream& os, const\n+ParallelIndexSet& indexSet)\n+ 644 {\n+ 645 typedef typename ParallelIndexSet::const_iterator Iterator;\n+ 646 Iterator end = indexSet.end();\n+ 647 os<<\"{\";\n+ 648 for(Iterator index = indexSet.begin(); index != end; ++index)\n+ 649 os<<*index<<\" \";\n+ 650 os<<\"}\";\n+ 651 return os;\n+ 652\n+ 653 }\n+ 654\n+ 655 template\n+656 inline bool operator==(const IndexPair& a, const IndexPair&\n+b)\n+ 657 {\n+ 658 return a.global_==b.global_;\n+ 659 }\n+ 660\n+ 661 template\n+662 inline bool operator!=(const IndexPair& a, const IndexPair&\n+b)\n+ 663 {\n+ 664 return a.global_!=b.global_;\n+ 665 }\n+ 666\n+ 667 template\n+668 inline bool operator<(const IndexPair& a, const IndexPair& b)\n+ 669 {\n+ 670 return a.global_\n+674 inline bool operator>(const IndexPair& a, const IndexPair& b)\n+ 675 {\n+ 676 return a.global_>b.global_;\n+ 677 }\n+ 678\n+ 679 template\n+680 inline bool operator<=(const IndexPair& a, const IndexPair&\n+b)\n+ 681 {\n+ 682 return a.global_<=b.global_;\n+ 683 }\n+ 684\n+ 685 template\n+686 inline bool operator_>=(const IndexPair& a, const IndexPair&\n+b)\n+ 687 {\n+ 688 return a.global_>=b.global_;\n+ 689 }\n+ 690\n+ 691 template\n+692 inline bool operator==(const IndexPair& a, const TG& b)\n+ 693 {\n+ 694 return a.global_==b;\n+ 695 }\n+ 696\n+ 697 template\n+698 inline bool operator!=(const IndexPair& a, const TG& b)\n+ 699 {\n+ 700 return a.global_!=b;\n+ 701 }\n+ 702\n+ 703 template\n+704 inline bool operator<(const IndexPair& a, const TG& b)\n+ 705 {\n+ 706 return a.global_\n+710 inline bool operator>(const IndexPair& a, const TG& b)\n+ 711 {\n+ 712 return a.global_>b;\n+ 713 }\n+ 714\n+ 715 template\n+716 inline bool operator<=(const IndexPair& a, const TG& b)\n+ 717 {\n+ 718 return a.global_<=b;\n+ 719 }\n+ 720\n+ 721 template\n+722 inline bool operator_>=(const IndexPair& a, const TG& b)\n+ 723 {\n+ 724 return a.global_>=b;\n+ 725 }\n+ 726\n+ 727#ifndef DOXYGEN\n+ 728\n+ 729 template\n+ 730 IndexPair::IndexPair(const TG& global, const TL& local)\n+ 731 : global_(global), local_(local){}\n+ 732\n+ 733 template\n+ 734 IndexPair::IndexPair(const TG& global)\n+ 735 : global_(global), local_(){}\n+ 736\n+ 737 template\n+ 738 IndexPair::IndexPair()\n+ 739 : global_(), local_(){}\n+ 740\n+ 741 template\n+ 742 inline const TG& IndexPair::global() const {\n+ 743 return global_;\n+ 744 }\n+ 745\n+ 746 template\n+ 747 inline TL& IndexPair::local() {\n+ 748 return local_;\n+ 749 }\n+ 750\n+ 751 template\n+ 752 inline const TL& IndexPair::local() const {\n+ 753 return local_;\n+ 754 }\n+ 755\n+ 756 template\n+ 757 inline void IndexPair::setLocal(int local){\n+ 758 local_=local;\n+ 759 }\n+ 760\n+ 761 template\n+ 762 ParallelIndexSet::ParallelIndexSet()\n+ 763 : state_(GROUND), seqNo_(0), deletedEntries_()\n+ 764 {}\n+ 765\n+ 766 template\n+ 767 void ParallelIndexSet::beginResize()\n+ 768 {\n+ 769\n+ 770 // Checks in unproductive code\n+ 771#ifndef NDEBUG\n+ 772 if(state_!=GROUND)\n+ 773 DUNE_THROW(InvalidIndexSetState,\n+ 774 \"IndexSet has to be in GROUND state, when \"\n+ 775 << \"beginResize() is called!\");\n+ 776#endif\n+ 777\n+ 778 state_ = RESIZE;\n+ 779 deletedEntries_ = false;\n+ 780 }\n+ 781\n+ 782 template\n+ 783 inline void ParallelIndexSet::add(const GlobalIndex& global)\n+ 784 {\n+ 785 // Checks in unproductive code\n+ 786#ifndef NDEBUG\n+ 787 if(state_ != RESIZE)\n+ 788 DUNE_THROW(InvalidIndexSetState, \"Indices can only be added \"\n+ 789 <<\"while in RESIZE state!\");\n+ 790#endif\n+ 791 newIndices_.push_back(IndexPair(global));\n+ 792 }\n+ 793\n+ 794 template\n+ 795 inline void ParallelIndexSet::add(const TG& global, const TL&\n+local)\n+ 796 {\n+ 797 // Checks in unproductive code\n+ 798#ifndef NDEBUG\n+ 799 if(state_ != RESIZE)\n+ 800 DUNE_THROW(InvalidIndexSetState, \"Indices can only be added \"\n+ 801 <<\"while in RESIZE state!\");\n+ 802#endif\n+ 803 newIndices_.push_back(IndexPair(global,local));\n+ 804 }\n+ 805\n+ 806 template\n+ 807 inline void ParallelIndexSet::markAsDeleted(const iterator&\n+global)\n+ 808 {\n+ 809 // Checks in unproductive code\n+ 810#ifndef NDEBUG\n+ 811 if(state_ != RESIZE)\n+ 812 DUNE_THROW(InvalidIndexSetState, \"Indices can only be removed \"\n+ 813 <<\"while in RESIZE state!\");\n+ 814#endif\n+ 815 deletedEntries_ = true;\n+ 816\n+ 817 global.markAsDeleted();\n+ 818 }\n+ 819\n+ 820 template\n+ 821 void ParallelIndexSet::endResize() {\n+ 822 // Checks in unproductive code\n+ 823#ifndef NDEBUG\n+ 824 if(state_ != RESIZE)\n+ 825 DUNE_THROW(InvalidIndexSetState, \"endResize called while not \"\n+ 826 <<\"in RESIZE state!\");\n+ 827#endif\n+ 828\n+ 829 std::sort(newIndices_.begin(), newIndices_.end(),\n+IndexSetSortFunctor());\n+ 830 merge();\n+ 831 seqNo_++;\n+ 832 state_ = GROUND;\n+ 833 }\n+ 834\n+ 835\n+ 836 template\n+ 837 inline void ParallelIndexSet::merge(){\n+ 838 if(localIndices_.size()==0)\n+ 839 {\n+ 840 localIndices_=newIndices_;\n+ 841 newIndices_.clear();\n+ 842 }\n+ 843 else if(newIndices_.size()>0 || deletedEntries_)\n+ 844 {\n+ 845 ArrayList tempPairs;\n+ 846\n+ 847 auto old = localIndices_.begin();\n+ 848 auto added = newIndices_.begin();\n+ 849 const auto endold = localIndices_.end();\n+ 850 const auto endadded = newIndices_.end();\n+ 851\n+ 852 while(old != endold && added!= endadded)\n+ 853 {\n+ 854 if(old->local().state()==DELETED) {\n+ 855 old.eraseToHere();\n+ 856 }\n+ 857 else\n+ 858 {\n+ 859 if(old->global() < added->global() ||\n+ 860 (old->global() == added->global()\n+ 861 && LocalIndexComparator::compare(old->local(),added->local())))\n+ 862 {\n+ 863 tempPairs.push_back(*old);\n+ 864 old.eraseToHere();\n+ 865 continue;\n+ 866 }else\n+ 867 {\n+ 868 tempPairs.push_back(*added);\n+ 869 added.eraseToHere();\n+ 870 }\n+ 871 }\n+ 872 }\n+ 873\n+ 874 while(old != endold)\n+ 875 {\n+ 876 if(old->local().state()!=DELETED) {\n+ 877 tempPairs.push_back(*old);\n+ 878 }\n+ 879 old.eraseToHere();\n+ 880 }\n+ 881\n+ 882 while(added!= endadded)\n+ 883 {\n+ 884 tempPairs.push_back(*added);\n+ 885 added.eraseToHere();\n+ 886 }\n+ 887 localIndices_ = tempPairs;\n+ 888 }\n+ 889 }\n+ 890\n+ 891\n+ 892 template\n+ 893 inline const IndexPair&\n+ 894 ParallelIndexSet::at(const TG& global) const\n+ 895 {\n+ 896 // perform a binary search\n+ 897 int low=0, high=localIndices_.size()-1, probe=-1;\n+ 898\n+ 899 while(low\n+ 918 inline const IndexPair&\n+ 919 ParallelIndexSet::operator[](const TG& global) const\n+ 920 {\n+ 921 // perform a binary search\n+ 922 int low=0, high=localIndices_.size()-1, probe=-1;\n+ 923\n+ 924 while(low\n+ 936 inline IndexPair& ParallelIndexSet::at(const TG& global)\n+ 937 {\n+ 938 // perform a binary search\n+ 939 int low=0, high=localIndices_.size()-1, probe=-1;\n+ 940\n+ 941 while(low= global)\n+ 945 high = probe;\n+ 946 else\n+ 947 low = probe+1;\n+ 948 }\n+ 949\n+ 950 if(probe==-1)\n+ 951 DUNE_THROW(RangeError, \"No entries!\");\n+ 952\n+ 953 if( localIndices_[low].global() != global)\n+ 954 DUNE_THROW(RangeError, \"Could not find entry of \"<\n+ 960 inline bool ParallelIndexSet::exists (const TG& global) const\n+ 961 {\n+ 962 // perform a binary search\n+ 963 int low=0, high=localIndices_.size()-1, probe=-1;\n+ 964\n+ 965 while(low= global)\n+ 969 high = probe;\n+ 970 else\n+ 971 low = probe+1;\n+ 972 }\n+ 973\n+ 974 if(probe==-1)\n+ 975 return false;\n+ 976\n+ 977 if( localIndices_[low].global() != global)\n+ 978 return false;\n+ 979 return true;\n+ 980 }\n+ 981\n+ 982 template\n+ 983 inline IndexPair& ParallelIndexSet::operator[](const TG&\n+global)\n+ 984 {\n+ 985 // perform a binary search\n+ 986 int low=0, high=localIndices_.size()-1, probe=-1;\n+ 987\n+ 988 while(low= global)\n+ 992 high = probe;\n+ 993 else\n+ 994 low = probe+1;\n+ 995 }\n+ 996\n+ 997 return localIndices_[low];\n+ 998 }\n+ 999 template\n+ 1000 inline typename ParallelIndexSet::iterator\n+ 1001 ParallelIndexSet::begin()\n+ 1002 {\n+ 1003 return iterator(*this, localIndices_.begin());\n+ 1004 }\n+ 1005\n+ 1006\n+ 1007 template\n+ 1008 inline typename ParallelIndexSet::iterator\n+ 1009 ParallelIndexSet::end()\n+ 1010 {\n+ 1011 return iterator(*this,localIndices_.end());\n+ 1012 }\n+ 1013\n+ 1014 template\n+ 1015 inline typename ParallelIndexSet::const_iterator\n+ 1016 ParallelIndexSet::begin() const\n+ 1017 {\n+ 1018 return localIndices_.begin();\n+ 1019 }\n+ 1020\n+ 1021\n+ 1022 template\n+ 1023 inline typename ParallelIndexSet::const_iterator\n+ 1024 ParallelIndexSet::end() const\n+ 1025 {\n+ 1026 return localIndices_.end();\n+ 1027 }\n+ 1028\n+ 1029 template\n+ 1030 void ParallelIndexSet::renumberLocal(){\n+ 1031#ifndef NDEBUG\n+ 1032 if(state_==RESIZE)\n+ 1033 DUNE_THROW(InvalidIndexSetState, \"IndexSet has to be in \"\n+ 1034 <<\"GROUND state for renumberLocal()\");\n+ 1035#endif\n+ 1036\n+ 1037 const auto end_ = end();\n+ 1038 uint32_t index=0;\n+ 1039\n+ 1040 for(auto pair=begin(); pair!=end_; index++, ++pair)\n+ 1041 pair->local()=index;\n+ 1042 }\n+ 1043\n+ 1044 template\n+ 1045 inline int ParallelIndexSet::seqNo() const\n+ 1046 {\n+ 1047 return seqNo_;\n+ 1048 }\n+ 1049\n+ 1050 template\n+ 1051 inline size_t ParallelIndexSet::size() const\n+ 1052 {\n+ 1053 return localIndices_.size();\n+ 1054 }\n+ 1055\n+ 1056 template\n+ 1057 GlobalLookupIndexSet::GlobalLookupIndexSet(const I& indexset,\n+ 1058 std::size_t size)\n+ 1059 : indexSet_(indexset), size_(size),\n+ 1060 indices_(size_, static_cast(0))\n+ 1061 {\n+ 1062 const_iterator end_ = indexSet_.end();\n+ 1063\n+ 1064 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) {\n+ 1065 assert(pair->local()local()] = &(*pair);\n+ 1067 }\n+ 1068 }\n+ 1069\n+ 1070 template\n+ 1071 GlobalLookupIndexSet::GlobalLookupIndexSet(const I& indexset)\n+ 1072 : indexSet_(indexset), size_(0)\n+ 1073 {\n+ 1074 const_iterator end_ = indexSet_.end();\n+ 1075 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)\n+ 1076 size_=std::max(size_,static_cast(pair->local()));\n+ 1077\n+ 1078 indices_.resize(++size_, 0);\n+ 1079\n+ 1080 for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)\n+ 1081 indices_[pair->local()] = &(*pair);\n+ 1082 }\n+ 1083\n+ 1084 template\n+ 1085 GlobalLookupIndexSet::~GlobalLookupIndexSet()\n+ 1086 {}\n+ 1087\n+ 1088 template\n+ 1089 inline const IndexPair*\n+ 1090 GlobalLookupIndexSet::pair(const std::size_t& local) const\n+ 1091 {\n+ 1092 return indices_[local];\n+ 1093 }\n+ 1094\n+ 1095 template\n+ 1096 inline const IndexPair&\n+ 1097 GlobalLookupIndexSet::operator[](const GlobalIndex& global) const\n+ 1098 {\n+ 1099 return indexSet_[global];\n+ 1100 }\n+ 1101\n+ 1102 template\n+ 1103 typename I::const_iterator GlobalLookupIndexSet::begin() const\n+ 1104 {\n+ 1105 return indexSet_.begin();\n+ 1106 }\n+ 1107\n+ 1108 template\n+ 1109 typename I::const_iterator GlobalLookupIndexSet::end() const\n+ 1110 {\n+ 1111 return indexSet_.end();\n+ 1112 }\n+ 1113\n+ 1114 template\n+ 1115 inline size_t GlobalLookupIndexSet::size() const\n+ 1116 {\n+ 1117 return size_;\n+ 1118 }\n+ 1119\n+ 1120 template\n+ 1121 inline int GlobalLookupIndexSet::seqNo() const\n+ 1122 {\n+ 1123 return indexSet_.seqNo();\n+ 1124 }\n+ 1125\n+ 1126 template\n+ 1127 bool operator==(const ParallelIndexSet& idxset,\n+ 1128 const ParallelIndexSet& idxset1)\n+ 1129 {\n+ 1130 if(idxset.size()!=idxset1.size())\n+ 1131 return false;\n+ 1132 typedef typename ParallelIndexSet::const_iterator Iter;\n+ 1133 typedef typename ParallelIndexSet::const_iterator Iter1;\n+ 1134 Iter iter=idxset.begin();\n+ 1135 for(Iter1 iter1=idxset1.begin(); iter1 != idxset1.end(); ++iter, ++iter1)\n+{\n+ 1136 if(iter1->global()!=iter->global())\n+ 1137 return false;\n+ 1138 typedef typename ParallelIndexSet::LocalIndex PI;\n+ 1139 const PI& pi=iter->local(), pi1=iter1->local();\n+ 1140\n+ 1141 if(pi!=pi1)\n+ 1142 return false;\n+ 1143 }\n+ 1144 return true;\n+ 1145 }\n+ 1146\n+ 1147 template\n+ 1148 bool operator!=(const ParallelIndexSet& idxset,\n+ 1149 const ParallelIndexSet& idxset1)\n+ 1150 {\n+ 1151 return !(idxset==idxset1);\n+ 1152 }\n+ 1153\n+ 1154\n+ 1155#endif // DOXYGEN\n+ 1156\n+ 1157}\n+ 1158#endif\n+localindex.hh\n+Provides classes for use as the local index in ParallelIndexSet.\n+arraylist.hh\n+Implements a random-access container that can efficiently change size (similar\n+to std::deque)\n+exceptions.hh\n+A few common exception classes.\n+Dune::operator<<\n+std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)\n+Definition: bigunsignedint.hh:278\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+Dune::operator<\n+EnableIfInterOperable< T1, T2, bool >::type operator<(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:637\n+Dune::operator>\n+EnableIfInterOperable< T1, T2, bool >::type operator>(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:683\n+Dune::operator<=\n+EnableIfInterOperable< T1, T2, bool >::type operator<=(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:660\n+Dune::operator==\n+EnableIfInterOperable< T1, T2, bool >::type operator==(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for equality.\n+Definition: iteratorfacades.hh:237\n+Dune::operator>=\n+EnableIfInterOperable< T1, T2, bool >::type operator>=(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:705\n+Dune::operator!=\n+EnableIfInterOperable< T1, T2, bool >::type operator!=(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for inequality.\n+Definition: iteratorfacades.hh:259\n+Dune::ParallelIndexSet::operator[]\n+IndexPair & operator[](const GlobalIndex &global)\n+Find the index pair with a specific global id.\n+Dune::ParallelIndexSet::arraySize\n+static constexpr int arraySize\n+The size of the individual arrays in the underlying ArrayList.\n+Definition: indexset.hh:252\n+Dune::ParallelIndexSet::beginResize\n+void beginResize()\n+Indicate that the index set is to be resized.\n+Dune::ParallelIndexSetState\n+ParallelIndexSetState\n+The states the index set can be in.\n+Definition: indexset.hh:181\n+Dune::ParallelIndexSet::renumberLocal\n+void renumberLocal()\n+Renumbers the local index numbers.\n+Dune::ParallelIndexSet::exists\n+bool exists(const GlobalIndex &global) const\n+Find the index pair with a specific global id.\n+Dune::ParallelIndexSet::size\n+size_t size() const\n+Get the total number (public and nonpublic) indices.\n+Dune::ParallelIndexSet::const_iterator\n+ArrayList< IndexPair, N >::const_iterator const_iterator\n+The constant iterator over the pairs.\n+Definition: indexset.hh:296\n+Dune::IndexSetSortFunctor::operator()\n+bool operator()(const IndexPair< TG, TL > &i1, const IndexPair< TG, TL > &i2)\n+Definition: indexset.hh:625\n+Dune::ParallelIndexSet::add\n+void add(const GlobalIndex &global)\n+Add an new index to the set.\n+Dune::GlobalLookupIndexSet::end\n+const_iterator end() const\n+Get an iterator over the indices positioned after the last index.\n+Dune::IndexPair::local\n+const LocalIndex & local() const\n+Get the local index.\n+Dune::ParallelIndexSet::at\n+const IndexPair & at(const GlobalIndex &global) const\n+Find the index pair with a specific global id.\n+Dune::GlobalLookupIndexSet::GlobalLookupIndexSet\n+GlobalLookupIndexSet(const ParallelIndexSet &indexset)\n+Constructor.\n+Dune::IndexPair::LocalIndex\n+TL LocalIndex\n+the type of the local index.\n+Definition: indexset.hh:120\n+Dune::GlobalLookupIndexSet::seqNo\n+int seqNo() const\n+Get the internal sequence number.\n+Dune::LocalIndexComparator::compare\n+static bool compare(const T &t1, const T &t2)\n+Definition: indexset.hh:616\n+Dune::ParallelIndexSet::begin\n+iterator begin()\n+Get an iterator over the indices positioned at the first index.\n+Dune::GlobalLookupIndexSet::IndexPair\n+Dune::IndexPair< typename I::GlobalIndex, typename I::LocalIndex > IndexPair\n+Definition: indexset.hh:529\n+Dune::ParallelIndexSet::end\n+iterator end()\n+Get an iterator over the indices positioned after the last index.\n+Dune::GlobalLookupIndexSet::const_iterator\n+ParallelIndexSet::const_iterator const_iterator\n+The iterator over the index pairs.\n+Definition: indexset.hh:527\n+Dune::GlobalLookupIndexSet::begin\n+const_iterator begin() const\n+Get an iterator over the indices positioned at the first index.\n+Dune::ParallelIndexSet::operator[]\n+const IndexPair & operator[](const GlobalIndex &global) const\n+Find the index pair with a specific global id.\n+Dune::ParallelIndexSet::state\n+const ParallelIndexSetState & state()\n+Get the state the index set is in.\n+Definition: indexset.hh:307\n+Dune::ParallelIndexSet::begin\n+const_iterator begin() const\n+Get an iterator over the indices positioned at the first index.\n+Dune::GlobalLookupIndexSet::operator[]\n+const IndexPair & operator[](const GlobalIndex &global) const\n+Find the index pair with a specific global id.\n+Dune::IndexPair::IndexPair\n+IndexPair()\n+Construct a new Pair.\n+Dune::GlobalLookupIndexSet::ParallelIndexSet\n+I ParallelIndexSet\n+The type of the index set.\n+Definition: indexset.hh:512\n+Dune::ParallelIndexSet::LocalIndex\n+TL LocalIndex\n+The type of the local index, e.g. ParallelLocalIndex.\n+Definition: indexset.hh:239\n+Dune::ParallelIndexSet::markAsDeleted\n+void markAsDeleted(const iterator &position)\n+Mark an index as deleted.\n+Dune::GlobalLookupIndexSet::LocalIndex\n+ParallelIndexSet::LocalIndex LocalIndex\n+The type of the local index.\n+Definition: indexset.hh:517\n+Dune::IndexPair::IndexPair\n+IndexPair(const GlobalIndex &global, const LocalIndex &local)\n+Constructs a new Pair.\n+Dune::IndexPair::setLocal\n+void setLocal(int index)\n+Set the local index.\n+Dune::IndexPair::global\n+const GlobalIndex & global() const\n+Get the global index.\n+Dune::ParallelIndexSet::add\n+void add(const GlobalIndex &global, const LocalIndex &local)\n+Add an new index to the set.\n+Dune::ParallelIndexSet::end\n+const_iterator end() const\n+Get an iterator over the indices positioned after the last index.\n+Dune::ParallelIndexSet::at\n+IndexPair & at(const GlobalIndex &global)\n+Find the index pair with a specific global id.\n+Dune::ParallelIndexSet::ParallelIndexSet\n+ParallelIndexSet()\n+Constructor.\n+Dune::ParallelIndexSet::endResize\n+void endResize()\n+Indicate that the resizing finishes.\n+Dune::GlobalLookupIndexSet::~GlobalLookupIndexSet\n+~GlobalLookupIndexSet()\n+Destructor.\n+Dune::GlobalLookupIndexSet::pair\n+const IndexPair * pair(const std::size_t &local) const\n+Get the index pair corresponding to a local index.\n+Dune::IndexPair::local\n+LocalIndex & local()\n+Get the local index.\n+Dune::GlobalLookupIndexSet::size\n+size_t size() const\n+Get the total number (public and nonpublic) indices.\n+Dune::IndexPair::IndexPair\n+IndexPair(const GlobalIndex &global)\n+Constructs a new Pair.\n+Dune::ParallelIndexSet::GlobalIndex\n+TG GlobalIndex\n+the type of the global index. This type has to provide at least a operator< for\n+sorting.\n+Definition: indexset.hh:226\n+Dune::IndexPair::GlobalIndex\n+TG GlobalIndex\n+the type of the global index.\n+Definition: indexset.hh:107\n+Dune::ParallelIndexSet::seqNo\n+int seqNo() const\n+Get the internal sequence number.\n+Dune::ParallelIndexSet::iterator::iterator\n+iterator(ParallelIndexSet< TG, TL, N > &indexSet, const Father &father)\n+Definition: indexset.hh:262\n+Dune::GlobalLookupIndexSet::GlobalLookupIndexSet\n+GlobalLookupIndexSet(const ParallelIndexSet &indexset, std::size_t size)\n+Constructor.\n+Dune::GlobalLookupIndexSet::GlobalIndex\n+ParallelIndexSet::GlobalIndex GlobalIndex\n+The type of the global index.\n+Definition: indexset.hh:522\n+Dune::ParallelIndexSet::IndexPair\n+Dune::IndexPair< GlobalIndex, LocalIndex > IndexPair\n+The type of the pair stored.\n+Definition: indexset.hh:244\n+Dune::RESIZE\n+@ RESIZE\n+Indicates that the index set is currently being resized.\n+Definition: indexset.hh:190\n+Dune::GROUND\n+@ GROUND\n+The default mode. Indicates that the index set is ready to be used.\n+Definition: indexset.hh:186\n+Dune::DELETED\n+@ DELETED\n+Definition: localindex.hh:28\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::FieldVector\n-vector space out of a tensor product of fields.\n-Definition: fvector.hh:95\n-Dune::IntegralRange\n-dynamic integer range for use in range-based for loops\n-Definition: rangeutilities.hh:175\n-Dune::StaticIntegralRange\n-static integer range for use in range-based for loops\n-Definition: rangeutilities.hh:225\n-Dune::IsIntegralConstant\n-Check if T is an std::integral_constant\n-Definition: typetraits.hh:384\n-Dune::PriorityTag\n-Helper class for tagging priorities.\n-Definition: typeutilities.hh:73\n-Dune::PriorityTag<_0_>\n-Helper class for tagging priorities.\n-Definition: typeutilities.hh:87\n+Dune::AlignedNumberImpl::max\n+auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n+&b)\n+Definition: debugalign.hh:425\n+Dune::ArrayListIterator\n+A random access iterator for the Dune::ArrayList class.\n+Definition: arraylist.hh:255\n+Dune::ConstArrayListIterator\n+A constant random access iterator for the Dune::ArrayList class.\n+Definition: arraylist.hh:370\n+Dune::ArrayList\n+A dynamically growing random access list.\n+Definition: arraylist.hh:62\n+Dune::ArrayList::const_iterator\n+ConstArrayListIterator< MemberType, N, A > const_iterator\n+A constant random access iterator.\n+Definition: arraylist.hh:110\n+Dune::MPITraits\n+A traits class describing the mapping of types onto MPI_Datatypes.\n+Definition: mpitraits.hh:41\n+Dune::InvalidStateException\n+Default exception if a function was called while the object is not in a valid\n+state for that function...\n+Definition: exceptions.hh:281\n+Dune::RandomAccessIteratorFacade<_ArrayListIterator<_T,_N,_A_>,_A::value_type,\n+A::value_type_&,_A::difference_type_>::operator*\n+Reference operator*() const\n+Dereferencing operator.\n+Definition: iteratorfacades.hh:500\n+Dune::IndexPair\n+A pair consisting of a global and local index.\n+Definition: indexset.hh:85\n+Dune::InvalidIndexSetState\n+Exception indicating that the index set is not in the expected state.\n+Definition: indexset.hh:205\n+Dune::GlobalLookupIndexSet\n+Decorates an index set with the possibility to find a global index that is\n+mapped to a specific local...\n+Definition: indexset.hh:507\n+Dune::ParallelIndexSet\n+Manager class for the mapping between local indices and globally unique\n+indices.\n+Definition: indexset.hh:218\n+Dune::ParallelIndexSet::iterator\n+The iterator over the pairs.\n+Definition: indexset.hh:257\n+Dune::LocalIndexComparator\n+Definition: indexset.hh:615\n+Dune::IndexSetSortFunctor\n+Definition: indexset.hh:624\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00068.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00068.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: scalarmatrixview.hh File Reference\n+dune-common: mpifuture.hh File Reference\n \n \n \n \n \n \n \n@@ -58,46 +58,51 @@\n \n \n \n \n \n
    \n \n-
    scalarmatrixview.hh File Reference
    \n+
    mpifuture.hh File Reference
    \n
    \n
    \n-\n-

    Implements a scalar matrix view wrapper around an existing scalar. \n-More...

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

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+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...
     
    \n \n \n \n \n+\n+\n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::impl
     
    \n-

    Detailed Description

    \n-

    Implements a scalar matrix view wrapper around an existing scalar.

    \n-
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,30 +4,37 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces\n-scalarmatrixview.hh File Reference\n-Common \u00bb Dense_Matrix_and_Vector_Template_Library\n-Implements a scalar matrix view wrapper around an existing scalar. More...\n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+ * parallel\n+Classes | Namespaces\n+mpifuture.hh File Reference\n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::impl::Buffer<_T_>\n+\u00a0\n+struct \u00a0Dune::impl::Buffer<_T_&_>\n+\u00a0\n+struct \u00a0Dune::impl::Buffer<_void_>\n+\u00a0\n+ class \u00a0Dune::MPIFuture<_R,_S_>\n+ Provides a future-like object for MPI communication. It contains the\n+\u00a0 object that will be received and might contain also a sending object,\n+ which must be hold (keep alive) until the communication has been\n+ completed. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-***** Detailed Description *****\n-Implements a scalar matrix view wrapper around an existing scalar.\n+namespace \u00a0Dune::impl\n+\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00068_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: scalarmatrixview.hh Source File\n+dune-common: mpifuture.hh Source File\n \n \n \n \n \n \n \n@@ -58,203 +58,231 @@\n \n \n \n \n \n
    \n-
    scalarmatrixview.hh
    \n+
    mpifuture.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_SCALARMATRIXVIEW_HH
    \n-
    6#define DUNE_COMMON_SCALARMATRIXVIEW_HH
    \n+
    5#ifndef DUNE_COMMON_PARALLEL_MPIFUTURE_HH
    \n+
    6#define DUNE_COMMON_PARALLEL_MPIFUTURE_HH
    \n
    7
    \n-
    8#include <cstddef>
    \n-
    9#include <type_traits>
    \n-
    10#include <ostream>
    \n-
    11
    \n-\n-\n-\n-\n-\n-\n-
    18
    \n-
    19
    \n-
    20namespace Dune {
    \n-
    21
    \n-
    22namespace Impl {
    \n-
    23
    \n-
    39 template<class K>
    \n-
    40 class ScalarMatrixView :
    \n-
    41 public DenseMatrix<ScalarMatrixView<K>>
    \n-
    42 {
    \n-
    43 ScalarVectorView<K> data_;
    \n-
    44 using Base = DenseMatrix<ScalarMatrixView<K>>;
    \n-
    45
    \n-
    46 template <class>
    \n-
    47 friend class ScalarMatrixView;
    \n-
    48 public:
    \n-
    49
    \n-
    50 //===== type definitions and constants
    \n-
    51
    \n-
    54 constexpr static int blocklevel = 1;
    \n-
    55
    \n-
    56 using size_type = typename Base::size_type;
    \n-
    57 using row_type = typename Base::row_type;
    \n-
    58 using row_reference = typename Base::row_reference;
    \n-\n-
    60
    \n-
    63 constexpr static int rows = 1;
    \n-
    66 constexpr static int cols = 1;
    \n-
    67
    \n-
    68 //===== constructors
    \n-
    71 constexpr ScalarMatrixView ()
    \n-
    72 : data_()
    \n-
    73 {}
    \n-
    74
    \n-
    76 ScalarMatrixView (K* p) :
    \n-
    77 data_(p)
    \n-
    78 {}
    \n+
    8#include <optional>
    \n+
    9
    \n+\n+\n+\n+
    13
    \n+
    14#if HAVE_MPI
    \n+
    15namespace Dune{
    \n+
    16
    \n+
    17 namespace impl{
    \n+
    18 template<class T>
    \n+
    19 struct Buffer{
    \n+
    20 Buffer(bool valid){
    \n+
    21 if(valid)
    \n+
    22 value = std::make_unique<T>();
    \n+
    23 }
    \n+
    24 template<class V>
    \n+
    25 Buffer(V&& t)
    \n+
    26 : value(std::make_unique<T>(std::forward<V>(t)))
    \n+
    27 {}
    \n+
    28 std::unique_ptr<T> value;
    \n+
    29 T get(){
    \n+
    30 T tmp = std::move(*value);
    \n+
    31 value.reset();
    \n+
    32 return tmp;
    \n+
    33 }
    \n+
    34 operator bool () const {
    \n+
    35 return (bool)value;
    \n+
    36 }
    \n+
    37 T& operator *() const{
    \n+
    38 return *value;
    \n+
    39 }
    \n+
    40 };
    \n+
    41
    \n+
    42 template<class T>
    \n+
    43 struct Buffer<T&>{
    \n+
    44 Buffer(bool valid = false)
    \n+
    45 {
    \n+
    46 if(valid)
    \n+
    47 value = T();
    \n+
    48 }
    \n+
    49 template<class V>
    \n+
    50 Buffer(V&& t)
    \n+
    51 : value(std::forward<V>(t))
    \n+
    52 {}
    \n+
    53 std::optional<std::reference_wrapper<T>> value;
    \n+
    54 T& get(){
    \n+
    55 T& tmp = *value;
    \n+
    56 value.reset();
    \n+
    57 return tmp;
    \n+
    58 }
    \n+
    59 operator bool () const{
    \n+
    60 return (bool)value;
    \n+
    61 }
    \n+
    62 T& operator *() const{
    \n+
    63 return *value;
    \n+
    64 }
    \n+
    65 };
    \n+
    66
    \n+
    67 template<>
    \n+
    68 struct Buffer<void>{
    \n+
    69 bool valid_;
    \n+
    70 Buffer(bool valid = false)
    \n+
    71 : valid_(valid)
    \n+
    72 {}
    \n+
    73 operator bool () const{
    \n+
    74 return valid_;
    \n+
    75 }
    \n+
    76 void get(){}
    \n+
    77 };
    \n+
    78 }
    \n
    79
    \n-
    81 ScalarMatrixView (const ScalarMatrixView &other) :
    \n-
    82 Base(),
    \n-
    83 data_(other.data_)
    \n-
    84 {}
    \n-
    85
    \n-
    87 ScalarMatrixView (ScalarMatrixView &&other) :
    \n-
    88 Base(),
    \n-
    89 data_( other.data_ )
    \n-
    90 {}
    \n-
    91
    \n-
    93 ScalarMatrixView& operator= (const ScalarMatrixView& other)
    \n-
    94 {
    \n-
    95 data_ = other.data_;
    \n-
    96 return *this;
    \n-
    97 }
    \n-
    98
    \n-
    99 template<class KK>
    \n-
    100 ScalarMatrixView& operator= (const ScalarMatrixView<KK>& other)
    \n-
    101 {
    \n-
    102 data_ = other.data_;
    \n-
    103 return *this;
    \n-
    104 }
    \n-
    105
    \n-
    107 template<typename T,
    \n-
    108 std::enable_if_t<std::is_convertible<T, K>::value, int> = 0>
    \n-
    109 inline ScalarMatrixView& operator= (const T& k)
    \n-
    110 {
    \n-
    111 data_ = k;
    \n-
    112 return *this;
    \n-
    113 }
    \n-
    114
    \n-
    115 // make this thing a matrix
    \n-
    116 static constexpr size_type mat_rows() { return 1; }
    \n-
    117 static constexpr size_type mat_cols() { return 1; }
    \n-
    118
    \n-
    119 row_reference mat_access ([[maybe_unused]] size_type i)
    \n-
    120 {
    \n-
    121 DUNE_ASSERT_BOUNDS(i == 0);
    \n-
    122 return data_;
    \n-
    123 }
    \n-
    124
    \n-
    125 const_row_reference mat_access ([[maybe_unused]] size_type i) const
    \n-
    126 {
    \n-
    127 DUNE_ASSERT_BOUNDS(i == 0);
    \n-
    128 return data_;
    \n+
    84 template<class R, class S = void>
    \n+
    85 class MPIFuture{
    \n+
    86 mutable MPI_Request req_;
    \n+
    87 mutable MPI_Status status_;
    \n+
    88 impl::Buffer<R> data_;
    \n+
    89 impl::Buffer<S> send_data_;
    \n+
    90 friend class Communication<MPI_Comm>;
    \n+
    91 public:
    \n+
    92 MPIFuture(bool valid = false)
    \n+
    93 : req_(MPI_REQUEST_NULL)
    \n+
    94 , data_(valid)
    \n+
    95 {}
    \n+
    96
    \n+
    97 // Hide this constructor if R or S is void
    \n+
    98 template<class V = R, class U = S>
    \n+
    99 MPIFuture(V&& recv_data, U&& send_data, typename std::enable_if_t<!std::is_void<V>::value && !std::is_void<U>::value>* = 0) :
    \n+
    100 req_(MPI_REQUEST_NULL)
    \n+
    101 , data_(std::forward<R>(recv_data))
    \n+
    102 , send_data_(std::forward<S>(send_data))
    \n+
    103 {}
    \n+
    104
    \n+
    105 // hide this constructor if R is void
    \n+
    106 template<class V = R>
    \n+
    107 MPIFuture(V&& recv_data, typename std::enable_if_t<!std::is_void<V>::value>* = 0)
    \n+
    108 : req_(MPI_REQUEST_NULL)
    \n+
    109 , data_(std::forward<V>(recv_data))
    \n+
    110 {}
    \n+
    111
    \n+\n+
    113 if(req_ != MPI_REQUEST_NULL){
    \n+
    114 try{ // might fail when it is a collective communication
    \n+
    115 MPI_Cancel(&req_);
    \n+
    116 MPI_Request_free(&req_);
    \n+
    117 }catch(...){
    \n+
    118 }
    \n+
    119 }
    \n+
    120 }
    \n+
    121
    \n+\n+
    123 : req_(MPI_REQUEST_NULL)
    \n+
    124 , data_(std::move(f.data_))
    \n+
    125 , send_data_(std::move(f.send_data_))
    \n+
    126 {
    \n+
    127 std::swap(req_, f.req_);
    \n+
    128 std::swap(status_, f.status_);
    \n
    129 }
    \n-
    130 }; // class ScalarMatrixView
    \n-
    131
    \n-
    133 template<typename K>
    \n-
    134 std::ostream& operator<< (std::ostream& s, const ScalarMatrixView<K>& a)
    \n-
    135 {
    \n-
    136 s << a[0][0];
    \n-
    137 return s;
    \n-
    138 }
    \n-
    139
    \n-
    141 template<class T,
    \n-
    142 std::enable_if_t<IsNumber<T>::value, int> = 0>
    \n-
    143 auto asMatrix(T& t)
    \n-
    144 {
    \n-
    145 return ScalarMatrixView<T>{&t};
    \n-
    146 }
    \n-
    147
    \n-
    149 template<class T,
    \n-
    150 std::enable_if_t<IsNumber<T>::value, int> = 0>
    \n-
    151 auto asMatrix(const T& t)
    \n-
    152 {
    \n-
    153 return ScalarMatrixView<const T>{&t};
    \n-
    154 }
    \n-
    155
    \n-
    157 template<class T,
    \n-
    158 std::enable_if_t<not IsNumber<T>::value, int> = 0>
    \n-
    159 T& asMatrix(T& t)
    \n-
    160 {
    \n-
    161 return t;
    \n-
    162 }
    \n-
    163
    \n-
    165 template<class T,
    \n-
    166 std::enable_if_t<not IsNumber<T>::value, int> = 0>
    \n-
    167 const T& asMatrix(const T& t)
    \n-
    168 {
    \n-
    169 return t;
    \n-
    170 }
    \n-
    171
    \n-
    174} // end namespace Impl
    \n-
    175
    \n-
    176 template<class K>
    \n-
    177 struct FieldTraits<Impl::ScalarMatrixView<K>> : public FieldTraits<std::remove_const_t<K>> {};
    \n-
    178
    \n-
    179 template<class K>
    \n-
    180 struct DenseMatVecTraits<Impl::ScalarMatrixView<K>>
    \n-
    181 {
    \n-
    182 using derived_type = Impl::ScalarMatrixView<K>;
    \n-
    183 using row_type = Impl::ScalarVectorView<K>;
    \n-
    184 using row_reference = row_type&;
    \n-
    185 using const_row_reference = const row_type&;
    \n-
    186 using value_type = std::remove_const_t<K>;
    \n-
    187 using size_type = std::size_t;
    \n-
    188 };
    \n-
    189
    \n-
    190
    \n-
    191 template<class K>
    \n-
    192 struct AutonomousValueType<Impl::ScalarMatrixView<K>>
    \n-
    193 {
    \n-
    194 using type = FieldMatrix<std::remove_const_t<K>,1,1>;
    \n-
    195 };
    \n-
    196
    \n-
    197
    \n-
    198} // end namespace Dune
    \n-
    199
    \n-
    200#endif // DUNE_COMMON_SCALARMATRIXVIEW_HH
    \n-
    Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
    \n-
    Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
    \n-
    Implements a scalar vector view wrapper around an existing scalar.
    \n-
    Macro for wrapping boundary checks.
    \n-
    Implements a matrix constructed from a given type representing a field and compile-time given number ...
    \n-
    Traits for type conversions and type information.
    \n-
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition: boundschecking.hh:30
    \n-
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition: bigunsignedint.hh:278
    \n+
    130
    \n+\n+
    132 std::swap(req_, f.req_);
    \n+
    133 std::swap(status_, f.status_);
    \n+
    134 std::swap(data_, f.data_);
    \n+
    135 std::swap(send_data_, f.send_data_);
    \n+
    136 return *this;
    \n+
    137 }
    \n+
    138
    \n+
    139 bool valid() const{
    \n+
    140 return (bool)data_;
    \n+
    141 }
    \n+
    142
    \n+
    143 void wait(){
    \n+
    144 if(!valid())
    \n+
    145 DUNE_THROW(InvalidFutureException, "The MPIFuture is not valid!");
    \n+
    146 MPI_Wait(&req_, &status_);
    \n+
    147 }
    \n+
    148
    \n+
    149 bool ready() const{
    \n+
    150 int flag = -1;
    \n+
    151 MPI_Test(&req_, &flag, &status_);
    \n+
    152 return flag;
    \n+
    153 }
    \n+
    154
    \n+
    155 R get() {
    \n+
    156 wait();
    \n+
    157 return data_.get();
    \n+
    158 }
    \n+
    159
    \n+\n+
    161 wait();
    \n+
    162 return send_data_.get();
    \n+
    163 }
    \n+
    164
    \n+\n+
    166 return getMPIData(*data_);
    \n+
    167 }
    \n+
    168
    \n+\n+
    170 return getMPIData(*send_data_);
    \n+
    171 }
    \n+
    172 };
    \n+
    173
    \n+
    174}
    \n+
    175#endif
    \n+
    176#endif
    \n+\n+
    Implements an utility class that provides collective communication methods for sequential programs.
    \n+
    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
    \n+
    bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
    Definition: bigunsignedint.hh:549
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    constexpr size_type cols() const
    number of columns
    Definition: densematrix.hh:715
    \n-
    constexpr size_type rows() const
    number of rows
    Definition: densematrix.hh:709
    \n-
    static constexpr int blocklevel
    The number of block levels we contain. This is the leaf, that is, 1.
    Definition: densematrix.hh:178
    \n-
    Traits::row_type row_type
    The type used to represent a row (must fulfill the Dune::DenseVector interface)
    Definition: densematrix.hh:169
    \n-
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition: densematrix.hh:166
    \n-
    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
    \n-
    Traits::row_reference row_reference
    The type used to represent a reference to a row (usually row_type &)
    Definition: densematrix.hh:172
    \n-
    T type
    Definition: typetraits.hh:501
    \n+
    auto getMPIData(T &t)
    Definition: mpidata.hh:43
    \n+
    void swap(T &v1, T &v2, bool mask)
    Definition: simd.hh:472
    \n+
    Collective communication interface and sequential default implementation.
    Definition: communication.hh:100
    \n+
    This exception is thrown when ready(), wait() or get() is called on an invalid future....
    Definition: future.hh:18
    \n+
    Definition: mpifuture.hh:19
    \n+
    std::unique_ptr< T > value
    Definition: mpifuture.hh:28
    \n+
    T & operator*() const
    Definition: mpifuture.hh:37
    \n+
    Buffer(V &&t)
    Definition: mpifuture.hh:25
    \n+
    T get()
    Definition: mpifuture.hh:29
    \n+
    Buffer(bool valid)
    Definition: mpifuture.hh:20
    \n+
    std::optional< std::reference_wrapper< T > > value
    Definition: mpifuture.hh:53
    \n+
    Buffer(bool valid=false)
    Definition: mpifuture.hh:44
    \n+
    T & get()
    Definition: mpifuture.hh:54
    \n+
    Buffer(V &&t)
    Definition: mpifuture.hh:50
    \n+
    bool valid_
    Definition: mpifuture.hh:69
    \n+
    void get()
    Definition: mpifuture.hh:76
    \n+
    Buffer(bool valid=false)
    Definition: mpifuture.hh:70
    \n+
    Provides a future-like object for MPI communication. It contains the object that will be received and...
    Definition: mpifuture.hh:85
    \n+
    MPIFuture(V &&recv_data, typename std::enable_if_t<!std::is_void< V >::value > *=0)
    Definition: mpifuture.hh:107
    \n+
    bool ready() const
    Definition: mpifuture.hh:149
    \n+
    bool valid() const
    Definition: mpifuture.hh:139
    \n+
    ~MPIFuture()
    Definition: mpifuture.hh:112
    \n+
    MPIFuture(bool valid=false)
    Definition: mpifuture.hh:92
    \n+
    MPIFuture & operator=(MPIFuture &&f)
    Definition: mpifuture.hh:131
    \n+
    auto get_send_mpidata()
    Definition: mpifuture.hh:169
    \n+
    void wait()
    Definition: mpifuture.hh:143
    \n+
    auto get_mpidata()
    Definition: mpifuture.hh:165
    \n+
    R get()
    Definition: mpifuture.hh:155
    \n+
    MPIFuture(V &&recv_data, U &&send_data, typename std::enable_if_t<!std::is_void< V >::value &&!std::is_void< U >::value > *=0)
    Definition: mpifuture.hh:99
    \n+
    S get_send_data()
    Definition: mpifuture.hh:160
    \n+
    MPIFuture(MPIFuture &&f)
    Definition: mpifuture.hh:122
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,237 +4,302 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-scalarmatrixview.hh\n+ * parallel\n+mpifuture.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_SCALARMATRIXVIEW_HH\n- 6#define DUNE_COMMON_SCALARMATRIXVIEW_HH\n+ 5#ifndef DUNE_COMMON_PARALLEL_MPIFUTURE_HH\n+ 6#define DUNE_COMMON_PARALLEL_MPIFUTURE_HH\n 7\n- 8#include \n- 9#include \n- 10#include \n- 11\n- 12#include \n- 13#include \n- 14#include \n- 15#include \n- 16#include \n- 17#include \n- 18\n- 19\n- 20namespace Dune {\n- 21\n- 22namespace Impl {\n- 23\n- 39 template\n- 40 class ScalarMatrixView :\n- 41 public DenseMatrix>\n- 42 {\n- 43 ScalarVectorView data_;\n- 44 using Base = DenseMatrix>;\n- 45\n- 46 template \n- 47 friend class ScalarMatrixView;\n- 48 public:\n- 49\n- 50 //===== type definitions and constants\n- 51\n- 54 constexpr static int blocklevel = 1;\n- 55\n- 56 using size_type = typename Base::size_type;\n- 57 using row_type = typename Base::row_type;\n- 58 using row_reference = typename Base::row_reference;\n- 59 using const_row_reference = typename Base::const_row_reference;\n- 60\n- 63 constexpr static int rows = 1;\n- 66 constexpr static int cols = 1;\n- 67\n- 68 //===== constructors\n- 71 constexpr ScalarMatrixView ()\n- 72 : data_()\n- 73 {}\n- 74\n- 76 ScalarMatrixView (K* p) :\n- 77 data_(p)\n- 78 {}\n+ 8#include \n+ 9\n+ 10#include \n+ 11#include \n+ 12#include \n+ 13\n+ 14#if HAVE_MPI\n+ 15namespace Dune{\n+ 16\n+17 namespace impl{\n+ 18 template\n+19 struct Buffer{\n+20 Buffer(bool valid){\n+ 21 if(valid)\n+ 22 value = std::make_unique();\n+ 23 }\n+ 24 template\n+25 Buffer(V&& t)\n+ 26 : value(std::make_unique(std::forward(t)))\n+ 27 {}\n+28 std::unique_ptr value;\n+29 T get(){\n+ 30 T tmp = std::move(*value);\n+ 31 value.reset();\n+ 32 return tmp;\n+ 33 }\n+34 operator bool () const {\n+ 35 return (bool)value;\n+ 36 }\n+37 T& operator_*() const{\n+ 38 return *value;\n+ 39 }\n+ 40 };\n+ 41\n+ 42 template\n+43 struct Buffer{\n+44 Buffer(bool valid = false)\n+ 45 {\n+ 46 if(valid)\n+ 47 value = T();\n+ 48 }\n+ 49 template\n+50 Buffer(V&& t)\n+ 51 : value(std::forward(t))\n+ 52 {}\n+53 std::optional> value;\n+54 T& get(){\n+ 55 T& tmp = *value;\n+ 56 value.reset();\n+ 57 return tmp;\n+ 58 }\n+59 operator bool () const{\n+ 60 return (bool)value;\n+ 61 }\n+62 T& operator_*() const{\n+ 63 return *value;\n+ 64 }\n+ 65 };\n+ 66\n+ 67 template<>\n+68 struct Buffer{\n+69 bool valid_;\n+70 Buffer(bool valid = false)\n+ 71 : valid_(valid)\n+ 72 {}\n+73 operator bool () const{\n+ 74 return valid_;\n+ 75 }\n+76 void get(){}\n+ 77 };\n+ 78 }\n 79\n- 81 ScalarMatrixView (const ScalarMatrixView &other) :\n- 82 Base(),\n- 83 data_(other.data_)\n- 84 {}\n- 85\n- 87 ScalarMatrixView (ScalarMatrixView &&other) :\n- 88 Base(),\n- 89 data_( other.data_ )\n- 90 {}\n- 91\n- 93 ScalarMatrixView& operator= (const ScalarMatrixView& other)\n- 94 {\n- 95 data_ = other.data_;\n- 96 return *this;\n- 97 }\n- 98\n- 99 template\n- 100 ScalarMatrixView& operator= (const ScalarMatrixView& other)\n- 101 {\n- 102 data_ = other.data_;\n- 103 return *this;\n- 104 }\n- 105\n- 107 template::value, int> = 0>\n- 109 inline ScalarMatrixView& operator= (const T& k)\n- 110 {\n- 111 data_ = k;\n- 112 return *this;\n- 113 }\n- 114\n- 115 // make this thing a matrix\n- 116 static constexpr size_type mat_rows() { return 1; }\n- 117 static constexpr size_type mat_cols() { return 1; }\n- 118\n- 119 row_reference mat_access ([[maybe_unused]] size_type i)\n- 120 {\n- 121 DUNE_ASSERT_BOUNDS(i == 0);\n- 122 return data_;\n- 123 }\n- 124\n- 125 const_row_reference mat_access ([[maybe_unused]] size_type i) const\n+ 84 template\n+85 class MPIFuture{\n+ 86 mutable MPI_Request req_;\n+ 87 mutable MPI_Status status_;\n+ 88 impl::Buffer data_;\n+89 impl::Buffer send_data_;\n+ 90 friend class Communication;\n+ 91 public:\n+92 MPIFuture(bool valid = false)\n+ 93 : req_(MPI_REQUEST_NULL)\n+ 94 , data_(valid)\n+ 95 {}\n+ 96\n+ 97 // Hide this constructor if R or S is void\n+ 98 template\n+99 MPIFuture(V&& recv_data, U&& send_data, typename std::enable_if_t::value && !std::is_void::value>* = 0) :\n+ 100 req_(MPI_REQUEST_NULL)\n+ 101 , data_(std::forward(recv_data))\n+ 102 , send_data_(std::forward(send_data))\n+ 103 {}\n+ 104\n+ 105 // hide this constructor if R is void\n+ 106 template\n+107 MPIFuture(V&& recv_data, typename std::enable_if_t::\n+value>* = 0)\n+ 108 : req_(MPI_REQUEST_NULL)\n+ 109 , data_(std::forward(recv_data))\n+ 110 {}\n+ 111\n+112 ~MPIFuture() {\n+ 113 if(req_ != MPI_REQUEST_NULL){\n+ 114 try{ // might fail when it is a collective communication\n+ 115 MPI_Cancel(&req_);\n+ 116 MPI_Request_free(&req_);\n+ 117 }catch(...){\n+ 118 }\n+ 119 }\n+ 120 }\n+ 121\n+122 MPIFuture(MPIFuture&& f)\n+ 123 : req_(MPI_REQUEST_NULL)\n+ 124 , data_(std::move(f.data_))\n+ 125 , send_data_(std::move(f.send_data_))\n 126 {\n- 127 DUNE_ASSERT_BOUNDS(i == 0);\n- 128 return data_;\n+ 127 std::swap(req_, f.req_);\n+ 128 std::swap(status_, f.status_);\n 129 }\n- 130 }; // class ScalarMatrixView\n- 131\n- 133 template\n- 134 std::ostream& operator<<(std::ostream& s, const ScalarMatrixView& a)\n- 135 {\n- 136 s << a[0][0];\n- 137 return s;\n- 138 }\n- 139\n- 141 template::value, int> = 0>\n- 143 auto asMatrix(T& t)\n- 144 {\n- 145 return ScalarMatrixView{&t};\n- 146 }\n- 147\n- 149 template::value, int> = 0>\n- 151 auto asMatrix(const T& t)\n- 152 {\n- 153 return ScalarMatrixView{&t};\n- 154 }\n- 155\n- 157 template::value, int> = 0>\n- 159 T& asMatrix(T& t)\n- 160 {\n- 161 return t;\n- 162 }\n- 163\n- 165 template::value, int> = 0>\n- 167 const T& asMatrix(const T& t)\n- 168 {\n- 169 return t;\n- 170 }\n- 171\n- 174} // end namespace Impl\n- 175\n- 176 template\n- 177 struct FieldTraits> : public FieldTraits> {};\n- 178\n- 179 template\n- 180 struct DenseMatVecTraits>\n- 181 {\n- 182 using derived_type = Impl::ScalarMatrixView;\n- 183 using row_type = Impl::ScalarVectorView;\n- 184 using row_reference = row_type&;\n- 185 using const_row_reference = const row_type&;\n- 186 using value_type = std::remove_const_t;\n- 187 using size_type = std::size_t;\n- 188 };\n- 189\n- 190\n- 191 template\n- 192 struct AutonomousValueType>\n- 193 {\n- 194 using type = FieldMatrix,1,1>;\n- 195 };\n- 196\n- 197\n- 198} // end namespace Dune\n- 199\n- 200#endif // DUNE_COMMON_SCALARMATRIXVIEW_HH\n-matvectraits.hh\n-Documentation of the traits classes you need to write for each implementation\n-of DenseVector or Dense...\n-densematrix.hh\n-Implements a matrix constructed from a given type representing a field and a\n-compile-time given numbe...\n-scalarvectorview.hh\n-Implements a scalar vector view wrapper around an existing scalar.\n-boundschecking.hh\n-Macro for wrapping boundary checks.\n-fmatrix.hh\n-Implements a matrix constructed from a given type representing a field and\n-compile-time given number ...\n-typetraits.hh\n-Traits for type conversions and type information.\n-DUNE_ASSERT_BOUNDS\n-#define DUNE_ASSERT_BOUNDS(cond)\n-If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do\n-nothing.\n-Definition: boundschecking.hh:30\n-Dune::operator<<\n-std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)\n-Definition: bigunsignedint.hh:278\n+ 130\n+131 MPIFuture& operator=(MPIFuture&& f){\n+ 132 std::swap(req_, f.req_);\n+ 133 std::swap(status_, f.status_);\n+ 134 std::swap(data_, f.data_);\n+ 135 std::swap(send_data_, f.send_data_);\n+ 136 return *this;\n+ 137 }\n+ 138\n+139 bool valid() const{\n+ 140 return (bool)data_;\n+ 141 }\n+ 142\n+143 void wait(){\n+ 144 if(!valid())\n+ 145 DUNE_THROW(InvalidFutureException, \"The MPIFuture is not valid!\");\n+ 146 MPI_Wait(&req_, &status_);\n+ 147 }\n+ 148\n+149 bool ready() const{\n+ 150 int flag = -1;\n+ 151 MPI_Test(&req_, &flag, &status_);\n+ 152 return flag;\n+ 153 }\n+ 154\n+155 R get() {\n+ 156 wait();\n+ 157 return data_.get();\n+ 158 }\n+ 159\n+160 S get_send_data(){\n+ 161 wait();\n+ 162 return send_data_.get();\n+ 163 }\n+ 164\n+165 auto get_mpidata(){\n+ 166 return getMPIData(*data_);\n+ 167 }\n+ 168\n+169 auto get_send_mpidata(){\n+ 170 return getMPIData(*send_data_);\n+ 171 }\n+ 172 };\n+ 173\n+ 174}\n+ 175#endif\n+ 176#endif\n+future.hh\n+communication.hh\n+Implements an utility class that provides collective communication methods for\n+sequential programs.\n+mpidata.hh\n+Interface class to translate objects to a MPI_Datatype, void* and size used for\n+MPI calls.\n+Dune::operator*\n+bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)\n+Definition: bigunsignedint.hh:549\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::DenseMatrix<_ScalarMatrixView<_K_>_>::cols\n-constexpr size_type cols() const\n-number of columns\n-Definition: densematrix.hh:715\n-Dune::DenseMatrix<_ScalarMatrixView<_K_>_>::rows\n-constexpr size_type rows() const\n-number of rows\n-Definition: densematrix.hh:709\n-Dune::DenseMatrix<_ScalarMatrixView<_K_>_>::blocklevel\n-static constexpr int blocklevel\n-The number of block levels we contain. This is the leaf, that is, 1.\n-Definition: densematrix.hh:178\n-Dune::DenseMatrix<_ScalarMatrixView<_K_>_>::row_type\n-Traits::row_type row_type\n-The type used to represent a row (must fulfill the Dune::DenseVector interface)\n-Definition: densematrix.hh:169\n-Dune::DenseMatrix<_ScalarMatrixView<_K_>_>::size_type\n-Traits::size_type size_type\n-The type used for the index access and size operation.\n-Definition: densematrix.hh:166\n-Dune::DenseMatrix<_ScalarMatrixView<_K_>_>::const_row_reference\n-Traits::const_row_reference const_row_reference\n-The type used to represent a reference to a constant row (usually const\n-row_type &)\n-Definition: densematrix.hh:175\n-Dune::DenseMatrix<_ScalarMatrixView<_K_>_>::row_reference\n-Traits::row_reference row_reference\n-The type used to represent a reference to a row (usually row_type &)\n-Definition: densematrix.hh:172\n-Dune::AutonomousValueType::type\n-T type\n-Definition: typetraits.hh:501\n+Dune::getMPIData\n+auto getMPIData(T &t)\n+Definition: mpidata.hh:43\n+Dune::swap\n+void swap(T &v1, T &v2, bool mask)\n+Definition: simd.hh:472\n+Dune::Communication\n+Collective communication interface and sequential default implementation.\n+Definition: communication.hh:100\n+Dune::InvalidFutureException\n+This exception is thrown when ready(), wait() or get() is called on an invalid\n+future....\n+Definition: future.hh:18\n+Dune::impl::Buffer\n+Definition: mpifuture.hh:19\n+Dune::impl::Buffer::value\n+std::unique_ptr< T > value\n+Definition: mpifuture.hh:28\n+Dune::impl::Buffer::operator*\n+T & operator*() const\n+Definition: mpifuture.hh:37\n+Dune::impl::Buffer::Buffer\n+Buffer(V &&t)\n+Definition: mpifuture.hh:25\n+Dune::impl::Buffer::get\n+T get()\n+Definition: mpifuture.hh:29\n+Dune::impl::Buffer::Buffer\n+Buffer(bool valid)\n+Definition: mpifuture.hh:20\n+Dune::impl::Buffer<_T_&_>::value\n+std::optional< std::reference_wrapper< T > > value\n+Definition: mpifuture.hh:53\n+Dune::impl::Buffer<_T_&_>::Buffer\n+Buffer(bool valid=false)\n+Definition: mpifuture.hh:44\n+Dune::impl::Buffer<_T_&_>::get\n+T & get()\n+Definition: mpifuture.hh:54\n+Dune::impl::Buffer<_T_&_>::Buffer\n+Buffer(V &&t)\n+Definition: mpifuture.hh:50\n+Dune::impl::Buffer<_void_>::valid_\n+bool valid_\n+Definition: mpifuture.hh:69\n+Dune::impl::Buffer<_void_>::get\n+void get()\n+Definition: mpifuture.hh:76\n+Dune::impl::Buffer<_void_>::Buffer\n+Buffer(bool valid=false)\n+Definition: mpifuture.hh:70\n+Dune::MPIFuture\n+Provides a future-like object for MPI communication. It contains the object\n+that will be received and...\n+Definition: mpifuture.hh:85\n+Dune::MPIFuture::MPIFuture\n+MPIFuture(V &&recv_data, typename std::enable_if_t::value >\n+*=0)\n+Definition: mpifuture.hh:107\n+Dune::MPIFuture::ready\n+bool ready() const\n+Definition: mpifuture.hh:149\n+Dune::MPIFuture::valid\n+bool valid() const\n+Definition: mpifuture.hh:139\n+Dune::MPIFuture::~MPIFuture\n+~MPIFuture()\n+Definition: mpifuture.hh:112\n+Dune::MPIFuture::MPIFuture\n+MPIFuture(bool valid=false)\n+Definition: mpifuture.hh:92\n+Dune::MPIFuture::operator=\n+MPIFuture & operator=(MPIFuture &&f)\n+Definition: mpifuture.hh:131\n+Dune::MPIFuture::get_send_mpidata\n+auto get_send_mpidata()\n+Definition: mpifuture.hh:169\n+Dune::MPIFuture::wait\n+void wait()\n+Definition: mpifuture.hh:143\n+Dune::MPIFuture::get_mpidata\n+auto get_mpidata()\n+Definition: mpifuture.hh:165\n+Dune::MPIFuture::get\n+R get()\n+Definition: mpifuture.hh:155\n+Dune::MPIFuture::MPIFuture\n+MPIFuture(V &&recv_data, U &&send_data, typename std::enable_if_t::value &&!std::is_void< U >::value > *=0)\n+Definition: mpifuture.hh:99\n+Dune::MPIFuture::get_send_data\n+S get_send_data()\n+Definition: mpifuture.hh:160\n+Dune::MPIFuture::MPIFuture\n+MPIFuture(MPIFuture &&f)\n+Definition: mpifuture.hh:122\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00071.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00071.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: dotproduct.hh File Reference\n+dune-common: communication.hh File Reference\n \n \n \n \n \n \n \n@@ -58,60 +58,71 @@\n \n \n \n \n \n
    \n \n-
    dotproduct.hh File Reference
    \n+
    communication.hh File Reference
    \n
    \n
    \n \n-

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

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

    \n-
    #include "ftraits.hh"
    \n-#include "typetraits.hh"
    \n+
    #include <iostream>
    \n+#include <complex>
    \n+#include <algorithm>
    \n+#include <vector>
    \n+#include <dune/common/binaryfunctions.hh>
    \n+#include <dune/common/exceptions.hh>
    \n+#include <dune/common/parallel/future.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n+\n \n-\n+\n+\n \n

    \n Classes

    struct  Dune::IsVector< T, class >
    struct  Dune::No_Comm
     
    struct  Dune::IsVector< T, std::void_t< typename T::field_type > >
    class  Dune::Communication< Communicator >
     Collective communication interface and sequential default implementation. More...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+\n+\n+\n+\n+

    \n+Typedefs

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

    \n Functions

    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 More...
     
    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. More...
     
    bool Dune::operator== (const No_Comm &, const No_Comm &)
     Comparison operator for MPI compatibility. More...
     
    bool Dune::operator!= (const No_Comm &, const No_Comm &)
     Comparison operator for MPI compatibility. More...
     
    \n

    Detailed Description

    \n-

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

    \n-

    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\u00f6 Fahlke, Matthias Wohlmuth
    \n+

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

    \n+

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

    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "encoding", "source2": "encoding", "unified_diff": "@@ -1 +1 @@\n-utf-8\n+us-ascii\n"}, {"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,50 +4,51 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces | Functions\n-dotproduct.hh File Reference\n-Provides the functions dot(a,b) := [$a^H \\cdot b $] and dotT(a,b) := [$a^T\n-\\cdot b $]. More...\n-#include \"ftraits.hh\"\n-#include \"typetraits.hh\"\n+ * parallel\n+Classes | Namespaces | Typedefs | Functions\n+communication.hh File Reference\n+Common \u00bb Parallel_Communication | Common \u00bb Parallel_Communication\n+Implements an utility class that provides collective communication methods for\n+sequential programs. More...\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::IsVector<_T,_class_>\n+struct \u00a0Dune::No_Comm\n \u00a0\n-struct \u00a0Dune::IsVector<_T,_std::void_t<_typename_T::field_type_>_>\n+ class \u00a0Dune::Communication<_Communicator_>\n+\u00a0 Collective communication interface and sequential default\n+ implementation. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+ Typedefs\n+template\n+using\u00a0Dune::CollectiveCommunication = Communication< T >\n+\u00a0\n Functions\n-template\n-auto\u00a0Dune::dot (const A &a, const B &b) -> typename std::enable_if< IsNumber<\n- A >::value &&!IsVector< A >::value &&!std::is_same< typename FieldTraits<\n- A >::field_type, typename FieldTraits< A >::real_type > ::value, decltype\n- (conj(a) *b)>::type\n-\u00a0 computes the dot product for fundamental data types according to Petsc's\n- VectDot function: dot(a,b) := std::conj(a)*b More...\n-\u00a0\n-template\n-auto\u00a0Dune::dotT (const A &a, const B &b) -> decltype(a *b)\n-\u00a0 Computes an indefinite vector dot product for fundamental data types\n- according to Petsc's VectTDot function: dotT(a,b) := a*b. More...\n+bool\u00a0Dune::operator== (const No_Comm &, const No_Comm &)\n+\u00a0 Comparison operator for MPI compatibility. More...\n+\u00a0\n+bool\u00a0Dune::operator!= (const No_Comm &, const No_Comm &)\n+\u00a0 Comparison operator for MPI compatibility. More...\n \u00a0\n ***** Detailed Description *****\n-Provides the functions dot(a,b) := [$a^H \\cdot b $] and dotT(a,b) := [$a^T\n-\\cdot b $].\n-The provided dot products dot,dotT are used to compute (indefinite) dot\n-products for fundamental types as well as DUNE vector types, such as\n-DenseVector, FieldVector, ISTLVector. Note that the definition of dot(a,b)\n-conjugates the first argument. This agrees with the behaviour of Matlab and\n-Petsc, but not with BLAS.\n- Author\n- J\u00f6 Fahlke, Matthias Wohlmuth\n+Implements an utility class that provides collective communication methods for\n+sequential programs.\n+An abstraction to the basic methods of parallel communication, following the\n+message-passing paradigm.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00071_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: dotproduct.hh Source File\n+dune-common: communication.hh Source File\n \n \n \n \n \n \n \n@@ -58,79 +58,342 @@\n \n
    \n \n \n
    \n
    \n-
    dotproduct.hh
    \n+
    communication.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_DOTPRODUCT_HH
    \n-
    6#define DUNE_DOTPRODUCT_HH
    \n-
    7
    \n-
    8#include "ftraits.hh"
    \n-
    9#include "typetraits.hh"
    \n-
    10
    \n-
    11namespace Dune {
    \n-
    26 template<class T, class = void>
    \n-
    27 struct IsVector : std::false_type {};
    \n-
    28
    \n-
    29 template<class T>
    \n-
    30 struct IsVector<T, std::void_t<typename T::field_type> >
    \n-
    31 : std::true_type {};
    \n-
    32
    \n-
    40 template<class A, class B>
    \n-
    41 auto
    \n-
    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
    \n-
    43 {
    \n-
    44 return conj(a)*b;
    \n-
    45 }
    \n-
    46
    \n-
    56 // fundamental type with A being a real type
    \n-
    57 template<class A, class B>
    \n-
    58 auto
    \n-
    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
    \n-
    60 {
    \n-
    61 return a*b;
    \n-
    62 }
    \n-
    63
    \n-
    73 template<typename A, typename B>
    \n-
    74 auto
    \n-
    75 dot(const A & a, const B & b) -> typename std::enable_if<IsVector<A>::value, decltype(a.dot(b))>::type
    \n-
    76 {
    \n-
    77 return a.dot(b);
    \n-
    78 }
    \n-
    88 template<class A, class B>
    \n-
    89 auto
    \n-
    90 dotT(const A & a, const B & b) -> decltype(a*b)
    \n-
    91 {
    \n-
    92 return a*b;
    \n-
    93 }
    \n-
    94
    \n-
    96} // end namespace DUNE
    \n-
    97
    \n-
    98#endif // DUNE_DOTPRODUCT_HH
    \n-
    Type traits to determine the type of reals (when working with complex numbers)
    \n-
    Traits for type conversions and type information.
    \n-
    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
    \n-
    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
    \n-
    STL namespace.
    \n+
    5#ifndef DUNE_COMMON_PARALLEL_COMMUNICATION_HH
    \n+
    6#define DUNE_COMMON_PARALLEL_COMMUNICATION_HH
    \n+
    14#include <iostream>
    \n+
    15#include <complex>
    \n+
    16#include <algorithm>
    \n+
    17#include <vector>
    \n+
    18
    \n+\n+\n+\n+
    22
    \n+
    42namespace Dune
    \n+
    43{
    \n+
    44
    \n+
    45 /* define some type that definitely differs from MPI_Comm */
    \n+
    46 struct No_Comm {};
    \n+
    47
    \n+
    52 inline bool operator==(const No_Comm&, const No_Comm&)
    \n+
    53 {
    \n+
    54 return true;
    \n+
    55 }
    \n+
    56
    \n+
    61 inline bool operator!=(const No_Comm&, const No_Comm&)
    \n+
    62 {
    \n+
    63 return false;
    \n+
    64 }
    \n+
    65
    \n+
    98 template<typename Communicator>
    \n+\n+
    100 {
    \n+
    101 public:
    \n+\n+
    104 {}
    \n+
    105
    \n+
    110 Communication (const Communicator&)
    \n+
    111 {}
    \n+
    112
    \n+
    114 int rank () const
    \n+
    115 {
    \n+
    116 return 0;
    \n+
    117 }
    \n+
    118
    \n+
    120 operator No_Comm() const
    \n+
    121 {
    \n+
    122 return {};
    \n+
    123 }
    \n+
    124
    \n+
    126 int size () const
    \n+
    127 {
    \n+
    128 return 1;
    \n+
    129 }
    \n+
    130
    \n+
    134 template<class T>
    \n+
    135 int send([[maybe_unused]] const T& data,
    \n+
    136 [[maybe_unused]] int dest_rank,
    \n+
    137 [[maybe_unused]] int tag)
    \n+
    138 {
    \n+
    139 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    \n+
    140 }
    \n+
    141
    \n+
    145 template<class T>
    \n+
    146 PseudoFuture<T> isend([[maybe_unused]] const T&& data,
    \n+
    147 [[maybe_unused]] int dest_rank,
    \n+
    148 [[maybe_unused]] int tag)
    \n+
    149 {
    \n+
    150 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    \n+
    151 }
    \n+
    152
    \n+
    156 template<class T>
    \n+
    157 T recv([[maybe_unused]] T&& data,
    \n+
    158 [[maybe_unused]] int source_rank,
    \n+
    159 [[maybe_unused]] int tag,
    \n+
    160 [[maybe_unused]] void* status = 0)
    \n+
    161 {
    \n+
    162 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    \n+
    163 }
    \n+
    164
    \n+
    168 template<class T>
    \n+
    169 PseudoFuture<T> irecv([[maybe_unused]] T&& data,
    \n+
    170 [[maybe_unused]] int source_rank,
    \n+
    171 [[maybe_unused]] int tag)
    \n+
    172 {
    \n+
    173 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    \n+
    174 }
    \n+
    175
    \n+
    176 template<class T>
    \n+
    177 T rrecv([[maybe_unused]] T&& data,
    \n+
    178 [[maybe_unused]] int source_rank,
    \n+
    179 [[maybe_unused]] int tag,
    \n+
    180 [[maybe_unused]] void* status = 0) const
    \n+
    181 {
    \n+
    182 DUNE_THROW(ParallelError, "This method is not supported in sequential programs");
    \n+
    183 }
    \n+
    187 template<typename T>
    \n+
    188 T sum (const T& in) const
    \n+
    189 {
    \n+
    190 return in;
    \n+
    191 }
    \n+
    192
    \n+
    198 template<typename T>
    \n+
    199 int sum ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    \n+
    200 {
    \n+
    201 return 0;
    \n+
    202 }
    \n+
    203
    \n+
    207 template<typename T>
    \n+
    208 T prod (const T& in) const
    \n+
    209 {
    \n+
    210 return in;
    \n+
    211 }
    \n+
    212
    \n+
    218 template<typename T>
    \n+
    219 int prod ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    \n+
    220 {
    \n+
    221 return 0;
    \n+
    222 }
    \n+
    223
    \n+
    227 template<typename T>
    \n+
    228 T min (const T& in) const
    \n+
    229 {
    \n+
    230 return in;
    \n+
    231 }
    \n+
    232
    \n+
    238 template<typename T>
    \n+
    239 int min ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    \n+
    240 {
    \n+
    241 return 0;
    \n+
    242 }
    \n+
    243
    \n+
    247 template<typename T>
    \n+
    248 T max (const T& in) const
    \n+
    249 {
    \n+
    250 return in;
    \n+
    251 }
    \n+
    252
    \n+
    258 template<typename T>
    \n+
    259 int max ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const
    \n+
    260 {
    \n+
    261 return 0;
    \n+
    262 }
    \n+
    263
    \n+
    267 int barrier () const
    \n+
    268 {
    \n+
    269 return 0;
    \n+
    270 }
    \n+
    271
    \n+\n+
    276 {
    \n+
    277 return {true}; // return a valid future
    \n+
    278 }
    \n+
    279
    \n+
    283 template<typename T>
    \n+
    284 int broadcast ([[maybe_unused]] T* inout,
    \n+
    285 [[maybe_unused]] int len,
    \n+
    286 [[maybe_unused]] int root) const
    \n+
    287 {
    \n+
    288 return 0;
    \n+
    289 }
    \n+
    290
    \n+
    294 template<class T>
    \n+
    295 PseudoFuture<T> ibroadcast(T&& data, int root) const{
    \n+
    296 return {std::forward<T>(data)};
    \n+
    297 }
    \n+
    298
    \n+
    299
    \n+
    312 template<typename T>
    \n+
    313 int gather (const T* in, T* out, int len, [[maybe_unused]] int root) const // note out must have same size as in
    \n+
    314 {
    \n+
    315 for (int i=0; i<len; i++)
    \n+
    316 out[i] = in[i];
    \n+
    317 return 0;
    \n+
    318 }
    \n+
    319
    \n+
    323 template<class TIN, class TOUT = std::vector<TIN>>
    \n+
    324 PseudoFuture<TOUT> igather(TIN&& data_in, TOUT&& data_out, int root){
    \n+
    325 *(data_out.begin()) = std::forward<TIN>(data_in);
    \n+
    326 return {std::forward<TOUT>(data_out)};
    \n+
    327 }
    \n+
    328
    \n+
    329
    \n+
    349 template<typename T>
    \n+
    350 int gatherv (const T* in,
    \n+
    351 int sendDataLen,
    \n+
    352 T* out,
    \n+
    353 [[maybe_unused]] int* recvDataLen,
    \n+
    354 int* displ,
    \n+
    355 [[maybe_unused]] int root) const
    \n+
    356 {
    \n+
    357 for (int i=*displ; i<sendDataLen; i++)
    \n+
    358 out[i] = in[i];
    \n+
    359 return 0;
    \n+
    360 }
    \n+
    361
    \n+
    375 template<typename T>
    \n+
    376 int scatter (const T* sendData, T* recvData, int len, [[maybe_unused]] int root) const // note out must have same size as in
    \n+
    377 {
    \n+
    378 for (int i=0; i<len; i++)
    \n+
    379 recvData[i] = sendData[i];
    \n+
    380 return 0;
    \n+
    381 }
    \n+
    382
    \n+
    386 template<class TIN, class TOUT = TIN>
    \n+
    387 PseudoFuture<TOUT> iscatter(TIN&& data_in, TOUT&& data_out, int root){
    \n+
    388 data_out = *(std::forward<TIN>(data_in).begin());
    \n+
    389 return {std::forward<TOUT>(data_out)};
    \n+
    390 }
    \n+
    391
    \n+
    410 template<typename T>
    \n+
    411 int scatterv (const T* sendData,int* sendDataLen, int* displ, T* recvData,
    \n+
    412 [[maybe_unused]] int recvDataLen, [[maybe_unused]] int root) const
    \n+
    413 {
    \n+
    414 for (int i=*displ; i<*sendDataLen; i++)
    \n+
    415 recvData[i] = sendData[i];
    \n+
    416 return 0;
    \n+
    417 }
    \n+
    418
    \n+
    432 template<typename T>
    \n+
    433 int allgather(const T* sbuf, int count, T* rbuf) const
    \n+
    434 {
    \n+
    435 for(const T* end=sbuf+count; sbuf < end; ++sbuf, ++rbuf)
    \n+
    436 *rbuf=*sbuf;
    \n+
    437 return 0;
    \n+
    438 }
    \n+
    439
    \n+
    444 template<class TIN, class TOUT = TIN>
    \n+
    445 PseudoFuture<TOUT> iallgather(TIN&& data_in, TOUT&& data_out){
    \n+
    446 return {std::forward<TOUT>(data_out)};
    \n+
    447 }
    \n+
    448
    \n+
    465 template<typename T>
    \n+
    466 int allgatherv (const T* in, int sendDataLen, T* out, [[maybe_unused]] int* recvDataLen, int* displ) const
    \n+
    467 {
    \n+
    468 for (int i=*displ; i<sendDataLen; i++)
    \n+
    469 out[i] = in[i];
    \n+
    470 return 0;
    \n+
    471 }
    \n+
    472
    \n+
    485 template<typename BinaryFunction, typename Type>
    \n+
    486 int allreduce([[maybe_unused]] Type* inout, [[maybe_unused]] int len) const
    \n+
    487 {
    \n+
    488 return 0;
    \n+
    489 }
    \n+
    490
    \n+
    495 template<class BinaryFunction, class TIN, class TOUT = TIN>
    \n+
    496 PseudoFuture<TOUT> iallreduce(TIN&& data_in, TOUT&& data_out){
    \n+
    497 data_out = std::forward<TIN>(data_in);
    \n+
    498 return {std::forward<TOUT>(data_out)};
    \n+
    499 }
    \n+
    500
    \n+
    505 template<class BinaryFunction, class T>
    \n+\n+
    507 return {std::forward<T>(data)};
    \n+
    508 }
    \n+
    509
    \n+
    510
    \n+
    524 template<typename BinaryFunction, typename Type>
    \n+
    525 int allreduce(const Type* in, Type* out, int len) const
    \n+
    526 {
    \n+
    527 std::copy(in, in+len, out);
    \n+
    528 return 0;
    \n+
    529 }
    \n+
    530
    \n+
    531 };
    \n+
    532
    \n+
    538 template<class T>
    \n+\n+
    540 [[deprecated("CollectiveCommunication is deprecated. Use Communication instead.")]]
    \n+\n+
    542}
    \n+
    543
    \n+
    544#endif
    \n+\n+
    helper classes to provide unique types for standard functions
    \n+
    A few common exception classes.
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition: iteratorfacades.hh:237
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition: iteratorfacades.hh:259
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    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:90
    \n-
    Definition: dotproduct.hh:27
    \n-
    T real_type
    export the type representing the real type of the field
    Definition: ftraits.hh:30
    \n+
    Default exception if an error in the parallel communication of the program occurred.
    Definition: exceptions.hh:287
    \n+
    Definition: communication.hh:46
    \n+
    Collective communication interface and sequential default implementation.
    Definition: communication.hh:100
    \n+
    PseudoFuture< TOUT > iallreduce(TIN &&data_in, TOUT &&data_out)
    Compute something over all processes nonblocking.
    Definition: communication.hh:496
    \n+
    int send(const T &data, int dest_rank, int tag)
    Sends the data to the dest_rank.
    Definition: communication.hh:135
    \n+
    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
    \n+
    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
    \n+
    int rank() const
    Return rank, is between 0 and size()-1.
    Definition: communication.hh:114
    \n+
    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
    \n+
    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
    \n+
    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
    \n+
    T recv(T &&data, int source_rank, int tag, void *status=0)
    Receives the data from the source_rank.
    Definition: communication.hh:157
    \n+
    PseudoFuture< T > isend(const T &&data, int dest_rank, int tag)
    Sends the data to the dest_rank nonblocking.
    Definition: communication.hh:146
    \n+
    PseudoFuture< void > ibarrier() const
    Nonblocking barrier.
    Definition: communication.hh:275
    \n+
    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
    \n+
    int size() const
    Number of processes in set, is greater than 0.
    Definition: communication.hh:126
    \n+
    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
    \n+
    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
    \n+
    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
    \n+
    PseudoFuture< T > irecv(T &&data, int source_rank, int tag)
    Receives the data from the source_rank nonblocking.
    Definition: communication.hh:169
    \n+
    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
    \n+
    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
    \n+
    int allgather(const T *sbuf, int count, T *rbuf) const
    Gathers data from all tasks and distribute it to all.
    Definition: communication.hh:433
    \n+
    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
    \n+
    int gather(const T *in, T *out, int len, int root) const
    Gather arrays on root task.
    Definition: communication.hh:313
    \n+
    PseudoFuture< T > iallreduce(T &&data)
    Compute something over all processes nonblocking and in-place.
    Definition: communication.hh:506
    \n+
    Communication(const Communicator &)
    Constructor with a given communicator.
    Definition: communication.hh:110
    \n+
    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
    \n+
    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
    \n+
    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
    \n+
    T rrecv(T &&data, int source_rank, int tag, void *status=0) const
    Definition: communication.hh:177
    \n+
    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
    \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 ...
    Definition: communication.hh:239
    \n+
    int barrier() const
    Wait until all processes have arrived at this point in the program.
    Definition: communication.hh:267
    \n+
    PseudoFuture< TOUT > igather(TIN &&data_in, TOUT &&data_out, int root)
    Gather arrays on root task nonblocking.
    Definition: communication.hh:324
    \n+
    PseudoFuture< TOUT > iallgather(TIN &&data_in, TOUT &&data_out)
    Gathers data from all tasks and distribute it to all nonblocking.
    Definition: communication.hh:445
    \n+
    Communication()
    Construct default object.
    Definition: communication.hh:103
    \n+
    A wrapper-class for a object which is ready immediately.
    Definition: future.hh:122
    \n+
    Definition: future.hh:160
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,100 +4,484 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-dotproduct.hh\n+ * parallel\n+communication.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_DOTPRODUCT_HH\n- 6#define DUNE_DOTPRODUCT_HH\n- 7\n- 8#include \"ftraits.hh\"\n- 9#include \"typetraits.hh\"\n- 10\n- 11namespace Dune {\n- 26 template\n-27 struct IsVector : std::false_type {};\n- 28\n- 29 template\n-30 struct IsVector >\n- 31 : std::true_type {};\n- 32\n- 40 template\n- 41 auto\n-42 dot(const A & a, const B & b) -> typename std::enable_if::value\n-&& !IsVector::value && !std::is_same::\n-field_type,typename FieldTraits::real_type> ::value, decltype(conj(a)*b)>::\n-type\n- 43 {\n- 44 return conj(a)*b;\n- 45 }\n- 46\n- 56 // fundamental type with A being a real type\n- 57 template\n- 58 auto\n- 59 dot(const A & a, const B & b) -> typename std::enable_if::value\n-&& !IsVector::value && std::is_same::\n-field_type,typename FieldTraits::real_type>::value, decltype(a*b)>::type\n- 60 {\n- 61 return a*b;\n- 62 }\n- 63\n- 73 template\n- 74 auto\n- 75 dot(const A & a, const B & b) -> typename std::enable_if::\n-value, decltype(a.dot(b))>::type\n- 76 {\n- 77 return a.dot(b);\n- 78 }\n- 88 template\n- 89 auto\n-90 dotT(const A & a, const B & b) -> decltype(a*b)\n- 91 {\n- 92 return a*b;\n- 93 }\n- 94\n- 96} // end namespace DUNE\n- 97\n- 98#endif // DUNE_DOTPRODUCT_HH\n-ftraits.hh\n-Type traits to determine the type of reals (when working with complex numbers)\n-typetraits.hh\n-Traits for type conversions and type information.\n-Dune::dot\n-auto dot(const A &a, const B &b) -> typename std::enable_if< IsNumber< A >::\n-value &&!IsVector< A >::value &&!std::is_same< typename FieldTraits< A >::\n-field_type, typename FieldTraits< A >::real_type > ::value, decltype(conj(a)\n-*b)>::type\n-computes the dot product for fundamental data types according to Petsc's\n-VectDot function: dot(a,...\n-Definition: dotproduct.hh:42\n-Dune::void_t\n-typename Impl::voider< Types... >::type void_t\n-Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.\n-Definition: typetraits.hh:40\n-std\n-STL namespace.\n+ 5#ifndef DUNE_COMMON_PARALLEL_COMMUNICATION_HH\n+ 6#define DUNE_COMMON_PARALLEL_COMMUNICATION_HH\n+ 14#include \n+ 15#include \n+ 16#include \n+ 17#include \n+ 18\n+ 19#include \n+ 20#include \n+ 21#include \n+ 22\n+ 42namespace Dune\n+ 43{\n+ 44\n+ 45 /* define some type that definitely differs from MPI_Comm */\n+46 struct No_Comm {};\n+ 47\n+52 inline bool operator==(const No_Comm&, const No_Comm&)\n+ 53 {\n+ 54 return true;\n+ 55 }\n+ 56\n+61 inline bool operator!=(const No_Comm&, const No_Comm&)\n+ 62 {\n+ 63 return false;\n+ 64 }\n+ 65\n+ 98 template\n+99 class Communication\n+ 100 {\n+ 101 public:\n+103 Communication()\n+ 104 {}\n+ 105\n+110 Communication (const Communicator&)\n+ 111 {}\n+ 112\n+114 int rank () const\n+ 115 {\n+ 116 return 0;\n+ 117 }\n+ 118\n+120 operator No_Comm() const\n+ 121 {\n+ 122 return {};\n+ 123 }\n+ 124\n+126 int size () const\n+ 127 {\n+ 128 return 1;\n+ 129 }\n+ 130\n+ 134 template\n+135 int send([[maybe_unused]] const T& data,\n+ 136 [[maybe_unused]] int dest_rank,\n+ 137 [[maybe_unused]] int tag)\n+ 138 {\n+ 139 DUNE_THROW(ParallelError, \"This method is not supported in sequential\n+programs\");\n+ 140 }\n+ 141\n+ 145 template\n+146 PseudoFuture isend([[maybe_unused]] const T&& data,\n+ 147 [[maybe_unused]] int dest_rank,\n+ 148 [[maybe_unused]] int tag)\n+ 149 {\n+ 150 DUNE_THROW(ParallelError, \"This method is not supported in sequential\n+programs\");\n+ 151 }\n+ 152\n+ 156 template\n+157 T recv([[maybe_unused]] T&& data,\n+ 158 [[maybe_unused]] int source_rank,\n+ 159 [[maybe_unused]] int tag,\n+ 160 [[maybe_unused]] void* status = 0)\n+ 161 {\n+ 162 DUNE_THROW(ParallelError, \"This method is not supported in sequential\n+programs\");\n+ 163 }\n+ 164\n+ 168 template\n+169 PseudoFuture irecv([[maybe_unused]] T&& data,\n+ 170 [[maybe_unused]] int source_rank,\n+ 171 [[maybe_unused]] int tag)\n+ 172 {\n+ 173 DUNE_THROW(ParallelError, \"This method is not supported in sequential\n+programs\");\n+ 174 }\n+ 175\n+ 176 template\n+177 T rrecv([[maybe_unused]] T&& data,\n+ 178 [[maybe_unused]] int source_rank,\n+ 179 [[maybe_unused]] int tag,\n+ 180 [[maybe_unused]] void* status = 0) const\n+ 181 {\n+ 182 DUNE_THROW(ParallelError, \"This method is not supported in sequential\n+programs\");\n+ 183 }\n+ 187 template\n+188 T sum (const T& in) const\n+ 189 {\n+ 190 return in;\n+ 191 }\n+ 192\n+ 198 template\n+199 int sum ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const\n+ 200 {\n+ 201 return 0;\n+ 202 }\n+ 203\n+ 207 template\n+208 T prod (const T& in) const\n+ 209 {\n+ 210 return in;\n+ 211 }\n+ 212\n+ 218 template\n+219 int prod ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const\n+ 220 {\n+ 221 return 0;\n+ 222 }\n+ 223\n+ 227 template\n+228 T min (const T& in) const\n+ 229 {\n+ 230 return in;\n+ 231 }\n+ 232\n+ 238 template\n+239 int min ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const\n+ 240 {\n+ 241 return 0;\n+ 242 }\n+ 243\n+ 247 template\n+248 T max (const T& in) const\n+ 249 {\n+ 250 return in;\n+ 251 }\n+ 252\n+ 258 template\n+259 int max ([[maybe_unused]] T* inout, [[maybe_unused]] int len) const\n+ 260 {\n+ 261 return 0;\n+ 262 }\n+ 263\n+267 int barrier () const\n+ 268 {\n+ 269 return 0;\n+ 270 }\n+ 271\n+275 PseudoFuture ibarrier () const\n+ 276 {\n+ 277 return {true}; // return a valid future\n+ 278 }\n+ 279\n+ 283 template\n+284 int broadcast ([[maybe_unused]] T* inout,\n+ 285 [[maybe_unused]] int len,\n+ 286 [[maybe_unused]] int root) const\n+ 287 {\n+ 288 return 0;\n+ 289 }\n+ 290\n+ 294 template\n+295 PseudoFuture ibroadcast(T&& data, int root) const{\n+ 296 return {std::forward(data)};\n+ 297 }\n+ 298\n+ 299\n+ 312 template\n+313 int gather (const T* in, T* out, int len, [[maybe_unused]] int root) const\n+// note out must have same size as in\n+ 314 {\n+ 315 for (int i=0; i>\n+324 PseudoFuture igather(TIN&& data_in, TOUT&& data_out, int root){\n+ 325 *(data_out.begin()) = std::forward(data_in);\n+ 326 return {std::forward(data_out)};\n+ 327 }\n+ 328\n+ 329\n+ 349 template\n+350 int gatherv (const T* in,\n+ 351 int sendDataLen,\n+ 352 T* out,\n+ 353 [[maybe_unused]] int* recvDataLen,\n+ 354 int* displ,\n+ 355 [[maybe_unused]] int root) const\n+ 356 {\n+ 357 for (int i=*displ; i\n+376 int scatter (const T* sendData, T* recvData, int len, [[maybe_unused]] int\n+root) const // note out must have same size as in\n+ 377 {\n+ 378 for (int i=0; i\n+387 PseudoFuture iscatter(TIN&& data_in, TOUT&& data_out, int root){\n+ 388 data_out = *(std::forward(data_in).begin());\n+ 389 return {std::forward(data_out)};\n+ 390 }\n+ 391\n+ 410 template\n+411 int scatterv (const T* sendData,int* sendDataLen, int* displ, T* recvData,\n+ 412 [[maybe_unused]] int recvDataLen, [[maybe_unused]] int root) const\n+ 413 {\n+ 414 for (int i=*displ; i<*sendDataLen; i++)\n+ 415 recvData[i] = sendData[i];\n+ 416 return 0;\n+ 417 }\n+ 418\n+ 432 template\n+433 int allgather(const T* sbuf, int count, T* rbuf) const\n+ 434 {\n+ 435 for(const T* end=sbuf+count; sbuf < end; ++sbuf, ++rbuf)\n+ 436 *rbuf=*sbuf;\n+ 437 return 0;\n+ 438 }\n+ 439\n+ 444 template\n+445 PseudoFuture iallgather(TIN&& data_in, TOUT&& data_out){\n+ 446 return {std::forward(data_out)};\n+ 447 }\n+ 448\n+ 465 template\n+466 int allgatherv (const T* in, int sendDataLen, T* out, [[maybe_unused]] int*\n+recvDataLen, int* displ) const\n+ 467 {\n+ 468 for (int i=*displ; i\n+486 int allreduce([[maybe_unused]] Type* inout, [[maybe_unused]] int len) const\n+ 487 {\n+ 488 return 0;\n+ 489 }\n+ 490\n+ 495 template\n+496 PseudoFuture iallreduce(TIN&& data_in, TOUT&& data_out){\n+ 497 data_out = std::forward(data_in);\n+ 498 return {std::forward(data_out)};\n+ 499 }\n+ 500\n+ 505 template\n+506 PseudoFuture iallreduce(T&& data){\n+ 507 return {std::forward(data)};\n+ 508 }\n+ 509\n+ 510\n+ 524 template\n+525 int allreduce(const Type* in, Type* out, int len) const\n+ 526 {\n+ 527 std::copy(in, in+len, out);\n+ 528 return 0;\n+ 529 }\n+ 530\n+ 531 };\n+ 532\n+ 538 template\n+539 using CollectiveCommunication\n+ 540 [[deprecated(\"CollectiveCommunication is deprecated. Use Communication\n+instead.\")]]\n+ 541 = Communication;\n+ 542}\n+ 543\n+ 544#endif\n+future.hh\n+binaryfunctions.hh\n+helper classes to provide unique types for standard functions\n+exceptions.hh\n+A few common exception classes.\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+Dune::operator==\n+EnableIfInterOperable< T1, T2, bool >::type operator==(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for equality.\n+Definition: iteratorfacades.hh:237\n+Dune::operator!=\n+EnableIfInterOperable< T1, T2, bool >::type operator!=(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for inequality.\n+Definition: iteratorfacades.hh:259\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::dotT\n-auto dotT(const A &a, const B &b) -> decltype(a *b)\n-Computes an indefinite vector dot product for fundamental data types according\n-to Petsc's VectTDot fu...\n-Definition: dotproduct.hh:90\n-Dune::IsVector\n-Definition: dotproduct.hh:27\n-Dune::FieldTraits::real_type\n-T real_type\n-export the type representing the real type of the field\n-Definition: ftraits.hh:30\n+Dune::ParallelError\n+Default exception if an error in the parallel communication of the program\n+occurred.\n+Definition: exceptions.hh:287\n+Dune::No_Comm\n+Definition: communication.hh:46\n+Dune::Communication\n+Collective communication interface and sequential default implementation.\n+Definition: communication.hh:100\n+Dune::Communication::iallreduce\n+PseudoFuture< TOUT > iallreduce(TIN &&data_in, TOUT &&data_out)\n+Compute something over all processes nonblocking.\n+Definition: communication.hh:496\n+Dune::Communication::send\n+int send(const T &data, int dest_rank, int tag)\n+Sends the data to the dest_rank.\n+Definition: communication.hh:135\n+Dune::Communication::allreduce\n+int allreduce(const Type *in, Type *out, int len) const\n+Compute something over all processes for each component of an array and return\n+the result in every pr...\n+Definition: communication.hh:525\n+Dune::Communication::max\n+T max(const T &in) const\n+Compute the maximum of the argument over all processes and return the result in\n+every process....\n+Definition: communication.hh:248\n+Dune::Communication::rank\n+int rank() const\n+Return rank, is between 0 and size()-1.\n+Definition: communication.hh:114\n+Dune::Communication::sum\n+T sum(const T &in) const\n+Compute the sum of the argument over all processes and return the result in\n+every process....\n+Definition: communication.hh:188\n+Dune::Communication::scatterv\n+int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int\n+recvDataLen, int root) const\n+Scatter arrays of variable length from a root to all other tasks.\n+Definition: communication.hh:411\n+Dune::Communication::prod\n+int prod(T *inout, int len) const\n+Compute the product over all processes for each component of an array and\n+return the result in every ...\n+Definition: communication.hh:219\n+Dune::Communication::recv\n+T recv(T &&data, int source_rank, int tag, void *status=0)\n+Receives the data from the source_rank.\n+Definition: communication.hh:157\n+Dune::Communication::isend\n+PseudoFuture< T > isend(const T &&data, int dest_rank, int tag)\n+Sends the data to the dest_rank nonblocking.\n+Definition: communication.hh:146\n+Dune::Communication::ibarrier\n+PseudoFuture< void > ibarrier() const\n+Nonblocking barrier.\n+Definition: communication.hh:275\n+Dune::Communication::allreduce\n+int allreduce(Type *inout, int len) const\n+Compute something over all processes for each component of an array and return\n+the result in every pr...\n+Definition: communication.hh:486\n+Dune::Communication::size\n+int size() const\n+Number of processes in set, is greater than 0.\n+Definition: communication.hh:126\n+Dune::Communication::sum\n+int sum(T *inout, int len) const\n+Compute the sum over all processes for each component of an array and return\n+the result in every proc...\n+Definition: communication.hh:199\n+Dune::Communication::allgatherv\n+int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int\n+*displ) const\n+Gathers data of variable length from all tasks and distribute it to all.\n+Definition: communication.hh:466\n+Dune::Communication::min\n+T min(const T &in) const\n+Compute the minimum of the argument over all processes and return the result in\n+every process....\n+Definition: communication.hh:228\n+Dune::Communication::irecv\n+PseudoFuture< T > irecv(T &&data, int source_rank, int tag)\n+Receives the data from the source_rank nonblocking.\n+Definition: communication.hh:169\n+Dune::Communication::gatherv\n+int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ,\n+int root) const\n+Gather arrays of variable size on root task.\n+Definition: communication.hh:350\n+Dune::Communication::ibroadcast\n+PseudoFuture< T > ibroadcast(T &&data, int root) const\n+Distribute an array from the process with rank root to all other processes\n+nonblocking.\n+Definition: communication.hh:295\n+Dune::Communication::allgather\n+int allgather(const T *sbuf, int count, T *rbuf) const\n+Gathers data from all tasks and distribute it to all.\n+Definition: communication.hh:433\n+Dune::Communication::scatter\n+int scatter(const T *sendData, T *recvData, int len, int root) const\n+Scatter array from a root to all other task.\n+Definition: communication.hh:376\n+Dune::Communication::gather\n+int gather(const T *in, T *out, int len, int root) const\n+Gather arrays on root task.\n+Definition: communication.hh:313\n+Dune::Communication::iallreduce\n+PseudoFuture< T > iallreduce(T &&data)\n+Compute something over all processes nonblocking and in-place.\n+Definition: communication.hh:506\n+Dune::Communication::Communication\n+Communication(const Communicator &)\n+Constructor with a given communicator.\n+Definition: communication.hh:110\n+Dune::Communication::max\n+int max(T *inout, int len) const\n+Compute the maximum over all processes for each component of an array and\n+return the result in every ...\n+Definition: communication.hh:259\n+Dune::Communication::prod\n+T prod(const T &in) const\n+Compute the product of the argument over all processes and return the result in\n+every process....\n+Definition: communication.hh:208\n+Dune::Communication::broadcast\n+int broadcast(T *inout, int len, int root) const\n+Distribute an array from the process with rank root to all other processes.\n+Definition: communication.hh:284\n+Dune::Communication::rrecv\n+T rrecv(T &&data, int source_rank, int tag, void *status=0) const\n+Definition: communication.hh:177\n+Dune::Communication::iscatter\n+PseudoFuture< TOUT > iscatter(TIN &&data_in, TOUT &&data_out, int root)\n+Scatter array from a root to all other task nonblocking.\n+Definition: communication.hh:387\n+Dune::Communication::min\n+int min(T *inout, int len) const\n+Compute the minimum over all processes for each component of an array and\n+return the result in every ...\n+Definition: communication.hh:239\n+Dune::Communication::barrier\n+int barrier() const\n+Wait until all processes have arrived at this point in the program.\n+Definition: communication.hh:267\n+Dune::Communication::igather\n+PseudoFuture< TOUT > igather(TIN &&data_in, TOUT &&data_out, int root)\n+Gather arrays on root task nonblocking.\n+Definition: communication.hh:324\n+Dune::Communication::iallgather\n+PseudoFuture< TOUT > iallgather(TIN &&data_in, TOUT &&data_out)\n+Gathers data from all tasks and distribute it to all nonblocking.\n+Definition: communication.hh:445\n+Dune::Communication::Communication\n+Communication()\n+Construct default object.\n+Definition: communication.hh:103\n+Dune::PseudoFuture\n+A wrapper-class for a object which is ready immediately.\n+Definition: future.hh:122\n+Dune::PseudoFuture<_void_>\n+Definition: future.hh:160\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00074.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00074.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: propertymap.hh File Reference\n+dune-common: mpitraits.hh File Reference\n \n \n \n \n \n \n \n@@ -58,84 +58,51 @@\n \n \n \n \n \n
    \n \n-
    propertymap.hh File Reference
    \n+Namespaces
    \n+
    mpitraits.hh File Reference
    \n \n
    \n+\n+

    Traits classes for mapping types onto MPI_Datatype. \n+More...

    \n
    #include <cstddef>
    \n-#include <iterator>
    \n+#include <cstdint>
    \n #include <type_traits>
    \n+#include <utility>
    \n+#include <complex>
    \n+#include <mpi.h>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n \n

    \n Classes

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

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n-\n-\n

    \n-Functions

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

    Detailed Description

    \n+

    Traits classes for mapping types onto MPI_Datatype.

    \n+
    Author
    Markus Blatt
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,67 +4,35 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces | Functions\n-propertymap.hh File Reference\n+ * parallel\n+Classes | Namespaces\n+mpitraits.hh File Reference\n+Common \u00bb Parallel_Communication\n+Traits classes for mapping types onto MPI_Datatype. More...\n #include \n-#include \n+#include \n #include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::PropertyMapTraits<_PM_>\n-\u00a0\n-struct \u00a0Dune::ReadablePropertyMapTag\n-\u00a0 Tag for the category of readable property maps. More...\n-\u00a0\n-struct \u00a0Dune::WritablePropertyMapTag\n-\u00a0 Tag for the category of writable property maps. More...\n-\u00a0\n-struct \u00a0Dune::ReadWritePropertyMapTag\n-\u00a0 Tag for the category of readable and writable property maps. More...\n-\u00a0\n-struct \u00a0Dune::LvaluePropertyMapTag\n-\u00a0 Tag for the category of lvalue property maps. More...\n-\u00a0\n-struct \u00a0Dune::PropertyMapTraits<_T_*_>\n-\u00a0\n-struct \u00a0Dune::PropertyMapTraits<_const_T_*_>\n-\u00a0\n-struct \u00a0Dune::RAPropertyMapHelper<_Reference,_PropertyMap_>\n-\u00a0\n- class \u00a0Dune::IteratorPropertyMap<_RAI,_IM,_T,_R_>\n-\u00a0 Adapter to turn a random access iterator into a property map. More...\n-\u00a0\n- class \u00a0Dune::AssociativePropertyMap<_T_>\n-\u00a0 An adapter to turn an unique associative container into a property\n- map. More...\n-\u00a0\n- class \u00a0Dune::ConstAssociativePropertyMap<_T_>\n-\u00a0 An adaptor to turn an unique associative container into a property\n- map. More...\n-\u00a0\n-struct \u00a0Dune::IdentityMap\n-\u00a0 A property map that applies the identity function to integers. More...\n-\u00a0\n-struct \u00a0Dune::PropertyMapTypeSelector<_T,_C_>\n-\u00a0 Selector for the property map type. More...\n+struct \u00a0Dune::MPITraits<_T_>\n+\u00a0 A traits class describing the mapping of types onto MPI_Datatypes.\n+ More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n- Functions\n-template\n-Reference\u00a0Dune::get (const RAPropertyMapHelper< Reference, PropertyMap >\n- &pmap, const Key &key)\n-\u00a0\n-template\n- void\u00a0Dune::put (const RAPropertyMapHelper< Reference, PropertyMap >\n- &pmap, const Key &key, const Value &value)\n-\u00a0\n+***** Detailed Description *****\n+Traits classes for mapping types onto MPI_Datatype.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00074_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: propertymap.hh Source File\n+dune-common: mpitraits.hh Source File\n \n \n \n \n \n \n \n@@ -58,273 +58,214 @@\n \n \n \n \n \n
    \n-
    propertymap.hh
    \n+
    mpitraits.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_PROPERTYMAP_HH
    \n-
    6#define DUNE_PROPERTYMAP_HH
    \n+
    5#ifndef DUNE_MPITRAITS_HH
    \n+
    6#define DUNE_MPITRAITS_HH
    \n
    7
    \n-
    8#include <cstddef>
    \n-
    9#include <iterator>
    \n-
    10#include <type_traits>
    \n-
    11
    \n-
    12namespace Dune
    \n-
    13{
    \n-
    14
    \n-
    15 template<class PM>
    \n-\n-
    17 {
    \n-
    21 typedef typename PM::KeyType KeyType;
    \n-
    25 typedef typename PM::ValueType ValueType;
    \n-
    29 typedef typename PM::Reference Reference;
    \n-
    33 typedef typename PM::Category Category;
    \n-
    34 };
    \n-
    35
    \n-\n-
    38 {};
    \n-
    39
    \n-\n-
    42 {};
    \n-
    43
    \n-\n-\n-
    50 {};
    \n-
    51
    \n-\n-\n-
    57 {};
    \n-
    58
    \n-
    59 template<class T>
    \n-\n-
    61 {
    \n-
    62 typedef T ValueType;
    \n-\n-
    64 typedef std::ptrdiff_t KeyType;
    \n-\n-
    66 };
    \n-
    67
    \n-
    68
    \n-
    69 template<class T>
    \n-
    70 struct PropertyMapTraits<const T*>
    \n-
    71 {
    \n-
    72 typedef T ValueType;
    \n-
    73 typedef const ValueType& Reference;
    \n-
    74 typedef std::ptrdiff_t KeyType;
    \n-\n-
    76 };
    \n-
    77
    \n-
    78 template<class Reference, class PropertyMap>
    \n-\n-
    80 {};
    \n-
    81
    \n-
    82 template<class Reference, class PropertyMap, class Key>
    \n-
    83 inline Reference
    \n-\n-
    85 const Key& key)
    \n-
    86 {
    \n-
    87 return static_cast<const PropertyMap&>(pmap)[key];
    \n-
    88 }
    \n-
    89
    \n-
    90 template<class Reference, class PropertyMap, class Key, class Value>
    \n-
    91 inline void
    \n-\n-
    93 const Key& key, const Value& value)
    \n-
    94 {
    \n-
    95 static_assert(std::is_convertible<typename PropertyMap::Category,WritablePropertyMapTag>::value,
    \n-
    96 "WritablePropertyMapTag required!");
    \n-
    97 static_cast<const PropertyMap&>(pmap)[key] = value;
    \n-
    98 }
    \n-
    99
    \n-
    103 template<class RAI, class IM,
    \n-
    104 class T = typename std::iterator_traits<RAI>::value_type,
    \n-
    105 class R = typename std::iterator_traits<RAI>::reference>
    \n-\n-
    107 : public RAPropertyMapHelper<R,IteratorPropertyMap<RAI,IM,T,R> >
    \n-
    108 {
    \n-
    109 public:
    \n-\n-
    114
    \n-
    120 typedef IM IndexMap;
    \n-
    121
    \n-
    125 typedef typename IndexMap::KeyType KeyType;
    \n-
    126
    \n-
    130 typedef T ValueType;
    \n-
    131
    \n-
    135 typedef R Reference;
    \n-
    136
    \n-\n-
    141
    \n-\n-
    150 const IndexMap& im=IndexMap())
    \n-
    151 : iter_(iter), indexMap_(im)
    \n-
    152 {}
    \n-
    153
    \n-\n-
    156 : iter_(), indexMap_()
    \n-
    157 {}
    \n-
    158
    \n-
    160 inline Reference operator[](KeyType key) const
    \n-
    161 {
    \n-
    162 return *(iter_ + get(indexMap_, key));
    \n-
    163 }
    \n-
    164
    \n-
    165 private:
    \n-\n-
    169 IndexMap indexMap_;
    \n+
    18#if HAVE_MPI
    \n+
    19
    \n+
    20#include <cstddef>
    \n+
    21#include <cstdint>
    \n+
    22#include <type_traits>
    \n+
    23#include <utility>
    \n+
    24#include <complex>
    \n+
    25
    \n+
    26#include <mpi.h>
    \n+
    27
    \n+
    28namespace Dune
    \n+
    29{
    \n+
    39 template<typename T>
    \n+
    40 struct MPITraits
    \n+
    41 {
    \n+
    42 private:
    \n+
    43 MPITraits(){}
    \n+
    44 MPITraits(const MPITraits&){}
    \n+
    45 static MPI_Datatype datatype;
    \n+
    46 static MPI_Datatype vectortype;
    \n+
    47 public:
    \n+
    48 static inline MPI_Datatype getType()
    \n+
    49 {
    \n+
    50 if(datatype==MPI_DATATYPE_NULL) {
    \n+
    51 MPI_Type_contiguous(sizeof(T),MPI_BYTE,&datatype);
    \n+
    52 MPI_Type_commit(&datatype);
    \n+
    53 }
    \n+
    54 return datatype;
    \n+
    55 }
    \n+
    56 static constexpr bool is_intrinsic = false;
    \n+
    57 };
    \n+
    58 template<class T>
    \n+
    59 MPI_Datatype MPITraits<T>::datatype = MPI_DATATYPE_NULL;
    \n+
    60
    \n+
    61#ifndef DOXYGEN
    \n+
    62
    \n+
    63 // A Macro for defining traits for the primitive data types
    \n+
    64#define ComposeMPITraits(p,m) \\
    \n+
    65 template<> \\
    \n+
    66 struct MPITraits<p>{ \\
    \n+
    67 static inline MPI_Datatype getType(){ \\
    \n+
    68 return m; \\
    \n+
    69 } \\
    \n+
    70 static constexpr bool is_intrinsic = true; \\
    \n+
    71 }
    \n+
    72
    \n+
    73 ComposeMPITraits(char, MPI_CHAR);
    \n+
    74 ComposeMPITraits(unsigned char,MPI_UNSIGNED_CHAR);
    \n+
    75 ComposeMPITraits(short,MPI_SHORT);
    \n+
    76 ComposeMPITraits(unsigned short,MPI_UNSIGNED_SHORT);
    \n+
    77 ComposeMPITraits(int,MPI_INT);
    \n+
    78 ComposeMPITraits(unsigned int,MPI_UNSIGNED);
    \n+
    79 ComposeMPITraits(long,MPI_LONG);
    \n+
    80 ComposeMPITraits(unsigned long,MPI_UNSIGNED_LONG);
    \n+
    81 ComposeMPITraits(float,MPI_FLOAT);
    \n+
    82 ComposeMPITraits(double,MPI_DOUBLE);
    \n+
    83 ComposeMPITraits(long double,MPI_LONG_DOUBLE);
    \n+
    84 ComposeMPITraits(std::complex<double>, MPI_CXX_DOUBLE_COMPLEX);
    \n+
    85 ComposeMPITraits(std::complex<long double>, MPI_CXX_LONG_DOUBLE_COMPLEX);
    \n+
    86 ComposeMPITraits(std::complex<float>, MPI_CXX_FLOAT_COMPLEX);
    \n+
    87
    \n+
    88
    \n+
    89#undef ComposeMPITraits
    \n+
    90
    \n+
    91 template<class K, int n> class FieldVector;
    \n+
    92
    \n+
    93 template<class K, int n>
    \n+
    94 struct MPITraits<FieldVector<K,n> >
    \n+
    95 {
    \n+
    96 static MPI_Datatype datatype;
    \n+
    97 static MPI_Datatype vectortype;
    \n+
    98
    \n+
    99 static inline MPI_Datatype getType()
    \n+
    100 {
    \n+
    101 if(datatype==MPI_DATATYPE_NULL) {
    \n+
    102 MPI_Type_contiguous(n, MPITraits<K>::getType(), &vectortype);
    \n+
    103 MPI_Type_commit(&vectortype);
    \n+
    104 FieldVector<K,n> fvector;
    \n+
    105 MPI_Aint base;
    \n+
    106 MPI_Aint displ;
    \n+
    107 MPI_Get_address(&fvector, &base);
    \n+
    108 MPI_Get_address(&(fvector[0]), &displ);
    \n+
    109 displ -= base;
    \n+
    110 int length[1]={1};
    \n+
    111
    \n+
    112 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
    \n+
    113 MPI_Type_commit(&datatype);
    \n+
    114 }
    \n+
    115 return datatype;
    \n+
    116 }
    \n+
    117
    \n+
    118 };
    \n+
    119
    \n+
    120 template<class K, int n>
    \n+
    121 MPI_Datatype MPITraits<FieldVector<K,n> >::datatype = MPI_DATATYPE_NULL;
    \n+
    122 template<class K, int n>
    \n+
    123 MPI_Datatype MPITraits<FieldVector<K,n> >::vectortype = {MPI_DATATYPE_NULL};
    \n+
    124
    \n+
    125
    \n+
    126 template<int k>
    \n+
    127 class bigunsignedint;
    \n+
    128
    \n+
    129 template<int k>
    \n+
    130 struct MPITraits<bigunsignedint<k> >
    \n+
    131 {
    \n+
    132 static MPI_Datatype datatype;
    \n+
    133 static MPI_Datatype vectortype;
    \n+
    134
    \n+
    135 static inline MPI_Datatype getType()
    \n+
    136 {
    \n+
    137 if(datatype==MPI_DATATYPE_NULL) {
    \n+\n+
    139 &vectortype);
    \n+
    140 //MPI_Type_commit(&vectortype);
    \n+
    141 bigunsignedint<k> data;
    \n+
    142 MPI_Aint base;
    \n+
    143 MPI_Aint displ;
    \n+
    144 MPI_Get_address(&data, &base);
    \n+
    145 MPI_Get_address(&(data.digit), &displ);
    \n+
    146 displ -= base;
    \n+
    147 int length[1]={1};
    \n+
    148 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
    \n+
    149 MPI_Type_commit(&datatype);
    \n+
    150 }
    \n+
    151 return datatype;
    \n+
    152 }
    \n+
    153 };
    \n+
    154}
    \n+
    155
    \n+
    156namespace Dune
    \n+
    157{
    \n+
    158 template<int k>
    \n+
    159 MPI_Datatype MPITraits<bigunsignedint<k> >::datatype = MPI_DATATYPE_NULL;
    \n+
    160 template<int k>
    \n+
    161 MPI_Datatype MPITraits<bigunsignedint<k> >::vectortype = MPI_DATATYPE_NULL;
    \n+
    162
    \n+
    163 template<typename T1, typename T2>
    \n+
    164 struct MPITraits<std::pair<T1,T2 > >
    \n+
    165 {
    \n+
    166 public:
    \n+
    167 inline static MPI_Datatype getType();
    \n+
    168 private:
    \n+
    169 static MPI_Datatype type;
    \n
    170 };
    \n-
    171
    \n-
    176 template<typename T>
    \n-\n-
    178 : RAPropertyMapHelper<typename T::value_type::second_type&,
    \n-
    179 AssociativePropertyMap<T> >
    \n-
    180 {
    \n-
    184 typedef T UniqueAssociativeContainer;
    \n-
    185
    \n-
    189 typedef typename UniqueAssociativeContainer::value_type::first_type
    \n-
    190 KeyType;
    \n-
    191
    \n-
    195 typedef typename UniqueAssociativeContainer::value_type::second_type
    \n-
    196 ValueType;
    \n-
    197
    \n-
    201 typedef ValueType& Reference;
    \n+
    171 template<typename T1, typename T2>
    \n+
    172 MPI_Datatype MPITraits<std::pair<T1,T2> >::getType()
    \n+
    173 {
    \n+
    174 if(type==MPI_DATATYPE_NULL) {
    \n+
    175 int length[2] = {1, 1};
    \n+
    176 MPI_Aint disp[2];
    \n+
    177 MPI_Datatype types[2] = {MPITraits<T1>::getType(),
    \n+\n+
    179
    \n+
    180 using Pair = std::pair<T1, T2>;
    \n+
    181 static_assert(std::is_standard_layout<Pair>::value, "offsetof() is only defined for standard layout types");
    \n+
    182 disp[0] = offsetof(Pair, first);
    \n+
    183 disp[1] = offsetof(Pair, second);
    \n+
    184
    \n+
    185 MPI_Datatype tmp;
    \n+
    186 MPI_Type_create_struct(2, length, disp, types, &tmp);
    \n+
    187
    \n+
    188 MPI_Type_create_resized(tmp, 0, sizeof(Pair), &type);
    \n+
    189 MPI_Type_commit(&type);
    \n+
    190
    \n+
    191 MPI_Type_free(&tmp);
    \n+
    192 }
    \n+
    193 return type;
    \n+
    194 }
    \n+
    195
    \n+
    196 template<typename T1, typename T2>
    \n+
    197 MPI_Datatype MPITraits<std::pair<T1,T2> >::type=MPI_DATATYPE_NULL;
    \n+
    198
    \n+
    199#endif // !DOXYGEN
    \n+
    200
    \n+
    201} // namespace Dune
    \n
    202
    \n-\n-
    207
    \n-\n-
    210 : map_(0)
    \n-
    211 {}
    \n-
    212
    \n-
    214 inline AssociativePropertyMap(UniqueAssociativeContainer& map)
    \n-
    215 : map_(&map)
    \n-
    216 {}
    \n-
    217
    \n-
    222 inline Reference operator[](KeyType key) const
    \n-
    223 {
    \n-
    224 return map_->find(key)->second;
    \n-
    225 }
    \n-
    226 private:
    \n-
    227 UniqueAssociativeContainer* map_;
    \n-
    228 };
    \n-
    229
    \n-
    234 template<typename T>
    \n-\n-
    236 : RAPropertyMapHelper<const typename T::value_type::second_type&,
    \n-
    237 ConstAssociativePropertyMap<T> >
    \n-
    238 {
    \n-
    242 typedef T UniqueAssociativeContainer;
    \n-
    243
    \n-
    247 typedef typename UniqueAssociativeContainer::value_type::first_type
    \n-
    248 KeyType;
    \n-
    249
    \n-
    253 typedef typename UniqueAssociativeContainer::value_type::second_type
    \n-
    254 ValueType;
    \n-
    255
    \n-
    259 typedef const ValueType& Reference;
    \n-
    260
    \n-\n-
    265
    \n-\n-
    268 : map_(0)
    \n-
    269 {}
    \n-
    270
    \n-
    272 inline ConstAssociativePropertyMap(const UniqueAssociativeContainer& map)
    \n-
    273 : map_(&map)
    \n-
    274 {}
    \n-
    275
    \n-
    280 inline Reference operator[](KeyType key) const
    \n-
    281 {
    \n-
    282 return map_->find(key)->second;
    \n-
    283 }
    \n-
    284 private:
    \n-
    285 const UniqueAssociativeContainer* map_;
    \n-
    286 };
    \n-
    287
    \n-\n-
    292 : public RAPropertyMapHelper<std::size_t, IdentityMap>
    \n-
    293 {
    \n-
    295 typedef std::size_t KeyType;
    \n-
    296
    \n-
    298 typedef std::size_t ValueType;
    \n-
    299
    \n-
    301 typedef std::size_t Reference;
    \n-
    302
    \n-\n-
    305
    \n-
    306 inline ValueType operator[](const KeyType& key) const
    \n-
    307 {
    \n-
    308 return key;
    \n-
    309 }
    \n-
    310 };
    \n-
    311
    \n-
    312
    \n-
    318 template<typename T, typename C>
    \n-\n-
    320 {
    \n-
    324 typedef T Tag;
    \n-
    329 typedef C Container;
    \n-
    330 };
    \n-
    331
    \n-
    332}
    \n-
    333
    \n-
    334#endif
    \n+
    203#endif // HAVE_MPI
    \n+
    204
    \n+
    207#endif
    \n+
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    void put(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key, const Value &value)
    Definition: propertymap.hh:92
    \n-
    Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
    Definition: propertymap.hh:84
    \n-
    Definition: propertymap.hh:17
    \n-
    PM::ValueType ValueType
    The type of the values of the property map.
    Definition: propertymap.hh:25
    \n-
    PM::Category Category
    The category the property map belongs to.
    Definition: propertymap.hh:33
    \n-
    PM::Reference Reference
    The type of the reference to the values.
    Definition: propertymap.hh:29
    \n-
    PM::KeyType KeyType
    The type of the key of the property map.
    Definition: propertymap.hh:21
    \n-
    Tag for the category of readable property maps.
    Definition: propertymap.hh:38
    \n-
    Tag for the category of writable property maps.
    Definition: propertymap.hh:42
    \n-
    Tag for the category of readable and writable property maps.
    Definition: propertymap.hh:50
    \n-
    Tag for the category of lvalue property maps.
    Definition: propertymap.hh:57
    \n-
    ValueType & Reference
    Definition: propertymap.hh:63
    \n-
    std::ptrdiff_t KeyType
    Definition: propertymap.hh:64
    \n-
    T ValueType
    Definition: propertymap.hh:62
    \n-
    LvaluePropertyMapTag Category
    Definition: propertymap.hh:65
    \n-
    std::ptrdiff_t KeyType
    Definition: propertymap.hh:74
    \n-
    const ValueType & Reference
    Definition: propertymap.hh:73
    \n-
    T ValueType
    Definition: propertymap.hh:72
    \n-
    LvaluePropertyMapTag Category
    Definition: propertymap.hh:75
    \n-
    Definition: propertymap.hh:80
    \n-
    Adapter to turn a random access iterator into a property map.
    Definition: propertymap.hh:108
    \n-
    IndexMap::KeyType KeyType
    The key type of the property map.
    Definition: propertymap.hh:125
    \n-
    R Reference
    The reference type of the property map.
    Definition: propertymap.hh:135
    \n-
    T ValueType
    The value type of the property map.
    Definition: propertymap.hh:130
    \n-
    Reference operator[](KeyType key) const
    Access the a value by reference.
    Definition: propertymap.hh:160
    \n-
    IteratorPropertyMap(RandomAccessIterator iter, const IndexMap &im=IndexMap())
    Constructor.
    Definition: propertymap.hh:149
    \n-
    IteratorPropertyMap()
    Constructor.
    Definition: propertymap.hh:155
    \n-
    IM IndexMap
    The type of the index map.
    Definition: propertymap.hh:120
    \n-
    RAI RandomAccessIterator
    The type of the random access iterator.
    Definition: propertymap.hh:113
    \n-
    LvaluePropertyMapTag Category
    The category of this property map.
    Definition: propertymap.hh:140
    \n-
    An adapter to turn an unique associative container into a property map.
    Definition: propertymap.hh:180
    \n-
    An adaptor to turn an unique associative container into a property map.
    Definition: propertymap.hh:238
    \n-
    A property map that applies the identity function to integers.
    Definition: propertymap.hh:293
    \n-
    std::size_t ValueType
    The value type of the map.
    Definition: propertymap.hh:298
    \n-
    std::size_t KeyType
    The key type of the map.
    Definition: propertymap.hh:295
    \n-
    ValueType operator[](const KeyType &key) const
    Definition: propertymap.hh:306
    \n-
    std::size_t Reference
    The reference type of the map.
    Definition: propertymap.hh:301
    \n-
    ReadablePropertyMapTag Category
    The category of the map.
    Definition: propertymap.hh:304
    \n-
    Selector for the property map type.
    Definition: propertymap.hh:320
    \n-
    T Tag
    the tag identifying the property.
    Definition: propertymap.hh:324
    \n-
    C Container
    The container type to whose entries the properties are attached.
    Definition: propertymap.hh:329
    \n+
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition: mpitraits.hh:41
    \n+
    static MPI_Datatype getType()
    Definition: mpitraits.hh:48
    \n+
    static constexpr bool is_intrinsic
    Definition: mpitraits.hh:56
    \n+
    static constexpr int n
    Definition: bigunsignedint.hh:78
    \n+
    vector space out of a tensor product of fields.
    Definition: fvector.hh:95
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,369 +4,224 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-propertymap.hh\n+ * parallel\n+mpitraits.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_PROPERTYMAP_HH\n- 6#define DUNE_PROPERTYMAP_HH\n+ 5#ifndef DUNE_MPITRAITS_HH\n+ 6#define DUNE_MPITRAITS_HH\n 7\n- 8#include \n- 9#include \n- 10#include \n- 11\n- 12namespace Dune\n- 13{\n- 14\n- 15 template\n-16 struct PropertyMapTraits\n- 17 {\n-21 typedef typename PM::KeyType KeyType;\n-25 typedef typename PM::ValueType ValueType;\n-29 typedef typename PM::Reference Reference;\n-33 typedef typename PM::Category Category;\n- 34 };\n- 35\n-37 struct ReadablePropertyMapTag\n- 38 {};\n- 39\n-41 struct WritablePropertyMapTag\n- 42 {};\n- 43\n-48 struct ReadWritePropertyMapTag\n- 49 : public ReadablePropertyMapTag, public WritablePropertyMapTag\n- 50 {};\n- 51\n-55 struct LvaluePropertyMapTag\n- 56 : public ReadWritePropertyMapTag\n- 57 {};\n- 58\n- 59 template\n-60 struct PropertyMapTraits\n- 61 {\n-62 typedef T ValueType;\n-63 typedef ValueType& Reference;\n-64 typedef std::ptrdiff_t KeyType;\n-65 typedef LvaluePropertyMapTag Category;\n- 66 };\n- 67\n- 68\n- 69 template\n-70 struct PropertyMapTraits\n- 71 {\n-72 typedef T ValueType;\n-73 typedef const ValueType& Reference;\n-74 typedef std::ptrdiff_t KeyType;\n-75 typedef LvaluePropertyMapTag Category;\n- 76 };\n- 77\n- 78 template\n-79 struct RAPropertyMapHelper\n- 80 {};\n- 81\n- 82 template\n- 83 inline Reference\n-84 get(const RAPropertyMapHelper& pmap,\n- 85 const Key& key)\n- 86 {\n- 87 return static_cast(pmap)[key];\n- 88 }\n- 89\n- 90 template\n- 91 inline void\n-92 put(const RAPropertyMapHelper& pmap,\n- 93 const Key& key, const Value& value)\n- 94 {\n- 95 static_assert(std::is_convertible::value,\n- 96 \"WritablePropertyMapTag required!\");\n- 97 static_cast(pmap)[key] = value;\n- 98 }\n- 99\n- 103 template::value_type,\n- 105 class R = typename std::iterator_traits::reference>\n-106 class IteratorPropertyMap\n- 107 : public RAPropertyMapHelper >\n- 108 {\n- 109 public:\n-113 typedef RAI RandomAccessIterator;\n- 114\n-120 typedef IM IndexMap;\n- 121\n-125 typedef typename IndexMap::KeyType KeyType;\n- 126\n-130 typedef T ValueType;\n- 131\n-135 typedef R Reference;\n- 136\n-140 typedef LvaluePropertyMapTag Category;\n- 141\n-149 inline IteratorPropertyMap(RandomAccessIterator iter,\n- 150 const IndexMap& im=IndexMap())\n- 151 : iter_(iter), indexMap_(im)\n- 152 {}\n- 153\n-155 inline IteratorPropertyMap()\n- 156 : iter_(), indexMap_()\n- 157 {}\n- 158\n-160 inline Reference operator[](KeyType key) const\n- 161 {\n- 162 return *(iter_ + get(indexMap_, key));\n- 163 }\n- 164\n- 165 private:\n- 167 RandomAccessIterator iter_;\n- 169 IndexMap indexMap_;\n+ 18#if HAVE_MPI\n+ 19\n+ 20#include \n+ 21#include \n+ 22#include \n+ 23#include \n+ 24#include \n+ 25\n+ 26#include \n+ 27\n+ 28namespace Dune\n+ 29{\n+ 39 template\n+40 struct MPITraits\n+ 41 {\n+ 42 private:\n+ 43 MPITraits(){}\n+ 44 MPITraits(const MPITraits&){}\n+ 45 static MPI_Datatype datatype;\n+ 46 static MPI_Datatype vectortype;\n+ 47 public:\n+48 static inline MPI_Datatype getType()\n+ 49 {\n+ 50 if(datatype==MPI_DATATYPE_NULL) {\n+ 51 MPI_Type_contiguous(sizeof(T),MPI_BYTE,&datatype);\n+ 52 MPI_Type_commit(&datatype);\n+ 53 }\n+ 54 return datatype;\n+ 55 }\n+56 static constexpr bool is_intrinsic = false;\n+ 57 };\n+ 58 template\n+ 59 MPI_Datatype MPITraits::datatype = MPI_DATATYPE_NULL;\n+ 60\n+ 61#ifndef DOXYGEN\n+ 62\n+ 63 // A Macro for defining traits for the primitive data types\n+ 64#define ComposeMPITraits(p,m) \\\n+ 65 template<> \\\n+ 66 struct MPITraits

    { \\\n+ 67 static inline MPI_Datatype getType(){ \\\n+ 68 return m; \\\n+ 69 } \\\n+ 70 static constexpr bool is_intrinsic = true; \\\n+ 71 }\n+ 72\n+ 73 ComposeMPITraits(char, MPI_CHAR);\n+ 74 ComposeMPITraits(unsigned char,MPI_UNSIGNED_CHAR);\n+ 75 ComposeMPITraits(short,MPI_SHORT);\n+ 76 ComposeMPITraits(unsigned short,MPI_UNSIGNED_SHORT);\n+ 77 ComposeMPITraits(int,MPI_INT);\n+ 78 ComposeMPITraits(unsigned int,MPI_UNSIGNED);\n+ 79 ComposeMPITraits(long,MPI_LONG);\n+ 80 ComposeMPITraits(unsigned long,MPI_UNSIGNED_LONG);\n+ 81 ComposeMPITraits(float,MPI_FLOAT);\n+ 82 ComposeMPITraits(double,MPI_DOUBLE);\n+ 83 ComposeMPITraits(long double,MPI_LONG_DOUBLE);\n+ 84 ComposeMPITraits(std::complex, MPI_CXX_DOUBLE_COMPLEX);\n+ 85 ComposeMPITraits(std::complex, MPI_CXX_LONG_DOUBLE_COMPLEX);\n+ 86 ComposeMPITraits(std::complex, MPI_CXX_FLOAT_COMPLEX);\n+ 87\n+ 88\n+ 89#undef ComposeMPITraits\n+ 90\n+ 91 template class FieldVector;\n+ 92\n+ 93 template\n+ 94 struct MPITraits >\n+ 95 {\n+ 96 static MPI_Datatype datatype;\n+ 97 static MPI_Datatype vectortype;\n+ 98\n+ 99 static inline MPI_Datatype getType()\n+ 100 {\n+ 101 if(datatype==MPI_DATATYPE_NULL) {\n+ 102 MPI_Type_contiguous(n, MPITraits::getType(), &vectortype);\n+ 103 MPI_Type_commit(&vectortype);\n+ 104 FieldVector fvector;\n+ 105 MPI_Aint base;\n+ 106 MPI_Aint displ;\n+ 107 MPI_Get_address(&fvector, &base);\n+ 108 MPI_Get_address(&(fvector[0]), &displ);\n+ 109 displ -= base;\n+ 110 int length[1]={1};\n+ 111\n+ 112 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);\n+ 113 MPI_Type_commit(&datatype);\n+ 114 }\n+ 115 return datatype;\n+ 116 }\n+ 117\n+ 118 };\n+ 119\n+ 120 template\n+ 121 MPI_Datatype MPITraits >::datatype = MPI_DATATYPE_NULL;\n+ 122 template\n+ 123 MPI_Datatype MPITraits >::vectortype =\n+{MPI_DATATYPE_NULL};\n+ 124\n+ 125\n+ 126 template\n+ 127 class bigunsignedint;\n+ 128\n+ 129 template\n+ 130 struct MPITraits >\n+ 131 {\n+ 132 static MPI_Datatype datatype;\n+ 133 static MPI_Datatype vectortype;\n+ 134\n+ 135 static inline MPI_Datatype getType()\n+ 136 {\n+ 137 if(datatype==MPI_DATATYPE_NULL) {\n+ 138 MPI_Type_contiguous(bigunsignedint::n, MPITraits::\n+getType(),\n+ 139 &vectortype);\n+ 140 //MPI_Type_commit(&vectortype);\n+ 141 bigunsignedint data;\n+ 142 MPI_Aint base;\n+ 143 MPI_Aint displ;\n+ 144 MPI_Get_address(&data, &base);\n+ 145 MPI_Get_address(&(data.digit), &displ);\n+ 146 displ -= base;\n+ 147 int length[1]={1};\n+ 148 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);\n+ 149 MPI_Type_commit(&datatype);\n+ 150 }\n+ 151 return datatype;\n+ 152 }\n+ 153 };\n+ 154}\n+ 155\n+ 156namespace Dune\n+ 157{\n+ 158 template\n+ 159 MPI_Datatype MPITraits >::datatype = MPI_DATATYPE_NULL;\n+ 160 template\n+ 161 MPI_Datatype MPITraits >::vectortype =\n+MPI_DATATYPE_NULL;\n+ 162\n+ 163 template\n+ 164 struct MPITraits >\n+ 165 {\n+ 166 public:\n+ 167 inline static MPI_Datatype getType();\n+ 168 private:\n+ 169 static MPI_Datatype type;\n 170 };\n- 171\n- 176 template\n-177 class AssociativePropertyMap\n- 178 : RAPropertyMapHelper >\n- 180 {\n- 184 typedef T UniqueAssociativeContainer;\n- 185\n- 189 typedef typename UniqueAssociativeContainer::value_type::first_type\n- 190 KeyType;\n- 191\n- 195 typedef typename UniqueAssociativeContainer::value_type::second_type\n- 196 ValueType;\n- 197\n- 201 typedef ValueType& Reference;\n+ 171 template\n+ 172 MPI_Datatype MPITraits >::getType()\n+ 173 {\n+ 174 if(type==MPI_DATATYPE_NULL) {\n+ 175 int length[2] = {1, 1};\n+ 176 MPI_Aint disp[2];\n+ 177 MPI_Datatype types[2] = {MPITraits::getType(),\n+ 178 MPITraits::getType()};\n+ 179\n+ 180 using Pair = std::pair;\n+ 181 static_assert(std::is_standard_layout::value, \"offsetof() is only\n+defined for standard layout types\");\n+ 182 disp[0] = offsetof(Pair, first);\n+ 183 disp[1] = offsetof(Pair, second);\n+ 184\n+ 185 MPI_Datatype tmp;\n+ 186 MPI_Type_create_struct(2, length, disp, types, &tmp);\n+ 187\n+ 188 MPI_Type_create_resized(tmp, 0, sizeof(Pair), &type);\n+ 189 MPI_Type_commit(&type);\n+ 190\n+ 191 MPI_Type_free(&tmp);\n+ 192 }\n+ 193 return type;\n+ 194 }\n+ 195\n+ 196 template\n+ 197 MPI_Datatype MPITraits >::type=MPI_DATATYPE_NULL;\n+ 198\n+ 199#endif // !DOXYGEN\n+ 200\n+ 201} // namespace Dune\n 202\n- 206 typedef LvaluePropertyMapTag Category;\n- 207\n- 209 inline AssociativePropertyMap()\n- 210 : map_(0)\n- 211 {}\n- 212\n- 214 inline AssociativePropertyMap(UniqueAssociativeContainer& map)\n- 215 : map_(&map)\n- 216 {}\n- 217\n- 222 inline Reference operator[](KeyType key) const\n- 223 {\n- 224 return map_->find(key)->second;\n- 225 }\n- 226 private:\n- 227 UniqueAssociativeContainer* map_;\n- 228 };\n- 229\n- 234 template\n-235 class ConstAssociativePropertyMap\n- 236 : RAPropertyMapHelper >\n- 238 {\n- 242 typedef T UniqueAssociativeContainer;\n- 243\n- 247 typedef typename UniqueAssociativeContainer::value_type::first_type\n- 248 KeyType;\n- 249\n- 253 typedef typename UniqueAssociativeContainer::value_type::second_type\n- 254 ValueType;\n- 255\n- 259 typedef const ValueType& Reference;\n- 260\n- 264 typedef LvaluePropertyMapTag Category;\n- 265\n- 267 inline ConstAssociativePropertyMap()\n- 268 : map_(0)\n- 269 {}\n- 270\n- 272 inline ConstAssociativePropertyMap(const UniqueAssociativeContainer& map)\n- 273 : map_(&map)\n- 274 {}\n- 275\n- 280 inline Reference operator[](KeyType key) const\n- 281 {\n- 282 return map_->find(key)->second;\n- 283 }\n- 284 private:\n- 285 const UniqueAssociativeContainer* map_;\n- 286 };\n- 287\n-291 struct IdentityMap\n- 292 : public RAPropertyMapHelper\n- 293 {\n-295 typedef std::size_t KeyType;\n- 296\n-298 typedef std::size_t ValueType;\n- 299\n-301 typedef std::size_t Reference;\n- 302\n-304 typedef ReadablePropertyMapTag Category;\n- 305\n-306 inline ValueType operator[](const KeyType& key) const\n- 307 {\n- 308 return key;\n- 309 }\n- 310 };\n- 311\n- 312\n- 318 template\n-319 struct PropertyMapTypeSelector\n- 320 {\n-324 typedef T Tag;\n-329 typedef C Container;\n- 330 };\n- 331\n- 332}\n- 333\n- 334#endif\n+ 203#endif // HAVE_MPI\n+ 204\n+ 207#endif\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::put\n-void put(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key\n-&key, const Value &value)\n-Definition: propertymap.hh:92\n-Dune::get\n-Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const\n-Key &key)\n-Definition: propertymap.hh:84\n-Dune::PropertyMapTraits\n-Definition: propertymap.hh:17\n-Dune::PropertyMapTraits::ValueType\n-PM::ValueType ValueType\n-The type of the values of the property map.\n-Definition: propertymap.hh:25\n-Dune::PropertyMapTraits::Category\n-PM::Category Category\n-The category the property map belongs to.\n-Definition: propertymap.hh:33\n-Dune::PropertyMapTraits::Reference\n-PM::Reference Reference\n-The type of the reference to the values.\n-Definition: propertymap.hh:29\n-Dune::PropertyMapTraits::KeyType\n-PM::KeyType KeyType\n-The type of the key of the property map.\n-Definition: propertymap.hh:21\n-Dune::ReadablePropertyMapTag\n-Tag for the category of readable property maps.\n-Definition: propertymap.hh:38\n-Dune::WritablePropertyMapTag\n-Tag for the category of writable property maps.\n-Definition: propertymap.hh:42\n-Dune::ReadWritePropertyMapTag\n-Tag for the category of readable and writable property maps.\n-Definition: propertymap.hh:50\n-Dune::LvaluePropertyMapTag\n-Tag for the category of lvalue property maps.\n-Definition: propertymap.hh:57\n-Dune::PropertyMapTraits<_T_*_>::Reference\n-ValueType & Reference\n-Definition: propertymap.hh:63\n-Dune::PropertyMapTraits<_T_*_>::KeyType\n-std::ptrdiff_t KeyType\n-Definition: propertymap.hh:64\n-Dune::PropertyMapTraits<_T_*_>::ValueType\n-T ValueType\n-Definition: propertymap.hh:62\n-Dune::PropertyMapTraits<_T_*_>::Category\n-LvaluePropertyMapTag Category\n-Definition: propertymap.hh:65\n-Dune::PropertyMapTraits<_const_T_*_>::KeyType\n-std::ptrdiff_t KeyType\n-Definition: propertymap.hh:74\n-Dune::PropertyMapTraits<_const_T_*_>::Reference\n-const ValueType & Reference\n-Definition: propertymap.hh:73\n-Dune::PropertyMapTraits<_const_T_*_>::ValueType\n-T ValueType\n-Definition: propertymap.hh:72\n-Dune::PropertyMapTraits<_const_T_*_>::Category\n-LvaluePropertyMapTag Category\n-Definition: propertymap.hh:75\n-Dune::RAPropertyMapHelper\n-Definition: propertymap.hh:80\n-Dune::IteratorPropertyMap\n-Adapter to turn a random access iterator into a property map.\n-Definition: propertymap.hh:108\n-Dune::IteratorPropertyMap::KeyType\n-IndexMap::KeyType KeyType\n-The key type of the property map.\n-Definition: propertymap.hh:125\n-Dune::IteratorPropertyMap::Reference\n-R Reference\n-The reference type of the property map.\n-Definition: propertymap.hh:135\n-Dune::IteratorPropertyMap::ValueType\n-T ValueType\n-The value type of the property map.\n-Definition: propertymap.hh:130\n-Dune::IteratorPropertyMap::operator[]\n-Reference operator[](KeyType key) const\n-Access the a value by reference.\n-Definition: propertymap.hh:160\n-Dune::IteratorPropertyMap::IteratorPropertyMap\n-IteratorPropertyMap(RandomAccessIterator iter, const IndexMap &im=IndexMap())\n-Constructor.\n-Definition: propertymap.hh:149\n-Dune::IteratorPropertyMap::IteratorPropertyMap\n-IteratorPropertyMap()\n-Constructor.\n-Definition: propertymap.hh:155\n-Dune::IteratorPropertyMap::IndexMap\n-IM IndexMap\n-The type of the index map.\n-Definition: propertymap.hh:120\n-Dune::IteratorPropertyMap::RandomAccessIterator\n-RAI RandomAccessIterator\n-The type of the random access iterator.\n-Definition: propertymap.hh:113\n-Dune::IteratorPropertyMap::Category\n-LvaluePropertyMapTag Category\n-The category of this property map.\n-Definition: propertymap.hh:140\n-Dune::AssociativePropertyMap\n-An adapter to turn an unique associative container into a property map.\n-Definition: propertymap.hh:180\n-Dune::ConstAssociativePropertyMap\n-An adaptor to turn an unique associative container into a property map.\n-Definition: propertymap.hh:238\n-Dune::IdentityMap\n-A property map that applies the identity function to integers.\n-Definition: propertymap.hh:293\n-Dune::IdentityMap::ValueType\n-std::size_t ValueType\n-The value type of the map.\n-Definition: propertymap.hh:298\n-Dune::IdentityMap::KeyType\n-std::size_t KeyType\n-The key type of the map.\n-Definition: propertymap.hh:295\n-Dune::IdentityMap::operator[]\n-ValueType operator[](const KeyType &key) const\n-Definition: propertymap.hh:306\n-Dune::IdentityMap::Reference\n-std::size_t Reference\n-The reference type of the map.\n-Definition: propertymap.hh:301\n-Dune::IdentityMap::Category\n-ReadablePropertyMapTag Category\n-The category of the map.\n-Definition: propertymap.hh:304\n-Dune::PropertyMapTypeSelector\n-Selector for the property map type.\n-Definition: propertymap.hh:320\n-Dune::PropertyMapTypeSelector::Tag\n-T Tag\n-the tag identifying the property.\n-Definition: propertymap.hh:324\n-Dune::PropertyMapTypeSelector::Container\n-C Container\n-The container type to whose entries the properties are attached.\n-Definition: propertymap.hh:329\n+Dune::MPITraits\n+A traits class describing the mapping of types onto MPI_Datatypes.\n+Definition: mpitraits.hh:41\n+Dune::MPITraits::getType\n+static MPI_Datatype getType()\n+Definition: mpitraits.hh:48\n+Dune::MPITraits::is_intrinsic\n+static constexpr bool is_intrinsic\n+Definition: mpitraits.hh:56\n+Dune::bigunsignedint::n\n+static constexpr int n\n+Definition: bigunsignedint.hh:78\n+Dune::FieldVector\n+vector space out of a tensor product of fields.\n+Definition: fvector.hh:95\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00077.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00077.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: indent.hh File Reference\n+dune-common: mpi_collective_benchmark.cc File Reference\n \n \n \n \n \n \n \n@@ -58,54 +58,330 @@\n \n \n \n

    \n \n
    \n \n-
    indent.hh File Reference
    \n+Functions |\n+Variables
    \n+
    mpi_collective_benchmark.cc File Reference
    \n \n
    \n-\n-

    Utility class for handling nested indentation in output. \n-More...

    \n-
    #include <ostream>
    \n-#include <string>
    \n-
    \n-

    Go to the source code of this file.

    \n-\n-\n-\n-\n-\n-

    \n-Classes

    class  Dune::Indent
     Utility class for handling nested indentation in output. More...
     
    \n-\n-\n-\n-\n-

    \n-Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+
    #include <config.h>
    \n+#include <iostream>
    \n+#include <iomanip>
    \n+#include <thread>
    \n+#include <dune/common/parallel/mpihelper.hh>
    \n+#include <dune/common/timer.hh>
    \n+#include <dune/common/parametertree.hh>
    \n+#include <dune/common/parametertreeparser.hh>
    \n+
    \n \n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n Functions

    std::ostream & Dune::operator<< (std::ostream &s, const Indent &indent)
     write indentation to a stream More...
     
    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)
     
    \n+\n+\n+\n+\n+\n+\n

    \n+Variables

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

    Detailed Description

    \n-

    Utility class for handling nested indentation in output.

    \n-
    Author
    J\u00f6 Fahlke
    \n-
    \n+

    Function Documentation

    \n+\n+

    ◆ communicate()

    \n+\n+
    \n+
    \n+
    \n+template<class CC >
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    void communicate (CC & cc)
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ determineOverlap()

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    std::tuple< double, double > determineOverlap (std::function< std::tuple< double, double >(std::chrono::duration< double >)> fun)
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ main()

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    int main (int argc,
    char ** argv 
    )
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ printHeader()

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    void printHeader ()
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ run()

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    void run (int s)
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ runBlocking()

    \n+\n+
    \n+
    \n+
    \n+template<class CC >
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    double runBlocking (CC & cc)
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ runNonblockingActive()

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    std::tuple< double, double > runNonblockingActive (decltype(Dune::MPIHelper::getCommunication())& cc,
    std::chrono::duration< double > wait_time 
    )
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ runNonblockingSleep()

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    std::tuple< double, double > runNonblockingSleep (decltype(Dune::MPIHelper::getCommunication())& cc,
    std::chrono::duration< double > wait_time 
    )
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ runNonblockingWait()

    \n+\n+
    \n+
    \n+
    \n+template<class CC >
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    double runNonblockingWait (CC & cc)
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ startCommunication()

    \n+\n+
    \n+
    \n+
    \n+template<class CC >
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    Dune::Future< void > startCommunication (CC & cc)
    \n+
    \n+\n+
    \n+
    \n+

    Variable Documentation

    \n+\n+

    ◆ all_methods

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

    ◆ options

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+
    Dune::ParameterTree options
    \n+
    \n+\n+

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

    \n+

    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

    \n+

    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.

    \n+

    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.

    \n+

    Usage: mpirun ./mpi_collective_benchmark [options]

    \n+

    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.

    \n+

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

    \n+

    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)

    \n+\n+
    \n+
    \n+\n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "encoding", "source2": "encoding", "unified_diff": "@@ -1 +1 @@\n-utf-8\n+us-ascii\n"}, {"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,33 +4,147 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces | Functions\n-indent.hh File Reference\n-Common\n-Utility class for handling nested indentation in output. More...\n-#include \n-#include \n-Go_to_the_source_code_of_this_file.\n- Classes\n-class \u00a0Dune::Indent\n-\u00a0 Utility class for handling nested indentation in output. More...\n-\u00a0\n- Namespaces\n-namespace \u00a0Dune\n-\u00a0 Dune namespace.\n-\u00a0\n+ * parallel\n+ * benchmark\n+Functions | Variables\n+mpi_collective_benchmark.cc File Reference\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Functions\n-std::ostream &\u00a0Dune::operator<< (std::ostream &s, const Indent &indent)\n-\u00a0 write indentation to a stream More...\n+template\n+ void\u00a0communicate (CC &cc)\n+\u00a0\n+template\n+ Dune::Future< void >\u00a0startCommunication (CC &cc)\n+\u00a0\n+template\n+ double\u00a0runBlocking (CC &cc)\n+\u00a0\n+template\n+ double\u00a0runNonblockingWait (CC &cc)\n+\u00a0\n+std::tuple< double, double >\u00a0runNonblockingSleep (decltype(Dune::MPIHelper::\n+ getCommunication())&cc, std::chrono::duration<\n+ double > wait_time)\n+\u00a0\n+std::tuple< double, double >\u00a0runNonblockingActive (decltype(Dune::MPIHelper::\n+ getCommunication())&cc, std::chrono::duration<\n+ double > wait_time)\n+\u00a0\n+std::tuple< double, double >\u00a0determineOverlap (std::function< std::tuple<\n+ double, double >(std::chrono::duration< double\n+ >)> fun)\n+\u00a0\n+ void\u00a0printHeader ()\n+\u00a0\n+ void\u00a0run (int s)\n+\u00a0\n+ int\u00a0main (int argc, char **argv)\n+\u00a0\n+ Variables\n+ Dune::ParameterTree\u00a0options\n+ Benchmark for measure the possible overlap of\n+\u00a0 computation and communication at MPI collective\n+ communications. More...\n+\u00a0\n+std::vector< std::string >\u00a0all_methods\n \u00a0\n-***** Detailed Description *****\n-Utility class for handling nested indentation in output.\n- Author\n- J\u00f6 Fahlke\n+***** Function Documentation *****\n+***** \u25c6\u00a0communicate() *****\n+template\n+void communicate ( CC &\u00a0cc )\n+***** \u25c6\u00a0determineOverlap() *****\n+std::tuple< double, double > ( std::function< std::tuple< double, double fun )\n+determineOverlap >(std::chrono::duration< double >)>\u00a0\n+***** \u25c6\u00a0main() *****\n+int main ( int\u00a0 argc,\n+ char **\u00a0argv\u00a0\n+ )\n+***** \u25c6\u00a0printHeader() *****\n+void printHeader ( )\n+***** \u25c6\u00a0run() *****\n+void run ( int\u00a0s )\n+***** \u25c6\u00a0runBlocking() *****\n+template\n+double runBlocking ( CC &\u00a0cc )\n+***** \u25c6\u00a0runNonblockingActive() *****\n+std::tuple< double, double > ( decltype(Dune::MPIHelper:: cc,\n+runNonblockingActive getCommunication())&\u00a0\n+ std::chrono::duration< double >\u00a0wait_time\u00a0\n+ )\n+***** \u25c6\u00a0runNonblockingSleep() *****\n+std::tuple< double, double > ( decltype(Dune::MPIHelper:: cc,\n+runNonblockingSleep getCommunication())&\u00a0\n+ std::chrono::duration< double >\u00a0wait_time\u00a0\n+ )\n+***** \u25c6\u00a0runNonblockingWait() *****\n+template\n+double runNonblockingWait ( CC &\u00a0cc )\n+***** \u25c6\u00a0startCommunication() *****\n+template\n+Dune::Future< void > startCommunication ( CC &\u00a0cc )\n+***** Variable Documentation *****\n+***** \u25c6\u00a0all_methods *****\n+std::vector all_methods\n+Initial value:\n+= {\"allreduce\",\n+\"barrier\",\n+\"broadcast\",\n+\"gather\",\n+\"allgather\",\n+\"scatter\"}\n+***** \u25c6\u00a0options *****\n+Dune::ParameterTree options\n+Benchmark for measure the possible overlap of computation and communication at\n+MPI collective communications.\n+This benchmark is inspired by the sandia micro benchmark: W. Lawry, C. Wilson,\n+A. Maccabe, R. Brightwell. COMB: A Portable Benchmark Suite for Assessing MPI\n+Overlap. In Proceedings of the IEEE International Conference on Cluster\n+Computing (CLUSTER 2002), p. 472, 2002. http://www.cs.sandia.gov/smb/\n+overhead.html\n+The following communication times are measured: Blocking: Blocking call. E.g.\n+MPI_Allreduce Nonblocking_wait (NB_Wait): Nonblocking (e.g. MPI_Iallreduce)\n+call directly followed by MPI_Wait. Nonblocking_sleep (NB_Sleep): Nonblocking\n+call followed by a busy wait until the work time has passed. Then MPI_Wait.\n+Nonblocking_active (NB_active): Nonblocking call followed by a basy wait where\n+in every iteration MPI_Test is called until the work time has passed. The\n+MPI_wait.\n+The overhead is computed as the time for the Nonblocking call plus the time for\n+MPI_Wait. The iteration time is the time for the whole communication. The\n+available part of the communication time(avail(%)) is computed as 1-(overhead/\n+base_t), where base_t is the time for calling the method with wait time = 0.\n+The overhead is determined by increasing the work time successive until it is\n+the dominant factor in the iteration time. Then the overhead is computed as\n+iter_t-work_t.\n+Usage: mpirun ./mpi_collective_benchmark [options]\n+options: -method: default: allreduce. possible methods: allreduce, barrier,\n+broadcast, gather, allgather, scatter -iterations: default: 10000. Number of\n+iterations for measure the time for one communication -allMethods: default:0.\n+If 1 iterates over all available methods -startSize: default: n, where n is the\n+size of MPI_COMM_WORLD. runs the benchmark for different communicator sizes,\n+starting with startSize. After every run the size is doubled. Finally one run\n+is made for the whole communicator. -verbose: default: 0. If 1 prints\n+intermediate information while determining the overhead. -threshold: default:\n+2. The threshold when the work time is the dominant factor in the iteration\n+time. (Similar to the threshold in the sandia benchmark) -nohdr: default: 0.\n+Suppress output of the header.\n+options can be set either in the options.ini file or can be pass at the\n+command-line (-key value).\n+To get a good 'available' value for the NB_sleep communication, some MPI\n+implementation need to spawn an extra thread. With MPICH you can activate this\n+by setting the environment variable MPI_ASYNC_PROGRESS to 1, with IntelMPI the\n+variable is called I_MPI_ASYNC_PROGRESS. (https://software.intel.com/en-us/mpi-\n+developer-reference-linux-asynchronous-progress-control)\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00080.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00080.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: boundschecking.hh File Reference\n+dune-common: mpidata.hh File Reference\n \n \n \n \n \n \n \n@@ -58,38 +58,61 @@\n \n \n \n \n \n
    \n
    \n-Macros
    \n-
    boundschecking.hh File Reference
    \n+Classes |\n+Namespaces |\n+Functions
    \n+
    mpidata.hh File Reference
    \n \n
    \n \n-

    Macro for wrapping boundary checks. \n+

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

    \n-
    #include <dune/common/exceptions.hh>
    \n+
    #include <vector>
    \n+#include <string>
    \n+#include <dune/common/typetraits.hh>
    \n+#include <dune/common/std/type_traits.hh>
    \n+#include <dune/common/parallel/mpitraits.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+

    \n-Macros

    #define DUNE_ASSERT_BOUNDS(cond)
     If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing. More...
     

    \n+Classes

    struct  Dune::MPIData< T, Enable >
     
    struct  Dune::MPIData< void >
     
    struct  Dune::MPIData< T, std::void_t< std::tuple< decltype(std::declval< T >().data()), decltype(std::declval< T >().size()), typename std::decay_t< T >::value_type > > >
     
    \n+\n+\n+\n+\n+

    \n+Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+\n+\n+\n+\n

    \n+Functions

    template<class T >
    auto Dune::getMPIData (T &t)
     
    \n

    Detailed Description

    \n-

    Macro for wrapping boundary checks.

    \n+

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

    \n+

    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.

    \n+

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

    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,22 +4,46 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Macros\n-boundschecking.hh File Reference\n-Macro for wrapping boundary checks. More...\n-#include \n+ * parallel\n+Classes | Namespaces | Functions\n+mpidata.hh File Reference\n+Common \u00bb Parallel_Communication\n+Interface class to translate objects to a MPI_Datatype, void* and size used for\n+MPI calls. More...\n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Macros\n-#define\u00a0DUNE_ASSERT_BOUNDS(cond)\n-\u00a0 If DUNE_CHECK_BOUNDS is defined: check if condition cond holds;\n- otherwise, do nothing. More...\n+ Classes\n+struct \u00a0Dune::MPIData<_T,_Enable_>\n+\u00a0\n+struct \u00a0Dune::MPIData<_void_>\n+\u00a0\n+struct \u00a0Dune::MPIData<_T,_std::void_t<_std::tuple<_decltype(std::declval<_T_>\n+ ().data()),_decltype(std::declval<_T_>().size()),_typename_std::\n+ decay_t<_T_>::value_type_>_>_>\n+\u00a0\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n+\u00a0\n+ Functions\n+template\n+auto\u00a0Dune::getMPIData (T &t)\n \u00a0\n ***** Detailed Description *****\n-Macro for wrapping boundary checks.\n+Interface class to translate objects to a MPI_Datatype, void* and size used for\n+MPI calls.\n+Furthermore it can be used to resize the object if possible. This makes it\n+possible to receive a message with variable size. See Communication::rrecv.\n+To 'register' a new dynamic type for MPI communication specialize MPIData or\n+overload getMPIData.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00080_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: boundschecking.hh Source File\n+dune-common: mpidata.hh Source File\n \n \n \n \n \n \n \n@@ -58,46 +58,164 @@\n \n
    \n \n \n
    \n
    \n-
    boundschecking.hh
    \n+
    mpidata.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n-
    2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    3#ifndef DUNE_BOUNDSCHECKING_HH
    \n-
    4#define DUNE_BOUNDSCHECKING_HH
    \n+Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n+
    2// vi: set et ts=4 sw=2 sts=2:
    \n+
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n+
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n
    5
    \n-\n-
    7
    \n-
    19#ifndef DUNE_ASSERT_BOUNDS
    \n-
    20#if defined(DUNE_CHECK_BOUNDS) || defined(DOXYGEN)
    \n-
    21
    \n-
    30#define DUNE_ASSERT_BOUNDS(cond) \\
    \n-
    31 do { \\
    \n-
    32 if (!(cond)) \\
    \n-
    33 DUNE_THROW(Dune::RangeError, "Index out of bounds."); \\
    \n-
    34 } while (false)
    \n-
    35
    \n-
    36#else
    \n-
    37#define DUNE_ASSERT_BOUNDS(cond)
    \n-
    38#endif
    \n-
    39#endif
    \n-
    40
    \n-
    41/* @} */
    \n-
    42
    \n-
    43#endif // DUNE_BOUNDSCHECKING_HH
    \n-
    A few common exception classes.
    \n+
    6#ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH
    \n+
    7#define DUNE_COMMON_PARALLEL_MPIDATA_HH
    \n+
    8
    \n+
    9#include <vector>
    \n+
    10#include <string>
    \n+
    11
    \n+
    12#if HAVE_MPI
    \n+
    13
    \n+\n+\n+\n+
    17
    \n+
    37namespace Dune{
    \n+
    38
    \n+
    39 template<class, class = void>
    \n+
    40 struct MPIData;
    \n+
    41
    \n+
    42 template<class T>
    \n+
    43 auto getMPIData(T& t){
    \n+
    44 return MPIData<T>(t);
    \n+
    45 }
    \n+
    46
    \n+
    47 // Default implementation for static datatypes
    \n+
    48 template<class T, class Enable>
    \n+
    49 struct MPIData
    \n+
    50 {
    \n+
    51 friend auto getMPIData<T>(T&);
    \n+
    52 protected:
    \n+\n+
    54
    \n+
    55 MPIData(T& t)
    \n+
    56 : data_(t)
    \n+
    57 {}
    \n+
    58
    \n+
    59 public:
    \n+
    60 void* ptr() const {
    \n+
    61 return (void*)&data_;
    \n+
    62 }
    \n+
    63
    \n+
    64 // indicates whether the datatype can be resized
    \n+
    65 static constexpr bool static_size = true;
    \n+
    66
    \n+
    67 int size() const{
    \n+
    68 return 1;
    \n+
    69 }
    \n+
    70
    \n+
    71 MPI_Datatype type() const {
    \n+
    72 return MPITraits<std::decay_t<T>>::getType();
    \n+
    73 }
    \n+
    74 };
    \n+
    75
    \n+
    76 // dummy implementation for void
    \n+
    77 template<>
    \n+
    78 struct MPIData<void>{
    \n+
    79 protected:
    \n+\n+
    81
    \n+
    82 public:
    \n+
    83 void* ptr(){
    \n+
    84 return nullptr;
    \n+
    85 }
    \n+
    86 int size(){
    \n+
    87 return 0;
    \n+
    88 }
    \n+
    89 void get(){}
    \n+
    90 MPI_Datatype type() const{
    \n+
    91 return MPI_INT;
    \n+
    92 }
    \n+
    93 };
    \n+
    94
    \n+
    95 // specializations:
    \n+
    96 // std::vector of static sized elements or std::string
    \n+
    97 template<class T>
    \n+
    98 struct MPIData<T, std::void_t<std::tuple<decltype(std::declval<T>().data()),
    \n+
    99 decltype(std::declval<T>().size()),
    \n+
    100 typename std::decay_t<T>::value_type>>>{
    \n+
    101 private:
    \n+
    102 template<class U>
    \n+
    103 using hasResizeOp = decltype(std::declval<U>().resize(0));
    \n+
    104
    \n+
    105 protected:
    \n+
    106 friend auto getMPIData<T>(T&);
    \n+\n+
    108 : data_(t)
    \n+
    109 {}
    \n+
    110 public:
    \n+
    111 static constexpr bool static_size = std::is_const<T>::value || !Std::is_detected_v<hasResizeOp, T>;
    \n+
    112 void* ptr() {
    \n+
    113 return (void*) data_.data();
    \n+
    114 }
    \n+
    115 int size() {
    \n+
    116 return data_.size();
    \n+
    117 }
    \n+
    118 MPI_Datatype type() const{
    \n+\n+
    120 }
    \n+
    121
    \n+
    122 template<class S = T>
    \n+
    123 auto /*void*/ resize(int size)
    \n+
    124 -> std::enable_if_t<!std::is_const<S>::value || !Std::is_detected_v<hasResizeOp, S>>
    \n+
    125 {
    \n+
    126 data_.resize(size);
    \n+
    127 }
    \n+
    128
    \n+
    129 protected:
    \n+\n+
    131 };
    \n+
    132
    \n+
    133}
    \n+
    134
    \n+
    139#endif
    \n+
    140#endif
    \n+
    Traits for type conversions and type information.
    \n+
    Traits classes for mapping types onto MPI_Datatype.
    \n+\n+
    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
    \n+
    STL namespace.
    \n+
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    auto getMPIData(T &t)
    Definition: mpidata.hh:43
    \n+
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition: mpitraits.hh:41
    \n+
    Definition: mpidata.hh:50
    \n+
    T & data_
    Definition: mpidata.hh:53
    \n+
    MPI_Datatype type() const
    Definition: mpidata.hh:71
    \n+
    void * ptr() const
    Definition: mpidata.hh:60
    \n+
    int size() const
    Definition: mpidata.hh:67
    \n+
    static constexpr bool static_size
    Definition: mpidata.hh:65
    \n+
    MPIData(T &t)
    Definition: mpidata.hh:55
    \n+
    void get()
    Definition: mpidata.hh:89
    \n+
    MPIData()
    Definition: mpidata.hh:80
    \n+
    int size()
    Definition: mpidata.hh:86
    \n+
    void * ptr()
    Definition: mpidata.hh:83
    \n+
    MPI_Datatype type() const
    Definition: mpidata.hh:90
    \n+\n+\n+\n+\n+
    auto resize(int size) -> std::enable_if_t<!std::is_const< S >::value||!Std::is_detected_v< hasResizeOp, S > >
    Definition: mpidata.hh:123
    \n+\n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,39 +4,219 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-boundschecking.hh\n+ * parallel\n+mpidata.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n+ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n+ 2// vi: set et ts=4 sw=2 sts=2:\n+ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 3#ifndef DUNE_BOUNDSCHECKING_HH\n- 4#define DUNE_BOUNDSCHECKING_HH\n+ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n 5\n- 6#include \n- 7\n- 19#ifndef DUNE_ASSERT_BOUNDS\n- 20#if defined(DUNE_CHECK_BOUNDS) || defined(DOXYGEN)\n- 21\n-30#define DUNE_ASSERT_BOUNDS(cond) \\\n- 31 do { \\\n- 32 if (!(cond)) \\\n- 33 DUNE_THROW(Dune::RangeError, \"Index out of bounds.\"); \\\n- 34 } while (false)\n- 35\n- 36#else\n- 37#define DUNE_ASSERT_BOUNDS(cond)\n- 38#endif\n- 39#endif\n- 40\n- 41/* @} */\n- 42\n- 43#endif // DUNE_BOUNDSCHECKING_HH\n-exceptions.hh\n-A few common exception classes.\n+ 6#ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH\n+ 7#define DUNE_COMMON_PARALLEL_MPIDATA_HH\n+ 8\n+ 9#include \n+ 10#include \n+ 11\n+ 12#if HAVE_MPI\n+ 13\n+ 14#include \n+ 15#include \n+ 16#include \n+ 17\n+ 37namespace Dune{\n+ 38\n+ 39 template\n+ 40 struct MPIData;\n+ 41\n+ 42 template\n+43 auto getMPIData(T& t){\n+ 44 return MPIData(t);\n+ 45 }\n+ 46\n+ 47 // Default implementation for static datatypes\n+ 48 template\n+49 struct MPIData\n+ 50 {\n+ 51 friend auto getMPIData(T&);\n+ 52 protected:\n+53 T& data_;\n+ 54\n+55 MPIData(T& t)\n+ 56 : data_(t)\n+ 57 {}\n+ 58\n+ 59 public:\n+60 void* ptr() const {\n+ 61 return (void*)&data_;\n+ 62 }\n+ 63\n+ 64 // indicates whether the datatype can be resized\n+65 static constexpr bool static_size = true;\n+ 66\n+67 int size() const{\n+ 68 return 1;\n+ 69 }\n+ 70\n+71 MPI_Datatype type() const {\n+ 72 return MPITraits>::getType();\n+ 73 }\n+ 74 };\n+ 75\n+ 76 // dummy implementation for void\n+ 77 template<>\n+78 struct MPIData{\n+ 79 protected:\n+80 MPIData() {}\n+ 81\n+ 82 public:\n+83 void* ptr(){\n+ 84 return nullptr;\n+ 85 }\n+86 int size(){\n+ 87 return 0;\n+ 88 }\n+89 void get(){}\n+90 MPI_Datatype type() const{\n+ 91 return MPI_INT;\n+ 92 }\n+ 93 };\n+ 94\n+ 95 // specializations:\n+ 96 // std::vector of static sized elements or std::string\n+ 97 template\n+98 struct MPIData().data()),\n+ 99 decltype(std::declval().size()),\n+ 100 typename std::decay_t::value_type>>>{\n+ 101 private:\n+ 102 template\n+ 103 using hasResizeOp = decltype(std::declval().resize(0));\n+ 104\n+ 105 protected:\n+ 106 friend auto getMPIData(T&);\n+107 MPIData(T& t)\n+ 108 : data_(t)\n+ 109 {}\n+ 110 public:\n+111 static constexpr bool static_size = std::is_const::value || !Std::\n+is_detected_v;\n+112 void* ptr() {\n+ 113 return (void*) data_.data();\n+ 114 }\n+115 int size() {\n+ 116 return data_.size();\n+ 117 }\n+118 MPI_Datatype type() const{\n+ 119 return MPITraits::value_type>::getType();\n+ 120 }\n+ 121\n+ 122 template\n+123 auto /*void*/ resize(int size)\n+ 124 -> std::enable_if_t::value || !Std::\n+is_detected_v>\n+ 125 {\n+ 126 data_.resize(size);\n+ 127 }\n+ 128\n+ 129 protected:\n+130 T& data_;\n+ 131 };\n+ 132\n+ 133}\n+ 134\n+ 139#endif\n+ 140#endif\n+typetraits.hh\n+Traits for type conversions and type information.\n+mpitraits.hh\n+Traits classes for mapping types onto MPI_Datatype.\n+type_traits.hh\n+Dune::void_t\n+typename Impl::voider< Types... >::type void_t\n+Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.\n+Definition: typetraits.hh:40\n+std\n+STL namespace.\n+Dune\n+Dune namespace.\n+Definition: alignedallocator.hh:13\n+Dune::getMPIData\n+auto getMPIData(T &t)\n+Definition: mpidata.hh:43\n+Dune::MPITraits\n+A traits class describing the mapping of types onto MPI_Datatypes.\n+Definition: mpitraits.hh:41\n+Dune::MPIData\n+Definition: mpidata.hh:50\n+Dune::MPIData::data_\n+T & data_\n+Definition: mpidata.hh:53\n+Dune::MPIData::type\n+MPI_Datatype type() const\n+Definition: mpidata.hh:71\n+Dune::MPIData::ptr\n+void * ptr() const\n+Definition: mpidata.hh:60\n+Dune::MPIData::size\n+int size() const\n+Definition: mpidata.hh:67\n+Dune::MPIData::static_size\n+static constexpr bool static_size\n+Definition: mpidata.hh:65\n+Dune::MPIData::MPIData\n+MPIData(T &t)\n+Definition: mpidata.hh:55\n+Dune::MPIData<_void_>::get\n+void get()\n+Definition: mpidata.hh:89\n+Dune::MPIData<_void_>::MPIData\n+MPIData()\n+Definition: mpidata.hh:80\n+Dune::MPIData<_void_>::size\n+int size()\n+Definition: mpidata.hh:86\n+Dune::MPIData<_void_>::ptr\n+void * ptr()\n+Definition: mpidata.hh:83\n+Dune::MPIData<_void_>::type\n+MPI_Datatype type() const\n+Definition: mpidata.hh:90\n+Dune::MPIData<_T,_std::void_t<_std::tuple<_decltype(std::declval<_T_>().data\n+()),_decltype(std::declval<_T_>().size()),_typename_std::decay_t<_T_>::\n+value_type_>_>_>::MPIData\n+MPIData(T &t)\n+Definition: mpidata.hh:107\n+Dune::MPIData<_T,_std::void_t<_std::tuple<_decltype(std::declval<_T_>().data\n+()),_decltype(std::declval<_T_>().size()),_typename_std::decay_t<_T_>::\n+value_type_>_>_>::ptr\n+void * ptr()\n+Definition: mpidata.hh:112\n+Dune::MPIData<_T,_std::void_t<_std::tuple<_decltype(std::declval<_T_>().data\n+()),_decltype(std::declval<_T_>().size()),_typename_std::decay_t<_T_>::\n+value_type_>_>_>::size\n+int size()\n+Definition: mpidata.hh:115\n+Dune::MPIData<_T,_std::void_t<_std::tuple<_decltype(std::declval<_T_>().data\n+()),_decltype(std::declval<_T_>().size()),_typename_std::decay_t<_T_>::\n+value_type_>_>_>::data_\n+T & data_\n+Definition: mpidata.hh:130\n+Dune::MPIData<_T,_std::void_t<_std::tuple<_decltype(std::declval<_T_>().data\n+()),_decltype(std::declval<_T_>().size()),_typename_std::decay_t<_T_>::\n+value_type_>_>_>::resize\n+auto resize(int size) -> std::enable_if_t::value||!Std::\n+is_detected_v< hasResizeOp, S > >\n+Definition: mpidata.hh:123\n+Dune::MPIData<_T,_std::void_t<_std::tuple<_decltype(std::declval<_T_>().data\n+()),_decltype(std::declval<_T_>().size()),_typename_std::decay_t<_T_>::\n+value_type_>_>_>::type\n+MPI_Datatype type() const\n+Definition: mpidata.hh:118\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00083.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00083.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: ftraits.hh File Reference\n+dune-common: mpicommunication.hh File Reference\n \n \n \n \n \n \n \n@@ -58,53 +58,114 @@\n \n
    \n \n \n \n
    \n \n-
    ftraits.hh File Reference
    \n+Namespaces |\n+Macros |\n+Functions
    \n+
    mpicommunication.hh File Reference
    \n \n
    \n \n-

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

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

    \n-
    #include <complex>
    \n-#include <vector>
    \n+
    #include <algorithm>
    \n+#include <functional>
    \n+#include <memory>
    \n+#include <mpi.h>
    \n+#include <dune/common/binaryfunctions.hh>
    \n+#include <dune/common/exceptions.hh>
    \n+#include <dune/common/parallel/communication.hh>
    \n+#include <dune/common/parallel/mpitraits.hh>
    \n+#include <dune/common/parallel/mpifuture.hh>
    \n+#include <dune/common/parallel/mpidata.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n+\n \n-\n-\n-\n-\n-\n-\n-\n+\n+\n \n

    \n Classes

    struct  Dune::FieldTraits< T >
    class  Dune::Generic_MPI_Op< Type, BinaryFunction, Enable >
     
    struct  Dune::FieldTraits< const T >
     
    struct  Dune::FieldTraits< std::complex< T > >
     
    struct  Dune::FieldTraits< T[N] >
     
    struct  Dune::FieldTraits< std::vector< T > >
    class  Dune::Communication< MPI_Comm >
     Specialization of Communication for MPI. More...
     
    \n \n \n \n \n+

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+\n+\n+\n+

    \n+Macros

    #define ComposeMPIOp(func, op)
     
    \n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n+Functions

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

    Detailed Description

    \n-

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

    \n-
    \n+

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

    \n+

    Macro Definition Documentation

    \n+\n+

    ◆ ComposeMPIOp

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    #define ComposeMPIOp( func,
     op 
    )
    \n+
    \n+Value:
    template<class T, class S> \\
    \n+
    class Generic_MPI_Op<T, func<S>, std::enable_if_t<MPITraits<S>::is_intrinsic> >{ \\
    \n+
    public: \\
    \n+
    static MPI_Op get(){ \\
    \n+
    return op; \\
    \n+
    } \\
    \n+
    private: \\
    \n+
    Generic_MPI_Op () {} \\
    \n+
    Generic_MPI_Op (const Generic_MPI_Op & ) {} \\
    \n+
    }
    \n+
    Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
    Definition: propertymap.hh:84
    \n+
    \n+
    \n+
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,34 +4,73 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces\n-ftraits.hh File Reference\n-Type traits to determine the type of reals (when working with complex numbers)\n-More...\n-#include \n-#include \n+ * parallel\n+Classes | Namespaces | Macros | Functions\n+mpicommunication.hh File Reference\n+Common \u00bb Parallel_Communication\n+Implements an utility class that provides MPI's collective communication\n+methods. More...\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::FieldTraits<_T_>\n+class \u00a0Dune::Generic_MPI_Op<_Type,_BinaryFunction,_Enable_>\n \u00a0\n-struct \u00a0Dune::FieldTraits<_const_T_>\n-\u00a0\n-struct \u00a0Dune::FieldTraits<_std::complex<_T_>_>\n-\u00a0\n-struct \u00a0Dune::FieldTraits<_T[N]_>\n-\u00a0\n-struct \u00a0Dune::FieldTraits<_std::vector<_T_>_>\n+class \u00a0Dune::Communication<_MPI_Comm_>\n+\u00a0 Specialization of Communication for MPI. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n+ Macros\n+#define\u00a0ComposeMPIOp(func, op)\n+\u00a0\n+ Functions\n+\u00a0Dune::ComposeMPIOp (std::plus, MPI_SUM)\n+\u00a0\n+\u00a0Dune::ComposeMPIOp (std::multiplies, MPI_PROD)\n+\u00a0\n+\u00a0Dune::ComposeMPIOp (Min, MPI_MIN)\n+\u00a0\n+\u00a0Dune::ComposeMPIOp (Max, MPI_MAX)\n+\u00a0\n ***** Detailed Description *****\n-Type traits to determine the type of reals (when working with complex numbers)\n+Implements an utility class that provides MPI's collective communication\n+methods.\n+***** Macro Definition Documentation *****\n+***** \u25c6\u00a0ComposeMPIOp *****\n+#define ComposeMPIOp ( \u00a0func,\n+ \u00a0op\u00a0\n+ )\n+Value:\n+template \\\n+class Generic_MPI_Op, std::enable_if_t::is_intrinsic> >\n+{ \\\n+public: \\\n+static MPI_Op get(){ \\\n+return op; \\\n+} \\\n+private: \\\n+Generic_MPI_Op () {} \\\n+Generic_MPI_Op (const Generic_MPI_Op & ) {} \\\n+}\n+Dune::get\n+Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const\n+Key &key)\n+Definition: propertymap.hh:84\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00083_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: ftraits.hh Source File\n+dune-common: mpicommunication.hh Source File\n \n \n \n \n \n \n \n@@ -58,84 +58,501 @@\n \n \n \n \n \n
    \n-
    ftraits.hh
    \n+
    mpicommunication.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_FTRAITS_HH
    \n-
    6#define DUNE_FTRAITS_HH
    \n+
    5#ifndef DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH
    \n+
    6#define DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH
    \n
    7
    \n-
    12#include <complex>
    \n-
    13#include <vector>
    \n-
    14
    \n-
    15namespace Dune {
    \n-
    16
    \n-
    24 template<class T>
    \n-\n-
    26 {
    \n-
    28 typedef T field_type;
    \n-
    30 typedef T real_type;
    \n-
    31 };
    \n-
    32
    \n-
    33 template<class T>
    \n-
    34 struct FieldTraits<const T>
    \n-
    35 {
    \n-\n-\n-
    38 };
    \n-
    39
    \n-
    40 template<class T>
    \n-
    41 struct FieldTraits< std::complex<T> >
    \n-
    42 {
    \n-
    43 typedef std::complex<T> field_type;
    \n-
    44 typedef T real_type;
    \n-
    45 };
    \n-
    46
    \n-
    47 template<class T, unsigned int N>
    \n-
    48 struct FieldTraits< T[N] >
    \n-
    49 {
    \n-\n-\n-
    52 };
    \n-
    53
    \n-
    54 template<class T>
    \n-
    55 struct FieldTraits< std::vector<T> >
    \n-
    56 {
    \n-\n-\n-
    59 };
    \n-
    60
    \n-
    61} // end namespace Dune
    \n-
    62
    \n-
    63#endif // DUNE_FTRAITS_HH
    \n-
    STL namespace.
    \n+
    16#if HAVE_MPI
    \n+
    17
    \n+
    18#include <algorithm>
    \n+
    19#include <functional>
    \n+
    20#include <memory>
    \n+
    21
    \n+
    22#include <mpi.h>
    \n+
    23
    \n+\n+\n+\n+\n+\n+\n+
    30
    \n+
    31namespace Dune
    \n+
    32{
    \n+
    33
    \n+
    34 //=======================================================
    \n+
    35 // use singleton pattern and template specialization to
    \n+
    36 // generate MPI operations
    \n+
    37 //=======================================================
    \n+
    38
    \n+
    39 template<typename Type, typename BinaryFunction, typename Enable=void>
    \n+\n+
    41 {
    \n+
    42
    \n+
    43 public:
    \n+
    44 static MPI_Op get ()
    \n+
    45 {
    \n+
    46 if (!op)
    \n+
    47 {
    \n+
    48 op = std::make_unique<MPI_Op>();
    \n+
    49 // The following line leaks an MPI operation object, because the corresponding
    \n+
    50 //`MPI_Op_free` is never called. It is never called because there is no easy
    \n+
    51 // way to call it at the right moment: right before the call to MPI_Finalize.
    \n+
    52 // See https://gitlab.dune-project.org/core/dune-istl/issues/80
    \n+
    53 MPI_Op_create((void (*)(void*, void*, int*, MPI_Datatype*))&operation,true,op.get());
    \n+
    54 }
    \n+
    55 return *op;
    \n+
    56 }
    \n+
    57 private:
    \n+
    58 static void operation (Type *in, Type *inout, int *len, MPI_Datatype*)
    \n+
    59 {
    \n+
    60 BinaryFunction func;
    \n+
    61
    \n+
    62 for (int i=0; i< *len; ++i, ++in, ++inout) {
    \n+
    63 Type temp;
    \n+
    64 temp = func(*in, *inout);
    \n+
    65 *inout = temp;
    \n+
    66 }
    \n+
    67 }
    \n+
    68 Generic_MPI_Op () {}
    \n+
    69 Generic_MPI_Op (const Generic_MPI_Op& ) {}
    \n+
    70 static std::unique_ptr<MPI_Op> op;
    \n+
    71 };
    \n+
    72
    \n+
    73
    \n+
    74 template<typename Type, typename BinaryFunction, typename Enable>
    \n+
    75 std::unique_ptr<MPI_Op> Generic_MPI_Op<Type,BinaryFunction, Enable>::op;
    \n+
    76
    \n+
    77#define ComposeMPIOp(func,op) \\
    \n+
    78 template<class T, class S> \\
    \n+
    79 class Generic_MPI_Op<T, func<S>, std::enable_if_t<MPITraits<S>::is_intrinsic> >{ \\
    \n+
    80 public: \\
    \n+
    81 static MPI_Op get(){ \\
    \n+
    82 return op; \\
    \n+
    83 } \\
    \n+
    84 private: \\
    \n+
    85 Generic_MPI_Op () {} \\
    \n+
    86 Generic_MPI_Op (const Generic_MPI_Op & ) {} \\
    \n+
    87 }
    \n+
    88
    \n+
    89
    \n+
    90 ComposeMPIOp(std::plus, MPI_SUM);
    \n+
    91 ComposeMPIOp(std::multiplies, MPI_PROD);
    \n+
    92 ComposeMPIOp(Min, MPI_MIN);
    \n+
    93 ComposeMPIOp(Max, MPI_MAX);
    \n+
    94
    \n+
    95#undef ComposeMPIOp
    \n+
    96
    \n+
    97
    \n+
    98 //=======================================================
    \n+
    99 // use singleton pattern and template specialization to
    \n+
    100 // generate MPI operations
    \n+
    101 //=======================================================
    \n+
    102
    \n+
    106 template<>
    \n+
    107 class Communication<MPI_Comm>
    \n+
    108 {
    \n+
    109 public:
    \n+
    111 Communication (const MPI_Comm& c = MPI_COMM_WORLD)
    \n+
    112 : communicator(c)
    \n+
    113 {
    \n+
    114 if(communicator!=MPI_COMM_NULL) {
    \n+
    115 int initialized = 0;
    \n+
    116 MPI_Initialized(&initialized);
    \n+
    117 if (!initialized)
    \n+
    118 DUNE_THROW(ParallelError,"You must call MPIHelper::instance(argc,argv) in your main() function before using the MPI Communication!");
    \n+
    119 MPI_Comm_rank(communicator,&me);
    \n+
    120 MPI_Comm_size(communicator,&procs);
    \n+
    121 }else{
    \n+
    122 procs=0;
    \n+
    123 me=-1;
    \n+
    124 }
    \n+
    125 }
    \n+
    126
    \n+
    128 int rank () const
    \n+
    129 {
    \n+
    130 return me;
    \n+
    131 }
    \n+
    132
    \n+
    134 int size () const
    \n+
    135 {
    \n+
    136 return procs;
    \n+
    137 }
    \n+
    138
    \n+
    140 template<class T>
    \n+
    141 int send(const T& data, int dest_rank, int tag) const
    \n+
    142 {
    \n+
    143 auto mpi_data = getMPIData(data);
    \n+
    144 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
    \n+
    145 dest_rank, tag, communicator);
    \n+
    146 }
    \n+
    147
    \n+
    149 template<class T>
    \n+
    150 MPIFuture<const T> isend(const T&& data, int dest_rank, int tag) const
    \n+
    151 {
    \n+
    152 MPIFuture<const T> future(std::forward<const T>(data));
    \n+
    153 auto mpidata = future.get_mpidata();
    \n+
    154 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(),
    \n+
    155 dest_rank, tag, communicator, &future.req_);
    \n+
    156 return future;
    \n+
    157 }
    \n+
    158
    \n+
    160 template<class T>
    \n+
    161 T recv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
    \n+
    162 {
    \n+
    163 T lvalue_data(std::forward<T>(data));
    \n+
    164 auto mpi_data = getMPIData(lvalue_data);
    \n+
    165 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),
    \n+
    166 source_rank, tag, communicator, status);
    \n+
    167 return lvalue_data;
    \n+
    168 }
    \n+
    169
    \n+
    171 template<class T>
    \n+
    172 MPIFuture<T> irecv(T&& data, int source_rank, int tag) const
    \n+
    173 {
    \n+
    174 MPIFuture<T> future(std::forward<T>(data));
    \n+
    175 auto mpidata = future.get_mpidata();
    \n+
    176 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(),
    \n+
    177 source_rank, tag, communicator, &future.req_);
    \n+
    178 return future;
    \n+
    179 }
    \n+
    180
    \n+
    181 template<class T>
    \n+
    182 T rrecv(T&& data, int source_rank, int tag, MPI_Status* status = MPI_STATUS_IGNORE) const
    \n+
    183 {
    \n+
    184 MPI_Status _status;
    \n+
    185 MPI_Message _message;
    \n+
    186 T lvalue_data(std::forward<T>(data));
    \n+
    187 auto mpi_data = getMPIData(lvalue_data);
    \n+
    188 static_assert(!mpi_data.static_size, "rrecv work only for non-static-sized types.");
    \n+
    189 if(status == MPI_STATUS_IGNORE)
    \n+
    190 status = &_status;
    \n+
    191 MPI_Mprobe(source_rank, tag, communicator, &_message, status);
    \n+
    192 int size;
    \n+
    193 MPI_Get_count(status, mpi_data.type(), &size);
    \n+
    194 mpi_data.resize(size);
    \n+
    195 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message, status);
    \n+
    196 return lvalue_data;
    \n+
    197 }
    \n+
    198
    \n+
    200 template<typename T>
    \n+
    201 T sum (const T& in) const
    \n+
    202 {
    \n+
    203 T out;
    \n+
    204 allreduce<std::plus<T> >(&in,&out,1);
    \n+
    205 return out;
    \n+
    206 }
    \n+
    207
    \n+
    209 template<typename T>
    \n+
    210 int sum (T* inout, int len) const
    \n+
    211 {
    \n+
    212 return allreduce<std::plus<T> >(inout,len);
    \n+
    213 }
    \n+
    214
    \n+
    216 template<typename T>
    \n+
    217 T prod (const T& in) const
    \n+
    218 {
    \n+
    219 T out;
    \n+
    220 allreduce<std::multiplies<T> >(&in,&out,1);
    \n+
    221 return out;
    \n+
    222 }
    \n+
    223
    \n+
    225 template<typename T>
    \n+
    226 int prod (T* inout, int len) const
    \n+
    227 {
    \n+
    228 return allreduce<std::multiplies<T> >(inout,len);
    \n+
    229 }
    \n+
    230
    \n+
    232 template<typename T>
    \n+
    233 T min (const T& in) const
    \n+
    234 {
    \n+
    235 T out;
    \n+
    236 allreduce<Min<T> >(&in,&out,1);
    \n+
    237 return out;
    \n+
    238 }
    \n+
    239
    \n+
    241 template<typename T>
    \n+
    242 int min (T* inout, int len) const
    \n+
    243 {
    \n+
    244 return allreduce<Min<T> >(inout,len);
    \n+
    245 }
    \n+
    246
    \n+
    247
    \n+
    249 template<typename T>
    \n+
    250 T max (const T& in) const
    \n+
    251 {
    \n+
    252 T out;
    \n+
    253 allreduce<Max<T> >(&in,&out,1);
    \n+
    254 return out;
    \n+
    255 }
    \n+
    256
    \n+
    258 template<typename T>
    \n+
    259 int max (T* inout, int len) const
    \n+
    260 {
    \n+
    261 return allreduce<Max<T> >(inout,len);
    \n+
    262 }
    \n+
    263
    \n+
    265 int barrier () const
    \n+
    266 {
    \n+
    267 return MPI_Barrier(communicator);
    \n+
    268 }
    \n+
    269
    \n+\n+
    272 {
    \n+
    273 MPIFuture<void> future(true); // make a valid MPIFuture<void>
    \n+
    274 MPI_Ibarrier(communicator, &future.req_);
    \n+
    275 return future;
    \n+
    276 }
    \n+
    277
    \n+
    278
    \n+
    280 template<typename T>
    \n+
    281 int broadcast (T* inout, int len, int root) const
    \n+
    282 {
    \n+
    283 return MPI_Bcast(inout,len,MPITraits<T>::getType(),root,communicator);
    \n+
    284 }
    \n+
    285
    \n+
    287 template<class T>
    \n+
    288 MPIFuture<T> ibroadcast(T&& data, int root) const{
    \n+
    289 MPIFuture<T> future(std::forward<T>(data));
    \n+
    290 auto mpidata = future.get_mpidata();
    \n+
    291 MPI_Ibcast(mpidata.ptr(),
    \n+
    292 mpidata.size(),
    \n+
    293 mpidata.type(),
    \n+
    294 root,
    \n+
    295 communicator,
    \n+
    296 &future.req_);
    \n+
    297 return future;
    \n+
    298 }
    \n+
    299
    \n+
    302 template<typename T>
    \n+
    303 int gather (const T* in, T* out, int len, int root) const
    \n+
    304 {
    \n+
    305 return MPI_Gather(const_cast<T*>(in),len,MPITraits<T>::getType(),
    \n+
    306 out,len,MPITraits<T>::getType(),
    \n+
    307 root,communicator);
    \n+
    308 }
    \n+
    309
    \n+
    311 template<class TIN, class TOUT = std::vector<TIN>>
    \n+
    312 MPIFuture<TOUT, TIN> igather(TIN&& data_in, TOUT&& data_out, int root) const{
    \n+
    313 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    \n+
    314 auto mpidata_in = future.get_send_mpidata();
    \n+
    315 auto mpidata_out = future.get_mpidata();
    \n+
    316 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size());
    \n+
    317 int outlen = (me==root) * mpidata_in.size();
    \n+
    318 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
    \n+
    319 mpidata_out.ptr(), outlen, mpidata_out.type(),
    \n+
    320 root, communicator, &future.req_);
    \n+
    321 return future;
    \n+
    322 }
    \n+
    323
    \n+
    325 template<typename T>
    \n+
    326 int gatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ, int root) const
    \n+
    327 {
    \n+
    328 return MPI_Gatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
    \n+
    329 out,recvDataLen,displ,MPITraits<T>::getType(),
    \n+
    330 root,communicator);
    \n+
    331 }
    \n+
    332
    \n+
    335 template<typename T>
    \n+
    336 int scatter (const T* sendData, T* recvData, int len, int root) const
    \n+
    337 {
    \n+
    338 return MPI_Scatter(const_cast<T*>(sendData),len,MPITraits<T>::getType(),
    \n+
    339 recvData,len,MPITraits<T>::getType(),
    \n+
    340 root,communicator);
    \n+
    341 }
    \n+
    342
    \n+
    344 template<class TIN, class TOUT = TIN>
    \n+
    345 MPIFuture<TOUT, TIN> iscatter(TIN&& data_in, TOUT&& data_out, int root) const
    \n+
    346 {
    \n+
    347 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    \n+
    348 auto mpidata_in = future.get_send_mpidata();
    \n+
    349 auto mpidata_out = future.get_mpidata();
    \n+
    350 int inlen = (me==root) * mpidata_in.size()/procs;
    \n+
    351 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(),
    \n+
    352 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(),
    \n+
    353 root, communicator, &future.req_);
    \n+
    354 return future;
    \n+
    355 }
    \n+
    356
    \n+
    358 template<typename T>
    \n+
    359 int scatterv (const T* sendData, int* sendDataLen, int* displ, T* recvData, int recvDataLen, int root) const
    \n+
    360 {
    \n+
    361 return MPI_Scatterv(const_cast<T*>(sendData),sendDataLen,displ,MPITraits<T>::getType(),
    \n+
    362 recvData,recvDataLen,MPITraits<T>::getType(),
    \n+
    363 root,communicator);
    \n+
    364 }
    \n+
    365
    \n+
    366
    \n+
    367 operator MPI_Comm () const
    \n+
    368 {
    \n+
    369 return communicator;
    \n+
    370 }
    \n+
    371
    \n+
    373 template<typename T, typename T1>
    \n+
    374 int allgather(const T* sbuf, int count, T1* rbuf) const
    \n+
    375 {
    \n+
    376 return MPI_Allgather(const_cast<T*>(sbuf), count, MPITraits<T>::getType(),
    \n+
    377 rbuf, count, MPITraits<T1>::getType(),
    \n+
    378 communicator);
    \n+
    379 }
    \n+
    380
    \n+
    382 template<class TIN, class TOUT = TIN>
    \n+
    383 MPIFuture<TOUT, TIN> iallgather(TIN&& data_in, TOUT&& data_out) const
    \n+
    384 {
    \n+
    385 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    \n+
    386 auto mpidata_in = future.get_send_mpidata();
    \n+
    387 auto mpidata_out = future.get_mpidata();
    \n+
    388 assert(mpidata_in.size()*procs <= mpidata_out.size());
    \n+
    389 int outlen = mpidata_in.size();
    \n+
    390 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),
    \n+
    391 mpidata_out.ptr(), outlen, mpidata_out.type(),
    \n+
    392 communicator, &future.req_);
    \n+
    393 return future;
    \n+
    394 }
    \n+
    395
    \n+
    397 template<typename T>
    \n+
    398 int allgatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int* displ) const
    \n+
    399 {
    \n+
    400 return MPI_Allgatherv(const_cast<T*>(in),sendDataLen,MPITraits<T>::getType(),
    \n+
    401 out,recvDataLen,displ,MPITraits<T>::getType(),
    \n+
    402 communicator);
    \n+
    403 }
    \n+
    404
    \n+
    406 template<typename BinaryFunction, typename Type>
    \n+
    407 int allreduce(Type* inout, int len) const
    \n+
    408 {
    \n+
    409 Type* out = new Type[len];
    \n+
    410 int ret = allreduce<BinaryFunction>(inout,out,len);
    \n+
    411 std::copy(out, out+len, inout);
    \n+
    412 delete[] out;
    \n+
    413 return ret;
    \n+
    414 }
    \n+
    415
    \n+
    416 template<typename BinaryFunction, typename Type>
    \n+
    417 Type allreduce(Type&& in) const{
    \n+
    418 Type lvalue_data = std::forward<Type>(in);
    \n+
    419 auto data = getMPIData(lvalue_data);
    \n+
    420 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(),
    \n+\n+
    422 communicator);
    \n+
    423 return lvalue_data;
    \n+
    424 }
    \n+
    425
    \n+
    427 template<class BinaryFunction, class TIN, class TOUT = TIN>
    \n+
    428 MPIFuture<TOUT, TIN> iallreduce(TIN&& data_in, TOUT&& data_out) const {
    \n+
    429 MPIFuture<TOUT, TIN> future(std::forward<TOUT>(data_out), std::forward<TIN>(data_in));
    \n+
    430 auto mpidata_in = future.get_send_mpidata();
    \n+
    431 auto mpidata_out = future.get_mpidata();
    \n+
    432 assert(mpidata_out.size() == mpidata_in.size());
    \n+
    433 assert(mpidata_out.type() == mpidata_in.type());
    \n+
    434 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(),
    \n+
    435 mpidata_out.size(), mpidata_out.type(),
    \n+\n+
    437 communicator, &future.req_);
    \n+
    438 return future;
    \n+
    439 }
    \n+
    440
    \n+
    442 template<class BinaryFunction, class T>
    \n+
    443 MPIFuture<T> iallreduce(T&& data) const{
    \n+
    444 MPIFuture<T> future(std::forward<T>(data));
    \n+
    445 auto mpidata = future.get_mpidata();
    \n+
    446 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(),
    \n+
    447 mpidata.size(), mpidata.type(),
    \n+\n+
    449 communicator, &future.req_);
    \n+
    450 return future;
    \n+
    451 }
    \n+
    452
    \n+
    454 template<typename BinaryFunction, typename Type>
    \n+
    455 int allreduce(const Type* in, Type* out, int len) const
    \n+
    456 {
    \n+
    457 return MPI_Allreduce(const_cast<Type*>(in), out, len, MPITraits<Type>::getType(),
    \n+\n+
    459 }
    \n+
    460
    \n+
    461 private:
    \n+
    462 MPI_Comm communicator;
    \n+
    463 int me;
    \n+
    464 int procs;
    \n+
    465 };
    \n+
    466} // namespace dune
    \n+
    467
    \n+
    468#endif // HAVE_MPI
    \n+
    469
    \n+
    470#endif
    \n+\n+
    Implements an utility class that provides collective communication methods for sequential programs.
    \n+
    Traits classes for mapping types onto MPI_Datatype.
    \n+
    Interface class to translate objects to a MPI_Datatype, void* and size used for MPI calls.
    \n+
    helper classes to provide unique types for standard functions
    \n+
    A few common exception classes.
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    Definition: ftraits.hh:26
    \n-
    T field_type
    export the type representing the field
    Definition: ftraits.hh:28
    \n-
    T real_type
    export the type representing the real type of the field
    Definition: ftraits.hh:30
    \n-
    FieldTraits< T >::field_type field_type
    Definition: ftraits.hh:36
    \n-
    FieldTraits< T >::real_type real_type
    Definition: ftraits.hh:37
    \n-
    T real_type
    Definition: ftraits.hh:44
    \n-
    std::complex< T > field_type
    Definition: ftraits.hh:43
    \n-
    FieldTraits< T >::field_type field_type
    Definition: ftraits.hh:50
    \n-
    FieldTraits< T >::real_type real_type
    Definition: ftraits.hh:51
    \n-
    FieldTraits< T >::real_type real_type
    Definition: ftraits.hh:58
    \n-
    FieldTraits< T >::field_type field_type
    Definition: ftraits.hh:57
    \n+
    ComposeMPIOp(std::plus, MPI_SUM)
    \n+
    auto getMPIData(T &t)
    Definition: mpidata.hh:43
    \n+
    A traits class describing the mapping of types onto MPI_Datatypes.
    Definition: mpitraits.hh:41
    \n+
    Definition: binaryfunctions.hh:18
    \n+
    Definition: binaryfunctions.hh:34
    \n+
    Default exception if an error in the parallel communication of the program occurred.
    Definition: exceptions.hh:287
    \n+
    Collective communication interface and sequential default implementation.
    Definition: communication.hh:100
    \n+
    int size() const
    Number of processes in set, is greater than 0.
    Definition: communication.hh:126
    \n+
    Definition: mpicommunication.hh:41
    \n+
    static MPI_Op get()
    Definition: mpicommunication.hh:44
    \n+
    int max(T *inout, int len) const
    Compute the maximum of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:259
    \n+
    int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ) const
    Gathers data of variable length from all tasks and distribute it to all.
    Definition: mpicommunication.hh:398
    \n+
    T max(const T &in) const
    Compute the maximum of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:250
    \n+
    MPIFuture< T > ibroadcast(T &&data, int root) const
    Distribute an array from the process with rank root to all other processes nonblocking.
    Definition: mpicommunication.hh:288
    \n+
    MPIFuture< void > ibarrier() const
    Nonblocking barrier.
    Definition: mpicommunication.hh:271
    \n+
    MPIFuture< const T > isend(const T &&data, int dest_rank, int tag) const
    Sends the data to the dest_rank nonblocking.
    Definition: mpicommunication.hh:150
    \n+
    T recv(T &&data, int source_rank, int tag, MPI_Status *status=MPI_STATUS_IGNORE) const
    Receives the data from the source_rank.
    Definition: mpicommunication.hh:161
    \n+
    int barrier() const
    Wait until all processes have arrived at this point in the program.
    Definition: mpicommunication.hh:265
    \n+
    int rank() const
    Return rank, is between 0 and size()-1.
    Definition: mpicommunication.hh:128
    \n+
    int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int recvDataLen, int root) const
    Scatter arrays of variable length from a root to all other tasks.
    Definition: mpicommunication.hh:359
    \n+
    MPIFuture< TOUT, TIN > iallgather(TIN &&data_in, TOUT &&data_out) const
    Gathers data from all tasks and distribute it to all nonblocking.
    Definition: mpicommunication.hh:383
    \n+
    Type allreduce(Type &&in) const
    Definition: mpicommunication.hh:417
    \n+
    int sum(T *inout, int len) const
    Compute the sum of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:210
    \n+
    int broadcast(T *inout, int len, int root) const
    Distribute an array from the process with rank root to all other processes.
    Definition: mpicommunication.hh:281
    \n+
    MPIFuture< T > iallreduce(T &&data) const
    Compute something over all processes nonblocking.
    Definition: mpicommunication.hh:443
    \n+
    T sum(const T &in) const
    Compute the sum of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:201
    \n+
    int allreduce(const Type *in, Type *out, int len) const
    Definition: mpicommunication.hh:455
    \n+
    MPIFuture< TOUT, TIN > iallreduce(TIN &&data_in, TOUT &&data_out) const
    Compute something over all processes nonblocking.
    Definition: mpicommunication.hh:428
    \n+
    int size() const
    Number of processes in set, is greater than 0.
    Definition: mpicommunication.hh:134
    \n+
    int gather(const T *in, T *out, int len, int root) const
    Gather arrays on root task.
    Definition: mpicommunication.hh:303
    \n+
    int allreduce(Type *inout, int len) const
    Compute something over all processes for each component of an array and return the result in every pr...
    Definition: mpicommunication.hh:407
    \n+
    T rrecv(T &&data, int source_rank, int tag, MPI_Status *status=MPI_STATUS_IGNORE) const
    Definition: mpicommunication.hh:182
    \n+
    int scatter(const T *sendData, T *recvData, int len, int root) const
    Scatter array from a root to all other task.
    Definition: mpicommunication.hh:336
    \n+
    MPIFuture< T > irecv(T &&data, int source_rank, int tag) const
    Receives the data from the source_rank nonblocking.
    Definition: mpicommunication.hh:172
    \n+
    int prod(T *inout, int len) const
    Compute the product of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:226
    \n+
    MPIFuture< TOUT, TIN > igather(TIN &&data_in, TOUT &&data_out, int root) const
    Gather arrays on root task nonblocking.
    Definition: mpicommunication.hh:312
    \n+
    T min(const T &in) const
    Compute the minimum of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:233
    \n+
    Communication(const MPI_Comm &c=MPI_COMM_WORLD)
    Instantiation using a MPI communicator.
    Definition: mpicommunication.hh:111
    \n+
    MPIFuture< TOUT, TIN > iscatter(TIN &&data_in, TOUT &&data_out, int root) const
    Scatter array from a root to all other task nonblocking.
    Definition: mpicommunication.hh:345
    \n+
    int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ, int root) const
    Gather arrays of variable size on root task.
    Definition: mpicommunication.hh:326
    \n+
    int min(T *inout, int len) const
    Compute the minimum of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:242
    \n+
    int allgather(const T *sbuf, int count, T1 *rbuf) const
    Gathers data from all tasks and distribute it to all.
    Definition: mpicommunication.hh:374
    \n+
    int send(const T &data, int dest_rank, int tag) const
    Sends the data to the dest_rank.
    Definition: mpicommunication.hh:141
    \n+
    T prod(const T &in) const
    Compute the product of the argument over all processes and return the result in every process....
    Definition: mpicommunication.hh:217
    \n+
    Provides a future-like object for MPI communication. It contains the object that will be received and...
    Definition: mpifuture.hh:85
    \n+
    auto get_send_mpidata()
    Definition: mpifuture.hh:169
    \n+
    auto get_mpidata()
    Definition: mpifuture.hh:165
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,102 +4,666 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-ftraits.hh\n+ * parallel\n+mpicommunication.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_FTRAITS_HH\n- 6#define DUNE_FTRAITS_HH\n+ 5#ifndef DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH\n+ 6#define DUNE_COMMON_PARALLEL_MPICOMMUNICATION_HH\n 7\n- 12#include \n- 13#include \n- 14\n- 15namespace Dune {\n- 16\n- 24 template\n-25 struct FieldTraits\n- 26 {\n-28 typedef T field_type;\n-30 typedef T real_type;\n- 31 };\n- 32\n- 33 template\n-34 struct FieldTraits\n- 35 {\n-36 typedef typename FieldTraits::field_type field_type;\n-37 typedef typename FieldTraits::real_type real_type;\n- 38 };\n- 39\n- 40 template\n-41 struct FieldTraits< std::complex >\n- 42 {\n-43 typedef std::complex field_type;\n-44 typedef T real_type;\n- 45 };\n- 46\n- 47 template\n-48 struct FieldTraits< T[N] >\n- 49 {\n-50 typedef typename FieldTraits::field_type field_type;\n-51 typedef typename FieldTraits::real_type real_type;\n- 52 };\n- 53\n- 54 template\n-55 struct FieldTraits< std::vector >\n- 56 {\n-57 typedef typename FieldTraits::field_type field_type;\n-58 typedef typename FieldTraits::real_type real_type;\n- 59 };\n- 60\n- 61} // end namespace Dune\n- 62\n- 63#endif // DUNE_FTRAITS_HH\n-std\n-STL namespace.\n+ 16#if HAVE_MPI\n+ 17\n+ 18#include \n+ 19#include \n+ 20#include \n+ 21\n+ 22#include \n+ 23\n+ 24#include \n+ 25#include \n+ 26#include \n+ 27#include \n+ 28#include \n+ 29#include \n+ 30\n+ 31namespace Dune\n+ 32{\n+ 33\n+ 34 //=======================================================\n+ 35 // use singleton pattern and template specialization to\n+ 36 // generate MPI operations\n+ 37 //=======================================================\n+ 38\n+ 39 template\n+40 class Generic_MPI_Op\n+ 41 {\n+ 42\n+ 43 public:\n+44 static MPI_Op get ()\n+ 45 {\n+ 46 if (!op)\n+ 47 {\n+ 48 op = std::make_unique();\n+ 49 // The following line leaks an MPI operation object, because the\n+corresponding\n+ 50 //`MPI_Op_free` is never called. It is never called because there is no\n+easy\n+ 51 // way to call it at the right moment: right before the call to\n+MPI_Finalize.\n+ 52 // See https://gitlab.dune-project.org/core/dune-istl/issues/80\n+ 53 MPI_Op_create((void (*)(void*, void*, int*,\n+MPI_Datatype*))&operation,true,op.get());\n+ 54 }\n+ 55 return *op;\n+ 56 }\n+ 57 private:\n+ 58 static void operation (Type *in, Type *inout, int *len, MPI_Datatype*)\n+ 59 {\n+ 60 BinaryFunction func;\n+ 61\n+ 62 for (int i=0; i< *len; ++i, ++in, ++inout) {\n+ 63 Type temp;\n+ 64 temp = func(*in, *inout);\n+ 65 *inout = temp;\n+ 66 }\n+ 67 }\n+ 68 Generic_MPI_Op () {}\n+ 69 Generic_MPI_Op (const Generic_MPI_Op& ) {}\n+ 70 static std::unique_ptr op;\n+ 71 };\n+ 72\n+ 73\n+ 74 template\n+ 75 std::unique_ptr Generic_MPI_Op::op;\n+ 76\n+77#define ComposeMPIOp(func,op) \\\n+ 78 template \\\n+ 79 class Generic_MPI_Op, std::enable_if_t::\n+is_intrinsic> >{ \\\n+ 80 public: \\\n+ 81 static MPI_Op get(){ \\\n+ 82 return op; \\\n+ 83 } \\\n+ 84 private: \\\n+ 85 Generic_MPI_Op () {} \\\n+ 86 Generic_MPI_Op (const Generic_MPI_Op & ) {} \\\n+ 87 }\n+ 88\n+ 89\n+90 ComposeMPIOp(std::plus, MPI_SUM);\n+91 ComposeMPIOp(std::multiplies, MPI_PROD);\n+92 ComposeMPIOp(Min, MPI_MIN);\n+93 ComposeMPIOp(Max, MPI_MAX);\n+ 94\n+ 95#undef ComposeMPIOp\n+ 96\n+ 97\n+ 98 //=======================================================\n+ 99 // use singleton pattern and template specialization to\n+ 100 // generate MPI operations\n+ 101 //=======================================================\n+ 102\n+ 106 template<>\n+107 class Communication\n+ 108 {\n+ 109 public:\n+111 Communication (const MPI_Comm& c = MPI_COMM_WORLD)\n+ 112 : communicator(c)\n+ 113 {\n+ 114 if(communicator!=MPI_COMM_NULL) {\n+ 115 int initialized = 0;\n+ 116 MPI_Initialized(&initialized);\n+ 117 if (!initialized)\n+ 118 DUNE_THROW(ParallelError,\"You must call MPIHelper::instance(argc,argv) in\n+your main() function before using the MPI Communication!\");\n+ 119 MPI_Comm_rank(communicator,&me);\n+ 120 MPI_Comm_size(communicator,&procs);\n+ 121 }else{\n+ 122 procs=0;\n+ 123 me=-1;\n+ 124 }\n+ 125 }\n+ 126\n+128 int rank () const\n+ 129 {\n+ 130 return me;\n+ 131 }\n+ 132\n+134 int size () const\n+ 135 {\n+ 136 return procs;\n+ 137 }\n+ 138\n+ 140 template\n+141 int send(const T& data, int dest_rank, int tag) const\n+ 142 {\n+ 143 auto mpi_data = getMPIData(data);\n+ 144 return MPI_Send(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),\n+ 145 dest_rank, tag, communicator);\n+ 146 }\n+ 147\n+ 149 template\n+150 MPIFuture isend(const T&& data, int dest_rank, int tag) const\n+ 151 {\n+ 152 MPIFuture future(std::forward(data));\n+ 153 auto mpidata = future.get_mpidata();\n+ 154 MPI_Isend(mpidata.ptr(), mpidata.size(), mpidata.type(),\n+ 155 dest_rank, tag, communicator, &future.req_);\n+ 156 return future;\n+ 157 }\n+ 158\n+ 160 template\n+161 T recv(T&& data, int source_rank, int tag, MPI_Status* status =\n+MPI_STATUS_IGNORE) const\n+ 162 {\n+ 163 T lvalue_data(std::forward(data));\n+ 164 auto mpi_data = getMPIData(lvalue_data);\n+ 165 MPI_Recv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(),\n+ 166 source_rank, tag, communicator, status);\n+ 167 return lvalue_data;\n+ 168 }\n+ 169\n+ 171 template\n+172 MPIFuture irecv(T&& data, int source_rank, int tag) const\n+ 173 {\n+ 174 MPIFuture future(std::forward(data));\n+ 175 auto mpidata = future.get_mpidata();\n+ 176 MPI_Irecv(mpidata.ptr(), mpidata.size(), mpidata.type(),\n+ 177 source_rank, tag, communicator, &future.req_);\n+ 178 return future;\n+ 179 }\n+ 180\n+ 181 template\n+182 T rrecv(T&& data, int source_rank, int tag, MPI_Status* status =\n+MPI_STATUS_IGNORE) const\n+ 183 {\n+ 184 MPI_Status _status;\n+ 185 MPI_Message _message;\n+ 186 T lvalue_data(std::forward(data));\n+ 187 auto mpi_data = getMPIData(lvalue_data);\n+ 188 static_assert(!mpi_data.static_size, \"rrecv work only for non-static-sized\n+types.\");\n+ 189 if(status == MPI_STATUS_IGNORE)\n+ 190 status = &_status;\n+ 191 MPI_Mprobe(source_rank, tag, communicator, &_message, status);\n+ 192 int size;\n+ 193 MPI_Get_count(status, mpi_data.type(), &size);\n+ 194 mpi_data.resize(size);\n+ 195 MPI_Mrecv(mpi_data.ptr(), mpi_data.size(), mpi_data.type(), &_message,\n+status);\n+ 196 return lvalue_data;\n+ 197 }\n+ 198\n+ 200 template\n+201 T sum (const T& in) const\n+ 202 {\n+ 203 T out;\n+ 204 allreduce >(&in,&out,1);\n+ 205 return out;\n+ 206 }\n+ 207\n+ 209 template\n+210 int sum (T* inout, int len) const\n+ 211 {\n+ 212 return allreduce >(inout,len);\n+ 213 }\n+ 214\n+ 216 template\n+217 T prod (const T& in) const\n+ 218 {\n+ 219 T out;\n+ 220 allreduce >(&in,&out,1);\n+ 221 return out;\n+ 222 }\n+ 223\n+ 225 template\n+226 int prod (T* inout, int len) const\n+ 227 {\n+ 228 return allreduce >(inout,len);\n+ 229 }\n+ 230\n+ 232 template\n+233 T min (const T& in) const\n+ 234 {\n+ 235 T out;\n+ 236 allreduce >(&in,&out,1);\n+ 237 return out;\n+ 238 }\n+ 239\n+ 241 template\n+242 int min (T* inout, int len) const\n+ 243 {\n+ 244 return allreduce >(inout,len);\n+ 245 }\n+ 246\n+ 247\n+ 249 template\n+250 T max (const T& in) const\n+ 251 {\n+ 252 T out;\n+ 253 allreduce >(&in,&out,1);\n+ 254 return out;\n+ 255 }\n+ 256\n+ 258 template\n+259 int max (T* inout, int len) const\n+ 260 {\n+ 261 return allreduce >(inout,len);\n+ 262 }\n+ 263\n+265 int barrier () const\n+ 266 {\n+ 267 return MPI_Barrier(communicator);\n+ 268 }\n+ 269\n+271 MPIFuture ibarrier () const\n+ 272 {\n+ 273 MPIFuture future(true); // make a valid MPIFuture\n+ 274 MPI_Ibarrier(communicator, &future.req_);\n+ 275 return future;\n+ 276 }\n+ 277\n+ 278\n+ 280 template\n+281 int broadcast (T* inout, int len, int root) const\n+ 282 {\n+ 283 return MPI_Bcast(inout,len,MPITraits::getType(),root,communicator);\n+ 284 }\n+ 285\n+ 287 template\n+288 MPIFuture ibroadcast(T&& data, int root) const{\n+ 289 MPIFuture future(std::forward(data));\n+ 290 auto mpidata = future.get_mpidata();\n+ 291 MPI_Ibcast(mpidata.ptr(),\n+ 292 mpidata.size(),\n+ 293 mpidata.type(),\n+ 294 root,\n+ 295 communicator,\n+ 296 &future.req_);\n+ 297 return future;\n+ 298 }\n+ 299\n+ 302 template\n+303 int gather (const T* in, T* out, int len, int root) const\n+ 304 {\n+ 305 return MPI_Gather(const_cast(in),len,MPITraits::getType(),\n+ 306 out,len,MPITraits::getType(),\n+ 307 root,communicator);\n+ 308 }\n+ 309\n+ 311 template>\n+312 MPIFuture igather(TIN&& data_in, TOUT&& data_out, int root)\n+const{\n+ 313 MPIFuture future(std::forward(data_out), std::\n+forward(data_in));\n+ 314 auto mpidata_in = future.get_send_mpidata();\n+ 315 auto mpidata_out = future.get_mpidata();\n+ 316 assert(root != me || mpidata_in.size()*procs <= mpidata_out.size());\n+ 317 int outlen = (me==root) * mpidata_in.size();\n+ 318 MPI_Igather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),\n+ 319 mpidata_out.ptr(), outlen, mpidata_out.type(),\n+ 320 root, communicator, &future.req_);\n+ 321 return future;\n+ 322 }\n+ 323\n+ 325 template\n+326 int gatherv (const T* in, int sendDataLen, T* out, int* recvDataLen, int*\n+displ, int root) const\n+ 327 {\n+ 328 return MPI_Gatherv(const_cast(in),sendDataLen,MPITraits::getType(),\n+ 329 out,recvDataLen,displ,MPITraits::getType(),\n+ 330 root,communicator);\n+ 331 }\n+ 332\n+ 335 template\n+336 int scatter (const T* sendData, T* recvData, int len, int root) const\n+ 337 {\n+ 338 return MPI_Scatter(const_cast(sendData),len,MPITraits::getType(),\n+ 339 recvData,len,MPITraits::getType(),\n+ 340 root,communicator);\n+ 341 }\n+ 342\n+ 344 template\n+345 MPIFuture iscatter(TIN&& data_in, TOUT&& data_out, int root)\n+const\n+ 346 {\n+ 347 MPIFuture future(std::forward(data_out), std::\n+forward(data_in));\n+ 348 auto mpidata_in = future.get_send_mpidata();\n+ 349 auto mpidata_out = future.get_mpidata();\n+ 350 int inlen = (me==root) * mpidata_in.size()/procs;\n+ 351 MPI_Iscatter(mpidata_in.ptr(), inlen, mpidata_in.type(),\n+ 352 mpidata_out.ptr(), mpidata_out.size(), mpidata_out.type(),\n+ 353 root, communicator, &future.req_);\n+ 354 return future;\n+ 355 }\n+ 356\n+ 358 template\n+359 int scatterv (const T* sendData, int* sendDataLen, int* displ, T* recvData,\n+int recvDataLen, int root) const\n+ 360 {\n+ 361 return MPI_Scatterv(const_cast\n+(sendData),sendDataLen,displ,MPITraits::getType(),\n+ 362 recvData,recvDataLen,MPITraits::getType(),\n+ 363 root,communicator);\n+ 364 }\n+ 365\n+ 366\n+367 operator MPI_Comm () const\n+ 368 {\n+ 369 return communicator;\n+ 370 }\n+ 371\n+ 373 template\n+374 int allgather(const T* sbuf, int count, T1* rbuf) const\n+ 375 {\n+ 376 return MPI_Allgather(const_cast(sbuf), count, MPITraits::getType(),\n+ 377 rbuf, count, MPITraits::getType(),\n+ 378 communicator);\n+ 379 }\n+ 380\n+ 382 template\n+383 MPIFuture iallgather(TIN&& data_in, TOUT&& data_out) const\n+ 384 {\n+ 385 MPIFuture future(std::forward(data_out), std::\n+forward(data_in));\n+ 386 auto mpidata_in = future.get_send_mpidata();\n+ 387 auto mpidata_out = future.get_mpidata();\n+ 388 assert(mpidata_in.size()*procs <= mpidata_out.size());\n+ 389 int outlen = mpidata_in.size();\n+ 390 MPI_Iallgather(mpidata_in.ptr(), mpidata_in.size(), mpidata_in.type(),\n+ 391 mpidata_out.ptr(), outlen, mpidata_out.type(),\n+ 392 communicator, &future.req_);\n+ 393 return future;\n+ 394 }\n+ 395\n+ 397 template\n+398 int allgatherv (const T* in, int sendDataLen, T* out, int* recvDataLen,\n+int* displ) const\n+ 399 {\n+ 400 return MPI_Allgatherv(const_cast(in),sendDataLen,MPITraits::getType\n+(),\n+ 401 out,recvDataLen,displ,MPITraits::getType(),\n+ 402 communicator);\n+ 403 }\n+ 404\n+ 406 template\n+407 int allreduce(Type* inout, int len) const\n+ 408 {\n+ 409 Type* out = new Type[len];\n+ 410 int ret = allreduce(inout,out,len);\n+ 411 std::copy(out, out+len, inout);\n+ 412 delete[] out;\n+ 413 return ret;\n+ 414 }\n+ 415\n+ 416 template\n+417 Type allreduce(Type&& in) const{\n+ 418 Type lvalue_data = std::forward(in);\n+ 419 auto data = getMPIData(lvalue_data);\n+ 420 MPI_Allreduce(MPI_IN_PLACE, data.ptr(), data.size(), data.type(),\n+ 421 (Generic_MPI_Op::get()),\n+ 422 communicator);\n+ 423 return lvalue_data;\n+ 424 }\n+ 425\n+ 427 template\n+428 MPIFuture iallreduce(TIN&& data_in, TOUT&& data_out) const {\n+ 429 MPIFuture future(std::forward(data_out), std::\n+forward(data_in));\n+ 430 auto mpidata_in = future.get_send_mpidata();\n+ 431 auto mpidata_out = future.get_mpidata();\n+ 432 assert(mpidata_out.size() == mpidata_in.size());\n+ 433 assert(mpidata_out.type() == mpidata_in.type());\n+ 434 MPI_Iallreduce(mpidata_in.ptr(), mpidata_out.ptr(),\n+ 435 mpidata_out.size(), mpidata_out.type(),\n+ 436 (Generic_MPI_Op::get()),\n+ 437 communicator, &future.req_);\n+ 438 return future;\n+ 439 }\n+ 440\n+ 442 template\n+443 MPIFuture iallreduce(T&& data) const{\n+ 444 MPIFuture future(std::forward(data));\n+ 445 auto mpidata = future.get_mpidata();\n+ 446 MPI_Iallreduce(MPI_IN_PLACE, mpidata.ptr(),\n+ 447 mpidata.size(), mpidata.type(),\n+ 448 (Generic_MPI_Op::get()),\n+ 449 communicator, &future.req_);\n+ 450 return future;\n+ 451 }\n+ 452\n+ 454 template\n+455 int allreduce(const Type* in, Type* out, int len) const\n+ 456 {\n+ 457 return MPI_Allreduce(const_cast(in), out, len, MPITraits::\n+getType(),\n+ 458 (Generic_MPI_Op::get()),communicator);\n+ 459 }\n+ 460\n+ 461 private:\n+ 462 MPI_Comm communicator;\n+ 463 int me;\n+ 464 int procs;\n+ 465 };\n+ 466} // namespace dune\n+ 467\n+ 468#endif // HAVE_MPI\n+ 469\n+ 470#endif\n+mpifuture.hh\n+communication.hh\n+Implements an utility class that provides collective communication methods for\n+sequential programs.\n+mpitraits.hh\n+Traits classes for mapping types onto MPI_Datatype.\n+mpidata.hh\n+Interface class to translate objects to a MPI_Datatype, void* and size used for\n+MPI calls.\n+binaryfunctions.hh\n+helper classes to provide unique types for standard functions\n+exceptions.hh\n+A few common exception classes.\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::FieldTraits\n-Definition: ftraits.hh:26\n-Dune::FieldTraits::field_type\n-T field_type\n-export the type representing the field\n-Definition: ftraits.hh:28\n-Dune::FieldTraits::real_type\n-T real_type\n-export the type representing the real type of the field\n-Definition: ftraits.hh:30\n-Dune::FieldTraits<_const_T_>::field_type\n-FieldTraits< T >::field_type field_type\n-Definition: ftraits.hh:36\n-Dune::FieldTraits<_const_T_>::real_type\n-FieldTraits< T >::real_type real_type\n-Definition: ftraits.hh:37\n-Dune::FieldTraits<_std::complex<_T_>_>::real_type\n-T real_type\n-Definition: ftraits.hh:44\n-Dune::FieldTraits<_std::complex<_T_>_>::field_type\n-std::complex< T > field_type\n-Definition: ftraits.hh:43\n-Dune::FieldTraits<_T[N]_>::field_type\n-FieldTraits< T >::field_type field_type\n-Definition: ftraits.hh:50\n-Dune::FieldTraits<_T[N]_>::real_type\n-FieldTraits< T >::real_type real_type\n-Definition: ftraits.hh:51\n-Dune::FieldTraits<_std::vector<_T_>_>::real_type\n-FieldTraits< T >::real_type real_type\n-Definition: ftraits.hh:58\n-Dune::FieldTraits<_std::vector<_T_>_>::field_type\n-FieldTraits< T >::field_type field_type\n-Definition: ftraits.hh:57\n+Dune::ComposeMPIOp\n+ComposeMPIOp(std::plus, MPI_SUM)\n+Dune::getMPIData\n+auto getMPIData(T &t)\n+Definition: mpidata.hh:43\n+Dune::MPITraits\n+A traits class describing the mapping of types onto MPI_Datatypes.\n+Definition: mpitraits.hh:41\n+Dune::Min\n+Definition: binaryfunctions.hh:18\n+Dune::Max\n+Definition: binaryfunctions.hh:34\n+Dune::ParallelError\n+Default exception if an error in the parallel communication of the program\n+occurred.\n+Definition: exceptions.hh:287\n+Dune::Communication\n+Collective communication interface and sequential default implementation.\n+Definition: communication.hh:100\n+Dune::Communication::size\n+int size() const\n+Number of processes in set, is greater than 0.\n+Definition: communication.hh:126\n+Dune::Generic_MPI_Op\n+Definition: mpicommunication.hh:41\n+Dune::Generic_MPI_Op::get\n+static MPI_Op get()\n+Definition: mpicommunication.hh:44\n+Dune::Communication<_MPI_Comm_>::max\n+int max(T *inout, int len) const\n+Compute the maximum of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:259\n+Dune::Communication<_MPI_Comm_>::allgatherv\n+int allgatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int\n+*displ) const\n+Gathers data of variable length from all tasks and distribute it to all.\n+Definition: mpicommunication.hh:398\n+Dune::Communication<_MPI_Comm_>::max\n+T max(const T &in) const\n+Compute the maximum of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:250\n+Dune::Communication<_MPI_Comm_>::ibroadcast\n+MPIFuture< T > ibroadcast(T &&data, int root) const\n+Distribute an array from the process with rank root to all other processes\n+nonblocking.\n+Definition: mpicommunication.hh:288\n+Dune::Communication<_MPI_Comm_>::ibarrier\n+MPIFuture< void > ibarrier() const\n+Nonblocking barrier.\n+Definition: mpicommunication.hh:271\n+Dune::Communication<_MPI_Comm_>::isend\n+MPIFuture< const T > isend(const T &&data, int dest_rank, int tag) const\n+Sends the data to the dest_rank nonblocking.\n+Definition: mpicommunication.hh:150\n+Dune::Communication<_MPI_Comm_>::recv\n+T recv(T &&data, int source_rank, int tag, MPI_Status\n+*status=MPI_STATUS_IGNORE) const\n+Receives the data from the source_rank.\n+Definition: mpicommunication.hh:161\n+Dune::Communication<_MPI_Comm_>::barrier\n+int barrier() const\n+Wait until all processes have arrived at this point in the program.\n+Definition: mpicommunication.hh:265\n+Dune::Communication<_MPI_Comm_>::rank\n+int rank() const\n+Return rank, is between 0 and size()-1.\n+Definition: mpicommunication.hh:128\n+Dune::Communication<_MPI_Comm_>::scatterv\n+int scatterv(const T *sendData, int *sendDataLen, int *displ, T *recvData, int\n+recvDataLen, int root) const\n+Scatter arrays of variable length from a root to all other tasks.\n+Definition: mpicommunication.hh:359\n+Dune::Communication<_MPI_Comm_>::iallgather\n+MPIFuture< TOUT, TIN > iallgather(TIN &&data_in, TOUT &&data_out) const\n+Gathers data from all tasks and distribute it to all nonblocking.\n+Definition: mpicommunication.hh:383\n+Dune::Communication<_MPI_Comm_>::allreduce\n+Type allreduce(Type &&in) const\n+Definition: mpicommunication.hh:417\n+Dune::Communication<_MPI_Comm_>::sum\n+int sum(T *inout, int len) const\n+Compute the sum of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:210\n+Dune::Communication<_MPI_Comm_>::broadcast\n+int broadcast(T *inout, int len, int root) const\n+Distribute an array from the process with rank root to all other processes.\n+Definition: mpicommunication.hh:281\n+Dune::Communication<_MPI_Comm_>::iallreduce\n+MPIFuture< T > iallreduce(T &&data) const\n+Compute something over all processes nonblocking.\n+Definition: mpicommunication.hh:443\n+Dune::Communication<_MPI_Comm_>::sum\n+T sum(const T &in) const\n+Compute the sum of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:201\n+Dune::Communication<_MPI_Comm_>::allreduce\n+int allreduce(const Type *in, Type *out, int len) const\n+Definition: mpicommunication.hh:455\n+Dune::Communication<_MPI_Comm_>::iallreduce\n+MPIFuture< TOUT, TIN > iallreduce(TIN &&data_in, TOUT &&data_out) const\n+Compute something over all processes nonblocking.\n+Definition: mpicommunication.hh:428\n+Dune::Communication<_MPI_Comm_>::size\n+int size() const\n+Number of processes in set, is greater than 0.\n+Definition: mpicommunication.hh:134\n+Dune::Communication<_MPI_Comm_>::gather\n+int gather(const T *in, T *out, int len, int root) const\n+Gather arrays on root task.\n+Definition: mpicommunication.hh:303\n+Dune::Communication<_MPI_Comm_>::allreduce\n+int allreduce(Type *inout, int len) const\n+Compute something over all processes for each component of an array and return\n+the result in every pr...\n+Definition: mpicommunication.hh:407\n+Dune::Communication<_MPI_Comm_>::rrecv\n+T rrecv(T &&data, int source_rank, int tag, MPI_Status\n+*status=MPI_STATUS_IGNORE) const\n+Definition: mpicommunication.hh:182\n+Dune::Communication<_MPI_Comm_>::scatter\n+int scatter(const T *sendData, T *recvData, int len, int root) const\n+Scatter array from a root to all other task.\n+Definition: mpicommunication.hh:336\n+Dune::Communication<_MPI_Comm_>::irecv\n+MPIFuture< T > irecv(T &&data, int source_rank, int tag) const\n+Receives the data from the source_rank nonblocking.\n+Definition: mpicommunication.hh:172\n+Dune::Communication<_MPI_Comm_>::prod\n+int prod(T *inout, int len) const\n+Compute the product of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:226\n+Dune::Communication<_MPI_Comm_>::igather\n+MPIFuture< TOUT, TIN > igather(TIN &&data_in, TOUT &&data_out, int root) const\n+Gather arrays on root task nonblocking.\n+Definition: mpicommunication.hh:312\n+Dune::Communication<_MPI_Comm_>::min\n+T min(const T &in) const\n+Compute the minimum of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:233\n+Dune::Communication<_MPI_Comm_>::Communication\n+Communication(const MPI_Comm &c=MPI_COMM_WORLD)\n+Instantiation using a MPI communicator.\n+Definition: mpicommunication.hh:111\n+Dune::Communication<_MPI_Comm_>::iscatter\n+MPIFuture< TOUT, TIN > iscatter(TIN &&data_in, TOUT &&data_out, int root) const\n+Scatter array from a root to all other task nonblocking.\n+Definition: mpicommunication.hh:345\n+Dune::Communication<_MPI_Comm_>::gatherv\n+int gatherv(const T *in, int sendDataLen, T *out, int *recvDataLen, int *displ,\n+int root) const\n+Gather arrays of variable size on root task.\n+Definition: mpicommunication.hh:326\n+Dune::Communication<_MPI_Comm_>::min\n+int min(T *inout, int len) const\n+Compute the minimum of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:242\n+Dune::Communication<_MPI_Comm_>::allgather\n+int allgather(const T *sbuf, int count, T1 *rbuf) const\n+Gathers data from all tasks and distribute it to all.\n+Definition: mpicommunication.hh:374\n+Dune::Communication<_MPI_Comm_>::send\n+int send(const T &data, int dest_rank, int tag) const\n+Sends the data to the dest_rank.\n+Definition: mpicommunication.hh:141\n+Dune::Communication<_MPI_Comm_>::prod\n+T prod(const T &in) const\n+Compute the product of the argument over all processes and return the result in\n+every process....\n+Definition: mpicommunication.hh:217\n+Dune::MPIFuture\n+Provides a future-like object for MPI communication. It contains the object\n+that will be received and...\n+Definition: mpifuture.hh:85\n+Dune::MPIFuture::get_send_mpidata\n+auto get_send_mpidata()\n+Definition: mpifuture.hh:169\n+Dune::MPIFuture::get_mpidata\n+auto get_mpidata()\n+Definition: mpifuture.hh:165\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00086.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00086.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: filledarray.hh File Reference\n+dune-common: localindex.hh File Reference\n \n \n \n \n \n \n \n@@ -58,47 +58,55 @@\n \n \n \n \n \n
    \n \n-
    filledarray.hh File Reference
    \n+Enumerations
    \n+ \n \n
    \n \n-

    Utility to generate an array with a certain value. \n+

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

    \n-
    #include <array>
    \n-#include <cstddef>
    \n+
    #include <cstddef>
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+

    \n+Classes

    class  Dune::LocalIndex
     An index present on the local process. More...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n+\n+\n+\n+\n

    \n-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. More...
     

    \n+Enumerations

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

    Detailed Description

    \n-

    Utility to generate an array with a certain value.

    \n+

    Provides classes for use as the local index in ParallelIndexSet.

    \n+
    Author
    Markus Blatt
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,28 +4,33 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Functions\n-filledarray.hh File Reference\n-Utility to generate an array with a certain value. More...\n-#include \n+ * parallel\n+Classes | Namespaces | Enumerations\n+localindex.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+Provides classes for use as the local index in ParallelIndexSet. More...\n #include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+class \u00a0Dune::LocalIndex\n+\u00a0 An index present on the local process. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n- Functions\n-template\n-constexpr std::array< T, n >\u00a0Dune::filledArray (const T &t)\n-\u00a0 Return an array filled with the provided value.\n- More...\n+ Enumerations\n+enum \u00a0Dune::LocalIndexState { Dune::VALID , Dune::DELETED }\n+\u00a0 The states available for the local indices. More...\n \u00a0\n ***** Detailed Description *****\n-Utility to generate an array with a certain value.\n+Provides classes for use as the local index in ParallelIndexSet.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00086_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: filledarray.hh Source File\n+dune-common: localindex.hh Source File\n \n \n \n \n \n \n \n@@ -58,50 +58,101 @@\n \n
    \n \n \n
    \n
    \n-
    filledarray.hh
    \n+
    localindex.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n
    5
    \n-
    6#ifndef DUNE_COMMON_FILLED_ARRAY_HH
    \n-
    7#define DUNE_COMMON_FILLED_ARRAY_HH
    \n+
    6#ifndef DUNE_COMMON_LOCALINDEX_HH
    \n+
    7#define DUNE_COMMON_LOCALINDEX_HH
    \n
    8
    \n-
    13#include <array>
    \n-
    14#include <cstddef>
    \n-
    15
    \n-
    16namespace Dune
    \n-
    17{
    \n-
    24
    \n-
    32 template<std::size_t n, class T>
    \n-
    33 constexpr std::array<T, n> filledArray(const T& t)
    \n-
    34 {
    \n-
    35 std::array<T, n> arr{};
    \n-
    36 // this is constexpr in c++17, `arr.fill(t)` is not
    \n-
    37 for(auto &el : arr)
    \n-
    38 el = t;
    \n-
    39 return arr;
    \n-
    40 }
    \n-
    41
    \n-
    44} // end namespace Dune
    \n-
    45
    \n-
    46#endif // DUNE_COMMON_FILLED_ARRAY_HH
    \n-
    constexpr std::array< T, n > filledArray(const T &t)
    Return an array filled with the provided value.
    Definition: filledarray.hh:33
    \n+
    9#include <cstddef>
    \n+
    10
    \n+
    11namespace Dune
    \n+
    12{
    \n+
    13
    \n+
    14
    \n+\n+
    29
    \n+
    30
    \n+\n+
    35 {
    \n+
    36 public:
    \n+\n+
    42 localIndex_(0), state_(VALID){}
    \n+
    43
    \n+
    44
    \n+
    49 LocalIndex(std::size_t index) :
    \n+
    50 localIndex_(index), state_(VALID){}
    \n+
    55 inline const std::size_t& local() const;
    \n+
    56
    \n+
    60 inline operator std::size_t() const;
    \n+
    61
    \n+
    67 inline LocalIndex& operator=(std::size_t index);
    \n+
    68
    \n+
    73 inline LocalIndexState state() const;
    \n+
    74
    \n+
    79 inline void setState(LocalIndexState state);
    \n+
    80
    \n+
    81 private:
    \n+
    83 std::size_t localIndex_;
    \n+
    84
    \n+
    91 char state_;
    \n+
    92
    \n+
    93 };
    \n+
    94
    \n+
    95
    \n+
    96
    \n+
    97 inline const std::size_t& LocalIndex::local() const {
    \n+
    98 return localIndex_;
    \n+
    99 }
    \n+
    100
    \n+
    101 inline LocalIndex::operator std::size_t() const {
    \n+
    102 return localIndex_;
    \n+
    103 }
    \n+
    104
    \n+
    105 inline LocalIndex& LocalIndex::operator=(std::size_t index){
    \n+
    106 localIndex_ = index;
    \n+
    107 return *this;
    \n+
    108 }
    \n+
    109
    \n+\n+
    111 return static_cast<LocalIndexState>(state_);
    \n+
    112 }
    \n+
    113
    \n+\n+
    115 state_ = static_cast<char>(state);
    \n+
    116 }
    \n+
    117
    \n+
    120} // namespace Dune
    \n+
    121
    \n+
    122#endif
    \n+
    LocalIndexState
    The states available for the local indices.
    Definition: localindex.hh:28
    \n+
    LocalIndex & operator=(std::size_t index)
    Assign a new local index.
    Definition: localindex.hh:105
    \n+
    LocalIndexState state() const
    Get the state.
    Definition: localindex.hh:110
    \n+
    const std::size_t & local() const
    get the local index.
    Definition: localindex.hh:97
    \n+
    void setState(LocalIndexState state)
    Set the state.
    Definition: localindex.hh:114
    \n+
    @ VALID
    Definition: localindex.hh:28
    \n+
    @ DELETED
    Definition: localindex.hh:28
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    An index present on the local process.
    Definition: localindex.hh:35
    \n+
    LocalIndex()
    Constructor. known to other processes.
    Definition: localindex.hh:41
    \n+
    LocalIndex(std::size_t index)
    Constructor.
    Definition: localindex.hh:49
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,47 +4,123 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-filledarray.hh\n+ * parallel\n+localindex.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n 5\n- 6#ifndef DUNE_COMMON_FILLED_ARRAY_HH\n- 7#define DUNE_COMMON_FILLED_ARRAY_HH\n+ 6#ifndef DUNE_COMMON_LOCALINDEX_HH\n+ 7#define DUNE_COMMON_LOCALINDEX_HH\n 8\n- 13#include \n- 14#include \n- 15\n- 16namespace Dune\n- 17{\n- 24\n- 32 template\n-33 constexpr std::array filledArray(const T& t)\n- 34 {\n- 35 std::array arr{};\n- 36 // this is constexpr in c++17, `arr.fill(t)` is not\n- 37 for(auto &el : arr)\n- 38 el = t;\n- 39 return arr;\n- 40 }\n- 41\n- 44} // end namespace Dune\n- 45\n- 46#endif // DUNE_COMMON_FILLED_ARRAY_HH\n-Dune::filledArray\n-constexpr std::array< T, n > filledArray(const T &t)\n-Return an array filled with the provided value.\n-Definition: filledarray.hh:33\n+ 9#include \n+ 10\n+ 11namespace Dune\n+ 12{\n+ 13\n+ 14\n+28 enum LocalIndexState {VALID, DELETED};\n+ 29\n+ 30\n+34 class LocalIndex\n+ 35 {\n+ 36 public:\n+41 LocalIndex() :\n+ 42 localIndex_(0), state_(VALID){}\n+ 43\n+ 44\n+49 LocalIndex(std::size_t index) :\n+ 50 localIndex_(index), state_(VALID){}\n+ 55 inline const std::size_t& local() const;\n+ 56\n+ 60 inline operator std::size_t() const;\n+ 61\n+ 67 inline LocalIndex& operator=(std::size_t index);\n+ 68\n+ 73 inline LocalIndexState state() const;\n+ 74\n+ 79 inline void setState(LocalIndexState state);\n+ 80\n+ 81 private:\n+ 83 std::size_t localIndex_;\n+ 84\n+ 91 char state_;\n+ 92\n+ 93 };\n+ 94\n+ 95\n+ 96\n+97 inline const std::size_t& LocalIndex::local() const {\n+ 98 return localIndex_;\n+ 99 }\n+ 100\n+101 inline LocalIndex::operator std::size_t() const {\n+ 102 return localIndex_;\n+ 103 }\n+ 104\n+105 inline LocalIndex& LocalIndex::operator=(std::size_t index){\n+ 106 localIndex_ = index;\n+ 107 return *this;\n+ 108 }\n+ 109\n+110 inline LocalIndexState LocalIndex::state() const {\n+ 111 return static_cast(state_);\n+ 112 }\n+ 113\n+114 inline void LocalIndex::setState(LocalIndexState state){\n+ 115 state_ = static_cast(state);\n+ 116 }\n+ 117\n+ 120} // namespace Dune\n+ 121\n+ 122#endif\n+Dune::LocalIndexState\n+LocalIndexState\n+The states available for the local indices.\n+Definition: localindex.hh:28\n+Dune::LocalIndex::operator=\n+LocalIndex & operator=(std::size_t index)\n+Assign a new local index.\n+Definition: localindex.hh:105\n+Dune::LocalIndex::state\n+LocalIndexState state() const\n+Get the state.\n+Definition: localindex.hh:110\n+Dune::LocalIndex::local\n+const std::size_t & local() const\n+get the local index.\n+Definition: localindex.hh:97\n+Dune::LocalIndex::setState\n+void setState(LocalIndexState state)\n+Set the state.\n+Definition: localindex.hh:114\n+Dune::VALID\n+@ VALID\n+Definition: localindex.hh:28\n+Dune::DELETED\n+@ DELETED\n+Definition: localindex.hh:28\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n+Dune::LocalIndex\n+An index present on the local process.\n+Definition: localindex.hh:35\n+Dune::LocalIndex::LocalIndex\n+LocalIndex()\n+Constructor. known to other processes.\n+Definition: localindex.hh:41\n+Dune::LocalIndex::LocalIndex\n+LocalIndex(std::size_t index)\n+Constructor.\n+Definition: localindex.hh:49\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00089.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00089.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: visibility.hh File Reference\n+dune-common: indicessyncer.hh File Reference\n \n \n \n \n \n \n \n@@ -58,75 +58,86 @@\n \n \n \n \n \n
    \n
    \n-Macros
    \n-
    visibility.hh File Reference
    \n+Classes |\n+Namespaces |\n+Functions
    \n+ \n \n
    \n \n-

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

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

    \n-\n+
    #include "indexset.hh"
    \n+#include "remoteindices.hh"
    \n+#include <dune/common/stdstreams.hh>
    \n+#include <dune/common/sllist.hh>
    \n+#include <cassert>
    \n+#include <cmath>
    \n+#include <limits>
    \n+#include <algorithm>
    \n+#include <functional>
    \n+#include <map>
    \n+#include <tuple>
    \n+
    \n

    Go to the source code of this file.

    \n \n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n+\n+

    \n-Macros

    #define DUNE_EXPORT   implementation_defined
     Export a symbol as part of the public ABI. More...
     
    #define DUNE_PRIVATE   implementation_defined
     Mark a symbol as being for internal use within the current DSO only. More...
     

    \n+Classes

    class  Dune::IndicesSyncer< T >
     Class for recomputing missing indices of a distributed index set. More...
     
    \n+\n+\n+\n+\n+

    \n+Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n+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. More...
     
    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. More...
     
    \n

    Detailed Description

    \n-

    Definition of macros controlling symbol visibility at the ABI level.

    \n-

    Macro Definition Documentation

    \n-\n-

    ◆ DUNE_EXPORT

    \n-\n-
    \n-
    \n- \n- \n- \n- \n-
    #define DUNE_EXPORT   implementation_defined
    \n-
    \n-\n-

    Export a symbol as part of the public ABI.

    \n-

    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.

    \n-\n-
    \n-
    \n-\n-

    ◆ DUNE_PRIVATE

    \n-\n-
    \n-
    \n- \n- \n- \n- \n-
    #define DUNE_PRIVATE   implementation_defined
    \n-
    \n-\n-

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

    \n-

    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!

    \n-\n-
    \n-
    \n-
    \n+

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

    \n+
    Author
    Markus Blatt
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,38 +4,80 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Macros\n-visibility.hh File Reference\n-Definition of macros controlling symbol visibility at the ABI level. More...\n+ * parallel\n+Classes | Namespaces | Functions\n+indicessyncer.hh File Reference\n+Common \u00bb Parallel_Communication \u00bb Parallel_Computing_based_on_Indexsets\n+Class for adding missing indices of a distributed index set in a local\n+communication. More...\n+#include \"indexset.hh\"\n+#include \"remoteindices.hh\"\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Macros\n-#define\u00a0DUNE_EXPORT\u00a0\u00a0\u00a0implementation_defined\n-\u00a0 Export a symbol as part of the public ABI. More...\n-\u00a0\n-#define\u00a0DUNE_PRIVATE\u00a0\u00a0\u00a0implementation_defined\n-\u00a0 Mark a symbol as being for internal use within the current DSO only.\n- More...\n+ Classes\n+class \u00a0Dune::IndicesSyncer<_T_>\n+\u00a0 Class for recomputing missing indices of a distributed index set.\n+ More...\n+\u00a0\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n+\u00a0\n+ Functions\n+template\n+bool\u00a0Dune::operator< (const IndexPair< TG, ParallelLocalIndex< TA > > &i1,\n+ const std::pair< TG, TA > &i2)\n+\u00a0\n+template\n+bool\u00a0Dune::operator< (const std::pair< TG, TA > &i1, const IndexPair< TG,\n+ ParallelLocalIndex< TA > > &i2)\n+\u00a0\n+template\n+bool\u00a0Dune::operator== (const IndexPair< TG, ParallelLocalIndex< TA > > &i1,\n+ const std::pair< TG, TA > &i2)\n+\u00a0\n+template\n+bool\u00a0Dune::operator!= (const IndexPair< TG, ParallelLocalIndex< TA > > &i1,\n+ const std::pair< TG, TA > &i2)\n+\u00a0\n+template\n+bool\u00a0Dune::operator== (const std::pair< TG, TA > &i2, const IndexPair< TG,\n+ ParallelLocalIndex< TA > > &i1)\n+\u00a0\n+template\n+bool\u00a0Dune::operator!= (const std::pair< TG, TA > &i2, const IndexPair< TG,\n+ ParallelLocalIndex< TA > > &i1)\n+\u00a0\n+template\n+void\u00a0Dune::storeGlobalIndicesOfRemoteIndices (std::map< int, SLList< std::\n+ pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > >\n+ &globalMap, const RemoteIndices< T, A1 > &remoteIndices)\n+\u00a0 Stores the corresponding global indices of the remote index information.\n+ More...\n+\u00a0\n+template\n+void\u00a0Dune::repairLocalIndexPointers (std::map< int, SLList< std::pair<\n+ typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > >\n+ &globalMap, RemoteIndices< T, A1 > &remoteIndices, const T &indexSet)\n+\u00a0 Repair the pointers to the local indices in the remote indices. More...\n \u00a0\n ***** Detailed Description *****\n-Definition of macros controlling symbol visibility at the ABI level.\n-***** Macro Definition Documentation *****\n-***** \u25c6\u00a0DUNE_EXPORT *****\n-#define DUNE_EXPORT\u00a0\u00a0\u00a0implementation_defined\n-Export a symbol as part of the public ABI.\n-Mark a class, function or static variable as visible outside the current DSO.\n-For now, this is mostly important for templated global variables and functions\n-that contain static variables.\n-***** \u25c6\u00a0DUNE_PRIVATE *****\n-#define DUNE_PRIVATE\u00a0\u00a0\u00a0implementation_defined\n-Mark a symbol as being for internal use within the current DSO only.\n-Mark a class, function or static variable as inaccessible from outside the\n-current DSO. Doing so will decrease the size of the symbol table, but you have\n-to be sure that the symbol will never have to be accessed from another library\n-or the main executable!\n+Class for adding missing indices of a distributed index set in a local\n+communication.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00089_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: visibility.hh Source File\n+dune-common: indicessyncer.hh Source File\n \n \n \n \n \n \n \n@@ -58,52 +58,996 @@\n \n \n \n \n \n
    \n-
    visibility.hh
    \n+
    indicessyncer.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_VISIBILITY_HH
    \n-
    6#define DUNE_COMMON_VISIBILITY_HH
    \n+
    5#ifndef DUNE_INDICESSYNCER_HH
    \n+
    6#define DUNE_INDICESSYNCER_HH
    \n
    7
    \n-
    12#ifdef DOXYGEN
    \n-
    13
    \n-
    15
    \n-
    20#define DUNE_EXPORT implementation_defined
    \n-
    21
    \n-
    23
    \n-
    28#define DUNE_PRIVATE implementation_defined
    \n-
    29
    \n-
    30#else // DOXYGEN
    \n-
    31
    \n-
    32#if __GNUC__ >= 4
    \n-
    33// GCC and Clang both define __GNUC__ to 4 and they both support the visibility
    \n-
    34// attribute
    \n-
    35#define DUNE_EXPORT __attribute__((visibility("default")))
    \n-
    36#define DUNE_PRIVATE __attribute__((visibility("hidden")))
    \n-
    37#else
    \n-
    38// We don't know about the active compiler, so just turn the visibility macros to no-ops.
    \n-
    39#define DUNE_EXPORT
    \n-
    40#define DUNE_PRIVATE
    \n-
    41#endif
    \n-
    42
    \n-
    43#endif // DOXYGEN
    \n-
    44
    \n-
    45#endif // DUNE_COMMON_VISIBILITY
    \n+
    8#include "indexset.hh"
    \n+
    9#include "remoteindices.hh"
    \n+\n+
    11#include <dune/common/sllist.hh>
    \n+
    12#include <cassert>
    \n+
    13#include <cmath>
    \n+
    14#include <limits>
    \n+
    15#include <algorithm>
    \n+
    16#include <functional>
    \n+
    17#include <map>
    \n+
    18#include <tuple>
    \n+
    19
    \n+
    20#if HAVE_MPI
    \n+
    21namespace Dune
    \n+
    22{
    \n+
    39 template<typename T>
    \n+\n+
    41 {
    \n+
    42 public:
    \n+
    43
    \n+\n+
    46
    \n+\n+
    49
    \n+\n+
    52
    \n+
    54 typedef typename ParallelIndexSet::LocalIndex::Attribute Attribute;
    \n+
    55
    \n+\n+
    60
    \n+\n+
    71 RemoteIndices& remoteIndices);
    \n+
    72
    \n+
    82 void sync();
    \n+
    83
    \n+
    94 template<typename T1>
    \n+
    95 void sync(T1& numberer);
    \n+
    96
    \n+
    97 private:
    \n+
    98
    \n+
    100 ParallelIndexSet& indexSet_;
    \n+
    101
    \n+
    103 RemoteIndices& remoteIndices_;
    \n+
    104
    \n+
    106 char** sendBuffers_;
    \n+
    107
    \n+
    109 char* receiveBuffer_;
    \n+
    110
    \n+
    112 std::size_t* sendBufferSizes_;
    \n+
    113
    \n+
    115 int receiveBufferSize_; // int because of MPI
    \n+
    116
    \n+
    120 struct MessageInformation
    \n+
    121 {
    \n+\n+
    123 : publish(), pairs()
    \n+
    124 {}
    \n+\n+
    131 int pairs;
    \n+
    132 };
    \n+
    133
    \n+
    137 class DefaultNumberer
    \n+
    138 {
    \n+
    139 public:
    \n+
    145 std::size_t operator()([[maybe_unused]] const GlobalIndex& global)
    \n+
    146 {
    \n+\n+
    148 }
    \n+
    149 };
    \n+
    150
    \n+
    152 MPI_Datatype datatype_;
    \n+
    153
    \n+
    155 int rank_;
    \n+
    156
    \n+
    161 typedef SLList<std::pair<GlobalIndex,Attribute>, typename RemoteIndices::Allocator> GlobalIndexList;
    \n+
    162
    \n+
    164 typedef typename GlobalIndexList::ModifyIterator GlobalIndexModifier;
    \n+
    165
    \n+\n+
    170 GlobalIndexIterator;
    \n+
    171
    \n+
    173 typedef std::map<int, GlobalIndexList> GlobalIndicesMap;
    \n+
    174
    \n+
    183 GlobalIndicesMap globalMap_;
    \n+
    184
    \n+\n+
    189
    \n+
    193 typedef typename BoolList::iterator BoolIterator;
    \n+
    194
    \n+
    196 typedef typename BoolList::ModifyIterator BoolListModifier;
    \n+
    197
    \n+
    199 typedef std::map<int,BoolList> BoolMap;
    \n+
    200
    \n+
    205 BoolMap oldMap_;
    \n+
    206
    \n+
    208 std::map<int,MessageInformation> infoSend_;
    \n+
    209
    \n+
    211 typedef typename RemoteIndices::RemoteIndexList RemoteIndexList;
    \n+
    212
    \n+
    214 typedef typename RemoteIndexList::ModifyIterator RemoteIndexModifier;
    \n+
    215
    \n+\n+
    218
    \n+
    220 typedef typename RemoteIndexList::iterator RemoteIndexIterator;
    \n+
    221
    \n+
    223 typedef typename RemoteIndexList::const_iterator ConstRemoteIndexIterator;
    \n+
    224
    \n+
    226 typedef std::tuple<RemoteIndexModifier,GlobalIndexModifier,BoolListModifier,
    \n+
    227 const ConstRemoteIndexIterator> IteratorTuple;
    \n+
    228
    \n+
    236 class Iterators
    \n+
    237 {
    \n+
    238 friend class IndicesSyncer<T>;
    \n+
    239 public:
    \n+
    249 Iterators(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,
    \n+
    250 BoolList& booleans);
    \n+
    251
    \n+
    255 Iterators();
    \n+
    256
    \n+
    260 Iterators& operator++();
    \n+
    261
    \n+
    267 void insert(const RemoteIndex& index,
    \n+
    268 const std::pair<GlobalIndex,Attribute>& global);
    \n+
    269
    \n+
    274 RemoteIndex& remoteIndex() const;
    \n+
    275
    \n+
    280 std::pair<GlobalIndex,Attribute>& globalIndexPair() const;
    \n+
    281
    \n+\n+
    283
    \n+
    289 bool isOld() const;
    \n+
    290
    \n+
    300 void reset(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,
    \n+
    301 BoolList& booleans);
    \n+
    302
    \n+
    308 bool isNotAtEnd() const;
    \n+
    309
    \n+
    315 bool isAtEnd() const;
    \n+
    316
    \n+
    317 private:
    \n+
    327 IteratorTuple iterators_;
    \n+
    328 };
    \n+
    329
    \n+
    331 typedef std::map<int,Iterators> IteratorsMap;
    \n+
    332
    \n+
    344 IteratorsMap iteratorsMap_;
    \n+
    345
    \n+
    347 void calculateMessageSizes();
    \n+
    348
    \n+
    356 void packAndSend(int destination, char* buffer, std::size_t bufferSize, MPI_Request& req);
    \n+
    357
    \n+
    362 template<typename T1>
    \n+
    363 void recvAndUnpack(T1& numberer);
    \n+
    364
    \n+
    368 void registerMessageDatatype();
    \n+
    369
    \n+
    373 void insertIntoRemoteIndexList(int process,
    \n+
    374 const std::pair<GlobalIndex,Attribute>& global,
    \n+
    375 char attribute);
    \n+
    376
    \n+
    380 void resetIteratorsMap();
    \n+
    381
    \n+
    386 bool checkReset();
    \n+
    387
    \n+
    396 bool checkReset(const Iterators& iterators, RemoteIndexList& rlist, GlobalIndexList& gList,
    \n+
    397 BoolList& bList);
    \n+
    398 };
    \n+
    399
    \n+
    400 template<typename TG, typename TA>
    \n+\n+
    402 const std::pair<TG,TA>& i2)
    \n+
    403 {
    \n+
    404 return i1.global() < i2.first ||
    \n+
    405 (i1.global() == i2.first && i1.local().attribute()<i2.second);
    \n+
    406 }
    \n+
    407
    \n+
    408 template<typename TG, typename TA>
    \n+
    409 bool operator<(const std::pair<TG,TA>& i1,
    \n+
    410 const IndexPair<TG,ParallelLocalIndex<TA> >& i2)
    \n+
    411 {
    \n+
    412 return i1.first < i2.global() ||
    \n+
    413 (i1.first == i2.global() && i1.second<i2.local().attribute());
    \n+
    414 }
    \n+
    415
    \n+
    416 template<typename TG, typename TA>
    \n+\n+
    418 const std::pair<TG,TA>& i2)
    \n+
    419 {
    \n+
    420 return (i1.global() == i2.first && i1.local().attribute()==i2.second);
    \n+
    421 }
    \n+
    422
    \n+
    423 template<typename TG, typename TA>
    \n+\n+
    425 const std::pair<TG,TA>& i2)
    \n+
    426 {
    \n+
    427 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);
    \n+
    428 }
    \n+
    429
    \n+
    430 template<typename TG, typename TA>
    \n+
    431 bool operator==(const std::pair<TG,TA>& i2,
    \n+
    432 const IndexPair<TG,ParallelLocalIndex<TA> >& i1)
    \n+
    433 {
    \n+
    434 return (i1.global() == i2.first && i1.local().attribute()==i2.second);
    \n+
    435 }
    \n+
    436
    \n+
    437 template<typename TG, typename TA>
    \n+
    438 bool operator!=(const std::pair<TG,TA>& i2,
    \n+
    439 const IndexPair<TG,ParallelLocalIndex<TA> >& i1)
    \n+
    440 {
    \n+
    441 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);
    \n+
    442 }
    \n+
    443
    \n+
    460 template<typename T, typename A, typename A1>
    \n+
    461 void storeGlobalIndicesOfRemoteIndices(std::map<int,SLList<std::pair<typename T::GlobalIndex, typename T::LocalIndex::Attribute>,A> >& globalMap,
    \n+
    462 const RemoteIndices<T,A1>& remoteIndices)
    \n+
    463 {
    \n+
    464 for(auto remote = remoteIndices.begin(), end =remoteIndices.end(); remote != end; ++remote) {
    \n+
    465 typedef typename RemoteIndices<T,A1>::RemoteIndexList RemoteIndexList;
    \n+\n+
    467 GlobalIndexList& global = globalMap[remote->first];
    \n+
    468 RemoteIndexList& rList = *(remote->second.first);
    \n+
    469
    \n+
    470 for(auto index = rList.begin(), riEnd = rList.end();
    \n+
    471 index != riEnd; ++index) {
    \n+
    472 global.push_back(std::make_pair(index->localIndexPair().global(),
    \n+
    473 index->localIndexPair().local().attribute()));
    \n+
    474 }
    \n+
    475 }
    \n+
    476 }
    \n+
    477
    \n+
    486 template<typename T, typename A, typename A1>
    \n+
    487 inline void repairLocalIndexPointers(std::map<int,
    \n+
    488 SLList<std::pair<typename T::GlobalIndex,
    \n+
    489 typename T::LocalIndex::Attribute>,A> >& globalMap,
    \n+
    490 RemoteIndices<T,A1>& remoteIndices,
    \n+
    491 const T& indexSet)
    \n+
    492 {
    \n+
    493 assert(globalMap.size()==static_cast<std::size_t>(remoteIndices.neighbours()));
    \n+
    494 // Repair pointers to index set in remote indices.
    \n+
    495 auto global = globalMap.begin();
    \n+
    496 auto end = remoteIndices.remoteIndices_.end();
    \n+
    497
    \n+
    498 for(auto remote = remoteIndices.remoteIndices_.begin(); remote != end; ++remote, ++global) {
    \n+
    499 assert(remote->first==global->first);
    \n+
    500 assert(remote->second.first->size() == global->second.size());
    \n+
    501
    \n+
    502 auto riEnd = remote->second.first->end();
    \n+
    503 auto rIndex = remote->second.first->begin();
    \n+
    504 auto gIndex = global->second.begin();
    \n+
    505 auto index = indexSet.begin();
    \n+
    506
    \n+
    507 assert(rIndex==riEnd || gIndex != global->second.end());
    \n+
    508 while(rIndex != riEnd) {
    \n+
    509 // Search for the index in the set.
    \n+
    510 assert(gIndex != global->second.end());
    \n+
    511
    \n+
    512 while(!(index->global() == gIndex->first
    \n+
    513 && index->local().attribute() == gIndex->second)) {
    \n+
    514 ++index;
    \n+
    515 // this is only needed for ALU, where there may exist
    \n+
    516 // more entries with the same global index in the remote index set
    \n+
    517 // than in the index set
    \n+
    518 if (index->global() > gIndex->first) {
    \n+
    519 index=indexSet.begin();
    \n+
    520 }
    \n+
    521 }
    \n+
    522
    \n+
    523 assert(index != indexSet.end() && *index == *gIndex);
    \n+
    524
    \n+
    525 rIndex->localIndex_ = &(*index);
    \n+
    526 ++index;
    \n+
    527 ++rIndex;
    \n+
    528 ++gIndex;
    \n+
    529 }
    \n+
    530 }
    \n+
    531 remoteIndices.sourceSeqNo_ = remoteIndices.source_->seqNo();
    \n+
    532 remoteIndices.destSeqNo_ = remoteIndices.target_->seqNo();
    \n+
    533 }
    \n+
    534
    \n+
    535 template<typename T>
    \n+\n+
    537 RemoteIndices& remoteIndices)
    \n+
    538 : indexSet_(indexSet), remoteIndices_(remoteIndices)
    \n+
    539 {
    \n+
    540 // index sets must match.
    \n+
    541 assert(remoteIndices.source_ == remoteIndices.target_);
    \n+
    542 assert(remoteIndices.source_ == &indexSet);
    \n+
    543 MPI_Comm_rank(remoteIndices_.communicator(), &rank_);
    \n+
    544 }
    \n+
    545
    \n+
    546 template<typename T>
    \n+\n+
    548 GlobalIndexList& globalIndices,
    \n+
    549 BoolList& booleans)
    \n+
    550 : iterators_(remoteIndices.beginModify(), globalIndices.beginModify(),
    \n+
    551 booleans.beginModify(), remoteIndices.end())
    \n+
    552 { }
    \n+
    553
    \n+
    554 template<typename T>
    \n+\n+
    556 : iterators_()
    \n+
    557 {}
    \n+
    558
    \n+
    559 template<typename T>
    \n+\n+
    561 {
    \n+
    562 ++(std::get<0>(iterators_));
    \n+
    563 ++(std::get<1>(iterators_));
    \n+
    564 ++(std::get<2>(iterators_));
    \n+
    565 return *this;
    \n+
    566 }
    \n+
    567
    \n+
    568 template<typename T>
    \n+\n+
    570 const std::pair<GlobalIndex,Attribute>& global)
    \n+
    571 {
    \n+
    572 std::get<0>(iterators_).insert(index);
    \n+
    573 std::get<1>(iterators_).insert(global);
    \n+
    574 std::get<2>(iterators_).insert(false);
    \n+
    575 }
    \n+
    576
    \n+
    577 template<typename T>
    \n+
    578 inline typename IndicesSyncer<T>::RemoteIndex&
    \n+\n+
    580 {
    \n+
    581 return *(std::get<0>(iterators_));
    \n+
    582 }
    \n+
    583
    \n+
    584 template<typename T>
    \n+
    585 inline std::pair<typename IndicesSyncer<T>::GlobalIndex,typename IndicesSyncer<T>::Attribute>&
    \n+\n+
    587 {
    \n+
    588 return *(std::get<1>(iterators_));
    \n+
    589 }
    \n+
    590
    \n+
    591 template<typename T>
    \n+\n+
    593 {
    \n+
    594 return *(std::get<2>(iterators_));
    \n+
    595 }
    \n+
    596
    \n+
    597 template<typename T>
    \n+\n+
    599 GlobalIndexList& globalIndices,
    \n+
    600 BoolList& booleans)
    \n+
    601 {
    \n+
    602 std::get<0>(iterators_) = remoteIndices.beginModify();
    \n+
    603 std::get<1>(iterators_) = globalIndices.beginModify();
    \n+
    604 std::get<2>(iterators_) = booleans.beginModify();
    \n+
    605 }
    \n+
    606
    \n+
    607 template<typename T>
    \n+\n+
    609 {
    \n+
    610 return std::get<0>(iterators_) != std::get<3>(iterators_);
    \n+
    611 }
    \n+
    612
    \n+
    613 template<typename T>
    \n+\n+
    615 {
    \n+
    616 return std::get<0>(iterators_) == std::get<3>(iterators_);
    \n+
    617 }
    \n+
    618
    \n+
    619 template<typename T>
    \n+\n+
    621 {
    \n+
    622 MPI_Datatype type[2] = {MPI_INT, MPI_INT};
    \n+
    623 int blocklength[2] = {1,1};
    \n+
    624 MPI_Aint displacement[2];
    \n+
    625 MPI_Aint base;
    \n+
    626
    \n+
    627 // Compute displacement
    \n+
    628 MessageInformation message;
    \n+
    629
    \n+
    630 MPI_Get_address( &(message.publish), displacement);
    \n+
    631 MPI_Get_address( &(message.pairs), displacement+1);
    \n+
    632
    \n+
    633 // Make the displacement relative
    \n+
    634 MPI_Get_address(&message, &base);
    \n+
    635 displacement[0] -= base;
    \n+
    636 displacement[1] -= base;
    \n+
    637
    \n+
    638 MPI_Type_create_struct( 2, blocklength, displacement, type, &datatype_);
    \n+
    639 MPI_Type_commit(&datatype_);
    \n+
    640 }
    \n+
    641
    \n+
    642 template<typename T>
    \n+
    643 void IndicesSyncer<T>::calculateMessageSizes()
    \n+
    644 {
    \n+
    645 auto iEnd = indexSet_.end();
    \n+
    646 auto collIter = remoteIndices_.template iterator<true>();
    \n+
    647
    \n+
    648 for(auto index = indexSet_.begin(); index != iEnd; ++index) {
    \n+
    649 collIter.advance(index->global(), index->local().attribute());
    \n+
    650 if(collIter.empty())
    \n+
    651 break;
    \n+
    652 int knownRemote=0;
    \n+
    653 auto end = collIter.end();
    \n+
    654
    \n+
    655 // Count the remote indices we know.
    \n+
    656 for(auto valid = collIter.begin(); valid != end; ++valid) {
    \n+
    657 ++knownRemote;
    \n+
    658 }
    \n+
    659
    \n+
    660 if(knownRemote>0) {
    \n+
    661 Dune::dverb<<rank_<<": publishing "<<knownRemote<<" for index "<<index->global()<< " for processes ";
    \n+
    662
    \n+
    663 // Update MessageInformation
    \n+
    664 for(auto valid = collIter.begin(); valid != end; ++valid) {
    \n+
    665 ++(infoSend_[valid.process()].publish);
    \n+
    666 (infoSend_[valid.process()].pairs) += knownRemote;
    \n+
    667 Dune::dverb<<valid.process()<<" ";
    \n+
    668 Dune::dverb<<"(publish="<<infoSend_[valid.process()].publish<<", pairs="<<infoSend_[valid.process()].pairs
    \n+
    669 <<") ";
    \n+
    670 }
    \n+
    671 Dune::dverb<<std::endl;
    \n+
    672 }
    \n+
    673 }
    \n+
    674
    \n+
    675 const auto end = infoSend_.end();
    \n+
    676
    \n+
    677 // Now determine the buffersizes needed for each neighbour using MPI_Pack_size
    \n+
    678 MessageInformation dummy;
    \n+
    679
    \n+
    680 auto messageIter= infoSend_.begin();
    \n+
    681 const auto rend = remoteIndices_.end();
    \n+
    682 int neighbour=0;
    \n+
    683
    \n+
    684 for(auto remote = remoteIndices_.begin(); remote != rend; ++remote, ++neighbour) {
    \n+
    685 MessageInformation* message;
    \n+
    686 MessageInformation recv;
    \n+
    687
    \n+
    688 if(messageIter != end && messageIter->first==remote->first) {
    \n+
    689 // We want to send message information to that process
    \n+
    690 message = const_cast<MessageInformation*>(&(messageIter->second));
    \n+
    691 ++messageIter;
    \n+
    692 }else
    \n+
    693 // We do not want to send information but the other process might.
    \n+
    694 message = &dummy;
    \n+
    695
    \n+
    696 sendBufferSizes_[neighbour]=0;
    \n+
    697 int tsize;
    \n+
    698 // The number of indices published
    \n+
    699 MPI_Pack_size(1, MPI_INT,remoteIndices_.communicator(), &tsize);
    \n+
    700 sendBufferSizes_[neighbour] += tsize;
    \n+
    701
    \n+
    702 for(int i=0; i < message->publish; ++i) {
    \n+
    703 // The global index
    \n+
    704 MPI_Pack_size(1, MPITraits<GlobalIndex>::getType(), remoteIndices_.communicator(), &tsize);
    \n+
    705 sendBufferSizes_[neighbour] += tsize;
    \n+
    706 // The attribute in the local index
    \n+
    707 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);
    \n+
    708 sendBufferSizes_[neighbour] += tsize;
    \n+
    709 // The number of corresponding remote indices
    \n+
    710 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);
    \n+
    711 sendBufferSizes_[neighbour] += tsize;
    \n+
    712 }
    \n+
    713 for(int i=0; i < message->pairs; ++i) {
    \n+
    714 // The process of the remote index
    \n+
    715 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);
    \n+
    716 sendBufferSizes_[neighbour] += tsize;
    \n+
    717 // The attribute of the remote index
    \n+
    718 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);
    \n+
    719 sendBufferSizes_[neighbour] += tsize;
    \n+
    720 }
    \n+
    721
    \n+
    722 Dune::dverb<<rank_<<": Buffer (neighbour="<<remote->first<<") size is "<< sendBufferSizes_[neighbour]<<" for publish="<<message->publish<<" pairs="<<message->pairs<<std::endl;
    \n+
    723 }
    \n+
    724
    \n+
    725 }
    \n+
    726
    \n+
    727 template<typename T>
    \n+\n+
    729 {
    \n+
    730 DefaultNumberer numberer;
    \n+
    731 sync(numberer);
    \n+
    732 }
    \n+
    733
    \n+
    734 template<typename T>
    \n+
    735 template<typename T1>
    \n+
    736 void IndicesSyncer<T>::sync(T1& numberer)
    \n+
    737 {
    \n+
    738 // The pointers to the local indices in the remote indices
    \n+
    739 // will become invalid due to the resorting of the index set.
    \n+
    740 // Therefore store the corresponding global indices.
    \n+
    741 // Mark all indices as not added
    \n+
    742 const auto end = remoteIndices_.end();
    \n+
    743
    \n+
    744 // Number of neighbours might change during the syncing.
    \n+
    745 // save the old neighbours
    \n+
    746 std::size_t noOldNeighbours = remoteIndices_.neighbours();
    \n+
    747 int* oldNeighbours = new int[noOldNeighbours];
    \n+
    748 sendBufferSizes_ = new std::size_t[noOldNeighbours];
    \n+
    749 std::size_t neighbourI = 0;
    \n+
    750
    \n+
    751 for(auto remote = remoteIndices_.begin(); remote != end; ++remote, ++neighbourI) {
    \n+
    752 oldNeighbours[neighbourI] = remote->first;
    \n+
    753
    \n+
    754 // Make sure we only have one remote index list.
    \n+
    755 assert(remote->second.first==remote->second.second);
    \n+
    756
    \n+
    757 RemoteIndexList& rList = *(remote->second.first);
    \n+
    758
    \n+
    759 // Store the corresponding global indices.
    \n+
    760 GlobalIndexList& global = globalMap_[remote->first];
    \n+
    761 BoolList& added = oldMap_[remote->first];
    \n+
    762 auto riEnd = rList.end();
    \n+
    763
    \n+
    764 for(auto index = rList.begin();
    \n+
    765 index != riEnd; ++index) {
    \n+
    766 global.push_back(std::make_pair(index->localIndexPair().global(),
    \n+
    767 index->localIndexPair().local().attribute()));
    \n+
    768 added.push_back(true);
    \n+
    769 }
    \n+
    770
    \n+
    771 Iterators iterators(rList, global, added);
    \n+
    772 iteratorsMap_.insert(std::make_pair(remote->first, iterators));
    \n+
    773 assert(checkReset(iteratorsMap_[remote->first], rList,global,added));
    \n+
    774 }
    \n+
    775
    \n+
    776 // Exchange indices with each neighbour
    \n+
    777 calculateMessageSizes();
    \n+
    778
    \n+
    779 // Allocate the buffers
    \n+
    780 receiveBufferSize_=1;
    \n+
    781 sendBuffers_ = new char*[noOldNeighbours];
    \n+
    782
    \n+
    783 for(std::size_t i=0; i<noOldNeighbours; ++i) {
    \n+
    784 sendBuffers_[i] = new char[sendBufferSizes_[i]];
    \n+
    785 receiveBufferSize_ = std::max(receiveBufferSize_, static_cast<int>(sendBufferSizes_[i]));
    \n+
    786 }
    \n+
    787
    \n+
    788 receiveBuffer_=new char[receiveBufferSize_];
    \n+
    789
    \n+
    790 indexSet_.beginResize();
    \n+
    791
    \n+
    792 Dune::dverb<<rank_<<": Neighbours: ";
    \n+
    793
    \n+
    794 for(std::size_t i = 0; i<noOldNeighbours; ++i)
    \n+
    795 Dune::dverb<<oldNeighbours[i]<<" ";
    \n+
    796
    \n+
    797 Dune::dverb<<std::endl;
    \n+
    798
    \n+
    799 MPI_Request* requests = new MPI_Request[noOldNeighbours];
    \n+
    800 MPI_Status* statuses = new MPI_Status[noOldNeighbours];
    \n+
    801
    \n+
    802 // Pack Message data and start the sends
    \n+
    803 for(std::size_t i = 0; i<noOldNeighbours; ++i)
    \n+
    804 packAndSend(oldNeighbours[i], sendBuffers_[i], sendBufferSizes_[i], requests[i]);
    \n+
    805
    \n+
    806 // Probe for incoming messages, receive and unpack them
    \n+
    807 for(std::size_t i = 0; i<noOldNeighbours; ++i)
    \n+
    808 recvAndUnpack(numberer);
    \n+
    809 // }else{
    \n+
    810 // recvAndUnpack(oldNeighbours[i], numberer);
    \n+
    811 // packAndSend(oldNeighbours[i]);
    \n+
    812 // }
    \n+
    813 // }
    \n+
    814
    \n+
    815 delete[] receiveBuffer_;
    \n+
    816
    \n+
    817 // Wait for the completion of the sends
    \n+
    818 // Wait for completion of sends
    \n+
    819 if(MPI_SUCCESS!=MPI_Waitall(noOldNeighbours, requests, statuses)) {
    \n+
    820 std::cerr<<": MPI_Error occurred while sending message"<<std::endl;
    \n+
    821 for(std::size_t i=0; i< noOldNeighbours; i++)
    \n+
    822 if(MPI_SUCCESS!=statuses[i].MPI_ERROR)
    \n+
    823 std::cerr<<"Destination "<<statuses[i].MPI_SOURCE<<" error code: "<<statuses[i].MPI_ERROR<<std::endl;
    \n+
    824 }
    \n+
    825
    \n+
    826 delete[] statuses;
    \n+
    827 delete[] requests;
    \n+
    828
    \n+
    829 for(std::size_t i=0; i<noOldNeighbours; ++i)
    \n+
    830 delete[] sendBuffers_[i];
    \n+
    831
    \n+
    832 delete[] sendBuffers_;
    \n+
    833 delete[] sendBufferSizes_;
    \n+
    834
    \n+
    835 // No need for the iterator tuples any more
    \n+
    836 iteratorsMap_.clear();
    \n+
    837
    \n+
    838 indexSet_.endResize();
    \n+
    839
    \n+
    840 delete[] oldNeighbours;
    \n+
    841
    \n+
    842 repairLocalIndexPointers(globalMap_, remoteIndices_, indexSet_);
    \n+
    843
    \n+
    844 oldMap_.clear();
    \n+
    845 globalMap_.clear();
    \n+
    846
    \n+
    847 // update the sequence number
    \n+
    848 remoteIndices_.sourceSeqNo_ = remoteIndices_.destSeqNo_ = indexSet_.seqNo();
    \n+
    849 }
    \n+
    850
    \n+
    851 template<typename T>
    \n+
    852 void IndicesSyncer<T>::packAndSend(int destination, char* buffer, std::size_t bufferSize, MPI_Request& request)
    \n+
    853 {
    \n+
    854 auto iEnd = indexSet_.end();
    \n+
    855 int bpos = 0;
    \n+
    856 int published = 0;
    \n+
    857 int pairs = 0;
    \n+
    858
    \n+
    859 assert(checkReset());
    \n+
    860
    \n+
    861 // Pack the number of indices we publish
    \n+
    862 MPI_Pack(&(infoSend_[destination].publish), 1, MPI_INT, buffer, bufferSize, &bpos,
    \n+
    863 remoteIndices_.communicator());
    \n+
    864
    \n+
    865 for(auto index = indexSet_.begin(); index != iEnd; ++index) {
    \n+
    866 // Search for corresponding remote indices in all iterator tuples
    \n+
    867 auto iteratorsEnd = iteratorsMap_.end();
    \n+
    868
    \n+
    869 // advance all iterators to a position with global index >= index->global()
    \n+
    870 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators) {
    \n+
    871 while(iterators->second.isNotAtEnd() &&
    \n+
    872 iterators->second.globalIndexPair().first < index->global())
    \n+
    873 ++(iterators->second);
    \n+
    874 assert(!iterators->second.isNotAtEnd() || iterators->second.globalIndexPair().first >= index->global());
    \n+
    875 }
    \n+
    876
    \n+
    877 // Add all remote indices positioned at global which were already present before calling sync
    \n+
    878 // to the message.
    \n+
    879 // Count how many remote indices we will send
    \n+
    880 int indices = 0;
    \n+
    881 bool knownRemote = false; // Is the remote process supposed to know this index?
    \n+
    882
    \n+
    883 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators)
    \n+
    884 {
    \n+
    885 std::pair<GlobalIndex,Attribute> p;
    \n+
    886 if (iterators->second.isNotAtEnd())
    \n+
    887 {
    \n+
    888 p = iterators->second.globalIndexPair();
    \n+
    889 }
    \n+
    890
    \n+
    891 if(iterators->second.isNotAtEnd() && iterators->second.isOld()
    \n+
    892 && iterators->second.globalIndexPair().first == index->global()) {
    \n+
    893 indices++;
    \n+
    894 if(destination == iterators->first)
    \n+
    895 knownRemote = true;
    \n+
    896 }
    \n+
    897 }
    \n+
    898
    \n+
    899 if(!knownRemote)
    \n+
    900 // We do not need to send any indices
    \n+
    901 continue;
    \n+
    902
    \n+
    903 Dune::dverb<<rank_<<": sending "<<indices<<" for index "<<index->global()<<" to "<<destination<<std::endl;
    \n+
    904
    \n+
    905
    \n+
    906 // Pack the global index, the attribute and the number
    \n+
    907 MPI_Pack(const_cast<GlobalIndex*>(&(index->global())), 1, MPITraits<GlobalIndex>::getType(), buffer, bufferSize, &bpos,
    \n+
    908 remoteIndices_.communicator());
    \n+
    909
    \n+
    910 char attr = index->local().attribute();
    \n+
    911 MPI_Pack(&attr, 1, MPI_CHAR, buffer, bufferSize, &bpos,
    \n+
    912 remoteIndices_.communicator());
    \n+
    913
    \n+
    914 // Pack the number of remote indices we send.
    \n+
    915 MPI_Pack(&indices, 1, MPI_INT, buffer, bufferSize, &bpos,
    \n+
    916 remoteIndices_.communicator());
    \n+
    917
    \n+
    918 // Pack the information about the remote indices
    \n+
    919 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators; ++iterators)
    \n+
    920 if(iterators->second.isNotAtEnd() && iterators->second.isOld()
    \n+
    921 && iterators->second.globalIndexPair().first == index->global()) {
    \n+
    922 int process = iterators->first;
    \n+
    923
    \n+
    924 ++pairs;
    \n+
    925 assert(pairs <= infoSend_[destination].pairs);
    \n+
    926 MPI_Pack(&process, 1, MPI_INT, buffer, bufferSize, &bpos,
    \n+
    927 remoteIndices_.communicator());
    \n+
    928 char attr2 = iterators->second.remoteIndex().attribute();
    \n+
    929
    \n+
    930 MPI_Pack(&attr2, 1, MPI_CHAR, buffer, bufferSize, &bpos,
    \n+
    931 remoteIndices_.communicator());
    \n+
    932 --indices;
    \n+
    933 }
    \n+
    934 assert(indices==0);
    \n+
    935 ++published;
    \n+
    936 Dune::dvverb<<" (publish="<<published<<", pairs="<<pairs<<")"<<std::endl;
    \n+
    937 assert(published <= infoSend_[destination].publish);
    \n+
    938 }
    \n+
    939
    \n+
    940 // Make sure we send all expected entries
    \n+
    941 assert(published == infoSend_[destination].publish);
    \n+
    942 assert(pairs == infoSend_[destination].pairs);
    \n+
    943 resetIteratorsMap();
    \n+
    944
    \n+
    945 Dune::dverb << rank_<<": Sending message of "<<bpos<<" bytes to "<<destination<<std::endl;
    \n+
    946
    \n+
    947 MPI_Issend(buffer, bpos, MPI_PACKED, destination, 345, remoteIndices_.communicator(),&request);
    \n+
    948 }
    \n+
    949
    \n+
    950 template<typename T>
    \n+
    951 inline void IndicesSyncer<T>::insertIntoRemoteIndexList(int process,
    \n+
    952 const std::pair<GlobalIndex,Attribute>& globalPair,
    \n+
    953 char attribute)
    \n+
    954 {
    \n+
    955 Dune::dverb<<"Inserting from "<<process<<" "<<globalPair.first<<", "<<
    \n+
    956 globalPair.second<<" "<<attribute<<std::endl;
    \n+
    957
    \n+
    958 resetIteratorsMap();
    \n+
    959
    \n+
    960 // There might be cases where there no remote indices for that process yet
    \n+
    961 typename IteratorsMap::iterator found = iteratorsMap_.find(process);
    \n+
    962
    \n+
    963 if( found == iteratorsMap_.end() ) {
    \n+
    964 Dune::dverb<<"Discovered new neighbour "<<process<<std::endl;
    \n+
    965 RemoteIndexList* rlist = new RemoteIndexList();
    \n+
    966 remoteIndices_.remoteIndices_.insert(std::make_pair(process,std::make_pair(rlist,rlist)));
    \n+
    967 Iterators iterators = Iterators(*rlist, globalMap_[process], oldMap_[process]);
    \n+
    968 found = iteratorsMap_.insert(std::make_pair(process, iterators)).first;
    \n+
    969 }
    \n+
    970
    \n+
    971 Iterators& iterators = found->second;
    \n+
    972
    \n+
    973 // Search for the remote index
    \n+
    974 while(iterators.isNotAtEnd() && iterators.globalIndexPair() < globalPair) {
    \n+
    975 // Increment all iterators
    \n+
    976 ++iterators;
    \n+
    977
    \n+
    978 }
    \n+
    979
    \n+
    980 if(iterators.isAtEnd() || iterators.globalIndexPair() != globalPair) {
    \n+
    981 // The entry is not yet known
    \n+
    982 // Insert in the list and do not change the first iterator.
    \n+
    983 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);
    \n+
    984 return;
    \n+
    985 }
    \n+
    986
    \n+
    987 // Global indices match
    \n+
    988 bool indexIsThere=false;
    \n+
    989 for(Iterators tmpIterators = iterators;
    \n+
    990 !tmpIterators.isAtEnd() && tmpIterators.globalIndexPair() == globalPair;
    \n+
    991 ++tmpIterators)
    \n+
    992 //entry already exists with the same attribute
    \n+
    993 if(tmpIterators.globalIndexPair().second == attribute) {
    \n+
    994 indexIsThere=true;
    \n+
    995 break;
    \n+
    996 }
    \n+
    997
    \n+
    998 if(!indexIsThere)
    \n+
    999 // The entry is not yet known
    \n+
    1000 // Insert in the list and do not change the first iterator.
    \n+
    1001 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);
    \n+
    1002 }
    \n+
    1003
    \n+
    1004 template<typename T>
    \n+
    1005 template<typename T1>
    \n+
    1006 void IndicesSyncer<T>::recvAndUnpack(T1& numberer)
    \n+
    1007 {
    \n+
    1008 const ParallelIndexSet& constIndexSet = indexSet_;
    \n+
    1009 auto iEnd = constIndexSet.end();
    \n+
    1010 auto index = constIndexSet.begin();
    \n+
    1011 int bpos = 0;
    \n+
    1012 int publish;
    \n+
    1013
    \n+
    1014 assert(checkReset());
    \n+
    1015
    \n+
    1016 MPI_Status status;
    \n+
    1017
    \n+
    1018 // We have to determine the message size and source before the receive
    \n+
    1019 MPI_Probe(MPI_ANY_SOURCE, 345, remoteIndices_.communicator(), &status);
    \n+
    1020
    \n+
    1021 int source=status.MPI_SOURCE;
    \n+
    1022 int count;
    \n+
    1023 MPI_Get_count(&status, MPI_PACKED, &count);
    \n+
    1024
    \n+
    1025 Dune::dvverb<<rank_<<": Receiving message from "<< source<<" with "<<count<<" bytes"<<std::endl;
    \n+
    1026
    \n+
    1027 if(count>receiveBufferSize_) {
    \n+
    1028 receiveBufferSize_=count;
    \n+
    1029 delete[] receiveBuffer_;
    \n+
    1030 receiveBuffer_ = new char[receiveBufferSize_];
    \n+
    1031 }
    \n+
    1032
    \n+
    1033 MPI_Recv(receiveBuffer_, count, MPI_PACKED, source, 345, remoteIndices_.communicator(), &status);
    \n+
    1034
    \n+
    1035 // How many global entries were published?
    \n+
    1036 MPI_Unpack(receiveBuffer_, count, &bpos, &publish, 1, MPI_INT, remoteIndices_.communicator());
    \n+
    1037
    \n+
    1038 // Now unpack the remote indices and add them.
    \n+
    1039 while(publish>0) {
    \n+
    1040
    \n+
    1041 // Unpack information about the local index on the source process
    \n+
    1042 GlobalIndex global; // global index of the current entry
    \n+
    1043 char sourceAttribute; // Attribute on the source process
    \n+
    1044 int pairs;
    \n+
    1045
    \n+
    1046 MPI_Unpack(receiveBuffer_, count, &bpos, &global, 1, MPITraits<GlobalIndex>::getType(),
    \n+
    1047 remoteIndices_.communicator());
    \n+
    1048 MPI_Unpack(receiveBuffer_, count, &bpos, &sourceAttribute, 1, MPI_CHAR,
    \n+
    1049 remoteIndices_.communicator());
    \n+
    1050 MPI_Unpack(receiveBuffer_, count, &bpos, &pairs, 1, MPI_INT,
    \n+
    1051 remoteIndices_.communicator());
    \n+
    1052
    \n+
    1053 // Insert the entry on the remote process to our
    \n+
    1054 // remote index list
    \n+
    1055 SLList<std::pair<int,Attribute> > sourceAttributeList;
    \n+
    1056 sourceAttributeList.push_back(std::make_pair(source,Attribute(sourceAttribute)));
    \n+
    1057#ifndef NDEBUG
    \n+
    1058 bool foundSelf = false;
    \n+
    1059#endif
    \n+
    1060 Attribute myAttribute=Attribute();
    \n+
    1061
    \n+
    1062 // Unpack the remote indices
    \n+
    1063 for(; pairs>0; --pairs) {
    \n+
    1064 // Unpack the process id that knows the index
    \n+
    1065 int process;
    \n+
    1066 char attribute;
    \n+
    1067 MPI_Unpack(receiveBuffer_, count, &bpos, &process, 1, MPI_INT,
    \n+
    1068 remoteIndices_.communicator());
    \n+
    1069 // Unpack the attribute
    \n+
    1070 MPI_Unpack(receiveBuffer_, count, &bpos, &attribute, 1, MPI_CHAR,
    \n+
    1071 remoteIndices_.communicator());
    \n+
    1072
    \n+
    1073 if(process==rank_) {
    \n+
    1074#ifndef NDEBUG
    \n+
    1075 foundSelf=true;
    \n+
    1076#endif
    \n+
    1077 myAttribute=Attribute(attribute);
    \n+
    1078 // Now we know the local attribute of the global index
    \n+
    1079 //Only add the index if it is unknown.
    \n+
    1080 // Do we know that global index already?
    \n+
    1081 auto pos = std::lower_bound(index, iEnd, IndexPair(global));
    \n+
    1082
    \n+
    1083 if(pos == iEnd || pos->global() != global) {
    \n+
    1084 // no entry with this global index
    \n+
    1085 indexSet_.add(global,
    \n+
    1086 ParallelLocalIndex<Attribute>(numberer(global),
    \n+
    1087 myAttribute, true));
    \n+
    1088 Dune::dvverb << "Adding "<<global<<" "<<myAttribute<<std::endl;
    \n+
    1089 continue;
    \n+
    1090 }
    \n+
    1091
    \n+
    1092 // because of above the global indices match. Add only if the attribute is different
    \n+
    1093 bool indexIsThere = false;
    \n+
    1094 index=pos;
    \n+
    1095
    \n+
    1096 for(; pos->global()==global; ++pos)
    \n+
    1097 if(pos->local().attribute() == myAttribute) {
    \n+
    1098 Dune::dvverb<<"found "<<global<<" "<<myAttribute<<std::endl;
    \n+
    1099 indexIsThere = true;
    \n+
    1100 break;
    \n+
    1101 }
    \n+
    1102
    \n+
    1103 if(!indexIsThere) {
    \n+
    1104 indexSet_.add(global,
    \n+
    1105 ParallelLocalIndex<Attribute>(numberer(global),
    \n+
    1106 myAttribute, true));
    \n+
    1107 Dune::dvverb << "Adding "<<global<<" "<<myAttribute<<std::endl;
    \n+
    1108 }
    \n+
    1109
    \n+
    1110 }else{
    \n+
    1111 sourceAttributeList.push_back(std::make_pair(process,Attribute(attribute)));
    \n+
    1112 }
    \n+
    1113 }
    \n+
    1114 assert(foundSelf);
    \n+
    1115 // Insert remote indices
    \n+
    1116 typedef typename SLList<std::pair<int,Attribute> >::const_iterator Iter;
    \n+
    1117 for(Iter i=sourceAttributeList.begin(), end=sourceAttributeList.end();
    \n+
    1118 i!=end; ++i)
    \n+
    1119 insertIntoRemoteIndexList(i->first, std::make_pair(global, myAttribute),
    \n+
    1120 i->second);
    \n+
    1121 --publish;
    \n+
    1122 }
    \n+
    1123
    \n+
    1124 resetIteratorsMap();
    \n+
    1125 }
    \n+
    1126
    \n+
    1127 template<typename T>
    \n+
    1128 void IndicesSyncer<T>::resetIteratorsMap(){
    \n+
    1129
    \n+
    1130 // Reset iterators in all tuples.
    \n+
    1131 const auto remoteEnd = remoteIndices_.remoteIndices_.end();
    \n+
    1132 auto iterators = iteratorsMap_.begin();
    \n+
    1133 auto global = globalMap_.begin();
    \n+
    1134 auto added = oldMap_.begin();
    \n+
    1135
    \n+
    1136 for(auto remote = remoteIndices_.remoteIndices_.begin();
    \n+
    1137 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {
    \n+
    1138 iterators->second.reset(*(remote->second.first), global->second, added->second);
    \n+
    1139 }
    \n+
    1140 }
    \n+
    1141
    \n+
    1142 template<typename T>
    \n+
    1143 bool IndicesSyncer<T>::checkReset(const Iterators& iterators, RemoteIndexList& rList, GlobalIndexList& gList,
    \n+
    1144 BoolList& bList){
    \n+
    1145
    \n+
    1146 if(std::get<0>(iterators.iterators_) != rList.begin())
    \n+
    1147 return false;
    \n+
    1148 if(std::get<1>(iterators.iterators_) != gList.begin())
    \n+
    1149 return false;
    \n+
    1150 if(std::get<2>(iterators.iterators_) != bList.begin())
    \n+
    1151 return false;
    \n+
    1152 return true;
    \n+
    1153 }
    \n+
    1154
    \n+
    1155
    \n+
    1156 template<typename T>
    \n+
    1157 bool IndicesSyncer<T>::checkReset(){
    \n+
    1158
    \n+
    1159 // Reset iterators in all tuples.
    \n+
    1160 const auto remoteEnd = remoteIndices_.remoteIndices_.end();
    \n+
    1161 auto iterators = iteratorsMap_.begin();
    \n+
    1162 auto global = globalMap_.begin();
    \n+
    1163 auto added = oldMap_.begin();
    \n+
    1164 bool ret = true;
    \n+
    1165
    \n+
    1166 for(auto remote = remoteIndices_.remoteIndices_.begin();
    \n+
    1167 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {
    \n+
    1168 if(!checkReset(iterators->second, *(remote->second.first), global->second,
    \n+
    1169 added->second))
    \n+
    1170 ret=false;
    \n+
    1171 }
    \n+
    1172 return ret;
    \n+
    1173 }
    \n+
    1174}
    \n+
    1175
    \n+
    1176#endif
    \n+
    1177#endif
    \n+
    Classes describing a distributed indexset.
    \n+
    Provides a map between global and local indices.
    \n+
    Implements a singly linked list together with the necessary iterators.
    \n+
    Standard Dune debug streams.
    \n+
    void push_back(const MemberType &item)
    Add a new entry to the end of the list.
    Definition: sllist.hh:643
    \n+
    SLListIterator< T, A > iterator
    The mutable iterator of the list.
    Definition: sllist.hh:69
    \n+
    iterator end()
    Get an iterator pointing to the end of the list.
    Definition: sllist.hh:774
    \n+
    ModifyIterator beginModify()
    Get an iterator capable of deleting and inserting elements.
    Definition: sllist.hh:787
    \n+
    SLListConstIterator< RemoteIndex, Allocator > const_iterator
    The constant iterator of the list.
    Definition: sllist.hh:74
    \n+
    SLListModifyIterator< T, A > ModifyIterator
    The type of the iterator capable of deletion and insertion.
    Definition: sllist.hh:103
    \n+
    iterator begin()
    Get an iterator pointing to the first element in the list.
    Definition: sllist.hh:762
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
    Comparison operator.
    Definition: iteratorfacades.hh:637
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for equality.
    Definition: iteratorfacades.hh:237
    \n+
    EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
    Checks for inequality.
    Definition: iteratorfacades.hh:259
    \n+
    Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
    Type of the remote indices.
    Definition: indicessyncer.hh:59
    \n+
    int publish
    The number of indices we publish for the other process.
    Definition: indicessyncer.hh:126
    \n+
    void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, RemoteIndices< T, A1 > &remoteIndices, const T &indexSet)
    Repair the pointers to the local indices in the remote indices.
    Definition: indicessyncer.hh:487
    \n+
    ParallelIndexSet::GlobalIndex GlobalIndex
    Type of the global index used in the index set.
    Definition: indicessyncer.hh:51
    \n+
    int pairs
    The number of pairs (attribute and process number) we publish to the neighbour process.
    Definition: indicessyncer.hh:131
    \n+
    Attribute & attribute() const
    \n+
    ParallelIndexSet::LocalIndex::Attribute Attribute
    Type of the attribute used in the index set.
    Definition: indicessyncer.hh:54
    \n+
    IndicesSyncer(ParallelIndexSet &indexSet, RemoteIndices &remoteIndices)
    Constructor.
    Definition: indicessyncer.hh:536
    \n+
    T ParallelIndexSet
    The type of the index set.
    Definition: indicessyncer.hh:45
    \n+
    TG GlobalIndex
    the type of the global index. This type has to provide at least a operator< for sorting.
    Definition: indexset.hh:226
    \n+
    void storeGlobalIndicesOfRemoteIndices(std::map< int, SLList< std::pair< typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap, const RemoteIndices< T, A1 > &remoteIndices)
    Stores the corresponding global indices of the remote index information.
    Definition: indicessyncer.hh:461
    \n+
    void sync()
    Sync the index set.
    Definition: indicessyncer.hh:728
    \n+
    int seqNo() const
    Get the internal sequence number.
    \n+
    ParallelIndexSet::IndexPair IndexPair
    The type of the index pair.
    Definition: indicessyncer.hh:48
    \n+
    MessageInformation()
    Definition: indicessyncer.hh:122
    \n+
    DVVerbType dvverb(std::cout)
    stream for very verbose output.
    Definition: stdstreams.hh:95
    \n+
    DVerbType dverb(std::cout)
    Singleton of verbose debug stream.
    Definition: stdstreams.hh:116
    \n+
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition: debugalign.hh:425
    \n+
    static MPI_Datatype getType()
    Definition: mpitraits.hh:48
    \n+
    A pair consisting of a global and local index.
    Definition: indexset.hh:85
    \n+
    Class for recomputing missing indices of a distributed index set.
    Definition: indicessyncer.hh:41
    \n+
    An index present on the local process with an additional attribute flag.
    Definition: plocalindex.hh:49
    \n+
    The indices present on remote processes.
    Definition: remoteindices.hh:189
    \n+
    MPI_Comm communicator() const
    Get the mpi communicator used.
    Definition: remoteindices.hh:1696
    \n+
    const_iterator end() const
    Get an iterator over all remote index lists.
    Definition: remoteindices.hh:1529
    \n+
    int neighbours() const
    Get the number of processors we share indices with.
    Definition: remoteindices.hh:1446
    \n+
    typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex > Allocator
    The type of the allocator for the remote index list.
    Definition: remoteindices.hh:237
    \n+
    const_iterator begin() const
    Get an iterator over all remote index lists.
    Definition: remoteindices.hh:1522
    \n+
    Information about an index residing on another processor.
    Definition: remoteindices.hh:73
    \n+
    A mutable iterator for the SLList.
    Definition: sllist.hh:271
    \n+
    A single linked list.
    Definition: sllist.hh:44
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,46 +4,1171 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-visibility.hh\n+ * parallel\n+indicessyncer.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_VISIBILITY_HH\n- 6#define DUNE_COMMON_VISIBILITY_HH\n+ 5#ifndef DUNE_INDICESSYNCER_HH\n+ 6#define DUNE_INDICESSYNCER_HH\n 7\n- 12#ifdef DOXYGEN\n- 13\n- 15\n-20#define DUNE_EXPORT implementation_defined\n- 21\n- 23\n-28#define DUNE_PRIVATE implementation_defined\n- 29\n- 30#else // DOXYGEN\n- 31\n- 32#if __GNUC__ >= 4\n- 33// GCC and Clang both define __GNUC__ to 4 and they both support the\n-visibility\n- 34// attribute\n- 35#define DUNE_EXPORT __attribute__((visibility(\"default\")))\n- 36#define DUNE_PRIVATE __attribute__((visibility(\"hidden\")))\n- 37#else\n- 38// We don't know about the active compiler, so just turn the visibility\n-macros to no-ops.\n- 39#define DUNE_EXPORT\n- 40#define DUNE_PRIVATE\n- 41#endif\n- 42\n- 43#endif // DOXYGEN\n- 44\n- 45#endif // DUNE_COMMON_VISIBILITY\n+ 8#include \"indexset.hh\"\n+ 9#include \"remoteindices.hh\"\n+ 10#include \n+ 11#include \n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16#include \n+ 17#include \n+ 18#include \n+ 19\n+ 20#if HAVE_MPI\n+ 21namespace Dune\n+ 22{\n+ 39 template\n+40 class IndicesSyncer\n+ 41 {\n+ 42 public:\n+ 43\n+45 typedef T ParallelIndexSet;\n+ 46\n+48 typedef typename ParallelIndexSet::IndexPair IndexPair;\n+ 49\n+51 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;\n+ 52\n+54 typedef typename ParallelIndexSet::LocalIndex::Attribute Attribute;\n+ 55\n+59 typedef Dune::RemoteIndices RemoteIndices;\n+ 60\n+ 70 IndicesSyncer(ParallelIndexSet& indexSet,\n+ 71 RemoteIndices& remoteIndices);\n+ 72\n+ 82 void sync();\n+ 83\n+ 94 template\n+ 95 void sync(T1& numberer);\n+ 96\n+ 97 private:\n+ 98\n+ 100 ParallelIndexSet& indexSet_;\n+ 101\n+ 103 RemoteIndices& remoteIndices_;\n+ 104\n+ 106 char** sendBuffers_;\n+ 107\n+ 109 char* receiveBuffer_;\n+ 110\n+ 112 std::size_t* sendBufferSizes_;\n+ 113\n+ 115 int receiveBufferSize_; // int because of MPI\n+ 116\n+ 120 struct MessageInformation\n+ 121 {\n+122 MessageInformation()\n+ 123 : publish(), pairs()\n+ 124 {}\n+126 int publish;\n+131 int pairs;\n+ 132 };\n+ 133\n+ 137 class DefaultNumberer\n+ 138 {\n+ 139 public:\n+145 std::size_t operator()([[maybe_unused]] const GlobalIndex& global)\n+ 146 {\n+ 147 return std::numeric_limits::max();\n+ 148 }\n+ 149 };\n+ 150\n+ 152 MPI_Datatype datatype_;\n+ 153\n+ 155 int rank_;\n+ 156\n+ 161 typedef SLList, typename RemoteIndices::\n+Allocator> GlobalIndexList;\n+ 162\n+ 164 typedef typename GlobalIndexList::ModifyIterator GlobalIndexModifier;\n+ 165\n+ 169 typedef typename SLList::\n+iterator\n+ 170 GlobalIndexIterator;\n+ 171\n+ 173 typedef std::map GlobalIndicesMap;\n+ 174\n+ 183 GlobalIndicesMap globalMap_;\n+ 184\n+ 188 typedef SLList BoolList;\n+ 189\n+ 193 typedef typename BoolList::iterator BoolIterator;\n+ 194\n+ 196 typedef typename BoolList::ModifyIterator BoolListModifier;\n+ 197\n+ 199 typedef std::map BoolMap;\n+ 200\n+ 205 BoolMap oldMap_;\n+ 206\n+ 208 std::map infoSend_;\n+ 209\n+ 211 typedef typename RemoteIndices::RemoteIndexList RemoteIndexList;\n+ 212\n+ 214 typedef typename RemoteIndexList::ModifyIterator RemoteIndexModifier;\n+ 215\n+ 217 typedef Dune::RemoteIndex RemoteIndex;\n+ 218\n+ 220 typedef typename RemoteIndexList::iterator RemoteIndexIterator;\n+ 221\n+ 223 typedef typename RemoteIndexList::const_iterator ConstRemoteIndexIterator;\n+ 224\n+ 226 typedef std::\n+tuple IteratorTuple;\n+ 228\n+ 236 class Iterators\n+ 237 {\n+ 238 friend class IndicesSyncer;\n+ 239 public:\n+ 249 Iterators(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,\n+ 250 BoolList& booleans);\n+ 251\n+ 255 Iterators();\n+ 256\n+ 260 Iterators& operator++();\n+ 261\n+ 267 void insert(const RemoteIndex& index,\n+ 268 const std::pair& global);\n+ 269\n+ 274 RemoteIndex& remoteIndex() const;\n+ 275\n+ 280 std::pair& globalIndexPair() const;\n+ 281\n+282 Attribute& attribute() const;\n+ 283\n+ 289 bool isOld() const;\n+ 290\n+ 300 void reset(RemoteIndexList& remoteIndices, GlobalIndexList& globalIndices,\n+ 301 BoolList& booleans);\n+ 302\n+ 308 bool isNotAtEnd() const;\n+ 309\n+ 315 bool isAtEnd() const;\n+ 316\n+ 317 private:\n+ 327 IteratorTuple iterators_;\n+ 328 };\n+ 329\n+ 331 typedef std::map IteratorsMap;\n+ 332\n+ 344 IteratorsMap iteratorsMap_;\n+ 345\n+ 347 void calculateMessageSizes();\n+ 348\n+ 356 void packAndSend(int destination, char* buffer, std::size_t bufferSize,\n+MPI_Request& req);\n+ 357\n+ 362 template\n+ 363 void recvAndUnpack(T1& numberer);\n+ 364\n+ 368 void registerMessageDatatype();\n+ 369\n+ 373 void insertIntoRemoteIndexList(int process,\n+ 374 const std::pair& global,\n+ 375 char attribute);\n+ 376\n+ 380 void resetIteratorsMap();\n+ 381\n+ 386 bool checkReset();\n+ 387\n+ 396 bool checkReset(const Iterators& iterators, RemoteIndexList& rlist,\n+GlobalIndexList& gList,\n+ 397 BoolList& bList);\n+ 398 };\n+ 399\n+ 400 template\n+401 bool operator<(const IndexPair >& i1,\n+ 402 const std::pair& i2)\n+ 403 {\n+ 404 return i1.global() < i2.first ||\n+ 405 (i1.global() == i2.first && i1.local().attribute()\n+409 bool operator<(const std::pair& i1,\n+ 410 const IndexPair >& i2)\n+ 411 {\n+ 412 return i1.first < i2.global() ||\n+ 413 (i1.first == i2.global() && i1.second\n+417 bool operator==(const IndexPair >& i1,\n+ 418 const std::pair& i2)\n+ 419 {\n+ 420 return (i1.global() == i2.first && i1.local().attribute()==i2.second);\n+ 421 }\n+ 422\n+ 423 template\n+424 bool operator!=(const IndexPair >& i1,\n+ 425 const std::pair& i2)\n+ 426 {\n+ 427 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);\n+ 428 }\n+ 429\n+ 430 template\n+431 bool operator==(const std::pair& i2,\n+ 432 const IndexPair >& i1)\n+ 433 {\n+ 434 return (i1.global() == i2.first && i1.local().attribute()==i2.second);\n+ 435 }\n+ 436\n+ 437 template\n+438 bool operator!=(const std::pair& i2,\n+ 439 const IndexPair >& i1)\n+ 440 {\n+ 441 return (i1.global() != i2.first || i1.local().attribute()!=i2.second);\n+ 442 }\n+ 443\n+ 460 template\n+461 void storeGlobalIndicesOfRemoteIndices(std::map,A> >&\n+globalMap,\n+ 462 const RemoteIndices& remoteIndices)\n+ 463 {\n+ 464 for(auto remote = remoteIndices.begin(), end =remoteIndices.end(); remote\n+!= end; ++remote) {\n+ 465 typedef typename RemoteIndices::RemoteIndexList RemoteIndexList;\n+ 466 typedef SLList,A> GlobalIndexList;\n+ 467 GlobalIndexList& global = globalMap[remote->first];\n+ 468 RemoteIndexList& rList = *(remote->second.first);\n+ 469\n+ 470 for(auto index = rList.begin(), riEnd = rList.end();\n+ 471 index != riEnd; ++index) {\n+ 472 global.push_back(std::make_pair(index->localIndexPair().global(),\n+ 473 index->localIndexPair().local().attribute()));\n+ 474 }\n+ 475 }\n+ 476 }\n+ 477\n+ 486 template\n+487 inline void repairLocalIndexPointers(std::map,A> >& globalMap,\n+ 490 RemoteIndices& remoteIndices,\n+ 491 const T& indexSet)\n+ 492 {\n+ 493 assert(globalMap.size()==static_cast(remoteIndices.neighbours\n+()));\n+ 494 // Repair pointers to index set in remote indices.\n+ 495 auto global = globalMap.begin();\n+ 496 auto end = remoteIndices.remoteIndices_.end();\n+ 497\n+ 498 for(auto remote = remoteIndices.remoteIndices_.begin(); remote != end;\n+++remote, ++global) {\n+ 499 assert(remote->first==global->first);\n+ 500 assert(remote->second.first->size() == global->second.size());\n+ 501\n+ 502 auto riEnd = remote->second.first->end();\n+ 503 auto rIndex = remote->second.first->begin();\n+ 504 auto gIndex = global->second.begin();\n+ 505 auto index = indexSet.begin();\n+ 506\n+ 507 assert(rIndex==riEnd || gIndex != global->second.end());\n+ 508 while(rIndex != riEnd) {\n+ 509 // Search for the index in the set.\n+ 510 assert(gIndex != global->second.end());\n+ 511\n+ 512 while(!(index->global() == gIndex->first\n+ 513 && index->local().attribute() == gIndex->second)) {\n+ 514 ++index;\n+ 515 // this is only needed for ALU, where there may exist\n+ 516 // more entries with the same global index in the remote index set\n+ 517 // than in the index set\n+ 518 if (index->global() > gIndex->first) {\n+ 519 index=indexSet.begin();\n+ 520 }\n+ 521 }\n+ 522\n+ 523 assert(index != indexSet.end() && *index == *gIndex);\n+ 524\n+ 525 rIndex->localIndex_ = &(*index);\n+ 526 ++index;\n+ 527 ++rIndex;\n+ 528 ++gIndex;\n+ 529 }\n+ 530 }\n+ 531 remoteIndices.sourceSeqNo_ = remoteIndices.source_->seqNo();\n+ 532 remoteIndices.destSeqNo_ = remoteIndices.target_->seqNo();\n+ 533 }\n+ 534\n+ 535 template\n+536 IndicesSyncer::IndicesSyncer(ParallelIndexSet& indexSet,\n+ 537 RemoteIndices& remoteIndices)\n+ 538 : indexSet_(indexSet), remoteIndices_(remoteIndices)\n+ 539 {\n+ 540 // index sets must match.\n+ 541 assert(remoteIndices.source_ == remoteIndices.target_);\n+ 542 assert(remoteIndices.source_ == &indexSet);\n+ 543 MPI_Comm_rank(remoteIndices_.communicator(), &rank_);\n+ 544 }\n+ 545\n+ 546 template\n+547 IndicesSyncer::Iterators::Iterators(RemoteIndexList& remoteIndices,\n+ 548 GlobalIndexList& globalIndices,\n+ 549 BoolList& booleans)\n+ 550 : iterators_(remoteIndices.beginModify(), globalIndices.beginModify(),\n+ 551 booleans.beginModify(), remoteIndices.end())\n+ 552 { }\n+ 553\n+ 554 template\n+555 IndicesSyncer::Iterators::Iterators()\n+ 556 : iterators_()\n+ 557 {}\n+ 558\n+ 559 template\n+560 inline typename IndicesSyncer::Iterators& IndicesSyncer::Iterators::\n+operator++()\n+ 561 {\n+ 562 ++(std::get<0>(iterators_));\n+ 563 ++(std::get<1>(iterators_));\n+ 564 ++(std::get<2>(iterators_));\n+ 565 return *this;\n+ 566 }\n+ 567\n+ 568 template\n+569 inline void IndicesSyncer::Iterators::insert(const RemoteIndex & index,\n+ 570 const std::pair& global)\n+ 571 {\n+ 572 std::get<0>(iterators_).insert(index);\n+ 573 std::get<1>(iterators_).insert(global);\n+ 574 std::get<2>(iterators_).insert(false);\n+ 575 }\n+ 576\n+ 577 template\n+ 578 inline typename IndicesSyncer::RemoteIndex&\n+579 IndicesSyncer::Iterators::remoteIndex() const\n+ 580 {\n+ 581 return *(std::get<0>(iterators_));\n+ 582 }\n+ 583\n+ 584 template\n+ 585 inline std::pair::GlobalIndex,typename\n+IndicesSyncer::Attribute>&\n+586 IndicesSyncer::Iterators::globalIndexPair() const\n+ 587 {\n+ 588 return *(std::get<1>(iterators_));\n+ 589 }\n+ 590\n+ 591 template\n+592 inline bool IndicesSyncer::Iterators::isOld() const\n+ 593 {\n+ 594 return *(std::get<2>(iterators_));\n+ 595 }\n+ 596\n+ 597 template\n+598 inline void IndicesSyncer::Iterators::reset(RemoteIndexList&\n+remoteIndices,\n+ 599 GlobalIndexList& globalIndices,\n+ 600 BoolList& booleans)\n+ 601 {\n+ 602 std::get<0>(iterators_) = remoteIndices.beginModify();\n+ 603 std::get<1>(iterators_) = globalIndices.beginModify();\n+ 604 std::get<2>(iterators_) = booleans.beginModify();\n+ 605 }\n+ 606\n+ 607 template\n+608 inline bool IndicesSyncer::Iterators::isNotAtEnd() const\n+ 609 {\n+ 610 return std::get<0>(iterators_) != std::get<3>(iterators_);\n+ 611 }\n+ 612\n+ 613 template\n+614 inline bool IndicesSyncer::Iterators::isAtEnd() const\n+ 615 {\n+ 616 return std::get<0>(iterators_) == std::get<3>(iterators_);\n+ 617 }\n+ 618\n+ 619 template\n+ 620 void IndicesSyncer::registerMessageDatatype()\n+ 621 {\n+ 622 MPI_Datatype type[2] = {MPI_INT, MPI_INT};\n+ 623 int blocklength[2] = {1,1};\n+ 624 MPI_Aint displacement[2];\n+ 625 MPI_Aint base;\n+ 626\n+ 627 // Compute displacement\n+ 628 MessageInformation message;\n+ 629\n+ 630 MPI_Get_address( &(message.publish), displacement);\n+ 631 MPI_Get_address( &(message.pairs), displacement+1);\n+ 632\n+ 633 // Make the displacement relative\n+ 634 MPI_Get_address(&message, &base);\n+ 635 displacement[0] -= base;\n+ 636 displacement[1] -= base;\n+ 637\n+ 638 MPI_Type_create_struct( 2, blocklength, displacement, type, &datatype_);\n+ 639 MPI_Type_commit(&datatype_);\n+ 640 }\n+ 641\n+ 642 template\n+ 643 void IndicesSyncer::calculateMessageSizes()\n+ 644 {\n+ 645 auto iEnd = indexSet_.end();\n+ 646 auto collIter = remoteIndices_.template iterator();\n+ 647\n+ 648 for(auto index = indexSet_.begin(); index != iEnd; ++index) {\n+ 649 collIter.advance(index->global(), index->local().attribute());\n+ 650 if(collIter.empty())\n+ 651 break;\n+ 652 int knownRemote=0;\n+ 653 auto end = collIter.end();\n+ 654\n+ 655 // Count the remote indices we know.\n+ 656 for(auto valid = collIter.begin(); valid != end; ++valid) {\n+ 657 ++knownRemote;\n+ 658 }\n+ 659\n+ 660 if(knownRemote>0) {\n+ 661 Dune::dverb<global()<< \" for processes \";\n+ 662\n+ 663 // Update MessageInformation\n+ 664 for(auto valid = collIter.begin(); valid != end; ++valid) {\n+ 665 ++(infoSend_[valid.process()].publish);\n+ 666 (infoSend_[valid.process()].pairs) += knownRemote;\n+ 667 Dune::dverb<first==remote->first) {\n+ 689 // We want to send message information to that process\n+ 690 message = const_cast(&(messageIter->second));\n+ 691 ++messageIter;\n+ 692 }else\n+ 693 // We do not want to send information but the other process might.\n+ 694 message = &dummy;\n+ 695\n+ 696 sendBufferSizes_[neighbour]=0;\n+ 697 int tsize;\n+ 698 // The number of indices published\n+ 699 MPI_Pack_size(1, MPI_INT,remoteIndices_.communicator(), &tsize);\n+ 700 sendBufferSizes_[neighbour] += tsize;\n+ 701\n+ 702 for(int i=0; i < message->publish; ++i) {\n+ 703 // The global index\n+ 704 MPI_Pack_size(1, MPITraits::getType(),\n+remoteIndices_.communicator(), &tsize);\n+ 705 sendBufferSizes_[neighbour] += tsize;\n+ 706 // The attribute in the local index\n+ 707 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);\n+ 708 sendBufferSizes_[neighbour] += tsize;\n+ 709 // The number of corresponding remote indices\n+ 710 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);\n+ 711 sendBufferSizes_[neighbour] += tsize;\n+ 712 }\n+ 713 for(int i=0; i < message->pairs; ++i) {\n+ 714 // The process of the remote index\n+ 715 MPI_Pack_size(1, MPI_INT, remoteIndices_.communicator(), &tsize);\n+ 716 sendBufferSizes_[neighbour] += tsize;\n+ 717 // The attribute of the remote index\n+ 718 MPI_Pack_size(1, MPI_CHAR, remoteIndices_.communicator(), &tsize);\n+ 719 sendBufferSizes_[neighbour] += tsize;\n+ 720 }\n+ 721\n+ 722 Dune::dverb<first<<\") size is \"<<\n+sendBufferSizes_[neighbour]<<\" for publish=\"<publish<<\"\n+pairs=\"<pairs<\n+728 inline void IndicesSyncer::sync()\n+ 729 {\n+ 730 DefaultNumberer numberer;\n+ 731 sync(numberer);\n+ 732 }\n+ 733\n+ 734 template\n+ 735 template\n+736 void IndicesSyncer::sync(T1& numberer)\n+ 737 {\n+ 738 // The pointers to the local indices in the remote indices\n+ 739 // will become invalid due to the resorting of the index set.\n+ 740 // Therefore store the corresponding global indices.\n+ 741 // Mark all indices as not added\n+ 742 const auto end = remoteIndices_.end();\n+ 743\n+ 744 // Number of neighbours might change during the syncing.\n+ 745 // save the old neighbours\n+ 746 std::size_t noOldNeighbours = remoteIndices_.neighbours();\n+ 747 int* oldNeighbours = new int[noOldNeighbours];\n+ 748 sendBufferSizes_ = new std::size_t[noOldNeighbours];\n+ 749 std::size_t neighbourI = 0;\n+ 750\n+ 751 for(auto remote = remoteIndices_.begin(); remote != end; ++remote,\n+++neighbourI) {\n+ 752 oldNeighbours[neighbourI] = remote->first;\n+ 753\n+ 754 // Make sure we only have one remote index list.\n+ 755 assert(remote->second.first==remote->second.second);\n+ 756\n+ 757 RemoteIndexList& rList = *(remote->second.first);\n+ 758\n+ 759 // Store the corresponding global indices.\n+ 760 GlobalIndexList& global = globalMap_[remote->first];\n+ 761 BoolList& added = oldMap_[remote->first];\n+ 762 auto riEnd = rList.end();\n+ 763\n+ 764 for(auto index = rList.begin();\n+ 765 index != riEnd; ++index) {\n+ 766 global.push_back(std::make_pair(index->localIndexPair().global(),\n+ 767 index->localIndexPair().local().attribute()));\n+ 768 added.push_back(true);\n+ 769 }\n+ 770\n+ 771 Iterators iterators(rList, global, added);\n+ 772 iteratorsMap_.insert(std::make_pair(remote->first, iterators));\n+ 773 assert(checkReset(iteratorsMap_[remote->first], rList,global,added));\n+ 774 }\n+ 775\n+ 776 // Exchange indices with each neighbour\n+ 777 calculateMessageSizes();\n+ 778\n+ 779 // Allocate the buffers\n+ 780 receiveBufferSize_=1;\n+ 781 sendBuffers_ = new char*[noOldNeighbours];\n+ 782\n+ 783 for(std::size_t i=0; i\n+(sendBufferSizes_[i]));\n+ 786 }\n+ 787\n+ 788 receiveBuffer_=new char[receiveBufferSize_];\n+ 789\n+ 790 indexSet_.beginResize();\n+ 791\n+ 792 Dune::dverb<\n+ 852 void IndicesSyncer::packAndSend(int destination, char* buffer, std::\n+size_t bufferSize, MPI_Request& request)\n+ 853 {\n+ 854 auto iEnd = indexSet_.end();\n+ 855 int bpos = 0;\n+ 856 int published = 0;\n+ 857 int pairs = 0;\n+ 858\n+ 859 assert(checkReset());\n+ 860\n+ 861 // Pack the number of indices we publish\n+ 862 MPI_Pack(&(infoSend_[destination].publish), 1, MPI_INT, buffer,\n+bufferSize, &bpos,\n+ 863 remoteIndices_.communicator());\n+ 864\n+ 865 for(auto index = indexSet_.begin(); index != iEnd; ++index) {\n+ 866 // Search for corresponding remote indices in all iterator tuples\n+ 867 auto iteratorsEnd = iteratorsMap_.end();\n+ 868\n+ 869 // advance all iterators to a position with global index >= index->global\n+()\n+ 870 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators;\n+++iterators) {\n+ 871 while(iterators->second.isNotAtEnd() &&\n+ 872 iterators->second.globalIndexPair().first < index->global())\n+ 873 ++(iterators->second);\n+ 874 assert(!iterators->second.isNotAtEnd() || iterators-\n+>second.globalIndexPair().first >= index->global());\n+ 875 }\n+ 876\n+ 877 // Add all remote indices positioned at global which were already present\n+before calling sync\n+ 878 // to the message.\n+ 879 // Count how many remote indices we will send\n+ 880 int indices = 0;\n+ 881 bool knownRemote = false; // Is the remote process supposed to know this\n+index?\n+ 882\n+ 883 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators;\n+++iterators)\n+ 884 {\n+ 885 std::pair p;\n+ 886 if (iterators->second.isNotAtEnd())\n+ 887 {\n+ 888 p = iterators->second.globalIndexPair();\n+ 889 }\n+ 890\n+ 891 if(iterators->second.isNotAtEnd() && iterators->second.isOld()\n+ 892 && iterators->second.globalIndexPair().first == index->global()) {\n+ 893 indices++;\n+ 894 if(destination == iterators->first)\n+ 895 knownRemote = true;\n+ 896 }\n+ 897 }\n+ 898\n+ 899 if(!knownRemote)\n+ 900 // We do not need to send any indices\n+ 901 continue;\n+ 902\n+ 903 Dune::dverb<global\n+()<<\" to \"<(&(index->global())), 1,\n+MPITraits::getType(), buffer, bufferSize, &bpos,\n+ 908 remoteIndices_.communicator());\n+ 909\n+ 910 char attr = index->local().attribute();\n+ 911 MPI_Pack(&attr, 1, MPI_CHAR, buffer, bufferSize, &bpos,\n+ 912 remoteIndices_.communicator());\n+ 913\n+ 914 // Pack the number of remote indices we send.\n+ 915 MPI_Pack(&indices, 1, MPI_INT, buffer, bufferSize, &bpos,\n+ 916 remoteIndices_.communicator());\n+ 917\n+ 918 // Pack the information about the remote indices\n+ 919 for(auto iterators = iteratorsMap_.begin(); iteratorsEnd != iterators;\n+++iterators)\n+ 920 if(iterators->second.isNotAtEnd() && iterators->second.isOld()\n+ 921 && iterators->second.globalIndexPair().first == index->global()) {\n+ 922 int process = iterators->first;\n+ 923\n+ 924 ++pairs;\n+ 925 assert(pairs <= infoSend_[destination].pairs);\n+ 926 MPI_Pack(&process, 1, MPI_INT, buffer, bufferSize, &bpos,\n+ 927 remoteIndices_.communicator());\n+ 928 char attr2 = iterators->second.remoteIndex().attribute();\n+ 929\n+ 930 MPI_Pack(&attr2, 1, MPI_CHAR, buffer, bufferSize, &bpos,\n+ 931 remoteIndices_.communicator());\n+ 932 --indices;\n+ 933 }\n+ 934 assert(indices==0);\n+ 935 ++published;\n+ 936 Dune::dvverb<<\" (publish=\"<\n+ 951 inline void IndicesSyncer::insertIntoRemoteIndexList(int process,\n+ 952 const std::pair& globalPair,\n+ 953 char attribute)\n+ 954 {\n+ 955 Dune::dverb<<\"Inserting from \"<second;\n+ 972\n+ 973 // Search for the remote index\n+ 974 while(iterators.isNotAtEnd() && iterators.globalIndexPair() < globalPair)\n+{\n+ 975 // Increment all iterators\n+ 976 ++iterators;\n+ 977\n+ 978 }\n+ 979\n+ 980 if(iterators.isAtEnd() || iterators.globalIndexPair() != globalPair) {\n+ 981 // The entry is not yet known\n+ 982 // Insert in the list and do not change the first iterator.\n+ 983 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);\n+ 984 return;\n+ 985 }\n+ 986\n+ 987 // Global indices match\n+ 988 bool indexIsThere=false;\n+ 989 for(Iterators tmpIterators = iterators;\n+ 990 !tmpIterators.isAtEnd() && tmpIterators.globalIndexPair() == globalPair;\n+ 991 ++tmpIterators)\n+ 992 //entry already exists with the same attribute\n+ 993 if(tmpIterators.globalIndexPair().second == attribute) {\n+ 994 indexIsThere=true;\n+ 995 break;\n+ 996 }\n+ 997\n+ 998 if(!indexIsThere)\n+ 999 // The entry is not yet known\n+ 1000 // Insert in the list and do not change the first iterator.\n+ 1001 iterators.insert(RemoteIndex(Attribute(attribute)),globalPair);\n+ 1002 }\n+ 1003\n+ 1004 template\n+ 1005 template\n+ 1006 void IndicesSyncer::recvAndUnpack(T1& numberer)\n+ 1007 {\n+ 1008 const ParallelIndexSet& constIndexSet = indexSet_;\n+ 1009 auto iEnd = constIndexSet.end();\n+ 1010 auto index = constIndexSet.begin();\n+ 1011 int bpos = 0;\n+ 1012 int publish;\n+ 1013\n+ 1014 assert(checkReset());\n+ 1015\n+ 1016 MPI_Status status;\n+ 1017\n+ 1018 // We have to determine the message size and source before the receive\n+ 1019 MPI_Probe(MPI_ANY_SOURCE, 345, remoteIndices_.communicator(), &status);\n+ 1020\n+ 1021 int source=status.MPI_SOURCE;\n+ 1022 int count;\n+ 1023 MPI_Get_count(&status, MPI_PACKED, &count);\n+ 1024\n+ 1025 Dune::dvverb<receiveBufferSize_) {\n+ 1028 receiveBufferSize_=count;\n+ 1029 delete[] receiveBuffer_;\n+ 1030 receiveBuffer_ = new char[receiveBufferSize_];\n+ 1031 }\n+ 1032\n+ 1033 MPI_Recv(receiveBuffer_, count, MPI_PACKED, source, 345,\n+remoteIndices_.communicator(), &status);\n+ 1034\n+ 1035 // How many global entries were published?\n+ 1036 MPI_Unpack(receiveBuffer_, count, &bpos, &publish, 1, MPI_INT,\n+remoteIndices_.communicator());\n+ 1037\n+ 1038 // Now unpack the remote indices and add them.\n+ 1039 while(publish>0) {\n+ 1040\n+ 1041 // Unpack information about the local index on the source process\n+ 1042 GlobalIndex global; // global index of the current entry\n+ 1043 char sourceAttribute; // Attribute on the source process\n+ 1044 int pairs;\n+ 1045\n+ 1046 MPI_Unpack(receiveBuffer_, count, &bpos, &global, 1,\n+MPITraits::getType(),\n+ 1047 remoteIndices_.communicator());\n+ 1048 MPI_Unpack(receiveBuffer_, count, &bpos, &sourceAttribute, 1, MPI_CHAR,\n+ 1049 remoteIndices_.communicator());\n+ 1050 MPI_Unpack(receiveBuffer_, count, &bpos, &pairs, 1, MPI_INT,\n+ 1051 remoteIndices_.communicator());\n+ 1052\n+ 1053 // Insert the entry on the remote process to our\n+ 1054 // remote index list\n+ 1055 SLList > sourceAttributeList;\n+ 1056 sourceAttributeList.push_back(std::make_pair(source,Attribute\n+(sourceAttribute)));\n+ 1057#ifndef NDEBUG\n+ 1058 bool foundSelf = false;\n+ 1059#endif\n+ 1060 Attribute myAttribute=Attribute();\n+ 1061\n+ 1062 // Unpack the remote indices\n+ 1063 for(; pairs>0; --pairs) {\n+ 1064 // Unpack the process id that knows the index\n+ 1065 int process;\n+ 1066 char attribute;\n+ 1067 MPI_Unpack(receiveBuffer_, count, &bpos, &process, 1, MPI_INT,\n+ 1068 remoteIndices_.communicator());\n+ 1069 // Unpack the attribute\n+ 1070 MPI_Unpack(receiveBuffer_, count, &bpos, &attribute, 1, MPI_CHAR,\n+ 1071 remoteIndices_.communicator());\n+ 1072\n+ 1073 if(process==rank_) {\n+ 1074#ifndef NDEBUG\n+ 1075 foundSelf=true;\n+ 1076#endif\n+ 1077 myAttribute=Attribute(attribute);\n+ 1078 // Now we know the local attribute of the global index\n+ 1079 //Only add the index if it is unknown.\n+ 1080 // Do we know that global index already?\n+ 1081 auto pos = std::lower_bound(index, iEnd, IndexPair(global));\n+ 1082\n+ 1083 if(pos == iEnd || pos->global() != global) {\n+ 1084 // no entry with this global index\n+ 1085 indexSet_.add(global,\n+ 1086 ParallelLocalIndex(numberer(global),\n+ 1087 myAttribute, true));\n+ 1088 Dune::dvverb << \"Adding \"<global()==global; ++pos)\n+ 1097 if(pos->local().attribute() == myAttribute) {\n+ 1098 Dune::dvverb<<\"found \"<(numberer(global),\n+ 1106 myAttribute, true));\n+ 1107 Dune::dvverb << \"Adding \"< >::const_iterator Iter;\n+ 1117 for(Iter i=sourceAttributeList.begin(), end=sourceAttributeList.end();\n+ 1118 i!=end; ++i)\n+ 1119 insertIntoRemoteIndexList(i->first, std::make_pair(global, myAttribute),\n+ 1120 i->second);\n+ 1121 --publish;\n+ 1122 }\n+ 1123\n+ 1124 resetIteratorsMap();\n+ 1125 }\n+ 1126\n+ 1127 template\n+ 1128 void IndicesSyncer::resetIteratorsMap(){\n+ 1129\n+ 1130 // Reset iterators in all tuples.\n+ 1131 const auto remoteEnd = remoteIndices_.remoteIndices_.end();\n+ 1132 auto iterators = iteratorsMap_.begin();\n+ 1133 auto global = globalMap_.begin();\n+ 1134 auto added = oldMap_.begin();\n+ 1135\n+ 1136 for(auto remote = remoteIndices_.remoteIndices_.begin();\n+ 1137 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {\n+ 1138 iterators->second.reset(*(remote->second.first), global->second, added-\n+>second);\n+ 1139 }\n+ 1140 }\n+ 1141\n+ 1142 template\n+ 1143 bool IndicesSyncer::checkReset(const Iterators& iterators,\n+RemoteIndexList& rList, GlobalIndexList& gList,\n+ 1144 BoolList& bList){\n+ 1145\n+ 1146 if(std::get<0>(iterators.iterators_) != rList.begin())\n+ 1147 return false;\n+ 1148 if(std::get<1>(iterators.iterators_) != gList.begin())\n+ 1149 return false;\n+ 1150 if(std::get<2>(iterators.iterators_) != bList.begin())\n+ 1151 return false;\n+ 1152 return true;\n+ 1153 }\n+ 1154\n+ 1155\n+ 1156 template\n+ 1157 bool IndicesSyncer::checkReset(){\n+ 1158\n+ 1159 // Reset iterators in all tuples.\n+ 1160 const auto remoteEnd = remoteIndices_.remoteIndices_.end();\n+ 1161 auto iterators = iteratorsMap_.begin();\n+ 1162 auto global = globalMap_.begin();\n+ 1163 auto added = oldMap_.begin();\n+ 1164 bool ret = true;\n+ 1165\n+ 1166 for(auto remote = remoteIndices_.remoteIndices_.begin();\n+ 1167 remote != remoteEnd; ++remote, ++global, ++added, ++iterators) {\n+ 1168 if(!checkReset(iterators->second, *(remote->second.first), global-\n+>second,\n+ 1169 added->second))\n+ 1170 ret=false;\n+ 1171 }\n+ 1172 return ret;\n+ 1173 }\n+ 1174}\n+ 1175\n+ 1176#endif\n+ 1177#endif\n+remoteindices.hh\n+Classes describing a distributed indexset.\n+indexset.hh\n+Provides a map between global and local indices.\n+sllist.hh\n+Implements a singly linked list together with the necessary iterators.\n+stdstreams.hh\n+Standard Dune debug streams.\n+Dune::SLList::push_back\n+void push_back(const MemberType &item)\n+Add a new entry to the end of the list.\n+Definition: sllist.hh:643\n+Dune::SLList::iterator\n+SLListIterator< T, A > iterator\n+The mutable iterator of the list.\n+Definition: sllist.hh:69\n+Dune::SLList::end\n+iterator end()\n+Get an iterator pointing to the end of the list.\n+Definition: sllist.hh:774\n+Dune::SLList::beginModify\n+ModifyIterator beginModify()\n+Get an iterator capable of deleting and inserting elements.\n+Definition: sllist.hh:787\n+Dune::SLList<_RemoteIndex,_Allocator_>::const_iterator\n+SLListConstIterator< RemoteIndex, Allocator > const_iterator\n+The constant iterator of the list.\n+Definition: sllist.hh:74\n+Dune::SLList::ModifyIterator\n+SLListModifyIterator< T, A > ModifyIterator\n+The type of the iterator capable of deletion and insertion.\n+Definition: sllist.hh:103\n+Dune::SLList::begin\n+iterator begin()\n+Get an iterator pointing to the first element in the list.\n+Definition: sllist.hh:762\n+Dune::operator<\n+EnableIfInterOperable< T1, T2, bool >::type operator<(const\n+RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const\n+RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)\n+Comparison operator.\n+Definition: iteratorfacades.hh:637\n+Dune::operator==\n+EnableIfInterOperable< T1, T2, bool >::type operator==(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for equality.\n+Definition: iteratorfacades.hh:237\n+Dune::operator!=\n+EnableIfInterOperable< T1, T2, bool >::type operator!=(const\n+ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2,\n+V2, R2, D > &rhs)\n+Checks for inequality.\n+Definition: iteratorfacades.hh:259\n+Dune::IndicesSyncer::RemoteIndices\n+Dune::RemoteIndices< ParallelIndexSet > RemoteIndices\n+Type of the remote indices.\n+Definition: indicessyncer.hh:59\n+Dune::IndicesSyncer::MessageInformation::publish\n+int publish\n+The number of indices we publish for the other process.\n+Definition: indicessyncer.hh:126\n+Dune::repairLocalIndexPointers\n+void repairLocalIndexPointers(std::map< int, SLList< std::pair< typename T::\n+GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap,\n+RemoteIndices< T, A1 > &remoteIndices, const T &indexSet)\n+Repair the pointers to the local indices in the remote indices.\n+Definition: indicessyncer.hh:487\n+Dune::IndicesSyncer::GlobalIndex\n+ParallelIndexSet::GlobalIndex GlobalIndex\n+Type of the global index used in the index set.\n+Definition: indicessyncer.hh:51\n+Dune::IndicesSyncer::MessageInformation::pairs\n+int pairs\n+The number of pairs (attribute and process number) we publish to the neighbour\n+process.\n+Definition: indicessyncer.hh:131\n+Dune::IndicesSyncer::Iterators::attribute\n+Attribute & attribute() const\n+Dune::IndicesSyncer::Attribute\n+ParallelIndexSet::LocalIndex::Attribute Attribute\n+Type of the attribute used in the index set.\n+Definition: indicessyncer.hh:54\n+Dune::IndicesSyncer::IndicesSyncer\n+IndicesSyncer(ParallelIndexSet &indexSet, RemoteIndices &remoteIndices)\n+Constructor.\n+Definition: indicessyncer.hh:536\n+Dune::IndicesSyncer::ParallelIndexSet\n+T ParallelIndexSet\n+The type of the index set.\n+Definition: indicessyncer.hh:45\n+Dune::ParallelIndexSet::GlobalIndex\n+TG GlobalIndex\n+the type of the global index. This type has to provide at least a operator< for\n+sorting.\n+Definition: indexset.hh:226\n+Dune::storeGlobalIndicesOfRemoteIndices\n+void storeGlobalIndicesOfRemoteIndices(std::map< int, SLList< std::pair<\n+typename T::GlobalIndex, typename T::LocalIndex::Attribute >, A > > &globalMap,\n+const RemoteIndices< T, A1 > &remoteIndices)\n+Stores the corresponding global indices of the remote index information.\n+Definition: indicessyncer.hh:461\n+Dune::IndicesSyncer::sync\n+void sync()\n+Sync the index set.\n+Definition: indicessyncer.hh:728\n+Dune::ParallelIndexSet::seqNo\n+int seqNo() const\n+Get the internal sequence number.\n+Dune::IndicesSyncer::IndexPair\n+ParallelIndexSet::IndexPair IndexPair\n+The type of the index pair.\n+Definition: indicessyncer.hh:48\n+Dune::IndicesSyncer::MessageInformation::MessageInformation\n+MessageInformation()\n+Definition: indicessyncer.hh:122\n+Dune::dvverb\n+DVVerbType dvverb(std::cout)\n+stream for very verbose output.\n+Definition: stdstreams.hh:95\n+Dune::dverb\n+DVerbType dverb(std::cout)\n+Singleton of verbose debug stream.\n+Definition: stdstreams.hh:116\n+Dune\n+Dune namespace.\n+Definition: alignedallocator.hh:13\n+Dune::AlignedNumberImpl::max\n+auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n+&b)\n+Definition: debugalign.hh:425\n+Dune::MPITraits::getType\n+static MPI_Datatype getType()\n+Definition: mpitraits.hh:48\n+Dune::IndexPair\n+A pair consisting of a global and local index.\n+Definition: indexset.hh:85\n+Dune::IndicesSyncer\n+Class for recomputing missing indices of a distributed index set.\n+Definition: indicessyncer.hh:41\n+Dune::ParallelLocalIndex\n+An index present on the local process with an additional attribute flag.\n+Definition: plocalindex.hh:49\n+Dune::RemoteIndices\n+The indices present on remote processes.\n+Definition: remoteindices.hh:189\n+Dune::RemoteIndices::communicator\n+MPI_Comm communicator() const\n+Get the mpi communicator used.\n+Definition: remoteindices.hh:1696\n+Dune::RemoteIndices::end\n+const_iterator end() const\n+Get an iterator over all remote index lists.\n+Definition: remoteindices.hh:1529\n+Dune::RemoteIndices::neighbours\n+int neighbours() const\n+Get the number of processors we share indices with.\n+Definition: remoteindices.hh:1446\n+Dune::RemoteIndices::Allocator\n+typename std::allocator_traits< A >::template rebind_alloc< RemoteIndex >\n+Allocator\n+The type of the allocator for the remote index list.\n+Definition: remoteindices.hh:237\n+Dune::RemoteIndices::begin\n+const_iterator begin() const\n+Get an iterator over all remote index lists.\n+Definition: remoteindices.hh:1522\n+Dune::RemoteIndex\n+Information about an index residing on another processor.\n+Definition: remoteindices.hh:73\n+Dune::SLListIterator\n+A mutable iterator for the SLList.\n+Definition: sllist.hh:271\n+Dune::SLList\n+A single linked list.\n+Definition: sllist.hh:44\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00092.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00092.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: stringutility.hh File Reference\n+dune-common: alignedallocator.hh File Reference\n \n \n \n \n \n \n \n@@ -63,57 +63,38 @@\n
    \n \n
    \n \n
    \n \n-
    stringutility.hh File Reference
    \n+Classes |\n+Namespaces
    \n+
    alignedallocator.hh File Reference
    \n \n
    \n-\n-

    Miscellaneous helper stuff. \n-More...

    \n-
    #include <cstddef>
    \n-#include <cstring>
    \n-#include <algorithm>
    \n-#include <cassert>
    \n-#include <cstdio>
    \n-#include <memory>
    \n-#include <string>
    \n-#include <new>
    \n-#include <dune/common/exceptions.hh>
    \n+
    #include "mallocallocator.hh"
    \n+#include <cstdlib>
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+

    \n+Classes

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

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n

    \n-Functions

    template<typename C >
    bool Dune::hasPrefix (const C &c, const char *prefix)
     Check whether a character container has a given prefix. More...
     
    template<typename C >
    bool Dune::hasSuffix (const C &c, const char *suffix)
     Check whether a character container has a given suffix. More...
     
    template<class... T>
    static std::string Dune::formatString (const std::string &s, const T &... args)
     Format values according to printf format string. More...
     
    \n-

    Detailed Description

    \n-

    Miscellaneous helper stuff.

    \n-
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,45 +4,25 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Functions\n-stringutility.hh File Reference\n-Miscellaneous helper stuff. More...\n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+Classes | Namespaces\n+alignedallocator.hh File Reference\n+#include \"mallocallocator.hh\"\n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+ class \u00a0Dune::AlignedAllocator<_T,_Alignment_>\n+\u00a0 Allocators which guarantee alignment of the memory. More...\n+\u00a0\n+struct \u00a0Dune::AlignedAllocator<_T,_Alignment_>::rebind<_U_>\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n- Functions\n-template\n- bool\u00a0Dune::hasPrefix (const C &c, const char *prefix)\n-\u00a0 Check whether a character container has a given prefix.\n- More...\n-\u00a0\n-template\n- bool\u00a0Dune::hasSuffix (const C &c, const char *suffix)\n-\u00a0 Check whether a character container has a given suffix.\n- More...\n-\u00a0\n-template\n-static std::string\u00a0Dune::formatString (const std::string &s, const T &...\n- args)\n-\u00a0 Format values according to printf format string. More...\n-\u00a0\n-***** Detailed Description *****\n-Miscellaneous helper stuff.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00092_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: stringutility.hh Source File\n+dune-common: alignedallocator.hh Source File\n \n \n \n \n \n \n \n@@ -62,103 +62,114 @@\n \n
    \n \n
    \n \n
    \n-
    stringutility.hh
    \n+
    alignedallocator.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_STRINGUTILITY_HH
    \n-
    6#define DUNE_COMMON_STRINGUTILITY_HH
    \n+
    5#ifndef DUNE_ALIGNED_ALLOCATOR_HH
    \n+
    6#define DUNE_ALIGNED_ALLOCATOR_HH
    \n
    7
    \n-
    12#include <cstddef>
    \n-
    13#include <cstring>
    \n-
    14#include <algorithm>
    \n-
    15#include <cassert>
    \n-
    16#include <cstdio>
    \n-
    17#include <memory>
    \n-
    18#include <string>
    \n-
    19#include <new>
    \n-
    20
    \n-\n-
    22
    \n-
    23
    \n-
    24namespace Dune {
    \n-
    25
    \n-
    36 template<typename C>
    \n-
    37 bool hasPrefix(const C& c, const char* prefix) {
    \n-
    38 std::size_t len = std::strlen(prefix);
    \n-
    39 return c.size() >= len &&
    \n-
    40 std::equal(prefix, prefix+len, c.begin());
    \n-
    41 }
    \n+
    8#include "mallocallocator.hh"
    \n+
    9#include <cstdlib>
    \n+
    10
    \n+
    11
    \n+
    12namespace Dune
    \n+
    13{
    \n+
    14
    \n+
    22 template<class T, int Alignment = -1>
    \n+\n+
    24
    \n+
    25#if __APPLE__
    \n+
    26
    \n+
    27 /*
    \n+
    28 * macOS has pretty draconian restrictions on the
    \n+
    29 * alignments that you may ask for: It has to be
    \n+
    30 *
    \n+
    31 * 1) a power of 2
    \n+
    32 * 2) at least as large as sizeof(void*)
    \n+
    33 *
    \n+
    34 * So here is a little constexpr function that calculates just that
    \n+
    35 * (together with the correct starting value for align fed in further down).
    \n+
    36 */
    \n+
    37 static constexpr int fixAlignment(int align)
    \n+
    38 {
    \n+
    39 return ((Alignment==-1) ? std::alignment_of<T>::value : Alignment) > align
    \n+
    40 ? fixAlignment(align << 1) : align;
    \n+
    41 }
    \n
    42
    \n-
    52 template<typename C>
    \n-
    53 bool hasSuffix(const C& c, const char* suffix) {
    \n-
    54 std::size_t len = std::strlen(suffix);
    \n-
    55 if(c.size() < len) return false;
    \n-
    56 typename C::const_iterator it = c.begin();
    \n-
    57 std::advance(it, c.size() - len);
    \n-
    58 return std::equal(suffix, suffix+len, it);
    \n-
    59 }
    \n-
    60
    \n-
    72 template<class... T>
    \n-
    73 static std::string formatString(const std::string& s, const T&... args)
    \n-
    74 {
    \n-
    75 static const int bufferSize=1000;
    \n-
    76 char buffer[bufferSize];
    \n-
    77
    \n-
    78 // try to format with static buffer
    \n-
    79 int r = std::snprintf(buffer, bufferSize, s.c_str(), args...);
    \n-
    80
    \n-
    81 // negative return values correspond to errors
    \n-
    82 if (r<0)
    \n-
    83 DUNE_THROW(Dune::Exception,"Could not convert format string using given arguments.");
    \n-
    84
    \n-
    85 // if buffer was large enough return result as string
    \n-
    86 if (r<bufferSize)
    \n-
    87 return std::string(buffer);
    \n-
    88
    \n-
    89 // if buffer was to small allocate a larger buffer using
    \n-
    90 // the predicted size hint (+1 for the terminating 0-byte).
    \n-
    91 int dynamicBufferSize = r+1;
    \n-
    92
    \n-
    93 std::unique_ptr<char[]> dynamicBuffer;
    \n-
    94 try {
    \n-
    95 dynamicBuffer = std::make_unique<char[]>(dynamicBufferSize);
    \n-
    96 }
    \n-
    97 catch (const std::bad_alloc&) {
    \n-
    98 DUNE_THROW(Dune::Exception,"Could allocate large enough dynamic buffer in formatString.");
    \n-
    99 }
    \n-
    100
    \n-
    101 // convert and check for errors again
    \n-
    102 r = std::snprintf(dynamicBuffer.get(), dynamicBufferSize, s.c_str(), args...);
    \n-
    103 if (r<0)
    \n-
    104 DUNE_THROW(Dune::Exception,"Could not convert format string using given arguments.");
    \n-
    105
    \n-
    106 // the new buffer should always be large enough
    \n-
    107 assert(r<dynamicBufferSize);
    \n-
    108
    \n-
    109 return std::string(dynamicBuffer.get());
    \n-
    110 }
    \n-
    113}
    \n-
    114
    \n-
    115#endif // DUNE_COMMON_STRINGUTILITY_HH
    \n-
    A few common exception classes.
    \n-
    bool hasSuffix(const C &c, const char *suffix)
    Check whether a character container has a given suffix.
    Definition: stringutility.hh:53
    \n-
    static std::string formatString(const std::string &s, const T &... args)
    Format values according to printf format string.
    Definition: stringutility.hh:73
    \n-
    bool hasPrefix(const C &c, const char *prefix)
    Check whether a character container has a given prefix.
    Definition: stringutility.hh:37
    \n-
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    43#else
    \n+
    44
    \n+
    45 /*
    \n+
    46 * Non-Apple platforms we just have to check whether an explicit alignment was
    \n+
    47 * restricted or fall back to the default alignment of T.
    \n+
    48 */
    \n+
    49 static constexpr int fixAlignment(int align)
    \n+
    50 {
    \n+
    51 return (Alignment==-1) ? std::alignment_of<T>::value : Alignment;
    \n+
    52 }
    \n+
    53
    \n+
    54#endif
    \n+
    55
    \n+
    56 public:
    \n+\n+\n+
    59 template <class U> struct rebind {
    \n+\n+
    61 };
    \n+
    62
    \n+
    63 static constexpr int alignment = fixAlignment(sizeof(void*));
    \n+
    64
    \n+
    66 pointer allocate(size_type n, [[maybe_unused]] const void* hint = 0)
    \n+
    67 {
    \n+
    68 if (n > this->max_size())
    \n+
    69 throw std::bad_alloc();
    \n+
    70
    \n+
    71#if __APPLE__
    \n+
    72 // Apple is also restrictive regarding the allocation size.
    \n+
    73 // size must be at least the alignment size.
    \n+
    74 size_type size = n * sizeof(T) >= alignment ? n * sizeof(T) : alignment;
    \n+
    75#else
    \n+
    76 size_type size = n * sizeof(T);
    \n+
    77#endif
    \n+
    78
    \n+
    79 /*
    \n+
    80 * Everybody else gets the standard treatment.
    \n+
    81 */
    \n+
    82 pointer ret = static_cast<pointer>(std::aligned_alloc(alignment, size));
    \n+
    83 if (!ret)
    \n+
    84 throw std::bad_alloc();
    \n+
    85
    \n+
    86 return ret;
    \n+
    87 }
    \n+
    88 };
    \n+
    89
    \n+
    90}
    \n+
    91
    \n+
    92#endif // DUNE_ALIGNED_ALLOCATOR_HH
    \n+
    Allocators that use malloc/free.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    Base class for Dune-Exceptions.
    Definition: exceptions.hh:96
    \n+
    Allocators which guarantee alignment of the memory.
    Definition: alignedallocator.hh:23
    \n+
    typename MallocAllocator< T >::size_type size_type
    Definition: alignedallocator.hh:58
    \n+
    pointer allocate(size_type n, const void *hint=0)
    allocate n objects of type T
    Definition: alignedallocator.hh:66
    \n+
    typename MallocAllocator< T >::pointer pointer
    Definition: alignedallocator.hh:57
    \n+
    static constexpr int alignment
    Definition: alignedallocator.hh:63
    \n+
    Definition: alignedallocator.hh:59
    \n+
    AlignedAllocator< U, Alignment > other
    Definition: alignedallocator.hh:60
    \n+
    Allocators implementation which simply calls malloc/free.
    Definition: mallocallocator.hh:24
    \n+
    T * pointer
    Definition: mallocallocator.hh:28
    \n+
    std::size_t size_type
    Definition: mallocallocator.hh:26
    \n+
    size_type max_size() const noexcept
    max size for allocate
    Definition: mallocallocator.hh:74
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,119 +4,137 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-stringutility.hh\n+alignedallocator.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_STRINGUTILITY_HH\n- 6#define DUNE_COMMON_STRINGUTILITY_HH\n+ 5#ifndef DUNE_ALIGNED_ALLOCATOR_HH\n+ 6#define DUNE_ALIGNED_ALLOCATOR_HH\n 7\n- 12#include \n- 13#include \n- 14#include \n- 15#include \n- 16#include \n- 17#include \n- 18#include \n- 19#include \n- 20\n- 21#include \n- 22\n- 23\n- 24namespace Dune {\n- 25\n- 36 template\n-37 bool hasPrefix(const C& c, const char* prefix) {\n- 38 std::size_t len = std::strlen(prefix);\n- 39 return c.size() >= len &&\n- 40 std::equal(prefix, prefix+len, c.begin());\n+ 8#include \"mallocallocator.hh\"\n+ 9#include \n+ 10\n+ 11\n+12namespace Dune\n+ 13{\n+ 14\n+ 22 template\n+23 class AlignedAllocator : public MallocAllocator {\n+ 24\n+ 25#if __APPLE__\n+ 26\n+ 27 /*\n+ 28 * macOS has pretty draconian restrictions on the\n+ 29 * alignments that you may ask for: It has to be\n+ 30 *\n+ 31 * 1) a power of 2\n+ 32 * 2) at least as large as sizeof(void*)\n+ 33 *\n+ 34 * So here is a little constexpr function that calculates just that\n+ 35 * (together with the correct starting value for align fed in further down).\n+ 36 */\n+ 37 static constexpr int fixAlignment(int align)\n+ 38 {\n+ 39 return ((Alignment==-1) ? std::alignment_of::value : Alignment) > align\n+ 40 ? fixAlignment(align << 1) : align;\n 41 }\n 42\n- 52 template\n-53 bool hasSuffix(const C& c, const char* suffix) {\n- 54 std::size_t len = std::strlen(suffix);\n- 55 if(c.size() < len) return false;\n- 56 typename C::const_iterator it = c.begin();\n- 57 std::advance(it, c.size() - len);\n- 58 return std::equal(suffix, suffix+len, it);\n- 59 }\n- 60\n- 72 template\n-73 static std::string formatString(const std::string& s, const T&... args)\n- 74 {\n- 75 static const int bufferSize=1000;\n- 76 char buffer[bufferSize];\n- 77\n- 78 // try to format with static buffer\n- 79 int r = std::snprintf(buffer, bufferSize, s.c_str(), args...);\n- 80\n- 81 // negative return values correspond to errors\n- 82 if (r<0)\n- 83 DUNE_THROW(Dune::Exception,\"Could not convert format string using given\n-arguments.\");\n- 84\n- 85 // if buffer was large enough return result as string\n- 86 if (r dynamicBuffer;\n- 94 try {\n- 95 dynamicBuffer = std::make_unique(dynamicBufferSize);\n- 96 }\n- 97 catch (const std::bad_alloc&) {\n- 98 DUNE_THROW(Dune::Exception,\"Could allocate large enough dynamic buffer in\n-formatString.\");\n- 99 }\n- 100\n- 101 // convert and check for errors again\n- 102 r = std::snprintf(dynamicBuffer.get(), dynamicBufferSize, s.c_str(),\n-args...);\n- 103 if (r<0)\n- 104 DUNE_THROW(Dune::Exception,\"Could not convert format string using given\n-arguments.\");\n- 105\n- 106 // the new buffer should always be large enough\n- 107 assert(r::value : Alignment;\n+ 52 }\n+ 53\n+ 54#endif\n+ 55\n+ 56 public:\n+57 using pointer = typename MallocAllocator::pointer;\n+58 using size_type = typename MallocAllocator::size_type;\n+59 template struct rebind {\n+60 typedef AlignedAllocator other;\n+ 61 };\n+ 62\n+63 static constexpr int alignment = fixAlignment(sizeof(void*));\n+ 64\n+66 pointer allocate(size_type n, [[maybe_unused]] const void* hint = 0)\n+ 67 {\n+ 68 if (n > this->max_size())\n+ 69 throw std::bad_alloc();\n+ 70\n+ 71#if __APPLE__\n+ 72 // Apple is also restrictive regarding the allocation size.\n+ 73 // size must be at least the alignment size.\n+ 74 size_type size = n * sizeof(T) >= alignment ? n * sizeof(T) : alignment;\n+ 75#else\n+ 76 size_type size = n * sizeof(T);\n+ 77#endif\n+ 78\n+ 79 /*\n+ 80 * Everybody else gets the standard treatment.\n+ 81 */\n+ 82 pointer ret = static_cast(std::aligned_alloc(alignment, size));\n+ 83 if (!ret)\n+ 84 throw std::bad_alloc();\n+ 85\n+ 86 return ret;\n+ 87 }\n+ 88 };\n+ 89\n+ 90}\n+ 91\n+ 92#endif // DUNE_ALIGNED_ALLOCATOR_HH\n+mallocallocator.hh\n+Allocators that use malloc/free.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::Exception\n-Base class for Dune-Exceptions.\n-Definition: exceptions.hh:96\n+Dune::AlignedAllocator\n+Allocators which guarantee alignment of the memory.\n+Definition: alignedallocator.hh:23\n+Dune::AlignedAllocator::size_type\n+typename MallocAllocator< T >::size_type size_type\n+Definition: alignedallocator.hh:58\n+Dune::AlignedAllocator::allocate\n+pointer allocate(size_type n, const void *hint=0)\n+allocate n objects of type T\n+Definition: alignedallocator.hh:66\n+Dune::AlignedAllocator::pointer\n+typename MallocAllocator< T >::pointer pointer\n+Definition: alignedallocator.hh:57\n+Dune::AlignedAllocator::alignment\n+static constexpr int alignment\n+Definition: alignedallocator.hh:63\n+Dune::AlignedAllocator::rebind\n+Definition: alignedallocator.hh:59\n+Dune::AlignedAllocator::rebind::other\n+AlignedAllocator< U, Alignment > other\n+Definition: alignedallocator.hh:60\n+Dune::MallocAllocator\n+Allocators implementation which simply calls malloc/free.\n+Definition: mallocallocator.hh:24\n+Dune::MallocAllocator::pointer\n+T * pointer\n+Definition: mallocallocator.hh:28\n+Dune::MallocAllocator::size_type\n+std::size_t size_type\n+Definition: mallocallocator.hh:26\n+Dune::MallocAllocator::max_size\n+size_type max_size() const noexcept\n+max size for allocate\n+Definition: mallocallocator.hh:74\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00095.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00095.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: to_unique_ptr.hh File Reference\n+dune-common: debugstream.hh File Reference\n \n \n \n \n \n \n \n@@ -63,44 +63,64 @@\n
    \n \n
    \n \n
    \n \n-
    to_unique_ptr.hh File Reference
    \n+Typedefs
    \n+
    debugstream.hh File Reference
    \n \n
    \n-
    #include <memory>
    \n+\n+

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

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

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+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...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n \n-\n-\n-\n-\n-

    \n Typedefs

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

    \n-Functions

    template<class T , class... Args>
    std::unique_ptr< T > Dune::makeToUnique (Args &&... args)
     Alias for std::make_unique introduced as transition wrapper. More...
     
    typedef unsigned int Dune::DebugLevel
     Type for debug levels. More...
     
    \n-
    \n+

    Detailed Description

    \n+

    Defines several output streams for messages of different importance.

    \n+

    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

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,29 +4,49 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Namespaces | Typedefs | Functions\n-to_unique_ptr.hh File Reference\n-#include \n+Classes | Namespaces | Typedefs\n+debugstream.hh File Reference\n+Common \u00bb Debug_output\n+Defines several output streams for messages of different importance. More...\n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::greater_or_equal<_current,_threshold_>\n+\u00a0 Greater or equal template test. More...\n+\u00a0\n+struct \u00a0Dune::common_bits<_current,_mask_>\n+\u00a0 activate if current and mask have common bits switched on. More...\n+\u00a0\n+ class \u00a0Dune::DebugStreamError\n+\u00a0 standard exception for the debugstream More...\n+\u00a0\n+ class \u00a0Dune::StreamWrap\n+\u00a0\n+ class \u00a0Dune::DebugStreamState\n+\u00a0 Intermediate class to implement tie-operation of DebugStream. More...\n+\u00a0\n+ class \u00a0Dune::DebugStream<_thislevel,_dlevel,_alevel,_activator_>\n+\u00a0 Generic class to implement debug output streams. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n Typedefs\n-template\n-using\u00a0Dune::ToUniquePtr = std::unique_ptr< T >\n-\u00a0 Alias for std::unique_ptr introduced as transition wrapper. More...\n-\u00a0\n- Functions\n-template\n-std::unique_ptr< T >\u00a0Dune::makeToUnique (Args &&... args)\n-\u00a0 Alias for std::make_unique introduced as transition\n- wrapper. More...\n+typedef unsigned int\u00a0Dune::DebugLevel\n+\u00a0 Type for debug levels. More...\n \u00a0\n+***** Detailed Description *****\n+Defines several output streams for messages of different importance.\n+This file implements the class DebugStream to support output in a variety of\n+debug levels. Additionally, template parameters control if the output operation\n+is really performed so that unused debug levels can be deactivated\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00095_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: to_unique_ptr.hh Source File\n+dune-common: debugstream.hh Source File\n \n \n \n \n \n \n \n@@ -62,46 +62,296 @@\n \n
    \n \n
    \n \n
    \n-
    to_unique_ptr.hh
    \n+
    debugstream.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n
    5
    \n-
    6#ifndef DUNE_TO_UNIQUE_PTR_HH
    \n-
    7#define DUNE_TO_UNIQUE_PTR_HH
    \n+
    6#ifndef DUNE_DEBUGSTREAM_HH
    \n+
    7#define DUNE_DEBUGSTREAM_HH
    \n
    8
    \n-
    9#warning to_unique_ptr.hh and ToUniquePtr are deprecated. Use std::unique_ptr or std::shared_ptr instead.
    \n-
    10
    \n-
    11#include <memory>
    \n-
    12
    \n-
    13namespace Dune
    \n-
    14{
    \n-
    17 template <class T>
    \n-
    18 using ToUniquePtr [[deprecated]] = std::unique_ptr<T>;
    \n+
    13#include <iostream>
    \n+
    14#include <stack>
    \n+
    15
    \n+\n+
    17
    \n+
    18namespace Dune {
    \n
    19
    \n-
    22 template <class T, class... Args>
    \n-
    23 [[deprecated]] std::unique_ptr<T> makeToUnique (Args&&... args)
    \n-
    24 {
    \n-
    25 return std::make_unique(std::forward<Args>(args)...);
    \n-
    26 }
    \n-
    27
    \n-
    28} // end namespace Dune
    \n-
    29
    \n-
    30#endif // DUNE_TO_UNIQUE_PTR_HH
    \n+
    118 typedef unsigned int DebugLevel;
    \n+
    119
    \n+
    129 template <DebugLevel current, DebugLevel threshold>
    \n+\n+
    131 constexpr static bool value = (current >= threshold);
    \n+
    132 };
    \n+
    133
    \n+
    134
    \n+
    141 template <DebugLevel current, DebugLevel mask>
    \n+
    142 struct common_bits {
    \n+
    143 constexpr static bool value = ((current & mask) != 0);
    \n+
    144 };
    \n+
    145
    \n+
    146
    \n+
    148 class DebugStreamError : public IOError {};
    \n+
    149
    \n+\n+
    151 public:
    \n+
    152 StreamWrap(std::ostream& _out) : out(_out) { }
    \n+
    153 std::ostream& out;
    \n+\n+
    155 };
    \n+
    156
    \n+\n+
    159 // !!! should be protected somehow but that won't be easy
    \n+
    160 public:
    \n+\n+
    163
    \n+\n+
    166
    \n+
    168 bool _tied;
    \n+
    169
    \n+
    171 unsigned int _tied_streams;
    \n+
    172 };
    \n+
    173
    \n+
    188 template <DebugLevel thislevel = 1,
    \n+
    189 DebugLevel dlevel = 1,
    \n+
    190 DebugLevel alevel = 1,
    \n+
    191 template<DebugLevel, DebugLevel> class activator = greater_or_equal>
    \n+\n+
    193 public:
    \n+
    199 DebugStream(std::ostream& out = std::cerr) {
    \n+
    200 // start a new list of streams
    \n+
    201 current = new StreamWrap(out);
    \n+
    202 current->next = 0;
    \n+
    203
    \n+
    204 // check if we are above the default activation level
    \n+
    205 _active = activator<thislevel,alevel>::value;
    \n+
    206
    \n+
    207 // we're not tied to another DebugStream
    \n+
    208 _tied = false;
    \n+
    209
    \n+
    210 // no child streams yet
    \n+
    211 _tied_streams = 0;
    \n+
    212 }
    \n+
    213
    \n+\n+
    220 std::ostream& fallback = std::cerr)
    \n+
    221 {
    \n+
    222 // start a new list of streams
    \n+
    223 current = new StreamWrap(fallback);
    \n+
    224 current->next = 0;
    \n+
    225
    \n+
    226 // check if we are above the default activation level
    \n+
    227 _active = activator<thislevel,alevel>::value;
    \n+
    228 _tied_streams = 0;
    \n+
    229
    \n+
    230 // tie to the provided stream
    \n+
    231 _tied = true;
    \n+
    232 tiedstate = &master;
    \n+
    233 tiedstate->_tied_streams++;
    \n+
    234 }
    \n+
    235
    \n+\n+
    244 {
    \n+
    245 // untie
    \n+
    246 if (_tied)
    \n+
    247 tiedstate->_tied_streams--;
    \n+
    248 else {
    \n+
    249 // check if somebody still ties to us...
    \n+
    250 if (_tied_streams != 0)
    \n+
    251 {
    \n+
    252 std::cerr << "DebugStream destructor is called while other streams are still tied to it. Terminating!" << std::endl;
    \n+
    253 std::terminate();
    \n+
    254 }
    \n+
    255 }
    \n+
    256
    \n+
    257 // remove ostream-stack
    \n+
    258 while (current != 0) {
    \n+
    259 StreamWrap *s = current;
    \n+\n+
    261 delete s;
    \n+
    262 }
    \n+
    263 }
    \n+
    264
    \n+
    266 template <class T>
    \n+
    267 DebugStream& operator<<(const T data) {
    \n+
    268 // remove the following code if stream wasn't compiled active
    \n+
    269 if (activator<thislevel, dlevel>::value) {
    \n+
    270 if (! _tied) {
    \n+
    271 if (_active)
    \n+
    272 current->out << data;
    \n+
    273 } else {
    \n+
    274 if (_active && tiedstate->_active)
    \n+
    275 tiedstate->current->out << data;
    \n+
    276 }
    \n+
    277 }
    \n+
    278
    \n+
    279 return *this;
    \n+
    280 }
    \n+
    281
    \n+
    289 DebugStream& operator<<(const int data) {
    \n+
    290 // remove the following code if stream wasn't compiled active
    \n+
    291 if (activator<thislevel, dlevel>::value) {
    \n+
    292 if (! _tied) {
    \n+
    293 if (_active)
    \n+
    294 current->out << data;
    \n+
    295 } else {
    \n+
    296 if (_active && tiedstate->_active)
    \n+
    297 tiedstate->current->out << data;
    \n+
    298 }
    \n+
    299 }
    \n+
    300
    \n+
    301 return *this;
    \n+
    302 }
    \n+
    303
    \n+
    305 DebugStream& operator<<(std::ostream& (*f)(std::ostream&)) {
    \n+
    306 if (activator<thislevel, dlevel>::value) {
    \n+
    307 if (! _tied) {
    \n+
    308 if (_active)
    \n+
    309 f(current->out);
    \n+
    310 } else {
    \n+
    311 if (_active && tiedstate->_active)
    \n+
    312 f(tiedstate->current->out);
    \n+
    313 }
    \n+
    314 }
    \n+
    315
    \n+
    316 return *this;
    \n+
    317 }
    \n+
    318
    \n+\n+
    321 if (activator<thislevel, dlevel>::value) {
    \n+
    322 if (! _tied) {
    \n+
    323 if (_active)
    \n+
    324 current->out.flush();
    \n+
    325 } else {
    \n+
    326 if (_active && tiedstate->_active)
    \n+
    327 tiedstate->current->out.flush();
    \n+
    328 }
    \n+
    329 }
    \n+
    330
    \n+
    331 return *this;
    \n+
    332 }
    \n+
    333
    \n+
    335 void push(bool b) {
    \n+
    336 // are we at all active?
    \n+
    337 if (activator<thislevel,alevel>::value) {
    \n+
    338 _actstack.push(_active);
    \n+
    339 _active = b;
    \n+
    340 } else {
    \n+
    341 // stay off
    \n+
    342 _actstack.push(false);
    \n+
    343 }
    \n+
    344 }
    \n+
    345
    \n+
    349 void pop() {
    \n+
    350 if (_actstack.empty())
    \n+
    351 DUNE_THROW(DebugStreamError, "No previous activation setting!");
    \n+
    352
    \n+
    353 _active = _actstack.top();
    \n+
    354 _actstack.pop();
    \n+
    355 }
    \n+
    356
    \n+
    363 bool active() const {
    \n+
    364 return activator<thislevel, dlevel>::value && _active;
    \n+
    365 }
    \n+
    366
    \n+
    371 void attach(std::ostream& stream) {
    \n+
    372 if (_tied)
    \n+
    373 DUNE_THROW(DebugStreamError, "Cannot attach to a tied stream!");
    \n+
    374
    \n+
    375 StreamWrap* newcurr = new StreamWrap(stream);
    \n+
    376 newcurr->next = current;
    \n+
    377 current = newcurr;
    \n+
    378 }
    \n+
    379
    \n+
    383 void detach() {
    \n+
    384 if (current->next == 0)
    \n+
    385 DUNE_THROW(DebugStreamError, "Cannot detach initial stream!");
    \n+
    386 if (_tied)
    \n+
    387 DUNE_THROW(DebugStreamError, "Cannot detach a tied stream!");
    \n+
    388
    \n+
    389 StreamWrap* old = current;
    \n+\n+
    391 delete old;
    \n+
    392 }
    \n+
    393
    \n+\n+
    398 if (to._tied)
    \n+
    399 DUNE_THROW(DebugStreamError, "Cannot tie to an already tied stream!");
    \n+
    400 if (_tied)
    \n+
    401 DUNE_THROW(DebugStreamError, "Stream already tied: untie first!");
    \n+
    402
    \n+
    403 _tied = true;
    \n+
    404 tiedstate = &to;
    \n+
    405
    \n+
    406 // tell master class
    \n+
    407 tiedstate->_tied_streams++;
    \n+
    408 }
    \n+
    409
    \n+
    413 void untie() {
    \n+
    414 if(! _tied)
    \n+
    415 DUNE_THROW(DebugStreamError, "Cannot untie, stream is not tied!");
    \n+
    416
    \n+
    417 tiedstate->_tied_streams--;
    \n+
    418 _tied = false;
    \n+
    419 tiedstate = 0;
    \n+
    420 }
    \n+
    421
    \n+
    422 private:
    \n+
    424 DebugStreamState* tiedstate;
    \n+
    425
    \n+
    430 std::stack<bool> _actstack;
    \n+
    431 };
    \n+
    432
    \n+
    434}
    \n+
    435
    \n+
    436
    \n+
    437#endif
    \n+
    A few common exception classes.
    \n+
    StreamWrap(std::ostream &_out)
    Definition: debugstream.hh:152
    \n+
    DebugStream(std::ostream &out=std::cerr)
    Create a DebugStream and set initial output stream.
    Definition: debugstream.hh:199
    \n+
    void untie()
    Untie stream.
    Definition: debugstream.hh:413
    \n+
    DebugStream & flush()
    pass on flush to underlying output stream
    Definition: debugstream.hh:320
    \n+
    void attach(std::ostream &stream)
    set output to a different stream.
    Definition: debugstream.hh:371
    \n+
    void detach()
    detach current output stream and restore to previous stream
    Definition: debugstream.hh:383
    \n+
    static constexpr bool value
    Definition: debugstream.hh:143
    \n+
    std::ostream & out
    Definition: debugstream.hh:153
    \n+
    void pop()
    restore previously set activation flag
    Definition: debugstream.hh:349
    \n+
    bool active() const
    reports if this stream will produce output
    Definition: debugstream.hh:363
    \n+
    bool _active
    flag to switch output during runtime
    Definition: debugstream.hh:165
    \n+
    unsigned int _tied_streams
    how many streams are tied to this state
    Definition: debugstream.hh:171
    \n+
    void tie(DebugStreamState &to)
    Tie a stream to this one.
    Definition: debugstream.hh:397
    \n+
    void push(bool b)
    set activation flag and store old value
    Definition: debugstream.hh:335
    \n+
    unsigned int DebugLevel
    Type for debug levels.
    Definition: debugstream.hh:118
    \n+
    bool _tied
    are we tied to another DebugStream?
    Definition: debugstream.hh:168
    \n+
    StreamWrap * current
    current output stream and link to possibly pushed old output streams
    Definition: debugstream.hh:162
    \n+
    DebugStream & operator<<(const T data)
    Generic types are passed on to current output stream.
    Definition: debugstream.hh:267
    \n+
    static constexpr bool value
    Definition: debugstream.hh:131
    \n+
    ~DebugStream()
    Destroy stream.
    Definition: debugstream.hh:243
    \n+
    DebugStream(DebugStreamState &master, std::ostream &fallback=std::cerr)
    Create a DebugStream and directly tie to another DebugStream.
    Definition: debugstream.hh:219
    \n+
    DebugStream & operator<<(const int data)
    explicit specialization so that enums can be printed
    Definition: debugstream.hh:289
    \n+
    DebugStream & operator<<(std::ostream &(*f)(std::ostream &))
    pass on manipulators to underlying output stream
    Definition: debugstream.hh:305
    \n+
    StreamWrap * next
    Definition: debugstream.hh:154
    \n+
    #define DUNE_THROW(E, m)
    Definition: exceptions.hh:218
    \n+
    Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
    implements Simd::mask()
    Definition: defaults.hh:153
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    std::unique_ptr< T > makeToUnique(Args &&... args)
    Alias for std::make_unique introduced as transition wrapper.
    Definition: to_unique_ptr.hh:23
    \n-
    std::unique_ptr< T > ToUniquePtr
    Alias for std::unique_ptr introduced as transition wrapper.
    Definition: to_unique_ptr.hh:18
    \n+
    Greater or equal template test.
    Definition: debugstream.hh:130
    \n+
    activate if current and mask have common bits switched on.
    Definition: debugstream.hh:142
    \n+
    standard exception for the debugstream
    Definition: debugstream.hh:148
    \n+
    Definition: debugstream.hh:150
    \n+
    Intermediate class to implement tie-operation of DebugStream.
    Definition: debugstream.hh:158
    \n+
    Generic class to implement debug output streams.
    Definition: debugstream.hh:192
    \n+
    Default exception class for I/O errors.
    Definition: exceptions.hh:231
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,51 +4,381 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-to_unique_ptr.hh\n+debugstream.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n 5\n- 6#ifndef DUNE_TO_UNIQUE_PTR_HH\n- 7#define DUNE_TO_UNIQUE_PTR_HH\n+ 6#ifndef DUNE_DEBUGSTREAM_HH\n+ 7#define DUNE_DEBUGSTREAM_HH\n 8\n- 9#warning to_unique_ptr.hh and ToUniquePtr are deprecated. Use std::unique_ptr\n-or std::shared_ptr instead.\n- 10\n- 11#include \n- 12\n- 13namespace Dune\n- 14{\n- 17 template \n-18 using ToUniquePtr [[deprecated]] = std::unique_ptr;\n+ 13#include \n+ 14#include \n+ 15\n+ 16#include \n+ 17\n+ 18namespace Dune {\n 19\n- 22 template \n-23 [[deprecated]] std::unique_ptr makeToUnique (Args&&... args)\n- 24 {\n- 25 return std::make_unique(std::forward(args)...);\n- 26 }\n- 27\n- 28} // end namespace Dune\n- 29\n- 30#endif // DUNE_TO_UNIQUE_PTR_HH\n+118 typedef unsigned int DebugLevel;\n+ 119\n+ 129 template \n+130 struct greater_or_equal {\n+131 constexpr static bool value = (current >= threshold);\n+ 132 };\n+ 133\n+ 134\n+ 141 template \n+142 struct common_bits {\n+143 constexpr static bool value = ((current & mask) != 0);\n+ 144 };\n+ 145\n+ 146\n+148 class DebugStreamError : public IOError {};\n+ 149\n+150 class StreamWrap {\n+ 151 public:\n+152 StreamWrap(std::ostream& _out) : out(_out) { }\n+153 std::ostream& out;\n+154 StreamWrap *next;\n+ 155 };\n+ 156\n+158 class DebugStreamState {\n+ 159 // !!! should be protected somehow but that won't be easy\n+ 160 public:\n+162 StreamWrap* current;\n+ 163\n+165 bool _active;\n+ 166\n+168 bool _tied;\n+ 169\n+171 unsigned int _tied_streams;\n+ 172 };\n+ 173\n+ 188 template class activator = greater_or_equal>\n+192 class DebugStream : public DebugStreamState {\n+ 193 public:\n+199 DebugStream(std::ostream& out = std::cerr) {\n+ 200 // start a new list of streams\n+ 201 current = new StreamWrap(out);\n+ 202 current->next = 0;\n+ 203\n+ 204 // check if we are above the default activation level\n+ 205 _active = activator::value;\n+ 206\n+ 207 // we're not tied to another DebugStream\n+ 208 _tied = false;\n+ 209\n+ 210 // no child streams yet\n+ 211 _tied_streams = 0;\n+ 212 }\n+ 213\n+219 DebugStream (DebugStreamState& master,\n+ 220 std::ostream& fallback = std::cerr)\n+ 221 {\n+ 222 // start a new list of streams\n+ 223 current = new StreamWrap(fallback);\n+ 224 current->next = 0;\n+ 225\n+ 226 // check if we are above the default activation level\n+ 227 _active = activator::value;\n+ 228 _tied_streams = 0;\n+ 229\n+ 230 // tie to the provided stream\n+ 231 _tied = true;\n+ 232 tiedstate = &master;\n+ 233 tiedstate->_tied_streams++;\n+ 234 }\n+ 235\n+243 ~DebugStream()\n+ 244 {\n+ 245 // untie\n+ 246 if (_tied)\n+ 247 tiedstate->_tied_streams--;\n+ 248 else {\n+ 249 // check if somebody still ties to us...\n+ 250 if (_tied_streams != 0)\n+ 251 {\n+ 252 std::cerr << \"DebugStream destructor is called while other streams are\n+still tied to it. Terminating!\" << std::endl;\n+ 253 std::terminate();\n+ 254 }\n+ 255 }\n+ 256\n+ 257 // remove ostream-stack\n+ 258 while (current != 0) {\n+ 259 StreamWrap *s = current;\n+ 260 current = current->next;\n+ 261 delete s;\n+ 262 }\n+ 263 }\n+ 264\n+ 266 template \n+267 DebugStream& operator<<(const T data) {\n+ 268 // remove the following code if stream wasn't compiled active\n+ 269 if (activator::value) {\n+ 270 if (! _tied) {\n+ 271 if (_active)\n+ 272 current->out << data;\n+ 273 } else {\n+ 274 if (_active && tiedstate->_active)\n+ 275 tiedstate->current->out << data;\n+ 276 }\n+ 277 }\n+ 278\n+ 279 return *this;\n+ 280 }\n+ 281\n+289 DebugStream& operator<<(const int data) {\n+ 290 // remove the following code if stream wasn't compiled active\n+ 291 if (activator::value) {\n+ 292 if (! _tied) {\n+ 293 if (_active)\n+ 294 current->out << data;\n+ 295 } else {\n+ 296 if (_active && tiedstate->_active)\n+ 297 tiedstate->current->out << data;\n+ 298 }\n+ 299 }\n+ 300\n+ 301 return *this;\n+ 302 }\n+ 303\n+305 DebugStream& operator<<(std::ostream& (*f)(std::ostream&)) {\n+ 306 if (activator::value) {\n+ 307 if (! _tied) {\n+ 308 if (_active)\n+ 309 f(current->out);\n+ 310 } else {\n+ 311 if (_active && tiedstate->_active)\n+ 312 f(tiedstate->current->out);\n+ 313 }\n+ 314 }\n+ 315\n+ 316 return *this;\n+ 317 }\n+ 318\n+320 DebugStream& flush() {\n+ 321 if (activator::value) {\n+ 322 if (! _tied) {\n+ 323 if (_active)\n+ 324 current->out.flush();\n+ 325 } else {\n+ 326 if (_active && tiedstate->_active)\n+ 327 tiedstate->current->out.flush();\n+ 328 }\n+ 329 }\n+ 330\n+ 331 return *this;\n+ 332 }\n+ 333\n+335 void push(bool b) {\n+ 336 // are we at all active?\n+ 337 if (activator::value) {\n+ 338 _actstack.push(_active);\n+ 339 _active = b;\n+ 340 } else {\n+ 341 // stay off\n+ 342 _actstack.push(false);\n+ 343 }\n+ 344 }\n+ 345\n+349 void pop() {\n+ 350 if (_actstack.empty())\n+ 351 DUNE_THROW(DebugStreamError, \"No previous activation setting!\");\n+ 352\n+ 353 _active = _actstack.top();\n+ 354 _actstack.pop();\n+ 355 }\n+ 356\n+363 bool active() const {\n+ 364 return activator::value && _active;\n+ 365 }\n+ 366\n+371 void attach(std::ostream& stream) {\n+ 372 if (_tied)\n+ 373 DUNE_THROW(DebugStreamError, \"Cannot attach to a tied stream!\");\n+ 374\n+ 375 StreamWrap* newcurr = new StreamWrap(stream);\n+ 376 newcurr->next = current;\n+ 377 current = newcurr;\n+ 378 }\n+ 379\n+383 void detach() {\n+ 384 if (current->next == 0)\n+ 385 DUNE_THROW(DebugStreamError, \"Cannot detach initial stream!\");\n+ 386 if (_tied)\n+ 387 DUNE_THROW(DebugStreamError, \"Cannot detach a tied stream!\");\n+ 388\n+ 389 StreamWrap* old = current;\n+ 390 current = current->next;\n+ 391 delete old;\n+ 392 }\n+ 393\n+397 void tie(DebugStreamState& to) {\n+ 398 if (to._tied)\n+ 399 DUNE_THROW(DebugStreamError, \"Cannot tie to an already tied stream!\");\n+ 400 if (_tied)\n+ 401 DUNE_THROW(DebugStreamError, \"Stream already tied: untie first!\");\n+ 402\n+ 403 _tied = true;\n+ 404 tiedstate = &to;\n+ 405\n+ 406 // tell master class\n+ 407 tiedstate->_tied_streams++;\n+ 408 }\n+ 409\n+413 void untie() {\n+ 414 if(! _tied)\n+ 415 DUNE_THROW(DebugStreamError, \"Cannot untie, stream is not tied!\");\n+ 416\n+ 417 tiedstate->_tied_streams--;\n+ 418 _tied = false;\n+ 419 tiedstate = 0;\n+ 420 }\n+ 421\n+ 422 private:\n+ 424 DebugStreamState* tiedstate;\n+ 425\n+ 430 std::stack _actstack;\n+ 431 };\n+ 432\n+ 434}\n+ 435\n+ 436\n+ 437#endif\n+exceptions.hh\n+A few common exception classes.\n+Dune::StreamWrap::StreamWrap\n+StreamWrap(std::ostream &_out)\n+Definition: debugstream.hh:152\n+Dune::DebugStream::DebugStream\n+DebugStream(std::ostream &out=std::cerr)\n+Create a DebugStream and set initial output stream.\n+Definition: debugstream.hh:199\n+Dune::DebugStream::untie\n+void untie()\n+Untie stream.\n+Definition: debugstream.hh:413\n+Dune::DebugStream::flush\n+DebugStream & flush()\n+pass on flush to underlying output stream\n+Definition: debugstream.hh:320\n+Dune::DebugStream::attach\n+void attach(std::ostream &stream)\n+set output to a different stream.\n+Definition: debugstream.hh:371\n+Dune::DebugStream::detach\n+void detach()\n+detach current output stream and restore to previous stream\n+Definition: debugstream.hh:383\n+Dune::common_bits::value\n+static constexpr bool value\n+Definition: debugstream.hh:143\n+Dune::StreamWrap::out\n+std::ostream & out\n+Definition: debugstream.hh:153\n+Dune::DebugStream::pop\n+void pop()\n+restore previously set activation flag\n+Definition: debugstream.hh:349\n+Dune::DebugStream::active\n+bool active() const\n+reports if this stream will produce output\n+Definition: debugstream.hh:363\n+Dune::DebugStreamState::_active\n+bool _active\n+flag to switch output during runtime\n+Definition: debugstream.hh:165\n+Dune::DebugStreamState::_tied_streams\n+unsigned int _tied_streams\n+how many streams are tied to this state\n+Definition: debugstream.hh:171\n+Dune::DebugStream::tie\n+void tie(DebugStreamState &to)\n+Tie a stream to this one.\n+Definition: debugstream.hh:397\n+Dune::DebugStream::push\n+void push(bool b)\n+set activation flag and store old value\n+Definition: debugstream.hh:335\n+Dune::DebugLevel\n+unsigned int DebugLevel\n+Type for debug levels.\n+Definition: debugstream.hh:118\n+Dune::DebugStreamState::_tied\n+bool _tied\n+are we tied to another DebugStream?\n+Definition: debugstream.hh:168\n+Dune::DebugStreamState::current\n+StreamWrap * current\n+current output stream and link to possibly pushed old output streams\n+Definition: debugstream.hh:162\n+Dune::DebugStream::operator<<\n+DebugStream & operator<<(const T data)\n+Generic types are passed on to current output stream.\n+Definition: debugstream.hh:267\n+Dune::greater_or_equal::value\n+static constexpr bool value\n+Definition: debugstream.hh:131\n+Dune::DebugStream::~DebugStream\n+~DebugStream()\n+Destroy stream.\n+Definition: debugstream.hh:243\n+Dune::DebugStream::DebugStream\n+DebugStream(DebugStreamState &master, std::ostream &fallback=std::cerr)\n+Create a DebugStream and directly tie to another DebugStream.\n+Definition: debugstream.hh:219\n+Dune::DebugStream::operator<<\n+DebugStream & operator<<(const int data)\n+explicit specialization so that enums can be printed\n+Definition: debugstream.hh:289\n+Dune::DebugStream::operator<<\n+DebugStream & operator<<(std::ostream &(*f)(std::ostream &))\n+pass on manipulators to underlying output stream\n+Definition: debugstream.hh:305\n+Dune::StreamWrap::next\n+StreamWrap * next\n+Definition: debugstream.hh:154\n+DUNE_THROW\n+#define DUNE_THROW(E, m)\n+Definition: exceptions.hh:218\n+Dune::Simd::Overloads::mask\n+Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)\n+implements Simd::mask()\n+Definition: defaults.hh:153\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::makeToUnique\n-std::unique_ptr< T > makeToUnique(Args &&... args)\n-Alias for std::make_unique introduced as transition wrapper.\n-Definition: to_unique_ptr.hh:23\n-Dune::ToUniquePtr\n-std::unique_ptr< T > ToUniquePtr\n-Alias for std::unique_ptr introduced as transition wrapper.\n-Definition: to_unique_ptr.hh:18\n+Dune::greater_or_equal\n+Greater or equal template test.\n+Definition: debugstream.hh:130\n+Dune::common_bits\n+activate if current and mask have common bits switched on.\n+Definition: debugstream.hh:142\n+Dune::DebugStreamError\n+standard exception for the debugstream\n+Definition: debugstream.hh:148\n+Dune::StreamWrap\n+Definition: debugstream.hh:150\n+Dune::DebugStreamState\n+Intermediate class to implement tie-operation of DebugStream.\n+Definition: debugstream.hh:158\n+Dune::DebugStream\n+Generic class to implement debug output streams.\n+Definition: debugstream.hh:192\n+Dune::IOError\n+Default exception class for I/O errors.\n+Definition: exceptions.hh:231\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00098.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00098.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: shared_ptr.hh File Reference\n+dune-common: ios_state.cc File Reference\n \n \n \n \n \n \n \n@@ -63,58 +63,26 @@\n
    \n \n
    \n \n
    \n \n-
    shared_ptr.hh File Reference
    \n+Namespaces
    \n+
    ios_state.cc File Reference
    \n \n
    \n-\n-

    This file implements several utilities related to std::shared_ptr. \n-More...

    \n-
    #include <memory>
    \n-#include <dune/common/typetraits.hh>
    \n-
    \n-

    Go to the source code of this file.

    \n-\n-\n-\n-\n-\n-

    \n-Classes

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

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n

    \n-Functions

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

    Detailed Description

    \n-

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

    \n-
    Author
    Markus Blatt
    \n-
    \n+\n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,42 +4,17 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces | Functions\n-shared_ptr.hh File Reference\n-This file implements several utilities related to std::shared_ptr. More...\n-#include \n-#include \n-Go_to_the_source_code_of_this_file.\n- Classes\n-struct \u00a0Dune::null_deleter<_T_>\n-\u00a0 implements the Deleter concept of shared_ptr without deleting anything\n- More...\n-\u00a0\n+Namespaces\n+ios_state.cc File Reference\n+#include \n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n- Functions\n-template\n-std::shared_ptr< T >\u00a0Dune::stackobject_to_shared_ptr (T &t)\n-\u00a0 Create a shared_ptr for a stack-allocated object. More...\n-\u00a0\n-template\n- auto\u00a0Dune::wrap_or_move (T &&t)\n-\u00a0 Capture R-value reference to shared_ptr. More...\n-\u00a0\n-template\n- auto\u00a0Dune::wrap_or_move (T &t)\n-\u00a0 Capture L-value reference to std::shared_ptr. More...\n-\u00a0\n-***** Detailed Description *****\n-This file implements several utilities related to std::shared_ptr.\n- Author\n- Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00101.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00101.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: deprecated.hh File Reference\n+dune-common: concept.hh File Reference\n \n \n \n \n \n \n \n@@ -63,35 +63,90 @@\n
    \n \n
    \n \n
    \n
    \n-Macros
    \n-
    deprecated.hh File Reference
    \n+Classes |\n+Namespaces |\n+Functions
    \n+
    concept.hh File Reference
    \n \n
    \n \n-

    Definition of the DUNE_NO_DEPRECATED_* macros. \n+

    Infrastructure for concepts. \n More...

    \n-\n+
    #include <type_traits>
    \n+#include <utility>
    \n+#include <tuple>
    \n+#include <dune/common/typeutilities.hh>
    \n+#include <dune/common/typelist.hh>
    \n+#include <dune/common/tupleutility.hh>
    \n+#include <dune/common/std/type_traits.hh>
    \n+
    \n

    Go to the source code of this file.

    \n \n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n+\n+

    \n-Macros

    #define DUNE_NO_DEPRECATED_BEGIN   ...
     Ignore deprecation warnings (start) More...
     
    #define DUNE_NO_DEPRECATED_END   ...
     Ignore deprecation warnings (end) More...
     

    \n+Classes

    struct  Dune::Concept::Refines< BaseConcepts >
     Base class for refined concepts. More...
     
    \n+\n+\n+\n+\n+\n+\n+\n+

    \n+Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Concept
     Namespace for concepts.
     
    \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n+Functions

    template<class C , class... T>
    constexpr auto Dune::models ()
     Check if concept is modeled by given types. More...
     
    template<class C , class Tuple >
    constexpr auto Dune::Concept::tupleEntriesModel () -> typename Impl::TupleEntriesModelHelper< C, Tuple >::Result
     
    template<bool b, typename std::enable_if< b, int >::type = 0>
    constexpr bool Dune::Concept::requireTrue ()
     
    template<class C , class... T, typename std::enable_if< models< C, T... >(), int >::type = 0>
    constexpr bool Dune::Concept::requireConcept ()
     
    template<class C , class... T, typename std::enable_if< models< C, T... >(), int >::type = 0>
    constexpr bool Dune::Concept::requireConcept (T &&...)
     
    template<class C , class Tuple , typename std::enable_if< tupleEntriesModel< C, Tuple >(), int >::type = 0>
    constexpr bool Dune::Concept::requireConceptForTupleEntries ()
     
    template<class From , class To , typename std::enable_if< std::is_convertible< From, To >::value, int >::type = 0>
    constexpr bool Dune::Concept::requireConvertible ()
     
    template<class To , class From , typename std::enable_if< std::is_convertible< From, To >::value, int >::type = 0>
    constexpr bool Dune::Concept::requireConvertible (const From &)
     
    template<typename T >
    constexpr bool Dune::Concept::requireType ()
     
    template<class Base , class Derived , typename std::enable_if< std::is_base_of< Base, Derived >::value, int >::type = 0>
    constexpr bool Dune::Concept::requireBaseOf ()
     
    template<class Base , class Derived , typename std::enable_if< std::is_base_of< Base, Derived >::value, int >::type = 0>
    constexpr bool Dune::Concept::requireBaseOf (const Derived &)
     
    template<class A , class B , typename std::enable_if< std::is_same< A, B >::value, int >::type = 0>
    constexpr bool Dune::Concept::requireSameType ()
     
    \n

    Detailed Description

    \n-

    Definition of the DUNE_NO_DEPRECATED_* macros.

    \n+

    Infrastructure for concepts.

    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,23 +4,81 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Macros\n-deprecated.hh File Reference\n-Definition of the DUNE_NO_DEPRECATED_* macros. More...\n+Classes | Namespaces | Functions\n+concept.hh File Reference\n+Infrastructure for concepts. More...\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Macros\n-#define\u00a0DUNE_NO_DEPRECATED_BEGIN\u00a0\u00a0\u00a0...\n-\u00a0 Ignore deprecation warnings (start) More...\n+ Classes\n+struct \u00a0Dune::Concept::Refines<_BaseConcepts_>\n+\u00a0 Base class for refined concepts. More...\n \u00a0\n-#define\u00a0DUNE_NO_DEPRECATED_END\u00a0\u00a0\u00a0...\n-\u00a0 Ignore deprecation warnings (end) More...\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n+\u00a0\n+namespace \u00a0Dune::Concept\n+\u00a0 Namespace for concepts.\n+\u00a0\n+ Functions\n+template\n+constexpr auto\u00a0Dune::models ()\n+\u00a0 Check if concept is modeled by given types. More...\n+\u00a0\n+template\n+constexpr auto\u00a0Dune::Concept::tupleEntriesModel () -> typename Impl::\n+ TupleEntriesModelHelper< C, Tuple >::Result\n+\u00a0\n+template::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireTrue ()\n+\u00a0\n+template(),\n+int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireConcept ()\n+\u00a0\n+template(),\n+int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireConcept (T &&...)\n+\u00a0\n+template(), int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireConceptForTupleEntries ()\n+\u00a0\n+template::value, int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireConvertible ()\n+\u00a0\n+template::value, int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireConvertible (const From &)\n+\u00a0\n+template\n+constexpr bool\u00a0Dune::Concept::requireType ()\n+\u00a0\n+template::value, int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireBaseOf ()\n+\u00a0\n+template::value, int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireBaseOf (const Derived &)\n+\u00a0\n+template::\n+value, int >::type = 0>\n+constexpr bool\u00a0Dune::Concept::requireSameType ()\n \u00a0\n ***** Detailed Description *****\n-Definition of the DUNE_NO_DEPRECATED_* macros.\n+Infrastructure for concepts.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00101_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: deprecated.hh Source File\n+dune-common: concept.hh Source File\n \n \n \n \n \n \n \n@@ -62,52 +62,310 @@\n \n
    \n \n
    \n
    \n
    \n-
    deprecated.hh
    \n+
    concept.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_DEPRECATED_HH
    \n-
    6#define DUNE_DEPRECATED_HH
    \n+
    5#ifndef DUNE_COMMON_CONCEPT_HH
    \n+
    6#define DUNE_COMMON_CONCEPT_HH
    \n
    7
    \n-
    14#ifdef DOXYGEN
    \n-
    32#define DUNE_NO_DEPRECATED_BEGIN ...
    \n-
    38#define DUNE_NO_DEPRECATED_END ...
    \n-
    39#else
    \n-
    40# if defined __clang__
    \n-
    41# define DUNE_NO_DEPRECATED_BEGIN \\
    \n-
    42 _Pragma("clang diagnostic push") \\
    \n-
    43 _Pragma("clang diagnostic ignored \\"-Wdeprecated-declarations\\"")
    \n-
    44# define DUNE_NO_DEPRECATED_END _Pragma("clang diagnostic pop")
    \n-
    45# elif defined __INTEL_COMPILER
    \n-
    46# define DUNE_NO_DEPRECATED_BEGIN \\
    \n-
    47 _Pragma("warning push") \\
    \n-
    48 _Pragma("warning(disable:1478)") \\
    \n-
    49 _Pragma("warning(disable:1786)")
    \n-
    50# define DUNE_NO_DEPRECATED_END _Pragma("warning pop")
    \n-
    51# elif defined __GNUC__
    \n-
    52# define DUNE_NO_DEPRECATED_BEGIN \\
    \n-
    53 _Pragma("GCC diagnostic push") \\
    \n-
    54 _Pragma("GCC diagnostic ignored \\"-Wdeprecated-declarations\\"")
    \n-
    55# define DUNE_NO_DEPRECATED_END _Pragma("GCC diagnostic pop")
    \n-
    56# else
    \n-
    57# define DUNE_NO_DEPRECATED_BEGIN /* Noop. */
    \n-
    58# define DUNE_NO_DEPRECATED_END /* Noop. */
    \n-
    59# endif
    \n-
    60#endif
    \n-
    61
    \n-
    63
    \n-
    64#endif
    \n+
    8#include <type_traits>
    \n+
    9#include <utility>
    \n+
    10#include <tuple>
    \n+
    11
    \n+\n+\n+\n+\n+
    16
    \n+
    23namespace Dune {
    \n+
    24
    \n+
    34namespace Concept {
    \n+
    35
    \n+
    36
    \n+
    37
    \n+
    52template<class... BaseConcepts>
    \n+
    53struct Refines
    \n+
    54{
    \n+
    55 typedef TypeList<BaseConcepts...> BaseConceptList;
    \n+
    56};
    \n+
    57
    \n+
    58
    \n+
    59#ifndef DOXYGEN
    \n+
    60
    \n+
    61namespace Impl {
    \n+
    62
    \n+
    63 // #############################################################################
    \n+
    64 // # All functions following here are implementation details
    \n+
    65 // # for the models() function below.
    \n+
    66 // #############################################################################
    \n+
    67
    \n+
    68 // Forward declaration
    \n+
    69 template<class C, class... T>
    \n+
    70 constexpr bool models();
    \n+
    71
    \n+
    72
    \n+
    73
    \n+
    74 // Here is the implementation of the concept checking.
    \n+
    75 // The first two overloads do the magic for checking
    \n+
    76 // if the requirements of a concept are satisfied.
    \n+
    77 // The rest is just for checking base concepts in case
    \n+
    78 // of refinement.
    \n+
    79
    \n+
    80 // This overload is present if type substitution for
    \n+
    81 // C::require(T...) is successful, i.e., if the T...
    \n+
    82 // matches the requirement of C. In this case this
    \n+
    83 // overload is selected because PriorityTag<1>
    \n+
    84 // is a better match for PrioriryTag<42> than
    \n+
    85 // PriorityTag<0> in the default overload.
    \n+
    86 template<class C, class... T,
    \n+
    87 decltype(std::declval<C>().require(std::declval<T>()...), 0) =0>
    \n+
    88 constexpr std::true_type matchesRequirement(PriorityTag<1>)
    \n+
    89 { return {}; }
    \n+
    90
    \n+
    91 // If the above overload is ruled out by SFINAE because
    \n+
    92 // the T... does not match the requirements of C, then
    \n+
    93 // this default overload drops in.
    \n+
    94 template<class C, class... T>
    \n+
    95 constexpr std::false_type matchesRequirement(PriorityTag<0>)
    \n+
    96 { return {}; }
    \n+
    97
    \n+
    98
    \n+
    99
    \n+
    100 // An empty list C of concepts is always matched by T...
    \n+
    101 template<class...T>
    \n+
    102 constexpr bool modelsConceptList(TypeList<>)
    \n+
    103 { return true; }
    \n+
    104
    \n+
    105 // A nonempty list C0,..,CN of concepts is modeled
    \n+
    106 // by T... if it models the concept C0
    \n+
    107 // and all concepts in the list C1,..,CN.
    \n+
    108 template<class...T, class C0, class... CC>
    \n+
    109 constexpr bool modelsConceptList(TypeList<C0, CC...>)
    \n+
    110 { return models<C0, T...>() and modelsConceptList<T...>(TypeList<CC...>()); }
    \n+
    111
    \n+
    112
    \n+
    113
    \n+
    114 // If C is an unrefined concept, then T... models C
    \n+
    115 // if it matches the requirement of C.
    \n+
    116 template<class C, class... T>
    \n+
    117 constexpr bool modelsConcept(PriorityTag<0>)
    \n+
    118 { return matchesRequirement<C, T...>(PriorityTag<42>()); }
    \n+
    119
    \n+
    120 // If C is a refined concept, then T... models C
    \n+
    121 // if it matches the requirement of C and of
    \n+
    122 // all base concepts.
    \n+
    123 //
    \n+
    124 // This overload is used if C::BaseConceptList exists
    \n+
    125 // due to its higher priority.
    \n+
    126 template<class C, class... T,
    \n+
    127 decltype(typename C::BaseConceptList(), 0) = 0>
    \n+
    128 constexpr bool modelsConcept(PriorityTag<1>)
    \n+
    129 { return matchesRequirement<C, T...>(PriorityTag<42>()) and modelsConceptList<T...>(typename C::BaseConceptList()); }
    \n+
    130
    \n+
    131 // This is the full concept check. It's defined here in the
    \n+
    132 // implementation namespace with 'constexpr bool' return type
    \n+
    133 // because we need a forward declaration in order to use it
    \n+
    134 // internally above.
    \n+
    135 //
    \n+
    136 // The actual interface function can then call this one and
    \n+
    137 // return the result as std::integral_constant<bool,*> which
    \n+
    138 // does not allow for a forward declaration because the return
    \n+
    139 // type is deduced.
    \n+
    140 template<class C, class... T>
    \n+
    141 constexpr bool models()
    \n+
    142 {
    \n+
    143 return modelsConcept<C, T...>(PriorityTag<42>());
    \n+
    144 }
    \n+
    145
    \n+
    146} // namespace Dune::Concept::Impl
    \n+
    147
    \n+
    148#endif // DOXYGEN
    \n+
    149
    \n+
    150} // namespace Dune::Concept
    \n+
    151
    \n+
    152
    \n+
    153
    \n+
    183template<class C, class... T>
    \n+
    184constexpr auto models()
    \n+
    185{
    \n+
    186 return Std::bool_constant<Concept::Impl::models<C, T...>()>();
    \n+
    187}
    \n+
    188
    \n+
    189
    \n+
    190
    \n+
    191namespace Concept {
    \n+
    192
    \n+
    193#ifndef DOXYGEN
    \n+
    194
    \n+
    195namespace Impl {
    \n+
    196
    \n+
    197 // #############################################################################
    \n+
    198 // # All functions following here are implementation details for the
    \n+
    199 // # for the tupleEntriesModel() function below.
    \n+
    200 // #############################################################################
    \n+
    201
    \n+
    202 template<class C, class Tuple>
    \n+
    203 struct TupleEntriesModelHelper
    \n+
    204 {
    \n+
    205 template<class Accumulated, class T>
    \n+
    206 struct AccumulateFunctor
    \n+
    207 {
    \n+
    208 using type = typename std::integral_constant<bool, Accumulated::value and models<C, T>()>;
    \n+
    209 };
    \n+\n+
    211 };
    \n+
    212
    \n+
    213} // namespace Dune::Concept::Impl
    \n+
    214
    \n+
    215#endif // DOXYGEN
    \n+
    216
    \n+
    217
    \n+
    218// #############################################################################
    \n+
    219// # The method tupleEntriesModel() does the actual check if the types in a tuple
    \n+
    220// # model a concept using the implementation details above.
    \n+
    221// #############################################################################
    \n+
    222
    \n+
    223template<class C, class Tuple>
    \n+
    224constexpr auto tupleEntriesModel()
    \n+
    225 -> typename Impl::TupleEntriesModelHelper<C, Tuple>::Result
    \n+
    226{
    \n+
    227 return {};
    \n+
    228}
    \n+
    229
    \n+
    230// #############################################################################
    \n+
    231// # The following require*() functions are just helpers that allow to
    \n+
    232// # propagate a failed check as substitution failure. This is useful
    \n+
    233// # inside of a concept definition.
    \n+
    234// #############################################################################
    \n+
    235
    \n+
    236// Helper function for use in concept definitions.
    \n+
    237// If the passed value b is not true, the concept will to be satisfied.
    \n+
    238template<bool b, typename std::enable_if<b, int>::type = 0>
    \n+
    239constexpr bool requireTrue()
    \n+
    240{
    \n+
    241 return true;
    \n+
    242}
    \n+
    243
    \n+
    244// Helper function for use in concept definitions.
    \n+
    245template<class C, class... T, typename std::enable_if<models<C, T...>(), int>::type = 0>
    \n+
    246constexpr bool requireConcept()
    \n+
    247{
    \n+
    248 return true;
    \n+
    249}
    \n+
    250
    \n+
    251// Helper function for use in concept definitions.
    \n+
    252// This allows to avoid using decltype
    \n+
    253template<class C, class... T, typename std::enable_if<models<C, T...>(), int>::type = 0>
    \n+
    254constexpr bool requireConcept(T&&... /*t*/)
    \n+
    255{
    \n+
    256 return true;
    \n+
    257}
    \n+
    258
    \n+
    259// Helper function for use in concept definitions.
    \n+
    260// This checks if the concept given as first type is modelled by all types in the tuple passed as argument
    \n+
    261template<class C, class Tuple, typename std::enable_if<tupleEntriesModel<C, Tuple>(), int>::type = 0>
    \n+\n+
    263{
    \n+
    264 return true;
    \n+
    265}
    \n+
    266
    \n+
    267// Helper function for use in concept definitions.
    \n+
    268// If the first passed type is not convertible to the second, the concept will not be satisfied.
    \n+
    269template<class From, class To,
    \n+
    270 typename std::enable_if< std::is_convertible<From, To>::value, int>::type = 0>
    \n+
    271constexpr bool requireConvertible()
    \n+
    272{
    \n+
    273 return true;
    \n+
    274}
    \n+
    275
    \n+
    276// Helper function for use in concept definitions.
    \n+
    277// If passed argument is not convertible to the first passed type, the concept will not be satisfied.
    \n+
    278template<class To, class From,
    \n+
    279 typename std::enable_if< std::is_convertible<From, To>::value, int>::type = 0>
    \n+
    280constexpr bool requireConvertible(const From&)
    \n+
    281{
    \n+
    282 return true;
    \n+
    283}
    \n+
    284
    \n+
    285// Helper function for use in concept definitions.
    \n+
    286// This will always evaluate to true. If just allow
    \n+
    287// to turn a type into an expression. The failure happens
    \n+
    288// already during substitution for the type argument.
    \n+
    289template<typename T>
    \n+
    290constexpr bool requireType()
    \n+
    291{
    \n+
    292 return true;
    \n+
    293}
    \n+
    294
    \n+
    295// Helper function for use in concept definitions.
    \n+
    296// If first passed type is not a base class of second type, the concept will not be satisfied.
    \n+
    297template<class Base, class Derived,
    \n+
    298 typename std::enable_if< std::is_base_of<Base, Derived>::value, int>::type = 0>
    \n+
    299constexpr bool requireBaseOf()
    \n+
    300{
    \n+
    301 return true;
    \n+
    302}
    \n+
    303
    \n+
    304// Helper function for use in concept definitions.
    \n+
    305// If first passed type is not a base class of first arguments type, the concept will not be satisfied.
    \n+
    306template<class Base, class Derived,
    \n+
    307 typename std::enable_if< std::is_base_of<Base, Derived>::value, int>::type = 0>
    \n+
    308constexpr bool requireBaseOf(const Derived&)
    \n+
    309{
    \n+
    310 return true;
    \n+
    311}
    \n+
    312
    \n+
    313// Helper function for use in concept definitions.
    \n+
    314// If the passed types are not the same, the concept will not be satisfied.
    \n+
    315template<class A, class B,
    \n+
    316 typename std::enable_if< std::is_same<A, B>::value, int>::type = 0>
    \n+
    317constexpr bool requireSameType()
    \n+
    318{
    \n+
    319 return true;
    \n+
    320}
    \n+
    321
    \n+
    322
    \n+
    323
    \n+
    324} // namespace Dune::Concept
    \n+
    325
    \n+
    328} // namespace Dune
    \n+
    329
    \n+
    330
    \n+
    331
    \n+
    332
    \n+
    333#endif // DUNE_COMMON_CONCEPT_HH
    \n+
    Contains utility classes which can be used with std::tuple.
    \n+\n+
    Utilities for type computations, constraining overloads, ...
    \n+\n+
    F< Accumulated, Value >::type type
    Result of the reduce operation.
    Definition: tupleutility.hh:522
    \n+
    std::tuple< MetaType< T >... > TypeList
    A simple type list.
    Definition: typelist.hh:87
    \n+
    constexpr auto models()
    Check if concept is modeled by given types.
    Definition: concept.hh:184
    \n+
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    constexpr bool requireConcept()
    Definition: concept.hh:246
    \n+
    constexpr bool requireTrue()
    Definition: concept.hh:239
    \n+
    constexpr bool requireSameType()
    Definition: concept.hh:317
    \n+
    constexpr auto tupleEntriesModel() -> typename Impl::TupleEntriesModelHelper< C, Tuple >::Result
    Definition: concept.hh:224
    \n+
    constexpr bool requireConceptForTupleEntries()
    Definition: concept.hh:262
    \n+
    constexpr bool requireBaseOf()
    Definition: concept.hh:299
    \n+
    constexpr bool requireConvertible()
    Definition: concept.hh:271
    \n+
    constexpr bool requireType()
    Definition: concept.hh:290
    \n+
    Base class for refined concepts.
    Definition: concept.hh:54
    \n+
    TypeList< BaseConcepts... > BaseConceptList
    Definition: concept.hh:55
    \n+
    Helper class for tagging priorities.
    Definition: typeutilities.hh:73
    \n+
    Helper class for tagging priorities.
    Definition: typeutilities.hh:87
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,48 +4,369 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-deprecated.hh\n+concept.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_DEPRECATED_HH\n- 6#define DUNE_DEPRECATED_HH\n+ 5#ifndef DUNE_COMMON_CONCEPT_HH\n+ 6#define DUNE_COMMON_CONCEPT_HH\n 7\n- 14#ifdef DOXYGEN\n-32#define DUNE_NO_DEPRECATED_BEGIN ...\n-38#define DUNE_NO_DEPRECATED_END ...\n- 39#else\n- 40# if defined __clang__\n- 41# define DUNE_NO_DEPRECATED_BEGIN \\\n- 42 _Pragma(\"clang diagnostic push\") \\\n- 43 _Pragma(\"clang diagnostic ignored \\\"-Wdeprecated-declarations\\\"\")\n- 44# define DUNE_NO_DEPRECATED_END _Pragma(\"clang diagnostic pop\")\n- 45# elif defined __INTEL_COMPILER\n- 46# define DUNE_NO_DEPRECATED_BEGIN \\\n- 47 _Pragma(\"warning push\") \\\n- 48 _Pragma(\"warning(disable:1478)\") \\\n- 49 _Pragma(\"warning(disable:1786)\")\n- 50# define DUNE_NO_DEPRECATED_END _Pragma(\"warning pop\")\n- 51# elif defined __GNUC__\n- 52# define DUNE_NO_DEPRECATED_BEGIN \\\n- 53 _Pragma(\"GCC diagnostic push\") \\\n- 54 _Pragma(\"GCC diagnostic ignored \\\"-Wdeprecated-declarations\\\"\")\n- 55# define DUNE_NO_DEPRECATED_END _Pragma(\"GCC diagnostic pop\")\n- 56# else\n- 57# define DUNE_NO_DEPRECATED_BEGIN /* Noop. */\n- 58# define DUNE_NO_DEPRECATED_END /* Noop. */\n- 59# endif\n- 60#endif\n- 61\n- 63\n- 64#endif\n+ 8#include \n+ 9#include \n+ 10#include \n+ 11\n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16\n+ 23namespace Dune {\n+ 24\n+34namespace Concept {\n+ 35\n+ 36\n+ 37\n+ 52template\n+53struct Refines\n+ 54{\n+55 typedef TypeList BaseConceptList;\n+ 56};\n+ 57\n+ 58\n+ 59#ifndef DOXYGEN\n+ 60\n+ 61namespace Impl {\n+ 62\n+ 63 /\n+/ #############################################################################\n+ 64 // # All functions following here are implementation details\n+ 65 // # for the models() function below.\n+ 66 /\n+/ #############################################################################\n+ 67\n+ 68 // Forward declaration\n+ 69 template\n+ 70 constexpr bool models();\n+ 71\n+ 72\n+ 73\n+ 74 // Here is the implementation of the concept checking.\n+ 75 // The first two overloads do the magic for checking\n+ 76 // if the requirements of a concept are satisfied.\n+ 77 // The rest is just for checking base concepts in case\n+ 78 // of refinement.\n+ 79\n+ 80 // This overload is present if type substitution for\n+ 81 // C::require(T...) is successful, i.e., if the T...\n+ 82 // matches the requirement of C. In this case this\n+ 83 // overload is selected because PriorityTag<1>\n+ 84 // is a better match for PrioriryTag<42> than\n+ 85 // PriorityTag<0> in the default overload.\n+ 86 template().require(std::declval()...), 0) =0>\n+ 88 constexpr std::true_type matchesRequirement(PriorityTag<1>)\n+ 89 { return {}; }\n+ 90\n+ 91 // If the above overload is ruled out by SFINAE because\n+ 92 // the T... does not match the requirements of C, then\n+ 93 // this default overload drops in.\n+ 94 template\n+ 95 constexpr std::false_type matchesRequirement(PriorityTag<0>)\n+ 96 { return {}; }\n+ 97\n+ 98\n+ 99\n+ 100 // An empty list C of concepts is always matched by T...\n+ 101 template\n+ 102 constexpr bool modelsConceptList(TypeList<>)\n+ 103 { return true; }\n+ 104\n+ 105 // A nonempty list C0,..,CN of concepts is modeled\n+ 106 // by T... if it models the concept C0\n+ 107 // and all concepts in the list C1,..,CN.\n+ 108 template\n+ 109 constexpr bool modelsConceptList(TypeList)\n+ 110 { return models() and modelsConceptList(TypeList\n+()); }\n+ 111\n+ 112\n+ 113\n+ 114 // If C is an unrefined concept, then T... models C\n+ 115 // if it matches the requirement of C.\n+ 116 template\n+ 117 constexpr bool modelsConcept(PriorityTag<0>)\n+ 118 { return matchesRequirement(PriorityTag<42>()); }\n+ 119\n+ 120 // If C is a refined concept, then T... models C\n+ 121 // if it matches the requirement of C and of\n+ 122 // all base concepts.\n+ 123 //\n+ 124 // This overload is used if C::BaseConceptList exists\n+ 125 // due to its higher priority.\n+ 126 template\n+ 128 constexpr bool modelsConcept(PriorityTag<1>)\n+ 129 { return matchesRequirement(PriorityTag<42>()) and\n+modelsConceptList(typename C::BaseConceptList()); }\n+ 130\n+ 131 // This is the full concept check. It's defined here in the\n+ 132 // implementation namespace with 'constexpr bool' return type\n+ 133 // because we need a forward declaration in order to use it\n+ 134 // internally above.\n+ 135 //\n+ 136 // The actual interface function can then call this one and\n+ 137 // return the result as std::integral_constant which\n+ 138 // does not allow for a forward declaration because the return\n+ 139 // type is deduced.\n+ 140 template\n+ 141 constexpr bool models()\n+ 142 {\n+ 143 return modelsConcept(PriorityTag<42>());\n+ 144 }\n+ 145\n+ 146} // namespace Dune::Concept::Impl\n+ 147\n+ 148#endif // DOXYGEN\n+ 149\n+ 150} // namespace Dune::Concept\n+ 151\n+ 152\n+ 153\n+ 183template\n+184constexpr auto models()\n+ 185{\n+ 186 return Std::bool_constant()>();\n+ 187}\n+ 188\n+ 189\n+ 190\n+ 191namespace Concept {\n+ 192\n+ 193#ifndef DOXYGEN\n+ 194\n+ 195namespace Impl {\n+ 196\n+ 197 /\n+/ #############################################################################\n+ 198 // # All functions following here are implementation details for the\n+ 199 // # for the tupleEntriesModel() function below.\n+ 200 /\n+/ #############################################################################\n+ 201\n+ 202 template\n+ 203 struct TupleEntriesModelHelper\n+ 204 {\n+ 205 template\n+ 206 struct AccumulateFunctor\n+ 207 {\n+ 208 using type = typename std::integral_constant()>;\n+ 209 };\n+ 210 using Result = typename ReduceTuple::type;\n+ 211 };\n+ 212\n+ 213} // namespace Dune::Concept::Impl\n+ 214\n+ 215#endif // DOXYGEN\n+ 216\n+ 217\n+ 218/\n+/ #############################################################################\n+ 219// # The method tupleEntriesModel() does the actual check if the types in a\n+tuple\n+ 220// # model a concept using the implementation details above.\n+ 221/\n+/ #############################################################################\n+ 222\n+ 223template\n+224constexpr auto tupleEntriesModel()\n+ 225 -> typename Impl::TupleEntriesModelHelper::Result\n+ 226{\n+ 227 return {};\n+ 228}\n+ 229\n+ 230/\n+/ #############################################################################\n+ 231// # The following require*() functions are just helpers that allow to\n+ 232// # propagate a failed check as substitution failure. This is useful\n+ 233// # inside of a concept definition.\n+ 234/\n+/ #############################################################################\n+ 235\n+ 236// Helper function for use in concept definitions.\n+ 237// If the passed value b is not true, the concept will to be satisfied.\n+ 238template::type = 0>\n+239constexpr bool requireTrue()\n+ 240{\n+ 241 return true;\n+ 242}\n+ 243\n+ 244// Helper function for use in concept definitions.\n+ 245template(),\n+int>::type = 0>\n+246constexpr bool requireConcept()\n+ 247{\n+ 248 return true;\n+ 249}\n+ 250\n+ 251// Helper function for use in concept definitions.\n+ 252// This allows to avoid using decltype\n+ 253template(),\n+int>::type = 0>\n+254constexpr bool requireConcept(T&&... /*t*/)\n+ 255{\n+ 256 return true;\n+ 257}\n+ 258\n+ 259// Helper function for use in concept definitions.\n+ 260// This checks if the concept given as first type is modelled by all types\n+in the tuple passed as argument\n+ 261template(), int>::type = 0>\n+262constexpr bool requireConceptForTupleEntries()\n+ 263{\n+ 264 return true;\n+ 265}\n+ 266\n+ 267// Helper function for use in concept definitions.\n+ 268// If the first passed type is not convertible to the second, the concept\n+will not be satisfied.\n+ 269template::value, int>::type\n+= 0>\n+271constexpr bool requireConvertible()\n+ 272{\n+ 273 return true;\n+ 274}\n+ 275\n+ 276// Helper function for use in concept definitions.\n+ 277// If passed argument is not convertible to the first passed type, the\n+concept will not be satisfied.\n+ 278template::value, int>::type\n+= 0>\n+280constexpr bool requireConvertible(const From&)\n+ 281{\n+ 282 return true;\n+ 283}\n+ 284\n+ 285// Helper function for use in concept definitions.\n+ 286// This will always evaluate to true. If just allow\n+ 287// to turn a type into an expression. The failure happens\n+ 288// already during substitution for the type argument.\n+ 289template\n+290constexpr bool requireType()\n+ 291{\n+ 292 return true;\n+ 293}\n+ 294\n+ 295// Helper function for use in concept definitions.\n+ 296// If first passed type is not a base class of second type, the concept\n+will not be satisfied.\n+ 297template::value, int>::type\n+= 0>\n+299constexpr bool requireBaseOf()\n+ 300{\n+ 301 return true;\n+ 302}\n+ 303\n+ 304// Helper function for use in concept definitions.\n+ 305// If first passed type is not a base class of first arguments type, the\n+concept will not be satisfied.\n+ 306template::value, int>::type\n+= 0>\n+308constexpr bool requireBaseOf(const Derived&)\n+ 309{\n+ 310 return true;\n+ 311}\n+ 312\n+ 313// Helper function for use in concept definitions.\n+ 314// If the passed types are not the same, the concept will not be satisfied.\n+ 315template::value, int>::type = 0>\n+317constexpr bool requireSameType()\n+ 318{\n+ 319 return true;\n+ 320}\n+ 321\n+ 322\n+ 323\n+ 324} // namespace Dune::Concept\n+ 325\n+ 328} // namespace Dune\n+ 329\n+ 330\n+ 331\n+ 332\n+ 333#endif // DUNE_COMMON_CONCEPT_HH\n+tupleutility.hh\n+Contains utility classes which can be used with std::tuple.\n+typelist.hh\n+typeutilities.hh\n+Utilities for type computations, constraining overloads, ...\n+type_traits.hh\n+Dune::ReduceTuple::type\n+F< Accumulated, Value >::type type\n+Result of the reduce operation.\n+Definition: tupleutility.hh:522\n+Dune::TypeList\n+std::tuple< MetaType< T >... > TypeList\n+A simple type list.\n+Definition: typelist.hh:87\n+Dune::models\n+constexpr auto models()\n+Check if concept is modeled by given types.\n+Definition: concept.hh:184\n+Dune\n+Dune namespace.\n+Definition: alignedallocator.hh:13\n+Dune::Concept::requireConcept\n+constexpr bool requireConcept()\n+Definition: concept.hh:246\n+Dune::Concept::requireTrue\n+constexpr bool requireTrue()\n+Definition: concept.hh:239\n+Dune::Concept::requireSameType\n+constexpr bool requireSameType()\n+Definition: concept.hh:317\n+Dune::Concept::tupleEntriesModel\n+constexpr auto tupleEntriesModel() -> typename Impl::TupleEntriesModelHelper<\n+C, Tuple >::Result\n+Definition: concept.hh:224\n+Dune::Concept::requireConceptForTupleEntries\n+constexpr bool requireConceptForTupleEntries()\n+Definition: concept.hh:262\n+Dune::Concept::requireBaseOf\n+constexpr bool requireBaseOf()\n+Definition: concept.hh:299\n+Dune::Concept::requireConvertible\n+constexpr bool requireConvertible()\n+Definition: concept.hh:271\n+Dune::Concept::requireType\n+constexpr bool requireType()\n+Definition: concept.hh:290\n+Dune::Concept::Refines\n+Base class for refined concepts.\n+Definition: concept.hh:54\n+Dune::Concept::Refines::BaseConceptList\n+TypeList< BaseConcepts... > BaseConceptList\n+Definition: concept.hh:55\n+Dune::PriorityTag\n+Helper class for tagging priorities.\n+Definition: typeutilities.hh:73\n+Dune::PriorityTag<_0_>\n+Helper class for tagging priorities.\n+Definition: typeutilities.hh:87\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00104.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00104.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: bartonnackmanifcheck.hh File Reference\n+dune-common: dynmatrix.hh File Reference\n \n \n \n \n \n \n \n@@ -63,75 +63,52 @@\n
    \n \n
    \n \n
    \n
    \n-Macros
    \n-
    bartonnackmanifcheck.hh File Reference
    \n+Classes |\n+Namespaces
    \n+
    dynmatrix.hh File Reference
    \n \n
    \n \n-

    Provides check for implementation of interface methods when using static polymorphism, i.e. the Barton-Nackman trick. This is purely for debugging purposes. To check the correct implementation of interface methods (and pick up possible infinite loops) NDEBUG must be undefined and DUNE_INTERFACECHECK has to be defined. \n+

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

    \n-
    #include <dune/common/exceptions.hh>
    \n+
    #include <cmath>
    \n+#include <cstddef>
    \n+#include <iostream>
    \n+#include <initializer_list>
    \n+#include <dune/common/boundschecking.hh>
    \n+#include <dune/common/exceptions.hh>
    \n+#include <dune/common/dynvector.hh>
    \n+#include <dune/common/densematrix.hh>
    \n+#include <dune/common/typetraits.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n-\n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n-Macros

    #define CHECK_INTERFACE_IMPLEMENTATION(dummy)
     
    #define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)    (__interface_method_to_call__)
     

    \n+Classes

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

    \n+Namespaces

    namespace  Dune
     Dune namespace.
     
    \n

    Detailed Description

    \n-

    Provides check for implementation of interface methods when using static polymorphism, i.e. the Barton-Nackman trick. This is purely for debugging purposes. To check the correct implementation of interface methods (and pick up possible infinite loops) NDEBUG must be undefined and DUNE_INTERFACECHECK has to be defined.

    \n-
    Author
    Robert Kloefkorn
    \n-

    Use by invoking CHECK_INTERFACE_IMPLEMENTATION(asImp().methodToCheck()) and for template methods double (CHECK_INTERFACE_IMPLEMENTATION((asImp().template methodToCheck<param> ())). If either NDEBUG is defined or DUNE_INTERFACECHECK is undefined the CHECK_INTERFACE_IMPLEMENTATION macro is empty.

    \n-

    Note: adding the interface check to a method will cause the implementation of the method to be called twice, so before use make sure that this will not cause problems e.g. if internal counters are updated.

    \n-

    Macro Definition Documentation

    \n-\n-

    ◆ CHECK_AND_CALL_INTERFACE_IMPLEMENTATION

    \n-\n-
    \n-
    \n- \n- \n- \n- \n- \n- \n- \n- \n-
    #define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( __interface_method_to_call__)    (__interface_method_to_call__)
    \n-
    \n-

    The macro CHECK_AND_CALL_INTERFACE_IMPLEMENTATION throws an exception, if the interface method is not implemented and just calls the method otherwise. If NDEBUG is defined no checking is done and the method is just called.

    \n-\n-
    \n-
    \n-\n-

    ◆ CHECK_INTERFACE_IMPLEMENTATION

    \n-\n-
    \n-
    \n- \n- \n- \n- \n- \n- \n- \n- \n-
    #define CHECK_INTERFACE_IMPLEMENTATION( dummy)
    \n-
    \n-\n-
    \n-
    \n-
    \n+

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

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,49 +4,39 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Macros\n-bartonnackmanifcheck.hh File Reference\n-Provides check for implementation of interface methods when using static\n-polymorphism, i.e. the Barton-Nackman trick. This is purely for debugging\n-purposes. To check the correct implementation of interface methods (and pick up\n-possible infinite loops) NDEBUG must be undefined and DUNE_INTERFACECHECK has\n-to be defined. More...\n+Classes | Namespaces\n+dynmatrix.hh File Reference\n+Common \u00bb Dense_Matrix_and_Vector_Template_Library\n+This file implements a dense matrix with dynamic numbers of rows and columns.\n+More...\n+#include \n+#include \n+#include \n+#include \n+#include \n #include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Macros\n-#define\u00a0CHECK_INTERFACE_IMPLEMENTATION(dummy)\n+ Classes\n+struct \u00a0Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>\n \u00a0\n-#define\u00a0CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)\u00a0\u00a0\u00a0\n- (__interface_method_to_call__)\n+struct \u00a0Dune::FieldTraits<_DynamicMatrix<_K_>_>\n+\u00a0\n+ class \u00a0Dune::DynamicMatrix<_K_>\n+\u00a0 Construct a matrix with a dynamic size. More...\n+\u00a0\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n \u00a0\n ***** Detailed Description *****\n-Provides check for implementation of interface methods when using static\n-polymorphism, i.e. the Barton-Nackman trick. This is purely for debugging\n-purposes. To check the correct implementation of interface methods (and pick up\n-possible infinite loops) NDEBUG must be undefined and DUNE_INTERFACECHECK has\n-to be defined.\n- Author\n- Robert Kloefkorn\n-Use by invoking CHECK_INTERFACE_IMPLEMENTATION(asImp().methodToCheck()) and for\n-template methods double (CHECK_INTERFACE_IMPLEMENTATION((asImp().template\n-methodToCheck ())). If either NDEBUG is defined or DUNE_INTERFACECHECK\n-is undefined the CHECK_INTERFACE_IMPLEMENTATION macro is empty.\n-Note: adding the interface check to a method will cause the implementation of\n-the method to be called twice, so before use make sure that this will not cause\n-problems e.g. if internal counters are updated.\n-***** Macro Definition Documentation *****\n-***** \u25c6\u00a0CHECK_AND_CALL_INTERFACE_IMPLEMENTATION *****\n-#define ( \u00a0__interface_method_to_call__ ) \u00a0\u00a0\u00a0\n-CHECK_AND_CALL_INTERFACE_IMPLEMENTATION (__interface_method_to_call__)\n-The macro CHECK_AND_CALL_INTERFACE_IMPLEMENTATION throws an exception, if the\n-interface method is not implemented and just calls the method otherwise. If\n-NDEBUG is defined no checking is done and the method is just called.\n-***** \u25c6\u00a0CHECK_INTERFACE_IMPLEMENTATION *****\n-#define CHECK_INTERFACE_IMPLEMENTATION ( \u00a0dummy )\n+This file implements a dense matrix with dynamic numbers of rows and columns.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00104_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: bartonnackmanifcheck.hh Source File\n+dune-common: dynmatrix.hh Source File\n \n \n \n \n \n \n \n@@ -62,60 +62,189 @@\n \n
    \n \n
    \n \n
    \n-
    bartonnackmanifcheck.hh
    \n+
    dynmatrix.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    24//- Dune includes
    \n-\n-
    26
    \n-
    27#ifdef CHECK_INTERFACE_IMPLEMENTATION
    \n-
    28#undef CHECK_INTERFACE_IMPLEMENTATION
    \n-
    29#endif
    \n-
    30#ifdef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
    \n-
    31#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
    \n-
    32#endif
    \n-
    33
    \n-
    34#if defined NDEBUG || !defined DUNE_INTERFACECHECK
    \n-
    35#define CHECK_INTERFACE_IMPLEMENTATION(dummy)
    \n-
    36#else
    \n-
    37#define CHECK_INTERFACE_IMPLEMENTATION(__interface_method_to_call__) \\
    \n-
    38 {\\
    \n-
    39 static bool call = false; \\
    \n-
    40 if( call == true ) \\
    \n-
    41 DUNE_THROW(NotImplemented,"Interface method not implemented!");\\
    \n-
    42 call = true; \\
    \n-
    43 try { \\
    \n-
    44 (__interface_method_to_call__); \\
    \n-
    45 call = false; \\
    \n-
    46 } \\
    \n-
    47 catch ( ... ) \\
    \n-
    48 { \\
    \n-
    49 call = false; \\
    \n-
    50 throw; \\
    \n-
    51 } \\
    \n-
    52 }
    \n-
    53#endif
    \n+
    5#ifndef DUNE_DYNMATRIX_HH
    \n+
    6#define DUNE_DYNMATRIX_HH
    \n+
    7
    \n+
    8#include <cmath>
    \n+
    9#include <cstddef>
    \n+
    10#include <iostream>
    \n+
    11#include <initializer_list>
    \n+
    12
    \n+\n+\n+\n+\n+\n+
    18
    \n+
    19namespace Dune
    \n+
    20{
    \n+
    21
    \n+
    31 template< class K > class DynamicMatrix;
    \n+
    32
    \n+
    33 template< class K >
    \n+\n+
    35 {
    \n+\n+
    37
    \n+\n+
    39
    \n+\n+\n+
    42
    \n+
    43 typedef std::vector<K> container_type;
    \n+
    44 typedef K value_type;
    \n+
    45 typedef typename container_type::size_type size_type;
    \n+
    46 };
    \n+
    47
    \n+
    48 template< class K >
    \n+\n+
    50 {
    \n+\n+\n+
    53 };
    \n
    54
    \n-
    60#if defined NDEBUG || !defined DUNE_INTERFACECHECK
    \n-
    61#define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__) \\
    \n-
    62 (__interface_method_to_call__)
    \n-
    63#else
    \n-
    64#define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__) \\
    \n-
    65 CHECK_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)
    \n-
    66#endif
    \n-
    A few common exception classes.
    \n+
    59 template<class K>
    \n+
    60 class DynamicMatrix : public DenseMatrix< DynamicMatrix<K> >
    \n+
    61 {
    \n+
    62 std::vector< DynamicVector<K> > _data;
    \n+\n+
    64 public:
    \n+
    65 typedef typename Base::size_type size_type;
    \n+
    66 typedef typename Base::value_type value_type;
    \n+
    67 typedef typename Base::row_type row_type;
    \n+
    68
    \n+
    69 //===== constructors
    \n+\n+
    72
    \n+\n+
    75 _data(r, row_type(c, v) )
    \n+
    76 {}
    \n+
    77
    \n+
    80 DynamicMatrix (std::initializer_list<DynamicVector<K>> const &ll)
    \n+
    81 : _data(ll)
    \n+
    82 {}
    \n+
    83
    \n+
    84
    \n+
    85 template <class T,
    \n+
    86 typename = std::enable_if_t<!Dune::IsNumber<T>::value && HasDenseMatrixAssigner<DynamicMatrix, T>::value>>
    \n+
    87 DynamicMatrix(T const& rhs)
    \n+
    88 {
    \n+
    89 *this = rhs;
    \n+
    90 }
    \n+
    91
    \n+
    92 //==== resize related methods
    \n+\n+
    107 {
    \n+
    108 _data.resize(0);
    \n+
    109 _data.resize(r, row_type(c, v) );
    \n+
    110 }
    \n+
    111
    \n+
    112 //===== assignment
    \n+
    113 // General assignment with resizing
    \n+
    114 template <typename T,
    \n+
    115 typename = std::enable_if_t<!Dune::IsNumber<T>::value>>
    \n+
    116 DynamicMatrix& operator=(T const& rhs) {
    \n+
    117 _data.resize(rhs.N());
    \n+
    118 std::fill(_data.begin(), _data.end(), row_type(rhs.M(), K(0)));
    \n+
    119 Base::operator=(rhs);
    \n+
    120 return *this;
    \n+
    121 }
    \n+
    122
    \n+
    123 // Specialisation: scalar assignment (no resizing)
    \n+
    124 template <typename T,
    \n+
    125 typename = std::enable_if_t<Dune::IsNumber<T>::value>>
    \n+\n+
    127 std::fill(_data.begin(), _data.end(), scalar);
    \n+
    128 return *this;
    \n+
    129 }
    \n+
    130
    \n+\n+
    133 {
    \n+
    134 DynamicMatrix AT(this->M(), this->N());
    \n+
    135 for( size_type i = 0; i < this->N(); ++i )
    \n+
    136 for( size_type j = 0; j < this->M(); ++j )
    \n+
    137 AT[j][i] = (*this)[i][j];
    \n+
    138 return AT;
    \n+
    139 }
    \n+
    140
    \n+
    141 // make this thing a matrix
    \n+
    142 size_type mat_rows() const { return _data.size(); }
    \n+\n+
    144 assert(this->rows());
    \n+
    145 return _data.front().size();
    \n+
    146 }
    \n+\n+
    148 DUNE_ASSERT_BOUNDS(i < _data.size());
    \n+
    149 return _data[i];
    \n+
    150 }
    \n+
    151 const row_type & mat_access(size_type i) const {
    \n+
    152 DUNE_ASSERT_BOUNDS(i < _data.size());
    \n+
    153 return _data[i];
    \n+
    154 }
    \n+
    155 };
    \n+
    156
    \n+
    159} // end namespace
    \n+
    160
    \n+
    161#endif
    \n+
    Traits for type conversions and type information.
    \n+
    This file implements a dense vector with a dynamic size.
    \n+
    Macro for wrapping boundary checks.
    \n+
    A few common exception classes.
    \n+
    Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
    \n+
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition: boundschecking.hh:30
    \n+
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    A dense n x m matrix.
    Definition: densematrix.hh:140
    \n+
    derived_type & operator=(const RHS &rhs)
    Definition: densematrix.hh:279
    \n+
    constexpr size_type M() const
    number of columns
    Definition: densematrix.hh:703
    \n+
    Traits::value_type value_type
    export the type representing the field
    Definition: densematrix.hh:157
    \n+
    constexpr size_type rows() const
    number of rows
    Definition: densematrix.hh:709
    \n+
    constexpr size_type N() const
    number of rows
    Definition: densematrix.hh:697
    \n+
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition: densematrix.hh:166
    \n+
    Construct a matrix with a dynamic size.
    Definition: dynmatrix.hh:61
    \n+
    size_type mat_cols() const
    Definition: dynmatrix.hh:143
    \n+
    DynamicMatrix(std::initializer_list< DynamicVector< K > > const &ll)
    Constructor initializing the matrix from a list of vector.
    Definition: dynmatrix.hh:80
    \n+
    Base::row_type row_type
    Definition: dynmatrix.hh:67
    \n+
    DynamicMatrix transposed() const
    Return transposed of the matrix as DynamicMatrix.
    Definition: dynmatrix.hh:132
    \n+
    Base::value_type value_type
    Definition: dynmatrix.hh:66
    \n+
    row_type & mat_access(size_type i)
    Definition: dynmatrix.hh:147
    \n+
    Base::size_type size_type
    Definition: dynmatrix.hh:65
    \n+
    size_type mat_rows() const
    Definition: dynmatrix.hh:142
    \n+
    DynamicMatrix(T const &rhs)
    Definition: dynmatrix.hh:87
    \n+
    const row_type & mat_access(size_type i) const
    Definition: dynmatrix.hh:151
    \n+
    void resize(size_type r, size_type c, value_type v=value_type())
    resize matrix to r \u00d7 c
    Definition: dynmatrix.hh:106
    \n+
    DynamicMatrix & operator=(T const &rhs)
    Definition: dynmatrix.hh:116
    \n+
    DynamicMatrix()
    Default constructor.
    Definition: dynmatrix.hh:71
    \n+
    DynamicMatrix(size_type r, size_type c, value_type v=value_type())
    Constructor initializing the whole matrix with a scalar.
    Definition: dynmatrix.hh:74
    \n+
    DynamicMatrix & operator=(T scalar)
    Definition: dynmatrix.hh:126
    \n+
    container_type::size_type size_type
    Definition: dynmatrix.hh:45
    \n+
    DynamicVector< K > row_type
    Definition: dynmatrix.hh:38
    \n+
    row_type & row_reference
    Definition: dynmatrix.hh:40
    \n+
    K value_type
    Definition: dynmatrix.hh:44
    \n+
    DynamicMatrix< K > derived_type
    Definition: dynmatrix.hh:36
    \n+
    const row_type & const_row_reference
    Definition: dynmatrix.hh:41
    \n+
    std::vector< K > container_type
    Definition: dynmatrix.hh:43
    \n+
    FieldTraits< K >::real_type real_type
    Definition: dynmatrix.hh:52
    \n+
    FieldTraits< K >::field_type field_type
    Definition: dynmatrix.hh:51
    \n+
    Construct a vector with a dynamic size.
    Definition: dynvector.hh:59
    \n+
    Definition: ftraits.hh:26
    \n+
    T field_type
    export the type representing the field
    Definition: ftraits.hh:28
    \n+
    T real_type
    export the type representing the real type of the field
    Definition: ftraits.hh:30
    \n+
    Definition: matvectraits.hh:31
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "encoding", "source2": "encoding", "unified_diff": "@@ -1 +1 @@\n-us-ascii\n+utf-8\n"}, {"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,59 +4,282 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-bartonnackmanifcheck.hh\n+dynmatrix.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 24//- Dune includes\n- 25#include \n- 26\n- 27#ifdef CHECK_INTERFACE_IMPLEMENTATION\n- 28#undef CHECK_INTERFACE_IMPLEMENTATION\n- 29#endif\n- 30#ifdef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION\n- 31#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION\n- 32#endif\n- 33\n- 34#if defined NDEBUG || !defined DUNE_INTERFACECHECK\n-35#define CHECK_INTERFACE_IMPLEMENTATION(dummy)\n- 36#else\n- 37#define CHECK_INTERFACE_IMPLEMENTATION(__interface_method_to_call__) \\\n- 38 {\\\n- 39 static bool call = false; \\\n- 40 if( call == true ) \\\n- 41 DUNE_THROW(NotImplemented,\"Interface method not implemented!\");\\\n- 42 call = true; \\\n- 43 try { \\\n- 44 (__interface_method_to_call__); \\\n- 45 call = false; \\\n- 46 } \\\n- 47 catch ( ... ) \\\n- 48 { \\\n- 49 call = false; \\\n- 50 throw; \\\n- 51 } \\\n- 52 }\n- 53#endif\n+ 5#ifndef DUNE_DYNMATRIX_HH\n+ 6#define DUNE_DYNMATRIX_HH\n+ 7\n+ 8#include \n+ 9#include \n+ 10#include \n+ 11#include \n+ 12\n+ 13#include \n+ 14#include \n+ 15#include \n+ 16#include \n+ 17#include \n+ 18\n+ 19namespace Dune\n+ 20{\n+ 21\n+ 31 template< class K > class DynamicMatrix;\n+ 32\n+ 33 template< class K >\n+34 struct DenseMatVecTraits< DynamicMatrix >\n+ 35 {\n+36 typedef DynamicMatrix derived_type;\n+ 37\n+38 typedef DynamicVector row_type;\n+ 39\n+40 typedef row_type &row_reference;\n+41 typedef const row_type &const_row_reference;\n+ 42\n+43 typedef std::vector container_type;\n+44 typedef K value_type;\n+45 typedef typename container_type::size_type size_type;\n+ 46 };\n+ 47\n+ 48 template< class K >\n+49 struct FieldTraits< DynamicMatrix >\n+ 50 {\n+51 typedef typename FieldTraits::field_type field_type;\n+52 typedef typename FieldTraits::real_type real_type;\n+ 53 };\n 54\n- 60#if defined NDEBUG || !defined DUNE_INTERFACECHECK\n-61#define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)\n-\\\n- 62 (__interface_method_to_call__)\n- 63#else\n- 64#define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION\n-(__interface_method_to_call__) \\\n- 65 CHECK_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)\n- 66#endif\n+ 59 template\n+60 class DynamicMatrix : public DenseMatrix< DynamicMatrix >\n+ 61 {\n+ 62 std::vector< DynamicVector > _data;\n+ 63 typedef DenseMatrix<_DynamicMatrix > Base;\n+ 64 public:\n+65 typedef typename Base::size_type size_type;\n+66 typedef typename Base::value_type value_type;\n+67 typedef typename Base::row_type row_type;\n+ 68\n+ 69 //===== constructors\n+71 DynamicMatrix () {}\n+ 72\n+74 DynamicMatrix (size_type r, size_type c, value_type v = value_type() ) :\n+ 75 _data(r, row_type(c, v) )\n+ 76 {}\n+ 77\n+80 DynamicMatrix (std::initializer_list> const &ll)\n+ 81 : _data(ll)\n+ 82 {}\n+ 83\n+ 84\n+ 85 template ::value &&\n+HasDenseMatrixAssigner::value>>\n+87 DynamicMatrix(T const& rhs)\n+ 88 {\n+ 89 *this = rhs;\n+ 90 }\n+ 91\n+ 92 //==== resize related methods\n+106 void resize (size_type r, size_type c, value_type v = value_type() )\n+ 107 {\n+ 108 _data.resize(0);\n+ 109 _data.resize(r, row_type(c, v) );\n+ 110 }\n+ 111\n+ 112 //===== assignment\n+ 113 // General assignment with resizing\n+ 114 template ::value>>\n+116 DynamicMatrix& operator=(T const& rhs) {\n+ 117 _data.resize(rhs.N());\n+ 118 std::fill(_data.begin(), _data.end(), row_type(rhs.M(), K(0)));\n+ 119 Base::operator=(rhs);\n+ 120 return *this;\n+ 121 }\n+ 122\n+ 123 // Specialisation: scalar assignment (no resizing)\n+ 124 template ::value>>\n+126 DynamicMatrix& operator=(T scalar) {\n+ 127 std::fill(_data.begin(), _data.end(), scalar);\n+ 128 return *this;\n+ 129 }\n+ 130\n+132 DynamicMatrix transposed() const\n+ 133 {\n+ 134 DynamicMatrix AT(this->M(), this->N());\n+ 135 for( size_type i = 0; i < this->N(); ++i )\n+ 136 for( size_type j = 0; j < this->M(); ++j )\n+ 137 AT[j][i] = (*this)[i][j];\n+ 138 return AT;\n+ 139 }\n+ 140\n+ 141 // make this thing a matrix\n+142 size_type mat_rows() const { return _data.size(); }\n+143 size_type mat_cols() const {\n+ 144 assert(this->rows());\n+ 145 return _data.front().size();\n+ 146 }\n+147 row_type & mat_access(size_type i) {\n+ 148 DUNE_ASSERT_BOUNDS(i < _data.size());\n+ 149 return _data[i];\n+ 150 }\n+151 const row_type & mat_access(size_type i) const {\n+ 152 DUNE_ASSERT_BOUNDS(i < _data.size());\n+ 153 return _data[i];\n+ 154 }\n+ 155 };\n+ 156\n+ 159} // end namespace\n+ 160\n+ 161#endif\n+typetraits.hh\n+Traits for type conversions and type information.\n+dynvector.hh\n+This file implements a dense vector with a dynamic size.\n+boundschecking.hh\n+Macro for wrapping boundary checks.\n exceptions.hh\n A few common exception classes.\n+densematrix.hh\n+Implements a matrix constructed from a given type representing a field and a\n+compile-time given numbe...\n+DUNE_ASSERT_BOUNDS\n+#define DUNE_ASSERT_BOUNDS(cond)\n+If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do\n+nothing.\n+Definition: boundschecking.hh:30\n+Dune\n+Dune namespace.\n+Definition: alignedallocator.hh:13\n+Dune::DenseMatrix\n+A dense n x m matrix.\n+Definition: densematrix.hh:140\n+Dune::DenseMatrix<_DynamicMatrix<_K_>_>::operator=\n+derived_type & operator=(const RHS &rhs)\n+Definition: densematrix.hh:279\n+Dune::DenseMatrix<_DynamicMatrix<_K_>_>::M\n+constexpr size_type M() const\n+number of columns\n+Definition: densematrix.hh:703\n+Dune::DenseMatrix<_DynamicMatrix<_K_>_>::value_type\n+Traits::value_type value_type\n+export the type representing the field\n+Definition: densematrix.hh:157\n+Dune::DenseMatrix<_DynamicMatrix<_K_>_>::rows\n+constexpr size_type rows() const\n+number of rows\n+Definition: densematrix.hh:709\n+Dune::DenseMatrix<_DynamicMatrix<_K_>_>::N\n+constexpr size_type N() const\n+number of rows\n+Definition: densematrix.hh:697\n+Dune::DenseMatrix<_DynamicMatrix<_K_>_>::size_type\n+Traits::size_type size_type\n+The type used for the index access and size operation.\n+Definition: densematrix.hh:166\n+Dune::DynamicMatrix\n+Construct a matrix with a dynamic size.\n+Definition: dynmatrix.hh:61\n+Dune::DynamicMatrix::mat_cols\n+size_type mat_cols() const\n+Definition: dynmatrix.hh:143\n+Dune::DynamicMatrix::DynamicMatrix\n+DynamicMatrix(std::initializer_list< DynamicVector< K > > const &ll)\n+Constructor initializing the matrix from a list of vector.\n+Definition: dynmatrix.hh:80\n+Dune::DynamicMatrix::row_type\n+Base::row_type row_type\n+Definition: dynmatrix.hh:67\n+Dune::DynamicMatrix::transposed\n+DynamicMatrix transposed() const\n+Return transposed of the matrix as DynamicMatrix.\n+Definition: dynmatrix.hh:132\n+Dune::DynamicMatrix::value_type\n+Base::value_type value_type\n+Definition: dynmatrix.hh:66\n+Dune::DynamicMatrix::mat_access\n+row_type & mat_access(size_type i)\n+Definition: dynmatrix.hh:147\n+Dune::DynamicMatrix::size_type\n+Base::size_type size_type\n+Definition: dynmatrix.hh:65\n+Dune::DynamicMatrix::mat_rows\n+size_type mat_rows() const\n+Definition: dynmatrix.hh:142\n+Dune::DynamicMatrix::DynamicMatrix\n+DynamicMatrix(T const &rhs)\n+Definition: dynmatrix.hh:87\n+Dune::DynamicMatrix::mat_access\n+const row_type & mat_access(size_type i) const\n+Definition: dynmatrix.hh:151\n+Dune::DynamicMatrix::resize\n+void resize(size_type r, size_type c, value_type v=value_type())\n+resize matrix to r \u00d7 c\n+Definition: dynmatrix.hh:106\n+Dune::DynamicMatrix::operator=\n+DynamicMatrix & operator=(T const &rhs)\n+Definition: dynmatrix.hh:116\n+Dune::DynamicMatrix::DynamicMatrix\n+DynamicMatrix()\n+Default constructor.\n+Definition: dynmatrix.hh:71\n+Dune::DynamicMatrix::DynamicMatrix\n+DynamicMatrix(size_type r, size_type c, value_type v=value_type())\n+Constructor initializing the whole matrix with a scalar.\n+Definition: dynmatrix.hh:74\n+Dune::DynamicMatrix::operator=\n+DynamicMatrix & operator=(T scalar)\n+Definition: dynmatrix.hh:126\n+Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>::size_type\n+container_type::size_type size_type\n+Definition: dynmatrix.hh:45\n+Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>::row_type\n+DynamicVector< K > row_type\n+Definition: dynmatrix.hh:38\n+Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>::row_reference\n+row_type & row_reference\n+Definition: dynmatrix.hh:40\n+Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>::value_type\n+K value_type\n+Definition: dynmatrix.hh:44\n+Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>::derived_type\n+DynamicMatrix< K > derived_type\n+Definition: dynmatrix.hh:36\n+Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>::const_row_reference\n+const row_type & const_row_reference\n+Definition: dynmatrix.hh:41\n+Dune::DenseMatVecTraits<_DynamicMatrix<_K_>_>::container_type\n+std::vector< K > container_type\n+Definition: dynmatrix.hh:43\n+Dune::FieldTraits<_DynamicMatrix<_K_>_>::real_type\n+FieldTraits< K >::real_type real_type\n+Definition: dynmatrix.hh:52\n+Dune::FieldTraits<_DynamicMatrix<_K_>_>::field_type\n+FieldTraits< K >::field_type field_type\n+Definition: dynmatrix.hh:51\n+Dune::DynamicVector\n+Construct a vector with a dynamic size.\n+Definition: dynvector.hh:59\n+Dune::FieldTraits\n+Definition: ftraits.hh:26\n+Dune::FieldTraits::field_type\n+T field_type\n+export the type representing the field\n+Definition: ftraits.hh:28\n+Dune::FieldTraits::real_type\n+T real_type\n+export the type representing the real type of the field\n+Definition: ftraits.hh:30\n+Dune::DenseMatVecTraits\n+Definition: matvectraits.hh:31\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00107.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00107.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: apply.hh File Reference\n+dune-common: densevector.hh File Reference\n \n \n \n \n \n \n \n@@ -58,36 +58,60 @@\n \n \n \n \n \n
    \n \n-
    apply.hh File Reference
    \n+
    densevector.hh File Reference
    \n
    \n
    \n-
    #include <tuple>
    \n+\n+

    Implements the dense vector interface, with an exchangeable storage class. \n+More...

    \n+
    #include <algorithm>
    \n+#include <limits>
    \n+#include <type_traits>
    \n+#include "genericiterator.hh"
    \n+#include "ftraits.hh"
    \n+#include "matvectraits.hh"
    \n+#include "promotiontraits.hh"
    \n+#include "dotproduct.hh"
    \n+#include "boundschecking.hh"
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+Classes

    struct  Dune::FieldTraits< DenseVector< V > >
     
    class  Dune::DenseIterator< C, T, R >
     Generic iterator class for dense vector and matrix implementations. More...
     
    class  Dune::DenseVector< V >
     Interface for a class of dense vectors over a given field. More...
     
    \n \n \n \n \n-\n-\n+\n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::Std
     Namespace for features backported from new C++ standards.
    namespace  Dune::fvmeta
     
    \n-
    \n+

    Detailed Description

    \n+

    Implements the dense vector interface, with an exchangeable storage class.

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,22 +4,43 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-Namespaces\n-apply.hh File Reference\n-#include \n+Classes | Namespaces\n+densevector.hh File Reference\n+Common \u00bb Dense_Matrix_and_Vector_Template_Library\n+Implements the dense vector interface, with an exchangeable storage class.\n+More...\n+#include \n+#include \n+#include \n+#include \"genericiterator.hh\"\n+#include \"ftraits.hh\"\n+#include \"matvectraits.hh\"\n+#include \"promotiontraits.hh\"\n+#include \"dotproduct.hh\"\n+#include \"boundschecking.hh\"\n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::FieldTraits<_DenseVector<_V_>_>\n+\u00a0\n+ class \u00a0Dune::DenseIterator<_C,_T,_R_>\n+\u00a0 Generic iterator class for dense vector and matrix implementations.\n+ More...\n+\u00a0\n+ class \u00a0Dune::DenseVector<_V_>\n+\u00a0 Interface for a class of dense vectors over a given field. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::Std\n-\u00a0 Namespace for features backported from new C++ standards.\n+namespace \u00a0Dune::fvmeta\n \u00a0\n+***** Detailed Description *****\n+Implements the dense vector interface, with an exchangeable storage class.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00107_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: apply.hh Source File\n+dune-common: densevector.hh Source File\n \n \n \n \n \n \n \n@@ -58,42 +58,711 @@\n \n \n \n \n \n
    \n-
    apply.hh
    \n+
    densevector.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_STD_APPLY_HH
    \n-
    6#define DUNE_COMMON_STD_APPLY_HH
    \n+
    5#ifndef DUNE_DENSEVECTOR_HH
    \n+
    6#define DUNE_DENSEVECTOR_HH
    \n
    7
    \n-
    8#include <tuple>
    \n-
    9
    \n-
    10namespace Dune
    \n-
    11{
    \n-
    12 namespace Std
    \n-
    13 {
    \n-
    14
    \n-
    17 using std::apply;
    \n+
    8#include <algorithm>
    \n+
    9#include <limits>
    \n+
    10#include <type_traits>
    \n+
    11
    \n+
    12#include "genericiterator.hh"
    \n+
    13#include "ftraits.hh"
    \n+
    14#include "matvectraits.hh"
    \n+
    15#include "promotiontraits.hh"
    \n+
    16#include "dotproduct.hh"
    \n+
    17#include "boundschecking.hh"
    \n
    18
    \n-
    19 } // namespace Std
    \n-
    20} // namespace Dune
    \n-
    21
    \n-
    22#endif // #ifndef DUNE_COMMON_STD_APPLY_HH
    \n+
    19namespace Dune {
    \n+
    20
    \n+
    21 // forward declaration of template
    \n+
    22 template<typename V> class DenseVector;
    \n+
    23
    \n+
    24 template<typename V>
    \n+\n+
    26 {
    \n+\n+\n+
    29 };
    \n+
    30
    \n+
    40 namespace fvmeta
    \n+
    41 {
    \n+
    46 template<class K>
    \n+
    47 inline typename FieldTraits<K>::real_type absreal (const K& k)
    \n+
    48 {
    \n+
    49 using std::abs;
    \n+
    50 return abs(k);
    \n+
    51 }
    \n+
    52
    \n+
    57 template<class K>
    \n+
    58 inline typename FieldTraits<K>::real_type absreal (const std::complex<K>& c)
    \n+
    59 {
    \n+
    60 using std::abs;
    \n+
    61 return abs(c.real()) + abs(c.imag());
    \n+
    62 }
    \n+
    63
    \n+
    68 template<class K>
    \n+
    69 inline typename FieldTraits<K>::real_type abs2 (const K& k)
    \n+
    70 {
    \n+
    71 return k*k;
    \n+
    72 }
    \n+
    73
    \n+
    78 template<class K>
    \n+
    79 inline typename FieldTraits<K>::real_type abs2 (const std::complex<K>& c)
    \n+
    80 {
    \n+
    81 return c.real()*c.real() + c.imag()*c.imag();
    \n+
    82 }
    \n+
    83
    \n+
    88 template<class K, bool isInteger = std::numeric_limits<K>::is_integer>
    \n+
    89 struct Sqrt
    \n+
    90 {
    \n+
    91 static inline typename FieldTraits<K>::real_type sqrt (const K& k)
    \n+
    92 {
    \n+
    93 using std::sqrt;
    \n+
    94 return sqrt(k);
    \n+
    95 }
    \n+
    96 };
    \n+
    97
    \n+
    102 template<class K>
    \n+
    103 struct Sqrt<K, true>
    \n+
    104 {
    \n+
    105 static inline typename FieldTraits<K>::real_type sqrt (const K& k)
    \n+
    106 {
    \n+
    107 using std::sqrt;
    \n+
    108 return typename FieldTraits<K>::real_type(sqrt(double(k)));
    \n+
    109 }
    \n+
    110 };
    \n+
    111
    \n+
    116 template<class K>
    \n+
    117 inline typename FieldTraits<K>::real_type sqrt (const K& k)
    \n+
    118 {
    \n+
    119 return Sqrt<K>::sqrt(k);
    \n+
    120 }
    \n+
    121
    \n+
    122 }
    \n+
    123
    \n+
    128 template<class C, class T, class R =T&>
    \n+\n+
    130 public Dune::RandomAccessIteratorFacade<DenseIterator<C,T,R>,T, R, std::ptrdiff_t>
    \n+
    131 {
    \n+
    132 friend class DenseIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type >;
    \n+
    133 friend class DenseIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type >;
    \n+
    134
    \n+
    135 typedef DenseIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type > MutableIterator;
    \n+
    136 typedef DenseIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type > ConstIterator;
    \n+
    137 public:
    \n+
    138
    \n+
    142 typedef std::ptrdiff_t DifferenceType;
    \n+
    143
    \n+
    147 typedef typename C::size_type SizeType;
    \n+
    148
    \n+
    149 // Constructors needed by the base iterators.
    \n+\n+
    151 : container_(0), position_()
    \n+
    152 {}
    \n+
    153
    \n+\n+
    155 : container_(&cont), position_(pos)
    \n+
    156 {}
    \n+
    157
    \n+\n+
    159 : container_(other.container_), position_(other.position_)
    \n+
    160 {}
    \n+
    161
    \n+\n+
    163 : container_(other.container_), position_(other.position_)
    \n+
    164 {}
    \n+
    165
    \n+
    166 // Methods needed by the forward iterator
    \n+
    167 bool equals(const MutableIterator &other) const
    \n+
    168 {
    \n+
    169 return position_ == other.position_ && container_ == other.container_;
    \n+
    170 }
    \n+
    171
    \n+
    172
    \n+
    173 bool equals(const ConstIterator & other) const
    \n+
    174 {
    \n+
    175 return position_ == other.position_ && container_ == other.container_;
    \n+
    176 }
    \n+
    177
    \n+
    178 R dereference() const {
    \n+
    179 return container_->operator[](position_);
    \n+
    180 }
    \n+
    181
    \n+
    182 void increment(){
    \n+
    183 ++position_;
    \n+
    184 }
    \n+
    185
    \n+
    186 // Additional function needed by BidirectionalIterator
    \n+
    187 void decrement(){
    \n+
    188 --position_;
    \n+
    189 }
    \n+
    190
    \n+
    191 // Additional function needed by RandomAccessIterator
    \n+\n+
    193 return container_->operator[](position_+i);
    \n+
    194 }
    \n+
    195
    \n+\n+
    197 position_=position_+n;
    \n+
    198 }
    \n+
    199
    \n+
    200 DifferenceType distanceTo(DenseIterator<const typename std::remove_const<C>::type,const typename std::remove_const<T>::type> other) const
    \n+
    201 {
    \n+
    202 assert(other.container_==container_);
    \n+
    203 return static_cast< DifferenceType >( other.position_ ) - static_cast< DifferenceType >( position_ );
    \n+
    204 }
    \n+
    205
    \n+
    206 DifferenceType distanceTo(DenseIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type> other) const
    \n+
    207 {
    \n+
    208 assert(other.container_==container_);
    \n+
    209 return static_cast< DifferenceType >( other.position_ ) - static_cast< DifferenceType >( position_ );
    \n+
    210 }
    \n+
    211
    \n+\n+
    214 {
    \n+
    215 return this->position_;
    \n+
    216 }
    \n+
    217
    \n+
    218 private:
    \n+
    219 C *container_;
    \n+
    220 SizeType position_;
    \n+
    221 };
    \n+
    222
    \n+
    227 template<typename V>
    \n+\n+
    229 {
    \n+\n+
    231 // typedef typename Traits::value_type K;
    \n+
    232
    \n+
    233 // Curiously recurring template pattern
    \n+
    234 V & asImp() { return static_cast<V&>(*this); }
    \n+
    235 const V & asImp() const { return static_cast<const V&>(*this); }
    \n+
    236
    \n+
    237 protected:
    \n+
    238 // construction allowed to derived classes only
    \n+
    239 constexpr DenseVector() = default;
    \n+
    240 // copying only allowed by derived classes
    \n+
    241 DenseVector(const DenseVector&) = default;
    \n+
    242
    \n+
    243 public:
    \n+
    244 //===== type definitions and constants
    \n+
    245
    \n+
    247 typedef typename Traits::derived_type derived_type;
    \n+
    248
    \n+
    250 typedef typename Traits::value_type value_type;
    \n+
    251
    \n+\n+
    254
    \n+
    256 typedef typename Traits::value_type block_type;
    \n+
    257
    \n+
    259 typedef typename Traits::size_type size_type;
    \n+
    260
    \n+
    262 constexpr static int blocklevel = 1;
    \n+
    263
    \n+
    264 //===== assignment from scalar
    \n+\n+
    267 {
    \n+
    268 for (size_type i=0; i<size(); i++)
    \n+
    269 asImp()[i] = k;
    \n+
    270 return asImp();
    \n+
    271 }
    \n+
    272
    \n+
    273 //===== assignment from other DenseVectors
    \n+
    274 protected:
    \n+\n+
    277
    \n+
    278 public:
    \n+
    279
    \n+
    281 template <typename W,
    \n+
    282 std::enable_if_t<
    \n+
    283 std::is_assignable<value_type&, typename DenseVector<W>::value_type>::value, int> = 0>
    \n+\n+
    285 {
    \n+
    286 assert(other.size() == size());
    \n+
    287 for (size_type i=0; i<size(); i++)
    \n+
    288 asImp()[i] = other[i];
    \n+
    289 return asImp();
    \n+
    290 }
    \n+
    291
    \n+
    292 //===== access to components
    \n+
    293
    \n+\n+
    296 {
    \n+
    297 return asImp()[i];
    \n+
    298 }
    \n+
    299
    \n+\n+
    301 {
    \n+
    302 return asImp()[i];
    \n+
    303 }
    \n+
    304
    \n+\n+
    307 {
    \n+
    308 return asImp()[0];
    \n+
    309 }
    \n+
    310
    \n+
    312 const value_type& front() const
    \n+
    313 {
    \n+
    314 return asImp()[0];
    \n+
    315 }
    \n+
    316
    \n+\n+
    319 {
    \n+
    320 return asImp()[size()-1];
    \n+
    321 }
    \n+
    322
    \n+
    324 const value_type& back() const
    \n+
    325 {
    \n+
    326 return asImp()[size()-1];
    \n+
    327 }
    \n+
    328
    \n+
    330 bool empty() const
    \n+
    331 {
    \n+
    332 return size() == 0;
    \n+
    333 }
    \n+
    334
    \n+\n+
    337 {
    \n+
    338 return asImp().size();
    \n+
    339 }
    \n+
    340
    \n+\n+\n+
    345
    \n+\n+
    348 {
    \n+
    349 return Iterator(*this,0);
    \n+
    350 }
    \n+
    351
    \n+\n+
    354 {
    \n+
    355 return Iterator(*this,size());
    \n+
    356 }
    \n+
    357
    \n+\n+
    361 {
    \n+
    362 return Iterator(*this,size()-1);
    \n+
    363 }
    \n+
    364
    \n+\n+
    368 {
    \n+
    369 return Iterator(*this,-1);
    \n+
    370 }
    \n+
    371
    \n+\n+
    374 {
    \n+
    375 return Iterator(*this,std::min(i,size()));
    \n+
    376 }
    \n+
    377
    \n+\n+\n+
    382
    \n+\n+
    385 {
    \n+
    386 return ConstIterator(*this,0);
    \n+
    387 }
    \n+
    388
    \n+\n+
    391 {
    \n+
    392 return ConstIterator(*this,size());
    \n+
    393 }
    \n+
    394
    \n+\n+
    398 {
    \n+
    399 return ConstIterator(*this,size()-1);
    \n+
    400 }
    \n+
    401
    \n+\n+
    405 {
    \n+
    406 return ConstIterator(*this,-1);
    \n+
    407 }
    \n+
    408
    \n+\n+
    411 {
    \n+
    412 return ConstIterator(*this,std::min(i,size()));
    \n+
    413 }
    \n+
    414
    \n+
    415 //===== vector space arithmetic
    \n+
    416
    \n+
    418 template <class Other>
    \n+\n+
    420 {
    \n+
    421 DUNE_ASSERT_BOUNDS(x.size() == size());
    \n+
    422 for (size_type i=0; i<size(); i++)
    \n+
    423 (*this)[i] += x[i];
    \n+
    424 return asImp();
    \n+
    425 }
    \n+
    426
    \n+
    428 template <class Other>
    \n+\n+
    430 {
    \n+
    431 DUNE_ASSERT_BOUNDS(x.size() == size());
    \n+
    432 for (size_type i=0; i<size(); i++)
    \n+
    433 (*this)[i] -= x[i];
    \n+
    434 return asImp();
    \n+
    435 }
    \n+
    436
    \n+
    438 template <class Other>
    \n+\n+
    440 {
    \n+
    441 derived_type z = asImp();
    \n+
    442 return (z+=b);
    \n+
    443 }
    \n+
    444
    \n+
    446 template <class Other>
    \n+\n+
    448 {
    \n+
    449 derived_type z = asImp();
    \n+
    450 return (z-=b);
    \n+
    451 }
    \n+
    452
    \n+\n+
    455 {
    \n+
    456 V result;
    \n+
    457 using idx_type = typename decltype(result)::size_type;
    \n+
    458
    \n+
    459 for (idx_type i = 0; i < size(); ++i)
    \n+
    460 result[i] = -asImp()[i];
    \n+
    461
    \n+
    462 return result;
    \n+
    463 }
    \n+
    464
    \n+
    466
    \n+
    474 template <typename ValueType>
    \n+
    475 typename std::enable_if<
    \n+
    476 std::is_convertible<ValueType, value_type>::value,
    \n+\n+
    478 >::type&
    \n+
    479 operator+= (const ValueType& kk)
    \n+
    480 {
    \n+
    481 const value_type& k = kk;
    \n+
    482 for (size_type i=0; i<size(); i++)
    \n+
    483 (*this)[i] += k;
    \n+
    484 return asImp();
    \n+
    485 }
    \n+
    486
    \n+
    488
    \n+
    496 template <typename ValueType>
    \n+
    497 typename std::enable_if<
    \n+
    498 std::is_convertible<ValueType, value_type>::value,
    \n+\n+
    500 >::type&
    \n+
    501 operator-= (const ValueType& kk)
    \n+
    502 {
    \n+
    503 const value_type& k = kk;
    \n+
    504 for (size_type i=0; i<size(); i++)
    \n+
    505 (*this)[i] -= k;
    \n+
    506 return asImp();
    \n+
    507 }
    \n+
    508
    \n+
    510
    \n+
    518 template <typename FieldType>
    \n+
    519 typename std::enable_if<
    \n+
    520 std::is_convertible<FieldType, field_type>::value,
    \n+\n+
    522 >::type&
    \n+
    523 operator*= (const FieldType& kk)
    \n+
    524 {
    \n+
    525 const field_type& k = kk;
    \n+
    526 for (size_type i=0; i<size(); i++)
    \n+
    527 (*this)[i] *= k;
    \n+
    528 return asImp();
    \n+
    529 }
    \n+
    530
    \n+
    532
    \n+
    540 template <typename FieldType>
    \n+
    541 typename std::enable_if<
    \n+
    542 std::is_convertible<FieldType, field_type>::value,
    \n+\n+
    544 >::type&
    \n+
    545 operator/= (const FieldType& kk)
    \n+
    546 {
    \n+
    547 const field_type& k = kk;
    \n+
    548 for (size_type i=0; i<size(); i++)
    \n+
    549 (*this)[i] /= k;
    \n+
    550 return asImp();
    \n+
    551 }
    \n+
    552
    \n+
    554 template <class Other>
    \n+
    555 bool operator== (const DenseVector<Other>& x) const
    \n+
    556 {
    \n+
    557 DUNE_ASSERT_BOUNDS(x.size() == size());
    \n+
    558 for (size_type i=0; i<size(); i++)
    \n+
    559 if ((*this)[i]!=x[i])
    \n+
    560 return false;
    \n+
    561
    \n+
    562 return true;
    \n+
    563 }
    \n+
    564
    \n+
    566 template <class Other>
    \n+
    567 bool operator!= (const DenseVector<Other>& x) const
    \n+
    568 {
    \n+
    569 return !operator==(x);
    \n+
    570 }
    \n+
    571
    \n+
    572
    \n+
    574 template <class Other>
    \n+\n+
    576 {
    \n+
    577 DUNE_ASSERT_BOUNDS(x.size() == size());
    \n+
    578 for (size_type i=0; i<size(); i++)
    \n+
    579 (*this)[i] += a*x[i];
    \n+
    580 return asImp();
    \n+
    581 }
    \n+
    582
    \n+
    590 template<class Other>
    \n+\n+
    592 typedef typename PromotionTraits<field_type, typename DenseVector<Other>::field_type>::PromotedType PromotedType;
    \n+
    593 PromotedType result(0);
    \n+
    594 assert(x.size() == size());
    \n+
    595 for (size_type i=0; i<size(); i++) {
    \n+
    596 result += PromotedType((*this)[i]*x[i]);
    \n+
    597 }
    \n+
    598 return result;
    \n+
    599 }
    \n+
    600
    \n+
    608 template<class Other>
    \n+\n+
    610 typedef typename PromotionTraits<field_type, typename DenseVector<Other>::field_type>::PromotedType PromotedType;
    \n+
    611 PromotedType result(0);
    \n+
    612 assert(x.size() == size());
    \n+
    613 for (size_type i=0; i<size(); i++) {
    \n+
    614 result += Dune::dot((*this)[i],x[i]);
    \n+
    615 }
    \n+
    616 return result;
    \n+
    617 }
    \n+
    618
    \n+
    619 //===== norms
    \n+
    620
    \n+\n+
    623 using std::abs;
    \n+
    624 typename FieldTraits<value_type>::real_type result( 0 );
    \n+
    625 for (size_type i=0; i<size(); i++)
    \n+
    626 result += abs((*this)[i]);
    \n+
    627 return result;
    \n+
    628 }
    \n+
    629
    \n+
    630
    \n+\n+
    633 {
    \n+
    634 typename FieldTraits<value_type>::real_type result( 0 );
    \n+
    635 for (size_type i=0; i<size(); i++)
    \n+
    636 result += fvmeta::absreal((*this)[i]);
    \n+
    637 return result;
    \n+
    638 }
    \n+
    639
    \n+\n+
    642 {
    \n+
    643 typename FieldTraits<value_type>::real_type result( 0 );
    \n+
    644 for (size_type i=0; i<size(); i++)
    \n+
    645 result += fvmeta::abs2((*this)[i]);
    \n+
    646 return fvmeta::sqrt(result);
    \n+
    647 }
    \n+
    648
    \n+\n+
    651 {
    \n+
    652 typename FieldTraits<value_type>::real_type result( 0 );
    \n+
    653 for (size_type i=0; i<size(); i++)
    \n+
    654 result += fvmeta::abs2((*this)[i]);
    \n+
    655 return result;
    \n+
    656 }
    \n+
    657
    \n+
    659 template <typename vt = value_type,
    \n+
    660 typename std::enable_if<!HasNaN<vt>::value, int>::type = 0>
    \n+\n+
    662 using real_type = typename FieldTraits<vt>::real_type;
    \n+
    663 using std::abs;
    \n+
    664 using std::max;
    \n+
    665
    \n+
    666 real_type norm = 0;
    \n+
    667 for (auto const &x : *this) {
    \n+
    668 real_type const a = abs(x);
    \n+
    669 norm = max(a, norm);
    \n+
    670 }
    \n+
    671 return norm;
    \n+
    672 }
    \n+
    673
    \n+
    675 template <typename vt = value_type,
    \n+
    676 typename std::enable_if<!HasNaN<vt>::value, int>::type = 0>
    \n+\n+
    678 using real_type = typename FieldTraits<vt>::real_type;
    \n+
    679 using std::max;
    \n+
    680
    \n+
    681 real_type norm = 0;
    \n+
    682 for (auto const &x : *this) {
    \n+
    683 real_type const a = fvmeta::absreal(x);
    \n+
    684 norm = max(a, norm);
    \n+
    685 }
    \n+
    686 return norm;
    \n+
    687 }
    \n+
    688
    \n+
    690 template <typename vt = value_type,
    \n+
    691 typename std::enable_if<HasNaN<vt>::value, int>::type = 0>
    \n+\n+
    693 using real_type = typename FieldTraits<vt>::real_type;
    \n+
    694 using std::abs;
    \n+
    695 using std::max;
    \n+
    696
    \n+
    697 real_type norm = 0;
    \n+
    698 real_type isNaN = 1;
    \n+
    699 for (auto const &x : *this) {
    \n+
    700 real_type const a = abs(x);
    \n+
    701 norm = max(a, norm);
    \n+
    702 isNaN += a;
    \n+
    703 }
    \n+
    704 return norm * (isNaN / isNaN);
    \n+
    705 }
    \n+
    706
    \n+
    708 template <typename vt = value_type,
    \n+
    709 typename std::enable_if<HasNaN<vt>::value, int>::type = 0>
    \n+\n+
    711 using real_type = typename FieldTraits<vt>::real_type;
    \n+
    712 using std::max;
    \n+
    713
    \n+
    714 real_type norm = 0;
    \n+
    715 real_type isNaN = 1;
    \n+
    716 for (auto const &x : *this) {
    \n+
    717 real_type const a = fvmeta::absreal(x);
    \n+
    718 norm = max(a, norm);
    \n+
    719 isNaN += a;
    \n+
    720 }
    \n+
    721 return norm * (isNaN / isNaN);
    \n+
    722 }
    \n+
    723
    \n+
    724 //===== sizes
    \n+
    725
    \n+
    727 size_type N () const
    \n+
    728 {
    \n+
    729 return size();
    \n+
    730 }
    \n+
    731
    \n+
    733 size_type dim () const
    \n+
    734 {
    \n+
    735 return size();
    \n+
    736 }
    \n+
    737
    \n+
    738 };
    \n+
    739
    \n+
    748 template<typename V>
    \n+
    749 std::ostream& operator<< (std::ostream& s, const DenseVector<V>& v)
    \n+
    750 {
    \n+
    751 for (typename DenseVector<V>::size_type i=0; i<v.size(); i++)
    \n+
    752 s << ((i>0) ? " " : "") << v[i];
    \n+
    753 return s;
    \n+
    754 }
    \n+
    755
    \n+
    758} // end namespace
    \n+
    759
    \n+
    760#endif // DUNE_DENSEVECTOR_HH
    \n+
    Implements a generic iterator class for writing stl conformant iterators.
    \n+
    Macro for wrapping boundary checks.
    \n+
    Compute type of the result of an arithmetic operation involving two different number types.
    \n+
    Provides the functions dot(a,b) := and dotT(a,b) := .
    \n+
    Documentation of the traits classes you need to write for each implementation of DenseVector or Dense...
    \n+
    Type traits to determine the type of reals (when working with complex numbers)
    \n+
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition: boundschecking.hh:30
    \n+
    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
    \n+
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition: bigunsignedint.hh:278
    \n+
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition: debugalign.hh:447
    \n+
    auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition: debugalign.hh:425
    \n+
    bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
    Definition: fvector.hh:604
    \n+
    Interface for a class of dense vectors over a given field.
    Definition: densevector.hh:229
    \n+
    Traits::value_type value_type
    export the type representing the field
    Definition: densevector.hh:250
    \n+
    FieldTraits< value_type >::real_type two_norm2() const
    square of two norm (sum over squared values of entries), need for block recursion
    Definition: densevector.hh:650
    \n+
    ConstIterator const_iterator
    typedef for stl compliant access
    Definition: densevector.hh:381
    \n+
    Iterator iterator
    typedef for stl compliant access
    Definition: densevector.hh:344
    \n+
    ConstIterator find(size_type i) const
    return iterator to given element or end()
    Definition: densevector.hh:410
    \n+
    ConstIterator end() const
    end ConstIterator
    Definition: densevector.hh:390
    \n+
    value_type & front()
    return reference to first element
    Definition: densevector.hh:306
    \n+
    FieldTraits< value_type >::real_type two_norm() const
    two norm sqrt(sum over squared values of entries)
    Definition: densevector.hh:641
    \n+
    ConstIterator beforeBegin() const
    Definition: densevector.hh:404
    \n+
    bool operator==(const DenseVector< Other > &x) const
    Binary vector comparison.
    Definition: densevector.hh:555
    \n+
    Iterator begin()
    begin iterator
    Definition: densevector.hh:347
    \n+
    Iterator beforeBegin()
    Definition: densevector.hh:367
    \n+
    DenseIterator< const DenseVector, const value_type > ConstIterator
    ConstIterator class for sequential access.
    Definition: densevector.hh:379
    \n+
    Traits::derived_type derived_type
    type of derived vector class
    Definition: densevector.hh:247
    \n+
    const value_type & front() const
    return reference to first element
    Definition: densevector.hh:312
    \n+
    derived_type operator+(const DenseVector< Other > &b) const
    Binary vector addition.
    Definition: densevector.hh:439
    \n+
    size_type size() const
    size method
    Definition: densevector.hh:336
    \n+
    size_type dim() const
    dimension of the vector space
    Definition: densevector.hh:733
    \n+
    FieldTraits< vt >::real_type infinity_norm() const
    infinity norm (maximum of absolute values of entries)
    Definition: densevector.hh:661
    \n+
    ConstIterator beforeEnd() const
    Definition: densevector.hh:397
    \n+
    derived_type & axpy(const field_type &a, const DenseVector< Other > &x)
    vector space axpy operation ( *this += a x )
    Definition: densevector.hh:575
    \n+
    derived_type & operator=(const value_type &k)
    Assignment operator for scalar.
    Definition: densevector.hh:266
    \n+
    static constexpr int blocklevel
    The number of block levels we contain. This is the leaf, that is, 1.
    Definition: densevector.hh:262
    \n+
    Iterator end()
    end iterator
    Definition: densevector.hh:353
    \n+
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition: densevector.hh:259
    \n+
    DenseIterator< DenseVector, value_type > Iterator
    Iterator class for sequential access.
    Definition: densevector.hh:342
    \n+
    derived_type & operator-=(const DenseVector< Other > &x)
    vector space subtraction
    Definition: densevector.hh:429
    \n+
    DenseVector(const DenseVector &)=default
    \n+
    Iterator beforeEnd()
    Definition: densevector.hh:360
    \n+
    derived_type & operator+=(const DenseVector< Other > &x)
    vector space addition
    Definition: densevector.hh:419
    \n+
    std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator*=(const FieldType &kk)
    vector space multiplication with scalar
    Definition: densevector.hh:523
    \n+
    bool operator!=(const DenseVector< Other > &x) const
    Binary vector incomparison.
    Definition: densevector.hh:567
    \n+
    const value_type & back() const
    return reference to last element
    Definition: densevector.hh:324
    \n+
    ConstIterator begin() const
    begin ConstIterator
    Definition: densevector.hh:384
    \n+
    PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType operator*(const DenseVector< Other > &x) const
    indefinite vector dot product which corresponds to Petsc's VecTDot
    Definition: densevector.hh:591
    \n+
    constexpr DenseVector()=default
    \n+
    FieldTraits< vt >::real_type infinity_norm_real() const
    simplified infinity norm (uses Manhattan norm for complex values)
    Definition: densevector.hh:677
    \n+
    DenseVector & operator=(const DenseVector &)=default
    Assignment operator for other DenseVector of same type.
    \n+
    Traits::value_type block_type
    export the type representing the components
    Definition: densevector.hh:256
    \n+
    value_type & operator[](size_type i)
    random access
    Definition: densevector.hh:295
    \n+
    FieldTraits< value_type >::field_type field_type
    export the type representing the field
    Definition: densevector.hh:253
    \n+
    value_type & back()
    return reference to last element
    Definition: densevector.hh:318
    \n+
    derived_type operator-() const
    Vector negation.
    Definition: densevector.hh:454
    \n+
    std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator/=(const FieldType &kk)
    vector space division by scalar
    Definition: densevector.hh:545
    \n+
    FieldTraits< value_type >::real_type one_norm_real() const
    simplified one norm (uses Manhattan norm for complex values)
    Definition: densevector.hh:632
    \n+
    PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType dot(const DenseVector< Other > &x) const
    vector dot product which corresponds to Petsc's VecDot
    Definition: densevector.hh:609
    \n+
    Iterator find(size_type i)
    return iterator to given element or end()
    Definition: densevector.hh:373
    \n+
    FieldTraits< value_type >::real_type one_norm() const
    one norm (sum over absolute values of entries)
    Definition: densevector.hh:622
    \n+
    size_type N() const
    number of blocks in the vector (are of size 1 here)
    Definition: densevector.hh:727
    \n+
    bool empty() const
    checks whether the container is empty
    Definition: densevector.hh:330
    \n+
    FieldTraits< typenameDenseMatVecTraits< V >::value_type >::real_type real_type
    Definition: densevector.hh:28
    \n+
    FieldTraits< typenameDenseMatVecTraits< V >::value_type >::field_type field_type
    Definition: densevector.hh:27
    \n+
    Generic iterator class for dense vector and matrix implementations.
    Definition: densevector.hh:131
    \n+
    void increment()
    Definition: densevector.hh:182
    \n+
    SizeType index() const
    return index
    Definition: densevector.hh:213
    \n+
    bool equals(const MutableIterator &other) const
    Definition: densevector.hh:167
    \n+
    DenseIterator(const MutableIterator &other)
    Definition: densevector.hh:158
    \n+
    bool equals(const ConstIterator &other) const
    Definition: densevector.hh:173
    \n+
    R elementAt(DifferenceType i) const
    Definition: densevector.hh:192
    \n+
    DifferenceType distanceTo(DenseIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T >::type > other) const
    Definition: densevector.hh:200
    \n+
    void decrement()
    Definition: densevector.hh:187
    \n+
    DenseIterator(const ConstIterator &other)
    Definition: densevector.hh:162
    \n+
    DifferenceType distanceTo(DenseIterator< typename std::remove_const< C >::type, typename std::remove_const< T >::type > other) const
    Definition: densevector.hh:206
    \n+
    DenseIterator(C &cont, SizeType pos)
    Definition: densevector.hh:154
    \n+
    std::ptrdiff_t DifferenceType
    The type of the difference between two positions.
    Definition: densevector.hh:142
    \n+
    R dereference() const
    Definition: densevector.hh:178
    \n+
    void advance(DifferenceType n)
    Definition: densevector.hh:196
    \n+
    C::size_type SizeType
    The type to index the underlying container.
    Definition: densevector.hh:147
    \n+
    Definition: ftraits.hh:26
    \n+
    T field_type
    export the type representing the field
    Definition: ftraits.hh:28
    \n+
    T real_type
    export the type representing the real type of the field
    Definition: ftraits.hh:30
    \n+
    get the 'mutable' version of a reference to a const object
    Definition: genericiterator.hh:116
    \n+
    Base class for stl conformant forward iterators.
    Definition: iteratorfacades.hh:434
    \n+
    Definition: matvectraits.hh:31
    \n+
    Compute type of the result of an arithmetic operation involving two different number types.
    Definition: promotiontraits.hh:27
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,37 +4,958 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-apply.hh\n+densevector.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_STD_APPLY_HH\n- 6#define DUNE_COMMON_STD_APPLY_HH\n+ 5#ifndef DUNE_DENSEVECTOR_HH\n+ 6#define DUNE_DENSEVECTOR_HH\n 7\n- 8#include \n- 9\n- 10namespace Dune\n- 11{\n-12 namespace Std\n- 13 {\n- 14\n- 17 using std::apply;\n+ 8#include \n+ 9#include \n+ 10#include \n+ 11\n+ 12#include \"genericiterator.hh\"\n+ 13#include \"ftraits.hh\"\n+ 14#include \"matvectraits.hh\"\n+ 15#include \"promotiontraits.hh\"\n+ 16#include \"dotproduct.hh\"\n+ 17#include \"boundschecking.hh\"\n 18\n- 19 } // namespace Std\n- 20} // namespace Dune\n- 21\n- 22#endif // #ifndef DUNE_COMMON_STD_APPLY_HH\n+ 19namespace Dune {\n+ 20\n+ 21 // forward declaration of template\n+ 22 template class DenseVector;\n+ 23\n+ 24 template\n+25 struct FieldTraits< DenseVector >\n+ 26 {\n+27 typedef typename FieldTraits<_typename_DenseMatVecTraits::value_type >::\n+field_type field_type;\n+28 typedef typename FieldTraits<_typename_DenseMatVecTraits::value_type >::\n+real_type real_type;\n+ 29 };\n+ 30\n+40 namespace fvmeta\n+ 41 {\n+ 46 template\n+ 47 inline typename FieldTraits::real_type absreal (const K& k)\n+ 48 {\n+ 49 using std::abs;\n+ 50 return abs(k);\n+ 51 }\n+ 52\n+ 57 template\n+ 58 inline typename FieldTraits::real_type absreal (const std::complex&\n+c)\n+ 59 {\n+ 60 using std::abs;\n+ 61 return abs(c.real()) + abs(c.imag());\n+ 62 }\n+ 63\n+ 68 template\n+ 69 inline typename FieldTraits::real_type abs2 (const K& k)\n+ 70 {\n+ 71 return k*k;\n+ 72 }\n+ 73\n+ 78 template\n+ 79 inline typename FieldTraits::real_type abs2 (const std::complex& c)\n+ 80 {\n+ 81 return c.real()*c.real() + c.imag()*c.imag();\n+ 82 }\n+ 83\n+ 88 template::is_integer>\n+ 89 struct Sqrt\n+ 90 {\n+ 91 static inline typename FieldTraits::real_type sqrt (const K& k)\n+ 92 {\n+ 93 using std::sqrt;\n+ 94 return sqrt(k);\n+ 95 }\n+ 96 };\n+ 97\n+ 102 template\n+ 103 struct Sqrt\n+ 104 {\n+105 static inline typename FieldTraits::real_type sqrt (const K& k)\n+ 106 {\n+ 107 using std::sqrt;\n+ 108 return typename FieldTraits::real_type(sqrt(double(k)));\n+ 109 }\n+ 110 };\n+ 111\n+ 116 template\n+ 117 inline typename FieldTraits::real_type sqrt (const K& k)\n+ 118 {\n+ 119 return Sqrt::sqrt(k);\n+ 120 }\n+ 121\n+ 122 }\n+ 123\n+ 128 template\n+129 class DenseIterator :\n+ 130 public Dune::RandomAccessIteratorFacade,T, R, std::\n+ptrdiff_t>\n+ 131 {\n+ 132 friend class DenseIterator::type, typename\n+std::remove_const::type, typename mutable_reference::type >;\n+ 133 friend class DenseIterator::type,\n+const typename std::remove_const::type, typename const_reference::type >;\n+ 134\n+ 135 typedef DenseIterator::type, typename std::\n+remove_const::type, typename mutable_reference::type > MutableIterator;\n+ 136 typedef DenseIterator::type, const\n+typename std::remove_const::type, typename const_reference::type >\n+ConstIterator;\n+ 137 public:\n+ 138\n+142 typedef std::ptrdiff_t DifferenceType;\n+ 143\n+147 typedef typename C::size_type SizeType;\n+ 148\n+ 149 // Constructors needed by the base iterators.\n+150 DenseIterator()\n+ 151 : container_(0), position_()\n+ 152 {}\n+ 153\n+154 DenseIterator(C& cont, SizeType pos)\n+ 155 : container_(&cont), position_(pos)\n+ 156 {}\n+ 157\n+158 DenseIterator(const MutableIterator & other)\n+ 159 : container_(other.container_), position_(other.position_)\n+ 160 {}\n+ 161\n+162 DenseIterator(const ConstIterator & other)\n+ 163 : container_(other.container_), position_(other.position_)\n+ 164 {}\n+ 165\n+ 166 // Methods needed by the forward iterator\n+167 bool equals(const MutableIterator &other) const\n+ 168 {\n+ 169 return position_ == other.position_ && container_ == other.container_;\n+ 170 }\n+ 171\n+ 172\n+173 bool equals(const ConstIterator & other) const\n+ 174 {\n+ 175 return position_ == other.position_ && container_ == other.container_;\n+ 176 }\n+ 177\n+178 R dereference() const {\n+ 179 return container_->operator[](position_);\n+ 180 }\n+ 181\n+182 void increment(){\n+ 183 ++position_;\n+ 184 }\n+ 185\n+ 186 // Additional function needed by BidirectionalIterator\n+187 void decrement(){\n+ 188 --position_;\n+ 189 }\n+ 190\n+ 191 // Additional function needed by RandomAccessIterator\n+192 R elementAt(DifferenceType i) const {\n+ 193 return container_->operator[](position_+i);\n+ 194 }\n+ 195\n+196 void advance(DifferenceType n){\n+ 197 position_=position_+n;\n+ 198 }\n+ 199\n+200 DifferenceType distanceTo(DenseIterator::type,const typename std::remove_const::type> other) const\n+ 201 {\n+ 202 assert(other.container_==container_);\n+ 203 return static_cast< DifferenceType >( other.position_ ) - static_cast<\n+DifferenceType >( position_ );\n+ 204 }\n+ 205\n+206 DifferenceType distanceTo(DenseIterator::\n+type, typename std::remove_const::type> other) const\n+ 207 {\n+ 208 assert(other.container_==container_);\n+ 209 return static_cast< DifferenceType >( other.position_ ) - static_cast<\n+DifferenceType >( position_ );\n+ 210 }\n+ 211\n+213 SizeType index () const\n+ 214 {\n+ 215 return this->position_;\n+ 216 }\n+ 217\n+ 218 private:\n+ 219 C *container_;\n+ 220 SizeType position_;\n+ 221 };\n+ 222\n+ 227 template\n+228 class DenseVector\n+ 229 {\n+ 230 typedef DenseMatVecTraits Traits;\n+ 231 // typedef typename Traits::value_type K;\n+ 232\n+ 233 // Curiously recurring template pattern\n+ 234 V & asImp() { return static_cast(*this); }\n+ 235 const V & asImp() const { return static_cast(*this); }\n+ 236\n+ 237 protected:\n+ 238 // construction allowed to derived classes only\n+239 constexpr DenseVector() = default;\n+ 240 // copying only allowed by derived classes\n+241 DenseVector(const DenseVector&) = default;\n+ 242\n+ 243 public:\n+ 244 //===== type definitions and constants\n+ 245\n+247 typedef typename Traits::derived_type derived_type;\n+ 248\n+250 typedef typename Traits::value_type value_type;\n+ 251\n+253 typedef typename FieldTraits<_value_type_>::field_type field_type;\n+ 254\n+256 typedef typename Traits::value_type block_type;\n+ 257\n+259 typedef typename Traits::size_type size_type;\n+ 260\n+262 constexpr static int blocklevel = 1;\n+ 263\n+ 264 //===== assignment from scalar\n+266 inline derived_type& operator=(const value_type& k)\n+ 267 {\n+ 268 for (size_type i=0; i::value_type>::\n+value, int> = 0>\n+284 derived_type& operator=(const DenseVector& other)\n+ 285 {\n+ 286 assert(other.size() == size());\n+ 287 for (size_type i=0; i Iterator;\n+344 typedef Iterator iterator;\n+ 345\n+347 Iterator begin ()\n+ 348 {\n+ 349 return Iterator(*this,0);\n+ 350 }\n+ 351\n+353 Iterator end ()\n+ 354 {\n+ 355 return Iterator(*this,size());\n+ 356 }\n+ 357\n+360 Iterator beforeEnd ()\n+ 361 {\n+ 362 return Iterator(*this,size()-1);\n+ 363 }\n+ 364\n+367 Iterator beforeBegin ()\n+ 368 {\n+ 369 return Iterator(*this,-1);\n+ 370 }\n+ 371\n+373 Iterator find (size_type i)\n+ 374 {\n+ 375 return Iterator(*this,std::min(i,size()));\n+ 376 }\n+ 377\n+379 typedef DenseIterator ConstIterator;\n+381 typedef ConstIterator const_iterator;\n+ 382\n+384 ConstIterator begin () const\n+ 385 {\n+ 386 return ConstIterator(*this,0);\n+ 387 }\n+ 388\n+390 ConstIterator end () const\n+ 391 {\n+ 392 return ConstIterator(*this,size());\n+ 393 }\n+ 394\n+397 ConstIterator beforeEnd () const\n+ 398 {\n+ 399 return ConstIterator(*this,size()-1);\n+ 400 }\n+ 401\n+404 ConstIterator beforeBegin () const\n+ 405 {\n+ 406 return ConstIterator(*this,-1);\n+ 407 }\n+ 408\n+410 ConstIterator find (size_type i) const\n+ 411 {\n+ 412 return ConstIterator(*this,std::min(i,size()));\n+ 413 }\n+ 414\n+ 415 //===== vector space arithmetic\n+ 416\n+ 418 template \n+419 derived_type& operator+=(const DenseVector& x)\n+ 420 {\n+ 421 DUNE_ASSERT_BOUNDS(x.size() == size());\n+ 422 for (size_type i=0; i\n+429 derived_type& operator-=(const DenseVector& x)\n+ 430 {\n+ 431 DUNE_ASSERT_BOUNDS(x.size() == size());\n+ 432 for (size_type i=0; i\n+439 derived_type operator+(const DenseVector& b) const\n+ 440 {\n+ 441 derived_type z = asImp();\n+ 442 return (z+=b);\n+ 443 }\n+ 444\n+ 446 template \n+447 derived_type operator-(const DenseVector& b) const\n+ 448 {\n+ 449 derived_type z = asImp();\n+ 450 return (z-=b);\n+ 451 }\n+ 452\n+454 derived_type operator-() const\n+ 455 {\n+ 456 V result;\n+ 457 using idx_type = typename decltype(result)::size_type;\n+ 458\n+ 459 for (idx_type i = 0; i < size(); ++i)\n+ 460 result[i] = -asImp()[i];\n+ 461\n+ 462 return result;\n+ 463 }\n+ 464\n+ 466\n+ 474 template \n+ 475 typename std::enable_if<\n+ 476 std::is_convertible::value,\n+ 477 derived_type\n+ 478 >::type&\n+479 operator+=(const ValueType& kk)\n+ 480 {\n+ 481 const value_type& k = kk;\n+ 482 for (size_type i=0; i\n+ 497 typename std::enable_if<\n+ 498 std::is_convertible::value,\n+ 499 derived_type\n+ 500 >::type&\n+501 operator-=(const ValueType& kk)\n+ 502 {\n+ 503 const value_type& k = kk;\n+ 504 for (size_type i=0; i\n+ 519 typename std::enable_if<\n+ 520 std::is_convertible::value,\n+ 521 derived_type\n+ 522 >::type&\n+523 operator*=(const FieldType& kk)\n+ 524 {\n+ 525 const field_type& k = kk;\n+ 526 for (size_type i=0; i\n+ 541 typename std::enable_if<\n+ 542 std::is_convertible::value,\n+ 543 derived_type\n+ 544 >::type&\n+545 operator/=(const FieldType& kk)\n+ 546 {\n+ 547 const field_type& k = kk;\n+ 548 for (size_type i=0; i\n+555 bool operator==(const DenseVector& x) const\n+ 556 {\n+ 557 DUNE_ASSERT_BOUNDS(x.size() == size());\n+ 558 for (size_type i=0; i\n+567 bool operator!=(const DenseVector& x) const\n+ 568 {\n+ 569 return !operator==(x);\n+ 570 }\n+ 571\n+ 572\n+ 574 template \n+575 derived_type& axpy (const field_type& a, const DenseVector& x)\n+ 576 {\n+ 577 DUNE_ASSERT_BOUNDS(x.size() == size());\n+ 578 for (size_type i=0; i\n+591 typename PromotionTraits::\n+field_type>::PromotedType operator*(const DenseVector& x) const {\n+ 592 typedef typename PromotionTraits::\n+field_type>::PromotedType PromotedType;\n+ 593 PromotedType result(0);\n+ 594 assert(x.size() == size());\n+ 595 for (size_type i=0; i\n+609 typename PromotionTraits::\n+field_type>::PromotedType dot(const DenseVector& x) const {\n+ 610 typedef typename PromotionTraits::\n+field_type>::PromotedType PromotedType;\n+ 611 PromotedType result(0);\n+ 612 assert(x.size() == size());\n+ 613 for (size_type i=0; i::real_type one_norm() const {\n+ 623 using std::abs;\n+ 624 typename FieldTraits::real_type result( 0 );\n+ 625 for (size_type i=0; i::real_type one_norm_real () const\n+ 633 {\n+ 634 typename FieldTraits::real_type result( 0 );\n+ 635 for (size_type i=0; i::real_type two_norm () const\n+ 642 {\n+ 643 typename FieldTraits::real_type result( 0 );\n+ 644 for (size_type i=0; i::real_type two_norm2 () const\n+ 651 {\n+ 652 typename FieldTraits::real_type result( 0 );\n+ 653 for (size_type i=0; i::value, int>::type = 0>\n+661 typename FieldTraits::real_type infinity_norm() const {\n+ 662 using real_type = typename FieldTraits::real_type;\n+ 663 using std::abs;\n+ 664 using std::max;\n+ 665\n+ 666 real_type norm = 0;\n+ 667 for (auto const &x : *this) {\n+ 668 real_type const a = abs(x);\n+ 669 norm = max(a, norm);\n+ 670 }\n+ 671 return norm;\n+ 672 }\n+ 673\n+ 675 template ::value, int>::type = 0>\n+677 typename FieldTraits::real_type infinity_norm_real() const {\n+ 678 using real_type = typename FieldTraits::real_type;\n+ 679 using std::max;\n+ 680\n+ 681 real_type norm = 0;\n+ 682 for (auto const &x : *this) {\n+ 683 real_type const a = fvmeta::absreal(x);\n+ 684 norm = max(a, norm);\n+ 685 }\n+ 686 return norm;\n+ 687 }\n+ 688\n+ 690 template ::value, int>::type = 0>\n+692 typename FieldTraits::real_type infinity_norm() const {\n+ 693 using real_type = typename FieldTraits::real_type;\n+ 694 using std::abs;\n+ 695 using std::max;\n+ 696\n+ 697 real_type norm = 0;\n+ 698 real_type isNaN = 1;\n+ 699 for (auto const &x : *this) {\n+ 700 real_type const a = abs(x);\n+ 701 norm = max(a, norm);\n+ 702 isNaN += a;\n+ 703 }\n+ 704 return norm * (isNaN / isNaN);\n+ 705 }\n+ 706\n+ 708 template ::value, int>::type = 0>\n+710 typename FieldTraits::real_type infinity_norm_real() const {\n+ 711 using real_type = typename FieldTraits::real_type;\n+ 712 using std::max;\n+ 713\n+ 714 real_type norm = 0;\n+ 715 real_type isNaN = 1;\n+ 716 for (auto const &x : *this) {\n+ 717 real_type const a = fvmeta::absreal(x);\n+ 718 norm = max(a, norm);\n+ 719 isNaN += a;\n+ 720 }\n+ 721 return norm * (isNaN / isNaN);\n+ 722 }\n+ 723\n+ 724 //===== sizes\n+ 725\n+727 size_type N () const\n+ 728 {\n+ 729 return size();\n+ 730 }\n+ 731\n+733 size_type dim () const\n+ 734 {\n+ 735 return size();\n+ 736 }\n+ 737\n+ 738 };\n+ 739\n+ 748 template\n+749 std::ostream& operator<<(std::ostream& s, const DenseVector& v)\n+ 750 {\n+ 751 for (typename DenseVector::size_type i=0; i0) ? \" \" : \"\") << v[i];\n+ 753 return s;\n+ 754 }\n+ 755\n+ 758} // end namespace\n+ 759\n+ 760#endif // DUNE_DENSEVECTOR_HH\n+genericiterator.hh\n+Implements a generic iterator class for writing stl conformant iterators.\n+boundschecking.hh\n+Macro for wrapping boundary checks.\n+promotiontraits.hh\n+Compute type of the result of an arithmetic operation involving two different\n+number types.\n+dotproduct.hh\n+Provides the functions dot(a,b) := and dotT(a,b) := .\n+matvectraits.hh\n+Documentation of the traits classes you need to write for each implementation\n+of DenseVector or Dense...\n+ftraits.hh\n+Type traits to determine the type of reals (when working with complex numbers)\n+DUNE_ASSERT_BOUNDS\n+#define DUNE_ASSERT_BOUNDS(cond)\n+If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do\n+nothing.\n+Definition: boundschecking.hh:30\n+Dune::dot\n+auto dot(const A &a, const B &b) -> typename std::enable_if< IsNumber< A >::\n+value &&!IsVector< A >::value &&!std::is_same< typename FieldTraits< A >::\n+field_type, typename FieldTraits< A >::real_type > ::value, decltype(conj(a)\n+*b)>::type\n+computes the dot product for fundamental data types according to Petsc's\n+VectDot function: dot(a,...\n+Definition: dotproduct.hh:42\n+Dune::operator<<\n+std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)\n+Definition: bigunsignedint.hh:278\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n+Dune::AlignedNumberImpl::min\n+auto min(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n+&b)\n+Definition: debugalign.hh:447\n+Dune::AlignedNumberImpl::max\n+auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n+&b)\n+Definition: debugalign.hh:425\n+Dune::MathOverloads::isNaN\n+bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)\n+Definition: fvector.hh:604\n+Dune::DenseVector\n+Interface for a class of dense vectors over a given field.\n+Definition: densevector.hh:229\n+Dune::DenseVector::value_type\n+Traits::value_type value_type\n+export the type representing the field\n+Definition: densevector.hh:250\n+Dune::DenseVector::two_norm2\n+FieldTraits< value_type >::real_type two_norm2() const\n+square of two norm (sum over squared values of entries), need for block\n+recursion\n+Definition: densevector.hh:650\n+Dune::DenseVector::const_iterator\n+ConstIterator const_iterator\n+typedef for stl compliant access\n+Definition: densevector.hh:381\n+Dune::DenseVector::iterator\n+Iterator iterator\n+typedef for stl compliant access\n+Definition: densevector.hh:344\n+Dune::DenseVector::find\n+ConstIterator find(size_type i) const\n+return iterator to given element or end()\n+Definition: densevector.hh:410\n+Dune::DenseVector::end\n+ConstIterator end() const\n+end ConstIterator\n+Definition: densevector.hh:390\n+Dune::DenseVector::front\n+value_type & front()\n+return reference to first element\n+Definition: densevector.hh:306\n+Dune::DenseVector::two_norm\n+FieldTraits< value_type >::real_type two_norm() const\n+two norm sqrt(sum over squared values of entries)\n+Definition: densevector.hh:641\n+Dune::DenseVector::beforeBegin\n+ConstIterator beforeBegin() const\n+Definition: densevector.hh:404\n+Dune::DenseVector::operator==\n+bool operator==(const DenseVector< Other > &x) const\n+Binary vector comparison.\n+Definition: densevector.hh:555\n+Dune::DenseVector::begin\n+Iterator begin()\n+begin iterator\n+Definition: densevector.hh:347\n+Dune::DenseVector::beforeBegin\n+Iterator beforeBegin()\n+Definition: densevector.hh:367\n+Dune::DenseVector::ConstIterator\n+DenseIterator< const DenseVector, const value_type > ConstIterator\n+ConstIterator class for sequential access.\n+Definition: densevector.hh:379\n+Dune::DenseVector::derived_type\n+Traits::derived_type derived_type\n+type of derived vector class\n+Definition: densevector.hh:247\n+Dune::DenseVector::front\n+const value_type & front() const\n+return reference to first element\n+Definition: densevector.hh:312\n+Dune::DenseVector::operator+\n+derived_type operator+(const DenseVector< Other > &b) const\n+Binary vector addition.\n+Definition: densevector.hh:439\n+Dune::DenseVector::size\n+size_type size() const\n+size method\n+Definition: densevector.hh:336\n+Dune::DenseVector::dim\n+size_type dim() const\n+dimension of the vector space\n+Definition: densevector.hh:733\n+Dune::DenseVector::infinity_norm\n+FieldTraits< vt >::real_type infinity_norm() const\n+infinity norm (maximum of absolute values of entries)\n+Definition: densevector.hh:661\n+Dune::DenseVector::beforeEnd\n+ConstIterator beforeEnd() const\n+Definition: densevector.hh:397\n+Dune::DenseVector::axpy\n+derived_type & axpy(const field_type &a, const DenseVector< Other > &x)\n+vector space axpy operation ( *this += a x )\n+Definition: densevector.hh:575\n+Dune::DenseVector::operator=\n+derived_type & operator=(const value_type &k)\n+Assignment operator for scalar.\n+Definition: densevector.hh:266\n+Dune::DenseVector::blocklevel\n+static constexpr int blocklevel\n+The number of block levels we contain. This is the leaf, that is, 1.\n+Definition: densevector.hh:262\n+Dune::DenseVector::end\n+Iterator end()\n+end iterator\n+Definition: densevector.hh:353\n+Dune::DenseVector::size_type\n+Traits::size_type size_type\n+The type used for the index access and size operation.\n+Definition: densevector.hh:259\n+Dune::DenseVector::Iterator\n+DenseIterator< DenseVector, value_type > Iterator\n+Iterator class for sequential access.\n+Definition: densevector.hh:342\n+Dune::DenseVector::operator-=\n+derived_type & operator-=(const DenseVector< Other > &x)\n+vector space subtraction\n+Definition: densevector.hh:429\n+Dune::DenseVector::DenseVector\n+DenseVector(const DenseVector &)=default\n+Dune::DenseVector::beforeEnd\n+Iterator beforeEnd()\n+Definition: densevector.hh:360\n+Dune::DenseVector::operator+=\n+derived_type & operator+=(const DenseVector< Other > &x)\n+vector space addition\n+Definition: densevector.hh:419\n+Dune::DenseVector::operator*=\n+std::enable_if< std::is_convertible< FieldType, field_type >::value,\n+derived_type >::type & operator*=(const FieldType &kk)\n+vector space multiplication with scalar\n+Definition: densevector.hh:523\n+Dune::DenseVector::operator!=\n+bool operator!=(const DenseVector< Other > &x) const\n+Binary vector incomparison.\n+Definition: densevector.hh:567\n+Dune::DenseVector::back\n+const value_type & back() const\n+return reference to last element\n+Definition: densevector.hh:324\n+Dune::DenseVector::begin\n+ConstIterator begin() const\n+begin ConstIterator\n+Definition: densevector.hh:384\n+Dune::DenseVector::operator*\n+PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::\n+PromotedType operator*(const DenseVector< Other > &x) const\n+indefinite vector dot product which corresponds to Petsc's VecTDot\n+Definition: densevector.hh:591\n+Dune::DenseVector::DenseVector\n+constexpr DenseVector()=default\n+Dune::DenseVector::infinity_norm_real\n+FieldTraits< vt >::real_type infinity_norm_real() const\n+simplified infinity norm (uses Manhattan norm for complex values)\n+Definition: densevector.hh:677\n+Dune::DenseVector::operator=\n+DenseVector & operator=(const DenseVector &)=default\n+Assignment operator for other DenseVector of same type.\n+Dune::DenseVector::block_type\n+Traits::value_type block_type\n+export the type representing the components\n+Definition: densevector.hh:256\n+Dune::DenseVector::operator[]\n+value_type & operator[](size_type i)\n+random access\n+Definition: densevector.hh:295\n+Dune::DenseVector::field_type\n+FieldTraits< value_type >::field_type field_type\n+export the type representing the field\n+Definition: densevector.hh:253\n+Dune::DenseVector::back\n+value_type & back()\n+return reference to last element\n+Definition: densevector.hh:318\n+Dune::DenseVector::operator-\n+derived_type operator-() const\n+Vector negation.\n+Definition: densevector.hh:454\n+Dune::DenseVector::operator/=\n+std::enable_if< std::is_convertible< FieldType, field_type >::value,\n+derived_type >::type & operator/=(const FieldType &kk)\n+vector space division by scalar\n+Definition: densevector.hh:545\n+Dune::DenseVector::one_norm_real\n+FieldTraits< value_type >::real_type one_norm_real() const\n+simplified one norm (uses Manhattan norm for complex values)\n+Definition: densevector.hh:632\n+Dune::DenseVector::dot\n+PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::\n+PromotedType dot(const DenseVector< Other > &x) const\n+vector dot product which corresponds to Petsc's VecDot\n+Definition: densevector.hh:609\n+Dune::DenseVector::find\n+Iterator find(size_type i)\n+return iterator to given element or end()\n+Definition: densevector.hh:373\n+Dune::DenseVector::one_norm\n+FieldTraits< value_type >::real_type one_norm() const\n+one norm (sum over absolute values of entries)\n+Definition: densevector.hh:622\n+Dune::DenseVector::N\n+size_type N() const\n+number of blocks in the vector (are of size 1 here)\n+Definition: densevector.hh:727\n+Dune::DenseVector::empty\n+bool empty() const\n+checks whether the container is empty\n+Definition: densevector.hh:330\n+Dune::FieldTraits<_DenseVector<_V_>_>::real_type\n+FieldTraits< typenameDenseMatVecTraits< V >::value_type >::real_type real_type\n+Definition: densevector.hh:28\n+Dune::FieldTraits<_DenseVector<_V_>_>::field_type\n+FieldTraits< typenameDenseMatVecTraits< V >::value_type >::field_type\n+field_type\n+Definition: densevector.hh:27\n+Dune::DenseIterator\n+Generic iterator class for dense vector and matrix implementations.\n+Definition: densevector.hh:131\n+Dune::DenseIterator::increment\n+void increment()\n+Definition: densevector.hh:182\n+Dune::DenseIterator::index\n+SizeType index() const\n+return index\n+Definition: densevector.hh:213\n+Dune::DenseIterator::equals\n+bool equals(const MutableIterator &other) const\n+Definition: densevector.hh:167\n+Dune::DenseIterator::DenseIterator\n+DenseIterator(const MutableIterator &other)\n+Definition: densevector.hh:158\n+Dune::DenseIterator::equals\n+bool equals(const ConstIterator &other) const\n+Definition: densevector.hh:173\n+Dune::DenseIterator::elementAt\n+R elementAt(DifferenceType i) const\n+Definition: densevector.hh:192\n+Dune::DenseIterator::distanceTo\n+DifferenceType distanceTo(DenseIterator< const typename std::remove_const< C\n+>::type, const typename std::remove_const< T >::type > other) const\n+Definition: densevector.hh:200\n+Dune::DenseIterator::decrement\n+void decrement()\n+Definition: densevector.hh:187\n+Dune::DenseIterator::DenseIterator\n+DenseIterator(const ConstIterator &other)\n+Definition: densevector.hh:162\n+Dune::DenseIterator::distanceTo\n+DifferenceType distanceTo(DenseIterator< typename std::remove_const< C >::type,\n+typename std::remove_const< T >::type > other) const\n+Definition: densevector.hh:206\n+Dune::DenseIterator::DenseIterator\n+DenseIterator(C &cont, SizeType pos)\n+Definition: densevector.hh:154\n+Dune::DenseIterator::DifferenceType\n+std::ptrdiff_t DifferenceType\n+The type of the difference between two positions.\n+Definition: densevector.hh:142\n+Dune::DenseIterator::dereference\n+R dereference() const\n+Definition: densevector.hh:178\n+Dune::DenseIterator::advance\n+void advance(DifferenceType n)\n+Definition: densevector.hh:196\n+Dune::DenseIterator::SizeType\n+C::size_type SizeType\n+The type to index the underlying container.\n+Definition: densevector.hh:147\n+Dune::FieldTraits\n+Definition: ftraits.hh:26\n+Dune::FieldTraits::field_type\n+T field_type\n+export the type representing the field\n+Definition: ftraits.hh:28\n+Dune::FieldTraits::real_type\n+T real_type\n+export the type representing the real type of the field\n+Definition: ftraits.hh:30\n+Dune::mutable_reference\n+get the 'mutable' version of a reference to a const object\n+Definition: genericiterator.hh:116\n+Dune::RandomAccessIteratorFacade\n+Base class for stl conformant forward iterators.\n+Definition: iteratorfacades.hh:434\n+Dune::DenseMatVecTraits\n+Definition: matvectraits.hh:31\n+Dune::PromotionTraits\n+Compute type of the result of an arithmetic operation involving two different\n+number types.\n+Definition: promotiontraits.hh:27\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00110.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00110.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: make_array.hh File Reference\n+dune-common: dynvector.hh File Reference\n \n \n \n \n \n \n \n@@ -58,45 +58,61 @@\n \n \n \n \n \n
    \n \n-
    make_array.hh File Reference
    \n+Classes |\n+Namespaces
    \n+
    dynvector.hh File Reference
    \n \n
    \n-
    #include <array>
    \n-#include <type_traits>
    \n+\n+

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

    \n+
    #include <cmath>
    \n+#include <cstddef>
    \n+#include <cstdlib>
    \n+#include <complex>
    \n+#include <cstring>
    \n+#include <initializer_list>
    \n+#include <limits>
    \n+#include <utility>
    \n+#include "boundschecking.hh"
    \n+#include "exceptions.hh"
    \n+#include "genericiterator.hh"
    \n+#include <vector>
    \n+#include "densevector.hh"
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+Classes

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

    \n Namespaces

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

    \n-Functions

    template<typename... Args>
    std::array< typename std::common_type< Args... >::type, sizeof...(Args)> Dune::Std::make_array (const Args &... args)
     Create and initialize an array. More...
     
    \n-
    \n+

    Detailed Description

    \n+

    This file implements a dense vector with a dynamic size.

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,29 +4,42 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-Namespaces | Functions\n-make_array.hh File Reference\n-#include \n-#include \n+Classes | Namespaces\n+dynvector.hh File Reference\n+Common \u00bb Dense_Matrix_and_Vector_Template_Library\n+This file implements a dense vector with a dynamic size. More...\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \"boundschecking.hh\"\n+#include \"exceptions.hh\"\n+#include \"genericiterator.hh\"\n+#include \n+#include \"densevector.hh\"\n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::DenseMatVecTraits<_DynamicVector<_K,_Allocator_>_>\n+\u00a0\n+struct \u00a0Dune::FieldTraits<_DynamicVector<_K,_Allocator_>_>\n+\u00a0\n+ class \u00a0Dune::DynamicVector<_K,_Allocator_>\n+\u00a0 Construct a vector with a dynamic size. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::Std\n-\u00a0 Namespace for features backported from new C++ standards.\n-\u00a0\n- Functions\n-template\n-std::array< typename std::common_type< Dune::Std::make_array (const Args &...\n- Args... >::type, sizeof...(Args)>\u00a0args)\n-\u00a0 Create and initialize an array. More...\n-\u00a0\n+***** Detailed Description *****\n+This file implements a dense vector with a dynamic size.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00110_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00110_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: make_array.hh Source File\n+dune-common: dynvector.hh Source File\n \n \n \n \n \n \n \n@@ -58,62 +58,233 @@\n \n \n \n \n \n
    \n-
    make_array.hh
    \n+
    dynvector.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n-
    2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    3#ifndef DUNE_COMMON_STD_MAKE_ARRAY_HH
    \n-
    4#define DUNE_COMMON_STD_MAKE_ARRAY_HH
    \n-
    5
    \n-
    6#include <array>
    \n-
    7#include <type_traits>
    \n-
    8
    \n-
    9#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    \n-
    10#include <experimental/array>
    \n-
    11#endif
    \n-
    12
    \n-
    13#warning make_array.hh is deprecated and will be removed after Dune 2.9. \\
    \n-
    14 Use deduction guide of `std::array` or `std::to_array`.
    \n-
    15
    \n-
    16namespace Dune {
    \n-
    17namespace Std {
    \n-
    18
    \n-
    19#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    \n+Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n+
    2// vi: set et ts=4 sw=2 sts=2:
    \n+
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n+
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n+
    5#ifndef DUNE_DYNVECTOR_HH
    \n+
    6#define DUNE_DYNVECTOR_HH
    \n+
    7
    \n+
    8#include <cmath>
    \n+
    9#include <cstddef>
    \n+
    10#include <cstdlib>
    \n+
    11#include <complex>
    \n+
    12#include <cstring>
    \n+
    13#include <initializer_list>
    \n+
    14#include <limits>
    \n+
    15#include <utility>
    \n+
    16
    \n+
    17#include "boundschecking.hh"
    \n+
    18#include "exceptions.hh"
    \n+
    19#include "genericiterator.hh"
    \n
    20
    \n-\n+
    21#include <vector>
    \n+
    22#include "densevector.hh"
    \n
    23
    \n-
    24#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    \n+
    24namespace Dune {
    \n
    25
    \n-
    27
    \n-
    41 template <typename... Args>
    \n-
    42 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
    \n-
    43 make_array(const Args&... args) {
    \n-
    44 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
    \n-
    45 result = {{args...}};
    \n-
    46 return result;
    \n-
    47 }
    \n-
    48
    \n-
    49#endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
    \n+
    34 template< class K, class Allocator > class DynamicVector;
    \n+
    35 template< class K, class Allocator >
    \n+
    36 struct DenseMatVecTraits< DynamicVector< K, Allocator > >
    \n+
    37 {
    \n+\n+
    39 typedef std::vector< K, Allocator > container_type;
    \n+
    40 typedef K value_type;
    \n+
    41 typedef typename container_type::size_type size_type;
    \n+
    42 };
    \n+
    43
    \n+
    44 template< class K, class Allocator >
    \n+
    45 struct FieldTraits< DynamicVector< K, Allocator > >
    \n+
    46 {
    \n+\n+\n+
    49 };
    \n
    50
    \n-
    51}
    \n-
    52}
    \n-
    53
    \n-
    54#endif
    \n-
    std::array< typename std::common_type< Args... >::type, sizeof...(Args)> make_array(const Args &... args)
    Create and initialize an array.
    Definition: make_array.hh:43
    \n+
    57 template< class K, class Allocator = std::allocator< K > >
    \n+
    58 class DynamicVector : public DenseVector< DynamicVector< K, Allocator > >
    \n+
    59 {
    \n+
    60 std::vector< K, Allocator > _data;
    \n+
    61
    \n+\n+
    63 public:
    \n+
    64 typedef typename Base::size_type size_type;
    \n+
    65 typedef typename Base::value_type value_type;
    \n+
    66
    \n+
    67 typedef std::vector< K, Allocator > container_type;
    \n+
    68
    \n+
    69 typedef Allocator allocator_type;
    \n+
    70
    \n+\n+
    73 _data( a )
    \n+
    74 {}
    \n+
    75
    \n+\n+
    77 _data( n, value_type(), a )
    \n+
    78 {}
    \n+
    79
    \n+\n+
    82 _data( n, c, a )
    \n+
    83 {}
    \n+
    84
    \n+
    86 DynamicVector (std::initializer_list<K> const &l) :
    \n+
    87 _data(l)
    \n+
    88 {}
    \n+
    89
    \n+\n+
    92 Base(), _data(x._data)
    \n+
    93 {}
    \n+
    94
    \n+\n+
    97 _data(std::move(x._data))
    \n+
    98 {}
    \n+
    99
    \n+
    100 template< class T >
    \n+\n+
    102 _data(x.begin(), x.end(), x.get_allocator())
    \n+
    103 {}
    \n+
    104
    \n+
    106 template< class X >
    \n+\n+
    108 _data(a)
    \n+
    109 {
    \n+
    110 const size_type n = x.size();
    \n+
    111 _data.reserve(n);
    \n+
    112 for( size_type i =0; i<n ;++i)
    \n+
    113 _data.push_back( x[ i ] );
    \n+
    114 }
    \n+
    115
    \n+
    116 using Base::operator=;
    \n+
    117
    \n+\n+
    120 {
    \n+
    121 _data = other._data;
    \n+
    122 return *this;
    \n+
    123 }
    \n+
    124
    \n+\n+
    127 {
    \n+
    128 _data = std::move(other._data);
    \n+
    129 return *this;
    \n+
    130 }
    \n+
    131
    \n+
    132 //==== forward some methods of std::vector
    \n+\n+
    138 {
    \n+
    139 return _data.capacity();
    \n+
    140 }
    \n+\n+
    142 {
    \n+
    143 _data.resize(n,c);
    \n+
    144 }
    \n+\n+
    146 {
    \n+
    147 _data.reserve(n);
    \n+
    148 }
    \n+
    149
    \n+
    150 //==== make this thing a vector
    \n+
    151 size_type size() const { return _data.size(); }
    \n+\n+\n+
    154 return _data[i];
    \n+
    155 }
    \n+
    156 const K & operator[](size_type i) const {
    \n+\n+
    158 return _data[i];
    \n+
    159 }
    \n+
    160
    \n+
    162 K* data() noexcept
    \n+
    163 {
    \n+
    164 return _data.data();
    \n+
    165 }
    \n+
    166
    \n+
    168 const K* data() const noexcept
    \n+
    169 {
    \n+
    170 return _data.data();
    \n+
    171 }
    \n+
    172
    \n+
    173 const container_type &container () const { return _data; }
    \n+
    174 container_type &container () { return _data; }
    \n+
    175 };
    \n+
    176
    \n+
    188 template< class K, class Allocator >
    \n+
    189 inline std::istream &operator>> ( std::istream &in,
    \n+\n+
    191 {
    \n+\n+
    193 for( typename DynamicVector< K, Allocator >::size_type i = 0; i < w.size(); ++i )
    \n+
    194 in >> w[ i ];
    \n+
    195 if(in)
    \n+
    196 v = std::move(w);
    \n+
    197 return in;
    \n+
    198 }
    \n+
    199
    \n+
    202} // end namespace
    \n+
    203
    \n+
    204#endif
    \n+
    Implements a generic iterator class for writing stl conformant iterators.
    \n+
    Implements the dense vector interface, with an exchangeable storage class.
    \n+
    Macro for wrapping boundary checks.
    \n+
    A few common exception classes.
    \n+
    Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)
    Read a std::tuple.
    Definition: streamoperators.hh:43
    \n+
    #define DUNE_ASSERT_BOUNDS(cond)
    If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
    Definition: boundschecking.hh:30
    \n+
    STL namespace.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    Interface for a class of dense vectors over a given field.
    Definition: densevector.hh:229
    \n+
    Traits::value_type value_type
    export the type representing the field
    Definition: densevector.hh:250
    \n+
    Iterator begin()
    begin iterator
    Definition: densevector.hh:347
    \n+
    size_type size() const
    size method
    Definition: densevector.hh:336
    \n+
    Iterator end()
    end iterator
    Definition: densevector.hh:353
    \n+
    Traits::size_type size_type
    The type used for the index access and size operation.
    Definition: densevector.hh:259
    \n+
    Construct a vector with a dynamic size.
    Definition: dynvector.hh:59
    \n+
    void resize(size_type n, value_type c=value_type())
    Definition: dynvector.hh:141
    \n+
    DynamicVector(const DynamicVector &x)
    Constructor making vector with identical coordinates.
    Definition: dynvector.hh:91
    \n+
    Base::size_type size_type
    Definition: dynvector.hh:64
    \n+
    std::vector< K, Allocator > container_type
    Definition: dynvector.hh:67
    \n+
    size_type size() const
    Definition: dynvector.hh:151
    \n+
    K & operator[](size_type i)
    Definition: dynvector.hh:152
    \n+
    container_type & container()
    Definition: dynvector.hh:174
    \n+
    Base::value_type value_type
    Definition: dynvector.hh:65
    \n+
    const K * data() const noexcept
    return pointer to underlying array
    Definition: dynvector.hh:168
    \n+
    Allocator allocator_type
    Definition: dynvector.hh:69
    \n+
    DynamicVector(const allocator_type &a=allocator_type())
    Constructor making uninitialized vector.
    Definition: dynvector.hh:72
    \n+
    DynamicVector(DynamicVector &&x)
    Move constructor.
    Definition: dynvector.hh:96
    \n+
    K * data() noexcept
    return pointer to underlying array
    Definition: dynvector.hh:162
    \n+
    DynamicVector & operator=(DynamicVector &&other)
    Move assignment operator.
    Definition: dynvector.hh:126
    \n+
    DynamicVector & operator=(const DynamicVector &other)
    Copy assignment operator.
    Definition: dynvector.hh:119
    \n+
    size_type capacity() const
    Number of elements for which memory has been allocated.
    Definition: dynvector.hh:137
    \n+
    const container_type & container() const
    Definition: dynvector.hh:173
    \n+
    DynamicVector(size_type n, const allocator_type &a=allocator_type())
    Definition: dynvector.hh:76
    \n+
    DynamicVector(std::initializer_list< K > const &l)
    Construct from a std::initializer_list.
    Definition: dynvector.hh:86
    \n+
    DynamicVector(const DynamicVector< T, Allocator > &x)
    Definition: dynvector.hh:101
    \n+
    const K & operator[](size_type i) const
    Definition: dynvector.hh:156
    \n+
    void reserve(size_type n)
    Definition: dynvector.hh:145
    \n+
    DynamicVector(size_type n, value_type c, const allocator_type &a=allocator_type())
    Constructor making vector with identical coordinates.
    Definition: dynvector.hh:81
    \n+
    DynamicVector(const DenseVector< X > &x, const allocator_type &a=allocator_type())
    Copy constructor from another DenseVector.
    Definition: dynvector.hh:107
    \n+\n+
    DynamicVector< K, Allocator > derived_type
    Definition: dynvector.hh:38
    \n+
    std::vector< K, Allocator > container_type
    Definition: dynvector.hh:39
    \n+
    container_type::size_type size_type
    Definition: dynvector.hh:41
    \n+
    FieldTraits< K >::real_type real_type
    Definition: dynvector.hh:48
    \n+
    FieldTraits< K >::field_type field_type
    Definition: dynvector.hh:47
    \n+
    Definition: ftraits.hh:26
    \n+
    T field_type
    export the type representing the field
    Definition: ftraits.hh:28
    \n+
    T real_type
    export the type representing the real type of the field
    Definition: ftraits.hh:30
    \n+
    Definition: matvectraits.hh:31
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,61 +4,343 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-make_array.hh\n+dynvector.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n+ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n+ 2// vi: set et ts=4 sw=2 sts=2:\n+ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 3#ifndef DUNE_COMMON_STD_MAKE_ARRAY_HH\n- 4#define DUNE_COMMON_STD_MAKE_ARRAY_HH\n- 5\n- 6#include \n- 7#include \n- 8\n- 9#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY\n- 10#include \n- 11#endif\n- 12\n- 13#warning make_array.hh is deprecated and will be removed after Dune 2.9. \\\n- 14 Use deduction guide of `std::array` or `std::to_array`.\n- 15\n- 16namespace Dune {\n- 17namespace Std {\n- 18\n- 19#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY\n+ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n+ 5#ifndef DUNE_DYNVECTOR_HH\n+ 6#define DUNE_DYNVECTOR_HH\n+ 7\n+ 8#include \n+ 9#include \n+ 10#include \n+ 11#include \n+ 12#include \n+ 13#include \n+ 14#include \n+ 15#include \n+ 16\n+ 17#include \"boundschecking.hh\"\n+ 18#include \"exceptions.hh\"\n+ 19#include \"genericiterator.hh\"\n 20\n- 22 using std::experimental::make_array;\n+ 21#include \n+ 22#include \"densevector.hh\"\n 23\n- 24#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY\n+ 24namespace Dune {\n 25\n- 27\n- 41 template \n- 42 std::array::type, sizeof...(Args)>\n-43 make_array(const Args&... args) {\n- 44 std::array::type, sizeof...(Args)>\n- 45 result = {{args...}};\n- 46 return result;\n- 47 }\n- 48\n- 49#endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY\n+ 34 template< class K, class Allocator > class DynamicVector;\n+ 35 template< class K, class Allocator >\n+36 struct DenseMatVecTraits< DynamicVector< K, Allocator > >\n+ 37 {\n+38 typedef DynamicVector<_K,_Allocator_> derived_type;\n+39 typedef std::vector< K, Allocator > container_type;\n+40 typedef K value_type;\n+41 typedef typename container_type::size_type size_type;\n+ 42 };\n+ 43\n+ 44 template< class K, class Allocator >\n+45 struct FieldTraits< DynamicVector< K, Allocator > >\n+ 46 {\n+47 typedef typename FieldTraits<_K_>::field_type field_type;\n+48 typedef typename FieldTraits<_K_>::real_type real_type;\n+ 49 };\n 50\n- 51}\n- 52}\n- 53\n- 54#endif\n-Dune::Std::make_array\n-std::array< typename std::common_type< Args... >::type, sizeof...(Args)>\n-make_array(const Args &... args)\n-Create and initialize an array.\n-Definition: make_array.hh:43\n+ 57 template< class K, class Allocator = std::allocator< K > >\n+58 class DynamicVector : public DenseVector< DynamicVector< K, Allocator > >\n+ 59 {\n+ 60 std::vector< K, Allocator > _data;\n+ 61\n+ 62 typedef DenseVector<_DynamicVector<_K,_Allocator_> > Base;\n+ 63 public:\n+64 typedef typename Base::size_type size_type;\n+65 typedef typename Base::value_type value_type;\n+ 66\n+67 typedef std::vector< K, Allocator > container_type;\n+ 68\n+69 typedef Allocator allocator_type;\n+ 70\n+72 explicit DynamicVector(const allocator_type &a = allocator_type() ) :\n+ 73 _data( a )\n+ 74 {}\n+ 75\n+76 explicit DynamicVector(size_type n, const allocator_type &a = allocator_type\n+() ) :\n+ 77 _data( n, value_type(), a )\n+ 78 {}\n+ 79\n+81 DynamicVector( size_type n, value_type c, const allocator_type &a =\n+allocator_type() ) :\n+ 82 _data( n, c, a )\n+ 83 {}\n+ 84\n+86 DynamicVector (std::initializer_list const &l) :\n+ 87 _data(l)\n+ 88 {}\n+ 89\n+91 DynamicVector(const DynamicVector & x) :\n+ 92 Base(), _data(x._data)\n+ 93 {}\n+ 94\n+96 DynamicVector(DynamicVector && x) :\n+ 97 _data(std::move(x._data))\n+ 98 {}\n+ 99\n+ 100 template< class T >\n+101 DynamicVector(const DynamicVector<_T,_Allocator_> & x) :\n+ 102 _data(x.begin(), x.end(), x.get_allocator())\n+ 103 {}\n+ 104\n+ 106 template< class X >\n+107 DynamicVector(const DenseVector<_X_> & x, const allocator_type &a =\n+allocator_type() ) :\n+ 108 _data(a)\n+ 109 {\n+ 110 const size_type n = x.size();\n+ 111 _data.reserve(n);\n+ 112 for( size_type i =0; i\n+189 inline std::istream &operator>>( std::istream &in,\n+ 190 DynamicVector<_K,_Allocator_> &v )\n+ 191 {\n+ 192 DynamicVector<_K,_Allocator_> w(v);\n+ 193 for( typename DynamicVector<_K,_Allocator_>::size_type i = 0; i < w.size\n+(); ++i )\n+ 194 in >> w[ i ];\n+ 195 if(in)\n+ 196 v = std::move(w);\n+ 197 return in;\n+ 198 }\n+ 199\n+ 202} // end namespace\n+ 203\n+ 204#endif\n+genericiterator.hh\n+Implements a generic iterator class for writing stl conformant iterators.\n+densevector.hh\n+Implements the dense vector interface, with an exchangeable storage class.\n+boundschecking.hh\n+Macro for wrapping boundary checks.\n+exceptions.hh\n+A few common exception classes.\n+Dune::operator>>\n+Stream & operator>>(Stream &stream, std::tuple< Ts... > &t)\n+Read a std::tuple.\n+Definition: streamoperators.hh:43\n+DUNE_ASSERT_BOUNDS\n+#define DUNE_ASSERT_BOUNDS(cond)\n+If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do\n+nothing.\n+Definition: boundschecking.hh:30\n+std\n+STL namespace.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n+Dune::DenseVector\n+Interface for a class of dense vectors over a given field.\n+Definition: densevector.hh:229\n+Dune::DenseVector::value_type\n+Traits::value_type value_type\n+export the type representing the field\n+Definition: densevector.hh:250\n+Dune::DenseVector<_DynamicVector<_K,_std::allocator<_K_>_>_>::begin\n+Iterator begin()\n+begin iterator\n+Definition: densevector.hh:347\n+Dune::DenseVector::size\n+size_type size() const\n+size method\n+Definition: densevector.hh:336\n+Dune::DenseVector<_DynamicVector<_K,_std::allocator<_K_>_>_>::end\n+Iterator end()\n+end iterator\n+Definition: densevector.hh:353\n+Dune::DenseVector::size_type\n+Traits::size_type size_type\n+The type used for the index access and size operation.\n+Definition: densevector.hh:259\n+Dune::DynamicVector\n+Construct a vector with a dynamic size.\n+Definition: dynvector.hh:59\n+Dune::DynamicVector::resize\n+void resize(size_type n, value_type c=value_type())\n+Definition: dynvector.hh:141\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(const DynamicVector &x)\n+Constructor making vector with identical coordinates.\n+Definition: dynvector.hh:91\n+Dune::DynamicVector::size_type\n+Base::size_type size_type\n+Definition: dynvector.hh:64\n+Dune::DynamicVector::container_type\n+std::vector< K, Allocator > container_type\n+Definition: dynvector.hh:67\n+Dune::DynamicVector::size\n+size_type size() const\n+Definition: dynvector.hh:151\n+Dune::DynamicVector::operator[]\n+K & operator[](size_type i)\n+Definition: dynvector.hh:152\n+Dune::DynamicVector::container\n+container_type & container()\n+Definition: dynvector.hh:174\n+Dune::DynamicVector::value_type\n+Base::value_type value_type\n+Definition: dynvector.hh:65\n+Dune::DynamicVector::data\n+const K * data() const noexcept\n+return pointer to underlying array\n+Definition: dynvector.hh:168\n+Dune::DynamicVector::allocator_type\n+Allocator allocator_type\n+Definition: dynvector.hh:69\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(const allocator_type &a=allocator_type())\n+Constructor making uninitialized vector.\n+Definition: dynvector.hh:72\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(DynamicVector &&x)\n+Move constructor.\n+Definition: dynvector.hh:96\n+Dune::DynamicVector::data\n+K * data() noexcept\n+return pointer to underlying array\n+Definition: dynvector.hh:162\n+Dune::DynamicVector::operator=\n+DynamicVector & operator=(DynamicVector &&other)\n+Move assignment operator.\n+Definition: dynvector.hh:126\n+Dune::DynamicVector::operator=\n+DynamicVector & operator=(const DynamicVector &other)\n+Copy assignment operator.\n+Definition: dynvector.hh:119\n+Dune::DynamicVector::capacity\n+size_type capacity() const\n+Number of elements for which memory has been allocated.\n+Definition: dynvector.hh:137\n+Dune::DynamicVector::container\n+const container_type & container() const\n+Definition: dynvector.hh:173\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(size_type n, const allocator_type &a=allocator_type())\n+Definition: dynvector.hh:76\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(std::initializer_list< K > const &l)\n+Construct from a std::initializer_list.\n+Definition: dynvector.hh:86\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(const DynamicVector< T, Allocator > &x)\n+Definition: dynvector.hh:101\n+Dune::DynamicVector::operator[]\n+const K & operator[](size_type i) const\n+Definition: dynvector.hh:156\n+Dune::DynamicVector::reserve\n+void reserve(size_type n)\n+Definition: dynvector.hh:145\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(size_type n, value_type c, const allocator_type &a=allocator_type\n+())\n+Constructor making vector with identical coordinates.\n+Definition: dynvector.hh:81\n+Dune::DynamicVector::DynamicVector\n+DynamicVector(const DenseVector< X > &x, const allocator_type &a=allocator_type\n+())\n+Copy constructor from another DenseVector.\n+Definition: dynvector.hh:107\n+Dune::DenseMatVecTraits<_DynamicVector<_K,_Allocator_>_>::value_type\n+K value_type\n+Definition: dynvector.hh:40\n+Dune::DenseMatVecTraits<_DynamicVector<_K,_Allocator_>_>::derived_type\n+DynamicVector< K, Allocator > derived_type\n+Definition: dynvector.hh:38\n+Dune::DenseMatVecTraits<_DynamicVector<_K,_Allocator_>_>::container_type\n+std::vector< K, Allocator > container_type\n+Definition: dynvector.hh:39\n+Dune::DenseMatVecTraits<_DynamicVector<_K,_Allocator_>_>::size_type\n+container_type::size_type size_type\n+Definition: dynvector.hh:41\n+Dune::FieldTraits<_DynamicVector<_K,_Allocator_>_>::real_type\n+FieldTraits< K >::real_type real_type\n+Definition: dynvector.hh:48\n+Dune::FieldTraits<_DynamicVector<_K,_Allocator_>_>::field_type\n+FieldTraits< K >::field_type field_type\n+Definition: dynvector.hh:47\n+Dune::FieldTraits\n+Definition: ftraits.hh:26\n+Dune::FieldTraits::field_type\n+T field_type\n+export the type representing the field\n+Definition: ftraits.hh:28\n+Dune::FieldTraits::real_type\n+T real_type\n+export the type representing the real type of the field\n+Definition: ftraits.hh:30\n+Dune::DenseMatVecTraits\n+Definition: matvectraits.hh:31\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00113.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00113.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: type_traits.hh File Reference\n+dune-common: exceptions.cc File Reference\n \n \n \n \n \n \n \n@@ -58,101 +58,30 @@\n \n
    \n \n \n \n
    \n \n-
    type_traits.hh File Reference
    \n+Namespaces
    \n+
    exceptions.cc File Reference
    \n \n
    \n-
    #include <type_traits>
    \n-#include <dune/common/typetraits.hh>
    \n-#include <dune/common/typeutilities.hh>
    \n-
    \n-

    Go to the source code of this file.

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-Classes

    struct  Dune::Std::nonesuch
     Type representing a lookup failure by std::detected_or and friends. More...
     
    struct  Dune::Std::conjunction< B >
     forms the logical conjunction of the type traits B... More...
     
    struct  Dune::Std::disjunction< B >
     forms the logical disjunction of the type traits B... More...
     
    struct  Dune::Std::negation< B >
     forms the logical negation of the type traits B... More...
     
    \n+
    \n \n \n \n \n-\n-\n-\n-

    \n Namespaces

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

    \n-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. More...
     
    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. More...
     
    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. More...
     
    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. More...
     
    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. More...
     
    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. More...
     
    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. More...
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n

    \n-Variables

    template<template< typename... > class Op, typename... Args>
    constexpr bool Dune::Std::is_detected_v = is_detected<Op,Args...>::value
     Detects whether Op<Args...> is valid and makes the result available as a value. More...
     
    template<typename Expected , template< typename... > class Op, typename... Args>
    constexpr bool Dune::Std::is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value
     Convenient access to the result value of is_detected_exact. More...
     
    template<typename Target , template< typename... > class Op, typename... Args>
    constexpr bool Dune::Std::is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value
     Convenient access to the result value of is_detected_convertible. More...
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,102 +4,17 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-Classes | Namespaces | Typedefs | Variables\n-type_traits.hh File Reference\n-#include \n-#include \n-#include \n-Go_to_the_source_code_of_this_file.\n- Classes\n-struct \u00a0Dune::Std::nonesuch\n-\u00a0 Type representing a lookup failure by std::detected_or and friends.\n- More...\n-\u00a0\n-struct \u00a0Dune::Std::conjunction<_B_>\n-\u00a0 forms the logical conjunction of the type traits B... More...\n-\u00a0\n-struct \u00a0Dune::Std::disjunction<_B_>\n-\u00a0 forms the logical disjunction of the type traits B... More...\n-\u00a0\n-struct \u00a0Dune::Std::negation<_B_>\n-\u00a0 forms the logical negation of the type traits B... More...\n-\u00a0\n+Namespaces\n+exceptions.cc File Reference\n+#include \n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::Std\n-\u00a0 Namespace for features backported from new C++ standards.\n-\u00a0\n- Typedefs\n-template class Op, typename... Args>\n-using\u00a0Dune::Std::detected_or = Impl::detector< Default, void, Op, Args... >\n-\u00a0 Detects whether Op is valid and makes the result available.\n- More...\n-\u00a0\n-template class Op, typename... Args>\n-using\u00a0Dune::Std::is_detected = typename detected_or< nonesuch, Op, Args... >::\n- value_t\n-\u00a0 Detects whether Op is valid. More...\n-\u00a0\n-template class Op, typename... Args>\n-using\u00a0Dune::Std::detected_t = typename detected_or< nonesuch, Op, Args... >::\n- type\n-\u00a0 Returns Op if that is valid; otherwise returns nonesuch.\n- More...\n-\u00a0\n-template class Op, typename... Args>\n-using\u00a0Dune::Std::detected_or_t = typename detected_or< Default, Op, Args...\n- >::type\n-\u00a0 Returns Op if that is valid; otherwise returns the fallback\n- type Default. More...\n-\u00a0\n-template class Op, typename...\n-Args>\n-using\u00a0Dune::Std::is_detected_exact = std::is_same< Expected, detected_t< Op,\n- Args... > >\n-\u00a0 Checks whether Op is Expected without causing an error if\n- Op is invalid. More...\n-\u00a0\n-template class Op, typename... Args>\n-using\u00a0Dune::Std::is_detected_convertible = std::is_convertible< Target,\n- detected_t< Op, Args... > >\n-\u00a0 Checks whether Op is convertible to Target without causing an\n- error if Op is invalid. More...\n-\u00a0\n-template class Fallback, template< typename... > class\n-TargetType, typename... Args>\n-using\u00a0Dune::detected_or_fallback_t = Std::detected_or_t< decltype(detail::\n- warningIfNotDefined< Std::detected_t< Fallback, Args... > >(std::\n- declval< const Std::detected_t< TargetType, Args... > * >())),\n- TargetType, Args... >\n-\u00a0 This type will be either TargetType if it exists, or the\n- Fallback type. More...\n-\u00a0\n- Variables\n-template class Op, typename... Args>\n-constexpr bool\u00a0Dune::Std::is_detected_v = is_detected::value\n-\u00a0 Detects whether Op is valid and makes the result\n- available as a value. More...\n-\u00a0\n-template class Op, typename...\n-Args>\n-constexpr bool\u00a0Dune::Std::is_detected_exact_v =\n- is_detected_exact::value\n-\u00a0 Convenient access to the result value of is_detected_exact.\n- More...\n-\u00a0\n-template class Op, typename... Args>\n-constexpr bool\u00a0Dune::Std::is_detected_convertible_v =\n- is_detected_convertible::value\n-\u00a0 Convenient access to the result value of\n- is_detected_convertible. More...\n-\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00116.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00116.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: variant.hh File Reference\n+dune-common: arraylist.hh File Reference\n \n \n \n \n \n \n \n@@ -58,36 +58,56 @@\n \n \n \n \n \n
    \n \n-
    variant.hh File Reference
    \n+
    arraylist.hh File Reference
    \n
    \n
    \n-
    #include <variant>
    \n+\n+

    Implements a random-access container that can efficiently change size (similar to std::deque) \n+More...

    \n+
    #include <array>
    \n+#include <cassert>
    \n+#include <memory>
    \n+#include <vector>
    \n+#include "iteratorfacades.hh"
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+Classes

    class  Dune::ArrayList< T, N, A >
     A dynamically growing random access list. More...
     
    class  Dune::ArrayListIterator< T, N, A >
     A random access iterator for the Dune::ArrayList class. More...
     
    class  Dune::ConstArrayListIterator< T, N, A >
     A constant random access iterator for the Dune::ArrayList class. More...
     
    \n \n \n \n \n-\n-\n-\n

    \n Namespaces

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

    Detailed Description

    \n+

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

    \n+

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

    Author
    Markus Blatt
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,22 +4,43 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-Namespaces\n-variant.hh File Reference\n-#include \n+Classes | Namespaces\n+arraylist.hh File Reference\n+Implements a random-access container that can efficiently change size (similar\n+to std::deque) More...\n+#include \n+#include \n+#include \n+#include \n+#include \"iteratorfacades.hh\"\n Go_to_the_source_code_of_this_file.\n+ Classes\n+class \u00a0Dune::ArrayList<_T,_N,_A_>\n+\u00a0 A dynamically growing random access list. More...\n+\u00a0\n+class \u00a0Dune::ArrayListIterator<_T,_N,_A_>\n+\u00a0 A random access iterator for the Dune::ArrayList class. More...\n+\u00a0\n+class \u00a0Dune::ConstArrayListIterator<_T,_N,_A_>\n+\u00a0 A constant random access iterator for the Dune::ArrayList class.\n+ More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::Std\n-\u00a0 Namespace for features backported from new C++ standards.\n-\u00a0\n+***** Detailed Description *****\n+Implements a random-access container that can efficiently change size (similar\n+to std::deque)\n+This file implements the class ArrayList which behaves like dynamically growing\n+array together with the class ArrayListIterator which is random access iterator\n+as needed by the stl for sorting and other algorithms.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00116_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: variant.hh Source File\n+dune-common: arraylist.hh Source File\n \n \n \n \n \n \n \n@@ -58,49 +58,523 @@\n \n \n \n \n \n
    \n-
    variant.hh
    \n+
    arraylist.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_STD_VARIANT_HH
    \n-
    6#define DUNE_COMMON_STD_VARIANT_HH
    \n-
    7
    \n-
    8#warning dune/common/std/variant.hh is deprecated and will be removed after Dune 2.8.\\
    \n-
    9 Include <variant> instead
    \n-
    10
    \n-
    11#include <variant>
    \n-
    12
    \n-
    13namespace Dune {
    \n-
    14namespace Std {
    \n-
    15 using std::variant;
    \n-
    16 using std::visit;
    \n-
    17 using std::variant_size;
    \n-
    18 using std::variant_size_v;
    \n-
    19 using std::get;
    \n-
    20 using std::get_if;
    \n-
    21 using std::holds_alternative;
    \n-
    22 using std::monostate;
    \n-
    23}
    \n-
    24}
    \n-
    25
    \n-
    26#endif
    \n+
    5
    \n+
    6#ifndef DUNE_COMMON_ARRAYLIST_HH
    \n+
    7#define DUNE_COMMON_ARRAYLIST_HH
    \n+
    8
    \n+
    9#include <array>
    \n+
    10#include <cassert>
    \n+
    11#include <memory>
    \n+
    12#include <vector>
    \n+
    13#include "iteratorfacades.hh"
    \n+
    14
    \n+
    15namespace Dune
    \n+
    16{
    \n+
    17 // forward declaration
    \n+
    18 template<class T, int N, class A>
    \n+
    19 class ArrayListIterator;
    \n+
    20
    \n+
    21 template<class T, int N, class A>
    \n+
    22 class ConstArrayListIterator;
    \n+
    23
    \n+
    60 template<class T, int N=100, class A=std::allocator<T> >
    \n+\n+
    62 {
    \n+
    63 public:
    \n+
    69 typedef T MemberType;
    \n+
    70
    \n+
    74 typedef T value_type;
    \n+
    75
    \n+
    79 typedef T& reference;
    \n+
    80
    \n+
    84 typedef const T& const_reference;
    \n+
    85
    \n+
    89 typedef T* pointer;
    \n+
    90
    \n+
    94 typedef const T* const_pointer;
    \n+
    95
    \n+
    100 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    \n+
    101
    \n+\n+
    106
    \n+\n+
    111
    \n+
    115 typedef std::size_t size_type;
    \n+
    116
    \n+
    120 typedef std::ptrdiff_t difference_type;
    \n+
    121
    \n+\n+
    127
    \n+\n+
    134
    \n+\n+
    140
    \n+\n+
    146
    \n+
    151 inline void push_back(const_reference entry);
    \n+
    152
    \n+\n+
    159
    \n+\n+
    166
    \n+
    171 inline size_type size() const;
    \n+
    172
    \n+
    180 inline void purge();
    \n+
    181
    \n+
    185 inline void clear();
    \n+\n+
    190
    \n+
    191 private:
    \n+
    192
    \n+
    196 using SmartPointerAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::shared_ptr< std::array<MemberType,chunkSize_> > >;
    \n+
    197
    \n+
    201 using ArrayAllocator = typename std::allocator_traits<A>::template rebind_alloc< std::array<MemberType,chunkSize_> >;
    \n+
    202
    \n+
    206 friend class ArrayListIterator<T,N,A>;
    \n+
    207 friend class ConstArrayListIterator<T,N,A>;
    \n+
    208
    \n+
    210 std::vector<std::shared_ptr<std::array<MemberType,chunkSize_> >,
    \n+
    211 SmartPointerAllocator> chunks_;
    \n+
    220 size_type capacity_;
    \n+
    222 size_type size_;
    \n+
    224 size_type start_;
    \n+
    233 inline reference elementAt(size_type i);
    \n+
    234
    \n+
    243 inline const_reference elementAt(size_type i) const;
    \n+
    244 };
    \n+
    245
    \n+
    246
    \n+
    250 template<class T, int N, class A>
    \n+
    251 class ArrayListIterator : public RandomAccessIteratorFacade<ArrayListIterator<T,N,A>,
    \n+
    252 typename A::value_type,
    \n+
    253 typename A::value_type &,
    \n+
    254 typename A::difference_type>
    \n+
    255 {
    \n+
    256
    \n+
    257 friend class ArrayList<T,N,A>;
    \n+
    258 friend class ConstArrayListIterator<T,N,A>;
    \n+
    259 public:
    \n+
    263 typedef typename A::value_type MemberType;
    \n+
    264
    \n+
    265 typedef typename A::difference_type difference_type;
    \n+
    266
    \n+
    267 typedef typename A::size_type size_type;
    \n+
    268
    \n+
    269 using reference = typename A::value_type &;
    \n+
    270
    \n+
    271 using const_reference = typename A::value_type const&;
    \n+
    272
    \n+
    278 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    \n+
    279
    \n+
    280
    \n+
    286 inline bool equals(const ArrayListIterator<MemberType,N,A>& other) const;
    \n+
    287
    \n+
    293 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    \n+
    294
    \n+
    298 inline void increment();
    \n+
    299
    \n+
    303 inline void decrement();
    \n+
    304
    \n+
    309 inline reference elementAt(size_type i) const;
    \n+
    310
    \n+
    315 inline reference dereference() const;
    \n+
    316
    \n+
    328 inline void eraseToHere();
    \n+
    329
    \n+
    331 inline size_type position(){return position_;}
    \n+
    332
    \n+
    334 inline void advance(difference_type n);
    \n+
    335
    \n+
    337 inline difference_type distanceTo(const ArrayListIterator<T,N,A>& other) const;
    \n+
    338
    \n+
    340 inline ArrayListIterator() : position_(0), list_(nullptr)
    \n+
    341 {}
    \n+
    342
    \n+
    343 private:
    \n+\n+
    350
    \n+
    354 size_type position_;
    \n+\n+
    359 };
    \n+
    360
    \n+
    364 template<class T, int N, class A>
    \n+\n+
    366 : public RandomAccessIteratorFacade<ConstArrayListIterator<T,N,A>,
    \n+
    367 const typename A::value_type,
    \n+
    368 typename A::value_type const&,
    \n+
    369 typename A::difference_type>
    \n+
    370 {
    \n+
    371
    \n+
    372 friend class ArrayList<T,N,A>;
    \n+
    373 friend class ArrayListIterator<T,N,A>;
    \n+
    374
    \n+
    375 public:
    \n+
    379 typedef typename A::value_type MemberType;
    \n+
    380
    \n+
    381 typedef typename A::difference_type difference_type;
    \n+
    382
    \n+
    383 typedef typename A::size_type size_type;
    \n+
    384
    \n+
    385 using reference = typename A::value_type &;
    \n+
    386
    \n+
    387 using const_reference = typename A::value_type const&;
    \n+
    388
    \n+
    394 constexpr static int chunkSize_ = (N > 0) ? N : 1;
    \n+
    395
    \n+
    401 inline bool equals(const ConstArrayListIterator<MemberType,N,A>& other) const;
    \n+
    402
    \n+
    406 inline void increment();
    \n+
    407
    \n+
    411 inline void decrement();
    \n+
    412
    \n+
    414 inline void advance(difference_type n);
    \n+
    415
    \n+\n+
    418
    \n+\n+
    424
    \n+\n+
    430
    \n+
    431 inline ConstArrayListIterator() : position_(0), list_(nullptr)
    \n+
    432 {}
    \n+
    433
    \n+\n+
    435
    \n+
    436 private:
    \n+
    437
    \n+
    443 inline ConstArrayListIterator(const ArrayList<T,N,A>& arrayList, size_type position);
    \n+
    444
    \n+
    448 size_type position_;
    \n+
    452 const ArrayList<T,N,A>* list_;
    \n+
    453 };
    \n+
    454
    \n+
    455
    \n+
    456 template<class T, int N, class A>
    \n+\n+
    458 : capacity_(0), size_(0), start_(0)
    \n+
    459 {
    \n+
    460 chunks_.reserve(100);
    \n+
    461 }
    \n+
    462
    \n+
    463 template<class T, int N, class A>
    \n+\n+
    465 capacity_=0;
    \n+
    466 size_=0;
    \n+
    467 start_=0;
    \n+
    468 chunks_.clear();
    \n+
    469 }
    \n+
    470
    \n+
    471 template<class T, int N, class A>
    \n+\n+
    473 {
    \n+
    474 return size_;
    \n+
    475 }
    \n+
    476
    \n+
    477 template<class T, int N, class A>
    \n+\n+
    479 {
    \n+
    480 size_t index=start_+size_;
    \n+
    481 if(index==capacity_)
    \n+
    482 {
    \n+
    483 chunks_.push_back(std::make_shared<std::array<MemberType,chunkSize_> >());
    \n+
    484 capacity_ += chunkSize_;
    \n+
    485 }
    \n+
    486 elementAt(index)=entry;
    \n+
    487 ++size_;
    \n+
    488 }
    \n+
    489
    \n+
    490 template<class T, int N, class A>
    \n+\n+
    492 {
    \n+
    493 return elementAt(start_+i);
    \n+
    494 }
    \n+
    495
    \n+
    496
    \n+
    497 template<class T, int N, class A>
    \n+\n+
    499 {
    \n+
    500 return elementAt(start_+i);
    \n+
    501 }
    \n+
    502
    \n+
    503 template<class T, int N, class A>
    \n+\n+
    505 {
    \n+
    506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    \n+
    507 }
    \n+
    508
    \n+
    509
    \n+
    510 template<class T, int N, class A>
    \n+
    511 typename ArrayList<T,N,A>::const_reference ArrayList<T,N,A>::elementAt(size_type i) const
    \n+
    512 {
    \n+
    513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);
    \n+
    514 }
    \n+
    515
    \n+
    516 template<class T, int N, class A>
    \n+\n+
    518 {
    \n+
    519 return ArrayListIterator<T,N,A>(*this, start_);
    \n+
    520 }
    \n+
    521
    \n+
    522 template<class T, int N, class A>
    \n+\n+
    524 {
    \n+
    525 return ConstArrayListIterator<T,N,A>(*this, start_);
    \n+
    526 }
    \n+
    527
    \n+
    528 template<class T, int N, class A>
    \n+\n+
    530 {
    \n+
    531 return ArrayListIterator<T,N,A>(*this, start_+size_);
    \n+
    532 }
    \n+
    533
    \n+
    534 template<class T, int N, class A>
    \n+\n+
    536 {
    \n+
    537 return ConstArrayListIterator<T,N,A>(*this, start_+size_);
    \n+
    538 }
    \n+
    539
    \n+
    540 template<class T, int N, class A>
    \n+\n+
    542 {
    \n+
    543 // Distance to copy to the left.
    \n+
    544 size_t distance = start_/chunkSize_;
    \n+
    545 if(distance>0) {
    \n+
    546 // Number of chunks with entries in it;
    \n+
    547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ );
    \n+
    548
    \n+
    549 // Copy chunks to the left.
    \n+
    550 std::copy(chunks_.begin()+distance,
    \n+
    551 chunks_.begin()+(distance+chunks), chunks_.begin());
    \n+
    552
    \n+
    553 // Calculate new parameters
    \n+
    554 start_ = start_ % chunkSize_;
    \n+
    555 //capacity += distance * chunkSize_;
    \n+
    556 }
    \n+
    557 }
    \n+
    558
    \n+
    559 template<class T, int N, class A>
    \n+\n+
    561 {
    \n+
    562 position_+=i;
    \n+
    563 }
    \n+
    564
    \n+
    565 template<class T, int N, class A>
    \n+\n+
    567 {
    \n+
    568 position_+=i;
    \n+
    569 }
    \n+
    570
    \n+
    571
    \n+
    572 template<class T, int N, class A>
    \n+\n+
    574 {
    \n+
    575 // Makes only sense if we reference a common list
    \n+
    576 assert(list_==(other.list_));
    \n+
    577 return position_==other.position_ ;
    \n+
    578 }
    \n+
    579
    \n+
    580
    \n+
    581 template<class T, int N, class A>
    \n+\n+
    583 {
    \n+
    584 // Makes only sense if we reference a common list
    \n+
    585 assert(list_==(other.list_));
    \n+
    586 return position_==other.position_ ;
    \n+
    587 }
    \n+
    588
    \n+
    589
    \n+
    590 template<class T, int N, class A>
    \n+\n+
    592 {
    \n+
    593 // Makes only sense if we reference a common list
    \n+
    594 assert(list_==(other.list_));
    \n+
    595 return position_==other.position_ ;
    \n+
    596 }
    \n+
    597
    \n+
    598 template<class T, int N, class A>
    \n+\n+
    600 {
    \n+
    601 ++position_;
    \n+
    602 }
    \n+
    603
    \n+
    604 template<class T, int N, class A>
    \n+\n+
    606 {
    \n+
    607 ++position_;
    \n+
    608 }
    \n+
    609
    \n+
    610 template<class T, int N, class A>
    \n+\n+
    612 {
    \n+
    613 --position_;
    \n+
    614 }
    \n+
    615
    \n+
    616 template<class T, int N, class A>
    \n+\n+
    618 {
    \n+
    619 --position_;
    \n+
    620 }
    \n+
    621
    \n+
    622 template<class T, int N, class A>
    \n+\n+
    624 {
    \n+
    625 return list_->elementAt(i+position_);
    \n+
    626 }
    \n+
    627
    \n+
    628 template<class T, int N, class A>
    \n+\n+
    630 {
    \n+
    631 return list_->elementAt(i+position_);
    \n+
    632 }
    \n+
    633
    \n+
    634 template<class T, int N, class A>
    \n+\n+
    636 {
    \n+
    637 return list_->elementAt(position_);
    \n+
    638 }
    \n+
    639
    \n+
    640 template<class T, int N, class A>
    \n+\n+
    642 {
    \n+
    643 return list_->elementAt(position_);
    \n+
    644 }
    \n+
    645
    \n+
    646 template<class T, int N, class A>
    \n+\n+
    648 {
    \n+
    649 // Makes only sense if we reference a common list
    \n+
    650 assert(list_==(other.list_));
    \n+
    651 return other.position_ - position_;
    \n+
    652 }
    \n+
    653
    \n+
    654 template<class T, int N, class A>
    \n+\n+
    656 {
    \n+
    657 // Makes only sense if we reference a common list
    \n+
    658 assert(list_==(other.list_));
    \n+
    659 return other.position_ - position_;
    \n+
    660 }
    \n+
    661
    \n+
    662 template<class T, int N, class A>
    \n+\n+
    664 {
    \n+
    665 list_->size_ -= ++position_ - list_->start_;
    \n+
    666 // chunk number of the new position.
    \n+
    667 size_t posChunkStart = position_ / chunkSize_;
    \n+
    668 // number of chunks to deallocate
    \n+
    669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_)
    \n+
    670 / chunkSize_;
    \n+
    671 list_->start_ = position_;
    \n+
    672
    \n+
    673 // Deallocate memory not needed any more.
    \n+
    674 for(size_t chunk=0; chunk<chunks; chunk++) {
    \n+
    675 --posChunkStart;
    \n+
    676 list_->chunks_[posChunkStart].reset();
    \n+
    677 }
    \n+
    678
    \n+
    679 // Capacity stays the same as the chunks before us
    \n+
    680 // are still there. They null pointers.
    \n+
    681 assert(list_->start_+list_->size_<=list_->capacity_);
    \n+
    682 }
    \n+
    683
    \n+
    684 template<class T, int N, class A>
    \n+\n+
    686 : position_(position), list_(&arrayList)
    \n+
    687 {}
    \n+
    688
    \n+
    689
    \n+
    690 template<class T, int N, class A>
    \n+
    691 ConstArrayListIterator<T,N,A>::ConstArrayListIterator(const ArrayList<T,N,A>& arrayList,
    \n+
    692 size_type position)
    \n+
    693 : position_(position), list_(&arrayList)
    \n+
    694 {}
    \n+
    695
    \n+
    696 template<class T, int N, class A>
    \n+\n+
    698 : position_(other.position_), list_(other.list_)
    \n+
    699 {}
    \n+
    700
    \n+
    701
    \n+
    703}
    \n+
    704#endif
    \n+
    This file implements iterator facade classes for writing stl conformant iterators.
    \n+
    reference operator[](size_type i)
    Get the element at specific position.
    Definition: arraylist.hh:491
    \n+
    iterator begin()
    Get an iterator that is positioned at the first element.
    Definition: arraylist.hh:517
    \n+
    bool equals(const ArrayListIterator< MemberType, N, A > &other) const
    Comares two iterators.
    Definition: arraylist.hh:573
    \n+
    void increment()
    Increment the iterator.
    Definition: arraylist.hh:599
    \n+
    size_type size() const
    Get the number of elements in the list.
    Definition: arraylist.hh:472
    \n+
    ConstArrayListIterator(const ArrayListIterator< T, N, A > &other)
    Definition: arraylist.hh:697
    \n+
    void purge()
    Purge the list.
    Definition: arraylist.hh:541
    \n+
    void decrement()
    decrement the iterator.
    Definition: arraylist.hh:611
    \n+
    void eraseToHere()
    Erase all entries before the current position and the one at the current position.
    Definition: arraylist.hh:663
    \n+
    ArrayList()
    Constructs an Array list with one chunk.
    Definition: arraylist.hh:457
    \n+
    const_iterator begin() const
    Get a random access iterator that is positioned at the first element.
    Definition: arraylist.hh:523
    \n+
    void increment()
    Increment the iterator.
    Definition: arraylist.hh:605
    \n+
    iterator end()
    Get a random access iterator positioned after the last element.
    Definition: arraylist.hh:529
    \n+
    const_reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition: arraylist.hh:629
    \n+
    const_reference operator[](size_type i) const
    Get the element at specific position.
    Definition: arraylist.hh:498
    \n+
    void decrement()
    decrement the iterator.
    Definition: arraylist.hh:617
    \n+
    void advance(difference_type n)
    Definition: arraylist.hh:566
    \n+
    const_iterator end() const
    Get a random access iterator positioned after the last element.
    Definition: arraylist.hh:535
    \n+
    const_reference dereference() const
    Access the element at the current position.
    Definition: arraylist.hh:641
    \n+
    void clear()
    Delete all entries from the list.
    Definition: arraylist.hh:464
    \n+
    reference elementAt(size_type i) const
    Get the value of the list at an arbitrary position.
    Definition: arraylist.hh:623
    \n+
    bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const
    Comares to iterators.
    Definition: arraylist.hh:591
    \n+
    void advance(difference_type n)
    Definition: arraylist.hh:560
    \n+
    difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other) const
    Definition: arraylist.hh:655
    \n+
    reference dereference() const
    Access the element at the current position.
    Definition: arraylist.hh:635
    \n+
    void push_back(const_reference entry)
    Append an entry to the list.
    Definition: arraylist.hh:478
    \n+
    difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const
    Definition: arraylist.hh:647
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
    Definition: propertymap.hh:84
    \n+
    A random access iterator for the Dune::ArrayList class.
    Definition: arraylist.hh:255
    \n+
    size_type position()
    Definition: arraylist.hh:331
    \n+
    A::value_type MemberType
    The member type.
    Definition: arraylist.hh:263
    \n+
    ArrayListIterator()
    Standard constructor.
    Definition: arraylist.hh:340
    \n+
    A::difference_type difference_type
    Definition: arraylist.hh:265
    \n+
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition: arraylist.hh:278
    \n+
    A::size_type size_type
    Definition: arraylist.hh:267
    \n+
    typename A::value_type const & const_reference
    Definition: arraylist.hh:271
    \n+
    typename A::value_type & reference
    Definition: arraylist.hh:269
    \n+
    A constant random access iterator for the Dune::ArrayList class.
    Definition: arraylist.hh:370
    \n+
    static constexpr int chunkSize_
    The number of elements in one chunk of the list.
    Definition: arraylist.hh:394
    \n+
    typename A::value_type & reference
    Definition: arraylist.hh:385
    \n+
    ConstArrayListIterator()
    Definition: arraylist.hh:431
    \n+
    A::value_type MemberType
    The member type.
    Definition: arraylist.hh:379
    \n+
    A::difference_type difference_type
    Definition: arraylist.hh:381
    \n+
    typename A::value_type const & const_reference
    Definition: arraylist.hh:387
    \n+
    A::size_type size_type
    Definition: arraylist.hh:383
    \n+
    A dynamically growing random access list.
    Definition: arraylist.hh:62
    \n+
    T value_type
    Value type for stl compliance.
    Definition: arraylist.hh:74
    \n+
    static constexpr int chunkSize_
    The number of elements in one chunk of the list. This has to be at least one. The default is 100.
    Definition: arraylist.hh:100
    \n+
    const T * const_pointer
    The type of a const pointer to the type we store.
    Definition: arraylist.hh:94
    \n+
    ArrayListIterator< MemberType, N, A > iterator
    A random access iterator.
    Definition: arraylist.hh:105
    \n+
    const T & const_reference
    The type of a const reference to the type we store.
    Definition: arraylist.hh:84
    \n+
    T & reference
    The type of a reference to the type we store.
    Definition: arraylist.hh:79
    \n+
    std::size_t size_type
    The size type.
    Definition: arraylist.hh:115
    \n+
    T MemberType
    The member type that is stored.
    Definition: arraylist.hh:69
    \n+
    T * pointer
    The type of a pointer to the type we store.
    Definition: arraylist.hh:89
    \n+
    ConstArrayListIterator< MemberType, N, A > const_iterator
    A constant random access iterator.
    Definition: arraylist.hh:110
    \n+
    std::ptrdiff_t difference_type
    The difference type.
    Definition: arraylist.hh:120
    \n+
    Base class for stl conformant forward iterators.
    Definition: iteratorfacades.hh:434
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,48 +4,700 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-variant.hh\n+arraylist.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_STD_VARIANT_HH\n- 6#define DUNE_COMMON_STD_VARIANT_HH\n- 7\n- 8#warning dune/common/std/variant.hh is deprecated and will be removed after\n-Dune 2.8.\\\n- 9 Include instead\n- 10\n- 11#include \n- 12\n- 13namespace Dune {\n- 14namespace Std {\n- 15 using std::variant;\n- 16 using std::visit;\n- 17 using std::variant_size;\n- 18 using std::variant_size_v;\n- 19 using std::get;\n- 20 using std::get_if;\n- 21 using std::holds_alternative;\n- 22 using std::monostate;\n- 23}\n- 24}\n- 25\n- 26#endif\n+ 5\n+ 6#ifndef DUNE_COMMON_ARRAYLIST_HH\n+ 7#define DUNE_COMMON_ARRAYLIST_HH\n+ 8\n+ 9#include \n+ 10#include \n+ 11#include \n+ 12#include \n+ 13#include \"iteratorfacades.hh\"\n+ 14\n+ 15namespace Dune\n+ 16{\n+ 17 // forward declaration\n+ 18 template\n+ 19 class ArrayListIterator;\n+ 20\n+ 21 template\n+ 22 class ConstArrayListIterator;\n+ 23\n+ 60 template >\n+61 class ArrayList\n+ 62 {\n+ 63 public:\n+69 typedef T MemberType;\n+ 70\n+74 typedef T value_type;\n+ 75\n+79 typedef T& reference;\n+ 80\n+84 typedef const T& const_reference;\n+ 85\n+89 typedef T* pointer;\n+ 90\n+94 typedef const T* const_pointer;\n+ 95\n+100 constexpr static int chunkSize_ = (N > 0) ? N : 1;\n+ 101\n+105 typedef ArrayListIterator iterator;\n+ 106\n+110 typedef ConstArrayListIterator const_iterator;\n+ 111\n+115 typedef std::size_t size_type;\n+ 116\n+120 typedef std::ptrdiff_t difference_type;\n+ 121\n+126 iterator begin();\n+ 127\n+133 const_iterator begin() const;\n+ 134\n+139 iterator end();\n+ 140\n+145 const_iterator end() const;\n+ 146\n+151 inline void push_back(const_reference entry);\n+ 152\n+158 inline reference operator[](size_type i);\n+ 159\n+165 inline const_reference operator[](size_type i) const;\n+ 166\n+171 inline size_type size() const;\n+ 172\n+180 inline void purge();\n+ 181\n+185 inline void clear();\n+189 ArrayList();\n+ 190\n+ 191 private:\n+ 192\n+ 196 using SmartPointerAllocator = typename std::allocator_traits::template\n+rebind_alloc< std::shared_ptr< std::array > >;\n+ 197\n+ 201 using ArrayAllocator = typename std::allocator_traits::template\n+rebind_alloc< std::array >;\n+ 202\n+ 206 friend class ArrayListIterator;\n+ 207 friend class ConstArrayListIterator;\n+ 208\n+ 210 std::vector >,\n+ 211 SmartPointerAllocator> chunks_;\n+ 220 size_type capacity_;\n+ 222 size_type size_;\n+ 224 size_type start_;\n+ 233 inline reference elementAt(size_type i);\n+ 234\n+243 inline const_reference elementAt(size_type i) const;\n+ 244 };\n+ 245\n+ 246\n+ 250 template\n+251 class ArrayListIterator : public\n+RandomAccessIteratorFacade,\n+ 252 typename A::value_type,\n+ 253 typename A::value_type &,\n+ 254 typename A::difference_type>\n+ 255 {\n+ 256\n+ 257 friend class ArrayList;\n+ 258 friend class ConstArrayListIterator;\n+ 259 public:\n+263 typedef typename A::value_type MemberType;\n+ 264\n+265 typedef typename A::difference_type difference_type;\n+ 266\n+267 typedef typename A::size_type size_type;\n+ 268\n+269 using reference = typename A::value_type &;\n+ 270\n+271 using const_reference = typename A::value_type const&;\n+ 272\n+278 constexpr static int chunkSize_ = (N > 0) ? N : 1;\n+ 279\n+ 280\n+ 286 inline bool equals(const ArrayListIterator& other) const;\n+ 287\n+ 293 inline bool equals(const ConstArrayListIterator& other)\n+const;\n+ 294\n+ 298 inline void increment();\n+ 299\n+ 303 inline void decrement();\n+ 304\n+ 309 inline reference elementAt(size_type i) const;\n+ 310\n+ 315 inline reference dereference() const;\n+ 316\n+ 328 inline void eraseToHere();\n+ 329\n+331 inline size_type position(){return position_;}\n+ 332\n+ 334 inline void advance(difference_type n);\n+ 335\n+ 337 inline difference_type distanceTo(const ArrayListIterator& other)\n+const;\n+ 338\n+340 inline ArrayListIterator() : position_(0), list_(nullptr)\n+ 341 {}\n+ 342\n+ 343 private:\n+ 349 inline ArrayListIterator(ArrayList& arrayList, size_type position);\n+ 350\n+ 354 size_type position_;\n+358 ArrayList* list_;\n+ 359 };\n+ 360\n+ 364 template\n+365 class ConstArrayListIterator\n+ 366 : public RandomAccessIteratorFacade,\n+ 367 const typename A::value_type,\n+ 368 typename A::value_type const&,\n+ 369 typename A::difference_type>\n+ 370 {\n+ 371\n+ 372 friend class ArrayList;\n+ 373 friend class ArrayListIterator;\n+ 374\n+ 375 public:\n+379 typedef typename A::value_type MemberType;\n+ 380\n+381 typedef typename A::difference_type difference_type;\n+ 382\n+383 typedef typename A::size_type size_type;\n+ 384\n+385 using reference = typename A::value_type &;\n+ 386\n+387 using const_reference = typename A::value_type const&;\n+ 388\n+394 constexpr static int chunkSize_ = (N > 0) ? N : 1;\n+ 395\n+401 inline bool equals(const ConstArrayListIterator& other)\n+const;\n+ 402\n+406 inline void increment();\n+ 407\n+411 inline void decrement();\n+ 412\n+414 inline void advance(difference_type n);\n+ 415\n+417 inline difference_type distanceTo(const ConstArrayListIterator&\n+other) const;\n+ 418\n+423 inline const_reference elementAt(size_type i) const;\n+ 424\n+429 inline const_reference dereference() const;\n+ 430\n+431 inline ConstArrayListIterator() : position_(0), list_(nullptr)\n+ 432 {}\n+ 433\n+434 inline ConstArrayListIterator(const ArrayListIterator& other);\n+ 435\n+ 436 private:\n+ 437\n+ 443 inline ConstArrayListIterator(const ArrayList& arrayList, size_type\n+position);\n+ 444\n+ 448 size_type position_;\n+ 452 const ArrayList* list_;\n+ 453 };\n+ 454\n+ 455\n+ 456 template\n+457 ArrayList::ArrayList()\n+ 458 : capacity_(0), size_(0), start_(0)\n+ 459 {\n+ 460 chunks_.reserve(100);\n+ 461 }\n+ 462\n+ 463 template\n+464 void ArrayList::clear(){\n+ 465 capacity_=0;\n+ 466 size_=0;\n+ 467 start_=0;\n+ 468 chunks_.clear();\n+ 469 }\n+ 470\n+ 471 template\n+472 size_t ArrayList::size() const\n+ 473 {\n+ 474 return size_;\n+ 475 }\n+ 476\n+ 477 template\n+478 void ArrayList::push_back(const_reference entry)\n+ 479 {\n+ 480 size_t index=start_+size_;\n+ 481 if(index==capacity_)\n+ 482 {\n+ 483 chunks_.push_back(std::make_shared >());\n+ 484 capacity_ += chunkSize_;\n+ 485 }\n+ 486 elementAt(index)=entry;\n+ 487 ++size_;\n+ 488 }\n+ 489\n+ 490 template\n+491 typename ArrayList::reference ArrayList::operator[](size_type\n+i)\n+ 492 {\n+ 493 return elementAt(start_+i);\n+ 494 }\n+ 495\n+ 496\n+ 497 template\n+498 typename ArrayList::const_reference ArrayList::operator[]\n+(size_type i) const\n+ 499 {\n+ 500 return elementAt(start_+i);\n+ 501 }\n+ 502\n+ 503 template\n+ 504 typename ArrayList::reference ArrayList::elementAt(size_type\n+i)\n+ 505 {\n+ 506 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);\n+ 507 }\n+ 508\n+ 509\n+ 510 template\n+ 511 typename ArrayList::const_reference ArrayList::elementAt\n+(size_type i) const\n+ 512 {\n+ 513 return chunks_[i/chunkSize_]->operator[](i%chunkSize_);\n+ 514 }\n+ 515\n+ 516 template\n+517 ArrayListIterator ArrayList::begin()\n+ 518 {\n+ 519 return ArrayListIterator(*this, start_);\n+ 520 }\n+ 521\n+ 522 template\n+523 ConstArrayListIterator ArrayList::begin() const\n+ 524 {\n+ 525 return ConstArrayListIterator(*this, start_);\n+ 526 }\n+ 527\n+ 528 template\n+529 ArrayListIterator ArrayList::end()\n+ 530 {\n+ 531 return ArrayListIterator(*this, start_+size_);\n+ 532 }\n+ 533\n+ 534 template\n+535 ConstArrayListIterator ArrayList::end() const\n+ 536 {\n+ 537 return ConstArrayListIterator(*this, start_+size_);\n+ 538 }\n+ 539\n+ 540 template\n+541 void ArrayList::purge()\n+ 542 {\n+ 543 // Distance to copy to the left.\n+ 544 size_t distance = start_/chunkSize_;\n+ 545 if(distance>0) {\n+ 546 // Number of chunks with entries in it;\n+ 547 size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ );\n+ 548\n+ 549 // Copy chunks to the left.\n+ 550 std::copy(chunks_.begin()+distance,\n+ 551 chunks_.begin()+(distance+chunks), chunks_.begin());\n+ 552\n+ 553 // Calculate new parameters\n+ 554 start_ = start_ % chunkSize_;\n+ 555 //capacity += distance * chunkSize_;\n+ 556 }\n+ 557 }\n+ 558\n+ 559 template\n+560 void ArrayListIterator::advance(difference_type i)\n+ 561 {\n+ 562 position_+=i;\n+ 563 }\n+ 564\n+ 565 template\n+566 void ConstArrayListIterator::advance(difference_type i)\n+ 567 {\n+ 568 position_+=i;\n+ 569 }\n+ 570\n+ 571\n+ 572 template\n+573 bool ArrayListIterator::equals(const\n+ArrayListIterator& other) const\n+ 574 {\n+ 575 // Makes only sense if we reference a common list\n+ 576 assert(list_==(other.list_));\n+ 577 return position_==other.position_ ;\n+ 578 }\n+ 579\n+ 580\n+ 581 template\n+582 bool ArrayListIterator::equals(const\n+ConstArrayListIterator& other) const\n+ 583 {\n+ 584 // Makes only sense if we reference a common list\n+ 585 assert(list_==(other.list_));\n+ 586 return position_==other.position_ ;\n+ 587 }\n+ 588\n+ 589\n+ 590 template\n+591 bool ConstArrayListIterator::equals(const\n+ConstArrayListIterator& other) const\n+ 592 {\n+ 593 // Makes only sense if we reference a common list\n+ 594 assert(list_==(other.list_));\n+ 595 return position_==other.position_ ;\n+ 596 }\n+ 597\n+ 598 template\n+599 void ArrayListIterator::increment()\n+ 600 {\n+ 601 ++position_;\n+ 602 }\n+ 603\n+ 604 template\n+605 void ConstArrayListIterator::increment()\n+ 606 {\n+ 607 ++position_;\n+ 608 }\n+ 609\n+ 610 template\n+611 void ArrayListIterator::decrement()\n+ 612 {\n+ 613 --position_;\n+ 614 }\n+ 615\n+ 616 template\n+617 void ConstArrayListIterator::decrement()\n+ 618 {\n+ 619 --position_;\n+ 620 }\n+ 621\n+ 622 template\n+623 typename ArrayListIterator::reference ArrayListIterator::\n+elementAt(size_type i) const\n+ 624 {\n+ 625 return list_->elementAt(i+position_);\n+ 626 }\n+ 627\n+ 628 template\n+629 typename ConstArrayListIterator::const_reference\n+ConstArrayListIterator::elementAt(size_type i) const\n+ 630 {\n+ 631 return list_->elementAt(i+position_);\n+ 632 }\n+ 633\n+ 634 template\n+635 typename ArrayListIterator::reference ArrayListIterator::\n+dereference() const\n+ 636 {\n+ 637 return list_->elementAt(position_);\n+ 638 }\n+ 639\n+ 640 template\n+641 typename ConstArrayListIterator::const_reference\n+ConstArrayListIterator::dereference() const\n+ 642 {\n+ 643 return list_->elementAt(position_);\n+ 644 }\n+ 645\n+ 646 template\n+647 typename ArrayListIterator::difference_type\n+ArrayListIterator::distanceTo(const ArrayListIterator& other)\n+const\n+ 648 {\n+ 649 // Makes only sense if we reference a common list\n+ 650 assert(list_==(other.list_));\n+ 651 return other.position_ - position_;\n+ 652 }\n+ 653\n+ 654 template\n+655 typename ConstArrayListIterator::difference_type\n+ConstArrayListIterator::distanceTo(const ConstArrayListIterator&\n+other) const\n+ 656 {\n+ 657 // Makes only sense if we reference a common list\n+ 658 assert(list_==(other.list_));\n+ 659 return other.position_ - position_;\n+ 660 }\n+ 661\n+ 662 template\n+663 void ArrayListIterator::eraseToHere()\n+ 664 {\n+ 665 list_->size_ -= ++position_ - list_->start_;\n+ 666 // chunk number of the new position.\n+ 667 size_t posChunkStart = position_ / chunkSize_;\n+ 668 // number of chunks to deallocate\n+ 669 size_t chunks = (position_ - list_->start_ + list_->start_ % chunkSize_)\n+ 670 / chunkSize_;\n+ 671 list_->start_ = position_;\n+ 672\n+ 673 // Deallocate memory not needed any more.\n+ 674 for(size_t chunk=0; chunkchunks_[posChunkStart].reset();\n+ 677 }\n+ 678\n+ 679 // Capacity stays the same as the chunks before us\n+ 680 // are still there. They null pointers.\n+ 681 assert(list_->start_+list_->size_<=list_->capacity_);\n+ 682 }\n+ 683\n+ 684 template\n+ 685 ArrayListIterator::ArrayListIterator(ArrayList& arrayList,\n+size_type position)\n+ 686 : position_(position), list_(&arrayList)\n+ 687 {}\n+ 688\n+ 689\n+ 690 template\n+ 691 ConstArrayListIterator::ConstArrayListIterator(const\n+ArrayList& arrayList,\n+ 692 size_type position)\n+ 693 : position_(position), list_(&arrayList)\n+ 694 {}\n+ 695\n+ 696 template\n+697 ConstArrayListIterator::ConstArrayListIterator(const\n+ArrayListIterator& other)\n+ 698 : position_(other.position_), list_(other.list_)\n+ 699 {}\n+ 700\n+ 701\n+ 703}\n+ 704#endif\n+iteratorfacades.hh\n+This file implements iterator facade classes for writing stl conformant\n+iterators.\n+Dune::ArrayList::operator[]\n+reference operator[](size_type i)\n+Get the element at specific position.\n+Definition: arraylist.hh:491\n+Dune::ArrayList::begin\n+iterator begin()\n+Get an iterator that is positioned at the first element.\n+Definition: arraylist.hh:517\n+Dune::ArrayListIterator::equals\n+bool equals(const ArrayListIterator< MemberType, N, A > &other) const\n+Comares two iterators.\n+Definition: arraylist.hh:573\n+Dune::ArrayListIterator::increment\n+void increment()\n+Increment the iterator.\n+Definition: arraylist.hh:599\n+Dune::ArrayList::size\n+size_type size() const\n+Get the number of elements in the list.\n+Definition: arraylist.hh:472\n+Dune::ConstArrayListIterator::ConstArrayListIterator\n+ConstArrayListIterator(const ArrayListIterator< T, N, A > &other)\n+Definition: arraylist.hh:697\n+Dune::ArrayList::purge\n+void purge()\n+Purge the list.\n+Definition: arraylist.hh:541\n+Dune::ArrayListIterator::decrement\n+void decrement()\n+decrement the iterator.\n+Definition: arraylist.hh:611\n+Dune::ArrayListIterator::eraseToHere\n+void eraseToHere()\n+Erase all entries before the current position and the one at the current\n+position.\n+Definition: arraylist.hh:663\n+Dune::ArrayList::ArrayList\n+ArrayList()\n+Constructs an Array list with one chunk.\n+Definition: arraylist.hh:457\n+Dune::ArrayList::begin\n+const_iterator begin() const\n+Get a random access iterator that is positioned at the first element.\n+Definition: arraylist.hh:523\n+Dune::ConstArrayListIterator::increment\n+void increment()\n+Increment the iterator.\n+Definition: arraylist.hh:605\n+Dune::ArrayList::end\n+iterator end()\n+Get a random access iterator positioned after the last element.\n+Definition: arraylist.hh:529\n+Dune::ConstArrayListIterator::elementAt\n+const_reference elementAt(size_type i) const\n+Get the value of the list at an arbitrary position.\n+Definition: arraylist.hh:629\n+Dune::ArrayList::operator[]\n+const_reference operator[](size_type i) const\n+Get the element at specific position.\n+Definition: arraylist.hh:498\n+Dune::ConstArrayListIterator::decrement\n+void decrement()\n+decrement the iterator.\n+Definition: arraylist.hh:617\n+Dune::ConstArrayListIterator::advance\n+void advance(difference_type n)\n+Definition: arraylist.hh:566\n+Dune::ArrayList::end\n+const_iterator end() const\n+Get a random access iterator positioned after the last element.\n+Definition: arraylist.hh:535\n+Dune::ConstArrayListIterator::dereference\n+const_reference dereference() const\n+Access the element at the current position.\n+Definition: arraylist.hh:641\n+Dune::ArrayList::clear\n+void clear()\n+Delete all entries from the list.\n+Definition: arraylist.hh:464\n+Dune::ArrayListIterator::elementAt\n+reference elementAt(size_type i) const\n+Get the value of the list at an arbitrary position.\n+Definition: arraylist.hh:623\n+Dune::ConstArrayListIterator::equals\n+bool equals(const ConstArrayListIterator< MemberType, N, A > &other) const\n+Comares to iterators.\n+Definition: arraylist.hh:591\n+Dune::ArrayListIterator::advance\n+void advance(difference_type n)\n+Definition: arraylist.hh:560\n+Dune::ConstArrayListIterator::distanceTo\n+difference_type distanceTo(const ConstArrayListIterator< T, N, A > &other)\n+const\n+Definition: arraylist.hh:655\n+Dune::ArrayListIterator::dereference\n+reference dereference() const\n+Access the element at the current position.\n+Definition: arraylist.hh:635\n+Dune::ArrayList::push_back\n+void push_back(const_reference entry)\n+Append an entry to the list.\n+Definition: arraylist.hh:478\n+Dune::ArrayListIterator::distanceTo\n+difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const\n+Definition: arraylist.hh:647\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::get\n-Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const\n-Key &key)\n-Definition: propertymap.hh:84\n+Dune::ArrayListIterator\n+A random access iterator for the Dune::ArrayList class.\n+Definition: arraylist.hh:255\n+Dune::ArrayListIterator::position\n+size_type position()\n+Definition: arraylist.hh:331\n+Dune::ArrayListIterator::MemberType\n+A::value_type MemberType\n+The member type.\n+Definition: arraylist.hh:263\n+Dune::ArrayListIterator::ArrayListIterator\n+ArrayListIterator()\n+Standard constructor.\n+Definition: arraylist.hh:340\n+Dune::ArrayListIterator::difference_type\n+A::difference_type difference_type\n+Definition: arraylist.hh:265\n+Dune::ArrayListIterator::chunkSize_\n+static constexpr int chunkSize_\n+The number of elements in one chunk of the list.\n+Definition: arraylist.hh:278\n+Dune::ArrayListIterator::size_type\n+A::size_type size_type\n+Definition: arraylist.hh:267\n+Dune::ArrayListIterator::const_reference\n+typename A::value_type const & const_reference\n+Definition: arraylist.hh:271\n+Dune::ArrayListIterator::reference\n+typename A::value_type & reference\n+Definition: arraylist.hh:269\n+Dune::ConstArrayListIterator\n+A constant random access iterator for the Dune::ArrayList class.\n+Definition: arraylist.hh:370\n+Dune::ConstArrayListIterator::chunkSize_\n+static constexpr int chunkSize_\n+The number of elements in one chunk of the list.\n+Definition: arraylist.hh:394\n+Dune::ConstArrayListIterator::reference\n+typename A::value_type & reference\n+Definition: arraylist.hh:385\n+Dune::ConstArrayListIterator::ConstArrayListIterator\n+ConstArrayListIterator()\n+Definition: arraylist.hh:431\n+Dune::ConstArrayListIterator::MemberType\n+A::value_type MemberType\n+The member type.\n+Definition: arraylist.hh:379\n+Dune::ConstArrayListIterator::difference_type\n+A::difference_type difference_type\n+Definition: arraylist.hh:381\n+Dune::ConstArrayListIterator::const_reference\n+typename A::value_type const & const_reference\n+Definition: arraylist.hh:387\n+Dune::ConstArrayListIterator::size_type\n+A::size_type size_type\n+Definition: arraylist.hh:383\n+Dune::ArrayList\n+A dynamically growing random access list.\n+Definition: arraylist.hh:62\n+Dune::ArrayList::value_type\n+T value_type\n+Value type for stl compliance.\n+Definition: arraylist.hh:74\n+Dune::ArrayList::chunkSize_\n+static constexpr int chunkSize_\n+The number of elements in one chunk of the list. This has to be at least one.\n+The default is 100.\n+Definition: arraylist.hh:100\n+Dune::ArrayList::const_pointer\n+const T * const_pointer\n+The type of a const pointer to the type we store.\n+Definition: arraylist.hh:94\n+Dune::ArrayList::iterator\n+ArrayListIterator< MemberType, N, A > iterator\n+A random access iterator.\n+Definition: arraylist.hh:105\n+Dune::ArrayList::const_reference\n+const T & const_reference\n+The type of a const reference to the type we store.\n+Definition: arraylist.hh:84\n+Dune::ArrayList::reference\n+T & reference\n+The type of a reference to the type we store.\n+Definition: arraylist.hh:79\n+Dune::ArrayList::size_type\n+std::size_t size_type\n+The size type.\n+Definition: arraylist.hh:115\n+Dune::ArrayList::MemberType\n+T MemberType\n+The member type that is stored.\n+Definition: arraylist.hh:69\n+Dune::ArrayList::pointer\n+T * pointer\n+The type of a pointer to the type we store.\n+Definition: arraylist.hh:89\n+Dune::ArrayList::const_iterator\n+ConstArrayListIterator< MemberType, N, A > const_iterator\n+A constant random access iterator.\n+Definition: arraylist.hh:110\n+Dune::ArrayList::difference_type\n+std::ptrdiff_t difference_type\n+The difference type.\n+Definition: arraylist.hh:120\n+Dune::RandomAccessIteratorFacade\n+Base class for stl conformant forward iterators.\n+Definition: iteratorfacades.hh:434\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00119.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00119.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: utility.hh File Reference\n+dune-common: parametertreeparser.hh File Reference\n \n \n \n \n \n \n \n@@ -58,36 +58,55 @@\n \n \n \n \n \n
    \n \n-
    utility.hh File Reference
    \n+
    parametertreeparser.hh File Reference
    \n
    \n
    \n-
    #include <utility>
    \n+\n+

    Various parser methods to get data into a ParameterTree object. \n+More...

    \n+
    #include <istream>
    \n+#include <string>
    \n+#include <vector>
    \n+#include <dune/common/parametertree.hh>
    \n+#include <dune/common/exceptions.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+Classes

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

    \n Namespaces

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

    Detailed Description

    \n+

    Various parser methods to get data into a ParameterTree object.

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,22 +4,35 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-Namespaces\n-utility.hh File Reference\n-#include \n+Classes | Namespaces\n+parametertreeparser.hh File Reference\n+Various parser methods to get data into a ParameterTree object. More...\n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+class \u00a0Dune::ParameterTreeParserError\n+\u00a0 report parser error while reading ParameterTree More...\n+\u00a0\n+class \u00a0Dune::HelpRequest\n+\u00a0 exception thrown if the user wants to see help string More...\n+\u00a0\n+class \u00a0Dune::ParameterTreeParser\n+\u00a0 Parsers to set up a ParameterTree from various input sources. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::Std\n-\u00a0 Namespace for features backported from new C++ standards.\n-\u00a0\n+***** Detailed Description *****\n+Various parser methods to get data into a ParameterTree object.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00119_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: utility.hh Source File\n+dune-common: parametertreeparser.hh Source File\n \n \n \n \n \n \n \n@@ -58,49 +58,95 @@\n \n \n \n \n \n
    \n-
    utility.hh
    \n+
    parametertreeparser.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n-
    2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    3#ifndef DUNE_COMMON_STD_UTILITY_HH
    \n-
    4#define DUNE_COMMON_STD_UTILITY_HH
    \n-
    5
    \n-
    6#include <utility>
    \n+Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n+
    2// vi: set et ts=4 sw=2 sts=2:
    \n+
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n+
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n+
    5#ifndef DUNE_PARAMETER_PARSER_HH
    \n+
    6#define DUNE_PARAMETER_PARSER_HH
    \n
    7
    \n-
    8#warning dune/common/std/utility.hh is deprecated and will be removed after Dune 2.8.\\
    \n-
    9 Include <utility> instead
    \n-
    10
    \n-
    11namespace Dune
    \n-
    12{
    \n-
    13
    \n-
    14 namespace Std
    \n-
    15 {
    \n-
    16
    \n-
    17 using std::integer_sequence;
    \n-
    18 using std::index_sequence;
    \n-
    19 using std::make_integer_sequence;
    \n-
    20 using std::make_index_sequence;
    \n-
    21 using std::index_sequence_for;
    \n-
    22
    \n-
    23 } // namespace Std
    \n-
    24
    \n-
    25} // namespace Dune
    \n-
    26
    \n-
    27#endif // #ifndef DUNE_COMMON_STD_UTILITY_HH
    \n+
    12#include <istream>
    \n+
    13#include <string>
    \n+
    14#include <vector>
    \n+
    15
    \n+\n+\n+
    18
    \n+
    19namespace Dune {
    \n+
    20
    \n+\n+
    28 class HelpRequest : public Exception {};
    \n+
    29
    \n+\n+
    35 {
    \n+
    36
    \n+
    37 static std::string ltrim(const std::string& s);
    \n+
    38 static std::string rtrim(const std::string& s);
    \n+
    39
    \n+
    40 public:
    \n+
    41
    \n+
    85
    \n+
    96 static void readINITree(std::istream& in, ParameterTree& pt,
    \n+
    97 bool overwrite);
    \n+
    98
    \n+
    105 static Dune::ParameterTree readINITree(std::istream& in);
    \n+
    106
    \n+
    107
    \n+
    120 static void readINITree(std::istream& in, ParameterTree& pt,
    \n+
    121 const std::string srcname = "stream",
    \n+
    122 bool overwrite = true);
    \n+
    123
    \n+
    124
    \n+
    135 static void readINITree(std::string file, ParameterTree& pt, bool overwrite = true);
    \n+
    136
    \n+
    143 static Dune::ParameterTree readINITree(const std::string& file);
    \n+
    144
    \n+
    146
    \n+
    158 static void readOptions(int argc, char* argv [], ParameterTree& pt);
    \n+
    159
    \n+
    177 static void readNamedOptions(int argc, char* argv[],
    \n+
    178 ParameterTree& pt,
    \n+
    179 std::vector<std::string> keywords,
    \n+
    180 unsigned int required = std::numeric_limits<unsigned int>::max(),
    \n+
    181 bool allow_more = true,
    \n+
    182 bool overwrite = true,
    \n+
    183 std::vector<std::string> help = std::vector<std::string>());
    \n+
    184
    \n+
    185 private:
    \n+
    186 static std::string generateHelpString(std::string progname, std::vector<std::string> keywords, unsigned int required, std::vector<std::string> help);
    \n+
    187 };
    \n+
    188
    \n+
    189} // end namespace Dune
    \n+
    190
    \n+
    191#endif // DUNE_PARAMETER_PARSER_HH
    \n+
    A hierarchical structure of string parameters.
    \n+
    A few common exception classes.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n+
    auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align > &b)
    Definition: debugalign.hh:425
    \n+
    Base class for Dune-Exceptions.
    Definition: exceptions.hh:96
    \n+
    Default exception class for range errors.
    Definition: exceptions.hh:254
    \n+
    Hierarchical structure of string parameters.
    Definition: parametertree.hh:37
    \n+
    report parser error while reading ParameterTree
    Definition: parametertreeparser.hh:22
    \n+
    exception thrown if the user wants to see help string
    Definition: parametertreeparser.hh:28
    \n+
    Parsers to set up a ParameterTree from various input sources.
    Definition: parametertreeparser.hh:35
    \n+
    static void readOptions(int argc, char *argv[], ParameterTree &pt)
    parse command line options and build hierarchical ParameterTree structure
    Definition: parametertreeparser.cc:159
    \n+
    static void readINITree(std::istream &in, ParameterTree &pt, bool overwrite)
    parse C++ stream
    Definition: parametertreeparser.cc:74
    \n+
    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:175
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,45 +4,122 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-utility.hh\n+parametertreeparser.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n+ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n+ 2// vi: set et ts=4 sw=2 sts=2:\n+ 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 3#ifndef DUNE_COMMON_STD_UTILITY_HH\n- 4#define DUNE_COMMON_STD_UTILITY_HH\n- 5\n- 6#include \n+ 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n+ 5#ifndef DUNE_PARAMETER_PARSER_HH\n+ 6#define DUNE_PARAMETER_PARSER_HH\n 7\n- 8#warning dune/common/std/utility.hh is deprecated and will be removed after\n-Dune 2.8.\\\n- 9 Include instead\n- 10\n- 11namespace Dune\n- 12{\n- 13\n- 14 namespace Std\n- 15 {\n- 16\n- 17 using std::integer_sequence;\n- 18 using std::index_sequence;\n- 19 using std::make_integer_sequence;\n- 20 using std::make_index_sequence;\n- 21 using std::index_sequence_for;\n- 22\n- 23 } // namespace Std\n- 24\n- 25} // namespace Dune\n- 26\n- 27#endif // #ifndef DUNE_COMMON_STD_UTILITY_HH\n+ 12#include \n+ 13#include \n+ 14#include \n+ 15\n+ 16#include \n+ 17#include \n+ 18\n+ 19namespace Dune {\n+ 20\n+22 class ParameterTreeParserError : public RangeError {};\n+28 class HelpRequest : public Exception {};\n+ 29\n+34 class ParameterTreeParser\n+ 35 {\n+ 36\n+ 37 static std::string ltrim(const std::string& s);\n+ 38 static std::string rtrim(const std::string& s);\n+ 39\n+ 40 public:\n+ 41\n+ 85\n+ 96 static void readINITree(std::istream& in, ParameterTree& pt,\n+ 97 bool overwrite);\n+ 98\n+ 105 static Dune::ParameterTree readINITree(std::istream& in);\n+ 106\n+ 107\n+ 120 static void readINITree(std::istream& in, ParameterTree& pt,\n+ 121 const std::string srcname = \"stream\",\n+ 122 bool overwrite = true);\n+ 123\n+ 124\n+ 135 static void readINITree(std::string file, ParameterTree& pt, bool\n+overwrite = true);\n+ 136\n+ 143 static Dune::ParameterTree readINITree(const std::string& file);\n+ 144\n+ 146\n+ 158 static void readOptions(int argc, char* argv [], ParameterTree& pt);\n+ 159\n+ 177 static void readNamedOptions(int argc, char* argv[],\n+ 178 ParameterTree& pt,\n+ 179 std::vector keywords,\n+ 180 unsigned int required = std::numeric_limits::max(),\n+ 181 bool allow_more = true,\n+ 182 bool overwrite = true,\n+ 183 std::vector help = std::vector());\n+ 184\n+ 185 private:\n+ 186 static std::string generateHelpString(std::string progname, std::\n+vector keywords, unsigned int required, std::vector\n+help);\n+ 187 };\n+ 188\n+ 189} // end namespace Dune\n+ 190\n+ 191#endif // DUNE_PARAMETER_PARSER_HH\n+parametertree.hh\n+A hierarchical structure of string parameters.\n+exceptions.hh\n+A few common exception classes.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n+Dune::AlignedNumberImpl::max\n+auto max(const AlignedNumber< T, align > &a, const AlignedNumber< T, align >\n+&b)\n+Definition: debugalign.hh:425\n+Dune::Exception\n+Base class for Dune-Exceptions.\n+Definition: exceptions.hh:96\n+Dune::RangeError\n+Default exception class for range errors.\n+Definition: exceptions.hh:254\n+Dune::ParameterTree\n+Hierarchical structure of string parameters.\n+Definition: parametertree.hh:37\n+Dune::ParameterTreeParserError\n+report parser error while reading ParameterTree\n+Definition: parametertreeparser.hh:22\n+Dune::HelpRequest\n+exception thrown if the user wants to see help string\n+Definition: parametertreeparser.hh:28\n+Dune::ParameterTreeParser\n+Parsers to set up a ParameterTree from various input sources.\n+Definition: parametertreeparser.hh:35\n+Dune::ParameterTreeParser::readOptions\n+static void readOptions(int argc, char *argv[], ParameterTree &pt)\n+parse command line options and build hierarchical ParameterTree structure\n+Definition: parametertreeparser.cc:159\n+Dune::ParameterTreeParser::readINITree\n+static void readINITree(std::istream &in, ParameterTree &pt, bool overwrite)\n+parse C++ stream\n+Definition: parametertreeparser.cc:74\n+Dune::ParameterTreeParser::readNamedOptions\n+static void readNamedOptions(int argc, char *argv[], ParameterTree &pt, std::\n+vector< std::string > keywords, unsigned int required=std::numeric_limits<\n+unsigned int >::max(), bool allow_more=true, bool overwrite=true, std::vector<\n+std::string > help=std::vector< std::string >())\n+read [named] command line options and build hierarchical ParameterTree\n+structure\n+Definition: parametertreeparser.cc:175\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00122.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00122.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: functional.hh File Reference\n+dune-common: shared_ptr.hh File Reference\n \n \n \n \n \n \n \n@@ -58,43 +58,63 @@\n \n
    \n \n \n \n
    \n \n-
    functional.hh File Reference
    \n+Namespaces |\n+Functions
    \n+
    shared_ptr.hh File Reference
    \n \n
    \n-
    #include <functional>
    \n+\n+

    This file implements several utilities related to std::shared_ptr. \n+More...

    \n+
    #include <memory>
    \n+#include <dune/common/typetraits.hh>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n-\n+\n+\n \n

    \n Classes

    struct  Dune::Std::identity
     A function object type whose operator() returns its argument unchanged. More...
    struct  Dune::null_deleter< T >
     implements the Deleter concept of shared_ptr without deleting anything More...
     
    \n \n \n \n \n-\n-\n-\n+

    \n Namespaces

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

    \n+Functions

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

    Detailed Description

    \n+

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

    \n+
    Author
    Markus Blatt
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,27 +4,42 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-Classes | Namespaces\n-functional.hh File Reference\n-#include \n+Classes | Namespaces | Functions\n+shared_ptr.hh File Reference\n+This file implements several utilities related to std::shared_ptr. More...\n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::Std::identity\n-\u00a0 A function object type whose operator() returns its argument\n- unchanged. More...\n+struct \u00a0Dune::null_deleter<_T_>\n+\u00a0 implements the Deleter concept of shared_ptr without deleting anything\n+ More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n-namespace \u00a0Dune::Std\n-\u00a0 Namespace for features backported from new C++ standards.\n+ Functions\n+template\n+std::shared_ptr< T >\u00a0Dune::stackobject_to_shared_ptr (T &t)\n+\u00a0 Create a shared_ptr for a stack-allocated object. More...\n \u00a0\n+template\n+ auto\u00a0Dune::wrap_or_move (T &&t)\n+\u00a0 Capture R-value reference to shared_ptr. More...\n+\u00a0\n+template\n+ auto\u00a0Dune::wrap_or_move (T &t)\n+\u00a0 Capture L-value reference to std::shared_ptr. More...\n+\u00a0\n+***** Detailed Description *****\n+This file implements several utilities related to std::shared_ptr.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00122_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: functional.hh Source File\n+dune-common: shared_ptr.hh Source File\n \n \n \n \n \n \n \n@@ -58,52 +58,68 @@\n \n \n \n \n \n
    \n-
    functional.hh
    \n+
    shared_ptr.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n-
    2// vi: set ts=8 sw=2 et sts=2:
    \n+Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n+
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5#ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
    \n-
    6#define DUNE_COMMON_STD_FUNCTIONAL_HH
    \n-
    7
    \n-
    8#include <functional>
    \n-
    9
    \n-
    10namespace Dune
    \n-
    11{
    \n-
    12
    \n-
    13 namespace Std
    \n-
    14 {
    \n-
    15
    \n-
    22#if DUNE_HAVE_CXX_STD_IDENTITY
    \n-
    23 using std::identity;
    \n-
    24#else //DUNE_HAVE_CXX_STD_IDENTITY
    \n-
    25 struct identity {
    \n-
    26 template<class T>
    \n-
    27 constexpr T&& operator()(T&& t ) const noexcept {return std::forward<T>(t);}
    \n-
    28 };
    \n-
    29#endif
    \n-
    30 } // namespace Std
    \n-
    31
    \n-
    32} // namespace Dune
    \n-
    33
    \n-
    34#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH
    \n+
    5
    \n+
    6#ifndef DUNE_SHARED_PTR_HH
    \n+
    7#define DUNE_SHARED_PTR_HH
    \n+
    8
    \n+
    9#include <memory>
    \n+
    10
    \n+\n+
    17namespace Dune
    \n+
    18{
    \n+
    47 template<class T>
    \n+\n+
    49 {
    \n+
    50 void operator() (T*) const {}
    \n+
    51 };
    \n+
    52
    \n+
    71 template<typename T>
    \n+
    72 inline std::shared_ptr<T> stackobject_to_shared_ptr(T & t)
    \n+
    73 {
    \n+
    74 return std::shared_ptr<T>(&t, null_deleter<T>());
    \n+
    75 }
    \n+
    76
    \n+
    77
    \n+
    95 template<class T>
    \n+
    96 auto wrap_or_move(T&& t)
    \n+
    97 {
    \n+
    98 return std::make_shared<std::decay_t<T>>(std::forward<T>(t));
    \n+
    99 }
    \n+
    100
    \n+
    118 template<class T>
    \n+
    119 auto wrap_or_move(T& t)
    \n+
    120 {
    \n+\n+
    122 }
    \n+
    123
    \n+
    124}
    \n+
    125#endif
    \n+
    Traits for type conversions and type information.
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    A function object type whose operator() returns its argument unchanged.
    Definition: functional.hh:25
    \n-
    constexpr T && operator()(T &&t) const noexcept
    Definition: functional.hh:27
    \n+
    std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
    Create a shared_ptr for a stack-allocated object.
    Definition: shared_ptr.hh:72
    \n+
    auto wrap_or_move(T &&t)
    Capture R-value reference to shared_ptr.
    Definition: shared_ptr.hh:96
    \n+
    implements the Deleter concept of shared_ptr without deleting anything
    Definition: shared_ptr.hh:49
    \n+
    std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
    Create a shared_ptr for a stack-allocated object.
    Definition: shared_ptr.hh:72
    \n+
    void operator()(T *) const
    Definition: shared_ptr.hh:50
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,51 +4,76 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n- * std\n-functional.hh\n+shared_ptr.hh\n Go_to_the_documentation_of_this_file.\n- 1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n- 2// vi: set ts=8 sw=2 et sts=2:\n+ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n+ 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5#ifndef DUNE_COMMON_STD_FUNCTIONAL_HH\n- 6#define DUNE_COMMON_STD_FUNCTIONAL_HH\n- 7\n- 8#include \n- 9\n- 10namespace Dune\n- 11{\n- 12\n- 13 namespace Std\n- 14 {\n- 15\n- 22#if DUNE_HAVE_CXX_STD_IDENTITY\n- 23 using std::identity;\n- 24#else //DUNE_HAVE_CXX_STD_IDENTITY\n-25 struct identity {\n- 26 template\n-27 constexpr T&& operator()(T&& t ) const noexcept {return std::forward(t);}\n- 28 };\n- 29#endif\n- 30 } // namespace Std\n- 31\n- 32} // namespace Dune\n- 33\n- 34#endif // #ifndef DUNE_COMMON_STD_FUNCTIONAL_HH\n+ 5\n+ 6#ifndef DUNE_SHARED_PTR_HH\n+ 7#define DUNE_SHARED_PTR_HH\n+ 8\n+ 9#include \n+ 10\n+ 11#include \n+ 17namespace Dune\n+ 18{\n+ 47 template\n+48 struct null_deleter\n+ 49 {\n+50 void operator()(T*) const {}\n+ 51 };\n+ 52\n+ 71 template\n+72 inline std::shared_ptr stackobject_to_shared_ptr(T & t)\n+ 73 {\n+ 74 return std::shared_ptr(&t, null_deleter());\n+ 75 }\n+ 76\n+ 77\n+ 95 template\n+96 auto wrap_or_move(T&& t)\n+ 97 {\n+ 98 return std::make_shared>(std::forward(t));\n+ 99 }\n+ 100\n+ 118 template\n+119 auto wrap_or_move(T& t)\n+ 120 {\n+ 121 return stackobject_to_shared_ptr(t);\n+ 122 }\n+ 123\n+ 124}\n+ 125#endif\n+typetraits.hh\n+Traits for type conversions and type information.\n Dune\n Dune namespace.\n Definition: alignedallocator.hh:13\n-Dune::Std::identity\n-A function object type whose operator() returns its argument unchanged.\n-Definition: functional.hh:25\n-Dune::Std::identity::operator()\n-constexpr T && operator()(T &&t) const noexcept\n-Definition: functional.hh:27\n+Dune::stackobject_to_shared_ptr\n+std::shared_ptr< T > stackobject_to_shared_ptr(T &t)\n+Create a shared_ptr for a stack-allocated object.\n+Definition: shared_ptr.hh:72\n+Dune::wrap_or_move\n+auto wrap_or_move(T &&t)\n+Capture R-value reference to shared_ptr.\n+Definition: shared_ptr.hh:96\n+Dune::null_deleter\n+implements the Deleter concept of shared_ptr without deleting anything\n+Definition: shared_ptr.hh:49\n+Dune::null_deleter::stackobject_to_shared_ptr\n+std::shared_ptr< T > stackobject_to_shared_ptr(T &t)\n+Create a shared_ptr for a stack-allocated object.\n+Definition: shared_ptr.hh:72\n+Dune::null_deleter::operator()\n+void operator()(T *) const\n+Definition: shared_ptr.hh:50\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00125.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00125.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: densevector.hh File Reference\n+dune-common: parametertreeparser.cc File Reference\n \n \n \n \n \n \n \n@@ -62,56 +62,28 @@\n \n
    \n \n
    \n
    \n
    \n- \n-
    densevector.hh File Reference
    \n+
    parametertreeparser.cc File Reference
    \n
    \n
    \n-\n-

    Implements the dense vector interface, with an exchangeable storage class. \n-More...

    \n-
    #include <algorithm>
    \n-#include <limits>
    \n-#include <type_traits>
    \n-#include "genericiterator.hh"
    \n-#include "ftraits.hh"
    \n-#include "matvectraits.hh"
    \n-#include "promotiontraits.hh"
    \n-#include "dotproduct.hh"
    \n-#include "boundschecking.hh"
    \n-
    \n-

    Go to the source code of this file.

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

    \n-Classes

    struct  Dune::FieldTraits< DenseVector< V > >
     
    class  Dune::DenseIterator< C, T, R >
     Generic iterator class for dense vector and matrix implementations. More...
     
    class  Dune::DenseVector< V >
     Interface for a class of dense vectors over a given field. More...
     
    \n-\n-\n-\n-\n-\n-\n-

    \n-Namespaces

    namespace  Dune
     Dune namespace.
     
    namespace  Dune::fvmeta
     
    \n-

    Detailed Description

    \n-

    Implements the dense vector interface, with an exchangeable storage class.

    \n+
    #include "parametertreeparser.hh"
    \n+#include <cstdlib>
    \n+#include <iostream>
    \n+#include <ostream>
    \n+#include <string>
    \n+#include <sstream>
    \n+#include <fstream>
    \n+#include <set>
    \n+#include <map>
    \n+#include <algorithm>
    \n+#include <dune/common/exceptions.hh>
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,43 +4,22 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-Classes | Namespaces\n-densevector.hh File Reference\n-Common \u00bb Dense_Matrix_and_Vector_Template_Library\n-Implements the dense vector interface, with an exchangeable storage class.\n-More...\n+parametertreeparser.cc File Reference\n+#include \"parametertreeparser.hh\"\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n #include \n-#include \n-#include \n-#include \"genericiterator.hh\"\n-#include \"ftraits.hh\"\n-#include \"matvectraits.hh\"\n-#include \"promotiontraits.hh\"\n-#include \"dotproduct.hh\"\n-#include \"boundschecking.hh\"\n-Go_to_the_source_code_of_this_file.\n- Classes\n-struct \u00a0Dune::FieldTraits<_DenseVector<_V_>_>\n-\u00a0\n- class \u00a0Dune::DenseIterator<_C,_T,_R_>\n-\u00a0 Generic iterator class for dense vector and matrix implementations.\n- More...\n-\u00a0\n- class \u00a0Dune::DenseVector<_V_>\n-\u00a0 Interface for a class of dense vectors over a given field. More...\n-\u00a0\n- Namespaces\n-namespace \u00a0Dune\n-\u00a0 Dune namespace.\n-\u00a0\n-namespace \u00a0Dune::fvmeta\n-\u00a0\n-***** Detailed Description *****\n-Implements the dense vector interface, with an exchangeable storage class.\n+#include \n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00128.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00128.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: parametertree.cc File Reference\n+dune-common: stringutility.hh File Reference\n \n \n \n \n \n \n \n@@ -62,27 +62,58 @@\n \n
    \n \n
    \n
    \n
    \n-
    parametertree.cc File Reference
    \n+ \n+
    stringutility.hh File Reference
    \n
    \n
    \n-
    #include <cstdlib>
    \n-#include <iostream>
    \n-#include <ostream>
    \n-#include <string>
    \n-#include <sstream>
    \n-#include <fstream>
    \n-#include <set>
    \n+\n+

    Miscellaneous helper stuff. \n+More...

    \n+
    #include <cstddef>
    \n+#include <cstring>
    \n #include <algorithm>
    \n-#include <dune/common/exceptions.hh>
    \n-#include <dune/common/parametertree.hh>
    \n+#include <cassert>
    \n+#include <cstdio>
    \n+#include <memory>
    \n+#include <string>
    \n+#include <new>
    \n+#include <dune/common/exceptions.hh>
    \n+
    \n+

    Go to the source code of this file.

    \n+\n+\n+\n+\n+\n+

    \n+Namespaces

    namespace  Dune
     Dune namespace.
     
    \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

    \n+Functions

    template<typename C >
    bool Dune::hasPrefix (const C &c, const char *prefix)
     Check whether a character container has a given prefix. More...
     
    template<typename C >
    bool Dune::hasSuffix (const C &c, const char *suffix)
     Check whether a character container has a given suffix. More...
     
    template<class... T>
    static std::string Dune::formatString (const std::string &s, const T &... args)
     Format values according to printf format string. More...
     
    \n+

    Detailed Description

    \n+

    Miscellaneous helper stuff.

    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,21 +4,45 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-parametertree.cc File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+Namespaces | Functions\n+stringutility.hh File Reference\n+Miscellaneous helper stuff. More...\n+#include \n+#include \n #include \n+#include \n+#include \n+#include \n+#include \n+#include \n #include \n-#include \n+Go_to_the_source_code_of_this_file.\n+ Namespaces\n+namespace \u00a0Dune\n+\u00a0 Dune namespace.\n+\u00a0\n+ Functions\n+template\n+ bool\u00a0Dune::hasPrefix (const C &c, const char *prefix)\n+\u00a0 Check whether a character container has a given prefix.\n+ More...\n+\u00a0\n+template\n+ bool\u00a0Dune::hasSuffix (const C &c, const char *suffix)\n+\u00a0 Check whether a character container has a given suffix.\n+ More...\n+\u00a0\n+template\n+static std::string\u00a0Dune::formatString (const std::string &s, const T &...\n+ args)\n+\u00a0 Format values according to printf format string. More...\n+\u00a0\n+***** Detailed Description *****\n+Miscellaneous helper stuff.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00131.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00131.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: tupleutility.hh File Reference\n+dune-common: enumset.hh File Reference\n \n \n \n \n \n \n \n@@ -66,115 +66,69 @@\n
    \n \n
    \n \n-
    tupleutility.hh File Reference
    \n+
    enumset.hh File Reference
    \n
    \n
    \n \n-

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

    Classes for building sets out of enumeration values. \n More...

    \n-
    #include <cstddef>
    \n-#include <tuple>
    \n-#include <type_traits>
    \n-#include <utility>
    \n-#include <dune/common/hybridutilities.hh>
    \n-#include <dune/common/typetraits.hh>
    \n+
    #include <iostream>
    \n
    \n

    Go to the source code of this file.

    \n \n \n-\n+\n+\n \n-\n+\n+\n \n-\n+\n+\n \n-\n+\n+\n \n-\n+\n+\n \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n \n

    \n Classes

    struct  Dune::TupleAccessTraits< T >
    class  Dune::EmptySet< TA >
     An empty set. More...
     
    struct  Dune::TupleAccessTraits< T * >
    class  Dune::AllSet< TA >
     A set containing everything. More...
     
    struct  Dune::TupleAccessTraits< T & >
    class  Dune::EnumItem< TA, item >
     A set consisting only of one item. More...
     
    struct  Dune::NullPointerInitialiser< std::tuple< Args... > >
    class  Dune::EnumRange< TA, from, end >
     A set representing a range including the borders. More...
     
    struct  Dune::ForEachType< TE, std::tuple< Args... > >
    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::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::Combine< TI1, TI2, TA >
     A set combining two other sets. More...
     
    \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     Dune namespace.
     
    \n \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n 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. More...
     
    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...)))
     
    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 > &)
     
    \n

    Detailed Description

    \n-

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

    \n+

    Classes for building sets out of enumeration values.

    \n+
    Author
    Markus Blatt
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,109 +5,59 @@\n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n Classes | Namespaces | Functions\n-tupleutility.hh File Reference\n-Common \u00bb Utilities \u00bb Tuple_Utilities\n-Contains utility classes which can be used with std::tuple. More...\n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+enumset.hh File Reference\n+Classes for building sets out of enumeration values. More...\n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::TupleAccessTraits<_T_>\n+class \u00a0Dune::EmptySet<_TA_>\n+\u00a0 An empty set. More...\n \u00a0\n-struct \u00a0Dune::TupleAccessTraits<_T_*_>\n+class \u00a0Dune::AllSet<_TA_>\n+\u00a0 A set containing everything. More...\n \u00a0\n-struct \u00a0Dune::TupleAccessTraits<_T_&_>\n+class \u00a0Dune::EnumItem<_TA,_item_>\n+\u00a0 A set consisting only of one item. More...\n \u00a0\n-struct \u00a0Dune::NullPointerInitialiser<_std::tuple<_Args..._>_>\n+class \u00a0Dune::EnumRange<_TA,_from,_end_>\n+\u00a0 A set representing a range including the borders. More...\n \u00a0\n-struct \u00a0Dune::ForEachType<_TE,_std::tuple<_Args..._>_>\n+class \u00a0Dune::NegateSet<_S_>\n+\u00a0 The negation of a set. An item is contained in the set if and only if\n+ it is not contained in the negated set. More...\n \u00a0\n- class \u00a0Dune::TransformTupleFunctor<_TE,_Args_>\n-\u00a0\n-struct \u00a0Dune::TransformTupleFunctor<_TE,_Args_>::TypeEvaluator<_T_>\n-\u00a0\n-struct \u00a0Dune::AddRefTypeEvaluator<_T_>\n-\u00a0 TypeEvaluator to turn a type T into a reference to T More...\n-\u00a0\n-struct \u00a0Dune::AddPtrTypeEvaluator<_T_>\n-\u00a0 TypeEvaluator to turn a type T into a pointer to T More...\n-\u00a0\n-struct \u00a0Dune::AddPtrTypeEvaluator<_T_&_>\n-\u00a0\n-struct \u00a0Dune::AtType<_N,_Tuple_>\n-\u00a0 Type for reverse element access. More...\n-\u00a0\n-struct \u00a0Dune::At<_N_>\n-\u00a0 Reverse element access. More...\n-\u00a0\n-struct \u00a0Dune::PointerPairDeletor<_Tuple_>\n-\u00a0 Deletes all objects pointed to in a std::tuple of pointers. More...\n-\u00a0\n- class \u00a0Dune::FirstPredicateIndex<_Tuple,_Predicate,_start,_size_>\n-\u00a0 Finding the index of a certain type in a std::tuple. More...\n-\u00a0\n-struct \u00a0Dune::IsType<_T_>\n-\u00a0 Generator for predicates accepting one particular type. More...\n-\u00a0\n-struct \u00a0Dune::IsType<_T_>::Predicate<_U_>\n-\u00a0 The actual predicate. More...\n-\u00a0\n-struct \u00a0Dune::FirstTypeIndex<_Tuple,_T,_start_>\n-\u00a0 Find the first occurrence of a type in a std::tuple. More...\n-\u00a0\n-struct \u00a0Dune::PushBackTuple<_typename_std::tuple<_Args..._>,_T_>\n-\u00a0\n-struct \u00a0Dune::PushFrontTuple<_typename_std::tuple<_Args..._>,_T_>\n-\u00a0\n-struct \u00a0Dune::ReduceTuple<_F,_Tuple,_Seed,_N_>\n-\u00a0 Apply reduce with meta binary function to template. More...\n-\u00a0\n-struct \u00a0Dune::ReduceTuple<_F,_Tuple,_Seed,_0_>\n-\u00a0 Apply reduce with meta binary function to template. More...\n-\u00a0\n-struct \u00a0Dune::JoinTuples<_Head,_Tail_>\n-\u00a0 Join two std::tuple's. More...\n-\u00a0\n-struct \u00a0Dune::FlattenTuple<_Tuple_>\n-\u00a0 Flatten a std::tuple of std::tuple's. More...\n+class \u00a0Dune::Combine<_TI1,_TI2,_TA_>\n+\u00a0 A set combining two other sets. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0 Dune namespace.\n \u00a0\n Functions\n-template\n- decltype(auto)\u00a0Dune::applyPartial (F &&f, ArgTuple\n- &&args, std::integer_sequence< I, i... >)\n-\u00a0 Apply function with arguments from a\n- given tuple. More...\n-\u00a0\n-template\n- auto\u00a0Dune::genericTransformTuple (Tuple &&t,\n- Functor &&f) -> decltype\n- (genericTransformTupleBackend(t, f))\n-\u00a0\n-template class TE, class... Args>\n-TransformTupleFunctor< TE, Args... >\u00a0Dune::makeTransformTupleFunctor (Args\n- &&... args)\n-\u00a0\n-template class TypeEvaluator, class Tuple , class... Args>\n- auto\u00a0Dune::transformTuple (Tuple &&orig, Args\n- &&... args) -> decltype\n- (genericTransformTuple(orig,\n- makeTransformTupleFunctor< TypeEvaluator\n- >(args...)))\n+template\n+ std::ostream &\u00a0Dune::operator<< (std::ostream &os,\n+ const EnumItem< TA, i > &)\n+\u00a0\n+template\n+ std::ostream &\u00a0Dune::operator<< (std::ostream &os,\n+ const EnumRange< TA, from, to > &)\n+\u00a0\n+template\n+Combine< TI1, TI2, typename TI1::Type >\u00a0Dune::combine (const TI1 &set1, const\n+ TI2 &set2)\n+\u00a0\n+template\n+ std::ostream &\u00a0Dune::operator<< (std::ostream &os,\n+ const Combine< TI1, TI2, T > &)\n \u00a0\n ***** Detailed Description *****\n-Contains utility classes which can be used with std::tuple.\n+Classes for building sets out of enumeration values.\n+ Author\n+ Markus Blatt\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html", "source2": "./usr/share/doc/libdune-common-doc/doxygen/a00131_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-common: tupleutility.hh Source File\n+dune-common: enumset.hh Source File\n \n \n \n \n \n \n \n@@ -62,377 +62,158 @@\n \n
    \n \n
    \n
    \n
    \n-
    tupleutility.hh
    \n+
    enumset.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    \n
    2// vi: set et ts=4 sw=2 sts=2:
    \n
    3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    \n-
    5
    \n-
    6#ifndef DUNE_TUPLE_UTILITY_HH
    \n-
    7#define DUNE_TUPLE_UTILITY_HH
    \n-
    8
    \n-
    9#include <cstddef>
    \n-
    10#include <tuple>
    \n-
    11#include <type_traits>
    \n-
    12#include <utility>
    \n-
    13
    \n-\n-\n-
    16
    \n-
    17namespace Dune {
    \n-
    18
    \n-
    41 template<class F, class ArgTuple, class I, I... i>
    \n-
    42 decltype(auto) applyPartial(F&& f, ArgTuple&& args, std::integer_sequence<I, i...> /*indices*/)
    \n-
    43 {
    \n-
    44 return f(std::get<i>(args)...);
    \n-
    45 }
    \n-
    46
    \n-
    47 template<class T>
    \n-\n-
    49 {
    \n-
    50 typedef typename std::add_const<T>::type& ConstType;
    \n-
    51 typedef T& NonConstType;
    \n-
    52 typedef const typename std::remove_const<T>::type& ParameterType;
    \n-
    53 };
    \n-
    54
    \n-
    55 template<class T>
    \n-\n-
    57 {
    \n-
    58 typedef typename std::add_const<T>::type* ConstType;
    \n-
    59 typedef T* NonConstType;
    \n-
    60 typedef T* ParameterType;
    \n-
    61 };
    \n-
    62
    \n-
    63 template<class T>
    \n-\n-
    65 {
    \n-
    66 typedef T& ConstType;
    \n-
    67 typedef T& NonConstType;
    \n-
    68 typedef T& ParameterType;
    \n-
    69 };
    \n-
    70
    \n-
    78 template<class T>
    \n-\n-
    80
    \n-
    81 template<class... Args>
    \n-
    82 struct NullPointerInitialiser<std::tuple<Args...> >
    \n-
    83 {
    \n-
    84 typedef std::tuple<Args...> ResultType;
    \n-\n-
    86 {
    \n-
    87 return ResultType(static_cast<Args>(nullptr)...);
    \n-
    88 }
    \n-
    89 };
    \n-
    90
    \n-
    115 template<template <class> class TE, class T>
    \n-\n-
    117
    \n-
    118 template<template <class> class TE, class... Args>
    \n-
    119 struct ForEachType<TE, std::tuple<Args...> >
    \n-
    120 {
    \n-
    121 typedef std::tuple<typename TE<Args>::Type...> Type;
    \n-
    122 };
    \n-
    123
    \n-
    124#ifndef DOXYGEN
    \n-
    125 template<class Tuple, class Functor, std::size_t... I>
    \n-
    126 inline auto genericTransformTupleBackendImpl(Tuple& t, Functor& f, const std::index_sequence<I...>& )
    \n-
    127 -> std::tuple<decltype(f(std::get<I>(t)))...>
    \n-
    128 {
    \n-
    129 return std::tuple<decltype(f(std::get<I>(t)))...>(f(std::get<I>(t))...);
    \n-
    130 }
    \n-
    131
    \n-
    132 template<class... Args, class Functor>
    \n-
    133 auto genericTransformTupleBackend(std::tuple<Args...>& t, Functor& f) ->
    \n-
    134 decltype(genericTransformTupleBackendImpl(t, f,std::index_sequence_for<Args...>{}))
    \n-
    135 {
    \n-
    136 return genericTransformTupleBackendImpl(t, f,std::index_sequence_for<Args...>{});
    \n-
    137 }
    \n-
    138
    \n-
    139 template<class... Args, class Functor>
    \n-
    140 auto genericTransformTupleBackend(const std::tuple<Args...>& t, Functor& f) ->
    \n-
    141 decltype(genericTransformTupleBackendImpl(t, f, std::index_sequence_for<Args...>{}))
    \n+
    5#ifndef DUNE_ENUMSET_HH
    \n+
    6#define DUNE_ENUMSET_HH
    \n+
    7
    \n+
    8#include <iostream>
    \n+
    9
    \n+
    10namespace Dune
    \n+
    11{
    \n+
    25 template<typename TA>
    \n+\n+
    27 {
    \n+
    28 public:
    \n+
    32 typedef TA Type;
    \n+
    36 static bool contains(const Type& attribute);
    \n+
    37 };
    \n+
    38
    \n+
    42 template<typename TA>
    \n+
    43 class AllSet
    \n+
    44 {
    \n+
    45 public:
    \n+
    49 typedef TA Type;
    \n+
    53 static bool contains(const Type& attribute);
    \n+
    54 };
    \n+
    55
    \n+
    59 template<typename TA, int item>
    \n+\n+
    61 {
    \n+
    62 public:
    \n+
    66 typedef TA Type;
    \n+
    67
    \n+
    72 static bool contains(const Type& attribute);
    \n+
    73 };
    \n+
    74
    \n+
    78 template<typename TA,int from, int end>
    \n+
    79 class EnumRange //: public PODSet<EnumRange<T,from,end>,T>
    \n+
    80 {
    \n+
    81 public:
    \n+
    85 typedef TA Type;
    \n+
    86 static bool contains(const Type& item);
    \n+
    87 };
    \n+
    88
    \n+
    94 template<typename S>
    \n+\n+
    96 {
    \n+
    97 public:
    \n+
    98 typedef typename S::Type Type;
    \n+
    99
    \n+
    100 static bool contains(const Type& item)
    \n+
    101 {
    \n+
    102 return !S::contains(item);
    \n+
    103 }
    \n+
    104 };
    \n+
    105
    \n+
    109 template<class TI1, class TI2, typename TA=typename TI1::Type>
    \n+\n+
    111 {
    \n+
    112 public:
    \n+
    113 static bool contains(const TA& item);
    \n+
    114 };
    \n+
    115
    \n+
    116 template<typename TA>
    \n+
    117 inline bool EmptySet<TA>::contains([[maybe_unused]] const Type& attribute)
    \n+
    118 {
    \n+
    119 return false;
    \n+
    120 }
    \n+
    121
    \n+
    122 template<typename TA>
    \n+
    123 inline bool AllSet<TA>::contains([[maybe_unused]] const Type& attribute)
    \n+
    124 {
    \n+
    125 return true;
    \n+
    126 }
    \n+
    127
    \n+
    128 template<typename TA,int i>
    \n+
    129 inline bool EnumItem<TA,i>::contains(const Type& item)
    \n+
    130 {
    \n+
    131 return item==i;
    \n+
    132 }
    \n+
    133
    \n+
    134 template<typename TA,int i>
    \n+
    135 inline std::ostream& operator<<(std::ostream& os, const EnumItem<TA,i>&)
    \n+
    136 {
    \n+
    137 return os<<i;
    \n+
    138 }
    \n+
    139
    \n+
    140 template<typename TA, int from, int to>
    \n+
    141 inline bool EnumRange<TA,from,to>::contains(const Type& item)
    \n
    142 {
    \n-
    143 return genericTransformTupleBackendImpl(t, f, std::index_sequence_for<Args...>{});
    \n+
    143 return from<=item && item<=to;
    \n
    144 }
    \n-
    145#endif
    \n-
    146
    \n-
    185 template<class Tuple, class Functor>
    \n-
    186 auto genericTransformTuple(Tuple&& t, Functor&& f) ->
    \n-
    187 decltype(genericTransformTupleBackend(t, f))
    \n-
    188 {
    \n-
    189 return genericTransformTupleBackend(t, f);
    \n-
    190 }
    \n-
    191
    \n-
    224 template<template<class> class TE, class... Args>
    \n-\n-
    226 {
    \n-
    227 mutable std::tuple<Args&...> tup;
    \n-
    228
    \n-
    229 template<class T, std::size_t... I>
    \n-
    230 inline auto apply(T&& t, const std::index_sequence<I...>& ) ->
    \n-
    231 decltype(TE<T>::apply(t,std::get<I>(tup)...)) const
    \n-
    232 {
    \n-
    233 return TE<T>::apply(t,std::get<I>(tup)...);
    \n-
    234 }
    \n-
    235
    \n-
    236 public:
    \n-
    237 template<class T>
    \n-
    238 struct TypeEvaluator : public TE<T>
    \n-
    239 {};
    \n-
    240
    \n-
    241 TransformTupleFunctor(Args&&... args)
    \n-
    242 : tup(args...)
    \n-
    243 { }
    \n-
    244
    \n-
    245 template<class T>
    \n-
    246 inline auto operator()(T&& t) ->
    \n-
    247 decltype(this->apply(t,std::index_sequence_for<Args...>{})) const
    \n-
    248 {
    \n-
    249 return apply(t,std::index_sequence_for<Args...>{});
    \n-
    250 }
    \n-
    251 };
    \n-
    252
    \n-
    253 template<template<class> class TE, class... Args>
    \n-\n-
    255 {
    \n-
    256 return TransformTupleFunctor<TE, Args...>(args...);
    \n-
    257 }
    \n-
    258
    \n-
    291 template<template<class> class TypeEvaluator, class Tuple, class... Args>
    \n-
    292 auto transformTuple(Tuple&& orig, Args&&... args) ->
    \n-
    293 decltype(genericTransformTuple(orig, makeTransformTupleFunctor<TypeEvaluator>(args...)))
    \n-
    294 {
    \n-
    295 return genericTransformTuple(orig, makeTransformTupleFunctor<TypeEvaluator>(args...));
    \n-
    296 }
    \n-
    297
    \n-
    299
    \n-
    303 template<class T>
    \n-\n-
    305 {
    \n-
    306 typedef T& Type;
    \n-
    307 static Type apply(T& t)
    \n-
    308 {
    \n-
    309 return t;
    \n-
    310 }
    \n-
    311 };
    \n-
    312
    \n-
    314
    \n-
    318 template<class T>
    \n-\n-
    320 {
    \n-
    321 typedef typename std::remove_reference<T>::type* Type;
    \n-
    322 static Type apply(T& t)
    \n-
    323 {
    \n-
    324 return &t;
    \n-
    325 }
    \n-
    326 };
    \n-
    327
    \n-
    328 // Specialization, in case the type is already a reference
    \n-
    329 template<class T>
    \n-\n-
    331 {
    \n-
    332 typedef typename std::remove_reference<T>::type* Type;
    \n-
    333 static Type apply(T& t)
    \n-
    334 {
    \n-
    335 return &t;
    \n-
    336 }
    \n-
    337 };
    \n-
    338
    \n-
    344 template<int N, class Tuple>
    \n-
    345 struct AtType
    \n-
    346 {
    \n-
    347 typedef typename std::tuple_element<std::tuple_size<Tuple>::value - N - 1, Tuple>::type Type;
    \n-
    348 };
    \n-
    349
    \n-
    357 template<int N>
    \n-
    358 struct At
    \n-
    359 {
    \n-
    360 template<typename Tuple>
    \n-
    361 static typename TupleAccessTraits<typename AtType<N, Tuple>::Type>::NonConstType
    \n-
    362 get(Tuple& t)
    \n-
    363 {
    \n-
    364 return std::get<std::tuple_size<Tuple>::value - N - 1>(t);
    \n-
    365 }
    \n-
    366
    \n-
    367 template<typename Tuple>
    \n-
    368 static typename TupleAccessTraits<typename AtType<N, Tuple>::Type>::ConstType
    \n-
    369 get(const Tuple& t)
    \n-
    370 {
    \n-
    371 return std::get<std::tuple_size<Tuple>::value - N - 1>(t);
    \n-
    372 }
    \n-
    373 };
    \n-
    374
    \n-
    378 template<class Tuple>
    \n-\n-
    380 {
    \n-
    381 template<typename... Ts>
    \n-
    382 static void apply(std::tuple<Ts...>& t)
    \n-
    383 {
    \n-
    384 Hybrid::forEach(t,[&](auto&& ti){delete ti; ti=nullptr;});
    \n-
    385 }
    \n-
    386 };
    \n-
    387
    \n-
    411 template<class Tuple, template<class> class Predicate, std::size_t start = 0,
    \n-
    412 std::size_t size = std::tuple_size<Tuple>::value>
    \n-\n-
    414 public std::conditional<Predicate<typename std::tuple_element<start,
    \n-
    415 Tuple>::type>::value,
    \n-
    416 std::integral_constant<std::size_t, start>,
    \n-
    417 FirstPredicateIndex<Tuple, Predicate, start+1> >::type
    \n-
    418 {
    \n-
    419 static_assert(std::tuple_size<Tuple>::value == size, "The \\"size\\" "
    \n-
    420 "template parameter of FirstPredicateIndex is an "
    \n-
    421 "implementation detail and should never be set "
    \n-
    422 "explicitly!");
    \n-
    423 };
    \n-
    424
    \n-
    425#ifndef DOXYGEN
    \n-
    426 template<class Tuple, template<class> class Predicate, std::size_t size>
    \n-
    427 class FirstPredicateIndex<Tuple, Predicate, size, size>
    \n-
    428 {
    \n-
    429 static_assert(AlwaysFalse<Tuple>::value, "None of the std::tuple element "
    \n-
    430 "types matches the predicate!");
    \n-
    431 };
    \n-
    432#endif // !DOXYGEN
    \n-
    433
    \n-
    443 template<class T>
    \n-
    444 struct IsType
    \n-
    445 {
    \n-
    447 template<class U>
    \n-
    448 struct Predicate : public std::is_same<T, U> {};
    \n-
    449 };
    \n-
    450
    \n-
    464 template<class Tuple, class T, std::size_t start = 0>
    \n-\n-
    466 public FirstPredicateIndex<Tuple, IsType<T>::template Predicate, start>
    \n-
    467 { };
    \n-
    468
    \n-
    475 template<class Tuple, class T>
    \n-\n-
    477
    \n-
    478 template<class... Args, class T>
    \n-
    479 struct PushBackTuple<typename std::tuple<Args...>, T>
    \n-
    480 {
    \n-
    481 typedef typename std::tuple<Args..., T> type;
    \n-
    482 };
    \n-
    483
    \n-
    490 template<class Tuple, class T>
    \n-\n-
    492
    \n-
    493 template<class... Args, class T>
    \n-
    494 struct PushFrontTuple<typename std::tuple<Args...>, T>
    \n-
    495 {
    \n-
    496 typedef typename std::tuple<T, Args...> type;
    \n-
    497 };
    \n-
    498
    \n-
    511 template<
    \n-
    512 template <class, class> class F,
    \n-
    513 class Tuple,
    \n-
    514 class Seed=std::tuple<>,
    \n-
    515 int N=std::tuple_size<Tuple>::value>
    \n-\n-
    517 {
    \n-
    518 typedef typename ReduceTuple<F, Tuple, Seed, N-1>::type Accumulated;
    \n-
    519 typedef typename std::tuple_element<N-1, Tuple>::type Value;
    \n-
    520
    \n-
    522 typedef typename F<Accumulated, Value>::type type;
    \n-
    523 };
    \n-
    524
    \n-
    535 template<
    \n-
    536 template <class, class> class F,
    \n-
    537 class Tuple,
    \n-
    538 class Seed>
    \n-
    539 struct ReduceTuple<F, Tuple, Seed, 0>
    \n-
    540 {
    \n-
    542 typedef Seed type;
    \n-
    543 };
    \n-
    544
    \n-
    554 template<class Head, class Tail>
    \n-\n-
    556 {
    \n-\n-
    559 };
    \n-
    560
    \n-
    569 template<class Tuple>
    \n-\n-
    571 {
    \n-\n-
    574 };
    \n-
    575
    \n-
    577}
    \n-
    578
    \n-
    579#endif
    \n-\n-
    Traits for type conversions and type information.
    \n-
    std::add_const< T >::type & ConstType
    Definition: tupleutility.hh:50
    \n-
    static void apply(std::tuple< Ts... > &t)
    Definition: tupleutility.hh:382
    \n-
    T * ParameterType
    Definition: tupleutility.hh:60
    \n-
    auto transformTuple(Tuple &&orig, Args &&... args) -> decltype(genericTransformTuple(orig, makeTransformTupleFunctor< TypeEvaluator >(args...)))
    Definition: tupleutility.hh:292
    \n-
    T & ConstType
    Definition: tupleutility.hh:66
    \n-
    ReduceTuple< F, Tuple, Seed, N-1 >::type Accumulated
    Definition: tupleutility.hh:518
    \n-
    T * NonConstType
    Definition: tupleutility.hh:59
    \n-
    Seed type
    Result of the reduce operation.
    Definition: tupleutility.hh:542
    \n-
    std::remove_reference< T >::type * Type
    Definition: tupleutility.hh:321
    \n-
    static Type apply(T &t)
    Definition: tupleutility.hh:307
    \n-
    static ResultType apply()
    Definition: tupleutility.hh:85
    \n-
    std::tuple< Args... > ResultType
    Definition: tupleutility.hh:84
    \n-
    std::remove_reference< T >::type * Type
    Definition: tupleutility.hh:332
    \n-
    TransformTupleFunctor(Args &&... args)
    Definition: tupleutility.hh:241
    \n-
    std::tuple_element< std::tuple_size< Tuple >::value-N-1, Tuple >::type Type
    Definition: tupleutility.hh:347
    \n-
    static Type apply(T &t)
    Definition: tupleutility.hh:333
    \n-
    auto operator()(T &&t) -> decltype(this->apply(t, std::index_sequence_for< Args... >{})) const
    Definition: tupleutility.hh:246
    \n-
    T & NonConstType
    Definition: tupleutility.hh:67
    \n-
    T & NonConstType
    Definition: tupleutility.hh:51
    \n-
    static TupleAccessTraits< typenameAtType< N, Tuple >::Type >::ConstType get(const Tuple &t)
    Definition: tupleutility.hh:369
    \n-
    T & Type
    Definition: tupleutility.hh:306
    \n-
    static TupleAccessTraits< typenameAtType< N, Tuple >::Type >::NonConstType get(Tuple &t)
    Definition: tupleutility.hh:362
    \n-
    std::tuple< Args..., T > type
    Definition: tupleutility.hh:481
    \n-
    std::tuple_element< N-1, Tuple >::type Value
    Definition: tupleutility.hh:519
    \n-
    std::tuple< T, Args... > type
    Definition: tupleutility.hh:496
    \n-
    ReduceTuple< JoinTuples, Tuple >::type type
    Result of the flatten operation.
    Definition: tupleutility.hh:573
    \n-
    static Type apply(T &t)
    Definition: tupleutility.hh:322
    \n-
    F< Accumulated, Value >::type type
    Result of the reduce operation.
    Definition: tupleutility.hh:522
    \n-
    ReduceTuple< PushBackTuple, Tail, Head >::type type
    Result of the join operation.
    Definition: tupleutility.hh:558
    \n-
    std::tuple< typename TE< Args >::Type... > Type
    Definition: tupleutility.hh:121
    \n-
    auto genericTransformTuple(Tuple &&t, Functor &&f) -> decltype(genericTransformTupleBackend(t, f))
    Definition: tupleutility.hh:186
    \n-
    decltype(auto) applyPartial(F &&f, ArgTuple &&args, std::integer_sequence< I, i... >)
    Apply function with arguments from a given tuple.
    Definition: tupleutility.hh:42
    \n-
    T & ParameterType
    Definition: tupleutility.hh:68
    \n-
    const std::remove_const< T >::type & ParameterType
    Definition: tupleutility.hh:52
    \n-
    std::add_const< T >::type * ConstType
    Definition: tupleutility.hh:58
    \n-
    TransformTupleFunctor< TE, Args... > makeTransformTupleFunctor(Args &&... args)
    Definition: tupleutility.hh:254
    \n-
    constexpr void forEach(Range &&range, F &&f)
    Range based for loop.
    Definition: hybridutilities.hh:268
    \n-
    STL namespace.
    \n+
    145
    \n+
    146 template<typename TA, int from, int to>
    \n+
    147 inline std::ostream& operator<<(std::ostream& os, const EnumRange<TA,from,to>&)
    \n+
    148 {
    \n+
    149 return os<<"["<<from<<" - "<<to<<"]";
    \n+
    150 }
    \n+
    151
    \n+
    152 template<class TI1, class TI2, typename TA>
    \n+
    153 inline bool Combine<TI1,TI2,TA>::contains(const TA& item)
    \n+
    154 {
    \n+
    155 return TI1::contains(item) ||
    \n+
    156 TI2::contains(item);
    \n+
    157 }
    \n+
    158
    \n+
    159 template<class TI1, class TI2>
    \n+
    160 inline Combine<TI1,TI2,typename TI1::Type> combine([[maybe_unused]] const TI1& set1,
    \n+
    161 [[maybe_unused]] const TI2& set2)
    \n+
    162 {
    \n+\n+
    164 }
    \n+
    165
    \n+
    166 template<class TI1, class TI2, class T>
    \n+
    167 inline std::ostream& operator<<(std::ostream& os, const Combine<TI1,TI2,T>&)
    \n+
    168 {
    \n+
    169 return os << TI1()<<" "<<TI2();
    \n+
    170 }
    \n+
    172}
    \n+
    173
    \n+
    174#endif
    \n+
    static bool contains(const Type &attribute)
    Always returns true.
    Definition: enumset.hh:123
    \n+
    static bool contains(const Type &item)
    Definition: enumset.hh:141
    \n+
    static bool contains(const TA &item)
    Definition: enumset.hh:153
    \n+
    static bool contains(const Type &attribute)
    Always returns false.
    Definition: enumset.hh:117
    \n+
    static bool contains(const Type &attribute)
    Tests whether an item is in the set.
    Definition: enumset.hh:129
    \n+
    Combine< TI1, TI2, typename TI1::Type > combine(const TI1 &set1, const TI2 &set2)
    Definition: enumset.hh:160
    \n+
    std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
    Definition: bigunsignedint.hh:278
    \n
    Dune namespace.
    Definition: alignedallocator.hh:13
    \n-
    Definition: tupleutility.hh:49
    \n-
    A helper template that initializes a std::tuple consisting of pointers to nullptr.
    Definition: tupleutility.hh:79
    \n-
    Helper template to clone the type definition of a std::tuple with the storage types replaced by a use...
    Definition: tupleutility.hh:116
    \n-
    Definition: tupleutility.hh:226
    \n-
    Definition: tupleutility.hh:239
    \n-
    TypeEvaluator to turn a type T into a reference to T
    Definition: tupleutility.hh:305
    \n-
    TypeEvaluator to turn a type T into a pointer to T
    Definition: tupleutility.hh:320
    \n-
    Type for reverse element access.
    Definition: tupleutility.hh:346
    \n-
    Reverse element access.
    Definition: tupleutility.hh:359
    \n-
    Deletes all objects pointed to in a std::tuple of pointers.
    Definition: tupleutility.hh:380
    \n-
    Finding the index of a certain type in a std::tuple.
    Definition: tupleutility.hh:418
    \n-
    Generator for predicates accepting one particular type.
    Definition: tupleutility.hh:445
    \n-
    The actual predicate.
    Definition: tupleutility.hh:448
    \n-
    Find the first occurrence of a type in a std::tuple.
    Definition: tupleutility.hh:467
    \n-
    Helper template to append a type to a std::tuple.
    Definition: tupleutility.hh:476
    \n-
    Helper template to prepend a type to a std::tuple.
    Definition: tupleutility.hh:491
    \n-
    Apply reduce with meta binary function to template.
    Definition: tupleutility.hh:517
    \n-
    Join two std::tuple's.
    Definition: tupleutility.hh:556
    \n-
    Flatten a std::tuple of std::tuple's.
    Definition: tupleutility.hh:571
    \n-
    template which always yields a false value
    Definition: typetraits.hh:124
    \n+
    An empty set.
    Definition: enumset.hh:27
    \n+
    TA Type
    The POD type the set holds.
    Definition: enumset.hh:32
    \n+
    A set containing everything.
    Definition: enumset.hh:44
    \n+
    TA Type
    The POD type the set holds.
    Definition: enumset.hh:49
    \n+
    A set consisting only of one item.
    Definition: enumset.hh:61
    \n+
    TA Type
    The type the set holds.
    Definition: enumset.hh:66
    \n+
    A set representing a range including the borders.
    Definition: enumset.hh:80
    \n+
    TA Type
    The type the set holds.
    Definition: enumset.hh:85
    \n+
    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
    \n+
    S::Type Type
    Definition: enumset.hh:98
    \n+
    static bool contains(const Type &item)
    Definition: enumset.hh:100
    \n+
    A set combining two other sets.
    Definition: enumset.hh:111
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,517 +4,206 @@\n \n \n dune-common\u00a02.9.0\n \n \n * dune\n * common\n-tupleutility.hh\n+enumset.hh\n Go_to_the_documentation_of_this_file.\n 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n 2// vi: set et ts=4 sw=2 sts=2:\n 3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception\n- 5\n- 6#ifndef DUNE_TUPLE_UTILITY_HH\n- 7#define DUNE_TUPLE_UTILITY_HH\n- 8\n- 9#include \n- 10#include \n- 11#include \n- 12#include \n- 13\n- 14#include \n- 15#include \n- 16\n- 17namespace Dune {\n- 18\n- 41 template\n-42 decltype(auto) applyPartial(F&& f, ArgTuple&& args, std::integer_sequence /*indices*/)\n- 43 {\n- 44 return f(std::get(args)...);\n- 45 }\n- 46\n- 47 template\n-48 struct TupleAccessTraits\n- 49 {\n-50 typedef typename std::add_const::type& ConstType;\n-51 typedef T& NonConstType;\n-52 typedef const typename std::remove_const::type& ParameterType;\n- 53 };\n- 54\n- 55 template\n-56 struct TupleAccessTraits\n- 57 {\n-58 typedef typename std::add_const::type* ConstType;\n-59 typedef T* NonConstType;\n-60 typedef T* ParameterType;\n- 61 };\n- 62\n- 63 template\n-64 struct TupleAccessTraits\n- 65 {\n-66 typedef T& ConstType;\n-67 typedef T& NonConstType;\n-68 typedef T& ParameterType;\n- 69 };\n- 70\n- 78 template\n-79 struct NullPointerInitialiser;\n- 80\n- 81 template\n-82 struct NullPointerInitialiser >\n- 83 {\n-84 typedef std::tuple ResultType;\n-85 static ResultType apply()\n- 86 {\n- 87 return ResultType(static_cast(nullptr)...);\n- 88 }\n- 89 };\n- 90\n- 115 template