{"diffoscope-json-version": 1, "source1": "/srv/reproducible-results/rbuild-debian/r-b-build.dwA4fozE/b1/dune-grid-glue_2.9.0-3_armhf.changes", "source2": "/srv/reproducible-results/rbuild-debian/r-b-build.dwA4fozE/b2/dune-grid-glue_2.9.0-3_armhf.changes", "unified_diff": null, "details": [{"source1": "Files", "source2": "Files", "unified_diff": "@@ -1,4 +1,4 @@\n \n 36155d08d84a69666f94c1975d2f31a1 886240 debug optional libdune-grid-glue-dev-dbgsym_2.9.0-3_armhf.deb\n df2521e3591b8c827a44f6d1e81012d3 99252 libdevel optional libdune-grid-glue-dev_2.9.0-3_armhf.deb\n- 2aa9d227de318bd1ea2ed0b5b368b2ff 782340 doc optional libdune-grid-glue-doc_2.9.0-3_all.deb\n+ 3ddb45c61829849e6415e74c2ce85499 781796 doc optional libdune-grid-glue-doc_2.9.0-3_all.deb\n"}, {"source1": "libdune-grid-glue-doc_2.9.0-3_all.deb", "source2": "libdune-grid-glue-doc_2.9.0-3_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-13 13:23:40.000000 debian-binary\n--rw-r--r-- 0 0 0 7224 2023-01-13 13:23:40.000000 control.tar.xz\n--rw-r--r-- 0 0 0 774924 2023-01-13 13:23:40.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 7212 2023-01-13 13:23:40.000000 control.tar.xz\n+-rw-r--r-- 0 0 0 774392 2023-01-13 13:23:40.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": "@@ -2,26 +2,26 @@\n usr/share/doc/libdune-grid-glue-doc/changelog.gz\n usr/share/doc/libdune-grid-glue-doc/copyright\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html\n+usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00014.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00014_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00020.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00020_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html\n-usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html\n@@ -41,28 +41,28 @@\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html\n+usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html\n-usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html\n+usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00089.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html\n-usr/share/doc/libdune-grid-glue-doc/doxygen/a00095_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00101.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00103.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00104.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00105.html\n usr/share/doc/libdune-grid-glue-doc/doxygen/a00106.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": "@@ -5,72 +5,72 @@\n drwxr-xr-x 0 root (0) root (0) 0 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/\n -rw-r--r-- 0 root (0) root (0) 768 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/changelog.Debian.gz\n -rw-r--r-- 0 root (0) root (0) 1157 2022-12-23 06:52:03.000000 ./usr/share/doc/libdune-grid-glue-doc/changelog.gz\n -rw-r--r-- 0 root (0) root (0) 2569 2023-01-12 15:07:38.000000 ./usr/share/doc/libdune-grid-glue-doc/copyright\n drwxr-xr-x 0 root (0) root (0) 0 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/\n -rw-r--r-- 0 root (0) root (0) 6934 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html\n -rw-r--r-- 0 root (0) root (0) 80989 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html\n--rw-r--r-- 0 root (0) root (0) 5124 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html\n--rw-r--r-- 0 root (0) root (0) 16170 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html\n--rw-r--r-- 0 root (0) root (0) 5293 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html\n+-rw-r--r-- 0 root (0) root (0) 10399 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html\n+-rw-r--r-- 0 root (0) root (0) 68932 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html\n+-rw-r--r-- 0 root (0) root (0) 5982 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html\n+-rw-r--r-- 0 root (0) root (0) 13843 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html\n -rw-r--r-- 0 root (0) root (0) 4890 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html\n -rw-r--r-- 0 root (0) root (0) 16166 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html\n -rw-r--r-- 0 root (0) root (0) 5600 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014.html\n -rw-r--r-- 0 root (0) root (0) 51914 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014_source.html\n--rw-r--r-- 0 root (0) root (0) 10399 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html\n--rw-r--r-- 0 root (0) root (0) 68932 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html\n+-rw-r--r-- 0 root (0) root (0) 5124 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html\n+-rw-r--r-- 0 root (0) root (0) 16170 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html\n -rw-r--r-- 0 root (0) root (0) 7874 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020.html\n -rw-r--r-- 0 root (0) root (0) 117804 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020_source.html\n--rw-r--r-- 0 root (0) root (0) 5982 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html\n--rw-r--r-- 0 root (0) root (0) 13843 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html\n--rw-r--r-- 0 root (0) root (0) 5256 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html\n--rw-r--r-- 0 root (0) root (0) 26879 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html\n--rw-r--r-- 0 root (0) root (0) 10978 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html\n--rw-r--r-- 0 root (0) root (0) 40196 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html\n--rw-r--r-- 0 root (0) root (0) 5188 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html\n--rw-r--r-- 0 root (0) root (0) 8044 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html\n--rw-r--r-- 0 root (0) root (0) 6298 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html\n--rw-r--r-- 0 root (0) root (0) 8760 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html\n--rw-r--r-- 0 root (0) root (0) 7846 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html\n--rw-r--r-- 0 root (0) root (0) 29152 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html\n+-rw-r--r-- 0 root (0) root (0) 5256 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html\n+-rw-r--r-- 0 root (0) root (0) 26879 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html\n+-rw-r--r-- 0 root (0) root (0) 5293 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html\n+-rw-r--r-- 0 root (0) root (0) 5188 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html\n+-rw-r--r-- 0 root (0) root (0) 8044 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html\n+-rw-r--r-- 0 root (0) root (0) 7846 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html\n+-rw-r--r-- 0 root (0) root (0) 29152 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html\n+-rw-r--r-- 0 root (0) root (0) 7157 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html\n+-rw-r--r-- 0 root (0) root (0) 44297 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html\n+-rw-r--r-- 0 root (0) root (0) 7719 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html\n+-rw-r--r-- 0 root (0) root (0) 73289 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html\n -rw-r--r-- 0 root (0) root (0) 5782 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html\n -rw-r--r-- 0 root (0) root (0) 27205 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041_source.html\n--rw-r--r-- 0 root (0) root (0) 7157 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html\n--rw-r--r-- 0 root (0) root (0) 44297 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html\n--rw-r--r-- 0 root (0) root (0) 7719 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html\n--rw-r--r-- 0 root (0) root (0) 73289 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html\n--rw-r--r-- 0 root (0) root (0) 7444 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html\n--rw-r--r-- 0 root (0) root (0) 10647 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html\n+-rw-r--r-- 0 root (0) root (0) 7444 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html\n+-rw-r--r-- 0 root (0) root (0) 10647 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html\n+-rw-r--r-- 0 root (0) root (0) 6298 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html\n+-rw-r--r-- 0 root (0) root (0) 8760 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html\n+-rw-r--r-- 0 root (0) root (0) 10978 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html\n+-rw-r--r-- 0 root (0) root (0) 40196 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html\n -rw-r--r-- 0 root (0) root (0) 8009 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053.html\n -rw-r--r-- 0 root (0) root (0) 94248 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053_source.html\n -rw-r--r-- 0 root (0) root (0) 5232 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056.html\n -rw-r--r-- 0 root (0) root (0) 43609 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056_source.html\n -rw-r--r-- 0 root (0) root (0) 5191 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html\n -rw-r--r-- 0 root (0) root (0) 47646 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html\n -rw-r--r-- 0 root (0) root (0) 5365 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html\n -rw-r--r-- 0 root (0) root (0) 70686 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html\n--rw-r--r-- 0 root (0) root (0) 6394 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html\n--rw-r--r-- 0 root (0) root (0) 35781 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html\n--rw-r--r-- 0 root (0) root (0) 9744 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html\n--rw-r--r-- 0 root (0) root (0) 6144 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html\n--rw-r--r-- 0 root (0) root (0) 45120 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html\n--rw-r--r-- 0 root (0) root (0) 5882 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html\n--rw-r--r-- 0 root (0) root (0) 58890 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html\n--rw-r--r-- 0 root (0) root (0) 5725 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html\n--rw-r--r-- 0 root (0) root (0) 18783 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html\n--rw-r--r-- 0 root (0) root (0) 4035 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html\n--rw-r--r-- 0 root (0) root (0) 4284 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html\n--rw-r--r-- 0 root (0) root (0) 5159 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html\n--rw-r--r-- 0 root (0) root (0) 22438 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html\n+-rw-r--r-- 0 root (0) root (0) 5725 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html\n+-rw-r--r-- 0 root (0) root (0) 18783 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html\n+-rw-r--r-- 0 root (0) root (0) 5770 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html\n+-rw-r--r-- 0 root (0) root (0) 36815 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html\n+-rw-r--r-- 0 root (0) root (0) 5159 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html\n+-rw-r--r-- 0 root (0) root (0) 22438 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html\n+-rw-r--r-- 0 root (0) root (0) 4035 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html\n+-rw-r--r-- 0 root (0) root (0) 6394 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html\n+-rw-r--r-- 0 root (0) root (0) 35781 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html\n+-rw-r--r-- 0 root (0) root (0) 11104 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html\n+-rw-r--r-- 0 root (0) root (0) 5882 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html\n+-rw-r--r-- 0 root (0) root (0) 58890 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html\n+-rw-r--r-- 0 root (0) root (0) 6144 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html\n+-rw-r--r-- 0 root (0) root (0) 45120 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html\n -rw-r--r-- 0 root (0) root (0) 5168 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089.html\n--rw-r--r-- 0 root (0) root (0) 11104 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html\n--rw-r--r-- 0 root (0) root (0) 11998 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html\n--rw-r--r-- 0 root (0) root (0) 148477 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095_source.html\n--rw-r--r-- 0 root (0) root (0) 5770 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html\n--rw-r--r-- 0 root (0) root (0) 36815 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html\n+-rw-r--r-- 0 root (0) root (0) 4284 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html\n+-rw-r--r-- 0 root (0) root (0) 9744 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html\n+-rw-r--r-- 0 root (0) root (0) 11998 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html\n+-rw-r--r-- 0 root (0) root (0) 148477 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html\n -rw-r--r-- 0 root (0) root (0) 5689 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00101.html\n -rw-r--r-- 0 root (0) root (0) 4421 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00103.html\n -rw-r--r-- 0 root (0) root (0) 66344 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00104.html\n -rw-r--r-- 0 root (0) root (0) 5563 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00105.html\n -rw-r--r-- 0 root (0) root (0) 14779 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00106.html\n -rw-r--r-- 0 root (0) root (0) 13251 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00107.html\n -rw-r--r-- 0 root (0) root (0) 6137 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00108.html\n@@ -222,15 +222,15 @@\n -rw-r--r-- 0 root (0) root (0) 2352 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_65f347cff0208f20f00d27c542208238_dep.png\n -rw-r--r-- 0 root (0) root (0) 6730 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_68eff8a27dcb1cd0ff0ecf490070d3de.html\n -rw-r--r-- 0 root (0) root (0) 13683 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_68eff8a27dcb1cd0ff0ecf490070d3de_dep.png\n -rw-r--r-- 0 root (0) root (0) 6242 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_eaad0bdad6fc03850e65b1fdad9faad4.html\n -rw-r--r-- 0 root (0) root (0) 7180 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_eaad0bdad6fc03850e65b1fdad9faad4_dep.png\n -rw-r--r-- 0 root (0) root (0) 746 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/doc.png\n -rw-r--r-- 0 root (0) root (0) 33676 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/doxygen.css\n--rw-r--r-- 0 root (0) root (0) 28669 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz\n+-rw-r--r-- 0 root (0) root (0) 28666 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz\n -rw-r--r-- 0 root (0) root (0) 4452 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dynsections.js\n -rw-r--r-- 0 root (0) root (0) 15406 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/files.html\n -rw-r--r-- 0 root (0) root (0) 616 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/folderclosed.png\n -rw-r--r-- 0 root (0) root (0) 597 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/folderopen.png\n -rw-r--r-- 0 root (0) root (0) 3051 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions.html\n -rw-r--r-- 0 root (0) root (0) 3616 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_b.html\n -rw-r--r-- 0 root (0) root (0) 13286 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_c.html\n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html", "unified_diff": "@@ -80,27 +80,27 @@\n #include <type_traits>
\n #include <dune/common/deprecated.hh>
\n #include <dune/common/exceptions.hh>
\n #include <dune/common/iteratorfacades.hh>
\n #include <dune/common/promotiontraits.hh>
\n #include <dune/common/shared_ptr.hh>
\n #include <dune/common/stdstreams.hh>
\n-#include "adapter/gridgluecommunicate.hh"
\n-#include <dune/grid-glue/merging/merger.hh>
\n+#include "adapter/gridgluecommunicate.hh"
\n+#include <dune/grid-glue/merging/merger.hh>
\n #include <dune/common/parallel/mpitraits.hh>
\n #include <dune/common/parallel/mpicommunication.hh>
\n #include <dune/common/parallel/indexset.hh>
\n #include <dune/common/parallel/plocalindex.hh>
\n #include <dune/common/parallel/remoteindices.hh>
\n #include <dune/common/parallel/communicator.hh>
\n #include <dune/common/parallel/interface.hh>
\n-#include "adapter/rangegenerators.hh"
\n-#include "adapter/gridglue.cc"
\n+#include "adapter/rangegenerators.hh"
\n+#include "adapter/gridglue.cc"
\n #include "adapter/intersection.hh"
\n-#include "adapter/intersectioniterator.hh"
\n+#include "adapter/intersectioniterator.hh"
\n #include "adapter/intersectionindexset.hh"
\n \n

Go to the source code of this file.

\n \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html", "unified_diff": "@@ -83,16 +83,16 @@\n
19#include <dune/common/deprecated.hh>
\n
20#include <dune/common/exceptions.hh>
\n
21#include <dune/common/iteratorfacades.hh>
\n
22#include <dune/common/promotiontraits.hh>
\n
23#include <dune/common/shared_ptr.hh>
\n
24#include <dune/common/stdstreams.hh>
\n
25
\n-
26#include "adapter/gridgluecommunicate.hh"
\n-
27#include <dune/grid-glue/merging/merger.hh>
\n+
26#include "adapter/gridgluecommunicate.hh"
\n+
27#include <dune/grid-glue/merging/merger.hh>
\n
28
\n
29#include <dune/common/parallel/mpitraits.hh>
\n
30#include <dune/common/parallel/mpicommunication.hh>
\n
31#include <dune/common/parallel/indexset.hh>
\n
32#include <dune/common/parallel/plocalindex.hh>
\n
33#include <dune/common/parallel/remoteindices.hh>
\n
34#include <dune/common/parallel/communicator.hh>
\n@@ -355,30 +355,30 @@\n
396 }
\n
397
\n
398};
\n
399
\n
400} // end namespace GridGlue
\n
401} // end namespace Dune
\n
402
\n-
403#include "adapter/rangegenerators.hh"
\n+
403#include "adapter/rangegenerators.hh"
\n
404
\n-
405#include "adapter/gridglue.cc"
\n+
405#include "adapter/gridglue.cc"
\n
406
\n
407#include "adapter/intersection.hh"
\n-
408#include "adapter/intersectioniterator.hh"
\n+
408#include "adapter/intersectioniterator.hh"
\n
409#include "adapter/intersectionindexset.hh"
\n
410
\n
411#endif // DUNE_GRIDGLUE_GRIDGLUE_HH
\n-
intersectioniterator.hh
Implement iterators over GridGlue intersections.
\n-
gridglue.cc
\n+
gridgluecommunicate.hh
Describes the parallel communication interface class for Dune::GridGlue.
\n+
rangegenerators.hh
\n
intersectionindexset.hh
\n-
gridgluecommunicate.hh
Describes the parallel communication interface class for Dune::GridGlue.
\n+
intersectioniterator.hh
Implement iterators over GridGlue intersections.
\n
intersection.hh
Model of the Intersection concept provided by GridGlue.
\n-
rangegenerators.hh
\n-
merger.hh
\n+
gridglue.cc
\n+
merger.hh
\n
Dune
Definition: gridglue.hh:37
\n
Dune::GridGlue::GridGlue
sequential adapter to couple two grids at specified close together boundaries
Definition: gridglue.hh:67
\n
Dune::GridGlue::GridGlue::Coords
Dune::FieldVector< ctype, dimworld > Coords
The type used for coordinate vectors.
Definition: gridglue.hh:174
\n
Dune::GridGlue::GridGlue::getIntersection
Intersection getIntersection(int i) const
Definition: gridglue.hh:388
\n
Dune::GridGlue::GridGlue::Grid1Vertex
GridVertex< 1 > Grid1Vertex
The type of the Grid1 vertices.
Definition: gridglue.hh:194
\n
Dune::GridGlue::GridGlue::IndexSet
Dune::GridGlue::IntersectionIndexSet< P0, P1 > IndexSet
Type of remote intersection indexSet.
Definition: gridglue.hh:206
\n
Dune::GridGlue::GridGlue::IndexType
unsigned int IndexType
Definition: gridglue.hh:147
\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -326,23 +326,23 @@\n 405#include \"adapter/gridglue.cc\"\n 406\n 407#include \"adapter/intersection.hh\"\n 408#include \"adapter/intersectioniterator.hh\"\n 409#include \"adapter/intersectionindexset.hh\"\n 410\n 411#endif // DUNE_GRIDGLUE_GRIDGLUE_HH\n-intersectioniterator.hh\n-Implement iterators over GridGlue intersections.\n-gridglue.cc\n-intersectionindexset.hh\n gridgluecommunicate.hh\n Describes the parallel communication interface class for Dune::GridGlue.\n+rangegenerators.hh\n+intersectionindexset.hh\n+intersectioniterator.hh\n+Implement iterators over GridGlue intersections.\n intersection.hh\n Model of the Intersection concept provided by GridGlue.\n-rangegenerators.hh\n+gridglue.cc\n merger.hh\n Dune\n Definition: gridglue.hh:37\n Dune::GridGlue::GridGlue\n sequential adapter to couple two grids at specified close together boundaries\n Definition: gridglue.hh:67\n Dune::GridGlue::GridGlue::Coords\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: intersectioniterator.hh File Reference\n+dune-grid-glue: gridgluecommunicate.hh File Reference\n \n \n \n \n \n \n \n@@ -64,39 +64,73 @@\n \n \n \n
\n
\n Classes |\n-Namespaces
\n-
intersectioniterator.hh File Reference
\n+Namespaces |\n+Typedefs |\n+Functions
\n+
gridgluecommunicate.hh File Reference
\n \n
\n \n-

Implement iterators over GridGlue intersections. \n+

Describes the parallel communication interface class for Dune::GridGlue. \n More...

\n-
#include <dune/grid-glue/gridglue.hh>
\n+
#include <type_traits>
\n+#include <dune/common/bartonnackmanifcheck.hh>
\n+#include <dune/common/parallel/communicator.hh>
\n+#include <dune/grid/common/datahandleif.hh>
\n+#include <dune/grid/common/gridenums.hh>
\n
\n

Go to the source code of this file.

\n

\n Classes

class  Dune::GridGlue::GridGlue< P0, P1 >
\n \n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n

\n Classes

class  Dune::GridGlue::IntersectionIterator< P0, P1, inside, outside >
struct  Dune::GridGlue::GlobalId
 
class  Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp >
 describes the features of a data handle for communication in parallel runs using the GridGlue::communicate methods. More...
 
class  Dune::GridGlue::StreamingMessageBuffer< DT >
 
class  Dune::GridGlue::CommunicationOperator< dir >
 forward gather scatter to user defined CommInfo class More...
 
struct  Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp >
 collects all GridGlue data requried for communication More...
 
struct  Dune::CommPolicy< ::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > >
 specialization of the CommPolicy struct, required for the ParallelIndexsets More...
 
\n \n \n \n \n \n+

\n Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
\n+\n+\n+\n+\n+\n+\n+\n+

\n+Typedefs

typedef std::pair< int, int > Dune::GridGlue::RankPair
 
typedef CommunicationOperator< Dune::ForwardCommunication > Dune::GridGlue::ForwardOperator
 
typedef CommunicationOperator< Dune::BackwardCommunication > Dune::GridGlue::BackwardOperator
 
\n+\n+\n+\n

\n+Functions

std::ostream & Dune::GridGlue::operator<< (std::ostream &os, const GlobalId &id)
 
\n

Detailed Description

\n-

Implement iterators over GridGlue intersections.

\n+

Describes the parallel communication interface class for Dune::GridGlue.

\n
Author
Christian Engwer
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,27 +5,62 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-Classes | Namespaces\n-intersectioniterator.hh File Reference\n-Implement iterators over GridGlue intersections. More...\n-#include \n+Classes | Namespaces | Typedefs | Functions\n+gridgluecommunicate.hh File Reference\n+Describes the parallel communication interface class for Dune::GridGlue.\n+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::GridGlue::IntersectionIterator<_P0,_P1,_inside,_outside_>\n+struct \u00a0Dune::GridGlue::GlobalId\n+\u00a0\n+ class \u00a0Dune::GridGlue::CommDataHandle<_DataHandleImp,_DataTypeImp_>\n+\u00a0 describes the features of a data handle for communication in parallel\n+ runs using the GridGlue::communicate methods. More...\n+\u00a0\n+ class \u00a0Dune::GridGlue::StreamingMessageBuffer<_DT_>\n+\u00a0\n+ class \u00a0Dune::GridGlue::CommunicationOperator<_dir_>\n+\u00a0 forward gather scatter to user defined CommInfo class More...\n+\u00a0\n+struct \u00a0Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n+\u00a0 collects all GridGlue data requried for communication More...\n+\u00a0\n+struct \u00a0Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,\n+ DataTypeImp_>_>\n+\u00a0 specialization of the CommPolicy struct, required for the\n+ ParallelIndexsets More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n+ Typedefs\n+ typedef std::pair< int, int >\u00a0Dune::GridGlue::RankPair\n+\u00a0\n+typedef CommunicationOperator< Dune::\n+ ForwardCommunication >\u00a0Dune::GridGlue::ForwardOperator\n+\u00a0\n+typedef CommunicationOperator< Dune::\n+ BackwardCommunication >\u00a0Dune::GridGlue::BackwardOperator\n+\u00a0\n+ Functions\n+std::ostream &\u00a0Dune::GridGlue::operator<< (std::ostream &os, const GlobalId\n+ &id)\n+\u00a0\n ***** Detailed Description *****\n-Implement iterators over GridGlue intersections.\n+Describes the parallel communication interface class for Dune::GridGlue.\n Author\n Christian Engwer\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: intersectioniterator.hh Source File\n+dune-grid-glue: gridgluecommunicate.hh Source File\n \n \n \n \n \n \n \n@@ -62,85 +62,323 @@\n \n \n \n
\n-
intersectioniterator.hh
\n+
gridgluecommunicate.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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
\n
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
\n-
12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
\n-
13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
\n+
5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
\n+
6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
\n+
7
\n+
13#include <type_traits>
\n
14
\n-\n-
16
\n-
17namespace Dune {
\n-
18 namespace GridGlue {
\n+
15#include <dune/common/bartonnackmanifcheck.hh>
\n+
16#include <dune/common/parallel/communicator.hh>
\n+
17#include <dune/grid/common/datahandleif.hh>
\n+
18#include <dune/grid/common/gridenums.hh>
\n
19
\n-
21 template<typename P0, typename P1, int inside, int outside>
\n-\n-
23 public Dune::ForwardIteratorFacade< IntersectionIterator<P0,P1,inside,outside>,
\n-
24 const Intersection<P0,P1,inside,outside> >
\n-
25 {
\n-
26 public:
\n-
27
\n-
28 typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
\n-
29 typedef ::Dune::GridGlue::Intersection<P0,P1,inside,outside> Intersection;
\n-
30
\n-
31 IntersectionIterator(const GridGlue * glue, unsigned int i)
\n-
32 : glue_(glue),
\n-
33 index_(i),
\n-
34 intersection_(glue_, & glue_->intersections_[index_])
\n-
35 {}
\n-
36
\n-\n-
38 {
\n-
39 assert(("never dereference the end iterator" &&
\n-
40 index_ != glue_->index__sz));
\n-
41 return intersection_;
\n+
20
\n+
21namespace Dune {
\n+
22 namespace GridGlue {
\n+
23
\n+
24 typedef std::pair<int, int> RankPair;
\n+
25 struct GlobalId : public std::pair<RankPair, unsigned int>
\n+
26 {
\n+\n+
31 this->first.first = 0;
\n+
32 this->first.second = 0;
\n+
33 this->second = 0;
\n+
34 }
\n+
38 GlobalId(int i) {
\n+
39 this->first.first = i;
\n+
40 this->first.second = i;
\n+
41 this->second = 0;
\n
42 }
\n-
43
\n-
44 void increment()
\n-
45 {
\n-
46 intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);
\n-
47 }
\n-
48
\n-
49 bool equals(const IntersectionIterator& iter) const
\n-
50 {
\n-
51 return iter.index_ == index_;
\n+
48 GlobalId(int i, int j, unsigned int n) {
\n+
49 this->first.first = std::min(i,j);
\n+
50 this->first.second = std::max(i,j);
\n+
51 this->second = n;
\n
52 }
\n-
53
\n-
54 private:
\n-
55
\n-
56 const GridGlue* glue_;
\n-
57 unsigned int index_;
\n-
58
\n-
59 Intersection intersection_;
\n-
60 };
\n-
61
\n-
62 } // end namespace GridGlue
\n-
63} // end namespace Dune
\n-
64
\n-
65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
\n-
Central component of the module implementing the coupling of two grids.
\n+
53 };
\n+
54
\n+
55 inline std::ostream& operator<<(std::ostream& os, const GlobalId & id)
\n+
56 {
\n+
57 os << "("
\n+
58 << id.first.first << "," << id.first.second << ","
\n+
59 << id.second << ")";
\n+
60 return os;
\n+
61 }
\n+
62
\n+
75 template <class DataHandleImp, class DataTypeImp>
\n+\n+
77 {
\n+
78 public:
\n+
80 typedef DataTypeImp DataType;
\n+
81
\n+
82 protected:
\n+
83 // one should not create an explicit instance of this inteface object
\n+\n+
85
\n+
86 public:
\n+
87
\n+
91 template<class RISType>
\n+
92 size_t size (RISType& i) const
\n+
93 {
\n+
94 CHECK_INTERFACE_IMPLEMENTATION((asImp().size(i)));
\n+
95 return asImp().size(i);
\n+
96 }
\n+
97
\n+
103 template<class MessageBufferImp, class EntityType, class RISType>
\n+
104 void gather (MessageBufferImp& buff, const EntityType& e, const RISType & i) const
\n+
105 {
\n+
106 MessageBufferIF<MessageBufferImp> buffIF(buff);
\n+
107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().gather(buffIF,e,i)));
\n+
108 }
\n+
109
\n+
117 template<class MessageBufferImp, class EntityType, class RISType>
\n+
118 void scatter (MessageBufferImp& buff, const EntityType& e, const RISType & i, size_t n)
\n+
119 {
\n+
120 MessageBufferIF<MessageBufferImp> buffIF(buff);
\n+
121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().scatter(buffIF,e,i,n)));
\n+
122 }
\n+
123
\n+
124 private:
\n+
126 DataHandleImp& asImp () {
\n+
127 return static_cast<DataHandleImp &> (*this);
\n+
128 }
\n+
130 const DataHandleImp& asImp () const
\n+
131 {
\n+
132 return static_cast<const DataHandleImp &>(*this);
\n+
133 }
\n+
134 }; // end class CommDataHandleIF
\n+
135
\n+
140 template<typename DT>
\n+\n+
142 public:
\n+
143 typedef DT value_type;
\n+
144
\n+
145 // Constructor
\n+\n+
147 {
\n+
148 a=p;
\n+
149 i=0;
\n+
150 j=0;
\n+
151 }
\n+
152
\n+
153 // write data to message buffer, acts like a stream !
\n+
154 template<class Y>
\n+
155 void write (const Y& data)
\n+
156 {
\n+
157 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
\n+
158 a[i++] = data;
\n+
159 }
\n+
160
\n+
161 // read data from message buffer, acts like a stream !
\n+
162 template<class Y>
\n+
163 void read (Y& data) const
\n+
164 {
\n+
165 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
\n+
166 data = a[j++];
\n+
167 }
\n+
168
\n+
169 size_t counter() const { return i; }
\n+
170
\n+
171 void clear()
\n+
172 {
\n+
173 i = 0;
\n+
174 j = 0;
\n+
175 }
\n+
176
\n+
177 // we need access to these variables in an assertion
\n+
178#ifdef NDEBUG
\n+
179 private:
\n+
180#endif
\n+
181 DT *a;
\n+
182 size_t i;
\n+
183 mutable size_t j;
\n+
184 };
\n+
185
\n+
192 template<int dir>
\n+\n+
194 {
\n+
195 public:
\n+
196 template<class CommInfo>
\n+
197 static const typename CommInfo::DataType& gather(const CommInfo& commInfo, size_t i, size_t j = 0)
\n+
198 {
\n+
199 // get Intersection
\n+
200 typedef typename CommInfo::GridGlue::Intersection Intersection;
\n+
201 Intersection ris(commInfo.gridglue->getIntersection(i));
\n+
202
\n+
203 // fill buffer if we have a new intersection
\n+
204 if (j == 0)
\n+
205 {
\n+
206 commInfo.mbuffer.clear();
\n+
207 if (dir == Dune::ForwardCommunication)
\n+
208 {
\n+
209 // read from grid0
\n+
210 if(ris.self())
\n+
211 commInfo.data->gather(commInfo.mbuffer, ris.inside(), ris);
\n+
212 }
\n+
213 else // (dir == Dune::BackwardCommunication)
\n+
214 {
\n+
215 // read from grid1
\n+
216 if(ris.neighbor())
\n+
217 commInfo.data->gather(commInfo.mbuffer, ris.outside(), ris.flip());
\n+
218 }
\n+
219 }
\n+
220
\n+
221 // return the j'th value in the buffer
\n+
222 assert(j < commInfo.mbuffer.i);
\n+
223 return commInfo.buffer[j];
\n+
224 }
\n+
225
\n+
226 template<class CommInfo>
\n+
227 static void scatter(CommInfo& commInfo, const typename CommInfo::DataType& v, std::size_t i, std::size_t j = 0)
\n+
228 {
\n+
229 // extract GridGlue objects...
\n+
230 typedef typename CommInfo::GridGlue::Intersection Intersection;
\n+
231 Intersection ris(commInfo.gridglue->getIntersection(i));
\n+
232
\n+
233 // get size if we have a new intersection
\n+
234 if (j == 0)
\n+
235 {
\n+
236 commInfo.mbuffer.clear();
\n+
237 commInfo.currentsize = commInfo.data->size(ris);
\n+
238 }
\n+
239
\n+
240 // write entry to buffer
\n+
241 commInfo.buffer[j] = v;
\n+
242
\n+
243 // write back the buffer if we are at the end of this intersection
\n+
244 if (j == commInfo.currentsize-1)
\n+
245 {
\n+
246 if (dir == Dune::ForwardCommunication)
\n+
247 {
\n+
248 // write to grid1
\n+
249 if(ris.neighbor())
\n+
250 commInfo.data->scatter(commInfo.mbuffer, ris.outside(), ris.flip(), commInfo.currentsize);
\n+
251 }
\n+
252 else // (dir == Dune::BackwardCommunication)
\n+
253 {
\n+
254 // write to grid0
\n+
255 if(ris.self())
\n+
256 commInfo.data->scatter(commInfo.mbuffer, ris.inside(), ris, commInfo.currentsize);
\n+
257 }
\n+
258 assert(commInfo.mbuffer.j <= commInfo.currentsize);
\n+
259 }
\n+
260 }
\n+
261 };
\n+
262
\n+\n+\n+
265
\n+
270 template <typename GG, class DataHandleImp, class DataTypeImp>
\n+
271 struct CommInfo
\n+
272 {
\n+
273 typedef DataTypeImp value_type;
\n+
274 typedef GG GridGlue;
\n+
275 typedef DataTypeImp DataType;
\n+
276
\n+\n+
278 {}
\n+
279
\n+
280 // tunnel information to the policy and the operators
\n+\n+\n+
283
\n+
284 // state variables
\n+
285 std::vector<DataType> buffer;
\n+
286 mutable ::Dune::GridGlue::StreamingMessageBuffer<DataType> mbuffer;
\n+\n+
288 Dune::CommunicationDirection dir;
\n+
289 };
\n+
290
\n+
291 } // end namespace GridGlue
\n+
292
\n+
293#if HAVE_MPI
\n+
298 template<typename GG, class DataHandleImp, class DataTypeImp>
\n+
299 struct CommPolicy< ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> >
\n+
300 {
\n+
304 typedef ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> Type;
\n+
305
\n+
309 typedef DataTypeImp IndexedType;
\n+
310
\n+
314 // typedef SizeOne IndexedTypeFlag;
\n+
315 typedef VariableSize IndexedTypeFlag;
\n+
316
\n+
320 static size_t getSize(const Type& commInfo, size_t i)
\n+
321 {
\n+
322 // get Intersection
\n+
323 typedef typename Type::GridGlue::Intersection Intersection;
\n+
324 Intersection ris(commInfo.gridglue->getIntersection(i));
\n+
325
\n+
326 // ask data handle for size
\n+
327 return commInfo.data->size(ris);
\n+
328 }
\n+
329 };
\n+
330#endif
\n+
331
\n+
332} // end namespace Dune
\n+
333#endif
\n
Definition: gridglue.hh:37
\n-
sequential adapter to couple two grids at specified close together boundaries
Definition: gridglue.hh:67
\n-\n-
Definition: intersectioniterator.hh:25
\n-
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition: intersectioniterator.hh:28
\n-
const Intersection & dereference() const
Definition: intersectioniterator.hh:37
\n-
void increment()
Definition: intersectioniterator.hh:44
\n-
::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection
Definition: intersectioniterator.hh:29
\n-
IntersectionIterator(const GridGlue *glue, unsigned int i)
Definition: intersectioniterator.hh:31
\n-
bool equals(const IntersectionIterator &iter) const
Definition: intersectioniterator.hh:49
\n+
CommunicationOperator< Dune::BackwardCommunication > BackwardOperator
Definition: gridgluecommunicate.hh:264
\n+
CommunicationOperator< Dune::ForwardCommunication > ForwardOperator
Definition: gridgluecommunicate.hh:263
\n+
std::pair< int, int > RankPair
Definition: gridgluecommunicate.hh:24
\n+
std::ostream & operator<<(std::ostream &os, const GlobalId &id)
Definition: gridgluecommunicate.hh:55
\n+
The intersection of two entities of the two patches of a GridGlue.
Definition: intersection.hh:261
\n+
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition: intersection.hh:483
\n+
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition: intersection.hh:393
\n+
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition: intersection.hh:319
\n+
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition: intersection.hh:399
\n+
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition: intersection.hh:328
\n+
Definition: gridgluecommunicate.hh:26
\n+
GlobalId(int i)
Definition: gridgluecommunicate.hh:38
\n+
GlobalId()
Definition: gridgluecommunicate.hh:30
\n+
GlobalId(int i, int j, unsigned int n)
Definition: gridgluecommunicate.hh:48
\n+
describes the features of a data handle for communication in parallel runs using the GridGlue::commun...
Definition: gridgluecommunicate.hh:77
\n+
size_t size(RISType &i) const
Definition: gridgluecommunicate.hh:92
\n+
void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, size_t n)
Definition: gridgluecommunicate.hh:118
\n+
void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) const
pack data from user to message buffer
Definition: gridgluecommunicate.hh:104
\n+
DataTypeImp DataType
data type of data to communicate
Definition: gridgluecommunicate.hh:80
\n+
CommDataHandle()
Definition: gridgluecommunicate.hh:84
\n+
Definition: gridgluecommunicate.hh:141
\n+
size_t j
Definition: gridgluecommunicate.hh:183
\n+
StreamingMessageBuffer(DT *p)
Definition: gridgluecommunicate.hh:146
\n+
DT * a
Definition: gridgluecommunicate.hh:181
\n+
size_t counter() const
Definition: gridgluecommunicate.hh:169
\n+
void write(const Y &data)
Definition: gridgluecommunicate.hh:155
\n+
void read(Y &data) const
Definition: gridgluecommunicate.hh:163
\n+
DT value_type
Definition: gridgluecommunicate.hh:143
\n+
size_t i
Definition: gridgluecommunicate.hh:182
\n+
void clear()
Definition: gridgluecommunicate.hh:171
\n+
forward gather scatter to user defined CommInfo class
Definition: gridgluecommunicate.hh:194
\n+
static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v, std::size_t i, std::size_t j=0)
Definition: gridgluecommunicate.hh:227
\n+
static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i, size_t j=0)
Definition: gridgluecommunicate.hh:197
\n+
collects all GridGlue data requried for communication
Definition: gridgluecommunicate.hh:272
\n+
Dune::CommunicationDirection dir
Definition: gridgluecommunicate.hh:288
\n+
DataTypeImp value_type
Definition: gridgluecommunicate.hh:273
\n+
DataTypeImp DataType
Definition: gridgluecommunicate.hh:275
\n+
::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data
Definition: gridgluecommunicate.hh:282
\n+
GG GridGlue
Definition: gridgluecommunicate.hh:274
\n+
size_t currentsize
Definition: gridgluecommunicate.hh:287
\n+
CommInfo()
Definition: gridgluecommunicate.hh:277
\n+
mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer
Definition: gridgluecommunicate.hh:286
\n+
const GridGlue * gridglue
Definition: gridgluecommunicate.hh:281
\n+
std::vector< DataType > buffer
Definition: gridgluecommunicate.hh:285
\n+
static size_t getSize(const Type &commInfo, size_t i)
Get the number of objects at an intersection.
Definition: gridgluecommunicate.hh:320
\n+
DataTypeImp IndexedType
The datatype that should be communicated.
Definition: gridgluecommunicate.hh:309
\n+
::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type
The type of the GridGlueCommInfo.
Definition: gridgluecommunicate.hh:304
\n+
VariableSize IndexedTypeFlag
Each intersection can communicate a different number of objects.
Definition: gridgluecommunicate.hh:315
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,100 +5,443 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-intersectioniterator.hh\n+gridgluecommunicate.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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH\n- 13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH\n+ 5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH\n+ 6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH\n+ 7\n+ 13#include \n 14\n- 15#include \n- 16\n- 17namespace Dune {\n- 18 namespace GridGlue {\n+ 15#include \n+ 16#include \n+ 17#include \n+ 18#include \n 19\n- 21 template\n-22 class IntersectionIterator :\n- 23 public Dune::ForwardIteratorFacade<\n-IntersectionIterator,\n- 24 const Intersection >\n- 25 {\n- 26 public:\n- 27\n-28 typedef ::Dune::GridGlue::GridGlue GridGlue;\n-29 typedef ::Dune::GridGlue::Intersection Intersection;\n- 30\n-31 IntersectionIterator(const GridGlue * glue, unsigned int i)\n- 32 : glue_(glue),\n- 33 index_(i),\n- 34 intersection_(glue_, & glue_->intersections_[index_])\n- 35 {}\n- 36\n-37 const Intersection& dereference() const\n- 38 {\n- 39 assert((\"never dereference the end iterator\" &&\n- 40 index_ != glue_->index__sz));\n- 41 return intersection_;\n+ 20\n+ 21namespace Dune {\n+ 22 namespace GridGlue {\n+ 23\n+24 typedef std::pair RankPair;\n+25 struct GlobalId : public std::pair\n+ 26 {\n+30 GlobalId() {\n+ 31 this->first.first = 0;\n+ 32 this->first.second = 0;\n+ 33 this->second = 0;\n+ 34 }\n+38 GlobalId(int i) {\n+ 39 this->first.first = i;\n+ 40 this->first.second = i;\n+ 41 this->second = 0;\n 42 }\n- 43\n-44 void increment()\n- 45 {\n- 46 intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);\n- 47 }\n- 48\n-49 bool equals(const IntersectionIterator& iter) const\n- 50 {\n- 51 return iter.index_ == index_;\n+48 GlobalId(int i, int j, unsigned int n) {\n+ 49 this->first.first = std::min(i,j);\n+ 50 this->first.second = std::max(i,j);\n+ 51 this->second = n;\n 52 }\n- 53\n- 54 private:\n- 55\n- 56 const GridGlue* glue_;\n- 57 unsigned int index_;\n- 58\n- 59 Intersection intersection_;\n- 60 };\n- 61\n- 62 } // end namespace GridGlue\n- 63} // end namespace Dune\n- 64\n- 65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH\n-gridglue.hh\n-Central component of the module implementing the coupling of two grids.\n+ 53 };\n+ 54\n+55 inline std::ostream& operator<<(std::ostream& os, const GlobalId & id)\n+ 56 {\n+ 57 os << \"(\"\n+ 58 << id.first.first << \",\" << id.first.second << \",\"\n+ 59 << id.second << \")\";\n+ 60 return os;\n+ 61 }\n+ 62\n+ 75 template \n+76 class CommDataHandle\n+ 77 {\n+ 78 public:\n+80 typedef DataTypeImp DataType;\n+ 81\n+ 82 protected:\n+ 83 // one should not create an explicit instance of this inteface object\n+84 CommDataHandle() {}\n+ 85\n+ 86 public:\n+ 87\n+ 91 template\n+92 size_t size (RISType& i) const\n+ 93 {\n+ 94 CHECK_INTERFACE_IMPLEMENTATION((asImp().size(i)));\n+ 95 return asImp().size(i);\n+ 96 }\n+ 97\n+ 103 template\n+104 void gather (MessageBufferImp& buff, const EntityType& e, const RISType &\n+i) const\n+ 105 {\n+ 106 MessageBufferIF buffIF(buff);\n+ 107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().gather(buffIF,e,i)));\n+ 108 }\n+ 109\n+ 117 template\n+118 void scatter (MessageBufferImp& buff, const EntityType& e, const RISType &\n+i, size_t n)\n+ 119 {\n+ 120 MessageBufferIF buffIF(buff);\n+ 121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().scatter(buffIF,e,i,n)));\n+ 122 }\n+ 123\n+ 124 private:\n+ 126 DataHandleImp& asImp () {\n+ 127 return static_cast (*this);\n+ 128 }\n+ 130 const DataHandleImp& asImp () const\n+ 131 {\n+ 132 return static_cast(*this);\n+ 133 }\n+ 134 }; // end class CommDataHandleIF\n+ 135\n+ 140 template\n+141 class StreamingMessageBuffer {\n+ 142 public:\n+143 typedef DT value_type;\n+ 144\n+ 145 // Constructor\n+146 StreamingMessageBuffer (DT *p)\n+ 147 {\n+ 148 a=p;\n+ 149 i=0;\n+ 150 j=0;\n+ 151 }\n+ 152\n+ 153 // write data to message buffer, acts like a stream !\n+ 154 template\n+155 void write (const Y& data)\n+ 156 {\n+ 157 static_assert(std::is_same::value, \"DataType mismatch\");\n+ 158 a[i++] = data;\n+ 159 }\n+ 160\n+ 161 // read data from message buffer, acts like a stream !\n+ 162 template\n+163 void read (Y& data) const\n+ 164 {\n+ 165 static_assert(std::is_same::value, \"DataType mismatch\");\n+ 166 data = a[j++];\n+ 167 }\n+ 168\n+169 size_t counter() const { return i; }\n+ 170\n+171 void clear()\n+ 172 {\n+ 173 i = 0;\n+ 174 j = 0;\n+ 175 }\n+ 176\n+ 177 // we need access to these variables in an assertion\n+ 178#ifdef NDEBUG\n+ 179 private:\n+ 180#endif\n+181 DT *a;\n+182 size_t i;\n+183 mutable size_t j;\n+ 184 };\n+ 185\n+ 192 template\n+193 class CommunicationOperator\n+ 194 {\n+ 195 public:\n+ 196 template\n+197 static const typename CommInfo::DataType& gather(const CommInfo& commInfo,\n+size_t i, size_t j = 0)\n+ 198 {\n+ 199 // get Intersection\n+ 200 typedef typename CommInfo::GridGlue::Intersection Intersection;\n+ 201 Intersection ris(commInfo.gridglue->getIntersection(i));\n+ 202\n+ 203 // fill buffer if we have a new intersection\n+ 204 if (j == 0)\n+ 205 {\n+ 206 commInfo.mbuffer.clear();\n+ 207 if (dir == Dune::ForwardCommunication)\n+ 208 {\n+ 209 // read from grid0\n+ 210 if(ris.self())\n+ 211 commInfo.data->gather(commInfo.mbuffer, ris.inside(), ris);\n+ 212 }\n+ 213 else // (dir == Dune::BackwardCommunication)\n+ 214 {\n+ 215 // read from grid1\n+ 216 if(ris.neighbor())\n+ 217 commInfo.data->gather(commInfo.mbuffer, ris.outside(), ris.flip());\n+ 218 }\n+ 219 }\n+ 220\n+ 221 // return the j'th value in the buffer\n+ 222 assert(j < commInfo.mbuffer.i);\n+ 223 return commInfo.buffer[j];\n+ 224 }\n+ 225\n+ 226 template\n+227 static void scatter(CommInfo& commInfo, const typename CommInfo::DataType&\n+v, std::size_t i, std::size_t j = 0)\n+ 228 {\n+ 229 // extract GridGlue objects...\n+ 230 typedef typename CommInfo::GridGlue::Intersection Intersection;\n+ 231 Intersection ris(commInfo.gridglue->getIntersection(i));\n+ 232\n+ 233 // get size if we have a new intersection\n+ 234 if (j == 0)\n+ 235 {\n+ 236 commInfo.mbuffer.clear();\n+ 237 commInfo.currentsize = commInfo.data->size(ris);\n+ 238 }\n+ 239\n+ 240 // write entry to buffer\n+ 241 commInfo.buffer[j] = v;\n+ 242\n+ 243 // write back the buffer if we are at the end of this intersection\n+ 244 if (j == commInfo.currentsize-1)\n+ 245 {\n+ 246 if (dir == Dune::ForwardCommunication)\n+ 247 {\n+ 248 // write to grid1\n+ 249 if(ris.neighbor())\n+ 250 commInfo.data->scatter(commInfo.mbuffer, ris.outside(), ris.flip(),\n+commInfo.currentsize);\n+ 251 }\n+ 252 else // (dir == Dune::BackwardCommunication)\n+ 253 {\n+ 254 // write to grid0\n+ 255 if(ris.self())\n+ 256 commInfo.data->scatter(commInfo.mbuffer, ris.inside(), ris,\n+commInfo.currentsize);\n+ 257 }\n+ 258 assert(commInfo.mbuffer.j <= commInfo.currentsize);\n+ 259 }\n+ 260 }\n+ 261 };\n+ 262\n+263 typedef CommunicationOperator ForwardOperator;\n+264 typedef CommunicationOperator\n+BackwardOperator;\n+ 265\n+ 270 template \n+271 struct CommInfo\n+ 272 {\n+273 typedef DataTypeImp value_type;\n+274 typedef GG GridGlue;\n+275 typedef DataTypeImp DataType;\n+ 276\n+277 CommInfo() : buffer(100), mbuffer(&buffer[0])\n+ 278 {}\n+ 279\n+ 280 // tunnel information to the policy and the operators\n+281 const GridGlue * gridglue;\n+282 ::Dune::GridGlue::CommDataHandle * data;\n+ 283\n+ 284 // state variables\n+285 std::vector buffer;\n+286 mutable ::Dune::GridGlue::StreamingMessageBuffer mbuffer;\n+287 size_t currentsize;\n+288 Dune::CommunicationDirection dir;\n+ 289 };\n+ 290\n+ 291 } // end namespace GridGlue\n+ 292\n+ 293#if HAVE_MPI\n+ 298 template\n+299 struct CommPolicy< ::Dune::GridGlue::CommInfo >\n+ 300 {\n+304 typedef ::Dune::GridGlue::CommInfo Type;\n+ 305\n+309 typedef DataTypeImp IndexedType;\n+ 310\n+ 314 // typedef SizeOne IndexedTypeFlag;\n+315 typedef VariableSize IndexedTypeFlag;\n+ 316\n+320 static size_t getSize(const Type& commInfo, size_t i)\n+ 321 {\n+ 322 // get Intersection\n+ 323 typedef typename Type::GridGlue::Intersection Intersection;\n+ 324 Intersection ris(commInfo.gridglue->getIntersection(i));\n+ 325\n+ 326 // ask data handle for size\n+ 327 return commInfo.data->size(ris);\n+ 328 }\n+ 329 };\n+ 330#endif\n+ 331\n+ 332} // end namespace Dune\n+ 333#endif\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::GridGlue\n-sequential adapter to couple two grids at specified close together boundaries\n-Definition: gridglue.hh:67\n-Dune::GridGlue::Intersection<_P0,_P1,_inside,_outside_>\n-Dune::GridGlue::IntersectionIterator\n-Definition: intersectioniterator.hh:25\n-Dune::GridGlue::IntersectionIterator::GridGlue\n-::Dune::GridGlue::GridGlue< P0, P1 > GridGlue\n-Definition: intersectioniterator.hh:28\n-Dune::GridGlue::IntersectionIterator::dereference\n-const Intersection & dereference() const\n-Definition: intersectioniterator.hh:37\n-Dune::GridGlue::IntersectionIterator::increment\n-void increment()\n-Definition: intersectioniterator.hh:44\n-Dune::GridGlue::IntersectionIterator::Intersection\n-::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection\n-Definition: intersectioniterator.hh:29\n-Dune::GridGlue::IntersectionIterator::IntersectionIterator\n-IntersectionIterator(const GridGlue *glue, unsigned int i)\n-Definition: intersectioniterator.hh:31\n-Dune::GridGlue::IntersectionIterator::equals\n-bool equals(const IntersectionIterator &iter) const\n-Definition: intersectioniterator.hh:49\n+Dune::GridGlue::BackwardOperator\n+CommunicationOperator< Dune::BackwardCommunication > BackwardOperator\n+Definition: gridgluecommunicate.hh:264\n+Dune::GridGlue::ForwardOperator\n+CommunicationOperator< Dune::ForwardCommunication > ForwardOperator\n+Definition: gridgluecommunicate.hh:263\n+Dune::GridGlue::RankPair\n+std::pair< int, int > RankPair\n+Definition: gridgluecommunicate.hh:24\n+Dune::GridGlue::operator<<\n+std::ostream & operator<<(std::ostream &os, const GlobalId &id)\n+Definition: gridgluecommunicate.hh:55\n+Dune::GridGlue::Intersection\n+The intersection of two entities of the two patches of a GridGlue.\n+Definition: intersection.hh:261\n+Dune::GridGlue::Intersection::flip\n+Intersection< P0, P1, O, I > flip() const\n+Return a copy of the intersection with inside and outside switched.\n+Definition: intersection.hh:483\n+Dune::GridGlue::Intersection::self\n+bool self() const\n+For parallel computations: Return true if inside() entity exists locally.\n+Definition: intersection.hh:393\n+Dune::GridGlue::Intersection::inside\n+InsideEntity inside(unsigned int parentId=0) const\n+Return element on the inside of this intersection.\n+Definition: intersection.hh:319\n+Dune::GridGlue::Intersection::neighbor\n+size_t neighbor(unsigned int g=0) const\n+Return number of embeddings into local grid0 (grid1) entities.\n+Definition: intersection.hh:399\n+Dune::GridGlue::Intersection::outside\n+OutsideEntity outside(unsigned int parentId=0) const\n+Return element on the outside of this intersection.\n+Definition: intersection.hh:328\n+Dune::GridGlue::GlobalId\n+Definition: gridgluecommunicate.hh:26\n+Dune::GridGlue::GlobalId::GlobalId\n+GlobalId(int i)\n+Definition: gridgluecommunicate.hh:38\n+Dune::GridGlue::GlobalId::GlobalId\n+GlobalId()\n+Definition: gridgluecommunicate.hh:30\n+Dune::GridGlue::GlobalId::GlobalId\n+GlobalId(int i, int j, unsigned int n)\n+Definition: gridgluecommunicate.hh:48\n+Dune::GridGlue::CommDataHandle\n+describes the features of a data handle for communication in parallel runs\n+using the GridGlue::commun...\n+Definition: gridgluecommunicate.hh:77\n+Dune::GridGlue::CommDataHandle::size\n+size_t size(RISType &i) const\n+Definition: gridgluecommunicate.hh:92\n+Dune::GridGlue::CommDataHandle::scatter\n+void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i,\n+size_t n)\n+Definition: gridgluecommunicate.hh:118\n+Dune::GridGlue::CommDataHandle::gather\n+void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i)\n+const\n+pack data from user to message buffer\n+Definition: gridgluecommunicate.hh:104\n+Dune::GridGlue::CommDataHandle::DataType\n+DataTypeImp DataType\n+data type of data to communicate\n+Definition: gridgluecommunicate.hh:80\n+Dune::GridGlue::CommDataHandle::CommDataHandle\n+CommDataHandle()\n+Definition: gridgluecommunicate.hh:84\n+Dune::GridGlue::StreamingMessageBuffer\n+Definition: gridgluecommunicate.hh:141\n+Dune::GridGlue::StreamingMessageBuffer::j\n+size_t j\n+Definition: gridgluecommunicate.hh:183\n+Dune::GridGlue::StreamingMessageBuffer::StreamingMessageBuffer\n+StreamingMessageBuffer(DT *p)\n+Definition: gridgluecommunicate.hh:146\n+Dune::GridGlue::StreamingMessageBuffer::a\n+DT * a\n+Definition: gridgluecommunicate.hh:181\n+Dune::GridGlue::StreamingMessageBuffer::counter\n+size_t counter() const\n+Definition: gridgluecommunicate.hh:169\n+Dune::GridGlue::StreamingMessageBuffer::write\n+void write(const Y &data)\n+Definition: gridgluecommunicate.hh:155\n+Dune::GridGlue::StreamingMessageBuffer::read\n+void read(Y &data) const\n+Definition: gridgluecommunicate.hh:163\n+Dune::GridGlue::StreamingMessageBuffer::value_type\n+DT value_type\n+Definition: gridgluecommunicate.hh:143\n+Dune::GridGlue::StreamingMessageBuffer::i\n+size_t i\n+Definition: gridgluecommunicate.hh:182\n+Dune::GridGlue::StreamingMessageBuffer::clear\n+void clear()\n+Definition: gridgluecommunicate.hh:171\n+Dune::GridGlue::CommunicationOperator\n+forward gather scatter to user defined CommInfo class\n+Definition: gridgluecommunicate.hh:194\n+Dune::GridGlue::CommunicationOperator::scatter\n+static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v,\n+std::size_t i, std::size_t j=0)\n+Definition: gridgluecommunicate.hh:227\n+Dune::GridGlue::CommunicationOperator::gather\n+static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i,\n+size_t j=0)\n+Definition: gridgluecommunicate.hh:197\n+Dune::GridGlue::CommInfo\n+collects all GridGlue data requried for communication\n+Definition: gridgluecommunicate.hh:272\n+Dune::GridGlue::CommInfo::dir\n+Dune::CommunicationDirection dir\n+Definition: gridgluecommunicate.hh:288\n+Dune::GridGlue::CommInfo::value_type\n+DataTypeImp value_type\n+Definition: gridgluecommunicate.hh:273\n+Dune::GridGlue::CommInfo::DataType\n+DataTypeImp DataType\n+Definition: gridgluecommunicate.hh:275\n+Dune::GridGlue::CommInfo::data\n+::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data\n+Definition: gridgluecommunicate.hh:282\n+Dune::GridGlue::CommInfo::GridGlue\n+GG GridGlue\n+Definition: gridgluecommunicate.hh:274\n+Dune::GridGlue::CommInfo::currentsize\n+size_t currentsize\n+Definition: gridgluecommunicate.hh:287\n+Dune::GridGlue::CommInfo::CommInfo\n+CommInfo()\n+Definition: gridgluecommunicate.hh:277\n+Dune::GridGlue::CommInfo::mbuffer\n+mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer\n+Definition: gridgluecommunicate.hh:286\n+Dune::GridGlue::CommInfo::gridglue\n+const GridGlue * gridglue\n+Definition: gridgluecommunicate.hh:281\n+Dune::GridGlue::CommInfo::buffer\n+std::vector< DataType > buffer\n+Definition: gridgluecommunicate.hh:285\n+Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n+>::getSize\n+static size_t getSize(const Type &commInfo, size_t i)\n+Get the number of objects at an intersection.\n+Definition: gridgluecommunicate.hh:320\n+Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n+>::IndexedType\n+DataTypeImp IndexedType\n+The datatype that should be communicated.\n+Definition: gridgluecommunicate.hh:309\n+Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n+>::Type\n+::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type\n+The type of the GridGlueCommInfo.\n+Definition: gridgluecommunicate.hh:304\n+Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n+>::IndexedTypeFlag\n+VariableSize IndexedTypeFlag\n+Each intersection can communicate a different number of objects.\n+Definition: gridgluecommunicate.hh:315\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: gridglue.cc File Reference\n+dune-grid-glue: rangegenerators.hh File Reference\n \n \n \n \n \n \n \n@@ -63,38 +63,42 @@\n \n \n
\n \n-
gridglue.cc File Reference
\n+
rangegenerators.hh File Reference
\n
\n
\n-
#include "intersection.hh"
\n-#include <vector>
\n-#include <iterator>
\n-#include "../gridglue.hh"
\n-#include "../common/ringcomm.hh"
\n-#include <dune/common/unused.hh>
\n-
\n+
#include <dune/common/iteratorrange.hh>
\n+
\n+

Go to the source code of this file.

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

\n+Classes

struct  Dune::GridGlue::Reverse< reverse >
 
\n \n \n \n \n \n

\n Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
\n \n-\n-\n-\n+\n+\n+\n+\n

\n Functions

template<typename T >
void Dune::GridGlue::printVector (const std::vector< T > &v, std::string name, int rank)
 
template<... >
IteratorRange<... > Dune::GridGlue::intersections (const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
 Iterate over all intersections of a GridGlue. More...
 
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,28 +5,28 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-Namespaces | Functions\n-gridglue.cc File Reference\n-#include \"intersection.hh\"\n-#include \n-#include \n-#include \"../gridglue.hh\"\n-#include \"../common/ringcomm.hh\"\n-#include \n+Classes | Namespaces | Functions\n+rangegenerators.hh File Reference\n+#include \n+Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::GridGlue::Reverse<_reverse_>\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n Functions\n-template\n-void\u00a0Dune::GridGlue::printVector (const std::vector< T > &v, std::string name,\n- int rank)\n+template<... >\n+IteratorRange<... >\u00a0Dune::GridGlue::intersections (const GridGlue<... > &glue,\n+ const Reverse<... > &reverse=!reversed)\n+\u00a0 Iterate over all intersections of a GridGlue. More...\n \u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: gridgluecommunicate.hh File Reference\n+dune-grid-glue: intersectioniterator.hh File Reference\n \n \n \n \n \n \n \n@@ -64,73 +64,39 @@\n \n \n \n
\n \n-
gridgluecommunicate.hh File Reference
\n+Namespaces
\n+
intersectioniterator.hh File Reference
\n \n
\n \n-

Describes the parallel communication interface class for Dune::GridGlue. \n+

Implement iterators over GridGlue intersections. \n More...

\n-
#include <type_traits>
\n-#include <dune/common/bartonnackmanifcheck.hh>
\n-#include <dune/common/parallel/communicator.hh>
\n-#include <dune/grid/common/datahandleif.hh>
\n-#include <dune/grid/common/gridenums.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::GridGlue::GlobalId
 
class  Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp >
 describes the features of a data handle for communication in parallel runs using the GridGlue::communicate methods. More...
 
class  Dune::GridGlue::StreamingMessageBuffer< DT >
 
class  Dune::GridGlue::CommunicationOperator< dir >
 forward gather scatter to user defined CommInfo class More...
 
struct  Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp >
 collects all GridGlue data requried for communication More...
 
struct  Dune::CommPolicy< ::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > >
 specialization of the CommPolicy struct, required for the ParallelIndexsets More...
class  Dune::GridGlue::IntersectionIterator< P0, P1, inside, outside >
 
\n \n \n \n \n \n-

\n Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
\n-\n-\n-\n-\n-\n-\n-\n-

\n-Typedefs

typedef std::pair< int, int > Dune::GridGlue::RankPair
 
typedef CommunicationOperator< Dune::ForwardCommunication > Dune::GridGlue::ForwardOperator
 
typedef CommunicationOperator< Dune::BackwardCommunication > Dune::GridGlue::BackwardOperator
 
\n-\n-\n-\n

\n-Functions

std::ostream & Dune::GridGlue::operator<< (std::ostream &os, const GlobalId &id)
 
\n

Detailed Description

\n-

Describes the parallel communication interface class for Dune::GridGlue.

\n+

Implement iterators over GridGlue intersections.

\n
Author
Christian Engwer
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,62 +5,27 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-Classes | Namespaces | Typedefs | Functions\n-gridgluecommunicate.hh File Reference\n-Describes the parallel communication interface class for Dune::GridGlue.\n-More...\n-#include \n-#include \n-#include \n-#include \n-#include \n+Classes | Namespaces\n+intersectioniterator.hh File Reference\n+Implement iterators over GridGlue intersections. More...\n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::GridGlue::GlobalId\n-\u00a0\n- class \u00a0Dune::GridGlue::CommDataHandle<_DataHandleImp,_DataTypeImp_>\n-\u00a0 describes the features of a data handle for communication in parallel\n- runs using the GridGlue::communicate methods. More...\n-\u00a0\n- class \u00a0Dune::GridGlue::StreamingMessageBuffer<_DT_>\n-\u00a0\n- class \u00a0Dune::GridGlue::CommunicationOperator<_dir_>\n-\u00a0 forward gather scatter to user defined CommInfo class More...\n-\u00a0\n-struct \u00a0Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n-\u00a0 collects all GridGlue data requried for communication More...\n-\u00a0\n-struct \u00a0Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,\n- DataTypeImp_>_>\n-\u00a0 specialization of the CommPolicy struct, required for the\n- ParallelIndexsets More...\n+class \u00a0Dune::GridGlue::IntersectionIterator<_P0,_P1,_inside,_outside_>\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n- Typedefs\n- typedef std::pair< int, int >\u00a0Dune::GridGlue::RankPair\n-\u00a0\n-typedef CommunicationOperator< Dune::\n- ForwardCommunication >\u00a0Dune::GridGlue::ForwardOperator\n-\u00a0\n-typedef CommunicationOperator< Dune::\n- BackwardCommunication >\u00a0Dune::GridGlue::BackwardOperator\n-\u00a0\n- Functions\n-std::ostream &\u00a0Dune::GridGlue::operator<< (std::ostream &os, const GlobalId\n- &id)\n-\u00a0\n ***** Detailed Description *****\n-Describes the parallel communication interface class for Dune::GridGlue.\n+Implement iterators over GridGlue intersections.\n Author\n Christian Engwer\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: gridgluecommunicate.hh Source File\n+dune-grid-glue: intersectioniterator.hh Source File\n \n \n \n \n \n \n \n@@ -62,323 +62,85 @@\n \n \n
\n
\n-
gridgluecommunicate.hh
\n+
intersectioniterator.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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
\n
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
\n-
5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
\n-
6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
\n-
7
\n-
13#include <type_traits>
\n+
12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
\n+
13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
\n
14
\n-
15#include <dune/common/bartonnackmanifcheck.hh>
\n-
16#include <dune/common/parallel/communicator.hh>
\n-
17#include <dune/grid/common/datahandleif.hh>
\n-
18#include <dune/grid/common/gridenums.hh>
\n+\n+
16
\n+
17namespace Dune {
\n+
18 namespace GridGlue {
\n
19
\n-
20
\n-
21namespace Dune {
\n-
22 namespace GridGlue {
\n-
23
\n-
24 typedef std::pair<int, int> RankPair;
\n-
25 struct GlobalId : public std::pair<RankPair, unsigned int>
\n-
26 {
\n-\n-
31 this->first.first = 0;
\n-
32 this->first.second = 0;
\n-
33 this->second = 0;
\n-
34 }
\n-
38 GlobalId(int i) {
\n-
39 this->first.first = i;
\n-
40 this->first.second = i;
\n-
41 this->second = 0;
\n+
21 template<typename P0, typename P1, int inside, int outside>
\n+\n+
23 public Dune::ForwardIteratorFacade< IntersectionIterator<P0,P1,inside,outside>,
\n+
24 const Intersection<P0,P1,inside,outside> >
\n+
25 {
\n+
26 public:
\n+
27
\n+
28 typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
\n+
29 typedef ::Dune::GridGlue::Intersection<P0,P1,inside,outside> Intersection;
\n+
30
\n+
31 IntersectionIterator(const GridGlue * glue, unsigned int i)
\n+
32 : glue_(glue),
\n+
33 index_(i),
\n+
34 intersection_(glue_, & glue_->intersections_[index_])
\n+
35 {}
\n+
36
\n+\n+
38 {
\n+
39 assert(("never dereference the end iterator" &&
\n+
40 index_ != glue_->index__sz));
\n+
41 return intersection_;
\n
42 }
\n-
48 GlobalId(int i, int j, unsigned int n) {
\n-
49 this->first.first = std::min(i,j);
\n-
50 this->first.second = std::max(i,j);
\n-
51 this->second = n;
\n+
43
\n+
44 void increment()
\n+
45 {
\n+
46 intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);
\n+
47 }
\n+
48
\n+
49 bool equals(const IntersectionIterator& iter) const
\n+
50 {
\n+
51 return iter.index_ == index_;
\n
52 }
\n-
53 };
\n-
54
\n-
55 inline std::ostream& operator<<(std::ostream& os, const GlobalId & id)
\n-
56 {
\n-
57 os << "("
\n-
58 << id.first.first << "," << id.first.second << ","
\n-
59 << id.second << ")";
\n-
60 return os;
\n-
61 }
\n-
62
\n-
75 template <class DataHandleImp, class DataTypeImp>
\n-\n-
77 {
\n-
78 public:
\n-
80 typedef DataTypeImp DataType;
\n-
81
\n-
82 protected:
\n-
83 // one should not create an explicit instance of this inteface object
\n-\n-
85
\n-
86 public:
\n-
87
\n-
91 template<class RISType>
\n-
92 size_t size (RISType& i) const
\n-
93 {
\n-
94 CHECK_INTERFACE_IMPLEMENTATION((asImp().size(i)));
\n-
95 return asImp().size(i);
\n-
96 }
\n-
97
\n-
103 template<class MessageBufferImp, class EntityType, class RISType>
\n-
104 void gather (MessageBufferImp& buff, const EntityType& e, const RISType & i) const
\n-
105 {
\n-
106 MessageBufferIF<MessageBufferImp> buffIF(buff);
\n-
107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().gather(buffIF,e,i)));
\n-
108 }
\n-
109
\n-
117 template<class MessageBufferImp, class EntityType, class RISType>
\n-
118 void scatter (MessageBufferImp& buff, const EntityType& e, const RISType & i, size_t n)
\n-
119 {
\n-
120 MessageBufferIF<MessageBufferImp> buffIF(buff);
\n-
121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().scatter(buffIF,e,i,n)));
\n-
122 }
\n-
123
\n-
124 private:
\n-
126 DataHandleImp& asImp () {
\n-
127 return static_cast<DataHandleImp &> (*this);
\n-
128 }
\n-
130 const DataHandleImp& asImp () const
\n-
131 {
\n-
132 return static_cast<const DataHandleImp &>(*this);
\n-
133 }
\n-
134 }; // end class CommDataHandleIF
\n-
135
\n-
140 template<typename DT>
\n-\n-
142 public:
\n-
143 typedef DT value_type;
\n-
144
\n-
145 // Constructor
\n-\n-
147 {
\n-
148 a=p;
\n-
149 i=0;
\n-
150 j=0;
\n-
151 }
\n-
152
\n-
153 // write data to message buffer, acts like a stream !
\n-
154 template<class Y>
\n-
155 void write (const Y& data)
\n-
156 {
\n-
157 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
\n-
158 a[i++] = data;
\n-
159 }
\n-
160
\n-
161 // read data from message buffer, acts like a stream !
\n-
162 template<class Y>
\n-
163 void read (Y& data) const
\n-
164 {
\n-
165 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
\n-
166 data = a[j++];
\n-
167 }
\n-
168
\n-
169 size_t counter() const { return i; }
\n-
170
\n-
171 void clear()
\n-
172 {
\n-
173 i = 0;
\n-
174 j = 0;
\n-
175 }
\n-
176
\n-
177 // we need access to these variables in an assertion
\n-
178#ifdef NDEBUG
\n-
179 private:
\n-
180#endif
\n-
181 DT *a;
\n-
182 size_t i;
\n-
183 mutable size_t j;
\n-
184 };
\n-
185
\n-
192 template<int dir>
\n-\n-
194 {
\n-
195 public:
\n-
196 template<class CommInfo>
\n-
197 static const typename CommInfo::DataType& gather(const CommInfo& commInfo, size_t i, size_t j = 0)
\n-
198 {
\n-
199 // get Intersection
\n-
200 typedef typename CommInfo::GridGlue::Intersection Intersection;
\n-
201 Intersection ris(commInfo.gridglue->getIntersection(i));
\n-
202
\n-
203 // fill buffer if we have a new intersection
\n-
204 if (j == 0)
\n-
205 {
\n-
206 commInfo.mbuffer.clear();
\n-
207 if (dir == Dune::ForwardCommunication)
\n-
208 {
\n-
209 // read from grid0
\n-
210 if(ris.self())
\n-
211 commInfo.data->gather(commInfo.mbuffer, ris.inside(), ris);
\n-
212 }
\n-
213 else // (dir == Dune::BackwardCommunication)
\n-
214 {
\n-
215 // read from grid1
\n-
216 if(ris.neighbor())
\n-
217 commInfo.data->gather(commInfo.mbuffer, ris.outside(), ris.flip());
\n-
218 }
\n-
219 }
\n-
220
\n-
221 // return the j'th value in the buffer
\n-
222 assert(j < commInfo.mbuffer.i);
\n-
223 return commInfo.buffer[j];
\n-
224 }
\n-
225
\n-
226 template<class CommInfo>
\n-
227 static void scatter(CommInfo& commInfo, const typename CommInfo::DataType& v, std::size_t i, std::size_t j = 0)
\n-
228 {
\n-
229 // extract GridGlue objects...
\n-
230 typedef typename CommInfo::GridGlue::Intersection Intersection;
\n-
231 Intersection ris(commInfo.gridglue->getIntersection(i));
\n-
232
\n-
233 // get size if we have a new intersection
\n-
234 if (j == 0)
\n-
235 {
\n-
236 commInfo.mbuffer.clear();
\n-
237 commInfo.currentsize = commInfo.data->size(ris);
\n-
238 }
\n-
239
\n-
240 // write entry to buffer
\n-
241 commInfo.buffer[j] = v;
\n-
242
\n-
243 // write back the buffer if we are at the end of this intersection
\n-
244 if (j == commInfo.currentsize-1)
\n-
245 {
\n-
246 if (dir == Dune::ForwardCommunication)
\n-
247 {
\n-
248 // write to grid1
\n-
249 if(ris.neighbor())
\n-
250 commInfo.data->scatter(commInfo.mbuffer, ris.outside(), ris.flip(), commInfo.currentsize);
\n-
251 }
\n-
252 else // (dir == Dune::BackwardCommunication)
\n-
253 {
\n-
254 // write to grid0
\n-
255 if(ris.self())
\n-
256 commInfo.data->scatter(commInfo.mbuffer, ris.inside(), ris, commInfo.currentsize);
\n-
257 }
\n-
258 assert(commInfo.mbuffer.j <= commInfo.currentsize);
\n-
259 }
\n-
260 }
\n-
261 };
\n-
262
\n-\n-\n-
265
\n-
270 template <typename GG, class DataHandleImp, class DataTypeImp>
\n-
271 struct CommInfo
\n-
272 {
\n-
273 typedef DataTypeImp value_type;
\n-
274 typedef GG GridGlue;
\n-
275 typedef DataTypeImp DataType;
\n-
276
\n-\n-
278 {}
\n-
279
\n-
280 // tunnel information to the policy and the operators
\n-\n-\n-
283
\n-
284 // state variables
\n-
285 std::vector<DataType> buffer;
\n-
286 mutable ::Dune::GridGlue::StreamingMessageBuffer<DataType> mbuffer;
\n-\n-
288 Dune::CommunicationDirection dir;
\n-
289 };
\n-
290
\n-
291 } // end namespace GridGlue
\n-
292
\n-
293#if HAVE_MPI
\n-
298 template<typename GG, class DataHandleImp, class DataTypeImp>
\n-
299 struct CommPolicy< ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> >
\n-
300 {
\n-
304 typedef ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> Type;
\n-
305
\n-
309 typedef DataTypeImp IndexedType;
\n-
310
\n-
314 // typedef SizeOne IndexedTypeFlag;
\n-
315 typedef VariableSize IndexedTypeFlag;
\n-
316
\n-
320 static size_t getSize(const Type& commInfo, size_t i)
\n-
321 {
\n-
322 // get Intersection
\n-
323 typedef typename Type::GridGlue::Intersection Intersection;
\n-
324 Intersection ris(commInfo.gridglue->getIntersection(i));
\n-
325
\n-
326 // ask data handle for size
\n-
327 return commInfo.data->size(ris);
\n-
328 }
\n-
329 };
\n-
330#endif
\n-
331
\n-
332} // end namespace Dune
\n-
333#endif
\n+
53
\n+
54 private:
\n+
55
\n+
56 const GridGlue* glue_;
\n+
57 unsigned int index_;
\n+
58
\n+
59 Intersection intersection_;
\n+
60 };
\n+
61
\n+
62 } // end namespace GridGlue
\n+
63} // end namespace Dune
\n+
64
\n+
65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
\n+
Central component of the module implementing the coupling of two grids.
\n
Definition: gridglue.hh:37
\n-
CommunicationOperator< Dune::BackwardCommunication > BackwardOperator
Definition: gridgluecommunicate.hh:264
\n-
CommunicationOperator< Dune::ForwardCommunication > ForwardOperator
Definition: gridgluecommunicate.hh:263
\n-
std::pair< int, int > RankPair
Definition: gridgluecommunicate.hh:24
\n-
std::ostream & operator<<(std::ostream &os, const GlobalId &id)
Definition: gridgluecommunicate.hh:55
\n-
The intersection of two entities of the two patches of a GridGlue.
Definition: intersection.hh:261
\n-
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition: intersection.hh:483
\n-
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition: intersection.hh:393
\n-
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition: intersection.hh:319
\n-
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition: intersection.hh:399
\n-
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition: intersection.hh:328
\n-
Definition: gridgluecommunicate.hh:26
\n-
GlobalId(int i)
Definition: gridgluecommunicate.hh:38
\n-
GlobalId()
Definition: gridgluecommunicate.hh:30
\n-
GlobalId(int i, int j, unsigned int n)
Definition: gridgluecommunicate.hh:48
\n-
describes the features of a data handle for communication in parallel runs using the GridGlue::commun...
Definition: gridgluecommunicate.hh:77
\n-
size_t size(RISType &i) const
Definition: gridgluecommunicate.hh:92
\n-
void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, size_t n)
Definition: gridgluecommunicate.hh:118
\n-
void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) const
pack data from user to message buffer
Definition: gridgluecommunicate.hh:104
\n-
DataTypeImp DataType
data type of data to communicate
Definition: gridgluecommunicate.hh:80
\n-
CommDataHandle()
Definition: gridgluecommunicate.hh:84
\n-
Definition: gridgluecommunicate.hh:141
\n-
size_t j
Definition: gridgluecommunicate.hh:183
\n-
StreamingMessageBuffer(DT *p)
Definition: gridgluecommunicate.hh:146
\n-
DT * a
Definition: gridgluecommunicate.hh:181
\n-
size_t counter() const
Definition: gridgluecommunicate.hh:169
\n-
void write(const Y &data)
Definition: gridgluecommunicate.hh:155
\n-
void read(Y &data) const
Definition: gridgluecommunicate.hh:163
\n-
DT value_type
Definition: gridgluecommunicate.hh:143
\n-
size_t i
Definition: gridgluecommunicate.hh:182
\n-
void clear()
Definition: gridgluecommunicate.hh:171
\n-
forward gather scatter to user defined CommInfo class
Definition: gridgluecommunicate.hh:194
\n-
static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v, std::size_t i, std::size_t j=0)
Definition: gridgluecommunicate.hh:227
\n-
static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i, size_t j=0)
Definition: gridgluecommunicate.hh:197
\n-
collects all GridGlue data requried for communication
Definition: gridgluecommunicate.hh:272
\n-
Dune::CommunicationDirection dir
Definition: gridgluecommunicate.hh:288
\n-
DataTypeImp value_type
Definition: gridgluecommunicate.hh:273
\n-
DataTypeImp DataType
Definition: gridgluecommunicate.hh:275
\n-
::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data
Definition: gridgluecommunicate.hh:282
\n-
GG GridGlue
Definition: gridgluecommunicate.hh:274
\n-
size_t currentsize
Definition: gridgluecommunicate.hh:287
\n-
CommInfo()
Definition: gridgluecommunicate.hh:277
\n-
mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer
Definition: gridgluecommunicate.hh:286
\n-
const GridGlue * gridglue
Definition: gridgluecommunicate.hh:281
\n-
std::vector< DataType > buffer
Definition: gridgluecommunicate.hh:285
\n-
static size_t getSize(const Type &commInfo, size_t i)
Get the number of objects at an intersection.
Definition: gridgluecommunicate.hh:320
\n-
DataTypeImp IndexedType
The datatype that should be communicated.
Definition: gridgluecommunicate.hh:309
\n-
::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type
The type of the GridGlueCommInfo.
Definition: gridgluecommunicate.hh:304
\n-
VariableSize IndexedTypeFlag
Each intersection can communicate a different number of objects.
Definition: gridgluecommunicate.hh:315
\n+
sequential adapter to couple two grids at specified close together boundaries
Definition: gridglue.hh:67
\n+\n+
Definition: intersectioniterator.hh:25
\n+
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition: intersectioniterator.hh:28
\n+
const Intersection & dereference() const
Definition: intersectioniterator.hh:37
\n+
void increment()
Definition: intersectioniterator.hh:44
\n+
::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection
Definition: intersectioniterator.hh:29
\n+
IntersectionIterator(const GridGlue *glue, unsigned int i)
Definition: intersectioniterator.hh:31
\n+
bool equals(const IntersectionIterator &iter) const
Definition: intersectioniterator.hh:49
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,443 +5,100 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-gridgluecommunicate.hh\n+intersectioniterator.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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH\n- 6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH\n- 7\n- 13#include \n+ 12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH\n+ 13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH\n 14\n- 15#include \n- 16#include \n- 17#include \n- 18#include \n+ 15#include \n+ 16\n+ 17namespace Dune {\n+ 18 namespace GridGlue {\n 19\n- 20\n- 21namespace Dune {\n- 22 namespace GridGlue {\n- 23\n-24 typedef std::pair RankPair;\n-25 struct GlobalId : public std::pair\n- 26 {\n-30 GlobalId() {\n- 31 this->first.first = 0;\n- 32 this->first.second = 0;\n- 33 this->second = 0;\n- 34 }\n-38 GlobalId(int i) {\n- 39 this->first.first = i;\n- 40 this->first.second = i;\n- 41 this->second = 0;\n+ 21 template\n+22 class IntersectionIterator :\n+ 23 public Dune::ForwardIteratorFacade<\n+IntersectionIterator,\n+ 24 const Intersection >\n+ 25 {\n+ 26 public:\n+ 27\n+28 typedef ::Dune::GridGlue::GridGlue GridGlue;\n+29 typedef ::Dune::GridGlue::Intersection Intersection;\n+ 30\n+31 IntersectionIterator(const GridGlue * glue, unsigned int i)\n+ 32 : glue_(glue),\n+ 33 index_(i),\n+ 34 intersection_(glue_, & glue_->intersections_[index_])\n+ 35 {}\n+ 36\n+37 const Intersection& dereference() const\n+ 38 {\n+ 39 assert((\"never dereference the end iterator\" &&\n+ 40 index_ != glue_->index__sz));\n+ 41 return intersection_;\n 42 }\n-48 GlobalId(int i, int j, unsigned int n) {\n- 49 this->first.first = std::min(i,j);\n- 50 this->first.second = std::max(i,j);\n- 51 this->second = n;\n+ 43\n+44 void increment()\n+ 45 {\n+ 46 intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);\n+ 47 }\n+ 48\n+49 bool equals(const IntersectionIterator& iter) const\n+ 50 {\n+ 51 return iter.index_ == index_;\n 52 }\n- 53 };\n- 54\n-55 inline std::ostream& operator<<(std::ostream& os, const GlobalId & id)\n- 56 {\n- 57 os << \"(\"\n- 58 << id.first.first << \",\" << id.first.second << \",\"\n- 59 << id.second << \")\";\n- 60 return os;\n- 61 }\n- 62\n- 75 template \n-76 class CommDataHandle\n- 77 {\n- 78 public:\n-80 typedef DataTypeImp DataType;\n- 81\n- 82 protected:\n- 83 // one should not create an explicit instance of this inteface object\n-84 CommDataHandle() {}\n- 85\n- 86 public:\n- 87\n- 91 template\n-92 size_t size (RISType& i) const\n- 93 {\n- 94 CHECK_INTERFACE_IMPLEMENTATION((asImp().size(i)));\n- 95 return asImp().size(i);\n- 96 }\n- 97\n- 103 template\n-104 void gather (MessageBufferImp& buff, const EntityType& e, const RISType &\n-i) const\n- 105 {\n- 106 MessageBufferIF buffIF(buff);\n- 107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().gather(buffIF,e,i)));\n- 108 }\n- 109\n- 117 template\n-118 void scatter (MessageBufferImp& buff, const EntityType& e, const RISType &\n-i, size_t n)\n- 119 {\n- 120 MessageBufferIF buffIF(buff);\n- 121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().scatter(buffIF,e,i,n)));\n- 122 }\n- 123\n- 124 private:\n- 126 DataHandleImp& asImp () {\n- 127 return static_cast (*this);\n- 128 }\n- 130 const DataHandleImp& asImp () const\n- 131 {\n- 132 return static_cast(*this);\n- 133 }\n- 134 }; // end class CommDataHandleIF\n- 135\n- 140 template\n-141 class StreamingMessageBuffer {\n- 142 public:\n-143 typedef DT value_type;\n- 144\n- 145 // Constructor\n-146 StreamingMessageBuffer (DT *p)\n- 147 {\n- 148 a=p;\n- 149 i=0;\n- 150 j=0;\n- 151 }\n- 152\n- 153 // write data to message buffer, acts like a stream !\n- 154 template\n-155 void write (const Y& data)\n- 156 {\n- 157 static_assert(std::is_same::value, \"DataType mismatch\");\n- 158 a[i++] = data;\n- 159 }\n- 160\n- 161 // read data from message buffer, acts like a stream !\n- 162 template\n-163 void read (Y& data) const\n- 164 {\n- 165 static_assert(std::is_same::value, \"DataType mismatch\");\n- 166 data = a[j++];\n- 167 }\n- 168\n-169 size_t counter() const { return i; }\n- 170\n-171 void clear()\n- 172 {\n- 173 i = 0;\n- 174 j = 0;\n- 175 }\n- 176\n- 177 // we need access to these variables in an assertion\n- 178#ifdef NDEBUG\n- 179 private:\n- 180#endif\n-181 DT *a;\n-182 size_t i;\n-183 mutable size_t j;\n- 184 };\n- 185\n- 192 template\n-193 class CommunicationOperator\n- 194 {\n- 195 public:\n- 196 template\n-197 static const typename CommInfo::DataType& gather(const CommInfo& commInfo,\n-size_t i, size_t j = 0)\n- 198 {\n- 199 // get Intersection\n- 200 typedef typename CommInfo::GridGlue::Intersection Intersection;\n- 201 Intersection ris(commInfo.gridglue->getIntersection(i));\n- 202\n- 203 // fill buffer if we have a new intersection\n- 204 if (j == 0)\n- 205 {\n- 206 commInfo.mbuffer.clear();\n- 207 if (dir == Dune::ForwardCommunication)\n- 208 {\n- 209 // read from grid0\n- 210 if(ris.self())\n- 211 commInfo.data->gather(commInfo.mbuffer, ris.inside(), ris);\n- 212 }\n- 213 else // (dir == Dune::BackwardCommunication)\n- 214 {\n- 215 // read from grid1\n- 216 if(ris.neighbor())\n- 217 commInfo.data->gather(commInfo.mbuffer, ris.outside(), ris.flip());\n- 218 }\n- 219 }\n- 220\n- 221 // return the j'th value in the buffer\n- 222 assert(j < commInfo.mbuffer.i);\n- 223 return commInfo.buffer[j];\n- 224 }\n- 225\n- 226 template\n-227 static void scatter(CommInfo& commInfo, const typename CommInfo::DataType&\n-v, std::size_t i, std::size_t j = 0)\n- 228 {\n- 229 // extract GridGlue objects...\n- 230 typedef typename CommInfo::GridGlue::Intersection Intersection;\n- 231 Intersection ris(commInfo.gridglue->getIntersection(i));\n- 232\n- 233 // get size if we have a new intersection\n- 234 if (j == 0)\n- 235 {\n- 236 commInfo.mbuffer.clear();\n- 237 commInfo.currentsize = commInfo.data->size(ris);\n- 238 }\n- 239\n- 240 // write entry to buffer\n- 241 commInfo.buffer[j] = v;\n- 242\n- 243 // write back the buffer if we are at the end of this intersection\n- 244 if (j == commInfo.currentsize-1)\n- 245 {\n- 246 if (dir == Dune::ForwardCommunication)\n- 247 {\n- 248 // write to grid1\n- 249 if(ris.neighbor())\n- 250 commInfo.data->scatter(commInfo.mbuffer, ris.outside(), ris.flip(),\n-commInfo.currentsize);\n- 251 }\n- 252 else // (dir == Dune::BackwardCommunication)\n- 253 {\n- 254 // write to grid0\n- 255 if(ris.self())\n- 256 commInfo.data->scatter(commInfo.mbuffer, ris.inside(), ris,\n-commInfo.currentsize);\n- 257 }\n- 258 assert(commInfo.mbuffer.j <= commInfo.currentsize);\n- 259 }\n- 260 }\n- 261 };\n- 262\n-263 typedef CommunicationOperator ForwardOperator;\n-264 typedef CommunicationOperator\n-BackwardOperator;\n- 265\n- 270 template \n-271 struct CommInfo\n- 272 {\n-273 typedef DataTypeImp value_type;\n-274 typedef GG GridGlue;\n-275 typedef DataTypeImp DataType;\n- 276\n-277 CommInfo() : buffer(100), mbuffer(&buffer[0])\n- 278 {}\n- 279\n- 280 // tunnel information to the policy and the operators\n-281 const GridGlue * gridglue;\n-282 ::Dune::GridGlue::CommDataHandle * data;\n- 283\n- 284 // state variables\n-285 std::vector buffer;\n-286 mutable ::Dune::GridGlue::StreamingMessageBuffer mbuffer;\n-287 size_t currentsize;\n-288 Dune::CommunicationDirection dir;\n- 289 };\n- 290\n- 291 } // end namespace GridGlue\n- 292\n- 293#if HAVE_MPI\n- 298 template\n-299 struct CommPolicy< ::Dune::GridGlue::CommInfo >\n- 300 {\n-304 typedef ::Dune::GridGlue::CommInfo Type;\n- 305\n-309 typedef DataTypeImp IndexedType;\n- 310\n- 314 // typedef SizeOne IndexedTypeFlag;\n-315 typedef VariableSize IndexedTypeFlag;\n- 316\n-320 static size_t getSize(const Type& commInfo, size_t i)\n- 321 {\n- 322 // get Intersection\n- 323 typedef typename Type::GridGlue::Intersection Intersection;\n- 324 Intersection ris(commInfo.gridglue->getIntersection(i));\n- 325\n- 326 // ask data handle for size\n- 327 return commInfo.data->size(ris);\n- 328 }\n- 329 };\n- 330#endif\n- 331\n- 332} // end namespace Dune\n- 333#endif\n+ 53\n+ 54 private:\n+ 55\n+ 56 const GridGlue* glue_;\n+ 57 unsigned int index_;\n+ 58\n+ 59 Intersection intersection_;\n+ 60 };\n+ 61\n+ 62 } // end namespace GridGlue\n+ 63} // end namespace Dune\n+ 64\n+ 65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH\n+gridglue.hh\n+Central component of the module implementing the coupling of two grids.\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::BackwardOperator\n-CommunicationOperator< Dune::BackwardCommunication > BackwardOperator\n-Definition: gridgluecommunicate.hh:264\n-Dune::GridGlue::ForwardOperator\n-CommunicationOperator< Dune::ForwardCommunication > ForwardOperator\n-Definition: gridgluecommunicate.hh:263\n-Dune::GridGlue::RankPair\n-std::pair< int, int > RankPair\n-Definition: gridgluecommunicate.hh:24\n-Dune::GridGlue::operator<<\n-std::ostream & operator<<(std::ostream &os, const GlobalId &id)\n-Definition: gridgluecommunicate.hh:55\n-Dune::GridGlue::Intersection\n-The intersection of two entities of the two patches of a GridGlue.\n-Definition: intersection.hh:261\n-Dune::GridGlue::Intersection::flip\n-Intersection< P0, P1, O, I > flip() const\n-Return a copy of the intersection with inside and outside switched.\n-Definition: intersection.hh:483\n-Dune::GridGlue::Intersection::self\n-bool self() const\n-For parallel computations: Return true if inside() entity exists locally.\n-Definition: intersection.hh:393\n-Dune::GridGlue::Intersection::inside\n-InsideEntity inside(unsigned int parentId=0) const\n-Return element on the inside of this intersection.\n-Definition: intersection.hh:319\n-Dune::GridGlue::Intersection::neighbor\n-size_t neighbor(unsigned int g=0) const\n-Return number of embeddings into local grid0 (grid1) entities.\n-Definition: intersection.hh:399\n-Dune::GridGlue::Intersection::outside\n-OutsideEntity outside(unsigned int parentId=0) const\n-Return element on the outside of this intersection.\n-Definition: intersection.hh:328\n-Dune::GridGlue::GlobalId\n-Definition: gridgluecommunicate.hh:26\n-Dune::GridGlue::GlobalId::GlobalId\n-GlobalId(int i)\n-Definition: gridgluecommunicate.hh:38\n-Dune::GridGlue::GlobalId::GlobalId\n-GlobalId()\n-Definition: gridgluecommunicate.hh:30\n-Dune::GridGlue::GlobalId::GlobalId\n-GlobalId(int i, int j, unsigned int n)\n-Definition: gridgluecommunicate.hh:48\n-Dune::GridGlue::CommDataHandle\n-describes the features of a data handle for communication in parallel runs\n-using the GridGlue::commun...\n-Definition: gridgluecommunicate.hh:77\n-Dune::GridGlue::CommDataHandle::size\n-size_t size(RISType &i) const\n-Definition: gridgluecommunicate.hh:92\n-Dune::GridGlue::CommDataHandle::scatter\n-void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i,\n-size_t n)\n-Definition: gridgluecommunicate.hh:118\n-Dune::GridGlue::CommDataHandle::gather\n-void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i)\n-const\n-pack data from user to message buffer\n-Definition: gridgluecommunicate.hh:104\n-Dune::GridGlue::CommDataHandle::DataType\n-DataTypeImp DataType\n-data type of data to communicate\n-Definition: gridgluecommunicate.hh:80\n-Dune::GridGlue::CommDataHandle::CommDataHandle\n-CommDataHandle()\n-Definition: gridgluecommunicate.hh:84\n-Dune::GridGlue::StreamingMessageBuffer\n-Definition: gridgluecommunicate.hh:141\n-Dune::GridGlue::StreamingMessageBuffer::j\n-size_t j\n-Definition: gridgluecommunicate.hh:183\n-Dune::GridGlue::StreamingMessageBuffer::StreamingMessageBuffer\n-StreamingMessageBuffer(DT *p)\n-Definition: gridgluecommunicate.hh:146\n-Dune::GridGlue::StreamingMessageBuffer::a\n-DT * a\n-Definition: gridgluecommunicate.hh:181\n-Dune::GridGlue::StreamingMessageBuffer::counter\n-size_t counter() const\n-Definition: gridgluecommunicate.hh:169\n-Dune::GridGlue::StreamingMessageBuffer::write\n-void write(const Y &data)\n-Definition: gridgluecommunicate.hh:155\n-Dune::GridGlue::StreamingMessageBuffer::read\n-void read(Y &data) const\n-Definition: gridgluecommunicate.hh:163\n-Dune::GridGlue::StreamingMessageBuffer::value_type\n-DT value_type\n-Definition: gridgluecommunicate.hh:143\n-Dune::GridGlue::StreamingMessageBuffer::i\n-size_t i\n-Definition: gridgluecommunicate.hh:182\n-Dune::GridGlue::StreamingMessageBuffer::clear\n-void clear()\n-Definition: gridgluecommunicate.hh:171\n-Dune::GridGlue::CommunicationOperator\n-forward gather scatter to user defined CommInfo class\n-Definition: gridgluecommunicate.hh:194\n-Dune::GridGlue::CommunicationOperator::scatter\n-static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v,\n-std::size_t i, std::size_t j=0)\n-Definition: gridgluecommunicate.hh:227\n-Dune::GridGlue::CommunicationOperator::gather\n-static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i,\n-size_t j=0)\n-Definition: gridgluecommunicate.hh:197\n-Dune::GridGlue::CommInfo\n-collects all GridGlue data requried for communication\n-Definition: gridgluecommunicate.hh:272\n-Dune::GridGlue::CommInfo::dir\n-Dune::CommunicationDirection dir\n-Definition: gridgluecommunicate.hh:288\n-Dune::GridGlue::CommInfo::value_type\n-DataTypeImp value_type\n-Definition: gridgluecommunicate.hh:273\n-Dune::GridGlue::CommInfo::DataType\n-DataTypeImp DataType\n-Definition: gridgluecommunicate.hh:275\n-Dune::GridGlue::CommInfo::data\n-::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data\n-Definition: gridgluecommunicate.hh:282\n-Dune::GridGlue::CommInfo::GridGlue\n-GG GridGlue\n-Definition: gridgluecommunicate.hh:274\n-Dune::GridGlue::CommInfo::currentsize\n-size_t currentsize\n-Definition: gridgluecommunicate.hh:287\n-Dune::GridGlue::CommInfo::CommInfo\n-CommInfo()\n-Definition: gridgluecommunicate.hh:277\n-Dune::GridGlue::CommInfo::mbuffer\n-mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer\n-Definition: gridgluecommunicate.hh:286\n-Dune::GridGlue::CommInfo::gridglue\n-const GridGlue * gridglue\n-Definition: gridgluecommunicate.hh:281\n-Dune::GridGlue::CommInfo::buffer\n-std::vector< DataType > buffer\n-Definition: gridgluecommunicate.hh:285\n-Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n->::getSize\n-static size_t getSize(const Type &commInfo, size_t i)\n-Get the number of objects at an intersection.\n-Definition: gridgluecommunicate.hh:320\n-Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n->::IndexedType\n-DataTypeImp IndexedType\n-The datatype that should be communicated.\n-Definition: gridgluecommunicate.hh:309\n-Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n->::Type\n-::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type\n-The type of the GridGlueCommInfo.\n-Definition: gridgluecommunicate.hh:304\n-Dune::CommPolicy<_::Dune::GridGlue::CommInfo<_GG,_DataHandleImp,_DataTypeImp_>\n->::IndexedTypeFlag\n-VariableSize IndexedTypeFlag\n-Each intersection can communicate a different number of objects.\n-Definition: gridgluecommunicate.hh:315\n+Dune::GridGlue::GridGlue\n+sequential adapter to couple two grids at specified close together boundaries\n+Definition: gridglue.hh:67\n+Dune::GridGlue::Intersection<_P0,_P1,_inside,_outside_>\n+Dune::GridGlue::IntersectionIterator\n+Definition: intersectioniterator.hh:25\n+Dune::GridGlue::IntersectionIterator::GridGlue\n+::Dune::GridGlue::GridGlue< P0, P1 > GridGlue\n+Definition: intersectioniterator.hh:28\n+Dune::GridGlue::IntersectionIterator::dereference\n+const Intersection & dereference() const\n+Definition: intersectioniterator.hh:37\n+Dune::GridGlue::IntersectionIterator::increment\n+void increment()\n+Definition: intersectioniterator.hh:44\n+Dune::GridGlue::IntersectionIterator::Intersection\n+::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection\n+Definition: intersectioniterator.hh:29\n+Dune::GridGlue::IntersectionIterator::IntersectionIterator\n+IntersectionIterator(const GridGlue *glue, unsigned int i)\n+Definition: intersectioniterator.hh:31\n+Dune::GridGlue::IntersectionIterator::equals\n+bool equals(const IntersectionIterator &iter) const\n+Definition: intersectioniterator.hh:49\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: rangegenerators.hh File Reference\n+dune-grid-glue: gridglueamirawriter.hh File Reference\n \n \n \n \n \n \n \n@@ -64,42 +64,42 @@\n \n
\n \n
\n \n-
rangegenerators.hh File Reference
\n+Namespaces
\n+
gridglueamirawriter.hh File Reference
\n \n
\n-
#include <dune/common/iteratorrange.hh>
\n+\n+

Write all remote intersections to a AmiraMesh file. \n+More...

\n+
#include <fstream>
\n+#include <sstream>
\n+#include <type_traits>
\n
\n

Go to the source code of this file.

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

\n Classes

struct  Dune::GridGlue::Reverse< reverse >
class  Dune::GridGlue::GridGlueAmiraWriter
 Write remote intersections to a AmiraMesh file for debugging purposes. More...
 
\n \n \n \n \n \n-

\n Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
\n-\n-\n-\n-\n-\n

\n-Functions

template<... >
IteratorRange<... > Dune::GridGlue::intersections (const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
 Iterate over all intersections of a GridGlue. More...
 
\n-
\n+

Detailed Description

\n+

Write all remote intersections to a AmiraMesh file.

\n+
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,28 +5,29 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-Classes | Namespaces | Functions\n-rangegenerators.hh File Reference\n-#include \n+Classes | Namespaces\n+gridglueamirawriter.hh File Reference\n+Write all remote intersections to a AmiraMesh file. More...\n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-struct \u00a0Dune::GridGlue::Reverse<_reverse_>\n+class \u00a0Dune::GridGlue::GridGlueAmiraWriter\n+\u00a0 Write remote intersections to a AmiraMesh file for debugging purposes.\n+ More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n- Functions\n-template<... >\n-IteratorRange<... >\u00a0Dune::GridGlue::intersections (const GridGlue<... > &glue,\n- const Reverse<... > &reverse=!reversed)\n-\u00a0 Iterate over all intersections of a GridGlue. More...\n-\u00a0\n+***** Detailed Description *****\n+Write all remote intersections to a AmiraMesh file.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: rangegenerators.hh Source File\n+dune-grid-glue: gridglueamirawriter.hh Source File\n \n \n \n \n \n \n \n@@ -62,74 +62,162 @@\n \n \n \n
\n-
rangegenerators.hh
\n+
gridglueamirawriter.hh
\n
\n
\n Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
\n
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
\n-
3#ifndef DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
\n-
4#define DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
\n-
5
\n-
6#include <dune/common/iteratorrange.hh>
\n-
7
\n-
8namespace Dune {
\n-
9namespace GridGlue {
\n+
8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
\n+
9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
\n
10
\n-
14template<bool reverse>
\n-
15struct Reverse
\n-
16 : std::integral_constant<bool, reverse>
\n-
17{
\n-
18 typedef Reverse type;
\n-
19
\n-
20 constexpr
\n-\n-
22 { return {}; }
\n-
23};
\n-
24
\n-
25#ifdef DOXYGEN
\n-
26
\n-\n+
11#include <fstream>
\n+
12#include <sstream>
\n+
13#include <type_traits>
\n+
14
\n+
15namespace Dune {
\n+
16namespace GridGlue {
\n+
17
\n+\n+
21{
\n+
22
\n+
26 template <class Glue, int side>
\n+
27 static void writeIntersections(const Glue& glue, const std::string& filename)
\n+
28 {
\n+
29 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
\n+
30
\n+
31 std::ofstream fgrid;
\n
32
\n-
66template<...>
\n-
67IteratorRange<...>
\n-
68intersections(const GridGlue<...>& glue, const Reverse<...>& reverse = !reversed);
\n-
69
\n-
70#else
\n-
71
\n-
72namespace {
\n-
73const Reverse<true> reversed = {};
\n-
74} /* namespace */
\n+
33 fgrid.open(filename.c_str());
\n+
34
\n+
35 using GridView = typename Glue::template GridView<side>;
\n+
36 const int dim = GridView::dimension;
\n+
37 const int domdimw = GridView::dimensionworld;
\n+
38
\n+
39 // coordinates have to be in R^3 in the VTK format
\n+
40 std::string coordinatePadding;
\n+
41 for (int i=domdimw; i<3; i++)
\n+
42 coordinatePadding += " 0";
\n+
43
\n+
44 int overlaps = glue.size();
\n+
45
\n+
46 if (dim==3) {
\n+
47
\n+
48 fgrid << "# HyperSurface 0.1 ASCII \\n" << std::endl;
\n+
49 fgrid<<"\\n";
\n+
50 fgrid<<"Parameters {\\n";
\n+
51 fgrid<<" Materials {\\n";
\n+
52 fgrid<<" outside {\\n";
\n+
53 fgrid<<" Id 0\\n";
\n+
54 fgrid<<" }\\n";
\n+
55 fgrid<<" inside {\\n";
\n+
56 fgrid<<" Id 1\\n";
\n+
57 fgrid<<" }\\n";
\n+
58 fgrid<<" }\\n";
\n+
59 fgrid<<"\\n";
\n+
60 fgrid<<"}\\n";
\n+
61
\n+
62 // ////////////////////////////////////////////
\n+
63 // Write vertices
\n+
64 // ////////////////////////////////////////////
\n+
65
\n+
66 //use dim and not dim+1
\n+
67 fgrid<<"\\nVertices "<< overlaps*(dim)<<"\\n";
\n+
68 auto isEnd = glue.template iend<side>();
\n+
69 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt)
\n+
70 {
\n+
71 const auto& geometry = isIt->geometry();
\n+
72 for (int i = 0; i < geometry.corners(); ++i)
\n+
73 fgrid << geometry.corner(i) << coordinatePadding << std::endl;
\n+
74 }
\n
75
\n-
76template<typename P0, typename P1, bool reverse = false>
\n-
77IteratorRange< typename GridGlue<P0, P1>::template IntersectionIterator<reverse ? 1 : 0> >
\n-
78intersections(const GridGlue<P0, P1>& glue, const Reverse<reverse>& = {})
\n-
79{
\n-
80 const static int side = reverse ? 1 : 0;
\n-
81 return {glue.template ibegin<side>(), glue.template iend<side>()};
\n-
82}
\n-
83
\n-
84#endif // DOXYGEN
\n-
85
\n-
86} /* namespace GridGlue */
\n-
87} /* namespace Dune */
\n-
88
\n-
89#endif
\n+
76 // ////////////////////////////////////////////
\n+
77 // Write triangles
\n+
78 // ////////////////////////////////////////////
\n+
79
\n+
80 fgrid<<"NBranchingPoints 0\\n";
\n+
81 fgrid<<"NVerticesOnCurves 0\\n";
\n+
82 fgrid<<"BoundaryCurves 0\\n";
\n+
83 fgrid<<"Patches 1\\n";
\n+
84 fgrid<<"{\\n";
\n+
85 fgrid<<"InnerRegion inside\\n";
\n+
86 fgrid<<"OuterRegion outside\\n";
\n+
87 fgrid<<"BoundaryID 0\\n";
\n+
88 fgrid<<"BranchingPoints 0";
\n+
89 fgrid<<"\\n";
\n+
90
\n+
91 fgrid<<"Triangles "<<overlaps<<std::endl;
\n+
92
\n+
93 for (int i=0;i<overlaps; i++)
\n+
94 fgrid<<i*dim+1<<" "<<i*dim+2<<" "<<i*dim+3<<std::endl;
\n+
95 fgrid<<"}\\n";
\n+
96
\n+
97 } else if (dim==2) {
\n+
98
\n+
99 fgrid << "# AmiraMesh 3D ASCII 2.0 \\n";
\n+
100 fgrid<<"\\n";
\n+
101 fgrid<<"define Lines "<<3*overlaps<<"\\n";
\n+
102 fgrid<<"nVertices "<<2*overlaps<<"\\n";
\n+
103 fgrid<<"\\n";
\n+
104 fgrid<<"Parameters {\\n";
\n+
105 fgrid<<" ContentType \\"HxLineSet\\" \\n";
\n+
106 fgrid<<"}\\n";
\n+
107 fgrid<<"\\n";
\n+
108 fgrid<<"Lines { int LineIdx } @1\\n";
\n+
109 fgrid<<"Vertices { float[3] Coordinates } @2\\n";
\n+
110 fgrid<<"\\n";
\n+
111 fgrid<<"# Data section follows\\n";
\n+
112 fgrid<<"@1 \\n";
\n+
113 for (int i=0; i<overlaps;i++)
\n+
114 fgrid<<2*i<<"\\n"<<2*i+1<<"\\n"<<-1<<"\\n";
\n+
115 fgrid<<"\\n";
\n+
116 fgrid<<"@2 \\n";
\n+
117
\n+
118 auto isEnd = glue.template iend<side>();
\n+
119 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt) {
\n+
120 const auto& geometry = isIt->geometry();
\n+
121 for (int i = 0; i <2; ++i)
\n+
122 fgrid << geometry.corner(i) <<" "<<0<<"\\n";
\n+
123 }
\n+
124 }
\n+
125
\n+
126 fgrid.close();
\n+
127 }
\n+
128
\n+
129public:
\n+
130 template<typename Glue>
\n+
131 static void write(const Glue& glue, const std::string& path, int appendix=1)
\n+
132 {
\n+
133 std::ostringstream name0;
\n+
134 name0 << path;
\n+
135 name0 << "/domain.surf" << std::setw(3) << std::setfill('0') << appendix;
\n+
136
\n+
137 // Write extracted grid and remote intersection on the grid1-side
\n+
138 writeIntersections<Glue,0>(glue,name0.str());
\n+
139
\n+
140 std::ostringstream name1;
\n+
141 name1 << path;
\n+
142 name1 << "/target.surf" << std::setw(3) << std::setfill('0') << appendix;
\n+
143
\n+
144 writeIntersections<Glue,1>(glue, name1.str());
\n+
145 }
\n+
146
\n+
147};
\n+
148
\n+
149} // namespace GridGlue
\n+
150} // namespace Dune
\n+
151
\n+
152#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
\n
Definition: gridglue.hh:37
\n-
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
\n-
sequential adapter to couple two grids at specified close together boundaries
Definition: gridglue.hh:67
\n-
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
\n-
Definition: rangegenerators.hh:17
\n-
const Reverse< true > reversed
Definition: rangegenerators.hh:31
\n-
Reverse type
Definition: rangegenerators.hh:18
\n-
constexpr Reverse<!reverse > operator!() const
Definition: rangegenerators.hh:21
\n+
Write remote intersections to a AmiraMesh file for debugging purposes.
Definition: gridglueamirawriter.hh:21
\n+
static void write(const Glue &glue, const std::string &path, int appendix=1)
Definition: gridglueamirawriter.hh:131
\n
\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,89 +5,166 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-rangegenerators.hh\n+gridglueamirawriter.hh\n Go_to_the_documentation_of_this_file.\n 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#ifndef DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH\n- 4#define DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH\n- 5\n- 6#include \n- 7\n- 8namespace Dune {\n- 9namespace GridGlue {\n+ 8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH\n+ 9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH\n 10\n- 14template\n-15struct Reverse\n- 16 : std::integral_constant\n- 17{\n-18 typedef Reverse type;\n- 19\n- 20 constexpr\n-21 Reverse operator!() const\n- 22 { return {}; }\n- 23};\n- 24\n- 25#ifdef DOXYGEN\n- 26\n-31const Reverse reversed;\n+ 11#include \n+ 12#include \n+ 13#include \n+ 14\n+ 15namespace Dune {\n+ 16namespace GridGlue {\n+ 17\n+20class GridGlueAmiraWriter\n+ 21{\n+ 22\n+ 26 template \n+ 27 static void writeIntersections(const Glue& glue, const std::string&\n+filename)\n+ 28 {\n+ 29 static_assert((side==0 || side==1), \"'side' can only be 0 or 1\");\n+ 30\n+ 31 std::ofstream fgrid;\n 32\n- 66template<...>\n- 67IteratorRange<...>\n-68intersections(const GridGlue<...>& glue, const Reverse<...>& reverse =\n-!reversed);\n- 69\n- 70#else\n- 71\n- 72namespace {\n- 73const Reverse reversed = {};\n- 74} /* namespace */\n+ 33 fgrid.open(filename.c_str());\n+ 34\n+ 35 using GridView = typename Glue::template GridView;\n+ 36 const int dim = GridView::dimension;\n+ 37 const int domdimw = GridView::dimensionworld;\n+ 38\n+ 39 // coordinates have to be in R^3 in the VTK format\n+ 40 std::string coordinatePadding;\n+ 41 for (int i=domdimw; i<3; i++)\n+ 42 coordinatePadding += \" 0\";\n+ 43\n+ 44 int overlaps = glue.size();\n+ 45\n+ 46 if (dim==3) {\n+ 47\n+ 48 fgrid << \"# HyperSurface 0.1 ASCII \\n\" << std::endl;\n+ 49 fgrid<<\"\\n\";\n+ 50 fgrid<<\"Parameters {\\n\";\n+ 51 fgrid<<\" Materials {\\n\";\n+ 52 fgrid<<\" outside {\\n\";\n+ 53 fgrid<<\" Id 0\\n\";\n+ 54 fgrid<<\" }\\n\";\n+ 55 fgrid<<\" inside {\\n\";\n+ 56 fgrid<<\" Id 1\\n\";\n+ 57 fgrid<<\" }\\n\";\n+ 58 fgrid<<\" }\\n\";\n+ 59 fgrid<<\"\\n\";\n+ 60 fgrid<<\"}\\n\";\n+ 61\n+ 62 // ////////////////////////////////////////////\n+ 63 // Write vertices\n+ 64 // ////////////////////////////////////////////\n+ 65\n+ 66 //use dim and not dim+1\n+ 67 fgrid<<\"\\nVertices \"<< overlaps*(dim)<<\"\\n\";\n+ 68 auto isEnd = glue.template iend();\n+ 69 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt)\n+ 70 {\n+ 71 const auto& geometry = isIt->geometry();\n+ 72 for (int i = 0; i < geometry.corners(); ++i)\n+ 73 fgrid << geometry.corner(i) << coordinatePadding << std::endl;\n+ 74 }\n 75\n- 76template\n- 77IteratorRange< typename GridGlue::template\n-IntersectionIterator >\n- 78intersections(const GridGlue& glue, const Reverse& = {})\n- 79{\n- 80 const static int side = reverse ? 1 : 0;\n- 81 return {glue.template ibegin(), glue.template iend()};\n- 82}\n- 83\n- 84#endif // DOXYGEN\n- 85\n- 86} /* namespace GridGlue */\n- 87} /* namespace Dune */\n- 88\n- 89#endif\n+ 76 // ////////////////////////////////////////////\n+ 77 // Write triangles\n+ 78 // ////////////////////////////////////////////\n+ 79\n+ 80 fgrid<<\"NBranchingPoints 0\\n\";\n+ 81 fgrid<<\"NVerticesOnCurves 0\\n\";\n+ 82 fgrid<<\"BoundaryCurves 0\\n\";\n+ 83 fgrid<<\"Patches 1\\n\";\n+ 84 fgrid<<\"{\\n\";\n+ 85 fgrid<<\"InnerRegion inside\\n\";\n+ 86 fgrid<<\"OuterRegion outside\\n\";\n+ 87 fgrid<<\"BoundaryID 0\\n\";\n+ 88 fgrid<<\"BranchingPoints 0\";\n+ 89 fgrid<<\"\\n\";\n+ 90\n+ 91 fgrid<<\"Triangles \"<();\n+ 119 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt) {\n+ 120 const auto& geometry = isIt->geometry();\n+ 121 for (int i = 0; i <2; ++i)\n+ 122 fgrid << geometry.corner(i) <<\" \"<<0<<\"\\n\";\n+ 123 }\n+ 124 }\n+ 125\n+ 126 fgrid.close();\n+ 127 }\n+ 128\n+ 129public:\n+ 130 template\n+131 static void write(const Glue& glue, const std::string& path, int\n+appendix=1)\n+ 132 {\n+ 133 std::ostringstream name0;\n+ 134 name0 << path;\n+ 135 name0 << \"/domain.surf\" << std::setw(3) << std::setfill('0') << appendix;\n+ 136\n+ 137 // Write extracted grid and remote intersection on the grid1-side\n+ 138 writeIntersections(glue,name0.str());\n+ 139\n+ 140 std::ostringstream name1;\n+ 141 name1 << path;\n+ 142 name1 << \"/target.surf\" << std::setw(3) << std::setfill('0') << appendix;\n+ 143\n+ 144 writeIntersections(glue, name1.str());\n+ 145 }\n+ 146\n+ 147};\n+ 148\n+ 149} // namespace GridGlue\n+ 150} // namespace Dune\n+ 151\n+ 152#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::intersections\n-IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<...\n-> &reverse=!reversed)\n-Iterate over all intersections of a GridGlue.\n-Dune::GridGlue::GridGlue\n-sequential adapter to couple two grids at specified close together boundaries\n-Definition: gridglue.hh:67\n-Dune::GridGlue::GridGlue::intersections\n-IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<...\n-> &reverse=!reversed)\n-Iterate over all intersections of a GridGlue.\n-Dune::GridGlue::Reverse\n-Definition: rangegenerators.hh:17\n-Dune::GridGlue::Reverse::reversed\n-const Reverse< true > reversed\n-Definition: rangegenerators.hh:31\n-Dune::GridGlue::Reverse::type\n-Reverse type\n-Definition: rangegenerators.hh:18\n-Dune::GridGlue::Reverse::operator!\n-constexpr Reverse operator!() const\n-Definition: rangegenerators.hh:21\n+Dune::GridGlue::GridGlueAmiraWriter\n+Write remote intersections to a AmiraMesh file for debugging purposes.\n+Definition: gridglueamirawriter.hh:21\n+Dune::GridGlue::GridGlueAmiraWriter::write\n+static void write(const Glue &glue, const std::string &path, int appendix=1)\n+Definition: gridglueamirawriter.hh:131\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: gridglueamirawriter.hh File Reference\n+dune-grid-glue: gridglue.cc File Reference\n \n \n \n \n \n \n \n@@ -63,43 +63,39 @@\n \n \n
\n \n-
gridglueamirawriter.hh File Reference
\n+Namespaces |\n+Functions
\n+
gridglue.cc File Reference
\n \n
\n-\n-

Write all remote intersections to a AmiraMesh file. \n-More...

\n-
#include <fstream>
\n-#include <sstream>
\n-#include <type_traits>
\n-
\n-

Go to the source code of this file.

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

\n-Classes

class  Dune::GridGlue::GridGlueAmiraWriter
 Write remote intersections to a AmiraMesh file for debugging purposes. More...
 
\n+
#include "intersection.hh"
\n+#include <vector>
\n+#include <iterator>
\n+#include "../gridglue.hh"
\n+#include "../common/ringcomm.hh"
\n+#include <dune/common/unused.hh>
\n+
\n \n \n \n \n \n+

\n Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
\n+\n+\n+\n+\n

\n+Functions

template<typename T >
void Dune::GridGlue::printVector (const std::vector< T > &v, std::string name, int rank)
 
\n-

Detailed Description

\n-

Write all remote intersections to a AmiraMesh file.

\n-
\n+\n \n
\n Generated by \"doxygen\"/ 1.9.4\n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,29 +5,28 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * adapter\n-Classes | Namespaces\n-gridglueamirawriter.hh File Reference\n-Write all remote intersections to a AmiraMesh file. More...\n-#include \n-#include \n-#include \n-Go_to_the_source_code_of_this_file.\n- Classes\n-class \u00a0Dune::GridGlue::GridGlueAmiraWriter\n-\u00a0 Write remote intersections to a AmiraMesh file for debugging purposes.\n- More...\n-\u00a0\n+Namespaces | Functions\n+gridglue.cc File Reference\n+#include \"intersection.hh\"\n+#include \n+#include \n+#include \"../gridglue.hh\"\n+#include \"../common/ringcomm.hh\"\n+#include \n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n-***** Detailed Description *****\n-Write all remote intersections to a AmiraMesh file.\n+ Functions\n+template\n+void\u00a0Dune::GridGlue::printVector (const std::vector< T > &v, std::string name,\n+ int rank)\n+\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: projectionwriter_impl.hh File Reference\n+dune-grid-glue: crossproduct.hh File Reference\n \n \n \n \n \n \n \n@@ -65,59 +65,33 @@\n
  • dune
  • grid-glue
  • common
  • \n \n \n
    \n \n-
    projectionwriter_impl.hh File Reference
    \n+
    crossproduct.hh File Reference
    \n
    \n
    \n-
    #include <fstream>
    \n-
    \n+\n

    Go to the source code of this file.

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

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    namespace  Dune::GridGlue::ProjectionWriterImplementation
     
    \n \n-\n-\n-\n-\n-\n-\n-\n-\n-\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<unsigned side, typename Coordinate , typename Corners >
    void Dune::GridGlue::ProjectionWriterImplementation::write_points (const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
     
    template<unsigned side, typename Coordinate , typename Normals >
    void Dune::GridGlue::ProjectionWriterImplementation::write_normals (const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
     
    template<typename Coordinate , typename Corners >
    void Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_points (const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
     
    template<typename Coordinate , typename Normals >
    void Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_normals (const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
     
    template<unsigned side, typename Coordinate >
    void Dune::GridGlue::ProjectionWriterImplementation::write_success (const Projection< Coordinate > &projection, std::ostream &out)
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::write (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, std::ostream &out)
     write projection in VTK format More...
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::write (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, const std::string &filename)
     write projection in VTK format More...
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::print (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)
     Print information about the projection to std::cout stream. More...
     
    template<class T , int dim>
    static Dune::FieldVector< T, dim > Dune::GridGlue::crossProduct (const Dune::FieldVector< T, dim > &a, const Dune::FieldVector< T, dim > &b)
     compute cross product More...
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -6,60 +6,24 @@\n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n Namespaces | Functions\n-projectionwriter_impl.hh File Reference\n-#include \n+crossproduct.hh File Reference\n Go_to_the_source_code_of_this_file.\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n-namespace \u00a0Dune::GridGlue::ProjectionWriterImplementation\n-\u00a0\n Functions\n-template\n-void\u00a0Dune::GridGlue::ProjectionWriterImplementation::write_points (const\n- Projection< Coordinate > &projection, const Corners &corners, std::\n- ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::ProjectionWriterImplementation::write_normals (const\n- Projection< Coordinate > &projection, const Normals &normals, std::\n- ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::ProjectionWriterImplementation::\n- write_edge_intersection_points (const Projection< Coordinate >\n- &projection, const Corners &corners, std::ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::ProjectionWriterImplementation::\n- write_edge_intersection_normals (const Projection< Coordinate >\n- &projection, const Normals &normals, std::ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::ProjectionWriterImplementation::write_success (const\n- Projection< Coordinate > &projection, std::ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::write (const Projection< Coordinate > &projection, const\n- Corners &corners, const Normals &normals, std::ostream &out)\n-\u00a0 write projection in VTK format More...\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::write (const Projection< Coordinate > &projection, const\n- Corners &corners, const Normals &normals, const std::string &filename)\n-\u00a0 write projection in VTK format More...\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::print (const Projection< Coordinate > &projection, const\n- Corners &corners, const Normals &normals)\n-\u00a0 Print information about the projection to std::cout stream. More...\n+template\n+static Dune::FieldVector< T, dim >\u00a0Dune::GridGlue::crossProduct (const Dune::\n+ FieldVector< T, dim > &a, const Dune::\n+ FieldVector< T, dim > &b)\n+\u00a0 compute cross product More...\n \u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: projectionwriter_impl.hh Source File\n+dune-grid-glue: crossproduct.hh Source File\n \n \n \n \n \n \n \n@@ -62,195 +62,46 @@\n \n \n \n
    \n-
    projectionwriter_impl.hh
    \n+
    crossproduct.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    3#include <fstream>
    \n-
    4
    \n-
    5namespace Dune {
    \n-
    6namespace GridGlue {
    \n-
    7
    \n-
    8namespace ProjectionWriterImplementation {
    \n-
    9
    \n-
    10template<unsigned side, typename Coordinate, typename Corners>
    \n-
    11void write_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
    \n-
    12{
    \n-
    13 using namespace ProjectionImplementation;
    \n-
    14 using std::get;
    \n-
    15 const unsigned other_side = 1 - side;
    \n-
    16
    \n-
    17 for (const auto& c : get<side>(corners))
    \n-
    18 out << c << "\\n";
    \n-
    19
    \n-
    20 for (const auto& i : get<side>(projection.images())) {
    \n-
    21 const auto global = interpolate(i, get<other_side>(corners));
    \n-
    22 out << global << "\\n";
    \n-
    23 }
    \n-
    24}
    \n+
    3#ifndef DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH
    \n+
    4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1
    \n+
    5
    \n+
    6namespace Dune {
    \n+
    7namespace GridGlue {
    \n+
    8
    \n+
    14template <class T, int dim>
    \n+
    15static Dune::FieldVector<T,dim> crossProduct(const Dune::FieldVector<T,dim>& a,
    \n+
    16 const Dune::FieldVector<T,dim>& b)
    \n+
    17{
    \n+
    18 if (dim!=3)
    \n+
    19 DUNE_THROW(Dune::NotImplemented, "crossProduct does not work for dimension " << dim);
    \n+
    20
    \n+
    21 Dune::FieldVector<T,dim> c;
    \n+
    22 c[0] = a[1]*b[2] - a[2]*b[1];
    \n+
    23 c[1] = a[2]*b[0] - a[0]*b[2];
    \n+
    24 c[2] = a[0]*b[1] - a[1]*b[0];
    \n
    25
    \n-
    26template<unsigned side, typename Coordinate, typename Normals>
    \n-
    27void write_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
    \n-
    28{
    \n-
    29 using namespace ProjectionImplementation;
    \n-
    30 using std::get;
    \n-
    31 const unsigned other_side = 1 - side;
    \n-
    32
    \n-
    33 for (const auto& n : get<side>(normals))
    \n-
    34 out << n << "\\n";
    \n-
    35
    \n-
    36 for (const auto& x : get<side>(projection.images())) {
    \n-
    37 const auto n = interpolate_unit_normals(x, get<other_side>(normals));
    \n-
    38 out << n << "\\n";
    \n-
    39 }
    \n-
    40}
    \n-
    41
    \n-
    42template<typename Coordinate, typename Corners>
    \n-
    43void write_edge_intersection_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
    \n-
    44{
    \n-
    45 using namespace ProjectionImplementation;
    \n-
    46 using std::get;
    \n-
    47
    \n-
    48 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
    \n-
    49 const auto& local = projection.edgeIntersections()[i].local;
    \n-
    50 out << interpolate(local[0], get<0>(corners)) << "\\n"
    \n-
    51 << interpolate(local[1], get<1>(corners)) << "\\n";
    \n-
    52 }
    \n-
    53}
    \n-
    54
    \n-
    55template<typename Coordinate, typename Normals>
    \n-
    56void write_edge_intersection_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
    \n-
    57{
    \n-
    58 using namespace ProjectionImplementation;
    \n-
    59 using std::get;
    \n-
    60
    \n-
    61 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
    \n-
    62 const auto& local = projection.edgeIntersections()[i].local;
    \n-
    63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals));
    \n-
    64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals));
    \n-
    65
    \n-
    66 out << n0 << "\\n"
    \n-
    67 << n1 << "\\n";
    \n-
    68 }
    \n-
    69}
    \n-
    70
    \n-
    71template<unsigned side, typename Coordinate>
    \n-
    72void write_success(const Projection<Coordinate>& projection, std::ostream& out)
    \n-
    73{
    \n-
    74 using std::get;
    \n-
    75
    \n-
    76 out << side << "\\n";
    \n-
    77
    \n-
    78 const auto& success = get<side>(projection.success());
    \n-
    79 for (std::size_t i = 0; i < success.size(); ++i)
    \n-
    80 out << (success[i] ? "1\\n" : "0\\n");
    \n-
    81}
    \n-
    82
    \n-
    83} /* namespace ProjectionWriterImplementation */
    \n-
    84
    \n-
    85template<typename Coordinate, typename Corners, typename Normals>
    \n-
    86void write(const Projection<Coordinate>& projection,
    \n-
    87 const Corners& corners,
    \n-
    88 const Normals& normals,
    \n-
    89 std::ostream& out)
    \n-
    90{
    \n-
    91 using namespace ProjectionWriterImplementation;
    \n-
    92
    \n-
    93 const auto numberOfEdgeIntersections = projection.numberOfEdgeIntersections();
    \n-
    94 const auto nPoints = 12 + 2 * numberOfEdgeIntersections;
    \n-
    95
    \n-
    96 out << "# vtk DataFile Version2.0\\n"
    \n-
    97 << "Filename: projection\\n"
    \n-
    98 << "ASCII\\n"
    \n-
    99 << "DATASET UNSTRUCTURED_GRID\\n"
    \n-
    100 << "POINTS " << nPoints << " double\\n";
    \n-
    101 write_points<0>(projection, corners, out);
    \n-
    102 write_points<1>(projection, corners, out);
    \n-
    103 write_edge_intersection_points(projection, corners, out);
    \n-
    104 out << "CELLS " << (8 + numberOfEdgeIntersections) << " " << (26 + 3 * numberOfEdgeIntersections) << "\\n";
    \n-
    105 out << "3 0 1 2\\n" "2 0 3\\n" "2 1 4\\n" "2 2 5\\n"
    \n-
    106 << "3 6 7 8\\n" "2 6 9\\n" "2 7 10\\n" "2 8 11\\n";
    \n-
    107 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    \n-
    108 out << "2 " << (12 + 2*i) << " " << (12 + 2*i + 1) << "\\n";
    \n-
    109 out << "CELL_TYPES " << (8 + numberOfEdgeIntersections) << "\\n" "5\\n3\\n3\\n3\\n" "5\\n3\\n3\\n3\\n";
    \n-
    110 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    \n-
    111 out << "3\\n";
    \n-
    112 out << "CELL_DATA " << (8 + numberOfEdgeIntersections) << "\\n";
    \n-
    113 out << "SCALARS success int 1\\n"
    \n-
    114 << "LOOKUP_TABLE success\\n";
    \n-
    115 write_success<0>(projection, out);
    \n-
    116 write_success<1>(projection, out);
    \n-
    117 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    \n-
    118 out << "2\\n";
    \n-
    119 out << "LOOKUP_TABLE success 2\\n"
    \n-
    120 << "1.0 0.0 0.0 1.0\\n"
    \n-
    121 << "0.0 1.0 0.0 1.0\\n";
    \n-
    122 out << "POINT_DATA " << nPoints << "\\n"
    \n-
    123 << "NORMALS normals double\\n";
    \n-
    124 write_normals<0>(projection, normals, out);
    \n-
    125 write_normals<1>(projection, normals, out);
    \n-
    126 write_edge_intersection_normals(projection, normals, out);
    \n-
    127}
    \n-
    128
    \n-
    129template<typename Coordinate, typename Corners, typename Normals>
    \n-
    130void write(const Projection<Coordinate>& projection,
    \n-
    131 const Corners& corners,
    \n-
    132 const Normals& normals,
    \n-
    133 const std::string& filename)
    \n-
    134{
    \n-
    135 std::ofstream out(filename.c_str());
    \n-
    136 write(projection, corners, normals, out);
    \n-
    137}
    \n-
    138
    \n-
    139template<typename Coordinate, typename Corners, typename Normals>
    \n-
    140void print(const Projection<Coordinate>& projection,
    \n-
    141 const Corners& corners,
    \n-
    142 const Normals& normals)
    \n-
    143{
    \n-
    144 using namespace ProjectionWriterImplementation;
    \n-
    145
    \n-
    146 std::cout << "Side 0 corners and images:\\n";
    \n-
    147 write_points<0>(projection, corners, std::cout);
    \n-
    148 std::cout << "Side 0 success:\\n";
    \n-
    149 write_success<0>(projection, std::cout);
    \n-
    150 std::cout << "Side 1 corners and images:\\n";
    \n-
    151 write_points<1>(projection, corners, std::cout);
    \n-
    152 std::cout << "Side 1 success:\\n";
    \n-
    153 write_success<1>(projection, std::cout);
    \n-
    154 std::cout << "Side 0 normals and projected normals:\\n";
    \n-
    155 write_normals<0>(projection, normals, std::cout);
    \n-
    156 std::cout << "Side 1 normals and projected normals:\\n";
    \n-
    157 write_normals<1>(projection, normals, std::cout);
    \n-
    158 std::cout << projection.numberOfEdgeIntersections() << " edge intersections:\\n";
    \n-
    159 write_edge_intersection_points(projection, corners, std::cout);
    \n-
    160}
    \n-
    161
    \n-
    162} /* namespace GridGlue */
    \n-
    163} /* namespace Dune */
    \n+
    26 return c;
    \n+
    27}
    \n+
    28
    \n+
    29} /* namespace GridGlue */
    \n+
    30} /* namespace Dune */
    \n+
    31
    \n+
    32#endif
    \n
    Definition: gridglue.hh:37
    \n-
    void write(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, std::ostream &out)
    write projection in VTK format
    Definition: projectionwriter_impl.hh:86
    \n-
    void print(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)
    Print information about the projection to std::cout stream.
    Definition: projectionwriter_impl.hh:140
    \n-
    Corners::value_type interpolate(const Coordinate &x, const Corners &corners)
    Definition: projection_impl.hh:70
    \n-
    Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals &normals)
    Definition: projection_impl.hh:91
    \n-
    void write_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
    Definition: projectionwriter_impl.hh:27
    \n-
    void write_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
    Definition: projectionwriter_impl.hh:11
    \n-
    void write_success(const Projection< Coordinate > &projection, std::ostream &out)
    Definition: projectionwriter_impl.hh:72
    \n-
    void write_edge_intersection_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
    Definition: projectionwriter_impl.hh:43
    \n-
    void write_edge_intersection_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
    Definition: projectionwriter_impl.hh:56
    \n-
    Projection of a line (triangle) on another line (triangle).
    Definition: projection.hh:21
    \n-
    const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const
    Indicate whether projection (inverse projection) is valid for each corner or not.
    Definition: projection.hh:252
    \n-
    unsigned numberOfEdgeIntersections() const
    Number of edge intersections.
    Definition: projection.hh:262
    \n-
    const std::tuple< Images, Preimages > & images() const
    Images and preimages of corners.
    Definition: projection.hh:235
    \n-
    const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections() const
    Edge-edge intersections.
    Definition: projection.hh:273
    \n+
    static Dune::FieldVector< T, dim > crossProduct(const Dune::FieldVector< T, dim > &a, const Dune::FieldVector< T, dim > &b)
    compute cross product
    Definition: crossproduct.hh:15
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,246 +5,50 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-projectionwriter_impl.hh\n+crossproduct.hh\n Go_to_the_documentation_of_this_file.\n 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#include \n- 4\n- 5namespace Dune {\n- 6namespace GridGlue {\n- 7\n-8namespace ProjectionWriterImplementation {\n- 9\n- 10template\n-11void write_points(const Projection& projection, const Corners&\n-corners, std::ostream& out)\n- 12{\n- 13 using namespace ProjectionImplementation;\n- 14 using std::get;\n- 15 const unsigned other_side = 1 - side;\n- 16\n- 17 for (const auto& c : get(corners))\n- 18 out << c << \"\\n\";\n- 19\n- 20 for (const auto& i : get(projection.images())) {\n- 21 const auto global = interpolate(i, get(corners));\n- 22 out << global << \"\\n\";\n- 23 }\n- 24}\n+ 3#ifndef DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH\n+ 4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1\n+ 5\n+ 6namespace Dune {\n+ 7namespace GridGlue {\n+ 8\n+ 14template \n+15static Dune::FieldVector crossProduct(const Dune::FieldVector&\n+a,\n+ 16 const Dune::FieldVector& b)\n+ 17{\n+ 18 if (dim!=3)\n+ 19 DUNE_THROW(Dune::NotImplemented, \"crossProduct does not work for dimension\n+\" << dim);\n+ 20\n+ 21 Dune::FieldVector c;\n+ 22 c[0] = a[1]*b[2] - a[2]*b[1];\n+ 23 c[1] = a[2]*b[0] - a[0]*b[2];\n+ 24 c[2] = a[0]*b[1] - a[1]*b[0];\n 25\n- 26template\n-27void write_normals(const Projection& projection, const Normals&\n-normals, std::ostream& out)\n- 28{\n- 29 using namespace ProjectionImplementation;\n- 30 using std::get;\n- 31 const unsigned other_side = 1 - side;\n- 32\n- 33 for (const auto& n : get(normals))\n- 34 out << n << \"\\n\";\n- 35\n- 36 for (const auto& x : get(projection.images())) {\n- 37 const auto n = interpolate_unit_normals(x, get(normals));\n- 38 out << n << \"\\n\";\n- 39 }\n- 40}\n- 41\n- 42template\n-43void write_edge_intersection_points(const Projection& projection,\n-const Corners& corners, std::ostream& out)\n- 44{\n- 45 using namespace ProjectionImplementation;\n- 46 using std::get;\n- 47\n- 48 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {\n- 49 const auto& local = projection.edgeIntersections()[i].local;\n- 50 out << interpolate(local[0], get<0>(corners)) << \"\\n\"\n- 51 << interpolate(local[1], get<1>(corners)) << \"\\n\";\n- 52 }\n- 53}\n- 54\n- 55template\n-56void write_edge_intersection_normals(const Projection&\n-projection, const Normals& normals, std::ostream& out)\n- 57{\n- 58 using namespace ProjectionImplementation;\n- 59 using std::get;\n- 60\n- 61 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {\n- 62 const auto& local = projection.edgeIntersections()[i].local;\n- 63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals));\n- 64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals));\n- 65\n- 66 out << n0 << \"\\n\"\n- 67 << n1 << \"\\n\";\n- 68 }\n- 69}\n- 70\n- 71template\n-72void write_success(const Projection& projection, std::ostream&\n-out)\n- 73{\n- 74 using std::get;\n- 75\n- 76 out << side << \"\\n\";\n- 77\n- 78 const auto& success = get(projection.success());\n- 79 for (std::size_t i = 0; i < success.size(); ++i)\n- 80 out << (success[i] ? \"1\\n\" : \"0\\n\");\n- 81}\n- 82\n- 83} /* namespace ProjectionWriterImplementation */\n- 84\n- 85template\n-86void write(const Projection& projection,\n- 87 const Corners& corners,\n- 88 const Normals& normals,\n- 89 std::ostream& out)\n- 90{\n- 91 using namespace ProjectionWriterImplementation;\n- 92\n- 93 const auto numberOfEdgeIntersections = projection.numberOfEdgeIntersections\n-();\n- 94 const auto nPoints = 12 + 2 * numberOfEdgeIntersections;\n- 95\n- 96 out << \"# vtk DataFile Version2.0\\n\"\n- 97 << \"Filename: projection\\n\"\n- 98 << \"ASCII\\n\"\n- 99 << \"DATASET UNSTRUCTURED_GRID\\n\"\n- 100 << \"POINTS \" << nPoints << \" double\\n\";\n- 101 write_points<0>(projection, corners, out);\n- 102 write_points<1>(projection, corners, out);\n- 103 write_edge_intersection_points(projection, corners, out);\n- 104 out << \"CELLS \" << (8 + numberOfEdgeIntersections) << \" \" << (26 + 3 *\n-numberOfEdgeIntersections) << \"\\n\";\n- 105 out << \"3 0 1 2\\n\" \"2 0 3\\n\" \"2 1 4\\n\" \"2 2 5\\n\"\n- 106 << \"3 6 7 8\\n\" \"2 6 9\\n\" \"2 7 10\\n\" \"2 8 11\\n\";\n- 107 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)\n- 108 out << \"2 \" << (12 + 2*i) << \" \" << (12 + 2*i + 1) << \"\\n\";\n- 109 out << \"CELL_TYPES \" << (8 + numberOfEdgeIntersections) << \"\\n\"\n-\"5\\n3\\n3\\n3\\n\" \"5\\n3\\n3\\n3\\n\";\n- 110 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)\n- 111 out << \"3\\n\";\n- 112 out << \"CELL_DATA \" << (8 + numberOfEdgeIntersections) << \"\\n\";\n- 113 out << \"SCALARS success int 1\\n\"\n- 114 << \"LOOKUP_TABLE success\\n\";\n- 115 write_success<0>(projection, out);\n- 116 write_success<1>(projection, out);\n- 117 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)\n- 118 out << \"2\\n\";\n- 119 out << \"LOOKUP_TABLE success 2\\n\"\n- 120 << \"1.0 0.0 0.0 1.0\\n\"\n- 121 << \"0.0 1.0 0.0 1.0\\n\";\n- 122 out << \"POINT_DATA \" << nPoints << \"\\n\"\n- 123 << \"NORMALS normals double\\n\";\n- 124 write_normals<0>(projection, normals, out);\n- 125 write_normals<1>(projection, normals, out);\n- 126 write_edge_intersection_normals(projection, normals, out);\n- 127}\n- 128\n- 129template\n-130void write(const Projection& projection,\n- 131 const Corners& corners,\n- 132 const Normals& normals,\n- 133 const std::string& filename)\n- 134{\n- 135 std::ofstream out(filename.c_str());\n- 136 write(projection, corners, normals, out);\n- 137}\n- 138\n- 139template\n-140void print(const Projection& projection,\n- 141 const Corners& corners,\n- 142 const Normals& normals)\n- 143{\n- 144 using namespace ProjectionWriterImplementation;\n- 145\n- 146 std::cout << \"Side 0 corners and images:\\n\";\n- 147 write_points<0>(projection, corners, std::cout);\n- 148 std::cout << \"Side 0 success:\\n\";\n- 149 write_success<0>(projection, std::cout);\n- 150 std::cout << \"Side 1 corners and images:\\n\";\n- 151 write_points<1>(projection, corners, std::cout);\n- 152 std::cout << \"Side 1 success:\\n\";\n- 153 write_success<1>(projection, std::cout);\n- 154 std::cout << \"Side 0 normals and projected normals:\\n\";\n- 155 write_normals<0>(projection, normals, std::cout);\n- 156 std::cout << \"Side 1 normals and projected normals:\\n\";\n- 157 write_normals<1>(projection, normals, std::cout);\n- 158 std::cout << projection.numberOfEdgeIntersections() << \" edge\n-intersections:\\n\";\n- 159 write_edge_intersection_points(projection, corners, std::cout);\n- 160}\n- 161\n- 162} /* namespace GridGlue */\n- 163} /* namespace Dune */\n+ 26 return c;\n+ 27}\n+ 28\n+ 29} /* namespace GridGlue */\n+ 30} /* namespace Dune */\n+ 31\n+ 32#endif\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::write\n-void write(const Projection< Coordinate > &projection, const Corners &corners,\n-const Normals &normals, std::ostream &out)\n-write projection in VTK format\n-Definition: projectionwriter_impl.hh:86\n-Dune::GridGlue::print\n-void print(const Projection< Coordinate > &projection, const Corners &corners,\n-const Normals &normals)\n-Print information about the projection to std::cout stream.\n-Definition: projectionwriter_impl.hh:140\n-Dune::GridGlue::ProjectionImplementation::interpolate\n-Corners::value_type interpolate(const Coordinate &x, const Corners &corners)\n-Definition: projection_impl.hh:70\n-Dune::GridGlue::ProjectionImplementation::interpolate_unit_normals\n-Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals\n-&normals)\n-Definition: projection_impl.hh:91\n-Dune::GridGlue::ProjectionWriterImplementation::write_normals\n-void write_normals(const Projection< Coordinate > &projection, const Normals\n-&normals, std::ostream &out)\n-Definition: projectionwriter_impl.hh:27\n-Dune::GridGlue::ProjectionWriterImplementation::write_points\n-void write_points(const Projection< Coordinate > &projection, const Corners\n-&corners, std::ostream &out)\n-Definition: projectionwriter_impl.hh:11\n-Dune::GridGlue::ProjectionWriterImplementation::write_success\n-void write_success(const Projection< Coordinate > &projection, std::ostream\n-&out)\n-Definition: projectionwriter_impl.hh:72\n-Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_points\n-void write_edge_intersection_points(const Projection< Coordinate > &projection,\n-const Corners &corners, std::ostream &out)\n-Definition: projectionwriter_impl.hh:43\n-Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_normals\n-void write_edge_intersection_normals(const Projection< Coordinate >\n-&projection, const Normals &normals, std::ostream &out)\n-Definition: projectionwriter_impl.hh:56\n-Dune::GridGlue::Projection\n-Projection of a line (triangle) on another line (triangle).\n-Definition: projection.hh:21\n-Dune::GridGlue::Projection::success\n-const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const\n-Indicate whether projection (inverse projection) is valid for each corner or\n-not.\n-Definition: projection.hh:252\n-Dune::GridGlue::Projection::numberOfEdgeIntersections\n-unsigned numberOfEdgeIntersections() const\n-Number of edge intersections.\n-Definition: projection.hh:262\n-Dune::GridGlue::Projection::images\n-const std::tuple< Images, Preimages > & images() const\n-Images and preimages of corners.\n-Definition: projection.hh:235\n-Dune::GridGlue::Projection::edgeIntersections\n-const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections\n-() const\n-Edge-edge intersections.\n-Definition: projection.hh:273\n+Dune::GridGlue::crossProduct\n+static Dune::FieldVector< T, dim > crossProduct(const Dune::FieldVector< T, dim\n+> &a, const Dune::FieldVector< T, dim > &b)\n+compute cross product\n+Definition: crossproduct.hh:15\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: crossproduct.hh File Reference\n+dune-grid-glue: areawriter_impl.hh File Reference\n \n \n \n \n \n \n \n@@ -63,35 +63,56 @@\n \n \n
    \n \n-
    crossproduct.hh File Reference
    \n+
    areawriter_impl.hh File Reference
    \n
    \n
    \n-\n+
    #include <fstream>
    \n+#include <vector>
    \n+#include <dune/common/fvector.hh>
    \n+#include <dune/geometry/type.hh>
    \n+#include <dune/grid/common/mcmgmapper.hh>
    \n+
    \n

    Go to the source code of this file.

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

    \n+Classes

    struct  Dune::GridGlue::AreaWriterImplementation::FacetLayout< dimgrid >
     
    \n \n \n \n \n \n+\n+\n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    namespace  Dune::GridGlue::AreaWriterImplementation
     
    \n \n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n Functions

    template<class T , int dim>
    static Dune::FieldVector< T, dim > Dune::GridGlue::crossProduct (const Dune::FieldVector< T, dim > &a, const Dune::FieldVector< T, dim > &b)
     compute cross product More...
     
    template<typename GridView >
    void Dune::GridGlue::AreaWriterImplementation::write_facet_geometry (const GridView &gv, std::ostream &out)
     
    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)
     
    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string &filename)
     
    template<typename Glue >
    void Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string &base)
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,25 +5,44 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-Namespaces | Functions\n-crossproduct.hh File Reference\n+Classes | Namespaces | Functions\n+areawriter_impl.hh File Reference\n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n+ Classes\n+struct \u00a0Dune::GridGlue::AreaWriterImplementation::FacetLayout<_dimgrid_>\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n+namespace \u00a0Dune::GridGlue::AreaWriterImplementation\n+\u00a0\n Functions\n-template\n-static Dune::FieldVector< T, dim >\u00a0Dune::GridGlue::crossProduct (const Dune::\n- FieldVector< T, dim > &a, const Dune::\n- FieldVector< T, dim > &b)\n-\u00a0 compute cross product More...\n+template\n+void\u00a0Dune::GridGlue::AreaWriterImplementation::write_facet_geometry (const\n+ GridView &gv, std::ostream &out)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string\n+ &filename)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string\n+ &base)\n \u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: crossproduct.hh Source File\n+dune-grid-glue: areawriter_impl.hh Source File\n \n \n \n \n \n \n \n@@ -62,46 +62,169 @@\n \n \n \n
    \n-
    crossproduct.hh
    \n+
    areawriter_impl.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    3#ifndef DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH
    \n-
    4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1
    \n+
    3#include <fstream>
    \n+
    4#include <vector>
    \n
    5
    \n-
    6namespace Dune {
    \n-
    7namespace GridGlue {
    \n-
    8
    \n-
    14template <class T, int dim>
    \n-
    15static Dune::FieldVector<T,dim> crossProduct(const Dune::FieldVector<T,dim>& a,
    \n-
    16 const Dune::FieldVector<T,dim>& b)
    \n+
    6#include <dune/common/fvector.hh>
    \n+
    7#include <dune/geometry/type.hh>
    \n+
    8#include <dune/grid/common/mcmgmapper.hh>
    \n+
    9
    \n+
    10namespace Dune {
    \n+
    11namespace GridGlue {
    \n+
    12
    \n+
    13namespace AreaWriterImplementation {
    \n+
    14
    \n+
    15template<int dimgrid>
    \n+\n
    17{
    \n-
    18 if (dim!=3)
    \n-
    19 DUNE_THROW(Dune::NotImplemented, "crossProduct does not work for dimension " << dim);
    \n-
    20
    \n-
    21 Dune::FieldVector<T,dim> c;
    \n-
    22 c[0] = a[1]*b[2] - a[2]*b[1];
    \n-
    23 c[1] = a[2]*b[0] - a[0]*b[2];
    \n-
    24 c[2] = a[0]*b[1] - a[1]*b[0];
    \n-
    25
    \n-
    26 return c;
    \n-
    27}
    \n+
    18 bool contains(Dune::GeometryType gt) const
    \n+
    19 {
    \n+
    20 return gt.dim() == dimgrid - 1;
    \n+
    21 }
    \n+
    22};
    \n+
    23
    \n+
    24template<typename GridView>
    \n+
    25void write_facet_geometry(const GridView& gv, std::ostream& out)
    \n+
    26{
    \n+
    27 using Coordinate = Dune::FieldVector<double, 3>;
    \n
    28
    \n-
    29} /* namespace GridGlue */
    \n-
    30} /* namespace Dune */
    \n-
    31
    \n-
    32#endif
    \n+
    29 std::vector<Coordinate> corners;
    \n+
    30 for (const auto& facet : facets(gv)) {
    \n+
    31 const auto geometry = facet.geometry();
    \n+
    32 for (int i = 0; i < geometry.corners(); ++i) {
    \n+
    33 /* VTK always needs 3-dim coordinates... */
    \n+
    34 const auto c0 = geometry.corner(i);
    \n+
    35 Coordinate c1;
    \n+
    36 for (int d = 0; d < GridView::dimensionworld; ++d)
    \n+
    37 c1[d] = c0[d];
    \n+
    38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d)
    \n+
    39 c1[d] = double(0);
    \n+
    40 corners.push_back(c1);
    \n+
    41 }
    \n+
    42 }
    \n+
    43
    \n+
    44 {
    \n+
    45 out << "DATASET UNSTRUCTURED_GRID\\n"
    \n+
    46 << "POINTS " << corners.size() << " double\\n";
    \n+
    47 for (const auto& c : corners)
    \n+
    48 out << c << "\\n";
    \n+
    49 }
    \n+
    50 {
    \n+
    51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << "\\n";
    \n+
    52 std::size_t c = 0;
    \n+
    53 for (const auto& facet : facets(gv)) {
    \n+
    54 const auto geometry = facet.geometry();
    \n+
    55 out << geometry.corners();
    \n+
    56 for (int i = 0; i < geometry.corners(); ++i, ++c)
    \n+
    57 out << " " << c;
    \n+
    58 out << "\\n";
    \n+
    59 }
    \n+
    60 }
    \n+
    61 {
    \n+
    62 out << "CELL_TYPES " << gv.size(1) << "\\n";
    \n+
    63 for (const auto& facet : facets(gv)) {
    \n+
    64 const auto type = facet.type();
    \n+
    65 if (type.isVertex())
    \n+
    66 out << "1\\n";
    \n+
    67 else if (type.isLine())
    \n+
    68 out << "2\\n";
    \n+
    69 else if (type.isTriangle())
    \n+
    70 out << "5\\n";
    \n+
    71 else if (type.isQuadrilateral())
    \n+
    72 out << "9\\n";
    \n+
    73 else if (type.isTetrahedron())
    \n+
    74 out << "10\\n";
    \n+
    75 else
    \n+
    76 DUNE_THROW(Dune::Exception, "Unhandled geometry type");
    \n+
    77 }
    \n+
    78 }
    \n+
    79}
    \n+
    80
    \n+
    81} /* namespace AreaWriterImplementation */
    \n+
    82
    \n+
    83template<int side, typename Glue>
    \n+
    84void write_glue_area_vtk(const Glue& glue, std::ostream& out)
    \n+
    85{
    \n+
    86 using GridView = typename std::decay< decltype(glue.template gridView<side>()) >::type;
    \n+
    87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, AreaWriterImplementation::FacetLayout>;
    \n+
    88 using ctype = typename GridView::ctype;
    \n+
    89
    \n+
    90 const GridView gv = glue.template gridView<side>();
    \n+
    91 Mapper mapper(gv);
    \n+
    92 std::vector<ctype> coveredArea(mapper.size(), ctype(0));
    \n+
    93 std::vector<ctype> totalArea(mapper.size(), ctype(1));
    \n+
    94
    \n+
    95 for (const auto& in : intersections(glue, Reverse<side == 1>())) {
    \n+
    96 const auto element = in.inside();
    \n+
    97 const auto index = mapper.subIndex(element, in.indexInInside(), 1);
    \n+
    98 coveredArea[index] += in.geometryInInside().volume();
    \n+
    99
    \n+
    100 const auto& refElement = Dune::ReferenceElements<ctype, GridView::dimension>::general(element.type());
    \n+
    101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside());
    \n+
    102 totalArea[index] = subGeometry.volume();
    \n+
    103 }
    \n+
    104
    \n+
    105 for (std::size_t i = 0; i < coveredArea.size(); ++i)
    \n+
    106 coveredArea[i] /= totalArea[i];
    \n+
    107
    \n+
    108 out << "# vtk DataFile Version 2.0\\n"
    \n+
    109 << "Filename: Glue Area\\n"
    \n+
    110 << "ASCII\\n";
    \n+
    111
    \n+\n+
    113
    \n+
    114 out << "CELL_DATA " << coveredArea.size() << "\\n"
    \n+
    115 << "SCALARS CoveredArea double 1\\n"
    \n+
    116 << "LOOKUP_TABLE default\\n";
    \n+
    117 for (const auto& value : coveredArea)
    \n+
    118 out << value << "\\n";
    \n+
    119}
    \n+
    120
    \n+
    121template<int side, typename Glue>
    \n+
    122void write_glue_area_vtk(const Glue& glue, const std::string& filename)
    \n+
    123{
    \n+
    124 std::ofstream out(filename.c_str());
    \n+
    125 write_glue_area_vtk<side>(glue, out);
    \n+
    126}
    \n+
    127
    \n+
    128template<typename Glue>
    \n+
    129void write_glue_areas_vtk(const Glue& glue, const std::string& base)
    \n+
    130{
    \n+
    131 {
    \n+
    132 std::string filename = base;
    \n+
    133 filename += "-inside.vtk";
    \n+
    134 write_glue_area_vtk<0>(glue, filename);
    \n+
    135 }
    \n+
    136 {
    \n+
    137 std::string filename = base;
    \n+
    138 filename += "-outside.vtk";
    \n+
    139 write_glue_area_vtk<1>(glue, filename);
    \n+
    140 }
    \n+
    141}
    \n+
    142
    \n+
    143} /* namespace GridGlue */
    \n+
    144} /* namespace Dune */
    \n
    Definition: gridglue.hh:37
    \n-
    static Dune::FieldVector< T, dim > crossProduct(const Dune::FieldVector< T, dim > &a, const Dune::FieldVector< T, dim > &b)
    compute cross product
    Definition: crossproduct.hh:15
    \n+
    void write_glue_area_vtk(const Glue &glue, std::ostream &out)
    Definition: areawriter_impl.hh:84
    \n+
    void write_glue_areas_vtk(const Glue &glue, const std::string &base)
    Definition: areawriter_impl.hh:129
    \n+
    IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
    Iterate over all intersections of a GridGlue.
    \n+
    void write_facet_geometry(const GridView &gv, std::ostream &out)
    Definition: areawriter_impl.hh:25
    \n+
    Definition: rangegenerators.hh:17
    \n+\n+
    bool contains(Dune::GeometryType gt) const
    Definition: areawriter_impl.hh:18
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,50 +5,185 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-crossproduct.hh\n+areawriter_impl.hh\n Go_to_the_documentation_of_this_file.\n 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#ifndef DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH\n- 4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1\n+ 3#include \n+ 4#include \n 5\n- 6namespace Dune {\n- 7namespace GridGlue {\n- 8\n- 14template \n-15static Dune::FieldVector crossProduct(const Dune::FieldVector&\n-a,\n- 16 const Dune::FieldVector& b)\n+ 6#include \n+ 7#include \n+ 8#include \n+ 9\n+ 10namespace Dune {\n+ 11namespace GridGlue {\n+ 12\n+13namespace AreaWriterImplementation {\n+ 14\n+ 15template\n+16struct FacetLayout\n 17{\n- 18 if (dim!=3)\n- 19 DUNE_THROW(Dune::NotImplemented, \"crossProduct does not work for dimension\n-\" << dim);\n- 20\n- 21 Dune::FieldVector c;\n- 22 c[0] = a[1]*b[2] - a[2]*b[1];\n- 23 c[1] = a[2]*b[0] - a[0]*b[2];\n- 24 c[2] = a[0]*b[1] - a[1]*b[0];\n- 25\n- 26 return c;\n- 27}\n+18 bool contains(Dune::GeometryType gt) const\n+ 19 {\n+ 20 return gt.dim() == dimgrid - 1;\n+ 21 }\n+ 22};\n+ 23\n+ 24template\n+25void write_facet_geometry(const GridView& gv, std::ostream& out)\n+ 26{\n+ 27 using Coordinate = Dune::FieldVector;\n 28\n- 29} /* namespace GridGlue */\n- 30} /* namespace Dune */\n- 31\n- 32#endif\n+ 29 std::vector corners;\n+ 30 for (const auto& facet : facets(gv)) {\n+ 31 const auto geometry = facet.geometry();\n+ 32 for (int i = 0; i < geometry.corners(); ++i) {\n+ 33 /* VTK always needs 3-dim coordinates... */\n+ 34 const auto c0 = geometry.corner(i);\n+ 35 Coordinate c1;\n+ 36 for (int d = 0; d < GridView::dimensionworld; ++d)\n+ 37 c1[d] = c0[d];\n+ 38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d)\n+ 39 c1[d] = double(0);\n+ 40 corners.push_back(c1);\n+ 41 }\n+ 42 }\n+ 43\n+ 44 {\n+ 45 out << \"DATASET UNSTRUCTURED_GRID\\n\"\n+ 46 << \"POINTS \" << corners.size() << \" double\\n\";\n+ 47 for (const auto& c : corners)\n+ 48 out << c << \"\\n\";\n+ 49 }\n+ 50 {\n+ 51 out << \"CELLS \" << gv.size(1) << \" \" << (gv.size(1) + corners.size()) <<\n+\"\\n\";\n+ 52 std::size_t c = 0;\n+ 53 for (const auto& facet : facets(gv)) {\n+ 54 const auto geometry = facet.geometry();\n+ 55 out << geometry.corners();\n+ 56 for (int i = 0; i < geometry.corners(); ++i, ++c)\n+ 57 out << \" \" << c;\n+ 58 out << \"\\n\";\n+ 59 }\n+ 60 }\n+ 61 {\n+ 62 out << \"CELL_TYPES \" << gv.size(1) << \"\\n\";\n+ 63 for (const auto& facet : facets(gv)) {\n+ 64 const auto type = facet.type();\n+ 65 if (type.isVertex())\n+ 66 out << \"1\\n\";\n+ 67 else if (type.isLine())\n+ 68 out << \"2\\n\";\n+ 69 else if (type.isTriangle())\n+ 70 out << \"5\\n\";\n+ 71 else if (type.isQuadrilateral())\n+ 72 out << \"9\\n\";\n+ 73 else if (type.isTetrahedron())\n+ 74 out << \"10\\n\";\n+ 75 else\n+ 76 DUNE_THROW(Dune::Exception, \"Unhandled geometry type\");\n+ 77 }\n+ 78 }\n+ 79}\n+ 80\n+ 81} /* namespace AreaWriterImplementation */\n+ 82\n+ 83template\n+84void write_glue_area_vtk(const Glue& glue, std::ostream& out)\n+ 85{\n+ 86 using GridView = typename std::decay< decltype(glue.template gridView\n+()) >::type;\n+ 87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper;\n+ 88 using ctype = typename GridView::ctype;\n+ 89\n+ 90 const GridView gv = glue.template gridView();\n+ 91 Mapper mapper(gv);\n+ 92 std::vector coveredArea(mapper.size(), ctype(0));\n+ 93 std::vector totalArea(mapper.size(), ctype(1));\n+ 94\n+ 95 for (const auto& in : intersections(glue, Reverse())) {\n+ 96 const auto element = in.inside();\n+ 97 const auto index = mapper.subIndex(element, in.indexInInside(), 1);\n+ 98 coveredArea[index] += in.geometryInInside().volume();\n+ 99\n+ 100 const auto& refElement = Dune::ReferenceElements::general(element.type());\n+ 101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside\n+());\n+ 102 totalArea[index] = subGeometry.volume();\n+ 103 }\n+ 104\n+ 105 for (std::size_t i = 0; i < coveredArea.size(); ++i)\n+ 106 coveredArea[i] /= totalArea[i];\n+ 107\n+ 108 out << \"# vtk DataFile Version 2.0\\n\"\n+ 109 << \"Filename: Glue Area\\n\"\n+ 110 << \"ASCII\\n\";\n+ 111\n+ 112 AreaWriterImplementation::write_facet_geometry(gv, out);\n+ 113\n+ 114 out << \"CELL_DATA \" << coveredArea.size() << \"\\n\"\n+ 115 << \"SCALARS CoveredArea double 1\\n\"\n+ 116 << \"LOOKUP_TABLE default\\n\";\n+ 117 for (const auto& value : coveredArea)\n+ 118 out << value << \"\\n\";\n+ 119}\n+ 120\n+ 121template\n+122void write_glue_area_vtk(const Glue& glue, const std::string& filename)\n+ 123{\n+ 124 std::ofstream out(filename.c_str());\n+ 125 write_glue_area_vtk(glue, out);\n+ 126}\n+ 127\n+ 128template\n+129void write_glue_areas_vtk(const Glue& glue, const std::string& base)\n+ 130{\n+ 131 {\n+ 132 std::string filename = base;\n+ 133 filename += \"-inside.vtk\";\n+ 134 write_glue_area_vtk<0>(glue, filename);\n+ 135 }\n+ 136 {\n+ 137 std::string filename = base;\n+ 138 filename += \"-outside.vtk\";\n+ 139 write_glue_area_vtk<1>(glue, filename);\n+ 140 }\n+ 141}\n+ 142\n+ 143} /* namespace GridGlue */\n+ 144} /* namespace Dune */\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::crossProduct\n-static Dune::FieldVector< T, dim > crossProduct(const Dune::FieldVector< T, dim\n-> &a, const Dune::FieldVector< T, dim > &b)\n-compute cross product\n-Definition: crossproduct.hh:15\n+Dune::GridGlue::write_glue_area_vtk\n+void write_glue_area_vtk(const Glue &glue, std::ostream &out)\n+Definition: areawriter_impl.hh:84\n+Dune::GridGlue::write_glue_areas_vtk\n+void write_glue_areas_vtk(const Glue &glue, const std::string &base)\n+Definition: areawriter_impl.hh:129\n+Dune::GridGlue::intersections\n+IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<...\n+> &reverse=!reversed)\n+Iterate over all intersections of a GridGlue.\n+Dune::GridGlue::AreaWriterImplementation::write_facet_geometry\n+void write_facet_geometry(const GridView &gv, std::ostream &out)\n+Definition: areawriter_impl.hh:25\n+Dune::GridGlue::Reverse\n+Definition: rangegenerators.hh:17\n+Dune::GridGlue::AreaWriterImplementation::FacetLayout\n+Definition: areawriter_impl.hh:17\n+Dune::GridGlue::AreaWriterImplementation::FacetLayout::contains\n+bool contains(Dune::GeometryType gt) const\n+Definition: areawriter_impl.hh:18\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: areawriter.hh File Reference\n+dune-grid-glue: ringcomm.hh File Reference\n \n \n \n \n \n \n \n@@ -64,43 +64,77 @@\n \n \n \n
    \n \n-
    areawriter.hh File Reference
    \n+
    ringcomm.hh File Reference
    \n
    \n
    \n-
    #include <ostream>
    \n-#include <string>
    \n-#include "areawriter_impl.hh"
    \n+
    #include <mpi.h>
    \n+#include <functional>
    \n+#include <utility>
    \n+#include <dune/common/fvector.hh>
    \n+#include <dune/common/hybridutilities.hh>
    \n+#include <dune/geometry/type.hh>
    \n
    \n

    Go to the source code of this file.

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

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
    namespace  Dune::Parallel
     
    \n+\n+\n+\n+

    \n+Macros

    #define CheckMPIStatus(A, B)   {}
     
    \n \n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n+\n

    \n Functions

    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)
     
    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string &filename)
     
    template<typename Glue >
    void Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string &base)
     
    template<typename OP , typename... Args>
    void Dune::Parallel::MPI_AllApply (MPI_Comm mpicomm, OP &&op, const Args &... data)
     apply an operator locally to a difstributed data set More...
     
    \n+

    Macro Definition Documentation

    \n+\n+

    ◆ CheckMPIStatus

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    #define CheckMPIStatus( A,
     
    )   {}
    \n+
    \n+
    Todo:
    Implement MPI Status check with exception handling
    \n+\n+
    \n+
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,33 +5,40 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-Namespaces | Functions\n-areawriter.hh File Reference\n-#include \n-#include \n-#include \"areawriter_impl.hh\"\n+Namespaces | Macros | Functions\n+ringcomm.hh File Reference\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\n-namespace \u00a0Dune::GridGlue\n+namespace \u00a0Dune::Parallel\n \u00a0\n- Functions\n-template\n-void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string\n- &filename)\n+ Macros\n+#define\u00a0CheckMPIStatus(A, B)\u00a0\u00a0\u00a0{}\n \u00a0\n-template\n-void\u00a0Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string\n- &base)\n+ Functions\n+template\n+void\u00a0Dune::Parallel::MPI_AllApply (MPI_Comm mpicomm, OP &&op, const Args &...\n+ data)\n+\u00a0 apply an operator locally to a difstributed data set More...\n \u00a0\n+***** Macro Definition Documentation *****\n+***** \u25c6\u00a0CheckMPIStatus *****\n+#define CheckMPIStatus ( \u00a0A,\n+ \u00a0B\u00a0\n+ ) \u00a0\u00a0\u00a0{}\n+ Todo:\n+ Implement MPI Status check with exception handling\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: areawriter.hh Source File\n+dune-grid-glue: ringcomm.hh Source File\n \n \n \n \n \n \n \n@@ -62,47 +62,305 @@\n \n \n
    \n
    \n-
    areawriter.hh
    \n+
    ringcomm.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n-
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    3#ifndef DUNE_GRIDGLUE_COMMON_AREAWRITER_HH
    \n-
    4#define DUNE_GRIDGLUE_COMMON_AREAWRITER_HH
    \n-
    5
    \n-
    6#include <ostream>
    \n-
    7#include <string>
    \n-
    8
    \n-
    9namespace Dune {
    \n-
    10namespace GridGlue {
    \n-
    11
    \n-
    12template<int side, typename Glue>
    \n-
    13void write_glue_area_vtk(const Glue& glue, std::ostream& out);
    \n-
    14
    \n-
    15template<int side, typename Glue>
    \n-
    16void write_glue_area_vtk(const Glue& glue, const std::string& filename);
    \n-
    17
    \n-
    37template<typename Glue>
    \n-
    38void write_glue_areas_vtk(const Glue& glue, const std::string& base);
    \n-
    39
    \n-
    40} /* namespace GridGlue */
    \n-
    41} /* namespace Dune */
    \n-
    42
    \n-
    43#include "areawriter_impl.hh"
    \n-
    44
    \n-
    45#endif
    \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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n+
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n+
    5/* IMPLEMENTATION OF CLASS G R I D G L U E */
    \n+
    6
    \n+
    8#define CheckMPIStatus(A,B) {}
    \n+
    9
    \n+
    10#include <mpi.h>
    \n+
    11#include <functional>
    \n+
    12#include <utility>
    \n+
    13
    \n+
    14#include <dune/common/fvector.hh>
    \n+
    15#include <dune/common/hybridutilities.hh>
    \n+
    16
    \n+
    17#include <dune/geometry/type.hh>
    \n+
    18
    \n+
    19namespace Dune {
    \n+
    20namespace Parallel {
    \n+
    21
    \n+
    22 namespace Impl {
    \n+
    23
    \n+
    25 template<typename T>
    \n+
    26 struct MPITypeInfo {};
    \n+
    27
    \n+
    28 template<>
    \n+
    29 struct MPITypeInfo< int >
    \n+
    30 {
    \n+
    31 static const unsigned int size = 1;
    \n+
    32 static inline MPI_Datatype getType()
    \n+
    33 {
    \n+
    34 return MPI_INT;
    \n+
    35 }
    \n+
    36 };
    \n+
    37
    \n+
    38 template<typename K, int N>
    \n+
    39 struct MPITypeInfo< Dune::FieldVector<K,N> >
    \n+
    40 {
    \n+
    41 static const unsigned int size = N;
    \n+
    42 static inline MPI_Datatype getType()
    \n+
    43 {
    \n+
    44 return Dune::MPITraits<K>::getType();
    \n+
    45 }
    \n+
    46 };
    \n+
    47
    \n+
    48 template<>
    \n+
    49 struct MPITypeInfo< unsigned int >
    \n+
    50 {
    \n+
    51 static const unsigned int size = 1;
    \n+
    52 static inline MPI_Datatype getType()
    \n+
    53 {
    \n+
    54 return MPI_UNSIGNED;
    \n+
    55 }
    \n+
    56 };
    \n+
    57
    \n+
    58 template<>
    \n+
    59 struct MPITypeInfo< Dune::GeometryType >
    \n+
    60 {
    \n+
    61 static const unsigned int size = 1;
    \n+
    62 static inline MPI_Datatype getType()
    \n+
    63 {
    \n+
    64 return Dune::MPITraits< Dune::GeometryType >::getType();
    \n+
    65 }
    \n+
    66 };
    \n+
    67
    \n+
    68 template<typename T>
    \n+
    69 void MPI_SetVectorSize(
    \n+
    70 std::vector<T> & data,
    \n+
    71 MPI_Status & status)
    \n+
    72 {
    \n+
    73 typedef MPITypeInfo<T> Info;
    \n+
    74 int sz;
    \n+
    75 MPI_Get_count(&status, Info::getType(), &sz);
    \n+
    76 assert(sz%Info::size == 0);
    \n+
    77 data.resize(sz/Info::size);
    \n+
    78 }
    \n+
    79
    \n+
    89 template<typename T>
    \n+
    90 void MPI_SendVectorInRing(
    \n+
    91 std::vector<T> & data,
    \n+
    92 std::vector<T> & next,
    \n+
    93 int tag,
    \n+
    94 int rightrank,
    \n+
    95 int leftrank,
    \n+
    96 MPI_Comm comm,
    \n+
    97 MPI_Request& r_send,
    \n+
    98 MPI_Request& r_recv
    \n+
    99 )
    \n+
    100 {
    \n+
    101 // mpi status stuff
    \n+
    102 [[maybe_unused]] int result = 0;
    \n+
    103 typedef MPITypeInfo<T> Info;
    \n+
    104 // resize next buffer to maximum size
    \n+
    105 next.resize(next.capacity());
    \n+
    106 // send data (explicitly send data.size elements)
    \n+
    107 result =
    \n+
    108 MPI_Isend(
    \n+
    109 &(data[0]), Info::size*data.size(), Info::getType(), rightrank, tag,
    \n+
    110 comm, &r_send);
    \n+
    111 // receive up to maximum size. The acutal size is stored in the status
    \n+
    112 result =
    \n+
    113 MPI_Irecv(
    \n+
    114 &(next[0]), Info::size*next.size(), Info::getType(), leftrank, tag,
    \n+
    115 comm, &r_recv);
    \n+
    116 // // check result
    \n+
    117 // MPI_Status status;
    \n+
    118 // CheckMPIStatus(result, status);
    \n+
    119 }
    \n+
    120
    \n+
    121 template<typename T>
    \n+
    122 using ptr_t = T*;
    \n+
    123
    \n+
    124 /* these helper structs are needed as long as we still support
    \n+
    125 C++11, as we can't use variadic lambdas */
    \n+
    126 template<typename... Args>
    \n+
    127 struct call_MPI_SendVectorInRing
    \n+
    128 {
    \n+
    129 std::tuple<Args...> & remotedata;
    \n+
    130 std::tuple<Args...> & nextdata;
    \n+
    131 int & tag;
    \n+
    132 int & rightrank;
    \n+
    133 int & leftrank;
    \n+
    134 MPI_Comm & mpicomm;
    \n+
    135 std::array<MPI_Request,sizeof...(Args)> & requests_send;
    \n+
    136 std::array<MPI_Request,sizeof...(Args)> & requests_recv;
    \n+
    137
    \n+
    138 template<typename I>
    \n+
    139 void operator()(I i)
    \n+
    140 {
    \n+
    141 MPI_SendVectorInRing(
    \n+
    142 std::get<i>(remotedata),
    \n+
    143 std::get<i>(nextdata),
    \n+
    144 tag+i,
    \n+
    145 rightrank, leftrank, mpicomm,
    \n+
    146 requests_send[i],
    \n+
    147 requests_recv[i]);
    \n+
    148 }
    \n+
    149 };
    \n+
    150 template<typename... Args>
    \n+
    151 struct call_MPI_SetVectorSize
    \n+
    152 {
    \n+
    153 std::tuple<Args...> & nextdata;
    \n+
    154 std::array<MPI_Status,sizeof...(Args)> & status_recv;
    \n+
    155
    \n+
    156 template<typename I>
    \n+
    157 void operator()(I i)
    \n+
    158 {
    \n+
    159 MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
    \n+
    160 }
    \n+
    161 };
    \n+
    162
    \n+
    163 template<typename OP, std::size_t... Indices, typename... Args>
    \n+
    164 void MPI_AllApply_impl(MPI_Comm mpicomm,
    \n+
    165 OP && op,
    \n+
    166 std::index_sequence<Indices...> indices,
    \n+
    167 const Args&... data)
    \n+
    168 {
    \n+
    169 constexpr std::size_t N = sizeof...(Args);
    \n+
    170 int myrank = 0;
    \n+
    171 int commsize = 0;
    \n+
    172#if HAVE_MPI
    \n+
    173 MPI_Comm_rank(mpicomm, &myrank);
    \n+
    174 MPI_Comm_size(mpicomm, &commsize);
    \n+
    175#endif // HAVE_MPI
    \n+
    176
    \n+
    177 if (commsize > 1)
    \n+
    178 {
    \n+
    179#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
    \n+
    180 std::cout << myrank << " Start Communication, size " << commsize << std::endl;
    \n+
    181#endif
    \n+
    182
    \n+
    183 // get data sizes
    \n+
    184 std::array<unsigned int, N> size({ ((unsigned int)data.size())... });
    \n+
    185
    \n+
    186 // communicate max data size
    \n+
    187 std::array<unsigned int, N> maxSize;
    \n+
    188 MPI_Allreduce(&size, &maxSize,
    \n+
    189 size.size(), MPI_UNSIGNED, MPI_MAX, mpicomm);
    \n+
    190#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
    \n+
    191 std::cout << myrank << " maxSize " << "done... " << std::endl;
    \n+
    192#endif
    \n+
    193
    \n+
    194 // allocate receiving buffers with maxsize to ensure sufficient buffer size for communication
    \n+
    195 std::tuple<Args...> remotedata { Args(maxSize[Indices])... };
    \n+
    196
    \n+
    197 // copy local data to receiving buffer
    \n+
    198 remotedata = std::tie(data...);
    \n+
    199
    \n+
    200 // allocate second set of receiving buffers necessary for async communication
    \n+
    201 std::tuple<Args...> nextdata { Args(maxSize[Indices])... };
    \n+
    202
    \n+
    203 // communicate data in the ring
    \n+
    204 int rightrank = (myrank + 1 + commsize) % commsize;
    \n+
    205 int leftrank = (myrank - 1 + commsize) % commsize;
    \n+
    206
    \n+
    207 std::cout << myrank << ": size = " << commsize << std::endl;
    \n+
    208 std::cout << myrank << ": left = " << leftrank
    \n+
    209 << " right = " << rightrank << std::endl;
    \n+
    210
    \n+
    211 // currently the remote data is our own data
    \n+
    212 int remoterank = myrank;
    \n+
    213
    \n+
    214 for (int i=1; i<commsize; i++)
    \n+
    215 {
    \n+
    216 // in this iteration we will receive data from nextrank
    \n+
    217 int nextrank = (myrank - i + commsize) % commsize;
    \n+
    218
    \n+
    219 std::cout << myrank << ": next = " << nextrank << std::endl;
    \n+
    220
    \n+
    221 // send remote data to right neighbor and receive from left neighbor
    \n+
    222 std::array<MPI_Request,N> requests_send;
    \n+
    223 std::array<MPI_Request,N> requests_recv;
    \n+
    224
    \n+
    225 int tag = 0;
    \n+
    226 Dune::Hybrid::forEach(indices,
    \n+
    227 // [&](auto i){
    \n+
    228 // MPI_SendVectorInRing(
    \n+
    229 // std::get<i>(remotedata),
    \n+
    230 // std::get<i>(nextdata),
    \n+
    231 // tag+i,
    \n+
    232 // rightrank, leftrank, mpicomm,
    \n+
    233 // requests_send[i],
    \n+
    234 // requests_recv[i]);
    \n+
    235 // });
    \n+
    236 call_MPI_SendVectorInRing<Args...>({
    \n+
    237 remotedata,
    \n+
    238 nextdata,
    \n+
    239 tag,
    \n+
    240 rightrank, leftrank, mpicomm,
    \n+
    241 requests_send,
    \n+
    242 requests_recv
    \n+
    243 }));
    \n+
    244
    \n+
    245 // apply operator
    \n+
    246 op(remoterank,std::get<Indices>(remotedata)...);
    \n+
    247
    \n+
    248 // wait for communication to finalize
    \n+
    249 std::array<MPI_Status,N> status_send;
    \n+
    250 std::array<MPI_Status,N> status_recv;
    \n+
    251 MPI_Waitall(N,&requests_recv[0],&status_recv[0]);
    \n+
    252
    \n+
    253 // we finished receiving from nextrank and thus remoterank = nextrank
    \n+
    254 remoterank = nextrank;
    \n+
    255
    \n+
    256 // get current data sizes
    \n+
    257 // and resize vectors
    \n+
    258 Dune::Hybrid::forEach(indices,
    \n+
    259 // [&](auto i){
    \n+
    260 // MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
    \n+
    261 // });
    \n+
    262 call_MPI_SetVectorSize<Args...>({
    \n+
    263 nextdata, status_recv
    \n+
    264 }));
    \n+
    265
    \n+
    266 MPI_Waitall(N,&requests_send[0],&status_send[0]);
    \n+
    267
    \n+
    268 // swap the communication buffers
    \n+
    269 std::swap(remotedata,nextdata);
    \n+
    270 }
    \n+
    271
    \n+
    272 // last apply (or the only one in the case of sequential application)
    \n+
    273 op(remoterank,std::get<Indices>(remotedata)...);
    \n+
    274 }
    \n+
    275 else // sequential
    \n+
    276 {
    \n+
    277 op(myrank,data...);
    \n+
    278 }
    \n+
    279 }
    \n+
    280
    \n+
    281 } // end namespace Impl
    \n+
    282
    \n+
    296template<typename OP, typename... Args>
    \n+
    297void MPI_AllApply(MPI_Comm mpicomm,
    \n+
    298 OP && op,
    \n+
    299 const Args& ... data)
    \n+
    300{
    \n+
    301 Impl::MPI_AllApply_impl(
    \n+
    302 mpicomm,
    \n+
    303 std::forward<OP>(op),
    \n+
    304 std::make_index_sequence<sizeof...(Args)>(),
    \n+
    305 data...
    \n+
    306 );
    \n+
    307}
    \n+
    308
    \n+
    309} // end namespace Parallel
    \n+
    310} // end namespace Dune
    \n
    Definition: gridglue.hh:37
    \n-
    void write_glue_area_vtk(const Glue &glue, std::ostream &out)
    Definition: areawriter_impl.hh:84
    \n-
    void write_glue_areas_vtk(const Glue &glue, const std::string &base)
    Definition: areawriter_impl.hh:129
    \n+
    void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data)
    apply an operator locally to a difstributed data set
    Definition: ringcomm.hh:297
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,49 +5,309 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-areawriter.hh\n+ringcomm.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright \u00a9 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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n+ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#ifndef DUNE_GRIDGLUE_COMMON_AREAWRITER_HH\n- 4#define DUNE_GRIDGLUE_COMMON_AREAWRITER_HH\n- 5\n- 6#include \n- 7#include \n- 8\n- 9namespace Dune {\n- 10namespace GridGlue {\n- 11\n- 12template\n- 13void write_glue_area_vtk(const Glue& glue, std::ostream& out);\n- 14\n- 15template\n- 16void write_glue_area_vtk(const Glue& glue, const std::string& filename);\n- 17\n- 37template\n- 38void write_glue_areas_vtk(const Glue& glue, const std::string& base);\n- 39\n- 40} /* namespace GridGlue */\n- 41} /* namespace Dune */\n- 42\n- 43#include \"areawriter_impl.hh\"\n- 44\n- 45#endif\n-areawriter_impl.hh\n+ 5/* IMPLEMENTATION OF CLASS G R I D G L U E */\n+ 6\n+8#define CheckMPIStatus(A,B) {}\n+ 9\n+ 10#include \n+ 11#include \n+ 12#include \n+ 13\n+ 14#include \n+ 15#include \n+ 16\n+ 17#include \n+ 18\n+ 19namespace Dune {\n+20namespace Parallel {\n+ 21\n+ 22 namespace Impl {\n+ 23\n+ 25 template\n+ 26 struct MPITypeInfo {};\n+ 27\n+ 28 template<>\n+ 29 struct MPITypeInfo< int >\n+ 30 {\n+ 31 static const unsigned int size = 1;\n+ 32 static inline MPI_Datatype getType()\n+ 33 {\n+ 34 return MPI_INT;\n+ 35 }\n+ 36 };\n+ 37\n+ 38 template\n+ 39 struct MPITypeInfo< Dune::FieldVector >\n+ 40 {\n+ 41 static const unsigned int size = N;\n+ 42 static inline MPI_Datatype getType()\n+ 43 {\n+ 44 return Dune::MPITraits::getType();\n+ 45 }\n+ 46 };\n+ 47\n+ 48 template<>\n+ 49 struct MPITypeInfo< unsigned int >\n+ 50 {\n+ 51 static const unsigned int size = 1;\n+ 52 static inline MPI_Datatype getType()\n+ 53 {\n+ 54 return MPI_UNSIGNED;\n+ 55 }\n+ 56 };\n+ 57\n+ 58 template<>\n+ 59 struct MPITypeInfo< Dune::GeometryType >\n+ 60 {\n+ 61 static const unsigned int size = 1;\n+ 62 static inline MPI_Datatype getType()\n+ 63 {\n+ 64 return Dune::MPITraits< Dune::GeometryType >::getType();\n+ 65 }\n+ 66 };\n+ 67\n+ 68 template\n+ 69 void MPI_SetVectorSize(\n+ 70 std::vector & data,\n+ 71 MPI_Status & status)\n+ 72 {\n+ 73 typedef MPITypeInfo Info;\n+ 74 int sz;\n+ 75 MPI_Get_count(&status, Info::getType(), &sz);\n+ 76 assert(sz%Info::size == 0);\n+ 77 data.resize(sz/Info::size);\n+ 78 }\n+ 79\n+ 89 template\n+ 90 void MPI_SendVectorInRing(\n+ 91 std::vector & data,\n+ 92 std::vector & next,\n+ 93 int tag,\n+ 94 int rightrank,\n+ 95 int leftrank,\n+ 96 MPI_Comm comm,\n+ 97 MPI_Request& r_send,\n+ 98 MPI_Request& r_recv\n+ 99 )\n+ 100 {\n+ 101 // mpi status stuff\n+ 102 [[maybe_unused]] int result = 0;\n+ 103 typedef MPITypeInfo Info;\n+ 104 // resize next buffer to maximum size\n+ 105 next.resize(next.capacity());\n+ 106 // send data (explicitly send data.size elements)\n+ 107 result =\n+ 108 MPI_Isend(\n+ 109 &(data[0]), Info::size*data.size(), Info::getType(), rightrank, tag,\n+ 110 comm, &r_send);\n+ 111 // receive up to maximum size. The acutal size is stored in the status\n+ 112 result =\n+ 113 MPI_Irecv(\n+ 114 &(next[0]), Info::size*next.size(), Info::getType(), leftrank, tag,\n+ 115 comm, &r_recv);\n+ 116 // // check result\n+ 117 // MPI_Status status;\n+ 118 // CheckMPIStatus(result, status);\n+ 119 }\n+ 120\n+ 121 template\n+ 122 using ptr_t = T*;\n+ 123\n+ 124 /* these helper structs are needed as long as we still support\n+ 125 C++11, as we can't use variadic lambdas */\n+ 126 template\n+ 127 struct call_MPI_SendVectorInRing\n+ 128 {\n+ 129 std::tuple & remotedata;\n+ 130 std::tuple & nextdata;\n+ 131 int & tag;\n+ 132 int & rightrank;\n+ 133 int & leftrank;\n+ 134 MPI_Comm & mpicomm;\n+ 135 std::array & requests_send;\n+ 136 std::array & requests_recv;\n+ 137\n+ 138 template\n+ 139 void operator()(I i)\n+ 140 {\n+ 141 MPI_SendVectorInRing(\n+ 142 std::get(remotedata),\n+ 143 std::get(nextdata),\n+ 144 tag+i,\n+ 145 rightrank, leftrank, mpicomm,\n+ 146 requests_send[i],\n+ 147 requests_recv[i]);\n+ 148 }\n+ 149 };\n+ 150 template\n+ 151 struct call_MPI_SetVectorSize\n+ 152 {\n+ 153 std::tuple & nextdata;\n+ 154 std::array & status_recv;\n+ 155\n+ 156 template\n+ 157 void operator()(I i)\n+ 158 {\n+ 159 MPI_SetVectorSize(std::get(nextdata),status_recv[i]);\n+ 160 }\n+ 161 };\n+ 162\n+ 163 template\n+ 164 void MPI_AllApply_impl(MPI_Comm mpicomm,\n+ 165 OP && op,\n+ 166 std::index_sequence indices,\n+ 167 const Args&... data)\n+ 168 {\n+ 169 constexpr std::size_t N = sizeof...(Args);\n+ 170 int myrank = 0;\n+ 171 int commsize = 0;\n+ 172#if HAVE_MPI\n+ 173 MPI_Comm_rank(mpicomm, &myrank);\n+ 174 MPI_Comm_size(mpicomm, &commsize);\n+ 175#endif // HAVE_MPI\n+ 176\n+ 177 if (commsize > 1)\n+ 178 {\n+ 179#ifdef DEBUG_GRIDGLUE_PARALLELMERGE\n+ 180 std::cout << myrank << \" Start Communication, size \" << commsize << std::\n+endl;\n+ 181#endif\n+ 182\n+ 183 // get data sizes\n+ 184 std::array size({ ((unsigned int)data.size())... });\n+ 185\n+ 186 // communicate max data size\n+ 187 std::array maxSize;\n+ 188 MPI_Allreduce(&size, &maxSize,\n+ 189 size.size(), MPI_UNSIGNED, MPI_MAX, mpicomm);\n+ 190#ifdef DEBUG_GRIDGLUE_PARALLELMERGE\n+ 191 std::cout << myrank << \" maxSize \" << \"done... \" << std::endl;\n+ 192#endif\n+ 193\n+ 194 // allocate receiving buffers with maxsize to ensure sufficient buffer\n+size for communication\n+ 195 std::tuple remotedata { Args(maxSize[Indices])... };\n+ 196\n+ 197 // copy local data to receiving buffer\n+ 198 remotedata = std::tie(data...);\n+ 199\n+ 200 // allocate second set of receiving buffers necessary for async\n+communication\n+ 201 std::tuple nextdata { Args(maxSize[Indices])... };\n+ 202\n+ 203 // communicate data in the ring\n+ 204 int rightrank = (myrank + 1 + commsize) % commsize;\n+ 205 int leftrank = (myrank - 1 + commsize) % commsize;\n+ 206\n+ 207 std::cout << myrank << \": size = \" << commsize << std::endl;\n+ 208 std::cout << myrank << \": left = \" << leftrank\n+ 209 << \" right = \" << rightrank << std::endl;\n+ 210\n+ 211 // currently the remote data is our own data\n+ 212 int remoterank = myrank;\n+ 213\n+ 214 for (int i=1; i requests_send;\n+ 223 std::array requests_recv;\n+ 224\n+ 225 int tag = 0;\n+ 226 Dune::Hybrid::forEach(indices,\n+ 227 // [&](auto i){\n+ 228 // MPI_SendVectorInRing(\n+ 229 // std::get(remotedata),\n+ 230 // std::get(nextdata),\n+ 231 // tag+i,\n+ 232 // rightrank, leftrank, mpicomm,\n+ 233 // requests_send[i],\n+ 234 // requests_recv[i]);\n+ 235 // });\n+ 236 call_MPI_SendVectorInRing({\n+ 237 remotedata,\n+ 238 nextdata,\n+ 239 tag,\n+ 240 rightrank, leftrank, mpicomm,\n+ 241 requests_send,\n+ 242 requests_recv\n+ 243 }));\n+ 244\n+ 245 // apply operator\n+ 246 op(remoterank,std::get(remotedata)...);\n+ 247\n+ 248 // wait for communication to finalize\n+ 249 std::array status_send;\n+ 250 std::array status_recv;\n+ 251 MPI_Waitall(N,&requests_recv[0],&status_recv[0]);\n+ 252\n+ 253 // we finished receiving from nextrank and thus remoterank = nextrank\n+ 254 remoterank = nextrank;\n+ 255\n+ 256 // get current data sizes\n+ 257 // and resize vectors\n+ 258 Dune::Hybrid::forEach(indices,\n+ 259 // [&](auto i){\n+ 260 // MPI_SetVectorSize(std::get(nextdata),status_recv[i]);\n+ 261 // });\n+ 262 call_MPI_SetVectorSize({\n+ 263 nextdata, status_recv\n+ 264 }));\n+ 265\n+ 266 MPI_Waitall(N,&requests_send[0],&status_send[0]);\n+ 267\n+ 268 // swap the communication buffers\n+ 269 std::swap(remotedata,nextdata);\n+ 270 }\n+ 271\n+ 272 // last apply (or the only one in the case of sequential application)\n+ 273 op(remoterank,std::get(remotedata)...);\n+ 274 }\n+ 275 else // sequential\n+ 276 {\n+ 277 op(myrank,data...);\n+ 278 }\n+ 279 }\n+ 280\n+ 281 } // end namespace Impl\n+ 282\n+ 296template\n+297void MPI_AllApply(MPI_Comm mpicomm,\n+ 298 OP && op,\n+ 299 const Args& ... data)\n+ 300{\n+ 301 Impl::MPI_AllApply_impl(\n+ 302 mpicomm,\n+ 303 std::forward(op),\n+ 304 std::make_index_sequence(),\n+ 305 data...\n+ 306 );\n+ 307}\n+ 308\n+ 309} // end namespace Parallel\n+ 310} // end namespace Dune\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::write_glue_area_vtk\n-void write_glue_area_vtk(const Glue &glue, std::ostream &out)\n-Definition: areawriter_impl.hh:84\n-Dune::GridGlue::write_glue_areas_vtk\n-void write_glue_areas_vtk(const Glue &glue, const std::string &base)\n-Definition: areawriter_impl.hh:129\n+Dune::Parallel::MPI_AllApply\n+void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data)\n+apply an operator locally to a difstributed data set\n+Definition: ringcomm.hh:297\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: areawriter_impl.hh File Reference\n+dune-grid-glue: projection_impl.hh File Reference\n \n \n \n \n \n \n \n@@ -63,56 +63,49 @@\n \n
    \n
    \n \n-
    areawriter_impl.hh File Reference
    \n+
    projection_impl.hh File Reference
    \n
    \n
    \n-
    #include <fstream>
    \n-#include <vector>
    \n-#include <dune/common/fvector.hh>
    \n-#include <dune/geometry/type.hh>
    \n-#include <dune/grid/common/mcmgmapper.hh>
    \n+
    #include <dune/common/fmatrix.hh>
    \n+#include <cmath>
    \n
    \n

    Go to the source code of this file.

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

    \n-Classes

    struct  Dune::GridGlue::AreaWriterImplementation::FacetLayout< dimgrid >
     
    \n \n \n \n \n \n-\n+\n \n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    namespace  Dune::GridGlue::AreaWriterImplementation
    namespace  Dune::GridGlue::ProjectionImplementation
     
    \n \n-\n-\n-\n-\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 GridView >
    void Dune::GridGlue::AreaWriterImplementation::write_facet_geometry (const GridView &gv, std::ostream &out)
     
    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)
     
    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string &filename)
     
    template<typename Glue >
    void Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string &base)
     
    template<typename Coordinate , typename Field >
    Coordinate Dune::GridGlue::ProjectionImplementation::corner (unsigned c)
     
    std::pair< unsigned, unsigned > Dune::GridGlue::ProjectionImplementation::edgeToCorners (unsigned edge)
     
    template<typename Coordinate , typename Corners >
    Corners::value_type Dune::GridGlue::ProjectionImplementation::interpolate (const Coordinate &x, const Corners &corners)
     
    template<typename Coordinate , typename Normals >
    Normals::value_type Dune::GridGlue::ProjectionImplementation::interpolate_unit_normals (const Coordinate &x, const Normals &normals)
     
    template<typename Coordinate , typename Field >
    bool Dune::GridGlue::ProjectionImplementation::inside (const Coordinate &x, const Field &epsilon)
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,44 +5,45 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-Classes | Namespaces | Functions\n-areawriter_impl.hh File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n+Namespaces | Functions\n+projection_impl.hh File Reference\n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n- Classes\n-struct \u00a0Dune::GridGlue::AreaWriterImplementation::FacetLayout<_dimgrid_>\n-\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n-namespace \u00a0Dune::GridGlue::AreaWriterImplementation\n+namespace \u00a0Dune::GridGlue::ProjectionImplementation\n \u00a0\n Functions\n-template\n-void\u00a0Dune::GridGlue::AreaWriterImplementation::write_facet_geometry (const\n- GridView &gv, std::ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string\n- &filename)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string\n- &base)\n+template\n+ Coordinate\u00a0Dune::GridGlue::ProjectionImplementation::\n+ corner (unsigned c)\n+\u00a0\n+std::pair< unsigned, unsigned >\u00a0Dune::GridGlue::ProjectionImplementation::\n+ edgeToCorners (unsigned edge)\n+\u00a0\n+template\n+ Corners::value_type\u00a0Dune::GridGlue::ProjectionImplementation::\n+ interpolate (const Coordinate &x, const\n+ Corners &corners)\n+\u00a0\n+template\n+ Normals::value_type\u00a0Dune::GridGlue::ProjectionImplementation::\n+ interpolate_unit_normals (const Coordinate &x,\n+ const Normals &normals)\n+\u00a0\n+template\n+ bool\u00a0Dune::GridGlue::ProjectionImplementation::\n+ inside (const Coordinate &x, const Field\n+ &epsilon)\n \u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: areawriter_impl.hh Source File\n+dune-grid-glue: projection_impl.hh Source File\n \n \n \n \n \n \n \n@@ -62,169 +62,449 @@\n \n \n
    \n
    \n-
    areawriter_impl.hh
    \n+
    projection_impl.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    3#include <fstream>
    \n-
    4#include <vector>
    \n-
    5
    \n-
    6#include <dune/common/fvector.hh>
    \n-
    7#include <dune/geometry/type.hh>
    \n-
    8#include <dune/grid/common/mcmgmapper.hh>
    \n+
    3#include <dune/common/fmatrix.hh>
    \n+
    4
    \n+
    5#include <cmath>
    \n+
    6
    \n+
    7namespace Dune {
    \n+
    8namespace GridGlue {
    \n
    9
    \n-
    10namespace Dune {
    \n-
    11namespace GridGlue {
    \n-
    12
    \n-
    13namespace AreaWriterImplementation {
    \n-
    14
    \n-
    15template<int dimgrid>
    \n-\n-
    17{
    \n-
    18 bool contains(Dune::GeometryType gt) const
    \n-
    19 {
    \n-
    20 return gt.dim() == dimgrid - 1;
    \n-
    21 }
    \n-
    22};
    \n-
    23
    \n-
    24template<typename GridView>
    \n-
    25void write_facet_geometry(const GridView& gv, std::ostream& out)
    \n-
    26{
    \n-
    27 using Coordinate = Dune::FieldVector<double, 3>;
    \n-
    28
    \n-
    29 std::vector<Coordinate> corners;
    \n-
    30 for (const auto& facet : facets(gv)) {
    \n-
    31 const auto geometry = facet.geometry();
    \n-
    32 for (int i = 0; i < geometry.corners(); ++i) {
    \n-
    33 /* VTK always needs 3-dim coordinates... */
    \n-
    34 const auto c0 = geometry.corner(i);
    \n-
    35 Coordinate c1;
    \n-
    36 for (int d = 0; d < GridView::dimensionworld; ++d)
    \n-
    37 c1[d] = c0[d];
    \n-
    38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d)
    \n-
    39 c1[d] = double(0);
    \n-
    40 corners.push_back(c1);
    \n-
    41 }
    \n-
    42 }
    \n-
    43
    \n-
    44 {
    \n-
    45 out << "DATASET UNSTRUCTURED_GRID\\n"
    \n-
    46 << "POINTS " << corners.size() << " double\\n";
    \n-
    47 for (const auto& c : corners)
    \n-
    48 out << c << "\\n";
    \n+
    10namespace ProjectionImplementation {
    \n+
    11
    \n+
    22template<typename Coordinate, typename Field>
    \n+
    23inline Coordinate
    \n+
    24corner(unsigned c)
    \n+
    25{
    \n+
    26 Coordinate x(Field(0));
    \n+
    27 if (c == 0)
    \n+
    28 return x;
    \n+
    29 x[c-1] = Field(1);
    \n+
    30 return x;
    \n+
    31}
    \n+
    32
    \n+
    42inline std::pair<unsigned, unsigned>
    \n+
    43edgeToCorners(unsigned edge)
    \n+
    44{
    \n+
    45 switch(edge) {
    \n+
    46 case 0: return {0, 1};
    \n+
    47 case 1: return {0, 2};
    \n+
    48 case 2: return {1, 2};
    \n
    49 }
    \n-
    50 {
    \n-
    51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << "\\n";
    \n-
    52 std::size_t c = 0;
    \n-
    53 for (const auto& facet : facets(gv)) {
    \n-
    54 const auto geometry = facet.geometry();
    \n-
    55 out << geometry.corners();
    \n-
    56 for (int i = 0; i < geometry.corners(); ++i, ++c)
    \n-
    57 out << " " << c;
    \n-
    58 out << "\\n";
    \n-
    59 }
    \n-
    60 }
    \n-
    61 {
    \n-
    62 out << "CELL_TYPES " << gv.size(1) << "\\n";
    \n-
    63 for (const auto& facet : facets(gv)) {
    \n-
    64 const auto type = facet.type();
    \n-
    65 if (type.isVertex())
    \n-
    66 out << "1\\n";
    \n-
    67 else if (type.isLine())
    \n-
    68 out << "2\\n";
    \n-
    69 else if (type.isTriangle())
    \n-
    70 out << "5\\n";
    \n-
    71 else if (type.isQuadrilateral())
    \n-
    72 out << "9\\n";
    \n-
    73 else if (type.isTetrahedron())
    \n-
    74 out << "10\\n";
    \n-
    75 else
    \n-
    76 DUNE_THROW(Dune::Exception, "Unhandled geometry type");
    \n-
    77 }
    \n-
    78 }
    \n-
    79}
    \n-
    80
    \n-
    81} /* namespace AreaWriterImplementation */
    \n-
    82
    \n-
    83template<int side, typename Glue>
    \n-
    84void write_glue_area_vtk(const Glue& glue, std::ostream& out)
    \n-
    85{
    \n-
    86 using GridView = typename std::decay< decltype(glue.template gridView<side>()) >::type;
    \n-
    87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, AreaWriterImplementation::FacetLayout>;
    \n-
    88 using ctype = typename GridView::ctype;
    \n-
    89
    \n-
    90 const GridView gv = glue.template gridView<side>();
    \n-
    91 Mapper mapper(gv);
    \n-
    92 std::vector<ctype> coveredArea(mapper.size(), ctype(0));
    \n-
    93 std::vector<ctype> totalArea(mapper.size(), ctype(1));
    \n-
    94
    \n-
    95 for (const auto& in : intersections(glue, Reverse<side == 1>())) {
    \n-
    96 const auto element = in.inside();
    \n-
    97 const auto index = mapper.subIndex(element, in.indexInInside(), 1);
    \n-
    98 coveredArea[index] += in.geometryInInside().volume();
    \n-
    99
    \n-
    100 const auto& refElement = Dune::ReferenceElements<ctype, GridView::dimension>::general(element.type());
    \n-
    101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside());
    \n-
    102 totalArea[index] = subGeometry.volume();
    \n-
    103 }
    \n-
    104
    \n-
    105 for (std::size_t i = 0; i < coveredArea.size(); ++i)
    \n-
    106 coveredArea[i] /= totalArea[i];
    \n-
    107
    \n-
    108 out << "# vtk DataFile Version 2.0\\n"
    \n-
    109 << "Filename: Glue Area\\n"
    \n-
    110 << "ASCII\\n";
    \n-
    111
    \n-\n-
    113
    \n-
    114 out << "CELL_DATA " << coveredArea.size() << "\\n"
    \n-
    115 << "SCALARS CoveredArea double 1\\n"
    \n-
    116 << "LOOKUP_TABLE default\\n";
    \n-
    117 for (const auto& value : coveredArea)
    \n-
    118 out << value << "\\n";
    \n-
    119}
    \n-
    120
    \n-
    121template<int side, typename Glue>
    \n-
    122void write_glue_area_vtk(const Glue& glue, const std::string& filename)
    \n-
    123{
    \n-
    124 std::ofstream out(filename.c_str());
    \n-
    125 write_glue_area_vtk<side>(glue, out);
    \n-
    126}
    \n+
    50 DUNE_THROW(Dune::Exception, "Unexpected edge number.");
    \n+
    51}
    \n+
    52
    \n+
    68template<typename Coordinate, typename Corners>
    \n+
    69inline typename Corners::value_type
    \n+
    70interpolate(const Coordinate& x, const Corners& corners)
    \n+
    71{
    \n+
    72 auto y = corners[0];
    \n+
    73 for (unsigned i = 0; i < corners.size() - 1; ++i)
    \n+
    74 y.axpy(x[i], corners[i+1] - corners[0]);
    \n+
    75 return y;
    \n+
    76}
    \n+
    77
    \n+
    89template<typename Coordinate, typename Normals>
    \n+
    90inline typename Normals::value_type
    \n+
    91interpolate_unit_normals(const Coordinate& x, const Normals& normals)
    \n+
    92{
    \n+
    93 auto n = interpolate(x, normals);
    \n+
    94 n /= n.two_norm();
    \n+
    95 return n;
    \n+
    96}
    \n+
    97
    \n+
    109template<typename Coordinate, typename Field>
    \n+
    110inline bool
    \n+
    111inside(const Coordinate& x, const Field& epsilon)
    \n+
    112{
    \n+
    113 const unsigned dim = Coordinate::dimension;
    \n+
    114 Field sum(0);
    \n+
    115 for (unsigned i = 0; i < dim-1; ++i) {
    \n+
    116 if (x[i] < -epsilon)
    \n+
    117 return false;
    \n+
    118 sum += x[i];
    \n+
    119 }
    \n+
    120 /* If any x\u1d62 is NaN, sum will be NaN and this comparison false! */
    \n+
    121 if (sum <= Field(1) + epsilon)
    \n+
    122 return true;
    \n+
    123 return false;
    \n+
    124}
    \n+
    125
    \n+
    126} /* namespace ProjectionImplementation */
    \n
    127
    \n-
    128template<typename Glue>
    \n-
    129void write_glue_areas_vtk(const Glue& glue, const std::string& base)
    \n-
    130{
    \n-
    131 {
    \n-
    132 std::string filename = base;
    \n-
    133 filename += "-inside.vtk";
    \n-
    134 write_glue_area_vtk<0>(glue, filename);
    \n-
    135 }
    \n-
    136 {
    \n-
    137 std::string filename = base;
    \n-
    138 filename += "-outside.vtk";
    \n-
    139 write_glue_area_vtk<1>(glue, filename);
    \n-
    140 }
    \n-
    141}
    \n-
    142
    \n-
    143} /* namespace GridGlue */
    \n-
    144} /* namespace Dune */
    \n+
    128template<typename Coordinate>
    \n+\n+
    130::Projection(const Field overlap, const Field max_normal_product)
    \n+
    131 : m_overlap(overlap)
    \n+
    132 , m_max_normal_product(max_normal_product)
    \n+
    133{
    \n+
    134 /* Nothing. */
    \n+
    135}
    \n+
    136
    \n+
    137template<typename Coordinate>
    \n+
    138void
    \n+\n+
    140::epsilon(const Field epsilon)
    \n+
    141{
    \n+
    142 m_epsilon = epsilon;
    \n+
    143}
    \n+
    144
    \n+
    145template<typename Coordinate>
    \n+
    146template<typename Corners, typename Normals>
    \n+
    147void
    \n+\n+
    149::doProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n+
    150{
    \n+
    151 /* Try to obtain \u03a6(x\u1d62) for each corner x\u1d62 of the preimage triangle.
    \n+
    152 * This means solving a linear system of equations
    \n+
    153 * \u03a6(x\u1d62) = (1-\u03b1-\u03b2) y\u2080 + \u03b1 y\u2081 + \u03b2 y\u2082 = x\u1d62 + \u03b4 n\u1d62
    \n+
    154 * or \u03b1 (y\u2081 - y\u2080) + \u03b2 (y\u2082 - y\u2080) - \u03b4 n\u1d62 = x\u1d62 - y\u2080
    \n+
    155 * to obtain the barycentric coordinates (\u03b1, \u03b2) of \u03a6(x\u1d62) in the image
    \n+
    156 * triangle and the distance \u03b4.
    \n+
    157 *
    \n+
    158 * In the matrix m corresponding to the system, only the third column and the
    \n+
    159 * right-hand side depend on i. The first two columns can be assembled before
    \n+
    160 * and reused.
    \n+
    161 */
    \n+
    162 using namespace ProjectionImplementation;
    \n+
    163 using std::get;
    \n+
    164 typedef Dune::FieldMatrix<Field, dim, dim> Matrix;
    \n+
    165 Matrix m;
    \n+
    166
    \n+
    167 const auto& origin = get<0>(corners);
    \n+
    168 const auto& origin_normals = get<0>(normals);
    \n+
    169 const auto& target = get<1>(corners);
    \n+
    170 const auto& target_normals = get<1>(normals);
    \n+
    171 auto& images = get<0>(m_images);
    \n+
    172 auto& success = get<0>(m_success);
    \n+
    173
    \n+
    174 /* directions\u1d62 = (y\u1d62 - y\u2080) / ||y\u1d62 - y\u2080||
    \n+
    175 * These are the first to columns of the system matrix; the rescaling is done
    \n+
    176 * to ensure all columns have a comparable norm (the last has the normal with norm 1.
    \n+
    177 */
    \n+
    178 std::array<Coordinate, dim-1> directions;
    \n+
    179 std::array<Field, dim-1> scales;
    \n+
    180 /* estimator for the diameter of the target face */
    \n+
    181 Field scaleSum(0);
    \n+
    182 for (unsigned i = 0; i < dim-1; ++i) {
    \n+
    183 directions[i] = target[i+1] - target[0];
    \n+
    184 scales[i] = directions[i].infinity_norm();
    \n+
    185 directions[i] /= scales[i];
    \n+
    186 scaleSum += scales[i];
    \n+
    187 }
    \n+
    188
    \n+
    189 for (unsigned i = 0; i < dim-1; ++i) {
    \n+
    190 for (unsigned j = 0; j < dim; ++j) {
    \n+
    191 m[j][i] = directions[i][j];
    \n+
    192 }
    \n+
    193 }
    \n+
    194
    \n+
    195 m_projection_valid = true;
    \n+
    196 success.reset();
    \n+
    197
    \n+
    198 /* Now project x\u1d62 for each i */
    \n+
    199 for (unsigned i = 0; i < origin.size(); ++i) {
    \n+
    200 for (unsigned j = 0; j < dim; ++j)
    \n+
    201 m[j][dim-1] = origin_normals[i][j];
    \n+
    202
    \n+
    203 const Coordinate rhs = origin[i] - target[0];
    \n+
    204
    \n+
    205 try {
    \n+
    206 /* y = (\u03b1, \u03b2, \u03b4) */
    \n+
    207 auto& y = images[i];
    \n+
    208 m.solve(y, rhs);
    \n+
    209 for (unsigned j = 0; j < dim-1; ++j)
    \n+
    210 y[j] /= scales[j];
    \n+
    211 /* Solving gave us -\u03b4 as the term is "-\u03b4 n\u1d62". */
    \n+
    212 y[dim-1] *= Field(-1);
    \n+
    213
    \n+
    214 /* If the forward projection is too far in the wrong direction
    \n+
    215 * then this might result in artificial inverse projections or
    \n+
    216 * edge intersections. To prevent these wrong cases but not
    \n+
    217 * dismiss feasible intersections, the projection is dismissed
    \n+
    218 * if the forward projection is further than two times the
    \n+
    219 * approximate diameter of the image triangle.
    \n+
    220 */
    \n+
    221 if(y[dim-1] < -2*scaleSum) {
    \n+
    222 success.set(i,false);
    \n+
    223 m_projection_valid = false;
    \n+
    224 return;
    \n+
    225 }
    \n+
    226
    \n+
    227 const bool feasible = projectionFeasible(origin[i], origin_normals[i], y, target, target_normals);
    \n+
    228 success.set(i, feasible);
    \n+
    229 }
    \n+
    230 catch (const Dune::FMatrixError&) {
    \n+
    231 success.set(i, false);
    \n+
    232 m_projection_valid = false;
    \n+
    233 }
    \n+
    234 }
    \n+
    235}
    \n+
    236
    \n+
    237template<typename Coordinate>
    \n+
    238template<typename Corners, typename Normals>
    \n+
    239void
    \n+
    240Projection<Coordinate>
    \n+
    241::doInverseProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n+
    242{
    \n+
    243 /* Try to obtain \u03a6\u207b\u00b9(y\u1d62) for each corner y\u1d62 of the image triangle.
    \n+
    244 * Instead of solving the problem directly (which would lead to
    \n+
    245 * non-linear equations), we make use of the forward projection \u03a6
    \n+
    246 * which projects the preimage triangle on the plane spanned by the
    \n+
    247 * image triangle. The inverse projection is then given by finding
    \n+
    248 * the barycentric coordinates of y\u1d62 with respect to the triangle
    \n+
    249 * with the corners \u03a6(x\u1d62). This way we only have to solve linear
    \n+
    250 * equations.
    \n+
    251 */
    \n+
    252
    \n+
    253 using namespace ProjectionImplementation;
    \n+
    254 using std::get;
    \n+
    255 typedef Dune::FieldMatrix<Field, dim-1, dim-1> Matrix;
    \n+
    256 typedef Dune::FieldVector<Field, dim-1> Vector;
    \n+
    257
    \n+
    258 /* The inverse projection can only be computed if the forward projection
    \n+
    259 * managed to project all x\u1d62 on the plane spanned by the y\u1d62
    \n+
    260 */
    \n+
    261 if (!m_projection_valid) {
    \n+
    262 get<1>(m_success).reset();
    \n+
    263 return;
    \n+
    264 }
    \n+
    265
    \n+
    266 const auto& images = get<0>(m_images);
    \n+
    267 const auto& target_corners = get<1>(corners);
    \n+
    268 auto& preimages = get<1>(m_images);
    \n+
    269 auto& success = get<1>(m_success);
    \n+
    270
    \n+
    271 std::array<Coordinate, dim> v;
    \n+
    272 for (unsigned i = 0; i < dim-1; ++i) {
    \n+
    273 v[i] = interpolate(images[i+1], target_corners);
    \n+
    274 v[i] -= interpolate(images[0], target_corners);
    \n+
    275 }
    \n+
    276
    \n+
    277 Matrix m;
    \n+
    278 for (unsigned i = 0; i < dim-1; ++i) {
    \n+
    279 for (unsigned j = 0; j < dim-1; ++j) {
    \n+
    280 m[i][j] = v[i]*v[j];
    \n+
    281 }
    \n+
    282 }
    \n+
    283
    \n+
    284 for (unsigned i = 0; i < dim; ++i) {
    \n+
    285 /* Convert y\u1d62 to barycentric coordinates with respect to \u03a6(x\u2c7c) */
    \n+
    286 v[dim-1] = target_corners[i];
    \n+
    287 v[dim-1] -= interpolate(images[0], target_corners);
    \n+
    288
    \n+
    289 Vector rhs, z;
    \n+
    290 for (unsigned j = 0; j < dim-1; ++j)
    \n+
    291 rhs[j] = v[dim-1]*v[j];
    \n+
    292 m.solve(z, rhs);
    \n+
    293
    \n+
    294 for (unsigned j = 0; j < dim-1; ++j)
    \n+
    295 preimages[i][j] = z[j];
    \n+
    296
    \n+
    297 /* Calculate distance along normal direction */
    \n+
    298 const auto x = interpolate(z, get<0>(corners));
    \n+
    299 preimages[i][dim-1] = (x - target_corners[i]) * get<1>(normals)[i];
    \n+
    300
    \n+
    301 /* Check y_i lies inside the \u03a6(x\u2c7c) */
    \n+
    302 const bool feasible = projectionFeasible(target_corners[i], get<1>(normals)[i], preimages[i], get<0>(corners), get<0>(normals));
    \n+
    303 success.set(i, feasible);
    \n+
    304 }
    \n+
    305}
    \n+
    306
    \n+
    307template<typename Coordinate>
    \n+
    308template<typename Corners, typename Normals>
    \n+
    309void
    \n+
    310Projection<Coordinate>
    \n+
    311::doEdgeIntersection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n+
    312{
    \n+
    313 using namespace ProjectionImplementation;
    \n+
    314 using std::get;
    \n+
    315
    \n+
    316 m_number_of_edge_intersections = 0;
    \n+
    317
    \n+
    318 /* There are no edge intersections for 2d, only for 3d */
    \n+
    319 if (dim != 3)
    \n+
    320 return;
    \n+
    321
    \n+
    322 /* There are no edge intersections
    \n+
    323 * - when the projection is invalid,
    \n+
    324 * - when the projected triangle lies fully in the target triangle,
    \n+
    325 * - or when the target triangle lies fully in the projected triangle.
    \n+
    326 */
    \n+
    327 if (!m_projection_valid || get<0>(m_success).all() || get<1>(m_success).all()) {
    \n+
    328 return;
    \n+
    329 }
    \n+
    330
    \n+
    331 const auto& images = get<0>(m_images);
    \n+
    332 const auto& ys = get<1>(corners);
    \n+
    333
    \n+
    334 /* Intersect line through \u03a6(x\u1d62), \u03a6(x\u2c7c) with line through y\u2096, y\u2097:
    \n+
    335 We want \u03b1, \u03b2 \u2208 \u211d such that
    \n+
    336 \u03a6(x\u1d62) + \u03b1 (\u03a6(x\u2c7c) - \u03a6(x\u1d62)) = y\u2096 + \u03b2 (y\u2097 - y\u2096)
    \n+
    337 or
    \n+
    338 \u03b1 (\u03a6(x\u2c7c)-\u03a6(x\u1d62)) + \u03b2 (y\u2097-y\u2096) = y\u2096-\u03a6(x\u1d62)
    \n+
    339 To get a 2\u00d72 system of equations, multiply with y\u2098-y\u2080 for
    \n+
    340 m \u2208 {1,\u0323\u03232} which are linear indep. (and so the system is
    \n+
    341 equivalent to the original 3\u00d72 system)
    \n+
    342 */
    \n+
    343 for (unsigned edgex = 0; edgex < dim; ++edgex) {
    \n+
    344 unsigned i, j;
    \n+
    345 std::tie(i, j) = edgeToCorners(edgex);
    \n+
    346
    \n+
    347 /* Both sides of edgex lie in the target triangle means no edge intersection */
    \n+
    348 if (get<0>(m_success)[i] && get<0>(m_success)[j])
    \n+
    349 continue;
    \n+
    350
    \n+
    351 const auto pxi = interpolate(images[i], ys);
    \n+
    352 const auto pxj = interpolate(images[j], ys);
    \n+
    353 const auto pxjpxi = pxj - pxi;
    \n+
    354
    \n+
    355 typedef Dune::FieldMatrix<Field, dim-1, dim-1> Matrix;
    \n+
    356 typedef Dune::FieldVector<Field, dim-1> Vector;
    \n+
    357
    \n+
    358 for (unsigned edgey = 0; edgey < dim; ++edgey) {
    \n+
    359 unsigned k, l;
    \n+
    360 std::tie(k, l) = edgeToCorners(edgey);
    \n+
    361
    \n+
    362 /* Both sides of edgey lie in the projected triangle means no edge intersection */
    \n+
    363 if (get<1>(m_success)[k] && get<1>(m_success)[l])
    \n+
    364 continue;
    \n+
    365
    \n+
    366 const auto ykyl = ys[k] - ys[l];
    \n+
    367 const auto ykpxi = ys[k] - pxi;
    \n+
    368
    \n+
    369 /* If edges are parallel then the intersection is already computed by vertex projections. */
    \n+
    370 bool parallel = true;
    \n+
    371 for (unsigned h=0; h<3; h++)
    \n+
    372 parallel &= std::abs(ykyl[(h+1)%3]*pxjpxi[(h+2)%3] - ykyl[(h+2)%3]*pxjpxi[(h+1)%3])<1e-14;
    \n+
    373 if (parallel)
    \n+
    374 continue;
    \n+
    375
    \n+
    376 Matrix mat;
    \n+
    377 Vector rhs, z;
    \n+
    378
    \n+
    379 for (unsigned m = 0; m < dim-1; ++m) {
    \n+
    380 const auto ym1y0 = ys[m+1] - ys[0];
    \n+
    381 mat[m][0] = pxjpxi * ym1y0;
    \n+
    382 mat[m][1] = ykyl * ym1y0;
    \n+
    383 rhs[m] = ykpxi * ym1y0;
    \n+
    384 }
    \n+
    385
    \n+
    386 try {
    \n+
    387 using std::isfinite;
    \n+
    388
    \n+
    389 mat.solve(z, rhs);
    \n+
    390
    \n+
    391 /* If solving the system gives a NaN, the edges are probably parallel. */
    \n+
    392 if (!isfinite(z[0]) || !isfinite(z[1]))
    \n+
    393 continue;
    \n+
    394
    \n+
    395 /* Filter out corner (pre)images. We only want "real" edge-edge intersections here. */
    \n+
    396 if (z[0] < m_epsilon || z[0] > Field(1) - m_epsilon
    \n+
    397 || z[1] < m_epsilon || z[1] > Field(1) - m_epsilon)
    \n+
    398 continue;
    \n+
    399
    \n+
    400 Coordinate local_x = corner<Coordinate, Field>(i);
    \n+
    401 local_x.axpy(z[0], corner<Coordinate, Field>(j) - corner<Coordinate, Field>(i));
    \n+
    402 Coordinate local_y = corner<Coordinate, Field>(k);
    \n+
    403 local_y.axpy(z[1], corner<Coordinate, Field>(l) - corner<Coordinate, Field>(k));
    \n+
    404
    \n+
    405 /* Make sure the intersection is in the triangle. */
    \n+
    406 if (!inside(local_x, m_epsilon) || !inside(local_y, m_epsilon))
    \n+
    407 continue;
    \n+
    408
    \n+
    409 /* Make sure the intersection respects overlap. */
    \n+
    410 auto xy = interpolate(local_x, get<0>(corners));
    \n+
    411 xy -= interpolate(local_y, get<1>(corners));
    \n+
    412 const auto nx = interpolate_unit_normals(local_x, get<0>(normals));
    \n+
    413 const auto ny = interpolate_unit_normals(local_y, get<1>(normals));
    \n+
    414 local_x[dim-1] = -(xy*nx);
    \n+
    415 local_y[dim-1] = xy*ny;
    \n+
    416
    \n+
    417 if (local_x[dim-1] < -m_overlap-m_epsilon || local_y[dim-1] < -m_overlap-m_epsilon)
    \n+
    418 continue;
    \n+
    419
    \n+
    420 /* Normals should be opposing. */
    \n+
    421 if (nx*ny > m_max_normal_product + m_epsilon)
    \n+
    422 continue;
    \n+
    423
    \n+
    424 /* Intersection is feasible. Store it. */
    \n+
    425 auto& intersection = m_edge_intersections[m_number_of_edge_intersections++];
    \n+
    426 intersection = { {{edgex, edgey}}, {{local_x, local_y}} };
    \n+
    427 }
    \n+
    428 catch(const Dune::FMatrixError&) {
    \n+
    429 /* Edges might be parallel, ignore and continue with next edge */
    \n+
    430 }
    \n+
    431 }
    \n+
    432 }
    \n+
    433}
    \n+
    434
    \n+
    435template<typename Coordinate>
    \n+
    436template<typename Corners, typename Normals>
    \n+
    437bool Projection<Coordinate>
    \n+
    438::projectionFeasible(const Coordinate& x, const Coordinate& nx, const Coordinate& px, const Corners& corners, const Normals& normals) const
    \n+
    439{
    \n+
    440 using namespace ProjectionImplementation;
    \n+
    441
    \n+
    442 /* Image must be within simplex. */
    \n+
    443 if (!inside(px, m_epsilon))
    \n+
    444 return false;
    \n+
    445
    \n+
    446 /* Distance along normal must not be smaller than -overlap. */
    \n+
    447 if (px[dim-1] < -m_overlap-m_epsilon)
    \n+
    448 return false;
    \n+
    449
    \n+
    450 /* Distance along normal at image must not be smaller than -overlap. */
    \n+
    451 auto xmy = x;
    \n+
    452 xmy -= interpolate(px, corners);
    \n+
    453 const auto n = interpolate_unit_normals(px, normals);
    \n+
    454 const auto d = xmy * n;
    \n+
    455 if (d < -m_overlap-m_epsilon)
    \n+
    456 return false;
    \n+
    457
    \n+
    458 /* Normals at x and \u03a6(x) are opposing. */
    \n+
    459 if (nx * n > m_max_normal_product + m_epsilon)
    \n+
    460 return false;
    \n+
    461
    \n+
    462 /* Okay, projection is feasible. */
    \n+
    463 return true;
    \n+
    464}
    \n+
    465
    \n+
    466template<typename Coordinate>
    \n+
    467template<typename Corners, typename Normals>
    \n+\n+
    469::project(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n+
    470{
    \n+
    471 doProjection(corners, normals);
    \n+
    472 doInverseProjection(corners, normals);
    \n+
    473 doEdgeIntersection(corners, normals);
    \n+
    474}
    \n+
    475
    \n+
    476} /* namespace GridGlue */
    \n+
    477} /* namespace Dune */
    \n
    Definition: gridglue.hh:37
    \n-
    void write_glue_area_vtk(const Glue &glue, std::ostream &out)
    Definition: areawriter_impl.hh:84
    \n-
    void write_glue_areas_vtk(const Glue &glue, const std::string &base)
    Definition: areawriter_impl.hh:129
    \n-
    IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
    Iterate over all intersections of a GridGlue.
    \n-
    void write_facet_geometry(const GridView &gv, std::ostream &out)
    Definition: areawriter_impl.hh:25
    \n-
    Definition: rangegenerators.hh:17
    \n-\n-
    bool contains(Dune::GeometryType gt) const
    Definition: areawriter_impl.hh:18
    \n+
    Corners::value_type interpolate(const Coordinate &x, const Corners &corners)
    Definition: projection_impl.hh:70
    \n+
    bool inside(const Coordinate &x, const Field &epsilon)
    Definition: projection_impl.hh:111
    \n+
    std::pair< unsigned, unsigned > edgeToCorners(unsigned edge)
    Definition: projection_impl.hh:43
    \n+
    Coordinate corner(unsigned c)
    Definition: projection_impl.hh:24
    \n+
    Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals &normals)
    Definition: projection_impl.hh:91
    \n+
    Projection of a line (triangle) on another line (triangle).
    Definition: projection.hh:21
    \n+
    Coordinate::field_type Field
    Scalar type.
    Definition: projection.hh:61
    \n+
    Projection(const Field overlap=Field(0), const Field max_normal_product=Field(-0.1))
    Definition: projection_impl.hh:130
    \n+
    void epsilon(const Field epsilon)
    Set epsilon used for floating-point comparisons.
    Definition: projection_impl.hh:140
    \n+
    void project(const std::tuple< Corners &, Corners & > &corners, const std::tuple< Normals &, Normals & > &normals)
    Do the actual projection.
    Definition: projection_impl.hh:469
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,185 +5,494 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-areawriter_impl.hh\n+projection_impl.hh\n Go_to_the_documentation_of_this_file.\n 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#include \n- 4#include \n- 5\n- 6#include \n- 7#include \n- 8#include \n+ 3#include \n+ 4\n+ 5#include \n+ 6\n+ 7namespace Dune {\n+ 8namespace GridGlue {\n 9\n- 10namespace Dune {\n- 11namespace GridGlue {\n- 12\n-13namespace AreaWriterImplementation {\n- 14\n- 15template\n-16struct FacetLayout\n- 17{\n-18 bool contains(Dune::GeometryType gt) const\n- 19 {\n- 20 return gt.dim() == dimgrid - 1;\n- 21 }\n- 22};\n- 23\n- 24template\n-25void write_facet_geometry(const GridView& gv, std::ostream& out)\n- 26{\n- 27 using Coordinate = Dune::FieldVector;\n- 28\n- 29 std::vector corners;\n- 30 for (const auto& facet : facets(gv)) {\n- 31 const auto geometry = facet.geometry();\n- 32 for (int i = 0; i < geometry.corners(); ++i) {\n- 33 /* VTK always needs 3-dim coordinates... */\n- 34 const auto c0 = geometry.corner(i);\n- 35 Coordinate c1;\n- 36 for (int d = 0; d < GridView::dimensionworld; ++d)\n- 37 c1[d] = c0[d];\n- 38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d)\n- 39 c1[d] = double(0);\n- 40 corners.push_back(c1);\n- 41 }\n- 42 }\n- 43\n- 44 {\n- 45 out << \"DATASET UNSTRUCTURED_GRID\\n\"\n- 46 << \"POINTS \" << corners.size() << \" double\\n\";\n- 47 for (const auto& c : corners)\n- 48 out << c << \"\\n\";\n+10namespace ProjectionImplementation {\n+ 11\n+ 22template\n+ 23inline Coordinate\n+24corner(unsigned c)\n+ 25{\n+ 26 Coordinate x(Field(0));\n+ 27 if (c == 0)\n+ 28 return x;\n+ 29 x[c-1] = Field(1);\n+ 30 return x;\n+ 31}\n+ 32\n+ 42inline std::pair\n+43edgeToCorners(unsigned edge)\n+ 44{\n+ 45 switch(edge) {\n+ 46 case 0: return {0, 1};\n+ 47 case 1: return {0, 2};\n+ 48 case 2: return {1, 2};\n 49 }\n- 50 {\n- 51 out << \"CELLS \" << gv.size(1) << \" \" << (gv.size(1) + corners.size()) <<\n-\"\\n\";\n- 52 std::size_t c = 0;\n- 53 for (const auto& facet : facets(gv)) {\n- 54 const auto geometry = facet.geometry();\n- 55 out << geometry.corners();\n- 56 for (int i = 0; i < geometry.corners(); ++i, ++c)\n- 57 out << \" \" << c;\n- 58 out << \"\\n\";\n- 59 }\n- 60 }\n- 61 {\n- 62 out << \"CELL_TYPES \" << gv.size(1) << \"\\n\";\n- 63 for (const auto& facet : facets(gv)) {\n- 64 const auto type = facet.type();\n- 65 if (type.isVertex())\n- 66 out << \"1\\n\";\n- 67 else if (type.isLine())\n- 68 out << \"2\\n\";\n- 69 else if (type.isTriangle())\n- 70 out << \"5\\n\";\n- 71 else if (type.isQuadrilateral())\n- 72 out << \"9\\n\";\n- 73 else if (type.isTetrahedron())\n- 74 out << \"10\\n\";\n- 75 else\n- 76 DUNE_THROW(Dune::Exception, \"Unhandled geometry type\");\n- 77 }\n- 78 }\n- 79}\n- 80\n- 81} /* namespace AreaWriterImplementation */\n- 82\n- 83template\n-84void write_glue_area_vtk(const Glue& glue, std::ostream& out)\n- 85{\n- 86 using GridView = typename std::decay< decltype(glue.template gridView\n-()) >::type;\n- 87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper;\n- 88 using ctype = typename GridView::ctype;\n- 89\n- 90 const GridView gv = glue.template gridView();\n- 91 Mapper mapper(gv);\n- 92 std::vector coveredArea(mapper.size(), ctype(0));\n- 93 std::vector totalArea(mapper.size(), ctype(1));\n- 94\n- 95 for (const auto& in : intersections(glue, Reverse())) {\n- 96 const auto element = in.inside();\n- 97 const auto index = mapper.subIndex(element, in.indexInInside(), 1);\n- 98 coveredArea[index] += in.geometryInInside().volume();\n- 99\n- 100 const auto& refElement = Dune::ReferenceElements::general(element.type());\n- 101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside\n-());\n- 102 totalArea[index] = subGeometry.volume();\n- 103 }\n- 104\n- 105 for (std::size_t i = 0; i < coveredArea.size(); ++i)\n- 106 coveredArea[i] /= totalArea[i];\n- 107\n- 108 out << \"# vtk DataFile Version 2.0\\n\"\n- 109 << \"Filename: Glue Area\\n\"\n- 110 << \"ASCII\\n\";\n- 111\n- 112 AreaWriterImplementation::write_facet_geometry(gv, out);\n- 113\n- 114 out << \"CELL_DATA \" << coveredArea.size() << \"\\n\"\n- 115 << \"SCALARS CoveredArea double 1\\n\"\n- 116 << \"LOOKUP_TABLE default\\n\";\n- 117 for (const auto& value : coveredArea)\n- 118 out << value << \"\\n\";\n- 119}\n- 120\n- 121template\n-122void write_glue_area_vtk(const Glue& glue, const std::string& filename)\n- 123{\n- 124 std::ofstream out(filename.c_str());\n- 125 write_glue_area_vtk(glue, out);\n- 126}\n+ 50 DUNE_THROW(Dune::Exception, \"Unexpected edge number.\");\n+ 51}\n+ 52\n+ 68template\n+ 69inline typename Corners::value_type\n+70interpolate(const Coordinate& x, const Corners& corners)\n+ 71{\n+ 72 auto y = corners[0];\n+ 73 for (unsigned i = 0; i < corners.size() - 1; ++i)\n+ 74 y.axpy(x[i], corners[i+1] - corners[0]);\n+ 75 return y;\n+ 76}\n+ 77\n+ 89template\n+ 90inline typename Normals::value_type\n+91interpolate_unit_normals(const Coordinate& x, const Normals& normals)\n+ 92{\n+ 93 auto n = interpolate(x, normals);\n+ 94 n /= n.two_norm();\n+ 95 return n;\n+ 96}\n+ 97\n+ 109template\n+ 110inline bool\n+111inside(const Coordinate& x, const Field& epsilon)\n+ 112{\n+ 113 const unsigned dim = Coordinate::dimension;\n+ 114 Field sum(0);\n+ 115 for (unsigned i = 0; i < dim-1; ++i) {\n+ 116 if (x[i] < -epsilon)\n+ 117 return false;\n+ 118 sum += x[i];\n+ 119 }\n+ 120 /* If any x\u1d62 is NaN, sum will be NaN and this comparison false! */\n+ 121 if (sum <= Field(1) + epsilon)\n+ 122 return true;\n+ 123 return false;\n+ 124}\n+ 125\n+ 126} /* namespace ProjectionImplementation */\n 127\n- 128template\n-129void write_glue_areas_vtk(const Glue& glue, const std::string& base)\n- 130{\n- 131 {\n- 132 std::string filename = base;\n- 133 filename += \"-inside.vtk\";\n- 134 write_glue_area_vtk<0>(glue, filename);\n- 135 }\n- 136 {\n- 137 std::string filename = base;\n- 138 filename += \"-outside.vtk\";\n- 139 write_glue_area_vtk<1>(glue, filename);\n- 140 }\n- 141}\n- 142\n- 143} /* namespace GridGlue */\n- 144} /* namespace Dune */\n+ 128template\n+ 129Projection\n+130::Projection(const Field overlap, const Field max_normal_product)\n+ 131 : m_overlap(overlap)\n+ 132 , m_max_normal_product(max_normal_product)\n+ 133{\n+ 134 /* Nothing. */\n+ 135}\n+ 136\n+ 137template\n+ 138void\n+ 139Projection\n+140::epsilon(const Field epsilon)\n+ 141{\n+ 142 m_epsilon = epsilon;\n+ 143}\n+ 144\n+ 145template\n+ 146template\n+ 147void\n+ 148Projection\n+ 149::doProjection(const std::tuple& corners, const std::\n+tuple& normals)\n+ 150{\n+ 151 /* Try to obtain \u03a6(x\u1d62) for each corner x\u1d62 of the preimage triangle.\n+ 152 * This means solving a linear system of equations\n+ 153 * \u03a6(x\u1d62) = (1-\u03b1-\u03b2) y\u2080 + \u03b1 y\u2081 + \u03b2 y\u2082 = x\u1d62 + \u03b4 n\u1d62\n+ 154 * or \u03b1 (y\u2081 - y\u2080) + \u03b2 (y\u2082 - y\u2080) - \u03b4 n\u1d62 = x\u1d62 - y\u2080\n+ 155 * to obtain the barycentric coordinates (\u03b1, \u03b2) of \u03a6(x\u1d62) in the image\n+ 156 * triangle and the distance \u03b4.\n+ 157 *\n+ 158 * In the matrix m corresponding to the system, only the third column and\n+the\n+ 159 * right-hand side depend on i. The first two columns can be assembled\n+before\n+ 160 * and reused.\n+ 161 */\n+ 162 using namespace ProjectionImplementation;\n+ 163 using std::get;\n+ 164 typedef Dune::FieldMatrix Matrix;\n+ 165 Matrix m;\n+ 166\n+ 167 const auto& origin = get<0>(corners);\n+ 168 const auto& origin_normals = get<0>(normals);\n+ 169 const auto& target = get<1>(corners);\n+ 170 const auto& target_normals = get<1>(normals);\n+ 171 auto& images = get<0>(m_images);\n+ 172 auto& success = get<0>(m_success);\n+ 173\n+ 174 /* directions\u1d62 = (y\u1d62 - y\u2080) / ||y\u1d62 - y\u2080||\n+ 175 * These are the first to columns of the system matrix; the rescaling is\n+done\n+ 176 * to ensure all columns have a comparable norm (the last has the normal\n+with norm 1.\n+ 177 */\n+ 178 std::array directions;\n+ 179 std::array scales;\n+ 180 /* estimator for the diameter of the target face */\n+ 181 Field scaleSum(0);\n+ 182 for (unsigned i = 0; i < dim-1; ++i) {\n+ 183 directions[i] = target[i+1] - target[0];\n+ 184 scales[i] = directions[i].infinity_norm();\n+ 185 directions[i] /= scales[i];\n+ 186 scaleSum += scales[i];\n+ 187 }\n+ 188\n+ 189 for (unsigned i = 0; i < dim-1; ++i) {\n+ 190 for (unsigned j = 0; j < dim; ++j) {\n+ 191 m[j][i] = directions[i][j];\n+ 192 }\n+ 193 }\n+ 194\n+ 195 m_projection_valid = true;\n+ 196 success.reset();\n+ 197\n+ 198 /* Now project x\u1d62 for each i */\n+ 199 for (unsigned i = 0; i < origin.size(); ++i) {\n+ 200 for (unsigned j = 0; j < dim; ++j)\n+ 201 m[j][dim-1] = origin_normals[i][j];\n+ 202\n+ 203 const Coordinate rhs = origin[i] - target[0];\n+ 204\n+ 205 try {\n+ 206 /* y = (\u03b1, \u03b2, \u03b4) */\n+ 207 auto& y = images[i];\n+ 208 m.solve(y, rhs);\n+ 209 for (unsigned j = 0; j < dim-1; ++j)\n+ 210 y[j] /= scales[j];\n+ 211 /* Solving gave us -\u03b4 as the term is \"-\u03b4 n\u1d62\". */\n+ 212 y[dim-1] *= Field(-1);\n+ 213\n+ 214 /* If the forward projection is too far in the wrong direction\n+ 215 * then this might result in artificial inverse projections or\n+ 216 * edge intersections. To prevent these wrong cases but not\n+ 217 * dismiss feasible intersections, the projection is dismissed\n+ 218 * if the forward projection is further than two times the\n+ 219 * approximate diameter of the image triangle.\n+ 220 */\n+ 221 if(y[dim-1] < -2*scaleSum) {\n+ 222 success.set(i,false);\n+ 223 m_projection_valid = false;\n+ 224 return;\n+ 225 }\n+ 226\n+ 227 const bool feasible = projectionFeasible(origin[i], origin_normals[i], y,\n+target, target_normals);\n+ 228 success.set(i, feasible);\n+ 229 }\n+ 230 catch (const Dune::FMatrixError&) {\n+ 231 success.set(i, false);\n+ 232 m_projection_valid = false;\n+ 233 }\n+ 234 }\n+ 235}\n+ 236\n+ 237template\n+ 238template\n+ 239void\n+ 240Projection\n+ 241::doInverseProjection(const std::tuple& corners, const\n+std::tuple& normals)\n+ 242{\n+ 243 /* Try to obtain \u03a6\u207b\u00b9(y\u1d62) for each corner y\u1d62 of the image triangle.\n+ 244 * Instead of solving the problem directly (which would lead to\n+ 245 * non-linear equations), we make use of the forward projection \u03a6\n+ 246 * which projects the preimage triangle on the plane spanned by the\n+ 247 * image triangle. The inverse projection is then given by finding\n+ 248 * the barycentric coordinates of y\u1d62 with respect to the triangle\n+ 249 * with the corners \u03a6(x\u1d62). This way we only have to solve linear\n+ 250 * equations.\n+ 251 */\n+ 252\n+ 253 using namespace ProjectionImplementation;\n+ 254 using std::get;\n+ 255 typedef Dune::FieldMatrix Matrix;\n+ 256 typedef Dune::FieldVector Vector;\n+ 257\n+ 258 /* The inverse projection can only be computed if the forward projection\n+ 259 * managed to project all x\u1d62 on the plane spanned by the y\u1d62\n+ 260 */\n+ 261 if (!m_projection_valid) {\n+ 262 get<1>(m_success).reset();\n+ 263 return;\n+ 264 }\n+ 265\n+ 266 const auto& images = get<0>(m_images);\n+ 267 const auto& target_corners = get<1>(corners);\n+ 268 auto& preimages = get<1>(m_images);\n+ 269 auto& success = get<1>(m_success);\n+ 270\n+ 271 std::array v;\n+ 272 for (unsigned i = 0; i < dim-1; ++i) {\n+ 273 v[i] = interpolate(images[i+1], target_corners);\n+ 274 v[i] -= interpolate(images[0], target_corners);\n+ 275 }\n+ 276\n+ 277 Matrix m;\n+ 278 for (unsigned i = 0; i < dim-1; ++i) {\n+ 279 for (unsigned j = 0; j < dim-1; ++j) {\n+ 280 m[i][j] = v[i]*v[j];\n+ 281 }\n+ 282 }\n+ 283\n+ 284 for (unsigned i = 0; i < dim; ++i) {\n+ 285 /* Convert y\u1d62 to barycentric coordinates with respect to \u03a6(x\u2c7c) */\n+ 286 v[dim-1] = target_corners[i];\n+ 287 v[dim-1] -= interpolate(images[0], target_corners);\n+ 288\n+ 289 Vector rhs, z;\n+ 290 for (unsigned j = 0; j < dim-1; ++j)\n+ 291 rhs[j] = v[dim-1]*v[j];\n+ 292 m.solve(z, rhs);\n+ 293\n+ 294 for (unsigned j = 0; j < dim-1; ++j)\n+ 295 preimages[i][j] = z[j];\n+ 296\n+ 297 /* Calculate distance along normal direction */\n+ 298 const auto x = interpolate(z, get<0>(corners));\n+ 299 preimages[i][dim-1] = (x - target_corners[i]) * get<1>(normals)[i];\n+ 300\n+ 301 /* Check y_i lies inside the \u03a6(x\u2c7c) */\n+ 302 const bool feasible = projectionFeasible(target_corners[i], get<1>\n+(normals)[i], preimages[i], get<0>(corners), get<0>(normals));\n+ 303 success.set(i, feasible);\n+ 304 }\n+ 305}\n+ 306\n+ 307template\n+ 308template\n+ 309void\n+ 310Projection\n+ 311::doEdgeIntersection(const std::tuple& corners, const\n+std::tuple& normals)\n+ 312{\n+ 313 using namespace ProjectionImplementation;\n+ 314 using std::get;\n+ 315\n+ 316 m_number_of_edge_intersections = 0;\n+ 317\n+ 318 /* There are no edge intersections for 2d, only for 3d */\n+ 319 if (dim != 3)\n+ 320 return;\n+ 321\n+ 322 /* There are no edge intersections\n+ 323 * - when the projection is invalid,\n+ 324 * - when the projected triangle lies fully in the target triangle,\n+ 325 * - or when the target triangle lies fully in the projected triangle.\n+ 326 */\n+ 327 if (!m_projection_valid || get<0>(m_success).all() || get<1>\n+(m_success).all()) {\n+ 328 return;\n+ 329 }\n+ 330\n+ 331 const auto& images = get<0>(m_images);\n+ 332 const auto& ys = get<1>(corners);\n+ 333\n+ 334 /* Intersect line through \u03a6(x\u1d62), \u03a6(x\u2c7c) with line through y\u2096, y\u2097:\n+ 335 We want \u03b1, \u03b2 \u2208 \u211d such that\n+ 336 \u03a6(x\u1d62) + \u03b1 (\u03a6(x\u2c7c) - \u03a6(x\u1d62)) = y\u2096 + \u03b2 (y\u2097 - y\u2096)\n+ 337 or\n+ 338 \u03b1 (\u03a6(x\u2c7c)-\u03a6(x\u1d62)) + \u03b2 (y\u2097-y\u2096) = y\u2096-\u03a6(x\u1d62)\n+ 339 To get a 2\u00d72 system of equations, multiply with y\u2098-y\u2080 for\n+ 340 m \u2208 {1,\u0323\u03232} which are linear indep. (and so the system is\n+ 341 equivalent to the original 3\u00d72 system)\n+ 342 */\n+ 343 for (unsigned edgex = 0; edgex < dim; ++edgex) {\n+ 344 unsigned i, j;\n+ 345 std::tie(i, j) = edgeToCorners(edgex);\n+ 346\n+ 347 /* Both sides of edgex lie in the target triangle means no edge\n+intersection */\n+ 348 if (get<0>(m_success)[i] && get<0>(m_success)[j])\n+ 349 continue;\n+ 350\n+ 351 const auto pxi = interpolate(images[i], ys);\n+ 352 const auto pxj = interpolate(images[j], ys);\n+ 353 const auto pxjpxi = pxj - pxi;\n+ 354\n+ 355 typedef Dune::FieldMatrix Matrix;\n+ 356 typedef Dune::FieldVector Vector;\n+ 357\n+ 358 for (unsigned edgey = 0; edgey < dim; ++edgey) {\n+ 359 unsigned k, l;\n+ 360 std::tie(k, l) = edgeToCorners(edgey);\n+ 361\n+ 362 /* Both sides of edgey lie in the projected triangle means no edge\n+intersection */\n+ 363 if (get<1>(m_success)[k] && get<1>(m_success)[l])\n+ 364 continue;\n+ 365\n+ 366 const auto ykyl = ys[k] - ys[l];\n+ 367 const auto ykpxi = ys[k] - pxi;\n+ 368\n+ 369 /* If edges are parallel then the intersection is already computed by\n+vertex projections. */\n+ 370 bool parallel = true;\n+ 371 for (unsigned h=0; h<3; h++)\n+ 372 parallel &= std::abs(ykyl[(h+1)%3]*pxjpxi[(h+2)%3] - ykyl[(h+2)%3]*pxjpxi[\n+(h+1)%3])<1e-14;\n+ 373 if (parallel)\n+ 374 continue;\n+ 375\n+ 376 Matrix mat;\n+ 377 Vector rhs, z;\n+ 378\n+ 379 for (unsigned m = 0; m < dim-1; ++m) {\n+ 380 const auto ym1y0 = ys[m+1] - ys[0];\n+ 381 mat[m][0] = pxjpxi * ym1y0;\n+ 382 mat[m][1] = ykyl * ym1y0;\n+ 383 rhs[m] = ykpxi * ym1y0;\n+ 384 }\n+ 385\n+ 386 try {\n+ 387 using std::isfinite;\n+ 388\n+ 389 mat.solve(z, rhs);\n+ 390\n+ 391 /* If solving the system gives a NaN, the edges are probably parallel. */\n+ 392 if (!isfinite(z[0]) || !isfinite(z[1]))\n+ 393 continue;\n+ 394\n+ 395 /* Filter out corner (pre)images. We only want \"real\" edge-edge\n+intersections here. */\n+ 396 if (z[0] < m_epsilon || z[0] > Field(1) - m_epsilon\n+ 397 || z[1] < m_epsilon || z[1] > Field(1) - m_epsilon)\n+ 398 continue;\n+ 399\n+ 400 Coordinate local_x = corner(i);\n+ 401 local_x.axpy(z[0], corner(j) - corner(i));\n+ 402 Coordinate local_y = corner(k);\n+ 403 local_y.axpy(z[1], corner(l) - corner(k));\n+ 404\n+ 405 /* Make sure the intersection is in the triangle. */\n+ 406 if (!inside(local_x, m_epsilon) || !inside(local_y, m_epsilon))\n+ 407 continue;\n+ 408\n+ 409 /* Make sure the intersection respects overlap. */\n+ 410 auto xy = interpolate(local_x, get<0>(corners));\n+ 411 xy -= interpolate(local_y, get<1>(corners));\n+ 412 const auto nx = interpolate_unit_normals(local_x, get<0>(normals));\n+ 413 const auto ny = interpolate_unit_normals(local_y, get<1>(normals));\n+ 414 local_x[dim-1] = -(xy*nx);\n+ 415 local_y[dim-1] = xy*ny;\n+ 416\n+ 417 if (local_x[dim-1] < -m_overlap-m_epsilon || local_y[dim-1] < -m_overlap-\n+m_epsilon)\n+ 418 continue;\n+ 419\n+ 420 /* Normals should be opposing. */\n+ 421 if (nx*ny > m_max_normal_product + m_epsilon)\n+ 422 continue;\n+ 423\n+ 424 /* Intersection is feasible. Store it. */\n+ 425 auto& intersection = m_edge_intersections\n+[m_number_of_edge_intersections++];\n+ 426 intersection = { {{edgex, edgey}}, {{local_x, local_y}} };\n+ 427 }\n+ 428 catch(const Dune::FMatrixError&) {\n+ 429 /* Edges might be parallel, ignore and continue with next edge */\n+ 430 }\n+ 431 }\n+ 432 }\n+ 433}\n+ 434\n+ 435template\n+ 436template\n+ 437bool Projection\n+ 438::projectionFeasible(const Coordinate& x, const Coordinate& nx, const\n+Coordinate& px, const Corners& corners, const Normals& normals) const\n+ 439{\n+ 440 using namespace ProjectionImplementation;\n+ 441\n+ 442 /* Image must be within simplex. */\n+ 443 if (!inside(px, m_epsilon))\n+ 444 return false;\n+ 445\n+ 446 /* Distance along normal must not be smaller than -overlap. */\n+ 447 if (px[dim-1] < -m_overlap-m_epsilon)\n+ 448 return false;\n+ 449\n+ 450 /* Distance along normal at image must not be smaller than -overlap. */\n+ 451 auto xmy = x;\n+ 452 xmy -= interpolate(px, corners);\n+ 453 const auto n = interpolate_unit_normals(px, normals);\n+ 454 const auto d = xmy * n;\n+ 455 if (d < -m_overlap-m_epsilon)\n+ 456 return false;\n+ 457\n+ 458 /* Normals at x and \u03a6(x) are opposing. */\n+ 459 if (nx * n > m_max_normal_product + m_epsilon)\n+ 460 return false;\n+ 461\n+ 462 /* Okay, projection is feasible. */\n+ 463 return true;\n+ 464}\n+ 465\n+ 466template\n+ 467template\n+ 468void Projection\n+469::project(const std::tuple& corners, const std::\n+tuple& normals)\n+ 470{\n+ 471 doProjection(corners, normals);\n+ 472 doInverseProjection(corners, normals);\n+ 473 doEdgeIntersection(corners, normals);\n+ 474}\n+ 475\n+ 476} /* namespace GridGlue */\n+ 477} /* namespace Dune */\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::write_glue_area_vtk\n-void write_glue_area_vtk(const Glue &glue, std::ostream &out)\n-Definition: areawriter_impl.hh:84\n-Dune::GridGlue::write_glue_areas_vtk\n-void write_glue_areas_vtk(const Glue &glue, const std::string &base)\n-Definition: areawriter_impl.hh:129\n-Dune::GridGlue::intersections\n-IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<...\n-> &reverse=!reversed)\n-Iterate over all intersections of a GridGlue.\n-Dune::GridGlue::AreaWriterImplementation::write_facet_geometry\n-void write_facet_geometry(const GridView &gv, std::ostream &out)\n-Definition: areawriter_impl.hh:25\n-Dune::GridGlue::Reverse\n-Definition: rangegenerators.hh:17\n-Dune::GridGlue::AreaWriterImplementation::FacetLayout\n-Definition: areawriter_impl.hh:17\n-Dune::GridGlue::AreaWriterImplementation::FacetLayout::contains\n-bool contains(Dune::GeometryType gt) const\n-Definition: areawriter_impl.hh:18\n+Dune::GridGlue::ProjectionImplementation::interpolate\n+Corners::value_type interpolate(const Coordinate &x, const Corners &corners)\n+Definition: projection_impl.hh:70\n+Dune::GridGlue::ProjectionImplementation::inside\n+bool inside(const Coordinate &x, const Field &epsilon)\n+Definition: projection_impl.hh:111\n+Dune::GridGlue::ProjectionImplementation::edgeToCorners\n+std::pair< unsigned, unsigned > edgeToCorners(unsigned edge)\n+Definition: projection_impl.hh:43\n+Dune::GridGlue::ProjectionImplementation::corner\n+Coordinate corner(unsigned c)\n+Definition: projection_impl.hh:24\n+Dune::GridGlue::ProjectionImplementation::interpolate_unit_normals\n+Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals\n+&normals)\n+Definition: projection_impl.hh:91\n+Dune::GridGlue::Projection\n+Projection of a line (triangle) on another line (triangle).\n+Definition: projection.hh:21\n+Dune::GridGlue::Projection::Field\n+Coordinate::field_type Field\n+Scalar type.\n+Definition: projection.hh:61\n+Dune::GridGlue::Projection::Projection\n+Projection(const Field overlap=Field(0), const Field max_normal_product=Field(-\n+0.1))\n+Definition: projection_impl.hh:130\n+Dune::GridGlue::Projection::epsilon\n+void epsilon(const Field epsilon)\n+Set epsilon used for floating-point comparisons.\n+Definition: projection_impl.hh:140\n+Dune::GridGlue::Projection::project\n+void project(const std::tuple< Corners &, Corners & > &corners, const std::\n+tuple< Normals &, Normals & > &normals)\n+Do the actual projection.\n+Definition: projection_impl.hh:469\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html", "unified_diff": "@@ -71,15 +71,15 @@\n Namespaces \n
    projection.hh File Reference
    \n \n
    \n
    #include <array>
    \n #include <bitset>
    \n #include <tuple>
    \n-#include "projection_impl.hh"
    \n+#include "projection_impl.hh"
    \n
    \n

    Go to the source code of this file.

    \n \n \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041_source.html", "unified_diff": "@@ -153,18 +153,18 @@\n
    273 const std::array<EdgeIntersection, maxEdgeIntersections>& edgeIntersections() const
    \n
    274 { return m_edge_intersections; }
    \n
    275};
    \n
    276
    \n
    277} /* namespace GridGlue */
    \n
    278} /* namespace Dune */
    \n
    279
    \n-
    280#include "projection_impl.hh"
    \n+
    280#include "projection_impl.hh"
    \n
    281
    \n
    282#endif
    \n-\n+\n
    Definition: gridglue.hh:37
    \n
    Projection of a line (triangle) on another line (triangle).
    Definition: projection.hh:21
    \n
    Coordinate::field_type Field
    Scalar type.
    Definition: projection.hh:61
    \n
    Projection(const Field overlap=Field(0), const Field max_normal_product=Field(-0.1))
    Definition: projection_impl.hh:130
    \n
    const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const
    Indicate whether projection (inverse projection) is valid for each corner or not.
    Definition: projection.hh:252
    \n
    static constexpr unsigned maxEdgeIntersections
    maximum number of edge-edge intersections
    Definition: projection.hh:54
    \n
    Images Preimages
    Definition: projection.hh:78
    \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: ringcomm.hh File Reference\n+dune-grid-glue: projectionwriter.hh File Reference\n \n \n \n \n \n \n \n@@ -64,77 +64,47 @@\n \n \n \n
    \n \n-
    ringcomm.hh File Reference
    \n+
    projectionwriter.hh File Reference
    \n
    \n
    \n-
    #include <mpi.h>
    \n-#include <functional>
    \n-#include <utility>
    \n-#include <dune/common/fvector.hh>
    \n-#include <dune/common/hybridutilities.hh>
    \n-#include <dune/geometry/type.hh>
    \n+
    #include <iostream>
    \n+#include <string>
    \n+#include <dune/grid-glue/common/projection.hh>
    \n+#include "projectionwriter_impl.hh"
    \n
    \n

    Go to the source code of this file.

    \n

    \n Classes

    class  Dune::GridGlue::Projection< Coordinate >
     Projection of a line (triangle) on another line (triangle). More...
    \n \n \n \n-\n+\n \n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::Parallel
    namespace  Dune::GridGlue
     
    \n-\n-\n-\n-

    \n-Macros

    #define CheckMPIStatus(A, B)   {}
     
    \n \n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n Functions

    template<typename OP , typename... Args>
    void Dune::Parallel::MPI_AllApply (MPI_Comm mpicomm, OP &&op, const Args &... data)
     apply an operator locally to a difstributed data set More...
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::write (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, std::ostream &out)
     write projection in VTK format More...
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::write (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, const std::string &filename)
     write projection in VTK format More...
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::print (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)
     Print information about the projection to std::cout stream. More...
     
    \n-

    Macro Definition Documentation

    \n-\n-

    ◆ CheckMPIStatus

    \n-\n-
    \n-
    \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
    #define CheckMPIStatus( A,
     
    )   {}
    \n-
    \n-
    Todo:
    Implement MPI Status check with exception handling
    \n-\n-
    \n-
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,40 +5,38 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-Namespaces | Macros | Functions\n-ringcomm.hh File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+Namespaces | Functions\n+projectionwriter.hh File Reference\n+#include \n+#include \n+#include \n+#include \"projectionwriter_impl.hh\"\n Go_to_the_source_code_of_this_file.\n Namespaces\n namespace \u00a0Dune\n \u00a0\n-namespace \u00a0Dune::Parallel\n-\u00a0\n- Macros\n-#define\u00a0CheckMPIStatus(A, B)\u00a0\u00a0\u00a0{}\n+namespace \u00a0Dune::GridGlue\n \u00a0\n Functions\n-template\n-void\u00a0Dune::Parallel::MPI_AllApply (MPI_Comm mpicomm, OP &&op, const Args &...\n- data)\n-\u00a0 apply an operator locally to a difstributed data set More...\n+template\n+void\u00a0Dune::GridGlue::write (const Projection< Coordinate > &projection, const\n+ Corners &corners, const Normals &normals, std::ostream &out)\n+\u00a0 write projection in VTK format More...\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::write (const Projection< Coordinate > &projection, const\n+ Corners &corners, const Normals &normals, const std::string &filename)\n+\u00a0 write projection in VTK format More...\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::print (const Projection< Coordinate > &projection, const\n+ Corners &corners, const Normals &normals)\n+\u00a0 Print information about the projection to std::cout stream. More...\n \u00a0\n-***** Macro Definition Documentation *****\n-***** \u25c6\u00a0CheckMPIStatus *****\n-#define CheckMPIStatus ( \u00a0A,\n- \u00a0B\u00a0\n- ) \u00a0\u00a0\u00a0{}\n- Todo:\n- Implement MPI Status check with exception handling\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: ringcomm.hh Source File\n+dune-grid-glue: projectionwriter.hh Source File\n \n \n \n \n \n \n \n@@ -62,305 +62,57 @@\n \n \n \n
    \n-
    ringcomm.hh
    \n+
    projectionwriter.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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n-
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    5/* IMPLEMENTATION OF CLASS G R I D G L U E */
    \n-
    6
    \n-
    8#define CheckMPIStatus(A,B) {}
    \n-
    9
    \n-
    10#include <mpi.h>
    \n-
    11#include <functional>
    \n-
    12#include <utility>
    \n+Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n+
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n+
    3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
    \n+
    4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
    \n+
    5
    \n+
    6#include <iostream>
    \n+
    7#include <string>
    \n+
    8
    \n+\n+
    10
    \n+
    11namespace Dune {
    \n+
    12namespace GridGlue {
    \n
    13
    \n-
    14#include <dune/common/fvector.hh>
    \n-
    15#include <dune/common/hybridutilities.hh>
    \n-
    16
    \n-
    17#include <dune/geometry/type.hh>
    \n-
    18
    \n-
    19namespace Dune {
    \n-
    20namespace Parallel {
    \n-
    21
    \n-
    22 namespace Impl {
    \n-
    23
    \n-
    25 template<typename T>
    \n-
    26 struct MPITypeInfo {};
    \n-
    27
    \n-
    28 template<>
    \n-
    29 struct MPITypeInfo< int >
    \n-
    30 {
    \n-
    31 static const unsigned int size = 1;
    \n-
    32 static inline MPI_Datatype getType()
    \n-
    33 {
    \n-
    34 return MPI_INT;
    \n-
    35 }
    \n-
    36 };
    \n-
    37
    \n-
    38 template<typename K, int N>
    \n-
    39 struct MPITypeInfo< Dune::FieldVector<K,N> >
    \n-
    40 {
    \n-
    41 static const unsigned int size = N;
    \n-
    42 static inline MPI_Datatype getType()
    \n-
    43 {
    \n-
    44 return Dune::MPITraits<K>::getType();
    \n-
    45 }
    \n-
    46 };
    \n-
    47
    \n-
    48 template<>
    \n-
    49 struct MPITypeInfo< unsigned int >
    \n-
    50 {
    \n-
    51 static const unsigned int size = 1;
    \n-
    52 static inline MPI_Datatype getType()
    \n-
    53 {
    \n-
    54 return MPI_UNSIGNED;
    \n-
    55 }
    \n-
    56 };
    \n-
    57
    \n-
    58 template<>
    \n-
    59 struct MPITypeInfo< Dune::GeometryType >
    \n-
    60 {
    \n-
    61 static const unsigned int size = 1;
    \n-
    62 static inline MPI_Datatype getType()
    \n-
    63 {
    \n-
    64 return Dune::MPITraits< Dune::GeometryType >::getType();
    \n-
    65 }
    \n-
    66 };
    \n-
    67
    \n-
    68 template<typename T>
    \n-
    69 void MPI_SetVectorSize(
    \n-
    70 std::vector<T> & data,
    \n-
    71 MPI_Status & status)
    \n-
    72 {
    \n-
    73 typedef MPITypeInfo<T> Info;
    \n-
    74 int sz;
    \n-
    75 MPI_Get_count(&status, Info::getType(), &sz);
    \n-
    76 assert(sz%Info::size == 0);
    \n-
    77 data.resize(sz/Info::size);
    \n-
    78 }
    \n-
    79
    \n-
    89 template<typename T>
    \n-
    90 void MPI_SendVectorInRing(
    \n-
    91 std::vector<T> & data,
    \n-
    92 std::vector<T> & next,
    \n-
    93 int tag,
    \n-
    94 int rightrank,
    \n-
    95 int leftrank,
    \n-
    96 MPI_Comm comm,
    \n-
    97 MPI_Request& r_send,
    \n-
    98 MPI_Request& r_recv
    \n-
    99 )
    \n-
    100 {
    \n-
    101 // mpi status stuff
    \n-
    102 [[maybe_unused]] int result = 0;
    \n-
    103 typedef MPITypeInfo<T> Info;
    \n-
    104 // resize next buffer to maximum size
    \n-
    105 next.resize(next.capacity());
    \n-
    106 // send data (explicitly send data.size elements)
    \n-
    107 result =
    \n-
    108 MPI_Isend(
    \n-
    109 &(data[0]), Info::size*data.size(), Info::getType(), rightrank, tag,
    \n-
    110 comm, &r_send);
    \n-
    111 // receive up to maximum size. The acutal size is stored in the status
    \n-
    112 result =
    \n-
    113 MPI_Irecv(
    \n-
    114 &(next[0]), Info::size*next.size(), Info::getType(), leftrank, tag,
    \n-
    115 comm, &r_recv);
    \n-
    116 // // check result
    \n-
    117 // MPI_Status status;
    \n-
    118 // CheckMPIStatus(result, status);
    \n-
    119 }
    \n-
    120
    \n-
    121 template<typename T>
    \n-
    122 using ptr_t = T*;
    \n-
    123
    \n-
    124 /* these helper structs are needed as long as we still support
    \n-
    125 C++11, as we can't use variadic lambdas */
    \n-
    126 template<typename... Args>
    \n-
    127 struct call_MPI_SendVectorInRing
    \n-
    128 {
    \n-
    129 std::tuple<Args...> & remotedata;
    \n-
    130 std::tuple<Args...> & nextdata;
    \n-
    131 int & tag;
    \n-
    132 int & rightrank;
    \n-
    133 int & leftrank;
    \n-
    134 MPI_Comm & mpicomm;
    \n-
    135 std::array<MPI_Request,sizeof...(Args)> & requests_send;
    \n-
    136 std::array<MPI_Request,sizeof...(Args)> & requests_recv;
    \n-
    137
    \n-
    138 template<typename I>
    \n-
    139 void operator()(I i)
    \n-
    140 {
    \n-
    141 MPI_SendVectorInRing(
    \n-
    142 std::get<i>(remotedata),
    \n-
    143 std::get<i>(nextdata),
    \n-
    144 tag+i,
    \n-
    145 rightrank, leftrank, mpicomm,
    \n-
    146 requests_send[i],
    \n-
    147 requests_recv[i]);
    \n-
    148 }
    \n-
    149 };
    \n-
    150 template<typename... Args>
    \n-
    151 struct call_MPI_SetVectorSize
    \n-
    152 {
    \n-
    153 std::tuple<Args...> & nextdata;
    \n-
    154 std::array<MPI_Status,sizeof...(Args)> & status_recv;
    \n-
    155
    \n-
    156 template<typename I>
    \n-
    157 void operator()(I i)
    \n-
    158 {
    \n-
    159 MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
    \n-
    160 }
    \n-
    161 };
    \n-
    162
    \n-
    163 template<typename OP, std::size_t... Indices, typename... Args>
    \n-
    164 void MPI_AllApply_impl(MPI_Comm mpicomm,
    \n-
    165 OP && op,
    \n-
    166 std::index_sequence<Indices...> indices,
    \n-
    167 const Args&... data)
    \n-
    168 {
    \n-
    169 constexpr std::size_t N = sizeof...(Args);
    \n-
    170 int myrank = 0;
    \n-
    171 int commsize = 0;
    \n-
    172#if HAVE_MPI
    \n-
    173 MPI_Comm_rank(mpicomm, &myrank);
    \n-
    174 MPI_Comm_size(mpicomm, &commsize);
    \n-
    175#endif // HAVE_MPI
    \n-
    176
    \n-
    177 if (commsize > 1)
    \n-
    178 {
    \n-
    179#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
    \n-
    180 std::cout << myrank << " Start Communication, size " << commsize << std::endl;
    \n-
    181#endif
    \n-
    182
    \n-
    183 // get data sizes
    \n-
    184 std::array<unsigned int, N> size({ ((unsigned int)data.size())... });
    \n-
    185
    \n-
    186 // communicate max data size
    \n-
    187 std::array<unsigned int, N> maxSize;
    \n-
    188 MPI_Allreduce(&size, &maxSize,
    \n-
    189 size.size(), MPI_UNSIGNED, MPI_MAX, mpicomm);
    \n-
    190#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
    \n-
    191 std::cout << myrank << " maxSize " << "done... " << std::endl;
    \n-
    192#endif
    \n-
    193
    \n-
    194 // allocate receiving buffers with maxsize to ensure sufficient buffer size for communication
    \n-
    195 std::tuple<Args...> remotedata { Args(maxSize[Indices])... };
    \n-
    196
    \n-
    197 // copy local data to receiving buffer
    \n-
    198 remotedata = std::tie(data...);
    \n-
    199
    \n-
    200 // allocate second set of receiving buffers necessary for async communication
    \n-
    201 std::tuple<Args...> nextdata { Args(maxSize[Indices])... };
    \n-
    202
    \n-
    203 // communicate data in the ring
    \n-
    204 int rightrank = (myrank + 1 + commsize) % commsize;
    \n-
    205 int leftrank = (myrank - 1 + commsize) % commsize;
    \n-
    206
    \n-
    207 std::cout << myrank << ": size = " << commsize << std::endl;
    \n-
    208 std::cout << myrank << ": left = " << leftrank
    \n-
    209 << " right = " << rightrank << std::endl;
    \n-
    210
    \n-
    211 // currently the remote data is our own data
    \n-
    212 int remoterank = myrank;
    \n-
    213
    \n-
    214 for (int i=1; i<commsize; i++)
    \n-
    215 {
    \n-
    216 // in this iteration we will receive data from nextrank
    \n-
    217 int nextrank = (myrank - i + commsize) % commsize;
    \n-
    218
    \n-
    219 std::cout << myrank << ": next = " << nextrank << std::endl;
    \n-
    220
    \n-
    221 // send remote data to right neighbor and receive from left neighbor
    \n-
    222 std::array<MPI_Request,N> requests_send;
    \n-
    223 std::array<MPI_Request,N> requests_recv;
    \n-
    224
    \n-
    225 int tag = 0;
    \n-
    226 Dune::Hybrid::forEach(indices,
    \n-
    227 // [&](auto i){
    \n-
    228 // MPI_SendVectorInRing(
    \n-
    229 // std::get<i>(remotedata),
    \n-
    230 // std::get<i>(nextdata),
    \n-
    231 // tag+i,
    \n-
    232 // rightrank, leftrank, mpicomm,
    \n-
    233 // requests_send[i],
    \n-
    234 // requests_recv[i]);
    \n-
    235 // });
    \n-
    236 call_MPI_SendVectorInRing<Args...>({
    \n-
    237 remotedata,
    \n-
    238 nextdata,
    \n-
    239 tag,
    \n-
    240 rightrank, leftrank, mpicomm,
    \n-
    241 requests_send,
    \n-
    242 requests_recv
    \n-
    243 }));
    \n-
    244
    \n-
    245 // apply operator
    \n-
    246 op(remoterank,std::get<Indices>(remotedata)...);
    \n-
    247
    \n-
    248 // wait for communication to finalize
    \n-
    249 std::array<MPI_Status,N> status_send;
    \n-
    250 std::array<MPI_Status,N> status_recv;
    \n-
    251 MPI_Waitall(N,&requests_recv[0],&status_recv[0]);
    \n-
    252
    \n-
    253 // we finished receiving from nextrank and thus remoterank = nextrank
    \n-
    254 remoterank = nextrank;
    \n-
    255
    \n-
    256 // get current data sizes
    \n-
    257 // and resize vectors
    \n-
    258 Dune::Hybrid::forEach(indices,
    \n-
    259 // [&](auto i){
    \n-
    260 // MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
    \n-
    261 // });
    \n-
    262 call_MPI_SetVectorSize<Args...>({
    \n-
    263 nextdata, status_recv
    \n-
    264 }));
    \n-
    265
    \n-
    266 MPI_Waitall(N,&requests_send[0],&status_send[0]);
    \n-
    267
    \n-
    268 // swap the communication buffers
    \n-
    269 std::swap(remotedata,nextdata);
    \n-
    270 }
    \n-
    271
    \n-
    272 // last apply (or the only one in the case of sequential application)
    \n-
    273 op(remoterank,std::get<Indices>(remotedata)...);
    \n-
    274 }
    \n-
    275 else // sequential
    \n-
    276 {
    \n-
    277 op(myrank,data...);
    \n-
    278 }
    \n-
    279 }
    \n-
    280
    \n-
    281 } // end namespace Impl
    \n-
    282
    \n-
    296template<typename OP, typename... Args>
    \n-
    297void MPI_AllApply(MPI_Comm mpicomm,
    \n-
    298 OP && op,
    \n-
    299 const Args& ... data)
    \n-
    300{
    \n-
    301 Impl::MPI_AllApply_impl(
    \n-
    302 mpicomm,
    \n-
    303 std::forward<OP>(op),
    \n-
    304 std::make_index_sequence<sizeof...(Args)>(),
    \n-
    305 data...
    \n-
    306 );
    \n-
    307}
    \n-
    308
    \n-
    309} // end namespace Parallel
    \n-
    310} // end namespace Dune
    \n+
    28template<typename Coordinate, typename Corners, typename Normals>
    \n+
    29void write(const Projection<Coordinate>& projection,
    \n+
    30 const Corners& corners,
    \n+
    31 const Normals& normals,
    \n+
    32 std::ostream& out);
    \n+
    33
    \n+
    40template<typename Coordinate, typename Corners, typename Normals>
    \n+
    41void write(const Projection<Coordinate>& projection,
    \n+
    42 const Corners& corners,
    \n+
    43 const Normals& normals,
    \n+
    44 const std::string& filename);
    \n+
    54template<typename Coordinate, typename Corners, typename Normals>
    \n+
    55void print(const Projection<Coordinate>& projection,
    \n+
    56 const Corners& corners,
    \n+
    57 const Normals& normals);
    \n+
    58
    \n+
    59} /* namespace GridGlue */
    \n+
    60} /* namespace Dune */
    \n+
    61
    \n+\n+
    63
    \n+
    64#endif
    \n+\n+\n
    Definition: gridglue.hh:37
    \n-
    void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data)
    apply an operator locally to a difstributed data set
    Definition: ringcomm.hh:297
    \n+
    void write(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, std::ostream &out)
    write projection in VTK format
    Definition: projectionwriter_impl.hh:86
    \n+
    void print(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)
    Print information about the projection to std::cout stream.
    Definition: projectionwriter_impl.hh:140
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,309 +5,63 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-ringcomm.hh\n+projectionwriter.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 \u00a9 DUNE Project contributors, see file\n+ 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n- 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n+ 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 5/* IMPLEMENTATION OF CLASS G R I D G L U E */\n- 6\n-8#define CheckMPIStatus(A,B) {}\n- 9\n- 10#include \n- 11#include \n- 12#include \n+ 3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH\n+ 4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH\n+ 5\n+ 6#include \n+ 7#include \n+ 8\n+ 9#include \n+ 10\n+ 11namespace Dune {\n+ 12namespace GridGlue {\n 13\n- 14#include \n- 15#include \n- 16\n- 17#include \n- 18\n- 19namespace Dune {\n-20namespace Parallel {\n- 21\n- 22 namespace Impl {\n- 23\n- 25 template\n- 26 struct MPITypeInfo {};\n- 27\n- 28 template<>\n- 29 struct MPITypeInfo< int >\n- 30 {\n- 31 static const unsigned int size = 1;\n- 32 static inline MPI_Datatype getType()\n- 33 {\n- 34 return MPI_INT;\n- 35 }\n- 36 };\n- 37\n- 38 template\n- 39 struct MPITypeInfo< Dune::FieldVector >\n- 40 {\n- 41 static const unsigned int size = N;\n- 42 static inline MPI_Datatype getType()\n- 43 {\n- 44 return Dune::MPITraits::getType();\n- 45 }\n- 46 };\n- 47\n- 48 template<>\n- 49 struct MPITypeInfo< unsigned int >\n- 50 {\n- 51 static const unsigned int size = 1;\n- 52 static inline MPI_Datatype getType()\n- 53 {\n- 54 return MPI_UNSIGNED;\n- 55 }\n- 56 };\n- 57\n- 58 template<>\n- 59 struct MPITypeInfo< Dune::GeometryType >\n- 60 {\n- 61 static const unsigned int size = 1;\n- 62 static inline MPI_Datatype getType()\n- 63 {\n- 64 return Dune::MPITraits< Dune::GeometryType >::getType();\n- 65 }\n- 66 };\n- 67\n- 68 template\n- 69 void MPI_SetVectorSize(\n- 70 std::vector & data,\n- 71 MPI_Status & status)\n- 72 {\n- 73 typedef MPITypeInfo Info;\n- 74 int sz;\n- 75 MPI_Get_count(&status, Info::getType(), &sz);\n- 76 assert(sz%Info::size == 0);\n- 77 data.resize(sz/Info::size);\n- 78 }\n- 79\n- 89 template\n- 90 void MPI_SendVectorInRing(\n- 91 std::vector & data,\n- 92 std::vector & next,\n- 93 int tag,\n- 94 int rightrank,\n- 95 int leftrank,\n- 96 MPI_Comm comm,\n- 97 MPI_Request& r_send,\n- 98 MPI_Request& r_recv\n- 99 )\n- 100 {\n- 101 // mpi status stuff\n- 102 [[maybe_unused]] int result = 0;\n- 103 typedef MPITypeInfo Info;\n- 104 // resize next buffer to maximum size\n- 105 next.resize(next.capacity());\n- 106 // send data (explicitly send data.size elements)\n- 107 result =\n- 108 MPI_Isend(\n- 109 &(data[0]), Info::size*data.size(), Info::getType(), rightrank, tag,\n- 110 comm, &r_send);\n- 111 // receive up to maximum size. The acutal size is stored in the status\n- 112 result =\n- 113 MPI_Irecv(\n- 114 &(next[0]), Info::size*next.size(), Info::getType(), leftrank, tag,\n- 115 comm, &r_recv);\n- 116 // // check result\n- 117 // MPI_Status status;\n- 118 // CheckMPIStatus(result, status);\n- 119 }\n- 120\n- 121 template\n- 122 using ptr_t = T*;\n- 123\n- 124 /* these helper structs are needed as long as we still support\n- 125 C++11, as we can't use variadic lambdas */\n- 126 template\n- 127 struct call_MPI_SendVectorInRing\n- 128 {\n- 129 std::tuple & remotedata;\n- 130 std::tuple & nextdata;\n- 131 int & tag;\n- 132 int & rightrank;\n- 133 int & leftrank;\n- 134 MPI_Comm & mpicomm;\n- 135 std::array & requests_send;\n- 136 std::array & requests_recv;\n- 137\n- 138 template\n- 139 void operator()(I i)\n- 140 {\n- 141 MPI_SendVectorInRing(\n- 142 std::get(remotedata),\n- 143 std::get(nextdata),\n- 144 tag+i,\n- 145 rightrank, leftrank, mpicomm,\n- 146 requests_send[i],\n- 147 requests_recv[i]);\n- 148 }\n- 149 };\n- 150 template\n- 151 struct call_MPI_SetVectorSize\n- 152 {\n- 153 std::tuple & nextdata;\n- 154 std::array & status_recv;\n- 155\n- 156 template\n- 157 void operator()(I i)\n- 158 {\n- 159 MPI_SetVectorSize(std::get(nextdata),status_recv[i]);\n- 160 }\n- 161 };\n- 162\n- 163 template\n- 164 void MPI_AllApply_impl(MPI_Comm mpicomm,\n- 165 OP && op,\n- 166 std::index_sequence indices,\n- 167 const Args&... data)\n- 168 {\n- 169 constexpr std::size_t N = sizeof...(Args);\n- 170 int myrank = 0;\n- 171 int commsize = 0;\n- 172#if HAVE_MPI\n- 173 MPI_Comm_rank(mpicomm, &myrank);\n- 174 MPI_Comm_size(mpicomm, &commsize);\n- 175#endif // HAVE_MPI\n- 176\n- 177 if (commsize > 1)\n- 178 {\n- 179#ifdef DEBUG_GRIDGLUE_PARALLELMERGE\n- 180 std::cout << myrank << \" Start Communication, size \" << commsize << std::\n-endl;\n- 181#endif\n- 182\n- 183 // get data sizes\n- 184 std::array size({ ((unsigned int)data.size())... });\n- 185\n- 186 // communicate max data size\n- 187 std::array maxSize;\n- 188 MPI_Allreduce(&size, &maxSize,\n- 189 size.size(), MPI_UNSIGNED, MPI_MAX, mpicomm);\n- 190#ifdef DEBUG_GRIDGLUE_PARALLELMERGE\n- 191 std::cout << myrank << \" maxSize \" << \"done... \" << std::endl;\n- 192#endif\n- 193\n- 194 // allocate receiving buffers with maxsize to ensure sufficient buffer\n-size for communication\n- 195 std::tuple remotedata { Args(maxSize[Indices])... };\n- 196\n- 197 // copy local data to receiving buffer\n- 198 remotedata = std::tie(data...);\n- 199\n- 200 // allocate second set of receiving buffers necessary for async\n-communication\n- 201 std::tuple nextdata { Args(maxSize[Indices])... };\n- 202\n- 203 // communicate data in the ring\n- 204 int rightrank = (myrank + 1 + commsize) % commsize;\n- 205 int leftrank = (myrank - 1 + commsize) % commsize;\n- 206\n- 207 std::cout << myrank << \": size = \" << commsize << std::endl;\n- 208 std::cout << myrank << \": left = \" << leftrank\n- 209 << \" right = \" << rightrank << std::endl;\n- 210\n- 211 // currently the remote data is our own data\n- 212 int remoterank = myrank;\n- 213\n- 214 for (int i=1; i requests_send;\n- 223 std::array requests_recv;\n- 224\n- 225 int tag = 0;\n- 226 Dune::Hybrid::forEach(indices,\n- 227 // [&](auto i){\n- 228 // MPI_SendVectorInRing(\n- 229 // std::get(remotedata),\n- 230 // std::get(nextdata),\n- 231 // tag+i,\n- 232 // rightrank, leftrank, mpicomm,\n- 233 // requests_send[i],\n- 234 // requests_recv[i]);\n- 235 // });\n- 236 call_MPI_SendVectorInRing({\n- 237 remotedata,\n- 238 nextdata,\n- 239 tag,\n- 240 rightrank, leftrank, mpicomm,\n- 241 requests_send,\n- 242 requests_recv\n- 243 }));\n- 244\n- 245 // apply operator\n- 246 op(remoterank,std::get(remotedata)...);\n- 247\n- 248 // wait for communication to finalize\n- 249 std::array status_send;\n- 250 std::array status_recv;\n- 251 MPI_Waitall(N,&requests_recv[0],&status_recv[0]);\n- 252\n- 253 // we finished receiving from nextrank and thus remoterank = nextrank\n- 254 remoterank = nextrank;\n- 255\n- 256 // get current data sizes\n- 257 // and resize vectors\n- 258 Dune::Hybrid::forEach(indices,\n- 259 // [&](auto i){\n- 260 // MPI_SetVectorSize(std::get(nextdata),status_recv[i]);\n- 261 // });\n- 262 call_MPI_SetVectorSize({\n- 263 nextdata, status_recv\n- 264 }));\n- 265\n- 266 MPI_Waitall(N,&requests_send[0],&status_send[0]);\n- 267\n- 268 // swap the communication buffers\n- 269 std::swap(remotedata,nextdata);\n- 270 }\n- 271\n- 272 // last apply (or the only one in the case of sequential application)\n- 273 op(remoterank,std::get(remotedata)...);\n- 274 }\n- 275 else // sequential\n- 276 {\n- 277 op(myrank,data...);\n- 278 }\n- 279 }\n- 280\n- 281 } // end namespace Impl\n- 282\n- 296template\n-297void MPI_AllApply(MPI_Comm mpicomm,\n- 298 OP && op,\n- 299 const Args& ... data)\n- 300{\n- 301 Impl::MPI_AllApply_impl(\n- 302 mpicomm,\n- 303 std::forward(op),\n- 304 std::make_index_sequence(),\n- 305 data...\n- 306 );\n- 307}\n- 308\n- 309} // end namespace Parallel\n- 310} // end namespace Dune\n+ 28template\n+ 29void write(const Projection& projection,\n+ 30 const Corners& corners,\n+ 31 const Normals& normals,\n+ 32 std::ostream& out);\n+ 33\n+ 40template\n+ 41void write(const Projection& projection,\n+ 42 const Corners& corners,\n+ 43 const Normals& normals,\n+ 44 const std::string& filename);\n+ 54template\n+ 55void print(const Projection& projection,\n+ 56 const Corners& corners,\n+ 57 const Normals& normals);\n+ 58\n+ 59} /* namespace GridGlue */\n+ 60} /* namespace Dune */\n+ 61\n+ 62#include \"projectionwriter_impl.hh\"\n+ 63\n+ 64#endif\n+projection.hh\n+projectionwriter_impl.hh\n Dune\n Definition: gridglue.hh:37\n-Dune::Parallel::MPI_AllApply\n-void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data)\n-apply an operator locally to a difstributed data set\n-Definition: ringcomm.hh:297\n+Dune::GridGlue::write\n+void write(const Projection< Coordinate > &projection, const Corners &corners,\n+const Normals &normals, std::ostream &out)\n+write projection in VTK format\n+Definition: projectionwriter_impl.hh:86\n+Dune::GridGlue::print\n+void print(const Projection< Coordinate > &projection, const Corners &corners,\n+const Normals &normals)\n+Print information about the projection to std::cout stream.\n+Definition: projectionwriter_impl.hh:140\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: projection_impl.hh File Reference\n+dune-grid-glue: areawriter.hh File Reference\n \n \n \n \n \n \n \n@@ -65,47 +65,41 @@\n
  • dune
  • grid-glue
  • common
  • \n
    \n \n
    \n \n-
    projection_impl.hh File Reference
    \n+
    areawriter.hh File Reference
    \n
    \n
    \n-
    #include <dune/common/fmatrix.hh>
    \n-#include <cmath>
    \n+
    #include <ostream>
    \n+#include <string>
    \n+#include "areawriter_impl.hh"
    \n
    \n

    Go to the source code of this file.

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

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    namespace  Dune::GridGlue::ProjectionImplementation
     
    \n \n-\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 Coordinate , typename Field >
    Coordinate Dune::GridGlue::ProjectionImplementation::corner (unsigned c)
     
    std::pair< unsigned, unsigned > Dune::GridGlue::ProjectionImplementation::edgeToCorners (unsigned edge)
     
    template<typename Coordinate , typename Corners >
    Corners::value_type Dune::GridGlue::ProjectionImplementation::interpolate (const Coordinate &x, const Corners &corners)
     
    template<typename Coordinate , typename Normals >
    Normals::value_type Dune::GridGlue::ProjectionImplementation::interpolate_unit_normals (const Coordinate &x, const Normals &normals)
     
    template<typename Coordinate , typename Field >
    bool Dune::GridGlue::ProjectionImplementation::inside (const Coordinate &x, const Field &epsilon)
     
    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)
     
    template<int side, typename Glue >
    void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string &filename)
     
    template<typename Glue >
    void Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string &base)
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -6,44 +6,32 @@\n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n Namespaces | Functions\n-projection_impl.hh File Reference\n-#include \n-#include \n+areawriter.hh File Reference\n+#include \n+#include \n+#include \"areawriter_impl.hh\"\n Go_to_the_source_code_of_this_file.\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n-namespace \u00a0Dune::GridGlue::ProjectionImplementation\n-\u00a0\n Functions\n-template\n- Coordinate\u00a0Dune::GridGlue::ProjectionImplementation::\n- corner (unsigned c)\n-\u00a0\n-std::pair< unsigned, unsigned >\u00a0Dune::GridGlue::ProjectionImplementation::\n- edgeToCorners (unsigned edge)\n-\u00a0\n-template\n- Corners::value_type\u00a0Dune::GridGlue::ProjectionImplementation::\n- interpolate (const Coordinate &x, const\n- Corners &corners)\n-\u00a0\n-template\n- Normals::value_type\u00a0Dune::GridGlue::ProjectionImplementation::\n- interpolate_unit_normals (const Coordinate &x,\n- const Normals &normals)\n+template\n+void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)\n \u00a0\n-template\n- bool\u00a0Dune::GridGlue::ProjectionImplementation::\n- inside (const Coordinate &x, const Field\n- &epsilon)\n+template\n+void\u00a0Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string\n+ &filename)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string\n+ &base)\n \u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: projection_impl.hh Source File\n+dune-grid-glue: areawriter.hh Source File\n \n \n \n \n \n \n \n@@ -62,449 +62,47 @@\n \n \n
    \n
    \n-
    projection_impl.hh
    \n+
    areawriter.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    3#include <dune/common/fmatrix.hh>
    \n-
    4
    \n-
    5#include <cmath>
    \n-
    6
    \n-
    7namespace Dune {
    \n-
    8namespace GridGlue {
    \n-
    9
    \n-
    10namespace ProjectionImplementation {
    \n+
    3#ifndef DUNE_GRIDGLUE_COMMON_AREAWRITER_HH
    \n+
    4#define DUNE_GRIDGLUE_COMMON_AREAWRITER_HH
    \n+
    5
    \n+
    6#include <ostream>
    \n+
    7#include <string>
    \n+
    8
    \n+
    9namespace Dune {
    \n+
    10namespace GridGlue {
    \n
    11
    \n-
    22template<typename Coordinate, typename Field>
    \n-
    23inline Coordinate
    \n-
    24corner(unsigned c)
    \n-
    25{
    \n-
    26 Coordinate x(Field(0));
    \n-
    27 if (c == 0)
    \n-
    28 return x;
    \n-
    29 x[c-1] = Field(1);
    \n-
    30 return x;
    \n-
    31}
    \n-
    32
    \n-
    42inline std::pair<unsigned, unsigned>
    \n-
    43edgeToCorners(unsigned edge)
    \n-
    44{
    \n-
    45 switch(edge) {
    \n-
    46 case 0: return {0, 1};
    \n-
    47 case 1: return {0, 2};
    \n-
    48 case 2: return {1, 2};
    \n-
    49 }
    \n-
    50 DUNE_THROW(Dune::Exception, "Unexpected edge number.");
    \n-
    51}
    \n-
    52
    \n-
    68template<typename Coordinate, typename Corners>
    \n-
    69inline typename Corners::value_type
    \n-
    70interpolate(const Coordinate& x, const Corners& corners)
    \n-
    71{
    \n-
    72 auto y = corners[0];
    \n-
    73 for (unsigned i = 0; i < corners.size() - 1; ++i)
    \n-
    74 y.axpy(x[i], corners[i+1] - corners[0]);
    \n-
    75 return y;
    \n-
    76}
    \n-
    77
    \n-
    89template<typename Coordinate, typename Normals>
    \n-
    90inline typename Normals::value_type
    \n-
    91interpolate_unit_normals(const Coordinate& x, const Normals& normals)
    \n-
    92{
    \n-
    93 auto n = interpolate(x, normals);
    \n-
    94 n /= n.two_norm();
    \n-
    95 return n;
    \n-
    96}
    \n-
    97
    \n-
    109template<typename Coordinate, typename Field>
    \n-
    110inline bool
    \n-
    111inside(const Coordinate& x, const Field& epsilon)
    \n-
    112{
    \n-
    113 const unsigned dim = Coordinate::dimension;
    \n-
    114 Field sum(0);
    \n-
    115 for (unsigned i = 0; i < dim-1; ++i) {
    \n-
    116 if (x[i] < -epsilon)
    \n-
    117 return false;
    \n-
    118 sum += x[i];
    \n-
    119 }
    \n-
    120 /* If any x\u1d62 is NaN, sum will be NaN and this comparison false! */
    \n-
    121 if (sum <= Field(1) + epsilon)
    \n-
    122 return true;
    \n-
    123 return false;
    \n-
    124}
    \n-
    125
    \n-
    126} /* namespace ProjectionImplementation */
    \n-
    127
    \n-
    128template<typename Coordinate>
    \n-\n-
    130::Projection(const Field overlap, const Field max_normal_product)
    \n-
    131 : m_overlap(overlap)
    \n-
    132 , m_max_normal_product(max_normal_product)
    \n-
    133{
    \n-
    134 /* Nothing. */
    \n-
    135}
    \n-
    136
    \n-
    137template<typename Coordinate>
    \n-
    138void
    \n-\n-
    140::epsilon(const Field epsilon)
    \n-
    141{
    \n-
    142 m_epsilon = epsilon;
    \n-
    143}
    \n-
    144
    \n-
    145template<typename Coordinate>
    \n-
    146template<typename Corners, typename Normals>
    \n-
    147void
    \n-\n-
    149::doProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n-
    150{
    \n-
    151 /* Try to obtain \u03a6(x\u1d62) for each corner x\u1d62 of the preimage triangle.
    \n-
    152 * This means solving a linear system of equations
    \n-
    153 * \u03a6(x\u1d62) = (1-\u03b1-\u03b2) y\u2080 + \u03b1 y\u2081 + \u03b2 y\u2082 = x\u1d62 + \u03b4 n\u1d62
    \n-
    154 * or \u03b1 (y\u2081 - y\u2080) + \u03b2 (y\u2082 - y\u2080) - \u03b4 n\u1d62 = x\u1d62 - y\u2080
    \n-
    155 * to obtain the barycentric coordinates (\u03b1, \u03b2) of \u03a6(x\u1d62) in the image
    \n-
    156 * triangle and the distance \u03b4.
    \n-
    157 *
    \n-
    158 * In the matrix m corresponding to the system, only the third column and the
    \n-
    159 * right-hand side depend on i. The first two columns can be assembled before
    \n-
    160 * and reused.
    \n-
    161 */
    \n-
    162 using namespace ProjectionImplementation;
    \n-
    163 using std::get;
    \n-
    164 typedef Dune::FieldMatrix<Field, dim, dim> Matrix;
    \n-
    165 Matrix m;
    \n-
    166
    \n-
    167 const auto& origin = get<0>(corners);
    \n-
    168 const auto& origin_normals = get<0>(normals);
    \n-
    169 const auto& target = get<1>(corners);
    \n-
    170 const auto& target_normals = get<1>(normals);
    \n-
    171 auto& images = get<0>(m_images);
    \n-
    172 auto& success = get<0>(m_success);
    \n-
    173
    \n-
    174 /* directions\u1d62 = (y\u1d62 - y\u2080) / ||y\u1d62 - y\u2080||
    \n-
    175 * These are the first to columns of the system matrix; the rescaling is done
    \n-
    176 * to ensure all columns have a comparable norm (the last has the normal with norm 1.
    \n-
    177 */
    \n-
    178 std::array<Coordinate, dim-1> directions;
    \n-
    179 std::array<Field, dim-1> scales;
    \n-
    180 /* estimator for the diameter of the target face */
    \n-
    181 Field scaleSum(0);
    \n-
    182 for (unsigned i = 0; i < dim-1; ++i) {
    \n-
    183 directions[i] = target[i+1] - target[0];
    \n-
    184 scales[i] = directions[i].infinity_norm();
    \n-
    185 directions[i] /= scales[i];
    \n-
    186 scaleSum += scales[i];
    \n-
    187 }
    \n-
    188
    \n-
    189 for (unsigned i = 0; i < dim-1; ++i) {
    \n-
    190 for (unsigned j = 0; j < dim; ++j) {
    \n-
    191 m[j][i] = directions[i][j];
    \n-
    192 }
    \n-
    193 }
    \n-
    194
    \n-
    195 m_projection_valid = true;
    \n-
    196 success.reset();
    \n-
    197
    \n-
    198 /* Now project x\u1d62 for each i */
    \n-
    199 for (unsigned i = 0; i < origin.size(); ++i) {
    \n-
    200 for (unsigned j = 0; j < dim; ++j)
    \n-
    201 m[j][dim-1] = origin_normals[i][j];
    \n-
    202
    \n-
    203 const Coordinate rhs = origin[i] - target[0];
    \n-
    204
    \n-
    205 try {
    \n-
    206 /* y = (\u03b1, \u03b2, \u03b4) */
    \n-
    207 auto& y = images[i];
    \n-
    208 m.solve(y, rhs);
    \n-
    209 for (unsigned j = 0; j < dim-1; ++j)
    \n-
    210 y[j] /= scales[j];
    \n-
    211 /* Solving gave us -\u03b4 as the term is "-\u03b4 n\u1d62". */
    \n-
    212 y[dim-1] *= Field(-1);
    \n-
    213
    \n-
    214 /* If the forward projection is too far in the wrong direction
    \n-
    215 * then this might result in artificial inverse projections or
    \n-
    216 * edge intersections. To prevent these wrong cases but not
    \n-
    217 * dismiss feasible intersections, the projection is dismissed
    \n-
    218 * if the forward projection is further than two times the
    \n-
    219 * approximate diameter of the image triangle.
    \n-
    220 */
    \n-
    221 if(y[dim-1] < -2*scaleSum) {
    \n-
    222 success.set(i,false);
    \n-
    223 m_projection_valid = false;
    \n-
    224 return;
    \n-
    225 }
    \n-
    226
    \n-
    227 const bool feasible = projectionFeasible(origin[i], origin_normals[i], y, target, target_normals);
    \n-
    228 success.set(i, feasible);
    \n-
    229 }
    \n-
    230 catch (const Dune::FMatrixError&) {
    \n-
    231 success.set(i, false);
    \n-
    232 m_projection_valid = false;
    \n-
    233 }
    \n-
    234 }
    \n-
    235}
    \n-
    236
    \n-
    237template<typename Coordinate>
    \n-
    238template<typename Corners, typename Normals>
    \n-
    239void
    \n-
    240Projection<Coordinate>
    \n-
    241::doInverseProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n-
    242{
    \n-
    243 /* Try to obtain \u03a6\u207b\u00b9(y\u1d62) for each corner y\u1d62 of the image triangle.
    \n-
    244 * Instead of solving the problem directly (which would lead to
    \n-
    245 * non-linear equations), we make use of the forward projection \u03a6
    \n-
    246 * which projects the preimage triangle on the plane spanned by the
    \n-
    247 * image triangle. The inverse projection is then given by finding
    \n-
    248 * the barycentric coordinates of y\u1d62 with respect to the triangle
    \n-
    249 * with the corners \u03a6(x\u1d62). This way we only have to solve linear
    \n-
    250 * equations.
    \n-
    251 */
    \n-
    252
    \n-
    253 using namespace ProjectionImplementation;
    \n-
    254 using std::get;
    \n-
    255 typedef Dune::FieldMatrix<Field, dim-1, dim-1> Matrix;
    \n-
    256 typedef Dune::FieldVector<Field, dim-1> Vector;
    \n-
    257
    \n-
    258 /* The inverse projection can only be computed if the forward projection
    \n-
    259 * managed to project all x\u1d62 on the plane spanned by the y\u1d62
    \n-
    260 */
    \n-
    261 if (!m_projection_valid) {
    \n-
    262 get<1>(m_success).reset();
    \n-
    263 return;
    \n-
    264 }
    \n-
    265
    \n-
    266 const auto& images = get<0>(m_images);
    \n-
    267 const auto& target_corners = get<1>(corners);
    \n-
    268 auto& preimages = get<1>(m_images);
    \n-
    269 auto& success = get<1>(m_success);
    \n-
    270
    \n-
    271 std::array<Coordinate, dim> v;
    \n-
    272 for (unsigned i = 0; i < dim-1; ++i) {
    \n-
    273 v[i] = interpolate(images[i+1], target_corners);
    \n-
    274 v[i] -= interpolate(images[0], target_corners);
    \n-
    275 }
    \n-
    276
    \n-
    277 Matrix m;
    \n-
    278 for (unsigned i = 0; i < dim-1; ++i) {
    \n-
    279 for (unsigned j = 0; j < dim-1; ++j) {
    \n-
    280 m[i][j] = v[i]*v[j];
    \n-
    281 }
    \n-
    282 }
    \n-
    283
    \n-
    284 for (unsigned i = 0; i < dim; ++i) {
    \n-
    285 /* Convert y\u1d62 to barycentric coordinates with respect to \u03a6(x\u2c7c) */
    \n-
    286 v[dim-1] = target_corners[i];
    \n-
    287 v[dim-1] -= interpolate(images[0], target_corners);
    \n-
    288
    \n-
    289 Vector rhs, z;
    \n-
    290 for (unsigned j = 0; j < dim-1; ++j)
    \n-
    291 rhs[j] = v[dim-1]*v[j];
    \n-
    292 m.solve(z, rhs);
    \n-
    293
    \n-
    294 for (unsigned j = 0; j < dim-1; ++j)
    \n-
    295 preimages[i][j] = z[j];
    \n-
    296
    \n-
    297 /* Calculate distance along normal direction */
    \n-
    298 const auto x = interpolate(z, get<0>(corners));
    \n-
    299 preimages[i][dim-1] = (x - target_corners[i]) * get<1>(normals)[i];
    \n-
    300
    \n-
    301 /* Check y_i lies inside the \u03a6(x\u2c7c) */
    \n-
    302 const bool feasible = projectionFeasible(target_corners[i], get<1>(normals)[i], preimages[i], get<0>(corners), get<0>(normals));
    \n-
    303 success.set(i, feasible);
    \n-
    304 }
    \n-
    305}
    \n-
    306
    \n-
    307template<typename Coordinate>
    \n-
    308template<typename Corners, typename Normals>
    \n-
    309void
    \n-
    310Projection<Coordinate>
    \n-
    311::doEdgeIntersection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n-
    312{
    \n-
    313 using namespace ProjectionImplementation;
    \n-
    314 using std::get;
    \n-
    315
    \n-
    316 m_number_of_edge_intersections = 0;
    \n-
    317
    \n-
    318 /* There are no edge intersections for 2d, only for 3d */
    \n-
    319 if (dim != 3)
    \n-
    320 return;
    \n-
    321
    \n-
    322 /* There are no edge intersections
    \n-
    323 * - when the projection is invalid,
    \n-
    324 * - when the projected triangle lies fully in the target triangle,
    \n-
    325 * - or when the target triangle lies fully in the projected triangle.
    \n-
    326 */
    \n-
    327 if (!m_projection_valid || get<0>(m_success).all() || get<1>(m_success).all()) {
    \n-
    328 return;
    \n-
    329 }
    \n-
    330
    \n-
    331 const auto& images = get<0>(m_images);
    \n-
    332 const auto& ys = get<1>(corners);
    \n-
    333
    \n-
    334 /* Intersect line through \u03a6(x\u1d62), \u03a6(x\u2c7c) with line through y\u2096, y\u2097:
    \n-
    335 We want \u03b1, \u03b2 \u2208 \u211d such that
    \n-
    336 \u03a6(x\u1d62) + \u03b1 (\u03a6(x\u2c7c) - \u03a6(x\u1d62)) = y\u2096 + \u03b2 (y\u2097 - y\u2096)
    \n-
    337 or
    \n-
    338 \u03b1 (\u03a6(x\u2c7c)-\u03a6(x\u1d62)) + \u03b2 (y\u2097-y\u2096) = y\u2096-\u03a6(x\u1d62)
    \n-
    339 To get a 2\u00d72 system of equations, multiply with y\u2098-y\u2080 for
    \n-
    340 m \u2208 {1,\u0323\u03232} which are linear indep. (and so the system is
    \n-
    341 equivalent to the original 3\u00d72 system)
    \n-
    342 */
    \n-
    343 for (unsigned edgex = 0; edgex < dim; ++edgex) {
    \n-
    344 unsigned i, j;
    \n-
    345 std::tie(i, j) = edgeToCorners(edgex);
    \n-
    346
    \n-
    347 /* Both sides of edgex lie in the target triangle means no edge intersection */
    \n-
    348 if (get<0>(m_success)[i] && get<0>(m_success)[j])
    \n-
    349 continue;
    \n-
    350
    \n-
    351 const auto pxi = interpolate(images[i], ys);
    \n-
    352 const auto pxj = interpolate(images[j], ys);
    \n-
    353 const auto pxjpxi = pxj - pxi;
    \n-
    354
    \n-
    355 typedef Dune::FieldMatrix<Field, dim-1, dim-1> Matrix;
    \n-
    356 typedef Dune::FieldVector<Field, dim-1> Vector;
    \n-
    357
    \n-
    358 for (unsigned edgey = 0; edgey < dim; ++edgey) {
    \n-
    359 unsigned k, l;
    \n-
    360 std::tie(k, l) = edgeToCorners(edgey);
    \n-
    361
    \n-
    362 /* Both sides of edgey lie in the projected triangle means no edge intersection */
    \n-
    363 if (get<1>(m_success)[k] && get<1>(m_success)[l])
    \n-
    364 continue;
    \n-
    365
    \n-
    366 const auto ykyl = ys[k] - ys[l];
    \n-
    367 const auto ykpxi = ys[k] - pxi;
    \n-
    368
    \n-
    369 /* If edges are parallel then the intersection is already computed by vertex projections. */
    \n-
    370 bool parallel = true;
    \n-
    371 for (unsigned h=0; h<3; h++)
    \n-
    372 parallel &= std::abs(ykyl[(h+1)%3]*pxjpxi[(h+2)%3] - ykyl[(h+2)%3]*pxjpxi[(h+1)%3])<1e-14;
    \n-
    373 if (parallel)
    \n-
    374 continue;
    \n-
    375
    \n-
    376 Matrix mat;
    \n-
    377 Vector rhs, z;
    \n-
    378
    \n-
    379 for (unsigned m = 0; m < dim-1; ++m) {
    \n-
    380 const auto ym1y0 = ys[m+1] - ys[0];
    \n-
    381 mat[m][0] = pxjpxi * ym1y0;
    \n-
    382 mat[m][1] = ykyl * ym1y0;
    \n-
    383 rhs[m] = ykpxi * ym1y0;
    \n-
    384 }
    \n-
    385
    \n-
    386 try {
    \n-
    387 using std::isfinite;
    \n-
    388
    \n-
    389 mat.solve(z, rhs);
    \n-
    390
    \n-
    391 /* If solving the system gives a NaN, the edges are probably parallel. */
    \n-
    392 if (!isfinite(z[0]) || !isfinite(z[1]))
    \n-
    393 continue;
    \n-
    394
    \n-
    395 /* Filter out corner (pre)images. We only want "real" edge-edge intersections here. */
    \n-
    396 if (z[0] < m_epsilon || z[0] > Field(1) - m_epsilon
    \n-
    397 || z[1] < m_epsilon || z[1] > Field(1) - m_epsilon)
    \n-
    398 continue;
    \n-
    399
    \n-
    400 Coordinate local_x = corner<Coordinate, Field>(i);
    \n-
    401 local_x.axpy(z[0], corner<Coordinate, Field>(j) - corner<Coordinate, Field>(i));
    \n-
    402 Coordinate local_y = corner<Coordinate, Field>(k);
    \n-
    403 local_y.axpy(z[1], corner<Coordinate, Field>(l) - corner<Coordinate, Field>(k));
    \n-
    404
    \n-
    405 /* Make sure the intersection is in the triangle. */
    \n-
    406 if (!inside(local_x, m_epsilon) || !inside(local_y, m_epsilon))
    \n-
    407 continue;
    \n-
    408
    \n-
    409 /* Make sure the intersection respects overlap. */
    \n-
    410 auto xy = interpolate(local_x, get<0>(corners));
    \n-
    411 xy -= interpolate(local_y, get<1>(corners));
    \n-
    412 const auto nx = interpolate_unit_normals(local_x, get<0>(normals));
    \n-
    413 const auto ny = interpolate_unit_normals(local_y, get<1>(normals));
    \n-
    414 local_x[dim-1] = -(xy*nx);
    \n-
    415 local_y[dim-1] = xy*ny;
    \n-
    416
    \n-
    417 if (local_x[dim-1] < -m_overlap-m_epsilon || local_y[dim-1] < -m_overlap-m_epsilon)
    \n-
    418 continue;
    \n-
    419
    \n-
    420 /* Normals should be opposing. */
    \n-
    421 if (nx*ny > m_max_normal_product + m_epsilon)
    \n-
    422 continue;
    \n-
    423
    \n-
    424 /* Intersection is feasible. Store it. */
    \n-
    425 auto& intersection = m_edge_intersections[m_number_of_edge_intersections++];
    \n-
    426 intersection = { {{edgex, edgey}}, {{local_x, local_y}} };
    \n-
    427 }
    \n-
    428 catch(const Dune::FMatrixError&) {
    \n-
    429 /* Edges might be parallel, ignore and continue with next edge */
    \n-
    430 }
    \n-
    431 }
    \n-
    432 }
    \n-
    433}
    \n-
    434
    \n-
    435template<typename Coordinate>
    \n-
    436template<typename Corners, typename Normals>
    \n-
    437bool Projection<Coordinate>
    \n-
    438::projectionFeasible(const Coordinate& x, const Coordinate& nx, const Coordinate& px, const Corners& corners, const Normals& normals) const
    \n-
    439{
    \n-
    440 using namespace ProjectionImplementation;
    \n-
    441
    \n-
    442 /* Image must be within simplex. */
    \n-
    443 if (!inside(px, m_epsilon))
    \n-
    444 return false;
    \n-
    445
    \n-
    446 /* Distance along normal must not be smaller than -overlap. */
    \n-
    447 if (px[dim-1] < -m_overlap-m_epsilon)
    \n-
    448 return false;
    \n-
    449
    \n-
    450 /* Distance along normal at image must not be smaller than -overlap. */
    \n-
    451 auto xmy = x;
    \n-
    452 xmy -= interpolate(px, corners);
    \n-
    453 const auto n = interpolate_unit_normals(px, normals);
    \n-
    454 const auto d = xmy * n;
    \n-
    455 if (d < -m_overlap-m_epsilon)
    \n-
    456 return false;
    \n-
    457
    \n-
    458 /* Normals at x and \u03a6(x) are opposing. */
    \n-
    459 if (nx * n > m_max_normal_product + m_epsilon)
    \n-
    460 return false;
    \n-
    461
    \n-
    462 /* Okay, projection is feasible. */
    \n-
    463 return true;
    \n-
    464}
    \n-
    465
    \n-
    466template<typename Coordinate>
    \n-
    467template<typename Corners, typename Normals>
    \n-\n-
    469::project(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
    \n-
    470{
    \n-
    471 doProjection(corners, normals);
    \n-
    472 doInverseProjection(corners, normals);
    \n-
    473 doEdgeIntersection(corners, normals);
    \n-
    474}
    \n-
    475
    \n-
    476} /* namespace GridGlue */
    \n-
    477} /* namespace Dune */
    \n+
    12template<int side, typename Glue>
    \n+
    13void write_glue_area_vtk(const Glue& glue, std::ostream& out);
    \n+
    14
    \n+
    15template<int side, typename Glue>
    \n+
    16void write_glue_area_vtk(const Glue& glue, const std::string& filename);
    \n+
    17
    \n+
    37template<typename Glue>
    \n+
    38void write_glue_areas_vtk(const Glue& glue, const std::string& base);
    \n+
    39
    \n+
    40} /* namespace GridGlue */
    \n+
    41} /* namespace Dune */
    \n+
    42
    \n+
    43#include "areawriter_impl.hh"
    \n+
    44
    \n+
    45#endif
    \n+\n
    Definition: gridglue.hh:37
    \n-
    Corners::value_type interpolate(const Coordinate &x, const Corners &corners)
    Definition: projection_impl.hh:70
    \n-
    bool inside(const Coordinate &x, const Field &epsilon)
    Definition: projection_impl.hh:111
    \n-
    std::pair< unsigned, unsigned > edgeToCorners(unsigned edge)
    Definition: projection_impl.hh:43
    \n-
    Coordinate corner(unsigned c)
    Definition: projection_impl.hh:24
    \n-
    Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals &normals)
    Definition: projection_impl.hh:91
    \n-
    Projection of a line (triangle) on another line (triangle).
    Definition: projection.hh:21
    \n-
    Coordinate::field_type Field
    Scalar type.
    Definition: projection.hh:61
    \n-
    Projection(const Field overlap=Field(0), const Field max_normal_product=Field(-0.1))
    Definition: projection_impl.hh:130
    \n-
    void epsilon(const Field epsilon)
    Set epsilon used for floating-point comparisons.
    Definition: projection_impl.hh:140
    \n-
    void project(const std::tuple< Corners &, Corners & > &corners, const std::tuple< Normals &, Normals & > &normals)
    Do the actual projection.
    Definition: projection_impl.hh:469
    \n+
    void write_glue_area_vtk(const Glue &glue, std::ostream &out)
    Definition: areawriter_impl.hh:84
    \n+
    void write_glue_areas_vtk(const Glue &glue, const std::string &base)
    Definition: areawriter_impl.hh:129
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,494 +5,49 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-projection_impl.hh\n+areawriter.hh\n Go_to_the_documentation_of_this_file.\n 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#include \n- 4\n- 5#include \n- 6\n- 7namespace Dune {\n- 8namespace GridGlue {\n- 9\n-10namespace ProjectionImplementation {\n+ 3#ifndef DUNE_GRIDGLUE_COMMON_AREAWRITER_HH\n+ 4#define DUNE_GRIDGLUE_COMMON_AREAWRITER_HH\n+ 5\n+ 6#include \n+ 7#include \n+ 8\n+ 9namespace Dune {\n+ 10namespace GridGlue {\n 11\n- 22template\n- 23inline Coordinate\n-24corner(unsigned c)\n- 25{\n- 26 Coordinate x(Field(0));\n- 27 if (c == 0)\n- 28 return x;\n- 29 x[c-1] = Field(1);\n- 30 return x;\n- 31}\n- 32\n- 42inline std::pair\n-43edgeToCorners(unsigned edge)\n- 44{\n- 45 switch(edge) {\n- 46 case 0: return {0, 1};\n- 47 case 1: return {0, 2};\n- 48 case 2: return {1, 2};\n- 49 }\n- 50 DUNE_THROW(Dune::Exception, \"Unexpected edge number.\");\n- 51}\n- 52\n- 68template\n- 69inline typename Corners::value_type\n-70interpolate(const Coordinate& x, const Corners& corners)\n- 71{\n- 72 auto y = corners[0];\n- 73 for (unsigned i = 0; i < corners.size() - 1; ++i)\n- 74 y.axpy(x[i], corners[i+1] - corners[0]);\n- 75 return y;\n- 76}\n- 77\n- 89template\n- 90inline typename Normals::value_type\n-91interpolate_unit_normals(const Coordinate& x, const Normals& normals)\n- 92{\n- 93 auto n = interpolate(x, normals);\n- 94 n /= n.two_norm();\n- 95 return n;\n- 96}\n- 97\n- 109template\n- 110inline bool\n-111inside(const Coordinate& x, const Field& epsilon)\n- 112{\n- 113 const unsigned dim = Coordinate::dimension;\n- 114 Field sum(0);\n- 115 for (unsigned i = 0; i < dim-1; ++i) {\n- 116 if (x[i] < -epsilon)\n- 117 return false;\n- 118 sum += x[i];\n- 119 }\n- 120 /* If any x\u1d62 is NaN, sum will be NaN and this comparison false! */\n- 121 if (sum <= Field(1) + epsilon)\n- 122 return true;\n- 123 return false;\n- 124}\n- 125\n- 126} /* namespace ProjectionImplementation */\n- 127\n- 128template\n- 129Projection\n-130::Projection(const Field overlap, const Field max_normal_product)\n- 131 : m_overlap(overlap)\n- 132 , m_max_normal_product(max_normal_product)\n- 133{\n- 134 /* Nothing. */\n- 135}\n- 136\n- 137template\n- 138void\n- 139Projection\n-140::epsilon(const Field epsilon)\n- 141{\n- 142 m_epsilon = epsilon;\n- 143}\n- 144\n- 145template\n- 146template\n- 147void\n- 148Projection\n- 149::doProjection(const std::tuple& corners, const std::\n-tuple& normals)\n- 150{\n- 151 /* Try to obtain \u03a6(x\u1d62) for each corner x\u1d62 of the preimage triangle.\n- 152 * This means solving a linear system of equations\n- 153 * \u03a6(x\u1d62) = (1-\u03b1-\u03b2) y\u2080 + \u03b1 y\u2081 + \u03b2 y\u2082 = x\u1d62 + \u03b4 n\u1d62\n- 154 * or \u03b1 (y\u2081 - y\u2080) + \u03b2 (y\u2082 - y\u2080) - \u03b4 n\u1d62 = x\u1d62 - y\u2080\n- 155 * to obtain the barycentric coordinates (\u03b1, \u03b2) of \u03a6(x\u1d62) in the image\n- 156 * triangle and the distance \u03b4.\n- 157 *\n- 158 * In the matrix m corresponding to the system, only the third column and\n-the\n- 159 * right-hand side depend on i. The first two columns can be assembled\n-before\n- 160 * and reused.\n- 161 */\n- 162 using namespace ProjectionImplementation;\n- 163 using std::get;\n- 164 typedef Dune::FieldMatrix Matrix;\n- 165 Matrix m;\n- 166\n- 167 const auto& origin = get<0>(corners);\n- 168 const auto& origin_normals = get<0>(normals);\n- 169 const auto& target = get<1>(corners);\n- 170 const auto& target_normals = get<1>(normals);\n- 171 auto& images = get<0>(m_images);\n- 172 auto& success = get<0>(m_success);\n- 173\n- 174 /* directions\u1d62 = (y\u1d62 - y\u2080) / ||y\u1d62 - y\u2080||\n- 175 * These are the first to columns of the system matrix; the rescaling is\n-done\n- 176 * to ensure all columns have a comparable norm (the last has the normal\n-with norm 1.\n- 177 */\n- 178 std::array directions;\n- 179 std::array scales;\n- 180 /* estimator for the diameter of the target face */\n- 181 Field scaleSum(0);\n- 182 for (unsigned i = 0; i < dim-1; ++i) {\n- 183 directions[i] = target[i+1] - target[0];\n- 184 scales[i] = directions[i].infinity_norm();\n- 185 directions[i] /= scales[i];\n- 186 scaleSum += scales[i];\n- 187 }\n- 188\n- 189 for (unsigned i = 0; i < dim-1; ++i) {\n- 190 for (unsigned j = 0; j < dim; ++j) {\n- 191 m[j][i] = directions[i][j];\n- 192 }\n- 193 }\n- 194\n- 195 m_projection_valid = true;\n- 196 success.reset();\n- 197\n- 198 /* Now project x\u1d62 for each i */\n- 199 for (unsigned i = 0; i < origin.size(); ++i) {\n- 200 for (unsigned j = 0; j < dim; ++j)\n- 201 m[j][dim-1] = origin_normals[i][j];\n- 202\n- 203 const Coordinate rhs = origin[i] - target[0];\n- 204\n- 205 try {\n- 206 /* y = (\u03b1, \u03b2, \u03b4) */\n- 207 auto& y = images[i];\n- 208 m.solve(y, rhs);\n- 209 for (unsigned j = 0; j < dim-1; ++j)\n- 210 y[j] /= scales[j];\n- 211 /* Solving gave us -\u03b4 as the term is \"-\u03b4 n\u1d62\". */\n- 212 y[dim-1] *= Field(-1);\n- 213\n- 214 /* If the forward projection is too far in the wrong direction\n- 215 * then this might result in artificial inverse projections or\n- 216 * edge intersections. To prevent these wrong cases but not\n- 217 * dismiss feasible intersections, the projection is dismissed\n- 218 * if the forward projection is further than two times the\n- 219 * approximate diameter of the image triangle.\n- 220 */\n- 221 if(y[dim-1] < -2*scaleSum) {\n- 222 success.set(i,false);\n- 223 m_projection_valid = false;\n- 224 return;\n- 225 }\n- 226\n- 227 const bool feasible = projectionFeasible(origin[i], origin_normals[i], y,\n-target, target_normals);\n- 228 success.set(i, feasible);\n- 229 }\n- 230 catch (const Dune::FMatrixError&) {\n- 231 success.set(i, false);\n- 232 m_projection_valid = false;\n- 233 }\n- 234 }\n- 235}\n- 236\n- 237template\n- 238template\n- 239void\n- 240Projection\n- 241::doInverseProjection(const std::tuple& corners, const\n-std::tuple& normals)\n- 242{\n- 243 /* Try to obtain \u03a6\u207b\u00b9(y\u1d62) for each corner y\u1d62 of the image triangle.\n- 244 * Instead of solving the problem directly (which would lead to\n- 245 * non-linear equations), we make use of the forward projection \u03a6\n- 246 * which projects the preimage triangle on the plane spanned by the\n- 247 * image triangle. The inverse projection is then given by finding\n- 248 * the barycentric coordinates of y\u1d62 with respect to the triangle\n- 249 * with the corners \u03a6(x\u1d62). This way we only have to solve linear\n- 250 * equations.\n- 251 */\n- 252\n- 253 using namespace ProjectionImplementation;\n- 254 using std::get;\n- 255 typedef Dune::FieldMatrix Matrix;\n- 256 typedef Dune::FieldVector Vector;\n- 257\n- 258 /* The inverse projection can only be computed if the forward projection\n- 259 * managed to project all x\u1d62 on the plane spanned by the y\u1d62\n- 260 */\n- 261 if (!m_projection_valid) {\n- 262 get<1>(m_success).reset();\n- 263 return;\n- 264 }\n- 265\n- 266 const auto& images = get<0>(m_images);\n- 267 const auto& target_corners = get<1>(corners);\n- 268 auto& preimages = get<1>(m_images);\n- 269 auto& success = get<1>(m_success);\n- 270\n- 271 std::array v;\n- 272 for (unsigned i = 0; i < dim-1; ++i) {\n- 273 v[i] = interpolate(images[i+1], target_corners);\n- 274 v[i] -= interpolate(images[0], target_corners);\n- 275 }\n- 276\n- 277 Matrix m;\n- 278 for (unsigned i = 0; i < dim-1; ++i) {\n- 279 for (unsigned j = 0; j < dim-1; ++j) {\n- 280 m[i][j] = v[i]*v[j];\n- 281 }\n- 282 }\n- 283\n- 284 for (unsigned i = 0; i < dim; ++i) {\n- 285 /* Convert y\u1d62 to barycentric coordinates with respect to \u03a6(x\u2c7c) */\n- 286 v[dim-1] = target_corners[i];\n- 287 v[dim-1] -= interpolate(images[0], target_corners);\n- 288\n- 289 Vector rhs, z;\n- 290 for (unsigned j = 0; j < dim-1; ++j)\n- 291 rhs[j] = v[dim-1]*v[j];\n- 292 m.solve(z, rhs);\n- 293\n- 294 for (unsigned j = 0; j < dim-1; ++j)\n- 295 preimages[i][j] = z[j];\n- 296\n- 297 /* Calculate distance along normal direction */\n- 298 const auto x = interpolate(z, get<0>(corners));\n- 299 preimages[i][dim-1] = (x - target_corners[i]) * get<1>(normals)[i];\n- 300\n- 301 /* Check y_i lies inside the \u03a6(x\u2c7c) */\n- 302 const bool feasible = projectionFeasible(target_corners[i], get<1>\n-(normals)[i], preimages[i], get<0>(corners), get<0>(normals));\n- 303 success.set(i, feasible);\n- 304 }\n- 305}\n- 306\n- 307template\n- 308template\n- 309void\n- 310Projection\n- 311::doEdgeIntersection(const std::tuple& corners, const\n-std::tuple& normals)\n- 312{\n- 313 using namespace ProjectionImplementation;\n- 314 using std::get;\n- 315\n- 316 m_number_of_edge_intersections = 0;\n- 317\n- 318 /* There are no edge intersections for 2d, only for 3d */\n- 319 if (dim != 3)\n- 320 return;\n- 321\n- 322 /* There are no edge intersections\n- 323 * - when the projection is invalid,\n- 324 * - when the projected triangle lies fully in the target triangle,\n- 325 * - or when the target triangle lies fully in the projected triangle.\n- 326 */\n- 327 if (!m_projection_valid || get<0>(m_success).all() || get<1>\n-(m_success).all()) {\n- 328 return;\n- 329 }\n- 330\n- 331 const auto& images = get<0>(m_images);\n- 332 const auto& ys = get<1>(corners);\n- 333\n- 334 /* Intersect line through \u03a6(x\u1d62), \u03a6(x\u2c7c) with line through y\u2096, y\u2097:\n- 335 We want \u03b1, \u03b2 \u2208 \u211d such that\n- 336 \u03a6(x\u1d62) + \u03b1 (\u03a6(x\u2c7c) - \u03a6(x\u1d62)) = y\u2096 + \u03b2 (y\u2097 - y\u2096)\n- 337 or\n- 338 \u03b1 (\u03a6(x\u2c7c)-\u03a6(x\u1d62)) + \u03b2 (y\u2097-y\u2096) = y\u2096-\u03a6(x\u1d62)\n- 339 To get a 2\u00d72 system of equations, multiply with y\u2098-y\u2080 for\n- 340 m \u2208 {1,\u0323\u03232} which are linear indep. (and so the system is\n- 341 equivalent to the original 3\u00d72 system)\n- 342 */\n- 343 for (unsigned edgex = 0; edgex < dim; ++edgex) {\n- 344 unsigned i, j;\n- 345 std::tie(i, j) = edgeToCorners(edgex);\n- 346\n- 347 /* Both sides of edgex lie in the target triangle means no edge\n-intersection */\n- 348 if (get<0>(m_success)[i] && get<0>(m_success)[j])\n- 349 continue;\n- 350\n- 351 const auto pxi = interpolate(images[i], ys);\n- 352 const auto pxj = interpolate(images[j], ys);\n- 353 const auto pxjpxi = pxj - pxi;\n- 354\n- 355 typedef Dune::FieldMatrix Matrix;\n- 356 typedef Dune::FieldVector Vector;\n- 357\n- 358 for (unsigned edgey = 0; edgey < dim; ++edgey) {\n- 359 unsigned k, l;\n- 360 std::tie(k, l) = edgeToCorners(edgey);\n- 361\n- 362 /* Both sides of edgey lie in the projected triangle means no edge\n-intersection */\n- 363 if (get<1>(m_success)[k] && get<1>(m_success)[l])\n- 364 continue;\n- 365\n- 366 const auto ykyl = ys[k] - ys[l];\n- 367 const auto ykpxi = ys[k] - pxi;\n- 368\n- 369 /* If edges are parallel then the intersection is already computed by\n-vertex projections. */\n- 370 bool parallel = true;\n- 371 for (unsigned h=0; h<3; h++)\n- 372 parallel &= std::abs(ykyl[(h+1)%3]*pxjpxi[(h+2)%3] - ykyl[(h+2)%3]*pxjpxi[\n-(h+1)%3])<1e-14;\n- 373 if (parallel)\n- 374 continue;\n- 375\n- 376 Matrix mat;\n- 377 Vector rhs, z;\n- 378\n- 379 for (unsigned m = 0; m < dim-1; ++m) {\n- 380 const auto ym1y0 = ys[m+1] - ys[0];\n- 381 mat[m][0] = pxjpxi * ym1y0;\n- 382 mat[m][1] = ykyl * ym1y0;\n- 383 rhs[m] = ykpxi * ym1y0;\n- 384 }\n- 385\n- 386 try {\n- 387 using std::isfinite;\n- 388\n- 389 mat.solve(z, rhs);\n- 390\n- 391 /* If solving the system gives a NaN, the edges are probably parallel. */\n- 392 if (!isfinite(z[0]) || !isfinite(z[1]))\n- 393 continue;\n- 394\n- 395 /* Filter out corner (pre)images. We only want \"real\" edge-edge\n-intersections here. */\n- 396 if (z[0] < m_epsilon || z[0] > Field(1) - m_epsilon\n- 397 || z[1] < m_epsilon || z[1] > Field(1) - m_epsilon)\n- 398 continue;\n- 399\n- 400 Coordinate local_x = corner(i);\n- 401 local_x.axpy(z[0], corner(j) - corner(i));\n- 402 Coordinate local_y = corner(k);\n- 403 local_y.axpy(z[1], corner(l) - corner(k));\n- 404\n- 405 /* Make sure the intersection is in the triangle. */\n- 406 if (!inside(local_x, m_epsilon) || !inside(local_y, m_epsilon))\n- 407 continue;\n- 408\n- 409 /* Make sure the intersection respects overlap. */\n- 410 auto xy = interpolate(local_x, get<0>(corners));\n- 411 xy -= interpolate(local_y, get<1>(corners));\n- 412 const auto nx = interpolate_unit_normals(local_x, get<0>(normals));\n- 413 const auto ny = interpolate_unit_normals(local_y, get<1>(normals));\n- 414 local_x[dim-1] = -(xy*nx);\n- 415 local_y[dim-1] = xy*ny;\n- 416\n- 417 if (local_x[dim-1] < -m_overlap-m_epsilon || local_y[dim-1] < -m_overlap-\n-m_epsilon)\n- 418 continue;\n- 419\n- 420 /* Normals should be opposing. */\n- 421 if (nx*ny > m_max_normal_product + m_epsilon)\n- 422 continue;\n- 423\n- 424 /* Intersection is feasible. Store it. */\n- 425 auto& intersection = m_edge_intersections\n-[m_number_of_edge_intersections++];\n- 426 intersection = { {{edgex, edgey}}, {{local_x, local_y}} };\n- 427 }\n- 428 catch(const Dune::FMatrixError&) {\n- 429 /* Edges might be parallel, ignore and continue with next edge */\n- 430 }\n- 431 }\n- 432 }\n- 433}\n- 434\n- 435template\n- 436template\n- 437bool Projection\n- 438::projectionFeasible(const Coordinate& x, const Coordinate& nx, const\n-Coordinate& px, const Corners& corners, const Normals& normals) const\n- 439{\n- 440 using namespace ProjectionImplementation;\n- 441\n- 442 /* Image must be within simplex. */\n- 443 if (!inside(px, m_epsilon))\n- 444 return false;\n- 445\n- 446 /* Distance along normal must not be smaller than -overlap. */\n- 447 if (px[dim-1] < -m_overlap-m_epsilon)\n- 448 return false;\n- 449\n- 450 /* Distance along normal at image must not be smaller than -overlap. */\n- 451 auto xmy = x;\n- 452 xmy -= interpolate(px, corners);\n- 453 const auto n = interpolate_unit_normals(px, normals);\n- 454 const auto d = xmy * n;\n- 455 if (d < -m_overlap-m_epsilon)\n- 456 return false;\n- 457\n- 458 /* Normals at x and \u03a6(x) are opposing. */\n- 459 if (nx * n > m_max_normal_product + m_epsilon)\n- 460 return false;\n- 461\n- 462 /* Okay, projection is feasible. */\n- 463 return true;\n- 464}\n- 465\n- 466template\n- 467template\n- 468void Projection\n-469::project(const std::tuple& corners, const std::\n-tuple& normals)\n- 470{\n- 471 doProjection(corners, normals);\n- 472 doInverseProjection(corners, normals);\n- 473 doEdgeIntersection(corners, normals);\n- 474}\n- 475\n- 476} /* namespace GridGlue */\n- 477} /* namespace Dune */\n+ 12template\n+ 13void write_glue_area_vtk(const Glue& glue, std::ostream& out);\n+ 14\n+ 15template\n+ 16void write_glue_area_vtk(const Glue& glue, const std::string& filename);\n+ 17\n+ 37template\n+ 38void write_glue_areas_vtk(const Glue& glue, const std::string& base);\n+ 39\n+ 40} /* namespace GridGlue */\n+ 41} /* namespace Dune */\n+ 42\n+ 43#include \"areawriter_impl.hh\"\n+ 44\n+ 45#endif\n+areawriter_impl.hh\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::ProjectionImplementation::interpolate\n-Corners::value_type interpolate(const Coordinate &x, const Corners &corners)\n-Definition: projection_impl.hh:70\n-Dune::GridGlue::ProjectionImplementation::inside\n-bool inside(const Coordinate &x, const Field &epsilon)\n-Definition: projection_impl.hh:111\n-Dune::GridGlue::ProjectionImplementation::edgeToCorners\n-std::pair< unsigned, unsigned > edgeToCorners(unsigned edge)\n-Definition: projection_impl.hh:43\n-Dune::GridGlue::ProjectionImplementation::corner\n-Coordinate corner(unsigned c)\n-Definition: projection_impl.hh:24\n-Dune::GridGlue::ProjectionImplementation::interpolate_unit_normals\n-Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals\n-&normals)\n-Definition: projection_impl.hh:91\n-Dune::GridGlue::Projection\n-Projection of a line (triangle) on another line (triangle).\n-Definition: projection.hh:21\n-Dune::GridGlue::Projection::Field\n-Coordinate::field_type Field\n-Scalar type.\n-Definition: projection.hh:61\n-Dune::GridGlue::Projection::Projection\n-Projection(const Field overlap=Field(0), const Field max_normal_product=Field(-\n-0.1))\n-Definition: projection_impl.hh:130\n-Dune::GridGlue::Projection::epsilon\n-void epsilon(const Field epsilon)\n-Set epsilon used for floating-point comparisons.\n-Definition: projection_impl.hh:140\n-Dune::GridGlue::Projection::project\n-void project(const std::tuple< Corners &, Corners & > &corners, const std::\n-tuple< Normals &, Normals & > &normals)\n-Do the actual projection.\n-Definition: projection_impl.hh:469\n+Dune::GridGlue::write_glue_area_vtk\n+void write_glue_area_vtk(const Glue &glue, std::ostream &out)\n+Definition: areawriter_impl.hh:84\n+Dune::GridGlue::write_glue_areas_vtk\n+void write_glue_areas_vtk(const Glue &glue, const std::string &base)\n+Definition: areawriter_impl.hh:129\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: projectionwriter.hh File Reference\n+dune-grid-glue: projectionwriter_impl.hh File Reference\n \n \n \n \n \n \n \n@@ -65,33 +65,47 @@\n
  • dune
  • grid-glue
  • common
  • \n \n \n
    \n \n-
    projectionwriter.hh File Reference
    \n+
    projectionwriter_impl.hh File Reference
    \n
    \n
    \n-
    #include <iostream>
    \n-#include <string>
    \n-#include <dune/grid-glue/common/projection.hh>
    \n-#include "projectionwriter_impl.hh"
    \n+
    #include <fstream>
    \n
    \n

    Go to the source code of this file.

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

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    namespace  Dune::GridGlue::ProjectionWriterImplementation
     
    \n \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n \n \n \n \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -6,26 +6,49 @@\n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n Namespaces | Functions\n-projectionwriter.hh File Reference\n-#include \n-#include \n-#include \n-#include \"projectionwriter_impl.hh\"\n+projectionwriter_impl.hh File Reference\n+#include \n Go_to_the_source_code_of_this_file.\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n+namespace \u00a0Dune::GridGlue::ProjectionWriterImplementation\n+\u00a0\n Functions\n+template\n+void\u00a0Dune::GridGlue::ProjectionWriterImplementation::write_points (const\n+ Projection< Coordinate > &projection, const Corners &corners, std::\n+ ostream &out)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::ProjectionWriterImplementation::write_normals (const\n+ Projection< Coordinate > &projection, const Normals &normals, std::\n+ ostream &out)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::ProjectionWriterImplementation::\n+ write_edge_intersection_points (const Projection< Coordinate >\n+ &projection, const Corners &corners, std::ostream &out)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::ProjectionWriterImplementation::\n+ write_edge_intersection_normals (const Projection< Coordinate >\n+ &projection, const Normals &normals, std::ostream &out)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::ProjectionWriterImplementation::write_success (const\n+ Projection< Coordinate > &projection, std::ostream &out)\n+\u00a0\n template\n void\u00a0Dune::GridGlue::write (const Projection< Coordinate > &projection, const\n Corners &corners, const Normals &normals, std::ostream &out)\n \u00a0 write projection in VTK format More...\n \u00a0\n template\n void\u00a0Dune::GridGlue::write (const Projection< Coordinate > &projection, const\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: projectionwriter.hh Source File\n+dune-grid-glue: projectionwriter_impl.hh Source File\n \n \n \n \n \n \n \n@@ -62,57 +62,195 @@\n \n \n \n
    \n-
    projectionwriter.hh
    \n+
    projectionwriter_impl.hh
    \n
    \n
    \n Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
    \n-
    4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
    \n-
    5
    \n-
    6#include <iostream>
    \n-
    7#include <string>
    \n-
    8
    \n-\n-
    10
    \n-
    11namespace Dune {
    \n-
    12namespace GridGlue {
    \n-
    13
    \n-
    28template<typename Coordinate, typename Corners, typename Normals>
    \n-
    29void write(const Projection<Coordinate>& projection,
    \n-
    30 const Corners& corners,
    \n-
    31 const Normals& normals,
    \n-
    32 std::ostream& out);
    \n-
    33
    \n-
    40template<typename Coordinate, typename Corners, typename Normals>
    \n-
    41void write(const Projection<Coordinate>& projection,
    \n-
    42 const Corners& corners,
    \n-
    43 const Normals& normals,
    \n-
    44 const std::string& filename);
    \n-
    54template<typename Coordinate, typename Corners, typename Normals>
    \n-
    55void print(const Projection<Coordinate>& projection,
    \n-
    56 const Corners& corners,
    \n-
    57 const Normals& normals);
    \n-
    58
    \n-
    59} /* namespace GridGlue */
    \n-
    60} /* namespace Dune */
    \n-
    61
    \n-\n-
    63
    \n-
    64#endif
    \n-\n-\n+
    3#include <fstream>
    \n+
    4
    \n+
    5namespace Dune {
    \n+
    6namespace GridGlue {
    \n+
    7
    \n+
    8namespace ProjectionWriterImplementation {
    \n+
    9
    \n+
    10template<unsigned side, typename Coordinate, typename Corners>
    \n+
    11void write_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
    \n+
    12{
    \n+
    13 using namespace ProjectionImplementation;
    \n+
    14 using std::get;
    \n+
    15 const unsigned other_side = 1 - side;
    \n+
    16
    \n+
    17 for (const auto& c : get<side>(corners))
    \n+
    18 out << c << "\\n";
    \n+
    19
    \n+
    20 for (const auto& i : get<side>(projection.images())) {
    \n+
    21 const auto global = interpolate(i, get<other_side>(corners));
    \n+
    22 out << global << "\\n";
    \n+
    23 }
    \n+
    24}
    \n+
    25
    \n+
    26template<unsigned side, typename Coordinate, typename Normals>
    \n+
    27void write_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
    \n+
    28{
    \n+
    29 using namespace ProjectionImplementation;
    \n+
    30 using std::get;
    \n+
    31 const unsigned other_side = 1 - side;
    \n+
    32
    \n+
    33 for (const auto& n : get<side>(normals))
    \n+
    34 out << n << "\\n";
    \n+
    35
    \n+
    36 for (const auto& x : get<side>(projection.images())) {
    \n+
    37 const auto n = interpolate_unit_normals(x, get<other_side>(normals));
    \n+
    38 out << n << "\\n";
    \n+
    39 }
    \n+
    40}
    \n+
    41
    \n+
    42template<typename Coordinate, typename Corners>
    \n+
    43void write_edge_intersection_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
    \n+
    44{
    \n+
    45 using namespace ProjectionImplementation;
    \n+
    46 using std::get;
    \n+
    47
    \n+
    48 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
    \n+
    49 const auto& local = projection.edgeIntersections()[i].local;
    \n+
    50 out << interpolate(local[0], get<0>(corners)) << "\\n"
    \n+
    51 << interpolate(local[1], get<1>(corners)) << "\\n";
    \n+
    52 }
    \n+
    53}
    \n+
    54
    \n+
    55template<typename Coordinate, typename Normals>
    \n+
    56void write_edge_intersection_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
    \n+
    57{
    \n+
    58 using namespace ProjectionImplementation;
    \n+
    59 using std::get;
    \n+
    60
    \n+
    61 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
    \n+
    62 const auto& local = projection.edgeIntersections()[i].local;
    \n+
    63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals));
    \n+
    64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals));
    \n+
    65
    \n+
    66 out << n0 << "\\n"
    \n+
    67 << n1 << "\\n";
    \n+
    68 }
    \n+
    69}
    \n+
    70
    \n+
    71template<unsigned side, typename Coordinate>
    \n+
    72void write_success(const Projection<Coordinate>& projection, std::ostream& out)
    \n+
    73{
    \n+
    74 using std::get;
    \n+
    75
    \n+
    76 out << side << "\\n";
    \n+
    77
    \n+
    78 const auto& success = get<side>(projection.success());
    \n+
    79 for (std::size_t i = 0; i < success.size(); ++i)
    \n+
    80 out << (success[i] ? "1\\n" : "0\\n");
    \n+
    81}
    \n+
    82
    \n+
    83} /* namespace ProjectionWriterImplementation */
    \n+
    84
    \n+
    85template<typename Coordinate, typename Corners, typename Normals>
    \n+
    86void write(const Projection<Coordinate>& projection,
    \n+
    87 const Corners& corners,
    \n+
    88 const Normals& normals,
    \n+
    89 std::ostream& out)
    \n+
    90{
    \n+
    91 using namespace ProjectionWriterImplementation;
    \n+
    92
    \n+
    93 const auto numberOfEdgeIntersections = projection.numberOfEdgeIntersections();
    \n+
    94 const auto nPoints = 12 + 2 * numberOfEdgeIntersections;
    \n+
    95
    \n+
    96 out << "# vtk DataFile Version2.0\\n"
    \n+
    97 << "Filename: projection\\n"
    \n+
    98 << "ASCII\\n"
    \n+
    99 << "DATASET UNSTRUCTURED_GRID\\n"
    \n+
    100 << "POINTS " << nPoints << " double\\n";
    \n+
    101 write_points<0>(projection, corners, out);
    \n+
    102 write_points<1>(projection, corners, out);
    \n+
    103 write_edge_intersection_points(projection, corners, out);
    \n+
    104 out << "CELLS " << (8 + numberOfEdgeIntersections) << " " << (26 + 3 * numberOfEdgeIntersections) << "\\n";
    \n+
    105 out << "3 0 1 2\\n" "2 0 3\\n" "2 1 4\\n" "2 2 5\\n"
    \n+
    106 << "3 6 7 8\\n" "2 6 9\\n" "2 7 10\\n" "2 8 11\\n";
    \n+
    107 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    \n+
    108 out << "2 " << (12 + 2*i) << " " << (12 + 2*i + 1) << "\\n";
    \n+
    109 out << "CELL_TYPES " << (8 + numberOfEdgeIntersections) << "\\n" "5\\n3\\n3\\n3\\n" "5\\n3\\n3\\n3\\n";
    \n+
    110 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    \n+
    111 out << "3\\n";
    \n+
    112 out << "CELL_DATA " << (8 + numberOfEdgeIntersections) << "\\n";
    \n+
    113 out << "SCALARS success int 1\\n"
    \n+
    114 << "LOOKUP_TABLE success\\n";
    \n+
    115 write_success<0>(projection, out);
    \n+
    116 write_success<1>(projection, out);
    \n+
    117 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    \n+
    118 out << "2\\n";
    \n+
    119 out << "LOOKUP_TABLE success 2\\n"
    \n+
    120 << "1.0 0.0 0.0 1.0\\n"
    \n+
    121 << "0.0 1.0 0.0 1.0\\n";
    \n+
    122 out << "POINT_DATA " << nPoints << "\\n"
    \n+
    123 << "NORMALS normals double\\n";
    \n+
    124 write_normals<0>(projection, normals, out);
    \n+
    125 write_normals<1>(projection, normals, out);
    \n+
    126 write_edge_intersection_normals(projection, normals, out);
    \n+
    127}
    \n+
    128
    \n+
    129template<typename Coordinate, typename Corners, typename Normals>
    \n+
    130void write(const Projection<Coordinate>& projection,
    \n+
    131 const Corners& corners,
    \n+
    132 const Normals& normals,
    \n+
    133 const std::string& filename)
    \n+
    134{
    \n+
    135 std::ofstream out(filename.c_str());
    \n+
    136 write(projection, corners, normals, out);
    \n+
    137}
    \n+
    138
    \n+
    139template<typename Coordinate, typename Corners, typename Normals>
    \n+
    140void print(const Projection<Coordinate>& projection,
    \n+
    141 const Corners& corners,
    \n+
    142 const Normals& normals)
    \n+
    143{
    \n+
    144 using namespace ProjectionWriterImplementation;
    \n+
    145
    \n+
    146 std::cout << "Side 0 corners and images:\\n";
    \n+
    147 write_points<0>(projection, corners, std::cout);
    \n+
    148 std::cout << "Side 0 success:\\n";
    \n+
    149 write_success<0>(projection, std::cout);
    \n+
    150 std::cout << "Side 1 corners and images:\\n";
    \n+
    151 write_points<1>(projection, corners, std::cout);
    \n+
    152 std::cout << "Side 1 success:\\n";
    \n+
    153 write_success<1>(projection, std::cout);
    \n+
    154 std::cout << "Side 0 normals and projected normals:\\n";
    \n+
    155 write_normals<0>(projection, normals, std::cout);
    \n+
    156 std::cout << "Side 1 normals and projected normals:\\n";
    \n+
    157 write_normals<1>(projection, normals, std::cout);
    \n+
    158 std::cout << projection.numberOfEdgeIntersections() << " edge intersections:\\n";
    \n+
    159 write_edge_intersection_points(projection, corners, std::cout);
    \n+
    160}
    \n+
    161
    \n+
    162} /* namespace GridGlue */
    \n+
    163} /* namespace Dune */
    \n
    Definition: gridglue.hh:37
    \n
    void write(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, std::ostream &out)
    write projection in VTK format
    Definition: projectionwriter_impl.hh:86
    \n
    void print(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)
    Print information about the projection to std::cout stream.
    Definition: projectionwriter_impl.hh:140
    \n+
    Corners::value_type interpolate(const Coordinate &x, const Corners &corners)
    Definition: projection_impl.hh:70
    \n+
    Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals &normals)
    Definition: projection_impl.hh:91
    \n+
    void write_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
    Definition: projectionwriter_impl.hh:27
    \n+
    void write_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
    Definition: projectionwriter_impl.hh:11
    \n+
    void write_success(const Projection< Coordinate > &projection, std::ostream &out)
    Definition: projectionwriter_impl.hh:72
    \n+
    void write_edge_intersection_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
    Definition: projectionwriter_impl.hh:43
    \n+
    void write_edge_intersection_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
    Definition: projectionwriter_impl.hh:56
    \n+
    Projection of a line (triangle) on another line (triangle).
    Definition: projection.hh:21
    \n+
    const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const
    Indicate whether projection (inverse projection) is valid for each corner or not.
    Definition: projection.hh:252
    \n+
    unsigned numberOfEdgeIntersections() const
    Number of edge intersections.
    Definition: projection.hh:262
    \n+
    const std::tuple< Images, Preimages > & images() const
    Images and preimages of corners.
    Definition: projection.hh:235
    \n+
    const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections() const
    Edge-edge intersections.
    Definition: projection.hh:273
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,63 +5,246 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * common\n-projectionwriter.hh\n+projectionwriter_impl.hh\n Go_to_the_documentation_of_this_file.\n 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH\n- 4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH\n- 5\n- 6#include \n- 7#include \n- 8\n- 9#include \n- 10\n- 11namespace Dune {\n- 12namespace GridGlue {\n- 13\n- 28template\n- 29void write(const Projection& projection,\n- 30 const Corners& corners,\n- 31 const Normals& normals,\n- 32 std::ostream& out);\n- 33\n- 40template\n- 41void write(const Projection& projection,\n- 42 const Corners& corners,\n- 43 const Normals& normals,\n- 44 const std::string& filename);\n- 54template\n- 55void print(const Projection& projection,\n- 56 const Corners& corners,\n- 57 const Normals& normals);\n- 58\n- 59} /* namespace GridGlue */\n- 60} /* namespace Dune */\n- 61\n- 62#include \"projectionwriter_impl.hh\"\n- 63\n- 64#endif\n-projectionwriter_impl.hh\n-projection.hh\n+ 3#include \n+ 4\n+ 5namespace Dune {\n+ 6namespace GridGlue {\n+ 7\n+8namespace ProjectionWriterImplementation {\n+ 9\n+ 10template\n+11void write_points(const Projection& projection, const Corners&\n+corners, std::ostream& out)\n+ 12{\n+ 13 using namespace ProjectionImplementation;\n+ 14 using std::get;\n+ 15 const unsigned other_side = 1 - side;\n+ 16\n+ 17 for (const auto& c : get(corners))\n+ 18 out << c << \"\\n\";\n+ 19\n+ 20 for (const auto& i : get(projection.images())) {\n+ 21 const auto global = interpolate(i, get(corners));\n+ 22 out << global << \"\\n\";\n+ 23 }\n+ 24}\n+ 25\n+ 26template\n+27void write_normals(const Projection& projection, const Normals&\n+normals, std::ostream& out)\n+ 28{\n+ 29 using namespace ProjectionImplementation;\n+ 30 using std::get;\n+ 31 const unsigned other_side = 1 - side;\n+ 32\n+ 33 for (const auto& n : get(normals))\n+ 34 out << n << \"\\n\";\n+ 35\n+ 36 for (const auto& x : get(projection.images())) {\n+ 37 const auto n = interpolate_unit_normals(x, get(normals));\n+ 38 out << n << \"\\n\";\n+ 39 }\n+ 40}\n+ 41\n+ 42template\n+43void write_edge_intersection_points(const Projection& projection,\n+const Corners& corners, std::ostream& out)\n+ 44{\n+ 45 using namespace ProjectionImplementation;\n+ 46 using std::get;\n+ 47\n+ 48 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {\n+ 49 const auto& local = projection.edgeIntersections()[i].local;\n+ 50 out << interpolate(local[0], get<0>(corners)) << \"\\n\"\n+ 51 << interpolate(local[1], get<1>(corners)) << \"\\n\";\n+ 52 }\n+ 53}\n+ 54\n+ 55template\n+56void write_edge_intersection_normals(const Projection&\n+projection, const Normals& normals, std::ostream& out)\n+ 57{\n+ 58 using namespace ProjectionImplementation;\n+ 59 using std::get;\n+ 60\n+ 61 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {\n+ 62 const auto& local = projection.edgeIntersections()[i].local;\n+ 63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals));\n+ 64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals));\n+ 65\n+ 66 out << n0 << \"\\n\"\n+ 67 << n1 << \"\\n\";\n+ 68 }\n+ 69}\n+ 70\n+ 71template\n+72void write_success(const Projection& projection, std::ostream&\n+out)\n+ 73{\n+ 74 using std::get;\n+ 75\n+ 76 out << side << \"\\n\";\n+ 77\n+ 78 const auto& success = get(projection.success());\n+ 79 for (std::size_t i = 0; i < success.size(); ++i)\n+ 80 out << (success[i] ? \"1\\n\" : \"0\\n\");\n+ 81}\n+ 82\n+ 83} /* namespace ProjectionWriterImplementation */\n+ 84\n+ 85template\n+86void write(const Projection& projection,\n+ 87 const Corners& corners,\n+ 88 const Normals& normals,\n+ 89 std::ostream& out)\n+ 90{\n+ 91 using namespace ProjectionWriterImplementation;\n+ 92\n+ 93 const auto numberOfEdgeIntersections = projection.numberOfEdgeIntersections\n+();\n+ 94 const auto nPoints = 12 + 2 * numberOfEdgeIntersections;\n+ 95\n+ 96 out << \"# vtk DataFile Version2.0\\n\"\n+ 97 << \"Filename: projection\\n\"\n+ 98 << \"ASCII\\n\"\n+ 99 << \"DATASET UNSTRUCTURED_GRID\\n\"\n+ 100 << \"POINTS \" << nPoints << \" double\\n\";\n+ 101 write_points<0>(projection, corners, out);\n+ 102 write_points<1>(projection, corners, out);\n+ 103 write_edge_intersection_points(projection, corners, out);\n+ 104 out << \"CELLS \" << (8 + numberOfEdgeIntersections) << \" \" << (26 + 3 *\n+numberOfEdgeIntersections) << \"\\n\";\n+ 105 out << \"3 0 1 2\\n\" \"2 0 3\\n\" \"2 1 4\\n\" \"2 2 5\\n\"\n+ 106 << \"3 6 7 8\\n\" \"2 6 9\\n\" \"2 7 10\\n\" \"2 8 11\\n\";\n+ 107 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)\n+ 108 out << \"2 \" << (12 + 2*i) << \" \" << (12 + 2*i + 1) << \"\\n\";\n+ 109 out << \"CELL_TYPES \" << (8 + numberOfEdgeIntersections) << \"\\n\"\n+\"5\\n3\\n3\\n3\\n\" \"5\\n3\\n3\\n3\\n\";\n+ 110 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)\n+ 111 out << \"3\\n\";\n+ 112 out << \"CELL_DATA \" << (8 + numberOfEdgeIntersections) << \"\\n\";\n+ 113 out << \"SCALARS success int 1\\n\"\n+ 114 << \"LOOKUP_TABLE success\\n\";\n+ 115 write_success<0>(projection, out);\n+ 116 write_success<1>(projection, out);\n+ 117 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)\n+ 118 out << \"2\\n\";\n+ 119 out << \"LOOKUP_TABLE success 2\\n\"\n+ 120 << \"1.0 0.0 0.0 1.0\\n\"\n+ 121 << \"0.0 1.0 0.0 1.0\\n\";\n+ 122 out << \"POINT_DATA \" << nPoints << \"\\n\"\n+ 123 << \"NORMALS normals double\\n\";\n+ 124 write_normals<0>(projection, normals, out);\n+ 125 write_normals<1>(projection, normals, out);\n+ 126 write_edge_intersection_normals(projection, normals, out);\n+ 127}\n+ 128\n+ 129template\n+130void write(const Projection& projection,\n+ 131 const Corners& corners,\n+ 132 const Normals& normals,\n+ 133 const std::string& filename)\n+ 134{\n+ 135 std::ofstream out(filename.c_str());\n+ 136 write(projection, corners, normals, out);\n+ 137}\n+ 138\n+ 139template\n+140void print(const Projection& projection,\n+ 141 const Corners& corners,\n+ 142 const Normals& normals)\n+ 143{\n+ 144 using namespace ProjectionWriterImplementation;\n+ 145\n+ 146 std::cout << \"Side 0 corners and images:\\n\";\n+ 147 write_points<0>(projection, corners, std::cout);\n+ 148 std::cout << \"Side 0 success:\\n\";\n+ 149 write_success<0>(projection, std::cout);\n+ 150 std::cout << \"Side 1 corners and images:\\n\";\n+ 151 write_points<1>(projection, corners, std::cout);\n+ 152 std::cout << \"Side 1 success:\\n\";\n+ 153 write_success<1>(projection, std::cout);\n+ 154 std::cout << \"Side 0 normals and projected normals:\\n\";\n+ 155 write_normals<0>(projection, normals, std::cout);\n+ 156 std::cout << \"Side 1 normals and projected normals:\\n\";\n+ 157 write_normals<1>(projection, normals, std::cout);\n+ 158 std::cout << projection.numberOfEdgeIntersections() << \" edge\n+intersections:\\n\";\n+ 159 write_edge_intersection_points(projection, corners, std::cout);\n+ 160}\n+ 161\n+ 162} /* namespace GridGlue */\n+ 163} /* namespace Dune */\n Dune\n Definition: gridglue.hh:37\n Dune::GridGlue::write\n void write(const Projection< Coordinate > &projection, const Corners &corners,\n const Normals &normals, std::ostream &out)\n write projection in VTK format\n Definition: projectionwriter_impl.hh:86\n Dune::GridGlue::print\n void print(const Projection< Coordinate > &projection, const Corners &corners,\n const Normals &normals)\n Print information about the projection to std::cout stream.\n Definition: projectionwriter_impl.hh:140\n+Dune::GridGlue::ProjectionImplementation::interpolate\n+Corners::value_type interpolate(const Coordinate &x, const Corners &corners)\n+Definition: projection_impl.hh:70\n+Dune::GridGlue::ProjectionImplementation::interpolate_unit_normals\n+Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals\n+&normals)\n+Definition: projection_impl.hh:91\n+Dune::GridGlue::ProjectionWriterImplementation::write_normals\n+void write_normals(const Projection< Coordinate > &projection, const Normals\n+&normals, std::ostream &out)\n+Definition: projectionwriter_impl.hh:27\n+Dune::GridGlue::ProjectionWriterImplementation::write_points\n+void write_points(const Projection< Coordinate > &projection, const Corners\n+&corners, std::ostream &out)\n+Definition: projectionwriter_impl.hh:11\n+Dune::GridGlue::ProjectionWriterImplementation::write_success\n+void write_success(const Projection< Coordinate > &projection, std::ostream\n+&out)\n+Definition: projectionwriter_impl.hh:72\n+Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_points\n+void write_edge_intersection_points(const Projection< Coordinate > &projection,\n+const Corners &corners, std::ostream &out)\n+Definition: projectionwriter_impl.hh:43\n+Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_normals\n+void write_edge_intersection_normals(const Projection< Coordinate >\n+&projection, const Normals &normals, std::ostream &out)\n+Definition: projectionwriter_impl.hh:56\n+Dune::GridGlue::Projection\n+Projection of a line (triangle) on another line (triangle).\n+Definition: projection.hh:21\n+Dune::GridGlue::Projection::success\n+const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const\n+Indicate whether projection (inverse projection) is valid for each corner or\n+not.\n+Definition: projection.hh:252\n+Dune::GridGlue::Projection::numberOfEdgeIntersections\n+unsigned numberOfEdgeIntersections() const\n+Number of edge intersections.\n+Definition: projection.hh:262\n+Dune::GridGlue::Projection::images\n+const std::tuple< Images, Preimages > & images() const\n+Images and preimages of corners.\n+Definition: projection.hh:235\n+Dune::GridGlue::Projection::edgeIntersections\n+const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections\n+() const\n+Edge-edge intersections.\n+Definition: projection.hh:273\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html", "unified_diff": "@@ -77,15 +77,15 @@\n More...

    \n
    #include "extractor.hh"
    \n #include <array>
    \n #include <deque>
    \n #include <functional>
    \n #include <dune/common/deprecated.hh>
    \n #include <dune/common/version.hh>
    \n-#include <dune/grid-glue/common/crossproduct.hh>
    \n+#include <dune/grid-glue/common/crossproduct.hh>
    \n
    \n

    Go to the source code of this file.

    \n

    \n Functions

    template<unsigned side, typename Coordinate , typename Corners >
    void Dune::GridGlue::ProjectionWriterImplementation::write_points (const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
     
    template<unsigned side, typename Coordinate , typename Normals >
    void Dune::GridGlue::ProjectionWriterImplementation::write_normals (const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
     
    template<typename Coordinate , typename Corners >
    void Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_points (const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
     
    template<typename Coordinate , typename Normals >
    void Dune::GridGlue::ProjectionWriterImplementation::write_edge_intersection_normals (const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
     
    template<unsigned side, typename Coordinate >
    void Dune::GridGlue::ProjectionWriterImplementation::write_success (const Projection< Coordinate > &projection, std::ostream &out)
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::write (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, std::ostream &out)
     write projection in VTK format More...
     
    template<typename Coordinate , typename Corners , typename Normals >
    void Dune::GridGlue::write (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, const std::string &filename)
     write projection in VTK format More...
    \n \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html", "unified_diff": "@@ -90,15 +90,15 @@\n
    24
    \n
    25#include <array>
    \n
    26#include <deque>
    \n
    27#include <functional>
    \n
    28
    \n
    29#include <dune/common/deprecated.hh>
    \n
    30#include <dune/common/version.hh>
    \n-\n+\n
    32
    \n
    33namespace Dune {
    \n
    34
    \n
    35 namespace GridGlue {
    \n
    36
    \n
    40template<typename GV>
    \n
    41class Codim1Extractor : public Extractor<GV,1>
    \n@@ -428,15 +428,15 @@\n
    384}
    \n
    385
    \n
    386} // namespace GridGlue
    \n
    387
    \n
    388} // namespace Dune
    \n
    389
    \n
    390#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
    \n-\n+\n
    extractor base class
    \n
    Definition: gridglue.hh:37
    \n
    IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
    Iterate over all intersections of a GridGlue.
    \n
    static Dune::FieldVector< T, dim > crossProduct(const Dune::FieldVector< T, dim > &a, const Dune::FieldVector< T, dim > &b)
    compute cross product
    Definition: crossproduct.hh:15
    \n
    Definition: codim1extractor.hh:42
    \n
    Extractor< GV, 1 >::IndexType IndexType
    Definition: codim1extractor.hh:51
    \n
    GV GridView
    Definition: codim1extractor.hh:56
    \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: computeintersection.hh File Reference\n+dune-grid-glue: overlappingmerge.hh File Reference\n \n \n \n \n \n \n \n@@ -64,46 +64,45 @@\n \n \n \n
    \n \n-
    computeintersection.hh File Reference
    \n+Namespaces
    \n+
    overlappingmerge.hh File Reference
    \n \n
    \n-
    #include <dune/common/fvector.hh>
    \n+
    #include <iostream>
    \n+#include <iomanip>
    \n+#include <vector>
    \n+#include <algorithm>
    \n #include <dune/common/fmatrix.hh>
    \n-#include "simplexintersection.cc"
    \n-#include "computeintersection.cc"
    \n+#include <dune/common/fvector.hh>
    \n+#include <dune/geometry/referenceelements.hh>
    \n+#include <dune/geometry/multilineargeometry.hh>
    \n+#include <dune/grid/common/grid.hh>
    \n+#include <dune/grid-glue/merging/standardmerge.hh>
    \n+#include <dune/grid-glue/merging/computeintersection.hh>
    \n+#include "overlappingmerge.cc"
    \n
    \n

    Go to the source code of this file.

    \n

    \n Classes

    class  Dune::GridGlue::Codim1Extractor< GV >
     
    \n \n-\n-\n-\n-\n+\n+\n \n

    \n Classes

    class  Dune::GridGlue::ComputationMethod< dimWorld, dim1, dim2, T >
     
    class  Dune::GridGlue::IntersectionComputation< CM >
     Intersection computation method for two elements of arbitrary dimension. More...
    class  Dune::GridGlue::OverlappingMerge< dim1, dim2, dimworld, T >
     Computing overlapping grid intersections for grids of different dimensions. More...
     
    \n \n \n \n \n \n-

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n-\n-\n-\n-\n

    \n-Functions

    template<class V >
    int Dune::GridGlue::insertPoint (const V p, std::vector< V > &P)
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,33 +5,35 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Classes | Namespaces | Functions\n-computeintersection.hh File Reference\n-#include \n+Classes | Namespaces\n+overlappingmerge.hh File Reference\n+#include \n+#include \n+#include \n+#include \n #include \n-#include \"simplexintersection.cc\"\n-#include \"computeintersection.cc\"\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \"overlappingmerge.cc\"\n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::GridGlue::ComputationMethod<_dimWorld,_dim1,_dim2,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::IntersectionComputation<_CM_>\n-\u00a0 Intersection computation method for two elements of arbitrary\n- dimension. More...\n+class \u00a0Dune::GridGlue::OverlappingMerge<_dim1,_dim2,_dimworld,_T_>\n+\u00a0 Computing overlapping grid intersections for grids of different\n+ dimensions. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n- Functions\n-template\n-int\u00a0Dune::GridGlue::insertPoint (const V p, std::vector< V > &P)\n-\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: computeintersection.hh Source File\n+dune-grid-glue: overlappingmerge.hh Source File\n \n \n \n \n \n \n \n@@ -62,182 +62,98 @@\n \n \n
    \n
    \n-
    computeintersection.hh
    \n+
    overlappingmerge.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n-
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    3#ifndef DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH
    \n-
    4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH
    \n-
    5
    \n-
    6#include <dune/common/fvector.hh>
    \n-
    7#include <dune/common/fmatrix.hh>
    \n-
    8
    \n-
    9namespace Dune {
    \n-
    10namespace GridGlue {
    \n-
    11
    \n-
    12template<int dimWorld, int dim1, int dim2, typename T = double>
    \n-\n-
    14public:
    \n-
    15 typedef FieldVector<T, dimWorld> Vector;
    \n-
    16 static const int grid1Dimension = dim1;
    \n-
    17 static const int grid2Dimension = dim2;
    \n-
    18 static const int intersectionDimension = (dim1 < dim2)?(dim1):(dim2);
    \n-
    19
    \n-
    20 static bool computeIntersectionPoints(const std::vector<Vector> X,
    \n-
    21 const std::vector<Vector> Y,
    \n-
    22 std::vector<std::vector<int> >& SX,
    \n-
    23 std::vector<std::vector<int> >& SY,
    \n-
    24 std::vector<Vector>& P);
    \n-
    25 static void grid1_subdivisions(const std::vector<Vector> elementCorners,
    \n-
    26 std::vector<std::vector<unsigned int> >& subElements,
    \n-
    27 std::vector<std::vector<int> >& faceIds);
    \n-
    28 static void grid2_subdivisions(const std::vector<Vector> elementCorners,
    \n-
    29 std::vector<std::vector<unsigned int> >& subElements,
    \n-
    30 std::vector<std::vector<int> >& faceIds);
    \n-
    31};
    \n-
    32
    \n-
    38template<class CM>
    \n-\n-
    40private:
    \n-
    41 typedef typename CM::Vector V;
    \n-
    42 const int dimWorld = V::dimension;
    \n-
    43 const int dim1 = CM::grid1Dimension;
    \n-
    44 const int dim2 = CM::grid2Dimension;
    \n-
    45public:
    \n-
    59 static bool computeIntersection(const std::vector<V>& X,
    \n-
    60 const std::vector<V>& Y,
    \n-
    61 std::vector<std::vector<int> >& SX,
    \n-
    62 std::vector<std::vector<int> >& SY,
    \n-
    63 std::vector<V>& P);
    \n-
    64
    \n-
    74 template<int isDim, int dW>
    \n-
    75 static void orderPoints(const V& centroid,
    \n-
    76 const std::vector<std::vector<int> >& SX,
    \n-
    77 const std::vector<std::vector<int> >& SY,
    \n-
    78 const std::vector<V>& P,
    \n-
    79 std::vector<std::vector<int> >& H)
    \n-
    80 {
    \n-
    81 if (isDim > 1)
    \n-
    82 orderPoints_(std::integral_constant<int,isDim>(),std::integral_constant<int,dW>(),
    \n-
    83 centroid, SX, SY, P,H);
    \n-
    84 }
    \n-
    85
    \n-
    86private:
    \n-
    87 static void orderPoints_(std::integral_constant<int,1>,
    \n-
    88 std::integral_constant<int,1>,
    \n-
    89 const V& centroid,
    \n-
    90 const std::vector<std::vector<int> >& SX,
    \n-
    91 const std::vector<std::vector<int> >& SY,
    \n-
    92 const std::vector<V>& P,
    \n-
    93 std::vector<std::vector<int> >& H) {}
    \n-
    94 static void orderPoints_(std::integral_constant<int,1>,
    \n-
    95 std::integral_constant<int,2>,
    \n-
    96 const V& centroid,
    \n-
    97 const std::vector<std::vector<int> >& SX,
    \n-
    98 const std::vector<std::vector<int> >& SY,
    \n-
    99 const std::vector<V>& P,
    \n-
    100 std::vector<std::vector<int> >& H) {}
    \n-
    101 static void orderPoints_(std::integral_constant<int,1>,
    \n-
    102 std::integral_constant<int,3>,
    \n-
    103 const V& centroid,
    \n-
    104 const std::vector<std::vector<int> >& SX,
    \n-
    105 const std::vector<std::vector<int> >& SY,
    \n-
    106 const std::vector<V>& P,
    \n-
    107 std::vector<std::vector<int> >& H) {}
    \n-
    108 static void orderPoints_(std::integral_constant<int,2>,
    \n-
    109 std::integral_constant<int,2>,
    \n-
    110 const V& centroid,
    \n-
    111 const std::vector<std::vector<int> >& SX,
    \n-
    112 const std::vector<std::vector<int> >& SY,
    \n-
    113 const std::vector<V>& P,
    \n-
    114 std::vector<std::vector<int> >& H);
    \n-
    115 static void orderPoints_(std::integral_constant<int,2>,
    \n-
    116 std::integral_constant<int,3>,
    \n-
    117 const V& centroid,
    \n-
    118 const std::vector<std::vector<int> >& SX,
    \n-
    119 const std::vector<std::vector<int> >& SY,
    \n-
    120 const std::vector<V>& P,
    \n-
    121 std::vector<std::vector<int> >& H);
    \n-
    122 static void orderPoints_(std::integral_constant<int,3>,
    \n-
    123 std::integral_constant<int,3>,
    \n-
    124 const V& centroid,
    \n-
    125 const std::vector<std::vector<int> >& SX,
    \n-
    126 const std::vector<std::vector<int> >& SY,
    \n-
    127 const std::vector<V>& P,
    \n-
    128 std::vector<std::vector<int> > & H);
    \n-
    129
    \n-
    137 static void orderPointsCC(std::integral_constant<int,2>,
    \n-
    138 const V& centroid,
    \n-
    139 std::vector<int> &id,
    \n-
    140 const std::vector<V>& P);
    \n-
    141 static void orderPointsCC(std::integral_constant<int,3>,
    \n-
    142 const V& centroid,
    \n-
    143 std::vector<int> &id,
    \n-
    144 const std::vector<V>& P);
    \n-
    145
    \n-
    150 static void removeDuplicates( std::vector<int> & p);
    \n-
    151
    \n-
    159 static bool newFace3D(const std::vector<int>& id,
    \n-
    160 const std::vector<std::vector<int> >& H);
    \n-
    161};
    \n-
    162
    \n-
    163template<class V>
    \n-
    164inline int insertPoint(const V p, std::vector<V>& P)
    \n-
    165{
    \n-
    166 double eps= 1e-8; // tolerance for identical nodes
    \n-
    167 std::size_t k=0 ;
    \n-
    168
    \n-
    169 if (P.size()>0) {
    \n-
    170
    \n-
    171 while ((k<P.size())&&
    \n-
    172 ((p - P[k]).infinity_norm()>eps*(P[k].infinity_norm()) &&
    \n-
    173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) &&
    \n-
    174 !(p.infinity_norm() < eps && P[k].infinity_norm() <eps &&
    \n-
    175 (p - P[k]).infinity_norm() < eps))
    \n-
    176 k++ ;
    \n-
    177
    \n-
    178 if (k>=P.size())
    \n-
    179 P.push_back(p) ; // new node is not contained in P
    \n-
    180
    \n-
    181 }
    \n-
    182 else
    \n-
    183 P.push_back(p);
    \n-
    184
    \n-
    185 return k ;
    \n-
    186}
    \n-
    187
    \n-
    188
    \n-
    189} /* namespace Dune::GridGlue */
    \n-
    190} /* namespace Dune */
    \n-
    191
    \n-
    192#include "simplexintersection.cc"
    \n-
    193#include "computeintersection.cc"
    \n-
    194
    \n-
    195#endif
    \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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n+
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n+
    5#ifndef DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
    \n+
    6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
    \n+
    7
    \n+
    8#include <iostream>
    \n+
    9#include <iomanip>
    \n+
    10#include <vector>
    \n+
    11#include <algorithm>
    \n+
    12
    \n+
    13#include <dune/common/fmatrix.hh>
    \n+
    14#include <dune/common/fvector.hh>
    \n+
    15
    \n+
    16#include <dune/geometry/referenceelements.hh>
    \n+
    17#include <dune/geometry/multilineargeometry.hh>
    \n+
    18
    \n+
    19#include <dune/grid/common/grid.hh>
    \n+
    20
    \n+\n+\n+
    23
    \n+
    24namespace Dune {
    \n+
    25namespace GridGlue {
    \n+
    26
    \n+
    34template<int dim1, int dim2, int dimworld, typename T = double>
    \n+\n+
    36 : public StandardMerge<T,dim1,dim2,dimworld>
    \n+
    37{
    \n+
    38
    \n+
    39public:
    \n+
    40
    \n+
    41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
    \n+
    42
    \n+
    44 typedef T ctype;
    \n+
    45
    \n+
    47 typedef Dune::FieldVector<T, dimworld> WorldCoords;
    \n+
    48
    \n+
    50 //typedef Dune::FieldVector<T, dim> LocalCoords;
    \n+
    51
    \n+\n+
    53 {}
    \n+
    54
    \n+
    55protected:
    \n+\n+
    57
    \n+
    69 void computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n+
    70 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n+
    71 std::bitset<(1<<dim1)>& neighborIntersects1,
    \n+
    72 unsigned int grid1Index,
    \n+
    73 const Dune::GeometryType& grid2ElementType,
    \n+
    74 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n+
    75 std::bitset<(1<<dim2)>& neighborIntersects2,
    \n+
    76 unsigned int grid2Index,
    \n+
    77 std::vector<SimplicialIntersection>& intersections);
    \n+
    78
    \n+
    79private:
    \n+
    80 bool inPlane(std::vector<FieldVector<T,dimworld> >& points);
    \n+
    81
    \n+
    82};
    \n+
    83
    \n+
    84} /* namespace Dune::GridGlue */
    \n+
    85} /* namespace Dune */
    \n+
    86
    \n+
    87#include "overlappingmerge.cc"
    \n+
    88
    \n+
    89
    \n+
    90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
    \n+\n+\n+
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    \n
    Definition: gridglue.hh:37
    \n-
    int insertPoint(const V p, std::vector< V > &P)
    Definition: computeintersection.hh:164
    \n-
    Definition: computeintersection.hh:13
    \n-
    static void grid2_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
    \n-
    static bool computeIntersectionPoints(const std::vector< Vector > X, const std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > > &SY, std::vector< Vector > &P)
    \n-
    FieldVector< T, dimWorld > Vector
    Definition: computeintersection.hh:15
    \n-
    static const int grid1Dimension
    Definition: computeintersection.hh:16
    \n-
    static void grid1_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
    \n-
    static const int grid2Dimension
    Definition: computeintersection.hh:17
    \n-
    static const int intersectionDimension
    Definition: computeintersection.hh:18
    \n-
    Intersection computation method for two elements of arbitrary dimension.
    Definition: computeintersection.hh:39
    \n-
    static void orderPoints(const V &centroid, const std::vector< std::vector< int > > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V > &P, std::vector< std::vector< int > > &H)
    Order Points in the point list P face-wise such that a subsimplex subdivision can be constructed.
    Definition: computeintersection.hh:75
    \n-
    static bool computeIntersection(const std::vector< V > &X, const std::vector< V > &Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > > &SY, std::vector< V > &P)
    Compute the intersection of two elements X and Y Compute the intersection of two elements X and Y,...
    Definition: computeintersection.cc:14
    \n+
    Computing overlapping grid intersections for grids of different dimensions.
    Definition: overlappingmerge.hh:37
    \n+
    StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection SimplicialIntersection
    Definition: overlappingmerge.hh:56
    \n+
    OverlappingMerge()
    the coordinate type used in this interface
    Definition: overlappingmerge.hh:52
    \n+
    void computeIntersections(const Dune::GeometryType &grid1ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid1ElementCorners, std::bitset<(1<< dim1)> &neighborIntersects1, unsigned int grid1Index, const Dune::GeometryType &grid2ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid2ElementCorners, std::bitset<(1<< dim2)> &neighborIntersects2, unsigned int grid2Index, std::vector< SimplicialIntersection > &intersections)
    Compute the intersection between two overlapping elements.
    Definition: overlappingmerge.cc:34
    \n+
    Dune::FieldVector< T, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: overlappingmerge.hh:47
    \n+
    T ctype
    the numeric type used in this interface
    Definition: overlappingmerge.hh:44
    \n+
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    Definition: standardmerge.hh:58
    \n+
    typename IntersectionListProvider::SimplicialIntersection SimplicialIntersection
    Definition: standardmerge.hh:83
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,215 +5,128 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-computeintersection.hh\n+overlappingmerge.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright \u00a9 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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n+ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 3#ifndef DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH\n- 4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH\n- 5\n- 6#include \n- 7#include \n- 8\n- 9namespace Dune {\n- 10namespace GridGlue {\n- 11\n- 12template\n-13class ComputationMethod {\n- 14public:\n-15 typedef FieldVector Vector;\n-16 static const int grid1Dimension = dim1;\n-17 static const int grid2Dimension = dim2;\n-18 static const int intersectionDimension = (dim1 < dim2)?(dim1):(dim2);\n- 19\n-20 static bool computeIntersectionPoints(const std::vector X,\n- 21 const std::vector Y,\n- 22 std::vector >& SX,\n- 23 std::vector >& SY,\n- 24 std::vector& P);\n-25 static void grid1_subdivisions(const std::vector elementCorners,\n- 26 std::vector >& subElements,\n- 27 std::vector >& faceIds);\n-28 static void grid2_subdivisions(const std::vector elementCorners,\n- 29 std::vector >& subElements,\n- 30 std::vector >& faceIds);\n- 31};\n- 32\n- 38template\n-39class IntersectionComputation {\n- 40private:\n- 41 typedef typename CM::Vector V;\n- 42 const int dimWorld = V::dimension;\n- 43 const int dim1 = CM::grid1Dimension;\n- 44 const int dim2 = CM::grid2Dimension;\n- 45public:\n- 59 static bool computeIntersection(const std::vector& X,\n- 60 const std::vector& Y,\n- 61 std::vector >& SX,\n- 62 std::vector >& SY,\n- 63 std::vector& P);\n- 64\n- 74 template\n-75 static void orderPoints(const V& centroid,\n- 76 const std::vector >& SX,\n- 77 const std::vector >& SY,\n- 78 const std::vector& P,\n- 79 std::vector >& H)\n- 80 {\n- 81 if (isDim > 1)\n- 82 orderPoints_(std::integral_constant(),std::\n-integral_constant(),\n- 83 centroid, SX, SY, P,H);\n- 84 }\n- 85\n- 86private:\n- 87 static void orderPoints_(std::integral_constant,\n- 88 std::integral_constant,\n- 89 const V& centroid,\n- 90 const std::vector >& SX,\n- 91 const std::vector >& SY,\n- 92 const std::vector& P,\n- 93 std::vector >& H) {}\n- 94 static void orderPoints_(std::integral_constant,\n- 95 std::integral_constant,\n- 96 const V& centroid,\n- 97 const std::vector >& SX,\n- 98 const std::vector >& SY,\n- 99 const std::vector& P,\n- 100 std::vector >& H) {}\n- 101 static void orderPoints_(std::integral_constant,\n- 102 std::integral_constant,\n- 103 const V& centroid,\n- 104 const std::vector >& SX,\n- 105 const std::vector >& SY,\n- 106 const std::vector& P,\n- 107 std::vector >& H) {}\n- 108 static void orderPoints_(std::integral_constant,\n- 109 std::integral_constant,\n- 110 const V& centroid,\n- 111 const std::vector >& SX,\n- 112 const std::vector >& SY,\n- 113 const std::vector& P,\n- 114 std::vector >& H);\n- 115 static void orderPoints_(std::integral_constant,\n- 116 std::integral_constant,\n- 117 const V& centroid,\n- 118 const std::vector >& SX,\n- 119 const std::vector >& SY,\n- 120 const std::vector& P,\n- 121 std::vector >& H);\n- 122 static void orderPoints_(std::integral_constant,\n- 123 std::integral_constant,\n- 124 const V& centroid,\n- 125 const std::vector >& SX,\n- 126 const std::vector >& SY,\n- 127 const std::vector& P,\n- 128 std::vector > & H);\n- 129\n- 137 static void orderPointsCC(std::integral_constant,\n- 138 const V& centroid,\n- 139 std::vector &id,\n- 140 const std::vector& P);\n- 141 static void orderPointsCC(std::integral_constant,\n- 142 const V& centroid,\n- 143 std::vector &id,\n- 144 const std::vector& P);\n- 145\n- 150 static void removeDuplicates( std::vector & p);\n- 151\n- 159 static bool newFace3D(const std::vector& id,\n- 160 const std::vector >& H);\n- 161};\n- 162\n- 163template\n-164inline int insertPoint(const V p, std::vector& P)\n- 165{\n- 166 double eps= 1e-8; // tolerance for identical nodes\n- 167 std::size_t k=0 ;\n- 168\n- 169 if (P.size()>0) {\n- 170\n- 171 while ((keps*(P[k].infinity_norm()) &&\n- 173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) &&\n- 174 !(p.infinity_norm() < eps && P[k].infinity_norm() =P.size())\n- 179 P.push_back(p) ; // new node is not contained in P\n- 180\n- 181 }\n- 182 else\n- 183 P.push_back(p);\n- 184\n- 185 return k ;\n- 186}\n- 187\n- 188\n- 189} /* namespace Dune::GridGlue */\n- 190} /* namespace Dune */\n- 191\n- 192#include \"simplexintersection.cc\"\n- 193#include \"computeintersection.cc\"\n- 194\n- 195#endif\n-computeintersection.cc\n-simplexintersection.cc\n+ 5#ifndef DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH\n+ 6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_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\n+ 16#include \n+ 17#include \n+ 18\n+ 19#include \n+ 20\n+ 21#include \n+ 22#include \n+ 23\n+ 24namespace Dune {\n+ 25namespace GridGlue {\n+ 26\n+ 34template\n+35class OverlappingMerge\n+ 36 : public StandardMerge\n+ 37{\n+ 38\n+ 39public:\n+ 40\n+ 41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */\n+ 42\n+44 typedef T ctype;\n+ 45\n+47 typedef Dune::FieldVector WorldCoords;\n+ 48\n+ 50 //typedef Dune::FieldVector LocalCoords;\n+ 51\n+52 OverlappingMerge()\n+ 53 {}\n+ 54\n+ 55protected:\n+56 typedef typename StandardMerge::SimplicialIntersection\n+SimplicialIntersection;\n+ 57\n+ 69 void computeIntersections(const Dune::GeometryType& grid1ElementType,\n+ 70 const std::vector >& grid1ElementCorners,\n+ 71 std::bitset<(1<& neighborIntersects1,\n+ 72 unsigned int grid1Index,\n+ 73 const Dune::GeometryType& grid2ElementType,\n+ 74 const std::vector >& grid2ElementCorners,\n+ 75 std::bitset<(1<& neighborIntersects2,\n+ 76 unsigned int grid2Index,\n+ 77 std::vector& intersections);\n+ 78\n+ 79private:\n+ 80 bool inPlane(std::vector >& points);\n+ 81\n+ 82};\n+ 83\n+ 84} /* namespace Dune::GridGlue */\n+ 85} /* namespace Dune */\n+ 86\n+ 87#include \"overlappingmerge.cc\"\n+ 88\n+ 89\n+ 90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH\n+computeintersection.hh\n+overlappingmerge.cc\n+standardmerge.hh\n+Common base class for many merger implementations: produce pairs of entities\n+that may intersect.\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::insertPoint\n-int insertPoint(const V p, std::vector< V > &P)\n-Definition: computeintersection.hh:164\n-Dune::GridGlue::ComputationMethod\n-Definition: computeintersection.hh:13\n-Dune::GridGlue::ComputationMethod::grid2_subdivisions\n-static void grid2_subdivisions(const std::vector< Vector > elementCorners,\n-std::vector< std::vector< unsigned int > > &subElements, std::vector< std::\n-vector< int > > &faceIds)\n-Dune::GridGlue::ComputationMethod::computeIntersectionPoints\n-static bool computeIntersectionPoints(const std::vector< Vector > X, const\n-std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector<\n-std::vector< int > > &SY, std::vector< Vector > &P)\n-Dune::GridGlue::ComputationMethod::Vector\n-FieldVector< T, dimWorld > Vector\n-Definition: computeintersection.hh:15\n-Dune::GridGlue::ComputationMethod::grid1Dimension\n-static const int grid1Dimension\n-Definition: computeintersection.hh:16\n-Dune::GridGlue::ComputationMethod::grid1_subdivisions\n-static void grid1_subdivisions(const std::vector< Vector > elementCorners,\n-std::vector< std::vector< unsigned int > > &subElements, std::vector< std::\n-vector< int > > &faceIds)\n-Dune::GridGlue::ComputationMethod::grid2Dimension\n-static const int grid2Dimension\n-Definition: computeintersection.hh:17\n-Dune::GridGlue::ComputationMethod::intersectionDimension\n-static const int intersectionDimension\n-Definition: computeintersection.hh:18\n-Dune::GridGlue::IntersectionComputation\n-Intersection computation method for two elements of arbitrary dimension.\n-Definition: computeintersection.hh:39\n-Dune::GridGlue::IntersectionComputation::orderPoints\n-static void orderPoints(const V ¢roid, const std::vector< std::vector< int\n-> > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V >\n-&P, std::vector< std::vector< int > > &H)\n-Order Points in the point list P face-wise such that a subsimplex subdivision\n-can be constructed.\n-Definition: computeintersection.hh:75\n-Dune::GridGlue::IntersectionComputation::computeIntersection\n-static bool computeIntersection(const std::vector< V > &X, const std::vector< V\n-> &Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > >\n-&SY, std::vector< V > &P)\n-Compute the intersection of two elements X and Y Compute the intersection of\n-two elements X and Y,...\n-Definition: computeintersection.cc:14\n+Dune::GridGlue::OverlappingMerge\n+Computing overlapping grid intersections for grids of different dimensions.\n+Definition: overlappingmerge.hh:37\n+Dune::GridGlue::OverlappingMerge::SimplicialIntersection\n+StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection\n+SimplicialIntersection\n+Definition: overlappingmerge.hh:56\n+Dune::GridGlue::OverlappingMerge::OverlappingMerge\n+OverlappingMerge()\n+the coordinate type used in this interface\n+Definition: overlappingmerge.hh:52\n+Dune::GridGlue::OverlappingMerge::computeIntersections\n+void computeIntersections(const Dune::GeometryType &grid1ElementType, const\n+std::vector< Dune::FieldVector< T, dimworld > > &grid1ElementCorners, std::\n+bitset<(1<< dim1)> &neighborIntersects1, unsigned int grid1Index, const Dune::\n+GeometryType &grid2ElementType, const std::vector< Dune::FieldVector< T,\n+dimworld > > &grid2ElementCorners, std::bitset<(1<< dim2)>\n+&neighborIntersects2, unsigned int grid2Index, std::vector<\n+SimplicialIntersection > &intersections)\n+Compute the intersection between two overlapping elements.\n+Definition: overlappingmerge.cc:34\n+Dune::GridGlue::OverlappingMerge::WorldCoords\n+Dune::FieldVector< T, dimworld > WorldCoords\n+the coordinate type used in this interface\n+Definition: overlappingmerge.hh:47\n+Dune::GridGlue::OverlappingMerge::ctype\n+T ctype\n+the numeric type used in this interface\n+Definition: overlappingmerge.hh:44\n+Dune::GridGlue::StandardMerge\n+Common base class for many merger implementations: produce pairs of entities\n+that may intersect.\n+Definition: standardmerge.hh:58\n+Dune::GridGlue::StandardMerge::SimplicialIntersection\n+typename IntersectionListProvider::SimplicialIntersection\n+SimplicialIntersection\n+Definition: standardmerge.hh:83\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: standardmerge.cc File Reference\n+dune-grid-glue: conformingmerge.hh File Reference\n \n \n \n \n \n \n \n@@ -63,110 +63,48 @@\n \n
    \n
    \n \n-
    standardmerge.cc File Reference
    \n+Classes |\n+Namespaces
    \n+
    conformingmerge.hh File Reference
    \n \n
    \n-
    #include "config.h"
    \n-#include "standardmerge.hh"
    \n-
    \n+\n+

    Implementation of the Merger concept for conforming interfaces. \n+More...

    \n+
    #include <iomanip>
    \n+#include <vector>
    \n+#include <algorithm>
    \n+#include <bitset>
    \n+#include <dune/common/fmatrix.hh>
    \n+#include <dune/common/fvector.hh>
    \n+#include <dune/geometry/referenceelements.hh>
    \n+#include <dune/grid-glue/merging/standardmerge.hh>
    \n+
    \n+

    Go to the source code of this file.

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

    \n+Classes

    class  Dune::GridGlue::ConformingMerge< dim, dimworld, T >
     Implementation of the Merger concept for conforming interfaces. More...
     
    \n \n \n \n \n \n-

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n-\n-\n-\n-\n-\n-

    \n-Macros

    #define DECL
     
    #define STANDARD_MERGE_INSTANTIATE(T, A, B, C)
     
    \n-\n-\n-\n-\n-\n-\n-\n

    \n-Functions

     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 1, 1, 1)
     
     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 2, 2, 2)
     
     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 3, 3, 3)
     
    \n-

    Macro Definition Documentation

    \n-\n-

    ◆ DECL

    \n-\n-
    \n-
    \n- \n- \n- \n- \n-
    #define DECL
    \n-
    \n-\n-
    \n-
    \n-\n-

    ◆ STANDARD_MERGE_INSTANTIATE

    \n-\n-
    \n-
    \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
    #define STANDARD_MERGE_INSTANTIATE( T,
     A,
     B,
     
    )
    \n-
    \n-Value:
    DECL template \\
    \n-
    void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1_coords, \\
    \n-
    const std::vector<unsigned int>& grid1_elements, \\
    \n-
    const std::vector<Dune::GeometryType>& grid1_element_types, \\
    \n-
    const std::vector<Dune::FieldVector<T,C> >& grid2_coords, \\
    \n-
    const std::vector<unsigned int>& grid2_elements, \\
    \n-
    const std::vector<Dune::GeometryType>& grid2_element_types \\
    \n-
    )
    \n-
    #define DECL
    Definition: standardmerge.cc:12
    \n-
    \n-
    \n-
    \n-
    \n+

    Detailed Description

    \n+

    Implementation of the Merger concept for conforming interfaces.

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,53 +5,33 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Namespaces | Macros | Functions\n-standardmerge.cc File Reference\n-#include \"config.h\"\n-#include \"standardmerge.hh\"\n+Classes | Namespaces\n+conformingmerge.hh File Reference\n+Implementation of the Merger concept for conforming interfaces. More...\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+class \u00a0Dune::GridGlue::ConformingMerge<_dim,_dimworld,_T_>\n+\u00a0 Implementation of the Merger concept for conforming interfaces. More...\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n- Macros\n-#define\u00a0DECL\n-\u00a0\n-#define\u00a0STANDARD_MERGE_INSTANTIATE(T, A, B, C)\n-\u00a0\n- Functions\n-\u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 1, 1, 1)\n-\u00a0\n-\u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 2, 2, 2)\n-\u00a0\n-\u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 3, 3, 3)\n-\u00a0\n-***** Macro Definition Documentation *****\n-***** \u25c6\u00a0DECL *****\n-#define DECL\n-***** \u25c6\u00a0STANDARD_MERGE_INSTANTIATE *****\n-#define STANDARD_MERGE_INSTANTIATE ( \u00a0T,\n- \u00a0A,\n- \u00a0B,\n- \u00a0C\u00a0\n- )\n-Value:\n-DECL template \\\n-void StandardMerge::build(const std::vector >&\n-grid1_coords, \\\n-const std::vector& grid1_elements, \\\n-const std::vector& grid1_element_types, \\\n-const std::vector >& grid2_coords, \\\n-const std::vector& grid2_elements, \\\n-const std::vector& grid2_element_types \\\n-)\n-DECL\n-#define DECL\n-Definition: standardmerge.cc:12\n+***** Detailed Description *****\n+Implementation of the Merger concept for conforming interfaces.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: contactmerge.hh File Reference\n+dune-grid-glue: merger.hh File Reference\n \n \n \n \n \n \n \n@@ -65,54 +65,37 @@\n
  • dune
  • grid-glue
  • merging
  • \n \n \n
    \n \n-
    contactmerge.hh File Reference
    \n+
    merger.hh File Reference
    \n
    \n
    \n-\n-

    Merge two grid boundary surfaces that may be a positive distance apart. \n-More...

    \n-
    #include <iostream>
    \n-#include <fstream>
    \n-#include <iomanip>
    \n-#include <vector>
    \n-#include <algorithm>
    \n-#include <limits>
    \n-#include <memory>
    \n-#include <functional>
    \n+
    #include <vector>
    \n #include <dune/common/fvector.hh>
    \n-#include <dune/common/exceptions.hh>
    \n-#include <dune/common/bitsetvector.hh>
    \n-#include <dune/common/deprecated.hh>
    \n-#include <dune/grid/common/grid.hh>
    \n-#include <dune/grid-glue/merging/standardmerge.hh>
    \n-#include <dune/grid-glue/gridglue.hh>
    \n-#include "contactmerge.cc"
    \n+#include <dune/geometry/type.hh>
    \n+#include <dune/grid-glue/merging/intersectionlist.hh>
    \n
    \n

    Go to the source code of this file.

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

    \n Classes

    class  Dune::GridGlue::ContactMerge< dimworld, T >
     Merge two codimension-1 surfaces that may be a positive distance apart. More...
    class  Dune::GridGlue::Merger< ctype, grid1Dim, grid2Dim, dimworld >
     Abstract base for all classes that take extracted grids and build sets of intersections. More...
     
    \n \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n-

    Detailed Description

    \n-

    Merge two grid boundary surfaces that may be a positive distance apart.

    \n-
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -6,41 +6,26 @@\n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n Classes | Namespaces\n-contactmerge.hh File Reference\n-Merge two grid boundary surfaces that may be a positive distance apart. More...\n-#include \n-#include \n-#include \n+merger.hh File Reference\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 \"contactmerge.cc\"\n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::GridGlue::ContactMerge<_dimworld,_T_>\n-\u00a0 Merge two codimension-1 surfaces that may be a positive distance apart.\n- More...\n+class \u00a0Dune::GridGlue::Merger<_ctype,_grid1Dim,_grid2Dim,_dimworld_>\n+\u00a0 Abstract base for all classes that take extracted grids and build sets\n+ of intersections. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n-***** Detailed Description *****\n-Merge two grid boundary surfaces that may be a positive distance apart.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: contactmerge.hh Source File\n+dune-grid-glue: merger.hh Source File\n \n \n \n \n \n \n \n@@ -62,217 +62,101 @@\n \n \n \n
    \n-
    contactmerge.hh
    \n+
    merger.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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    10#ifndef DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH
    \n-
    11#define DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH
    \n+
    5#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH
    \n+
    6#define DUNE_GRIDGLUE_MERGING_MERGER_HH
    \n+
    7
    \n+
    8#include <vector>
    \n+
    9
    \n+
    10#include <dune/common/fvector.hh>
    \n+
    11#include <dune/geometry/type.hh>
    \n
    12
    \n-
    13
    \n-
    14#include <iostream>
    \n-
    15#include <fstream>
    \n-
    16#include <iomanip>
    \n-
    17#include <vector>
    \n-
    18#include <algorithm>
    \n-
    19#include <limits>
    \n-
    20#include <memory>
    \n-
    21#include <functional>
    \n-
    22
    \n-
    23#include <dune/common/fvector.hh>
    \n-
    24#include <dune/common/exceptions.hh>
    \n-
    25#include <dune/common/bitsetvector.hh>
    \n-
    26#include <dune/common/deprecated.hh>
    \n-
    27
    \n-
    28#include <dune/grid/common/grid.hh>
    \n+\n+
    14
    \n+
    15namespace Dune {
    \n+
    16namespace GridGlue {
    \n+
    17
    \n+
    25template <class ctype, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    26class Merger
    \n+
    27{
    \n+
    28public:
    \n
    29
    \n-\n-\n+
    31 typedef Dune::FieldVector<ctype, grid1Dim> Grid1Coords;
    \n
    32
    \n-
    33namespace Dune {
    \n-
    34namespace GridGlue {
    \n+
    34 typedef Dune::FieldVector<ctype, grid2Dim> Grid2Coords;
    \n
    35
    \n-
    41template<int dimworld, typename T = double>
    \n-\n-
    43: public StandardMerge<T,dimworld-1,dimworld-1,dimworld>
    \n-
    44{
    \n-
    45 static constexpr int dim = dimworld-1;
    \n-
    46
    \n-
    47 static_assert( dim==1 || dim==2,
    \n-
    48 "ContactMerge yet only handles the cases dim==1 and dim==2!");
    \n-
    49
    \n-\n-
    51public:
    \n-
    52
    \n-
    53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
    \n-
    54
    \n-
    56 typedef T ctype;
    \n-
    57
    \n-
    59 typedef Dune::FieldVector<T, dimworld> WorldCoords;
    \n+
    37 typedef Dune::FieldVector<ctype, dimworld> WorldCoords;
    \n+
    38
    \n+\n+
    40
    \n+
    54 virtual void build(const std::vector<Dune::FieldVector<ctype,dimworld> >& grid1_coords,
    \n+
    55 const std::vector<unsigned int>& grid1_elements,
    \n+
    56 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    57 const std::vector<Dune::FieldVector<ctype,dimworld> >& grid2_coords,
    \n+
    58 const std::vector<unsigned int>& grid2_elements,
    \n+
    59 const std::vector<Dune::GeometryType>& grid2_element_types) = 0;
    \n
    60
    \n-
    62 typedef Dune::FieldVector<T, dim> LocalCoords;
    \n-
    63
    \n-\n-
    73 ContactMerge(const T allowedOverlap=T(0),
    \n-
    74 std::function<WorldCoords(WorldCoords)> domainDirections=nullptr,
    \n-
    75 std::function<WorldCoords(WorldCoords)> targetDirections=nullptr,
    \n-\n-
    77 : domainDirections_(domainDirections), targetDirections_(targetDirections),
    \n-
    78 overlap_(allowedOverlap), type_(type)
    \n-
    79 {}
    \n-
    80
    \n-
    86 ContactMerge(const T allowedOverlap, ProjectionType type)
    \n-
    87 : overlap_(allowedOverlap),
    \n-
    88 type_(type)
    \n-
    89 {}
    \n-
    90
    \n-
    99 inline
    \n-
    100 void setSurfaceDirections(std::function<WorldCoords(WorldCoords)> domainDirections,
    \n-
    101 std::function<WorldCoords(WorldCoords)> targetDirections)
    \n-
    102 {
    \n-
    103 domainDirections_ = domainDirections;
    \n-
    104 targetDirections_ = targetDirections;
    \n-
    105 this->valid = false;
    \n-
    106 }
    \n-
    107
    \n-
    109 void setOverlap(T overlap)
    \n-
    110 {
    \n-
    111 overlap_ = overlap;
    \n-
    112 }
    \n-
    113
    \n-
    115 T getOverlap() const
    \n-
    116 {
    \n-
    117 return overlap_;
    \n-
    118 }
    \n+
    64 unsigned int nSimplices() const
    \n+
    65 { return intersectionList()->size(); }
    \n+
    66
    \n+
    67 virtual void clear() = 0;
    \n+
    68
    \n+
    74 virtual std::shared_ptr<IntersectionList> intersectionList() const = 0;
    \n+
    75
    \n+
    79 template<int n>
    \n+
    80 unsigned int parents(unsigned int idx) const {
    \n+
    81 return intersectionList()->template parents<n>(idx);
    \n+
    82 }
    \n+
    83
    \n+
    90 template<int n>
    \n+
    91 unsigned int parent(unsigned int idx, unsigned int parId = 0) const
    \n+
    92 {
    \n+
    93 return intersectionList()->template parent<n>(idx, parId);
    \n+
    94 }
    \n+
    95
    \n+
    104 template<int n>
    \n+
    105 auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId = 0) const
    \n+
    106 {
    \n+
    107 return intersectionList()->template corner<n>(idx, corner, parId);
    \n+
    108 }
    \n+
    109
    \n+
    114 unsigned int counter;
    \n+
    115};
    \n+
    116
    \n+
    117} /* namespace GridGlue */
    \n+
    118} /* namespace Dune */
    \n
    119
    \n-
    123 void minNormalAngle(T angle)
    \n-
    124 {
    \n-
    125 using std::cos;
    \n-
    126 maxNormalProduct_ = cos(angle);
    \n-
    127 }
    \n-
    128
    \n-\n-
    133 {
    \n-
    134 using std::acos;
    \n-
    135 return acos(maxNormalProduct_);
    \n-
    136 }
    \n-
    137
    \n-
    138protected:
    \n-
    139 typedef typename StandardMerge<T,dimworld-1,dimworld-1,dimworld>::SimplicialIntersection SimplicialIntersection;
    \n-
    140
    \n-
    141private:
    \n-
    145 std::function<WorldCoords(WorldCoords)> domainDirections_;
    \n-
    146 std::vector<WorldCoords> nodalDomainDirections_;
    \n-
    147
    \n-
    156 std::function<WorldCoords(WorldCoords)> targetDirections_;
    \n-
    157 std::vector<WorldCoords> nodalTargetDirections_;
    \n-
    158
    \n-
    160 T overlap_;
    \n-
    161
    \n-
    163 ProjectionType type_;
    \n-
    164
    \n-
    168 T maxNormalProduct_ = T(-0.1);
    \n-
    169
    \n-
    174 void computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n-
    175 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n-
    176 std::bitset<(1<<dim)>& neighborIntersects1,
    \n-
    177 unsigned int grid1Index,
    \n-
    178 const Dune::GeometryType& grid2ElementType,
    \n-
    179 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n-
    180 std::bitset<(1<<dim)>& neighborIntersects2,
    \n-
    181 unsigned int grid2Index,
    \n-
    182 std::vector<SimplicialIntersection>& intersections) override;
    \n-
    183
    \n-
    187protected:
    \n-
    188 void build(const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n-
    189 const std::vector<unsigned int>& grid1Elements,
    \n-
    190 const std::vector<Dune::GeometryType>& grid1ElementTypes,
    \n-
    191 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n-
    192 const std::vector<unsigned int>& grid2Elements,
    \n-
    193 const std::vector<Dune::GeometryType>& grid2ElementTypes) override
    \n-
    194 {
    \n-
    195 std::cout<<"ContactMerge building grid!\\n";
    \n-
    196 // setup the nodal direction vectors
    \n-
    197 setupNodalDirections(grid1Coords, grid1Elements, grid1ElementTypes,
    \n-
    198 grid2Coords, grid2Elements, grid2ElementTypes);
    \n-
    199
    \n-
    200 Base::build(grid1Coords, grid1Elements, grid1ElementTypes,
    \n-
    201 grid2Coords, grid2Elements, grid2ElementTypes);
    \n-
    202
    \n-
    203 }
    \n-
    204
    \n-
    205private:
    \n-
    206
    \n-
    208 static LocalCoords localCornerCoords(int i, const Dune::GeometryType& gt)
    \n-
    209 {
    \n-
    210 const auto& ref = Dune::ReferenceElements<T,dim>::general(gt);
    \n-
    211 return ref.position(i,dim);
    \n-
    212 }
    \n-
    213
    \n-
    214protected:
    \n-
    215
    \n-
    217 void computeCyclicOrder(const std::vector<std::array<LocalCoords,2> >& polytopeCorners,
    \n-
    218 const LocalCoords& center, std::vector<int>& ordering) const;
    \n-
    219
    \n-
    221 void setupNodalDirections(const std::vector<WorldCoords>& coords1,
    \n-
    222 const std::vector<unsigned int>& elements1,
    \n-
    223 const std::vector<Dune::GeometryType>& elementTypes1,
    \n-
    224 const std::vector<WorldCoords>& coords2,
    \n-
    225 const std::vector<unsigned int>& elements2,
    \n-
    226 const std::vector<Dune::GeometryType>& elementTypes2);
    \n-
    227
    \n-
    229 void computeOuterNormalField(const std::vector<WorldCoords>& coords,
    \n-
    230 const std::vector<unsigned int>& elements,
    \n-
    231 const std::vector<Dune::GeometryType>& elementTypes,
    \n-
    232 std::vector<WorldCoords>& normals);
    \n-
    233
    \n-
    235 void removeDoubles(std::vector<std::array<LocalCoords,2> >& polytopeCorners);
    \n-
    236};
    \n-
    237
    \n-
    238} /* namespace GridGlue */
    \n-
    239} /* namespace Dune */
    \n-
    240
    \n-
    241#include "contactmerge.cc"
    \n-
    242
    \n-
    243#endif // DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH
    \n-
    Central component of the module implementing the coupling of two grids.
    \n-\n-
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    \n+
    120#endif
    \n+\n
    Definition: gridglue.hh:37
    \n-
    Merge two codimension-1 surfaces that may be a positive distance apart.
    Definition: contactmerge.hh:44
    \n-
    void computeCyclicOrder(const std::vector< std::array< LocalCoords, 2 > > &polytopeCorners, const LocalCoords &center, std::vector< int > &ordering) const
    Order the corners of the intersection polytope in cyclic order.
    Definition: contactmerge.cc:214
    \n-
    StandardMerge< T, dimworld-1, dimworld-1, dimworld >::SimplicialIntersection SimplicialIntersection
    Definition: contactmerge.hh:139
    \n-
    void removeDoubles(std::vector< std::array< LocalCoords, 2 > > &polytopeCorners)
    Remove all multiples.
    Definition: contactmerge.cc:335
    \n-
    void setOverlap(T overlap)
    Set the allowed overlap of the surfaces.
    Definition: contactmerge.hh:109
    \n-
    Dune::FieldVector< T, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: contactmerge.hh:59
    \n-
    void setupNodalDirections(const std::vector< WorldCoords > &coords1, const std::vector< unsigned int > &elements1, const std::vector< Dune::GeometryType > &elementTypes1, const std::vector< WorldCoords > &coords2, const std::vector< unsigned int > &elements2, const std::vector< Dune::GeometryType > &elementTypes2)
    Setup the direction vectors containing the directions for each vertex.
    Definition: contactmerge.cc:269
    \n-
    void minNormalAngle(T angle)
    set minimum angle in radians between normals at x and \u03a6(x)
    Definition: contactmerge.hh:123
    \n-
    T ctype
    the numeric type used in this interface
    Definition: contactmerge.hh:56
    \n-
    ProjectionType
    Type of the projection, closest point or outer normal projection.
    Definition: contactmerge.hh:65
    \n-
    @ CLOSEST_POINT
    Definition: contactmerge.hh:65
    \n-
    @ OUTER_NORMAL
    Definition: contactmerge.hh:65
    \n-
    void computeOuterNormalField(const std::vector< WorldCoords > &coords, const std::vector< unsigned int > &elements, const std::vector< Dune::GeometryType > &elementTypes, std::vector< WorldCoords > &normals)
    If no direction field was specified compute the outer normal field.
    Definition: contactmerge.cc:296
    \n-
    T getOverlap() const
    Get the allowed overlap of the surfaces.
    Definition: contactmerge.hh:115
    \n-
    ContactMerge(const T allowedOverlap=T(0), std::function< WorldCoords(WorldCoords)> domainDirections=nullptr, std::function< WorldCoords(WorldCoords)> targetDirections=nullptr, ProjectionType type=OUTER_NORMAL)
    Construct merger given overlap and possible projection directions.
    Definition: contactmerge.hh:73
    \n-
    void setSurfaceDirections(std::function< WorldCoords(WorldCoords)> domainDirections, std::function< WorldCoords(WorldCoords)> targetDirections)
    Set surface direction functions.
    Definition: contactmerge.hh:100
    \n-
    void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords, const std::vector< unsigned int > &grid1Elements, const std::vector< Dune::GeometryType > &grid1ElementTypes, const std::vector< Dune::FieldVector< T, dimworld > > &grid2Coords, const std::vector< unsigned int > &grid2Elements, const std::vector< Dune::GeometryType > &grid2ElementTypes) override
    builds the merged grid
    Definition: contactmerge.hh:188
    \n-
    ContactMerge(const T allowedOverlap, ProjectionType type)
    Construct merger given overlap and type of the projection.
    Definition: contactmerge.hh:86
    \n-
    T minNormalAngle() const
    get minimum angle in radians between normals at x and \u03a6(x)
    Definition: contactmerge.hh:132
    \n-
    Dune::FieldVector< T, dim > LocalCoords
    the coordinate type used in this interface
    Definition: contactmerge.hh:62
    \n-
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    Definition: standardmerge.hh:58
    \n-
    void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1_Coords, const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< T, dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements, const std::vector< Dune::GeometryType > &grid2_element_types) override
    builds the merged grid
    Definition: standardmerge.hh:392
    \n-\n+
    Coordinate corner(unsigned c)
    Definition: projection_impl.hh:24
    \n+
    Definition: intersectionlist.hh:134
    \n+
    Abstract base for all classes that take extracted grids and build sets of intersections.
    Definition: merger.hh:27
    \n+
    unsigned int parent(unsigned int idx, unsigned int parId=0) const
    get index of grid-n's parent simplex for given merged grid simplex
    Definition: merger.hh:91
    \n+
    virtual void clear()=0
    \n+
    Dune::FieldVector< ctype, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: merger.hh:37
    \n+
    Dune::FieldVector< ctype, grid1Dim > Grid1Coords
    the local coordinate type for the grid1 coordinates
    Definition: merger.hh:31
    \n+
    unsigned int counter
    Counts the number of times the computeIntersection method has been called.
    Definition: merger.hh:114
    \n+
    auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId=0) const
    get the grid-n parent's simplex local coordinates for a particular merged grid simplex corner (parent...
    Definition: merger.hh:105
    \n+
    virtual void build(const std::vector< Dune::FieldVector< ctype, dimworld > > &grid1_coords, const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< ctype, dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements, const std::vector< Dune::GeometryType > &grid2_element_types)=0
    builds the merged grid
    \n+
    unsigned int nSimplices() const
    get the number of simplices in the merged grid The indices are then in 0..nSimplices()-1
    Definition: merger.hh:64
    \n+
    virtual std::shared_ptr< IntersectionList > intersectionList() const =0
    \n+
    unsigned int parents(unsigned int idx) const
    Definition: merger.hh:80
    \n+
    Dune::FieldVector< ctype, grid2Dim > Grid2Coords
    the local coordinate type for the grid2 coordinates
    Definition: merger.hh:34
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,308 +5,143 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-contactmerge.hh\n+merger.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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 10#ifndef DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH\n- 11#define DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH\n+ 5#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH\n+ 6#define DUNE_GRIDGLUE_MERGING_MERGER_HH\n+ 7\n+ 8#include \n+ 9\n+ 10#include \n+ 11#include \n 12\n- 13\n- 14#include \n- 15#include \n- 16#include \n- 17#include \n- 18#include \n- 19#include \n- 20#include \n- 21#include \n- 22\n- 23#include \n- 24#include \n- 25#include \n- 26#include \n- 27\n- 28#include \n+ 13#include \n+ 14\n+ 15namespace Dune {\n+ 16namespace GridGlue {\n+ 17\n+ 25template \n+26class Merger\n+ 27{\n+ 28public:\n 29\n- 30#include \n- 31#include \n+31 typedef Dune::FieldVector Grid1Coords;\n 32\n- 33namespace Dune {\n- 34namespace GridGlue {\n+34 typedef Dune::FieldVector Grid2Coords;\n 35\n- 41template\n-42class ContactMerge\n- 43: public StandardMerge\n- 44{\n- 45 static constexpr int dim = dimworld-1;\n- 46\n- 47 static_assert( dim==1 || dim==2,\n- 48 \"ContactMerge yet only handles the cases dim==1 and dim==2!\");\n- 49\n- 50 typedef StandardMerge Base;\n- 51public:\n- 52\n- 53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */\n- 54\n-56 typedef T ctype;\n- 57\n-59 typedef Dune::FieldVector WorldCoords;\n+37 typedef Dune::FieldVector WorldCoords;\n+ 38\n+39 using IntersectionList = Dune::GridGlue::IntersectionList;\n+ 40\n+54 virtual void build(const std::vector >&\n+grid1_coords,\n+ 55 const std::vector& grid1_elements,\n+ 56 const std::vector& grid1_element_types,\n+ 57 const std::vector >& grid2_coords,\n+ 58 const std::vector& grid2_elements,\n+ 59 const std::vector& grid2_element_types) = 0;\n 60\n-62 typedef Dune::FieldVector LocalCoords;\n- 63\n-65 enum ProjectionType {OUTER_NORMAL, CLOSEST_POINT};\n-73 ContactMerge(const T allowedOverlap=T(0),\n- 74 std::function domainDirections=nullptr,\n- 75 std::function targetDirections=nullptr,\n- 76 ProjectionType type = OUTER_NORMAL)\n- 77 : domainDirections_(domainDirections), targetDirections_(targetDirections),\n- 78 overlap_(allowedOverlap), type_(type)\n- 79 {}\n- 80\n-86 ContactMerge(const T allowedOverlap, ProjectionType type)\n- 87 : overlap_(allowedOverlap),\n- 88 type_(type)\n- 89 {}\n- 90\n- 99 inline\n-100 void setSurfaceDirections(std::function\n-domainDirections,\n- 101 std::function targetDirections)\n- 102 {\n- 103 domainDirections_ = domainDirections;\n- 104 targetDirections_ = targetDirections;\n- 105 this->valid = false;\n- 106 }\n- 107\n-109 void setOverlap(T overlap)\n- 110 {\n- 111 overlap_ = overlap;\n- 112 }\n- 113\n-115 T getOverlap() const\n- 116 {\n- 117 return overlap_;\n- 118 }\n+64 unsigned int nSimplices() const\n+ 65 { return intersectionList()->size(); }\n+ 66\n+67 virtual void clear() = 0;\n+ 68\n+74 virtual std::shared_ptr intersectionList() const = 0;\n+ 75\n+ 79 template\n+80 unsigned int parents(unsigned int idx) const {\n+ 81 return intersectionList()->template parents(idx);\n+ 82 }\n+ 83\n+ 90 template\n+91 unsigned int parent(unsigned int idx, unsigned int parId = 0) const\n+ 92 {\n+ 93 return intersectionList()->template parent(idx, parId);\n+ 94 }\n+ 95\n+ 104 template\n+105 auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId\n+= 0) const\n+ 106 {\n+ 107 return intersectionList()->template corner(idx, corner, parId);\n+ 108 }\n+ 109\n+114 unsigned int counter;\n+ 115};\n+ 116\n+ 117} /* namespace GridGlue */\n+ 118} /* namespace Dune */\n 119\n-123 void minNormalAngle(T angle)\n- 124 {\n- 125 using std::cos;\n- 126 maxNormalProduct_ = cos(angle);\n- 127 }\n- 128\n-132 T minNormalAngle() const\n- 133 {\n- 134 using std::acos;\n- 135 return acos(maxNormalProduct_);\n- 136 }\n- 137\n- 138protected:\n-139 typedef typename StandardMerge::\n-SimplicialIntersection SimplicialIntersection;\n- 140\n- 141private:\n- 145 std::function domainDirections_;\n- 146 std::vector nodalDomainDirections_;\n- 147\n- 156 std::function targetDirections_;\n- 157 std::vector nodalTargetDirections_;\n- 158\n- 160 T overlap_;\n- 161\n- 163 ProjectionType type_;\n- 164\n- 168 T maxNormalProduct_ = T(-0.1);\n- 169\n- 174 void computeIntersections(const Dune::GeometryType& grid1ElementType,\n- 175 const std::vector >& grid1ElementCorners,\n- 176 std::bitset<(1<& neighborIntersects1,\n- 177 unsigned int grid1Index,\n- 178 const Dune::GeometryType& grid2ElementType,\n- 179 const std::vector >& grid2ElementCorners,\n- 180 std::bitset<(1<& neighborIntersects2,\n- 181 unsigned int grid2Index,\n- 182 std::vector& intersections) override;\n- 183\n- 187protected:\n-188 void build(const std::vector >& grid1Coords,\n- 189 const std::vector& grid1Elements,\n- 190 const std::vector& grid1ElementTypes,\n- 191 const std::vector >& grid2Coords,\n- 192 const std::vector& grid2Elements,\n- 193 const std::vector& grid2ElementTypes) override\n- 194 {\n- 195 std::cout<<\"ContactMerge building grid!\\n\";\n- 196 // setup the nodal direction vectors\n- 197 setupNodalDirections(grid1Coords, grid1Elements, grid1ElementTypes,\n- 198 grid2Coords, grid2Elements, grid2ElementTypes);\n- 199\n- 200 Base::build(grid1Coords, grid1Elements, grid1ElementTypes,\n- 201 grid2Coords, grid2Elements, grid2ElementTypes);\n- 202\n- 203 }\n- 204\n- 205private:\n- 206\n- 208 static LocalCoords localCornerCoords(int i, const Dune::GeometryType& gt)\n- 209 {\n- 210 const auto& ref = Dune::ReferenceElements::general(gt);\n- 211 return ref.position(i,dim);\n- 212 }\n- 213\n- 214protected:\n- 215\n- 217 void computeCyclicOrder(const std::vector >&\n-polytopeCorners,\n- 218 const LocalCoords& center, std::vector& ordering) const;\n- 219\n- 221 void setupNodalDirections(const std::vector& coords1,\n- 222 const std::vector& elements1,\n- 223 const std::vector& elementTypes1,\n- 224 const std::vector& coords2,\n- 225 const std::vector& elements2,\n- 226 const std::vector& elementTypes2);\n- 227\n- 229 void computeOuterNormalField(const std::vector& coords,\n- 230 const std::vector& elements,\n- 231 const std::vector& elementTypes,\n- 232 std::vector& normals);\n- 233\n- 235 void removeDoubles(std::vector >&\n-polytopeCorners);\n- 236};\n- 237\n- 238} /* namespace GridGlue */\n- 239} /* namespace Dune */\n- 240\n- 241#include \"contactmerge.cc\"\n- 242\n- 243#endif // DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH\n-gridglue.hh\n-Central component of the module implementing the coupling of two grids.\n-contactmerge.cc\n-standardmerge.hh\n-Common base class for many merger implementations: produce pairs of entities\n-that may intersect.\n+ 120#endif\n+intersectionlist.hh\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::ContactMerge\n-Merge two codimension-1 surfaces that may be a positive distance apart.\n-Definition: contactmerge.hh:44\n-Dune::GridGlue::ContactMerge::computeCyclicOrder\n-void computeCyclicOrder(const std::vector< std::array< LocalCoords, 2 > >\n-&polytopeCorners, const LocalCoords ¢er, std::vector< int > &ordering)\n-const\n-Order the corners of the intersection polytope in cyclic order.\n-Definition: contactmerge.cc:214\n-Dune::GridGlue::ContactMerge::SimplicialIntersection\n-StandardMerge< T, dimworld-1, dimworld-1, dimworld >::SimplicialIntersection\n-SimplicialIntersection\n-Definition: contactmerge.hh:139\n-Dune::GridGlue::ContactMerge::removeDoubles\n-void removeDoubles(std::vector< std::array< LocalCoords, 2 > >\n-&polytopeCorners)\n-Remove all multiples.\n-Definition: contactmerge.cc:335\n-Dune::GridGlue::ContactMerge::setOverlap\n-void setOverlap(T overlap)\n-Set the allowed overlap of the surfaces.\n-Definition: contactmerge.hh:109\n-Dune::GridGlue::ContactMerge::WorldCoords\n-Dune::FieldVector< T, dimworld > WorldCoords\n-the coordinate type used in this interface\n-Definition: contactmerge.hh:59\n-Dune::GridGlue::ContactMerge::setupNodalDirections\n-void setupNodalDirections(const std::vector< WorldCoords > &coords1, const\n-std::vector< unsigned int > &elements1, const std::vector< Dune::GeometryType >\n-&elementTypes1, const std::vector< WorldCoords > &coords2, const std::vector<\n-unsigned int > &elements2, const std::vector< Dune::GeometryType >\n-&elementTypes2)\n-Setup the direction vectors containing the directions for each vertex.\n-Definition: contactmerge.cc:269\n-Dune::GridGlue::ContactMerge::minNormalAngle\n-void minNormalAngle(T angle)\n-set minimum angle in radians between normals at x and \u03a6(x)\n-Definition: contactmerge.hh:123\n-Dune::GridGlue::ContactMerge::ctype\n-T ctype\n-the numeric type used in this interface\n-Definition: contactmerge.hh:56\n-Dune::GridGlue::ContactMerge::ProjectionType\n-ProjectionType\n-Type of the projection, closest point or outer normal projection.\n-Definition: contactmerge.hh:65\n-Dune::GridGlue::ContactMerge::CLOSEST_POINT\n-@ CLOSEST_POINT\n-Definition: contactmerge.hh:65\n-Dune::GridGlue::ContactMerge::OUTER_NORMAL\n-@ OUTER_NORMAL\n-Definition: contactmerge.hh:65\n-Dune::GridGlue::ContactMerge::computeOuterNormalField\n-void computeOuterNormalField(const std::vector< WorldCoords > &coords, const\n-std::vector< unsigned int > &elements, const std::vector< Dune::GeometryType >\n-&elementTypes, std::vector< WorldCoords > &normals)\n-If no direction field was specified compute the outer normal field.\n-Definition: contactmerge.cc:296\n-Dune::GridGlue::ContactMerge::getOverlap\n-T getOverlap() const\n-Get the allowed overlap of the surfaces.\n-Definition: contactmerge.hh:115\n-Dune::GridGlue::ContactMerge::ContactMerge\n-ContactMerge(const T allowedOverlap=T(0), std::function< WorldCoords\n-(WorldCoords)> domainDirections=nullptr, std::function< WorldCoords\n-(WorldCoords)> targetDirections=nullptr, ProjectionType type=OUTER_NORMAL)\n-Construct merger given overlap and possible projection directions.\n-Definition: contactmerge.hh:73\n-Dune::GridGlue::ContactMerge::setSurfaceDirections\n-void setSurfaceDirections(std::function< WorldCoords(WorldCoords)>\n-domainDirections, std::function< WorldCoords(WorldCoords)> targetDirections)\n-Set surface direction functions.\n-Definition: contactmerge.hh:100\n-Dune::GridGlue::ContactMerge::build\n-void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords,\n-const std::vector< unsigned int > &grid1Elements, const std::vector< Dune::\n-GeometryType > &grid1ElementTypes, const std::vector< Dune::FieldVector< T,\n-dimworld > > &grid2Coords, const std::vector< unsigned int > &grid2Elements,\n-const std::vector< Dune::GeometryType > &grid2ElementTypes) override\n-builds the merged grid\n-Definition: contactmerge.hh:188\n-Dune::GridGlue::ContactMerge::ContactMerge\n-ContactMerge(const T allowedOverlap, ProjectionType type)\n-Construct merger given overlap and type of the projection.\n-Definition: contactmerge.hh:86\n-Dune::GridGlue::ContactMerge::minNormalAngle\n-T minNormalAngle() const\n-get minimum angle in radians between normals at x and \u03a6(x)\n-Definition: contactmerge.hh:132\n-Dune::GridGlue::ContactMerge::LocalCoords\n-Dune::FieldVector< T, dim > LocalCoords\n+Dune::GridGlue::ProjectionImplementation::corner\n+Coordinate corner(unsigned c)\n+Definition: projection_impl.hh:24\n+Dune::GridGlue::IntersectionList\n+Definition: intersectionlist.hh:134\n+Dune::GridGlue::Merger\n+Abstract base for all classes that take extracted grids and build sets of\n+intersections.\n+Definition: merger.hh:27\n+Dune::GridGlue::Merger::parent\n+unsigned int parent(unsigned int idx, unsigned int parId=0) const\n+get index of grid-n's parent simplex for given merged grid simplex\n+Definition: merger.hh:91\n+Dune::GridGlue::Merger::clear\n+virtual void clear()=0\n+Dune::GridGlue::Merger::WorldCoords\n+Dune::FieldVector< ctype, dimworld > WorldCoords\n the coordinate type used in this interface\n-Definition: contactmerge.hh:62\n-Dune::GridGlue::StandardMerge\n-Common base class for many merger implementations: produce pairs of entities\n-that may intersect.\n-Definition: standardmerge.hh:58\n-Dune::GridGlue::StandardMerge::build\n-void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1_Coords,\n-const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::\n-GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< T,\n-dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements,\n-const std::vector< Dune::GeometryType > &grid2_element_types) override\n+Definition: merger.hh:37\n+Dune::GridGlue::Merger::Grid1Coords\n+Dune::FieldVector< ctype, grid1Dim > Grid1Coords\n+the local coordinate type for the grid1 coordinates\n+Definition: merger.hh:31\n+Dune::GridGlue::Merger::counter\n+unsigned int counter\n+Counts the number of times the computeIntersection method has been called.\n+Definition: merger.hh:114\n+Dune::GridGlue::Merger::parentLocal\n+auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId=0)\n+const\n+get the grid-n parent's simplex local coordinates for a particular merged grid\n+simplex corner (parent...\n+Definition: merger.hh:105\n+Dune::GridGlue::Merger::build\n+virtual void build(const std::vector< Dune::FieldVector< ctype, dimworld > >\n+&grid1_coords, const std::vector< unsigned int > &grid1_elements, const std::\n+vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::\n+FieldVector< ctype, dimworld > > &grid2_coords, const std::vector< unsigned int\n+> &grid2_elements, const std::vector< Dune::GeometryType >\n+&grid2_element_types)=0\n builds the merged grid\n-Definition: standardmerge.hh:392\n-Dune::GridGlue::StandardMerge<_double,_dimworld-1,_dimworld-1,_dimworld_>::\n-valid\n-bool valid\n-Definition: standardmerge.hh:86\n+Dune::GridGlue::Merger::nSimplices\n+unsigned int nSimplices() const\n+get the number of simplices in the merged grid The indices are then in\n+0..nSimplices()-1\n+Definition: merger.hh:64\n+Dune::GridGlue::Merger::intersectionList\n+virtual std::shared_ptr< IntersectionList > intersectionList() const =0\n+Dune::GridGlue::Merger::parents\n+unsigned int parents(unsigned int idx) const\n+Definition: merger.hh:80\n+Dune::GridGlue::Merger::Grid2Coords\n+Dune::FieldVector< ctype, grid2Dim > Grid2Coords\n+the local coordinate type for the grid2 coordinates\n+Definition: merger.hh:34\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: intersectionlist.hh File Reference\n+dune-grid-glue: computeintersection.cc File Reference\n \n \n \n \n \n \n \n@@ -63,38 +63,19 @@\n \n \n
    \n \n-
    intersectionlist.hh File Reference
    \n+
    computeintersection.cc File Reference
    \n
    \n
    \n-
    #include <array>
    \n-#include <type_traits>
    \n-#include <utility>
    \n-#include <vector>
    \n-#include <dune/common/fvector.hh>
    \n-
    \n-

    Go to the source code of this file.

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

    \n-Classes

    class  Dune::GridGlue::IntersectionListProvider< L0, L1 >
     
    class  Dune::GridGlue::IntersectionList< Local0, Local1 >
     
    class  Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 >
     
    struct  Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 >::SimplicialIntersection
     
    \n \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,32 +5,16 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Classes | Namespaces\n-intersectionlist.hh File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n-Go_to_the_source_code_of_this_file.\n- Classes\n- class \u00a0Dune::GridGlue::IntersectionListProvider<_L0,_L1_>\n-\u00a0\n- class \u00a0Dune::GridGlue::IntersectionList<_Local0,_Local1_>\n-\u00a0\n- class \u00a0Dune::GridGlue::SimplicialIntersectionListProvider<_dim0,_dim1_>\n-\u00a0\n-struct \u00a0Dune::GridGlue::SimplicialIntersectionListProvider<_dim0,_dim1_>::\n- SimplicialIntersection\n-\u00a0\n+Namespaces\n+computeintersection.cc File Reference\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n \n ===============================================================================\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: overlappingmerge.hh File Reference\n+dune-grid-glue: computeintersection.hh File Reference\n \n \n \n \n \n \n \n@@ -64,45 +64,46 @@\n \n
    \n \n
    \n \n-
    overlappingmerge.hh File Reference
    \n+Namespaces |\n+Functions
    \n+
    computeintersection.hh File Reference
    \n \n
    \n-
    #include <iostream>
    \n-#include <iomanip>
    \n-#include <vector>
    \n-#include <algorithm>
    \n+
    #include <dune/common/fvector.hh>
    \n #include <dune/common/fmatrix.hh>
    \n-#include <dune/common/fvector.hh>
    \n-#include <dune/geometry/referenceelements.hh>
    \n-#include <dune/geometry/multilineargeometry.hh>
    \n-#include <dune/grid/common/grid.hh>
    \n-#include <dune/grid-glue/merging/standardmerge.hh>
    \n-#include <dune/grid-glue/merging/computeintersection.hh>
    \n-#include "overlappingmerge.cc"
    \n+#include "simplexintersection.cc"
    \n+#include "computeintersection.cc"
    \n
    \n

    Go to the source code of this file.

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

    \n Classes

    class  Dune::GridGlue::OverlappingMerge< dim1, dim2, dimworld, T >
     Computing overlapping grid intersections for grids of different dimensions. More...
    class  Dune::GridGlue::ComputationMethod< dimWorld, dim1, dim2, T >
     
    class  Dune::GridGlue::IntersectionComputation< CM >
     Intersection computation method for two elements of arbitrary dimension. More...
     
    \n \n \n \n \n \n+

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n+\n+\n+\n+\n

    \n+Functions

    template<class V >
    int Dune::GridGlue::insertPoint (const V p, std::vector< V > &P)
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,35 +5,33 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Classes | Namespaces\n-overlappingmerge.hh File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n+Classes | Namespaces | Functions\n+computeintersection.hh File Reference\n #include \n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \"overlappingmerge.cc\"\n+#include \n+#include \"simplexintersection.cc\"\n+#include \"computeintersection.cc\"\n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::GridGlue::OverlappingMerge<_dim1,_dim2,_dimworld,_T_>\n-\u00a0 Computing overlapping grid intersections for grids of different\n- dimensions. More...\n+class \u00a0Dune::GridGlue::ComputationMethod<_dimWorld,_dim1,_dim2,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::IntersectionComputation<_CM_>\n+\u00a0 Intersection computation method for two elements of arbitrary\n+ dimension. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n+ Functions\n+template\n+int\u00a0Dune::GridGlue::insertPoint (const V p, std::vector< V > &P)\n+\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: overlappingmerge.hh Source File\n+dune-grid-glue: computeintersection.hh Source File\n \n \n \n \n \n \n \n@@ -62,98 +62,182 @@\n \n \n
    \n
    \n-
    overlappingmerge.hh
    \n+
    computeintersection.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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n-
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    5#ifndef DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
    \n-
    6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
    \n-
    7
    \n-
    8#include <iostream>
    \n-
    9#include <iomanip>
    \n-
    10#include <vector>
    \n-
    11#include <algorithm>
    \n-
    12
    \n-
    13#include <dune/common/fmatrix.hh>
    \n-
    14#include <dune/common/fvector.hh>
    \n-
    15
    \n-
    16#include <dune/geometry/referenceelements.hh>
    \n-
    17#include <dune/geometry/multilineargeometry.hh>
    \n-
    18
    \n-
    19#include <dune/grid/common/grid.hh>
    \n-
    20
    \n-\n-\n-
    23
    \n-
    24namespace Dune {
    \n-
    25namespace GridGlue {
    \n-
    26
    \n-
    34template<int dim1, int dim2, int dimworld, typename T = double>
    \n-\n-
    36 : public StandardMerge<T,dim1,dim2,dimworld>
    \n-
    37{
    \n-
    38
    \n-
    39public:
    \n-
    40
    \n-
    41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
    \n-
    42
    \n-
    44 typedef T ctype;
    \n-
    45
    \n-
    47 typedef Dune::FieldVector<T, dimworld> WorldCoords;
    \n-
    48
    \n-
    50 //typedef Dune::FieldVector<T, dim> LocalCoords;
    \n-
    51
    \n-\n-
    53 {}
    \n-
    54
    \n-
    55protected:
    \n-\n-
    57
    \n-
    69 void computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n-
    70 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n-
    71 std::bitset<(1<<dim1)>& neighborIntersects1,
    \n-
    72 unsigned int grid1Index,
    \n-
    73 const Dune::GeometryType& grid2ElementType,
    \n-
    74 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n-
    75 std::bitset<(1<<dim2)>& neighborIntersects2,
    \n-
    76 unsigned int grid2Index,
    \n-
    77 std::vector<SimplicialIntersection>& intersections);
    \n-
    78
    \n-
    79private:
    \n-
    80 bool inPlane(std::vector<FieldVector<T,dimworld> >& points);
    \n-
    81
    \n-
    82};
    \n-
    83
    \n-
    84} /* namespace Dune::GridGlue */
    \n-
    85} /* namespace Dune */
    \n-
    86
    \n-
    87#include "overlappingmerge.cc"
    \n-
    88
    \n-
    89
    \n-
    90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
    \n-\n-\n-
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    \n+Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n+
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n+
    3#ifndef DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH
    \n+
    4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH
    \n+
    5
    \n+
    6#include <dune/common/fvector.hh>
    \n+
    7#include <dune/common/fmatrix.hh>
    \n+
    8
    \n+
    9namespace Dune {
    \n+
    10namespace GridGlue {
    \n+
    11
    \n+
    12template<int dimWorld, int dim1, int dim2, typename T = double>
    \n+\n+
    14public:
    \n+
    15 typedef FieldVector<T, dimWorld> Vector;
    \n+
    16 static const int grid1Dimension = dim1;
    \n+
    17 static const int grid2Dimension = dim2;
    \n+
    18 static const int intersectionDimension = (dim1 < dim2)?(dim1):(dim2);
    \n+
    19
    \n+
    20 static bool computeIntersectionPoints(const std::vector<Vector> X,
    \n+
    21 const std::vector<Vector> Y,
    \n+
    22 std::vector<std::vector<int> >& SX,
    \n+
    23 std::vector<std::vector<int> >& SY,
    \n+
    24 std::vector<Vector>& P);
    \n+
    25 static void grid1_subdivisions(const std::vector<Vector> elementCorners,
    \n+
    26 std::vector<std::vector<unsigned int> >& subElements,
    \n+
    27 std::vector<std::vector<int> >& faceIds);
    \n+
    28 static void grid2_subdivisions(const std::vector<Vector> elementCorners,
    \n+
    29 std::vector<std::vector<unsigned int> >& subElements,
    \n+
    30 std::vector<std::vector<int> >& faceIds);
    \n+
    31};
    \n+
    32
    \n+
    38template<class CM>
    \n+\n+
    40private:
    \n+
    41 typedef typename CM::Vector V;
    \n+
    42 const int dimWorld = V::dimension;
    \n+
    43 const int dim1 = CM::grid1Dimension;
    \n+
    44 const int dim2 = CM::grid2Dimension;
    \n+
    45public:
    \n+
    59 static bool computeIntersection(const std::vector<V>& X,
    \n+
    60 const std::vector<V>& Y,
    \n+
    61 std::vector<std::vector<int> >& SX,
    \n+
    62 std::vector<std::vector<int> >& SY,
    \n+
    63 std::vector<V>& P);
    \n+
    64
    \n+
    74 template<int isDim, int dW>
    \n+
    75 static void orderPoints(const V& centroid,
    \n+
    76 const std::vector<std::vector<int> >& SX,
    \n+
    77 const std::vector<std::vector<int> >& SY,
    \n+
    78 const std::vector<V>& P,
    \n+
    79 std::vector<std::vector<int> >& H)
    \n+
    80 {
    \n+
    81 if (isDim > 1)
    \n+
    82 orderPoints_(std::integral_constant<int,isDim>(),std::integral_constant<int,dW>(),
    \n+
    83 centroid, SX, SY, P,H);
    \n+
    84 }
    \n+
    85
    \n+
    86private:
    \n+
    87 static void orderPoints_(std::integral_constant<int,1>,
    \n+
    88 std::integral_constant<int,1>,
    \n+
    89 const V& centroid,
    \n+
    90 const std::vector<std::vector<int> >& SX,
    \n+
    91 const std::vector<std::vector<int> >& SY,
    \n+
    92 const std::vector<V>& P,
    \n+
    93 std::vector<std::vector<int> >& H) {}
    \n+
    94 static void orderPoints_(std::integral_constant<int,1>,
    \n+
    95 std::integral_constant<int,2>,
    \n+
    96 const V& centroid,
    \n+
    97 const std::vector<std::vector<int> >& SX,
    \n+
    98 const std::vector<std::vector<int> >& SY,
    \n+
    99 const std::vector<V>& P,
    \n+
    100 std::vector<std::vector<int> >& H) {}
    \n+
    101 static void orderPoints_(std::integral_constant<int,1>,
    \n+
    102 std::integral_constant<int,3>,
    \n+
    103 const V& centroid,
    \n+
    104 const std::vector<std::vector<int> >& SX,
    \n+
    105 const std::vector<std::vector<int> >& SY,
    \n+
    106 const std::vector<V>& P,
    \n+
    107 std::vector<std::vector<int> >& H) {}
    \n+
    108 static void orderPoints_(std::integral_constant<int,2>,
    \n+
    109 std::integral_constant<int,2>,
    \n+
    110 const V& centroid,
    \n+
    111 const std::vector<std::vector<int> >& SX,
    \n+
    112 const std::vector<std::vector<int> >& SY,
    \n+
    113 const std::vector<V>& P,
    \n+
    114 std::vector<std::vector<int> >& H);
    \n+
    115 static void orderPoints_(std::integral_constant<int,2>,
    \n+
    116 std::integral_constant<int,3>,
    \n+
    117 const V& centroid,
    \n+
    118 const std::vector<std::vector<int> >& SX,
    \n+
    119 const std::vector<std::vector<int> >& SY,
    \n+
    120 const std::vector<V>& P,
    \n+
    121 std::vector<std::vector<int> >& H);
    \n+
    122 static void orderPoints_(std::integral_constant<int,3>,
    \n+
    123 std::integral_constant<int,3>,
    \n+
    124 const V& centroid,
    \n+
    125 const std::vector<std::vector<int> >& SX,
    \n+
    126 const std::vector<std::vector<int> >& SY,
    \n+
    127 const std::vector<V>& P,
    \n+
    128 std::vector<std::vector<int> > & H);
    \n+
    129
    \n+
    137 static void orderPointsCC(std::integral_constant<int,2>,
    \n+
    138 const V& centroid,
    \n+
    139 std::vector<int> &id,
    \n+
    140 const std::vector<V>& P);
    \n+
    141 static void orderPointsCC(std::integral_constant<int,3>,
    \n+
    142 const V& centroid,
    \n+
    143 std::vector<int> &id,
    \n+
    144 const std::vector<V>& P);
    \n+
    145
    \n+
    150 static void removeDuplicates( std::vector<int> & p);
    \n+
    151
    \n+
    159 static bool newFace3D(const std::vector<int>& id,
    \n+
    160 const std::vector<std::vector<int> >& H);
    \n+
    161};
    \n+
    162
    \n+
    163template<class V>
    \n+
    164inline int insertPoint(const V p, std::vector<V>& P)
    \n+
    165{
    \n+
    166 double eps= 1e-8; // tolerance for identical nodes
    \n+
    167 std::size_t k=0 ;
    \n+
    168
    \n+
    169 if (P.size()>0) {
    \n+
    170
    \n+
    171 while ((k<P.size())&&
    \n+
    172 ((p - P[k]).infinity_norm()>eps*(P[k].infinity_norm()) &&
    \n+
    173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) &&
    \n+
    174 !(p.infinity_norm() < eps && P[k].infinity_norm() <eps &&
    \n+
    175 (p - P[k]).infinity_norm() < eps))
    \n+
    176 k++ ;
    \n+
    177
    \n+
    178 if (k>=P.size())
    \n+
    179 P.push_back(p) ; // new node is not contained in P
    \n+
    180
    \n+
    181 }
    \n+
    182 else
    \n+
    183 P.push_back(p);
    \n+
    184
    \n+
    185 return k ;
    \n+
    186}
    \n+
    187
    \n+
    188
    \n+
    189} /* namespace Dune::GridGlue */
    \n+
    190} /* namespace Dune */
    \n+
    191
    \n+
    192#include "simplexintersection.cc"
    \n+
    193#include "computeintersection.cc"
    \n+
    194
    \n+
    195#endif
    \n+\n+\n
    Definition: gridglue.hh:37
    \n-
    Computing overlapping grid intersections for grids of different dimensions.
    Definition: overlappingmerge.hh:37
    \n-
    StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection SimplicialIntersection
    Definition: overlappingmerge.hh:56
    \n-
    OverlappingMerge()
    the coordinate type used in this interface
    Definition: overlappingmerge.hh:52
    \n-
    void computeIntersections(const Dune::GeometryType &grid1ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid1ElementCorners, std::bitset<(1<< dim1)> &neighborIntersects1, unsigned int grid1Index, const Dune::GeometryType &grid2ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid2ElementCorners, std::bitset<(1<< dim2)> &neighborIntersects2, unsigned int grid2Index, std::vector< SimplicialIntersection > &intersections)
    Compute the intersection between two overlapping elements.
    Definition: overlappingmerge.cc:34
    \n-
    Dune::FieldVector< T, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: overlappingmerge.hh:47
    \n-
    T ctype
    the numeric type used in this interface
    Definition: overlappingmerge.hh:44
    \n-
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    Definition: standardmerge.hh:58
    \n-
    typename IntersectionListProvider::SimplicialIntersection SimplicialIntersection
    Definition: standardmerge.hh:83
    \n+
    int insertPoint(const V p, std::vector< V > &P)
    Definition: computeintersection.hh:164
    \n+
    Definition: computeintersection.hh:13
    \n+
    static void grid2_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
    \n+
    static bool computeIntersectionPoints(const std::vector< Vector > X, const std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > > &SY, std::vector< Vector > &P)
    \n+
    FieldVector< T, dimWorld > Vector
    Definition: computeintersection.hh:15
    \n+
    static const int grid1Dimension
    Definition: computeintersection.hh:16
    \n+
    static void grid1_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
    \n+
    static const int grid2Dimension
    Definition: computeintersection.hh:17
    \n+
    static const int intersectionDimension
    Definition: computeintersection.hh:18
    \n+
    Intersection computation method for two elements of arbitrary dimension.
    Definition: computeintersection.hh:39
    \n+
    static void orderPoints(const V &centroid, const std::vector< std::vector< int > > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V > &P, std::vector< std::vector< int > > &H)
    Order Points in the point list P face-wise such that a subsimplex subdivision can be constructed.
    Definition: computeintersection.hh:75
    \n+
    static bool computeIntersection(const std::vector< V > &X, const std::vector< V > &Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > > &SY, std::vector< V > &P)
    Compute the intersection of two elements X and Y Compute the intersection of two elements X and Y,...
    Definition: computeintersection.cc:14
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,128 +5,215 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-overlappingmerge.hh\n+computeintersection.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 \u00a9 DUNE Project contributors, see file\n+ 1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n- 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n+ 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 5#ifndef DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH\n- 6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_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\n- 16#include \n- 17#include \n- 18\n- 19#include \n- 20\n- 21#include \n- 22#include \n- 23\n- 24namespace Dune {\n- 25namespace GridGlue {\n- 26\n- 34template\n-35class OverlappingMerge\n- 36 : public StandardMerge\n- 37{\n- 38\n- 39public:\n- 40\n- 41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */\n- 42\n-44 typedef T ctype;\n- 45\n-47 typedef Dune::FieldVector WorldCoords;\n- 48\n- 50 //typedef Dune::FieldVector LocalCoords;\n- 51\n-52 OverlappingMerge()\n- 53 {}\n- 54\n- 55protected:\n-56 typedef typename StandardMerge::SimplicialIntersection\n-SimplicialIntersection;\n- 57\n- 69 void computeIntersections(const Dune::GeometryType& grid1ElementType,\n- 70 const std::vector >& grid1ElementCorners,\n- 71 std::bitset<(1<& neighborIntersects1,\n- 72 unsigned int grid1Index,\n- 73 const Dune::GeometryType& grid2ElementType,\n- 74 const std::vector >& grid2ElementCorners,\n- 75 std::bitset<(1<& neighborIntersects2,\n- 76 unsigned int grid2Index,\n- 77 std::vector& intersections);\n- 78\n- 79private:\n- 80 bool inPlane(std::vector >& points);\n- 81\n- 82};\n- 83\n- 84} /* namespace Dune::GridGlue */\n- 85} /* namespace Dune */\n- 86\n- 87#include \"overlappingmerge.cc\"\n- 88\n- 89\n- 90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH\n-computeintersection.hh\n-overlappingmerge.cc\n-standardmerge.hh\n-Common base class for many merger implementations: produce pairs of entities\n-that may intersect.\n+ 3#ifndef DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH\n+ 4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH\n+ 5\n+ 6#include \n+ 7#include \n+ 8\n+ 9namespace Dune {\n+ 10namespace GridGlue {\n+ 11\n+ 12template\n+13class ComputationMethod {\n+ 14public:\n+15 typedef FieldVector Vector;\n+16 static const int grid1Dimension = dim1;\n+17 static const int grid2Dimension = dim2;\n+18 static const int intersectionDimension = (dim1 < dim2)?(dim1):(dim2);\n+ 19\n+20 static bool computeIntersectionPoints(const std::vector X,\n+ 21 const std::vector Y,\n+ 22 std::vector >& SX,\n+ 23 std::vector >& SY,\n+ 24 std::vector& P);\n+25 static void grid1_subdivisions(const std::vector elementCorners,\n+ 26 std::vector >& subElements,\n+ 27 std::vector >& faceIds);\n+28 static void grid2_subdivisions(const std::vector elementCorners,\n+ 29 std::vector >& subElements,\n+ 30 std::vector >& faceIds);\n+ 31};\n+ 32\n+ 38template\n+39class IntersectionComputation {\n+ 40private:\n+ 41 typedef typename CM::Vector V;\n+ 42 const int dimWorld = V::dimension;\n+ 43 const int dim1 = CM::grid1Dimension;\n+ 44 const int dim2 = CM::grid2Dimension;\n+ 45public:\n+ 59 static bool computeIntersection(const std::vector& X,\n+ 60 const std::vector& Y,\n+ 61 std::vector >& SX,\n+ 62 std::vector >& SY,\n+ 63 std::vector& P);\n+ 64\n+ 74 template\n+75 static void orderPoints(const V& centroid,\n+ 76 const std::vector >& SX,\n+ 77 const std::vector >& SY,\n+ 78 const std::vector& P,\n+ 79 std::vector >& H)\n+ 80 {\n+ 81 if (isDim > 1)\n+ 82 orderPoints_(std::integral_constant(),std::\n+integral_constant(),\n+ 83 centroid, SX, SY, P,H);\n+ 84 }\n+ 85\n+ 86private:\n+ 87 static void orderPoints_(std::integral_constant,\n+ 88 std::integral_constant,\n+ 89 const V& centroid,\n+ 90 const std::vector >& SX,\n+ 91 const std::vector >& SY,\n+ 92 const std::vector& P,\n+ 93 std::vector >& H) {}\n+ 94 static void orderPoints_(std::integral_constant,\n+ 95 std::integral_constant,\n+ 96 const V& centroid,\n+ 97 const std::vector >& SX,\n+ 98 const std::vector >& SY,\n+ 99 const std::vector& P,\n+ 100 std::vector >& H) {}\n+ 101 static void orderPoints_(std::integral_constant,\n+ 102 std::integral_constant,\n+ 103 const V& centroid,\n+ 104 const std::vector >& SX,\n+ 105 const std::vector >& SY,\n+ 106 const std::vector& P,\n+ 107 std::vector >& H) {}\n+ 108 static void orderPoints_(std::integral_constant,\n+ 109 std::integral_constant,\n+ 110 const V& centroid,\n+ 111 const std::vector >& SX,\n+ 112 const std::vector >& SY,\n+ 113 const std::vector& P,\n+ 114 std::vector >& H);\n+ 115 static void orderPoints_(std::integral_constant,\n+ 116 std::integral_constant,\n+ 117 const V& centroid,\n+ 118 const std::vector >& SX,\n+ 119 const std::vector >& SY,\n+ 120 const std::vector& P,\n+ 121 std::vector >& H);\n+ 122 static void orderPoints_(std::integral_constant,\n+ 123 std::integral_constant,\n+ 124 const V& centroid,\n+ 125 const std::vector >& SX,\n+ 126 const std::vector >& SY,\n+ 127 const std::vector& P,\n+ 128 std::vector > & H);\n+ 129\n+ 137 static void orderPointsCC(std::integral_constant,\n+ 138 const V& centroid,\n+ 139 std::vector &id,\n+ 140 const std::vector& P);\n+ 141 static void orderPointsCC(std::integral_constant,\n+ 142 const V& centroid,\n+ 143 std::vector &id,\n+ 144 const std::vector& P);\n+ 145\n+ 150 static void removeDuplicates( std::vector & p);\n+ 151\n+ 159 static bool newFace3D(const std::vector& id,\n+ 160 const std::vector >& H);\n+ 161};\n+ 162\n+ 163template\n+164inline int insertPoint(const V p, std::vector& P)\n+ 165{\n+ 166 double eps= 1e-8; // tolerance for identical nodes\n+ 167 std::size_t k=0 ;\n+ 168\n+ 169 if (P.size()>0) {\n+ 170\n+ 171 while ((keps*(P[k].infinity_norm()) &&\n+ 173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) &&\n+ 174 !(p.infinity_norm() < eps && P[k].infinity_norm() =P.size())\n+ 179 P.push_back(p) ; // new node is not contained in P\n+ 180\n+ 181 }\n+ 182 else\n+ 183 P.push_back(p);\n+ 184\n+ 185 return k ;\n+ 186}\n+ 187\n+ 188\n+ 189} /* namespace Dune::GridGlue */\n+ 190} /* namespace Dune */\n+ 191\n+ 192#include \"simplexintersection.cc\"\n+ 193#include \"computeintersection.cc\"\n+ 194\n+ 195#endif\n+computeintersection.cc\n+simplexintersection.cc\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::OverlappingMerge\n-Computing overlapping grid intersections for grids of different dimensions.\n-Definition: overlappingmerge.hh:37\n-Dune::GridGlue::OverlappingMerge::SimplicialIntersection\n-StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection\n-SimplicialIntersection\n-Definition: overlappingmerge.hh:56\n-Dune::GridGlue::OverlappingMerge::OverlappingMerge\n-OverlappingMerge()\n-the coordinate type used in this interface\n-Definition: overlappingmerge.hh:52\n-Dune::GridGlue::OverlappingMerge::computeIntersections\n-void computeIntersections(const Dune::GeometryType &grid1ElementType, const\n-std::vector< Dune::FieldVector< T, dimworld > > &grid1ElementCorners, std::\n-bitset<(1<< dim1)> &neighborIntersects1, unsigned int grid1Index, const Dune::\n-GeometryType &grid2ElementType, const std::vector< Dune::FieldVector< T,\n-dimworld > > &grid2ElementCorners, std::bitset<(1<< dim2)>\n-&neighborIntersects2, unsigned int grid2Index, std::vector<\n-SimplicialIntersection > &intersections)\n-Compute the intersection between two overlapping elements.\n-Definition: overlappingmerge.cc:34\n-Dune::GridGlue::OverlappingMerge::WorldCoords\n-Dune::FieldVector< T, dimworld > WorldCoords\n-the coordinate type used in this interface\n-Definition: overlappingmerge.hh:47\n-Dune::GridGlue::OverlappingMerge::ctype\n-T ctype\n-the numeric type used in this interface\n-Definition: overlappingmerge.hh:44\n-Dune::GridGlue::StandardMerge\n-Common base class for many merger implementations: produce pairs of entities\n-that may intersect.\n-Definition: standardmerge.hh:58\n-Dune::GridGlue::StandardMerge::SimplicialIntersection\n-typename IntersectionListProvider::SimplicialIntersection\n-SimplicialIntersection\n-Definition: standardmerge.hh:83\n+Dune::GridGlue::insertPoint\n+int insertPoint(const V p, std::vector< V > &P)\n+Definition: computeintersection.hh:164\n+Dune::GridGlue::ComputationMethod\n+Definition: computeintersection.hh:13\n+Dune::GridGlue::ComputationMethod::grid2_subdivisions\n+static void grid2_subdivisions(const std::vector< Vector > elementCorners,\n+std::vector< std::vector< unsigned int > > &subElements, std::vector< std::\n+vector< int > > &faceIds)\n+Dune::GridGlue::ComputationMethod::computeIntersectionPoints\n+static bool computeIntersectionPoints(const std::vector< Vector > X, const\n+std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector<\n+std::vector< int > > &SY, std::vector< Vector > &P)\n+Dune::GridGlue::ComputationMethod::Vector\n+FieldVector< T, dimWorld > Vector\n+Definition: computeintersection.hh:15\n+Dune::GridGlue::ComputationMethod::grid1Dimension\n+static const int grid1Dimension\n+Definition: computeintersection.hh:16\n+Dune::GridGlue::ComputationMethod::grid1_subdivisions\n+static void grid1_subdivisions(const std::vector< Vector > elementCorners,\n+std::vector< std::vector< unsigned int > > &subElements, std::vector< std::\n+vector< int > > &faceIds)\n+Dune::GridGlue::ComputationMethod::grid2Dimension\n+static const int grid2Dimension\n+Definition: computeintersection.hh:17\n+Dune::GridGlue::ComputationMethod::intersectionDimension\n+static const int intersectionDimension\n+Definition: computeintersection.hh:18\n+Dune::GridGlue::IntersectionComputation\n+Intersection computation method for two elements of arbitrary dimension.\n+Definition: computeintersection.hh:39\n+Dune::GridGlue::IntersectionComputation::orderPoints\n+static void orderPoints(const V ¢roid, const std::vector< std::vector< int\n+> > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V >\n+&P, std::vector< std::vector< int > > &H)\n+Order Points in the point list P face-wise such that a subsimplex subdivision\n+can be constructed.\n+Definition: computeintersection.hh:75\n+Dune::GridGlue::IntersectionComputation::computeIntersection\n+static bool computeIntersection(const std::vector< V > &X, const std::vector< V\n+> &Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > >\n+&SY, std::vector< V > &P)\n+Compute the intersection of two elements X and Y Compute the intersection of\n+two elements X and Y,...\n+Definition: computeintersection.cc:14\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: computeintersection.cc File Reference\n+dune-grid-glue: simplexintersection.cc File Reference\n \n \n \n \n \n \n \n@@ -63,25 +63,67 @@\n \n
    \n
    \n \n-
    computeintersection.cc File Reference
    \n+Classes |\n+Namespaces |\n+Functions
    \n+
    simplexintersection.cc File Reference
    \n \n
    \n \n+\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::GridGlue::SimplexMethod< dimWorld, dim1, dim2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 0, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 1, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 3, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 1, 1, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 1, 2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 1, 3, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 2, 2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 2, 3, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 3, 3, T >
     
    \n \n \n \n \n \n+

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

    \n+Functions

    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 0 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 1 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 2 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 3 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,17 +5,65 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Namespaces\n-computeintersection.cc File Reference\n+Classes | Namespaces | Functions\n+simplexintersection.cc File Reference\n+ Classes\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_dim1,_dim2,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_0,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_1,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_2,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_3,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_1,_1,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_1,_2,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_1,_3,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_2,_2,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_2,_3,_T_>\n+\u00a0\n+class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_3,_3,_T_>\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n+ Functions\n+template\n+void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 0 >,\n+ const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n+ std::vector< std::vector< unsigned int > > &subElements, std::vector<\n+ std::vector< int > > &faceIds)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 1 >,\n+ const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n+ std::vector< std::vector< unsigned int > > &subElements, std::vector<\n+ std::vector< int > > &faceIds)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 2 >,\n+ const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n+ std::vector< std::vector< unsigned int > > &subElements, std::vector<\n+ std::vector< int > > &faceIds)\n+\u00a0\n+template\n+void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 3 >,\n+ const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n+ std::vector< std::vector< unsigned int > > &subElements, std::vector<\n+ std::vector< int > > &faceIds)\n+\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: contactmerge.cc File Reference\n+dune-grid-glue: intersectionlist.hh File Reference\n \n \n \n \n \n \n \n@@ -63,21 +63,38 @@\n \n \n
    \n \n-
    contactmerge.cc File Reference
    \n+
    intersectionlist.hh File Reference
    \n
    \n
    \n-\n+
    #include <array>
    \n+#include <type_traits>
    \n+#include <utility>
    \n+#include <vector>
    \n+#include <dune/common/fvector.hh>
    \n+
    \n+

    Go to the source code of this file.

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

    \n+Classes

    class  Dune::GridGlue::IntersectionListProvider< L0, L1 >
     
    class  Dune::GridGlue::IntersectionList< Local0, Local1 >
     
    class  Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 >
     
    struct  Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 >::SimplicialIntersection
     
    \n \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,18 +5,32 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Namespaces\n-contactmerge.cc File Reference\n-#include \n-#include \n+Classes | Namespaces\n+intersectionlist.hh File Reference\n+#include \n+#include \n+#include \n+#include \n+#include \n+Go_to_the_source_code_of_this_file.\n+ Classes\n+ class \u00a0Dune::GridGlue::IntersectionListProvider<_L0,_L1_>\n+\u00a0\n+ class \u00a0Dune::GridGlue::IntersectionList<_Local0,_Local1_>\n+\u00a0\n+ class \u00a0Dune::GridGlue::SimplicialIntersectionListProvider<_dim0,_dim1_>\n+\u00a0\n+struct \u00a0Dune::GridGlue::SimplicialIntersectionListProvider<_dim0,_dim1_>::\n+ SimplicialIntersection\n+\u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n \n ===============================================================================\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: merger.hh File Reference\n+dune-grid-glue: contactmerge.hh File Reference\n \n \n \n \n \n \n \n@@ -65,37 +65,54 @@\n
  • dune
  • grid-glue
  • merging
  • \n
    \n \n
    \n \n-
    merger.hh File Reference
    \n+
    contactmerge.hh File Reference
    \n
    \n
    \n-
    #include <vector>
    \n+\n+

    Merge two grid boundary surfaces that may be a positive distance apart. \n+More...

    \n+
    #include <iostream>
    \n+#include <fstream>
    \n+#include <iomanip>
    \n+#include <vector>
    \n+#include <algorithm>
    \n+#include <limits>
    \n+#include <memory>
    \n+#include <functional>
    \n #include <dune/common/fvector.hh>
    \n-#include <dune/geometry/type.hh>
    \n-#include <dune/grid-glue/merging/intersectionlist.hh>
    \n+#include <dune/common/exceptions.hh>
    \n+#include <dune/common/bitsetvector.hh>
    \n+#include <dune/common/deprecated.hh>
    \n+#include <dune/grid/common/grid.hh>
    \n+#include <dune/grid-glue/merging/standardmerge.hh>
    \n+#include <dune/grid-glue/gridglue.hh>
    \n+#include "contactmerge.cc"
    \n
    \n

    Go to the source code of this file.

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

    \n Classes

    class  Dune::GridGlue::Merger< ctype, grid1Dim, grid2Dim, dimworld >
     Abstract base for all classes that take extracted grids and build sets of intersections. More...
    class  Dune::GridGlue::ContactMerge< dimworld, T >
     Merge two codimension-1 surfaces that may be a positive distance apart. More...
     
    \n \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n-
    \n+

    Detailed Description

    \n+

    Merge two grid boundary surfaces that may be a positive distance apart.

    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -6,26 +6,41 @@\n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n Classes | Namespaces\n-merger.hh File Reference\n+contactmerge.hh File Reference\n+Merge two grid boundary surfaces that may be a positive distance apart. 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 \"contactmerge.cc\"\n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::GridGlue::Merger<_ctype,_grid1Dim,_grid2Dim,_dimworld_>\n-\u00a0 Abstract base for all classes that take extracted grids and build sets\n- of intersections. More...\n+class \u00a0Dune::GridGlue::ContactMerge<_dimworld,_T_>\n+\u00a0 Merge two codimension-1 surfaces that may be a positive distance apart.\n+ More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n+***** Detailed Description *****\n+Merge two grid boundary surfaces that may be a positive distance apart.\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: merger.hh Source File\n+dune-grid-glue: contactmerge.hh Source File\n \n \n \n \n \n \n \n@@ -62,101 +62,217 @@\n \n \n \n
    \n-
    merger.hh
    \n+
    contactmerge.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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    5#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH
    \n-
    6#define DUNE_GRIDGLUE_MERGING_MERGER_HH
    \n-
    7
    \n-
    8#include <vector>
    \n-
    9
    \n-
    10#include <dune/common/fvector.hh>
    \n-
    11#include <dune/geometry/type.hh>
    \n+
    10#ifndef DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH
    \n+
    11#define DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH
    \n
    12
    \n-\n-
    14
    \n-
    15namespace Dune {
    \n-
    16namespace GridGlue {
    \n-
    17
    \n-
    25template <class ctype, int grid1Dim, int grid2Dim, int dimworld>
    \n-
    26class Merger
    \n-
    27{
    \n-
    28public:
    \n+
    13
    \n+
    14#include <iostream>
    \n+
    15#include <fstream>
    \n+
    16#include <iomanip>
    \n+
    17#include <vector>
    \n+
    18#include <algorithm>
    \n+
    19#include <limits>
    \n+
    20#include <memory>
    \n+
    21#include <functional>
    \n+
    22
    \n+
    23#include <dune/common/fvector.hh>
    \n+
    24#include <dune/common/exceptions.hh>
    \n+
    25#include <dune/common/bitsetvector.hh>
    \n+
    26#include <dune/common/deprecated.hh>
    \n+
    27
    \n+
    28#include <dune/grid/common/grid.hh>
    \n
    29
    \n-
    31 typedef Dune::FieldVector<ctype, grid1Dim> Grid1Coords;
    \n+\n+\n
    32
    \n-
    34 typedef Dune::FieldVector<ctype, grid2Dim> Grid2Coords;
    \n+
    33namespace Dune {
    \n+
    34namespace GridGlue {
    \n
    35
    \n-
    37 typedef Dune::FieldVector<ctype, dimworld> WorldCoords;
    \n-
    38
    \n-\n-
    40
    \n-
    54 virtual void build(const std::vector<Dune::FieldVector<ctype,dimworld> >& grid1_coords,
    \n-
    55 const std::vector<unsigned int>& grid1_elements,
    \n-
    56 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n-
    57 const std::vector<Dune::FieldVector<ctype,dimworld> >& grid2_coords,
    \n-
    58 const std::vector<unsigned int>& grid2_elements,
    \n-
    59 const std::vector<Dune::GeometryType>& grid2_element_types) = 0;
    \n+
    41template<int dimworld, typename T = double>
    \n+\n+
    43: public StandardMerge<T,dimworld-1,dimworld-1,dimworld>
    \n+
    44{
    \n+
    45 static constexpr int dim = dimworld-1;
    \n+
    46
    \n+
    47 static_assert( dim==1 || dim==2,
    \n+
    48 "ContactMerge yet only handles the cases dim==1 and dim==2!");
    \n+
    49
    \n+\n+
    51public:
    \n+
    52
    \n+
    53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
    \n+
    54
    \n+
    56 typedef T ctype;
    \n+
    57
    \n+
    59 typedef Dune::FieldVector<T, dimworld> WorldCoords;
    \n
    60
    \n-
    64 unsigned int nSimplices() const
    \n-
    65 { return intersectionList()->size(); }
    \n-
    66
    \n-
    67 virtual void clear() = 0;
    \n-
    68
    \n-
    74 virtual std::shared_ptr<IntersectionList> intersectionList() const = 0;
    \n-
    75
    \n-
    79 template<int n>
    \n-
    80 unsigned int parents(unsigned int idx) const {
    \n-
    81 return intersectionList()->template parents<n>(idx);
    \n-
    82 }
    \n-
    83
    \n-
    90 template<int n>
    \n-
    91 unsigned int parent(unsigned int idx, unsigned int parId = 0) const
    \n-
    92 {
    \n-
    93 return intersectionList()->template parent<n>(idx, parId);
    \n-
    94 }
    \n-
    95
    \n-
    104 template<int n>
    \n-
    105 auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId = 0) const
    \n-
    106 {
    \n-
    107 return intersectionList()->template corner<n>(idx, corner, parId);
    \n-
    108 }
    \n-
    109
    \n-
    114 unsigned int counter;
    \n-
    115};
    \n-
    116
    \n-
    117} /* namespace GridGlue */
    \n-
    118} /* namespace Dune */
    \n+
    62 typedef Dune::FieldVector<T, dim> LocalCoords;
    \n+
    63
    \n+\n+
    73 ContactMerge(const T allowedOverlap=T(0),
    \n+
    74 std::function<WorldCoords(WorldCoords)> domainDirections=nullptr,
    \n+
    75 std::function<WorldCoords(WorldCoords)> targetDirections=nullptr,
    \n+\n+
    77 : domainDirections_(domainDirections), targetDirections_(targetDirections),
    \n+
    78 overlap_(allowedOverlap), type_(type)
    \n+
    79 {}
    \n+
    80
    \n+
    86 ContactMerge(const T allowedOverlap, ProjectionType type)
    \n+
    87 : overlap_(allowedOverlap),
    \n+
    88 type_(type)
    \n+
    89 {}
    \n+
    90
    \n+
    99 inline
    \n+
    100 void setSurfaceDirections(std::function<WorldCoords(WorldCoords)> domainDirections,
    \n+
    101 std::function<WorldCoords(WorldCoords)> targetDirections)
    \n+
    102 {
    \n+
    103 domainDirections_ = domainDirections;
    \n+
    104 targetDirections_ = targetDirections;
    \n+
    105 this->valid = false;
    \n+
    106 }
    \n+
    107
    \n+
    109 void setOverlap(T overlap)
    \n+
    110 {
    \n+
    111 overlap_ = overlap;
    \n+
    112 }
    \n+
    113
    \n+
    115 T getOverlap() const
    \n+
    116 {
    \n+
    117 return overlap_;
    \n+
    118 }
    \n
    119
    \n-
    120#endif
    \n-\n+
    123 void minNormalAngle(T angle)
    \n+
    124 {
    \n+
    125 using std::cos;
    \n+
    126 maxNormalProduct_ = cos(angle);
    \n+
    127 }
    \n+
    128
    \n+\n+
    133 {
    \n+
    134 using std::acos;
    \n+
    135 return acos(maxNormalProduct_);
    \n+
    136 }
    \n+
    137
    \n+
    138protected:
    \n+
    139 typedef typename StandardMerge<T,dimworld-1,dimworld-1,dimworld>::SimplicialIntersection SimplicialIntersection;
    \n+
    140
    \n+
    141private:
    \n+
    145 std::function<WorldCoords(WorldCoords)> domainDirections_;
    \n+
    146 std::vector<WorldCoords> nodalDomainDirections_;
    \n+
    147
    \n+
    156 std::function<WorldCoords(WorldCoords)> targetDirections_;
    \n+
    157 std::vector<WorldCoords> nodalTargetDirections_;
    \n+
    158
    \n+
    160 T overlap_;
    \n+
    161
    \n+
    163 ProjectionType type_;
    \n+
    164
    \n+
    168 T maxNormalProduct_ = T(-0.1);
    \n+
    169
    \n+
    174 void computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n+
    175 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n+
    176 std::bitset<(1<<dim)>& neighborIntersects1,
    \n+
    177 unsigned int grid1Index,
    \n+
    178 const Dune::GeometryType& grid2ElementType,
    \n+
    179 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n+
    180 std::bitset<(1<<dim)>& neighborIntersects2,
    \n+
    181 unsigned int grid2Index,
    \n+
    182 std::vector<SimplicialIntersection>& intersections) override;
    \n+
    183
    \n+
    187protected:
    \n+
    188 void build(const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    189 const std::vector<unsigned int>& grid1Elements,
    \n+
    190 const std::vector<Dune::GeometryType>& grid1ElementTypes,
    \n+
    191 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    192 const std::vector<unsigned int>& grid2Elements,
    \n+
    193 const std::vector<Dune::GeometryType>& grid2ElementTypes) override
    \n+
    194 {
    \n+
    195 std::cout<<"ContactMerge building grid!\\n";
    \n+
    196 // setup the nodal direction vectors
    \n+
    197 setupNodalDirections(grid1Coords, grid1Elements, grid1ElementTypes,
    \n+
    198 grid2Coords, grid2Elements, grid2ElementTypes);
    \n+
    199
    \n+
    200 Base::build(grid1Coords, grid1Elements, grid1ElementTypes,
    \n+
    201 grid2Coords, grid2Elements, grid2ElementTypes);
    \n+
    202
    \n+
    203 }
    \n+
    204
    \n+
    205private:
    \n+
    206
    \n+
    208 static LocalCoords localCornerCoords(int i, const Dune::GeometryType& gt)
    \n+
    209 {
    \n+
    210 const auto& ref = Dune::ReferenceElements<T,dim>::general(gt);
    \n+
    211 return ref.position(i,dim);
    \n+
    212 }
    \n+
    213
    \n+
    214protected:
    \n+
    215
    \n+
    217 void computeCyclicOrder(const std::vector<std::array<LocalCoords,2> >& polytopeCorners,
    \n+
    218 const LocalCoords& center, std::vector<int>& ordering) const;
    \n+
    219
    \n+
    221 void setupNodalDirections(const std::vector<WorldCoords>& coords1,
    \n+
    222 const std::vector<unsigned int>& elements1,
    \n+
    223 const std::vector<Dune::GeometryType>& elementTypes1,
    \n+
    224 const std::vector<WorldCoords>& coords2,
    \n+
    225 const std::vector<unsigned int>& elements2,
    \n+
    226 const std::vector<Dune::GeometryType>& elementTypes2);
    \n+
    227
    \n+
    229 void computeOuterNormalField(const std::vector<WorldCoords>& coords,
    \n+
    230 const std::vector<unsigned int>& elements,
    \n+
    231 const std::vector<Dune::GeometryType>& elementTypes,
    \n+
    232 std::vector<WorldCoords>& normals);
    \n+
    233
    \n+
    235 void removeDoubles(std::vector<std::array<LocalCoords,2> >& polytopeCorners);
    \n+
    236};
    \n+
    237
    \n+
    238} /* namespace GridGlue */
    \n+
    239} /* namespace Dune */
    \n+
    240
    \n+
    241#include "contactmerge.cc"
    \n+
    242
    \n+
    243#endif // DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH
    \n+
    Central component of the module implementing the coupling of two grids.
    \n+\n+
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    \n
    Definition: gridglue.hh:37
    \n-
    Coordinate corner(unsigned c)
    Definition: projection_impl.hh:24
    \n-
    Definition: intersectionlist.hh:134
    \n-
    Abstract base for all classes that take extracted grids and build sets of intersections.
    Definition: merger.hh:27
    \n-
    unsigned int parent(unsigned int idx, unsigned int parId=0) const
    get index of grid-n's parent simplex for given merged grid simplex
    Definition: merger.hh:91
    \n-
    virtual void clear()=0
    \n-
    Dune::FieldVector< ctype, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: merger.hh:37
    \n-
    Dune::FieldVector< ctype, grid1Dim > Grid1Coords
    the local coordinate type for the grid1 coordinates
    Definition: merger.hh:31
    \n-
    unsigned int counter
    Counts the number of times the computeIntersection method has been called.
    Definition: merger.hh:114
    \n-
    auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId=0) const
    get the grid-n parent's simplex local coordinates for a particular merged grid simplex corner (parent...
    Definition: merger.hh:105
    \n-
    virtual void build(const std::vector< Dune::FieldVector< ctype, dimworld > > &grid1_coords, const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< ctype, dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements, const std::vector< Dune::GeometryType > &grid2_element_types)=0
    builds the merged grid
    \n-
    unsigned int nSimplices() const
    get the number of simplices in the merged grid The indices are then in 0..nSimplices()-1
    Definition: merger.hh:64
    \n-
    virtual std::shared_ptr< IntersectionList > intersectionList() const =0
    \n-
    unsigned int parents(unsigned int idx) const
    Definition: merger.hh:80
    \n-
    Dune::FieldVector< ctype, grid2Dim > Grid2Coords
    the local coordinate type for the grid2 coordinates
    Definition: merger.hh:34
    \n+
    Merge two codimension-1 surfaces that may be a positive distance apart.
    Definition: contactmerge.hh:44
    \n+
    void computeCyclicOrder(const std::vector< std::array< LocalCoords, 2 > > &polytopeCorners, const LocalCoords &center, std::vector< int > &ordering) const
    Order the corners of the intersection polytope in cyclic order.
    Definition: contactmerge.cc:214
    \n+
    StandardMerge< T, dimworld-1, dimworld-1, dimworld >::SimplicialIntersection SimplicialIntersection
    Definition: contactmerge.hh:139
    \n+
    void removeDoubles(std::vector< std::array< LocalCoords, 2 > > &polytopeCorners)
    Remove all multiples.
    Definition: contactmerge.cc:335
    \n+
    void setOverlap(T overlap)
    Set the allowed overlap of the surfaces.
    Definition: contactmerge.hh:109
    \n+
    Dune::FieldVector< T, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: contactmerge.hh:59
    \n+
    void setupNodalDirections(const std::vector< WorldCoords > &coords1, const std::vector< unsigned int > &elements1, const std::vector< Dune::GeometryType > &elementTypes1, const std::vector< WorldCoords > &coords2, const std::vector< unsigned int > &elements2, const std::vector< Dune::GeometryType > &elementTypes2)
    Setup the direction vectors containing the directions for each vertex.
    Definition: contactmerge.cc:269
    \n+
    void minNormalAngle(T angle)
    set minimum angle in radians between normals at x and \u03a6(x)
    Definition: contactmerge.hh:123
    \n+
    T ctype
    the numeric type used in this interface
    Definition: contactmerge.hh:56
    \n+
    ProjectionType
    Type of the projection, closest point or outer normal projection.
    Definition: contactmerge.hh:65
    \n+
    @ CLOSEST_POINT
    Definition: contactmerge.hh:65
    \n+
    @ OUTER_NORMAL
    Definition: contactmerge.hh:65
    \n+
    void computeOuterNormalField(const std::vector< WorldCoords > &coords, const std::vector< unsigned int > &elements, const std::vector< Dune::GeometryType > &elementTypes, std::vector< WorldCoords > &normals)
    If no direction field was specified compute the outer normal field.
    Definition: contactmerge.cc:296
    \n+
    T getOverlap() const
    Get the allowed overlap of the surfaces.
    Definition: contactmerge.hh:115
    \n+
    ContactMerge(const T allowedOverlap=T(0), std::function< WorldCoords(WorldCoords)> domainDirections=nullptr, std::function< WorldCoords(WorldCoords)> targetDirections=nullptr, ProjectionType type=OUTER_NORMAL)
    Construct merger given overlap and possible projection directions.
    Definition: contactmerge.hh:73
    \n+
    void setSurfaceDirections(std::function< WorldCoords(WorldCoords)> domainDirections, std::function< WorldCoords(WorldCoords)> targetDirections)
    Set surface direction functions.
    Definition: contactmerge.hh:100
    \n+
    void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords, const std::vector< unsigned int > &grid1Elements, const std::vector< Dune::GeometryType > &grid1ElementTypes, const std::vector< Dune::FieldVector< T, dimworld > > &grid2Coords, const std::vector< unsigned int > &grid2Elements, const std::vector< Dune::GeometryType > &grid2ElementTypes) override
    builds the merged grid
    Definition: contactmerge.hh:188
    \n+
    ContactMerge(const T allowedOverlap, ProjectionType type)
    Construct merger given overlap and type of the projection.
    Definition: contactmerge.hh:86
    \n+
    T minNormalAngle() const
    get minimum angle in radians between normals at x and \u03a6(x)
    Definition: contactmerge.hh:132
    \n+
    Dune::FieldVector< T, dim > LocalCoords
    the coordinate type used in this interface
    Definition: contactmerge.hh:62
    \n+
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    Definition: standardmerge.hh:58
    \n+
    void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1_Coords, const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< T, dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements, const std::vector< Dune::GeometryType > &grid2_element_types) override
    builds the merged grid
    Definition: standardmerge.hh:392
    \n+\n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,143 +5,308 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-merger.hh\n+contactmerge.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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 5#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH\n- 6#define DUNE_GRIDGLUE_MERGING_MERGER_HH\n- 7\n- 8#include \n- 9\n- 10#include \n- 11#include \n+ 10#ifndef DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH\n+ 11#define DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH\n 12\n- 13#include \n- 14\n- 15namespace Dune {\n- 16namespace GridGlue {\n- 17\n- 25template \n-26class Merger\n- 27{\n- 28public:\n+ 13\n+ 14#include \n+ 15#include \n+ 16#include \n+ 17#include \n+ 18#include \n+ 19#include \n+ 20#include \n+ 21#include \n+ 22\n+ 23#include \n+ 24#include \n+ 25#include \n+ 26#include \n+ 27\n+ 28#include \n 29\n-31 typedef Dune::FieldVector Grid1Coords;\n+ 30#include \n+ 31#include \n 32\n-34 typedef Dune::FieldVector Grid2Coords;\n+ 33namespace Dune {\n+ 34namespace GridGlue {\n 35\n-37 typedef Dune::FieldVector WorldCoords;\n- 38\n-39 using IntersectionList = Dune::GridGlue::IntersectionList;\n- 40\n-54 virtual void build(const std::vector >&\n-grid1_coords,\n- 55 const std::vector& grid1_elements,\n- 56 const std::vector& grid1_element_types,\n- 57 const std::vector >& grid2_coords,\n- 58 const std::vector& grid2_elements,\n- 59 const std::vector& grid2_element_types) = 0;\n+ 41template\n+42class ContactMerge\n+ 43: public StandardMerge\n+ 44{\n+ 45 static constexpr int dim = dimworld-1;\n+ 46\n+ 47 static_assert( dim==1 || dim==2,\n+ 48 \"ContactMerge yet only handles the cases dim==1 and dim==2!\");\n+ 49\n+ 50 typedef StandardMerge Base;\n+ 51public:\n+ 52\n+ 53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */\n+ 54\n+56 typedef T ctype;\n+ 57\n+59 typedef Dune::FieldVector WorldCoords;\n 60\n-64 unsigned int nSimplices() const\n- 65 { return intersectionList()->size(); }\n- 66\n-67 virtual void clear() = 0;\n- 68\n-74 virtual std::shared_ptr intersectionList() const = 0;\n- 75\n- 79 template\n-80 unsigned int parents(unsigned int idx) const {\n- 81 return intersectionList()->template parents(idx);\n- 82 }\n- 83\n- 90 template\n-91 unsigned int parent(unsigned int idx, unsigned int parId = 0) const\n- 92 {\n- 93 return intersectionList()->template parent(idx, parId);\n- 94 }\n- 95\n- 104 template\n-105 auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId\n-= 0) const\n- 106 {\n- 107 return intersectionList()->template corner(idx, corner, parId);\n- 108 }\n- 109\n-114 unsigned int counter;\n- 115};\n- 116\n- 117} /* namespace GridGlue */\n- 118} /* namespace Dune */\n+62 typedef Dune::FieldVector LocalCoords;\n+ 63\n+65 enum ProjectionType {OUTER_NORMAL, CLOSEST_POINT};\n+73 ContactMerge(const T allowedOverlap=T(0),\n+ 74 std::function domainDirections=nullptr,\n+ 75 std::function targetDirections=nullptr,\n+ 76 ProjectionType type = OUTER_NORMAL)\n+ 77 : domainDirections_(domainDirections), targetDirections_(targetDirections),\n+ 78 overlap_(allowedOverlap), type_(type)\n+ 79 {}\n+ 80\n+86 ContactMerge(const T allowedOverlap, ProjectionType type)\n+ 87 : overlap_(allowedOverlap),\n+ 88 type_(type)\n+ 89 {}\n+ 90\n+ 99 inline\n+100 void setSurfaceDirections(std::function\n+domainDirections,\n+ 101 std::function targetDirections)\n+ 102 {\n+ 103 domainDirections_ = domainDirections;\n+ 104 targetDirections_ = targetDirections;\n+ 105 this->valid = false;\n+ 106 }\n+ 107\n+109 void setOverlap(T overlap)\n+ 110 {\n+ 111 overlap_ = overlap;\n+ 112 }\n+ 113\n+115 T getOverlap() const\n+ 116 {\n+ 117 return overlap_;\n+ 118 }\n 119\n- 120#endif\n-intersectionlist.hh\n+123 void minNormalAngle(T angle)\n+ 124 {\n+ 125 using std::cos;\n+ 126 maxNormalProduct_ = cos(angle);\n+ 127 }\n+ 128\n+132 T minNormalAngle() const\n+ 133 {\n+ 134 using std::acos;\n+ 135 return acos(maxNormalProduct_);\n+ 136 }\n+ 137\n+ 138protected:\n+139 typedef typename StandardMerge::\n+SimplicialIntersection SimplicialIntersection;\n+ 140\n+ 141private:\n+ 145 std::function domainDirections_;\n+ 146 std::vector nodalDomainDirections_;\n+ 147\n+ 156 std::function targetDirections_;\n+ 157 std::vector nodalTargetDirections_;\n+ 158\n+ 160 T overlap_;\n+ 161\n+ 163 ProjectionType type_;\n+ 164\n+ 168 T maxNormalProduct_ = T(-0.1);\n+ 169\n+ 174 void computeIntersections(const Dune::GeometryType& grid1ElementType,\n+ 175 const std::vector >& grid1ElementCorners,\n+ 176 std::bitset<(1<& neighborIntersects1,\n+ 177 unsigned int grid1Index,\n+ 178 const Dune::GeometryType& grid2ElementType,\n+ 179 const std::vector >& grid2ElementCorners,\n+ 180 std::bitset<(1<& neighborIntersects2,\n+ 181 unsigned int grid2Index,\n+ 182 std::vector& intersections) override;\n+ 183\n+ 187protected:\n+188 void build(const std::vector >& grid1Coords,\n+ 189 const std::vector& grid1Elements,\n+ 190 const std::vector& grid1ElementTypes,\n+ 191 const std::vector >& grid2Coords,\n+ 192 const std::vector& grid2Elements,\n+ 193 const std::vector& grid2ElementTypes) override\n+ 194 {\n+ 195 std::cout<<\"ContactMerge building grid!\\n\";\n+ 196 // setup the nodal direction vectors\n+ 197 setupNodalDirections(grid1Coords, grid1Elements, grid1ElementTypes,\n+ 198 grid2Coords, grid2Elements, grid2ElementTypes);\n+ 199\n+ 200 Base::build(grid1Coords, grid1Elements, grid1ElementTypes,\n+ 201 grid2Coords, grid2Elements, grid2ElementTypes);\n+ 202\n+ 203 }\n+ 204\n+ 205private:\n+ 206\n+ 208 static LocalCoords localCornerCoords(int i, const Dune::GeometryType& gt)\n+ 209 {\n+ 210 const auto& ref = Dune::ReferenceElements::general(gt);\n+ 211 return ref.position(i,dim);\n+ 212 }\n+ 213\n+ 214protected:\n+ 215\n+ 217 void computeCyclicOrder(const std::vector >&\n+polytopeCorners,\n+ 218 const LocalCoords& center, std::vector& ordering) const;\n+ 219\n+ 221 void setupNodalDirections(const std::vector& coords1,\n+ 222 const std::vector& elements1,\n+ 223 const std::vector& elementTypes1,\n+ 224 const std::vector& coords2,\n+ 225 const std::vector& elements2,\n+ 226 const std::vector& elementTypes2);\n+ 227\n+ 229 void computeOuterNormalField(const std::vector& coords,\n+ 230 const std::vector& elements,\n+ 231 const std::vector& elementTypes,\n+ 232 std::vector& normals);\n+ 233\n+ 235 void removeDoubles(std::vector >&\n+polytopeCorners);\n+ 236};\n+ 237\n+ 238} /* namespace GridGlue */\n+ 239} /* namespace Dune */\n+ 240\n+ 241#include \"contactmerge.cc\"\n+ 242\n+ 243#endif // DUNE_GRIDGLUE_MERGING_CONTACTMERGE_HH\n+gridglue.hh\n+Central component of the module implementing the coupling of two grids.\n+contactmerge.cc\n+standardmerge.hh\n+Common base class for many merger implementations: produce pairs of entities\n+that may intersect.\n Dune\n Definition: gridglue.hh:37\n-Dune::GridGlue::ProjectionImplementation::corner\n-Coordinate corner(unsigned c)\n-Definition: projection_impl.hh:24\n-Dune::GridGlue::IntersectionList\n-Definition: intersectionlist.hh:134\n-Dune::GridGlue::Merger\n-Abstract base for all classes that take extracted grids and build sets of\n-intersections.\n-Definition: merger.hh:27\n-Dune::GridGlue::Merger::parent\n-unsigned int parent(unsigned int idx, unsigned int parId=0) const\n-get index of grid-n's parent simplex for given merged grid simplex\n-Definition: merger.hh:91\n-Dune::GridGlue::Merger::clear\n-virtual void clear()=0\n-Dune::GridGlue::Merger::WorldCoords\n-Dune::FieldVector< ctype, dimworld > WorldCoords\n-the coordinate type used in this interface\n-Definition: merger.hh:37\n-Dune::GridGlue::Merger::Grid1Coords\n-Dune::FieldVector< ctype, grid1Dim > Grid1Coords\n-the local coordinate type for the grid1 coordinates\n-Definition: merger.hh:31\n-Dune::GridGlue::Merger::counter\n-unsigned int counter\n-Counts the number of times the computeIntersection method has been called.\n-Definition: merger.hh:114\n-Dune::GridGlue::Merger::parentLocal\n-auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId=0)\n+Dune::GridGlue::ContactMerge\n+Merge two codimension-1 surfaces that may be a positive distance apart.\n+Definition: contactmerge.hh:44\n+Dune::GridGlue::ContactMerge::computeCyclicOrder\n+void computeCyclicOrder(const std::vector< std::array< LocalCoords, 2 > >\n+&polytopeCorners, const LocalCoords ¢er, std::vector< int > &ordering)\n const\n-get the grid-n parent's simplex local coordinates for a particular merged grid\n-simplex corner (parent...\n-Definition: merger.hh:105\n-Dune::GridGlue::Merger::build\n-virtual void build(const std::vector< Dune::FieldVector< ctype, dimworld > >\n-&grid1_coords, const std::vector< unsigned int > &grid1_elements, const std::\n-vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::\n-FieldVector< ctype, dimworld > > &grid2_coords, const std::vector< unsigned int\n-> &grid2_elements, const std::vector< Dune::GeometryType >\n-&grid2_element_types)=0\n+Order the corners of the intersection polytope in cyclic order.\n+Definition: contactmerge.cc:214\n+Dune::GridGlue::ContactMerge::SimplicialIntersection\n+StandardMerge< T, dimworld-1, dimworld-1, dimworld >::SimplicialIntersection\n+SimplicialIntersection\n+Definition: contactmerge.hh:139\n+Dune::GridGlue::ContactMerge::removeDoubles\n+void removeDoubles(std::vector< std::array< LocalCoords, 2 > >\n+&polytopeCorners)\n+Remove all multiples.\n+Definition: contactmerge.cc:335\n+Dune::GridGlue::ContactMerge::setOverlap\n+void setOverlap(T overlap)\n+Set the allowed overlap of the surfaces.\n+Definition: contactmerge.hh:109\n+Dune::GridGlue::ContactMerge::WorldCoords\n+Dune::FieldVector< T, dimworld > WorldCoords\n+the coordinate type used in this interface\n+Definition: contactmerge.hh:59\n+Dune::GridGlue::ContactMerge::setupNodalDirections\n+void setupNodalDirections(const std::vector< WorldCoords > &coords1, const\n+std::vector< unsigned int > &elements1, const std::vector< Dune::GeometryType >\n+&elementTypes1, const std::vector< WorldCoords > &coords2, const std::vector<\n+unsigned int > &elements2, const std::vector< Dune::GeometryType >\n+&elementTypes2)\n+Setup the direction vectors containing the directions for each vertex.\n+Definition: contactmerge.cc:269\n+Dune::GridGlue::ContactMerge::minNormalAngle\n+void minNormalAngle(T angle)\n+set minimum angle in radians between normals at x and \u03a6(x)\n+Definition: contactmerge.hh:123\n+Dune::GridGlue::ContactMerge::ctype\n+T ctype\n+the numeric type used in this interface\n+Definition: contactmerge.hh:56\n+Dune::GridGlue::ContactMerge::ProjectionType\n+ProjectionType\n+Type of the projection, closest point or outer normal projection.\n+Definition: contactmerge.hh:65\n+Dune::GridGlue::ContactMerge::CLOSEST_POINT\n+@ CLOSEST_POINT\n+Definition: contactmerge.hh:65\n+Dune::GridGlue::ContactMerge::OUTER_NORMAL\n+@ OUTER_NORMAL\n+Definition: contactmerge.hh:65\n+Dune::GridGlue::ContactMerge::computeOuterNormalField\n+void computeOuterNormalField(const std::vector< WorldCoords > &coords, const\n+std::vector< unsigned int > &elements, const std::vector< Dune::GeometryType >\n+&elementTypes, std::vector< WorldCoords > &normals)\n+If no direction field was specified compute the outer normal field.\n+Definition: contactmerge.cc:296\n+Dune::GridGlue::ContactMerge::getOverlap\n+T getOverlap() const\n+Get the allowed overlap of the surfaces.\n+Definition: contactmerge.hh:115\n+Dune::GridGlue::ContactMerge::ContactMerge\n+ContactMerge(const T allowedOverlap=T(0), std::function< WorldCoords\n+(WorldCoords)> domainDirections=nullptr, std::function< WorldCoords\n+(WorldCoords)> targetDirections=nullptr, ProjectionType type=OUTER_NORMAL)\n+Construct merger given overlap and possible projection directions.\n+Definition: contactmerge.hh:73\n+Dune::GridGlue::ContactMerge::setSurfaceDirections\n+void setSurfaceDirections(std::function< WorldCoords(WorldCoords)>\n+domainDirections, std::function< WorldCoords(WorldCoords)> targetDirections)\n+Set surface direction functions.\n+Definition: contactmerge.hh:100\n+Dune::GridGlue::ContactMerge::build\n+void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords,\n+const std::vector< unsigned int > &grid1Elements, const std::vector< Dune::\n+GeometryType > &grid1ElementTypes, const std::vector< Dune::FieldVector< T,\n+dimworld > > &grid2Coords, const std::vector< unsigned int > &grid2Elements,\n+const std::vector< Dune::GeometryType > &grid2ElementTypes) override\n+builds the merged grid\n+Definition: contactmerge.hh:188\n+Dune::GridGlue::ContactMerge::ContactMerge\n+ContactMerge(const T allowedOverlap, ProjectionType type)\n+Construct merger given overlap and type of the projection.\n+Definition: contactmerge.hh:86\n+Dune::GridGlue::ContactMerge::minNormalAngle\n+T minNormalAngle() const\n+get minimum angle in radians between normals at x and \u03a6(x)\n+Definition: contactmerge.hh:132\n+Dune::GridGlue::ContactMerge::LocalCoords\n+Dune::FieldVector< T, dim > LocalCoords\n+the coordinate type used in this interface\n+Definition: contactmerge.hh:62\n+Dune::GridGlue::StandardMerge\n+Common base class for many merger implementations: produce pairs of entities\n+that may intersect.\n+Definition: standardmerge.hh:58\n+Dune::GridGlue::StandardMerge::build\n+void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1_Coords,\n+const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::\n+GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< T,\n+dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements,\n+const std::vector< Dune::GeometryType > &grid2_element_types) override\n builds the merged grid\n-Dune::GridGlue::Merger::nSimplices\n-unsigned int nSimplices() const\n-get the number of simplices in the merged grid The indices are then in\n-0..nSimplices()-1\n-Definition: merger.hh:64\n-Dune::GridGlue::Merger::intersectionList\n-virtual std::shared_ptr< IntersectionList > intersectionList() const =0\n-Dune::GridGlue::Merger::parents\n-unsigned int parents(unsigned int idx) const\n-Definition: merger.hh:80\n-Dune::GridGlue::Merger::Grid2Coords\n-Dune::FieldVector< ctype, grid2Dim > Grid2Coords\n-the local coordinate type for the grid2 coordinates\n-Definition: merger.hh:34\n+Definition: standardmerge.hh:392\n+Dune::GridGlue::StandardMerge<_double,_dimworld-1,_dimworld-1,_dimworld_>::\n+valid\n+bool valid\n+Definition: standardmerge.hh:86\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: simplexintersection.cc File Reference\n+dune-grid-glue: contactmerge.cc File Reference\n \n \n \n \n \n \n \n@@ -63,67 +63,27 @@\n \n \n
    \n \n-
    simplexintersection.cc File Reference
    \n+Namespaces
    \n+
    contactmerge.cc File Reference
    \n \n
    \n-\n-\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::GridGlue::SimplexMethod< dimWorld, dim1, dim2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 0, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 1, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 0, 3, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 1, 1, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 1, 2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 1, 3, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 2, 2, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 2, 3, T >
     
    class  Dune::GridGlue::SimplexMethod< dimWorld, 3, 3, T >
     
    \n+
    \n \n \n \n \n \n-

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n

    \n-Functions

    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 0 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 1 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 2 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    template<int dimworld, typename T >
    void Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 3 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
     
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,65 +5,19 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Classes | Namespaces | Functions\n-simplexintersection.cc File Reference\n- Classes\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_dim1,_dim2,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_0,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_1,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_2,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_0,_3,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_1,_1,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_1,_2,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_1,_3,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_2,_2,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_2,_3,_T_>\n-\u00a0\n-class \u00a0Dune::GridGlue::SimplexMethod<_dimWorld,_3,_3,_T_>\n-\u00a0\n+Namespaces\n+contactmerge.cc File Reference\n+#include \n+#include \n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n- Functions\n-template\n-void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 0 >,\n- const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n- std::vector< std::vector< unsigned int > > &subElements, std::vector<\n- std::vector< int > > &faceIds)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 1 >,\n- const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n- std::vector< std::vector< unsigned int > > &subElements, std::vector<\n- std::vector< int > > &faceIds)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 2 >,\n- const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n- std::vector< std::vector< unsigned int > > &subElements, std::vector<\n- std::vector< int > > &faceIds)\n-\u00a0\n-template\n-void\u00a0Dune::GridGlue::simplexSubdivision (std::integral_constant< int, 3 >,\n- const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners,\n- std::vector< std::vector< unsigned int > > &subElements, std::vector<\n- std::vector< int > > &faceIds)\n-\u00a0\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: standardmerge.hh File Reference\n+dune-grid-glue: standardmerge.cc File Reference\n \n \n \n \n \n \n \n@@ -63,85 +63,55 @@\n \n \n
    \n \n-
    standardmerge.hh File Reference
    \n+
    standardmerge.cc File Reference
    \n
    \n
    \n-\n-

    Common base class for many merger implementations: produce pairs of entities that may intersect. \n-More...

    \n-
    #include <iostream>
    \n-#include <iomanip>
    \n-#include <vector>
    \n-#include <stack>
    \n-#include <set>
    \n-#include <utility>
    \n-#include <map>
    \n-#include <memory>
    \n-#include <algorithm>
    \n-#include <dune/common/fvector.hh>
    \n-#include <dune/common/bitsetvector.hh>
    \n-#include <dune/common/stdstreams.hh>
    \n-#include <dune/common/timer.hh>
    \n-#include <dune/geometry/referenceelements.hh>
    \n-#include <dune/grid/common/grid.hh>
    \n-#include <dune/grid-glue/merging/intersectionlist.hh>
    \n-#include <dune/grid-glue/merging/merger.hh>
    \n-#include <dune/grid-glue/merging/computeintersection.hh>
    \n-
    \n-

    Go to the source code of this file.

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

    \n-Classes

    class  Dune::GridGlue::StandardMerge< T, grid1Dim, grid2Dim, dimworld >
     Common base class for many merger implementations: produce pairs of entities that may intersect. More...
     
    \n+
    #include "config.h"
    \n+#include "standardmerge.hh"
    \n+
    \n \n \n \n \n \n

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n \n-\n+\n \n \n \n

    \n Macros

    #define DECL   extern
    #define DECL
     
    #define STANDARD_MERGE_INSTANTIATE(T, A, B, C)
     
    \n \n \n \n \n \n \n \n

    \n Functions

     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 1, 1, 1)
     
     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 2, 2, 2)
     
     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 3, 3, 3)
     
    \n-

    Detailed Description

    \n-

    Common base class for many merger implementations: produce pairs of entities that may intersect.

    \n-

    Macro Definition Documentation

    \n+

    Macro Definition Documentation

    \n \n

    ◆ DECL

    \n \n
    \n
    \n \n \n- \n+ \n \n
    #define DECL   extern#define DECL
    \n
    \n \n
    \n
    \n \n@@ -178,22 +148,22 @@\n \n )\n \n \n \n
    \n Value:
    DECL template \\
    \n-
    void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1Coords, \\
    \n+
    void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1_coords, \\
    \n
    const std::vector<unsigned int>& grid1_elements, \\
    \n
    const std::vector<Dune::GeometryType>& grid1_element_types, \\
    \n-
    const std::vector<Dune::FieldVector<T,C> >& grid2Coords, \\
    \n+
    const std::vector<Dune::FieldVector<T,C> >& grid2_coords, \\
    \n
    const std::vector<unsigned int>& grid2_elements, \\
    \n
    const std::vector<Dune::GeometryType>& grid2_element_types \\
    \n
    )
    \n-
    #define DECL
    Definition: standardmerge.hh:827
    \n+
    #define DECL
    Definition: standardmerge.cc:12
    \n
    \n
    \n \n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,80 +5,53 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Classes | Namespaces | Macros | Functions\n-standardmerge.hh File Reference\n-Common base class for many merger implementations: produce pairs of entities\n-that may intersect. 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-class \u00a0Dune::GridGlue::StandardMerge<_T,_grid1Dim,_grid2Dim,_dimworld_>\n-\u00a0 Common base class for many merger implementations: produce pairs of\n- entities that may intersect. More...\n-\u00a0\n+Namespaces | Macros | Functions\n+standardmerge.cc File Reference\n+#include \"config.h\"\n+#include \"standardmerge.hh\"\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n Macros\n-#define\u00a0DECL\u00a0\u00a0\u00a0extern\n+#define\u00a0DECL\n \u00a0\n #define\u00a0STANDARD_MERGE_INSTANTIATE(T, A, B, C)\n \u00a0\n Functions\n \u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 1, 1, 1)\n \u00a0\n \u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 2, 2, 2)\n \u00a0\n \u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 3, 3, 3)\n \u00a0\n-***** Detailed Description *****\n-Common base class for many merger implementations: produce pairs of entities\n-that may intersect.\n ***** Macro Definition Documentation *****\n ***** \u25c6\u00a0DECL *****\n-#define DECL\u00a0\u00a0\u00a0extern\n+#define DECL\n ***** \u25c6\u00a0STANDARD_MERGE_INSTANTIATE *****\n #define STANDARD_MERGE_INSTANTIATE ( \u00a0T,\n \u00a0A,\n \u00a0B,\n \u00a0C\u00a0\n )\n Value:\n DECL template \\\n void StandardMerge::build(const std::vector >&\n-grid1Coords, \\\n+grid1_coords, \\\n const std::vector& grid1_elements, \\\n const std::vector& grid1_element_types, \\\n-const std::vector >& grid2Coords, \\\n+const std::vector >& grid2_coords, \\\n const std::vector& grid2_elements, \\\n const std::vector& grid2_element_types \\\n )\n DECL\n #define DECL\n-Definition: standardmerge.hh:827\n+Definition: standardmerge.cc:12\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: conformingmerge.hh File Reference\n+dune-grid-glue: standardmerge.hh File Reference\n \n \n \n \n \n \n \n@@ -64,47 +64,139 @@\n \n \n \n
    \n \n-
    conformingmerge.hh File Reference
    \n+Namespaces |\n+Macros |\n+Functions
    \n+
    standardmerge.hh File Reference
    \n \n
    \n \n-

    Implementation of the Merger concept for conforming interfaces. \n+

    Common base class for many merger implementations: produce pairs of entities that may intersect. \n More...

    \n-
    #include <iomanip>
    \n+
    #include <iostream>
    \n+#include <iomanip>
    \n #include <vector>
    \n+#include <stack>
    \n+#include <set>
    \n+#include <utility>
    \n+#include <map>
    \n+#include <memory>
    \n #include <algorithm>
    \n-#include <bitset>
    \n-#include <dune/common/fmatrix.hh>
    \n #include <dune/common/fvector.hh>
    \n+#include <dune/common/bitsetvector.hh>
    \n+#include <dune/common/stdstreams.hh>
    \n+#include <dune/common/timer.hh>
    \n #include <dune/geometry/referenceelements.hh>
    \n-#include <dune/grid-glue/merging/standardmerge.hh>
    \n+#include <dune/grid/common/grid.hh>
    \n+#include <dune/grid-glue/merging/intersectionlist.hh>
    \n+#include <dune/grid-glue/merging/merger.hh>
    \n+#include <dune/grid-glue/merging/computeintersection.hh>
    \n
    \n

    Go to the source code of this file.

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

    \n Classes

    class  Dune::GridGlue::ConformingMerge< dim, dimworld, T >
     Implementation of the Merger concept for conforming interfaces. More...
    class  Dune::GridGlue::StandardMerge< T, grid1Dim, grid2Dim, dimworld >
     Common base class for many merger implementations: produce pairs of entities that may intersect. More...
     
    \n \n \n \n \n \n+

    \n Namespaces

    namespace  Dune
     
    namespace  Dune::GridGlue
     
    \n+\n+\n+\n+\n+\n+

    \n+Macros

    #define DECL   extern
     
    #define STANDARD_MERGE_INSTANTIATE(T, A, B, C)
     
    \n+\n+\n+\n+\n+\n+\n+\n

    \n+Functions

     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 1, 1, 1)
     
     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 2, 2, 2)
     
     Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 3, 3, 3)
     
    \n

    Detailed Description

    \n-

    Implementation of the Merger concept for conforming interfaces.

    \n-
    \n+

    Common base class for many merger implementations: produce pairs of entities that may intersect.

    \n+

    Macro Definition Documentation

    \n+\n+

    ◆ DECL

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+
    #define DECL   extern
    \n+
    \n+\n+
    \n+
    \n+\n+

    ◆ STANDARD_MERGE_INSTANTIATE

    \n+\n+
    \n+
    \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
    #define STANDARD_MERGE_INSTANTIATE( T,
     A,
     B,
     
    )
    \n+
    \n+Value:
    DECL template \\
    \n+
    void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1Coords, \\
    \n+
    const std::vector<unsigned int>& grid1_elements, \\
    \n+
    const std::vector<Dune::GeometryType>& grid1_element_types, \\
    \n+
    const std::vector<Dune::FieldVector<T,C> >& grid2Coords, \\
    \n+
    const std::vector<unsigned int>& grid2_elements, \\
    \n+
    const std::vector<Dune::GeometryType>& grid2_element_types \\
    \n+
    )
    \n+
    #define DECL
    Definition: standardmerge.hh:827
    \n+
    \n+
    \n+
    \n+
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,33 +5,80 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-Classes | Namespaces\n-conformingmerge.hh File Reference\n-Implementation of the Merger concept for conforming interfaces. More...\n+Classes | Namespaces | Macros | Functions\n+standardmerge.hh File Reference\n+Common base class for many merger implementations: produce pairs of entities\n+that may intersect. 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+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Classes\n-class \u00a0Dune::GridGlue::ConformingMerge<_dim,_dimworld,_T_>\n-\u00a0 Implementation of the Merger concept for conforming interfaces. More...\n+class \u00a0Dune::GridGlue::StandardMerge<_T,_grid1Dim,_grid2Dim,_dimworld_>\n+\u00a0 Common base class for many merger implementations: produce pairs of\n+ entities that may intersect. More...\n \u00a0\n Namespaces\n namespace \u00a0Dune\n \u00a0\n namespace \u00a0Dune::GridGlue\n \u00a0\n+ Macros\n+#define\u00a0DECL\u00a0\u00a0\u00a0extern\n+\u00a0\n+#define\u00a0STANDARD_MERGE_INSTANTIATE(T, A, B, C)\n+\u00a0\n+ Functions\n+\u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 1, 1, 1)\n+\u00a0\n+\u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 2, 2, 2)\n+\u00a0\n+\u00a0Dune::GridGlue::STANDARD_MERGE_INSTANTIATE (double, 3, 3, 3)\n+\u00a0\n ***** Detailed Description *****\n-Implementation of the Merger concept for conforming interfaces.\n+Common base class for many merger implementations: produce pairs of entities\n+that may intersect.\n+***** Macro Definition Documentation *****\n+***** \u25c6\u00a0DECL *****\n+#define DECL\u00a0\u00a0\u00a0extern\n+***** \u25c6\u00a0STANDARD_MERGE_INSTANTIATE *****\n+#define STANDARD_MERGE_INSTANTIATE ( \u00a0T,\n+ \u00a0A,\n+ \u00a0B,\n+ \u00a0C\u00a0\n+ )\n+Value:\n+DECL template \\\n+void StandardMerge::build(const std::vector >&\n+grid1Coords, \\\n+const std::vector& grid1_elements, \\\n+const std::vector& grid1_element_types, \\\n+const std::vector >& grid2Coords, \\\n+const std::vector& grid2_elements, \\\n+const std::vector& grid2_element_types \\\n+)\n+DECL\n+#define DECL\n+Definition: standardmerge.hh:827\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: conformingmerge.hh Source File\n+dune-grid-glue: standardmerge.hh Source File\n \n \n \n \n \n \n \n@@ -62,216 +62,835 @@\n \n \n \n
    \n-
    conformingmerge.hh
    \n+
    standardmerge.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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    5/*
    \n-
    6 * Filename: conformingmerge.hh
    \n-
    7 * Version: 1.0
    \n-
    8 * Created on: Sep 14, 2009
    \n-
    9 * Author: Oliver Sander
    \n-
    10 * ---------------------------------
    \n-
    11 * Project: dune-grid-glue
    \n-
    12 * Description: implementation of the Merger concept for conforming interfaces
    \n-
    13 *
    \n-
    14 */
    \n-
    21#ifndef DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
    \n-
    22#define DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
    \n+
    10#ifndef DUNE_GRIDGLUE_MERGING_STANDARDMERGE_HH
    \n+
    11#define DUNE_GRIDGLUE_MERGING_STANDARDMERGE_HH
    \n+
    12
    \n+
    13
    \n+
    14#include <iostream>
    \n+
    15#include <iomanip>
    \n+
    16#include <vector>
    \n+
    17#include <stack>
    \n+
    18#include <set>
    \n+
    19#include <utility>
    \n+
    20#include <map>
    \n+
    21#include <memory>
    \n+
    22#include <algorithm>
    \n
    23
    \n-
    24#include <iomanip>
    \n-
    25#include <vector>
    \n-
    26#include <algorithm>
    \n-
    27#include <bitset>
    \n+
    24#include <dune/common/fvector.hh>
    \n+
    25#include <dune/common/bitsetvector.hh>
    \n+
    26#include <dune/common/stdstreams.hh>
    \n+
    27#include <dune/common/timer.hh>
    \n
    28
    \n-
    29#include <dune/common/fmatrix.hh>
    \n-
    30#include <dune/common/fvector.hh>
    \n+
    29#include <dune/geometry/referenceelements.hh>
    \n+
    30#include <dune/grid/common/grid.hh>
    \n
    31
    \n-
    32#include <dune/geometry/referenceelements.hh>
    \n-
    33
    \n-\n+\n+\n+\n
    35
    \n
    36namespace Dune {
    \n-
    37
    \n-
    38 namespace GridGlue {
    \n-
    39
    \n-
    46template<int dim, int dimworld, typename T = double>
    \n-\n-
    48 : public StandardMerge<T,dim,dim,dimworld>
    \n-
    49{
    \n-
    50
    \n-
    51public:
    \n-
    52
    \n-
    53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
    \n-
    54
    \n-
    56 typedef T ctype;
    \n-
    57
    \n-
    59 typedef Dune::FieldVector<T, dimworld> WorldCoords;
    \n+
    37namespace GridGlue {
    \n+
    38
    \n+
    55template<class T, int grid1Dim, int grid2Dim, int dimworld>
    \n+\n+
    57 : public Merger<T,grid1Dim,grid2Dim,dimworld>
    \n+
    58{
    \n+\n
    60
    \n-
    62 typedef Dune::FieldVector<T, dim> LocalCoords;
    \n-
    63
    \n-
    64private:
    \n-
    65
    \n-
    66 /* M E M B E R V A R I A B L E S */
    \n+
    61public:
    \n+
    62
    \n+
    63 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
    \n+
    64
    \n+
    66 typedef T ctype;
    \n
    67
    \n-
    69 T tolerance_;
    \n+\n
    70
    \n-
    71 typedef typename StandardMerge<T,dim,dim,dimworld>::SimplicialIntersection SimplicialIntersection;
    \n-
    72
    \n-
    77 void computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n-
    78 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n-
    79 std::bitset<(1<<dim)>& neighborIntersects1,
    \n-
    80 unsigned int grid1Index,
    \n-
    81 const Dune::GeometryType& grid2ElementType,
    \n-
    82 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n-
    83 std::bitset<(1<<dim)>& neighborIntersects2,
    \n-
    84 unsigned int grid2Index,
    \n-
    85 std::vector<SimplicialIntersection>& intersections);
    \n-
    86
    \n-
    87public:
    \n-
    88
    \n-
    89 static constexpr T default_tolerance = 1e-4;
    \n-
    90
    \n-\n-
    92 tolerance_(tolerance)
    \n-
    93 {}
    \n-
    94};
    \n-
    95
    \n-
    96template<int dim, int dimworld, typename T>
    \n-\n-
    98
    \n-
    99template<int dim, int dimworld, typename T>
    \n-
    100void ConformingMerge<dim, dimworld, T>::computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n-
    101 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n-
    102 std::bitset<(1<<dim)>& neighborIntersects1,
    \n-
    103 unsigned int grid1Index,
    \n-
    104 const Dune::GeometryType& grid2ElementType,
    \n-
    105 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n-
    106 std::bitset<(1<<dim)>& neighborIntersects2,
    \n-
    107 unsigned int grid2Index,
    \n-
    108 std::vector<SimplicialIntersection>& intersections)
    \n-
    109{
    \n-
    110 this->counter++;
    \n-
    111
    \n-
    112 // A few consistency checks
    \n-
    113 assert((unsigned int)(Dune::ReferenceElements<T,dim>::general(grid1ElementType).size(dim)) == grid1ElementCorners.size());
    \n-
    114 assert((unsigned int)(Dune::ReferenceElements<T,dim>::general(grid2ElementType).size(dim)) == grid2ElementCorners.size());
    \n-
    115 // any intersection we may find will be the entire elements.
    \n-
    116 neighborIntersects1.reset();
    \n-
    117 neighborIntersects2.reset();
    \n-
    118
    \n-
    119 // the intersection is either conforming or empty, hence the GeometryTypes have to match
    \n-
    120 if (grid1ElementType != grid2ElementType)
    \n-
    121 return;
    \n+\n+
    73
    \n+\n+
    76
    \n+\n+
    78
    \n+
    79protected:
    \n+
    80
    \n+\n+\n+\n+
    85
    \n+
    86 bool valid = false;
    \n+
    87
    \n+\n+\n+\n+
    91 {}
    \n+
    92
    \n+
    93 virtual ~StandardMerge() = default;
    \n+
    94
    \n+
    99 virtual void computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n+
    100 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n+
    101 std::bitset<(1<<grid1Dim)>& neighborIntersects1,
    \n+
    102 unsigned int grid1Index,
    \n+
    103 const Dune::GeometryType& grid2ElementType,
    \n+
    104 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n+
    105 std::bitset<(1<<grid2Dim)>& neighborIntersects2,
    \n+
    106 unsigned int grid2Index,
    \n+
    107 std::vector<SimplicialIntersection>& intersections) = 0;
    \n+
    108
    \n+
    112 bool computeIntersection(unsigned int candidate0, unsigned int candidate1,
    \n+
    113 const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    114 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    115 std::bitset<(1<<grid1Dim)>& neighborIntersects1,
    \n+
    116 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    117 const std::vector<Dune::GeometryType>& grid2_element_types,
    \n+
    118 std::bitset<(1<<grid2Dim)>& neighborIntersects2,
    \n+
    119 bool insert = true);
    \n+
    120
    \n+
    121 /* M E M B E R V A R I A B L E S */
    \n
    122
    \n-
    123 // ////////////////////////////////////////////////////////////
    \n-
    124 // Find correspondences between the different corners
    \n-
    125 // ////////////////////////////////////////////////////////////
    \n-
    126 std::vector<int> other(grid1ElementCorners.size(), -1);
    \n-
    127
    \n-
    128 for (unsigned int i=0; i<grid1ElementCorners.size(); i++) {
    \n+
    123 std::shared_ptr<IntersectionListProvider> intersectionListProvider_;
    \n+
    124 std::shared_ptr<IntersectionList> intersectionList_;
    \n+
    125
    \n+
    127 std::vector<std::vector<unsigned int> > grid1ElementCorners_;
    \n+
    128 std::vector<std::vector<unsigned int> > grid2ElementCorners_;
    \n
    129
    \n-
    130 for (unsigned int j=0; j<grid2ElementCorners.size(); j++) {
    \n-
    131
    \n-
    132 if ( (grid1ElementCorners[i]-grid2ElementCorners[j]).two_norm() < tolerance_ ) {
    \n-
    133
    \n-
    134 other[i] = j;
    \n-
    135 break;
    \n+
    130 std::vector<std::vector<int> > elementNeighbors1_;
    \n+
    131 std::vector<std::vector<int> > elementNeighbors2_;
    \n+
    132
    \n+
    133public:
    \n+
    134
    \n+
    135 /* C O N C E P T I M P L E M E N T I N G I N T E R F A C E */
    \n
    136
    \n-
    137 }
    \n-
    138
    \n-
    139 }
    \n-
    140
    \n-
    141 // No corresponding grid2 vertex found for this grid1 vertex
    \n-
    142 if (other[i] == -1)
    \n-
    143 return;
    \n-
    144
    \n-
    145 }
    \n+
    140 void build(const std::vector<Dune::FieldVector<T,dimworld> >& grid1_Coords,
    \n+
    141 const std::vector<unsigned int>& grid1_elements,
    \n+
    142 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    143 const std::vector<Dune::FieldVector<T,dimworld> >& grid2_coords,
    \n+
    144 const std::vector<unsigned int>& grid2_elements,
    \n+
    145 const std::vector<Dune::GeometryType>& grid2_element_types) override;
    \n
    146
    \n-
    147 // ////////////////////////////////////////////////////////////
    \n-
    148 // Set up the new remote intersection
    \n-
    149 // ////////////////////////////////////////////////////////////
    \n-
    150
    \n-
    151 const auto& refElement = Dune::ReferenceElements<T,dim>::general(grid1ElementType);
    \n-
    152
    \n-
    154 if (grid1ElementType.isSimplex()) {
    \n-
    155
    \n-
    156 intersections.emplace_back(grid1Index, grid2Index);
    \n-
    157
    \n-
    158 for (int i=0; i<refElement.size(dim); i++) {
    \n-
    159 intersections.back().corners0[0][i] = refElement.position(i,dim);
    \n-
    160 intersections.back().corners1[0][i] = refElement.position(other[i],dim);
    \n-
    161 }
    \n-
    162
    \n-
    163 } else if (dim == 2 && grid1ElementType.isQuadrilateral()) {
    \n-
    164
    \n-
    165 // split the quadrilateral into two triangles
    \n-
    166 const unsigned int subVertices[2][3] = {{0,1,3}, {0,3,2}};
    \n-
    167
    \n-
    168 for (int i=0; i<2; i++) {
    \n-
    169
    \n-
    170 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index);
    \n-
    171
    \n-
    172 for (int j=0; j<dim+1; j++) {
    \n-
    173 newSimplicialIntersection.corners0[0][j] = refElement.position(subVertices[i][j],dim);
    \n-
    174 newSimplicialIntersection.corners1[0][j] = refElement.position(subVertices[i][other[j]],dim);
    \n-
    175 }
    \n-
    176
    \n-
    177 intersections.push_back(newSimplicialIntersection);
    \n-
    178
    \n-
    179 }
    \n-
    180
    \n-
    181 } else if (grid1ElementType.isHexahedron()) {
    \n-
    182
    \n-
    183 // split the hexahedron into five tetrahedra
    \n-
    184 // This can be removed if ever we allow Intersections that are not simplices
    \n-
    185 const unsigned int subVertices[5][4] = {{0,1,3,5}, {0,3,2,6}, {4,5,0,6}, {6,7,6,3}, {6,0,5,3}};
    \n+
    147
    \n+
    148 /* P R O B I N G T H E M E R G E D G R I D */
    \n+
    149
    \n+
    150 void clear() override
    \n+
    151 {
    \n+
    152 // Delete old internal data, from a possible previous run
    \n+\n+\n+\n+
    156
    \n+
    157 valid = false;
    \n+
    158 }
    \n+
    159
    \n+
    160 std::shared_ptr<IntersectionList> intersectionList() const final
    \n+
    161 {
    \n+
    162 assert(valid);
    \n+
    163 return intersectionList_;
    \n+
    164 }
    \n+
    165
    \n+
    166 void enableFallback(bool fallback)
    \n+
    167 {
    \n+
    168 m_enableFallback = fallback;
    \n+
    169 }
    \n+
    170
    \n+
    171 void enableBruteForce(bool bruteForce)
    \n+
    172 {
    \n+
    173 m_enableBruteForce = bruteForce;
    \n+
    174 }
    \n+
    175
    \n+
    176private:
    \n+
    180 bool m_enableFallback = false;
    \n+
    181
    \n+
    185 bool m_enableBruteForce = false;
    \n
    186
    \n-
    187 for (int i=0; i<5; i++) {
    \n-
    188
    \n-
    189 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index);
    \n-
    190
    \n-
    191 for (int j=0; j<dim+1; j++) {
    \n-
    192 newSimplicialIntersection.corners0[0][j] = refElement.position(subVertices[i][j],dim);
    \n-
    193 newSimplicialIntersection.corners1[0][j] = refElement.position(subVertices[i][other[j]],dim);
    \n-
    194 }
    \n-
    195
    \n-
    196 intersections.push_back(newSimplicialIntersection);
    \n-
    197
    \n-
    198 }
    \n-
    199
    \n-
    200 } else
    \n-
    201 DUNE_THROW(Dune::GridError, "Unsupported element type");
    \n-
    202
    \n-
    203}
    \n-
    204
    \n-
    205} // namespace GridGlue
    \n-
    206
    \n-
    207} // namespace Dune
    \n-
    208
    \n-
    209#endif // DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
    \n-
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    \n+
    187 auto& intersections()
    \n+
    188 { return intersectionListProvider_->intersections(); }
    \n+
    189
    \n+
    191 template<typename V>
    \n+
    192 static void purge(V & v)
    \n+
    193 {
    \n+
    194 v.clear();
    \n+
    195 V v2(v);
    \n+
    196 v.swap(v2);
    \n+
    197 }
    \n+
    198
    \n+
    203 void generateSeed(std::vector<int>& seeds,
    \n+
    204 Dune::BitSetVector<1>& isHandled2,
    \n+
    205 std::stack<unsigned>& candidates2,
    \n+
    206 const std::vector<Dune::FieldVector<T, dimworld> >& grid1Coords,
    \n+
    207 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    208 const std::vector<Dune::FieldVector<T, dimworld> >& grid2Coords,
    \n+
    209 const std::vector<Dune::GeometryType>& grid2_element_types);
    \n+
    210
    \n+
    214 int insertIntersections(unsigned int candidate1, unsigned int candidate2,std::vector<SimplicialIntersection>& intersections);
    \n+
    215
    \n+
    219 int bruteForceSearch(int candidate1,
    \n+
    220 const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    221 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    222 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    223 const std::vector<Dune::GeometryType>& grid2_element_types);
    \n+
    224
    \n+
    228 std::pair<bool, unsigned int>
    \n+
    229 intersectionIndex(unsigned int grid1Index, unsigned int grid2Index,
    \n+
    230 SimplicialIntersection& intersection);
    \n+
    231
    \n+
    235 template <int gridDim>
    \n+
    236 void computeNeighborsPerElement(const std::vector<Dune::GeometryType>& gridElementTypes,
    \n+
    237 const std::vector<std::vector<unsigned int> >& gridElementCorners,
    \n+
    238 std::vector<std::vector<int> >& elementNeighbors);
    \n+
    239
    \n+
    240 void buildAdvancingFront(
    \n+
    241 const std::vector<Dune::FieldVector<T,dimworld> >& grid1_Coords,
    \n+
    242 const std::vector<unsigned int>& grid1_elements,
    \n+
    243 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    244 const std::vector<Dune::FieldVector<T,dimworld> >& grid2_coords,
    \n+
    245 const std::vector<unsigned int>& grid2_elements,
    \n+
    246 const std::vector<Dune::GeometryType>& grid2_element_types
    \n+
    247 );
    \n+
    248
    \n+
    249 void buildBruteForce(
    \n+
    250 const std::vector<Dune::FieldVector<T,dimworld> >& grid1_Coords,
    \n+
    251 const std::vector<unsigned int>& grid1_elements,
    \n+
    252 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    253 const std::vector<Dune::FieldVector<T,dimworld> >& grid2_coords,
    \n+
    254 const std::vector<unsigned int>& grid2_elements,
    \n+
    255 const std::vector<Dune::GeometryType>& grid2_element_types
    \n+
    256 );
    \n+
    257};
    \n+
    258
    \n+
    259
    \n+
    260/* IMPLEMENTATION */
    \n+
    261
    \n+
    262template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    263bool StandardMerge<T,grid1Dim,grid2Dim,dimworld>::computeIntersection(unsigned int candidate0, unsigned int candidate1,
    \n+
    264 const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    265 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    266 std::bitset<(1<<grid1Dim)>& neighborIntersects1,
    \n+
    267 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    268 const std::vector<Dune::GeometryType>& grid2_element_types,
    \n+
    269 std::bitset<(1<<grid2Dim)>& neighborIntersects2,
    \n+
    270 bool insert)
    \n+
    271{
    \n+
    272 // Select vertices of the grid1 element
    \n+
    273 int grid1NumVertices = grid1ElementCorners_[candidate0].size();
    \n+
    274 std::vector<Dune::FieldVector<T,dimworld> > grid1ElementCorners(grid1NumVertices);
    \n+
    275 for (int i=0; i<grid1NumVertices; i++)
    \n+
    276 grid1ElementCorners[i] = grid1Coords[grid1ElementCorners_[candidate0][i]];
    \n+
    277
    \n+
    278 // Select vertices of the grid2 element
    \n+
    279 int grid2NumVertices = grid2ElementCorners_[candidate1].size();
    \n+
    280 std::vector<Dune::FieldVector<T,dimworld> > grid2ElementCorners(grid2NumVertices);
    \n+
    281 for (int i=0; i<grid2NumVertices; i++)
    \n+
    282 grid2ElementCorners[i] = grid2Coords[grid2ElementCorners_[candidate1][i]];
    \n+
    283
    \n+
    284 // ///////////////////////////////////////////////////////
    \n+
    285 // Compute the intersection between the two elements
    \n+
    286 // ///////////////////////////////////////////////////////
    \n+
    287
    \n+
    288 std::vector<SimplicialIntersection> intersections(0);
    \n+
    289
    \n+
    290 // compute the intersections
    \n+
    291 computeIntersections(grid1_element_types[candidate0], grid1ElementCorners,
    \n+
    292 neighborIntersects1, candidate0,
    \n+
    293 grid2_element_types[candidate1], grid2ElementCorners,
    \n+
    294 neighborIntersects2, candidate1,
    \n+\n+
    296
    \n+
    297 // insert intersections if needed
    \n+
    298 if(insert && !intersections.empty())
    \n+
    299 insertIntersections(candidate0,candidate1,intersections);
    \n+
    300
    \n+
    301 // Have we found an intersection?
    \n+
    302 return !intersections.empty() || neighborIntersects1.any() || neighborIntersects2.any();
    \n+
    303
    \n+
    304}
    \n+
    305
    \n+
    306template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+\n+
    308 const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    309 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    310 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    311 const std::vector<Dune::GeometryType>& grid2_element_types)
    \n+
    312{
    \n+
    313 std::bitset<(1<<grid1Dim)> neighborIntersects1;
    \n+
    314 std::bitset<(1<<grid2Dim)> neighborIntersects2;
    \n+
    315 for (std::size_t i=0; i<grid1_element_types.size(); i++) {
    \n+
    316
    \n+
    317 bool intersectionFound = computeIntersection(i, candidate1,
    \n+
    318 grid1Coords, grid1_element_types, neighborIntersects1,
    \n+
    319 grid2Coords, grid2_element_types, neighborIntersects2,
    \n+
    320 false);
    \n+
    321
    \n+
    322 // if there is an intersection, i is our new seed candidate on the grid1 side
    \n+
    323 if (intersectionFound)
    \n+
    324 return i;
    \n+
    325
    \n+
    326 }
    \n+
    327
    \n+
    328 return -1;
    \n+
    329}
    \n+
    330
    \n+
    331
    \n+
    332template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    333template<int gridDim>
    \n+
    334void StandardMerge<T,grid1Dim,grid2Dim,dimworld>::
    \n+
    335computeNeighborsPerElement(const std::vector<Dune::GeometryType>& gridElementTypes,
    \n+
    336 const std::vector<std::vector<unsigned int> >& gridElementCorners,
    \n+
    337 std::vector<std::vector<int> >& elementNeighbors)
    \n+
    338{
    \n+
    339 typedef std::vector<unsigned int> FaceType;
    \n+
    340 typedef std::map<FaceType, std::pair<unsigned int, unsigned int> > FaceSetType;
    \n+
    341
    \n+
    343 // First: grid 1
    \n+
    345 FaceSetType faces;
    \n+
    346 elementNeighbors.resize(gridElementTypes.size());
    \n+
    347
    \n+
    348 for (size_t i=0; i<gridElementTypes.size(); i++)
    \n+
    349 elementNeighbors[i].resize(Dune::ReferenceElements<T,gridDim>::general(gridElementTypes[i]).size(1), -1);
    \n+
    350
    \n+
    351 for (size_t i=0; i<gridElementTypes.size(); i++) { //iterate over all elements
    \n+
    352 const auto& refElement = Dune::ReferenceElements<T,gridDim>::general(gridElementTypes[i]);
    \n+
    353
    \n+
    354 for (size_t j=0; j<(size_t)refElement.size(1); j++) { // iterate over all faces of the element
    \n+
    355
    \n+
    356 FaceType face;
    \n+
    357 // extract element face
    \n+
    358 for (size_t k=0; k<(size_t)refElement.size(j,1,gridDim); k++)
    \n+
    359 face.push_back(gridElementCorners[i][refElement.subEntity(j,1,k,gridDim)]);
    \n+
    360
    \n+
    361 // sort the face vertices to get rid of twists and other permutations
    \n+
    362 std::sort(face.begin(), face.end());
    \n+
    363
    \n+
    364 typename FaceSetType::iterator faceHandle = faces.find(face);
    \n+
    365
    \n+
    366 if (faceHandle == faces.end()) {
    \n+
    367
    \n+
    368 // face has not been visited before
    \n+
    369 faces.insert(std::make_pair(face, std::make_pair(i,j)));
    \n+
    370
    \n+
    371 } else {
    \n+
    372
    \n+
    373 // face has been visited before: store the mutual neighbor information
    \n+
    374 elementNeighbors[i][j] = faceHandle->second.first;
    \n+
    375 elementNeighbors[faceHandle->second.first][faceHandle->second.second] = i;
    \n+
    376
    \n+
    377 faces.erase(faceHandle);
    \n+
    378
    \n+
    379 }
    \n+
    380
    \n+
    381 }
    \n+
    382
    \n+
    383 }
    \n+
    384}
    \n+
    385
    \n+
    386// /////////////////////////////////////////////////////////////////////
    \n+
    387// Compute the intersection of all pairs of elements
    \n+
    388// Linear algorithm by Gander and Japhet, Proc. of DD18
    \n+
    389// /////////////////////////////////////////////////////////////////////
    \n+
    390
    \n+
    391template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    392void StandardMerge<T,grid1Dim,grid2Dim,dimworld>::build(const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    393 const std::vector<unsigned int>& grid1_elements,
    \n+
    394 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    395 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    396 const std::vector<unsigned int>& grid2_elements,
    \n+
    397 const std::vector<Dune::GeometryType>& grid2_element_types
    \n+
    398 )
    \n+
    399{
    \n+
    400
    \n+
    401 std::cout << "StandardMerge building merged grid..." << std::endl;
    \n+
    402 Dune::Timer watch;
    \n+
    403
    \n+
    404 clear();
    \n+
    405 // clear global intersection list
    \n+
    406 intersectionListProvider_->clear();
    \n+
    407 this->counter = 0;
    \n+
    408
    \n+
    409 // /////////////////////////////////////////////////////////////////////
    \n+
    410 // Copy element corners into a data structure with block-structure.
    \n+
    411 // This is not as efficient but a lot easier to use.
    \n+
    412 // We may think about efficiency later.
    \n+
    413 // /////////////////////////////////////////////////////////////////////
    \n+
    414
    \n+
    415 // first the grid1 side
    \n+
    416 grid1ElementCorners_.resize(grid1_element_types.size());
    \n+
    417
    \n+
    418 unsigned int grid1CornerCounter = 0;
    \n+
    419
    \n+
    420 for (std::size_t i=0; i<grid1_element_types.size(); i++) {
    \n+
    421
    \n+
    422 // Select vertices of the grid1 element
    \n+
    423 int numVertices = Dune::ReferenceElements<T,grid1Dim>::general(grid1_element_types[i]).size(grid1Dim);
    \n+
    424 grid1ElementCorners_[i].resize(numVertices);
    \n+
    425 for (int j=0; j<numVertices; j++)
    \n+
    426 grid1ElementCorners_[i][j] = grid1_elements[grid1CornerCounter++];
    \n+
    427
    \n+
    428 }
    \n+
    429
    \n+
    430 // then the grid2 side
    \n+
    431 grid2ElementCorners_.resize(grid2_element_types.size());
    \n+
    432
    \n+
    433 unsigned int grid2CornerCounter = 0;
    \n+
    434
    \n+
    435 for (std::size_t i=0; i<grid2_element_types.size(); i++) {
    \n+
    436
    \n+
    437 // Select vertices of the grid2 element
    \n+
    438 int numVertices = Dune::ReferenceElements<T,grid2Dim>::general(grid2_element_types[i]).size(grid2Dim);
    \n+
    439 grid2ElementCorners_[i].resize(numVertices);
    \n+
    440 for (int j=0; j<numVertices; j++)
    \n+
    441 grid2ElementCorners_[i][j] = grid2_elements[grid2CornerCounter++];
    \n+
    442
    \n+
    443 }
    \n+
    444
    \n+
    446 // Compute the face neighbors for each element
    \n+
    448
    \n+
    449 computeNeighborsPerElement<grid1Dim>(grid1_element_types, grid1ElementCorners_, elementNeighbors1_);
    \n+
    450 computeNeighborsPerElement<grid2Dim>(grid2_element_types, grid2ElementCorners_, elementNeighbors2_);
    \n+
    451
    \n+
    452 std::cout << "setup took " << watch.elapsed() << " seconds." << std::endl;
    \n+
    453
    \n+
    454 if (m_enableBruteForce)
    \n+
    455 buildBruteForce(grid1Coords, grid1_elements, grid1_element_types, grid2Coords, grid2_elements, grid2_element_types);
    \n+
    456 else
    \n+
    457 buildAdvancingFront(grid1Coords, grid1_elements, grid1_element_types, grid2Coords, grid2_elements, grid2_element_types);
    \n+
    458
    \n+
    459 valid = true;
    \n+
    460 std::cout << "intersection construction took " << watch.elapsed() << " seconds." << std::endl;
    \n+
    461}
    \n+
    462
    \n+
    463template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+\n+
    465 const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    466 const std::vector<unsigned int>& grid1_elements,
    \n+
    467 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    468 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    469 const std::vector<unsigned int>& grid2_elements,
    \n+
    470 const std::vector<Dune::GeometryType>& grid2_element_types
    \n+
    471 )
    \n+
    472{
    \n+
    474 // Data structures for the advancing-front algorithm
    \n+
    476
    \n+
    477 std::stack<unsigned int> candidates1;
    \n+
    478 std::stack<unsigned int> candidates2;
    \n+
    479
    \n+
    480 std::vector<int> seeds(grid2_element_types.size(), -1);
    \n+
    481
    \n+
    482 // /////////////////////////////////////////////////////////////////////
    \n+
    483 // Do a brute-force search to find one pair of intersecting elements
    \n+
    484 // to start the advancing-front type algorithm with.
    \n+
    485 // /////////////////////////////////////////////////////////////////////
    \n+
    486
    \n+
    487 // Set flag if element has been handled
    \n+
    488 Dune::BitSetVector<1> isHandled2(grid2_element_types.size());
    \n+
    489
    \n+
    490 // Set flag if the element has been entered in the queue
    \n+
    491 Dune::BitSetVector<1> isCandidate2(grid2_element_types.size());
    \n+
    492
    \n+
    493 generateSeed(seeds, isHandled2, candidates2, grid1Coords, grid1_element_types, grid2Coords, grid2_element_types);
    \n+
    494
    \n+
    495 // /////////////////////////////////////////////////////////////////////
    \n+
    496 // Main loop
    \n+
    497 // /////////////////////////////////////////////////////////////////////
    \n+
    498
    \n+
    499 std::set<unsigned int> isHandled1;
    \n+
    500
    \n+
    501 std::set<unsigned int> isCandidate1;
    \n+
    502
    \n+
    503 while (!candidates2.empty()) {
    \n+
    504
    \n+
    505 // Get the next element on the grid2 side
    \n+
    506 unsigned int currentCandidate2 = candidates2.top();
    \n+
    507 int seed = seeds[currentCandidate2];
    \n+
    508 assert(seed >= 0);
    \n+
    509
    \n+
    510 candidates2.pop();
    \n+
    511 isHandled2[currentCandidate2] = true;
    \n+
    512
    \n+
    513 // Start advancing front algorithm on the grid1 side from the 'seed' element that
    \n+
    514 // we stored along with the current grid2 element
    \n+
    515 candidates1.push(seed);
    \n+
    516
    \n+
    517 isHandled1.clear();
    \n+
    518 isCandidate1.clear();
    \n+
    519
    \n+
    520 while (!candidates1.empty()) {
    \n+
    521
    \n+
    522 unsigned int currentCandidate1 = candidates1.top();
    \n+
    523 candidates1.pop();
    \n+
    524 isHandled1.insert(currentCandidate1);
    \n+
    525
    \n+
    526 // Test whether there is an intersection between currentCandidate0 and currentCandidate1
    \n+
    527 std::bitset<(1<<grid1Dim)> neighborIntersects1;
    \n+
    528 std::bitset<(1<<grid2Dim)> neighborIntersects2;
    \n+
    529 bool intersectionFound = computeIntersection(currentCandidate1, currentCandidate2,
    \n+
    530 grid1Coords,grid1_element_types, neighborIntersects1,
    \n+
    531 grid2Coords,grid2_element_types, neighborIntersects2);
    \n+
    532
    \n+
    533 for (size_t i=0; i<neighborIntersects2.size(); i++)
    \n+
    534 if (neighborIntersects2[i] && elementNeighbors2_[currentCandidate2][i] != -1)
    \n+
    535 seeds[elementNeighbors2_[currentCandidate2][i]] = currentCandidate1;
    \n+
    536
    \n+
    537 // add neighbors of candidate0 to the list of elements to be checked
    \n+
    538 if (intersectionFound) {
    \n+
    539
    \n+
    540 for (size_t i=0; i<elementNeighbors1_[currentCandidate1].size(); i++) {
    \n+
    541
    \n+
    542 int neighbor = elementNeighbors1_[currentCandidate1][i];
    \n+
    543
    \n+
    544 if (neighbor == -1) // do nothing at the grid boundary
    \n+
    545 continue;
    \n+
    546
    \n+
    547 if (isHandled1.find(neighbor) == isHandled1.end()
    \n+
    548 && isCandidate1.find(neighbor) == isCandidate1.end()) {
    \n+
    549 candidates1.push(neighbor);
    \n+
    550 isCandidate1.insert(neighbor);
    \n+
    551 }
    \n+
    552
    \n+
    553 }
    \n+
    554
    \n+
    555 }
    \n+
    556
    \n+
    557 }
    \n+
    558
    \n+
    559 // We have now found all intersections of elements in the grid1 side with currentCandidate2
    \n+
    560 // Now we add all neighbors of currentCandidate2 that have not been treated yet as new
    \n+
    561 // candidates.
    \n+
    562
    \n+
    563 // Do we have an unhandled neighbor with a seed?
    \n+
    564 bool seedFound = !candidates2.empty();
    \n+
    565 for (size_t i=0; i<elementNeighbors2_[currentCandidate2].size(); i++) {
    \n+
    566
    \n+
    567 int neighbor = elementNeighbors2_[currentCandidate2][i];
    \n+
    568
    \n+
    569 if (neighbor == -1) // do nothing at the grid boundary
    \n+
    570 continue;
    \n+
    571
    \n+
    572 // Add all unhandled intersecting neighbors to the queue
    \n+
    573 if (!isHandled2[neighbor][0] && !isCandidate2[neighbor][0] && seeds[neighbor]>-1) {
    \n+
    574
    \n+
    575 isCandidate2[neighbor][0] = true;
    \n+
    576 candidates2.push(neighbor);
    \n+
    577 seedFound = true;
    \n+
    578 }
    \n+
    579 }
    \n+
    580
    \n+
    581 if (seedFound || !m_enableFallback)
    \n+
    582 continue;
    \n+
    583
    \n+
    584 // There is no neighbor with a seed, so we need to be a bit more aggressive...
    \n+
    585 // get all neighbors of currentCandidate2, but not currentCandidate2 itself
    \n+
    586 for (size_t i=0; i<elementNeighbors2_[currentCandidate2].size(); i++) {
    \n+
    587
    \n+
    588 int neighbor = elementNeighbors2_[currentCandidate2][i];
    \n+
    589
    \n+
    590 if (neighbor == -1) // do nothing at the grid boundary
    \n+
    591 continue;
    \n+
    592
    \n+
    593 if (!isHandled2[neighbor][0] && !isCandidate2[neighbor][0]) {
    \n+
    594
    \n+
    595 // Get a seed element for the new grid2 element
    \n+
    596 // Look for an element on the grid1 side that intersects the new grid2 element.
    \n+
    597 int seed = -1;
    \n+
    598
    \n+
    599 // Look among the ones that have been tested during the last iteration.
    \n+
    600 for (typename std::set<unsigned int>::iterator seedIt = isHandled1.begin();
    \n+
    601 seedIt != isHandled1.end(); ++seedIt) {
    \n+
    602
    \n+
    603 std::bitset<(1<<grid1Dim)> neighborIntersects1;
    \n+
    604 std::bitset<(1<<grid2Dim)> neighborIntersects2;
    \n+
    605 bool intersectionFound = computeIntersection(*seedIt, neighbor,
    \n+
    606 grid1Coords, grid1_element_types, neighborIntersects1,
    \n+
    607 grid2Coords, grid2_element_types, neighborIntersects2,
    \n+
    608 false);
    \n+
    609
    \n+
    610 // if the intersection is nonempty, *seedIt is our new seed candidate on the grid1 side
    \n+
    611 if (intersectionFound) {
    \n+
    612 seed = *seedIt;
    \n+
    613 Dune::dwarn << "Algorithm entered first fallback method and found a new seed in the build algorithm." <<
    \n+
    614 "Probably, the neighborIntersects bitsets computed in computeIntersection specialization is wrong." << std::endl;
    \n+
    615 break;
    \n+
    616 }
    \n+
    617
    \n+
    618 }
    \n+
    619
    \n+
    620 if (seed < 0) {
    \n+
    621 // The fast method didn't find a grid1 element that intersects with
    \n+
    622 // the new grid2 candidate. We have to do a brute-force search.
    \n+
    623 seed = bruteForceSearch(neighbor,
    \n+
    624 grid1Coords,grid1_element_types,
    \n+
    625 grid2Coords,grid2_element_types);
    \n+
    626 Dune::dwarn << "Algorithm entered second fallback method. This probably should not happen." << std::endl;
    \n+
    627
    \n+
    628 }
    \n+
    629
    \n+
    630 // We have tried all we could: the candidate is 'handled' now
    \n+
    631 isCandidate2[neighbor] = true;
    \n+
    632
    \n+
    633 // still no seed? Then the new grid2 candidate isn't overlapped by anything
    \n+
    634 if (seed < 0)
    \n+
    635 continue;
    \n+
    636
    \n+
    637 // we have a seed now
    \n+
    638 candidates2.push(neighbor);
    \n+
    639 seeds[neighbor] = seed;
    \n+
    640 seedFound = true;
    \n+
    641
    \n+
    642 }
    \n+
    643
    \n+
    644 }
    \n+
    645
    \n+
    646 /* Do a brute-force search if there is still no seed:
    \n+
    647 * There might still be a disconnected region out there.
    \n+
    648 */
    \n+
    649 if (!seedFound && candidates2.empty()) {
    \n+
    650 generateSeed(seeds, isHandled2, candidates2, grid1Coords, grid1_element_types, grid2Coords, grid2_element_types);
    \n+
    651 }
    \n+
    652 }
    \n+
    653}
    \n+
    654
    \n+
    655template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    656void StandardMerge<T,grid1Dim,grid2Dim,dimworld>::buildBruteForce(
    \n+
    657 const std::vector<Dune::FieldVector<T,dimworld> >& grid1Coords,
    \n+
    658 const std::vector<unsigned int>& grid1_elements,
    \n+
    659 const std::vector<Dune::GeometryType>& grid1_element_types,
    \n+
    660 const std::vector<Dune::FieldVector<T,dimworld> >& grid2Coords,
    \n+
    661 const std::vector<unsigned int>& grid2_elements,
    \n+
    662 const std::vector<Dune::GeometryType>& grid2_element_types
    \n+
    663 )
    \n+
    664{
    \n+
    665 std::bitset<(1<<grid1Dim)> neighborIntersects1;
    \n+
    666 std::bitset<(1<<grid2Dim)> neighborIntersects2;
    \n+
    667
    \n+
    668 for (unsigned i = 0; i < grid1_element_types.size(); ++i) {
    \n+
    669 for (unsigned j = 0; j < grid2_element_types.size(); ++j) {
    \n+
    670 (void) computeIntersection(i, j,
    \n+
    671 grid1Coords, grid1_element_types, neighborIntersects1,
    \n+
    672 grid2Coords, grid2_element_types, neighborIntersects2);
    \n+
    673 }
    \n+
    674 }
    \n+
    675}
    \n+
    676
    \n+
    677template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    678void StandardMerge<T,grid1Dim,grid2Dim,dimworld>::generateSeed(std::vector<int>& seeds, Dune::BitSetVector<1>& isHandled2, std::stack<unsigned>& candidates2, const std::vector<Dune::FieldVector<T, dimworld> >& grid1Coords, const std::vector<Dune::GeometryType>& grid1_element_types, const std::vector<Dune::FieldVector<T, dimworld> >& grid2Coords, const std::vector<Dune::GeometryType>& grid2_element_types)
    \n+
    679{
    \n+
    680 for (std::size_t j=0; j<grid2_element_types.size(); j++) {
    \n+
    681
    \n+
    682 if (seeds[j] > 0 || isHandled2[j][0])
    \n+
    683 continue;
    \n+
    684
    \n+
    685 int seed = bruteForceSearch(j,grid1Coords,grid1_element_types,grid2Coords,grid2_element_types);
    \n+
    686
    \n+
    687 if (seed >= 0) {
    \n+
    688 candidates2.push(j); // the candidate and a seed for the candidate
    \n+
    689 seeds[j] = seed;
    \n+
    690 break;
    \n+
    691 } else // If the brute force search did not find any intersection we can skip this element
    \n+
    692 isHandled2[j] = true;
    \n+
    693 }
    \n+
    694}
    \n+
    695
    \n+
    696template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    697int StandardMerge<T,grid1Dim,grid2Dim,dimworld>::insertIntersections(unsigned int candidate1, unsigned int candidate2,
    \n+
    698 std::vector<SimplicialIntersection>& intersections)
    \n+
    699{
    \n+
    700 typedef typename std::vector<SimplicialIntersection>::size_type size_t;
    \n+
    701 int count = 0;
    \n+
    702
    \n+
    703 for (size_t i = 0; i < intersections.size(); ++i) {
    \n+
    704 // get the intersection index of the current intersection from intersections in this->intersections
    \n+
    705 bool found;
    \n+
    706 unsigned int index;
    \n+
    707 std::tie(found, index) = intersectionIndex(candidate1,candidate2,intersections[i]);
    \n+
    708
    \n+
    709 if (found && index >= this->intersections().size()) { //the intersection is not yet contained in this->intersections
    \n+
    710 this->intersections().push_back(intersections[i]); // insert
    \n+
    711
    \n+
    712 ++count;
    \n+
    713 } else if (found) {
    \n+
    714 auto& intersection = this->intersections()[index];
    \n+
    715
    \n+
    716 // insert each grid1 element and local representation of intersections[i] with parent candidate1
    \n+
    717 for (size_t j = 0; j < intersections[i].parents0.size(); ++j) {
    \n+
    718 intersection.parents0.push_back(candidate1);
    \n+
    719 intersection.corners0.push_back(intersections[i].corners0[j]);
    \n+
    720 }
    \n+
    721
    \n+
    722 // insert each grid2 element and local representation of intersections[i] with parent candidate2
    \n+
    723 for (size_t j = 0; j < intersections[i].parents1.size(); ++j) {
    \n+
    724 intersection.parents1.push_back(candidate2);
    \n+
    725 intersection.corners1.push_back(intersections[i].corners1[j]);
    \n+
    726 }
    \n+
    727
    \n+
    728 ++count;
    \n+
    729 } else {
    \n+
    730 Dune::dwarn << "Computed the same intersection twice!" << std::endl;
    \n+
    731 }
    \n+
    732 }
    \n+
    733 return count;
    \n+
    734}
    \n+
    735
    \n+
    736template<typename T, int grid1Dim, int grid2Dim, int dimworld>
    \n+
    737std::pair<bool, unsigned int>
    \n+
    738StandardMerge<T,grid1Dim,grid2Dim,dimworld>::intersectionIndex(unsigned int grid1Index, unsigned int grid2Index,
    \n+
    739 SimplicialIntersection& intersection) {
    \n+
    740
    \n+
    741
    \n+
    742 // return index in intersections_ if at least one local representation of a Simplicial Intersection (SI)
    \n+
    743 // of intersections_ is equal to the local representation of one element in intersections
    \n+
    744
    \n+
    745 std::size_t n_intersections = this->intersections().size();
    \n+
    746 if (grid1Dim == grid2Dim)
    \n+
    747 return {true, n_intersections};
    \n+
    748
    \n+
    749 T eps = 1e-10;
    \n+
    750
    \n+
    751 for (std::size_t i = 0; i < n_intersections; ++i) {
    \n+
    752
    \n+
    753 // compare the local representation of the subelements of the SI
    \n+
    754 for (std::size_t ei = 0; ei < this->intersections()[i].parents0.size(); ++ei) // merger subelement
    \n+
    755 {
    \n+
    756 if (this->intersections()[i].parents0[ei] == grid1Index)
    \n+
    757 {
    \n+
    758 for (std::size_t er = 0; er < intersection.parents0.size(); ++er) // list subelement
    \n+
    759 {
    \n+
    760 bool found_all = true;
    \n+
    761 // compare the local coordinate representations
    \n+
    762 for (std::size_t ci = 0; ci < this->intersections()[i].corners0[ei].size(); ++ci)
    \n+
    763 {
    \n+
    764 Dune::FieldVector<T,grid1Dim> ni = this->intersections()[i].corners0[ei][ci];
    \n+
    765 bool found_ni = false;
    \n+
    766 for (std::size_t cr = 0; cr < intersection.corners0[er].size(); ++cr)
    \n+
    767 {
    \n+
    768 Dune::FieldVector<T,grid1Dim> nr = intersection.corners0[er][cr];
    \n+
    769
    \n+
    770 found_ni = found_ni || ((ni-nr).infinity_norm() < eps);
    \n+
    771 if (found_ni)
    \n+
    772 break;
    \n+
    773 }
    \n+
    774 found_all = found_all && found_ni;
    \n+
    775
    \n+
    776 if (!found_ni)
    \n+
    777 break;
    \n+
    778 }
    \n+
    779
    \n+
    780 if (found_all && (this->intersections()[i].parents1[ei] != grid2Index))
    \n+
    781 return {true, i};
    \n+
    782 else if (found_all)
    \n+
    783 return {false, 0};
    \n+
    784 }
    \n+
    785 }
    \n+
    786 }
    \n+
    787
    \n+
    788 // compare the local representation of the subelements of the SI
    \n+
    789 for (std::size_t ei = 0; ei < this->intersections()[i].parents1.size(); ++ei) // merger subelement
    \n+
    790 {
    \n+
    791 if (this->intersections()[i].parents1[ei] == grid2Index)
    \n+
    792 {
    \n+
    793 for (std::size_t er = 0; er < intersection.parents1.size(); ++er) // list subelement
    \n+
    794 {
    \n+
    795 bool found_all = true;
    \n+
    796 // compare the local coordinate representations
    \n+
    797 for (std::size_t ci = 0; ci < this->intersections()[i].corners1[ei].size(); ++ci)
    \n+
    798 {
    \n+
    799 Dune::FieldVector<T,grid2Dim> ni = this->intersections()[i].corners1[ei][ci];
    \n+
    800 bool found_ni = false;
    \n+
    801 for (std::size_t cr = 0; cr < intersection.corners1[er].size(); ++cr)
    \n+
    802 {
    \n+
    803 Dune::FieldVector<T,grid2Dim> nr = intersection.corners1[er][cr];
    \n+
    804 found_ni = found_ni || ((ni-nr).infinity_norm() < eps);
    \n+
    805
    \n+
    806 if (found_ni)
    \n+
    807 break;
    \n+
    808 }
    \n+
    809 found_all = found_all && found_ni;
    \n+
    810
    \n+
    811 if (!found_ni)
    \n+
    812 break;
    \n+
    813 }
    \n+
    814
    \n+
    815 if (found_all && (this->intersections()[i].parents0[ei] != grid1Index))
    \n+
    816 return {true, i};
    \n+
    817 else if (found_all)
    \n+
    818 return {false, 0};
    \n+
    819 }
    \n+
    820 }
    \n+
    821 }
    \n+
    822 }
    \n+
    823
    \n+
    824 return {true, n_intersections};
    \n+
    825}
    \n+
    826
    \n+
    827#define DECL extern
    \n+
    828#define STANDARD_MERGE_INSTANTIATE(T,A,B,C) \\
    \n+
    829 DECL template \\
    \n+
    830 void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1Coords, \\
    \n+
    831 const std::vector<unsigned int>& grid1_elements, \\
    \n+
    832 const std::vector<Dune::GeometryType>& grid1_element_types, \\
    \n+
    833 const std::vector<Dune::FieldVector<T,C> >& grid2Coords, \\
    \n+
    834 const std::vector<unsigned int>& grid2_elements, \\
    \n+
    835 const std::vector<Dune::GeometryType>& grid2_element_types \\
    \n+
    836 )
    \n+
    837
    \n+
    838STANDARD_MERGE_INSTANTIATE(double,1,1,1);
    \n+
    839STANDARD_MERGE_INSTANTIATE(double,2,2,2);
    \n+
    840STANDARD_MERGE_INSTANTIATE(double,3,3,3);
    \n+
    841#undef STANDARD_MERGE_INSTANTIATE
    \n+
    842#undef DECL
    \n+
    843
    \n+
    844} /* namespace GridGlue */
    \n+
    845} /* namespace Dune */
    \n+
    846
    \n+
    847#endif // DUNE_GRIDGLUE_MERGING_STANDARDMERGE_HH
    \n+\n+\n+\n
    Definition: gridglue.hh:37
    \n+
    STANDARD_MERGE_INSTANTIATE(double, 1, 1, 1)
    \n
    IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
    Iterate over all intersections of a GridGlue.
    \n-
    Implementation of the Merger concept for conforming interfaces.
    Definition: conformingmerge.hh:49
    \n-
    Dune::FieldVector< T, dim > LocalCoords
    the coordinate type used in this interface
    Definition: conformingmerge.hh:62
    \n-
    Dune::FieldVector< T, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: conformingmerge.hh:59
    \n-
    static constexpr T default_tolerance
    Definition: conformingmerge.hh:89
    \n-
    T ctype
    the numeric type used in this interface
    Definition: conformingmerge.hh:56
    \n-
    ConformingMerge(T tolerance=default_tolerance)
    Definition: conformingmerge.hh:91
    \n+
    Definition: intersectionlist.hh:207
    \n+\n+
    Abstract base for all classes that take extracted grids and build sets of intersections.
    Definition: merger.hh:27
    \n+
    Dune::FieldVector< T, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: merger.hh:37
    \n+
    Dune::GridGlue::IntersectionList< Grid1Coords, Grid2Coords > IntersectionList
    Definition: merger.hh:39
    \n+
    Dune::FieldVector< T, grid1Dim > Grid1Coords
    the local coordinate type for the grid1 coordinates
    Definition: merger.hh:31
    \n+
    Dune::FieldVector< T, grid2Dim > Grid2Coords
    the local coordinate type for the grid2 coordinates
    Definition: merger.hh:34
    \n
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    Definition: standardmerge.hh:58
    \n+
    virtual void computeIntersections(const Dune::GeometryType &grid1ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid1ElementCorners, std::bitset<(1<< grid1Dim)> &neighborIntersects1, unsigned int grid1Index, const Dune::GeometryType &grid2ElementType, const std::vector< Dune::FieldVector< T, dimworld > > &grid2ElementCorners, std::bitset<(1<< grid2Dim)> &neighborIntersects2, unsigned int grid2Index, std::vector< SimplicialIntersection > &intersections)=0
    Compute the intersection between two overlapping elements.
    \n+
    std::shared_ptr< IntersectionList > intersectionList_
    Definition: standardmerge.hh:124
    \n+
    typename Base::Grid1Coords Grid1Coords
    Type used for local coordinates on the grid1 side.
    Definition: standardmerge.hh:69
    \n+
    void enableFallback(bool fallback)
    Definition: standardmerge.hh:166
    \n+
    std::vector< std::vector< int > > elementNeighbors2_
    Definition: standardmerge.hh:131
    \n+
    std::vector< std::vector< int > > elementNeighbors1_
    Definition: standardmerge.hh:130
    \n+
    T ctype
    the numeric type used in this interface
    Definition: standardmerge.hh:66
    \n+
    void clear() override
    Definition: standardmerge.hh:150
    \n+
    typename Base::IntersectionList IntersectionList
    Definition: standardmerge.hh:77
    \n+
    bool computeIntersection(unsigned int candidate0, unsigned int candidate1, const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords, const std::vector< Dune::GeometryType > &grid1_element_types, std::bitset<(1<< grid1Dim)> &neighborIntersects1, const std::vector< Dune::FieldVector< T, dimworld > > &grid2Coords, const std::vector< Dune::GeometryType > &grid2_element_types, std::bitset<(1<< grid2Dim)> &neighborIntersects2, bool insert=true)
    Compute the intersection between two overlapping elements.
    Definition: standardmerge.hh:263
    \n+
    void enableBruteForce(bool bruteForce)
    Definition: standardmerge.hh:171
    \n+
    std::shared_ptr< IntersectionListProvider > intersectionListProvider_
    Definition: standardmerge.hh:123
    \n+
    void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1_Coords, const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< T, dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements, const std::vector< Dune::GeometryType > &grid2_element_types) override
    builds the merged grid
    Definition: standardmerge.hh:392
    \n+
    std::vector< std::vector< unsigned int > > grid1ElementCorners_
    Temporary internal data.
    Definition: standardmerge.hh:127
    \n+
    std::vector< std::vector< unsigned int > > grid2ElementCorners_
    Definition: standardmerge.hh:128
    \n+
    typename Base::Grid2Coords Grid2Coords
    Type used for local coordinates on the grid2 side.
    Definition: standardmerge.hh:72
    \n+
    std::shared_ptr< IntersectionList > intersectionList() const final
    Definition: standardmerge.hh:160
    \n+
    virtual ~StandardMerge()=default
    \n+
    SimplicialIntersection RemoteSimplicialIntersection
    Definition: standardmerge.hh:84
    \n+
    bool valid
    Definition: standardmerge.hh:86
    \n+
    StandardMerge()
    Definition: standardmerge.hh:88
    \n
    typename IntersectionListProvider::SimplicialIntersection SimplicialIntersection
    Definition: standardmerge.hh:83
    \n+
    typename Base::WorldCoords WorldCoords
    the coordinate type used in this interface
    Definition: standardmerge.hh:75
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -5,254 +5,994 @@\n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n * merging\n-conformingmerge.hh\n+standardmerge.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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 5/*\n- 6 * Filename: conformingmerge.hh\n- 7 * Version: 1.0\n- 8 * Created on: Sep 14, 2009\n- 9 * Author: Oliver Sander\n- 10 * ---------------------------------\n- 11 * Project: dune-grid-glue\n- 12 * Description: implementation of the Merger concept for conforming\n-interfaces\n- 13 *\n- 14 */\n- 21#ifndef DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH\n- 22#define DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH\n+ 10#ifndef DUNE_GRIDGLUE_MERGING_STANDARDMERGE_HH\n+ 11#define DUNE_GRIDGLUE_MERGING_STANDARDMERGE_HH\n+ 12\n+ 13\n+ 14#include \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\n- 24#include \n- 25#include \n- 26#include \n- 27#include \n+ 24#include \n+ 25#include \n+ 26#include \n+ 27#include \n 28\n- 29#include \n- 30#include \n+ 29#include \n+ 30#include \n 31\n- 32#include \n- 33\n- 34#include \n+ 32#include \n+ 33#include \n+ 34#include \n 35\n 36namespace Dune {\n- 37\n- 38 namespace GridGlue {\n- 39\n- 46template\n-47class ConformingMerge\n- 48 : public StandardMerge\n- 49{\n- 50\n- 51public:\n- 52\n- 53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */\n- 54\n-56 typedef T ctype;\n- 57\n-59 typedef Dune::FieldVector WorldCoords;\n+ 37namespace GridGlue {\n+ 38\n+ 55template\n+56class StandardMerge\n+ 57 : public Merger\n+ 58{\n+ 59 using Base = Merger;\n 60\n-62 typedef Dune::FieldVector LocalCoords;\n- 63\n- 64private:\n- 65\n- 66 /* M E M B E R V A R I A B L E S */\n+ 61public:\n+ 62\n+ 63 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */\n+ 64\n+66 typedef T ctype;\n 67\n- 69 T tolerance_;\n+69 using Grid1Coords = typename Base::Grid1Coords;\n 70\n- 71 typedef typename StandardMerge::SimplicialIntersection\n+72 using Grid2Coords = typename Base::Grid2Coords;\n+ 73\n+75 using WorldCoords = typename Base::WorldCoords;\n+ 76\n+77 using IntersectionList = typename Base::IntersectionList;\n+ 78\n+ 79protected:\n+ 80\n+82 using IntersectionListProvider =\n+SimplicialIntersectionListProvider;\n+83 using SimplicialIntersection = typename IntersectionListProvider::\n SimplicialIntersection;\n- 72\n- 77 void computeIntersections(const Dune::GeometryType& grid1ElementType,\n- 78 const std::vector >& grid1ElementCorners,\n- 79 std::bitset<(1<& neighborIntersects1,\n- 80 unsigned int grid1Index,\n- 81 const Dune::GeometryType& grid2ElementType,\n- 82 const std::vector >& grid2ElementCorners,\n- 83 std::bitset<(1<& neighborIntersects2,\n- 84 unsigned int grid2Index,\n- 85 std::vector& intersections);\n- 86\n- 87public:\n- 88\n-89 static constexpr T default_tolerance = 1e-4;\n- 90\n-91 ConformingMerge(T tolerance = default_tolerance) :\n- 92 tolerance_(tolerance)\n- 93 {}\n- 94};\n- 95\n- 96template\n- 97constexpr T ConformingMerge::default_tolerance;\n- 98\n- 99template\n- 100void ConformingMerge::computeIntersections(const Dune::\n-GeometryType& grid1ElementType,\n- 101 const std::vector >& grid1ElementCorners,\n- 102 std::bitset<(1<& neighborIntersects1,\n- 103 unsigned int grid1Index,\n- 104 const Dune::GeometryType& grid2ElementType,\n- 105 const std::vector >& grid2ElementCorners,\n- 106 std::bitset<(1<& neighborIntersects2,\n- 107 unsigned int grid2Index,\n- 108 std::vector& intersections)\n- 109{\n- 110 this->counter++;\n- 111\n- 112 // A few consistency checks\n- 113 assert((unsigned int)(Dune::ReferenceElements::general\n-(grid1ElementType).size(dim)) == grid1ElementCorners.size());\n- 114 assert((unsigned int)(Dune::ReferenceElements::general\n-(grid2ElementType).size(dim)) == grid2ElementCorners.size());\n- 115 // any intersection we may find will be the entire elements.\n- 116 neighborIntersects1.reset();\n- 117 neighborIntersects2.reset();\n- 118\n- 119 // the intersection is either conforming or empty, hence the GeometryTypes\n-have to match\n- 120 if (grid1ElementType != grid2ElementType)\n- 121 return;\n+84 using RemoteSimplicialIntersection = SimplicialIntersection;\n+ 85\n+86 bool valid = false;\n+ 87\n+88 StandardMerge()\n+ 89 : intersectionListProvider_(std::make_shared())\n+ 90 , intersectionList_(std::make_shared\n+(intersectionListProvider_))\n+ 91 {}\n+ 92\n+93 virtual ~StandardMerge() = default;\n+ 94\n+99 virtual void computeIntersections(const Dune::GeometryType&\n+grid1ElementType,\n+ 100 const std::vector >& grid1ElementCorners,\n+ 101 std::bitset<(1<& neighborIntersects1,\n+ 102 unsigned int grid1Index,\n+ 103 const Dune::GeometryType& grid2ElementType,\n+ 104 const std::vector >& grid2ElementCorners,\n+ 105 std::bitset<(1<& neighborIntersects2,\n+ 106 unsigned int grid2Index,\n+ 107 std::vector& intersections) = 0;\n+ 108\n+112 bool computeIntersection(unsigned int candidate0, unsigned int candidate1,\n+ 113 const std::vector >& grid1Coords,\n+ 114 const std::vector& grid1_element_types,\n+ 115 std::bitset<(1<& neighborIntersects1,\n+ 116 const std::vector >& grid2Coords,\n+ 117 const std::vector& grid2_element_types,\n+ 118 std::bitset<(1<& neighborIntersects2,\n+ 119 bool insert = true);\n+ 120\n+ 121 /* M E M B E R V A R I A B L E S */\n 122\n- 123 // ////////////////////////////////////////////////////////////\n- 124 // Find correspondences between the different corners\n- 125 // ////////////////////////////////////////////////////////////\n- 126 std::vector other(grid1ElementCorners.size(), -1);\n- 127\n- 128 for (unsigned int i=0; i intersectionListProvider_;\n+124 std::shared_ptr intersectionList_;\n+ 125\n+127 std::vector > grid1ElementCorners_;\n+128 std::vector > grid2ElementCorners_;\n 129\n- 130 for (unsigned int j=0; j > elementNeighbors1_;\n+131 std::vector > elementNeighbors2_;\n+ 132\n+ 133public:\n+ 134\n+ 135 /* C O N C E P T I M P L E M E N T I N G I N T E R F A C E */\n 136\n- 137 }\n- 138\n- 139 }\n- 140\n- 141 // No corresponding grid2 vertex found for this grid1 vertex\n- 142 if (other[i] == -1)\n- 143 return;\n- 144\n- 145 }\n+140 void build(const std::vector >& grid1_Coords,\n+ 141 const std::vector& grid1_elements,\n+ 142 const std::vector& grid1_element_types,\n+ 143 const std::vector >& grid2_coords,\n+ 144 const std::vector& grid2_elements,\n+ 145 const std::vector& grid2_element_types) override;\n 146\n- 147 // ////////////////////////////////////////////////////////////\n- 148 // Set up the new remote intersection\n- 149 // ////////////////////////////////////////////////////////////\n- 150\n- 151 const auto& refElement = Dune::ReferenceElements::general\n-(grid1ElementType);\n- 152\n- 154 if (grid1ElementType.isSimplex()) {\n- 155\n- 156 intersections.emplace_back(grid1Index, grid2Index);\n- 157\n- 158 for (int i=0; iclear();\n+ 154 purge(grid1ElementCorners_);\n+ 155 purge(grid2ElementCorners_);\n+ 156\n+ 157 valid = false;\n+ 158 }\n+ 159\n+160 std::shared_ptr intersectionList() const final\n+ 161 {\n+ 162 assert(valid);\n+ 163 return intersectionList_;\n+ 164 }\n+ 165\n+166 void enableFallback(bool fallback)\n+ 167 {\n+ 168 m_enableFallback = fallback;\n+ 169 }\n+ 170\n+171 void enableBruteForce(bool bruteForce)\n+ 172 {\n+ 173 m_enableBruteForce = bruteForce;\n+ 174 }\n+ 175\n+ 176private:\n+ 180 bool m_enableFallback = false;\n+ 181\n+ 185 bool m_enableBruteForce = false;\n 186\n- 187 for (int i=0; i<5; i++) {\n- 188\n- 189 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index);\n- 190\n- 191 for (int j=0; jintersections(); }\n+ 189\n+ 191 template\n+ 192 static void purge(V & v)\n+ 193 {\n+ 194 v.clear();\n+ 195 V v2(v);\n+ 196 v.swap(v2);\n+ 197 }\n+ 198\n+ 203 void generateSeed(std::vector& seeds,\n+ 204 Dune::BitSetVector<1>& isHandled2,\n+ 205 std::stack& candidates2,\n+ 206 const std::vector >& grid1Coords,\n+ 207 const std::vector& grid1_element_types,\n+ 208 const std::vector >& grid2Coords,\n+ 209 const std::vector& grid2_element_types);\n+ 210\n+ 214 int insertIntersections(unsigned int candidate1, unsigned int\n+candidate2,std::vector& intersections);\n+ 215\n+ 219 int bruteForceSearch(int candidate1,\n+ 220 const std::vector >& grid1Coords,\n+ 221 const std::vector& grid1_element_types,\n+ 222 const std::vector >& grid2Coords,\n+ 223 const std::vector& grid2_element_types);\n+ 224\n+ 228 std::pair\n+ 229 intersectionIndex(unsigned int grid1Index, unsigned int grid2Index,\n+ 230 SimplicialIntersection& intersection);\n+ 231\n+ 235 template \n+ 236 void computeNeighborsPerElement(const std::vector&\n+gridElementTypes,\n+ 237 const std::vector >& gridElementCorners,\n+ 238 std::vector >& elementNeighbors);\n+ 239\n+ 240 void buildAdvancingFront(\n+ 241 const std::vector >& grid1_Coords,\n+ 242 const std::vector& grid1_elements,\n+ 243 const std::vector& grid1_element_types,\n+ 244 const std::vector >& grid2_coords,\n+ 245 const std::vector& grid2_elements,\n+ 246 const std::vector& grid2_element_types\n+ 247 );\n+ 248\n+ 249 void buildBruteForce(\n+ 250 const std::vector >& grid1_Coords,\n+ 251 const std::vector& grid1_elements,\n+ 252 const std::vector& grid1_element_types,\n+ 253 const std::vector >& grid2_coords,\n+ 254 const std::vector& grid2_elements,\n+ 255 const std::vector& grid2_element_types\n+ 256 );\n+ 257};\n+ 258\n+ 259\n+ 260/* IMPLEMENTATION */\n+ 261\n+ 262template\n+263bool StandardMerge::computeIntersection\n+(unsigned int candidate0, unsigned int candidate1,\n+ 264 const std::vector >& grid1Coords,\n+ 265 const std::vector& grid1_element_types,\n+ 266 std::bitset<(1<& neighborIntersects1,\n+ 267 const std::vector >& grid2Coords,\n+ 268 const std::vector& grid2_element_types,\n+ 269 std::bitset<(1<& neighborIntersects2,\n+ 270 bool insert)\n+ 271{\n+ 272 // Select vertices of the grid1 element\n+ 273 int grid1NumVertices = grid1ElementCorners_[candidate0].size();\n+ 274 std::vector > grid1ElementCorners\n+(grid1NumVertices);\n+ 275 for (int i=0; i > grid2ElementCorners\n+(grid2NumVertices);\n+ 281 for (int i=0; i intersections(0);\n+ 289\n+ 290 // compute the intersections\n+ 291 computeIntersections(grid1_element_types[candidate0], grid1ElementCorners,\n+ 292 neighborIntersects1, candidate0,\n+ 293 grid2_element_types[candidate1], grid2ElementCorners,\n+ 294 neighborIntersects2, candidate1,\n+ 295 intersections);\n+ 296\n+ 297 // insert intersections if needed\n+ 298 if(insert && !intersections.empty())\n+ 299 insertIntersections(candidate0,candidate1,intersections);\n+ 300\n+ 301 // Have we found an intersection?\n+ 302 return !intersections.empty() || neighborIntersects1.any() ||\n+neighborIntersects2.any();\n+ 303\n+ 304}\n+ 305\n+ 306template\n+ 307int StandardMerge::bruteForceSearch(int\n+candidate1,\n+ 308 const std::vector >& grid1Coords,\n+ 309 const std::vector& grid1_element_types,\n+ 310 const std::vector >& grid2Coords,\n+ 311 const std::vector& grid2_element_types)\n+ 312{\n+ 313 std::bitset<(1< neighborIntersects1;\n+ 314 std::bitset<(1< neighborIntersects2;\n+ 315 for (std::size_t i=0; i\n+ 333template\n+ 334void StandardMerge::\n+ 335computeNeighborsPerElement(const std::vector&\n+gridElementTypes,\n+ 336 const std::vector >& gridElementCorners,\n+ 337 std::vector >& elementNeighbors)\n+ 338{\n+ 339 typedef std::vector FaceType;\n+ 340 typedef std::map >\n+FaceSetType;\n+ 341\n+ 343 // First: grid 1\n+ 345 FaceSetType faces;\n+ 346 elementNeighbors.resize(gridElementTypes.size());\n+ 347\n+ 348 for (size_t i=0; i::general\n+(gridElementTypes[i]).size(1), -1);\n+ 350\n+ 351 for (size_t i=0; i::general\n+(gridElementTypes[i]);\n+ 353\n+ 354 for (size_t j=0; j<(size_t)refElement.size(1); j++) { // iterate over all\n+faces of the element\n+ 355\n+ 356 FaceType face;\n+ 357 // extract element face\n+ 358 for (size_t k=0; k<(size_t)refElement.size(j,1,gridDim); k++)\n+ 359 face.push_back(gridElementCorners[i][refElement.subEntity\n+(j,1,k,gridDim)]);\n+ 360\n+ 361 // sort the face vertices to get rid of twists and other permutations\n+ 362 std::sort(face.begin(), face.end());\n+ 363\n+ 364 typename FaceSetType::iterator faceHandle = faces.find(face);\n+ 365\n+ 366 if (faceHandle == faces.end()) {\n+ 367\n+ 368 // face has not been visited before\n+ 369 faces.insert(std::make_pair(face, std::make_pair(i,j)));\n+ 370\n+ 371 } else {\n+ 372\n+ 373 // face has been visited before: store the mutual neighbor information\n+ 374 elementNeighbors[i][j] = faceHandle->second.first;\n+ 375 elementNeighbors[faceHandle->second.first][faceHandle->second.second] = i;\n+ 376\n+ 377 faces.erase(faceHandle);\n+ 378\n+ 379 }\n+ 380\n+ 381 }\n+ 382\n+ 383 }\n+ 384}\n+ 385\n+ 386// /////////////////////////////////////////////////////////////////////\n+ 387// Compute the intersection of all pairs of elements\n+ 388// Linear algorithm by Gander and Japhet, Proc. of DD18\n+ 389// /////////////////////////////////////////////////////////////////////\n+ 390\n+ 391template\n+392void StandardMerge::build(const std::\n+vector >& grid1Coords,\n+ 393 const std::vector& grid1_elements,\n+ 394 const std::vector& grid1_element_types,\n+ 395 const std::vector >& grid2Coords,\n+ 396 const std::vector& grid2_elements,\n+ 397 const std::vector& grid2_element_types\n+ 398 )\n+ 399{\n+ 400\n+ 401 std::cout << \"StandardMerge building merged grid...\" << std::endl;\n+ 402 Dune::Timer watch;\n+ 403\n+ 404 clear();\n+ 405 // clear global intersection list\n+ 406 intersectionListProvider_->clear();\n+ 407 this->counter = 0;\n+ 408\n+ 409 // /////////////////////////////////////////////////////////////////////\n+ 410 // Copy element corners into a data structure with block-structure.\n+ 411 // This is not as efficient but a lot easier to use.\n+ 412 // We may think about efficiency later.\n+ 413 // /////////////////////////////////////////////////////////////////////\n+ 414\n+ 415 // first the grid1 side\n+ 416 grid1ElementCorners_.resize(grid1_element_types.size());\n+ 417\n+ 418 unsigned int grid1CornerCounter = 0;\n+ 419\n+ 420 for (std::size_t i=0; i::general\n+(grid1_element_types[i]).size(grid1Dim);\n+ 424 grid1ElementCorners_[i].resize(numVertices);\n+ 425 for (int j=0; j::general\n+(grid2_element_types[i]).size(grid2Dim);\n+ 439 grid2ElementCorners_[i].resize(numVertices);\n+ 440 for (int j=0; j(grid1_element_types,\n+grid1ElementCorners_, elementNeighbors1_);\n+ 450 computeNeighborsPerElement(grid2_element_types,\n+grid2ElementCorners_, elementNeighbors2_);\n+ 451\n+ 452 std::cout << \"setup took \" << watch.elapsed() << \" seconds.\" << std::endl;\n+ 453\n+ 454 if (m_enableBruteForce)\n+ 455 buildBruteForce(grid1Coords, grid1_elements, grid1_element_types,\n+grid2Coords, grid2_elements, grid2_element_types);\n+ 456 else\n+ 457 buildAdvancingFront(grid1Coords, grid1_elements, grid1_element_types,\n+grid2Coords, grid2_elements, grid2_element_types);\n+ 458\n+ 459 valid = true;\n+ 460 std::cout << \"intersection construction took \" << watch.elapsed() << \"\n+seconds.\" << std::endl;\n+ 461}\n+ 462\n+ 463template\n+ 464void StandardMerge::buildAdvancingFront(\n+ 465 const std::vector >& grid1Coords,\n+ 466 const std::vector& grid1_elements,\n+ 467 const std::vector& grid1_element_types,\n+ 468 const std::vector >& grid2Coords,\n+ 469 const std::vector& grid2_elements,\n+ 470 const std::vector& grid2_element_types\n+ 471 )\n+ 472{\n+ 474 // Data structures for the advancing-front algorithm\n+ 476\n+ 477 std::stack candidates1;\n+ 478 std::stack candidates2;\n+ 479\n+ 480 std::vector seeds(grid2_element_types.size(), -1);\n+ 481\n+ 482 // /////////////////////////////////////////////////////////////////////\n+ 483 // Do a brute-force search to find one pair of intersecting elements\n+ 484 // to start the advancing-front type algorithm with.\n+ 485 // /////////////////////////////////////////////////////////////////////\n+ 486\n+ 487 // Set flag if element has been handled\n+ 488 Dune::BitSetVector<1> isHandled2(grid2_element_types.size());\n+ 489\n+ 490 // Set flag if the element has been entered in the queue\n+ 491 Dune::BitSetVector<1> isCandidate2(grid2_element_types.size());\n+ 492\n+ 493 generateSeed(seeds, isHandled2, candidates2, grid1Coords,\n+grid1_element_types, grid2Coords, grid2_element_types);\n+ 494\n+ 495 // /////////////////////////////////////////////////////////////////////\n+ 496 // Main loop\n+ 497 // /////////////////////////////////////////////////////////////////////\n+ 498\n+ 499 std::set isHandled1;\n+ 500\n+ 501 std::set isCandidate1;\n+ 502\n+ 503 while (!candidates2.empty()) {\n+ 504\n+ 505 // Get the next element on the grid2 side\n+ 506 unsigned int currentCandidate2 = candidates2.top();\n+ 507 int seed = seeds[currentCandidate2];\n+ 508 assert(seed >= 0);\n+ 509\n+ 510 candidates2.pop();\n+ 511 isHandled2[currentCandidate2] = true;\n+ 512\n+ 513 // Start advancing front algorithm on the grid1 side from the 'seed'\n+element that\n+ 514 // we stored along with the current grid2 element\n+ 515 candidates1.push(seed);\n+ 516\n+ 517 isHandled1.clear();\n+ 518 isCandidate1.clear();\n+ 519\n+ 520 while (!candidates1.empty()) {\n+ 521\n+ 522 unsigned int currentCandidate1 = candidates1.top();\n+ 523 candidates1.pop();\n+ 524 isHandled1.insert(currentCandidate1);\n+ 525\n+ 526 // Test whether there is an intersection between currentCandidate0 and\n+currentCandidate1\n+ 527 std::bitset<(1< neighborIntersects1;\n+ 528 std::bitset<(1< neighborIntersects2;\n+ 529 bool intersectionFound = computeIntersection(currentCandidate1,\n+currentCandidate2,\n+ 530 grid1Coords,grid1_element_types, neighborIntersects1,\n+ 531 grid2Coords,grid2_element_types, neighborIntersects2);\n+ 532\n+ 533 for (size_t i=0; i-1) {\n+ 574\n+ 575 isCandidate2[neighbor][0] = true;\n+ 576 candidates2.push(neighbor);\n+ 577 seedFound = true;\n+ 578 }\n+ 579 }\n+ 580\n+ 581 if (seedFound || !m_enableFallback)\n+ 582 continue;\n+ 583\n+ 584 // There is no neighbor with a seed, so we need to be a bit more\n+aggressive...\n+ 585 // get all neighbors of currentCandidate2, but not currentCandidate2\n+itself\n+ 586 for (size_t i=0; i::iterator seedIt = isHandled1.begin\n+();\n+ 601 seedIt != isHandled1.end(); ++seedIt) {\n+ 602\n+ 603 std::bitset<(1< neighborIntersects1;\n+ 604 std::bitset<(1< neighborIntersects2;\n+ 605 bool intersectionFound = computeIntersection(*seedIt, neighbor,\n+ 606 grid1Coords, grid1_element_types, neighborIntersects1,\n+ 607 grid2Coords, grid2_element_types, neighborIntersects2,\n+ 608 false);\n+ 609\n+ 610 // if the intersection is nonempty, *seedIt is our new seed candidate on\n+the grid1 side\n+ 611 if (intersectionFound) {\n+ 612 seed = *seedIt;\n+ 613 Dune::dwarn << \"Algorithm entered first fallback method and found a new\n+seed in the build algorithm.\" <<\n+ 614 \"Probably, the neighborIntersects bitsets computed in computeIntersection\n+specialization is wrong.\" << std::endl;\n+ 615 break;\n+ 616 }\n+ 617\n+ 618 }\n+ 619\n+ 620 if (seed < 0) {\n+ 621 // The fast method didn't find a grid1 element that intersects with\n+ 622 // the new grid2 candidate. We have to do a brute-force search.\n+ 623 seed = bruteForceSearch(neighbor,\n+ 624 grid1Coords,grid1_element_types,\n+ 625 grid2Coords,grid2_element_types);\n+ 626 Dune::dwarn << \"Algorithm entered second fallback method. This probably\n+should not happen.\" << std::endl;\n+ 627\n+ 628 }\n+ 629\n+ 630 // We have tried all we could: the candidate is 'handled' now\n+ 631 isCandidate2[neighbor] = true;\n+ 632\n+ 633 // still no seed? Then the new grid2 candidate isn't overlapped by\n+anything\n+ 634 if (seed < 0)\n+ 635 continue;\n+ 636\n+ 637 // we have a seed now\n+ 638 candidates2.push(neighbor);\n+ 639 seeds[neighbor] = seed;\n+ 640 seedFound = true;\n+ 641\n+ 642 }\n+ 643\n+ 644 }\n+ 645\n+ 646 /* Do a brute-force search if there is still no seed:\n+ 647 * There might still be a disconnected region out there.\n+ 648 */\n+ 649 if (!seedFound && candidates2.empty()) {\n+ 650 generateSeed(seeds, isHandled2, candidates2, grid1Coords,\n+grid1_element_types, grid2Coords, grid2_element_types);\n+ 651 }\n+ 652 }\n+ 653}\n+ 654\n+ 655template\n+ 656void StandardMerge::buildBruteForce(\n+ 657 const std::vector >& grid1Coords,\n+ 658 const std::vector& grid1_elements,\n+ 659 const std::vector& grid1_element_types,\n+ 660 const std::vector >& grid2Coords,\n+ 661 const std::vector& grid2_elements,\n+ 662 const std::vector& grid2_element_types\n+ 663 )\n+ 664{\n+ 665 std::bitset<(1< neighborIntersects1;\n+ 666 std::bitset<(1< neighborIntersects2;\n+ 667\n+ 668 for (unsigned i = 0; i < grid1_element_types.size(); ++i) {\n+ 669 for (unsigned j = 0; j < grid2_element_types.size(); ++j) {\n+ 670 (void) computeIntersection(i, j,\n+ 671 grid1Coords, grid1_element_types, neighborIntersects1,\n+ 672 grid2Coords, grid2_element_types, neighborIntersects2);\n+ 673 }\n+ 674 }\n+ 675}\n+ 676\n+ 677template\n+ 678void StandardMerge::generateSeed(std::\n+vector& seeds, Dune::BitSetVector<1>& isHandled2, std::stack&\n+candidates2, const std::vector >& grid1Coords,\n+const std::vector& grid1_element_types, const std::\n+vector >& grid2Coords, const std::vector& grid2_element_types)\n+ 679{\n+ 680 for (std::size_t j=0; j 0 || isHandled2[j][0])\n+ 683 continue;\n+ 684\n+ 685 int seed = bruteForceSearch\n+(j,grid1Coords,grid1_element_types,grid2Coords,grid2_element_types);\n+ 686\n+ 687 if (seed >= 0) {\n+ 688 candidates2.push(j); // the candidate and a seed for the candidate\n+ 689 seeds[j] = seed;\n+ 690 break;\n+ 691 } else // If the brute force search did not find any intersection we can\n+skip this element\n+ 692 isHandled2[j] = true;\n+ 693 }\n+ 694}\n+ 695\n+ 696template\n+ 697int StandardMerge::insertIntersections\n+(unsigned int candidate1, unsigned int candidate2,\n+ 698 std::vector& intersections)\n+ 699{\n+ 700 typedef typename std::vector::size_type size_t;\n+ 701 int count = 0;\n+ 702\n+ 703 for (size_t i = 0; i < intersections.size(); ++i) {\n+ 704 // get the intersection index of the current intersection from\n+intersections in this->intersections\n+ 705 bool found;\n+ 706 unsigned int index;\n+ 707 std::tie(found, index) = intersectionIndex\n+(candidate1,candidate2,intersections[i]);\n+ 708\n+ 709 if (found && index >= this->intersections().size()) { //the intersection\n+is not yet contained in this->intersections\n+ 710 this->intersections().push_back(intersections[i]); // insert\n+ 711\n+ 712 ++count;\n+ 713 } else if (found) {\n+ 714 auto& intersection = this->intersections()[index];\n+ 715\n+ 716 // insert each grid1 element and local representation of intersections[i]\n+with parent candidate1\n+ 717 for (size_t j = 0; j < intersections[i].parents0.size(); ++j) {\n+ 718 intersection.parents0.push_back(candidate1);\n+ 719 intersection.corners0.push_back(intersections[i].corners0[j]);\n+ 720 }\n+ 721\n+ 722 // insert each grid2 element and local representation of intersections[i]\n+with parent candidate2\n+ 723 for (size_t j = 0; j < intersections[i].parents1.size(); ++j) {\n+ 724 intersection.parents1.push_back(candidate2);\n+ 725 intersection.corners1.push_back(intersections[i].corners1[j]);\n+ 726 }\n+ 727\n+ 728 ++count;\n+ 729 } else {\n+ 730 Dune::dwarn << \"Computed the same intersection twice!\" << std::endl;\n+ 731 }\n+ 732 }\n+ 733 return count;\n+ 734}\n+ 735\n+ 736template\n+ 737std::pair\n+ 738StandardMerge::intersectionIndex(unsigned int\n+grid1Index, unsigned int grid2Index,\n+ 739 SimplicialIntersection& intersection) {\n+ 740\n+ 741\n+ 742 // return index in intersections_ if at least one local representation of\n+a Simplicial Intersection (SI)\n+ 743 // of intersections_ is equal to the local representation of one element\n+in intersections\n+ 744\n+ 745 std::size_t n_intersections = this->intersections().size();\n+ 746 if (grid1Dim == grid2Dim)\n+ 747 return {true, n_intersections};\n+ 748\n+ 749 T eps = 1e-10;\n+ 750\n+ 751 for (std::size_t i = 0; i < n_intersections; ++i) {\n+ 752\n+ 753 // compare the local representation of the subelements of the SI\n+ 754 for (std::size_t ei = 0; ei < this->intersections()[i].parents0.size();\n+++ei) // merger subelement\n+ 755 {\n+ 756 if (this->intersections()[i].parents0[ei] == grid1Index)\n+ 757 {\n+ 758 for (std::size_t er = 0; er < intersection.parents0.size(); ++er) // list\n+subelement\n+ 759 {\n+ 760 bool found_all = true;\n+ 761 // compare the local coordinate representations\n+ 762 for (std::size_t ci = 0; ci < this->intersections()[i].corners0[ei].size\n+(); ++ci)\n+ 763 {\n+ 764 Dune::FieldVector ni = this->intersections()[i].corners0[ei]\n+[ci];\n+ 765 bool found_ni = false;\n+ 766 for (std::size_t cr = 0; cr < intersection.corners0[er].size(); ++cr)\n+ 767 {\n+ 768 Dune::FieldVector nr = intersection.corners0[er][cr];\n+ 769\n+ 770 found_ni = found_ni || ((ni-nr).infinity_norm() < eps);\n+ 771 if (found_ni)\n+ 772 break;\n+ 773 }\n+ 774 found_all = found_all && found_ni;\n+ 775\n+ 776 if (!found_ni)\n+ 777 break;\n+ 778 }\n+ 779\n+ 780 if (found_all && (this->intersections()[i].parents1[ei] != grid2Index))\n+ 781 return {true, i};\n+ 782 else if (found_all)\n+ 783 return {false, 0};\n+ 784 }\n+ 785 }\n+ 786 }\n+ 787\n+ 788 // compare the local representation of the subelements of the SI\n+ 789 for (std::size_t ei = 0; ei < this->intersections()[i].parents1.size();\n+++ei) // merger subelement\n+ 790 {\n+ 791 if (this->intersections()[i].parents1[ei] == grid2Index)\n+ 792 {\n+ 793 for (std::size_t er = 0; er < intersection.parents1.size(); ++er) // list\n+subelement\n+ 794 {\n+ 795 bool found_all = true;\n+ 796 // compare the local coordinate representations\n+ 797 for (std::size_t ci = 0; ci < this->intersections()[i].corners1[ei].size\n+(); ++ci)\n+ 798 {\n+ 799 Dune::FieldVector ni = this->intersections()[i].corners1[ei]\n+[ci];\n+ 800 bool found_ni = false;\n+ 801 for (std::size_t cr = 0; cr < intersection.corners1[er].size(); ++cr)\n+ 802 {\n+ 803 Dune::FieldVector nr = intersection.corners1[er][cr];\n+ 804 found_ni = found_ni || ((ni-nr).infinity_norm() < eps);\n+ 805\n+ 806 if (found_ni)\n+ 807 break;\n+ 808 }\n+ 809 found_all = found_all && found_ni;\n+ 810\n+ 811 if (!found_ni)\n+ 812 break;\n+ 813 }\n+ 814\n+ 815 if (found_all && (this->intersections()[i].parents0[ei] != grid1Index))\n+ 816 return {true, i};\n+ 817 else if (found_all)\n+ 818 return {false, 0};\n+ 819 }\n+ 820 }\n+ 821 }\n+ 822 }\n+ 823\n+ 824 return {true, n_intersections};\n+ 825}\n+ 826\n+827#define DECL extern\n+828#define STANDARD_MERGE_INSTANTIATE(T,A,B,C) \\\n+ 829 DECL template \\\n+ 830 void StandardMerge::build(const std::vector >& grid1Coords, \\\n+ 831 const std::vector& grid1_elements, \\\n+ 832 const std::vector& grid1_element_types, \\\n+ 833 const std::vector >& grid2Coords, \\\n+ 834 const std::vector& grid2_elements, \\\n+ 835 const std::vector& grid2_element_types \\\n+ 836 )\n+ 837\n+ 838STANDARD_MERGE_INSTANTIATE(double,1,1,1);\n+ 839STANDARD_MERGE_INSTANTIATE(double,2,2,2);\n+ 840STANDARD_MERGE_INSTANTIATE(double,3,3,3);\n+ 841#undef STANDARD_MERGE_INSTANTIATE\n+ 842#undef DECL\n+ 843\n+ 844} /* namespace GridGlue */\n+ 845} /* namespace Dune */\n+ 846\n+ 847#endif // DUNE_GRIDGLUE_MERGING_STANDARDMERGE_HH\n+merger.hh\n+computeintersection.hh\n+intersectionlist.hh\n Dune\n Definition: gridglue.hh:37\n+Dune::GridGlue::STANDARD_MERGE_INSTANTIATE\n+STANDARD_MERGE_INSTANTIATE(double, 1, 1, 1)\n Dune::GridGlue::intersections\n IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<...\n > &reverse=!reversed)\n Iterate over all intersections of a GridGlue.\n-Dune::GridGlue::ConformingMerge\n-Implementation of the Merger concept for conforming interfaces.\n-Definition: conformingmerge.hh:49\n-Dune::GridGlue::ConformingMerge::LocalCoords\n-Dune::FieldVector< T, dim > LocalCoords\n-the coordinate type used in this interface\n-Definition: conformingmerge.hh:62\n-Dune::GridGlue::ConformingMerge::WorldCoords\n+Dune::GridGlue::SimplicialIntersectionListProvider\n+Definition: intersectionlist.hh:207\n+Dune::GridGlue::SimplicialIntersectionListProvider::SimplicialIntersection\n+Definition: intersectionlist.hh:222\n+Dune::GridGlue::Merger\n+Abstract base for all classes that take extracted grids and build sets of\n+intersections.\n+Definition: merger.hh:27\n+Dune::GridGlue::Merger<_T,_grid1Dim,_grid2Dim,_dimworld_>::WorldCoords\n Dune::FieldVector< T, dimworld > WorldCoords\n the coordinate type used in this interface\n-Definition: conformingmerge.hh:59\n-Dune::GridGlue::ConformingMerge::default_tolerance\n-static constexpr T default_tolerance\n-Definition: conformingmerge.hh:89\n-Dune::GridGlue::ConformingMerge::ctype\n-T ctype\n-the numeric type used in this interface\n-Definition: conformingmerge.hh:56\n-Dune::GridGlue::ConformingMerge::ConformingMerge\n-ConformingMerge(T tolerance=default_tolerance)\n-Definition: conformingmerge.hh:91\n+Definition: merger.hh:37\n+Dune::GridGlue::Merger<_T,_grid1Dim,_grid2Dim,_dimworld_>::IntersectionList\n+Dune::GridGlue::IntersectionList< Grid1Coords, Grid2Coords > IntersectionList\n+Definition: merger.hh:39\n+Dune::GridGlue::Merger<_T,_grid1Dim,_grid2Dim,_dimworld_>::Grid1Coords\n+Dune::FieldVector< T, grid1Dim > Grid1Coords\n+the local coordinate type for the grid1 coordinates\n+Definition: merger.hh:31\n+Dune::GridGlue::Merger<_T,_grid1Dim,_grid2Dim,_dimworld_>::Grid2Coords\n+Dune::FieldVector< T, grid2Dim > Grid2Coords\n+the local coordinate type for the grid2 coordinates\n+Definition: merger.hh:34\n Dune::GridGlue::StandardMerge\n Common base class for many merger implementations: produce pairs of entities\n that may intersect.\n Definition: standardmerge.hh:58\n+Dune::GridGlue::StandardMerge::computeIntersections\n+virtual void computeIntersections(const Dune::GeometryType &grid1ElementType,\n+const std::vector< Dune::FieldVector< T, dimworld > > &grid1ElementCorners,\n+std::bitset<(1<< grid1Dim)> &neighborIntersects1, unsigned int grid1Index,\n+const Dune::GeometryType &grid2ElementType, const std::vector< Dune::\n+FieldVector< T, dimworld > > &grid2ElementCorners, std::bitset<(1<< grid2Dim)>\n+&neighborIntersects2, unsigned int grid2Index, std::vector<\n+SimplicialIntersection > &intersections)=0\n+Compute the intersection between two overlapping elements.\n+Dune::GridGlue::StandardMerge::intersectionList_\n+std::shared_ptr< IntersectionList > intersectionList_\n+Definition: standardmerge.hh:124\n+Dune::GridGlue::StandardMerge::Grid1Coords\n+typename Base::Grid1Coords Grid1Coords\n+Type used for local coordinates on the grid1 side.\n+Definition: standardmerge.hh:69\n+Dune::GridGlue::StandardMerge::enableFallback\n+void enableFallback(bool fallback)\n+Definition: standardmerge.hh:166\n+Dune::GridGlue::StandardMerge::elementNeighbors2_\n+std::vector< std::vector< int > > elementNeighbors2_\n+Definition: standardmerge.hh:131\n+Dune::GridGlue::StandardMerge::elementNeighbors1_\n+std::vector< std::vector< int > > elementNeighbors1_\n+Definition: standardmerge.hh:130\n+Dune::GridGlue::StandardMerge::ctype\n+T ctype\n+the numeric type used in this interface\n+Definition: standardmerge.hh:66\n+Dune::GridGlue::StandardMerge::clear\n+void clear() override\n+Definition: standardmerge.hh:150\n+Dune::GridGlue::StandardMerge::IntersectionList\n+typename Base::IntersectionList IntersectionList\n+Definition: standardmerge.hh:77\n+Dune::GridGlue::StandardMerge::computeIntersection\n+bool computeIntersection(unsigned int candidate0, unsigned int candidate1,\n+const std::vector< Dune::FieldVector< T, dimworld > > &grid1Coords, const std::\n+vector< Dune::GeometryType > &grid1_element_types, std::bitset<(1<< grid1Dim)>\n+&neighborIntersects1, const std::vector< Dune::FieldVector< T, dimworld > >\n+&grid2Coords, const std::vector< Dune::GeometryType > &grid2_element_types,\n+std::bitset<(1<< grid2Dim)> &neighborIntersects2, bool insert=true)\n+Compute the intersection between two overlapping elements.\n+Definition: standardmerge.hh:263\n+Dune::GridGlue::StandardMerge::enableBruteForce\n+void enableBruteForce(bool bruteForce)\n+Definition: standardmerge.hh:171\n+Dune::GridGlue::StandardMerge::intersectionListProvider_\n+std::shared_ptr< IntersectionListProvider > intersectionListProvider_\n+Definition: standardmerge.hh:123\n+Dune::GridGlue::StandardMerge::build\n+void build(const std::vector< Dune::FieldVector< T, dimworld > > &grid1_Coords,\n+const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::\n+GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< T,\n+dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements,\n+const std::vector< Dune::GeometryType > &grid2_element_types) override\n+builds the merged grid\n+Definition: standardmerge.hh:392\n+Dune::GridGlue::StandardMerge::grid1ElementCorners_\n+std::vector< std::vector< unsigned int > > grid1ElementCorners_\n+Temporary internal data.\n+Definition: standardmerge.hh:127\n+Dune::GridGlue::StandardMerge::grid2ElementCorners_\n+std::vector< std::vector< unsigned int > > grid2ElementCorners_\n+Definition: standardmerge.hh:128\n+Dune::GridGlue::StandardMerge::Grid2Coords\n+typename Base::Grid2Coords Grid2Coords\n+Type used for local coordinates on the grid2 side.\n+Definition: standardmerge.hh:72\n+Dune::GridGlue::StandardMerge::intersectionList\n+std::shared_ptr< IntersectionList > intersectionList() const final\n+Definition: standardmerge.hh:160\n+Dune::GridGlue::StandardMerge::~StandardMerge\n+virtual ~StandardMerge()=default\n+Dune::GridGlue::StandardMerge::RemoteSimplicialIntersection\n+SimplicialIntersection RemoteSimplicialIntersection\n+Definition: standardmerge.hh:84\n+Dune::GridGlue::StandardMerge::valid\n+bool valid\n+Definition: standardmerge.hh:86\n+Dune::GridGlue::StandardMerge::StandardMerge\n+StandardMerge()\n+Definition: standardmerge.hh:88\n Dune::GridGlue::StandardMerge::SimplicialIntersection\n typename IntersectionListProvider::SimplicialIntersection\n SimplicialIntersection\n Definition: standardmerge.hh:83\n+Dune::GridGlue::StandardMerge::WorldCoords\n+typename Base::WorldCoords WorldCoords\n+the coordinate type used in this interface\n+Definition: standardmerge.hh:75\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00101.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00101.html", "unified_diff": "@@ -62,15 +62,15 @@\n \n \n
    \n
    Todo List
    \n
    \n
    \n
    \n-
    Member CheckMPIStatus (A, B)
    \n+
    Member CheckMPIStatus (A, B)
    \n
    Implement MPI Status check with exception handling
    \n
    Class Dune::GridGlue::GridGlue< P0, P1 >
    \n
    adapt member names according to style guide
    \n
    Member Dune::GridGlue::GridGlue< P0, P1 >::communicate (Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > &data, Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const
    \n

    fix mixed communication: seq->par use commSeq, par->seq use commPar

    \n

    \n

    add directed version communicate<FROM,TO, DH,DT>(data,iftype,dir)

    \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00926.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00926.html", "unified_diff": "@@ -1520,16 +1520,16 @@\n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following files:\n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00938.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00938.html", "unified_diff": "@@ -70,15 +70,15 @@\n Public Types |\n Public Member Functions |\n List of all members \n
    Dune::GridGlue::IntersectionIterator< P0, P1, inside, outside > Class Template Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/adapter/intersectioniterator.hh>

    \n+

    #include <dune/grid-glue/adapter/intersectioniterator.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::IntersectionIterator< P0, P1, inside, outside >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -259,15 +259,15 @@\n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following files:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00946.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00946.html", "unified_diff": "@@ -72,15 +72,15 @@\n
    Dune::GridGlue::GridGlueAmiraWriter Class Reference
    \n \n
    \n \n

    Write remote intersections to a AmiraMesh file for debugging purposes. \n More...

    \n \n-

    #include <dune/grid-glue/adapter/gridglueamirawriter.hh>

    \n+

    #include <dune/grid-glue/adapter/gridglueamirawriter.hh>

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

    \n Static Public Member Functions

    template<typename Glue >
    static void write (const Glue &glue, const std::string &path, int appendix=1)
     
    \n@@ -128,15 +128,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00950.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00950.html", "unified_diff": "@@ -69,15 +69,15 @@\n \n
    Dune::GridGlue::GlobalId Struct Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n+

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::GlobalId:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -194,15 +194,15 @@\n \n \n \n \n
    \n
    \n
    The documentation for this struct was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00954.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00954.html", "unified_diff": "@@ -74,15 +74,15 @@\n
    Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > Class Template Reference
    \n \n
    \n \n

    describes the features of a data handle for communication in parallel runs using the GridGlue::communicate methods. \n More...

    \n \n-

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n+

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

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

    \n Public Types

    typedef DataTypeImp DataType
     data type of data to communicate More...
     
    \n@@ -308,15 +308,15 @@\n
    \n
    \n

    how many objects of type DataType have to be sent for a given intersection Note: Both sender and receiver side need to know this size.

    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00958.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00958.html", "unified_diff": "@@ -71,15 +71,15 @@\n Public Member Functions |\n Public Attributes |\n List of all members \n
    Dune::GridGlue::StreamingMessageBuffer< DT > Class Template Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n+

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::StreamingMessageBuffer< DT >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -333,15 +333,15 @@\n \n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00962.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00962.html", "unified_diff": "@@ -72,15 +72,15 @@\n
    Dune::GridGlue::CommunicationOperator< dir > Class Template Reference
    \n \n
    \n \n

    forward gather scatter to user defined CommInfo class \n More...

    \n \n-

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n+

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n \n \n \n \n \n \n@@ -190,15 +190,15 @@\n \n

    \n Static Public Member Functions

    template<class CommInfo >
    static const CommInfo::DataTypegather (const CommInfo &commInfo, size_t i, size_t j=0)
     
    template<class CommInfo >
    \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00966.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00966.html", "unified_diff": "@@ -74,15 +74,15 @@\n
    Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Struct Template Reference
    \n \n
    \n \n

    collects all GridGlue data requried for communication \n More...

    \n \n-

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n+

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n \n \n \n \n \n \n@@ -283,15 +283,15 @@\n \n

    \n Public Types

    typedef DataTypeImp value_type
     
    typedef GG GridGlue
     
    \n
    \n \n
    \n \n
    The documentation for this struct was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00970.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00970.html", "unified_diff": "@@ -73,15 +73,15 @@\n
    Dune::CommPolicy< ::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > > Struct Template Reference
    \n \n
    \n \n

    specialization of the CommPolicy struct, required for the ParallelIndexsets \n More...

    \n \n-

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n+

    #include <dune/grid-glue/adapter/gridgluecommunicate.hh>

    \n \n \n \n \n \n \n@@ -193,15 +193,15 @@\n
    \n \n

    Get the number of objects at an intersection.

    \n \n
    \n \n
    The documentation for this struct was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00986.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00986.html", "unified_diff": "@@ -71,15 +71,15 @@\n Public Member Functions |\n Related Functions |\n List of all members\n
    Dune::GridGlue::Reverse< reverse > Struct Template Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/adapter/rangegenerators.hh>

    \n+

    #include <dune/grid-glue/adapter/rangegenerators.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::Reverse< reverse >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -174,15 +174,15 @@\n

    \n Public Types

    typedef ::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type
     The type of the GridGlueCommInfo. More...
     
    typedef DataTypeImp IndexedType
    \n
    \n

    Static tag representing reversal of in- and outside of intersections.

    \n \n
    \n \n
    The documentation for this struct was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00990.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00990.html", "unified_diff": "@@ -69,15 +69,15 @@\n \n
    Dune::GridGlue::AreaWriterImplementation::FacetLayout< dimgrid > Struct Template Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/common/areawriter_impl.hh>

    \n+

    #include <dune/grid-glue/common/areawriter_impl.hh>

    \n \n \n \n \n

    \n Public Member Functions

    bool contains (Dune::GeometryType gt) const
     
    \n

    Member Function Documentation

    \n@@ -106,15 +106,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this struct was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00994.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00994.html", "unified_diff": "@@ -486,15 +486,15 @@\n

    maximum number of edge-edge intersections

    \n

    See also \\seealso edgeIntersections()

    \n \n \n \n
    The documentation for this class was generated from the following files:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01066.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01066.html", "unified_diff": "@@ -71,15 +71,15 @@\n Static Public Member Functions |\n Static Public Attributes |\n List of all members \n
    Dune::GridGlue::ComputationMethod< dimWorld, dim1, dim2, T > Class Template Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/merging/computeintersection.hh>

    \n+

    #include <dune/grid-glue/merging/computeintersection.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::ComputationMethod< dimWorld, dim1, dim2, T >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -362,15 +362,15 @@\n \n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01070.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01070.html", "unified_diff": "@@ -72,15 +72,15 @@\n
    Dune::GridGlue::IntersectionComputation< CM > Class Template Reference
    \n \n
    \n \n

    Intersection computation method for two elements of arbitrary dimension. \n More...

    \n \n-

    #include <dune/grid-glue/merging/computeintersection.hh>

    \n+

    #include <dune/grid-glue/merging/computeintersection.hh>

    \n \n \n \n \n \n \n@@ -241,16 +241,16 @@\n

    \n Static Public Member Functions

    static bool computeIntersection (const std::vector< V > &X, const std::vector< V > &Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > > &SY, std::vector< V > &P)
     Compute the intersection of two elements X and Y Compute the intersection of two elements X and Y, where X is of dimension dim1 and Y is of dimension dim2 and return a vector P containing the corner points of the intersection polyhedron. More...
     
    template<int isDim, int dW>
    \n \n \n \n
    \n \n
    The documentation for this class was generated from the following files:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01074.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01074.html", "unified_diff": "@@ -78,15 +78,15 @@\n
    Dune::GridGlue::ConformingMerge< dim, dimworld, T > Class Template Referenceabstract
    \n \n
    \n \n

    Implementation of the Merger concept for conforming interfaces. \n More...

    \n \n-

    #include <dune/grid-glue/merging/conformingmerge.hh>

    \n+

    #include <dune/grid-glue/merging/conformingmerge.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::ConformingMerge< dim, dimworld, T >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -1189,15 +1189,15 @@\n \n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01078.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01078.html", "unified_diff": "@@ -77,15 +77,15 @@\n
    Dune::GridGlue::ContactMerge< dimworld, T > Class Template Referenceabstract
    \n \n
    \n \n

    Merge two codimension-1 surfaces that may be a positive distance apart. \n More...

    \n \n-

    #include <dune/grid-glue/merging/contactmerge.hh>

    \n+

    #include <dune/grid-glue/merging/contactmerge.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::ContactMerge< dimworld, T >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -1757,16 +1757,16 @@\n \n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following files:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01082.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01082.html", "unified_diff": "@@ -70,15 +70,15 @@\n Public Types |\n Public Member Functions |\n List of all members \n
    Dune::GridGlue::IntersectionListProvider< L0, L1 > Class Template Referenceabstract
    \n \n
    \n \n-

    #include <dune/grid-glue/merging/intersectionlist.hh>

    \n+

    #include <dune/grid-glue/merging/intersectionlist.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::IntersectionListProvider< L0, L1 >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -481,15 +481,15 @@\n

    number of intersections in the merged grid

    \n \n

    Implemented in Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 >.

    \n \n
    \n
    \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01098.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01098.html", "unified_diff": "@@ -70,15 +70,15 @@\n Public Types |\n Public Member Functions |\n List of all members \n
    Dune::GridGlue::IntersectionList< Local0, Local1 > Class Template Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/merging/intersectionlist.hh>

    \n+

    #include <dune/grid-glue/merging/intersectionlist.hh>

    \n \n \n \n \n \n \n@@ -354,15 +354,15 @@\n

    \n Public Types

    using Provider = IntersectionListProvider< Local0, Local1 >
     
    using Index = typename Provider::Index
     
    \n
    \n

    number of intersections in the merged grid

    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01102.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01102.html", "unified_diff": "@@ -71,15 +71,15 @@\n Public Types |\n Public Member Functions |\n List of all members \n
    Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 > Class Template Referencefinal
    \n \n
    \n \n-

    #include <dune/grid-glue/merging/intersectionlist.hh>

    \n+

    #include <dune/grid-glue/merging/intersectionlist.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -624,15 +624,15 @@\n

    number of intersections in the merged grid

    \n \n

    Implements Dune::GridGlue::IntersectionListProvider< FieldVector< double, dim0 >, FieldVector< double, dim1 > >.

    \n \n
    \n
    \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01106.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01106.html", "unified_diff": "@@ -71,15 +71,15 @@\n Public Member Functions |\n Public Attributes |\n List of all members \n
    Dune::GridGlue::SimplicialIntersectionListProvider< dim0, dim1 >::SimplicialIntersection Struct Reference
    \n \n
    \n \n-

    #include <dune/grid-glue/merging/intersectionlist.hh>

    \n+

    #include <dune/grid-glue/merging/intersectionlist.hh>

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

    \n Public Types

    template<int I>
    using Corners = std::array< Local< I >, nVertices >
     
    \n@@ -256,15 +256,15 @@\n
    \n
    \n

    list of parent entities for embeddings into the second grid

    \n \n
    \n \n
    The documentation for this struct was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01110.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01110.html", "unified_diff": "@@ -74,15 +74,15 @@\n
    Dune::GridGlue::Merger< ctype, grid1Dim, grid2Dim, dimworld > Class Template Referenceabstract
    \n \n
    \n \n

    Abstract base for all classes that take extracted grids and build sets of intersections. \n More...

    \n \n-

    #include <dune/grid-glue/merging/merger.hh>

    \n+

    #include <dune/grid-glue/merging/merger.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::Merger< ctype, grid1Dim, grid2Dim, dimworld >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -557,15 +557,15 @@\n \n

    Counts the number of times the computeIntersection method has been called.

    \n

    Used temporarily to speed up the implementation

    \n \n
    \n
    \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01114.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01114.html", "unified_diff": "@@ -77,15 +77,15 @@\n
    Dune::GridGlue::OverlappingMerge< dim1, dim2, dimworld, T > Class Template Referenceabstract
    \n \n
    \n \n

    Computing overlapping grid intersections for grids of different dimensions. \n More...

    \n \n-

    #include <dune/grid-glue/merging/overlappingmerge.hh>

    \n+

    #include <dune/grid-glue/merging/overlappingmerge.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::OverlappingMerge< dim1, dim2, dimworld, T >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -1262,15 +1262,15 @@\n \n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following files:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01118.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01118.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01122.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01122.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01126.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01126.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01130.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01130.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01134.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01134.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01138.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01138.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01142.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01142.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01146.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01146.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01150.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01150.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01154.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01154.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01158.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01158.html", "unified_diff": "@@ -484,15 +484,15 @@\n \n \n
    \n \n
    \n \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01162.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a01162.html", "unified_diff": "@@ -77,15 +77,15 @@\n
    Dune::GridGlue::StandardMerge< T, grid1Dim, grid2Dim, dimworld > Class Template Referenceabstract
    \n \n
    \n \n

    Common base class for many merger implementations: produce pairs of entities that may intersect. \n More...

    \n \n-

    #include <dune/grid-glue/merging/standardmerge.hh>

    \n+

    #include <dune/grid-glue/merging/standardmerge.hh>

    \n
    \n Inheritance diagram for Dune::GridGlue::StandardMerge< T, grid1Dim, grid2Dim, dimworld >:
    \n
    \n
    \"Inheritance
    \n \n \"\"\n \"\"\n@@ -1136,15 +1136,15 @@\n \n \n
    \n \n
    \n
    \n
    The documentation for this class was generated from the following file:\n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000000_000001.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000000_000001.html", "unified_diff": "@@ -62,14 +62,14 @@\n \n \n \n
    \n-

    adapter → common Relation

    File in dune/grid-glue/adapterIncludes file in dune/grid-glue/common
    gridglue.ccringcomm.hh
    \n+

    adapter → common Relation

    File in dune/grid-glue/adapterIncludes file in dune/grid-glue/common
    gridglue.ccringcomm.hh
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000003_000001.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000003_000001.html", "unified_diff": "@@ -62,14 +62,14 @@\n \n \n \n
    \n-

    extractors → common Relation

    File in dune/grid-glue/extractorsIncludes file in dune/grid-glue/common
    codim1extractor.hhcrossproduct.hh
    \n+

    extractors → common Relation

    File in dune/grid-glue/extractorsIncludes file in dune/grid-glue/common
    codim1extractor.hhcrossproduct.hh
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000004_000000.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000004_000000.html", "unified_diff": "@@ -62,14 +62,14 @@\n \n
    \n \n
    \n \n \n+

    grid-glue → adapter Relation

    File in dune/grid-glueIncludes file in dune/grid-glue/adapter
    gridglue.hhgridglue.cc
    gridglue.hhgridgluecommunicate.hh
    gridglue.hhintersection.hh
    gridglue.hhintersectionindexset.hh
    gridglue.hhintersectioniterator.hh
    gridglue.hhrangegenerators.hh
    extractors / vtksurfacewriter.hhgridgluevtkwriter.hh
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000004_000005.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000004_000005.html", "unified_diff": "@@ -62,14 +62,14 @@\n \n
    \n \n
    \n \n
    \n-

    grid-glue → merging Relation

    File in dune/grid-glueIncludes file in dune/grid-glue/merging
    gridglue.hhmerger.hh
    \n+

    grid-glue → merging Relation

    File in dune/grid-glueIncludes file in dune/grid-glue/merging
    gridglue.hhmerger.hh
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000005_000001.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_000005_000001.html", "unified_diff": "@@ -62,14 +62,14 @@\n \n \n \n
    \n-

    merging → common Relation

    File in dune/grid-glue/mergingIncludes file in dune/grid-glue/common
    contactmerge.cccrossproduct.hh
    contactmerge.ccprojection.hh
    \n+

    merging → common Relation

    File in dune/grid-glue/mergingIncludes file in dune/grid-glue/common
    contactmerge.cccrossproduct.hh
    contactmerge.ccprojection.hh
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_0d8f660a135565b225f6b14e80c278b4.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_0d8f660a135565b225f6b14e80c278b4.html", "unified_diff": "@@ -79,40 +79,40 @@\n \"\"\n \"\"\n
    \n \n \n \n-\n+\n \n-\n+\n \n-\n-\n+\n+\n \n-\n+\n \n-\n-\n+\n+\n \n-\n+\n \n-\n+\n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n-\n+\n+\n \n

    \n Files

    file  computeintersection.cc
    file  computeintersection.cc
     
    file  computeintersection.hh [code]
    file  computeintersection.hh [code]
     
    file  conformingmerge.hh [code]
     Implementation of the Merger concept for conforming interfaces.
    file  conformingmerge.hh [code]
     Implementation of the Merger concept for conforming interfaces.
     
    file  contactmerge.cc
    file  contactmerge.cc
     
    file  contactmerge.hh [code]
     Merge two grid boundary surfaces that may be a positive distance apart.
    file  contactmerge.hh [code]
     Merge two grid boundary surfaces that may be a positive distance apart.
     
    file  intersectionlist.hh [code]
    file  intersectionlist.hh [code]
     
    file  merger.hh [code]
    file  merger.hh [code]
     
    file  overlappingmerge.cc
     
    file  overlappingmerge.hh [code]
    file  overlappingmerge.hh [code]
     
    file  simplexintersection.cc
    file  simplexintersection.cc
     
    file  standardmerge.cc
    file  standardmerge.cc
     
    file  standardmerge.hh [code]
     Common base class for many merger implementations: produce pairs of entities that may intersect.
    file  standardmerge.hh [code]
     Common base class for many merger implementations: produce pairs of entities that may intersect.
     
    \n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_1b444a177590012656060e8a0bca20fc.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_1b444a177590012656060e8a0bca20fc.html", "unified_diff": "@@ -79,36 +79,36 @@\n \"\"\n \"\"\n
    \n \n \n \n-\n+\n \n \n \n-\n-\n+\n+\n \n-\n-\n+\n+\n \n \n \n \n \n \n \n \n \n-\n-\n+\n+\n \n-\n+\n \n

    \n Files

    file  gridglue.cc
    file  gridglue.cc
     
    file  adapter/gridglue.hh [code]
     
    file  gridglueamirawriter.hh [code]
     Write all remote intersections to a AmiraMesh file.
    file  gridglueamirawriter.hh [code]
     Write all remote intersections to a AmiraMesh file.
     
    file  gridgluecommunicate.hh [code]
     Describes the parallel communication interface class for Dune::GridGlue.
    file  gridgluecommunicate.hh [code]
     Describes the parallel communication interface class for Dune::GridGlue.
     
    file  gridgluevtkwriter.hh [code]
     Write all remote intersections to a vtk file for debugging.
     
    file  intersection.hh [code]
     Model of the Intersection concept provided by GridGlue.
     
    file  intersectionindexset.hh [code]
     
    file  intersectioniterator.hh [code]
     Implement iterators over GridGlue intersections.
    file  intersectioniterator.hh [code]
     Implement iterators over GridGlue intersections.
     
    file  rangegenerators.hh [code]
    file  rangegenerators.hh [code]
     
    \n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_65f347cff0208f20f00d27c542208238.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_65f347cff0208f20f00d27c542208238.html", "unified_diff": "@@ -77,29 +77,29 @@\n \"\"\n \"\"\n
    \n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n

    \n Files

    file  areawriter.hh [code]
    file  areawriter.hh [code]
     
    file  areawriter_impl.hh [code]
    file  areawriter_impl.hh [code]
     
    file  crossproduct.hh [code]
    file  crossproduct.hh [code]
     
    file  projection.hh [code]
     
    file  projection_impl.hh [code]
    file  projection_impl.hh [code]
     
    file  projectionwriter.hh [code]
    file  projectionwriter.hh [code]
     
    file  projectionwriter_impl.hh [code]
    file  projectionwriter_impl.hh [code]
     
    file  ringcomm.hh [code]
    file  ringcomm.hh [code]
     
    \n \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz", "unified_diff": null, "details": [{"source1": "dune-grid-glue.tag", "source2": "dune-grid-glue.tag", "unified_diff": null, "details": [{"source1": "dune-grid-glue.tag", "source2": "dune-grid-glue.tag", "unified_diff": "@@ -1,38 +1,38 @@\n \n \n \n gridglue.cc\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/adapter/\n- a00008.html\n+ a00026.html\n intersection.hh\n ../gridglue.hh\n- ../common/ringcomm.hh\n+ ../common/ringcomm.hh\n Dune\n Dune::GridGlue\n \n void\n printVector\n a00104.html\n ac943b51eb586602f1cfd101f30562e10\n (const std::vector< T > &v, std::string name, int rank)\n \n \n \n gridglueamirawriter.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/adapter/\n- a00026.html\n+ a00023.html\n Dune::GridGlue::GridGlueAmiraWriter\n Dune\n Dune::GridGlue\n \n \n gridgluecommunicate.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/adapter/\n- a00017.html\n+ a00005.html\n Dune::GridGlue::GlobalId\n Dune::GridGlue::CommDataHandle\n Dune::GridGlue::StreamingMessageBuffer\n Dune::GridGlue::CommunicationOperator\n Dune::GridGlue::CommInfo\n Dune::CommPolicy< ::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > >\n Dune\n@@ -102,40 +102,40 @@\n Dune::GridGlue::IntersectionIndexSet\n Dune\n Dune::GridGlue\n \n \n intersectioniterator.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/adapter/\n- a00005.html\n+ a00017.html\n dune/grid-glue/gridglue.hh\n Dune::GridGlue::IntersectionIterator\n Dune\n Dune::GridGlue\n \n \n rangegenerators.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/adapter/\n- a00023.html\n+ a00008.html\n Dune::GridGlue::Reverse\n Dune\n Dune::GridGlue\n \n IteratorRange<... >\n intersections\n a00104.html\n ac6a31e555010d279de506e730906a26e\n (const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)\n \n \n \n areawriter.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n- a00035.html\n- areawriter_impl.hh\n+ a00047.html\n+ areawriter_impl.hh\n Dune\n Dune::GridGlue\n \n void\n write_glue_area_vtk\n a00104.html\n a16ccdbde4466d3073eab2a0f25d78f4e\n@@ -155,15 +155,15 @@\n ab4463688255524d5d7433ae6af851884\n (const Glue &glue, const std::string &base)\n \n \n \n areawriter_impl.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n- a00038.html\n+ a00032.html\n Dune::GridGlue::AreaWriterImplementation::FacetLayout\n Dune\n Dune::GridGlue\n Dune::GridGlue::AreaWriterImplementation\n \n void\n write_facet_geometry\n@@ -192,39 +192,39 @@\n ab4463688255524d5d7433ae6af851884\n (const Glue &glue, const std::string &base)\n \n \n \n crossproduct.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n- a00032.html\n+ a00029.html\n Dune\n Dune::GridGlue\n \n static Dune::FieldVector< T, dim >\n crossProduct\n a00104.html\n acbf555ac0358f96454a5f22dd4ac4de2\n (const Dune::FieldVector< T, dim > &a, const Dune::FieldVector< T, dim > &b)\n \n \n \n projection.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n a00041.html\n- projection_impl.hh\n+ projection_impl.hh\n Dune::GridGlue::Projection\n Dune::GridGlue::Projection::EdgeIntersection\n Dune\n Dune::GridGlue\n \n \n projection_impl.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n- a00047.html\n+ a00038.html\n Dune\n Dune::GridGlue\n Dune::GridGlue::ProjectionImplementation\n \n Coordinate\n corner\n a00106.html\n@@ -259,17 +259,17 @@\n a870cd1d1b2cb9d977ceab3032db9dca6\n (const Coordinate &x, const Field &epsilon)\n \n \n \n projectionwriter.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n- a00050.html\n+ a00044.html\n dune/grid-glue/common/projection.hh\n- projectionwriter_impl.hh\n+ projectionwriter_impl.hh\n Dune\n Dune::GridGlue\n \n void\n write\n a00104.html\n a4dcc05f4b64a511b2e9548e371e140a7\n@@ -289,15 +289,15 @@\n ace9cbed627c90927e36d71a65a5498a3\n (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)\n \n \n \n projectionwriter_impl.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n- a00029.html\n+ a00050.html\n Dune\n Dune::GridGlue\n Dune::GridGlue::ProjectionWriterImplementation\n \n void\n write_points\n a00107.html\n@@ -353,21 +353,21 @@\n ace9cbed627c90927e36d71a65a5498a3\n (const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)\n \n \n \n ringcomm.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/common/\n- a00044.html\n+ a00035.html\n Dune\n Dune::Parallel\n \n #define\n CheckMPIStatus\n- a00044.html\n+ a00035.html\n a1a95f4074572a7a9e13bcb072afef070\n (A, B)\n \n \n void\n MPI_AllApply\n a00108.html\n@@ -385,15 +385,15 @@\n Dune::GridGlue\n \n \n codim1extractor.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/extractors/\n a00062.html\n extractor.hh\n- dune/grid-glue/common/crossproduct.hh\n+ dune/grid-glue/common/crossproduct.hh\n Dune::GridGlue::Codim1Extractor\n Dune\n Dune::GridGlue\n \n \n extractor.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/extractors/\n@@ -422,38 +422,38 @@\n a01963.html\n dune/grid-glue/gridglue.hh\n \n \n gridglue.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/\n a00002.html\n- adapter/gridgluecommunicate.hh\n- dune/grid-glue/merging/merger.hh\n- adapter/rangegenerators.hh\n- adapter/gridglue.cc\n+ adapter/gridgluecommunicate.hh\n+ dune/grid-glue/merging/merger.hh\n+ adapter/rangegenerators.hh\n+ adapter/gridglue.cc\n adapter/intersection.hh\n- adapter/intersectioniterator.hh\n+ adapter/intersectioniterator.hh\n adapter/intersectionindexset.hh\n Dune::GridGlue::GridGlue\n Dune\n Dune::GridGlue\n \n \n computeintersection.cc\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00080.html\n+ a00074.html\n Dune\n Dune::GridGlue\n \n \n computeintersection.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00065.html\n- simplexintersection.cc\n- computeintersection.cc\n+ a00077.html\n+ simplexintersection.cc\n+ computeintersection.cc\n Dune::GridGlue::ComputationMethod\n Dune::GridGlue::IntersectionComputation\n Dune\n Dune::GridGlue\n \n int\n insertPoint\n@@ -461,56 +461,56 @@\n a273266aab32afadee15bb5fcf71aa4ca\n (const V p, std::vector< V > &P)\n \n \n \n conformingmerge.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00098.html\n- dune/grid-glue/merging/standardmerge.hh\n+ a00068.html\n+ dune/grid-glue/merging/standardmerge.hh\n Dune::GridGlue::ConformingMerge\n Dune\n Dune::GridGlue\n \n \n contactmerge.cc\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00083.html\n- dune/grid-glue/common/crossproduct.hh\n+ a00092.html\n+ dune/grid-glue/common/crossproduct.hh\n dune/grid-glue/common/projection.hh\n Dune\n Dune::GridGlue\n \n \n contactmerge.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00071.html\n- dune/grid-glue/merging/standardmerge.hh\n+ a00086.html\n+ dune/grid-glue/merging/standardmerge.hh\n dune/grid-glue/gridglue.hh\n- contactmerge.cc\n+ contactmerge.cc\n Dune::GridGlue::ContactMerge\n Dune\n Dune::GridGlue\n \n \n intersectionlist.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00074.html\n+ a00083.html\n Dune::GridGlue::IntersectionListProvider\n Dune::GridGlue::IntersectionList\n Dune::GridGlue::SimplicialIntersectionListProvider\n Dune::GridGlue::SimplicialIntersectionListProvider::SimplicialIntersection\n Dune\n Dune::GridGlue\n \n \n merger.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00086.html\n- dune/grid-glue/merging/intersectionlist.hh\n+ a00071.html\n+ dune/grid-glue/merging/intersectionlist.hh\n Dune::GridGlue::Merger\n Dune\n Dune::GridGlue\n \n \n overlappingmerge.cc\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n@@ -524,26 +524,26 @@\n ad63267c6d27a8f09d98506419b206db8\n \n \n \n \n overlappingmerge.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00077.html\n- dune/grid-glue/merging/standardmerge.hh\n- dune/grid-glue/merging/computeintersection.hh\n+ a00065.html\n+ dune/grid-glue/merging/standardmerge.hh\n+ dune/grid-glue/merging/computeintersection.hh\n overlappingmerge.cc\n Dune::GridGlue::OverlappingMerge\n Dune\n Dune::GridGlue\n \n \n simplexintersection.cc\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00092.html\n+ a00080.html\n Dune::GridGlue::SimplexMethod\n Dune::GridGlue::SimplexMethod< dimWorld, 0, 0, T >\n Dune::GridGlue::SimplexMethod< dimWorld, 0, 1, T >\n Dune::GridGlue::SimplexMethod< dimWorld, 0, 2, T >\n Dune::GridGlue::SimplexMethod< dimWorld, 0, 3, T >\n Dune::GridGlue::SimplexMethod< dimWorld, 1, 1, T >\n Dune::GridGlue::SimplexMethod< dimWorld, 1, 2, T >\n@@ -581,29 +581,29 @@\n a697e604ca453c314141e6b4c5efe3eab\n (std::integral_constant< int, 3 >, const std::vector< Dune::FieldVector< T, dimworld > > &elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)\n \n \n \n standardmerge.cc\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00068.html\n- standardmerge.hh\n+ a00095.html\n+ standardmerge.hh\n Dune\n Dune::GridGlue\n \n #define\n DECL\n- a00068.html\n+ a00095.html\n ad5c7ca0181fea7823b37d06d5f61e9cd\n \n \n \n #define\n STANDARD_MERGE_INSTANTIATE\n- a00068.html\n+ a00095.html\n a4a2b0f7fb92723749fc6d5cca82a4297\n (T, A, B, C)\n \n \n \n STANDARD_MERGE_INSTANTIATE\n a00104.html\n@@ -624,32 +624,32 @@\n aa1057477f7967001ea15f5928e90f84c\n (double, 3, 3, 3)\n \n \n \n standardmerge.hh\n /build/reproducible-path/dune-grid-glue-2.9.0/dune/grid-glue/merging/\n- a00095.html\n- dune/grid-glue/merging/intersectionlist.hh\n- dune/grid-glue/merging/merger.hh\n- dune/grid-glue/merging/computeintersection.hh\n+ a00098.html\n+ dune/grid-glue/merging/intersectionlist.hh\n+ dune/grid-glue/merging/merger.hh\n+ dune/grid-glue/merging/computeintersection.hh\n Dune::GridGlue::StandardMerge\n Dune\n Dune::GridGlue\n \n #define\n DECL\n- a00095.html\n+ a00098.html\n ad5c7ca0181fea7823b37d06d5f61e9cd\n \n \n \n #define\n STANDARD_MERGE_INSTANTIATE\n- a00095.html\n+ a00098.html\n a4a2b0f7fb92723749fc6d5cca82a4297\n (T, A, B, C)\n \n \n \n STANDARD_MERGE_INSTANTIATE\n a00104.html\n"}]}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/files.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/files.html", "unified_diff": "@@ -66,50 +66,50 @@\n \n
    \n
    Here is a list of all files with brief descriptions:
    \n
    [detail level 1234]
    \n \n \n \n-\n+\n \n-\n-\n+\n+\n \n \n \n-\n-\n+\n+\n \n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n-\n+\n+\n+\n+\n \n \n \n \n \n \n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n \n-\n-\n-\n-\n+\n+\n+\n+\n \n
      dune
      grid-glue
      adapter
     gridglue.cc
     gridglue.cc
     adapter/gridglue.hh
     gridglueamirawriter.hhWrite all remote intersections to a AmiraMesh file
     gridgluecommunicate.hhDescribes the parallel communication interface class for Dune::GridGlue
     gridglueamirawriter.hhWrite all remote intersections to a AmiraMesh file
     gridgluecommunicate.hhDescribes the parallel communication interface class for Dune::GridGlue
     gridgluevtkwriter.hhWrite all remote intersections to a vtk file for debugging
     intersection.hhModel of the Intersection concept provided by GridGlue
     intersectionindexset.hh
     intersectioniterator.hhImplement iterators over GridGlue intersections
     rangegenerators.hh
     intersectioniterator.hhImplement iterators over GridGlue intersections
     rangegenerators.hh
      common
     areawriter.hh
     areawriter_impl.hh
     crossproduct.hh
     areawriter.hh
     areawriter_impl.hh
     crossproduct.hh
     projection.hh
     projection_impl.hh
     projectionwriter.hh
     projectionwriter_impl.hh
     ringcomm.hh
     projection_impl.hh
     projectionwriter.hh
     projectionwriter_impl.hh
     ringcomm.hh
      extractors
     codim0extractor.hhMesh grid extractor base class
     codim1extractor.hhGrid extractor class for codim 1 subgrids
     extractor.hhExtractor base class
     vtksurfacewriter.hhHelper class for graphical output of grids in generic representation
      merging
     computeintersection.cc
     computeintersection.hh
     conformingmerge.hhImplementation of the Merger concept for conforming interfaces
     contactmerge.cc
     contactmerge.hhMerge two grid boundary surfaces that may be a positive distance apart
     intersectionlist.hh
     merger.hh
     computeintersection.cc
     computeintersection.hh
     conformingmerge.hhImplementation of the Merger concept for conforming interfaces
     contactmerge.cc
     contactmerge.hhMerge two grid boundary surfaces that may be a positive distance apart
     intersectionlist.hh
     merger.hh
     overlappingmerge.cc
     overlappingmerge.hh
     simplexintersection.cc
     standardmerge.cc
     standardmerge.hhCommon base class for many merger implementations: produce pairs of entities that may intersect
     overlappingmerge.hh
     simplexintersection.cc
     standardmerge.cc
     standardmerge.hhCommon base class for many merger implementations: produce pairs of entities that may intersect
     gridglue.hhCentral component of the module implementing the coupling of two grids
    \n
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/globals.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/globals.html", "unified_diff": "@@ -59,19 +59,19 @@\n \n \n \n
    \n
    Here is a list of all file members with links to the files they belong to:
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/globals_defs.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/globals_defs.html", "unified_diff": "@@ -59,19 +59,19 @@\n \n \n \n
    \n  \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n"}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html", "comments": ["Files 17% similar despite different names"], "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-dune-grid-glue: gridglueamirawriter.hh Source File\n+dune-grid-glue: conformingmerge.hh Source File\n \n \n \n \n \n \n \n@@ -58,166 +58,220 @@\n \n \n \n \n \n
    \n-
    gridglueamirawriter.hh
    \n+
    conformingmerge.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n-
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n-
    8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
    \n-
    9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
    \n-
    10
    \n-
    11#include <fstream>
    \n-
    12#include <sstream>
    \n-
    13#include <type_traits>
    \n-
    14
    \n-
    15namespace Dune {
    \n-
    16namespace GridGlue {
    \n-
    17
    \n-\n-
    21{
    \n-
    22
    \n-
    26 template <class Glue, int side>
    \n-
    27 static void writeIntersections(const Glue& glue, const std::string& filename)
    \n-
    28 {
    \n-
    29 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
    \n-
    30
    \n-
    31 std::ofstream fgrid;
    \n-
    32
    \n-
    33 fgrid.open(filename.c_str());
    \n-
    34
    \n-
    35 using GridView = typename Glue::template GridView<side>;
    \n-
    36 const int dim = GridView::dimension;
    \n-
    37 const int domdimw = GridView::dimensionworld;
    \n-
    38
    \n-
    39 // coordinates have to be in R^3 in the VTK format
    \n-
    40 std::string coordinatePadding;
    \n-
    41 for (int i=domdimw; i<3; i++)
    \n-
    42 coordinatePadding += " 0";
    \n-
    43
    \n-
    44 int overlaps = glue.size();
    \n-
    45
    \n-
    46 if (dim==3) {
    \n-
    47
    \n-
    48 fgrid << "# HyperSurface 0.1 ASCII \\n" << std::endl;
    \n-
    49 fgrid<<"\\n";
    \n-
    50 fgrid<<"Parameters {\\n";
    \n-
    51 fgrid<<" Materials {\\n";
    \n-
    52 fgrid<<" outside {\\n";
    \n-
    53 fgrid<<" Id 0\\n";
    \n-
    54 fgrid<<" }\\n";
    \n-
    55 fgrid<<" inside {\\n";
    \n-
    56 fgrid<<" Id 1\\n";
    \n-
    57 fgrid<<" }\\n";
    \n-
    58 fgrid<<" }\\n";
    \n-
    59 fgrid<<"\\n";
    \n-
    60 fgrid<<"}\\n";
    \n-
    61
    \n-
    62 // ////////////////////////////////////////////
    \n-
    63 // Write vertices
    \n-
    64 // ////////////////////////////////////////////
    \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 \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n+
    4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n+
    5/*
    \n+
    6 * Filename: conformingmerge.hh
    \n+
    7 * Version: 1.0
    \n+
    8 * Created on: Sep 14, 2009
    \n+
    9 * Author: Oliver Sander
    \n+
    10 * ---------------------------------
    \n+
    11 * Project: dune-grid-glue
    \n+
    12 * Description: implementation of the Merger concept for conforming interfaces
    \n+
    13 *
    \n+
    14 */
    \n+
    21#ifndef DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
    \n+
    22#define DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
    \n+
    23
    \n+
    24#include <iomanip>
    \n+
    25#include <vector>
    \n+
    26#include <algorithm>
    \n+
    27#include <bitset>
    \n+
    28
    \n+
    29#include <dune/common/fmatrix.hh>
    \n+
    30#include <dune/common/fvector.hh>
    \n+
    31
    \n+
    32#include <dune/geometry/referenceelements.hh>
    \n+
    33
    \n+\n+
    35
    \n+
    36namespace Dune {
    \n+
    37
    \n+
    38 namespace GridGlue {
    \n+
    39
    \n+
    46template<int dim, int dimworld, typename T = double>
    \n+\n+
    48 : public StandardMerge<T,dim,dim,dimworld>
    \n+
    49{
    \n+
    50
    \n+
    51public:
    \n+
    52
    \n+
    53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
    \n+
    54
    \n+
    56 typedef T ctype;
    \n+
    57
    \n+
    59 typedef Dune::FieldVector<T, dimworld> WorldCoords;
    \n+
    60
    \n+
    62 typedef Dune::FieldVector<T, dim> LocalCoords;
    \n+
    63
    \n+
    64private:
    \n
    65
    \n-
    66 //use dim and not dim+1
    \n-
    67 fgrid<<"\\nVertices "<< overlaps*(dim)<<"\\n";
    \n-
    68 auto isEnd = glue.template iend<side>();
    \n-
    69 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt)
    \n-
    70 {
    \n-
    71 const auto& geometry = isIt->geometry();
    \n-
    72 for (int i = 0; i < geometry.corners(); ++i)
    \n-
    73 fgrid << geometry.corner(i) << coordinatePadding << std::endl;
    \n-
    74 }
    \n-
    75
    \n-
    76 // ////////////////////////////////////////////
    \n-
    77 // Write triangles
    \n-
    78 // ////////////////////////////////////////////
    \n-
    79
    \n-
    80 fgrid<<"NBranchingPoints 0\\n";
    \n-
    81 fgrid<<"NVerticesOnCurves 0\\n";
    \n-
    82 fgrid<<"BoundaryCurves 0\\n";
    \n-
    83 fgrid<<"Patches 1\\n";
    \n-
    84 fgrid<<"{\\n";
    \n-
    85 fgrid<<"InnerRegion inside\\n";
    \n-
    86 fgrid<<"OuterRegion outside\\n";
    \n-
    87 fgrid<<"BoundaryID 0\\n";
    \n-
    88 fgrid<<"BranchingPoints 0";
    \n-
    89 fgrid<<"\\n";
    \n+
    66 /* M E M B E R V A R I A B L E S */
    \n+
    67
    \n+
    69 T tolerance_;
    \n+
    70
    \n+
    71 typedef typename StandardMerge<T,dim,dim,dimworld>::SimplicialIntersection SimplicialIntersection;
    \n+
    72
    \n+
    77 void computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n+
    78 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n+
    79 std::bitset<(1<<dim)>& neighborIntersects1,
    \n+
    80 unsigned int grid1Index,
    \n+
    81 const Dune::GeometryType& grid2ElementType,
    \n+
    82 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n+
    83 std::bitset<(1<<dim)>& neighborIntersects2,
    \n+
    84 unsigned int grid2Index,
    \n+
    85 std::vector<SimplicialIntersection>& intersections);
    \n+
    86
    \n+
    87public:
    \n+
    88
    \n+
    89 static constexpr T default_tolerance = 1e-4;
    \n
    90
    \n-
    91 fgrid<<"Triangles "<<overlaps<<std::endl;
    \n-
    92
    \n-
    93 for (int i=0;i<overlaps; i++)
    \n-
    94 fgrid<<i*dim+1<<" "<<i*dim+2<<" "<<i*dim+3<<std::endl;
    \n-
    95 fgrid<<"}\\n";
    \n-
    96
    \n-
    97 } else if (dim==2) {
    \n+\n+
    92 tolerance_(tolerance)
    \n+
    93 {}
    \n+
    94};
    \n+
    95
    \n+
    96template<int dim, int dimworld, typename T>
    \n+\n
    98
    \n-
    99 fgrid << "# AmiraMesh 3D ASCII 2.0 \\n";
    \n-
    100 fgrid<<"\\n";
    \n-
    101 fgrid<<"define Lines "<<3*overlaps<<"\\n";
    \n-
    102 fgrid<<"nVertices "<<2*overlaps<<"\\n";
    \n-
    103 fgrid<<"\\n";
    \n-
    104 fgrid<<"Parameters {\\n";
    \n-
    105 fgrid<<" ContentType \\"HxLineSet\\" \\n";
    \n-
    106 fgrid<<"}\\n";
    \n-
    107 fgrid<<"\\n";
    \n-
    108 fgrid<<"Lines { int LineIdx } @1\\n";
    \n-
    109 fgrid<<"Vertices { float[3] Coordinates } @2\\n";
    \n-
    110 fgrid<<"\\n";
    \n-
    111 fgrid<<"# Data section follows\\n";
    \n-
    112 fgrid<<"@1 \\n";
    \n-
    113 for (int i=0; i<overlaps;i++)
    \n-
    114 fgrid<<2*i<<"\\n"<<2*i+1<<"\\n"<<-1<<"\\n";
    \n-
    115 fgrid<<"\\n";
    \n-
    116 fgrid<<"@2 \\n";
    \n-
    117
    \n-
    118 auto isEnd = glue.template iend<side>();
    \n-
    119 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt) {
    \n-
    120 const auto& geometry = isIt->geometry();
    \n-
    121 for (int i = 0; i <2; ++i)
    \n-
    122 fgrid << geometry.corner(i) <<" "<<0<<"\\n";
    \n-
    123 }
    \n-
    124 }
    \n-
    125
    \n-
    126 fgrid.close();
    \n-
    127 }
    \n-
    128
    \n-
    129public:
    \n-
    130 template<typename Glue>
    \n-
    131 static void write(const Glue& glue, const std::string& path, int appendix=1)
    \n-
    132 {
    \n-
    133 std::ostringstream name0;
    \n-
    134 name0 << path;
    \n-
    135 name0 << "/domain.surf" << std::setw(3) << std::setfill('0') << appendix;
    \n+
    99template<int dim, int dimworld, typename T>
    \n+
    100void ConformingMerge<dim, dimworld, T>::computeIntersections(const Dune::GeometryType& grid1ElementType,
    \n+
    101 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
    \n+
    102 std::bitset<(1<<dim)>& neighborIntersects1,
    \n+
    103 unsigned int grid1Index,
    \n+
    104 const Dune::GeometryType& grid2ElementType,
    \n+
    105 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
    \n+
    106 std::bitset<(1<<dim)>& neighborIntersects2,
    \n+
    107 unsigned int grid2Index,
    \n+
    108 std::vector<SimplicialIntersection>& intersections)
    \n+
    109{
    \n+
    110 this->counter++;
    \n+
    111
    \n+
    112 // A few consistency checks
    \n+
    113 assert((unsigned int)(Dune::ReferenceElements<T,dim>::general(grid1ElementType).size(dim)) == grid1ElementCorners.size());
    \n+
    114 assert((unsigned int)(Dune::ReferenceElements<T,dim>::general(grid2ElementType).size(dim)) == grid2ElementCorners.size());
    \n+
    115 // any intersection we may find will be the entire elements.
    \n+
    116 neighborIntersects1.reset();
    \n+
    117 neighborIntersects2.reset();
    \n+
    118
    \n+
    119 // the intersection is either conforming or empty, hence the GeometryTypes have to match
    \n+
    120 if (grid1ElementType != grid2ElementType)
    \n+
    121 return;
    \n+
    122
    \n+
    123 // ////////////////////////////////////////////////////////////
    \n+
    124 // Find correspondences between the different corners
    \n+
    125 // ////////////////////////////////////////////////////////////
    \n+
    126 std::vector<int> other(grid1ElementCorners.size(), -1);
    \n+
    127
    \n+
    128 for (unsigned int i=0; i<grid1ElementCorners.size(); i++) {
    \n+
    129
    \n+
    130 for (unsigned int j=0; j<grid2ElementCorners.size(); j++) {
    \n+
    131
    \n+
    132 if ( (grid1ElementCorners[i]-grid2ElementCorners[j]).two_norm() < tolerance_ ) {
    \n+
    133
    \n+
    134 other[i] = j;
    \n+
    135 break;
    \n
    136
    \n-
    137 // Write extracted grid and remote intersection on the grid1-side
    \n-
    138 writeIntersections<Glue,0>(glue,name0.str());
    \n-
    139
    \n-
    140 std::ostringstream name1;
    \n-
    141 name1 << path;
    \n-
    142 name1 << "/target.surf" << std::setw(3) << std::setfill('0') << appendix;
    \n-
    143
    \n-
    144 writeIntersections<Glue,1>(glue, name1.str());
    \n+
    137 }
    \n+
    138
    \n+
    139 }
    \n+
    140
    \n+
    141 // No corresponding grid2 vertex found for this grid1 vertex
    \n+
    142 if (other[i] == -1)
    \n+
    143 return;
    \n+
    144
    \n
    145 }
    \n
    146
    \n-
    147};
    \n-
    148
    \n-
    149} // namespace GridGlue
    \n-
    150} // namespace Dune
    \n-
    151
    \n-
    152#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
    \n+
    147 // ////////////////////////////////////////////////////////////
    \n+
    148 // Set up the new remote intersection
    \n+
    149 // ////////////////////////////////////////////////////////////
    \n+
    150
    \n+
    151 const auto& refElement = Dune::ReferenceElements<T,dim>::general(grid1ElementType);
    \n+
    152
    \n+
    154 if (grid1ElementType.isSimplex()) {
    \n+
    155
    \n+
    156 intersections.emplace_back(grid1Index, grid2Index);
    \n+
    157
    \n+
    158 for (int i=0; i<refElement.size(dim); i++) {
    \n+
    159 intersections.back().corners0[0][i] = refElement.position(i,dim);
    \n+
    160 intersections.back().corners1[0][i] = refElement.position(other[i],dim);
    \n+
    161 }
    \n+
    162
    \n+
    163 } else if (dim == 2 && grid1ElementType.isQuadrilateral()) {
    \n+
    164
    \n+
    165 // split the quadrilateral into two triangles
    \n+
    166 const unsigned int subVertices[2][3] = {{0,1,3}, {0,3,2}};
    \n+
    167
    \n+
    168 for (int i=0; i<2; i++) {
    \n+
    169
    \n+
    170 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index);
    \n+
    171
    \n+
    172 for (int j=0; j<dim+1; j++) {
    \n+
    173 newSimplicialIntersection.corners0[0][j] = refElement.position(subVertices[i][j],dim);
    \n+
    174 newSimplicialIntersection.corners1[0][j] = refElement.position(subVertices[i][other[j]],dim);
    \n+
    175 }
    \n+
    176
    \n+
    177 intersections.push_back(newSimplicialIntersection);
    \n+
    178
    \n+
    179 }
    \n+
    180
    \n+
    181 } else if (grid1ElementType.isHexahedron()) {
    \n+
    182
    \n+
    183 // split the hexahedron into five tetrahedra
    \n+
    184 // This can be removed if ever we allow Intersections that are not simplices
    \n+
    185 const unsigned int subVertices[5][4] = {{0,1,3,5}, {0,3,2,6}, {4,5,0,6}, {6,7,6,3}, {6,0,5,3}};
    \n+
    186
    \n+
    187 for (int i=0; i<5; i++) {
    \n+
    188
    \n+
    189 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index);
    \n+
    190
    \n+
    191 for (int j=0; j<dim+1; j++) {
    \n+
    192 newSimplicialIntersection.corners0[0][j] = refElement.position(subVertices[i][j],dim);
    \n+
    193 newSimplicialIntersection.corners1[0][j] = refElement.position(subVertices[i][other[j]],dim);
    \n+
    194 }
    \n+
    195
    \n+
    196 intersections.push_back(newSimplicialIntersection);
    \n+
    197
    \n+
    198 }
    \n+
    199
    \n+
    200 } else
    \n+
    201 DUNE_THROW(Dune::GridError, "Unsupported element type");
    \n+
    202
    \n+
    203}
    \n+
    204
    \n+
    205} // namespace GridGlue
    \n+
    206
    \n+
    207} // namespace Dune
    \n+
    208
    \n+
    209#endif // DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
    \n+
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    \n
    Definition: gridglue.hh:37
    \n-
    Write remote intersections to a AmiraMesh file for debugging purposes.
    Definition: gridglueamirawriter.hh:21
    \n-
    static void write(const Glue &glue, const std::string &path, int appendix=1)
    Definition: gridglueamirawriter.hh:131
    \n+
    IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
    Iterate over all intersections of a GridGlue.
    \n+
    Implementation of the Merger concept for conforming interfaces.
    Definition: conformingmerge.hh:49
    \n+
    Dune::FieldVector< T, dim > LocalCoords
    the coordinate type used in this interface
    Definition: conformingmerge.hh:62
    \n+
    Dune::FieldVector< T, dimworld > WorldCoords
    the coordinate type used in this interface
    Definition: conformingmerge.hh:59
    \n+
    static constexpr T default_tolerance
    Definition: conformingmerge.hh:89
    \n+
    T ctype
    the numeric type used in this interface
    Definition: conformingmerge.hh:56
    \n+
    ConformingMerge(T tolerance=default_tolerance)
    Definition: conformingmerge.hh:91
    \n+
    Common base class for many merger implementations: produce pairs of entities that may intersect.
    Definition: standardmerge.hh:58
    \n+
    typename IntersectionListProvider::SimplicialIntersection SimplicialIntersection
    Definition: standardmerge.hh:83
    \n
    \n \n
    \n Generated by \"doxygen\"/ 1.9.4\n
    \n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,167 +4,255 @@\n \n \n dune-grid-glue\u00a02.9\n \n \n * dune\n * grid-glue\n- * adapter\n-gridglueamirawriter.hh\n+ * merging\n+conformingmerge.hh\n Go_to_the_documentation_of_this_file.\n- 1// SPDX-FileCopyrightInfo: Copyright \u00a9 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 \u00a9 DUNE Project contributors, see file\n LICENSE.md in module root\n- 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n+ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-\n with-dune-grid-glue-exception\n- 8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH\n- 9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH\n- 10\n- 11#include \n- 12#include \n- 13#include \n- 14\n- 15namespace Dune {\n- 16namespace GridGlue {\n- 17\n-20class GridGlueAmiraWriter\n- 21{\n- 22\n- 26 template \n- 27 static void writeIntersections(const Glue& glue, const std::string&\n-filename)\n- 28 {\n- 29 static_assert((side==0 || side==1), \"'side' can only be 0 or 1\");\n- 30\n- 31 std::ofstream fgrid;\n- 32\n- 33 fgrid.open(filename.c_str());\n- 34\n- 35 using GridView = typename Glue::template GridView;\n- 36 const int dim = GridView::dimension;\n- 37 const int domdimw = GridView::dimensionworld;\n- 38\n- 39 // coordinates have to be in R^3 in the VTK format\n- 40 std::string coordinatePadding;\n- 41 for (int i=domdimw; i<3; i++)\n- 42 coordinatePadding += \" 0\";\n- 43\n- 44 int overlaps = glue.size();\n- 45\n- 46 if (dim==3) {\n- 47\n- 48 fgrid << \"# HyperSurface 0.1 ASCII \\n\" << std::endl;\n- 49 fgrid<<\"\\n\";\n- 50 fgrid<<\"Parameters {\\n\";\n- 51 fgrid<<\" Materials {\\n\";\n- 52 fgrid<<\" outside {\\n\";\n- 53 fgrid<<\" Id 0\\n\";\n- 54 fgrid<<\" }\\n\";\n- 55 fgrid<<\" inside {\\n\";\n- 56 fgrid<<\" Id 1\\n\";\n- 57 fgrid<<\" }\\n\";\n- 58 fgrid<<\" }\\n\";\n- 59 fgrid<<\"\\n\";\n- 60 fgrid<<\"}\\n\";\n- 61\n- 62 // ////////////////////////////////////////////\n- 63 // Write vertices\n- 64 // ////////////////////////////////////////////\n+ 5/*\n+ 6 * Filename: conformingmerge.hh\n+ 7 * Version: 1.0\n+ 8 * Created on: Sep 14, 2009\n+ 9 * Author: Oliver Sander\n+ 10 * ---------------------------------\n+ 11 * Project: dune-grid-glue\n+ 12 * Description: implementation of the Merger concept for conforming\n+interfaces\n+ 13 *\n+ 14 */\n+ 21#ifndef DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH\n+ 22#define DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH\n+ 23\n+ 24#include \n+ 25#include \n+ 26#include \n+ 27#include \n+ 28\n+ 29#include \n+ 30#include \n+ 31\n+ 32#include \n+ 33\n+ 34#include \n+ 35\n+ 36namespace Dune {\n+ 37\n+ 38 namespace GridGlue {\n+ 39\n+ 46template\n+47class ConformingMerge\n+ 48 : public StandardMerge\n+ 49{\n+ 50\n+ 51public:\n+ 52\n+ 53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */\n+ 54\n+56 typedef T ctype;\n+ 57\n+59 typedef Dune::FieldVector WorldCoords;\n+ 60\n+62 typedef Dune::FieldVector LocalCoords;\n+ 63\n+ 64private:\n 65\n- 66 //use dim and not dim+1\n- 67 fgrid<<\"\\nVertices \"<< overlaps*(dim)<<\"\\n\";\n- 68 auto isEnd = glue.template iend();\n- 69 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt)\n- 70 {\n- 71 const auto& geometry = isIt->geometry();\n- 72 for (int i = 0; i < geometry.corners(); ++i)\n- 73 fgrid << geometry.corner(i) << coordinatePadding << std::endl;\n- 74 }\n- 75\n- 76 // ////////////////////////////////////////////\n- 77 // Write triangles\n- 78 // ////////////////////////////////////////////\n- 79\n- 80 fgrid<<\"NBranchingPoints 0\\n\";\n- 81 fgrid<<\"NVerticesOnCurves 0\\n\";\n- 82 fgrid<<\"BoundaryCurves 0\\n\";\n- 83 fgrid<<\"Patches 1\\n\";\n- 84 fgrid<<\"{\\n\";\n- 85 fgrid<<\"InnerRegion inside\\n\";\n- 86 fgrid<<\"OuterRegion outside\\n\";\n- 87 fgrid<<\"BoundaryID 0\\n\";\n- 88 fgrid<<\"BranchingPoints 0\";\n- 89 fgrid<<\"\\n\";\n+ 66 /* M E M B E R V A R I A B L E S */\n+ 67\n+ 69 T tolerance_;\n+ 70\n+ 71 typedef typename StandardMerge::SimplicialIntersection\n+SimplicialIntersection;\n+ 72\n+ 77 void computeIntersections(const Dune::GeometryType& grid1ElementType,\n+ 78 const std::vector >& grid1ElementCorners,\n+ 79 std::bitset<(1<& neighborIntersects1,\n+ 80 unsigned int grid1Index,\n+ 81 const Dune::GeometryType& grid2ElementType,\n+ 82 const std::vector >& grid2ElementCorners,\n+ 83 std::bitset<(1<& neighborIntersects2,\n+ 84 unsigned int grid2Index,\n+ 85 std::vector& intersections);\n+ 86\n+ 87public:\n+ 88\n+89 static constexpr T default_tolerance = 1e-4;\n 90\n- 91 fgrid<<\"Triangles \"<\n+ 97constexpr T ConformingMerge::default_tolerance;\n 98\n- 99 fgrid << \"# AmiraMesh 3D ASCII 2.0 \\n\";\n- 100 fgrid<<\"\\n\";\n- 101 fgrid<<\"define Lines \"<<3*overlaps<<\"\\n\";\n- 102 fgrid<<\"nVertices \"<<2*overlaps<<\"\\n\";\n- 103 fgrid<<\"\\n\";\n- 104 fgrid<<\"Parameters {\\n\";\n- 105 fgrid<<\" ContentType \\\"HxLineSet\\\" \\n\";\n- 106 fgrid<<\"}\\n\";\n- 107 fgrid<<\"\\n\";\n- 108 fgrid<<\"Lines { int LineIdx } @1\\n\";\n- 109 fgrid<<\"Vertices { float[3] Coordinates } @2\\n\";\n- 110 fgrid<<\"\\n\";\n- 111 fgrid<<\"# Data section follows\\n\";\n- 112 fgrid<<\"@1 \\n\";\n- 113 for (int i=0; i();\n- 119 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt) {\n- 120 const auto& geometry = isIt->geometry();\n- 121 for (int i = 0; i <2; ++i)\n- 122 fgrid << geometry.corner(i) <<\" \"<<0<<\"\\n\";\n- 123 }\n- 124 }\n- 125\n- 126 fgrid.close();\n- 127 }\n- 128\n- 129public:\n- 130 template\n-131 static void write(const Glue& glue, const std::string& path, int\n-appendix=1)\n- 132 {\n- 133 std::ostringstream name0;\n- 134 name0 << path;\n- 135 name0 << \"/domain.surf\" << std::setw(3) << std::setfill('0') << appendix;\n+ 99template\n+ 100void ConformingMerge::computeIntersections(const Dune::\n+GeometryType& grid1ElementType,\n+ 101 const std::vector >& grid1ElementCorners,\n+ 102 std::bitset<(1<& neighborIntersects1,\n+ 103 unsigned int grid1Index,\n+ 104 const Dune::GeometryType& grid2ElementType,\n+ 105 const std::vector >& grid2ElementCorners,\n+ 106 std::bitset<(1<& neighborIntersects2,\n+ 107 unsigned int grid2Index,\n+ 108 std::vector& intersections)\n+ 109{\n+ 110 this->counter++;\n+ 111\n+ 112 // A few consistency checks\n+ 113 assert((unsigned int)(Dune::ReferenceElements::general\n+(grid1ElementType).size(dim)) == grid1ElementCorners.size());\n+ 114 assert((unsigned int)(Dune::ReferenceElements::general\n+(grid2ElementType).size(dim)) == grid2ElementCorners.size());\n+ 115 // any intersection we may find will be the entire elements.\n+ 116 neighborIntersects1.reset();\n+ 117 neighborIntersects2.reset();\n+ 118\n+ 119 // the intersection is either conforming or empty, hence the GeometryTypes\n+have to match\n+ 120 if (grid1ElementType != grid2ElementType)\n+ 121 return;\n+ 122\n+ 123 // ////////////////////////////////////////////////////////////\n+ 124 // Find correspondences between the different corners\n+ 125 // ////////////////////////////////////////////////////////////\n+ 126 std::vector other(grid1ElementCorners.size(), -1);\n+ 127\n+ 128 for (unsigned int i=0; i(glue,name0.str());\n- 139\n- 140 std::ostringstream name1;\n- 141 name1 << path;\n- 142 name1 << \"/target.surf\" << std::setw(3) << std::setfill('0') << appendix;\n- 143\n- 144 writeIntersections(glue, name1.str());\n+ 137 }\n+ 138\n+ 139 }\n+ 140\n+ 141 // No corresponding grid2 vertex found for this grid1 vertex\n+ 142 if (other[i] == -1)\n+ 143 return;\n+ 144\n 145 }\n 146\n- 147};\n- 148\n- 149} // namespace GridGlue\n- 150} // namespace Dune\n- 151\n- 152#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH\n+ 147 // ////////////////////////////////////////////////////////////\n+ 148 // Set up the new remote intersection\n+ 149 // ////////////////////////////////////////////////////////////\n+ 150\n+ 151 const auto& refElement = Dune::ReferenceElements::general\n+(grid1ElementType);\n+ 152\n+ 154 if (grid1ElementType.isSimplex()) {\n+ 155\n+ 156 intersections.emplace_back(grid1Index, grid2Index);\n+ 157\n+ 158 for (int i=0; i intersections(const GridGlue<... > &glue, const Reverse<...\n+> &reverse=!reversed)\n+Iterate over all intersections of a GridGlue.\n+Dune::GridGlue::ConformingMerge\n+Implementation of the Merger concept for conforming interfaces.\n+Definition: conformingmerge.hh:49\n+Dune::GridGlue::ConformingMerge::LocalCoords\n+Dune::FieldVector< T, dim > LocalCoords\n+the coordinate type used in this interface\n+Definition: conformingmerge.hh:62\n+Dune::GridGlue::ConformingMerge::WorldCoords\n+Dune::FieldVector< T, dimworld > WorldCoords\n+the coordinate type used in this interface\n+Definition: conformingmerge.hh:59\n+Dune::GridGlue::ConformingMerge::default_tolerance\n+static constexpr T default_tolerance\n+Definition: conformingmerge.hh:89\n+Dune::GridGlue::ConformingMerge::ctype\n+T ctype\n+the numeric type used in this interface\n+Definition: conformingmerge.hh:56\n+Dune::GridGlue::ConformingMerge::ConformingMerge\n+ConformingMerge(T tolerance=default_tolerance)\n+Definition: conformingmerge.hh:91\n+Dune::GridGlue::StandardMerge\n+Common base class for many merger implementations: produce pairs of entities\n+that may intersect.\n+Definition: standardmerge.hh:58\n+Dune::GridGlue::StandardMerge::SimplicialIntersection\n+typename IntersectionListProvider::SimplicialIntersection\n+SimplicialIntersection\n+Definition: standardmerge.hh:83\n \n ===============================================================================\n Generated by\u00a0[doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html", "source2": "./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html", "comments": ["Files 0% similar despite different names"], "unified_diff": "@@ -65,15 +65,15 @@\n
  • dune
  • grid-glue
  • merging
  • \n
    \n \n
    \n
    intersectionlist.hh
    \n
    \n
    \n-Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n+Go to the documentation of this file.
    1// SPDX-FileCopyrightInfo: Copyright \u00a9 DUNE Project contributors, see file LICENSE.md in module root
    \n
    2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
    \n
    3#ifndef DUNE_GRIDGLUE_MERGING_INTERSECTIONLIST_HH
    \n
    4#define DUNE_GRIDGLUE_MERGING_INTERSECTIONLIST_HH 1
    \n
    5
    \n
    6#include <array>
    \n
    7#include <type_traits>
    \n
    8#include <utility>
    \n"}]}]}]}]}